@dcl-regenesislabs/web-editor 0.3.16-40613344367.commit-dac030b → 0.3.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/editor.js +1 -1
  2. package/package.json +2 -3
package/editor.js CHANGED
@@ -35764,4 +35764,4 @@ ${n}
35764
35764
  ${r}`));return"w"+Array.from(new Uint8Array(a).slice(0,16),s=>s.toString(16).padStart(2,"0")).join("")}function PTr(t){return`${t.file===void 0?"":`${t.file}:${t.line??1}:${t.column??0}: `}${t.severity==="error"?"ERROR":"WARNING"}: ${t.message}`}function ITr(t){return t.length<=3?t.join(", "):`${t.slice(0,3).join(", ")} and ${t.length-3} more`}function NTr(t,n){const r=M1(t.get("package.json"));for(const a of[r==null?void 0:r.devDependencies,r==null?void 0:r.dependencies]){const s=typeof a=="object"&&a!==null?a["@dcl/sdk"]:void 0;if(typeof s=="string"&&s!==n)return`⚠ This project asks for @dcl/sdk ${s}; the editor builds it with ${n}.`}return null}function DTr(t){const{emit:n,log:r}=t;let a=null,s=!1,l=null,f=Promise.resolve();const m=C=>{const N=f.then(C,C);return f=N.catch(()=>{}),N};async function _(){if(s)throw new Error("The editor was closed");a===null&&(l=null);const C=a??cxr(t.urls);a=C;try{const N=await C.ready;return{builder:C,sdkVersion:N.sdkVersion,info:N}}catch(N){throw C.dispose(),a===C&&(a=null),N}}async function x(C,N,F){const{builder:B,info:H}=await _();let Z=!1;const K=await CTr(N,t.packages,H.snapshot,pe=>{t.onPackages(C,pe),F&&!Z&&r("Downloading packages from npm…"),Z=!0});K.lockFile!==void 0&&(N.set(R3,K.lockFile),await t.saveLock(C,K.lockFile));const te=K.lock===null?"":YVt(K.lock);if(te!==l)try{await B.setPackages(K.lock,t.packages),l=te}catch(pe){F&&r(`⚠ ${jOt(pe)}`),await B.setPackages(null),l=""}if(t.onPackages(C,K.status),!(!F||K.status===null)){if(K.status.state==="error")r(`✖ ${K.status.message??"The packages could not be installed"}`);else if(K.downloaded>0){const pe=Object.entries(K.status.installed).map(([fe,X])=>`${fe} ${X}`);r(`✔ Packages frozen into the scene: ${pe.join(", ")} (${K.status.total} in all)`)}for(const pe of K.status.warnings)r(`⚠ ${pe}`)}}function T(C,N,F=C){const B=PWe(t.pageDir,F),H=new Set;let Z=null,K=null,te=!0,pe=!1,fe=!1,X=null;const he=wt=>(n({type:"failed",message:wt}),r(`✖ Build failed: ${wt.split(`
35765
35765
  `)[0]}`),!1);async function Ce(wt){const ft=performance.now();n({type:"buildStarted",changed:wt}),r(wt.length===0?"Building the scene…":`Rebuilding: ${ITr(wt)}`);try{const{builder:St,sdkVersion:gt}=await _(),Ue=wt.length===0?NTr(N,gt):null;Ue!==null&&r(Ue);const qt=wt.length===0||wt.includes("package.json")||wt.includes(R3),{snapshot:Ve,result:Re}=await m(async()=>{(qt||l!==X)&&(await x(C,N,!0),X=l);const xt=new Map(N);return{snapshot:xt,result:await St.build(xt)}});if(fe)return!1;const $t=Re.diagnostics.filter(xt=>xt.severity==="error"||xt.file===void 0||Ve.has(xt.file));n({type:"diagnostics",diagnostics:$t.map(({severity:xt,message:ut,file:Nt,line:Ut,column:Wt})=>({severity:xt,message:ut,file:Nt,line:Ut,column:Wt}))});for(const xt of $t)r(PTr(xt));if(!Re.ok){const xt=Re.events.find(ut=>ut.type==="failed");return he((xt==null?void 0:xt.type)==="failed"?xt.message:"The build produced no bundle")}const vt=M1(Ve.get("scene.json"));return vt===null?he("scene.json is missing or is not valid JSON"):(await ywr({realmUrl:B,projectId:F,files:Ve,buildOutputs:Re.outputs,sceneJson:vt,sdkVersion:gt,machineId:await t.machineId(F)}),fe?!1:(n({type:"bundleSaved"}),r(`✔ Built in ${Math.round(performance.now()-ft)} ms`),!0))}catch(St){return fe?!1:he(jOt(St))}}function qe(){return fe?Promise.resolve(!1):(K!==null||(K=(async()=>{for(;(te||H.size>0)&&!fe;){const wt=te?[]:[...H];te=!1,H.clear(),pe=await Ce(wt)}return pe&&!fe})().finally(()=>{K=null})),K)}return{id:C,files:N,start:qe,flush(){return Z!==null&&clearTimeout(Z),Z=null,qe()},async published(){const wt=await(await caches.open(Rxe)).match(IWe(B)),ft=await(wt==null?void 0:wt.json().catch(()=>{})),St=ft==null?void 0:ft.entity;return(St==null?void 0:St.id)===HXe(F,await t.machineId(F))},changed(wt){fe||(H.add(wt),Z!==null&&clearTimeout(Z),Z=setTimeout(()=>{Z=null,qe()},ATr))},stop(){fe=!0,Z!==null&&clearTimeout(Z)}}}return{realmUrl:C=>PWe(t.pageDir,C),open:T,async build(C,N,F){const{builder:B,sdkVersion:H}=await _();return m(async()=>(await x(C,N,!1),{...await B.build(N,F),sdkVersion:H}))},install:(C,N)=>m(()=>x(C,N,!1)),dispose(){s=!0,a==null||a.dispose(),a=null}}}const UOt=64*1024*1024,RTr=4*1024*1024;function MTr(t,n){return t.length>8192?!1:n==="POST"?t==="/content/entities/active":n!=="GET"&&n!=="HEAD"?!1:t==="/about"||t==="/scene.json"||/^\/content\/contents\/(?:b64-[A-Za-z0-9+/=]+|[A-Za-z0-9]+)$/.test(decodeURIComponent(t))}function LTr(t,n,r){const a=t===null?null:new URL(t).origin;let s="",l=null,f="",m="",_=new AbortController,x=0,T=0;const C=(B,H=[])=>{l!==null&&a!==null&&l.postMessage({...B,session:n,instance:s},a,H)},N=async B=>{var he;if(typeof B.requestId!="string"||B.requestId.length>128||typeof B.path!="string")return;const H=B.requestId;if(x>=64){C({type:"realm-response",requestId:H,error:"Too many preview resource requests"});return}const Z=_,K=l,te=new AbortController,pe=setTimeout(()=>te.abort(new Error("Preview resource timed out")),3e4);let fe=0,X;x++;try{const Ce=new URL(f+B.path);if(!Ce.href.startsWith(f+"/")||!MTr(B.path,B.method))throw new Error("Invalid preview resource");if(B.body!==void 0&&(!(B.body instanceof ArrayBuffer)||B.body.byteLength>1024*1024))throw new Error("Invalid preview request body");const qe=await fetch(Ce,{method:String(B.method),credentials:"omit",redirect:"error",signal:AbortSignal.any([Z.signal,te.signal]),headers:{"Content-Type":"application/json"},body:B.method==="POST"?B.body:void 0}),wt=qe.headers.get("Content-Type")??"application/octet-stream",ft=wt.includes("application/json")?RTr:UOt;if(X=(he=qe.body)==null?void 0:he.getReader(),Number(qe.headers.get("Content-Length"))>ft)throw new Error("Preview resource exceeds the memory limit");const St=[];if(X!==void 0)for(;;){const{done:Ve,value:Re}=await X.read();if(Ve)break;if(fe+=Re.byteLength,T+=Re.byteLength,fe>ft||T>UOt)throw new Error("Preview resource exceeds the memory limit");St.push(Re)}const gt=new Uint8Array(fe);let Ue=0;for(const Ve of St)gt.set(Ve,Ue),Ue+=Ve.byteLength;St.length=0;let qt=gt.buffer;if(B.method!=="HEAD"&&qt.byteLength>0&&wt.includes("application/json")){const Ve=JSON.parse(new TextDecoder().decode(qt)),Re=$t=>typeof $t=="string"?$t.startsWith(f+"/")||$t===f?m+$t.slice(f.length):$t:Array.isArray($t)?$t.map(Re):dl($t)?Object.fromEntries(Object.entries($t).map(([vt,xt])=>[vt,Re(xt)])):$t;qt=new TextEncoder().encode(JSON.stringify(Re(Ve))).buffer}!Z.signal.aborted&&K===l&&C({type:"realm-response",requestId:H,status:qe.status,headers:{"Content-Type":wt},body:qt},[qt])}catch(Ce){!Z.signal.aborted&&K===l&&C({type:"realm-response",requestId:H,error:Ce instanceof Error?Ce.message:String(Ce)})}finally{clearTimeout(pe),te.abort(),X!==void 0&&X.cancel().catch(Ce=>{Ce instanceof Error&&Ce.name==="AbortError"||console.warn("Preview stream cleanup:",Ce)}),T-=fe,x--}},F=B=>{const H=B.data;B.origin!==a||!dl(H)||H.session!==n||H.instance!==s||s===""||(H.type==="connect"&&l===null&&B.source!==null&&"postMessage"in B.source&&(l=B.source),!(B.source!==l||l===null)&&(H.type==="realm-request"?N(H):r(H)))};return window.addEventListener("message",F),{send:C,reset:(B="",H="",Z="")=>{_.abort(),_=new AbortController,l=null,s=B,f=H,m=Z},dispose:()=>{_.abort(),window.removeEventListener("message",F)}}}function FTr(t,n){return["localhost","127.0.0.1","[::1]"].includes(new URL(t).hostname)?"http://127.0.0.1:8788/mobile-preview/index.html":n===null?null:new URL("mobile-preview/index.html",n.replace(/\/$/,"")+"/").href}function jTr(t){if(t===null)return null;const n=new URL(t).hostname;return n==="decentraland.zone"||n.endsWith(".decentraland.zone")?"zone":null}function BTr(t,n,r,a=null){const s=crypto.randomUUID(),l=LTr(t,s,fe=>pe(fe)),f=new Set,m=new Map;let _={mode:"closed",url:null,ready:!1},x=null,T="",C="",N=0,F=null,B=!1,H=null;const Z=fe=>{_=fe;for(const X of f)X()},K=()=>{C!==""&&l.send({type:"stop",session:s,instance:C}),l.reset(),H==null||H.close(),H=null,C="";for(const fe of m.values())fe.reject(new Error("The mobile preview was closed."));m.clear(),Z({mode:"closed",url:null,ready:!1})},te=()=>{N++,x=null,K()};window.addEventListener("pagehide",te);const pe=fe=>{if(!dl(fe)||fe.session!==s||fe.instance!==C||(fe.type==="ready"&&(Z({..._,ready:!0}),l.send({type:"visibility",session:s,instance:C,visible:_.mode!=="minimized"})),fe.type==="closed"&&te(),fe.type!=="capture"||typeof fe.requestId!="string"))return;const X=m.get(fe.requestId);X!==void 0&&(typeof fe.error=="string"?X.reject(new Error(fe.error)):typeof fe.image=="string"&&fe.image.length<=4e6&&typeof fe.width=="number"&&fe.width>0&&fe.width<=1024&&typeof fe.height=="number"&&fe.height>0&&fe.height<=1024?X.resolve({mimeType:"image/jpeg",image:fe.image,width:fe.width,height:fe.height}):X.reject(new Error("The mobile preview sent an invalid picture.")))};return{state:()=>_,status:()=>({mode:_.mode,ready:_.ready}),subscribe:fe=>(f.add(fe),()=>f.delete(fe)),open:async(fe,X,he="embedded")=>{if(B||t===null)return{ok:!1,reason:"unavailable"};const Ce=fe.replace(/\/$/,"");if(_.mode===he&&x===Ce)return N++,{ok:!0};if((he==="embedded"||he==="minimized")&&(_.mode==="embedded"||_.mode==="minimized")&&x===Ce){if(N++,Z({..._,mode:he}),l.send({type:"visibility",session:s,instance:C,visible:he!=="minimized"}),he==="minimized")for(const qt of m.values())qt.reject(new Error("Restore the mobile preview before taking a picture."));return{ok:!0}}if(he==="minimized")return{ok:!1,reason:"unavailable"};const qe=he==="tab"?window.open("about:blank",`dcl-phone-preview-${crypto.randomUUID()}`):null;if(he==="tab"&&qe===null)return{ok:!1,reason:"unavailable"};const wt=++N;if(!await fetch(t,{method:"HEAD",signal:AbortSignal.timeout(5e3)}).then(qt=>qt.ok,()=>!1)||wt!==N||B||qe!=null&&qe.closed)return qe==null||qe.close(),{ok:!1,reason:"unavailable"};if(K(),await new Promise(qt=>setTimeout(qt,100)),wt!==N||B||qe!=null&&qe.closed)return qe==null||qe.close(),{ok:!1,reason:"unavailable"};C=crypto.randomUUID();const St=new URL(t);St.searchParams.set("previewSession",s),St.searchParams.set("previewInstance",C),St.searchParams.set("editorOrigin",window.location.origin),he==="tab"&&St.searchParams.set("previewDetached","1"),St.searchParams.set("maxpixels",String(1600*720)),T=new URL(`realm/${s}/${C}`,t).href,l.reset(C,Ce,T);const gt=new URL("decentraland://open");gt.searchParams.set("preview",T),gt.searchParams.set("position",X);const Ue=["--local-editor-preview","--skip-lobby","--guest-profile","--fake-deeplink",gt.href];return a!==null&&Ue.push("--dclenv",a),St.searchParams.set("args",Ue.join(" ")),x=Ce,Z({mode:he,url:St.href,ready:!1}),H=qe,qe!==null&&UTr(qe,St.href),{ok:!0}},close:te,capture:async fe=>{if(fe.throwIfAborted(),_.mode==="closed"||!_.ready)throw new Error("Open the mobile preview and wait for it to load before taking a picture.");_.mode==="minimized"&&(F=N,Z({..._,mode:"embedded"}),l.send({type:"visibility",session:s,instance:C,visible:!0}));const X=crypto.randomUUID();try{return await new Promise((he,Ce)=>{const qe=()=>{clearTimeout(ft),fe.removeEventListener("abort",wt),m.delete(X)},wt=()=>{qe(),Ce(fe.reason)},ft=setTimeout(()=>{qe(),Ce(new Error("The mobile preview did not answer. Bring its tab to the foreground and retry."))},1e4);m.set(X,{resolve:St=>{qe(),he(St)},reject:St=>{qe(),Ce(St)}}),fe.addEventListener("abort",wt,{once:!0}),l.send({type:"capture",session:s,instance:C,requestId:X})})}finally{m.size===0&&(F===N&&_.mode==="embedded"&&(Z({..._,mode:"minimized"}),l.send({type:"visibility",session:s,instance:C,visible:!1})),F=null)}},built:async fe=>{if(x===null)return;const X=x,he=await n(fe),Ce=HXe(he,await r(he));!B&&X===x&&l.send({type:"scene-updated",session:s,instance:C,realm:T,entityId:Ce})},dispose:()=>{te(),B=!0,window.removeEventListener("pagehide",te),l.dispose(),f.clear()}}}function UTr(t,n){const r=t.document;r.title="Mobile scene preview",r.body.style.cssText="margin:0;background:#19191c;overflow:hidden";const a=r.createElement("iframe");a.title="Mobile scene preview",a.allow="autoplay; fullscreen; gamepad; cross-origin-isolated",a.style.cssText="width:100vw;height:100vh;border:0;display:block",a.src=n,r.body.replaceChildren(a)}const $Tr=200,zTr=2e3,VTr=/^\((?:no logs|\+\d+ older entries not retained)\)$/;function WTr(t,n){for(let r=Math.min(t.length,n.length);r>0;r--){const a=t.length-r;if(n.slice(0,r).every((s,l)=>s===t[a+l]))return n.slice(r)}return[...n]}function qTr(t,n){let r=[],a=!1,s;const l=async()=>{try{const f=await t(`scene_logs ${$Tr} --server`);if(a)return;const m=f.split(`
35766
35766
  `).filter(_=>_.trim()!==""&&!VTr.test(_.trim()));for(const _ of WTr(r,m))n(_);r=m}catch{}a||(s=setTimeout(()=>void l(),zTr))};return l(),()=>{a=!0,clearTimeout(s)}}function GTr(t,n,r){r.throwIfAborted();const a=nt.scene,s=[...t].sort().join(";");return new Promise((l,f)=>{const m=()=>{clearTimeout(N),T(),r.removeEventListener("abort",C)},_=F=>{m(),f(F)},x=()=>{var B;nt.scene===a||nt.status!=="ready"||!nt.frozen||((B=nt.scene)==null?void 0:B.parcels.map(H=>`${H.x},${H.y}`).sort().join(";"))!==s||(m(),l())},T=HWe(x),C=()=>_(r.reason),N=setTimeout(()=>_(new Error("The preview has not loaded the new parcels. Retry sceneSettings before building outside the current layout.")),9e4);r.addEventListener("abort",C,{once:!0});try{n(),x()}catch(F){_(F)}})}const HTr=new Set(["node_modules",".git","bin","dist"]),JTr=300*1024,QTr=56,YTr=5;function XTr(t){const n=t.origin,r=typeof n=="object"&&n!==null&&!Array.isArray(n)?n:null;return r!==null&&(r.source==="import"||r.source==="github")?r:{...r??{},source:"user"}}function ZTr(t,n){const r=new Map;let a=new Map;function s(m,_){if(_.size>JTr)return t.blob(m,_.hash);let x=r.get(_.hash);return x===void 0&&(x=t.blob(m,_.hash),r.set(_.hash,x),x.catch(()=>r.delete(_.hash))),x}const l={async folders(){const m=await t.list();return a=new Map(m.map(x=>[x.name,x])),(await Promise.all(m.map(async x=>{const T=x.files["data.json"];if(T===void 0)return null;const C=await s(x.name,T).then(F=>new TextDecoder().decode(F),()=>null);if(C===null)return null;const N=Object.fromEntries(Object.entries(x.files).map(([F,B])=>[F,B.size]));return{name:x.name,data:C,files:N}}))).filter(x=>x!==null)},async read(m,_){var T;const x=(T=a.get(m.name))==null?void 0:T.files[_];if(x===void 0)throw new Error(`${m.name}/${_} is not in your library`);return s(m.name,x)}};async function f(m,_){const x={},T=new Map;for(const[N,F]of _){const B=await n(F);x[N]={hash:B,size:F.length},T.set(B,F)}const C=[...T].map(([N,F])=>({hash:N,size:F.length}));for(const N of await t.uploads(m,C)){const F=T.get(N.hash);F!==void 0&&await t.putBlob(N,F)}await t.put(m,x)}return{tree:l,async copyOut(m,_){const[x,T,C]=_.split("/");if(x!=="custom"||T===void 0||C!==void 0||!/^[A-Za-z0-9][A-Za-z0-9._-]*$/.test(T))throw new Error(`not a prefab folder: ${_}`);const N=`${_}/`,F=new Map;for(const[X,he]of m.files()){const Ce=X.slice(N.length);X.startsWith(N)&&!Ce.split("/").some(qe=>HTr.has(qe))&&F.set(Ce,he)}const B=F.get("data.json"),H=B===void 0?null:Fq(new TextDecoder().decode(B));if(H===null)throw new Error(`${_} has no readable data.json`);const Z={...H,id:typeof H.id=="string"?H.id:crypto.randomUUID(),origin:XTr(H)},K=`${JSON.stringify(Z,null,2)}
35767
- `;F.set("data.json",new TextEncoder().encode(K));const te=zWe(kWt(H,T)).slice(0,QTr).replace(/_+$/,"")||"prefab",pe=new Set((await t.list()).map(X=>X.name));let fe=1;for(let X=0;X<YTr;X++){let he=te;for(;pe.has(he);)he=`${te}_${++fe}`;try{return await f(he,F),{ref:`user:${he}`,scope:"user",data:K}}catch(Ce){if(!(Ce instanceof pWt))throw Ce;pe.add(he)}}throw new Error("could not find a free name in your library — try again")},remove:m=>t.remove(m)}}const $Ot=new WeakMap;function KTr(t){let n=$Ot.get(t);return n===void 0&&(n=crypto.subtle.digest("SHA-256",new Uint8Array(t)).then(r=>[...new Uint8Array(r)].map(a=>a.toString(16).padStart(2,"0")).join("")),$Ot.set(t,n)),n}async function ekr(t){const n=t.get(".dclignore"),r=QXe(t.keys(),n===void 0?void 0:new TextDecoder().decode(n)).filter(l=>l!==R3),a=new Map;let s=0;for(const l of r){const f=t.get(l);f!==void 0&&(a.set(await KTr(f),f.byteLength),s++)}return{bytes:[...a.values()].reduce((l,f)=>l+f,0),files:s}}const zOt=4e3,tkr=4e6,nkr=iPt*24*60*60*1e3,rkr="assets/images",ikr=3e3,akr=100,skr="Sign in to keep prefabs in your own library. The built-in prefabs work without it.",okr=t=>t instanceof Error?t.message:String(t);function o9e(t,n){var r,a,s;return{realm:n.replace(/\/$/,""),systemScene:"",position:((r=t.scene)==null?void 0:r.base)??((s=(a=t.scene)==null?void 0:a.parcels)==null?void 0:s[0])??"0,0",spawn:Dwr(t),spawnPoints:JSON.stringify(Array.isArray(t.spawnPoints)?t.spawnPoints:[])}}const ckr=({host:t,sceneCompiler:n})=>{const r=new pSr(oSr()),a=kk(t),s=a===null||a.services.projects===null?null:fWt(a.services.projects,(Qn,Lr)=>a.signedFetch(Qn,Lr)),l=()=>{const{address:Qn,isGuest:Lr}=t.identity();return Lr||Qn===null?null:Qn.toLowerCase()},f=[],m=[],_=[],x=[],T=[],C=Qn=>{f.push(Qn),f.length>zOt&&f.splice(0,f.length-zOt);for(const Lr of m)Lr(Qn)},N=BTr(FTr(t.pageDir,(a==null?void 0:a.services.projects)??null),he,async Qn=>BOt(await Z,l()??"guest",Qn),jTr((a==null?void 0:a.services.worldsContent)??null)),F=Qn=>{for(const Lr of _)Lr(Qn);Qn.type==="bundleSaved"&&pe!==null&&N.built(pe.id).catch(Lr=>console.error("[editor] mobile preview reload failed",Lr))},B=new Map,H=new Set,Z=G3t.then(OTr),K=DTr({pageDir:t.pageDir,urls:n,machineId:async Qn=>BOt(await Z,l()??"guest",Qn),emit:F,log:C,packages:r.packages,saveLock:async(Qn,Lr)=>{await r.write(Qn,R3,Lr),xt.touched(Qn,R3),(pe==null?void 0:pe.id)===Qn&&pe.files.set(R3,Lr)},onPackages:(Qn,Lr)=>{if(Lr===null){B.delete(Qn);return}B.set(Qn,Lr);for(const ti of H)ti(Qn,Lr)}});let te=null,pe=null,fe=null,X=null;async function he(Qn){var Ga;const Lr=(Ga=(await r.list()).find(Xa=>Xa.id===Qn))==null?void 0:Ga.previewId;if(Lr!==void 0)return Lr;const ti="p"+Array.from(crypto.getRandomValues(new Uint8Array(16)),Xa=>Xa.toString(16).padStart(2,"0")).join("");return await r.patch(Qn,{previewId:ti}),ti}async function Ce(Qn){const Lr=new URL("preview/",t.pageDir).href,ti=await caches.open(Rxe);for(const Ga of await ti.keys())Ga.url.startsWith(Lr)&&(Qn===null||!Ga.url.startsWith(Qn))&&await ti.delete(Ga)}let qe=0,wt=Promise.resolve(),ft=Promise.resolve();const St=wwr({service:(a==null?void 0:a.services.projects)??null,fetch:(Qn,Lr)=>a===null?Promise.reject(new Error("The assistant service is not configured.")):a.signedFetch(Qn,Lr),wallet:l,mobilePreview:N.status,memory:{read:async(Qn,Lr)=>{const ti=await r.assistantMemory(Qn,Lr);return dl(ti)&&typeof ti.id=="string"&&typeof ti.key=="string"?{id:ti.id,key:ti.key}:null},write:(Qn,Lr,ti)=>r.setAssistantMemory(Qn,Lr,ti)},project:()=>{const Qn=Tt();return{id:Qn.id,tools:{files:()=>Qn.files,write:(Lr,ti,Ga,Xa)=>qt(Qn.id,Lr,ti,{expected:Ga,signal:Xa}),assets:p$t({files:()=>Qn.files}),scene:(Lr,ti)=>lTe(Lr,ti,async Ga=>{var ii,yl,ja;const Xa=ss=>{var Ts,Zs;return JSON.stringify([(Ts=ss==null?void 0:ss.scene)==null?void 0:Ts.parcels,(Zs=ss==null?void 0:ss.scene)==null?void 0:Zs.base])};await eO();const Kc=Xa(M1(await Ue(Qn.id,"scene.json")));await tn(Qn.id,ss=>Fwr(ss,Ga));const uu=M1(await Ue(Qn.id,"scene.json")),lr=Xa(uu)!==Kc,Pl=((ii=uu==null?void 0:uu.scene)==null?void 0:ii.parcels)??[],fm=(yl=nt.scene)==null?void 0:yl.parcels.map(ss=>`${ss.x},${ss.y}`).sort().join(";");if(lr||fm!==[...Pl].sort().join(";")){if(!await Qn.flush())throw new Error("The scene did not build. Fix the code and retry sceneSettings to load the new parcels.");ti.throwIfAborted();const ss=await he(Qn.id);te=o9e(uu??{},K.realmUrl(ss)),await GTr(Pl,()=>{for(const Ts of x)Ts(te)},ti)}else if(te!==null){const ss=o9e(uu??{},te.realm);(ss.spawn!==te.spawn||ss.spawnPoints!==te.spawnPoints)&&(te={...te,spawn:ss.spawn,spawnPoints:ss.spawnPoints},vur(ss.spawn,ss.spawnPoints))}return{requiredPermissions:(uu==null?void 0:uu.requiredPermissions)??[],spawnPoints:(uu==null?void 0:uu.spawnPoints)??[],parcels:Pl,base:((ja=uu==null?void 0:uu.scene)==null?void 0:ja.base)??null,previewReady:!0}}),written:_$t,view:(Lr,ti)=>AXe(Lr,ti),playtest:fzt,uiLayout:hzt,turnEnded:lzt,build:async Lr=>{Lr.throwIfAborted(),await ft;const ti=await K.build(Qn.id,new Map(Qn.files));if(Lr.throwIfAborted(),!ti.ok)return{ok:!1,diagnostics:ti.diagnostics,mobilePreview:N.status()};const Ga=await f$t();return Lr.throwIfAborted(),{ok:!0,diagnostics:ti.diagnostics,run:Ga,mobilePreview:N.status()}}}}}});function gt(){St.reset(),X==null||X(),X=null,pe!==null&&(pe.stop(),r.close(pe.id),xt.flush(pe.id),pe=null,fe=null)}async function Ue(Qn,Lr){return(pe==null?void 0:pe.id)===Qn?pe.files.get(Lr):r.read(Qn,Lr).catch(ti=>{if(!mI(ti))throw ti})}function qt(Qn,Lr,ti,Ga){const Xa=ft.then(async()=>{if(Ga==null||Ga.signal.throwIfAborted(),Ga!==void 0&&((pe==null?void 0:pe.id)!==Qn||!y$t(pe.files.get(Lr),Ga.expected)))throw new Error("This file changed. Read it again before writing.");await r.write(Qn,Lr,ti),xt.touched(Qn,Lr),(pe==null?void 0:pe.id)===Qn&&(pe.files.set(Lr,ti),pe.changed(Lr))});return ft=Xa.catch(Kc=>console.error("[editor] file write failed",Kc)),Xa}function Ve(Qn,Lr){const ti=ft.then(async()=>{const Ga=await r.remove(Qn,Lr);return Ga&&xt.touched(Qn,Lr),Ga&&(pe==null?void 0:pe.id)===Qn&&pe.files.delete(Lr)&&pe.changed(Lr),Ga});return ft=ti.catch(Ga=>console.error("[editor] file removal failed",Ga)),ti}function Re(Qn){const Lr=Tt();if(Lr.id!==Qn)throw new Error("that scene is not the one open");return{files:()=>Lr.files,write:(ti,Ga)=>qt(Qn,ti,Ga),remove:async ti=>{await Ve(Qn,ti)}}}async function $t(Qn){var Ga;const Lr=M1(await Ue(Qn,"scene.json").catch(()=>{})),ti=(((Ga=Lr==null?void 0:Lr.display)==null?void 0:Ga.title)??"").replace(/[\x00-\x1f\x7f]/g,"").replace(new RegExp(dWt.source,"g"),"").trim().slice(0,akr);return ti===""?Qn:ti}async function vt(Qn,Lr){const ti=(await r.list()).find(Xa=>Xa.id===Qn);if(ti===void 0)return null;const Ga=await r.duplicate(Qn,`${ti.name} ${Lr}`,xt.remoteIds());return await tn(Ga.id,Xa=>{var Kc;return{...Xa,display:{...Xa.display??{},title:`${((Kc=Xa.display)==null?void 0:Kc.title)||ti.name} ${Lr}`}}}),Ga.id}const xt=bSr({store:r,session:()=>{const Qn=l();return s===null||Qn===null?null:{api:s,wallet:Qn}},account:()=>s===null?"unavailable":l()===null?"guest":"on",hash:Ixe,title:$t,duplicate:async Qn=>{const Lr=await vt(Qn,rPt(new Date));if(Lr===null)throw new Error("The scene is no longer on this device");return Lr}});let ut=!1,Nt=0;async function Ut(){const Qn=++Nt,Lr=l()!==null&&(await St.shell.aiProviders()).some(ti=>ti.available);Qn!==Nt||Lr===ut||(ut=Lr,G0())}Ut();let Wt=l();const Me=setInterval(()=>{const Qn=l();Qn!==Wt&&(Wt=Qn,St.reset(),G0(),Ut(),xt.refresh(!0),Ce(fe).catch(Lr=>console.warn("[editor] could not clear the previews",Lr)))},ikr),Ke=()=>{document.visibilityState==="hidden"&&xt.flush()};document.addEventListener("visibilitychange",Ke);const st=new Set;async function tn(Qn,Lr){const ti=M1(await Ue(Qn,"scene.json"));if(ti===null)throw new Error("scene.json is missing or is not valid JSON");await qt(Qn,"scene.json",lOt(Lr(ti)))}async function An(Qn,Lr){if(Lr==null||Lr==="")return null;const ti=await Ue(Qn,Lr).catch(()=>{});return ti===void 0||ti.length>tkr?null:uOt(Lr,ti)}async function un(Qn,Lr=xt.status().projects){var Ga,Xa,Kc,uu;const ti=M1(await Ue(Qn.id,"scene.json").catch(()=>{}));return{sync:Lr[Qn.id],path:Qn.id,name:Qn.name,title:((Ga=ti==null?void 0:ti.display)==null?void 0:Ga.title)||Qn.name,world:((Xa=ti==null?void 0:ti.worldConfiguration)==null?void 0:Xa.name)||null,parcels:Array.isArray((Kc=ti==null?void 0:ti.scene)==null?void 0:Kc.parcels)?ti.scene.parcels.length:0,thumbnail:await An(Qn.id,(uu=ti==null?void 0:ti.display)==null?void 0:uu.navmapThumbnail),favourite:Qn.favourite,lastOpened:Qn.lastOpened,published:Qn.published,deletedAt:Qn.deletedAt??void 0}}async function Tn(Qn,Lr){var Ga,Xa;gt(),f.length=0,F({type:"sessionStarted"});const ti=Kc=>{if(gt(),Lr===qe){C(`✖ ${Kc}`);for(const uu of T)uu(Kc)}};try{if(await xt.prepareOpen(Qn,(ii,yl)=>C(`Downloading from your account… ${ii}/${yl}`)),Lr!==qe)return;if(!await r.open(Qn)){ti("This scene is open in another tab. Close it there to edit it here.");return}const Kc=await r.readAll(Qn).then(async ii=>{for(const[yl,ja]of pxr(ii))await qt(Qn,yl,ja),ii.set(yl,ja);return ii}).catch(ii=>{throw r.close(Qn),ii});if(Lr!==qe){r.close(Qn);return}const uu=await he(Qn);if(Lr!==qe){r.close(Qn);return}const lr=K.open(Qn,Kc,uu);pe=lr;const Pl=K.realmUrl(uu);if(fe=Pl,C(`▶ Opening ${((Xa=(Ga=M1(lr.files.get("scene.json")))==null?void 0:Ga.display)==null?void 0:Xa.title)||Qn}`),!await lr.start()&&!await lr.published()){if(Lr!==qe)return;C("✖ The scene did not build.");for(const ii of T)ii("The scene did not build.");return}if(await r.patch(Qn,{lastOpened:Date.now()}),Lr!==qe){gt();return}const fm=M1(lr.files.get("scene.json"))??{};te=o9e(fm,Pl),X=qTr(ii=>t.engineConsole(ii),C);for(const ii of x)ii(te)}catch(Kc){ti(okr(Kc))}}function fi(Qn){N.close(),te=null;const Lr=++qe,ti=St.reset(),Ga=wt.then(async()=>{await ti,await ft,Lr===qe&&await Qn(Lr)});return wt=Ga.catch(Xa=>console.error("[editor] project transition failed",Xa)),Ga}function Tt(){if(pe===null)throw new Error("no project is open");return pe}const Wi={saveFile:async({path:Qn,content:Lr})=>qt(Tt().id,Qn,Lr),getFile:async({path:Qn})=>{const Lr=Tt().files.get(Qn)??hTr(Qn);if(Lr===void 0)throw new Error(`no such file: ${Qn}`);return{content:Lr}},removeFiles:async({filePaths:Qn})=>{const Lr=Tt(),ti=[],Ga=[];for(const Xa of Qn)(await Ve(Lr.id,Xa).catch(()=>!1)?ti:Ga).push(Xa);return{success:ti,failed:Ga}},getFilesSizes:async({path:Qn,ignore:Lr})=>{const ti=Qn===""?"":`${Qn.replace(/\/+$/,"")}/`;return{files:[...Tt().files.keys()].filter(Xa=>Xa.startsWith(ti)&&!Xa.split("/").some(Kc=>Lr.includes(Kc))).sort().map(Xa=>({path:Xa}))}}},Er={async find(Qn){return(await r.list()).some(Lr=>Lr.id===Qn)?!0:(await xt.refresh(!0),xt.remoteOnly().some(Lr=>Lr.id===Qn))},files:async Qn=>(pe==null?void 0:pe.id)===Qn?new Map(pe.files):r.readAll(Qn),manifest:Qn=>xt.manifest(Qn),build:async(Qn,Lr)=>K.build(Qn,await Er.files(Qn),Lr),dependencies:async Qn=>oWt(await Ue(Qn,"package.json")),onImported:Qn=>(st.add(Qn),()=>st.delete(Qn))},lo=a===null?null:sSr({host:a,setWorld:async(Qn,Lr)=>{var Ga,Xa;((Xa=(Ga=M1(await Ue(Qn,"scene.json")))==null?void 0:Ga.worldConfiguration)==null?void 0:Xa.name)!==Lr&&await tn(Qn,Kc=>({...Kc,worldConfiguration:{...Kc.worldConfiguration??{},name:Lr}}))},files:Qn=>Er.files(Qn),build:(Qn,Lr)=>K.build(Qn,Lr,{production:!0}),published:(Qn,Lr)=>r.patch(Qn,{published:Lr})}),Ba=(a==null?void 0:a.services.projects)==null?null:ZTr(_Sr(a.services.projects,(Qn,Lr)=>a.signedFetch(Qn,Lr)),Ixe);ydr(Ewr(t.editorBase)),Cwr(t.editorBase),v$t({material:Awr,sound:Owr}),Qdr(async()=>ekr(await Er.files(Tt().id)));const zo=TTr({builtin:MSr(t.editorBase,gB("prefabs/catalog.json"),gTe),user:()=>Ba!==null&&l()!==null?Ba.tree:null}),Zc={...(a==null?void 0:a.services.projects)==null?{}:{...St.shell,aiOffered:()=>ut,aiTranscript:()=>{const Qn=Wt;if(Qn===null||pe===null)return null;const Lr=pe.id;return{owner:`${Lr}@${Qn.toLowerCase()}`,load:()=>r.transcript(Lr,Qn),save:ti=>r.setTranscript(Lr,Qn,ti)}}},pickProject:async()=>{},openProject:Qn=>fi(Lr=>Tn(Qn,Lr)),relaunchProject:Qn=>fi(Lr=>Tn(Qn,Lr)),closeProject:()=>fi(async()=>{gt(),F({type:"sessionStarted"}),C("■ Scene closed"),await Ce(null).catch(Qn=>console.warn("[editor] could not clear the previews",Qn))}),getState:async()=>{const Qn=await r.list(),Lr=xt.status().projects,ti=xt.remoteOnly().map(Ga=>({path:Ga.id,name:Ga.name,title:Ga.name,world:null,parcels:0,thumbnail:null,remoteOnly:!0}));return{recentProjects:[...Qn].sort((Ga,Xa)=>Xa.lastOpened-Ga.lastOpened).map(Ga=>Ga.id),projects:[...await Promise.all(Qn.map(Ga=>un(Ga,Lr))),...ti],logs:[...f],bevyWebDir:"",editorSceneDir:"",webPort:0,scenePort:0,editorScenePort:0,favourites:Qn.filter(Ga=>Ga.favourite).map(Ga=>Ga.id)}},onStackLog:Qn=>{m.push(Qn)},onBuildEvent:Qn=>{_.push(Qn)},onServersReady:Qn=>{x.push(Qn)},requestReady:async()=>te,phonePreview:async Qn=>te===null?{ok:!1,reason:"no-scene"}:N.open(te.realm,te.position,Qn),phonePreviewState:N.state,onPhonePreviewState:N.subscribe,closePhonePreview:N.close,capturePhonePreview:N.capture,onServersError:Qn=>{T.push(Qn)},toggleFavourite:async Qn=>{const Lr=(await r.list()).find(ti=>ti.id===Qn);Lr!==void 0&&await r.patch(Qn,{favourite:!Lr.favourite})},deleteProject:async Qn=>{const Lr=await r.trash(Qn);return Lr&&xt.trashed(Qn),Lr},trashedProjects:async()=>Promise.all((await r.trashed()).map(Qn=>un(Qn))),restoreProject:async Qn=>{const Lr=await r.restore(Qn);return Lr&&xt.restored(Qn),Lr},syncStatus:async()=>(xt.refresh(),xt.status()),onSyncStatus:Qn=>xt.subscribe(Qn),resolveSyncConflict:(Qn,Lr)=>xt.resolve(Qn,Lr),exportProject:async Qn=>NSr(await $t(Qn),await Er.files(Qn)),importProject:async Qn=>{const Lr=await RSr(Qn,async(ti,Ga)=>{const Xa=await r.create(ti,Ga,{taken:xt.remoteIds()});return xt.touched(Xa.id,"scene.json"),Xa.id});if((Lr==null?void 0:Lr.ok)===!0){const{id:ti,needsPackages:Ga}=Lr.report;Object.keys(Ga).length>0&&r.readAll(ti).then(Xa=>K.install(ti,Xa)).catch(Xa=>console.warn("[editor] could not install the packages of",ti,Xa));for(const Xa of st)Xa(Lr.report)}return Lr},projectPackages:async Qn=>B.get(Qn)??null,onProjectPackages:Qn=>(H.add(Qn),()=>H.delete(Qn)),...lo===null||a===null?{}:{publishScene:(Qn,Lr,ti)=>lo.publish(Qn,Lr,ti),publishStop:async()=>lo.stop(),publishWorlds:async()=>{const Qn=l();return Qn===null?[]:rSr(Qn,a.services.worldsContent.replace(/\/+$/,""))}},canImportFolder:ISr(),renameProject:(Qn,Lr)=>tn(Qn,ti=>({...ti,display:{...ti.display??{},title:Lr.trim()}})),duplicateProject:Qn=>vt(Qn,"copy"),sceneTemplates:async()=>fTr(),createScene:async(Qn,Lr,ti)=>{const Ga=SWt(ti),Xa=M1(Ga.get("scene.json"));if(Xa===null)throw new Error(`template not found: ${ti}`);Ga.set("scene.json",lOt({...Xa,display:{...Xa.display??{},title:Lr.trim()}}));const Kc=await r.create(Lr,Ga,{taken:xt.remoteIds()});return xt.touched(Kc.id,"scene.json"),Kc.id},openExternal:async Qn=>{/^https?:$/.test(new URL(Qn).protocol)&&window.open(Qn,"_blank","noopener,noreferrer")},compositeEntityIds:async Qn=>{for(const Lr of Rwr){const ti=await Ue(Qn,Lr);if(ti!==void 0)return Mwr(new TextDecoder().decode(ti))}return[]},sceneSettings:async Qn=>{const Lr=M1(await Ue(Qn,"scene.json"));if(Lr===null)throw new Error("scene.json is missing or is not valid JSON");const ti=Pwr(Lr);return{...ti,thumbnail:await An(Qn,ti.thumbnailPath)}},saveSceneSettings:async(Qn,Lr)=>{const ti=Iwr(Lr);return ti!==null?ti:(await tn(Qn,Ga=>Nwr(Ga,Lr)),null)},pickSceneThumbnail:async Qn=>{const Lr=await wWt(Object.values(DWe).join(","));if(Lr===null)return null;const ti=aWt(Lr.name);if(DWe[ti]===void 0)throw new Error("not a supported image (png, jpg, gif, webp)");const Ga=`${rkr}/scene-thumbnail${ti}`,Xa=new Uint8Array(await Lr.arrayBuffer());return await qt(Qn,Ga,Xa),{path:Ga,dataUrl:uOt(Ga,Xa)}},appVersion:async()=>vwr,prefabLibraryList:()=>zo.list(),prefabLibraryCopyIn:async(Qn,Lr)=>zo.copyIn(Qn,Re(Lr)),prefabLibraryUpdateCopy:async(Qn,Lr)=>zo.updateCopy(Qn,Re(Lr)),prefabUserLibrary:()=>Ba===null?"unavailable":l()===null?"guest":"on",...Ba===null?{}:{prefabLibraryCopyOut:async(Qn,Lr)=>{if(l()===null)throw new Error(skr);return Ba.copyOut(Re(Qn),Lr)},prefabLibraryDelete:async Qn=>{const Lr=TWt(Qn);return(Lr==null?void 0:Lr.scope)==="user"&&l()!==null?Ba.remove(Lr.name):!1}}};async function Hl(){const Qn=new Set;for(const Lr of[...await r.list(),...await r.trashed()]){const ti=QVt(await Ue(Lr.id,R3).catch(()=>{}));for(const Ga of Object.keys((ti==null?void 0:ti.packages)??{}))Qn.add(Ga);for(const[Ga,Xa]of Object.entries((ti==null?void 0:ti.dependencies)??{}))Qn.add(Wj(Ga,Xa))}for(const Lr of await r.packages.keys())Qn.has(Lr)||await r.packages.remove(Lr)}return r.purge(Date.now()-nkr).then(async Qn=>{const Lr=await caches.open(Rxe),ti=Qn.map(({id:Xa,previewId:Kc})=>K.realmUrl(Kc??Xa));for(const Xa of await Lr.keys())ti.some(Kc=>Xa.url.startsWith(Kc))&&await Lr.delete(Xa);const Ga=await caches.open(gwr);for(const Xa of ti)await Ga.delete(`${Xa}__storage`);Qn.length>0&&await Hl()}).catch(Qn=>console.warn("[editor] could not empty the trash",Qn)),{shell:Zc,projects:Er,dataLayer:Wi,dispose:()=>{N.dispose(),St.dispose(),qe++,gt(),K.dispose(),clearInterval(Me),document.removeEventListener("visibilitychange",Ke),xt.flush().finally(()=>xt.dispose())}}};let qj=null,xG=null,ere=null,VOt=!1;function lkr(){if(qj!==null)return qj;const t=window.__dclEditorHost;if(t===void 0||t.version!==0&&t.version!==1)return console.error("[editor] window.__dclEditorHost (contract v0 or v1) is missing: nothing to mount into"),null;console.log("[editor] web build 2026-10-28T01:10:39.701Z"),oPt(t),GIt(a=>t.engineConsole(a)),eRt(()=>t.identity()),DGn.needed=!1;const n=ckr({host:t,sceneCompiler:kwr(t.editorBase)});window.editorShell=ukr(n.shell,t),bDt(n.dataLayer??null),UGe();const r=document.createElement("link");return r.rel="stylesheet",r.href=new URL("editor.css",t.editorBase).href,r.integrity=gB("editor.css"),r.crossOrigin="anonymous",r.onerror=()=>console.error("[editor] editor.css did not load or does not match the hash this editor was published with: its fonts are not applied"),document.head.appendChild(r),OE.project=null,OE.notice=null,qj={host:t,web:n,fonts:r},qj}function jxe(){const t=xG;xG=null,t==null||t.unmount()}function ukr(t,n){const{createScene:r,importProject:a,duplicateProject:s}=t;return{...t,...r===void 0?{}:{createScene:async(l,f,m)=>{const _=await r(l,f,m);return _!==null&&Xx("project_created",{project_id:_,source:"template",template:m}),_}},...a===void 0?{}:{importProject:async l=>{const f=await a(l);return(f==null?void 0:f.ok)===!0&&Xx("project_created",{project_id:f.report.id,source:"import",import_kind:l}),f}},...s===void 0?{}:{duplicateProject:async l=>{const f=await s(l);return f!==null&&Xx("project_created",{project_id:f,source:"duplicate",from_project_id:l}),f}},openProject:async l=>{const f=xG;jxe(),f==null||f.api.close(),ere??(ere=ZFt(n.container,A.jsx(Y1r,{}))),n.setMode("edit"),OE.project=l,OE.opens++,await t.openProject(l),Xx("project_opened")}}}function dkr(t,n){var m;const r=lkr();if(r===null)return()=>{};jxe();const a=document.createElement("div");a.style.cssText="position:relative;width:100%;height:100%",pGn(a),t.appendChild(a);const s=ZFt(a,A.jsx(_Gn,{}),"eui-create-root"),l={api:n,unmount:()=>{s(),a.remove()}};xG=l;const f=VOt?null:((m=kk(r.host))==null?void 0:m.openProject)??null;return VOt=!0,Xx("editor_opened",{deep_link:f!==null}),f!==null&&r.web.projects.find(f).catch(()=>!1).then(_=>{var x;xG===l&&(_?(x=window.editorShell)==null||x.openProject(f):OE.notice=`“${f}” is not on this device or on your account. Here are your scenes.`)}),()=>{xG===l&&jxe()}}function fkr(){jxe();const t=qj;if(t===null)return;qj=null;const n=eO();ere==null||ere(),ere=null,t.fonts.remove(),OE.project=null,delete window.editorShell,eRt(null),GIt(null),oPt(null),t.host.setMode("off"),n.finally(()=>{var r,a;(a=(r=t.web).dispose)==null||a.call(r),qj===null&&bDt(null)})}window.__dclEditor={mountHome:dkr,unmount:fkr};
35767
+ `;F.set("data.json",new TextEncoder().encode(K));const te=zWe(kWt(H,T)).slice(0,QTr).replace(/_+$/,"")||"prefab",pe=new Set((await t.list()).map(X=>X.name));let fe=1;for(let X=0;X<YTr;X++){let he=te;for(;pe.has(he);)he=`${te}_${++fe}`;try{return await f(he,F),{ref:`user:${he}`,scope:"user",data:K}}catch(Ce){if(!(Ce instanceof pWt))throw Ce;pe.add(he)}}throw new Error("could not find a free name in your library — try again")},remove:m=>t.remove(m)}}const $Ot=new WeakMap;function KTr(t){let n=$Ot.get(t);return n===void 0&&(n=crypto.subtle.digest("SHA-256",new Uint8Array(t)).then(r=>[...new Uint8Array(r)].map(a=>a.toString(16).padStart(2,"0")).join("")),$Ot.set(t,n)),n}async function ekr(t){const n=t.get(".dclignore"),r=QXe(t.keys(),n===void 0?void 0:new TextDecoder().decode(n)).filter(l=>l!==R3),a=new Map;let s=0;for(const l of r){const f=t.get(l);f!==void 0&&(a.set(await KTr(f),f.byteLength),s++)}return{bytes:[...a.values()].reduce((l,f)=>l+f,0),files:s}}const zOt=4e3,tkr=4e6,nkr=iPt*24*60*60*1e3,rkr="assets/images",ikr=3e3,akr=100,skr="Sign in to keep prefabs in your own library. The built-in prefabs work without it.",okr=t=>t instanceof Error?t.message:String(t);function o9e(t,n){var r,a,s;return{realm:n.replace(/\/$/,""),systemScene:"",position:((r=t.scene)==null?void 0:r.base)??((s=(a=t.scene)==null?void 0:a.parcels)==null?void 0:s[0])??"0,0",spawn:Dwr(t),spawnPoints:JSON.stringify(Array.isArray(t.spawnPoints)?t.spawnPoints:[])}}const ckr=({host:t,sceneCompiler:n})=>{const r=new pSr(oSr()),a=kk(t),s=a===null||a.services.projects===null?null:fWt(a.services.projects,(Qn,Lr)=>a.signedFetch(Qn,Lr)),l=()=>{const{address:Qn,isGuest:Lr}=t.identity();return Lr||Qn===null?null:Qn.toLowerCase()},f=[],m=[],_=[],x=[],T=[],C=Qn=>{f.push(Qn),f.length>zOt&&f.splice(0,f.length-zOt);for(const Lr of m)Lr(Qn)},N=BTr(FTr(t.pageDir,(a==null?void 0:a.services.projects)??null),he,async Qn=>BOt(await Z,l()??"guest",Qn),jTr((a==null?void 0:a.services.worldsContent)??null)),F=Qn=>{for(const Lr of _)Lr(Qn);Qn.type==="bundleSaved"&&pe!==null&&N.built(pe.id).catch(Lr=>console.error("[editor] mobile preview reload failed",Lr))},B=new Map,H=new Set,Z=G3t.then(OTr),K=DTr({pageDir:t.pageDir,urls:n,machineId:async Qn=>BOt(await Z,l()??"guest",Qn),emit:F,log:C,packages:r.packages,saveLock:async(Qn,Lr)=>{await r.write(Qn,R3,Lr),xt.touched(Qn,R3),(pe==null?void 0:pe.id)===Qn&&pe.files.set(R3,Lr)},onPackages:(Qn,Lr)=>{if(Lr===null){B.delete(Qn);return}B.set(Qn,Lr);for(const ti of H)ti(Qn,Lr)}});let te=null,pe=null,fe=null,X=null;async function he(Qn){var Ga;const Lr=(Ga=(await r.list()).find(Xa=>Xa.id===Qn))==null?void 0:Ga.previewId;if(Lr!==void 0)return Lr;const ti="p"+Array.from(crypto.getRandomValues(new Uint8Array(16)),Xa=>Xa.toString(16).padStart(2,"0")).join("");return await r.patch(Qn,{previewId:ti}),ti}async function Ce(Qn){const Lr=new URL("preview/",t.pageDir).href,ti=await caches.open(Rxe);for(const Ga of await ti.keys())Ga.url.startsWith(Lr)&&(Qn===null||!Ga.url.startsWith(Qn))&&await ti.delete(Ga)}let qe=0,wt=Promise.resolve(),ft=Promise.resolve();const St=wwr({service:(a==null?void 0:a.services.projects)??null,fetch:(Qn,Lr)=>a===null?Promise.reject(new Error("The assistant service is not configured.")):a.signedFetch(Qn,Lr),wallet:l,mobilePreview:N.status,memory:{read:async(Qn,Lr)=>{const ti=await r.assistantMemory(Qn,Lr);return dl(ti)&&typeof ti.id=="string"&&typeof ti.key=="string"?{id:ti.id,key:ti.key}:null},write:(Qn,Lr,ti)=>r.setAssistantMemory(Qn,Lr,ti)},project:()=>{const Qn=Tt();return{id:Qn.id,tools:{files:()=>Qn.files,write:(Lr,ti,Ga,Xa)=>qt(Qn.id,Lr,ti,{expected:Ga,signal:Xa}),assets:p$t({files:()=>Qn.files}),scene:(Lr,ti)=>lTe(Lr,ti,async Ga=>{var ii,yl,ja;const Xa=ss=>{var Ts,Zs;return JSON.stringify([(Ts=ss==null?void 0:ss.scene)==null?void 0:Ts.parcels,(Zs=ss==null?void 0:ss.scene)==null?void 0:Zs.base])};await eO();const Kc=Xa(M1(await Ue(Qn.id,"scene.json")));await tn(Qn.id,ss=>Fwr(ss,Ga));const uu=M1(await Ue(Qn.id,"scene.json")),lr=Xa(uu)!==Kc,Pl=((ii=uu==null?void 0:uu.scene)==null?void 0:ii.parcels)??[],fm=(yl=nt.scene)==null?void 0:yl.parcels.map(ss=>`${ss.x},${ss.y}`).sort().join(";");if(lr||fm!==[...Pl].sort().join(";")){if(!await Qn.flush())throw new Error("The scene did not build. Fix the code and retry sceneSettings to load the new parcels.");ti.throwIfAborted();const ss=await he(Qn.id);te=o9e(uu??{},K.realmUrl(ss)),await GTr(Pl,()=>{for(const Ts of x)Ts(te)},ti)}else if(te!==null){const ss=o9e(uu??{},te.realm);(ss.spawn!==te.spawn||ss.spawnPoints!==te.spawnPoints)&&(te={...te,spawn:ss.spawn,spawnPoints:ss.spawnPoints},vur(ss.spawn,ss.spawnPoints))}return{requiredPermissions:(uu==null?void 0:uu.requiredPermissions)??[],spawnPoints:(uu==null?void 0:uu.spawnPoints)??[],parcels:Pl,base:((ja=uu==null?void 0:uu.scene)==null?void 0:ja.base)??null,previewReady:!0}}),written:_$t,view:(Lr,ti)=>AXe(Lr,ti),playtest:fzt,uiLayout:hzt,turnEnded:lzt,build:async Lr=>{Lr.throwIfAborted(),await ft;const ti=await K.build(Qn.id,new Map(Qn.files));if(Lr.throwIfAborted(),!ti.ok)return{ok:!1,diagnostics:ti.diagnostics,mobilePreview:N.status()};const Ga=await f$t();return Lr.throwIfAborted(),{ok:!0,diagnostics:ti.diagnostics,run:Ga,mobilePreview:N.status()}}}}}});function gt(){St.reset(),X==null||X(),X=null,pe!==null&&(pe.stop(),r.close(pe.id),xt.flush(pe.id),pe=null,fe=null)}async function Ue(Qn,Lr){return(pe==null?void 0:pe.id)===Qn?pe.files.get(Lr):r.read(Qn,Lr).catch(ti=>{if(!mI(ti))throw ti})}function qt(Qn,Lr,ti,Ga){const Xa=ft.then(async()=>{if(Ga==null||Ga.signal.throwIfAborted(),Ga!==void 0&&((pe==null?void 0:pe.id)!==Qn||!y$t(pe.files.get(Lr),Ga.expected)))throw new Error("This file changed. Read it again before writing.");await r.write(Qn,Lr,ti),xt.touched(Qn,Lr),(pe==null?void 0:pe.id)===Qn&&(pe.files.set(Lr,ti),pe.changed(Lr))});return ft=Xa.catch(Kc=>console.error("[editor] file write failed",Kc)),Xa}function Ve(Qn,Lr){const ti=ft.then(async()=>{const Ga=await r.remove(Qn,Lr);return Ga&&xt.touched(Qn,Lr),Ga&&(pe==null?void 0:pe.id)===Qn&&pe.files.delete(Lr)&&pe.changed(Lr),Ga});return ft=ti.catch(Ga=>console.error("[editor] file removal failed",Ga)),ti}function Re(Qn){const Lr=Tt();if(Lr.id!==Qn)throw new Error("that scene is not the one open");return{files:()=>Lr.files,write:(ti,Ga)=>qt(Qn,ti,Ga),remove:async ti=>{await Ve(Qn,ti)}}}async function $t(Qn){var Ga;const Lr=M1(await Ue(Qn,"scene.json").catch(()=>{})),ti=(((Ga=Lr==null?void 0:Lr.display)==null?void 0:Ga.title)??"").replace(/[\x00-\x1f\x7f]/g,"").replace(new RegExp(dWt.source,"g"),"").trim().slice(0,akr);return ti===""?Qn:ti}async function vt(Qn,Lr){const ti=(await r.list()).find(Xa=>Xa.id===Qn);if(ti===void 0)return null;const Ga=await r.duplicate(Qn,`${ti.name} ${Lr}`,xt.remoteIds());return await tn(Ga.id,Xa=>{var Kc;return{...Xa,display:{...Xa.display??{},title:`${((Kc=Xa.display)==null?void 0:Kc.title)||ti.name} ${Lr}`}}}),Ga.id}const xt=bSr({store:r,session:()=>{const Qn=l();return s===null||Qn===null?null:{api:s,wallet:Qn}},account:()=>s===null?"unavailable":l()===null?"guest":"on",hash:Ixe,title:$t,duplicate:async Qn=>{const Lr=await vt(Qn,rPt(new Date));if(Lr===null)throw new Error("The scene is no longer on this device");return Lr}});let ut=!1,Nt=0;async function Ut(){const Qn=++Nt,Lr=l()!==null&&(await St.shell.aiProviders()).some(ti=>ti.available);Qn!==Nt||Lr===ut||(ut=Lr,G0())}Ut();let Wt=l();const Me=setInterval(()=>{const Qn=l();Qn!==Wt&&(Wt=Qn,St.reset(),G0(),Ut(),xt.refresh(!0),Ce(fe).catch(Lr=>console.warn("[editor] could not clear the previews",Lr)))},ikr),Ke=()=>{document.visibilityState==="hidden"&&xt.flush()};document.addEventListener("visibilitychange",Ke);const st=new Set;async function tn(Qn,Lr){const ti=M1(await Ue(Qn,"scene.json"));if(ti===null)throw new Error("scene.json is missing or is not valid JSON");await qt(Qn,"scene.json",lOt(Lr(ti)))}async function An(Qn,Lr){if(Lr==null||Lr==="")return null;const ti=await Ue(Qn,Lr).catch(()=>{});return ti===void 0||ti.length>tkr?null:uOt(Lr,ti)}async function un(Qn,Lr=xt.status().projects){var Ga,Xa,Kc,uu;const ti=M1(await Ue(Qn.id,"scene.json").catch(()=>{}));return{sync:Lr[Qn.id],path:Qn.id,name:Qn.name,title:((Ga=ti==null?void 0:ti.display)==null?void 0:Ga.title)||Qn.name,world:((Xa=ti==null?void 0:ti.worldConfiguration)==null?void 0:Xa.name)||null,parcels:Array.isArray((Kc=ti==null?void 0:ti.scene)==null?void 0:Kc.parcels)?ti.scene.parcels.length:0,thumbnail:await An(Qn.id,(uu=ti==null?void 0:ti.display)==null?void 0:uu.navmapThumbnail),favourite:Qn.favourite,lastOpened:Qn.lastOpened,published:Qn.published,deletedAt:Qn.deletedAt??void 0}}async function Tn(Qn,Lr){var Ga,Xa;gt(),f.length=0,F({type:"sessionStarted"});const ti=Kc=>{if(gt(),Lr===qe){C(`✖ ${Kc}`);for(const uu of T)uu(Kc)}};try{if(await xt.prepareOpen(Qn,(ii,yl)=>C(`Downloading from your account… ${ii}/${yl}`)),Lr!==qe)return;if(!await r.open(Qn)){ti("This scene is open in another tab. Close it there to edit it here.");return}const Kc=await r.readAll(Qn).then(async ii=>{for(const[yl,ja]of pxr(ii))await qt(Qn,yl,ja),ii.set(yl,ja);return ii}).catch(ii=>{throw r.close(Qn),ii});if(Lr!==qe){r.close(Qn);return}const uu=await he(Qn);if(Lr!==qe){r.close(Qn);return}const lr=K.open(Qn,Kc,uu);pe=lr;const Pl=K.realmUrl(uu);if(fe=Pl,C(`▶ Opening ${((Xa=(Ga=M1(lr.files.get("scene.json")))==null?void 0:Ga.display)==null?void 0:Xa.title)||Qn}`),!await lr.start()&&!await lr.published()){if(Lr!==qe)return;C("✖ The scene did not build.");for(const ii of T)ii("The scene did not build.");return}if(await r.patch(Qn,{lastOpened:Date.now()}),Lr!==qe){gt();return}const fm=M1(lr.files.get("scene.json"))??{};te=o9e(fm,Pl),X=qTr(ii=>t.engineConsole(ii),C);for(const ii of x)ii(te)}catch(Kc){ti(okr(Kc))}}function fi(Qn){N.close(),te=null;const Lr=++qe,ti=St.reset(),Ga=wt.then(async()=>{await ti,await ft,Lr===qe&&await Qn(Lr)});return wt=Ga.catch(Xa=>console.error("[editor] project transition failed",Xa)),Ga}function Tt(){if(pe===null)throw new Error("no project is open");return pe}const Wi={saveFile:async({path:Qn,content:Lr})=>qt(Tt().id,Qn,Lr),getFile:async({path:Qn})=>{const Lr=Tt().files.get(Qn)??hTr(Qn);if(Lr===void 0)throw new Error(`no such file: ${Qn}`);return{content:Lr}},removeFiles:async({filePaths:Qn})=>{const Lr=Tt(),ti=[],Ga=[];for(const Xa of Qn)(await Ve(Lr.id,Xa).catch(()=>!1)?ti:Ga).push(Xa);return{success:ti,failed:Ga}},getFilesSizes:async({path:Qn,ignore:Lr})=>{const ti=Qn===""?"":`${Qn.replace(/\/+$/,"")}/`;return{files:[...Tt().files.keys()].filter(Xa=>Xa.startsWith(ti)&&!Xa.split("/").some(Kc=>Lr.includes(Kc))).sort().map(Xa=>({path:Xa}))}}},Er={async find(Qn){return(await r.list()).some(Lr=>Lr.id===Qn)?!0:(await xt.refresh(!0),xt.remoteOnly().some(Lr=>Lr.id===Qn))},files:async Qn=>(pe==null?void 0:pe.id)===Qn?new Map(pe.files):r.readAll(Qn),manifest:Qn=>xt.manifest(Qn),build:async(Qn,Lr)=>K.build(Qn,await Er.files(Qn),Lr),dependencies:async Qn=>oWt(await Ue(Qn,"package.json")),onImported:Qn=>(st.add(Qn),()=>st.delete(Qn))},lo=a===null?null:sSr({host:a,setWorld:async(Qn,Lr)=>{var Ga,Xa;((Xa=(Ga=M1(await Ue(Qn,"scene.json")))==null?void 0:Ga.worldConfiguration)==null?void 0:Xa.name)!==Lr&&await tn(Qn,Kc=>({...Kc,worldConfiguration:{...Kc.worldConfiguration??{},name:Lr}}))},files:Qn=>Er.files(Qn),build:(Qn,Lr)=>K.build(Qn,Lr,{production:!0}),published:(Qn,Lr)=>r.patch(Qn,{published:Lr})}),Ba=(a==null?void 0:a.services.projects)==null?null:ZTr(_Sr(a.services.projects,(Qn,Lr)=>a.signedFetch(Qn,Lr)),Ixe);ydr(Ewr(t.editorBase)),Cwr(t.editorBase),v$t({material:Awr,sound:Owr}),Qdr(async()=>ekr(await Er.files(Tt().id)));const zo=TTr({builtin:MSr(t.editorBase,gB("prefabs/catalog.json"),gTe),user:()=>Ba!==null&&l()!==null?Ba.tree:null}),Zc={...(a==null?void 0:a.services.projects)==null?{}:{...St.shell,aiOffered:()=>ut,aiTranscript:()=>{const Qn=Wt;if(Qn===null||pe===null)return null;const Lr=pe.id;return{owner:`${Lr}@${Qn.toLowerCase()}`,load:()=>r.transcript(Lr,Qn),save:ti=>r.setTranscript(Lr,Qn,ti)}}},pickProject:async()=>{},openProject:Qn=>fi(Lr=>Tn(Qn,Lr)),relaunchProject:Qn=>fi(Lr=>Tn(Qn,Lr)),closeProject:()=>fi(async()=>{gt(),F({type:"sessionStarted"}),C("■ Scene closed"),await Ce(null).catch(Qn=>console.warn("[editor] could not clear the previews",Qn))}),getState:async()=>{const Qn=await r.list(),Lr=xt.status().projects,ti=xt.remoteOnly().map(Ga=>({path:Ga.id,name:Ga.name,title:Ga.name,world:null,parcels:0,thumbnail:null,remoteOnly:!0}));return{recentProjects:[...Qn].sort((Ga,Xa)=>Xa.lastOpened-Ga.lastOpened).map(Ga=>Ga.id),projects:[...await Promise.all(Qn.map(Ga=>un(Ga,Lr))),...ti],logs:[...f],bevyWebDir:"",editorSceneDir:"",webPort:0,scenePort:0,editorScenePort:0,favourites:Qn.filter(Ga=>Ga.favourite).map(Ga=>Ga.id)}},onStackLog:Qn=>{m.push(Qn)},onBuildEvent:Qn=>{_.push(Qn)},onServersReady:Qn=>{x.push(Qn)},requestReady:async()=>te,phonePreview:async Qn=>te===null?{ok:!1,reason:"no-scene"}:N.open(te.realm,te.position,Qn),phonePreviewState:N.state,onPhonePreviewState:N.subscribe,closePhonePreview:N.close,capturePhonePreview:N.capture,onServersError:Qn=>{T.push(Qn)},toggleFavourite:async Qn=>{const Lr=(await r.list()).find(ti=>ti.id===Qn);Lr!==void 0&&await r.patch(Qn,{favourite:!Lr.favourite})},deleteProject:async Qn=>{const Lr=await r.trash(Qn);return Lr&&xt.trashed(Qn),Lr},trashedProjects:async()=>Promise.all((await r.trashed()).map(Qn=>un(Qn))),restoreProject:async Qn=>{const Lr=await r.restore(Qn);return Lr&&xt.restored(Qn),Lr},syncStatus:async()=>(xt.refresh(),xt.status()),onSyncStatus:Qn=>xt.subscribe(Qn),resolveSyncConflict:(Qn,Lr)=>xt.resolve(Qn,Lr),exportProject:async Qn=>NSr(await $t(Qn),await Er.files(Qn)),importProject:async Qn=>{const Lr=await RSr(Qn,async(ti,Ga)=>{const Xa=await r.create(ti,Ga,{taken:xt.remoteIds()});return xt.touched(Xa.id,"scene.json"),Xa.id});if((Lr==null?void 0:Lr.ok)===!0){const{id:ti,needsPackages:Ga}=Lr.report;Object.keys(Ga).length>0&&r.readAll(ti).then(Xa=>K.install(ti,Xa)).catch(Xa=>console.warn("[editor] could not install the packages of",ti,Xa));for(const Xa of st)Xa(Lr.report)}return Lr},projectPackages:async Qn=>B.get(Qn)??null,onProjectPackages:Qn=>(H.add(Qn),()=>H.delete(Qn)),...lo===null||a===null?{}:{publishScene:(Qn,Lr,ti)=>lo.publish(Qn,Lr,ti),publishStop:async()=>lo.stop(),publishWorlds:async()=>{const Qn=l();return Qn===null?[]:rSr(Qn,a.services.worldsContent.replace(/\/+$/,""))}},canImportFolder:ISr(),renameProject:(Qn,Lr)=>tn(Qn,ti=>({...ti,display:{...ti.display??{},title:Lr.trim()}})),duplicateProject:Qn=>vt(Qn,"copy"),sceneTemplates:async()=>fTr(),createScene:async(Qn,Lr,ti)=>{const Ga=SWt(ti),Xa=M1(Ga.get("scene.json"));if(Xa===null)throw new Error(`template not found: ${ti}`);Ga.set("scene.json",lOt({...Xa,display:{...Xa.display??{},title:Lr.trim()}}));const Kc=await r.create(Lr,Ga,{taken:xt.remoteIds()});return xt.touched(Kc.id,"scene.json"),Kc.id},openExternal:async Qn=>{/^https?:$/.test(new URL(Qn).protocol)&&window.open(Qn,"_blank","noopener,noreferrer")},compositeEntityIds:async Qn=>{for(const Lr of Rwr){const ti=await Ue(Qn,Lr);if(ti!==void 0)return Mwr(new TextDecoder().decode(ti))}return[]},sceneSettings:async Qn=>{const Lr=M1(await Ue(Qn,"scene.json"));if(Lr===null)throw new Error("scene.json is missing or is not valid JSON");const ti=Pwr(Lr);return{...ti,thumbnail:await An(Qn,ti.thumbnailPath)}},saveSceneSettings:async(Qn,Lr)=>{const ti=Iwr(Lr);return ti!==null?ti:(await tn(Qn,Ga=>Nwr(Ga,Lr)),null)},pickSceneThumbnail:async Qn=>{const Lr=await wWt(Object.values(DWe).join(","));if(Lr===null)return null;const ti=aWt(Lr.name);if(DWe[ti]===void 0)throw new Error("not a supported image (png, jpg, gif, webp)");const Ga=`${rkr}/scene-thumbnail${ti}`,Xa=new Uint8Array(await Lr.arrayBuffer());return await qt(Qn,Ga,Xa),{path:Ga,dataUrl:uOt(Ga,Xa)}},appVersion:async()=>vwr,prefabLibraryList:()=>zo.list(),prefabLibraryCopyIn:async(Qn,Lr)=>zo.copyIn(Qn,Re(Lr)),prefabLibraryUpdateCopy:async(Qn,Lr)=>zo.updateCopy(Qn,Re(Lr)),prefabUserLibrary:()=>Ba===null?"unavailable":l()===null?"guest":"on",...Ba===null?{}:{prefabLibraryCopyOut:async(Qn,Lr)=>{if(l()===null)throw new Error(skr);return Ba.copyOut(Re(Qn),Lr)},prefabLibraryDelete:async Qn=>{const Lr=TWt(Qn);return(Lr==null?void 0:Lr.scope)==="user"&&l()!==null?Ba.remove(Lr.name):!1}}};async function Hl(){const Qn=new Set;for(const Lr of[...await r.list(),...await r.trashed()]){const ti=QVt(await Ue(Lr.id,R3).catch(()=>{}));for(const Ga of Object.keys((ti==null?void 0:ti.packages)??{}))Qn.add(Ga);for(const[Ga,Xa]of Object.entries((ti==null?void 0:ti.dependencies)??{}))Qn.add(Wj(Ga,Xa))}for(const Lr of await r.packages.keys())Qn.has(Lr)||await r.packages.remove(Lr)}return r.purge(Date.now()-nkr).then(async Qn=>{const Lr=await caches.open(Rxe),ti=Qn.map(({id:Xa,previewId:Kc})=>K.realmUrl(Kc??Xa));for(const Xa of await Lr.keys())ti.some(Kc=>Xa.url.startsWith(Kc))&&await Lr.delete(Xa);const Ga=await caches.open(gwr);for(const Xa of ti)await Ga.delete(`${Xa}__storage`);Qn.length>0&&await Hl()}).catch(Qn=>console.warn("[editor] could not empty the trash",Qn)),{shell:Zc,projects:Er,dataLayer:Wi,dispose:()=>{N.dispose(),St.dispose(),qe++,gt(),K.dispose(),clearInterval(Me),document.removeEventListener("visibilitychange",Ke),xt.flush().finally(()=>xt.dispose())}}};let qj=null,xG=null,ere=null,VOt=!1;function lkr(){if(qj!==null)return qj;const t=window.__dclEditorHost;if(t===void 0||t.version!==0&&t.version!==1)return console.error("[editor] window.__dclEditorHost (contract v0 or v1) is missing: nothing to mount into"),null;console.log("[editor] web build 2026-10-28T01:11:37.875Z"),oPt(t),GIt(a=>t.engineConsole(a)),eRt(()=>t.identity()),DGn.needed=!1;const n=ckr({host:t,sceneCompiler:kwr(t.editorBase)});window.editorShell=ukr(n.shell,t),bDt(n.dataLayer??null),UGe();const r=document.createElement("link");return r.rel="stylesheet",r.href=new URL("editor.css",t.editorBase).href,r.integrity=gB("editor.css"),r.crossOrigin="anonymous",r.onerror=()=>console.error("[editor] editor.css did not load or does not match the hash this editor was published with: its fonts are not applied"),document.head.appendChild(r),OE.project=null,OE.notice=null,qj={host:t,web:n,fonts:r},qj}function jxe(){const t=xG;xG=null,t==null||t.unmount()}function ukr(t,n){const{createScene:r,importProject:a,duplicateProject:s}=t;return{...t,...r===void 0?{}:{createScene:async(l,f,m)=>{const _=await r(l,f,m);return _!==null&&Xx("project_created",{project_id:_,source:"template",template:m}),_}},...a===void 0?{}:{importProject:async l=>{const f=await a(l);return(f==null?void 0:f.ok)===!0&&Xx("project_created",{project_id:f.report.id,source:"import",import_kind:l}),f}},...s===void 0?{}:{duplicateProject:async l=>{const f=await s(l);return f!==null&&Xx("project_created",{project_id:f,source:"duplicate",from_project_id:l}),f}},openProject:async l=>{const f=xG;jxe(),f==null||f.api.close(),ere??(ere=ZFt(n.container,A.jsx(Y1r,{}))),n.setMode("edit"),OE.project=l,OE.opens++,await t.openProject(l),Xx("project_opened")}}}function dkr(t,n){var m;const r=lkr();if(r===null)return()=>{};jxe();const a=document.createElement("div");a.style.cssText="position:relative;width:100%;height:100%",pGn(a),t.appendChild(a);const s=ZFt(a,A.jsx(_Gn,{}),"eui-create-root"),l={api:n,unmount:()=>{s(),a.remove()}};xG=l;const f=VOt?null:((m=kk(r.host))==null?void 0:m.openProject)??null;return VOt=!0,Xx("editor_opened",{deep_link:f!==null}),f!==null&&r.web.projects.find(f).catch(()=>!1).then(_=>{var x;xG===l&&(_?(x=window.editorShell)==null||x.openProject(f):OE.notice=`“${f}” is not on this device or on your account. Here are your scenes.`)}),()=>{xG===l&&jxe()}}function fkr(){jxe();const t=qj;if(t===null)return;qj=null;const n=eO();ere==null||ere(),ere=null,t.fonts.remove(),OE.project=null,delete window.editorShell,eRt(null),GIt(null),oPt(null),t.host.setMode("off"),n.finally(()=>{var r,a;(a=(r=t.web).dispose)==null||a.call(r),qj===null&&bDt(null)})}window.__dclEditor={mountHome:dkr,unmount:fkr};
package/package.json CHANGED
@@ -1,12 +1,11 @@
1
1
  {
2
2
  "name": "@dcl-regenesislabs/web-editor",
3
- "version": "0.3.16-40613344367.commit-dac030b",
3
+ "version": "0.3.16",
4
4
  "license": "Apache-2.0",
5
5
  "description": "The Decentraland scene editor for the web explorer: editor.js plus the files it loads beside it. Served by version, not installed.",
6
6
  "repository": {
7
7
  "type": "git",
8
8
  "url": "git+https://github.com/dcl-regenesislabs/web-editor.git",
9
9
  "directory": "packages/web"
10
- },
11
- "commit": "dac030ba3b151f034e8102ae1a4e1bb33bcd0caa"
10
+ }
12
11
  }