var W=Object.create;var L=Object.defineProperty;var K=Object.getOwnPropertyDescriptor;var z=Object.getOwnPropertyNames;var H=Object.getPrototypeOf,V=Object.prototype.hasOwnProperty;var J=(e,i)=>()=>(i||e((i={exports:{}}).exports,i),i.exports);var Z=(e,i,g,m)=>{if(i&&typeof i=="object"||typeof i=="function")for(let u of z(i))!V.call(e,u)&&u!==g&&L(e,u,{get:()=>i[u],enumerable:!(m=K(i,u))||m.enumerable});return e};var G=(e,i,g)=>(g=e!=null?W(H(e)):{},Z(i||!e||!e.__esModule?L(g,"default",{value:e,enumerable:!0}):g,e));var I=J((oe,_)=>{var X=function(){var e=String.fromCharCode,i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",g="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-$",m={};function u(t,n){if(!m[t]){m[t]={};for(var c=0;c>>8,c[o*2+1]=h%256}return c},decompressFromUint8Array:function(t){if(t==null)return d.decompress(t);for(var n=new Array(t.length/2),c=0,o=n.length;c>1}else{for(l=1,o=0;o>1}x--,x==0&&(x=Math.pow(2,p),p++),delete v[y]}else for(l=h[y],o=0;o>1;x--,x==0&&(x=Math.pow(2,p),p++),h[U]=S++,y=String(w)}if(y!==""){if(Object.prototype.hasOwnProperty.call(v,y)){if(y.charCodeAt(0)<256){for(o=0;o>1}else{for(l=1,o=0;o>1}x--,x==0&&(x=Math.pow(2,p),p++),delete v[y]}else for(l=h[y],o=0;o>1;x--,x==0&&(x=Math.pow(2,p),p++)}for(l=2,o=0;o>1;for(;;)if(s=s<<1,r==n-1){f.push(c(s));break}else r++;return f.join("")},decompress:function(t){return t==null?"":t==""?null:d._decompress(t.length,32768,function(n){return t.charCodeAt(n)})},_decompress:function(t,n,c){var o=[],l,h=4,v=4,w=3,U="",y=[],x,S,p,f,s,r,b,a={val:c(0),position:n,index:1};for(x=0;x<3;x+=1)o[x]=x;for(p=0,s=Math.pow(2,2),r=1;r!=s;)f=a.val&a.position,a.position>>=1,a.position==0&&(a.position=n,a.val=c(a.index++)),p|=(f>0?1:0)*r,r<<=1;switch(l=p){case 0:for(p=0,s=Math.pow(2,8),r=1;r!=s;)f=a.val&a.position,a.position>>=1,a.position==0&&(a.position=n,a.val=c(a.index++)),p|=(f>0?1:0)*r,r<<=1;b=e(p);break;case 1:for(p=0,s=Math.pow(2,16),r=1;r!=s;)f=a.val&a.position,a.position>>=1,a.position==0&&(a.position=n,a.val=c(a.index++)),p|=(f>0?1:0)*r,r<<=1;b=e(p);break;case 2:return""}for(o[3]=b,S=b,y.push(b);;){if(a.index>t)return"";for(p=0,s=Math.pow(2,w),r=1;r!=s;)f=a.val&a.position,a.position>>=1,a.position==0&&(a.position=n,a.val=c(a.index++)),p|=(f>0?1:0)*r,r<<=1;switch(b=p){case 0:for(p=0,s=Math.pow(2,8),r=1;r!=s;)f=a.val&a.position,a.position>>=1,a.position==0&&(a.position=n,a.val=c(a.index++)),p|=(f>0?1:0)*r,r<<=1;o[v++]=e(p),b=v-1,h--;break;case 1:for(p=0,s=Math.pow(2,16),r=1;r!=s;)f=a.val&a.position,a.position>>=1,a.position==0&&(a.position=n,a.val=c(a.index++)),p|=(f>0?1:0)*r,r<<=1;o[v++]=e(p),b=v-1,h--;break;case 2:return y.join("")}if(h==0&&(h=Math.pow(2,w),w++),o[b])U=o[b];else if(b===v)U=S+S.charAt(0);else return null;y.push(U),o[v++]=S+U.charAt(0),h--,S=U,h==0&&(h=Math.pow(2,w),w++)}}};return d}();typeof _<"u"&&_!=null&&(_.exports=X)});var R=["esm.sh","skypack","esm.run","jsdelivr.esm","fastly.jsdelivr.esm","gcore.jsdelivr.esm","testingcf.jsdelivr.esm","jsdelivr.b-cdn.esm","jspm"],$=["jsdelivr","fastly.jsdelivr","unpkg","gcore.jsdelivr","testingcf.jsdelivr","jsdelivr.b-cdn","npmcdn"],D=["jsdelivr.gh","fastly.jsdelivr.gh","statically","gcore.jsdelivr.gh","testingcf.jsdelivr.gh","jsdelivr.b-cdn.gh"],k={getModuleUrl:(e,{isModule:i=!0,defaultCDN:g="esm.sh",external:m}={})=>{e=e.replace(/#nobundle/g,"");let u=t=>!m||!t.includes("https://esm.sh")?t:t.includes("?")?`${t}&external=${m}`:`${t}?external=${m}`,d=B(e,i,g);return d?u(d):i?u("https://esm.sh/"+e):"https://cdn.jsdelivr.net/npm/"+e},getUrl:(e,i)=>e.startsWith("http")||e.startsWith("data:")?e:B(e,!1,i||A())||e,cdnLists:{npm:$,module:R,gh:D},checkCDNs:async(e,i)=>{let g=[i,...k.cdnLists.npm].filter(Boolean);for(let m of g)try{if((await fetch(k.getUrl(e,m),{method:"HEAD"})).ok)return m}catch{}return k.cdnLists.npm[0]}},A=()=>{if(globalThis.appCDN)return globalThis.appCDN;try{return new URL(location.href).searchParams.get("appCDN")||k.cdnLists.npm[0]}catch{return k.cdnLists.npm[0]}},B=(e,i,g)=>{let m=i&&e.startsWith("unpkg:")?"?module":"";e.startsWith("gh:")?e=e.replace("gh",D[0]):e.includes(":")||(e=(g||(i?R[0]:$[0]))+":"+e);for(let u of Q){let[d,t]=u;if(d.test(e))return e.replace(d,t)+m}return null},Q=[[/^(esm\.sh:)(.+)/i,"https://esm.sh/$2"],[/^(npm:)(.+)/i,"https://esm.sh/$2"],[/^(node:)(.+)/i,"https://esm.sh/$2"],[/^(jsr:)(.+)/i,"https://esm.sh/jsr/$2"],[/^(skypack:)(.+)/i,"https://cdn.skypack.dev/$2"],[/^(jsdelivr:)(.+)/i,"https://cdn.jsdelivr.net/npm/$2"],[/^(fastly\.jsdelivr:)(.+)/i,"https://fastly.jsdelivr.net/npm/$2"],[/^(gcore\.jsdelivr:)(.+)/i,"https://gcore.jsdelivr.net/npm/$2"],[/^(testingcf\.jsdelivr:)(.+)/i,"https://testingcf.jsdelivr.net/npm/$2"],[/^(jsdelivr\.b-cdn:)(.+)/i,"https://jsdelivr.b-cdn.net/npm/$2"],[/^(jsdelivr\.gh:)(.+)/i,"https://cdn.jsdelivr.net/gh/$2"],[/^(fastly\.jsdelivr\.gh:)(.+)/i,"https://fastly.jsdelivr.net/gh/$2"],[/^(gcore\.jsdelivr\.gh:)(.+)/i,"https://gcore.jsdelivr.net/gh/$2"],[/^(testingcf\.jsdelivr\.gh:)(.+)/i,"https://testingcf.jsdelivr.net/gh/$2"],[/^(jsdelivr\.b-cdn\.gh:)(.+)/i,"https://jsdelivr.b-cdn.net/gh/$2"],[/^(statically:)(.+)/i,"https://cdn.statically.io/gh/$2"],[/^(esm\.run:)(.+)/i,"https://esm.run/$2"],[/^(jsdelivr\.esm:)(.+)/i,"https://cdn.jsdelivr.net/npm/$2/+esm"],[/^(fastly\.jsdelivr\.esm:)(.+)/i,"https://fastly.jsdelivr.net/npm/$2/+esm"],[/^(gcore\.jsdelivr\.esm:)(.+)/i,"https://gcore.jsdelivr.net/npm/$2/+esm"],[/^(testingcf\.jsdelivr\.esm:)(.+)/i,"https://testingcf.jsdelivr.net/npm/$2/+esm"],[/^(jsdelivr\.b-cdn\.esm:)(.+)/i,"https://jsdelivr.b-cdn.net/npm/$2/+esm"],[/^(jspm:)(.+)/i,"https://jspm.dev/$2"],[/^(esbuild:)(.+)/i,"https://esbuild.vercel.app/$2"],[/^(bundle\.run:)(.+)/i,"https://bundle.run/$2"],[/^(unpkg:)(.+)/i,"https://unpkg.com/$2"],[/^(npmcdn:)(.+)/i,"https://npmcdn.com/$2"],[/^(bundlejs:)(.+)/i,"https://deno.bundlejs.com/?file&q=$2"],[/^(bundle:)(.+)/i,"https://deno.bundlejs.com/?file&q=$2"],[/^(deno:)(.+)/i,"https://deno.bundlejs.com/?file&q=https://deno.land/x/$2/mod.ts"],[/^(https:\/\/deno\.land\/.+)/i,"https://deno.bundlejs.com/?file&q=$1"],[/^(github:|https:\/\/github\.com\/)(.[^\/]+?)\/(.[^\/]+?)\/(?!releases\/)(?:(?:blob|raw)\/)?(.+?\/.+)/i,"https://deno.bundlejs.com/?file&q=https://cdn.jsdelivr.net/gh/$2/$3@$4"],[/^(gist\.github:)(.+?\/[0-9a-f]+\/raw\/(?:[0-9a-f]+\/)?.+)$/i,"https://gist.githack.com/$2"],[/^(gitlab:|https:\/\/gitlab\.com\/)([^\/]+.*\/[^\/]+)\/(?:raw|blob)\/(.+?)(?:\?.*)?$/i,"https://deno.bundlejs.com/?file&q=https://gl.githack.com/$2/raw/$3"],[/^(bitbucket:|https:\/\/bitbucket\.org\/)([^\/]+\/[^\/]+)\/(?:raw|src)\/(.+?)(?:\?.*)?$/i,"https://deno.bundlejs.com/?file&q=https://bb.githack.com/$2/raw/$3"],[/^(bitbucket:)snippets\/([^\/]+\/[^\/]+)\/revisions\/([^\/\#\?]+)(?:\?[^#]*)?(?:\#file-(.+?))$/i,"https://bb.githack.com/!api/2.0/snippets/$2/$3/files/$4"],[/^(bitbucket:)snippets\/([^\/]+\/[^\/\#\?]+)(?:\?[^#]*)?(?:\#file-(.+?))$/i,"https://bb.githack.com/!api/2.0/snippets/$2/HEAD/files/$3"],[/^(bitbucket:)\!api\/2.0\/snippets\/([^\/]+\/[^\/]+\/[^\/]+)\/files\/(.+?)(?:\?.*)?$/i,"https://bb.githack.com/!api/2.0/snippets/$2/files/$3"],[/^(api\.bitbucket:)2.0\/snippets\/([^\/]+\/[^\/]+\/[^\/]+)\/files\/(.+?)(?:\?.*)?$/i,"https://bb.githack.com/!api/2.0/snippets/$2/files/$3"],[/^(rawgit:)(.+?\/[0-9a-f]+\/raw\/(?:[0-9a-f]+\/)?.+)$/i,"https://gist.githack.com/$2"],[/^(rawgit:|https:\/\/raw\.githubusercontent\.com)(\/[^\/]+\/[^\/]+|[0-9A-Za-z-]+\/[0-9a-f]+\/raw)\/(.+)/i,"https://deno.bundlejs.com/?file&q=https://raw.githack.com/$2/$3"]];var E=G(I());var M=()=>{let e=[];return{subscribe:d=>(e.push(d),{unsubscribe:()=>{e.splice(e.indexOf(d),1)}}),notify:d=>{e.forEach(t=>{t(d)})},hasSubscribers:()=>e.length>0,unsubscribeAll:()=>{e.length=0}}};var O=e=>(globalThis.structuredClone||(i=>JSON.parse(JSON.stringify(i,(g,m)=>m===void 0?null:m))))(e);var Y=()=>String(Math.random())+"-"+Date.now().toFixed();var T=async(e,i)=>new Promise(g=>{let m=Y(),u=d=>{let t=d.data;t.method===i.method&&t.messageId===m&&(e.removeEventListener("message",u),g(t.data))};e.addEventListener("message",u),e.postMessage({...i,messageId:m})});var{getUrl:ue,getModuleUrl:fe}=k;var P={getValue:()=>null,setValue:()=>{},clear:()=>{},subscribe:()=>({unsubscribe:()=>{}}),unsubscribeAll:()=>{}};var C=(e,i)=>{if(i)return P;let g=M(),m=o=>g.subscribe(o),u=()=>{g.unsubscribeAll()},d=()=>{g.notify(n())},t=o=>{window.localStorage.setItem(e,JSON.stringify(o)),d()},n=()=>{let o=window.localStorage.getItem(e);if(!o)return null;try{return JSON.parse(o)}catch{return null}};return{getValue:n,setValue:t,clear:()=>{t(null),d()},subscribe:m,unsubscribeAll:u}};var q=()=>O({projects:null,templates:null,assets:null,snippets:null,recover:null,userConfig:null,userData:null,appData:null,sync:null});var F=async(e,i)=>{i||(e.recover=C("__livecodes_project_recover__",i),e.userConfig=C("__livecodes_user_config__",i),e.appData=C("__livecodes_app_data__",i))};var j,Xe=e=>{j=j||new Worker(e+"sync.worker.a6d82e69c8168333aaaf3bc4caeb7b1e.js?appCDN="+A());let i;j.addEventListener("message",async g=>{let m=g.data,u=m.method,d=m.args||{};if(u!=="getValue"&&u!=="setValue")return;i||(i=q(),await F(i,!1));let t,{storeKey:n,value:c}=d,o=i[n];!o||!n||(u==="getValue"&&"getValue"in o&&(t=o.getValue()),u==="setValue"&&"setValue"in o&&c!=null&&o.setValue(c),j.postMessage({...m,data:t}))})},Ye=async(...e)=>T(j,{method:"sync",args:e}),et=async(...e)=>T(j,{method:"exportToLocalSync",args:e}),tt=async(...e)=>T(j,{method:"exportStoreAsBase64Update",args:e}),ot=async(...e)=>T(j,{method:"restoreFromUpdate",args:e}),st=async(...e)=>T(j,{method:"restoreFromLocalSync",args:e});export{tt as exportStoreAsBase64Update,et as exportToLocalSync,Xe as init,st as restoreFromLocalSync,ot as restoreFromUpdate,Ye as sync};