1import{d as D,u as T,q as G,x as X,o as p,c as f,b as r,g as u,f as s,h as y,I as b,t as c,i as k,y as J,F as $,e as E,n as _,p as R,r as C,D as w,a as Q,m as I,j as q,k as H,v as Y,E as Z,B as ee,C as te,w as z,G as oe}from"./index-X3ku3MSB.js";import{_ as se}from"./LocaleSwitcher.vue_vue_type_script_setup_true_lang-C0v4-J_q.js";import{_ as K}from"./index-DjFx_2kg.js";import{u as ne}from"./useSeoMeta-ANddsuqs.js";const le={class:"z-40 border-b border-slate-100/80 bg-white/70 backdrop-blur-xl"},re={class:"mx-auto flex h-16 max-w-4xl items-center justify-between px-6"},ce={class:"flex items-center gap-2.5"},ae={class:"flex h-8 w-8 items-center justify-center rounded-lg bg-slate-700"},ie={class:"text-lg font-bold tracking-tight text-slate-900"},de={class:"flex items-center gap-3"},ue={class:"hidden items-center gap-1.5 rounded-full bg-slate-100 px-3 py-1 text-xs font-semibold text-slate-600 sm:inline-flex"},he=D({__name:"EncodeHeader",setup(t){const{t:o}=T(),{homePath:e}=G();return(l,n)=>{const i=X("RouterLink");return p(),f("header",le,[r("div",re,[r("div",ce,[u(i,{to:s(e),class:"flex h-8 w-8 cursor-pointer items-center justify-center rounded-lg text-slate-400 transition-colors duration-200 hover:bg-slate-100 hover:text-slate-700",title:s(o)("common.backHome")},{default:y(()=>[u(s(b),{icon:"heroicons:home-20-solid",class:"h-5 w-5"})]),_:1},8,["to","title"]),r("div",ae,[u(s(b),{icon:"heroicons:command-line",class:"h-4.5 w-4.5 text-white"})]),r("span",ie,c(s(o)("encode.brand")),1)]),r("div",de,[r("span",ue,[u(s(b),{icon:"heroicons:lock-closed",class:"h-3.5 w-3.5"}),k(" "+c(s(o)("encode.privacyBadge")),1)]),u(se)])])])}}}),B="base64",L=[{id:"base64",labelKey:"encode.tools.base64",enabled:!0},{id:"url",labelKey:"encode.tools.url",enabled:!0},{id:"html",labelKey:"encode.tools.html",enabled:!0}];function pe(){return L.filter(t=>t.enabled)}function N(t){return t!=="base64"&&t!=="url"&&t!=="html"?B:L.find(e=>e.id===t&&e.enabled)?t:B}const fe={class:"mb-6 flex flex-wrap gap-2"},me=["onClick"],xe=D({__name:"EncodeToolTabs",props:{modelValue:{required:!0},modelModifiers:{}},emits:["update:modelValue"],setup(t){const o=J(t,"modelValue"),{t:e}=T(),l=pe(),n={base64:{active:"bg-slate-700 text-white shadow-sm shadow-slate-700/20",idle:"bg-white text-slate-700 ring-1 ring-slate-200 hover:bg-slate-50"},url:{active:"bg-neutral-700 text-white shadow-sm shadow-neutral-700/20",idle:"bg-white text-neutral-700 ring-1 ring-neutral-200 hover:bg-neutral-50"},html:{active:"bg-zinc-700 text-white shadow-sm shadow-zinc-700/20",idle:"bg-white text-zinc-700 ring-1 ring-zinc-200 hover:bg-zinc-50"}};return(i,a)=>(p(),f("div",fe,[(p(!0),f($,null,E(s(l),h=>(p(),f("button",{key:h.id,type:"button",class:_(s(R)("cursor-pointer rounded-lg px-4 py-2 text-sm font-semibold transition-colors",o.value===h.id?n[h.id].active:n[h.id].idle)),onClick:m=>o.value=h.id},c(s(e)(h.labelKey)),11,me))),128))]))}}),_e={"&":"&","<":"<",">":">",'"':""","'":"'"},be={amp:"&",lt:"<",gt:">",quot:'"',apos:"'"};function ve(t){let o="";for(const e of t)o+=String.fromCharCode(e);return btoa(o)}function ge(t){const o=t.replace(/\s+/g,""),e=atob(o),l=new Uint8Array(e.length);for(let n=0;n<e.length;n++)l[n]=e.charCodeAt(n);return l}function we(t){return ve(new TextEncoder().encode(t))}function ye(t){try{const o=ge(t);return{ok:!0,value:new TextDecoder("utf-8",{fatal:!0}).decode(o)}}catch{return{ok:!1,code:"invalid-base64"}}}function P(t,o){try{return{ok:!0,value:t(o)}}catch{return{ok:!1,code:"invalid-url-escape"}}}function ke(t,o="uri"){return P(o==="uri"?encodeURI:encodeURIComponent,t)}function Ce(t,o="uri"){return P(o==="uri"?decodeURI:decodeURIComponent,t)}function $e(t){let o="";for(const e of t)e==="&"||e==="<"||e===">"||e==='"'||e==="'"?o+=_e[e]:o+=e;return o}function Ee(t){if(t.startsWith("#x")||t.startsWith("#X")){const e=t.slice(2);if(!/^[0-9a-fA-F]+$/.test(e))return null;const l=Number.parseInt(e,16);if(!Number.isFinite(l)||l<0||l>1114111)return null;try{return String.fromCodePoint(l)}catch{return null}}if(t.startsWith("#")){const e=t.slice(1);if(!/^[0-9]+$/.test(e))return null;const l=Number.parseInt(e,10);if(!Number.isFinite(l)||l<0||l>1114111)return null;try{return String.fromCodePoint(l)}catch{return null}}const o=be[t];return o!==void 0?o:null}function De(t){let o="",e=0;for(;e<t.length;){const l=t[e];if(l!=="&"){o+=l,e+=1;continue}const n=t.indexOf(";",e+1);
1if(n===-1)return{ok:!1,code:"invalid-html"};const i=t.slice(e+1,n);if(i.length===0)return{ok:!1,code:"invalid-html"};const a=Ee(i);if(a===null)return{ok:!1,code:"invalid-html"};o+=a,e=n+1}return{ok:!0,value:o}}function Te(t,o,e,l){if(o==="encode")switch(t){case"base64":return{value:we(e),error:null};case"url":{const n=ke(e,l);return n.ok?{value:n.value,error:null}:{value:"",error:n.code}}case"html":return{value:$e(e),error:null}}switch(t){case"base64":{const n=ye(e);return n.ok?{value:n.value,error:null}:{value:"",error:n.code}}case"url":{const n=Ce(e,l);return n.ok?{value:n.value,error:null}:{value:"",error:n.code}}case"html":{const n=De(e);return n.ok?{value:n.value,error:null}:{value:"",error:n.code}}}}function Me(t){const o=C("encode"),e=C(""),l=C("uri"),n=w(()=>Te(t.value,o.value,e.value,l.value)),i=w(()=>n.value.value),a=w(()=>n.value.error),h=w(()=>a.value?`encode.errors.${a.value}`:null);function m(x){o.value=x}function v(x){l.value=x}function M(){const x=o.value==="encode"?"decode":"encode",g=i.value;o.value=x,g&&(e.value=g)}function U(){e.value="",o.value="encode"}return{direction:o,input:e,output:i,errorKey:h,urlMode:l,setDirection:m,setUrlMode:v,swapDirection:M,clearAll:U}}const Ue={class:"space-y-5"},Ie={class:"flex flex-wrap items-center justify-between gap-3"},Ke={class:"flex flex-wrap gap-2"},Ne=["onClick"],Re={class:"flex flex-wrap items-center gap-2"},Ve={key:0,class:"flex flex-wrap items-center gap-2"},ze=["onClick"],Be={class:"w-full text-xs text-slate-400"},Oe={key:1,class:"text-xs text-slate-400"},qe={class:"grid items-start gap-4 md:grid-cols-2"},He={class:"flex min-w-0 flex-col"},Le={class:"mb-2 flex h-7 items-center justify-between gap-2"},Pe={class:"text-xs font-semibold text-slate-500"},Ae={class:"invisible h-7 px-2 text-xs","aria-hidden":"true"},je=["placeholder"],Se={class:"flex min-w-0 flex-col"},Fe={class:"mb-2 flex h-7 items-center justify-between gap-2"},We={class:"text-xs font-semibold text-slate-500"},Ge=["value","placeholder"],Xe={key:0,class:"mt-2 text-sm text-rose-600"},O="w-full min-h-[200px] rounded-xl border border-slate-200 bg-white px-4 py-3 font-mono text-sm text-slate-800 shadow-sm outline-none focus:border-slate-300 focus:ring-2 focus:ring-slate-100",Je=D({__name:"EncodeWorkspace",props:{tool:{}},setup(t){const o=t,{t:e}=T(),{copy:l,copied:n}=Q(),i=Z(o,"tool"),{direction:a,input:h,output:m,errorKey:v,urlMode:M,setDirection:U,setUrlMode:x,swapDirection:g,clearAll:A}=Me(i),j=[{id:"encode",labelKey:"encode.workspace.encode",active:"bg-slate-700 text-white shadow-sm shadow-slate-700/20",idle:"bg-white text-slate-700 ring-1 ring-slate-200 hover:bg-slate-50"},{id:"decode",labelKey:"encode.workspace.decode",active:"bg-neutral-700 text-white shadow-sm shadow-neutral-700/20",idle:"bg-white text-neutral-700 ring-1 ring-neutral-200 hover:bg-neutral-50"}],S=[{id:"uri",labelKey:"encode.workspace.urlModeUri"},{id:"component",labelKey:"encode.workspace.urlModeComponent"}];async function F(){m.value&&await l(m.value)}return(st,V)=>(p(),f("div",Ue,[r("div",Ie,[r("div",Ke,[(p(),f($,null,E(j,d=>r("button",{key:d.id,type:"button",class:_(s(R)("cursor-pointer rounded-lg px-4 py-2 text-sm font-semibold transition-colors",s(a)===d.id?d.active:d.idle)),onClick:W=>s(U)(d.id)},c(s(e)(d.labelKey)),11,Ne)),64))]),r("div",Re,[u(s(K),{type:"button",variant:"outline",size:"sm",class:"border-slate-200 text-slate-700 hover:bg-slate-50",onClick:s(g)},{default:y(()=>[u(s(b),{icon:"heroicons:arrows-right-left",class:"mr-1.5 h-4 w-4"}),k(" "+c(s(e)("encode.workspace.swap")),1)]),_:1},8,["onClick"]),u(s(K),{type:"button",variant:"outline",size:"sm",class:"border-slate-200 text-slate-600 hover:bg-slate-50",onClick:s(A)},{default:y(()=>[k(c(s(e)("encode.workspace.clear")),1)]),_:1},8,["onClick"])])]),t.tool==="url"?(p(),f("div",Ve,[(p(),f($,null,E(S,d=>r("button",{key:d.id,type:"button",class:_(s(R)("cursor-pointer rounded-lg px-3 py-1.5 text-xs font-semibold transition-colors",s(M)===d.id?"bg-slate-800 text-white":"bg-white text-slate-600 ring-1 ring-slate-200 hover:bg-slate-50")),onClick:W=>s(x)(d.id)},c(s(e)(d.labelKey)),11,ze)),64)),r("p",Be,c(s(e)("encode.workspace.urlHint")),1)])):I("",!0),t.tool==="html"?(p(),f("p",Oe,c(s(e)("encode.workspace.htmlHint")),1)):I("",!0),r("div",qe,[r("div",He,[r("div",Le,[r("label",Pe,c(s(e)("encode.workspace.input")),1),r("span",Ae,c(s(e)("encode.workspace.copy")),1)]),q(r("textarea",{"onUpdate:modelValue":V[0]||(V[0]=d=>H(h)?h.value=d:null),class:_(O),placeholder:s(e)("encode.workspace.inputPlaceholder"),spellcheck:"false"},null,8,je),[[Y,s(h)]])]),r("div",Se,[r("div",Fe,[r("label",We,c(s(e)("encode.workspace.output")),1),u(s(K),{type:"button",variant:"outline",size:"sm",class:"h-7 border-slate-200 px-2 text-xs text-slate-600 hover:bg-slate-50",disabled:!s(m),onClick:F},{default:y(()=>[u(s(b),{icon:"heroicons:clipboard-document",class:"mr-1 h-3.5 w-3.5"}),k(" "+c(s(n)?s(e)("encode.workspace.copied"):s(e)("encode.workspace.copy")),1)]),_:1},8,["disabled"])]),r("textarea",{class:_(O),value:s(m),readonly:"",placeholder:s(e)("encode.workspace.outputPlaceholder"),spellcheck:"false"},null,8,Ge),s(v)?(p(),f("p",Xe,c(s(e)(s(v))),1)):I("",!0)])])]))}});function Qe(){const t=ee(),o=te(),e=C(N(t.query.tool));return z(()=>t.query.tool,l=>{const n=N(l);n!==e.value&&(e.value=n)}),z(e,l=>{N(t.query.tool)!==l&&o.replace({query:{...t.query,tool:l}})}),{tool:e}}const Ye={class:"flex min-h-dvh flex-col bg-slate-50 text-slate-900"},Ze={class:"mx-auto w-full max-w-4xl flex-1 px-6 py-12"},et={class:"mb-2 text-center text-3xl font-bold tracking-tight text-slate-900 md:text-4xl"},tt={class:"mb-8 text-center text-sm text-slate-400"},ot={class:"rounded-2xl border border-slate-100 bg-white p-6 shadow-sm shadow-slate-200/40"},at=D({__name:"IndexPage",setup(t){const{t:o}=T(),{tool:e}=Qe(),l=["base64","url","html"];return ne(()=>({title:o(`encode.seoTitle.${e.value}`),description:o("encode.seoDescription"),path:"/encode"})),(n,i)=>(p(),f("div",Ye,[u(he,{class:"shrink-0"}),r("main",Ze,[r("h1",et,c(s(o)("encode.brand")),1),r("p",tt,c(s(o)("encode.seoDescription")),1),u(xe,{modelValue:s(e),"onUpdate:modelValue":i[0]||(i[0]=a=>H(e)?e.value=a:null)},null,8,["modelValue"]),r("section",ot,[(p(),f($,null,E(l,a=>q(u(Je,{key:a,tool:a},null,8,["tool"]),[[oe,s(e)===a]])),64))])])]))}});
1export{at as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.