import{d as $}from"../chunks/environment.9aa685ef.js";import{s as ee,e as W,n as Y,r as te}from"../chunks/scheduler.9254f691.js";import{S as se,i as ae,g as l,s as g,h as n,j as S,x as V,c as b,f as I,k as e,l as le,a as ne,y as t,z as Z,A as z}from"../chunks/index.fcfb5454.js";const re=$,oe=!0,he=Object.freeze(Object.defineProperty({__proto__:null,csr:re,prerender:oe},Symbol.toStringTag,{value:"Module"}));function ce(p){let i,r,w="A.D.E.S.O.",x,a,o,k,u,f,L="Image:",j,c,E,s,y,X="Encode",q,C,G="Decode",B,d,O,J="Encoded Image:",N,h,P,F,A,K="Decoded Text:",H,_,M,Q;return{c(){i=l("div"),r=l("h2"),r.textContent=w,x=g(),a=l("div"),o=l("textarea"),k=g(),u=l("div"),f=l("label"),f.textContent=L,j=g(),c=l("input"),E=g(),s=l("div"),y=l("button"),y.textContent=X,q=g(),C=l("button"),C.textContent=G,B=g(),d=l("div"),O=l("div"),O.textContent=J,N=g(),h=l("img"),F=g(),A=l("div"),A.textContent=K,H=g(),_=l("textarea"),this.h()},l(m){i=n(m,"DIV",{class:!0});var v=S(i);r=n(v,"H2",{class:!0,["data-svelte-h"]:!0}),V(r)!=="svelte-1viz2bh"&&(r.textContent=w),x=b(v),a=n(v,"DIV",{class:!0});var T=S(a);o=n(T,"TEXTAREA",{rows:!0,class:!0,placeholder:!0}),S(o).forEach(I),k=b(T),u=n(T,"DIV",{class:!0});var R=S(u);f=n(R,"LABEL",{for:!0,class:!0,["data-svelte-h"]:!0}),V(f)!=="svelte-127t7d6"&&(f.textContent=L),j=b(R),c=n(R,"INPUT",{type:!0,id:!0,class:!0,accept:!0}),R.forEach(I),E=b(T),s=n(T,"DIV",{class:!0});var U=S(s);y=n(U,"BUTTON",{class:!0,["data-svelte-h"]:!0}),V(y)!=="svelte-1c2uzuh"&&(y.textContent=X),q=b(U),C=n(U,"BUTTON",{class:!0,["data-svelte-h"]:!0}),V(C)!=="svelte-1pmuic1"&&(C.textContent=G),U.forEach(I),B=b(T),d=n(T,"DIV",{class:!0});var D=S(d);O=n(D,"DIV",{class:!0,["data-svelte-h"]:!0}),V(O)!=="svelte-1n9aq8m"&&(O.textContent=J),N=b(D),h=n(D,"IMG",{src:!0,alt:!0,class:!0,style:!0}),F=b(D),A=n(D,"DIV",{class:!0,["data-svelte-h"]:!0}),V(A)!=="svelte-unay6w"&&(A.textContent=K),H=b(D),_=n(D,"TEXTAREA",{class:!0,rows:!0}),S(_).forEach(I),D.forEach(I),T.forEach(I),v.forEach(I),this.h()},h(){e(r,"class","title svelte-18i1tfs"),e(o,"rows","13"),e(o,"class","input-area svelte-18i1tfs"),e(o,"placeholder",`
  Input ciphertext to encode in your image here.
  Steaganography obfuscates, it does not encrypt.
  Only encode ciphertext, not plain text.
      
  The encoded image will be displayed below. 
  Right click to persist the encoded image locally.
      
  The Decode operation works off the uploaded file, not the
  image displayed in the Encoded Image section.
      
    `),e(f,"for","image"),e(f,"class","input-label svelte-18i1tfs"),e(c,"type","file"),e(c,"id","image"),e(c,"class","input-field svelte-18i1tfs"),e(c,"accept","image/*"),e(u,"class","input-container svelte-18i1tfs"),e(y,"class","submit-button encode svelte-18i1tfs"),e(C,"class","submit-button decode svelte-18i1tfs"),e(s,"class","buttons-container svelte-18i1tfs"),e(O,"class","result-label svelte-18i1tfs"),W(h.src,P=p[2])||e(h,"src",P),e(h,"alt"," "),e(h,"class","result-image svelte-18i1tfs"),le(h,"margin-bottom","50px"),e(A,"class","result-label svelte-18i1tfs"),e(_,"class","result-textarea svelte-18i1tfs"),e(_,"rows","1"),_.readOnly=!0,_.value=p[3],e(d,"class","result-container svelte-18i1tfs"),e(a,"class","form-container svelte-18i1tfs"),e(i,"class","container svelte-18i1tfs")},m(m,v){ne(m,i,v),t(i,r),t(i,x),t(i,a),t(a,o),Z(o,p[0]),t(a,k),t(a,u),t(u,f),t(u,j),t(u,c),t(a,E),t(a,s),t(s,y),t(s,q),t(s,C),t(a,B),t(a,d),t(d,O),t(d,N),t(d,h),t(d,F),t(d,A),t(d,H),t(d,_),M||(Q=[z(o,"input",p[5]),z(c,"change",p[6]),z(y,"click",p[7]),z(C,"click",p[8])],M=!0)},p(m,[v]){v&1&&Z(o,m[0]),v&4&&!W(h.src,P=m[2])&&e(h,"src",P),v&8&&(_.value=m[3])},i:Y,o:Y,d(m){m&&I(i),M=!1,te(Q)}}}function ie(p,i,r){let w="",x,a="",o="";const k=async c=>{r(2,a=""),r(3,o="");let E=new FormData;E.append("image",x[0]),E.append("action",c),E.append("data",w),await fetch("http://127.0.0.1:5000/encoding",{method:"POST",body:E}).then(s=>{if(!s.ok)throw new Error(`HTTP error! status: ${s.status}`);if(c==="Encode")return s.blob();if(c==="Decode")return s.json()}).then(s=>{console.log(s),c==="Encode"?r(2,a=URL.createObjectURL(s)):c==="Decode"&&r(3,o=s.decoded_image)}).catch(s=>{console.error(`Fetch Error: ${s}`)})};function u(){w=this.value,r(0,w)}function f(){x=this.files,r(1,x)}return[w,x,a,o,k,u,f,()=>k("Encode"),()=>k("Decode")]}class ve extends se{constructor(i){super(),ae(this,i,ie,ce,ee,{})}}export{ve as component,he as universal};
