@dcl-regenesislabs/web-editor 0.3.17-41048703832.commit-be9f2ca → 0.3.17
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.
- package/editor.js +1 -1
- package/package.json +2 -3
package/editor.js
CHANGED
|
@@ -35826,4 +35826,4 @@ ${n}
|
|
|
35826
35826
|
${r}`));return"w"+Array.from(new Uint8Array(a).slice(0,16),s=>s.toString(16).padStart(2,"0")).join("")}function kkr(t){return`${t.file===void 0?"":`${t.file}:${t.line??1}:${t.column??0}: `}${t.severity==="error"?"ERROR":"WARNING"}: ${t.message}`}function Ekr(t){return t.length<=3?t.join(", "):`${t.slice(0,3).join(", ")} and ${t.length-3} more`}function Ckr(t,n){const r=Ib(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 Akr(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??Zxr(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,L){const{builder:B,info:H}=await _();let X=!1;const K=await wkr(N,t.packages,H.snapshot,pe=>{t.onPackages(C,pe),L&&!X&&r("Downloading packages from npm…"),X=!0});K.lockFile!==void 0&&(N.set(L3,K.lockFile),await t.saveLock(C,K.lockFile));const te=K.lock===null?"":TWt(K.lock);if(te!==l)try{await B.setPackages(K.lock,t.packages),l=te}catch(pe){L&&r(`⚠ ${sPt(pe)}`),await B.setPackages(null),l=""}if(t.onPackages(C,K.status),!(!L||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,Y])=>`${fe} ${Y}`);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,L=C){const B=GWe(t.pageDir,L),H=new Set;let X=null,K=null,te=!0,pe=!1,fe=!1,Y=null;const he=xt=>(n({type:"failed",message:xt}),r(`✖ Build failed: ${xt.split(`
|
|
35827
35827
|
`)[0]}`),!1);async function Ee(xt){const lt=performance.now();n({type:"buildStarted",changed:xt}),r(xt.length===0?"Building the scene…":`Rebuilding: ${Ekr(xt)}`);try{const{builder:St,sdkVersion:gt}=await _(),Ue=xt.length===0?Ckr(N,gt):null;Ue!==null&&r(Ue);const qt=xt.length===0||xt.includes("package.json")||xt.includes(L3),{snapshot:We,result:Re}=await m(async()=>{(qt||l!==Y)&&(await x(C,N,!0),Y=l);const wt=new Map(N);return{snapshot:wt,result:await St.build(wt)}});if(fe)return!1;const $t=Re.diagnostics.filter(wt=>wt.severity==="error"||wt.file===void 0||We.has(wt.file));n({type:"diagnostics",diagnostics:$t.map(({severity:wt,message:dt,file:Nt,line:Ut,column:Wt})=>({severity:wt,message:dt,file:Nt,line:Ut,column:Wt}))});for(const wt of $t)r(kkr(wt));if(!Re.ok){const wt=Re.events.find(dt=>dt.type==="failed");return he((wt==null?void 0:wt.type)==="failed"?wt.message:"The build produced no bundle")}const vt=Ib(We.get("scene.json"));return vt===null?he("scene.json is missing or is not valid JSON"):(await cSr({realmUrl:B,projectId:L,files:We,buildOutputs:Re.outputs,sceneJson:vt,sdkVersion:gt,machineId:await t.machineId(L)}),fe?!1:(n({type:"bundleSaved"}),r(`✔ Built in ${Math.round(performance.now()-lt)} ms`),!0))}catch(St){return fe?!1:he(sPt(St))}}function Ve(){return fe?Promise.resolve(!1):(K!==null||(K=(async()=>{for(;(te||H.size>0)&&!fe;){const xt=te?[]:[...H];te=!1,H.clear(),pe=await Ee(xt)}return pe&&!fe})().finally(()=>{K=null})),K)}return{id:C,files:N,start:Ve,flush(){return X!==null&&clearTimeout(X),X=null,Ve()},async published(){const xt=await(await caches.open(Uxe)).match(HWe(B)),lt=await(xt==null?void 0:xt.json().catch(()=>{})),St=lt==null?void 0:lt.entity;return(St==null?void 0:St.id)===sZe(L,await t.machineId(L))},changed(xt){fe||(H.add(xt),X!==null&&clearTimeout(X),X=setTimeout(()=>{X=null,Ve()},Skr))},stop(){fe=!0,X!==null&&clearTimeout(X)}}}return{realmUrl:C=>GWe(t.pageDir,C),open:T,async build(C,N,L){const{builder:B,sdkVersion:H}=await _();return m(async()=>(await x(C,N,!1),{...await B.build(N,L),sdkVersion:H}))},install:(C,N)=>m(()=>x(C,N,!1)),dispose(){s=!0,a==null||a.dispose(),a=null}}}const cPt=64*1024*1024,Okr=4*1024*1024;function Pkr(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 Ikr(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 X=_,K=l,te=new AbortController,pe=setTimeout(()=>te.abort(new Error("Preview resource timed out")),3e4);let fe=0,Y;x++;try{const Ee=new URL(f+B.path);if(!Ee.href.startsWith(f+"/")||!Pkr(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 Ve=await fetch(Ee,{method:String(B.method),credentials:"omit",redirect:"error",signal:AbortSignal.any([X.signal,te.signal]),headers:{"Content-Type":"application/json"},body:B.method==="POST"?B.body:void 0}),xt=Ve.headers.get("Content-Type")??"application/octet-stream",lt=xt.includes("application/json")?Okr:cPt;if(Y=(he=Ve.body)==null?void 0:he.getReader(),Number(Ve.headers.get("Content-Length"))>lt)throw new Error("Preview resource exceeds the memory limit");const St=[];if(Y!==void 0)for(;;){const{done:We,value:Re}=await Y.read();if(We)break;if(fe+=Re.byteLength,T+=Re.byteLength,fe>lt||T>cPt)throw new Error("Preview resource exceeds the memory limit");St.push(Re)}const gt=new Uint8Array(fe);let Ue=0;for(const We of St)gt.set(We,Ue),Ue+=We.byteLength;St.length=0;let qt=gt.buffer;if(B.method!=="HEAD"&&qt.byteLength>0&&xt.includes("application/json")){const We=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):Zc($t)?Object.fromEntries(Object.entries($t).map(([vt,wt])=>[vt,Re(wt)])):$t;qt=new TextEncoder().encode(JSON.stringify(Re(We))).buffer}!X.signal.aborted&&K===l&&C({type:"realm-response",requestId:H,status:Ve.status,headers:{"Content-Type":xt},body:qt},[qt])}catch(Ee){!X.signal.aborted&&K===l&&C({type:"realm-response",requestId:H,error:Ee instanceof Error?Ee.message:String(Ee)})}finally{clearTimeout(pe),te.abort(),Y!==void 0&&Y.cancel().catch(Ee=>{Ee instanceof Error&&Ee.name==="AbortError"||console.warn("Preview stream cleanup:",Ee)}),T-=fe,x--}},L=B=>{const H=B.data;B.origin!==a||!Zc(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",L),{send:C,reset:(B="",H="",X="")=>{_.abort(),_=new AbortController,l=null,s=B,f=H,m=X},dispose:()=>{_.abort(),window.removeEventListener("message",L)}}}const lPt=["localhost","127.0.0.1","[::1]"];function Nkr(t,n,r=""){if(lPt.includes(new URL(t).hostname)){const a=new URLSearchParams(r).get("editor-mobile");return`${a!==null&&URL.canParse(a)&&lPt.includes(new URL(a).hostname)?new URL(a).origin:"http://127.0.0.1:8788"}/mobile-preview/index.html`}return n===null?null:new URL("mobile-preview/index.html",n.replace(/\/$/,"")+"/").href}function Dkr(t){if(t===null)return null;const n=new URL(t).hostname;return n==="decentraland.zone"||n.endsWith(".decentraland.zone")?"zone":null}function Rkr(t,n,r,a=null){const s=crypto.randomUUID(),l=Ikr(t,s,fe=>pe(fe)),f=new Set,m=new Map;let _={mode:"closed",url:null,ready:!1},x=null,T="",C="",N=0,L=null,B=!1,H=null;const X=fe=>{_=fe;for(const Y of f)Y()},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(),X({mode:"closed",url:null,ready:!1})},te=()=>{N++,x=null,K()};window.addEventListener("pagehide",te);const pe=fe=>{if(!Zc(fe)||fe.session!==s||fe.instance!==C||(fe.type==="ready"&&(X({..._,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 Y=m.get(fe.requestId);Y!==void 0&&(typeof fe.error=="string"?Y.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?Y.resolve({mimeType:"image/jpeg",image:fe.image,width:fe.width,height:fe.height}):Y.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,Y,he="embedded")=>{if(B||t===null)return{ok:!1,reason:"unavailable"};const Ee=fe.replace(/\/$/,"");if(_.mode===he&&x===Ee)return N++,{ok:!0};if((he==="embedded"||he==="minimized")&&(_.mode==="embedded"||_.mode==="minimized")&&x===Ee){if(N++,X({..._,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 Ve=he==="tab"?window.open("about:blank",`dcl-phone-preview-${crypto.randomUUID()}`):null;if(he==="tab"&&Ve===null)return{ok:!1,reason:"unavailable"};const xt=++N;if(!await fetch(t,{method:"HEAD",signal:AbortSignal.timeout(5e3)}).then(qt=>qt.ok,()=>!1)||xt!==N||B||Ve!=null&&Ve.closed)return Ve==null||Ve.close(),{ok:!1,reason:"unavailable"};if(K(),await new Promise(qt=>setTimeout(qt,100)),xt!==N||B||Ve!=null&&Ve.closed)return Ve==null||Ve.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,Ee,T);const gt=new URL("decentraland://open");gt.searchParams.set("preview",T),gt.searchParams.set("position",Y);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=Ee,X({mode:he,url:St.href,ready:!1}),H=Ve,Ve!==null&&Mkr(Ve,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"&&(L=N,X({..._,mode:"embedded"}),l.send({type:"visibility",session:s,instance:C,visible:!0}));const Y=crypto.randomUUID();try{return await new Promise((he,Ee)=>{const Ve=()=>{clearTimeout(lt),fe.removeEventListener("abort",xt),m.delete(Y)},xt=()=>{Ve(),Ee(fe.reason)},lt=setTimeout(()=>{Ve(),Ee(new Error("The mobile preview did not answer. Bring its tab to the foreground and retry."))},1e4);m.set(Y,{resolve:St=>{Ve(),he(St)},reject:St=>{Ve(),Ee(St)}}),fe.addEventListener("abort",xt,{once:!0}),l.send({type:"capture",session:s,instance:C,requestId:Y})})}finally{m.size===0&&(L===N&&_.mode==="embedded"&&(X({..._,mode:"minimized"}),l.send({type:"visibility",session:s,instance:C,visible:!1})),L=null)}},built:async fe=>{if(x===null)return;const Y=x,he=await n(fe),Ee=sZe(he,await r(he));!B&&Y===x&&l.send({type:"scene-updated",session:s,instance:C,realm:T,entityId:Ee})},dispose:()=>{te(),B=!0,window.removeEventListener("pagehide",te),l.dispose(),f.clear()}}}function Mkr(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 Lkr=200,Fkr=2e3,jkr=/^\((?:no logs|\+\d+ older entries not retained)\)$/;function Bkr(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 Ukr(t,n){let r=[],a=!1,s;const l=async()=>{try{const f=await t(`scene_logs ${Lkr} --server`);if(a)return;const m=f.split(`
|
|
35828
35828
|
`).filter(_=>_.trim()!==""&&!jkr.test(_.trim()));for(const _ of Bkr(r,m))n(_);r=m}catch{}a||(s=setTimeout(()=>void l(),Fkr))};return l(),()=>{a=!0,clearTimeout(s)}}function $kr(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)},_=L=>{m(),f(L)},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=lqe(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(L){_(L)}})}const zkr=new Set(["node_modules",".git","bin","dist"]),Vkr=300*1024,Wkr=56,qkr=5;function Gkr(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 Hkr(t,n){const r=new Map;let a=new Map;function s(m,_){if(_.size>Vkr)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(L=>new TextDecoder().decode(L),()=>null);if(C===null)return null;const N=Object.fromEntries(Object.entries(x.files).map(([L,B])=>[L,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,L]of _){const B=await n(L);x[N]={hash:B,size:L.length},T.set(B,L)}const C=[...T].map(([N,L])=>({hash:N,size:L.length}));for(const N of await t.uploads(m,C)){const L=T.get(N.hash);L!==void 0&&await t.putBlob(N,L)}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=`${_}/`,L=new Map;for(const[Y,he]of m.files()){const Ee=Y.slice(N.length);Y.startsWith(N)&&!Ee.split("/").some(Ve=>zkr.has(Ve))&&L.set(Ee,he)}const B=L.get("data.json"),H=B===void 0?null:Uq(new TextDecoder().decode(B));if(H===null)throw new Error(`${_} has no readable data.json`);const X={...H,id:typeof H.id=="string"?H.id:crypto.randomUUID(),origin:Gkr(H)},K=`${JSON.stringify(X,null,2)}
|
|
35829
|
-
`;L.set("data.json",new TextEncoder().encode(K));const te=iqe(KWt(H,T)).slice(0,Wkr).replace(/_+$/,"")||"prefab",pe=new Set((await t.list()).map(Y=>Y.name));let fe=1;for(let Y=0;Y<qkr;Y++){let he=te;for(;pe.has(he);)he=`${te}_${++fe}`;try{return await f(he,L),{ref:`user:${he}`,scope:"user",data:K}}catch(Ee){if(!(Ee instanceof $Wt))throw Ee;pe.add(he)}}throw new Error("could not find a free name in your library — try again")},remove:m=>t.remove(m)}}const uPt=new WeakMap;function Jkr(t){let n=uPt.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("")),uPt.set(t,n)),n}async function Qkr(t){const n=t.get(".dclignore"),r=cZe(t.keys(),n===void 0?void 0:new TextDecoder().decode(n)).filter(l=>l!==L3),a=new Map;let s=0;for(const l of r){const f=t.get(l);f!==void 0&&(a.set(await Jkr(f),f.byteLength),s++)}return{bytes:[...a.values()].reduce((l,f)=>l+f,0),files:s}}const dPt=4e3,Ykr=4e6,Xkr=CPt*24*60*60*1e3,Zkr="assets/images",Kkr=3e3,e2r=100,t2r="Sign in to keep prefabs in your own library. The built-in prefabs work without it.",n2r=t=>t instanceof Error?t.message:String(t);function b9e(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:SSr(t),spawnPoints:JSON.stringify(Array.isArray(t.spawnPoints)?t.spawnPoints:[])}}const r2r=({host:t,sceneCompiler:n})=>{const r=new cTr(nTr()),a=Ck(t),s=a===null||a.services.projects===null?null:UWt(a.services.projects,(Xn,Lr)=>a.signedFetch(Xn,Lr)),l=()=>{const{address:Xn,isGuest:Lr}=t.identity();return Lr||Xn===null?null:Xn.toLowerCase()},f=[],m=[],_=[],x=[],T=[],C=Xn=>{f.push(Xn),f.length>dPt&&f.splice(0,f.length-dPt);for(const Lr of m)Lr(Xn)},N=Rkr(Nkr(t.pageDir,(a==null?void 0:a.services.projects)??null,location.search),he,async Xn=>oPt(await X,l()??"guest",Xn),Dkr((a==null?void 0:a.services.worldsContent)??null)),L=Xn=>{for(const Lr of _)Lr(Xn);Xn.type==="bundleSaved"&&pe!==null&&N.built(pe.id).catch(Lr=>console.error("[editor] mobile preview reload failed",Lr))},B=new Map,H=new Set,X=_Rt.then(Tkr),K=Akr({pageDir:t.pageDir,urls:n,machineId:async Xn=>oPt(await X,l()??"guest",Xn),emit:L,log:C,packages:r.packages,saveLock:async(Xn,Lr)=>{await r.write(Xn,L3,Lr),wt.touched(Xn,L3),(pe==null?void 0:pe.id)===Xn&&pe.files.set(L3,Lr)},onPackages:(Xn,Lr)=>{if(Lr===null){B.delete(Xn);return}B.set(Xn,Lr);for(const ti of H)ti(Xn,Lr)}});let te=null,pe=null,fe=null,Y=null;async function he(Xn){var Ga;const Lr=(Ga=(await r.list()).find(Za=>Za.id===Xn))==null?void 0:Ga.previewId;if(Lr!==void 0)return Lr;const ti="p"+Array.from(crypto.getRandomValues(new Uint8Array(16)),Za=>Za.toString(16).padStart(2,"0")).join("");return await r.patch(Xn,{previewId:ti}),ti}async function Ee(Xn){const Lr=new URL("preview/",t.pageDir).href,ti=await caches.open(Uxe);for(const Ga of await ti.keys())Ga.url.startsWith(Lr)&&(Xn===null||!Ga.url.startsWith(Xn))&&await ti.delete(Ga)}let Ve=0,xt=Promise.resolve(),lt=Promise.resolve();const St=fSr({service:(a==null?void 0:a.services.projects)??null,fetch:(Xn,Lr)=>a===null?Promise.reject(new Error("The assistant service is not configured.")):a.signedFetch(Xn,Lr),wallet:l,mobilePreview:N.status,memory:{read:async(Xn,Lr)=>{const ti=await r.assistantMemory(Xn,Lr);return Zc(ti)&&typeof ti.id=="string"&&typeof ti.key=="string"?{id:ti.id,key:ti.key}:null},write:(Xn,Lr,ti)=>r.setAssistantMemory(Xn,Lr,ti)},project:()=>{const Xn=Tt();return{id:Xn.id,tools:{files:()=>Xn.files,write:(Lr,ti,Ga,Za)=>qt(Xn.id,Lr,ti,{expected:Ga,signal:Za}),assets:F$t({files:()=>Xn.files}),scene:(Lr,ti)=>yTe(Lr,ti,async Ga=>{var ii,yl,ja;const Za=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 VE();const el=Za(Ib(await Ue(Xn.id,"scene.json")));await tn(Xn.id,ss=>CSr(ss,Ga));const uu=Ib(await Ue(Xn.id,"scene.json")),lr=Za(uu)!==el,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 Xn.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(Xn.id);te=b9e(uu??{},K.realmUrl(ss)),await $kr(Pl,()=>{for(const Ts of x)Ts(te)},ti)}else if(te!==null){const ss=b9e(uu??{},te.realm);(ss.spawn!==te.spawn||ss.spawnPoints!==te.spawnPoints)&&(te={...te,spawn:ss.spawn,spawnPoints:ss.spawnPoints},Jur(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:U$t,view:(Lr,ti)=>vTe(Lr,ti),playtest:UXe,uiLayout:xWe,turnEnded:Mzt,build:async Lr=>{Lr.throwIfAborted(),await lt;const ti=await K.build(Xn.id,new Map(Xn.files));if(Lr.throwIfAborted(),!ti.ok)return{ok:!1,diagnostics:ti.diagnostics,mobilePreview:N.status()};const Ga=await L$t();return Lr.throwIfAborted(),{ok:!0,diagnostics:ti.diagnostics,run:Ga,mobilePreview:N.status()}}}}}});function gt(){St.reset(),Y==null||Y(),Y=null,pe!==null&&(pe.stop(),r.close(pe.id),wt.flush(pe.id),pe=null,fe=null)}async function Ue(Xn,Lr){return(pe==null?void 0:pe.id)===Xn?pe.files.get(Lr):r.read(Xn,Lr).catch(ti=>{if(!gI(ti))throw ti})}function qt(Xn,Lr,ti,Ga){const Za=lt.then(async()=>{if(Ga==null||Ga.signal.throwIfAborted(),Ga!==void 0&&((pe==null?void 0:pe.id)!==Xn||!z$t(pe.files.get(Lr),Ga.expected)))throw new Error("This file changed. Read it again before writing.");await r.write(Xn,Lr,ti),wt.touched(Xn,Lr),(pe==null?void 0:pe.id)===Xn&&(pe.files.set(Lr,ti),pe.changed(Lr))});return lt=Za.catch(el=>console.error("[editor] file write failed",el)),Za}function We(Xn,Lr){const ti=lt.then(async()=>{const Ga=await r.remove(Xn,Lr);return Ga&&wt.touched(Xn,Lr),Ga&&(pe==null?void 0:pe.id)===Xn&&pe.files.delete(Lr)&&pe.changed(Lr),Ga});return lt=ti.catch(Ga=>console.error("[editor] file removal failed",Ga)),ti}function Re(Xn){const Lr=Tt();if(Lr.id!==Xn)throw new Error("that scene is not the one open");return{files:()=>Lr.files,write:(ti,Ga)=>qt(Xn,ti,Ga),remove:async ti=>{await We(Xn,ti)}}}async function $t(Xn){var Ga;const Lr=Ib(await Ue(Xn,"scene.json").catch(()=>{})),ti=(((Ga=Lr==null?void 0:Lr.display)==null?void 0:Ga.title)??"").replace(/[\x00-\x1f\x7f]/g,"").replace(new RegExp(BWt.source,"g"),"").trim().slice(0,e2r);return ti===""?Xn:ti}async function vt(Xn,Lr){const ti=(await r.list()).find(Za=>Za.id===Xn);if(ti===void 0)return null;const Ga=await r.duplicate(Xn,`${ti.name} ${Lr}`,wt.remoteIds());return await tn(Ga.id,Za=>{var el;return{...Za,display:{...Za.display??{},title:`${((el=Za.display)==null?void 0:el.title)||ti.name} ${Lr}`}}}),Ga.id}const wt=hTr({store:r,session:()=>{const Xn=l();return s===null||Xn===null?null:{api:s,wallet:Xn}},account:()=>s===null?"unavailable":l()===null?"guest":"on",hash:Fxe,title:$t,duplicate:async Xn=>{const Lr=await vt(Xn,EPt(new Date));if(Lr===null)throw new Error("The scene is no longer on this device");return Lr}});let dt=!1,Nt=0;async function Ut(){const Xn=++Nt,Lr=l()!==null&&(await St.shell.aiProviders()).some(ti=>ti.available);Xn!==Nt||Lr===dt||(dt=Lr,J0())}Ut();let Wt=l();const Me=setInterval(()=>{const Xn=l();Xn!==Wt&&(Wt=Xn,St.reset(),J0(),Ut(),wt.refresh(!0),Ee(fe).catch(Lr=>console.warn("[editor] could not clear the previews",Lr)))},Kkr),Ke=()=>{document.visibilityState==="hidden"&&wt.flush()};document.addEventListener("visibilitychange",Ke);const st=new Set;async function tn(Xn,Lr){const ti=Ib(await Ue(Xn,"scene.json"));if(ti===null)throw new Error("scene.json is missing or is not valid JSON");await qt(Xn,"scene.json",POt(Lr(ti)))}async function An(Xn,Lr){if(Lr==null||Lr==="")return null;const ti=await Ue(Xn,Lr).catch(()=>{});return ti===void 0||ti.length>Ykr?null:IOt(Lr,ti)}async function un(Xn,Lr=wt.status().projects){var Ga,Za,el,uu;const ti=Ib(await Ue(Xn.id,"scene.json").catch(()=>{}));return{sync:Lr[Xn.id],path:Xn.id,name:Xn.name,title:((Ga=ti==null?void 0:ti.display)==null?void 0:Ga.title)||Xn.name,world:((Za=ti==null?void 0:ti.worldConfiguration)==null?void 0:Za.name)||null,parcels:Array.isArray((el=ti==null?void 0:ti.scene)==null?void 0:el.parcels)?ti.scene.parcels.length:0,thumbnail:await An(Xn.id,(uu=ti==null?void 0:ti.display)==null?void 0:uu.navmapThumbnail),favourite:Xn.favourite,lastOpened:Xn.lastOpened,published:Xn.published,deletedAt:Xn.deletedAt??void 0}}async function Tn(Xn,Lr){var Ga,Za;gt(),f.length=0,L({type:"sessionStarted"});const ti=el=>{if(gt(),Lr===Ve){C(`✖ ${el}`);for(const uu of T)uu(el)}};try{if(await wt.prepareOpen(Xn,(ii,yl)=>C(`Downloading from your account… ${ii}/${yl}`)),Lr!==Ve)return;if(!await r.open(Xn)){ti("This scene is open in another tab. Close it there to edit it here.");return}const el=await r.readAll(Xn).then(async ii=>{for(const[yl,ja]of rwr(ii))await qt(Xn,yl,ja),ii.set(yl,ja);return ii}).catch(ii=>{throw r.close(Xn),ii});if(Lr!==Ve){r.close(Xn);return}const uu=await he(Xn);if(Lr!==Ve){r.close(Xn);return}const lr=K.open(Xn,el,uu);pe=lr;const Pl=K.realmUrl(uu);if(fe=Pl,C(`▶ Opening ${((Za=(Ga=Ib(lr.files.get("scene.json")))==null?void 0:Ga.display)==null?void 0:Za.title)||Xn}`),!await lr.start()&&!await lr.published()){if(Lr!==Ve)return;C("✖ The scene did not build.");for(const ii of T)ii("The scene did not build.");return}if(await r.patch(Xn,{lastOpened:Date.now()}),Lr!==Ve){gt();return}const fm=Ib(lr.files.get("scene.json"))??{};te=b9e(fm,Pl),Y=Ukr(ii=>t.engineConsole(ii),C);for(const ii of x)ii(te)}catch(el){ti(n2r(el))}}function fi(Xn){N.close(),te=null;const Lr=++Ve,ti=St.reset(),Ga=xt.then(async()=>{await ti,await lt,Lr===Ve&&await Xn(Lr)});return xt=Ga.catch(Za=>console.error("[editor] project transition failed",Za)),Ga}function Tt(){if(pe===null)throw new Error("no project is open");return pe}const Wi={saveFile:async({path:Xn,content:Lr})=>qt(Tt().id,Xn,Lr),getFile:async({path:Xn})=>{const Lr=Tt().files.get(Xn)??ukr(Xn);if(Lr===void 0)throw new Error(`no such file: ${Xn}`);return{content:Lr}},removeFiles:async({filePaths:Xn})=>{const Lr=Tt(),ti=[],Ga=[];for(const Za of Xn)(await We(Lr.id,Za).catch(()=>!1)?ti:Ga).push(Za);return{success:ti,failed:Ga}},getFilesSizes:async({path:Xn,ignore:Lr})=>{const ti=Xn===""?"":`${Xn.replace(/\/+$/,"")}/`;return{files:[...Tt().files.keys()].filter(Za=>Za.startsWith(ti)&&!Za.split("/").some(el=>Lr.includes(el))).sort().map(Za=>({path:Za}))}}},Er={async find(Xn){return(await r.list()).some(Lr=>Lr.id===Xn)?!0:(await wt.refresh(!0),wt.remoteOnly().some(Lr=>Lr.id===Xn))},files:async Xn=>(pe==null?void 0:pe.id)===Xn?new Map(pe.files):r.readAll(Xn),manifest:Xn=>wt.manifest(Xn),build:async(Xn,Lr)=>K.build(Xn,await Er.files(Xn),Lr),dependencies:async Xn=>MWt(await Ue(Xn,"package.json")),onImported:Xn=>(st.add(Xn),()=>st.delete(Xn))},to=a===null?null:tTr({host:a,setWorld:async(Xn,Lr)=>{var Ga,Za;((Za=(Ga=Ib(await Ue(Xn,"scene.json")))==null?void 0:Ga.worldConfiguration)==null?void 0:Za.name)!==Lr&&await tn(Xn,el=>({...el,worldConfiguration:{...el.worldConfiguration??{},name:Lr}}))},files:Xn=>Er.files(Xn),build:(Xn,Lr)=>K.build(Xn,Lr,{production:!0}),published:(Xn,Lr)=>r.patch(Xn,{published:Lr})}),Ba=(a==null?void 0:a.services.projects)==null?null:Hkr(dTr(a.services.projects,(Xn,Lr)=>a.signedFetch(Xn,Lr)),Fxe);Nfr(_Sr(t.editorBase)),gSr(t.editorBase),V$t({material:ySr,sound:vSr}),lpr(async()=>Qkr(await Er.files(Tt().id)));const Vo=vkr({builtin:PTr(t.editorBase,xB("prefabs/catalog.json"),CTe),user:()=>Ba!==null&&l()!==null?Ba.tree:null}),Kc={...(a==null?void 0:a.services.projects)==null?{}:{...St.shell,aiOffered:()=>dt,aiTranscript:()=>{const Xn=Wt;if(Xn===null||pe===null)return null;const Lr=pe.id;return{owner:`${Lr}@${Xn.toLowerCase()}`,load:()=>r.transcript(Lr,Xn),save:ti=>r.setTranscript(Lr,Xn,ti)}}},pickProject:async()=>{},openProject:Xn=>fi(Lr=>Tn(Xn,Lr)),relaunchProject:Xn=>fi(Lr=>Tn(Xn,Lr)),closeProject:()=>fi(async()=>{gt(),L({type:"sessionStarted"}),C("■ Scene closed"),await Ee(null).catch(Xn=>console.warn("[editor] could not clear the previews",Xn))}),getState:async()=>{const Xn=await r.list(),Lr=wt.status().projects,ti=wt.remoteOnly().map(Ga=>({path:Ga.id,name:Ga.name,title:Ga.name,world:null,parcels:0,thumbnail:null,remoteOnly:!0}));return{recentProjects:[...Xn].sort((Ga,Za)=>Za.lastOpened-Ga.lastOpened).map(Ga=>Ga.id),projects:[...await Promise.all(Xn.map(Ga=>un(Ga,Lr))),...ti],logs:[...f],bevyWebDir:"",editorSceneDir:"",webPort:0,scenePort:0,editorScenePort:0,favourites:Xn.filter(Ga=>Ga.favourite).map(Ga=>Ga.id)}},onStackLog:Xn=>{m.push(Xn)},onBuildEvent:Xn=>{_.push(Xn)},onServersReady:Xn=>{x.push(Xn)},requestReady:async()=>te,phonePreview:async Xn=>te===null?{ok:!1,reason:"no-scene"}:N.open(te.realm,te.position,Xn),phonePreviewState:N.state,onPhonePreviewState:N.subscribe,closePhonePreview:N.close,capturePhonePreview:N.capture,onServersError:Xn=>{T.push(Xn)},toggleFavourite:async Xn=>{const Lr=(await r.list()).find(ti=>ti.id===Xn);Lr!==void 0&&await r.patch(Xn,{favourite:!Lr.favourite})},deleteProject:async Xn=>{const Lr=await r.trash(Xn);return Lr&&wt.trashed(Xn),Lr},trashedProjects:async()=>Promise.all((await r.trashed()).map(Xn=>un(Xn))),restoreProject:async Xn=>{const Lr=await r.restore(Xn);return Lr&&wt.restored(Xn),Lr},syncStatus:async()=>(wt.refresh(),wt.status()),onSyncStatus:Xn=>wt.subscribe(Xn),resolveSyncConflict:(Xn,Lr)=>wt.resolve(Xn,Lr),exportProject:async Xn=>CTr(await $t(Xn),await Er.files(Xn)),importProject:async Xn=>{const Lr=await OTr(Xn,async(ti,Ga)=>{const Za=await r.create(ti,Ga,{taken:wt.remoteIds()});return wt.touched(Za.id,"scene.json"),Za.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(Za=>K.install(ti,Za)).catch(Za=>console.warn("[editor] could not install the packages of",ti,Za));for(const Za of st)Za(Lr.report)}return Lr},projectPackages:async Xn=>B.get(Xn)??null,onProjectPackages:Xn=>(H.add(Xn),()=>H.delete(Xn)),...to===null||a===null?{}:{publishScene:(Xn,Lr,ti)=>to.publish(Xn,Lr,ti),...to.publishShared===void 0?{}:{publishShared:to.publishShared},publishStop:async()=>to.stop(),publishWorlds:async()=>KSr(l(),a.services.worldsContent)},canImportFolder:ETr(),renameProject:(Xn,Lr)=>tn(Xn,ti=>({...ti,display:{...ti.display??{},title:Lr.trim()}})),duplicateProject:Xn=>vt(Xn,"copy"),sceneTemplates:async()=>okr(),createScene:async(Xn,Lr,ti)=>{const Ga=XWt(ti),Za=Ib(Ga.get("scene.json"));if(Za===null)throw new Error(`template not found: ${ti}`);Ga.set("scene.json",POt({...Za,display:{...Za.display??{},title:Lr.trim()}}));const el=await r.create(Lr,Ga,{taken:wt.remoteIds()});return wt.touched(el.id,"scene.json"),el.id},openExternal:async Xn=>{/^https?:$/.test(new URL(Xn).protocol)&&window.open(Xn,"_blank","noopener,noreferrer")},compositeEntityIds:async Xn=>{for(const Lr of TSr){const ti=await Ue(Xn,Lr);if(ti!==void 0)return kSr(new TextDecoder().decode(ti))}return[]},sceneSettings:async Xn=>{const Lr=Ib(await Ue(Xn,"scene.json"));if(Lr===null)throw new Error("scene.json is missing or is not valid JSON");const ti=bSr(Lr);return{...ti,thumbnail:await An(Xn,ti.thumbnailPath)}},saveSceneSettings:async(Xn,Lr)=>{const ti=xSr(Lr);return ti!==null?ti:(await tn(Xn,Ga=>wSr(Ga,Lr)),null)},pickSceneThumbnail:async Xn=>{const Lr=await YWt(Object.values(QWe).join(","));if(Lr===null)return null;const ti=DWt(Lr.name);if(QWe[ti]===void 0)throw new Error("not a supported image (png, jpg, gif, webp)");const Ga=`${Zkr}/scene-thumbnail${ti}`,Za=new Uint8Array(await Lr.arrayBuffer());return await qt(Xn,Ga,Za),{path:Ga,dataUrl:IOt(Ga,Za)}},appVersion:async()=>lSr,prefabLibraryList:()=>Vo.list(),prefabLibraryCopyIn:async(Xn,Lr)=>Vo.copyIn(Xn,Re(Lr)),prefabLibraryUpdateCopy:async(Xn,Lr)=>Vo.updateCopy(Xn,Re(Lr)),prefabUserLibrary:()=>Ba===null?"unavailable":l()===null?"guest":"on",...Ba===null?{}:{prefabLibraryCopyOut:async(Xn,Lr)=>{if(l()===null)throw new Error(t2r);return Ba.copyOut(Re(Xn),Lr)},prefabLibraryDelete:async Xn=>{const Lr=ZWt(Xn);return(Lr==null?void 0:Lr.scope)==="user"&&l()!==null?Ba.remove(Lr.name):!1}}};async function Hl(){const Xn=new Set;for(const Lr of[...await r.list(),...await r.trashed()]){const ti=SWt(await Ue(Lr.id,L3).catch(()=>{}));for(const Ga of Object.keys((ti==null?void 0:ti.packages)??{}))Xn.add(Ga);for(const[Ga,Za]of Object.entries((ti==null?void 0:ti.dependencies)??{}))Xn.add(Qj(Ga,Za))}for(const Lr of await r.packages.keys())Xn.has(Lr)||await r.packages.remove(Lr)}return r.purge(Date.now()-Xkr).then(async Xn=>{const Lr=await caches.open(Uxe),ti=Xn.map(({id:Za,previewId:el})=>K.realmUrl(el??Za));for(const Za of await Lr.keys())ti.some(el=>Za.url.startsWith(el))&&await Lr.delete(Za);const Ga=await caches.open(oSr);for(const Za of ti)await Ga.delete(`${Za}__storage`);Xn.length>0&&await Hl()}).catch(Xn=>console.warn("[editor] could not empty the trash",Xn)),{shell:Kc,projects:Er,dataLayer:Wi,dispose:()=>{N.dispose(),St.dispose(),Ve++,gt(),K.dispose(),clearInterval(Me),document.removeEventListener("visibilitychange",Ke),wt.flush().finally(()=>wt.dispose())}}};let Yj=null,SG=null,rre=null,fPt=!1;function i2r(){if(Yj!==null)return Yj;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-30T11:32:27.081Z"),PPt(t),hNt(a=>t.engineConsole(a)),TRt(()=>t.identity()),cHn.needed=!1;const n=r2r({host:t,sceneCompiler:hSr(t.editorBase)});window.editorShell=a2r(n.shell,t),WDt(n.dataLayer??null),nHe();const r=document.createElement("link");return r.rel="stylesheet",r.href=new URL("editor.css",t.editorBase).href,r.integrity=xB("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),IE.project=null,IE.notice=null,Yj={host:t,web:n,fonts:r},Yj}function Wxe(){const t=SG;SG=null,t==null||t.unmount()}function a2r(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&&Kx("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&&Kx("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&&Kx("project_created",{project_id:f,source:"duplicate",from_project_id:l}),f}},openProject:async l=>{const f=SG;Wxe(),f==null||f.api.close(),rre??(rre=wjt(n.container,A.jsx(Uxr,{}))),n.setMode("edit"),IE.project=l,IE.opens++,await t.openProject(l),Kx("project_opened")}}}function s2r(t,n){var m;const r=i2r();if(r===null)return()=>{};Wxe();const a=document.createElement("div");a.style.cssText="position:relative;width:100%;height:100%",zGn(a),t.appendChild(a);const s=wjt(a,A.jsx(qGn,{}),"eui-create-root"),l={api:n,unmount:()=>{s(),a.remove()}};SG=l;const f=fPt?null:((m=Ck(r.host))==null?void 0:m.openProject)??null;return fPt=!0,Kx("editor_opened",{deep_link:f!==null}),f!==null&&r.web.projects.find(f).catch(()=>!1).then(_=>{var x;SG===l&&(_?(x=window.editorShell)==null||x.openProject(f):IE.notice=`“${f}” is not on this device or on your account. Here are your scenes.`)}),()=>{SG===l&&Wxe()}}function o2r(){Wxe();const t=Yj;if(t===null)return;Yj=null;const n=VE();rre==null||rre(),rre=null,t.fonts.remove(),IE.project=null,delete window.editorShell,TRt(null),hNt(null),PPt(null),t.host.setMode("off"),n.finally(()=>{var r,a;(a=(r=t.web).dispose)==null||a.call(r),Yj===null&&WDt(null)})}window.__dclEditor={mountHome:s2r,unmount:o2r};
|
|
35829
|
+
`;L.set("data.json",new TextEncoder().encode(K));const te=iqe(KWt(H,T)).slice(0,Wkr).replace(/_+$/,"")||"prefab",pe=new Set((await t.list()).map(Y=>Y.name));let fe=1;for(let Y=0;Y<qkr;Y++){let he=te;for(;pe.has(he);)he=`${te}_${++fe}`;try{return await f(he,L),{ref:`user:${he}`,scope:"user",data:K}}catch(Ee){if(!(Ee instanceof $Wt))throw Ee;pe.add(he)}}throw new Error("could not find a free name in your library — try again")},remove:m=>t.remove(m)}}const uPt=new WeakMap;function Jkr(t){let n=uPt.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("")),uPt.set(t,n)),n}async function Qkr(t){const n=t.get(".dclignore"),r=cZe(t.keys(),n===void 0?void 0:new TextDecoder().decode(n)).filter(l=>l!==L3),a=new Map;let s=0;for(const l of r){const f=t.get(l);f!==void 0&&(a.set(await Jkr(f),f.byteLength),s++)}return{bytes:[...a.values()].reduce((l,f)=>l+f,0),files:s}}const dPt=4e3,Ykr=4e6,Xkr=CPt*24*60*60*1e3,Zkr="assets/images",Kkr=3e3,e2r=100,t2r="Sign in to keep prefabs in your own library. The built-in prefabs work without it.",n2r=t=>t instanceof Error?t.message:String(t);function b9e(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:SSr(t),spawnPoints:JSON.stringify(Array.isArray(t.spawnPoints)?t.spawnPoints:[])}}const r2r=({host:t,sceneCompiler:n})=>{const r=new cTr(nTr()),a=Ck(t),s=a===null||a.services.projects===null?null:UWt(a.services.projects,(Xn,Lr)=>a.signedFetch(Xn,Lr)),l=()=>{const{address:Xn,isGuest:Lr}=t.identity();return Lr||Xn===null?null:Xn.toLowerCase()},f=[],m=[],_=[],x=[],T=[],C=Xn=>{f.push(Xn),f.length>dPt&&f.splice(0,f.length-dPt);for(const Lr of m)Lr(Xn)},N=Rkr(Nkr(t.pageDir,(a==null?void 0:a.services.projects)??null,location.search),he,async Xn=>oPt(await X,l()??"guest",Xn),Dkr((a==null?void 0:a.services.worldsContent)??null)),L=Xn=>{for(const Lr of _)Lr(Xn);Xn.type==="bundleSaved"&&pe!==null&&N.built(pe.id).catch(Lr=>console.error("[editor] mobile preview reload failed",Lr))},B=new Map,H=new Set,X=_Rt.then(Tkr),K=Akr({pageDir:t.pageDir,urls:n,machineId:async Xn=>oPt(await X,l()??"guest",Xn),emit:L,log:C,packages:r.packages,saveLock:async(Xn,Lr)=>{await r.write(Xn,L3,Lr),wt.touched(Xn,L3),(pe==null?void 0:pe.id)===Xn&&pe.files.set(L3,Lr)},onPackages:(Xn,Lr)=>{if(Lr===null){B.delete(Xn);return}B.set(Xn,Lr);for(const ti of H)ti(Xn,Lr)}});let te=null,pe=null,fe=null,Y=null;async function he(Xn){var Ga;const Lr=(Ga=(await r.list()).find(Za=>Za.id===Xn))==null?void 0:Ga.previewId;if(Lr!==void 0)return Lr;const ti="p"+Array.from(crypto.getRandomValues(new Uint8Array(16)),Za=>Za.toString(16).padStart(2,"0")).join("");return await r.patch(Xn,{previewId:ti}),ti}async function Ee(Xn){const Lr=new URL("preview/",t.pageDir).href,ti=await caches.open(Uxe);for(const Ga of await ti.keys())Ga.url.startsWith(Lr)&&(Xn===null||!Ga.url.startsWith(Xn))&&await ti.delete(Ga)}let Ve=0,xt=Promise.resolve(),lt=Promise.resolve();const St=fSr({service:(a==null?void 0:a.services.projects)??null,fetch:(Xn,Lr)=>a===null?Promise.reject(new Error("The assistant service is not configured.")):a.signedFetch(Xn,Lr),wallet:l,mobilePreview:N.status,memory:{read:async(Xn,Lr)=>{const ti=await r.assistantMemory(Xn,Lr);return Zc(ti)&&typeof ti.id=="string"&&typeof ti.key=="string"?{id:ti.id,key:ti.key}:null},write:(Xn,Lr,ti)=>r.setAssistantMemory(Xn,Lr,ti)},project:()=>{const Xn=Tt();return{id:Xn.id,tools:{files:()=>Xn.files,write:(Lr,ti,Ga,Za)=>qt(Xn.id,Lr,ti,{expected:Ga,signal:Za}),assets:F$t({files:()=>Xn.files}),scene:(Lr,ti)=>yTe(Lr,ti,async Ga=>{var ii,yl,ja;const Za=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 VE();const el=Za(Ib(await Ue(Xn.id,"scene.json")));await tn(Xn.id,ss=>CSr(ss,Ga));const uu=Ib(await Ue(Xn.id,"scene.json")),lr=Za(uu)!==el,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 Xn.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(Xn.id);te=b9e(uu??{},K.realmUrl(ss)),await $kr(Pl,()=>{for(const Ts of x)Ts(te)},ti)}else if(te!==null){const ss=b9e(uu??{},te.realm);(ss.spawn!==te.spawn||ss.spawnPoints!==te.spawnPoints)&&(te={...te,spawn:ss.spawn,spawnPoints:ss.spawnPoints},Jur(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:U$t,view:(Lr,ti)=>vTe(Lr,ti),playtest:UXe,uiLayout:xWe,turnEnded:Mzt,build:async Lr=>{Lr.throwIfAborted(),await lt;const ti=await K.build(Xn.id,new Map(Xn.files));if(Lr.throwIfAborted(),!ti.ok)return{ok:!1,diagnostics:ti.diagnostics,mobilePreview:N.status()};const Ga=await L$t();return Lr.throwIfAborted(),{ok:!0,diagnostics:ti.diagnostics,run:Ga,mobilePreview:N.status()}}}}}});function gt(){St.reset(),Y==null||Y(),Y=null,pe!==null&&(pe.stop(),r.close(pe.id),wt.flush(pe.id),pe=null,fe=null)}async function Ue(Xn,Lr){return(pe==null?void 0:pe.id)===Xn?pe.files.get(Lr):r.read(Xn,Lr).catch(ti=>{if(!gI(ti))throw ti})}function qt(Xn,Lr,ti,Ga){const Za=lt.then(async()=>{if(Ga==null||Ga.signal.throwIfAborted(),Ga!==void 0&&((pe==null?void 0:pe.id)!==Xn||!z$t(pe.files.get(Lr),Ga.expected)))throw new Error("This file changed. Read it again before writing.");await r.write(Xn,Lr,ti),wt.touched(Xn,Lr),(pe==null?void 0:pe.id)===Xn&&(pe.files.set(Lr,ti),pe.changed(Lr))});return lt=Za.catch(el=>console.error("[editor] file write failed",el)),Za}function We(Xn,Lr){const ti=lt.then(async()=>{const Ga=await r.remove(Xn,Lr);return Ga&&wt.touched(Xn,Lr),Ga&&(pe==null?void 0:pe.id)===Xn&&pe.files.delete(Lr)&&pe.changed(Lr),Ga});return lt=ti.catch(Ga=>console.error("[editor] file removal failed",Ga)),ti}function Re(Xn){const Lr=Tt();if(Lr.id!==Xn)throw new Error("that scene is not the one open");return{files:()=>Lr.files,write:(ti,Ga)=>qt(Xn,ti,Ga),remove:async ti=>{await We(Xn,ti)}}}async function $t(Xn){var Ga;const Lr=Ib(await Ue(Xn,"scene.json").catch(()=>{})),ti=(((Ga=Lr==null?void 0:Lr.display)==null?void 0:Ga.title)??"").replace(/[\x00-\x1f\x7f]/g,"").replace(new RegExp(BWt.source,"g"),"").trim().slice(0,e2r);return ti===""?Xn:ti}async function vt(Xn,Lr){const ti=(await r.list()).find(Za=>Za.id===Xn);if(ti===void 0)return null;const Ga=await r.duplicate(Xn,`${ti.name} ${Lr}`,wt.remoteIds());return await tn(Ga.id,Za=>{var el;return{...Za,display:{...Za.display??{},title:`${((el=Za.display)==null?void 0:el.title)||ti.name} ${Lr}`}}}),Ga.id}const wt=hTr({store:r,session:()=>{const Xn=l();return s===null||Xn===null?null:{api:s,wallet:Xn}},account:()=>s===null?"unavailable":l()===null?"guest":"on",hash:Fxe,title:$t,duplicate:async Xn=>{const Lr=await vt(Xn,EPt(new Date));if(Lr===null)throw new Error("The scene is no longer on this device");return Lr}});let dt=!1,Nt=0;async function Ut(){const Xn=++Nt,Lr=l()!==null&&(await St.shell.aiProviders()).some(ti=>ti.available);Xn!==Nt||Lr===dt||(dt=Lr,J0())}Ut();let Wt=l();const Me=setInterval(()=>{const Xn=l();Xn!==Wt&&(Wt=Xn,St.reset(),J0(),Ut(),wt.refresh(!0),Ee(fe).catch(Lr=>console.warn("[editor] could not clear the previews",Lr)))},Kkr),Ke=()=>{document.visibilityState==="hidden"&&wt.flush()};document.addEventListener("visibilitychange",Ke);const st=new Set;async function tn(Xn,Lr){const ti=Ib(await Ue(Xn,"scene.json"));if(ti===null)throw new Error("scene.json is missing or is not valid JSON");await qt(Xn,"scene.json",POt(Lr(ti)))}async function An(Xn,Lr){if(Lr==null||Lr==="")return null;const ti=await Ue(Xn,Lr).catch(()=>{});return ti===void 0||ti.length>Ykr?null:IOt(Lr,ti)}async function un(Xn,Lr=wt.status().projects){var Ga,Za,el,uu;const ti=Ib(await Ue(Xn.id,"scene.json").catch(()=>{}));return{sync:Lr[Xn.id],path:Xn.id,name:Xn.name,title:((Ga=ti==null?void 0:ti.display)==null?void 0:Ga.title)||Xn.name,world:((Za=ti==null?void 0:ti.worldConfiguration)==null?void 0:Za.name)||null,parcels:Array.isArray((el=ti==null?void 0:ti.scene)==null?void 0:el.parcels)?ti.scene.parcels.length:0,thumbnail:await An(Xn.id,(uu=ti==null?void 0:ti.display)==null?void 0:uu.navmapThumbnail),favourite:Xn.favourite,lastOpened:Xn.lastOpened,published:Xn.published,deletedAt:Xn.deletedAt??void 0}}async function Tn(Xn,Lr){var Ga,Za;gt(),f.length=0,L({type:"sessionStarted"});const ti=el=>{if(gt(),Lr===Ve){C(`✖ ${el}`);for(const uu of T)uu(el)}};try{if(await wt.prepareOpen(Xn,(ii,yl)=>C(`Downloading from your account… ${ii}/${yl}`)),Lr!==Ve)return;if(!await r.open(Xn)){ti("This scene is open in another tab. Close it there to edit it here.");return}const el=await r.readAll(Xn).then(async ii=>{for(const[yl,ja]of rwr(ii))await qt(Xn,yl,ja),ii.set(yl,ja);return ii}).catch(ii=>{throw r.close(Xn),ii});if(Lr!==Ve){r.close(Xn);return}const uu=await he(Xn);if(Lr!==Ve){r.close(Xn);return}const lr=K.open(Xn,el,uu);pe=lr;const Pl=K.realmUrl(uu);if(fe=Pl,C(`▶ Opening ${((Za=(Ga=Ib(lr.files.get("scene.json")))==null?void 0:Ga.display)==null?void 0:Za.title)||Xn}`),!await lr.start()&&!await lr.published()){if(Lr!==Ve)return;C("✖ The scene did not build.");for(const ii of T)ii("The scene did not build.");return}if(await r.patch(Xn,{lastOpened:Date.now()}),Lr!==Ve){gt();return}const fm=Ib(lr.files.get("scene.json"))??{};te=b9e(fm,Pl),Y=Ukr(ii=>t.engineConsole(ii),C);for(const ii of x)ii(te)}catch(el){ti(n2r(el))}}function fi(Xn){N.close(),te=null;const Lr=++Ve,ti=St.reset(),Ga=xt.then(async()=>{await ti,await lt,Lr===Ve&&await Xn(Lr)});return xt=Ga.catch(Za=>console.error("[editor] project transition failed",Za)),Ga}function Tt(){if(pe===null)throw new Error("no project is open");return pe}const Wi={saveFile:async({path:Xn,content:Lr})=>qt(Tt().id,Xn,Lr),getFile:async({path:Xn})=>{const Lr=Tt().files.get(Xn)??ukr(Xn);if(Lr===void 0)throw new Error(`no such file: ${Xn}`);return{content:Lr}},removeFiles:async({filePaths:Xn})=>{const Lr=Tt(),ti=[],Ga=[];for(const Za of Xn)(await We(Lr.id,Za).catch(()=>!1)?ti:Ga).push(Za);return{success:ti,failed:Ga}},getFilesSizes:async({path:Xn,ignore:Lr})=>{const ti=Xn===""?"":`${Xn.replace(/\/+$/,"")}/`;return{files:[...Tt().files.keys()].filter(Za=>Za.startsWith(ti)&&!Za.split("/").some(el=>Lr.includes(el))).sort().map(Za=>({path:Za}))}}},Er={async find(Xn){return(await r.list()).some(Lr=>Lr.id===Xn)?!0:(await wt.refresh(!0),wt.remoteOnly().some(Lr=>Lr.id===Xn))},files:async Xn=>(pe==null?void 0:pe.id)===Xn?new Map(pe.files):r.readAll(Xn),manifest:Xn=>wt.manifest(Xn),build:async(Xn,Lr)=>K.build(Xn,await Er.files(Xn),Lr),dependencies:async Xn=>MWt(await Ue(Xn,"package.json")),onImported:Xn=>(st.add(Xn),()=>st.delete(Xn))},to=a===null?null:tTr({host:a,setWorld:async(Xn,Lr)=>{var Ga,Za;((Za=(Ga=Ib(await Ue(Xn,"scene.json")))==null?void 0:Ga.worldConfiguration)==null?void 0:Za.name)!==Lr&&await tn(Xn,el=>({...el,worldConfiguration:{...el.worldConfiguration??{},name:Lr}}))},files:Xn=>Er.files(Xn),build:(Xn,Lr)=>K.build(Xn,Lr,{production:!0}),published:(Xn,Lr)=>r.patch(Xn,{published:Lr})}),Ba=(a==null?void 0:a.services.projects)==null?null:Hkr(dTr(a.services.projects,(Xn,Lr)=>a.signedFetch(Xn,Lr)),Fxe);Nfr(_Sr(t.editorBase)),gSr(t.editorBase),V$t({material:ySr,sound:vSr}),lpr(async()=>Qkr(await Er.files(Tt().id)));const Vo=vkr({builtin:PTr(t.editorBase,xB("prefabs/catalog.json"),CTe),user:()=>Ba!==null&&l()!==null?Ba.tree:null}),Kc={...(a==null?void 0:a.services.projects)==null?{}:{...St.shell,aiOffered:()=>dt,aiTranscript:()=>{const Xn=Wt;if(Xn===null||pe===null)return null;const Lr=pe.id;return{owner:`${Lr}@${Xn.toLowerCase()}`,load:()=>r.transcript(Lr,Xn),save:ti=>r.setTranscript(Lr,Xn,ti)}}},pickProject:async()=>{},openProject:Xn=>fi(Lr=>Tn(Xn,Lr)),relaunchProject:Xn=>fi(Lr=>Tn(Xn,Lr)),closeProject:()=>fi(async()=>{gt(),L({type:"sessionStarted"}),C("■ Scene closed"),await Ee(null).catch(Xn=>console.warn("[editor] could not clear the previews",Xn))}),getState:async()=>{const Xn=await r.list(),Lr=wt.status().projects,ti=wt.remoteOnly().map(Ga=>({path:Ga.id,name:Ga.name,title:Ga.name,world:null,parcels:0,thumbnail:null,remoteOnly:!0}));return{recentProjects:[...Xn].sort((Ga,Za)=>Za.lastOpened-Ga.lastOpened).map(Ga=>Ga.id),projects:[...await Promise.all(Xn.map(Ga=>un(Ga,Lr))),...ti],logs:[...f],bevyWebDir:"",editorSceneDir:"",webPort:0,scenePort:0,editorScenePort:0,favourites:Xn.filter(Ga=>Ga.favourite).map(Ga=>Ga.id)}},onStackLog:Xn=>{m.push(Xn)},onBuildEvent:Xn=>{_.push(Xn)},onServersReady:Xn=>{x.push(Xn)},requestReady:async()=>te,phonePreview:async Xn=>te===null?{ok:!1,reason:"no-scene"}:N.open(te.realm,te.position,Xn),phonePreviewState:N.state,onPhonePreviewState:N.subscribe,closePhonePreview:N.close,capturePhonePreview:N.capture,onServersError:Xn=>{T.push(Xn)},toggleFavourite:async Xn=>{const Lr=(await r.list()).find(ti=>ti.id===Xn);Lr!==void 0&&await r.patch(Xn,{favourite:!Lr.favourite})},deleteProject:async Xn=>{const Lr=await r.trash(Xn);return Lr&&wt.trashed(Xn),Lr},trashedProjects:async()=>Promise.all((await r.trashed()).map(Xn=>un(Xn))),restoreProject:async Xn=>{const Lr=await r.restore(Xn);return Lr&&wt.restored(Xn),Lr},syncStatus:async()=>(wt.refresh(),wt.status()),onSyncStatus:Xn=>wt.subscribe(Xn),resolveSyncConflict:(Xn,Lr)=>wt.resolve(Xn,Lr),exportProject:async Xn=>CTr(await $t(Xn),await Er.files(Xn)),importProject:async Xn=>{const Lr=await OTr(Xn,async(ti,Ga)=>{const Za=await r.create(ti,Ga,{taken:wt.remoteIds()});return wt.touched(Za.id,"scene.json"),Za.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(Za=>K.install(ti,Za)).catch(Za=>console.warn("[editor] could not install the packages of",ti,Za));for(const Za of st)Za(Lr.report)}return Lr},projectPackages:async Xn=>B.get(Xn)??null,onProjectPackages:Xn=>(H.add(Xn),()=>H.delete(Xn)),...to===null||a===null?{}:{publishScene:(Xn,Lr,ti)=>to.publish(Xn,Lr,ti),...to.publishShared===void 0?{}:{publishShared:to.publishShared},publishStop:async()=>to.stop(),publishWorlds:async()=>KSr(l(),a.services.worldsContent)},canImportFolder:ETr(),renameProject:(Xn,Lr)=>tn(Xn,ti=>({...ti,display:{...ti.display??{},title:Lr.trim()}})),duplicateProject:Xn=>vt(Xn,"copy"),sceneTemplates:async()=>okr(),createScene:async(Xn,Lr,ti)=>{const Ga=XWt(ti),Za=Ib(Ga.get("scene.json"));if(Za===null)throw new Error(`template not found: ${ti}`);Ga.set("scene.json",POt({...Za,display:{...Za.display??{},title:Lr.trim()}}));const el=await r.create(Lr,Ga,{taken:wt.remoteIds()});return wt.touched(el.id,"scene.json"),el.id},openExternal:async Xn=>{/^https?:$/.test(new URL(Xn).protocol)&&window.open(Xn,"_blank","noopener,noreferrer")},compositeEntityIds:async Xn=>{for(const Lr of TSr){const ti=await Ue(Xn,Lr);if(ti!==void 0)return kSr(new TextDecoder().decode(ti))}return[]},sceneSettings:async Xn=>{const Lr=Ib(await Ue(Xn,"scene.json"));if(Lr===null)throw new Error("scene.json is missing or is not valid JSON");const ti=bSr(Lr);return{...ti,thumbnail:await An(Xn,ti.thumbnailPath)}},saveSceneSettings:async(Xn,Lr)=>{const ti=xSr(Lr);return ti!==null?ti:(await tn(Xn,Ga=>wSr(Ga,Lr)),null)},pickSceneThumbnail:async Xn=>{const Lr=await YWt(Object.values(QWe).join(","));if(Lr===null)return null;const ti=DWt(Lr.name);if(QWe[ti]===void 0)throw new Error("not a supported image (png, jpg, gif, webp)");const Ga=`${Zkr}/scene-thumbnail${ti}`,Za=new Uint8Array(await Lr.arrayBuffer());return await qt(Xn,Ga,Za),{path:Ga,dataUrl:IOt(Ga,Za)}},appVersion:async()=>lSr,prefabLibraryList:()=>Vo.list(),prefabLibraryCopyIn:async(Xn,Lr)=>Vo.copyIn(Xn,Re(Lr)),prefabLibraryUpdateCopy:async(Xn,Lr)=>Vo.updateCopy(Xn,Re(Lr)),prefabUserLibrary:()=>Ba===null?"unavailable":l()===null?"guest":"on",...Ba===null?{}:{prefabLibraryCopyOut:async(Xn,Lr)=>{if(l()===null)throw new Error(t2r);return Ba.copyOut(Re(Xn),Lr)},prefabLibraryDelete:async Xn=>{const Lr=ZWt(Xn);return(Lr==null?void 0:Lr.scope)==="user"&&l()!==null?Ba.remove(Lr.name):!1}}};async function Hl(){const Xn=new Set;for(const Lr of[...await r.list(),...await r.trashed()]){const ti=SWt(await Ue(Lr.id,L3).catch(()=>{}));for(const Ga of Object.keys((ti==null?void 0:ti.packages)??{}))Xn.add(Ga);for(const[Ga,Za]of Object.entries((ti==null?void 0:ti.dependencies)??{}))Xn.add(Qj(Ga,Za))}for(const Lr of await r.packages.keys())Xn.has(Lr)||await r.packages.remove(Lr)}return r.purge(Date.now()-Xkr).then(async Xn=>{const Lr=await caches.open(Uxe),ti=Xn.map(({id:Za,previewId:el})=>K.realmUrl(el??Za));for(const Za of await Lr.keys())ti.some(el=>Za.url.startsWith(el))&&await Lr.delete(Za);const Ga=await caches.open(oSr);for(const Za of ti)await Ga.delete(`${Za}__storage`);Xn.length>0&&await Hl()}).catch(Xn=>console.warn("[editor] could not empty the trash",Xn)),{shell:Kc,projects:Er,dataLayer:Wi,dispose:()=>{N.dispose(),St.dispose(),Ve++,gt(),K.dispose(),clearInterval(Me),document.removeEventListener("visibilitychange",Ke),wt.flush().finally(()=>wt.dispose())}}};let Yj=null,SG=null,rre=null,fPt=!1;function i2r(){if(Yj!==null)return Yj;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-30T11:32:41.068Z"),PPt(t),hNt(a=>t.engineConsole(a)),TRt(()=>t.identity()),cHn.needed=!1;const n=r2r({host:t,sceneCompiler:hSr(t.editorBase)});window.editorShell=a2r(n.shell,t),WDt(n.dataLayer??null),nHe();const r=document.createElement("link");return r.rel="stylesheet",r.href=new URL("editor.css",t.editorBase).href,r.integrity=xB("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),IE.project=null,IE.notice=null,Yj={host:t,web:n,fonts:r},Yj}function Wxe(){const t=SG;SG=null,t==null||t.unmount()}function a2r(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&&Kx("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&&Kx("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&&Kx("project_created",{project_id:f,source:"duplicate",from_project_id:l}),f}},openProject:async l=>{const f=SG;Wxe(),f==null||f.api.close(),rre??(rre=wjt(n.container,A.jsx(Uxr,{}))),n.setMode("edit"),IE.project=l,IE.opens++,await t.openProject(l),Kx("project_opened")}}}function s2r(t,n){var m;const r=i2r();if(r===null)return()=>{};Wxe();const a=document.createElement("div");a.style.cssText="position:relative;width:100%;height:100%",zGn(a),t.appendChild(a);const s=wjt(a,A.jsx(qGn,{}),"eui-create-root"),l={api:n,unmount:()=>{s(),a.remove()}};SG=l;const f=fPt?null:((m=Ck(r.host))==null?void 0:m.openProject)??null;return fPt=!0,Kx("editor_opened",{deep_link:f!==null}),f!==null&&r.web.projects.find(f).catch(()=>!1).then(_=>{var x;SG===l&&(_?(x=window.editorShell)==null||x.openProject(f):IE.notice=`“${f}” is not on this device or on your account. Here are your scenes.`)}),()=>{SG===l&&Wxe()}}function o2r(){Wxe();const t=Yj;if(t===null)return;Yj=null;const n=VE();rre==null||rre(),rre=null,t.fonts.remove(),IE.project=null,delete window.editorShell,TRt(null),hNt(null),PPt(null),t.host.setMode("off"),n.finally(()=>{var r,a;(a=(r=t.web).dispose)==null||a.call(r),Yj===null&&WDt(null)})}window.__dclEditor={mountHome:s2r,unmount:o2r};
|
package/package.json
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dcl-regenesislabs/web-editor",
|
|
3
|
-
"version": "0.3.17
|
|
3
|
+
"version": "0.3.17",
|
|
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": "be9f2ca15fd2010a22af4a43f46ff94aeefe1ddc"
|
|
10
|
+
}
|
|
12
11
|
}
|