mirror of
https://github.com/CorentinTh/it-tools.git
synced 2025-05-05 13:57:10 -04:00
1 line
2.1 KiB
JavaScript
1 line
2.1 KiB
JavaScript
import{b as U}from"./chunk-a740628f.js";import{d as V,r as m,c as _,j as Y,D as z,m as o,l as r,q as t,S as v,E as f,z as g,F as D,K as R}from"./chunk-449c23a2.js";import{_ as k}from"./chunk-6deddc2e.js";import{u as b}from"./chunk-767079b6.js";import{u as y}from"./chunk-340feaf0.js";import{i as C}from"./chunk-c7e7c785.js";import{w}from"./chunk-4d6daddf.js";import"./chunk-9a43cce8.js";const N={flex:"","justify-center":""},T={flex:"","justify-center":""},S=V({__name:"url-encoder",setup(j){const n=m("Hello world :)"),i=_(()=>w(()=>encodeURIComponent(n.value),"")),x=y({source:n,rules:[{validator:a=>C(()=>encodeURIComponent(a)),message:"Impossible to parse this string"}]}),{copy:h}=b({source:i,text:"Encoded string copied to the clipboard"}),s=m("Hello%20world%20%3A)"),u=_(()=>w(()=>decodeURIComponent(s.value),"")),I=y({source:n,rules:[{validator:a=>C(()=>decodeURIComponent(a)),message:"Impossible to parse this string"}]}),{copy:E}=b({source:u,text:"Decoded string copied to the clipboard"});return(a,e)=>{const d=k,c=R,p=U;return Y(),z(D,null,[o(p,{title:"Encode"},{default:r(()=>[o(d,{value:t(n),"onUpdate:value":e[0]||(e[0]=l=>v(n)?n.value=l:null),label:"Your string :",validation:t(x),multiline:"",autosize:"",placeholder:"The string to encode",rows:"2","mb-3":""},null,8,["value","validation"]),o(d,{label:"Your string encoded :",value:t(i),multiline:"",autosize:"",readonly:"",placeholder:"Your string encoded",rows:"2","mb-3":""},null,8,["value"]),f("div",N,[o(c,{onClick:e[1]||(e[1]=l=>t(h)())},{default:r(()=>[g(" Copy ")]),_:1})])]),_:1}),o(p,{title:"Decode"},{default:r(()=>[o(d,{value:t(s),"onUpdate:value":e[2]||(e[2]=l=>v(s)?s.value=l:null),label:"Your encoded string :",validation:t(I),multiline:"",autosize:"",placeholder:"The string to decode",rows:"2","mb-3":""},null,8,["value","validation"]),o(d,{label:"Your string decoded :",value:t(u),multiline:"",autosize:"",readonly:"",placeholder:"Your string decoded",rows:"2","mb-3":""},null,8,["value"]),f("div",T,[o(c,{onClick:e[3]||(e[3]=l=>t(E)())},{default:r(()=>[g(" Copy ")]),_:1})])]),_:1})],64)}}});export{S as default};
|