@splinetool/viewer 2.0.77 → 2.0.79

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.
@@ -4169,13 +4169,13 @@ void main() {
4169
4169
  }
4170
4170
  post({ kind: 'ready' });
4171
4171
  }, 250);
4172
- })();`}),QF=z(()=>{jC=class{constructor(t,e,i){this.deps=t,this.onConsole=e,this.onEvent=i,this.disposed=!1,this.eventUnsubs=new Map,this.variablePollHandle=null,this.lastVariables=null}dispose(){this.disposed=!0;for(let t of this.eventUnsubs.values())t();this.eventUnsubs.clear(),this.stopVariablePolling()}execute(t,e){let i=this.deps;switch(t){case"setVariable":{let n=i.setVariable(String(e[0]),e[1]);return n.warning&&this.onConsole("warn",n.warning),n.ok}case"setVariables":{let n=e[0]??{},r=!0;for(let[s,a]of Object.entries(n)){let o=i.setVariable(s,a);o.warning&&this.onConsole("warn",o.warning),r=r&&o.ok}return r}case"getVariable":return i.getVariable(String(e[0]));case"getVariables":return i.getVariables();case"getAllObjects":return i.getAllObjects();case"findObjectByName":case"findObjectById":return i.findObject(String(e[0]));case"getGeometry":{let n=i.getGeometry(String(e[0]),e[1]??{});return n.warning&&this.onConsole("warn",n.warning),n.data}case"updateObject":return i.updateObject(String(e[0]),e[1]??{});case"createObject":return i.createObject(String(e[0]),e[1]??{});case"createCustomMaterial":if(i.createCustomMaterial===void 0)throw new Error("createCustomMaterial: not available on this surface \u2014 custom three.js/TSL materials need the inline HTML-content mode (editor Preview/Play and web exports).");return i.createCustomMaterial(e[0]);case"getTexture":if(i.getTexture===void 0)throw new Error("getTexture: not available on this surface \u2014 a three.js texture instance needs the inline HTML-content mode (editor Preview/Play and web exports).");return i.getTexture(String(e[0]),e[1]??{});case"setMaterial":if(i.setMaterial===void 0)throw new Error("setMaterial: not available on this surface \u2014 custom three.js/TSL materials need the inline HTML-content mode (editor Preview/Play and web exports).");return i.setMaterial(String(e[0]),e[1]);case"cloneObject":return i.cloneObject(String(e[0]),e[1]??{});case"removeObject":return i.removeObject(String(e[0]));case"spawnObject":{let n=i.spawnObject(String(e[0]),e[1]??{});return n.warning&&this.onConsole("warn",n.warning),n.object}case"destroyObject":return i.destroyObject(String(e[0]));case"setInstanceTransforms":{let n=e[1]===null||e[1]===void 0?null:e[1],r=i.setInstanceTransforms(String(e[0]),n);return r<0&&this.onConsole("warn",`spline.setInstanceTransforms: "${String(e[0])}" has no cloner \u2014 make the object a cloner first (its copies are what this drives).`),r}case"emitEvent":case"emitEventReverse":{let n=i.emitEvent(String(e[0]),String(e[1]),t==="emitEventReverse");return n.warning&&this.onConsole("warn",n.warning),n.ok}case"requestRender":return i.requestRender(),!0;case"listenEvent":{let n=String(e[0]);return n==="variableChange"?this.startVariablePolling():this.eventUnsubs.has(n)||this.eventUnsubs.set(n,i.addSplineEventListener(n,r=>{this.onEvent(n,r)})),!0}case"unlistenEvent":{let n=String(e[0]);return n==="variableChange"?this.stopVariablePolling():(this.eventUnsubs.get(n)?.(),this.eventUnsubs.delete(n)),!0}default:throw new Error(`Unknown spline bridge method: ${t}`)}}startVariablePolling(){this.variablePollHandle===null&&(this.lastVariables=this.deps.getVariables(),this.variablePollHandle=window.setInterval(()=>{if(this.disposed)return;let t=this.deps.getVariables(),e=function(i,n){let r=[];for(let s of Object.keys(n))i[s]!==n[s]&&r.push({name:s,value:n[s]});return r}(this.lastVariables??{},t);this.lastVariables=t;for(let i of e)this.onEvent("variableChange",i)},100))}stopVariablePolling(){this.variablePollHandle!==null&&(window.clearInterval(this.variablePollHandle),this.variablePollHandle=null),this.lastVariables=null}}});function P$(t,e,i,n){return[t[0]*e+t[4]*i+t[8]*n+t[12],t[1]*e+t[5]*i+t[9]*n+t[13],t[2]*e+t[6]*i+t[10]*n+t[14]]}var D$=z(()=>{}),JF,R$=z(()=>{}),I$=z(()=>{GC(),QF(),JF=class{constructor(t,e,i){this.iframe=t,this.deps=e,this.onConsole=i,this.disposed=!1,this.handshakeSeen=!1,this.handshakeTimer=null,this.onMessage=n=>{if(this.disposed||n.source!==this.iframe.contentWindow)return;let r=n.data;var s;typeof(s=r)!="object"||s===null||s[jl]!==!0||typeof s.kind!="string"||this.handleMessage(r)},this.host=new jC(e,i,(n,r)=>{this.sendEvent(n,r)})}attach(){window.addEventListener("message",this.onMessage),this.send({[jl]:!0,kind:"ready-ack"}),this.handshakeTimer=window.setTimeout(()=>{this.handshakeTimer=null,!this.handshakeSeen&&!this.disposed&&this.onConsole("warn","The HTML content frame has not initialized (no signal from its scripts yet) \u2014 if the page looks frozen, check for errors in its code.")},6e3)}dispose(){this.disposed=!0,window.removeEventListener("message",this.onMessage),this.host.dispose(),this.handshakeTimer!==null&&(window.clearTimeout(this.handshakeTimer),this.handshakeTimer=null)}handleMessage(t){switch(t.kind){case"ready":this.handshakeSeen=!0,this.send({[jl]:!0,kind:"ready-ack"});break;case"console":this.onConsole(t.level,t.text);break;case"call":{let e;try{e=Promise.resolve(this.host.execute(t.method,t.args))}catch(i){e=Promise.reject(i)}e.then(i=>{this.send({[jl]:!0,kind:"result",id:t.id,ok:!0,value:i,error:void 0})},i=>{let n=i instanceof Error?i.message:String(i);this.send({[jl]:!0,kind:"result",id:t.id,ok:!1,value:void 0,error:n}),this.onConsole("error",n)});break}case"input":this.dispatchInput(t.event)}}send(t){this.iframe.contentWindow?.postMessage(t,"*")}sendEvent(t,e){this.send({[jl]:!0,kind:"event",eventName:t,payload:e})}dispatchInput(t){let e=this.deps.getCanvas();if(!e)return;let i=this.iframe.getBoundingClientRect(),n={bubbles:!0,cancelable:!0,view:window,shiftKey:t.shiftKey,ctrlKey:t.ctrlKey,altKey:t.altKey,metaKey:t.metaKey};switch(t.type){case"pointerdown":case"pointermove":case"pointerup":case"pointercancel":e.dispatchEvent(new PointerEvent(t.type,{...n,clientX:(t.x??0)+i.left,clientY:(t.y??0)+i.top,button:t.button,buttons:t.buttons,pointerId:t.pointerId,pointerType:t.pointerType,isPrimary:t.isPrimary,movementX:t.movementX,movementY:t.movementY}));break;case"click":case"dblclick":e.dispatchEvent(new MouseEvent(t.type,{...n,clientX:(t.x??0)+i.left,clientY:(t.y??0)+i.top,button:t.button,buttons:t.buttons}));break;case"wheel":{let r=new WheelEvent("wheel",{...n,clientX:(t.x??0)+i.left,clientY:(t.y??0)+i.top,deltaX:t.deltaX,deltaY:t.deltaY,deltaMode:t.deltaMode});typeof t.wheelDeltaX=="number"&&Object.defineProperty(r,"wheelDeltaX",{value:t.wheelDeltaX}),typeof t.wheelDeltaY=="number"&&Object.defineProperty(r,"wheelDeltaY",{value:t.wheelDeltaY}),e.dispatchEvent(r);break}case"keydown":case"keyup":e.dispatchEvent(new KeyboardEvent(t.type,{...n,key:t.key,code:t.code,repeat:t.repeat}))}}}}),ti=z(()=>{VC(),f$(),m$(),g$(),y$(),_$(),b$(),x$(),w$(),S$(),M$(),T$(),GC(),C$(),QF(),D$(),R$(),I$()}),O$=z(()=>{});function tN(t){return Array.isArray(t)?t:[t]}function N_(t,e){let i=0;for(;i<t.length&&i<e.length;){if(t[i]<e[i])return-1;if(t[i]>e[i])return 1;i+=1}return i!==e.length?-1:i!==t.length?1:0}var L$=z(()=>{});function Ar(t,e){return Object.setPrototypeOf(t,e),t}function fS(t){let e={...t};return Object.setPrototypeOf(e,Object.getPrototypeOf(t)),e}function Ql(t,e,i){if(t===void 0?e===void 0?(t=0,e=10):t=e-10:e===void 0&&(e=t+10),t>e){let s=t;t=e,e=s}let n=[],r=1/(i+1);for(let s=0;s<i;s++){let a=t+(e-t)*(s+.75+.5*Math.random())*r;n.push(a)}return n}function qc(t){return t instanceof Uint8Array||t instanceof Uint16Array||t instanceof Uint32Array||t instanceof Int8Array||t instanceof Int16Array||t instanceof Int32Array||t instanceof Float32Array||t instanceof Float64Array}var B$=z(()=>{});function HC(t){if(t.deepFreeze!==void 0)return void t.deepFreeze(t);let e=Object.getOwnPropertyNames(t);for(let i of e){let n=t[i];n&&typeof n=="object"&&HC(n)}return Object.freeze(t)}function eN(t){for(let e of Object.keys(t))t[e]===void 0&&delete t[e];return t}var mS,k_,iA,te,WC,U$=z(()=>{}),Dn=z(()=>{O$(),L$(),B$(),U$()}),qC=z(()=>{mS=class{},k_=class extends mS{constructor(t){super(),this.id=t}},iA=class extends mS{constructor(t){super(),this.data=t}}}),z$=z(()=>{}),rx=z(()=>{te=class{modifyById(t,e){let i=this;if(i[t]===void 0)throw new Error("not expected");{let n={...i,[t]:e};return Object.setPrototypeOf(n,te.prototype),n}}add(t,e){return this.runOp({type:1,id:t,data:e})?.data??this}runOp(t){let e=this;if(t.type===1){let i,n=e[t.id];i=n===void 0?{type:2,id:t.id}:{type:1,id:t.id,data:n};let{id:r,data:s}=t,a={...e,[r]:s};return Object.setPrototypeOf(a,te.prototype),{data:a,actual:t,reverse:i}}if(t.type===2){let{id:i}=t,n=e[i];if(n===void 0)return null;{let r={...e};return Object.setPrototypeOf(r,te.prototype),delete r[i],{data:r,actual:t,reverse:{type:1,id:i,data:n}}}}return null}}}),XC=z(()=>{WC=class extends Error{}});function iN(t,e){for(let i of t)e(i.id,i.data)!==!0&&iN(i.children,e)}function nN(t,e){if(e(t.id,t.data)!==!0)for(let i of t.children)nN(i,e)}var Xn,_v,fp,Vt,Jc=z(()=>{Dn(),XC(),Dn(),Xn=class extends Array{constructor(...t){super(...t),Qa(this,"partialObjectCaches"),Qa(this,"objCaches"),Qa(this,"parentCaches"),Object.setPrototypeOf(this,Xn.prototype)}deepFreeze(){let t=0;for(;t<this.length;)HC(this[t]),t++}fillCaches0(t,e){this.objCaches.set(t.id,t),this.parentCaches.set(t.id,e);for(let i of t.children)this.fillCaches0(i,t.id)}fillCaches(){if(this.objCaches===void 0){this.objCaches=new Map,this.parentCaches=new Map;for(let t of this)this.fillCaches0(t,null)}}randomId(){this.fillCaches();let t=Array.from(this.objCaches.keys());if(t.length!==0)return t[Math.max(0,Math.floor(Math.random()*t.length)-1)]}nonExistOrDescendantOf(t,e){if(!this.has(t))return!0;for(;t;){let i=this.parent(t);if(i===e)return!0;t=i}return!1}rootAcestor(t){for(;t;){let e=this.parent(t);if(!e)return t;t=e}return t}isDescendantOf(t,e){for(;t;){let i=this.parent(t);if(i===e)return!0;t=i}return!1}data(t){return this.get(t)?.data}has(t){return this.childrenOf(t)!==void 0}partialCache(t){this.partialObjectCaches===void 0&&(this.partialObjectCaches=new Map);let e=this.get(t);e!==void 0&&this.partialObjectCaches.set(t,e)}get(t){if(this.partialObjectCaches!==void 0){let e=this.partialObjectCaches.get(t);if(e!==void 0)return e}return this.fillCaches(),this.objCaches.get(t)}childrenOf(t){return t===null?this:this.get(t)?.children}traverseFrom(t,e){if(t===null)this.traverse(e);else{let i=this.get(t);i&&nN(i,e)}}traverse(t){iN(this,t)}totalSize(){return this.fillCaches(),this.objCaches.size}parent(t){return this.fillCaches(),this.parentCaches.get(t)}childrenArray(t){return t===null?this:this.get(t).children}modifyById(t,e){if(this.get(t)===void 0)throw new Error("not expected");{let i=this.parent(t),n=this.childrenArray(i),r=n.findIndex(o=>o.id===t);if(r<0)throw new Error("not expected");let s=n[r];n=[...n],n[r]={...s,data:e};let a=new Map;return a.set(t,n[r]),this.modifyArrayBy(i,n,a)}}modifyArrayBy(t,e,i=void 0){let n=t,r=e;for(;n!==null;){let a=r,o=n;if(n=this.parent(n),n===void 0)throw new Error;r=this.childrenArray(n);let l=r.findIndex(c=>c.id===o);if(l<0)throw new Error;r=[...r],r[l]={...r[l],children:a},i&&i.set(o,r[l])}Object.setPrototypeOf(r,Xn.prototype);let s=r;if(i&&this.objCaches!==void 0&&this.parentCaches!==void 0){s.objCaches=this.objCaches;for(let[a,o]of i)s.objCaches.set(a,o);s.parentCaches=this.parentCaches,this.objCaches=void 0,this.parentCaches=void 0}else s.fillCaches();return s}runOp(t){switch(t.type){case 7:return this.addOp(t);case 8:return this.deleteOp(t);case 9:return this.moveOp(t)}return null}checkDuplicatedIdRec({id:t,children:e}){if(this.get(t)!==void 0)return!0;for(let i of e)if(this.checkDuplicatedIdRec(i))return!0;return!1}addOp(t){let{parent:e,fi:i,id:n,data:r,children:s}=t;if(e!==null&&this.get(e)===void 0||this.checkDuplicatedIdRec(t))return null;{let a=e,o=this.childrenArray(a),l={fi:i,id:n,data:r,children:s};return o=[...o,l],o.sort((c,h)=>c.fi-h.fi),t.localIndex=o.indexOf(l),{data:this.modifyArrayBy(a,o),actual:t,reverse:{type:8,id:n}}}}deleteOp(t){let{id:e}=t;if(this.get(e)===null)return null;{let i=this.parent(e);if(i===void 0)return null;let n=this.childrenArray(i),r=n.findIndex(a=>a.id===e);t.localIndex=r,n=[...n];let s=n.splice(r,1)[0];return{data:this.modifyArrayBy(i,n),actual:t,reverse:{type:7,...s,parent:i}}}}moveOp(t){let{parent:e,fi:i,id:n}=t;if(e!==null&&this.get(e)===void 0)return this.deleteOp({type:8,id:n});if(e!==null){let d=e;for(;d!==null;){if(d===void 0)throw new Error;if(d===n)throw new WC("cyclic tree");d=this.parent(d)}}let r=this.parent(n);if(r===void 0)return null;let s=r,a=this.childrenArray(r),o=a.findIndex(d=>d.id===n);a=[...a];let l=a.splice(o,1)[0],c=this.modifyArrayBy(r,a);r=e,a=c.childrenArray(r);let h=l.fi;return l={...l,fi:i},a=[...a,l],a.sort((d,u)=>d.fi-u.fi),t.localIndex=a.indexOf(l),c=c.modifyArrayBy(r,a),{data:c,actual:t,reverse:{type:9,parent:s,fi:h,id:n}}}previous(t,e){if(e===null){let n=this.childrenArray(t);return n.length===0?null:n[n.length-1].id}let i=null;for(let n of this.childrenArray(t)){if(n.id===e)return i;i=n.id}return null}traverseSortNext(t){let e=this.parent(t);if(e!==void 0){let i=this.childrenArray(e),n=i.findIndex(r=>r.id===t)+1;if(n<i.length)return i[n].id;if(e)return this.traverseSortNext(e)}}sortNext(t){let e=this.childrenArray(t);return e.length>0?e[0].id:this.traverseSortNext(t)}traverseSortPrevious(t){let e=this.childrenArray(t);return e.length>0?this.traverseSortPrevious(e[e.length-1].id):t}sortPrevious(t){let e=this.parent(t);if(e!==void 0){let i=this.childrenArray(e),n=i.findIndex(r=>r.id===t)-1;return n>=0?this.traverseSortPrevious(i[n].id):e}}getAllSorted(t){let e=[];for(let i of t){let n=this.getWithSortKey(i.id);n!==void 0&&e.push({...i,...n})}e.sort((i,n)=>N_(i.sortKey,n.sortKey));for(let i of e)delete i.sortKey;return e}getAllIdSorted(t){let e=[];for(let i of t){let n=this.getWithSortKey(i);n!==void 0&&e.push(n)}e.sort((i,n)=>N_(i.sortKey,n.sortKey));for(let i of e)delete i.sortKey;return e.map(i=>i.id)}getWithSortKey(t){let e=t,i=[],n=this.get(e),r=n;if(n!==void 0){for(;e;)i.splice(0,0,n.fi),e=this.parent(e),e!==null&&(n=this.get(e));return{...r,sortKey:i}}}insertBeforeHelper(t,e,i){return this.insertAfterHelper(t,this.previous(t,e),i)}insertAfterHelper(t,e,i){let n=this.childrenArray(t);if(e===null){if(n.length===0)return Ql(0,i,i);{let r=n[0].fi;return Ql(r-i,r,i)}}{let r=this.get(e);if(r===void 0||this.parent(e)!==t)throw new Error("illegal args");let s=n.find(a=>a.fi>r.fi);if(s===void 0){let a=n[n.length-1].fi;return Ql(a,a+i,i)}return Ql(r.fi,s.fi,i)}}}}),$C=z(()=>{var t;Dn(),_v=null,(t=fp||(fp={})).setPreservePrototype=function(e){_v=e},t.tryPreservePrototype=function(e,i){return Object.getPrototypeOf(e)===_v&&Object.setPrototypeOf(i,_v),i},t.runOp=function(e,i){if(i.type!==0)return null;if(Array.isArray(e)||qc(e)){let n=i.props,r={},s=qc(e)?e.slice():[...e],a=!1;if(n)for(let o of Object.keys(n)){let l=parseInt(o);if(isNaN(l))throw new Error("wrong index");r[o]=s[l],s[l]=n[o],a=!0}return a?{data:s,actual:i,reverse:{type:0,props:r}}:null}{let n=i.props,r={},s={...e},a=!1;if(n)for(let o of Object.keys(n)){r[o]=s[o];let l=n[o];l===void 0?delete s[o]:s[o]=l,a=!0}return a?{data:t.tryPreservePrototype(e,s),actual:i,reverse:{type:0,props:r}}:null}}}),td=z(()=>{Dn(),Dn(),Vt=class extends Array{constructor(...t){super(...t),Qa(this,"objCaches"),Object.setPrototypeOf(this,Vt.prototype)}deepFreeze(){let t=0;for(;t<this.length;)HC(this[t]),t++}fillCaches0(t){this.objCaches.set(t.id,t)}fillCaches(){if(this.objCaches===void 0){this.objCaches=new Map,Object.getOwnPropertyDescriptor(this,"objCaches").enumerable=!1;for(let t of this)this.fillCaches0(t)}}randomId(){this.fillCaches();let t=Array.from(this.objCaches.keys());if(t.length!==0)return t[Math.max(0,Math.floor(Math.random()*t.length)-1)]}data(t){return this.get(t)?.data}get(t){return this.fillCaches(),this.objCaches.get(t)}modifyById(t,e){if(this.get(t)===void 0)throw new Error("not expected");{let i=this,n=i.findIndex(s=>s.id===t);if(n<0)throw new Error("not expected");let r=i[n];return i=[...i],i[n]={...r,data:e},this.modifyArrayBy(i)}}modifyArrayBy(t){Object.setPrototypeOf(t,Vt.prototype);let e=t;return typeof process<"u"||e.fillCaches(),e}runOp(t){switch(t.type){case 4:return this.addOp(t);case 5:return this.deleteOp(t);case 6:return this.moveOp(t)}return null}addOp(t){let{fi:e,id:i,data:n}=t,r=this,s={fi:e,id:i,data:n};return r=[...r,s],r.sort((a,o)=>a.fi-o.fi),t.localIndex=r.indexOf(s),{data:this.modifyArrayBy(r),actual:t,reverse:{type:5,id:i}}}deleteOp(t){let{id:e}=t,i=this,n=i.findIndex(s=>s.id===e);if(n===-1)return null;t.localIndex=n,i=[...i];let r=i.splice(n,1)[0];return{data:this.modifyArrayBy(i),actual:t,reverse:{type:4,...r}}}moveOp(t){let{fi:e,id:i}=t,n=this;n=[...n];let r=n.findIndex(o=>o.id===i);if(r===-1)return null;let s=n[r].fi,a={...n[r],fi:e};return n[r]=a,n.sort((o,l)=>o.fi-l.fi),t.localIndex=n.indexOf(a),{data:this.modifyArrayBy(n),actual:t,reverse:{type:6,fi:s,id:i}}}previous(t){if(t===null)return this.length===0?null:this[this.length-1].id;let e=null;for(let i of this){if(i.id===t)return e;e=i.id}return null}insertBeforeHelper(t,e){return this.insertAfterHelper(this.previous(t),e)}insertAfterHelper(t,e){let i=this;if(t===null){if(i.length===0)return Ql(0,e,e);{let n=i[0].fi;return Ql(n-e,n,e)}}{let n=this.get(t);if(n===void 0)throw new Error("illegal args");let r=i.find(s=>s.fi>n.fi);if(r===void 0){let s=i[i.length-1].fi;return Ql(s,s+e,e)}return Ql(n.fi,r.fi,e)}}}});function F$(t,e){let i={cur:[],result:[],len:0};return[t=Xu(t,e,i)??t,i.result]}function M1(t,e){return t===null?null:(t.cur[t.len]=e,t.len+=1,t)}function E1(t){t&&(t.len-=1)}function rN(t,e,i){let n=!1,r=t.map(s=>{let a=s.id,o=e[a];if(o!==void 0&&typeof o=="string"&&(n=!0,a=o,i!==null))throw new Error("not supported");let l=Xu(s.data,e,M1(i,a));E1(i),n=n||l!==void 0,l===void 0&&(l=s.data);let c=rN(s.children,e,i);return c!==void 0?n=!0:c=s.children,{...s,id:a,data:l,children:c}});if(n)return r}function Xu(t,e,i){if(t instanceof Xn){let n=rN(t,e,i);return n!==void 0&&Object.setPrototypeOf(n,Object.getPrototypeOf(t)),n}if(t instanceof Vt)return function(n,r,s){let a=!1,o=n.map(l=>{let c=l.id,h=r[c];if(h!==void 0&&typeof h=="string"&&(a=!0,c=h,s!==null))throw new Error("not supported");let d=Xu(l.data,r,M1(s,c));return E1(s),a=a||d!==void 0,d===void 0&&(d=l.data),{...l,id:c,data:d}});if(a)return Object.setPrototypeOf(o,Object.getPrototypeOf(n)),o}(t,e,i);if(Array.isArray(t)){let n=!1,r=t.map((s,a)=>{let o=Xu(s,e,M1(i,a));return E1(i),n=n||o!==void 0,o===void 0&&(o=s),o});return n?(Object.setPrototypeOf(r,Object.getPrototypeOf(t)),r):void 0}if(t&&typeof t=="object"&&!qc(t)){let n={},r=!1;for(let[s,a]of Object.entries(t))if(s!=="name"&&s!=="variableId"){let o=e[s];if(typeof o=="string"){if(i!==null)throw new Error("not supported");r=!0,s=o}let l=Xu(a,e,M1(i,s));E1(i),r=r||l!==void 0,l===void 0&&(l=a),n[s]=l}else n[s]=a;return r?(Object.setPrototypeOf(n,Object.getPrototypeOf(t)),n):void 0}if(typeof t=="string"){let n=e[t];return n!==void 0&&function(r){if(r===null)return null;r.result.push(r.cur.slice(0,r.len))}(i),n}}var sN=z(()=>{Jc(),td(),Dn()});function $u(t){return t&&typeof t=="object"&&t instanceof $i}function YC(t,e){if(e===void 0)return;let i=!1,n=t.map(r=>{let s=r.id,a=cg(r.data,e[s]);if(i=i||a!==void 0,a===void 0&&(a=r.data),r.children){let o=YC(r.children,e);return o!==void 0?i=!0:o=r.children,{...r,id:s,data:a,children:o}}return{...r,id:s,data:a}});return i?n:void 0}function cg(t,e){if(!$u(e))return e;if(t instanceof Xn){let i=YC(t,e);return i!==void 0&&Object.setPrototypeOf(i,Object.getPrototypeOf(t)),i}if(t instanceof Vt)return function(i,n){if(n===void 0)return;let r=!1,s=i.map(a=>{let o=a.id,l=cg(a.data,n[o]);return r=r||l!==void 0,l===void 0&&(l=a.data),{...a,id:o,data:l}});return r?(Object.setPrototypeOf(s,Object.getPrototypeOf(i)),s):void 0}(t,e);if(Array.isArray(t)){let i=!1,n=t.map((r,s)=>{let a=cg(r,e[s]);return i=i||a!==void 0,a===void 0&&(a=r),a});return i?(Object.setPrototypeOf(n,Object.getPrototypeOf(t)),n):void 0}if(t instanceof $i)return ZC(t,e);if(t&&typeof t=="object"){let i={},n=!1;for(let[r,s]of Object.entries(t)){let a=cg(s,e[r]);n=n||a!==void 0,a===void 0&&(a=s),i[r]=a}return n?(Object.setPrototypeOf(i,Object.getPrototypeOf(t)),i):void 0}}function ZC(t,e){if(t===void 0)return e;if(e===void 0)return t;if(!$u(e))return e;if(!$u(t))return ch.apply(t,e);let i=new Set;for(let r of Object.keys(t))i.add(r);for(let r of Object.keys(e))i.add(r);let n=new $i;for(let r of i){let s=ZC(t===void 0?void 0:t[r],e===void 0?void 0:e[r]);n[r]=s}return n}var $i,ch,V_,er,xI,sx=z(()=>{var t;Jc(),td(),lx(),Dn(),$i=class{unusedFunOverridesTable(e){}runOp(e){let i=[],n=this,r=0,s={};for(;r<e.path.length;){if(i.push(n),n=n===void 0?void 0:n[e.path[r]],n!==void 0&&!$u(n))return null;r+=1}n=n?fS(n):new $i;for(let[a,o]of Object.entries(e.props)){let l=n[a];s[a]=l,o===void 0?delete n[a]:n[a]=o}for(;r>0;){if(Object.keys(n).length===0){let a=i[r-1];a&&(n=fS(a),delete n[e.path[r-1]])}else{let a=i[r-1];if(a){let o=fS(a);o[e.path[r-1]]=n,n=o}else{let o=new $i;o[e.path[r-1]]=n,n=o}}r-=1}return{data:Object.setPrototypeOf(n,$i.prototype),actual:e,reverse:{...e,props:s}}}},(t=ch||(ch={})).apply=function(e,i){return cg(e,i)??e},t.merge=function(e,i){return ZC(e,i)},t.filterOp=function(e,i){let n=0,r=i.path,s=e;for(;n<r.length&&s!==void 0;){if(s=jn.zoomOnce(s,r[n]),s===void 0)return i;if(!$u(s))return;n+=1}if(s===void 0)return i;if($u(s)){if(i.type===0){let a={...i.props};for(let o of Object.keys(s))delete a[o];return{...i,props:a}}if(i.type===1||i.type===4||i.type===7){let a=YC([i],s);return a?a[0]:i}return i}}}),N$=z(()=>{Dn(),lx(),rx(),Jc(),XC(),$C(),td(),sN(),sx(),(V_||(V_={})).replaceProps=function(t,e){let i=jn.zoom(e,t.path);if(typeof i=="object"){let n={};for(let r of Object.keys(t.props))n[r]=i[r];return{...t,props:n}}return{...t,props:{}}},(t=>{function e(r,s){let a=s.path,o=[];for(;;){let l;if(r instanceof $i&&s.type===0&&(l=r.runOp({...s,path:a.slice(o.length)}),l===null&&(l=void 0)),l===void 0&&o.length===a.length&&(l=r instanceof Xn||r instanceof Vt||r instanceof te?r.runOp(s):fp.runOp(r,s)),l!==void 0){if(l!==null){let d=l.data;for(let u=o.length-1;u>=0;u--){let p=a[u],f=o[u];if(f instanceof Xn){if(typeof p=="number")throw new Error("illegal arg");d=f.modifyById(p,d)}else if(f instanceof Vt){if(typeof p=="number")throw new Error("illegal arg");d=f.modifyById(p,d)}else if(f instanceof te){if(typeof p=="number")throw new Error("illegal arg");d=f.modifyById(p,d)}else if(f instanceof $i){let g={...f,[p]:d};d=Object.setPrototypeOf(g,$i.prototype)}else{if(typeof f!="object")return null;if(Array.isArray(f)||qc(f)){if(typeof p=="string"&&(p=parseInt(p),isNaN(p)))throw new Error("Invalid path");let g=d;d=qc(f)?f.slice():[...f],d[p]=g}else d=fp.tryPreservePrototype(f,{...f,[p]:d})}}return{data:d,actual:{...l.actual,path:a},reverse:{...l.reverse,path:a}}}return null}let c,h=a[o.length];if(r instanceof Xn){if(typeof h=="number")throw new Error("");c=r.get(h)?.data}else if(r instanceof Vt){if(typeof h=="number")throw new Error("");c=r.get(h)?.data}else r!==null&&(c=r[h]);if(c===void 0)return null;o.push(r),r=c}}function i(r,s){for(let a=0;a<r.length&&a<s.length;a++)if(r[a]!==s[a])return!0;return!1}function n(r,s){if(r.length!==s.length)return!1;for(let a=0;a<r.length;a++)if(r[a]!==s[a])return!1;return!0}t.drop=function(r,s){return{...r,path:r.path.slice(s)}},t.applySimple=function(r,s){return e(r,s)?.data??r},t.apply=e,t.pathDisjoint=i,t.pathEq=n,t.commutative=function(r,s){return i(r.path,s.path)},t.subsumed=function(r,s){return!(r.type!==0||s.type!==0||!n(r.path,s.path))&&Object.keys(r.props).every(a=>s.props[a]!==void 0)}})(er||(er={})),(t=>{function e(i,n){let r=i,s=[],a=[];for(let o of n)try{if(o.type===3||o.type===5&&o.path[o.path.length-1]==="variables"){let l,c,h;if(o.type===3?(l=jn.zoom(r,[...o.path,o.id]),h=er.apply(r,{...o,type:2})):(l=jn.zoom(r,[...o.path,o.id,"value"]),h=er.apply(r,o)),h!==null){r=h.data;let[d,u]=F$(r,{[o.id]:l});r=d;for(let p=0;p<u.length;p++){let f=u[p],g=f.pop();if(typeof g=="number"){let m=[g];for(let y=p+1;y<u.length;y++){let _=u[y],b=_[_.length-1];if(typeof b!="number"||!jn.equal(f,_.slice(0,_.length-1)))break;m.push(b),u.splice(y,1)}let v=jn.zoom(r,f);c=v.map((y,_)=>m.includes(_)?o.id:y),l=v,g=f.pop()}else{if(g==="alphaOverride"||g==="alpha"){l/=100;let m=l,v=jn.zoom(r,f.slice(0,f.length-2)),y=v.layers.map(_=>_.id===f[f.length-1]?{..._,data:{..._.data,[g]:m}}:_);Object.setPrototypeOf(y,Object.getPrototypeOf(v.layers)),v.layers=y}c=o.id}s.push({type:0,path:f,props:{[g]:l}}),a.push({type:0,path:f,props:{[g]:c}})}a.push(h.reverse),s.push(h.actual)}}else{let l=er.apply(r,o);l!==null&&(s.push(l.actual),r=l.data,a.push(l.reverse))}}catch(l){if(l instanceof WC)return null;throw l}return{data:r,actual:s,reverse:a.reverse()}}t.empty=function(){return[]},t.removePrefix=function(i,n){let r=[];for(let s of i){let[a,...o]=s.path;a===n&&r.push({...s,path:o})}return r},t.addPrefix=function(i,n){return i.map(r=>({...r,path:[n,...r.path]}))},t.concat=function(i,n){return[...i,...n]},t.compress=function(i,n){return[...i.filter(r=>!n.some(s=>er.subsumed(r,s))),...n]},t.commutative=function(i,n){return i.every(r=>n.every(s=>er.commutative(r,s)))},t.applyAll=function(i,n){for(let r of n){let s=e(i,r);s!==null&&(i=s.data)}return i},t.apply=e})(xI||(xI={}))});function wI(t,e){return t instanceof $i?Object.setPrototypeOf(e,$i.prototype):fp.tryPreservePrototype(t,e)}function gS(t,e,i){if(t.length>0){let n=t[t.length-1];if(n.type===0&&e.type===0&&jn.equal(n.path,i))return void Object.assign(n.props,e.props)}t.push({...e,path:i})}function A1(t,e,i){return i instanceof Xn?new ax(t,e,i):i instanceof Vt?new ox(t,e,i):i instanceof te?new Proxy(new oN(t,e,i),hN):i!==null&&typeof i=="object"?qc(i)?i:new Proxy(new aN(t,e,i),lN):i}function Bm(t){let e=new rA(t);return[A1(e,"",t),e]}function j_(t,e){let[i,n]=Bm(t);return e(i),n.result()}function un(t){return t instanceof ax||t instanceof ox?t._current:t!==null&&typeof t=="object"?t[nA]:t}var nA,SI,Uf,Ud,aN,oN,vS,lN,hN,ax,ox,rA,jn,cN=z(()=>{rx(),Jc(),$C(),td(),Dn(),lx(),sx(),nA=Symbol(),SI=Symbol(),Uf=Symbol(),Ud=class{reportOp(t,e,i=[]){let n=this;if(e===null)return;n._current=e.data;let r=i;for(;!(n instanceof rA);){let s=n._path,a=n._current;if(s!==""&&r.splice(0,0,s),n=n._parent,n===null)return;n.update(s,a)}n.push(r,t,e.actual,e.reverse)}deleteChildren(t){if(this._children){let e=this._children[t];if(e){let i=e[Uf];i&&i(),delete this._children[t]}}}},aN=class extends Ud{constructor(t,e,i){super(),this._parent=t,this._path=e,this._current=i}update(t,e){if(Array.isArray(this._current)){if(typeof t=="string"&&(t=parseInt(t),isNaN(t)))throw new Error("Invalid path");this._current=[...this._current],this._current[t]=e}else this._current=wI(this._current,{...this._current,[t]:e})}runOp(t){let e=fp.runOp(this._current,t);e!==null&&(e.data=wI(this._current,e.data)),this.reportOp(t,e,t.path)}},oN=class extends Ud{constructor(t,e,i){super(),this._parent=t,this._path=e,this._current=i}update(t,e){this._current={...this._current,[t]:e},Object.setPrototypeOf(this._current,te.prototype)}runOp(t){this.reportOp(t,this._current.runOp(t))}},vS={get(t,e){if(e===Uf)return()=>{t._parent=null};if(e===nA)return t._current;if(e===SI)return t;let{_current:i,_children:n}=t;if(e==="push"&&Array.isArray(i))throw new Error("not supported to expand array");let r=n===void 0?void 0:n[e];if(r!==void 0)return r;let s=i[e],a=A1(t,e,s);return a!==s?(n===void 0&&(n={},t._children=n),n[e]=a,a):s},has:(t,e)=>e in t._current,ownKeys:t=>Reflect.ownKeys(t._current),defineProperty(){throw Error("not supported")},getPrototypeOf:t=>Object.getPrototypeOf(t._current),setPrototypeOf(){throw Error("not supported")},getOwnPropertyDescriptor(t,e){let i=t._current,n=Reflect.getOwnPropertyDescriptor(i,e);return n&&{writable:!0,configurable:!0,enumerable:n.enumerable,value:i[e]}}},lN={...vS,set(t,e,i){let n={type:0,props:{[e]:un(i)??i}};return t.deleteChildren(e),t.runOp(n),!0},deleteProperty(t,e){let i={type:0,props:{[e]:void 0}};return t.deleteChildren(e),t.runOp(i),!0}},hN={...vS,set(t,e,i){return i===void 0?this.deleteProperty(t,e):(t.deleteChildren(e),t.runOp({type:1,id:e,data:i})),!0},deleteProperty:(t,e)=>(t.runOp({type:2,id:e}),!0)},ax=class extends Ud{constructor(t,e,i){super(),this._children={},this._parent=t,this._path=e,this._current=i,this[Uf]=()=>{this._parent=null}}unproxy(){return this._current}update(t,e){this._current=this._current.modifyById(t,e)}runOp(t){this.reportOp(t,this._current.runOp(t))}randomId(){return this._current.randomId()}isDescendantOf(t,e){return this._current.isDescendantOf(t,e)}childrenOf(t){return this._current.childrenOf(t)}get(t){return this._current.get(t)}parent(t){return this._current.parent(t)}traverse(t){this._current.traverse((e,i)=>{t(e,this.data(e))})}data(t){let{_current:e,_children:i}=this,n=i===void 0?void 0:i[t];if(n!==void 0)return n;let r=e.get(t)?.data,s=A1(this,t,r);return s!==r?(i===void 0&&(i={},this._children=i),i[t]=s,s):r}add(t,e,i,n,r){this.runOp({type:7,parent:t,fi:e,id:i,data:n,children:r})}move(t,e,i){this.runOp({type:9,parent:t,fi:e,id:i})}insertAfter(t,e,i){let n=this._current.insertAfterHelper(t,e,i.length);for(let r=0;r<i.length;r++){let s=i[r];this.add(t,n[r],s.id,s.data,s.children)}}insertBefore(t,e,i){let n=this._current.insertBeforeHelper(t,e,i.length);for(let r=0;r<i.length;r++){let s=i[r];this.add(t,n[r],s.id,s.data,s.children)}}moveAfter(t,e,i){let n=this._current.insertAfterHelper(t,e,i.length);for(let r=0;r<i.length;r++){let s=i[r];this.move(t,n[r],s)}}moveBefore(t,e,i){let n=this._current.insertBeforeHelper(t,e,i.length);for(let r=0;r<i.length;r++){let s=i[r];this.move(t,n[r],s)}}delete(t){this.deleteChildren(t),this.runOp({type:8,id:t})}sortNext(t){return this._current.sortNext(t)}sortPrevious(t){return this._current.sortPrevious(t)}getAllSorted(t){return this._current.getAllSorted(t)}},ox=class extends Ud{constructor(t,e,i){super(),this._children={},this._parent=t,this._path=e,this._current=i,this[Uf]=()=>{this._parent=null}}unproxy(){return this._current}get length(){return this._current.length}forEach(t){let e=this.length;for(let i=0;i<e;i++){let n=this._current[i].id,r=this._current[i].fi;t(this.data(this._current[i].id),n,r,i)}}find(t){let e=this.length;for(let i=0;i<e;i++){let n=this._current[i].id;if(t(this.data(n),n))return this.get(n)}}update(t,e){this._current=this._current.modifyById(t,e)}randomId(){return this._current.randomId()}get(t){return{...this._current.get(t),data:this.data(t)}}at(t){let{id:e,fi:i}=this._current.at(t);return{id:e,fi:i,data:this.data(e)}}data(t){let{_current:e,_children:i}=this,n=i===void 0?void 0:i[t];if(n!==void 0)return n;let r=e.get(t)?.data,s=A1(this,t,r);return s!==r?(i===void 0&&(i={},this._children=i),i[t]=s,s):r}runOp(t){this.reportOp(t,this._current.runOp(t))}add(t,e,i){this.runOp({type:4,fi:t,id:e,data:i})}move(t,e){this.runOp({type:6,fi:t,id:e})}insertAfter(t,e){let i=this._current.insertAfterHelper(t,e.length);for(let n=0;n<e.length;n++){let r=e[n];this.add(i[n],r.id,r.data)}}insertBefore(t,e){let i=this._current.insertBeforeHelper(t,e.length);for(let n=0;n<e.length;n++){let r=e[n];this.add(i[n],r.id,r.data)}}moveAfter(t,e){let i=this._current.insertAfterHelper(t,e.length);for(let n=0;n<e.length;n++){let r=e[n];this.move(i[n],r)}}moveBefore(t,e){let i=this._current.insertBeforeHelper(t,e.length);for(let n=0;n<e.length;n++){let r=e[n];this.move(i[n],r)}}delete(t){this.deleteChildren(t),this.runOp({type:5,id:t})}},rA=class extends Ud{constructor(t){super(),this.ts=[],this.actual=[],this.reverse=[],this._current=t}update(t,e){if(t!=="")throw new Error("");this._current=e}push(t,e,i,n){gS(this.ts,e,t),gS(this.actual,i,t),gS(this.reverse,n,t)}result(){return{data:this._current,ts:this.ts,actual:this.actual,reverse:this.reverse.reverse()}}}}),lx=z(()=>{qC(),cN(),td(),Jc(),Dn(),(t=>{function e(n,r){return(n instanceof Xn||n instanceof ax)&&typeof r=="string"||(n instanceof Vt||n instanceof ox)&&typeof r=="string"?n.data(r):typeof r=="number"&&Array.isArray(n)||typeof r=="string"&&typeof n=="object"&&n!==null?n[r]:void 0}function i(n,r,s=0){for(;s<r.length&&n!==void 0;)n=e(n,r[s]),s+=1;return n}t.equal=function(n,r){if(r.length!==n.length)return!1;{let s=0;for(;s<n.length;){if(n[s]!==r[s])return!1;s+=1}}return!0},t.removeOverridden=function(n,r,s){let a=i(s,n);if(a!==void 0&&typeof a=="object"&&a!==null){let o={...r};return Object.keys(a).forEach(l=>{delete o[l]}),o}return r},t.zoomOnce=e,t.zoom=i,t.findPathes=function(n,r){let s=[];return function a(o,l){if(o instanceof k_&&o.id===r.id)s.push(l);else if(o instanceof Vt)for(let c=0;c<o.length;c++)a(o[c].data,[...l,o[c].id]);else if(o instanceof Xn)o.traverse((c,h)=>{a(h,[...l,c])});else if(Array.isArray(o)){if(typeof o[0]=="number")return;for(let c=0;c<o.length;c++)a(o[c],[...l,c])}else{if(qc(o))return;if(typeof o=="object"&&o!==null)for(let c in o)a(o[c],[...l,c])}}(n,[]),s}})(jn||(jn={}))}),k$=z(()=>{});function ri(t,e){let i=[];if(!(e.length<=t.length))return null;{let n=0;for(;n<e.length;){if(e[n]==="*")i.push(t[n]);else if(t[n]!==e[n])return null;n+=1}}return i}var V$=z(()=>{});function bv(t){try{if(!bi.trusted&&!el){let i=Qe.sharedLength||0;i<Qe.length&&(Qe.length=i)}let e;if(bi.randomAccessStructure&&kt[ut]<64&&kt[ut]>=32&&PI?(e=PI(kt,ut,ks,bi),kt=null,!(t&&t.lazy)&&e&&(e=e.toJSON()),ut=ks):e=vn(),_r&&(ut=_r.postBundlePosition,_r=null),el&&(Qe.restoreStructures=null),ut==ks)Qe&&Qe.restoreStructures&&MI(),Qe=null,kt=null,tl&&(tl=null);else{if(ut>ks)throw new Error("Unexpected end of MessagePack data");if(!el){let i;try{i=JSON.stringify(e,(n,r)=>typeof r=="bigint"?`${r}n`:r).slice(0,100)}catch(n){i="(JSON view not available "+n+")"}throw new Error("Data read, but end of buffer not reached "+i)}}return e}catch(e){throw Qe&&Qe.restoreStructures&&MI(),aA(),(e instanceof RangeError||e.message.startsWith("Unexpected end of buffer")||ut>ks)&&(e.incomplete=!0),e}}function MI(){for(let t in Qe.restoreStructures)Qe[t]=Qe.restoreStructures[t];Qe.restoreStructures=null}function vn(){let t=kt[ut++];if(t<160){if(t<128){if(t<64)return t;{let e=Qe[63&t]||bi.getStructures&&dN()[63&t];return e?(e.read||(e.read=sA(e,63&t)),e.read()):t}}if(t<144){if(t-=128,bi.mapsAsObjects){let e={};for(let i=0;i<t;i++){let n=pN();n==="__proto__"&&(n="__proto_"),e[n]=vn()}return e}{let e=new Map;for(let i=0;i<t;i++)e.set(vn(),vn());return e}}{t-=144;let e=new Array(t);for(let i=0;i<t;i++)e[i]=vn();return bi.freezeData?Object.freeze(e):e}}if(t<192){let e=t-160;if(pa>=ut)return Jl.slice(ut-ms,(ut+=e)-ms);if(pa==0&&ks<140){let i=e<16?KC(e):uN(e);if(i!=null)return i}return W_(e)}{let e;switch(t){case 192:return null;case 193:return _r?(e=vn(),e>0?_r[1].slice(_r.position1,_r.position1+=e):_r[0].slice(_r.position0,_r.position0-=e)):gN;case 194:return!1;case 195:return!0;case 196:if(e=kt[ut++],e===void 0)throw new Error("Unexpected end of buffer");return yS(e);case 197:return e=He.getUint16(ut),ut+=2,yS(e);case 198:return e=He.getUint32(ut),ut+=4,yS(e);case 199:return Kh(kt[ut++]);case 200:return e=He.getUint16(ut),ut+=2,Kh(e);case 201:return e=He.getUint32(ut),ut+=4,Kh(e);case 202:if(e=He.getFloat32(ut),bi.useFloat32>2){let i=uA[(127&kt[ut])<<1|kt[ut+1]>>7];return ut+=4,(i*e+(e>0?.5:-.5)|0)/i}return ut+=4,e;case 203:return e=He.getFloat64(ut),ut+=8,e;case 204:return kt[ut++];case 205:return e=He.getUint16(ut),ut+=2,e;case 206:return e=He.getUint32(ut),ut+=4,e;case 207:return bi.int64AsType==="number"?(e=4294967296*He.getUint32(ut),e+=He.getUint32(ut+4)):bi.int64AsType==="string"?e=He.getBigUint64(ut).toString():bi.int64AsType==="auto"?(e=He.getBigUint64(ut),e<=BigInt(2)<<BigInt(52)&&(e=Number(e))):e=He.getBigUint64(ut),ut+=8,e;case 208:return He.getInt8(ut++);case 209:return e=He.getInt16(ut),ut+=2,e;case 210:return e=He.getInt32(ut),ut+=4,e;case 211:return bi.int64AsType==="number"?(e=4294967296*He.getInt32(ut),e+=He.getUint32(ut+4)):bi.int64AsType==="string"?e=He.getBigInt64(ut).toString():bi.int64AsType==="auto"?(e=He.getBigInt64(ut),e>=BigInt(-2)<<BigInt(52)&&e<=BigInt(2)<<BigInt(52)&&(e=Number(e))):e=He.getBigInt64(ut),ut+=8,e;case 212:if(e=kt[ut++],e==114)return dA(63&kt[ut++]);{let i=gr[e];if(i)return i.read?(ut++,i.read(vn())):i.noBuffer?(ut++,i()):i(kt.subarray(ut,++ut));throw new Error("Unknown extension "+e)}case 213:return e=kt[ut],e==114?(ut++,dA(63&kt[ut++],kt[ut++])):Kh(2);case 214:return Kh(4);case 215:return Kh(8);case 216:return Kh(16);case 217:return e=kt[ut++],pa>=ut?Jl.slice(ut-ms,(ut+=e)-ms):yN(e);case 218:return e=He.getUint16(ut),pa>=(ut+=2)?Jl.slice(ut-ms,(ut+=e)-ms):_N(e);case 219:return e=He.getUint32(ut),pa>=(ut+=4)?Jl.slice(ut-ms,(ut+=e)-ms):bN(e);case 220:return e=He.getUint16(ut),ut+=2,EI(e);case 221:return e=He.getUint32(ut),ut+=4,EI(e);case 222:return e=He.getUint16(ut),ut+=2,AI(e);case 223:return e=He.getUint32(ut),ut+=4,AI(e);default:if(t>=224)return t-256;if(t===void 0){let i=new Error("Unexpected end of MessagePack data");throw i.incomplete=!0,i}throw new Error("Unknown MessagePack token "+t)}}}function sA(t,e){function i(){if(i.count++>lA){let r;try{r=t.read=new Function("r","return function(){return "+(bi.freezeData?"Object.freeze":"")+"({"+t.map(s=>s==="__proto__"?"__proto_:r()":vN.test(s)?s+":r()":"["+JSON.stringify(s)+"]:r()").join(",")+"})}")(vn)}catch{return lA=1/0,i()}return t.read0=r,t.highByte===0&&(t.read=hA(e,t.read)),r()}let n={};for(let r=0,s=t.length;r<s;r++){let a=t[r];a==="__proto__"&&(a="__proto_"),n[a]=vn()}return bi.freezeData?Object.freeze(n):n}return i.count=0,t.read0=i,t.highByte===0?hA(e,i):i}function dN(){let t=mN(()=>(kt=null,bi.getStructures()));return Qe=bi._mergeStructures(t,Qe)}function Um(t){let e;if(t<16&&(e=KC(t)))return e;if(t>64&&oA)return oA.decode(kt.subarray(ut,ut+=t));let i=ut+t,n=[];for(e="";ut<i;){let r=kt[ut++];if(128&r)if((224&r)==192){let s=(31&r)<<6|63&kt[ut++];s<128?n.push(65533):n.push(s)}else if((240&r)==224){let s=(31&r)<<12|(63&kt[ut++])<<6|63&kt[ut++];s<2048||s>=55296&&s<=57343?n.push(65533):n.push(s)}else if((248&r)==240){let s=(7&r)<<18|(63&kt[ut++])<<12|(63&kt[ut++])<<6|63&kt[ut++];s<65536||s>1114111?n.push(65533):(s>65535&&(s-=65536,n.push(s>>>10&1023|55296),s=56320|1023&s),n.push(s))}else n.push(65533);else n.push(r);n.length>=4096&&(e+=kn.apply(String,n),n.length=0)}return n.length>0&&(e+=kn.apply(String,n)),e}function EI(t){let e=new Array(t);for(let i=0;i<t;i++)e[i]=vn();return bi.freezeData?Object.freeze(e):e}function AI(t){if(bi.mapsAsObjects){let e={};for(let i=0;i<t;i++){let n=pN();n==="__proto__"&&(n="__proto_"),e[n]=vn()}return e}{let e=new Map;for(let i=0;i<t;i++)e.set(vn(),vn());return e}}function uN(t){let e=ut,i=new Array(t);for(let n=0;n<t;n++){let r=kt[ut++];if((128&r)>0)return void(ut=e);i[n]=r}return kn.apply(String,i)}function KC(t){if(t<4){if(t<2){if(t===0)return"";{let e=kt[ut++];return(128&e)>1?void(ut-=1):kn(e)}}{let e=kt[ut++],i=kt[ut++];if((128&e)>0||(128&i)>0)return void(ut-=2);if(t<3)return kn(e,i);let n=kt[ut++];return(128&n)>0?void(ut-=3):kn(e,i,n)}}{let e=kt[ut++],i=kt[ut++],n=kt[ut++],r=kt[ut++];if((128&e)>0||(128&i)>0||(128&n)>0||(128&r)>0)return void(ut-=4);if(t<6){if(t===4)return kn(e,i,n,r);{let s=kt[ut++];return(128&s)>0?void(ut-=5):kn(e,i,n,r,s)}}if(t<8){let s=kt[ut++],a=kt[ut++];if((128&s)>0||(128&a)>0)return void(ut-=6);if(t<7)return kn(e,i,n,r,s,a);let o=kt[ut++];return(128&o)>0?void(ut-=7):kn(e,i,n,r,s,a,o)}{let s=kt[ut++],a=kt[ut++],o=kt[ut++],l=kt[ut++];if((128&s)>0||(128&a)>0||(128&o)>0||(128&l)>0)return void(ut-=8);if(t<10){if(t===8)return kn(e,i,n,r,s,a,o,l);{let c=kt[ut++];return(128&c)>0?void(ut-=9):kn(e,i,n,r,s,a,o,l,c)}}if(t<12){let c=kt[ut++],h=kt[ut++];if((128&c)>0||(128&h)>0)return void(ut-=10);if(t<11)return kn(e,i,n,r,s,a,o,l,c,h);let d=kt[ut++];return(128&d)>0?void(ut-=11):kn(e,i,n,r,s,a,o,l,c,h,d)}{let c=kt[ut++],h=kt[ut++],d=kt[ut++],u=kt[ut++];if((128&c)>0||(128&h)>0||(128&d)>0||(128&u)>0)return void(ut-=12);if(t<14){if(t===12)return kn(e,i,n,r,s,a,o,l,c,h,d,u);{let p=kt[ut++];return(128&p)>0?void(ut-=13):kn(e,i,n,r,s,a,o,l,c,h,d,u,p)}}{let p=kt[ut++],f=kt[ut++];if((128&p)>0||(128&f)>0)return void(ut-=14);if(t<15)return kn(e,i,n,r,s,a,o,l,c,h,d,u,p,f);let g=kt[ut++];return(128&g)>0?void(ut-=15):kn(e,i,n,r,s,a,o,l,c,h,d,u,p,f,g)}}}}}function TI(){let t,e=kt[ut++];if(e<192)t=e-160;else switch(e){case 217:t=kt[ut++];break;case 218:t=He.getUint16(ut),ut+=2;break;case 219:t=He.getUint32(ut),ut+=4;break;default:throw new Error("Expected string")}return Um(t)}function yS(t){return bi.copyBuffers?Uint8Array.prototype.slice.call(kt,ut,ut+=t):kt.subarray(ut,ut+=t)}function Kh(t){let e=kt[ut++];if(gr[e]){let i;return gr[e](kt.subarray(ut,i=ut+=t),n=>{ut=n;try{return vn()}finally{ut=i}})}throw new Error("Unknown extension type "+e)}function pN(){let t=kt[ut++];if(!(t>=160&&t<192))return ut--,fN(vn());if(t-=160,pa>=ut)return Jl.slice(ut-ms,(ut+=t)-ms);if(!(pa==0&&ks<180))return W_(t);let e,i=4095&(t<<5^(t>1?He.getUint16(ut):t>0?kt[ut]:0)),n=cA[i],r=ut,s=ut+t-3,a=0;if(n&&n.bytes==t){for(;r<s;){if(e=He.getUint32(r),e!=n[a++]){r=1879048192;break}r+=4}for(s+=3;r<s;)if(e=kt[r++],e!=n[a++]){r=1879048192;break}if(r===s)return ut=r,n.string;s-=3,r=ut}for(n=[],cA[i]=n,n.bytes=t;r<s;)e=He.getUint32(r),n.push(e),r+=4;for(s+=3;r<s;)e=kt[r++],n.push(e);let o=t<16?KC(t):uN(t);return n.string=o??W_(t)}function fN(t){if(typeof t=="string")return t;if(typeof t=="number"||typeof t=="boolean"||typeof t=="bigint")return t.toString();if(t==null)return t+"";if(bi.allowArraysInMapKeys&&Array.isArray(t)&&t.flat().every(e=>["string","number","boolean","bigint"].includes(typeof e)))return t.flat().toString();throw new Error("Invalid property type for record: "+typeof t)}function mN(t){DI&&DI();let e=ks,i=ut,n=H_,r=ms,s=pa,a=Jl,o=G_,l=tl,c=_r,h=new Uint8Array(kt.slice(0,ks)),d=Qe,u=Qe.slice(0,Qe.length),p=bi,f=el,g=t();return ks=e,ut=i,H_=n,ms=r,pa=s,Jl=a,G_=o,tl=l,_r=c,kt=h,el=f,(Qe=d).splice(0,Qe.length,...u),bi=p,He=new DataView(kt.buffer,kt.byteOffset,kt.byteLength),g}function aA(){kt=null,tl=null,Qe=null}function j$(t){t.unpack?gr[t.type]=t.unpack:gr[t.type]=t}var oA,kt,ks,ut,CI,G_,H_,bi,Qe,Jl,ms,pa,_r,tl,gr,He,_S,gN,el,lA,PI,DI,zm,vN,hA,W_,yN,_N,bN,kn,cA,dA,bS,RI,II,OI,uA,xv,LI,BI,UI,pA,xS,jg,G$=z(()=>{try{oA=new TextDecoder}catch{}ut=0,G_=CI=[],H_=0,bi={},ms=0,pa=0,gr=[],_S={useRecords:!1,mapsAsObjects:!0},(gN=new class{}).name="MessagePack 0xC1",el=!1,lA=2,zm=class{constructor(t){t&&(t.useRecords===!1&&t.mapsAsObjects===void 0&&(t.mapsAsObjects=!0),t.sequential&&t.trusted!==!1&&(t.trusted=!0,!t.structures&&t.useRecords!=0&&(t.structures=[],t.maxSharedStructures||(t.maxSharedStructures=0))),t.structures?t.structures.sharedLength=t.structures.length:t.getStructures&&((t.structures=[]).uninitialized=!0,t.structures.sharedLength=0),t.int64AsNumber&&(t.int64AsType="number")),Object.assign(this,t)}unpack(t,e){if(kt)return mN(()=>(aA(),this?this.unpack(t,e):zm.prototype.unpack.call(_S,t,e)));!t.buffer&&t.constructor===ArrayBuffer&&(t=typeof Buffer<"u"?Buffer.from(t):new Uint8Array(t)),typeof e=="object"?(ks=e.end||t.length,ut=e.start||0):(ut=0,ks=e>-1?e:t.length),H_=0,pa=0,Jl=null,G_=CI,_r=null,kt=t;try{He=t.dataView||(t.dataView=new DataView(t.buffer,t.byteOffset,t.byteLength))}catch(i){throw kt=null,t instanceof Uint8Array?i:new Error("Source must be a Uint8Array or Buffer but was a "+(t&&typeof t=="object"?t.constructor.name:typeof t))}if(this instanceof zm){if(bi=this,this.structures)return Qe=this.structures,bv(e);(!Qe||Qe.length>0)&&(Qe=[])}else bi=_S,(!Qe||Qe.length>0)&&(Qe=[]);return bv(e)}unpackMultiple(t,e){let i,n=0;try{el=!0;let r=t.length,s=this?this.unpack(t,r):xv.unpack(t,r);if(!e){for(i=[s];ut<r;)n=ut,i.push(bv());return i}if(e(s,n,ut)===!1)return;for(;ut<r;)if(n=ut,e(bv(),n,ut)===!1)return}catch(r){throw r.lastPosition=n,r.values=i,r}finally{el=!1,aA()}}_mergeStructures(t,e){t=t||[],Object.isFrozen(t)&&(t=t.map(i=>i.slice(0)));for(let i=0,n=t.length;i<n;i++){let r=t[i];r&&(r.isShared=!0,i>=32&&(r.highByte=i-32>>5))}t.sharedLength=t.length;for(let i in e||[])if(i>=0){let n=t[i],r=e[i];r&&(n&&((t.restoreStructures||(t.restoreStructures=[]))[i]=n),t[i]=r)}return this.structures=t}decode(t,e){return this.unpack(t,e)}},vN=/^[a-zA-Z_$][a-zA-Z\d_$]*$/,hA=(t,e)=>function(){let i=kt[ut++];if(i===0)return e();let n=t<32?-(t+(i<<5)):t+(i<<5),r=Qe[n]||dN()[n];if(!r)throw new Error("Record id is not defined for "+n);return r.read||(r.read=sA(r,t)),r.read()},W_=Um,yN=Um,_N=Um,bN=Um,kn=String.fromCharCode,cA=new Array(4096),dA=(t,e)=>{let i=vn().map(fN),n=t;e!==void 0&&(t=t<32?-((e<<5)+t):(e<<5)+t,i.highByte=e);let r=Qe[t];return r&&(r.isShared||el)&&((Qe.restoreStructures||(Qe.restoreStructures=[]))[t]=r),Qe[t]=i,i.read=sA(i,n),(i.read0||i.read)()},gr[0]=()=>{},gr[0].noBuffer=!0,gr[66]=t=>{let e=t.byteLength%8||8,i=BigInt(128&t[0]?t[0]-256:t[0]);for(let n=1;n<e;n++)i<<=BigInt(8),i+=BigInt(t[n]);if(t.byteLength!==e){let n=new DataView(t.buffer,t.byteOffset,t.byteLength),r=(s,a)=>{let o=a-s;if(o<=40){let d=n.getBigUint64(s);for(let u=s+8;u<a;u+=8)d<<=BigInt(64),d|=n.getBigUint64(u);return d}let l=s+(o>>4<<3),c=r(s,l),h=r(l,a);return c<<BigInt(8*(a-l))|h};i=i<<BigInt(8*(n.byteLength-e))|r(e,n.byteLength)}return i},bS={Error,EvalError,RangeError,ReferenceError,SyntaxError,TypeError,URIError,AggregateError:typeof AggregateError=="function"?AggregateError:null},gr[101]=()=>{let t=vn();if(!bS[t[0]]){let e=Error(t[1],{cause:t[2]});return e.name=t[0],e}return bS[t[0]](t[1],{cause:t[2]})},gr[105]=t=>{if(bi.structuredClone===!1)throw new Error("Structured clone extension is disabled");let e=He.getUint32(ut-4);tl||(tl=new Map);let i,n=kt[ut];i=n>=144&&n<160||n==220||n==221?[]:n>=128&&n<144||n==222||n==223?new Map:(n>=199&&n<=201||n>=212&&n<=216)&&kt[ut+1]===115?new Set:{};let r={target:i};tl.set(e,r);let s=vn();if(!r.used)return r.target=s;if(Object.assign(i,s),i instanceof Map)for(let[a,o]of s.entries())i.set(a,o);if(i instanceof Set)for(let a of Array.from(s))i.add(a);return i},gr[112]=t=>{if(bi.structuredClone===!1)throw new Error("Structured clone extension is disabled");let e=He.getUint32(ut-4),i=tl.get(e);return i.used=!0,i.target},gr[115]=()=>new Set(vn()),RI=["Int8","Uint8","Uint8Clamped","Int16","Uint16","Int32","Uint32","Float32","Float64","BigInt64","BigUint64"].map(t=>t+"Array"),II=typeof globalThis=="object"?globalThis:window,gr[116]=t=>{let e=t[0],i=Uint8Array.prototype.slice.call(t,1).buffer,n=RI[e];if(!n){if(e===16)return i;if(e===17)return new DataView(i);throw new Error("Could not find typed array for code "+e)}return new II[n](i)},gr[120]=()=>{let t=vn();return new RegExp(t[0],t[1])},OI=[],gr[98]=t=>{let e=(t[0]<<24)+(t[1]<<16)+(t[2]<<8)+t[3],i=ut;return ut+=e-t.length,_r=OI,(_r=[TI(),TI()]).position0=0,_r.position1=0,_r.postBundlePosition=ut,ut=i,vn()},gr[255]=t=>t.length==4?new Date(1e3*(16777216*t[0]+(t[1]<<16)+(t[2]<<8)+t[3])):t.length==8?new Date(((t[0]<<22)+(t[1]<<14)+(t[2]<<6)+(t[3]>>2))/1e6+1e3*(4294967296*(3&t[3])+16777216*t[4]+(t[5]<<16)+(t[6]<<8)+t[7])):t.length==12?new Date(((t[0]<<24)+(t[1]<<16)+(t[2]<<8)+t[3])/1e6+1e3*((128&t[4]?-281474976710656:0)+1099511627776*t[6]+4294967296*t[7]+16777216*t[8]+(t[9]<<16)+(t[10]<<8)+t[11])):new Date("invalid"),uA=new Array(147);for(let t=0;t<256;t++)uA[t]=+("1e"+Math.floor(45.15-.30103*t));(xv=new zm({useRecords:!1})).unpack,xv.unpackMultiple,xv.unpack,LI=new Float32Array(1),new Uint8Array(LI.buffer,0,4)}),H$=z(()=>{G$(),qC(),sx(),td(),rx(),Jc(),BI=[{Class:te.prototype.constructor,type:1,write:t=>({...t}),read:t=>(Object.setPrototypeOf(t,te.prototype),t)},{Class:Vt.prototype.constructor,type:2,write:t=>[...t],read:t=>(Object.setPrototypeOf(t,Vt.prototype),t)},{Class:Xn.prototype.constructor,type:3,write:t=>[...t],read:t=>(Object.setPrototypeOf(t,Xn.prototype),t)},{Class:k_.prototype.constructor,type:4,write:t=>t.id,read:t=>new k_(t)},{Class:iA.prototype.constructor,type:5,write:t=>t.data,read:t=>new iA(t)},{Class:$i.prototype.constructor,type:6,write:t=>({...t}),read:t=>(Object.setPrototypeOf(t,$i.prototype),t)}];for(let t of BI)j$(t);UI=new zm({structuredClone:!0}),(pA||(pA={})).deserialize=function(t){return UI.unpack(t)}}),W$=z(()=>{H$(),xS=t=>()=>{throw new Error(t+" is not available in the runtime build (decode-only CollabSerialize)")},jg={deserialize:pA.deserialize,serialize:xS("CollabSerialize.serialize"),checksum:xS("CollabSerialize.checksum")}}),Ye=z(()=>{lx(),z$(),XC(),Jc(),rx(),$C(),td(),N$(),k$(),cN(),V$(),qC(),W$(),sN(),sx()});function fA(t){return t==="MouseDown"||t==="MouseUp"||t==="KeyDown"||t==="KeyUp"||t==="Collision"||t==="Trigger"}var zI,mA,dg,wv,wS,FI,NI,kI,gA,vA,VI,jI,GI,HI,WI,yA,_A,qI,XI,$I,YI,xN=z(()=>{var t,e,i;Ye(),tt(),(t=zI||(zI={})).toEventUIType=function(n){return n.type==="Conditional"?n.condition.type==="Distance"?"Distance":"StateChange":n.type},t.fromEventUIType=function(n){return n==="Distance"||n==="StateChange"?"Conditional":n},mA={LookAt:[],Follow:["Create"],DragDrop:["Transition","Animation","Audio","Particles","Create","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],MouseHover:["Transition","Animation","TimelineAnimation","Particles","Create","Destroy","SwitchCamera","SceneTransition","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],Scroll:["Transition","Animation","TimelineAnimation","Create","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],Start:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],Conditional:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],MouseDown:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],MouseUp:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],MousePress:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Link","Create","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],KeyDown:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],KeyUp:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],KeyPress:["Transition","Animation","Audio","Particles","Video","Link","Create","SwitchCamera","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],GameControl:["Transition","Animation","TimelineAnimation","Audio","Particles","Create","Conditional"],Collision:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Create","Destroy","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],Trigger:["Transition","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],Resize:["Transition","Animation","Audio","Particles","Video","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],VariableChange:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],API:["Transition","Animation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],WEBHOOK:["Transition","Animation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],AIAssistantListener:["SetVariable"],AIAssistantTrigger:["Transition","Animation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"]},(n=>{n.is=function(r){return r.type==="MouseDown"||r.type==="MouseUp"||r.type==="MousePress"||r.type==="KeyDown"||r.type==="KeyUp"||r.type==="KeyPress"},n.defaultData=function(r){return r==="MouseDown"||r==="MouseUp"||r==="MousePress"?{type:r,mode:"Object",disabled:!1,name:"",actions:new Vt}:{type:r,disabled:!1,name:"",key:void 0,actions:new Vt}}})(dg||(dg={})),(n=>{n.propertyDefaultData=function(r){return{type:"Property",value:[r??null,"position","x"]}},n.valueDefaultData={type:"Literal",value:0}})(wv||(wv={})),(e=wS||(wS={})).comparisonDefaultData=function(n){return{type:"Comparison",operator:"==",lOperand:wv.propertyDefaultData(n),rOperand:{...wv.valueDefaultData}}},e.distanceDefaultData=function(n){return{type:"Distance",toObject:n??null,fromObject:n??null,distance:200}},e.stateDefaultData=function(n,r){return{type:"State",object:n??null,state:r??null}},(FI||(FI={})).isConditionalSubActions=function(n){return n.find(r=>r==="ifActions"||r==="elseActions")!==void 0},(n=>{n.is=function(r){return r.type==="Conditional"},n.defaultData=function(r){return{type:"Conditional",disabled:!1,name:"",inActions:new Vt,outActions:new Vt,condition:wS.distanceDefaultData(r)}}})(NI||(NI={})),(kI||(kI={})).defaultData={type:"DragDrop",name:"",cursor:"hand",disabled:!1,dampingFactor:1,objects:[],snapTo:"center",snapSurfaceMode:"bbox",snapSurfaceOffset:0,dropOn:"all",autoOrient:!0,dropDestinations:[],plane:"adaptive",planeMode:"locked",referenceFrame:"global",limits:[-1/0,1/0,-1/0,1/0,-1/0,1/0],drop:!1,resetOnSnapFail:!1,snapSpeed:20,resetSpeed:20,dragDropActions:{drag:new Vt,drop:new Vt}},(gA||(gA={})).defaultData={type:"Follow",disabled:!1,name:"",maxDelta:0,dampingFactor:1,target:"cursor",plane:"custom",resetOnPointerLeave:!0,resetAfterDistanceLimit:!0,enabledTranslation:[!0,!0,!0],limitDistanceEnabled:!1,limitDistance:1e3,snapDelay:0,resetSpeed:5,actions:new Vt},(vA||(vA={})).defaultData={type:"LookAt",disabled:!1,name:"",distance:1e3,dampingFactor:1,target:"cursor",tilt:"up",axis:"z",plane:"custom",resetOnPointerLeave:!0,resetAfterDistanceLimit:!0,enabledRotation:[!0,!0,!0],limitDistanceEnabled:!1,limitDistance:1e3,snapDelay:0,resetSpeed:5},(n=>{n.is=function(r){return r.type==="MouseHover"},n.defaultData=function(){return{type:"MouseHover",disabled:!1,name:"",actions:new Vt}}})(VI||(VI={})),(n=>{n.is=function(r){return r.type==="Scroll"},n.defaultData=function(){return{type:"Scroll",disabled:!1,name:"",steps:100,trigger:"load",startFrom:"enter",enterAnchor:"top",startOffset:0,endAfter:400,actions:new Vt}}})(jI||(jI={})),(n=>{n.is=function(r){return r.type==="Start"},n.defaultData=function(){return{type:"Start",disabled:!1,name:"",actions:new Vt}}})(GI||(GI={})),(n=>{n.is=function(r){return r.type==="Collision"},n.defaultData=function(){return{type:"Collision",disabled:!1,name:"",target:"character",actions:new Vt}}})(HI||(HI={})),(n=>{n.is=function(r){return r.type==="Trigger"},n.defaultData=function(r,s){return{type:"Trigger",name:"",disabled:!1,target:"all",triggeringObjects:[],actions:new Vt,triggerZone:"box",position:s.toArray(),rotation:[0,0,0],size:r.toArray(),radius:r.length()/2,helperVisible:!0}}})(WI||(WI={})),(i=yA||(yA={})).defaultSizes={mobile:[480,480],tablet:[768,768],desktop:[1200,1200],custom:[769,1200]},i.is=function(n){return n.type==="Resize"},i.sizeToDevice=function(n){return typeof n=="string"?n:"custom"},i.deviceToSize=function(n){return typeof n=="string"?[...i.defaultSizes[n]]:[...n]},i.defaultData=function(){let n={size:"mobile",operator:"<",actions:new Vt},r={size:"tablet",operator:"<",actions:new Vt},s={size:[...i.defaultSizes.custom],operator:"<>",actions:new Vt},a=new Vt;return a.push({id:Ot.generateUUID(),fi:0,data:n},{id:Ot.generateUUID(),fi:1,data:r},{id:Ot.generateUUID(),fi:2,data:s}),{type:"Resize",disabled:!1,name:"",orientation:"horizontal",breakpoints:a}},i.defaultBreakpointData=function(){return{size:[...i.defaultSizes.custom],operator:"<>",actions:new Vt}},(n=>{n.propertyPaths={Position:["position"],"Position X":["position","x"],"Position Y":["position","y"],"Position Z":["position","z"],Rotation:["rotation"],"Rotation X":["rotation","x"],"Rotation Y":["rotation","y"],"Rotation Z":["rotation","z"],Scale:["scale"],"Scale X":["scale","x"],"Scale Y":["scale","y"],"Scale Z":["scale","z"],Width:["width"],Height:["height"],Depth:["depth"],"Mouse Position X":["mouse","x"],"Mouse Position Y":["mouse","y"],"Mouse Pressed":["mouse","pressed"],"Screen Width":["mouse","width"],"Screen Height":["mouse","height"],"Hit Position X":["raycast","x"],"Hit Position Y":["raycast","y"],"Hit Position Z":["raycast","z"],"Hit Object Position X":["raycast","objX"],"Hit Object Position Y":["raycast","objY"],"Hit Object Position Z":["raycast","objZ"]},n.is=function(r){return r.type==="VariableChange"},n.defaultData=function(){return{disabled:!1,type:"VariableChange",name:"",actions:new Vt,variableId:"",objectId:null,property:"Position X"}}})(_A||(_A={})),(n=>{n.is=function(r){return r.type==="API"},n.defaultData=function(){return{disabled:!1,type:"API",name:"",successActions:new Vt,errorActions:new Vt,userAPIId:""}}})(qI||(qI={})),(n=>{n.is=function(r){return r.type==="WEBHOOK"},n.defaultData=function(){return{disabled:!1,type:"WEBHOOK",name:"",actions:new Vt,userWebhookId:""}}})(XI||(XI={})),(n=>{n.is=function(r){return r.type==="AIAssistantListener"},n.defaultData=function(){return{disabled:!1,type:"AIAssistantListener",name:"",actions:new Vt,analysis:"average",analysisRange:[0,71],analysisSingle:0}}})($I||($I={})),(n=>{n.is=function(r){return r.type==="AIAssistantTrigger"},n.defaultData=function(){return{disabled:!1,description:"",name:"",type:"AIAssistantTrigger",actions:new Vt}}})(YI||(YI={}))});function ZI(t){let e=typeof t;return t!==null&&(e==="object"||e==="function")}function KI(t){return typeof t=="string"&&t.length===36&&/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(t)}var ed,Yu,wN,Ir,QI,to,dh,Gg,JI,Zu,Tn,Je,bA,tO,th,mp,eO,iO,nO,rO,sO,aO,oO,lO,SS,hO,cO,MS,dO,uO,pO,ES,fO,AS,mO,gO,TS,vO,xA,yO,_O,bO,xO,wO,SO,Xc,il,eh,wA,SA,q_,X_,$_,Y_,Z_,MA,EA,K_,AA,Ku,MO,CS,PS,TA,EO,Q_,AO,TO,J_,CO,PO,DO,RO,IO,OO,LO,BO,UO,hx,QC,tn,Vi,Au,SN,Hg,tb,wc,CA,JC,eb,ib,PA,Yo,T1,ir,DS,ql,nb,ug,RS,IS,OS,Qu,LS,DA,RA,zO,zd,MN,An,rb,FO,NO,kO,VO,Wa,pg,sb,ab,nl,zc,jO,ih,ob,rl,BS,US,Mc,$c,Ec,fg,IA,GO,br,zS,HO,WO,Zo,Ns,Ju,OA,bs=z(()=>{var t,e,i,n,r,s,a,o;ed="personal camera",Yu="a218fcc3-276b-49b9-b485-49037fd14f5f",wN=2500134,Ir=5526619,(t=QI||{}).x="x",t.y="y",t.z="z",QI=t,(l=>{function c(u,p){return Math.pow(p[0]-u[0],2)+Math.pow(p[1]-u[1],2)}function h(u,p){return Math.sqrt(c(u,p))}function d(u,p,f){let g=l.sub(p,u),m=l.sub(f,u),v=l.dot(g,m)/l.dot(g,g),y=l.scalarMultiply(g,v);return l.add(u,y)}l.isEqual=function(u,p){return u[0]===p[0]&&u[1]===p[1]},l.lerp=function(u,p,f){return[u[0]+(p[0]-u[0])*f,u[1]+(p[1]-u[1])*f]},l.add=function(u,p){return[u[0]+p[0],u[1]+p[1]]},l.sub=function(u,p){return[u[0]-p[0],u[1]-p[1]]},l.multiply=function(u,p){return[u[0]*p[0],u[1]*p[1]]},l.divide=function(u,p){return[u[0]/p[0],u[1]/p[1]]},l.distanceSquared=c,l.distance=h,l.dot=function(u,p){return u[0]*p[0]+u[1]*p[1]},l.scalarMultiply=function(u,p){return[u[0]*p,u[1]*p]},l.projectionOnto=d,l.projectionOntoDistance=function(u,p,f){return h(u,d(u,p,f))},l.center=function(u,p){return[.5*(u[0]+p[0]),.5*(u[1]+p[1])]}})(to||(to={})),(e=dh||(dh={})).isEqual=function(l,c){return l[0]===c[0]&&l[1]===c[1]&&l[2]===c[2]},e.add=function(l,c){return[l[0]+c[0],l[1]+c[1],l[2]+c[2]]},e.sub=function(l,c){return[l[0]-c[0],l[1]-c[1],l[2]-c[2]]},e.div=function(l,c){return[l[0]/c[0],l[1]/c[1],l[2]/c[2]]},e.mul=function(l,c){return[l[0]*c[0],l[1]*c[1],l[2]*c[2]]},e.dist=function(l,c){return Math.hypot(l[0]-c[0],l[1]-c[1],l[2]-c[2])},e.lerp=function(l,c,h){return[l[0]+(c[0]-l[0])*h,l[1]+(c[1]-l[1])*h,l[2]+(c[2]-l[2])*h]},(i=Gg||(Gg={})).isEqual=function(l,c){return l[0]===c[0]&&l[1]===c[1]&&l[2]===c[2]&&l[3]===c[3]},i.lerp=function(l,c,h){return[l[0]+(c[0]-l[0])*h,l[1]+(c[1]-l[1])*h,l[2]+(c[2]-l[2])*h,l[3]+(c[3]-l[3])*h]},(l=>{let c=180/Math.PI,h=Math.PI/180;function d(p){return typeof p=="number"?p*c:p}function u(p){return typeof p=="number"?p*h:p}l.radToDeg=function(p){return[d(p[0]),d(p[1]),d(p[2])]},l.degToRad=function(p){return[u(p[0]),u(p[1]),u(p[2])]}})(JI||(JI={})),(n=Zu||(Zu={})).identity=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],n.isEqual=function(l,c){for(let h=0;h<16;h++)if(l[h]!==c[h])return!1;return!0},n.simplify=function(l){return l??n.identity},n.applyMatrix4=function(l,c){let h=c.slice(0);for(let d=0,u=c.length;d<u;d+=3){let p=l[3]*c[d]+l[7]*c[d+1]+l[11]*c[d+2]+l[15];h[d]=(l[0]*c[d]+l[4]*c[d+1]+l[8]*c[d+2]+l[12])/p,h[d+1]=(l[1]*c[d]+l[5]*c[d+1]+l[9]*c[d+2]+l[13])/p,h[d+2]=(l[2]*c[d]+l[6]*c[d+1]+l[10]*c[d+2]+l[14])/p}return h},(r=Tn||(Tn={})).isRGB=function(l){return typeof l=="object"&&typeof l.r=="number"&&typeof l.g=="number"&&typeof l.b=="number"},r.white={r:1,g:1,b:1},r.red={r:1,g:0,b:0},r.black={r:0,g:0,b:0},r.toRgb255a1=function(l){return{r:Math.round(255*l.r),g:Math.round(255*l.g),b:Math.round(255*l.b),a:1}},r.clone=function(l){return{r:l.r,g:l.g,b:l.b}},r.fromHex=function(l){return{r:((l=Math.floor(l))>>16&255)/255,g:(l>>8&255)/255,b:(255&l)/255}},r.toHex=function(l){return 65536*Math.round(255*l.r)+256*Math.round(255*l.g)+Math.round(255*l.b)},r.equals=function(l,c){return l.r===c.r&&l.g===c.g&&l.b===c.b},r.equalsFixed=function(l,c){return l.r.toFixed(2)===c.r.toFixed(2)&&l.g.toFixed(2)===c.g.toFixed(2)&&l.b.toFixed(2)===c.b.toFixed(2)},r.lerp=function(l,c,h){return{r:l.r+(c.r-l.r)*h,g:l.g+(c.g-l.g)*h,b:l.b+(c.b-l.b)*h}},r.is=function(l){return!!ZI(l)&&"r"in l&&"g"in l&&"b"in l&&!("a"in l)},(s=Je||(Je={})).white={...Tn.white,a:1},s.is=function(l){return!!ZI(l)&&"r"in l&&"g"in l&&"b"in l&&"a"in l},s.transparent={...Tn.white,a:0},s.from0to1=function(l){return{r:l[0],g:l[1],b:l[2],a:l[3]}},s.fromHexAndA=function(l,c){return{...Tn.fromHex(l),a:c}},s.toRgb255a1=function(l){return{r:Math.round(255*l.r),g:Math.round(255*l.g),b:Math.round(255*l.b),a:l.a}},s.equals=function(l,c){return Tn.equals(l,c)&&l.a===c.a},s.equalsFixed=function(l,c){return Tn.equalsFixed(l,c)&&l.a.toFixed(2)===c.a.toFixed(2)},s.lerp=function(l,c,h){return{r:l.r+(c.r-l.r)*h,g:l.g+(c.g-l.g)*h,b:l.b+(c.b-l.b)*h,a:l.a+(c.a-l.a)*h}},s.toStyle=function({r:l,g:c,b:h,a:d}=s.white){return`rgba(${255*l}, ${255*c}, ${255*h}, ${d})`},(bA||(bA={})).identity={position:[0,0,0],rotation:[0,0,0],scale:[1,1,1],pivot:[0,0,0],pivotRotation:[0,0,0]},(a=tO||{})[a.LINEAR=0]="LINEAR",a[a.EASE=1]="EASE",a[a.EASE_IN=2]="EASE_IN",a[a.EASE_OUT=3]="EASE_OUT",a[a.EASE_IN_OUT=4]="EASE_IN_OUT",a[a.CUBIC=5]="CUBIC",a[a.SPRING=6]="SPRING",a[a.ARC=7]="ARC",a[a.NONE=8]="NONE",tO=a,(th||(th={})).defaultData={mass:1,stiffness:80,damping:10,velocity:0},(mp||(mp={})).defaultData={control1:[.5,0],control2:[.5,1]},(o=eO||(eO={})).linear=[0,0,1,1],o.ease=[.25,.1,.25,1],o.easeIn=[.42,0,1,1],o.easeOut=[0,0,.58,1],o.easeInOut=[.42,0,.58,1]}),q$=z(()=>{var t,e;Ye(),xN(),(iO||(iO={})).defaultData={type:"SwitchCamera",name:"",targetCamera:"",delay:0,animate:!0,duration:1e3,easing:4,runMode:"Normal"},(nO||(nO={})).defaultData={type:"SceneTransition",name:"",target:"",delay:0,duration:1,transition:"none"},(rO||(rO={})).defaultData={type:"Link",name:"",url:null,context:"tab"},(sO||(sO={})).defaultData={type:"Destroy",name:"",objects:[],delay:0},(aO||(aO={})).defaultData={type:"Particles",name:"",emitterObjectId:"",delay:0,emission:"start",triggerAfter:"any"},(oO||(oO={})).defaultData={type:"Create",name:"",object:"",delay:0,creationSpeed:10,coordinateSystem:"world",dynamic:!0,destroy:"No",destroyAfterQuantity:5,lifetime:2,position:[0,0,0],rotation:[0,0,0],velocity:[1e3,0,0],hideBase:"No"},(lO||(lO={})).defaultData={type:"Reset",name:"",delay:0},(SS||(SS={})).defaultData={interaction:"play",delay:0,volume:.5,loop:1},(t=hO||(hO={})).pauseDefaultData={interaction:"pause",delay:0},t.stopDefaultData={interaction:"stop",delay:0},(e=cO||(cO={})).defaultData={type:"Audio",name:"",...SS.defaultData},e.hasAudioByActions=i=>i.some(({data:n})=>n.type==="Audio"&&n.interaction==="play"&&n.audio),e.hasAudioByEvents=i=>e.getAudiosByEvents(i).length>0,e.getAudiosByActions=i=>{let n=[];return i.forEach(r=>{let s=r.data;s.type==="Audio"&&s.interaction==="play"&&s.audio&&n.push(r),s.type==="Conditional"&&(n.push(...e.getAudiosByActions(s.ifActions)),n.push(...e.getAudiosByActions(s.elseActions)))}),n},e.getAudiosByEvents=i=>{let n=[];return i.forEach(({data:r})=>{dg.is(r)||r.type==="Collision"||r.type==="Start"||r.type==="Trigger"||r.type==="VariableChange"||r.type==="WEBHOOK"||r.type==="AIAssistantTrigger"?n.push(...e.getAudiosByActions(r.actions)):r.type==="Conditional"?(n.push(...e.getAudiosByActions(r.inActions)),n.push(...e.getAudiosByActions(r.outActions))):r.type==="GameControl"?Object.values(r.gameActions).forEach(s=>{n.push(...e.getAudiosByActions(s))}):r.type==="DragDrop"?(n.push(...e.getAudiosByActions(r.dragDropActions.drag)),n.push(...e.getAudiosByActions(r.dragDropActions.drop))):r.type==="Resize"?r.breakpoints.forEach(({data:s})=>{n.push(...e.getAudiosByActions(s.actions))}):r.type==="API"&&(n.push(...e.getAudiosByActions(r.successActions)),n.push(...e.getAudiosByActions(r.errorActions)))}),n},(MS||(MS={})).defaultData={interaction:"play",delay:0,volume:.5,loop:1/0},(i=>{i.pauseDefaultData={interaction:"pause",delay:0},i.stopDefaultData={interaction:"stop",delay:0}})(dO||(dO={})),(i=>{i.defaultData={type:"Video",name:"",triggerAfter:"autoplay",...MS.defaultData},i.hasVideoByActions=n=>n.some(({data:r})=>r.type==="Video"&&r.interaction==="play"&&r.layerId),i.hasVideoByObject=n=>{if(n.events){for(let{data:r}of n.events)if((dg.is(r)||r.type==="Start")&&i.hasVideoByActions(r.actions))return!0}},i.getVideosByActions=n=>{let r=[];return n.forEach(s=>{let a=s.data;a.type==="Video"&&a.interaction==="play"&&a.layerId&&r.push(s)}),r},i.getVideosByEvents=n=>{let r=[];return n.forEach(({data:s})=>{(dg.is(s)||s.type==="Start")&&r.push(...i.getVideosByActions(s.actions))}),r}})(uO||(uO={})),(pO||(pO={})).defaultData=function(i){return{state:i,repeat:0,delay:0,delayDirection:"start-once",direction:"normal",duration:1e3,easing:4}},(ES||(ES={})).defaultData=function(){return{tweens:new Vt,repeat:0,delay:0,delayDirection:"start-once",direction:"normal"}},(fO||(fO={})).defaultData=function(i){return{type:"Transition",name:"",runMode:"Once",object:i??null,...ES.defaultData()}},(AS||(AS={})).defaultData=function(i){return{interaction:"play",timeline:i,repeat:0,delay:0,delayDirection:"start-once",direction:"normal",runMode:"Once"}},(i=>{i.pauseDefaultData={interaction:"pause",delay:0},i.stopDefaultData={interaction:"stop",delay:0}})(mO||(mO={})),(gO||(gO={})).defaultData=function(i){return{type:"TimelineAnimation",name:"",...AS.defaultData(i)}},(TS||(TS={})).defaultData=function(i,n,r){return{interaction:"play",object:i,clipId:n,crop:r,crop2:r,repeat:-1,delay:0,delayDirection:"start-once",direction:"normal",runMode:"Normal"}},(i=>{i.pauseDefaultData={interaction:"pause",delay:0},i.stopDefaultData={interaction:"stop",delay:0}})(vO||(vO={})),(i=>{i.defaultData=function(n,r,s){return{type:"Animation",name:"",...TS.defaultData(n,r,s)}},i.isPause=function(n){return n.interaction==="pause"||n.interaction==="stop"}})(xA||(xA={})),(yO||(yO={})).defaultData={type:"SetVariable",name:"",variableId:"",expression:[]},(_O||(_O={})).defaultData=()=>({type:"Conditional",name:"",ifActions:new Vt,elseActions:new Vt,condition:[]}),(bO||(bO={})).defaultData={type:"DynamicVariablePlay",name:"",variableId:"",mode:"PlayPause",delay:0,pauseDelay:0},(xO||(xO={})).defaultData={type:"ClearLocalStorage",name:"",target:"all"},(wO||(wO={})).defaultData={name:"",type:"UserAPI"}}),X$=z(()=>{var t;(t=SO||(SO={})).emptyAudio={data:Uint8Array.from(atob("UklGRjIAAABXQVZFZm10IBIAAAABAAEAQB8AAEAfAAABAAgAAABmYWN0BAAAAAAAAABkYXRhAAAAAA=="),e=>e.charCodeAt(0)),mimeType:"audio/wav",filename:"unknown"},t.maxSize=2e6}),EN=z(()=>{var t;(t=Xc||(Xc={})).all=["PerspectiveCamera","OrthographicCamera"],t.is=function(e){return t.all.includes(e)},(e=>{e.DefaultUp=[0,1,0],e.DefaultTargetOffset=1e3,e.MinTargetOffset=.001,e.sanitizeTargetOffset=function(s){return s===void 0||!Number.isFinite(s)||s<e.MinTargetOffset?e.DefaultTargetOffset:s},e.DefaultAzimuth=-24,e.DefaultElevation=15;let i=e.DefaultAzimuth*Math.PI/180,n=e.DefaultElevation*Math.PI/180,r=180/Math.PI;e.DefaultPosition=[e.DefaultTargetOffset*Math.sin(i)*Math.cos(n),e.DefaultTargetOffset*Math.sin(n),e.DefaultTargetOffset*Math.cos(i)*Math.cos(n)],e.DefaultRotation=[Math.atan2(-Math.sin(n),Math.cos(i)*Math.cos(n))*r,Math.asin(Math.sin(i)*Math.cos(n))*r,Math.atan2(Math.sin(i)*Math.sin(n),Math.cos(i))*r],e.defaultData={far:1e5,type:"PerspectiveCamera",perspective:{near:70,fov:45,zoom:1},orthographic:{near:-1e5,zoom:1},up:e.DefaultUp,isUpVectorFlipped:!1,targetOffset:e.DefaultTargetOffset},e.getZoom=function(s){return s.type==="PerspectiveCamera"?s.perspective?.zoom??1:s.orthographic?.zoom??1}})(il||(il={}))}),AN=z(()=>{var t;(t=eh||(eh={})).defaultData=function(e,i=.1){return{disabled:!1,type:"linear",hideBase:!1,instanced:!1,count:3,radial:{radius:2*Math.max(typeof e[0]=="number"?e[0]:1,typeof e[1]=="number"?e[1]:1),start:0,end:360,alignment:!1,axis:"y",scale:[1,1,1],rotation:[0,0,0],position:[0,0,0],pivot:[0,0,0],pivotRotation:[0,0,0]},toObject:{object:"",spreadType:"random",scale:[0,0,0],rotation:[0,0,0],position:[0,0,0],axis:"x",seed:0,count:99,align:"normal",pivot:[0,0,0],pivotRotation:[0,0,0]},linear:{scale:[1,1,1],rotation:[0,0,0],position:[(typeof e[0]=="number"?e[0]+e[0]:1)*i,0,0],pivot:[0,0,0],pivotRotation:[0,0,0]},grid:{count:[2,2,2],size:e.map(n=>(typeof n=="number"?n:1)*(1+i)),useCenter:!0},randomness:!1,randomnessObject:{strength:100,scale:[0,0,0],rotation:[0,0,0],position:[0,0,0],movement:1,seed:0,freqScale:10,noiseType:"perlin"}}},t.merge=function(e,i){let n={...e};if(SA.forEach(r=>{Object.assign(n,{[r]:i[r]??e[r]})}),n.radial={...e.radial},i.radial){let r=e.radial,s=i.radial;q_.forEach(a=>{Object.assign(n.radial,{[a]:s[a]??r[a]})})}if(n.linear={...e.linear},i.linear){let r=e.linear,s=i.linear;X_.forEach(a=>{Object.assign(n.linear,{[a]:s[a]??r[a]})})}if(n.grid={...e.grid},i.grid){let r=e.grid,s=i.grid;$_.forEach(a=>{Object.assign(n.grid,{[a]:s[a]??r[a]})})}if(n.toObject={...e.toObject},i.toObject){let r=e.toObject,s=i.toObject;Y_.forEach(a=>{Object.assign(n.toObject,{[a]:s[a]??r[a]})})}if(n.randomnessObject={...e.randomnessObject},i.randomnessObject){let r=e.randomnessObject,s=i.randomnessObject;Z_.forEach(a=>{Object.assign(n.randomnessObject,{[a]:s[a]??r[a]})})}return n},t.isPartial=function(e){return!(!e.randomnessObject&&!e.toObject)},(e=>{e.defaultData={radial:{},linear:{},grid:{},toObject:{},randomnessObject:{}};let i=["radial","linear","grid","toObject","randomnessObject"];e.toOps=function(n,r){let s=[];n.count!==void 0&&s.push({type:0,path:r,props:{count:n.count}});for(let a of i){let o=n[a];o&&Object.keys(o).length>0&&s.push({type:0,path:[...r,a],props:o})}return s}})(wA||(wA={})),SA=["count"],q_=["radius","start","end","position","scale","rotation"],X_=["position","scale","rotation"],$_=["count","size"],Y_=["count","position","scale","rotation"],Z_=["strength","scale","rotation","position","movement","seed","freqScale"]}),TN=z(()=>{var t;bs(),(t=MA||(MA={})).all=["PointLight","SpotLight","DirectionalLight","HemisphereLight"],t.is=function(e){return t.all.includes(e)},(EA||(EA={})).defaultData=function(e){return function(i){if(i==="PointLight")return{type:i,color:Je.white,intensity:1,distance:2e3,decay:1,shadows:!0,shadowResolution:1024,shadowRadius:1,penumbraSize:.5,depth:1e5};if(i==="SpotLight")return{type:i,color:Je.white,intensity:1,distance:2e3,decay:1,shadows:!0,penumbra:0,angle:30/180*Math.PI,depth:1e5,penumbraSize:.5,shadowResolution:1024,shadowRadius:1};if(i==="DirectionalLight")return{type:i,color:Je.white,intensity:1,shadows:!0,size:2e3,depth:1e5,penumbraSize:.5,shadowResolution:1024,shadowRadius:1};throw new Error("not implemented")}(e)}}),CN=z(()=>{var t;(t=K_||(K_={})).defaultShapeData={type:"PlaneEmitterShape",size:[100,100,100]},t.defaultCollisionData={colliderEntityId:null,collisionBounce:.75},t.defaultData={renderMaterial:{type:"particleMaterial",color:{r:1,g:.2,b:.545,a:1},color2:{r:.945,g:.714,b:.184,a:1},coloring:"gradient",ease:"linearFadeOut",easeSize:"linearFadeOut",transparent:!0,size:[40,40],texture:"pt_default_particle",spriteRotation:[0,0]},birthRatePerSec:50,gravity:1,noiseStrength:0,noiseScale:0,noiseSeed:1,noiseType:"curl",randomRotation:0,randomScale:.2,randomMass:.5,rootObjectType:"instancedMesh",life:1,direction:[0,0,0],directionMode:"axis",speed:10,shape:t.defaultShapeData,autoPlay:!0,emitTimeDelay:0,emitTimeCycle:"infinity",emitTimeDuration:1,...t.defaultCollisionData}}),PN=z(()=>{var t;(t=AA||(AA={})).defaultData={gravity:10,damping:.03,localStiffness:.67,globalStiffness:.5,globalRange:.15,stiffnessFalloff:.1,windStrength:0,vspCoefficient:.01,elasticity:.15,hairLength:.75,tipSeparation:.8,kink:0,kinkFrequency:0,clumpStrength:0,clumpSize:32,clumpTipScale:1.5,spreadRadius:.03,guideStrands:8192,headShape:"sphere",baseObjectId:null,hairColorSource:"custom",hairShadeRoot:.6,hairShadeTip:1.15,hairRootColor:{r:.29,g:.102,b:.039,a:1},hairMidColor:{r:.8,g:.267,b:.133,a:1},hairTipColor:{r:.545,g:.18,b:.18,a:1},headColor:{r:.325,g:.137,b:.114,a:1},noiseEnabled:!1,noiseColorA:{r:.545,g:.184,b:.788,a:1},noiseColorB:{r:.914,g:.188,b:.914,a:1},noiseColorC:{r:.2,g:.4,b:1,a:1},noiseColorD:{r:.2,g:1,b:.6,a:1},noiseScale:1.8,noiseMixHair:.75,noiseMixHead:.8,castShadow:!0,receiveShadow:!0,hairWidth:1.75,specularPower:40,specularIntensity:.4,diffuseIntensity:.6,ambientIntensity:.25,opacity:1,tipFade:.4,autoPlay:!0},t.regenProps=["hairLength","spreadRadius","guideStrands","headShape","baseObjectId"]}),t3=z(()=>{(Ku||(Ku={})).defaultData={enabled:"visibility",fusedBody:!0,rigidBody:"positioned",density:1,pointMass:0,gravityScale:1,friction:.5,damping:0,restitution:.2,colliderType:"convex",enabledRotation:[!0,!0,!0],enabledTranslation:[!0,!0,!0]}}),DN=z(()=>{var t,e;(t=MO||{})[t.Front=0]="Front",t[t.Back=1]="Back",t[t.Double=2]="Double",MO=t,(e=CS||(CS={})).defaultData={castShadow:!0,receiveShadow:!0},e.equals=function(i,n){return i.castShadow===n.castShadow&&i.receiveShadow===n.receiveShadow},(i=>{i.defaultData={flatShading:!1,wireframe:!1,side:0},i.equals=function(n,r){return n.flatShading===r.flatShading&&n.side===r.side&&n.wireframe===r.wireframe&&(n.shadowCatcher??!1)===(r.shadowCatcher??!1)}})(PS||(PS={})),(TA||(TA={})).defaultData={...PS.defaultData,...CS.defaultData},(EO||(EO={})).getMaterialData=function(i,n){let r=[];if("material"in i){let s=typeof i.material=="string"?n.materials[i.material]??n.lib.materials[i.material]?.asset:i.material;s&&r.push(s)}else if("materials"in i)for(let s of i.materials){let a=typeof s=="string"?n.materials[s]??n.lib.materials[s]?.asset:s;a&&r.push(a)}return r}}),RN=z(()=>{var t;(t=Q_||(Q_={})).defaultVideo={data:"",thumb:"/_assets/_videos/catThumb.png",type:"video",name:"Cat video"},t.maxSize=3e7}),r0=z(()=>{var t,e,i,n;Ye(),bs(),RN(),bs(),(AO||(AO={})).is=function(r){return r==="texture"||r==="video"||r==="color"||r==="depth"||r==="normal"||r==="gradient"||r==="noise"||r==="fresnel"||r==="cavity"||r==="dust"||r==="rainbow"||r==="toon"||r==="outline"||r==="particle"||r==="transmission"||r==="reflection"||r==="matcap"||r==="displace"||r==="pattern"||r==="vertexColor"||r==="light"},(TO||(TO={})).is=function(r){return r==="luminance"||r==="r"||r==="g"||r==="b"||r==="a"},(J_||(J_={})).is=function(r){return typeof r=="object"&&r!==null&&r.image!=null},(CO||(CO={})).is=function(r){return r==="phong"||r==="toon"||r==="lambert"||r==="physical"},(n=PO||{})[n.Linear=0]="Linear",n[n.Radial=1]="Radial",n[n.Polar=2]="Polar",PO=n,DO=(r=>(r[r.RepeatWrapping=1e3]="RepeatWrapping",r[r.ClampToEdgeWrapping=1001]="ClampToEdgeWrapping",r[r.MirroredRepeatWrapping=1002]="MirroredRepeatWrapping",r))(DO||{}),RO=(r=>(r[r.NearestFilter=1003]="NearestFilter",r[r.LinearFilter=1006]="LinearFilter",r[r.LinearMipmapLinearFilter=1008]="LinearMipmapLinearFilter",r))(RO||{}),(i=IO||{})[i.UV=0]="UV",i[i.Planar=1]="Planar",i[i.Spherical=2]="Spherical",i[i.Cylindrical=3]="Cylindrical",i[i.Triplanar=4]="Triplanar",IO=i,(e=OO||{})[e.Simplex=0]="Simplex",e[e.SimplexFractal=1]="SimplexFractal",e[e.Ashima=2]="Ashima",e[e.Fbm=3]="Fbm",e[e.Perlin=4]="Perlin",e[e.Voronoi=5]="Voronoi",OO=e,(t=LO||{})[t.F1=0]="F1",t[t.F2=1]="F2",t[t.F2MinusF1=2]="F2MinusF1",t[t.SmoothBlend=3]="SmoothBlend",t[t.Edge=4]="Edge",t[t.Power=5]="Power",t[t.Lines=6]="Lines",t[t.Cells=7]="Cells",LO=t,BO=(r=>(r[r.Lights=0]="Lights",r[r.Static=1]="Static",r[r.Camera=2]="Camera",r))(BO||{}),UO=(r=>(r[r.Circle=0]="Circle",r[r.Ring=1]="Ring",r[r.Polygon=2]="Polygon",r[r.Cross=3]="Cross",r[r.Diamond=4]="Diamond",r[r.Checkerboard=5]="Checkerboard",r[r.Line=6]="Line",r[r.Wave=7]="Wave",r))(UO||{}),hx=["mode","gradientType","noiseType","tracingMode","mirror","displacementType","projection","cnormal","crop","axis","side","roughnessMapChannel","metalnessMap","metalnessMapChannel","normalMap","aoMap","aoMapChannel","emissiveMap","style"],QC=["wrapping","image","video","name","minFilter","magFilter"],(r=>{r.patch=function(s,a){let{texture:o,...l}=a;if(Object.assign(s,l),o){let c=s.texture;c&&Object.assign(c,o)}},r.defaultColorLayer=function(s){return{...r.defaultData("color"),color:s}},r.defaultData=function(s,a){return s==="light"&&a?function(o){let l={mode:0,isMask:!1,visible:!0,bumpMap:void 0,bumpMapIntensity:5,roughnessMap:void 0,alphaOverride:1};switch(o){case"phong":return{...l,category:"phong",specular:{r:.2,g:.2,b:.2},shininess:5,type:"light",visible:!0,mode:0,occlusion:!0,alpha:.6};case"toon":return{...l,category:"toon",specular:{r:.2,g:.2,b:.2},shininess:10,type:"light",alpha:1};case"lambert":return{...l,category:"lambert",emissive:{r:0,g:0,b:0},type:"light",alpha:1,visible:!0,mode:0,occlusion:!0};case"physical":return{...l,category:"physical",roughness:.6,metalness:.2,reflectivity:.2,type:"light",alpha:.6,visible:!0,mode:0,occlusion:!0}}}(a):function(o){let l={alpha:1,mode:0,isMask:!1,visible:!0};switch(o){case"texture":return{...l,type:"texture",size:[128,128],blending:0,axis:"x",side:2,projection:0,texture:{image:"image_0",wrapping:1e3,repeat:[1,1],offset:[0,0],rotation:0,minFilter:1008,magFilter:1006},crop:!1};case"video":return{...l,type:"video",size:[128,128],blending:0,axis:"x",side:2,projection:0,texture:{video:Q_.defaultVideo,wrapping:1001,repeat:[1,1],offset:[0,0],rotation:0,minFilter:1008,magFilter:1006},crop:!1};case"color":return{...l,type:"color",color:Tn.fromHex(Ir)};case"vertexColor":return{...l,type:"vertexColor"};case"depth":return{...l,type:"depth",gradientType:1,smooth:!1,isVector:!0,isWorldSpace:!1,origin:[0,0,0],direction:[1,0,0],colors:[[1,1,1,1],[0,0,0,1]],steps:[0,1],near:50,far:200};case"normal":return{...l,type:"normal",cnormal:[1,1,1]};case"gradient":return{...l,type:"gradient",gradientType:0,smooth:!1,colors:[[0,0,0,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1]],steps:[0,1,1,1,1,1,1,1,1,1],num:2,angle:0,offset:[0,0],morph:[0,0]};case"noise":return{...l,type:"noise",size:[100,100,100],noiseType:0,scale:1,move:1,colorA:{...Tn.fromHex(6710886),a:1},colorB:{...Tn.fromHex(6710886),a:1},colorC:{...Tn.fromHex(16777215),a:1},colorD:{...Tn.fromHex(16777215),a:1},distortion:[1,1],fA:[1.7,9.2],fB:[8.3,2.8],voronoiStyle:0,highCut:1,lowCut:0,smoothness:.3,seed:0,quality:1};case"cavity":return{...l,type:"cavity",mode:3,ridge:1,valley:1};case"fresnel":return{...l,type:"fresnel",color:Je.fromHexAndA(16777215,1),bias:.1,scale:1,intensity:2,factor:1};case"dust":return{...l,type:"dust",color:Je.fromHexAndA(10323813,1),coverage:.2,softness:.2,noiseStrength:.2,noiseScale:1};case"rainbow":return{...l,type:"rainbow",filmThickness:30,movement:0,wavelengths:[0,0,0],noiseStrength:0,noiseScale:1,offset:[0,0,0]};case"toon":return{...l,type:"toon",positioning:2,colors:[[0,0,0,1],[.5,.5,.5,1],[.5,.5,.5,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1]],steps:[0,.475,.525,1,1,1,1,1,1,1],num:4,source:[0,1e3,0],isWorldSpace:!0,noiseStrength:0,noiseScale:1,shadowColor:Je.fromHexAndA(0,0),offset:[0,0,0]};case"outline":return{...l,type:"outline",outlineColor:Je.fromHexAndA(0,1),contourColor:Je.fromHexAndA(0,1),outlineWidth:2,contourWidth:5,outlineThreshold:.4,contourThreshold:0,outlineSmoothing:0,contourFrequency:10,contourDirection:[0,1,0],positionalLines:!1,compensation:!0};case"matcap":return{...l,type:"matcap",texture:{image:"matcap_0",wrapping:1001,repeat:[1,1],offset:[0,0],rotation:0,minFilter:1008,magFilter:1006}};case"transmission":return{...l,type:"transmission",thickness:10,ior:1.5,roughness:1};case"reflection":return{...l,type:"reflection",blur:0,thickness:.001,steps:60,stepSize:.005,tracingMode:1,mirror:0};case"displace":return{visible:!0,type:"displace",displacementType:"noise",noiseType:0,scale:10,movement:1,offset:[0,0,0],intensity:8,voronoiStyle:0,smoothness:.3,seed:0,highCut:1,lowCut:0,quality:1};case"pattern":return{...l,type:"pattern",style:0,projection:0,axis:"y",blending:0,offset:[0,0],colorA:{...Tn.fromHex(0),a:1},colorB:{...Tn.fromHex(16777215),a:1},frequency:[10,10],size:.5,variation:0,smoothness:.5,zigzag:0,rotation:0,vertical:[0,1],horizontal:[0,1],sides:6}}}(s)}})(tn||(tn={})),(r=>{function s(a,o="layer1",l="layer2",c=Tn.fromHex(16777215)){let h=new Vt;return h.push({fi:0,data:tn.defaultData("light",a),id:o}),h.push({fi:1,data:tn.defaultData("color"),id:l}),{layers:h}}r.isMergable=function(a){return!a.layers.some(o=>o.data.type==="texture"&&o.data.projection!==0||o.data.type==="depth"&&!o.data.isWorldSpace||o.data.type==="noise"||o.data.type==="dust"&&o.data.noiseStrength!==0||o.data.type==="displace")},r.getHash=function(a){let o="";return a.layers.forEach(l=>{Object.entries(l.data).forEach(([c,h])=>{o+=`${c}${h}`,Array.isArray(h)?h.forEach(d=>o+=`${d}`):typeof h=="object"?Object.values(h).forEach(d=>{o+=typeof d=="number"?`${d.toFixed(4)}`:`${d}`}):o+=`${h}`})}),o},r.defaultEmptyData=function(){return{layers:new Vt}},r.defaultData=function(a="layer1",o="layer2"){return s("physical",a,o)},r.withName=function(a,o){return{...a,name:o}},r.defaultTwoLayerData=s,r.defaultColorMaterial=function(a,o,l="layer1",c="layer2"){let h=new Vt;return h.push({fi:0,data:tn.defaultData("light",o),id:l}),h.push({fi:1,data:tn.defaultColorLayer(a),id:c}),{layers:h}},r.defaultUIObjectMaterial=function(a){let o=tn.defaultData("texture");a&&Object.assign(o.texture,{image:a});let l=new Vt;return l.push({fi:0,data:o,id:"layer1"}),l.push({fi:1,data:{...tn.defaultData("transmission"),alpha:1},id:"layer2"}),l.push({fi:2,data:{...tn.defaultData("light","lambert"),alpha:0},id:"layer3"}),{layers:l}},r.defaultTwoLayerTextureData=function(a,o="physical",l="layer1",c="layer2"){let h=tn.defaultData("texture");Object.assign(h.texture,{image:a});let d=new Vt;return d.push({fi:0,data:h,id:l}),d.push({fi:1,data:tn.defaultData("light",o),id:c}),{layers:d}},r.defaultTwoLayerVideoTextureData=function(a,o="physical",l="layer1",c="layer2"){let h=tn.defaultData("video");Object.assign(h.texture,{video:a});let d=new Vt;return d.push({fi:0,data:h,id:l}),d.push({fi:1,data:tn.defaultData("light",o),id:c}),{layers:d}}})(Vi||(Vi={}))}),$$=z(()=>{Au="Roboto_regular",SN="https://fonts.gstatic.com/s/roboto/v30/KFOmCnqEu92Fr1Me5WZLCzYlKw.ttf"}),Y$=z(()=>{$$()}),IN=z(()=>{Ye(),(Hg||(Hg={})).defaultData=function(){return{points:new Vt,roundness:0,shapeHoles:[],isClosed:!1}}}),ON=z(()=>{Ye(),(tb||(tb={})).defaultData=function(){return{points:new Vt,lastInsertionPlane:null,subdivisions:12,isClosed:!1,subdivisionMode:"parametric"}},wc={type:"Ellipse",width:50,height:50,spikes:16,angle:360,innerRadius:0},(CA||(CA={})).merge=function(t,e){let i={...t};return eb.forEach(n=>{Object.assign(i,{[n]:e[n]??t[n]})}),i},JC={shape:wc,depth:1,offset:0,bevel:50,bevelSides:6,angle:0,twist:0,startScale:1,endScale:1,capType:"flat"},eb=["depth","offset","angle","twist","startScale","endScale"]}),e3=z(()=>{var t,e;IN(),ON(),(t=ib||(ib={})).is2DParametricMesh=function(i){return i==="PolygonGeometry"||i==="RectangleGeometry"||i==="StarGeometry"||i==="TriangleGeometry"||i==="EllipseGeometry"||i==="UIGeometry"},t.isParametricMesh=function(i){return i==="PolygonGeometry"||i==="RectangleGeometry"||i==="StarGeometry"||i==="TriangleGeometry"||i==="EllipseGeometry"||i==="PathGeometry"||i==="VectorGeometry"||i==="ConeGeometry"||i==="CubeGeometry"||i==="CylinderGeometry"||i==="DodecahedronGeometry"||i==="HelixGeometry"||i==="IcosahedronGeometry"||i==="LatheGeometry"||i==="PyramidGeometry"||i==="SphereGeometry"||i==="PlaneGeometry"||i==="BackdropGeometry"||i==="TorusGeometry"||i==="TorusKnotGeometry"||i==="BooleanGeometry"||i==="TextGeometry"||i==="InputGeometry"||i==="DecalGeometry"},t.isSwappableGeometry=function(i){return i==="PolygonGeometry"||i==="RectangleGeometry"||i==="StarGeometry"||i==="TriangleGeometry"||i==="EllipseGeometry"||i==="PathGeometry"||i==="VectorGeometry"||i==="ConeGeometry"||i==="CubeGeometry"||i==="CylinderGeometry"||i==="DodecahedronGeometry"||i==="HelixGeometry"||i==="IcosahedronGeometry"||i==="LatheGeometry"||i==="PyramidGeometry"||i==="SphereGeometry"||i==="PlaneGeometry"||i==="BackdropGeometry"||i==="TorusGeometry"||i==="TorusKnotGeometry"||i==="TextGeometry"||i==="SubdivGeometry"||i==="NonParametricGeometry"},(PA||(PA={})).merge=function(i,n){let r={...i};return Object.assign(r,n),r.type==="PathGeometry"&&"extrusion"in n&&n.extrusion&&(r.extrusion={...i.extrusion},Object.assign(r.extrusion,CA.merge(r.extrusion,n.extrusion))),r},(e=Yo||(Yo={})).defaultData=function(i){if(i==="RectangleGeometry")return{width:320,height:320,type:i,cornerRadius:[0,0,0,0],cornerType:0,depth:0,extrudeBevelSize:0,extrudeBevelSegments:1};if(i==="UIGeometry")return{type:i,frame:"",cornerRadius:[0,0,0,0],cornerType:0,width:1,height:1};if(i==="PathGeometry")return{type:i,width:1,height:1,depth:1,path:tb.defaultData(),extrusion:JC};if(i==="VectorGeometry")return{width:1,height:1,type:i,subdivisions:12,shape:Hg.defaultData(),depth:0,extrudeBevelSize:0,extrudeBevelSegments:1};if(i==="BooleanGeometry")return{type:i,operation:2,width:0,height:0,depth:0,phongAngle:35};if(i==="ShapeBlendGeometry")return{type:i,width:0,height:0,depth:0,resolutionLevel:6,blendRange:100,useChildrenColors:!1};if(i==="DecalGeometry")return{type:i,width:200,height:200,depth:200,offset:1,projection:"all",projectionTargets:[]};if(i==="TextGeometry")return{type:i,width:100,height:100,depth:0,horizontalAlign:1,verticalAlign:1,fontSize:16,lineHeight:1.2,letterSpacing:0,text:{textValue:""},textTransform:1,font:"Roboto_regular",editable:!1,extrudeBevelSize:0,extrudeBevelSegments:1};if(i==="InputGeometry")return{...e.defaultData("TextGeometry"),type:i,editable:!0};if(i==="SphereGeometry")return{type:"SphereGeometry",width:100,height:100,depth:100,widthSegments:64,heightSegments:64,phiStart:0,phiLength:2*Math.PI,thetaStart:0,thetaLength:180};throw new Error("not implemented")},T1=["width","height","depth"]}),LN=z(()=>{bs(),(t=>{function e(i){return i.mode??"linear"}t.defaultData={enabled:!1,useBackgroundColor:!1,color:Tn.white,near:.1,far:2e3,mode:"linear",density:.005,heightFalloff:.01,heightBase:0},t.getMode=e,t.getModeIndex=function(i){let n=e(i);return n==="height"?1:n==="both"?2:0},t.getDensity=function(i){return i.density??t.defaultData.density},t.getHeightFalloff=function(i){return i.heightFalloff??t.defaultData.heightFalloff},t.getHeightBase=function(i){return i.heightBase??t.defaultData.heightBase}})(ir||(ir={}))}),i3=z(()=>{(DS||(DS={})).defaultData={image:null,rotation:0,blur:32,showBackground:!0},(ql||(ql={})).defaultData={enabled:!1,mode:"hdri",hdri:DS.defaultData,timeOfDay:10,weather:"partlyCloudy",lighting:!0,lightingIntensity:1,lightingQuality:"full",clouds:!0,windSpeed:2,animateWind:!0,exposure:1,seed:2}}),BN=z(()=>{(()=>{let t={opacity:1,blendFunction:13,enabled:!1};(nb||(nb={})).defaultData={enabled:!1,pixelation:{...t,blendFunction:16,granularity:15},bloom:{...t,blendFunction:16,intensity:1,blurScale:1,luminanceThreshold:.25,luminanceSmoothing:.025,kernelSize:3},chromaticAberration:{...t,offset:[2,2]},vignette:{...t,darkness:1,offset:0},hueSaturation:{...t,hue:3,saturation:0},brightnessContrast:{...t,brightness:.25,contrast:0},depthOfField:{...t,focusDistance:100,focalLength:20,bokehScale:5},noise:{...t,blendFunction:16}}})()}),n3=z(()=>{var t;LN(),i3(),BN(),bs(),(t=ug||(ug={})).defaultData={type:"normal",softShadowQuality:"low"},t.isSoft=function(e){return e!=null&&(e.type===void 0||e.type==="soft")},(RS||(RS={})).defaultData={enabled:!0,color:{r:.8274509803921568,g:.8274509803921568,b:.8274509803921568},intensity:.75},(IS||(IS={})).defaultData={occlusion:!1,aoFullRes:!1,radius:256,bias:.5,aoColor:{r:.19607843137254902,g:.19607843137254902,b:.19607843137254902}},(e=>{e.defaultData={pipeline:"classic",toneMapping:"aces",exposure:1},e.isUntouched=function(i){return i===void 0||i.pipeline==="classic"&&(i.toneMapping==="none"||i.toneMapping==="aces")&&i.exposure===1}})(OS||(OS={})),(Qu||(Qu={})).defaultData={usePhysics:!1,gravity:-10},(LS||(LS={})).defaultData={playCamera:ed,gameControlObject:null},(DA||(DA={})).defaultData={backgroundColor:Je.fromHexAndA(wN,1),postprocessing:nb.defaultData,fog:ir.defaultData,sky:ql.defaultData,globalPhysics:Qu.defaultData,ambient:RS.defaultData,ao:IS.defaultData,shadow:ug.defaultData,publish:LS.defaultData,grading:OS.defaultData}}),Z$=z(()=>{(RA||(RA={})).defaultData={colliderType:"box",size:[100,100,100],colliderHelperVisible:!0,forceType:"collider",forceRange:"global",forceIntensity:.5,forceDambing:.95}}),cx=z(()=>{var t,e,i;Ye(),EN(),TN(),CN(),PN(),t3(),DN(),bs(),r0(),e3(),AN(),Dn(),n3(),Z$(),(t=zO||(zO={})).isComponentRelated=function(n){return n==="Component"||n==="Instance"},t.isEmptyOrComponent=function(n){return n==="Empty"||n==="Instance"},(e=zd||(zd={})).identity={...bA.identity,hiddenMatrix:Zu.identity},e.fromObject=function(n){return{position:n.position,rotation:n.rotation,scale:n.scale,pivot:n.pivot,pivotRotation:n.pivotRotation,hiddenMatrix:n.hiddenMatrix}},e.merge=function(n,r){return{position:r?.position||n.position,rotation:r?.rotation||n.rotation,pivot:r?.pivot||n.pivot,pivotRotation:r?.pivotRotation||n.pivotRotation,scale:r?.scale||n.scale,hiddenMatrix:r?.hiddenMatrix||n.hiddenMatrix}},e.diff=function(n,r){return eN({position:dh.isEqual(n.position,r.position)?void 0:r.position,rotation:dh.isEqual(n.rotation,r.rotation)?void 0:r.rotation,scale:dh.isEqual(n.scale,r.scale)?null:r.scale,hiddenMatrix:Zu.isEqual(n.hiddenMatrix,r.hiddenMatrix)?void 0:r.hiddenMatrix})},MN=["slide","offset"],(An||(An={})).defaultData={states:new Vt,events:new Vt,visible:!0,raycastLock:!1,physics:Ku.defaultData,pathSnapping:{pathId:null,slide:0,offset:0,orientation:"tangential"},...zd.identity,cloner:null},(rb||(rb={})).defaultData={type:"Empty",...An.defaultData},(FO||(FO={})).defaultData={type:"ParticleCollider",...RA.defaultData,...An.defaultData},(NO||(NO={})).defaultData={type:"Component",...An.defaultData},(kO||(kO={})).defaultData={type:"Particle",...An.defaultData,...K_.defaultData},(VO||(VO={})).defaultData={type:"Hair",...An.defaultData,...AA.defaultData},(Wa||(Wa={})).defaultData={type:"Mesh",...An.defaultData,...TA.defaultData},(pg||(pg={})).defaultData={...An.defaultData,...zd.identity,position:il.DefaultPosition,rotation:il.DefaultRotation,...il.defaultData},(n=>{n.defaultData=function(r){return{...An.defaultData,...EA.defaultData(r)}},n.defaultDirectionalLightData={...n.defaultData("DirectionalLight"),position:[200,300,300],name:"Directional Light",intensity:.7}})(sb||(sb={})),(n=>{function r(s,a,o=0){for(;o<a.length;){let l=s?s[a[o]]:void 0;if(a.length===o+1)return l;if(!l)return;s=l.descendants,o+=1}}n.resolveWithDes=r,n.resolve=function(s,a,o=0){let l=r(s,a,o);if(l){let c=Object.keys(l);if(c.length===1&&c[0]==="descendants")return}return l}})(ab||(ab={})),(n=>{function r(s,a){return{...An.defaultData,...a,component:s,overrides:new $i,physics:void 0,events:void 0,type:"Instance"}}n.rootOverrideProps=["physics","events"],n.compositeNonOptionalOverrideProps=["geometry"],n.compositeEntireOverrideOverrideProps=["material"],n.ofComponent=r,n.fromComponentData=function(s){let a=zd.fromObject(s.data);return r(s.id,a)}})(nl||(nl={})),(n=>{n.defaultData={type:"Page",...An.defaultData,physics:{...Ku.defaultData,fusedBody:!1},...DA.defaultData,camera:pg.defaultData,timelines:new te},n.isUIPage=function(r){return r.uiScene!==void 0}})(zc||(zc={})),(i=jO||(jO={})).defaultCamera={position:[0,0,1e3],scale:[1,1,1],rotation:[0,0,0],pivot:[0,0,0],pivotRotation:[0,0,0],hiddenMatrix:Zu.identity,name:"Play Camera",visible:!0,raycastLock:!1,physics:Ku.defaultData,states:new Vt,events:new Vt,cloner:null,pathSnapping:{pathId:null,orientation:"tangential",slide:0,offset:0},...il.defaultData},i.KeysByResetCategory={States:["states"],Events:["events"],Material:["material","materials"],Geometry:["geometry"],Position:["position"],Rotation:["rotation"],Scale:["scale"],Transform:["position","scale","rotation","hiddenMatrix"],Name:["name"],Visibility:["visible","raycastLock","flatShading","wireframe","side","shadowCatcher"],Shadows:["castShadow","receiveShadow"],Cloner:["cloner"],Physics:["physics"]},i.defaultMeshObject={name:"Rectangle",...An.defaultData,...Wa.defaultData,geometry:Yo.defaultData("RectangleGeometry"),material:Vi.defaultTwoLayerData("physical","layer1","layer2")},i.defaultBooleanObject={name:"Boolean",...An.defaultData,...Wa.defaultData,geometry:Yo.defaultData("BooleanGeometry"),material:Vi.defaultTwoLayerData("physical","layer1","layer2")},i.defaultShapeBlendObject={name:"Shape Blend",...An.defaultData,...Wa.defaultData,geometry:Yo.defaultData("ShapeBlendGeometry"),material:Vi.defaultTwoLayerData("physical","layer1","layer2")},i.defaultTextObject={name:"Text",...An.defaultData,...Wa.defaultData,geometry:Yo.defaultData("TextGeometry"),material:Vi.defaultTwoLayerData("physical","layer1","layer2")},i.defaultInputObject={name:"Input",...An.defaultData,...Wa.defaultData,geometry:Yo.defaultData("InputGeometry"),material:Vi.defaultTwoLayerData("physical","layer1","layer2")},(n=>{n.newEmpty=function(r,s){let a={name:s};return r.type==="Mesh"?(a.geometry={},"material"in r&&(a.material={layers:new $i}),"materials"in r&&(a.materials=r.materials.map(o=>({layers:new $i})))):Xc.is(r.type)&&(a.perspective={},a.orthographic={}),a},n.toOps=function(r,s){let a,o=[],l={orthographic:0,perspective:0,geometry:0};function c(h,d){for(let[u,p]of Object.entries(d.layers)){let{texture:f,...g}=p;if(f!==void 0&&Object.keys(f).length>0){let m={path:[...h,"layers",u,"texture"],props:f,type:0};o.push(m)}if(Object.keys(g).length>0){let m={path:[...h,"layers",u],props:g,type:0};o.push(m)}}}for(let[h,d]of Object.entries(s)){let u=d;if(h!=="name")if(h==="cloner")o.push(...wA.toOps(u,["cloner"]));else if(h==="pathSnapping")o.push({path:[h],props:{slide:u.slide,offset:u.offset},type:0});else if(h==="material")c(["material"],u);else if(h==="materials")for(let[p,f]of Object.entries(u))c(["materials",p],f);else if(l[h]===0){if(h==="geometry"&&u.extrusion!==void 0){let p={path:[h,"extrusion"],props:u.extrusion,type:0};o.push(p),u={...u},delete u.extrusion}if(Object.keys(u).length>0){let p={path:[h],props:u,type:0};o.push(p)}}else a===void 0&&(a={path:[],props:{},type:0},o.push(a)),a.props[h]=u}return o},n.patch=function(r,s){if(s===void 0)return r;let a={...r};if(Object.assign(a,zd.merge(a,s)),Object.assign(a,{pathSnapping:Object.assign({},a.pathSnapping,{slide:s.pathSnapping?.slide??a.pathSnapping?.slide??0,offset:s.pathSnapping?.offset??a.pathSnapping?.offset??0})}),Xc.is(r.type)){a.orthographic={...a.orthographic},a.perspective={...a.perspective};let o=s;o.orthographic?.zoom!==void 0&&(a.orthographic.zoom=o.orthographic.zoom),o.perspective?.zoom!==void 0&&(a.perspective.zoom=o.perspective.zoom),o.isUpVectorFlipped!==void 0&&(a.isUpVectorFlipped=o.isUpVectorFlipped),o.targetOffset!==void 0&&(a.targetOffset=o.targetOffset)}else if(r.type==="Mesh")"geometry"in s&&Object.assign(a,{geometry:PA.merge(a.geometry,s.geometry)}),(s.material||s.materials)&&(a=function(o,l){if(l===void 0)return o;let c={...o};return"material"in c&&"material"in l&&l.material&&(c.material=j_(c.material,h=>{if(typeof h!="string")for(let[d,u]of Object.entries(l.material.layers)){let p=h.layers.data(d);p&&tn.patch(p,u)}}).data),c.materials&&l.materials&&(c.materials=j_(c.materials,h=>{for(let d=0;d<c.materials.length;d++){let u=l.materials[d];if(typeof u!="string")for(let[p,f]of Object.entries(u.layers)){let g=h[d]?.layers?.data(p);g&&tn.patch(g,f)}}}).data),c}(a,s)),a.cloner&&"cloner"in s&&Object.assign(a,{cloner:eh.merge(a.cloner,s.cloner)});else if(r.type==="Empty")a.cloner&&"cloner"in s&&Object.assign(a,{cloner:eh.merge(a.cloner,s.cloner)});else if(MA.is(r.type)){let o=s;o.intensity!==void 0&&(a.intensity=o.intensity),o.color!==void 0&&(typeof o.color=="string"?a.color=o.color:a.color=Tn.clone(o.color))}return a}})(ih||(ih={}))}),r3=z(()=>{(ob||(ob={})).defaultData={enablePan:!0,enableZoom:!0,enableRotate:!0,enableDamping:!0,rotationLimitsMode:0,rotationVerticalOffset:{min:Math.PI/4,max:Math.PI/4},rotationHorizontalOffset:{min:Math.PI/4,max:Math.PI/4},rotationSoftLimit:2,rotationSpeed:1,panLimitsMode:0,panVerticalOffset:{min:250,max:250},panHorizontalOffset:{min:250,max:250},panSoftLimit:2,zoomLimitsEnabled:!1,zoomLimits:{min:.1,max:2},autoRotate:!1,autoRotateSpeed:2,autoRotateClockwise:!0,hoverRotatePanMode:0,hoverRotatePanStrength:20,hoverRotateDamping:.125,isTouchZoom:!0,orbitTouches:2,panTouches:3,resetHoverEffectOnPointerLeave:!0}}),dx=z(()=>{r3(),bs(),(rl||(rl={})).defaultData={orbitControls:ob.defaultData,playPage:Yu,withBackground:!0,preventScroll:!1,preventTouchScroll:!1,hideCursor:!1,mouseEventTarget:"canvas",joystickSizeAndXYOffset:Array(12).fill(0).map((t,e)=>{let i=0,n=0;return e<5?n=-30:e<10&&(n=30),e===0||e===10||e===5?i=30:(e===4||e===11||e===9)&&(i=-30),[120,[i,n],"show"]}),settings:{image:{format:"jpg",ratio:1,colorSpace:"display-p3"},videoStatic:{fps:60,mbps:150,ratio:1,duration:1e3,format:"mp4",imageFormat:"jpg",activeTimeline:null,colorSpace:"display-p3"},web:{logo:!0,compress:!0,preset:1,preload:!0,hint:!1,imageQuality:70,pixelRatioMobile:0,pixelRatioDesktop:0}},stopRaycast:!0,hdTransmission:!1,renderer:"webgpu",asyncShaderCompilation:!0}}),UN=z(()=>{var t;(BS||(BS={})).defaultData={id:"basic",label:"Basic",style:"None",prompt:""},(US||(US={})).defaultData={weather:0,shadows:0,lightOrigin:0,temperature:0,sun:0,camera:0,environment:0,particles:0,nature:0,floor:0},(t=Mc||(Mc={})).defaultData=()=>({mode:"line-art-both",prompt:"",negativePrompt:"",style:{...BS.defaultData},isRandomSeed:!0,seed:t.generateSeed(),guessMode:!1,advanced:!1,steps:20,guidanceScale:7.5,controlNetScale:1,modifiers:US.defaultData}),t.generateSeed=()=>Math.round(1e5*Math.random())}),s3=z(()=>{cx(),Ye(),dx(),bs(),Dn(),UN(),(t=>{function e(i,n){let r=i.scene.objects.get(n);if(r&&r.data.type==="Component")return r;{let s=i.shared.lib.components[n];if(s)return{...s.asset,id:n}}}t.physicsEnabled=function(i){return i.find(n=>n.data.type==="Page"&&n.data.globalPhysics.usePhysics)!==void 0},t.findTimeline=function(i,n){let r=i.find(s=>s.data.type==="Page"&&s.data.timelines?.[n]!==void 0);return r&&r.data.timelines?.[n]},t.getComponentData=e,t.traverseModuleInstances=function(i,n,r){i.scene.objects.traverseFrom(n,(s,a)=>{if(a.type==="Instance"){let o=e(i,a.component)?.data;o&&r(s,a,o.events)}else r(s,a,a.events)})}})($c||($c={})),(t=>{function e(n=!0,r=[]){let s=[];n&&s.push({...t.defaultLight}),s.push(...r);let a=new Xn;return a.push({fi:1,id:Yu,data:{...zc.defaultData,name:"Scene 1"},children:s}),a}function i(n){return{...t.defaultData,objects:Ar(n,Xn.prototype)}}t.TRASH_CAN_ID="830a2708-8ed9-49cf-a68e-085299892222",t.defaultLight={fi:-1,data:sb.defaultDirectionalLightData,id:"830a2708-8ed9-49cf-a68e-085299899103",children:[]},t.createDefaultObjectTreeWithPage=e,t.defaultData={objects:e(),publish:rl.defaultData,styles:Mc.defaultData()},t.emptyDataWithoutPage=function(){return{objects:new Xn,publish:rl.defaultData,styles:Mc.defaultData()}},t.emptyDataWithPage=function(n=!0){return{objects:e(n),publish:rl.defaultData,styles:Mc.defaultData()}},t.emptyData=function(){return{objects:new Xn,publish:{...rl.defaultData},styles:Mc.defaultData()}},t.withObjs=i,t.withObj=function(n,r){return i([{id:n,data:r,children:[],fi:0}])}})(Ec||(Ec={}))}),zN=z(()=>{(fg||(fg={})).defaultData={preset:"fullscreen",allowResponsive:!1,size:[512,512],coords:[0,0],sceneScale:1,color:{r:0,g:0,b:0,a:.5}}}),a3=z(()=>{var t,e;Ye(),Dn(),(t=IA||(IA={})).defaultData=i=>({url:i,name:"New Webhook",parametersSchemas:new Vt}),t.defaultParameterValueByType=i=>i==="number"?0:i!=="boolean"&&"",(GO||(GO={})).defaultData=(i,n="GET")=>({url:i,method:n,name:"New API",headers:new Vt,queries:new Vt,autoStart:!0}),(i=>{function n(s){return s.textValue!==void 0}function r(s){return typeof s=="boolean"}i.isTextValue=n,i.isNumber=function(s){return typeof s=="number"},i.isBoolean=r,i.typeOfVariable=function(s){return n(s)?"string":r(s)?"boolean":"number"},i.getDisplayedValue=function(s){return i.isTextValue(s)?Array.isArray(s.textValue)?s.textValue.map(a=>a.toString().padStart(s.padding??2,"0")).join(s.deliminator??":")+(s.suffix!==void 0?" "+s.suffix:""):s.textValue.toString():i.isBoolean(s)?s?"True":"False":i.isNumber(s)?parseFloat(s.toFixed(3)).toString():s.toString()}})(br||(br={})),(zS||(zS={})).all=["images","videos","colors","audios","particles","fonts","materials","variables"],(HO||(HO={})).all=[...zS.all,"components"],(WO||(WO={})).defaultData=function(){return{images:new te,videos:new te,colors:new te,audios:new te,particles:new te,fonts:new te,materials:new te,components:new te,variables:new te,userAPIs:new te,userWebhooks:new te}},(Zo||(Zo={})).defaultData=function(){return{images:new te,videos:new te,colors:new te,audios:new te,particles:new te,fonts:new te,materials:new te,components:new te,variables:new te,userAPIs:new te,userWebhooks:new te}},(e=Ns||(Ns={})).defaultColors=function(){return Ar({"89b10010-844c-11ec-a8a3-0242ac120002":{r:.5,g:.5,b:.5,a:1,name:"Default Color"}},te.prototype)},e.defaultImages=function(){return Ar({},te.prototype)},e.emptyData=function(){return{catelogs:new te,materials:new te,images:new te,videos:new te,colors:new te,audios:new te,particles:new te,fonts:new te,variables:new Vt,userAPIs:new te,userWebhooks:new te,lib:Zo.defaultData()}},e.defaultVariables=function(i){switch(i){case"number":return{value:0,name:"Number"};case"boolean":return{value:!1,name:"Boolean"};case"string":return{value:{textValue:"String value"},name:"String"};case"time":{let n=[0,0,0];return{name:"Time",value:{textValue:n,deliminator:":",padding:2,suffix:"AM"},dynamicVariableType:"time",format:"HH:mm:ss",format12h24h:"12ampm",timeZone:null,hasEnd:!1,endValue:{textValue:n,deliminator:":",padding:2,suffix:"AM"},autoStart:!0,repeat:!1}}case"counter":return{name:"Counter",value:0,dynamicVariableType:"counter",updateInterval:1e3,increment:1,autoStart:!0,hasEnd:!0,endValue:60,repeat:!0,randomStart:!1,range:[0,100],decimals:0};case"random":return{name:"Random",value:0,dynamicVariableType:"random",updateInterval:1e3,increment:1,autoStart:!0,isStatic:!1,hasEnd:!0,endValue:60,repeat:!0,min:0,max:100,decimals:0};default:console.error("Unknown variable type",i)}},e.getFormattedTimerTime=function(i,n){if(n.format==="HH:mm:ss"){let r=Math.floor(i/3600),s=Math.floor((i-3600*r)/60);return{textValue:[r,s,Math.round(i-3600*r-60*s)]}}if(n.format==="mm:ss"){let r=Math.floor(i/60);return{textValue:[r,Math.round(i-60*r)]}}return n.format==="number"?Math.round(i):Math.round(1e3*i)/1e3}}),K$=z(()=>{}),FN=z(()=>{var t;Ye(),s3(),zN(),a3(),(t=Ju||(Ju={})).defaultData={schema:132,scene:Ec.defaultData,frames:new te().add("72fc2993-2da3-4b6b-96ac-2879db3a28bd",fg.defaultData),shared:{...Ns.emptyData(),colors:Ns.defaultColors()}},t.createDefaultData=function(){return jg.deserialize(jg.serialize(t.defaultData))},t.emptyDataForImports=function(){return{schema:132,scene:Ec.emptyDataWithPage(),frames:new te().add("72fc2993-2da3-4b6b-96ac-2879db3a28bd",fg.defaultData),shared:{...Ns.emptyData(),colors:Ns.defaultColors(),images:Ns.defaultImages()}}},t.emptyData=function(){return{schema:132,scene:Ec.emptyDataWithPage(),frames:new te().add("72fc2993-2da3-4b6b-96ac-2879db3a28bd",fg.defaultData),shared:Ns.emptyData()}},t.clipboard2dData=function(){return{schema:132,scene:Ec.emptyData(),frames:new te,shared:Ns.emptyData()}},t.withoutLib=function(e){return{...e,shared:{...e.shared,lib:Zo.defaultData()}}},t.getComponentData=function(e,i){return $c.getComponentData(e,i)},t.hasSensitiveData=function(e){let i=Object.values(e.shared.userAPIs);for(let n of i){let r=n.headers;for(let s of r)if(s.data.key.toLowerCase()==="authorization"&&s.data.value!=="")return!0}return!1}}),Q$=z(()=>{(OA||(OA={})).emptyImage={data:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVQYV2NgYAAAAAMAAWgmWQ0AAAAASUVORK5CYII=",name:"empty"}});function Fc(t,e=[0,0]){return[t&&!isNaN(t[0])?t[0]:e[0],t&&!isNaN(t[1])?t[1]:e[1]]}function zf(t,e,i){switch(t){case 0:return"cubicBezier( 0, 0, 1, 1 )";case 1:return"cubicBezier( .25, .1, .25, 1 )";case 2:return"cubicBezier( .42, 0, 1, 1 )";case 3:return"cubicBezier( 0, 0, .58, 1 )";case 4:return"cubicBezier( .42, 0, .58, 1 )";case 7:return"cubicBezier( .25, 1, .5, 1 )";case 5:{let{control1:n,control2:r}=e??{...mp.defaultData};return`cubicBezier( ${n[0]}, ${n[1]}, ${r[0]}, ${r[1]} )`}case 6:{let{mass:n,stiffness:r,damping:s,velocity:a}=i??{...th.defaultData},o=new NN(n,r,s,a),l=o.solve(1);return()=>c=>o.solve(c)/l}case 8:return()=>n=>Math.floor(n)}}var qO,XO,Nc,Wg,NN,lb,hb,kN=z(()=>{Ye(),bs(),(qO||(qO={})).defaultData=function(t,e){return{id:t,name:e,duration:5,objectTimelines:new te}},(XO||(XO={})).is=function(t){return t&&typeof t.x=="number"&&typeof t.y=="number"&&typeof t.z=="number"},(t=>{function e(h,d){let u=[0,0],p=[1,1];if(h?.cubicControls)u=Fc(h.cubicControls.control1,u);else switch(h?.type){case 2:case 4:u=[.42,0];break;case 3:case 0:u=[0,0];break;case 1:u=[.25,.1];break;case 7:u=[.25,1]}if(d?.cubicControls)p=Fc(d.cubicControls.control2,p);else switch(d?.type){case 2:case 0:p=[1,1];break;case 3:case 4:p=[.58,1];break;case 1:p=[.25,1];break;case 7:p=[.5,1]}return{control1:u,control2:p}}function i(h){if(!t.BEZIER_PRESETS.includes(h))return;let d={type:h};return{control1:e(d).control1,control2:e(void 0,d).control2}}function n(h,d){return Math.abs(h[0]-d[0])<.001&&Math.abs(h[1]-d[1])<.001}function r(h){let d=t.ROOT_PROPERTY_ORDER.indexOf(h[0]);return d===-1?t.ROOT_PROPERTY_ORDER.length:d}function s(h){return h.layerId??h.path.join(".")}function a(h){let d=h[h.length-1];return Wg.includes(d)?d:void 0}function o(h){return h.layerId?h.layerId:(a(h.path)?h.path.slice(0,-1):h.path).join(".")}function l(h){return["material",h.type==="light"?`${h.category} lighting`:h.type]}function c(h,d,u){return{id:h,data:{id:h,time:u?.time??0,path:d,value:{},layerId:u?.layerId,index:u?.index,isPlaceholder:!0,easing:{type:5,cubicControls:{control1:[.42,0],control2:[.58,1]}}}}}t.getControlsWithDefault=e,t.BEZIER_PRESETS=[0,1,2,3,4,7],t.presetHandles=i,t.presetForHandles=function(h){return t.BEZIER_PRESETS.find(d=>{let u=i(d);return u!==void 0&&n(u.control1,h.control1)&&n(u.control2,h.control2)})},t.defaultData=function(h){return{id:h,keyframes:new Vt}},t.ROOT_PROPERTY_ORDER=["position","rotation","scale","shape size","material","opacity","camera","light","cloner","path extrusion","path snapping"],t.rowOrder=r,t.propertyKey=s,t.groupKeyframes=function(h,d){let u=new Map;for(let p of h){let f=p.data;if(d?.(f))continue;let g=s(f),m=u.get(g);m||(m={id:g,path:f.path,keyframes:[],layerId:f.layerId,index:f.index},u.set(g,m)),f.isPlaceholder?m.placeholder=p.id:m.keyframes.push(p)}return[...u.values()].sort((p,f)=>{let g=r(p.path)-r(f.path);return g!==0?g:(p.index??0)-(f.index??0)})},t.rowAxis=a,t.drawnRowKey=o,t.drawnRows=function(h){let d=new Map;for(let u of h){let p=a(u.path),f=p?u.path.slice(0,-1):u.path,g=o(u),m=d.get(g);m||(m={id:g,path:f,layerId:u.layerId,index:u.index,tracks:[]},d.set(g,m)),m.tracks.push({axis:p,property:u})}return[...d.values()]},t.sortedKeyframes=function(h){return[...h].sort((d,u)=>d.data.time-u.data.time)},t.materialLayerPath=l,t.createMaterialGroup=function(h,d){return h.map(({data:u,id:p},f)=>c(d(),l(u),{layerId:p,index:f}))},t.placeholderKeyframe=c,t.createName=function(h){return Object.entries(h).reduce((d,[u,p])=>(typeof p!="string"&&d.push({name:p.name}),d),[])},t.Presets=[{name:"Slide in",animationParams:{translateX:{value:[-20,0],easing:zf(3),duration:1e3},opacity:{value:[0,1],easing:zf(3),duration:1e3},endDelay:250,loop:!0}},{name:"Rotate",animationParams:{rotate:{value:[0,"1turn"],easing:zf(5),duration:700},endDelay:250,loop:!0}},{name:"Scale Out",animationParams:{scale:{value:[1,1.5],easing:zf(4),duration:1e3},endDelay:250,loop:!0}},{name:"Jump",animationParams:{translateY:[{value:0,duration:200,easing:"linear"},{value:-20,easing:"linear",duration:200},{value:0,easing:"linear",duration:100}],endDelay:500,loop:!0}},{name:"Jump Rotate",animationParams:{translateY:[{value:0,duration:200,easing:"linear"},{value:-20,easing:"linear",duration:200},{value:0,easing:"linear",duration:100}],rotate:{value:[0,"1turn"],easing:zf(5),duration:500},endDelay:500,loop:!0}},{name:"Bounce",animationParams:{translateY:{value:["20px","-20px"],duration:575,easing:"easeOutQuad"},direction:"alternate",loop:!0}}]})(Nc||(Nc={})),Wg=["x","y","z"],NN=class{constructor(t=1,e=100,i=10,n=0){this.mass=t,this.stiffness=e,this.damping=i,this.initialVelocity=n,this.m_w0=Math.sqrt(e/t),this.m_zeta=i/(2*Math.sqrt(e*t)),this.m_zeta<1?(this.m_wd=this.m_w0*Math.sqrt(1-this.m_zeta*this.m_zeta),this.m_A=1,this.m_B=(this.m_zeta*this.m_w0-n)/this.m_wd):(this.m_wd=0,this.m_A=1,this.m_B=-n+this.m_w0)}solve(t){return 1-(this.m_zeta<1?Math.exp(-t*this.m_zeta*this.m_w0)*(this.m_A*Math.cos(this.m_wd*t)+this.m_B*Math.sin(this.m_wd*t)):(this.m_A+this.m_B*t)*Math.exp(-t*this.m_w0))}getDuration(){let t=.16666666666666666,e=0,i=0;for(;;)if(e+=t,this.solve(e)===1){if(i++,i>=16)break}else i=0;return e*t*1e3}}}),o3=z(()=>{var t;bs(),Ye(),(lb||(lb={})).list=["idle","move","jump","run"],(t=hb||(hb={})).defaultColliderData={type:"capsule",height:200,radius:50,position:[0,0,0],rotation:[0,0,0]},t.defaultDataThirdPerson={moveMode:"walk",forwardDirection:"+z",speedTranslate:1e3,speedRotate:100,runMultiplier:2,rotationMode:"normal",rotBy:"keys",rotByTouch:"drag",delayPos:[.3,.3],delayRot:[.3,.3],keyAssignments:[["moveNegZ","W"],["moveNegX","A"],["movePosZ","S"],["movePosX","D"],["rotPosX","\u25B2"],["rotPosY","\u25C0"],["rotNegX","\u25BC"],["rotNegY","\u25B6"],["jump","Space"],["run","\u21E7"],["none","Ctrl"]],touchControl:!0,joystickPosLoc:5,joystickRotLoc:11,jumpTouchButtonLoc:9,collider:t.defaultColliderData,colliderHelperVisible:!0,collisionEnabled:!0,jumpPower:100,resetYPosition:3e3,alignToGround:!1,autoOrientMove:!0,orientWith:"camera",orientMode:"radial",delayPosCamera:.3,delayRotCamera:.3,camera:"",cameraXAxis:"Limit",cameraYAxis:"Free",cameraRotXLimits:[0,Math.PI/2],cameraRotYLimits:[-Math.PI/2,Math.PI/2],gameActions:{idle:new Vt,move:new Vt,jump:new Vt,run:new Vt},navmesh:{enabled:!1,ch:6,cs:6,walkableClimb:5,walkableHeight:1,walkableRadius:0,zones:"all",objects:[],helperVisible:!0,destinationHelperRadius:0,destinationHelperColor:Je.fromHexAndA(3728051,1)}}});function gc(t,...e){let i={};for(let n of e.flat())t!=null&&n in t&&(i[n]=t[n]);return i}function $O(t){t.layers.forEach(e=>{if(e.type==="depth"&&e.colorA!==void 0){let i=e.colorA,n=e.colorB,r=[[i.r,i.g,i.b,i.a],[n.r,n.g,n.b,n.a]],s=[0,1];for(let o=2;o<10;o++)r.push(r[1]),s.push(1);let a={...gc(un(e),"type","visible","isVector","isWorldSpace","origin","alpha","mode"),near:Math.max(0,e.near),far:Math.max(0,e.far),colors:r,steps:s,num:2,direction:[1,0,0],smooth:!1,gradientType:1};Object.assign(e,a)}else if(e.type==="depth"&&e.gradientType===1&&(e.near<0||e.far<0)){let i={...un(e),near:Math.max(e.near,0),far:Math.max(e.far,0)};Object.assign(e,i)}})}function Go(t,e){Object.values(t.shared.materials).forEach(i=>e(i))}function Ho(t,e){t.scene.objects.traverse((i,n)=>{"materials"in n?n.materials.forEach((r,s)=>{r===void 0&&(n.materials[s]=Vi.defaultTwoLayerData("phong"),r=n.materials[s]),typeof r!="string"&&e(r)}):"material"in n?typeof n.material!="string"&&(n.material===void 0&&(n.material=Vi.defaultTwoLayerData("phong")),e(n.material)):n.type==="Mesh"&&(n.material===void 0&&(n.material=Vi.defaultTwoLayerData("phong")),e(n.material)),"overrides"in n&&Object.values(n.overrides).forEach(r=>{r.material&&typeof r.material!="string"&&Object.getPrototypeOf(r.material)!==$i.prototype&&e(r.material)})})}function YO(t){t.layers===void 0&&Object.assign(t,Vi.defaultTwoLayerData("lambert"))}function FS(t){!t.layers||t.layers.forEach(e=>{if(e.type==="depth"&&e.colors.length===10){let i=[...e.colors];i.push(e.colors[9]);let n=[...e.steps];n.push(e.steps[9]);let r={...un(e),colors:i,steps:n};Object.assign(e,r)}})}function ZO(t){t.scene.objects.traverse((e,i)=>{"materials"in i?i.materials.forEach(n=>{typeof n!="string"&&FS(n)}):"material"in i&&typeof i.material!="string"&&FS(i.material)}),Object.values(t.shared.materials).forEach(e=>FS(e))}function KO(t){t.layers&&t.layers.forEach(e=>{e.type==="depth"&&e.num!==void 0&&(e.colors=e.colors.slice(0,e.num),e.steps=e.steps.slice(0,e.num),delete e.num)})}function QO(t){t.layers&&t.layers.forEach(e=>{(function(i){return i.type!=="displace"})(e)&&e.isMask===void 0&&(e.isMask=!1),(e.type==="texture"||e.type==="video")&&e.blending===void 0&&(e.blending=0),(e.type==="noise"||e.type==="displace"&&e.displacementType==="noise")&&(e.voronoiStyle===void 0&&(e.voronoiStyle=0),e.highCut===void 0&&(e.highCut=1),e.lowCut===void 0&&(e.lowCut=0),e.smoothness===void 0&&(e.smoothness=.3),e.seed===void 0&&(e.seed=0),e.quality===void 0&&(e.quality=1))})}function JO(t){let e=t.layers.find(i=>i.type==="light")?.data;if(e?.category==="basic"){let i=tn.defaultData("light","phong"),n=e;Object.assign(n,i),n.visible=!1}}function t4(t){Go(t,JO),Ho(t,JO)}function e4(t){t.layers.forEach(e=>{e.type==="light"&&e.category!=="toon"&&e.occlusion===void 0&&(e.occlusion=!0)})}function i4(t){t.layers&&t.layers.forEach(e=>{e.type==="light"&&e.bumpMapIntensity===void 0&&(e.bumpMapIntensity=5)})}var J$=z(()=>{r0(),bs(),r3(),cx(),Ye(),dx(),Dn(),tt(),e3(),o3(),UN(),s3(),t3(),n3()}),VN={};function n4(t){t.layers&&t.layers.forEach(e=>{e.type==="light"&&e.alphaOverride===void 0&&(e.alphaOverride=1)})}function jN(t){let e=t.geometry;e!==void 0&&XN.has(e.type)&&e.extrusionVersion===void 0&&(e.extrusionVersion=1)}function r4(t,e){let[i,n,r]=t,s=Math.cos(i),a=Math.sin(i),o=Math.cos(n),l=Math.sin(n),c=Math.cos(r),h=Math.sin(r),d=[o*c,s*h+a*c*l,a*h-s*c*l],u=Math.hypot(e[0],e[1],e[2])||1;return Math.abs((d[0]*e[0]+d[1]*e[1]+d[2]*e[2])/u)}function GN(t){(function(i){i.rotation=i.rotation.slice(0,3).map(n=>n*kl)})(t),t.type==="Page"&&function(i){let n=i.rotation.slice(0,3);(function(r,s){let a=Array.isArray(s)&&s.length>=3&&s.every(c=>typeof c=="number"&&Number.isFinite(c))?s:[0,1,0],o=r4(r,a),l=r4(r.map(c=>c*$N),a);return Math.abs(o-l)<1e-6?r.some(c=>Math.abs(c)>Math.PI):l<o})(n,i.up)?i.rotation=n:i.rotation=n.map(r=>r*kl)}(t.camera),t.states?.forEach(i=>{i.rotation===void 0||i.rotation===null||(i.rotation=i.rotation.slice(0,3).map(n=>n*kl))});let e=t.geometry;e&&e.type==="SphereGeometry"&&(e.thetaLength=(e.thetaLength??180)*kl),e&&e.type==="TorusGeometry"&&(e.arc=e.arc*kl),e&&e.type==="PathGeometry"&&(e.extrusion.angle*=kl,e.extrusion.twist*=kl),t.type==="Mesh"&&t.geometry.type==="TextGeometry"&&(t.geometry.text={textValue:t.geometry.text}),Array.isArray(un(t.events))&&t.events?.forEach(i=>{(i.type==="MouseDown"||i.type==="MouseUp"||i.type==="MousePress"||i.type==="KeyDown"||i.type==="KeyUp"||i.type==="KeyPress"||i.type==="Collision"||i.type==="Trigger")&&(i.runMode=i.toggle?"Toggle":"Repeat")})}function tY(t){t.scene.objects.traverse((e,i)=>{})}function eY(t){let e=t.schema??104;e!==132&&e<130&&(cb(t.asset),t.schema=130)}function Sc(t,e){e(t.data);for(let i of t.children)Sc(i,e)}function HN(t){let e=t.schema??104;e!==132&&(e<105&&(Sc(t.asset,GN),t.schema=105),e<118&&(Sc(t.asset,qN),t.schema=118),e<121&&(Sc(t.asset,BA),t.schema=121),e<130&&(Sc(t.asset,iY),t.schema=130),e<132&&(Sc(t.asset,jN),t.schema=132))}function WN(t,e){Ho(t,e),Go(t,e),Object.values(t.shared.lib.materials).forEach(i=>e(i.asset))}function cb(t){t.layers===void 0&&Object.assign(t,Vi.defaultTwoLayerData("phong"))}function iY(t){"materials"in t?t.materials.forEach(e=>{e!==void 0&&typeof e!="string"&&cb(e)}):"material"in t&&t.material!==void 0&&typeof t.material!="string"&&cb(t.material)}function qN(t){t.timelineAnimations=Ar({},te.prototype)}function nY(t){let e=[];return t?(t.forEach((i,n)=>{let{path:r,keyframes:s}=i.data,a=r[0]==="material"?i.id:void 0;s?.length?s.forEach(({id:o,data:l})=>{e.push({id:o,data:{...l,path:r,layerId:a,index:n}})}):e.push(Nc.placeholderKeyframe(i.id,r,{layerId:a,index:n}))}),e.sort((i,n)=>i.data.time-n.data.time),new Vt(...e.map((i,n)=>({...i,fi:n})))):new Vt}function rY(t){for(let{id:e,data:i}of[...t.unproxy()]){let n=i.path?.[0];if(!n||!YN.includes(n))continue;let r=LA(i.value);if(!r.length)continue;let s=t.data(e);if(!s)continue;let a=i.value,[o,...l]=r;for(let c of l){let h=Ot.generateUUID();t.insertBefore(null,[{id:h,data:{...i,id:h,path:[n,c],value:a[c],easing:sY(i.easing)}}])}s.path=[n,o],s.value=a[o]}}function LA(t){return t===null||typeof t!="object"?[]:Wg.filter(e=>e in t)}function sY(t){let e=t?.cubicControls;return{...t,cubicControls:{control1:[...e?.control1??[0,0]],control2:[...e?.control2??[1,1]]},...t?.springParameters?{springParameters:{...t.springParameters}}:{}}}function aY(t,e){return Math.abs(t[0]-e[0])<1e-6&&Math.abs(t[1]-e[1])<1e-6}function oY(t){let e=function(s){let a=[];for(let o of Nc.groupKeyframes(s)){let l=new Set(o.keyframes.flatMap(h=>LA(h.data.value))),c=l.size?[...l].map(h=>o.keyframes.filter(d=>LA(d.data.value).includes(h))):[o.keyframes];for(let h of c){let d=[...h].sort((u,p)=>u.data.time-p.data.time);for(let u=0;u+1<d.length;u++)a.push({left:d[u],right:d[u+1]})}}return a}([...t.unproxy()]),i=new Map,n=new Set;for(let{left:s,right:a}of e){let o=s.data.easing?.type,l=(o===void 0?void 0:Nc.presetHandles(o))?.control2??(o===5?Fc(a.data.easing?.cubicControls?.control2,[1,1]):void 0);if(!l)continue;let c=i.get(a.id);c?aY(c,l)||n.add(a.id):i.set(a.id,l)}let r=new Map;for(let{id:s,data:a}of t.unproxy()){let o=a.easing?.type,l=o===void 0?void 0:Nc.presetHandles(o);l&&r.set(s,l.control1)}for(let{left:s,right:a}of e)n.has(a.id)&&r.delete(s.id);for(let[s,a]of r){let o=t.data(s);!o?.easing||(o.easing.cubicControls={control1:a,control2:Fc(o.easing.cubicControls?.control2,[1,1])},o.easing.type=5)}for(let{left:s,right:a}of e){if(!r.has(s.id))continue;let o=t.data(a.id),l=i.get(a.id);!o?.easing||!l||(o.easing.cubicControls={control1:Fc(o.easing.cubicControls?.control1,[0,0]),control2:l})}}function s4(t,e){t.scene.objects.traverse((i,n)=>{let r=n;if(r.type==="Page"&&r.timelines)for(let s of Object.values(r.timelines))for(let a of Object.values(s.objectTimelines??{}))e(a.keyframes)})}function BA(t){t.pivot=[0,0,0],t.pivotRotation=[0,0,0]}function lY(t){}function hY(t){let e=t.schema??0;if(e!==132){if(e>132)return void console.error(`This scene was created with a newer version of Spline (file format ${e}, this runtime reads 132). Update @splinetool/runtime to the latest version to load it correctly.`);console.warn("updating from ",e,"to ",132),function(i,n){if(n<1&&(Ho(i,$O),Go(i,$O),i.schema=1),n<2&&(function(r){Object.assign(r.scene.publish,{orbitControls:{...ob.defaultData,...un(r.scene.publish.orbitControls)}})}(i),i.schema=2),n<3&&(function(r){function s(a){if(a.layers){for(let o of Object.values(a.layers))if(o){for(let[l,c]of Object.entries(o))if((hx.includes(l)||typeof c=="boolean")&&delete o[l],l==="texture")for(let[h,d]of Object.entries(c))(QC.includes(h)||typeof d=="boolean")&&delete c[h]}}}r.scene.objects.traverse((a,o)=>{o.states.forEach(l=>{let c=l;c.material?s(c.material):c.materials&&c.materials.forEach(h=>{s(h)})})})}(i),i.schema=3),n<4&&(function(r){r.scene.publish.withBackground=!0}(i),i.schema=4),n<5&&(function(r){r.scene.publish.settings.web={compress:!0,preload:!0,preset:1,logo:!0,hint:!1}}(i),i.schema=5),n<6&&(function(r){r.scene.objects.traverse((s,a)=>{let o=a.cloner;o&&(o.radial.scale=o.radial.scale.map(l=>l+1),o.linear.scale=o.linear.scale.map(l=>l+1))})}(i),i.schema=6),n<7&&(function(r){r.scene.objects.traverse((s,a)=>{let o=a.geometry;o&&(o.type==="DodecahedronGeometry"||o.type==="IcosahedronGeometry")&&(o.detail=Math.round(o.detail))})}(i),i.schema=7),n<8&&(i.schema=8),n<9&&(ZO(i),i.schema=9),n<10&&(function(r){r.scene.objects.traverse((s,a)=>{a.type==="Mesh"&&(a.geometry.type==="BooleanGeometry"||a.geometry.type==="SubdivGeometry")&&(a.geometry.phongAngle=35)})}(i),i.schema=10),n<11&&(function(r){r.scene.environment.ambientLight.softShadows=!1,r.scene.environment.ambientLight.softShadowQuality="low",r.scene.objects.traverse((s,a)=>{(a.type==="DirectionalLight"||a.type==="SpotLight")&&(a.shadowResolution=1024,a.shadowRadius=1,a.depth=1e5)}),r.shared.penumbraSize=new Array(5).fill(.5)}(i),i.schema=11),n<12&&(ZO(i),i.schema=12),n<13&&(function(r){r.shared.audios=Ar({},te.prototype)}(i),i.schema=13),n<14&&(function(r){let s=r.shared.materials;Object.entries(s).forEach(([a,o])=>{if(!o.layers){let l={name:"Untitled Material",layers:[{fi:0,data:{type:"light",category:"phong",alpha:.6,visible:!0,mode:0,specular:{r:.2,g:.2,b:.2},shininess:5},id:"layer1"},{fi:1,data:{type:"color",alpha:1,visible:!0,mode:0,color:{r:.2823529411764706,g:.2823529411764706,b:.30196078431372547}},id:"layer2"}]};Object.assign(s,{[a]:l})}})}(i),i.schema=14),n<15&&(function(r){Object.entries(un(r.shared.images)).filter(s=>s[1].asset===!1).map(s=>s[0]).forEach(s=>{delete r.shared.images[s]}),Object.entries(un(r.shared.audios)).filter(s=>s[1].asset===!1).map(s=>s[0]).forEach(s=>{delete r.shared.audios[s]})}(i),i.schema=15),n<16&&(function(r){r.scene.publish.settings.web.preload=!1}(i),i.schema=16),n<17&&(Ho(i,KO),Go(i,KO),i.schema=17),n<18&&(Ho(i,YO),Go(i,YO),i.schema=18),n<19&&(function(r){Object.assign(r.scene.publish.settings,{video:{...rl.defaultData.settings.video,...un(r.scene.publish.settings.video)}})}(i),i.schema=19),n<20&&(function(r){r.shared.fonts=Ar({},te.prototype)}(i),function(r){let s=[];r.scene.objects.traverse((a,o)=>{let l=o;if(l.type==="TextFrame"){let c=Vi.defaultTwoLayerData("phong"),h=typeof l.color=="string"?r.shared.colors[l.color]:l.color;c.layers[1].data.color={r:h.r,g:h.g,b:h.b},c.layers[1].data.alpha=l.alpha;let d=function(f){return f.replace(".typeface","").replace(/optimer/gi,"open sans").replace("space_mono","space mono").replace(/alma_mono/gi,"varela round").replace(/droid_sans_mono/gi,"noto sans mono").replace(/droid_sans|gentilis|gnomon_(simple|foreground)|helvetiker/gi,"roboto").replace(/droid_serif/gi,"roboto slab").replace("_sans"," sans").replace("crimson_text","crimson text").replace("medium_medium","medium").replace("fatface_fatface","fatface").replace("100hairline","thin").replace("200thin","extralight").replace("300light","light").replace("500medium","medium").replace("600semi","semibold").replace("800heavy","extrabold").replace("900black","black").replace(/bodoni_(11|16|24|36|48|72|96)([^_])/gi,"bodoni_$1_$2").replace(/bodoni_(11|16|24|36|48|72|96)/gi,"bodoni moda").replace(/(thin|hairline)(_regular)?/gi,"100").replace(/(extra|ultra)light(_regular)?/gi,"200").replace(/light(_regular)?/gi,"300").replace(/_book|_normal|_roman/gi,"_regular").replace(/medium(_regular)?/gi,"500").replace(/(semi|demi)bold(_regular)?/gi,"600").replace(/(extra|ultra)bold(_regular)?/gi,"800").replace(/bold(_regular)?/gi,"700").replace(/(black|heavy|fatface)(_regular)?/gi,"900").replace(/([1-9]00)_italic/gi,"$1italic").replace(/regularitalic/gi,"italic").replace(/regularitalic/gi,"italic").split(" ").map(g=>g.charAt(0).toUpperCase()+g.slice(1)).join(" ")}(l.font);r.shared.fonts[d]===void 0&&(r.shared.fonts[d]={name:d});let u={name:l.name,...An.defaultData,...Wa.defaultData,flatShading:!1,wireframe:!1,geometry:{...Yo.defaultData("TextGeometry"),width:l.width,height:l.height,font:d,depth:0,horizontalAlign:l.horizontalAlign,verticalAlign:l.verticalAlign,fontSize:1.40625*l.fontSize,lineHeight:l.lineHeight/1.40625,letterSpacing:l.letterSpacing-1,text:l.text,textTransform:l.textTransform,extrudeBevelSize:0,extrudeBevelSegments:1},material:c,states:un(l.states),events:un(l.events),visible:l.visible,raycastLock:l.raycastLock,position:l.position,rotation:l.rotation,scale:l.scale,hiddenMatrix:l.hiddenMatrix},p=un(r.scene.objects).parent(a);r.scene.objects.insertAfter(p??null,a,[{id:a+"new",data:u,children:[]}]),s.push(a)}}),s.forEach(a=>{r.scene.objects.delete(a)})}(i),i.schema=20),n<21&&(function(r){let s={0:"MouseDown",1:"MouseUp",2:"MouseHover",5:"KeyDown",6:"KeyUp",7:"Start",9:"LookAt",10:"Follow",11:"Scroll",12:"Audio",13:"GameControl"};r.scene.objects.traverse((a,o)=>{o.events.forEach(l=>{if(s[Number(l.type)])if(Object.assign(l,{type:s[Number(l.type)]}),l.type==="Audio"&&"audioEvent"in l&&(Object.assign(l,{playAudio:l.audioEvent}),delete l.audioEvent),l.type==="GameControl")Object.assign(l,{gameActions:{idle:new Vt,move:new Vt,jump:new Vt}});else{let c=new Vt;Object.assign(l,{actions:c}),(l.type==="MouseDown"||l.type==="MouseUp"||l.type==="KeyDown"||l.type==="KeyUp")&&"url"in l&&c.push({fi:0,id:Ot.generateUUID(),data:{type:"Link",url:l.url,delay:0}}),"targets"in l&&(l.targets.forEach((h,d,u)=>{let p={easing:h.easing,duration:h.duration};h.easing===6?Object.assign(p,gc(h,"mass","stiffness","damping","velocity")):h.easing===5&&Object.assign(p,{control1:{...h.control1},control2:{...h.control2}});let f={repeat:h.repeat?-1:0,delay:h.delay,delayDirection:h.delayDirection,direction:h.cycle&&h.rewind?"pingpong-rewind":h.cycle?"pingpong":"normal"},g={state:h.state,...f,...p},m={allowSlerp:!0,type:"Transition",object:h.object,repeat:0,delay:0,delayDirection:void 0,direction:"normal",tweens:new Vt({fi:0,id:Ot.generateUUID(),data:{state:void 0,repeat:0,delay:0,delayDirection:void 0,direction:"normal",duration:0,easing:4}},{fi:1,id:Ot.generateUUID(),data:g})};c.push({fi:u,id:d,data:m})}),delete l.targets)}})})}(i),function(r){r.scene.objects.traverse((s,a)=>{function o(l,c){let h=new Vt,d=[];if(a.events.forEach((u,p,f)=>{if(u.type==="Audio"&&u.trigger===c){let g;d.push(p),u.interaction==="play"?g={...gc(u,"interaction","audio","delay","volume","loop"),triggerAfter:"after"in u?u.after:void 0,toggle:"after"in u?u.toggle:void 0,type:"Audio"}:(u.interaction==="pause"||u.interaction==="stop")&&(g={...gc(u,"interaction","delay","object","playAudio"),type:"Audio"}),g&&h.push({fi:f,id:p,data:g})}}),d.forEach(u=>a.events.delete(u)),h.length){let u=a.events.find(p=>p.type===l)?.data;u?"actions"in u&&u.actions.insertBefore(null,h):a.events.insertBefore(null,[{id:Ot.generateUUID(),data:{type:l,actions:h}}])}}o("Start","start"),o("MouseDown","mouseDown"),o("MouseUp","mouseUp"),o("KeyDown","keyDown"),o("KeyUp","keyUp")})}(i),i.schema=21),n<22&&(t4(i),i.schema=22),n<23&&(function(r){r.scene.objects.traverse((s,a)=>{a.type==="Mesh"&&a.geometry.type==="SubdivGeometry"&&(a.geometry.scaleBaked||(a.geometry.scaleBaked=[1,1,1]))})}(i),i.schema=23),n<24&&(function(r){r.scene.objects.traverse((s,a)=>{(a.type==="Empty"||a.type==="Mesh")&&a.cloner&&!a.cloner.randomnessObject&&!a.cloner.toObject&&!a.cloner.randomness&&(a.cloner={...a.cloner,toObject:{object:"",spreadType:"random",scale:[0,0,0],rotation:[0,0,0],position:[0,0,0],axis:"x",seed:0,count:99,align:"normal"},randomness:!1,randomnessObject:{strength:100,scale:[0,0,0],rotation:[0,0,0],position:[0,0,0],movement:1,seed:0,freqScale:10,noiseType:"perlin"}})})}(i),i.schema=24),(n<25||i.shared.videos===void 0)&&(function(r){r.shared.videos=Ar({},te.prototype)}(i),n<25&&(i.schema=25)),n<26&&(function(r){r.scene.objects.traverse((s,a)=>{let o=r.scene.objects.unproxy().parent(s);if(o){let l=un(r.scene.objects.data(o));l&&l.type==="Mesh"&&l.geometry.type==="BooleanGeometry"&&a.type==="Mesh"&&(a.visible=un(a).booleanExclude!==!0)}})}(i),i.schema=26),n<27&&(function(r){r.scene.objects.traverse((s,a)=>{if(a.type==="Mesh"){let o=a;a.geometry.type==="NonParametricGeometry"?o.material!==void 0&&delete o.material:o.materials!==void 0&&delete o.materials}})}(i),i.schema=27),n<28&&(t4(i),i.schema=28),n<29&&(function(r){function s(o){Object.setPrototypeOf(o,$i.prototype),o.texture&&Object.setPrototypeOf(o.texture,$i.prototype)}function a(o){Object.setPrototypeOf(o,$i.prototype);for(let l in o)s(o[l])}r.scene.objects.traverse((o,l)=>{l.states.forEach(c=>{let h=c;if(h.material){let d=un(h.material).layers;a(d),h.material.layers=d}if(h.materials)for(let d=0;d<h.materials.length;d++){let u=h.materials[d],p=un(u).layers;a(p),u.layers=p}})})}(i),i.schema=29),n<30&&(function(r){r.scene.objects.traverse((s,a)=>{a.type==="Mesh"&&a.geometry.type==="NonParametricGeometry"&&!("material"in a)&&!("materials"in a)&&(a.material=Vi.defaultTwoLayerData("phong"))})}(i),i.schema=30),n<31&&(function(r){r.scene.publish.orbitControls.autoZoom===void 0&&(r.scene.publish.orbitControls.autoZoom=!1),r.scene.objects.traverse((s,a)=>{(a.type==="OrthographicCamera"||a.type==="PerspectiveCamera")&&(a.orthographic.autoZoom===void 0&&(a.orthographic.autoZoom=!1),a.orthographic.autoZoomFrustumSize===void 0&&(a.orthographic.autoZoomFrustumSize=790))})}(i),i.schema=31),n<33&&(function(r){r.scene.objects.traverse((s,a)=>{a.pathSnapping===void 0&&(a.pathSnapping={pathId:null,slide:0,offset:0,orientation:"tangential"}),a.pathSnapping.offset===void 0&&(a.pathSnapping.offset=0)})}(i),i.schema=33),n<34&&(function(r){r.scene.publish.mouseEventTarget===void 0&&(r.scene.publish.mouseEventTarget="canvas"),r.scene.publish.settings.web.hint===void 0&&(r.scene.publish.settings.web.hint=!1)}(i),i.schema=34),n<35&&(function(r){let{video:s}=r.scene.publish.settings;s.format==="gif"&&s.fps>48&&(s.fps=15)}(i),i.schema=35),n<36&&(function(r){r.scene.objects.traverse((s,a)=>{a.events.forEach(o=>{o.type==="GameControl"&&(o.resetYPosition=Math.abs(o.resetYPosition-a.position[1]))})})}(i),i.schema=36),n<37&&(function(r){let s=r.scene.environment.usePhysics;r.scene.objects.traverse((a,o)=>{s&&o.physics===null?o.collision=!1:o.collision="visibility"})}(i),i.schema=37),n<38&&(Ho(i,QO),Go(i,QO),i.schema=38),n<39&&(function(r){r.scene.objects.traverse((s,a)=>{a.events.forEach(o=>{o.type==="GameControl"&&(o.navmesh=hb.defaultDataThirdPerson.navmesh)})})}(i),i.schema=39),n<40&&(function(r){r.scene.styles||(r.scene.styles=Mc.defaultData())}(i),i.schema=40),n<41&&(function(r){r.scene.environment.ambientLight.occlusion===void 0&&(r.scene.environment.ambientLight.occlusion=!1),r.scene.environment.ambientLight.aoFullRes===void 0&&(r.scene.environment.ambientLight.aoFullRes=!1),r.scene.environment.ambientLight.radius===void 0&&(r.scene.environment.ambientLight.radius=256),r.scene.environment.ambientLight.bias===void 0&&(r.scene.environment.ambientLight.bias=.5),r.scene.environment.ambientLight.aoColor===void 0&&(r.scene.environment.ambientLight.aoColor={r:.19607843137254902,g:.19607843137254902,b:.19607843137254902}),Ho(r,e4),Go(r,e4)}(i),i.schema=41),n<42&&(function(r){r.scene.objects.traverse((s,a)=>{a.events.forEach(o=>{o.type==="GameControl"&&Object.assign(o.gameActions,{run:new Vt})})})}(i),i.schema=42),n<43&&(function(r){r.scene.objects.traverse((s,a)=>{a.events.forEach(o=>{o.type==="GameControl"&&(o.keyAssignments=[...o.keyAssignments,["run","\u21E7"],["none","Ctrl"]])})})}(i),i.schema=43),n<99){Ho(i,i4),Go(i,i4),i.scene.publish.playCamera===null&&(i.scene.publish.playCamera=ed);let r=un(i.scene.objects),s=i.scene.objects;i.scene.publish.playPage=Yu,s.insertBefore(null,null,[{id:Yu,data:{...zc.defaultData,backgroundColor:i.scene.backgroundColor,fog:i.scene.fog,postprocessing:i.scene.postprocessing,ao:gc(i.scene.environment.ambientLight,"occlusion","aoFullRes","radius","bias","aoColor"),publish:{playCamera:i.scene.publish.playCamera,gameControlObject:i.scene.publish.gameControlObject},shadow:gc(i.scene.environment.ambientLight,"softShadowQuality"),globalPhysics:{...Qu.defaultData,...gc(i.scene.environment,"usePhysics","gravity")},camera:un(i.scene.ownerCamera)??zc.defaultData.camera,name:"Scene"},children:[]}]);for(let l of r)l.id!==Ec.TRASH_CAN_ID&&s.move(Yu,l.fi,l.id);let a=0,o=0;i.shared.penumbraSize&&i.scene.objects.traverse((l,c)=>{c.type==="DirectionalLight"?(c.penumbraSize=i.shared.penumbraSize[Math.min(a,2)],a+=1):c.type==="SpotLight"&&(c.penumbraSize=i.shared.penumbraSize[3+Math.min(o,1)],o+=1),(c.physics===void 0||c.physics===null)&&c.type!=="Instance"&&(c.physics={},Object.assign(c.physics,Ku.defaultData)),c.physics!==void 0&&c.physics!==null&&(c.physics.enabled=c.collision??"visibility",delete c.collision)}),i.schema=99}}(t,e),e<100&&(t.scene.publish.joystickSizeAndXYOffset===void 0&&(t.scene.publish.joystickSizeAndXYOffset=rl.defaultData.joystickSizeAndXYOffset),t.schema=100),e<101&&(Ho(t,n4),Go(t,n4),t.schema=101),e<102&&(function(i){i.scene.objects.traverse((n,r)=>{let s=r.geometry;s&&s.type==="PathGeometry"&&(s.extrusion.capType="flat",s.extrusion.bevel=50,s.extrusion.bevelSides=6,s.extrusion.shape.type==="Custom"&&(s.extrusion.shape.shapeQuality="low"))})}(t),t.schema=102),e<104&&(t.shared.catelogs=new te,t.shared.lib=Zo.defaultData(),t.schema=104),e<105&&(function(i){i.shared.variables=Ar({},te.prototype)}(t),t.scene.objects.traverse((i,n)=>{GN(n)}),t.schema=105);for(let i of Object.values(t.shared.lib.components))HN(i);e<106&&(function(i){let n=un(i.shared.variables);i.shared.variables=Ar(Object.entries(n??{}).map(([r,s],a)=>({fi:a,id:r,data:s})),Vt.prototype)}(t),t.schema=106),e<107&&(t.shared.lib.variables=Zo.defaultData().variables,t.schema=107),e<109&&(function(i){i.shared.particles=Ar({},te.prototype),i.shared.lib&&(i.shared.lib.particles=Zo.defaultData().particles)}(t),t.schema=109),e<110&&(function(i){i.scene.objects.traverse((n,r)=>{r.type==="Particle"&&typeof r.renderMaterial.size=="number"&&Object.assign(r.renderMaterial,{size:[r.renderMaterial.size,r.renderMaterial.size]})})}(t),t.schema=110),e<111&&(t.scene.objects.traverse((i,n)=>{(function(r){Array.isArray(un(r.events))&&r.events?.forEach(s=>{"disabled"in s||(s.disabled=!1),(s.type==="MouseDown"||s.type==="MouseUp"||s.type==="MousePress")&&(s.mode=s.mode||"Object")})})(n)}),t.schema=111),e<112&&(function(i){i.scene.objects.traverse((n,r)=>{r.type==="Page"&&(r.postprocessing.depthOfField.focusDistance=100,r.postprocessing.depthOfField.focalLength=20,r.postprocessing.depthOfField.bokehScale=5)})}(t),t.schema=112),e<113&&(function(i){i.scene.objects.traverse((n,r)=>{Array.isArray(un(r.events))!==!1&&r.events?.forEach(s=>{let a=s.runMode;s.type==="MouseDown"||s.type==="MouseUp"||s.type==="KeyDown"||s.type==="KeyUp"||s.type==="Collision"||s.type==="Trigger"?s.actions?.forEach(o=>{o.type==="Transition"&&(o.runMode=a??"Repeat"),(o.type==="Animation"&&"runMode"in o||o.type==="SwitchCamera")&&(o.runMode=a==="Toggle"?"Toggle":"Normal")}):s.type==="MouseHover"||s.type==="MousePress"||s.type==="KeyPress"?s.actions?.forEach(o=>{(o.type==="Transition"||o.type==="Animation"&&"runMode"in o||o.type==="SwitchCamera")&&(o.runMode="Toggle")}):s.type==="GameControl"?(delete s.actions,Object.keys(s.gameActions).forEach(o=>{s.gameActions[o]?.forEach(l=>{l.type==="Transition"&&(l.runMode="Repeat"),l.type==="Animation"&&"runMode"in l&&(l.runMode="Normal")})})):s.type==="DragDrop"?(delete s.actions,s.dragDropActions?.drag?.forEach(o=>{(o.type==="Transition"||o.type==="Animation"&&"runMode"in o||o.type==="SwitchCamera")&&(o.runMode="Toggle")}),s.dragDropActions?.drop?.forEach(o=>{(o.type==="Transition"||o.type==="Animation"&&"runMode"in o||o.type==="SwitchCamera")&&(o.runMode="Toggle")})):s.type==="Resize"?(delete s.actions,s.breakpoints?.forEach(o=>{o.actions?.forEach(l=>{(l.type==="Transition"||l.type==="Animation"&&"runMode"in l||l.type==="SwitchCamera")&&(l.runMode="Toggle")})})):s.type==="Start"?s.actions?.forEach(o=>{o.type==="Transition"&&(o.runMode="Once"),(o.type==="Animation"&&"runMode"in o||o.type==="SwitchCamera")&&(o.runMode="Normal")}):s.type==="VariableChange"||s.type==="Scroll"?s.actions?.forEach(o=>{o.type==="Transition"&&(o.runMode="Repeat"),(o.type==="Animation"&&"runMode"in o||o.type==="SwitchCamera")&&(o.runMode="Normal")}):s.type==="Conditional"&&(delete s.actions,s.inActions?.forEach(o=>{o.type==="Transition"&&(o.runMode="Repeat"),(o.type==="Animation"&&"runMode"in o||o.type==="SwitchCamera")&&(o.runMode="Normal")}),s.outActions?.forEach(o=>{o.type==="Transition"&&(o.runMode="Repeat"),(o.type==="Animation"&&"runMode"in o||o.type==="SwitchCamera")&&(o.runMode="Normal")}))})})}(t),t.schema=113),e<114&&(t.scene.publish.settings.web.imageQuality===void 0&&(t.scene.publish.settings.web.imageQuality=70),t.schema=114),e<115&&(function(i){i.shared.userAPIs=Ar({},te.prototype),i.shared.userWebhooks=Ar({},te.prototype),i.shared.lib&&(i.shared.lib.userAPIs=Zo.defaultData().userAPIs,i.shared.lib.userWebhooks=Zo.defaultData().userWebhooks)}(t),t.schema=115),e<116&&(function(i){i.scene.publish.settings.videoStatic===void 0&&(i.scene.publish.settings.videoStatic=rl.defaultData.settings.videoStatic)}(t),t.schema=116),e<117&&(t.scene.publish.settings.web.pixelRatioMobile===void 0&&(t.scene.publish.settings.web.pixelRatioMobile=0),t.scene.publish.settings.web.pixelRatioDesktop===void 0&&(t.scene.publish.settings.web.pixelRatioDesktop=0),t.schema=117),e<118&&(t.shared.timelineAnimations=Ar({},te.prototype),t.scene.objects.traverse((i,n)=>{qN(n)}),t.schema=118),e<119&&(t.scene.publish.settings.videoStatic.format=Ju.defaultData.scene.publish.settings.videoStatic.format,t.scene.publish.settings.videoStatic.imageFormat=Ju.defaultData.scene.publish.settings.videoStatic.imageFormat,t.schema=119),e<120&&(t.scene.publish.settings.image.colorSpace="display-p3",t.scene.publish.settings.videoStatic.colorSpace="display-p3",t.schema=120),e<121&&(t.scene.objects.traverse((i,n)=>{BA(n),n.type==="Page"&&n.camera!==void 0&&BA(n.camera)}),t.schema=121),e<122&&(delete t.scene.publish.settings.video,t.scene.publish.orbitControls.rotationSpeed=Ju.defaultData.scene.publish.orbitControls.rotationSpeed,t.schema=122),e<123&&(t.scene.objects.traverse((i,n)=>{n.type==="Page"&&n.sky===void 0&&(n.sky=ql.defaultData)}),t.schema=123),e<124&&(e>=123&&t.scene.objects.traverse((i,n)=>{let r=n.sky;n.type==="Page"&&r!==void 0&&(typeof r.exposure=="number"&&(r.exposure=Math.round(r.exposure/5e-4*1e4)/1e4),r.lighting===void 0&&(r.lighting=ql.defaultData.lighting))}),t.schema=124),e<125&&(t.scene.objects.traverse((i,n)=>{let r=n.sky;n.type==="Page"&&r!==void 0&&r.lightingIntensity===void 0&&(r.lightingIntensity=ql.defaultData.lightingIntensity)}),t.schema=125),e<126&&(t.scene.objects.traverse((i,n)=>{let r=n.sky;n.type==="Page"&&r!==void 0&&(r.mode===void 0&&(r.mode="physical"),r.hdri===void 0?r.hdri={...ql.defaultData.hdri}:(r.hdri.blur===void 0&&(r.hdri.blur=ql.defaultData.hdri.blur),Array.isArray(r.hdri.rotation)&&(r.hdri.rotation=r.hdri.rotation[1]??0)))}),t.schema=126),e<127&&(t.scene.objects.traverse((i,n)=>{let r=n.sky;n.type==="Page"&&r?.hdri!==void 0&&r.hdri.showBackground===void 0&&(r.hdri.showBackground=!0)}),t.schema=127),e<128&&(t.scene.objects.traverse((i,n)=>{let r=n.sky;n.type==="Page"&&r!==void 0&&r.lightingQuality===void 0&&(r.lightingQuality="full")}),t.schema=128),e<129&&(t.scene.objects.traverse((i,n)=>{if(n.type==="Page"){n.camera===void 0&&(n.camera=zc.defaultData.camera);let r=n.camera;r.far=1e5,r.perspective?r.perspective.near=70:r.perspective={near:70,fov:45,zoom:1}}}),t.schema=129),e<130&&(WN(t,cb),t.schema=130),e<131&&(function(i){i.scene.objects.traverse((n,r)=>{let s=r.states;if(!s)return;let a=r.timelineAnimations,o=[];s.forEach((l,c)=>{(l.isAnimation||a?.[c])&&o.push(c)}),o.forEach(l=>s.delete(l))})}(t),function(i){let n=i.shared,r=n.timelineAnimations;if(!r)return;let s=i.scene.objects,a=s.unproxy().find(o=>o.data.type==="Page")?.id;for(let[o,l]of Object.entries(r)){let c=Ar({},te.prototype),h=0,d=Boolean(l.loop);for(let[f,g]of Object.entries(l.mapping??{})){let m=s.data(f)?.timelineAnimations?.[g];!m||(h=Math.max(h,m.to??0),d=d||Boolean(m.loop),c[f]={id:f,keyframes:nY(m.properties?.unproxy())})}let u=l.page??a,p=u?s.data(u):void 0;p&&p.type==="Page"&&((p.timelines??(p.timelines=Ar({},te.prototype)))[o]={id:o,name:l.name,duration:h||5,...d?{loop:d}:{},objectTimelines:c})}delete n.timelineAnimations,s.traverse((o,l)=>{delete l.timelineAnimations})}(t),s4(t,rY),s4(t,oY),t.schema=131),e<132&&(t.scene.objects.traverse((i,n)=>jN(n)),t.schema=132)}}e0(VN,{updateAllMaterials:()=>WN,updateDocumentSchema:()=>hY,updateLibSchema:()=>lY,updateMaterialSchema:()=>eY,updateObjectStateRec:()=>Sc,updateObjectsSchema:()=>HN,updateTextValues:()=>tY});var XN,kl,$N,YN,a4,Sv,NS,o4,Mv,Ac,Ff,Fd,Ev,kS,C1,VS,jS,l4,P1,GS,kc,UA,ux=z(()=>{tt(),FN(),Ye(),kN(),J$(),dx(),r0(),Dn(),a3(),cx(),i3(),XN=new Set(["RectangleGeometry","EllipseGeometry","StarGeometry","PolygonGeometry","TriangleGeometry","VectorGeometry","TextGeometry","InputGeometry","PathGeometry"]),kl=180/Math.PI,$N=Math.PI/180,YN=["position","rotation","scale","shape size"]}),cY=z(()=>{var t,e,i;bs(),Ye(),Dn(),(a4||(a4={})).is=function(n){return!0},(t=Sv||(Sv={})).defaultData={position:[0,0],scale:[1,1],rotation:0,shear:[0,0]},t.merge=function(n,r){return{position:r?.position??n.position,rotation:r?.rotation??n.rotation,scale:r?.scale??n.scale,shear:r?.shear??n.shear}},t.diff=function(n,r){return eN({position:to.isEqual(n.position,r.position)?void 0:r.position,rotation:n.rotation===r.rotation?void 0:r.rotation,scale:to.isEqual(n.scale,r.scale)?void 0:r.scale,shear:n.shear&&r.shear&&to.isEqual(n.shear,r.shear)?void 0:r.shear})},(NS||(NS={})).defaultData={horizontalConstraint:0,verticalConstraint:0},(o4||(o4={})).defaultData={direction:"row",wrap:"unwrap",align:"top-left",gap:10,rowGap:10,autoGap:!1,autoRowGap:!1,leftPadding:8,rightPadding:8,topPadding:8,bottomPadding:8},(Mv||(Mv={})).defaultData={opacity:1,fill:{color:Je.fromHexAndA(Ir,1),enabled:!0},stroke:{color:Je.from0to1([0,0,0,1]),thickness:1,enabled:!1,mode:"inside"},layerBlur:{radius:2,enabled:!1},backgroundBlur:{radius:2,enabled:!1},dropShadow:{offset:[10,10],blurRadius:10,color:Je.from0to1([0,0,0,1]),enabled:!1,spread:0},innerShadow:{offset:[10,10],blurRadius:10,color:Je.from0to1([0,0,0,1]),enabled:!1,spread:0}},(e=Ac||(Ac={})).newEmpty=function(n,r){return{name:r}},e.patch=function(n,r){if(r===void 0)return n;let s={...n};return Object.assign(s,Sv.merge(s,r)),s=function(a,o){if(o===void 0)return a;let l={...a},c=["width","height","cornerRadius"];for(let h of c)h in l&&h in o&&o[h]!==void 0&&Object.assign(l,{[h]:o[h]});return l}(s,r),s=function(a,o){if(o===void 0)return a;let l={...a};return"fill"in l&&"fill"in o&&o.fill!==void 0&&Object.assign(l,{fill:{...l.fill,...o.fill}}),"stroke"in l&&"stroke"in o&&o.stroke!==void 0&&Object.assign(l,{stroke:{...l.stroke,...o.stroke}}),"layerBlur"in l&&"layerBlur"in o&&o.layerBlur!==void 0&&Object.assign(l,{layerBlur:{...l.layerBlur,...o.layerBlur}}),"backgroundBlur"in l&&"backgroundBlur"in o&&o.backgroundBlur!==void 0&&Object.assign(l,{backgroundBlur:{...l.backgroundBlur,...o.backgroundBlur}}),"dropShadow"in l&&"dropShadow"in o&&o.dropShadow!==void 0&&Object.assign(l,{dropShadow:{...l.dropShadow,...o.dropShadow}}),"innerShadow"in l&&"innerShadow"in o&&o.innerShadow!==void 0&&Object.assign(l,{innerShadow:{...l.innerShadow,...o.innerShadow}}),l}(s,r),s},e.toOps=function(n,r){let s,a=[];for(let[o,l]of Object.entries(r))o!=="name"&&(s===void 0&&(s={path:[],props:{},type:0},a.push(s)),s.props[o]=l);return a},(Ff||(Ff={})).defaultData={...Sv.defaultData,...NS.defaultData,states:new Vt,events:new Vt,visible:!0,raycastLock:!1},(Fd||(Fd={})).defaultData={...Ff.defaultData,...Mv.defaultData},(Ev||(Ev={})).defaultData={cornerRadius:[0,0,0,0]},(kS||(kS={})).defaultData={...Fd.defaultData,type:"ellipse2d",width:100,height:100,name:"Ellipse"},(C1||(C1={})).defaultData={...Fd.defaultData,...Ev.defaultData,type:"rectangle2d",width:100,height:100,name:"Rectangle"},(VS||(VS={})).defaultData={...Fd.defaultData,type:"text2d",width:100,height:100,fontSize:12,lineHeight:1.2,letterSpacing:0,text:{textValue:"Hello world"},horizontalAlign:1,verticalAlign:1,textTransform:1,font:"Roboto_regular",name:"Text"},(jS||(jS={})).defaultData={...Fd.defaultData,type:"path2d",path:"",name:"Path"},(l4||(l4={})).is=function(n){return n.type==="ellipse2d"||n.type==="rectangle2d"||n.type==="text2d"||n.type==="vector2d"||n.type==="path2d"},(P1||(P1={})).defaultData={...Ff.defaultData,name:"Group",type:"group2d"},(GS||(GS={})).defaultData=()=>({...Ff.defaultData,...Ev.defaultData,...Mv.defaultData,name:"Frame",type:"frame2d",clipped:!0,width:200,height:200,fill:{color:Je.fromHexAndA(4737101,1),enabled:!0},stroke:{color:Je.fromHexAndA(0,1),thickness:1,enabled:!1,mode:"inside"},backgroundBlur:{radius:2,enabled:!1},layerBlur:{radius:2,enabled:!1}}),(n=>{n.defaultData=function(r){switch(r){case"rectangle2d":case"vector2d":return{...C1.defaultData};case"ellipse2d":return{...kS.defaultData};case"text2d":return{...VS.defaultData};case"path2d":return{...jS.defaultData};case"frame2d":return{...GS.defaultData()};case"group2d":return{...P1.defaultData}}},n.getPivot=function(r){return"width"in r&&"height"in r?[typeof r.width=="number"?.5*r.width:0,typeof r.height=="number"?.5*r.height:0]:[0,0]},n.isResizeable=function(r){return r.type==="rectangle2d"||r.type==="ellipse2d"||r.type==="text2d"||r.type==="frame2d"},n.isAutoLayoutable=function(r){return r.type==="frame2d"&&r.autoLayout!==void 0},n.hasCorners=function(r){return r.type==="rectangle2d"||r.type==="frame2d"}})(kc||(kc={})),(i=UA||(UA={})).defaultData={name:"UI",type:"scene2d",objects:new Xn},i.emptyData=function(){return{type:"scene2d",objects:new Xn}}}),dY=z(()=>{q$(),X$(),EN(),AN(),FN(),xN(),Q$(),RN(),LN(),i3(),ux(),zN(),e3(),t3(),TN(),r0(),DN(),BN(),bs(),dx(),cx(),r3(),ON(),a3(),s3(),Y$(),IN(),o3(),n3(),CN(),PN(),cY()});function Tc(t,e=!1){let i=t[0].index!==null,n=new Set(Object.keys(t[0].attributes)),r=new Set(Object.keys(t[0].morphAttributes)),s={},a={},o=t[0].morphTargetsRelative,l=new jt,c=0;for(let h=0;h<t.length;++h){let d=t[h],u=0;if(i!==(d.index!==null))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+h+". All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them."),null;for(let p in d.attributes){if(!n.has(p))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+h+'. All geometries must have compatible attributes; make sure "'+p+'" attribute exists among all geometries, or in none of them.'),null;s[p]===void 0&&(s[p]=[]),s[p].push(d.attributes[p]),u++}if(u!==n.size)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+h+". Make sure all geometries have the same number of attributes."),null;if(o!==d.morphTargetsRelative)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+h+". .morphTargetsRelative must be consistent throughout all geometries."),null;for(let p in d.morphAttributes){if(!r.has(p))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+h+". .morphAttributes must be consistent throughout all geometries."),null;a[p]===void 0&&(a[p]=[]),a[p].push(d.morphAttributes[p])}if(e){let p;if(i)p=d.index.count;else{if(d.attributes.position===void 0)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+h+". The geometry must have either an index or a position attribute"),null;p=d.attributes.position.count}l.addGroup(c,p,h),c+=p}}if(i){let h=0,d=[];for(let u=0;u<t.length;++u){let p=t[u].index;for(let f=0;f<p.count;++f)d.push(p.getX(f)+h);h+=t[u].attributes.position.count}l.setIndex(d)}for(let h in s){let d=h4(s[h]);if(!d)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+h+" attribute."),null;l.setAttribute(h,d)}for(let h in a){let d=a[h][0].length;if(d!==0){l.morphAttributes=l.morphAttributes||{},l.morphAttributes[h]=[];for(let u=0;u<d;++u){let p=[];for(let g=0;g<a[h].length;++g)p.push(a[h][g][u]);let f=h4(p);if(!f)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+h+" morphAttribute."),null;l.morphAttributes[h].push(f)}}}return l}function h4(t){let e,i,n,r=-1,s=0;for(let c=0;c<t.length;++c){let h=t[c];if(e===void 0&&(e=h.array.constructor),e!==h.array.constructor)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.array must be of consistent array types across matching attributes."),null;if(i===void 0&&(i=h.itemSize),i!==h.itemSize)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes."),null;if(n===void 0&&(n=h.normalized),n!==h.normalized)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes."),null;if(r===-1&&(r=h.gpuType),r!==h.gpuType)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.gpuType must be consistent across matching attributes."),null;s+=h.count*i}let a=new e(s),o=new Ht(a,i,n),l=0;for(let c=0;c<t.length;++c){let h=t[c];if(h.isInterleavedBufferAttribute){let d=l/i;for(let u=0,p=h.count;u<p;u++)for(let f=0;f<i;f++){let g=h.getComponent(u,f);o.setComponent(u+d,f,g)}}else a.set(h.array,l);l+=h.count*i}return r!==void 0&&(o.gpuType=r),o}var s0=z(()=>{tt()});function ZN(t){let e=t.points.length/7,i=new Vt;for(let n=0;n<e;n++){let r=7*n,s=t.points[r+0],a=t.points[r+1],o=t.points[r+2],l=t.points[r+3],c=t.points[r+4],h=t.points[r+5],d=t.points[r+6];i.push({fi:n,id:Ot.generateUUID(),data:{roundness:d,position:[s,a],areControlsDirectionsMirrored:!0,controlPrevious:{position:[o,l]},controlNext:{position:[c,h]}}})}return{points:i,isClosed:t.isClosed,roundness:t.roundness,shapeHoles:t.shapeHoles?.map(n=>ZN(n))??[]}}function KN(t){let{userData:e,uuid:i,...n}=t;if(e===void 0||e.type==="NonParametricGeometry")return function(a){let o,{userData:l,data:c}=a,h=c?.groups,d=c?.attributes??{},u=c?.morphAttributes??{},p=c?.interleavedBuffers,f=c?.arrayBuffers,g=c?.index;d.position!==void 0&&Array.isArray(d.position.array)&&(o=function(v){let y=1/0,_=1/0,b=1/0,x=-1/0,w=-1/0,S=-1/0;for(let E=0;E<v.length;E+=3){let A=v[E],P=v[E+1],C=v[E+2];y=Math.min(y,A),_=Math.min(_,P),b=Math.min(b,C),x=Math.max(x,A),w=Math.max(w,P),S=Math.max(S,C)}return{width:x-y,height:w-_,depth:S-b}}(d.position.array));let m={...l===void 0?{}:l.parameters,data:{attributes:d,morphAttributes:u,interleavedBuffers:p,arrayBuffers:f},...o===void 0?{}:o,type:"NonParametricGeometry"};return g!==void 0&&Object.assign(m.data,{index:g}),h!==void 0&&Object.assign(m.data,{groups:h.map(v=>({...v,materialIndex:v.materialIndex??0}))}),m}(t);if(e.type==="SubdivGeometry"){let a="SubdivGeometry",o=n.data?.attributes;if(o?.positionWASM===void 0){let c=new jt;if(o?.position===void 0||o?.faceMap===void 0)return null;let h=o.position.array,d=o.faceMap.array,u=n.data.index.array;c.setAttribute("position",new Nt(h,3)),c.setIndex(new lh(u,1));let p=function(v,y=1e-4){y=Math.max(y,Number.EPSILON);let _={},b=v.getIndex(),x=v.getAttribute("position"),w=b?b.count:x.count,S=0,E=Object.keys(v.attributes),A={},P={},C=[],R=["getX","getY","getZ","getW"],L=["setX","setY","setZ","setW"];for(let W=0,it=E.length;W<it;W++){let nt=E[W],Y=v.attributes[nt];A[nt]=new Y.constructor(new Y.array.constructor(Y.count*Y.itemSize),Y.itemSize,Y.normalized);let ot=v.morphAttributes[nt];ot&&(P[nt]||(P[nt]=[]),ot.forEach((ht,ft)=>{let pt=new ht.array.constructor(ht.count*ht.itemSize);P[nt][ft]=new ht.constructor(pt,ht.itemSize,ht.normalized)}))}let D=.5*y,F=Math.log10(1/y),V=Math.pow(10,F),U=D*V;for(let W=0;W<w;W++){let it=b?b.getX(W):W,nt="";for(let Y=0,ot=E.length;Y<ot;Y++){let ht=E[Y],ft=v.getAttribute(ht),pt=ft.itemSize;for(let J=0;J<pt;J++)nt+=~~(ft[R[J]](it)*V+U)+","}if(nt in _)C.push(_[nt]);else{for(let Y=0,ot=E.length;Y<ot;Y++){let ht=E[Y],ft=v.getAttribute(ht),pt=v.morphAttributes[ht],J=ft.itemSize,mt=A[ht],N=P[ht];for(let O=0;O<J;O++){let H=R[O],$=L[O];if(mt[$](S,ft[H](it)),pt)for(let B=0,Z=pt.length;B<Z;B++)N[B][$](S,pt[B][H](it))}}_[nt]=S,C.push(S),S++}}let j=v.clone();for(let W in v.attributes){let it=A[W];if(j.setAttribute(W,new it.constructor(it.array.slice(0,S*it.itemSize),it.itemSize,it.normalized)),W in P)for(let nt=0;nt<P[W].length;nt++){let Y=P[W][nt];j.morphAttributes[W][nt]=new Y.constructor(Y.array.slice(0,S*Y.itemSize),Y.itemSize,Y.normalized)}}return j.setIndex(C),j}(c),f=[],g=new Array(d[d.length-1]+1).fill(3),m=p.getIndex().array;for(let v=0,y=d.length;v<y;)d[v]===d[v+1]?(g[d[v]]++,f.push(...new Set(m.slice(3*v,3*v+6))),v+=2):(f.push(...m.slice(3*v,3*v+3)),v++);o.indexWASM={array:f},o.positionWASM=p.attributes.position,o.verticesPerFaceWASM={array:g}}if(o?.positionWASM===void 0||o?.positionWASM.length===0||o?.indexWASM===void 0||o?.indexWASM.length===0||o?.verticesPerFaceWASM===void 0||o?.verticesPerFaceWASM.length===0)return null;let l={type:a,...uY(o.positionWASM.array)};l.subdivisions=e.parameters.subdivisions;for(let c in o)c==="positionWASM"?l[c]=new Float32Array(o[c].array):c==="indexWASM"?l[c]=new Int32Array(o[c].array):c==="verticesPerFaceWASM"&&(l[c]=new Int8Array(o[c].array));return l.scaleBaked=[1,1,1],l}let r=e.type,s=e.parameters;return r==="VectorGeometry"?(s.extrudeDepth&&(s.depth=s.extrudeDepth),{...s,width:100,height:100,shape:ZN(e.shape),type:r}):r==="LatheGeometry"?{...e.parameters,type:r,points:(e?.parameters.points??[]).map(a=>[a.x,a.y])}:(s.extrudeDepth&&(s.depth=s.extrudeDepth),{...s,type:r})}function uY(t){return zA.setFromArray(t),zA.getSize(Fm),{width:Fm.x,height:Fm.y,depth:Fm.z}}var zA,Fm,HS,pY=z(()=>{Ye(),tt(),s0(),new At,new Wt,new xi,new T,new T,zA=new ci,Fm=new T}),fY=z(()=>{var t;(t=HS||{}).view="view",t.edit="edit",((HS=t)||(HS={})).canWrite=function(e){return e!=="view"},class extends Error{constructor(e,i){super(`This is a ${e.toUpperCase()} document, but it was opened as a ${i.toUpperCase()} one`),this.actual=e,this.expected=i,this.name="DocumentKindMismatchError"}}}),QN,ol,mg,JN,tk,Sp,Nf,Av,WS,Mp,c4,qS,d4,XS,gp,Tl,Cl,Co,$S,u4,p4,YS,FA,sl,ek=z(()=>{fY()}),mY=z(()=>{}),gY=z(()=>{Ye(),ux(),ek()}),vY=z(()=>{r0(),[...hx],new Set(QC)}),$t=z(()=>{dY(),mY(),K$(),ux(),gY(),ek(),kN(),vY(),o3(),Ye()}),co=z(()=>{QN=[3,4,8,9],ol=5,mg=3,JN=32,tk=.98}),a0=z(()=>{tt(),Sp=t=>{var e;return(e=class extends t{}).geometryHelper=new va(30,30,30),e}}),o0=z(()=>{tt(),Nf=new Jo,Av=new yr,WS=new At,Mp=(t,e,i,n,r=!1,s=t)=>{let a=e,o=s.matrixWorld;if(a.boundingSphere===null&&a.computeBoundingSphere(),Av.copy(a.boundingSphere),Av.applyMatrix4(o),i.ray.intersectsSphere(Av)===!1||(WS.copy(o).invert(),Nf.copy(i.ray).applyMatrix4(WS),a.boundingBox!==null&&Nf.intersectsBox(a.boundingBox)===!1))return;let l,c,h,d,u,p,f=a.index,g=a.attributes.position,m=a.drawRange;if(r===!1){for(u=Math.max(0,m.start),p=Math.min(f.count,m.start+m.count);u<p;u+=3)if(c=f.getX(u),h=f.getX(u+1),d=f.getX(u+2),l=v(t,i,Nf,g,c,h,d),l)return l.faceIndex=Math.floor(u/3),void n.push(l)}else{let y=a.attributes.position,_=new T,b=new T,x=new T,w=new T,S=2,E=1/((s.scale.x+s.scale.y+s.scale.z)/3),A=E*E;for(let P=Math.max(0,m.start),C=Math.min(y.count,m.start+m.count)-1;P<C;P+=S){if(_.fromBufferAttribute(y,P),b.fromBufferAttribute(y,P+1),Nf.distanceSqToSegment(_,b,w,x)>A)continue;w.applyMatrix4(s.matrixWorld);let R=i.ray.origin.distanceTo(w);R<i.near||R>i.far||n.push({distance:R,point:x.clone().applyMatrix4(s.matrixWorld),object:t})}}function v(y,_,b,x,w,S,E){let A=new T,P=new T,C=new T,R=new T,L=new T;if(A.fromBufferAttribute(x,w),P.fromBufferAttribute(x,S),C.fromBufferAttribute(x,E),b.intersectTriangle(A,P,C,!1,R)===null)return null;L.copy(R),L.applyMatrix4(y.matrixWorld);let D=_.ray.origin.distanceTo(L);return D<_.near||D>_.far?null:{faceIndex:1,distance:D,point:L.clone(),object:y}}}}),px=z(()=>{tt(),a0(),o0(),c4=new T(1,1,1),qS=new T,d4=new T,XS=new Wt,gp=class extends Sp(wF){constructor(t,e=15){super(e),this.object=t,this.dummy=new xp,this.object.updateMatrixWorld(),this.name=`EmptyObjectHelper: ${t.uuid}`,this.matrix=this.dummy.matrixWorld,this.matrixAutoUpdate=!1,this.object.isBone&&(this.visible=!1)}raycast(t,e){Mp(this.object,gp.geometryHelper,t,e,!1,this.dummy)}update(){}updateMatrix(){}updateMatrixWorld(t){this.object.matrixWorld.decompose(qS,XS,d4),this.matrix.compose(qS,XS,c4),super.updateMatrixWorld(t)}updateWorldMatrix(t,e){}}}),yY=z(()=>{tt(),Tl=new T,Cl=new T,Co=new At,$S=[new T(-1,1,1),new T(-1,-1,1),new T(1,-1,1),new T(1,1,1),new T(-1,1,-1),new T(-1,-1,-1),new T(1,-1,-1),new T(1,1,-1)],u4=[[0,3],[1,2],[5,6],[4,7],[0,1],[3,2],[7,6],[4,5],[0,4],[1,5],[2,6],[3,7]],p4=[[0,2],[7,5],[4,1],[3,6],[4,3],[1,6]],YS=(t,e,i)=>{t.updateEntityBoxSize(Tl,Cl),Co.copy(e).multiply(t.matrixWorld),Cl.x===0&&Cl.y===0&&Cl.z===0?i.push(new T(Tl.x,Tl.y,Tl.z).applyMatrix4(Co)):$S.forEach(n=>{i.push(n.clone().multiply(Cl).add(Tl).applyMatrix4(Co))})},FA=class extends ci{constructor(){super(...arguments),this.matrix=new At,this.vertices=[],this.faces=[],this.edges=[],this.centerEdges=[]}copy(t){return super.copy(t),this.matrix.copy(t.matrix),this.vertices=t.vertices.map(e=>e.clone()),this.faces=t.faces.map(e=>e.clone()),this.edges=t.edges.map(e=>e.clone()),this.centerEdges=t.centerEdges.map(e=>e.clone()),this}setFromObjectSize(t,e=!1){t.updateWorldMatrix(!1,e),this.makeEmpty(),this.matrix.copy(t.matrixWorld);let i=new At().copy(t.matrixWorld).invert();return this.expandByObjectSize(t,i,e)}expandByObjectSize(t,e,i=!1){let n=[];if(i===!0){let r=[];t.traverseEntity(s=>{if(s.visible||s.cloner&&s.data.visible){if(!("geometry"in s))return Co.copy(e).multiply(s.matrixWorld),void r.push(new T().applyMatrix4(Co));YS(s,e,n)}}),n.length===0&&n.push(...r)}else YS(t,e,n);return this.setFromPoints(n)}getCenter(t){return(t=super.getCenter(t)).applyMatrix4(this.matrix),t}getPositionToCenter(t){return(t=super.getCenter(t)).applyMatrix4(Co.copy(this.matrix).setPosition(0,0,0)),t}computeVertices(){this.getSize(Cl).multiplyScalar(.5),this.getCenter(Tl),Co.copy(this.matrix).setPosition(Tl),this.vertices=$S.map(t=>t.clone().multiply(Cl).applyMatrix4(Co))}computeEdges(){this.vertices.length>0&&this.computeVertices(),this.edges=u4.map(([t,e])=>new ys(this.vertices[t],this.vertices[e])),this.centerEdges=this.edges.map(t=>t.getCenter(new T))}computeFaces(){this.vertices.length>0&&this.computeVertices(),this.faces=p4.map(([t,e])=>this.vertices[t].clone().add(this.vertices[e]).multiplyScalar(.5))}}}),db=z(()=>{sl={Cloner:null,changeEntityProptotype:()=>{},createEntity:()=>{}}});function gg(t){return t?.isParticleSystem===!0}function Yc(t){return t?.isHairSystem===!0}function ll(t){return t?.isShapeBlendEntity===!0}function fx(t){return t?.isPathObject===!0}function os(t){return t?.isObject2D===!0}function Pr(t){return t?.isUIObject===!0}function zu(t){return t?.isCloner===!0}function Cc(t){return t?.isClone===!0}function D1(t){return t?.isComponentObject===!0}var Bi=z(()=>{});function Si(t){l3.add(t)}function Gn(t,e){let i=`${t}:${e}`;VA.has(i)||VA.add(i)}function ub(t,e){h3.set(t,e)}function ZS(t){return h3.get(t)}function Ep(t,e){c3.set(t,e)}function KS(t){return c3.get(t)}function NA(t,e){d3.set(t,e)}function ik(t){return d3.get(t)}function kA(){return mx}var l3,VA,h3,c3,d3,mx,pb,ke=z(()=>{l3=new Set,VA=new Set,h3=new Map,c3=new Map,d3=new Map,mx=null,pb=null});function nk(t){let e=t.elements;ca.set(e[0],e[1],e[2]),da.set(e[4],e[5],e[6]),$a.set(e[8],e[9],e[10])}function rk(){let t=Math.max(ca.lengthSq(),da.lengthSq(),$a.lengthSq());ca.lengthSq()>Nm*t?gs.copy(ca).normalize():gs.set(1,0,0),vs.crossVectors($a,gs),vs.lengthSq()<=Nm*t&&(vs.copy(da).addScaledVector(gs,-da.dot(gs)),vs.lengthSq()<=Nm*t&&function(e,i){e.set(1,0,0).cross(i),e.lengthSq()<=Nm&&e.set(0,1,0).cross(i),e.normalize()}(vs,gs)),vs.normalize(),Pc.crossVectors(gs,vs)}var ca,da,$a,gs,vs,Pc,sk,Nm,km,Tv,Dc,gx,ak=z(()=>{tt(),ca=new T,da=new T,$a=new T,gs=new T,vs=new T,Pc=new T,sk=new At,Nm=1e-12,km=.01}),l0=z(()=>{tt(),ak(),Tv=new At,(Dc||(Dc={})).is=function(t){return t&&t.__isSPEObject},gx=t=>class extends t{constructor(){super(...arguments),this.previousModelViewMatrix=new At,this.copyPreviousMatrix=!0,this.hiddenMatrix=new At,this.pivotMatrix=new At,this.matrixWorldRigid=new At,this.shearScale=new At,this.shearScaleInv=new At}get __isSPEObject(){return!0}getPhysicsLocalMatrix(e){return!!this.rigidBody?.isDynamic()&&(e.copy(this.matrixWorld),this.hasNonUniformScale&&e.multiply(this.shearScaleInv),this.parent&&e.premultiply(Tv.copy(this.parent.matrixWorld).invert()),e.premultiply(Tv.copy(this.hiddenMatrix).invert()),e.multiply(Tv.copy(this.pivotMatrix).invert()),!0)}isDescendantOf(e){e instanceof _i&&(e=e.uuid);let i=this;for(;i.parent;){if(i.parent.uuid===e)return!0;i=i.parent}return!1}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.parent===null?this.matrixWorld.multiplyMatrices(this.hiddenMatrix,this.matrix):(this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.hiddenMatrix),this.matrixWorld.multiplyMatrices(this.matrixWorld,this.matrix)),this.matrixWorld.multiply(this.pivotMatrix),this.matrixWorldNeedsUpdate=!1,e=!0);for(let i of this.children)i.updateMatrixWorld(e)}updateWorldMatrix(e,i){let n=this.parent;if(e&&n!==null&&n.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.parent===null?this.matrixWorld.multiplyMatrices(this.hiddenMatrix,this.matrix):(this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.hiddenMatrix),this.matrixWorld.multiplyMatrices(this.matrixWorld,this.matrix)),this.matrixWorld.multiply(this.pivotMatrix),i)for(let r of this.children)r.updateWorldMatrix(!1,!0)}traverseChildren(e,i=0){for(let n of this.children)Dc.is(n)&&n.traverseObject(e,i+1)}traverseObject(e,i=0){if(e(this,i)!==!0)for(let n of this.children)Dc.is(n)&&n.traverseObject(e,i+1)}updateMatrixWorldRigid(){this.hasNonUniformScale=function(e,i,n){return nk(e),rk(),i.makeBasis(gs,vs,Pc),n.set(gs.dot(ca),gs.dot(da),gs.dot($a),0,vs.dot(ca),vs.dot(da),vs.dot($a),0,Pc.dot(ca),Pc.dot(da),Pc.dot($a),0,0,0,0,1),function(){let r=ca.length(),s=da.length(),a=$a.length(),o=Math.max(r,s,a);if(o-r>km||o-s>km||o-a>km)return!0;let l=km*o*o;return Math.abs(ca.dot(da))>l||Math.abs(ca.dot($a))>l||Math.abs(da.dot($a))>l}()}(this.matrixWorld,this.matrixWorldRigid,this.shearScale),this.matrixWorldRigid.copyPosition(this.matrixWorld),this.shearScaleInv.copy(this.shearScale).invert()}attach(e,i){this.updateWorldMatrix(!0,!1);let n=new At().copy(this.matrixWorld).invert();return e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),n.multiply(e.parent.matrixWorld)),"hiddenMatrix"in e&&e.hiddenMatrix instanceof At?e.hiddenMatrix.premultiply(n):e.applyMatrix4(n),e.updateWorldMatrix(!1,!1),this.add(e),i!==void 0&&(this.children.pop(),this.children.splice(i,0,e)),this}copy(e,i=!1){return super.copy(e,i),this.hasNonUniformScale=e.hasNonUniformScale,this}onAfterRender(e,i,n,r,s,a){this.copyPreviousMatrix&&this.previousModelViewMatrix.copy(this.modelViewMatrix)}}});function f4(t,e,i){return Xl.subVectors(e,t),qg.subVectors(e,i),Xl.cross(qg).length()<=vg}function ok(t){let e=HA.get(t.points);if(e!==void 0&&e.isClosed===t.isClosed)return e.curve;let i=function(n){let r=n.points,s=[r[0]],a=[new T(...r[0].data.position)];vc.copy(a[0]);for(let v=0;v<r.length-1;v++)Xl.fromArray(r[v].data.position),qg.fromArray(r[v+1].data.position),Tu.subVectors(Xl,vc),Cu.subVectors(Xl,qg),Tu.cross(Cu).length()>vg&&(s.push(r[v]),a.push(new T().copy(Xl)),vc.copy(Xl));let o=r[r.length-1];s.push(o),a.push(new T(...o.data.position));let l=n.isClosed,c=s.length-(l?0:1),h=s.length,d=[],u=[];for(let v=0;v<h;v++){let y=s[v].data;d.push(new T(...y.controlPrevious.position)),u.push(new T(...y.controlNext.position))}let p=[];for(let v=0;v<c;v++){let y=v===h-1?0:v+1;p.push(f4(a[v],u[v],a[y])&&f4(a[v],d[y],a[y]))}let f=[];for(let v=0;v<h;v++){let y=s[v].data,_=a[v],b={position:_,prevDir:void 0,nextDir:void 0,controlPrevious:d[v],controlNext:u[v],tan:void 0,baseRoundness:y.roundness,removedLength:0};if(f.push(b),y.roundness===0||!l&&(v===0||v===h-1))continue;let x=l&&v==0?h-1:v-1,w=l&&v==h-1?0:v+1,S=new T().subVectors(a[x],_).normalize(),E=new T().subVectors(a[w],_).normalize();b.prevDir=S,b.nextDir=E;let A=p[l&&v===0?h-1:v-1],P=p[v];if(A&&P){yc.addVectors(S,E).normalize();let C=vc.crossVectors(yc,S).length()/S.dot(yc);b.tan=C,b.removedLength=y.roundness/C}}for(let v=0;v<c;v++){let y=l&&v===h-1?0:v+1,_=f[v],b=f[y];if(_.removedLength!==0||b.removedLength!==0){let x=_.position.distanceTo(b.position);_.removedLength=Math.min(_.removedLength,x/2),b.removedLength=Math.min(b.removedLength,x/2)}}let g=new Array(2*h).fill(null);for(let v=0;v<c;v++){let y=l&&v===h-1?0:v+1,_=f[v],b=f[y],x=null;if(p[v]){let w=_.position.clone(),S=b.position.clone();(_.removedLength!==0||b.removedLength!==0)&&(_.nextDir&&w.add(vc.copy(_.nextDir).setLength(_.removedLength)),b.prevDir&&S.add(vc.copy(b.prevDir).setLength(b.removedLength))),w.distanceTo(S)>vg&&(x=new ag(w,w.clone().lerp(S,.3),S.clone().lerp(w,.3),S))}else _.position.distanceTo(b.position)>vg&&(x=new ag(_.position,_.controlNext,b.controlPrevious,b.position));g[2*v+1]=x}for(let v=0;v<h;v++){let y=f[v];if(y.removedLength===0)continue;let _=y.position,b=y.prevDir.clone().multiplyScalar(y.removedLength).add(_),x=y.nextDir.clone().multiplyScalar(y.removedLength).add(_),w=y.tan*y.removedLength;yc.addVectors(y.prevDir,y.nextDir).normalize(),Tu.copy(b).lerp(x,.5);let S=b.distanceTo(x)/2;GA.copy(yc).multiplyScalar(Math.sqrt(Math.pow(w,2)-Math.pow(S,2))).add(Tu),R1.copy(yc).multiplyScalar(-w).add(GA);let E=_.distanceTo(R1)/_.distanceTo(Tu);Cu.copy(y.prevDir).multiplyScalar(E*_.distanceTo(b)).add(_),jA.copy(Cu).lerp(R1,2);let A=b.clone().lerp(Cu,4/3),P=x.clone().lerp(jA,4/3);g[2*v]=new ag(b,A,P,x)}let m=new lk;for(let v=0;v<g.length;v++){let y=g[v];y&&m.add(y)}return m}(t);return HA.set(t.points,{isClosed:t.isClosed,curve:i}),i}var lk,vg,Xl,qg,vc,yc,Tu,R1,Cu,jA,GA,HA,Pu,WA,I1,hk,ck,dk,Be,qa,m4,g4,kf,QS,Cv,JS,t2,vx,qA,id,Ya,uk=z(()=>{tt(),lk=class extends BE{constructor(){super()}getPoints(t=12){let e,i=[],n=this.getCurveLengths(),r=n[n.length-1]/n.length;for(let s=0,a=this.curves;s<a.length;s++){let o=a[s],l=s===0?n[s]:n[s]-n[s-1],c=Math.ceil(t*l/r),h=o.getPoints(c);for(let d=0;d<h.length;d++){let u=h[d];e&&e.equals(u)||(i.push(u),e=u)}}return this.autoClose&&i.length>1&&!i[i.length-1].equals(i[0])&&i.push(i[0]),i}},vg=.001,Xl=new T,qg=new T,vc=new T,yc=new T,Tu=new T,R1=new T,Cu=new T,jA=new T,GA=new T,HA=new WeakMap}),_Y=z(()=>{tt(),Pu=new At,WA=new Wt,I1=new Wt,hk=new xi,ck=new T,dk=new T(0,1,0)}),qr=z(()=>{tt(),$t(),yY(),Ye(),db(),Bi(),ke(),l0(),uk(),_Y(),ti(),(Be||(Be={})).is=function(t){return t&&t.__isEntity},qa=t=>Be.is(t),m4={type:"completeState",isfromEntity:!0},g4=["x","y","z"],kf=new T,QS=new T(1,1,1),Cv=new Wt,JS=new xi,t2=new At,vx=t=>class extends gx(t){constructor(){super(...arguments),this.raycastLock=!1,this.scaleLock=!1,this.disposed=!1,this.stateSelection=null,this.destroyedInAction=!1,this.instances=[],this.prevState=null,this.currentState=null,this.currentAnimationAction=null,this.reversibleToState=null,this.transitionState={settled:!0,state:null},this.currentTransitionEvent=null,this.previousAction=null,this._singleBBox=new FA,this._recursiveBBox=new FA,this.singleBBoxNeedsUpdate=!0,this.recursiveBBoxNeedsUpdate=!0,this._needApplyPathSnapping=!0,this.attachedPaths=new Set}get __isEntity(){return!0}entityChildren(e){let i=this.children[e];if(Be.is(i))return i}entityChildrenCount(){let e=this.children.length;for(;e--;)if(Be.is(this.children[e]))return e+1;return 0}get isConcreteEntity(){return typeof this.identity=="string"}get isVirtualEntity(){return typeof this.identity!="string"}get isInstanceRoot(){return this.isConcreteEntity&&this.data.type==="Instance"}nearestInstanceSelfOrParent(){let e=this;for(;e.data.type!=="Instance";){let i=e.parent;if(!Be.is(i))return;e=i}return e}forInstancesRec(e){this.instances.forEach(i=>{i.disposed||e(i),i.forInstancesRec(e)})}super_Entity(e,i){typeof e=="string"&&(this.uuid=e),this.identity=e,this.data=i,this.matrixAutoUpdate=!1,this.dataPatched=this.data}changeSelectedState(e,i,n=!1){if(this.data.states.length!==0||n){for(let r of this.data.states)ih.toOps(this.data,r.data).forEach(s=>{let a=V_.replaceProps(s,this.data);this.dataPatched=this.data,this.updateByPatchedOp(a,this.data,i)});if(e!==null){let r=this.data.states.data(e);r&&(this.dataPatched=ih.patch(this.data,r),ih.toOps(this.data,r).forEach(s=>{this.updateByPatchedOp(s,this.dataPatched,i)}))}n&&this.updateTransformState(this.dataPatched,i),this.stateSelection=e,this.updatePathSnapping(this.dataPatched.pathSnapping)}}get singleBBox(){return this.singleBBoxNeedsUpdate&&(this.singleBBoxNeedsUpdate=!1,this._singleBBox.setFromObjectSize(this,!1),this._singleBBox.computeVertices(),this._singleBBox.computeEdges(),this._singleBBox.computeFaces()),this._singleBBox}get recursiveBBox(){return this.recursiveBBoxNeedsUpdate&&(this.recursiveBBoxNeedsUpdate=!1,this._recursiveBBox.setFromObjectSize(this,!0),this._recursiveBBox.computeVertices(),this._recursiveBBox.computeEdges(),this._recursiveBBox.computeFaces()),this._recursiveBBox}updateEntityBoxSize(e,i){e.setScalar(0),i.setScalar(0)}resetBBoxNeedsUpdateSelf(){this.singleBBoxNeedsUpdate=!0,this.recursiveBBoxNeedsUpdate=!0}resetBBoxNeedsUpdate(){this.resetBBoxNeedsUpdateSelf(),this.traverseAncestors(e=>{qa(e)&&e.resetBBoxNeedsUpdateSelf()}),this.traverseEntity(e=>{e.resetBBoxNeedsUpdateSelf()})}find(e){let i;return this.traverseEntity(n=>{n.uuid===e&&(i=n)}),i}traverseSortNextHelper(){let e=this.parent;if(e){let i=e.children,n=i.indexOf(this)+1;if(Be.is(i[n]))return i[n];if(Be.is(e))return e.traverseSortNextHelper()}}sortNext(){let e=this.children;return this.children.length>0&&Be.is(this.children[0])?e[0]:this.traverseSortNextHelper()}goUp(e){let i=this;for(;e>0&&i!==null;)i=i.parent,e-=1;return i}hasAnccestorOrSelf(e){return this===e||this.hasAnccestor(e)}hasAnccestor(e){let i=this.parent;for(;i;){if(e===i)return!0;i=i.parent}return!1}countToAccestor(e){let i=0,n=this;for(;n!==e;){if(n===null)return-1;n=n.parent,i+=1}return i}forEachEntity(e){for(let i of this.children)qa(i)&&e(i)}traverseEntityAncestors(e){this.traverseAncestors(i=>{Be.is(i)&&e(i)})}traverseConcreteEntity(e,i=0){if(e(this,i)!==!0)for(let n of this.children)qa(n)&&n.isConcreteEntity&&n.traverseEntity(e,i+1)}traverseEntity(e,i=0){if(e(this,i)!==!0)for(let n of this.children)qa(n)&&n.traverseEntity(e,i+1)}traverseVisibleEntity(e){e(this);for(let i of this.children)qa(i)&&i.visible&&i.traverseVisibleEntity(e)}updateMatrix(){super.updateMatrix(),this.cloner&&this.cloner.onObjUpdateMatrix(),this.dispatchEvent({type:"updateMatrix"})}updateMatrixWorld(e){super.updateMatrixWorld(e),this.dispatchEvent({type:"updateMatrixWorld"})}copy(e,i=!1){return super.copy(e,i),this.dataPatched=e.dataPatched,this.raycastLock=e.raycastLock,this.scaleLock=e.scaleLock,this.hiddenMatrix.copy(e.hiddenMatrix),this}hasEntityChild(){return this.children.some(e=>qa(e))}isAncestorOf(e){if(this.uuid===e)return!1;let i=!1;return this.traverseEntity(n=>{n.uuid===e&&(i=!0)}),i}toObjectTransformState(e=[]){return this.updateWorldMatrix(!0,!1),eA({position:this.position.toArray(),rotation:[this.rotation.x*Ot.RAD2DEG,this.rotation.y*Ot.RAD2DEG,this.rotation.z*Ot.RAD2DEG],scale:this.scale.toArray(),hiddenMatrix:this.hiddenMatrix.toArray(),pivot:[0,0,0],pivotRotation:[0,0,0]},e)}getTransformValues(e,i,n){return i[e].map((r,s)=>n?.shared.getVariable(r,[this.uuid,e,g4[s]])??r)}updateTransformState(e,i){let n=!1;if(e.position&&(this.position.fromArray(this.getTransformValues("position",e,i)),n=!0),e.rotation&&(kf.fromArray(this.getTransformValues("rotation",e,i)).multiplyScalar(Ot.DEG2RAD),this.rotation.setFromVector3(kf),n=!0),e.scale&&(this.scale.fromArray(this.getTransformValues("scale",e,i)),n=!0),e.hiddenMatrix!==void 0&&(n=!0,this.hiddenMatrix.fromArray(e.hiddenMatrix??Zu.identity)),e.pivot!==void 0||e.pivotRotation!==void 0){if(n=!0,e.pivot!==void 0&&e.pivotRotation!==void 0)this.pivotMatrix.compose(kf.fromArray(e.pivot).negate(),Cv.setFromEuler(JS.fromArray(e.pivotRotation.map(r=>r*Ot.DEG2RAD))).invert(),QS);else if(e.pivot!==void 0)this.pivotMatrix.setPosition(-e.pivot[0],-e.pivot[1],-e.pivot[2]);else if(e.pivotRotation!==void 0){let r=kf.setFromMatrixPosition(this.pivotMatrix);Cv.setFromEuler(JS.fromArray(e.pivotRotation.map(s=>s*Ot.DEG2RAD))).invert(),this.pivotMatrix.compose(r,Cv,QS)}}return n&&(this.updateMatrix(),this.resetBBoxNeedsUpdate(),this.invalidateClonerTransform(this),this.traverseEntityAncestors(r=>{r.invalidateClonerTransform(this)})),e.position&&e.rotation&&e.scale&&e.hiddenMatrix!==void 0&&this.updateWorldMatrix(!1,!0),n}onVariableUpdate(e=!1){e?this.resetBBoxNeedsUpdate():(this.updateMatrix(),this.resetBBoxNeedsUpdate(),this.invalidateClonerTransform(this),this.traverseEntityAncestors(i=>{i.invalidateClonerTransform(this)}),this.requestRender())}dispose(){this.disposed=!0,this.cloner&&(this.cloner.dispose(),this.cloner=void 0)}disposeChildrenRecursively(){for(let e of this.children)Be.is(e)&&e.disposeRecursively()}disposeRecursively(){this.dispose(),this.children.forEach(e=>{Be.is(e)&&e.disposeRecursively()})}toState(e=[]){return eA({name:this.name,visible:this.visible,raycastLock:this.raycastLock,...this.toObjectTransformState(e)},e)}updateByObjUpdateOp(e,i){e!==void 0&&this.updateByOp({type:0,props:e,path:[]},{...this.data,...e},i,!1)}updateByOp(e,i,n,r){let s=this.data;this.data=i;let a=e,o=ri(e.path,["states","*"]);if(o!==null){if(e.type===0){let[l]=o;if(this?.stateSelection===l){let c={...e.props};if(delete c.name,Object.values(e.props).some(h=>h===void 0)){let h=this.data;if(h!==void 0){let d=jn.zoom(h,e.path.slice(2));if(d)for(let u in e.props)e.props[u]===void 0&&u in d&&(c[u]=d[u])}}a={...e,props:c,path:e.path.slice(2)}}}}else if(e.type===0){let l=this.stateSelection?this.data.states.data(this.stateSelection):void 0;if(l!==void 0){if(e.props.name!==void 0&&l.name){let{name:h,...d}=l;l=d}if(e.props.material!==void 0&&"material"in l){let{material:h,...d}=l;l=d}let c=jn.removeOverridden(e.path,e.props,l);a={...e,props:c}}}if(this.updateByPatchedOpBase(a,ih.patch(this.data,this.stateSelection?this.data.states.data(this.stateSelection):void 0),n),ri(e.path,["overrides"])){let l=[],c=[...e.path];for(l.push(c[1]),c.splice(0,2);c.length>0&&c[0]==="descendants";)l.push(c[1]),c.splice(0,2);if(l[l.length-1]===void 0){if(e.type===0)for(let h of Object.keys(e.props)){l[l.length-1]=h;let d=n.scene.findInstance([this.uuid,...l]);d&&(d.overrideData=e.props[h],d.updateState(ch.apply(d.component.data,d.overrideData),n))}}else{let h=n.scene.findInstance([this.uuid,...l]);if(h){let d=jn.zoom(h.component.data,c);if((e={...e,path:c}).type===0){let u=e.props;if(d)for(let[p,f]of Object.entries(e.props))f===void 0&&(u===e.props&&(u={...e.props}),u[p]=d[p]);e={...e,props:u}}h.overrideData=ab.resolve(i.overrides,l),h.updateByOp(e,er.applySimple(h.data,e),n,!1)}}}else if(this.instances.length>0){let l;if(e.path.length===0&&e.type===0){let c;for(let h of nl.rootOverrideProps)h in e.props&&(c===void 0&&(c={}),c[h]=e.props[h]);c&&(l={...e,props:c})}else for(let c of nl.rootOverrideProps)if(ri(e.path,[c])){l=e;break}l!==void 0&&this.instances.forEach(c=>{if(c.isInstanceRoot){let h=ch.filterOp(c.overrideData,l);h&&c.updateByOp(h,er.applySimple(c.data,h),n,!0)}}),this.instances.forEach(c=>{if(!c.isInstanceRoot){let h=ch.filterOp(c.overrideData,e);if(h){let d;d=s===c.data&&e===h?i:er.applySimple(c.data,h),c.updateByOp(h,d,n,!0)}}})}}updateByPatchedOpBase(e,i,n){if(this.dataPatched=i,e.path.length===0&&e.type===0)e.props.type!==void 0&&!Xc.is(e.props.type)&&sl.changeEntityProptotype(this,i,n);else if(e.path.length===1&&e.path[0]==="geometry"&&e.type===0&&"type"in e.props){sl.changeEntityProptotype(this,i,n);for(let r of this.children)Be.is(r)&&r.updateVisible(n.scene)}this.updateByPatchedOp(e,i,n)}updateByPatchedOp(e,i,n){if(e.path.length===0&&e.type===0?this.updateState(e.props,n):e.type===0&&("resolutionLevel"in e.props||"useChildrenColors"in e.props)&&this.updateState(i,n),e.path[0]==="morphTargetInfluences"&&e.type===0){let r=i.morphTargetInfluences.get(e.path[1])?.data.name;r&&this.updateMorphInfluences(r,n.shared.getVariable(e.props.value,[this.uuid,"morphTargetInfluences",r]))}if(ri(e.path,["pathSnapping"])!==null&&this.updatePathSnapping(i.pathSnapping),ri(e.path,["cloner"])!==null){let r=er.drop(e,1);r.path.length===0&&r.type===0&&r.props.disabled===!0?this.setFromClonerState(null,n):this.cloner?this.cloner.updateState(i.cloner,n):(this.setFromClonerState(i.cloner,n),this.expandCloner(n)),this.updateVisible(n.scene)}}updatePathSnapping(e=this.dataPatched.pathSnapping){this._updatedPathSnapping=e,this._needApplyPathSnapping=!0}get updatedPathSnapping(){return this._updatedPathSnapping}applyPathSnapping(e){if(this._needApplyPathSnapping===!1)return;let i=this._updatedPathSnapping?.pathId??this.dataPatched.pathSnapping.pathId,n=this._updatedPathSnapping?.slide??this.dataPatched.pathSnapping.slide??0,r=this._updatedPathSnapping?.offset??this.dataPatched.pathSnapping.offset??0,s=this._updatedPathSnapping?.orientation??this.dataPatched.pathSnapping.orientation;if(i===null)return;let a=e.find(i);if(!a)return;this._needApplyPathSnapping=!1;let o=a.data;if(o.geometry.path.points.length<=1)return;let l=ok(o.geometry.path),c=function(p){let f=p%1;return f<0?f+1:f===0&&p>0?1:f}(n+r),h=null;try{h=l.curves.length?l.getPointAt(c):null}catch{}if(h===null)return;a.updateMatrixWorld();let d=this.parent?t2.multiplyMatrices(this.parent.matrixWorld,this.hiddenMatrix):t2.copy(this.hiddenMatrix),u=function(p,f,g,m){WA.setFromRotationMatrix(Pu.extractRotation(m));let v=p.clone().applyMatrix4(Pu.copy(m).invert().multiply(g));if(f===null)I1.setFromRotationMatrix(Pu.extractRotation(g));else{let y=f.clone().applyMatrix4(Pu.extractRotation(g));I1.setFromRotationMatrix(Pu.lookAt(ck.set(0,0,0),y,dk))}return{position:v,rotation:new T().setFromEuler(hk.setFromQuaternion(WA.invert().multiply(I1))).multiplyScalar(Ot.RAD2DEG)}}(h,s==="tangential"?l.getTangentAt(c):null,a.matrixWorld,d);this.updateTransformState({position:u.position.toArray(),rotation:u.rotation.toArray()}),this.traverseEntity(p=>{p._cameraType&&p.dispatchEvent(m4)})}updateVisible(e){if(this.visible=this.dataPatched.visible&&(!this.dataPatched.cloner||(this.dataPatched.cloner.disabled??!1)||this.dataPatched.cloner?.hideBase!==!0),!e)return;let i=!1;this.traverseEntity(n=>{if(n.data.type==="Splat")return i=!0,!0}),i&&e.reloadSplats()}updateState_Entity(e,i){e.name!==void 0&&(this.name=e.name),e.raycastLock!==void 0&&(this.raycastLock=e.raycastLock),e.visible!==void 0&&(this.updateVisible(i?.scene),this.resetBBoxNeedsUpdate()),i&&"cloner"in e&&e.cloner!==void 0&&(this.setFromClonerState(e.cloner,i),this.updateVisible(i.scene)),this.updateTransformState(e,i)}get attachedSurfaceCloners(){return this.children.filter(e=>zu(e)&&e.parameters.type==="toObject")}setFromClonerState(e,i){if(!this.disposed)if(e===null||e.disabled)this.cloner&&this.cloner.dispose(),this.cloner=void 0;else if(this.cloner===void 0){if(sl.Cloner===null)return void Gn("cloners","a cloner");this.cloner=new sl.Cloner(this,e),i.scene.addPendingExpandCloner(this)}else this.cloner.updateState(e,i)}expandCloner(e){!this.disposed&&this.cloner&&this.cloner.expandClones(e)}invalidateClonerTransform(e){this.cloner&&this.cloner.invalidateTransform(e)}requestRender(){this.dispatchEvent({type:"requestRender"})}}}),nd=z(()=>{tt(),qr(),(qA||(qA={})).is=t=>"objectHelper"in t,id=(t,e)=>class extends vx(t){constructor(){super(...arguments),this.objectHelper=new e(this),this.gizmos={}}get geometryHelper(){return e.geometryHelper}raycast(i,n){this.objectHelper.raycast(i,n)}showGizmos(){for(let i in this.gizmos){let n=this.gizmos[i];n instanceof Fg&&(n.visible=!0)}}updateEntityBoxSize(i,n){this.objectHelper.visible&&this.geometryHelper instanceof va?(i.setScalar(0),n.set(this.geometryHelper.parameters.width,this.geometryHelper.parameters.height,this.geometryHelper.parameters.height).multiplyScalar(.5)):super.updateEntityBoxSize(i,n)}hideGizmos(){for(let i in this.gizmos){let n=this.gizmos[i];n instanceof Fg&&(n.visible=!1)}}}}),yx=z(()=>{tt(),px(),nd(),Ya=class extends id(xp,gp){constructor(t,e){super(),this.super_Entity(t,e),this.objectHelper.update(),this.data.type==="Empty"&&(this.objectHelper.visible=!1)}updateState(t,e){this.updateState_Entity(t,e),"buffer"in t&&Object.keys(t).length===1&&e.scene.reloadSplats()}}});function Js(t,e,i,n,r,s,a){Vm.set(r,s,a).unproject(n);let o=e[t];if(o!==void 0){let l=i.getAttribute("position");for(let c=0,h=o.length;c<h;c++)l.setXYZ(o[c],Vm.x,Vm.y,Vm.z)}}var Vm,ds,v4,pk,bY=z(()=>{tt(),a0(),o0(),Vm=new T,ds=new Kl,v4=class extends bu{constructor(t){let e=new jt,i=new jo({color:16777215,vertexColors:!0,toneMapped:!1}),n=[],r=[],s={},a=new Jt(15711266),o=new Jt(15711266),l=new Jt(2857471);function c(d,u,p){h(d,p),h(u,p)}function h(d,u){n.push(0,0,0),r.push(u.r,u.g,u.b),s[d]===void 0&&(s[d]=[]),s[d].push(n.length/3-1)}c("n1","n2",a),c("n2","n4",a),c("n4","n3",a),c("n3","n1",a),c("f1","f2",a),c("f2","f4",a),c("f4","f3",a),c("f3","f1",a),c("n1","f1",a),c("n2","f2",a),c("n3","f3",a),c("n4","f4",a),c("p","n1",o),c("p","n2",o),c("p","n3",o),c("p","n4",o),c("u1","u2",l),c("u2","u3",l),c("u3","u1",l),e.setAttribute("position",new Nt(n,3)),e.setAttribute("color",new Nt(r,3)),super(e,i),this.type="CameraHelper",this.camera=t,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=s,this.update()}update(){let t=this.geometry,e=this.pointMap;ds.projectionMatrixInverse.elements=[.5112609807824982,-0,-0,-0,-0,.41421356237309503,-0,-0,-0,-0,-0,-.099999,-0,-0,-1.0000000000000002,.100001];let i=.8;Js("n1",e,t,ds,-1,-1,i),Js("n2",e,t,ds,1,-1,i),Js("n3",e,t,ds,-1,1,i),Js("n4",e,t,ds,1,1,i);let n=i;Js("f1",e,t,ds,-1,-1,n),Js("f2",e,t,ds,1,-1,n),Js("f3",e,t,ds,-1,1,n),Js("f4",e,t,ds,1,1,n);let r=n;Js("u1",e,t,ds,.35,1.1,r),Js("u2",e,t,ds,-.35,1.1,r),Js("u3",e,t,ds,0,1.55,r),t.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}},pk=class extends Sp(v4){constructor(t){super(t),this.object=t,this.name=`CombinedCameraHelper: ${t.uuid}`}updateMatrixWorld(t){super.updateMatrixWorld(t),this.updateTarget()}updateTarget(){let t=this.object.getTarget();this.updateWorldMatrix(!0,!1),this.worldToLocal(t)}raycast(t,e){Mp(this.object,this.geometry,t,e,!0)}}});function y4(t){return 1-Math.pow(1-t,3)}var Qh,Pv,Dv,Rv,Nd,Iv,La,Zi,Ws=z(()=>{tt(),bY(),$t(),nd(),ti(),Qh=new T,Pv=new T,Dv=new Wt,Rv=new T,Nd=new T,Iv=new T,La=class extends id(Kl,pk){constructor(t="",e={...pg.defaultData,name:""}){super(),this._cameraType="OrthographicCamera",this.targetOffset=il.DefaultTargetOffset,this.isUpVectorFlipped=!1,this.angleOffsetFromUp=0,this.wasMovedByUser=!1,this.wasMovedBySwitchCameraAction=!1,this._createdAt=typeof performance<"u"?performance.now():0,this._tickProjectionTransition=()=>{let r=this._projectionTransition;if(r===void 0)return;if(this.disposed)return void this._endProjectionTransition();r.raf=requestAnimationFrame(this._tickProjectionTransition);let s=La.projectionTransitionRequestRender??r.requestRender;this.updateProjectionMatrix(),s?.()},this.super_Entity(t,e),this.previousProjectionMatrix=new At,this.matrixAutoUpdate=!0,this.width=window.innerWidth,this.height=window.innerHeight;let i=this.width,n=this.height;this.orthoCamera=new pp(-.5*i,.5*i,.5*n,-.5*n,-5e4,1e4),this.perspCamera=new qu(45,i/n,50,1e4),this.left=this.orthoCamera.left,this.right=this.orthoCamera.right,this.top=this.orthoCamera.top,this.bottom=this.orthoCamera.bottom,this.far=this.orthoCamera.far,this.view=this.orthoCamera.view,this.aspect=this.perspCamera.aspect,this.focus=this.perspCamera.focus,this.filmGauge=this.perspCamera.filmGauge,this.filmOffset=this.perspCamera.filmOffset,this.objectHelper.update()}static withoutProjectionTransition(t){let e=La.projectionTransitionsEnabled;La.projectionTransitionsEnabled=!1;try{return t()}finally{La.projectionTransitionsEnabled=e}}get isPerspectiveCamera(){return this.cameraType==="PerspectiveCamera"}get isOrthographicCamera(){return!this.isPerspectiveCamera}get cameraType(){return this._cameraType}set fov(t){this.perspCamera.fov=t}get fov(){return this.perspCamera.fov}setNear(t,e){t==="PerspectiveCamera"?this.perspCamera.near=e:this.orthoCamera.near=e}setZoom(t,e){e>=0&&(t==="PerspectiveCamera"?this.perspCamera.zoom=e:this.orthoCamera.zoom=e)}set cameraType(t){t==="PerspectiveCamera"?this.toPerspective():t==="OrthographicCamera"&&this.toOrthographic()}get near(){return this._cameraType==="PerspectiveCamera"?this.perspCamera.near:this.orthoCamera.near}set near(t){this._cameraType==="PerspectiveCamera"?this.perspCamera.near=t:this.orthoCamera.near=t}get zoom(){return this._cameraType==="PerspectiveCamera"?this.perspCamera.zoom:this.orthoCamera.zoom}set zoom(t){t>=0&&(this._cameraType==="PerspectiveCamera"?this.perspCamera.zoom=t:this.orthoCamera.zoom=t)}lookAt(t,e,i){typeof t=="number"&&(t=new T(t,e,i)),super.lookAt(t),this.getWorldPosition(Qh),this.targetOffset=Qh.distanceTo(t)}getTarget(t=new T){return this.getWorldDirection(Pv),this.getWorldPosition(Qh),Pv.multiplyScalar(this.targetOffset),t.copy(Qh).add(Pv),t}getDistanceToTarget(){let t=this.getTarget();return this.getWorldPosition(Qh),Qh.distanceTo(t)}updateUp(){this.getWorldQuaternion(Dv),Rv.set(0,0,1).applyQuaternion(Dv),Nd.copy(_i.DEFAULT_UP),this.isUpVectorFlipped&&Nd.negate(),Nd.applyQuaternion(Dv),Iv.copy(_i.DEFAULT_UP).projectOnPlane(Rv),this.angleOffsetFromUp=Iv.angleTo(Nd),this.angleOffsetFromUp*=Iv.cross(Nd).dot(Rv)>=0?1:-1}updateTransformState(t,e){let i=super.updateTransformState(t,e);return t.isUpVectorFlipped!==void 0&&(this.isUpVectorFlipped=t.isUpVectorFlipped),this.updateUp(),i}getViewFrontToObject(t){let e=t.getWorldPosition(new T),i=t.getWorldDirection(new T).multiplyScalar(this.targetOffset);return{position:e.clone().add(i),target:e}}getViewToTarget(t){let e=this.getWorldDirection(new T).multiplyScalar(this.targetOffset);return{position:t.clone().sub(e),target:t}}getViewToObject(t){let e=new T;return t.getWorldPosition(e),this.getViewToTarget(e)}setViewplaneSize(t,e,i=!1){if(this.aspect=t/e,i){let n=t>e?this.aspect:1,r=t>e?1:this.aspect;this.left=-395*n,this.right=395*n,this.top=1/r*395,this.bottom=1/r*-395}else this.left=.5*-t,this.right=.5*t,this.top=.5*e,this.bottom=.5*-e;this.updateProjectionMatrix()}copyViewPlaneSize(t){this.aspect=t.aspect,this.left=t.left,this.right=t.right,this.top=t.top,this.bottom=t.bottom,this.updateProjectionMatrix()}toOrthographic(){this.orthoCamera.left=this.left,this.orthoCamera.right=this.right,this.orthoCamera.top=this.top,this.orthoCamera.bottom=this.bottom,this.orthoCamera.view=this.view,this.orthoCamera.far=this.far,this.orthoCamera.updateProjectionMatrix(),this.projectionMatrix=this.orthoCamera.projectionMatrix,this.projectionMatrixInverse=this.orthoCamera.projectionMatrixInverse,this._cameraType="OrthographicCamera",this._applyProjectionTransition(),this.objectHelper&&this.objectHelper.update()}toPerspective(){this.perspCamera.aspect=this.aspect,this.perspCamera.fov=this.fov,this.perspCamera.view=this.view,this.perspCamera.far=this.far,this.perspCamera.updateProjectionMatrix(),this.projectionMatrix=this.perspCamera.projectionMatrix,this.projectionMatrixInverse=this.perspCamera.projectionMatrixInverse,this._cameraType="PerspectiveCamera",this._applyProjectionTransition(),this.objectHelper&&this.objectHelper.update()}get isProjectionTransitioning(){return this._projectionTransition!==void 0}get projectionTransitionProgress(){let t=this._projectionTransition;if(t===void 0)return 1;let e=(performance.now()-t.start)/t.duration;return e>=1?1:e<=0?0:y4(e)}get _activeSubCamera(){return this._cameraType==="PerspectiveCamera"?this.perspCamera:this.orthoCamera}_canAnimateProjection(){return La.projectionTransitionsEnabled&&typeof requestAnimationFrame=="function"&&typeof performance<"u"&&performance.now()-this._createdAt>=La.projectionTransitionMinAgeMs}_beginProjectionTransition(t){let e=this._projectionTransition;e===void 0&&(e={from:new At,blend:new At,blendInverse:new At,start:0,duration:La.projectionTransitionDuration,referenceDepth:1,raf:0,requestRender:t},this._projectionTransition=e),e.from.copy(this.projectionMatrix),e.start=performance.now(),e.duration=La.projectionTransitionDuration,e.referenceDepth=Number.isFinite(this.targetOffset)?Math.max(1,this.targetOffset):1,t&&(e.requestRender=t),e.raf!==0&&cancelAnimationFrame(e.raf),e.raf=requestAnimationFrame(this._tickProjectionTransition)}_applyProjectionTransition(){let t=this._projectionTransition;if(t===void 0)return;let e=(performance.now()-t.start)/t.duration;if(e>=1)return void this._endProjectionTransition();let i=y4(e),n=t.from.elements,r=this._activeSubCamera.projectionMatrix.elements,s=t.blend.elements,a=t.referenceDepth,o=Math.max(1e-6,n[15]-n[11]*a),l=i*o/(i*o+(1-i)*Math.max(1e-6,r[15]-r[11]*a));for(let c=0;c<16;c++)s[c]=n[c]+(r[c]-n[c])*l;t.blendInverse.copy(t.blend).invert(),this.projectionMatrix=t.blend,this.projectionMatrixInverse=t.blendInverse}_endProjectionTransition(){let t=this._projectionTransition;if(t===void 0)return;t.raf!==0&&cancelAnimationFrame(t.raf),this._projectionTransition=void 0;let e=this._activeSubCamera;this.projectionMatrix=e.projectionMatrix,this.projectionMatrixInverse=e.projectionMatrixInverse}_syncProjectionTransition(t){let e=t._projectionTransition;if(e===void 0)return void(this._projectionTransition!==void 0&&this._endProjectionTransition());let i=this._projectionTransition;i===void 0?(i={from:new At,blend:new At,blendInverse:new At,start:0,duration:1,referenceDepth:1,raf:0,requestRender:void 0},this._projectionTransition=i):i.raf!==0&&(cancelAnimationFrame(i.raf),i.raf=0),i.requestRender=void 0,i.from.copy(e.from),i.start=e.start,i.duration=e.duration,i.referenceDepth=e.referenceDepth,this._applyProjectionTransition()}setFocalLength(t){this.perspCamera.setFocalLength(t),this.toPerspective()}getFocalLength(){return this.perspCamera.getFocalLength()}getEffectiveFOV(){return this.perspCamera.getEffectiveFOV()}getFilmWidth(){return this.perspCamera.getFilmWidth()}getFilmHeight(){return this.perspCamera.getFilmHeight()}setViewOffset(t,e,i,n,r,s){this._cameraType==="PerspectiveCamera"?this.perspCamera.setViewOffset(t,e,i,n,r,s):this.orthoCamera.setViewOffset(t,e,i,n,r,s),this._applyProjectionTransition()}clearViewOffset(){this._cameraType==="PerspectiveCamera"?(this.perspCamera.clearViewOffset(),this.toPerspective()):(this.orthoCamera.clearViewOffset(),this.toOrthographic())}copyHistory(){this.previousProjectionMatrix&&this.previousProjectionMatrix.copy(this.projectionMatrix)}updateProjectionMatrix(){this._cameraType==="PerspectiveCamera"?this.toPerspective():this._cameraType==="OrthographicCamera"&&this.toOrthographic()}updateMatrixWorld(t){super.updateMatrixWorld(t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(t,e){super.updateWorldMatrix(t,e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}copy(t,e){return super.copy(t,e),this.parent=t.parent,this.orthoCamera.copy(t.orthoCamera),this.perspCamera.copy(t.perspCamera),this.left=t.left,this.right=t.right,this.top=t.top,this.bottom=t.bottom,this.far=t.far,this.view=t.view===null?null:Object.assign({},t.view),this._cameraType=t._cameraType,this.aspect=t.aspect,this.fov=t.fov,this.focus=t.focus,this.filmGauge=t.filmGauge,this.filmOffset=t.filmOffset,this.targetOffset=il.sanitizeTargetOffset(t.targetOffset),this.updateProjectionMatrix(),this._syncProjectionTransition(t),this}toCameraState(t=[]){return eA({type:this.cameraType,far:this.far,orthographic:{near:this.orthoCamera.near,zoom:this.orthoCamera.zoom},perspective:{near:this.perspCamera.near,fov:this.perspCamera.fov,zoom:this.perspCamera.zoom},up:this.up.toArray(),targetOffset:this.targetOffset,isUpVectorFlipped:this.isUpVectorFlipped},t)}updateCameraSubtype(t,e){let i=t==="perspective"?"PerspectiveCamera":"OrthographicCamera";e.zoom!==void 0&&this.setZoom(i,e.zoom),e.near!==void 0&&this.setNear(i,e.near),e.fov!==void 0&&i==="PerspectiveCamera"&&(this.fov=e.fov)}updateState(t,e){this.updateCameraState(t,e)}updateCameraState(t,e){this.updateState_Entity(t,e),t.far!==void 0&&(this.far=t.far),t.orthographic!==void 0&&this.updateCameraSubtype("orthographic",t.orthographic),t.perspective!==void 0&&this.updateCameraSubtype("perspective",t.perspective),t.type!==void 0&&(t.type!==this._cameraType&&this._canAnimateProjection()&&this._beginProjectionTransition(e?.shared.requestRender),this.cameraType=t.type),t.up!==void 0&&this.up.fromArray(t.up.map(i=>typeof i=="number"?i:0)),t.targetOffset!==void 0&&(this.targetOffset=il.sanitizeTargetOffset(t.targetOffset)),t.isUpVectorFlipped!==void 0&&(this.isUpVectorFlipped=t.isUpVectorFlipped),this.updateProjectionMatrix()}updateByPatchedOp(t,e,i){super.updateByPatchedOp(t,e,i),t.path.length===1&&t.type===0&&this.updateCameraSubtype(t.path[0],t.props)}toState(t){return{...super.toState(t),...this.toCameraState(t),type:this.cameraType}}},(Zi=La).projectionTransitionsEnabled=!1,Zi.projectionTransitionDuration=350,Zi.projectionTransitionMinAgeMs=1e3});function fk(t){return t.type==="TorusGeometry"&&t.arc===360}var mk,Ov,XA,Xg=z(()=>{tt(),mk=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i=Object.assign({},e?.parameters??{width:100,revolutions:2,segments:40,pathRadius:10,pathType:0,pathSegments:30,cornerRadius:30,cornerSegments:4},t.parameters),n=Math.abs(i.width),r=Math.abs(i.height??n),s=Math.abs(i.depth??n),a=Math.abs(Math.min(n,s))/2;return{parameters:Object.assign(i,{width:n,height:r,depth:s,radius:a,segments:Math.round(i.segments),pathSegments:Math.round(i.pathSegments),cornerSegments:Math.round(i.cornerSegments)})}}static build(t){let{width:e,height:i,depth:n,radius:r,revolutions:s,segments:a,pathRadius:o,pathType:l,pathSegments:c,cornerRadius:h,cornerSegments:d}=t.parameters,u=new XA(!1,e,i,n,r,s,a,o,l,c,h,d);return Object.assign(u,{userData:{...t,type:"HelixGeometry"}})}},Ov=new lh([0,0,0],1),XA=class extends jt{constructor(t=!0,e=1,i=1,n=1,r=1,s=1,a=1,o=1,l=1,c=1,h=1,d=1){if(super(),s===0)return;let u=t&&s===1;u&&(d=0),h>100&&(h=100),h===0&&(d=0);let p,f,g,m,v,y,_,b,x=()=>new T,w=new T,S=x(),E=x(),A=x(),P=x(),C=x(),R=x(),L=x(),D=x(),F=x(),V=x(),U=x(),j=i-2*o+.001,W=j/s,it=Math.ceil(a*s),nt=it+1,Y=j/it,ot=-j/2,ht=c+1,ft=2*Math.PI/c,pt=Math.PI/2/d,J=Math.min((1-h/100)*o,o-.01),mt=o-J,N=0,O=2*d+2,H=ht*O/2,$=H+ht*nt,B=Math.max(0,ht*(nt+O)),[Z,K,k]=[3,3,2].map(Gt=>Array(B*Gt).fill(0)),st=[],dt=r-o;function bt(Gt,Ft){let _e=Math.PI/2;y=Ft*Y,b=2*Math.PI*(y%W)/W+_e,y+=ot,_=Math.sin(b)*dt,v=Math.cos(b)*dt,t?Gt.set(v,_,y):Gt.set(v,y,_)}bt(w,-1e-10),bt(S,0),P.copy(w),bt(w,1);let ct=w.distanceTo(S),It=u?0:mt+J,St=ct*it+2*It,Dt=J,Mt=St-It;for(let Gt=0;Gt<=it;Gt++){bt(E,Gt),U.subVectors(E,P).normalize(),P.copy(E),F.copy(E).setComponent(+t+1,0).normalize(),V.crossVectors(U,F).normalize();let Ft=Gt===0,_e=Gt===it,be=Ft?3*Math.PI/2:pt,ji=Ft?Dt:Mt,oe=Ft?ht:$,le=Ft?0:B-ht,Pe=U.clone().multiplyScalar(Ft?-mt:mt).add(E),si=U.clone().multiplyScalar(Ft?-1:1).normalize();for(let ze=0;ze<ht;ze++){let Ci=ze*ft;if(C.addVectors(w.copy(F).multiplyScalar(o*Math.cos(Ci)),S.copy(V).multiplyScalar(o*Math.sin(Ci))),R.copy(C).normalize(),Ft||_e){u||(N=le+ze,[0,1,2].forEach(ui=>{Z[3*N+ui]=Pe.getComponent(ui),K[3*N+ui]=si.getComponent(ui)}),k[2*N]=+_e,k[2*N+1]=ze/c),S.copy(R).multiplyScalar(J),A.addVectors(E,S);for(let ui=0;ui<d;ui++){let sn=ui*pt+be;L.addVectors(w.copy(U).multiplyScalar(mt*Math.sin(sn)),S.copy(R).multiplyScalar(mt*Math.cos(sn))),D.copy(L).normalize(),S.addVectors(A,L),L.normalize(),N=oe+ui*ht+ze,[0,1,2].forEach(_n=>{Z[3*N+_n]=S.getComponent(_n),K[3*N+_n]=D.getComponent(_n)});let Qr=+Ft+Math.sin(sn);k[2*N]=(ji+mt*Qr)/St,k[2*N+1]=ze/c}}S.addVectors(E,C),N=H+Gt*ht+ze,[0,1,2].forEach(ui=>{Z[3*N+ui]=S.getComponent(ui),K[3*N+ui]=R.getComponent(ui)}),k[2*N]=(It+Gt*ct)/St,k[2*N+1]=ze/c}}let q=nt+2*d+2,[_t,Pt]=[+u,q-1];for(let Gt=_t;Gt<=Pt-1;Gt++){let Ft=u&&Gt===Pt-1;for(let _e=0;_e<ht-1;_e++)p=Gt*ht+_e,f=p+1,g=(Ft?_e:p)+ht,m=(Ft?_e+1:f)+ht,Gt===0?st.push(f,m,g):Gt===q-2?st.push(p,f,g):st.push(p,f,g,f,m,g)}this.setIndex(st),this.setAttribute("position",new Nt(Z,3)),this.setAttribute("normal",new Nt(K,3)),this.setAttribute("uv",new Nt(k,2))}getClosedTorusIndicesForBooleanOrSubdiv(){let t,e,i,n,r=this.userData.parameters,s=Math.ceil(r.tubularSegments),a=r.radialSegments,o=a+1,l=[];for(let c=1;c<s;c++)for(let h=0;h<a;h++)t=c*o+h,e=t+1,i=t+o,n=e+o,l.push(t,e,i,e,n,i);for(let c=0;c<a;c++)t=s*o+c,e=t+1,i=c+o,n=c+1+o,l.push(t,e,i,e,n,i);return Ov.array=new Uint32Array(l),Ov.count=l.length,Ov}}});function xY(t){return b4||(b4=async function(){let e=t??"https://cdn.spline.design/@splinetool/runtime@2.0.77/build",i=import("./boolean.js"),[n,r]=await Promise.all([i,fetch(`${e}/boolean.wasm`).then(s=>s.arrayBuffer())]);await n.default({module_or_path:r}),$g=n}())}function fb(){if($g===void 0)throw new Error("boolean-wasm is not loaded");return $g}function u3(t){let e=Yg.get(t);if(e===void 0)throw new Error("Unknown csg mesh set handle "+t);return e}function p3(t){return Yg.set(++$A,t),$A}function wY(t,e,i){if($g===void 0)return-1;let{positions:n,indices:r,normals:s}=function(a,o){if(o&&a.userData.positions!==void 0){let p=a.userData,f=[];for(let g=0,m=0;g<p.verticesPerFace.length;g++){let v=p.verticesPerFace[g];for(let y=1;y<v-1;y++)f.push(p.indices[m],p.indices[m+y],p.indices[m+y+1]);m+=v}return{positions:p.positions instanceof Float32Array?p.positions:new Float32Array(p.positions),indices:new Uint32Array(f)}}let l;l=fk(a.userData.parameters)?a.getClosedTorusIndicesForBooleanOrSubdiv():a.getIndex();let c,h=a.getAttribute("position");if(l===null){c=new Uint32Array(h.count);for(let p=0;p<c.length;p++)c[p]=p}else c=l.array instanceof Uint32Array?l.array:new Uint32Array(l.array);let d=a.getAttribute("normal"),u=d!==void 0&&d.itemSize===3&&d.count===h.count&&d.array instanceof Float32Array&&d.isInterleavedBufferAttribute!==!0?d.array:void 0;return{positions:h.array,indices:c,normals:u}}(t,e);return p3(new $g.CsgMesh(n,r,s))}function _4(t,e){let i=fb(),n=vk[e];if(n===void 0)throw new Error("Unknown boolean operation "+e);let r=t.map(u3);if(r.length===1)return i.clone_mesh(r[0]);let s,a=[];if(e===2&&r.length>2){let o=r[0];for(let l=1;l<r.length-1;l++)o=i.boolean_mesh(o,r[l],0),a.push(o);s=i.boolean_mesh(r[r.length-1],o,2)}else if(e===2)s=i.boolean_mesh(r[1],r[0],2);else{let o=r[r.length-1];for(let l=0;l<r.length-1&&(o=i.boolean_mesh(o,r[l],n),a.push(o),o.tri_count()!==0);l++);s=o,a.pop()}for(let o of a)o.free();return s}function e2(t,e){u3(t).transform(new Float32Array(e.elements))}function gk(t){let e=Yg.get(t);e!==void 0&&(e.free(),Yg.delete(t))}var $g,Yg,$A,b4,vk,_x=z(()=>{tt(),Xg(),Yg=new Map,$A=0,vk={0:0,1:1,2:2}});function Jh(t){return t!==null&&"booleanOp"in t}var YA,yk,SY=z(()=>{tt(),qr(),_x(),YA=class extends vx(gi){constructor(){super(...arguments),this.booleanMeshSetAddress=-1,this.booleanWasTransformed=!1,this.booleanMatrixInvOld=new At}updateVisible(t){super.updateVisible(t),this.visible=!Jh(this.parent)&&this.visible,Jh(this.parent)&&this.parent.invalidateDownstreamBooleanData()}onClonerLayoutUpdated(){Jh(this.parent)&&this.invalidateDownstreamBooleanData()}freeBooleanPointer(){this.booleanMeshSetAddress!==-1&&(gk(this.booleanMeshSetAddress),this.booleanMeshSetAddress=-1)}invalidateDownstreamBooleanData(t=!1){return t?this.booleanWasTransformed=!0:this.freeBooleanPointer(),Jh(this.parent)?this.parent.invalidateDownstreamBooleanData():this}invalidateUpstreamBooleanData(){this.freeBooleanPointer();for(let t of this.children)t instanceof YA&&(t.freeBooleanPointer(),Jh(t)&&t.invalidateUpstreamBooleanData())}updateTransformState(t,e){let i=super.updateTransformState(t,e);return i&&Jh(this.parent)&&this.invalidateDownstreamBooleanData(!0),i}onVariableUpdate(t=!1){super.onVariableUpdate(t),Jh(this.parent)&&this.invalidateDownstreamBooleanData(!0)}}}),MY=z(()=>{yk=null});function f3(t,e=0,i=t.count,n,r){let s=1/0,a=1/0,o=1/0,l=-1/0,c=-1/0,h=-1/0;for(let d=e;d<i;d++){let u=t.getX(d),p=t.getY(d),f=t.getZ(d);u<s&&(s=u),p<a&&(a=p),f<o&&(o=f),u>l&&(l=u),p>c&&(c=p),f>h&&(h=f)}jm.min.set(s,a,o),jm.max.set(l,c,h),jm.getCenter(n),jm.getSize(r).multiplyScalar(.5)}var jm,x4,w4,Yi,Kn=z(()=>{tt(),SY(),MY(),jm=new ci,x4=new jt,w4=new Hs,Yi=class extends YA{constructor(t,e){super(x4,w4),this.super_Entity(t,e)}updateState(t,e){this.updateState_Entity(t,e)}raycast(t,e){if(this.raycastDeformed(t,e))return;let i=yk;i===null?super.raycast(t,e):i(this,t,e)}raycastDeformed(t,e){return!1}updateEntityBoxSize(t,e){let i=this.geometry.getAttribute("position");i!==void 0?f3(i,this.geometry.drawRange.start,this.geometry.drawRange.count<1/0?this.geometry.drawRange.count:i.count,t,e):super.updateEntityBoxSize(t,e)}}});function mb(t){return t?.isClassicNodeMaterial===!0}var yn,Zg,_k,bk,yg,xk,wk,Sk,m3=z(()=>{}),_a=z(()=>{tt(),yn=class extends Jt{constructor(t,e,i,n){super(t,e,i),this.isColorA=!0,this.a=n}setRGBA(t,e,i,n){super.setRGB(t,e,i),this.a=n}copy(t){return super.copy(t),this.a="a"in t?t.a:1,this}clone(){return new this.constructor(this.r,this.g,this.b,this.a)}equals(t){return super.equals(t)&&this.a===t.a}setStyle(t,e="srgb"){let i;if(t==="transparent")return this.setRGBA(0,0,0,0),this;if(i=/^((?:rgb|hsl)a?)\(([^)]*)\)/.exec(t)){let n,r=i[1],s=i[2];switch(r){case"rgb":case"rgba":if(n=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return this.a=r==="rgba"?parseFloat(n[4]):1,super.setStyle(t,e);break;case"hsl":case"hsla":if(n=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)%\s*,\s*(\d*\.?\d+)%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return this.a=r==="hsla"?parseFloat(n[4]):1,super.setStyle(t,e)}}return super.setStyle(t,e)}get x(){return this.r}get y(){return this.g}get z(){return this.b}get w(){return this.a}set x(t){this.r=t}set y(t){this.g=t}set z(t){this.b=t}set w(t){this.a=t}}}),Mk=z(()=>{_a(),Zg=class extends yn{}}),EY=z(()=>{_k=class{constructor(t=1e4){this.timeout=t,this.cache=new Map,this.head={data:null,time:0,src:null,next:null,prev:null},this.tail={data:null,time:1/0,src:null,next:null,prev:null},this.hasClean=!1,this.cleanupTimer=null,this.head.next=this.tail,this.tail.prev=this.head}log(...t){}remove(t){let e=this.cache.get(t);e&&(this.dispose(t,e.data),this.cache.delete(t),e.prev.next=e.next,e.next.prev=e.prev,e.next=null,e.prev=null,e.data=null)}scheduleCleanup(){this.hasClean||(this.log("scheduled cleanup"),this.hasClean=!0,this.cleanupTimer=setTimeout(()=>{this.hasClean=!1,this.cleanupTimer=null,this.log("cleaning");let t=Date.now(),e=this.head.next;for(;e.time<t-this.timeout;){this.dispose(e.src,e.data),this.cache.delete(e.src);let i=e;e=e.next,e.prev=this.head,this.head.next=e,i.next=null,i.prev=null,i.data=null}this.head.next!==this.tail?this.scheduleCleanup():this.log("no more cleanup")},this.timeout+1e3))}has(t){return this.cache.get(t)?.data}load(t){let e=Date.now(),i=this.cache.get(t);return i===void 0?(i={data:this.create(t),src:t,time:e,next:null,prev:null},this.cache.set(t,i)):(i.time=e,i.prev.next=i.next,i.next.prev=i.prev),i.prev=this.tail.prev,i.next=this.tail,this.tail.prev.next=i,this.tail.prev=i,this.scheduleCleanup(),i.data}disposeAll(){this.cleanupTimer!==null&&(clearTimeout(this.cleanupTimer),this.cleanupTimer=null),this.hasClean=!1,this.cache.forEach((t,e)=>{this.dispose(e,t.data),t.next=null,t.prev=null,t.data=null}),this.cache.clear(),this.head.next=this.tail,this.tail.prev=this.head}destroy(){this.disposeAll(),this.head=null,this.tail=null}}}),Ek=z(()=>{EY(),bk=class extends _k{create(t){return URL.createObjectURL(new Blob([t]))}dispose(t,e){URL.revokeObjectURL(e)}}}),Ak=z(()=>{xk=class{constructor(t,e){this.data=t,this.cache=e,this.refCount=0}deref(){this.refCount,this.refCount-=1,this.refCount===0&&(this.cache.remove(this),this.dispose())}dispose(){this.refCount}},wk=class{constructor(){this.cache=new Map}remove(t){this.cache.delete(t.data)}load(t){let e=this.cache.get(t);return e===void 0&&(e=this.create(t),this.cache.set(t,e)),e.refCount+=1,e}}}),AY=z(()=>{tt(),Sk=class extends uF{constructor(t){super(t),this.type=$n}parse(t){let e=function(p,f){switch(p){case 1:throw new Error("THREE.HDRLoader: Read Error: "+(f||""));case 2:throw new Error("THREE.HDRLoader: Write Error: "+(f||""));case 3:throw new Error("THREE.HDRLoader: Bad File Format: "+(f||""));default:throw new Error("THREE.HDRLoader: Memory Error: "+(f||""))}},i=function(p,f,g){f=f||1024;let m=p.pos,v=-1,y=0,_="",b=String.fromCharCode.apply(null,new Uint16Array(p.subarray(m,m+128)));for(;0>(v=b.indexOf(`
4172
+ })();`}),QF=z(()=>{jC=class{constructor(t,e,i){this.deps=t,this.onConsole=e,this.onEvent=i,this.disposed=!1,this.eventUnsubs=new Map,this.variablePollHandle=null,this.lastVariables=null}dispose(){this.disposed=!0;for(let t of this.eventUnsubs.values())t();this.eventUnsubs.clear(),this.stopVariablePolling()}execute(t,e){let i=this.deps;switch(t){case"setVariable":{let n=i.setVariable(String(e[0]),e[1]);return n.warning&&this.onConsole("warn",n.warning),n.ok}case"setVariables":{let n=e[0]??{},r=!0;for(let[s,a]of Object.entries(n)){let o=i.setVariable(s,a);o.warning&&this.onConsole("warn",o.warning),r=r&&o.ok}return r}case"getVariable":return i.getVariable(String(e[0]));case"getVariables":return i.getVariables();case"getAllObjects":return i.getAllObjects();case"findObjectByName":case"findObjectById":return i.findObject(String(e[0]));case"getGeometry":{let n=i.getGeometry(String(e[0]),e[1]??{});return n.warning&&this.onConsole("warn",n.warning),n.data}case"updateObject":return i.updateObject(String(e[0]),e[1]??{});case"createObject":return i.createObject(String(e[0]),e[1]??{});case"createCustomMaterial":if(i.createCustomMaterial===void 0)throw new Error("createCustomMaterial: not available on this surface \u2014 custom three.js/TSL materials need the inline HTML-content mode (editor Preview/Play and web exports).");return i.createCustomMaterial(e[0]);case"getTexture":if(i.getTexture===void 0)throw new Error("getTexture: not available on this surface \u2014 a three.js texture instance needs the inline HTML-content mode (editor Preview/Play and web exports).");return i.getTexture(String(e[0]),e[1]??{});case"setMaterial":if(i.setMaterial===void 0)throw new Error("setMaterial: not available on this surface \u2014 custom three.js/TSL materials need the inline HTML-content mode (editor Preview/Play and web exports).");return i.setMaterial(String(e[0]),e[1]);case"cloneObject":return i.cloneObject(String(e[0]),e[1]??{});case"removeObject":return i.removeObject(String(e[0]));case"spawnObject":{let n=i.spawnObject(String(e[0]),e[1]??{});return n.warning&&this.onConsole("warn",n.warning),n.object}case"destroyObject":return i.destroyObject(String(e[0]));case"setInstanceTransforms":{let n=e[1]===null||e[1]===void 0?null:e[1],r=i.setInstanceTransforms(String(e[0]),n);return r<0&&this.onConsole("warn",`spline.setInstanceTransforms: "${String(e[0])}" has no cloner \u2014 make the object a cloner first (its copies are what this drives).`),r}case"emitEvent":case"emitEventReverse":{let n=i.emitEvent(String(e[0]),String(e[1]),t==="emitEventReverse");return n.warning&&this.onConsole("warn",n.warning),n.ok}case"requestRender":return i.requestRender(),!0;case"listenEvent":{let n=String(e[0]);return n==="variableChange"?this.startVariablePolling():this.eventUnsubs.has(n)||this.eventUnsubs.set(n,i.addSplineEventListener(n,r=>{this.onEvent(n,r)})),!0}case"unlistenEvent":{let n=String(e[0]);return n==="variableChange"?this.stopVariablePolling():(this.eventUnsubs.get(n)?.(),this.eventUnsubs.delete(n)),!0}default:throw new Error(`Unknown spline bridge method: ${t}`)}}startVariablePolling(){this.variablePollHandle===null&&(this.lastVariables=this.deps.getVariables(),this.variablePollHandle=window.setInterval(()=>{if(this.disposed)return;let t=this.deps.getVariables(),e=function(i,n){let r=[];for(let s of Object.keys(n))i[s]!==n[s]&&r.push({name:s,value:n[s]});return r}(this.lastVariables??{},t);this.lastVariables=t;for(let i of e)this.onEvent("variableChange",i)},100))}stopVariablePolling(){this.variablePollHandle!==null&&(window.clearInterval(this.variablePollHandle),this.variablePollHandle=null),this.lastVariables=null}}});function P$(t,e,i,n){return[t[0]*e+t[4]*i+t[8]*n+t[12],t[1]*e+t[5]*i+t[9]*n+t[13],t[2]*e+t[6]*i+t[10]*n+t[14]]}var D$=z(()=>{}),JF,R$=z(()=>{}),I$=z(()=>{GC(),QF(),JF=class{constructor(t,e,i){this.iframe=t,this.deps=e,this.onConsole=i,this.disposed=!1,this.handshakeSeen=!1,this.handshakeTimer=null,this.onMessage=n=>{if(this.disposed||n.source!==this.iframe.contentWindow)return;let r=n.data;var s;typeof(s=r)!="object"||s===null||s[jl]!==!0||typeof s.kind!="string"||this.handleMessage(r)},this.host=new jC(e,i,(n,r)=>{this.sendEvent(n,r)})}attach(){window.addEventListener("message",this.onMessage),this.send({[jl]:!0,kind:"ready-ack"}),this.handshakeTimer=window.setTimeout(()=>{this.handshakeTimer=null,!this.handshakeSeen&&!this.disposed&&this.onConsole("warn","The HTML content frame has not initialized (no signal from its scripts yet) \u2014 if the page looks frozen, check for errors in its code.")},6e3)}dispose(){this.disposed=!0,window.removeEventListener("message",this.onMessage),this.host.dispose(),this.handshakeTimer!==null&&(window.clearTimeout(this.handshakeTimer),this.handshakeTimer=null)}handleMessage(t){switch(t.kind){case"ready":this.handshakeSeen=!0,this.send({[jl]:!0,kind:"ready-ack"});break;case"console":this.onConsole(t.level,t.text);break;case"call":{let e;try{e=Promise.resolve(this.host.execute(t.method,t.args))}catch(i){e=Promise.reject(i)}e.then(i=>{this.send({[jl]:!0,kind:"result",id:t.id,ok:!0,value:i,error:void 0})},i=>{let n=i instanceof Error?i.message:String(i);this.send({[jl]:!0,kind:"result",id:t.id,ok:!1,value:void 0,error:n}),this.onConsole("error",n)});break}case"input":this.dispatchInput(t.event)}}send(t){this.iframe.contentWindow?.postMessage(t,"*")}sendEvent(t,e){this.send({[jl]:!0,kind:"event",eventName:t,payload:e})}dispatchInput(t){let e=this.deps.getCanvas();if(!e)return;let i=this.iframe.getBoundingClientRect(),n={bubbles:!0,cancelable:!0,view:window,shiftKey:t.shiftKey,ctrlKey:t.ctrlKey,altKey:t.altKey,metaKey:t.metaKey};switch(t.type){case"pointerdown":case"pointermove":case"pointerup":case"pointercancel":e.dispatchEvent(new PointerEvent(t.type,{...n,clientX:(t.x??0)+i.left,clientY:(t.y??0)+i.top,button:t.button,buttons:t.buttons,pointerId:t.pointerId,pointerType:t.pointerType,isPrimary:t.isPrimary,movementX:t.movementX,movementY:t.movementY}));break;case"click":case"dblclick":e.dispatchEvent(new MouseEvent(t.type,{...n,clientX:(t.x??0)+i.left,clientY:(t.y??0)+i.top,button:t.button,buttons:t.buttons}));break;case"wheel":{let r=new WheelEvent("wheel",{...n,clientX:(t.x??0)+i.left,clientY:(t.y??0)+i.top,deltaX:t.deltaX,deltaY:t.deltaY,deltaMode:t.deltaMode});typeof t.wheelDeltaX=="number"&&Object.defineProperty(r,"wheelDeltaX",{value:t.wheelDeltaX}),typeof t.wheelDeltaY=="number"&&Object.defineProperty(r,"wheelDeltaY",{value:t.wheelDeltaY}),e.dispatchEvent(r);break}case"keydown":case"keyup":e.dispatchEvent(new KeyboardEvent(t.type,{...n,key:t.key,code:t.code,repeat:t.repeat}))}}}}),ti=z(()=>{VC(),f$(),m$(),g$(),y$(),_$(),b$(),x$(),w$(),S$(),M$(),T$(),GC(),C$(),QF(),D$(),R$(),I$()}),O$=z(()=>{});function tN(t){return Array.isArray(t)?t:[t]}function N_(t,e){let i=0;for(;i<t.length&&i<e.length;){if(t[i]<e[i])return-1;if(t[i]>e[i])return 1;i+=1}return i!==e.length?-1:i!==t.length?1:0}var L$=z(()=>{});function Ar(t,e){return Object.setPrototypeOf(t,e),t}function fS(t){let e={...t};return Object.setPrototypeOf(e,Object.getPrototypeOf(t)),e}function Ql(t,e,i){if(t===void 0?e===void 0?(t=0,e=10):t=e-10:e===void 0&&(e=t+10),t>e){let s=t;t=e,e=s}let n=[],r=1/(i+1);for(let s=0;s<i;s++){let a=t+(e-t)*(s+.75+.5*Math.random())*r;n.push(a)}return n}function qc(t){return t instanceof Uint8Array||t instanceof Uint16Array||t instanceof Uint32Array||t instanceof Int8Array||t instanceof Int16Array||t instanceof Int32Array||t instanceof Float32Array||t instanceof Float64Array}var B$=z(()=>{});function HC(t){if(t.deepFreeze!==void 0)return void t.deepFreeze(t);let e=Object.getOwnPropertyNames(t);for(let i of e){let n=t[i];n&&typeof n=="object"&&HC(n)}return Object.freeze(t)}function eN(t){for(let e of Object.keys(t))t[e]===void 0&&delete t[e];return t}var mS,k_,iA,te,WC,U$=z(()=>{}),Dn=z(()=>{O$(),L$(),B$(),U$()}),qC=z(()=>{mS=class{},k_=class extends mS{constructor(t){super(),this.id=t}},iA=class extends mS{constructor(t){super(),this.data=t}}}),z$=z(()=>{}),rx=z(()=>{te=class{modifyById(t,e){let i=this;if(i[t]===void 0)throw new Error("not expected");{let n={...i,[t]:e};return Object.setPrototypeOf(n,te.prototype),n}}add(t,e){return this.runOp({type:1,id:t,data:e})?.data??this}runOp(t){let e=this;if(t.type===1){let i,n=e[t.id];i=n===void 0?{type:2,id:t.id}:{type:1,id:t.id,data:n};let{id:r,data:s}=t,a={...e,[r]:s};return Object.setPrototypeOf(a,te.prototype),{data:a,actual:t,reverse:i}}if(t.type===2){let{id:i}=t,n=e[i];if(n===void 0)return null;{let r={...e};return Object.setPrototypeOf(r,te.prototype),delete r[i],{data:r,actual:t,reverse:{type:1,id:i,data:n}}}}return null}}}),XC=z(()=>{WC=class extends Error{}});function iN(t,e){for(let i of t)e(i.id,i.data)!==!0&&iN(i.children,e)}function nN(t,e){if(e(t.id,t.data)!==!0)for(let i of t.children)nN(i,e)}var Xn,_v,fp,Vt,Jc=z(()=>{Dn(),XC(),Dn(),Xn=class extends Array{constructor(...t){super(...t),Qa(this,"partialObjectCaches"),Qa(this,"objCaches"),Qa(this,"parentCaches"),Object.setPrototypeOf(this,Xn.prototype)}deepFreeze(){let t=0;for(;t<this.length;)HC(this[t]),t++}fillCaches0(t,e){this.objCaches.set(t.id,t),this.parentCaches.set(t.id,e);for(let i of t.children)this.fillCaches0(i,t.id)}fillCaches(){if(this.objCaches===void 0){this.objCaches=new Map,this.parentCaches=new Map;for(let t of this)this.fillCaches0(t,null)}}randomId(){this.fillCaches();let t=Array.from(this.objCaches.keys());if(t.length!==0)return t[Math.max(0,Math.floor(Math.random()*t.length)-1)]}nonExistOrDescendantOf(t,e){if(!this.has(t))return!0;for(;t;){let i=this.parent(t);if(i===e)return!0;t=i}return!1}rootAcestor(t){for(;t;){let e=this.parent(t);if(!e)return t;t=e}return t}isDescendantOf(t,e){for(;t;){let i=this.parent(t);if(i===e)return!0;t=i}return!1}data(t){return this.get(t)?.data}has(t){return this.childrenOf(t)!==void 0}partialCache(t){this.partialObjectCaches===void 0&&(this.partialObjectCaches=new Map);let e=this.get(t);e!==void 0&&this.partialObjectCaches.set(t,e)}get(t){if(this.partialObjectCaches!==void 0){let e=this.partialObjectCaches.get(t);if(e!==void 0)return e}return this.fillCaches(),this.objCaches.get(t)}childrenOf(t){return t===null?this:this.get(t)?.children}traverseFrom(t,e){if(t===null)this.traverse(e);else{let i=this.get(t);i&&nN(i,e)}}traverse(t){iN(this,t)}totalSize(){return this.fillCaches(),this.objCaches.size}parent(t){return this.fillCaches(),this.parentCaches.get(t)}childrenArray(t){return t===null?this:this.get(t).children}modifyById(t,e){if(this.get(t)===void 0)throw new Error("not expected");{let i=this.parent(t),n=this.childrenArray(i),r=n.findIndex(o=>o.id===t);if(r<0)throw new Error("not expected");let s=n[r];n=[...n],n[r]={...s,data:e};let a=new Map;return a.set(t,n[r]),this.modifyArrayBy(i,n,a)}}modifyArrayBy(t,e,i=void 0){let n=t,r=e;for(;n!==null;){let a=r,o=n;if(n=this.parent(n),n===void 0)throw new Error;r=this.childrenArray(n);let l=r.findIndex(c=>c.id===o);if(l<0)throw new Error;r=[...r],r[l]={...r[l],children:a},i&&i.set(o,r[l])}Object.setPrototypeOf(r,Xn.prototype);let s=r;if(i&&this.objCaches!==void 0&&this.parentCaches!==void 0){s.objCaches=this.objCaches;for(let[a,o]of i)s.objCaches.set(a,o);s.parentCaches=this.parentCaches,this.objCaches=void 0,this.parentCaches=void 0}else s.fillCaches();return s}runOp(t){switch(t.type){case 7:return this.addOp(t);case 8:return this.deleteOp(t);case 9:return this.moveOp(t)}return null}checkDuplicatedIdRec({id:t,children:e}){if(this.get(t)!==void 0)return!0;for(let i of e)if(this.checkDuplicatedIdRec(i))return!0;return!1}addOp(t){let{parent:e,fi:i,id:n,data:r,children:s}=t;if(e!==null&&this.get(e)===void 0||this.checkDuplicatedIdRec(t))return null;{let a=e,o=this.childrenArray(a),l={fi:i,id:n,data:r,children:s};return o=[...o,l],o.sort((c,h)=>c.fi-h.fi),t.localIndex=o.indexOf(l),{data:this.modifyArrayBy(a,o),actual:t,reverse:{type:8,id:n}}}}deleteOp(t){let{id:e}=t;if(this.get(e)===null)return null;{let i=this.parent(e);if(i===void 0)return null;let n=this.childrenArray(i),r=n.findIndex(a=>a.id===e);t.localIndex=r,n=[...n];let s=n.splice(r,1)[0];return{data:this.modifyArrayBy(i,n),actual:t,reverse:{type:7,...s,parent:i}}}}moveOp(t){let{parent:e,fi:i,id:n}=t;if(e!==null&&this.get(e)===void 0)return this.deleteOp({type:8,id:n});if(e!==null){let d=e;for(;d!==null;){if(d===void 0)throw new Error;if(d===n)throw new WC("cyclic tree");d=this.parent(d)}}let r=this.parent(n);if(r===void 0)return null;let s=r,a=this.childrenArray(r),o=a.findIndex(d=>d.id===n);a=[...a];let l=a.splice(o,1)[0],c=this.modifyArrayBy(r,a);r=e,a=c.childrenArray(r);let h=l.fi;return l={...l,fi:i},a=[...a,l],a.sort((d,u)=>d.fi-u.fi),t.localIndex=a.indexOf(l),c=c.modifyArrayBy(r,a),{data:c,actual:t,reverse:{type:9,parent:s,fi:h,id:n}}}previous(t,e){if(e===null){let n=this.childrenArray(t);return n.length===0?null:n[n.length-1].id}let i=null;for(let n of this.childrenArray(t)){if(n.id===e)return i;i=n.id}return null}traverseSortNext(t){let e=this.parent(t);if(e!==void 0){let i=this.childrenArray(e),n=i.findIndex(r=>r.id===t)+1;if(n<i.length)return i[n].id;if(e)return this.traverseSortNext(e)}}sortNext(t){let e=this.childrenArray(t);return e.length>0?e[0].id:this.traverseSortNext(t)}traverseSortPrevious(t){let e=this.childrenArray(t);return e.length>0?this.traverseSortPrevious(e[e.length-1].id):t}sortPrevious(t){let e=this.parent(t);if(e!==void 0){let i=this.childrenArray(e),n=i.findIndex(r=>r.id===t)-1;return n>=0?this.traverseSortPrevious(i[n].id):e}}getAllSorted(t){let e=[];for(let i of t){let n=this.getWithSortKey(i.id);n!==void 0&&e.push({...i,...n})}e.sort((i,n)=>N_(i.sortKey,n.sortKey));for(let i of e)delete i.sortKey;return e}getAllIdSorted(t){let e=[];for(let i of t){let n=this.getWithSortKey(i);n!==void 0&&e.push(n)}e.sort((i,n)=>N_(i.sortKey,n.sortKey));for(let i of e)delete i.sortKey;return e.map(i=>i.id)}getWithSortKey(t){let e=t,i=[],n=this.get(e),r=n;if(n!==void 0){for(;e;)i.splice(0,0,n.fi),e=this.parent(e),e!==null&&(n=this.get(e));return{...r,sortKey:i}}}insertBeforeHelper(t,e,i){return this.insertAfterHelper(t,this.previous(t,e),i)}insertAfterHelper(t,e,i){let n=this.childrenArray(t);if(e===null){if(n.length===0)return Ql(0,i,i);{let r=n[0].fi;return Ql(r-i,r,i)}}{let r=this.get(e);if(r===void 0||this.parent(e)!==t)throw new Error("illegal args");let s=n.find(a=>a.fi>r.fi);if(s===void 0){let a=n[n.length-1].fi;return Ql(a,a+i,i)}return Ql(r.fi,s.fi,i)}}}}),$C=z(()=>{var t;Dn(),_v=null,(t=fp||(fp={})).setPreservePrototype=function(e){_v=e},t.tryPreservePrototype=function(e,i){return Object.getPrototypeOf(e)===_v&&Object.setPrototypeOf(i,_v),i},t.runOp=function(e,i){if(i.type!==0)return null;if(Array.isArray(e)||qc(e)){let n=i.props,r={},s=qc(e)?e.slice():[...e],a=!1;if(n)for(let o of Object.keys(n)){let l=parseInt(o);if(isNaN(l))throw new Error("wrong index");r[o]=s[l],s[l]=n[o],a=!0}return a?{data:s,actual:i,reverse:{type:0,props:r}}:null}{let n=i.props,r={},s={...e},a=!1;if(n)for(let o of Object.keys(n)){r[o]=s[o];let l=n[o];l===void 0?delete s[o]:s[o]=l,a=!0}return a?{data:t.tryPreservePrototype(e,s),actual:i,reverse:{type:0,props:r}}:null}}}),td=z(()=>{Dn(),Dn(),Vt=class extends Array{constructor(...t){super(...t),Qa(this,"objCaches"),Object.setPrototypeOf(this,Vt.prototype)}deepFreeze(){let t=0;for(;t<this.length;)HC(this[t]),t++}fillCaches0(t){this.objCaches.set(t.id,t)}fillCaches(){if(this.objCaches===void 0){this.objCaches=new Map,Object.getOwnPropertyDescriptor(this,"objCaches").enumerable=!1;for(let t of this)this.fillCaches0(t)}}randomId(){this.fillCaches();let t=Array.from(this.objCaches.keys());if(t.length!==0)return t[Math.max(0,Math.floor(Math.random()*t.length)-1)]}data(t){return this.get(t)?.data}get(t){return this.fillCaches(),this.objCaches.get(t)}modifyById(t,e){if(this.get(t)===void 0)throw new Error("not expected");{let i=this,n=i.findIndex(s=>s.id===t);if(n<0)throw new Error("not expected");let r=i[n];return i=[...i],i[n]={...r,data:e},this.modifyArrayBy(i)}}modifyArrayBy(t){Object.setPrototypeOf(t,Vt.prototype);let e=t;return typeof process<"u"||e.fillCaches(),e}runOp(t){switch(t.type){case 4:return this.addOp(t);case 5:return this.deleteOp(t);case 6:return this.moveOp(t)}return null}addOp(t){let{fi:e,id:i,data:n}=t,r=this,s={fi:e,id:i,data:n};return r=[...r,s],r.sort((a,o)=>a.fi-o.fi),t.localIndex=r.indexOf(s),{data:this.modifyArrayBy(r),actual:t,reverse:{type:5,id:i}}}deleteOp(t){let{id:e}=t,i=this,n=i.findIndex(s=>s.id===e);if(n===-1)return null;t.localIndex=n,i=[...i];let r=i.splice(n,1)[0];return{data:this.modifyArrayBy(i),actual:t,reverse:{type:4,...r}}}moveOp(t){let{fi:e,id:i}=t,n=this;n=[...n];let r=n.findIndex(o=>o.id===i);if(r===-1)return null;let s=n[r].fi,a={...n[r],fi:e};return n[r]=a,n.sort((o,l)=>o.fi-l.fi),t.localIndex=n.indexOf(a),{data:this.modifyArrayBy(n),actual:t,reverse:{type:6,fi:s,id:i}}}previous(t){if(t===null)return this.length===0?null:this[this.length-1].id;let e=null;for(let i of this){if(i.id===t)return e;e=i.id}return null}insertBeforeHelper(t,e){return this.insertAfterHelper(this.previous(t),e)}insertAfterHelper(t,e){let i=this;if(t===null){if(i.length===0)return Ql(0,e,e);{let n=i[0].fi;return Ql(n-e,n,e)}}{let n=this.get(t);if(n===void 0)throw new Error("illegal args");let r=i.find(s=>s.fi>n.fi);if(r===void 0){let s=i[i.length-1].fi;return Ql(s,s+e,e)}return Ql(n.fi,r.fi,e)}}}});function F$(t,e){let i={cur:[],result:[],len:0};return[t=Xu(t,e,i)??t,i.result]}function M1(t,e){return t===null?null:(t.cur[t.len]=e,t.len+=1,t)}function E1(t){t&&(t.len-=1)}function rN(t,e,i){let n=!1,r=t.map(s=>{let a=s.id,o=e[a];if(o!==void 0&&typeof o=="string"&&(n=!0,a=o,i!==null))throw new Error("not supported");let l=Xu(s.data,e,M1(i,a));E1(i),n=n||l!==void 0,l===void 0&&(l=s.data);let c=rN(s.children,e,i);return c!==void 0?n=!0:c=s.children,{...s,id:a,data:l,children:c}});if(n)return r}function Xu(t,e,i){if(t instanceof Xn){let n=rN(t,e,i);return n!==void 0&&Object.setPrototypeOf(n,Object.getPrototypeOf(t)),n}if(t instanceof Vt)return function(n,r,s){let a=!1,o=n.map(l=>{let c=l.id,h=r[c];if(h!==void 0&&typeof h=="string"&&(a=!0,c=h,s!==null))throw new Error("not supported");let d=Xu(l.data,r,M1(s,c));return E1(s),a=a||d!==void 0,d===void 0&&(d=l.data),{...l,id:c,data:d}});if(a)return Object.setPrototypeOf(o,Object.getPrototypeOf(n)),o}(t,e,i);if(Array.isArray(t)){let n=!1,r=t.map((s,a)=>{let o=Xu(s,e,M1(i,a));return E1(i),n=n||o!==void 0,o===void 0&&(o=s),o});return n?(Object.setPrototypeOf(r,Object.getPrototypeOf(t)),r):void 0}if(t&&typeof t=="object"&&!qc(t)){let n={},r=!1;for(let[s,a]of Object.entries(t))if(s!=="name"&&s!=="variableId"){let o=e[s];if(typeof o=="string"){if(i!==null)throw new Error("not supported");r=!0,s=o}let l=Xu(a,e,M1(i,s));E1(i),r=r||l!==void 0,l===void 0&&(l=a),n[s]=l}else n[s]=a;return r?(Object.setPrototypeOf(n,Object.getPrototypeOf(t)),n):void 0}if(typeof t=="string"){let n=e[t];return n!==void 0&&function(r){if(r===null)return null;r.result.push(r.cur.slice(0,r.len))}(i),n}}var sN=z(()=>{Jc(),td(),Dn()});function $u(t){return t&&typeof t=="object"&&t instanceof $i}function YC(t,e){if(e===void 0)return;let i=!1,n=t.map(r=>{let s=r.id,a=cg(r.data,e[s]);if(i=i||a!==void 0,a===void 0&&(a=r.data),r.children){let o=YC(r.children,e);return o!==void 0?i=!0:o=r.children,{...r,id:s,data:a,children:o}}return{...r,id:s,data:a}});return i?n:void 0}function cg(t,e){if(!$u(e))return e;if(t instanceof Xn){let i=YC(t,e);return i!==void 0&&Object.setPrototypeOf(i,Object.getPrototypeOf(t)),i}if(t instanceof Vt)return function(i,n){if(n===void 0)return;let r=!1,s=i.map(a=>{let o=a.id,l=cg(a.data,n[o]);return r=r||l!==void 0,l===void 0&&(l=a.data),{...a,id:o,data:l}});return r?(Object.setPrototypeOf(s,Object.getPrototypeOf(i)),s):void 0}(t,e);if(Array.isArray(t)){let i=!1,n=t.map((r,s)=>{let a=cg(r,e[s]);return i=i||a!==void 0,a===void 0&&(a=r),a});return i?(Object.setPrototypeOf(n,Object.getPrototypeOf(t)),n):void 0}if(t instanceof $i)return ZC(t,e);if(t&&typeof t=="object"){let i={},n=!1;for(let[r,s]of Object.entries(t)){let a=cg(s,e[r]);n=n||a!==void 0,a===void 0&&(a=s),i[r]=a}return n?(Object.setPrototypeOf(i,Object.getPrototypeOf(t)),i):void 0}}function ZC(t,e){if(t===void 0)return e;if(e===void 0)return t;if(!$u(e))return e;if(!$u(t))return ch.apply(t,e);let i=new Set;for(let r of Object.keys(t))i.add(r);for(let r of Object.keys(e))i.add(r);let n=new $i;for(let r of i){let s=ZC(t===void 0?void 0:t[r],e===void 0?void 0:e[r]);n[r]=s}return n}var $i,ch,V_,er,xI,sx=z(()=>{var t;Jc(),td(),lx(),Dn(),$i=class{unusedFunOverridesTable(e){}runOp(e){let i=[],n=this,r=0,s={};for(;r<e.path.length;){if(i.push(n),n=n===void 0?void 0:n[e.path[r]],n!==void 0&&!$u(n))return null;r+=1}n=n?fS(n):new $i;for(let[a,o]of Object.entries(e.props)){let l=n[a];s[a]=l,o===void 0?delete n[a]:n[a]=o}for(;r>0;){if(Object.keys(n).length===0){let a=i[r-1];a&&(n=fS(a),delete n[e.path[r-1]])}else{let a=i[r-1];if(a){let o=fS(a);o[e.path[r-1]]=n,n=o}else{let o=new $i;o[e.path[r-1]]=n,n=o}}r-=1}return{data:Object.setPrototypeOf(n,$i.prototype),actual:e,reverse:{...e,props:s}}}},(t=ch||(ch={})).apply=function(e,i){return cg(e,i)??e},t.merge=function(e,i){return ZC(e,i)},t.filterOp=function(e,i){let n=0,r=i.path,s=e;for(;n<r.length&&s!==void 0;){if(s=jn.zoomOnce(s,r[n]),s===void 0)return i;if(!$u(s))return;n+=1}if(s===void 0)return i;if($u(s)){if(i.type===0){let a={...i.props};for(let o of Object.keys(s))delete a[o];return{...i,props:a}}if(i.type===1||i.type===4||i.type===7){let a=YC([i],s);return a?a[0]:i}return i}}}),N$=z(()=>{Dn(),lx(),rx(),Jc(),XC(),$C(),td(),sN(),sx(),(V_||(V_={})).replaceProps=function(t,e){let i=jn.zoom(e,t.path);if(typeof i=="object"){let n={};for(let r of Object.keys(t.props))n[r]=i[r];return{...t,props:n}}return{...t,props:{}}},(t=>{function e(r,s){let a=s.path,o=[];for(;;){let l;if(r instanceof $i&&s.type===0&&(l=r.runOp({...s,path:a.slice(o.length)}),l===null&&(l=void 0)),l===void 0&&o.length===a.length&&(l=r instanceof Xn||r instanceof Vt||r instanceof te?r.runOp(s):fp.runOp(r,s)),l!==void 0){if(l!==null){let d=l.data;for(let u=o.length-1;u>=0;u--){let p=a[u],f=o[u];if(f instanceof Xn){if(typeof p=="number")throw new Error("illegal arg");d=f.modifyById(p,d)}else if(f instanceof Vt){if(typeof p=="number")throw new Error("illegal arg");d=f.modifyById(p,d)}else if(f instanceof te){if(typeof p=="number")throw new Error("illegal arg");d=f.modifyById(p,d)}else if(f instanceof $i){let g={...f,[p]:d};d=Object.setPrototypeOf(g,$i.prototype)}else{if(typeof f!="object")return null;if(Array.isArray(f)||qc(f)){if(typeof p=="string"&&(p=parseInt(p),isNaN(p)))throw new Error("Invalid path");let g=d;d=qc(f)?f.slice():[...f],d[p]=g}else d=fp.tryPreservePrototype(f,{...f,[p]:d})}}return{data:d,actual:{...l.actual,path:a},reverse:{...l.reverse,path:a}}}return null}let c,h=a[o.length];if(r instanceof Xn){if(typeof h=="number")throw new Error("");c=r.get(h)?.data}else if(r instanceof Vt){if(typeof h=="number")throw new Error("");c=r.get(h)?.data}else r!==null&&(c=r[h]);if(c===void 0)return null;o.push(r),r=c}}function i(r,s){for(let a=0;a<r.length&&a<s.length;a++)if(r[a]!==s[a])return!0;return!1}function n(r,s){if(r.length!==s.length)return!1;for(let a=0;a<r.length;a++)if(r[a]!==s[a])return!1;return!0}t.drop=function(r,s){return{...r,path:r.path.slice(s)}},t.applySimple=function(r,s){return e(r,s)?.data??r},t.apply=e,t.pathDisjoint=i,t.pathEq=n,t.commutative=function(r,s){return i(r.path,s.path)},t.subsumed=function(r,s){return!(r.type!==0||s.type!==0||!n(r.path,s.path))&&Object.keys(r.props).every(a=>s.props[a]!==void 0)}})(er||(er={})),(t=>{function e(i,n){let r=i,s=[],a=[];for(let o of n)try{if(o.type===3||o.type===5&&o.path[o.path.length-1]==="variables"){let l,c,h;if(o.type===3?(l=jn.zoom(r,[...o.path,o.id]),h=er.apply(r,{...o,type:2})):(l=jn.zoom(r,[...o.path,o.id,"value"]),h=er.apply(r,o)),h!==null){r=h.data;let[d,u]=F$(r,{[o.id]:l});r=d;for(let p=0;p<u.length;p++){let f=u[p],g=f.pop();if(typeof g=="number"){let m=[g];for(let y=p+1;y<u.length;y++){let _=u[y],b=_[_.length-1];if(typeof b!="number"||!jn.equal(f,_.slice(0,_.length-1)))break;m.push(b),u.splice(y,1)}let v=jn.zoom(r,f);c=v.map((y,_)=>m.includes(_)?o.id:y),l=v,g=f.pop()}else{if(g==="alphaOverride"||g==="alpha"){l/=100;let m=l,v=jn.zoom(r,f.slice(0,f.length-2)),y=v.layers.map(_=>_.id===f[f.length-1]?{..._,data:{..._.data,[g]:m}}:_);Object.setPrototypeOf(y,Object.getPrototypeOf(v.layers)),v.layers=y}c=o.id}s.push({type:0,path:f,props:{[g]:l}}),a.push({type:0,path:f,props:{[g]:c}})}a.push(h.reverse),s.push(h.actual)}}else{let l=er.apply(r,o);l!==null&&(s.push(l.actual),r=l.data,a.push(l.reverse))}}catch(l){if(l instanceof WC)return null;throw l}return{data:r,actual:s,reverse:a.reverse()}}t.empty=function(){return[]},t.removePrefix=function(i,n){let r=[];for(let s of i){let[a,...o]=s.path;a===n&&r.push({...s,path:o})}return r},t.addPrefix=function(i,n){return i.map(r=>({...r,path:[n,...r.path]}))},t.concat=function(i,n){return[...i,...n]},t.compress=function(i,n){return[...i.filter(r=>!n.some(s=>er.subsumed(r,s))),...n]},t.commutative=function(i,n){return i.every(r=>n.every(s=>er.commutative(r,s)))},t.applyAll=function(i,n){for(let r of n){let s=e(i,r);s!==null&&(i=s.data)}return i},t.apply=e})(xI||(xI={}))});function wI(t,e){return t instanceof $i?Object.setPrototypeOf(e,$i.prototype):fp.tryPreservePrototype(t,e)}function gS(t,e,i){if(t.length>0){let n=t[t.length-1];if(n.type===0&&e.type===0&&jn.equal(n.path,i))return void Object.assign(n.props,e.props)}t.push({...e,path:i})}function A1(t,e,i){return i instanceof Xn?new ax(t,e,i):i instanceof Vt?new ox(t,e,i):i instanceof te?new Proxy(new oN(t,e,i),hN):i!==null&&typeof i=="object"?qc(i)?i:new Proxy(new aN(t,e,i),lN):i}function Bm(t){let e=new rA(t);return[A1(e,"",t),e]}function j_(t,e){let[i,n]=Bm(t);return e(i),n.result()}function un(t){return t instanceof ax||t instanceof ox?t._current:t!==null&&typeof t=="object"?t[nA]:t}var nA,SI,Uf,Ud,aN,oN,vS,lN,hN,ax,ox,rA,jn,cN=z(()=>{rx(),Jc(),$C(),td(),Dn(),lx(),sx(),nA=Symbol(),SI=Symbol(),Uf=Symbol(),Ud=class{reportOp(t,e,i=[]){let n=this;if(e===null)return;n._current=e.data;let r=i;for(;!(n instanceof rA);){let s=n._path,a=n._current;if(s!==""&&r.splice(0,0,s),n=n._parent,n===null)return;n.update(s,a)}n.push(r,t,e.actual,e.reverse)}deleteChildren(t){if(this._children){let e=this._children[t];if(e){let i=e[Uf];i&&i(),delete this._children[t]}}}},aN=class extends Ud{constructor(t,e,i){super(),this._parent=t,this._path=e,this._current=i}update(t,e){if(Array.isArray(this._current)){if(typeof t=="string"&&(t=parseInt(t),isNaN(t)))throw new Error("Invalid path");this._current=[...this._current],this._current[t]=e}else this._current=wI(this._current,{...this._current,[t]:e})}runOp(t){let e=fp.runOp(this._current,t);e!==null&&(e.data=wI(this._current,e.data)),this.reportOp(t,e,t.path)}},oN=class extends Ud{constructor(t,e,i){super(),this._parent=t,this._path=e,this._current=i}update(t,e){this._current={...this._current,[t]:e},Object.setPrototypeOf(this._current,te.prototype)}runOp(t){this.reportOp(t,this._current.runOp(t))}},vS={get(t,e){if(e===Uf)return()=>{t._parent=null};if(e===nA)return t._current;if(e===SI)return t;let{_current:i,_children:n}=t;if(e==="push"&&Array.isArray(i))throw new Error("not supported to expand array");let r=n===void 0?void 0:n[e];if(r!==void 0)return r;let s=i[e],a=A1(t,e,s);return a!==s?(n===void 0&&(n={},t._children=n),n[e]=a,a):s},has:(t,e)=>e in t._current,ownKeys:t=>Reflect.ownKeys(t._current),defineProperty(){throw Error("not supported")},getPrototypeOf:t=>Object.getPrototypeOf(t._current),setPrototypeOf(){throw Error("not supported")},getOwnPropertyDescriptor(t,e){let i=t._current,n=Reflect.getOwnPropertyDescriptor(i,e);return n&&{writable:!0,configurable:!0,enumerable:n.enumerable,value:i[e]}}},lN={...vS,set(t,e,i){let n={type:0,props:{[e]:un(i)??i}};return t.deleteChildren(e),t.runOp(n),!0},deleteProperty(t,e){let i={type:0,props:{[e]:void 0}};return t.deleteChildren(e),t.runOp(i),!0}},hN={...vS,set(t,e,i){return i===void 0?this.deleteProperty(t,e):(t.deleteChildren(e),t.runOp({type:1,id:e,data:i})),!0},deleteProperty:(t,e)=>(t.runOp({type:2,id:e}),!0)},ax=class extends Ud{constructor(t,e,i){super(),this._children={},this._parent=t,this._path=e,this._current=i,this[Uf]=()=>{this._parent=null}}unproxy(){return this._current}update(t,e){this._current=this._current.modifyById(t,e)}runOp(t){this.reportOp(t,this._current.runOp(t))}randomId(){return this._current.randomId()}isDescendantOf(t,e){return this._current.isDescendantOf(t,e)}childrenOf(t){return this._current.childrenOf(t)}get(t){return this._current.get(t)}parent(t){return this._current.parent(t)}traverse(t){this._current.traverse((e,i)=>{t(e,this.data(e))})}data(t){let{_current:e,_children:i}=this,n=i===void 0?void 0:i[t];if(n!==void 0)return n;let r=e.get(t)?.data,s=A1(this,t,r);return s!==r?(i===void 0&&(i={},this._children=i),i[t]=s,s):r}add(t,e,i,n,r){this.runOp({type:7,parent:t,fi:e,id:i,data:n,children:r})}move(t,e,i){this.runOp({type:9,parent:t,fi:e,id:i})}insertAfter(t,e,i){let n=this._current.insertAfterHelper(t,e,i.length);for(let r=0;r<i.length;r++){let s=i[r];this.add(t,n[r],s.id,s.data,s.children)}}insertBefore(t,e,i){let n=this._current.insertBeforeHelper(t,e,i.length);for(let r=0;r<i.length;r++){let s=i[r];this.add(t,n[r],s.id,s.data,s.children)}}moveAfter(t,e,i){let n=this._current.insertAfterHelper(t,e,i.length);for(let r=0;r<i.length;r++){let s=i[r];this.move(t,n[r],s)}}moveBefore(t,e,i){let n=this._current.insertBeforeHelper(t,e,i.length);for(let r=0;r<i.length;r++){let s=i[r];this.move(t,n[r],s)}}delete(t){this.deleteChildren(t),this.runOp({type:8,id:t})}sortNext(t){return this._current.sortNext(t)}sortPrevious(t){return this._current.sortPrevious(t)}getAllSorted(t){return this._current.getAllSorted(t)}},ox=class extends Ud{constructor(t,e,i){super(),this._children={},this._parent=t,this._path=e,this._current=i,this[Uf]=()=>{this._parent=null}}unproxy(){return this._current}get length(){return this._current.length}forEach(t){let e=this.length;for(let i=0;i<e;i++){let n=this._current[i].id,r=this._current[i].fi;t(this.data(this._current[i].id),n,r,i)}}find(t){let e=this.length;for(let i=0;i<e;i++){let n=this._current[i].id;if(t(this.data(n),n))return this.get(n)}}update(t,e){this._current=this._current.modifyById(t,e)}randomId(){return this._current.randomId()}get(t){return{...this._current.get(t),data:this.data(t)}}at(t){let{id:e,fi:i}=this._current.at(t);return{id:e,fi:i,data:this.data(e)}}data(t){let{_current:e,_children:i}=this,n=i===void 0?void 0:i[t];if(n!==void 0)return n;let r=e.get(t)?.data,s=A1(this,t,r);return s!==r?(i===void 0&&(i={},this._children=i),i[t]=s,s):r}runOp(t){this.reportOp(t,this._current.runOp(t))}add(t,e,i){this.runOp({type:4,fi:t,id:e,data:i})}move(t,e){this.runOp({type:6,fi:t,id:e})}insertAfter(t,e){let i=this._current.insertAfterHelper(t,e.length);for(let n=0;n<e.length;n++){let r=e[n];this.add(i[n],r.id,r.data)}}insertBefore(t,e){let i=this._current.insertBeforeHelper(t,e.length);for(let n=0;n<e.length;n++){let r=e[n];this.add(i[n],r.id,r.data)}}moveAfter(t,e){let i=this._current.insertAfterHelper(t,e.length);for(let n=0;n<e.length;n++){let r=e[n];this.move(i[n],r)}}moveBefore(t,e){let i=this._current.insertBeforeHelper(t,e.length);for(let n=0;n<e.length;n++){let r=e[n];this.move(i[n],r)}}delete(t){this.deleteChildren(t),this.runOp({type:5,id:t})}},rA=class extends Ud{constructor(t){super(),this.ts=[],this.actual=[],this.reverse=[],this._current=t}update(t,e){if(t!=="")throw new Error("");this._current=e}push(t,e,i,n){gS(this.ts,e,t),gS(this.actual,i,t),gS(this.reverse,n,t)}result(){return{data:this._current,ts:this.ts,actual:this.actual,reverse:this.reverse.reverse()}}}}),lx=z(()=>{qC(),cN(),td(),Jc(),Dn(),(t=>{function e(n,r){return(n instanceof Xn||n instanceof ax)&&typeof r=="string"||(n instanceof Vt||n instanceof ox)&&typeof r=="string"?n.data(r):typeof r=="number"&&Array.isArray(n)||typeof r=="string"&&typeof n=="object"&&n!==null?n[r]:void 0}function i(n,r,s=0){for(;s<r.length&&n!==void 0;)n=e(n,r[s]),s+=1;return n}t.equal=function(n,r){if(r.length!==n.length)return!1;{let s=0;for(;s<n.length;){if(n[s]!==r[s])return!1;s+=1}}return!0},t.removeOverridden=function(n,r,s){let a=i(s,n);if(a!==void 0&&typeof a=="object"&&a!==null){let o={...r};return Object.keys(a).forEach(l=>{delete o[l]}),o}return r},t.zoomOnce=e,t.zoom=i,t.findPathes=function(n,r){let s=[];return function a(o,l){if(o instanceof k_&&o.id===r.id)s.push(l);else if(o instanceof Vt)for(let c=0;c<o.length;c++)a(o[c].data,[...l,o[c].id]);else if(o instanceof Xn)o.traverse((c,h)=>{a(h,[...l,c])});else if(Array.isArray(o)){if(typeof o[0]=="number")return;for(let c=0;c<o.length;c++)a(o[c],[...l,c])}else{if(qc(o))return;if(typeof o=="object"&&o!==null)for(let c in o)a(o[c],[...l,c])}}(n,[]),s}})(jn||(jn={}))}),k$=z(()=>{});function ri(t,e){let i=[];if(!(e.length<=t.length))return null;{let n=0;for(;n<e.length;){if(e[n]==="*")i.push(t[n]);else if(t[n]!==e[n])return null;n+=1}}return i}var V$=z(()=>{});function bv(t){try{if(!bi.trusted&&!el){let i=Qe.sharedLength||0;i<Qe.length&&(Qe.length=i)}let e;if(bi.randomAccessStructure&&kt[ut]<64&&kt[ut]>=32&&PI?(e=PI(kt,ut,ks,bi),kt=null,!(t&&t.lazy)&&e&&(e=e.toJSON()),ut=ks):e=vn(),_r&&(ut=_r.postBundlePosition,_r=null),el&&(Qe.restoreStructures=null),ut==ks)Qe&&Qe.restoreStructures&&MI(),Qe=null,kt=null,tl&&(tl=null);else{if(ut>ks)throw new Error("Unexpected end of MessagePack data");if(!el){let i;try{i=JSON.stringify(e,(n,r)=>typeof r=="bigint"?`${r}n`:r).slice(0,100)}catch(n){i="(JSON view not available "+n+")"}throw new Error("Data read, but end of buffer not reached "+i)}}return e}catch(e){throw Qe&&Qe.restoreStructures&&MI(),aA(),(e instanceof RangeError||e.message.startsWith("Unexpected end of buffer")||ut>ks)&&(e.incomplete=!0),e}}function MI(){for(let t in Qe.restoreStructures)Qe[t]=Qe.restoreStructures[t];Qe.restoreStructures=null}function vn(){let t=kt[ut++];if(t<160){if(t<128){if(t<64)return t;{let e=Qe[63&t]||bi.getStructures&&dN()[63&t];return e?(e.read||(e.read=sA(e,63&t)),e.read()):t}}if(t<144){if(t-=128,bi.mapsAsObjects){let e={};for(let i=0;i<t;i++){let n=pN();n==="__proto__"&&(n="__proto_"),e[n]=vn()}return e}{let e=new Map;for(let i=0;i<t;i++)e.set(vn(),vn());return e}}{t-=144;let e=new Array(t);for(let i=0;i<t;i++)e[i]=vn();return bi.freezeData?Object.freeze(e):e}}if(t<192){let e=t-160;if(pa>=ut)return Jl.slice(ut-ms,(ut+=e)-ms);if(pa==0&&ks<140){let i=e<16?KC(e):uN(e);if(i!=null)return i}return W_(e)}{let e;switch(t){case 192:return null;case 193:return _r?(e=vn(),e>0?_r[1].slice(_r.position1,_r.position1+=e):_r[0].slice(_r.position0,_r.position0-=e)):gN;case 194:return!1;case 195:return!0;case 196:if(e=kt[ut++],e===void 0)throw new Error("Unexpected end of buffer");return yS(e);case 197:return e=He.getUint16(ut),ut+=2,yS(e);case 198:return e=He.getUint32(ut),ut+=4,yS(e);case 199:return Kh(kt[ut++]);case 200:return e=He.getUint16(ut),ut+=2,Kh(e);case 201:return e=He.getUint32(ut),ut+=4,Kh(e);case 202:if(e=He.getFloat32(ut),bi.useFloat32>2){let i=uA[(127&kt[ut])<<1|kt[ut+1]>>7];return ut+=4,(i*e+(e>0?.5:-.5)|0)/i}return ut+=4,e;case 203:return e=He.getFloat64(ut),ut+=8,e;case 204:return kt[ut++];case 205:return e=He.getUint16(ut),ut+=2,e;case 206:return e=He.getUint32(ut),ut+=4,e;case 207:return bi.int64AsType==="number"?(e=4294967296*He.getUint32(ut),e+=He.getUint32(ut+4)):bi.int64AsType==="string"?e=He.getBigUint64(ut).toString():bi.int64AsType==="auto"?(e=He.getBigUint64(ut),e<=BigInt(2)<<BigInt(52)&&(e=Number(e))):e=He.getBigUint64(ut),ut+=8,e;case 208:return He.getInt8(ut++);case 209:return e=He.getInt16(ut),ut+=2,e;case 210:return e=He.getInt32(ut),ut+=4,e;case 211:return bi.int64AsType==="number"?(e=4294967296*He.getInt32(ut),e+=He.getUint32(ut+4)):bi.int64AsType==="string"?e=He.getBigInt64(ut).toString():bi.int64AsType==="auto"?(e=He.getBigInt64(ut),e>=BigInt(-2)<<BigInt(52)&&e<=BigInt(2)<<BigInt(52)&&(e=Number(e))):e=He.getBigInt64(ut),ut+=8,e;case 212:if(e=kt[ut++],e==114)return dA(63&kt[ut++]);{let i=gr[e];if(i)return i.read?(ut++,i.read(vn())):i.noBuffer?(ut++,i()):i(kt.subarray(ut,++ut));throw new Error("Unknown extension "+e)}case 213:return e=kt[ut],e==114?(ut++,dA(63&kt[ut++],kt[ut++])):Kh(2);case 214:return Kh(4);case 215:return Kh(8);case 216:return Kh(16);case 217:return e=kt[ut++],pa>=ut?Jl.slice(ut-ms,(ut+=e)-ms):yN(e);case 218:return e=He.getUint16(ut),pa>=(ut+=2)?Jl.slice(ut-ms,(ut+=e)-ms):_N(e);case 219:return e=He.getUint32(ut),pa>=(ut+=4)?Jl.slice(ut-ms,(ut+=e)-ms):bN(e);case 220:return e=He.getUint16(ut),ut+=2,EI(e);case 221:return e=He.getUint32(ut),ut+=4,EI(e);case 222:return e=He.getUint16(ut),ut+=2,AI(e);case 223:return e=He.getUint32(ut),ut+=4,AI(e);default:if(t>=224)return t-256;if(t===void 0){let i=new Error("Unexpected end of MessagePack data");throw i.incomplete=!0,i}throw new Error("Unknown MessagePack token "+t)}}}function sA(t,e){function i(){if(i.count++>lA){let r;try{r=t.read=new Function("r","return function(){return "+(bi.freezeData?"Object.freeze":"")+"({"+t.map(s=>s==="__proto__"?"__proto_:r()":vN.test(s)?s+":r()":"["+JSON.stringify(s)+"]:r()").join(",")+"})}")(vn)}catch{return lA=1/0,i()}return t.read0=r,t.highByte===0&&(t.read=hA(e,t.read)),r()}let n={};for(let r=0,s=t.length;r<s;r++){let a=t[r];a==="__proto__"&&(a="__proto_"),n[a]=vn()}return bi.freezeData?Object.freeze(n):n}return i.count=0,t.read0=i,t.highByte===0?hA(e,i):i}function dN(){let t=mN(()=>(kt=null,bi.getStructures()));return Qe=bi._mergeStructures(t,Qe)}function Um(t){let e;if(t<16&&(e=KC(t)))return e;if(t>64&&oA)return oA.decode(kt.subarray(ut,ut+=t));let i=ut+t,n=[];for(e="";ut<i;){let r=kt[ut++];if(128&r)if((224&r)==192){let s=(31&r)<<6|63&kt[ut++];s<128?n.push(65533):n.push(s)}else if((240&r)==224){let s=(31&r)<<12|(63&kt[ut++])<<6|63&kt[ut++];s<2048||s>=55296&&s<=57343?n.push(65533):n.push(s)}else if((248&r)==240){let s=(7&r)<<18|(63&kt[ut++])<<12|(63&kt[ut++])<<6|63&kt[ut++];s<65536||s>1114111?n.push(65533):(s>65535&&(s-=65536,n.push(s>>>10&1023|55296),s=56320|1023&s),n.push(s))}else n.push(65533);else n.push(r);n.length>=4096&&(e+=kn.apply(String,n),n.length=0)}return n.length>0&&(e+=kn.apply(String,n)),e}function EI(t){let e=new Array(t);for(let i=0;i<t;i++)e[i]=vn();return bi.freezeData?Object.freeze(e):e}function AI(t){if(bi.mapsAsObjects){let e={};for(let i=0;i<t;i++){let n=pN();n==="__proto__"&&(n="__proto_"),e[n]=vn()}return e}{let e=new Map;for(let i=0;i<t;i++)e.set(vn(),vn());return e}}function uN(t){let e=ut,i=new Array(t);for(let n=0;n<t;n++){let r=kt[ut++];if((128&r)>0)return void(ut=e);i[n]=r}return kn.apply(String,i)}function KC(t){if(t<4){if(t<2){if(t===0)return"";{let e=kt[ut++];return(128&e)>1?void(ut-=1):kn(e)}}{let e=kt[ut++],i=kt[ut++];if((128&e)>0||(128&i)>0)return void(ut-=2);if(t<3)return kn(e,i);let n=kt[ut++];return(128&n)>0?void(ut-=3):kn(e,i,n)}}{let e=kt[ut++],i=kt[ut++],n=kt[ut++],r=kt[ut++];if((128&e)>0||(128&i)>0||(128&n)>0||(128&r)>0)return void(ut-=4);if(t<6){if(t===4)return kn(e,i,n,r);{let s=kt[ut++];return(128&s)>0?void(ut-=5):kn(e,i,n,r,s)}}if(t<8){let s=kt[ut++],a=kt[ut++];if((128&s)>0||(128&a)>0)return void(ut-=6);if(t<7)return kn(e,i,n,r,s,a);let o=kt[ut++];return(128&o)>0?void(ut-=7):kn(e,i,n,r,s,a,o)}{let s=kt[ut++],a=kt[ut++],o=kt[ut++],l=kt[ut++];if((128&s)>0||(128&a)>0||(128&o)>0||(128&l)>0)return void(ut-=8);if(t<10){if(t===8)return kn(e,i,n,r,s,a,o,l);{let c=kt[ut++];return(128&c)>0?void(ut-=9):kn(e,i,n,r,s,a,o,l,c)}}if(t<12){let c=kt[ut++],h=kt[ut++];if((128&c)>0||(128&h)>0)return void(ut-=10);if(t<11)return kn(e,i,n,r,s,a,o,l,c,h);let d=kt[ut++];return(128&d)>0?void(ut-=11):kn(e,i,n,r,s,a,o,l,c,h,d)}{let c=kt[ut++],h=kt[ut++],d=kt[ut++],u=kt[ut++];if((128&c)>0||(128&h)>0||(128&d)>0||(128&u)>0)return void(ut-=12);if(t<14){if(t===12)return kn(e,i,n,r,s,a,o,l,c,h,d,u);{let p=kt[ut++];return(128&p)>0?void(ut-=13):kn(e,i,n,r,s,a,o,l,c,h,d,u,p)}}{let p=kt[ut++],f=kt[ut++];if((128&p)>0||(128&f)>0)return void(ut-=14);if(t<15)return kn(e,i,n,r,s,a,o,l,c,h,d,u,p,f);let g=kt[ut++];return(128&g)>0?void(ut-=15):kn(e,i,n,r,s,a,o,l,c,h,d,u,p,f,g)}}}}}function TI(){let t,e=kt[ut++];if(e<192)t=e-160;else switch(e){case 217:t=kt[ut++];break;case 218:t=He.getUint16(ut),ut+=2;break;case 219:t=He.getUint32(ut),ut+=4;break;default:throw new Error("Expected string")}return Um(t)}function yS(t){return bi.copyBuffers?Uint8Array.prototype.slice.call(kt,ut,ut+=t):kt.subarray(ut,ut+=t)}function Kh(t){let e=kt[ut++];if(gr[e]){let i;return gr[e](kt.subarray(ut,i=ut+=t),n=>{ut=n;try{return vn()}finally{ut=i}})}throw new Error("Unknown extension type "+e)}function pN(){let t=kt[ut++];if(!(t>=160&&t<192))return ut--,fN(vn());if(t-=160,pa>=ut)return Jl.slice(ut-ms,(ut+=t)-ms);if(!(pa==0&&ks<180))return W_(t);let e,i=4095&(t<<5^(t>1?He.getUint16(ut):t>0?kt[ut]:0)),n=cA[i],r=ut,s=ut+t-3,a=0;if(n&&n.bytes==t){for(;r<s;){if(e=He.getUint32(r),e!=n[a++]){r=1879048192;break}r+=4}for(s+=3;r<s;)if(e=kt[r++],e!=n[a++]){r=1879048192;break}if(r===s)return ut=r,n.string;s-=3,r=ut}for(n=[],cA[i]=n,n.bytes=t;r<s;)e=He.getUint32(r),n.push(e),r+=4;for(s+=3;r<s;)e=kt[r++],n.push(e);let o=t<16?KC(t):uN(t);return n.string=o??W_(t)}function fN(t){if(typeof t=="string")return t;if(typeof t=="number"||typeof t=="boolean"||typeof t=="bigint")return t.toString();if(t==null)return t+"";if(bi.allowArraysInMapKeys&&Array.isArray(t)&&t.flat().every(e=>["string","number","boolean","bigint"].includes(typeof e)))return t.flat().toString();throw new Error("Invalid property type for record: "+typeof t)}function mN(t){DI&&DI();let e=ks,i=ut,n=H_,r=ms,s=pa,a=Jl,o=G_,l=tl,c=_r,h=new Uint8Array(kt.slice(0,ks)),d=Qe,u=Qe.slice(0,Qe.length),p=bi,f=el,g=t();return ks=e,ut=i,H_=n,ms=r,pa=s,Jl=a,G_=o,tl=l,_r=c,kt=h,el=f,(Qe=d).splice(0,Qe.length,...u),bi=p,He=new DataView(kt.buffer,kt.byteOffset,kt.byteLength),g}function aA(){kt=null,tl=null,Qe=null}function j$(t){t.unpack?gr[t.type]=t.unpack:gr[t.type]=t}var oA,kt,ks,ut,CI,G_,H_,bi,Qe,Jl,ms,pa,_r,tl,gr,He,_S,gN,el,lA,PI,DI,zm,vN,hA,W_,yN,_N,bN,kn,cA,dA,bS,RI,II,OI,uA,xv,LI,BI,UI,pA,xS,jg,G$=z(()=>{try{oA=new TextDecoder}catch{}ut=0,G_=CI=[],H_=0,bi={},ms=0,pa=0,gr=[],_S={useRecords:!1,mapsAsObjects:!0},(gN=new class{}).name="MessagePack 0xC1",el=!1,lA=2,zm=class{constructor(t){t&&(t.useRecords===!1&&t.mapsAsObjects===void 0&&(t.mapsAsObjects=!0),t.sequential&&t.trusted!==!1&&(t.trusted=!0,!t.structures&&t.useRecords!=0&&(t.structures=[],t.maxSharedStructures||(t.maxSharedStructures=0))),t.structures?t.structures.sharedLength=t.structures.length:t.getStructures&&((t.structures=[]).uninitialized=!0,t.structures.sharedLength=0),t.int64AsNumber&&(t.int64AsType="number")),Object.assign(this,t)}unpack(t,e){if(kt)return mN(()=>(aA(),this?this.unpack(t,e):zm.prototype.unpack.call(_S,t,e)));!t.buffer&&t.constructor===ArrayBuffer&&(t=typeof Buffer<"u"?Buffer.from(t):new Uint8Array(t)),typeof e=="object"?(ks=e.end||t.length,ut=e.start||0):(ut=0,ks=e>-1?e:t.length),H_=0,pa=0,Jl=null,G_=CI,_r=null,kt=t;try{He=t.dataView||(t.dataView=new DataView(t.buffer,t.byteOffset,t.byteLength))}catch(i){throw kt=null,t instanceof Uint8Array?i:new Error("Source must be a Uint8Array or Buffer but was a "+(t&&typeof t=="object"?t.constructor.name:typeof t))}if(this instanceof zm){if(bi=this,this.structures)return Qe=this.structures,bv(e);(!Qe||Qe.length>0)&&(Qe=[])}else bi=_S,(!Qe||Qe.length>0)&&(Qe=[]);return bv(e)}unpackMultiple(t,e){let i,n=0;try{el=!0;let r=t.length,s=this?this.unpack(t,r):xv.unpack(t,r);if(!e){for(i=[s];ut<r;)n=ut,i.push(bv());return i}if(e(s,n,ut)===!1)return;for(;ut<r;)if(n=ut,e(bv(),n,ut)===!1)return}catch(r){throw r.lastPosition=n,r.values=i,r}finally{el=!1,aA()}}_mergeStructures(t,e){t=t||[],Object.isFrozen(t)&&(t=t.map(i=>i.slice(0)));for(let i=0,n=t.length;i<n;i++){let r=t[i];r&&(r.isShared=!0,i>=32&&(r.highByte=i-32>>5))}t.sharedLength=t.length;for(let i in e||[])if(i>=0){let n=t[i],r=e[i];r&&(n&&((t.restoreStructures||(t.restoreStructures=[]))[i]=n),t[i]=r)}return this.structures=t}decode(t,e){return this.unpack(t,e)}},vN=/^[a-zA-Z_$][a-zA-Z\d_$]*$/,hA=(t,e)=>function(){let i=kt[ut++];if(i===0)return e();let n=t<32?-(t+(i<<5)):t+(i<<5),r=Qe[n]||dN()[n];if(!r)throw new Error("Record id is not defined for "+n);return r.read||(r.read=sA(r,t)),r.read()},W_=Um,yN=Um,_N=Um,bN=Um,kn=String.fromCharCode,cA=new Array(4096),dA=(t,e)=>{let i=vn().map(fN),n=t;e!==void 0&&(t=t<32?-((e<<5)+t):(e<<5)+t,i.highByte=e);let r=Qe[t];return r&&(r.isShared||el)&&((Qe.restoreStructures||(Qe.restoreStructures=[]))[t]=r),Qe[t]=i,i.read=sA(i,n),(i.read0||i.read)()},gr[0]=()=>{},gr[0].noBuffer=!0,gr[66]=t=>{let e=t.byteLength%8||8,i=BigInt(128&t[0]?t[0]-256:t[0]);for(let n=1;n<e;n++)i<<=BigInt(8),i+=BigInt(t[n]);if(t.byteLength!==e){let n=new DataView(t.buffer,t.byteOffset,t.byteLength),r=(s,a)=>{let o=a-s;if(o<=40){let d=n.getBigUint64(s);for(let u=s+8;u<a;u+=8)d<<=BigInt(64),d|=n.getBigUint64(u);return d}let l=s+(o>>4<<3),c=r(s,l),h=r(l,a);return c<<BigInt(8*(a-l))|h};i=i<<BigInt(8*(n.byteLength-e))|r(e,n.byteLength)}return i},bS={Error,EvalError,RangeError,ReferenceError,SyntaxError,TypeError,URIError,AggregateError:typeof AggregateError=="function"?AggregateError:null},gr[101]=()=>{let t=vn();if(!bS[t[0]]){let e=Error(t[1],{cause:t[2]});return e.name=t[0],e}return bS[t[0]](t[1],{cause:t[2]})},gr[105]=t=>{if(bi.structuredClone===!1)throw new Error("Structured clone extension is disabled");let e=He.getUint32(ut-4);tl||(tl=new Map);let i,n=kt[ut];i=n>=144&&n<160||n==220||n==221?[]:n>=128&&n<144||n==222||n==223?new Map:(n>=199&&n<=201||n>=212&&n<=216)&&kt[ut+1]===115?new Set:{};let r={target:i};tl.set(e,r);let s=vn();if(!r.used)return r.target=s;if(Object.assign(i,s),i instanceof Map)for(let[a,o]of s.entries())i.set(a,o);if(i instanceof Set)for(let a of Array.from(s))i.add(a);return i},gr[112]=t=>{if(bi.structuredClone===!1)throw new Error("Structured clone extension is disabled");let e=He.getUint32(ut-4),i=tl.get(e);return i.used=!0,i.target},gr[115]=()=>new Set(vn()),RI=["Int8","Uint8","Uint8Clamped","Int16","Uint16","Int32","Uint32","Float32","Float64","BigInt64","BigUint64"].map(t=>t+"Array"),II=typeof globalThis=="object"?globalThis:window,gr[116]=t=>{let e=t[0],i=Uint8Array.prototype.slice.call(t,1).buffer,n=RI[e];if(!n){if(e===16)return i;if(e===17)return new DataView(i);throw new Error("Could not find typed array for code "+e)}return new II[n](i)},gr[120]=()=>{let t=vn();return new RegExp(t[0],t[1])},OI=[],gr[98]=t=>{let e=(t[0]<<24)+(t[1]<<16)+(t[2]<<8)+t[3],i=ut;return ut+=e-t.length,_r=OI,(_r=[TI(),TI()]).position0=0,_r.position1=0,_r.postBundlePosition=ut,ut=i,vn()},gr[255]=t=>t.length==4?new Date(1e3*(16777216*t[0]+(t[1]<<16)+(t[2]<<8)+t[3])):t.length==8?new Date(((t[0]<<22)+(t[1]<<14)+(t[2]<<6)+(t[3]>>2))/1e6+1e3*(4294967296*(3&t[3])+16777216*t[4]+(t[5]<<16)+(t[6]<<8)+t[7])):t.length==12?new Date(((t[0]<<24)+(t[1]<<16)+(t[2]<<8)+t[3])/1e6+1e3*((128&t[4]?-281474976710656:0)+1099511627776*t[6]+4294967296*t[7]+16777216*t[8]+(t[9]<<16)+(t[10]<<8)+t[11])):new Date("invalid"),uA=new Array(147);for(let t=0;t<256;t++)uA[t]=+("1e"+Math.floor(45.15-.30103*t));(xv=new zm({useRecords:!1})).unpack,xv.unpackMultiple,xv.unpack,LI=new Float32Array(1),new Uint8Array(LI.buffer,0,4)}),H$=z(()=>{G$(),qC(),sx(),td(),rx(),Jc(),BI=[{Class:te.prototype.constructor,type:1,write:t=>({...t}),read:t=>(Object.setPrototypeOf(t,te.prototype),t)},{Class:Vt.prototype.constructor,type:2,write:t=>[...t],read:t=>(Object.setPrototypeOf(t,Vt.prototype),t)},{Class:Xn.prototype.constructor,type:3,write:t=>[...t],read:t=>(Object.setPrototypeOf(t,Xn.prototype),t)},{Class:k_.prototype.constructor,type:4,write:t=>t.id,read:t=>new k_(t)},{Class:iA.prototype.constructor,type:5,write:t=>t.data,read:t=>new iA(t)},{Class:$i.prototype.constructor,type:6,write:t=>({...t}),read:t=>(Object.setPrototypeOf(t,$i.prototype),t)}];for(let t of BI)j$(t);UI=new zm({structuredClone:!0}),(pA||(pA={})).deserialize=function(t){return UI.unpack(t)}}),W$=z(()=>{H$(),xS=t=>()=>{throw new Error(t+" is not available in the runtime build (decode-only CollabSerialize)")},jg={deserialize:pA.deserialize,serialize:xS("CollabSerialize.serialize"),checksum:xS("CollabSerialize.checksum")}}),Ye=z(()=>{lx(),z$(),XC(),Jc(),rx(),$C(),td(),N$(),k$(),cN(),V$(),qC(),W$(),sN(),sx()});function fA(t){return t==="MouseDown"||t==="MouseUp"||t==="KeyDown"||t==="KeyUp"||t==="Collision"||t==="Trigger"}var zI,mA,dg,wv,wS,FI,NI,kI,gA,vA,VI,jI,GI,HI,WI,yA,_A,qI,XI,$I,YI,xN=z(()=>{var t,e,i;Ye(),tt(),(t=zI||(zI={})).toEventUIType=function(n){return n.type==="Conditional"?n.condition.type==="Distance"?"Distance":"StateChange":n.type},t.fromEventUIType=function(n){return n==="Distance"||n==="StateChange"?"Conditional":n},mA={LookAt:[],Follow:["Create"],DragDrop:["Transition","Animation","Audio","Particles","Create","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],MouseHover:["Transition","Animation","TimelineAnimation","Particles","Create","Destroy","SwitchCamera","SceneTransition","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],Scroll:["Transition","Animation","TimelineAnimation","Create","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],Start:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],Conditional:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],MouseDown:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],MouseUp:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],MousePress:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Link","Create","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],KeyDown:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],KeyUp:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],KeyPress:["Transition","Animation","Audio","Particles","Video","Link","Create","SwitchCamera","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],GameControl:["Transition","Animation","TimelineAnimation","Audio","Particles","Create","Conditional"],Collision:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Create","Destroy","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],Trigger:["Transition","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],Resize:["Transition","Animation","Audio","Particles","Video","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],VariableChange:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],API:["Transition","Animation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],WEBHOOK:["Transition","Animation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],AIAssistantListener:["SetVariable"],AIAssistantTrigger:["Transition","Animation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"]},(n=>{n.is=function(r){return r.type==="MouseDown"||r.type==="MouseUp"||r.type==="MousePress"||r.type==="KeyDown"||r.type==="KeyUp"||r.type==="KeyPress"},n.defaultData=function(r){return r==="MouseDown"||r==="MouseUp"||r==="MousePress"?{type:r,mode:"Object",disabled:!1,name:"",actions:new Vt}:{type:r,disabled:!1,name:"",key:void 0,actions:new Vt}}})(dg||(dg={})),(n=>{n.propertyDefaultData=function(r){return{type:"Property",value:[r??null,"position","x"]}},n.valueDefaultData={type:"Literal",value:0}})(wv||(wv={})),(e=wS||(wS={})).comparisonDefaultData=function(n){return{type:"Comparison",operator:"==",lOperand:wv.propertyDefaultData(n),rOperand:{...wv.valueDefaultData}}},e.distanceDefaultData=function(n){return{type:"Distance",toObject:n??null,fromObject:n??null,distance:200}},e.stateDefaultData=function(n,r){return{type:"State",object:n??null,state:r??null}},(FI||(FI={})).isConditionalSubActions=function(n){return n.find(r=>r==="ifActions"||r==="elseActions")!==void 0},(n=>{n.is=function(r){return r.type==="Conditional"},n.defaultData=function(r){return{type:"Conditional",disabled:!1,name:"",inActions:new Vt,outActions:new Vt,condition:wS.distanceDefaultData(r)}}})(NI||(NI={})),(kI||(kI={})).defaultData={type:"DragDrop",name:"",cursor:"hand",disabled:!1,dampingFactor:1,objects:[],snapTo:"center",snapSurfaceMode:"bbox",snapSurfaceOffset:0,dropOn:"all",autoOrient:!0,dropDestinations:[],plane:"adaptive",planeMode:"locked",referenceFrame:"global",limits:[-1/0,1/0,-1/0,1/0,-1/0,1/0],drop:!1,resetOnSnapFail:!1,snapSpeed:20,resetSpeed:20,dragDropActions:{drag:new Vt,drop:new Vt}},(gA||(gA={})).defaultData={type:"Follow",disabled:!1,name:"",maxDelta:0,dampingFactor:1,target:"cursor",plane:"custom",resetOnPointerLeave:!0,resetAfterDistanceLimit:!0,enabledTranslation:[!0,!0,!0],limitDistanceEnabled:!1,limitDistance:1e3,snapDelay:0,resetSpeed:5,actions:new Vt},(vA||(vA={})).defaultData={type:"LookAt",disabled:!1,name:"",distance:1e3,dampingFactor:1,target:"cursor",tilt:"up",axis:"z",plane:"custom",resetOnPointerLeave:!0,resetAfterDistanceLimit:!0,enabledRotation:[!0,!0,!0],limitDistanceEnabled:!1,limitDistance:1e3,snapDelay:0,resetSpeed:5},(n=>{n.is=function(r){return r.type==="MouseHover"},n.defaultData=function(){return{type:"MouseHover",disabled:!1,name:"",actions:new Vt}}})(VI||(VI={})),(n=>{n.is=function(r){return r.type==="Scroll"},n.defaultData=function(){return{type:"Scroll",disabled:!1,name:"",steps:100,trigger:"load",startFrom:"enter",enterAnchor:"top",startOffset:0,endAfter:400,actions:new Vt}}})(jI||(jI={})),(n=>{n.is=function(r){return r.type==="Start"},n.defaultData=function(){return{type:"Start",disabled:!1,name:"",actions:new Vt}}})(GI||(GI={})),(n=>{n.is=function(r){return r.type==="Collision"},n.defaultData=function(){return{type:"Collision",disabled:!1,name:"",target:"character",actions:new Vt}}})(HI||(HI={})),(n=>{n.is=function(r){return r.type==="Trigger"},n.defaultData=function(r,s){return{type:"Trigger",name:"",disabled:!1,target:"all",triggeringObjects:[],actions:new Vt,triggerZone:"box",position:s.toArray(),rotation:[0,0,0],size:r.toArray(),radius:r.length()/2,helperVisible:!0}}})(WI||(WI={})),(i=yA||(yA={})).defaultSizes={mobile:[480,480],tablet:[768,768],desktop:[1200,1200],custom:[769,1200]},i.is=function(n){return n.type==="Resize"},i.sizeToDevice=function(n){return typeof n=="string"?n:"custom"},i.deviceToSize=function(n){return typeof n=="string"?[...i.defaultSizes[n]]:[...n]},i.defaultData=function(){let n={size:"mobile",operator:"<",actions:new Vt},r={size:"tablet",operator:"<",actions:new Vt},s={size:[...i.defaultSizes.custom],operator:"<>",actions:new Vt},a=new Vt;return a.push({id:Ot.generateUUID(),fi:0,data:n},{id:Ot.generateUUID(),fi:1,data:r},{id:Ot.generateUUID(),fi:2,data:s}),{type:"Resize",disabled:!1,name:"",orientation:"horizontal",breakpoints:a}},i.defaultBreakpointData=function(){return{size:[...i.defaultSizes.custom],operator:"<>",actions:new Vt}},(n=>{n.propertyPaths={Position:["position"],"Position X":["position","x"],"Position Y":["position","y"],"Position Z":["position","z"],Rotation:["rotation"],"Rotation X":["rotation","x"],"Rotation Y":["rotation","y"],"Rotation Z":["rotation","z"],Scale:["scale"],"Scale X":["scale","x"],"Scale Y":["scale","y"],"Scale Z":["scale","z"],Width:["width"],Height:["height"],Depth:["depth"],"Mouse Position X":["mouse","x"],"Mouse Position Y":["mouse","y"],"Mouse Pressed":["mouse","pressed"],"Screen Width":["mouse","width"],"Screen Height":["mouse","height"],"Hit Position X":["raycast","x"],"Hit Position Y":["raycast","y"],"Hit Position Z":["raycast","z"],"Hit Object Position X":["raycast","objX"],"Hit Object Position Y":["raycast","objY"],"Hit Object Position Z":["raycast","objZ"]},n.is=function(r){return r.type==="VariableChange"},n.defaultData=function(){return{disabled:!1,type:"VariableChange",name:"",actions:new Vt,variableId:"",objectId:null,property:"Position X"}}})(_A||(_A={})),(n=>{n.is=function(r){return r.type==="API"},n.defaultData=function(){return{disabled:!1,type:"API",name:"",successActions:new Vt,errorActions:new Vt,userAPIId:""}}})(qI||(qI={})),(n=>{n.is=function(r){return r.type==="WEBHOOK"},n.defaultData=function(){return{disabled:!1,type:"WEBHOOK",name:"",actions:new Vt,userWebhookId:""}}})(XI||(XI={})),(n=>{n.is=function(r){return r.type==="AIAssistantListener"},n.defaultData=function(){return{disabled:!1,type:"AIAssistantListener",name:"",actions:new Vt,analysis:"average",analysisRange:[0,71],analysisSingle:0}}})($I||($I={})),(n=>{n.is=function(r){return r.type==="AIAssistantTrigger"},n.defaultData=function(){return{disabled:!1,description:"",name:"",type:"AIAssistantTrigger",actions:new Vt}}})(YI||(YI={}))});function ZI(t){let e=typeof t;return t!==null&&(e==="object"||e==="function")}function KI(t){return typeof t=="string"&&t.length===36&&/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(t)}var ed,Yu,wN,Ir,QI,to,dh,Gg,JI,Zu,Tn,Je,bA,tO,th,mp,eO,iO,nO,rO,sO,aO,oO,lO,SS,hO,cO,MS,dO,uO,pO,ES,fO,AS,mO,gO,TS,vO,xA,yO,_O,bO,xO,wO,SO,Xc,il,eh,wA,SA,q_,X_,$_,Y_,Z_,MA,EA,K_,AA,Ku,MO,CS,PS,TA,EO,Q_,AO,TO,J_,CO,PO,DO,RO,IO,OO,LO,BO,UO,hx,QC,tn,Vi,Au,SN,Hg,tb,wc,CA,JC,eb,ib,PA,Yo,T1,ir,DS,ql,nb,ug,RS,IS,OS,Qu,LS,DA,RA,zO,zd,MN,An,rb,FO,NO,kO,VO,Wa,pg,sb,ab,nl,zc,jO,ih,ob,rl,BS,US,Mc,$c,Ec,fg,IA,GO,br,zS,HO,WO,Zo,Ns,Ju,OA,bs=z(()=>{var t,e,i,n,r,s,a,o;ed="personal camera",Yu="a218fcc3-276b-49b9-b485-49037fd14f5f",wN=2500134,Ir=5526619,(t=QI||{}).x="x",t.y="y",t.z="z",QI=t,(l=>{function c(u,p){return Math.pow(p[0]-u[0],2)+Math.pow(p[1]-u[1],2)}function h(u,p){return Math.sqrt(c(u,p))}function d(u,p,f){let g=l.sub(p,u),m=l.sub(f,u),v=l.dot(g,m)/l.dot(g,g),y=l.scalarMultiply(g,v);return l.add(u,y)}l.isEqual=function(u,p){return u[0]===p[0]&&u[1]===p[1]},l.lerp=function(u,p,f){return[u[0]+(p[0]-u[0])*f,u[1]+(p[1]-u[1])*f]},l.add=function(u,p){return[u[0]+p[0],u[1]+p[1]]},l.sub=function(u,p){return[u[0]-p[0],u[1]-p[1]]},l.multiply=function(u,p){return[u[0]*p[0],u[1]*p[1]]},l.divide=function(u,p){return[u[0]/p[0],u[1]/p[1]]},l.distanceSquared=c,l.distance=h,l.dot=function(u,p){return u[0]*p[0]+u[1]*p[1]},l.scalarMultiply=function(u,p){return[u[0]*p,u[1]*p]},l.projectionOnto=d,l.projectionOntoDistance=function(u,p,f){return h(u,d(u,p,f))},l.center=function(u,p){return[.5*(u[0]+p[0]),.5*(u[1]+p[1])]}})(to||(to={})),(e=dh||(dh={})).isEqual=function(l,c){return l[0]===c[0]&&l[1]===c[1]&&l[2]===c[2]},e.add=function(l,c){return[l[0]+c[0],l[1]+c[1],l[2]+c[2]]},e.sub=function(l,c){return[l[0]-c[0],l[1]-c[1],l[2]-c[2]]},e.div=function(l,c){return[l[0]/c[0],l[1]/c[1],l[2]/c[2]]},e.mul=function(l,c){return[l[0]*c[0],l[1]*c[1],l[2]*c[2]]},e.dist=function(l,c){return Math.hypot(l[0]-c[0],l[1]-c[1],l[2]-c[2])},e.lerp=function(l,c,h){return[l[0]+(c[0]-l[0])*h,l[1]+(c[1]-l[1])*h,l[2]+(c[2]-l[2])*h]},(i=Gg||(Gg={})).isEqual=function(l,c){return l[0]===c[0]&&l[1]===c[1]&&l[2]===c[2]&&l[3]===c[3]},i.lerp=function(l,c,h){return[l[0]+(c[0]-l[0])*h,l[1]+(c[1]-l[1])*h,l[2]+(c[2]-l[2])*h,l[3]+(c[3]-l[3])*h]},(l=>{let c=180/Math.PI,h=Math.PI/180;function d(p){return typeof p=="number"?p*c:p}function u(p){return typeof p=="number"?p*h:p}l.radToDeg=function(p){return[d(p[0]),d(p[1]),d(p[2])]},l.degToRad=function(p){return[u(p[0]),u(p[1]),u(p[2])]}})(JI||(JI={})),(n=Zu||(Zu={})).identity=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],n.isEqual=function(l,c){for(let h=0;h<16;h++)if(l[h]!==c[h])return!1;return!0},n.simplify=function(l){return l??n.identity},n.applyMatrix4=function(l,c){let h=c.slice(0);for(let d=0,u=c.length;d<u;d+=3){let p=l[3]*c[d]+l[7]*c[d+1]+l[11]*c[d+2]+l[15];h[d]=(l[0]*c[d]+l[4]*c[d+1]+l[8]*c[d+2]+l[12])/p,h[d+1]=(l[1]*c[d]+l[5]*c[d+1]+l[9]*c[d+2]+l[13])/p,h[d+2]=(l[2]*c[d]+l[6]*c[d+1]+l[10]*c[d+2]+l[14])/p}return h},(r=Tn||(Tn={})).isRGB=function(l){return typeof l=="object"&&typeof l.r=="number"&&typeof l.g=="number"&&typeof l.b=="number"},r.white={r:1,g:1,b:1},r.red={r:1,g:0,b:0},r.black={r:0,g:0,b:0},r.toRgb255a1=function(l){return{r:Math.round(255*l.r),g:Math.round(255*l.g),b:Math.round(255*l.b),a:1}},r.clone=function(l){return{r:l.r,g:l.g,b:l.b}},r.fromHex=function(l){return{r:((l=Math.floor(l))>>16&255)/255,g:(l>>8&255)/255,b:(255&l)/255}},r.toHex=function(l){return 65536*Math.round(255*l.r)+256*Math.round(255*l.g)+Math.round(255*l.b)},r.equals=function(l,c){return l.r===c.r&&l.g===c.g&&l.b===c.b},r.equalsFixed=function(l,c){return l.r.toFixed(2)===c.r.toFixed(2)&&l.g.toFixed(2)===c.g.toFixed(2)&&l.b.toFixed(2)===c.b.toFixed(2)},r.lerp=function(l,c,h){return{r:l.r+(c.r-l.r)*h,g:l.g+(c.g-l.g)*h,b:l.b+(c.b-l.b)*h}},r.is=function(l){return!!ZI(l)&&"r"in l&&"g"in l&&"b"in l&&!("a"in l)},(s=Je||(Je={})).white={...Tn.white,a:1},s.is=function(l){return!!ZI(l)&&"r"in l&&"g"in l&&"b"in l&&"a"in l},s.transparent={...Tn.white,a:0},s.from0to1=function(l){return{r:l[0],g:l[1],b:l[2],a:l[3]}},s.fromHexAndA=function(l,c){return{...Tn.fromHex(l),a:c}},s.toRgb255a1=function(l){return{r:Math.round(255*l.r),g:Math.round(255*l.g),b:Math.round(255*l.b),a:l.a}},s.equals=function(l,c){return Tn.equals(l,c)&&l.a===c.a},s.equalsFixed=function(l,c){return Tn.equalsFixed(l,c)&&l.a.toFixed(2)===c.a.toFixed(2)},s.lerp=function(l,c,h){return{r:l.r+(c.r-l.r)*h,g:l.g+(c.g-l.g)*h,b:l.b+(c.b-l.b)*h,a:l.a+(c.a-l.a)*h}},s.toStyle=function({r:l,g:c,b:h,a:d}=s.white){return`rgba(${255*l}, ${255*c}, ${255*h}, ${d})`},(bA||(bA={})).identity={position:[0,0,0],rotation:[0,0,0],scale:[1,1,1],pivot:[0,0,0],pivotRotation:[0,0,0]},(a=tO||{})[a.LINEAR=0]="LINEAR",a[a.EASE=1]="EASE",a[a.EASE_IN=2]="EASE_IN",a[a.EASE_OUT=3]="EASE_OUT",a[a.EASE_IN_OUT=4]="EASE_IN_OUT",a[a.CUBIC=5]="CUBIC",a[a.SPRING=6]="SPRING",a[a.ARC=7]="ARC",a[a.NONE=8]="NONE",tO=a,(th||(th={})).defaultData={mass:1,stiffness:80,damping:10,velocity:0},(mp||(mp={})).defaultData={control1:[.5,0],control2:[.5,1]},(o=eO||(eO={})).linear=[0,0,1,1],o.ease=[.25,.1,.25,1],o.easeIn=[.42,0,1,1],o.easeOut=[0,0,.58,1],o.easeInOut=[.42,0,.58,1]}),q$=z(()=>{var t,e;Ye(),xN(),(iO||(iO={})).defaultData={type:"SwitchCamera",name:"",targetCamera:"",delay:0,animate:!0,duration:1e3,easing:4,runMode:"Normal"},(nO||(nO={})).defaultData={type:"SceneTransition",name:"",target:"",delay:0,duration:1,transition:"none"},(rO||(rO={})).defaultData={type:"Link",name:"",url:null,context:"tab"},(sO||(sO={})).defaultData={type:"Destroy",name:"",objects:[],delay:0},(aO||(aO={})).defaultData={type:"Particles",name:"",emitterObjectId:"",delay:0,emission:"start",triggerAfter:"any"},(oO||(oO={})).defaultData={type:"Create",name:"",object:"",delay:0,creationSpeed:10,coordinateSystem:"world",dynamic:!0,destroy:"No",destroyAfterQuantity:5,lifetime:2,position:[0,0,0],rotation:[0,0,0],velocity:[1e3,0,0],hideBase:"No"},(lO||(lO={})).defaultData={type:"Reset",name:"",delay:0},(SS||(SS={})).defaultData={interaction:"play",delay:0,volume:.5,loop:1},(t=hO||(hO={})).pauseDefaultData={interaction:"pause",delay:0},t.stopDefaultData={interaction:"stop",delay:0},(e=cO||(cO={})).defaultData={type:"Audio",name:"",...SS.defaultData},e.hasAudioByActions=i=>i.some(({data:n})=>n.type==="Audio"&&n.interaction==="play"&&n.audio),e.hasAudioByEvents=i=>e.getAudiosByEvents(i).length>0,e.getAudiosByActions=i=>{let n=[];return i.forEach(r=>{let s=r.data;s.type==="Audio"&&s.interaction==="play"&&s.audio&&n.push(r),s.type==="Conditional"&&(n.push(...e.getAudiosByActions(s.ifActions)),n.push(...e.getAudiosByActions(s.elseActions)))}),n},e.getAudiosByEvents=i=>{let n=[];return i.forEach(({data:r})=>{dg.is(r)||r.type==="Collision"||r.type==="Start"||r.type==="Trigger"||r.type==="VariableChange"||r.type==="WEBHOOK"||r.type==="AIAssistantTrigger"?n.push(...e.getAudiosByActions(r.actions)):r.type==="Conditional"?(n.push(...e.getAudiosByActions(r.inActions)),n.push(...e.getAudiosByActions(r.outActions))):r.type==="GameControl"?Object.values(r.gameActions).forEach(s=>{n.push(...e.getAudiosByActions(s))}):r.type==="DragDrop"?(n.push(...e.getAudiosByActions(r.dragDropActions.drag)),n.push(...e.getAudiosByActions(r.dragDropActions.drop))):r.type==="Resize"?r.breakpoints.forEach(({data:s})=>{n.push(...e.getAudiosByActions(s.actions))}):r.type==="API"&&(n.push(...e.getAudiosByActions(r.successActions)),n.push(...e.getAudiosByActions(r.errorActions)))}),n},(MS||(MS={})).defaultData={interaction:"play",delay:0,volume:.5,loop:1/0},(i=>{i.pauseDefaultData={interaction:"pause",delay:0},i.stopDefaultData={interaction:"stop",delay:0}})(dO||(dO={})),(i=>{i.defaultData={type:"Video",name:"",triggerAfter:"autoplay",...MS.defaultData},i.hasVideoByActions=n=>n.some(({data:r})=>r.type==="Video"&&r.interaction==="play"&&r.layerId),i.hasVideoByObject=n=>{if(n.events){for(let{data:r}of n.events)if((dg.is(r)||r.type==="Start")&&i.hasVideoByActions(r.actions))return!0}},i.getVideosByActions=n=>{let r=[];return n.forEach(s=>{let a=s.data;a.type==="Video"&&a.interaction==="play"&&a.layerId&&r.push(s)}),r},i.getVideosByEvents=n=>{let r=[];return n.forEach(({data:s})=>{(dg.is(s)||s.type==="Start")&&r.push(...i.getVideosByActions(s.actions))}),r}})(uO||(uO={})),(pO||(pO={})).defaultData=function(i){return{state:i,repeat:0,delay:0,delayDirection:"start-once",direction:"normal",duration:1e3,easing:4}},(ES||(ES={})).defaultData=function(){return{tweens:new Vt,repeat:0,delay:0,delayDirection:"start-once",direction:"normal"}},(fO||(fO={})).defaultData=function(i){return{type:"Transition",name:"",runMode:"Once",object:i??null,...ES.defaultData()}},(AS||(AS={})).defaultData=function(i){return{interaction:"play",timeline:i,repeat:0,delay:0,delayDirection:"start-once",direction:"normal",runMode:"Once"}},(i=>{i.pauseDefaultData={interaction:"pause",delay:0},i.stopDefaultData={interaction:"stop",delay:0}})(mO||(mO={})),(gO||(gO={})).defaultData=function(i){return{type:"TimelineAnimation",name:"",...AS.defaultData(i)}},(TS||(TS={})).defaultData=function(i,n,r){return{interaction:"play",object:i,clipId:n,crop:r,crop2:r,repeat:-1,delay:0,delayDirection:"start-once",direction:"normal",runMode:"Normal"}},(i=>{i.pauseDefaultData={interaction:"pause",delay:0},i.stopDefaultData={interaction:"stop",delay:0}})(vO||(vO={})),(i=>{i.defaultData=function(n,r,s){return{type:"Animation",name:"",...TS.defaultData(n,r,s)}},i.isPause=function(n){return n.interaction==="pause"||n.interaction==="stop"}})(xA||(xA={})),(yO||(yO={})).defaultData={type:"SetVariable",name:"",variableId:"",expression:[]},(_O||(_O={})).defaultData=()=>({type:"Conditional",name:"",ifActions:new Vt,elseActions:new Vt,condition:[]}),(bO||(bO={})).defaultData={type:"DynamicVariablePlay",name:"",variableId:"",mode:"PlayPause",delay:0,pauseDelay:0},(xO||(xO={})).defaultData={type:"ClearLocalStorage",name:"",target:"all"},(wO||(wO={})).defaultData={name:"",type:"UserAPI"}}),X$=z(()=>{var t;(t=SO||(SO={})).emptyAudio={data:Uint8Array.from(atob("UklGRjIAAABXQVZFZm10IBIAAAABAAEAQB8AAEAfAAABAAgAAABmYWN0BAAAAAAAAABkYXRhAAAAAA=="),e=>e.charCodeAt(0)),mimeType:"audio/wav",filename:"unknown"},t.maxSize=2e6}),EN=z(()=>{var t;(t=Xc||(Xc={})).all=["PerspectiveCamera","OrthographicCamera"],t.is=function(e){return t.all.includes(e)},(e=>{e.DefaultUp=[0,1,0],e.DefaultTargetOffset=1e3,e.MinTargetOffset=.001,e.sanitizeTargetOffset=function(s){return s===void 0||!Number.isFinite(s)||s<e.MinTargetOffset?e.DefaultTargetOffset:s},e.DefaultAzimuth=-24,e.DefaultElevation=15;let i=e.DefaultAzimuth*Math.PI/180,n=e.DefaultElevation*Math.PI/180,r=180/Math.PI;e.DefaultPosition=[e.DefaultTargetOffset*Math.sin(i)*Math.cos(n),e.DefaultTargetOffset*Math.sin(n),e.DefaultTargetOffset*Math.cos(i)*Math.cos(n)],e.DefaultRotation=[Math.atan2(-Math.sin(n),Math.cos(i)*Math.cos(n))*r,Math.asin(Math.sin(i)*Math.cos(n))*r,Math.atan2(Math.sin(i)*Math.sin(n),Math.cos(i))*r],e.defaultData={far:1e5,type:"PerspectiveCamera",perspective:{near:70,fov:45,zoom:1},orthographic:{near:-1e5,zoom:1},up:e.DefaultUp,isUpVectorFlipped:!1,targetOffset:e.DefaultTargetOffset},e.getZoom=function(s){return s.type==="PerspectiveCamera"?s.perspective?.zoom??1:s.orthographic?.zoom??1}})(il||(il={}))}),AN=z(()=>{var t;(t=eh||(eh={})).defaultData=function(e,i=.1){return{disabled:!1,type:"linear",hideBase:!1,instanced:!1,count:3,radial:{radius:2*Math.max(typeof e[0]=="number"?e[0]:1,typeof e[1]=="number"?e[1]:1),start:0,end:360,alignment:!1,axis:"y",scale:[1,1,1],rotation:[0,0,0],position:[0,0,0],pivot:[0,0,0],pivotRotation:[0,0,0]},toObject:{object:"",spreadType:"random",scale:[0,0,0],rotation:[0,0,0],position:[0,0,0],axis:"x",seed:0,count:99,align:"normal",pivot:[0,0,0],pivotRotation:[0,0,0]},linear:{scale:[1,1,1],rotation:[0,0,0],position:[(typeof e[0]=="number"?e[0]+e[0]:1)*i,0,0],pivot:[0,0,0],pivotRotation:[0,0,0]},grid:{count:[2,2,2],size:e.map(n=>(typeof n=="number"?n:1)*(1+i)),useCenter:!0},randomness:!1,randomnessObject:{strength:100,scale:[0,0,0],rotation:[0,0,0],position:[0,0,0],movement:1,seed:0,freqScale:10,noiseType:"perlin"}}},t.merge=function(e,i){let n={...e};if(SA.forEach(r=>{Object.assign(n,{[r]:i[r]??e[r]})}),n.radial={...e.radial},i.radial){let r=e.radial,s=i.radial;q_.forEach(a=>{Object.assign(n.radial,{[a]:s[a]??r[a]})})}if(n.linear={...e.linear},i.linear){let r=e.linear,s=i.linear;X_.forEach(a=>{Object.assign(n.linear,{[a]:s[a]??r[a]})})}if(n.grid={...e.grid},i.grid){let r=e.grid,s=i.grid;$_.forEach(a=>{Object.assign(n.grid,{[a]:s[a]??r[a]})})}if(n.toObject={...e.toObject},i.toObject){let r=e.toObject,s=i.toObject;Y_.forEach(a=>{Object.assign(n.toObject,{[a]:s[a]??r[a]})})}if(n.randomnessObject={...e.randomnessObject},i.randomnessObject){let r=e.randomnessObject,s=i.randomnessObject;Z_.forEach(a=>{Object.assign(n.randomnessObject,{[a]:s[a]??r[a]})})}return n},t.isPartial=function(e){return!(!e.randomnessObject&&!e.toObject)},(e=>{e.defaultData={radial:{},linear:{},grid:{},toObject:{},randomnessObject:{}};let i=["radial","linear","grid","toObject","randomnessObject"];e.toOps=function(n,r){let s=[];n.count!==void 0&&s.push({type:0,path:r,props:{count:n.count}});for(let a of i){let o=n[a];o&&Object.keys(o).length>0&&s.push({type:0,path:[...r,a],props:o})}return s}})(wA||(wA={})),SA=["count"],q_=["radius","start","end","position","scale","rotation"],X_=["position","scale","rotation"],$_=["count","size"],Y_=["count","position","scale","rotation"],Z_=["strength","scale","rotation","position","movement","seed","freqScale"]}),TN=z(()=>{var t;bs(),(t=MA||(MA={})).all=["PointLight","SpotLight","DirectionalLight","HemisphereLight"],t.is=function(e){return t.all.includes(e)},(EA||(EA={})).defaultData=function(e){return function(i){if(i==="PointLight")return{type:i,color:Je.white,intensity:1,distance:2e3,decay:1,shadows:!0,shadowResolution:1024,shadowRadius:1,penumbraSize:.5,depth:1e5};if(i==="SpotLight")return{type:i,color:Je.white,intensity:1,distance:2e3,decay:1,shadows:!0,penumbra:0,angle:30/180*Math.PI,depth:1e5,penumbraSize:.5,shadowResolution:1024,shadowRadius:1};if(i==="DirectionalLight")return{type:i,color:Je.white,intensity:1,shadows:!0,size:2e3,depth:1e5,penumbraSize:.5,shadowResolution:1024,shadowRadius:1};throw new Error("not implemented")}(e)}}),CN=z(()=>{var t;(t=K_||(K_={})).defaultShapeData={type:"PlaneEmitterShape",size:[100,100,100]},t.defaultCollisionData={colliderEntityId:null,collisionBounce:.75},t.defaultData={renderMaterial:{type:"particleMaterial",color:{r:1,g:.2,b:.545,a:1},color2:{r:.945,g:.714,b:.184,a:1},coloring:"gradient",ease:"linearFadeOut",easeSize:"linearFadeOut",transparent:!0,size:[40,40],texture:"pt_default_particle",spriteRotation:[0,0]},birthRatePerSec:50,gravity:1,noiseStrength:0,noiseScale:0,noiseSeed:1,noiseType:"curl",randomRotation:0,randomScale:.2,randomMass:.5,rootObjectType:"instancedMesh",life:1,direction:[0,0,0],directionMode:"axis",speed:10,shape:t.defaultShapeData,autoPlay:!0,emitTimeDelay:0,emitTimeCycle:"infinity",emitTimeDuration:1,...t.defaultCollisionData}}),PN=z(()=>{var t;(t=AA||(AA={})).defaultData={gravity:10,damping:.03,localStiffness:.67,globalStiffness:.5,globalRange:.15,stiffnessFalloff:.1,windStrength:0,vspCoefficient:.01,elasticity:.15,hairLength:.75,tipSeparation:.8,kink:0,kinkFrequency:0,clumpStrength:0,clumpSize:32,clumpTipScale:1.5,spreadRadius:.03,guideStrands:8192,headShape:"sphere",baseObjectId:null,hairColorSource:"custom",hairShadeRoot:.6,hairShadeTip:1.15,hairRootColor:{r:.29,g:.102,b:.039,a:1},hairMidColor:{r:.8,g:.267,b:.133,a:1},hairTipColor:{r:.545,g:.18,b:.18,a:1},headColor:{r:.325,g:.137,b:.114,a:1},noiseEnabled:!1,noiseColorA:{r:.545,g:.184,b:.788,a:1},noiseColorB:{r:.914,g:.188,b:.914,a:1},noiseColorC:{r:.2,g:.4,b:1,a:1},noiseColorD:{r:.2,g:1,b:.6,a:1},noiseScale:1.8,noiseMixHair:.75,noiseMixHead:.8,castShadow:!0,receiveShadow:!0,hairWidth:1.75,specularPower:40,specularIntensity:.4,diffuseIntensity:.6,ambientIntensity:.25,opacity:1,tipFade:.4,autoPlay:!0},t.regenProps=["hairLength","spreadRadius","guideStrands","headShape","baseObjectId"]}),t3=z(()=>{(Ku||(Ku={})).defaultData={enabled:"visibility",fusedBody:!0,rigidBody:"positioned",density:1,pointMass:0,gravityScale:1,friction:.5,damping:0,restitution:.2,colliderType:"convex",enabledRotation:[!0,!0,!0],enabledTranslation:[!0,!0,!0]}}),DN=z(()=>{var t,e;(t=MO||{})[t.Front=0]="Front",t[t.Back=1]="Back",t[t.Double=2]="Double",MO=t,(e=CS||(CS={})).defaultData={castShadow:!0,receiveShadow:!0},e.equals=function(i,n){return i.castShadow===n.castShadow&&i.receiveShadow===n.receiveShadow},(i=>{i.defaultData={flatShading:!1,wireframe:!1,side:0},i.equals=function(n,r){return n.flatShading===r.flatShading&&n.side===r.side&&n.wireframe===r.wireframe&&(n.shadowCatcher??!1)===(r.shadowCatcher??!1)}})(PS||(PS={})),(TA||(TA={})).defaultData={...PS.defaultData,...CS.defaultData},(EO||(EO={})).getMaterialData=function(i,n){let r=[];if("material"in i){let s=typeof i.material=="string"?n.materials[i.material]??n.lib.materials[i.material]?.asset:i.material;s&&r.push(s)}else if("materials"in i)for(let s of i.materials){let a=typeof s=="string"?n.materials[s]??n.lib.materials[s]?.asset:s;a&&r.push(a)}return r}}),RN=z(()=>{var t;(t=Q_||(Q_={})).defaultVideo={data:"",thumb:"/_assets/_videos/catThumb.png",type:"video",name:"Cat video"},t.maxSize=3e7}),r0=z(()=>{var t,e,i,n;Ye(),bs(),RN(),bs(),(AO||(AO={})).is=function(r){return r==="texture"||r==="video"||r==="color"||r==="depth"||r==="normal"||r==="gradient"||r==="noise"||r==="fresnel"||r==="cavity"||r==="dust"||r==="rainbow"||r==="toon"||r==="outline"||r==="particle"||r==="transmission"||r==="reflection"||r==="matcap"||r==="displace"||r==="pattern"||r==="vertexColor"||r==="light"},(TO||(TO={})).is=function(r){return r==="luminance"||r==="r"||r==="g"||r==="b"||r==="a"},(J_||(J_={})).is=function(r){return typeof r=="object"&&r!==null&&r.image!=null},(CO||(CO={})).is=function(r){return r==="phong"||r==="toon"||r==="lambert"||r==="physical"},(n=PO||{})[n.Linear=0]="Linear",n[n.Radial=1]="Radial",n[n.Polar=2]="Polar",PO=n,DO=(r=>(r[r.RepeatWrapping=1e3]="RepeatWrapping",r[r.ClampToEdgeWrapping=1001]="ClampToEdgeWrapping",r[r.MirroredRepeatWrapping=1002]="MirroredRepeatWrapping",r))(DO||{}),RO=(r=>(r[r.NearestFilter=1003]="NearestFilter",r[r.LinearFilter=1006]="LinearFilter",r[r.LinearMipmapLinearFilter=1008]="LinearMipmapLinearFilter",r))(RO||{}),(i=IO||{})[i.UV=0]="UV",i[i.Planar=1]="Planar",i[i.Spherical=2]="Spherical",i[i.Cylindrical=3]="Cylindrical",i[i.Triplanar=4]="Triplanar",IO=i,(e=OO||{})[e.Simplex=0]="Simplex",e[e.SimplexFractal=1]="SimplexFractal",e[e.Ashima=2]="Ashima",e[e.Fbm=3]="Fbm",e[e.Perlin=4]="Perlin",e[e.Voronoi=5]="Voronoi",OO=e,(t=LO||{})[t.F1=0]="F1",t[t.F2=1]="F2",t[t.F2MinusF1=2]="F2MinusF1",t[t.SmoothBlend=3]="SmoothBlend",t[t.Edge=4]="Edge",t[t.Power=5]="Power",t[t.Lines=6]="Lines",t[t.Cells=7]="Cells",LO=t,BO=(r=>(r[r.Lights=0]="Lights",r[r.Static=1]="Static",r[r.Camera=2]="Camera",r))(BO||{}),UO=(r=>(r[r.Circle=0]="Circle",r[r.Ring=1]="Ring",r[r.Polygon=2]="Polygon",r[r.Cross=3]="Cross",r[r.Diamond=4]="Diamond",r[r.Checkerboard=5]="Checkerboard",r[r.Line=6]="Line",r[r.Wave=7]="Wave",r))(UO||{}),hx=["mode","gradientType","noiseType","tracingMode","mirror","displacementType","projection","cnormal","crop","axis","side","roughnessMapChannel","metalnessMap","metalnessMapChannel","normalMap","aoMap","aoMapChannel","emissiveMap","style"],QC=["wrapping","image","video","name","minFilter","magFilter"],(r=>{r.patch=function(s,a){let{texture:o,...l}=a;if(Object.assign(s,l),o){let c=s.texture;c&&Object.assign(c,o)}},r.defaultColorLayer=function(s){return{...r.defaultData("color"),color:s}},r.defaultData=function(s,a){return s==="light"&&a?function(o){let l={mode:0,isMask:!1,visible:!0,bumpMap:void 0,bumpMapIntensity:5,roughnessMap:void 0,alphaOverride:1};switch(o){case"phong":return{...l,category:"phong",specular:{r:.2,g:.2,b:.2},shininess:5,type:"light",visible:!0,mode:0,occlusion:!0,alpha:.6};case"toon":return{...l,category:"toon",specular:{r:.2,g:.2,b:.2},shininess:10,type:"light",alpha:1};case"lambert":return{...l,category:"lambert",emissive:{r:0,g:0,b:0},type:"light",alpha:1,visible:!0,mode:0,occlusion:!0};case"physical":return{...l,category:"physical",roughness:.6,metalness:.2,reflectivity:.2,type:"light",alpha:.6,visible:!0,mode:0,occlusion:!0}}}(a):function(o){let l={alpha:1,mode:0,isMask:!1,visible:!0};switch(o){case"texture":return{...l,type:"texture",size:[128,128],blending:0,axis:"x",side:2,projection:0,texture:{image:"image_0",wrapping:1e3,repeat:[1,1],offset:[0,0],rotation:0,minFilter:1008,magFilter:1006},crop:!1};case"video":return{...l,type:"video",size:[128,128],blending:0,axis:"x",side:2,projection:0,texture:{video:Q_.defaultVideo,wrapping:1001,repeat:[1,1],offset:[0,0],rotation:0,minFilter:1008,magFilter:1006},crop:!1};case"color":return{...l,type:"color",color:Tn.fromHex(Ir)};case"vertexColor":return{...l,type:"vertexColor"};case"depth":return{...l,type:"depth",gradientType:1,smooth:!1,isVector:!0,isWorldSpace:!1,origin:[0,0,0],direction:[1,0,0],colors:[[1,1,1,1],[0,0,0,1]],steps:[0,1],near:50,far:200};case"normal":return{...l,type:"normal",cnormal:[1,1,1]};case"gradient":return{...l,type:"gradient",gradientType:0,smooth:!1,colors:[[0,0,0,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1]],steps:[0,1,1,1,1,1,1,1,1,1],num:2,angle:0,offset:[0,0],morph:[0,0]};case"noise":return{...l,type:"noise",size:[100,100,100],noiseType:0,scale:1,move:1,colorA:{...Tn.fromHex(6710886),a:1},colorB:{...Tn.fromHex(6710886),a:1},colorC:{...Tn.fromHex(16777215),a:1},colorD:{...Tn.fromHex(16777215),a:1},distortion:[1,1],fA:[1.7,9.2],fB:[8.3,2.8],voronoiStyle:0,highCut:1,lowCut:0,smoothness:.3,seed:0,quality:1};case"cavity":return{...l,type:"cavity",mode:3,ridge:1,valley:1};case"fresnel":return{...l,type:"fresnel",color:Je.fromHexAndA(16777215,1),bias:.1,scale:1,intensity:2,factor:1};case"dust":return{...l,type:"dust",color:Je.fromHexAndA(10323813,1),coverage:.2,softness:.2,noiseStrength:.2,noiseScale:1};case"rainbow":return{...l,type:"rainbow",filmThickness:30,movement:0,wavelengths:[0,0,0],noiseStrength:0,noiseScale:1,offset:[0,0,0]};case"toon":return{...l,type:"toon",positioning:2,colors:[[0,0,0,1],[.5,.5,.5,1],[.5,.5,.5,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1]],steps:[0,.475,.525,1,1,1,1,1,1,1],num:4,source:[0,1e3,0],isWorldSpace:!0,noiseStrength:0,noiseScale:1,shadowColor:Je.fromHexAndA(0,0),offset:[0,0,0]};case"outline":return{...l,type:"outline",outlineColor:Je.fromHexAndA(0,1),contourColor:Je.fromHexAndA(0,1),outlineWidth:2,contourWidth:5,outlineThreshold:.4,contourThreshold:0,outlineSmoothing:0,contourFrequency:10,contourDirection:[0,1,0],positionalLines:!1,compensation:!0};case"matcap":return{...l,type:"matcap",texture:{image:"matcap_0",wrapping:1001,repeat:[1,1],offset:[0,0],rotation:0,minFilter:1008,magFilter:1006}};case"transmission":return{...l,type:"transmission",thickness:10,ior:1.5,roughness:1};case"reflection":return{...l,type:"reflection",blur:0,thickness:.001,steps:60,stepSize:.005,tracingMode:1,mirror:0};case"displace":return{visible:!0,type:"displace",displacementType:"noise",noiseType:0,scale:10,movement:1,offset:[0,0,0],intensity:8,voronoiStyle:0,smoothness:.3,seed:0,highCut:1,lowCut:0,quality:1};case"pattern":return{...l,type:"pattern",style:0,projection:0,axis:"y",blending:0,offset:[0,0],colorA:{...Tn.fromHex(0),a:1},colorB:{...Tn.fromHex(16777215),a:1},frequency:[10,10],size:.5,variation:0,smoothness:.5,zigzag:0,rotation:0,vertical:[0,1],horizontal:[0,1],sides:6}}}(s)}})(tn||(tn={})),(r=>{function s(a,o="layer1",l="layer2",c=Tn.fromHex(16777215)){let h=new Vt;return h.push({fi:0,data:tn.defaultData("light",a),id:o}),h.push({fi:1,data:tn.defaultData("color"),id:l}),{layers:h}}r.isMergable=function(a){return!a.layers.some(o=>o.data.type==="texture"&&o.data.projection!==0||o.data.type==="depth"&&!o.data.isWorldSpace||o.data.type==="noise"||o.data.type==="dust"&&o.data.noiseStrength!==0||o.data.type==="displace")},r.getHash=function(a){let o="";return a.layers.forEach(l=>{Object.entries(l.data).forEach(([c,h])=>{o+=`${c}${h}`,Array.isArray(h)?h.forEach(d=>o+=`${d}`):typeof h=="object"?Object.values(h).forEach(d=>{o+=typeof d=="number"?`${d.toFixed(4)}`:`${d}`}):o+=`${h}`})}),o},r.defaultEmptyData=function(){return{layers:new Vt}},r.defaultData=function(a="layer1",o="layer2"){return s("physical",a,o)},r.withName=function(a,o){return{...a,name:o}},r.defaultTwoLayerData=s,r.defaultColorMaterial=function(a,o,l="layer1",c="layer2"){let h=new Vt;return h.push({fi:0,data:tn.defaultData("light",o),id:l}),h.push({fi:1,data:tn.defaultColorLayer(a),id:c}),{layers:h}},r.defaultUIObjectMaterial=function(a){let o=tn.defaultData("texture");a&&Object.assign(o.texture,{image:a});let l=new Vt;return l.push({fi:0,data:o,id:"layer1"}),l.push({fi:1,data:{...tn.defaultData("transmission"),alpha:1},id:"layer2"}),l.push({fi:2,data:{...tn.defaultData("light","lambert"),alpha:0},id:"layer3"}),{layers:l}},r.defaultTwoLayerTextureData=function(a,o="physical",l="layer1",c="layer2"){let h=tn.defaultData("texture");Object.assign(h.texture,{image:a});let d=new Vt;return d.push({fi:0,data:h,id:l}),d.push({fi:1,data:tn.defaultData("light",o),id:c}),{layers:d}},r.defaultTwoLayerVideoTextureData=function(a,o="physical",l="layer1",c="layer2"){let h=tn.defaultData("video");Object.assign(h.texture,{video:a});let d=new Vt;return d.push({fi:0,data:h,id:l}),d.push({fi:1,data:tn.defaultData("light",o),id:c}),{layers:d}}})(Vi||(Vi={}))}),$$=z(()=>{Au="Roboto_regular",SN="https://fonts.gstatic.com/s/roboto/v30/KFOmCnqEu92Fr1Me5WZLCzYlKw.ttf"}),Y$=z(()=>{$$()}),IN=z(()=>{Ye(),(Hg||(Hg={})).defaultData=function(){return{points:new Vt,roundness:0,shapeHoles:[],isClosed:!1}}}),ON=z(()=>{Ye(),(tb||(tb={})).defaultData=function(){return{points:new Vt,lastInsertionPlane:null,subdivisions:12,isClosed:!1,subdivisionMode:"parametric"}},wc={type:"Ellipse",width:50,height:50,spikes:16,angle:360,innerRadius:0},(CA||(CA={})).merge=function(t,e){let i={...t};return eb.forEach(n=>{Object.assign(i,{[n]:e[n]??t[n]})}),i},JC={shape:wc,depth:1,offset:0,bevel:50,bevelSides:6,angle:0,twist:0,startScale:1,endScale:1,capType:"flat"},eb=["depth","offset","angle","twist","startScale","endScale"]}),e3=z(()=>{var t,e;IN(),ON(),(t=ib||(ib={})).is2DParametricMesh=function(i){return i==="PolygonGeometry"||i==="RectangleGeometry"||i==="StarGeometry"||i==="TriangleGeometry"||i==="EllipseGeometry"||i==="UIGeometry"},t.isParametricMesh=function(i){return i==="PolygonGeometry"||i==="RectangleGeometry"||i==="StarGeometry"||i==="TriangleGeometry"||i==="EllipseGeometry"||i==="PathGeometry"||i==="VectorGeometry"||i==="ConeGeometry"||i==="CubeGeometry"||i==="CylinderGeometry"||i==="DodecahedronGeometry"||i==="HelixGeometry"||i==="IcosahedronGeometry"||i==="LatheGeometry"||i==="PyramidGeometry"||i==="SphereGeometry"||i==="PlaneGeometry"||i==="BackdropGeometry"||i==="TorusGeometry"||i==="TorusKnotGeometry"||i==="BooleanGeometry"||i==="TextGeometry"||i==="InputGeometry"||i==="DecalGeometry"},t.isSwappableGeometry=function(i){return i==="PolygonGeometry"||i==="RectangleGeometry"||i==="StarGeometry"||i==="TriangleGeometry"||i==="EllipseGeometry"||i==="PathGeometry"||i==="VectorGeometry"||i==="ConeGeometry"||i==="CubeGeometry"||i==="CylinderGeometry"||i==="DodecahedronGeometry"||i==="HelixGeometry"||i==="IcosahedronGeometry"||i==="LatheGeometry"||i==="PyramidGeometry"||i==="SphereGeometry"||i==="PlaneGeometry"||i==="BackdropGeometry"||i==="TorusGeometry"||i==="TorusKnotGeometry"||i==="TextGeometry"||i==="SubdivGeometry"||i==="NonParametricGeometry"},(PA||(PA={})).merge=function(i,n){let r={...i};return Object.assign(r,n),r.type==="PathGeometry"&&"extrusion"in n&&n.extrusion&&(r.extrusion={...i.extrusion},Object.assign(r.extrusion,CA.merge(r.extrusion,n.extrusion))),r},(e=Yo||(Yo={})).defaultData=function(i){if(i==="RectangleGeometry")return{width:320,height:320,type:i,cornerRadius:[0,0,0,0],cornerType:0,depth:0,extrudeBevelSize:0,extrudeBevelSegments:1};if(i==="UIGeometry")return{type:i,frame:"",cornerRadius:[0,0,0,0],cornerType:0,width:1,height:1};if(i==="PathGeometry")return{type:i,width:1,height:1,depth:1,path:tb.defaultData(),extrusion:JC};if(i==="VectorGeometry")return{width:1,height:1,type:i,subdivisions:12,shape:Hg.defaultData(),depth:0,extrudeBevelSize:0,extrudeBevelSegments:1};if(i==="BooleanGeometry")return{type:i,operation:2,width:0,height:0,depth:0,phongAngle:35};if(i==="ShapeBlendGeometry")return{type:i,width:0,height:0,depth:0,resolutionLevel:6,blendRange:100,useChildrenColors:!1};if(i==="DecalGeometry")return{type:i,width:200,height:200,depth:200,offset:1,projection:"all",projectionTargets:[]};if(i==="TextGeometry")return{type:i,width:100,height:100,depth:0,horizontalAlign:1,verticalAlign:1,fontSize:16,lineHeight:1.2,letterSpacing:0,text:{textValue:""},textTransform:1,font:"Roboto_regular",editable:!1,extrudeBevelSize:0,extrudeBevelSegments:1};if(i==="InputGeometry")return{...e.defaultData("TextGeometry"),type:i,editable:!0};if(i==="SphereGeometry")return{type:"SphereGeometry",width:100,height:100,depth:100,widthSegments:64,heightSegments:64,phiStart:0,phiLength:2*Math.PI,thetaStart:0,thetaLength:180};throw new Error("not implemented")},T1=["width","height","depth"]}),LN=z(()=>{bs(),(t=>{function e(i){return i.mode??"linear"}t.defaultData={enabled:!1,useBackgroundColor:!1,color:Tn.white,near:.1,far:2e3,mode:"linear",density:.005,heightFalloff:.01,heightBase:0},t.getMode=e,t.getModeIndex=function(i){let n=e(i);return n==="height"?1:n==="both"?2:0},t.getDensity=function(i){return i.density??t.defaultData.density},t.getHeightFalloff=function(i){return i.heightFalloff??t.defaultData.heightFalloff},t.getHeightBase=function(i){return i.heightBase??t.defaultData.heightBase}})(ir||(ir={}))}),i3=z(()=>{(DS||(DS={})).defaultData={image:null,rotation:0,blur:32,showBackground:!0},(ql||(ql={})).defaultData={enabled:!1,mode:"hdri",hdri:DS.defaultData,timeOfDay:10,weather:"partlyCloudy",lighting:!0,lightingIntensity:1,lightingQuality:"full",clouds:!0,windSpeed:2,animateWind:!0,exposure:1,seed:2}}),BN=z(()=>{(()=>{let t={opacity:1,blendFunction:13,enabled:!1};(nb||(nb={})).defaultData={enabled:!1,pixelation:{...t,blendFunction:16,granularity:15},bloom:{...t,blendFunction:16,intensity:1,blurScale:1,luminanceThreshold:.25,luminanceSmoothing:.025,kernelSize:3},chromaticAberration:{...t,offset:[2,2]},vignette:{...t,darkness:1,offset:0},hueSaturation:{...t,hue:3,saturation:0},brightnessContrast:{...t,brightness:.25,contrast:0},depthOfField:{...t,focusDistance:100,focalLength:20,bokehScale:5},noise:{...t,blendFunction:16}}})()}),n3=z(()=>{var t;LN(),i3(),BN(),bs(),(t=ug||(ug={})).defaultData={type:"normal",softShadowQuality:"low"},t.isSoft=function(e){return e!=null&&(e.type===void 0||e.type==="soft")},(RS||(RS={})).defaultData={enabled:!0,color:{r:.8274509803921568,g:.8274509803921568,b:.8274509803921568},intensity:.75},(IS||(IS={})).defaultData={occlusion:!1,aoFullRes:!1,radius:256,bias:.5,aoColor:{r:.19607843137254902,g:.19607843137254902,b:.19607843137254902}},(e=>{e.defaultData={pipeline:"classic",toneMapping:"aces",exposure:1},e.isUntouched=function(i){return i===void 0||i.pipeline==="classic"&&(i.toneMapping==="none"||i.toneMapping==="aces")&&i.exposure===1}})(OS||(OS={})),(Qu||(Qu={})).defaultData={usePhysics:!1,gravity:-10},(LS||(LS={})).defaultData={playCamera:ed,gameControlObject:null},(DA||(DA={})).defaultData={backgroundColor:Je.fromHexAndA(wN,1),postprocessing:nb.defaultData,fog:ir.defaultData,sky:ql.defaultData,globalPhysics:Qu.defaultData,ambient:RS.defaultData,ao:IS.defaultData,shadow:ug.defaultData,publish:LS.defaultData,grading:OS.defaultData}}),Z$=z(()=>{(RA||(RA={})).defaultData={colliderType:"box",size:[100,100,100],colliderHelperVisible:!0,forceType:"collider",forceRange:"global",forceIntensity:.5,forceDambing:.95}}),cx=z(()=>{var t,e,i;Ye(),EN(),TN(),CN(),PN(),t3(),DN(),bs(),r0(),e3(),AN(),Dn(),n3(),Z$(),(t=zO||(zO={})).isComponentRelated=function(n){return n==="Component"||n==="Instance"},t.isEmptyOrComponent=function(n){return n==="Empty"||n==="Instance"},(e=zd||(zd={})).identity={...bA.identity,hiddenMatrix:Zu.identity},e.fromObject=function(n){return{position:n.position,rotation:n.rotation,scale:n.scale,pivot:n.pivot,pivotRotation:n.pivotRotation,hiddenMatrix:n.hiddenMatrix}},e.merge=function(n,r){return{position:r?.position||n.position,rotation:r?.rotation||n.rotation,pivot:r?.pivot||n.pivot,pivotRotation:r?.pivotRotation||n.pivotRotation,scale:r?.scale||n.scale,hiddenMatrix:r?.hiddenMatrix||n.hiddenMatrix}},e.diff=function(n,r){return eN({position:dh.isEqual(n.position,r.position)?void 0:r.position,rotation:dh.isEqual(n.rotation,r.rotation)?void 0:r.rotation,scale:dh.isEqual(n.scale,r.scale)?null:r.scale,hiddenMatrix:Zu.isEqual(n.hiddenMatrix,r.hiddenMatrix)?void 0:r.hiddenMatrix})},MN=["slide","offset"],(An||(An={})).defaultData={states:new Vt,events:new Vt,visible:!0,raycastLock:!1,physics:Ku.defaultData,pathSnapping:{pathId:null,slide:0,offset:0,orientation:"tangential"},...zd.identity,cloner:null},(rb||(rb={})).defaultData={type:"Empty",...An.defaultData},(FO||(FO={})).defaultData={type:"ParticleCollider",...RA.defaultData,...An.defaultData},(NO||(NO={})).defaultData={type:"Component",...An.defaultData},(kO||(kO={})).defaultData={type:"Particle",...An.defaultData,...K_.defaultData},(VO||(VO={})).defaultData={type:"Hair",...An.defaultData,...AA.defaultData},(Wa||(Wa={})).defaultData={type:"Mesh",...An.defaultData,...TA.defaultData},(pg||(pg={})).defaultData={...An.defaultData,...zd.identity,position:il.DefaultPosition,rotation:il.DefaultRotation,...il.defaultData},(n=>{n.defaultData=function(r){return{...An.defaultData,...EA.defaultData(r)}},n.defaultDirectionalLightData={...n.defaultData("DirectionalLight"),position:[200,300,300],name:"Directional Light",intensity:.7}})(sb||(sb={})),(n=>{function r(s,a,o=0){for(;o<a.length;){let l=s?s[a[o]]:void 0;if(a.length===o+1)return l;if(!l)return;s=l.descendants,o+=1}}n.resolveWithDes=r,n.resolve=function(s,a,o=0){let l=r(s,a,o);if(l){let c=Object.keys(l);if(c.length===1&&c[0]==="descendants")return}return l}})(ab||(ab={})),(n=>{function r(s,a){return{...An.defaultData,...a,component:s,overrides:new $i,physics:void 0,events:void 0,type:"Instance"}}n.rootOverrideProps=["physics","events"],n.compositeNonOptionalOverrideProps=["geometry"],n.compositeEntireOverrideOverrideProps=["material"],n.ofComponent=r,n.fromComponentData=function(s){let a=zd.fromObject(s.data);return r(s.id,a)}})(nl||(nl={})),(n=>{n.defaultData={type:"Page",...An.defaultData,physics:{...Ku.defaultData,fusedBody:!1},...DA.defaultData,camera:pg.defaultData,timelines:new te},n.isUIPage=function(r){return r.uiScene!==void 0}})(zc||(zc={})),(i=jO||(jO={})).defaultCamera={position:[0,0,1e3],scale:[1,1,1],rotation:[0,0,0],pivot:[0,0,0],pivotRotation:[0,0,0],hiddenMatrix:Zu.identity,name:"Play Camera",visible:!0,raycastLock:!1,physics:Ku.defaultData,states:new Vt,events:new Vt,cloner:null,pathSnapping:{pathId:null,orientation:"tangential",slide:0,offset:0},...il.defaultData},i.KeysByResetCategory={States:["states"],Events:["events"],Material:["material","materials"],Geometry:["geometry"],Position:["position"],Rotation:["rotation"],Scale:["scale"],Transform:["position","scale","rotation","hiddenMatrix"],Name:["name"],Visibility:["visible","raycastLock","flatShading","wireframe","side","shadowCatcher"],Shadows:["castShadow","receiveShadow"],Cloner:["cloner"],Physics:["physics"]},i.defaultMeshObject={name:"Rectangle",...An.defaultData,...Wa.defaultData,geometry:Yo.defaultData("RectangleGeometry"),material:Vi.defaultTwoLayerData("physical","layer1","layer2")},i.defaultBooleanObject={name:"Boolean",...An.defaultData,...Wa.defaultData,geometry:Yo.defaultData("BooleanGeometry"),material:Vi.defaultTwoLayerData("physical","layer1","layer2")},i.defaultShapeBlendObject={name:"Shape Blend",...An.defaultData,...Wa.defaultData,geometry:Yo.defaultData("ShapeBlendGeometry"),material:Vi.defaultTwoLayerData("physical","layer1","layer2")},i.defaultTextObject={name:"Text",...An.defaultData,...Wa.defaultData,geometry:Yo.defaultData("TextGeometry"),material:Vi.defaultTwoLayerData("physical","layer1","layer2")},i.defaultInputObject={name:"Input",...An.defaultData,...Wa.defaultData,geometry:Yo.defaultData("InputGeometry"),material:Vi.defaultTwoLayerData("physical","layer1","layer2")},(n=>{n.newEmpty=function(r,s){let a={name:s};return r.type==="Mesh"?(a.geometry={},"material"in r&&(a.material={layers:new $i}),"materials"in r&&(a.materials=r.materials.map(o=>({layers:new $i})))):Xc.is(r.type)&&(a.perspective={},a.orthographic={}),a},n.toOps=function(r,s){let a,o=[],l={orthographic:0,perspective:0,geometry:0};function c(h,d){for(let[u,p]of Object.entries(d.layers)){let{texture:f,...g}=p;if(f!==void 0&&Object.keys(f).length>0){let m={path:[...h,"layers",u,"texture"],props:f,type:0};o.push(m)}if(Object.keys(g).length>0){let m={path:[...h,"layers",u],props:g,type:0};o.push(m)}}}for(let[h,d]of Object.entries(s)){let u=d;if(h!=="name")if(h==="cloner")o.push(...wA.toOps(u,["cloner"]));else if(h==="pathSnapping")o.push({path:[h],props:{slide:u.slide,offset:u.offset},type:0});else if(h==="material")c(["material"],u);else if(h==="materials")for(let[p,f]of Object.entries(u))c(["materials",p],f);else if(l[h]===0){if(h==="geometry"&&u.extrusion!==void 0){let p={path:[h,"extrusion"],props:u.extrusion,type:0};o.push(p),u={...u},delete u.extrusion}if(Object.keys(u).length>0){let p={path:[h],props:u,type:0};o.push(p)}}else a===void 0&&(a={path:[],props:{},type:0},o.push(a)),a.props[h]=u}return o},n.patch=function(r,s){if(s===void 0)return r;let a={...r};if(Object.assign(a,zd.merge(a,s)),Object.assign(a,{pathSnapping:Object.assign({},a.pathSnapping,{slide:s.pathSnapping?.slide??a.pathSnapping?.slide??0,offset:s.pathSnapping?.offset??a.pathSnapping?.offset??0})}),Xc.is(r.type)){a.orthographic={...a.orthographic},a.perspective={...a.perspective};let o=s;o.orthographic?.zoom!==void 0&&(a.orthographic.zoom=o.orthographic.zoom),o.perspective?.zoom!==void 0&&(a.perspective.zoom=o.perspective.zoom),o.isUpVectorFlipped!==void 0&&(a.isUpVectorFlipped=o.isUpVectorFlipped),o.targetOffset!==void 0&&(a.targetOffset=o.targetOffset)}else if(r.type==="Mesh")"geometry"in s&&Object.assign(a,{geometry:PA.merge(a.geometry,s.geometry)}),(s.material||s.materials)&&(a=function(o,l){if(l===void 0)return o;let c={...o};return"material"in c&&"material"in l&&l.material&&(c.material=j_(c.material,h=>{if(typeof h!="string")for(let[d,u]of Object.entries(l.material.layers)){let p=h.layers.data(d);p&&tn.patch(p,u)}}).data),c.materials&&l.materials&&(c.materials=j_(c.materials,h=>{for(let d=0;d<c.materials.length;d++){let u=l.materials[d];if(typeof u!="string")for(let[p,f]of Object.entries(u.layers)){let g=h[d]?.layers?.data(p);g&&tn.patch(g,f)}}}).data),c}(a,s)),a.cloner&&"cloner"in s&&Object.assign(a,{cloner:eh.merge(a.cloner,s.cloner)});else if(r.type==="Empty")a.cloner&&"cloner"in s&&Object.assign(a,{cloner:eh.merge(a.cloner,s.cloner)});else if(MA.is(r.type)){let o=s;o.intensity!==void 0&&(a.intensity=o.intensity),o.color!==void 0&&(typeof o.color=="string"?a.color=o.color:a.color=Tn.clone(o.color))}return a}})(ih||(ih={}))}),r3=z(()=>{(ob||(ob={})).defaultData={enablePan:!0,enableZoom:!0,enableRotate:!0,enableDamping:!0,rotationLimitsMode:0,rotationVerticalOffset:{min:Math.PI/4,max:Math.PI/4},rotationHorizontalOffset:{min:Math.PI/4,max:Math.PI/4},rotationSoftLimit:2,rotationSpeed:1,panLimitsMode:0,panVerticalOffset:{min:250,max:250},panHorizontalOffset:{min:250,max:250},panSoftLimit:2,zoomLimitsEnabled:!1,zoomLimits:{min:.1,max:2},autoRotate:!1,autoRotateSpeed:2,autoRotateClockwise:!0,hoverRotatePanMode:0,hoverRotatePanStrength:20,hoverRotateDamping:.125,isTouchZoom:!0,orbitTouches:2,panTouches:3,resetHoverEffectOnPointerLeave:!0}}),dx=z(()=>{r3(),bs(),(rl||(rl={})).defaultData={orbitControls:ob.defaultData,playPage:Yu,withBackground:!0,preventScroll:!1,preventTouchScroll:!1,hideCursor:!1,mouseEventTarget:"canvas",joystickSizeAndXYOffset:Array(12).fill(0).map((t,e)=>{let i=0,n=0;return e<5?n=-30:e<10&&(n=30),e===0||e===10||e===5?i=30:(e===4||e===11||e===9)&&(i=-30),[120,[i,n],"show"]}),settings:{image:{format:"jpg",ratio:1,colorSpace:"display-p3"},videoStatic:{fps:60,mbps:150,ratio:1,duration:1e3,format:"mp4",imageFormat:"jpg",activeTimeline:null,colorSpace:"display-p3"},web:{logo:!0,compress:!0,preset:1,preload:!0,hint:!1,imageQuality:70,pixelRatioMobile:0,pixelRatioDesktop:0}},stopRaycast:!0,hdTransmission:!1,renderer:"webgpu",asyncShaderCompilation:!0}}),UN=z(()=>{var t;(BS||(BS={})).defaultData={id:"basic",label:"Basic",style:"None",prompt:""},(US||(US={})).defaultData={weather:0,shadows:0,lightOrigin:0,temperature:0,sun:0,camera:0,environment:0,particles:0,nature:0,floor:0},(t=Mc||(Mc={})).defaultData=()=>({mode:"line-art-both",prompt:"",negativePrompt:"",style:{...BS.defaultData},isRandomSeed:!0,seed:t.generateSeed(),guessMode:!1,advanced:!1,steps:20,guidanceScale:7.5,controlNetScale:1,modifiers:US.defaultData}),t.generateSeed=()=>Math.round(1e5*Math.random())}),s3=z(()=>{cx(),Ye(),dx(),bs(),Dn(),UN(),(t=>{function e(i,n){let r=i.scene.objects.get(n);if(r&&r.data.type==="Component")return r;{let s=i.shared.lib.components[n];if(s)return{...s.asset,id:n}}}t.physicsEnabled=function(i){return i.find(n=>n.data.type==="Page"&&n.data.globalPhysics.usePhysics)!==void 0},t.findTimeline=function(i,n){let r=i.find(s=>s.data.type==="Page"&&s.data.timelines?.[n]!==void 0);return r&&r.data.timelines?.[n]},t.getComponentData=e,t.traverseModuleInstances=function(i,n,r){i.scene.objects.traverseFrom(n,(s,a)=>{if(a.type==="Instance"){let o=e(i,a.component)?.data;o&&r(s,a,o.events)}else r(s,a,a.events)})}})($c||($c={})),(t=>{function e(n=!0,r=[]){let s=[];n&&s.push({...t.defaultLight}),s.push(...r);let a=new Xn;return a.push({fi:1,id:Yu,data:{...zc.defaultData,name:"Scene 1"},children:s}),a}function i(n){return{...t.defaultData,objects:Ar(n,Xn.prototype)}}t.TRASH_CAN_ID="830a2708-8ed9-49cf-a68e-085299892222",t.defaultLight={fi:-1,data:sb.defaultDirectionalLightData,id:"830a2708-8ed9-49cf-a68e-085299899103",children:[]},t.createDefaultObjectTreeWithPage=e,t.defaultData={objects:e(),publish:rl.defaultData,styles:Mc.defaultData()},t.emptyDataWithoutPage=function(){return{objects:new Xn,publish:rl.defaultData,styles:Mc.defaultData()}},t.emptyDataWithPage=function(n=!0){return{objects:e(n),publish:rl.defaultData,styles:Mc.defaultData()}},t.emptyData=function(){return{objects:new Xn,publish:{...rl.defaultData},styles:Mc.defaultData()}},t.withObjs=i,t.withObj=function(n,r){return i([{id:n,data:r,children:[],fi:0}])}})(Ec||(Ec={}))}),zN=z(()=>{(fg||(fg={})).defaultData={preset:"fullscreen",allowResponsive:!1,size:[512,512],coords:[0,0],sceneScale:1,color:{r:0,g:0,b:0,a:.5}}}),a3=z(()=>{var t,e;Ye(),Dn(),(t=IA||(IA={})).defaultData=i=>({url:i,name:"New Webhook",parametersSchemas:new Vt}),t.defaultParameterValueByType=i=>i==="number"?0:i!=="boolean"&&"",(GO||(GO={})).defaultData=(i,n="GET")=>({url:i,method:n,name:"New API",headers:new Vt,queries:new Vt,autoStart:!0}),(i=>{function n(s){return s.textValue!==void 0}function r(s){return typeof s=="boolean"}i.isTextValue=n,i.isNumber=function(s){return typeof s=="number"},i.isBoolean=r,i.typeOfVariable=function(s){return n(s)?"string":r(s)?"boolean":"number"},i.getDisplayedValue=function(s){return i.isTextValue(s)?Array.isArray(s.textValue)?s.textValue.map(a=>a.toString().padStart(s.padding??2,"0")).join(s.deliminator??":")+(s.suffix!==void 0?" "+s.suffix:""):s.textValue.toString():i.isBoolean(s)?s?"True":"False":i.isNumber(s)?parseFloat(s.toFixed(3)).toString():s.toString()}})(br||(br={})),(zS||(zS={})).all=["images","videos","colors","audios","particles","fonts","materials","variables"],(HO||(HO={})).all=[...zS.all,"components"],(WO||(WO={})).defaultData=function(){return{images:new te,videos:new te,colors:new te,audios:new te,particles:new te,fonts:new te,materials:new te,components:new te,variables:new te,userAPIs:new te,userWebhooks:new te}},(Zo||(Zo={})).defaultData=function(){return{images:new te,videos:new te,colors:new te,audios:new te,particles:new te,fonts:new te,materials:new te,components:new te,variables:new te,userAPIs:new te,userWebhooks:new te}},(e=Ns||(Ns={})).defaultColors=function(){return Ar({"89b10010-844c-11ec-a8a3-0242ac120002":{r:.5,g:.5,b:.5,a:1,name:"Default Color"}},te.prototype)},e.defaultImages=function(){return Ar({},te.prototype)},e.emptyData=function(){return{catelogs:new te,materials:new te,images:new te,videos:new te,colors:new te,audios:new te,particles:new te,fonts:new te,variables:new Vt,userAPIs:new te,userWebhooks:new te,lib:Zo.defaultData()}},e.defaultVariables=function(i){switch(i){case"number":return{value:0,name:"Number"};case"boolean":return{value:!1,name:"Boolean"};case"string":return{value:{textValue:"String value"},name:"String"};case"time":{let n=[0,0,0];return{name:"Time",value:{textValue:n,deliminator:":",padding:2,suffix:"AM"},dynamicVariableType:"time",format:"HH:mm:ss",format12h24h:"12ampm",timeZone:null,hasEnd:!1,endValue:{textValue:n,deliminator:":",padding:2,suffix:"AM"},autoStart:!0,repeat:!1}}case"counter":return{name:"Counter",value:0,dynamicVariableType:"counter",updateInterval:1e3,increment:1,autoStart:!0,hasEnd:!0,endValue:60,repeat:!0,randomStart:!1,range:[0,100],decimals:0};case"random":return{name:"Random",value:0,dynamicVariableType:"random",updateInterval:1e3,increment:1,autoStart:!0,isStatic:!1,hasEnd:!0,endValue:60,repeat:!0,min:0,max:100,decimals:0};default:console.error("Unknown variable type",i)}},e.getFormattedTimerTime=function(i,n){if(n.format==="HH:mm:ss"){let r=Math.floor(i/3600),s=Math.floor((i-3600*r)/60);return{textValue:[r,s,Math.round(i-3600*r-60*s)]}}if(n.format==="mm:ss"){let r=Math.floor(i/60);return{textValue:[r,Math.round(i-60*r)]}}return n.format==="number"?Math.round(i):Math.round(1e3*i)/1e3}}),K$=z(()=>{}),FN=z(()=>{var t;Ye(),s3(),zN(),a3(),(t=Ju||(Ju={})).defaultData={schema:132,scene:Ec.defaultData,frames:new te().add("72fc2993-2da3-4b6b-96ac-2879db3a28bd",fg.defaultData),shared:{...Ns.emptyData(),colors:Ns.defaultColors()}},t.createDefaultData=function(){return jg.deserialize(jg.serialize(t.defaultData))},t.emptyDataForImports=function(){return{schema:132,scene:Ec.emptyDataWithPage(),frames:new te().add("72fc2993-2da3-4b6b-96ac-2879db3a28bd",fg.defaultData),shared:{...Ns.emptyData(),colors:Ns.defaultColors(),images:Ns.defaultImages()}}},t.emptyData=function(){return{schema:132,scene:Ec.emptyDataWithPage(),frames:new te().add("72fc2993-2da3-4b6b-96ac-2879db3a28bd",fg.defaultData),shared:Ns.emptyData()}},t.clipboard2dData=function(){return{schema:132,scene:Ec.emptyData(),frames:new te,shared:Ns.emptyData()}},t.withoutLib=function(e){return{...e,shared:{...e.shared,lib:Zo.defaultData()}}},t.getComponentData=function(e,i){return $c.getComponentData(e,i)},t.hasSensitiveData=function(e){let i=Object.values(e.shared.userAPIs);for(let n of i){let r=n.headers;for(let s of r)if(s.data.key.toLowerCase()==="authorization"&&s.data.value!=="")return!0}return!1}}),Q$=z(()=>{(OA||(OA={})).emptyImage={data:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVQYV2NgYAAAAAMAAWgmWQ0AAAAASUVORK5CYII=",name:"empty"}});function Fc(t,e=[0,0]){return[t&&!isNaN(t[0])?t[0]:e[0],t&&!isNaN(t[1])?t[1]:e[1]]}function zf(t,e,i){switch(t){case 0:return"cubicBezier( 0, 0, 1, 1 )";case 1:return"cubicBezier( .25, .1, .25, 1 )";case 2:return"cubicBezier( .42, 0, 1, 1 )";case 3:return"cubicBezier( 0, 0, .58, 1 )";case 4:return"cubicBezier( .42, 0, .58, 1 )";case 7:return"cubicBezier( .25, 1, .5, 1 )";case 5:{let{control1:n,control2:r}=e??{...mp.defaultData};return`cubicBezier( ${n[0]}, ${n[1]}, ${r[0]}, ${r[1]} )`}case 6:{let{mass:n,stiffness:r,damping:s,velocity:a}=i??{...th.defaultData},o=new NN(n,r,s,a),l=o.solve(1);return()=>c=>o.solve(c)/l}case 8:return()=>n=>Math.floor(n)}}var qO,XO,Nc,Wg,NN,lb,hb,kN=z(()=>{Ye(),bs(),(qO||(qO={})).defaultData=function(t,e){return{id:t,name:e,duration:5,objectTimelines:new te}},(XO||(XO={})).is=function(t){return t&&typeof t.x=="number"&&typeof t.y=="number"&&typeof t.z=="number"},(t=>{function e(h,d){let u=[0,0],p=[1,1];if(h?.cubicControls)u=Fc(h.cubicControls.control1,u);else switch(h?.type){case 2:case 4:u=[.42,0];break;case 3:case 0:u=[0,0];break;case 1:u=[.25,.1];break;case 7:u=[.25,1]}if(d?.cubicControls)p=Fc(d.cubicControls.control2,p);else switch(d?.type){case 2:case 0:p=[1,1];break;case 3:case 4:p=[.58,1];break;case 1:p=[.25,1];break;case 7:p=[.5,1]}return{control1:u,control2:p}}function i(h){if(!t.BEZIER_PRESETS.includes(h))return;let d={type:h};return{control1:e(d).control1,control2:e(void 0,d).control2}}function n(h,d){return Math.abs(h[0]-d[0])<.001&&Math.abs(h[1]-d[1])<.001}function r(h){let d=t.ROOT_PROPERTY_ORDER.indexOf(h[0]);return d===-1?t.ROOT_PROPERTY_ORDER.length:d}function s(h){return h.layerId??h.path.join(".")}function a(h){let d=h[h.length-1];return Wg.includes(d)?d:void 0}function o(h){return h.layerId?h.layerId:(a(h.path)?h.path.slice(0,-1):h.path).join(".")}function l(h){return["material",h.type==="light"?`${h.category} lighting`:h.type]}function c(h,d,u){return{id:h,data:{id:h,time:u?.time??0,path:d,value:{},layerId:u?.layerId,index:u?.index,isPlaceholder:!0,easing:{type:5,cubicControls:{control1:[.42,0],control2:[.58,1]}}}}}t.getControlsWithDefault=e,t.BEZIER_PRESETS=[0,1,2,3,4,7],t.presetHandles=i,t.presetForHandles=function(h){return t.BEZIER_PRESETS.find(d=>{let u=i(d);return u!==void 0&&n(u.control1,h.control1)&&n(u.control2,h.control2)})},t.defaultData=function(h){return{id:h,keyframes:new Vt}},t.ROOT_PROPERTY_ORDER=["position","rotation","scale","shape size","material","opacity","camera","light","cloner","path extrusion","path snapping"],t.rowOrder=r,t.propertyKey=s,t.groupKeyframes=function(h,d){let u=new Map;for(let p of h){let f=p.data;if(d?.(f))continue;let g=s(f),m=u.get(g);m||(m={id:g,path:f.path,keyframes:[],layerId:f.layerId,index:f.index},u.set(g,m)),f.isPlaceholder?m.placeholder=p.id:m.keyframes.push(p)}return[...u.values()].sort((p,f)=>{let g=r(p.path)-r(f.path);return g!==0?g:(p.index??0)-(f.index??0)})},t.rowAxis=a,t.drawnRowKey=o,t.drawnRows=function(h){let d=new Map;for(let u of h){let p=a(u.path),f=p?u.path.slice(0,-1):u.path,g=o(u),m=d.get(g);m||(m={id:g,path:f,layerId:u.layerId,index:u.index,tracks:[]},d.set(g,m)),m.tracks.push({axis:p,property:u})}return[...d.values()]},t.sortedKeyframes=function(h){return[...h].sort((d,u)=>d.data.time-u.data.time)},t.materialLayerPath=l,t.createMaterialGroup=function(h,d){return h.map(({data:u,id:p},f)=>c(d(),l(u),{layerId:p,index:f}))},t.placeholderKeyframe=c,t.createName=function(h){return Object.entries(h).reduce((d,[u,p])=>(typeof p!="string"&&d.push({name:p.name}),d),[])},t.Presets=[{name:"Slide in",animationParams:{translateX:{value:[-20,0],easing:zf(3),duration:1e3},opacity:{value:[0,1],easing:zf(3),duration:1e3},endDelay:250,loop:!0}},{name:"Rotate",animationParams:{rotate:{value:[0,"1turn"],easing:zf(5),duration:700},endDelay:250,loop:!0}},{name:"Scale Out",animationParams:{scale:{value:[1,1.5],easing:zf(4),duration:1e3},endDelay:250,loop:!0}},{name:"Jump",animationParams:{translateY:[{value:0,duration:200,easing:"linear"},{value:-20,easing:"linear",duration:200},{value:0,easing:"linear",duration:100}],endDelay:500,loop:!0}},{name:"Jump Rotate",animationParams:{translateY:[{value:0,duration:200,easing:"linear"},{value:-20,easing:"linear",duration:200},{value:0,easing:"linear",duration:100}],rotate:{value:[0,"1turn"],easing:zf(5),duration:500},endDelay:500,loop:!0}},{name:"Bounce",animationParams:{translateY:{value:["20px","-20px"],duration:575,easing:"easeOutQuad"},direction:"alternate",loop:!0}}]})(Nc||(Nc={})),Wg=["x","y","z"],NN=class{constructor(t=1,e=100,i=10,n=0){this.mass=t,this.stiffness=e,this.damping=i,this.initialVelocity=n,this.m_w0=Math.sqrt(e/t),this.m_zeta=i/(2*Math.sqrt(e*t)),this.m_zeta<1?(this.m_wd=this.m_w0*Math.sqrt(1-this.m_zeta*this.m_zeta),this.m_A=1,this.m_B=(this.m_zeta*this.m_w0-n)/this.m_wd):(this.m_wd=0,this.m_A=1,this.m_B=-n+this.m_w0)}solve(t){return 1-(this.m_zeta<1?Math.exp(-t*this.m_zeta*this.m_w0)*(this.m_A*Math.cos(this.m_wd*t)+this.m_B*Math.sin(this.m_wd*t)):(this.m_A+this.m_B*t)*Math.exp(-t*this.m_w0))}getDuration(){let t=.16666666666666666,e=0,i=0;for(;;)if(e+=t,this.solve(e)===1){if(i++,i>=16)break}else i=0;return e*t*1e3}}}),o3=z(()=>{var t;bs(),Ye(),(lb||(lb={})).list=["idle","move","jump","run"],(t=hb||(hb={})).defaultColliderData={type:"capsule",height:200,radius:50,position:[0,0,0],rotation:[0,0,0]},t.defaultDataThirdPerson={moveMode:"walk",forwardDirection:"+z",speedTranslate:1e3,speedRotate:100,runMultiplier:2,rotationMode:"normal",rotBy:"keys",rotByTouch:"drag",delayPos:[.3,.3],delayRot:[.3,.3],keyAssignments:[["moveNegZ","W"],["moveNegX","A"],["movePosZ","S"],["movePosX","D"],["rotPosX","\u25B2"],["rotPosY","\u25C0"],["rotNegX","\u25BC"],["rotNegY","\u25B6"],["jump","Space"],["run","\u21E7"],["none","Ctrl"]],touchControl:!0,joystickPosLoc:5,joystickRotLoc:11,jumpTouchButtonLoc:9,collider:t.defaultColliderData,colliderHelperVisible:!0,collisionEnabled:!0,jumpPower:100,resetYPosition:3e3,alignToGround:!1,autoOrientMove:!0,orientWith:"camera",orientMode:"radial",delayPosCamera:.3,delayRotCamera:.3,camera:"",cameraXAxis:"Limit",cameraYAxis:"Free",cameraRotXLimits:[0,Math.PI/2],cameraRotYLimits:[-Math.PI/2,Math.PI/2],gameActions:{idle:new Vt,move:new Vt,jump:new Vt,run:new Vt},navmesh:{enabled:!1,ch:6,cs:6,walkableClimb:5,walkableHeight:1,walkableRadius:0,zones:"all",objects:[],helperVisible:!0,destinationHelperRadius:0,destinationHelperColor:Je.fromHexAndA(3728051,1)}}});function gc(t,...e){let i={};for(let n of e.flat())t!=null&&n in t&&(i[n]=t[n]);return i}function $O(t){t.layers.forEach(e=>{if(e.type==="depth"&&e.colorA!==void 0){let i=e.colorA,n=e.colorB,r=[[i.r,i.g,i.b,i.a],[n.r,n.g,n.b,n.a]],s=[0,1];for(let o=2;o<10;o++)r.push(r[1]),s.push(1);let a={...gc(un(e),"type","visible","isVector","isWorldSpace","origin","alpha","mode"),near:Math.max(0,e.near),far:Math.max(0,e.far),colors:r,steps:s,num:2,direction:[1,0,0],smooth:!1,gradientType:1};Object.assign(e,a)}else if(e.type==="depth"&&e.gradientType===1&&(e.near<0||e.far<0)){let i={...un(e),near:Math.max(e.near,0),far:Math.max(e.far,0)};Object.assign(e,i)}})}function Go(t,e){Object.values(t.shared.materials).forEach(i=>e(i))}function Ho(t,e){t.scene.objects.traverse((i,n)=>{"materials"in n?n.materials.forEach((r,s)=>{r===void 0&&(n.materials[s]=Vi.defaultTwoLayerData("phong"),r=n.materials[s]),typeof r!="string"&&e(r)}):"material"in n?typeof n.material!="string"&&(n.material===void 0&&(n.material=Vi.defaultTwoLayerData("phong")),e(n.material)):n.type==="Mesh"&&(n.material===void 0&&(n.material=Vi.defaultTwoLayerData("phong")),e(n.material)),"overrides"in n&&Object.values(n.overrides).forEach(r=>{r.material&&typeof r.material!="string"&&Object.getPrototypeOf(r.material)!==$i.prototype&&e(r.material)})})}function YO(t){t.layers===void 0&&Object.assign(t,Vi.defaultTwoLayerData("lambert"))}function FS(t){!t.layers||t.layers.forEach(e=>{if(e.type==="depth"&&e.colors.length===10){let i=[...e.colors];i.push(e.colors[9]);let n=[...e.steps];n.push(e.steps[9]);let r={...un(e),colors:i,steps:n};Object.assign(e,r)}})}function ZO(t){t.scene.objects.traverse((e,i)=>{"materials"in i?i.materials.forEach(n=>{typeof n!="string"&&FS(n)}):"material"in i&&typeof i.material!="string"&&FS(i.material)}),Object.values(t.shared.materials).forEach(e=>FS(e))}function KO(t){t.layers&&t.layers.forEach(e=>{e.type==="depth"&&e.num!==void 0&&(e.colors=e.colors.slice(0,e.num),e.steps=e.steps.slice(0,e.num),delete e.num)})}function QO(t){t.layers&&t.layers.forEach(e=>{(function(i){return i.type!=="displace"})(e)&&e.isMask===void 0&&(e.isMask=!1),(e.type==="texture"||e.type==="video")&&e.blending===void 0&&(e.blending=0),(e.type==="noise"||e.type==="displace"&&e.displacementType==="noise")&&(e.voronoiStyle===void 0&&(e.voronoiStyle=0),e.highCut===void 0&&(e.highCut=1),e.lowCut===void 0&&(e.lowCut=0),e.smoothness===void 0&&(e.smoothness=.3),e.seed===void 0&&(e.seed=0),e.quality===void 0&&(e.quality=1))})}function JO(t){let e=t.layers.find(i=>i.type==="light")?.data;if(e?.category==="basic"){let i=tn.defaultData("light","phong"),n=e;Object.assign(n,i),n.visible=!1}}function t4(t){Go(t,JO),Ho(t,JO)}function e4(t){t.layers.forEach(e=>{e.type==="light"&&e.category!=="toon"&&e.occlusion===void 0&&(e.occlusion=!0)})}function i4(t){t.layers&&t.layers.forEach(e=>{e.type==="light"&&e.bumpMapIntensity===void 0&&(e.bumpMapIntensity=5)})}var J$=z(()=>{r0(),bs(),r3(),cx(),Ye(),dx(),Dn(),tt(),e3(),o3(),UN(),s3(),t3(),n3()}),VN={};function n4(t){t.layers&&t.layers.forEach(e=>{e.type==="light"&&e.alphaOverride===void 0&&(e.alphaOverride=1)})}function jN(t){let e=t.geometry;e!==void 0&&XN.has(e.type)&&e.extrusionVersion===void 0&&(e.extrusionVersion=1)}function r4(t,e){let[i,n,r]=t,s=Math.cos(i),a=Math.sin(i),o=Math.cos(n),l=Math.sin(n),c=Math.cos(r),h=Math.sin(r),d=[o*c,s*h+a*c*l,a*h-s*c*l],u=Math.hypot(e[0],e[1],e[2])||1;return Math.abs((d[0]*e[0]+d[1]*e[1]+d[2]*e[2])/u)}function GN(t){(function(i){i.rotation=i.rotation.slice(0,3).map(n=>n*kl)})(t),t.type==="Page"&&function(i){let n=i.rotation.slice(0,3);(function(r,s){let a=Array.isArray(s)&&s.length>=3&&s.every(c=>typeof c=="number"&&Number.isFinite(c))?s:[0,1,0],o=r4(r,a),l=r4(r.map(c=>c*$N),a);return Math.abs(o-l)<1e-6?r.some(c=>Math.abs(c)>Math.PI):l<o})(n,i.up)?i.rotation=n:i.rotation=n.map(r=>r*kl)}(t.camera),t.states?.forEach(i=>{i.rotation===void 0||i.rotation===null||(i.rotation=i.rotation.slice(0,3).map(n=>n*kl))});let e=t.geometry;e&&e.type==="SphereGeometry"&&(e.thetaLength=(e.thetaLength??180)*kl),e&&e.type==="TorusGeometry"&&(e.arc=e.arc*kl),e&&e.type==="PathGeometry"&&(e.extrusion.angle*=kl,e.extrusion.twist*=kl),t.type==="Mesh"&&t.geometry.type==="TextGeometry"&&(t.geometry.text={textValue:t.geometry.text}),Array.isArray(un(t.events))&&t.events?.forEach(i=>{(i.type==="MouseDown"||i.type==="MouseUp"||i.type==="MousePress"||i.type==="KeyDown"||i.type==="KeyUp"||i.type==="KeyPress"||i.type==="Collision"||i.type==="Trigger")&&(i.runMode=i.toggle?"Toggle":"Repeat")})}function tY(t){t.scene.objects.traverse((e,i)=>{})}function eY(t){let e=t.schema??104;e!==132&&e<130&&(cb(t.asset),t.schema=130)}function Sc(t,e){e(t.data);for(let i of t.children)Sc(i,e)}function HN(t){let e=t.schema??104;e!==132&&(e<105&&(Sc(t.asset,GN),t.schema=105),e<118&&(Sc(t.asset,qN),t.schema=118),e<121&&(Sc(t.asset,BA),t.schema=121),e<130&&(Sc(t.asset,iY),t.schema=130),e<132&&(Sc(t.asset,jN),t.schema=132))}function WN(t,e){Ho(t,e),Go(t,e),Object.values(t.shared.lib.materials).forEach(i=>e(i.asset))}function cb(t){t.layers===void 0&&Object.assign(t,Vi.defaultTwoLayerData("phong"))}function iY(t){"materials"in t?t.materials.forEach(e=>{e!==void 0&&typeof e!="string"&&cb(e)}):"material"in t&&t.material!==void 0&&typeof t.material!="string"&&cb(t.material)}function qN(t){t.timelineAnimations=Ar({},te.prototype)}function nY(t){let e=[];return t?(t.forEach((i,n)=>{let{path:r,keyframes:s}=i.data,a=r[0]==="material"?i.id:void 0;s?.length?s.forEach(({id:o,data:l})=>{e.push({id:o,data:{...l,path:r,layerId:a,index:n}})}):e.push(Nc.placeholderKeyframe(i.id,r,{layerId:a,index:n}))}),e.sort((i,n)=>i.data.time-n.data.time),new Vt(...e.map((i,n)=>({...i,fi:n})))):new Vt}function rY(t){for(let{id:e,data:i}of[...t.unproxy()]){let n=i.path?.[0];if(!n||!YN.includes(n))continue;let r=LA(i.value);if(!r.length)continue;let s=t.data(e);if(!s)continue;let a=i.value,[o,...l]=r;for(let c of l){let h=Ot.generateUUID();t.insertBefore(null,[{id:h,data:{...i,id:h,path:[n,c],value:a[c],easing:sY(i.easing)}}])}s.path=[n,o],s.value=a[o]}}function LA(t){return t===null||typeof t!="object"?[]:Wg.filter(e=>e in t)}function sY(t){let e=t?.cubicControls;return{...t,cubicControls:{control1:[...e?.control1??[0,0]],control2:[...e?.control2??[1,1]]},...t?.springParameters?{springParameters:{...t.springParameters}}:{}}}function aY(t,e){return Math.abs(t[0]-e[0])<1e-6&&Math.abs(t[1]-e[1])<1e-6}function oY(t){let e=function(s){let a=[];for(let o of Nc.groupKeyframes(s)){let l=new Set(o.keyframes.flatMap(h=>LA(h.data.value))),c=l.size?[...l].map(h=>o.keyframes.filter(d=>LA(d.data.value).includes(h))):[o.keyframes];for(let h of c){let d=[...h].sort((u,p)=>u.data.time-p.data.time);for(let u=0;u+1<d.length;u++)a.push({left:d[u],right:d[u+1]})}}return a}([...t.unproxy()]),i=new Map,n=new Set;for(let{left:s,right:a}of e){let o=s.data.easing?.type,l=(o===void 0?void 0:Nc.presetHandles(o))?.control2??(o===5?Fc(a.data.easing?.cubicControls?.control2,[1,1]):void 0);if(!l)continue;let c=i.get(a.id);c?aY(c,l)||n.add(a.id):i.set(a.id,l)}let r=new Map;for(let{id:s,data:a}of t.unproxy()){let o=a.easing?.type,l=o===void 0?void 0:Nc.presetHandles(o);l&&r.set(s,l.control1)}for(let{left:s,right:a}of e)n.has(a.id)&&r.delete(s.id);for(let[s,a]of r){let o=t.data(s);!o?.easing||(o.easing.cubicControls={control1:a,control2:Fc(o.easing.cubicControls?.control2,[1,1])},o.easing.type=5)}for(let{left:s,right:a}of e){if(!r.has(s.id))continue;let o=t.data(a.id),l=i.get(a.id);!o?.easing||!l||(o.easing.cubicControls={control1:Fc(o.easing.cubicControls?.control1,[0,0]),control2:l})}}function s4(t,e){t.scene.objects.traverse((i,n)=>{let r=n;if(r.type==="Page"&&r.timelines)for(let s of Object.values(r.timelines))for(let a of Object.values(s.objectTimelines??{}))e(a.keyframes)})}function BA(t){t.pivot=[0,0,0],t.pivotRotation=[0,0,0]}function lY(t){}function hY(t){let e=t.schema??0;if(e!==132){if(e>132)return void console.error(`This scene was created with a newer version of Spline (file format ${e}, this runtime reads 132). Update @splinetool/runtime to the latest version to load it correctly.`);console.warn("updating from ",e,"to ",132),function(i,n){if(n<1&&(Ho(i,$O),Go(i,$O),i.schema=1),n<2&&(function(r){Object.assign(r.scene.publish,{orbitControls:{...ob.defaultData,...un(r.scene.publish.orbitControls)}})}(i),i.schema=2),n<3&&(function(r){function s(a){if(a.layers){for(let o of Object.values(a.layers))if(o){for(let[l,c]of Object.entries(o))if((hx.includes(l)||typeof c=="boolean")&&delete o[l],l==="texture")for(let[h,d]of Object.entries(c))(QC.includes(h)||typeof d=="boolean")&&delete c[h]}}}r.scene.objects.traverse((a,o)=>{o.states.forEach(l=>{let c=l;c.material?s(c.material):c.materials&&c.materials.forEach(h=>{s(h)})})})}(i),i.schema=3),n<4&&(function(r){r.scene.publish.withBackground=!0}(i),i.schema=4),n<5&&(function(r){r.scene.publish.settings.web={compress:!0,preload:!0,preset:1,logo:!0,hint:!1}}(i),i.schema=5),n<6&&(function(r){r.scene.objects.traverse((s,a)=>{let o=a.cloner;o&&(o.radial.scale=o.radial.scale.map(l=>l+1),o.linear.scale=o.linear.scale.map(l=>l+1))})}(i),i.schema=6),n<7&&(function(r){r.scene.objects.traverse((s,a)=>{let o=a.geometry;o&&(o.type==="DodecahedronGeometry"||o.type==="IcosahedronGeometry")&&(o.detail=Math.round(o.detail))})}(i),i.schema=7),n<8&&(i.schema=8),n<9&&(ZO(i),i.schema=9),n<10&&(function(r){r.scene.objects.traverse((s,a)=>{a.type==="Mesh"&&(a.geometry.type==="BooleanGeometry"||a.geometry.type==="SubdivGeometry")&&(a.geometry.phongAngle=35)})}(i),i.schema=10),n<11&&(function(r){r.scene.environment.ambientLight.softShadows=!1,r.scene.environment.ambientLight.softShadowQuality="low",r.scene.objects.traverse((s,a)=>{(a.type==="DirectionalLight"||a.type==="SpotLight")&&(a.shadowResolution=1024,a.shadowRadius=1,a.depth=1e5)}),r.shared.penumbraSize=new Array(5).fill(.5)}(i),i.schema=11),n<12&&(ZO(i),i.schema=12),n<13&&(function(r){r.shared.audios=Ar({},te.prototype)}(i),i.schema=13),n<14&&(function(r){let s=r.shared.materials;Object.entries(s).forEach(([a,o])=>{if(!o.layers){let l={name:"Untitled Material",layers:[{fi:0,data:{type:"light",category:"phong",alpha:.6,visible:!0,mode:0,specular:{r:.2,g:.2,b:.2},shininess:5},id:"layer1"},{fi:1,data:{type:"color",alpha:1,visible:!0,mode:0,color:{r:.2823529411764706,g:.2823529411764706,b:.30196078431372547}},id:"layer2"}]};Object.assign(s,{[a]:l})}})}(i),i.schema=14),n<15&&(function(r){Object.entries(un(r.shared.images)).filter(s=>s[1].asset===!1).map(s=>s[0]).forEach(s=>{delete r.shared.images[s]}),Object.entries(un(r.shared.audios)).filter(s=>s[1].asset===!1).map(s=>s[0]).forEach(s=>{delete r.shared.audios[s]})}(i),i.schema=15),n<16&&(function(r){r.scene.publish.settings.web.preload=!1}(i),i.schema=16),n<17&&(Ho(i,KO),Go(i,KO),i.schema=17),n<18&&(Ho(i,YO),Go(i,YO),i.schema=18),n<19&&(function(r){Object.assign(r.scene.publish.settings,{video:{...rl.defaultData.settings.video,...un(r.scene.publish.settings.video)}})}(i),i.schema=19),n<20&&(function(r){r.shared.fonts=Ar({},te.prototype)}(i),function(r){let s=[];r.scene.objects.traverse((a,o)=>{let l=o;if(l.type==="TextFrame"){let c=Vi.defaultTwoLayerData("phong"),h=typeof l.color=="string"?r.shared.colors[l.color]:l.color;c.layers[1].data.color={r:h.r,g:h.g,b:h.b},c.layers[1].data.alpha=l.alpha;let d=function(f){return f.replace(".typeface","").replace(/optimer/gi,"open sans").replace("space_mono","space mono").replace(/alma_mono/gi,"varela round").replace(/droid_sans_mono/gi,"noto sans mono").replace(/droid_sans|gentilis|gnomon_(simple|foreground)|helvetiker/gi,"roboto").replace(/droid_serif/gi,"roboto slab").replace("_sans"," sans").replace("crimson_text","crimson text").replace("medium_medium","medium").replace("fatface_fatface","fatface").replace("100hairline","thin").replace("200thin","extralight").replace("300light","light").replace("500medium","medium").replace("600semi","semibold").replace("800heavy","extrabold").replace("900black","black").replace(/bodoni_(11|16|24|36|48|72|96)([^_])/gi,"bodoni_$1_$2").replace(/bodoni_(11|16|24|36|48|72|96)/gi,"bodoni moda").replace(/(thin|hairline)(_regular)?/gi,"100").replace(/(extra|ultra)light(_regular)?/gi,"200").replace(/light(_regular)?/gi,"300").replace(/_book|_normal|_roman/gi,"_regular").replace(/medium(_regular)?/gi,"500").replace(/(semi|demi)bold(_regular)?/gi,"600").replace(/(extra|ultra)bold(_regular)?/gi,"800").replace(/bold(_regular)?/gi,"700").replace(/(black|heavy|fatface)(_regular)?/gi,"900").replace(/([1-9]00)_italic/gi,"$1italic").replace(/regularitalic/gi,"italic").replace(/regularitalic/gi,"italic").split(" ").map(g=>g.charAt(0).toUpperCase()+g.slice(1)).join(" ")}(l.font);r.shared.fonts[d]===void 0&&(r.shared.fonts[d]={name:d});let u={name:l.name,...An.defaultData,...Wa.defaultData,flatShading:!1,wireframe:!1,geometry:{...Yo.defaultData("TextGeometry"),width:l.width,height:l.height,font:d,depth:0,horizontalAlign:l.horizontalAlign,verticalAlign:l.verticalAlign,fontSize:1.40625*l.fontSize,lineHeight:l.lineHeight/1.40625,letterSpacing:l.letterSpacing-1,text:l.text,textTransform:l.textTransform,extrudeBevelSize:0,extrudeBevelSegments:1},material:c,states:un(l.states),events:un(l.events),visible:l.visible,raycastLock:l.raycastLock,position:l.position,rotation:l.rotation,scale:l.scale,hiddenMatrix:l.hiddenMatrix},p=un(r.scene.objects).parent(a);r.scene.objects.insertAfter(p??null,a,[{id:a+"new",data:u,children:[]}]),s.push(a)}}),s.forEach(a=>{r.scene.objects.delete(a)})}(i),i.schema=20),n<21&&(function(r){let s={0:"MouseDown",1:"MouseUp",2:"MouseHover",5:"KeyDown",6:"KeyUp",7:"Start",9:"LookAt",10:"Follow",11:"Scroll",12:"Audio",13:"GameControl"};r.scene.objects.traverse((a,o)=>{o.events.forEach(l=>{if(s[Number(l.type)])if(Object.assign(l,{type:s[Number(l.type)]}),l.type==="Audio"&&"audioEvent"in l&&(Object.assign(l,{playAudio:l.audioEvent}),delete l.audioEvent),l.type==="GameControl")Object.assign(l,{gameActions:{idle:new Vt,move:new Vt,jump:new Vt}});else{let c=new Vt;Object.assign(l,{actions:c}),(l.type==="MouseDown"||l.type==="MouseUp"||l.type==="KeyDown"||l.type==="KeyUp")&&"url"in l&&c.push({fi:0,id:Ot.generateUUID(),data:{type:"Link",url:l.url,delay:0}}),"targets"in l&&(l.targets.forEach((h,d,u)=>{let p={easing:h.easing,duration:h.duration};h.easing===6?Object.assign(p,gc(h,"mass","stiffness","damping","velocity")):h.easing===5&&Object.assign(p,{control1:{...h.control1},control2:{...h.control2}});let f={repeat:h.repeat?-1:0,delay:h.delay,delayDirection:h.delayDirection,direction:h.cycle&&h.rewind?"pingpong-rewind":h.cycle?"pingpong":"normal"},g={state:h.state,...f,...p},m={allowSlerp:!0,type:"Transition",object:h.object,repeat:0,delay:0,delayDirection:void 0,direction:"normal",tweens:new Vt({fi:0,id:Ot.generateUUID(),data:{state:void 0,repeat:0,delay:0,delayDirection:void 0,direction:"normal",duration:0,easing:4}},{fi:1,id:Ot.generateUUID(),data:g})};c.push({fi:u,id:d,data:m})}),delete l.targets)}})})}(i),function(r){r.scene.objects.traverse((s,a)=>{function o(l,c){let h=new Vt,d=[];if(a.events.forEach((u,p,f)=>{if(u.type==="Audio"&&u.trigger===c){let g;d.push(p),u.interaction==="play"?g={...gc(u,"interaction","audio","delay","volume","loop"),triggerAfter:"after"in u?u.after:void 0,toggle:"after"in u?u.toggle:void 0,type:"Audio"}:(u.interaction==="pause"||u.interaction==="stop")&&(g={...gc(u,"interaction","delay","object","playAudio"),type:"Audio"}),g&&h.push({fi:f,id:p,data:g})}}),d.forEach(u=>a.events.delete(u)),h.length){let u=a.events.find(p=>p.type===l)?.data;u?"actions"in u&&u.actions.insertBefore(null,h):a.events.insertBefore(null,[{id:Ot.generateUUID(),data:{type:l,actions:h}}])}}o("Start","start"),o("MouseDown","mouseDown"),o("MouseUp","mouseUp"),o("KeyDown","keyDown"),o("KeyUp","keyUp")})}(i),i.schema=21),n<22&&(t4(i),i.schema=22),n<23&&(function(r){r.scene.objects.traverse((s,a)=>{a.type==="Mesh"&&a.geometry.type==="SubdivGeometry"&&(a.geometry.scaleBaked||(a.geometry.scaleBaked=[1,1,1]))})}(i),i.schema=23),n<24&&(function(r){r.scene.objects.traverse((s,a)=>{(a.type==="Empty"||a.type==="Mesh")&&a.cloner&&!a.cloner.randomnessObject&&!a.cloner.toObject&&!a.cloner.randomness&&(a.cloner={...a.cloner,toObject:{object:"",spreadType:"random",scale:[0,0,0],rotation:[0,0,0],position:[0,0,0],axis:"x",seed:0,count:99,align:"normal"},randomness:!1,randomnessObject:{strength:100,scale:[0,0,0],rotation:[0,0,0],position:[0,0,0],movement:1,seed:0,freqScale:10,noiseType:"perlin"}})})}(i),i.schema=24),(n<25||i.shared.videos===void 0)&&(function(r){r.shared.videos=Ar({},te.prototype)}(i),n<25&&(i.schema=25)),n<26&&(function(r){r.scene.objects.traverse((s,a)=>{let o=r.scene.objects.unproxy().parent(s);if(o){let l=un(r.scene.objects.data(o));l&&l.type==="Mesh"&&l.geometry.type==="BooleanGeometry"&&a.type==="Mesh"&&(a.visible=un(a).booleanExclude!==!0)}})}(i),i.schema=26),n<27&&(function(r){r.scene.objects.traverse((s,a)=>{if(a.type==="Mesh"){let o=a;a.geometry.type==="NonParametricGeometry"?o.material!==void 0&&delete o.material:o.materials!==void 0&&delete o.materials}})}(i),i.schema=27),n<28&&(t4(i),i.schema=28),n<29&&(function(r){function s(o){Object.setPrototypeOf(o,$i.prototype),o.texture&&Object.setPrototypeOf(o.texture,$i.prototype)}function a(o){Object.setPrototypeOf(o,$i.prototype);for(let l in o)s(o[l])}r.scene.objects.traverse((o,l)=>{l.states.forEach(c=>{let h=c;if(h.material){let d=un(h.material).layers;a(d),h.material.layers=d}if(h.materials)for(let d=0;d<h.materials.length;d++){let u=h.materials[d],p=un(u).layers;a(p),u.layers=p}})})}(i),i.schema=29),n<30&&(function(r){r.scene.objects.traverse((s,a)=>{a.type==="Mesh"&&a.geometry.type==="NonParametricGeometry"&&!("material"in a)&&!("materials"in a)&&(a.material=Vi.defaultTwoLayerData("phong"))})}(i),i.schema=30),n<31&&(function(r){r.scene.publish.orbitControls.autoZoom===void 0&&(r.scene.publish.orbitControls.autoZoom=!1),r.scene.objects.traverse((s,a)=>{(a.type==="OrthographicCamera"||a.type==="PerspectiveCamera")&&(a.orthographic.autoZoom===void 0&&(a.orthographic.autoZoom=!1),a.orthographic.autoZoomFrustumSize===void 0&&(a.orthographic.autoZoomFrustumSize=790))})}(i),i.schema=31),n<33&&(function(r){r.scene.objects.traverse((s,a)=>{a.pathSnapping===void 0&&(a.pathSnapping={pathId:null,slide:0,offset:0,orientation:"tangential"}),a.pathSnapping.offset===void 0&&(a.pathSnapping.offset=0)})}(i),i.schema=33),n<34&&(function(r){r.scene.publish.mouseEventTarget===void 0&&(r.scene.publish.mouseEventTarget="canvas"),r.scene.publish.settings.web.hint===void 0&&(r.scene.publish.settings.web.hint=!1)}(i),i.schema=34),n<35&&(function(r){let{video:s}=r.scene.publish.settings;s.format==="gif"&&s.fps>48&&(s.fps=15)}(i),i.schema=35),n<36&&(function(r){r.scene.objects.traverse((s,a)=>{a.events.forEach(o=>{o.type==="GameControl"&&(o.resetYPosition=Math.abs(o.resetYPosition-a.position[1]))})})}(i),i.schema=36),n<37&&(function(r){let s=r.scene.environment.usePhysics;r.scene.objects.traverse((a,o)=>{s&&o.physics===null?o.collision=!1:o.collision="visibility"})}(i),i.schema=37),n<38&&(Ho(i,QO),Go(i,QO),i.schema=38),n<39&&(function(r){r.scene.objects.traverse((s,a)=>{a.events.forEach(o=>{o.type==="GameControl"&&(o.navmesh=hb.defaultDataThirdPerson.navmesh)})})}(i),i.schema=39),n<40&&(function(r){r.scene.styles||(r.scene.styles=Mc.defaultData())}(i),i.schema=40),n<41&&(function(r){r.scene.environment.ambientLight.occlusion===void 0&&(r.scene.environment.ambientLight.occlusion=!1),r.scene.environment.ambientLight.aoFullRes===void 0&&(r.scene.environment.ambientLight.aoFullRes=!1),r.scene.environment.ambientLight.radius===void 0&&(r.scene.environment.ambientLight.radius=256),r.scene.environment.ambientLight.bias===void 0&&(r.scene.environment.ambientLight.bias=.5),r.scene.environment.ambientLight.aoColor===void 0&&(r.scene.environment.ambientLight.aoColor={r:.19607843137254902,g:.19607843137254902,b:.19607843137254902}),Ho(r,e4),Go(r,e4)}(i),i.schema=41),n<42&&(function(r){r.scene.objects.traverse((s,a)=>{a.events.forEach(o=>{o.type==="GameControl"&&Object.assign(o.gameActions,{run:new Vt})})})}(i),i.schema=42),n<43&&(function(r){r.scene.objects.traverse((s,a)=>{a.events.forEach(o=>{o.type==="GameControl"&&(o.keyAssignments=[...o.keyAssignments,["run","\u21E7"],["none","Ctrl"]])})})}(i),i.schema=43),n<99){Ho(i,i4),Go(i,i4),i.scene.publish.playCamera===null&&(i.scene.publish.playCamera=ed);let r=un(i.scene.objects),s=i.scene.objects;i.scene.publish.playPage=Yu,s.insertBefore(null,null,[{id:Yu,data:{...zc.defaultData,backgroundColor:i.scene.backgroundColor,fog:i.scene.fog,postprocessing:i.scene.postprocessing,ao:gc(i.scene.environment.ambientLight,"occlusion","aoFullRes","radius","bias","aoColor"),publish:{playCamera:i.scene.publish.playCamera,gameControlObject:i.scene.publish.gameControlObject},shadow:gc(i.scene.environment.ambientLight,"softShadowQuality"),globalPhysics:{...Qu.defaultData,...gc(i.scene.environment,"usePhysics","gravity")},camera:un(i.scene.ownerCamera)??zc.defaultData.camera,name:"Scene"},children:[]}]);for(let l of r)l.id!==Ec.TRASH_CAN_ID&&s.move(Yu,l.fi,l.id);let a=0,o=0;i.shared.penumbraSize&&i.scene.objects.traverse((l,c)=>{c.type==="DirectionalLight"?(c.penumbraSize=i.shared.penumbraSize[Math.min(a,2)],a+=1):c.type==="SpotLight"&&(c.penumbraSize=i.shared.penumbraSize[3+Math.min(o,1)],o+=1),(c.physics===void 0||c.physics===null)&&c.type!=="Instance"&&(c.physics={},Object.assign(c.physics,Ku.defaultData)),c.physics!==void 0&&c.physics!==null&&(c.physics.enabled=c.collision??"visibility",delete c.collision)}),i.schema=99}}(t,e),e<100&&(t.scene.publish.joystickSizeAndXYOffset===void 0&&(t.scene.publish.joystickSizeAndXYOffset=rl.defaultData.joystickSizeAndXYOffset),t.schema=100),e<101&&(Ho(t,n4),Go(t,n4),t.schema=101),e<102&&(function(i){i.scene.objects.traverse((n,r)=>{let s=r.geometry;s&&s.type==="PathGeometry"&&(s.extrusion.capType="flat",s.extrusion.bevel=50,s.extrusion.bevelSides=6,s.extrusion.shape.type==="Custom"&&(s.extrusion.shape.shapeQuality="low"))})}(t),t.schema=102),e<104&&(t.shared.catelogs=new te,t.shared.lib=Zo.defaultData(),t.schema=104),e<105&&(function(i){i.shared.variables=Ar({},te.prototype)}(t),t.scene.objects.traverse((i,n)=>{GN(n)}),t.schema=105);for(let i of Object.values(t.shared.lib.components))HN(i);e<106&&(function(i){let n=un(i.shared.variables);i.shared.variables=Ar(Object.entries(n??{}).map(([r,s],a)=>({fi:a,id:r,data:s})),Vt.prototype)}(t),t.schema=106),e<107&&(t.shared.lib.variables=Zo.defaultData().variables,t.schema=107),e<109&&(function(i){i.shared.particles=Ar({},te.prototype),i.shared.lib&&(i.shared.lib.particles=Zo.defaultData().particles)}(t),t.schema=109),e<110&&(function(i){i.scene.objects.traverse((n,r)=>{r.type==="Particle"&&typeof r.renderMaterial.size=="number"&&Object.assign(r.renderMaterial,{size:[r.renderMaterial.size,r.renderMaterial.size]})})}(t),t.schema=110),e<111&&(t.scene.objects.traverse((i,n)=>{(function(r){Array.isArray(un(r.events))&&r.events?.forEach(s=>{"disabled"in s||(s.disabled=!1),(s.type==="MouseDown"||s.type==="MouseUp"||s.type==="MousePress")&&(s.mode=s.mode||"Object")})})(n)}),t.schema=111),e<112&&(function(i){i.scene.objects.traverse((n,r)=>{r.type==="Page"&&(r.postprocessing.depthOfField.focusDistance=100,r.postprocessing.depthOfField.focalLength=20,r.postprocessing.depthOfField.bokehScale=5)})}(t),t.schema=112),e<113&&(function(i){i.scene.objects.traverse((n,r)=>{Array.isArray(un(r.events))!==!1&&r.events?.forEach(s=>{let a=s.runMode;s.type==="MouseDown"||s.type==="MouseUp"||s.type==="KeyDown"||s.type==="KeyUp"||s.type==="Collision"||s.type==="Trigger"?s.actions?.forEach(o=>{o.type==="Transition"&&(o.runMode=a??"Repeat"),(o.type==="Animation"&&"runMode"in o||o.type==="SwitchCamera")&&(o.runMode=a==="Toggle"?"Toggle":"Normal")}):s.type==="MouseHover"||s.type==="MousePress"||s.type==="KeyPress"?s.actions?.forEach(o=>{(o.type==="Transition"||o.type==="Animation"&&"runMode"in o||o.type==="SwitchCamera")&&(o.runMode="Toggle")}):s.type==="GameControl"?(delete s.actions,Object.keys(s.gameActions).forEach(o=>{s.gameActions[o]?.forEach(l=>{l.type==="Transition"&&(l.runMode="Repeat"),l.type==="Animation"&&"runMode"in l&&(l.runMode="Normal")})})):s.type==="DragDrop"?(delete s.actions,s.dragDropActions?.drag?.forEach(o=>{(o.type==="Transition"||o.type==="Animation"&&"runMode"in o||o.type==="SwitchCamera")&&(o.runMode="Toggle")}),s.dragDropActions?.drop?.forEach(o=>{(o.type==="Transition"||o.type==="Animation"&&"runMode"in o||o.type==="SwitchCamera")&&(o.runMode="Toggle")})):s.type==="Resize"?(delete s.actions,s.breakpoints?.forEach(o=>{o.actions?.forEach(l=>{(l.type==="Transition"||l.type==="Animation"&&"runMode"in l||l.type==="SwitchCamera")&&(l.runMode="Toggle")})})):s.type==="Start"?s.actions?.forEach(o=>{o.type==="Transition"&&(o.runMode="Once"),(o.type==="Animation"&&"runMode"in o||o.type==="SwitchCamera")&&(o.runMode="Normal")}):s.type==="VariableChange"||s.type==="Scroll"?s.actions?.forEach(o=>{o.type==="Transition"&&(o.runMode="Repeat"),(o.type==="Animation"&&"runMode"in o||o.type==="SwitchCamera")&&(o.runMode="Normal")}):s.type==="Conditional"&&(delete s.actions,s.inActions?.forEach(o=>{o.type==="Transition"&&(o.runMode="Repeat"),(o.type==="Animation"&&"runMode"in o||o.type==="SwitchCamera")&&(o.runMode="Normal")}),s.outActions?.forEach(o=>{o.type==="Transition"&&(o.runMode="Repeat"),(o.type==="Animation"&&"runMode"in o||o.type==="SwitchCamera")&&(o.runMode="Normal")}))})})}(t),t.schema=113),e<114&&(t.scene.publish.settings.web.imageQuality===void 0&&(t.scene.publish.settings.web.imageQuality=70),t.schema=114),e<115&&(function(i){i.shared.userAPIs=Ar({},te.prototype),i.shared.userWebhooks=Ar({},te.prototype),i.shared.lib&&(i.shared.lib.userAPIs=Zo.defaultData().userAPIs,i.shared.lib.userWebhooks=Zo.defaultData().userWebhooks)}(t),t.schema=115),e<116&&(function(i){i.scene.publish.settings.videoStatic===void 0&&(i.scene.publish.settings.videoStatic=rl.defaultData.settings.videoStatic)}(t),t.schema=116),e<117&&(t.scene.publish.settings.web.pixelRatioMobile===void 0&&(t.scene.publish.settings.web.pixelRatioMobile=0),t.scene.publish.settings.web.pixelRatioDesktop===void 0&&(t.scene.publish.settings.web.pixelRatioDesktop=0),t.schema=117),e<118&&(t.shared.timelineAnimations=Ar({},te.prototype),t.scene.objects.traverse((i,n)=>{qN(n)}),t.schema=118),e<119&&(t.scene.publish.settings.videoStatic.format=Ju.defaultData.scene.publish.settings.videoStatic.format,t.scene.publish.settings.videoStatic.imageFormat=Ju.defaultData.scene.publish.settings.videoStatic.imageFormat,t.schema=119),e<120&&(t.scene.publish.settings.image.colorSpace="display-p3",t.scene.publish.settings.videoStatic.colorSpace="display-p3",t.schema=120),e<121&&(t.scene.objects.traverse((i,n)=>{BA(n),n.type==="Page"&&n.camera!==void 0&&BA(n.camera)}),t.schema=121),e<122&&(delete t.scene.publish.settings.video,t.scene.publish.orbitControls.rotationSpeed=Ju.defaultData.scene.publish.orbitControls.rotationSpeed,t.schema=122),e<123&&(t.scene.objects.traverse((i,n)=>{n.type==="Page"&&n.sky===void 0&&(n.sky=ql.defaultData)}),t.schema=123),e<124&&(e>=123&&t.scene.objects.traverse((i,n)=>{let r=n.sky;n.type==="Page"&&r!==void 0&&(typeof r.exposure=="number"&&(r.exposure=Math.round(r.exposure/5e-4*1e4)/1e4),r.lighting===void 0&&(r.lighting=ql.defaultData.lighting))}),t.schema=124),e<125&&(t.scene.objects.traverse((i,n)=>{let r=n.sky;n.type==="Page"&&r!==void 0&&r.lightingIntensity===void 0&&(r.lightingIntensity=ql.defaultData.lightingIntensity)}),t.schema=125),e<126&&(t.scene.objects.traverse((i,n)=>{let r=n.sky;n.type==="Page"&&r!==void 0&&(r.mode===void 0&&(r.mode="physical"),r.hdri===void 0?r.hdri={...ql.defaultData.hdri}:(r.hdri.blur===void 0&&(r.hdri.blur=ql.defaultData.hdri.blur),Array.isArray(r.hdri.rotation)&&(r.hdri.rotation=r.hdri.rotation[1]??0)))}),t.schema=126),e<127&&(t.scene.objects.traverse((i,n)=>{let r=n.sky;n.type==="Page"&&r?.hdri!==void 0&&r.hdri.showBackground===void 0&&(r.hdri.showBackground=!0)}),t.schema=127),e<128&&(t.scene.objects.traverse((i,n)=>{let r=n.sky;n.type==="Page"&&r!==void 0&&r.lightingQuality===void 0&&(r.lightingQuality="full")}),t.schema=128),e<129&&(t.scene.objects.traverse((i,n)=>{if(n.type==="Page"){n.camera===void 0&&(n.camera=zc.defaultData.camera);let r=n.camera;r.far=1e5,r.perspective?r.perspective.near=70:r.perspective={near:70,fov:45,zoom:1}}}),t.schema=129),e<130&&(WN(t,cb),t.schema=130),e<131&&(function(i){i.scene.objects.traverse((n,r)=>{let s=r.states;if(!s)return;let a=r.timelineAnimations,o=[];s.forEach((l,c)=>{(l.isAnimation||a?.[c])&&o.push(c)}),o.forEach(l=>s.delete(l))})}(t),function(i){let n=i.shared,r=n.timelineAnimations;if(!r)return;let s=i.scene.objects,a=s.unproxy().find(o=>o.data.type==="Page")?.id;for(let[o,l]of Object.entries(r)){let c=Ar({},te.prototype),h=0,d=Boolean(l.loop);for(let[f,g]of Object.entries(l.mapping??{})){let m=s.data(f)?.timelineAnimations?.[g];!m||(h=Math.max(h,m.to??0),d=d||Boolean(m.loop),c[f]={id:f,keyframes:nY(m.properties?.unproxy())})}let u=l.page??a,p=u?s.data(u):void 0;p&&p.type==="Page"&&((p.timelines??(p.timelines=Ar({},te.prototype)))[o]={id:o,name:l.name,duration:h||5,...d?{loop:d}:{},objectTimelines:c})}delete n.timelineAnimations,s.traverse((o,l)=>{delete l.timelineAnimations})}(t),s4(t,rY),s4(t,oY),t.schema=131),e<132&&(t.scene.objects.traverse((i,n)=>jN(n)),t.schema=132)}}e0(VN,{updateAllMaterials:()=>WN,updateDocumentSchema:()=>hY,updateLibSchema:()=>lY,updateMaterialSchema:()=>eY,updateObjectStateRec:()=>Sc,updateObjectsSchema:()=>HN,updateTextValues:()=>tY});var XN,kl,$N,YN,a4,Sv,NS,o4,Mv,Ac,Ff,Fd,Ev,kS,C1,VS,jS,l4,P1,GS,kc,UA,ux=z(()=>{tt(),FN(),Ye(),kN(),J$(),dx(),r0(),Dn(),a3(),cx(),i3(),XN=new Set(["RectangleGeometry","EllipseGeometry","StarGeometry","PolygonGeometry","TriangleGeometry","VectorGeometry","TextGeometry","InputGeometry","PathGeometry"]),kl=180/Math.PI,$N=Math.PI/180,YN=["position","rotation","scale","shape size"]}),cY=z(()=>{var t,e,i;bs(),Ye(),Dn(),(a4||(a4={})).is=function(n){return!0},(t=Sv||(Sv={})).defaultData={position:[0,0],scale:[1,1],rotation:0,shear:[0,0]},t.merge=function(n,r){return{position:r?.position??n.position,rotation:r?.rotation??n.rotation,scale:r?.scale??n.scale,shear:r?.shear??n.shear}},t.diff=function(n,r){return eN({position:to.isEqual(n.position,r.position)?void 0:r.position,rotation:n.rotation===r.rotation?void 0:r.rotation,scale:to.isEqual(n.scale,r.scale)?void 0:r.scale,shear:n.shear&&r.shear&&to.isEqual(n.shear,r.shear)?void 0:r.shear})},(NS||(NS={})).defaultData={horizontalConstraint:0,verticalConstraint:0},(o4||(o4={})).defaultData={direction:"row",wrap:"unwrap",align:"top-left",gap:10,rowGap:10,autoGap:!1,autoRowGap:!1,leftPadding:8,rightPadding:8,topPadding:8,bottomPadding:8},(Mv||(Mv={})).defaultData={opacity:1,fill:{color:Je.fromHexAndA(Ir,1),enabled:!0},stroke:{color:Je.from0to1([0,0,0,1]),thickness:1,enabled:!1,mode:"inside"},layerBlur:{radius:2,enabled:!1},backgroundBlur:{radius:2,enabled:!1},dropShadow:{offset:[10,10],blurRadius:10,color:Je.from0to1([0,0,0,1]),enabled:!1,spread:0},innerShadow:{offset:[10,10],blurRadius:10,color:Je.from0to1([0,0,0,1]),enabled:!1,spread:0}},(e=Ac||(Ac={})).newEmpty=function(n,r){return{name:r}},e.patch=function(n,r){if(r===void 0)return n;let s={...n};return Object.assign(s,Sv.merge(s,r)),s=function(a,o){if(o===void 0)return a;let l={...a},c=["width","height","cornerRadius"];for(let h of c)h in l&&h in o&&o[h]!==void 0&&Object.assign(l,{[h]:o[h]});return l}(s,r),s=function(a,o){if(o===void 0)return a;let l={...a};return"fill"in l&&"fill"in o&&o.fill!==void 0&&Object.assign(l,{fill:{...l.fill,...o.fill}}),"stroke"in l&&"stroke"in o&&o.stroke!==void 0&&Object.assign(l,{stroke:{...l.stroke,...o.stroke}}),"layerBlur"in l&&"layerBlur"in o&&o.layerBlur!==void 0&&Object.assign(l,{layerBlur:{...l.layerBlur,...o.layerBlur}}),"backgroundBlur"in l&&"backgroundBlur"in o&&o.backgroundBlur!==void 0&&Object.assign(l,{backgroundBlur:{...l.backgroundBlur,...o.backgroundBlur}}),"dropShadow"in l&&"dropShadow"in o&&o.dropShadow!==void 0&&Object.assign(l,{dropShadow:{...l.dropShadow,...o.dropShadow}}),"innerShadow"in l&&"innerShadow"in o&&o.innerShadow!==void 0&&Object.assign(l,{innerShadow:{...l.innerShadow,...o.innerShadow}}),l}(s,r),s},e.toOps=function(n,r){let s,a=[];for(let[o,l]of Object.entries(r))o!=="name"&&(s===void 0&&(s={path:[],props:{},type:0},a.push(s)),s.props[o]=l);return a},(Ff||(Ff={})).defaultData={...Sv.defaultData,...NS.defaultData,states:new Vt,events:new Vt,visible:!0,raycastLock:!1},(Fd||(Fd={})).defaultData={...Ff.defaultData,...Mv.defaultData},(Ev||(Ev={})).defaultData={cornerRadius:[0,0,0,0]},(kS||(kS={})).defaultData={...Fd.defaultData,type:"ellipse2d",width:100,height:100,name:"Ellipse"},(C1||(C1={})).defaultData={...Fd.defaultData,...Ev.defaultData,type:"rectangle2d",width:100,height:100,name:"Rectangle"},(VS||(VS={})).defaultData={...Fd.defaultData,type:"text2d",width:100,height:100,fontSize:12,lineHeight:1.2,letterSpacing:0,text:{textValue:"Hello world"},horizontalAlign:1,verticalAlign:1,textTransform:1,font:"Roboto_regular",name:"Text"},(jS||(jS={})).defaultData={...Fd.defaultData,type:"path2d",path:"",name:"Path"},(l4||(l4={})).is=function(n){return n.type==="ellipse2d"||n.type==="rectangle2d"||n.type==="text2d"||n.type==="vector2d"||n.type==="path2d"},(P1||(P1={})).defaultData={...Ff.defaultData,name:"Group",type:"group2d"},(GS||(GS={})).defaultData=()=>({...Ff.defaultData,...Ev.defaultData,...Mv.defaultData,name:"Frame",type:"frame2d",clipped:!0,width:200,height:200,fill:{color:Je.fromHexAndA(4737101,1),enabled:!0},stroke:{color:Je.fromHexAndA(0,1),thickness:1,enabled:!1,mode:"inside"},backgroundBlur:{radius:2,enabled:!1},layerBlur:{radius:2,enabled:!1}}),(n=>{n.defaultData=function(r){switch(r){case"rectangle2d":case"vector2d":return{...C1.defaultData};case"ellipse2d":return{...kS.defaultData};case"text2d":return{...VS.defaultData};case"path2d":return{...jS.defaultData};case"frame2d":return{...GS.defaultData()};case"group2d":return{...P1.defaultData}}},n.getPivot=function(r){return"width"in r&&"height"in r?[typeof r.width=="number"?.5*r.width:0,typeof r.height=="number"?.5*r.height:0]:[0,0]},n.isResizeable=function(r){return r.type==="rectangle2d"||r.type==="ellipse2d"||r.type==="text2d"||r.type==="frame2d"},n.isAutoLayoutable=function(r){return r.type==="frame2d"&&r.autoLayout!==void 0},n.hasCorners=function(r){return r.type==="rectangle2d"||r.type==="frame2d"}})(kc||(kc={})),(i=UA||(UA={})).defaultData={name:"UI",type:"scene2d",objects:new Xn},i.emptyData=function(){return{type:"scene2d",objects:new Xn}}}),dY=z(()=>{q$(),X$(),EN(),AN(),FN(),xN(),Q$(),RN(),LN(),i3(),ux(),zN(),e3(),t3(),TN(),r0(),DN(),BN(),bs(),dx(),cx(),r3(),ON(),a3(),s3(),Y$(),IN(),o3(),n3(),CN(),PN(),cY()});function Tc(t,e=!1){let i=t[0].index!==null,n=new Set(Object.keys(t[0].attributes)),r=new Set(Object.keys(t[0].morphAttributes)),s={},a={},o=t[0].morphTargetsRelative,l=new jt,c=0;for(let h=0;h<t.length;++h){let d=t[h],u=0;if(i!==(d.index!==null))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+h+". All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them."),null;for(let p in d.attributes){if(!n.has(p))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+h+'. All geometries must have compatible attributes; make sure "'+p+'" attribute exists among all geometries, or in none of them.'),null;s[p]===void 0&&(s[p]=[]),s[p].push(d.attributes[p]),u++}if(u!==n.size)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+h+". Make sure all geometries have the same number of attributes."),null;if(o!==d.morphTargetsRelative)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+h+". .morphTargetsRelative must be consistent throughout all geometries."),null;for(let p in d.morphAttributes){if(!r.has(p))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+h+". .morphAttributes must be consistent throughout all geometries."),null;a[p]===void 0&&(a[p]=[]),a[p].push(d.morphAttributes[p])}if(e){let p;if(i)p=d.index.count;else{if(d.attributes.position===void 0)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+h+". The geometry must have either an index or a position attribute"),null;p=d.attributes.position.count}l.addGroup(c,p,h),c+=p}}if(i){let h=0,d=[];for(let u=0;u<t.length;++u){let p=t[u].index;for(let f=0;f<p.count;++f)d.push(p.getX(f)+h);h+=t[u].attributes.position.count}l.setIndex(d)}for(let h in s){let d=h4(s[h]);if(!d)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+h+" attribute."),null;l.setAttribute(h,d)}for(let h in a){let d=a[h][0].length;if(d!==0){l.morphAttributes=l.morphAttributes||{},l.morphAttributes[h]=[];for(let u=0;u<d;++u){let p=[];for(let g=0;g<a[h].length;++g)p.push(a[h][g][u]);let f=h4(p);if(!f)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+h+" morphAttribute."),null;l.morphAttributes[h].push(f)}}}return l}function h4(t){let e,i,n,r=-1,s=0;for(let c=0;c<t.length;++c){let h=t[c];if(e===void 0&&(e=h.array.constructor),e!==h.array.constructor)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.array must be of consistent array types across matching attributes."),null;if(i===void 0&&(i=h.itemSize),i!==h.itemSize)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes."),null;if(n===void 0&&(n=h.normalized),n!==h.normalized)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes."),null;if(r===-1&&(r=h.gpuType),r!==h.gpuType)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.gpuType must be consistent across matching attributes."),null;s+=h.count*i}let a=new e(s),o=new Ht(a,i,n),l=0;for(let c=0;c<t.length;++c){let h=t[c];if(h.isInterleavedBufferAttribute){let d=l/i;for(let u=0,p=h.count;u<p;u++)for(let f=0;f<i;f++){let g=h.getComponent(u,f);o.setComponent(u+d,f,g)}}else a.set(h.array,l);l+=h.count*i}return r!==void 0&&(o.gpuType=r),o}var s0=z(()=>{tt()});function ZN(t){let e=t.points.length/7,i=new Vt;for(let n=0;n<e;n++){let r=7*n,s=t.points[r+0],a=t.points[r+1],o=t.points[r+2],l=t.points[r+3],c=t.points[r+4],h=t.points[r+5],d=t.points[r+6];i.push({fi:n,id:Ot.generateUUID(),data:{roundness:d,position:[s,a],areControlsDirectionsMirrored:!0,controlPrevious:{position:[o,l]},controlNext:{position:[c,h]}}})}return{points:i,isClosed:t.isClosed,roundness:t.roundness,shapeHoles:t.shapeHoles?.map(n=>ZN(n))??[]}}function KN(t){let{userData:e,uuid:i,...n}=t;if(e===void 0||e.type==="NonParametricGeometry")return function(a){let o,{userData:l,data:c}=a,h=c?.groups,d=c?.attributes??{},u=c?.morphAttributes??{},p=c?.interleavedBuffers,f=c?.arrayBuffers,g=c?.index;d.position!==void 0&&Array.isArray(d.position.array)&&(o=function(v){let y=1/0,_=1/0,b=1/0,x=-1/0,w=-1/0,S=-1/0;for(let E=0;E<v.length;E+=3){let A=v[E],P=v[E+1],C=v[E+2];y=Math.min(y,A),_=Math.min(_,P),b=Math.min(b,C),x=Math.max(x,A),w=Math.max(w,P),S=Math.max(S,C)}return{width:x-y,height:w-_,depth:S-b}}(d.position.array));let m={...l===void 0?{}:l.parameters,data:{attributes:d,morphAttributes:u,interleavedBuffers:p,arrayBuffers:f},...o===void 0?{}:o,type:"NonParametricGeometry"};return g!==void 0&&Object.assign(m.data,{index:g}),h!==void 0&&Object.assign(m.data,{groups:h.map(v=>({...v,materialIndex:v.materialIndex??0}))}),m}(t);if(e.type==="SubdivGeometry"){let a="SubdivGeometry",o=n.data?.attributes;if(o?.positionWASM===void 0){let c=new jt;if(o?.position===void 0||o?.faceMap===void 0)return null;let h=o.position.array,d=o.faceMap.array,u=n.data.index.array;c.setAttribute("position",new Nt(h,3)),c.setIndex(new lh(u,1));let p=function(v,y=1e-4){y=Math.max(y,Number.EPSILON);let _={},b=v.getIndex(),x=v.getAttribute("position"),w=b?b.count:x.count,S=0,E=Object.keys(v.attributes),A={},P={},C=[],R=["getX","getY","getZ","getW"],L=["setX","setY","setZ","setW"];for(let W=0,it=E.length;W<it;W++){let nt=E[W],Y=v.attributes[nt];A[nt]=new Y.constructor(new Y.array.constructor(Y.count*Y.itemSize),Y.itemSize,Y.normalized);let ot=v.morphAttributes[nt];ot&&(P[nt]||(P[nt]=[]),ot.forEach((ht,ft)=>{let pt=new ht.array.constructor(ht.count*ht.itemSize);P[nt][ft]=new ht.constructor(pt,ht.itemSize,ht.normalized)}))}let D=.5*y,F=Math.log10(1/y),V=Math.pow(10,F),U=D*V;for(let W=0;W<w;W++){let it=b?b.getX(W):W,nt="";for(let Y=0,ot=E.length;Y<ot;Y++){let ht=E[Y],ft=v.getAttribute(ht),pt=ft.itemSize;for(let J=0;J<pt;J++)nt+=~~(ft[R[J]](it)*V+U)+","}if(nt in _)C.push(_[nt]);else{for(let Y=0,ot=E.length;Y<ot;Y++){let ht=E[Y],ft=v.getAttribute(ht),pt=v.morphAttributes[ht],J=ft.itemSize,mt=A[ht],N=P[ht];for(let O=0;O<J;O++){let H=R[O],$=L[O];if(mt[$](S,ft[H](it)),pt)for(let B=0,Z=pt.length;B<Z;B++)N[B][$](S,pt[B][H](it))}}_[nt]=S,C.push(S),S++}}let j=v.clone();for(let W in v.attributes){let it=A[W];if(j.setAttribute(W,new it.constructor(it.array.slice(0,S*it.itemSize),it.itemSize,it.normalized)),W in P)for(let nt=0;nt<P[W].length;nt++){let Y=P[W][nt];j.morphAttributes[W][nt]=new Y.constructor(Y.array.slice(0,S*Y.itemSize),Y.itemSize,Y.normalized)}}return j.setIndex(C),j}(c),f=[],g=new Array(d[d.length-1]+1).fill(3),m=p.getIndex().array;for(let v=0,y=d.length;v<y;)d[v]===d[v+1]?(g[d[v]]++,f.push(...new Set(m.slice(3*v,3*v+6))),v+=2):(f.push(...m.slice(3*v,3*v+3)),v++);o.indexWASM={array:f},o.positionWASM=p.attributes.position,o.verticesPerFaceWASM={array:g}}if(o?.positionWASM===void 0||o?.positionWASM.length===0||o?.indexWASM===void 0||o?.indexWASM.length===0||o?.verticesPerFaceWASM===void 0||o?.verticesPerFaceWASM.length===0)return null;let l={type:a,...uY(o.positionWASM.array)};l.subdivisions=e.parameters.subdivisions;for(let c in o)c==="positionWASM"?l[c]=new Float32Array(o[c].array):c==="indexWASM"?l[c]=new Int32Array(o[c].array):c==="verticesPerFaceWASM"&&(l[c]=new Int8Array(o[c].array));return l.scaleBaked=[1,1,1],l}let r=e.type,s=e.parameters;return r==="VectorGeometry"?(s.extrudeDepth&&(s.depth=s.extrudeDepth),{...s,width:100,height:100,shape:ZN(e.shape),type:r}):r==="LatheGeometry"?{...e.parameters,type:r,points:(e?.parameters.points??[]).map(a=>[a.x,a.y])}:(s.extrudeDepth&&(s.depth=s.extrudeDepth),{...s,type:r})}function uY(t){return zA.setFromArray(t),zA.getSize(Fm),{width:Fm.x,height:Fm.y,depth:Fm.z}}var zA,Fm,HS,pY=z(()=>{Ye(),tt(),s0(),new At,new Wt,new xi,new T,new T,zA=new ci,Fm=new T}),fY=z(()=>{var t;(t=HS||{}).view="view",t.edit="edit",((HS=t)||(HS={})).canWrite=function(e){return e!=="view"},class extends Error{constructor(e,i){super(`This is a ${e.toUpperCase()} document, but it was opened as a ${i.toUpperCase()} one`),this.actual=e,this.expected=i,this.name="DocumentKindMismatchError"}}}),QN,ol,mg,JN,tk,Sp,Nf,Av,WS,Mp,c4,qS,d4,XS,gp,Tl,Cl,Co,$S,u4,p4,YS,FA,sl,ek=z(()=>{fY()}),mY=z(()=>{}),gY=z(()=>{Ye(),ux(),ek()}),vY=z(()=>{r0(),[...hx],new Set(QC)}),$t=z(()=>{dY(),mY(),K$(),ux(),gY(),ek(),kN(),vY(),o3(),Ye()}),co=z(()=>{QN=[3,4,8,9],ol=5,mg=3,JN=32,tk=.98}),a0=z(()=>{tt(),Sp=t=>{var e;return(e=class extends t{}).geometryHelper=new va(30,30,30),e}}),o0=z(()=>{tt(),Nf=new Jo,Av=new yr,WS=new At,Mp=(t,e,i,n,r=!1,s=t)=>{let a=e,o=s.matrixWorld;if(a.boundingSphere===null&&a.computeBoundingSphere(),Av.copy(a.boundingSphere),Av.applyMatrix4(o),i.ray.intersectsSphere(Av)===!1||(WS.copy(o).invert(),Nf.copy(i.ray).applyMatrix4(WS),a.boundingBox!==null&&Nf.intersectsBox(a.boundingBox)===!1))return;let l,c,h,d,u,p,f=a.index,g=a.attributes.position,m=a.drawRange;if(r===!1){for(u=Math.max(0,m.start),p=Math.min(f.count,m.start+m.count);u<p;u+=3)if(c=f.getX(u),h=f.getX(u+1),d=f.getX(u+2),l=v(t,i,Nf,g,c,h,d),l)return l.faceIndex=Math.floor(u/3),void n.push(l)}else{let y=a.attributes.position,_=new T,b=new T,x=new T,w=new T,S=2,E=1/((s.scale.x+s.scale.y+s.scale.z)/3),A=E*E;for(let P=Math.max(0,m.start),C=Math.min(y.count,m.start+m.count)-1;P<C;P+=S){if(_.fromBufferAttribute(y,P),b.fromBufferAttribute(y,P+1),Nf.distanceSqToSegment(_,b,w,x)>A)continue;w.applyMatrix4(s.matrixWorld);let R=i.ray.origin.distanceTo(w);R<i.near||R>i.far||n.push({distance:R,point:x.clone().applyMatrix4(s.matrixWorld),object:t})}}function v(y,_,b,x,w,S,E){let A=new T,P=new T,C=new T,R=new T,L=new T;if(A.fromBufferAttribute(x,w),P.fromBufferAttribute(x,S),C.fromBufferAttribute(x,E),b.intersectTriangle(A,P,C,!1,R)===null)return null;L.copy(R),L.applyMatrix4(y.matrixWorld);let D=_.ray.origin.distanceTo(L);return D<_.near||D>_.far?null:{faceIndex:1,distance:D,point:L.clone(),object:y}}}}),px=z(()=>{tt(),a0(),o0(),c4=new T(1,1,1),qS=new T,d4=new T,XS=new Wt,gp=class extends Sp(wF){constructor(t,e=15){super(e),this.object=t,this.dummy=new xp,this.object.updateMatrixWorld(),this.name=`EmptyObjectHelper: ${t.uuid}`,this.matrix=this.dummy.matrixWorld,this.matrixAutoUpdate=!1,this.object.isBone&&(this.visible=!1)}raycast(t,e){Mp(this.object,gp.geometryHelper,t,e,!1,this.dummy)}update(){}updateMatrix(){}updateMatrixWorld(t){this.object.matrixWorld.decompose(qS,XS,d4),this.matrix.compose(qS,XS,c4),super.updateMatrixWorld(t)}updateWorldMatrix(t,e){}}}),yY=z(()=>{tt(),Tl=new T,Cl=new T,Co=new At,$S=[new T(-1,1,1),new T(-1,-1,1),new T(1,-1,1),new T(1,1,1),new T(-1,1,-1),new T(-1,-1,-1),new T(1,-1,-1),new T(1,1,-1)],u4=[[0,3],[1,2],[5,6],[4,7],[0,1],[3,2],[7,6],[4,5],[0,4],[1,5],[2,6],[3,7]],p4=[[0,2],[7,5],[4,1],[3,6],[4,3],[1,6]],YS=(t,e,i)=>{t.updateEntityBoxSize(Tl,Cl),Co.copy(e).multiply(t.matrixWorld),Cl.x===0&&Cl.y===0&&Cl.z===0?i.push(new T(Tl.x,Tl.y,Tl.z).applyMatrix4(Co)):$S.forEach(n=>{i.push(n.clone().multiply(Cl).add(Tl).applyMatrix4(Co))})},FA=class extends ci{constructor(){super(...arguments),this.matrix=new At,this.vertices=[],this.faces=[],this.edges=[],this.centerEdges=[]}copy(t){return super.copy(t),this.matrix.copy(t.matrix),this.vertices=t.vertices.map(e=>e.clone()),this.faces=t.faces.map(e=>e.clone()),this.edges=t.edges.map(e=>e.clone()),this.centerEdges=t.centerEdges.map(e=>e.clone()),this}setFromObjectSize(t,e=!1){t.updateWorldMatrix(!1,e),this.makeEmpty(),this.matrix.copy(t.matrixWorld);let i=new At().copy(t.matrixWorld).invert();return this.expandByObjectSize(t,i,e)}expandByObjectSize(t,e,i=!1){let n=[];if(i===!0){let r=[];t.traverseEntity(s=>{if(s.visible||s.cloner&&s.data.visible){if(!("geometry"in s))return Co.copy(e).multiply(s.matrixWorld),void r.push(new T().applyMatrix4(Co));YS(s,e,n)}}),n.length===0&&n.push(...r)}else YS(t,e,n);return this.setFromPoints(n)}getCenter(t){return(t=super.getCenter(t)).applyMatrix4(this.matrix),t}getPositionToCenter(t){return(t=super.getCenter(t)).applyMatrix4(Co.copy(this.matrix).setPosition(0,0,0)),t}computeVertices(){this.getSize(Cl).multiplyScalar(.5),this.getCenter(Tl),Co.copy(this.matrix).setPosition(Tl),this.vertices=$S.map(t=>t.clone().multiply(Cl).applyMatrix4(Co))}computeEdges(){this.vertices.length>0&&this.computeVertices(),this.edges=u4.map(([t,e])=>new ys(this.vertices[t],this.vertices[e])),this.centerEdges=this.edges.map(t=>t.getCenter(new T))}computeFaces(){this.vertices.length>0&&this.computeVertices(),this.faces=p4.map(([t,e])=>this.vertices[t].clone().add(this.vertices[e]).multiplyScalar(.5))}}}),db=z(()=>{sl={Cloner:null,changeEntityProptotype:()=>{},createEntity:()=>{}}});function gg(t){return t?.isParticleSystem===!0}function Yc(t){return t?.isHairSystem===!0}function ll(t){return t?.isShapeBlendEntity===!0}function fx(t){return t?.isPathObject===!0}function os(t){return t?.isObject2D===!0}function Pr(t){return t?.isUIObject===!0}function zu(t){return t?.isCloner===!0}function Cc(t){return t?.isClone===!0}function D1(t){return t?.isComponentObject===!0}var Bi=z(()=>{});function Si(t){l3.add(t)}function Gn(t,e){let i=`${t}:${e}`;VA.has(i)||VA.add(i)}function ub(t,e){h3.set(t,e)}function ZS(t){return h3.get(t)}function Ep(t,e){c3.set(t,e)}function KS(t){return c3.get(t)}function NA(t,e){d3.set(t,e)}function ik(t){return d3.get(t)}function kA(){return mx}var l3,VA,h3,c3,d3,mx,pb,ke=z(()=>{l3=new Set,VA=new Set,h3=new Map,c3=new Map,d3=new Map,mx=null,pb=null});function nk(t){let e=t.elements;ca.set(e[0],e[1],e[2]),da.set(e[4],e[5],e[6]),$a.set(e[8],e[9],e[10])}function rk(){let t=Math.max(ca.lengthSq(),da.lengthSq(),$a.lengthSq());ca.lengthSq()>Nm*t?gs.copy(ca).normalize():gs.set(1,0,0),vs.crossVectors($a,gs),vs.lengthSq()<=Nm*t&&(vs.copy(da).addScaledVector(gs,-da.dot(gs)),vs.lengthSq()<=Nm*t&&function(e,i){e.set(1,0,0).cross(i),e.lengthSq()<=Nm&&e.set(0,1,0).cross(i),e.normalize()}(vs,gs)),vs.normalize(),Pc.crossVectors(gs,vs)}var ca,da,$a,gs,vs,Pc,sk,Nm,km,Tv,Dc,gx,ak=z(()=>{tt(),ca=new T,da=new T,$a=new T,gs=new T,vs=new T,Pc=new T,sk=new At,Nm=1e-12,km=.01}),l0=z(()=>{tt(),ak(),Tv=new At,(Dc||(Dc={})).is=function(t){return t&&t.__isSPEObject},gx=t=>class extends t{constructor(){super(...arguments),this.previousModelViewMatrix=new At,this.copyPreviousMatrix=!0,this.hiddenMatrix=new At,this.pivotMatrix=new At,this.matrixWorldRigid=new At,this.shearScale=new At,this.shearScaleInv=new At}get __isSPEObject(){return!0}getPhysicsLocalMatrix(e){return!!this.rigidBody?.isDynamic()&&(e.copy(this.matrixWorld),this.hasNonUniformScale&&e.multiply(this.shearScaleInv),this.parent&&e.premultiply(Tv.copy(this.parent.matrixWorld).invert()),e.premultiply(Tv.copy(this.hiddenMatrix).invert()),e.multiply(Tv.copy(this.pivotMatrix).invert()),!0)}isDescendantOf(e){e instanceof _i&&(e=e.uuid);let i=this;for(;i.parent;){if(i.parent.uuid===e)return!0;i=i.parent}return!1}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.parent===null?this.matrixWorld.multiplyMatrices(this.hiddenMatrix,this.matrix):(this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.hiddenMatrix),this.matrixWorld.multiplyMatrices(this.matrixWorld,this.matrix)),this.matrixWorld.multiply(this.pivotMatrix),this.matrixWorldNeedsUpdate=!1,e=!0);for(let i of this.children)i.updateMatrixWorld(e)}updateWorldMatrix(e,i){let n=this.parent;if(e&&n!==null&&n.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.parent===null?this.matrixWorld.multiplyMatrices(this.hiddenMatrix,this.matrix):(this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.hiddenMatrix),this.matrixWorld.multiplyMatrices(this.matrixWorld,this.matrix)),this.matrixWorld.multiply(this.pivotMatrix),i)for(let r of this.children)r.updateWorldMatrix(!1,!0)}traverseChildren(e,i=0){for(let n of this.children)Dc.is(n)&&n.traverseObject(e,i+1)}traverseObject(e,i=0){if(e(this,i)!==!0)for(let n of this.children)Dc.is(n)&&n.traverseObject(e,i+1)}updateMatrixWorldRigid(){this.hasNonUniformScale=function(e,i,n){return nk(e),rk(),i.makeBasis(gs,vs,Pc),n.set(gs.dot(ca),gs.dot(da),gs.dot($a),0,vs.dot(ca),vs.dot(da),vs.dot($a),0,Pc.dot(ca),Pc.dot(da),Pc.dot($a),0,0,0,0,1),function(){let r=ca.length(),s=da.length(),a=$a.length(),o=Math.max(r,s,a);if(o-r>km||o-s>km||o-a>km)return!0;let l=km*o*o;return Math.abs(ca.dot(da))>l||Math.abs(ca.dot($a))>l||Math.abs(da.dot($a))>l}()}(this.matrixWorld,this.matrixWorldRigid,this.shearScale),this.matrixWorldRigid.copyPosition(this.matrixWorld),this.shearScaleInv.copy(this.shearScale).invert()}attach(e,i){this.updateWorldMatrix(!0,!1);let n=new At().copy(this.matrixWorld).invert();return e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),n.multiply(e.parent.matrixWorld)),"hiddenMatrix"in e&&e.hiddenMatrix instanceof At?e.hiddenMatrix.premultiply(n):e.applyMatrix4(n),e.updateWorldMatrix(!1,!1),this.add(e),i!==void 0&&(this.children.pop(),this.children.splice(i,0,e)),this}copy(e,i=!1){return super.copy(e,i),this.hasNonUniformScale=e.hasNonUniformScale,this}onAfterRender(e,i,n,r,s,a){this.copyPreviousMatrix&&this.previousModelViewMatrix.copy(this.modelViewMatrix)}}});function f4(t,e,i){return Xl.subVectors(e,t),qg.subVectors(e,i),Xl.cross(qg).length()<=vg}function ok(t){let e=HA.get(t.points);if(e!==void 0&&e.isClosed===t.isClosed)return e.curve;let i=function(n){let r=n.points,s=[r[0]],a=[new T(...r[0].data.position)];vc.copy(a[0]);for(let v=0;v<r.length-1;v++)Xl.fromArray(r[v].data.position),qg.fromArray(r[v+1].data.position),Tu.subVectors(Xl,vc),Cu.subVectors(Xl,qg),Tu.cross(Cu).length()>vg&&(s.push(r[v]),a.push(new T().copy(Xl)),vc.copy(Xl));let o=r[r.length-1];s.push(o),a.push(new T(...o.data.position));let l=n.isClosed,c=s.length-(l?0:1),h=s.length,d=[],u=[];for(let v=0;v<h;v++){let y=s[v].data;d.push(new T(...y.controlPrevious.position)),u.push(new T(...y.controlNext.position))}let p=[];for(let v=0;v<c;v++){let y=v===h-1?0:v+1;p.push(f4(a[v],u[v],a[y])&&f4(a[v],d[y],a[y]))}let f=[];for(let v=0;v<h;v++){let y=s[v].data,_=a[v],b={position:_,prevDir:void 0,nextDir:void 0,controlPrevious:d[v],controlNext:u[v],tan:void 0,baseRoundness:y.roundness,removedLength:0};if(f.push(b),y.roundness===0||!l&&(v===0||v===h-1))continue;let x=l&&v==0?h-1:v-1,w=l&&v==h-1?0:v+1,S=new T().subVectors(a[x],_).normalize(),E=new T().subVectors(a[w],_).normalize();b.prevDir=S,b.nextDir=E;let A=p[l&&v===0?h-1:v-1],P=p[v];if(A&&P){yc.addVectors(S,E).normalize();let C=vc.crossVectors(yc,S).length()/S.dot(yc);b.tan=C,b.removedLength=y.roundness/C}}for(let v=0;v<c;v++){let y=l&&v===h-1?0:v+1,_=f[v],b=f[y];if(_.removedLength!==0||b.removedLength!==0){let x=_.position.distanceTo(b.position);_.removedLength=Math.min(_.removedLength,x/2),b.removedLength=Math.min(b.removedLength,x/2)}}let g=new Array(2*h).fill(null);for(let v=0;v<c;v++){let y=l&&v===h-1?0:v+1,_=f[v],b=f[y],x=null;if(p[v]){let w=_.position.clone(),S=b.position.clone();(_.removedLength!==0||b.removedLength!==0)&&(_.nextDir&&w.add(vc.copy(_.nextDir).setLength(_.removedLength)),b.prevDir&&S.add(vc.copy(b.prevDir).setLength(b.removedLength))),w.distanceTo(S)>vg&&(x=new ag(w,w.clone().lerp(S,.3),S.clone().lerp(w,.3),S))}else _.position.distanceTo(b.position)>vg&&(x=new ag(_.position,_.controlNext,b.controlPrevious,b.position));g[2*v+1]=x}for(let v=0;v<h;v++){let y=f[v];if(y.removedLength===0)continue;let _=y.position,b=y.prevDir.clone().multiplyScalar(y.removedLength).add(_),x=y.nextDir.clone().multiplyScalar(y.removedLength).add(_),w=y.tan*y.removedLength;yc.addVectors(y.prevDir,y.nextDir).normalize(),Tu.copy(b).lerp(x,.5);let S=b.distanceTo(x)/2;GA.copy(yc).multiplyScalar(Math.sqrt(Math.pow(w,2)-Math.pow(S,2))).add(Tu),R1.copy(yc).multiplyScalar(-w).add(GA);let E=_.distanceTo(R1)/_.distanceTo(Tu);Cu.copy(y.prevDir).multiplyScalar(E*_.distanceTo(b)).add(_),jA.copy(Cu).lerp(R1,2);let A=b.clone().lerp(Cu,4/3),P=x.clone().lerp(jA,4/3);g[2*v]=new ag(b,A,P,x)}let m=new lk;for(let v=0;v<g.length;v++){let y=g[v];y&&m.add(y)}return m}(t);return HA.set(t.points,{isClosed:t.isClosed,curve:i}),i}var lk,vg,Xl,qg,vc,yc,Tu,R1,Cu,jA,GA,HA,Pu,WA,I1,hk,ck,dk,Be,qa,m4,g4,kf,QS,Cv,JS,t2,vx,qA,id,Ya,uk=z(()=>{tt(),lk=class extends BE{constructor(){super()}getPoints(t=12){let e,i=[],n=this.getCurveLengths(),r=n[n.length-1]/n.length;for(let s=0,a=this.curves;s<a.length;s++){let o=a[s],l=s===0?n[s]:n[s]-n[s-1],c=Math.ceil(t*l/r),h=o.getPoints(c);for(let d=0;d<h.length;d++){let u=h[d];e&&e.equals(u)||(i.push(u),e=u)}}return this.autoClose&&i.length>1&&!i[i.length-1].equals(i[0])&&i.push(i[0]),i}},vg=.001,Xl=new T,qg=new T,vc=new T,yc=new T,Tu=new T,R1=new T,Cu=new T,jA=new T,GA=new T,HA=new WeakMap}),_Y=z(()=>{tt(),Pu=new At,WA=new Wt,I1=new Wt,hk=new xi,ck=new T,dk=new T(0,1,0)}),qr=z(()=>{tt(),$t(),yY(),Ye(),db(),Bi(),ke(),l0(),uk(),_Y(),ti(),(Be||(Be={})).is=function(t){return t&&t.__isEntity},qa=t=>Be.is(t),m4={type:"completeState",isfromEntity:!0},g4=["x","y","z"],kf=new T,QS=new T(1,1,1),Cv=new Wt,JS=new xi,t2=new At,vx=t=>class extends gx(t){constructor(){super(...arguments),this.raycastLock=!1,this.scaleLock=!1,this.disposed=!1,this.stateSelection=null,this.destroyedInAction=!1,this.instances=[],this.prevState=null,this.currentState=null,this.currentAnimationAction=null,this.reversibleToState=null,this.transitionState={settled:!0,state:null},this.currentTransitionEvent=null,this.previousAction=null,this._singleBBox=new FA,this._recursiveBBox=new FA,this.singleBBoxNeedsUpdate=!0,this.recursiveBBoxNeedsUpdate=!0,this._needApplyPathSnapping=!0,this.attachedPaths=new Set}get __isEntity(){return!0}entityChildren(e){let i=this.children[e];if(Be.is(i))return i}entityChildrenCount(){let e=this.children.length;for(;e--;)if(Be.is(this.children[e]))return e+1;return 0}get isConcreteEntity(){return typeof this.identity=="string"}get isVirtualEntity(){return typeof this.identity!="string"}get isInstanceRoot(){return this.isConcreteEntity&&this.data.type==="Instance"}nearestInstanceSelfOrParent(){let e=this;for(;e.data.type!=="Instance";){let i=e.parent;if(!Be.is(i))return;e=i}return e}forInstancesRec(e){this.instances.forEach(i=>{i.disposed||e(i),i.forInstancesRec(e)})}super_Entity(e,i){typeof e=="string"&&(this.uuid=e),this.identity=e,this.data=i,this.matrixAutoUpdate=!1,this.dataPatched=this.data}changeSelectedState(e,i,n=!1){if(this.data.states.length!==0||n){for(let r of this.data.states)ih.toOps(this.data,r.data).forEach(s=>{let a=V_.replaceProps(s,this.data);this.dataPatched=this.data,this.updateByPatchedOp(a,this.data,i)});if(e!==null){let r=this.data.states.data(e);r&&(this.dataPatched=ih.patch(this.data,r),ih.toOps(this.data,r).forEach(s=>{this.updateByPatchedOp(s,this.dataPatched,i)}))}n&&this.updateTransformState(this.dataPatched,i),this.stateSelection=e,this.updatePathSnapping(this.dataPatched.pathSnapping)}}get singleBBox(){return this.singleBBoxNeedsUpdate&&(this.singleBBoxNeedsUpdate=!1,this._singleBBox.setFromObjectSize(this,!1),this._singleBBox.computeVertices(),this._singleBBox.computeEdges(),this._singleBBox.computeFaces()),this._singleBBox}get recursiveBBox(){return this.recursiveBBoxNeedsUpdate&&(this.recursiveBBoxNeedsUpdate=!1,this._recursiveBBox.setFromObjectSize(this,!0),this._recursiveBBox.computeVertices(),this._recursiveBBox.computeEdges(),this._recursiveBBox.computeFaces()),this._recursiveBBox}updateEntityBoxSize(e,i){e.setScalar(0),i.setScalar(0)}resetBBoxNeedsUpdateSelf(){this.singleBBoxNeedsUpdate=!0,this.recursiveBBoxNeedsUpdate=!0}resetBBoxNeedsUpdate(){this.resetBBoxNeedsUpdateSelf(),this.traverseAncestors(e=>{qa(e)&&e.resetBBoxNeedsUpdateSelf()}),this.traverseEntity(e=>{e.resetBBoxNeedsUpdateSelf()})}find(e){let i;return this.traverseEntity(n=>{n.uuid===e&&(i=n)}),i}traverseSortNextHelper(){let e=this.parent;if(e){let i=e.children,n=i.indexOf(this)+1;if(Be.is(i[n]))return i[n];if(Be.is(e))return e.traverseSortNextHelper()}}sortNext(){let e=this.children;return this.children.length>0&&Be.is(this.children[0])?e[0]:this.traverseSortNextHelper()}goUp(e){let i=this;for(;e>0&&i!==null;)i=i.parent,e-=1;return i}hasAnccestorOrSelf(e){return this===e||this.hasAnccestor(e)}hasAnccestor(e){let i=this.parent;for(;i;){if(e===i)return!0;i=i.parent}return!1}countToAccestor(e){let i=0,n=this;for(;n!==e;){if(n===null)return-1;n=n.parent,i+=1}return i}forEachEntity(e){for(let i of this.children)qa(i)&&e(i)}traverseEntityAncestors(e){this.traverseAncestors(i=>{Be.is(i)&&e(i)})}traverseConcreteEntity(e,i=0){if(e(this,i)!==!0)for(let n of this.children)qa(n)&&n.isConcreteEntity&&n.traverseEntity(e,i+1)}traverseEntity(e,i=0){if(e(this,i)!==!0)for(let n of this.children)qa(n)&&n.traverseEntity(e,i+1)}traverseVisibleEntity(e){e(this);for(let i of this.children)qa(i)&&i.visible&&i.traverseVisibleEntity(e)}updateMatrix(){super.updateMatrix(),this.cloner&&this.cloner.onObjUpdateMatrix(),this.dispatchEvent({type:"updateMatrix"})}updateMatrixWorld(e){super.updateMatrixWorld(e),this.dispatchEvent({type:"updateMatrixWorld"})}copy(e,i=!1){return super.copy(e,i),this.dataPatched=e.dataPatched,this.raycastLock=e.raycastLock,this.scaleLock=e.scaleLock,this.hiddenMatrix.copy(e.hiddenMatrix),this}hasEntityChild(){return this.children.some(e=>qa(e))}isAncestorOf(e){if(this.uuid===e)return!1;let i=!1;return this.traverseEntity(n=>{n.uuid===e&&(i=!0)}),i}toObjectTransformState(e=[]){return this.updateWorldMatrix(!0,!1),eA({position:this.position.toArray(),rotation:[this.rotation.x*Ot.RAD2DEG,this.rotation.y*Ot.RAD2DEG,this.rotation.z*Ot.RAD2DEG],scale:this.scale.toArray(),hiddenMatrix:this.hiddenMatrix.toArray(),pivot:[0,0,0],pivotRotation:[0,0,0]},e)}getTransformValues(e,i,n){return i[e].map((r,s)=>n?.shared.getVariable(r,[this.uuid,e,g4[s]])??r)}updateTransformState(e,i){let n=!1;if(e.position&&(this.position.fromArray(this.getTransformValues("position",e,i)),n=!0),e.rotation&&(kf.fromArray(this.getTransformValues("rotation",e,i)).multiplyScalar(Ot.DEG2RAD),this.rotation.setFromVector3(kf),n=!0),e.scale&&(this.scale.fromArray(this.getTransformValues("scale",e,i)),n=!0),e.hiddenMatrix!==void 0&&(n=!0,this.hiddenMatrix.fromArray(e.hiddenMatrix??Zu.identity)),e.pivot!==void 0||e.pivotRotation!==void 0){if(n=!0,e.pivot!==void 0&&e.pivotRotation!==void 0)this.pivotMatrix.compose(kf.fromArray(e.pivot).negate(),Cv.setFromEuler(JS.fromArray(e.pivotRotation.map(r=>r*Ot.DEG2RAD))).invert(),QS);else if(e.pivot!==void 0)this.pivotMatrix.setPosition(-e.pivot[0],-e.pivot[1],-e.pivot[2]);else if(e.pivotRotation!==void 0){let r=kf.setFromMatrixPosition(this.pivotMatrix);Cv.setFromEuler(JS.fromArray(e.pivotRotation.map(s=>s*Ot.DEG2RAD))).invert(),this.pivotMatrix.compose(r,Cv,QS)}}return n&&(this.updateMatrix(),this.resetBBoxNeedsUpdate(),this.invalidateClonerTransform(this),this.traverseEntityAncestors(r=>{r.invalidateClonerTransform(this)})),e.position&&e.rotation&&e.scale&&e.hiddenMatrix!==void 0&&this.updateWorldMatrix(!1,!0),n}onVariableUpdate(e=!1){e?this.resetBBoxNeedsUpdate():(this.updateMatrix(),this.resetBBoxNeedsUpdate(),this.invalidateClonerTransform(this),this.traverseEntityAncestors(i=>{i.invalidateClonerTransform(this)}),this.requestRender())}dispose(){this.disposed=!0,this.cloner&&(this.cloner.dispose(),this.cloner=void 0)}disposeChildrenRecursively(){for(let e of this.children)Be.is(e)&&e.disposeRecursively()}disposeRecursively(){this.dispose(),this.children.forEach(e=>{Be.is(e)&&e.disposeRecursively()})}toState(e=[]){return eA({name:this.name,visible:this.visible,raycastLock:this.raycastLock,...this.toObjectTransformState(e)},e)}updateByObjUpdateOp(e,i){e!==void 0&&this.updateByOp({type:0,props:e,path:[]},{...this.data,...e},i,!1)}updateByOp(e,i,n,r){let s=this.data;this.data=i;let a=e,o=ri(e.path,["states","*"]);if(o!==null){if(e.type===0){let[l]=o;if(this?.stateSelection===l){let c={...e.props};if(delete c.name,Object.values(e.props).some(h=>h===void 0)){let h=this.data;if(h!==void 0){let d=jn.zoom(h,e.path.slice(2));if(d)for(let u in e.props)e.props[u]===void 0&&u in d&&(c[u]=d[u])}}a={...e,props:c,path:e.path.slice(2)}}}}else if(e.type===0){let l=this.stateSelection?this.data.states.data(this.stateSelection):void 0;if(l!==void 0){if(e.props.name!==void 0&&l.name){let{name:h,...d}=l;l=d}if(e.props.material!==void 0&&"material"in l){let{material:h,...d}=l;l=d}let c=jn.removeOverridden(e.path,e.props,l);a={...e,props:c}}}if(this.updateByPatchedOpBase(a,ih.patch(this.data,this.stateSelection?this.data.states.data(this.stateSelection):void 0),n),ri(e.path,["overrides"])){let l=[],c=[...e.path];for(l.push(c[1]),c.splice(0,2);c.length>0&&c[0]==="descendants";)l.push(c[1]),c.splice(0,2);if(l[l.length-1]===void 0){if(e.type===0)for(let h of Object.keys(e.props)){l[l.length-1]=h;let d=n.scene.findInstance([this.uuid,...l]);d&&(d.overrideData=e.props[h],d.updateState(ch.apply(d.component.data,d.overrideData),n))}}else{let h=n.scene.findInstance([this.uuid,...l]);if(h){let d=jn.zoom(h.component.data,c);if((e={...e,path:c}).type===0){let u=e.props;if(d)for(let[p,f]of Object.entries(e.props))f===void 0&&(u===e.props&&(u={...e.props}),u[p]=d[p]);e={...e,props:u}}h.overrideData=ab.resolve(i.overrides,l),h.updateByOp(e,er.applySimple(h.data,e),n,!1)}}}else if(this.instances.length>0){let l;if(e.path.length===0&&e.type===0){let c;for(let h of nl.rootOverrideProps)h in e.props&&(c===void 0&&(c={}),c[h]=e.props[h]);c&&(l={...e,props:c})}else for(let c of nl.rootOverrideProps)if(ri(e.path,[c])){l=e;break}l!==void 0&&this.instances.forEach(c=>{if(c.isInstanceRoot){let h=ch.filterOp(c.overrideData,l);h&&c.updateByOp(h,er.applySimple(c.data,h),n,!0)}}),this.instances.forEach(c=>{if(!c.isInstanceRoot){let h=ch.filterOp(c.overrideData,e);if(h){let d;d=s===c.data&&e===h?i:er.applySimple(c.data,h),c.updateByOp(h,d,n,!0)}}})}}updateByPatchedOpBase(e,i,n){if(this.dataPatched=i,e.path.length===0&&e.type===0)e.props.type!==void 0&&!Xc.is(e.props.type)&&sl.changeEntityProptotype(this,i,n);else if(e.path.length===1&&e.path[0]==="geometry"&&e.type===0&&"type"in e.props){sl.changeEntityProptotype(this,i,n);for(let r of this.children)Be.is(r)&&r.updateVisible(n.scene)}this.updateByPatchedOp(e,i,n)}updateByPatchedOp(e,i,n){if(e.path.length===0&&e.type===0?this.updateState(e.props,n):e.type===0&&("resolutionLevel"in e.props||"useChildrenColors"in e.props)&&this.updateState(i,n),e.path[0]==="morphTargetInfluences"&&e.type===0){let r=i.morphTargetInfluences.get(e.path[1])?.data.name;r&&this.updateMorphInfluences(r,n.shared.getVariable(e.props.value,[this.uuid,"morphTargetInfluences",r]))}if(ri(e.path,["pathSnapping"])!==null&&this.updatePathSnapping(i.pathSnapping),ri(e.path,["cloner"])!==null){let r=er.drop(e,1);r.path.length===0&&r.type===0&&r.props.disabled===!0?this.setFromClonerState(null,n):this.cloner?this.cloner.updateState(i.cloner,n):(this.setFromClonerState(i.cloner,n),this.expandCloner(n)),this.updateVisible(n.scene)}}updatePathSnapping(e=this.dataPatched.pathSnapping){this._updatedPathSnapping=e,this._needApplyPathSnapping=!0}get updatedPathSnapping(){return this._updatedPathSnapping}applyPathSnapping(e){if(this._needApplyPathSnapping===!1)return;let i=this._updatedPathSnapping?.pathId??this.dataPatched.pathSnapping.pathId,n=this._updatedPathSnapping?.slide??this.dataPatched.pathSnapping.slide??0,r=this._updatedPathSnapping?.offset??this.dataPatched.pathSnapping.offset??0,s=this._updatedPathSnapping?.orientation??this.dataPatched.pathSnapping.orientation;if(i===null)return;let a=e.find(i);if(!a)return;this._needApplyPathSnapping=!1;let o=a.data;if(o.geometry.path.points.length<=1)return;let l=ok(o.geometry.path),c=function(p){let f=p%1;return f<0?f+1:f===0&&p>0?1:f}(n+r),h=null;try{h=l.curves.length?l.getPointAt(c):null}catch{}if(h===null)return;a.updateMatrixWorld();let d=this.parent?t2.multiplyMatrices(this.parent.matrixWorld,this.hiddenMatrix):t2.copy(this.hiddenMatrix),u=function(p,f,g,m){WA.setFromRotationMatrix(Pu.extractRotation(m));let v=p.clone().applyMatrix4(Pu.copy(m).invert().multiply(g));if(f===null)I1.setFromRotationMatrix(Pu.extractRotation(g));else{let y=f.clone().applyMatrix4(Pu.extractRotation(g));I1.setFromRotationMatrix(Pu.lookAt(ck.set(0,0,0),y,dk))}return{position:v,rotation:new T().setFromEuler(hk.setFromQuaternion(WA.invert().multiply(I1))).multiplyScalar(Ot.RAD2DEG)}}(h,s==="tangential"?l.getTangentAt(c):null,a.matrixWorld,d);this.updateTransformState({position:u.position.toArray(),rotation:u.rotation.toArray()}),this.traverseEntity(p=>{p._cameraType&&p.dispatchEvent(m4)})}updateVisible(e){if(this.visible=this.dataPatched.visible&&(!this.dataPatched.cloner||(this.dataPatched.cloner.disabled??!1)||this.dataPatched.cloner?.hideBase!==!0),!e)return;let i=!1;this.traverseEntity(n=>{if(n.data.type==="Splat")return i=!0,!0}),i&&e.reloadSplats()}updateState_Entity(e,i){e.name!==void 0&&(this.name=e.name),e.raycastLock!==void 0&&(this.raycastLock=e.raycastLock),e.visible!==void 0&&(this.updateVisible(i?.scene),this.resetBBoxNeedsUpdate()),i&&"cloner"in e&&e.cloner!==void 0&&(this.setFromClonerState(e.cloner,i),this.updateVisible(i.scene)),this.updateTransformState(e,i)}get attachedSurfaceCloners(){return this.children.filter(e=>zu(e)&&e.parameters.type==="toObject")}setFromClonerState(e,i){if(!this.disposed)if(e===null||e.disabled)this.cloner&&this.cloner.dispose(),this.cloner=void 0;else if(this.cloner===void 0){if(sl.Cloner===null)return void Gn("cloners","a cloner");this.cloner=new sl.Cloner(this,e),i.scene.addPendingExpandCloner(this)}else this.cloner.updateState(e,i)}expandCloner(e){!this.disposed&&this.cloner&&this.cloner.expandClones(e)}invalidateClonerTransform(e){this.cloner&&this.cloner.invalidateTransform(e)}requestRender(){this.dispatchEvent({type:"requestRender"})}}}),nd=z(()=>{tt(),qr(),(qA||(qA={})).is=t=>"objectHelper"in t,id=(t,e)=>class extends vx(t){constructor(){super(...arguments),this.objectHelper=new e(this),this.gizmos={}}get geometryHelper(){return e.geometryHelper}raycast(i,n){this.objectHelper.raycast(i,n)}showGizmos(){for(let i in this.gizmos){let n=this.gizmos[i];n instanceof Fg&&(n.visible=!0)}}updateEntityBoxSize(i,n){this.objectHelper.visible&&this.geometryHelper instanceof va?(i.setScalar(0),n.set(this.geometryHelper.parameters.width,this.geometryHelper.parameters.height,this.geometryHelper.parameters.height).multiplyScalar(.5)):super.updateEntityBoxSize(i,n)}hideGizmos(){for(let i in this.gizmos){let n=this.gizmos[i];n instanceof Fg&&(n.visible=!1)}}}}),yx=z(()=>{tt(),px(),nd(),Ya=class extends id(xp,gp){constructor(t,e){super(),this.super_Entity(t,e),this.objectHelper.update(),this.data.type==="Empty"&&(this.objectHelper.visible=!1)}updateState(t,e){this.updateState_Entity(t,e),"buffer"in t&&Object.keys(t).length===1&&e.scene.reloadSplats()}}});function Js(t,e,i,n,r,s,a){Vm.set(r,s,a).unproject(n);let o=e[t];if(o!==void 0){let l=i.getAttribute("position");for(let c=0,h=o.length;c<h;c++)l.setXYZ(o[c],Vm.x,Vm.y,Vm.z)}}var Vm,ds,v4,pk,bY=z(()=>{tt(),a0(),o0(),Vm=new T,ds=new Kl,v4=class extends bu{constructor(t){let e=new jt,i=new jo({color:16777215,vertexColors:!0,toneMapped:!1}),n=[],r=[],s={},a=new Jt(15711266),o=new Jt(15711266),l=new Jt(2857471);function c(d,u,p){h(d,p),h(u,p)}function h(d,u){n.push(0,0,0),r.push(u.r,u.g,u.b),s[d]===void 0&&(s[d]=[]),s[d].push(n.length/3-1)}c("n1","n2",a),c("n2","n4",a),c("n4","n3",a),c("n3","n1",a),c("f1","f2",a),c("f2","f4",a),c("f4","f3",a),c("f3","f1",a),c("n1","f1",a),c("n2","f2",a),c("n3","f3",a),c("n4","f4",a),c("p","n1",o),c("p","n2",o),c("p","n3",o),c("p","n4",o),c("u1","u2",l),c("u2","u3",l),c("u3","u1",l),e.setAttribute("position",new Nt(n,3)),e.setAttribute("color",new Nt(r,3)),super(e,i),this.type="CameraHelper",this.camera=t,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=s,this.update()}update(){let t=this.geometry,e=this.pointMap;ds.projectionMatrixInverse.elements=[.5112609807824982,-0,-0,-0,-0,.41421356237309503,-0,-0,-0,-0,-0,-.099999,-0,-0,-1.0000000000000002,.100001];let i=.8;Js("n1",e,t,ds,-1,-1,i),Js("n2",e,t,ds,1,-1,i),Js("n3",e,t,ds,-1,1,i),Js("n4",e,t,ds,1,1,i);let n=i;Js("f1",e,t,ds,-1,-1,n),Js("f2",e,t,ds,1,-1,n),Js("f3",e,t,ds,-1,1,n),Js("f4",e,t,ds,1,1,n);let r=n;Js("u1",e,t,ds,.35,1.1,r),Js("u2",e,t,ds,-.35,1.1,r),Js("u3",e,t,ds,0,1.55,r),t.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}},pk=class extends Sp(v4){constructor(t){super(t),this.object=t,this.name=`CombinedCameraHelper: ${t.uuid}`}updateMatrixWorld(t){super.updateMatrixWorld(t),this.updateTarget()}updateTarget(){let t=this.object.getTarget();this.updateWorldMatrix(!0,!1),this.worldToLocal(t)}raycast(t,e){Mp(this.object,this.geometry,t,e,!0)}}});function y4(t){return 1-Math.pow(1-t,3)}var Qh,Pv,Dv,Rv,Nd,Iv,La,Zi,Ws=z(()=>{tt(),bY(),$t(),nd(),ti(),Qh=new T,Pv=new T,Dv=new Wt,Rv=new T,Nd=new T,Iv=new T,La=class extends id(Kl,pk){constructor(t="",e={...pg.defaultData,name:""}){super(),this._cameraType="OrthographicCamera",this.targetOffset=il.DefaultTargetOffset,this.isUpVectorFlipped=!1,this.angleOffsetFromUp=0,this.wasMovedByUser=!1,this.wasMovedBySwitchCameraAction=!1,this._createdAt=typeof performance<"u"?performance.now():0,this._tickProjectionTransition=()=>{let r=this._projectionTransition;if(r===void 0)return;if(this.disposed)return void this._endProjectionTransition();r.raf=requestAnimationFrame(this._tickProjectionTransition);let s=La.projectionTransitionRequestRender??r.requestRender;this.updateProjectionMatrix(),s?.()},this.super_Entity(t,e),this.previousProjectionMatrix=new At,this.matrixAutoUpdate=!0,this.width=window.innerWidth,this.height=window.innerHeight;let i=this.width,n=this.height;this.orthoCamera=new pp(-.5*i,.5*i,.5*n,-.5*n,-5e4,1e4),this.perspCamera=new qu(45,i/n,50,1e4),this.left=this.orthoCamera.left,this.right=this.orthoCamera.right,this.top=this.orthoCamera.top,this.bottom=this.orthoCamera.bottom,this.far=this.orthoCamera.far,this.view=this.orthoCamera.view,this.aspect=this.perspCamera.aspect,this.focus=this.perspCamera.focus,this.filmGauge=this.perspCamera.filmGauge,this.filmOffset=this.perspCamera.filmOffset,this.objectHelper.update()}static withoutProjectionTransition(t){let e=La.projectionTransitionsEnabled;La.projectionTransitionsEnabled=!1;try{return t()}finally{La.projectionTransitionsEnabled=e}}get isPerspectiveCamera(){return this.cameraType==="PerspectiveCamera"}get isOrthographicCamera(){return!this.isPerspectiveCamera}get cameraType(){return this._cameraType}set fov(t){this.perspCamera.fov=t}get fov(){return this.perspCamera.fov}setNear(t,e){t==="PerspectiveCamera"?this.perspCamera.near=e:this.orthoCamera.near=e}setZoom(t,e){e>=0&&(t==="PerspectiveCamera"?this.perspCamera.zoom=e:this.orthoCamera.zoom=e)}set cameraType(t){t==="PerspectiveCamera"?this.toPerspective():t==="OrthographicCamera"&&this.toOrthographic()}get near(){return this._cameraType==="PerspectiveCamera"?this.perspCamera.near:this.orthoCamera.near}set near(t){this._cameraType==="PerspectiveCamera"?this.perspCamera.near=t:this.orthoCamera.near=t}get zoom(){return this._cameraType==="PerspectiveCamera"?this.perspCamera.zoom:this.orthoCamera.zoom}set zoom(t){t>=0&&(this._cameraType==="PerspectiveCamera"?this.perspCamera.zoom=t:this.orthoCamera.zoom=t)}lookAt(t,e,i){typeof t=="number"&&(t=new T(t,e,i)),super.lookAt(t),this.getWorldPosition(Qh),this.targetOffset=Qh.distanceTo(t)}getTarget(t=new T){return this.getWorldDirection(Pv),this.getWorldPosition(Qh),Pv.multiplyScalar(this.targetOffset),t.copy(Qh).add(Pv),t}getDistanceToTarget(){let t=this.getTarget();return this.getWorldPosition(Qh),Qh.distanceTo(t)}updateUp(){this.getWorldQuaternion(Dv),Rv.set(0,0,1).applyQuaternion(Dv),Nd.copy(_i.DEFAULT_UP),this.isUpVectorFlipped&&Nd.negate(),Nd.applyQuaternion(Dv),Iv.copy(_i.DEFAULT_UP).projectOnPlane(Rv),this.angleOffsetFromUp=Iv.angleTo(Nd),this.angleOffsetFromUp*=Iv.cross(Nd).dot(Rv)>=0?1:-1}updateTransformState(t,e){let i=super.updateTransformState(t,e);return t.isUpVectorFlipped!==void 0&&(this.isUpVectorFlipped=t.isUpVectorFlipped),this.updateUp(),i}getViewFrontToObject(t){let e=t.getWorldPosition(new T),i=t.getWorldDirection(new T).multiplyScalar(this.targetOffset);return{position:e.clone().add(i),target:e}}getViewToTarget(t){let e=this.getWorldDirection(new T).multiplyScalar(this.targetOffset);return{position:t.clone().sub(e),target:t}}getViewToObject(t){let e=new T;return t.getWorldPosition(e),this.getViewToTarget(e)}setViewplaneSize(t,e,i=!1){if(this.aspect=t/e,i){let n=t>e?this.aspect:1,r=t>e?1:this.aspect;this.left=-395*n,this.right=395*n,this.top=1/r*395,this.bottom=1/r*-395}else this.left=.5*-t,this.right=.5*t,this.top=.5*e,this.bottom=.5*-e;this.updateProjectionMatrix()}copyViewPlaneSize(t){this.aspect=t.aspect,this.left=t.left,this.right=t.right,this.top=t.top,this.bottom=t.bottom,this.updateProjectionMatrix()}toOrthographic(){this.orthoCamera.left=this.left,this.orthoCamera.right=this.right,this.orthoCamera.top=this.top,this.orthoCamera.bottom=this.bottom,this.orthoCamera.view=this.view,this.orthoCamera.far=this.far,this.orthoCamera.updateProjectionMatrix(),this.projectionMatrix=this.orthoCamera.projectionMatrix,this.projectionMatrixInverse=this.orthoCamera.projectionMatrixInverse,this._cameraType="OrthographicCamera",this._applyProjectionTransition(),this.objectHelper&&this.objectHelper.update()}toPerspective(){this.perspCamera.aspect=this.aspect,this.perspCamera.fov=this.fov,this.perspCamera.view=this.view,this.perspCamera.far=this.far,this.perspCamera.updateProjectionMatrix(),this.projectionMatrix=this.perspCamera.projectionMatrix,this.projectionMatrixInverse=this.perspCamera.projectionMatrixInverse,this._cameraType="PerspectiveCamera",this._applyProjectionTransition(),this.objectHelper&&this.objectHelper.update()}get isProjectionTransitioning(){return this._projectionTransition!==void 0}get projectionTransitionProgress(){let t=this._projectionTransition;if(t===void 0)return 1;let e=(performance.now()-t.start)/t.duration;return e>=1?1:e<=0?0:y4(e)}get _activeSubCamera(){return this._cameraType==="PerspectiveCamera"?this.perspCamera:this.orthoCamera}_canAnimateProjection(){return La.projectionTransitionsEnabled&&typeof requestAnimationFrame=="function"&&typeof performance<"u"&&performance.now()-this._createdAt>=La.projectionTransitionMinAgeMs}_beginProjectionTransition(t){let e=this._projectionTransition;e===void 0&&(e={from:new At,blend:new At,blendInverse:new At,start:0,duration:La.projectionTransitionDuration,referenceDepth:1,raf:0,requestRender:t},this._projectionTransition=e),e.from.copy(this.projectionMatrix),e.start=performance.now(),e.duration=La.projectionTransitionDuration,e.referenceDepth=Number.isFinite(this.targetOffset)?Math.max(1,this.targetOffset):1,t&&(e.requestRender=t),e.raf!==0&&cancelAnimationFrame(e.raf),e.raf=requestAnimationFrame(this._tickProjectionTransition)}_applyProjectionTransition(){let t=this._projectionTransition;if(t===void 0)return;let e=(performance.now()-t.start)/t.duration;if(e>=1)return void this._endProjectionTransition();let i=y4(e),n=t.from.elements,r=this._activeSubCamera.projectionMatrix.elements,s=t.blend.elements,a=t.referenceDepth,o=Math.max(1e-6,n[15]-n[11]*a),l=i*o/(i*o+(1-i)*Math.max(1e-6,r[15]-r[11]*a));for(let c=0;c<16;c++)s[c]=n[c]+(r[c]-n[c])*l;t.blendInverse.copy(t.blend).invert(),this.projectionMatrix=t.blend,this.projectionMatrixInverse=t.blendInverse}_endProjectionTransition(){let t=this._projectionTransition;if(t===void 0)return;t.raf!==0&&cancelAnimationFrame(t.raf),this._projectionTransition=void 0;let e=this._activeSubCamera;this.projectionMatrix=e.projectionMatrix,this.projectionMatrixInverse=e.projectionMatrixInverse}_syncProjectionTransition(t){let e=t._projectionTransition;if(e===void 0)return void(this._projectionTransition!==void 0&&this._endProjectionTransition());let i=this._projectionTransition;i===void 0?(i={from:new At,blend:new At,blendInverse:new At,start:0,duration:1,referenceDepth:1,raf:0,requestRender:void 0},this._projectionTransition=i):i.raf!==0&&(cancelAnimationFrame(i.raf),i.raf=0),i.requestRender=void 0,i.from.copy(e.from),i.start=e.start,i.duration=e.duration,i.referenceDepth=e.referenceDepth,this._applyProjectionTransition()}setFocalLength(t){this.perspCamera.setFocalLength(t),this.toPerspective()}getFocalLength(){return this.perspCamera.getFocalLength()}getEffectiveFOV(){return this.perspCamera.getEffectiveFOV()}getFilmWidth(){return this.perspCamera.getFilmWidth()}getFilmHeight(){return this.perspCamera.getFilmHeight()}setViewOffset(t,e,i,n,r,s){this._cameraType==="PerspectiveCamera"?this.perspCamera.setViewOffset(t,e,i,n,r,s):this.orthoCamera.setViewOffset(t,e,i,n,r,s),this._applyProjectionTransition()}clearViewOffset(){this._cameraType==="PerspectiveCamera"?(this.perspCamera.clearViewOffset(),this.toPerspective()):(this.orthoCamera.clearViewOffset(),this.toOrthographic())}copyHistory(){this.previousProjectionMatrix&&this.previousProjectionMatrix.copy(this.projectionMatrix)}updateProjectionMatrix(){this._cameraType==="PerspectiveCamera"?this.toPerspective():this._cameraType==="OrthographicCamera"&&this.toOrthographic()}updateMatrixWorld(t){super.updateMatrixWorld(t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(t,e){super.updateWorldMatrix(t,e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}copy(t,e){return super.copy(t,e),this.parent=t.parent,this.orthoCamera.copy(t.orthoCamera),this.perspCamera.copy(t.perspCamera),this.left=t.left,this.right=t.right,this.top=t.top,this.bottom=t.bottom,this.far=t.far,this.view=t.view===null?null:Object.assign({},t.view),this._cameraType=t._cameraType,this.aspect=t.aspect,this.fov=t.fov,this.focus=t.focus,this.filmGauge=t.filmGauge,this.filmOffset=t.filmOffset,this.targetOffset=il.sanitizeTargetOffset(t.targetOffset),this.updateProjectionMatrix(),this._syncProjectionTransition(t),this}toCameraState(t=[]){return eA({type:this.cameraType,far:this.far,orthographic:{near:this.orthoCamera.near,zoom:this.orthoCamera.zoom},perspective:{near:this.perspCamera.near,fov:this.perspCamera.fov,zoom:this.perspCamera.zoom},up:this.up.toArray(),targetOffset:this.targetOffset,isUpVectorFlipped:this.isUpVectorFlipped},t)}updateCameraSubtype(t,e){let i=t==="perspective"?"PerspectiveCamera":"OrthographicCamera";e.zoom!==void 0&&this.setZoom(i,e.zoom),e.near!==void 0&&this.setNear(i,e.near),e.fov!==void 0&&i==="PerspectiveCamera"&&(this.fov=e.fov)}updateState(t,e){this.updateCameraState(t,e)}updateCameraState(t,e){this.updateState_Entity(t,e),t.far!==void 0&&(this.far=t.far),t.orthographic!==void 0&&this.updateCameraSubtype("orthographic",t.orthographic),t.perspective!==void 0&&this.updateCameraSubtype("perspective",t.perspective),t.type!==void 0&&(t.type!==this._cameraType&&this._canAnimateProjection()&&this._beginProjectionTransition(e?.shared.requestRender),this.cameraType=t.type),t.up!==void 0&&this.up.fromArray(t.up.map(i=>typeof i=="number"?i:0)),t.targetOffset!==void 0&&(this.targetOffset=il.sanitizeTargetOffset(t.targetOffset)),t.isUpVectorFlipped!==void 0&&(this.isUpVectorFlipped=t.isUpVectorFlipped),this.updateProjectionMatrix()}updateByPatchedOp(t,e,i){super.updateByPatchedOp(t,e,i),t.path.length===1&&t.type===0&&this.updateCameraSubtype(t.path[0],t.props)}toState(t){return{...super.toState(t),...this.toCameraState(t),type:this.cameraType}}},(Zi=La).projectionTransitionsEnabled=!1,Zi.projectionTransitionDuration=350,Zi.projectionTransitionMinAgeMs=1e3});function fk(t){return t.type==="TorusGeometry"&&t.arc===360}var mk,Ov,XA,Xg=z(()=>{tt(),mk=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i=Object.assign({},e?.parameters??{width:100,revolutions:2,segments:40,pathRadius:10,pathType:0,pathSegments:30,cornerRadius:30,cornerSegments:4},t.parameters),n=Math.abs(i.width),r=Math.abs(i.height??n),s=Math.abs(i.depth??n),a=Math.abs(Math.min(n,s))/2;return{parameters:Object.assign(i,{width:n,height:r,depth:s,radius:a,segments:Math.round(i.segments),pathSegments:Math.round(i.pathSegments),cornerSegments:Math.round(i.cornerSegments)})}}static build(t){let{width:e,height:i,depth:n,radius:r,revolutions:s,segments:a,pathRadius:o,pathType:l,pathSegments:c,cornerRadius:h,cornerSegments:d}=t.parameters,u=new XA(!1,e,i,n,r,s,a,o,l,c,h,d);return Object.assign(u,{userData:{...t,type:"HelixGeometry"}})}},Ov=new lh([0,0,0],1),XA=class extends jt{constructor(t=!0,e=1,i=1,n=1,r=1,s=1,a=1,o=1,l=1,c=1,h=1,d=1){if(super(),s===0)return;let u=t&&s===1;u&&(d=0),h>100&&(h=100),h===0&&(d=0);let p,f,g,m,v,y,_,b,x=()=>new T,w=new T,S=x(),E=x(),A=x(),P=x(),C=x(),R=x(),L=x(),D=x(),F=x(),V=x(),U=x(),j=i-2*o+.001,W=j/s,it=Math.ceil(a*s),nt=it+1,Y=j/it,ot=-j/2,ht=c+1,ft=2*Math.PI/c,pt=Math.PI/2/d,J=Math.min((1-h/100)*o,o-.01),mt=o-J,N=0,O=2*d+2,H=ht*O/2,$=H+ht*nt,B=Math.max(0,ht*(nt+O)),[Z,K,k]=[3,3,2].map(Gt=>Array(B*Gt).fill(0)),st=[],dt=r-o;function bt(Gt,Ft){let _e=Math.PI/2;y=Ft*Y,b=2*Math.PI*(y%W)/W+_e,y+=ot,_=Math.sin(b)*dt,v=Math.cos(b)*dt,t?Gt.set(v,_,y):Gt.set(v,y,_)}bt(w,-1e-10),bt(S,0),P.copy(w),bt(w,1);let ct=w.distanceTo(S),It=u?0:mt+J,St=ct*it+2*It,Dt=J,Mt=St-It;for(let Gt=0;Gt<=it;Gt++){bt(E,Gt),U.subVectors(E,P).normalize(),P.copy(E),F.copy(E).setComponent(+t+1,0).normalize(),V.crossVectors(U,F).normalize();let Ft=Gt===0,_e=Gt===it,be=Ft?3*Math.PI/2:pt,ji=Ft?Dt:Mt,oe=Ft?ht:$,le=Ft?0:B-ht,Pe=U.clone().multiplyScalar(Ft?-mt:mt).add(E),si=U.clone().multiplyScalar(Ft?-1:1).normalize();for(let ze=0;ze<ht;ze++){let Ci=ze*ft;if(C.addVectors(w.copy(F).multiplyScalar(o*Math.cos(Ci)),S.copy(V).multiplyScalar(o*Math.sin(Ci))),R.copy(C).normalize(),Ft||_e){u||(N=le+ze,[0,1,2].forEach(ui=>{Z[3*N+ui]=Pe.getComponent(ui),K[3*N+ui]=si.getComponent(ui)}),k[2*N]=+_e,k[2*N+1]=ze/c),S.copy(R).multiplyScalar(J),A.addVectors(E,S);for(let ui=0;ui<d;ui++){let sn=ui*pt+be;L.addVectors(w.copy(U).multiplyScalar(mt*Math.sin(sn)),S.copy(R).multiplyScalar(mt*Math.cos(sn))),D.copy(L).normalize(),S.addVectors(A,L),L.normalize(),N=oe+ui*ht+ze,[0,1,2].forEach(_n=>{Z[3*N+_n]=S.getComponent(_n),K[3*N+_n]=D.getComponent(_n)});let Qr=+Ft+Math.sin(sn);k[2*N]=(ji+mt*Qr)/St,k[2*N+1]=ze/c}}S.addVectors(E,C),N=H+Gt*ht+ze,[0,1,2].forEach(ui=>{Z[3*N+ui]=S.getComponent(ui),K[3*N+ui]=R.getComponent(ui)}),k[2*N]=(It+Gt*ct)/St,k[2*N+1]=ze/c}}let q=nt+2*d+2,[_t,Pt]=[+u,q-1];for(let Gt=_t;Gt<=Pt-1;Gt++){let Ft=u&&Gt===Pt-1;for(let _e=0;_e<ht-1;_e++)p=Gt*ht+_e,f=p+1,g=(Ft?_e:p)+ht,m=(Ft?_e+1:f)+ht,Gt===0?st.push(f,m,g):Gt===q-2?st.push(p,f,g):st.push(p,f,g,f,m,g)}this.setIndex(st),this.setAttribute("position",new Nt(Z,3)),this.setAttribute("normal",new Nt(K,3)),this.setAttribute("uv",new Nt(k,2))}getClosedTorusIndicesForBooleanOrSubdiv(){let t,e,i,n,r=this.userData.parameters,s=Math.ceil(r.tubularSegments),a=r.radialSegments,o=a+1,l=[];for(let c=1;c<s;c++)for(let h=0;h<a;h++)t=c*o+h,e=t+1,i=t+o,n=e+o,l.push(t,e,i,e,n,i);for(let c=0;c<a;c++)t=s*o+c,e=t+1,i=c+o,n=c+1+o,l.push(t,e,i,e,n,i);return Ov.array=new Uint32Array(l),Ov.count=l.length,Ov}}});function xY(t){return b4||(b4=async function(){let e=t??"https://cdn.spline.design/@splinetool/runtime@2.0.79/build",i=import("./boolean.js"),[n,r]=await Promise.all([i,fetch(`${e}/boolean.wasm`).then(s=>s.arrayBuffer())]);await n.default({module_or_path:r}),$g=n}())}function fb(){if($g===void 0)throw new Error("boolean-wasm is not loaded");return $g}function u3(t){let e=Yg.get(t);if(e===void 0)throw new Error("Unknown csg mesh set handle "+t);return e}function p3(t){return Yg.set(++$A,t),$A}function wY(t,e,i){if($g===void 0)return-1;let{positions:n,indices:r,normals:s}=function(a,o){if(o&&a.userData.positions!==void 0){let p=a.userData,f=[];for(let g=0,m=0;g<p.verticesPerFace.length;g++){let v=p.verticesPerFace[g];for(let y=1;y<v-1;y++)f.push(p.indices[m],p.indices[m+y],p.indices[m+y+1]);m+=v}return{positions:p.positions instanceof Float32Array?p.positions:new Float32Array(p.positions),indices:new Uint32Array(f)}}let l;l=fk(a.userData.parameters)?a.getClosedTorusIndicesForBooleanOrSubdiv():a.getIndex();let c,h=a.getAttribute("position");if(l===null){c=new Uint32Array(h.count);for(let p=0;p<c.length;p++)c[p]=p}else c=l.array instanceof Uint32Array?l.array:new Uint32Array(l.array);let d=a.getAttribute("normal"),u=d!==void 0&&d.itemSize===3&&d.count===h.count&&d.array instanceof Float32Array&&d.isInterleavedBufferAttribute!==!0?d.array:void 0;return{positions:h.array,indices:c,normals:u}}(t,e);return p3(new $g.CsgMesh(n,r,s))}function _4(t,e){let i=fb(),n=vk[e];if(n===void 0)throw new Error("Unknown boolean operation "+e);let r=t.map(u3);if(r.length===1)return i.clone_mesh(r[0]);let s,a=[];if(e===2&&r.length>2){let o=r[0];for(let l=1;l<r.length-1;l++)o=i.boolean_mesh(o,r[l],0),a.push(o);s=i.boolean_mesh(r[r.length-1],o,2)}else if(e===2)s=i.boolean_mesh(r[1],r[0],2);else{let o=r[r.length-1];for(let l=0;l<r.length-1&&(o=i.boolean_mesh(o,r[l],n),a.push(o),o.tri_count()!==0);l++);s=o,a.pop()}for(let o of a)o.free();return s}function e2(t,e){u3(t).transform(new Float32Array(e.elements))}function gk(t){let e=Yg.get(t);e!==void 0&&(e.free(),Yg.delete(t))}var $g,Yg,$A,b4,vk,_x=z(()=>{tt(),Xg(),Yg=new Map,$A=0,vk={0:0,1:1,2:2}});function Jh(t){return t!==null&&"booleanOp"in t}var YA,yk,SY=z(()=>{tt(),qr(),_x(),YA=class extends vx(gi){constructor(){super(...arguments),this.booleanMeshSetAddress=-1,this.booleanWasTransformed=!1,this.booleanMatrixInvOld=new At}updateVisible(t){super.updateVisible(t),this.visible=!Jh(this.parent)&&this.visible,Jh(this.parent)&&this.parent.invalidateDownstreamBooleanData()}onClonerLayoutUpdated(){Jh(this.parent)&&this.invalidateDownstreamBooleanData()}freeBooleanPointer(){this.booleanMeshSetAddress!==-1&&(gk(this.booleanMeshSetAddress),this.booleanMeshSetAddress=-1)}invalidateDownstreamBooleanData(t=!1){return t?this.booleanWasTransformed=!0:this.freeBooleanPointer(),Jh(this.parent)?this.parent.invalidateDownstreamBooleanData():this}invalidateUpstreamBooleanData(){this.freeBooleanPointer();for(let t of this.children)t instanceof YA&&(t.freeBooleanPointer(),Jh(t)&&t.invalidateUpstreamBooleanData())}updateTransformState(t,e){let i=super.updateTransformState(t,e);return i&&Jh(this.parent)&&this.invalidateDownstreamBooleanData(!0),i}onVariableUpdate(t=!1){super.onVariableUpdate(t),Jh(this.parent)&&this.invalidateDownstreamBooleanData(!0)}}}),MY=z(()=>{yk=null});function f3(t,e=0,i=t.count,n,r){let s=1/0,a=1/0,o=1/0,l=-1/0,c=-1/0,h=-1/0;for(let d=e;d<i;d++){let u=t.getX(d),p=t.getY(d),f=t.getZ(d);u<s&&(s=u),p<a&&(a=p),f<o&&(o=f),u>l&&(l=u),p>c&&(c=p),f>h&&(h=f)}jm.min.set(s,a,o),jm.max.set(l,c,h),jm.getCenter(n),jm.getSize(r).multiplyScalar(.5)}var jm,x4,w4,Yi,Kn=z(()=>{tt(),SY(),MY(),jm=new ci,x4=new jt,w4=new Hs,Yi=class extends YA{constructor(t,e){super(x4,w4),this.super_Entity(t,e)}updateState(t,e){this.updateState_Entity(t,e)}raycast(t,e){if(this.raycastDeformed(t,e))return;let i=yk;i===null?super.raycast(t,e):i(this,t,e)}raycastDeformed(t,e){return!1}updateEntityBoxSize(t,e){let i=this.geometry.getAttribute("position");i!==void 0?f3(i,this.geometry.drawRange.start,this.geometry.drawRange.count<1/0?this.geometry.drawRange.count:i.count,t,e):super.updateEntityBoxSize(t,e)}}});function mb(t){return t?.isClassicNodeMaterial===!0}var yn,Zg,_k,bk,yg,xk,wk,Sk,m3=z(()=>{}),_a=z(()=>{tt(),yn=class extends Jt{constructor(t,e,i,n){super(t,e,i),this.isColorA=!0,this.a=n}setRGBA(t,e,i,n){super.setRGB(t,e,i),this.a=n}copy(t){return super.copy(t),this.a="a"in t?t.a:1,this}clone(){return new this.constructor(this.r,this.g,this.b,this.a)}equals(t){return super.equals(t)&&this.a===t.a}setStyle(t,e="srgb"){let i;if(t==="transparent")return this.setRGBA(0,0,0,0),this;if(i=/^((?:rgb|hsl)a?)\(([^)]*)\)/.exec(t)){let n,r=i[1],s=i[2];switch(r){case"rgb":case"rgba":if(n=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return this.a=r==="rgba"?parseFloat(n[4]):1,super.setStyle(t,e);break;case"hsl":case"hsla":if(n=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)%\s*,\s*(\d*\.?\d+)%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return this.a=r==="hsla"?parseFloat(n[4]):1,super.setStyle(t,e)}}return super.setStyle(t,e)}get x(){return this.r}get y(){return this.g}get z(){return this.b}get w(){return this.a}set x(t){this.r=t}set y(t){this.g=t}set z(t){this.b=t}set w(t){this.a=t}}}),Mk=z(()=>{_a(),Zg=class extends yn{}}),EY=z(()=>{_k=class{constructor(t=1e4){this.timeout=t,this.cache=new Map,this.head={data:null,time:0,src:null,next:null,prev:null},this.tail={data:null,time:1/0,src:null,next:null,prev:null},this.hasClean=!1,this.cleanupTimer=null,this.head.next=this.tail,this.tail.prev=this.head}log(...t){}remove(t){let e=this.cache.get(t);e&&(this.dispose(t,e.data),this.cache.delete(t),e.prev.next=e.next,e.next.prev=e.prev,e.next=null,e.prev=null,e.data=null)}scheduleCleanup(){this.hasClean||(this.log("scheduled cleanup"),this.hasClean=!0,this.cleanupTimer=setTimeout(()=>{this.hasClean=!1,this.cleanupTimer=null,this.log("cleaning");let t=Date.now(),e=this.head.next;for(;e.time<t-this.timeout;){this.dispose(e.src,e.data),this.cache.delete(e.src);let i=e;e=e.next,e.prev=this.head,this.head.next=e,i.next=null,i.prev=null,i.data=null}this.head.next!==this.tail?this.scheduleCleanup():this.log("no more cleanup")},this.timeout+1e3))}has(t){return this.cache.get(t)?.data}load(t){let e=Date.now(),i=this.cache.get(t);return i===void 0?(i={data:this.create(t),src:t,time:e,next:null,prev:null},this.cache.set(t,i)):(i.time=e,i.prev.next=i.next,i.next.prev=i.prev),i.prev=this.tail.prev,i.next=this.tail,this.tail.prev.next=i,this.tail.prev=i,this.scheduleCleanup(),i.data}disposeAll(){this.cleanupTimer!==null&&(clearTimeout(this.cleanupTimer),this.cleanupTimer=null),this.hasClean=!1,this.cache.forEach((t,e)=>{this.dispose(e,t.data),t.next=null,t.prev=null,t.data=null}),this.cache.clear(),this.head.next=this.tail,this.tail.prev=this.head}destroy(){this.disposeAll(),this.head=null,this.tail=null}}}),Ek=z(()=>{EY(),bk=class extends _k{create(t){return URL.createObjectURL(new Blob([t]))}dispose(t,e){URL.revokeObjectURL(e)}}}),Ak=z(()=>{xk=class{constructor(t,e){this.data=t,this.cache=e,this.refCount=0}deref(){this.refCount,this.refCount-=1,this.refCount===0&&(this.cache.remove(this),this.dispose())}dispose(){this.refCount}},wk=class{constructor(){this.cache=new Map}remove(t){this.cache.delete(t.data)}load(t){let e=this.cache.get(t);return e===void 0&&(e=this.create(t),this.cache.set(t,e)),e.refCount+=1,e}}}),AY=z(()=>{tt(),Sk=class extends uF{constructor(t){super(t),this.type=$n}parse(t){let e=function(p,f){switch(p){case 1:throw new Error("THREE.HDRLoader: Read Error: "+(f||""));case 2:throw new Error("THREE.HDRLoader: Write Error: "+(f||""));case 3:throw new Error("THREE.HDRLoader: Bad File Format: "+(f||""));default:throw new Error("THREE.HDRLoader: Memory Error: "+(f||""))}},i=function(p,f,g){f=f||1024;let m=p.pos,v=-1,y=0,_="",b=String.fromCharCode.apply(null,new Uint16Array(p.subarray(m,m+128)));for(;0>(v=b.indexOf(`
4173
4173
  `))&&y<f&&m<p.byteLength;)_+=b,y+=b.length,m+=128,b=String.fromCharCode.apply(null,new Uint16Array(p.subarray(m,m+128)));return-1<v&&(g!==!1&&(p.pos+=y+v+1),_+b.slice(0,v))},n=function(p,f,g,m){let v=p[f+3],y=Math.pow(2,v-128)/255;g[m+0]=p[f+0]*y,g[m+1]=p[f+1]*y,g[m+2]=p[f+2]*y,g[m+3]=1},r=function(p,f,g,m){let v=p[f+3],y=Math.pow(2,v-128)/255;g[m+0]=Zl.toHalfFloat(Math.min(p[f+0]*y,65504)),g[m+1]=Zl.toHalfFloat(Math.min(p[f+1]*y,65504)),g[m+2]=Zl.toHalfFloat(Math.min(p[f+2]*y,65504)),g[m+3]=Zl.toHalfFloat(1)},s=new Uint8Array(t);s.pos=0;let a,o,l,c=function(p){let f,g,m=/^#\?(\S+)/,v=/^\s*GAMMA\s*=\s*(\d+(\.\d+)?)\s*$/,y=/^\s*EXPOSURE\s*=\s*(\d+(\.\d+)?)\s*$/,_=/^\s*FORMAT=(\S+)\s*$/,b=/^\s*\-Y\s+(\d+)\s+\+X\s+(\d+)\s*$/,x={valid:0,string:"",comments:"",programtype:"RGBE",format:"",gamma:1,exposure:1,width:0,height:0};for((p.pos>=p.byteLength||!(f=i(p)))&&e(1,"no header found"),(g=f.match(m))||e(3,"bad initial token"),x.valid|=1,x.programtype=g[1],x.string+=f+`
4174
4174
  `;f=i(p),f!==!1;)if(x.string+=f+`
4175
4175
  `,f.charAt(0)!=="#"){if((g=f.match(v))&&(x.gamma=parseFloat(g[1])),(g=f.match(y))&&(x.exposure=parseFloat(g[1])),(g=f.match(_))&&(x.valid|=2,x.format=g[1]),(g=f.match(b))&&(x.valid|=4,x.height=parseInt(g[1],10),x.width=parseInt(g[2],10)),2&x.valid&&4&x.valid)break}else x.comments+=f+`
4176
- `;return 2&x.valid||e(3,"missing format specifier"),4&x.valid||e(3,"missing image size specifier"),x}(s),h=c.width,d=c.height,u=function(p,f,g){let m=f;if(m<8||m>32767||p[0]!==2||p[1]!==2||128&p[2])return new Uint8Array(p);m!==(p[2]<<8|p[3])&&e(3,"wrong scanline width");let v=new Uint8Array(4*f*g);v.length||e(4,"unable to allocate buffer space");let y=0,_=0,b=4*m,x=new Uint8Array(4),w=new Uint8Array(b),S=g;for(;S>0&&_<p.byteLength;){_+4>p.byteLength&&e(1),x[0]=p[_++],x[1]=p[_++],x[2]=p[_++],x[3]=p[_++],(x[0]!=2||x[1]!=2||(x[2]<<8|x[3])!=m)&&e(3,"bad rgbe scanline format");let E,A=0;for(;A<b&&_<p.byteLength;){E=p[_++];let C=E>128;if(C&&(E-=128),(E===0||A+E>b)&&e(3,"bad scanline data"),C){let R=p[_++];for(let L=0;L<E;L++)w[A++]=R}else w.set(p.subarray(_,_+E),A),A+=E,_+=E}let P=m;for(let C=0;C<P;C++){let R=0;v[y]=w[C+R],R+=m,v[y+1]=w[C+R],R+=m,v[y+2]=w[C+R],R+=m,v[y+3]=w[C+R],y+=4}S--}return v}(s.subarray(s.pos),h,d);switch(this.type){case $e:l=u.length/4;let p=new Float32Array(4*l);for(let g=0;g<l;g++)n(u,4*g,p,4*g);a=p,o=$e;break;case $n:l=u.length/4;let f=new Uint16Array(4*l);for(let g=0;g<l;g++)r(u,4*g,f,4*g);a=f,o=$n;break;default:throw new Error("THREE.HDRLoader: Unsupported type: "+this.type)}return{width:h,height:d,data:a,header:c.string,gamma:c.gamma,exposure:c.exposure,type:o,colorSpace:Wu,minFilter:de,magFilter:de,generateMipmaps:!1,flipY:!0}}setDataType(t){return this.type=t,this}}});function S4(t){return t.length>2&&t[0]===35&&t[1]===63}var M4,g3,Ko,TY=z(()=>{tt(),AY()}),Tk=z(()=>{tt(),Ek(),Ak(),TY(),M4=0,g3=class extends xk{constructor(t,e){super(t,e.imageHolderCache),this.data=t,this.shared=e,this.instanceId=++M4,this.loaded=!1,this.isVideo=!1,this.isBuffer=!1,this.isHdr=!1,this._cache={1e3:{},1001:{},1002:{}},this.isVideo=t.type==="video",this.isBuffer=t.isWebGLRenderTarget===!0,this.loadPromise=this.updateSrc(this.isBuffer?t:t.data)}async updateSrc(t){if(typeof document>"u")return;this.disposeTextures(),this.loaded=!1,this.isHdr=!1;let e=()=>{this.loaded=!0;for(let n of Object.values(this._cache))for(let r of Object.values(n))for(let s of Object.values(r))s&&(s.image=this.img,s.needsUpdate=!0);this.shared.requestRender()};if(this.isBuffer)this.img=t,this.loaded=!0;else if(this.isVideo){if(this.img=document.createElement("video"),this.img.preload="auto",this.img.playsInline=!0,this.img.currentTime=.01,typeof t!="string"){let n,r=new FileReader;r.readAsDataURL(new Blob([t],{type:"video/mp4"})),await new Promise(s=>{r.onloadend=a=>{n=a.target?.result,s(null)}}),this.img.src=n}else this.img.src=t;this.img.onloadeddata=()=>{e()}}else if(t instanceof Uint8Array?S4(t):typeof t=="string"&&/\.hdr($|[?#])/i.test(t)){let n=t instanceof Uint8Array?t:null;if(n===null)try{n=new Uint8Array(await(await fetch(t)).arrayBuffer())}catch{n=null}let r=n!==null&&S4(n)?function(s){try{let a=new Sk().parse(s.buffer.slice(s.byteOffset,s.byteOffset+s.byteLength));if(!a||!a.width||!a.height)return null;let{width:o,height:l}=a,c=a.data,h=new Uint16Array(c.length),d=4*o,u=g=>Zl.toHalfFloat(Math.pow(Math.max(Zl.fromHalfFloat(g),0),1/2.2)),p=new Map,f=g=>{let m=p.get(g);return m===void 0&&(m=u(g),p.set(g,m)),m};for(let g=0;g<l;g++){let m=g*d,v=(l-1-g)*d;for(let y=0;y<d;y+=4)h[v+y]=f(c[m+y]),h[v+y+1]=f(c[m+y+1]),h[v+y+2]=f(c[m+y+2]),h[v+y+3]=c[m+y+3]}return{isSplineHdr:!0,data:h,width:o,height:l}}catch{return null}}(n):null;r!==null&&(this.isHdr=!0,this.img=r,e())}else this.img=new Image,this.img.src=typeof(i=t)=="string"?i:(yg||(yg=new bk),yg.load(i)),this.img.onload=e,await new Promise(n=>{this.img.onload=()=>{e(),n(null)}});var i}getTexture(t,e=1008,i=1006){let n=this._cache[t]?.[e]?.[i];if(n)return n;{let r;return this.isBuffer?r=this.img.texture:this.isVideo?r=new rF(this.img,void 0,t,t):this.isHdr?(r=function(s){let a=new Cn(s.data,s.width,s.height,Xi,$n);return a.flipY=!1,a.image.isSplineHdr=!0,a.needsUpdate=!0,a}(this.img),r.wrapS=t,r.wrapT=t,r.magFilter=i,r.minFilter=e):r=new Fi(this.img,void 0,t,t,i,e),this.isBuffer||(r.anisotropy=8,r.generateMipmaps=e===1008),this.loaded&&(r.needsUpdate=!0),this._cache[t]===void 0&&(this._cache[t]={}),this._cache[t][e]===void 0&&(this._cache[t][e]={}),this._cache[t][e][i]=r,r}}setNeedsUpdate(t){if(!this.isBuffer)for(let e of Object.values(this._cache))for(let i of Object.values(e))for(let n of Object.values(i))n&&(n.needsUpdate=t)}disposeTextures(){for(let[t,e]of Object.entries(this._cache))for(let[i,n]of Object.entries(e))for(let[r,s]of Object.entries(n))s?.dispose(),this._cache[t]!==void 0&&this._cache[t][i]!==void 0&&(this._cache[t][i][r]=void 0)}dispose(){super.dispose(),this.disposeTextures()}}}),v3=z(()=>{Tk(),Ko=class extends g3{}});function CY(t){if(typeof t=="string")return t;let e=ZA.get(t);return e||(e={url:URL.createObjectURL(new Blob([t]))},ZA.set(t,e)),e.url}var ZA,PY=z(()=>{ZA=new Map});function DY(){if(!KA)return E4||(E4=async function(){await Promise.resolve().then(()=>(GP(),f7)),Ck(window!==void 0?window:global),KA=!0}())}var Ck,Pk,KA,E4,Dk=z(()=>{Pk=new Promise(t=>{Ck=t}),KA=!1});function A4(t,e){t.forEach(i=>{"dragDropActions"in i.data?(e.push(...i.data.dragDropActions.drag),e.push(...i.data.dragDropActions.drop)):"inActions"in i.data?(e.push(...i.data.inActions),e.push(...i.data.outActions)):"gameActions"in i.data?(e.push(...i.data.gameActions.idle),e.push(...i.data.gameActions.move),e.push(...i.data.gameActions.jump),e.push(...i.data.gameActions.run)):"breakpoints"in i.data?i.data.breakpoints.forEach(n=>{e.push(...n.data.actions)}):"actions"in i.data&&(e.push(...i.data.actions),i.data.actions.forEach(n=>{n.data.type==="Conditional"&&n.data.ifActions&&(e.push(...n.data.ifActions),e.push(...n.data.elseActions))}))})}function RY(t){let e=!1,i=[];return t.scene.objects.traverse((n,r)=>{if(r.type==="Page"&&r.uiScene!==void 0&&r.uiScene.objects.traverse((s,a)=>{if(a.events===void 0||Array.isArray(a.events)===!1)return!0;A4(a.events,i),e=e||i.some(o=>o.data.type==="Audio")}),r.events===void 0||Array.isArray(r.events)===!1)return!0;A4(r.events,i),e=e||i.some(s=>s.data.type==="Audio")}),e}var T4,Fu,y3=z(()=>{PY(),Dk(),Pk.then(t=>T4=t),Fu=class{constructor({src:t,volume:e,delay:i,loop:n}){let r;this._volume=1,this.delay=0,this._loop=1,this.loopsRemaining=0,this._status="stopped",this.onEnd=()=>{this.loopsRemaining===1/0?this.replay():this.loopsRemaining>1?(this.replay(),this.loopsRemaining--):(this._status="stopped",this.loopsRemaining=this._loop)},r=typeof t=="string"?{src:t}:{src:CY(t),format:"wav"},this.sound=new T4.Howl(r),this.sound.on("end",this.onEnd),this.src=t,e!==void 0&&(this.volume=e),i!==void 0&&(this.delay=i),n!==void 0&&(this.loop=n)}get status(){return this._status}get volume(){return this._volume}set volume(t){this._volume=t,this.sound.volume(t)}get loop(){return this._loop}set loop(t){this._loop=t,this.loopsRemaining=t}replay(){this.clearDelay(),this.delayTimerId=window.setTimeout(()=>{this.sound.play(),this.clearDelay()},this.delay)}fade(t,e=1e3){t?(this.sound.volume(this._volume),this.clearFade(),this.fadeTimerId=window.setTimeout(()=>{this.sound.fade(this._volume,0,e),this.clearFade()},t)):this.sound.fade(this._volume,0,e)}on(t,e,i){this.sound.on(t,e,i)}off(t,e,i){this.sound.off(t,e,i)}play(){this._status==="playing"||this.sound.playing()||(this._status==="paused"?(this.sound.seek()===0?this.replay():this.sound.play(),this._status="playing"):this._status==="stopped"&&(this.replay(),this._status="playing"))}pause(){this._status==="playing"&&(this.sound.pause(),this.clearFade(),this.clearDelay(),this._status="paused")}stop(){this.sound.stop(),this.loopsRemaining=this._loop,this.clearFade(),this.clearDelay(),this._status="stopped"}clearFade(){this.fadeTimerId&&(clearTimeout(this.fadeTimerId),delete this.fadeTimerId)}clearDelay(){this.delayTimerId&&(clearTimeout(this.delayTimerId),delete this.delayTimerId)}dispose(t=!1){this.off(),this.stop(),this.clearFade(),this.clearDelay()}}});function C4(t){let e=!1;return t.scene.objects.traverse((i,n)=>{n.type==="Mesh"&&(n.geometry.type==="TextGeometry"||n.geometry.type==="InputGeometry")&&(e=!0)}),e}var _3,b3=z(()=>{_3=null});function P4(t){return new et(t.y,-t.x)}var x3,QA,Rk,Ik,Lv,D4,gb,Ok,i2,vb=z(()=>{tt(),x3=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i=t.parameters?.radiusTop,n=t.parameters?.radiusBottom,r=Object.assign({},e?.parameters??{width:100,radialSegments:64,heightSegments:1,openEnded:!1,thetaStart:0,thetaLength:360,cornerRadius:8,cornerSegments:8,hollow:0},t.parameters);r.thetaLength=Ot.clamp(r.thetaLength,0,360),r.hollow=Ot.clamp(r.hollow??0,0,1);let s=r.width/2,a=r.radiusTop??s,o=r.radiusBottom??s;if(a===o?(a=s,o=s):a>o?(a=s,o=o*s/a):(a=a*s/o,o=s),r.shapeBlendNode){a=i??s,o=n??s;let l=2*Math.max(a,o);r.width=l,r.depth=l}return{parameters:Object.assign(r,{width:Math.abs(r.width),height:Math.abs(r.height??r.width),depth:Math.abs(r.depth??r.width),radiusTop:a,radiusBottom:o})}}static build(t){let e,{width:i,depth:n,height:r,radialSegments:s,heightSegments:a,openEnded:o,thetaStart:l,thetaLength:c,radiusTop:h,radiusBottom:d,cornerRadius:u,cornerSegments:p,hollow:f}=t.parameters;c===0?(e=new jt,e.setAttribute("position",new Nt([],3))):e=u||f?new QA(h,d,r,s,a,o,l,c*Math.PI/180,u,u,p,f):new sg(h,d,r,s,a,o,l,c*Math.PI/180);let g=n/i;return g!==1&&e.scale(1,1,g),Object.assign(e,{userData:{...t,type:"CylinderGeometry"}})}},QA=class extends jt{constructor(t,e,i,n,r,s,a,o,l,c,h,d,u=!1){super(),this.type="RoundedCylinderBufferGeometry",t=t!==void 0?t:1,e=e!==void 0?e:1,i=i||1,n=Math.floor(n)||8,r=Math.floor(r)||1,s=s!==void 0&&s,a=a!==void 0?a:0,o=o!==void 0?o:2*Math.PI,s&&(l=0,c=0);let p=i/2;u&&t==0&&(t=l),u&&e==0&&(e=c);let f=new et(t,p),g=new et(e,-p),m=null,v=null,y=null,_=null,b=f.clone().sub(g),x=0,w=0,S=0;d>0&&(x=Math.min(t,e)*(1-d),w=t-x,S=e-x);let E=f.clone();E.x-=x;let A=Math.PI-b.angle(),P=b.angle(),C=Math.tan(P/2),R=Math.tan(A/2),L=C+R,D=d?L:R,F=d?L:C;if(l=Math.min(l,(t-w)/D,b.length()/L),c=Math.min(c,(e-S)/F,b.length()/L),l>0){let st=l/C;m=f.clone().sub(new et(st,l)),d&&(y=m.clone(),y.x-=x-L*l),f.sub(b.clone().setLength(st))}if(c>0){let st=c/R;v=g.clone().sub(new et(st,-c)),g.add(b.clone().setLength(st)),d&&(_=v.clone(),_.x-=x-L*c,E.sub(b.clone().setLength(st)))}b=f.clone().sub(g);let V=b.length()<.5,U=[],j=[],W=[],it=[],nt=[],Y=[],ot=(st,dt,bt,ct,It)=>{for(let St=0;St<h+1;St++){let Dt=St/h,Mt=ct<0?Dt:1-Dt;It&&(Mt-=1),Mt*=st;let q=Math.sin(Mt),_t=Math.cos(Mt)*ct,Pt=_t*dt+bt.y;U.push(q*dt+bt.x),j.push(Pt),W.push(q),it.push(_t),nt.push(.5+Pt/i),Y.push(!1)}},ht=(st,dt,bt)=>{let ct=[st,dt];bt<0&&ct.reverse();for(let It of ct)U.push(It),j.push(p*bt),W.push(0),it.push(bt),nt.push(.5),Y.push(!0)};if(_&&v?(ot(A,c,_,-1,!0),ot(P,c,v,-1,!1)):v?(ht(v.x,0,-1),ot(P,c,v,-1,!1)):s||ht(e,S,-1),!V){let st=P4(b).normalize();for(let dt=0;dt<=r;dt++){let bt=dt/r,ct=b.y*bt+g.y;U.push(b.x*bt+g.x),j.push(ct),W.push(st.x),it.push(st.y),nt.push(.5+ct/i),Y.push(!1)}}if(y&&m?(ot(A,l,m,1,!1),ot(P,l,y,1,!0)):m?(ot(A,l,m,1,!1),ht(m.x,0,1)):s||ht(t,w,1),d&&!V){let st=P4(b).multiplyScalar(-1).normalize();for(let dt=0;dt<=r;dt++){let bt=dt/r,ct=b.y*-bt+E.y;U.push(b.x*-bt+E.x),j.push(ct),W.push(st.x),it.push(st.y),nt.push(.5+ct/i),Y.push(!1)}}let ft=U.length,pt=ft+(d&&!s?1:0),J=(st,dt)=>st*ft+(dt===ft?0:dt),mt=o<2*Math.PI,N=(n+1)*ft+(mt?2*(1+pt):0),O=new Float32Array(3*N),H=new Float32Array(3*N),$=new Float32Array(2*N),B=N-1>65535?new Uint32Array(n*Math.max(0,pt-1)*6+(mt?2*(pt+1)*3:0)):new Uint16Array(n*Math.max(0,pt-1)*6+(mt?2*(pt+1)*3:0)),Z=0,K=0;for(let st=0;st<=n;st++){let dt=st/n,bt=dt*o+a,ct=Math.sin(bt),It=Math.cos(bt);for(let St=0;St<ft;St++){let Dt=3*K,Mt=2*K,q=U[St],_t=W[St];O[Dt]=q*ct,O[Dt+1]=j[St],O[Dt+2]=q*It,H[Dt]=_t*ct,H[Dt+1]=it[St],H[Dt+2]=_t*It,Y[St]?($[Mt]=.5,$[Mt+1]=.5):($[Mt]=dt,$[Mt+1]=nt[St]),K++}}for(let st=0;st<n;st++)for(let dt=0;dt<pt-1;dt++){if(s&&d&&dt==r)continue;let bt=J(st,dt),ct=J(st+1,dt),It=J(st+1,dt+1),St=J(st,dt+1),Dt=O[3*It+0],Mt=O[3*It+2];B[Z++]=bt,B[Z++]=ct,B[Z++]=St,(Dt!=0||Mt!=0)&&(B[Z++]=ct,B[Z++]=It,B[Z++]=St)}function k(st,dt,bt){let ct=Math.sin(bt),It=Math.cos(bt),St=-It,Dt=ct,Mt=st<0?(Ft,_e,be)=>{B[Z++]=Ft,B[Z++]=_e,B[Z++]=be}:(Ft,_e,be)=>{B[Z++]=Ft,B[Z++]=be,B[Z++]=_e},q=(t+e+w+S)/4,_t=3*K,Pt=2*K;O[_t]=q*ct,O[_t+1]=0,O[_t+2]=q*It,H[_t]=St,H[_t+1]=0,H[_t+2]=Dt,$[Pt]=.5,$[Pt+1]=.5;let Gt=K++;for(let Ft=0;Ft<pt;Ft++){let _e=3*(dt+(Ft===ft?0:Ft));_t=3*K,Pt=2*K,O[_t]=O[_e],O[_t+1]=O[_e+1],O[_t+2]=O[_e+2],H[_t]=St,H[_t+1]=0,H[_t+2]=Dt;let be=_e/3*2|0;$[Pt]=$[be],$[Pt+1]=$[be+1],K++}for(let Ft=Gt+1;Ft<K-1;Ft++)Mt(Gt,Ft,Ft+1);Mt(Gt,K-1,Gt+1)}mt&&(k(-1,0,a),k(1,n*ft,a+o)),this.setIndex(new Ht(B.slice(0,Z),1)),this.setAttribute("position",new Ht(O,3)),this.setAttribute("normal",new Ht(H,3)),this.setAttribute("uv",new Ht($,2))}}}),R4=z(()=>{tt(),vb(),Rk=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i=Object.assign({},e?.parameters??{width:100,radialSegments:32,heightSegments:8,openEnded:!1,thetaStart:0,thetaLength:360,cornerRadiusTop:8,cornerRadiusBottom:8,cornerSegments:8},t.parameters);return i.thetaLength=Ot.clamp(i.thetaLength,0,360),{parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??i.width)})}}static build(t){let e,{width:i,depth:n,height:r,radialSegments:s,heightSegments:a,openEnded:o,thetaStart:l,thetaLength:c,cornerRadiusTop:h,cornerRadiusBottom:d,cornerSegments:u}=t.parameters;c===0?(e=new jt,e.setAttribute("position",new Nt([],3))):e=h>0||d>0||c<360?new QA(0,i/2,r,s,a,o,l,c*Math.PI/180,h,d,u,0,!0):new B_(i/2,r,s,a,o);let p=n/i;return p!==1&&e.scale(1,1,p),Object.assign(e,{userData:{...t,type:"ConeGeometry"}})}}}),I4=z(()=>{tt(),Ik=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i=Object.assign({},e?.parameters??{width:100,widthSegments:1,heightSegments:1,depthSegments:1,cornerRadius:8,cornerSegments:8},t.parameters);return{parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??i.width)})}}static build(t){let e,{width:i,height:n,depth:r,widthSegments:s,heightSegments:a,depthSegments:o,cornerRadius:l,cornerSegments:c}=t.parameters;return e=l===0?new va(i,n,r,s,a,o):new D4(i,n,r,s,a,o,l,c),Object.assign(e,{userData:{...t,type:"CubeGeometry"}})}},Lv=Math.PI/2,D4=class extends jt{constructor(t=1,e=1,i=1,n=1,r=1,s=1,a=0,o=4){super(),this.type="BoxGeometry",n=Math.floor(n),r=Math.floor(r),s=Math.floor(s),o=Math.floor(o);let l=(a=Math.min(a,t/2,e/2,i/2))>0,c=o+1,h=2*((s+1)*(r+1)+(n+1)*(s+1)+(n+1)*(r+1))+(l?4*c*(s+1+(n+1)+(r+1))+c*(c+1)/2*8:0),d=2*(s*r+n*s+n*r)+(l?4*o*(s+n+r):0),u=l?8*o*o:0,p=new Float32Array(3*h),f=new Float32Array(3*h),g=new Float32Array(2*h),m=h-1>65535?new Uint32Array(6*d+3*u):new Uint16Array(6*d+3*u),v=0,y=0,_=new Float64Array(c),b=new Float64Array(c),x=new Float64Array(c),w=new Float64Array(c);for(let L=0;L<c;L++){let D=L/o*Lv;_[L]=Math.sin(D)*a,b[L]=(1-Math.cos(D))*a,x[L]=Math.sin(D),w[L]=Math.cos(D)}let S=c*(c+1)/2,E=new Float64Array(3*S),A=new Float64Array(3*S);{let L=new T(t/2,e/2,i/2);L.subScalar(a);let D=0;for(let F=0;F<=o;F++){let V=Lv*(1-F/o),U=Math.cos(V),j=Math.sin(V),W=0;for(let it=0;it<=F;it++){let nt=U*Math.cos(W),Y=j,ot=U*Math.sin(W);E[3*D]=nt,E[3*D+1]=Y,E[3*D+2]=ot,A[3*D]=L.x+nt*a,A[3*D+1]=L.y+Y*a,A[3*D+2]=L.z+ot*a,D++,W+=Lv/F}}}function P(L,D,F,V,U,j,W,it,nt,Y){let ot=(j-2*a)/nt,ht=(W-2*a)/Y,ft=j/2-a,pt=W/2-a,J=it/2,mt=nt+1,N=Y+1,O=0,H=new T;for(let $=0;$<N;$++){let B=$*ht-pt;for(let Z=0;Z<mt;Z++){let K=Z*ot-ft,k=3*(v+O),st=2*(v+O);H[L]=K*V,H[D]=B*U,H[F]=J,p[k]=H.x,p[k+1]=H.y,p[k+2]=H.z,H[L]=0,H[D]=0,H[F]=it>0?1:-1,f[k]=H.x,f[k+1]=H.y,f[k+2]=H.z,g[st]=Z/nt,g[st+1]=1-$/Y,O+=1}}for(let $=0;$<Y;$++)for(let B=0;B<nt;B++){let Z=v+B+mt*$,K=v+B+mt*($+1),k=v+(B+1)+mt*($+1),st=v+(B+1)+mt*$;m[y++]=Z,m[y++]=K,m[y++]=st,m[y++]=K,m[y++]=k,m[y++]=st}v+=O}function C(L,D,F,V,U,j,W,it,nt,Y){let ot=(W-2*a)/Y,ht=W/2-a,ft=it/2-a,pt=nt/2,J=Y+1,mt=0,N=new T,O=new T;for(let H=0;H<o+1;H++){N[D]=(ft+_[H])*U,N[F]=(pt-b[H])*j,O[L]=0,O[D]=x[H]*Math.sign(N[D]),O[F]=w[H]*Math.sign(N[F]);for(let $=0;$<J;$++){let B=$*ot-ht;N[L]=B*V;let Z=3*(v+mt),K=2*(v+mt);p[Z]=N.x,p[Z+1]=N.y,p[Z+2]=N.z,f[Z]=O.x,f[Z+1]=O.y,f[Z+2]=O.z,g[K]=$/Y,g[K+1]=0,mt+=1}}for(let H=0;H<o;H++)for(let $=0;$<Y;$++){let B=v+$+J*H,Z=v+$+J*(H+1),K=v+($+1)+J*(H+1),k=v+($+1)+J*H;m[y++]=B,m[y++]=Z,m[y++]=k,m[y++]=Z,m[y++]=K,m[y++]=k}v+=mt}function R(L,D,F){let V=L*D*F>0?(j,W,it)=>{m[y++]=j,m[y++]=W,m[y++]=it}:(j,W,it)=>{m[y++]=j,m[y++]=it,m[y++]=W},U=v;for(let j=0;j<S;j++){let W=3*j,it=3*v,nt=2*v;p[it]=L*A[W],p[it+1]=D*A[W+1],p[it+2]=F*A[W+2],f[it]=L*E[W],f[it+1]=D*E[W+1],f[it+2]=F*E[W+2],g[nt]=0,g[nt+1]=0,v++}for(let j=0;j<o;j++){let W=U+j*(j+1)/2,it=U+(j+1)*(j+2)/2;V(W,it+1,it);for(let nt=1;nt<=j;nt++)V(W+nt-1,W+nt,it+nt),V(W+nt,it+nt+1,it+nt)}}P("z","y","x",-1,-1,i,e,t,s,r),P("z","y","x",1,-1,i,e,-t,s,r),P("x","z","y",1,1,t,i,e,n,s),P("x","z","y",1,-1,t,i,-e,n,s),P("x","y","z",1,-1,t,e,i,n,r),P("x","y","z",-1,-1,t,e,-i,n,r),a>0&&(C("z","y","x",-1,-1,1,i,e,t,s),C("z","y","x",1,-1,-1,i,e,t,s),C("z","y","x",-1,1,-1,i,e,t,s),C("z","y","x",1,1,1,i,e,t,s),C("x","y","z",-1,-1,-1,t,e,i,n),C("x","y","z",1,-1,1,t,e,i,n),C("x","y","z",-1,1,1,t,e,i,n),C("x","y","z",1,1,-1,t,e,i,n),C("y","x","z",-1,-1,1,e,t,i,r),C("y","x","z",1,-1,-1,e,t,i,r),C("y","x","z",1,1,1,e,t,i,r),C("y","x","z",-1,1,-1,e,t,i,r),R(1,1,1),R(-1,1,1),R(1,-1,1),R(-1,-1,1),R(1,1,-1),R(-1,1,-1),R(1,-1,-1),R(-1,-1,-1)),this.setIndex(new Ht(m,1)),this.setAttribute("position",new Ht(p,3)),this.setAttribute("normal",new Ht(f,3)),this.setAttribute("uv",new Ht(g,2))}}}),Lk=z(()=>{tt(),gb=class extends jt{constructor(t=[],e=[],i="",n=1,r=.2,s=4){super(),this.type="PolyhedronGeometryRound";let a,o,l,c=0;return function(){(r=Math.min(.99999,r))==0&&(s=0);let h={IcosahedronGeometry:5,DodecahedronGeometry:3,HexahedronGeometry:3,OctahedronGeometry:4,TetrahedronGeometry:3}[i],d=new T,u=d.clone(),p=new gn,f=r*n,g=n-f,m=s+1,v=new T,y=(J,mt)=>v.subVectors(J,mt).normalize(),_=(J,mt)=>Array(J).fill(void 0).map(mt),b=_(t.length/3,(J,mt)=>new T().fromArray(t,3*mt).setLength(n)),x=[],w=1e6;for(let J=0;J<b.length;J++){let mt,N,O,H=b[J],$=[],B=1e10,Z=-1;for(;(Z=e.indexOf(J,Z+1))!=-1;){let dt=Z-Z%3;mt=e[dt+(Z+1)%3],N=e[dt+(Z+2)%3],O=H.distanceToSquared(b[mt]),B=Math.min(B,O),$.push([mt,N,O])}B+=1e-6;let K=[],k=0,st=$.length;for(let dt=0;dt<st;dt++){[mt,N,O]=$[k];let bt=x[mt]?.includes(J)==1;O<=B&&K.push(mt+ +bt*w),k=$.findIndex(ct=>ct[0]==N)}x.push(K)}let S=[];{let J,mt,N=0,O=0,H=h==3;for(let $=0;$<=s;$++){J=$*($+1)/2,mt=($+1)*($+2)/2;for(let B=0;B<s-$;B++)[N,O]=[J+B+$+2,mt+B+$+3],S.push(J,mt,...H?[O,J]:[N,mt],O,N),[J,mt]=[N,O];S.push(J,mt,J+s+2)}}let E=0;for(let J=0;J<x.length;J++)for(let mt=0;mt<h;mt++)x[J][mt]<w&&E++;let A=b.length*h*S.length*3+E*m*6*3+2*E*3*3;a=new Float64Array(A),o=new Float64Array(A),l=new Float64Array(A/3*2);let P=(J,mt,N)=>{let O=c/3*2;l[O]=Math.atan2(N,-J)/2/Math.PI+.5,l[O+1]=1-(Math.atan2(-mt,Math.sqrt(J*J+N*N))/Math.PI+.5)},C=J=>{a[c]=J.x,a[c+1]=J.y,a[c+2]=J.z,o[c]=v.x,o[c+1]=v.y,o[c+2]=v.z,P(J.x,J.y,J.z),c+=3},R=J=>{a[c]=J[0].x,a[c+1]=J[0].y,a[c+2]=J[0].z,o[c]=J[1].x,o[c+1]=J[1].y,o[c+2]=J[1].z,P(J[0].x,J[0].y,J[0].z),c+=3},L=(s+2)*(s+3)/2,D=new Float64Array(3*L),F=new Float64Array(3*L),V=new Float64Array(2*L),U=_(2*h*m,()=>new T),j=_(s*Math.max(0,s-1)/2,()=>new T),W=d.clone(),it=d.clone(),nt=d.clone(),Y=d.clone(),ot=d.clone(),ht=[],ft=_(b.length,()=>_(h,()=>d.clone()));for(let J=0;J<b.length;J++){d.copy(b[J]).normalize(),W.copy(d).multiplyScalar(g);let mt=x[J];for(let K=0;K<mt.length;K++){let k=mt[K],st=mt[(K+1)%h];p.setFromPointsAndIndices(b,J,k%w,st%w),p.b.sub(p.a).setLength(1e10).add(p.a),p.c.sub(p.a).setLength(1e10).add(p.a),p.closestPointToPoint(W,ft[J][K])}let N=0,O=[],H=[],$=new T;s==0&&[...ft[J]].reduce((K,k)=>K.add(k),$).multiplyScalar(1/h);for(let K=0;K<h;K++){let k=[],st=(K-1+h)%h,dt=ft[J][st],bt=ft[J][K];d.copy(dt).sub(W),u.copy(bt).sub(W);let ct=W.angleTo(d),It=d.angleTo(u),St=Math.cos(ct)*f;s==0?it.copy($):it.copy(W).setLength(g+St),O.push(St);let Dt=[it,dt,bt];for(let Mt=0;Mt<2;Mt++){let q=Dt[Mt],_t=Dt[Mt+1];Y.subVectors(q,W),ot.subVectors(_t,W),nt.crossVectors(Y,ot).normalize();for(let Pt=0;Pt<m;Pt++){let Gt=[ct,It][Mt]*Pt/m;d.copy(Y).applyAxisAngle(nt,Gt).add(W),U[N++].copy(d),Mt&&(y(d,W),k.push([Pt==0?q:d.clone(),v.clone()]))}Mt&&(y(_t,W),k.push([_t,v.clone()]))}H.push(k)}ht.push(H);let B=2*m,Z=2;for(let K=0;K<h;K++){let k=B*K,st=B*((K+1)%h),dt=0,bt=[U[k]];for(let ct=1;ct<m;ct++){let It=U[k+ct],St=U[st+ct];bt.push(It);for(let Dt=1,Mt=ct-Z+1;Dt<=Mt;Dt++)d.lerpVectors(It,St,Dt/(Mt+1)),d.sub(W).setLength(O[K]).add(W),bt.push(j[dt++].copy(d));bt.push(St)}for(let ct=0;ct<m;ct++)bt.push(U[ct+m+k]);bt.push(U[st+m]);for(let ct=0,It=bt.length;ct<It;ct++){let St=bt[ct],Dt=3*ct,Mt=2*ct;D[Dt]=St.x,D[Dt+1]=St.y,D[Dt+2]=St.z,y(St,W),F[Dt]=v.x,F[Dt+1]=v.y,F[Dt+2]=v.z,V[Mt]=Math.atan2(St.z,-St.x)/2/Math.PI+.5,V[Mt+1]=1-(Math.atan2(-St.y,Math.sqrt(St.x*St.x+St.z*St.z))/Math.PI+.5)}for(let ct=0,It=S.length;ct<It;ct++){let St=3*S[ct],Dt=2*S[ct],Mt=c/3*2;a[c]=D[St],a[c+1]=D[St+1],a[c+2]=D[St+2],o[c]=F[St],o[c+1]=F[St+1],o[c+2]=F[St+2],l[Mt]=V[Dt],l[Mt+1]=V[Dt+1],c+=3}}}let pt=[];for(let J=0;J<x.length;J++)for(let mt=0;mt<h;mt++){let N=x[J][mt];if(N<w){let O=x[N].findIndex(B=>B%w==J),H=ht[J][mt],$=ht[N][O];for(let B=0;B<m;B++){let Z=H[B],K=$[m-B],k=H[B+1],st=$[m-(B+1)];R(Z),R(K),R(k),R(k),R(K),R(st)}pt.push(H[0][0],$[m][0],H[m][0],$[0][0])}}for(;pt.length;){let J,mt,N,[O,H]=pt.splice(0,2);J=H;let $=[O];for(;O!=J;)$.push(J),mt=pt.indexOf(J),N=mt%2,J=pt.splice(mt-N,2)[1-N];v.subVectors($[0],$[1]).cross(d.subVectors($[0],$[2])).normalize();let B=v.dot($[0])<0;B&&v.negate();for(let Z=1;Z<=$.length-2;Z++)C($[Z+ +B]),C($[Z+1-+B]),C($[0])}}(),function(){let h=new T,d=new T,u=new T,p=new T,f=new et,g=new et,m=new et,v=(b,x,w,S)=>{S<0&&b.x===1&&(l[x]=b.x-1),w.x===0&&w.z===0&&(l[x]=S/2/Math.PI+.5)};for(let b=0,x=0;b<c;b+=9,x+=6){h.set(a[b+0],a[b+1],a[b+2]),d.set(a[b+3],a[b+4],a[b+5]),u.set(a[b+6],a[b+7],a[b+8]),f.set(l[x+0],l[x+1]),g.set(l[x+2],l[x+3]),m.set(l[x+4],l[x+5]),p.copy(h).add(d).add(u).divideScalar(3);let w=_(p);v(f,x+0,h,w),v(g,x+2,d,w),v(m,x+4,u,w)}let y=c/3*2;for(let b=0;b<y;b+=6){let x=l[b+0],w=l[b+2],S=l[b+4],E=Math.max(x,w,S),A=Math.min(x,w,S);E>.9&&A<.1&&(x<.2&&(l[b+0]+=1),w<.2&&(l[b+2]+=1),S<.2&&(l[b+4]+=1))}function _(b){return Math.atan2(b.z,-b.x)}}(),this.setAttribute("position",new Ht(new Float32Array(a.subarray(0,c)),3)),this.setAttribute("normal",new Ht(new Float32Array(o.subarray(0,c)),3)),void this.setAttribute("uv",new Ht(new Float32Array(l.subarray(0,c/3*2)),2))}static fromJSON(t){return new gb(t.vertices,t.indices,t.radius,t.corner,t.cornerSides)}}}),O4=z(()=>{Lk(),tt(),Ok=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i=Object.assign({},e?.parameters??{width:100,detail:0,corner:0,cornerSides:4},t.parameters);return{parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??i.width)})}}static build(t){let{width:e,height:i,depth:n,detail:r,corner:s,cornerSides:a}=t.parameters,o=r===0&&s!==0?new i2(.5*e,s,a):new OE(.5*e,r),l=i/e,c=n/e;return(l!==1||c!==1)&&o.scale(1,l,c),Object.assign(o,{userData:{...t,type:"DodecahedronGeometry"}})}},i2=class extends gb{constructor(t=1,e=.2,i=4){let n=(1+Math.sqrt(5))/2,r=1/n,s="DodecahedronGeometry";super([-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-r,-n,0,-r,n,0,r,-n,0,r,n,-r,-n,0,-r,n,0,r,-n,0,r,n,0,-n,0,-r,n,0,-r,-n,0,r,n,0,r],[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9],s,t,e,i),this.type=s}static fromJSON(t){return new i2(t.radius,t.corner,t.cornerSides)}}});function L4(t,e=new et){let i=t.length();return e.set(-t.y/i,t.x/i)}function IY(t){let e=new et;e.addVectors(t.v0,Ic.subVectors(t.v1,t.v0).multiplyScalar(2/3));let i=new et;return i.addVectors(t.v2,Kg.subVectors(t.v1,t.v2).multiplyScalar(2/3)),new Fs(t.v0,e,i,t.v2)}function Gm(t,e,i=Number.EPSILON){return Math.abs(t-e)<i}function OY(t,e,i=Number.EPSILON){return t.distanceTo(e)<i}function LY(t,e,i=Number.EPSILON){return t.distanceTo(e)<i}function Bk(t,e,i){let n=Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2)),r=Math.sqrt(Math.pow(e.x-i.x,2)+Math.pow(e.y-i.y,2)),s=Math.sqrt(Math.pow(i.x-t.x,2)+Math.pow(i.y-t.y,2));return Math.acos((r*r+n*n-s*s)/(2*r*n))}function BY(t,e,i){return U4(t,e)&&U4(e,i)&&JA(t.position,e.position,i.position)}function JA(t,e,i){return Ic.copy(e).sub(t).cross(Kg.copy(i).sub(t))===0}function UY(t,e,i,n,r){let s=Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2)),a=(t.y+e.y)/2,o=(t.x+e.x)/2,l=Math.sqrt(Math.pow(i,2)-Math.pow(s/2,2))*(t.y-e.y)/s,c=Math.sqrt(Math.pow(i,2)-Math.pow(s/2,2))*(e.x-t.x)/s;return n.set(o+l,a+c),r.set(o-l,a-c),[n,r]}function zY(t,e,i){return t.distanceTo(i)<e.distanceTo(i)?e:t}function FY(t,e,i,n,r,s){let a,o=e.x-t.x,l=e.y-t.y,c=i.x-t.x,h=i.y-t.y,d=Math.sqrt((o+c)*(o+c)+(l+h)*(l+h));return Bk(e,t,i)>Math.PI&&(d*=-1),a=Gm(h,l)?(l+h)*(n/d-.5)*8/3/(o-c):(o+c)*(n/d-.5)*8/3/(h-l),r.set(e.x-a*l,e.y+a*o),s.set(i.x+a*h,i.y-a*c),[r,s]}function B4(t,e){return t.position.equals(t.controls[1].position)&&e.position.equals(e.controls[0].position)}function U4(t,e){return JA(t.position,t.controls[1].position,e.position)&&JA(t.position,e.controls[0].position,e.position)}function z4(t,e=12,i=!1){let n=[];for(let r=0,s=t.length;r<s;r++){let a=t[r],o=0;if(i&&a.roundedCurveCorner!==void 0){let l=.5*Rc(a.roundedCurveCorner,e);r>0&&(n[r-1]+=l),o+=l}a.curveAfter!==void 0&&(o+=Rc(a.curveAfter,e)),n.push(o)}return t.length>0&&i&&t[0].roundedCurveCorner!==void 0&&(n[t.length-1]+=.5*Rc(t[0].roundedCurveCorner,e)),n}function Rc(t,e=12){return t&&t instanceof Dm?2*e:t&&(t instanceof fs||t instanceof LE)?1:t&&t instanceof _1?e*t.points.length:e}var Du,Bv,Uv,Vc,O1,Ic,Kg,Uk,zk,Fk,Nk,tT,eT,zv,F4,N4,k4,V4,j4,ki,kk=z(()=>{tt(),Du=1e-12,Bv=class{constructor(t){this.position=new et,this.startPosition=new et,this.uuid=Ot.generateUUID(),this.position=t.clone()}start(){this.reset()}reset(){this.startPosition.copy(this.position)}applyOffset(t){this.position.copy(this.startPosition).add(t)}copy(t){return this.position.copy(t.position),this.startPosition.copy(t.startPosition),this}clone(){return new Bv(this.position).copy(this)}toJSON(){return[this.position.x,this.position.y]}},Uv=class extends Bv{constructor(t){super(t.position),this.parent=t}copy(t){return super.copy(t),this}clone(){return new Uv(this.parent).copy(this)}},Vc=class extends Bv{constructor(t,e){super(e),this.controls=[],this.roundness=0,this.areControlsDirectionsMirrored=!0,this.uuid=t,this.controls.push(new Uv(this),new Uv(this))}static create(t,e){let i=new Vc(t,new et(...e.position));return i.controls[0].position.set(...e.controlPrevious.position),i.controls[1].position.set(...e.controlNext.position),i.roundness=e.roundness,i.areControlsDirectionsMirrored=e.areControlsDirectionsMirrored,i}getOppositeControl(t){let e=this.controls.indexOf(t);return e===0?this.controls[1]:e===1?this.controls[0]:null}applyOffsetToControls(t,e=1){for(let i=0,n=this.controls.length;i<n;i++){let r=this.controls[i];this.position.distanceTo(r.position)<=e?r.position.copy(this.position):r.applyOffset(t)}}controlsMoved(){return!(this.position.equals(this.controls[0].position)&&this.position.equals(this.controls[1].position))}copy(t){return super.copy(t),this.controls[0].copy(t.controls[0]),this.controls[1].copy(t.controls[1]),this.roundness=t.roundness,this.uuid=t.uuid,this}clone(){return new Vc(this.uuid,this.position).copy(this)}toJSON(){return super.toJSON().concat(this.controls[0].toJSON(),this.controls[1].toJSON(),[this.roundness])}computeTangents(){let t=this.curveBefore?.getTangentAt(1),e=this.curveAfter?.getTangentAt(0);return[t,e]}computeNormals(t=new et,e=new et){let[i,n]=this.computeTangents();return i&&n&&(L4(i,t),L4(n,e)),[t,e]}computeTangent(t=new et){let[e,i]=this.computeTangents();return e&&i&&t.copy(e).add(i).normalize(),t}computeNormal(t=new et){let[e,i]=this.computeNormals();return t.copy(e).add(i).normalize(),t}},O1=t=>t,Ic=new et,Kg=new et,Uk=new et,zk=new et,Fk=new et,Nk=new et,tT=new T,eT=new T}),wh=z(()=>{tt(),kk(),zv=new et,F4=new et,N4=new et,k4=new et,V4=new et,j4=new et,ki=class extends Ug{constructor(t=100,e=100){super(),this.points=[],this.shapeHoles=[],this.plane=new Vr(new T(0,0,-1)),this.subdivision=0,this.controlSnapDistance=4,this.pointIDs=0,this.isMesh2D=!1,this.isText=!1,this._roundness=0,this.isClosed=!1,this.useCubicForRoundedCorners=!0,this.uuid=Ot.generateUUID(),this.needsUpdate=!1,this.roundedCurves=[],this._width=t,this._height=e}static createFromState(t,e,i){let n=new ki;return n.isClosed=t.isClosed,n.points=t.points.map(r=>Vc.create(r.id,r.data)),typeof t.roundness=="number"&&(n.roundness=t.roundness),n.shapeHoles=t.shapeHoles.map(r=>ki.createFromState(r)),e!==void 0&&i!==void 0&&n.applySize(e,i),n.update(),n}get width(){return this._width}get height(){return this._height}get roundness(){return this._roundness}set roundness(t){if(this._roundness!==t){this._roundness=t;for(let e=0,i=this.points.length;e<i;e++)this.points[e].roundness=t;this.needsUpdate=!0}}getPointsIndexesByIds(t){return t.map(e=>this.getPointIndexById(e)).filter(e=>e>=0)}getPointIndexById(t){let e=this.points.length,i=this.points.findIndex(n=>n.uuid===t);if(i<0){let n=e;for(let r=0,s=this.shapeHoles.length;r<s;r++){let a=this.shapeHoles[r],o=a.points.length,l=a.getPointIndexById(t);if(!(l<0))return l+n;n+=o}}return i}getLineIndexById(t){return this.getPointIndexById(t)}getBezierPoint(t){if(t<=this.points.length-1)return this.points[t];if(this.shapeHoles.length>0){let e=this.points.length;for(let i=0,n=this.shapeHoles.length;i<n;i++){let r=this.shapeHoles[i],s=t-e;if(s<=r.points.length-1)return r.points[s];e+=r.points.length}}throw new Error("This shape does not have a point for this index: "+t)}getBezierPointIndex(t){let e=this.points.indexOf(t);if(e>=0)return e;if(e=this.points.length,this.shapeHoles.length>0)for(let i=0,n=this.shapeHoles.length;i<n;i++){let r=this.shapeHoles[i],s=r.points.indexOf(t);if(s>=0)return e+s;e+=r.points.length}return-1}getAllPoints(){let t=[].concat(...this.shapeHoles.map(e=>e.points));return[...this.points,...t]}applySize(t,e){t===0&&(t=.001),e===0&&(e=.001),this._width=t,this._height=e}applyScale(t,e){let i=zv.set(t,e);for(let n=0,r=this.points.length;n<r;n++){let s=this.points[n];s.position.multiply(i),s.controls[0].position.multiply(i),s.controls[1].position.multiply(i)}for(let n=0,r=this.shapeHoles.length;n<r;n++)this.shapeHoles[n].applyScale(t,e);this._update()}createPoint(t,e=0,i=Ot.generateUUID()){let n;n=t instanceof et?t:new et(t,e);let r=new Vc(i,n);return r.roundness=this.roundness,r}addPoint(t){this.points.push(t),this.needsUpdate=!0}addPointAt(t,e){this.points.splice(e,0,t),this.needsUpdate=!0}getPointByUuid(t){for(let e=0,i=this.points.length;e<i;e++){let n=this.points[e];if(n.uuid===t)return n}for(let e=0,i=this.shapeHoles.length;e<i;e++){let n=this.shapeHoles[e].getPointByUuid(t);if(n)return n}}getFirstPoint(){return this.points[0]}getLastPoint(){return this.points[this.points.length-1]}removePoint(t){let e=this.points.indexOf(t);e>=0&&this.points.splice(e,1),this.needsUpdate=!0}removePointById(t){let e=this.points.find(i=>i.uuid===t);e&&this.removePoint(e)}update(){for(let t=0,e=this.shapeHoles.length;t<e;t++)this.shapeHoles[t].update();this._update()}extractShapePointsToBuffer(t,e=12,i=!1){this.subdivision=e,this.curveDivisions===void 0&&this.computeCurveDivisions(e);let n=i?this.roundedCurveDivisions:this.curveDivisions;return function(r,s,a=12,o=!0){let l,c=eT.set(0,0,0),h=0,d=[];for(let u=0;u<s.length;u++){let p=O1(s[u]),f=Ic,g=Rc(p,a);d.push(g);for(let m=0;m<=g;m++)if(p instanceof Fs||p instanceof $o||p instanceof fs){if(p.getPoint(m/g,f),c.set(f.x,f.y,0),l!==void 0&&LY(l,c))continue;l===void 0&&(l=tT),l.copy(c),r.setXYZ(h,c.x,c.y,c.z),h++}}o&&h>1&&(r.getX(h-1)!==r.getX(0)||r.getY(h-1)!==r.getY(0)||r.getZ(h-1)!==r.getZ(0))&&(r.setXYZ(h,r.getX(0),r.getY(0),r.getZ(0)),h++)}(t,i?this.roundedCurves:this.curves,e,this.autoClose),n.reduce((r,s)=>r+s,0)+1}computeCurveDivisions(t=12){return this.curveDivisions=z4(this.points,t,!1),this.roundedCurveDivisions=z4(this.points,t,!0),this.curveDivisions}extractFilteredShapePointsToBuffer(t,e,i=12){return 2*function(n,r,s,a=12,o=!0){let l=eT.set(0,0,0),c=0,h=[];for(let d=0;d<r.length;d++){if(s[d]===!1)continue;let u,p=O1(r[d]),f=Ic,g=Rc(p,a);h.push(g);for(let m=0;m<=g;m++)if(p instanceof Fs||p instanceof $o||p instanceof fs){if(p.getPoint(m/g,f),l.set(f.x,f.y,0),u?.equals(l))continue;u===void 0?u=tT:(n.setXYZ(c,u.x,u.y,u.z),c++,n.setXYZ(c,l.x,l.y,l.z),c++),u.copy(l)}}return o&&c>1&&!(n.getX(c-1)===n.getX(0)&&n.getY(c-1)===n.getY(0)&&n.getZ(c-1)===n.getZ(0))&&(n.setXYZ(c,n.getX(0),n.getY(0),n.getZ(0)),c++),h}(t,this.curves,e,i,this.autoClose).reduce((n,r)=>n+r,0)}extractShapePointsToFlatArray(t,e=12){return this.subdivision=e,this.curveDivisions===void 0&&this.computeCurveDivisions(e),function(i,n,r=12,s=!0){let a,o=0;for(let l=0;l<n.length;l++){let c=O1(n[l]),h=Rc(c,r),d=Ic;for(let u=0;u<=h;u++)if(c instanceof Fs||c instanceof $o||c instanceof fs){if(c.getPoint(u/h,d),a!==void 0&&OY(a,d,Du))continue;a===void 0&&(a=Kg),a.copy(d),i.push(d.x,d.y),o++}}return Gm(i[0],i[i.length-2],Du)&&Gm(i[1],i[i.length-1],Du)&&(i.pop(),i.pop()),s&&o>1&&!(Gm(i[o-1],i[1],Du)&&Gm(i[o-2],i[0],Du))&&(i.push(i[0],i[1]),o++),i}(t,this.roundedCurves,e,this.autoClose)}getCurveIndexFromVertexId(t,e=!1){let i=0;this.curveDivisions===void 0&&this.computeCurveDivisions(this.subdivision);let n=e?this.roundedCurveDivisions:this.curveDivisions,r=0;e&&this.points[0].roundedCurveCorner!==void 0&&(r=.5*Rc(this.points[0].roundedCurveCorner,this.subdivision));let s=t-r;s<0&&(s+=n.reduce((a,o)=>a+o,0));for(let a=0,o=n.length;a<o;a++){let l=n[a];if(s<i+l)return[a,(s-i+1)/l];i+=l}return[0,1]}getCurveT(t,e,i){let n=this.points[t],r=this.points[t>=this.points.length-1?0:t+1],s=this.curveDivisions,a=s[t];if(B4(n,r)){let l=n.position.distanceTo(r.position);return n.position.distanceTo(zv.set(i.x,i.y))/l}let o=0;for(let l=0;l<t;l++)o+=s[l];return(e-o)/a}dispose(){}_applyCurveForPoint(t,e){B4(e,t)?this.lineTo(t.position.x,t.position.y):this.bezierCurveTo(e.controls[1].position.x,e.controls[1].position.y,t.controls[0].position.x,t.controls[0].position.y,t.position.x,t.position.y);let i=this.curves[this.curves.length-1];t.curveBefore=i,e.curveAfter=i;let n=i.clone();t.roundedCurveBefore=n,e.roundedCurveAfter=n,t.roundedCurveCorner=void 0,this.roundedCurves.push(n)}_update(){if(this.curves=[],this.roundedCurves=[],!this.points.length)return;for(let e=0,i=this.points.length;e<i;e++){let n=this.points[e];if(e===0)this.moveTo(n.position.x,n.position.y);else{let r=this.points[e-1];this._applyCurveForPoint(n,r)}}let t=this.getLastPoint();if(t?.curveAfter&&(t.curveAfter=void 0),this.isClosed){let e=this.points[0],i=this.points[this.points.length-1];this._applyCurveForPoint(e,i)}if(this.points.length>2){let e=0;for(let i=0,n=this.points.length;i<n;i++){let r=this.points[i],s=this.points[i-1]??this.points[this.points.length-1],a=this.points[i+1]??this.points[0],o=r.roundness,l=s&&a&&BY(s,r,a);if(!r.controlsMoved()&&o>0&&!l){let c=r.curveBefore,h=r.curveAfter;if(c===void 0||h===void 0)continue;let d,u=r.roundedCurveBefore,p=r.roundedCurveAfter,f=c instanceof fs?c.v1.distanceTo(c.v2):c.getLength(),g=h instanceof fs?h.v1.distanceTo(h.v2):h.getLength(),m=Math.min(o,.499*f),v=Math.min(o,.499*g),y=Math.min(m,v),_=1-y/f,b=y/g,x=c.getPointAt(_,zv),w=h.getPointAt(b,F4);if(this._subSplitCurve(c,u,_,x,void 0),this._subSplitCurve(h,p,b,void 0,w),this.useCubicForRoundedCorners){let S=Bk(x,r.position,w)/2,E=Math.tan(S)*x.distanceTo(r.position),[A,P]=UY(x,w,E,N4,k4),C=zY(A,P,r.position),[R,L]=FY(C,x,w,E,V4,j4);d=new Fs(x.clone(),R.clone(),L.clone(),w.clone())}else d=new $o(x.clone(),r.position.clone(),w.clone());r.roundedCurveCorner=d,this.roundedCurves.splice(i+e,0,d),e++}}}}_subSplitCurve(t,e,i,n,r){if(!(t instanceof fs)){let s=t,a=e,o=s.getUtoTmapping(i,0),l=function(c,h,d,u,p=.5){let f=Ic.subVectors(h,c).multiplyScalar(p).add(c),g=Kg.subVectors(d,h).multiplyScalar(p).add(h),m=Uk.subVectors(u,d).multiplyScalar(p).add(d),v=f,y=zk.subVectors(g,f).multiplyScalar(p).add(f),_=Fk.subVectors(m,g).multiplyScalar(p).add(g),b=m,x=Nk.subVectors(_,y).multiplyScalar(p).add(y);return[c.x,c.y,v.x,v.y,y.x,y.y,x.x,x.y,_.x,_.y,b.x,b.y,u.x,u.y]}(s.v0,s.v1,s.v2,s.v3,o);return n!==void 0&&(a.v0.set(l[0],l[1]),a.v1.set(l[2],l[3]),a.v2.set(l[4],l[5]),a.v3.set(l[6],l[7])),r!==void 0&&(a.v0.set(l[6],l[7]),a.v1.set(l[8],l[9]),a.v2.set(l[10],l[11]),a.v3.set(l[12],l[13])),a}return n!==void 0&&e.v2.copy(n),r!==void 0&&e.v1.copy(r),e}clone(){let t=new ki(this._width,this._height);return t.points=this.points.map(e=>e.clone()),t.isClosed=this.isClosed,t.roundness=this.roundness,t.isMesh2D=this.isMesh2D,t.shapeHoles=this.shapeHoles.map(e=>e.clone()),t}toJSON(){return{points:this.points.reduce((t,e)=>t.concat(e.toJSON()),[]),shapeHoles:this.shapeHoles.map(t=>t.toJSON()),isClosed:this.isClosed,roundness:this.roundness}}fromJSON(t){this.points=[],this.pointIDs=0;let e=t.points.length/7;for(let i=0;i<e;i++){let n=7*i,r=t.points[n+0],s=t.points[n+1],a=t.points[n+2],o=t.points[n+3],l=t.points[n+4],c=t.points[n+5],h=t.points[n+6],d=new Vc(Ot.generateUUID(),new et(r,s));d.controls[0].position.set(a,o),d.controls[1].position.set(l,c),d.roundness=h,this.points.push(d)}return this.shapeHoles=t.shapeHoles?.length?t.shapeHoles.map(i=>{let n=new ki;return n.fromJSON(i),n}):[],this.isClosed=t.isClosed,this._roundness=t.roundness,this._update(),this}fromShape(t,e=!1){this.isText=e;let i=(n,r)=>{r instanceof Fs&&r.v3.equals(n.position)&&n.controls[0].position.copy(r.v2)};return this.points=(n=>{let r,s,a=[];for(r=0,s=n.length;r<s;r++)n[r]instanceof $o&&(n[r]=IY(n[r]));for(r=0,s=n.length;r<s;r++){let c,h=n[r],d=r>0?n[r-1]:null;h instanceof Fs?(c=this.createPoint(h.v0),c.controls[1].position.copy(h.v1)):h instanceof fs&&(c=this.createPoint(h.v1)),c!==void 0&&(d!==null&&i(c,d),a.push(c))}let o=n[n.length-1],l=!1;return o instanceof Fs?o.v3.equals(a[0].position)&&(a[0].controls[0].position.copy(o.v2),l=!0):o instanceof fs&&o.v2.equals(a[0].position)&&(l=!0),this.isClosed=l,a})(t.curves),t instanceof Ug&&(this.shapeHoles=t.holes.map(n=>{let r=new ki;return r.fromShape(n),r})),this.update(),this}updatePoint(t,e){let i=this.getPointByUuid(t);i&&(e.position!==void 0&&i.position.fromArray(e.position),e.roundness!==void 0&&(i.roundness=e.roundness),e.areControlsDirectionsMirrored!==void 0&&(i.areControlsDirectionsMirrored=e.areControlsDirectionsMirrored),this.needsUpdate=!0)}updatePreviousControl(t,e){let i=this.getPointByUuid(t)?.controls[0];i&&(e.position&&i.position.fromArray(e.position),this.needsUpdate=!0)}updateNextControl(t,e){let i=this.getPointByUuid(t)?.controls[1];i&&(e.position&&i.position.fromArray(e.position),this.needsUpdate=!0)}}});function n2({x:t,y:e},i,n,r,s){return{x:t*i+r,y:e*n+s}}function NY(t,e){let i=e===1.5707963267948966?.551915024494:e===-1.5707963267948966?-.551915024494:1.3333333333333333*Math.tan(e/4),n=Math.cos(t),r=Math.sin(t),s=Math.cos(t+e),a=Math.sin(t+e);return[{x:n-r*i,y:r+n*i},{x:s+a*i,y:a-s*i},{x:s,y:a}]}function G4(t,e,i,n){let r=t*n-e*i<0?-1:1,s=Math.min(1,Math.max(-1,t*i+e*n));return r*Math.acos(s)}var L1,kY=z(()=>{L1=2*Math.PI});function he(t,e){if(!t)throw e||"Assertion Failed!"}function _g(t){var e=t.windingRule,i=e===void 0?Oi.ODD:e,n=t.elementType,r=n===void 0?vr.POLYGONS:n,s=t.polySize,a=s===void 0?3:s,o=t.vertexSize,l=o===void 0?2:o,c=t.normal,h=c===void 0?[0,0,1]:c,d=t.contours,u=d===void 0?[]:d,p=t.strict,f=p===void 0||p,g=t.debug,m=g!==void 0&&g;if(!u&&f)throw new Error("Contours can't be empty");if(u){var v=new Vk;t.edgeCreateCallback&&(v.edgeCreateCallback=t.edgeCreateCallback),t.vertexIdCallback&&(v.vertexIdCallback=t.vertexIdCallback);for(var y=0;y<u.length;y++)v.addContour(l||2,u[y]);return v.tesselate(i,r,a,l,h,f),{vertices:v.vertices,vertexIndices:v.vertexIndices,vertexCount:v.vertexCount,elements:v.elements,elementCount:v.elementCount,mesh:m?v.mesh:void 0}}}var Oi,vr,re,kd,Vf,tc,r2,s2,a2,H4,Fv,o2,W4,q4,Vk,h0=z(()=>{var t;(t=Oi||(Oi={}))[t.ODD=0]="ODD",t[t.NONZERO=1]="NONZERO",t[t.POSITIVE=2]="POSITIVE",t[t.NEGATIVE=3]="NEGATIVE",t[t.ABS_GEQ_TWO=4]="ABS_GEQ_TWO",function(e){e[e.POLYGONS=0]="POLYGONS",e[e.CONNECTED_POLYGONS=1]="CONNECTED_POLYGONS",e[e.BOUNDARY_CONTOURS=2]="BOUNDARY_CONTOURS"}(vr||(vr={})),re=function(){function e(){}return e.vertEq=function(i,n){return i.s===n.s&&i.t===n.t},e.vertLeq=function(i,n){return i.s<n.s||i.s===n.s&&i.t<=n.t},e.transLeq=function(i,n){return i.t<n.t||i.t===n.t&&i.s<=n.s},e.edgeGoesLeft=function(i){return e.vertLeq(i.Dst,i.Org)},e.edgeGoesRight=function(i){return e.vertLeq(i.Org,i.Dst)},e.vertL1dist=function(i,n){return Math.abs(i.s-n.s)+Math.abs(i.t-n.t)},e.edgeEval=function(i,n,r){he(e.vertLeq(i,n)&&e.vertLeq(n,r));var s=n.s-i.s,a=r.s-n.s;return s+a>0?s<a?n.t-i.t+(i.t-r.t)*(s/(s+a)):n.t-r.t+(r.t-i.t)*(a/(s+a)):0},e.edgeSign=function(i,n,r){he(e.vertLeq(i,n)&&e.vertLeq(n,r));var s=n.s-i.s,a=r.s-n.s;return s+a>0?(n.t-r.t)*s+(n.t-i.t)*a:0},e.transEval=function(i,n,r){he(e.transLeq(i,n)&&e.transLeq(n,r));var s=n.t-i.t,a=r.t-n.t;return s+a>0?s<a?n.s-i.s+(i.s-r.s)*(s/(s+a)):n.s-r.s+(r.s-i.s)*(a/(s+a)):0},e.transSign=function(i,n,r){he(e.transLeq(i,n)&&e.transLeq(n,r));var s=n.t-i.t,a=r.t-n.t;return s+a>0?(n.s-r.s)*s+(n.s-i.s)*a:0},e.vertCCW=function(i,n,r){return i.s*(n.t-r.t)+n.s*(r.t-i.t)+r.s*(i.t-n.t)>=0},e.interpolate=function(i,n,r,s){return(i=i<0?0:i)<=(r=r<0?0:r)?r===0?(n+s)/2:n+i/(i+r)*(s-n):s+r/(i+r)*(n-s)},e.intersect=function(i,n,r,s,a){var o,l,c;e.vertLeq(i,n)||(c=i,i=n,n=c),e.vertLeq(r,s)||(c=r,r=s,s=c),e.vertLeq(i,r)||(c=i,i=r,r=c,c=n,n=s,s=c),e.vertLeq(r,n)?e.vertLeq(n,s)?((o=e.edgeEval(i,r,n))+(l=e.edgeEval(r,n,s))<0&&(o=-o,l=-l),a.s=e.interpolate(o,r.s,l,n.s)):((o=e.edgeSign(i,r,n))+(l=-e.edgeSign(i,s,n))<0&&(o=-o,l=-l),a.s=e.interpolate(o,r.s,l,s.s)):a.s=(r.s+n.s)/2,e.transLeq(i,n)||(c=i,i=n,n=c),e.transLeq(r,s)||(c=r,r=s,s=c),e.transLeq(i,r)||(c=i,i=r,r=c,c=n,n=s,s=c),e.transLeq(r,n)?e.transLeq(n,s)?((o=e.transEval(i,r,n))+(l=e.transEval(r,n,s))<0&&(o=-o,l=-l),a.t=e.interpolate(o,r.t,l,n.t)):((o=e.transSign(i,r,n))+(l=-e.transSign(i,s,n))<0&&(o=-o,l=-l),a.t=e.interpolate(o,r.t,l,s.t)):a.t=(r.t+n.t)/2},e}(),kd=function(){this.next=null,this.prev=null,this.anEdge=null,this.trail=null,this.n=0,this.marked=!1,this.inside=!1},Vf=function(){function e(i){this.side=i,this.next=null,this.Org=null,this.Sym=null,this.Onext=null,this.Lnext=null,this.Lface=null,this.activeRegion=null,this.winding=0}return Object.defineProperty(e.prototype,"Rface",{get:function(){return this.Sym.Lface},set:function(i){this.Sym.Lface=i},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"Dst",{get:function(){return this.Sym.Org},set:function(i){this.Sym.Org=i},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"Oprev",{get:function(){return this.Sym.Lnext},set:function(i){this.Sym.Lnext=i},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"Lprev",{get:function(){return this.Onext.Sym},set:function(i){this.Onext.Sym=i},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"Dprev",{get:function(){return this.Lnext.Sym},set:function(i){this.Lnext.Sym=i},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"Rprev",{get:function(){return this.Sym.Onext},set:function(i){this.Sym.Onext=i},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"Dnext",{get:function(){return this.Sym.Onext.Sym},set:function(i){this.Sym.Onext.Sym=i},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"Rnext",{get:function(){return this.Sym.Lnext.Sym},set:function(i){this.Sym.Lnext.Sym=i},enumerable:!0,configurable:!0}),e}(),tc=function(){this.next=null,this.prev=null,this.anEdge=null,this.coords=[0,0,0],this.s=0,this.t=0,this.pqHandle=0,this.n=0,this.idx=0},r2=function(){function e(){var i=new tc,n=new kd,r=new Vf(0),s=new Vf(1);i.next=i.prev=i,i.anEdge=null,n.next=n.prev=n,r.next=r,r.Sym=s,s.next=s,s.Sym=r,this.vHead=i,this.fHead=n,this.eHead=r,this.eHeadSym=s}return e.prototype.makeEdge_=function(i){var n=new Vf(0),r=new Vf(1);i.Sym.side<i.side&&(i=i.Sym);var s=i.Sym.next;return r.next=s,s.Sym.next=n,n.next=i,i.Sym.next=r,n.Sym=r,n.Onext=n,n.Lnext=r,n.Org=null,n.Lface=null,n.winding=0,n.activeRegion=null,r.Sym=n,r.Onext=r,r.Lnext=n,r.Org=null,r.Lface=null,r.winding=0,r.activeRegion=null,n},e.prototype.splice_=function(i,n){var r=i.Onext,s=n.Onext;r.Sym.Lnext=n,s.Sym.Lnext=i,i.Onext=s,n.Onext=r},e.prototype.makeVertex_=function(i,n,r){var s=i;he(s,"Vertex can't be null!");var a=r.prev;s.prev=a,a.next=s,s.next=r,r.prev=s,s.anEdge=n;var o=n;do o.Org=s,o=o.Onext;while(o!==n)},e.prototype.makeFace_=function(i,n,r){var s=i;he(s,"Face can't be null");var a=r.prev;s.prev=a,a.next=s,s.next=r,r.prev=s,s.anEdge=n,s.trail=null,s.marked=!1,s.inside=r.inside;var o=n;do o.Lface=s,o=o.Lnext;while(o!==n)},e.prototype.killEdge_=function(i){i.Sym.side<i.side&&(i=i.Sym);var n=i.next,r=i.Sym.next;n.Sym.next=r,r.Sym.next=n},e.prototype.killVertex_=function(i,n){var r=i.anEdge,s=r;do s.Org=n,s=s.Onext;while(s!==r);var a=i.prev,o=i.next;o.prev=a,a.next=o},e.prototype.killFace_=function(i,n){var r=i.anEdge,s=r;do s.Lface=n,s=s.Lnext;while(s!==r);var a=i.prev,o=i.next;o.prev=a,a.next=o},e.prototype.makeEdge=function(){var i=new tc,n=new tc,r=new kd,s=this.makeEdge_(this.eHead);return this.makeVertex_(i,s,this.vHead),this.makeVertex_(n,s.Sym,this.vHead),this.makeFace_(r,s,this.fHead),s},e.prototype.splice=function(i,n){var r=!1,s=!1;if(i!==n){if(n.Org!==i.Org&&(s=!0,this.killVertex_(n.Org,i.Org)),n.Lface!==i.Lface&&(r=!0,this.killFace_(n.Lface,i.Lface)),this.splice_(n,i),!s){var a=new tc;this.makeVertex_(a,n,i.Org),i.Org.anEdge=i}if(!r){var o=new kd;this.makeFace_(o,n,i.Lface),i.Lface.anEdge=i}}},e.prototype.delete=function(i){var n=i.Sym,r=!1;if(i.Lface!==i.Rface&&(r=!0,this.killFace_(i.Lface,i.Rface)),i.Onext===i)this.killVertex_(i.Org,null);else if(i.Rface.anEdge=i.Oprev,i.Org.anEdge=i.Onext,this.splice_(i,i.Oprev),!r){var s=new kd;this.makeFace_(s,i,i.Lface)}n.Onext===n?(this.killVertex_(n.Org,null),this.killFace_(n.Lface,null)):(i.Lface.anEdge=n.Oprev,n.Org.anEdge=n.Onext,this.splice_(n,n.Oprev)),this.killEdge_(i)},e.prototype.addEdgeVertex=function(i){var n=this.makeEdge_(i),r=n.Sym;this.splice_(n,i.Lnext),n.Org=i.Dst;var s=new tc;return this.makeVertex_(s,r,n.Org),n.Lface=r.Lface=i.Lface,n},e.prototype.splitEdge=function(i){var n=this.addEdgeVertex(i).Sym;return this.splice_(i.Sym,i.Sym.Oprev),this.splice_(i.Sym,n),i.Dst=n.Org,n.Dst.anEdge=n.Sym,n.Rface=i.Rface,n.winding=i.winding,n.Sym.winding=i.Sym.winding,n.idx=i.idx,n.Sym.idx=i.Sym.idx,n},e.prototype.connect=function(i,n){var r=!1,s=this.makeEdge_(i),a=s.Sym;if(n.Lface!==i.Lface&&(r=!0,this.killFace_(n.Lface,i.Lface)),this.splice_(s,i.Lnext),this.splice_(a,n),s.Org=i.Dst,a.Org=n.Org,s.Lface=a.Lface=i.Lface,i.Lface.anEdge=a,!r){var o=new kd;this.makeFace_(o,s,i.Lface)}return s},e.prototype.zapFace=function(i){var n,r,s,a,o,l=i.anEdge;r=l.Lnext;do r=(n=r).Lnext,n.Lface=null,n.Rface===null&&(n.Onext===n?this.killVertex_(n.Org,null):(n.Org.anEdge=n.Onext,this.splice_(n,n.Oprev)),(s=n.Sym).Onext===s?this.killVertex_(s.Org,null):(s.Org.anEdge=s.Onext,this.splice_(s,s.Oprev)),this.killEdge_(n));while(n!=l);a=i.prev,(o=i.next).prev=a,a.next=o},e.prototype.countFaceVerts_=function(i){var n=i.anEdge,r=0;do r++,n=n.Lnext;while(n!==i.anEdge);return r},e.prototype.mergeConvexFaces=function(i){var n,r,s,a,o;for(n=this.fHead.next;n!==this.fHead;n=n.next)if(n.inside)for(o=(r=n.anEdge).Org;s=r.Lnext,(a=r.Sym)&&a.Lface&&a.Lface.inside&&this.countFaceVerts_(n)+this.countFaceVerts_(a.Lface)-2<=i&&re.vertCCW(r.Lprev.Org,r.Org,a.Lnext.Lnext.Org)&&re.vertCCW(a.Lprev.Org,a.Org,r.Lnext.Lnext.Org)&&(s=a.Lnext,this.delete(a),r=null,a=null),!r||r.Lnext.Org!==o;)r=s;return!0},e.prototype.check=function(){var i,n,r,s,a,o,l=this.fHead,c=this.vHead,h=this.eHead;for(n=l,n=l;(i=n.next)!==l;n=i){he(i.prev===n),a=i.anEdge;do he(a.Sym!==a),he(a.Sym.Sym===a),he(a.Lnext.Onext.Sym===a),he(a.Onext.Sym.Lnext===a),he(a.Lface===i),a=a.Lnext;while(a!==i.anEdge)}for(he(i.prev===n&&i.anEdge===null),s=c,s=c;(r=s.next)!==c;s=r){he(r.prev===s),a=r.anEdge;do he(a.Sym!==a),he(a.Sym.Sym===a),he(a.Lnext.Onext.Sym===a),he(a.Onext.Sym.Lnext===a),he(a.Org===r),a=a.Onext;while(a!==r.anEdge)}for(he(r.prev===s&&r.anEdge===null),o=h,o=h;(a=o.next)!==h;o=a)he(a.Sym.next===o.Sym),he(a.Sym!==a),he(a.Sym.Sym===a),he(a.Org!==null),he(a.Dst!==null),he(a.Lnext.Onext.Sym===a),he(a.Onext.Sym.Lnext===a);he(a.Sym.next===o.Sym&&a.Sym===this.eHeadSym&&a.Sym.Sym===a&&a.Org===null&&a.Dst===null&&a.Lface===null&&a.Rface===null)},e}(),s2=function(){this.handle=null},a2=function(){this.key=null,this.node=0},H4=function(){function e(i,n){this.leq=n,this.max=0,this.nodes=[],this.handles=[],this.initialized=!1,this.freeList=0,this.size=0,this.max=i,this.nodes=[],this.handles=[];for(var r=0;r<i+1;r++)this.nodes[r]=new s2,this.handles[r]=new a2;this.initialized=!1,this.nodes[1].handle=1,this.handles[1].key=null}return e.prototype.floatDown_=function(i){var n,r,s,a=this.nodes,o=this.handles;for(n=a[i].handle;;){if((s=i<<1)<this.size&&this.leq(o[a[s+1].handle].key,o[a[s].handle].key)&&++s,he(s<=this.max),r=a[s].handle,s>this.size||this.leq(o[n].key,o[r].key)){a[i].handle=n,o[n].node=i;break}a[i].handle=r,o[r].node=i,i=s}},e.prototype.floatUp_=function(i){var n,r,s,a=this.nodes,o=this.handles;for(n=a[i].handle;;){if(r=a[s=i>>1].handle,s===0||this.leq(o[r].key,o[n].key)){a[i].handle=n,o[n].node=i;break}a[i].handle=r,o[r].node=i,i=s}},e.prototype.init=function(){for(var i=this.size;i>=1;--i)this.floatDown_(i);this.initialized=!0},e.prototype.min=function(){return this.handles[this.nodes[1].handle].key},e.prototype.insert=function(i){var n,r;if(2*(n=++this.size)>this.max){var s,a;for(this.max*=2,a=this.nodes.length,this.nodes.length=this.max+1,s=a;s<this.nodes.length;s++)this.nodes[s]=new s2;for(a=this.handles.length,this.handles.length=this.max+1,s=a;s<this.handles.length;s++)this.handles[s]=new a2}return this.freeList===0?r=n:(r=this.freeList,this.freeList=this.handles[r].node),this.nodes[n].handle=r,this.handles[r].node=n,this.handles[r].key=i,this.initialized&&this.floatUp_(n),r},e.prototype.extractMin=function(){var i=this.nodes,n=this.handles,r=i[1].handle,s=n[r].key;return this.size>0&&(i[1].handle=i[this.size].handle,n[i[1].handle].node=1,n[r].key=null,n[r].node=this.freeList,this.freeList=r,--this.size,this.size>0&&this.floatDown_(1)),s},e.prototype.delete=function(i){var n,r=this.nodes,s=this.handles;he(i>=1&&i<=this.max&&s[i].key!==null),r[n=s[i].node].handle=r[this.size].handle,s[r[n].handle].node=n,--this.size,n<=this.size&&(n<=1||this.leq(s[r[n>>1].handle].key,s[r[n].handle].key)?this.floatDown_(n):this.floatUp_(n)),s[i].key=null,s[i].node=this.freeList,this.freeList=i},e}(),Fv=function(){this.eUp=null,this.nodeUp=null,this.windingNumber=0,this.inside=!1,this.sentinel=!1,this.dirty=!1,this.fixUpperEdge=!1},o2=function(){this.key=null,this.next=null,this.prev=null},W4=function(){function e(i,n){this.frame=i,this.leq=n,this.head=new o2,this.head.next=this.head,this.head.prev=this.head}return e.prototype.min=function(){return this.head.next},e.prototype.max=function(){return this.head.prev},e.prototype.insert=function(i){return this.insertBefore(this.head,i)},e.prototype.search=function(i){var n=this.head;do n=n.next;while(n.key!==null&&!this.leq(this.frame,i,n.key));return n},e.prototype.insertBefore=function(i,n){do i=i.prev;while(i.key!==null&&!this.leq(this.frame,i.key,n));var r=new o2;return r.key=n,r.next=i.next,i.next.prev=r,r.prev=i,i.next=r,r},e.prototype.delete=function(i){i.next.prev=i.prev,i.prev.next=i.next},e}(),q4=function(){function e(){}return e.regionBelow=function(i){return i.nodeUp.prev.key},e.regionAbove=function(i){return i.nodeUp.next.key},e.debugEvent=function(i){},e.addWinding=function(i,n){i.winding+=n.winding,i.Sym.winding+=n.Sym.winding},e.edgeLeq=function(i,n,r){var s=i.event,a=n.eUp,o=r.eUp;return a.Dst===s?o.Dst===s?re.vertLeq(a.Org,o.Org)?re.edgeSign(o.Dst,a.Org,o.Org)<=0:re.edgeSign(a.Dst,o.Org,a.Org)>=0:re.edgeSign(o.Dst,s,o.Org)<=0:o.Dst===s?re.edgeSign(a.Dst,s,a.Org)>=0:re.edgeEval(a.Dst,s,a.Org)>=re.edgeEval(o.Dst,s,o.Org)},e.deleteRegion=function(i,n){n.fixUpperEdge&&he(n.eUp.winding===0),n.eUp.activeRegion=null,i.dict.delete(n.nodeUp)},e.fixUpperEdge=function(i,n,r){he(n.fixUpperEdge),i.mesh.delete(n.eUp),n.fixUpperEdge=!1,n.eUp=r,r.activeRegion=n},e.topLeftRegion=function(i,n){var r,s=n.eUp.Org;do n=e.regionAbove(n);while(n.eUp.Org===s);if(n.fixUpperEdge){if((r=i.mesh.connect(e.regionBelow(n).eUp.Sym,n.eUp.Lnext))===null)return null;e.fixUpperEdge(i,n,r),n=e.regionAbove(n)}return n},e.topRightRegion=function(i){var n=i.eUp.Dst;do i=e.regionAbove(i);while(i.eUp.Dst===n);return i},e.addRegionBelow=function(i,n,r){var s=new Fv;return s.eUp=r,s.nodeUp=i.dict.insertBefore(n.nodeUp,s),s.fixUpperEdge=!1,s.sentinel=!1,s.dirty=!1,r.activeRegion=s,s},e.isWindingInside=function(i,n){switch(i.windingRule){case Oi.ODD:return!!(1&n);case Oi.NONZERO:return n!==0;case Oi.POSITIVE:return n>0;case Oi.NEGATIVE:return n<0;case Oi.ABS_GEQ_TWO:return n>=2||n<=-2}throw new Error("Invalid winding rulle")},e.computeWinding=function(i,n){n.windingNumber=e.regionAbove(n).windingNumber+n.eUp.winding,n.inside=e.isWindingInside(i,n.windingNumber)},e.finishRegion=function(i,n){var r=n.eUp,s=r.Lface;s.inside=n.inside,s.anEdge=r,e.deleteRegion(i,n)},e.finishLeftRegions=function(i,n,r){for(var s,a=null,o=n,l=n.eUp;o!==r;){if(o.fixUpperEdge=!1,(s=(a=e.regionBelow(o)).eUp).Org!=l.Org){if(!a.fixUpperEdge){e.finishRegion(i,o);break}s=i.mesh.connect(l.Lprev,s.Sym),e.fixUpperEdge(i,a,s)}l.Onext!==s&&(i.mesh.splice(s.Oprev,s),i.mesh.splice(l,s)),e.finishRegion(i,o),l=a.eUp,o=a}return l},e.addRightEdges=function(i,n,r,s,a,o){var l,c,h,d,u=!0;h=r;do he(re.vertLeq(h.Org,h.Dst)),e.addRegionBelow(i,n,h.Sym),h=h.Onext;while(h!==s);for(a===null&&(a=e.regionBelow(n).eUp.Rprev),c=n,d=a;(h=(l=e.regionBelow(c)).eUp.Sym).Org===d.Org;)h.Onext!==d&&(i.mesh.splice(h.Oprev,h),i.mesh.splice(d.Oprev,h)),l.windingNumber=c.windingNumber-h.winding,l.inside=e.isWindingInside(i,l.windingNumber),c.dirty=!0,!u&&e.checkForRightSplice(i,c)&&(e.addWinding(h,d),e.deleteRegion(i,c),i.mesh.delete(d)),u=!1,c=l,d=h;c.dirty=!0,he(c.windingNumber-h.winding===l.windingNumber),o&&e.walkDirtyRegions(i,c)},e.spliceMergeVertices=function(i,n,r){i.mesh.splice(n,r)},e.vertexWeights=function(i,n,r){var s=re.vertL1dist(n,i),a=re.vertL1dist(r,i),o=.5*a/(s+a),l=.5*s/(s+a);i.coords[0]+=o*n.coords[0]+l*r.coords[0],i.coords[1]+=o*n.coords[1]+l*r.coords[1],i.coords[2]+=o*n.coords[2]+l*r.coords[2]},e.getIntersectData=function(i,n,r,s,a,o){n.coords[0]=n.coords[1]=n.coords[2]=0,n.idx=-1,e.vertexWeights(n,r,s),e.vertexWeights(n,a,o)},e.checkForRightSplice=function(i,n){var r=e.regionBelow(n),s=n.eUp,a=r.eUp;if(re.vertLeq(s.Org,a.Org)){if(re.edgeSign(a.Dst,s.Org,a.Org)>0)return!1;re.vertEq(s.Org,a.Org)?s.Org!==a.Org&&(i.pq.delete(s.Org.pqHandle),e.spliceMergeVertices(i,a.Oprev,s)):(i.mesh.splitEdge(a.Sym),i.mesh.splice(s,a.Oprev),n.dirty=r.dirty=!0)}else{if(re.edgeSign(s.Dst,a.Org,s.Org)<0)return!1;e.regionAbove(n).dirty=n.dirty=!0,i.mesh.splitEdge(s.Sym),i.mesh.splice(a.Oprev,s)}return!0},e.checkForLeftSplice=function(i,n){var r,s=e.regionBelow(n),a=n.eUp,o=s.eUp;if(he(!re.vertEq(a.Dst,o.Dst)),re.vertLeq(a.Dst,o.Dst)){if(re.edgeSign(a.Dst,o.Dst,a.Org)<0)return!1;e.regionAbove(n).dirty=n.dirty=!0,r=i.mesh.splitEdge(a),i.mesh.splice(o.Sym,r),r.Lface.inside=n.inside}else{if(re.edgeSign(o.Dst,a.Dst,o.Org)>0)return!1;n.dirty=s.dirty=!0,r=i.mesh.splitEdge(o),i.mesh.splice(a.Lnext,o.Sym),r.Rface.inside=n.inside}return!0},e.checkForIntersect=function(i,n){var r,s,a=e.regionBelow(n),o=n.eUp,l=a.eUp,c=o.Org,h=l.Org,d=o.Dst,u=l.Dst,p=new tc;if(he(!re.vertEq(u,d)),he(re.edgeSign(d,i.event,c)<=0),he(re.edgeSign(u,i.event,h)>=0),he(c!==i.event&&h!==i.event),he(!n.fixUpperEdge&&!a.fixUpperEdge),c===h||Math.min(c.t,d.t)>Math.max(h.t,u.t))return!1;if(re.vertLeq(c,h)){if(re.edgeSign(u,c,h)>0)return!1}else if(re.edgeSign(d,h,c)<0)return!1;return e.debugEvent(i),re.intersect(d,c,u,h,p),he(Math.min(c.t,d.t)<=p.t),he(p.t<=Math.max(h.t,u.t)),he(Math.min(u.s,d.s)<=p.s),he(p.s<=Math.max(h.s,c.s)),re.vertLeq(p,i.event)&&(p.s=i.event.s,p.t=i.event.t),r=re.vertLeq(c,h)?c:h,re.vertLeq(r,p)&&(p.s=r.s,p.t=r.t),re.vertEq(p,c)||re.vertEq(p,h)?(e.checkForRightSplice(i,n),!1):!re.vertEq(d,i.event)&&re.edgeSign(d,i.event,p)>=0||!re.vertEq(u,i.event)&&re.edgeSign(u,i.event,p)<=0?u===i.event?(i.mesh.splitEdge(o.Sym),i.mesh.splice(l.Sym,o),n=e.topLeftRegion(i,n),o=e.regionBelow(n).eUp,e.finishLeftRegions(i,e.regionBelow(n),a),e.addRightEdges(i,n,o.Oprev,o,o,!0),!0):d===i.event?(i.mesh.splitEdge(l.Sym),i.mesh.splice(o.Lnext,l.Oprev),a=n,n=e.topRightRegion(n),s=e.regionBelow(n).eUp.Rprev,a.eUp=l.Oprev,l=e.finishLeftRegions(i,a,null),e.addRightEdges(i,n,l.Onext,o.Rprev,s,!0),!0):(re.edgeSign(d,i.event,p)>=0&&(e.regionAbove(n).dirty=n.dirty=!0,i.mesh.splitEdge(o.Sym),o.Org.s=i.event.s,o.Org.t=i.event.t),re.edgeSign(u,i.event,p)<=0&&(n.dirty=a.dirty=!0,i.mesh.splitEdge(l.Sym),l.Org.s=i.event.s,l.Org.t=i.event.t),!1):(i.mesh.splitEdge(o.Sym),i.mesh.splitEdge(l.Sym),i.mesh.splice(l.Oprev,o),o.Org.s=p.s,o.Org.t=p.t,o.Org.pqHandle=i.pq.insert(o.Org),e.getIntersectData(i,o.Org,c,d,h,u),e.regionAbove(n).dirty=n.dirty=a.dirty=!0,!1)},e.walkDirtyRegions=function(i,n){for(var r,s,a=e.regionBelow(n);;){for(;a.dirty;)n=a,a=e.regionBelow(a);if(!n.dirty&&(a=n,(n=e.regionAbove(n))===null||!n.dirty))return;if(n.dirty=!1,r=n.eUp,s=a.eUp,r.Dst!==s.Dst&&e.checkForLeftSplice(i,n)&&(a.fixUpperEdge?(e.deleteRegion(i,a),i.mesh.delete(s),s=(a=e.regionBelow(n)).eUp):n.fixUpperEdge&&(e.deleteRegion(i,n),i.mesh.delete(r),r=(n=e.regionAbove(a)).eUp)),r.Org!==s.Org){if(r.Dst===s.Dst||n.fixUpperEdge||a.fixUpperEdge||r.Dst!==i.event&&s.Dst!==i.event)e.checkForRightSplice(i,n);else if(e.checkForIntersect(i,n))return}r.Org===s.Org&&r.Dst===s.Dst&&(e.addWinding(s,r),e.deleteRegion(i,n),i.mesh.delete(r),n=e.regionAbove(a))}},e.connectRightVertex=function(i,n,r){var s,a=r.Onext,o=e.regionBelow(n),l=n.eUp,c=o.eUp,h=!1;l.Dst!==c.Dst&&e.checkForIntersect(i,n),re.vertEq(l.Org,i.event)&&(i.mesh.splice(a.Oprev,l),n=e.topLeftRegion(i,n),a=e.regionBelow(n).eUp,e.finishLeftRegions(i,e.regionBelow(n),o),h=!0),re.vertEq(c.Org,i.event)&&(i.mesh.splice(r,c.Oprev),r=e.finishLeftRegions(i,o,null),h=!0),h?e.addRightEdges(i,n,r.Onext,a,a,!0):(s=re.vertLeq(c.Org,l.Org)?c.Oprev:l,s=i.mesh.connect(r.Lprev,s),e.addRightEdges(i,n,s,s.Onext,s.Onext,!1),s.Sym.activeRegion.fixUpperEdge=!0,e.walkDirtyRegions(i,n))},e.connectLeftDegenerate=function(i,n,r){var s,a,o,l,c;return s=n.eUp,re.vertEq(s.Org,r)?(he(!1),void e.spliceMergeVertices(i,s,r.anEdge)):re.vertEq(s.Dst,r)?(he(!1),n=e.topRightRegion(n),a=l=(o=(c=e.regionBelow(n)).eUp.Sym).Onext,c.fixUpperEdge&&(he(a!==o),e.deleteRegion(i,c),i.mesh.delete(o),o=a.Oprev),i.mesh.splice(r.anEdge,o),re.edgeGoesLeft(a)||(a=null),void e.addRightEdges(i,n,o.Onext,l,a,!0)):(i.mesh.splitEdge(s.Sym),n.fixUpperEdge&&(i.mesh.delete(s.Onext),n.fixUpperEdge=!1),i.mesh.splice(r.anEdge,s),void e.sweepEvent(i,r))},e.connectLeftVertex=function(i,n){var r,s,a,o,l,c,h=new Fv;if(h.eUp=n.anEdge.Sym,r=i.dict.search(h).key,s=e.regionBelow(r)){if(o=r.eUp,l=s.eUp,re.edgeSign(o.Dst,n,o.Org)===0)return void e.connectLeftDegenerate(i,r,n);a=re.vertLeq(l.Dst,o.Dst)?r:s,r.inside||a.fixUpperEdge?(c=a===r?i.mesh.connect(n.anEdge.Sym,o.Lnext):i.mesh.connect(l.Dnext,n.anEdge).Sym,a.fixUpperEdge?e.fixUpperEdge(i,a,c):e.computeWinding(i,e.addRegionBelow(i,r,c)),e.sweepEvent(i,n)):e.addRightEdges(i,r,n.anEdge,n.anEdge,null,!0)}},e.sweepEvent=function(i,n){i.event=n,e.debugEvent(i);for(var r=n.anEdge;r.activeRegion===null;)if((r=r.Onext)===n.anEdge)return void e.connectLeftVertex(i,n);var s=e.topLeftRegion(i,r.activeRegion);he(s!==null);var a=e.regionBelow(s),o=a.eUp,l=e.finishLeftRegions(i,a,null);l.Onext===o?e.connectRightVertex(i,s,l):e.addRightEdges(i,s,l.Onext,o,o,!0)},e.addSentinel=function(i,n,r,s){var a=new Fv,o=i.mesh.makeEdge();o.Org.s=r,o.Org.t=s,o.Dst.s=n,o.Dst.t=s,i.event=o.Dst,a.eUp=o,a.windingNumber=0,a.inside=!1,a.fixUpperEdge=!1,a.sentinel=!0,a.dirty=!1,a.nodeUp=i.dict.insert(a)},e.initEdgeDict=function(i){i.dict=new W4(i,e.edgeLeq);var n=i.bmax[0]-i.bmin[0],r=i.bmax[1]-i.bmin[1],s=i.bmin[0]-n,a=i.bmax[0]+n,o=i.bmin[1]-r,l=i.bmax[1]+r;e.addSentinel(i,s,a,o),e.addSentinel(i,s,a,l)},e.doneEdgeDict=function(i){for(var n,r=0;(n=i.dict.min().key)!==null;)n.sentinel||(he(n.fixUpperEdge),he(++r===1)),he(n.windingNumber===0),e.deleteRegion(i,n)},e.removeDegenerateEdges=function(i){var n,r,s,a=i.mesh.eHead;for(n=a.next;n!==a;n=r)r=n.next,s=n.Lnext,re.vertEq(n.Org,n.Dst)&&n.Lnext.Lnext!==n&&(e.spliceMergeVertices(i,s,n),i.mesh.delete(n),s=(n=s).Lnext),s.Lnext===n&&(s!==n&&((s===r||s===r.Sym)&&(r=r.next),i.mesh.delete(s)),(n===r||n===r.Sym)&&(r=r.next),i.mesh.delete(n))},e.initPriorityQ=function(i){var n,r,s,a=0;for(r=(s=i.mesh.vHead).next;r!==s;r=r.next)a++;for(a+=8,n=i.pq=new H4(a,re.vertLeq),r=(s=i.mesh.vHead).next;r!==s;r=r.next)r.pqHandle=n.insert(r);return r===s&&(n.init(),!0)},e.donePriorityQ=function(i){i.pq=null},e.removeDegenerateFaces=function(i,n){var r,s,a;for(r=n.fHead.next;r!==n.fHead;r=s)s=r.next,he((a=r.anEdge).Lnext!==a),a.Lnext.Lnext===a&&(e.addWinding(a.Onext,a),i.mesh.delete(a));return!0},e.computeInterior=function(i,n){var r,s;if(n===void 0&&(n=!0),e.removeDegenerateEdges(i),!e.initPriorityQ(i))return!1;for(e.initEdgeDict(i);(r=i.pq.extractMin())!==null;){for(;(s=i.pq.min())!==null&&re.vertEq(s,r);)s=i.pq.extractMin(),e.spliceMergeVertices(i,r.anEdge,s.anEdge);e.sweepEvent(i,r)}return i.event=i.dict.min().key.eUp.Org,e.debugEvent(i),e.doneEdgeDict(i),e.donePriorityQ(i),!!e.removeDegenerateFaces(i,i.mesh)&&(n&&i.mesh.check(),!0)},e}(),Vk=function(){function e(){this.mesh=new r2,this.normal=[0,0,0],this.sUnit=[0,0,0],this.tUnit=[0,0,0],this.bmin=[0,0],this.bmax=[0,0],this.windingRule=Oi.ODD,this.dict=null,this.pq=null,this.event=null,this.vertexIndexCounter=0,this.vertices=[],this.vertexIndices=[],this.vertexCount=0,this.elements=[],this.elementCount=0}return e.prototype.dot_=function(i,n){return i[0]*n[0]+i[1]*n[1]+i[2]*n[2]},e.prototype.normalize_=function(i){var n=i[0]*i[0]+i[1]*i[1]+i[2]*i[2];if(!n)throw"Zero-size vector!";n=Math.sqrt(n),i[0]/=n,i[1]/=n,i[2]/=n},e.prototype.longAxis_=function(i){var n=0;return Math.abs(i[1])>Math.abs(i[0])&&(n=1),Math.abs(i[2])>Math.abs(i[n])&&(n=2),n},e.prototype.computeNormal_=function(i){var n,r,s,a,o,l,c=[0,0,0],h=[0,0,0],d=[0,0,0],u=[0,0,0],p=[0,0,0],f=[null,null,null],g=[null,null,null],m=this.mesh.vHead;n=m.next;for(var v=0;v<3;++v)a=n.coords[v],h[v]=a,g[v]=n,c[v]=a,f[v]=n;for(n=m.next;n!==m;n=n.next)for(var y=0;y<3;++y)(a=n.coords[y])<h[y]&&(h[y]=a,g[y]=n),a>c[y]&&(c[y]=a,f[y]=n);var _=0;if(c[1]-h[1]>c[0]-h[0]&&(_=1),c[2]-h[2]>c[_]-h[_]&&(_=2),h[_]>=c[_])return i[0]=0,i[1]=0,void(i[2]=1);for(l=0,r=g[_],s=f[_],d[0]=r.coords[0]-s.coords[0],d[1]=r.coords[1]-s.coords[1],d[2]=r.coords[2]-s.coords[2],n=m.next;n!==m;n=n.next)u[0]=n.coords[0]-s.coords[0],u[1]=n.coords[1]-s.coords[1],u[2]=n.coords[2]-s.coords[2],p[0]=d[1]*u[2]-d[2]*u[1],p[1]=d[2]*u[0]-d[0]*u[2],p[2]=d[0]*u[1]-d[1]*u[0],(o=p[0]*p[0]+p[1]*p[1]+p[2]*p[2])>l&&(l=o,i[0]=p[0],i[1]=p[1],i[2]=p[2]);l<=0&&(i[0]=i[1]=i[2]=0,i[this.longAxis_(d)]=1)},e.prototype.checkOrientation_=function(){for(var i,n,r=this.mesh.fHead,s=this.mesh.vHead,a=0,o=r.next;o!==r;o=o.next)if(!((n=o.anEdge).winding<=0))do a+=(n.Org.s-n.Dst.s)*(n.Org.t+n.Dst.t),n=n.Lnext;while(n!==o.anEdge);if(a<0){for(i=s.next;i!==s;i=i.next)i.t=-i.t;this.tUnit[0]=-this.tUnit[0],this.tUnit[1]=-this.tUnit[1],this.tUnit[2]=-this.tUnit[2]}},e.prototype.projectPolygon_=function(){var i,n,r=this.mesh.vHead,s=[0,0,0],a=!1;s[0]=this.normal[0],s[1]=this.normal[1],s[2]=this.normal[2],!s[0]&&!s[1]&&!s[2]&&(this.computeNormal_(s),a=!0),i=this.sUnit,n=this.tUnit;var o=this.longAxis_(s);i[o]=0,i[(o+1)%3]=1,i[(o+2)%3]=0,n[o]=0,n[(o+1)%3]=0,n[(o+2)%3]=s[o]>0?1:-1;for(var l=r.next;l!==r;l=l.next)l.s=this.dot_(l.coords,i),l.t=this.dot_(l.coords,n);a&&this.checkOrientation_();for(var c=!0,h=r.next;h!==r;h=h.next)c?(this.bmin[0]=this.bmax[0]=h.s,this.bmin[1]=this.bmax[1]=h.t,c=!1):(h.s<this.bmin[0]&&(this.bmin[0]=h.s),h.s>this.bmax[0]&&(this.bmax[0]=h.s),h.t<this.bmin[1]&&(this.bmin[1]=h.t),h.t>this.bmax[1]&&(this.bmax[1]=h.t))},e.prototype.addWinding_=function(i,n){i.winding+=n.winding,i.Sym.winding+=n.Sym.winding},e.prototype.tessellateMonoRegion_=function(i,n){var r,s;if((r=n.anEdge).Lnext===r||r.Lnext.Lnext===r)throw"Mono region invalid";for(;re.vertLeq(r.Dst,r.Org);r=r.Lprev);for(;re.vertLeq(r.Org,r.Dst);r=r.Lnext);for(s=r.Lprev;r.Lnext!==s;)if(re.vertLeq(r.Dst,s.Org)){for(;s.Lnext!==r&&(re.edgeGoesLeft(s.Lnext)||re.edgeSign(s.Org,s.Dst,s.Lnext.Dst)<=0);)s=i.connect(s.Lnext,s).Sym;s=s.Lprev}else{for(;s.Lnext!==r&&(re.edgeGoesRight(r.Lprev)||re.edgeSign(r.Dst,r.Org,r.Lprev.Org)>=0);)r=i.connect(r,r.Lprev).Sym;r=r.Lnext}if(s.Lnext===r)throw"Mono region invalid";for(;s.Lnext.Lnext!==r;)s=i.connect(s.Lnext,s).Sym;return!0},e.prototype.tessellateInterior_=function(i){for(var n,r=i.fHead.next;r!==i.fHead;r=n)if(n=r.next,r.inside&&!this.tessellateMonoRegion_(i,r))return!1;return!0},e.prototype.discardExterior_=function(i){for(var n,r=i.fHead.next;r!==i.fHead;r=n)n=r.next,r.inside||i.zapFace(r)},e.prototype.setWindingNumber_=function(i,n,r){for(var s,a=i.eHead.next;a!==i.eHead;a=s)s=a.next,a.Rface.inside!==a.Lface.inside?a.winding=a.Lface.inside?n:-n:r?i.delete(a):a.winding=0},e.prototype.getNeighbourFace_=function(i){return i.Rface&&i.Rface.inside?i.Rface.n:-1},e.prototype.outputPolymesh_=function(i,n,r,s){var a,o,l=0,c=0;r>3&&i.mergeConvexFaces(r);for(var h=i.vHead.next;h!==i.vHead;h=h.next)h.n=-1;for(var d=i.fHead.next;d!==i.fHead;d=d.next)if(d.n=-1,d.inside){a=d.anEdge,o=0;do(h=a.Org).n===-1&&(h.n=c,c++),o++,a=a.Lnext;while(a!==d.anEdge);if(o>r)throw"Face vertex greater that support polygon";d.n=l,++l}for(this.elementCount=l,n===vr.CONNECTED_POLYGONS&&(l*=2),this.elements=[],this.elements.length=l*r,this.vertexCount=c,this.vertices=[],this.vertices.length=c*s,this.vertexIndices=[],this.vertexIndices.length=c,h=i.vHead.next;h!==i.vHead;h=h.next)if(h.n!==-1){var u=h.n*s;this.vertices[u+0]=h.coords[0],this.vertices[u+1]=h.coords[1],s>2&&(this.vertices[u+2]=h.coords[2]),this.vertexIndices[h.n]=h.idx}var p=0;for(d=i.fHead.next;d!==i.fHead;d=d.next)if(d.inside){a=d.anEdge,o=0;do h=a.Org,this.elements[p++]=h.n,o++,a=a.Lnext;while(a!==d.anEdge);for(var f=o;f<r;++f)this.elements[p++]=-1;if(n===vr.CONNECTED_POLYGONS){a=d.anEdge;do this.elements[p++]=this.getNeighbourFace_(a),a=a.Lnext;while(a!==d.anEdge);for(var g=o;g<r;++g)this.elements[p++]=-1}}},e.prototype.outputContours_=function(i,n){var r,s,a=0,o=0;this.vertexCount=0,this.elementCount=0;for(var l=i.fHead.next;l!==i.fHead;l=l.next)if(l.inside){s=r=l.anEdge;do this.vertexCount++,r=r.Lnext;while(r!==s);this.elementCount++}this.elements=[],this.elements.length=2*this.elementCount,this.vertices=[],this.vertices.length=this.vertexCount*n,this.vertexIndices=[],this.vertexIndices.length=this.vertexCount;var c=0,h=0,d=0;for(a=0,l=i.fHead.next;l!==i.fHead;l=l.next)if(l.inside){o=0,s=r=l.anEdge;do this.vertices[c++]=r.Org.coords[0],this.vertices[c++]=r.Org.coords[1],n>2&&(this.vertices[c++]=r.Org.coords[2]),this.vertexIndices[h++]=this.vertexIdCallback?this.vertexIdCallback(r):r.Org.idx,o++,r=r.Lnext;while(r!==s);this.elements[d++]=a,this.elements[d++]=o,a+=o}},e.prototype.addContour=function(i,n){this.mesh===null&&(this.mesh=new r2),i<2&&(i=2),i>3&&(i=3);for(var r=null,s=0;s<n.length;s+=i)r===null?(r=this.mesh.makeEdge(),this.mesh.splice(r,r.Sym)):(this.mesh.splitEdge(r),r=r.Lnext),r.Org.coords[0]=n[s+0],r.Org.coords[1]=n[s+1],r.Org.coords[2]=i>2?n[s+2]:0,r.Org.idx=this.vertexIndexCounter++,this.edgeCreateCallback&&this.edgeCreateCallback(r),r.winding=1,r.Sym.winding=-1},e.prototype.tesselate=function(i,n,r,s,a,o){if(i===void 0&&(i=Oi.ODD),n===void 0&&(n=vr.POLYGONS),o===void 0&&(o=!0),this.vertices=[],this.elements=[],this.vertexIndices=[],this.vertexIndexCounter=0,a&&(this.normal[0]=a[0],this.normal[1]=a[1],this.normal[2]=a[2]),this.windingRule=i,s<2&&(s=2),s>3&&(s=3),!this.mesh)return!1;this.projectPolygon_(),q4.computeInterior(this,o);var l=this.mesh;return n===vr.BOUNDARY_CONTOURS?this.setWindingNumber_(l,1,!0):this.tessellateInterior_(l),o&&l.check(),n===vr.BOUNDARY_CONTOURS?this.outputContours_(l,s):this.outputPolymesh_(l,n,r,s),!0},e}(),Oi.ODD,Oi.NONZERO,Oi.POSITIVE,Oi.NEGATIVE,Oi.ABS_GEQ_TWO,vr.POLYGONS,vr.CONNECTED_POLYGONS,vr.BOUNDARY_CONTOURS});function jk(t,e){let i=t.length/2;if(i<2)return[];let n=0;for(let l=0;l<i;l++){let c=(l+1)%i;n+=t[2*l]*t[2*c+1]-t[2*c]*t[2*l+1]}let r=n>0!==e?1:-1,s=[];for(let l=0;l<i;l++){let c=(l+1)%i,h=t[2*c]-t[2*l],d=t[2*c+1]-t[2*l+1],u=Math.hypot(h,d);s.push(u>0?[r*d/u,-r*h/u]:[0,0])}let a=Math.cos(40*Math.PI/180),o=(l,c)=>{if(l[0]*c[0]+l[1]*c[1]<=a)return l;let[h,d]=[l[0]+c[0],l[1]+c[1]],u=Math.hypot(h,d);return u>0?[h/u,d/u]:l};return s.map((l,c)=>[o(l,s[(c+i-1)%i]),o(l,s[(c+1)%i])])}function Gk(t,e,i){let n=t.length/2,r=new Float32Array(n+1);if(!(e>0)||!(i>0)||n<2)return{u:r,vScale:0};let s=0;for(let a=0;a<n;a++){let o=(a+1)%n;s+=Math.hypot((t[2*o]-t[2*a])/e,(t[2*o+1]-t[2*a+1])/i),r[a+1]=s}return{u:r,vScale:Math.sqrt(e*i)}}function Hk(t,e,i){for(let n=0;n<i.length;n+=3){let r=3*i[n],s=3*i[n+1],a=3*i[n+2],o=t[s]-t[r],l=t[s+1]-t[r+1],c=t[s+2]-t[r+2],h=t[a]-t[r],d=t[a+1]-t[r+1],u=t[a+2]-t[r+2],p=c*h-o*u,f=o*d-l*h;if((l*u-c*d)*(e[r]+e[s]+e[a])+p*(e[r+1]+e[s+1]+e[a+1])+f*(e[r+2]+e[s+2]+e[a+2])<0){let g=i[n+1];i[n+1]=i[n+2],i[n+2]=g}}}var w3,Wk,S3,qk=z(()=>{}),M3=z(()=>{w3={vertices:[160,160,-160,160,-160,-160,160,-160],vertexIndices:[1,0,3,2],vertexCount:4,elements:[0,4],elementCount:1,mesh:void 0},Wk={vertices:[],vertexIndices:[],vertexCount:0,elements:[],elementCount:0,mesh:void 0},S3={vertices:[-160,160,160,-160,160,160,-160,-160],vertexIndices:[1,3,0,2],vertexCount:4,elements:[0,1,2,1,0,3],elementCount:2,mesh:void 0}});function Xk(t,e){return t.normals[3*e+2]<.9999}function $k(t){let e=iT.get(t);if(e!==void 0)return e;if(!(t.rise>0))return t;let i=new Float32Array(t.normals),n=t.positions.length/3;for(let s=0;s<n;s++){if(!Xk(t,s))continue;let a=i[3*s],o=i[3*s+1],l=Math.hypot(a,o);if(l===0)continue;let c=t.rise-t.positions[3*s+2],h=Math.min(1,Math.max(0,1-c/t.rise)),d=Math.sqrt(1-h*h);i[3*s]=a/l*d,i[3*s+1]=o/l*d,i[3*s+2]=h}let r={...t,normals:i};return iT.set(t,r),r}function Yk(t,e,i,n){let r=(e-t.minX)/t.spanX,s=(i-t.minY)/t.spanY;return n?[s,r]:[r,s]}var iT,yb,nT,E3=z(()=>{iT=new WeakMap}),VY=z(()=>{tt(),h0(),ti(),qk(),M3(),E3(),yb=class extends jt{constructor(t,e,i=12,n=Oi.ODD,r,s=!1){super(),this.type="FlatExtrusionGeometry",this._nearSide=new Uint8Array(0),this._vScale=0,this._shape=t,this._depth=e,this._curveSegments=i,this._windingRule=n,this._uvPitch=s?void 0:r,this._legacy=s;let a,o=[t.extractShapePointsToFlatArray([],i),...t.shapeHoles.map(U=>U.extractShapePointsToFlatArray([],i))];try{a=_g({contours:o,windingRule:n,elementType:vr.POLYGONS,polySize:3,vertexSize:2,strict:!0})}catch{a=S3}let l=a?.vertexCount??0,c=a?.elementCount??0,h=1/0,d=1/0,u=-1/0,p=-1/0;for(let U of o)for(let j=0;j<U.length;j+=2)U[j]<h&&(h=U[j]),U[j]>u&&(u=U[j]),U[j+1]<d&&(d=U[j+1]),U[j+1]>p&&(p=U[j+1]);let f=this._uvPitch,g=f??(u-h||1),m=f??(p-d||1),v=f===void 0?h:0,y=f===void 0?d:0,_=o.map((U,j)=>jk(U,j>0)),b=0;for(let U of _)b+=U.length;let x=2*l+4*b,w=3*c*2+6*b,S=new Float32Array(3*x),E=new Float32Array(3*x),A=new Float32Array(2*x),P=new Uint32Array(w),C=new Uint8Array(x),R=0,L=0,D=0,F=!1,V=(U,j,W,it,nt,Y,ot=(U-v)/g,ht=(j-y)/m)=>{let ft=3*L;S[ft]=U,S[ft+1]=j,S[ft+2]=W,E[ft]=it,E[ft+1]=nt,E[ft+2]=Y,C[L]=W===e?F?2:1:0,A[2*L]=ot,A[2*L+1]=ht,L++};if(a!==void 0)for(let[U,j]of[[e,1],[0,-1]]){let W=L;for(let it=0;it<l;it++)V(a.vertices[2*it],a.vertices[2*it+1],U,0,0,j);for(let it=0;it<c;it++){let[nt,Y,ot]=[a.elements[3*it],a.elements[3*it+1],a.elements[3*it+2]];P[D++]=W+nt,P[D++]=W+(j>0?Y:ot),P[D++]=W+(j>0?ot:Y)}}F=!0;for(let U=0;U<o.length;U++){let j=o[U],W=_[U],it=j.length/2,{u:nt,vScale:Y}=s?{u:new Float32Array(it+1),vScale:0}:Gk(j,g,m);R=Y;let ot=Y===0?0:e/Y,ht={minX:v,minY:y,spanX:g,spanY:m},ft=(pt,[J,mt],N,O)=>{let H=j[2*pt],$=j[2*pt+1],[B,Z]=s?Yk(ht,H,$,N):[O,N?0:ot];V(H,$,N?0:e,J,mt,0,B,Z)};for(let pt=0;pt<W.length;pt++){let J=(pt+1)%it,[mt,N]=W[pt],[O,H]=[nt[pt],nt[pt+1]],$=L;ft(pt,mt,!1,O),ft(pt,mt,!0,O),ft(J,N,!1,H),ft(J,N,!0,H),P[D++]=$,P[D++]=$+1,P[D++]=$+2,P[D++]=$+3,P[D++]=$+2,P[D++]=$+1}}Hk(S,E,P),this.setAttribute("position",new Ht(S,3)),this.setAttribute("normal",new Ht(E,3)),this.setAttribute("uv",new Ht(A,2)),this.setIndex(new Ht(P,1)),this._nearSide=C,this._vScale=R}takeDepthStateFrom(t){let e=t;e._nearSide!==void 0&&(this._depth=e._depth??this._depth,this._nearSide=e._nearSide,this._vScale=e._vScale??this._vScale)}canShiftDepthTo(t){return this._nearSide.length>0&&this._depth>0&&t>0}shiftDepthTo(t){if(!this.canShiftDepthTo(t))return!1;let e=t-this._depth;if(this._depth=t,e===0)return!0;let i=this.getAttribute("position");if(i===void 0)return!1;let n=i.array,r=this.getAttribute("uv"),s=r?.array,a=this._vScale>0?e/this._vScale:0,o=this._nearSide;for(let l=0;l<o.length;l++){let c=o[l];c!==0&&(n[3*l+2]+=e,c===2&&s!==void 0&&(s[2*l+1]+=a))}return i.needsUpdate=!0,r!==void 0&&a!==0&&(r.needsUpdate=!0),this.refreshDepthBounds(t),!0}refreshDepthBounds(t){if(this.boundingBox===null&&this.boundingSphere===null)return;this.boundingBox===null&&this.computeBoundingBox();let e=this.boundingBox;e.min.z=Math.min(0,t),e.max.z=Math.max(0,t),this.boundingSphere!==null&&e.getBoundingSphere(this.boundingSphere)}clone(){let t=new yb(this._shape,this._depth,this._curveSegments,this._windingRule,this._uvPitch,this._legacy);return t.userData=nx(this.userData),t}}}),Zk=z(()=>{tt(),h0(),ti(),M3(),nT=class extends jt{constructor(t,e=12,i={}){super(),this.type="ShapeGeometry",this.windingRule=Oi.ODD,this.elementType=vr.POLYGONS,this.polySize=3,this.vertexSize=2,this.strict=!0,this._shape=t,this._curveSegments=e,this._triangulationOptions=Object.assign({windingRule:Oi.ODD,elementType:vr.POLYGONS,polySize:3,vertexSize:2,strict:!0},i);let n,r,s,a=this._shape.extractShapePointsToFlatArray([],this._curveSegments),o=this._shape.shapeHoles.map(u=>u.extractShapePointsToFlatArray([],this._curveSegments)),l=!0,c=!0;for(let u=0,p=a.length/2;u<p;u++){let f=2*u,g=a[f+0],m=a[f+1];if(r!==void 0&&g!==r&&(l=!1),s!==void 0&&m!==s&&(c=!1),r=g,s=m,!l&&!c)break}if(!l&&!c)try{n=_g({contours:[a,...o],windingRule:this._triangulationOptions.windingRule,elementType:this._triangulationOptions.elementType,polySize:this._triangulationOptions.polySize,vertexSize:this._triangulationOptions.vertexSize,strict:this._triangulationOptions.strict})}catch{n=w3}let h=n?.vertexCount??1,d=n?.elementCount??1;if(this._positionAttribute=new Ht(new Float32Array(3*h),3),this._normalAttribute=new Ht(new Float32Array(3*h),3),this._uvAttribute=new Ht(new Float32Array(2*h),2),this._indexAttribute=new Ht(new Uint32Array(3*d),1),n){let u=1/0,p=-1/0,f=1/0,g=-1/0;for(let y=0,_=h;y<_;y++){let b=2*y,x=n.vertices[b+0],w=n.vertices[b+1];x<u&&(u=x),x>p&&(p=x),w<f&&(f=w),w>g&&(g=w)}let m=p-u,v=g-f;for(let y=0,_=h;y<_;y++){let b=2*y,x=n.vertices[b+0],w=n.vertices[b+1],S=(x-u)/m,E=(w-f)/v;this._positionAttribute.setXYZ(y,x,w,0),this._normalAttribute.setXYZ(y,0,0,1),this._uvAttribute.setXY(y,S,E)}for(let y=0,_=d;y<_;y++){let b=3*y,x=n.elements[b+0],w=n.elements[b+1],S=n.elements[b+2];this._indexAttribute.setX(b+0,x),this._indexAttribute.setX(b+1,w),this._indexAttribute.setX(b+2,S)}}this.setAttribute("position",this._positionAttribute),this.setAttribute("normal",this._normalAttribute),this.setAttribute("uv",this._uvAttribute),this.setIndex(this._indexAttribute),this.setDrawRange(0,3*(n?.elementCount??1))}clone(){let t=new nT(this._shape,this._curveSegments);return t.userData=nx(this.userData),t}}});function jY(t){return X4||(X4=async function(){let e=t??"https://unpkg.com/@splinetool/runtime@2.0.77/build",i=Promise.resolve().then(()=>(YP(),$P)),[n,r]=await Promise.all([i,fetch(`${e}/bevel.wasm`).then(s=>s.arrayBuffer())]);await n.default({module_or_path:r}),c0=n}())}function GY(t){let e=!1;return t.scene.objects.traverse((i,n)=>{let r=n.geometry;if(r!==void 0&&(t6.has(r.type)&&r.depth!==void 0&&r.depth>0&&(r.extrudeBevelSize??0)>0&&(e=!0),r.type==="PathGeometry")){let s=r.extrusion;s!==void 0&&s.capType==="round"&&(s.bevel??0)>0&&(e=!0)}}),e}function Kk(t,e){let i=[t.extractShapePointsToFlatArray([],e)];for(let o of t.shapeHoles)i.push(o.extractShapePointsToFlatArray([],e));let n=0;for(let o of i)n+=o.length>>1;let r=new Float64Array(2*n),s=new Uint32Array(i.length),a=0;for(let o=0;o<i.length;o++)r.set(i[o],2*a),a+=i[o].length>>1,s[o]=a;return{points:r,ends:s}}function _b(t,e,i,n,r,s){let a=t.positions.length/3,o=r.elements,l=e6.getNormalMatrix(r).elements;for(let h=0;h<a;h++){let d=3*h,u=3*(i+h),p=t.positions[d],f=t.positions[d+1],g=t.positions[d+2];e.positions[u]=o[0]*p+o[4]*f+o[8]*g+o[12],e.positions[u+1]=o[1]*p+o[5]*f+o[9]*g+o[13],e.positions[u+2]=o[2]*p+o[6]*f+o[10]*g+o[14];let m=t.normals[d],v=t.normals[d+1],y=t.normals[d+2];e.normals[u]=l[0]*m+l[3]*v+l[6]*y,e.normals[u+1]=l[1]*m+l[4]*v+l[7]*y,e.normals[u+2]=l[2]*m+l[5]*v+l[8]*y;let _=2*(i+h);if(s===void 0)e.uvs[_]=t.uvs[2*h],e.uvs[_+1]=t.uvs[2*h+1];else{let[b,x]=s(p,f,t.uvs[2*h],t.uvs[2*h+1],h);e.uvs[_]=b,e.uvs[_+1]=x}}let c=r.determinant()<0;for(let h=0;h<t.indices.length;h+=3)e.indices[n+h]=t.indices[h]+i,e.indices[n+h+1]=t.indices[h+(c?2:1)]+i,e.indices[n+h+2]=t.indices[h+(c?1:2)]+i}function Qk(t){let{owner:e,shape:i,curveSegments:n,assembledAt:r,bevel:s,bevelSegments:a}=t,o=function(u,p){let f=[p],g=m=>{f.push(m.points.length,m.isClosed?1:0,m.roundness??0);for(let v of m.points){f.push(v.roundness??0,v.position.x,v.position.y);for(let y of v.controls)f.push(y.position.x,y.position.y)}f.push(m.shapeHoles.length);for(let v of m.shapeHoles)g(v)};return g(u),function(m){let v=2166136261;for(let y=0;y<m.length;y++)v^=m[y],v=Math.imul(v,16777619)>>>0;return v}(new Uint8Array(new Float64Array(f).buffer))}(i,n),l=e??`outline:${o}`,c=`${s}/${a}`,h=bb.get(l);if(h!==void 0&&h.outlineVersion===o&&h.capKey===c&&(t.stillServes?.(h)??1))return rT.placements++,h.cap;let d=function(u,p,f,g,m){let{points:v,ends:y}=Kk(u,p);return c0.assemble_cap(v,y,f,g,0,Math.max(1,Math.floor(m)),Jk,40)}(i,n,r,s,a);rT.assemblies++;try{let u=function(p,f){return function(g,m,v,y,_){let b=1/0;for(let x=2;x<g.length;x+=3)g[x]<b&&(b=g[x]);if(b===1/0&&(b=0),b!==0)for(let x=2;x<g.length;x+=3)g[x]-=b;return{positions:g,normals:m,uvs:v,indices:y,rise:_-b}}(p.positions(),p.normals(),p.uvs(),p.indices(),f)}(d,r);return bb.set(l,{outlineVersion:o,capKey:c,assembledAt:r,cap:u}),u}finally{d.free()}}function Nu(t,e){return .5*e>1.001*t}var c0,Jk,X4,t6,e6,$4,Y4,Z4,bb,rT,sT,Sh,Ap=z(()=>{tt(),ti(),qk(),E3(),Jk=.4,t6=new Set(["VectorGeometry","TextGeometry","InputGeometry","PolygonGeometry","RectangleGeometry","StarGeometry","TriangleGeometry","EllipseGeometry"]),e6=new ue,$4=new At,Y4=new At,Z4=new At().makeScale(1,1,-1),bb=new Map,rT={assemblies:0,placements:0},sT=class extends jt{constructor(t,e,i=0,n=12,r=3,s,a,o=!1){if(super(),this.type="ShapeGeometry",this._nearSide=new Uint8Array(0),this._effectiveBevel=0,this._vScale=0,c0===void 0)throw new Error("bevel-wasm is not loaded");this._shape=t,this._uvPitch=a,this._legacy=o,this._depth=e,this._bevel=i,this._curveSegments=n,this._bevelSegments=r,this._ownerId=s,this.rebuild()}takeDepthStateFrom(t){let e=t;e._nearSide!==void 0&&(this._depth=e._depth??this._depth,this._nearSide=e._nearSide,this._vScale=e._vScale??this._vScale,this._effectiveBevel=e._effectiveBevel??this._effectiveBevel)}canShiftDepthTo(t){return this._nearSide.length>0&&Nu(this._effectiveBevel,t)&&Nu(this._effectiveBevel,this._depth)}shiftDepthTo(t){if(!this.canShiftDepthTo(t))return!1;let e=t-this._depth;if(this._depth=t,e===0)return!0;let i=this.getAttribute("position");if(i===void 0)return!1;let n=i.array,r=this.getAttribute("uv"),s=r?.array,a=this._vScale>0?e/this._vScale:0,o=this._nearSide;for(let l=0;l<o.length;l++){let c=o[l];c!==0&&(n[3*l+2]+=e,c===2&&s!==void 0&&(s[2*l+1]+=a))}return i.needsUpdate=!0,r!==void 0&&a!==0&&(r.needsUpdate=!0),this.refreshDepthBounds(t),!0}refreshDepthBounds(t){if(this.boundingBox===null&&this.boundingSphere===null)return;this.boundingBox===null&&this.computeBoundingBox();let e=this.boundingBox;e.min.z=Math.min(0,t),e.max.z=Math.max(0,t),this.boundingSphere!==null&&e.getBoundingSphere(this.boundingSphere)}setDepth(t){t!==this._depth&&(this._depth=t,this.rebuild(),this.computeBoundingSphere(),this.computeBoundingBox())}rebuild(){let t=Qk({owner:this._ownerId,shape:this._shape,curveSegments:this._curveSegments,assembledAt:this._depth,bevel:this._bevel,bevelSegments:this._bevelSegments,stillServes:a=>Nu(a.cap.rise,this._depth)&&Nu(a.cap.rise,a.assembledAt)}),e=function(a,o,l,c,h,d=!1){let u=c.positions.length/3,p=l-c.rise,f=c.rise,{points:g,ends:m}=Kk(a,o),v=1/0,y=1/0,_=-1/0,b=-1/0;for(let ht=0;ht<g.length;ht+=2)g[ht]<v&&(v=g[ht]),g[ht]>_&&(_=g[ht]),g[ht+1]<y&&(y=g[ht+1]),g[ht+1]>b&&(b=g[ht+1]);d&&(h=void 0);let x=h??_-v,w=h??b-y,S={minX:v,minY:y,spanX:_-v||1,spanY:b-y||1},E=[],A=0;for(let ht of m)E.push({at:A,count:ht-A}),A=ht;let P=0;for(let ht of E)P+=ht.count;let C=2*u+4*P,R=new Float32Array(3*C),L=new Float32Array(3*C),D=new Float32Array(2*C),F=new Uint32Array(2*c.indices.length+6*P),V=new Uint8Array(C),U=0,j=h===void 0?void 0:(ht,ft)=>[ht/h,ft/h],W=d?(ht,ft,pt,J,mt)=>Xk(c,mt)?[J,pt]:[pt,J]:j,it=d?$k(c):c,nt={positions:R,normals:L,uvs:D,indices:F};_b(it,nt,0,0,$4.makeTranslation(0,0,p),j),_b(it,nt,u,c.indices.length,Y4.makeTranslation(0,0,f).multiply(Z4),W),V.fill(1,0,u);let Y=2*u,ot=2*c.indices.length;for(let ht=0;ht<E.length;ht++){let{at:ft,count:pt}=E[ht],J=g.subarray(2*ft,2*(ft+pt)),mt=jk(J,ht>0),N=d?{u:new Float32Array(pt+1),vScale:0}:Gk(J,x,w),O=N.u;U=N.vScale;for(let H=0;H<pt;H++){let $=(H+1)%pt,[B,Z]=mt[H],K=Y;for(let[k,st,dt,bt,ct,It]of[[J[2*H],J[2*H+1],B,p,O[H],2],[J[2*$],J[2*$+1],Z,p,O[H+1],2],[J[2*$],J[2*$+1],Z,f,O[H+1],0],[J[2*H],J[2*H+1],B,f,O[H],0]]){let St=3*Y;if(R[St]=k,R[St+1]=st,R[St+2]=bt,L[St]=dt[0],L[St+1]=dt[1],L[St+2]=0,d){let[Dt,Mt]=Yk(S,k,st,It===0);D[2*Y]=Dt,D[2*Y+1]=Mt}else D[2*Y]=ct,D[2*Y+1]=U===0?0:(bt-f)/U;V[Y]=It,Y++}F[ot++]=K,F[ot++]=K+1,F[ot++]=K+2,F[ot++]=K,F[ot++]=K+2,F[ot++]=K+3}}return Hk(R,L,F),{positions:R,normals:L,uvs:D,indices:F,nearSide:V,vScale:U}}(this._shape,this._curveSegments,this._depth,t,this._uvPitch,this._legacy);this._nearSide=e.nearSide,this._vScale=e.vScale,this._effectiveBevel=t.rise;let i=this.getAttribute("position"),n=this.getAttribute("normal"),r=this.getAttribute("uv"),s=this.getIndex();if(i!==void 0&&n!==void 0&&r!==void 0&&s!==null&&i.array.length===e.positions.length&&n.array.length===e.normals.length&&r.array.length===e.uvs.length&&s.array.length===e.indices.length)return i.array.set(e.positions),n.array.set(e.normals),r.array.set(e.uvs),s.array.set(e.indices),i.needsUpdate=!0,n.needsUpdate=!0,r.needsUpdate=!0,void(s.needsUpdate=!0);this.setAttribute("position",new Ht(e.positions,3)),this.setAttribute("normal",new Ht(e.normals,3)),this.setAttribute("uv",new Ht(e.uvs,2)),this.setIndex(new Ht(e.indices,1))}clone(){let t=new sT(this._shape,this._depth,this._bevel,this._curveSegments,this._bevelSegments,this._ownerId,this._uvPitch,this._legacy);return t.userData=nx(this.userData),t}}}),mh=z(()=>{wh(),VY(),Zk(),Ap(),h0(),Sh=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i,n=Object.assign({},e?.parameters??{width:100,subdivisions:40,roundness:0,extrudeBevelSize:0,extrudeBevelSegments:3,windingRule:Oi.ODD},t.parameters),r=Math.abs(n.width),s=Math.abs(n.height??n.width),a=Math.abs(n.depth??0),o=t.shape??e?.shape,l=o?.roundness??n.roundness;o!==void 0&&(o instanceof ki?(i=o,(i.width!==r||i.height!==s)&&i.applySize(r,s)):i=new ki(r,s).fromJSON(o),t.parameters?.roundness!==void 0&&t.parameters?.roundness>0&&i.update());let c=i??new ki(r,s);return{parameters:Object.assign(n,{width:r,height:s,depth:a,roundness:l}),shape:c,ownerId:t.ownerId??e?.ownerId}}static build(t){let e,{depth:i,extrudeBevelSize:n,extrudeBevelSegments:r,subdivisions:s,roundness:a,windingRule:o,uvPitch:l,extrusionVersion:c}=t.parameters,h=c===1;return t.shape.roundness=a,i<=0?e=new nT(t.shape,s,{windingRule:o}):n<=0?e=new yb(t.shape,i,s,o,l,h):c0!==void 0?e=new sT(t.shape,i,n,s,r,t.ownerId,l,h):(console.error("[extrude] engine not loaded \u2014 extruding without a bevel"),e=new yb(t.shape,i,s,o,l,h)),Object.assign(e,{userData:{...t,type:"VectorGeometry"}})}}});function HY(t,e,i,n,r,s){if(n>=A3)return r>30||r%4==0?(function(h,d,u,p=0,f=0,g=0){let m=.5522847498,v=d*m,y=u*m;h.addPoint(Nv(f-d,g,f-d,g-y,f-d,g+y)),h.addPoint(Nv(f,g+u,f-v,g+u,f+v,g+u)),h.addPoint(Nv(f+d,g,f+d,g+y,f+d,g-y)),h.addPoint(Nv(f,g-u,f+v,g-u,f-v,g-u)),p>0&&n6(h,d,u,p)}(t,e,i,s),Math.round(r/4)):K4(t,n,r,e,i,s);let a={x:0,y:i},o=(n=Math.max(n,.001))+.5*Math.PI,l={x:Math.cos(o)*e,y:Math.sin(o)*i},c=function({px:h,py:d,cx:u,cy:p,rx:f,ry:g,largeArcFlag:m,sweepFlag:v}){let y=[];if(f===0||g===0)return[];let _=(h-u)/2,b=(d-p)/2;if(_===0&&b===0)return[];f=Math.abs(f),g=Math.abs(g);let x=Math.pow(_,2)/Math.pow(f,2)+Math.pow(b,2)/Math.pow(g,2);x>1&&(f*=Math.sqrt(x),g*=Math.sqrt(x));let w=function(L,D,F,V,U,j,W,it,nt,Y){let ot=Math.pow(U,2),ht=Math.pow(j,2),ft=Math.pow(W,2),pt=Math.pow(it,2),J=ot*ht-ot*pt-ht*ft;J<0&&(J=0),J/=ot*pt+ht*ft,J=Math.sqrt(J)*(nt===Y?-1:1);let mt=J*U/j*it,N=J*-j/U*W,O=mt+(L+F)/2,H=N+(D+V)/2,$=(W-mt)/U,B=(it-N)/j,Z=(-W-mt)/U,K=(-it-N)/j,k=G4(1,0,$,B),st=G4($,B,Z,K);return!Y&&st>0&&(st-=L1),Y&&st<0&&(st+=L1),{centerx:O,centery:H,ang1:k,ang2:st}}(h,d,u,p,f,g,_,b,m,v),{ang1:S,ang2:E}=w,{centerx:A,centery:P}=w,C=Math.abs(E)/(L1/4);Math.abs(1-C)<1e-7&&(C=1);let R=Math.max(Math.ceil(C),1);E/=R;for(let L=0;L<R;L++)y.push(NY(S,E)),S+=E;return y.map(L=>{let{x:D,y:F}=n2(L[0],f,g,A,P),{x:V,y:U}=n2(L[1],f,g,A,P),{x:j,y:W}=n2(L[2],f,g,A,P);return{x1:D,y1:F,x2:V,y2:U,x:j,y:W}})}({px:a.x,py:a.y,cx:l.x,cy:l.y,rx:e,ry:i,largeArcFlag:n>Math.PI,sweepFlag:!0});return r>30||r%c.length===0?function(h,d,u,p,f,g,m,v){let y=Math.round(f/p.length);h.addPoint(tp(d,u));for(let _=0,b=p.length;_<b;_++){let x=p[_],w=h.points[_],S=tp(x.x,x.y);w.controls[1].position.set(x.x1,x.y1),S.controls[0].position.set(x.x2,x.y2),h.addPoint(S)}return v>0?i6(h,g,m,v):h.addPoint(tp(0,0)),y}(t,a.x,a.y,c,r,e,i,s):K4(t,n,r,e,i,s)}function K4(t,e,i,n,r,s){let a=-e/i;for(let o=0;o<=i;o++){let l=a*o,c=Math.sin(l)*n,h=Math.cos(l)*r;t.addPoint(tp(c,h))}return e<A3?s>0?i6(t,n,r,s):t.addPoint(tp(0,0)):(t.removePoint(t.points[t.points.length-1]),s>0&&n6(t,n,r,s)),1}function tp(t,e){return new Vc(Ot.generateUUID(),new et(t,e))}function Nv(t,e,i,n,r,s){let a=tp(t,e);return a.controls[0].position.set(i,n),a.controls[1].position.set(r,s),a}function i6(t,e,i,n){r6(t,e,i,n).forEach(r=>t.addPoint(r))}function n6(t,e,i,n){let r=r6(t,e,i,n),s=new ki;r.forEach(a=>s.addPoint(a)),s.isClosed=!0,t.shapeHoles.push(s)}function r6(t,e,i,n){let r=n*e/100,s=r*(Math.abs(i)/Math.abs(e)),a=new et(r/e,s/i),o=t.points.map(l=>{let c=l.clone();return c.uuid=Ot.generateUUID(),c}).reverse();return o.forEach(l=>{l.position.multiply(a);let c=l.controls[0].position.clone().multiply(a),h=l.controls[1].position.clone().multiply(a);l.controls[0].position.copy(h),l.controls[1].position.copy(c)}),o}var A3,bx,s6,l2,a6,xb=z(()=>{wh(),kk(),kY(),mh(),tt(),A3=2*Math.PI,bx=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i=Object.assign({},e?.parameters??{width:100,depth:0,spikes:64,angle:360,innerRadius:0,extrudeBevelSize:0,extrudeBevelSegments:1},t.parameters);return i.angle=Ot.clamp(i.angle,0,360),{shape:t.shape&&t.shape instanceof ki?t.shape:new ki,parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??0)})}}static build(t){let e,{width:i,height:n,spikes:r,angle:s,innerRadius:a,depth:o,extrudeBevelSize:l,extrudeBevelSegments:c,extrusionVersion:h}=t.parameters,d=t.shape,u=HY(d,.5*i,.5*n,s*Math.PI/180,r,a);return d.isClosed=!0,d.update(),s===0?(e=new jt,e.setAttribute("position",new Nt([],3))):e=Sh.create({shape:d,parameters:{subdivisions:u,depth:o,extrudeBevelSize:l,extrudeBevelSegments:c,extrusionVersion:h}}),Object.assign(e,{userData:{...t,type:"EllipseGeometry"}})}}}),Q4=z(()=>{tt(),Lk(),s6=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i=Object.assign({},e?.parameters??{width:100,detail:0,corner:0,cornerSides:4},t.parameters);return{parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??i.width)})}}static build(t){let{width:e,height:i,depth:n,detail:r,corner:s,cornerSides:a}=t.parameters,o=r===0&&s!==0?new l2(.5*e,s,a):new zE(.5*e,r),l=i/e,c=n/e;return(l!==1||c!==1)&&o.scale(1,l,c),Object.assign(o,{userData:{...t,type:"IcosahedronGeometry"}})}},l2=class extends gb{constructor(t=1,e=.2,i=4){let n=(1+Math.sqrt(5))/2,r="IcosahedronGeometry";super([-1,n,0,1,n,0,-1,-n,0,1,-n,0,0,-1,n,0,1,n,0,-1,-n,0,1,-n,n,0,-1,n,0,1,-n,0,-1,-n,0,1],[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1],r,t,e,i),this.type=r}static fromJSON(t){return new l2(t.radius,t.corner,t.cornerSides)}}}),J4=z(()=>{tt(),a6=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){(t.parameters?.points??[]).forEach(n=>{Array.isArray(n)&&(n.x=n[0],n.y=n[1])});let i=Object.assign({},e?.parameters??{width:100,segments:64,verticalSegments:64,points:[{x:0,y:-50,id:0},{x:50,y:-50,id:1},{x:50,y:50,id:2},{x:0,y:50,id:3}]},t.parameters);return{parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??i.width)})}}static build(t){let{points:e,segments:i,verticalSegments:n}=t.parameters,r=new Ug;r.moveTo(e[0].x,e[0].y),r.bezierCurveTo(e[1].x,e[1].y,e[2].x,e[2].y,e[3].x,e[3].y);let s=new FE(r.extractPoints(n).shape,i);return s.rotateZ(Math.PI),Object.assign(s,{userData:{...t,type:"LatheGeometry"}})}}});function Vd(t,e){return Math.abs(e-t)/2+Math.min(t,e)}function WY(t){let{positions:e,faces:i,materialIndices:n,uvs:r}=t,s=e.length/3,a=i.length/3,o=r!==null&&a>0,l=3*a,c=new Uint32Array(l),h=new Uint32Array(l),d=new Uint32Array(l),u=new Uint32Array(l),p=new Uint32Array(l),f=0,g=8;for(;g<2*l;)g*=2;let m=g-1,v=new Int32Array(g).fill(-1),y=(D,F)=>{let V=(Math.imul(D,2654435761)^F)&m;for(;;){let U=v[V];if(U===-1)return v[V]=f,c[f]=D,h[f]=F,f++;if(c[U]===D&&h[U]===F)return U;V=V+1&m}},_=(D,F)=>{let V=D<F?D:F,U=D<F?F:D,j=(Math.imul(V,2654435761)^U)&m;for(;;){let W=v[j];if(c[W]===V&&h[W]===U)return W;j=j+1&m}},b=new Uint32Array(s),x=new Float64Array(3*s),w=(D,F,V)=>{let U=D<F?y(D,F):y(F,D),j=++d[U];j===1?u[U]=V:j===2&&(p[U]=V),b[D]++,b[F]++,x[3*D]+=e[3*F],x[3*D+1]+=e[3*F+1],x[3*D+2]+=e[3*F+2],x[3*F]+=e[3*D],x[3*F+1]+=e[3*D+1],x[3*F+2]+=e[3*D+2]};for(let D=0;D<a;D++){let F=i[3*D],V=i[3*D+1],U=i[3*D+2];w(F,V,U),w(V,U,F),w(U,F,V)}let S=new Float64Array(3*f);for(let D=0;D<f;D++){let F=3*c[D],V=3*h[D];if(d[D]===2){let U=3*u[D],j=3*p[D];S[3*D]=.375*(e[F]+e[V])+.125*(e[U]+e[j]),S[3*D+1]=.375*(e[F+1]+e[V+1])+.125*(e[U+1]+e[j+1]),S[3*D+2]=.375*(e[F+2]+e[V+2])+.125*(e[U+2]+e[j+2])}else S[3*D]=.5*(e[F]+e[V]),S[3*D+1]=.5*(e[F+1]+e[V+1]),S[3*D+2]=.5*(e[F+2]+e[V+2])}let E,A=new Float64Array(3*s);for(let D=0;D<s;D++){let F=b[D];F===3?E=3/16:F>3&&(E=3/(8*F));let V=1-F*Number(E),U=Number(E);F===2&&(V=3/4,U=1/8),A[3*D]=e[3*D]*V+x[3*D]*U,A[3*D+1]=e[3*D+1]*V+x[3*D+1]*U,A[3*D+2]=e[3*D+2]*V+x[3*D+2]*U}let P=new Float64Array(3*(s+f));P.set(A),P.set(S,3*s);let C=new Uint32Array(12*a),R=new Array(4*a),L=o?new Float64Array(24*a):null;for(let D=0;D<a;D++){let F=i[3*D],V=i[3*D+1],U=i[3*D+2],j=_(F,V)+s,W=_(V,U)+s,it=_(U,F)+s,nt=12*D;C[nt++]=j,C[nt++]=W,C[nt++]=it,C[nt++]=F,C[nt++]=j,C[nt++]=it,C[nt++]=V,C[nt++]=W,C[nt++]=j,C[nt++]=U,C[nt++]=it,C[nt++]=W;let Y=n[D];if(R[4*D]=Y,R[4*D+1]=Y,R[4*D+2]=Y,R[4*D+3]=Y,L!==null){let ot=6*D,ht=r[ot],ft=r[ot+1],pt=r[ot+2],J=r[ot+3],mt=r[ot+4],N=r[ot+5],O=Vd(ht,pt),H=Vd(ft,J),$=Vd(pt,mt),B=Vd(J,N),Z=Vd(ht,mt),K=Vd(ft,N),k=24*D;L[k++]=O,L[k++]=H,L[k++]=$,L[k++]=B,L[k++]=Z,L[k++]=K,L[k++]=ht,L[k++]=ft,L[k++]=O,L[k++]=H,L[k++]=Z,L[k++]=K,L[k++]=pt,L[k++]=J,L[k++]=$,L[k++]=B,L[k++]=O,L[k++]=H,L[k++]=mt,L[k++]=N,L[k++]=Z,L[k++]=K,L[k++]=$,L[k++]=B}}return{positions:P,faces:C,materialIndices:R,uvs:L}}var kv,o6,Sn,l6,T3,qY=z(()=>{tt(),kv=1e4,o6=class{constructor(t=1){this.subdivisions=t}modify(t){let e=function(n){let r=n.getAttribute("position");if(r===void 0)return console.error("SubdivisionModifier: Position attribute required for subdivision."),{positions:new Float64Array(0),faces:new Uint32Array(0),materialIndices:[],uvs:null};let s=n.getAttribute("uv"),a=n.getIndex(),o=r.count,l=new Map,c=new Uint32Array(o),h=[],d=0;for(let y=0;y<o;y++){let _=r.getX(y),b=r.getY(y),x=r.getZ(y),w=Math.round(_*kv),S=Math.round(b*kv),E=Math.round(x*kv),A=l.get(w);A===void 0&&(A=new Map,l.set(w,A));let P=A.get(S);P===void 0&&(P=new Map,A.set(S,P));let C=P.get(E);C===void 0&&(C=d++,P.set(E,C),h.push(_,b,x)),c[y]=C}let u=[],p=[],f=s===void 0?null:[],g=a!==null?a.count:o,m=(y,_)=>{let b=a!==null?a.getX(y):y,x=a!==null?a.getX(y+1):y+1,w=a!==null?a.getX(y+2):y+2;if(!(b<o&&x<o&&w<o))return;let S=c[b],E=c[x],A=c[w];S===E||E===A||A===S||(u.push(S,E,A),p.push(_),f!==null&&f.push(s.getX(b),s.getY(b),s.getX(x),s.getY(x),s.getX(w),s.getY(w)))},v=n.groups;if(v.length>0)for(let y=0;y<v.length;y++){let _=v[y],b=_.materialIndex===void 0?0:_.materialIndex,x=Math.max(_.start,0),w=Math.min(_.start+_.count,g);for(let S=x;S<w&&S+2<g;S+=3)m(S,b)}else for(let y=0;y+2<g;y+=3)m(y,0);return{positions:Float64Array.from(h),faces:Uint32Array.from(u),materialIndices:p,uvs:f===null?null:Float64Array.from(f)}}(t),i=this.subdivisions;for(;i-- >0;)e=WY(e);return function(n,r){let{positions:s,faces:a,materialIndices:o,uvs:l}=n,c=s.length/3,h=a.length/3,d=new Float64Array(3*c);for(let v=0;v<h;v++){let y=3*a[3*v],_=3*a[3*v+1],b=3*a[3*v+2],x=s[b]-s[_],w=s[b+1]-s[_+1],S=s[b+2]-s[_+2],E=s[y]-s[_],A=s[y+1]-s[_+1],P=s[y+2]-s[_+2],C=w*P-S*A,R=S*E-x*P,L=x*A-w*E;d[y]+=C,d[y+1]+=R,d[y+2]+=L,d[_]+=C,d[_+1]+=R,d[_+2]+=L,d[b]+=C,d[b+1]+=R,d[b+2]+=L}for(let v=0;v<c;v++){let y=d[3*v],_=d[3*v+1],b=d[3*v+2],x=Math.sqrt(y*y+_*_+b*b)||1;d[3*v]=y/x,d[3*v+1]=_/x,d[3*v+2]=b/x}let u=3*h,p=new Float32Array(3*u),f=new Float32Array(3*u),g=l!==null&&l.length>0?new Float32Array(2*u):null;for(let v=0;v<u;v++){let y=3*a[v];p[3*v]=s[y],p[3*v+1]=s[y+1],p[3*v+2]=s[y+2],f[3*v]=d[y],f[3*v+1]=d[y+1],f[3*v+2]=d[y+2]}g!==null&&g.set(l.subarray(0,2*u));let m=new jt;m.setAttribute("position",new Ht(p,3)),u>0&&(m.setAttribute("normal",new Ht(f,3)),m.setAttribute("color",new Ht(new Float32Array(3*u).fill(1),3))),g!==null&&m.setAttribute("uv",new Ht(g,2));for(let v=0;v<h;){let y=o[v],_=v;do v++;while(v<h&&o[v]===y);m.addGroup(3*_,3*(v-_),y)}return r.boundingBox!==null&&(m.boundingBox=r.boundingBox.clone()),r.boundingSphere!==null&&(m.boundingSphere=r.boundingSphere.clone()),m}(e,t)}}}),tL=z(()=>{tt(),qY(),Sn=new T,l6=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i,n=t.geometry??e?.geometry??new jt().copy(new va(100,100,100));e===void 0?(n.computeBoundingBox(),n.boundingBox.getSize(Sn),i={width:Sn.x,height:Sn.y,depth:Sn.z,subdivisions:0}):i=e.parameters;let r={...i,...t.parameters};return{parameters:{width:Math.abs(r.width),height:Math.abs(r.height),depth:Math.abs(r.depth),subdivisions:Math.abs(r.subdivisions)},geometry:n}}static build(t){let{width:e,height:i,depth:n,subdivisions:r}=t.parameters,s=t.geometry??new jt().copy(new va(100,100,100)),a=s.userData.parameters;a===void 0?(s.boundingBox=function(l){let c=new ci,h=l.attributes.position;return h?(c.setFromBufferAttribute(h),c):(c.makeEmpty(),c)}(s),s.boundingBox.getSize(Sn)):Sn.set(a.width,a.height,a.depth),(e!==Sn.x||i!==Sn.y||n!==Sn.z)&&s.scale(Sn.x===0?1:e/Sn.x,Sn.y===0?1:i/Sn.y,Sn.z===0?1:n/Sn.z);let o=s.originalGeometry;try{r>0?(o===void 0||a?.subdivisions!==r)&&(o===void 0&&(o=s),s=new o6(r).modify(o)):(o!==void 0&&(s=o),o=void 0,s.getAttribute("normal")===void 0&&s.computeVertexNormals())}catch{o!==void 0&&(s=o),o=void 0,s.getAttribute("normal")===void 0&&s.computeVertexNormals()}return o!==void 0&&Object.assign(s,{originalGeometry:o}),delete t.geometry,Object.assign(s,{userData:{...t,type:"NonParametricGeometry"}})}static loadFromUrl(t,e,i){new LC(i).load(t,n=>{let r=this.normalizeInputs({geometry:n});n.boundingBox.getSize(Sn);let s=100/Sn.x;Object.assign(r.parameters,{width:100,height:Sn.y*s,depth:Sn.z*s}),e(this.build(r))})}}}),aT=z(()=>{wh(),mh(),T3=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i=Object.assign({},e?.parameters??{width:100,depth:0,spikes:5,cornerRadius:0,extrudeBevelSize:0,extrudeBevelSegments:3},t.parameters);return{shape:t.shape&&t.shape instanceof ki?t.shape:new ki,parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??0)})}}static build(t){let{width:e,height:i,spikes:n,cornerRadius:r,depth:s,extrudeBevelSize:a,extrudeBevelSegments:o,extrusionVersion:l}=t.parameters,c=t.shape,h=.5*e,d=.5*i,u=2*Math.PI/n;for(let f=0;f<n;f++){let g=u*f,m=0+Math.sin(g)*h,v=0+Math.cos(g)*d;c.addPoint(c.createPoint(m,v))}c.isClosed=!0;for(let f=0,g=c.points.length;f<g;f++)c.points[f].roundness=r;c.roundness=r,c.update();let p=Sh.create({shape:c,parameters:{roundness:r,depth:s,extrudeBevelSize:a,extrudeBevelSegments:o,extrusionVersion:l}});return Object.assign(p,{userData:{...t,type:"PolygonGeometry"}})}}});function jf(t,e,i){i.x=t.x*e.x,i.y=t.y,i.z=t.x*e.y}function h2(t,e,i,n,r,s){let a=c6.copy(e).sub(t),o=d6.copy(i).sub(t),l=a.angleTo(o);if(a.normalize(),o.normalize(),n===r){let c=a.add(o).normalize();s.copy(t).addScaledVector(c,n/Math.sin(l/2))}else{let c=a.angleTo(o);s.copy(t),s.addScaledVector(a,r/Math.sin(c)),s.addScaledVector(o,n/Math.sin(c))}}function XY(t,e,i){let n=t.clone().sub(e),r=i.clone().sub(e);return n.projectOnVector(r),n.add(e)}var h6,c6,d6,eL,xx,u6,p6,f6,iL,C3,m6,g6,v6,y6,nL=z(()=>{tt(),h6=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i=Object.assign({},e?.parameters??{width:100,radialSegments:4,heightSegments:1,cornerRadius:0,cornerSegments:8,openEnded:!1},t.parameters);return{parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??i.width)})}}static build(t){let{width:e,height:i,depth:n,radialSegments:r,heightSegments:s,openEnded:a,cornerRadius:o,cornerSegments:l}=t.parameters,c=new eL(.5*e,i,r,s,a,o,l),h=n/e;return h!==1&&c.scale(1,1,h),Object.assign(c,{userData:{...t,type:"PyramidGeometry"}})}},c6=new T,d6=new T,eL=class extends jt{constructor(t=.5,e=1,i=4,n=1,r=!1,s=0,a=4){super(),i=Math.floor(Math.max(3,i)),n=Math.floor(n),a=Math.floor(a);let o,l=[],c=[],h=[],d=[],u=0,p=e/2,f=Math.PI/i,g=t*Math.cos(Math.PI/i),m=2*Math.PI/i,v=(i-2)*Math.PI/i,y=Math.PI-v,_=new T(0,-p,0),b=new T(0,p,0),x=new et(t,-p),w=new et(g,-p),S=new et(0,b.y).sub(w),E=new et(0,b.y).sub(x),A=new et(S.y,-S.x).normalize(),P=new et(E.y,-E.x).normalize(),C=t*Math.cos(Math.PI/i)*Math.tan((Math.PI-S.angle())/2)-1e-8;s=Math.min(s,C);{let j=new T(A.x,A.y,0),W=new T(Math.cos(m)*j.x,j.y,Math.sin(m)*j.x);o=j.angleTo(W)}let R=s/Math.tan((Math.PI-S.angle())/2),L=s/Math.tan((Math.PI-o)/2),D=new T;if(!r){c.push(_.x,_.y,_.z),h.push(0,-1,0),d.push(0,0);let j=u++,W=[],it=x.clone(),nt=R/Math.cos(Math.PI/i);it.x-=nt;for(let Y=0;Y<i;Y++){let ot=Y/i*Math.PI*2+f;jf(it,new et(Math.sin(ot),Math.cos(ot)),D),c.push(D.x,D.y,D.z),h.push(0,-1,0),d.push(0,0),W.push(u++)}for(let Y=0;Y<W.length;Y++)l.push(W[Y],j,W[(Y+1)%W.length])}let F=[];{let j=new T,W=new T,it=new T,nt=new T,Y=new T,ot=new T;for(let ht=0;ht<i;ht++){let ft=ht/i*Math.PI*2+f,pt=(ht+.5)/i*Math.PI*2+f,J=(ht+1)/i*Math.PI*2+f,mt=new et(Math.sin(ft),Math.cos(ft)),N=new et(Math.sin(pt),Math.cos(pt)),O=new et(Math.sin(J),Math.cos(J));jf(x,mt,W),jf(x,O,it),jf(A,N,j),h2(b,W,it,L,L,nt),c.push(nt.x,nt.y,nt.z),h2(W,b,it,L,R,Y),c.push(Y.x,Y.y,Y.z),h2(it,W,b,R,L,ot),c.push(ot.x,ot.y,ot.z),h.push(j.x,j.y,j.z),h.push(j.x,j.y,j.z),h.push(j.x,j.y,j.z),d.push(0,0),d.push(0,0),d.push(0,0);let H=u++,$=u++,B=u++;if(l.push(H,$,B),s>0){{let k=W.clone().add(it).multiplyScalar(.5),st=b.clone().sub(k).normalize(),dt=_.clone().sub(k).normalize().add(st).normalize().multiplyScalar(-1);V(k,ot.clone().sub(Y),dt,S.angle())}let Z,K;{let k=new T;jf(P,O,k);let st=ot.clone().add(nt).multiplyScalar(.5);st=XY(st,it,b);let dt=ot.clone().sub(nt);[Z,K]=V(st,dt,k,o,nt.y)}{let k=Z,st=k.clone().setY(0).normalize(),dt=new T(0,-1,0),bt=st.clone().cross(dt);U(k,st,dt,bt)}F.concat(K);{let k=S.angle(),st=Math.PI-k,dt=b.clone();dt.y-=s/Math.sin(k-Math.PI/2);let bt=new T,ct=[];for(let St=0;St<a;St++){let Dt=[],Mt=Math.PI/2-st*St/a,q=Math.cos(Mt),_t=Math.sin(Mt),Pt=pt;for(let Gt=0;Gt<=St;Gt++){let Ft=Math.cos(Pt),_e=Math.sin(Pt);j.x=q*_e,j.y=_t,j.z=q*Ft,bt.copy(dt).addScaledVector(j,s),c.push(bt.x,bt.y,bt.z),h.push(j.x,j.y,j.z),d.push(0,0),Dt.push(u++),Pt+=2*Math.PI/St/i}ct.push(Dt)}K.reverse(),ct.push(K);let It=ct.length-1;for(let St=0;St<It;St++){let Dt=ct[St],Mt=ct[St+1],q=Dt.length-1;l.push(Mt[1],Dt[0],Mt[0]);for(let _t=1;_t<=q;_t++)l.push(Dt[_t],Dt[_t-1],Mt[_t]),l.push(Mt[_t+1],Dt[_t],Mt[_t])}}}}}function V(j,W,it,nt,Y){let ot=-nt/2,ht=(Math.PI-nt)/2,ft=W.clone().normalize().cross(it);j.addScaledVector(it,-s/Math.sin(ht));let pt=new T,J=new T,mt=u,N=[];for(let O=0;O<=a;O++){let H=ot+O/a*nt;J.set(0,0,0),J.addScaledVector(ft,Math.sin(H)),J.addScaledVector(it,Math.cos(H));for(let $=0;$<=1;$++){let B=$/1-.5;if(pt.copy(j),pt.addScaledVector(W,B),pt.addScaledVector(J,s),Y!=null){let Z=Math.max(0,pt.y-Y);pt.addScaledVector(W,-Z/W.y)}c.push(pt.x,pt.y,pt.z),h.push(J.x,J.y,J.z),d.push(0,0),$===0&&N.push(u),u++}}for(let O=0;O<a;O++)for(let H=0;H<1;H++){let $=mt+H+2*O,B=$+2,Z=B+1,K=$+1;l.push($,B,K),l.push(B,Z,K)}return[j.clone().addScaledVector(W,.5),N]}function U(j,W,it,nt){let Y=Math.PI/2,ot=E.angle()-Y,ht=[],ft=new T,pt=new T;for(let mt=0;mt<=a;mt++){let N=[],O=mt/a;for(let H=0;H<=mt;H++){let $=((mt?H/mt:0)-.5)*y,B=Math.cos($),Z=Math.sin($),K=(Y+Math.atan(Math.tan(ot)*B))*O,k=Math.cos(K),st=Math.sin(K);ft.set(0,0,0),ft.addScaledVector(W,st*B),ft.addScaledVector(it,k),ft.addScaledVector(nt,st*Z),pt.copy(j).addScaledVector(ft,s),c.push(pt.x,pt.y,pt.z),h.push(ft.x,ft.y,ft.z),d.push(0,0),N.push(u++)}ht.push(N)}let J=ht.length-1;for(let mt=0;mt<J;mt++){let N=ht[mt],O=ht[mt+1],H=N.length-1;l.push(N[0],O[1],O[0]);for(let $=1;$<=H;$++)l.push(N[$-1],N[$],O[$]),l.push(N[$],O[$+1],O[$])}}this.setIndex(l),this.setAttribute("position",new Nt(c,3)),this.setAttribute("normal",new Nt(h,3)),this.setAttribute("uv",new Nt(d,2))}}}),wb=z(()=>{wh(),mh(),xx=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i=Object.assign({},e?.parameters??{width:100,depth:0,cornerRadius:[0,0,0,0],cornerType:1,extrudeBevelSize:0,extrudeBevelSegments:1},t.parameters),n=Object.assign(e?.ui??{enabledIndieCorners:!1},t.ui);return{shape:t.shape&&t.shape instanceof ki?t.shape:new ki,parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??0)}),ui:n}}static build(t){let e=t.shape,{width:i,height:n,cornerRadius:r,cornerType:s,depth:a,extrudeBevelSize:o,extrudeBevelSegments:l,extrusionVersion:c}=t.parameters,h={x:.5*i,y:.5*n},d={x:-h.x,y:-h.y},u={x:h.x,y:h.y};function p(x,w,S){return w>i&&S>n?Math.min(x*i/w,x*n/S):w>i?x*i/w:S>n?x*n/S:x}let f=[];f[0]=r[0]===0?0:p(r[0],r[0]+r[3],r[0]+r[1]),f[1]=r[1]===0?0:p(r[1],r[1]+r[2],r[1]+r[0]),f[2]=r[2]===0?0:p(r[2],r[2]+r[1],r[2]+r[3]),f[3]=r[3]===0?0:p(r[3],r[3]+r[0],r[3]+r[2]);let g=d.x,m=u.x,v=u.y,y=d.y;e.addPoint(e.createPoint(g,v)),e.addPoint(e.createPoint(m,v)),e.addPoint(e.createPoint(m,y)),e.addPoint(e.createPoint(g,y)),e.isClosed=!0;let _=!0;for(let x=0,w=e.points.length;x<w;x++)e.points[x].roundness=f[x],x>0&&f[x]!==f[x-1]&&(_=!1);_&&(e.roundness=f[0]),e.useCubicForRoundedCorners=s!==1,e.update();let b=Sh.create({shape:e,parameters:{depth:a,extrudeBevelSize:o,extrudeBevelSegments:l,extrusionVersion:c}});return Object.assign(b,{userData:{...t,type:"RectangleGeometry"}})}}}),rL=z(()=>{tt(),u6=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i=Object.assign({},e?.parameters??{width:100,widthSegments:64,heightSegments:64,phiStart:0,phiLength:2*Math.PI,thetaStart:0,thetaLength:180},t.parameters);return i.thetaLength=Ot.clamp(i.thetaLength,0,180),{parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??i.width)})}}static build(t){let e,{width:i=100,height:n=i,depth:r=i,widthSegments:s=64,heightSegments:a=64,phiStart:o,phiLength:l,thetaStart:c,thetaLength:h}=t.parameters;return h===0?(e=new jt,e.setAttribute("position",new Nt([],3))):e=new hh(.5*i,s,a,o,l,c,h*Ot.DEG2RAD),e.scale(1,n/i,r/i),Object.assign(e,{userData:{...t,type:"SphereGeometry"}})}}}),sL=z(()=>{tt(),p6=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i=Object.assign({},e?.parameters??{width:100,depth:0,widthSegments:8,heightSegments:8},t.parameters);return{parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:0})}}static build(t){let{width:e=100,height:i=e,widthSegments:n=8,heightSegments:r=8}=t.parameters,s=new ho(e,i,n,r);return s.scale(1,1,1),Object.assign(s,{userData:{...t,type:"PlaneGeometry"}})}}}),aL=z(()=>{tt(),f6=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i=Object.assign({},e?.parameters??{width:100,angle:90,cornerRadius:24,cornerSegments:8},t.parameters);return{parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??i.width)})}}static build(t){let{width:e,height:i,depth:n,angle:r,cornerRadius:s,cornerSegments:a}=t.parameters,o=new iL(e,i,n,r,s,a);return Object.assign(o,{userData:{...t,type:"BackdropGeometry"}})}},iL=class extends jt{constructor(t=1,e=1,i=1,n=90,r=10,s=24){super(),this.type="BackdropGeometry";let a=[],o=[],l=[],c=.001;r==0&&(s=1),s=Math.max(1,Math.floor(s)),r=Math.min(r,100),n=Math.min(180-c,n),n*=Math.PI/180;let h=[],d=Math.PI/2,u=(pt=0,J=0,mt=0)=>new T(pt,J,mt),p=u(),f=u(),[g,m,v]=[e/2,t/2,i/2],y=-m,_=+m,[b,x,w]=[u(y,-g,+v),u(y,-g,-v),u(y,+g,-v)],S=(pt,J=!1)=>Math.sin(pt-Math.PI/(+J+1)),E=(pt,J=!1)=>Math.cos(pt-Math.PI/(+J+1));w.y=Math.sin(n)*e-g;let A=Math.cos(n)*e-v,P=b.z-c;n<=d?(w.z=Math.min(A,P),w.z==P&&(w.y-=(A-P)/Math.tan(d-n))):x.z=Math.min(x.z-A-v,b.z-c),p.subVectors(b,x),f.subVectors(w,x);let C=Math.min(p.length(),f.length())*r/100,R=C*Math.tan(n/2),L=C/Math.cos(n/2),D=p.clone().normalize().add(f.normalize()).setLength(L).add(x);p.set(0,S(n,!0),E(n,!0)),h.push([w,p.clone()]);let F=(Math.PI-n)/s;for(let pt=0;pt<=s;pt++){let J=d+n+pt*F;p.set(0,Math.sin(J)*R,Math.cos(J)*R),p.add(D),f.set(0,S(J),E(J)),h.push([p.clone(),f.clone()])}h.push([b,u(0,1,0)]);let V=Math.sin(F/2)*R*2,U=h.length-1,j=h[0][0].distanceTo(h[1][0]),W=j+V*s+h[U-1][0].distanceTo(h[U][0]);h[0].push(1);for(let pt=0;pt<=s;pt++)h[pt+1].push(1-(j+pt*V)/W);h[U].push(0);let it,nt,Y,[ot,ht,ft]=h[0];for(let pt=1;pt<h.length;pt++)[it,nt,Y]=h[pt],a.push(y,ot.y,ot.z,y,it.y,it.z,_,ot.y,ot.z,_,ot.y,ot.z,y,it.y,it.z,_,it.y,it.z),o.push(0,ht.y,ht.z,0,nt.y,nt.z,0,ht.y,ht.z,0,ht.y,ht.z,0,nt.y,nt.z,0,nt.y,nt.z),l.push(0,ft,0,Y,1,ft,1,ft,0,Y,1,Y),[ot,ht,ft]=[it,nt,Y];this.setAttribute("position",new Nt(a,3)),this.setAttribute("normal",new Nt(o,3)),this.setAttribute("uv",new Nt(l,2))}}}),oT=z(()=>{wh(),mh(),C3=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i=Object.assign({},e?.parameters??{width:100,depth:0,innerRadiusPercent:38.19,spikes:5,cornerRadius:0,angle:360,extrudeBevelSize:0,extrudeBevelSegments:1},t.parameters);return{shape:t.shape&&t.shape instanceof ki?t.shape:new ki,parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??0)})}}static build(t){let{width:e,height:i,innerRadiusPercent:n,spikes:r,cornerRadius:s,angle:a,depth:o,extrudeBevelSize:l,extrudeBevelSegments:c,extrusionVersion:h}=t.parameters,d=t.shape,u=.5*e,p=.5*i,f=a*Math.PI/360/r,g=Math.PI/2*3*-1,m=u*n/100,v=p*n/100;if(r===3&&n===50){f=2*Math.PI/r;for(let _=0;_<r;_++){let b=f*_,x=0+Math.sin(b)*u,w=0+Math.cos(b)*p;d.addPoint(d.createPoint(x,w))}}else for(let _=0;_<r;_++){let b=0+Math.cos(g)*u,x=0+Math.sin(g)*p;d.addPoint(d.createPoint(b,x)),g+=f,b=0+Math.cos(g)*m,x=0+Math.sin(g)*v,d.addPoint(d.createPoint(b,x)),g+=f}d.isClosed=!0;for(let _=0,b=d.points.length;_<b;_++)d.points[_].roundness=s;d.roundness=s,d.update();let y=Sh.create({shape:d,parameters:{roundness:s,depth:o,extrudeBevelSize:l,extrudeBevelSegments:c,extrusionVersion:h}});return Object.assign(y,{userData:{...t,type:"StarGeometry"}})}}}),oL=z(()=>{tt(),m6=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i=Object.assign({},e?.parameters??{width:100,depth:0},t.parameters);return{parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??0)})}}static build(t){let{width:e,height:i}=t.parameters,n=new ho(e,i);return Object.assign(n,{userData:{...t,type:"TextFrameGeometry"}})}}}),lL=z(()=>{tt(),Xg(),g6=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i=Object.assign({},e?.parameters??{width:100,radialSegments:32,tubularSegments:64,arc:360,cornerRadius:30,cornerSegments:8},t.parameters),n=Math.abs(i.width),r=Math.abs(i.height??i.width);i.shapeBlendNode&&(r=n);let s=Math.round(Math.abs(i.depth??.25*i.width));return{parameters:Object.assign(i,{width:n,height:r,depth:s})}}static build(t){let{width:e,height:i,depth:n,radialSegments:r,tubularSegments:s,arc:a,cornerRadius:o,cornerSegments:l}=t.parameters,c=function(h,d,u,p,f,g,m,v,y,_,b){[d,u]=[u,d],m=d/2;let x=Ot.clamp(f/360,0,1);if(x===0){let w=new jt;return w.setAttribute("position",new Nt([],3)),w}return x===1&&(_=0),new XA(!0,h,d,u,p,x,g,m,0,y,_,b)}(e,i,n,.5*e,a,s,0,0,r,o,l);return c.scale(1,i/e,1),Object.assign(c,{userData:{...t,type:"TorusGeometry"}})}}}),hL=z(()=>{tt(),v6=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i=Object.assign({},e?.parameters??{width:100,tubularSegments:64,radialSegments:32,p:2,q:3},t.parameters);return{parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??i.width),tube:i.tube??.125*i.width})}}static build(t){let{width:e,tube:i,tubularSegments:n,radialSegments:r,p:s,q:a}=t.parameters,o=.5*e;o!==i&&(o-=i);let l=new NE(o,i,n,r,s,a);return Object.assign(l,{userData:{...t,type:"TorusKnotGeometry"}})}}}),cL=z(()=>{wh(),mh(),y6=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i=Object.assign({},e?.parameters??{width:100,depth:0,spikes:5,cornerRadius:0,extrudeBevelSize:0,extrudeBevelSegments:1,isRect:!1},t.parameters);return{shape:t.shape&&t.shape instanceof ki?t.shape:new ki,parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width*(i.isRect?1:Math.sqrt(3)/2)),depth:Math.abs(i.depth??0)})}}static build(t){let{width:e=100,height:i,cornerRadius:n,depth:r,extrudeBevelSize:s,extrudeBevelSegments:a,isRect:o,extrusionVersion:l}=t.parameters,c=t.shape,h=.5*e,d=.5*i;o?(c.addPoint(c.createPoint(-h,d)),c.addPoint(c.createPoint(h,-d)),c.addPoint(c.createPoint(-h,-d))):(c.addPoint(c.createPoint(0,d)),c.addPoint(c.createPoint(h,-d)),c.addPoint(c.createPoint(-h,-d))),c.isClosed=!0;for(let p=0,f=c.points.length;p<f;p++)c.points[p].roundness=n;c.roundness=n,c.update();let u=Sh.create({shape:c,parameters:{roundness:n,depth:r,extrudeBevelSize:s,extrudeBevelSegments:a,extrusionVersion:l}});return Object.assign(u,{userData:{...t,type:"TriangleGeometry"}})}}}),$Y=z(()=>{}),YY=z(()=>{tt(),new yr,new At,new Jo,new T,new T,new T,new T});function dL(){let t=new jt;return t.setAttribute("position",new Ht(new Float32Array([]),3)),t.setIndex(new Ht(new Uint16Array([]),1)),t}var uL,lT,_6=z(()=>{Dn(),$t(),h0(),tt(),s0(),wh(),mh(),Ap(),uL=dL().attributes,lT=class extends jt{constructor(t,e){super(),this.isTextGeometry=!0,this.charWidths=[],this.charCoords=[],this.wrappedText=[],this.isLowResolution=!1,this.vectorShapes=[],this._nearSide=new Uint8Array(0),this._depth=0,this._effectiveBevel=0,this._vScale=0,Object.assign(this.attributes,uL),this.userData={parameters:t,type:"TextGeometry"};let i=e.getFont(t.font);i?.isLoaded?(this.font=i,this.update(t,e)):this.updateFont(t.font,e).then(()=>{this.update(t,e),e?.requestRender()})}async updateFont(t,e){let i=e.getFont(t);i&&(this.font=i,await i.loadingPromise)}update(t,e){let i=this.font;if(this.userData={parameters:t,type:"TextGeometry"},!i?.isLoaded)return void console.warn("Cannot update text because its font is not loaded");let{width:n,height:r,depth:s,extrudeBevelSize:a,extrudeBevelSegments:o,text:l,textTransform:c,fontSize:h,extrusionVersion:d}=t,u=br.getDisplayedValue(l),p=function(w,S,E,A){let P=typeof w.width=="string"?Number(A.getVariable(w.width)):w.width,C=[""],R="";for(let L of E)R+=L,L===" "||L===`
4176
+ `;return 2&x.valid||e(3,"missing format specifier"),4&x.valid||e(3,"missing image size specifier"),x}(s),h=c.width,d=c.height,u=function(p,f,g){let m=f;if(m<8||m>32767||p[0]!==2||p[1]!==2||128&p[2])return new Uint8Array(p);m!==(p[2]<<8|p[3])&&e(3,"wrong scanline width");let v=new Uint8Array(4*f*g);v.length||e(4,"unable to allocate buffer space");let y=0,_=0,b=4*m,x=new Uint8Array(4),w=new Uint8Array(b),S=g;for(;S>0&&_<p.byteLength;){_+4>p.byteLength&&e(1),x[0]=p[_++],x[1]=p[_++],x[2]=p[_++],x[3]=p[_++],(x[0]!=2||x[1]!=2||(x[2]<<8|x[3])!=m)&&e(3,"bad rgbe scanline format");let E,A=0;for(;A<b&&_<p.byteLength;){E=p[_++];let C=E>128;if(C&&(E-=128),(E===0||A+E>b)&&e(3,"bad scanline data"),C){let R=p[_++];for(let L=0;L<E;L++)w[A++]=R}else w.set(p.subarray(_,_+E),A),A+=E,_+=E}let P=m;for(let C=0;C<P;C++){let R=0;v[y]=w[C+R],R+=m,v[y+1]=w[C+R],R+=m,v[y+2]=w[C+R],R+=m,v[y+3]=w[C+R],y+=4}S--}return v}(s.subarray(s.pos),h,d);switch(this.type){case $e:l=u.length/4;let p=new Float32Array(4*l);for(let g=0;g<l;g++)n(u,4*g,p,4*g);a=p,o=$e;break;case $n:l=u.length/4;let f=new Uint16Array(4*l);for(let g=0;g<l;g++)r(u,4*g,f,4*g);a=f,o=$n;break;default:throw new Error("THREE.HDRLoader: Unsupported type: "+this.type)}return{width:h,height:d,data:a,header:c.string,gamma:c.gamma,exposure:c.exposure,type:o,colorSpace:Wu,minFilter:de,magFilter:de,generateMipmaps:!1,flipY:!0}}setDataType(t){return this.type=t,this}}});function S4(t){return t.length>2&&t[0]===35&&t[1]===63}var M4,g3,Ko,TY=z(()=>{tt(),AY()}),Tk=z(()=>{tt(),Ek(),Ak(),TY(),M4=0,g3=class extends xk{constructor(t,e){super(t,e.imageHolderCache),this.data=t,this.shared=e,this.instanceId=++M4,this.loaded=!1,this.isVideo=!1,this.isBuffer=!1,this.isHdr=!1,this._cache={1e3:{},1001:{},1002:{}},this.isVideo=t.type==="video",this.isBuffer=t.isWebGLRenderTarget===!0,this.loadPromise=this.updateSrc(this.isBuffer?t:t.data)}async updateSrc(t){if(typeof document>"u")return;this.disposeTextures(),this.loaded=!1,this.isHdr=!1;let e=()=>{this.loaded=!0;for(let n of Object.values(this._cache))for(let r of Object.values(n))for(let s of Object.values(r))s&&(s.image=this.img,s.needsUpdate=!0);this.shared.requestRender()};if(this.isBuffer)this.img=t,this.loaded=!0;else if(this.isVideo){if(this.img=document.createElement("video"),this.img.preload="auto",this.img.playsInline=!0,this.img.currentTime=.01,typeof t!="string"){let n,r=new FileReader;r.readAsDataURL(new Blob([t],{type:"video/mp4"})),await new Promise(s=>{r.onloadend=a=>{n=a.target?.result,s(null)}}),this.img.src=n}else this.img.src=t;this.img.onloadeddata=()=>{e()}}else if(t instanceof Uint8Array?S4(t):typeof t=="string"&&/\.hdr($|[?#])/i.test(t)){let n=t instanceof Uint8Array?t:null;if(n===null)try{n=new Uint8Array(await(await fetch(t)).arrayBuffer())}catch{n=null}let r=n!==null&&S4(n)?function(s){try{let a=new Sk().parse(s.buffer.slice(s.byteOffset,s.byteOffset+s.byteLength));if(!a||!a.width||!a.height)return null;let{width:o,height:l}=a,c=a.data,h=new Uint16Array(c.length),d=4*o,u=g=>Zl.toHalfFloat(Math.pow(Math.max(Zl.fromHalfFloat(g),0),1/2.2)),p=new Map,f=g=>{let m=p.get(g);return m===void 0&&(m=u(g),p.set(g,m)),m};for(let g=0;g<l;g++){let m=g*d,v=(l-1-g)*d;for(let y=0;y<d;y+=4)h[v+y]=f(c[m+y]),h[v+y+1]=f(c[m+y+1]),h[v+y+2]=f(c[m+y+2]),h[v+y+3]=c[m+y+3]}return{isSplineHdr:!0,data:h,width:o,height:l}}catch{return null}}(n):null;r!==null&&(this.isHdr=!0,this.img=r,e())}else this.img=new Image,this.img.src=typeof(i=t)=="string"?i:(yg||(yg=new bk),yg.load(i)),this.img.onload=e,await new Promise(n=>{this.img.onload=()=>{e(),n(null)}});var i}getTexture(t,e=1008,i=1006){let n=this._cache[t]?.[e]?.[i];if(n)return n;{let r;return this.isBuffer?r=this.img.texture:this.isVideo?r=new rF(this.img,void 0,t,t):this.isHdr?(r=function(s){let a=new Cn(s.data,s.width,s.height,Xi,$n);return a.flipY=!1,a.image.isSplineHdr=!0,a.needsUpdate=!0,a}(this.img),r.wrapS=t,r.wrapT=t,r.magFilter=i,r.minFilter=e):r=new Fi(this.img,void 0,t,t,i,e),this.isBuffer||(r.anisotropy=8,r.generateMipmaps=e===1008),this.loaded&&(r.needsUpdate=!0),this._cache[t]===void 0&&(this._cache[t]={}),this._cache[t][e]===void 0&&(this._cache[t][e]={}),this._cache[t][e][i]=r,r}}setNeedsUpdate(t){if(!this.isBuffer)for(let e of Object.values(this._cache))for(let i of Object.values(e))for(let n of Object.values(i))n&&(n.needsUpdate=t)}disposeTextures(){for(let[t,e]of Object.entries(this._cache))for(let[i,n]of Object.entries(e))for(let[r,s]of Object.entries(n))s?.dispose(),this._cache[t]!==void 0&&this._cache[t][i]!==void 0&&(this._cache[t][i][r]=void 0)}dispose(){super.dispose(),this.disposeTextures()}}}),v3=z(()=>{Tk(),Ko=class extends g3{}});function CY(t){if(typeof t=="string")return t;let e=ZA.get(t);return e||(e={url:URL.createObjectURL(new Blob([t]))},ZA.set(t,e)),e.url}var ZA,PY=z(()=>{ZA=new Map});function DY(){if(!KA)return E4||(E4=async function(){await Promise.resolve().then(()=>(GP(),f7)),Ck(window!==void 0?window:global),KA=!0}())}var Ck,Pk,KA,E4,Dk=z(()=>{Pk=new Promise(t=>{Ck=t}),KA=!1});function A4(t,e){t.forEach(i=>{"dragDropActions"in i.data?(e.push(...i.data.dragDropActions.drag),e.push(...i.data.dragDropActions.drop)):"inActions"in i.data?(e.push(...i.data.inActions),e.push(...i.data.outActions)):"gameActions"in i.data?(e.push(...i.data.gameActions.idle),e.push(...i.data.gameActions.move),e.push(...i.data.gameActions.jump),e.push(...i.data.gameActions.run)):"breakpoints"in i.data?i.data.breakpoints.forEach(n=>{e.push(...n.data.actions)}):"actions"in i.data&&(e.push(...i.data.actions),i.data.actions.forEach(n=>{n.data.type==="Conditional"&&n.data.ifActions&&(e.push(...n.data.ifActions),e.push(...n.data.elseActions))}))})}function RY(t){let e=!1,i=[];return t.scene.objects.traverse((n,r)=>{if(r.type==="Page"&&r.uiScene!==void 0&&r.uiScene.objects.traverse((s,a)=>{if(a.events===void 0||Array.isArray(a.events)===!1)return!0;A4(a.events,i),e=e||i.some(o=>o.data.type==="Audio")}),r.events===void 0||Array.isArray(r.events)===!1)return!0;A4(r.events,i),e=e||i.some(s=>s.data.type==="Audio")}),e}var T4,Fu,y3=z(()=>{PY(),Dk(),Pk.then(t=>T4=t),Fu=class{constructor({src:t,volume:e,delay:i,loop:n}){let r;this._volume=1,this.delay=0,this._loop=1,this.loopsRemaining=0,this._status="stopped",this.onEnd=()=>{this.loopsRemaining===1/0?this.replay():this.loopsRemaining>1?(this.replay(),this.loopsRemaining--):(this._status="stopped",this.loopsRemaining=this._loop)},r=typeof t=="string"?{src:t}:{src:CY(t),format:"wav"},this.sound=new T4.Howl(r),this.sound.on("end",this.onEnd),this.src=t,e!==void 0&&(this.volume=e),i!==void 0&&(this.delay=i),n!==void 0&&(this.loop=n)}get status(){return this._status}get volume(){return this._volume}set volume(t){this._volume=t,this.sound.volume(t)}get loop(){return this._loop}set loop(t){this._loop=t,this.loopsRemaining=t}replay(){this.clearDelay(),this.delayTimerId=window.setTimeout(()=>{this.sound.play(),this.clearDelay()},this.delay)}fade(t,e=1e3){t?(this.sound.volume(this._volume),this.clearFade(),this.fadeTimerId=window.setTimeout(()=>{this.sound.fade(this._volume,0,e),this.clearFade()},t)):this.sound.fade(this._volume,0,e)}on(t,e,i){this.sound.on(t,e,i)}off(t,e,i){this.sound.off(t,e,i)}play(){this._status==="playing"||this.sound.playing()||(this._status==="paused"?(this.sound.seek()===0?this.replay():this.sound.play(),this._status="playing"):this._status==="stopped"&&(this.replay(),this._status="playing"))}pause(){this._status==="playing"&&(this.sound.pause(),this.clearFade(),this.clearDelay(),this._status="paused")}stop(){this.sound.stop(),this.loopsRemaining=this._loop,this.clearFade(),this.clearDelay(),this._status="stopped"}clearFade(){this.fadeTimerId&&(clearTimeout(this.fadeTimerId),delete this.fadeTimerId)}clearDelay(){this.delayTimerId&&(clearTimeout(this.delayTimerId),delete this.delayTimerId)}dispose(t=!1){this.off(),this.stop(),this.clearFade(),this.clearDelay()}}});function C4(t){let e=!1;return t.scene.objects.traverse((i,n)=>{n.type==="Mesh"&&(n.geometry.type==="TextGeometry"||n.geometry.type==="InputGeometry")&&(e=!0)}),e}var _3,b3=z(()=>{_3=null});function P4(t){return new et(t.y,-t.x)}var x3,QA,Rk,Ik,Lv,D4,gb,Ok,i2,vb=z(()=>{tt(),x3=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i=t.parameters?.radiusTop,n=t.parameters?.radiusBottom,r=Object.assign({},e?.parameters??{width:100,radialSegments:64,heightSegments:1,openEnded:!1,thetaStart:0,thetaLength:360,cornerRadius:8,cornerSegments:8,hollow:0},t.parameters);r.thetaLength=Ot.clamp(r.thetaLength,0,360),r.hollow=Ot.clamp(r.hollow??0,0,1);let s=r.width/2,a=r.radiusTop??s,o=r.radiusBottom??s;if(a===o?(a=s,o=s):a>o?(a=s,o=o*s/a):(a=a*s/o,o=s),r.shapeBlendNode){a=i??s,o=n??s;let l=2*Math.max(a,o);r.width=l,r.depth=l}return{parameters:Object.assign(r,{width:Math.abs(r.width),height:Math.abs(r.height??r.width),depth:Math.abs(r.depth??r.width),radiusTop:a,radiusBottom:o})}}static build(t){let e,{width:i,depth:n,height:r,radialSegments:s,heightSegments:a,openEnded:o,thetaStart:l,thetaLength:c,radiusTop:h,radiusBottom:d,cornerRadius:u,cornerSegments:p,hollow:f}=t.parameters;c===0?(e=new jt,e.setAttribute("position",new Nt([],3))):e=u||f?new QA(h,d,r,s,a,o,l,c*Math.PI/180,u,u,p,f):new sg(h,d,r,s,a,o,l,c*Math.PI/180);let g=n/i;return g!==1&&e.scale(1,1,g),Object.assign(e,{userData:{...t,type:"CylinderGeometry"}})}},QA=class extends jt{constructor(t,e,i,n,r,s,a,o,l,c,h,d,u=!1){super(),this.type="RoundedCylinderBufferGeometry",t=t!==void 0?t:1,e=e!==void 0?e:1,i=i||1,n=Math.floor(n)||8,r=Math.floor(r)||1,s=s!==void 0&&s,a=a!==void 0?a:0,o=o!==void 0?o:2*Math.PI,s&&(l=0,c=0);let p=i/2;u&&t==0&&(t=l),u&&e==0&&(e=c);let f=new et(t,p),g=new et(e,-p),m=null,v=null,y=null,_=null,b=f.clone().sub(g),x=0,w=0,S=0;d>0&&(x=Math.min(t,e)*(1-d),w=t-x,S=e-x);let E=f.clone();E.x-=x;let A=Math.PI-b.angle(),P=b.angle(),C=Math.tan(P/2),R=Math.tan(A/2),L=C+R,D=d?L:R,F=d?L:C;if(l=Math.min(l,(t-w)/D,b.length()/L),c=Math.min(c,(e-S)/F,b.length()/L),l>0){let st=l/C;m=f.clone().sub(new et(st,l)),d&&(y=m.clone(),y.x-=x-L*l),f.sub(b.clone().setLength(st))}if(c>0){let st=c/R;v=g.clone().sub(new et(st,-c)),g.add(b.clone().setLength(st)),d&&(_=v.clone(),_.x-=x-L*c,E.sub(b.clone().setLength(st)))}b=f.clone().sub(g);let V=b.length()<.5,U=[],j=[],W=[],it=[],nt=[],Y=[],ot=(st,dt,bt,ct,It)=>{for(let St=0;St<h+1;St++){let Dt=St/h,Mt=ct<0?Dt:1-Dt;It&&(Mt-=1),Mt*=st;let q=Math.sin(Mt),_t=Math.cos(Mt)*ct,Pt=_t*dt+bt.y;U.push(q*dt+bt.x),j.push(Pt),W.push(q),it.push(_t),nt.push(.5+Pt/i),Y.push(!1)}},ht=(st,dt,bt)=>{let ct=[st,dt];bt<0&&ct.reverse();for(let It of ct)U.push(It),j.push(p*bt),W.push(0),it.push(bt),nt.push(.5),Y.push(!0)};if(_&&v?(ot(A,c,_,-1,!0),ot(P,c,v,-1,!1)):v?(ht(v.x,0,-1),ot(P,c,v,-1,!1)):s||ht(e,S,-1),!V){let st=P4(b).normalize();for(let dt=0;dt<=r;dt++){let bt=dt/r,ct=b.y*bt+g.y;U.push(b.x*bt+g.x),j.push(ct),W.push(st.x),it.push(st.y),nt.push(.5+ct/i),Y.push(!1)}}if(y&&m?(ot(A,l,m,1,!1),ot(P,l,y,1,!0)):m?(ot(A,l,m,1,!1),ht(m.x,0,1)):s||ht(t,w,1),d&&!V){let st=P4(b).multiplyScalar(-1).normalize();for(let dt=0;dt<=r;dt++){let bt=dt/r,ct=b.y*-bt+E.y;U.push(b.x*-bt+E.x),j.push(ct),W.push(st.x),it.push(st.y),nt.push(.5+ct/i),Y.push(!1)}}let ft=U.length,pt=ft+(d&&!s?1:0),J=(st,dt)=>st*ft+(dt===ft?0:dt),mt=o<2*Math.PI,N=(n+1)*ft+(mt?2*(1+pt):0),O=new Float32Array(3*N),H=new Float32Array(3*N),$=new Float32Array(2*N),B=N-1>65535?new Uint32Array(n*Math.max(0,pt-1)*6+(mt?2*(pt+1)*3:0)):new Uint16Array(n*Math.max(0,pt-1)*6+(mt?2*(pt+1)*3:0)),Z=0,K=0;for(let st=0;st<=n;st++){let dt=st/n,bt=dt*o+a,ct=Math.sin(bt),It=Math.cos(bt);for(let St=0;St<ft;St++){let Dt=3*K,Mt=2*K,q=U[St],_t=W[St];O[Dt]=q*ct,O[Dt+1]=j[St],O[Dt+2]=q*It,H[Dt]=_t*ct,H[Dt+1]=it[St],H[Dt+2]=_t*It,Y[St]?($[Mt]=.5,$[Mt+1]=.5):($[Mt]=dt,$[Mt+1]=nt[St]),K++}}for(let st=0;st<n;st++)for(let dt=0;dt<pt-1;dt++){if(s&&d&&dt==r)continue;let bt=J(st,dt),ct=J(st+1,dt),It=J(st+1,dt+1),St=J(st,dt+1),Dt=O[3*It+0],Mt=O[3*It+2];B[Z++]=bt,B[Z++]=ct,B[Z++]=St,(Dt!=0||Mt!=0)&&(B[Z++]=ct,B[Z++]=It,B[Z++]=St)}function k(st,dt,bt){let ct=Math.sin(bt),It=Math.cos(bt),St=-It,Dt=ct,Mt=st<0?(Ft,_e,be)=>{B[Z++]=Ft,B[Z++]=_e,B[Z++]=be}:(Ft,_e,be)=>{B[Z++]=Ft,B[Z++]=be,B[Z++]=_e},q=(t+e+w+S)/4,_t=3*K,Pt=2*K;O[_t]=q*ct,O[_t+1]=0,O[_t+2]=q*It,H[_t]=St,H[_t+1]=0,H[_t+2]=Dt,$[Pt]=.5,$[Pt+1]=.5;let Gt=K++;for(let Ft=0;Ft<pt;Ft++){let _e=3*(dt+(Ft===ft?0:Ft));_t=3*K,Pt=2*K,O[_t]=O[_e],O[_t+1]=O[_e+1],O[_t+2]=O[_e+2],H[_t]=St,H[_t+1]=0,H[_t+2]=Dt;let be=_e/3*2|0;$[Pt]=$[be],$[Pt+1]=$[be+1],K++}for(let Ft=Gt+1;Ft<K-1;Ft++)Mt(Gt,Ft,Ft+1);Mt(Gt,K-1,Gt+1)}mt&&(k(-1,0,a),k(1,n*ft,a+o)),this.setIndex(new Ht(B.slice(0,Z),1)),this.setAttribute("position",new Ht(O,3)),this.setAttribute("normal",new Ht(H,3)),this.setAttribute("uv",new Ht($,2))}}}),R4=z(()=>{tt(),vb(),Rk=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i=Object.assign({},e?.parameters??{width:100,radialSegments:32,heightSegments:8,openEnded:!1,thetaStart:0,thetaLength:360,cornerRadiusTop:8,cornerRadiusBottom:8,cornerSegments:8},t.parameters);return i.thetaLength=Ot.clamp(i.thetaLength,0,360),{parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??i.width)})}}static build(t){let e,{width:i,depth:n,height:r,radialSegments:s,heightSegments:a,openEnded:o,thetaStart:l,thetaLength:c,cornerRadiusTop:h,cornerRadiusBottom:d,cornerSegments:u}=t.parameters;c===0?(e=new jt,e.setAttribute("position",new Nt([],3))):e=h>0||d>0||c<360?new QA(0,i/2,r,s,a,o,l,c*Math.PI/180,h,d,u,0,!0):new B_(i/2,r,s,a,o);let p=n/i;return p!==1&&e.scale(1,1,p),Object.assign(e,{userData:{...t,type:"ConeGeometry"}})}}}),I4=z(()=>{tt(),Ik=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i=Object.assign({},e?.parameters??{width:100,widthSegments:1,heightSegments:1,depthSegments:1,cornerRadius:8,cornerSegments:8},t.parameters);return{parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??i.width)})}}static build(t){let e,{width:i,height:n,depth:r,widthSegments:s,heightSegments:a,depthSegments:o,cornerRadius:l,cornerSegments:c}=t.parameters;return e=l===0?new va(i,n,r,s,a,o):new D4(i,n,r,s,a,o,l,c),Object.assign(e,{userData:{...t,type:"CubeGeometry"}})}},Lv=Math.PI/2,D4=class extends jt{constructor(t=1,e=1,i=1,n=1,r=1,s=1,a=0,o=4){super(),this.type="BoxGeometry",n=Math.floor(n),r=Math.floor(r),s=Math.floor(s),o=Math.floor(o);let l=(a=Math.min(a,t/2,e/2,i/2))>0,c=o+1,h=2*((s+1)*(r+1)+(n+1)*(s+1)+(n+1)*(r+1))+(l?4*c*(s+1+(n+1)+(r+1))+c*(c+1)/2*8:0),d=2*(s*r+n*s+n*r)+(l?4*o*(s+n+r):0),u=l?8*o*o:0,p=new Float32Array(3*h),f=new Float32Array(3*h),g=new Float32Array(2*h),m=h-1>65535?new Uint32Array(6*d+3*u):new Uint16Array(6*d+3*u),v=0,y=0,_=new Float64Array(c),b=new Float64Array(c),x=new Float64Array(c),w=new Float64Array(c);for(let L=0;L<c;L++){let D=L/o*Lv;_[L]=Math.sin(D)*a,b[L]=(1-Math.cos(D))*a,x[L]=Math.sin(D),w[L]=Math.cos(D)}let S=c*(c+1)/2,E=new Float64Array(3*S),A=new Float64Array(3*S);{let L=new T(t/2,e/2,i/2);L.subScalar(a);let D=0;for(let F=0;F<=o;F++){let V=Lv*(1-F/o),U=Math.cos(V),j=Math.sin(V),W=0;for(let it=0;it<=F;it++){let nt=U*Math.cos(W),Y=j,ot=U*Math.sin(W);E[3*D]=nt,E[3*D+1]=Y,E[3*D+2]=ot,A[3*D]=L.x+nt*a,A[3*D+1]=L.y+Y*a,A[3*D+2]=L.z+ot*a,D++,W+=Lv/F}}}function P(L,D,F,V,U,j,W,it,nt,Y){let ot=(j-2*a)/nt,ht=(W-2*a)/Y,ft=j/2-a,pt=W/2-a,J=it/2,mt=nt+1,N=Y+1,O=0,H=new T;for(let $=0;$<N;$++){let B=$*ht-pt;for(let Z=0;Z<mt;Z++){let K=Z*ot-ft,k=3*(v+O),st=2*(v+O);H[L]=K*V,H[D]=B*U,H[F]=J,p[k]=H.x,p[k+1]=H.y,p[k+2]=H.z,H[L]=0,H[D]=0,H[F]=it>0?1:-1,f[k]=H.x,f[k+1]=H.y,f[k+2]=H.z,g[st]=Z/nt,g[st+1]=1-$/Y,O+=1}}for(let $=0;$<Y;$++)for(let B=0;B<nt;B++){let Z=v+B+mt*$,K=v+B+mt*($+1),k=v+(B+1)+mt*($+1),st=v+(B+1)+mt*$;m[y++]=Z,m[y++]=K,m[y++]=st,m[y++]=K,m[y++]=k,m[y++]=st}v+=O}function C(L,D,F,V,U,j,W,it,nt,Y){let ot=(W-2*a)/Y,ht=W/2-a,ft=it/2-a,pt=nt/2,J=Y+1,mt=0,N=new T,O=new T;for(let H=0;H<o+1;H++){N[D]=(ft+_[H])*U,N[F]=(pt-b[H])*j,O[L]=0,O[D]=x[H]*Math.sign(N[D]),O[F]=w[H]*Math.sign(N[F]);for(let $=0;$<J;$++){let B=$*ot-ht;N[L]=B*V;let Z=3*(v+mt),K=2*(v+mt);p[Z]=N.x,p[Z+1]=N.y,p[Z+2]=N.z,f[Z]=O.x,f[Z+1]=O.y,f[Z+2]=O.z,g[K]=$/Y,g[K+1]=0,mt+=1}}for(let H=0;H<o;H++)for(let $=0;$<Y;$++){let B=v+$+J*H,Z=v+$+J*(H+1),K=v+($+1)+J*(H+1),k=v+($+1)+J*H;m[y++]=B,m[y++]=Z,m[y++]=k,m[y++]=Z,m[y++]=K,m[y++]=k}v+=mt}function R(L,D,F){let V=L*D*F>0?(j,W,it)=>{m[y++]=j,m[y++]=W,m[y++]=it}:(j,W,it)=>{m[y++]=j,m[y++]=it,m[y++]=W},U=v;for(let j=0;j<S;j++){let W=3*j,it=3*v,nt=2*v;p[it]=L*A[W],p[it+1]=D*A[W+1],p[it+2]=F*A[W+2],f[it]=L*E[W],f[it+1]=D*E[W+1],f[it+2]=F*E[W+2],g[nt]=0,g[nt+1]=0,v++}for(let j=0;j<o;j++){let W=U+j*(j+1)/2,it=U+(j+1)*(j+2)/2;V(W,it+1,it);for(let nt=1;nt<=j;nt++)V(W+nt-1,W+nt,it+nt),V(W+nt,it+nt+1,it+nt)}}P("z","y","x",-1,-1,i,e,t,s,r),P("z","y","x",1,-1,i,e,-t,s,r),P("x","z","y",1,1,t,i,e,n,s),P("x","z","y",1,-1,t,i,-e,n,s),P("x","y","z",1,-1,t,e,i,n,r),P("x","y","z",-1,-1,t,e,-i,n,r),a>0&&(C("z","y","x",-1,-1,1,i,e,t,s),C("z","y","x",1,-1,-1,i,e,t,s),C("z","y","x",-1,1,-1,i,e,t,s),C("z","y","x",1,1,1,i,e,t,s),C("x","y","z",-1,-1,-1,t,e,i,n),C("x","y","z",1,-1,1,t,e,i,n),C("x","y","z",-1,1,1,t,e,i,n),C("x","y","z",1,1,-1,t,e,i,n),C("y","x","z",-1,-1,1,e,t,i,r),C("y","x","z",1,-1,-1,e,t,i,r),C("y","x","z",1,1,1,e,t,i,r),C("y","x","z",-1,1,-1,e,t,i,r),R(1,1,1),R(-1,1,1),R(1,-1,1),R(-1,-1,1),R(1,1,-1),R(-1,1,-1),R(1,-1,-1),R(-1,-1,-1)),this.setIndex(new Ht(m,1)),this.setAttribute("position",new Ht(p,3)),this.setAttribute("normal",new Ht(f,3)),this.setAttribute("uv",new Ht(g,2))}}}),Lk=z(()=>{tt(),gb=class extends jt{constructor(t=[],e=[],i="",n=1,r=.2,s=4){super(),this.type="PolyhedronGeometryRound";let a,o,l,c=0;return function(){(r=Math.min(.99999,r))==0&&(s=0);let h={IcosahedronGeometry:5,DodecahedronGeometry:3,HexahedronGeometry:3,OctahedronGeometry:4,TetrahedronGeometry:3}[i],d=new T,u=d.clone(),p=new gn,f=r*n,g=n-f,m=s+1,v=new T,y=(J,mt)=>v.subVectors(J,mt).normalize(),_=(J,mt)=>Array(J).fill(void 0).map(mt),b=_(t.length/3,(J,mt)=>new T().fromArray(t,3*mt).setLength(n)),x=[],w=1e6;for(let J=0;J<b.length;J++){let mt,N,O,H=b[J],$=[],B=1e10,Z=-1;for(;(Z=e.indexOf(J,Z+1))!=-1;){let dt=Z-Z%3;mt=e[dt+(Z+1)%3],N=e[dt+(Z+2)%3],O=H.distanceToSquared(b[mt]),B=Math.min(B,O),$.push([mt,N,O])}B+=1e-6;let K=[],k=0,st=$.length;for(let dt=0;dt<st;dt++){[mt,N,O]=$[k];let bt=x[mt]?.includes(J)==1;O<=B&&K.push(mt+ +bt*w),k=$.findIndex(ct=>ct[0]==N)}x.push(K)}let S=[];{let J,mt,N=0,O=0,H=h==3;for(let $=0;$<=s;$++){J=$*($+1)/2,mt=($+1)*($+2)/2;for(let B=0;B<s-$;B++)[N,O]=[J+B+$+2,mt+B+$+3],S.push(J,mt,...H?[O,J]:[N,mt],O,N),[J,mt]=[N,O];S.push(J,mt,J+s+2)}}let E=0;for(let J=0;J<x.length;J++)for(let mt=0;mt<h;mt++)x[J][mt]<w&&E++;let A=b.length*h*S.length*3+E*m*6*3+2*E*3*3;a=new Float64Array(A),o=new Float64Array(A),l=new Float64Array(A/3*2);let P=(J,mt,N)=>{let O=c/3*2;l[O]=Math.atan2(N,-J)/2/Math.PI+.5,l[O+1]=1-(Math.atan2(-mt,Math.sqrt(J*J+N*N))/Math.PI+.5)},C=J=>{a[c]=J.x,a[c+1]=J.y,a[c+2]=J.z,o[c]=v.x,o[c+1]=v.y,o[c+2]=v.z,P(J.x,J.y,J.z),c+=3},R=J=>{a[c]=J[0].x,a[c+1]=J[0].y,a[c+2]=J[0].z,o[c]=J[1].x,o[c+1]=J[1].y,o[c+2]=J[1].z,P(J[0].x,J[0].y,J[0].z),c+=3},L=(s+2)*(s+3)/2,D=new Float64Array(3*L),F=new Float64Array(3*L),V=new Float64Array(2*L),U=_(2*h*m,()=>new T),j=_(s*Math.max(0,s-1)/2,()=>new T),W=d.clone(),it=d.clone(),nt=d.clone(),Y=d.clone(),ot=d.clone(),ht=[],ft=_(b.length,()=>_(h,()=>d.clone()));for(let J=0;J<b.length;J++){d.copy(b[J]).normalize(),W.copy(d).multiplyScalar(g);let mt=x[J];for(let K=0;K<mt.length;K++){let k=mt[K],st=mt[(K+1)%h];p.setFromPointsAndIndices(b,J,k%w,st%w),p.b.sub(p.a).setLength(1e10).add(p.a),p.c.sub(p.a).setLength(1e10).add(p.a),p.closestPointToPoint(W,ft[J][K])}let N=0,O=[],H=[],$=new T;s==0&&[...ft[J]].reduce((K,k)=>K.add(k),$).multiplyScalar(1/h);for(let K=0;K<h;K++){let k=[],st=(K-1+h)%h,dt=ft[J][st],bt=ft[J][K];d.copy(dt).sub(W),u.copy(bt).sub(W);let ct=W.angleTo(d),It=d.angleTo(u),St=Math.cos(ct)*f;s==0?it.copy($):it.copy(W).setLength(g+St),O.push(St);let Dt=[it,dt,bt];for(let Mt=0;Mt<2;Mt++){let q=Dt[Mt],_t=Dt[Mt+1];Y.subVectors(q,W),ot.subVectors(_t,W),nt.crossVectors(Y,ot).normalize();for(let Pt=0;Pt<m;Pt++){let Gt=[ct,It][Mt]*Pt/m;d.copy(Y).applyAxisAngle(nt,Gt).add(W),U[N++].copy(d),Mt&&(y(d,W),k.push([Pt==0?q:d.clone(),v.clone()]))}Mt&&(y(_t,W),k.push([_t,v.clone()]))}H.push(k)}ht.push(H);let B=2*m,Z=2;for(let K=0;K<h;K++){let k=B*K,st=B*((K+1)%h),dt=0,bt=[U[k]];for(let ct=1;ct<m;ct++){let It=U[k+ct],St=U[st+ct];bt.push(It);for(let Dt=1,Mt=ct-Z+1;Dt<=Mt;Dt++)d.lerpVectors(It,St,Dt/(Mt+1)),d.sub(W).setLength(O[K]).add(W),bt.push(j[dt++].copy(d));bt.push(St)}for(let ct=0;ct<m;ct++)bt.push(U[ct+m+k]);bt.push(U[st+m]);for(let ct=0,It=bt.length;ct<It;ct++){let St=bt[ct],Dt=3*ct,Mt=2*ct;D[Dt]=St.x,D[Dt+1]=St.y,D[Dt+2]=St.z,y(St,W),F[Dt]=v.x,F[Dt+1]=v.y,F[Dt+2]=v.z,V[Mt]=Math.atan2(St.z,-St.x)/2/Math.PI+.5,V[Mt+1]=1-(Math.atan2(-St.y,Math.sqrt(St.x*St.x+St.z*St.z))/Math.PI+.5)}for(let ct=0,It=S.length;ct<It;ct++){let St=3*S[ct],Dt=2*S[ct],Mt=c/3*2;a[c]=D[St],a[c+1]=D[St+1],a[c+2]=D[St+2],o[c]=F[St],o[c+1]=F[St+1],o[c+2]=F[St+2],l[Mt]=V[Dt],l[Mt+1]=V[Dt+1],c+=3}}}let pt=[];for(let J=0;J<x.length;J++)for(let mt=0;mt<h;mt++){let N=x[J][mt];if(N<w){let O=x[N].findIndex(B=>B%w==J),H=ht[J][mt],$=ht[N][O];for(let B=0;B<m;B++){let Z=H[B],K=$[m-B],k=H[B+1],st=$[m-(B+1)];R(Z),R(K),R(k),R(k),R(K),R(st)}pt.push(H[0][0],$[m][0],H[m][0],$[0][0])}}for(;pt.length;){let J,mt,N,[O,H]=pt.splice(0,2);J=H;let $=[O];for(;O!=J;)$.push(J),mt=pt.indexOf(J),N=mt%2,J=pt.splice(mt-N,2)[1-N];v.subVectors($[0],$[1]).cross(d.subVectors($[0],$[2])).normalize();let B=v.dot($[0])<0;B&&v.negate();for(let Z=1;Z<=$.length-2;Z++)C($[Z+ +B]),C($[Z+1-+B]),C($[0])}}(),function(){let h=new T,d=new T,u=new T,p=new T,f=new et,g=new et,m=new et,v=(b,x,w,S)=>{S<0&&b.x===1&&(l[x]=b.x-1),w.x===0&&w.z===0&&(l[x]=S/2/Math.PI+.5)};for(let b=0,x=0;b<c;b+=9,x+=6){h.set(a[b+0],a[b+1],a[b+2]),d.set(a[b+3],a[b+4],a[b+5]),u.set(a[b+6],a[b+7],a[b+8]),f.set(l[x+0],l[x+1]),g.set(l[x+2],l[x+3]),m.set(l[x+4],l[x+5]),p.copy(h).add(d).add(u).divideScalar(3);let w=_(p);v(f,x+0,h,w),v(g,x+2,d,w),v(m,x+4,u,w)}let y=c/3*2;for(let b=0;b<y;b+=6){let x=l[b+0],w=l[b+2],S=l[b+4],E=Math.max(x,w,S),A=Math.min(x,w,S);E>.9&&A<.1&&(x<.2&&(l[b+0]+=1),w<.2&&(l[b+2]+=1),S<.2&&(l[b+4]+=1))}function _(b){return Math.atan2(b.z,-b.x)}}(),this.setAttribute("position",new Ht(new Float32Array(a.subarray(0,c)),3)),this.setAttribute("normal",new Ht(new Float32Array(o.subarray(0,c)),3)),void this.setAttribute("uv",new Ht(new Float32Array(l.subarray(0,c/3*2)),2))}static fromJSON(t){return new gb(t.vertices,t.indices,t.radius,t.corner,t.cornerSides)}}}),O4=z(()=>{Lk(),tt(),Ok=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i=Object.assign({},e?.parameters??{width:100,detail:0,corner:0,cornerSides:4},t.parameters);return{parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??i.width)})}}static build(t){let{width:e,height:i,depth:n,detail:r,corner:s,cornerSides:a}=t.parameters,o=r===0&&s!==0?new i2(.5*e,s,a):new OE(.5*e,r),l=i/e,c=n/e;return(l!==1||c!==1)&&o.scale(1,l,c),Object.assign(o,{userData:{...t,type:"DodecahedronGeometry"}})}},i2=class extends gb{constructor(t=1,e=.2,i=4){let n=(1+Math.sqrt(5))/2,r=1/n,s="DodecahedronGeometry";super([-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-r,-n,0,-r,n,0,r,-n,0,r,n,-r,-n,0,-r,n,0,r,-n,0,r,n,0,-n,0,-r,n,0,-r,-n,0,r,n,0,r],[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9],s,t,e,i),this.type=s}static fromJSON(t){return new i2(t.radius,t.corner,t.cornerSides)}}});function L4(t,e=new et){let i=t.length();return e.set(-t.y/i,t.x/i)}function IY(t){let e=new et;e.addVectors(t.v0,Ic.subVectors(t.v1,t.v0).multiplyScalar(2/3));let i=new et;return i.addVectors(t.v2,Kg.subVectors(t.v1,t.v2).multiplyScalar(2/3)),new Fs(t.v0,e,i,t.v2)}function Gm(t,e,i=Number.EPSILON){return Math.abs(t-e)<i}function OY(t,e,i=Number.EPSILON){return t.distanceTo(e)<i}function LY(t,e,i=Number.EPSILON){return t.distanceTo(e)<i}function Bk(t,e,i){let n=Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2)),r=Math.sqrt(Math.pow(e.x-i.x,2)+Math.pow(e.y-i.y,2)),s=Math.sqrt(Math.pow(i.x-t.x,2)+Math.pow(i.y-t.y,2));return Math.acos((r*r+n*n-s*s)/(2*r*n))}function BY(t,e,i){return U4(t,e)&&U4(e,i)&&JA(t.position,e.position,i.position)}function JA(t,e,i){return Ic.copy(e).sub(t).cross(Kg.copy(i).sub(t))===0}function UY(t,e,i,n,r){let s=Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2)),a=(t.y+e.y)/2,o=(t.x+e.x)/2,l=Math.sqrt(Math.pow(i,2)-Math.pow(s/2,2))*(t.y-e.y)/s,c=Math.sqrt(Math.pow(i,2)-Math.pow(s/2,2))*(e.x-t.x)/s;return n.set(o+l,a+c),r.set(o-l,a-c),[n,r]}function zY(t,e,i){return t.distanceTo(i)<e.distanceTo(i)?e:t}function FY(t,e,i,n,r,s){let a,o=e.x-t.x,l=e.y-t.y,c=i.x-t.x,h=i.y-t.y,d=Math.sqrt((o+c)*(o+c)+(l+h)*(l+h));return Bk(e,t,i)>Math.PI&&(d*=-1),a=Gm(h,l)?(l+h)*(n/d-.5)*8/3/(o-c):(o+c)*(n/d-.5)*8/3/(h-l),r.set(e.x-a*l,e.y+a*o),s.set(i.x+a*h,i.y-a*c),[r,s]}function B4(t,e){return t.position.equals(t.controls[1].position)&&e.position.equals(e.controls[0].position)}function U4(t,e){return JA(t.position,t.controls[1].position,e.position)&&JA(t.position,e.controls[0].position,e.position)}function z4(t,e=12,i=!1){let n=[];for(let r=0,s=t.length;r<s;r++){let a=t[r],o=0;if(i&&a.roundedCurveCorner!==void 0){let l=.5*Rc(a.roundedCurveCorner,e);r>0&&(n[r-1]+=l),o+=l}a.curveAfter!==void 0&&(o+=Rc(a.curveAfter,e)),n.push(o)}return t.length>0&&i&&t[0].roundedCurveCorner!==void 0&&(n[t.length-1]+=.5*Rc(t[0].roundedCurveCorner,e)),n}function Rc(t,e=12){return t&&t instanceof Dm?2*e:t&&(t instanceof fs||t instanceof LE)?1:t&&t instanceof _1?e*t.points.length:e}var Du,Bv,Uv,Vc,O1,Ic,Kg,Uk,zk,Fk,Nk,tT,eT,zv,F4,N4,k4,V4,j4,ki,kk=z(()=>{tt(),Du=1e-12,Bv=class{constructor(t){this.position=new et,this.startPosition=new et,this.uuid=Ot.generateUUID(),this.position=t.clone()}start(){this.reset()}reset(){this.startPosition.copy(this.position)}applyOffset(t){this.position.copy(this.startPosition).add(t)}copy(t){return this.position.copy(t.position),this.startPosition.copy(t.startPosition),this}clone(){return new Bv(this.position).copy(this)}toJSON(){return[this.position.x,this.position.y]}},Uv=class extends Bv{constructor(t){super(t.position),this.parent=t}copy(t){return super.copy(t),this}clone(){return new Uv(this.parent).copy(this)}},Vc=class extends Bv{constructor(t,e){super(e),this.controls=[],this.roundness=0,this.areControlsDirectionsMirrored=!0,this.uuid=t,this.controls.push(new Uv(this),new Uv(this))}static create(t,e){let i=new Vc(t,new et(...e.position));return i.controls[0].position.set(...e.controlPrevious.position),i.controls[1].position.set(...e.controlNext.position),i.roundness=e.roundness,i.areControlsDirectionsMirrored=e.areControlsDirectionsMirrored,i}getOppositeControl(t){let e=this.controls.indexOf(t);return e===0?this.controls[1]:e===1?this.controls[0]:null}applyOffsetToControls(t,e=1){for(let i=0,n=this.controls.length;i<n;i++){let r=this.controls[i];this.position.distanceTo(r.position)<=e?r.position.copy(this.position):r.applyOffset(t)}}controlsMoved(){return!(this.position.equals(this.controls[0].position)&&this.position.equals(this.controls[1].position))}copy(t){return super.copy(t),this.controls[0].copy(t.controls[0]),this.controls[1].copy(t.controls[1]),this.roundness=t.roundness,this.uuid=t.uuid,this}clone(){return new Vc(this.uuid,this.position).copy(this)}toJSON(){return super.toJSON().concat(this.controls[0].toJSON(),this.controls[1].toJSON(),[this.roundness])}computeTangents(){let t=this.curveBefore?.getTangentAt(1),e=this.curveAfter?.getTangentAt(0);return[t,e]}computeNormals(t=new et,e=new et){let[i,n]=this.computeTangents();return i&&n&&(L4(i,t),L4(n,e)),[t,e]}computeTangent(t=new et){let[e,i]=this.computeTangents();return e&&i&&t.copy(e).add(i).normalize(),t}computeNormal(t=new et){let[e,i]=this.computeNormals();return t.copy(e).add(i).normalize(),t}},O1=t=>t,Ic=new et,Kg=new et,Uk=new et,zk=new et,Fk=new et,Nk=new et,tT=new T,eT=new T}),wh=z(()=>{tt(),kk(),zv=new et,F4=new et,N4=new et,k4=new et,V4=new et,j4=new et,ki=class extends Ug{constructor(t=100,e=100){super(),this.points=[],this.shapeHoles=[],this.plane=new Vr(new T(0,0,-1)),this.subdivision=0,this.controlSnapDistance=4,this.pointIDs=0,this.isMesh2D=!1,this.isText=!1,this._roundness=0,this.isClosed=!1,this.useCubicForRoundedCorners=!0,this.uuid=Ot.generateUUID(),this.needsUpdate=!1,this.roundedCurves=[],this._width=t,this._height=e}static createFromState(t,e,i){let n=new ki;return n.isClosed=t.isClosed,n.points=t.points.map(r=>Vc.create(r.id,r.data)),typeof t.roundness=="number"&&(n.roundness=t.roundness),n.shapeHoles=t.shapeHoles.map(r=>ki.createFromState(r)),e!==void 0&&i!==void 0&&n.applySize(e,i),n.update(),n}get width(){return this._width}get height(){return this._height}get roundness(){return this._roundness}set roundness(t){if(this._roundness!==t){this._roundness=t;for(let e=0,i=this.points.length;e<i;e++)this.points[e].roundness=t;this.needsUpdate=!0}}getPointsIndexesByIds(t){return t.map(e=>this.getPointIndexById(e)).filter(e=>e>=0)}getPointIndexById(t){let e=this.points.length,i=this.points.findIndex(n=>n.uuid===t);if(i<0){let n=e;for(let r=0,s=this.shapeHoles.length;r<s;r++){let a=this.shapeHoles[r],o=a.points.length,l=a.getPointIndexById(t);if(!(l<0))return l+n;n+=o}}return i}getLineIndexById(t){return this.getPointIndexById(t)}getBezierPoint(t){if(t<=this.points.length-1)return this.points[t];if(this.shapeHoles.length>0){let e=this.points.length;for(let i=0,n=this.shapeHoles.length;i<n;i++){let r=this.shapeHoles[i],s=t-e;if(s<=r.points.length-1)return r.points[s];e+=r.points.length}}throw new Error("This shape does not have a point for this index: "+t)}getBezierPointIndex(t){let e=this.points.indexOf(t);if(e>=0)return e;if(e=this.points.length,this.shapeHoles.length>0)for(let i=0,n=this.shapeHoles.length;i<n;i++){let r=this.shapeHoles[i],s=r.points.indexOf(t);if(s>=0)return e+s;e+=r.points.length}return-1}getAllPoints(){let t=[].concat(...this.shapeHoles.map(e=>e.points));return[...this.points,...t]}applySize(t,e){t===0&&(t=.001),e===0&&(e=.001),this._width=t,this._height=e}applyScale(t,e){let i=zv.set(t,e);for(let n=0,r=this.points.length;n<r;n++){let s=this.points[n];s.position.multiply(i),s.controls[0].position.multiply(i),s.controls[1].position.multiply(i)}for(let n=0,r=this.shapeHoles.length;n<r;n++)this.shapeHoles[n].applyScale(t,e);this._update()}createPoint(t,e=0,i=Ot.generateUUID()){let n;n=t instanceof et?t:new et(t,e);let r=new Vc(i,n);return r.roundness=this.roundness,r}addPoint(t){this.points.push(t),this.needsUpdate=!0}addPointAt(t,e){this.points.splice(e,0,t),this.needsUpdate=!0}getPointByUuid(t){for(let e=0,i=this.points.length;e<i;e++){let n=this.points[e];if(n.uuid===t)return n}for(let e=0,i=this.shapeHoles.length;e<i;e++){let n=this.shapeHoles[e].getPointByUuid(t);if(n)return n}}getFirstPoint(){return this.points[0]}getLastPoint(){return this.points[this.points.length-1]}removePoint(t){let e=this.points.indexOf(t);e>=0&&this.points.splice(e,1),this.needsUpdate=!0}removePointById(t){let e=this.points.find(i=>i.uuid===t);e&&this.removePoint(e)}update(){for(let t=0,e=this.shapeHoles.length;t<e;t++)this.shapeHoles[t].update();this._update()}extractShapePointsToBuffer(t,e=12,i=!1){this.subdivision=e,this.curveDivisions===void 0&&this.computeCurveDivisions(e);let n=i?this.roundedCurveDivisions:this.curveDivisions;return function(r,s,a=12,o=!0){let l,c=eT.set(0,0,0),h=0,d=[];for(let u=0;u<s.length;u++){let p=O1(s[u]),f=Ic,g=Rc(p,a);d.push(g);for(let m=0;m<=g;m++)if(p instanceof Fs||p instanceof $o||p instanceof fs){if(p.getPoint(m/g,f),c.set(f.x,f.y,0),l!==void 0&&LY(l,c))continue;l===void 0&&(l=tT),l.copy(c),r.setXYZ(h,c.x,c.y,c.z),h++}}o&&h>1&&(r.getX(h-1)!==r.getX(0)||r.getY(h-1)!==r.getY(0)||r.getZ(h-1)!==r.getZ(0))&&(r.setXYZ(h,r.getX(0),r.getY(0),r.getZ(0)),h++)}(t,i?this.roundedCurves:this.curves,e,this.autoClose),n.reduce((r,s)=>r+s,0)+1}computeCurveDivisions(t=12){return this.curveDivisions=z4(this.points,t,!1),this.roundedCurveDivisions=z4(this.points,t,!0),this.curveDivisions}extractFilteredShapePointsToBuffer(t,e,i=12){return 2*function(n,r,s,a=12,o=!0){let l=eT.set(0,0,0),c=0,h=[];for(let d=0;d<r.length;d++){if(s[d]===!1)continue;let u,p=O1(r[d]),f=Ic,g=Rc(p,a);h.push(g);for(let m=0;m<=g;m++)if(p instanceof Fs||p instanceof $o||p instanceof fs){if(p.getPoint(m/g,f),l.set(f.x,f.y,0),u?.equals(l))continue;u===void 0?u=tT:(n.setXYZ(c,u.x,u.y,u.z),c++,n.setXYZ(c,l.x,l.y,l.z),c++),u.copy(l)}}return o&&c>1&&!(n.getX(c-1)===n.getX(0)&&n.getY(c-1)===n.getY(0)&&n.getZ(c-1)===n.getZ(0))&&(n.setXYZ(c,n.getX(0),n.getY(0),n.getZ(0)),c++),h}(t,this.curves,e,i,this.autoClose).reduce((n,r)=>n+r,0)}extractShapePointsToFlatArray(t,e=12){return this.subdivision=e,this.curveDivisions===void 0&&this.computeCurveDivisions(e),function(i,n,r=12,s=!0){let a,o=0;for(let l=0;l<n.length;l++){let c=O1(n[l]),h=Rc(c,r),d=Ic;for(let u=0;u<=h;u++)if(c instanceof Fs||c instanceof $o||c instanceof fs){if(c.getPoint(u/h,d),a!==void 0&&OY(a,d,Du))continue;a===void 0&&(a=Kg),a.copy(d),i.push(d.x,d.y),o++}}return Gm(i[0],i[i.length-2],Du)&&Gm(i[1],i[i.length-1],Du)&&(i.pop(),i.pop()),s&&o>1&&!(Gm(i[o-1],i[1],Du)&&Gm(i[o-2],i[0],Du))&&(i.push(i[0],i[1]),o++),i}(t,this.roundedCurves,e,this.autoClose)}getCurveIndexFromVertexId(t,e=!1){let i=0;this.curveDivisions===void 0&&this.computeCurveDivisions(this.subdivision);let n=e?this.roundedCurveDivisions:this.curveDivisions,r=0;e&&this.points[0].roundedCurveCorner!==void 0&&(r=.5*Rc(this.points[0].roundedCurveCorner,this.subdivision));let s=t-r;s<0&&(s+=n.reduce((a,o)=>a+o,0));for(let a=0,o=n.length;a<o;a++){let l=n[a];if(s<i+l)return[a,(s-i+1)/l];i+=l}return[0,1]}getCurveT(t,e,i){let n=this.points[t],r=this.points[t>=this.points.length-1?0:t+1],s=this.curveDivisions,a=s[t];if(B4(n,r)){let l=n.position.distanceTo(r.position);return n.position.distanceTo(zv.set(i.x,i.y))/l}let o=0;for(let l=0;l<t;l++)o+=s[l];return(e-o)/a}dispose(){}_applyCurveForPoint(t,e){B4(e,t)?this.lineTo(t.position.x,t.position.y):this.bezierCurveTo(e.controls[1].position.x,e.controls[1].position.y,t.controls[0].position.x,t.controls[0].position.y,t.position.x,t.position.y);let i=this.curves[this.curves.length-1];t.curveBefore=i,e.curveAfter=i;let n=i.clone();t.roundedCurveBefore=n,e.roundedCurveAfter=n,t.roundedCurveCorner=void 0,this.roundedCurves.push(n)}_update(){if(this.curves=[],this.roundedCurves=[],!this.points.length)return;for(let e=0,i=this.points.length;e<i;e++){let n=this.points[e];if(e===0)this.moveTo(n.position.x,n.position.y);else{let r=this.points[e-1];this._applyCurveForPoint(n,r)}}let t=this.getLastPoint();if(t?.curveAfter&&(t.curveAfter=void 0),this.isClosed){let e=this.points[0],i=this.points[this.points.length-1];this._applyCurveForPoint(e,i)}if(this.points.length>2){let e=0;for(let i=0,n=this.points.length;i<n;i++){let r=this.points[i],s=this.points[i-1]??this.points[this.points.length-1],a=this.points[i+1]??this.points[0],o=r.roundness,l=s&&a&&BY(s,r,a);if(!r.controlsMoved()&&o>0&&!l){let c=r.curveBefore,h=r.curveAfter;if(c===void 0||h===void 0)continue;let d,u=r.roundedCurveBefore,p=r.roundedCurveAfter,f=c instanceof fs?c.v1.distanceTo(c.v2):c.getLength(),g=h instanceof fs?h.v1.distanceTo(h.v2):h.getLength(),m=Math.min(o,.499*f),v=Math.min(o,.499*g),y=Math.min(m,v),_=1-y/f,b=y/g,x=c.getPointAt(_,zv),w=h.getPointAt(b,F4);if(this._subSplitCurve(c,u,_,x,void 0),this._subSplitCurve(h,p,b,void 0,w),this.useCubicForRoundedCorners){let S=Bk(x,r.position,w)/2,E=Math.tan(S)*x.distanceTo(r.position),[A,P]=UY(x,w,E,N4,k4),C=zY(A,P,r.position),[R,L]=FY(C,x,w,E,V4,j4);d=new Fs(x.clone(),R.clone(),L.clone(),w.clone())}else d=new $o(x.clone(),r.position.clone(),w.clone());r.roundedCurveCorner=d,this.roundedCurves.splice(i+e,0,d),e++}}}}_subSplitCurve(t,e,i,n,r){if(!(t instanceof fs)){let s=t,a=e,o=s.getUtoTmapping(i,0),l=function(c,h,d,u,p=.5){let f=Ic.subVectors(h,c).multiplyScalar(p).add(c),g=Kg.subVectors(d,h).multiplyScalar(p).add(h),m=Uk.subVectors(u,d).multiplyScalar(p).add(d),v=f,y=zk.subVectors(g,f).multiplyScalar(p).add(f),_=Fk.subVectors(m,g).multiplyScalar(p).add(g),b=m,x=Nk.subVectors(_,y).multiplyScalar(p).add(y);return[c.x,c.y,v.x,v.y,y.x,y.y,x.x,x.y,_.x,_.y,b.x,b.y,u.x,u.y]}(s.v0,s.v1,s.v2,s.v3,o);return n!==void 0&&(a.v0.set(l[0],l[1]),a.v1.set(l[2],l[3]),a.v2.set(l[4],l[5]),a.v3.set(l[6],l[7])),r!==void 0&&(a.v0.set(l[6],l[7]),a.v1.set(l[8],l[9]),a.v2.set(l[10],l[11]),a.v3.set(l[12],l[13])),a}return n!==void 0&&e.v2.copy(n),r!==void 0&&e.v1.copy(r),e}clone(){let t=new ki(this._width,this._height);return t.points=this.points.map(e=>e.clone()),t.isClosed=this.isClosed,t.roundness=this.roundness,t.isMesh2D=this.isMesh2D,t.shapeHoles=this.shapeHoles.map(e=>e.clone()),t}toJSON(){return{points:this.points.reduce((t,e)=>t.concat(e.toJSON()),[]),shapeHoles:this.shapeHoles.map(t=>t.toJSON()),isClosed:this.isClosed,roundness:this.roundness}}fromJSON(t){this.points=[],this.pointIDs=0;let e=t.points.length/7;for(let i=0;i<e;i++){let n=7*i,r=t.points[n+0],s=t.points[n+1],a=t.points[n+2],o=t.points[n+3],l=t.points[n+4],c=t.points[n+5],h=t.points[n+6],d=new Vc(Ot.generateUUID(),new et(r,s));d.controls[0].position.set(a,o),d.controls[1].position.set(l,c),d.roundness=h,this.points.push(d)}return this.shapeHoles=t.shapeHoles?.length?t.shapeHoles.map(i=>{let n=new ki;return n.fromJSON(i),n}):[],this.isClosed=t.isClosed,this._roundness=t.roundness,this._update(),this}fromShape(t,e=!1){this.isText=e;let i=(n,r)=>{r instanceof Fs&&r.v3.equals(n.position)&&n.controls[0].position.copy(r.v2)};return this.points=(n=>{let r,s,a=[];for(r=0,s=n.length;r<s;r++)n[r]instanceof $o&&(n[r]=IY(n[r]));for(r=0,s=n.length;r<s;r++){let c,h=n[r],d=r>0?n[r-1]:null;h instanceof Fs?(c=this.createPoint(h.v0),c.controls[1].position.copy(h.v1)):h instanceof fs&&(c=this.createPoint(h.v1)),c!==void 0&&(d!==null&&i(c,d),a.push(c))}let o=n[n.length-1],l=!1;return o instanceof Fs?o.v3.equals(a[0].position)&&(a[0].controls[0].position.copy(o.v2),l=!0):o instanceof fs&&o.v2.equals(a[0].position)&&(l=!0),this.isClosed=l,a})(t.curves),t instanceof Ug&&(this.shapeHoles=t.holes.map(n=>{let r=new ki;return r.fromShape(n),r})),this.update(),this}updatePoint(t,e){let i=this.getPointByUuid(t);i&&(e.position!==void 0&&i.position.fromArray(e.position),e.roundness!==void 0&&(i.roundness=e.roundness),e.areControlsDirectionsMirrored!==void 0&&(i.areControlsDirectionsMirrored=e.areControlsDirectionsMirrored),this.needsUpdate=!0)}updatePreviousControl(t,e){let i=this.getPointByUuid(t)?.controls[0];i&&(e.position&&i.position.fromArray(e.position),this.needsUpdate=!0)}updateNextControl(t,e){let i=this.getPointByUuid(t)?.controls[1];i&&(e.position&&i.position.fromArray(e.position),this.needsUpdate=!0)}}});function n2({x:t,y:e},i,n,r,s){return{x:t*i+r,y:e*n+s}}function NY(t,e){let i=e===1.5707963267948966?.551915024494:e===-1.5707963267948966?-.551915024494:1.3333333333333333*Math.tan(e/4),n=Math.cos(t),r=Math.sin(t),s=Math.cos(t+e),a=Math.sin(t+e);return[{x:n-r*i,y:r+n*i},{x:s+a*i,y:a-s*i},{x:s,y:a}]}function G4(t,e,i,n){let r=t*n-e*i<0?-1:1,s=Math.min(1,Math.max(-1,t*i+e*n));return r*Math.acos(s)}var L1,kY=z(()=>{L1=2*Math.PI});function he(t,e){if(!t)throw e||"Assertion Failed!"}function _g(t){var e=t.windingRule,i=e===void 0?Oi.ODD:e,n=t.elementType,r=n===void 0?vr.POLYGONS:n,s=t.polySize,a=s===void 0?3:s,o=t.vertexSize,l=o===void 0?2:o,c=t.normal,h=c===void 0?[0,0,1]:c,d=t.contours,u=d===void 0?[]:d,p=t.strict,f=p===void 0||p,g=t.debug,m=g!==void 0&&g;if(!u&&f)throw new Error("Contours can't be empty");if(u){var v=new Vk;t.edgeCreateCallback&&(v.edgeCreateCallback=t.edgeCreateCallback),t.vertexIdCallback&&(v.vertexIdCallback=t.vertexIdCallback);for(var y=0;y<u.length;y++)v.addContour(l||2,u[y]);return v.tesselate(i,r,a,l,h,f),{vertices:v.vertices,vertexIndices:v.vertexIndices,vertexCount:v.vertexCount,elements:v.elements,elementCount:v.elementCount,mesh:m?v.mesh:void 0}}}var Oi,vr,re,kd,Vf,tc,r2,s2,a2,H4,Fv,o2,W4,q4,Vk,h0=z(()=>{var t;(t=Oi||(Oi={}))[t.ODD=0]="ODD",t[t.NONZERO=1]="NONZERO",t[t.POSITIVE=2]="POSITIVE",t[t.NEGATIVE=3]="NEGATIVE",t[t.ABS_GEQ_TWO=4]="ABS_GEQ_TWO",function(e){e[e.POLYGONS=0]="POLYGONS",e[e.CONNECTED_POLYGONS=1]="CONNECTED_POLYGONS",e[e.BOUNDARY_CONTOURS=2]="BOUNDARY_CONTOURS"}(vr||(vr={})),re=function(){function e(){}return e.vertEq=function(i,n){return i.s===n.s&&i.t===n.t},e.vertLeq=function(i,n){return i.s<n.s||i.s===n.s&&i.t<=n.t},e.transLeq=function(i,n){return i.t<n.t||i.t===n.t&&i.s<=n.s},e.edgeGoesLeft=function(i){return e.vertLeq(i.Dst,i.Org)},e.edgeGoesRight=function(i){return e.vertLeq(i.Org,i.Dst)},e.vertL1dist=function(i,n){return Math.abs(i.s-n.s)+Math.abs(i.t-n.t)},e.edgeEval=function(i,n,r){he(e.vertLeq(i,n)&&e.vertLeq(n,r));var s=n.s-i.s,a=r.s-n.s;return s+a>0?s<a?n.t-i.t+(i.t-r.t)*(s/(s+a)):n.t-r.t+(r.t-i.t)*(a/(s+a)):0},e.edgeSign=function(i,n,r){he(e.vertLeq(i,n)&&e.vertLeq(n,r));var s=n.s-i.s,a=r.s-n.s;return s+a>0?(n.t-r.t)*s+(n.t-i.t)*a:0},e.transEval=function(i,n,r){he(e.transLeq(i,n)&&e.transLeq(n,r));var s=n.t-i.t,a=r.t-n.t;return s+a>0?s<a?n.s-i.s+(i.s-r.s)*(s/(s+a)):n.s-r.s+(r.s-i.s)*(a/(s+a)):0},e.transSign=function(i,n,r){he(e.transLeq(i,n)&&e.transLeq(n,r));var s=n.t-i.t,a=r.t-n.t;return s+a>0?(n.s-r.s)*s+(n.s-i.s)*a:0},e.vertCCW=function(i,n,r){return i.s*(n.t-r.t)+n.s*(r.t-i.t)+r.s*(i.t-n.t)>=0},e.interpolate=function(i,n,r,s){return(i=i<0?0:i)<=(r=r<0?0:r)?r===0?(n+s)/2:n+i/(i+r)*(s-n):s+r/(i+r)*(n-s)},e.intersect=function(i,n,r,s,a){var o,l,c;e.vertLeq(i,n)||(c=i,i=n,n=c),e.vertLeq(r,s)||(c=r,r=s,s=c),e.vertLeq(i,r)||(c=i,i=r,r=c,c=n,n=s,s=c),e.vertLeq(r,n)?e.vertLeq(n,s)?((o=e.edgeEval(i,r,n))+(l=e.edgeEval(r,n,s))<0&&(o=-o,l=-l),a.s=e.interpolate(o,r.s,l,n.s)):((o=e.edgeSign(i,r,n))+(l=-e.edgeSign(i,s,n))<0&&(o=-o,l=-l),a.s=e.interpolate(o,r.s,l,s.s)):a.s=(r.s+n.s)/2,e.transLeq(i,n)||(c=i,i=n,n=c),e.transLeq(r,s)||(c=r,r=s,s=c),e.transLeq(i,r)||(c=i,i=r,r=c,c=n,n=s,s=c),e.transLeq(r,n)?e.transLeq(n,s)?((o=e.transEval(i,r,n))+(l=e.transEval(r,n,s))<0&&(o=-o,l=-l),a.t=e.interpolate(o,r.t,l,n.t)):((o=e.transSign(i,r,n))+(l=-e.transSign(i,s,n))<0&&(o=-o,l=-l),a.t=e.interpolate(o,r.t,l,s.t)):a.t=(r.t+n.t)/2},e}(),kd=function(){this.next=null,this.prev=null,this.anEdge=null,this.trail=null,this.n=0,this.marked=!1,this.inside=!1},Vf=function(){function e(i){this.side=i,this.next=null,this.Org=null,this.Sym=null,this.Onext=null,this.Lnext=null,this.Lface=null,this.activeRegion=null,this.winding=0}return Object.defineProperty(e.prototype,"Rface",{get:function(){return this.Sym.Lface},set:function(i){this.Sym.Lface=i},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"Dst",{get:function(){return this.Sym.Org},set:function(i){this.Sym.Org=i},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"Oprev",{get:function(){return this.Sym.Lnext},set:function(i){this.Sym.Lnext=i},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"Lprev",{get:function(){return this.Onext.Sym},set:function(i){this.Onext.Sym=i},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"Dprev",{get:function(){return this.Lnext.Sym},set:function(i){this.Lnext.Sym=i},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"Rprev",{get:function(){return this.Sym.Onext},set:function(i){this.Sym.Onext=i},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"Dnext",{get:function(){return this.Sym.Onext.Sym},set:function(i){this.Sym.Onext.Sym=i},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"Rnext",{get:function(){return this.Sym.Lnext.Sym},set:function(i){this.Sym.Lnext.Sym=i},enumerable:!0,configurable:!0}),e}(),tc=function(){this.next=null,this.prev=null,this.anEdge=null,this.coords=[0,0,0],this.s=0,this.t=0,this.pqHandle=0,this.n=0,this.idx=0},r2=function(){function e(){var i=new tc,n=new kd,r=new Vf(0),s=new Vf(1);i.next=i.prev=i,i.anEdge=null,n.next=n.prev=n,r.next=r,r.Sym=s,s.next=s,s.Sym=r,this.vHead=i,this.fHead=n,this.eHead=r,this.eHeadSym=s}return e.prototype.makeEdge_=function(i){var n=new Vf(0),r=new Vf(1);i.Sym.side<i.side&&(i=i.Sym);var s=i.Sym.next;return r.next=s,s.Sym.next=n,n.next=i,i.Sym.next=r,n.Sym=r,n.Onext=n,n.Lnext=r,n.Org=null,n.Lface=null,n.winding=0,n.activeRegion=null,r.Sym=n,r.Onext=r,r.Lnext=n,r.Org=null,r.Lface=null,r.winding=0,r.activeRegion=null,n},e.prototype.splice_=function(i,n){var r=i.Onext,s=n.Onext;r.Sym.Lnext=n,s.Sym.Lnext=i,i.Onext=s,n.Onext=r},e.prototype.makeVertex_=function(i,n,r){var s=i;he(s,"Vertex can't be null!");var a=r.prev;s.prev=a,a.next=s,s.next=r,r.prev=s,s.anEdge=n;var o=n;do o.Org=s,o=o.Onext;while(o!==n)},e.prototype.makeFace_=function(i,n,r){var s=i;he(s,"Face can't be null");var a=r.prev;s.prev=a,a.next=s,s.next=r,r.prev=s,s.anEdge=n,s.trail=null,s.marked=!1,s.inside=r.inside;var o=n;do o.Lface=s,o=o.Lnext;while(o!==n)},e.prototype.killEdge_=function(i){i.Sym.side<i.side&&(i=i.Sym);var n=i.next,r=i.Sym.next;n.Sym.next=r,r.Sym.next=n},e.prototype.killVertex_=function(i,n){var r=i.anEdge,s=r;do s.Org=n,s=s.Onext;while(s!==r);var a=i.prev,o=i.next;o.prev=a,a.next=o},e.prototype.killFace_=function(i,n){var r=i.anEdge,s=r;do s.Lface=n,s=s.Lnext;while(s!==r);var a=i.prev,o=i.next;o.prev=a,a.next=o},e.prototype.makeEdge=function(){var i=new tc,n=new tc,r=new kd,s=this.makeEdge_(this.eHead);return this.makeVertex_(i,s,this.vHead),this.makeVertex_(n,s.Sym,this.vHead),this.makeFace_(r,s,this.fHead),s},e.prototype.splice=function(i,n){var r=!1,s=!1;if(i!==n){if(n.Org!==i.Org&&(s=!0,this.killVertex_(n.Org,i.Org)),n.Lface!==i.Lface&&(r=!0,this.killFace_(n.Lface,i.Lface)),this.splice_(n,i),!s){var a=new tc;this.makeVertex_(a,n,i.Org),i.Org.anEdge=i}if(!r){var o=new kd;this.makeFace_(o,n,i.Lface),i.Lface.anEdge=i}}},e.prototype.delete=function(i){var n=i.Sym,r=!1;if(i.Lface!==i.Rface&&(r=!0,this.killFace_(i.Lface,i.Rface)),i.Onext===i)this.killVertex_(i.Org,null);else if(i.Rface.anEdge=i.Oprev,i.Org.anEdge=i.Onext,this.splice_(i,i.Oprev),!r){var s=new kd;this.makeFace_(s,i,i.Lface)}n.Onext===n?(this.killVertex_(n.Org,null),this.killFace_(n.Lface,null)):(i.Lface.anEdge=n.Oprev,n.Org.anEdge=n.Onext,this.splice_(n,n.Oprev)),this.killEdge_(i)},e.prototype.addEdgeVertex=function(i){var n=this.makeEdge_(i),r=n.Sym;this.splice_(n,i.Lnext),n.Org=i.Dst;var s=new tc;return this.makeVertex_(s,r,n.Org),n.Lface=r.Lface=i.Lface,n},e.prototype.splitEdge=function(i){var n=this.addEdgeVertex(i).Sym;return this.splice_(i.Sym,i.Sym.Oprev),this.splice_(i.Sym,n),i.Dst=n.Org,n.Dst.anEdge=n.Sym,n.Rface=i.Rface,n.winding=i.winding,n.Sym.winding=i.Sym.winding,n.idx=i.idx,n.Sym.idx=i.Sym.idx,n},e.prototype.connect=function(i,n){var r=!1,s=this.makeEdge_(i),a=s.Sym;if(n.Lface!==i.Lface&&(r=!0,this.killFace_(n.Lface,i.Lface)),this.splice_(s,i.Lnext),this.splice_(a,n),s.Org=i.Dst,a.Org=n.Org,s.Lface=a.Lface=i.Lface,i.Lface.anEdge=a,!r){var o=new kd;this.makeFace_(o,s,i.Lface)}return s},e.prototype.zapFace=function(i){var n,r,s,a,o,l=i.anEdge;r=l.Lnext;do r=(n=r).Lnext,n.Lface=null,n.Rface===null&&(n.Onext===n?this.killVertex_(n.Org,null):(n.Org.anEdge=n.Onext,this.splice_(n,n.Oprev)),(s=n.Sym).Onext===s?this.killVertex_(s.Org,null):(s.Org.anEdge=s.Onext,this.splice_(s,s.Oprev)),this.killEdge_(n));while(n!=l);a=i.prev,(o=i.next).prev=a,a.next=o},e.prototype.countFaceVerts_=function(i){var n=i.anEdge,r=0;do r++,n=n.Lnext;while(n!==i.anEdge);return r},e.prototype.mergeConvexFaces=function(i){var n,r,s,a,o;for(n=this.fHead.next;n!==this.fHead;n=n.next)if(n.inside)for(o=(r=n.anEdge).Org;s=r.Lnext,(a=r.Sym)&&a.Lface&&a.Lface.inside&&this.countFaceVerts_(n)+this.countFaceVerts_(a.Lface)-2<=i&&re.vertCCW(r.Lprev.Org,r.Org,a.Lnext.Lnext.Org)&&re.vertCCW(a.Lprev.Org,a.Org,r.Lnext.Lnext.Org)&&(s=a.Lnext,this.delete(a),r=null,a=null),!r||r.Lnext.Org!==o;)r=s;return!0},e.prototype.check=function(){var i,n,r,s,a,o,l=this.fHead,c=this.vHead,h=this.eHead;for(n=l,n=l;(i=n.next)!==l;n=i){he(i.prev===n),a=i.anEdge;do he(a.Sym!==a),he(a.Sym.Sym===a),he(a.Lnext.Onext.Sym===a),he(a.Onext.Sym.Lnext===a),he(a.Lface===i),a=a.Lnext;while(a!==i.anEdge)}for(he(i.prev===n&&i.anEdge===null),s=c,s=c;(r=s.next)!==c;s=r){he(r.prev===s),a=r.anEdge;do he(a.Sym!==a),he(a.Sym.Sym===a),he(a.Lnext.Onext.Sym===a),he(a.Onext.Sym.Lnext===a),he(a.Org===r),a=a.Onext;while(a!==r.anEdge)}for(he(r.prev===s&&r.anEdge===null),o=h,o=h;(a=o.next)!==h;o=a)he(a.Sym.next===o.Sym),he(a.Sym!==a),he(a.Sym.Sym===a),he(a.Org!==null),he(a.Dst!==null),he(a.Lnext.Onext.Sym===a),he(a.Onext.Sym.Lnext===a);he(a.Sym.next===o.Sym&&a.Sym===this.eHeadSym&&a.Sym.Sym===a&&a.Org===null&&a.Dst===null&&a.Lface===null&&a.Rface===null)},e}(),s2=function(){this.handle=null},a2=function(){this.key=null,this.node=0},H4=function(){function e(i,n){this.leq=n,this.max=0,this.nodes=[],this.handles=[],this.initialized=!1,this.freeList=0,this.size=0,this.max=i,this.nodes=[],this.handles=[];for(var r=0;r<i+1;r++)this.nodes[r]=new s2,this.handles[r]=new a2;this.initialized=!1,this.nodes[1].handle=1,this.handles[1].key=null}return e.prototype.floatDown_=function(i){var n,r,s,a=this.nodes,o=this.handles;for(n=a[i].handle;;){if((s=i<<1)<this.size&&this.leq(o[a[s+1].handle].key,o[a[s].handle].key)&&++s,he(s<=this.max),r=a[s].handle,s>this.size||this.leq(o[n].key,o[r].key)){a[i].handle=n,o[n].node=i;break}a[i].handle=r,o[r].node=i,i=s}},e.prototype.floatUp_=function(i){var n,r,s,a=this.nodes,o=this.handles;for(n=a[i].handle;;){if(r=a[s=i>>1].handle,s===0||this.leq(o[r].key,o[n].key)){a[i].handle=n,o[n].node=i;break}a[i].handle=r,o[r].node=i,i=s}},e.prototype.init=function(){for(var i=this.size;i>=1;--i)this.floatDown_(i);this.initialized=!0},e.prototype.min=function(){return this.handles[this.nodes[1].handle].key},e.prototype.insert=function(i){var n,r;if(2*(n=++this.size)>this.max){var s,a;for(this.max*=2,a=this.nodes.length,this.nodes.length=this.max+1,s=a;s<this.nodes.length;s++)this.nodes[s]=new s2;for(a=this.handles.length,this.handles.length=this.max+1,s=a;s<this.handles.length;s++)this.handles[s]=new a2}return this.freeList===0?r=n:(r=this.freeList,this.freeList=this.handles[r].node),this.nodes[n].handle=r,this.handles[r].node=n,this.handles[r].key=i,this.initialized&&this.floatUp_(n),r},e.prototype.extractMin=function(){var i=this.nodes,n=this.handles,r=i[1].handle,s=n[r].key;return this.size>0&&(i[1].handle=i[this.size].handle,n[i[1].handle].node=1,n[r].key=null,n[r].node=this.freeList,this.freeList=r,--this.size,this.size>0&&this.floatDown_(1)),s},e.prototype.delete=function(i){var n,r=this.nodes,s=this.handles;he(i>=1&&i<=this.max&&s[i].key!==null),r[n=s[i].node].handle=r[this.size].handle,s[r[n].handle].node=n,--this.size,n<=this.size&&(n<=1||this.leq(s[r[n>>1].handle].key,s[r[n].handle].key)?this.floatDown_(n):this.floatUp_(n)),s[i].key=null,s[i].node=this.freeList,this.freeList=i},e}(),Fv=function(){this.eUp=null,this.nodeUp=null,this.windingNumber=0,this.inside=!1,this.sentinel=!1,this.dirty=!1,this.fixUpperEdge=!1},o2=function(){this.key=null,this.next=null,this.prev=null},W4=function(){function e(i,n){this.frame=i,this.leq=n,this.head=new o2,this.head.next=this.head,this.head.prev=this.head}return e.prototype.min=function(){return this.head.next},e.prototype.max=function(){return this.head.prev},e.prototype.insert=function(i){return this.insertBefore(this.head,i)},e.prototype.search=function(i){var n=this.head;do n=n.next;while(n.key!==null&&!this.leq(this.frame,i,n.key));return n},e.prototype.insertBefore=function(i,n){do i=i.prev;while(i.key!==null&&!this.leq(this.frame,i.key,n));var r=new o2;return r.key=n,r.next=i.next,i.next.prev=r,r.prev=i,i.next=r,r},e.prototype.delete=function(i){i.next.prev=i.prev,i.prev.next=i.next},e}(),q4=function(){function e(){}return e.regionBelow=function(i){return i.nodeUp.prev.key},e.regionAbove=function(i){return i.nodeUp.next.key},e.debugEvent=function(i){},e.addWinding=function(i,n){i.winding+=n.winding,i.Sym.winding+=n.Sym.winding},e.edgeLeq=function(i,n,r){var s=i.event,a=n.eUp,o=r.eUp;return a.Dst===s?o.Dst===s?re.vertLeq(a.Org,o.Org)?re.edgeSign(o.Dst,a.Org,o.Org)<=0:re.edgeSign(a.Dst,o.Org,a.Org)>=0:re.edgeSign(o.Dst,s,o.Org)<=0:o.Dst===s?re.edgeSign(a.Dst,s,a.Org)>=0:re.edgeEval(a.Dst,s,a.Org)>=re.edgeEval(o.Dst,s,o.Org)},e.deleteRegion=function(i,n){n.fixUpperEdge&&he(n.eUp.winding===0),n.eUp.activeRegion=null,i.dict.delete(n.nodeUp)},e.fixUpperEdge=function(i,n,r){he(n.fixUpperEdge),i.mesh.delete(n.eUp),n.fixUpperEdge=!1,n.eUp=r,r.activeRegion=n},e.topLeftRegion=function(i,n){var r,s=n.eUp.Org;do n=e.regionAbove(n);while(n.eUp.Org===s);if(n.fixUpperEdge){if((r=i.mesh.connect(e.regionBelow(n).eUp.Sym,n.eUp.Lnext))===null)return null;e.fixUpperEdge(i,n,r),n=e.regionAbove(n)}return n},e.topRightRegion=function(i){var n=i.eUp.Dst;do i=e.regionAbove(i);while(i.eUp.Dst===n);return i},e.addRegionBelow=function(i,n,r){var s=new Fv;return s.eUp=r,s.nodeUp=i.dict.insertBefore(n.nodeUp,s),s.fixUpperEdge=!1,s.sentinel=!1,s.dirty=!1,r.activeRegion=s,s},e.isWindingInside=function(i,n){switch(i.windingRule){case Oi.ODD:return!!(1&n);case Oi.NONZERO:return n!==0;case Oi.POSITIVE:return n>0;case Oi.NEGATIVE:return n<0;case Oi.ABS_GEQ_TWO:return n>=2||n<=-2}throw new Error("Invalid winding rulle")},e.computeWinding=function(i,n){n.windingNumber=e.regionAbove(n).windingNumber+n.eUp.winding,n.inside=e.isWindingInside(i,n.windingNumber)},e.finishRegion=function(i,n){var r=n.eUp,s=r.Lface;s.inside=n.inside,s.anEdge=r,e.deleteRegion(i,n)},e.finishLeftRegions=function(i,n,r){for(var s,a=null,o=n,l=n.eUp;o!==r;){if(o.fixUpperEdge=!1,(s=(a=e.regionBelow(o)).eUp).Org!=l.Org){if(!a.fixUpperEdge){e.finishRegion(i,o);break}s=i.mesh.connect(l.Lprev,s.Sym),e.fixUpperEdge(i,a,s)}l.Onext!==s&&(i.mesh.splice(s.Oprev,s),i.mesh.splice(l,s)),e.finishRegion(i,o),l=a.eUp,o=a}return l},e.addRightEdges=function(i,n,r,s,a,o){var l,c,h,d,u=!0;h=r;do he(re.vertLeq(h.Org,h.Dst)),e.addRegionBelow(i,n,h.Sym),h=h.Onext;while(h!==s);for(a===null&&(a=e.regionBelow(n).eUp.Rprev),c=n,d=a;(h=(l=e.regionBelow(c)).eUp.Sym).Org===d.Org;)h.Onext!==d&&(i.mesh.splice(h.Oprev,h),i.mesh.splice(d.Oprev,h)),l.windingNumber=c.windingNumber-h.winding,l.inside=e.isWindingInside(i,l.windingNumber),c.dirty=!0,!u&&e.checkForRightSplice(i,c)&&(e.addWinding(h,d),e.deleteRegion(i,c),i.mesh.delete(d)),u=!1,c=l,d=h;c.dirty=!0,he(c.windingNumber-h.winding===l.windingNumber),o&&e.walkDirtyRegions(i,c)},e.spliceMergeVertices=function(i,n,r){i.mesh.splice(n,r)},e.vertexWeights=function(i,n,r){var s=re.vertL1dist(n,i),a=re.vertL1dist(r,i),o=.5*a/(s+a),l=.5*s/(s+a);i.coords[0]+=o*n.coords[0]+l*r.coords[0],i.coords[1]+=o*n.coords[1]+l*r.coords[1],i.coords[2]+=o*n.coords[2]+l*r.coords[2]},e.getIntersectData=function(i,n,r,s,a,o){n.coords[0]=n.coords[1]=n.coords[2]=0,n.idx=-1,e.vertexWeights(n,r,s),e.vertexWeights(n,a,o)},e.checkForRightSplice=function(i,n){var r=e.regionBelow(n),s=n.eUp,a=r.eUp;if(re.vertLeq(s.Org,a.Org)){if(re.edgeSign(a.Dst,s.Org,a.Org)>0)return!1;re.vertEq(s.Org,a.Org)?s.Org!==a.Org&&(i.pq.delete(s.Org.pqHandle),e.spliceMergeVertices(i,a.Oprev,s)):(i.mesh.splitEdge(a.Sym),i.mesh.splice(s,a.Oprev),n.dirty=r.dirty=!0)}else{if(re.edgeSign(s.Dst,a.Org,s.Org)<0)return!1;e.regionAbove(n).dirty=n.dirty=!0,i.mesh.splitEdge(s.Sym),i.mesh.splice(a.Oprev,s)}return!0},e.checkForLeftSplice=function(i,n){var r,s=e.regionBelow(n),a=n.eUp,o=s.eUp;if(he(!re.vertEq(a.Dst,o.Dst)),re.vertLeq(a.Dst,o.Dst)){if(re.edgeSign(a.Dst,o.Dst,a.Org)<0)return!1;e.regionAbove(n).dirty=n.dirty=!0,r=i.mesh.splitEdge(a),i.mesh.splice(o.Sym,r),r.Lface.inside=n.inside}else{if(re.edgeSign(o.Dst,a.Dst,o.Org)>0)return!1;n.dirty=s.dirty=!0,r=i.mesh.splitEdge(o),i.mesh.splice(a.Lnext,o.Sym),r.Rface.inside=n.inside}return!0},e.checkForIntersect=function(i,n){var r,s,a=e.regionBelow(n),o=n.eUp,l=a.eUp,c=o.Org,h=l.Org,d=o.Dst,u=l.Dst,p=new tc;if(he(!re.vertEq(u,d)),he(re.edgeSign(d,i.event,c)<=0),he(re.edgeSign(u,i.event,h)>=0),he(c!==i.event&&h!==i.event),he(!n.fixUpperEdge&&!a.fixUpperEdge),c===h||Math.min(c.t,d.t)>Math.max(h.t,u.t))return!1;if(re.vertLeq(c,h)){if(re.edgeSign(u,c,h)>0)return!1}else if(re.edgeSign(d,h,c)<0)return!1;return e.debugEvent(i),re.intersect(d,c,u,h,p),he(Math.min(c.t,d.t)<=p.t),he(p.t<=Math.max(h.t,u.t)),he(Math.min(u.s,d.s)<=p.s),he(p.s<=Math.max(h.s,c.s)),re.vertLeq(p,i.event)&&(p.s=i.event.s,p.t=i.event.t),r=re.vertLeq(c,h)?c:h,re.vertLeq(r,p)&&(p.s=r.s,p.t=r.t),re.vertEq(p,c)||re.vertEq(p,h)?(e.checkForRightSplice(i,n),!1):!re.vertEq(d,i.event)&&re.edgeSign(d,i.event,p)>=0||!re.vertEq(u,i.event)&&re.edgeSign(u,i.event,p)<=0?u===i.event?(i.mesh.splitEdge(o.Sym),i.mesh.splice(l.Sym,o),n=e.topLeftRegion(i,n),o=e.regionBelow(n).eUp,e.finishLeftRegions(i,e.regionBelow(n),a),e.addRightEdges(i,n,o.Oprev,o,o,!0),!0):d===i.event?(i.mesh.splitEdge(l.Sym),i.mesh.splice(o.Lnext,l.Oprev),a=n,n=e.topRightRegion(n),s=e.regionBelow(n).eUp.Rprev,a.eUp=l.Oprev,l=e.finishLeftRegions(i,a,null),e.addRightEdges(i,n,l.Onext,o.Rprev,s,!0),!0):(re.edgeSign(d,i.event,p)>=0&&(e.regionAbove(n).dirty=n.dirty=!0,i.mesh.splitEdge(o.Sym),o.Org.s=i.event.s,o.Org.t=i.event.t),re.edgeSign(u,i.event,p)<=0&&(n.dirty=a.dirty=!0,i.mesh.splitEdge(l.Sym),l.Org.s=i.event.s,l.Org.t=i.event.t),!1):(i.mesh.splitEdge(o.Sym),i.mesh.splitEdge(l.Sym),i.mesh.splice(l.Oprev,o),o.Org.s=p.s,o.Org.t=p.t,o.Org.pqHandle=i.pq.insert(o.Org),e.getIntersectData(i,o.Org,c,d,h,u),e.regionAbove(n).dirty=n.dirty=a.dirty=!0,!1)},e.walkDirtyRegions=function(i,n){for(var r,s,a=e.regionBelow(n);;){for(;a.dirty;)n=a,a=e.regionBelow(a);if(!n.dirty&&(a=n,(n=e.regionAbove(n))===null||!n.dirty))return;if(n.dirty=!1,r=n.eUp,s=a.eUp,r.Dst!==s.Dst&&e.checkForLeftSplice(i,n)&&(a.fixUpperEdge?(e.deleteRegion(i,a),i.mesh.delete(s),s=(a=e.regionBelow(n)).eUp):n.fixUpperEdge&&(e.deleteRegion(i,n),i.mesh.delete(r),r=(n=e.regionAbove(a)).eUp)),r.Org!==s.Org){if(r.Dst===s.Dst||n.fixUpperEdge||a.fixUpperEdge||r.Dst!==i.event&&s.Dst!==i.event)e.checkForRightSplice(i,n);else if(e.checkForIntersect(i,n))return}r.Org===s.Org&&r.Dst===s.Dst&&(e.addWinding(s,r),e.deleteRegion(i,n),i.mesh.delete(r),n=e.regionAbove(a))}},e.connectRightVertex=function(i,n,r){var s,a=r.Onext,o=e.regionBelow(n),l=n.eUp,c=o.eUp,h=!1;l.Dst!==c.Dst&&e.checkForIntersect(i,n),re.vertEq(l.Org,i.event)&&(i.mesh.splice(a.Oprev,l),n=e.topLeftRegion(i,n),a=e.regionBelow(n).eUp,e.finishLeftRegions(i,e.regionBelow(n),o),h=!0),re.vertEq(c.Org,i.event)&&(i.mesh.splice(r,c.Oprev),r=e.finishLeftRegions(i,o,null),h=!0),h?e.addRightEdges(i,n,r.Onext,a,a,!0):(s=re.vertLeq(c.Org,l.Org)?c.Oprev:l,s=i.mesh.connect(r.Lprev,s),e.addRightEdges(i,n,s,s.Onext,s.Onext,!1),s.Sym.activeRegion.fixUpperEdge=!0,e.walkDirtyRegions(i,n))},e.connectLeftDegenerate=function(i,n,r){var s,a,o,l,c;return s=n.eUp,re.vertEq(s.Org,r)?(he(!1),void e.spliceMergeVertices(i,s,r.anEdge)):re.vertEq(s.Dst,r)?(he(!1),n=e.topRightRegion(n),a=l=(o=(c=e.regionBelow(n)).eUp.Sym).Onext,c.fixUpperEdge&&(he(a!==o),e.deleteRegion(i,c),i.mesh.delete(o),o=a.Oprev),i.mesh.splice(r.anEdge,o),re.edgeGoesLeft(a)||(a=null),void e.addRightEdges(i,n,o.Onext,l,a,!0)):(i.mesh.splitEdge(s.Sym),n.fixUpperEdge&&(i.mesh.delete(s.Onext),n.fixUpperEdge=!1),i.mesh.splice(r.anEdge,s),void e.sweepEvent(i,r))},e.connectLeftVertex=function(i,n){var r,s,a,o,l,c,h=new Fv;if(h.eUp=n.anEdge.Sym,r=i.dict.search(h).key,s=e.regionBelow(r)){if(o=r.eUp,l=s.eUp,re.edgeSign(o.Dst,n,o.Org)===0)return void e.connectLeftDegenerate(i,r,n);a=re.vertLeq(l.Dst,o.Dst)?r:s,r.inside||a.fixUpperEdge?(c=a===r?i.mesh.connect(n.anEdge.Sym,o.Lnext):i.mesh.connect(l.Dnext,n.anEdge).Sym,a.fixUpperEdge?e.fixUpperEdge(i,a,c):e.computeWinding(i,e.addRegionBelow(i,r,c)),e.sweepEvent(i,n)):e.addRightEdges(i,r,n.anEdge,n.anEdge,null,!0)}},e.sweepEvent=function(i,n){i.event=n,e.debugEvent(i);for(var r=n.anEdge;r.activeRegion===null;)if((r=r.Onext)===n.anEdge)return void e.connectLeftVertex(i,n);var s=e.topLeftRegion(i,r.activeRegion);he(s!==null);var a=e.regionBelow(s),o=a.eUp,l=e.finishLeftRegions(i,a,null);l.Onext===o?e.connectRightVertex(i,s,l):e.addRightEdges(i,s,l.Onext,o,o,!0)},e.addSentinel=function(i,n,r,s){var a=new Fv,o=i.mesh.makeEdge();o.Org.s=r,o.Org.t=s,o.Dst.s=n,o.Dst.t=s,i.event=o.Dst,a.eUp=o,a.windingNumber=0,a.inside=!1,a.fixUpperEdge=!1,a.sentinel=!0,a.dirty=!1,a.nodeUp=i.dict.insert(a)},e.initEdgeDict=function(i){i.dict=new W4(i,e.edgeLeq);var n=i.bmax[0]-i.bmin[0],r=i.bmax[1]-i.bmin[1],s=i.bmin[0]-n,a=i.bmax[0]+n,o=i.bmin[1]-r,l=i.bmax[1]+r;e.addSentinel(i,s,a,o),e.addSentinel(i,s,a,l)},e.doneEdgeDict=function(i){for(var n,r=0;(n=i.dict.min().key)!==null;)n.sentinel||(he(n.fixUpperEdge),he(++r===1)),he(n.windingNumber===0),e.deleteRegion(i,n)},e.removeDegenerateEdges=function(i){var n,r,s,a=i.mesh.eHead;for(n=a.next;n!==a;n=r)r=n.next,s=n.Lnext,re.vertEq(n.Org,n.Dst)&&n.Lnext.Lnext!==n&&(e.spliceMergeVertices(i,s,n),i.mesh.delete(n),s=(n=s).Lnext),s.Lnext===n&&(s!==n&&((s===r||s===r.Sym)&&(r=r.next),i.mesh.delete(s)),(n===r||n===r.Sym)&&(r=r.next),i.mesh.delete(n))},e.initPriorityQ=function(i){var n,r,s,a=0;for(r=(s=i.mesh.vHead).next;r!==s;r=r.next)a++;for(a+=8,n=i.pq=new H4(a,re.vertLeq),r=(s=i.mesh.vHead).next;r!==s;r=r.next)r.pqHandle=n.insert(r);return r===s&&(n.init(),!0)},e.donePriorityQ=function(i){i.pq=null},e.removeDegenerateFaces=function(i,n){var r,s,a;for(r=n.fHead.next;r!==n.fHead;r=s)s=r.next,he((a=r.anEdge).Lnext!==a),a.Lnext.Lnext===a&&(e.addWinding(a.Onext,a),i.mesh.delete(a));return!0},e.computeInterior=function(i,n){var r,s;if(n===void 0&&(n=!0),e.removeDegenerateEdges(i),!e.initPriorityQ(i))return!1;for(e.initEdgeDict(i);(r=i.pq.extractMin())!==null;){for(;(s=i.pq.min())!==null&&re.vertEq(s,r);)s=i.pq.extractMin(),e.spliceMergeVertices(i,r.anEdge,s.anEdge);e.sweepEvent(i,r)}return i.event=i.dict.min().key.eUp.Org,e.debugEvent(i),e.doneEdgeDict(i),e.donePriorityQ(i),!!e.removeDegenerateFaces(i,i.mesh)&&(n&&i.mesh.check(),!0)},e}(),Vk=function(){function e(){this.mesh=new r2,this.normal=[0,0,0],this.sUnit=[0,0,0],this.tUnit=[0,0,0],this.bmin=[0,0],this.bmax=[0,0],this.windingRule=Oi.ODD,this.dict=null,this.pq=null,this.event=null,this.vertexIndexCounter=0,this.vertices=[],this.vertexIndices=[],this.vertexCount=0,this.elements=[],this.elementCount=0}return e.prototype.dot_=function(i,n){return i[0]*n[0]+i[1]*n[1]+i[2]*n[2]},e.prototype.normalize_=function(i){var n=i[0]*i[0]+i[1]*i[1]+i[2]*i[2];if(!n)throw"Zero-size vector!";n=Math.sqrt(n),i[0]/=n,i[1]/=n,i[2]/=n},e.prototype.longAxis_=function(i){var n=0;return Math.abs(i[1])>Math.abs(i[0])&&(n=1),Math.abs(i[2])>Math.abs(i[n])&&(n=2),n},e.prototype.computeNormal_=function(i){var n,r,s,a,o,l,c=[0,0,0],h=[0,0,0],d=[0,0,0],u=[0,0,0],p=[0,0,0],f=[null,null,null],g=[null,null,null],m=this.mesh.vHead;n=m.next;for(var v=0;v<3;++v)a=n.coords[v],h[v]=a,g[v]=n,c[v]=a,f[v]=n;for(n=m.next;n!==m;n=n.next)for(var y=0;y<3;++y)(a=n.coords[y])<h[y]&&(h[y]=a,g[y]=n),a>c[y]&&(c[y]=a,f[y]=n);var _=0;if(c[1]-h[1]>c[0]-h[0]&&(_=1),c[2]-h[2]>c[_]-h[_]&&(_=2),h[_]>=c[_])return i[0]=0,i[1]=0,void(i[2]=1);for(l=0,r=g[_],s=f[_],d[0]=r.coords[0]-s.coords[0],d[1]=r.coords[1]-s.coords[1],d[2]=r.coords[2]-s.coords[2],n=m.next;n!==m;n=n.next)u[0]=n.coords[0]-s.coords[0],u[1]=n.coords[1]-s.coords[1],u[2]=n.coords[2]-s.coords[2],p[0]=d[1]*u[2]-d[2]*u[1],p[1]=d[2]*u[0]-d[0]*u[2],p[2]=d[0]*u[1]-d[1]*u[0],(o=p[0]*p[0]+p[1]*p[1]+p[2]*p[2])>l&&(l=o,i[0]=p[0],i[1]=p[1],i[2]=p[2]);l<=0&&(i[0]=i[1]=i[2]=0,i[this.longAxis_(d)]=1)},e.prototype.checkOrientation_=function(){for(var i,n,r=this.mesh.fHead,s=this.mesh.vHead,a=0,o=r.next;o!==r;o=o.next)if(!((n=o.anEdge).winding<=0))do a+=(n.Org.s-n.Dst.s)*(n.Org.t+n.Dst.t),n=n.Lnext;while(n!==o.anEdge);if(a<0){for(i=s.next;i!==s;i=i.next)i.t=-i.t;this.tUnit[0]=-this.tUnit[0],this.tUnit[1]=-this.tUnit[1],this.tUnit[2]=-this.tUnit[2]}},e.prototype.projectPolygon_=function(){var i,n,r=this.mesh.vHead,s=[0,0,0],a=!1;s[0]=this.normal[0],s[1]=this.normal[1],s[2]=this.normal[2],!s[0]&&!s[1]&&!s[2]&&(this.computeNormal_(s),a=!0),i=this.sUnit,n=this.tUnit;var o=this.longAxis_(s);i[o]=0,i[(o+1)%3]=1,i[(o+2)%3]=0,n[o]=0,n[(o+1)%3]=0,n[(o+2)%3]=s[o]>0?1:-1;for(var l=r.next;l!==r;l=l.next)l.s=this.dot_(l.coords,i),l.t=this.dot_(l.coords,n);a&&this.checkOrientation_();for(var c=!0,h=r.next;h!==r;h=h.next)c?(this.bmin[0]=this.bmax[0]=h.s,this.bmin[1]=this.bmax[1]=h.t,c=!1):(h.s<this.bmin[0]&&(this.bmin[0]=h.s),h.s>this.bmax[0]&&(this.bmax[0]=h.s),h.t<this.bmin[1]&&(this.bmin[1]=h.t),h.t>this.bmax[1]&&(this.bmax[1]=h.t))},e.prototype.addWinding_=function(i,n){i.winding+=n.winding,i.Sym.winding+=n.Sym.winding},e.prototype.tessellateMonoRegion_=function(i,n){var r,s;if((r=n.anEdge).Lnext===r||r.Lnext.Lnext===r)throw"Mono region invalid";for(;re.vertLeq(r.Dst,r.Org);r=r.Lprev);for(;re.vertLeq(r.Org,r.Dst);r=r.Lnext);for(s=r.Lprev;r.Lnext!==s;)if(re.vertLeq(r.Dst,s.Org)){for(;s.Lnext!==r&&(re.edgeGoesLeft(s.Lnext)||re.edgeSign(s.Org,s.Dst,s.Lnext.Dst)<=0);)s=i.connect(s.Lnext,s).Sym;s=s.Lprev}else{for(;s.Lnext!==r&&(re.edgeGoesRight(r.Lprev)||re.edgeSign(r.Dst,r.Org,r.Lprev.Org)>=0);)r=i.connect(r,r.Lprev).Sym;r=r.Lnext}if(s.Lnext===r)throw"Mono region invalid";for(;s.Lnext.Lnext!==r;)s=i.connect(s.Lnext,s).Sym;return!0},e.prototype.tessellateInterior_=function(i){for(var n,r=i.fHead.next;r!==i.fHead;r=n)if(n=r.next,r.inside&&!this.tessellateMonoRegion_(i,r))return!1;return!0},e.prototype.discardExterior_=function(i){for(var n,r=i.fHead.next;r!==i.fHead;r=n)n=r.next,r.inside||i.zapFace(r)},e.prototype.setWindingNumber_=function(i,n,r){for(var s,a=i.eHead.next;a!==i.eHead;a=s)s=a.next,a.Rface.inside!==a.Lface.inside?a.winding=a.Lface.inside?n:-n:r?i.delete(a):a.winding=0},e.prototype.getNeighbourFace_=function(i){return i.Rface&&i.Rface.inside?i.Rface.n:-1},e.prototype.outputPolymesh_=function(i,n,r,s){var a,o,l=0,c=0;r>3&&i.mergeConvexFaces(r);for(var h=i.vHead.next;h!==i.vHead;h=h.next)h.n=-1;for(var d=i.fHead.next;d!==i.fHead;d=d.next)if(d.n=-1,d.inside){a=d.anEdge,o=0;do(h=a.Org).n===-1&&(h.n=c,c++),o++,a=a.Lnext;while(a!==d.anEdge);if(o>r)throw"Face vertex greater that support polygon";d.n=l,++l}for(this.elementCount=l,n===vr.CONNECTED_POLYGONS&&(l*=2),this.elements=[],this.elements.length=l*r,this.vertexCount=c,this.vertices=[],this.vertices.length=c*s,this.vertexIndices=[],this.vertexIndices.length=c,h=i.vHead.next;h!==i.vHead;h=h.next)if(h.n!==-1){var u=h.n*s;this.vertices[u+0]=h.coords[0],this.vertices[u+1]=h.coords[1],s>2&&(this.vertices[u+2]=h.coords[2]),this.vertexIndices[h.n]=h.idx}var p=0;for(d=i.fHead.next;d!==i.fHead;d=d.next)if(d.inside){a=d.anEdge,o=0;do h=a.Org,this.elements[p++]=h.n,o++,a=a.Lnext;while(a!==d.anEdge);for(var f=o;f<r;++f)this.elements[p++]=-1;if(n===vr.CONNECTED_POLYGONS){a=d.anEdge;do this.elements[p++]=this.getNeighbourFace_(a),a=a.Lnext;while(a!==d.anEdge);for(var g=o;g<r;++g)this.elements[p++]=-1}}},e.prototype.outputContours_=function(i,n){var r,s,a=0,o=0;this.vertexCount=0,this.elementCount=0;for(var l=i.fHead.next;l!==i.fHead;l=l.next)if(l.inside){s=r=l.anEdge;do this.vertexCount++,r=r.Lnext;while(r!==s);this.elementCount++}this.elements=[],this.elements.length=2*this.elementCount,this.vertices=[],this.vertices.length=this.vertexCount*n,this.vertexIndices=[],this.vertexIndices.length=this.vertexCount;var c=0,h=0,d=0;for(a=0,l=i.fHead.next;l!==i.fHead;l=l.next)if(l.inside){o=0,s=r=l.anEdge;do this.vertices[c++]=r.Org.coords[0],this.vertices[c++]=r.Org.coords[1],n>2&&(this.vertices[c++]=r.Org.coords[2]),this.vertexIndices[h++]=this.vertexIdCallback?this.vertexIdCallback(r):r.Org.idx,o++,r=r.Lnext;while(r!==s);this.elements[d++]=a,this.elements[d++]=o,a+=o}},e.prototype.addContour=function(i,n){this.mesh===null&&(this.mesh=new r2),i<2&&(i=2),i>3&&(i=3);for(var r=null,s=0;s<n.length;s+=i)r===null?(r=this.mesh.makeEdge(),this.mesh.splice(r,r.Sym)):(this.mesh.splitEdge(r),r=r.Lnext),r.Org.coords[0]=n[s+0],r.Org.coords[1]=n[s+1],r.Org.coords[2]=i>2?n[s+2]:0,r.Org.idx=this.vertexIndexCounter++,this.edgeCreateCallback&&this.edgeCreateCallback(r),r.winding=1,r.Sym.winding=-1},e.prototype.tesselate=function(i,n,r,s,a,o){if(i===void 0&&(i=Oi.ODD),n===void 0&&(n=vr.POLYGONS),o===void 0&&(o=!0),this.vertices=[],this.elements=[],this.vertexIndices=[],this.vertexIndexCounter=0,a&&(this.normal[0]=a[0],this.normal[1]=a[1],this.normal[2]=a[2]),this.windingRule=i,s<2&&(s=2),s>3&&(s=3),!this.mesh)return!1;this.projectPolygon_(),q4.computeInterior(this,o);var l=this.mesh;return n===vr.BOUNDARY_CONTOURS?this.setWindingNumber_(l,1,!0):this.tessellateInterior_(l),o&&l.check(),n===vr.BOUNDARY_CONTOURS?this.outputContours_(l,s):this.outputPolymesh_(l,n,r,s),!0},e}(),Oi.ODD,Oi.NONZERO,Oi.POSITIVE,Oi.NEGATIVE,Oi.ABS_GEQ_TWO,vr.POLYGONS,vr.CONNECTED_POLYGONS,vr.BOUNDARY_CONTOURS});function jk(t,e){let i=t.length/2;if(i<2)return[];let n=0;for(let l=0;l<i;l++){let c=(l+1)%i;n+=t[2*l]*t[2*c+1]-t[2*c]*t[2*l+1]}let r=n>0!==e?1:-1,s=[];for(let l=0;l<i;l++){let c=(l+1)%i,h=t[2*c]-t[2*l],d=t[2*c+1]-t[2*l+1],u=Math.hypot(h,d);s.push(u>0?[r*d/u,-r*h/u]:[0,0])}let a=Math.cos(40*Math.PI/180),o=(l,c)=>{if(l[0]*c[0]+l[1]*c[1]<=a)return l;let[h,d]=[l[0]+c[0],l[1]+c[1]],u=Math.hypot(h,d);return u>0?[h/u,d/u]:l};return s.map((l,c)=>[o(l,s[(c+i-1)%i]),o(l,s[(c+1)%i])])}function Gk(t,e,i){let n=t.length/2,r=new Float32Array(n+1);if(!(e>0)||!(i>0)||n<2)return{u:r,vScale:0};let s=0;for(let a=0;a<n;a++){let o=(a+1)%n;s+=Math.hypot((t[2*o]-t[2*a])/e,(t[2*o+1]-t[2*a+1])/i),r[a+1]=s}return{u:r,vScale:Math.sqrt(e*i)}}function Hk(t,e,i){for(let n=0;n<i.length;n+=3){let r=3*i[n],s=3*i[n+1],a=3*i[n+2],o=t[s]-t[r],l=t[s+1]-t[r+1],c=t[s+2]-t[r+2],h=t[a]-t[r],d=t[a+1]-t[r+1],u=t[a+2]-t[r+2],p=c*h-o*u,f=o*d-l*h;if((l*u-c*d)*(e[r]+e[s]+e[a])+p*(e[r+1]+e[s+1]+e[a+1])+f*(e[r+2]+e[s+2]+e[a+2])<0){let g=i[n+1];i[n+1]=i[n+2],i[n+2]=g}}}var w3,Wk,S3,qk=z(()=>{}),M3=z(()=>{w3={vertices:[160,160,-160,160,-160,-160,160,-160],vertexIndices:[1,0,3,2],vertexCount:4,elements:[0,4],elementCount:1,mesh:void 0},Wk={vertices:[],vertexIndices:[],vertexCount:0,elements:[],elementCount:0,mesh:void 0},S3={vertices:[-160,160,160,-160,160,160,-160,-160],vertexIndices:[1,3,0,2],vertexCount:4,elements:[0,1,2,1,0,3],elementCount:2,mesh:void 0}});function Xk(t,e){return t.normals[3*e+2]<.9999}function $k(t){let e=iT.get(t);if(e!==void 0)return e;if(!(t.rise>0))return t;let i=new Float32Array(t.normals),n=t.positions.length/3;for(let s=0;s<n;s++){if(!Xk(t,s))continue;let a=i[3*s],o=i[3*s+1],l=Math.hypot(a,o);if(l===0)continue;let c=t.rise-t.positions[3*s+2],h=Math.min(1,Math.max(0,1-c/t.rise)),d=Math.sqrt(1-h*h);i[3*s]=a/l*d,i[3*s+1]=o/l*d,i[3*s+2]=h}let r={...t,normals:i};return iT.set(t,r),r}function Yk(t,e,i,n){let r=(e-t.minX)/t.spanX,s=(i-t.minY)/t.spanY;return n?[s,r]:[r,s]}var iT,yb,nT,E3=z(()=>{iT=new WeakMap}),VY=z(()=>{tt(),h0(),ti(),qk(),M3(),E3(),yb=class extends jt{constructor(t,e,i=12,n=Oi.ODD,r,s=!1){super(),this.type="FlatExtrusionGeometry",this._nearSide=new Uint8Array(0),this._vScale=0,this._shape=t,this._depth=e,this._curveSegments=i,this._windingRule=n,this._uvPitch=s?void 0:r,this._legacy=s;let a,o=[t.extractShapePointsToFlatArray([],i),...t.shapeHoles.map(U=>U.extractShapePointsToFlatArray([],i))];try{a=_g({contours:o,windingRule:n,elementType:vr.POLYGONS,polySize:3,vertexSize:2,strict:!0})}catch{a=S3}let l=a?.vertexCount??0,c=a?.elementCount??0,h=1/0,d=1/0,u=-1/0,p=-1/0;for(let U of o)for(let j=0;j<U.length;j+=2)U[j]<h&&(h=U[j]),U[j]>u&&(u=U[j]),U[j+1]<d&&(d=U[j+1]),U[j+1]>p&&(p=U[j+1]);let f=this._uvPitch,g=f??(u-h||1),m=f??(p-d||1),v=f===void 0?h:0,y=f===void 0?d:0,_=o.map((U,j)=>jk(U,j>0)),b=0;for(let U of _)b+=U.length;let x=2*l+4*b,w=3*c*2+6*b,S=new Float32Array(3*x),E=new Float32Array(3*x),A=new Float32Array(2*x),P=new Uint32Array(w),C=new Uint8Array(x),R=0,L=0,D=0,F=!1,V=(U,j,W,it,nt,Y,ot=(U-v)/g,ht=(j-y)/m)=>{let ft=3*L;S[ft]=U,S[ft+1]=j,S[ft+2]=W,E[ft]=it,E[ft+1]=nt,E[ft+2]=Y,C[L]=W===e?F?2:1:0,A[2*L]=ot,A[2*L+1]=ht,L++};if(a!==void 0)for(let[U,j]of[[e,1],[0,-1]]){let W=L;for(let it=0;it<l;it++)V(a.vertices[2*it],a.vertices[2*it+1],U,0,0,j);for(let it=0;it<c;it++){let[nt,Y,ot]=[a.elements[3*it],a.elements[3*it+1],a.elements[3*it+2]];P[D++]=W+nt,P[D++]=W+(j>0?Y:ot),P[D++]=W+(j>0?ot:Y)}}F=!0;for(let U=0;U<o.length;U++){let j=o[U],W=_[U],it=j.length/2,{u:nt,vScale:Y}=s?{u:new Float32Array(it+1),vScale:0}:Gk(j,g,m);R=Y;let ot=Y===0?0:e/Y,ht={minX:v,minY:y,spanX:g,spanY:m},ft=(pt,[J,mt],N,O)=>{let H=j[2*pt],$=j[2*pt+1],[B,Z]=s?Yk(ht,H,$,N):[O,N?0:ot];V(H,$,N?0:e,J,mt,0,B,Z)};for(let pt=0;pt<W.length;pt++){let J=(pt+1)%it,[mt,N]=W[pt],[O,H]=[nt[pt],nt[pt+1]],$=L;ft(pt,mt,!1,O),ft(pt,mt,!0,O),ft(J,N,!1,H),ft(J,N,!0,H),P[D++]=$,P[D++]=$+1,P[D++]=$+2,P[D++]=$+3,P[D++]=$+2,P[D++]=$+1}}Hk(S,E,P),this.setAttribute("position",new Ht(S,3)),this.setAttribute("normal",new Ht(E,3)),this.setAttribute("uv",new Ht(A,2)),this.setIndex(new Ht(P,1)),this._nearSide=C,this._vScale=R}takeDepthStateFrom(t){let e=t;e._nearSide!==void 0&&(this._depth=e._depth??this._depth,this._nearSide=e._nearSide,this._vScale=e._vScale??this._vScale)}canShiftDepthTo(t){return this._nearSide.length>0&&this._depth>0&&t>0}shiftDepthTo(t){if(!this.canShiftDepthTo(t))return!1;let e=t-this._depth;if(this._depth=t,e===0)return!0;let i=this.getAttribute("position");if(i===void 0)return!1;let n=i.array,r=this.getAttribute("uv"),s=r?.array,a=this._vScale>0?e/this._vScale:0,o=this._nearSide;for(let l=0;l<o.length;l++){let c=o[l];c!==0&&(n[3*l+2]+=e,c===2&&s!==void 0&&(s[2*l+1]+=a))}return i.needsUpdate=!0,r!==void 0&&a!==0&&(r.needsUpdate=!0),this.refreshDepthBounds(t),!0}refreshDepthBounds(t){if(this.boundingBox===null&&this.boundingSphere===null)return;this.boundingBox===null&&this.computeBoundingBox();let e=this.boundingBox;e.min.z=Math.min(0,t),e.max.z=Math.max(0,t),this.boundingSphere!==null&&e.getBoundingSphere(this.boundingSphere)}clone(){let t=new yb(this._shape,this._depth,this._curveSegments,this._windingRule,this._uvPitch,this._legacy);return t.userData=nx(this.userData),t}}}),Zk=z(()=>{tt(),h0(),ti(),M3(),nT=class extends jt{constructor(t,e=12,i={}){super(),this.type="ShapeGeometry",this.windingRule=Oi.ODD,this.elementType=vr.POLYGONS,this.polySize=3,this.vertexSize=2,this.strict=!0,this._shape=t,this._curveSegments=e,this._triangulationOptions=Object.assign({windingRule:Oi.ODD,elementType:vr.POLYGONS,polySize:3,vertexSize:2,strict:!0},i);let n,r,s,a=this._shape.extractShapePointsToFlatArray([],this._curveSegments),o=this._shape.shapeHoles.map(u=>u.extractShapePointsToFlatArray([],this._curveSegments)),l=!0,c=!0;for(let u=0,p=a.length/2;u<p;u++){let f=2*u,g=a[f+0],m=a[f+1];if(r!==void 0&&g!==r&&(l=!1),s!==void 0&&m!==s&&(c=!1),r=g,s=m,!l&&!c)break}if(!l&&!c)try{n=_g({contours:[a,...o],windingRule:this._triangulationOptions.windingRule,elementType:this._triangulationOptions.elementType,polySize:this._triangulationOptions.polySize,vertexSize:this._triangulationOptions.vertexSize,strict:this._triangulationOptions.strict})}catch{n=w3}let h=n?.vertexCount??1,d=n?.elementCount??1;if(this._positionAttribute=new Ht(new Float32Array(3*h),3),this._normalAttribute=new Ht(new Float32Array(3*h),3),this._uvAttribute=new Ht(new Float32Array(2*h),2),this._indexAttribute=new Ht(new Uint32Array(3*d),1),n){let u=1/0,p=-1/0,f=1/0,g=-1/0;for(let y=0,_=h;y<_;y++){let b=2*y,x=n.vertices[b+0],w=n.vertices[b+1];x<u&&(u=x),x>p&&(p=x),w<f&&(f=w),w>g&&(g=w)}let m=p-u,v=g-f;for(let y=0,_=h;y<_;y++){let b=2*y,x=n.vertices[b+0],w=n.vertices[b+1],S=(x-u)/m,E=(w-f)/v;this._positionAttribute.setXYZ(y,x,w,0),this._normalAttribute.setXYZ(y,0,0,1),this._uvAttribute.setXY(y,S,E)}for(let y=0,_=d;y<_;y++){let b=3*y,x=n.elements[b+0],w=n.elements[b+1],S=n.elements[b+2];this._indexAttribute.setX(b+0,x),this._indexAttribute.setX(b+1,w),this._indexAttribute.setX(b+2,S)}}this.setAttribute("position",this._positionAttribute),this.setAttribute("normal",this._normalAttribute),this.setAttribute("uv",this._uvAttribute),this.setIndex(this._indexAttribute),this.setDrawRange(0,3*(n?.elementCount??1))}clone(){let t=new nT(this._shape,this._curveSegments);return t.userData=nx(this.userData),t}}});function jY(t){return X4||(X4=async function(){let e=t??"https://unpkg.com/@splinetool/runtime@2.0.79/build",i=Promise.resolve().then(()=>(YP(),$P)),[n,r]=await Promise.all([i,fetch(`${e}/bevel.wasm`).then(s=>s.arrayBuffer())]);await n.default({module_or_path:r}),c0=n}())}function GY(t){let e=!1;return t.scene.objects.traverse((i,n)=>{let r=n.geometry;if(r!==void 0&&(t6.has(r.type)&&r.depth!==void 0&&r.depth>0&&(r.extrudeBevelSize??0)>0&&(e=!0),r.type==="PathGeometry")){let s=r.extrusion;s!==void 0&&s.capType==="round"&&(s.bevel??0)>0&&(e=!0)}}),e}function Kk(t,e){let i=[t.extractShapePointsToFlatArray([],e)];for(let o of t.shapeHoles)i.push(o.extractShapePointsToFlatArray([],e));let n=0;for(let o of i)n+=o.length>>1;let r=new Float64Array(2*n),s=new Uint32Array(i.length),a=0;for(let o=0;o<i.length;o++)r.set(i[o],2*a),a+=i[o].length>>1,s[o]=a;return{points:r,ends:s}}function _b(t,e,i,n,r,s){let a=t.positions.length/3,o=r.elements,l=e6.getNormalMatrix(r).elements;for(let h=0;h<a;h++){let d=3*h,u=3*(i+h),p=t.positions[d],f=t.positions[d+1],g=t.positions[d+2];e.positions[u]=o[0]*p+o[4]*f+o[8]*g+o[12],e.positions[u+1]=o[1]*p+o[5]*f+o[9]*g+o[13],e.positions[u+2]=o[2]*p+o[6]*f+o[10]*g+o[14];let m=t.normals[d],v=t.normals[d+1],y=t.normals[d+2];e.normals[u]=l[0]*m+l[3]*v+l[6]*y,e.normals[u+1]=l[1]*m+l[4]*v+l[7]*y,e.normals[u+2]=l[2]*m+l[5]*v+l[8]*y;let _=2*(i+h);if(s===void 0)e.uvs[_]=t.uvs[2*h],e.uvs[_+1]=t.uvs[2*h+1];else{let[b,x]=s(p,f,t.uvs[2*h],t.uvs[2*h+1],h);e.uvs[_]=b,e.uvs[_+1]=x}}let c=r.determinant()<0;for(let h=0;h<t.indices.length;h+=3)e.indices[n+h]=t.indices[h]+i,e.indices[n+h+1]=t.indices[h+(c?2:1)]+i,e.indices[n+h+2]=t.indices[h+(c?1:2)]+i}function Qk(t){let{owner:e,shape:i,curveSegments:n,assembledAt:r,bevel:s,bevelSegments:a}=t,o=function(u,p){let f=[p],g=m=>{f.push(m.points.length,m.isClosed?1:0,m.roundness??0);for(let v of m.points){f.push(v.roundness??0,v.position.x,v.position.y);for(let y of v.controls)f.push(y.position.x,y.position.y)}f.push(m.shapeHoles.length);for(let v of m.shapeHoles)g(v)};return g(u),function(m){let v=2166136261;for(let y=0;y<m.length;y++)v^=m[y],v=Math.imul(v,16777619)>>>0;return v}(new Uint8Array(new Float64Array(f).buffer))}(i,n),l=e??`outline:${o}`,c=`${s}/${a}`,h=bb.get(l);if(h!==void 0&&h.outlineVersion===o&&h.capKey===c&&(t.stillServes?.(h)??1))return rT.placements++,h.cap;let d=function(u,p,f,g,m){let{points:v,ends:y}=Kk(u,p);return c0.assemble_cap(v,y,f,g,0,Math.max(1,Math.floor(m)),Jk,40)}(i,n,r,s,a);rT.assemblies++;try{let u=function(p,f){return function(g,m,v,y,_){let b=1/0;for(let x=2;x<g.length;x+=3)g[x]<b&&(b=g[x]);if(b===1/0&&(b=0),b!==0)for(let x=2;x<g.length;x+=3)g[x]-=b;return{positions:g,normals:m,uvs:v,indices:y,rise:_-b}}(p.positions(),p.normals(),p.uvs(),p.indices(),f)}(d,r);return bb.set(l,{outlineVersion:o,capKey:c,assembledAt:r,cap:u}),u}finally{d.free()}}function Nu(t,e){return .5*e>1.001*t}var c0,Jk,X4,t6,e6,$4,Y4,Z4,bb,rT,sT,Sh,Ap=z(()=>{tt(),ti(),qk(),E3(),Jk=.4,t6=new Set(["VectorGeometry","TextGeometry","InputGeometry","PolygonGeometry","RectangleGeometry","StarGeometry","TriangleGeometry","EllipseGeometry"]),e6=new ue,$4=new At,Y4=new At,Z4=new At().makeScale(1,1,-1),bb=new Map,rT={assemblies:0,placements:0},sT=class extends jt{constructor(t,e,i=0,n=12,r=3,s,a,o=!1){if(super(),this.type="ShapeGeometry",this._nearSide=new Uint8Array(0),this._effectiveBevel=0,this._vScale=0,c0===void 0)throw new Error("bevel-wasm is not loaded");this._shape=t,this._uvPitch=a,this._legacy=o,this._depth=e,this._bevel=i,this._curveSegments=n,this._bevelSegments=r,this._ownerId=s,this.rebuild()}takeDepthStateFrom(t){let e=t;e._nearSide!==void 0&&(this._depth=e._depth??this._depth,this._nearSide=e._nearSide,this._vScale=e._vScale??this._vScale,this._effectiveBevel=e._effectiveBevel??this._effectiveBevel)}canShiftDepthTo(t){return this._nearSide.length>0&&Nu(this._effectiveBevel,t)&&Nu(this._effectiveBevel,this._depth)}shiftDepthTo(t){if(!this.canShiftDepthTo(t))return!1;let e=t-this._depth;if(this._depth=t,e===0)return!0;let i=this.getAttribute("position");if(i===void 0)return!1;let n=i.array,r=this.getAttribute("uv"),s=r?.array,a=this._vScale>0?e/this._vScale:0,o=this._nearSide;for(let l=0;l<o.length;l++){let c=o[l];c!==0&&(n[3*l+2]+=e,c===2&&s!==void 0&&(s[2*l+1]+=a))}return i.needsUpdate=!0,r!==void 0&&a!==0&&(r.needsUpdate=!0),this.refreshDepthBounds(t),!0}refreshDepthBounds(t){if(this.boundingBox===null&&this.boundingSphere===null)return;this.boundingBox===null&&this.computeBoundingBox();let e=this.boundingBox;e.min.z=Math.min(0,t),e.max.z=Math.max(0,t),this.boundingSphere!==null&&e.getBoundingSphere(this.boundingSphere)}setDepth(t){t!==this._depth&&(this._depth=t,this.rebuild(),this.computeBoundingSphere(),this.computeBoundingBox())}rebuild(){let t=Qk({owner:this._ownerId,shape:this._shape,curveSegments:this._curveSegments,assembledAt:this._depth,bevel:this._bevel,bevelSegments:this._bevelSegments,stillServes:a=>Nu(a.cap.rise,this._depth)&&Nu(a.cap.rise,a.assembledAt)}),e=function(a,o,l,c,h,d=!1){let u=c.positions.length/3,p=l-c.rise,f=c.rise,{points:g,ends:m}=Kk(a,o),v=1/0,y=1/0,_=-1/0,b=-1/0;for(let ht=0;ht<g.length;ht+=2)g[ht]<v&&(v=g[ht]),g[ht]>_&&(_=g[ht]),g[ht+1]<y&&(y=g[ht+1]),g[ht+1]>b&&(b=g[ht+1]);d&&(h=void 0);let x=h??_-v,w=h??b-y,S={minX:v,minY:y,spanX:_-v||1,spanY:b-y||1},E=[],A=0;for(let ht of m)E.push({at:A,count:ht-A}),A=ht;let P=0;for(let ht of E)P+=ht.count;let C=2*u+4*P,R=new Float32Array(3*C),L=new Float32Array(3*C),D=new Float32Array(2*C),F=new Uint32Array(2*c.indices.length+6*P),V=new Uint8Array(C),U=0,j=h===void 0?void 0:(ht,ft)=>[ht/h,ft/h],W=d?(ht,ft,pt,J,mt)=>Xk(c,mt)?[J,pt]:[pt,J]:j,it=d?$k(c):c,nt={positions:R,normals:L,uvs:D,indices:F};_b(it,nt,0,0,$4.makeTranslation(0,0,p),j),_b(it,nt,u,c.indices.length,Y4.makeTranslation(0,0,f).multiply(Z4),W),V.fill(1,0,u);let Y=2*u,ot=2*c.indices.length;for(let ht=0;ht<E.length;ht++){let{at:ft,count:pt}=E[ht],J=g.subarray(2*ft,2*(ft+pt)),mt=jk(J,ht>0),N=d?{u:new Float32Array(pt+1),vScale:0}:Gk(J,x,w),O=N.u;U=N.vScale;for(let H=0;H<pt;H++){let $=(H+1)%pt,[B,Z]=mt[H],K=Y;for(let[k,st,dt,bt,ct,It]of[[J[2*H],J[2*H+1],B,p,O[H],2],[J[2*$],J[2*$+1],Z,p,O[H+1],2],[J[2*$],J[2*$+1],Z,f,O[H+1],0],[J[2*H],J[2*H+1],B,f,O[H],0]]){let St=3*Y;if(R[St]=k,R[St+1]=st,R[St+2]=bt,L[St]=dt[0],L[St+1]=dt[1],L[St+2]=0,d){let[Dt,Mt]=Yk(S,k,st,It===0);D[2*Y]=Dt,D[2*Y+1]=Mt}else D[2*Y]=ct,D[2*Y+1]=U===0?0:(bt-f)/U;V[Y]=It,Y++}F[ot++]=K,F[ot++]=K+1,F[ot++]=K+2,F[ot++]=K,F[ot++]=K+2,F[ot++]=K+3}}return Hk(R,L,F),{positions:R,normals:L,uvs:D,indices:F,nearSide:V,vScale:U}}(this._shape,this._curveSegments,this._depth,t,this._uvPitch,this._legacy);this._nearSide=e.nearSide,this._vScale=e.vScale,this._effectiveBevel=t.rise;let i=this.getAttribute("position"),n=this.getAttribute("normal"),r=this.getAttribute("uv"),s=this.getIndex();if(i!==void 0&&n!==void 0&&r!==void 0&&s!==null&&i.array.length===e.positions.length&&n.array.length===e.normals.length&&r.array.length===e.uvs.length&&s.array.length===e.indices.length)return i.array.set(e.positions),n.array.set(e.normals),r.array.set(e.uvs),s.array.set(e.indices),i.needsUpdate=!0,n.needsUpdate=!0,r.needsUpdate=!0,void(s.needsUpdate=!0);this.setAttribute("position",new Ht(e.positions,3)),this.setAttribute("normal",new Ht(e.normals,3)),this.setAttribute("uv",new Ht(e.uvs,2)),this.setIndex(new Ht(e.indices,1))}clone(){let t=new sT(this._shape,this._depth,this._bevel,this._curveSegments,this._bevelSegments,this._ownerId,this._uvPitch,this._legacy);return t.userData=nx(this.userData),t}}}),mh=z(()=>{wh(),VY(),Zk(),Ap(),h0(),Sh=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i,n=Object.assign({},e?.parameters??{width:100,subdivisions:40,roundness:0,extrudeBevelSize:0,extrudeBevelSegments:3,windingRule:Oi.ODD},t.parameters),r=Math.abs(n.width),s=Math.abs(n.height??n.width),a=Math.abs(n.depth??0),o=t.shape??e?.shape,l=o?.roundness??n.roundness;o!==void 0&&(o instanceof ki?(i=o,(i.width!==r||i.height!==s)&&i.applySize(r,s)):i=new ki(r,s).fromJSON(o),t.parameters?.roundness!==void 0&&t.parameters?.roundness>0&&i.update());let c=i??new ki(r,s);return{parameters:Object.assign(n,{width:r,height:s,depth:a,roundness:l}),shape:c,ownerId:t.ownerId??e?.ownerId}}static build(t){let e,{depth:i,extrudeBevelSize:n,extrudeBevelSegments:r,subdivisions:s,roundness:a,windingRule:o,uvPitch:l,extrusionVersion:c}=t.parameters,h=c===1;return t.shape.roundness=a,i<=0?e=new nT(t.shape,s,{windingRule:o}):n<=0?e=new yb(t.shape,i,s,o,l,h):c0!==void 0?e=new sT(t.shape,i,n,s,r,t.ownerId,l,h):(console.error("[extrude] engine not loaded \u2014 extruding without a bevel"),e=new yb(t.shape,i,s,o,l,h)),Object.assign(e,{userData:{...t,type:"VectorGeometry"}})}}});function HY(t,e,i,n,r,s){if(n>=A3)return r>30||r%4==0?(function(h,d,u,p=0,f=0,g=0){let m=.5522847498,v=d*m,y=u*m;h.addPoint(Nv(f-d,g,f-d,g-y,f-d,g+y)),h.addPoint(Nv(f,g+u,f-v,g+u,f+v,g+u)),h.addPoint(Nv(f+d,g,f+d,g+y,f+d,g-y)),h.addPoint(Nv(f,g-u,f+v,g-u,f-v,g-u)),p>0&&n6(h,d,u,p)}(t,e,i,s),Math.round(r/4)):K4(t,n,r,e,i,s);let a={x:0,y:i},o=(n=Math.max(n,.001))+.5*Math.PI,l={x:Math.cos(o)*e,y:Math.sin(o)*i},c=function({px:h,py:d,cx:u,cy:p,rx:f,ry:g,largeArcFlag:m,sweepFlag:v}){let y=[];if(f===0||g===0)return[];let _=(h-u)/2,b=(d-p)/2;if(_===0&&b===0)return[];f=Math.abs(f),g=Math.abs(g);let x=Math.pow(_,2)/Math.pow(f,2)+Math.pow(b,2)/Math.pow(g,2);x>1&&(f*=Math.sqrt(x),g*=Math.sqrt(x));let w=function(L,D,F,V,U,j,W,it,nt,Y){let ot=Math.pow(U,2),ht=Math.pow(j,2),ft=Math.pow(W,2),pt=Math.pow(it,2),J=ot*ht-ot*pt-ht*ft;J<0&&(J=0),J/=ot*pt+ht*ft,J=Math.sqrt(J)*(nt===Y?-1:1);let mt=J*U/j*it,N=J*-j/U*W,O=mt+(L+F)/2,H=N+(D+V)/2,$=(W-mt)/U,B=(it-N)/j,Z=(-W-mt)/U,K=(-it-N)/j,k=G4(1,0,$,B),st=G4($,B,Z,K);return!Y&&st>0&&(st-=L1),Y&&st<0&&(st+=L1),{centerx:O,centery:H,ang1:k,ang2:st}}(h,d,u,p,f,g,_,b,m,v),{ang1:S,ang2:E}=w,{centerx:A,centery:P}=w,C=Math.abs(E)/(L1/4);Math.abs(1-C)<1e-7&&(C=1);let R=Math.max(Math.ceil(C),1);E/=R;for(let L=0;L<R;L++)y.push(NY(S,E)),S+=E;return y.map(L=>{let{x:D,y:F}=n2(L[0],f,g,A,P),{x:V,y:U}=n2(L[1],f,g,A,P),{x:j,y:W}=n2(L[2],f,g,A,P);return{x1:D,y1:F,x2:V,y2:U,x:j,y:W}})}({px:a.x,py:a.y,cx:l.x,cy:l.y,rx:e,ry:i,largeArcFlag:n>Math.PI,sweepFlag:!0});return r>30||r%c.length===0?function(h,d,u,p,f,g,m,v){let y=Math.round(f/p.length);h.addPoint(tp(d,u));for(let _=0,b=p.length;_<b;_++){let x=p[_],w=h.points[_],S=tp(x.x,x.y);w.controls[1].position.set(x.x1,x.y1),S.controls[0].position.set(x.x2,x.y2),h.addPoint(S)}return v>0?i6(h,g,m,v):h.addPoint(tp(0,0)),y}(t,a.x,a.y,c,r,e,i,s):K4(t,n,r,e,i,s)}function K4(t,e,i,n,r,s){let a=-e/i;for(let o=0;o<=i;o++){let l=a*o,c=Math.sin(l)*n,h=Math.cos(l)*r;t.addPoint(tp(c,h))}return e<A3?s>0?i6(t,n,r,s):t.addPoint(tp(0,0)):(t.removePoint(t.points[t.points.length-1]),s>0&&n6(t,n,r,s)),1}function tp(t,e){return new Vc(Ot.generateUUID(),new et(t,e))}function Nv(t,e,i,n,r,s){let a=tp(t,e);return a.controls[0].position.set(i,n),a.controls[1].position.set(r,s),a}function i6(t,e,i,n){r6(t,e,i,n).forEach(r=>t.addPoint(r))}function n6(t,e,i,n){let r=r6(t,e,i,n),s=new ki;r.forEach(a=>s.addPoint(a)),s.isClosed=!0,t.shapeHoles.push(s)}function r6(t,e,i,n){let r=n*e/100,s=r*(Math.abs(i)/Math.abs(e)),a=new et(r/e,s/i),o=t.points.map(l=>{let c=l.clone();return c.uuid=Ot.generateUUID(),c}).reverse();return o.forEach(l=>{l.position.multiply(a);let c=l.controls[0].position.clone().multiply(a),h=l.controls[1].position.clone().multiply(a);l.controls[0].position.copy(h),l.controls[1].position.copy(c)}),o}var A3,bx,s6,l2,a6,xb=z(()=>{wh(),kk(),kY(),mh(),tt(),A3=2*Math.PI,bx=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i=Object.assign({},e?.parameters??{width:100,depth:0,spikes:64,angle:360,innerRadius:0,extrudeBevelSize:0,extrudeBevelSegments:1},t.parameters);return i.angle=Ot.clamp(i.angle,0,360),{shape:t.shape&&t.shape instanceof ki?t.shape:new ki,parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??0)})}}static build(t){let e,{width:i,height:n,spikes:r,angle:s,innerRadius:a,depth:o,extrudeBevelSize:l,extrudeBevelSegments:c,extrusionVersion:h}=t.parameters,d=t.shape,u=HY(d,.5*i,.5*n,s*Math.PI/180,r,a);return d.isClosed=!0,d.update(),s===0?(e=new jt,e.setAttribute("position",new Nt([],3))):e=Sh.create({shape:d,parameters:{subdivisions:u,depth:o,extrudeBevelSize:l,extrudeBevelSegments:c,extrusionVersion:h}}),Object.assign(e,{userData:{...t,type:"EllipseGeometry"}})}}}),Q4=z(()=>{tt(),Lk(),s6=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i=Object.assign({},e?.parameters??{width:100,detail:0,corner:0,cornerSides:4},t.parameters);return{parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??i.width)})}}static build(t){let{width:e,height:i,depth:n,detail:r,corner:s,cornerSides:a}=t.parameters,o=r===0&&s!==0?new l2(.5*e,s,a):new zE(.5*e,r),l=i/e,c=n/e;return(l!==1||c!==1)&&o.scale(1,l,c),Object.assign(o,{userData:{...t,type:"IcosahedronGeometry"}})}},l2=class extends gb{constructor(t=1,e=.2,i=4){let n=(1+Math.sqrt(5))/2,r="IcosahedronGeometry";super([-1,n,0,1,n,0,-1,-n,0,1,-n,0,0,-1,n,0,1,n,0,-1,-n,0,1,-n,n,0,-1,n,0,1,-n,0,-1,-n,0,1],[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1],r,t,e,i),this.type=r}static fromJSON(t){return new l2(t.radius,t.corner,t.cornerSides)}}}),J4=z(()=>{tt(),a6=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){(t.parameters?.points??[]).forEach(n=>{Array.isArray(n)&&(n.x=n[0],n.y=n[1])});let i=Object.assign({},e?.parameters??{width:100,segments:64,verticalSegments:64,points:[{x:0,y:-50,id:0},{x:50,y:-50,id:1},{x:50,y:50,id:2},{x:0,y:50,id:3}]},t.parameters);return{parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??i.width)})}}static build(t){let{points:e,segments:i,verticalSegments:n}=t.parameters,r=new Ug;r.moveTo(e[0].x,e[0].y),r.bezierCurveTo(e[1].x,e[1].y,e[2].x,e[2].y,e[3].x,e[3].y);let s=new FE(r.extractPoints(n).shape,i);return s.rotateZ(Math.PI),Object.assign(s,{userData:{...t,type:"LatheGeometry"}})}}});function Vd(t,e){return Math.abs(e-t)/2+Math.min(t,e)}function WY(t){let{positions:e,faces:i,materialIndices:n,uvs:r}=t,s=e.length/3,a=i.length/3,o=r!==null&&a>0,l=3*a,c=new Uint32Array(l),h=new Uint32Array(l),d=new Uint32Array(l),u=new Uint32Array(l),p=new Uint32Array(l),f=0,g=8;for(;g<2*l;)g*=2;let m=g-1,v=new Int32Array(g).fill(-1),y=(D,F)=>{let V=(Math.imul(D,2654435761)^F)&m;for(;;){let U=v[V];if(U===-1)return v[V]=f,c[f]=D,h[f]=F,f++;if(c[U]===D&&h[U]===F)return U;V=V+1&m}},_=(D,F)=>{let V=D<F?D:F,U=D<F?F:D,j=(Math.imul(V,2654435761)^U)&m;for(;;){let W=v[j];if(c[W]===V&&h[W]===U)return W;j=j+1&m}},b=new Uint32Array(s),x=new Float64Array(3*s),w=(D,F,V)=>{let U=D<F?y(D,F):y(F,D),j=++d[U];j===1?u[U]=V:j===2&&(p[U]=V),b[D]++,b[F]++,x[3*D]+=e[3*F],x[3*D+1]+=e[3*F+1],x[3*D+2]+=e[3*F+2],x[3*F]+=e[3*D],x[3*F+1]+=e[3*D+1],x[3*F+2]+=e[3*D+2]};for(let D=0;D<a;D++){let F=i[3*D],V=i[3*D+1],U=i[3*D+2];w(F,V,U),w(V,U,F),w(U,F,V)}let S=new Float64Array(3*f);for(let D=0;D<f;D++){let F=3*c[D],V=3*h[D];if(d[D]===2){let U=3*u[D],j=3*p[D];S[3*D]=.375*(e[F]+e[V])+.125*(e[U]+e[j]),S[3*D+1]=.375*(e[F+1]+e[V+1])+.125*(e[U+1]+e[j+1]),S[3*D+2]=.375*(e[F+2]+e[V+2])+.125*(e[U+2]+e[j+2])}else S[3*D]=.5*(e[F]+e[V]),S[3*D+1]=.5*(e[F+1]+e[V+1]),S[3*D+2]=.5*(e[F+2]+e[V+2])}let E,A=new Float64Array(3*s);for(let D=0;D<s;D++){let F=b[D];F===3?E=3/16:F>3&&(E=3/(8*F));let V=1-F*Number(E),U=Number(E);F===2&&(V=3/4,U=1/8),A[3*D]=e[3*D]*V+x[3*D]*U,A[3*D+1]=e[3*D+1]*V+x[3*D+1]*U,A[3*D+2]=e[3*D+2]*V+x[3*D+2]*U}let P=new Float64Array(3*(s+f));P.set(A),P.set(S,3*s);let C=new Uint32Array(12*a),R=new Array(4*a),L=o?new Float64Array(24*a):null;for(let D=0;D<a;D++){let F=i[3*D],V=i[3*D+1],U=i[3*D+2],j=_(F,V)+s,W=_(V,U)+s,it=_(U,F)+s,nt=12*D;C[nt++]=j,C[nt++]=W,C[nt++]=it,C[nt++]=F,C[nt++]=j,C[nt++]=it,C[nt++]=V,C[nt++]=W,C[nt++]=j,C[nt++]=U,C[nt++]=it,C[nt++]=W;let Y=n[D];if(R[4*D]=Y,R[4*D+1]=Y,R[4*D+2]=Y,R[4*D+3]=Y,L!==null){let ot=6*D,ht=r[ot],ft=r[ot+1],pt=r[ot+2],J=r[ot+3],mt=r[ot+4],N=r[ot+5],O=Vd(ht,pt),H=Vd(ft,J),$=Vd(pt,mt),B=Vd(J,N),Z=Vd(ht,mt),K=Vd(ft,N),k=24*D;L[k++]=O,L[k++]=H,L[k++]=$,L[k++]=B,L[k++]=Z,L[k++]=K,L[k++]=ht,L[k++]=ft,L[k++]=O,L[k++]=H,L[k++]=Z,L[k++]=K,L[k++]=pt,L[k++]=J,L[k++]=$,L[k++]=B,L[k++]=O,L[k++]=H,L[k++]=mt,L[k++]=N,L[k++]=Z,L[k++]=K,L[k++]=$,L[k++]=B}}return{positions:P,faces:C,materialIndices:R,uvs:L}}var kv,o6,Sn,l6,T3,qY=z(()=>{tt(),kv=1e4,o6=class{constructor(t=1){this.subdivisions=t}modify(t){let e=function(n){let r=n.getAttribute("position");if(r===void 0)return console.error("SubdivisionModifier: Position attribute required for subdivision."),{positions:new Float64Array(0),faces:new Uint32Array(0),materialIndices:[],uvs:null};let s=n.getAttribute("uv"),a=n.getIndex(),o=r.count,l=new Map,c=new Uint32Array(o),h=[],d=0;for(let y=0;y<o;y++){let _=r.getX(y),b=r.getY(y),x=r.getZ(y),w=Math.round(_*kv),S=Math.round(b*kv),E=Math.round(x*kv),A=l.get(w);A===void 0&&(A=new Map,l.set(w,A));let P=A.get(S);P===void 0&&(P=new Map,A.set(S,P));let C=P.get(E);C===void 0&&(C=d++,P.set(E,C),h.push(_,b,x)),c[y]=C}let u=[],p=[],f=s===void 0?null:[],g=a!==null?a.count:o,m=(y,_)=>{let b=a!==null?a.getX(y):y,x=a!==null?a.getX(y+1):y+1,w=a!==null?a.getX(y+2):y+2;if(!(b<o&&x<o&&w<o))return;let S=c[b],E=c[x],A=c[w];S===E||E===A||A===S||(u.push(S,E,A),p.push(_),f!==null&&f.push(s.getX(b),s.getY(b),s.getX(x),s.getY(x),s.getX(w),s.getY(w)))},v=n.groups;if(v.length>0)for(let y=0;y<v.length;y++){let _=v[y],b=_.materialIndex===void 0?0:_.materialIndex,x=Math.max(_.start,0),w=Math.min(_.start+_.count,g);for(let S=x;S<w&&S+2<g;S+=3)m(S,b)}else for(let y=0;y+2<g;y+=3)m(y,0);return{positions:Float64Array.from(h),faces:Uint32Array.from(u),materialIndices:p,uvs:f===null?null:Float64Array.from(f)}}(t),i=this.subdivisions;for(;i-- >0;)e=WY(e);return function(n,r){let{positions:s,faces:a,materialIndices:o,uvs:l}=n,c=s.length/3,h=a.length/3,d=new Float64Array(3*c);for(let v=0;v<h;v++){let y=3*a[3*v],_=3*a[3*v+1],b=3*a[3*v+2],x=s[b]-s[_],w=s[b+1]-s[_+1],S=s[b+2]-s[_+2],E=s[y]-s[_],A=s[y+1]-s[_+1],P=s[y+2]-s[_+2],C=w*P-S*A,R=S*E-x*P,L=x*A-w*E;d[y]+=C,d[y+1]+=R,d[y+2]+=L,d[_]+=C,d[_+1]+=R,d[_+2]+=L,d[b]+=C,d[b+1]+=R,d[b+2]+=L}for(let v=0;v<c;v++){let y=d[3*v],_=d[3*v+1],b=d[3*v+2],x=Math.sqrt(y*y+_*_+b*b)||1;d[3*v]=y/x,d[3*v+1]=_/x,d[3*v+2]=b/x}let u=3*h,p=new Float32Array(3*u),f=new Float32Array(3*u),g=l!==null&&l.length>0?new Float32Array(2*u):null;for(let v=0;v<u;v++){let y=3*a[v];p[3*v]=s[y],p[3*v+1]=s[y+1],p[3*v+2]=s[y+2],f[3*v]=d[y],f[3*v+1]=d[y+1],f[3*v+2]=d[y+2]}g!==null&&g.set(l.subarray(0,2*u));let m=new jt;m.setAttribute("position",new Ht(p,3)),u>0&&(m.setAttribute("normal",new Ht(f,3)),m.setAttribute("color",new Ht(new Float32Array(3*u).fill(1),3))),g!==null&&m.setAttribute("uv",new Ht(g,2));for(let v=0;v<h;){let y=o[v],_=v;do v++;while(v<h&&o[v]===y);m.addGroup(3*_,3*(v-_),y)}return r.boundingBox!==null&&(m.boundingBox=r.boundingBox.clone()),r.boundingSphere!==null&&(m.boundingSphere=r.boundingSphere.clone()),m}(e,t)}}}),tL=z(()=>{tt(),qY(),Sn=new T,l6=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i,n=t.geometry??e?.geometry??new jt().copy(new va(100,100,100));e===void 0?(n.computeBoundingBox(),n.boundingBox.getSize(Sn),i={width:Sn.x,height:Sn.y,depth:Sn.z,subdivisions:0}):i=e.parameters;let r={...i,...t.parameters};return{parameters:{width:Math.abs(r.width),height:Math.abs(r.height),depth:Math.abs(r.depth),subdivisions:Math.abs(r.subdivisions)},geometry:n}}static build(t){let{width:e,height:i,depth:n,subdivisions:r}=t.parameters,s=t.geometry??new jt().copy(new va(100,100,100)),a=s.userData.parameters;a===void 0?(s.boundingBox=function(l){let c=new ci,h=l.attributes.position;return h?(c.setFromBufferAttribute(h),c):(c.makeEmpty(),c)}(s),s.boundingBox.getSize(Sn)):Sn.set(a.width,a.height,a.depth),(e!==Sn.x||i!==Sn.y||n!==Sn.z)&&s.scale(Sn.x===0?1:e/Sn.x,Sn.y===0?1:i/Sn.y,Sn.z===0?1:n/Sn.z);let o=s.originalGeometry;try{r>0?(o===void 0||a?.subdivisions!==r)&&(o===void 0&&(o=s),s=new o6(r).modify(o)):(o!==void 0&&(s=o),o=void 0,s.getAttribute("normal")===void 0&&s.computeVertexNormals())}catch{o!==void 0&&(s=o),o=void 0,s.getAttribute("normal")===void 0&&s.computeVertexNormals()}return o!==void 0&&Object.assign(s,{originalGeometry:o}),delete t.geometry,Object.assign(s,{userData:{...t,type:"NonParametricGeometry"}})}static loadFromUrl(t,e,i){new LC(i).load(t,n=>{let r=this.normalizeInputs({geometry:n});n.boundingBox.getSize(Sn);let s=100/Sn.x;Object.assign(r.parameters,{width:100,height:Sn.y*s,depth:Sn.z*s}),e(this.build(r))})}}}),aT=z(()=>{wh(),mh(),T3=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i=Object.assign({},e?.parameters??{width:100,depth:0,spikes:5,cornerRadius:0,extrudeBevelSize:0,extrudeBevelSegments:3},t.parameters);return{shape:t.shape&&t.shape instanceof ki?t.shape:new ki,parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??0)})}}static build(t){let{width:e,height:i,spikes:n,cornerRadius:r,depth:s,extrudeBevelSize:a,extrudeBevelSegments:o,extrusionVersion:l}=t.parameters,c=t.shape,h=.5*e,d=.5*i,u=2*Math.PI/n;for(let f=0;f<n;f++){let g=u*f,m=0+Math.sin(g)*h,v=0+Math.cos(g)*d;c.addPoint(c.createPoint(m,v))}c.isClosed=!0;for(let f=0,g=c.points.length;f<g;f++)c.points[f].roundness=r;c.roundness=r,c.update();let p=Sh.create({shape:c,parameters:{roundness:r,depth:s,extrudeBevelSize:a,extrudeBevelSegments:o,extrusionVersion:l}});return Object.assign(p,{userData:{...t,type:"PolygonGeometry"}})}}});function jf(t,e,i){i.x=t.x*e.x,i.y=t.y,i.z=t.x*e.y}function h2(t,e,i,n,r,s){let a=c6.copy(e).sub(t),o=d6.copy(i).sub(t),l=a.angleTo(o);if(a.normalize(),o.normalize(),n===r){let c=a.add(o).normalize();s.copy(t).addScaledVector(c,n/Math.sin(l/2))}else{let c=a.angleTo(o);s.copy(t),s.addScaledVector(a,r/Math.sin(c)),s.addScaledVector(o,n/Math.sin(c))}}function XY(t,e,i){let n=t.clone().sub(e),r=i.clone().sub(e);return n.projectOnVector(r),n.add(e)}var h6,c6,d6,eL,xx,u6,p6,f6,iL,C3,m6,g6,v6,y6,nL=z(()=>{tt(),h6=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i=Object.assign({},e?.parameters??{width:100,radialSegments:4,heightSegments:1,cornerRadius:0,cornerSegments:8,openEnded:!1},t.parameters);return{parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??i.width)})}}static build(t){let{width:e,height:i,depth:n,radialSegments:r,heightSegments:s,openEnded:a,cornerRadius:o,cornerSegments:l}=t.parameters,c=new eL(.5*e,i,r,s,a,o,l),h=n/e;return h!==1&&c.scale(1,1,h),Object.assign(c,{userData:{...t,type:"PyramidGeometry"}})}},c6=new T,d6=new T,eL=class extends jt{constructor(t=.5,e=1,i=4,n=1,r=!1,s=0,a=4){super(),i=Math.floor(Math.max(3,i)),n=Math.floor(n),a=Math.floor(a);let o,l=[],c=[],h=[],d=[],u=0,p=e/2,f=Math.PI/i,g=t*Math.cos(Math.PI/i),m=2*Math.PI/i,v=(i-2)*Math.PI/i,y=Math.PI-v,_=new T(0,-p,0),b=new T(0,p,0),x=new et(t,-p),w=new et(g,-p),S=new et(0,b.y).sub(w),E=new et(0,b.y).sub(x),A=new et(S.y,-S.x).normalize(),P=new et(E.y,-E.x).normalize(),C=t*Math.cos(Math.PI/i)*Math.tan((Math.PI-S.angle())/2)-1e-8;s=Math.min(s,C);{let j=new T(A.x,A.y,0),W=new T(Math.cos(m)*j.x,j.y,Math.sin(m)*j.x);o=j.angleTo(W)}let R=s/Math.tan((Math.PI-S.angle())/2),L=s/Math.tan((Math.PI-o)/2),D=new T;if(!r){c.push(_.x,_.y,_.z),h.push(0,-1,0),d.push(0,0);let j=u++,W=[],it=x.clone(),nt=R/Math.cos(Math.PI/i);it.x-=nt;for(let Y=0;Y<i;Y++){let ot=Y/i*Math.PI*2+f;jf(it,new et(Math.sin(ot),Math.cos(ot)),D),c.push(D.x,D.y,D.z),h.push(0,-1,0),d.push(0,0),W.push(u++)}for(let Y=0;Y<W.length;Y++)l.push(W[Y],j,W[(Y+1)%W.length])}let F=[];{let j=new T,W=new T,it=new T,nt=new T,Y=new T,ot=new T;for(let ht=0;ht<i;ht++){let ft=ht/i*Math.PI*2+f,pt=(ht+.5)/i*Math.PI*2+f,J=(ht+1)/i*Math.PI*2+f,mt=new et(Math.sin(ft),Math.cos(ft)),N=new et(Math.sin(pt),Math.cos(pt)),O=new et(Math.sin(J),Math.cos(J));jf(x,mt,W),jf(x,O,it),jf(A,N,j),h2(b,W,it,L,L,nt),c.push(nt.x,nt.y,nt.z),h2(W,b,it,L,R,Y),c.push(Y.x,Y.y,Y.z),h2(it,W,b,R,L,ot),c.push(ot.x,ot.y,ot.z),h.push(j.x,j.y,j.z),h.push(j.x,j.y,j.z),h.push(j.x,j.y,j.z),d.push(0,0),d.push(0,0),d.push(0,0);let H=u++,$=u++,B=u++;if(l.push(H,$,B),s>0){{let k=W.clone().add(it).multiplyScalar(.5),st=b.clone().sub(k).normalize(),dt=_.clone().sub(k).normalize().add(st).normalize().multiplyScalar(-1);V(k,ot.clone().sub(Y),dt,S.angle())}let Z,K;{let k=new T;jf(P,O,k);let st=ot.clone().add(nt).multiplyScalar(.5);st=XY(st,it,b);let dt=ot.clone().sub(nt);[Z,K]=V(st,dt,k,o,nt.y)}{let k=Z,st=k.clone().setY(0).normalize(),dt=new T(0,-1,0),bt=st.clone().cross(dt);U(k,st,dt,bt)}F.concat(K);{let k=S.angle(),st=Math.PI-k,dt=b.clone();dt.y-=s/Math.sin(k-Math.PI/2);let bt=new T,ct=[];for(let St=0;St<a;St++){let Dt=[],Mt=Math.PI/2-st*St/a,q=Math.cos(Mt),_t=Math.sin(Mt),Pt=pt;for(let Gt=0;Gt<=St;Gt++){let Ft=Math.cos(Pt),_e=Math.sin(Pt);j.x=q*_e,j.y=_t,j.z=q*Ft,bt.copy(dt).addScaledVector(j,s),c.push(bt.x,bt.y,bt.z),h.push(j.x,j.y,j.z),d.push(0,0),Dt.push(u++),Pt+=2*Math.PI/St/i}ct.push(Dt)}K.reverse(),ct.push(K);let It=ct.length-1;for(let St=0;St<It;St++){let Dt=ct[St],Mt=ct[St+1],q=Dt.length-1;l.push(Mt[1],Dt[0],Mt[0]);for(let _t=1;_t<=q;_t++)l.push(Dt[_t],Dt[_t-1],Mt[_t]),l.push(Mt[_t+1],Dt[_t],Mt[_t])}}}}}function V(j,W,it,nt,Y){let ot=-nt/2,ht=(Math.PI-nt)/2,ft=W.clone().normalize().cross(it);j.addScaledVector(it,-s/Math.sin(ht));let pt=new T,J=new T,mt=u,N=[];for(let O=0;O<=a;O++){let H=ot+O/a*nt;J.set(0,0,0),J.addScaledVector(ft,Math.sin(H)),J.addScaledVector(it,Math.cos(H));for(let $=0;$<=1;$++){let B=$/1-.5;if(pt.copy(j),pt.addScaledVector(W,B),pt.addScaledVector(J,s),Y!=null){let Z=Math.max(0,pt.y-Y);pt.addScaledVector(W,-Z/W.y)}c.push(pt.x,pt.y,pt.z),h.push(J.x,J.y,J.z),d.push(0,0),$===0&&N.push(u),u++}}for(let O=0;O<a;O++)for(let H=0;H<1;H++){let $=mt+H+2*O,B=$+2,Z=B+1,K=$+1;l.push($,B,K),l.push(B,Z,K)}return[j.clone().addScaledVector(W,.5),N]}function U(j,W,it,nt){let Y=Math.PI/2,ot=E.angle()-Y,ht=[],ft=new T,pt=new T;for(let mt=0;mt<=a;mt++){let N=[],O=mt/a;for(let H=0;H<=mt;H++){let $=((mt?H/mt:0)-.5)*y,B=Math.cos($),Z=Math.sin($),K=(Y+Math.atan(Math.tan(ot)*B))*O,k=Math.cos(K),st=Math.sin(K);ft.set(0,0,0),ft.addScaledVector(W,st*B),ft.addScaledVector(it,k),ft.addScaledVector(nt,st*Z),pt.copy(j).addScaledVector(ft,s),c.push(pt.x,pt.y,pt.z),h.push(ft.x,ft.y,ft.z),d.push(0,0),N.push(u++)}ht.push(N)}let J=ht.length-1;for(let mt=0;mt<J;mt++){let N=ht[mt],O=ht[mt+1],H=N.length-1;l.push(N[0],O[1],O[0]);for(let $=1;$<=H;$++)l.push(N[$-1],N[$],O[$]),l.push(N[$],O[$+1],O[$])}}this.setIndex(l),this.setAttribute("position",new Nt(c,3)),this.setAttribute("normal",new Nt(h,3)),this.setAttribute("uv",new Nt(d,2))}}}),wb=z(()=>{wh(),mh(),xx=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i=Object.assign({},e?.parameters??{width:100,depth:0,cornerRadius:[0,0,0,0],cornerType:1,extrudeBevelSize:0,extrudeBevelSegments:1},t.parameters),n=Object.assign(e?.ui??{enabledIndieCorners:!1},t.ui);return{shape:t.shape&&t.shape instanceof ki?t.shape:new ki,parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??0)}),ui:n}}static build(t){let e=t.shape,{width:i,height:n,cornerRadius:r,cornerType:s,depth:a,extrudeBevelSize:o,extrudeBevelSegments:l,extrusionVersion:c}=t.parameters,h={x:.5*i,y:.5*n},d={x:-h.x,y:-h.y},u={x:h.x,y:h.y};function p(x,w,S){return w>i&&S>n?Math.min(x*i/w,x*n/S):w>i?x*i/w:S>n?x*n/S:x}let f=[];f[0]=r[0]===0?0:p(r[0],r[0]+r[3],r[0]+r[1]),f[1]=r[1]===0?0:p(r[1],r[1]+r[2],r[1]+r[0]),f[2]=r[2]===0?0:p(r[2],r[2]+r[1],r[2]+r[3]),f[3]=r[3]===0?0:p(r[3],r[3]+r[0],r[3]+r[2]);let g=d.x,m=u.x,v=u.y,y=d.y;e.addPoint(e.createPoint(g,v)),e.addPoint(e.createPoint(m,v)),e.addPoint(e.createPoint(m,y)),e.addPoint(e.createPoint(g,y)),e.isClosed=!0;let _=!0;for(let x=0,w=e.points.length;x<w;x++)e.points[x].roundness=f[x],x>0&&f[x]!==f[x-1]&&(_=!1);_&&(e.roundness=f[0]),e.useCubicForRoundedCorners=s!==1,e.update();let b=Sh.create({shape:e,parameters:{depth:a,extrudeBevelSize:o,extrudeBevelSegments:l,extrusionVersion:c}});return Object.assign(b,{userData:{...t,type:"RectangleGeometry"}})}}}),rL=z(()=>{tt(),u6=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i=Object.assign({},e?.parameters??{width:100,widthSegments:64,heightSegments:64,phiStart:0,phiLength:2*Math.PI,thetaStart:0,thetaLength:180},t.parameters);return i.thetaLength=Ot.clamp(i.thetaLength,0,180),{parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??i.width)})}}static build(t){let e,{width:i=100,height:n=i,depth:r=i,widthSegments:s=64,heightSegments:a=64,phiStart:o,phiLength:l,thetaStart:c,thetaLength:h}=t.parameters;return h===0?(e=new jt,e.setAttribute("position",new Nt([],3))):e=new hh(.5*i,s,a,o,l,c,h*Ot.DEG2RAD),e.scale(1,n/i,r/i),Object.assign(e,{userData:{...t,type:"SphereGeometry"}})}}}),sL=z(()=>{tt(),p6=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i=Object.assign({},e?.parameters??{width:100,depth:0,widthSegments:8,heightSegments:8},t.parameters);return{parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:0})}}static build(t){let{width:e=100,height:i=e,widthSegments:n=8,heightSegments:r=8}=t.parameters,s=new ho(e,i,n,r);return s.scale(1,1,1),Object.assign(s,{userData:{...t,type:"PlaneGeometry"}})}}}),aL=z(()=>{tt(),f6=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i=Object.assign({},e?.parameters??{width:100,angle:90,cornerRadius:24,cornerSegments:8},t.parameters);return{parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??i.width)})}}static build(t){let{width:e,height:i,depth:n,angle:r,cornerRadius:s,cornerSegments:a}=t.parameters,o=new iL(e,i,n,r,s,a);return Object.assign(o,{userData:{...t,type:"BackdropGeometry"}})}},iL=class extends jt{constructor(t=1,e=1,i=1,n=90,r=10,s=24){super(),this.type="BackdropGeometry";let a=[],o=[],l=[],c=.001;r==0&&(s=1),s=Math.max(1,Math.floor(s)),r=Math.min(r,100),n=Math.min(180-c,n),n*=Math.PI/180;let h=[],d=Math.PI/2,u=(pt=0,J=0,mt=0)=>new T(pt,J,mt),p=u(),f=u(),[g,m,v]=[e/2,t/2,i/2],y=-m,_=+m,[b,x,w]=[u(y,-g,+v),u(y,-g,-v),u(y,+g,-v)],S=(pt,J=!1)=>Math.sin(pt-Math.PI/(+J+1)),E=(pt,J=!1)=>Math.cos(pt-Math.PI/(+J+1));w.y=Math.sin(n)*e-g;let A=Math.cos(n)*e-v,P=b.z-c;n<=d?(w.z=Math.min(A,P),w.z==P&&(w.y-=(A-P)/Math.tan(d-n))):x.z=Math.min(x.z-A-v,b.z-c),p.subVectors(b,x),f.subVectors(w,x);let C=Math.min(p.length(),f.length())*r/100,R=C*Math.tan(n/2),L=C/Math.cos(n/2),D=p.clone().normalize().add(f.normalize()).setLength(L).add(x);p.set(0,S(n,!0),E(n,!0)),h.push([w,p.clone()]);let F=(Math.PI-n)/s;for(let pt=0;pt<=s;pt++){let J=d+n+pt*F;p.set(0,Math.sin(J)*R,Math.cos(J)*R),p.add(D),f.set(0,S(J),E(J)),h.push([p.clone(),f.clone()])}h.push([b,u(0,1,0)]);let V=Math.sin(F/2)*R*2,U=h.length-1,j=h[0][0].distanceTo(h[1][0]),W=j+V*s+h[U-1][0].distanceTo(h[U][0]);h[0].push(1);for(let pt=0;pt<=s;pt++)h[pt+1].push(1-(j+pt*V)/W);h[U].push(0);let it,nt,Y,[ot,ht,ft]=h[0];for(let pt=1;pt<h.length;pt++)[it,nt,Y]=h[pt],a.push(y,ot.y,ot.z,y,it.y,it.z,_,ot.y,ot.z,_,ot.y,ot.z,y,it.y,it.z,_,it.y,it.z),o.push(0,ht.y,ht.z,0,nt.y,nt.z,0,ht.y,ht.z,0,ht.y,ht.z,0,nt.y,nt.z,0,nt.y,nt.z),l.push(0,ft,0,Y,1,ft,1,ft,0,Y,1,Y),[ot,ht,ft]=[it,nt,Y];this.setAttribute("position",new Nt(a,3)),this.setAttribute("normal",new Nt(o,3)),this.setAttribute("uv",new Nt(l,2))}}}),oT=z(()=>{wh(),mh(),C3=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i=Object.assign({},e?.parameters??{width:100,depth:0,innerRadiusPercent:38.19,spikes:5,cornerRadius:0,angle:360,extrudeBevelSize:0,extrudeBevelSegments:1},t.parameters);return{shape:t.shape&&t.shape instanceof ki?t.shape:new ki,parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??0)})}}static build(t){let{width:e,height:i,innerRadiusPercent:n,spikes:r,cornerRadius:s,angle:a,depth:o,extrudeBevelSize:l,extrudeBevelSegments:c,extrusionVersion:h}=t.parameters,d=t.shape,u=.5*e,p=.5*i,f=a*Math.PI/360/r,g=Math.PI/2*3*-1,m=u*n/100,v=p*n/100;if(r===3&&n===50){f=2*Math.PI/r;for(let _=0;_<r;_++){let b=f*_,x=0+Math.sin(b)*u,w=0+Math.cos(b)*p;d.addPoint(d.createPoint(x,w))}}else for(let _=0;_<r;_++){let b=0+Math.cos(g)*u,x=0+Math.sin(g)*p;d.addPoint(d.createPoint(b,x)),g+=f,b=0+Math.cos(g)*m,x=0+Math.sin(g)*v,d.addPoint(d.createPoint(b,x)),g+=f}d.isClosed=!0;for(let _=0,b=d.points.length;_<b;_++)d.points[_].roundness=s;d.roundness=s,d.update();let y=Sh.create({shape:d,parameters:{roundness:s,depth:o,extrudeBevelSize:l,extrudeBevelSegments:c,extrusionVersion:h}});return Object.assign(y,{userData:{...t,type:"StarGeometry"}})}}}),oL=z(()=>{tt(),m6=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i=Object.assign({},e?.parameters??{width:100,depth:0},t.parameters);return{parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??0)})}}static build(t){let{width:e,height:i}=t.parameters,n=new ho(e,i);return Object.assign(n,{userData:{...t,type:"TextFrameGeometry"}})}}}),lL=z(()=>{tt(),Xg(),g6=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i=Object.assign({},e?.parameters??{width:100,radialSegments:32,tubularSegments:64,arc:360,cornerRadius:30,cornerSegments:8},t.parameters),n=Math.abs(i.width),r=Math.abs(i.height??i.width);i.shapeBlendNode&&(r=n);let s=Math.round(Math.abs(i.depth??.25*i.width));return{parameters:Object.assign(i,{width:n,height:r,depth:s})}}static build(t){let{width:e,height:i,depth:n,radialSegments:r,tubularSegments:s,arc:a,cornerRadius:o,cornerSegments:l}=t.parameters,c=function(h,d,u,p,f,g,m,v,y,_,b){[d,u]=[u,d],m=d/2;let x=Ot.clamp(f/360,0,1);if(x===0){let w=new jt;return w.setAttribute("position",new Nt([],3)),w}return x===1&&(_=0),new XA(!0,h,d,u,p,x,g,m,0,y,_,b)}(e,i,n,.5*e,a,s,0,0,r,o,l);return c.scale(1,i/e,1),Object.assign(c,{userData:{...t,type:"TorusGeometry"}})}}}),hL=z(()=>{tt(),v6=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i=Object.assign({},e?.parameters??{width:100,tubularSegments:64,radialSegments:32,p:2,q:3},t.parameters);return{parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??i.width),tube:i.tube??.125*i.width})}}static build(t){let{width:e,tube:i,tubularSegments:n,radialSegments:r,p:s,q:a}=t.parameters,o=.5*e;o!==i&&(o-=i);let l=new NE(o,i,n,r,s,a);return Object.assign(l,{userData:{...t,type:"TorusKnotGeometry"}})}}}),cL=z(()=>{wh(),mh(),y6=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i=Object.assign({},e?.parameters??{width:100,depth:0,spikes:5,cornerRadius:0,extrudeBevelSize:0,extrudeBevelSegments:1,isRect:!1},t.parameters);return{shape:t.shape&&t.shape instanceof ki?t.shape:new ki,parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width*(i.isRect?1:Math.sqrt(3)/2)),depth:Math.abs(i.depth??0)})}}static build(t){let{width:e=100,height:i,cornerRadius:n,depth:r,extrudeBevelSize:s,extrudeBevelSegments:a,isRect:o,extrusionVersion:l}=t.parameters,c=t.shape,h=.5*e,d=.5*i;o?(c.addPoint(c.createPoint(-h,d)),c.addPoint(c.createPoint(h,-d)),c.addPoint(c.createPoint(-h,-d))):(c.addPoint(c.createPoint(0,d)),c.addPoint(c.createPoint(h,-d)),c.addPoint(c.createPoint(-h,-d))),c.isClosed=!0;for(let p=0,f=c.points.length;p<f;p++)c.points[p].roundness=n;c.roundness=n,c.update();let u=Sh.create({shape:c,parameters:{roundness:n,depth:r,extrudeBevelSize:s,extrudeBevelSegments:a,extrusionVersion:l}});return Object.assign(u,{userData:{...t,type:"TriangleGeometry"}})}}}),$Y=z(()=>{}),YY=z(()=>{tt(),new yr,new At,new Jo,new T,new T,new T,new T});function dL(){let t=new jt;return t.setAttribute("position",new Ht(new Float32Array([]),3)),t.setIndex(new Ht(new Uint16Array([]),1)),t}var uL,lT,_6=z(()=>{Dn(),$t(),h0(),tt(),s0(),wh(),mh(),Ap(),uL=dL().attributes,lT=class extends jt{constructor(t,e){super(),this.isTextGeometry=!0,this.charWidths=[],this.charCoords=[],this.wrappedText=[],this.isLowResolution=!1,this.vectorShapes=[],this._nearSide=new Uint8Array(0),this._depth=0,this._effectiveBevel=0,this._vScale=0,Object.assign(this.attributes,uL),this.userData={parameters:t,type:"TextGeometry"};let i=e.getFont(t.font);i?.isLoaded?(this.font=i,this.update(t,e)):this.updateFont(t.font,e).then(()=>{this.update(t,e),e?.requestRender()})}async updateFont(t,e){let i=e.getFont(t);i&&(this.font=i,await i.loadingPromise)}update(t,e){let i=this.font;if(this.userData={parameters:t,type:"TextGeometry"},!i?.isLoaded)return void console.warn("Cannot update text because its font is not loaded");let{width:n,height:r,depth:s,extrudeBevelSize:a,extrudeBevelSegments:o,text:l,textTransform:c,fontSize:h,extrusionVersion:d}=t,u=br.getDisplayedValue(l),p=function(w,S,E,A){let P=typeof w.width=="string"?Number(A.getVariable(w.width)):w.width,C=[""],R="";for(let L of E)R+=L,L===" "||L===`
4177
4177
  `?(C[C.length-1]+=R,R="",L===`
4178
- `&&C.push("")):S.getTextWidth(C[C.length-1]+R,w)>P&&(C[C.length-1].length&&C.push(""),S.getTextWidth(C[C.length-1]+R,w)>P&&(R.length===1?(C[C.length-1]+=R,R=""):(C[C.length-1]+=R.slice(0,-1),R=R[R.length-1],C.push(""))));return C[C.length-1]+=R,C}(t,i,c===2?u.toUpperCase():c===3?u.toLowerCase():u,e),{shapes:f,charWidths:g,charCoords:m}=i.generateShapes(p,t,e),v=.5*(typeof n=="number"?n:Number(e.getVariable(n))),y=.5*(typeof r=="number"?r:Number(e.getVariable(r))),_=f.map(w=>new ki().fromShape(w,!0));this.vectorShapes=_;let b=_.map(w=>Sh.create({shape:w,parameters:{depth:s,extrudeBevelSegments:o,extrudeBevelSize:a,uvPitch:d===1?void 0:h,extrusionVersion:d,windingRule:s<=0?Oi.NONZERO:Oi.ODD,subdivisions:this.isLowResolution&&s>0?1:12}})),x=b.length?Tc(b):dL();x.translate(-v,y,0),this.dispose(),this.wrappedText=p,this.charCoords=m,this.charWidths=g,this.deleteAttribute("extrudeNormal"),Object.entries(x.attributes).forEach(([w,S])=>{this.setAttribute(w,S)}),this.setIndex(x.index),this.adoptNearSide(b,s),this.computeBoundingSphere()}adoptNearSide(t,e){this._depth=e;let i=0,n=0,r=0;for(let o of t){let l=o,c=l._nearSide;if(c===void 0||c.length===0)return this._nearSide=new Uint8Array(0),this._effectiveBevel=0,void(this._vScale=0);i+=c.length,n=Math.max(n,l._effectiveBevel??0),r=l._vScale??r}this._effectiveBevel=n,this._vScale=r;let s=new Uint8Array(i),a=0;for(let o of t){let l=o._nearSide;s.set(l,a),a+=l.length}this._nearSide=s}takeDepthStateFrom(t){let e=t;e._nearSide!==void 0&&(this._depth=e._depth??this._depth,this._nearSide=e._nearSide,this._vScale=e._vScale??this._vScale,this._effectiveBevel=e._effectiveBevel??this._effectiveBevel)}canShiftDepthTo(t){return this._nearSide.length===this.getAttribute("position")?.count&&Nu(this._effectiveBevel,t)&&Nu(this._effectiveBevel,this._depth)}shiftDepthTo(t){if(!this.canShiftDepthTo(t))return!1;let e=t-this._depth;if(this._depth=t,e===0)return!0;let i=this.getAttribute("position"),n=i.array,r=this.getAttribute("uv"),s=r?.array,a=this._vScale>0?e/this._vScale:0,o=this._nearSide;for(let l=0;l<o.length;l++){let c=o[l];c!==0&&(n[3*l+2]+=e,c===2&&s!==void 0&&(s[2*l+1]+=a))}return i.needsUpdate=!0,r!==void 0&&a!==0&&(r.needsUpdate=!0),this.refreshDepthBounds(t),!0}refreshDepthBounds(t){if(this.boundingBox===null&&this.boundingSphere===null)return;this.boundingBox===null&&this.computeBoundingBox();let e=this.boundingBox;e.min.z=Math.min(0,t),e.max.z=Math.max(0,t),this.boundingSphere!==null&&e.getBoundingSphere(this.boundingSphere)}clone(){let t=Ar(new jt,lT.prototype);return t.copy(this),console.log("CloneGeometry",this,t),t}copy(t){return Object.entries(t.attributes).forEach(([e,i])=>{this.setAttribute(e,i)}),this.setIndex(t.index),this.userData={parameters:{...t.userData.parameters},type:"TextGeometry"},this}async setText(t,e){this.font&&await this.font.loadingPromise,await this.update({...this.userData.parameters,text:{textValue:t}},e)}get text(){return this.userData.parameters.text??""}}});function ZY(t){if(!hT)return pL||(pL=async function(){let e=t??"https://cdn.spline.design/@splinetool/runtime@2.0.77/build",i=import("./process.js"),[n,r]=await Promise.all([i,fetch(`${e}/process.wasm`).then(o=>o.arrayBuffer())]),s=n.default,a=await s({wasmBinary:r});b6(a),hT=!0}())}var b6,P3,hT,pL,wx=z(()=>{P3=new Promise(t=>{b6=t}),hT=!1});function c2(t,e){if(Object.keys(t.morphAttributes).length>0||Object.keys(e.morphAttributes).length>0)return!1;let i=Object.keys(t.attributes),n=Object.keys(e.attributes);if(i.length!==n.length)return!1;for(let l of n){let c=t.attributes[l],h=e.attributes[l];if(c===void 0||c.isInterleavedBufferAttribute===!0||h.isInterleavedBufferAttribute===!0||c.itemSize!==h.itemSize||c.normalized!==h.normalized||c.array.constructor!==h.array.constructor||c.array.length!==h.array.length)return!1}let r=t.index,s=e.index;if(r===null!=(s===null))return!1;let a=!1;if(r!==null&&s!==null){if(r.array.length!==s.array.length)return!1;let l=r.array.constructor,c=s.array.constructor;if(l!==c){if(l!==Uint32Array||c!==Uint16Array)return!1;a=!0}}if(t.groups.length!==e.groups.length)return!1;for(let l=0;l<e.groups.length;l++){let c=t.groups[l],h=e.groups[l];if(c.start!==h.start||c.count!==h.count||c.materialIndex!==h.materialIndex)return!1}for(let l of n){let c=t.attributes[l],h=e.attributes[l];c.array.set(h.array),c.needsUpdate=!0}let o=t.takeDepthStateFrom;if(typeof o=="function"&&o.call(t,e),r!==null&&s!==null){if(a){let l=r.array,c=s.array;for(let h=0,d=c.length;h<d;h++){let u=c[h];l[h]=u===65535?4294967295:u}}else r.array.set(s.array);r.needsUpdate=!0}return t.drawRange.start=e.drawRange.start,t.drawRange.count=e.drawRange.count,t.userData=e.userData,t.boundingBox=null,t.boundingSphere=null,!0}function cT(t,e,i,n){let r,s,a,o=t.position.array,l=t.normal.array,c=x6.makeScale(e,i,n).invert().elements;for(let h=0,d=o.length;h<d;h+=3)o[h]*=e,o[h+1]*=i,o[h+2]*=n,r=l[h],s=l[h+1],a=l[h+2],l[h]=c[0]*r+c[4]*s+c[8]*a,l[h+1]=c[1]*r+c[5]*s+c[9]*a,l[h+2]=c[2]*r+c[6]*s+c[10]*a;t.position.needsUpdate=!0,t.normal.needsUpdate=!0}var x6,w6=z(()=>{tt(),x6=new At});function dT(t){let e=Number(t);return Number.isInteger(e)&&e>=0&&String(e)===t?e:-1}function Vv(t){if(t!=null){if(Array.isArray(t)||ArrayBuffer.isView(t)&&!(t instanceof DataView))return t;if(typeof t=="object")return function(e){let i=Object.keys(e),n=0;for(let s of i){let a=dT(s);a>=n&&(n=a+1)}if(n===0||n>i.length)return;let r=new Array(n);for(let s=0;s<n;s++){let a=e[s];if(typeof a!="number")return;r[s]=a}return r}(t)}}function d2(t){if(t==null)return"missing";if(Array.isArray(t))return`Array(${t.length})`;if(ArrayBuffer.isView(t)){let l=t;return`${t.constructor.name}(${l.length})`}if(typeof t!="object")return typeof t;let e=Object.keys(t),i=e.filter(l=>dT(l)===-1),n=0;for(let l of e){let c=dT(l);c>=n&&(n=c+1)}let r=t,s=-1,a=-1;for(let l=0;l<n;l++)l in r?typeof r[l]!="number"&&a===-1&&(a=l):s===-1&&(s=l);let o=[`${e.length} keys`,"max index "+(n-1)];return s!==-1&&o.push(`first missing index ${s}`),a!==-1&&o.push(`non-number at ${a} (${typeof r[a]})`),i.length&&o.push(`stray keys ${i.slice(0,3).join(",")}`),`Object{${o.join(", ")}}`}function S6(t){let e=Object.keys(t);return e.length===1&&e[0]==="subdivisions"}function D3(t,e){let i=e?e.count:t.count,n=0,r=1e4,s=new Map,a=new Uint32Array(i),o=[];for(let h=0;h<i;h++){let d=e?e.getX(h):h,u=t.getX(d),p=t.getY(d),f=t.getZ(d),g=Math.round(u*r),m=Math.round(p*r),v=Math.round(f*r),y=s.get(g);y===void 0&&(y=new Map,s.set(g,y));let _=y.get(m);_===void 0&&(_=new Map,y.set(m,_));let b=_.get(v);b===void 0&&(b=n++,_.set(v,b),o.push(u,p,f)),a[h]=b}let l=[],c=[];for(let h=0;h<a.length;h+=3)a[h]===a[h+1]||a[h]===a[h+2]||a[h+1]===a[h+2]||(l.push(a[h],a[h+1],a[h+2]),c.push(e?e.getX(h):h,e?e.getX(h+1):h+1,e?e.getX(h+2):h+2));return{positions:o,triIndices:l,triOriginals:c}}var Gf,ec,Qt,u2,p2,f2,Ni,Hf,jv,Gv,Hv,uT,B1,Tp=z(()=>{tt(),wx(),$t(),Sx(),w6(),Xg(),Gf=new ci,ec=new T,P3.then(t=>{Qt=t}),u2=new Float32Array([10,10,0,-10,10,0,-10,-10,0,10,-10,0]),p2=new Uint32Array([0,1,2,3]),f2=new Uint8Array([4]),Ni=class extends jt{constructor(t,e){super(),this.data=t,this.flatShading=e,this.subdivPointer=0,this.rebuild(),this.freeSubdivPointer()}mutateDirectlyScaleBaked(t,e){this.freeSubdivPointer();let i=this.data.scaleBaked.map(a=>typeof a=="number"?a:1),n=dh.div(e.map(a=>typeof a=="number"?a:0),i);if(n.every(a=>a===1))return;this.subdividedGeometry&&cT(this.subdividedGeometry.attributes,...n),this.originalGeometry&&cT(this.originalGeometry.attributes,...n),this.data=t;let r=this.userData.parameters;this.userData.parameters={width:r.width*n[0],height:r.height*n[1],depth:r.depth*n[2]},this.originalGeometry.boundingSphere.center.multiply(ec.fromArray(n));let s=ec.set(r.width,r.height,r.depth).length();this.originalGeometry.boundingSphere.radius=s/2}ensureSubdivPointer(){return this.subdivPointer===0&&this.rebuild(),this.subdivPointer}mutateDirectlySubdivisions(t){this.freeSubdivPointer(),this.data=t;let e=t.phongAngle??35;this.flatShading&&(e=-1);let i=null;if(t.subdivisions>0){let r=0;try{r=Ni.allocate(t),i=Ni.buildRefined(r,t.subdivisions,e)}catch(s){console.error(s,t)}finally{r&&Ni.freeSubdivPointer(r)}}this.subdividedGeometry?.dispose(),this.subdividedGeometry=i??void 0,this.subdividedGeometry&&(this.subdividedGeometry.boundingSphere=this.originalGeometry.boundingSphere);let n=this.userData.parameters;Object.assign(this,this.subdividedGeometry??this.originalGeometry),this.userData.parameters=n}rebuild(){let t,e,i;try{({originalGeometry:t,subdividedGeometry:e,subdivPointer:i}=Ni.build(this.data,void 0,!this.flatShading,void 0))}catch{t=new va(100,100,100),i=0}this.subdivPointer=i,this.originalGeometry=t,this.subdividedGeometry=e??void 0;let n=this.subdividedGeometry??this.originalGeometry;Object.assign(this,n),this.calcBoundingBox()}freeSubdivPointer(){this.subdivPointer&&(Ni.freeSubdivPointer(this.subdivPointer),this.subdivPointer=0)}dispose(){super.dispose(),this.freeSubdivPointer()}calcBoundingBox(){let t=this.originalGeometry;t.boundingSphere===null&&(t.boundingSphere=new yr,this.subdividedGeometry&&(this.subdividedGeometry.boundingSphere=t.boundingSphere));let e=t.attributes.position,i=t.boundingSphere.center;Gf.setFromBufferAttribute(e),Gf.getCenter(i),t.boundingSphere.radius=i.distanceTo(Gf.max),isNaN(t.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this),Gf.getSize(ec);let n={width:ec.x,height:ec.y,depth:ec.z};return this.userData.parameters=n,n}static build(t,e,i,n){let r,s,a=t?.phongAngle??35;i===!1&&(a=-1),e&&(Qt.free_bvh(e),Qt.free_subdivision_surface(e));try{r=Ni.allocate(t,n)}catch(l){console.error(l,t),r=Ni.allocate({positionWASM:u2,indexWASM:p2,verticesPerFaceWASM:f2},n)}Qt.set_destination_refinement_level(r,0);let o=Ni.buildLevel(r,!0,a);return s=t.subdivisions>0?Ni.buildRefined(r,t.subdivisions,a):null,{subdivPointer:r,originalGeometry:o,subdividedGeometry:s}}static buildRefined(t,e,i){try{return Qt.set_destination_refinement_level(t,e),Ni.buildLevel(t,!1,i)??null}catch{try{return Qt.set_destination_refinement_level(t,e-1),Ni.buildLevel(t,!1,i)??null}catch{return null}}}static primitiveToQuads(t,e,i){t.widthSegments>16&&(t.widthSegments=16),t.heightSegments>16&&(t.heightSegments=16),t.depthSegments>16&&(t.depthSegments=16),t.radialSegments>16&&(t.radialSegments=16),t.type==="DodecahedronGeometry"&&(t.detail=0);let n,r=t.shape!==void 0||t.path!==void 0?e.geometry:nh(t,i,!1,e);n=fk(t)?r.getClosedTorusIndicesForBooleanOrSubdiv():r.getIndex();let s,{positions:a,triIndices:o,triOriginals:l}=D3(r.getAttribute("position"),n);if(t.type==="CylinderGeometry"&&t.cornerRadius===0&&t.hollow===0&&t.openEnded===!1){let u=t.radialSegments*t.heightSegments*3*2;s=[u,u+3*t.radialSegments]}let{indices:c,verticesPerFace:h,uvs:d}=function(u,p,f,g,m){let v=[],y=[],_=m?f.getAttribute("uv"):void 0,b=_&&_.itemSize===2?[]:void 0,x=E=>{if(b){let A=m[E];b.push(_.getX(A),_.getY(A))}};if(f.userData.shape!==void 0&&f.userData.parameters.depth===0&&f.userData.shape.shapeHoles.length===0){let E=f.userData.shape.extractShapePointsToFlatArray([]),A=f.userData.parameters.spikes;if(f.userData.type==="EllipseGeometry"&&A<=24&&A%4==0&&f.userData.parameters.angle>=360){let R=E.length/2/A;E=E.filter((L,D)=>Math.floor(D/2)%R===0)}let P=0;for(let R=0;R<E.length;R+=2)P+=(E[R]-E[(R===0?E.length:R)-2])*(E[R+1]+E[(R===0?E.length:R)-1]);u.length=0;let C=0;if(P<0)for(let R=0;R<E.length;R+=2)u.push(E[R],E[R+1],0),v.push(C++);else for(let R=E.length-2;R>=0;R-=2)u.push(E[R],E[R+1],0),v.push(C++);return y.push(C),{indices:v,verticesPerFace:y}}let w=new Float32Array([f.userData.parameters.depth])[0],S=0;for(;S<p.length;){if(f.useNgonForTopBottomFaceDuringBake){let E=0;if((u[3*p[S]+2]===w||u[3*p[S]+2]===0)&&E++,(u[3*p[S+1]+2]===w||u[3*p[S+1]+2]===0)&&E++,(u[3*p[S+2]+2]===w||u[3*p[S+2]+2]===0)&&E++,E===3)break}if(p[S+1]===p[S+3]&&p[S+2]===p[S+5]||p[S+0]===p[S+3]&&p[S+2]===p[S+4]){Hf.set(u[3*p[S]],u[3*p[S]+1],u[3*p[S]+2]),jv.set(u[3*p[S+1]],u[3*p[S+1]+1],u[3*p[S+1]+2]),Gv.set(u[3*p[S+4]],u[3*p[S+4]+1],u[3*p[S+4]+2]),Hv.set(u[3*p[S+5]],u[3*p[S+5]+1],u[3*p[S+5]+2]),jv.sub(Hf).normalize(),Gv.sub(Hf).normalize(),Hv.sub(Hf).normalize();let E=jv.cross(Gv).dot(Hv),A=S;Math.abs(E)>.005||g&&g.some((P,C)=>C%2!=1&&A>=g[C]&&A<g[C+1])?(v.push(p[S],p[S+1],p[S+2]),x(S),x(S+1),x(S+2),y.push(3),S+=3):(v.push(p[S],p[S+1],p[S+4],p[S+5]),x(S),x(S+1),x(S+4),x(S+5),y.push(4),S+=6)}else v.push(p[S],p[S+1],p[S+2]),x(S),x(S+1),x(S+2),y.push(3),S+=3}if(f.useNgonForTopBottomFaceDuringBake){let E=[],A=[],P=0;for(let C=0,R=0;C<u.length;C+=3,R++)u[C+2]===0&&(E.push(R),P++),u[C+2]===w&&A.push(R);if(f.userData.parameters.extrudeBevelSize===0){let C=A[0];A[0]=A[1],A[1]=C}E.reverse(),v.push(...E,...A),y.push(P,P),b=void 0}return{indices:v,verticesPerFace:y,uvs:b}}(a,o,r,s,l);return{positions:a,indices:c,verticesPerFace:h,uvs:d}}static allocate(t,e){let i,n,r,s=[],a=[],o=Vv(t.positionWASM),l=Vv(t.indexWASM),c=Vv(t.verticesPerFaceWASM);if(o&&o.length>0){if(!l?.length||!c?.length)throw new Error(`SubdivGeometry.allocate: unusable cage topology \u2014 positionWASM ${d2(t.positionWASM)}, indexWASM ${d2(t.indexWASM)}, verticesPerFaceWASM ${d2(t.verticesPerFaceWASM)}`);i=o,n=l,r=c;let S=Vv(t.uvWASM);Qt.alloc_subdivision_surface_uvs&&S&&S.length===2*n.length&&(a=S)}else i=u2,n=p2,r=f2;let h=i.length,d=n.length,u=r.length,p=i.length+s.length+a.length,f=n.length+r.length,g=p*Float32Array.BYTES_PER_ELEMENT+f*Uint32Array.BYTES_PER_ELEMENT,m=p*Float32Array.BYTES_PER_ELEMENT,v=Qt._malloc(g);if(!v)throw new Error(`SubdivGeometry.allocate: wasm _malloc(${g}) failed`);let y,_=new Float32Array(Qt.HEAPF32.buffer,v,p),b=new Uint32Array(Qt.HEAPU32.buffer,v+m,f);_.set(i,0),_.set(s,i.length),_.set(a,i.length+s.length),b.set(n,0),b.set(r,n.length),t?.scaleBaked?.some(S=>S!==1)&&(y=new At().makeScale(...t.scaleBaked.map(S=>typeof S=="number"?S:1))),e&&(y?y.premultiply(e):y=e);let x=v+(i.length+s.length)*Float32Array.BYTES_PER_ELEMENT,w=a.length?y?Qt.alloc_subdivision_surface_uvs2(v,h,v+m,d,v+m+n.length*Uint32Array.BYTES_PER_ELEMENT,u,x,a.length,y.elements):Qt.alloc_subdivision_surface_uvs(v,h,v+m,d,v+m+n.length*Uint32Array.BYTES_PER_ELEMENT,u,x,a.length):y?Qt.alloc_subdivision_surface2(v,h,v+m,d,v+m+n.length*Uint32Array.BYTES_PER_ELEMENT,u,y.elements):Qt.alloc_subdivision_surface(v,h,v+m,d,v+m+n.length*Uint32Array.BYTES_PER_ELEMENT,u);return Qt._free(v),w}static buildLevel(t,e,i,n,r,s=!1){let a=r?Qt.get_mesh_data2(t,e?Qt.Level.CONTROL:Qt.Level.REFINED,i,r.elements):Qt.get_mesh_data(t,e?Qt.Level.CONTROL:Qt.Level.REFINED,i),o=Qt.HEAPU32.subarray(a>>2,10+(a>>2)),l=o.subarray(4,8),c=0,h=Qt.HEAPU32[o[c]>>2],d=Qt.HEAPF32.subarray(h>>2,(h>>2)+l[c]);c++;let u=Qt.HEAPU32[o[c]>>2],p=Qt.HEAPF32.subarray(u>>2,(u>>2)+l[c]);c++;let f=Qt.HEAPU32[o[c]>>2],g=Qt.HEAPU32.subarray(f>>2,(f>>2)+l[c]);c++;let m,v=Qt.HEAPU32[o[c]>>2],y=Qt.HEAPU32.subarray(v>>2,(v>>2)+l[c]);if(c++,Qt.alloc_subdivision_surface_uvs){let b=o[9];if(b>0){let x=Qt.HEAPU32[o[8]>>2];m=Qt.HEAPF32.subarray(x>>2,(x>>2)+b)}}if(n===void 0){let b=new jt;if(b.setIndex(new lh(y,1)),b.setAttribute("position",new Nt(d,3)),b.setAttribute("normal",new Nt(p,3)),m&&b.setAttribute("uv",new Nt(m,2)),e){b.setAttribute("faceMap",new lh(g,1));let x=new Float32Array(p.length/3*4).fill(0);b.setAttribute("color",new Ht(x,4))}return Qt.free_mesh_data(a),b.userData.type="SubdivGeometry",b}if(n.getAttribute("position").copyArray(d),n.getAttribute("normal").copyArray(p),n.attributes.position.needsUpdate=!0,n.attributes.normal.needsUpdate=!0,s){let b=n.getIndex();b!==null&&b.array.length===y.length&&(b.copyArray(y),b.needsUpdate=!0)}let _=n.getAttribute("uv");m&&_&&_.array.length===m.length&&(_.copyArray(m),_.needsUpdate=!0),Qt.free_mesh_data(a)}static freeSubdivPointer(t){Qt.free_bvh(t),Qt.free_subdivision_surface(t)}static buildControlCageWireframe(t,e,i){let n=Qt.get_wireframe_data_for_base_level(t),r=Qt.HEAPU32.subarray(n>>2,4+(n>>2)),s=r.subarray(2,4),a=0,o=Qt.HEAPU32[r[a]>>2],l=Qt.HEAPF32.subarray(o>>2,(o>>2)+s[a]);a++;let c=Qt.HEAPU32[r[a]>>2],h=Qt.HEAPU32.subarray(c>>2,(c>>2)+s[a]);if(e===void 0){let d=new jt;d.setAttribute("position",new Nt(l,3));let u=new Float32Array(l.length);for(let p=0,f=l.length;p<f;)u[p++]=i.r,u[p++]=i.g,u[p++]=i.b;return d.setAttribute("color",new Ht(u,3)),d.setIndex(new lh(h,1)),Qt.free_wireframe_data_for_base_level(n),d}e.getAttribute("position").copyArray(l),e.attributes.position.needsUpdate=!0,Qt.free_wireframe_data_for_base_level(n)}static updateCollabMesh(t,e,i){let n=e===0;n||Qt.set_destination_refinement_level(t,e);let r=i?Qt.get_topological_data2(t,n?Qt.Level.CONTROL:Qt.Level.REFINED,i.elements):Qt.get_topological_data(t,n?Qt.Level.CONTROL:Qt.Level.REFINED),s=Qt.HEAPU32.subarray(r>>2,8+(r>>2)),a=s.subarray(3,6),o=0,l=Qt.HEAPU32[s[o]>>2],c=new Float32Array(Qt.HEAPF32.subarray(l>>2,(l>>2)+a[o]));o++;let h=Qt.HEAPU32[s[o]>>2],d=new Uint32Array(Qt.HEAPU32.subarray(h>>2,(h>>2)+a[o]));o++;let u,p=Qt.HEAPU32[s[o]>>2],f=new Uint8Array(Qt.HEAPU32.subarray(p>>2,(p>>2)+a[o]));if(Qt.alloc_subdivision_surface_uvs){let g=s[7];if(g>0){let m=Qt.HEAPU32[s[6]>>2];u=new Float32Array(Qt.HEAPF32.subarray(m>>2,(m>>2)+g))}}return Qt.free_topological_data(r),{positions:c,indices:d,verticesPerFace:f,uvs:u}}},Hf=new T,jv=new T,Gv=new T,Hv=new T}),M6=z(()=>{R4(),I4(),vb(),O4(),xb(),Xg(),Q4(),J4(),tL(),aT(),nL(),wb(),rL(),sL(),aL(),oT(),oL(),lL(),hL(),cL(),mh(),ke(),R4(),I4(),vb(),O4(),xb(),$Y(),Xg(),Q4(),J4(),tL(),aT(),nL(),wb(),rL(),sL(),aL(),oT(),oL(),lL(),hL(),cL(),mh(),YY(),Zk(),_6(),Tp(),wx(),_x(),Ap(),uT={ConeGeometry:Rk,CubeGeometry:Ik,CylinderGeometry:x3,DodecahedronGeometry:Ok,EllipseGeometry:bx,HelixGeometry:mk,IcosahedronGeometry:s6,LatheGeometry:a6,NonParametricGeometry:l6,PolygonGeometry:T3,PyramidGeometry:h6,RectangleGeometry:xx,SphereGeometry:u6,PlaneGeometry:p6,BackdropGeometry:f6,StarGeometry:C3,TextFrameGeometry:m6,TorusGeometry:g6,TorusKnotGeometry:v6,TriangleGeometry:y6,VectorGeometry:Sh},B1=t=>{let e=uT[t.type]??ik(t.type);if(e===void 0)throw new Error(`No geometry factory registered for "${t.type}" \u2014 was its feature compiled out of this runtime build?`);return e.create(t)}});function nh(t,e,i,n){let r,s,a;t.type==="PathGeometry"?(s={...t,extrusion:{...t.extrusion}},a=[[],["extrusion"]]):(s={...t},a=[[]]);for(let c of a){let h=s;for(let d of c)h=h[d];for(r in h){let d=h[r];KI(d)&&!E6.includes(r)&&(h[r]=e.getVariable(d,[n.uuid,"geometry",...c,r]),KI(h[r])&&(h[r]=1))}}let o,l={parameters:s,type:s.type};if(s.type==="PathGeometry"){l.path=s.path;let c=n.profileShape;c!==void 0&&(l.shapeData=c),l.ownerId=n.uuid}else if(s.type==="VectorGeometry"){let c=ki.createFromState(s.shape,s.width,s.height);l.shape=c,l.ownerId=n.uuid}else if(s.type==="NonParametricGeometry"){if(s.data.groups&&s.data.groups?.forEach(c=>c.materialIndex=Math.max(c.materialIndex??0,0)),l.geometry=new LC().parse(s),l.geometry.groups.length===0){let c=l.geometry;c.addGroup(0,Math.max(c.getIndex()?.count??0,c.getAttribute("position").count),0)}}else{if(s.type==="SubdivGeometry"){let c=new Ni(s,i);return c.data=t,c}if(s.type==="TextGeometry"||s.type==="InputGeometry"){let c=ik(s.type);if(c)return c.create(s,e);Gn("text",`a ${s.type}`);let h=ki.createFromState(Hg.defaultData(),100,100);return B1({...s,shape:h,type:"VectorGeometry"})}if(s.type==="UIGeometry")return xx.create({parameters:{width:s.width,height:s.height,cornerRadius:s.cornerRadius,cornerType:s.cornerType}})}try{o=B1(l)}catch(c){console.error(c),console.error(`Error generating geometry with inputs: ${l}`);let h=ki.createFromState(Hg.defaultData(),100,100);l.shape=h,l.type="VectorGeometry",o=B1(l)}return o}var E6,fL,pT,Sx=z(()=>{$t(),tt(),M6(),ke(),wb(),wh(),Tp(),E6=["font"]}),KY=z(()=>{Sx(),fL=class{constructor(){this.objects=new Map,this.unreachable=new Set}getCached(t){return this.objects.get(t)}get size(){return this.objects.size}get(t,e,i){let n=this.objects.get(t);return n===void 0?(n=this.createObject(t,e,i),this.objects.set(t,n)):n.isShared=!0,n}forceDelete(t){let e=this.objects.get(t);e&&(this.disposeObject(e),this.objects.delete(t))}adopt(t,e){this.objects.set(t,e)}mutateIfUnique(t,e){let i=this.objects.get(t);if(i&&i.isShared!==!0)return this.objects.delete(t),this.objects.set(e,i),i}startGc(){this.unreachable=new Set(this.objects.keys())}markAsReachable(t,e){e===this.objects.get(t)&&this.unreachable.delete(t)}endGc(){this.unreachable.forEach(t=>{this.disposeObject(this.objects.get(t)),this.objects.delete(t)}),this.unreachable.clear()}dispose(){this.objects.forEach(t=>{this.disposeObject(t)}),this.objects.clear()}},pT=class extends fL{constructor(t){super(),this.flatShading=t}disposeObject(t){t.dispose()}createObject(t,e,i){let n=nh(t,e,this.flatShading,i);return n.computeBoundingSphere(),n}}});function Sb(){return Mx}function A6(){if(Mx==="webgpu"){if(vL!==void 0)return vL;mT||(mT=!0,console.warn('[spe] Material backend is "webgpu" but no TSL material factory is registered \u2014 import spe/src/renderer/webgpu before creating materials. Falling back to WebGL materials.'))}if(fT===void 0)throw new Error('[spe] Classic (WebGL) materials are not available in this build \u2014 it was compiled WebGPU-only. Re-export the scene with renderer "Both" or "WebGL 2", or load the full runtime.');return fT}function T6(t,e){return A6().createRootMaterial(t,e)}function mL(t,e,i){return A6().createSharedMaterial(t,e,i)}function gL(t){return t.getLayersOfType===void 0&&Object.assign(t,{layers:[],getLayersOfType:()=>[],hasAO:!1,assetsLoaded:()=>!0}),t}function C6(){return QY}var Mx,vL,fT,mT,gT,QY,vT,P6,Mh=z(()=>{Mx="webgl",mT=!1}),JY=z(()=>{P6={markNeedsUpdateRendererDirty:()=>{}}});function Oc(t,e){let i=0;if(!t.layers||t.layers.length===0)return!1;let n=t.layers?.find(r=>r.data.type==="light");if(n){let r=n.data,s=Number(e.getVariable(r.alphaOverride));if((typeof r.alphaOverride=="string"?s/100:r.alphaOverride)<1)return!0}for(let r of t.layers){if(r.data.type!=="displace"&&r.data.isMask)return!0;if(r.data.type!=="displace"&&"alpha"in r.data&&r.data.type!=="light"&&r.data.type!=="fresnel"&&r.data.type!=="cavity"&&r.data.type!=="dust"&&r.data.type!=="texture"&&r.data.type!=="matcap"&&r.data.type!=="rainbow"&&r.data.type!=="outline"&&r.data.type!=="pattern"){let s=r.data.visible?r.data.alpha:0;if(typeof s=="string"&&(s=Math.max(0,Math.min(1,Number(e.getVariable(s)??100)/100))),s===1&&r.data.type==="depth"||r.data.type==="gradient"){for(let a of r.data.colors)if(a[3]<1){s=a[3];break}}else if(s===1&&r.data.type==="noise"){let a=e.color(r.data.colorA).a,o=e.color(r.data.colorB).a,l=e.color(r.data.colorC).a,c=e.color(r.data.colorD).a,h=Math.min(a,Math.min(o,Math.min(l,c)));h<1&&(s=h)}i+=(1-i)*s}}return i<1}var R3=z(()=>{});function vp(t){return typeof t=="string"||typeof t=="number"&&t!==0}var gh,Xt,Ex,D6,yL,_L,_s,hl=z(()=>{gh=(t,e,i)=>Math.max(0,Math.min(1,Number(e.getVariable(typeof t=="number"?100*t:t,i)??100)/100))??1,Xt=(t,e,i)=>typeof t=="number"?t:e.getVariable(t,i),Ex={noise:["noiseType"],texture:["projection","axis","projectionAxis","side"],video:["projection","axis","projectionAxis","side"],displace:["noiseType"],light:["roughnessMap","bumpMap","roughnessMapChannel","metalnessMap","metalnessMapChannel","normalMap","aoMap","aoMapChannel","emissiveMap"],depth:["smooth","isWorldSpace","gradientType","isVector"],pattern:["style","projection","axis"],reflection:["tracingMode","mirror"]},D6={depth:["colors"],gradient:["colors","steps"],toon:["colors","steps"]}}),Cp=z(()=>{tt(),l0(),yL=class extends gx(_i){},_L=t=>t.type==="Mesh",_s=class extends yL{constructor(t){super(),this.object=t,this.isClone=!0,this.matrixAutoUpdate=!1,this.hasNonUniformScale=t.hasNonUniformScale}raycast(t,e){}expand(){let t=0,e=this.object.entityChildren(t);for(;e;){let i=this.children[t];i?.object!==e&&(i&&this.remove(i),i=new _s(e),this.add(i),this.children.splice(t,0,this.children.pop()),i.matrixWorldNeedsUpdate=!0,i.matrixAutoUpdate=!1,i.matrix=e.matrix,i.hiddenMatrix=e.hiddenMatrix,i.pivotMatrix=e.pivotMatrix),i.expand(),t+=1,e=this.object.entityChildren(t)}for(;this.children.length>t;)this.remove(this.children[t]);this.pivotMatrix=this.object.pivotMatrix}get visible(){let t=this.object.cloner;return(t===void 0||this.parent!==t||!t.instancingActive&&!t.insideBoolean)&&(this.playModeVisible!==void 0?this.playModeVisible:this.object.visible||this.object.dataPatched.visible&&this.object.dataPatched.cloner?.hideBase===!0)}set visible(t){}get castShadow(){return this.object.castShadow}set castShadow(t){}get receiveShadow(){return this.object.receiveShadow}set receiveShadow(t){}get isMesh(){return _L(this.object)}get isLight(){return this.object.isLight}get layers(){return this.object.layers}set layers(t){}get isCamera(){return!1}get geometry(){if(this.object.geometry)return this.object.geometry}get material(){if(this.object.material)return this.object.material}get morphTargetInfluences(){if(this.object.morphTargetInfluences)return this.object.morphTargetInfluences}set morphTargetInfluences(t){}}});function bL(){return I3}var I3,O3,L3=z(()=>{I3=null,O3=null});function yT(t){return"variable_"+t}var m2,g2,v2,xL,y2,wL,_2,SL,Mb,B3=z(()=>{$t(),Mk(),Tk(),v3(),_a(),y3(),b3(),KY(),Mh(),Ak(),JY(),R3(),hl(),qr(),Cp(),Ye(),tt(),L3(),ke(),m2=new At,g2=new T,v2=new Wt,xL=new T,y2=new xi,wL=class extends wk{constructor(t){super(),this.shared=t}create(t){return new g3(t,this.shared)}},_2=new Set,(Mb=SL=class{constructor(t,e={},i=!0,n=!1){if(this.data=t,this.needsJitter=i,this.enableLocalStorageForPersistentVariables=n,this.geometryCache=new pT(!0),this.geometryCache2=new pT(!1),this.imageHolderCache=new wL(this),this.thisContext={scene:P6,shared:this},this.deletedImage=new Ko(OA.emptyImage,this),this.deletedVideo=new Ko(Q_.defaultVideo,this),this.materials={},this.images={},this.uiBuffers={},this.videos={},this.colors={},this.audios={},this.particles={},this.fonts={},this.variables={},this.userAPIs={},this.userWebhooks={},this.mouseProperty=null,this.raycastProperty=null,this.requestRender=()=>{this._requestRender&&this._requestRender()},this.transientGeometryKeys=new WeakSet,e.images)for(let[r,s]of Object.entries(e.images))this.addImage(r,s);if(e.videos)for(let[r,s]of Object.entries(e.videos))this.addVideo(r,s);if(e.audios)for(let[r,s]of Object.entries(e.audios))this.addAudio(r,s);if(e.particles)for(let[r,s]of Object.entries(e.particles))this.addParticle(r,s);this.reset(t)}get deletedMaterial(){return this._deletedMaterial??(this._deletedMaterial=mL(Vi.defaultTwoLayerData("phong"),this.thisContext,"")),this._deletedMaterial}setRequestRender(t){this._requestRender=t}getImageLoadPromises(){return Object.values(this.images).map(t=>t.loadPromise)}setEntityOpContext(t){this.entityOpContext=t}reset(t,e=!1,i=!1){this.data=t,this.resetLib(t.lib);for(let{id:n,data:r}of t.variables)this.addVariableHolder(n,r),e&&this.updateVariableHolder(n,r);for(let[n,r]of Object.entries(t.userAPIs??{}))this.addUserAPI(n,r);for(let[n,r]of Object.entries(t.userWebhooks??{}))this.addUserWebhook(n,r);if(!i){for(let[n,r]of Object.entries(t.images))this.addImage(n,r);for(let[n,r]of Object.entries(t.videos))this.addVideo(n,r)}for(let[n,r]of Object.entries(t.colors))this.addColor(n,r);for(let[n,r]of Object.entries(t.lib.materials))this.addMaterial(n,r.asset);for(let[n,r]of Object.entries(t.materials))this.addMaterial(n,r);for(let[n,r]of Object.entries(t.audios))this.addAudio(n,r);for(let[n,r]of Object.entries(t.particles))this.addParticle(n,r);for(let[n,r]of Object.entries(t.fonts))this.addFont(n,r)}addMaterial(t,e){if(e.layers===void 0&&(e={...e,layers:Vi.defaultTwoLayerData("phong").layers}),this.materials[t]){let i=this.materials[t];i.reset(e,this.thisContext),i.dispose()}else{let i=mL(e,this.thisContext,t);this.materials[t]=i}}deleteMaterial(t){this.materials[t]&&(this.materials[t].nodeMaterialDispose(),delete this.materials[t])}getMaterial(t){return this.materials[t]}getMaterialOrDeletedPlaceholder(t){return this.materials[t]??this.deletedMaterial}material(t){return typeof t=="string"?this.getMaterialOrDeletedPlaceholder(t):t==null?(console.error("material is undefined or null"),this.deletedMaterial):(t.layers===void 0&&(t={...t,layers:Vi.defaultTwoLayerData("phong").layers}),T6(t,this.thisContext))}getMaterials(){return this.materials}addImage(t,e){return this.images[t]?(this.onColorOrImageUpdate&&this.onColorOrImageUpdate(),this.images[t].updateSrc(e.data),!0):(this.images[t]=new Ko(e,this),!1)}deleteImage(t){let e=this.images[t];e&&(e.dispose(),delete this.images[t])}getDefaultImage(){return this.images.image_0}getImage(t){return this.images[t]??this.deletedImage}image(t){return typeof t=="string"?this.getImage(t):this.imageHolderCache.load(t)}addUIBuffer(t,e){return this.uiBuffers[t]?(this.onColorOrImageUpdate&&this.onColorOrImageUpdate(),this.uiBuffers[t].updateSrc(e),!0):(this.uiBuffers[t]=new Ko(e,this),!1)}uiBuffer(t){return this.uiBuffers[t]}getEntityTexture(t,e={}){let i=t.material;if(!i)return null;for(let n of Array.isArray(i)?i:[i]){let r=n.root??n;for(let s of r?.data?.layers??[]){let a=s?.data;if(a?.type!=="texture"&&a?.type!=="matcap"||e.layer!==void 0&&s.id!==e.layer&&a.type!==e.layer)continue;let o=a.texture?.image;if(o==null)continue;let l=(typeof o=="string"?this.uiBuffer(o):void 0)??this.image(o);if(!l)continue;let c=l.getTexture(a.texture.wrapping??(a.type==="texture"?1e3:1001),a.texture.minFilter??1008,a.texture.magFilter??1006),h=l.img;return{texture:c,width:h?.width??0,height:h?.height??0,layerId:s.id,layerType:a.type}}}return null}addVideo(t,e){return this.videos[t]?(this.videos[t].updateSrc(e.data),!0):(this.videos[t]=new Ko(e,this),!1)}deleteVideo(t){let e=this.videos[t];e&&(e.dispose(),delete this.videos[t])}getVideo(t){return this.videos[t]??this.deletedVideo}video(t){return typeof t=="string"?this.getVideo(t):this.imageHolderCache.load(t)}addColor(t,e){return this.colors[t]?(this.onColorOrImageUpdate&&this.onColorOrImageUpdate(),"a"in e?this.colors[t].setRGBA(e.r,e.g,e.b,e.a):this.colors[t].setRGBA(e.r,e.g,e.b,1),!0):(this.colors[t]=new Zg(e.r,e.g,e.b,"a"in e?e.a:1),!1)}updateColor(t,e){if(this.colors[t]){this.onColorOrImageUpdate&&this.onColorOrImageUpdate();let i=this.colors[t];return this.colors[t].r=e.r??i.r,this.colors[t].g=e.g??i.g,this.colors[t].b=e.b??i.b,this.colors[t].a=e.a??i.a,!0}return!1}deleteColor(t){this.colors[t]&&delete this.colors[t]}getColor(t){return this.colors[t]}getColorNames(){return Object.values(this.data.colors).map(t=>t.name)}getColorByName(t){for(let e in this.data.colors)if(this.data.colors[e].name===t)return{color:this.colors[e],id:e}}color(t){let e;if(typeof t!="string")return new yn(t.r,t.g,t.b,"a"in t?t.a:1);{let i=this.getColor(t);i?e=i:(console.warn("Tried to create color layer params with a color key that does not exist in the assets manager"),e=new yn(0,0,0,0))}return e}addAudio(t,e){this.audios[t]=e}getAudio(t){let e=this.audios[t];if(e instanceof Fu)return e;{let i=new Fu({src:e.data});return this.audios[t]=i,i}}addParticle(t,e){this.particles[t]=e}getParticle(t){return this.particles[t]}deleteParticle(t){this.particles[t]&&delete this.particles[t]}deleteAudio(t){let e=this.audios[t];e&&(e instanceof Fu&&e.dispose(),delete this.audios[t])}addFont(t,e){let i=_3;i!==null?(this.fonts[t]=new i(e),this.fonts[t].loadingPromise.then(()=>this.requestRender())):Gn("text","a font asset")}getFont(t){return this.fonts[t]}deleteFont(t){this.fonts[t]&&delete this.fonts[t]}dispose(){Object.keys(this.materials).forEach(t=>this.deleteMaterial(t)),this._requestRender=void 0,Object.values(this.audios).forEach(t=>{t instanceof Fu&&t.dispose()}),this.audios={},this.particles={},this.geometryCache.dispose(),this.geometryCache2.dispose()}addVariableHolder(t,e){if(this.variables[t]===void 0){let i=e.value;if(this.enableLocalStorageForPersistentVariables&&e.persistent){let n=localStorage.getItem(yT(t));i=n!==null?JSON.parse(n):e.value}return this.variables[t]={value:i,locations:[],persistent:e.persistent},"dynamicVariableType"in e&&(this.variables[t].dynamicVariablePlayState="Playing",this.variables[t].dynamicVariableToggleIsForward=void 0),!0}return this.variables[t].value=e.value,!1}resetDynamicVariablePlayState(){for(let t in this.variables)this.variables[t].dynamicVariablePlayState!==void 0&&(this.variables[t].dynamicVariablePlayState="Playing",this.variables[t].dynamicVariableToggleIsForward=void 0)}updateVariableHolder(t,e){this.updateVariable(t,e.value)}updateVariable(t,e){if(this.variables[t]===void 0)return!1;this.variables[t].value=e,this.enableLocalStorageForPersistentVariables&&this.variables[t].persistent&&localStorage.setItem(yT(t),JSON.stringify(e));let i=e;for(;typeof i=="string";)i=this.variables[i].value;let n=this.entityOpContext.scene,r=!1;for(let s=this.variables[t].locations.length-1;s>=0;s--){let a=this.variables[t].locations[s];if(a[0]==="material"){let o=a[1],l=i,c={scene:n,shared:this},h=a.slice(2);n.traverseMaterial(u=>{let p=u.root??u;p.uuid===o&&p.onVariableUpdate(h,l,c)});let d=this.materials[o];d&&d.onVariableUpdate(h,l,c)}else{let o=n.find(a[0]);if(o===void 0){this.variables[t].locations.splice(s,1);continue}if(r=!0,a[1]!=="geometry"&&a[1]!=="particles"){for(let l=1;l<a.length-1;l++)o=o[a[l]];a[1]==="rotation"?o[a[a.length-1]]=i*Ot.DEG2RAD:o[a[a.length-1]]=i}if(o=n.find(a[0]),o.type==="ParticleEmitter"&&o.updateVariableState(i,a),Be.is(o))if(a[1]==="position"||a[1]==="rotation"||a[1]==="scale")o.onVariableUpdate();else if(a[1]==="geometry"){let l=o;o.component&&(l=o.component);let c=l.dataPatched;l.chooseGeoemtryCache(this).forceDelete(c.geometry),l.createGeometryDelayed(this.entityOpContext),l.onVariableUpdate(!0),l.invalidateDownstreamBooleanData(),l.instances.forEach(h=>{let d=h.dataPatched;h.chooseGeoemtryCache(this).forceDelete(d.geometry),h.createGeometryDelayed(this.entityOpContext),h.onVariableUpdate(!0),h.invalidateDownstreamBooleanData()})}else a[1]==="morphTargetInfluences"&&o.updateMorphInfluences(a[2],i)}}return r&&n.markShadowsDirty(),this.requestRender(),!0}updateEntityGeometryParams(t,e){let i=t;if(i.component&&(i=i.component),typeof i.chooseGeoemtryCache!="function")return!1;let n=i.dataPatched,r=n?.geometry;if(!r||typeof r.type!="string"||r.type==="VectorGeometry"||r.type==="PathGeometry")return!1;let s=c=>c.toLowerCase().replace(/[\s_.-]+/g,""),a=new Map;for(let c of Object.keys(r))a.set(s(c),c);let o={};for(let[c,h]of Object.entries(e??{})){let d=a.get(s(c));if(d===void 0||d==="type"||d==="font"||d==="shape"||d==="path"||d==="data")continue;if(d==="text"){(typeof h=="string"||typeof h=="number")&&(o[d]={textValue:String(h)});continue}let u=r[d];typeof h=="number"&&isFinite(h)&&(typeof u=="number"||typeof u=="string")&&(o[d]=h)}if(Object.keys(o).length===0)return!1;let l={...r,...o};return i.dataPatched={...n,geometry:l},this.transientGeometryKeys.has(r)&&i.chooseGeoemtryCache(this).forceDelete(n.geometry),this.transientGeometryKeys.add(l),i.createGeometryDelayed(this.entityOpContext),i.onVariableUpdate(!0),i.invalidateDownstreamBooleanData(),this.entityOpContext.scene.markShadowsDirty(),this.requestRender(),!0}resetEntityGeometryParams(t){let e=t;if(e.component&&(e=e.component),typeof e.chooseGeoemtryCache!="function")return!1;let i=e.dataPatched?.geometry;return!(!i||!this.transientGeometryKeys.has(i)||(e.dataPatched=e.data,e.chooseGeoemtryCache(this).forceDelete(i),e.createGeometryDelayed(this.entityOpContext),e.onVariableUpdate(!0),e.invalidateDownstreamBooleanData(),this.entityOpContext.scene.markShadowsDirty(),this.requestRender(),0))}updateEntityGeometryVertices(t,e){let i=t;if(i.component&&(i=i.component),typeof i.chooseGeoemtryCache!="function")return!1;let n=i.dataPatched,r=n?.geometry;if(!r||r.type!=="NonParametricGeometry")return!1;let s=e?.vertices;if(s===void 0||typeof s.length!="number"||s.length<9||s.length%3!=0||s.length/3>SL.MAX_TRANSIENT_VERTICES)return!1;let a,o,l,c=s instanceof Float32Array?s:Float32Array.from(s),h=c.length/3;if(e.normals!==void 0){if(e.normals.length!==c.length)return!1;a=e.normals instanceof Float32Array?e.normals:Float32Array.from(e.normals)}if(e.uvs!==void 0){if(e.uvs.length!==2*h)return!1;o=e.uvs instanceof Float32Array?e.uvs:Float32Array.from(e.uvs)}if(e.indices!==void 0){let x=h>65535?Uint32Array.from(e.indices):Uint16Array.from(e.indices);if(x.length===0||x.length%3!=0)return!1;for(let w=0;w<x.length;w++)if(x[w]>=h)return!1;l={array:x,itemSize:1,type:x.constructor.name,normalized:!1}}else{let x=r.data,w=x?.index;if(w?.array?.length){let S=(x?.attributes?.position?.array?.length??0)/3;if(h!==S)return function(E,A){let P=`${E}/${A}`;_2.has(P)||(_2.add(P),console.warn(`[spline] updateObject: ignoring a geometry update of ${E} vertices for a mesh that holds ${A}. Without \`indices\` the write is taken as a morph of the mesh's own vertices, which only means anything at the same count \u2014 send \`indices\` alongside \`vertices\` to replace the topology too.`))}(h,S),!1;l=w}}let d=1/0,u=1/0,p=1/0,f=-1/0,g=-1/0,m=-1/0;for(let x=0;x<c.length;x+=3){let w=c[x],S=c[x+1],E=c[x+2];w<d&&(d=w),w>f&&(f=w),S<u&&(u=S),S>g&&(g=S),E<p&&(p=E),E>m&&(m=E)}let v=(x,w)=>({array:x,itemSize:w,type:"Float32Array",normalized:!1}),y={position:v(c,3)};a&&(y.normal=v(a,3)),o&&(y.uv=v(o,2));let _={...r,width:f-d,height:g-u,depth:m-p,data:{attributes:y,...l?{index:l}:{}}},b=this.transientGeometryKeys.has(r);return i.dataPatched={...n,geometry:_},this.transientGeometryKeys.add(_),i.applyTransientGeometryData(this.entityOpContext,b),i.onVariableUpdate(!0),i.invalidateDownstreamBooleanData(),this.entityOpContext.scene.markShadowsDirty(),this.requestRender(),!0}setEntityInstanceTransforms(t,e){let i=t;i.component&&(i=i.component);let n=i.cloner;if(n===void 0)return-1;let r=n.children,s=Math.PI/180,a=!1;if(e===null)for(let o of r)o.transformOverride!==void 0&&(o.transformOverride=void 0,a=!0);else{if(!Array.isArray(e))return r.length;{let o=Math.min(e.length,r.length);for(let l=0;l<o;l++){let c=e[l],h=r[l];if(c==null){h.transformOverride!==void 0&&(h.transformOverride=void 0,a=!0);continue}let d=h.transformOverride??{position:[h.position.x,h.position.y,h.position.z],rotation:[h.rotation.x,h.rotation.y,h.rotation.z],scale:[h.scale.x,h.scale.y,h.scale.z]};c.position&&(typeof c.position.x=="number"&&(d.position[0]=c.position.x),typeof c.position.y=="number"&&(d.position[1]=c.position.y),typeof c.position.z=="number"&&(d.position[2]=c.position.z)),c.rotation&&(typeof c.rotation.x=="number"&&(d.rotation[0]=c.rotation.x*s),typeof c.rotation.y=="number"&&(d.rotation[1]=c.rotation.y*s),typeof c.rotation.z=="number"&&(d.rotation[2]=c.rotation.z*s)),c.scale&&(typeof c.scale.x=="number"&&(d.scale[0]=c.scale.x),typeof c.scale.y=="number"&&(d.scale[1]=c.scale.y),typeof c.scale.z=="number"&&(d.scale[2]=c.scale.z)),h.transformOverride=d,h.position.fromArray(d.position),h.rotation.fromArray(d.rotation),h.scale.fromArray(d.scale),h.updateMatrix(),h.hasNonUniformScale&&(h.updateMatrixWorld(),h.updateMatrixWorldRigid())}}}return a?n.update(this.entityOpContext):n.syncInstanceMatrices(),n.invalidateTransform(i),this.entityOpContext.scene.markShadowsDirty(),this.requestRender(),r.length}spawnRuntimeClone(t,e={}){if(typeof t.entityChildren!="function")return;let i=t.parent;if(i===null)return;let n=new _s(t);n.playModeVisible=e.visible!==!1,n.expand(),typeof e.name=="string"&&(n.name=e.name);let r=Math.PI/180;return n.position.copy(t.position),n.rotation.copy(t.rotation),n.scale.copy(t.scale),n.hiddenMatrix.copy(t.hiddenMatrix),e.position&&(typeof e.position.x=="number"&&(n.position.x=e.position.x),typeof e.position.y=="number"&&(n.position.y=e.position.y),typeof e.position.z=="number"&&(n.position.z=e.position.z)),e.rotation&&(typeof e.rotation.x=="number"&&(n.rotation.x=e.rotation.x*r),typeof e.rotation.y=="number"&&(n.rotation.y=e.rotation.y*r),typeof e.rotation.z=="number"&&(n.rotation.z=e.rotation.z*r)),e.scale&&(typeof e.scale.x=="number"&&(n.scale.x=e.scale.x),typeof e.scale.y=="number"&&(n.scale.y=e.scale.y),typeof e.scale.z=="number"&&(n.scale.z=e.scale.z)),n.updateMatrix(),i.add(n),n.updateWorldMatrix(!0,!0),this.entityOpContext.scene.markShadowsDirty(),this.requestRender(),n}destroyRuntimeClone(t){t.removeFromParent(),this.entityOpContext.scene.markShadowsDirty(),this.requestRender()}updateEntityMaterialParams(t,e){let i=t.material;if(!i)return!1;let n=[];for(let c of Array.isArray(i)?i:[i]){let h=c.root??c;h&&Array.isArray(h.layers)&&h.data&&!n.includes(h)&&n.push(h)}if(n.length===0)return!1;let r={scene:this.entityOpContext.scene,shared:this},s=c=>c.toLowerCase().replace(/[\s_.-]+/g,""),a=c=>{if(typeof c=="string"){let h=new yn(1,1,1,1);try{h.set(c)}catch{return null}return{r:h.r,g:h.g,b:h.b,a:void 0}}if(c&&typeof c=="object"&&"r"in c){let h=c;if([h.r,h.g,h.b].some(u=>typeof u!="number"||!isFinite(u)))return null;let d=Math.max(h.r,h.g,h.b)>1?1/255:1;return{r:h.r*d,g:h.g*d,b:h.b*d,a:typeof h.a=="number"?Math.max(0,Math.min(h.a,1)):void 0}}return null},o=(c,h,d)=>{if(!c.hasValue(h))return!1;let u=c.getValue(h);if(!u||typeof u!="object"||!u.isColor)return!1;let p=d.a??(typeof u.a=="number"?u.a:1);return u instanceof Zg?c.setValue(h,new yn(d.r,d.g,d.b,p)):typeof u.setRGBA=="function"?u.setRGBA(d.r,d.g,d.b,p):u.setRGB(d.r,d.g,d.b),!0},l=!1;for(let c of n){let h=c.data.layers??[],d=u=>c.layers.find(p=>p.uuid===u);if(e.color!==void 0){let u=a(e.color),p=h.find(g=>g.data.type==="color"),f=p&&d(p.id);if(u&&f&&o(f,"color",u)&&(l=!0,u.a!==void 0)){let g=u.a<1||Oc(c.data,this);c.setTransparent?c.setTransparent(g,r.scene):c.transparent=g}}typeof e.alpha=="number"&&isFinite(e.alpha)&&(c.onVariableUpdate?.(["alphaOverride"],Math.max(0,Math.min(e.alpha,100)),r),l=!0);for(let u of e.layers??[]){if(!u||typeof u!="object")continue;let p=typeof u.id=="string"?h.find(v=>v.id===u.id):typeof u.index=="number"?h[u.index]:typeof u.type=="string"?h.find(v=>v.data.type===u.type):void 0,f=p&&d(p.id);if(!p||!f)continue;let g=Ex[p.data.type]??[],m=Object.keys(p.data);for(let[v,y]of Object.entries(u)){if(v==="id"||v==="index"||v==="type")continue;let _=m.find(x=>x===v)??m.find(x=>s(x)===s(v))??v;if(g.includes(_))continue;let b=a(y);if(b&&o(f,_,b))l=!0;else if(typeof y=="number"&&isFinite(y))c.onVariableUpdate?.(["layer",p.id,_],y,r),l=!0;else if(Array.isArray(y)&&y.length<=3&&y.every(x=>typeof x=="number"&&isFinite(x))){let x=["x","y","z"];y.forEach((w,S)=>{c.onVariableUpdate?.(["layer",p.id,_,x[S]],w,r)}),l=!0}}}}return l&&this.requestRender(),l}deleteVariable(t){this.variables[t]&&delete this.variables[t]}getVariable(t,e){if(Array.isArray(t)){if(t[0]==="mouse")return this.mouseProperty?.[t[1]]??0;if(t[0]==="raycast")return this.raycastProperty?.[t[1]]??0;let i=this.entityOpContext.scene.find(t[0]);if(t[1]==="width"||t[1]==="height"||t[1]==="depth")return i.geometry.userData.parameters[t[1]];if((t[1]==="position"||t[1]==="rotation")&&t.length>2&&i?.getPhysicsLocalMatrix?.(m2))return m2.decompose(g2,v2,xL),t[1]==="position"?g2[t[2]]:(y2.setFromQuaternion(v2,i.rotation.order),y2[t[2]]*Ot.RAD2DEG);for(let n=1;n<t.length;n++)i=i[t[n]];return t[1]==="rotation"&&(i*=Ot.RAD2DEG),i}for(let i in this.variables){if(e===void 0)break;let n=this.variables[i],r=n.locations?.findIndex(s=>jn.equal(s,e));r!==void 0&&r!==-1&&n.locations.splice(r,1)}if(typeof t=="string"){let i=t,n=t;do{if(n=i,this.variables[i]===void 0)break;let r=this.variables[i].value;e&&this.variables[n]!==void 0&&this.variables[n].locations.push(e),i=r}while(typeof i=="string");return i}return t}getVariables(){return this.variables}getVariablesNames(){return this.data.variables.map(t=>t.data.name)}getVariableByName(t){for(let e of this.data.variables)if(e.data.name===t)return{variable:e.data,id:e.id}}getDynamicVariablePlayState(t){return this.variables[t]?.dynamicVariablePlayState}setDynamicVariablePlayState(t,e){this.variables[t]!==void 0&&(this.variables[t].dynamicVariablePlayState=e)}getDynamicVariableToggleIsForward(t){return this.variables[t]?.dynamicVariableToggleIsForward}setDynamicVariableToggleIsForward(t,e){this.variables[t]!==void 0&&(this.variables[t].dynamicVariableToggleIsForward=e)}resetLib(t){for(let[e,i]of Object.entries(t.images))this.addImage(e,i.asset);for(let[e,i]of Object.entries(t.audios))this.addAudio(e,i.asset);for(let[e,i]of Object.entries(t.particles))this.addParticle(e,i.asset);for(let[e,i]of Object.entries(t.colors))this.addColor(e,i.asset);for(let[e,i]of Object.entries(t.fonts))this.addFont(e,i.asset);for(let[e,i]of Object.entries(t.videos))this.addVideo(e,i.asset);for(let[e,i]of Object.entries(t.variables))this.addVariableHolder(e,i.asset)}updateLibByOp(t,e){t.path[0]==="images"?t.path.length===1&&t.type===1?this.addImage(t.id,t.data.asset):t.path.length===1&&t.type===2&&this.deleteImage(t.id):t.path[0]==="videos"?t.path.length===1&&t.type===1?this.addVideo(t.id,t.data.asset):t.path.length===1&&t.type===2&&this.deleteVideo(t.id):t.path[0]==="audios"?t.path.length===1&&t.type===1?this.addAudio(t.id,t.data.asset):t.path.length===1&&t.type===2&&this.deleteAudio(t.id):t.path[0]==="particles"?t.path.length===1&&t.type===1?this.addParticle(t.id,t.data.asset):t.path.length===1&&t.type===2&&this.deleteParticle(t.id):t.path[0]==="colors"?t.path.length===1&&t.type===1?this.addColor(t.id,t.data.asset):t.path.length===1&&t.type===2&&this.deleteColor(t.id):t.path[0]==="materials"?t.path.length===1&&t.type===1?this.addMaterial(t.id,t.data.asset):t.path.length===1&&t.type===2&&this.deleteMaterial(t.id):t.path[0]==="fonts"?t.path.length===1&&t.type===1?this.addFont(t.id,t.data.asset):t.path.length===1&&t.type===2&&this.deleteFont(t.id):t.path[0]==="variables"?t.path.length===1&&t.type===1?this.addVariableHolder(t.id,t.data.asset):t.path.length===1&&t.type===2&&this.deleteVariable(t.id):t.path[0]==="components"&&e.updateByLibOp(t,this)}updateByOp(t,e,i){if(this.data=e,t.path[0]==="images")t.path.length===2&&t.type===0?t.props.data&&this.getImage(t.path[1]).updateSrc(t.props.data):t.path.length===1&&t.type===1?this.addImage(t.id,t.data):t.path.length===1&&t.type===2&&this.deleteImage(t.id);else if(t.path[0]==="videos")t.path.length===2&&t.type===0?t.props.data&&this.getVideo(t.path[1]).updateSrc(t.props.data):t.path.length===1&&t.type===1?this.addVideo(t.id,t.data):t.path.length===1&&t.type===2&&this.deleteVideo(t.id);else if(t.path[0]==="audios")t.path.length===2&&t.type===0?t.props.data&&this.addAudio(t.path[1],e.audios[t.path[1]]):t.path.length===1&&t.type===1?this.addAudio(t.id,t.data):t.path.length===1&&t.type===2&&this.deleteAudio(t.id);else if(t.path[0]==="particles")t.path.length===2&&t.type===0?t.props.data&&this.addParticle(t.path[1],e.particles[t.path[1]]):t.path.length===1&&t.type===1?this.addParticle(t.id,t.data):t.path.length===1&&t.type===2&&this.deleteParticle(t.id);else if(t.path[0]==="colors")t.path.length===2&&t.type===0?this.updateColor(t.path[1],t.props):t.path.length===1&&t.type===1?this.addColor(t.id,t.data):t.path.length===1&&t.type===2&&this.deleteColor(t.id);else if(t.path[0]==="materials")t.path.length===1&&t.type===1?this.addMaterial(t.id,t.data):t.path.length===1&&t.type===2?this.deleteMaterial(t.id):t.path.length>1&&this.getMaterial(t.path[1]).updateByOp(er.drop(t,2),e.materials[t.path[1]],{shared:this,scene:i});else if(t.path[0]==="fonts")t.path.length===2&&t.type===0?this.updateFont(t.path[1],t,i):t.path.length===1&&t.type===1?this.addFont(t.id,t.data):t.path.length===1&&t.type===2&&this.deleteFont(t.id);else if(t.path[0]==="variables")t.path.length===2&&t.type===0?"value"in t.props?this.updateVariable(t.path[1],t.props.value):"persistent"in t.props&&(this.variables[t.path[1]].persistent=t.props.persistent):t.path.length===1&&t.type===4?this.addVariableHolder(t.id,t.data):t.path.length===1&&t.type===5&&this.deleteVariable(t.id);else if(t.path[0]==="userAPIs"){if(t.path.length===1&&t.type===1)this.addUserAPI(t.id,t.data);else if(t.path.length===1&&t.type===2)this.deleteUserAPI(t.id);else if(typeof t.path[1]=="string"){let n=e.userAPIs[t.path[1]];if(n){let r=t.type===0&&t.props.debounce===void 0,s=this.getUserAPI(t.path[1]);s!==void 0&&s===this.openAIRealtime?s.update(n):s?.update(n,this,r)}}}else if(t.path[0]==="userWebhooks"){if(t.path.length===1&&t.type===1)this.addUserWebhook(t.id,t.data);else if(t.path.length===1&&t.type===2)this.deleteUserWebhook(t.id);else if(typeof t.path[1]=="string"){let n=e.userWebhooks[t.path[1]];n&&this.getUserWebhook(t.path[1])?.update(n)}}else t.path[0]==="lib"&&this.updateLibByOp(er.drop(t,1),i)}updateFont(t,e,i){if(e.props.url){let n=this.getFont(t),r={...this.data.fonts[t],url:e.props.url};n.update(r),n.loadingPromise.then(()=>this.requestRender()),i.updateFont(t,this)}}addUserAPI(t,e){if(this.userAPIs[t])return this.userAPIs[t].update(e,this),!0;if(this.openAIRealtime?.id===t)return this.openAIRealtime.update(e),!0;if(e.integration?.type==="VoiceAssistant"){let i=O3;return i===null?(Gn("ai-assistant","a voice-assistant integration"),!1):(this.openAIRealtime=i(e,t,this),!1)}{let i=bL();return i===null?(Gn("api-services","a user API integration"),!1):(this.userAPIs[t]=i.createUserAPI(t,e,this),!1)}}getUserAPI(t){return this.openAIRealtime?.id===t?this.openAIRealtime:this.userAPIs[t]}getUserAPIs(){return this.userAPIs}deleteUserAPI(t){let e=this.userAPIs[t];e&&(e.dispose(),delete this.userAPIs[t])}addUserWebhook(t,e){if(this.userWebhooks[t])return this.userWebhooks[t].update(e),!0;{let i=bL();return i===null?(Gn("api-services","a user webhook"),!1):(this.userWebhooks[t]=i.createUserWebhook(t,e),!1)}}getUserWebhook(t){return this.userWebhooks[t]}getUserWebhooks(){return this.userWebhooks}deleteUserWebhook(t){let e=this.userWebhooks[t];e&&(e.dispose(),delete this.userWebhooks[t])}get scene(){return this.entityOpContext.scene}}).MAX_TRANSIENT_VERTICES=6e4,new Mb(Ns.emptyData())});function R6(t){return mb(t)||t?.isTSLNodeMaterial===!0}var Wr,b2,x2,w2,ML,S2,Po,EL,AL,Wf,Ai,I6=z(()=>{m3()}),rd=z(()=>{$t(),Kn(),Mh(),I6(),Ye(),Dn(),Wr=class extends Yi{setMaterialOverride(t,e){this.materialOverride=gL(t),this.material!==this.shadowCatcherMaterial&&(this.disposeMaterial(),this.material=this.materialOverride,this.layers.set(0),this.syncShapeBlendNodeLayer(),e.scene.markNeedsUpdateRendererDirty())}updateByPatchedOp(t,e,i){if(super.updateByPatchedOp(t,e,i),ri(t.path,["geometry"])&&this.syncShadowCatcher(i),function(n,r){let s=[];if(r.length!==n.length)return null;{let a=0;for(;a<n.length;){if(r[a]==="*")s.push(n[a]);else if(n[a]!==r[a])return null;a+=1}}return s}(t.path,["materials"])!==null&&t.type===0&&Array.isArray(this.material))for(let[n,r]of Object.entries(t.props)){let s=this.material[Number(n)],a=i.shared.material(r);a!==s&&Wr.disposeOneMaterial(s),this.material[Number(n)]=a}else if(ri(t.path,["material"])){let n=this.material;!Array.isArray(n)&&typeof n?.updateByOp=="function"&&"material"in e&&typeof e.material!="string"&&n.updateByOp(er.drop(t,1),e.material,i)}else if(ri(t.path,["materials","*"])&&Array.isArray(this.material)){let n=t.path[1];if("materials"in e&&n<this.material.length){let r=e.materials[n];typeof r!="string"&&this.material[n].updateByOp(er.drop(t,2),r,i)}}}get needsAO(){return this.material!==void 0&&(Array.isArray(this.material)?this.material[0]:this.material).hasAO}syncShapeBlendNodeLayer(){this.dataPatched.type==="Mesh"&&this.dataPatched.geometry.shapeBlendNode?this.layers.set(9):512&this.layers.mask&&this.layers.set(0)}updateState(t,e){super.updateState(t,e),t.castShadow!==void 0&&(this.castShadow=t.castShadow),t.receiveShadow!==void 0&&(this.receiveShadow=t.receiveShadow);let i,n=this.dataPatched;this.syncShapeBlendNodeLayer(),this.dataPatched.type==="Mesh"&&this.dataPatched.geometry.type==="ShapeBlendGeometry"&&(i={resolutionLevel:Math.min(8,this.dataPatched.geometry.resolutionLevel),useChildrenColors:this.dataPatched.geometry.useChildrenColors});let r=this.materialOverride!==void 0;!r&&t.geometry?.type!=="NonParametricGeometry"&&"material"in t&&t.material!==void 0&&(this.disposeMaterial(),this.material=e.shared.material(t.material).getFlavor(n.flatShading,n.side,n.wireframe,i),e.scene.markNeedsUpdateRendererDirty()),!r&&(t.geometry?.type==="NonParametricGeometry"||"materials"in t)&&("materials"in t&&t.materials!==void 0?(this.disposeMaterial(),this.material=t.materials.map(a=>e.shared.material(a).getFlavor(n.flatShading,n.side,n.wireframe)),e.scene.markNeedsUpdateRendererDirty()):"material"in t&&t.material!==void 0&&(this.disposeMaterial(),this.material=[e.shared.material(t.material).getFlavor(n.flatShading,n.side,n.wireframe)],e.scene.markNeedsUpdateRendererDirty()));let s=this.data;if(!r&&s.geometry?.type!=="NonParametricGeometry"&&"materials"in s&&s.materials!==void 0&&(this.disposeMaterial(),this.material=e.shared.material(s.materials[0]).getFlavor(n.flatShading,n.side,n.wireframe)),!r&&(t.flatShading!==void 0||t.wireframe!==void 0||t.side!==void 0))if(Array.isArray(this.material))for(let a=0;a<this.material.length;a++)this.material[a]=this.material[a].getFlavor(n.flatShading,n.side,n.wireframe);else this.material=this.material.getFlavor(n.flatShading,n.side,n.wireframe,i);this.syncShadowCatcher(e)}shadowCatcherActive(){let t=this.dataPatched,e=t.geometry?.type;return t.shadowCatcher===!0&&(e==="RectangleGeometry"||e==="PlaneGeometry")}syncShadowCatcher(t){let e=this.dataPatched;if(this.shadowCatcherActive()){if(this.shadowCatcherMaterial===void 0){let i=gT===void 0?null:gL(gT());if(i===null)return;this.shadowCatcherMaterial=i}this.shadowCatcherMaterial.side=e.side,this.material!==this.shadowCatcherMaterial&&(this.disposeMaterial(),this.material=this.shadowCatcherMaterial,t.scene.markNeedsUpdateRendererDirty()),this.castShadow=!1,this.receiveShadow=!0,this.layers.set(0)}else this.shadowCatcherMaterial!==void 0&&this.material===this.shadowCatcherMaterial&&(this.materialOverride!==void 0?(this.material=this.materialOverride,t.scene.markNeedsUpdateRendererDirty()):"material"in e&&e.material!==void 0&&(this.material=t.shared.material(e.material).getFlavor(e.flatShading,e.side,e.wireframe),t.scene.markNeedsUpdateRendererDirty(),this.needsAO&&this.layers.enable(5)),this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow)}static disposeOneMaterial(t){var e;R6(t)&&!function(i){return i?.isClassicSharedMaterial===!0}(e=t)&&e?.isTSLSharedMaterial!==!0&&t.nodeMaterialDispose()}disposeMaterial(){this.material&&tN(this.material).forEach(t=>{Wr.disposeOneMaterial(t)})}dispose(){this.disposeMaterial(),this.shadowCatcherMaterial?.dispose(),super.dispose()}}}),Xr=z(()=>{$t(),Ye(),B3(),rd(),tt(),Sx(),Ap(),Tp(),w6(),b2=new T,x2=new ve,w2=new ve,ML=new T,S2=new At,Po=new gi,EL=Po.geometry,AL=Po.material,Wf=new T,Ai=class extends Wr{constructor(t,e,i){super(t,e),this.data=e,this.isSkinnedMesh=!1,this.localGeometry=void 0,e.bindMode&&e.bindMatrix&&(this.bindMode=e.bindMode,this.bindMatrix=new At().fromArray(e.bindMatrix),this.bindMatrixInverse=new At)}chooseGeoemtryCache(t){return t.geometryCache}supportsInPlaceGeometryUpdate(t){return t.isTextGeometry!==!0}markGeometryAsReachable(t){this.geometryCreateDeleyed instanceof jt&&this.chooseGeoemtryCache(t).markAsReachable(this.dataPatched.geometry,this.geometryCreateDeleyed)}get builtSharedGeometry(){if(this.localGeometry===void 0)return this.geometryCreateDeleyed instanceof jt?this.geometryCreateDeleyed:void 0}get geometry(){if(this.localGeometry!==void 0)return this.localGeometry;if(this.geometryCreateDeleyed instanceof Mb){let t=this.geometryCreateDeleyed,e=this.chooseGeoemtryCache(t),i=this.dataPatched.geometry;this.geometryCreateDeleyed=e.get(i,t,this),this._geometryCacheKey=i}return this.geometryCreateDeleyed}set geometry(t){this.localGeometry=t}get is2DAndNoDepth(){let t=this.dataPatched.geometry;return ib.is2DParametricMesh(t.type)&&t.depth===0}get is2DType(){return ib.is2DParametricMesh(this.geometry.userData.type)}get isTextType(){return this.geometry.isTextGeometry===!0}get isNonParametric(){return this.geometry.userData.type==="NonParametricGeometry"}updateByPatchedOp(t,e,i){super.updateByPatchedOp(t,e,i),ri(t.path,["geometry"])&&this.updateByPatchedOpGeometry(er.drop(t,1),e.geometry,i)}removeInteractionGeometry(t){this.localGeometry?.dispose(),this.localGeometry=void 0}dispose(){var t;super.dispose(),t=this.uuid,bb.delete(t),this._posed=void 0}get appliedGeometrySize(){let t=this.localGeometry?.userData;if(t!==void 0&&t.sxPrev!==void 0)return[t.sxPrev,t.syPrev,t.szPrev]}updateGeometryInteractions(t,e){this.invalidateDownstreamBooleanData();let i=this.data.geometry.type;if(i==="NonParametricGeometry"||i==="SubdivGeometry"){let n,r,s,a=t;if(this.localGeometry===void 0){let d={...this.data.geometry,...a};this.localGeometry=nh(d,e,this.data.flatShading,this)}a.scaleBaked?[n,r,s]=a.scaleBaked:{width:n,height:r,depth:s}=a;let o=this.localGeometry.userData,l=typeof n=="number"?n:1,c=typeof r=="number"?r:1,h=typeof s=="number"?s:1;o.sxPrev!==void 0&&cT(this.localGeometry.attributes,l/o.sxPrev,c/o.syPrev,h/o.szPrev),o.sxPrev=l,o.syPrev=c,o.szPrev=h}else if(!this.absorbDepthInteraction(t)){let n=nh({...this.data.geometry,...t},e,this.data.flatShading,this);this.localGeometry!==void 0&&this.supportsInPlaceGeometryUpdate(this.localGeometry)&&c2(this.localGeometry,n)?n.dispose():(this.localGeometry?.dispose(),this.localGeometry=n)}}absorbDepthInteraction(t){let e=this.localGeometry;if(e?.shiftDepthTo===void 0)return!1;let i=t;if(typeof i.depth!="number")return!1;let n=e.userData?.parameters;if(n===void 0)return!1;for(let r of Object.keys(i))if(r!=="depth"&&i[r]!==n[r])return!1;return!!e.shiftDepthTo(i.depth)&&(n.depth=i.depth,!0)}refreshAttachedClonersInteractions(t){for(let e of this.attachedSurfaceCloners)e.update(t)}refreshAttachedCloners(t){for(let e of this.attachedSurfaceCloners)t.scene.addPendingUpdateCloner(e.object)}refreshAttachedPaths(t){for(let e of this.attachedPaths)t.scene.addPendingCommand(()=>e.updateShape())}createGeometryDelayed(t){this.geometryCreateDeleyed=t.shared,this.refreshAttachedCloners(t),this.refreshAttachedPaths(t)}updateByPatchedOpGeometry(t,e,i){let n=!1;if(t.type===0&&t.path.length===0&&Object.keys(t.props).includes("scaleBaked")&&this.geometryCreateDeleyed instanceof Ni&&this.chooseGeoemtryCache(i.shared).mutateIfUnique(this.geometryCreateDeleyed.data,e)===this.geometryCreateDeleyed&&(n=!0,this.geometryCreateDeleyed.mutateDirectlyScaleBaked(e,t.props.scaleBaked),this.refreshAttachedCloners(i),this.refreshAttachedPaths(i)),!n&&t.type===0&&t.path.length===0&&S6(t.props)&&this.geometryCreateDeleyed instanceof Ni&&this.chooseGeoemtryCache(i.shared).mutateIfUnique(this.geometryCreateDeleyed.data,e)===this.geometryCreateDeleyed&&(n=!0,this.geometryCreateDeleyed.mutateDirectlySubdivisions(e),this.refreshAttachedCloners(i),this.refreshAttachedPaths(i)),!n&&t.type===0&&t.path.length===0&&this.geometryCreateDeleyed instanceof jt&&!(this.geometryCreateDeleyed instanceof Ni)&&this.supportsInPlaceGeometryUpdate(this.geometryCreateDeleyed)&&this._geometryCacheKey!==void 0){let r=i.shared,s=this.chooseGeoemtryCache(r),a=this.geometryCreateDeleyed;if(s.getCached(this._geometryCacheKey)===a&&a.isShared!==!0){let o=this.dataPatched.geometry,l=nh(o,r,this.data.flatShading,this);c2(a,l)?(l.dispose(),a.computeBoundingSphere(),s.mutateIfUnique(this._geometryCacheKey,o)):(l.computeBoundingSphere(),s.forceDelete(this._geometryCacheKey),s.adopt(o,l),this.geometryCreateDeleyed=l),this._geometryCacheKey=o,n=!0,this.refreshAttachedCloners(i),this.refreshAttachedPaths(i)}}n||(i.scene?.markGeometryCacheDirty(),this.createGeometryDelayed(i)),this.syncShapeBlendNodeLayer(),this.resetBBoxNeedsUpdate(),this.invalidateDownstreamBooleanData()}updateGeometryOnStateUpdate(t,e){this.createGeometryDelayed(e)}applyTransientGeometryData(t,e){let i=t.shared,n=this.dataPatched.geometry;if(this.geometryCreateDeleyed instanceof jt&&!(this.geometryCreateDeleyed instanceof Ni)&&this.supportsInPlaceGeometryUpdate(this.geometryCreateDeleyed)&&this._geometryCacheKey!==void 0){let r=this.chooseGeoemtryCache(i),s=this.geometryCreateDeleyed;if(r.getCached(this._geometryCacheKey)===s&&s.isShared!==!0){let a=nh(n,i,this.data.flatShading,this);return c2(s,a)?(a.dispose(),s.computeBoundingSphere(),r.mutateIfUnique(this._geometryCacheKey,n)):(a.computeBoundingSphere(),r.forceDelete(this._geometryCacheKey),r.adopt(n,a),this.geometryCreateDeleyed=a),this._geometryCacheKey=n,this.refreshAttachedCloners(t),void this.refreshAttachedPaths(t)}}e&&this._geometryCacheKey!==void 0&&this.chooseGeoemtryCache(i).forceDelete(this._geometryCacheKey),t.scene?.markGeometryCacheDirty(),this.createGeometryDelayed(t)}updateState(t,e){t.geometry!==void 0&&this.updateGeometryOnStateUpdate(t.geometry,e);let i=t.morphTargetInfluences;if(i){this.updateMorphTargets(),this.geometry.morphTargetsRelative=!0;for(let{data:{name:n,value:r}}of i)this.updateMorphInfluences(n,e.shared.getVariable(r,[this.uuid,"morphTargetInfluences",n]))}super.updateState(t,e)}updateMorphInfluences(t,e){if(this.morphTargetDictionary===void 0)return;let i=this.morphTargetDictionary[t];i!==void 0&&(this.morphTargetInfluences[i]=e)}updateGeometryGroupsIfNeeded(){Array.isArray(this.material)&&this.geometry.groups.length===0&&this.geometry.addGroup(0,Math.max(this.geometry.getIndex()?.count??0,this.geometry.getAttribute("position").count),0)}updateEntityBoxSize(t,e){let i=this.posedGeometry()?.boundingBox;if(i)return i.getCenter(t),void i.getSize(e).multiplyScalar(.5);let n=this.geometry.userData.parameters;this.is2DType||this.isTextType?t.set(0,0,.5*n.depth):this.isNonParametric?(t.setScalar(0),this.geometry.boundingSphere&&t.copy(this.geometry.boundingSphere.center),e.set(n.width,n.height,n.depth??0).multiplyScalar(.5)):n.centerOffset?t.fromArray(n.centerOffset):t.setScalar(0),e.set(n.width,n.height,n.depth??0).multiplyScalar(.5)}updateMatrixWorld(t){super.updateMatrixWorld(t),this.bindMode==="attached"?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode==="detached"&&this.bindMatrixInverse.copy(this.bindMatrix).invert()}bind(t,e){this.skeleton=t,this.isSkinnedMesh=!0,e===void 0&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),e=this.matrixWorld),this.bindMatrix.copy(e),this.bindMatrixInverse.copy(e).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(t){let e=new ve,i=this.geometry.attributes.skinWeight;for(let n=0,r=i.count;n<r;n++){e.fromBufferAttribute(i,n);let s=1/e.manhattanLength();s!==1/0?e.multiplyScalar(s):e.set(1,0,0,0),i.setXYZW(n,e.x,e.y,e.z,e.w)}}boneTransform(t,e){let i=this.skeleton;if(i===void 0)return;let n=this.geometry;x2.fromBufferAttribute(n.attributes.skinIndex,t),w2.fromBufferAttribute(n.attributes.skinWeight,t),b2.copy(e).applyMatrix4(this.bindMatrix),e.set(0,0,0);for(let r=0;r<4;r++){let s=w2.getComponent(r);if(s!==0){let a=x2.getComponent(r);S2.multiplyMatrices(i.bones[a].matrixWorld,i.boneInverses[a]),e.addScaledVector(ML.copy(b2).applyMatrix4(S2),s)}}return e.applyMatrix4(this.bindMatrixInverse)}raycastDeformed(t,e){let i=this.posedGeometry();if(i===void 0)return!1;Po.geometry=i,Po.material=this.material,Po.matrixWorld.copy(this.matrixWorld);let n=e.length;Po.raycast(t,e);for(let r=n;r<e.length;r++)e[r].object=this;return Po.geometry=EL,Po.material=AL,!0}posedGeometry(){let t=this.skeleton;if(!this.isSkinnedMesh||t===void 0)return;let e=this.geometry,{position:i,skinIndex:n,skinWeight:r}=e.attributes;if(!i||!n||!r)return;let s=[...this.bindMatrix.elements,...this.bindMatrixInverse.elements,...this.morphTargetInfluences??[]];for(let d=0;d<t.bones.length;d++){let u=t.bones[d];if(!u||!t.boneInverses[d])return;s.push(...u.matrixWorld.elements)}let a=this._posed;if(a?.source===e&&a.version===i.version&&a.pose.length===s.length&&a.pose.every((d,u)=>d===s[u]))return a.geometry;let o=i.count,l=a?.geometry.attributes.position,c=l?.count===o?l:new Ht(new Float32Array(3*o),3);for(let d=0;d<o;d++)this.boneTransform(d,this.getVertexPosition(d,Wf)),c.setXYZ(d,Wf.x,Wf.y,Wf.z);let h=new jt;h.setAttribute("position",c);for(let d of["normal","uv","uv1"]){let u=e.attributes[d];u&&h.setAttribute(d,u)}return h.setIndex(e.index),h.groups=e.groups,h.drawRange=e.drawRange,h.computeBoundingSphere(),h.computeBoundingBox(),this._posed={source:e,version:i.version,pose:s,geometry:h},h}}});function ep(t){if(Array.isArray(t.material)){for(let e of t.material)if(e.getLayersOfType("outline").length===0)return}else if(!mb(t.material)||t.material.getLayersOfType("outline").length===0)return;t instanceof Ai&&t.is2DAndNoDepth?function(e){if(e.geometry.attributes.extrudeNormals||!e.geometry.attributes.position)return;let i=e.geometry.attributes.position.array,n=new Float32Array(i.length),r=new T;for(let s=0;s<i.length;s+=3)r.set(i[s],i[s+1],i[s+2]).normalize(),n[s]=r.x,n[s+1]=r.y,n[s+2]=r.z;e.geometry.setAttribute("extrudeNormal",new Nt(n,3))}(t):function(e){if(e.geometry.attributes.extrudeNormal||!e.geometry.attributes.position||!e.geometry.attributes.normal)return;let i=new Map,n=e.geometry.attributes,r=n.position.array,s=n.normal.array,a=new Float32Array(r.length);for(let o=0;o<r.length;o+=3){let l=`${r[o]}_${r[o+1]}_${r[o+2]}`,c=new T(s[o],s[o+1],s[o+2]);i.has(l)?i.get(l)?.normals.push(c):i.set(l,{normals:[c],result:new T})}i.forEach((o,l)=>{for(let c of o.normals)o.result.add(c);o.result.divideScalar(o.normals.length)});for(let o=0;o<r.length;o+=3){let l=`${r[o]}_${r[o+1]}_${r[o+2]}`,c=i.get(l)?.result;c&&(a[o]=c.x,a[o+1]=c.y,a[o+2]=c.z)}e.geometry.setAttribute("extrudeNormal",new Nt(a,3))}(t)}function M2(t){return Math.min(2047,Math.max(1,Math.round(2048*t)))/2048}function ip(t){if(!t.geometry.attributes.position)return;let e=t.geometry.attributes,i=e.position.array,n=e.randomColor;if(n!==void 0&&3*n.count===i.length)return;let r=new Float32Array(i.length),s=parseInt(t.uuid.replace(/\D/g,"")),a=[M2(Ot.seededRandom(s)),M2(Ot.seededRandom(s+1e4)),M2(Ot.seededRandom(s+2e4))];for(let o=0;o<i.length;o++)r[o]=a[o%3];t.geometry.setAttribute("randomColor",new Ht(r,3))}var Ax=z(()=>{tt(),m3(),Xr()});function TL(t){let e=!1;return t.scene.objects.traverse((i,n)=>{n.geometry?.type==="BooleanGeometry"&&(e=!0)}),e}function tZ(t,e){let i=t.cloner;return i!==void 0&&i.parent===e?i:void 0}function CL(t,e,i,n){let r=16*(e.children.length+1);Hm.length<r&&(Hm=new Float32Array(r));let s=0,a=l=>{l.toArray(Hm,16*s),s++},o=e.parameters.hideBase!==!0;o&&a(n),_T.multiplyMatrices(t.hiddenMatrix,t.matrix);for(let l of e.children)!Cc(l)||l.playModeVisible===!1||(bT.multiplyMatrices(l.hiddenMatrix,l.matrix).multiply(l.pivotMatrix),U1.multiplyMatrices(_T,bT),(!o||!U1.equals(n))&&a(U1));try{return s===0?0:function(l,c){return p3(fb().instanced_union(u3(l),c))}(i,Hm.subarray(0,16*s))}finally{gk(i)}}var Do,PL,_T,bT,U1,Hm,uh,Eb,Tx,fa,eo,Ab,d0=z(()=>{Kn(),tt(),_x(),Ax(),rd(),Bi(),Do=new At,PL=new At,_T=new At,bT=new At,U1=new At,Hm=new Float32Array(0),uh=class extends Wr{constructor(t,e,i){super(t,e),this.data=e,this.meshSetAddresses=[],this.needsTransformForDownstream=!1,this.geometry=new jt,this.onAfterRender=(n,r,s,a,o,l)=>{super.onAfterRender(n,r,s,a,o,l),this.recomputeBoolean()},this.geometry.userData.parameters={width:0,height:0,depth:0}}get booleanOp(){return this.data.geometry.operation}get phongAngle(){return this.data.geometry.phongAngle??45}get isLOD(){return this.recomputeBoolean(),!1}updateByPatchedOp(t,e,i){super.updateByPatchedOp(t,e,i),t.path.length===1&&t.path[0]==="geometry"&&t.type===0&&t.props.operation!==void 0&&(this.freeBooleanPointer(),this.resetBBoxNeedsUpdate())}freeBooleanPointer(){super.freeBooleanPointer(),this.geometry.dispose()}recomputeBoolean(t,e=!0){if(this.booleanMeshSetAddress!==-1&&!t)return;for(let n=0;n<this.children.length;n++){let r=this.children[n];r instanceof uh&&r.dataPatched.visible===!0&&r.recomputeBoolean(t===!0,e)}this.meshSetAddresses=[];for(let n=0;n<this.children.length;n++){let r=this.children[n];if(r instanceof Yi&&r.dataPatched.visible===!0&&r.geometry.attributes.position?.count>0&&r.geometry.drawRange.count>0&&r.booleanMeshSetAddress!==0){Do.multiplyMatrices(r.hiddenMatrix,r.matrix).multiply(r.pivotMatrix);try{let s=tZ(r,this);if(r.booleanMeshSetAddress===-1){if((r.geometry.index??r.geometry.getAttribute("position")).count/3<15e5){let a=wY(r.geometry,t===!0);r.booleanMeshSetAddress=s===void 0||a===-1?a:CL(r,s,a,Do)}if(r.booleanMeshSetAddress===-1)return;s===void 0&&e2(r.booleanMeshSetAddress,Do),r.booleanMatrixInvOld.copy(Do).invert(),r.booleanWasTransformed=!1}else r instanceof uh&&r.needsTransformForDownstream===!0?(s===void 0?e2(r.booleanMeshSetAddress,Do):r.booleanMeshSetAddress=CL(r,s,r.booleanMeshSetAddress,Do),r.needsTransformForDownstream=!1):r.booleanWasTransformed===!0&&(e2(r.booleanMeshSetAddress,PL.multiplyMatrices(Do,r.booleanMatrixInvOld)),r.booleanMatrixInvOld.copy(Do).invert(),r.booleanWasTransformed=!1)}catch(s){console.error(s),r.booleanMeshSetAddress=0,r.geometry.userData.booleanOperationDidFail=!0;continue}if(r.booleanMeshSetAddress===0)continue;this.meshSetAddresses.push(r.booleanMeshSetAddress),r.geometry.userData.booleanOperationDidFail=!1}}if(this.meshSetAddresses.length===0){if(this.geometry.getAttribute("position")?.array.length!==0){let n=this.geometry;n.dispose(),this.geometry=new jt,this.geometry.userData=n.userData,this.geometry.boundingSphere=n.boundingSphere,this.geometry.setAttribute("position",new Nt([],3))}return void this.geometry.setDrawRange(0,0)}if(t===!0)return function(n,r){let s=fb(),a=_4(n,r),o=s.mesh_topological_data(a),l=o.positions(),c=o.indices();return o.free(),a.free(),{positions:l,indices:c,verticesPerFace:new Uint8Array(c.length/3).fill(3)}}(this.meshSetAddresses,this.booleanOp);let i=this.geometry;i.dispose(),this.geometry=new jt,this.geometry.userData=i.userData,this.geometry.boundingSphere=i.boundingSphere;try{this.booleanMeshSetAddress=function(n,r,s,a){let o=fb(),l=_4(n,r),c=o.mesh_render_data(l,Math.max(a,0));if(s.setAttribute("position",new Nt(c.positions(),3)),s.setAttribute("normal",new Nt(c.normals(),3)),c.free(),s.boundingSphere===null&&(s.boundingSphere=new yr),l.tri_count()===0)s.boundingSphere.center.set(0,0,0),s.boundingSphere.radius=0,s.userData.parameters={width:0,height:0,depth:0};else{let h=l.bounds();s.boundingSphere.center.set(h[0],h[1],h[2]),s.boundingSphere.radius=(h[3]**2+h[4]**2+h[5]**2)**.5,s.userData.parameters={width:2*h[3],height:2*h[4],depth:2*h[5]}}return p3(l)}(this.meshSetAddresses,this.booleanOp,this.geometry,this.phongAngle)}catch(n){this.booleanMeshSetAddress=0,this.geometry.userData.booleanOperationDidFail=!0,console.error(n)}this.booleanMatrixInvOld.copy(this.matrix).invert(),this.needsTransformForDownstream=!0,ep(this),ip(this)}dispose(){super.dispose(),this.geometry.dispose()}}}),u0=z(()=>{tt(),qr(),nd(),(Eb||(Eb={})).is=function(t){return Be.is(t)&&t instanceof Su},Tx=(t,e)=>class extends id(t,e){updateState_Light(i,n){if(this.updateState_Entity(i,n),i.color!==void 0&&(this.color=n.shared.color(i.color)),i.intensity!==void 0&&(this.intensity=i.intensity*Math.PI),i.depth!==void 0){let r=this.shadow;r.camera.far=i.depth,r.needsUpdate=!0}i.shadows!==void 0&&(this.castShadow=i.shadows)}}}),Eh=z(()=>{d0(),Kn(),nd(),fa=t=>t instanceof Yi,eo=t=>t!==null&&t instanceof uh,Ab=t=>qA.is(t)});function mr(t,e){return e.color(t)}function DL(t=new Date,e){let i=e.format,n=t.getSeconds(),r=t;e&&e.timeZone!==null&&(r=function(d,u){try{let p=new Intl.DateTimeFormat("en-US",{timeZone:u,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hourCycle:"h23"}).formatToParts(d),f=g=>Number(p.find(m=>m.type===g)?.value);return new Date(f("year"),f("month")-1,f("day"),f("hour"),f("minute"),f("second"),d.getMilliseconds())}catch{return new Date(NaN)}}(new Date,e.timeZone));let s,a=r.getHours(),o=r.getMinutes();e.format12h24h==="12ampm"&&(s=a>=12?"PM":"AM");let l,c,h=a;switch(e.format12h24h!=="24"&&(h=a%12,h===0&&(h=12)),i){case"HH:mm:ss":l=[h,o,n];break;case"HH:mm":l=[h,o];break;case"HH":l=[h],s=void 0;break;case"mm":l=[o],s=void 0;break;case"ss":l=[n],s=void 0;break;case"year":c=r.getFullYear();break;case"month":c=r.getMonth()+1;break;case"dayOfYear":c=Math.floor((r.getTime()-new Date(r.getFullYear(),0,0).getTime())/864e5);break;case"dayOfMonth":c=r.getDate();break;case"secondOfDay":c=60*a*60+60*o+n;break;default:console.error("Unknown time format",i),c=0}return l!==void 0?{textValue:l,suffix:s}:c}var xT,p0,U3=z(()=>{}),eZ=z(()=>{tt(),a0(),o0(),xT=class extends Sp(xF){constructor(t,e=15,i=10066329){super(t,e,i),this.object=t,this.added=!1,this.name=`DirectionalLightHelper: ${t.uuid}`}raycast(t,e){Mp(this.object,xT.geometryHelper,t,e)}}}),z3=z(()=>{tt(),eZ(),u0(),p0=class extends Tx(vF,xT){constructor(t,e,i){super(),this.super_Entity(t,e),this.castShadow=!0,this.shadow.mapSize.width=2048,this.shadow.mapSize.height=2048,this.shadow.normalBias=1,this.layers.enable(3);let n=this.shadow.camera;n.top=1250,n.bottom=-1250,n.right=1250,n.left=-1250,n.near=-1e4,n.far=2500;let r=new zg(this.shadow.camera);r.visible=!1,this.gizmos.shadowmap=r}update(){this.shadow.camera.updateProjectionMatrix();for(let t in this.gizmos){let e=this.gizmos[t];e instanceof zg&&e.update()}}updateMatrixWorld(t){super.updateMatrixWorld(t),this.objectHelper&&this.objectHelper.update()}updateState(t,e){this.updateState_Light(t,e);let i=t.depth!==void 0&&t.depth!==this.shadow.camera.far||t.size!==void 0&&t.size/2!==this.shadow.camera.right;t.size!==void 0&&function(n,r){n.shadow.camera.right=r/2,n.shadow.camera.left=-r/2,n.shadow.camera.top=r/2,n.shadow.camera.bottom=-r/2,n.shadow.needsUpdate=!0}(this,t.size),t.shadowRadius!==void 0&&(this.shadow.radius=t.shadowRadius),t.shadowResolution!==void 0&&(this.shadow.mapSize.set(t.shadowResolution,t.shadowResolution),this.shadow.map&&(this.shadow.map.dispose(),this.shadow.map=null)),t.penumbraSize!==void 0&&e.scene.markPenumbraSizeDirty(),i&&this.update()}}});function F3(t){return t instanceof Wr&&t.needsAO&&!ll(t)&&t.isDecalObject!==!0}function N3(t){let e=t.cloner;if(e&&Array.isArray(e.children))for(let i of e.children)i?.layers&&(i.layers.mask=t.layers.mask)}function k3(t){return t.getLayersOfType("reflection").filter(e=>e.data.visible).length}function RL(t,e){let i={outline:!1,cavity:!1},n=t.layers.mask&Cx,r=e.getLayersOfType("transmission"),s=e.getLayersOfType("outline"),a=k3(e),o=e.getLayersOfType("cavity");return(s.length>0||o.length>0)&&(t.layers.set(8),r.length>0&&t.layers.enable(3),a>0&&t.layers.enable(4),i.outline=s.length>0,i.cavity=o.length>0,ip(t),ep(t)),r.length===0&&s.length===0&&o.length===0&&a===0&&t.layers.set(0),n&&t.layers.set(9),!n&&F3(t)&&t.layers.enable(5),N3(t),i}function IL(t,e){if(!e.layers)return!1;let i=t.layers.mask&Cx,n=!1,r=e.getLayersOfType("transmission").filter(l=>l.data.visible),s=e.getLayersOfType("outline").filter(l=>l.data.visible),a=k3(e),o=e.getLayersOfType("cavity").filter(l=>l.data.visible);return r.length>0&&(t.layers.set(3),(s.length>0||o.length>0)&&t.layers.enable(8),a>0&&t.layers.enable(4),n=!0),r.length===0&&s.length===0&&o.length===0&&a===0&&t.layers.set(0),i&&t.layers.set(9),!i&&F3(t)&&t.layers.enable(5),N3(t),n}function OL(t,e){var i;if(!e.layers)return!1;let n=t.layers.mask&Cx,r=!1,s=k3(e),a=e.getLayersOfType("transmission").filter(c=>c.data.visible),o=e.getLayersOfType("outline").filter(c=>c.data.visible),l=e.getLayersOfType("cavity").filter(c=>c.data.visible);return s>0&&((i=t.userData).__splinePlanarMirror??(i.__splinePlanarMirror=0),t.layers.set(4),a.length>0&&t.layers.enable(3),(o.length>0||l.length>0)&&t.layers.enable(8),r=!0),s===0&&a.length===0&&o.length===0&&l.length===0&&t.layers.set(0),n&&t.layers.set(9),!n&&F3(t)&&t.layers.enable(5),N3(t),r}function wT(t,e,i,n=!1){let r=t.cloner;if(r){let s=null;if((t.raycast===gi.prototype.raycast||t.raycast===Yi.prototype.raycast)&&t.isSkinnedMesh!==!0){let a=t.geometry;a&&(a.boundingSphere===null&&a.computeBoundingSphere(),s=a.boundingSphere)}for(let a of r.children){if(s!==null&&(ST.copy(s).applyMatrix4(a.matrixWorld),!e.ray.intersectsSphere(ST)))continue;let o=L6.copy(a.matrixWorld).invert(),l=B6.copy(e.ray).applyMatrix4(o),c=t.matrixWorld;l.applyMatrix4(c);let h=O6;h.set(l.origin,l.direction),h.near=e.near,h.far=e.far,h.layers.mask=e.layers.mask;let d=h.intersectObject(t,!1);d.length>0&&i.push({...d[0],object:n?a:t})}}}var Cx,O6,L6,B6,ST,Wv,U6,E2,A2,T2,f0,mn,z6=z(()=>{Bi(),Ax(),Kn(),rd(),tt(),Cx=512,O6=new ex,L6=new At,B6=new Jo,ST=new yr}),iZ=z(()=>{tt(),a0(),o0(),Wv=class extends Sp(_F){constructor(t,e=6710886){super(t,e),this.object=t,this.matrix=t.matrixWorld,this.name=`SpotLightHelper: ${t.uuid}`}raycast(t,e){Mp(this.object,Wv.geometryHelper,t,e)}update(){if(this.object!==void 0){let t=Wv._vector,e=this.object.distance?this.object.distance:1e3,i=e*Math.tan(this.object.angle);this.cone.scale.set(i,i,e),t.setFromMatrixPosition(this.object.target.matrixWorld),this.cone.lookAt(t);let n=this.color!==void 0?this.color:this.light.color;if(this.cone.material instanceof Array)for(let r=0,s=this.cone.material.length;r<s;r++)this.cone.material[r].color.set(n);else this.cone.material.color.set(n)}}},(U6=Wv)._vector=new T}),V3=z(()=>{tt(),iZ(),u0(),E2=new T,A2=new T,T2=new Wt,f0=class extends Tx(mF,U6){constructor(t,e,i){super(),this.super_Entity(t,e),this.castShadow=!0,this.shadow.mapSize.width=1024,this.shadow.mapSize.height=1024,this.shadow.normalBias=1,this.layers.enable(3);let n=this.shadow.camera;n.fov=2*Ot.RAD2DEG*this.angle,n.aspect=1,n.near=100,n.far=2500;let r=new zg(this.shadow.camera);r.visible=!1,this.gizmos.shadowmap=r,this.update()}update(){this.shadow.camera.updateProjectionMatrix();for(let t in this.gizmos){let e=this.gizmos[t];e instanceof zg&&e.update()}}updateMatrixWorld(t){super.updateMatrixWorld(t),A2.setFromMatrixPosition(this.matrixWorld),T2.setFromRotationMatrix(this.matrixWorld),E2.copy(this.up).applyQuaternion(T2).negate().multiplyScalar(this.distance),this.target.position.copy(A2).add(E2),this.target.updateMatrixWorld(),this.objectHelper&&this.objectHelper.update()}updateState(t,e){this.updateState_Light(t,e),t.distance!==void 0&&(this.distance=t.distance),t.decay!==void 0&&(this.decay=t.decay),t.angle!==void 0&&(this.angle=t.angle),t.penumbra!==void 0&&(this.penumbra=t.penumbra),t.shadowRadius!==void 0&&(this.shadow.radius=t.shadowRadius),t.penumbraSize!==void 0&&e.scene.markPenumbraSizeDirty(),t.shadowResolution!==void 0&&(this.shadow.mapSize.set(t.shadowResolution,t.shadowResolution),this.shadow.map&&(this.shadow.map.dispose(),this.shadow.map=null))}}}),dl=z(()=>{$t(),Ws(),tt(),qr(),_a(),U3(),co(),z3(),Ye(),Mh(),tt(),rd(),Eh(),z6(),V3(),ke(),d0(),mn=class extends vx(ss){constructor(t,e,i){if(super(),this.data=e,this.bgColor=new yn(1,1,1,1),this.fog=null,this.backupFog=new TE(16777215,.1,2e3),this.fogUseBGColor=!1,this.fogMode="linear",this.fogDensity=ir.getDensity({}),this.fogHeightFalloff=ir.getHeightFalloff({}),this.fogHeightBase=ir.getHeightBase({}),this.isActive=!1,this.skyState=null,this.skyStateVersion=0,this.gradingState=null,this.skyHdriHolder=null,this.aoColor=new Jt,this.penumbraSizeArrayCache=null,this.super_Entity(t,e),this.personalCamera=new Zi(ed,{...pg.defaultData,...e.camera,name:"Personal Camera"}),this.personalCamera.objectHelper.visible=!1,this.add(this.personalCamera),this.activeCamera=this.personalCamera,this.ambientLight=new fF(13882323,8553090,.75*Math.PI),this.ambientLight.name="Default Ambient Light",this.ambientLight.layers.enable(3),this.ambientLight.removeFromParent(),this.add(this.ambientLight),e.uiScene){let n=kA();n===null?Gn("ui-2d","a page's 2D scene"):this.uiScene=new n.Scene2D((Array.isArray(t)?t[0]:t)+"-ui",e.uiScene,{dpr:window.devicePixelRatio,shared:i.shared})}else e.uiFrame&&this.createUICanvas(e.uiFrame,i)}get scene(){return this.parent}get postprocessing(){return this.data.postprocessing}get frameId(){return this.data.uiFrame}get frame(){return this.uiCanvas?.frame}createUICanvas(t,e){let i=kA();i!==null?(this.uiCanvas=new i.UICanvas(this.uuid+"-uiscreen",window.innerWidth,window.innerHeight,e),this.uiCanvas.isScreenSpace=!0,this.uiCanvas.promise.then(()=>{this.uiCanvas?.applyFrame(t),this.uiCanvas?.applySize()})):Gn("ui-2d","a page's UI canvas")}updateVisible(){}setBackgroundColor(t){this.bgColor=t,this.fogUseBGColor===!0&&(this.backupFog.color=t)}entityChildrenCount(){return this.uiScene?this.uiScene.children.length:super.entityChildrenCount()}updateAmbientLight(t,e){t.color!==void 0&&(this.ambientLight.color=mr(t.color,e)),t.intensity!==void 0&&(this.ambientLight.intensity=t.intensity*Math.PI),t.enabled!==void 0&&(t.enabled?this.add(this.ambientLight):this.remove(this.ambientLight))}onDeactive(){this.isActive=!1}onActive(t){this.isActive=!0,t.fog=this.fog,this.traverseEntity(e=>{e instanceof uh&&e.recomputeBoolean()}),this.updateShadow(this.data.shadow)}forceMaterialsUpdate(){this.traverseEntity(t=>{if(t instanceof Wr)if(Array.isArray(t.material))for(let e of t.material)e.needsUpdate=!0;else t.material.needsUpdate=!0,t.material.dispose()})}updateShadow(t){if(t.softShadowQuality===void 0&&t.type===void 0||!this.isActive)return;let e=this.data.shadow;var i,n;i=ug.isSoft(e),n=e?.softShadowQuality,vT!==void 0&&vT(i,n)&&this.forceMaterialsUpdate()}updateFog(t,e){t.enabled?this.fog=this.backupFog:this.fog=null,this.isActive&&(this.scene.fog=this.fog),this.fogUseBGColor=t.useBackgroundColor,t.useBackgroundColor?this.backupFog.color.set(this.bgColor):this.backupFog.color=mr(t.color,e),this.backupFog.near=t.near,this.backupFog.far=t.far,this.fogMode=ir.getMode(t),this.fogDensity=ir.getDensity(t),this.fogHeightFalloff=ir.getHeightFalloff(t),this.fogHeightBase=ir.getHeightBase(t)}updateSky(t,e){this.skyState=t??null,this.skyStateVersion++;let i=t?.hdri?.image;this.skyHdriHolder=i!=null?e.image(i):null}updateAo(t,e){t.aoColor!==void 0&&(this.aoColor=mr(t.aoColor,e))}updateByOp(t,e,i,n){let r=this.data.uiFrame;super.updateByOp(t,e,i,n);let s=e;ri(t.path,["fog"])?this.updateFog(s.fog,i.shared):ri(t.path,["sky"])?this.updateSky(s.sky,i.shared):ri(t.path,["grading"])?this.gradingState=s.grading??null:ri(t.path,["ao"])?this.updateAo(s.ao,i.shared):ri(t.path,["ambient"])?this.updateAmbientLight(s.ambient,i.shared):ri(t.path,["shadow"])?this.updateShadow(s.shadow):t.type===0&&t.path.length===0&&(t.props.uiFrame!==void 0||r!==s.uiFrame)&&this.updateUIFrame(t.props.uiFrame,i)}updateUIFrame(t,e){t?(this.uiCanvas||this.createUICanvas(t,e),this.uiCanvas.enabled=!0,this.uiCanvas.applyFrame(t)):this.uiCanvas&&(this.uiCanvas.enabled=!1)}updateState(t,e){this.updateState_Entity(t,e),t.backgroundColor!==void 0&&this.setBackgroundColor(mr(t.backgroundColor,e.shared)),t.fog!==void 0&&this.updateFog(t.fog,e.shared),t.sky!==void 0&&this.updateSky(t.sky,e.shared),t.grading!==void 0&&(this.gradingState=t.grading),t.ambient!==void 0&&this.updateAmbientLight(t.ambient,e.shared),t.ao!==void 0&&this.updateAo(t.ao,e.shared),t.shadow!==void 0&&this.updateShadow(t.shadow)}createFrame(t,e){}raycast(t,e){super.raycast(t,e)}switchActiveCamera(t){t instanceof Zi&&t.isDescendantOf(this)&&(this.activeCamera!==this.personalCamera&&(this.activeCamera.objectHelper.visible=!0),this.activeCamera=t,t.objectHelper.visible=!1)}get playCamera(){let t=this.scene?.find(this.data.publish.playCamera);return t instanceof Zi?t:this.personalCamera}switchToPlayCamera(){this.switchActiveCamera(this.playCamera)}get penumbraSizeArray(){return this.penumbraSizeArrayCache===null&&this.updatePenumbraSizeArray(),this.penumbraSizeArrayCache}updatePenumbraSizeArray(){this.penumbraSizeArrayCache=new Array(ol).fill(.5);let t=0,e=0;this.traverseEntity(i=>{if(!i.visible)return!0;i instanceof p0&&i.visible&&t<mg&&(this.penumbraSizeArrayCache[t]=i.data.penumbraSize??.5,t+=1),i instanceof f0&&i.visible&&t<ol-mg&&(this.penumbraSizeArrayCache[mg+e]=i.data.penumbraSize??.5,e+=1)})}raycastWithClones(t){let e=[],i=n=>{for(let r of n.children){let s=r.cloner;Be.is(r)&&(r.visible||s?.object.data.visible)&&((fa(r)||Ab(r)&&this.scene.enableHelpers&&r.objectHelper.visible)&&(t.intersectObject(r,!1,e),wT(r,t,e,!0)),i(r))}};return i(this),e}updateEntity2DByOp(t,e,i,n){this.uiCanvas?.updateEntity2DByOp(t,e,i,n)}}});function LL(){return F6}function C2(){if(Tb===null)throw new Error('[spe] Classic (WebGL) particles are not available in this build \u2014 it was compiled WebGPU-only. Re-export the scene with renderer "Both" or "WebGL 2", or load the full runtime.');return Tb}function P2(t){return t?.isWebGPUSplineRenderer===!0}var F6,Tb,np,N6=z(()=>{F6=null,Tb=null}),j3=z(()=>{tt(),px(),nd(),np=class extends id(xp,gp){constructor(t,e,i){super(),this.super_Entity(t,e),this.context=i,this.objectHelper.update()}updateState(t,e){this.updateState_Entity(t,e)}}}),nZ=_p((t,e)=>{var i,n;i=t,n=function(){return r.importState=function(s){var a=new r;return a.importState(s),a},r;function r(){return function(s){var a=0,o=0,l=0,c=1;s.length==0&&(s=[+new Date]);var h=function(){var p=4022871197,f=function(g){g=g.toString();for(var m=0;m<g.length;m++){var v=.02519603282416938*(p+=g.charCodeAt(m));v-=p=v>>>0,p=(v*=p)>>>0,p+=4294967296*(v-=p)}return 23283064365386963e-26*(p>>>0)};return f.version="Mash 0.9",f}();a=h(" "),o=h(" "),l=h(" ");for(var d=0;d<s.length;d++)(a-=h(s[d]))<0&&(a+=1),(o-=h(s[d]))<0&&(o+=1),(l-=h(s[d]))<0&&(l+=1);h=null;var u=function(){var p=2091639*a+23283064365386963e-26*c;return a=o,o=l,l=p-(c=0|p)};return u.next=u,u.uint32=function(){return 4294967296*u()},u.fract53=function(){return u()+11102230246251565e-32*(2097152*u()|0)},u.version="Alea 0.9",u.args=s,u.exportState=function(){return[a,o,l,c]},u.importState=function(p){a=+p[0]||0,o=+p[1]||0,l=+p[2]||0,c=+p[3]||0},u}(Array.prototype.slice.call(arguments))}},typeof t=="object"?e.exports=n():typeof define=="function"&&define.amd?define(n):i.Alea=n()});function rZ(t){let e=!1;return t.scene.objects.traverse((i,n)=>{n.type==="Mesh"&&n.geometry.type==="SubdivGeometry"&&(e=!0)}),e}var ta,jd,yp,m0=z(()=>{Kn(),tt(),Tp(),Ax(),Xr(),ta=new ci,jd=new T,yp=class extends Ai{constructor(t,e,i){super(t,e,i),this.data=e,this.hiddenMatrixOld=new At,this.smoothShading=!0,this.skipReactionUpdate=!1}chooseGeoemtryCache(t){return this.dataPatched.flatShading?t.geometryCache:t.geometryCache2}get subdivPointerNew(){return this.localGeometry!==void 0?this.subdivPointer:this.geometry.ensureSubdivPointer()}get originalGeometryNew(){return this.localGeometry!==void 0?this.originalGeometry:this.geometry.originalGeometry}get phongAngle(){return this.data.geometry.phongAngle??45}updateEntityBoxSize(t,e){let i=this.geometry.userData.parameters;t.copy(this.originalGeometryNew.boundingSphere.center),e.set(i.width,i.height,i.depth??0).multiplyScalar(.5)}createGeometryByControls(t){if(this.skipReactionUpdate===!0)return;let e=this.localGeometry?.uuid,{originalGeometry:i,subdividedGeometry:n,subdivPointer:r}=Ni.build(t,this.subdivPointer,this.smoothShading,this.hasNonUniformScale?this.shearScale:void 0);this.subdivPointer=r,i!==void 0&&(this.originalGeometry?.dispose(),this.originalGeometry=i),n!==void 0&&(this.subdividedGeometry?.dispose(),this.subdividedGeometry=n??void 0),this.localGeometry=this.subdividedGeometry??this.originalGeometry,ep(this),ip(this),this.calcBoundingBox(),e&&(this.localGeometry.uuid=e)}updateState(t,e){if(super.updateState(t,e),t.flatShading!==void 0){let i=this.material;this.material=Array.isArray(i)?i.map(n=>n.getFlavor(!1,n.side,n.wireframe)):i.getFlavor(!1,i.side,i.wireframe),this.smoothShading=!t.flatShading,this.createGeometryDelayed(e)}}updateMesh(t=!1,e=!1,i=!1){e&&this.subdividedGeometry||Ni.buildLevel(this.subdivPointer,!0,this.smoothShading?this.phongAngle:-1,this.originalGeometry,t&&this.hasNonUniformScale?this.shearScaleInv:void 0,i),this.subdividedGeometry&&Ni.buildLevel(this.subdivPointer,!1,this.smoothShading?this.phongAngle:-1,this.subdividedGeometry,t&&this.hasNonUniformScale?this.shearScaleInv:void 0)}updateTopology(){let t=this.localGeometry?.uuid;this.originalGeometry.dispose(),this.originalGeometry=Ni.buildLevel(this.subdivPointer,!0,this.smoothShading?this.phongAngle:-1),this.subdividedGeometry&&(this.subdividedGeometry.dispose(),this.subdividedGeometry=Ni.buildLevel(this.subdivPointer,!1,this.smoothShading?this.phongAngle:-1)),this.localGeometry=this.subdividedGeometry??this.originalGeometry,ep(this),ip(this),this.calcBoundingBox(),t&&(this.localGeometry.uuid=t)}raycast(t,e){let i=this.localGeometry;this.localGeometry=this.originalGeometryNew,Yi.prototype.raycast.call(this,t,e),this.localGeometry=i}activateShearCompensation(){!this.hasNonUniformScale||(this.matrix.copy(this.matrixWorldRigid),this.hiddenMatrixOld.copy(this.hiddenMatrix),this.hiddenMatrix.copy(this.parent.matrixWorld).invert())}deactivateShearCompensation(){!this.hasNonUniformScale||(this.updateMatrix(),this.hasNonUniformScale=void 0,this.hiddenMatrix.copy(this.hiddenMatrixOld))}calcBoundingBox(){let t=this.originalGeometry;t.boundingSphere===null&&(t.boundingSphere=new yr,this.subdividedGeometry&&(this.subdividedGeometry.boundingSphere=t.boundingSphere));let e=t.attributes.position,i=t.boundingSphere.center;ta.setFromBufferAttribute(e),ta.getCenter(i),t.boundingSphere.radius=i.distanceTo(ta.max),isNaN(t.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this),ta.getSize(jd),this.hasNonUniformScale&&jd.divide(this.scale);let n={width:jd.x,height:jd.y,depth:jd.z};return this.geometry.userData.parameters=n,n}updateBoundingSphere(t){let e=this.originalGeometry;ta.min.set(t[0],t[2],t[4]),ta.max.set(t[1],t[3],t[5]),this.hasNonUniformScale&&(ta.min.applyMatrix4(this.shearScaleInv),ta.max.applyMatrix4(this.shearScaleInv)),e.boundingSphere===null&&(e.boundingSphere=new yr);let i=e.boundingSphere.center;ta.getCenter(i),e.boundingSphere.radius=i.distanceTo(ta.max)}freeSubdivPointer(){this.subdivPointer&&(Ni.freeSubdivPointer(this.subdivPointer),this.subdivPointer=0),this.localGeometry=void 0,this.originalGeometry?.dispose(),this.subdividedGeometry?.dispose()}dispose(){super.dispose(),this.freeSubdivPointer()}updateSubdivisionLevel(t){if(this.skipReactionUpdate===!0)return;let e=this.localGeometry,i=e?.uuid,n=e?.userData.parameters,r=t.subdivisions>0?Ni.buildRefined(this.subdivPointer,t.subdivisions,this.smoothShading?t.phongAngle??35:-1):null;this.subdividedGeometry?.dispose(),this.subdividedGeometry=r??void 0,this.subdividedGeometry&&this.originalGeometry.boundingSphere&&(this.subdividedGeometry.boundingSphere=this.originalGeometry.boundingSphere),this.localGeometry=this.subdividedGeometry??this.originalGeometry,ep(this),ip(this),n!==void 0&&(this.localGeometry.userData.parameters=n),i&&(this.localGeometry.uuid=i)}updateByPatchedOpGeometry(t,e,i){super.updateByPatchedOpGeometry(t,e,i),this.localGeometry&&(t.type===0&&t.path.length===0&&S6(t.props)&&this.subdivPointer?this.updateSubdivisionLevel(e):this.createGeometryByControls(e))}}});function G3(t){if(t.component){let e=t.component.instances.indexOf(t);e>=0&&t.component.instances.splice(e,1);for(let i of t.children)Be.is(i)&&G3(i)}}var bg,MT,Px,k6=z(()=>{qr()}),sZ=_p((t,e)=>{function i(n,r,s,a){this.message=n,this.expected=r,this.found=s,this.location=a,this.name="SyntaxError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,i)}(function(n,r){function s(){this.constructor=n}s.prototype=r.prototype,n.prototype=new s})(i,Error),i.buildMessage=function(n,r){var s,a={literal:function(d){return'"'+l(d.text)+'"'},class:function(d){var u,p="";for(u=0;u<d.parts.length;u++)p+=d.parts[u]instanceof Array?c(d.parts[u][0])+"-"+c(d.parts[u][1]):c(d.parts[u]);return"["+(d.inverted?"^":"")+p+"]"},any:function(d){return"any character"},end:function(d){return"end of input"},other:function(d){return d.description}};function o(d){return d.charCodeAt(0).toString(16).toUpperCase()}function l(d){return d.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(u){return"\\x0"+o(u)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(u){return"\\x"+o(u)})}function c(d){return d.replace(/\\/g,"\\\\").replace(/\]/g,"\\]").replace(/\^/g,"\\^").replace(/-/g,"\\-").replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(u){return"\\x0"+o(u)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(u){return"\\x"+o(u)})}function h(d){return a[d.type](d)}return"Expected "+function(d){var u,p,f=new Array(d.length);for(u=0;u<d.length;u++)f[u]=h(d[u]);if(f.sort(),f.length>0){for(u=1,p=1;u<f.length;u++)f[u-1]!==f[u]&&(f[p]=f[u],p++);f.length=p}switch(f.length){case 1:return f[0];case 2:return f[0]+" or "+f[1];default:return f.slice(0,-1).join(", ")+", or "+f[f.length-1]}}(n)+" but "+((s=r)?'"'+l(s)+'"':"end of input")+" found."},e.exports={SyntaxError:i,parse:function(n,r){r=r!==void 0?r:{};var s,a={},o={svg_path:Pe},l=Pe,c=function(Q){if(!Q)return[];for(var Et=[],lt=0;lt<Q.length;lt++)Et=Et.concat.apply(Et,Q[lt]);var xt=Et[0];return xt&&xt.code=="m"&&(delete xt.relative,xt.code="M"),Et},h=function(Q,Et){return function(lt,xt){if(!xt)return[lt];for(var Rt=[lt],I=0,rt=xt.length;I<rt;I++)Rt[I+1]=xt[I][1];return Rt}(Q,Et)},d=/^[Mm]/,u=be(["M","m"],!1,!1),p=function(Q,Et,lt){var xt=mo(Q,[Et]);return lt&&(xt=xt.concat(mo(Q=="M"?"L":"l",lt[1]))),xt},f=/^[Zz]/,g=be(["Z","z"],!1,!1),m=function(){return mo("Z")},v=/^[Ll]/,y=be(["L","l"],!1,!1),_=function(Q,Et){return mo(Q,Et)},b=/^[Hh]/,x=be(["H","h"],!1,!1),w=function(Q,Et){return mo(Q,Et.map(function(lt){return{x:lt}}))},S=/^[Vv]/,E=be(["V","v"],!1,!1),A=function(Q,Et){return mo(Q,Et.map(function(lt){return{y:lt}}))},P=/^[Cc]/,C=be(["C","c"],!1,!1),R=function(Q,Et,lt){return{x1:Q.x,y1:Q.y,x2:Et.x,y2:Et.y,x:lt.x,y:lt.y}},L=/^[Ss]/,D=be(["S","s"],!1,!1),F=function(Q,Et){return{x2:Q.x,y2:Q.y,x:Et.x,y:Et.y}},V=/^[Qq]/,U=be(["Q","q"],!1,!1),j=function(Q,Et){return{x1:Q.x,y1:Q.y,x:Et.x,y:Et.y}},W=/^[Tt]/,it=be(["T","t"],!1,!1),nt=/^[Aa]/,Y=be(["A","a"],!1,!1),ot=function(Q,Et,lt,xt,Rt,I){return{rx:Q,ry:Et,xAxisRotation:lt,largeArc:xt,sweep:Rt,x:I.x,y:I.y}},ht=function(Q,Et){return{x:Q,y:Et}},ft=function(Q){return 1*Q},pt=function(Q){return 1*Q.join("")},J=/^[01]/,mt=be(["0","1"],!1,!1),N=function(Q){return Q=="1"},O=function(){return""},H=",",$=_e(",",!1),B=function(Q){return Q.join("")},Z=".",K=_e(".",!1),k=/^[eE]/,st=be(["e","E"],!1,!1),dt=/^[+\-]/,bt=be(["+","-"],!1,!1),ct=/^[0-9]/,It=be([["0","9"]],!1,!1),St=function(Q){return Q.join("")},Dt=/^[ \t\n\r]/,Mt=be([" "," ",`
4178
+ `&&C.push("")):S.getTextWidth(C[C.length-1]+R,w)>P&&(C[C.length-1].length&&C.push(""),S.getTextWidth(C[C.length-1]+R,w)>P&&(R.length===1?(C[C.length-1]+=R,R=""):(C[C.length-1]+=R.slice(0,-1),R=R[R.length-1],C.push(""))));return C[C.length-1]+=R,C}(t,i,c===2?u.toUpperCase():c===3?u.toLowerCase():u,e),{shapes:f,charWidths:g,charCoords:m}=i.generateShapes(p,t,e),v=.5*(typeof n=="number"?n:Number(e.getVariable(n))),y=.5*(typeof r=="number"?r:Number(e.getVariable(r))),_=f.map(w=>new ki().fromShape(w,!0));this.vectorShapes=_;let b=_.map(w=>Sh.create({shape:w,parameters:{depth:s,extrudeBevelSegments:o,extrudeBevelSize:a,uvPitch:d===1?void 0:h,extrusionVersion:d,windingRule:s<=0?Oi.NONZERO:Oi.ODD,subdivisions:this.isLowResolution&&s>0?1:12}})),x=b.length?Tc(b):dL();x.translate(-v,y,0),this.dispose(),this.wrappedText=p,this.charCoords=m,this.charWidths=g,this.deleteAttribute("extrudeNormal"),Object.entries(x.attributes).forEach(([w,S])=>{this.setAttribute(w,S)}),this.setIndex(x.index),this.adoptNearSide(b,s),this.computeBoundingSphere()}adoptNearSide(t,e){this._depth=e;let i=0,n=0,r=0;for(let o of t){let l=o,c=l._nearSide;if(c===void 0||c.length===0)return this._nearSide=new Uint8Array(0),this._effectiveBevel=0,void(this._vScale=0);i+=c.length,n=Math.max(n,l._effectiveBevel??0),r=l._vScale??r}this._effectiveBevel=n,this._vScale=r;let s=new Uint8Array(i),a=0;for(let o of t){let l=o._nearSide;s.set(l,a),a+=l.length}this._nearSide=s}takeDepthStateFrom(t){let e=t;e._nearSide!==void 0&&(this._depth=e._depth??this._depth,this._nearSide=e._nearSide,this._vScale=e._vScale??this._vScale,this._effectiveBevel=e._effectiveBevel??this._effectiveBevel)}canShiftDepthTo(t){return this._nearSide.length===this.getAttribute("position")?.count&&Nu(this._effectiveBevel,t)&&Nu(this._effectiveBevel,this._depth)}shiftDepthTo(t){if(!this.canShiftDepthTo(t))return!1;let e=t-this._depth;if(this._depth=t,e===0)return!0;let i=this.getAttribute("position"),n=i.array,r=this.getAttribute("uv"),s=r?.array,a=this._vScale>0?e/this._vScale:0,o=this._nearSide;for(let l=0;l<o.length;l++){let c=o[l];c!==0&&(n[3*l+2]+=e,c===2&&s!==void 0&&(s[2*l+1]+=a))}return i.needsUpdate=!0,r!==void 0&&a!==0&&(r.needsUpdate=!0),this.refreshDepthBounds(t),!0}refreshDepthBounds(t){if(this.boundingBox===null&&this.boundingSphere===null)return;this.boundingBox===null&&this.computeBoundingBox();let e=this.boundingBox;e.min.z=Math.min(0,t),e.max.z=Math.max(0,t),this.boundingSphere!==null&&e.getBoundingSphere(this.boundingSphere)}clone(){let t=Ar(new jt,lT.prototype);return t.copy(this),console.log("CloneGeometry",this,t),t}copy(t){return Object.entries(t.attributes).forEach(([e,i])=>{this.setAttribute(e,i)}),this.setIndex(t.index),this.userData={parameters:{...t.userData.parameters},type:"TextGeometry"},this}async setText(t,e){this.font&&await this.font.loadingPromise,await this.update({...this.userData.parameters,text:{textValue:t}},e)}get text(){return this.userData.parameters.text??""}}});function ZY(t){if(!hT)return pL||(pL=async function(){let e=t??"https://cdn.spline.design/@splinetool/runtime@2.0.79/build",i=import("./process.js"),[n,r]=await Promise.all([i,fetch(`${e}/process.wasm`).then(o=>o.arrayBuffer())]),s=n.default,a=await s({wasmBinary:r});b6(a),hT=!0}())}var b6,P3,hT,pL,wx=z(()=>{P3=new Promise(t=>{b6=t}),hT=!1});function c2(t,e){if(Object.keys(t.morphAttributes).length>0||Object.keys(e.morphAttributes).length>0)return!1;let i=Object.keys(t.attributes),n=Object.keys(e.attributes);if(i.length!==n.length)return!1;for(let l of n){let c=t.attributes[l],h=e.attributes[l];if(c===void 0||c.isInterleavedBufferAttribute===!0||h.isInterleavedBufferAttribute===!0||c.itemSize!==h.itemSize||c.normalized!==h.normalized||c.array.constructor!==h.array.constructor||c.array.length!==h.array.length)return!1}let r=t.index,s=e.index;if(r===null!=(s===null))return!1;let a=!1;if(r!==null&&s!==null){if(r.array.length!==s.array.length)return!1;let l=r.array.constructor,c=s.array.constructor;if(l!==c){if(l!==Uint32Array||c!==Uint16Array)return!1;a=!0}}if(t.groups.length!==e.groups.length)return!1;for(let l=0;l<e.groups.length;l++){let c=t.groups[l],h=e.groups[l];if(c.start!==h.start||c.count!==h.count||c.materialIndex!==h.materialIndex)return!1}for(let l of n){let c=t.attributes[l],h=e.attributes[l];c.array.set(h.array),c.needsUpdate=!0}let o=t.takeDepthStateFrom;if(typeof o=="function"&&o.call(t,e),r!==null&&s!==null){if(a){let l=r.array,c=s.array;for(let h=0,d=c.length;h<d;h++){let u=c[h];l[h]=u===65535?4294967295:u}}else r.array.set(s.array);r.needsUpdate=!0}return t.drawRange.start=e.drawRange.start,t.drawRange.count=e.drawRange.count,t.userData=e.userData,t.boundingBox=null,t.boundingSphere=null,!0}function cT(t,e,i,n){let r,s,a,o=t.position.array,l=t.normal.array,c=x6.makeScale(e,i,n).invert().elements;for(let h=0,d=o.length;h<d;h+=3)o[h]*=e,o[h+1]*=i,o[h+2]*=n,r=l[h],s=l[h+1],a=l[h+2],l[h]=c[0]*r+c[4]*s+c[8]*a,l[h+1]=c[1]*r+c[5]*s+c[9]*a,l[h+2]=c[2]*r+c[6]*s+c[10]*a;t.position.needsUpdate=!0,t.normal.needsUpdate=!0}var x6,w6=z(()=>{tt(),x6=new At});function dT(t){let e=Number(t);return Number.isInteger(e)&&e>=0&&String(e)===t?e:-1}function Vv(t){if(t!=null){if(Array.isArray(t)||ArrayBuffer.isView(t)&&!(t instanceof DataView))return t;if(typeof t=="object")return function(e){let i=Object.keys(e),n=0;for(let s of i){let a=dT(s);a>=n&&(n=a+1)}if(n===0||n>i.length)return;let r=new Array(n);for(let s=0;s<n;s++){let a=e[s];if(typeof a!="number")return;r[s]=a}return r}(t)}}function d2(t){if(t==null)return"missing";if(Array.isArray(t))return`Array(${t.length})`;if(ArrayBuffer.isView(t)){let l=t;return`${t.constructor.name}(${l.length})`}if(typeof t!="object")return typeof t;let e=Object.keys(t),i=e.filter(l=>dT(l)===-1),n=0;for(let l of e){let c=dT(l);c>=n&&(n=c+1)}let r=t,s=-1,a=-1;for(let l=0;l<n;l++)l in r?typeof r[l]!="number"&&a===-1&&(a=l):s===-1&&(s=l);let o=[`${e.length} keys`,"max index "+(n-1)];return s!==-1&&o.push(`first missing index ${s}`),a!==-1&&o.push(`non-number at ${a} (${typeof r[a]})`),i.length&&o.push(`stray keys ${i.slice(0,3).join(",")}`),`Object{${o.join(", ")}}`}function S6(t){let e=Object.keys(t);return e.length===1&&e[0]==="subdivisions"}function D3(t,e){let i=e?e.count:t.count,n=0,r=1e4,s=new Map,a=new Uint32Array(i),o=[];for(let h=0;h<i;h++){let d=e?e.getX(h):h,u=t.getX(d),p=t.getY(d),f=t.getZ(d),g=Math.round(u*r),m=Math.round(p*r),v=Math.round(f*r),y=s.get(g);y===void 0&&(y=new Map,s.set(g,y));let _=y.get(m);_===void 0&&(_=new Map,y.set(m,_));let b=_.get(v);b===void 0&&(b=n++,_.set(v,b),o.push(u,p,f)),a[h]=b}let l=[],c=[];for(let h=0;h<a.length;h+=3)a[h]===a[h+1]||a[h]===a[h+2]||a[h+1]===a[h+2]||(l.push(a[h],a[h+1],a[h+2]),c.push(e?e.getX(h):h,e?e.getX(h+1):h+1,e?e.getX(h+2):h+2));return{positions:o,triIndices:l,triOriginals:c}}var Gf,ec,Qt,u2,p2,f2,Ni,Hf,jv,Gv,Hv,uT,B1,Tp=z(()=>{tt(),wx(),$t(),Sx(),w6(),Xg(),Gf=new ci,ec=new T,P3.then(t=>{Qt=t}),u2=new Float32Array([10,10,0,-10,10,0,-10,-10,0,10,-10,0]),p2=new Uint32Array([0,1,2,3]),f2=new Uint8Array([4]),Ni=class extends jt{constructor(t,e){super(),this.data=t,this.flatShading=e,this.subdivPointer=0,this.rebuild(),this.freeSubdivPointer()}mutateDirectlyScaleBaked(t,e){this.freeSubdivPointer();let i=this.data.scaleBaked.map(a=>typeof a=="number"?a:1),n=dh.div(e.map(a=>typeof a=="number"?a:0),i);if(n.every(a=>a===1))return;this.subdividedGeometry&&cT(this.subdividedGeometry.attributes,...n),this.originalGeometry&&cT(this.originalGeometry.attributes,...n),this.data=t;let r=this.userData.parameters;this.userData.parameters={width:r.width*n[0],height:r.height*n[1],depth:r.depth*n[2]},this.originalGeometry.boundingSphere.center.multiply(ec.fromArray(n));let s=ec.set(r.width,r.height,r.depth).length();this.originalGeometry.boundingSphere.radius=s/2}ensureSubdivPointer(){return this.subdivPointer===0&&this.rebuild(),this.subdivPointer}mutateDirectlySubdivisions(t){this.freeSubdivPointer(),this.data=t;let e=t.phongAngle??35;this.flatShading&&(e=-1);let i=null;if(t.subdivisions>0){let r=0;try{r=Ni.allocate(t),i=Ni.buildRefined(r,t.subdivisions,e)}catch(s){console.error(s,t)}finally{r&&Ni.freeSubdivPointer(r)}}this.subdividedGeometry?.dispose(),this.subdividedGeometry=i??void 0,this.subdividedGeometry&&(this.subdividedGeometry.boundingSphere=this.originalGeometry.boundingSphere);let n=this.userData.parameters;Object.assign(this,this.subdividedGeometry??this.originalGeometry),this.userData.parameters=n}rebuild(){let t,e,i;try{({originalGeometry:t,subdividedGeometry:e,subdivPointer:i}=Ni.build(this.data,void 0,!this.flatShading,void 0))}catch{t=new va(100,100,100),i=0}this.subdivPointer=i,this.originalGeometry=t,this.subdividedGeometry=e??void 0;let n=this.subdividedGeometry??this.originalGeometry;Object.assign(this,n),this.calcBoundingBox()}freeSubdivPointer(){this.subdivPointer&&(Ni.freeSubdivPointer(this.subdivPointer),this.subdivPointer=0)}dispose(){super.dispose(),this.freeSubdivPointer()}calcBoundingBox(){let t=this.originalGeometry;t.boundingSphere===null&&(t.boundingSphere=new yr,this.subdividedGeometry&&(this.subdividedGeometry.boundingSphere=t.boundingSphere));let e=t.attributes.position,i=t.boundingSphere.center;Gf.setFromBufferAttribute(e),Gf.getCenter(i),t.boundingSphere.radius=i.distanceTo(Gf.max),isNaN(t.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this),Gf.getSize(ec);let n={width:ec.x,height:ec.y,depth:ec.z};return this.userData.parameters=n,n}static build(t,e,i,n){let r,s,a=t?.phongAngle??35;i===!1&&(a=-1),e&&(Qt.free_bvh(e),Qt.free_subdivision_surface(e));try{r=Ni.allocate(t,n)}catch(l){console.error(l,t),r=Ni.allocate({positionWASM:u2,indexWASM:p2,verticesPerFaceWASM:f2},n)}Qt.set_destination_refinement_level(r,0);let o=Ni.buildLevel(r,!0,a);return s=t.subdivisions>0?Ni.buildRefined(r,t.subdivisions,a):null,{subdivPointer:r,originalGeometry:o,subdividedGeometry:s}}static buildRefined(t,e,i){try{return Qt.set_destination_refinement_level(t,e),Ni.buildLevel(t,!1,i)??null}catch{try{return Qt.set_destination_refinement_level(t,e-1),Ni.buildLevel(t,!1,i)??null}catch{return null}}}static primitiveToQuads(t,e,i){t.widthSegments>16&&(t.widthSegments=16),t.heightSegments>16&&(t.heightSegments=16),t.depthSegments>16&&(t.depthSegments=16),t.radialSegments>16&&(t.radialSegments=16),t.type==="DodecahedronGeometry"&&(t.detail=0);let n,r=t.shape!==void 0||t.path!==void 0?e.geometry:nh(t,i,!1,e);n=fk(t)?r.getClosedTorusIndicesForBooleanOrSubdiv():r.getIndex();let s,{positions:a,triIndices:o,triOriginals:l}=D3(r.getAttribute("position"),n);if(t.type==="CylinderGeometry"&&t.cornerRadius===0&&t.hollow===0&&t.openEnded===!1){let u=t.radialSegments*t.heightSegments*3*2;s=[u,u+3*t.radialSegments]}let{indices:c,verticesPerFace:h,uvs:d}=function(u,p,f,g,m){let v=[],y=[],_=m?f.getAttribute("uv"):void 0,b=_&&_.itemSize===2?[]:void 0,x=E=>{if(b){let A=m[E];b.push(_.getX(A),_.getY(A))}};if(f.userData.shape!==void 0&&f.userData.parameters.depth===0&&f.userData.shape.shapeHoles.length===0){let E=f.userData.shape.extractShapePointsToFlatArray([]),A=f.userData.parameters.spikes;if(f.userData.type==="EllipseGeometry"&&A<=24&&A%4==0&&f.userData.parameters.angle>=360){let R=E.length/2/A;E=E.filter((L,D)=>Math.floor(D/2)%R===0)}let P=0;for(let R=0;R<E.length;R+=2)P+=(E[R]-E[(R===0?E.length:R)-2])*(E[R+1]+E[(R===0?E.length:R)-1]);u.length=0;let C=0;if(P<0)for(let R=0;R<E.length;R+=2)u.push(E[R],E[R+1],0),v.push(C++);else for(let R=E.length-2;R>=0;R-=2)u.push(E[R],E[R+1],0),v.push(C++);return y.push(C),{indices:v,verticesPerFace:y}}let w=new Float32Array([f.userData.parameters.depth])[0],S=0;for(;S<p.length;){if(f.useNgonForTopBottomFaceDuringBake){let E=0;if((u[3*p[S]+2]===w||u[3*p[S]+2]===0)&&E++,(u[3*p[S+1]+2]===w||u[3*p[S+1]+2]===0)&&E++,(u[3*p[S+2]+2]===w||u[3*p[S+2]+2]===0)&&E++,E===3)break}if(p[S+1]===p[S+3]&&p[S+2]===p[S+5]||p[S+0]===p[S+3]&&p[S+2]===p[S+4]){Hf.set(u[3*p[S]],u[3*p[S]+1],u[3*p[S]+2]),jv.set(u[3*p[S+1]],u[3*p[S+1]+1],u[3*p[S+1]+2]),Gv.set(u[3*p[S+4]],u[3*p[S+4]+1],u[3*p[S+4]+2]),Hv.set(u[3*p[S+5]],u[3*p[S+5]+1],u[3*p[S+5]+2]),jv.sub(Hf).normalize(),Gv.sub(Hf).normalize(),Hv.sub(Hf).normalize();let E=jv.cross(Gv).dot(Hv),A=S;Math.abs(E)>.005||g&&g.some((P,C)=>C%2!=1&&A>=g[C]&&A<g[C+1])?(v.push(p[S],p[S+1],p[S+2]),x(S),x(S+1),x(S+2),y.push(3),S+=3):(v.push(p[S],p[S+1],p[S+4],p[S+5]),x(S),x(S+1),x(S+4),x(S+5),y.push(4),S+=6)}else v.push(p[S],p[S+1],p[S+2]),x(S),x(S+1),x(S+2),y.push(3),S+=3}if(f.useNgonForTopBottomFaceDuringBake){let E=[],A=[],P=0;for(let C=0,R=0;C<u.length;C+=3,R++)u[C+2]===0&&(E.push(R),P++),u[C+2]===w&&A.push(R);if(f.userData.parameters.extrudeBevelSize===0){let C=A[0];A[0]=A[1],A[1]=C}E.reverse(),v.push(...E,...A),y.push(P,P),b=void 0}return{indices:v,verticesPerFace:y,uvs:b}}(a,o,r,s,l);return{positions:a,indices:c,verticesPerFace:h,uvs:d}}static allocate(t,e){let i,n,r,s=[],a=[],o=Vv(t.positionWASM),l=Vv(t.indexWASM),c=Vv(t.verticesPerFaceWASM);if(o&&o.length>0){if(!l?.length||!c?.length)throw new Error(`SubdivGeometry.allocate: unusable cage topology \u2014 positionWASM ${d2(t.positionWASM)}, indexWASM ${d2(t.indexWASM)}, verticesPerFaceWASM ${d2(t.verticesPerFaceWASM)}`);i=o,n=l,r=c;let S=Vv(t.uvWASM);Qt.alloc_subdivision_surface_uvs&&S&&S.length===2*n.length&&(a=S)}else i=u2,n=p2,r=f2;let h=i.length,d=n.length,u=r.length,p=i.length+s.length+a.length,f=n.length+r.length,g=p*Float32Array.BYTES_PER_ELEMENT+f*Uint32Array.BYTES_PER_ELEMENT,m=p*Float32Array.BYTES_PER_ELEMENT,v=Qt._malloc(g);if(!v)throw new Error(`SubdivGeometry.allocate: wasm _malloc(${g}) failed`);let y,_=new Float32Array(Qt.HEAPF32.buffer,v,p),b=new Uint32Array(Qt.HEAPU32.buffer,v+m,f);_.set(i,0),_.set(s,i.length),_.set(a,i.length+s.length),b.set(n,0),b.set(r,n.length),t?.scaleBaked?.some(S=>S!==1)&&(y=new At().makeScale(...t.scaleBaked.map(S=>typeof S=="number"?S:1))),e&&(y?y.premultiply(e):y=e);let x=v+(i.length+s.length)*Float32Array.BYTES_PER_ELEMENT,w=a.length?y?Qt.alloc_subdivision_surface_uvs2(v,h,v+m,d,v+m+n.length*Uint32Array.BYTES_PER_ELEMENT,u,x,a.length,y.elements):Qt.alloc_subdivision_surface_uvs(v,h,v+m,d,v+m+n.length*Uint32Array.BYTES_PER_ELEMENT,u,x,a.length):y?Qt.alloc_subdivision_surface2(v,h,v+m,d,v+m+n.length*Uint32Array.BYTES_PER_ELEMENT,u,y.elements):Qt.alloc_subdivision_surface(v,h,v+m,d,v+m+n.length*Uint32Array.BYTES_PER_ELEMENT,u);return Qt._free(v),w}static buildLevel(t,e,i,n,r,s=!1){let a=r?Qt.get_mesh_data2(t,e?Qt.Level.CONTROL:Qt.Level.REFINED,i,r.elements):Qt.get_mesh_data(t,e?Qt.Level.CONTROL:Qt.Level.REFINED,i),o=Qt.HEAPU32.subarray(a>>2,10+(a>>2)),l=o.subarray(4,8),c=0,h=Qt.HEAPU32[o[c]>>2],d=Qt.HEAPF32.subarray(h>>2,(h>>2)+l[c]);c++;let u=Qt.HEAPU32[o[c]>>2],p=Qt.HEAPF32.subarray(u>>2,(u>>2)+l[c]);c++;let f=Qt.HEAPU32[o[c]>>2],g=Qt.HEAPU32.subarray(f>>2,(f>>2)+l[c]);c++;let m,v=Qt.HEAPU32[o[c]>>2],y=Qt.HEAPU32.subarray(v>>2,(v>>2)+l[c]);if(c++,Qt.alloc_subdivision_surface_uvs){let b=o[9];if(b>0){let x=Qt.HEAPU32[o[8]>>2];m=Qt.HEAPF32.subarray(x>>2,(x>>2)+b)}}if(n===void 0){let b=new jt;if(b.setIndex(new lh(y,1)),b.setAttribute("position",new Nt(d,3)),b.setAttribute("normal",new Nt(p,3)),m&&b.setAttribute("uv",new Nt(m,2)),e){b.setAttribute("faceMap",new lh(g,1));let x=new Float32Array(p.length/3*4).fill(0);b.setAttribute("color",new Ht(x,4))}return Qt.free_mesh_data(a),b.userData.type="SubdivGeometry",b}if(n.getAttribute("position").copyArray(d),n.getAttribute("normal").copyArray(p),n.attributes.position.needsUpdate=!0,n.attributes.normal.needsUpdate=!0,s){let b=n.getIndex();b!==null&&b.array.length===y.length&&(b.copyArray(y),b.needsUpdate=!0)}let _=n.getAttribute("uv");m&&_&&_.array.length===m.length&&(_.copyArray(m),_.needsUpdate=!0),Qt.free_mesh_data(a)}static freeSubdivPointer(t){Qt.free_bvh(t),Qt.free_subdivision_surface(t)}static buildControlCageWireframe(t,e,i){let n=Qt.get_wireframe_data_for_base_level(t),r=Qt.HEAPU32.subarray(n>>2,4+(n>>2)),s=r.subarray(2,4),a=0,o=Qt.HEAPU32[r[a]>>2],l=Qt.HEAPF32.subarray(o>>2,(o>>2)+s[a]);a++;let c=Qt.HEAPU32[r[a]>>2],h=Qt.HEAPU32.subarray(c>>2,(c>>2)+s[a]);if(e===void 0){let d=new jt;d.setAttribute("position",new Nt(l,3));let u=new Float32Array(l.length);for(let p=0,f=l.length;p<f;)u[p++]=i.r,u[p++]=i.g,u[p++]=i.b;return d.setAttribute("color",new Ht(u,3)),d.setIndex(new lh(h,1)),Qt.free_wireframe_data_for_base_level(n),d}e.getAttribute("position").copyArray(l),e.attributes.position.needsUpdate=!0,Qt.free_wireframe_data_for_base_level(n)}static updateCollabMesh(t,e,i){let n=e===0;n||Qt.set_destination_refinement_level(t,e);let r=i?Qt.get_topological_data2(t,n?Qt.Level.CONTROL:Qt.Level.REFINED,i.elements):Qt.get_topological_data(t,n?Qt.Level.CONTROL:Qt.Level.REFINED),s=Qt.HEAPU32.subarray(r>>2,8+(r>>2)),a=s.subarray(3,6),o=0,l=Qt.HEAPU32[s[o]>>2],c=new Float32Array(Qt.HEAPF32.subarray(l>>2,(l>>2)+a[o]));o++;let h=Qt.HEAPU32[s[o]>>2],d=new Uint32Array(Qt.HEAPU32.subarray(h>>2,(h>>2)+a[o]));o++;let u,p=Qt.HEAPU32[s[o]>>2],f=new Uint8Array(Qt.HEAPU32.subarray(p>>2,(p>>2)+a[o]));if(Qt.alloc_subdivision_surface_uvs){let g=s[7];if(g>0){let m=Qt.HEAPU32[s[6]>>2];u=new Float32Array(Qt.HEAPF32.subarray(m>>2,(m>>2)+g))}}return Qt.free_topological_data(r),{positions:c,indices:d,verticesPerFace:f,uvs:u}}},Hf=new T,jv=new T,Gv=new T,Hv=new T}),M6=z(()=>{R4(),I4(),vb(),O4(),xb(),Xg(),Q4(),J4(),tL(),aT(),nL(),wb(),rL(),sL(),aL(),oT(),oL(),lL(),hL(),cL(),mh(),ke(),R4(),I4(),vb(),O4(),xb(),$Y(),Xg(),Q4(),J4(),tL(),aT(),nL(),wb(),rL(),sL(),aL(),oT(),oL(),lL(),hL(),cL(),mh(),YY(),Zk(),_6(),Tp(),wx(),_x(),Ap(),uT={ConeGeometry:Rk,CubeGeometry:Ik,CylinderGeometry:x3,DodecahedronGeometry:Ok,EllipseGeometry:bx,HelixGeometry:mk,IcosahedronGeometry:s6,LatheGeometry:a6,NonParametricGeometry:l6,PolygonGeometry:T3,PyramidGeometry:h6,RectangleGeometry:xx,SphereGeometry:u6,PlaneGeometry:p6,BackdropGeometry:f6,StarGeometry:C3,TextFrameGeometry:m6,TorusGeometry:g6,TorusKnotGeometry:v6,TriangleGeometry:y6,VectorGeometry:Sh},B1=t=>{let e=uT[t.type]??ik(t.type);if(e===void 0)throw new Error(`No geometry factory registered for "${t.type}" \u2014 was its feature compiled out of this runtime build?`);return e.create(t)}});function nh(t,e,i,n){let r,s,a;t.type==="PathGeometry"?(s={...t,extrusion:{...t.extrusion}},a=[[],["extrusion"]]):(s={...t},a=[[]]);for(let c of a){let h=s;for(let d of c)h=h[d];for(r in h){let d=h[r];KI(d)&&!E6.includes(r)&&(h[r]=e.getVariable(d,[n.uuid,"geometry",...c,r]),KI(h[r])&&(h[r]=1))}}let o,l={parameters:s,type:s.type};if(s.type==="PathGeometry"){l.path=s.path;let c=n.profileShape;c!==void 0&&(l.shapeData=c),l.ownerId=n.uuid}else if(s.type==="VectorGeometry"){let c=ki.createFromState(s.shape,s.width,s.height);l.shape=c,l.ownerId=n.uuid}else if(s.type==="NonParametricGeometry"){if(s.data.groups&&s.data.groups?.forEach(c=>c.materialIndex=Math.max(c.materialIndex??0,0)),l.geometry=new LC().parse(s),l.geometry.groups.length===0){let c=l.geometry;c.addGroup(0,Math.max(c.getIndex()?.count??0,c.getAttribute("position").count),0)}}else{if(s.type==="SubdivGeometry"){let c=new Ni(s,i);return c.data=t,c}if(s.type==="TextGeometry"||s.type==="InputGeometry"){let c=ik(s.type);if(c)return c.create(s,e);Gn("text",`a ${s.type}`);let h=ki.createFromState(Hg.defaultData(),100,100);return B1({...s,shape:h,type:"VectorGeometry"})}if(s.type==="UIGeometry")return xx.create({parameters:{width:s.width,height:s.height,cornerRadius:s.cornerRadius,cornerType:s.cornerType}})}try{o=B1(l)}catch(c){console.error(c),console.error(`Error generating geometry with inputs: ${l}`);let h=ki.createFromState(Hg.defaultData(),100,100);l.shape=h,l.type="VectorGeometry",o=B1(l)}return o}var E6,fL,pT,Sx=z(()=>{$t(),tt(),M6(),ke(),wb(),wh(),Tp(),E6=["font"]}),KY=z(()=>{Sx(),fL=class{constructor(){this.objects=new Map,this.unreachable=new Set}getCached(t){return this.objects.get(t)}get size(){return this.objects.size}get(t,e,i){let n=this.objects.get(t);return n===void 0?(n=this.createObject(t,e,i),this.objects.set(t,n)):n.isShared=!0,n}forceDelete(t){let e=this.objects.get(t);e&&(this.disposeObject(e),this.objects.delete(t))}adopt(t,e){this.objects.set(t,e)}mutateIfUnique(t,e){let i=this.objects.get(t);if(i&&i.isShared!==!0)return this.objects.delete(t),this.objects.set(e,i),i}startGc(){this.unreachable=new Set(this.objects.keys())}markAsReachable(t,e){e===this.objects.get(t)&&this.unreachable.delete(t)}endGc(){this.unreachable.forEach(t=>{this.disposeObject(this.objects.get(t)),this.objects.delete(t)}),this.unreachable.clear()}dispose(){this.objects.forEach(t=>{this.disposeObject(t)}),this.objects.clear()}},pT=class extends fL{constructor(t){super(),this.flatShading=t}disposeObject(t){t.dispose()}createObject(t,e,i){let n=nh(t,e,this.flatShading,i);return n.computeBoundingSphere(),n}}});function Sb(){return Mx}function A6(){if(Mx==="webgpu"){if(vL!==void 0)return vL;mT||(mT=!0,console.warn('[spe] Material backend is "webgpu" but no TSL material factory is registered \u2014 import spe/src/renderer/webgpu before creating materials. Falling back to WebGL materials.'))}if(fT===void 0)throw new Error('[spe] Classic (WebGL) materials are not available in this build \u2014 it was compiled WebGPU-only. Re-export the scene with renderer "Both" or "WebGL 2", or load the full runtime.');return fT}function T6(t,e){return A6().createRootMaterial(t,e)}function mL(t,e,i){return A6().createSharedMaterial(t,e,i)}function gL(t){return t.getLayersOfType===void 0&&Object.assign(t,{layers:[],getLayersOfType:()=>[],hasAO:!1,assetsLoaded:()=>!0}),t}function C6(){return QY}var Mx,vL,fT,mT,gT,QY,vT,P6,Mh=z(()=>{Mx="webgl",mT=!1}),JY=z(()=>{P6={markNeedsUpdateRendererDirty:()=>{}}});function Oc(t,e){let i=0;if(!t.layers||t.layers.length===0)return!1;let n=t.layers?.find(r=>r.data.type==="light");if(n){let r=n.data,s=Number(e.getVariable(r.alphaOverride));if((typeof r.alphaOverride=="string"?s/100:r.alphaOverride)<1)return!0}for(let r of t.layers){if(r.data.type!=="displace"&&r.data.isMask)return!0;if(r.data.type!=="displace"&&"alpha"in r.data&&r.data.type!=="light"&&r.data.type!=="fresnel"&&r.data.type!=="cavity"&&r.data.type!=="dust"&&r.data.type!=="texture"&&r.data.type!=="matcap"&&r.data.type!=="rainbow"&&r.data.type!=="outline"&&r.data.type!=="pattern"){let s=r.data.visible?r.data.alpha:0;if(typeof s=="string"&&(s=Math.max(0,Math.min(1,Number(e.getVariable(s)??100)/100))),s===1&&r.data.type==="depth"||r.data.type==="gradient"){for(let a of r.data.colors)if(a[3]<1){s=a[3];break}}else if(s===1&&r.data.type==="noise"){let a=e.color(r.data.colorA).a,o=e.color(r.data.colorB).a,l=e.color(r.data.colorC).a,c=e.color(r.data.colorD).a,h=Math.min(a,Math.min(o,Math.min(l,c)));h<1&&(s=h)}i+=(1-i)*s}}return i<1}var R3=z(()=>{});function vp(t){return typeof t=="string"||typeof t=="number"&&t!==0}var gh,Xt,Ex,D6,yL,_L,_s,hl=z(()=>{gh=(t,e,i)=>Math.max(0,Math.min(1,Number(e.getVariable(typeof t=="number"?100*t:t,i)??100)/100))??1,Xt=(t,e,i)=>typeof t=="number"?t:e.getVariable(t,i),Ex={noise:["noiseType"],texture:["projection","axis","projectionAxis","side"],video:["projection","axis","projectionAxis","side"],displace:["noiseType"],light:["roughnessMap","bumpMap","roughnessMapChannel","metalnessMap","metalnessMapChannel","normalMap","aoMap","aoMapChannel","emissiveMap"],depth:["smooth","isWorldSpace","gradientType","isVector"],pattern:["style","projection","axis"],reflection:["tracingMode","mirror"]},D6={depth:["colors"],gradient:["colors","steps"],toon:["colors","steps"]}}),Cp=z(()=>{tt(),l0(),yL=class extends gx(_i){},_L=t=>t.type==="Mesh",_s=class extends yL{constructor(t){super(),this.object=t,this.isClone=!0,this.matrixAutoUpdate=!1,this.hasNonUniformScale=t.hasNonUniformScale}raycast(t,e){}expand(){let t=0,e=this.object.entityChildren(t);for(;e;){let i=this.children[t];i?.object!==e&&(i&&this.remove(i),i=new _s(e),this.add(i),this.children.splice(t,0,this.children.pop()),i.matrixWorldNeedsUpdate=!0,i.matrixAutoUpdate=!1,i.matrix=e.matrix,i.hiddenMatrix=e.hiddenMatrix,i.pivotMatrix=e.pivotMatrix),i.expand(),t+=1,e=this.object.entityChildren(t)}for(;this.children.length>t;)this.remove(this.children[t]);this.pivotMatrix=this.object.pivotMatrix}get visible(){let t=this.object.cloner;return(t===void 0||this.parent!==t||!t.instancingActive&&!t.insideBoolean)&&(this.playModeVisible!==void 0?this.playModeVisible:this.object.visible||this.object.dataPatched.visible&&this.object.dataPatched.cloner?.hideBase===!0)}set visible(t){}get castShadow(){return this.object.castShadow}set castShadow(t){}get receiveShadow(){return this.object.receiveShadow}set receiveShadow(t){}get isMesh(){return _L(this.object)}get isLight(){return this.object.isLight}get layers(){return this.object.layers}set layers(t){}get isCamera(){return!1}get geometry(){if(this.object.geometry)return this.object.geometry}get material(){if(this.object.material)return this.object.material}get morphTargetInfluences(){if(this.object.morphTargetInfluences)return this.object.morphTargetInfluences}set morphTargetInfluences(t){}}});function bL(){return I3}var I3,O3,L3=z(()=>{I3=null,O3=null});function yT(t){return"variable_"+t}var m2,g2,v2,xL,y2,wL,_2,SL,Mb,B3=z(()=>{$t(),Mk(),Tk(),v3(),_a(),y3(),b3(),KY(),Mh(),Ak(),JY(),R3(),hl(),qr(),Cp(),Ye(),tt(),L3(),ke(),m2=new At,g2=new T,v2=new Wt,xL=new T,y2=new xi,wL=class extends wk{constructor(t){super(),this.shared=t}create(t){return new g3(t,this.shared)}},_2=new Set,(Mb=SL=class{constructor(t,e={},i=!0,n=!1){if(this.data=t,this.needsJitter=i,this.enableLocalStorageForPersistentVariables=n,this.geometryCache=new pT(!0),this.geometryCache2=new pT(!1),this.imageHolderCache=new wL(this),this.thisContext={scene:P6,shared:this},this.deletedImage=new Ko(OA.emptyImage,this),this.deletedVideo=new Ko(Q_.defaultVideo,this),this.materials={},this.images={},this.uiBuffers={},this.videos={},this.colors={},this.audios={},this.particles={},this.fonts={},this.variables={},this.userAPIs={},this.userWebhooks={},this.mouseProperty=null,this.raycastProperty=null,this.requestRender=()=>{this._requestRender&&this._requestRender()},this.transientGeometryKeys=new WeakSet,e.images)for(let[r,s]of Object.entries(e.images))this.addImage(r,s);if(e.videos)for(let[r,s]of Object.entries(e.videos))this.addVideo(r,s);if(e.audios)for(let[r,s]of Object.entries(e.audios))this.addAudio(r,s);if(e.particles)for(let[r,s]of Object.entries(e.particles))this.addParticle(r,s);this.reset(t)}get deletedMaterial(){return this._deletedMaterial??(this._deletedMaterial=mL(Vi.defaultTwoLayerData("phong"),this.thisContext,"")),this._deletedMaterial}setRequestRender(t){this._requestRender=t}getImageLoadPromises(){return Object.values(this.images).map(t=>t.loadPromise)}setEntityOpContext(t){this.entityOpContext=t}reset(t,e=!1,i=!1){this.data=t,this.resetLib(t.lib);for(let{id:n,data:r}of t.variables)this.addVariableHolder(n,r),e&&this.updateVariableHolder(n,r);for(let[n,r]of Object.entries(t.userAPIs??{}))this.addUserAPI(n,r);for(let[n,r]of Object.entries(t.userWebhooks??{}))this.addUserWebhook(n,r);if(!i){for(let[n,r]of Object.entries(t.images))this.addImage(n,r);for(let[n,r]of Object.entries(t.videos))this.addVideo(n,r)}for(let[n,r]of Object.entries(t.colors))this.addColor(n,r);for(let[n,r]of Object.entries(t.lib.materials))this.addMaterial(n,r.asset);for(let[n,r]of Object.entries(t.materials))this.addMaterial(n,r);for(let[n,r]of Object.entries(t.audios))this.addAudio(n,r);for(let[n,r]of Object.entries(t.particles))this.addParticle(n,r);for(let[n,r]of Object.entries(t.fonts))this.addFont(n,r)}addMaterial(t,e){if(e.layers===void 0&&(e={...e,layers:Vi.defaultTwoLayerData("phong").layers}),this.materials[t]){let i=this.materials[t];i.reset(e,this.thisContext),i.dispose()}else{let i=mL(e,this.thisContext,t);this.materials[t]=i}}deleteMaterial(t){this.materials[t]&&(this.materials[t].nodeMaterialDispose(),delete this.materials[t])}getMaterial(t){return this.materials[t]}getMaterialOrDeletedPlaceholder(t){return this.materials[t]??this.deletedMaterial}material(t){return typeof t=="string"?this.getMaterialOrDeletedPlaceholder(t):t==null?(console.error("material is undefined or null"),this.deletedMaterial):(t.layers===void 0&&(t={...t,layers:Vi.defaultTwoLayerData("phong").layers}),T6(t,this.thisContext))}getMaterials(){return this.materials}addImage(t,e){return this.images[t]?(this.onColorOrImageUpdate&&this.onColorOrImageUpdate(),this.images[t].updateSrc(e.data),!0):(this.images[t]=new Ko(e,this),!1)}deleteImage(t){let e=this.images[t];e&&(e.dispose(),delete this.images[t])}getDefaultImage(){return this.images.image_0}getImage(t){return this.images[t]??this.deletedImage}image(t){return typeof t=="string"?this.getImage(t):this.imageHolderCache.load(t)}addUIBuffer(t,e){return this.uiBuffers[t]?(this.onColorOrImageUpdate&&this.onColorOrImageUpdate(),this.uiBuffers[t].updateSrc(e),!0):(this.uiBuffers[t]=new Ko(e,this),!1)}uiBuffer(t){return this.uiBuffers[t]}getEntityTexture(t,e={}){let i=t.material;if(!i)return null;for(let n of Array.isArray(i)?i:[i]){let r=n.root??n;for(let s of r?.data?.layers??[]){let a=s?.data;if(a?.type!=="texture"&&a?.type!=="matcap"||e.layer!==void 0&&s.id!==e.layer&&a.type!==e.layer)continue;let o=a.texture?.image;if(o==null)continue;let l=(typeof o=="string"?this.uiBuffer(o):void 0)??this.image(o);if(!l)continue;let c=l.getTexture(a.texture.wrapping??(a.type==="texture"?1e3:1001),a.texture.minFilter??1008,a.texture.magFilter??1006),h=l.img;return{texture:c,width:h?.width??0,height:h?.height??0,layerId:s.id,layerType:a.type}}}return null}addVideo(t,e){return this.videos[t]?(this.videos[t].updateSrc(e.data),!0):(this.videos[t]=new Ko(e,this),!1)}deleteVideo(t){let e=this.videos[t];e&&(e.dispose(),delete this.videos[t])}getVideo(t){return this.videos[t]??this.deletedVideo}video(t){return typeof t=="string"?this.getVideo(t):this.imageHolderCache.load(t)}addColor(t,e){return this.colors[t]?(this.onColorOrImageUpdate&&this.onColorOrImageUpdate(),"a"in e?this.colors[t].setRGBA(e.r,e.g,e.b,e.a):this.colors[t].setRGBA(e.r,e.g,e.b,1),!0):(this.colors[t]=new Zg(e.r,e.g,e.b,"a"in e?e.a:1),!1)}updateColor(t,e){if(this.colors[t]){this.onColorOrImageUpdate&&this.onColorOrImageUpdate();let i=this.colors[t];return this.colors[t].r=e.r??i.r,this.colors[t].g=e.g??i.g,this.colors[t].b=e.b??i.b,this.colors[t].a=e.a??i.a,!0}return!1}deleteColor(t){this.colors[t]&&delete this.colors[t]}getColor(t){return this.colors[t]}getColorNames(){return Object.values(this.data.colors).map(t=>t.name)}getColorByName(t){for(let e in this.data.colors)if(this.data.colors[e].name===t)return{color:this.colors[e],id:e}}color(t){let e;if(typeof t!="string")return new yn(t.r,t.g,t.b,"a"in t?t.a:1);{let i=this.getColor(t);i?e=i:(console.warn("Tried to create color layer params with a color key that does not exist in the assets manager"),e=new yn(0,0,0,0))}return e}addAudio(t,e){this.audios[t]=e}getAudio(t){let e=this.audios[t];if(e instanceof Fu)return e;{let i=new Fu({src:e.data});return this.audios[t]=i,i}}addParticle(t,e){this.particles[t]=e}getParticle(t){return this.particles[t]}deleteParticle(t){this.particles[t]&&delete this.particles[t]}deleteAudio(t){let e=this.audios[t];e&&(e instanceof Fu&&e.dispose(),delete this.audios[t])}addFont(t,e){let i=_3;i!==null?(this.fonts[t]=new i(e),this.fonts[t].loadingPromise.then(()=>this.requestRender())):Gn("text","a font asset")}getFont(t){return this.fonts[t]}deleteFont(t){this.fonts[t]&&delete this.fonts[t]}dispose(){Object.keys(this.materials).forEach(t=>this.deleteMaterial(t)),this._requestRender=void 0,Object.values(this.audios).forEach(t=>{t instanceof Fu&&t.dispose()}),this.audios={},this.particles={},this.geometryCache.dispose(),this.geometryCache2.dispose()}addVariableHolder(t,e){if(this.variables[t]===void 0){let i=e.value;if(this.enableLocalStorageForPersistentVariables&&e.persistent){let n=localStorage.getItem(yT(t));i=n!==null?JSON.parse(n):e.value}return this.variables[t]={value:i,locations:[],persistent:e.persistent},"dynamicVariableType"in e&&(this.variables[t].dynamicVariablePlayState="Playing",this.variables[t].dynamicVariableToggleIsForward=void 0),!0}return this.variables[t].value=e.value,!1}resetDynamicVariablePlayState(){for(let t in this.variables)this.variables[t].dynamicVariablePlayState!==void 0&&(this.variables[t].dynamicVariablePlayState="Playing",this.variables[t].dynamicVariableToggleIsForward=void 0)}updateVariableHolder(t,e){this.updateVariable(t,e.value)}updateVariable(t,e){if(this.variables[t]===void 0)return!1;this.variables[t].value=e,this.enableLocalStorageForPersistentVariables&&this.variables[t].persistent&&localStorage.setItem(yT(t),JSON.stringify(e));let i=e;for(;typeof i=="string";)i=this.variables[i].value;let n=this.entityOpContext.scene,r=!1;for(let s=this.variables[t].locations.length-1;s>=0;s--){let a=this.variables[t].locations[s];if(a[0]==="material"){let o=a[1],l=i,c={scene:n,shared:this},h=a.slice(2);n.traverseMaterial(u=>{let p=u.root??u;p.uuid===o&&p.onVariableUpdate(h,l,c)});let d=this.materials[o];d&&d.onVariableUpdate(h,l,c)}else{let o=n.find(a[0]);if(o===void 0){this.variables[t].locations.splice(s,1);continue}if(r=!0,a[1]!=="geometry"&&a[1]!=="particles"){for(let l=1;l<a.length-1;l++)o=o[a[l]];a[1]==="rotation"?o[a[a.length-1]]=i*Ot.DEG2RAD:o[a[a.length-1]]=i}if(o=n.find(a[0]),o.type==="ParticleEmitter"&&o.updateVariableState(i,a),Be.is(o))if(a[1]==="position"||a[1]==="rotation"||a[1]==="scale")o.onVariableUpdate();else if(a[1]==="geometry"){let l=o;o.component&&(l=o.component);let c=l.dataPatched;l.chooseGeoemtryCache(this).forceDelete(c.geometry),l.createGeometryDelayed(this.entityOpContext),l.onVariableUpdate(!0),l.invalidateDownstreamBooleanData(),l.instances.forEach(h=>{let d=h.dataPatched;h.chooseGeoemtryCache(this).forceDelete(d.geometry),h.createGeometryDelayed(this.entityOpContext),h.onVariableUpdate(!0),h.invalidateDownstreamBooleanData()})}else a[1]==="morphTargetInfluences"&&o.updateMorphInfluences(a[2],i)}}return r&&n.markShadowsDirty(),this.requestRender(),!0}updateEntityGeometryParams(t,e){let i=t;if(i.component&&(i=i.component),typeof i.chooseGeoemtryCache!="function")return!1;let n=i.dataPatched,r=n?.geometry;if(!r||typeof r.type!="string"||r.type==="VectorGeometry"||r.type==="PathGeometry")return!1;let s=c=>c.toLowerCase().replace(/[\s_.-]+/g,""),a=new Map;for(let c of Object.keys(r))a.set(s(c),c);let o={};for(let[c,h]of Object.entries(e??{})){let d=a.get(s(c));if(d===void 0||d==="type"||d==="font"||d==="shape"||d==="path"||d==="data")continue;if(d==="text"){(typeof h=="string"||typeof h=="number")&&(o[d]={textValue:String(h)});continue}let u=r[d];typeof h=="number"&&isFinite(h)&&(typeof u=="number"||typeof u=="string")&&(o[d]=h)}if(Object.keys(o).length===0)return!1;let l={...r,...o};return i.dataPatched={...n,geometry:l},this.transientGeometryKeys.has(r)&&i.chooseGeoemtryCache(this).forceDelete(n.geometry),this.transientGeometryKeys.add(l),i.createGeometryDelayed(this.entityOpContext),i.onVariableUpdate(!0),i.invalidateDownstreamBooleanData(),this.entityOpContext.scene.markShadowsDirty(),this.requestRender(),!0}resetEntityGeometryParams(t){let e=t;if(e.component&&(e=e.component),typeof e.chooseGeoemtryCache!="function")return!1;let i=e.dataPatched?.geometry;return!(!i||!this.transientGeometryKeys.has(i)||(e.dataPatched=e.data,e.chooseGeoemtryCache(this).forceDelete(i),e.createGeometryDelayed(this.entityOpContext),e.onVariableUpdate(!0),e.invalidateDownstreamBooleanData(),this.entityOpContext.scene.markShadowsDirty(),this.requestRender(),0))}updateEntityGeometryVertices(t,e){let i=t;if(i.component&&(i=i.component),typeof i.chooseGeoemtryCache!="function")return!1;let n=i.dataPatched,r=n?.geometry;if(!r||r.type!=="NonParametricGeometry")return!1;let s=e?.vertices;if(s===void 0||typeof s.length!="number"||s.length<9||s.length%3!=0||s.length/3>SL.MAX_TRANSIENT_VERTICES)return!1;let a,o,l,c=s instanceof Float32Array?s:Float32Array.from(s),h=c.length/3;if(e.normals!==void 0){if(e.normals.length!==c.length)return!1;a=e.normals instanceof Float32Array?e.normals:Float32Array.from(e.normals)}if(e.uvs!==void 0){if(e.uvs.length!==2*h)return!1;o=e.uvs instanceof Float32Array?e.uvs:Float32Array.from(e.uvs)}if(e.indices!==void 0){let x=h>65535?Uint32Array.from(e.indices):Uint16Array.from(e.indices);if(x.length===0||x.length%3!=0)return!1;for(let w=0;w<x.length;w++)if(x[w]>=h)return!1;l={array:x,itemSize:1,type:x.constructor.name,normalized:!1}}else{let x=r.data,w=x?.index;if(w?.array?.length){let S=(x?.attributes?.position?.array?.length??0)/3;if(h!==S)return function(E,A){let P=`${E}/${A}`;_2.has(P)||(_2.add(P),console.warn(`[spline] updateObject: ignoring a geometry update of ${E} vertices for a mesh that holds ${A}. Without \`indices\` the write is taken as a morph of the mesh's own vertices, which only means anything at the same count \u2014 send \`indices\` alongside \`vertices\` to replace the topology too.`))}(h,S),!1;l=w}}let d=1/0,u=1/0,p=1/0,f=-1/0,g=-1/0,m=-1/0;for(let x=0;x<c.length;x+=3){let w=c[x],S=c[x+1],E=c[x+2];w<d&&(d=w),w>f&&(f=w),S<u&&(u=S),S>g&&(g=S),E<p&&(p=E),E>m&&(m=E)}let v=(x,w)=>({array:x,itemSize:w,type:"Float32Array",normalized:!1}),y={position:v(c,3)};a&&(y.normal=v(a,3)),o&&(y.uv=v(o,2));let _={...r,width:f-d,height:g-u,depth:m-p,data:{attributes:y,...l?{index:l}:{}}},b=this.transientGeometryKeys.has(r);return i.dataPatched={...n,geometry:_},this.transientGeometryKeys.add(_),i.applyTransientGeometryData(this.entityOpContext,b),i.onVariableUpdate(!0),i.invalidateDownstreamBooleanData(),this.entityOpContext.scene.markShadowsDirty(),this.requestRender(),!0}setEntityInstanceTransforms(t,e){let i=t;i.component&&(i=i.component);let n=i.cloner;if(n===void 0)return-1;let r=n.children,s=Math.PI/180,a=!1;if(e===null)for(let o of r)o.transformOverride!==void 0&&(o.transformOverride=void 0,a=!0);else{if(!Array.isArray(e))return r.length;{let o=Math.min(e.length,r.length);for(let l=0;l<o;l++){let c=e[l],h=r[l];if(c==null){h.transformOverride!==void 0&&(h.transformOverride=void 0,a=!0);continue}let d=h.transformOverride??{position:[h.position.x,h.position.y,h.position.z],rotation:[h.rotation.x,h.rotation.y,h.rotation.z],scale:[h.scale.x,h.scale.y,h.scale.z]};c.position&&(typeof c.position.x=="number"&&(d.position[0]=c.position.x),typeof c.position.y=="number"&&(d.position[1]=c.position.y),typeof c.position.z=="number"&&(d.position[2]=c.position.z)),c.rotation&&(typeof c.rotation.x=="number"&&(d.rotation[0]=c.rotation.x*s),typeof c.rotation.y=="number"&&(d.rotation[1]=c.rotation.y*s),typeof c.rotation.z=="number"&&(d.rotation[2]=c.rotation.z*s)),c.scale&&(typeof c.scale.x=="number"&&(d.scale[0]=c.scale.x),typeof c.scale.y=="number"&&(d.scale[1]=c.scale.y),typeof c.scale.z=="number"&&(d.scale[2]=c.scale.z)),h.transformOverride=d,h.position.fromArray(d.position),h.rotation.fromArray(d.rotation),h.scale.fromArray(d.scale),h.updateMatrix(),h.hasNonUniformScale&&(h.updateMatrixWorld(),h.updateMatrixWorldRigid())}}}return a?n.update(this.entityOpContext):n.syncInstanceMatrices(),n.invalidateTransform(i),this.entityOpContext.scene.markShadowsDirty(),this.requestRender(),r.length}spawnRuntimeClone(t,e={}){if(typeof t.entityChildren!="function")return;let i=t.parent;if(i===null)return;let n=new _s(t);n.playModeVisible=e.visible!==!1,n.expand(),typeof e.name=="string"&&(n.name=e.name);let r=Math.PI/180;return n.position.copy(t.position),n.rotation.copy(t.rotation),n.scale.copy(t.scale),n.hiddenMatrix.copy(t.hiddenMatrix),e.position&&(typeof e.position.x=="number"&&(n.position.x=e.position.x),typeof e.position.y=="number"&&(n.position.y=e.position.y),typeof e.position.z=="number"&&(n.position.z=e.position.z)),e.rotation&&(typeof e.rotation.x=="number"&&(n.rotation.x=e.rotation.x*r),typeof e.rotation.y=="number"&&(n.rotation.y=e.rotation.y*r),typeof e.rotation.z=="number"&&(n.rotation.z=e.rotation.z*r)),e.scale&&(typeof e.scale.x=="number"&&(n.scale.x=e.scale.x),typeof e.scale.y=="number"&&(n.scale.y=e.scale.y),typeof e.scale.z=="number"&&(n.scale.z=e.scale.z)),n.updateMatrix(),i.add(n),n.updateWorldMatrix(!0,!0),this.entityOpContext.scene.markShadowsDirty(),this.requestRender(),n}destroyRuntimeClone(t){t.removeFromParent(),this.entityOpContext.scene.markShadowsDirty(),this.requestRender()}updateEntityMaterialParams(t,e){let i=t.material;if(!i)return!1;let n=[];for(let c of Array.isArray(i)?i:[i]){let h=c.root??c;h&&Array.isArray(h.layers)&&h.data&&!n.includes(h)&&n.push(h)}if(n.length===0)return!1;let r={scene:this.entityOpContext.scene,shared:this},s=c=>c.toLowerCase().replace(/[\s_.-]+/g,""),a=c=>{if(typeof c=="string"){let h=new yn(1,1,1,1);try{h.set(c)}catch{return null}return{r:h.r,g:h.g,b:h.b,a:void 0}}if(c&&typeof c=="object"&&"r"in c){let h=c;if([h.r,h.g,h.b].some(u=>typeof u!="number"||!isFinite(u)))return null;let d=Math.max(h.r,h.g,h.b)>1?1/255:1;return{r:h.r*d,g:h.g*d,b:h.b*d,a:typeof h.a=="number"?Math.max(0,Math.min(h.a,1)):void 0}}return null},o=(c,h,d)=>{if(!c.hasValue(h))return!1;let u=c.getValue(h);if(!u||typeof u!="object"||!u.isColor)return!1;let p=d.a??(typeof u.a=="number"?u.a:1);return u instanceof Zg?c.setValue(h,new yn(d.r,d.g,d.b,p)):typeof u.setRGBA=="function"?u.setRGBA(d.r,d.g,d.b,p):u.setRGB(d.r,d.g,d.b),!0},l=!1;for(let c of n){let h=c.data.layers??[],d=u=>c.layers.find(p=>p.uuid===u);if(e.color!==void 0){let u=a(e.color),p=h.find(g=>g.data.type==="color"),f=p&&d(p.id);if(u&&f&&o(f,"color",u)&&(l=!0,u.a!==void 0)){let g=u.a<1||Oc(c.data,this);c.setTransparent?c.setTransparent(g,r.scene):c.transparent=g}}typeof e.alpha=="number"&&isFinite(e.alpha)&&(c.onVariableUpdate?.(["alphaOverride"],Math.max(0,Math.min(e.alpha,100)),r),l=!0);for(let u of e.layers??[]){if(!u||typeof u!="object")continue;let p=typeof u.id=="string"?h.find(v=>v.id===u.id):typeof u.index=="number"?h[u.index]:typeof u.type=="string"?h.find(v=>v.data.type===u.type):void 0,f=p&&d(p.id);if(!p||!f)continue;let g=Ex[p.data.type]??[],m=Object.keys(p.data);for(let[v,y]of Object.entries(u)){if(v==="id"||v==="index"||v==="type")continue;let _=m.find(x=>x===v)??m.find(x=>s(x)===s(v))??v;if(g.includes(_))continue;let b=a(y);if(b&&o(f,_,b))l=!0;else if(typeof y=="number"&&isFinite(y))c.onVariableUpdate?.(["layer",p.id,_],y,r),l=!0;else if(Array.isArray(y)&&y.length<=3&&y.every(x=>typeof x=="number"&&isFinite(x))){let x=["x","y","z"];y.forEach((w,S)=>{c.onVariableUpdate?.(["layer",p.id,_,x[S]],w,r)}),l=!0}}}}return l&&this.requestRender(),l}deleteVariable(t){this.variables[t]&&delete this.variables[t]}getVariable(t,e){if(Array.isArray(t)){if(t[0]==="mouse")return this.mouseProperty?.[t[1]]??0;if(t[0]==="raycast")return this.raycastProperty?.[t[1]]??0;let i=this.entityOpContext.scene.find(t[0]);if(t[1]==="width"||t[1]==="height"||t[1]==="depth")return i.geometry.userData.parameters[t[1]];if((t[1]==="position"||t[1]==="rotation")&&t.length>2&&i?.getPhysicsLocalMatrix?.(m2))return m2.decompose(g2,v2,xL),t[1]==="position"?g2[t[2]]:(y2.setFromQuaternion(v2,i.rotation.order),y2[t[2]]*Ot.RAD2DEG);for(let n=1;n<t.length;n++)i=i[t[n]];return t[1]==="rotation"&&(i*=Ot.RAD2DEG),i}for(let i in this.variables){if(e===void 0)break;let n=this.variables[i],r=n.locations?.findIndex(s=>jn.equal(s,e));r!==void 0&&r!==-1&&n.locations.splice(r,1)}if(typeof t=="string"){let i=t,n=t;do{if(n=i,this.variables[i]===void 0)break;let r=this.variables[i].value;e&&this.variables[n]!==void 0&&this.variables[n].locations.push(e),i=r}while(typeof i=="string");return i}return t}getVariables(){return this.variables}getVariablesNames(){return this.data.variables.map(t=>t.data.name)}getVariableByName(t){for(let e of this.data.variables)if(e.data.name===t)return{variable:e.data,id:e.id}}getDynamicVariablePlayState(t){return this.variables[t]?.dynamicVariablePlayState}setDynamicVariablePlayState(t,e){this.variables[t]!==void 0&&(this.variables[t].dynamicVariablePlayState=e)}getDynamicVariableToggleIsForward(t){return this.variables[t]?.dynamicVariableToggleIsForward}setDynamicVariableToggleIsForward(t,e){this.variables[t]!==void 0&&(this.variables[t].dynamicVariableToggleIsForward=e)}resetLib(t){for(let[e,i]of Object.entries(t.images))this.addImage(e,i.asset);for(let[e,i]of Object.entries(t.audios))this.addAudio(e,i.asset);for(let[e,i]of Object.entries(t.particles))this.addParticle(e,i.asset);for(let[e,i]of Object.entries(t.colors))this.addColor(e,i.asset);for(let[e,i]of Object.entries(t.fonts))this.addFont(e,i.asset);for(let[e,i]of Object.entries(t.videos))this.addVideo(e,i.asset);for(let[e,i]of Object.entries(t.variables))this.addVariableHolder(e,i.asset)}updateLibByOp(t,e){t.path[0]==="images"?t.path.length===1&&t.type===1?this.addImage(t.id,t.data.asset):t.path.length===1&&t.type===2&&this.deleteImage(t.id):t.path[0]==="videos"?t.path.length===1&&t.type===1?this.addVideo(t.id,t.data.asset):t.path.length===1&&t.type===2&&this.deleteVideo(t.id):t.path[0]==="audios"?t.path.length===1&&t.type===1?this.addAudio(t.id,t.data.asset):t.path.length===1&&t.type===2&&this.deleteAudio(t.id):t.path[0]==="particles"?t.path.length===1&&t.type===1?this.addParticle(t.id,t.data.asset):t.path.length===1&&t.type===2&&this.deleteParticle(t.id):t.path[0]==="colors"?t.path.length===1&&t.type===1?this.addColor(t.id,t.data.asset):t.path.length===1&&t.type===2&&this.deleteColor(t.id):t.path[0]==="materials"?t.path.length===1&&t.type===1?this.addMaterial(t.id,t.data.asset):t.path.length===1&&t.type===2&&this.deleteMaterial(t.id):t.path[0]==="fonts"?t.path.length===1&&t.type===1?this.addFont(t.id,t.data.asset):t.path.length===1&&t.type===2&&this.deleteFont(t.id):t.path[0]==="variables"?t.path.length===1&&t.type===1?this.addVariableHolder(t.id,t.data.asset):t.path.length===1&&t.type===2&&this.deleteVariable(t.id):t.path[0]==="components"&&e.updateByLibOp(t,this)}updateByOp(t,e,i){if(this.data=e,t.path[0]==="images")t.path.length===2&&t.type===0?t.props.data&&this.getImage(t.path[1]).updateSrc(t.props.data):t.path.length===1&&t.type===1?this.addImage(t.id,t.data):t.path.length===1&&t.type===2&&this.deleteImage(t.id);else if(t.path[0]==="videos")t.path.length===2&&t.type===0?t.props.data&&this.getVideo(t.path[1]).updateSrc(t.props.data):t.path.length===1&&t.type===1?this.addVideo(t.id,t.data):t.path.length===1&&t.type===2&&this.deleteVideo(t.id);else if(t.path[0]==="audios")t.path.length===2&&t.type===0?t.props.data&&this.addAudio(t.path[1],e.audios[t.path[1]]):t.path.length===1&&t.type===1?this.addAudio(t.id,t.data):t.path.length===1&&t.type===2&&this.deleteAudio(t.id);else if(t.path[0]==="particles")t.path.length===2&&t.type===0?t.props.data&&this.addParticle(t.path[1],e.particles[t.path[1]]):t.path.length===1&&t.type===1?this.addParticle(t.id,t.data):t.path.length===1&&t.type===2&&this.deleteParticle(t.id);else if(t.path[0]==="colors")t.path.length===2&&t.type===0?this.updateColor(t.path[1],t.props):t.path.length===1&&t.type===1?this.addColor(t.id,t.data):t.path.length===1&&t.type===2&&this.deleteColor(t.id);else if(t.path[0]==="materials")t.path.length===1&&t.type===1?this.addMaterial(t.id,t.data):t.path.length===1&&t.type===2?this.deleteMaterial(t.id):t.path.length>1&&this.getMaterial(t.path[1]).updateByOp(er.drop(t,2),e.materials[t.path[1]],{shared:this,scene:i});else if(t.path[0]==="fonts")t.path.length===2&&t.type===0?this.updateFont(t.path[1],t,i):t.path.length===1&&t.type===1?this.addFont(t.id,t.data):t.path.length===1&&t.type===2&&this.deleteFont(t.id);else if(t.path[0]==="variables")t.path.length===2&&t.type===0?"value"in t.props?this.updateVariable(t.path[1],t.props.value):"persistent"in t.props&&(this.variables[t.path[1]].persistent=t.props.persistent):t.path.length===1&&t.type===4?this.addVariableHolder(t.id,t.data):t.path.length===1&&t.type===5&&this.deleteVariable(t.id);else if(t.path[0]==="userAPIs"){if(t.path.length===1&&t.type===1)this.addUserAPI(t.id,t.data);else if(t.path.length===1&&t.type===2)this.deleteUserAPI(t.id);else if(typeof t.path[1]=="string"){let n=e.userAPIs[t.path[1]];if(n){let r=t.type===0&&t.props.debounce===void 0,s=this.getUserAPI(t.path[1]);s!==void 0&&s===this.openAIRealtime?s.update(n):s?.update(n,this,r)}}}else if(t.path[0]==="userWebhooks"){if(t.path.length===1&&t.type===1)this.addUserWebhook(t.id,t.data);else if(t.path.length===1&&t.type===2)this.deleteUserWebhook(t.id);else if(typeof t.path[1]=="string"){let n=e.userWebhooks[t.path[1]];n&&this.getUserWebhook(t.path[1])?.update(n)}}else t.path[0]==="lib"&&this.updateLibByOp(er.drop(t,1),i)}updateFont(t,e,i){if(e.props.url){let n=this.getFont(t),r={...this.data.fonts[t],url:e.props.url};n.update(r),n.loadingPromise.then(()=>this.requestRender()),i.updateFont(t,this)}}addUserAPI(t,e){if(this.userAPIs[t])return this.userAPIs[t].update(e,this),!0;if(this.openAIRealtime?.id===t)return this.openAIRealtime.update(e),!0;if(e.integration?.type==="VoiceAssistant"){let i=O3;return i===null?(Gn("ai-assistant","a voice-assistant integration"),!1):(this.openAIRealtime=i(e,t,this),!1)}{let i=bL();return i===null?(Gn("api-services","a user API integration"),!1):(this.userAPIs[t]=i.createUserAPI(t,e,this),!1)}}getUserAPI(t){return this.openAIRealtime?.id===t?this.openAIRealtime:this.userAPIs[t]}getUserAPIs(){return this.userAPIs}deleteUserAPI(t){let e=this.userAPIs[t];e&&(e.dispose(),delete this.userAPIs[t])}addUserWebhook(t,e){if(this.userWebhooks[t])return this.userWebhooks[t].update(e),!0;{let i=bL();return i===null?(Gn("api-services","a user webhook"),!1):(this.userWebhooks[t]=i.createUserWebhook(t,e),!1)}}getUserWebhook(t){return this.userWebhooks[t]}getUserWebhooks(){return this.userWebhooks}deleteUserWebhook(t){let e=this.userWebhooks[t];e&&(e.dispose(),delete this.userWebhooks[t])}get scene(){return this.entityOpContext.scene}}).MAX_TRANSIENT_VERTICES=6e4,new Mb(Ns.emptyData())});function R6(t){return mb(t)||t?.isTSLNodeMaterial===!0}var Wr,b2,x2,w2,ML,S2,Po,EL,AL,Wf,Ai,I6=z(()=>{m3()}),rd=z(()=>{$t(),Kn(),Mh(),I6(),Ye(),Dn(),Wr=class extends Yi{setMaterialOverride(t,e){this.materialOverride=gL(t),this.material!==this.shadowCatcherMaterial&&(this.disposeMaterial(),this.material=this.materialOverride,this.layers.set(0),this.syncShapeBlendNodeLayer(),e.scene.markNeedsUpdateRendererDirty())}updateByPatchedOp(t,e,i){if(super.updateByPatchedOp(t,e,i),ri(t.path,["geometry"])&&this.syncShadowCatcher(i),function(n,r){let s=[];if(r.length!==n.length)return null;{let a=0;for(;a<n.length;){if(r[a]==="*")s.push(n[a]);else if(n[a]!==r[a])return null;a+=1}}return s}(t.path,["materials"])!==null&&t.type===0&&Array.isArray(this.material))for(let[n,r]of Object.entries(t.props)){let s=this.material[Number(n)],a=i.shared.material(r);a!==s&&Wr.disposeOneMaterial(s),this.material[Number(n)]=a}else if(ri(t.path,["material"])){let n=this.material;!Array.isArray(n)&&typeof n?.updateByOp=="function"&&"material"in e&&typeof e.material!="string"&&n.updateByOp(er.drop(t,1),e.material,i)}else if(ri(t.path,["materials","*"])&&Array.isArray(this.material)){let n=t.path[1];if("materials"in e&&n<this.material.length){let r=e.materials[n];typeof r!="string"&&this.material[n].updateByOp(er.drop(t,2),r,i)}}}get needsAO(){return this.material!==void 0&&(Array.isArray(this.material)?this.material[0]:this.material).hasAO}syncShapeBlendNodeLayer(){this.dataPatched.type==="Mesh"&&this.dataPatched.geometry.shapeBlendNode?this.layers.set(9):512&this.layers.mask&&this.layers.set(0)}updateState(t,e){super.updateState(t,e),t.castShadow!==void 0&&(this.castShadow=t.castShadow),t.receiveShadow!==void 0&&(this.receiveShadow=t.receiveShadow);let i,n=this.dataPatched;this.syncShapeBlendNodeLayer(),this.dataPatched.type==="Mesh"&&this.dataPatched.geometry.type==="ShapeBlendGeometry"&&(i={resolutionLevel:Math.min(8,this.dataPatched.geometry.resolutionLevel),useChildrenColors:this.dataPatched.geometry.useChildrenColors});let r=this.materialOverride!==void 0;!r&&t.geometry?.type!=="NonParametricGeometry"&&"material"in t&&t.material!==void 0&&(this.disposeMaterial(),this.material=e.shared.material(t.material).getFlavor(n.flatShading,n.side,n.wireframe,i),e.scene.markNeedsUpdateRendererDirty()),!r&&(t.geometry?.type==="NonParametricGeometry"||"materials"in t)&&("materials"in t&&t.materials!==void 0?(this.disposeMaterial(),this.material=t.materials.map(a=>e.shared.material(a).getFlavor(n.flatShading,n.side,n.wireframe)),e.scene.markNeedsUpdateRendererDirty()):"material"in t&&t.material!==void 0&&(this.disposeMaterial(),this.material=[e.shared.material(t.material).getFlavor(n.flatShading,n.side,n.wireframe)],e.scene.markNeedsUpdateRendererDirty()));let s=this.data;if(!r&&s.geometry?.type!=="NonParametricGeometry"&&"materials"in s&&s.materials!==void 0&&(this.disposeMaterial(),this.material=e.shared.material(s.materials[0]).getFlavor(n.flatShading,n.side,n.wireframe)),!r&&(t.flatShading!==void 0||t.wireframe!==void 0||t.side!==void 0))if(Array.isArray(this.material))for(let a=0;a<this.material.length;a++)this.material[a]=this.material[a].getFlavor(n.flatShading,n.side,n.wireframe);else this.material=this.material.getFlavor(n.flatShading,n.side,n.wireframe,i);this.syncShadowCatcher(e)}shadowCatcherActive(){let t=this.dataPatched,e=t.geometry?.type;return t.shadowCatcher===!0&&(e==="RectangleGeometry"||e==="PlaneGeometry")}syncShadowCatcher(t){let e=this.dataPatched;if(this.shadowCatcherActive()){if(this.shadowCatcherMaterial===void 0){let i=gT===void 0?null:gL(gT());if(i===null)return;this.shadowCatcherMaterial=i}this.shadowCatcherMaterial.side=e.side,this.material!==this.shadowCatcherMaterial&&(this.disposeMaterial(),this.material=this.shadowCatcherMaterial,t.scene.markNeedsUpdateRendererDirty()),this.castShadow=!1,this.receiveShadow=!0,this.layers.set(0)}else this.shadowCatcherMaterial!==void 0&&this.material===this.shadowCatcherMaterial&&(this.materialOverride!==void 0?(this.material=this.materialOverride,t.scene.markNeedsUpdateRendererDirty()):"material"in e&&e.material!==void 0&&(this.material=t.shared.material(e.material).getFlavor(e.flatShading,e.side,e.wireframe),t.scene.markNeedsUpdateRendererDirty(),this.needsAO&&this.layers.enable(5)),this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow)}static disposeOneMaterial(t){var e;R6(t)&&!function(i){return i?.isClassicSharedMaterial===!0}(e=t)&&e?.isTSLSharedMaterial!==!0&&t.nodeMaterialDispose()}disposeMaterial(){this.material&&tN(this.material).forEach(t=>{Wr.disposeOneMaterial(t)})}dispose(){this.disposeMaterial(),this.shadowCatcherMaterial?.dispose(),super.dispose()}}}),Xr=z(()=>{$t(),Ye(),B3(),rd(),tt(),Sx(),Ap(),Tp(),w6(),b2=new T,x2=new ve,w2=new ve,ML=new T,S2=new At,Po=new gi,EL=Po.geometry,AL=Po.material,Wf=new T,Ai=class extends Wr{constructor(t,e,i){super(t,e),this.data=e,this.isSkinnedMesh=!1,this.localGeometry=void 0,e.bindMode&&e.bindMatrix&&(this.bindMode=e.bindMode,this.bindMatrix=new At().fromArray(e.bindMatrix),this.bindMatrixInverse=new At)}chooseGeoemtryCache(t){return t.geometryCache}supportsInPlaceGeometryUpdate(t){return t.isTextGeometry!==!0}markGeometryAsReachable(t){this.geometryCreateDeleyed instanceof jt&&this.chooseGeoemtryCache(t).markAsReachable(this.dataPatched.geometry,this.geometryCreateDeleyed)}get builtSharedGeometry(){if(this.localGeometry===void 0)return this.geometryCreateDeleyed instanceof jt?this.geometryCreateDeleyed:void 0}get geometry(){if(this.localGeometry!==void 0)return this.localGeometry;if(this.geometryCreateDeleyed instanceof Mb){let t=this.geometryCreateDeleyed,e=this.chooseGeoemtryCache(t),i=this.dataPatched.geometry;this.geometryCreateDeleyed=e.get(i,t,this),this._geometryCacheKey=i}return this.geometryCreateDeleyed}set geometry(t){this.localGeometry=t}get is2DAndNoDepth(){let t=this.dataPatched.geometry;return ib.is2DParametricMesh(t.type)&&t.depth===0}get is2DType(){return ib.is2DParametricMesh(this.geometry.userData.type)}get isTextType(){return this.geometry.isTextGeometry===!0}get isNonParametric(){return this.geometry.userData.type==="NonParametricGeometry"}updateByPatchedOp(t,e,i){super.updateByPatchedOp(t,e,i),ri(t.path,["geometry"])&&this.updateByPatchedOpGeometry(er.drop(t,1),e.geometry,i)}removeInteractionGeometry(t){this.localGeometry?.dispose(),this.localGeometry=void 0}dispose(){var t;super.dispose(),t=this.uuid,bb.delete(t),this._posed=void 0}get appliedGeometrySize(){let t=this.localGeometry?.userData;if(t!==void 0&&t.sxPrev!==void 0)return[t.sxPrev,t.syPrev,t.szPrev]}updateGeometryInteractions(t,e){this.invalidateDownstreamBooleanData();let i=this.data.geometry.type;if(i==="NonParametricGeometry"||i==="SubdivGeometry"){let n,r,s,a=t;if(this.localGeometry===void 0){let d={...this.data.geometry,...a};this.localGeometry=nh(d,e,this.data.flatShading,this)}a.scaleBaked?[n,r,s]=a.scaleBaked:{width:n,height:r,depth:s}=a;let o=this.localGeometry.userData,l=typeof n=="number"?n:1,c=typeof r=="number"?r:1,h=typeof s=="number"?s:1;o.sxPrev!==void 0&&cT(this.localGeometry.attributes,l/o.sxPrev,c/o.syPrev,h/o.szPrev),o.sxPrev=l,o.syPrev=c,o.szPrev=h}else if(!this.absorbDepthInteraction(t)){let n=nh({...this.data.geometry,...t},e,this.data.flatShading,this);this.localGeometry!==void 0&&this.supportsInPlaceGeometryUpdate(this.localGeometry)&&c2(this.localGeometry,n)?n.dispose():(this.localGeometry?.dispose(),this.localGeometry=n)}}absorbDepthInteraction(t){let e=this.localGeometry;if(e?.shiftDepthTo===void 0)return!1;let i=t;if(typeof i.depth!="number")return!1;let n=e.userData?.parameters;if(n===void 0)return!1;for(let r of Object.keys(i))if(r!=="depth"&&i[r]!==n[r])return!1;return!!e.shiftDepthTo(i.depth)&&(n.depth=i.depth,!0)}refreshAttachedClonersInteractions(t){for(let e of this.attachedSurfaceCloners)e.update(t)}refreshAttachedCloners(t){for(let e of this.attachedSurfaceCloners)t.scene.addPendingUpdateCloner(e.object)}refreshAttachedPaths(t){for(let e of this.attachedPaths)t.scene.addPendingCommand(()=>e.updateShape())}createGeometryDelayed(t){this.geometryCreateDeleyed=t.shared,this.refreshAttachedCloners(t),this.refreshAttachedPaths(t)}updateByPatchedOpGeometry(t,e,i){let n=!1;if(t.type===0&&t.path.length===0&&Object.keys(t.props).includes("scaleBaked")&&this.geometryCreateDeleyed instanceof Ni&&this.chooseGeoemtryCache(i.shared).mutateIfUnique(this.geometryCreateDeleyed.data,e)===this.geometryCreateDeleyed&&(n=!0,this.geometryCreateDeleyed.mutateDirectlyScaleBaked(e,t.props.scaleBaked),this.refreshAttachedCloners(i),this.refreshAttachedPaths(i)),!n&&t.type===0&&t.path.length===0&&S6(t.props)&&this.geometryCreateDeleyed instanceof Ni&&this.chooseGeoemtryCache(i.shared).mutateIfUnique(this.geometryCreateDeleyed.data,e)===this.geometryCreateDeleyed&&(n=!0,this.geometryCreateDeleyed.mutateDirectlySubdivisions(e),this.refreshAttachedCloners(i),this.refreshAttachedPaths(i)),!n&&t.type===0&&t.path.length===0&&this.geometryCreateDeleyed instanceof jt&&!(this.geometryCreateDeleyed instanceof Ni)&&this.supportsInPlaceGeometryUpdate(this.geometryCreateDeleyed)&&this._geometryCacheKey!==void 0){let r=i.shared,s=this.chooseGeoemtryCache(r),a=this.geometryCreateDeleyed;if(s.getCached(this._geometryCacheKey)===a&&a.isShared!==!0){let o=this.dataPatched.geometry,l=nh(o,r,this.data.flatShading,this);c2(a,l)?(l.dispose(),a.computeBoundingSphere(),s.mutateIfUnique(this._geometryCacheKey,o)):(l.computeBoundingSphere(),s.forceDelete(this._geometryCacheKey),s.adopt(o,l),this.geometryCreateDeleyed=l),this._geometryCacheKey=o,n=!0,this.refreshAttachedCloners(i),this.refreshAttachedPaths(i)}}n||(i.scene?.markGeometryCacheDirty(),this.createGeometryDelayed(i)),this.syncShapeBlendNodeLayer(),this.resetBBoxNeedsUpdate(),this.invalidateDownstreamBooleanData()}updateGeometryOnStateUpdate(t,e){this.createGeometryDelayed(e)}applyTransientGeometryData(t,e){let i=t.shared,n=this.dataPatched.geometry;if(this.geometryCreateDeleyed instanceof jt&&!(this.geometryCreateDeleyed instanceof Ni)&&this.supportsInPlaceGeometryUpdate(this.geometryCreateDeleyed)&&this._geometryCacheKey!==void 0){let r=this.chooseGeoemtryCache(i),s=this.geometryCreateDeleyed;if(r.getCached(this._geometryCacheKey)===s&&s.isShared!==!0){let a=nh(n,i,this.data.flatShading,this);return c2(s,a)?(a.dispose(),s.computeBoundingSphere(),r.mutateIfUnique(this._geometryCacheKey,n)):(a.computeBoundingSphere(),r.forceDelete(this._geometryCacheKey),r.adopt(n,a),this.geometryCreateDeleyed=a),this._geometryCacheKey=n,this.refreshAttachedCloners(t),void this.refreshAttachedPaths(t)}}e&&this._geometryCacheKey!==void 0&&this.chooseGeoemtryCache(i).forceDelete(this._geometryCacheKey),t.scene?.markGeometryCacheDirty(),this.createGeometryDelayed(t)}updateState(t,e){t.geometry!==void 0&&this.updateGeometryOnStateUpdate(t.geometry,e);let i=t.morphTargetInfluences;if(i){this.updateMorphTargets(),this.geometry.morphTargetsRelative=!0;for(let{data:{name:n,value:r}}of i)this.updateMorphInfluences(n,e.shared.getVariable(r,[this.uuid,"morphTargetInfluences",n]))}super.updateState(t,e)}updateMorphInfluences(t,e){if(this.morphTargetDictionary===void 0)return;let i=this.morphTargetDictionary[t];i!==void 0&&(this.morphTargetInfluences[i]=e)}updateGeometryGroupsIfNeeded(){Array.isArray(this.material)&&this.geometry.groups.length===0&&this.geometry.addGroup(0,Math.max(this.geometry.getIndex()?.count??0,this.geometry.getAttribute("position").count),0)}updateEntityBoxSize(t,e){let i=this.posedGeometry()?.boundingBox;if(i)return i.getCenter(t),void i.getSize(e).multiplyScalar(.5);let n=this.geometry.userData.parameters;this.is2DType||this.isTextType?t.set(0,0,.5*n.depth):this.isNonParametric?(t.setScalar(0),this.geometry.boundingSphere&&t.copy(this.geometry.boundingSphere.center),e.set(n.width,n.height,n.depth??0).multiplyScalar(.5)):n.centerOffset?t.fromArray(n.centerOffset):t.setScalar(0),e.set(n.width,n.height,n.depth??0).multiplyScalar(.5)}updateMatrixWorld(t){super.updateMatrixWorld(t),this.bindMode==="attached"?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode==="detached"&&this.bindMatrixInverse.copy(this.bindMatrix).invert()}bind(t,e){this.skeleton=t,this.isSkinnedMesh=!0,e===void 0&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),e=this.matrixWorld),this.bindMatrix.copy(e),this.bindMatrixInverse.copy(e).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(t){let e=new ve,i=this.geometry.attributes.skinWeight;for(let n=0,r=i.count;n<r;n++){e.fromBufferAttribute(i,n);let s=1/e.manhattanLength();s!==1/0?e.multiplyScalar(s):e.set(1,0,0,0),i.setXYZW(n,e.x,e.y,e.z,e.w)}}boneTransform(t,e){let i=this.skeleton;if(i===void 0)return;let n=this.geometry;x2.fromBufferAttribute(n.attributes.skinIndex,t),w2.fromBufferAttribute(n.attributes.skinWeight,t),b2.copy(e).applyMatrix4(this.bindMatrix),e.set(0,0,0);for(let r=0;r<4;r++){let s=w2.getComponent(r);if(s!==0){let a=x2.getComponent(r);S2.multiplyMatrices(i.bones[a].matrixWorld,i.boneInverses[a]),e.addScaledVector(ML.copy(b2).applyMatrix4(S2),s)}}return e.applyMatrix4(this.bindMatrixInverse)}raycastDeformed(t,e){let i=this.posedGeometry();if(i===void 0)return!1;Po.geometry=i,Po.material=this.material,Po.matrixWorld.copy(this.matrixWorld);let n=e.length;Po.raycast(t,e);for(let r=n;r<e.length;r++)e[r].object=this;return Po.geometry=EL,Po.material=AL,!0}posedGeometry(){let t=this.skeleton;if(!this.isSkinnedMesh||t===void 0)return;let e=this.geometry,{position:i,skinIndex:n,skinWeight:r}=e.attributes;if(!i||!n||!r)return;let s=[...this.bindMatrix.elements,...this.bindMatrixInverse.elements,...this.morphTargetInfluences??[]];for(let d=0;d<t.bones.length;d++){let u=t.bones[d];if(!u||!t.boneInverses[d])return;s.push(...u.matrixWorld.elements)}let a=this._posed;if(a?.source===e&&a.version===i.version&&a.pose.length===s.length&&a.pose.every((d,u)=>d===s[u]))return a.geometry;let o=i.count,l=a?.geometry.attributes.position,c=l?.count===o?l:new Ht(new Float32Array(3*o),3);for(let d=0;d<o;d++)this.boneTransform(d,this.getVertexPosition(d,Wf)),c.setXYZ(d,Wf.x,Wf.y,Wf.z);let h=new jt;h.setAttribute("position",c);for(let d of["normal","uv","uv1"]){let u=e.attributes[d];u&&h.setAttribute(d,u)}return h.setIndex(e.index),h.groups=e.groups,h.drawRange=e.drawRange,h.computeBoundingSphere(),h.computeBoundingBox(),this._posed={source:e,version:i.version,pose:s,geometry:h},h}}});function ep(t){if(Array.isArray(t.material)){for(let e of t.material)if(e.getLayersOfType("outline").length===0)return}else if(!mb(t.material)||t.material.getLayersOfType("outline").length===0)return;t instanceof Ai&&t.is2DAndNoDepth?function(e){if(e.geometry.attributes.extrudeNormals||!e.geometry.attributes.position)return;let i=e.geometry.attributes.position.array,n=new Float32Array(i.length),r=new T;for(let s=0;s<i.length;s+=3)r.set(i[s],i[s+1],i[s+2]).normalize(),n[s]=r.x,n[s+1]=r.y,n[s+2]=r.z;e.geometry.setAttribute("extrudeNormal",new Nt(n,3))}(t):function(e){if(e.geometry.attributes.extrudeNormal||!e.geometry.attributes.position||!e.geometry.attributes.normal)return;let i=new Map,n=e.geometry.attributes,r=n.position.array,s=n.normal.array,a=new Float32Array(r.length);for(let o=0;o<r.length;o+=3){let l=`${r[o]}_${r[o+1]}_${r[o+2]}`,c=new T(s[o],s[o+1],s[o+2]);i.has(l)?i.get(l)?.normals.push(c):i.set(l,{normals:[c],result:new T})}i.forEach((o,l)=>{for(let c of o.normals)o.result.add(c);o.result.divideScalar(o.normals.length)});for(let o=0;o<r.length;o+=3){let l=`${r[o]}_${r[o+1]}_${r[o+2]}`,c=i.get(l)?.result;c&&(a[o]=c.x,a[o+1]=c.y,a[o+2]=c.z)}e.geometry.setAttribute("extrudeNormal",new Nt(a,3))}(t)}function M2(t){return Math.min(2047,Math.max(1,Math.round(2048*t)))/2048}function ip(t){if(!t.geometry.attributes.position)return;let e=t.geometry.attributes,i=e.position.array,n=e.randomColor;if(n!==void 0&&3*n.count===i.length)return;let r=new Float32Array(i.length),s=parseInt(t.uuid.replace(/\D/g,"")),a=[M2(Ot.seededRandom(s)),M2(Ot.seededRandom(s+1e4)),M2(Ot.seededRandom(s+2e4))];for(let o=0;o<i.length;o++)r[o]=a[o%3];t.geometry.setAttribute("randomColor",new Ht(r,3))}var Ax=z(()=>{tt(),m3(),Xr()});function TL(t){let e=!1;return t.scene.objects.traverse((i,n)=>{n.geometry?.type==="BooleanGeometry"&&(e=!0)}),e}function tZ(t,e){let i=t.cloner;return i!==void 0&&i.parent===e?i:void 0}function CL(t,e,i,n){let r=16*(e.children.length+1);Hm.length<r&&(Hm=new Float32Array(r));let s=0,a=l=>{l.toArray(Hm,16*s),s++},o=e.parameters.hideBase!==!0;o&&a(n),_T.multiplyMatrices(t.hiddenMatrix,t.matrix);for(let l of e.children)!Cc(l)||l.playModeVisible===!1||(bT.multiplyMatrices(l.hiddenMatrix,l.matrix).multiply(l.pivotMatrix),U1.multiplyMatrices(_T,bT),(!o||!U1.equals(n))&&a(U1));try{return s===0?0:function(l,c){return p3(fb().instanced_union(u3(l),c))}(i,Hm.subarray(0,16*s))}finally{gk(i)}}var Do,PL,_T,bT,U1,Hm,uh,Eb,Tx,fa,eo,Ab,d0=z(()=>{Kn(),tt(),_x(),Ax(),rd(),Bi(),Do=new At,PL=new At,_T=new At,bT=new At,U1=new At,Hm=new Float32Array(0),uh=class extends Wr{constructor(t,e,i){super(t,e),this.data=e,this.meshSetAddresses=[],this.needsTransformForDownstream=!1,this.geometry=new jt,this.onAfterRender=(n,r,s,a,o,l)=>{super.onAfterRender(n,r,s,a,o,l),this.recomputeBoolean()},this.geometry.userData.parameters={width:0,height:0,depth:0}}get booleanOp(){return this.data.geometry.operation}get phongAngle(){return this.data.geometry.phongAngle??45}get isLOD(){return this.recomputeBoolean(),!1}updateByPatchedOp(t,e,i){super.updateByPatchedOp(t,e,i),t.path.length===1&&t.path[0]==="geometry"&&t.type===0&&t.props.operation!==void 0&&(this.freeBooleanPointer(),this.resetBBoxNeedsUpdate())}freeBooleanPointer(){super.freeBooleanPointer(),this.geometry.dispose()}recomputeBoolean(t,e=!0){if(this.booleanMeshSetAddress!==-1&&!t)return;for(let n=0;n<this.children.length;n++){let r=this.children[n];r instanceof uh&&r.dataPatched.visible===!0&&r.recomputeBoolean(t===!0,e)}this.meshSetAddresses=[];for(let n=0;n<this.children.length;n++){let r=this.children[n];if(r instanceof Yi&&r.dataPatched.visible===!0&&r.geometry.attributes.position?.count>0&&r.geometry.drawRange.count>0&&r.booleanMeshSetAddress!==0){Do.multiplyMatrices(r.hiddenMatrix,r.matrix).multiply(r.pivotMatrix);try{let s=tZ(r,this);if(r.booleanMeshSetAddress===-1){if((r.geometry.index??r.geometry.getAttribute("position")).count/3<15e5){let a=wY(r.geometry,t===!0);r.booleanMeshSetAddress=s===void 0||a===-1?a:CL(r,s,a,Do)}if(r.booleanMeshSetAddress===-1)return;s===void 0&&e2(r.booleanMeshSetAddress,Do),r.booleanMatrixInvOld.copy(Do).invert(),r.booleanWasTransformed=!1}else r instanceof uh&&r.needsTransformForDownstream===!0?(s===void 0?e2(r.booleanMeshSetAddress,Do):r.booleanMeshSetAddress=CL(r,s,r.booleanMeshSetAddress,Do),r.needsTransformForDownstream=!1):r.booleanWasTransformed===!0&&(e2(r.booleanMeshSetAddress,PL.multiplyMatrices(Do,r.booleanMatrixInvOld)),r.booleanMatrixInvOld.copy(Do).invert(),r.booleanWasTransformed=!1)}catch(s){console.error(s),r.booleanMeshSetAddress=0,r.geometry.userData.booleanOperationDidFail=!0;continue}if(r.booleanMeshSetAddress===0)continue;this.meshSetAddresses.push(r.booleanMeshSetAddress),r.geometry.userData.booleanOperationDidFail=!1}}if(this.meshSetAddresses.length===0){if(this.geometry.getAttribute("position")?.array.length!==0){let n=this.geometry;n.dispose(),this.geometry=new jt,this.geometry.userData=n.userData,this.geometry.boundingSphere=n.boundingSphere,this.geometry.setAttribute("position",new Nt([],3))}return void this.geometry.setDrawRange(0,0)}if(t===!0)return function(n,r){let s=fb(),a=_4(n,r),o=s.mesh_topological_data(a),l=o.positions(),c=o.indices();return o.free(),a.free(),{positions:l,indices:c,verticesPerFace:new Uint8Array(c.length/3).fill(3)}}(this.meshSetAddresses,this.booleanOp);let i=this.geometry;i.dispose(),this.geometry=new jt,this.geometry.userData=i.userData,this.geometry.boundingSphere=i.boundingSphere;try{this.booleanMeshSetAddress=function(n,r,s,a){let o=fb(),l=_4(n,r),c=o.mesh_render_data(l,Math.max(a,0));if(s.setAttribute("position",new Nt(c.positions(),3)),s.setAttribute("normal",new Nt(c.normals(),3)),c.free(),s.boundingSphere===null&&(s.boundingSphere=new yr),l.tri_count()===0)s.boundingSphere.center.set(0,0,0),s.boundingSphere.radius=0,s.userData.parameters={width:0,height:0,depth:0};else{let h=l.bounds();s.boundingSphere.center.set(h[0],h[1],h[2]),s.boundingSphere.radius=(h[3]**2+h[4]**2+h[5]**2)**.5,s.userData.parameters={width:2*h[3],height:2*h[4],depth:2*h[5]}}return p3(l)}(this.meshSetAddresses,this.booleanOp,this.geometry,this.phongAngle)}catch(n){this.booleanMeshSetAddress=0,this.geometry.userData.booleanOperationDidFail=!0,console.error(n)}this.booleanMatrixInvOld.copy(this.matrix).invert(),this.needsTransformForDownstream=!0,ep(this),ip(this)}dispose(){super.dispose(),this.geometry.dispose()}}}),u0=z(()=>{tt(),qr(),nd(),(Eb||(Eb={})).is=function(t){return Be.is(t)&&t instanceof Su},Tx=(t,e)=>class extends id(t,e){updateState_Light(i,n){if(this.updateState_Entity(i,n),i.color!==void 0&&(this.color=n.shared.color(i.color)),i.intensity!==void 0&&(this.intensity=i.intensity*Math.PI),i.depth!==void 0){let r=this.shadow;r.camera.far=i.depth,r.needsUpdate=!0}i.shadows!==void 0&&(this.castShadow=i.shadows)}}}),Eh=z(()=>{d0(),Kn(),nd(),fa=t=>t instanceof Yi,eo=t=>t!==null&&t instanceof uh,Ab=t=>qA.is(t)});function mr(t,e){return e.color(t)}function DL(t=new Date,e){let i=e.format,n=t.getSeconds(),r=t;e&&e.timeZone!==null&&(r=function(d,u){try{let p=new Intl.DateTimeFormat("en-US",{timeZone:u,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hourCycle:"h23"}).formatToParts(d),f=g=>Number(p.find(m=>m.type===g)?.value);return new Date(f("year"),f("month")-1,f("day"),f("hour"),f("minute"),f("second"),d.getMilliseconds())}catch{return new Date(NaN)}}(new Date,e.timeZone));let s,a=r.getHours(),o=r.getMinutes();e.format12h24h==="12ampm"&&(s=a>=12?"PM":"AM");let l,c,h=a;switch(e.format12h24h!=="24"&&(h=a%12,h===0&&(h=12)),i){case"HH:mm:ss":l=[h,o,n];break;case"HH:mm":l=[h,o];break;case"HH":l=[h],s=void 0;break;case"mm":l=[o],s=void 0;break;case"ss":l=[n],s=void 0;break;case"year":c=r.getFullYear();break;case"month":c=r.getMonth()+1;break;case"dayOfYear":c=Math.floor((r.getTime()-new Date(r.getFullYear(),0,0).getTime())/864e5);break;case"dayOfMonth":c=r.getDate();break;case"secondOfDay":c=60*a*60+60*o+n;break;default:console.error("Unknown time format",i),c=0}return l!==void 0?{textValue:l,suffix:s}:c}var xT,p0,U3=z(()=>{}),eZ=z(()=>{tt(),a0(),o0(),xT=class extends Sp(xF){constructor(t,e=15,i=10066329){super(t,e,i),this.object=t,this.added=!1,this.name=`DirectionalLightHelper: ${t.uuid}`}raycast(t,e){Mp(this.object,xT.geometryHelper,t,e)}}}),z3=z(()=>{tt(),eZ(),u0(),p0=class extends Tx(vF,xT){constructor(t,e,i){super(),this.super_Entity(t,e),this.castShadow=!0,this.shadow.mapSize.width=2048,this.shadow.mapSize.height=2048,this.shadow.normalBias=1,this.layers.enable(3);let n=this.shadow.camera;n.top=1250,n.bottom=-1250,n.right=1250,n.left=-1250,n.near=-1e4,n.far=2500;let r=new zg(this.shadow.camera);r.visible=!1,this.gizmos.shadowmap=r}update(){this.shadow.camera.updateProjectionMatrix();for(let t in this.gizmos){let e=this.gizmos[t];e instanceof zg&&e.update()}}updateMatrixWorld(t){super.updateMatrixWorld(t),this.objectHelper&&this.objectHelper.update()}updateState(t,e){this.updateState_Light(t,e);let i=t.depth!==void 0&&t.depth!==this.shadow.camera.far||t.size!==void 0&&t.size/2!==this.shadow.camera.right;t.size!==void 0&&function(n,r){n.shadow.camera.right=r/2,n.shadow.camera.left=-r/2,n.shadow.camera.top=r/2,n.shadow.camera.bottom=-r/2,n.shadow.needsUpdate=!0}(this,t.size),t.shadowRadius!==void 0&&(this.shadow.radius=t.shadowRadius),t.shadowResolution!==void 0&&(this.shadow.mapSize.set(t.shadowResolution,t.shadowResolution),this.shadow.map&&(this.shadow.map.dispose(),this.shadow.map=null)),t.penumbraSize!==void 0&&e.scene.markPenumbraSizeDirty(),i&&this.update()}}});function F3(t){return t instanceof Wr&&t.needsAO&&!ll(t)&&t.isDecalObject!==!0}function N3(t){let e=t.cloner;if(e&&Array.isArray(e.children))for(let i of e.children)i?.layers&&(i.layers.mask=t.layers.mask)}function k3(t){return t.getLayersOfType("reflection").filter(e=>e.data.visible).length}function RL(t,e){let i={outline:!1,cavity:!1},n=t.layers.mask&Cx,r=e.getLayersOfType("transmission"),s=e.getLayersOfType("outline"),a=k3(e),o=e.getLayersOfType("cavity");return(s.length>0||o.length>0)&&(t.layers.set(8),r.length>0&&t.layers.enable(3),a>0&&t.layers.enable(4),i.outline=s.length>0,i.cavity=o.length>0,ip(t),ep(t)),r.length===0&&s.length===0&&o.length===0&&a===0&&t.layers.set(0),n&&t.layers.set(9),!n&&F3(t)&&t.layers.enable(5),N3(t),i}function IL(t,e){if(!e.layers)return!1;let i=t.layers.mask&Cx,n=!1,r=e.getLayersOfType("transmission").filter(l=>l.data.visible),s=e.getLayersOfType("outline").filter(l=>l.data.visible),a=k3(e),o=e.getLayersOfType("cavity").filter(l=>l.data.visible);return r.length>0&&(t.layers.set(3),(s.length>0||o.length>0)&&t.layers.enable(8),a>0&&t.layers.enable(4),n=!0),r.length===0&&s.length===0&&o.length===0&&a===0&&t.layers.set(0),i&&t.layers.set(9),!i&&F3(t)&&t.layers.enable(5),N3(t),n}function OL(t,e){var i;if(!e.layers)return!1;let n=t.layers.mask&Cx,r=!1,s=k3(e),a=e.getLayersOfType("transmission").filter(c=>c.data.visible),o=e.getLayersOfType("outline").filter(c=>c.data.visible),l=e.getLayersOfType("cavity").filter(c=>c.data.visible);return s>0&&((i=t.userData).__splinePlanarMirror??(i.__splinePlanarMirror=0),t.layers.set(4),a.length>0&&t.layers.enable(3),(o.length>0||l.length>0)&&t.layers.enable(8),r=!0),s===0&&a.length===0&&o.length===0&&l.length===0&&t.layers.set(0),n&&t.layers.set(9),!n&&F3(t)&&t.layers.enable(5),N3(t),r}function wT(t,e,i,n=!1){let r=t.cloner;if(r){let s=null;if((t.raycast===gi.prototype.raycast||t.raycast===Yi.prototype.raycast)&&t.isSkinnedMesh!==!0){let a=t.geometry;a&&(a.boundingSphere===null&&a.computeBoundingSphere(),s=a.boundingSphere)}for(let a of r.children){if(s!==null&&(ST.copy(s).applyMatrix4(a.matrixWorld),!e.ray.intersectsSphere(ST)))continue;let o=L6.copy(a.matrixWorld).invert(),l=B6.copy(e.ray).applyMatrix4(o),c=t.matrixWorld;l.applyMatrix4(c);let h=O6;h.set(l.origin,l.direction),h.near=e.near,h.far=e.far,h.layers.mask=e.layers.mask;let d=h.intersectObject(t,!1);d.length>0&&i.push({...d[0],object:n?a:t})}}}var Cx,O6,L6,B6,ST,Wv,U6,E2,A2,T2,f0,mn,z6=z(()=>{Bi(),Ax(),Kn(),rd(),tt(),Cx=512,O6=new ex,L6=new At,B6=new Jo,ST=new yr}),iZ=z(()=>{tt(),a0(),o0(),Wv=class extends Sp(_F){constructor(t,e=6710886){super(t,e),this.object=t,this.matrix=t.matrixWorld,this.name=`SpotLightHelper: ${t.uuid}`}raycast(t,e){Mp(this.object,Wv.geometryHelper,t,e)}update(){if(this.object!==void 0){let t=Wv._vector,e=this.object.distance?this.object.distance:1e3,i=e*Math.tan(this.object.angle);this.cone.scale.set(i,i,e),t.setFromMatrixPosition(this.object.target.matrixWorld),this.cone.lookAt(t);let n=this.color!==void 0?this.color:this.light.color;if(this.cone.material instanceof Array)for(let r=0,s=this.cone.material.length;r<s;r++)this.cone.material[r].color.set(n);else this.cone.material.color.set(n)}}},(U6=Wv)._vector=new T}),V3=z(()=>{tt(),iZ(),u0(),E2=new T,A2=new T,T2=new Wt,f0=class extends Tx(mF,U6){constructor(t,e,i){super(),this.super_Entity(t,e),this.castShadow=!0,this.shadow.mapSize.width=1024,this.shadow.mapSize.height=1024,this.shadow.normalBias=1,this.layers.enable(3);let n=this.shadow.camera;n.fov=2*Ot.RAD2DEG*this.angle,n.aspect=1,n.near=100,n.far=2500;let r=new zg(this.shadow.camera);r.visible=!1,this.gizmos.shadowmap=r,this.update()}update(){this.shadow.camera.updateProjectionMatrix();for(let t in this.gizmos){let e=this.gizmos[t];e instanceof zg&&e.update()}}updateMatrixWorld(t){super.updateMatrixWorld(t),A2.setFromMatrixPosition(this.matrixWorld),T2.setFromRotationMatrix(this.matrixWorld),E2.copy(this.up).applyQuaternion(T2).negate().multiplyScalar(this.distance),this.target.position.copy(A2).add(E2),this.target.updateMatrixWorld(),this.objectHelper&&this.objectHelper.update()}updateState(t,e){this.updateState_Light(t,e),t.distance!==void 0&&(this.distance=t.distance),t.decay!==void 0&&(this.decay=t.decay),t.angle!==void 0&&(this.angle=t.angle),t.penumbra!==void 0&&(this.penumbra=t.penumbra),t.shadowRadius!==void 0&&(this.shadow.radius=t.shadowRadius),t.penumbraSize!==void 0&&e.scene.markPenumbraSizeDirty(),t.shadowResolution!==void 0&&(this.shadow.mapSize.set(t.shadowResolution,t.shadowResolution),this.shadow.map&&(this.shadow.map.dispose(),this.shadow.map=null))}}}),dl=z(()=>{$t(),Ws(),tt(),qr(),_a(),U3(),co(),z3(),Ye(),Mh(),tt(),rd(),Eh(),z6(),V3(),ke(),d0(),mn=class extends vx(ss){constructor(t,e,i){if(super(),this.data=e,this.bgColor=new yn(1,1,1,1),this.fog=null,this.backupFog=new TE(16777215,.1,2e3),this.fogUseBGColor=!1,this.fogMode="linear",this.fogDensity=ir.getDensity({}),this.fogHeightFalloff=ir.getHeightFalloff({}),this.fogHeightBase=ir.getHeightBase({}),this.isActive=!1,this.skyState=null,this.skyStateVersion=0,this.gradingState=null,this.skyHdriHolder=null,this.aoColor=new Jt,this.penumbraSizeArrayCache=null,this.super_Entity(t,e),this.personalCamera=new Zi(ed,{...pg.defaultData,...e.camera,name:"Personal Camera"}),this.personalCamera.objectHelper.visible=!1,this.add(this.personalCamera),this.activeCamera=this.personalCamera,this.ambientLight=new fF(13882323,8553090,.75*Math.PI),this.ambientLight.name="Default Ambient Light",this.ambientLight.layers.enable(3),this.ambientLight.removeFromParent(),this.add(this.ambientLight),e.uiScene){let n=kA();n===null?Gn("ui-2d","a page's 2D scene"):this.uiScene=new n.Scene2D((Array.isArray(t)?t[0]:t)+"-ui",e.uiScene,{dpr:window.devicePixelRatio,shared:i.shared})}else e.uiFrame&&this.createUICanvas(e.uiFrame,i)}get scene(){return this.parent}get postprocessing(){return this.data.postprocessing}get frameId(){return this.data.uiFrame}get frame(){return this.uiCanvas?.frame}createUICanvas(t,e){let i=kA();i!==null?(this.uiCanvas=new i.UICanvas(this.uuid+"-uiscreen",window.innerWidth,window.innerHeight,e),this.uiCanvas.isScreenSpace=!0,this.uiCanvas.promise.then(()=>{this.uiCanvas?.applyFrame(t),this.uiCanvas?.applySize()})):Gn("ui-2d","a page's UI canvas")}updateVisible(){}setBackgroundColor(t){this.bgColor=t,this.fogUseBGColor===!0&&(this.backupFog.color=t)}entityChildrenCount(){return this.uiScene?this.uiScene.children.length:super.entityChildrenCount()}updateAmbientLight(t,e){t.color!==void 0&&(this.ambientLight.color=mr(t.color,e)),t.intensity!==void 0&&(this.ambientLight.intensity=t.intensity*Math.PI),t.enabled!==void 0&&(t.enabled?this.add(this.ambientLight):this.remove(this.ambientLight))}onDeactive(){this.isActive=!1}onActive(t){this.isActive=!0,t.fog=this.fog,this.traverseEntity(e=>{e instanceof uh&&e.recomputeBoolean()}),this.updateShadow(this.data.shadow)}forceMaterialsUpdate(){this.traverseEntity(t=>{if(t instanceof Wr)if(Array.isArray(t.material))for(let e of t.material)e.needsUpdate=!0;else t.material.needsUpdate=!0,t.material.dispose()})}updateShadow(t){if(t.softShadowQuality===void 0&&t.type===void 0||!this.isActive)return;let e=this.data.shadow;var i,n;i=ug.isSoft(e),n=e?.softShadowQuality,vT!==void 0&&vT(i,n)&&this.forceMaterialsUpdate()}updateFog(t,e){t.enabled?this.fog=this.backupFog:this.fog=null,this.isActive&&(this.scene.fog=this.fog),this.fogUseBGColor=t.useBackgroundColor,t.useBackgroundColor?this.backupFog.color.set(this.bgColor):this.backupFog.color=mr(t.color,e),this.backupFog.near=t.near,this.backupFog.far=t.far,this.fogMode=ir.getMode(t),this.fogDensity=ir.getDensity(t),this.fogHeightFalloff=ir.getHeightFalloff(t),this.fogHeightBase=ir.getHeightBase(t)}updateSky(t,e){this.skyState=t??null,this.skyStateVersion++;let i=t?.hdri?.image;this.skyHdriHolder=i!=null?e.image(i):null}updateAo(t,e){t.aoColor!==void 0&&(this.aoColor=mr(t.aoColor,e))}updateByOp(t,e,i,n){let r=this.data.uiFrame;super.updateByOp(t,e,i,n);let s=e;ri(t.path,["fog"])?this.updateFog(s.fog,i.shared):ri(t.path,["sky"])?this.updateSky(s.sky,i.shared):ri(t.path,["grading"])?this.gradingState=s.grading??null:ri(t.path,["ao"])?this.updateAo(s.ao,i.shared):ri(t.path,["ambient"])?this.updateAmbientLight(s.ambient,i.shared):ri(t.path,["shadow"])?this.updateShadow(s.shadow):t.type===0&&t.path.length===0&&(t.props.uiFrame!==void 0||r!==s.uiFrame)&&this.updateUIFrame(t.props.uiFrame,i)}updateUIFrame(t,e){t?(this.uiCanvas||this.createUICanvas(t,e),this.uiCanvas.enabled=!0,this.uiCanvas.applyFrame(t)):this.uiCanvas&&(this.uiCanvas.enabled=!1)}updateState(t,e){this.updateState_Entity(t,e),t.backgroundColor!==void 0&&this.setBackgroundColor(mr(t.backgroundColor,e.shared)),t.fog!==void 0&&this.updateFog(t.fog,e.shared),t.sky!==void 0&&this.updateSky(t.sky,e.shared),t.grading!==void 0&&(this.gradingState=t.grading),t.ambient!==void 0&&this.updateAmbientLight(t.ambient,e.shared),t.ao!==void 0&&this.updateAo(t.ao,e.shared),t.shadow!==void 0&&this.updateShadow(t.shadow)}createFrame(t,e){}raycast(t,e){super.raycast(t,e)}switchActiveCamera(t){t instanceof Zi&&t.isDescendantOf(this)&&(this.activeCamera!==this.personalCamera&&(this.activeCamera.objectHelper.visible=!0),this.activeCamera=t,t.objectHelper.visible=!1)}get playCamera(){let t=this.scene?.find(this.data.publish.playCamera);return t instanceof Zi?t:this.personalCamera}switchToPlayCamera(){this.switchActiveCamera(this.playCamera)}get penumbraSizeArray(){return this.penumbraSizeArrayCache===null&&this.updatePenumbraSizeArray(),this.penumbraSizeArrayCache}updatePenumbraSizeArray(){this.penumbraSizeArrayCache=new Array(ol).fill(.5);let t=0,e=0;this.traverseEntity(i=>{if(!i.visible)return!0;i instanceof p0&&i.visible&&t<mg&&(this.penumbraSizeArrayCache[t]=i.data.penumbraSize??.5,t+=1),i instanceof f0&&i.visible&&t<ol-mg&&(this.penumbraSizeArrayCache[mg+e]=i.data.penumbraSize??.5,e+=1)})}raycastWithClones(t){let e=[],i=n=>{for(let r of n.children){let s=r.cloner;Be.is(r)&&(r.visible||s?.object.data.visible)&&((fa(r)||Ab(r)&&this.scene.enableHelpers&&r.objectHelper.visible)&&(t.intersectObject(r,!1,e),wT(r,t,e,!0)),i(r))}};return i(this),e}updateEntity2DByOp(t,e,i,n){this.uiCanvas?.updateEntity2DByOp(t,e,i,n)}}});function LL(){return F6}function C2(){if(Tb===null)throw new Error('[spe] Classic (WebGL) particles are not available in this build \u2014 it was compiled WebGPU-only. Re-export the scene with renderer "Both" or "WebGL 2", or load the full runtime.');return Tb}function P2(t){return t?.isWebGPUSplineRenderer===!0}var F6,Tb,np,N6=z(()=>{F6=null,Tb=null}),j3=z(()=>{tt(),px(),nd(),np=class extends id(xp,gp){constructor(t,e,i){super(),this.super_Entity(t,e),this.context=i,this.objectHelper.update()}updateState(t,e){this.updateState_Entity(t,e)}}}),nZ=_p((t,e)=>{var i,n;i=t,n=function(){return r.importState=function(s){var a=new r;return a.importState(s),a},r;function r(){return function(s){var a=0,o=0,l=0,c=1;s.length==0&&(s=[+new Date]);var h=function(){var p=4022871197,f=function(g){g=g.toString();for(var m=0;m<g.length;m++){var v=.02519603282416938*(p+=g.charCodeAt(m));v-=p=v>>>0,p=(v*=p)>>>0,p+=4294967296*(v-=p)}return 23283064365386963e-26*(p>>>0)};return f.version="Mash 0.9",f}();a=h(" "),o=h(" "),l=h(" ");for(var d=0;d<s.length;d++)(a-=h(s[d]))<0&&(a+=1),(o-=h(s[d]))<0&&(o+=1),(l-=h(s[d]))<0&&(l+=1);h=null;var u=function(){var p=2091639*a+23283064365386963e-26*c;return a=o,o=l,l=p-(c=0|p)};return u.next=u,u.uint32=function(){return 4294967296*u()},u.fract53=function(){return u()+11102230246251565e-32*(2097152*u()|0)},u.version="Alea 0.9",u.args=s,u.exportState=function(){return[a,o,l,c]},u.importState=function(p){a=+p[0]||0,o=+p[1]||0,l=+p[2]||0,c=+p[3]||0},u}(Array.prototype.slice.call(arguments))}},typeof t=="object"?e.exports=n():typeof define=="function"&&define.amd?define(n):i.Alea=n()});function rZ(t){let e=!1;return t.scene.objects.traverse((i,n)=>{n.type==="Mesh"&&n.geometry.type==="SubdivGeometry"&&(e=!0)}),e}var ta,jd,yp,m0=z(()=>{Kn(),tt(),Tp(),Ax(),Xr(),ta=new ci,jd=new T,yp=class extends Ai{constructor(t,e,i){super(t,e,i),this.data=e,this.hiddenMatrixOld=new At,this.smoothShading=!0,this.skipReactionUpdate=!1}chooseGeoemtryCache(t){return this.dataPatched.flatShading?t.geometryCache:t.geometryCache2}get subdivPointerNew(){return this.localGeometry!==void 0?this.subdivPointer:this.geometry.ensureSubdivPointer()}get originalGeometryNew(){return this.localGeometry!==void 0?this.originalGeometry:this.geometry.originalGeometry}get phongAngle(){return this.data.geometry.phongAngle??45}updateEntityBoxSize(t,e){let i=this.geometry.userData.parameters;t.copy(this.originalGeometryNew.boundingSphere.center),e.set(i.width,i.height,i.depth??0).multiplyScalar(.5)}createGeometryByControls(t){if(this.skipReactionUpdate===!0)return;let e=this.localGeometry?.uuid,{originalGeometry:i,subdividedGeometry:n,subdivPointer:r}=Ni.build(t,this.subdivPointer,this.smoothShading,this.hasNonUniformScale?this.shearScale:void 0);this.subdivPointer=r,i!==void 0&&(this.originalGeometry?.dispose(),this.originalGeometry=i),n!==void 0&&(this.subdividedGeometry?.dispose(),this.subdividedGeometry=n??void 0),this.localGeometry=this.subdividedGeometry??this.originalGeometry,ep(this),ip(this),this.calcBoundingBox(),e&&(this.localGeometry.uuid=e)}updateState(t,e){if(super.updateState(t,e),t.flatShading!==void 0){let i=this.material;this.material=Array.isArray(i)?i.map(n=>n.getFlavor(!1,n.side,n.wireframe)):i.getFlavor(!1,i.side,i.wireframe),this.smoothShading=!t.flatShading,this.createGeometryDelayed(e)}}updateMesh(t=!1,e=!1,i=!1){e&&this.subdividedGeometry||Ni.buildLevel(this.subdivPointer,!0,this.smoothShading?this.phongAngle:-1,this.originalGeometry,t&&this.hasNonUniformScale?this.shearScaleInv:void 0,i),this.subdividedGeometry&&Ni.buildLevel(this.subdivPointer,!1,this.smoothShading?this.phongAngle:-1,this.subdividedGeometry,t&&this.hasNonUniformScale?this.shearScaleInv:void 0)}updateTopology(){let t=this.localGeometry?.uuid;this.originalGeometry.dispose(),this.originalGeometry=Ni.buildLevel(this.subdivPointer,!0,this.smoothShading?this.phongAngle:-1),this.subdividedGeometry&&(this.subdividedGeometry.dispose(),this.subdividedGeometry=Ni.buildLevel(this.subdivPointer,!1,this.smoothShading?this.phongAngle:-1)),this.localGeometry=this.subdividedGeometry??this.originalGeometry,ep(this),ip(this),this.calcBoundingBox(),t&&(this.localGeometry.uuid=t)}raycast(t,e){let i=this.localGeometry;this.localGeometry=this.originalGeometryNew,Yi.prototype.raycast.call(this,t,e),this.localGeometry=i}activateShearCompensation(){!this.hasNonUniformScale||(this.matrix.copy(this.matrixWorldRigid),this.hiddenMatrixOld.copy(this.hiddenMatrix),this.hiddenMatrix.copy(this.parent.matrixWorld).invert())}deactivateShearCompensation(){!this.hasNonUniformScale||(this.updateMatrix(),this.hasNonUniformScale=void 0,this.hiddenMatrix.copy(this.hiddenMatrixOld))}calcBoundingBox(){let t=this.originalGeometry;t.boundingSphere===null&&(t.boundingSphere=new yr,this.subdividedGeometry&&(this.subdividedGeometry.boundingSphere=t.boundingSphere));let e=t.attributes.position,i=t.boundingSphere.center;ta.setFromBufferAttribute(e),ta.getCenter(i),t.boundingSphere.radius=i.distanceTo(ta.max),isNaN(t.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this),ta.getSize(jd),this.hasNonUniformScale&&jd.divide(this.scale);let n={width:jd.x,height:jd.y,depth:jd.z};return this.geometry.userData.parameters=n,n}updateBoundingSphere(t){let e=this.originalGeometry;ta.min.set(t[0],t[2],t[4]),ta.max.set(t[1],t[3],t[5]),this.hasNonUniformScale&&(ta.min.applyMatrix4(this.shearScaleInv),ta.max.applyMatrix4(this.shearScaleInv)),e.boundingSphere===null&&(e.boundingSphere=new yr);let i=e.boundingSphere.center;ta.getCenter(i),e.boundingSphere.radius=i.distanceTo(ta.max)}freeSubdivPointer(){this.subdivPointer&&(Ni.freeSubdivPointer(this.subdivPointer),this.subdivPointer=0),this.localGeometry=void 0,this.originalGeometry?.dispose(),this.subdividedGeometry?.dispose()}dispose(){super.dispose(),this.freeSubdivPointer()}updateSubdivisionLevel(t){if(this.skipReactionUpdate===!0)return;let e=this.localGeometry,i=e?.uuid,n=e?.userData.parameters,r=t.subdivisions>0?Ni.buildRefined(this.subdivPointer,t.subdivisions,this.smoothShading?t.phongAngle??35:-1):null;this.subdividedGeometry?.dispose(),this.subdividedGeometry=r??void 0,this.subdividedGeometry&&this.originalGeometry.boundingSphere&&(this.subdividedGeometry.boundingSphere=this.originalGeometry.boundingSphere),this.localGeometry=this.subdividedGeometry??this.originalGeometry,ep(this),ip(this),n!==void 0&&(this.localGeometry.userData.parameters=n),i&&(this.localGeometry.uuid=i)}updateByPatchedOpGeometry(t,e,i){super.updateByPatchedOpGeometry(t,e,i),this.localGeometry&&(t.type===0&&t.path.length===0&&S6(t.props)&&this.subdivPointer?this.updateSubdivisionLevel(e):this.createGeometryByControls(e))}}});function G3(t){if(t.component){let e=t.component.instances.indexOf(t);e>=0&&t.component.instances.splice(e,1);for(let i of t.children)Be.is(i)&&G3(i)}}var bg,MT,Px,k6=z(()=>{qr()}),sZ=_p((t,e)=>{function i(n,r,s,a){this.message=n,this.expected=r,this.found=s,this.location=a,this.name="SyntaxError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,i)}(function(n,r){function s(){this.constructor=n}s.prototype=r.prototype,n.prototype=new s})(i,Error),i.buildMessage=function(n,r){var s,a={literal:function(d){return'"'+l(d.text)+'"'},class:function(d){var u,p="";for(u=0;u<d.parts.length;u++)p+=d.parts[u]instanceof Array?c(d.parts[u][0])+"-"+c(d.parts[u][1]):c(d.parts[u]);return"["+(d.inverted?"^":"")+p+"]"},any:function(d){return"any character"},end:function(d){return"end of input"},other:function(d){return d.description}};function o(d){return d.charCodeAt(0).toString(16).toUpperCase()}function l(d){return d.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(u){return"\\x0"+o(u)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(u){return"\\x"+o(u)})}function c(d){return d.replace(/\\/g,"\\\\").replace(/\]/g,"\\]").replace(/\^/g,"\\^").replace(/-/g,"\\-").replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(u){return"\\x0"+o(u)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(u){return"\\x"+o(u)})}function h(d){return a[d.type](d)}return"Expected "+function(d){var u,p,f=new Array(d.length);for(u=0;u<d.length;u++)f[u]=h(d[u]);if(f.sort(),f.length>0){for(u=1,p=1;u<f.length;u++)f[u-1]!==f[u]&&(f[p]=f[u],p++);f.length=p}switch(f.length){case 1:return f[0];case 2:return f[0]+" or "+f[1];default:return f.slice(0,-1).join(", ")+", or "+f[f.length-1]}}(n)+" but "+((s=r)?'"'+l(s)+'"':"end of input")+" found."},e.exports={SyntaxError:i,parse:function(n,r){r=r!==void 0?r:{};var s,a={},o={svg_path:Pe},l=Pe,c=function(Q){if(!Q)return[];for(var Et=[],lt=0;lt<Q.length;lt++)Et=Et.concat.apply(Et,Q[lt]);var xt=Et[0];return xt&&xt.code=="m"&&(delete xt.relative,xt.code="M"),Et},h=function(Q,Et){return function(lt,xt){if(!xt)return[lt];for(var Rt=[lt],I=0,rt=xt.length;I<rt;I++)Rt[I+1]=xt[I][1];return Rt}(Q,Et)},d=/^[Mm]/,u=be(["M","m"],!1,!1),p=function(Q,Et,lt){var xt=mo(Q,[Et]);return lt&&(xt=xt.concat(mo(Q=="M"?"L":"l",lt[1]))),xt},f=/^[Zz]/,g=be(["Z","z"],!1,!1),m=function(){return mo("Z")},v=/^[Ll]/,y=be(["L","l"],!1,!1),_=function(Q,Et){return mo(Q,Et)},b=/^[Hh]/,x=be(["H","h"],!1,!1),w=function(Q,Et){return mo(Q,Et.map(function(lt){return{x:lt}}))},S=/^[Vv]/,E=be(["V","v"],!1,!1),A=function(Q,Et){return mo(Q,Et.map(function(lt){return{y:lt}}))},P=/^[Cc]/,C=be(["C","c"],!1,!1),R=function(Q,Et,lt){return{x1:Q.x,y1:Q.y,x2:Et.x,y2:Et.y,x:lt.x,y:lt.y}},L=/^[Ss]/,D=be(["S","s"],!1,!1),F=function(Q,Et){return{x2:Q.x,y2:Q.y,x:Et.x,y:Et.y}},V=/^[Qq]/,U=be(["Q","q"],!1,!1),j=function(Q,Et){return{x1:Q.x,y1:Q.y,x:Et.x,y:Et.y}},W=/^[Tt]/,it=be(["T","t"],!1,!1),nt=/^[Aa]/,Y=be(["A","a"],!1,!1),ot=function(Q,Et,lt,xt,Rt,I){return{rx:Q,ry:Et,xAxisRotation:lt,largeArc:xt,sweep:Rt,x:I.x,y:I.y}},ht=function(Q,Et){return{x:Q,y:Et}},ft=function(Q){return 1*Q},pt=function(Q){return 1*Q.join("")},J=/^[01]/,mt=be(["0","1"],!1,!1),N=function(Q){return Q=="1"},O=function(){return""},H=",",$=_e(",",!1),B=function(Q){return Q.join("")},Z=".",K=_e(".",!1),k=/^[eE]/,st=be(["e","E"],!1,!1),dt=/^[+\-]/,bt=be(["+","-"],!1,!1),ct=/^[0-9]/,It=be([["0","9"]],!1,!1),St=function(Q){return Q.join("")},Dt=/^[ \t\n\r]/,Mt=be([" "," ",`
4179
4179
  `,"\r"],!1,!1),q=0,_t=[{line:1,column:1}],Pt=0,Gt=[],Ft=0;if("startRule"in r){if(!(r.startRule in o))throw new Error(`Can't start parsing from rule "`+r.startRule+'".');l=o[r.startRule]}function _e(Q,Et){return{type:"literal",text:Q,ignoreCase:Et}}function be(Q,Et,lt){return{type:"class",parts:Q,inverted:Et,ignoreCase:lt}}function ji(Q){var Et,lt=_t[Q];if(lt)return lt;for(Et=Q-1;!_t[Et];)Et--;for(lt={line:(lt=_t[Et]).line,column:lt.column};Et<Q;)n.charCodeAt(Et)===10?(lt.line++,lt.column=1):lt.column++,Et++;return _t[Q]=lt,lt}function oe(Q,Et){var lt=ji(Q),xt=ji(Et);return{start:{offset:Q,line:lt.line,column:lt.column},end:{offset:Et,line:xt.line,column:xt.column}}}function le(Q){q<Pt||(q>Pt&&(Pt=q,Gt=[]),Gt.push(Q))}function Pe(){var Q,Et,lt,xt,Rt;for(Q=q,Et=[],lt=Oe();lt!==a;)Et.push(lt),lt=Oe();if(Et!==a)if(lt=function(){var I,rt,vt,wt,at,yt;if(I=q,(rt=si())!==a){for(vt=[],wt=q,at=[],yt=Oe();yt!==a;)at.push(yt),yt=Oe();for(at!==a&&(yt=si())!==a?wt=at=[at,yt]:(q=wt,wt=a);wt!==a;){for(vt.push(wt),wt=q,at=[],yt=Oe();yt!==a;)at.push(yt),yt=Oe();at!==a&&(yt=si())!==a?wt=at=[at,yt]:(q=wt,wt=a)}vt!==a?I=rt=h(rt,vt):(q=I,I=a)}else q=I,I=a;return I}(),lt===a&&(lt=null),lt!==a){for(xt=[],Rt=Oe();Rt!==a;)xt.push(Rt),Rt=Oe();xt!==a?Q=Et=c(lt):(q=Q,Q=a)}else q=Q,Q=a;else q=Q,Q=a;return Q}function si(){var Q,Et,lt,xt,Rt,I;if(Q=q,Et=function(){var rt,vt,wt,at,yt,Lt,Yt;if(rt=q,d.test(n.charAt(q))?(vt=n.charAt(q),q++):(vt=a,Ft===0&&le(u)),vt!==a){for(wt=[],at=Oe();at!==a;)wt.push(at),at=Oe();wt!==a&&(at=bn())!==a?(yt=q,(Lt=xe())===a&&(Lt=null),Lt!==a&&(Yt=Ci())!==a?yt=Lt=[Lt,Yt]:(q=yt,yt=a),yt===a&&(yt=null),yt!==a?rt=vt=p(vt,at,yt):(q=rt,rt=a)):(q=rt,rt=a)}else q=rt,rt=a;return rt}(),Et!==a){for(lt=[],xt=q,Rt=[],I=Oe();I!==a;)Rt.push(I),I=Oe();for(Rt!==a&&(I=ze())!==a?xt=Rt=[Rt,I]:(q=xt,xt=a);xt!==a;){for(lt.push(xt),xt=q,Rt=[],I=Oe();I!==a;)Rt.push(I),I=Oe();Rt!==a&&(I=ze())!==a?xt=Rt=[Rt,I]:(q=xt,xt=a)}lt!==a?Q=Et=h(Et,lt):(q=Q,Q=a)}else q=Q,Q=a;return Q}function ze(){var Q,Et;return f.test(n.charAt(q))?(Et=n.charAt(q),q++):(Et=a,Ft===0&&le(g)),Et!==a&&(Et=m()),(Q=Et)===a&&(Q=function(){var lt,xt,Rt,I;if(lt=q,v.test(n.charAt(q))?(xt=n.charAt(q),q++):(xt=a,Ft===0&&le(y)),xt!==a){for(Rt=[],I=Oe();I!==a;)Rt.push(I),I=Oe();Rt!==a&&(I=Ci())!==a?lt=xt=_(xt,I):(q=lt,lt=a)}else q=lt,lt=a;return lt}())===a&&(Q=function(){var lt,xt,Rt,I;if(lt=q,b.test(n.charAt(q))?(xt=n.charAt(q),q++):(xt=a,Ft===0&&le(x)),xt!==a){for(Rt=[],I=Oe();I!==a;)Rt.push(I),I=Oe();Rt!==a&&(I=ui())!==a?lt=xt=w(xt,I):(q=lt,lt=a)}else q=lt,lt=a;return lt}())===a&&(Q=function(){var lt,xt,Rt,I;if(lt=q,S.test(n.charAt(q))?(xt=n.charAt(q),q++):(xt=a,Ft===0&&le(E)),xt!==a){for(Rt=[],I=Oe();I!==a;)Rt.push(I),I=Oe();Rt!==a&&(I=ui())!==a?lt=xt=A(xt,I):(q=lt,lt=a)}else q=lt,lt=a;return lt}())===a&&(Q=function(){var lt,xt,Rt,I;if(lt=q,P.test(n.charAt(q))?(xt=n.charAt(q),q++):(xt=a,Ft===0&&le(C)),xt!==a){for(Rt=[],I=Oe();I!==a;)Rt.push(I),I=Oe();Rt!==a?(I=function(){var rt,vt,wt,at,yt,Lt;if(rt=q,(vt=sn())!==a){for(wt=[],at=q,(yt=xe())===a&&(yt=null),yt!==a&&(Lt=sn())!==a?at=yt=[yt,Lt]:(q=at,at=a);at!==a;)wt.push(at),at=q,(yt=xe())===a&&(yt=null),yt!==a&&(Lt=sn())!==a?at=yt=[yt,Lt]:(q=at,at=a);wt!==a?rt=vt=h(vt,wt):(q=rt,rt=a)}else q=rt,rt=a;return rt}(),I!==a?lt=xt=_(xt,I):(q=lt,lt=a)):(q=lt,lt=a)}else q=lt,lt=a;return lt}())===a&&(Q=function(){var lt,xt,Rt,I;if(lt=q,L.test(n.charAt(q))?(xt=n.charAt(q),q++):(xt=a,Ft===0&&le(D)),xt!==a){for(Rt=[],I=Oe();I!==a;)Rt.push(I),I=Oe();Rt!==a?(I=function(){var rt,vt,wt,at,yt,Lt;if(rt=q,(vt=Qr())!==a){for(wt=[],at=q,(yt=xe())===a&&(yt=null),yt!==a&&(Lt=Qr())!==a?at=yt=[yt,Lt]:(q=at,at=a);at!==a;)wt.push(at),at=q,(yt=xe())===a&&(yt=null),yt!==a&&(Lt=Qr())!==a?at=yt=[yt,Lt]:(q=at,at=a);wt!==a?rt=vt=h(vt,wt):(q=rt,rt=a)}else q=rt,rt=a;return rt}(),I!==a?lt=xt=_(xt,I):(q=lt,lt=a)):(q=lt,lt=a)}else q=lt,lt=a;return lt}())===a&&(Q=function(){var lt,xt,Rt,I;if(lt=q,V.test(n.charAt(q))?(xt=n.charAt(q),q++):(xt=a,Ft===0&&le(U)),xt!==a){for(Rt=[],I=Oe();I!==a;)Rt.push(I),I=Oe();Rt!==a?(I=function(){var rt,vt,wt,at,yt,Lt;if(rt=q,(vt=_n())!==a){for(wt=[],at=q,(yt=xe())===a&&(yt=null),yt!==a&&(Lt=_n())!==a?at=yt=[yt,Lt]:(q=at,at=a);at!==a;)wt.push(at),at=q,(yt=xe())===a&&(yt=null),yt!==a&&(Lt=_n())!==a?at=yt=[yt,Lt]:(q=at,at=a);wt!==a?rt=vt=h(vt,wt):(q=rt,rt=a)}else q=rt,rt=a;return rt}(),I!==a?lt=xt=_(xt,I):(q=lt,lt=a)):(q=lt,lt=a)}else q=lt,lt=a;return lt}())===a&&(Q=function(){var lt,xt,Rt,I;if(lt=q,W.test(n.charAt(q))?(xt=n.charAt(q),q++):(xt=a,Ft===0&&le(it)),xt!==a){for(Rt=[],I=Oe();I!==a;)Rt.push(I),I=Oe();Rt!==a?(I=function(){var rt,vt,wt,at,yt,Lt;if(rt=q,(vt=bn())!==a){for(wt=[],at=q,(yt=xe())===a&&(yt=null),yt!==a&&(Lt=bn())!==a?at=yt=[yt,Lt]:(q=at,at=a);at!==a;)wt.push(at),at=q,(yt=xe())===a&&(yt=null),yt!==a&&(Lt=bn())!==a?at=yt=[yt,Lt]:(q=at,at=a);wt!==a?rt=vt=h(vt,wt):(q=rt,rt=a)}else q=rt,rt=a;return rt}(),I!==a?lt=xt=_(xt,I):(q=lt,lt=a)):(q=lt,lt=a)}else q=lt,lt=a;return lt}())===a&&(Q=function(){var lt,xt,Rt,I;if(lt=q,nt.test(n.charAt(q))?(xt=n.charAt(q),q++):(xt=a,Ft===0&&le(Y)),xt!==a){for(Rt=[],I=Oe();I!==a;)Rt.push(I),I=Oe();Rt!==a?(I=function(){var rt,vt,wt,at,yt,Lt;if(rt=q,(vt=Jr())!==a){for(wt=[],at=q,(yt=xe())===a&&(yt=null),yt!==a&&(Lt=Jr())!==a?at=yt=[yt,Lt]:(q=at,at=a);at!==a;)wt.push(at),at=q,(yt=xe())===a&&(yt=null),yt!==a&&(Lt=Jr())!==a?at=yt=[yt,Lt]:(q=at,at=a);wt!==a?rt=vt=h(vt,wt):(q=rt,rt=a)}else q=rt,rt=a;return rt}(),I!==a?lt=xt=_(xt,I):(q=lt,lt=a)):(q=lt,lt=a)}else q=lt,lt=a;return lt}()),Q}function Ci(){var Q,Et,lt,xt,Rt,I;if(Q=q,(Et=bn())!==a){for(lt=[],xt=q,(Rt=xe())===a&&(Rt=null),Rt!==a&&(I=bn())!==a?xt=Rt=[Rt,I]:(q=xt,xt=a);xt!==a;)lt.push(xt),xt=q,(Rt=xe())===a&&(Rt=null),Rt!==a&&(I=bn())!==a?xt=Rt=[Rt,I]:(q=xt,xt=a);lt!==a?Q=Et=h(Et,lt):(q=Q,Q=a)}else q=Q,Q=a;return Q}function ui(){var Q,Et,lt,xt,Rt,I;if(Q=q,(Et=fo())!==a){for(lt=[],xt=q,(Rt=xe())===a&&(Rt=null),Rt!==a&&(I=fo())!==a?xt=Rt=[Rt,I]:(q=xt,xt=a);xt!==a;)lt.push(xt),xt=q,(Rt=xe())===a&&(Rt=null),Rt!==a&&(I=fo())!==a?xt=Rt=[Rt,I]:(q=xt,xt=a);lt!==a?Q=Et=h(Et,lt):(q=Q,Q=a)}else q=Q,Q=a;return Q}function sn(){var Q,Et,lt,xt,Rt,I;return Q=q,(Et=bn())!==a?((lt=xe())===a&&(lt=null),lt!==a&&(xt=bn())!==a?((Rt=xe())===a&&(Rt=null),Rt!==a&&(I=bn())!==a?Q=Et=R(Et,xt,I):(q=Q,Q=a)):(q=Q,Q=a)):(q=Q,Q=a),Q}function Qr(){var Q,Et,lt,xt;return Q=q,(Et=bn())!==a?((lt=xe())===a&&(lt=null),lt!==a&&(xt=bn())!==a?Q=Et=F(Et,xt):(q=Q,Q=a)):(q=Q,Q=a),Q}function _n(){var Q,Et,lt,xt;return Q=q,(Et=bn())!==a?((lt=xe())===a&&(lt=null),lt!==a&&(xt=bn())!==a?Q=Et=j(Et,xt):(q=Q,Q=a)):(q=Q,Q=a),Q}function Jr(){var Q,Et,lt,xt,Rt,I,rt,vt,wt,at,yt;return Q=q,(Et=gt())!==a?((lt=xe())===a&&(lt=null),lt!==a&&(xt=gt())!==a?((Rt=xe())===a&&(Rt=null),Rt!==a&&(I=fo())!==a&&xe()!==a&&(rt=Fp())!==a?((vt=xe())===a&&(vt=null),vt!==a&&(wt=Fp())!==a?((at=xe())===a&&(at=null),at!==a&&(yt=bn())!==a?Q=Et=ot(Et,xt,I,rt,wt,yt):(q=Q,Q=a)):(q=Q,Q=a)):(q=Q,Q=a)):(q=Q,Q=a)):(q=Q,Q=a),Q}function bn(){var Q,Et,lt,xt;return Q=q,(Et=fo())!==a?((lt=xe())===a&&(lt=null),lt!==a&&(xt=fo())!==a?Q=Et=ht(Et,xt):(q=Q,Q=a)):(q=Q,Q=a),Q}function gt(){var Q;return(Q=kp())===a&&(Q=xa()),Q!==a&&(Q=ft(Q)),Q}function fo(){var Q,Et,lt;return Q=q,(Et=ud())===a&&(Et=null),Et!==a&&(lt=kp())!==a?Q=Et=[Et,lt]:(q=Q,Q=a),Q===a&&(Q=q,(Et=ud())===a&&(Et=null),Et!==a&&(lt=xa())!==a?Q=Et=[Et,lt]:(q=Q,Q=a)),Q!==a&&(Q=pt(Q)),Q}function Fp(){var Q;return J.test(n.charAt(q))?(Q=n.charAt(q),q++):(Q=a,Ft===0&&le(mt)),Q!==a&&(Q=N(Q)),Q}function xe(){var Q,Et,lt,xt,Rt;if(Q=q,Et=[],(lt=Oe())!==a)for(;lt!==a;)Et.push(lt),lt=Oe();else Et=a;if(Et!==a)if((lt=Np())===a&&(lt=null),lt!==a){for(xt=[],Rt=Oe();Rt!==a;)xt.push(Rt),Rt=Oe();xt!==a?Q=Et=[Et,lt,xt]:(q=Q,Q=a)}else q=Q,Q=a;else q=Q,Q=a;if(Q===a){if(Q=q,Et=q,(lt=Np())!==a){for(xt=[],Rt=Oe();Rt!==a;)xt.push(Rt),Rt=Oe();xt!==a?Et=lt=[lt,xt]:(q=Et,Et=a)}else q=Et,Et=a;Et!==a&&(Et=O()),Q=Et}return Q}function Np(){var Q;return n.charCodeAt(q)===44?(Q=H,q++):(Q=a,Ft===0&&le($)),Q}function kp(){var Q,Et,lt;return Q=q,Et=function(){var xt,Rt,I,rt;return xt=q,(Rt=xa())===a&&(Rt=null),Rt!==a?(n.charCodeAt(q)===46?(I=Z,q++):(I=a,Ft===0&&le(K)),I!==a&&(rt=xa())!==a?xt=Rt=[Rt,I,rt]:(q=xt,xt=a)):(q=xt,xt=a),xt===a&&(xt=q,(Rt=xa())!==a?(n.charCodeAt(q)===46?(I=Z,q++):(I=a,Ft===0&&le(K)),I!==a?xt=Rt=[Rt,I]:(q=xt,xt=a)):(q=xt,xt=a)),xt!==a&&(xt=B(xt)),xt}(),Et!==a?((lt=Vp())===a&&(lt=null),lt!==a?Q=Et=[Et,lt]:(q=Q,Q=a)):(q=Q,Q=a),Q===a&&(Q=q,(Et=xa())!==a&&(lt=Vp())!==a?Q=Et=[Et,lt]:(q=Q,Q=a)),Q!==a&&(Q=B(Q)),Q}function Vp(){var Q,Et,lt,xt;return Q=q,k.test(n.charAt(q))?(Et=n.charAt(q),q++):(Et=a,Ft===0&&le(st)),Et!==a?((lt=ud())===a&&(lt=null),lt!==a&&(xt=xa())!==a?Q=Et=[Et,lt,xt]:(q=Q,Q=a)):(q=Q,Q=a),Q!==a&&(Q=B(Q)),Q}function ud(){var Q;return dt.test(n.charAt(q))?(Q=n.charAt(q),q++):(Q=a,Ft===0&&le(bt)),Q}function xa(){var Q,Et;if(Q=[],ct.test(n.charAt(q))?(Et=n.charAt(q),q++):(Et=a,Ft===0&&le(It)),Et!==a)for(;Et!==a;)Q.push(Et),ct.test(n.charAt(q))?(Et=n.charAt(q),q++):(Et=a,Ft===0&&le(It));else Q=a;return Q!==a&&(Q=St(Q)),Q}function Oe(){var Q;return Dt.test(n.charAt(q))?(Q=n.charAt(q),q++):(Q=a,Ft===0&&le(Mt)),Q!==a&&(Q=O()),Q}var pd,fd,wa,ml={m:"moveto",l:"lineto",h:"horizontal lineto",v:"vertical lineto",c:"curveto",s:"smooth curveto",q:"quadratic curveto",t:"smooth quadratic curveto",a:"elliptical arc",z:"closepath"};for(var jp in ml)ml[jp.toUpperCase()]=ml[jp];function mo(Q,Et){Et||(Et=[{}]);for(var lt=Et.length;lt--;){var xt={code:Q,command:ml[Q]};for(var Rt in Q==Q.toLowerCase()&&(xt.relative=!0),Et[lt])xt[Rt]=Et[lt][Rt];Et[lt]=xt}return Et}if((s=l())!==a&&q===n.length)return s;throw s!==a&&q<n.length&&le({type:"end"}),pd=Gt,fd=Pt<n.length?n.charAt(Pt):null,wa=Pt<n.length?oe(Pt,Pt+1):oe(Pt,Pt),new i(i.buildMessage(pd,fd),pd,fd,wa)}}}),H3=_p((t,e)=>{var i=sZ().parse;i.parseSVG=i,i.makeAbsolute=function(n){var r,s={x:0,y:0},a={x:"x0",y:"y0",x1:"x0",y1:"y0",x2:"x0",y2:"y0"};return n.forEach(function(o){for(var l in o.command==="moveto"&&(r=o),o.x0=s.x,o.y0=s.y,a)l in o&&(o[l]+=o.relative?o[a[l]]:0);"x"in o||(o.x=s.x),"y"in o||(o.y=s.y),o.relative=!1,o.code=o.code.toUpperCase(),o.command=="closepath"&&(o.x=r.x,o.y=r.y),s=o}),n},e.exports=i}),V6=z(()=>{bg=new Set}),aZ=z(()=>{tt(),a0(),o0(),MT=class extends Sp(bF){constructor(t,e=15,i=6710886){super(t,e,i),this.object=t,this.name=`PointLightHelper: ${t.uuid}`}raycast(t,e){Mp(this.object,MT.geometryHelper,t,e)}}}),j6=z(()=>{tt(),aZ(),u0(),Px=class extends Tx(gF,MT){constructor(t,e,i){super(),this.super_Entity(t,e),this.castShadow=!0,this.shadow.mapSize.width=1024,this.shadow.mapSize.height=1024,this.shadow.normalBias=1,this.layers.enable(3);let n=this.shadow.camera;n.fov=90,n.aspect=1,n.near=100,n.far=2500;let r=new T(-n.far+this.position.x,-n.far+this.position.y,-n.far+this.position.z),s=new T(n.far+this.position.x,n.far+this.position.y,n.far+this.position.z),a=new ci(r,s),o=new Fg(a,new Jt(16755200));o.visible=!1,this.gizmos.shadowmap=o,this.update()}update(){if(this.shadow&&(this.shadow.camera.updateProjectionMatrix(),this.gizmos))for(let t in this.gizmos){let e=this.gizmos[t];if(e instanceof Fg){let i=this.shadow.camera,n=new T(-i.far+this.position.x,-i.far+this.position.y,-i.far+this.position.z),r=new T(i.far+this.position.x,i.far+this.position.y,i.far+this.position.z);e.box.set(n,r),e.updateMatrixWorld(!0)}}}updateMatrixWorld(t){super.updateMatrixWorld(t),this.objectHelper&&this.objectHelper.update()}updateState(t,e){this.updateState_Light(t,e),t.distance!==void 0&&(this.distance=t.distance),t.decay!==void 0&&(this.decay=t.decay),t.shadowRadius!==void 0&&(this.shadow.radius=t.shadowRadius),t.shadowResolution!==void 0&&(this.shadow.mapSize.set(t.shadowResolution,t.shadowResolution),this.shadow.map&&(this.shadow.map.dispose(),this.shadow.map=null))}}});function BL(t){let e=ET.get(t);return e===void 0&&(e=G6++,ET.set(t,e)),e}function oZ(t,e,i,n){let r=t,s=e;return[BL(i),BL(n),r.layers?.mask??0,r.renderOrder??0,(r.castShadow??s.castShadow)===!0?1:0,(r.receiveShadow??s.receiveShadow)===!0?1:0].join(":")}var ET,G6,AT,TT,qv,H6,lZ=z(()=>{Bi(),ET=new WeakMap,G6=1}),hZ=z(()=>{tt(),TT=(AT=[8,32,128,512])[AT.length-1],qv=new At().makeScale(0,0,0),H6=class extends tx{constructor(t,e,i,n){super(t,e,i),this.isInstanceGroup=!0,this.members=new Array(i).fill(null),this.raycast=()=>{},this.matrixAutoUpdate=!1,this.frustumCulled=!1,this.adoptPassState(n);for(let r=0;r<i;r++)this.setMatrixAt(r,qv);this.instanceMatrix.needsUpdate=!0}adoptPassState(t){this.layers.mask=t.layers.mask,this.renderOrder=t.renderOrder,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow}assign(t,e){this.members[t]=e}writeSlot(t,e,i){return i===!1?(this.setMatrixAt(t,qv),!1):(this.setMatrixAt(t,e.matrixWorld),!0)}park(t){this.members[t]=null,this.setMatrixAt(t,qv)}get memberCount(){let t=0;for(let e of this.members)e!==null&&t++;return t}}});function W6(t,e){let i=e.get(t);if(i!==void 0)return i;let n=t.visible&&(t.parent===null||W6(t.parent,e));return e.set(t,n),n}var q6,cZ=z(()=>{lZ(),hZ(),q6=class{constructor(t=8){this.minGroupSize=t,this.groups=[],this.groupKeys=new WeakMap,this.placements=new Map,this.visibilityMemo=new Map,this.page=null,this.stats={instancingGroups:0,instancedDrawsSaved:0,instancingRegroups:0,instancingParks:0,instancingIneligible:{}}}update(t,e){this.page!==t&&(this.teardown(),this.page=t,e=!0),t.matrixWorldAutoUpdate===!0&&t.updateMatrixWorld(),e&&this.reconcile(t),this.refresh()}reconcile(t){let e={},i=new Map;t.traverse(s=>{if(s.isInstanceGroup===!0)return;let a=function(l){if(l.isMesh!==!0)return"not-a-mesh";if(ll(l)||Pr(l)||Yc(l)||gg(l))return"excluded-type";let c=function(f){let g=Cc(f)?f.object:f;return g.geometry!==void 0?g:void 0}(l);if(c===void 0)return"not-a-mesh";let h=c.material;if(h===void 0)return"not-a-mesh";if(Array.isArray(h))return"array-material";let d=c.builtSharedGeometry;if(d===void 0)return"unrealized-geometry";if(!function(f){return f.isShared===!0}(d))return"unshared-geometry";if(d.attributes.position===void 0)return"empty-geometry";if(d.morphAttributes.position!==void 0)return"morph";if(c.isSkinnedMesh===!0)return"skinned";let u=c.morphTargetInfluences;if(u!==void 0&&u.length>0)return"morph";if(d.drawRange.start!==0||d.drawRange.count!==Number.POSITIVE_INFINITY)return"draw-range";let p=h;return p.positionNode!=null||p.castShadowPositionNode!=null?"position-node":p.transparent===!0?"transparent":c.userData?.__splinePlanarMirror!==void 0?"reflection":function(f){let g=f;for(;g!==null;){let m=g.states;if(m!==void 0&&Object.keys(m).length>0)return!0;g=g.parent}return!1}(c)?"interaction-states":{object:l,owner:c,geometry:d,material:h,key:oZ(l,c,d,h)}}(s);if(typeof a=="string")return void(e[a]=(e[a]??0)+1);let o=i.get(a.key);o===void 0?i.set(a.key,[a]):o.push(a)});let n=new Map;for(let[s,a]of i)for(let o of a)n.set(o.object,s);let r=!1;for(let[s,a]of this.placements)n.get(s)!==this.groupKeys.get(a.group)&&this.parkPlacement(s,a);for(let s=this.groups.length-1;s>=0;s--){let a=this.groups[s];a.memberCount>=this.minGroupSize||(this.destroyGroup(a),this.groups.splice(s,1),r=!0)}for(let[s,a]of i){let o=a.filter(c=>!this.placements.has(c.object));if(o.length===0)continue;let l=0;for(let c of this.groups){if(l>=o.length)break;if(this.groupKeys.get(c)!==s)continue;let{members:h}=c;for(let d=0;d<h.length&&l<o.length;d++)h[d]===null&&this.place(c,d,o[l++].object)}for(;o.length-l>=this.minGroupSize;){let c=o.slice(l,l+TT);this.groups.push(this.createGroup(t,s,c)),l+=c.length,r=!0}}r&&this.stats.instancingRegroups++,this.publishGroupStats(),this.stats.instancingIneligible=e}createGroup(t,e,i){let n=i[0],r=new H6(n.geometry,n.material,function(s){for(let a of AT)if(s<=a)return a;return TT}(i.length),n.object);this.groupKeys.set(r,e);for(let s=0;s<i.length;s++)this.place(r,s,i[s].object);return t.add(r),r}destroyGroup(t){for(let e=0;e<t.members.length;e++){let i=t.members[e];i!==null&&this.parkPlacement(i,{group:t,slot:e})}t.removeFromParent(),t.dispose()}place(t,e,i){t.assign(e,i),this.placements.set(i,{group:t,slot:e}),i.isDrawSuppressed=!0}parkPlacement(t,e){e.group.park(e.slot),e.group.instanceMatrix.needsUpdate=!0,this.placements.delete(t),t.isDrawSuppressed=!1,this.stats.instancingParks++}refresh(){this.visibilityMemo.clear();for(let t of this.groups){let{members:e}=t,i=null;for(let n=0;n<e.length;n++){let r=e[n];r!==null&&(i===null&&(i=r),t.writeSlot(n,r,W6(r,this.visibilityMemo)))}i!==null&&(t.adoptPassState(i),t.instanceMatrix.needsUpdate=!0)}}teardown(){for(let t of this.groups)this.destroyGroup(t);this.groups.length=0;for(let t of this.placements.keys())t.isDrawSuppressed=!1;this.placements.clear(),this.publishGroupStats()}dispose(){this.teardown(),this.page=null}publishGroupStats(){let t=0;for(let e of this.groups){let i=e.memberCount;i>0&&(t+=i-1)}this.stats.instancingGroups=this.groups.length,this.stats.instancedDrawsSaved=t}}});function dZ(t,e,i){i.length=0;let{axis:n,sign:r,limit:s}=e;for(let a=0;a<t.length;a++){let o=t[a],l=t[(a+1)%t.length],c=(n===0?o.px:n===1?o.py:o.pz)*r-s,h=(n===0?l.px:n===1?l.py:l.pz)*r-s,d=c<=0,u=h<=0;if(d&&i.push(o),d!==u){let p=c/(c-h);i.push({px:o.px+(l.px-o.px)*p,py:o.py+(l.py-o.py)*p,pz:o.pz+(l.pz-o.pz)*p,nx:o.nx+(l.nx-o.nx)*p,ny:o.ny+(l.ny-o.ny)*p,nz:o.nz+(l.nz-o.nz)*p})}}return i}function uZ(t,e,i,n,r,s,a,o,l){let c=t.geometry,h=c.getAttribute("position");if(h===void 0||h.count===0)return!0;let d=c.getAttribute("normal"),u=c.getIndex(),p=u!==null?u.count:h.count;if(p>X6)return!0;let f=c.drawRange.start,g=f+(c.drawRange.count===1/0?p-f:Math.min(c.drawRange.count,p-f));Ru.copy(t.objectToDecal),Wm.getNormalMatrix(Ru);let m=[],v=[];for(let y=f;y+2<g;y+=3){let _=u!==null?u.getX(y):y,b=u!==null?u.getX(y+1):y+1,x=u!==null?u.getX(y+2):y+2;if(Ga.fromBufferAttribute(h,_).applyMatrix4(Ru),ko.fromBufferAttribute(h,b).applyMatrix4(Ru),Vo.fromBufferAttribute(h,x).applyMatrix4(Ru),Ga.z>i&&ko.z>i&&Vo.z>i||Ga.z<-i&&ko.z<-i&&Vo.z<-i)continue;kr.subVectors(ko,Ga),CT.subVectors(Vo,Ga),Vl.crossVectors(kr,CT);let w=Vl.length();if(!(w===0||Vl.z/w<=Y6)){if(m.length=0,d!==void 0)kr.fromBufferAttribute(d,_).applyMatrix3(Wm),m.push({px:Ga.x,py:Ga.y,pz:Ga.z,nx:kr.x,ny:kr.y,nz:kr.z}),kr.fromBufferAttribute(d,b).applyMatrix3(Wm),m.push({px:ko.x,py:ko.y,pz:ko.z,nx:kr.x,ny:kr.y,nz:kr.z}),kr.fromBufferAttribute(d,x).applyMatrix3(Wm),m.push({px:Vo.x,py:Vo.y,pz:Vo.z,nx:kr.x,ny:kr.y,nz:kr.z});else{Vl.divideScalar(w);for(let S of[Ga,ko,Vo])m.push({px:S.x,py:S.y,pz:S.z,nx:Vl.x,ny:Vl.y,nz:Vl.z})}for(let S of e){if(m.length===0)break;let E=dZ(m,S,v);v=m,m=E}if(!(m.length<3)){if(a.length/3+3*(m.length-2)>$6)return!1;for(let S=1;S+1<m.length;S++)for(let E of[m[0],m[S],m[S+1]]){l.push(E.px*n+.5,E.py*r+.5);let A=E.nx,P=E.ny,C=E.nz,R=Math.hypot(A,P,C);R>0?(A/=R,P/=R,C/=R):(A=0,P=0,C=1),a.push(E.px+A*s,E.py+P*s,E.pz+C*s),o.push(A,P,C)}}}}return!0}var X6,$6,Y6,Ru,Wm,Ga,ko,Vo,kr,CT,Vl,Xv,D2,R2,I2,z1,Z6,pZ=z(()=>{tt(),X6=15e5,$6=3e5,Y6=.01,Ru=new At,Wm=new ue,Ga=new T,ko=new T,Vo=new T,kr=new T,CT=new T,Vl=new T}),fZ=z(()=>{tt(),Ye(),rd(),Kn(),qr(),pZ(),Ax(),Xv=new ci,D2=new ci,R2=new At,I2=new T,z1=class extends Wr{constructor(t,e,i){super(t,e),this.data=e,this.geometry=new jt,this.lastSignature=[],this.nextSignature=[],this.scanned=[],this.lastParams={width:0,height:0,depth:0,offset:0},this.targetFilter=new Set,this.context=i;let n=this.data.geometry;this.lastParams={width:this.resolveNumber(n.width,0),height:this.resolveNumber(n.height,0),depth:this.resolveNumber(n.depth,0),offset:n.offset??0},this.geometry.userData={type:"DecalGeometry",parameters:{...this.lastParams}}}get isLOD(){return this.updateDecal(),!1}get isDecalObject(){return!0}resolveNumber(t,e){if(typeof t=="number")return t;let i=Number(this.context.shared.getVariable(t));return Number.isFinite(i)?i:e}currentParams(){let t=this.dataPatched.geometry;return{width:this.resolveNumber(t.width,this.lastParams.width),height:this.resolveNumber(t.height,this.lastParams.height),depth:this.resolveNumber(t.depth,this.lastParams.depth),offset:t.offset??0}}projectionRoot(){let t=this.parent;for(;t!==null&&Be.is(t);){if(t.data?.type==="Page")return t;t=t.parent}return this.context.scene}currentTargetFilter(){let t=this.dataPatched.geometry;if(t.projection!=="select")return null;let e=t.projectionTargets;if(e!==this.targetFilterSource&&(this.targetFilterSource=e,this.targetFilter.clear(),e!==void 0))for(let i of e)this.targetFilter.add(i);return this.targetFilter}static matchesTargetFilter(t,e,i){let n=t;for(;n!==null&&n!==i;){if(e.has(n.uuid))return!0;n=n.parent}return!1}scanTargets(t,e,i){let n=this.scanned;n.length=0;let r=this.projectionRoot();if(r===null)return n;let s=this.currentTargetFilter();if(s!==null&&s.size===0)return n;Xv.makeEmpty();for(let a=0;a<8;a++)I2.set((1&a?.5:-.5)*t,(2&a?.5:-.5)*e,(4&a?.5:-.5)*i).applyMatrix4(this.matrixWorld),Xv.expandByPoint(I2);return r.traverse(a=>{if(a===this||!Be.is(a)||!(a instanceof Yi)||a instanceof z1||a.dataPatched?.type!=="Mesh"||!a.visible||a.destroyedInAction||512&a.layers.mask||s!==null&&!z1.matchesTargetFilter(a,s,r))return;let o=a.geometry,l=o?.getAttribute("position");l===void 0||l.count===0||o.drawRange.count!==0&&(o.boundingBox===null&&o.computeBoundingBox(),D2.copy(o.boundingBox).applyMatrix4(a.matrixWorld),Xv.intersectsBox(D2)&&n.push(a))}),n}collectSignature(t,e,i){t.length=0,t.push(i.width,i.height,i.depth,i.offset);for(let n of this.matrixWorld.elements)t.push(n);for(let n of e){t.push(n.id,n.geometry.id);let r=n.geometry.getAttribute("position");t.push(r===void 0?-1:"version"in r?r.version:r.data.version);let s=n.geometry.getIndex();t.push(s!==null?s.version:-1),t.push(n.geometry.drawRange.count===1/0?-1:n.geometry.drawRange.count);for(let a of n.matrixWorld.elements)t.push(a)}}signaturesEqual(t,e){if(t.length!==e.length)return!1;for(let i=0;i<t.length;i++)if(t[i]!==e[i])return!1;return!0}updateDecal(){if(this.disposed)return!1;this.updateWorldMatrix(!0,!1);let t=this.currentParams(),e=this.scanTargets(t.width,t.height,t.depth);if(this.collectSignature(this.nextSignature,e,t),this.signaturesEqual(this.nextSignature,this.lastSignature))return!1;let i=this.lastSignature;this.lastSignature=this.nextSignature,this.nextSignature=i,this.lastParams=t,R2.copy(this.matrixWorld).invert();let n=e.map(r=>({geometry:r.geometry,objectToDecal:new At().multiplyMatrices(R2,r.matrixWorld)}));return this.geometry.dispose(),this.geometry=function(r,s){let a=Math.max(Math.abs(s.width),1e-6),o=Math.max(Math.abs(s.height),1e-6),l=Math.max(Math.abs(s.depth),1e-6),c=[{axis:0,sign:1,limit:a/2},{axis:0,sign:-1,limit:a/2},{axis:1,sign:1,limit:o/2},{axis:1,sign:-1,limit:o/2},{axis:2,sign:1,limit:l/2},{axis:2,sign:-1,limit:l/2}],h=[],d=[],u=[];for(let f of r)if(!uZ(f,c,l/2,1/a,1/o,s.offset,h,d,u))break;let p=new jt;return p.setAttribute("position",new Nt(h,3)),p.setAttribute("normal",new Nt(d,3)),p.setAttribute("uv",new Nt(u,2)),h.length===0?(p.setDrawRange(0,0),p.boundingSphere=new yr):p.computeBoundingSphere(),p}(n,t),this.geometry.userData={type:"DecalGeometry",parameters:{width:t.width,height:t.height,depth:t.depth}},ep(this),ip(this),this.resetBBoxNeedsUpdate(),!0}updateByPatchedOp(t,e,i){super.updateByPatchedOp(t,e,i),ri(t.path,["geometry"])&&this.resetBBoxNeedsUpdate()}updateEntityBoxSize(t,e){let i=this.currentParams();t.setScalar(0),e.set(i.width,i.height,i.depth).multiplyScalar(.5)}dispose(){super.dispose(),this.geometry.dispose()}}}),mZ=z(()=>{tt(),px(),nd(),Z6=class extends id(RE,gp){constructor(t,e){super(),this.super_Entity(t,e),this.objectHelper.update(),this.matrixAutoUpdate=!0}updateState(t,e){this.updateState_Entity(t,e)}}});function W3(t,e,i){if(console.assert(e.type!==void 0),e.type==="Mesh")return function(n,r,s){let a;if(F1!==void 0&&r?.geometry&&"subdivisions"in r.geometry&&(r.geometry.subdivisions??0)>F1&&Object.assign(r.geometry,{subdivisions:F1}),r.geometry.type==="TextGeometry"||r.geometry.type==="InputGeometry"){let o=KS(r.geometry.type);return o?o(n,r,s):(Gn(r.geometry.type==="InputGeometry"?"textinputs":"text",`a Mesh with ${r.geometry.type}`),new Ai(n,r,s))}if(r.geometry.type==="SubdivGeometry")a=new yp(n,r,s);else if(r.geometry.type==="PathGeometry"||r.geometry.type==="VectorGeometry"||r.geometry.type==="ShapeBlendGeometry"){let o=KS(r.geometry.type);o?a=o(n,r,s):(Gn(r.geometry.type==="ShapeBlendGeometry"?"shape-blends":r.geometry.type==="PathGeometry"?"3d-paths":"vector-shapes",`a Mesh with ${r.geometry.type}`),a=new Ai(n,r,s))}else if(r.geometry.type==="BooleanGeometry")a=new uh(n,r,s);else if(r.geometry.type==="DecalGeometry")a=new z1(n,r,s);else if(r.geometry.type==="UIGeometry"){let o=KS("UIGeometry");o?a=o(n,r,s):(Gn("ui-2d","a Mesh with UIGeometry"),a=new Ai(n,r,s))}else a=new Ai(n,r,s);return a}(t,e,i);if(e.type==="Empty")return new Ya(t,e);if(e.type==="Particle"){let n=ZS("Particle");return n?n(t,e,i):(Gn("particles","a Particle system"),new Ya(t,e))}if(e.type==="ParticleCollider")return new np(t,e,i);if(e.type==="Hair"){let n=ZS("Hair");return n?n(t,e,i):(Gn("hair","a Hair System"),new Ya(t,e))}if(e.type==="Splat")return new Ya(t,e);if(e.type==="Bone")return new Z6(t,e);if(e.type==="Page")return new mn(t,e,i);if(e.type==="PointLight")return new Px(t,e,i);if(e.type==="SpotLight")return new f0(t,e,i);if(e.type==="DirectionalLight")return new p0(t,e,i);if(e.type==="Component"||e.type==="Instance"){let n=ZS(e.type);return n?n(t,e,i):(Gn("components",`a ${e.type}`),new Ya(t,e))}return Xc.is(e.type)?new Zi(t,e):(console.error(e),new Ya(t,e))}function gZ(t,e,i){let n=W3(t.identity,e,i),r=t.children,s=t.attachedPaths,a=t.parent,o=t.component,l=t.instances,c=t.overrideData,h=t.uuid,d=t.stateSelection;t.dispose();for(let u of Object.keys(t))delete t[u];Object.setPrototypeOf(t,Object.getPrototypeOf(n));for(let u of Object.keys(n))t[u]=n[u];t.children=[...t.children,...r],t.attachedPaths=s,t.parent=a,t.component=o,t.instances=l,t.uuid=h,t.overrideData=c,t.updateState(t.data,i),d&&t.changeSelectedState(d,i),t.resetBBoxNeedsUpdate()}var F1,K6,Q6,J6,rh,N1,t8,PT,vZ=z(()=>{$t(),m0(),d0(),fZ(),Xr(),yx(),j6(),V3(),z3(),Ws(),db(),mZ(),dl(),j3(),ke(),F1=function(){try{let t=window.location.href;if(t.includes("reducesubdiv=")){let e=t.indexOf("reducesubdiv=")+13;return parseInt(t.slice(e,e+1))}}catch{}}(),sl.createEntity=W3,sl.changeEntityProptotype=gZ}),yZ=z(()=>{K6=class{constructor(){this._constraints=new Map}setConstraint(t,e){e===null?this._constraints.delete(t):this._constraints.set(t,e)}removeDependencies(t){this._constraints.delete(t)}applyConstraints(t){let e=new Set;this._constraints.forEach((i,n)=>{let r=[n,i],s=i;for(;this._constraints.has(s);){if(s=this._constraints.get(s),r.includes(s)){console.warn(`circular dependency detected: ${r.join(" -> ")}`);break}e.has(s)||r.push(s)}for(let a=r.length-2;a>=0;a--)if(!e.has(r[a])){let o=t.find(r[a]);o?o.applyPathSnapping(t):console.warn(`missing entity ${r[a]}`),e.add(r[a])}})}findDependency(t,e){let i=t;for(;this._constraints.has(i);)if(i=this._constraints.get(i),i===e)return!0;return!1}}}),_Z=z(()=>{Q6="AGFzbQEAAAAADwhkeWxpbmsuMAEEAAAAAAETA2AAAGAIf39/f39/f38AYAABfwISAQNlbnYGbWVtb3J5AgMAgIAEAwQDAAECBzkDEV9fd2FzbV9jYWxsX2N0b3JzAAALc29ydEluZGV4ZXMAARNlbXNjcmlwdGVuX3Rsc19pbml0AAIK3gMDAwABC9IDAwF/BnwBfgJAIAdFDQAgAysDUCEMIAMrAzAhDSADKwMQIQ5BACEDRP///////+9/IQtEAAAAAAAAEAAhCgNAIAIgA0ECdGoCfyAOIAEgA0EMbGoiCCoCALuiIA0gCCoCBLuioCAMIAgqAgi7oqBEAAAAAAAAsECiIgmZRAAAAAAAAOBBYwRAIAmqDAELQYCAgIB4CzYCACAJIAsgCSALYxshCyAJIAogCSAKZBshCiADQQFqIgMgB0cNAAsgB0UNACAGuCAKIAuhoyEJQQAhAwNAAn8gCSACIANBAnRqIgEoAgC3IAuhoiIKmUQAAAAAAADgQWMEQCAKqgwBC0GAgICAeAshCCABIAg2AgAgBCAIQQJ0aiIBIAEoAgBBAWo2AgAgA0EBaiIDIAdHDQALCyAGQQJPBEAgBCgCACEIQQEhAwNAIAQgA0ECdGoiASABKAIAIAhqIgg2AgAgA0EBaiIDIAZHDQALCyAHQQFrIgGtIQ8DQCAEIAIgD6dBAnQiA2ooAgBBAnRqIgcgBygCAEEBayIHNgIAIAUgASAHa0ECdGogACADaigCADYCACAPUCEDIA9CAX0hDyADRQ0ACyAGBEAgBEEAIAZBAnT8CwALCwQAQQAL"}),bZ=z(()=>{J6=`
4180
4180
  function sortWorker(self) {
4181
4181
  let wasmInstance;
@@ -4690,7 +4690,7 @@ function sortWorker(self) {
4690
4690
  gl_FragColor = vec4(color.rgb, A);
4691
4691
  gVelocity = vec4(0.0);
4692
4692
  }`,transparent:!0,alphaTest:1,blending:oh,depthTest:!0,depthWrite:!1,side:Hn})}static buildGeomtery(t){let e=new jt;e.setIndex([0,1,2,0,2,3]);let i=new Float32Array(12),n=new Ht(i,3);e.setAttribute("position",n),n.setXYZ(0,-1,-1,0),n.setXYZ(1,-1,1,0),n.setXYZ(2,1,1,0),n.setXYZ(3,1,-1,0),n.needsUpdate=!0;let r=new z_().copy(e),s=new Uint32Array(t),a=new Bu(s,1,!1);return a.setUsage(Jz),r.setAttribute("splatIndex",a),r.instanceCount=t,r}resetLocalSplatDataAndTexturesFromSplatBuffer(){this.updateLocalSplatDataFromSplatBuffer(),this.allocateAndStoreLocalSplatDataInTextures()}updateLocalSplatDataFromSplatBuffer(){this.splatBuffers.forEach(n=>n.buildPreComputedBuffers()),this.covariances=new Float32Array(6*this.splatCount),this.colors=new Uint8Array(4*this.splatCount),this.centers=new Float32Array(3*this.splatCount);let t=0,e=0,i=0;for(let n of this.splatBuffers){let r=n.nsplats;this.colors.subarray(t,t+4*r).set(n.colorsA),t+=4*r,this.centers.subarray(e,e+3*r).set(n.decoded.xyz.denormDequant().data),e+=3*r,this.covariances.subarray(i,i+6*r).set(new Float32Array(n.precomputedCovarianceBufferData)),i+=6*r}}allocateAndStoreLocalSplatDataInTextures(){let t=this.splatCount,e=new et(4096,1024);for(;e.x*e.y*2<6*t;)e.y*=2;let i,n,r=new et(4096,1024);for(;r.x*r.y*4<4*t;)r.y*=2;if(this.halfPrecisionCovariancesOnGPU){n=new Uint16Array(e.x*e.y*2);for(let c=0;c<this.covariances.length;c++)n[c]=Zl.toHalfFloat(this.covariances[c]);i=new Cn(n,e.x,e.y,lo,$n)}else n=new Float32Array(e.x*e.y*2),n.set(this.covariances),i=new Cn(n,e.x,e.y,lo,$e);i.needsUpdate=!0,this.material.uniforms.covariancesTexture.value=i,this.material.uniforms.covariancesTextureSize.value.copy(e);let s=new Uint32Array(r.x*r.y*4);for(let c=0;c<t;c++){let h=4*c,d=3*c,u=4*c;s[u]=t8(this.colors[h],this.colors[h+1],this.colors[h+2],this.colors[h+3]),s[u+1]=N1(this.centers[d]),s[u+2]=N1(this.centers[d+1]),s[u+3]=N1(this.centers[d+2])}let a=new Cn(s,r.x,r.y,n0,Gs);Sb()!=="webgpu"&&(a.internalFormat="RGBA32UI"),a.needsUpdate=!0,this.material.uniforms.centersColorsTexture.value=a,this.material.uniforms.centersColorsTextureSize.value.copy(r);let o=new Float32Array(4096);for(let c=0;c<this.meshMatrixWorlds.length;c++)o.set(this.meshMatrixWorlds[c].elements,16*c);let l=new Cn(o,1024,1,Xi,$e);l.needsUpdate=!0,this.material.uniforms.meshMatrixWorldsTexture.value=l,this.material.uniformsNeedUpdate=!0,this.splatDataTextures={covariances:{data:n,texture:i,size:e},centerColors:{data:s,texture:a,size:r},meshMatrixWorlds:{data:o,texture:l}}}updateIndexes(t){let e=this.geometry;e.attributes.splatIndex.set(t),e.attributes.splatIndex.needsUpdate=!0,e.instanceCount=t.length}updateUniforms(t,e,i,n){this.splatCount>0&&(qf.set(t.x*this.devicePixelRatio,t.y*this.devicePixelRatio),this.material.uniforms.viewport.value.copy(qf),this.material.uniforms.basisViewport.value.set(2/qf.x,2/qf.y),this.material.uniforms.focal.value.set(e,i),this.material.uniforms.orthoZoom.value=n,this.material.uniformsNeedUpdate=!0)}getSplatDataTextures(){return this.splatDataTextures}getSplatCount(){return this.splatCount}getCenters(){return this.centers}getColors(){return this.colors}getCovariances(){return this.covariances}dispose(){this.geometry.dispose(),this.material.dispose(),this.splatDataTextures&&(this.splatDataTextures.covariances.texture.dispose(),this.splatDataTextures.centerColors.texture.dispose(),this.splatDataTextures.meshMatrixWorlds.texture.dispose()),this.removeFromParent()}}});function MZ(){if(!DT)return zL||(zL=async function(){let t=await Promise.resolve().then(()=>(MD(),SD));i8(t),DT=!0}())}var i8,n8,DT,zL,FL,r8,RT,O2,Dx,s8=z(()=>{n8=new Promise(t=>{i8=t}),DT=!1}),EZ=z(()=>{xZ(),tt(),e8(),s8(),n8.then(t=>FL=t),r8=class{constructor(t={}){Qa(this,"updateView",function(){let e=new At,i=[],n=new T(0,0,-1),r=new T(0,0,-1),s=new T,a=new T;return function(o=!1,l){let c=this.updateMatrixWorldsInWorkerIfNeeded(),h=this.cropsChanged();if(!o){r.set(0,0,-1).applyQuaternion(l.quaternion);let u=!1,p=!1;if(r.dot(n)<=.95&&(u=!0),a.copy(l.position).sub(s).length()>=1&&(p=!0),!(u||p||c||h||this.needsInitialRender))return}this.needsInitialRender=!1,s.copy(l.position),n.copy(r),e.copy(l.matrixWorld).invert(),e.premultiply(this.dummyPerspectiveMatrix),i[0]=l.position.x,i[1]=l.position.y,i[2]=l.position.z;let d={sort:{view:e.elements,cameraPosition:i,splatRenderCount:this.splatRenderCount,splatSortCount:this.splatRenderCount},...c?{newMatrixWorlds:this.meshMatrixWorlds}:{},...h?{newCropsArray:this.cropsArray}:{}};this.sortRunning?this.queuedMessage=d:(this.queuedMessage=null,this.sortRunning=!0,this.sortWorker.postMessage(d))}}()),this.scene=t.scene,this.currentPage=null,this.devicePixelRatio=window.devicePixelRatio,this.sortWorker=null,this.splatRenderCount=0,this.splatSortCount=0,this.splatMesh=null,this.sortRunning=!1,this.meshMatrixWorlds=null,this.meshMatrixWorldsOld=null,this.cropsArray=null,this.splatEntries=null,this.queuedMessage=null,this.needsInitialRender=!0,this.dummyPerspectiveMatrix=new At().makePerspective(-1,1,-1,1,.1,1e3)}updateSplatMeshUniforms(t,e){let i=new et;this.splatMesh!==null&&this.splatMesh.getSplatCount()>0&&(t.getSize(i),this.cameraFocalLengthX=e.projectionMatrix.elements[0]*this.devicePixelRatio*i.x*.45,this.cameraFocalLengthY=e.projectionMatrix.elements[5]*this.devicePixelRatio*i.y*.45,this.splatMesh.updateUniforms(i,this.cameraFocalLengthX,this.cameraFocalLengthY,e.isPerspectiveCamera?-1:e.zoom*this.devicePixelRatio))}loadSplat(t={}){this.activePage=this.scene.activePage,t.position&&(t.position=new T().fromArray(t.position)),t.orientation&&(t.orientation=new Wt().fromArray(t.orientation)),t.halfPrecisionCovariances=!!t.halfPrecisionCovariances;let e=[];if(this.splatEntries=e,this.activePage.traverseVisibleEntity(s=>{s.data.type==="Splat"&&e.push(s)}),this.splatMesh&&this.splatMesh.dispose(),e.length===0)return this.splatMesh=null,!1;this.meshMatrixWorlds=e.map(s=>s.matrixWorld),this.meshMatrixWorldsOld=e.map(s=>s.matrixWorld.clone()),this.cropsArray=e.map(s=>s.data.crops.map(a=>a.data)),this._splatBufferCache??(this._splatBufferCache=new WeakMap);let i=e.map(s=>{let a=this._splatBufferCache.get(s.data.buffer);return a===void 0&&(a=new FL.GSplineBuffer(new Uint8Array(s.data.buffer).buffer),this._splatBufferCache.set(s.data.buffer,a)),a}),n=0,r=[0];for(let s of i)n+=s.getSplatCount(),r.push(n);return this.setupSplatMesh(i,n,t.position,t.orientation,t.halfPrecisionCovariances,this.devicePixelRatio,r,this.meshMatrixWorlds),this.setupSortWorker(n),!0}updateMatrixWorldsInWorkerIfNeeded(){let t=this.splatDataTextures.meshMatrixWorlds.data;for(let e=0;e<this.meshMatrixWorlds.length;e++)t.set(this.meshMatrixWorlds[e].elements,16*e);return this.splatDataTextures.meshMatrixWorlds.texture.needsUpdate=!0,!this.meshMatrixWorlds.every((e,i)=>e.equals(this.meshMatrixWorldsOld[i]))&&(this.meshMatrixWorldsOld=this.meshMatrixWorlds.map(e=>e.clone()),!0)}cropsChanged(){let t=!1;return this.splatEntries.forEach((e,i)=>{e.data.crops.forEach((n,r)=>{this.cropsArray[i][r]===void 0?(t=!0,this.cropsArray[i][r]=n.data):Object.entries(n.data).forEach(([s,a])=>{(Array.isArray(a)&&a.some((o,l)=>o!==this.cropsArray[i][r][s][l])||a!==this.cropsArray[i][r]?.[s])&&(t=!0,this.cropsArray[i][r][s]=a)})}),e.data.crops.length!==this.cropsArray[i]?.length&&(this.cropsArray[i].length=e.data.crops.length,t=!0)}),t}setupSplatMesh(t,e,i=new T,n=new Wt,r=!1,s=1,a,o){this.splatMesh=qm.buildMesh(t,e,r,s,a,o),this.splatMesh.position.copy(i),this.splatMesh.quaternion.copy(n),this.splatMesh.frustumCulled=!1,this.splatMesh.renderOrder=99999,this.splatRenderCount=e,this.splatMesh.onBeforeRender=(l,c,h)=>this.update(l,h)}setupSortWorker(t){this.sortWorker=function(e){let i=new Worker(URL.createObjectURL(new Blob(["(",J6,")(self)"],{type:"application/javascript"}))),n=atob(Q6),r=new Uint8Array(n.length);for(let s=0;s<n.length;s++)r[s]=n.charCodeAt(s);return i.postMessage({init:{sorterWasmBytes:r.buffer,splatCount:e,Constants:{BytesPerFloat:rh.BytesPerFloat,BytesPerInt:rh.BytesPerInt,DepthMapRange:rh.DepthMapRange,MemoryPageSize:rh.MemoryPageSize}}}),i}(t),this.sortWorker.onmessage=e=>{e.data.sortDone?(this.sortRunning=!1,this.splatMesh?.updateIndexes(new Uint32Array(e.data.indexesBuffer)),this.lastSortTime=e.data.sortTime,this.queuedMessage&&(this.sortWorker.postMessage(this.queuedMessage),this.queuedMessage=null)):e.data.sortCanceled?this.sortRunning=!1:e.data.sortSetupPhase1Complete?this.sortWorker.postMessage({positions:this.splatMesh.getCenters().buffer,meshMatrixWorlds:this.splatMesh.meshMatrixWorlds,meshIndexIntervals:this.splatMesh.meshIndexIntervals,cropsArray:this.cropsArray}):e.data.sortSetupComplete&&(this.splatDataTextures=this.splatMesh.getSplatDataTextures(),this.scene.activePage.add(this.splatMesh),this.needsInitialRender=!0)}}update(t,e){this.splatMesh!==null&&(this.updateSplatMeshUniforms(t,e),this.updateView(!1,e))}getSplatMesh(){return this.splatMesh}}}),q3=z(()=>{tt(),Ws(),qr(),Eh(),$t(),cZ(),Ye(),z6(),m3(),Kn(),d0(),vZ(),yx(),Xr(),Bi(),dl(),k6(),Bi(),Dn(),l0(),yZ(),EZ(),(RT=new Hs).wireframe=!0,O2=new T,Dx=class extends ss{constructor(t,e){super(),this.data=t,this.sharedAssets=e,this.enableHelpers=!1,this.wireframeState=!1,this.needsTransmissionDirty=!0,this.needsNormalDirty=!0,this.needsReflectionDirty=!0,this._needsTransmission=!1,this._needsNormal=!1,this._normalPassNeeds={outline:!1,cavity:!1},this._needsReflection=!1,this.geometryCacheChanged=!1,this.splatViewer=null,this.shapeBlendIntances=[],this.hairInstances=[],this.shadowsDirty=!0,this.instanceGroupsDirty=!0,this._autoInstancing=null,this.entityByUuid={},this.entityIdentityToEntity={},this.toExpandCloner=new Set,this.toUpdateCloner=new Set,this.pendingCommands=[],this.pathConstraints=new K6,this.invisibleObjects=new Ya("jflkdsafjasdifjaslk",{...rb.defaultData,visible:!1,name:"buildin invisible"}),this.needsRecomputeInstances=!1,this.init(t,e),this.matrixAutoUpdate=!1,this.errorPage=new mn("fdasfa",{...zc.defaultData,name:""},{shared:e,scene:this})}markGeometryCacheDirty(){this.geometryCacheChanged=!0}markShadowsDirty(){this.shadowsDirty=!0}markInstanceGroupsDirty(){this.instanceGroupsDirty=!0}get autoInstancing(){return this._autoInstancing}updateInstanceGroups(t,e){let i=this._autoInstancing;(i===null||i.minGroupSize!==e)&&(i?.dispose(),i=new q6(e),this._autoInstancing=i);let n=this.instanceGroupsDirty;return this.instanceGroupsDirty=!1,i.update(t,n),i.stats}releaseInstanceGroups(){this._autoInstancing?.teardown(),this.instanceGroupsDirty=!0}markNeedsUpdateRendererDirty(){this.needsTransmissionDirty=!0,this.needsNormalDirty=!0,this.needsReflectionDirty=!0,this.shadowsDirty=!0,this.instanceGroupsDirty=!0}needsTransmission(){return this.needsTransmissionDirty&&(this._needsTransmission=function(t){let e=!1;return t.traverseEntity(i=>{if(i instanceof Wr)if(Array.isArray(i.material))for(let n=0;n<i.material.length;n++)IL(i,i.material[n])&&(e=!0);else IL(i,i.material)&&(e=!0)}),e}(this),this.needsTransmissionDirty=!1),this._needsTransmission}needsNormal(){return this.needsNormalDirty&&(this._normalPassNeeds=function(t){let e={outline:!1,cavity:!1},i=n=>{e.outline=e.outline||n.outline,e.cavity=e.cavity||n.cavity};return t.traverseEntity(n=>{if(n instanceof Wr)if(Array.isArray(n.material))for(let r=0;r<n.material.length;r++)i(RL(n,n.material[r]));else i(RL(n,n.material))}),e}(this),this._needsNormal=this._normalPassNeeds.outline||this._normalPassNeeds.cavity,this.needsNormalDirty=!1),this._needsNormal}normalPassNeeds(){return this.needsNormal(),this._normalPassNeeds}needsReflection(){return this.needsReflectionDirty&&(this._needsReflection=function(t){let e=!1;return t.traverseEntity(i=>{if(i instanceof Wr)if(Array.isArray(i.material))for(let n=0;n<i.material.length;n++)OL(i,i.material[n])&&(e=!0);else OL(i,i.material)&&(e=!0)}),e}(this),this.needsReflectionDirty=!1),this._needsReflection}registerInstanceAndSetUuid(t){let e=t.identity.join("-"),i=this.entityIdentityToEntity[e];i&&(t.uuid=i.uuid),this.entityIdentityToEntity[e]=t,this.entityByUuid[t.uuid]=t}markPenumbraSizeDirty(){for(let t of this.children)t instanceof mn&&(t.penumbraSizeArrayCache=null)}findInstance(t){return this.entityIdentityToEntity[t.join("-")]}get bgColor(){return this.activePage.bgColor}get postprocessing(){return this.activePage.data.postprocessing}getWithSortKey(t){let e=this.find(t);if(e===void 0)return;let i=[],n=e;for(;n!==this;){let r=n;n=n.parent;let s=n.children.indexOf(r);i.splice(0,0,s)}return{entity:e,sortKey:i}}getAllSorted(t){let e=[];for(let i of t){let n=this.getWithSortKey(i.id);n!==void 0&&e.push(n)}return e.sort((i,n)=>N_(i.sortKey,n.sortKey)),e.map(i=>i.entity)}nonExistOrDescendantOf(t,e){let i=this.find(t);if(i===void 0)return!0;for(;i;){if(i.uuid===e)return!0;i=i.parent}return!1}find(t){if(this.activePage&&this.activePage.personalCamera.parent){if(t==="f23858d0-4a3b-4bd8-8173-66ed0af7f6fb-personalCamera")return this.activePage.personalCamera;if(t===ed)return this.activePage.personalCamera}if(t===""||t===void 0)return;let e=this.entityByUuid[t];return e===void 0?this.getObjectByProperty("uuid",t):e}find2D(t){for(let e of this.children)if(e instanceof mn&&e.uiScene){let i=e.uiScene.find(t);if(i)return i}}findScene2DfromObject2D(t){for(let e of this.children)if(e instanceof mn&&e.uiScene&&e.uiScene.find(t))return e.uiScene}find2DInUIObjects(t){let e;return this.traverseEntity(i=>{e===void 0&&Pr(i)&&(e=i.uiCanvas.find(t))}),e}traverse2D(t){for(let e of this.children)e instanceof mn&&e.uiScene&&e.uiScene.traverse(t)}debugEnsureEntity(t){let e=this.find(t);e?Array.isArray(e.identity)&&this.findInstance(e.identity)===void 0&&console.error("not found instance"):console.error("not found")}addPendingExpandCloner(t){this.toExpandCloner.add(t)}addPendingUpdateCloner(t){this.toUpdateCloner.add(t)}markToExpandCloner(t){this.toExpandCloner.add(t),t.traverseEntityAncestors(e=>{this.toExpandCloner.add(e)})}doPendingExpandCloner(t){this.toExpandCloner.forEach(e=>{e.expandCloner(t)}),this.toExpandCloner.clear()}doPendingUpdateCloner(t){this.toUpdateCloner.forEach(e=>{e.cloner?.update(t)}),this.toUpdateCloner.clear()}doPendingUpdates(t){this.doPendingExpandCloner(t),this.doPendingUpdateCloner(t),this.applyPendingCommands()}addPendingCommand(t){this.pendingCommands.push(t)}applyPendingCommands(){this.pendingCommands.forEach(t=>t()),this.pendingCommands.length=0}updateByLibOp(t,e){t.path.length===1&&t.path[0]==="components"&&t.type===1&&this.createChildrenObjects([{...t.data.asset,id:t.id}],this.invisibleObjects,e)}updateTreeByOp(t,e){if(t.path.length===0&&t.type===7){let i=t.parent===null?this:this.find(t.parent);if(i===void 0)throw new Error(`scene tree add: parent ${t.parent} not found for object ${t.id}`);let n=this.createObject(t.id,t.data,t.children,i,t.localIndex,e);n.updateVisible(this),n.resetBBoxNeedsUpdate(),fa(n)&&eo(n.parent)&&(n.invalidateUpstreamBooleanData(),n.parent.invalidateDownstreamBooleanData().recomputeBoolean()),this.markNeedsRecomputeInstancesForAncessors(i),this.markNeedsRecomputeInstancesForChildren(n),this.markToExpandCloner(n),this.markPenumbraSizeDirty(),n.updatePathSnapping()}else if(t.path.length===0&&t.type===8){let i=this.find(t.id);if(i===void 0)throw new Error(`scene tree delete: object ${t.id} not found`);i.traverseEntity(r=>{ll(r)&&(this.shapeBlendIntances=this.shapeBlendIntances.filter(s=>s!==r)),Yc(r)&&(this.hairInstances=this.hairInstances.filter(s=>s!==r))}),this.markToExpandCloner(i),i.resetBBoxNeedsUpdate(),this.unregisterObject(i);let n=i.parent;this.markNeedsRecomputeInstancesForAncessors(n),this.markNeedsRecomputeInstancesForChildren(i),this.markPenumbraSizeDirty(),i.parent.remove(i),eo(i.parent)&&(i.parent.invalidateUpstreamBooleanData(),i.parent.invalidateDownstreamBooleanData().recomputeBoolean()),fa(i)&&(i.freeBooleanPointer(),n instanceof uh&&n.invalidateDownstreamBooleanData().recomputeBoolean()),fx(i)&&i.detachShape(),this.disposeAndUnregisterEntityRecursivelyIfNotReregistered(i),this.pathConstraints.removeDependencies(i.uuid),i.updatePathSnapping()}else if(t.path.length===0&&t.type===9){let i=this.find(t.id);if(i===void 0)throw new Error(`scene tree move: object ${t.id} not found`);this.markNeedsRecomputeInstancesForChildren(i);let n=i.parent;this.markNeedsRecomputeInstancesForAncessors(n),i.cloner?.resetOnMove(),this.markToExpandCloner(i);let r=t.parent===null?this:this.find(t.parent);if(r===void 0)throw new Error(`scene tree move: new parent ${t.parent} not found for object ${t.id}`);r.add(i),this.markNeedsRecomputeInstancesForAncessors(r),this.markToExpandCloner(i),i.invalidateClonerTransform(i),i.updateVisible(this),i.resetBBoxNeedsUpdate(),this.markPenumbraSizeDirty();let s=t.localIndex;r.children.splice(s,0,r.children.pop()),fa(i)&&(i.invalidateUpstreamBooleanData(),eo(i.parent)?i.parent.invalidateDownstreamBooleanData().recomputeBoolean():n instanceof uh&&n.invalidateDownstreamBooleanData().recomputeBoolean()),i.updatePathSnapping()}this.markNeedsUpdateRendererDirty(),this.markGeometryCacheDirty()}get playPage(){return this.find(this.data.publish.playPage)??this.errorPage}updatePage(t){this.shadowsDirty=!0,this.activePage&&this.activePage.onDeactive(),this.activePage=this.errorPage;for(let e of this.children)e instanceof mn&&(e.visible=e.uuid===t,e.visible&&(this.activePage=e,this.activePage.onActive(this)));this.activePage!==this.splatViewer?.activePage&&this.reloadSplats()}updateEntityByOp(t,e,i,n){if(this.shadowsDirty=!0,e.type===0){if(("overrides"in e.props||"component"in e.props)&&this.markNeedsRecomputeInstances(),"visible"in e.props&&this.markPenumbraSizeDirty(),e.path.includes("overrides")&&"states"in e.props){let{rest:s}=e.props;e={...e,props:s},this.markNeedsRecomputeInstances()}e.path[0]==="pathSnapping"&&e.props.pathId!==void 0&&this.pathConstraints.setConstraint(t,e.props.pathId)}let r=this.find(t);if(r)try{(function(s,a,o,l){s.updateByOp(a,o,l,!1)})(r,e,i,{scene:this,shared:n}),r instanceof Ai&&r.updateGeometryGroupsIfNeeded()}catch(s){console.error(s)}}updateEntity2DByOp(t,e,i,n,r,s=[]){t.updateEntityByOp(e,i,n,r),this.traverseEntity(a=>{(Pr(a)||a instanceof mn)&&(s.includes(a.frameId??"")||a.frameId===e)&&a.updateEntity2DByOp(e,i,n,r)})}get activeCamera(){return this.activePage.activeCamera}switchActiveCamera(t){this.activePage.switchActiveCamera(t)}isInvisibleObjects(t){return t===this.invisibleObjects||t.hasAnccestor(this.invisibleObjects)}init(t,e){let i=Object.entries(e.data.lib.components).map((n,r)=>({data:n[1].asset.data,children:n[1].asset.children,id:n[0],fi:r}));this.invisibleObjects.updateState(this.invisibleObjects.data,{scene:this,shared:e}),this.add(this.invisibleObjects),this.createChildrenObjects(i,this.invisibleObjects,e),this.createChildrenObjects(t.objects,this,e),this.updatePage(t.publish.playPage),this.activePage.switchToPlayCamera(),this.expandInstances(e,!0),this.traverseEntity(n=>{n instanceof Zi&&n.updateUp()}),this.doPendingExpandCloner({scene:this,shared:e}),this.applyPendingCommands()}markNeedsRecomputeInstances(){this.needsRecomputeInstances=!0}markNeedsRecomputeInstancesForChildren(t){t.traverseEntity(e=>{(e.data.type==="Component"||e.data.type==="Instance")&&this.markNeedsRecomputeInstances()})}markNeedsRecomputeInstancesForAncessors(t){Be.is(t)&&(t.data.type==="Component"&&this.markNeedsRecomputeInstances(),t.traverseAncestors(e=>{Be.is(e)&&e.data.type==="Component"&&this.markNeedsRecomputeInstances()}))}relativeizeInner(t,e,i,n,r,s,a){if(t){let o=n.find(t);o&&o!==n&&r.forInstancesRec(l=>{l.data=j_(l.data,c=>{let h=c.events.data(a.id),d=l.goUp(s);if(d){let u=[...tN(d.identity),t].join("-"),p=this.entityIdentityToEntity[u];if(p){let f=p.uuid;jn.zoom(h,e)[i]=f}else console.warn("cannot find instance")}}).data})}}rewriteActions(t,e,i,n,r,s){t.forEach(a=>{a.data.type==="Transition"||a.data.type==="Animation"&&a.data.object?this.relativeizeInner(a.data.object,[...e,a.id],"object",i,n,r,s):a.data.type==="Conditional"&&(this.rewriteActions(a.data.ifActions,[...e,a.id,"ifActions"],i,n,r,s),this.rewriteActions(a.data.elseActions,[...e,a.id,"elseActions"],i,n,r,s))})}rewriteEventsBeforeGoToPlayMode(){this.traverseEntity(t=>{if(D1(t)&&typeof t.identity=="string"&&t.data.type==="Component")return t.traverseEntity((e,i)=>{e.data.events.forEach(n=>{if(n.data.type==="GameControl"){let r=!1;if(e.forInstancesRec(s=>{s.data=j_(s.data,a=>{s.isInstanceRoot||(a.events.delete(n.id),r=!0)}).data}),r===!1)for(let s of lb.list)this.rewriteActions(n.data.gameActions[s],["gameActions",s],t,e,i,n)}else n.data.type==="Conditional"?(n.data.condition.type==="Distance"?(this.relativeizeInner(n.data.condition.fromObject,["condition"],"fromObject",t,e,i,n),this.relativeizeInner(n.data.condition.toObject,["condition"],"toObject",t,e,i,n)):n.data.condition.type==="State"?this.relativeizeInner(n.data.condition.object,["condition"],"object",t,e,i,n):n.data.condition.type==="Comparison"&&(n.data.condition.lOperand.type==="Property"&&this.relativeizeInner(n.data.condition.lOperand.value[0],["condition","lOperand","value"],0,t,e,i,n),n.data.condition.rOperand.type==="Property"&&this.relativeizeInner(n.data.condition.rOperand.value[0],["condition","rOperand","value"],0,t,e,i,n)),this.rewriteActions(n.data.inActions,["inActions"],t,e,i,n),this.rewriteActions(n.data.outActions,["outActions"],t,e,i,n)):"actions"in n.data&&this.rewriteActions(n.data.actions,["actions"],t,e,i,n)})}),!0})}expandInstances(t,e,i){let n=new Set;this.traverseEntity(r=>{if(D1(r)&&r.isInstanceRoot)return r.expandInstanceChildren({scene:this,shared:t,pendingDeletes:n}),e||r.resetBBoxNeedsUpdate(),i&&r.traverseEntity(s=>{i.addClip(s)}),!0});for(let r of n)this.disposeAndUnregisterEntityRecursivelyIfNotReregistered(r),G3(r)}recomputeInstances(t,e){this.needsRecomputeInstances&&(this.needsRecomputeInstances=!1,this.traverseEntity(i=>{D1(i)&&i.isInstanceRoot&&(i.component=void 0)}),this.expandInstances(t,!1,e))}disposeAndUnregisterEntityRecursivelyIfNotReregistered(t){t.traverseEntity(e=>{let i=typeof e.identity=="string"?e.identity:e.identity.join("-");this.entityIdentityToEntity[i]===e&&(delete this.entityByUuid[e.uuid],delete this.entityIdentityToEntity[i]),e.dispose()})}clearScene(){this._autoInstancing?.dispose(),this._autoInstancing=null,this.instanceGroupsDirty=!0;for(let t of this.children)Be.is(t)&&t.disposeRecursively();this.children.length=0}resetAfterClear(t,e){this.init(t,e)}raycast(t){return this.raycast1(t,!1)}raycast1(t,e){let i=[],n=r=>{for(let s of r.children){let a=s.cloner;if(Be.is(s)&&!s.raycastLock&&(s.visible||a?.object.data.visible))if(e===!0&&s.isInstanceRoot){let o=[];if(t.intersectObject(s,!0,o),o.length){let l=o[0];l.object=s,l.point.applyMatrix4(l.object.matrixWorld);let c=s.matrixWorld.clone().invert();l.point.applyMatrix4(c),i.push(l)}}else(fa(s)||Ab(s)&&this.enableHelpers&&s.objectHelper.visible)&&(t.intersectObject(s,!1,i),wT(s,t,i)),n(s)}};return n(this.activePage),i}raycastWithClones(t){let e=[],i=n=>{for(let r of n.children){let s=r.cloner;Be.is(r)&&(r.visible||s?.object.data.visible)&&((fa(r)||Ab(r)&&this.enableHelpers&&r.objectHelper.visible)&&(t.intersectObject(r,!1,e),wT(r,t,e,!0)),i(r))}};return i(this),e}forEachEntity(t){for(let e of this.children)Be.is(e)&&t(e)}traverseConcreteEntity(t){for(let e of this.children)Be.is(e)&&e.isConcreteEntity&&e.traverseEntity(t)}traverseEntity(t){for(let e of this.children)Be.is(e)&&e.traverseEntity(t)}updateFont(t,e){this.traverseEntity(i=>{if(i instanceof Ai&&i.data.type==="Mesh"&&(i.data.geometry.type==="TextGeometry"||i.data.geometry.type==="InputGeometry")&&i.data.geometry.font===t){let n=i.geometry,r=i.data.geometry;n.updateFont(t,e).then(()=>{n.update(r,e);let s=i.invalidateDownstreamBooleanData();eo(s)&&s.recomputeBoolean()})}})}traverseObject(t){for(let e of this.children)Dc.is(e)&&e.traverseObject(t)}traverseVisibleEntity(t){for(let e of this.children)Be.is(e)&&e.visible&&e.traverseVisibleEntity(t)}dispose(){this.clearScene()}createChildrenObjects(t,e,i){let n=0;for(let r of t)this.createObject(r.id,r.data,r.children,e,n,i),n+=1}registerObjectCreatedInLegacy(t){this.entityByUuid[t.uuid]=t}unregisterObject(t){delete this.entityByUuid[t.uuid];for(let e of t.children)this.unregisterObject(e)}createObject(t,e,i,n,r,s){let a={scene:this,shared:s},o=W3(t,e,a);return ll(o)&&this.shapeBlendIntances.push(o),Yc(o)&&this.hairInstances.push(o),o&&(this.entityByUuid[t]=o,n.add(o),n.children.splice(r,0,n.children.pop()),i.length>0&&(o.isInstanceRoot?console.error("instance should not have children!"):this.createChildrenObjects(i,o,s)),o.updateState(e,a),o instanceof Ai&&o.updateGeometryGroupsIfNeeded(),o.updateVisible(this),o.cloner&&this.toExpandCloner.add(o),e.pathSnapping?.pathId&&this.pathConstraints.setConstraint(t,e.pathSnapping.pathId)),e.type==="Empty"&&e.animations&&o.traverseEntity(l=>{let c=l.dataPatched;if(l instanceof Ai&&c.bones&&c.boneInverses){let h=c.bones.map(p=>this.find(p)),d=c.boneInverses.map(p=>new At().fromArray(p)),u=new I_(h,d);l.bind(u,l.bindMatrix)}else l.matrixAutoUpdate=!0}),o}getCenter(t){let e=[];for(let n=0,r=t.length;n<r;++n){let{id:s,recursive:a}=t[n],o=this.find(s),l=a?o.recursiveBBox:o.singleBBox;e.push(...l.vertices)}let i=new ci;return i.setFromPoints(e),i.getCenter(O2),O2}copyMatrixWorld(t,e){if(t===null)return void e.identity();let i=this.find(t);i?(i.updateWorldMatrix(!0,!1),e.copy(i.matrixWorld)):e.identity()}copyParentMatrixWorld(t,e){if(t===null)return void e.identity();let i=this.find(t)?.parent;i?(i.updateWorldMatrix(!0,!1),e.copy(i.matrixWorld)):e.identity()}traverseMaterial(t){this.traverseEntity(e=>{if(e instanceof Yi)if(Array.isArray(e.material))for(let i=0;i<e.material.length;i++)mb(e.material[i])&&t(e.material[i]);else mb(e.material)&&t(e.material)})}updateViewPlaneSize(t,e,i=!1){this.traverseConcreteEntity(n=>{n instanceof Zi&&n.setViewplaneSize(t,e,i)})}initializeSplatViewer(){this.splatViewer=new r8({scene:this}),this.reloadSplats()}reloadSplats(){this.splatViewer?.loadSplat()}}}),a8={};function AZ(){let t,e;function i(n,r,s,a,o,l){let c=s.num_points(),h=l.num_components(),d=function(b,x){switch(x){case Float32Array:return b.DT_FLOAT32;case Int8Array:return b.DT_INT8;case Int16Array:return b.DT_INT16;case Int32Array:return b.DT_INT32;case Uint8Array:return b.DT_UINT8;case Uint16Array:return b.DT_UINT16;case Uint32Array:return b.DT_UINT32}}(n,o),u=h*o.BYTES_PER_ELEMENT,p=4*Math.ceil(u/4),f=p/o.BYTES_PER_ELEMENT,g=c*u,m=c*p,v=n._malloc(g);r.GetAttributeDataArrayForAllPoints(s,l,d,g,v);let y,_=new o(n.HEAPF32.buffer,v,g/o.BYTES_PER_ELEMENT);if(u===p)y=_.slice();else{y=new o(m/o.BYTES_PER_ELEMENT);let b=0;for(let x=0,w=_.length;x<w;x++){for(let S=0;S<h;S++)y[b+S]=_[x*h+S];b+=f}}return n._free(v),{name:a,count:c,itemSize:h,array:y,stride:f}}onmessage=function(n){let r=n.data;switch(r.type){case"init":t=r.decoderConfig,e=new Promise(function(o){t.onModuleLoaded=function(l){o({draco:l})},DracoDecoderModule(t)});break;case"decode":let s=r.buffer,a=r.taskConfig;e.then(o=>{let l=o.draco,c=new l.Decoder;try{let h=function(u,p,f,g){let m,v,y=g.attributeIDs,_=g.attributeTypes,b=p.GetEncodedGeometryType(f);if(b===u.TRIANGULAR_MESH)m=new u.Mesh,v=p.DecodeArrayToMesh(f,f.byteLength,m);else{if(b!==u.POINT_CLOUD)throw new Error("THREE.DRACOLoader: Unexpected geometry type.");m=new u.PointCloud,v=p.DecodeArrayToPointCloud(f,f.byteLength,m)}if(!v.ok()||m.ptr===0)throw new Error("THREE.DRACOLoader: Decoding failed: "+v.error_msg());let x={index:null,attributes:[]};for(let w in y){let S,E,A=self[_[w]];if(g.useUniqueIDs)E=y[w],S=p.GetAttributeByUniqueId(m,E);else{if(E=p.GetAttributeId(m,u[y[w]]),E===-1)continue;S=p.GetAttribute(m,E)}let P=i(u,p,m,w,A,S);w==="color"&&(P.vertexColorSpace=g.vertexColorSpace),x.attributes.push(P)}return b===u.TRIANGULAR_MESH&&(x.index=function(w,S,E){let A=3*E.num_faces(),P=4*A,C=w._malloc(P);S.GetTrianglesUInt32Array(E,P,C);let R=new Uint32Array(w.HEAPF32.buffer,C,A).slice();return w._free(C),{array:R,itemSize:1}}(u,p,m)),u.destroy(m),x}(l,c,new Int8Array(s),a),d=h.attributes.map(u=>u.array.buffer);h.index&&d.push(h.index.array.buffer),self.postMessage({type:"decode",id:r.id,geometry:h},d)}catch(h){console.error(h),self.postMessage({type:"error",id:r.id,error:h.message})}finally{l.destroy(c)}})}}}e0(a8,{DRACOLoader:()=>l8,DRACO_GLTF_CONFIG:()=>o8});var $v,o8,l8,TZ=z(()=>{tt(),$v=new WeakMap,o8={js:"",wasm:""},l8=class extends mc{constructor(t){super(t),this.decoderPaths={js:"",wasm:"",dep_js:""},this.decoderConfig={},this.decoderBinary=null,this.decoderPending=null,this.workerLimit=4,this.workerPool=[],this.workerNextTaskID=1,this.workerSourceURL="",this.defaultAttributeIDs={position:"POSITION",normal:"NORMAL",color:"COLOR",uv:"TEX_COORD"},this.defaultAttributeTypes={position:"Float32Array",normal:"Float32Array",color:"Float32Array",uv:"Float32Array"}}setDecoderPath(t){let{decoderPaths:e}=this;return typeof t=="object"?(e.js=t.js,e.wasm=t.wasm,e.dep_js=null):(e.js=x1.resolveURL("draco_wasm_wrapper.js",t),e.wasm=x1.resolveURL("draco_decoder.wasm",t),e.dep_js=x1.resolveURL("draco_decoder.js",t)),this}setDecoderConfig(t){return console.warn("THREE.DRACOLoader: setDecoderConfig to has been deprecated and will be removed in r194."),this.decoderConfig=t,this}setWorkerLimit(t){return this.workerLimit=t,this}load(t,e,i,n){let r=new lg(this.manager);r.setPath(this.path),r.setResponseType("arraybuffer"),r.setRequestHeader(this.requestHeader),r.setWithCredentials(this.withCredentials),r.load(t,s=>{this.parse(s,e,n)},i,n)}parse(t,e,i=()=>{}){this.decodeDracoFile(t,e,null,null,Ue,i).catch(i)}decodeDracoFile(t,e,i,n,r=Wu,s=()=>{}){let a={attributeIDs:i||this.defaultAttributeIDs,attributeTypes:n||this.defaultAttributeTypes,useUniqueIDs:!!i,vertexColorSpace:r};return this.decodeGeometry(t,a).then(e).catch(s)}decodeGeometry(t,e){let i=JSON.stringify(e);if($v.has(t)){let o=$v.get(t);if(o.key===i)return o.promise;if(t.byteLength===0)throw new Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.")}let n,r=this.workerNextTaskID++,s=t.byteLength,a=this._getWorker(r,s).then(o=>(n=o,new Promise((l,c)=>{n._callbacks[r]={resolve:l,reject:c},n.postMessage({type:"decode",id:r,taskConfig:e,buffer:t},[t])}))).then(o=>this._createGeometry(o.geometry));return a.catch(()=>!0).then(()=>{n&&r&&this._releaseTask(n,r)}),$v.set(t,{key:i,promise:a}),a}_createGeometry(t){let e=new jt;t.index&&e.setIndex(new Ht(t.index.array,1));for(let i=0;i<t.attributes.length;i++){let n,{name:r,array:s,itemSize:a,stride:o,vertexColorSpace:l}=t.attributes[i];if(a===o)n=new Ht(s,a);else{let c=new PE(s,o);n=new Mm(c,a,0)}r==="color"&&(this._assignVertexColorSpace(n,l),n.normalized=!(s instanceof Float32Array)),e.setAttribute(r,n)}return e}_assignVertexColorSpace(t,e){if(e!==Ue)return;let i=new Jt;for(let n=0,r=t.count;n<r;n++)i.fromBufferAttribute(t,n),Ve.colorSpaceToWorking(i,Ue),t.setXYZ(n,i.r,i.g,i.b)}_loadLibrary(t,e){let i=new lg(this.manager);return i.setResponseType(e),i.setWithCredentials(this.withCredentials),new Promise((n,r)=>{i.load(t,n,void 0,r)})}preload(){return this._initDecoder(),this}_initDecoder(){if(this.decoderPending)return this.decoderPending;let t=typeof WebAssembly!="object"||this.decoderConfig.type==="js",e=[],{decoderPaths:i}=this;if(t){if(i.dep_js===null)throw new Error("THREE.DRACOLoader: WebAssembly is required when using a custom decoder paths.");e.push(this._loadLibrary(i.dep_js,"text"))}else e.push(this._loadLibrary(i.js,"text")),e.push(this._loadLibrary(i.wasm,"arraybuffer"));return this.decoderPending=Promise.all(e).then(n=>{let r=n[0];t||(this.decoderConfig.wasmBinary=n[1]);let s=AZ.toString(),a=["/* draco decoder */",r,"","/* worker */",s.substring(s.indexOf("{")+1,s.lastIndexOf("}"))].join(`
4693
- `);this.workerSourceURL=URL.createObjectURL(new Blob([a]))}),this.decoderPending}_getWorker(t,e){return this._initDecoder().then(()=>{if(this.workerPool.length<this.workerLimit){let n=new Worker(this.workerSourceURL);n._callbacks={},n._taskCosts={},n._taskLoad=0,n.postMessage({type:"init",decoderConfig:this.decoderConfig}),n.onmessage=function(r){let s=r.data;switch(s.type){case"decode":n._callbacks[s.id].resolve(s);break;case"error":n._callbacks[s.id].reject(s);break;default:console.error('THREE.DRACOLoader: Unexpected message, "'+s.type+'"')}},this.workerPool.push(n)}else this.workerPool.sort(function(n,r){return n._taskLoad>r._taskLoad?-1:1});let i=this.workerPool[this.workerPool.length-1];return i._taskCosts[t]=e,i._taskLoad+=e,i})}_releaseTask(t,e){t._taskLoad-=t._taskCosts[e],delete t._callbacks[e],delete t._taskCosts[e]}debug(){console.log("Task load: ",this.workerPool.map(t=>t._taskLoad))}dispose(){for(let t=0;t<this.workerPool.length;++t)this.workerPool[t].terminate();return this.workerPool.length=0,this.workerSourceURL!==""&&URL.revokeObjectURL(this.workerSourceURL),this}}}),CZ=z(()=>{});function NL(t,e){let{url:i,fallback:n}=function(r){return function(s,{basePath:a,moduleUrl:o,cdnBuild:l}){if(a!==void 0)return{url:`${a}/${s}`};let c=`${l}/${s}`;if(o===void 0||o.startsWith("file:"))return{url:c};let h=o.slice(0,o.lastIndexOf("/")+1)+s;return h===c?{url:h}:{url:h,fallback:c}}(r,{basePath:h8,moduleUrl:typeof import.meta.url=="string"?import.meta.url:void 0,cdnBuild:"https://cdn.spline.design/@splinetool/runtime@2.0.77/build"})}(e);n!==void 0&&t.addEventListener("error",()=>{t.src=n},{once:!0}),t.src=i}var h8,c8=z(()=>{CZ()});function Ah(t,e){Rx.set(t,e)}function PZ(t){return Rx.get(t)}function DZ(t,e){let i=`${e}:${t}`;IT.has(i)||IT.add(i)}var Rx,IT,ul=z(()=>{Rx=new Map,IT=new Set});function kL(t,e,i){return t*(e-i)-e}function L2(t,e,i){return Math.min(Math.max((t+e)/(e-i),0),1)}function VL(t,e,i){for(let n of e){let r="$1"+t+n.charAt(0).toUpperCase()+n.slice(1),s=new RegExp("([^\\.])(\\b"+n+"\\b)","g");for(let a of i.entries())a[1]!==null&&i.set(a[0],a[1].replace(s,r))}}function RZ(t,e,i,n,r,s,a){let o=new Map([["fragment",e.getFragmentShader()],["vertex",e.getVertexShader()]]),l=o.get("fragment")!==void 0&&/mainImage/.test(o.get("fragment")),c=o.get("fragment")!==void 0&&/mainUv/.test(o.get("fragment")),h=[],d=[],u=!1,p=!1;if(o.get("fragment")===void 0)console.error("Missing fragment shader",e);else if(c&&(a&oa.CONVOLUTION)!==0)console.error("Effects that transform UV coordinates are incompatible with convolution effects",e);else if(l||c){let f=/(?:\w+\s+(\w+)\([\w\s,]*\)\s*{[^}]+})/g,g=k1.Section;if(c){let v=` ${t}MainUv(UV);
4693
+ `);this.workerSourceURL=URL.createObjectURL(new Blob([a]))}),this.decoderPending}_getWorker(t,e){return this._initDecoder().then(()=>{if(this.workerPool.length<this.workerLimit){let n=new Worker(this.workerSourceURL);n._callbacks={},n._taskCosts={},n._taskLoad=0,n.postMessage({type:"init",decoderConfig:this.decoderConfig}),n.onmessage=function(r){let s=r.data;switch(s.type){case"decode":n._callbacks[s.id].resolve(s);break;case"error":n._callbacks[s.id].reject(s);break;default:console.error('THREE.DRACOLoader: Unexpected message, "'+s.type+'"')}},this.workerPool.push(n)}else this.workerPool.sort(function(n,r){return n._taskLoad>r._taskLoad?-1:1});let i=this.workerPool[this.workerPool.length-1];return i._taskCosts[t]=e,i._taskLoad+=e,i})}_releaseTask(t,e){t._taskLoad-=t._taskCosts[e],delete t._callbacks[e],delete t._taskCosts[e]}debug(){console.log("Task load: ",this.workerPool.map(t=>t._taskLoad))}dispose(){for(let t=0;t<this.workerPool.length;++t)this.workerPool[t].terminate();return this.workerPool.length=0,this.workerSourceURL!==""&&URL.revokeObjectURL(this.workerSourceURL),this}}}),CZ=z(()=>{});function NL(t,e){let{url:i,fallback:n}=function(r){return function(s,{basePath:a,moduleUrl:o,cdnBuild:l}){if(a!==void 0)return{url:`${a}/${s}`};let c=`${l}/${s}`;if(o===void 0||o.startsWith("file:"))return{url:c};let h=o.slice(0,o.lastIndexOf("/")+1)+s;return h===c?{url:h}:{url:h,fallback:c}}(r,{basePath:h8,moduleUrl:typeof import.meta.url=="string"?import.meta.url:void 0,cdnBuild:"https://cdn.spline.design/@splinetool/runtime@2.0.79/build"})}(e);n!==void 0&&t.addEventListener("error",()=>{t.src=n},{once:!0}),t.src=i}var h8,c8=z(()=>{CZ()});function Ah(t,e){Rx.set(t,e)}function PZ(t){return Rx.get(t)}function DZ(t,e){let i=`${e}:${t}`;IT.has(i)||IT.add(i)}var Rx,IT,ul=z(()=>{Rx=new Map,IT=new Set});function kL(t,e,i){return t*(e-i)-e}function L2(t,e,i){return Math.min(Math.max((t+e)/(e-i),0),1)}function VL(t,e,i){for(let n of e){let r="$1"+t+n.charAt(0).toUpperCase()+n.slice(1),s=new RegExp("([^\\.])(\\b"+n+"\\b)","g");for(let a of i.entries())a[1]!==null&&i.set(a[0],a[1].replace(s,r))}}function RZ(t,e,i,n,r,s,a){let o=new Map([["fragment",e.getFragmentShader()],["vertex",e.getVertexShader()]]),l=o.get("fragment")!==void 0&&/mainImage/.test(o.get("fragment")),c=o.get("fragment")!==void 0&&/mainUv/.test(o.get("fragment")),h=[],d=[],u=!1,p=!1;if(o.get("fragment")===void 0)console.error("Missing fragment shader",e);else if(c&&(a&oa.CONVOLUTION)!==0)console.error("Effects that transform UV coordinates are incompatible with convolution effects",e);else if(l||c){let f=/(?:\w+\s+(\w+)\([\w\s,]*\)\s*{[^}]+})/g,g=k1.Section;if(c){let v=` ${t}MainUv(UV);
4694
4694
  `;i.set(g.FRAGMENT_MAIN_UV,i.get(g.FRAGMENT_MAIN_UV)+v),u=!0}if(o.get("vertex")!==null&&/mainSupport/.test(o.get("vertex"))){let v=` ${t}MainSupport(`;v+=/mainSupport *\([\w\s]*?uv\s*?\)/.test(o.get("vertex"))?`vUv);
4695
4695
  `:`);
4696
4696
  `,i.set(g.VERTEX_MAIN_SUPPORT,i.get(g.VERTEX_MAIN_SUPPORT)+v),h=h.concat([...o.get("vertex").matchAll(/(?:varying\s+\w+\s+(\w*))/g)].map(y=>y[1])),d=d.concat(h).concat([...o.get("vertex").matchAll(f)].map(y=>y[1]))}d=d.concat([...o.get("fragment").matchAll(f)].map(v=>v[1])),d=d.concat([...e.defines.keys()].map(v=>v.replace(/\([\w\s,]*\)/g,""))),d=d.concat([...e.uniforms.keys()]),e.uniforms.forEach((v,y)=>s.set(t+y.charAt(0).toUpperCase()+y.slice(1),v)),e.defines.forEach((v,y)=>r.set(t+y.charAt(0).toUpperCase()+y.slice(1),v)),VL(t,d,r),VL(t,d,o);let m=e.blendMode;if(n.set(m.blendFunction,m),l){let v=/MainImage *\([\w\s,]*?depth[\w\s,]*?\)/,y=`${t}MainImage(color0, UV, `;(a&oa.DEPTH)!==0&&v.test(o.get("fragment"))&&(y+="depth, ",p=!0),y+=`color1);
@@ -9856,11 +9856,11 @@ void main() {
9856
9856
  void main() {
9857
9857
  vec4 texel = texture2D( tDiffuse, vUv );
9858
9858
  gl_FragColor = texel;
9859
- }`}),gtt=new class{constructor(t){this._mesh=new gi(mtt,t)}dispose(){this._mesh.geometry.dispose()}render(t){t.render(this._mesh,ftt)}get material(){return this._mesh.material}set material(t){this._mesh.material=t}}(Xj),_M=null,bM=null,vtt=me.identity(),$j=class{constructor(t,e,i,n){var r;this.uuid=t,this.width=e,this.height=i,this.context=n,this.enabled=!0,this.isScreenSpace=!1,this.dpr=window.devicePixelRatio,this.isFrameDirty=!1,this.onRenderRequestedDownstream=()=>{this.isFrameDirty=!0,this.isScreenSpace||bg.add(this),this.context.shared.requestRender()},this._innerApplySize=()=>{let s=this.width,a=this.height;this.renderer.dpr=zB(s,a,this.dpr,this.isScreenSpace),this.renderer.setSize(s,a)},this.onFrameOverrideObjectEvent=s=>{if(s.target?.uuid!==void 0){let a=this.frameRoot?.find(s.target.uuid);a&&a.dispatchEvent({...s,target:a})}},this.scene2d=new pP(Ot.generateUUID(),UA.defaultData,{dpr:window.devicePixelRatio,shared:n.shared}),this.canvas=(_M===null&&(_M=document.createElement("canvas")),_M),this.renderer=(r=this.canvas,bM===null&&(bM=new ott(r)),bM),this.promise=this.init(),this.renderTarget=new Ne(1,1,{type:$n,stencilBuffer:!1,depthBuffer:!1}),n.shared.addUIBuffer(this.uuid,this.renderTarget),this.textureHolder=n.shared.uiBuffer(this.uuid)}get canvasTexture(){return this._canvasTexture||(this._canvasTexture=new sF(this.canvas)),this._canvasTexture}async init(){await this.renderer.init(),this.renderer.uiFontReady?.then(()=>{this.frameOverride&&this.onRenderRequestedDownstream()})}render(t){if(this.isFrameDirty){if(this.isFrameDirty=!1,this._innerApplySize(),this.renderer.clear(),this.frameOverride?.draw(this.renderer),this.renderer.render(),this.canvasTexture.needsUpdate=!0,t.blitTextureToTarget)t.blitTextureToTarget(this.canvasTexture,this.renderTarget);else{Xj.uniforms.tDiffuse.value=this.canvasTexture;let e=t.getRenderTarget();t.setRenderTarget(this.renderTarget),t.clear(),gtt.render(t),t.setRenderTarget(e)}this.textureHolder?.setNeedsUpdate(!0)}}updateEntity2DByOp(t,e,i,n){this.scene2d.updateEntityByOp(t,e,i,n),this.applySize()}updateTreeByOp(t,e){this.scene2d.updateTreeByOp(t,e),this.applySize()}applyOverrides(t){if(this.frameOverride&&this.frameRoot){this.frameOverride.position=[0,0],this.frameOverride.rotation=0;let e=t?.width??this.width,i=t?.height??this.height;this.frameOverride.width=e,this.frameOverride.height=i,this.frameOverride.localMatrix=vtt,this.isScreenSpace&&(this.frameOverride.fill.color=Je.from0to1([0,0,0,0])),this.frameOverride.data={...this.frameOverride.data,width:e,height:i},Yj({objectOverride:this.frameOverride,objectRoot:this.frameRoot,newParentWidth:this.frameOverride.width,newParentHeight:this.frameOverride.height,initialParentWidth:this.frameRoot.width,initialParentHeight:this.frameRoot.height}),this.frameOverride.updateWorldMatrix(!0,!1,!0)}}applySize(t,e=window.devicePixelRatio){let i=Math.max(1,t?.width??this.width),n=Math.max(1,t?.height??this.height);this.dpr=e,this.width=i,this.height=n,this._innerApplySize();let r=function(s,a,o,l){let c=zB(s,a,o,l),h=Math.max(o,512/Math.min(s,a)),d=Math.min(h,c);return{width:Math.max(1,Math.ceil(s*d)),height:Math.max(1,Math.ceil(a*d))}}(i,n,e,this.isScreenSpace);this.renderTarget.setSize(r.width,r.height),this._canvasTexture?.dispose(),this._canvasTexture=void 0,this.applyOverrides(t),this.frameOverride?.requestRender()}applyFrame(t){let e=this.context.scene.find2D(t);if(e&&e instanceof ao)return this.disposeFrameOverride(),this.frameRoot=e,this.frameOverride=e.clone({dpr:this.renderer.dpr,shared:this.context.shared}),this.scene2d.add(this.frameOverride),this.applySize(),this.frame?.addEventListener("render",this.onRenderRequestedDownstream),this.frameOverride.traverse(i=>{i.addEventListener("beginState",this.onFrameOverrideObjectEvent),i.addEventListener("completeState",this.onFrameOverrideObjectEvent)}),this.frame?.requestRender(),e}get frame(){return this.frameOverride}get frameId(){return this.frame?.uuid}find(t){return this.scene2d.find(t)}get texture(){return this.textureHolder?.getTexture(1001)}disposeFrameOverride(){this.frameOverride?.removeEventListener("render",this.onRenderRequestedDownstream),this.frameOverride?.traverse(t=>{t.removeEventListener("beginState",this.onFrameOverrideObjectEvent),t.removeEventListener("completeState",this.onFrameOverrideObjectEvent)}),this.frameOverride&&this.scene2d.remove(this.frameOverride)}};function Yj({objectOverride:t,objectRoot:e,newParentWidth:i,newParentHeight:n,initialParentWidth:r,initialParentHeight:s}){if(t instanceof ao&&e instanceof ao||t instanceof ph&&e instanceof ph)for(let a=0,o=t.children.length;a<o;a++){let l=t.children[a],c=e.children[a];l&&c&&l.uuid===c.uuid&&ytt({objectOverride:l,objectRoot:c,newParentWidth:i,newParentHeight:n,initialParentWidth:r,initialParentHeight:s})}}function ytt({objectOverride:t,objectRoot:e,newParentWidth:i,newParentHeight:n,initialParentWidth:r,initialParentHeight:s}){let[a,o]=function(d){if(xM(d))return[d.width,d.height];if(d instanceof kb){let[u,p]=d.getHalfSize();return[2*u,2*p]}if(d instanceof ph){let[u,p]=d.recursiveBBox.getHalfSize();return[2*u,2*p]}return[0,0]}(e),{width:l,height:c,position:h}=qj({constraints:t.data,newParentWidth:i,newParentHeight:n,initialParentWidth:r,initialParentHeight:s,objectInitialWidth:a,objectInitialHeight:o,objectInitialPosition:e.position});if(t.position=h,t.data={...t.data,position:h},t.states)for(let d in t.states)_tt({stateId:d,objectOverride:t,objectRoot:e,newParentWidth:i,newParentHeight:n,initialParentWidth:r,initialParentHeight:s});if(xM(t)||t instanceof ph)xM(t)&&(t.width=l,t.height=c,t.data={...t.data,width:l,height:c}),Yj({objectOverride:t,objectRoot:e,newParentWidth:l,newParentHeight:c,initialParentWidth:a,initialParentHeight:o});else if(t instanceof kb){let d=e,u=a!==0?l/a:1,p=o!==0?c/o:1;t.path=function(f,g=1,m=1){if(g<=0||m<=0)return f;if(Hj(f))return console.warn("Cannot scale invalid path",f),yM([]);if(g===1&&m===1)return f;try{return yM((0,ptt.parseSVG)(f).map(v=>{let y={...v};return"x"in y&&(y.x=y.x*g),"y"in y&&(y.y=y.y*m),"x1"in y&&(y.x1=y.x1*g),"x2"in y&&(y.x2=y.x2*g),"y1"in y&&(y.y1=y.y1*m),"y2"in y&&(y.y2=y.y2*m),"rx"in y&&(y.rx=y.rx*g),"ry"in y&&(y.ry=y.ry*m),y}))}catch(v){return console.warn("Error parsing SVG path",v),yM([])}}(d.path,u,p),t.data={...t.data,path:t.path}}}function _tt({stateId:t,objectOverride:e,objectRoot:i,newParentWidth:n,newParentHeight:r,initialParentWidth:s,initialParentHeight:a}){let o=e.states?.[t],l=i.states?.[t];if(o&&l){let{width:c,height:h,position:d}=qj({constraints:e.data,newParentWidth:n,newParentHeight:r,initialParentWidth:s,initialParentHeight:a,objectInitialWidth:kc.isResizeable(l)?l.width:0,objectInitialHeight:kc.isResizeable(l)?l.height:0,objectInitialPosition:l.position});Object.assign(e.states[t],{position:d}),kc.isResizeable(o)&&Object.assign(e.states[t],{width:c,height:h})}}function xM(t){return t instanceof y0||t instanceof ao||t instanceof dP||t instanceof uP}Sx();var FB,btt=class extends Ai{constructor(t,e,i){super(t,e,i),this.isUIObject=!0,this.uiCanvas=new $j(t+"-canvas",e.geometry.width,e.geometry.height,i),this.uiCanvas.promise.then(()=>{this.applyFrame(this.dataPatched.geometry.frame,i.shared)})}updateByPatchedOpGeometry(t,e,i){super.updateByPatchedOpGeometry(t,e,i),t.type===0&&(t.props.frame!==void 0&&this.applyFrame(t.props.frame,i.shared),(t.props.width!==void 0||t.props.height!==void 0)&&this.applySize(t.props,i.shared))}applySize(t,e){let i=t?.width??this.dataPatched.geometry.width,n=t?.height??this.dataPatched.geometry.height;this.uiCanvas.applySize({width:i,height:n}),this.applyGeometryParametersFromFrame(e)}applyFrame(t,e){this.uiCanvas.applyFrame(t),this.applyGeometryParametersFromFrame(e),this.applyMaterialParametersFromFrame({shared:e})}applyGeometryParametersFromFrame(t){let e=this.frame;e&&(Object.assign(this.data,{geometry:Object.assign(this.data.geometry,{cornerRadius:e.cornerRadius,cornerType:0})}),Object.assign(this.dataPatched,{geometry:Object.assign(this.dataPatched.geometry,{cornerRadius:e.cornerRadius,cornerType:0})}),this.localGeometry?.dispose(),this.localGeometry=nh(this.dataPatched.geometry,t,this.data.flatShading,this))}applyMaterialParametersFromFrame(t){let e=this.frame;if(e){let i=e.data.backgroundBlur;Object.assign(this.data.material.layers[0].data.texture,{image:this.uiCanvas.uuid}),Object.assign(this.data.material.layers[1].data,{roughness:i.radius,alpha:i.enabled?1:0}),Object.assign(this.dataPatched.material.layers[0].data.texture,{image:this.uiCanvas.uuid}),Object.assign(this.dataPatched.material.layers[1].data,{roughness:i.radius,alpha:i.enabled?1:0}),this.material.reset?.(this.dataPatched.material,t,!0)}}updateEntity2DByOp(t,e,i,n){this.uiCanvas.updateEntity2DByOp(t,e,i,n),t===this.frameId&&e.type===0&&(e.props.cornerRadius!==void 0?this.applyGeometryParametersFromFrame(n):ri(e.path,["backgroundBlur"])&&this.applyMaterialParametersFromFrame({shared:n}))}get frame(){return this.uiCanvas.frame}get frameId(){return this.frame?.uuid}removeInteractionGeometry(t){super.removeInteractionGeometry(t),this.applySize({},t)}updateGeometryInteractions(t,e){super.updateGeometryInteractions(t,e),this.applySize({width:t.width,height:t.height},e);let i={...this.data.geometry,...t};this.localGeometry?.dispose(),this.localGeometry=nh(i,e,this.data.flatShading,this)}};ke(),Ep("UIGeometry",(t,e,i)=>new btt(t,e,i)),mx=FB={Scene2D:pP,UICanvas:$j,loadHanaUIRUNTIME:function(){return zb||(zb=async()=>async function(t,e){return await t.default(e?{module_or_path:e}:void 0),Object.getOwnPropertyDescriptor(t.Engine.prototype,"scene")||Object.defineProperty(t.Engine.prototype,"scene",{get:function(){let i=Object.create(t.SceneController.prototype);return i.__wbg_ptr=this.__wbg_ptr,i}}),{createEngine:i=>t.Engine.create(i,JSON.parse('{"schema":13,"scenes":[{"fi":0,"id":"32603ebf4-bd9a-54ba-c1e9-6645c3ee7a53","data":{"name":"Page","backgroundColor":[0,0,0,0],"objects":[]}}],"assets":{"images":{},"videos":{},"colors":{},"audios":{},"numbers":{},"booleans":{},"strings":{},"dynamicVariables":{"counters":{},"randoms":{},"timers":{},"times":{}},"fonts":{},"animations":{},"geometries":{},"emojiArt":{}},"publish":{"logo":true,"presentationSizing":"Contain","allowPageScroll":true,"showBackground":true},"framePublish":{},"components":{}}'),!0)}}(await Promise.resolve().then(()=>(WD(),HD)),SB??function(){let t=typeof process<"u"?"2.0.77":void 0;return`https://cdn.spline.design/@splinetool/runtime${t?`@${t}`:""}/build/hana-ui.wasm`}())),jj().then(()=>{})},setHanaUIWasmUrl:function(t){SB=t}},pb!==null&&FB.setHanaUIWasmUrl(pb),Si("ui-2d"),_6(),tt();var Zj,wM,xtt=class{constructor(){this.type="ShapePath",this.color=new Jt,this.subPaths=[],this.currentPath=null}moveTo(t,e){return this.currentPath=new og,this.subPaths.push(this.currentPath),this.currentPath.moveTo(t,e),this}lineTo(t,e){return this.currentPath?.lineTo(t,e),this}quadraticCurveTo(t,e,i,n){return this.currentPath?.quadraticCurveTo(t,e,i,n),this}bezierCurveTo(t,e,i,n,r,s){return this.currentPath?.bezierCurveTo(t,e,i,n,r,s),this}splineThru(t){return this.currentPath?.splineThru(t),this}toShapes(){let t={loc:0,t:0};function e(c,h,d,u){let p=c.x,f=h.x,g=d.x,m=u.x,v=c.y,y=h.y,_=d.y,b=u.y,x=(m-g)*(v-_)-(b-_)*(p-g),w=(b-_)*(f-p)-(m-g)*(y-v),S=x/w,E=((f-p)*(v-_)-(y-v)*(p-g))/w;if(w===0&&x!==0||S<=0||S>=1||E<0||E>1)return null;if(x===0&&w===0){for(let A=0;A<2;A++){if(i(A===0?d:u,c,h),t.loc===0){let P=A===0?d:u;return{x:P.x,y:P.y,t:t.t}}if(t.loc===2)return{x:+(p+t.t*(f-p)).toPrecision(10),y:+(v+t.t*(y-v)).toPrecision(10),t:t.t}}return null}for(let A=0;A<2;A++)if(i(A===0?d:u,c,h),t.loc===0){let P=A===0?d:u;return{x:P.x,y:P.y,t:t.t}}return{x:+(p+S*(f-p)).toPrecision(10),y:+(v+S*(y-v)).toPrecision(10),t:S}}function i(c,h,d){let u,p=d.x-h.x,f=d.y-h.y,g=c.x-h.x,m=c.y-h.y,v=p*m-g*f;return c.x===h.x&&c.y===h.y?(t.loc=0,void(t.t=0)):c.x===d.x&&c.y===d.y?(t.loc=1,void(t.t=1)):void(v<-Number.EPSILON?t.loc=3:v>Number.EPSILON?t.loc=4:p*g<0||f*m<0?t.loc=5:Math.sqrt(p*p+f*f)<Math.sqrt(g*g+m*m)?t.loc=6:(u=p!==0?g/p:m/f,t.loc=2,t.t=u))}let n=0,r=999999999,s=-999999999,a=[];this.subPaths.forEach(c=>{let h=c.getPoints(),d=-999999999,u=999999999,p=-999999999,f=999999999;for(let g=0;g<h.length;g++){let m=h[g];m.y>d&&(d=m.y),m.y<u&&(u=m.y),m.x>p&&(p=m.x),m.x<f&&(f=m.x)}s<=p&&(s=p+1),r>=f&&(r=f-1),h.length&&a.push({curves:c.curves,points:h,isCW:UE.isClockWise(h),identifier:n++,boundingBox:new BC(new et(f,u),new et(p,d))})});let o=a.map(c=>function(h,d,u,p,f){(f==null||f==="")&&(f="nonzero");let g=new et;h.boundingBox.getCenter(g);let m=function(w,S,E){let A=new et;S.getCenter(A);let P=[];return E.forEach(C=>{C.boundingBox.containsPoint(A)&&function(R,L){let D=[],F=[];for(let V=1;V<R.length;V++){let U=R[V-1],j=R[V];for(let W=1;W<L.length;W++){let it=e(U,j,L[W-1],L[W]);it!==null&&D.find(nt=>nt.t<=it.t+Number.EPSILON&&nt.t>=it.t-Number.EPSILON)===void 0&&(D.push(it),F.push(new et(it.x,it.y)))}}return F}(w,C.points).forEach(R=>{P.push({identifier:C.identifier,isCW:C.isCW,point:R})})}),P.sort((C,R)=>C.point.x-R.point.x),P}([new et(u,g.y),new et(p,g.y)],h.boundingBox,d);m.sort((w,S)=>w.point.x-S.point.x);let v=[],y=[];m.forEach(w=>{w.identifier===h.identifier?v.push(w):y.push(w)});let _=v[0].point.x,b=[],x=0;for(;x<y.length&&y[x].point.x<_;)b.length>0&&b[b.length-1]===y[x].identifier?b.pop():b.push(y[x].identifier),x++;if(b.push(h.identifier),f==="evenodd"){let w=b.length%2==0,S=b[b.length-2];return{identifier:h.identifier,isHole:w,for:S}}if(f==="nonzero"){let w=!0,S=null,E=null;for(let A=0;A<b.length;A++){let P=b[A];d[P]&&(w?(E=d[P].isCW,w=!1,S=P):E!==d[P].isCW&&(E=d[P].isCW,w=!0))}return{identifier:h.identifier,isHole:w,for:S}}console.warn('fill-rule: "'+f+'" is currently not implemented.')}(c,a,r,s,this.userData?.style.fillRule)),l=[];return a.forEach(c=>{let h=o[c.identifier];if(h&&!h.isHole){let d=new Ug;d.curves=c.curves,o.filter(u=>u?.isHole&&u.for===c.identifier).forEach(u=>{if(u){let p=a[u.identifier],f=new og;f.curves=p.curves,d.holes.push(f)}}),l.push(d)}}),l}},Kj=!1,NB=new Promise(t=>{Zj=t}),kB=!1;function VB(){if(Kj=!0,!kB)return wM||(wM=async function(){let t=await import("./opentype.js");Zj(t),kB=!0}(),wM)}var wtt=new class{async load(t,e,i=()=>{}){let{load:n}=await NB;n(t,(r,s)=>{r||!s?i(r??"Something went wrong"):e(s)})}async parse(t){let{parse:e,Bidi:i}=await NB;try{let n=e(t),r=new i,s=a=>n.charToGlyphIndex(a.char);return r.registerModifier("glyphIndex",null,s),r.applyFeatures(n,n.defaultRenderOptions.features),{font:n,bidi:r}}catch(n){console.error(n)}}};function Stt(t,e){return e.state.glyphIndex===t||e.state.fina===t||e.state.medi===t||e.state.init===t}tt(),b3(),ke(),Ep("TextGeometry",(t,e,i)=>new cP(t,e,i));var jB={create:(t,e)=>new lT(t,e)};NA("TextGeometry",jB),NA("InputGeometry",jB),_3=class{constructor(t){this._arrayBuffer=new ArrayBuffer(1),this._isLoaded=!1,this._intercepted=!1,this._layoutErrorWarned=!1,this._isUserFont=t.isUserFont??!1,this._loadingPromise=this.load(t)}update(t){this._isLoaded=!1,this._isUserFont=t.isUserFont??!1,this._loadingPromise=this.load(t)}async load(t){try{this._layoutErrorWarned=!1;let e=await async function(i){let n,r,s=!1;if(i.url?(n=await async function(a){let o;try{o=await fetch(a)}catch(l){throw new Error(`could not fetch the font at ${a}: ${l}`)}if(!o.ok)throw new Error(`${o.status} ${o.statusText} fetching the font at ${a}`);return await o.arrayBuffer()}(i.url),r=i.url,s=i.url.startsWith("/")):i.data&&(n=i.data.buffer.slice(i.data.byteOffset,i.data.byteOffset+i.data.byteLength)),n){if(!Kj)return{font:void 0,url:r,intercepted:s,arr:n,bidi:null};{let a=await wtt.parse(n);if(a)return{font:a.font,url:r,intercepted:s,arr:n,bidi:a.bidi}}}}(t);e&&(this._arrayBuffer=e.arr,this._url=e.url,this.font=e.font,this._intercepted=e.intercepted,this._isLoaded=!0,this._bidi=e.bidi)}catch(e){console.warn(`Could not load the font "${t.url??"(inline data)"}"`,e)}}warnLayoutError(t){this._layoutErrorWarned||(this._layoutErrorWarned=!0,console.warn(`Text layout failed for the font "${this._url??"(inline data)"}"`,t))}get url(){return this._url}get intercepted(){return this._intercepted}get isLoaded(){return this._isLoaded}get loadingPromise(){return this._loadingPromise}reverseLigaturesTable(t,e,i){if(!this._bidi)return[];let n=this._bidi;n.getTextGlyphs(e);let r=n.tokenizer.tokens,s=[],a=0,o=i.length===r.length;for(let l=0;l<i.length;l++){let c=i[l].index,h=String.fromCharCode(i[l].unicode),d=r[a];if(Stt(c,d)||o)s.push({char:h,index:c,replacements:[d.state.glyphIndex],replacementChars:[d.char]}),a++;else{let u=d.char,p="",f=[d.state.glyphIndex],g=[],m=!1;for(;!m;)a++,p=e.charAt(a),u+=p,f.push(t.charToGlyphIndex(p)),g=t.stringToGlyphs(u),g.length===1&&g[0].index===c&&(m=!0),a>e.length&&(m=!0);s.push({char:h,index:c,replacements:f,replacementChars:Array.from(u)}),a++}}return s}generateShapes(t,e,i){if(!this._isLoaded)return;let n=this.font,r=e.fontSize/this.unitsPerEm,s=e.fontSize*e.lineHeight,a=t.map(v=>this.getTextWidth(v,e)),o=typeof e.width=="string"?Number(i.getVariable(e.width)):e.width,l=typeof e.height=="string"?Number(i.getVariable(e.height)):e.height,c=this.getCharWidth(`
9859
+ }`}),gtt=new class{constructor(t){this._mesh=new gi(mtt,t)}dispose(){this._mesh.geometry.dispose()}render(t){t.render(this._mesh,ftt)}get material(){return this._mesh.material}set material(t){this._mesh.material=t}}(Xj),_M=null,bM=null,vtt=me.identity(),$j=class{constructor(t,e,i,n){var r;this.uuid=t,this.width=e,this.height=i,this.context=n,this.enabled=!0,this.isScreenSpace=!1,this.dpr=window.devicePixelRatio,this.isFrameDirty=!1,this.onRenderRequestedDownstream=()=>{this.isFrameDirty=!0,this.isScreenSpace||bg.add(this),this.context.shared.requestRender()},this._innerApplySize=()=>{let s=this.width,a=this.height;this.renderer.dpr=zB(s,a,this.dpr,this.isScreenSpace),this.renderer.setSize(s,a)},this.onFrameOverrideObjectEvent=s=>{if(s.target?.uuid!==void 0){let a=this.frameRoot?.find(s.target.uuid);a&&a.dispatchEvent({...s,target:a})}},this.scene2d=new pP(Ot.generateUUID(),UA.defaultData,{dpr:window.devicePixelRatio,shared:n.shared}),this.canvas=(_M===null&&(_M=document.createElement("canvas")),_M),this.renderer=(r=this.canvas,bM===null&&(bM=new ott(r)),bM),this.promise=this.init(),this.renderTarget=new Ne(1,1,{type:$n,stencilBuffer:!1,depthBuffer:!1}),n.shared.addUIBuffer(this.uuid,this.renderTarget),this.textureHolder=n.shared.uiBuffer(this.uuid)}get canvasTexture(){return this._canvasTexture||(this._canvasTexture=new sF(this.canvas)),this._canvasTexture}async init(){await this.renderer.init(),this.renderer.uiFontReady?.then(()=>{this.frameOverride&&this.onRenderRequestedDownstream()})}render(t){if(this.isFrameDirty){if(this.isFrameDirty=!1,this._innerApplySize(),this.renderer.clear(),this.frameOverride?.draw(this.renderer),this.renderer.render(),this.canvasTexture.needsUpdate=!0,t.blitTextureToTarget)t.blitTextureToTarget(this.canvasTexture,this.renderTarget);else{Xj.uniforms.tDiffuse.value=this.canvasTexture;let e=t.getRenderTarget();t.setRenderTarget(this.renderTarget),t.clear(),gtt.render(t),t.setRenderTarget(e)}this.textureHolder?.setNeedsUpdate(!0)}}updateEntity2DByOp(t,e,i,n){this.scene2d.updateEntityByOp(t,e,i,n),this.applySize()}updateTreeByOp(t,e){this.scene2d.updateTreeByOp(t,e),this.applySize()}applyOverrides(t){if(this.frameOverride&&this.frameRoot){this.frameOverride.position=[0,0],this.frameOverride.rotation=0;let e=t?.width??this.width,i=t?.height??this.height;this.frameOverride.width=e,this.frameOverride.height=i,this.frameOverride.localMatrix=vtt,this.isScreenSpace&&(this.frameOverride.fill.color=Je.from0to1([0,0,0,0])),this.frameOverride.data={...this.frameOverride.data,width:e,height:i},Yj({objectOverride:this.frameOverride,objectRoot:this.frameRoot,newParentWidth:this.frameOverride.width,newParentHeight:this.frameOverride.height,initialParentWidth:this.frameRoot.width,initialParentHeight:this.frameRoot.height}),this.frameOverride.updateWorldMatrix(!0,!1,!0)}}applySize(t,e=window.devicePixelRatio){let i=Math.max(1,t?.width??this.width),n=Math.max(1,t?.height??this.height);this.dpr=e,this.width=i,this.height=n,this._innerApplySize();let r=function(s,a,o,l){let c=zB(s,a,o,l),h=Math.max(o,512/Math.min(s,a)),d=Math.min(h,c);return{width:Math.max(1,Math.ceil(s*d)),height:Math.max(1,Math.ceil(a*d))}}(i,n,e,this.isScreenSpace);this.renderTarget.setSize(r.width,r.height),this._canvasTexture?.dispose(),this._canvasTexture=void 0,this.applyOverrides(t),this.frameOverride?.requestRender()}applyFrame(t){let e=this.context.scene.find2D(t);if(e&&e instanceof ao)return this.disposeFrameOverride(),this.frameRoot=e,this.frameOverride=e.clone({dpr:this.renderer.dpr,shared:this.context.shared}),this.scene2d.add(this.frameOverride),this.applySize(),this.frame?.addEventListener("render",this.onRenderRequestedDownstream),this.frameOverride.traverse(i=>{i.addEventListener("beginState",this.onFrameOverrideObjectEvent),i.addEventListener("completeState",this.onFrameOverrideObjectEvent)}),this.frame?.requestRender(),e}get frame(){return this.frameOverride}get frameId(){return this.frame?.uuid}find(t){return this.scene2d.find(t)}get texture(){return this.textureHolder?.getTexture(1001)}disposeFrameOverride(){this.frameOverride?.removeEventListener("render",this.onRenderRequestedDownstream),this.frameOverride?.traverse(t=>{t.removeEventListener("beginState",this.onFrameOverrideObjectEvent),t.removeEventListener("completeState",this.onFrameOverrideObjectEvent)}),this.frameOverride&&this.scene2d.remove(this.frameOverride)}};function Yj({objectOverride:t,objectRoot:e,newParentWidth:i,newParentHeight:n,initialParentWidth:r,initialParentHeight:s}){if(t instanceof ao&&e instanceof ao||t instanceof ph&&e instanceof ph)for(let a=0,o=t.children.length;a<o;a++){let l=t.children[a],c=e.children[a];l&&c&&l.uuid===c.uuid&&ytt({objectOverride:l,objectRoot:c,newParentWidth:i,newParentHeight:n,initialParentWidth:r,initialParentHeight:s})}}function ytt({objectOverride:t,objectRoot:e,newParentWidth:i,newParentHeight:n,initialParentWidth:r,initialParentHeight:s}){let[a,o]=function(d){if(xM(d))return[d.width,d.height];if(d instanceof kb){let[u,p]=d.getHalfSize();return[2*u,2*p]}if(d instanceof ph){let[u,p]=d.recursiveBBox.getHalfSize();return[2*u,2*p]}return[0,0]}(e),{width:l,height:c,position:h}=qj({constraints:t.data,newParentWidth:i,newParentHeight:n,initialParentWidth:r,initialParentHeight:s,objectInitialWidth:a,objectInitialHeight:o,objectInitialPosition:e.position});if(t.position=h,t.data={...t.data,position:h},t.states)for(let d in t.states)_tt({stateId:d,objectOverride:t,objectRoot:e,newParentWidth:i,newParentHeight:n,initialParentWidth:r,initialParentHeight:s});if(xM(t)||t instanceof ph)xM(t)&&(t.width=l,t.height=c,t.data={...t.data,width:l,height:c}),Yj({objectOverride:t,objectRoot:e,newParentWidth:l,newParentHeight:c,initialParentWidth:a,initialParentHeight:o});else if(t instanceof kb){let d=e,u=a!==0?l/a:1,p=o!==0?c/o:1;t.path=function(f,g=1,m=1){if(g<=0||m<=0)return f;if(Hj(f))return console.warn("Cannot scale invalid path",f),yM([]);if(g===1&&m===1)return f;try{return yM((0,ptt.parseSVG)(f).map(v=>{let y={...v};return"x"in y&&(y.x=y.x*g),"y"in y&&(y.y=y.y*m),"x1"in y&&(y.x1=y.x1*g),"x2"in y&&(y.x2=y.x2*g),"y1"in y&&(y.y1=y.y1*m),"y2"in y&&(y.y2=y.y2*m),"rx"in y&&(y.rx=y.rx*g),"ry"in y&&(y.ry=y.ry*m),y}))}catch(v){return console.warn("Error parsing SVG path",v),yM([])}}(d.path,u,p),t.data={...t.data,path:t.path}}}function _tt({stateId:t,objectOverride:e,objectRoot:i,newParentWidth:n,newParentHeight:r,initialParentWidth:s,initialParentHeight:a}){let o=e.states?.[t],l=i.states?.[t];if(o&&l){let{width:c,height:h,position:d}=qj({constraints:e.data,newParentWidth:n,newParentHeight:r,initialParentWidth:s,initialParentHeight:a,objectInitialWidth:kc.isResizeable(l)?l.width:0,objectInitialHeight:kc.isResizeable(l)?l.height:0,objectInitialPosition:l.position});Object.assign(e.states[t],{position:d}),kc.isResizeable(o)&&Object.assign(e.states[t],{width:c,height:h})}}function xM(t){return t instanceof y0||t instanceof ao||t instanceof dP||t instanceof uP}Sx();var FB,btt=class extends Ai{constructor(t,e,i){super(t,e,i),this.isUIObject=!0,this.uiCanvas=new $j(t+"-canvas",e.geometry.width,e.geometry.height,i),this.uiCanvas.promise.then(()=>{this.applyFrame(this.dataPatched.geometry.frame,i.shared)})}updateByPatchedOpGeometry(t,e,i){super.updateByPatchedOpGeometry(t,e,i),t.type===0&&(t.props.frame!==void 0&&this.applyFrame(t.props.frame,i.shared),(t.props.width!==void 0||t.props.height!==void 0)&&this.applySize(t.props,i.shared))}applySize(t,e){let i=t?.width??this.dataPatched.geometry.width,n=t?.height??this.dataPatched.geometry.height;this.uiCanvas.applySize({width:i,height:n}),this.applyGeometryParametersFromFrame(e)}applyFrame(t,e){this.uiCanvas.applyFrame(t),this.applyGeometryParametersFromFrame(e),this.applyMaterialParametersFromFrame({shared:e})}applyGeometryParametersFromFrame(t){let e=this.frame;e&&(Object.assign(this.data,{geometry:Object.assign(this.data.geometry,{cornerRadius:e.cornerRadius,cornerType:0})}),Object.assign(this.dataPatched,{geometry:Object.assign(this.dataPatched.geometry,{cornerRadius:e.cornerRadius,cornerType:0})}),this.localGeometry?.dispose(),this.localGeometry=nh(this.dataPatched.geometry,t,this.data.flatShading,this))}applyMaterialParametersFromFrame(t){let e=this.frame;if(e){let i=e.data.backgroundBlur;Object.assign(this.data.material.layers[0].data.texture,{image:this.uiCanvas.uuid}),Object.assign(this.data.material.layers[1].data,{roughness:i.radius,alpha:i.enabled?1:0}),Object.assign(this.dataPatched.material.layers[0].data.texture,{image:this.uiCanvas.uuid}),Object.assign(this.dataPatched.material.layers[1].data,{roughness:i.radius,alpha:i.enabled?1:0}),this.material.reset?.(this.dataPatched.material,t,!0)}}updateEntity2DByOp(t,e,i,n){this.uiCanvas.updateEntity2DByOp(t,e,i,n),t===this.frameId&&e.type===0&&(e.props.cornerRadius!==void 0?this.applyGeometryParametersFromFrame(n):ri(e.path,["backgroundBlur"])&&this.applyMaterialParametersFromFrame({shared:n}))}get frame(){return this.uiCanvas.frame}get frameId(){return this.frame?.uuid}removeInteractionGeometry(t){super.removeInteractionGeometry(t),this.applySize({},t)}updateGeometryInteractions(t,e){super.updateGeometryInteractions(t,e),this.applySize({width:t.width,height:t.height},e);let i={...this.data.geometry,...t};this.localGeometry?.dispose(),this.localGeometry=nh(i,e,this.data.flatShading,this)}};ke(),Ep("UIGeometry",(t,e,i)=>new btt(t,e,i)),mx=FB={Scene2D:pP,UICanvas:$j,loadHanaUIRUNTIME:function(){return zb||(zb=async()=>async function(t,e){return await t.default(e?{module_or_path:e}:void 0),Object.getOwnPropertyDescriptor(t.Engine.prototype,"scene")||Object.defineProperty(t.Engine.prototype,"scene",{get:function(){let i=Object.create(t.SceneController.prototype);return i.__wbg_ptr=this.__wbg_ptr,i}}),{createEngine:i=>t.Engine.create(i,JSON.parse('{"schema":13,"scenes":[{"fi":0,"id":"32603ebf4-bd9a-54ba-c1e9-6645c3ee7a53","data":{"name":"Page","backgroundColor":[0,0,0,0],"objects":[]}}],"assets":{"images":{},"videos":{},"colors":{},"audios":{},"numbers":{},"booleans":{},"strings":{},"dynamicVariables":{"counters":{},"randoms":{},"timers":{},"times":{}},"fonts":{},"animations":{},"geometries":{},"emojiArt":{}},"publish":{"logo":true,"presentationSizing":"Contain","allowPageScroll":true,"showBackground":true},"framePublish":{},"components":{}}'),!0)}}(await Promise.resolve().then(()=>(WD(),HD)),SB??function(){let t=typeof process<"u"?"2.0.79":void 0;return`https://cdn.spline.design/@splinetool/runtime${t?`@${t}`:""}/build/hana-ui.wasm`}())),jj().then(()=>{})},setHanaUIWasmUrl:function(t){SB=t}},pb!==null&&FB.setHanaUIWasmUrl(pb),Si("ui-2d"),_6(),tt();var Zj,wM,xtt=class{constructor(){this.type="ShapePath",this.color=new Jt,this.subPaths=[],this.currentPath=null}moveTo(t,e){return this.currentPath=new og,this.subPaths.push(this.currentPath),this.currentPath.moveTo(t,e),this}lineTo(t,e){return this.currentPath?.lineTo(t,e),this}quadraticCurveTo(t,e,i,n){return this.currentPath?.quadraticCurveTo(t,e,i,n),this}bezierCurveTo(t,e,i,n,r,s){return this.currentPath?.bezierCurveTo(t,e,i,n,r,s),this}splineThru(t){return this.currentPath?.splineThru(t),this}toShapes(){let t={loc:0,t:0};function e(c,h,d,u){let p=c.x,f=h.x,g=d.x,m=u.x,v=c.y,y=h.y,_=d.y,b=u.y,x=(m-g)*(v-_)-(b-_)*(p-g),w=(b-_)*(f-p)-(m-g)*(y-v),S=x/w,E=((f-p)*(v-_)-(y-v)*(p-g))/w;if(w===0&&x!==0||S<=0||S>=1||E<0||E>1)return null;if(x===0&&w===0){for(let A=0;A<2;A++){if(i(A===0?d:u,c,h),t.loc===0){let P=A===0?d:u;return{x:P.x,y:P.y,t:t.t}}if(t.loc===2)return{x:+(p+t.t*(f-p)).toPrecision(10),y:+(v+t.t*(y-v)).toPrecision(10),t:t.t}}return null}for(let A=0;A<2;A++)if(i(A===0?d:u,c,h),t.loc===0){let P=A===0?d:u;return{x:P.x,y:P.y,t:t.t}}return{x:+(p+S*(f-p)).toPrecision(10),y:+(v+S*(y-v)).toPrecision(10),t:S}}function i(c,h,d){let u,p=d.x-h.x,f=d.y-h.y,g=c.x-h.x,m=c.y-h.y,v=p*m-g*f;return c.x===h.x&&c.y===h.y?(t.loc=0,void(t.t=0)):c.x===d.x&&c.y===d.y?(t.loc=1,void(t.t=1)):void(v<-Number.EPSILON?t.loc=3:v>Number.EPSILON?t.loc=4:p*g<0||f*m<0?t.loc=5:Math.sqrt(p*p+f*f)<Math.sqrt(g*g+m*m)?t.loc=6:(u=p!==0?g/p:m/f,t.loc=2,t.t=u))}let n=0,r=999999999,s=-999999999,a=[];this.subPaths.forEach(c=>{let h=c.getPoints(),d=-999999999,u=999999999,p=-999999999,f=999999999;for(let g=0;g<h.length;g++){let m=h[g];m.y>d&&(d=m.y),m.y<u&&(u=m.y),m.x>p&&(p=m.x),m.x<f&&(f=m.x)}s<=p&&(s=p+1),r>=f&&(r=f-1),h.length&&a.push({curves:c.curves,points:h,isCW:UE.isClockWise(h),identifier:n++,boundingBox:new BC(new et(f,u),new et(p,d))})});let o=a.map(c=>function(h,d,u,p,f){(f==null||f==="")&&(f="nonzero");let g=new et;h.boundingBox.getCenter(g);let m=function(w,S,E){let A=new et;S.getCenter(A);let P=[];return E.forEach(C=>{C.boundingBox.containsPoint(A)&&function(R,L){let D=[],F=[];for(let V=1;V<R.length;V++){let U=R[V-1],j=R[V];for(let W=1;W<L.length;W++){let it=e(U,j,L[W-1],L[W]);it!==null&&D.find(nt=>nt.t<=it.t+Number.EPSILON&&nt.t>=it.t-Number.EPSILON)===void 0&&(D.push(it),F.push(new et(it.x,it.y)))}}return F}(w,C.points).forEach(R=>{P.push({identifier:C.identifier,isCW:C.isCW,point:R})})}),P.sort((C,R)=>C.point.x-R.point.x),P}([new et(u,g.y),new et(p,g.y)],h.boundingBox,d);m.sort((w,S)=>w.point.x-S.point.x);let v=[],y=[];m.forEach(w=>{w.identifier===h.identifier?v.push(w):y.push(w)});let _=v[0].point.x,b=[],x=0;for(;x<y.length&&y[x].point.x<_;)b.length>0&&b[b.length-1]===y[x].identifier?b.pop():b.push(y[x].identifier),x++;if(b.push(h.identifier),f==="evenodd"){let w=b.length%2==0,S=b[b.length-2];return{identifier:h.identifier,isHole:w,for:S}}if(f==="nonzero"){let w=!0,S=null,E=null;for(let A=0;A<b.length;A++){let P=b[A];d[P]&&(w?(E=d[P].isCW,w=!1,S=P):E!==d[P].isCW&&(E=d[P].isCW,w=!0))}return{identifier:h.identifier,isHole:w,for:S}}console.warn('fill-rule: "'+f+'" is currently not implemented.')}(c,a,r,s,this.userData?.style.fillRule)),l=[];return a.forEach(c=>{let h=o[c.identifier];if(h&&!h.isHole){let d=new Ug;d.curves=c.curves,o.filter(u=>u?.isHole&&u.for===c.identifier).forEach(u=>{if(u){let p=a[u.identifier],f=new og;f.curves=p.curves,d.holes.push(f)}}),l.push(d)}}),l}},Kj=!1,NB=new Promise(t=>{Zj=t}),kB=!1;function VB(){if(Kj=!0,!kB)return wM||(wM=async function(){let t=await import("./opentype.js");Zj(t),kB=!0}(),wM)}var wtt=new class{async load(t,e,i=()=>{}){let{load:n}=await NB;n(t,(r,s)=>{r||!s?i(r??"Something went wrong"):e(s)})}async parse(t){let{parse:e,Bidi:i}=await NB;try{let n=e(t),r=new i,s=a=>n.charToGlyphIndex(a.char);return r.registerModifier("glyphIndex",null,s),r.applyFeatures(n,n.defaultRenderOptions.features),{font:n,bidi:r}}catch(n){console.error(n)}}};function Stt(t,e){return e.state.glyphIndex===t||e.state.fina===t||e.state.medi===t||e.state.init===t}tt(),b3(),ke(),Ep("TextGeometry",(t,e,i)=>new cP(t,e,i));var jB={create:(t,e)=>new lT(t,e)};NA("TextGeometry",jB),NA("InputGeometry",jB),_3=class{constructor(t){this._arrayBuffer=new ArrayBuffer(1),this._isLoaded=!1,this._intercepted=!1,this._layoutErrorWarned=!1,this._isUserFont=t.isUserFont??!1,this._loadingPromise=this.load(t)}update(t){this._isLoaded=!1,this._isUserFont=t.isUserFont??!1,this._loadingPromise=this.load(t)}async load(t){try{this._layoutErrorWarned=!1;let e=await async function(i){let n,r,s=!1;if(i.url?(n=await async function(a){let o;try{o=await fetch(a)}catch(l){throw new Error(`could not fetch the font at ${a}: ${l}`)}if(!o.ok)throw new Error(`${o.status} ${o.statusText} fetching the font at ${a}`);return await o.arrayBuffer()}(i.url),r=i.url,s=i.url.startsWith("/")):i.data&&(n=i.data.buffer.slice(i.data.byteOffset,i.data.byteOffset+i.data.byteLength)),n){if(!Kj)return{font:void 0,url:r,intercepted:s,arr:n,bidi:null};{let a=await wtt.parse(n);if(a)return{font:a.font,url:r,intercepted:s,arr:n,bidi:a.bidi}}}}(t);e&&(this._arrayBuffer=e.arr,this._url=e.url,this.font=e.font,this._intercepted=e.intercepted,this._isLoaded=!0,this._bidi=e.bidi)}catch(e){console.warn(`Could not load the font "${t.url??"(inline data)"}"`,e)}}warnLayoutError(t){this._layoutErrorWarned||(this._layoutErrorWarned=!0,console.warn(`Text layout failed for the font "${this._url??"(inline data)"}"`,t))}get url(){return this._url}get intercepted(){return this._intercepted}get isLoaded(){return this._isLoaded}get loadingPromise(){return this._loadingPromise}reverseLigaturesTable(t,e,i){if(!this._bidi)return[];let n=this._bidi;n.getTextGlyphs(e);let r=n.tokenizer.tokens,s=[],a=0,o=i.length===r.length;for(let l=0;l<i.length;l++){let c=i[l].index,h=String.fromCharCode(i[l].unicode),d=r[a];if(Stt(c,d)||o)s.push({char:h,index:c,replacements:[d.state.glyphIndex],replacementChars:[d.char]}),a++;else{let u=d.char,p="",f=[d.state.glyphIndex],g=[],m=!1;for(;!m;)a++,p=e.charAt(a),u+=p,f.push(t.charToGlyphIndex(p)),g=t.stringToGlyphs(u),g.length===1&&g[0].index===c&&(m=!0),a>e.length&&(m=!0);s.push({char:h,index:c,replacements:f,replacementChars:Array.from(u)}),a++}}return s}generateShapes(t,e,i){if(!this._isLoaded)return;let n=this.font,r=e.fontSize/this.unitsPerEm,s=e.fontSize*e.lineHeight,a=t.map(v=>this.getTextWidth(v,e)),o=typeof e.width=="string"?Number(i.getVariable(e.width)):e.width,l=typeof e.height=="string"?Number(i.getVariable(e.height)):e.height,c=this.getCharWidth(`
9860
9860
  `,e),h=e.horizontalAlign===1?c:0,d=this.getLineInitialOffsetX(a[0],o,e.horizontalAlign,t[0],c),u=this.getLineInitialOffsetY(s,t.length,l,r,e.verticalAlign),p=[],f=t.map(()=>[]),g=t.map(()=>[]);for(let v=0;v<t.length;v++){let y=t[v],_={features:{liga:!0},letterSpacing:e.letterSpacing},b=[];try{b=n.stringToGlyphs(y,_)}catch(A){this.warnLayoutError(A)}d=this.getLineInitialOffsetX(a[v],o,e.horizontalAlign,y,c);let x=[];try{x=this.reverseLigaturesTable(n,y,b)}catch(A){this.warnLayoutError(A)}let w=this.computeSpaceWidthForLine(t,v,e,i),S=0,E=b[0];E&&e.horizontalAlign===2&&E.leftSideBearing!==void 0&&(d-=E.leftSideBearing*r);try{this.font?.forEachGlyph(y,d,u,e.fontSize,_,(A,P,C,R,L)=>{let D=A.index===0?`
9861
9861
  `:A.unicode?String.fromCharCode(A.unicode):void 0,F=x[S],V=0;if(D===`
9862
9862
  `)V=h;else if(D===" ")V=w;else{let U=this.createPath(A,r,P,C,e);U&&(V=U.offsetX,p.push(U.path))}if(F&&F.replacements.length!==1){let U=F.replacements.map(nt=>(n.glyphs.get(nt).advanceWidth??0)*r),j=U.reduce((nt,Y)=>nt+Y,0),W=U.map(nt=>nt/j),it=P;for(let nt=0;nt<W.length;nt++){let Y=V*W[nt];g[v].push([it,C]),f[v].push(Y),it+=Y}}else g[v].push([P,C]),f[v].push(V);S++})}catch(A){this.warnLayoutError(A)}u-=s}let m=[];for(let v=0,y=p.length;v<y;v++)m.push(...p[v].toShapes());return{shapes:m,charWidths:f,lineWidths:a,charCoords:g}}get isUserFont(){return this._isUserFont}get arrayBuffer(){return this._arrayBuffer}get ascender(){return this.font?.ascender??0}get descender(){return this.font?.descender??0}get familyName(){return this.font?.names.fontFamily??""}get subfamilyName(){return this.font?.names.fontSubfamily??""}get unitsPerEm(){return this.font?.unitsPerEm??1}getLineInitialOffsetX(t,e,i,n,r){return(i===3||i===2)&&n.indexOf(`
9863
- `)>=0&&(t-=r),i===3?.5*e-.5*t:i===2?e-t:0}getLineInitialOffsetY(t,e,i,n,r){let s=e*t,a=t-Math.abs(this.ascender-this.descender)*n,o=-this.ascender*n-a/2;return r===3?-(i-s-o):r===2?-(.5*i-.5*s-o):o}createPath(t,e,i,n,r){let s=t.getPath(i,-n,r.fontSize,{kerning:!1,letterSpacing:r.letterSpacing});if(!s)return void console.error('THREE.Font: character "'+t+'" does not exists in font family '+this.familyName+".");let a=new xtt,o=(t.advanceWidth??1)*e;if(t)for(let l of s.commands){let c=a.currentPath?.currentPoint;if(!c||l.type==="Z"||c.x!==l.x||-c.y!==l.y)switch(l.type){case"M":a.moveTo(l.x,-l.y);break;case"L":a.lineTo(l.x,-l.y);break;case"Q":a.quadraticCurveTo(l.x1,-l.y1,l.x,-l.y);break;case"C":a.bezierCurveTo(l.x1,-l.y1,l.x2,-l.y2,l.x,-l.y)}}return a.subPaths.forEach(l=>{let c=function(h){if(h.length){let d=h[0];if(d instanceof fs)return d.v1;if(d instanceof Fs||d instanceof $o)return d.v0}}(l.curves);c!==void 0&&l.currentPoint.distanceTo(c)>0&&l.lineTo(c.x,c.y)}),{offsetX:o,path:a}}getCharWidth(t,e){try{return this.font?.getAdvanceWidth(t,e.fontSize,{kerning:!0,letterSpacing:e.letterSpacing})??0}catch(i){return this.warnLayoutError(i),0}}getTextWidth(t,e){try{return this.font?.getAdvanceWidth(t,e.fontSize,{kerning:!0,letterSpacing:e.letterSpacing})??0}catch(i){return this.warnLayoutError(i),0}}computeSpaceWidthForLine(t,e,i,n){let r=this.getCharWidth(" ",i),s=t[e];if(s){let a=this.countSpaces(s.trimEnd());if(i.horizontalAlign===4&&e<t.length-1&&a)return((typeof i.width=="string"?Number(n.getVariable(i.width)):i.width)-(this.getTextWidth(s,i)-a*r))/a}return r}countSpaces(t){return(t.match(/ /g)||[]).length}},Si("text"),$t();var Qj=null;function GB(){return Qj}function Mtt(t){let e=!1;return t.scene.objects.forEach(i=>{i.data.type==="Page"&&!e&&i.data.publish.gameControlObject&&$c.traverseModuleInstances(t,i.id,(n,r,s)=>{for(let a of s)a.data.type==="GameControl"&&a.data.navmesh.enabled&&(e=!0)})}),e}ti();var Sy=(t,e)=>{let i=e.x-t.x,n=e.y-t.y;return Math.sqrt(i*i+n*n)},SM=t=>t*(Math.PI/180),My=new Map,Vb=(t,e,i)=>{let n,r=e.split(/[ ,]+/g);for(let s=0;s<r.length;s+=1)n=r[s],t.addEventListener?t.addEventListener(n,i,!1):t.attachEvent&&t.attachEvent(n,i)},jb=(t,e,i)=>{let n,r=e.split(/[ ,]+/g);for(let s=0;s<r.length;s+=1)n=r[s],t.removeEventListener?t.removeEventListener(n,i):t.detachEvent&&t.detachEvent(n,i)},Jj=t=>(t.preventDefault(),t.type.match(/^touch/)?t.changedTouches:t),HB=()=>{if(!(typeof window>"u"))return{x:window.pageXOffset!==void 0?window.pageXOffset:(document.documentElement||document.body.parentNode||document.body).scrollLeft,y:window.pageYOffset!==void 0?window.pageYOffset:(document.documentElement||document.body.parentNode||document.body).scrollTop}},MM=(t,e)=>{e.top||e.right||e.bottom||e.left?(t.style.top=e.top,t.style.right=e.right,t.style.bottom=e.bottom,t.style.left=e.left):(t.style.left=e.x+"px",t.style.top=e.y+"px")},EM=(t,e,i)=>{let n=t9(t);for(let r in n)if(Object.prototype.hasOwnProperty.call(n,r))if(typeof e=="string")n[r]=e+" "+i;else{let s="";for(let a=0,o=e.length;a<o;a+=1)s+=e[a]+" "+i+", ";n[r]=s.slice(0,-2)}return n},t9=t=>{let e={};return e[t]="",["webkit","Moz","o"].forEach(function(i){e[i+t.charAt(0).toUpperCase()+t.slice(1)]=""}),e},AM=(t,e)=>{for(let i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},nC=(t,e)=>{if(t.length)for(let i=0,n=t.length;i<n;i+=1)e(t[i]);else e(t)};typeof window<"u"&&(e9="ontouchstart"in window,i9=!!window.PointerEvent,n9=!!window.MSPointerEvent);var e9,i9,n9,Jd,WB={start:"mousedown",move:"mousemove",end:"mouseup"},om={};function _c(){}i9?Jd={start:"pointerdown",move:"pointermove",end:"pointerup, pointercancel"}:n9?Jd={start:"MSPointerDown",move:"MSPointerMove",end:"MSPointerUp"}:e9?(Jd={start:"touchstart",move:"touchmove",end:"touchend, touchcancel"},om=WB):Jd=WB,_c.prototype.on=function(t,e){var i,n=this,r=t.split(/[ ,]+/g);n._handlers_=n._handlers_||{};for(var s=0;s<r.length;s+=1)i=r[s],n._handlers_[i]=n._handlers_[i]||[],n._handlers_[i].push(e);return n},_c.prototype.off=function(t,e){var i=this;return i._handlers_=i._handlers_||{},t===void 0?i._handlers_={}:e===void 0?i._handlers_[t]=null:i._handlers_[t]&&i._handlers_[t].indexOf(e)>=0&&i._handlers_[t].splice(i._handlers_[t].indexOf(e),1),i},_c.prototype.trigger=function(t,e){var i,n=this,r=t.split(/[ ,]+/g);n._handlers_=n._handlers_||{};for(var s=0;s<r.length;s+=1)i=r[s],n._handlers_[i]&&n._handlers_[i].length&&n._handlers_[i].forEach(function(a){a.call(n,{type:i,target:n},e)})},_c.prototype.config=function(t){var e=this;e.options=e.defaults||{},t&&(e.options=((i,n)=>{let r={};for(let s in i)Object.prototype.hasOwnProperty.call(i,s)&&Object.prototype.hasOwnProperty.call(n,s)?r[s]=n[s]:Object.prototype.hasOwnProperty.call(i,s)&&(r[s]=i[s]);return r})(e.options,t))},_c.prototype.bindEvt=function(t,e){var i=this;return i._domHandlers_=i._domHandlers_||{},i._domHandlers_[e]=function(){typeof i["on"+e]=="function"?i["on"+e].apply(i,arguments):console.warn('[WARNING] : Missing "on'+e+'" handler.')},Vb(t,Jd[e],i._domHandlers_[e]),om[e]&&Vb(t,om[e],i._domHandlers_[e]),i},_c.prototype.unbindEvt=function(t,e){var i=this;return i._domHandlers_=i._domHandlers_||{},jb(t,Jd[e],i._domHandlers_[e]),om[e]&&jb(t,om[e],i._domHandlers_[e]),delete i._domHandlers_[e],this};var fP=_c;function Nn(t,e){return this.identifier=e.identifier,this.position=e.position,this.frontPosition=e.frontPosition,this.collection=t,this.defaults={size:100,threshold:.1,color:"white",fadeTime:250,dataOnly:!1,restJoystick:!0,restOpacity:1,mode:"dynamic",zone:document.body,lockX:!1,lockY:!1,shape:"circle"},this.config(e),this.options.mode==="dynamic"&&(this.options.restOpacity=0),this.id=Nn.id,Nn.id+=1,this.buildEl().stylize(),this.instance={el:this.ui.el,on:this.on.bind(this),off:this.off.bind(this),show:this.show.bind(this),hide:this.hide.bind(this),add:this.addToDom.bind(this),remove:this.removeFromDom.bind(this),destroy:this.destroy.bind(this),setPosition:this.setPosition.bind(this),resetDirection:this.resetDirection.bind(this),computeDirection:this.computeDirection.bind(this),trigger:this.trigger.bind(this),position:this.position,frontPosition:this.frontPosition,ui:this.ui,identifier:this.identifier,id:this.id,options:this.options},this.instance}Nn.prototype=new fP,Nn.constructor=Nn,Nn.id=0,Nn.prototype.buildEl=function(t){return this.ui={},this.options.dataOnly||(this.ui.el=document.createElement("div"),this.ui.back=document.createElement("div"),this.ui.front=document.createElement("div"),this.ui.el.className="nipple collection_"+this.collection.id,this.ui.back.className="back",this.ui.front.className="front",this.ui.el.setAttribute("id","nipple_"+this.collection.id+"_"+this.id),this.ui.el.appendChild(this.ui.back),this.ui.el.appendChild(this.ui.front)),this},Nn.prototype.stylize=function(){if(this.options.dataOnly)return this;var t=this.options.fadeTime+"ms",e=(()=>{let r=t9("borderRadius");for(let s in r)Object.prototype.hasOwnProperty.call(r,s)&&(r[s]="50%");return r})(),i=EM("transition","opacity",t),n={};return n.el={position:"absolute",opacity:this.options.restOpacity,display:"block",zIndex:999},n.back={position:"absolute",display:"block",width:this.options.size+"px",height:this.options.size+"px",marginLeft:-this.options.size/2+"px",marginTop:-this.options.size/2+"px",background:"rgba(255, 255, 255, .4)",border:"solid 2px rgba(0, 0, 0, .1)"},n.front={width:this.options.size/2+"px",height:this.options.size/2+"px",position:"absolute",display:"block",marginLeft:-this.options.size/4+"px",marginTop:-this.options.size/4+"px",background:"rgba(255, 255, 255, .8)",border:"solid 2px rgba(0, 0, 0, .1)"},AM(n.el,i),this.options.shape==="circle"&&AM(n.back,e),AM(n.front,e),this.applyStyles(n),this},Nn.prototype.applyStyles=function(t){for(var e in this.ui)if(Object.prototype.hasOwnProperty.call(this.ui,e))for(var i in t[e])this.ui[e].style[i]=t[e][i];return this},Nn.prototype.addToDom=function(){return this.options.dataOnly||document.body.contains(this.ui.el)||this.options.zone.appendChild(this.ui.el),this},Nn.prototype.removeFromDom=function(){return this.options.dataOnly||!document.body.contains(this.ui.el)||this.options.zone.removeChild(this.ui.el),this},Nn.prototype.destroy=function(){clearTimeout(this.removeTimeout),clearTimeout(this.showTimeout),clearTimeout(this.restTimeout),this.trigger("destroyed",this.instance),this.removeFromDom(),this.off(),this.ui=null,this.instance=null,this.collection=null,this.options=null},Nn.prototype.show=function(t){var e=this;return e.options.dataOnly||(clearTimeout(e.removeTimeout),clearTimeout(e.showTimeout),clearTimeout(e.restTimeout),e.addToDom(),e.restCallback(),setTimeout(function(){e.ui.el.style.opacity=1},0),e.showTimeout=setTimeout(function(){e.trigger("shown",e.instance),typeof t=="function"&&t.call(this)},e.options.fadeTime)),e},Nn.prototype.hide=function(t){var e=this;if(e.options.dataOnly)return e;if(e.ui.el.style.opacity=e.options.restOpacity,clearTimeout(e.removeTimeout),clearTimeout(e.showTimeout),clearTimeout(e.restTimeout),e.removeTimeout=setTimeout(function(){var i=e.options.mode==="dynamic"?"none":"block";e.ui.el.style.display=i,typeof t=="function"&&t.call(e),e.trigger("hidden",e.instance)},e.options.fadeTime),e.options.restJoystick){let i=e.options.restJoystick,n={};n.x=i===!0||i.x!==!1?0:e.instance.frontPosition.x,n.y=i===!0||i.y!==!1?0:e.instance.frontPosition.y,e.setPosition(t,n)}return e},Nn.prototype.setPosition=function(t,e){var i=this;i.frontPosition={x:e.x,y:e.y};var n=i.options.fadeTime+"ms",r={};r.front=EM("transition",["top","left"],n);var s={front:{}};s.front={left:i.frontPosition.x+"px",top:i.frontPosition.y+"px"},i.applyStyles(r),i.applyStyles(s),i.restTimeout=setTimeout(function(){typeof t=="function"&&t.call(i),i.restCallback()},i.options.fadeTime)},Nn.prototype.restCallback=function(){var t=this,e={};e.front=EM("transition","none",""),t.applyStyles(e),t.trigger("rested",t.instance)},Nn.prototype.resetDirection=function(){this.direction={x:!1,y:!1,angle:!1}},Nn.prototype.computeDirection=function(t){var e,i,n,r=t.angle.radian,s=Math.PI/4,a=Math.PI/2;if(r>s&&r<3*s&&!t.lockX?e="up":r>-s&&r<=s&&!t.lockY?e="left":r>3*-s&&r<=-s&&!t.lockX?e="down":t.lockY||(e="right"),t.lockY||(i=r>-a&&r<a?"left":"right"),t.lockX||(n=r>0?"up":"down"),t.force>this.options.threshold){var o,l={};for(o in this.direction)Object.prototype.hasOwnProperty.call(this.direction,o)&&(l[o]=this.direction[o]);var c={};for(o in this.direction={x:i,y:n,angle:e},t.direction=this.direction,l)l[o]===this.direction[o]&&(c[o]=!0);if(c.x&&c.y&&c.angle)return t;(!c.x||!c.y)&&this.trigger("plain",t),c.x||this.trigger("plain:"+i,t),c.y||this.trigger("plain:"+n,t),c.angle||this.trigger("dir dir:"+e,t)}else this.resetDirection();return t};var Ett=Nn;function dn(t,e){var i=this;i.nipples=[],i.idles=[],i.actives=[],i.ids=[],i.pressureIntervals={},i.manager=t,i.id=dn.id,dn.id+=1,i.defaults={zone:document.body,multitouch:!1,maxNumberOfNipples:10,mode:"dynamic",position:{top:0,left:0},catchDistance:200,size:100,threshold:.1,color:"white",fadeTime:250,dataOnly:!1,restJoystick:!0,restOpacity:1,lockX:!1,lockY:!1,shape:"circle",dynamicPage:!1,follow:!1},i.config(e),(i.options.mode==="static"||i.options.mode==="semi")&&(i.options.multitouch=!1),i.options.multitouch||(i.options.maxNumberOfNipples=1);let n=getComputedStyle(i.options.zone.parentElement);return n&&n.display==="flex"&&(i.parentIsFlex=!0),i.updateBox(),i.prepareNipples(),i.bindings(),i.begin(),i.nipples}dn.prototype=new fP,dn.constructor=dn,dn.id=0,dn.prototype.prepareNipples=function(){var t=this,e=t.nipples;e.on=t.on.bind(t),e.off=t.off.bind(t),e.options=t.options,e.destroy=t.destroy.bind(t),e.ids=t.ids,e.id=t.id,e.processOnMove=t.processOnMove.bind(t),e.processOnEnd=t.processOnEnd.bind(t),e.get=function(i){if(i===void 0)return e[0];for(var n=0,r=e.length;n<r;n+=1)if(e[n].identifier===i)return e[n];return!1}},dn.prototype.bindings=function(){var t=this;t.bindEvt(t.options.zone,"start"),t.options.zone.style.touchAction="none",t.options.zone.style.msTouchAction="none"},dn.prototype.begin=function(){var t=this,e=t.options;if(e.mode==="static"){var i=t.createNipple(e.position,t.manager.getIdentifier());i.add(),t.idles.push(i)}},dn.prototype.createNipple=function(t,e){var i=this,n=i.manager.scroll,r={},s=i.options,a=i.parentIsFlex?n.x:n.x+i.box.left,o=i.parentIsFlex?n.y:n.y+i.box.top;if(t.x&&t.y)r={x:t.x-a,y:t.y-o};else if(t.top||t.right||t.bottom||t.left){var l=document.createElement("DIV");l.style.display="hidden",l.style.top=t.top,l.style.right=t.right,l.style.bottom=t.bottom,l.style.left=t.left,l.style.position="absolute",s.zone.appendChild(l);var c=l.getBoundingClientRect();s.zone.removeChild(l),r=t,t={x:c.left+n.x,y:c.top+n.y}}var h=new Ett(i,{color:s.color,size:s.size,threshold:s.threshold,fadeTime:s.fadeTime,dataOnly:s.dataOnly,restJoystick:s.restJoystick,restOpacity:s.restOpacity,mode:s.mode,identifier:e,position:t,zone:s.zone,frontPosition:{x:0,y:0},shape:s.shape});return s.dataOnly||(MM(h.ui.el,r),MM(h.ui.front,h.frontPosition)),i.nipples.push(h),i.trigger("added "+h.identifier+":added",h),i.manager.trigger("added "+h.identifier+":added",h),i.bindNipple(h),h},dn.prototype.updateBox=function(){this.box=this.options.zone.getBoundingClientRect()},dn.prototype.bindNipple=function(t){var e,i=this,n=function(r,s){e=r.type+" "+s.id+":"+r.type,i.trigger(e,s)};t.on("destroyed",i.onDestroyed.bind(i)),t.on("shown hidden rested dir plain",n),t.on("dir:up dir:right dir:down dir:left",n),t.on("plain:up plain:right plain:down plain:left",n)},dn.prototype.pressureFn=function(t,e,i){var n=this,r=0;clearInterval(n.pressureIntervals[i]),n.pressureIntervals[i]=setInterval(function(){var s=t.force||t.pressure||t.webkitForce||0;s!==r&&(e.trigger("pressure",s),n.trigger("pressure "+e.identifier+":pressure",s),r=s)}.bind(n),100)},dn.prototype.onstart=function(t){var e=this,i=e.options,n=t;return t=Jj(t),e.updateBox(),nC(t,function(r){e.actives.length<i.maxNumberOfNipples?e.processOnStart(r):n.type.match(/^touch/)&&(Object.keys(e.manager.ids).forEach(function(s){if(Object.values(n.touches).findIndex(function(o){return o.identifier===s})<0){var a=[t[0]];a.identifier=s,e.processOnEnd(a)}}),e.actives.length<i.maxNumberOfNipples&&e.processOnStart(r))}),e.manager.bindDocument(),!1},dn.prototype.processOnStart=function(t){var e,i=this,n=i.options,r=i.manager.getIdentifier(t),s=t.force||t.pressure||t.webkitForce||0,a={x:t.pageX,y:t.pageY},o=i.getOrCreate(r,a);o.identifier!==r&&i.manager.removeIdentifier(o.identifier),o.identifier=r;var l=function(c){c.trigger("start",c),i.trigger("start "+c.id+":start",c),c.show(),s>0&&i.pressureFn(t,c,c.identifier),i.processOnMove(t)};if((e=i.idles.indexOf(o))>=0&&i.idles.splice(e,1),i.actives.push(o),i.ids.push(o.identifier),n.mode!=="semi")l(o);else{if(!(Sy(a,o.position)<=n.catchDistance))return o.destroy(),void i.processOnStart(t);l(o)}return o},dn.prototype.getOrCreate=function(t,e){var i,n=this,r=n.options;return/(semi|static)/.test(r.mode)?(i=n.idles[0])?(n.idles.splice(0,1),i):r.mode==="semi"?n.createNipple(e,t):(console.warn("Coudln't find the needed nipple."),!1):i=n.createNipple(e,t)},dn.prototype.processOnMove=function(t){var e=this,i=e.options,n=e.manager.getIdentifier(t),r=e.nipples.get(n),s=e.manager.scroll;if((_=>isNaN(_.buttons)?_.pressure!==0:_.buttons!==0)(t)){if(!r)return console.error("Found zombie joystick with ID "+n),void e.manager.removeIdentifier(n);if(i.dynamicPage){var a=r.el.getBoundingClientRect();r.position={x:s.x+a.left,y:s.y+a.top}}r.identifier=n;var o=r.options.size/2,l={x:t.pageX,y:t.pageY};i.lockX&&(l.y=r.position.y),i.lockY&&(l.x=r.position.x);var c,h,d=Sy(l,r.position),u=((_,b)=>{let x=b.x-_.x,w=b.y-_.y;return(S=>S*(180/Math.PI))(Math.atan2(w,x))})(l,r.position),p=SM(u),f=d/o,g={distance:d,position:l};if(r.options.shape==="circle"?(c=Math.min(d,o),h=((_,b,x)=>{let w={x:0,y:0};return x=SM(x),w.x=_.x-b*Math.cos(x),w.y=_.y-b*Math.sin(x),w})(r.position,c,u)):(h=((_,b,x)=>({x:Math.min(Math.max(_.x,b.x-x),b.x+x),y:Math.min(Math.max(_.y,b.y-x),b.y+x)}))(l,r.position,o),c=Sy(h,r.position)),i.follow){if(d>o){let _=l.x-h.x,b=l.y-h.y;r.position.x+=_,r.position.y+=b,r.el.style.top=r.position.y-(e.box.top+s.y)+"px",r.el.style.left=r.position.x-(e.box.left+s.x)+"px",d=Sy(l,r.position)}}else l=h,d=c;var m=l.x-r.position.x,v=l.y-r.position.y;r.frontPosition={x:m,y:v},i.dataOnly||MM(r.ui.front,r.frontPosition);var y={identifier:r.identifier,position:l,force:f,pressure:t.force||t.pressure||t.webkitForce||0,distance:d,angle:{radian:p,degree:u},vector:{x:m/o,y:-v/o},raw:g,instance:r,lockX:i.lockX,lockY:i.lockY};(y=r.computeDirection(y)).angle={radian:SM(180-u),degree:180-u},r.trigger("move",y),e.trigger("move "+r.id+":move",y)}else this.processOnEnd(t)},dn.prototype.processOnEnd=function(t){var e=this,i=e.options,n=e.manager.getIdentifier(t),r=e.nipples.get(n),s=e.manager.removeIdentifier(r.identifier);!r||(i.dataOnly||r.hide(function(){i.mode==="dynamic"&&(r.trigger("removed",r),e.trigger("removed "+r.id+":removed",r),e.manager.trigger("removed "+r.id+":removed",r),r.destroy())}),clearInterval(e.pressureIntervals[r.identifier]),r.resetDirection(),r.trigger("end",r),e.trigger("end "+r.id+":end",r),e.ids.indexOf(r.identifier)>=0&&e.ids.splice(e.ids.indexOf(r.identifier),1),e.actives.indexOf(r)>=0&&e.actives.splice(e.actives.indexOf(r),1),/(semi|static)/.test(i.mode)?e.idles.push(r):e.nipples.indexOf(r)>=0&&e.nipples.splice(e.nipples.indexOf(r),1),e.manager.unbindDocument(),/(semi|static)/.test(i.mode)&&(e.manager.ids[s.id]=s.identifier))},dn.prototype.onDestroyed=function(t,e){var i=this;i.nipples.indexOf(e)>=0&&i.nipples.splice(i.nipples.indexOf(e),1),i.actives.indexOf(e)>=0&&i.actives.splice(i.actives.indexOf(e),1),i.idles.indexOf(e)>=0&&i.idles.splice(i.idles.indexOf(e),1),i.ids.indexOf(e.identifier)>=0&&i.ids.splice(i.ids.indexOf(e.identifier),1),i.manager.removeIdentifier(e.identifier),i.manager.unbindDocument()},dn.prototype.destroy=function(){var t=this;for(var e in t.unbindEvt(t.options.zone,"start"),t.nipples.forEach(function(i){i.destroy()}),t.pressureIntervals)Object.prototype.hasOwnProperty.call(t.pressureIntervals,e)&&clearInterval(t.pressureIntervals[e]);t.trigger("destroyed",t.nipples),t.manager.unbindDocument(),t.off(),t.pressureIntervals={},t.nipples=[],t.idles=[],t.actives=[],t.ids=[],t.manager=null};var Att=dn;function En(t){var e=this;e.ids={},e.index=0,e.collections=[],e.scroll=HB(),e._windowBound=!1,e.config(t),e.prepareCollections();var i=function(){var n;e.collections.forEach(function(r){r.forEach(function(s){n=s.el.getBoundingClientRect(),s.position={x:e.scroll.x+n.left,y:e.scroll.y+n.top}})})};return e._onResize=function(){(n=>{My.has(n)&&clearTimeout(My.get(n)),My.set(n,setTimeout(function(){My.delete(n),n()},100))})(i)},e._onScroll=function(){e.scroll=HB()},e.collections}En.prototype=new fP,En.constructor=En,En.prototype.prepareCollections=function(){var t=this;t.collections.create=t.create.bind(t),t.collections.on=t.on.bind(t),t.collections.off=t.off.bind(t),t.collections.destroy=t.destroy.bind(t),t.collections.get=function(e){var i;return t.collections.every(function(n){return!(i=n.get(e))}),i}},En.prototype.create=function(t){return this.createCollection(t)},En.prototype.bindWindowEvents=function(){var t=this;t._windowBound||typeof window>"u"||(t._windowBound=!0,Vb(window,"resize",t._onResize),Vb(window,"scroll",t._onScroll))},En.prototype.unbindWindowEvents=function(){var t=this;!t._windowBound||typeof window>"u"||(t._windowBound=!1,jb(window,"resize",t._onResize),jb(window,"scroll",t._onScroll))},En.prototype.createCollection=function(t){var e=this,i=new Att(e,t);return e.bindCollection(i),e.collections.push(i),e.bindWindowEvents(),i},En.prototype.bindCollection=function(t){var e,i=this,n=function(r,s){e=r.type+" "+s.id+":"+r.type,i.trigger(e,s)};t.on("destroyed",i.onDestroyed.bind(i)),t.on("shown hidden rested dir plain",n),t.on("dir:up dir:right dir:down dir:left",n),t.on("plain:up plain:right plain:down plain:left",n)},En.prototype.bindDocument=function(){var t=this;t.binded||(t.bindEvt(document,"move").bindEvt(document,"end"),t.binded=!0)},En.prototype.unbindDocument=function(t){var e=this;(!Object.keys(e.ids).length||t===!0)&&(e.unbindEvt(document,"move").unbindEvt(document,"end"),e.binded=!1)},En.prototype.getIdentifier=function(t){var e;return t?(e=t.identifier===void 0?t.pointerId:t.identifier)===void 0&&(e=this.latest||0):e=this.index,this.ids[e]===void 0&&(this.ids[e]=this.index,this.index+=1),this.latest=e,this.ids[e]},En.prototype.removeIdentifier=function(t){var e={};for(var i in this.ids)if(this.ids[i]===t){e.id=i,e.identifier=this.ids[i],delete this.ids[i];break}return e},En.prototype.onmove=function(t){return this.onAny("move",t),!1},En.prototype.onend=function(t){return this.onAny("end",t),!1},En.prototype.oncancel=function(t){return this.onAny("end",t),!1},En.prototype.onAny=function(t,e){var i,n=this,r="processOn"+t.charAt(0).toUpperCase()+t.slice(1);e=Jj(e);var s=function(a,o,l){l.ids.indexOf(o)>=0&&(l[r](a),a._found_=!0)};return nC(e,function(a){i=n.getIdentifier(a),nC(n.collections,s.bind(null,a,i)),a._found_||n.removeIdentifier(i)}),!1},En.prototype.destroy=function(){var t=this;t.unbindDocument(!0),t.unbindWindowEvents(),t.ids={},t.index=0,t.collections.forEach(function(e){e.destroy()}),t.collections=[],t.off()},En.prototype.onDestroyed=function(t,e){var i=this;if(i.collections.indexOf(e)<0)return!1;i.collections.splice(i.collections.indexOf(e),1),i.collections.length===0&&i.unbindWindowEvents()};var Ttt=En,op=null;function qB(){return op||(op=new Ttt),op}var Ctt={create:function(t){return qB().create(t)},destroy:function(){op&&(op.destroy(),op=null)},get factory(){return qB()}},Ptt=Ctt;ti(),$t(),tt(),Ws(),qr(),$t();var r9=null;function TM(){return r9}var s9,CM,Dtt=new Promise(t=>{s9=t});function Rtt(t){return CM||(CM=async function(){let e=t??"https://cdn.spline.design/@splinetool/runtime@2.0.77/build",i=import("./physics.js"),[n,r]=await Promise.all([i,fetch(`${e}/physics.wasm`).then(s=>s.arrayBuffer())]);await n.init(r),s9(n)}(),CM)}function a9(t){let e=t.elements,i=e[0]**2+e[1]**2+e[2]**2,n=e[4]**2+e[5]**2+e[6]**2,r=e[8]**2+e[9]**2+e[10]**2,s=e[0]**2+e[4]**2+e[8]**2,a=e[1]**2+e[5]**2+e[9]**2,o=e[2]**2+e[6]**2+e[10]**2,l=1e-8;return i<l||n<l||r<l||s<l||a<l||o<l}function qo(t,e){let i=new jt;if(e&&a9(e))return i.setAttribute("position",new Nt([],3)),i.setIndex([]),i;if(!t.getAttribute("position"))return i.setAttribute("position",new Nt([],3)),i.setIndex([]),i;let{positions:n,triIndices:r}=D3(t.getAttribute("position"),t.getIndex());return i.setAttribute("position",new Nt(n,3)),i.setIndex(r),e&&i.applyMatrix4(e),i}Bi(),qr(),ke(),j3(),tt(),tt(),Tp(),s0();var Ge,Itt=class{constructor(t,e,i,n,r,s){this.id=t,this.data=e,this.object=i,this.initialDisabled=!1,this.actions=Rn(e,e.actions,n,r,s,i),this.target=e.target}disconnect(){rr(this.actions)}dispatch(t){this.initialDisabled||(this.actions.Transition.forEach(e=>{e.object.currentTransitionEvent!==this&&(e.object.currentTransitionEvent=this,e.init())}),this.object.dispatchEvent({type:"beginEvent",eventName:"Collision"}),this.actions.Transition.forEach(e=>e.play()),this.actions.Animation.forEach(e=>{"runMode"in e.data&&e.data.runMode==="Toggle"?e.toggle():e.play()}),this.actions.TimelineAnimation.forEach(e=>{"runMode"in e.data&&e.data.runMode==="Toggle"?e.toggle():e.play()}),this.actions.Reset.forEach(e=>{e.dispatch()}),this.actions.Link.forEach(e=>{e.dispatch()}),this.actions.Reset.forEach(e=>{e.dispatch()}),this.actions.Create.forEach(e=>{e.dispatch()}),this.actions.Destroy.forEach(e=>{e.dispatch(t??!1)}),this.actions.SetVariable.forEach(e=>e.checkConditions()),this.actions.SetVariable.forEach(e=>e.dispatch()),this.actions.DynamicVariablePlay.forEach(e=>e.dispatch()),this.actions.Audio.forEach(e=>{e.dispatchBasic()}),this.actions.Particles.forEach(e=>{e.dispatchBasic()}),this.actions.Video.forEach(e=>{e.dispatchBasic()}),this.actions.ClearLocalStorage.forEach(e=>e.dispatch()),this.actions.UserAPI.forEach(e=>e.dispatch()))}},XB=class{constructor(t,e,i,n,r,s){this.id=t,this.data=e,this.object=i,this.page=n,this.currentIntersectedObjects=[],this.actions=Rn(e,e.actions,n,r,s,i),this.target=e.target,this.triggeringObjects=[];for(let a of e.triggeringObjects){let o=n.scene.find(a);o&&this.triggeringObjects.push(o)}}isValidTriggeringObject(t){return this.target==="all"||this.triggeringObjects.some(e=>e===t||e.isAncestorOf(t.uuid)||t.isAncestorOf(e.uuid))}disconnect(){rr(this.actions)}dispatch(){this.object.destroyedInAction||(this.actions.Transition.forEach(t=>{t.object.currentTransitionEvent!==this&&(t.object.currentTransitionEvent=this,t.init())}),this.object.dispatchEvent({type:"beginEvent",eventName:"Trigger"}),this.actions.Transition.forEach(t=>t.play()),this.actions.SwitchCamera.forEach(t=>{t.data.runMode==="Toggle"?t.toggle():t.play()}),this.actions.TimelineAnimation.forEach(t=>{"runMode"in t.data&&t.data.runMode==="Toggle"?t.toggle():t.play()}),this.actions.Link.forEach(t=>{t.dispatch()}),this.actions.Reset.forEach(t=>{t.dispatch()}),this.actions.Create.forEach(t=>{t.dispatch()}),this.actions.Destroy.forEach(t=>{t.dispatch(!1)}),this.actions.Audio.forEach(t=>{t.dispatchBasic()}),this.actions.Particles.forEach(t=>{t.dispatchBasic()}),this.actions.Video.forEach(t=>{t.dispatchBasic()}),this.actions.SceneTransition.forEach(t=>{t.dispatch()}),this.actions.SetVariable.forEach(t=>t.checkConditions()),this.actions.SetVariable.forEach(t=>t.dispatch()),this.actions.DynamicVariablePlay.forEach(t=>t.dispatch()),this.actions.ClearLocalStorage.forEach(t=>t.dispatch()),this.actions.UserAPI.forEach(t=>t.dispatch()))}};Bi(),Dtt.then(t=>Ge=t);var Mn=new T,Os=new Wt,Ll=new T,$B=(new xi(0,0,0,"YXZ"),new xi(0,0,0,"XYZ")),na=new T,PM=new T,DM=new T(1,1,1),tu=new Wt,Ey=new At,YB=new At,Ott={type:"updateMatrix"},ZB=new Wt,RM=new yr,IM=.01,rC={type:"beginEvent",eventName:"Collision"},Ltt={type:"beginEvent",eventName:"Trigger"},Gb=t=>t.states.some(e=>e.data.position!==void 0||e.data.rotation!==void 0||e.data.hiddenMatrix!==void 0||e.data.cloner!==void 0||e.data.pathSnapping!==void 0);function eu(t){return function(e){return typeof e=="object"&&e!==null&&"booleanOp"in e}(Cc(t)?t.object:t)}var Btt=class{constructor(t){this.eventContext=t,this.isEnabled=!1,this.gameControl=null,this.joysticks=[],this.joystickToGameControls=[],this.sharedGameControlGlobals={entitiesWithTransformAnim:[],entityToCollisionEvents:{},colliderToEntity:new Map,kinematicBodyToEntity:new Map,triggers:[],gamePads:[],createdObjects:[],nCreatedPerAction:{}},this.sensorToTriggerEvent={},this.eventManager=void 0,this.needsCollisionDetection=!1,this.initializationCounter=-1,this.fixedBodiesToWatch=[],this.rigidBodyToMesh=new Map,this.nActiveRigidBodies=0,this.collisionEvents=[],this.isExport=!1,this.skipRender=!0,this._staticBVHAttrIds=new WeakMap,this._staticBVHNextAttrId=1,this.processRigidBody=e=>{if(e.bodyType()!==Ge.RigidBodyType.Dynamic)return;e.isSleeping()||this.nActiveRigidBodies++;let[i,n,r]=this.rigidBodyToMesh.get(e.handle);if(Mn.copy(e.translation()).multiplyScalar(this.pixelsPerMeter),Os.copy(e.rotation()),i.matrixWorld.compose(Mn,Os,n),i.hasNonUniformScale&&i.matrixWorld.multiply(i.shearScale),i.dispatchEvent(Ott),r){let s=i.cloner;if(s&&s.objectForSample===void 0){s.matrixWorld.copy(i.matrixWorld);for(let a of s.children)a.updateMatrixWorld(!0)}for(let a of i.children)a.updateMatrixWorld(!0)}},this.accumulator=0,this.handleCollisionEvents=(e,i,n)=>{if(n===!1)return;let r,s;if(this.sensorToTriggerEvent[e]?(r=this.sensorToTriggerEvent[e],s=this.sharedGameControlGlobals.colliderToEntity.get(i)):this.sensorToTriggerEvent[i]&&(r=this.sensorToTriggerEvent[i],s=this.sharedGameControlGlobals.colliderToEntity.get(e)),r&&s&&r.isValidTriggeringObject(s))r.dispatch();else{for(let a=this.sharedGameControlGlobals.createdObjects.length-1;a>=0;a--){let o=this.sharedGameControlGlobals.createdObjects[a];if(o.userData.hasCollisionDestroy&&(o.rigidBody?.collider(0).handle===e||o.rigidBody?.collider(0).handle===i)){this.sharedGameControlGlobals.createdObjects.splice(a,1),o.removeFromParent();let l=o.rigidBody;requestAnimationFrame(()=>{o.rigidBody===l&&(this.sharedGameControlGlobals.rapierWorld?.removeRigidBody(l),o.rigidBody=void 0)});break}}if(this.gameControl?.object!==void 0&&this.gameControl.object===this.sharedGameControlGlobals.colliderToEntity.get(e)){let a=this.sharedGameControlGlobals.colliderToEntity.get(i),o=this.sharedGameControlGlobals.entityToCollisionEvents[a.uuid];if(o===void 0)return;for(let l of o)l.data.target==="character"&&this.dispatchCollisionEvent(l,a,i)}else if(this.gameControl?.object!==void 0&&this.gameControl.object===this.sharedGameControlGlobals.colliderToEntity.get(i)){let a=this.sharedGameControlGlobals.colliderToEntity.get(e),o=this.sharedGameControlGlobals.entityToCollisionEvents[a.uuid];if(o===void 0)return;for(let l of o)l.data.target==="character"&&this.dispatchCollisionEvent(l,a,e)}else{let a=this.sharedGameControlGlobals.colliderToEntity.get(e),o=this.sharedGameControlGlobals.entityToCollisionEvents[a.uuid];if(o!==void 0)for(let h of o)h.data.target==="scene"&&this.dispatchCollisionEvent(h,a,e);let l=this.sharedGameControlGlobals.colliderToEntity.get(i),c=this.sharedGameControlGlobals.entityToCollisionEvents[l?.uuid];if(c!==void 0)for(let h of c)h.data.target==="scene"&&this.dispatchCollisionEvent(h,l,i)}}},this.isExport=t.isExport,this.sharedAssets=t.sharedAssets,this.renderer=t.renderer,this.requestRender=t.requestRender,this.domElement=this.renderer.domElement,this.pixelsPerMeter=200,this.gravity=this.page.data.globalPhysics.gravity}get page(){return this.eventContext.page}markIsDestroyTarget(){this.page.traverseVisibleEntity(t=>{let e=t.dataPatched;for(let i of e.events){if(i.data.disabled===!0)continue;let n=i.data.actions?.find(r=>r.data.type==="Destroy")?.data;if(n)for(let r of n.objects){let s=this.page.scene.find(r);s&&(s.userData.hasDestroy=!0)}}})}markIsDragObject(){this.page.traverseVisibleEntity(t=>{let e=t.dataPatched;for(let i of e.events)if(i.data.disabled!==!0&&i.data.type==="DragDrop")for(let n of i.data.objects){let r=this.page.scene.find(n);r&&(r.userData.hasDrag=!0)}})}_staticBVHIdOf(t){let e=this._staticBVHAttrIds.get(t);return e===void 0&&(e=this._staticBVHNextAttrId++,this._staticBVHAttrIds.set(t,e)),e}initBVH(){if(TM()===null)return void Gn("collision-bvh","trigger/collision detection");let t=[],e=[];if(this.page.traverseChildren(i=>{let n,r=i instanceof np,s=gg(i);if(zu(i)||r||s)return;n=Cc(i)?i.object:i;let a=n.dataPatched;if(a.physics?.enabled==="visibility"?!a.visible:!a.physics?.enabled)return!0;let o=i.geometry,l=n.userData.hasDestroy===!0,c=n.userData.hasDrag===!0;if(Gb(a)||l||c||n.dataPatched.events.some(h=>h.data.disabled!==!0&&(h.data.type==="GameControl"||h.data.type==="Follow")))return i.updateMatrixWorldRigid(),this.addBoundsTree(i),!0;if(o){let h=o.getAttribute("position");if(h!==void 0&&h.count>0){t.push({geometry:o,matrixWorld:i.matrixWorld}),e.push(o.id,this._staticBVHIdOf(h),h.version,o.index!==null?this._staticBVHIdOf(o.index):-1,o.index!==null?o.index.version:-1);for(let d of i.matrixWorld.elements)e.push(d)}}return!!eu(i)||void 0}),t.length>0){let i=this._staticBVHCache;if(i!==void 0&&i.signature.length===e.length&&i.signature.every((s,a)=>s===e[a]))return void(this.sharedGameControlGlobals.staticMeshBVH=i.bvh);let n=Tc(t.map(s=>qo(s.geometry,s.matrixWorld)),!1),r=new(TM())(n);this._staticBVHCache={signature:e,bvh:r},this.sharedGameControlGlobals.staticMeshBVH=r}}addRigidBody(t,e,i){if(a9(t.matrixWorld))return;let n=[],r="geometry"in t?t.geometry:void 0,s=e.dataPatched;if(r?.getAttribute("position")!==void 0&&n.push(qo(r,t.shearScale)),s.physics.fusedBody){let a=this.gatherChildrenGeom(t,n);t.traverseObject(a),t.children.forEach(l=>l.updateMatrixWorld(!0));let o=t.cloner;o&&o.objectForSample===void 0&&s.physics.rigidBody==="dynamic"&&(o.traverseObject(a),o.children.forEach(l=>l.updateMatrixWorld(!0)))}if(n.length>0){let a,o=!1,l=!i.fromCreate&&s.physics.rigidBody==="dynamic"||i.fromCreate&&i.dynamic;l?(a=Ge.RigidBodyDesc.dynamic(),a.setLinearDamping(s.physics.damping).setAngularDamping(s.physics.damping).setAdditionalMass(1e-9).setGravityScale(s.physics.gravityScale).enabledRotations(...s.physics.enabledRotation).enabledTranslations(...s.physics.enabledTranslation)):(i.hasTransformAnim||i.hasFollow||i.hasDrag)&&!i.fromCreate?(a=Ge.RigidBodyDesc.kinematicPositionBased(),o=!0):a=Ge.RigidBodyDesc.fixed();let c=Tc(n);(t.hasNonUniformScale?t.matrixWorldRigid:t.matrixWorld).decompose(Mn,Os,Ll),t.position0=Mn.clone().divideScalar(this.pixelsPerMeter),t.rotation0=Os.clone(),Mn.divideScalar(this.pixelsPerMeter),a.setTranslation(Mn.x,Mn.y,Mn.z).setRotation(Os),r?c?.scale(1/this.pixelsPerMeter,1/this.pixelsPerMeter,1/this.pixelsPerMeter):c?.scale(Ll.x/this.pixelsPerMeter,Ll.y/this.pixelsPerMeter,Ll.z/this.pixelsPerMeter);let h=this.sharedGameControlGlobals.rapierWorld.createRigidBody(a),d=!(s.geometry===void 0||s.geometry.type==="SubdivGeometry"||s.geometry.type==="NonParametricGeometry"||s.geometry.type==="BooleanGeometry"||s.geometry.type==="VectorGeometry"||s.geometry.type==="StarGeometry"||s.geometry.type==="RectangleGeometry"||s.geometry.type==="EllipseGeometry"||s.geometry.type==="TriangleGeometry"||s.geometry.type==="TorusGeometry"||s.geometry.type==="HelixGeometry");try{this.addCollider(h,s.physics,c,e,d)}catch{try{this.addCollider(h,s.physics,c,e,!1)}catch(u){console.error(u)}}if(h.numColliders()===0)return void this.sharedGameControlGlobals.rapierWorld.removeRigidBody(h);l?this.rigidBodyToMesh.set(h.handle,[t,Ll.clone(),s.physics.fusedBody]):o?(this.sharedGameControlGlobals.kinematicBodyToEntity.set(h.handle,t),this.sharedGameControlGlobals.entitiesWithTransformAnim.push(t)):this.fixedBodiesToWatch.push([t,h,(t.hasNonUniformScale?t.matrixWorldRigid:t.matrixWorld).clone()]),t.rigidBody=h}}addBoundsTree(t){let e=[];if(t.geometry?.getAttribute("position")!==void 0&&t.geometry?.getAttribute("position").count>0&&e.push(qo(t.geometry,t.shearScale)),t.traverseObject(this.gatherChildrenGeom(t,e)),t.children.forEach(i=>i.updateMatrixWorld(!0)),e.length>0){let i=Tc(e,!1);t.bvhGeometry=i,i.getAttribute("position").count>0&&(t.bvhGeometry.boundsTree=new(TM())(i),this.sharedGameControlGlobals.entitiesWithTransformAnim.push(t))}}addCollider(t,e,i,n,r=!0){if(i?.getAttribute("position").count===0||i?.getIndex()?.count===0)return;let s;i&&(s=e.colliderType==="trimesh"?Ge.ColliderDesc.trimesh(i.getAttribute("position").array,i.getIndex().array):Ge.ColliderDesc.convexMesh(i.getAttribute("position").array,r?i.getIndex().array:void 0)),s.setFrictionCombineRule(Ge.CoefficientCombineRule.Average).setRestitutionCombineRule(Ge.CoefficientCombineRule.Average).setDensity(e.density).setFriction(e.friction).setRestitution(e.restitution);let a=this.sharedGameControlGlobals.rapierWorld.createCollider(s,t);this.sharedGameControlGlobals.colliderToEntity.set(a.handle,n),this.sharedGameControlGlobals.entityToCollisionEvents[n.uuid]?.some(o=>o.target==="scene")&&a.setActiveEvents(Ge.ActiveEvents.COLLISION_EVENTS)}gatherChildrenGeom(t,e){let i=eu(t);return(n,r)=>{if(r===0)return;if(i&&n.parent===t)return!0;let s;if(zu(n)){if(!n.objectForSample)return n.object.dataPatched.physics.fusedBody===!0&&n.object.dataPatched.physics.rigidBody==="dynamic"||void 0;if(n.objectForSample.dataPatched.physics.fusedBody)return;s=n.object}else if(Cc(n))s=n.object;else if(s=n,s.dataPatched.cloner?.hideBase)return!0;let a=s.dataPatched;if(a.physics.enabled==="visibility"?!a.visible:!a.physics.enabled)return!0;r===1?t.hasNonUniformScale?n.matrixWorld.multiplyMatrices(t.shearScale,n.hiddenMatrix):n.matrixWorld.copy(n.hiddenMatrix):n.matrixWorld.multiplyMatrices(n.parent.matrixWorld,n.hiddenMatrix),n.matrixWorld.multiply(n.matrix);let o=n.geometry;return o?.getAttribute("position")!==void 0&&e.push(qo(o,n.matrixWorld)),!!eu(n)||void 0}}activate(t){if(this.isEnabled)return;this.isEnabled=!0,this.eventManager=t,this.usePhysics=this.page.data.globalPhysics.usePhysics;let e=this.page.playCamera,i=!1;this.page.traverseEntity(a=>{for(let o of a.dataPatched.events)if(o.data.disabled===!1&&o.data.type==="Trigger")return this.needsCollisionDetection=!0,!0});let n=GB();if(n!==null?i=n.setup({manager:this,camera:e,renderer:this.renderer,sharedAssets:this.sharedAssets,eventContext:this.eventContext,isExport:this.isExport})||i:this.page.data.publish.gameControlObject!==null&&Gn("game-controls","the scene's game controls"),i===!1){let{enableRotate:a,enablePan:o,enableZoom:l,autoRotate:c,hoverRotatePanMode:h}=this.eventManager.publish.orbitControls;(a||o||l||c||h!==0)&&(this.orbitControls=new Dj(e,this.renderer.domElement,{isExport:this.isExport,isPlayMode:!0}),this.orbitControls.addEventListener("change",this.requestRender),this.orbitControls.addEventListener("end",this.requestRender),this.orbitControls.addEventListener("start",this.requestRender),this.orbitControls.fromJSON(this.eventManager.publish.orbitControls,this.eventManager.publish.mouseEventTarget),this.orbitControls.useKeyEvents=!1,this.orbitControls.addEventListenersToCamera(),this.orbitControls.connect(),this.orbitControls.update())}let r=this.renderer.domElement.width/this.renderer.getPixelRatio(),s=this.renderer.domElement.height/this.renderer.getPixelRatio();GB()?.createJoysticks(this,r,s),this.markIsDestroyTarget(),this.markIsDragObject(),this.rebuildBVH(),this.initializationCounter++,window.setTimeout(()=>{this.collisionEvents.forEach(a=>a.initialDisabled=!1)},80)}initPhysics(){this.sharedGameControlGlobals.rapierWorld?.free(),this.sharedGameControlGlobals.rapierWorld=new Ge.World(new Ge.Vector3(0,this.gravity,0)),this.events=new Ge.EventQueue(!0);let t=[],e=[];if(this.page.traverseChildren(a=>{let o;if(zu(a)){if(!a.objectForSample)return a.object.dataPatched.physics.fusedBody===!0&&a.object.dataPatched.physics.rigidBody==="dynamic"||void 0;if(a.objectForSample.dataPatched.physics.fusedBody)return;o=a.object}else if(Cc(a))o=a.object;else{if(gg(a)||Yc(a)||a instanceof np)return;if(o=a,o.dataPatched.cloner?.disabled===!1&&o.dataPatched.cloner?.hideBase&&o.dataPatched.physics?.fusedBody!==!0)return!0}let l,c=o.dataPatched;for(let m of c.events)m.data.disabled!==!0&&m.data.type==="GameControl"&&(l=m.data);if(!c.physics||(c.physics.enabled==="visibility"?!c.visible:!c.physics.enabled))return!0;a.updateMatrixWorldRigid();let h=Gb(c),d=!1,u=o.userData.hasDestroy,p=o.userData.hasDrag,f=!1;for(let m of c.events)if(m.data.disabled!==!0){if(m.data.type==="Collision"){d=!0;let v=new Itt(m.id,m.data,o,this.page,this.sharedAssets,this.eventManager);v.initialDisabled=!0,this.collisionEvents.push(v),this.sharedGameControlGlobals.entityToCollisionEvents[o.uuid]&&this.sharedGameControlGlobals.entityToCollisionEvents[o.uuid].every(y=>y.id!==m.id)?this.sharedGameControlGlobals.entityToCollisionEvents[o.uuid].push(v):this.sharedGameControlGlobals.entityToCollisionEvents[o.uuid]=[v]}else if(m.data.type==="Follow"){f=!0;let v=m.data.target;a.traverseVisible(y=>{y.userData.isFollowingObj=v})}}c.physics.rigidBody==="dynamic"&&c.physics.fusedBody===!1&&(a.matrixWorldFusedFalse=a.matrixWorld.clone());let g=a.geometry;if(l!==void 0){let m=Ge.RigidBodyDesc.kinematicPositionBased();(a.hasNonUniformScale?a.matrixWorldRigid:a.matrixWorld).decompose(Mn,Os,Ll),a.position0=Mn.clone().divideScalar(this.pixelsPerMeter),a.rotation0=Os.clone(),Mn.divideScalar(this.pixelsPerMeter),m.setTranslation(Mn.x,Mn.y,Mn.z).setRotation(Os);let v,y=this.sharedGameControlGlobals.rapierWorld.createRigidBody(m);a.rigidBody=y,v=l.collider.type==="sphere"?Ge.ColliderDesc.ball(l.collider.radius/this.pixelsPerMeter):l.collider.type==="capsule"?Ge.ColliderDesc.capsule((l.collider.height/2-l.collider.radius)/this.pixelsPerMeter,l.collider.radius/this.pixelsPerMeter):Ge.ColliderDesc.cuboid(l.collider.width/this.pixelsPerMeter/2,l.collider.height/this.pixelsPerMeter/2,l.collider.depth/this.pixelsPerMeter/2),v.setFrictionCombineRule(Ge.CoefficientCombineRule.Average).setDensity(c.physics.density).setFriction(c.physics.friction).setRestitution(0).setRestitutionCombineRule(Ge.CoefficientCombineRule.Min);let _=this.sharedGameControlGlobals.rapierWorld.createCollider(v,y);this.sharedGameControlGlobals.colliderToEntity.set(_.handle,o),Mn.fromArray(l.collider.position.map(x=>typeof x=="number"?x:0)).multiply(Ll.setFromMatrixScale(o.matrixWorld)).divideScalar(this.pixelsPerMeter),_.setTranslationWrtParent(Mn);let b=new Wt().setFromEuler(new xi().setFromVector3(new T().fromArray(l.collider.rotation.map(x=>typeof x=="number"?x:0))));_.setRotationWrtParent(b),_.setActiveEvents(Ge.ActiveEvents.COLLISION_EVENTS),this.generateSensorColliderDescs(o,!0)}else c.physics.rigidBody==="dynamic"||h||f||u||p||d?(this.addRigidBody(a,o,{hasFollow:f,hasTransformAnim:h,hasDrag:p}),this.generateSensorColliderDescs(o,c.physics.fusedBody)):(g&&t.push(qo(g,a.matrixWorld)),c.physics.fusedBody&&!eu(a)&&a.traverseObject((m,v)=>{if(v===0)return;let y;if(zu(m)){if(!m.objectForSample)return m.object.dataPatched.physics.fusedBody===!0&&m.object.dataPatched.physics.rigidBody==="dynamic"||void 0;if(m.objectForSample.dataPatched.physics.fusedBody)return;y=m.object}else{if(gg(m)||Yc(m)||m instanceof np)return;if(Cc(m))y=m.object;else if(y=m,y.dataPatched.cloner?.hideBase)return!0}let _=y.dataPatched;if(_.physics.enabled==="visibility"?!_.visible:!_.physics.enabled)return!0;let b=m.geometry;return b?.getAttribute("position")!==void 0&&t.push(qo(b,m.matrixWorld)),!!eu(m)||void 0}),this.generateSensorColliderDescs(o,c.physics.fusedBody,e));return!(c.physics?.fusedBody!==!0&&!l&&!eu(a))||void 0}),t.length===0)return;let i=Tc(t),n=i.getIndex().count>0;if(!n&&e.length===0)return;i.scale(1/this.pixelsPerMeter,1/this.pixelsPerMeter,1/this.pixelsPerMeter);let r=Ge.RigidBodyDesc.fixed(),s=this.sharedGameControlGlobals.rapierWorld.createRigidBody(r);if(n){let a=Ge.ColliderDesc.trimesh(i.getAttribute("position").array,i.getIndex().array).setFrictionCombineRule(Ge.CoefficientCombineRule.Multiply).setRestitutionCombineRule(Ge.CoefficientCombineRule.Multiply).setFriction(1).setRestitution(1);this.sharedGameControlGlobals.rapierWorld.createCollider(a,s)}for(let[a,o]of e){let l=this.sharedGameControlGlobals.rapierWorld.createCollider(a,s);this.sensorToTriggerEvent[l.handle]=o}}updatePositions(){return this.nActiveRigidBodies=0,this.sharedGameControlGlobals.rapierWorld.forEachRigidBody(this.processRigidBody),this.nActiveRigidBodies>0}rebuildBVH(){this.usePhysics?this.initPhysics():(this.page.traverseEntity(t=>{for(let e of t.dataPatched.events)if(e.data.type==="Trigger"&&e.data.disabled!==!0){let i=new XB(e.id,e.data,t,this.page,this.sharedAssets,this.eventManager),n=new At().compose(na.fromArray(e.data.position.map(r=>typeof r=="number"?r:0)),tu.setFromEuler($B.fromArray(e.data.rotation.map(r=>typeof r=="number"?r:0))),DM);if(e.data.triggerZone==="box"){let r=new ci;r.min.fromArray(e.data.size.map(s=>typeof s=="number"?s:0)).multiplyScalar(-.5),r.max.fromArray(e.data.size.map(s=>typeof s=="number"?s:0)).multiplyScalar(.5),this.sharedGameControlGlobals.triggers.push([r,n,t,i])}else this.sharedGameControlGlobals.triggers.push([e.data.radius,n,t,i])}}),this.needsCollisionDetection&&this.initBVH())}disconnectEvents(){this.collisionEvents.forEach(t=>t.disconnect()),this.sharedGameControlGlobals.triggers.forEach(t=>t[3].disconnect()),this.sharedGameControlGlobals.triggers.length=0}deactivate(){if(this.isEnabled){this.isEnabled=!1,this.page.traverse(t=>{let e=t;e.matrixWorldFusedFalse&&(e.matrixWorldFusedFalse=void 0),e.rigidBody&&(e.rigidBody=void 0),e.position0&&(e.position0=void 0),e.rotation0&&(e.rotation0=void 0)}),this.sharedGameControlGlobals.rapierWorld?.free(),this.sharedGameControlGlobals.rapierWorld=void 0,this.sharedGameControlGlobals.staticMeshBVH=void 0,this.accumulator=0,this.sharedGameControlGlobals.entitiesWithTransformAnim=[],this.sharedGameControlGlobals.kinematicBodyToEntity.clear(),this.fixedBodiesToWatch=[],this.disconnectEvents(),this.gameControl?.reset(),this.gameControl?.dispose(),this.gameControl=null,this.initializationCounter=-1,this.joysticks.forEach(([t,e])=>{t?.destroy(),e.remove()}),this.joystickToGameControls=[],this.joysticks=[],this.orbitControls&&(this.orbitControls.dispose(),this.orbitControls=void 0),this.navigationMeshWrapper?.dispose(),this.navigationMeshWrapper=void 0;for(let t of Object.values(this.sharedGameControlGlobals.entityToCollisionEvents))t.forEach(e=>e.disconnect());this.sharedGameControlGlobals.entityToCollisionEvents={},this.page.updateMatrixWorld(!0)}}update(t){if(!this.isEnabled)return!0;let e=!0;if(this.orbitControls!==void 0&&this.orbitControls.needsUpdate&&(this.orbitControls.update(),e=!this.orbitControls.isCurrentlyDamping),this.initializationCounter>=0&&this.initializationCounter<2?(this.initializationCounter++,e=!1):this.initializationCounter===2&&this.gameControl&&(e=!this.gameControl.update(t)&&e),this.usePhysics===!1&&this.checkTrigger(),this.usePhysics){let i=.016666666666666666;if(t===0)e=this.stepPhysics()&&e;else{let n=t/1e3;n<i&&n>.55*i&&(n=i),this.accumulator+=n;let r=performance.now(),s=0,a=6;for(;this.accumulator>=i&&s<a&&(e=this.stepPhysics()&&e,this.accumulator-=i,s++,!(performance.now()-r>1e3*i)););this.accumulator=this.accumulator%i}}this.skipRender=e}recordPhysicsPose(t){(t.hasNonUniformScale?t.matrixWorldRigid:t.matrixWorld).decompose(Mn,Os,Ll);let e=t;e.prevQ===void 0?(e.prevQ=Os.clone(),e.prevT=Mn.clone()):(e.prevQ.copy(Os),e.prevT.copy(Mn))}promoteMovedFixedBodies(){for(let t=this.fixedBodiesToWatch.length-1;t>=0;t--){let[e,i,n]=this.fixedBodiesToWatch[t];e.rigidBody===i?(e.hasNonUniformScale?e.matrixWorldRigid:e.matrixWorld).equals(n)||(i.setBodyType(Ge.RigidBodyType.KinematicPositionBased,!0),this.sharedGameControlGlobals.kinematicBodyToEntity.set(i.handle,e),this.sharedGameControlGlobals.entitiesWithTransformAnim.push(e),this.fixedBodiesToWatch.splice(t,1)):this.fixedBodiesToWatch.splice(t,1)}}clampPushedBodies(){let t=this.gameControl?.object.rigidBody;if(t===void 0)return;let e=this.sharedGameControlGlobals.rapierWorld,i=t.linvel(),n=t.translation(),r=Math.hypot(i.x,i.z);for(let s=0;s<t.numColliders();s++){let a=t.collider(s);e.contactPairsWith(a,o=>{let l=o.parent();if(l===null||!l.isDynamic())return;let c=l.translation(),h=-1/0,d=0,u=0;if(e.contactPair(a,o,v=>{let y=v.normal(),_=y.x*(c.x-n.x)+y.y*(c.y-n.y)+y.z*(c.z-n.z)<0?-1:1;if(Math.abs(y.y)>.7)return;let b=_*y.x,x=_*y.z,w=Math.hypot(b,x);if(w<1e-4)return;let S=(i.x*b+i.z*x)/w;S>h&&(h=S,d=b/w,u=x/w)}),h===-1/0)return;let p=i.x*d+i.z*u;if(p<-IM)return;let f=l.linvel();if(r>IM&&p>IM){let v=f.x*d+f.z*u;if(v<=0)return;let y=Math.min(v,p);return void l.setLinvel({x:d*y,y:f.y,z:u*y},!0)}let g=f.x*d+f.z*u-Math.max(0,p);if(g<=0)return;let m=.5*g;l.setLinvel({x:f.x-d*m,y:f.y,z:f.z-u*m},!0)})}}stepPhysics(){this.promoteMovedFixedBodies();let t=this.sharedGameControlGlobals.kinematicBodyToEntity;for(let[e,i]of t)i.rigidBody!==void 0?(this.recordPhysicsPose(i),i.rigidBody.setNextKinematicTranslation(Mn.divideScalar(this.pixelsPerMeter)),i.rigidBody.setNextKinematicRotation(Os)):t.delete(e);for(let e of this.sharedGameControlGlobals.entitiesWithTransformAnim)e.rigidBody?.isKinematic()!==!0&&this.recordPhysicsPose(e);return this.sharedGameControlGlobals.rapierWorld.step(this.events),this.clampPushedBodies(),this.events?.drainCollisionEvents(this.handleCollisionEvents),!this.updatePositions()}dispatchCollisionEvent(t,e,i){let n,r=(this.sharedGameControlGlobals.rapierWorld?.getCollider(i))._parent;if(e.cloner){for(let s of e.cloner.children)if(s.rigidBody===r){n=s;break}}t.dispatch(n),e.dispatchEvent(rC)}updateUseWindowEvents(t){this.orbitControls?.updateUseWindowEvents(t)}generateSensorColliderDescs(t,e,i){let n=YB.copy(t.matrixWorld).invert();t.traverseEntity((r,s)=>{if(e===!1&&s===1)return!0;for(let a of r.dataPatched.events)if(a.data.type==="Trigger"&&a.data.disabled!==!0){let o,l=new XB(a.id,a.data,r,this.page,this.sharedAssets,this.eventManager);if(o=a.data.triggerZone==="box"?Ge.ColliderDesc.cuboid(...a.data.size.map(c=>(typeof c=="number"?c:1)/(2*this.pixelsPerMeter))):Ge.ColliderDesc.ball(a.data.radius/this.pixelsPerMeter),o.setDensity(0).setSensor(!0).setActiveEvents(Ge.ActiveEvents.COLLISION_EVENTS),na.fromArray(a.data.position.map(c=>typeof c=="number"?c:0)),tu.setFromEuler($B.fromArray(a.data.rotation.map(c=>typeof c=="number"?c:0))),Ey.compose(na,tu,DM).premultiply(r.matrixWorld),i?(Ey.decompose(na,tu,PM),o.setActiveCollisionTypes(Ge.ActiveCollisionTypes.KINEMATIC_FIXED|Ge.ActiveCollisionTypes.DYNAMIC_FIXED)):(Ey.premultiply(n).decompose(na,tu,PM),t.rigidBody.bodyType()===Ge.RigidBodyType.Dynamic||(t.rigidBody.bodyType()===Ge.RigidBodyType.Fixed?o.setActiveCollisionTypes(Ge.ActiveCollisionTypes.KINEMATIC_FIXED|Ge.ActiveCollisionTypes.DYNAMIC_FIXED):o.setActiveCollisionTypes(Ge.ActiveCollisionTypes.KINEMATIC_KINEMATIC|Ge.ActiveCollisionTypes.DYNAMIC_KINEMATIC))),na.divideScalar(this.pixelsPerMeter),o.setTranslation(na.x,na.y,na.z),o.setRotation(tu),i)i.push([o,l]);else{let c=this.sharedGameControlGlobals.rapierWorld.createCollider(o,t.rigidBody);this.sensorToTriggerEvent[c.handle]=l}}})}checkTrigger(){let t;for(let e=0;e<this.sharedGameControlGlobals.triggers.length;e++){let[i,n,r,s]=this.sharedGameControlGlobals.triggers[e];for(let a=0;a<this.sharedGameControlGlobals.entitiesWithTransformAnim.length;a++){let o=this.sharedGameControlGlobals.entitiesWithTransformAnim[a];if(r===o||s.isValidTriggeringObject(Be.is(o)?o:o.object)===!1)continue;let l=YB.copy(r.matrixWorld).decompose(na,ZB,PM).compose(na,ZB,DM).multiply(n),c=Ey.copy(o.matrixWorld).invert().multiply(l),h=o.bvhGeometry.boundsTree;i instanceof ci?t=h.intersectsBox(i,c):(RM.radius=i,RM.center.setFromMatrixPosition(c),t=h.intersectsSphere(RM)),t?s.currentIntersectedObjects.indexOf(o)===-1&&(s.currentIntersectedObjects.push(o),s.dispatch(),r.dispatchEvent(Ltt)):s.currentIntersectedObjects=s.currentIntersectedObjects.filter(d=>d!==o)}}}};Cp(),tt(),vb(),Ye(),Mh();var OM=.02,KB=new T,QB=new T,Utt=new T,Er=new T,Lo=new T,iu=new T,LM=new At,JB=new At,ztt=new At,us=new Wt,hc=new Wt,nu=new xi(0,0,0,"YXZ"),Ftt=new T(1,0,0),Na=new T(0,1,0),Ntt=new T(0,0,1),tU=new T(1,1,1),eU=[],iU=t=>eU[t]??(eU[t]=new T),BM=new T,ktt=new T,Vtt=new T,jtt=new T,nU=new Wt,Gtt=new T,rU=new Wt,Qn=new ys,Ls=new ci,Htt={type:"requestRender"},Wtt={type:"updateMatrix"},sC=class extends Vn{constructor(t,e,i,n,r,s,a,o,l){super(),this.object=t,this.domElement=e,this.data=i,this.gloabalPhysics=n,this.controlsManager=r,this.cameraFollow=s,this.camera=a,this.page=o,this.sharedAssets=l,this.enableDamping=!0,this.hiddenMatrix0=new At,this.target0=new T,this.zoom0=1,this.rotForce=1,this.moveForce=1,this.pixelsPerMeter=200,this.euler0=new xi(0,0,0,"YXZ"),this.position0Cam=new T,this.quat0Cam=new Wt,this.scale0Cam=new T,this.hiddenMatrix0Cam=new At,this.threshEndTranslate=.01,this.threshEndRotate=1e-8,this.threshEndRotVel=.005,this.collider={type:"capsule",radius:40,segment:new ys(new T(0,-40,0),new T(0,40,0)),matrix:new At,position:new T,rotation:new Wt},this.euler=new xi(0,0,0,"YXZ"),this.eulerDelta=new T,this.lastPosition=new T,this.lastCameraQuaternion=new Wt,this.lastCameraPosition=new T,this.PI_2=Math.PI/2,this.prevMouse=new et,this.velocityTarget=new T,this.velocity=new T,this.directionXZ=new T,this.rotVelocityStick=new T,this.rotVelocityTarget=new T,this.rotVelocity=new T,this.rotDirection=new T,this.nonColliderRotOffset=new At,this.nonColliderPosOffset=new At,this.firstPointerId=-1,this.rot=new T,this.path=[],this.movementState={moveNegZ:0,movePosZ:0,moveNegX:0,movePosX:0,moveNegY:0,movePosY:0,rotPosX:0,rotNegX:0,rotPosY:0,rotNegY:0,jump:0,run:0},this.onObject=!1,this.actionState={},this.keyAssignments=[["moveNegZ","W"],["moveNegX","A"],["movePosZ","S"],["movePosX","D"],["rotPosX","ArrowUp"],["rotPosY","ArrowLeft"],["rotNegX","ArrowDown"],["rotNegY","ArrowRight"],["jump"," "]],this.collisionEnabled=!0,this.offsetMatrix=new At,this.objectToTarget=new T,this.objectToTarget0=new T,this.objectToCamXZ=new T,this.objectToCamXZ0=new T,this.targetToCamera=new T,this.targetToCamera0=new T,this.cameraPolarAxis0=new T,this.targetPos=new T,this.targetQuat=new Wt,this.lerpFactorPos=new T().setScalar(.3),this.lerpFactorPosStart=.3,this.lerpFactorPosEnd=.3,this.lerpFactorRotStart=.3,this.lerpFactorRotEnd=.3,this.lerpFactorPosCamera=.3,this.lerpFactorRotCamera=.3,this.objXZQuat=new Wt,this.objXZQuatInv=new Wt,this.objXZRotMat=new At,this.isFirstPerson=!1,this.didHit=!1,this.groundVelocity=new T,this.pushedVelocity=new T,this.groundYRotation=0,this.objectRealQuat=new Wt,this.colliderWorldQuat=new Wt,this.groundNormal=new T,this.groundTilt=new Wt,this.groundTiltInv=new Wt,this.lastHitObj=null,this.isFirstFrame=!0,this.rotationAccumWhenOrientWithCamera=0,this.navMeshPathDest=null,this.position=new T,this.quaternion=new Wt,this.scale=new T,this.initialAction=!0,this.onPointerDown=f=>{!(f.target===this.domElement||f.target instanceof HTMLElement&&f.target.tagName==="SPLINE-VIEWER"&&f.target.shadowRoot?.contains(this.domElement))||this.firstPointerId!==-1||(this.firstPointerId=f.pointerId,this.domElement.ownerDocument.addEventListener("pointermove",this.onPointerMove),this.domElement.ownerDocument.addEventListener("pointerup",this.onPointerUp),this.rotBy!=="keys"&&!as&&!QE&&this.domElement.requestPointerLock(),this.prevMouse.set(f.clientX,f.clientY))},this.onPointerUp=f=>{this.firstPointerId=-1,this.domElement.ownerDocument.removeEventListener("pointermove",this.onPointerMove),this.domElement.ownerDocument.removeEventListener("pointerup",this.onPointerUp),f.pointerType==="mouse"&&this.domElement.ownerDocument.exitPointerLock()},this.onPointerMove=f=>{if(f.pointerId!==this.firstPointerId)return;let g=f.clientX-this.prevMouse.x,m=f.clientY-this.prevMouse.y;this.prevMouse.set(f.clientX,f.clientY),f.pointerType==="mouse"&&this.rotBy!=="keys"&&(QE&&ZF<15.5&&!as?(this.eulerDelta.y=-g*this.mouseOrbitSensitivity,this.eulerDelta.x=-m*this.mouseOrbitSensitivity):(this.eulerDelta.y=-f.movementX*this.mouseOrbitSensitivity,this.eulerDelta.x=-f.movementY*this.mouseOrbitSensitivity)),f.pointerType!=="mouse"&&this.rotByTouch==="drag"&&(this.eulerDelta.y=-g*this.mouseOrbitSensitivity*5,this.eulerDelta.x=-m*this.mouseOrbitSensitivity*5),this.controlsManager.requestRender()},this.onPointerlockChange=f=>{this.domElement.ownerDocument.pointerLockElement===this.domElement?sC.isLocked=!0:sC.isLocked=!1},this.onPointerlockError=()=>{console.error("SPE.GameControls: Unable to use Pointer Lock API")},this.handleVisibilityChange=()=>{if(document?.hidden)for(let f in this.movementState)this.movementState[f]=0},this.onKeyDown=f=>{!(f.target instanceof HTMLInputElement)&&(f.code==="ArrowLeft"||f.code==="ArrowUp"||f.code==="ArrowRight"||f.code==="ArrowDown"||f.code==="Space")&&f.preventDefault();for(let g of this.keyAssignments)if(f.key.toUpperCase()===g[1]||f.key===g[1]){this.movementState[g[0]]=1;break}this.controlsManager.requestRender()},this.onKeyUp=f=>{for(let g of this.keyAssignments)if(f.key.toUpperCase()===g[1]||f.key===g[1]||f.code.slice(3,f.code.length).toUpperCase()===g[1]){this.movementState[g[0]]=0;break}},this.copyVRGamePadValues=(f,g)=>{for(let m=2;m<4;m++){let v=f.axes[m];g===0?m===2?this.movementState.movePosX=v:this.movementState.movePosZ=v:(f.buttons[3].pressed?this.movementState.jump=1:this.movementState.jump=0,m===2?this.movementState.rotPosY=v:this.moveMode==="fly"&&(this.movementState.moveNegY=v))}},this.sharedGameControlGlobals=r.sharedGameControlGlobals,t===a&&(this.isFirstPerson=!0),this.hiddenMatrix0.copy(this.object.hiddenMatrix),this.object.parent?this.object.hiddenMatrix.copy(this.object.parent.matrixWorld).invert():this.object.hiddenMatrix.identity(),this.object.matrix.copy(this.object.matrixWorld),this.object.matrix.decompose(this.position,this.quaternion,this.scale),this.euler0.setFromQuaternion(this.quaternion,"YXZ");let c=this.euler0.clone(),h=c.y;if(this.objectRealQuat.copy(this.quaternion),c.y=0,this.quaternion.setFromEuler(c),this.objXZQuat.copy(this.quaternion),this.objXZQuatInv.copy(this.objXZQuat).invert(),this.objXZRotMat.makeRotationFromQuaternion(this.quaternion),c.set(0,h,0),this.quaternion.setFromEuler(c),this.rot.setFromEuler(c),this.object.matrixAutoUpdate=!1,(this.isFirstPerson||this.cameraFollow===!0)&&(this.target0.copy(this.camera.getTarget()),this.zoom0=this.camera.zoom),this.cameraFollow===!0){this.position0Cam.copy(this.camera.position),this.quat0Cam.copy(this.camera.quaternion),this.scale0Cam.copy(this.camera.scale),this.hiddenMatrix0Cam.copy(this.camera.hiddenMatrix),this.camera.parent?(this.camera.hiddenMatrix.copy(this.camera?.parent.matrixWorld),this.camera.matrix.copy(this.camera.matrixWorld)):this.camera.hiddenMatrix.identity(),this.camera.matrix.copy(this.camera.matrixWorld),this.camera.matrix.decompose(this.camera.position,this.camera.quaternion,this.camera.scale),this.camera.matrixAutoUpdate=!1,this.offsetMatrix.copy(this.object.matrix).invert().multiply(this.camera.matrix);let f,g=new T(0,0,-1).applyQuaternion(this.camera.quaternion),m=new T().subVectors(this.position,this.camera.position);this.objectToCamXZ.copy(m),this.objectToCamXZ.y=0,this.objectToCamXZ0.copy(this.objectToCamXZ),Math.abs(g.y)<1e-6?(m.y=0,g.y=0,f=m.projectOnVector(g)):f=m.y/g.y>0?g.multiplyScalar(m.y/g.y):g.multiplyScalar(m.length()),this.targetToCamera0.copy(f).negate();let v=this.camera.position.clone().add(f);this.objectToTarget0.subVectors(v,this.position);let y=new xi().setFromQuaternion(this.camera.quaternion,"YXZ");this.cameraPolarOffset=-y.x,y.x=0,y.z=0,y.y-=Math.PI/2,this.cameraPolarAxis0.set(0,0,-1).applyEuler(y)}if(this.object instanceof Zi&&(this.object.matrixAutoUpdate=!1),this.euler.setFromQuaternion(this.quaternion,"YXZ"),this.rotByTouch=i.rotByTouch??"joystick",this.rotBy=i.rotBy??"keys",this.rotationMode=i.rotationMode??"normal",this.moveMode=i.moveMode??"walk",this.collisionEnabled=i.collisionEnabled,this.speedTranslate=1*(i.speedTranslate??250),this.speedOrbit=.025*(i.speedRotate??100),this.mouseOrbitSensitivity=16e-6*(i.speedRotate??100),this.keyAssignments=i.keyAssignments.map(f=>{let g=[f[0],f[1]];return g[1]==="\u25B2"?g[1]="ArrowUp":g[1]==="\u25C0"?g[1]="ArrowLeft":g[1]==="\u25BC"?g[1]="ArrowDown":g[1]==="\u25B6"?g[1]="ArrowRight":g[1]==="\u21E7"?g[1]="Shift":g[1]==="\u21B5"?g[1]="Enter":g[1]==="Space"?g[1]=" ":g[1]==="\u2318"?g[1]="Meta":g[1]==="Ctrl"?g[1]="Control":g[1]==="Esc"&&(g[1]="Escape"),g}),i.rotBy==="mouse"){let f;f=this.keyAssignments.findIndex(g=>g[0]==="rotNegX"),f!==-1&&(this.keyAssignments[f][1]=""),f=this.keyAssignments.findIndex(g=>g[0]==="rotPosX"),f!==-1&&(this.keyAssignments[f][1]=""),f=this.keyAssignments.findIndex(g=>g[0]==="rotPosY"),f!==-1&&(this.keyAssignments[f][1]=""),f=this.keyAssignments.findIndex(g=>g[0]==="rotNegY"),f!==-1&&(this.keyAssignments[f][1]="")}this.lerpFactorPosStart=1-.02**(1/(60*(i.delayPos[0]??.3))),this.lerpFactorPosEnd=1-.02**(1/(60*(i.delayPos[1]??.3))),this.lerpFactorPos.setScalar(this.lerpFactorPosStart),this.lerpFactorRotStart=1-.02**(1/(60*(i.delayRot[0]??.3))),this.lerpFactorRotEnd=1-.02**(1/(60*(i.delayRot[1]??.3))),this.lerpFactorPosCamera=1-.02**(1/(60*(i.delayPosCamera??.3))),this.lerpFactorRotCamera=1-.02**(1/(60*(i.delayRotCamera??.3))),this.gravity=12*(this.gloabalPhysics.gravity??Qu.defaultData.gravity),this.usePhysics=this.gloabalPhysics.usePhysics??Qu.defaultData.usePhysics,this.jumpPower=20*i.jumpPower,this.resetYPosition=this.position.y+Math.abs(i.resetYPosition)*(this.gravity>0?1:-1),this.alignToGround=i.alignToGround??!1,this.orientMode=i.autoOrientMove?i.orientMode:"none",this.orientWith=i.orientWith??hb.defaultDataThirdPerson.orientWith,this.slopeThresh=65*Math.PI/180,i.collider.type==="capsule"?(this.collider.radius=i.collider.radius,this.collider.segment.start.y=i.collider.height/2-i.collider.radius,this.collider.segment.end.y=-this.collider.segment.start.y,this.offset=i.collider.height*OM/this.pixelsPerMeter,this.stepThresh=.3*i.collider.height/this.pixelsPerMeter,this.colliderHeight=i.collider.height):i.collider.type==="sphere"?(this.collider.radius=i.collider.radius,this.collider.segment.start.y=0,this.collider.segment.end.y=0,this.offset=2*i.collider.radius*OM/this.pixelsPerMeter,this.stepThresh=2*i.collider.radius*.3/this.pixelsPerMeter,this.colliderHeight=2*i.collider.radius):(this.offset=i.collider.height*OM/this.pixelsPerMeter,this.stepThresh=.3*i.collider.height/this.pixelsPerMeter,this.colliderHeight=i.collider.height),this.collider.type=i.collider.type;let d=new T().fromArray(i.collider.position.map(f=>typeof f=="number"?f:0)),u=new Wt().setFromEuler(new xi().fromArray([...i.collider.rotation.map(f=>typeof f=="number"?f:0),"XYZ"]));this.collider.position.copy(d).multiply(this.scale),this.collider.rotation.copy(u),this.collider.matrix.compose(d,u,tU),i.cameraXAxis!==void 0&&(this.cameraXAxis=i.cameraXAxis,this.cameraYAxis=i.cameraYAxis,this.minPolarAngle=i.cameraRotXLimits[0],this.maxPolarAngle=i.cameraRotXLimits[1],this.minAzimuthAngleRel=i.cameraRotYLimits[0],this.maxAzimuthAngleRel=i.cameraRotYLimits[1]),this.forwardDir=i.forwardDirection??"-z",this.isFirstPerson&&(this.forwardDir="-z"),this.runMultiplier=i.runMultiplier??2;let p=2*i.navmesh.destinationHelperRadius;if(p>0){let f=new Vt;f.push({fi:0,data:{...tn.defaultData("light","phong"),alpha:0},id:"layer1"}),f.push({fi:0,data:{...tn.defaultData("color"),color:i.navmesh.destinationHelperColor,alpha:i.navmesh.destinationHelperColor.a},id:"layer2"});let g=T6({layers:f},{scene:this.page.scene,shared:this.sharedAssets});this.navMeshPathDest=new gi(x3.create({parameters:{width:p,height:p/10,hollow:.7}}),g),this.navMeshPathDest.material.userData.opacity0=i.navmesh.destinationHelperColor.a}this.activate()}reset(t=!1){if(this.object.hiddenMatrix.copy(this.hiddenMatrix0),t){this.object.updateMatrix(),this.object.updateMatrixWorld(),this.object.matrix.copy(this.object.matrixWorld),this.object.matrix.decompose(this.position,this.quaternion,this.scale),this.object.parent?this.object.hiddenMatrix.copy(this.object.parent.matrixWorld).invert():this.object.hiddenMatrix.identity();let e=new xi().setFromQuaternion(this.quaternion,"YXZ"),i=e.y;this.objectRealQuat.copy(this.quaternion),e.y=0,this.quaternion.setFromEuler(e),this.objXZQuat.copy(this.quaternion),this.objXZQuatInv.copy(this.objXZQuat).invert(),this.objXZRotMat.makeRotationFromQuaternion(this.quaternion),e.set(0,i,0),this.quaternion.setFromEuler(e),this.rot.setFromEuler(e),this.euler.setFromQuaternion(this.quaternion,"YXZ"),this.velocityTarget.set(0,0,0),this.velocity.set(0,0,0)}else this.object instanceof Zi?this.object.matrixAutoUpdate=!0:this.object.updateMatrix();this.cameraFollow===!0&&(this.camera.quaternion.copy(this.quat0Cam),this.camera.position.copy(this.position0Cam),this.camera.scale.copy(this.scale0Cam),this.camera.hiddenMatrix.copy(this.hiddenMatrix0Cam),this.camera.matrixAutoUpdate=!0),this.controlsManager.requestRender()}activate(){this.instantiateActions(),this.domElement.ownerDocument.addEventListener("pointerdown",this.onPointerDown),this.domElement.ownerDocument.addEventListener("keydown",this.onKeyDown),this.domElement.ownerDocument.addEventListener("keyup",this.onKeyUp),this.domElement.ownerDocument.addEventListener("pointerlockchange",this.onPointerlockChange),this.domElement.ownerDocument.addEventListener("pointerlockerror",this.onPointerlockError),this.domElement.ownerDocument.addEventListener("visibilitychange",this.handleVisibilityChange)}deactivate(){this.disposeActions(),this.domElement.ownerDocument.removeEventListener("pointerdown",this.onPointerDown),this.domElement.ownerDocument.removeEventListener("keydown",this.onKeyDown),this.domElement.ownerDocument.removeEventListener("keyup",this.onKeyUp),this.domElement.ownerDocument.removeEventListener("pointerlockchange",this.onPointerlockChange),this.domElement.ownerDocument.removeEventListener("pointerlockerror",this.onPointerlockError),this.domElement.ownerDocument.removeEventListener("visibilitychange",this.handleVisibilityChange)}dispose(){this.deactivate(),this.navMeshPathDest?.parent&&this.page.remove(this.navMeshPathDest)}instantiateActions(){let t=this.data,e=this.sharedAssets;t.gameActions!==void 0&&(this.actions={},lb.list.forEach(i=>{this.actions[i]=Rn({...t,disabled:!1,type:"GameControl"},t.gameActions[i],this.page,e,this.controlsManager.eventManager,this.object)})),this.dispatchStopEvent("move"),this.dispatchStopEvent("run"),this.dispatchStopEvent("jump"),this.dispatchStartEvent("idle"),this.initialAction&&(this.initialAction=!1)}disposeActions(){this.initialAction=!1,this.dispatchStopEvent("idle"),this.dispatchStopEvent("move"),this.dispatchStopEvent("run"),this.dispatchStopEvent("jump"),rr(this.actions.idle),rr(this.actions.move),rr(this.actions.run),rr(this.actions.jump)}dispatchStartEvent(t){this.actions[t]!==void 0&&(this.actionState[t]||(this.actionState[t]=!0,this.actions[t].Transition.forEach(e=>{e.play()}),this.actions[t].Animation.forEach(e=>{e.play(this.initialAction===!1)}),this.actions[t].TimelineAnimation.forEach(e=>{e.play()}),this.actions[t].Create.forEach(e=>{e.dispatchStart()}),this.actions[t].Audio.forEach(e=>{e.dispatchGameControl("start")}),this.actions[t].Particles.forEach(e=>{e.dispatchGameControl("start")})))}dispatchStopEvent(t){this.actions[t]!==void 0&&(!this.actionState[t]||(this.actionState[t]=!1,this.actions[t].Transition.forEach(e=>{e.stop(),e.object.currentState!==null&&e.object.changeSelectedState(null,{scene:this.page.scene,shared:this.sharedAssets})}),this.actions[t].TimelineAnimation.forEach(e=>{e.stop()}),this.actions[t].Create.forEach(e=>{e.dispatchStop()}),this.actions[t].Audio.forEach(e=>{e.dispatchGameControl("stop")}),this.actions[t].Particles.forEach(e=>{e.dispatchGameControl("stop")})))}get colliderWorldPosition(){return Er.copy(this.collider.position).applyQuaternion(this.objectRealQuat).add(this.position)}update(t){if(this.gravity<0?this.position.y<this.resetYPosition:this.position.y>this.resetYPosition)return this.reset(!0),!0;this.sharedGameControlGlobals.gamePads.forEach(this.copyVRGamePadValues);let e=(this.isFirstFrame?16.6:t)/1e3;this.isFirstFrame&&(this.isFirstFrame=!1);let i=60*e,n=!1;if(this.groundYRotation=0,this.groundVelocity.set(0,0,0),this.usePhysics&&this.collisionEnabled&&this.object.rigidBody?.collider(0).shape){let s=Lo.set(0,(this.velocity.y===0?this.pixelsPerMeter*Math.max(Math.abs(this.gravity)/120,1)*(this.gravity>0?1:-1):this.velocity.y)*e,0).divideScalar(this.pixelsPerMeter),a=this.sharedGameControlGlobals.rapierWorld.castShape(this.colliderWorldPosition.divideScalar(this.pixelsPerMeter),this.colliderWorldQuat,s,this.object.rigidBody?.collider(0).shape,0,1,!1,8,void 0,void 0,this.object.rigidBody);if(a){this.onObject=!0,this.groundNormal.set(a.normal2.x,a.normal2.y,a.normal2.z).applyQuaternion(this.colliderWorldQuat).negate(),this.alignToGround&&this.groundTiltAdjustment(this.groundNormal),Math.acos(this.groundNormal.y)<this.slopeThresh&&(n=!0),a.collider.parent()?.bodyType()===0&&Math.acos(this.groundNormal.y)*(180/Math.PI)>45&&(this.onObject=!1);let o=a.collider.parent(),l=o!==null&&o.isKinematic()?o:null,c=l===null?void 0:this.sharedGameControlGlobals.kinematicBodyToEntity.get(l.handle);if(l!==null&&c?.userData.isFollowingObj!==this.object.uuid){let h=this.object.getWorldPosition(Er).add(this.collider.position).divideScalar(this.pixelsPerMeter),d=l.velocityAtPoint(h);this.groundVelocity.set(d.x,d.y,d.z).multiplyScalar(this.pixelsPerMeter),this.groundYRotation=l.angvel().y*e}}else this.onObject=!1}if(this.moveMode==="walk"&&this.collisionEnabled&&(this.movementState.jump===1&&this.onObject&&(this.velocityTarget.y=this.jumpPower,this.movementState.jump=0,this.dispatchStopEvent("idle"),this.dispatchStopEvent("move"),this.dispatchStopEvent("run"),this.dispatchStopEvent("jump"),this.dispatchStartEvent("jump"),this.onObject=!1),this.onObject?this.velocityTarget.y/=2:this.velocityTarget.y+=this.gravity*i),this.moveMode==="fly"&&(this.velocityTarget.y=(this.movementState.movePosY-this.movementState.moveNegY)*this.speedTranslate),this.directionXZ.z=this.movementState.movePosZ-this.movementState.moveNegZ,this.directionXZ.x=this.movementState.movePosX-this.movementState.moveNegX,this.forwardDir==="+z"&&this.directionXZ.multiplyScalar(-1),this.directionXZ.manhattanLength()>0&&(this.path=[]),this.navMeshPathDest){let s=this.navMeshPathDest.material;if(this.moveMode==="walk"&&this.path.length>1){this.navMeshPathDest.position.copy(this.path[this.path.length-1]),this.navMeshPathDest.parent||this.page.add(this.navMeshPathDest);let a=Er.subVectors(this.path[1],this.position),o=Lo.subVectors(this.path[1],this.path[0]);a.dot(o)<0?this.path.shift():(this.directionXZ.x=o.x,this.directionXZ.z=o.z),s.opacity=s.userData.opacity0}else s.opacity-=.05*s.userData.opacity0,this.navMeshPathDest.material.opacity<=0&&this.navMeshPathDest.parent&&this.page.remove(this.navMeshPathDest)}this.directionXZ.normalize(),this.movementState.run?this.moveForce=this.runMultiplier:this.moveForce=1,this.velocityTarget.z=this.directionXZ.z*this.speedTranslate*this.moveForce,this.velocityTarget.x=this.directionXZ.x*this.speedTranslate*this.moveForce,(this.moveMode==="walk"?this.velocityTarget.x+this.velocityTarget.z===0:this.velocityTarget.manhattanLength()===0)?this.lerpFactorPos.setScalar(this.lerpFactorPosEnd):this.lerpFactorPos.setScalar(this.lerpFactorPosStart),this.moveMode==="walk"&&(this.lerpFactorPos.y=1),this.didHit===!1&&this.pushedVelocity.manhattanLength()===0||this.usePhysics===!1?(this.velocity.x+=(this.velocityTarget.x-this.velocity.x)*(1-(1-this.lerpFactorPos.x)**i),this.velocity.y+=(this.velocityTarget.y-this.velocity.y)*(1-(1-this.lerpFactorPos.y)**i),this.velocity.z+=(this.velocityTarget.z-this.velocity.z)*(1-(1-this.lerpFactorPos.z)**i)):this.velocity.copy(this.velocityTarget),(this.moveMode==="walk"?this.velocity.x**2+this.velocity.z**2<this.speedTranslate:this.velocity.lengthSq()<this.speedTranslate)?(this.dispatchStopEvent("move"),this.dispatchStopEvent("run"),this.onObject&&(this.dispatchStopEvent("jump"),this.dispatchStartEvent("idle"))):(this.dispatchStopEvent("idle"),(this.onObject||this.moveMode==="fly")&&(this.dispatchStopEvent("jump"),this.movementState.run?(this.dispatchStopEvent("move"),this.dispatchStartEvent("run")):(this.dispatchStopEvent("run"),this.dispatchStartEvent("move"))));let r=Utt.copy(this.velocity);if(this.orientMode!=="none"&&this.isFirstPerson===!1){let s=Lo.copy(r);s.y=0,r.set(0,r.y,s.length()*(this.forwardDir==="+z"?1:-1))}if(this.directionXZ.manhattanLength()>0&&this.orientMode!=="none"&&this.isFirstPerson===!1)if(this.orientWith==="camera"&&this.path.length<=1){let s=Er;this.camera.getWorldDirection(s);let a=iu.copy(Na).multiplyScalar(s.dot(Na));s.sub(a);let o=Lo.copy(this.directionXZ);o.x*=-1,this.rot.y=s.angleTo(o)*(s.cross(o).y>0?-1:1)+this.rotationAccumWhenOrientWithCamera}else this.rot.y=(this.path.length>1?0:this.euler.y)+Math.atan2(-this.directionXZ.z,this.directionXZ.x)+Math.PI/2*(this.forwardDir==="+z"?1:-1);if(nu.setFromVector3(this.rot),this.moveMode==="walk"&&(nu.x=0),r.applyEuler(nu),n&&(hc.setFromUnitVectors(Na,this.groundNormal),r.applyQuaternion(hc)),this.usePhysics===!0&&this.object.rigidBody){this.pushedVelocity.set(0,0,0);let s=0;for(let a of this.sharedGameControlGlobals.entitiesWithTransformAnim){if(a.rigidBody===void 0||a.prevQ===void 0)continue;(a.hasNonUniformScale?a.matrixWorldRigid:a.matrixWorld).decompose(BM,nU,ktt);let o=this.object.getWorldPosition(Vtt).add(this.collider.position).sub(BM);rU.copy(a.prevQ).invert().premultiply(nU);let l=iu.subVectors(BM,a.prevT).add(jtt.copy(o).applyQuaternion(rU).sub(o)).divideScalar(e).divideScalar(this.pixelsPerMeter),c=a.rigidBody.collider(0).castCollider(l,this.object.rigidBody.collider(0),Er.copy(r).divideScalar(this.pixelsPerMeter),0,e,!1);l.multiplyScalar(this.pixelsPerMeter);let h=Be.is(a)?a:a.object;if(c!==null&&this.lastHitObj!==h){let d;a instanceof _s&&(d=a);let u=this.sharedGameControlGlobals.entityToCollisionEvents[h.uuid];if(u)for(let p of u)p.data.target==="character"&&(p.dispatch(d),h.dispatchEvent(rC));this.lastHitObj=h}c!==null&&(Math.abs(l.x)>Math.abs(this.pushedVelocity.x)&&(this.pushedVelocity.x=l.x),Math.abs(l.y)>Math.abs(this.pushedVelocity.y)&&(this.pushedVelocity.y=l.y),Math.abs(l.z)>Math.abs(this.pushedVelocity.z)&&(this.pushedVelocity.z=l.z),iU(s++).copy(c.normal1).applyQuaternion(a.quaternion))}if(s>0){for(let a=0;a<s;a++){let o=iU(a),l=o.dot(r);l<0&&r.addScaledVector(o,-l)}r.add(this.pushedVelocity)}else r.add(this.groundVelocity)}if(this.rotDirection.y=Number(this.movementState.rotPosY)-Number(this.movementState.rotNegY),this.rotDirection.x=Number(this.movementState.rotPosX)-Number(this.movementState.rotNegX),this.rotDirection.normalize(),this.rotationMode==="normal"&&(this.movementState.rotPosX||this.movementState.rotNegX)||this.rotationMode==="steer"&&(this.movementState.rotPosX||this.movementState.rotNegX)&&(this.movementState.movePosZ||this.movementState.moveNegZ||this.moveMode==="walk")?this.rotVelocityStick.x=-this.rotDirection.x*this.speedOrbit*this.rotForce:this.rotVelocityStick.x=0,this.rotationMode==="normal"&&(this.movementState.rotPosY||this.movementState.rotNegY)||this.rotationMode==="steer"&&(this.movementState.rotPosY||this.movementState.rotNegY)&&(this.movementState.movePosZ||this.movementState.moveNegZ)?this.rotVelocityStick.y=-this.rotDirection.y*this.speedOrbit*this.rotForce:this.rotVelocityStick.y=0,this.rotVelocityTarget.subVectors(this.eulerDelta.divideScalar(e),this.rotVelocityStick),this.rotVelocityTarget.manhattanLength()===0?this.rotVelocity.lerp(this.rotVelocityTarget,1-(1-this.lerpFactorRotEnd)**i):this.rotVelocity.lerp(this.rotVelocityTarget,1-(1-this.lerpFactorRotStart)**i),this.euler.x+=this.rotVelocity.x*e,this.euler.y+=this.rotVelocity.y*e+this.groundYRotation,this.rotVelocityTarget.y===0&&this.directionXZ.manhattanLength()===0?this.rotationAccumWhenOrientWithCamera=0:(this.cameraFollow===!1||this.cameraYAxis==="Locked")&&(this.rotationAccumWhenOrientWithCamera+=this.rotVelocity.y*e),this.isFirstPerson===!1&&this.orientMode!=="none"&&this.directionXZ.manhattanLength()>0){if(this.orientMode==="radial"){this.objectToCamXZ.copy(this.objectToCamXZ0).applyAxisAngle(Na,this.euler.y-this.euler0.y);let s=Lo.copy(this.objectToCamXZ).normalize(),a=iu.copy(r).multiplyScalar(e);a.y=0;let o=a.sub(Er.copy(s).multiplyScalar(a.dot(s))).cross(s).y;this.euler.y-=Math.atan2(o,this.objectToCamXZ.length())}}else this.rot.y+=this.rotVelocity.y*e+this.groundYRotation,this.rotVelocityTarget.y!==0&&(this.cameraFollow===!1||this.cameraYAxis==="Locked")&&(this.euler.y=this.rot.y);if(this.cameraFollow===!0&&(this.moveMode==="walk"?this.cameraXAxis==="Limit"?this.euler.x=Ot.clamp(this.euler.x,-this.maxPolarAngle+this.cameraPolarOffset+1e-6,-this.minPolarAngle+this.cameraPolarOffset-1e-6):this.euler.x=Ot.clamp(this.euler.x,-this.PI_2+this.cameraPolarOffset,this.PI_2+this.cameraPolarOffset):this.cameraXAxis==="Limit"&&(this.euler.x=Ot.clamp(this.euler.x,-this.PI_2,this.PI_2))),this.moveMode==="fly"?this.rot.x=this.euler.x:this.isFirstPerson&&(nu.copy(this.euler),nu.y=0,this.nonColliderRotOffset.makeRotationFromEuler(nu)),us.setFromAxisAngle(Ftt,this.rot.x),hc.setFromAxisAngle(Na,this.rot.y),hc.multiply(us),us.setFromAxisAngle(Ntt,this.rot.z),hc.multiply(us),this.quaternion.copy(hc),this.objectRealQuat.multiplyQuaternions(this.quaternion,this.objXZQuat),this.colliderWorldQuat.copy(this.objectRealQuat).multiply(this.collider.rotation),this.collisionEnabled)if(this.usePhysics&&this.object.rigidBody?.collider(0).shape){let s=Lo.copy(r).multiplyScalar(e/this.pixelsPerMeter),a=null;this.didHit=!1;let o=new T;for(let h=0;h<5;h++){let d=s.length(),u=iu.copy(s).normalize();if(a=this.sharedGameControlGlobals.rapierWorld.castShape(this.colliderWorldPosition.divideScalar(this.pixelsPerMeter).add(o),this.colliderWorldQuat,u,this.object.rigidBody.collider(0).shape,0,d,!1,12,void 0,void 0,this.object.rigidBody),a===null){h===0&&this.directionXZ.manhattanLength()!==0&&(this.lastHitObj=null),o.add(s);break}{this.didHit=!0;let p=this.sharedGameControlGlobals.colliderToEntity.get(a.collider.handle);if(p!==this.lastHitObj&&h===0){this.lastHitObj=p;let v=this.sharedGameControlGlobals.entityToCollisionEvents[p?.uuid];if(v){for(let y of v)if(y.data.target==="character"){let _,b=(this.sharedGameControlGlobals.rapierWorld?.getCollider(a.collider.handle))._parent;if(p.cloner){for(let x of p.cloner.children)if(x.rigidBody===b){_=x;break}}y.dispatch(_),p.dispatchEvent(rC)}}}let f=KB.set(a.normal2.x,a.normal2.y,a.normal2.z).applyQuaternion(this.colliderWorldQuat),g=QB.copy(u).multiplyScalar(a.time_of_impact).dot(f),m=a.time_of_impact;if(m===0&&(this.position.y+=this.offset*this.pixelsPerMeter),g>this.offset&&(m=a.time_of_impact*(g-this.offset)/g,o.addScaledVector(u,m)),s.copy(u).multiplyScalar(d-m),Math.acos(-f.y)>this.slopeThresh){let v=this.colliderWorldPosition.divideScalar(this.pixelsPerMeter).add(o),y=iu.copy(a.witness2).applyQuaternion(this.colliderWorldQuat);y.y=0;let _=v.add(y);_.y+=this.stepThresh;let b=this.sharedGameControlGlobals.rapierWorld.castShape(_,this.colliderWorldQuat,s,this.object.rigidBody?.collider(0).shape,0,1,!1,12,void 0,void 0,this.object.rigidBody);b!==null&&b.time_of_impact===0&&(f.y=0,f.normalize())}s.addScaledVector(f,-s.dot(f))}}this.position.addScaledVector(o,this.pixelsPerMeter),Er.copy(this.position).divideScalar(this.pixelsPerMeter),us.copy(this.quaternion).premultiply(this.groundTilt).multiply(this.objXZQuat);let l=this.object.rigidBody,c=l!==void 0&&Gtt.copy(Er).sub(l.translation()).lengthSq()>1;l!==void 0&&(c?(l.setTranslation(Er,!0),l.setRotation(us,!0)):(l.setNextKinematicTranslation(Er),l.setNextKinematicRotation(us)))}else{let s=this.onObject?1:5,a=r.multiplyScalar(e/s);for(let o=0;o<s;o++)this.position.add(a),this.collisionAdjustment(e/s)}else this.position.addScaledVector(r,e);if(this.moveMode==="walk"&&this.onObject&&(this.velocityTarget.y=0,this.velocity.y=0),this.quaternion.premultiply(this.groundTilt).multiply(this.objXZQuat),this.object.matrix.compose(this.position,this.quaternion,this.scale),this.object.matrixWorldNeedsUpdate=!0,this.object.matrix.multiply(this.nonColliderPosOffset).multiply(this.nonColliderRotOffset),this.quaternion.premultiply(this.groundTiltInv).multiply(this.objXZQuatInv),this.cameraFollow===!0){this.updateFollowArms();let s=this.objectToTarget.add(this.position),a=this.targetToCamera.add(s);LM.lookAt(a,s,Na).setPosition(a),LM.decompose(this.targetPos,this.targetQuat,Er),this.camera.quaternion.slerp(this.targetQuat,1-(1-this.lerpFactorRotCamera)**i),this.camera.position.lerp(this.targetPos,1-(1-this.lerpFactorPosCamera)**i),this.camera.updateMatrix(),this.camera.updateMatrixWorld(),this.cameraYAxis==="Limit"&&this.orientMode==="cartesian"&&(this.euler.y=Ot.clamp(this.euler.y,this.minAzimuthAngleRel,this.maxAzimuthAngleRel)),this.euler.x=Ot.clamp(this.euler.x,-this.PI_2+(this.cameraPolarOffset<0?this.cameraPolarOffset:0),this.PI_2+(this.cameraPolarOffset>0?this.cameraPolarOffset:0))}return this.eulerDelta.set(0,0,0),this.object.dispatchEvent(Wtt),!(this.path.length<2&&this.lastPosition.distanceToSquared(this.position)<this.threshEndTranslate&&Math.abs(this.rotVelocity.x)<this.threshEndRotVel&&Math.abs(this.rotVelocity.y)<this.threshEndRotVel&&(this.camera===void 0||this.isFirstPerson||this.lastCameraPosition.distanceToSquared(this.camera.position)<this.threshEndTranslate&&8*(1-this.lastCameraQuaternion.dot(this.camera.quaternion))<this.threshEndRotate)&&(this.moveMode==="fly"||this.onObject===!0||this.collisionEnabled===!1)&&(this.navMeshPathDest===null||this.navMeshPathDest.material.opacity<-.04*this.navMeshPathDest?.material?.userData.opacity0)||(this.camera&&(this.lastCameraPosition.copy(this.camera.position),this.lastCameraQuaternion.copy(this.camera.quaternion)),this.lastPosition.copy(this.position),this.object.dispatchEvent(Htt),0))}updateFollowArms(){this.objectToTarget.copy(this.objectToTarget0),this.targetToCamera.copy(this.targetToCamera0);let t,e=us.setFromAxisAngle(Na,this.cameraYAxis==="Limit"&&this.orientMode!=="radial"?Ot.clamp(this.euler.y-this.euler0.y,this.minAzimuthAngleRel,this.maxAzimuthAngleRel):this.euler.y-this.euler0.y);(this.cameraYAxis!=="Locked"||this.orientMode==="radial")&&this.objectToTarget.applyQuaternion(e),t=this.cameraXAxis==="Limit"?Ot.clamp(this.euler.x,-this.maxPolarAngle+this.cameraPolarOffset+1e-6,-this.minPolarAngle+this.cameraPolarOffset-1e-6):Ot.clamp(this.euler.x,-this.PI_2+this.cameraPolarOffset+1e-6,this.PI_2+this.cameraPolarOffset-1e-6);let i=Er.copy(this.cameraPolarAxis0);(this.cameraYAxis!=="Locked"||this.orientMode==="radial")&&i.applyQuaternion(e);let n=hc.setFromAxisAngle(i,t);this.cameraYAxis!=="Locked"&&this.targetToCamera.applyQuaternion(e),this.cameraXAxis!=="Locked"&&this.targetToCamera.applyQuaternion(n)}groundTiltAdjustment(t){180*Na.angleTo(t)/Math.PI<15||180*Na.angleTo(t)/Math.PI>85?us.identity():us.setFromUnitVectors(Na,t),this.groundTilt.slerp(us,.06),this.groundTiltInv.copy(this.groundTilt).invert()}collisionAdjustment(t){let e=QB.set(0,0,0);this.object.matrix.compose(this.position,this.quaternion,this.scale);let i=LM.multiplyMatrices(this.object.matrix,this.objXZRotMat).multiply(this.collider.matrix).decompose(Er,us,Lo).compose(Er,us,tU);this.sharedGameControlGlobals.entitiesWithTransformAnim.forEach(r=>{if(r===this.object||r.isDescendantOf(this.object)||!r.bvhGeometry||!r.bvhGeometry.boundsTree)return;Ls.makeEmpty(),r.updateMatrixWorldRigid();let s=r.matrixWorldRigid,a=JB.copy(s).invert(),o=ztt.copy(JB).multiply(i);Qn.copy(this.collider.segment),Qn.start.applyMatrix4(o),Qn.end.applyMatrix4(o);let l=KB.copy(this.position).applyMatrix4(a);Ls.expandByPoint(Qn.start),Ls.expandByPoint(Qn.end),Ls.min.addScalar(-this.collider.radius),Ls.max.addScalar(this.collider.radius),r.bvhGeometry.boundsTree.shapecast({boundsTraverseOrder:c=>c.distanceToPoint(Qn.end),intersectsBounds:c=>c.intersectsBox(Ls),intersectsTriangle:c=>{let h=Er,d=Lo,u=c.closestPointToSegment(Qn,h,d);if(u<this.collider.radius){let p=this.collider.radius-u,f=d.sub(h).normalize(),g=iu.copy(l);g.addScaledVector(f,p);let m=g.applyMatrix4(s).sub(this.position);e.add(m),Qn.start.addScaledVector(f,p),Qn.end.addScaledVector(f,p)}}})}),Ls.makeEmpty(),Qn.copy(this.collider.segment),Qn.start.applyMatrix4(i),Qn.end.applyMatrix4(i),Ls.expandByPoint(Qn.start),Ls.expandByPoint(Qn.end),Ls.min.addScalar(-this.collider.radius),Ls.max.addScalar(this.collider.radius),this.sharedGameControlGlobals.staticMeshBVH?.shapecast({boundsTraverseOrder:r=>r.distanceToPoint(Qn.end),intersectsBounds:r=>r.intersectsBox(Ls),intersectsTriangle:r=>{let s=Er,a=Lo,o=r.closestPointToSegment(Qn,s,a);if(o<this.collider.radius){let l=this.collider.radius-o,c=a.sub(s).normalize();this.alignToGround&&this.groundTiltAdjustment(c),e.addScaledVector(c,l),Qn.start.addScaledVector(c,l),Qn.end.addScaledVector(c,l)}}}),this.onObject=Math.abs(e.y)>Math.abs(t*this.velocity.y*.25),this.onObject&&this.dispatchStopEvent("jump");let n=Math.max(0,e.length()-1e-5);e.normalize().multiplyScalar(n),this.position.add(e)}pause(){this.firstPointerId=-1,this.movementState={moveNegZ:0,movePosZ:0,moveNegX:0,movePosX:0,moveNegY:0,movePosY:0,rotPosX:0,rotNegX:0,rotPosY:0,rotNegY:0,jump:0,run:0},this.deactivate()}resume(){this.activate()}},o9=sC;o9.isLocked=!1,tt(),s0(),Cp(),Tp();var l9,h9,UM,qtt=new Promise(t=>{l9=t});function Xtt(t){return UM||(UM=async function(){let e=t??"https://cdn.spline.design/@splinetool/runtime@2.0.77/build";typeof window<"u"&&(h9=new URL(e.endsWith("/")?e:`${e}/`,window.location.href).href);let i=import("./navmesh.js"),[n,r]=await Promise.all([i,fetch(`${e}/navmesh.wasm`).then(o=>o.arrayBuffer())]),s=n.default,a=await s({wasmBinary:r});l9(a)}(),UM)}ti();var c9,Fe,ur,$tt=t=>`
9863
+ `)>=0&&(t-=r),i===3?.5*e-.5*t:i===2?e-t:0}getLineInitialOffsetY(t,e,i,n,r){let s=e*t,a=t-Math.abs(this.ascender-this.descender)*n,o=-this.ascender*n-a/2;return r===3?-(i-s-o):r===2?-(.5*i-.5*s-o):o}createPath(t,e,i,n,r){let s=t.getPath(i,-n,r.fontSize,{kerning:!1,letterSpacing:r.letterSpacing});if(!s)return void console.error('THREE.Font: character "'+t+'" does not exists in font family '+this.familyName+".");let a=new xtt,o=(t.advanceWidth??1)*e;if(t)for(let l of s.commands){let c=a.currentPath?.currentPoint;if(!c||l.type==="Z"||c.x!==l.x||-c.y!==l.y)switch(l.type){case"M":a.moveTo(l.x,-l.y);break;case"L":a.lineTo(l.x,-l.y);break;case"Q":a.quadraticCurveTo(l.x1,-l.y1,l.x,-l.y);break;case"C":a.bezierCurveTo(l.x1,-l.y1,l.x2,-l.y2,l.x,-l.y)}}return a.subPaths.forEach(l=>{let c=function(h){if(h.length){let d=h[0];if(d instanceof fs)return d.v1;if(d instanceof Fs||d instanceof $o)return d.v0}}(l.curves);c!==void 0&&l.currentPoint.distanceTo(c)>0&&l.lineTo(c.x,c.y)}),{offsetX:o,path:a}}getCharWidth(t,e){try{return this.font?.getAdvanceWidth(t,e.fontSize,{kerning:!0,letterSpacing:e.letterSpacing})??0}catch(i){return this.warnLayoutError(i),0}}getTextWidth(t,e){try{return this.font?.getAdvanceWidth(t,e.fontSize,{kerning:!0,letterSpacing:e.letterSpacing})??0}catch(i){return this.warnLayoutError(i),0}}computeSpaceWidthForLine(t,e,i,n){let r=this.getCharWidth(" ",i),s=t[e];if(s){let a=this.countSpaces(s.trimEnd());if(i.horizontalAlign===4&&e<t.length-1&&a)return((typeof i.width=="string"?Number(n.getVariable(i.width)):i.width)-(this.getTextWidth(s,i)-a*r))/a}return r}countSpaces(t){return(t.match(/ /g)||[]).length}},Si("text"),$t();var Qj=null;function GB(){return Qj}function Mtt(t){let e=!1;return t.scene.objects.forEach(i=>{i.data.type==="Page"&&!e&&i.data.publish.gameControlObject&&$c.traverseModuleInstances(t,i.id,(n,r,s)=>{for(let a of s)a.data.type==="GameControl"&&a.data.navmesh.enabled&&(e=!0)})}),e}ti();var Sy=(t,e)=>{let i=e.x-t.x,n=e.y-t.y;return Math.sqrt(i*i+n*n)},SM=t=>t*(Math.PI/180),My=new Map,Vb=(t,e,i)=>{let n,r=e.split(/[ ,]+/g);for(let s=0;s<r.length;s+=1)n=r[s],t.addEventListener?t.addEventListener(n,i,!1):t.attachEvent&&t.attachEvent(n,i)},jb=(t,e,i)=>{let n,r=e.split(/[ ,]+/g);for(let s=0;s<r.length;s+=1)n=r[s],t.removeEventListener?t.removeEventListener(n,i):t.detachEvent&&t.detachEvent(n,i)},Jj=t=>(t.preventDefault(),t.type.match(/^touch/)?t.changedTouches:t),HB=()=>{if(!(typeof window>"u"))return{x:window.pageXOffset!==void 0?window.pageXOffset:(document.documentElement||document.body.parentNode||document.body).scrollLeft,y:window.pageYOffset!==void 0?window.pageYOffset:(document.documentElement||document.body.parentNode||document.body).scrollTop}},MM=(t,e)=>{e.top||e.right||e.bottom||e.left?(t.style.top=e.top,t.style.right=e.right,t.style.bottom=e.bottom,t.style.left=e.left):(t.style.left=e.x+"px",t.style.top=e.y+"px")},EM=(t,e,i)=>{let n=t9(t);for(let r in n)if(Object.prototype.hasOwnProperty.call(n,r))if(typeof e=="string")n[r]=e+" "+i;else{let s="";for(let a=0,o=e.length;a<o;a+=1)s+=e[a]+" "+i+", ";n[r]=s.slice(0,-2)}return n},t9=t=>{let e={};return e[t]="",["webkit","Moz","o"].forEach(function(i){e[i+t.charAt(0).toUpperCase()+t.slice(1)]=""}),e},AM=(t,e)=>{for(let i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},nC=(t,e)=>{if(t.length)for(let i=0,n=t.length;i<n;i+=1)e(t[i]);else e(t)};typeof window<"u"&&(e9="ontouchstart"in window,i9=!!window.PointerEvent,n9=!!window.MSPointerEvent);var e9,i9,n9,Jd,WB={start:"mousedown",move:"mousemove",end:"mouseup"},om={};function _c(){}i9?Jd={start:"pointerdown",move:"pointermove",end:"pointerup, pointercancel"}:n9?Jd={start:"MSPointerDown",move:"MSPointerMove",end:"MSPointerUp"}:e9?(Jd={start:"touchstart",move:"touchmove",end:"touchend, touchcancel"},om=WB):Jd=WB,_c.prototype.on=function(t,e){var i,n=this,r=t.split(/[ ,]+/g);n._handlers_=n._handlers_||{};for(var s=0;s<r.length;s+=1)i=r[s],n._handlers_[i]=n._handlers_[i]||[],n._handlers_[i].push(e);return n},_c.prototype.off=function(t,e){var i=this;return i._handlers_=i._handlers_||{},t===void 0?i._handlers_={}:e===void 0?i._handlers_[t]=null:i._handlers_[t]&&i._handlers_[t].indexOf(e)>=0&&i._handlers_[t].splice(i._handlers_[t].indexOf(e),1),i},_c.prototype.trigger=function(t,e){var i,n=this,r=t.split(/[ ,]+/g);n._handlers_=n._handlers_||{};for(var s=0;s<r.length;s+=1)i=r[s],n._handlers_[i]&&n._handlers_[i].length&&n._handlers_[i].forEach(function(a){a.call(n,{type:i,target:n},e)})},_c.prototype.config=function(t){var e=this;e.options=e.defaults||{},t&&(e.options=((i,n)=>{let r={};for(let s in i)Object.prototype.hasOwnProperty.call(i,s)&&Object.prototype.hasOwnProperty.call(n,s)?r[s]=n[s]:Object.prototype.hasOwnProperty.call(i,s)&&(r[s]=i[s]);return r})(e.options,t))},_c.prototype.bindEvt=function(t,e){var i=this;return i._domHandlers_=i._domHandlers_||{},i._domHandlers_[e]=function(){typeof i["on"+e]=="function"?i["on"+e].apply(i,arguments):console.warn('[WARNING] : Missing "on'+e+'" handler.')},Vb(t,Jd[e],i._domHandlers_[e]),om[e]&&Vb(t,om[e],i._domHandlers_[e]),i},_c.prototype.unbindEvt=function(t,e){var i=this;return i._domHandlers_=i._domHandlers_||{},jb(t,Jd[e],i._domHandlers_[e]),om[e]&&jb(t,om[e],i._domHandlers_[e]),delete i._domHandlers_[e],this};var fP=_c;function Nn(t,e){return this.identifier=e.identifier,this.position=e.position,this.frontPosition=e.frontPosition,this.collection=t,this.defaults={size:100,threshold:.1,color:"white",fadeTime:250,dataOnly:!1,restJoystick:!0,restOpacity:1,mode:"dynamic",zone:document.body,lockX:!1,lockY:!1,shape:"circle"},this.config(e),this.options.mode==="dynamic"&&(this.options.restOpacity=0),this.id=Nn.id,Nn.id+=1,this.buildEl().stylize(),this.instance={el:this.ui.el,on:this.on.bind(this),off:this.off.bind(this),show:this.show.bind(this),hide:this.hide.bind(this),add:this.addToDom.bind(this),remove:this.removeFromDom.bind(this),destroy:this.destroy.bind(this),setPosition:this.setPosition.bind(this),resetDirection:this.resetDirection.bind(this),computeDirection:this.computeDirection.bind(this),trigger:this.trigger.bind(this),position:this.position,frontPosition:this.frontPosition,ui:this.ui,identifier:this.identifier,id:this.id,options:this.options},this.instance}Nn.prototype=new fP,Nn.constructor=Nn,Nn.id=0,Nn.prototype.buildEl=function(t){return this.ui={},this.options.dataOnly||(this.ui.el=document.createElement("div"),this.ui.back=document.createElement("div"),this.ui.front=document.createElement("div"),this.ui.el.className="nipple collection_"+this.collection.id,this.ui.back.className="back",this.ui.front.className="front",this.ui.el.setAttribute("id","nipple_"+this.collection.id+"_"+this.id),this.ui.el.appendChild(this.ui.back),this.ui.el.appendChild(this.ui.front)),this},Nn.prototype.stylize=function(){if(this.options.dataOnly)return this;var t=this.options.fadeTime+"ms",e=(()=>{let r=t9("borderRadius");for(let s in r)Object.prototype.hasOwnProperty.call(r,s)&&(r[s]="50%");return r})(),i=EM("transition","opacity",t),n={};return n.el={position:"absolute",opacity:this.options.restOpacity,display:"block",zIndex:999},n.back={position:"absolute",display:"block",width:this.options.size+"px",height:this.options.size+"px",marginLeft:-this.options.size/2+"px",marginTop:-this.options.size/2+"px",background:"rgba(255, 255, 255, .4)",border:"solid 2px rgba(0, 0, 0, .1)"},n.front={width:this.options.size/2+"px",height:this.options.size/2+"px",position:"absolute",display:"block",marginLeft:-this.options.size/4+"px",marginTop:-this.options.size/4+"px",background:"rgba(255, 255, 255, .8)",border:"solid 2px rgba(0, 0, 0, .1)"},AM(n.el,i),this.options.shape==="circle"&&AM(n.back,e),AM(n.front,e),this.applyStyles(n),this},Nn.prototype.applyStyles=function(t){for(var e in this.ui)if(Object.prototype.hasOwnProperty.call(this.ui,e))for(var i in t[e])this.ui[e].style[i]=t[e][i];return this},Nn.prototype.addToDom=function(){return this.options.dataOnly||document.body.contains(this.ui.el)||this.options.zone.appendChild(this.ui.el),this},Nn.prototype.removeFromDom=function(){return this.options.dataOnly||!document.body.contains(this.ui.el)||this.options.zone.removeChild(this.ui.el),this},Nn.prototype.destroy=function(){clearTimeout(this.removeTimeout),clearTimeout(this.showTimeout),clearTimeout(this.restTimeout),this.trigger("destroyed",this.instance),this.removeFromDom(),this.off(),this.ui=null,this.instance=null,this.collection=null,this.options=null},Nn.prototype.show=function(t){var e=this;return e.options.dataOnly||(clearTimeout(e.removeTimeout),clearTimeout(e.showTimeout),clearTimeout(e.restTimeout),e.addToDom(),e.restCallback(),setTimeout(function(){e.ui.el.style.opacity=1},0),e.showTimeout=setTimeout(function(){e.trigger("shown",e.instance),typeof t=="function"&&t.call(this)},e.options.fadeTime)),e},Nn.prototype.hide=function(t){var e=this;if(e.options.dataOnly)return e;if(e.ui.el.style.opacity=e.options.restOpacity,clearTimeout(e.removeTimeout),clearTimeout(e.showTimeout),clearTimeout(e.restTimeout),e.removeTimeout=setTimeout(function(){var i=e.options.mode==="dynamic"?"none":"block";e.ui.el.style.display=i,typeof t=="function"&&t.call(e),e.trigger("hidden",e.instance)},e.options.fadeTime),e.options.restJoystick){let i=e.options.restJoystick,n={};n.x=i===!0||i.x!==!1?0:e.instance.frontPosition.x,n.y=i===!0||i.y!==!1?0:e.instance.frontPosition.y,e.setPosition(t,n)}return e},Nn.prototype.setPosition=function(t,e){var i=this;i.frontPosition={x:e.x,y:e.y};var n=i.options.fadeTime+"ms",r={};r.front=EM("transition",["top","left"],n);var s={front:{}};s.front={left:i.frontPosition.x+"px",top:i.frontPosition.y+"px"},i.applyStyles(r),i.applyStyles(s),i.restTimeout=setTimeout(function(){typeof t=="function"&&t.call(i),i.restCallback()},i.options.fadeTime)},Nn.prototype.restCallback=function(){var t=this,e={};e.front=EM("transition","none",""),t.applyStyles(e),t.trigger("rested",t.instance)},Nn.prototype.resetDirection=function(){this.direction={x:!1,y:!1,angle:!1}},Nn.prototype.computeDirection=function(t){var e,i,n,r=t.angle.radian,s=Math.PI/4,a=Math.PI/2;if(r>s&&r<3*s&&!t.lockX?e="up":r>-s&&r<=s&&!t.lockY?e="left":r>3*-s&&r<=-s&&!t.lockX?e="down":t.lockY||(e="right"),t.lockY||(i=r>-a&&r<a?"left":"right"),t.lockX||(n=r>0?"up":"down"),t.force>this.options.threshold){var o,l={};for(o in this.direction)Object.prototype.hasOwnProperty.call(this.direction,o)&&(l[o]=this.direction[o]);var c={};for(o in this.direction={x:i,y:n,angle:e},t.direction=this.direction,l)l[o]===this.direction[o]&&(c[o]=!0);if(c.x&&c.y&&c.angle)return t;(!c.x||!c.y)&&this.trigger("plain",t),c.x||this.trigger("plain:"+i,t),c.y||this.trigger("plain:"+n,t),c.angle||this.trigger("dir dir:"+e,t)}else this.resetDirection();return t};var Ett=Nn;function dn(t,e){var i=this;i.nipples=[],i.idles=[],i.actives=[],i.ids=[],i.pressureIntervals={},i.manager=t,i.id=dn.id,dn.id+=1,i.defaults={zone:document.body,multitouch:!1,maxNumberOfNipples:10,mode:"dynamic",position:{top:0,left:0},catchDistance:200,size:100,threshold:.1,color:"white",fadeTime:250,dataOnly:!1,restJoystick:!0,restOpacity:1,lockX:!1,lockY:!1,shape:"circle",dynamicPage:!1,follow:!1},i.config(e),(i.options.mode==="static"||i.options.mode==="semi")&&(i.options.multitouch=!1),i.options.multitouch||(i.options.maxNumberOfNipples=1);let n=getComputedStyle(i.options.zone.parentElement);return n&&n.display==="flex"&&(i.parentIsFlex=!0),i.updateBox(),i.prepareNipples(),i.bindings(),i.begin(),i.nipples}dn.prototype=new fP,dn.constructor=dn,dn.id=0,dn.prototype.prepareNipples=function(){var t=this,e=t.nipples;e.on=t.on.bind(t),e.off=t.off.bind(t),e.options=t.options,e.destroy=t.destroy.bind(t),e.ids=t.ids,e.id=t.id,e.processOnMove=t.processOnMove.bind(t),e.processOnEnd=t.processOnEnd.bind(t),e.get=function(i){if(i===void 0)return e[0];for(var n=0,r=e.length;n<r;n+=1)if(e[n].identifier===i)return e[n];return!1}},dn.prototype.bindings=function(){var t=this;t.bindEvt(t.options.zone,"start"),t.options.zone.style.touchAction="none",t.options.zone.style.msTouchAction="none"},dn.prototype.begin=function(){var t=this,e=t.options;if(e.mode==="static"){var i=t.createNipple(e.position,t.manager.getIdentifier());i.add(),t.idles.push(i)}},dn.prototype.createNipple=function(t,e){var i=this,n=i.manager.scroll,r={},s=i.options,a=i.parentIsFlex?n.x:n.x+i.box.left,o=i.parentIsFlex?n.y:n.y+i.box.top;if(t.x&&t.y)r={x:t.x-a,y:t.y-o};else if(t.top||t.right||t.bottom||t.left){var l=document.createElement("DIV");l.style.display="hidden",l.style.top=t.top,l.style.right=t.right,l.style.bottom=t.bottom,l.style.left=t.left,l.style.position="absolute",s.zone.appendChild(l);var c=l.getBoundingClientRect();s.zone.removeChild(l),r=t,t={x:c.left+n.x,y:c.top+n.y}}var h=new Ett(i,{color:s.color,size:s.size,threshold:s.threshold,fadeTime:s.fadeTime,dataOnly:s.dataOnly,restJoystick:s.restJoystick,restOpacity:s.restOpacity,mode:s.mode,identifier:e,position:t,zone:s.zone,frontPosition:{x:0,y:0},shape:s.shape});return s.dataOnly||(MM(h.ui.el,r),MM(h.ui.front,h.frontPosition)),i.nipples.push(h),i.trigger("added "+h.identifier+":added",h),i.manager.trigger("added "+h.identifier+":added",h),i.bindNipple(h),h},dn.prototype.updateBox=function(){this.box=this.options.zone.getBoundingClientRect()},dn.prototype.bindNipple=function(t){var e,i=this,n=function(r,s){e=r.type+" "+s.id+":"+r.type,i.trigger(e,s)};t.on("destroyed",i.onDestroyed.bind(i)),t.on("shown hidden rested dir plain",n),t.on("dir:up dir:right dir:down dir:left",n),t.on("plain:up plain:right plain:down plain:left",n)},dn.prototype.pressureFn=function(t,e,i){var n=this,r=0;clearInterval(n.pressureIntervals[i]),n.pressureIntervals[i]=setInterval(function(){var s=t.force||t.pressure||t.webkitForce||0;s!==r&&(e.trigger("pressure",s),n.trigger("pressure "+e.identifier+":pressure",s),r=s)}.bind(n),100)},dn.prototype.onstart=function(t){var e=this,i=e.options,n=t;return t=Jj(t),e.updateBox(),nC(t,function(r){e.actives.length<i.maxNumberOfNipples?e.processOnStart(r):n.type.match(/^touch/)&&(Object.keys(e.manager.ids).forEach(function(s){if(Object.values(n.touches).findIndex(function(o){return o.identifier===s})<0){var a=[t[0]];a.identifier=s,e.processOnEnd(a)}}),e.actives.length<i.maxNumberOfNipples&&e.processOnStart(r))}),e.manager.bindDocument(),!1},dn.prototype.processOnStart=function(t){var e,i=this,n=i.options,r=i.manager.getIdentifier(t),s=t.force||t.pressure||t.webkitForce||0,a={x:t.pageX,y:t.pageY},o=i.getOrCreate(r,a);o.identifier!==r&&i.manager.removeIdentifier(o.identifier),o.identifier=r;var l=function(c){c.trigger("start",c),i.trigger("start "+c.id+":start",c),c.show(),s>0&&i.pressureFn(t,c,c.identifier),i.processOnMove(t)};if((e=i.idles.indexOf(o))>=0&&i.idles.splice(e,1),i.actives.push(o),i.ids.push(o.identifier),n.mode!=="semi")l(o);else{if(!(Sy(a,o.position)<=n.catchDistance))return o.destroy(),void i.processOnStart(t);l(o)}return o},dn.prototype.getOrCreate=function(t,e){var i,n=this,r=n.options;return/(semi|static)/.test(r.mode)?(i=n.idles[0])?(n.idles.splice(0,1),i):r.mode==="semi"?n.createNipple(e,t):(console.warn("Coudln't find the needed nipple."),!1):i=n.createNipple(e,t)},dn.prototype.processOnMove=function(t){var e=this,i=e.options,n=e.manager.getIdentifier(t),r=e.nipples.get(n),s=e.manager.scroll;if((_=>isNaN(_.buttons)?_.pressure!==0:_.buttons!==0)(t)){if(!r)return console.error("Found zombie joystick with ID "+n),void e.manager.removeIdentifier(n);if(i.dynamicPage){var a=r.el.getBoundingClientRect();r.position={x:s.x+a.left,y:s.y+a.top}}r.identifier=n;var o=r.options.size/2,l={x:t.pageX,y:t.pageY};i.lockX&&(l.y=r.position.y),i.lockY&&(l.x=r.position.x);var c,h,d=Sy(l,r.position),u=((_,b)=>{let x=b.x-_.x,w=b.y-_.y;return(S=>S*(180/Math.PI))(Math.atan2(w,x))})(l,r.position),p=SM(u),f=d/o,g={distance:d,position:l};if(r.options.shape==="circle"?(c=Math.min(d,o),h=((_,b,x)=>{let w={x:0,y:0};return x=SM(x),w.x=_.x-b*Math.cos(x),w.y=_.y-b*Math.sin(x),w})(r.position,c,u)):(h=((_,b,x)=>({x:Math.min(Math.max(_.x,b.x-x),b.x+x),y:Math.min(Math.max(_.y,b.y-x),b.y+x)}))(l,r.position,o),c=Sy(h,r.position)),i.follow){if(d>o){let _=l.x-h.x,b=l.y-h.y;r.position.x+=_,r.position.y+=b,r.el.style.top=r.position.y-(e.box.top+s.y)+"px",r.el.style.left=r.position.x-(e.box.left+s.x)+"px",d=Sy(l,r.position)}}else l=h,d=c;var m=l.x-r.position.x,v=l.y-r.position.y;r.frontPosition={x:m,y:v},i.dataOnly||MM(r.ui.front,r.frontPosition);var y={identifier:r.identifier,position:l,force:f,pressure:t.force||t.pressure||t.webkitForce||0,distance:d,angle:{radian:p,degree:u},vector:{x:m/o,y:-v/o},raw:g,instance:r,lockX:i.lockX,lockY:i.lockY};(y=r.computeDirection(y)).angle={radian:SM(180-u),degree:180-u},r.trigger("move",y),e.trigger("move "+r.id+":move",y)}else this.processOnEnd(t)},dn.prototype.processOnEnd=function(t){var e=this,i=e.options,n=e.manager.getIdentifier(t),r=e.nipples.get(n),s=e.manager.removeIdentifier(r.identifier);!r||(i.dataOnly||r.hide(function(){i.mode==="dynamic"&&(r.trigger("removed",r),e.trigger("removed "+r.id+":removed",r),e.manager.trigger("removed "+r.id+":removed",r),r.destroy())}),clearInterval(e.pressureIntervals[r.identifier]),r.resetDirection(),r.trigger("end",r),e.trigger("end "+r.id+":end",r),e.ids.indexOf(r.identifier)>=0&&e.ids.splice(e.ids.indexOf(r.identifier),1),e.actives.indexOf(r)>=0&&e.actives.splice(e.actives.indexOf(r),1),/(semi|static)/.test(i.mode)?e.idles.push(r):e.nipples.indexOf(r)>=0&&e.nipples.splice(e.nipples.indexOf(r),1),e.manager.unbindDocument(),/(semi|static)/.test(i.mode)&&(e.manager.ids[s.id]=s.identifier))},dn.prototype.onDestroyed=function(t,e){var i=this;i.nipples.indexOf(e)>=0&&i.nipples.splice(i.nipples.indexOf(e),1),i.actives.indexOf(e)>=0&&i.actives.splice(i.actives.indexOf(e),1),i.idles.indexOf(e)>=0&&i.idles.splice(i.idles.indexOf(e),1),i.ids.indexOf(e.identifier)>=0&&i.ids.splice(i.ids.indexOf(e.identifier),1),i.manager.removeIdentifier(e.identifier),i.manager.unbindDocument()},dn.prototype.destroy=function(){var t=this;for(var e in t.unbindEvt(t.options.zone,"start"),t.nipples.forEach(function(i){i.destroy()}),t.pressureIntervals)Object.prototype.hasOwnProperty.call(t.pressureIntervals,e)&&clearInterval(t.pressureIntervals[e]);t.trigger("destroyed",t.nipples),t.manager.unbindDocument(),t.off(),t.pressureIntervals={},t.nipples=[],t.idles=[],t.actives=[],t.ids=[],t.manager=null};var Att=dn;function En(t){var e=this;e.ids={},e.index=0,e.collections=[],e.scroll=HB(),e._windowBound=!1,e.config(t),e.prepareCollections();var i=function(){var n;e.collections.forEach(function(r){r.forEach(function(s){n=s.el.getBoundingClientRect(),s.position={x:e.scroll.x+n.left,y:e.scroll.y+n.top}})})};return e._onResize=function(){(n=>{My.has(n)&&clearTimeout(My.get(n)),My.set(n,setTimeout(function(){My.delete(n),n()},100))})(i)},e._onScroll=function(){e.scroll=HB()},e.collections}En.prototype=new fP,En.constructor=En,En.prototype.prepareCollections=function(){var t=this;t.collections.create=t.create.bind(t),t.collections.on=t.on.bind(t),t.collections.off=t.off.bind(t),t.collections.destroy=t.destroy.bind(t),t.collections.get=function(e){var i;return t.collections.every(function(n){return!(i=n.get(e))}),i}},En.prototype.create=function(t){return this.createCollection(t)},En.prototype.bindWindowEvents=function(){var t=this;t._windowBound||typeof window>"u"||(t._windowBound=!0,Vb(window,"resize",t._onResize),Vb(window,"scroll",t._onScroll))},En.prototype.unbindWindowEvents=function(){var t=this;!t._windowBound||typeof window>"u"||(t._windowBound=!1,jb(window,"resize",t._onResize),jb(window,"scroll",t._onScroll))},En.prototype.createCollection=function(t){var e=this,i=new Att(e,t);return e.bindCollection(i),e.collections.push(i),e.bindWindowEvents(),i},En.prototype.bindCollection=function(t){var e,i=this,n=function(r,s){e=r.type+" "+s.id+":"+r.type,i.trigger(e,s)};t.on("destroyed",i.onDestroyed.bind(i)),t.on("shown hidden rested dir plain",n),t.on("dir:up dir:right dir:down dir:left",n),t.on("plain:up plain:right plain:down plain:left",n)},En.prototype.bindDocument=function(){var t=this;t.binded||(t.bindEvt(document,"move").bindEvt(document,"end"),t.binded=!0)},En.prototype.unbindDocument=function(t){var e=this;(!Object.keys(e.ids).length||t===!0)&&(e.unbindEvt(document,"move").unbindEvt(document,"end"),e.binded=!1)},En.prototype.getIdentifier=function(t){var e;return t?(e=t.identifier===void 0?t.pointerId:t.identifier)===void 0&&(e=this.latest||0):e=this.index,this.ids[e]===void 0&&(this.ids[e]=this.index,this.index+=1),this.latest=e,this.ids[e]},En.prototype.removeIdentifier=function(t){var e={};for(var i in this.ids)if(this.ids[i]===t){e.id=i,e.identifier=this.ids[i],delete this.ids[i];break}return e},En.prototype.onmove=function(t){return this.onAny("move",t),!1},En.prototype.onend=function(t){return this.onAny("end",t),!1},En.prototype.oncancel=function(t){return this.onAny("end",t),!1},En.prototype.onAny=function(t,e){var i,n=this,r="processOn"+t.charAt(0).toUpperCase()+t.slice(1);e=Jj(e);var s=function(a,o,l){l.ids.indexOf(o)>=0&&(l[r](a),a._found_=!0)};return nC(e,function(a){i=n.getIdentifier(a),nC(n.collections,s.bind(null,a,i)),a._found_||n.removeIdentifier(i)}),!1},En.prototype.destroy=function(){var t=this;t.unbindDocument(!0),t.unbindWindowEvents(),t.ids={},t.index=0,t.collections.forEach(function(e){e.destroy()}),t.collections=[],t.off()},En.prototype.onDestroyed=function(t,e){var i=this;if(i.collections.indexOf(e)<0)return!1;i.collections.splice(i.collections.indexOf(e),1),i.collections.length===0&&i.unbindWindowEvents()};var Ttt=En,op=null;function qB(){return op||(op=new Ttt),op}var Ctt={create:function(t){return qB().create(t)},destroy:function(){op&&(op.destroy(),op=null)},get factory(){return qB()}},Ptt=Ctt;ti(),$t(),tt(),Ws(),qr(),$t();var r9=null;function TM(){return r9}var s9,CM,Dtt=new Promise(t=>{s9=t});function Rtt(t){return CM||(CM=async function(){let e=t??"https://cdn.spline.design/@splinetool/runtime@2.0.79/build",i=import("./physics.js"),[n,r]=await Promise.all([i,fetch(`${e}/physics.wasm`).then(s=>s.arrayBuffer())]);await n.init(r),s9(n)}(),CM)}function a9(t){let e=t.elements,i=e[0]**2+e[1]**2+e[2]**2,n=e[4]**2+e[5]**2+e[6]**2,r=e[8]**2+e[9]**2+e[10]**2,s=e[0]**2+e[4]**2+e[8]**2,a=e[1]**2+e[5]**2+e[9]**2,o=e[2]**2+e[6]**2+e[10]**2,l=1e-8;return i<l||n<l||r<l||s<l||a<l||o<l}function qo(t,e){let i=new jt;if(e&&a9(e))return i.setAttribute("position",new Nt([],3)),i.setIndex([]),i;if(!t.getAttribute("position"))return i.setAttribute("position",new Nt([],3)),i.setIndex([]),i;let{positions:n,triIndices:r}=D3(t.getAttribute("position"),t.getIndex());return i.setAttribute("position",new Nt(n,3)),i.setIndex(r),e&&i.applyMatrix4(e),i}Bi(),qr(),ke(),j3(),tt(),tt(),Tp(),s0();var Ge,Itt=class{constructor(t,e,i,n,r,s){this.id=t,this.data=e,this.object=i,this.initialDisabled=!1,this.actions=Rn(e,e.actions,n,r,s,i),this.target=e.target}disconnect(){rr(this.actions)}dispatch(t){this.initialDisabled||(this.actions.Transition.forEach(e=>{e.object.currentTransitionEvent!==this&&(e.object.currentTransitionEvent=this,e.init())}),this.object.dispatchEvent({type:"beginEvent",eventName:"Collision"}),this.actions.Transition.forEach(e=>e.play()),this.actions.Animation.forEach(e=>{"runMode"in e.data&&e.data.runMode==="Toggle"?e.toggle():e.play()}),this.actions.TimelineAnimation.forEach(e=>{"runMode"in e.data&&e.data.runMode==="Toggle"?e.toggle():e.play()}),this.actions.Reset.forEach(e=>{e.dispatch()}),this.actions.Link.forEach(e=>{e.dispatch()}),this.actions.Reset.forEach(e=>{e.dispatch()}),this.actions.Create.forEach(e=>{e.dispatch()}),this.actions.Destroy.forEach(e=>{e.dispatch(t??!1)}),this.actions.SetVariable.forEach(e=>e.checkConditions()),this.actions.SetVariable.forEach(e=>e.dispatch()),this.actions.DynamicVariablePlay.forEach(e=>e.dispatch()),this.actions.Audio.forEach(e=>{e.dispatchBasic()}),this.actions.Particles.forEach(e=>{e.dispatchBasic()}),this.actions.Video.forEach(e=>{e.dispatchBasic()}),this.actions.ClearLocalStorage.forEach(e=>e.dispatch()),this.actions.UserAPI.forEach(e=>e.dispatch()))}},XB=class{constructor(t,e,i,n,r,s){this.id=t,this.data=e,this.object=i,this.page=n,this.currentIntersectedObjects=[],this.actions=Rn(e,e.actions,n,r,s,i),this.target=e.target,this.triggeringObjects=[];for(let a of e.triggeringObjects){let o=n.scene.find(a);o&&this.triggeringObjects.push(o)}}isValidTriggeringObject(t){return this.target==="all"||this.triggeringObjects.some(e=>e===t||e.isAncestorOf(t.uuid)||t.isAncestorOf(e.uuid))}disconnect(){rr(this.actions)}dispatch(){this.object.destroyedInAction||(this.actions.Transition.forEach(t=>{t.object.currentTransitionEvent!==this&&(t.object.currentTransitionEvent=this,t.init())}),this.object.dispatchEvent({type:"beginEvent",eventName:"Trigger"}),this.actions.Transition.forEach(t=>t.play()),this.actions.SwitchCamera.forEach(t=>{t.data.runMode==="Toggle"?t.toggle():t.play()}),this.actions.TimelineAnimation.forEach(t=>{"runMode"in t.data&&t.data.runMode==="Toggle"?t.toggle():t.play()}),this.actions.Link.forEach(t=>{t.dispatch()}),this.actions.Reset.forEach(t=>{t.dispatch()}),this.actions.Create.forEach(t=>{t.dispatch()}),this.actions.Destroy.forEach(t=>{t.dispatch(!1)}),this.actions.Audio.forEach(t=>{t.dispatchBasic()}),this.actions.Particles.forEach(t=>{t.dispatchBasic()}),this.actions.Video.forEach(t=>{t.dispatchBasic()}),this.actions.SceneTransition.forEach(t=>{t.dispatch()}),this.actions.SetVariable.forEach(t=>t.checkConditions()),this.actions.SetVariable.forEach(t=>t.dispatch()),this.actions.DynamicVariablePlay.forEach(t=>t.dispatch()),this.actions.ClearLocalStorage.forEach(t=>t.dispatch()),this.actions.UserAPI.forEach(t=>t.dispatch()))}};Bi(),Dtt.then(t=>Ge=t);var Mn=new T,Os=new Wt,Ll=new T,$B=(new xi(0,0,0,"YXZ"),new xi(0,0,0,"XYZ")),na=new T,PM=new T,DM=new T(1,1,1),tu=new Wt,Ey=new At,YB=new At,Ott={type:"updateMatrix"},ZB=new Wt,RM=new yr,IM=.01,rC={type:"beginEvent",eventName:"Collision"},Ltt={type:"beginEvent",eventName:"Trigger"},Gb=t=>t.states.some(e=>e.data.position!==void 0||e.data.rotation!==void 0||e.data.hiddenMatrix!==void 0||e.data.cloner!==void 0||e.data.pathSnapping!==void 0);function eu(t){return function(e){return typeof e=="object"&&e!==null&&"booleanOp"in e}(Cc(t)?t.object:t)}var Btt=class{constructor(t){this.eventContext=t,this.isEnabled=!1,this.gameControl=null,this.joysticks=[],this.joystickToGameControls=[],this.sharedGameControlGlobals={entitiesWithTransformAnim:[],entityToCollisionEvents:{},colliderToEntity:new Map,kinematicBodyToEntity:new Map,triggers:[],gamePads:[],createdObjects:[],nCreatedPerAction:{}},this.sensorToTriggerEvent={},this.eventManager=void 0,this.needsCollisionDetection=!1,this.initializationCounter=-1,this.fixedBodiesToWatch=[],this.rigidBodyToMesh=new Map,this.nActiveRigidBodies=0,this.collisionEvents=[],this.isExport=!1,this.skipRender=!0,this._staticBVHAttrIds=new WeakMap,this._staticBVHNextAttrId=1,this.processRigidBody=e=>{if(e.bodyType()!==Ge.RigidBodyType.Dynamic)return;e.isSleeping()||this.nActiveRigidBodies++;let[i,n,r]=this.rigidBodyToMesh.get(e.handle);if(Mn.copy(e.translation()).multiplyScalar(this.pixelsPerMeter),Os.copy(e.rotation()),i.matrixWorld.compose(Mn,Os,n),i.hasNonUniformScale&&i.matrixWorld.multiply(i.shearScale),i.dispatchEvent(Ott),r){let s=i.cloner;if(s&&s.objectForSample===void 0){s.matrixWorld.copy(i.matrixWorld);for(let a of s.children)a.updateMatrixWorld(!0)}for(let a of i.children)a.updateMatrixWorld(!0)}},this.accumulator=0,this.handleCollisionEvents=(e,i,n)=>{if(n===!1)return;let r,s;if(this.sensorToTriggerEvent[e]?(r=this.sensorToTriggerEvent[e],s=this.sharedGameControlGlobals.colliderToEntity.get(i)):this.sensorToTriggerEvent[i]&&(r=this.sensorToTriggerEvent[i],s=this.sharedGameControlGlobals.colliderToEntity.get(e)),r&&s&&r.isValidTriggeringObject(s))r.dispatch();else{for(let a=this.sharedGameControlGlobals.createdObjects.length-1;a>=0;a--){let o=this.sharedGameControlGlobals.createdObjects[a];if(o.userData.hasCollisionDestroy&&(o.rigidBody?.collider(0).handle===e||o.rigidBody?.collider(0).handle===i)){this.sharedGameControlGlobals.createdObjects.splice(a,1),o.removeFromParent();let l=o.rigidBody;requestAnimationFrame(()=>{o.rigidBody===l&&(this.sharedGameControlGlobals.rapierWorld?.removeRigidBody(l),o.rigidBody=void 0)});break}}if(this.gameControl?.object!==void 0&&this.gameControl.object===this.sharedGameControlGlobals.colliderToEntity.get(e)){let a=this.sharedGameControlGlobals.colliderToEntity.get(i),o=this.sharedGameControlGlobals.entityToCollisionEvents[a.uuid];if(o===void 0)return;for(let l of o)l.data.target==="character"&&this.dispatchCollisionEvent(l,a,i)}else if(this.gameControl?.object!==void 0&&this.gameControl.object===this.sharedGameControlGlobals.colliderToEntity.get(i)){let a=this.sharedGameControlGlobals.colliderToEntity.get(e),o=this.sharedGameControlGlobals.entityToCollisionEvents[a.uuid];if(o===void 0)return;for(let l of o)l.data.target==="character"&&this.dispatchCollisionEvent(l,a,e)}else{let a=this.sharedGameControlGlobals.colliderToEntity.get(e),o=this.sharedGameControlGlobals.entityToCollisionEvents[a.uuid];if(o!==void 0)for(let h of o)h.data.target==="scene"&&this.dispatchCollisionEvent(h,a,e);let l=this.sharedGameControlGlobals.colliderToEntity.get(i),c=this.sharedGameControlGlobals.entityToCollisionEvents[l?.uuid];if(c!==void 0)for(let h of c)h.data.target==="scene"&&this.dispatchCollisionEvent(h,l,i)}}},this.isExport=t.isExport,this.sharedAssets=t.sharedAssets,this.renderer=t.renderer,this.requestRender=t.requestRender,this.domElement=this.renderer.domElement,this.pixelsPerMeter=200,this.gravity=this.page.data.globalPhysics.gravity}get page(){return this.eventContext.page}markIsDestroyTarget(){this.page.traverseVisibleEntity(t=>{let e=t.dataPatched;for(let i of e.events){if(i.data.disabled===!0)continue;let n=i.data.actions?.find(r=>r.data.type==="Destroy")?.data;if(n)for(let r of n.objects){let s=this.page.scene.find(r);s&&(s.userData.hasDestroy=!0)}}})}markIsDragObject(){this.page.traverseVisibleEntity(t=>{let e=t.dataPatched;for(let i of e.events)if(i.data.disabled!==!0&&i.data.type==="DragDrop")for(let n of i.data.objects){let r=this.page.scene.find(n);r&&(r.userData.hasDrag=!0)}})}_staticBVHIdOf(t){let e=this._staticBVHAttrIds.get(t);return e===void 0&&(e=this._staticBVHNextAttrId++,this._staticBVHAttrIds.set(t,e)),e}initBVH(){if(TM()===null)return void Gn("collision-bvh","trigger/collision detection");let t=[],e=[];if(this.page.traverseChildren(i=>{let n,r=i instanceof np,s=gg(i);if(zu(i)||r||s)return;n=Cc(i)?i.object:i;let a=n.dataPatched;if(a.physics?.enabled==="visibility"?!a.visible:!a.physics?.enabled)return!0;let o=i.geometry,l=n.userData.hasDestroy===!0,c=n.userData.hasDrag===!0;if(Gb(a)||l||c||n.dataPatched.events.some(h=>h.data.disabled!==!0&&(h.data.type==="GameControl"||h.data.type==="Follow")))return i.updateMatrixWorldRigid(),this.addBoundsTree(i),!0;if(o){let h=o.getAttribute("position");if(h!==void 0&&h.count>0){t.push({geometry:o,matrixWorld:i.matrixWorld}),e.push(o.id,this._staticBVHIdOf(h),h.version,o.index!==null?this._staticBVHIdOf(o.index):-1,o.index!==null?o.index.version:-1);for(let d of i.matrixWorld.elements)e.push(d)}}return!!eu(i)||void 0}),t.length>0){let i=this._staticBVHCache;if(i!==void 0&&i.signature.length===e.length&&i.signature.every((s,a)=>s===e[a]))return void(this.sharedGameControlGlobals.staticMeshBVH=i.bvh);let n=Tc(t.map(s=>qo(s.geometry,s.matrixWorld)),!1),r=new(TM())(n);this._staticBVHCache={signature:e,bvh:r},this.sharedGameControlGlobals.staticMeshBVH=r}}addRigidBody(t,e,i){if(a9(t.matrixWorld))return;let n=[],r="geometry"in t?t.geometry:void 0,s=e.dataPatched;if(r?.getAttribute("position")!==void 0&&n.push(qo(r,t.shearScale)),s.physics.fusedBody){let a=this.gatherChildrenGeom(t,n);t.traverseObject(a),t.children.forEach(l=>l.updateMatrixWorld(!0));let o=t.cloner;o&&o.objectForSample===void 0&&s.physics.rigidBody==="dynamic"&&(o.traverseObject(a),o.children.forEach(l=>l.updateMatrixWorld(!0)))}if(n.length>0){let a,o=!1,l=!i.fromCreate&&s.physics.rigidBody==="dynamic"||i.fromCreate&&i.dynamic;l?(a=Ge.RigidBodyDesc.dynamic(),a.setLinearDamping(s.physics.damping).setAngularDamping(s.physics.damping).setAdditionalMass(1e-9).setGravityScale(s.physics.gravityScale).enabledRotations(...s.physics.enabledRotation).enabledTranslations(...s.physics.enabledTranslation)):(i.hasTransformAnim||i.hasFollow||i.hasDrag)&&!i.fromCreate?(a=Ge.RigidBodyDesc.kinematicPositionBased(),o=!0):a=Ge.RigidBodyDesc.fixed();let c=Tc(n);(t.hasNonUniformScale?t.matrixWorldRigid:t.matrixWorld).decompose(Mn,Os,Ll),t.position0=Mn.clone().divideScalar(this.pixelsPerMeter),t.rotation0=Os.clone(),Mn.divideScalar(this.pixelsPerMeter),a.setTranslation(Mn.x,Mn.y,Mn.z).setRotation(Os),r?c?.scale(1/this.pixelsPerMeter,1/this.pixelsPerMeter,1/this.pixelsPerMeter):c?.scale(Ll.x/this.pixelsPerMeter,Ll.y/this.pixelsPerMeter,Ll.z/this.pixelsPerMeter);let h=this.sharedGameControlGlobals.rapierWorld.createRigidBody(a),d=!(s.geometry===void 0||s.geometry.type==="SubdivGeometry"||s.geometry.type==="NonParametricGeometry"||s.geometry.type==="BooleanGeometry"||s.geometry.type==="VectorGeometry"||s.geometry.type==="StarGeometry"||s.geometry.type==="RectangleGeometry"||s.geometry.type==="EllipseGeometry"||s.geometry.type==="TriangleGeometry"||s.geometry.type==="TorusGeometry"||s.geometry.type==="HelixGeometry");try{this.addCollider(h,s.physics,c,e,d)}catch{try{this.addCollider(h,s.physics,c,e,!1)}catch(u){console.error(u)}}if(h.numColliders()===0)return void this.sharedGameControlGlobals.rapierWorld.removeRigidBody(h);l?this.rigidBodyToMesh.set(h.handle,[t,Ll.clone(),s.physics.fusedBody]):o?(this.sharedGameControlGlobals.kinematicBodyToEntity.set(h.handle,t),this.sharedGameControlGlobals.entitiesWithTransformAnim.push(t)):this.fixedBodiesToWatch.push([t,h,(t.hasNonUniformScale?t.matrixWorldRigid:t.matrixWorld).clone()]),t.rigidBody=h}}addBoundsTree(t){let e=[];if(t.geometry?.getAttribute("position")!==void 0&&t.geometry?.getAttribute("position").count>0&&e.push(qo(t.geometry,t.shearScale)),t.traverseObject(this.gatherChildrenGeom(t,e)),t.children.forEach(i=>i.updateMatrixWorld(!0)),e.length>0){let i=Tc(e,!1);t.bvhGeometry=i,i.getAttribute("position").count>0&&(t.bvhGeometry.boundsTree=new(TM())(i),this.sharedGameControlGlobals.entitiesWithTransformAnim.push(t))}}addCollider(t,e,i,n,r=!0){if(i?.getAttribute("position").count===0||i?.getIndex()?.count===0)return;let s;i&&(s=e.colliderType==="trimesh"?Ge.ColliderDesc.trimesh(i.getAttribute("position").array,i.getIndex().array):Ge.ColliderDesc.convexMesh(i.getAttribute("position").array,r?i.getIndex().array:void 0)),s.setFrictionCombineRule(Ge.CoefficientCombineRule.Average).setRestitutionCombineRule(Ge.CoefficientCombineRule.Average).setDensity(e.density).setFriction(e.friction).setRestitution(e.restitution);let a=this.sharedGameControlGlobals.rapierWorld.createCollider(s,t);this.sharedGameControlGlobals.colliderToEntity.set(a.handle,n),this.sharedGameControlGlobals.entityToCollisionEvents[n.uuid]?.some(o=>o.target==="scene")&&a.setActiveEvents(Ge.ActiveEvents.COLLISION_EVENTS)}gatherChildrenGeom(t,e){let i=eu(t);return(n,r)=>{if(r===0)return;if(i&&n.parent===t)return!0;let s;if(zu(n)){if(!n.objectForSample)return n.object.dataPatched.physics.fusedBody===!0&&n.object.dataPatched.physics.rigidBody==="dynamic"||void 0;if(n.objectForSample.dataPatched.physics.fusedBody)return;s=n.object}else if(Cc(n))s=n.object;else if(s=n,s.dataPatched.cloner?.hideBase)return!0;let a=s.dataPatched;if(a.physics.enabled==="visibility"?!a.visible:!a.physics.enabled)return!0;r===1?t.hasNonUniformScale?n.matrixWorld.multiplyMatrices(t.shearScale,n.hiddenMatrix):n.matrixWorld.copy(n.hiddenMatrix):n.matrixWorld.multiplyMatrices(n.parent.matrixWorld,n.hiddenMatrix),n.matrixWorld.multiply(n.matrix);let o=n.geometry;return o?.getAttribute("position")!==void 0&&e.push(qo(o,n.matrixWorld)),!!eu(n)||void 0}}activate(t){if(this.isEnabled)return;this.isEnabled=!0,this.eventManager=t,this.usePhysics=this.page.data.globalPhysics.usePhysics;let e=this.page.playCamera,i=!1;this.page.traverseEntity(a=>{for(let o of a.dataPatched.events)if(o.data.disabled===!1&&o.data.type==="Trigger")return this.needsCollisionDetection=!0,!0});let n=GB();if(n!==null?i=n.setup({manager:this,camera:e,renderer:this.renderer,sharedAssets:this.sharedAssets,eventContext:this.eventContext,isExport:this.isExport})||i:this.page.data.publish.gameControlObject!==null&&Gn("game-controls","the scene's game controls"),i===!1){let{enableRotate:a,enablePan:o,enableZoom:l,autoRotate:c,hoverRotatePanMode:h}=this.eventManager.publish.orbitControls;(a||o||l||c||h!==0)&&(this.orbitControls=new Dj(e,this.renderer.domElement,{isExport:this.isExport,isPlayMode:!0}),this.orbitControls.addEventListener("change",this.requestRender),this.orbitControls.addEventListener("end",this.requestRender),this.orbitControls.addEventListener("start",this.requestRender),this.orbitControls.fromJSON(this.eventManager.publish.orbitControls,this.eventManager.publish.mouseEventTarget),this.orbitControls.useKeyEvents=!1,this.orbitControls.addEventListenersToCamera(),this.orbitControls.connect(),this.orbitControls.update())}let r=this.renderer.domElement.width/this.renderer.getPixelRatio(),s=this.renderer.domElement.height/this.renderer.getPixelRatio();GB()?.createJoysticks(this,r,s),this.markIsDestroyTarget(),this.markIsDragObject(),this.rebuildBVH(),this.initializationCounter++,window.setTimeout(()=>{this.collisionEvents.forEach(a=>a.initialDisabled=!1)},80)}initPhysics(){this.sharedGameControlGlobals.rapierWorld?.free(),this.sharedGameControlGlobals.rapierWorld=new Ge.World(new Ge.Vector3(0,this.gravity,0)),this.events=new Ge.EventQueue(!0);let t=[],e=[];if(this.page.traverseChildren(a=>{let o;if(zu(a)){if(!a.objectForSample)return a.object.dataPatched.physics.fusedBody===!0&&a.object.dataPatched.physics.rigidBody==="dynamic"||void 0;if(a.objectForSample.dataPatched.physics.fusedBody)return;o=a.object}else if(Cc(a))o=a.object;else{if(gg(a)||Yc(a)||a instanceof np)return;if(o=a,o.dataPatched.cloner?.disabled===!1&&o.dataPatched.cloner?.hideBase&&o.dataPatched.physics?.fusedBody!==!0)return!0}let l,c=o.dataPatched;for(let m of c.events)m.data.disabled!==!0&&m.data.type==="GameControl"&&(l=m.data);if(!c.physics||(c.physics.enabled==="visibility"?!c.visible:!c.physics.enabled))return!0;a.updateMatrixWorldRigid();let h=Gb(c),d=!1,u=o.userData.hasDestroy,p=o.userData.hasDrag,f=!1;for(let m of c.events)if(m.data.disabled!==!0){if(m.data.type==="Collision"){d=!0;let v=new Itt(m.id,m.data,o,this.page,this.sharedAssets,this.eventManager);v.initialDisabled=!0,this.collisionEvents.push(v),this.sharedGameControlGlobals.entityToCollisionEvents[o.uuid]&&this.sharedGameControlGlobals.entityToCollisionEvents[o.uuid].every(y=>y.id!==m.id)?this.sharedGameControlGlobals.entityToCollisionEvents[o.uuid].push(v):this.sharedGameControlGlobals.entityToCollisionEvents[o.uuid]=[v]}else if(m.data.type==="Follow"){f=!0;let v=m.data.target;a.traverseVisible(y=>{y.userData.isFollowingObj=v})}}c.physics.rigidBody==="dynamic"&&c.physics.fusedBody===!1&&(a.matrixWorldFusedFalse=a.matrixWorld.clone());let g=a.geometry;if(l!==void 0){let m=Ge.RigidBodyDesc.kinematicPositionBased();(a.hasNonUniformScale?a.matrixWorldRigid:a.matrixWorld).decompose(Mn,Os,Ll),a.position0=Mn.clone().divideScalar(this.pixelsPerMeter),a.rotation0=Os.clone(),Mn.divideScalar(this.pixelsPerMeter),m.setTranslation(Mn.x,Mn.y,Mn.z).setRotation(Os);let v,y=this.sharedGameControlGlobals.rapierWorld.createRigidBody(m);a.rigidBody=y,v=l.collider.type==="sphere"?Ge.ColliderDesc.ball(l.collider.radius/this.pixelsPerMeter):l.collider.type==="capsule"?Ge.ColliderDesc.capsule((l.collider.height/2-l.collider.radius)/this.pixelsPerMeter,l.collider.radius/this.pixelsPerMeter):Ge.ColliderDesc.cuboid(l.collider.width/this.pixelsPerMeter/2,l.collider.height/this.pixelsPerMeter/2,l.collider.depth/this.pixelsPerMeter/2),v.setFrictionCombineRule(Ge.CoefficientCombineRule.Average).setDensity(c.physics.density).setFriction(c.physics.friction).setRestitution(0).setRestitutionCombineRule(Ge.CoefficientCombineRule.Min);let _=this.sharedGameControlGlobals.rapierWorld.createCollider(v,y);this.sharedGameControlGlobals.colliderToEntity.set(_.handle,o),Mn.fromArray(l.collider.position.map(x=>typeof x=="number"?x:0)).multiply(Ll.setFromMatrixScale(o.matrixWorld)).divideScalar(this.pixelsPerMeter),_.setTranslationWrtParent(Mn);let b=new Wt().setFromEuler(new xi().setFromVector3(new T().fromArray(l.collider.rotation.map(x=>typeof x=="number"?x:0))));_.setRotationWrtParent(b),_.setActiveEvents(Ge.ActiveEvents.COLLISION_EVENTS),this.generateSensorColliderDescs(o,!0)}else c.physics.rigidBody==="dynamic"||h||f||u||p||d?(this.addRigidBody(a,o,{hasFollow:f,hasTransformAnim:h,hasDrag:p}),this.generateSensorColliderDescs(o,c.physics.fusedBody)):(g&&t.push(qo(g,a.matrixWorld)),c.physics.fusedBody&&!eu(a)&&a.traverseObject((m,v)=>{if(v===0)return;let y;if(zu(m)){if(!m.objectForSample)return m.object.dataPatched.physics.fusedBody===!0&&m.object.dataPatched.physics.rigidBody==="dynamic"||void 0;if(m.objectForSample.dataPatched.physics.fusedBody)return;y=m.object}else{if(gg(m)||Yc(m)||m instanceof np)return;if(Cc(m))y=m.object;else if(y=m,y.dataPatched.cloner?.hideBase)return!0}let _=y.dataPatched;if(_.physics.enabled==="visibility"?!_.visible:!_.physics.enabled)return!0;let b=m.geometry;return b?.getAttribute("position")!==void 0&&t.push(qo(b,m.matrixWorld)),!!eu(m)||void 0}),this.generateSensorColliderDescs(o,c.physics.fusedBody,e));return!(c.physics?.fusedBody!==!0&&!l&&!eu(a))||void 0}),t.length===0)return;let i=Tc(t),n=i.getIndex().count>0;if(!n&&e.length===0)return;i.scale(1/this.pixelsPerMeter,1/this.pixelsPerMeter,1/this.pixelsPerMeter);let r=Ge.RigidBodyDesc.fixed(),s=this.sharedGameControlGlobals.rapierWorld.createRigidBody(r);if(n){let a=Ge.ColliderDesc.trimesh(i.getAttribute("position").array,i.getIndex().array).setFrictionCombineRule(Ge.CoefficientCombineRule.Multiply).setRestitutionCombineRule(Ge.CoefficientCombineRule.Multiply).setFriction(1).setRestitution(1);this.sharedGameControlGlobals.rapierWorld.createCollider(a,s)}for(let[a,o]of e){let l=this.sharedGameControlGlobals.rapierWorld.createCollider(a,s);this.sensorToTriggerEvent[l.handle]=o}}updatePositions(){return this.nActiveRigidBodies=0,this.sharedGameControlGlobals.rapierWorld.forEachRigidBody(this.processRigidBody),this.nActiveRigidBodies>0}rebuildBVH(){this.usePhysics?this.initPhysics():(this.page.traverseEntity(t=>{for(let e of t.dataPatched.events)if(e.data.type==="Trigger"&&e.data.disabled!==!0){let i=new XB(e.id,e.data,t,this.page,this.sharedAssets,this.eventManager),n=new At().compose(na.fromArray(e.data.position.map(r=>typeof r=="number"?r:0)),tu.setFromEuler($B.fromArray(e.data.rotation.map(r=>typeof r=="number"?r:0))),DM);if(e.data.triggerZone==="box"){let r=new ci;r.min.fromArray(e.data.size.map(s=>typeof s=="number"?s:0)).multiplyScalar(-.5),r.max.fromArray(e.data.size.map(s=>typeof s=="number"?s:0)).multiplyScalar(.5),this.sharedGameControlGlobals.triggers.push([r,n,t,i])}else this.sharedGameControlGlobals.triggers.push([e.data.radius,n,t,i])}}),this.needsCollisionDetection&&this.initBVH())}disconnectEvents(){this.collisionEvents.forEach(t=>t.disconnect()),this.sharedGameControlGlobals.triggers.forEach(t=>t[3].disconnect()),this.sharedGameControlGlobals.triggers.length=0}deactivate(){if(this.isEnabled){this.isEnabled=!1,this.page.traverse(t=>{let e=t;e.matrixWorldFusedFalse&&(e.matrixWorldFusedFalse=void 0),e.rigidBody&&(e.rigidBody=void 0),e.position0&&(e.position0=void 0),e.rotation0&&(e.rotation0=void 0)}),this.sharedGameControlGlobals.rapierWorld?.free(),this.sharedGameControlGlobals.rapierWorld=void 0,this.sharedGameControlGlobals.staticMeshBVH=void 0,this.accumulator=0,this.sharedGameControlGlobals.entitiesWithTransformAnim=[],this.sharedGameControlGlobals.kinematicBodyToEntity.clear(),this.fixedBodiesToWatch=[],this.disconnectEvents(),this.gameControl?.reset(),this.gameControl?.dispose(),this.gameControl=null,this.initializationCounter=-1,this.joysticks.forEach(([t,e])=>{t?.destroy(),e.remove()}),this.joystickToGameControls=[],this.joysticks=[],this.orbitControls&&(this.orbitControls.dispose(),this.orbitControls=void 0),this.navigationMeshWrapper?.dispose(),this.navigationMeshWrapper=void 0;for(let t of Object.values(this.sharedGameControlGlobals.entityToCollisionEvents))t.forEach(e=>e.disconnect());this.sharedGameControlGlobals.entityToCollisionEvents={},this.page.updateMatrixWorld(!0)}}update(t){if(!this.isEnabled)return!0;let e=!0;if(this.orbitControls!==void 0&&this.orbitControls.needsUpdate&&(this.orbitControls.update(),e=!this.orbitControls.isCurrentlyDamping),this.initializationCounter>=0&&this.initializationCounter<2?(this.initializationCounter++,e=!1):this.initializationCounter===2&&this.gameControl&&(e=!this.gameControl.update(t)&&e),this.usePhysics===!1&&this.checkTrigger(),this.usePhysics){let i=.016666666666666666;if(t===0)e=this.stepPhysics()&&e;else{let n=t/1e3;n<i&&n>.55*i&&(n=i),this.accumulator+=n;let r=performance.now(),s=0,a=6;for(;this.accumulator>=i&&s<a&&(e=this.stepPhysics()&&e,this.accumulator-=i,s++,!(performance.now()-r>1e3*i)););this.accumulator=this.accumulator%i}}this.skipRender=e}recordPhysicsPose(t){(t.hasNonUniformScale?t.matrixWorldRigid:t.matrixWorld).decompose(Mn,Os,Ll);let e=t;e.prevQ===void 0?(e.prevQ=Os.clone(),e.prevT=Mn.clone()):(e.prevQ.copy(Os),e.prevT.copy(Mn))}promoteMovedFixedBodies(){for(let t=this.fixedBodiesToWatch.length-1;t>=0;t--){let[e,i,n]=this.fixedBodiesToWatch[t];e.rigidBody===i?(e.hasNonUniformScale?e.matrixWorldRigid:e.matrixWorld).equals(n)||(i.setBodyType(Ge.RigidBodyType.KinematicPositionBased,!0),this.sharedGameControlGlobals.kinematicBodyToEntity.set(i.handle,e),this.sharedGameControlGlobals.entitiesWithTransformAnim.push(e),this.fixedBodiesToWatch.splice(t,1)):this.fixedBodiesToWatch.splice(t,1)}}clampPushedBodies(){let t=this.gameControl?.object.rigidBody;if(t===void 0)return;let e=this.sharedGameControlGlobals.rapierWorld,i=t.linvel(),n=t.translation(),r=Math.hypot(i.x,i.z);for(let s=0;s<t.numColliders();s++){let a=t.collider(s);e.contactPairsWith(a,o=>{let l=o.parent();if(l===null||!l.isDynamic())return;let c=l.translation(),h=-1/0,d=0,u=0;if(e.contactPair(a,o,v=>{let y=v.normal(),_=y.x*(c.x-n.x)+y.y*(c.y-n.y)+y.z*(c.z-n.z)<0?-1:1;if(Math.abs(y.y)>.7)return;let b=_*y.x,x=_*y.z,w=Math.hypot(b,x);if(w<1e-4)return;let S=(i.x*b+i.z*x)/w;S>h&&(h=S,d=b/w,u=x/w)}),h===-1/0)return;let p=i.x*d+i.z*u;if(p<-IM)return;let f=l.linvel();if(r>IM&&p>IM){let v=f.x*d+f.z*u;if(v<=0)return;let y=Math.min(v,p);return void l.setLinvel({x:d*y,y:f.y,z:u*y},!0)}let g=f.x*d+f.z*u-Math.max(0,p);if(g<=0)return;let m=.5*g;l.setLinvel({x:f.x-d*m,y:f.y,z:f.z-u*m},!0)})}}stepPhysics(){this.promoteMovedFixedBodies();let t=this.sharedGameControlGlobals.kinematicBodyToEntity;for(let[e,i]of t)i.rigidBody!==void 0?(this.recordPhysicsPose(i),i.rigidBody.setNextKinematicTranslation(Mn.divideScalar(this.pixelsPerMeter)),i.rigidBody.setNextKinematicRotation(Os)):t.delete(e);for(let e of this.sharedGameControlGlobals.entitiesWithTransformAnim)e.rigidBody?.isKinematic()!==!0&&this.recordPhysicsPose(e);return this.sharedGameControlGlobals.rapierWorld.step(this.events),this.clampPushedBodies(),this.events?.drainCollisionEvents(this.handleCollisionEvents),!this.updatePositions()}dispatchCollisionEvent(t,e,i){let n,r=(this.sharedGameControlGlobals.rapierWorld?.getCollider(i))._parent;if(e.cloner){for(let s of e.cloner.children)if(s.rigidBody===r){n=s;break}}t.dispatch(n),e.dispatchEvent(rC)}updateUseWindowEvents(t){this.orbitControls?.updateUseWindowEvents(t)}generateSensorColliderDescs(t,e,i){let n=YB.copy(t.matrixWorld).invert();t.traverseEntity((r,s)=>{if(e===!1&&s===1)return!0;for(let a of r.dataPatched.events)if(a.data.type==="Trigger"&&a.data.disabled!==!0){let o,l=new XB(a.id,a.data,r,this.page,this.sharedAssets,this.eventManager);if(o=a.data.triggerZone==="box"?Ge.ColliderDesc.cuboid(...a.data.size.map(c=>(typeof c=="number"?c:1)/(2*this.pixelsPerMeter))):Ge.ColliderDesc.ball(a.data.radius/this.pixelsPerMeter),o.setDensity(0).setSensor(!0).setActiveEvents(Ge.ActiveEvents.COLLISION_EVENTS),na.fromArray(a.data.position.map(c=>typeof c=="number"?c:0)),tu.setFromEuler($B.fromArray(a.data.rotation.map(c=>typeof c=="number"?c:0))),Ey.compose(na,tu,DM).premultiply(r.matrixWorld),i?(Ey.decompose(na,tu,PM),o.setActiveCollisionTypes(Ge.ActiveCollisionTypes.KINEMATIC_FIXED|Ge.ActiveCollisionTypes.DYNAMIC_FIXED)):(Ey.premultiply(n).decompose(na,tu,PM),t.rigidBody.bodyType()===Ge.RigidBodyType.Dynamic||(t.rigidBody.bodyType()===Ge.RigidBodyType.Fixed?o.setActiveCollisionTypes(Ge.ActiveCollisionTypes.KINEMATIC_FIXED|Ge.ActiveCollisionTypes.DYNAMIC_FIXED):o.setActiveCollisionTypes(Ge.ActiveCollisionTypes.KINEMATIC_KINEMATIC|Ge.ActiveCollisionTypes.DYNAMIC_KINEMATIC))),na.divideScalar(this.pixelsPerMeter),o.setTranslation(na.x,na.y,na.z),o.setRotation(tu),i)i.push([o,l]);else{let c=this.sharedGameControlGlobals.rapierWorld.createCollider(o,t.rigidBody);this.sensorToTriggerEvent[c.handle]=l}}})}checkTrigger(){let t;for(let e=0;e<this.sharedGameControlGlobals.triggers.length;e++){let[i,n,r,s]=this.sharedGameControlGlobals.triggers[e];for(let a=0;a<this.sharedGameControlGlobals.entitiesWithTransformAnim.length;a++){let o=this.sharedGameControlGlobals.entitiesWithTransformAnim[a];if(r===o||s.isValidTriggeringObject(Be.is(o)?o:o.object)===!1)continue;let l=YB.copy(r.matrixWorld).decompose(na,ZB,PM).compose(na,ZB,DM).multiply(n),c=Ey.copy(o.matrixWorld).invert().multiply(l),h=o.bvhGeometry.boundsTree;i instanceof ci?t=h.intersectsBox(i,c):(RM.radius=i,RM.center.setFromMatrixPosition(c),t=h.intersectsSphere(RM)),t?s.currentIntersectedObjects.indexOf(o)===-1&&(s.currentIntersectedObjects.push(o),s.dispatch(),r.dispatchEvent(Ltt)):s.currentIntersectedObjects=s.currentIntersectedObjects.filter(d=>d!==o)}}}};Cp(),tt(),vb(),Ye(),Mh();var OM=.02,KB=new T,QB=new T,Utt=new T,Er=new T,Lo=new T,iu=new T,LM=new At,JB=new At,ztt=new At,us=new Wt,hc=new Wt,nu=new xi(0,0,0,"YXZ"),Ftt=new T(1,0,0),Na=new T(0,1,0),Ntt=new T(0,0,1),tU=new T(1,1,1),eU=[],iU=t=>eU[t]??(eU[t]=new T),BM=new T,ktt=new T,Vtt=new T,jtt=new T,nU=new Wt,Gtt=new T,rU=new Wt,Qn=new ys,Ls=new ci,Htt={type:"requestRender"},Wtt={type:"updateMatrix"},sC=class extends Vn{constructor(t,e,i,n,r,s,a,o,l){super(),this.object=t,this.domElement=e,this.data=i,this.gloabalPhysics=n,this.controlsManager=r,this.cameraFollow=s,this.camera=a,this.page=o,this.sharedAssets=l,this.enableDamping=!0,this.hiddenMatrix0=new At,this.target0=new T,this.zoom0=1,this.rotForce=1,this.moveForce=1,this.pixelsPerMeter=200,this.euler0=new xi(0,0,0,"YXZ"),this.position0Cam=new T,this.quat0Cam=new Wt,this.scale0Cam=new T,this.hiddenMatrix0Cam=new At,this.threshEndTranslate=.01,this.threshEndRotate=1e-8,this.threshEndRotVel=.005,this.collider={type:"capsule",radius:40,segment:new ys(new T(0,-40,0),new T(0,40,0)),matrix:new At,position:new T,rotation:new Wt},this.euler=new xi(0,0,0,"YXZ"),this.eulerDelta=new T,this.lastPosition=new T,this.lastCameraQuaternion=new Wt,this.lastCameraPosition=new T,this.PI_2=Math.PI/2,this.prevMouse=new et,this.velocityTarget=new T,this.velocity=new T,this.directionXZ=new T,this.rotVelocityStick=new T,this.rotVelocityTarget=new T,this.rotVelocity=new T,this.rotDirection=new T,this.nonColliderRotOffset=new At,this.nonColliderPosOffset=new At,this.firstPointerId=-1,this.rot=new T,this.path=[],this.movementState={moveNegZ:0,movePosZ:0,moveNegX:0,movePosX:0,moveNegY:0,movePosY:0,rotPosX:0,rotNegX:0,rotPosY:0,rotNegY:0,jump:0,run:0},this.onObject=!1,this.actionState={},this.keyAssignments=[["moveNegZ","W"],["moveNegX","A"],["movePosZ","S"],["movePosX","D"],["rotPosX","ArrowUp"],["rotPosY","ArrowLeft"],["rotNegX","ArrowDown"],["rotNegY","ArrowRight"],["jump"," "]],this.collisionEnabled=!0,this.offsetMatrix=new At,this.objectToTarget=new T,this.objectToTarget0=new T,this.objectToCamXZ=new T,this.objectToCamXZ0=new T,this.targetToCamera=new T,this.targetToCamera0=new T,this.cameraPolarAxis0=new T,this.targetPos=new T,this.targetQuat=new Wt,this.lerpFactorPos=new T().setScalar(.3),this.lerpFactorPosStart=.3,this.lerpFactorPosEnd=.3,this.lerpFactorRotStart=.3,this.lerpFactorRotEnd=.3,this.lerpFactorPosCamera=.3,this.lerpFactorRotCamera=.3,this.objXZQuat=new Wt,this.objXZQuatInv=new Wt,this.objXZRotMat=new At,this.isFirstPerson=!1,this.didHit=!1,this.groundVelocity=new T,this.pushedVelocity=new T,this.groundYRotation=0,this.objectRealQuat=new Wt,this.colliderWorldQuat=new Wt,this.groundNormal=new T,this.groundTilt=new Wt,this.groundTiltInv=new Wt,this.lastHitObj=null,this.isFirstFrame=!0,this.rotationAccumWhenOrientWithCamera=0,this.navMeshPathDest=null,this.position=new T,this.quaternion=new Wt,this.scale=new T,this.initialAction=!0,this.onPointerDown=f=>{!(f.target===this.domElement||f.target instanceof HTMLElement&&f.target.tagName==="SPLINE-VIEWER"&&f.target.shadowRoot?.contains(this.domElement))||this.firstPointerId!==-1||(this.firstPointerId=f.pointerId,this.domElement.ownerDocument.addEventListener("pointermove",this.onPointerMove),this.domElement.ownerDocument.addEventListener("pointerup",this.onPointerUp),this.rotBy!=="keys"&&!as&&!QE&&this.domElement.requestPointerLock(),this.prevMouse.set(f.clientX,f.clientY))},this.onPointerUp=f=>{this.firstPointerId=-1,this.domElement.ownerDocument.removeEventListener("pointermove",this.onPointerMove),this.domElement.ownerDocument.removeEventListener("pointerup",this.onPointerUp),f.pointerType==="mouse"&&this.domElement.ownerDocument.exitPointerLock()},this.onPointerMove=f=>{if(f.pointerId!==this.firstPointerId)return;let g=f.clientX-this.prevMouse.x,m=f.clientY-this.prevMouse.y;this.prevMouse.set(f.clientX,f.clientY),f.pointerType==="mouse"&&this.rotBy!=="keys"&&(QE&&ZF<15.5&&!as?(this.eulerDelta.y=-g*this.mouseOrbitSensitivity,this.eulerDelta.x=-m*this.mouseOrbitSensitivity):(this.eulerDelta.y=-f.movementX*this.mouseOrbitSensitivity,this.eulerDelta.x=-f.movementY*this.mouseOrbitSensitivity)),f.pointerType!=="mouse"&&this.rotByTouch==="drag"&&(this.eulerDelta.y=-g*this.mouseOrbitSensitivity*5,this.eulerDelta.x=-m*this.mouseOrbitSensitivity*5),this.controlsManager.requestRender()},this.onPointerlockChange=f=>{this.domElement.ownerDocument.pointerLockElement===this.domElement?sC.isLocked=!0:sC.isLocked=!1},this.onPointerlockError=()=>{console.error("SPE.GameControls: Unable to use Pointer Lock API")},this.handleVisibilityChange=()=>{if(document?.hidden)for(let f in this.movementState)this.movementState[f]=0},this.onKeyDown=f=>{!(f.target instanceof HTMLInputElement)&&(f.code==="ArrowLeft"||f.code==="ArrowUp"||f.code==="ArrowRight"||f.code==="ArrowDown"||f.code==="Space")&&f.preventDefault();for(let g of this.keyAssignments)if(f.key.toUpperCase()===g[1]||f.key===g[1]){this.movementState[g[0]]=1;break}this.controlsManager.requestRender()},this.onKeyUp=f=>{for(let g of this.keyAssignments)if(f.key.toUpperCase()===g[1]||f.key===g[1]||f.code.slice(3,f.code.length).toUpperCase()===g[1]){this.movementState[g[0]]=0;break}},this.copyVRGamePadValues=(f,g)=>{for(let m=2;m<4;m++){let v=f.axes[m];g===0?m===2?this.movementState.movePosX=v:this.movementState.movePosZ=v:(f.buttons[3].pressed?this.movementState.jump=1:this.movementState.jump=0,m===2?this.movementState.rotPosY=v:this.moveMode==="fly"&&(this.movementState.moveNegY=v))}},this.sharedGameControlGlobals=r.sharedGameControlGlobals,t===a&&(this.isFirstPerson=!0),this.hiddenMatrix0.copy(this.object.hiddenMatrix),this.object.parent?this.object.hiddenMatrix.copy(this.object.parent.matrixWorld).invert():this.object.hiddenMatrix.identity(),this.object.matrix.copy(this.object.matrixWorld),this.object.matrix.decompose(this.position,this.quaternion,this.scale),this.euler0.setFromQuaternion(this.quaternion,"YXZ");let c=this.euler0.clone(),h=c.y;if(this.objectRealQuat.copy(this.quaternion),c.y=0,this.quaternion.setFromEuler(c),this.objXZQuat.copy(this.quaternion),this.objXZQuatInv.copy(this.objXZQuat).invert(),this.objXZRotMat.makeRotationFromQuaternion(this.quaternion),c.set(0,h,0),this.quaternion.setFromEuler(c),this.rot.setFromEuler(c),this.object.matrixAutoUpdate=!1,(this.isFirstPerson||this.cameraFollow===!0)&&(this.target0.copy(this.camera.getTarget()),this.zoom0=this.camera.zoom),this.cameraFollow===!0){this.position0Cam.copy(this.camera.position),this.quat0Cam.copy(this.camera.quaternion),this.scale0Cam.copy(this.camera.scale),this.hiddenMatrix0Cam.copy(this.camera.hiddenMatrix),this.camera.parent?(this.camera.hiddenMatrix.copy(this.camera?.parent.matrixWorld),this.camera.matrix.copy(this.camera.matrixWorld)):this.camera.hiddenMatrix.identity(),this.camera.matrix.copy(this.camera.matrixWorld),this.camera.matrix.decompose(this.camera.position,this.camera.quaternion,this.camera.scale),this.camera.matrixAutoUpdate=!1,this.offsetMatrix.copy(this.object.matrix).invert().multiply(this.camera.matrix);let f,g=new T(0,0,-1).applyQuaternion(this.camera.quaternion),m=new T().subVectors(this.position,this.camera.position);this.objectToCamXZ.copy(m),this.objectToCamXZ.y=0,this.objectToCamXZ0.copy(this.objectToCamXZ),Math.abs(g.y)<1e-6?(m.y=0,g.y=0,f=m.projectOnVector(g)):f=m.y/g.y>0?g.multiplyScalar(m.y/g.y):g.multiplyScalar(m.length()),this.targetToCamera0.copy(f).negate();let v=this.camera.position.clone().add(f);this.objectToTarget0.subVectors(v,this.position);let y=new xi().setFromQuaternion(this.camera.quaternion,"YXZ");this.cameraPolarOffset=-y.x,y.x=0,y.z=0,y.y-=Math.PI/2,this.cameraPolarAxis0.set(0,0,-1).applyEuler(y)}if(this.object instanceof Zi&&(this.object.matrixAutoUpdate=!1),this.euler.setFromQuaternion(this.quaternion,"YXZ"),this.rotByTouch=i.rotByTouch??"joystick",this.rotBy=i.rotBy??"keys",this.rotationMode=i.rotationMode??"normal",this.moveMode=i.moveMode??"walk",this.collisionEnabled=i.collisionEnabled,this.speedTranslate=1*(i.speedTranslate??250),this.speedOrbit=.025*(i.speedRotate??100),this.mouseOrbitSensitivity=16e-6*(i.speedRotate??100),this.keyAssignments=i.keyAssignments.map(f=>{let g=[f[0],f[1]];return g[1]==="\u25B2"?g[1]="ArrowUp":g[1]==="\u25C0"?g[1]="ArrowLeft":g[1]==="\u25BC"?g[1]="ArrowDown":g[1]==="\u25B6"?g[1]="ArrowRight":g[1]==="\u21E7"?g[1]="Shift":g[1]==="\u21B5"?g[1]="Enter":g[1]==="Space"?g[1]=" ":g[1]==="\u2318"?g[1]="Meta":g[1]==="Ctrl"?g[1]="Control":g[1]==="Esc"&&(g[1]="Escape"),g}),i.rotBy==="mouse"){let f;f=this.keyAssignments.findIndex(g=>g[0]==="rotNegX"),f!==-1&&(this.keyAssignments[f][1]=""),f=this.keyAssignments.findIndex(g=>g[0]==="rotPosX"),f!==-1&&(this.keyAssignments[f][1]=""),f=this.keyAssignments.findIndex(g=>g[0]==="rotPosY"),f!==-1&&(this.keyAssignments[f][1]=""),f=this.keyAssignments.findIndex(g=>g[0]==="rotNegY"),f!==-1&&(this.keyAssignments[f][1]="")}this.lerpFactorPosStart=1-.02**(1/(60*(i.delayPos[0]??.3))),this.lerpFactorPosEnd=1-.02**(1/(60*(i.delayPos[1]??.3))),this.lerpFactorPos.setScalar(this.lerpFactorPosStart),this.lerpFactorRotStart=1-.02**(1/(60*(i.delayRot[0]??.3))),this.lerpFactorRotEnd=1-.02**(1/(60*(i.delayRot[1]??.3))),this.lerpFactorPosCamera=1-.02**(1/(60*(i.delayPosCamera??.3))),this.lerpFactorRotCamera=1-.02**(1/(60*(i.delayRotCamera??.3))),this.gravity=12*(this.gloabalPhysics.gravity??Qu.defaultData.gravity),this.usePhysics=this.gloabalPhysics.usePhysics??Qu.defaultData.usePhysics,this.jumpPower=20*i.jumpPower,this.resetYPosition=this.position.y+Math.abs(i.resetYPosition)*(this.gravity>0?1:-1),this.alignToGround=i.alignToGround??!1,this.orientMode=i.autoOrientMove?i.orientMode:"none",this.orientWith=i.orientWith??hb.defaultDataThirdPerson.orientWith,this.slopeThresh=65*Math.PI/180,i.collider.type==="capsule"?(this.collider.radius=i.collider.radius,this.collider.segment.start.y=i.collider.height/2-i.collider.radius,this.collider.segment.end.y=-this.collider.segment.start.y,this.offset=i.collider.height*OM/this.pixelsPerMeter,this.stepThresh=.3*i.collider.height/this.pixelsPerMeter,this.colliderHeight=i.collider.height):i.collider.type==="sphere"?(this.collider.radius=i.collider.radius,this.collider.segment.start.y=0,this.collider.segment.end.y=0,this.offset=2*i.collider.radius*OM/this.pixelsPerMeter,this.stepThresh=2*i.collider.radius*.3/this.pixelsPerMeter,this.colliderHeight=2*i.collider.radius):(this.offset=i.collider.height*OM/this.pixelsPerMeter,this.stepThresh=.3*i.collider.height/this.pixelsPerMeter,this.colliderHeight=i.collider.height),this.collider.type=i.collider.type;let d=new T().fromArray(i.collider.position.map(f=>typeof f=="number"?f:0)),u=new Wt().setFromEuler(new xi().fromArray([...i.collider.rotation.map(f=>typeof f=="number"?f:0),"XYZ"]));this.collider.position.copy(d).multiply(this.scale),this.collider.rotation.copy(u),this.collider.matrix.compose(d,u,tU),i.cameraXAxis!==void 0&&(this.cameraXAxis=i.cameraXAxis,this.cameraYAxis=i.cameraYAxis,this.minPolarAngle=i.cameraRotXLimits[0],this.maxPolarAngle=i.cameraRotXLimits[1],this.minAzimuthAngleRel=i.cameraRotYLimits[0],this.maxAzimuthAngleRel=i.cameraRotYLimits[1]),this.forwardDir=i.forwardDirection??"-z",this.isFirstPerson&&(this.forwardDir="-z"),this.runMultiplier=i.runMultiplier??2;let p=2*i.navmesh.destinationHelperRadius;if(p>0){let f=new Vt;f.push({fi:0,data:{...tn.defaultData("light","phong"),alpha:0},id:"layer1"}),f.push({fi:0,data:{...tn.defaultData("color"),color:i.navmesh.destinationHelperColor,alpha:i.navmesh.destinationHelperColor.a},id:"layer2"});let g=T6({layers:f},{scene:this.page.scene,shared:this.sharedAssets});this.navMeshPathDest=new gi(x3.create({parameters:{width:p,height:p/10,hollow:.7}}),g),this.navMeshPathDest.material.userData.opacity0=i.navmesh.destinationHelperColor.a}this.activate()}reset(t=!1){if(this.object.hiddenMatrix.copy(this.hiddenMatrix0),t){this.object.updateMatrix(),this.object.updateMatrixWorld(),this.object.matrix.copy(this.object.matrixWorld),this.object.matrix.decompose(this.position,this.quaternion,this.scale),this.object.parent?this.object.hiddenMatrix.copy(this.object.parent.matrixWorld).invert():this.object.hiddenMatrix.identity();let e=new xi().setFromQuaternion(this.quaternion,"YXZ"),i=e.y;this.objectRealQuat.copy(this.quaternion),e.y=0,this.quaternion.setFromEuler(e),this.objXZQuat.copy(this.quaternion),this.objXZQuatInv.copy(this.objXZQuat).invert(),this.objXZRotMat.makeRotationFromQuaternion(this.quaternion),e.set(0,i,0),this.quaternion.setFromEuler(e),this.rot.setFromEuler(e),this.euler.setFromQuaternion(this.quaternion,"YXZ"),this.velocityTarget.set(0,0,0),this.velocity.set(0,0,0)}else this.object instanceof Zi?this.object.matrixAutoUpdate=!0:this.object.updateMatrix();this.cameraFollow===!0&&(this.camera.quaternion.copy(this.quat0Cam),this.camera.position.copy(this.position0Cam),this.camera.scale.copy(this.scale0Cam),this.camera.hiddenMatrix.copy(this.hiddenMatrix0Cam),this.camera.matrixAutoUpdate=!0),this.controlsManager.requestRender()}activate(){this.instantiateActions(),this.domElement.ownerDocument.addEventListener("pointerdown",this.onPointerDown),this.domElement.ownerDocument.addEventListener("keydown",this.onKeyDown),this.domElement.ownerDocument.addEventListener("keyup",this.onKeyUp),this.domElement.ownerDocument.addEventListener("pointerlockchange",this.onPointerlockChange),this.domElement.ownerDocument.addEventListener("pointerlockerror",this.onPointerlockError),this.domElement.ownerDocument.addEventListener("visibilitychange",this.handleVisibilityChange)}deactivate(){this.disposeActions(),this.domElement.ownerDocument.removeEventListener("pointerdown",this.onPointerDown),this.domElement.ownerDocument.removeEventListener("keydown",this.onKeyDown),this.domElement.ownerDocument.removeEventListener("keyup",this.onKeyUp),this.domElement.ownerDocument.removeEventListener("pointerlockchange",this.onPointerlockChange),this.domElement.ownerDocument.removeEventListener("pointerlockerror",this.onPointerlockError),this.domElement.ownerDocument.removeEventListener("visibilitychange",this.handleVisibilityChange)}dispose(){this.deactivate(),this.navMeshPathDest?.parent&&this.page.remove(this.navMeshPathDest)}instantiateActions(){let t=this.data,e=this.sharedAssets;t.gameActions!==void 0&&(this.actions={},lb.list.forEach(i=>{this.actions[i]=Rn({...t,disabled:!1,type:"GameControl"},t.gameActions[i],this.page,e,this.controlsManager.eventManager,this.object)})),this.dispatchStopEvent("move"),this.dispatchStopEvent("run"),this.dispatchStopEvent("jump"),this.dispatchStartEvent("idle"),this.initialAction&&(this.initialAction=!1)}disposeActions(){this.initialAction=!1,this.dispatchStopEvent("idle"),this.dispatchStopEvent("move"),this.dispatchStopEvent("run"),this.dispatchStopEvent("jump"),rr(this.actions.idle),rr(this.actions.move),rr(this.actions.run),rr(this.actions.jump)}dispatchStartEvent(t){this.actions[t]!==void 0&&(this.actionState[t]||(this.actionState[t]=!0,this.actions[t].Transition.forEach(e=>{e.play()}),this.actions[t].Animation.forEach(e=>{e.play(this.initialAction===!1)}),this.actions[t].TimelineAnimation.forEach(e=>{e.play()}),this.actions[t].Create.forEach(e=>{e.dispatchStart()}),this.actions[t].Audio.forEach(e=>{e.dispatchGameControl("start")}),this.actions[t].Particles.forEach(e=>{e.dispatchGameControl("start")})))}dispatchStopEvent(t){this.actions[t]!==void 0&&(!this.actionState[t]||(this.actionState[t]=!1,this.actions[t].Transition.forEach(e=>{e.stop(),e.object.currentState!==null&&e.object.changeSelectedState(null,{scene:this.page.scene,shared:this.sharedAssets})}),this.actions[t].TimelineAnimation.forEach(e=>{e.stop()}),this.actions[t].Create.forEach(e=>{e.dispatchStop()}),this.actions[t].Audio.forEach(e=>{e.dispatchGameControl("stop")}),this.actions[t].Particles.forEach(e=>{e.dispatchGameControl("stop")})))}get colliderWorldPosition(){return Er.copy(this.collider.position).applyQuaternion(this.objectRealQuat).add(this.position)}update(t){if(this.gravity<0?this.position.y<this.resetYPosition:this.position.y>this.resetYPosition)return this.reset(!0),!0;this.sharedGameControlGlobals.gamePads.forEach(this.copyVRGamePadValues);let e=(this.isFirstFrame?16.6:t)/1e3;this.isFirstFrame&&(this.isFirstFrame=!1);let i=60*e,n=!1;if(this.groundYRotation=0,this.groundVelocity.set(0,0,0),this.usePhysics&&this.collisionEnabled&&this.object.rigidBody?.collider(0).shape){let s=Lo.set(0,(this.velocity.y===0?this.pixelsPerMeter*Math.max(Math.abs(this.gravity)/120,1)*(this.gravity>0?1:-1):this.velocity.y)*e,0).divideScalar(this.pixelsPerMeter),a=this.sharedGameControlGlobals.rapierWorld.castShape(this.colliderWorldPosition.divideScalar(this.pixelsPerMeter),this.colliderWorldQuat,s,this.object.rigidBody?.collider(0).shape,0,1,!1,8,void 0,void 0,this.object.rigidBody);if(a){this.onObject=!0,this.groundNormal.set(a.normal2.x,a.normal2.y,a.normal2.z).applyQuaternion(this.colliderWorldQuat).negate(),this.alignToGround&&this.groundTiltAdjustment(this.groundNormal),Math.acos(this.groundNormal.y)<this.slopeThresh&&(n=!0),a.collider.parent()?.bodyType()===0&&Math.acos(this.groundNormal.y)*(180/Math.PI)>45&&(this.onObject=!1);let o=a.collider.parent(),l=o!==null&&o.isKinematic()?o:null,c=l===null?void 0:this.sharedGameControlGlobals.kinematicBodyToEntity.get(l.handle);if(l!==null&&c?.userData.isFollowingObj!==this.object.uuid){let h=this.object.getWorldPosition(Er).add(this.collider.position).divideScalar(this.pixelsPerMeter),d=l.velocityAtPoint(h);this.groundVelocity.set(d.x,d.y,d.z).multiplyScalar(this.pixelsPerMeter),this.groundYRotation=l.angvel().y*e}}else this.onObject=!1}if(this.moveMode==="walk"&&this.collisionEnabled&&(this.movementState.jump===1&&this.onObject&&(this.velocityTarget.y=this.jumpPower,this.movementState.jump=0,this.dispatchStopEvent("idle"),this.dispatchStopEvent("move"),this.dispatchStopEvent("run"),this.dispatchStopEvent("jump"),this.dispatchStartEvent("jump"),this.onObject=!1),this.onObject?this.velocityTarget.y/=2:this.velocityTarget.y+=this.gravity*i),this.moveMode==="fly"&&(this.velocityTarget.y=(this.movementState.movePosY-this.movementState.moveNegY)*this.speedTranslate),this.directionXZ.z=this.movementState.movePosZ-this.movementState.moveNegZ,this.directionXZ.x=this.movementState.movePosX-this.movementState.moveNegX,this.forwardDir==="+z"&&this.directionXZ.multiplyScalar(-1),this.directionXZ.manhattanLength()>0&&(this.path=[]),this.navMeshPathDest){let s=this.navMeshPathDest.material;if(this.moveMode==="walk"&&this.path.length>1){this.navMeshPathDest.position.copy(this.path[this.path.length-1]),this.navMeshPathDest.parent||this.page.add(this.navMeshPathDest);let a=Er.subVectors(this.path[1],this.position),o=Lo.subVectors(this.path[1],this.path[0]);a.dot(o)<0?this.path.shift():(this.directionXZ.x=o.x,this.directionXZ.z=o.z),s.opacity=s.userData.opacity0}else s.opacity-=.05*s.userData.opacity0,this.navMeshPathDest.material.opacity<=0&&this.navMeshPathDest.parent&&this.page.remove(this.navMeshPathDest)}this.directionXZ.normalize(),this.movementState.run?this.moveForce=this.runMultiplier:this.moveForce=1,this.velocityTarget.z=this.directionXZ.z*this.speedTranslate*this.moveForce,this.velocityTarget.x=this.directionXZ.x*this.speedTranslate*this.moveForce,(this.moveMode==="walk"?this.velocityTarget.x+this.velocityTarget.z===0:this.velocityTarget.manhattanLength()===0)?this.lerpFactorPos.setScalar(this.lerpFactorPosEnd):this.lerpFactorPos.setScalar(this.lerpFactorPosStart),this.moveMode==="walk"&&(this.lerpFactorPos.y=1),this.didHit===!1&&this.pushedVelocity.manhattanLength()===0||this.usePhysics===!1?(this.velocity.x+=(this.velocityTarget.x-this.velocity.x)*(1-(1-this.lerpFactorPos.x)**i),this.velocity.y+=(this.velocityTarget.y-this.velocity.y)*(1-(1-this.lerpFactorPos.y)**i),this.velocity.z+=(this.velocityTarget.z-this.velocity.z)*(1-(1-this.lerpFactorPos.z)**i)):this.velocity.copy(this.velocityTarget),(this.moveMode==="walk"?this.velocity.x**2+this.velocity.z**2<this.speedTranslate:this.velocity.lengthSq()<this.speedTranslate)?(this.dispatchStopEvent("move"),this.dispatchStopEvent("run"),this.onObject&&(this.dispatchStopEvent("jump"),this.dispatchStartEvent("idle"))):(this.dispatchStopEvent("idle"),(this.onObject||this.moveMode==="fly")&&(this.dispatchStopEvent("jump"),this.movementState.run?(this.dispatchStopEvent("move"),this.dispatchStartEvent("run")):(this.dispatchStopEvent("run"),this.dispatchStartEvent("move"))));let r=Utt.copy(this.velocity);if(this.orientMode!=="none"&&this.isFirstPerson===!1){let s=Lo.copy(r);s.y=0,r.set(0,r.y,s.length()*(this.forwardDir==="+z"?1:-1))}if(this.directionXZ.manhattanLength()>0&&this.orientMode!=="none"&&this.isFirstPerson===!1)if(this.orientWith==="camera"&&this.path.length<=1){let s=Er;this.camera.getWorldDirection(s);let a=iu.copy(Na).multiplyScalar(s.dot(Na));s.sub(a);let o=Lo.copy(this.directionXZ);o.x*=-1,this.rot.y=s.angleTo(o)*(s.cross(o).y>0?-1:1)+this.rotationAccumWhenOrientWithCamera}else this.rot.y=(this.path.length>1?0:this.euler.y)+Math.atan2(-this.directionXZ.z,this.directionXZ.x)+Math.PI/2*(this.forwardDir==="+z"?1:-1);if(nu.setFromVector3(this.rot),this.moveMode==="walk"&&(nu.x=0),r.applyEuler(nu),n&&(hc.setFromUnitVectors(Na,this.groundNormal),r.applyQuaternion(hc)),this.usePhysics===!0&&this.object.rigidBody){this.pushedVelocity.set(0,0,0);let s=0;for(let a of this.sharedGameControlGlobals.entitiesWithTransformAnim){if(a.rigidBody===void 0||a.prevQ===void 0)continue;(a.hasNonUniformScale?a.matrixWorldRigid:a.matrixWorld).decompose(BM,nU,ktt);let o=this.object.getWorldPosition(Vtt).add(this.collider.position).sub(BM);rU.copy(a.prevQ).invert().premultiply(nU);let l=iu.subVectors(BM,a.prevT).add(jtt.copy(o).applyQuaternion(rU).sub(o)).divideScalar(e).divideScalar(this.pixelsPerMeter),c=a.rigidBody.collider(0).castCollider(l,this.object.rigidBody.collider(0),Er.copy(r).divideScalar(this.pixelsPerMeter),0,e,!1);l.multiplyScalar(this.pixelsPerMeter);let h=Be.is(a)?a:a.object;if(c!==null&&this.lastHitObj!==h){let d;a instanceof _s&&(d=a);let u=this.sharedGameControlGlobals.entityToCollisionEvents[h.uuid];if(u)for(let p of u)p.data.target==="character"&&(p.dispatch(d),h.dispatchEvent(rC));this.lastHitObj=h}c!==null&&(Math.abs(l.x)>Math.abs(this.pushedVelocity.x)&&(this.pushedVelocity.x=l.x),Math.abs(l.y)>Math.abs(this.pushedVelocity.y)&&(this.pushedVelocity.y=l.y),Math.abs(l.z)>Math.abs(this.pushedVelocity.z)&&(this.pushedVelocity.z=l.z),iU(s++).copy(c.normal1).applyQuaternion(a.quaternion))}if(s>0){for(let a=0;a<s;a++){let o=iU(a),l=o.dot(r);l<0&&r.addScaledVector(o,-l)}r.add(this.pushedVelocity)}else r.add(this.groundVelocity)}if(this.rotDirection.y=Number(this.movementState.rotPosY)-Number(this.movementState.rotNegY),this.rotDirection.x=Number(this.movementState.rotPosX)-Number(this.movementState.rotNegX),this.rotDirection.normalize(),this.rotationMode==="normal"&&(this.movementState.rotPosX||this.movementState.rotNegX)||this.rotationMode==="steer"&&(this.movementState.rotPosX||this.movementState.rotNegX)&&(this.movementState.movePosZ||this.movementState.moveNegZ||this.moveMode==="walk")?this.rotVelocityStick.x=-this.rotDirection.x*this.speedOrbit*this.rotForce:this.rotVelocityStick.x=0,this.rotationMode==="normal"&&(this.movementState.rotPosY||this.movementState.rotNegY)||this.rotationMode==="steer"&&(this.movementState.rotPosY||this.movementState.rotNegY)&&(this.movementState.movePosZ||this.movementState.moveNegZ)?this.rotVelocityStick.y=-this.rotDirection.y*this.speedOrbit*this.rotForce:this.rotVelocityStick.y=0,this.rotVelocityTarget.subVectors(this.eulerDelta.divideScalar(e),this.rotVelocityStick),this.rotVelocityTarget.manhattanLength()===0?this.rotVelocity.lerp(this.rotVelocityTarget,1-(1-this.lerpFactorRotEnd)**i):this.rotVelocity.lerp(this.rotVelocityTarget,1-(1-this.lerpFactorRotStart)**i),this.euler.x+=this.rotVelocity.x*e,this.euler.y+=this.rotVelocity.y*e+this.groundYRotation,this.rotVelocityTarget.y===0&&this.directionXZ.manhattanLength()===0?this.rotationAccumWhenOrientWithCamera=0:(this.cameraFollow===!1||this.cameraYAxis==="Locked")&&(this.rotationAccumWhenOrientWithCamera+=this.rotVelocity.y*e),this.isFirstPerson===!1&&this.orientMode!=="none"&&this.directionXZ.manhattanLength()>0){if(this.orientMode==="radial"){this.objectToCamXZ.copy(this.objectToCamXZ0).applyAxisAngle(Na,this.euler.y-this.euler0.y);let s=Lo.copy(this.objectToCamXZ).normalize(),a=iu.copy(r).multiplyScalar(e);a.y=0;let o=a.sub(Er.copy(s).multiplyScalar(a.dot(s))).cross(s).y;this.euler.y-=Math.atan2(o,this.objectToCamXZ.length())}}else this.rot.y+=this.rotVelocity.y*e+this.groundYRotation,this.rotVelocityTarget.y!==0&&(this.cameraFollow===!1||this.cameraYAxis==="Locked")&&(this.euler.y=this.rot.y);if(this.cameraFollow===!0&&(this.moveMode==="walk"?this.cameraXAxis==="Limit"?this.euler.x=Ot.clamp(this.euler.x,-this.maxPolarAngle+this.cameraPolarOffset+1e-6,-this.minPolarAngle+this.cameraPolarOffset-1e-6):this.euler.x=Ot.clamp(this.euler.x,-this.PI_2+this.cameraPolarOffset,this.PI_2+this.cameraPolarOffset):this.cameraXAxis==="Limit"&&(this.euler.x=Ot.clamp(this.euler.x,-this.PI_2,this.PI_2))),this.moveMode==="fly"?this.rot.x=this.euler.x:this.isFirstPerson&&(nu.copy(this.euler),nu.y=0,this.nonColliderRotOffset.makeRotationFromEuler(nu)),us.setFromAxisAngle(Ftt,this.rot.x),hc.setFromAxisAngle(Na,this.rot.y),hc.multiply(us),us.setFromAxisAngle(Ntt,this.rot.z),hc.multiply(us),this.quaternion.copy(hc),this.objectRealQuat.multiplyQuaternions(this.quaternion,this.objXZQuat),this.colliderWorldQuat.copy(this.objectRealQuat).multiply(this.collider.rotation),this.collisionEnabled)if(this.usePhysics&&this.object.rigidBody?.collider(0).shape){let s=Lo.copy(r).multiplyScalar(e/this.pixelsPerMeter),a=null;this.didHit=!1;let o=new T;for(let h=0;h<5;h++){let d=s.length(),u=iu.copy(s).normalize();if(a=this.sharedGameControlGlobals.rapierWorld.castShape(this.colliderWorldPosition.divideScalar(this.pixelsPerMeter).add(o),this.colliderWorldQuat,u,this.object.rigidBody.collider(0).shape,0,d,!1,12,void 0,void 0,this.object.rigidBody),a===null){h===0&&this.directionXZ.manhattanLength()!==0&&(this.lastHitObj=null),o.add(s);break}{this.didHit=!0;let p=this.sharedGameControlGlobals.colliderToEntity.get(a.collider.handle);if(p!==this.lastHitObj&&h===0){this.lastHitObj=p;let v=this.sharedGameControlGlobals.entityToCollisionEvents[p?.uuid];if(v){for(let y of v)if(y.data.target==="character"){let _,b=(this.sharedGameControlGlobals.rapierWorld?.getCollider(a.collider.handle))._parent;if(p.cloner){for(let x of p.cloner.children)if(x.rigidBody===b){_=x;break}}y.dispatch(_),p.dispatchEvent(rC)}}}let f=KB.set(a.normal2.x,a.normal2.y,a.normal2.z).applyQuaternion(this.colliderWorldQuat),g=QB.copy(u).multiplyScalar(a.time_of_impact).dot(f),m=a.time_of_impact;if(m===0&&(this.position.y+=this.offset*this.pixelsPerMeter),g>this.offset&&(m=a.time_of_impact*(g-this.offset)/g,o.addScaledVector(u,m)),s.copy(u).multiplyScalar(d-m),Math.acos(-f.y)>this.slopeThresh){let v=this.colliderWorldPosition.divideScalar(this.pixelsPerMeter).add(o),y=iu.copy(a.witness2).applyQuaternion(this.colliderWorldQuat);y.y=0;let _=v.add(y);_.y+=this.stepThresh;let b=this.sharedGameControlGlobals.rapierWorld.castShape(_,this.colliderWorldQuat,s,this.object.rigidBody?.collider(0).shape,0,1,!1,12,void 0,void 0,this.object.rigidBody);b!==null&&b.time_of_impact===0&&(f.y=0,f.normalize())}s.addScaledVector(f,-s.dot(f))}}this.position.addScaledVector(o,this.pixelsPerMeter),Er.copy(this.position).divideScalar(this.pixelsPerMeter),us.copy(this.quaternion).premultiply(this.groundTilt).multiply(this.objXZQuat);let l=this.object.rigidBody,c=l!==void 0&&Gtt.copy(Er).sub(l.translation()).lengthSq()>1;l!==void 0&&(c?(l.setTranslation(Er,!0),l.setRotation(us,!0)):(l.setNextKinematicTranslation(Er),l.setNextKinematicRotation(us)))}else{let s=this.onObject?1:5,a=r.multiplyScalar(e/s);for(let o=0;o<s;o++)this.position.add(a),this.collisionAdjustment(e/s)}else this.position.addScaledVector(r,e);if(this.moveMode==="walk"&&this.onObject&&(this.velocityTarget.y=0,this.velocity.y=0),this.quaternion.premultiply(this.groundTilt).multiply(this.objXZQuat),this.object.matrix.compose(this.position,this.quaternion,this.scale),this.object.matrixWorldNeedsUpdate=!0,this.object.matrix.multiply(this.nonColliderPosOffset).multiply(this.nonColliderRotOffset),this.quaternion.premultiply(this.groundTiltInv).multiply(this.objXZQuatInv),this.cameraFollow===!0){this.updateFollowArms();let s=this.objectToTarget.add(this.position),a=this.targetToCamera.add(s);LM.lookAt(a,s,Na).setPosition(a),LM.decompose(this.targetPos,this.targetQuat,Er),this.camera.quaternion.slerp(this.targetQuat,1-(1-this.lerpFactorRotCamera)**i),this.camera.position.lerp(this.targetPos,1-(1-this.lerpFactorPosCamera)**i),this.camera.updateMatrix(),this.camera.updateMatrixWorld(),this.cameraYAxis==="Limit"&&this.orientMode==="cartesian"&&(this.euler.y=Ot.clamp(this.euler.y,this.minAzimuthAngleRel,this.maxAzimuthAngleRel)),this.euler.x=Ot.clamp(this.euler.x,-this.PI_2+(this.cameraPolarOffset<0?this.cameraPolarOffset:0),this.PI_2+(this.cameraPolarOffset>0?this.cameraPolarOffset:0))}return this.eulerDelta.set(0,0,0),this.object.dispatchEvent(Wtt),!(this.path.length<2&&this.lastPosition.distanceToSquared(this.position)<this.threshEndTranslate&&Math.abs(this.rotVelocity.x)<this.threshEndRotVel&&Math.abs(this.rotVelocity.y)<this.threshEndRotVel&&(this.camera===void 0||this.isFirstPerson||this.lastCameraPosition.distanceToSquared(this.camera.position)<this.threshEndTranslate&&8*(1-this.lastCameraQuaternion.dot(this.camera.quaternion))<this.threshEndRotate)&&(this.moveMode==="fly"||this.onObject===!0||this.collisionEnabled===!1)&&(this.navMeshPathDest===null||this.navMeshPathDest.material.opacity<-.04*this.navMeshPathDest?.material?.userData.opacity0)||(this.camera&&(this.lastCameraPosition.copy(this.camera.position),this.lastCameraQuaternion.copy(this.camera.quaternion)),this.lastPosition.copy(this.position),this.object.dispatchEvent(Htt),0))}updateFollowArms(){this.objectToTarget.copy(this.objectToTarget0),this.targetToCamera.copy(this.targetToCamera0);let t,e=us.setFromAxisAngle(Na,this.cameraYAxis==="Limit"&&this.orientMode!=="radial"?Ot.clamp(this.euler.y-this.euler0.y,this.minAzimuthAngleRel,this.maxAzimuthAngleRel):this.euler.y-this.euler0.y);(this.cameraYAxis!=="Locked"||this.orientMode==="radial")&&this.objectToTarget.applyQuaternion(e),t=this.cameraXAxis==="Limit"?Ot.clamp(this.euler.x,-this.maxPolarAngle+this.cameraPolarOffset+1e-6,-this.minPolarAngle+this.cameraPolarOffset-1e-6):Ot.clamp(this.euler.x,-this.PI_2+this.cameraPolarOffset+1e-6,this.PI_2+this.cameraPolarOffset-1e-6);let i=Er.copy(this.cameraPolarAxis0);(this.cameraYAxis!=="Locked"||this.orientMode==="radial")&&i.applyQuaternion(e);let n=hc.setFromAxisAngle(i,t);this.cameraYAxis!=="Locked"&&this.targetToCamera.applyQuaternion(e),this.cameraXAxis!=="Locked"&&this.targetToCamera.applyQuaternion(n)}groundTiltAdjustment(t){180*Na.angleTo(t)/Math.PI<15||180*Na.angleTo(t)/Math.PI>85?us.identity():us.setFromUnitVectors(Na,t),this.groundTilt.slerp(us,.06),this.groundTiltInv.copy(this.groundTilt).invert()}collisionAdjustment(t){let e=QB.set(0,0,0);this.object.matrix.compose(this.position,this.quaternion,this.scale);let i=LM.multiplyMatrices(this.object.matrix,this.objXZRotMat).multiply(this.collider.matrix).decompose(Er,us,Lo).compose(Er,us,tU);this.sharedGameControlGlobals.entitiesWithTransformAnim.forEach(r=>{if(r===this.object||r.isDescendantOf(this.object)||!r.bvhGeometry||!r.bvhGeometry.boundsTree)return;Ls.makeEmpty(),r.updateMatrixWorldRigid();let s=r.matrixWorldRigid,a=JB.copy(s).invert(),o=ztt.copy(JB).multiply(i);Qn.copy(this.collider.segment),Qn.start.applyMatrix4(o),Qn.end.applyMatrix4(o);let l=KB.copy(this.position).applyMatrix4(a);Ls.expandByPoint(Qn.start),Ls.expandByPoint(Qn.end),Ls.min.addScalar(-this.collider.radius),Ls.max.addScalar(this.collider.radius),r.bvhGeometry.boundsTree.shapecast({boundsTraverseOrder:c=>c.distanceToPoint(Qn.end),intersectsBounds:c=>c.intersectsBox(Ls),intersectsTriangle:c=>{let h=Er,d=Lo,u=c.closestPointToSegment(Qn,h,d);if(u<this.collider.radius){let p=this.collider.radius-u,f=d.sub(h).normalize(),g=iu.copy(l);g.addScaledVector(f,p);let m=g.applyMatrix4(s).sub(this.position);e.add(m),Qn.start.addScaledVector(f,p),Qn.end.addScaledVector(f,p)}}})}),Ls.makeEmpty(),Qn.copy(this.collider.segment),Qn.start.applyMatrix4(i),Qn.end.applyMatrix4(i),Ls.expandByPoint(Qn.start),Ls.expandByPoint(Qn.end),Ls.min.addScalar(-this.collider.radius),Ls.max.addScalar(this.collider.radius),this.sharedGameControlGlobals.staticMeshBVH?.shapecast({boundsTraverseOrder:r=>r.distanceToPoint(Qn.end),intersectsBounds:r=>r.intersectsBox(Ls),intersectsTriangle:r=>{let s=Er,a=Lo,o=r.closestPointToSegment(Qn,s,a);if(o<this.collider.radius){let l=this.collider.radius-o,c=a.sub(s).normalize();this.alignToGround&&this.groundTiltAdjustment(c),e.addScaledVector(c,l),Qn.start.addScaledVector(c,l),Qn.end.addScaledVector(c,l)}}}),this.onObject=Math.abs(e.y)>Math.abs(t*this.velocity.y*.25),this.onObject&&this.dispatchStopEvent("jump");let n=Math.max(0,e.length()-1e-5);e.normalize().multiplyScalar(n),this.position.add(e)}pause(){this.firstPointerId=-1,this.movementState={moveNegZ:0,movePosZ:0,moveNegX:0,movePosX:0,moveNegY:0,movePosY:0,rotPosX:0,rotNegX:0,rotPosY:0,rotNegY:0,jump:0,run:0},this.deactivate()}resume(){this.activate()}},o9=sC;o9.isLocked=!1,tt(),s0(),Cp(),Tp();var l9,h9,UM,qtt=new Promise(t=>{l9=t});function Xtt(t){return UM||(UM=async function(){let e=t??"https://cdn.spline.design/@splinetool/runtime@2.0.79/build";typeof window<"u"&&(h9=new URL(e.endsWith("/")?e:`${e}/`,window.location.href).href);let i=import("./navmesh.js"),[n,r]=await Promise.all([i,fetch(`${e}/navmesh.wasm`).then(o=>o.arrayBuffer())]),s=n.default,a=await s({wasmBinary:r});l9(a)}(),UM)}ti();var c9,Fe,ur,$tt=t=>`
9864
9864
  (async function() {
9865
9865
  const [wasmImport, wasmBinary] = await Promise.all([
9866
9866
  import('${t}' + 'navmesh.js'),
@@ -9870,7 +9870,7 @@ void main() {
9870
9870
  self.module = await wasmModule({ wasmBinary });
9871
9871
  postMessage('ready');
9872
9872
  })();
9873
- `,Ytt={cs:6,ch:2,walkableSlopeAngle:90,walkableHeight:20,walkableClimb:5,walkableRadius:0,maxEdgeLen:12,maxSimplificationError:1.3,minRegionArea:8,mergeRegionArea:20,maxVertsPerPoly:6,detailSampleDist:6,detailSampleMaxError:1};qtt.then(t=>{c9=t,Fe=new t.Vec3,ur=new t.Vec3});var Ztt=new T,Ktt=class{constructor(t=!1,e=!1){this.usePhysics=t,this.isExport=e,this.onPointerDown=i=>{if(ae.length!==1)return;let{raycaster:n,page:r}=this.eventContext;this.eventContext.updateRaycaster(i);let s=r.raycastWithClones(n);if(s.length!==0){if(this.gameControl){let a=Ztt.copy(this.gameControl.colliderWorldPosition);a.y-=this.gameControl.colliderHeight/2,this.gameControl.path=this.computePath(a,s[0].point)}this.eventContext.requestRender()}},this.traverseWithPhysics=(i,n)=>r=>{let s;if(r instanceof jc){if(!r.objectForSample)return r.object.dataPatched.physics.fusedBody===!0&&r.object.dataPatched.physics.rigidBody==="dynamic"||void 0;if(r.objectForSample.dataPatched.physics.fusedBody)return;s=r.object}else if(r instanceof _s)s=r.object;else if(s=r,s.dataPatched.cloner?.disabled===!1&&s.dataPatched.cloner?.hideBase&&s.dataPatched.physics?.fusedBody!==!0)return!0;if(n&&!s.userData.navmesh)return;let a=s.dataPatched;if(!a.visible&&a.physics?.enabled!==!0)return!0;r.updateMatrixWorldRigid();let o=Gb(a),l=s.userData.hasDestroy,c=s.userData.hasDrag,h=!1,d=!1;for(let u of a.events)u.data.disabled!==!0&&(u.data.type==="GameControl"?h=!0:u.data.type==="Follow"&&(d=!0));if(h||o||d||l||c)return!0;if(this.usePhysics&&a.physics?.rigidBody==="dynamic"){if(this.usePhysics&&a.physics?.fusedBody)return!0}else if("geometry"in r&&r.geometry&&i.push(qo(r.geometry,r.matrixWorld)),this.usePhysics&&a.physics?.fusedBody)return r.traverseObject((u,p)=>{if(p===0)return;let f;if(u instanceof jc){if(!u.objectForSample)return u.object.dataPatched.physics.fusedBody===!0&&u.object.dataPatched.physics.rigidBody==="dynamic"||void 0;if(u.objectForSample.dataPatched.physics.fusedBody)return;f=u.object}else if(u instanceof _s)f=u.object;else if(f=u,u.dataPatched.cloner?.hideBase)return!0;let g=f.dataPatched;if(!g.visible&&g.physics?.enabled!==!0)return!0;"geometry"in u&&u.geometry&&i.push(qo(u.geometry,u.matrixWorld))}),!0},this.traverseNoPhysics=(i,n)=>r=>{let s;if(r instanceof jc)return;s=r instanceof _s?r.object:r;let a=s.dataPatched;if(a.physics.enabled==="visibility"?!a.visible:!a.physics.enabled)return!0;if(n&&!s.userData.navmesh)return;let o=r.geometry,l=s.userData.hasDestroy===!0,c=s.userData.hasDrag===!0;if(Gb(a)||l||c||s.dataPatched.events.some(h=>h.data.disabled!==!0&&h.data.type==="GameControl"))return!0;o&&i.push(qo(o,r.matrixWorld))},this.navmeshWasm=c9,this.navMesh=new this.navmeshWasm.NavMesh,this._workerURL=URL.createObjectURL(new Blob([(e?$tt(h9??"https://cdn.spline.design/@splinetool/runtime@2.0.77/build/"):`
9873
+ `,Ytt={cs:6,ch:2,walkableSlopeAngle:90,walkableHeight:20,walkableClimb:5,walkableRadius:0,maxEdgeLen:12,maxSimplificationError:1.3,minRegionArea:8,mergeRegionArea:20,maxVertsPerPoly:6,detailSampleDist:6,detailSampleMaxError:1};qtt.then(t=>{c9=t,Fe=new t.Vec3,ur=new t.Vec3});var Ztt=new T,Ktt=class{constructor(t=!1,e=!1){this.usePhysics=t,this.isExport=e,this.onPointerDown=i=>{if(ae.length!==1)return;let{raycaster:n,page:r}=this.eventContext;this.eventContext.updateRaycaster(i);let s=r.raycastWithClones(n);if(s.length!==0){if(this.gameControl){let a=Ztt.copy(this.gameControl.colliderWorldPosition);a.y-=this.gameControl.colliderHeight/2,this.gameControl.path=this.computePath(a,s[0].point)}this.eventContext.requestRender()}},this.traverseWithPhysics=(i,n)=>r=>{let s;if(r instanceof jc){if(!r.objectForSample)return r.object.dataPatched.physics.fusedBody===!0&&r.object.dataPatched.physics.rigidBody==="dynamic"||void 0;if(r.objectForSample.dataPatched.physics.fusedBody)return;s=r.object}else if(r instanceof _s)s=r.object;else if(s=r,s.dataPatched.cloner?.disabled===!1&&s.dataPatched.cloner?.hideBase&&s.dataPatched.physics?.fusedBody!==!0)return!0;if(n&&!s.userData.navmesh)return;let a=s.dataPatched;if(!a.visible&&a.physics?.enabled!==!0)return!0;r.updateMatrixWorldRigid();let o=Gb(a),l=s.userData.hasDestroy,c=s.userData.hasDrag,h=!1,d=!1;for(let u of a.events)u.data.disabled!==!0&&(u.data.type==="GameControl"?h=!0:u.data.type==="Follow"&&(d=!0));if(h||o||d||l||c)return!0;if(this.usePhysics&&a.physics?.rigidBody==="dynamic"){if(this.usePhysics&&a.physics?.fusedBody)return!0}else if("geometry"in r&&r.geometry&&i.push(qo(r.geometry,r.matrixWorld)),this.usePhysics&&a.physics?.fusedBody)return r.traverseObject((u,p)=>{if(p===0)return;let f;if(u instanceof jc){if(!u.objectForSample)return u.object.dataPatched.physics.fusedBody===!0&&u.object.dataPatched.physics.rigidBody==="dynamic"||void 0;if(u.objectForSample.dataPatched.physics.fusedBody)return;f=u.object}else if(u instanceof _s)f=u.object;else if(f=u,u.dataPatched.cloner?.hideBase)return!0;let g=f.dataPatched;if(!g.visible&&g.physics?.enabled!==!0)return!0;"geometry"in u&&u.geometry&&i.push(qo(u.geometry,u.matrixWorld))}),!0},this.traverseNoPhysics=(i,n)=>r=>{let s;if(r instanceof jc)return;s=r instanceof _s?r.object:r;let a=s.dataPatched;if(a.physics.enabled==="visibility"?!a.visible:!a.physics.enabled)return!0;if(n&&!s.userData.navmesh)return;let o=r.geometry,l=s.userData.hasDestroy===!0,c=s.userData.hasDrag===!0;if(Gb(a)||l||c||s.dataPatched.events.some(h=>h.data.disabled!==!0&&h.data.type==="GameControl"))return!0;o&&i.push(qo(o,r.matrixWorld))},this.navmeshWasm=c9,this.navMesh=new this.navmeshWasm.NavMesh,this._workerURL=URL.createObjectURL(new Blob([(e?$tt(h9??"https://cdn.spline.design/@splinetool/runtime@2.0.79/build/"):`
9874
9874
  (async function() {
9875
9875
  const [wasmImport, wasmBinary] = await Promise.all([
9876
9876
  import(self.location.origin + '/_libraries/navmesh.js'),
@@ -9941,11 +9941,11 @@ onmessage = function(messageEvent) {
9941
9941
  `:"")+Zm(i.children,e);if(i.type==="variable"){let r=e.getVariable(i.variableId);if(r!==void 0)return w9(r,e)}}return""}).join("");$t();var tE=1e3,BU=512e3,Oit=class{constructor(t,e){this.id=t,this.userWebhook=e,this.result=void 0,this._connected=!1,this.emitter=zx(),this.reconnectWaitFor=tE,this._onError=i=>{this.eventSource?.removeEventListener("message",this._onMessage),this.eventSource?.removeEventListener("error",this._onError),this.eventSource?.removeEventListener("open",this._onConnected),this._scheduleReconnect()},this._onConnected=i=>{clearTimeout(this.scheduledReconnectHandle),this.reconnectWaitFor=tE,this._connected=!0},this._onDisconnected=()=>{clearTimeout(this.scheduledReconnectHandle),this.reconnectWaitFor=tE,this._connected=!1},this._onMessage=i=>{let n,r=i.data;try{n=JSON.parse(r)}catch(s){console.error("Error parsing webhook message",s)}if(n){let s=!1;this.userWebhook.parametersSchemas.forEach(({data:a})=>{n[a.name]!==void 0&&function(o,l){let c=typeof o;return!!((l==="string"||l==="number")&&c===l||l==="boolean"&&(o==="true"||o==="false"||o===!0||o===!1)||l==="image"&&c==="string"&&o.startsWith("http"))}(n[a.name],a.type)&&(this.result===void 0&&(this.result={}),this.result[a.name]=n[a.name],s=!0)}),s&&this.emitter.emit("message",{userWebhookId:this.id})}}}connect(){clearTimeout(this.scheduledReconnectHandle),this.userWebhook.url&&(this.eventSource=new EventSource("https://hooks.spline.design/events?hashFile="+this.userWebhook.url),this.eventSource.addEventListener("message",this._onMessage),this.eventSource.addEventListener("error",this._onError),this.eventSource.addEventListener("open",this._onConnected))}disconnect(){this.eventSource?.removeEventListener("message",this._onMessage),this.eventSource?.removeEventListener("error",this._onError),this.eventSource?.removeEventListener("open",this._onConnected),this.eventSource?.close(),this._onDisconnected(),clearTimeout(this.scheduledReconnectHandle)}_scheduleReconnect(){this.reconnectWaitFor*=2,this.reconnectWaitFor>BU&&(this.reconnectWaitFor=BU),clearTimeout(this.scheduledReconnectHandle),this.scheduledReconnectHandle=setTimeout(()=>{this.scheduledReconnectHandle=void 0,this.connect()},this.reconnectWaitFor)}update(t){this.userWebhook=t}dispose(){this._connected&&this.disconnect()}get connected(){return this._connected}on(t,e){this.emitter.on(t,e)}off(t,e){this.emitter.off(t,e)}getParametersKeys(){return this.userWebhook.parametersSchemas.map(t=>t.data.name)}getParameterValue(t){if(this.getParametersKeys().includes(t)){if(this.result)return this.result?.[t];for(let e of this.userWebhook.parametersSchemas)if(e.data.name===t)return IA.defaultParameterValueByType(e.data.type)}}};ke(),ws("API",({eventContext:t,eventManager:e})=>new Ait(t,e)),ws("WEBHOOK",({eventContext:t,eventManager:e})=>new Cit(t,e)),Dr("UserAPI",({data:t,page:e,shared:i,actionCondition:n})=>new Dit(t,e,i,n)),function(t){I3=t}({createUserAPI:(t,e,i)=>new Rit(t,e,i),createUserWebhook:(t,e)=>new Oit(t,e)}),Si("api-services");var Lit=class extends Lr{constructor(t,e){super(t),this.eventManager=e,this.events=[],this.onVoice=({value:i,frequencies:n})=>{this.events.forEach(r=>{r.dispatch()})}}connect(){this.openAIRealtime=this.eventContext.sharedAssets.openAIRealtime,this.openAIRealtime&&(this.eventContext.page.traverseEntity(t=>{t.data?.events.filter(e=>e.data.type==="AIAssistantListener"&&!e.data.disabled).forEach(e=>{this.events.push(new Bit(e.id,e.data,t,this.eventContext.page,this.eventContext.sharedAssets,this.eventManager))})}),this.openAIRealtime.on("voice",this.onVoice))}disconnect(){this.openAIRealtime?.off("voice",this.onVoice)}},Bit=class{constructor(t,e,i,n,r,s){this.id=t,this.data=e,this.object=i,this.actions=Rn(e,e.actions,n,r,s,i)}dispatch(){this.dispatchActions(this.actions)}dispatchActions(t){t.Audio.forEach(e=>e.dispatchConditional()),t.Particles.forEach(e=>e.dispatchConditional()),t.Video.forEach(e=>e.dispatchConditional()),t.Create.forEach(e=>e.dispatch()),t.Destroy.forEach(e=>e.dispatch()),t.Reset.forEach(e=>e.dispatch()),t.Transition.forEach(e=>{!e.shouldReinit()||(e.object.currentTransitionEvent!==this&&(e.object.currentTransitionEvent=this),e.init())}),t.Transition.forEach(e=>e.play()),t.Animation.forEach(e=>e.play()),t.SwitchCamera.forEach(e=>e.play()),t.SceneTransition.forEach(e=>e.dispatch()),t.SetVariable.forEach(e=>e.checkConditions()),t.SetVariable.forEach(e=>e.dispatch()),t.DynamicVariablePlay.forEach(e=>e.dispatch()),t.ClearLocalStorage.forEach(e=>e.dispatch()),t.UserAPI.forEach(e=>e.dispatch())}},Uit=class extends Lr{constructor(t,e){super(t),this.eventManager=e,this.events=[],this.onTriggerEvent=({description:i,direction:n})=>{let r=this.events.find(s=>s.data.description===i);r&&(n==="backward"?r.dispatchReverse():r.dispatch())}}connect(){this.openAIRealtime=this.eventContext.sharedAssets.openAIRealtime,this.openAIRealtime&&(this.eventContext.page.traverseEntity(t=>{t.data?.events.filter(e=>e.data.type==="AIAssistantTrigger"&&!e.data.disabled).forEach(e=>{this.events.push(new zit(e.id,e.data,t,this.eventContext.page,this.eventContext.sharedAssets,this.eventManager))})}),this.openAIRealtime.on("trigger_event",this.onTriggerEvent))}disconnect(){this.openAIRealtime?.off("trigger_event",this.onTriggerEvent)}},zit=class{constructor(t,e,i,n,r,s){this.id=t,this.data=e,this.object=i,this.actions=Rn(e,e.actions,n,r,s,i)}dispatch(){let t=this.actions;t.Audio.forEach(e=>e.dispatchConditional()),t.Particles.forEach(e=>e.dispatchConditional()),t.Video.forEach(e=>e.dispatchConditional()),t.Create.forEach(e=>e.dispatch()),t.Destroy.forEach(e=>e.dispatch()),t.Reset.forEach(e=>e.dispatch()),t.Transition.forEach(e=>{!e.shouldReinit()||(e.object.currentTransitionEvent!==this&&(e.object.currentTransitionEvent=this),e.init())}),t.Transition.forEach(e=>e.play()),t.Animation.forEach(e=>e.play()),t.SwitchCamera.forEach(e=>e.play()),t.SceneTransition.forEach(e=>e.dispatch()),t.SetVariable.forEach(e=>e.checkConditions()),t.SetVariable.forEach(e=>e.dispatch()),t.DynamicVariablePlay.forEach(e=>e.dispatch()),t.ClearLocalStorage.forEach(e=>e.dispatch()),t.UserAPI.forEach(e=>e.dispatch())}dispatchReverse(){let t=this.actions;t.Transition.forEach(e=>e.reverseFromCurrent()),t.Particles.forEach(e=>e.reverseFromCurrent()),t.Animation.forEach(e=>e.reverseFromCurrent()),t.SwitchCamera.forEach(e=>e.reverseFromCurrent()),t.Create.forEach(e=>e.dispatchStop())}};L3();var Fit=function(t){t=t.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i,(i,n,r,s)=>String(n+n+r+r+s+s));let e=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t);return e?{r:parseInt(e[1],16),g:parseInt(e[2],16),b:parseInt(e[3],16)}:null},UU=[4186.01,4434.92,4698.63,4978.03,5274.04,5587.65,5919.91,6271.93,6644.88,7040,7458.62,7902.13],Nit=["C","C#","D","D#","E","F","F#","G","G#","A","A#","B"],fh=[],yP=[];for(let t=1;t<=8;t++)for(let e=0;e<UU.length;e++){let i=UU[e];fh.push(i/Math.pow(2,8-t)),yP.push(Nit[e]+t)}var Wb=[32,2e3],zU=fh.filter((t,e)=>fh[e]>Wb[0]&&fh[e]<Wb[1]),kit=yP.filter((t,e)=>fh[e]>Wb[0]&&fh[e]<Wb[1]),Vit=class{static getFrequencies(t,e,i,n="frequency",r=-100,s=-30){i||(i=new Float32Array(t.frequencyBinCount),t.getFloatFrequencyData(i));let a,o,l,c=e/2,h=1/i.length*c;if(n==="music"||n==="voice"){let u=n==="voice"?zU:fh,p=Array(u.length).fill(r);for(let f=0;f<i.length;f++){let g=f*h,m=i[f];for(let v=u.length-1;v>=0;v--)if(g>u[v]){p[v]=Math.max(p[v],m);break}}a=p,o=n==="voice"?zU:fh,l=n==="voice"?kit:yP}else a=Array.from(i),o=a.map((u,p)=>h*p),l=o.map(u=>`${u.toFixed(2)} Hz`);let d=a.map(u=>Math.max(0,Math.min((u-r)/(s-r),1)));return{values:new Float32Array(d),frequencies:o,labels:l}}},jit=class{constructor(t){this.value=0,this.frequencies=new Float32Array(0);let e=new AudioContext;this.source=e.createMediaStreamSource(t),this.analyser=e.createAnalyser(),this.source.connect(this.analyser),this.analyser.fftSize=8192,this.analyser.smoothingTimeConstant=.1}getFrequencies(t=-100,e=-30){if(!this.analyser)throw new Error("Not connected, please call .connect() first");return Vit.getFrequencies(this.analyser,44100,void 0,"voice",t,e)}update(){let t=this.getFrequencies(),e=t.values.reduce((i,n)=>i+n,0)/t.values.length;this.value=e,this.frequencies=t.values}disconnect(){this.source.disconnect(),this.analyser.disconnect()}},Git=class{constructor(t){this.callbacks=t,this.rafId=0,this.isOpen=!1,this.onMessage=e=>{this.callbacks.onMessage(e.data)},this.onOpen=()=>{this.isOpen=!0,this.callbacks.onOpen()},this.animate=()=>{this.rafId=requestAnimationFrame(this.animate),this.isOpen&&this.analyser&&(this.analyser.update(),this.callbacks.onVoice(this.analyser.value,this.analyser.frequencies))}}async connect(t){let e=await async function(s){try{return(await(await fetch("https://relayserver.spline.design/session?uuidfile="+s)).json()).token}catch(a){console.error("Token generation error:",a)}}(t);this.pc=new RTCPeerConnection,this.audioElement=document.createElement("audio"),this.audioElement.autoplay=!0,this.pc.ontrack=s=>{let a=s.streams[0];this.audioElement.srcObject=a,this.analyser=new jit(a)};let i=await navigator.mediaDevices.getUserMedia({audio:!0});this.pc.addTrack(i.getTracks()[0]),this.dc=this.pc.createDataChannel("oai-events"),this.dc.addEventListener("message",this.onMessage),this.dc.addEventListener("open",this.onOpen);let n=await this.pc.createOffer();await this.pc.setLocalDescription(n);let r={type:"answer",sdp:await(await fetch("https://api.openai.com/v1/realtime/calls?model=gpt-realtime",{method:"POST",body:n.sdp,headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/sdp"}})).text()};await this.pc.setRemoteDescription(r),this.animate()}send(t){return!!this.dc&&(this.dc.send(t),!0)}disconnect(){cancelAnimationFrame(this.rafId),this.analyser?.disconnect(),this.isOpen=!1,this.dc?.removeEventListener("message",this.onMessage),this.dc?.removeEventListener("open",this.onOpen),this.dc?.close(),this.pc?.getSenders().forEach(t=>{t.track&&t.track.stop()}),this.pc?.close(),this.pc=void 0}},Hit=class{constructor(t,e,i){this.data=t,this.id=e,this.shared=i,this.emitter=zx(),this.voice=0,this.frequencies=new Float32Array([0]),this.events=[],this.isConnected=!1,this.isToolsAdded=!1,this.tools=[],this.onServerEvent=n=>{let r=JSON.parse(n);if(this.appendEvent(r),r.type==="session.created"&&this.onSessionCreated(),r.type==="response.done"&&r.response?.output){for(let s of r.response.output)if(s.type==="function_call")for(let[a,o]of this.tools)s.name===a.name&&(o(JSON.parse(s.arguments)),setTimeout(()=>{this.sendClientEvent({type:"response.create",response:{instructions:"notice the user about what you just did"}})}))}},this.onSessionCreated=()=>{this.isToolsAdded||this.registerTools()},this.onOpen=()=>{this.events=[],this.isConnected=!0,this.sendClientEvent({type:"response.create",response:{instructions:"Say hi"}})}}update(t){this.data=t}setColorByName(t,e){let i=this.shared.getColorByName(t);if(i){let{id:n}=i,{r,g:s,b:a}=Fit(e)??{r:0,g:0,b:0};this.shared.updateColor(n,{r:r/255,g:s/255,b:a/255})}}async connect(){if(this.isConnected||this.session||this.hosted)return;let t={onMessage:this.onServerEvent,onOpen:this.onOpen,onVoice:(e,i)=>{this.voice=e,this.frequencies=i,this.emitter.emit("voice",{value:e,frequencies:i})}};this.hosted=function(e,i,n){if(!function(){try{return window.__SPLINE_PLAY_VOICE_HOST__===!0&&window.parent!==window}catch{return!1}}())return null;let r=!1,s=o=>{window.parent.postMessage({__splinePlayFrame:!0,...o},"*")},a=o=>{if(o.source!==window.parent)return;let l=o.data;!l||l.__splinePlayFrameHost!==!0||l.id!==e||(l.type==="voice-open"?(r=!0,n.onOpen()):l.type==="voice-message"&&typeof l.data=="string"?n.onMessage(l.data):l.type==="voice-level"&&typeof l.value=="number"?n.onVoice(l.value,l.frequencies instanceof Float32Array?l.frequencies:new Float32Array(0)):l.type==="voice-error"&&console.error("Voice assistant host error:",l.message))};return window.addEventListener("message",a),s({type:"voice-connect",id:e,hash:i}),{send:o=>!!r&&(s({type:"voice-send",id:e,message:o}),!0),disconnect:()=>{r=!1,window.removeEventListener("message",a),s({type:"voice-disconnect",id:e})}}}(this.id,this.data.integration.hash,t),!this.hosted&&(this.session=new Git(t),await this.session.connect(this.data.integration.hash))}appendEvent(t){this.events=[t,...this.events]}sendClientEvent(t){t.event_id=t.event_id||crypto.randomUUID();let e=JSON.stringify(t);(this.hosted?this.hosted.send(e):this.session?.send(e))?this.appendEvent(t):console.error("Failed to send message - no data channel available",t)}registerTools(){this.isToolsAdded=!0,this.registerTool({type:"function",name:"set_personality_color",description:"returns a color based on the voice personality of the ai assistant. This should be called by the voice assistant each time it is asks to speak differently. If a color cannot be associated to the personality, the color should be a neutral color.",parameters:{type:"object",properties:{color:{type:"string",description:"css hex color string, reflecting the personality"},personality:{type:"string",description:"the personality of the voice assistant"}},required:["color","personality"]}},({color:r})=>{this.setColorByName("Voice Assistant Color",r)});let t=this.shared.getVariablesNames().join(", ");this.registerTool({type:"function",name:"set_variable",description:"Sets a Spline variable value when asked by the user.",parameters:{type:"object",properties:{name:{type:"string",description:`The name of the variable that needs to be set. Here's a list of available variables: ${t}. It the variable does not exist, don't call the function and warn the user about it.`},value:{type:"string",description:"The new value for this variable, should always be a string even for number and boolean variables, assume that the value will be cast to the proper type afterwards."}},required:["name","value","type"]}},({name:r,value:s})=>{let a=this.shared.getVariableByName(r);if(a){let o,l=this.shared.getVariable(a.id);if(typeof l=="number"){if(o=parseFloat(s),!Number.isFinite(o))return}else o=typeof l=="boolean"?s.toLowerCase()==="true":{textValue:s};this.shared.updateVariable(a.id,o)}});let e=this.shared.getColorNames().join(", ");this.registerTool({type:"function",name:"set_color",description:"Sets a Spline color asset value when asked by the user.",parameters:{type:"object",properties:{name:{type:"string",description:`The name of the color asset that needs to be set. Here's a list of available color assets: ${e}. It the color asset does not exist, don't call the function and warn the user about it.`},value:{type:"string",description:"css hex color string"}},required:["name","value"]}},({name:r,value:s})=>{this.setColorByName(r,s)});let i=this.shared.scene,n=[];i.traverseEntity(r=>{r.data.events.forEach(s=>{if(s.data.type==="AIAssistantTrigger"){let{description:a}=s.data;n.push(a)}})}),this.registerTool({type:"function",name:"trigger_event",description:"Trigger an event by name, here are the available events, please match what the user is asking for to one of these if it applies, otherwise don't call the function and warn the user.",parameters:{type:"object",properties:{description:{type:"string",description:`The name of the event that needs to be triggered. Here's a list of available events: ${JSON.stringify(n)}.`},direction:{type:"string",description:"default is forward, but can be forward or backward. Always set to forward unless the user ask to reverse or cancel the event, then set to backward."}},required:["description","direction"]}},({description:r,direction:s})=>{this.emitter.emit("trigger_event",{description:r,direction:s})}),this.sendClientEvent({type:"session.update",session:{type:"realtime",tools:this.tools.map(([r])=>r)}})}registerTool(t,e){this.tools.push([t,e])}disconnect(){this.voice=0,this.isConnected=!1,this.isToolsAdded=!1,this.session?.disconnect(),this.session=void 0,this.hosted?.disconnect(),this.hosted=null}computeAnalysisForListenerEvent(t){if(t.analysis==="range"){let e=this.frequencies.slice(...t.analysisRange);return e.reduce((i,n)=>i+n,0)/e.length}return t.analysis==="single"?this.frequencies[t.analysisSingle]:this.voice}on(t,e){this.emitter.on(t,e)}off(t,e){this.emitter.off(t,e)}};ke(),ws("AIAssistantListener",({eventContext:t,eventManager:e})=>new Lit(t,e)),ws("AIAssistantTrigger",({eventContext:t,eventManager:e})=>new Uit(t,e)),O3=(t,e,i)=>new Hit(t,e,i),Si("ai-assistant"),ti();var _P=class extends cP{constructor(t,e,i){super(t,e,i),this.data=e}};$t(),tt(),$t(),tt();var S9=class extends xp{constructor(){super(),this.caretIndex=0,this._caretVisibleAlpha=1,this._selectionVisibleAlpha=.3,this.current={start:0,end:void 0},this.matrixAutoUpdate=!1,this.caretMesh=new gi(new ho(1,1),new Hs({transparent:!0,opacity:0,side:Hn})),this.add(this.caretMesh),this.selectionMesh=new gi(new ho(1,1),new Hs({color:2857471,transparent:!0,depthTest:!1,depthWrite:!1,opacity:0,side:Hn})),this.add(this.selectionMesh),this.hide()}get caretHeight(){return this.object?.AD??0}show(t){this.visible=!0,this.object=t,this.caretMesh.scale.set(1,this.caretHeight,1),this.caretMesh.position.y=.5*-this.caretHeight,this.setCaretPosition(this.caretIndex),this.update()}hide(){this.visible=!1}update(){if(this.object===void 0)return;this.updateHelperMatrix();let{depth:t}=this.object.geometry.userData.parameters;this.caretMesh.position.z=t,this.selectionMesh.position.z=t}updateHelperMatrix(){if(this.object===void 0)return;let t=this.object,e=t.parent;e!==null&&e.updateWorldMatrix(!0,!1),t.matrixAutoUpdate&&t.updateMatrix(),e!==null?(this.matrixWorld.multiplyMatrices(e.matrixWorld,t.hiddenMatrix),this.matrixWorld.multiplyMatrices(this.matrixWorld,t.matrix)):this.matrixWorld.multiplyMatrices(t.hiddenMatrix,t.matrix),this.matrix.copy(this.matrixWorld);for(let i of this.children)i.matrixWorld.copy(this.matrixWorld);t.updateWorldMatrix(!0,!0)}setCaretColor(t){let e=this.caretMesh.material;e.color.setRGB(t.r,t.g,t.b);let i=this._caretVisibleAlpha===e.opacity;this._caretVisibleAlpha=t.a,i&&(e.opacity=this._caretVisibleAlpha)}setSelectionColor(t){this.selectionMesh.material.color.setRGB(t.r,t.g,t.b)}setCaretPosition(t,e={}){if(this.object===void 0)return;this.caretIndex=t;let i=this.object.wrappedText,[n,r]=$y(i,t),[s,a]=t>0?$y(i,t-1):[null,null];(t>0&&i.length?i[s].charAt(a):null)===`
9942
9942
  `&&(n++,r=0),this.current.start=t,this.current.end=void 0;let[o,l]=eE(this.object,n,r),{AD:c,descender:h}=this.object,d=h+.5*c,{width:u,height:p,depth:f}=this.object.geometry.userData.parameters,g=typeof u=="string"?0:u,m=typeof p=="string"?0:p;this.caretMesh.scale.set(1,this.caretHeight,1),this.caretMesh.position.set(o-.5*g,l+d+.5*m,f),this.hideSelectionMesh(),this.showCaretMesh()}setSelection(t,e){if(this.object===void 0)return;let i=this.object.wrappedText;this.current.start=t,this.current.end=e;let n=[],r=[],s=function(m,v,y){let[_,b]=$y(m,v),[x,w]=$y(m,y),S=[];b>=m[_].length&&(_++,b=0);for(let E=_;E<=x;E++){let A=m[E],P=E===_?b:0,C=E===x?w:A.length;S.push([E,P,C])}return S}(i,t,e),{lineHeight:a,AD:o,descender:l}=this.object,c=l+.5*o-.5*a;for(let[m,v,y]of s)if(v!==y){let[_,b]=eE(this.object,m,v),[x,w]=eE(this.object,m,y),S=b,E=w;S+=c,E+=c,E+=a;let A=n.length/3;n.push(_,S,0),n.push(x,S,0),n.push(x,E,0),n.push(_,E,0),r.push(A+0,A+1,A+2),r.push(A+2,A+3,A+0)}let h=new jt;h.setIndex(r),h.setAttribute("position",new Nt(n,3));let{width:d,height:u,depth:p}=this.object.geometry.userData.parameters,f=typeof d=="string"?0:d,g=typeof u=="string"?0:u;this.selectionMesh.geometry.dispose(),this.selectionMesh.geometry=h,this.selectionMesh.position.x=.5*-f,this.selectionMesh.position.y=.5*g,this.selectionMesh.position.z=p,this.showSelectionMesh(),this.hideCaretMesh()}getSelectionFromPosition(t,e,i="previous"){if(this.object===void 0||this.object.font===void 0)return;let n=this.object.wrappedText,r=n.length,s=this.object.lineHeight,a=r*s,{height:o,verticalAlign:l}=this.object.geometry.userData.parameters,c=typeof o=="string"?0:o,h=0;l===3?h=c-a:l===2&&(h=.5*c-.5*a);let d=Math.min(Math.floor(Math.max(Math.min(-e-h,a),0)/s),r-1),u=this.object.charCoords[d],p=this.object.charWidths[d],f=0,g=!1;if(i==="previous"){for(let m=0;m<u.length;m++)if(u[m][0]+.5*p[m]-t>0){f=m,g=!0;break}}else if(i==="closest"){let m=1/0;for(let v=0;v<u.length;v++){let y=u[v][0]+.5*p[v],_=Math.abs(y-t);_<m&&(m=_,f=v,g=!0)}}else for(let m=0;m<u.length;m++){let v=u[m][0],y=u[m][0]+p[m];if(t>=v&&t<y){f=m,g=!0;break}}return g||(f=u.length),{index:this.getGlobalIndexFromLineAndCharIndexes(n,d,f),lineIndex:d,characterIndex:f}}getGlobalIndexFromLineAndCharIndexes(t,e,i){return t.slice(0,e).reduce((n,r)=>n+r.length,0)+i}showSelectionMesh(){this.selectionMesh.material.opacity=this._selectionVisibleAlpha}hideSelectionMesh(){this.selectionMesh.material.opacity=0}showCaretMesh(){this.caretMesh.material.opacity=this._caretVisibleAlpha}hideCaretMesh(){this.caretMesh.material.opacity=0}};function eE(t,e,i){let{charCoords:n,charWidths:r,initialOffsetY:s,lineHeight:a}=t;if(n[e]&&n[e].length===0||n.length===0){let d=0,{horizontalAlign:u}=t.data.geometry,p=t.wrappedText,{width:f}=t.geometry.userData.parameters;return p.length===1&&p[0].length===0&&(u===3?d=.5*f:u===2&&(d=f)),[d,s-a*e]}let o=n[e];if(o===void 0||o.length===0)return[0,0];let[l,c]=o[Math.min(i,o.length-1)],h=l;return i>=o.length&&(h+=r[e][i-1]),[h,c]}function $y(t,e){let i=0;for(let n=0;n<t.length;n++){let r=t[n],s=e-i;if(s<=r.length)return[n,s];i+=r.length}return[Math.max(0,t.length-1),t[t.length-1]?.length??0]}function Wit(t,e){return typeof t=="string"?e.data.colors[t]:t}function qit(t){return t.colors[0]}tt();var Xit=class{constructor(){this._clickCount=0,this._lastTime=0,this._lastPosition=[0,0],this._delay=500,this._distance=2,this._onMouseDown=t=>{let e=[t.clientX,t.clientY],i=new Date().getTime();if(this._clickCount>0){let n=e[0]-this._lastPosition[0],r=e[1]-this._lastPosition[1];Math.sqrt(n*n+r*r)>this._distance&&(this._clickCount=0)}this._lastPosition=e,this._clickCount=i-this._lastTime>this._delay?1:this._clickCount+1,this._lastTime=i},this._onMouseUp=t=>{}}start(t,e=500,i=2){this._target&&this.stop(),this.reset(),this._delay=e,this._distance=i,this._target=t,this._target.addEventListener("pointerdown",this._onMouseDown,!1),this._target.addEventListener("pointerup",this._onMouseUp,!1)}stop(){this._target&&(this._target.removeEventListener("pointerdown",this._onMouseDown,!1),this._target.removeEventListener("pointerup",this._onMouseUp,!1),this._target=void 0)}get clickCount(){return this._clickCount}reset(){this._clickCount=0,this._lastTime=0,this._lastPosition=[0,0]}};ti();var $it=new T(0,0,1),FU=new T,NU=new T,kU=new ue,Yit=class{constructor(t,e,i,n,r){this.containerScene=t,this.raycaster=e,this.sharedAssets=i,this.requestRender=n,this.onExit=r,this.htmlInput=null,this.virtualInput=null,this.helper=new S9,this.doubleClickHandler=new Xit,this.isDragging=!1,this.plane=new Vr,this.caretInterval=0,this.planeIntersection=new T,this.projected=new et,this._lastIndex=0,this._isFirstDragMove=!1,this.selectionOnDragStart=0,this.onTextMaterialChanged=()=>{let s=this.virtualInput?.data;if(this.virtualInput!==void 0&&s){let a=s.material,o=function(l,c){let h=Tn.fromHex(3223857),d=.8;for(let u of l.layers){if(u.data.type==="light"||u.data.type==="displace"||u.data.type==="fresnel"||u.data.type==="dust"||u.data.type==="matcap"||u.data.type==="texture"||u.data.type==="toon"||u.data.type==="outline"||u.data.type==="transmission"||u.data.type==="noise"||u.data.type==="vertexColor")continue;let p=typeof u.data.alpha=="string"?Number(c.getVariable(u.data.alpha)):u.data.alpha;if(u.data.type==="color"&&p>.3){h=Wit(u.data.color,c),d=p;break}if((u.data.type==="depth"||u.data.type==="gradient")&&p>.3){let f=qit(u.data);h={r:f[0],g:f[1],b:f[2]},d=typeof u.data.alpha=="string"?1:u.data.alpha;break}}return{...h,a:d}}(typeof a=="string"?this.sharedAssets.data.materials[a]:a,this.sharedAssets);this.helper.setCaretColor(o)}},this.stopAnimateTextCursor=()=>{clearInterval(this.caretInterval),this.helper&&(this.helper.caretMesh.visible=!1)},this.startAnimateTextCursor=()=>{this.stopAnimateTextCursor(),this.helper&&(this.helper.caretMesh.visible=!0,this.caretInterval=setInterval(()=>{this.helper&&(this.helper.caretMesh.visible=!this.helper.caretMesh.visible),this.requestRender()},600))},this.handleCaretUpdate=s=>{if(!this.htmlInput||!this.virtualInput)return;let a=this.helper,o=s?.key==="ArrowLeft"||s?.key==="ArrowRight",l=s?.key==="ArrowUp"||s?.key==="ArrowDown";this.htmlInput.selectionStart===this.htmlInput.selectionEnd?(a.setCaretPosition(this.htmlInput.selectionStart,{horizontalKeyMove:o,verticalKeyMove:l}),this.startAnimateTextCursor()):a.setSelection(this.htmlInput.selectionStart,this.htmlInput.selectionEnd),this.requestRender()},this.containerScene.add(this.helper)}createInput(){return this.htmlInput=function(){let t=document.createElement("textarea");return t.style.position="fixed",t.style.top="200px",t.style.left="400px",t.style.zIndex="-1",t.style.border="1px solid rgba(255,0,0,0.5)",t.style.width="10px",t.style.height="500px",t.style.color="white",t.style.opacity="0.5",t.style.background="transparent",t.style.display="none",t.style.margin="0px",t.style.padding="0px",t.style.boxSizing="content-box",t.style.pointerEvents="none",t}(),this.htmlInput}connect(){}disconnect(){this.stopAnimateTextCursor(),this.helper.hide(),this.htmlInput?.remove(),this.doubleClickHandler.stop()}handleMouseDown(){if(!this.htmlInput||!this.virtualInput)return!0;this.getPointOnPlane();let t=this.doubleClickHandler.clickCount,e=this.helper.getSelectionFromPosition(this.projected.x,this.projected.y,t>1?"inside":"previous")??{index:0,lineIndex:0,characterIndex:0},{lineIndex:i}=e,{index:n,characterIndex:r}=e;this.virtualInput?.wrappedText?.length&&this.virtualInput.wrappedText[i][Math.max(0,r-1)]===`
9943
9943
  `&&(n--,r--),this._lastIndex=n,this._isFirstDragMove=!0;let s=this.checkClickedObject();if(t===1){if(s===null)return this.onExit(this.virtualInput),!0;this.selectionOnDragStart=n,this.isDragging=!0,this.setInputSelection(n)}else s===this.virtualInput&&(t===2?this.selectClosestWord(i,r):t>2&&(this.setInputSelection(0,this.htmlInput.value.length),this.doubleClickHandler.reset()))}handleMouseUp(){this.applyRangeToTextInput(),this.isDragging=!1,this._isFirstDragMove=!1}handleMouseMove(){!this.virtualInput||(this._isFirstDragMove&&this.doubleClickHandler.clickCount>1&&(this.selectionOnDragStart=this._lastIndex,this.isDragging=!0,this.setInputSelection(this._lastIndex)),this._isFirstDragMove=!1,this.getPointOnPlane(),this.applyRangeToTextInput())}focus(t){if(this.virtualInput=t,this.updateTextInputStyles(),this.htmlInput)if(t){let e=this.data?.geometry.text;this.htmlInput.value=typeof e=="string"?"":e?.textValue.toString()??""}else this.htmlInput.value=""}blur(){}get data(){let{virtualInput:t}=this;if(t)return t.dataPatched}applyRangeToTextInput(){if(!this.isDragging||!this.virtualInput||!this.htmlInput)return;let t=this.selectionOnDragStart,{index:e,lineIndex:i,characterIndex:n}=this.helper.getSelectionFromPosition(this.projected.x,this.projected.y,this.doubleClickHandler.clickCount>2?"inside":"previous")??{index:0},r=e;i!==void 0&&n!==void 0&&this.virtualInput?.wrappedText[i][n-1]===`
9944
- `&&r--,this.htmlInput.setSelectionRange(Math.min(t,r),Math.max(t,r))}checkClickedObject(){if(this.virtualInput){let t=this.raycaster.intersectObject(this.virtualInput,!1);if(t.length>0){let e=t[0];if(e.object instanceof _P)return e.object}}return null}selectClosestWord(t,e){if(!this.virtualInput)return;let i=this.virtualInput.wrappedText,n=i[t],r=e+1,s=e;n[e]!==" "&&(r=this.findNextCharOccurence(n,e,"forward"," "),s=this.findNextCharOccurence(n,e,"backward"," "),s>0&&s++,r>=n.length-1&&t===i.length-1&&r++);let a=this.helper,o=a.getGlobalIndexFromLineAndCharIndexes(i,t,s),l=a.getGlobalIndexFromLineAndCharIndexes(i,t,r);this.setInputSelection(o,l)}findNextCharOccurence(t,e,i,n=" "){let r=Math.max(0,t.length-1),s=i==="forward"?r:0,a=i==="forward"?1:-1,o=Math.max(Math.min(e,r),0);for(;o!==s;)if(o+=a,t.charAt(o)===n)return o;return s}getPointOnPlane(){let t=this.virtualInput?.data;if(this.virtualInput&&t&&this.raycaster.ray.intersectsPlane(this.plane)){this.planeIntersection===null&&(this.planeIntersection=new T);let e=this.raycaster.ray.intersectPlane(this.plane,this.planeIntersection);if(e){this.planeIntersection.copy(this.virtualInput.worldToLocal(e));let i=typeof t.geometry.width=="number"?t.geometry.width:1,n=typeof t.geometry.height=="number"?t.geometry.height:1;this.projected.set(e.x+.5*i,e.y-.5*n)}}}updatePlane(){let t=this.virtualInput?.data;this.virtualInput&&t&&(kU.getNormalMatrix(this.virtualInput.matrixWorld),FU.copy($it).applyMatrix3(kU).normalize(),this.virtualInput.localToWorld(NU.set(0,0,t.geometry.depth)),this.plane.setFromNormalAndCoplanarPoint(FU,NU))}setInputSelection(t,e=t){this.htmlInput?.setSelectionRange(t,e),Qc&&this.htmlInput?.focus(),setTimeout(()=>{this.htmlInput?.focus()})}updateTextInputStyles(){let t=this.virtualInput?.data;this.virtualInput&&t&&this.htmlInput&&(this.htmlInput.style.fontSize=t.geometry.fontSize+"px",this.htmlInput.style.letterSpacing=t.geometry.letterSpacing*t.geometry.fontSize+"px",this.htmlInput.style.lineHeight=t.geometry.fontSize*t.geometry.lineHeight+"px",this.htmlInput.style.width=t.geometry.width+"px",this.htmlInput.style.height=t.geometry.height+"px",this.htmlInput.style.textAlign=function(e){return e===4?"justify":e===2?"right":e===3?"center":"left"}(t.geometry.horizontalAlign))}},M9=(t,e)=>{if(typeof t=="string"){let i=e.data(t);if(i)return M9(i.value,e)}return br.getDisplayedValue(t)};function VU(t,e){let i=t.text,n="";if(typeof i=="string"){let r=e.variables.data(n);r&&(n=M9(r.value,e.variables))}else n=i.textValue.toString();return n}var Zit=class extends Lr{constructor(t,e){super(t),this.eventManager=e,this._textInputs=[],this.sceneHelpers=new ss,this.helper=new S9,this._onMouseDownFocusIn=i=>{if(ae.length>1)return;this.eventContext.updateRaycaster(i);let n=null;if(this.eventContext.raycaster){for(let r of this._textInputs)if(this.eventContext.raycaster.intersectObject(r,!0).length>0){n=r;break}}this.focusOnTextInput(n),this._onCaretUpdate(),this._onMouseUp(),this.textInputManager.doubleClickHandler.start(this.eventContext.domElement),this.textInputManager.doubleClickHandler._onMouseDown(i),this._onMouseDown(i)},this.onExit=()=>{let{virtualInput:i}=this.textInputManager;if(i===null)return;let n=this.textInputManager.htmlInput;this.helper.hide(),n?.setSelectionRange(n.value.length,n.value.length),this.eventManager.controlsManager.orbitControls&&(this.eventManager.controlsManager.orbitControls.enabled=!0);let{domElement:r}=this.eventContext;r.removeEventListener("pointerdown",this._onMouseDown,!1),r.removeEventListener("pointerup",this._onMouseUp,!1),r.removeEventListener("pointermove",this._onMouseMove,!1),window.removeEventListener("keydown",this._onKeyPress),this.textInputManager.doubleClickHandler.reset(),r.addEventListener("pointerdown",this._onMouseDownFocusIn),this.eventContext.renderer.sceneHelpersOnTop=void 0,this.eventContext.renderer.pipeline.disableHelpers()},this._onMouseDown=i=>{this.eventContext.updateRaycaster(i),this.textInputManager.handleMouseDown(),this.textInputManager.virtualInput&&this.eventContext.raycaster.intersectObject(this.textInputManager.virtualInput,!0).length>0&&this.eventManager.controlsManager.orbitControls&&(this.eventManager.controlsManager.orbitControls.enabled=!1)},this._onMouseUp=()=>{this.textInputManager.handleMouseUp(),this.eventManager.controlsManager.orbitControls&&!this.eventManager.controlsManager.orbitControls.enabled&&(this.eventManager.controlsManager.orbitControls.enabled=!0)},this._onMouseMove=i=>{this.eventContext.updateRaycaster(i),this.textInputManager.handleMouseMove()},this._onTextEdit=i=>{let{htmlInput:n,virtualInput:r,helper:s}=this.textInputManager;if(!n||!r)return;let a=n.value;r.textGeometry.setText(a,this.eventContext.sharedAssets).then(()=>{this.eventContext.requestRender()});let o=r.data;s.update();let l=o.geometry.text;if(typeof l=="string"){let c=l;this.eventContext.sharedAssets.updateVariable(c,{textValue:a})}this.textInputManager.updateTextInputStyles(),this._onCaretUpdate()},this._onCaretUpdate=i=>{this.textInputManager.handleCaretUpdate(i)},this._onKeyPress=i=>{i.key==="Escape"&&this.onExit()},this.textInputManager=new Yit(this.sceneHelpers,t.raycaster,t.sharedAssets,t.requestRender,this.onExit)}connect(){let t=[];if(this.eventContext.scene.traverseEntity(n=>{n instanceof _P&&t.push(n)}),this._textInputs=t,t.length===0)return;let{domElement:e}=this.eventContext;e.addEventListener("pointerdown",this._onMouseDownFocusIn),this.textInputManager.connect();let i=this.textInputManager.createInput();document.body.appendChild(i),i.style.display="none",i.addEventListener("keyup",this._onCaretUpdate),i.addEventListener("keydown",this._onCaretUpdate),i.addEventListener("beforeinput",this._onCaretUpdate),i.addEventListener("paste",this._onCaretUpdate),i.addEventListener("cut",this._onCaretUpdate),i.addEventListener("select",this._onCaretUpdate),i.addEventListener("selectstart",this._onCaretUpdate)}disconnect(){let t=this.textInputManager.htmlInput,{domElement:e,sharedAssets:i}=this.eventContext;e.removeEventListener("pointerdown",this._onMouseDownFocusIn),t?.removeEventListener("keyup",this._onCaretUpdate),t?.removeEventListener("keydown",this._onCaretUpdate),t?.removeEventListener("beforeinput",this._onCaretUpdate),t?.removeEventListener("paste",this._onCaretUpdate),t?.removeEventListener("cut",this._onCaretUpdate),t?.removeEventListener("select",this._onCaretUpdate),t?.removeEventListener("selectstart",this._onCaretUpdate),this._textInputs.forEach(n=>{let r=VU(n.data.geometry,this.eventContext.sharedAssets.data);n.textGeometry.setText(r,i)}),e.removeEventListener("pointerdown",this._onMouseDown,!1),e.removeEventListener("pointerup",this._onMouseUp,!1),e.removeEventListener("pointermove",this._onMouseMove,!1),window.removeEventListener("keydown",this._onKeyPress),this.eventContext.renderer.sceneHelpersOnTop=void 0,this.eventContext.renderer.pipeline.disableHelpers(),this.textInputManager.disconnect()}focusOnTextInput(t){this.textInputManager.focus(t),this.textInputManager.onTextMaterialChanged();let e=this.textInputManager.htmlInput;if(!e||t===null)return;this.textInputManager.updateTextInputStyles(),this.eventContext.renderer.sceneHelpersOnTop=this.sceneHelpers,this.eventContext.renderer.pipeline.enableHelpers(),this.textInputManager.isDragging=!1;let i=VU(t.textGeometry.userData.parameters,this.eventContext.sharedAssets.data);e.value=i,e.setSelectionRange(0,0),this.textInputManager.helper.show(t),e.style.display="block",e.addEventListener("input",this._onTextEdit),this.textInputManager.updatePlane();let{domElement:n}=this.eventContext;n.removeEventListener("pointerdown",this._onMouseDownFocusIn),n.addEventListener("pointerdown",this._onMouseDown,!1),n.addEventListener("pointerup",this._onMouseUp,!1),n.addEventListener("pointermove",this._onMouseMove,!1),window.addEventListener("keydown",this._onKeyPress)}};ke(),ws("Textfields",({eventContext:t,eventManager:e})=>new Zit(t,e)),Ep("InputGeometry",(t,e,i)=>new _P(t,e,i)),Si("textinputs"),y3();var E9=new Map,Ag=new Map,Yy=class{constructor(t,e,i,n){this.data=e,this.isPlayAudioAction=!0;let{audio:r,volume:s,delay:a,loop:o}=e;if(!r)throw new Error("Missing property");try{let l=typeof r=="string"?n.getAudio(r).src:r.data;this.audioPlayer=new Fu({src:l,volume:s,delay:a,loop:o})}catch{console.warn(`Could not create an audio player for this object: "${i.name}" and this audio: "${r}"`)}Ag.has(i.uuid)?Ag.get(i.uuid).push(this):Ag.set(i.uuid,[this]),E9.set(t,this)}playByToggle(){this.data.toggle==="stop"?this.audioPlayer?.status==="playing"?this.audioPlayer.stop():(this.audioPlayer?.stop(),this.audioPlayer?.play()):this.data.toggle==="pause"?this.audioPlayer?.status==="playing"?this.audioPlayer?.pause():this.audioPlayer?.play():(this.audioPlayer?.stop(),this.audioPlayer?.play())}dispose(){this.audioPlayer?.stop()}},Kit=class{constructor(t){this.data=t,this.isPauseAudioAction=!0}dispatch(){this.data.playAudio?this.pauseAudio(this.data.playAudio):this.data.object?this.pauseAllAudiosFromObject(this.data.object):this.pauseAllAudios()}pauseAudio(t){let e=E9.get(t);!e||(this.data.delay>0?(this.disposeDelay(),this.timeoutId=window.setTimeout(()=>{e.audioPlayer?.[this.data.interaction](),this.disposeDelay()},this.data.delay)):e.audioPlayer?.[this.data.interaction]())}pauseAllAudiosFromObject(t){let e=Ag.get(t);!e?.length||(this.data.delay>0?(this.disposeDelay(),this.timeoutId=window.setTimeout(()=>{e.forEach(i=>i.audioPlayer?.[this.data.interaction]()),this.disposeDelay()},this.data.delay)):e.forEach(i=>i.audioPlayer?.[this.data.interaction]()))}pauseAllAudios(){let t=[...Ag.values()];!t.length||(this.data.delay>0?(this.disposeDelay(),this.timeoutId=window.setTimeout(()=>{t.forEach(e=>{e.forEach(i=>{i.audioPlayer?.[this.data.interaction]()})}),this.disposeDelay()},this.data.delay)):t.forEach(e=>{e.forEach(i=>{i.audioPlayer?.[this.data.interaction]()})}))}disposeDelay(){clearTimeout(this.timeoutId),delete this.timeoutId}dispose(){clearTimeout(this.timeoutId),delete this.timeoutId}},Qit=class{constructor(t,e,i,n,r){if(this.data=e,this.shared=n,this.condition=r,e.interaction==="play")this.interaction=new Yy(t,e,i,n);else{if(e.interaction!=="pause"&&e.interaction!=="stop")throw new Error("Missing property");this.interaction=new Kit(e)}}dispatchBasic(){if(wi(this.shared,this.condition)===!1)return!1;this.interaction instanceof Yy?this.interaction.playByToggle():this.interaction.dispatch()}dispatchConditional(){if(wi(this.shared,this.condition)===!1)return!1;this.interaction instanceof Yy?this.interaction.audioPlayer?.play():this.interaction.dispatch()}dispatchGameControl(t){if(wi(this.shared,this.condition)===!1)return!1;this.interaction instanceof Yy&&(t==="start"?this.interaction.audioPlayer?.play():this.interaction.audioPlayer?.stop())}dispose(){this.interaction.dispose()}};ke(),Dr("Audio",({id:t,data:e,object:i,shared:n,actionCondition:r})=>new Qit(t,e,i,n,r)),Si("audio"),ti();var A9=new Map,Tg=new Map,iE=class{constructor(t,e,i){this.data=e,this.isPlayVideoAction=!0,this.delay=0,this.status="stopped";let{layerId:n,loop:r,volume:s,delay:a}=e;if(this.object=i,n===void 0)throw new Error("Missing property");let o=function(l,c){let h;if("material"in l){let u=l.material;h=Array.isArray(u)?l.material[0].layers.find(p=>p.uuid===c):l.material.layers.find(p=>p.uuid===c)}if(!h)return;let d=h.color?.texture?.image?.img??h.holders?.find(u=>u.isVideo)?.img;return d instanceof HTMLVideoElement?d:void 0}(i,n);o&&(this.videoElement=o,this.videoElement.loop=r===1/0,Qc&&(this.videoElement.autoplay=!0),s!==void 0&&(this.videoElement.volume=s)),a!==void 0&&(this.delay=a),Tg.has(i.uuid)?Tg.get(i.uuid).push(this):Tg.set(i.uuid,[this]),A9.set(t,this),this.pause()}mute(){!this.videoElement||(this.videoElement.muted=!0)}unMute(){!this.videoElement||(this.videoElement.muted=!1)}play(t){if(!this.videoElement)return;let e=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);t?(this.mute(),this.delay+=150):e?(this.mute(),window.setTimeout(()=>{this.unMute()},100)):this.unMute(),this.delayTimerId=window.setTimeout(()=>{if(!this.videoElement)return;let i=this.videoElement.play();i!==void 0&&i.then(n=>{}).catch(n=>{this.play()}),this.clearDelay()},this.delay),this.status="playing"}clearDelay(){this.delayTimerId&&(clearTimeout(this.delayTimerId),delete this.delayTimerId)}pause(){!this.videoElement||(this.videoElement.pause(),this.status="paused")}stop(){!this.videoElement||(this.videoElement.pause(),this.videoElement.currentTime=0,this.status="stopped",this.clearDelay())}seek(t){return new Promise(e=>{if(!this.videoElement)return e();let i=this.videoElement.duration;if(i>0){let n=t%i;this.videoElement.currentTime=n}this.videoElement.addEventListener("seeked",()=>e(),{once:!0})})}playByToggle(){this.data.toggle==="stop"?this.status==="playing"?this.stop():(this.stop(),this.play()):this.data.toggle==="pause"?this.status==="playing"?this.pause():this.play():(this.stop(),this.play())}dispose(){!this.videoElement||(this.stop(),this.videoElement.muted=!0)}},Jit=class{constructor(t){this.data=t,this.isPauseVideoAction=!0}dispatch(){this.data.playVideo?this.pauseVideo(this.data.playVideo):this.data.object?this.pauseAllVideosFromObject(this.data.object):this.pauseAllVideos()}pauseVideo(t){let e=A9.get(t);!e||(this.data.delay>0?(this.disposeDelay(),this.timeoutId=window.setTimeout(()=>{e[this.data.interaction](),this.disposeDelay()},this.data.delay)):e[this.data.interaction]())}pauseAllVideosFromObject(t){let e=Tg.get(t);!e?.length||(this.data.delay>0?(this.disposeDelay(),this.timeoutId=window.setTimeout(()=>{e.forEach(i=>i[this.data.interaction]()),this.disposeDelay()},this.data.delay)):e.forEach(i=>i[this.data.interaction]()))}pauseAllVideos(){let t=[...Tg.values()];!t.length||(this.data.delay>0?(this.disposeDelay(),this.timeoutId=window.setTimeout(()=>{t.forEach(e=>{e.forEach(i=>{i[this.data.interaction]()})}),this.disposeDelay()},this.data.delay)):t.forEach(e=>{e.forEach(i=>{i[this.data.interaction]()})}))}disposeDelay(){clearTimeout(this.timeoutId),delete this.timeoutId}dispose(){clearTimeout(this.timeoutId),delete this.timeoutId}},tnt=class{constructor(t,e,i,n,r){if(this.data=e,this.shared=n,this.condition=r,e.interaction==="play")this.interaction=new iE(t,e,i);else{if(e.interaction!=="pause"&&e.interaction!=="stop")throw new Error("Missing property");this.interaction=new Jit(e)}}dispatchBasic(){if(wi(this.shared,this.condition)===!1)return!1;this.interaction instanceof iE?this.interaction.playByToggle():this.interaction.dispatch()}dispatchConditional(){if(wi(this.shared,this.condition)===!1)return!1;this.interaction instanceof iE?this.interaction.play():this.interaction.dispatch()}dispose(){this.interaction.dispose()}};Bi(),ke(),Dr("Video",({id:t,data:e,object:i,shared:n,actionCondition:r})=>os(i)?null:new tnt(t,e,i,n,r)),Si("video"),ti(),tt(),Cp();var nE=(()=>{let t,e,i,n,r=!1;function s(l){!t&&!jU()&&(e?.sharedGameControlGlobals.createdObjects.length??0)>0&&(t=requestAnimationFrame(a)),l&&(e=l,n=l.requestRender,!r&&typeof document<"u"&&(document.addEventListener("visibilitychange",o),r=!0))}function a(l){if(!e||!n)return t=void 0,void(i=void 0);let c=i?l-i:0,h=e.sharedGameControlGlobals.createdObjects,d=e.sharedGameControlGlobals.nCreatedPerAction,u=h.length,p=0;for(;p<u;){let f=h[p];f.userData.createdTime===void 0&&(f.userData.createdTime=l),f.userData.lifetime===void 0&&f.userData.quantity===void 0||f.userData.lifetime&&l-f.userData.createdTime<f.userData.lifetime||f.userData.quantity&&d[f.userData.actionId]<=f.userData.quantity?(f.userData.velocity&&(f.position.addScaledVector(f.userData.velocity,c/1e3),f.updateMatrix(),n()),p++):(d[f.userData.actionId]>f.userData.quantity&&d[f.userData.actionId]--,h.splice(p,1),f.removeFromParent(),e.sharedGameControlGlobals.rapierWorld&&f.rigidBody?(e.sharedGameControlGlobals.colliderToEntity.delete(f.rigidBody.collider(0).handle),e.sharedGameControlGlobals.rapierWorld.removeRigidBody(f.rigidBody)):(f.bvhGeometry=void 0,e.sharedGameControlGlobals.entitiesWithTransformAnim=e.sharedGameControlGlobals.entitiesWithTransformAnim.filter(g=>g.bvhGeometry!==void 0)),u--,n())}t=p>0?requestAnimationFrame(a):void 0,i=p>0?l:void 0}function o(){jU()?t&&(cancelAnimationFrame(t),t=void 0,i=void 0):s()}return{play:s,dispose:function(){t&&(cancelAnimationFrame(t),t=void 0),r&&typeof document<"u"&&(document.removeEventListener("visibilitychange",o),r=!1),e=void 0,n=void 0,i=void 0}}})();function jU(){return!!document&&document.hidden}var GU=new Wt,ent=new T,int=new T,nnt=class{constructor(t,e,i,n,r){this.data=t,this.page=e,this.controlsManager=i,this.shared=n,this.condition=r,this.intervalId=null,this.timeoutIdQueue=[],this.uniqueId=Ot.generateUUID(),this.dispatch=()=>{if(wi(this.shared,this.condition)===!1)return!1;this.data.delay?this.timeoutIdQueue.push(window.setTimeout(this.dispatchInner,1e3*this.data.delay)):this.dispatchInner()},this.dispatchFromStart=()=>{if(wi(this.shared,this.condition)===!1)return!1;this.timeoutIdQueue.push(window.setTimeout(this.dispatchInner,1e3*this.data.delay))},this.dispatchThrottled=function(a,o=0,l={}){return Vg(a,o,{leading:l.leading!==!1,trailing:l.trailing!==!1,maxWait:o})}(this.dispatch,1e3/this.data.creationSpeed),this.dispatchStart=()=>{this.intervalId===null&&(this.intervalId=window.setInterval(this.dispatch,1e3/this.data.creationSpeed))},this.dispatchStop=()=>{this.intervalId!==null&&(window.clearInterval(this.intervalId),this.intervalId=null)},this.dispatchInner=()=>{this.timeoutIdQueue.shift();let a=new _s(this.object);if(a.playModeVisible=!0,a.expand(),this.data.coordinateSystem!=="world"){let l=this.data.coordinateSystem,c=this.page.scene.find(l);c&&(c.updateMatrixWorldRigid(),a.hiddenMatrix.copy(c.matrixWorldRigid))}a.scale.copy(this.object.scale),a.position.fromArray(this.data.position.map(l=>typeof l=="number"?l:0)),a.rotation.fromArray(this.data.rotation.map(l=>typeof l=="number"?l:0)),a.updateMatrix(),this.page.add(a);let o=this.controlsManager.sharedGameControlGlobals;o.createdObjects.push(a),o.nCreatedPerAction[this.uniqueId]===void 0?o.nCreatedPerAction[this.uniqueId]=1:o.nCreatedPerAction[this.uniqueId]++,a.updateWorldMatrix(!0,!0),a.traverseObject(this.traverseObjectCB),nE.play(),this.controlsManager.requestRender()},this.traverseObjectCB=a=>{let o;if(a.hasNonUniformScale&&a.updateMatrixWorldRigid(),this.controlsManager.sharedGameControlGlobals.rapierWorld){if(a instanceof jc){if(!a.objectForSample)return a.object.dataPatched.physics.fusedBody===!0&&a.object.dataPatched.physics.rigidBody==="dynamic"||void 0;if(a.objectForSample.dataPatched.physics.fusedBody)return;o=a.object}else if(a instanceof _s)o=a.object;else if(o=a,o.dataPatched.cloner?.hideBase)return!0}else{if(a instanceof jc)return;o=a instanceof _s?a.object:a}this.data.destroy==="Time"?a.userData.lifetime=1e3*this.data.lifetime:this.data.destroy==="Quantity"&&(a.userData.quantity=this.data.destroyAfterQuantity,a.userData.actionId=this.uniqueId);let l=new T().fromArray(this.data.velocity.map(h=>typeof h=="number"?h:0)),c=o.dataPatched;if(!(c.physics.enabled==="visibility"?!c.visible:!c.physics.enabled)&&(this.controlsManager.sharedGameControlGlobals.rapierWorld?(this.controlsManager.addRigidBody(a,o,{fromCreate:!0,dynamic:this.data.dynamic}),this.data.destroy==="Collision"&&(a.rigidBody?.collider(0).setActiveEvents(1),a.userData.hasCollisionDestroy=!0),a.matrixWorld.decompose(ent,GU,int),l.applyQuaternion(GU),this.data.velocity.some(h=>h!==0)&&this.data.dynamic&&a.rigidBody?.setLinvel(l.divideScalar(this.controlsManager.pixelsPerMeter),!0)):("geometry"in a.object&&this.controlsManager.addBoundsTree(a),this.data.velocity.some(h=>h!==0)&&this.data.dynamic&&(a.userData.velocity=l)),o.dataPatched.physics?.fusedBody===!0))return!0};let s=this.page.scene.find(this.data.object);if(!s)throw new Error("Missing Property");if(this.object=s,this.data.coordinateSystem!=="world"&&!this.page.scene.find(this.data.coordinateSystem))throw new Error("Missing Property");nE.play(i)}dispose(){this.intervalId!==null&&(window.clearInterval(this.intervalId),this.intervalId=null),this.timeoutIdQueue.forEach(t=>window.clearTimeout(t)),this.timeoutIdQueue=[],this.dispatchThrottled.cancel(),this.page.remove(...this.controlsManager.sharedGameControlGlobals.createdObjects),this.controlsManager.sharedGameControlGlobals.createdObjects=[],nE.dispose()}},rnt=class{constructor(t,e,i,n,r){this.data=t,this.page=e,this.controlsManager=i,this.shared=n,this.condition=r,this.timeoutIdQueue=[],this.dispatchInner=()=>{this.objects.forEach(this.destroyCallback)},this.destroyCallback=s=>{this.timeoutIdQueue.shift();let a=this.page.scene.find(s);if(a===void 0)return;let o=this.controlsManager.sharedGameControlGlobals.rapierWorld,l=!o||a.dataPatched.physics?.fusedBody;if(a.cloner){for(let c of a.cloner.children)l?(c.playModeVisible=!1,a.dataPatched.physics?.rigidBody==="positioned"&&this.removeBody(c),c.bvhGeometry&&(c.bvhGeometry=void 0)):this.clone===void 0||this.clone===c?(c.playModeVisible=!1,this.removeBody(c)):c.playModeVisible===void 0&&(c.playModeVisible=!0);a.cloner.syncInstanceMatrices(),(l||this.clone===void 0||this.clone===!1)&&(a.visible=!1,this.removeBody(a),a.bvhGeometry&&(a.bvhGeometry=void 0))}else this.removeBody(a),a.bvhGeometry&&(a.bvhGeometry=void 0),a.visible=!1;this.controlsManager.sharedGameControlGlobals.entitiesWithTransformAnim=o===void 0?this.controlsManager.sharedGameControlGlobals.entitiesWithTransformAnim.filter(c=>c.bvhGeometry!==void 0):this.controlsManager.sharedGameControlGlobals.entitiesWithTransformAnim.filter(c=>c.rigidBody!==void 0),a.destroyedInAction=!0,this.controlsManager.requestRender()},this.objects=[...t.objects]}removeBody(t){let e=t.rigidBody;if(!e)return;let i=this.controlsManager.sharedGameControlGlobals;i.colliderToEntity.delete(e.collider(0).handle),i.kinematicBodyToEntity.delete(e.handle);let n=this.controlsManager;n.fixedBodiesToWatch=n.fixedBodiesToWatch.filter(([,r])=>r!==e),i.rapierWorld.removeRigidBody(e),t.rigidBody=void 0}dispatch(t){if(wi(this.shared,this.condition)===!1)return!1;this.clone=t,this.data.delay?this.timeoutIdQueue.push(window.setTimeout(this.dispatchInner,1e3*this.data.delay)):this.dispatchInner()}dispatchFromStart(){if(wi(this.shared,this.condition)===!1)return!1;this.timeoutIdQueue.push(window.setTimeout(this.dispatchInner,1e3*this.data.delay))}dispose(){this.timeoutIdQueue.forEach(t=>window.clearTimeout(t))}};ke(),Dr("Create",({data:t,page:e,eventManager:i,shared:n,actionCondition:r})=>new nnt(t,e,i.controlsManager,n,r)),Dr("Destroy",({data:t,page:e,eventManager:i,shared:n,actionCondition:r})=>new rnt(t,e,i.controlsManager,n,r)),Si("create-destroy"),$t(),$t(),qr(),tt(),Ws(),Xr(),Bi();var HU=new T;function bP(t,e,i=!1){let n=[],r=s=>{let a=s.data;delete s.states,s.currentState=null,s.reversibleToState=null,s.currentTransitionEvent=null;for(let o of a.states){let l={...o.data};s.states||(s.states={}),s.states[o.id]=Ac.patch(a,l)}qU(t.scene,s,null,e,a.events.find(o=>o.data.type==="Follow"||o.data.type==="LookAt")!==void 0),WU(t)};t.scene.traverse2D(r),t.traverseChildren(s=>{if(i&&(s.rigidBody?.setTranslation(s.position0,!0),s.rigidBody?.setRotation(s.rotation0,!0),s.rigidBody?.setLinvel(HU,!0),s.rigidBody?.setAngvel(HU,!0)),!Be.is(s))return;let a=s.uuid,o=s.data;if(delete s.states,s.uuid===ed)return;let l=!1;n.some(c=>t.scene.find(a)?.isDescendantOf(c))?l=!0:o.physics?.fusedBody===!0&&o.physics.rigidBody==="dynamic"&&n.push(a),s.data=o,s.currentState=null,s.reversibleToState=null,s.currentTransitionEvent=null,s.transitionState={settled:!0,state:null};for(let c of o.states){let h={...c.data};t.data.globalPhysics.usePhysics===!0&&o.physics&&(o.physics.rigidBody==="dynamic"||l)&&(c.data.position!==void 0&&delete h.position,c.data.rotation!==void 0&&delete h.rotation,c.data.hiddenMatrix!==void 0&&delete h.hiddenMatrix),s.states||(s.states={}),s.states[c.id]=ih.patch(o,h)}qU(t.scene,s,null,e,o.events.find(c=>c.data.type==="Follow"||c.data.type==="LookAt")!==void 0),Pr(s)&&s.frame&&(s.frame.traverse(c=>r(c)),s.uiCanvas?.applySize())}),WU(t),t.frame&&(t.frame.traverse(s=>r(s)),t.uiCanvas?.applySize())}function WU(t){t.traverseEntity(e=>{for(let i of e.data.events){let n=[];switch(i.data.type){case"Follow":case"MouseHover":case"Scroll":case"MouseDown":case"MouseUp":case"MousePress":case"KeyUp":case"KeyDown":case"KeyPress":case"Collision":n.push(...i.data.actions);break;case"GameControl":for(let r of Object.values(i.data.gameActions))n.push(...r);break;case"DragDrop":n.push(...i.data.dragDropActions.drag,...i.data.dragDropActions.drop);break;case"Conditional":n.push(...i.data.inActions,...i.data.outActions)}for(let r of n)if(r.data.type==="Create"&&r.data.hideBase==="Yes"){let s=t.scene.find(r.data.object);s&&(s.visible=!1)}}})}function qU(t,e,i,n,r=!1){if(t.markShadowsDirty(),e instanceof Ai&&!ll(e)&&e.removeInteractionGeometry(n),os(e)?e.changeSelectedState(i,{shared:n},r):e.changeSelectedState(i,{scene:t,shared:n},r),e instanceof Ai&&e.updateGeometryGroupsIfNeeded(),e instanceof Zi&&e.updateCameraState(e.dataPatched,{scene:t,shared:n}),!os(e)){if(e.cloner){let s=!1;for(let a of e.cloner.children)a.playModeVisible=void 0,a.transformOverride!==void 0&&(a.transformOverride=void 0,s=!0);s&&t.addPendingUpdateCloner(e),e.cloner.syncInstanceMatrices()}e.updateVisible()}}var snt=class{constructor(t,e,i,n,r){this.data=t,this.page=e,this.eventManager=i,this.shared=n,this.condition=r,this.timeOutId=-1,this.scene=e.scene}dispatch(){if(wi(this.shared,this.condition)===!1)return!1;this.data.target!==this.page.uuid&&(window.clearTimeout(this.timeOutId),this.timeOutId=window.setTimeout(()=>{this.play()},1e3*this.data.delay))}dispose(){window.clearTimeout(this.timeOutId)}play(){if(this.scene.children.every(e=>e.uuid!==this.data.target||e.data.uiScene))return;this.data.transition==="fade"&&this.data.duration>0&&this.eventManager.eventContext.renderer.renderFromSceneForSceneTransitionPass(this.scene,this.scene.activeCamera,1e3*this.data.duration),this.eventManager.deactivate(),this.eventManager.controlsManager.deactivate();let t=this.scene.activeCamera;this.scene.updatePage(this.data.target),this.scene.traverseVisibleEntity(e=>{e.type==="ParticleSystem"&&(e.sleep(),e.wakeUp(),e.data.autoPlay?e.start():e.stop())}),this.scene.activePage.switchToPlayCamera(),this.scene.activeCamera.copyViewPlaneSize(t),bP(this.scene.activePage,this.shared),this.eventManager.activate(),this.eventManager.controlsManager.activate(this.eventManager)}};function ant(t){return{easing:t.type,control1:Fc(t.cubicControls?.control1,[0,0]),control2:Fc(t.cubicControls?.control2,[1,1]),...t.springParameters}}function gu(t,e){let i=[];for(let n of t??[]){let r=e(n.data);r!==void 0&&i.push({time:n.data.time,ease:ant(n.data.easing),value:r})}return{keyframes:Xet(i)}}function ja(t,e){if(t.keyframes.length===0)return;let{index0:i,index1:n,t:r}=function(o,l){if(o.length===0)throw new Error("sampleKeyframes requires at least one keyframe");if(l<=o[0].time)return{index0:0,index1:0,t:1};let{found:c,index:h}=function(m,v){let y=m.length,_=0,b=y;for(;_<b;){let x=_+Math.floor(y/2),w=m[x].time;if(w<v)_=x+1;else{if(!(w>v))return{found:!0,index:x};b=x}y=b-_}return{found:!1,index:_}}(o,l);if(c)return{index0:h,index1:h,t:1};if(h>=o.length){let m=o.length-1;return{index0:m,index1:m,t:1}}let d=h-1,u=h,p=o[d].time,f=o[u].time;if(f===p)return{index0:d,index1:u,t:.5};let g=XM(f-p);return{index0:d,index1:u,t:y9({...o[d].ease,control2:o[u].ease.control2},g,XM(XM(l-p)/g))}}(t.keyframes,e),s=t.read;if(s&&s.index0===i&&s.index1===n&&s.t===r)return;let a={index0:i,index1:n,from:t.keyframes[i].value,to:t.keyframes[n].value,t:r};return t.read=a,a}function ont(t){t.read=void 0}function Zy(t,e,i){return t+(e-t)*i}ke(),Dr("SceneTransition",({data:t,page:e,eventManager:i,shared:n,actionCondition:r})=>new snt(t,e,i,n,r)),Si("scene-transition"),$t(),tt(),$t(),$t(),tt(),Kn(),Ws(),z3(),j6(),V3(),Xr(),Bi(),hl(),I6(),$t(),ti(),tt(),_a();var{degToRad:urt,radToDeg:prt}=Ot,XU=new T,$U=new T,YU=new Wt;function fr(t,e,i,n,r,s){let a=i[t]!==void 0?i[t]:void 0,o=n[t];if(o==null)return;let l=a!=null?typeof a=="string"?Number(r.getVariable(a)??0):a:e[t],c=typeof o=="string"?Number(r.getVariable(o)??0):o;return l!==c?{update:h=>{let d=Ot.lerp(l,c,h);e[t]=s?Math.trunc(d):d},start:()=>{e[t]=l},end:()=>{e[t]=c}}:void 0}function _C(t,e,i,n,r,s){let a=i[t]?i[t]:void 0,o=n[t];if(!o)return;let l=e[t],c=[...a??l].map(d=>typeof d=="string"?Number(r.getVariable(d)??0):d),h=[...o].map(d=>typeof d=="string"?Number(r.getVariable(d)??0):d);return c.length!==h.length||Uc(c,h)?void 0:{update:d=>{c.forEach((u,p)=>{let f=Ot.lerp(u,h[p],d);e[t][p]=s?Math.trunc(f):f})},start:()=>{Object.assign(e[t],c)},end:()=>{Object.assign(e[t],h)}}}function qb(t,e,i){return e.forEach((n,r)=>{t.setComponent(r,typeof n=="string"?Number(i.getVariable(n)??0):n)}),t}function ZU(t,e,i,n,r){let s=i[t]?i[t]:void 0,a=n[t];if(!a)return;let o=e[t],l=s?qb(new T,s,r):o.clone(),c=qb(new T,a,r);return l.equals(c)?void 0:{update:h=>{o.lerpVectors(l,c,h)},start:()=>{o.copy(l)},end:()=>{o.copy(c)}}}function KU(t,e,i){return e.forEach((n,r)=>{t.setComponent(r,typeof n=="string"?Number(i.getVariable(n)??0):n)}),t}function Ky(t,e,i,n,r){let s=i[t]?i[t]:void 0,a=n[t];if(!a)return;let o=e[t],l=!(o instanceof et),c=o instanceof et?o:new et().fromArray(o),h=s?KU(new et,s,r):c.clone(),d=KU(new et,a,r);return h.equals(d)?void 0:{update:u=>{c.lerpVectors(h,d,u),l&&(e[t]=c.toArray())},start:()=>{c.copy(h),l&&(e[t]=c.toArray())},end:()=>{c.copy(d),l&&(e[t]=c.toArray())}}}function Qy(t,e,i,n,r){let s=i[t]?i[t]:void 0,a=n[t];if(!a)return;let o=e[t],l=new yn(o.r,o.g,o.b,o.a),c=s?typeof s=="string"?r.getColor(s).clone():new yn(s.r,s.g,s.b,s.a):l.clone(),h=typeof a=="string"?r.getColor(a).clone():new yn(a.r,a.g,a.b,a.a);return c.equals(h)?void 0:{update:d=>{l.lerpColors(c,h,d);let u=Ot.lerp(c.a,h.a,d);l.a=u,e[t]={r:l.r,g:l.g,b:l.b,a:l.a}},start:()=>{l.copy(c)},end:()=>{l.copy(h)}}}function Fl(t,e,i,n,r){return typeof e[t]=="number"?fr(t,e,i??{},n,r):Array.isArray(e[t])?_C(t,e,i??{},n,r):void 0}function lnt(t,e){if(t)for(let[i,n]of Object.entries(e)){let r=t[i];if(Array.isArray(r)&&Array.isArray(n)){let s=Math.min(r.length,n.length);for(let a=0;a<s;a++)r[a]=n[a]}else t[i]=n}}function Jy(t,e,i,n){let r={};if(!e||!i)return r;for(let s of t){let a=e[s],o=i[s];if(typeof a=="number"&&typeof o=="number")r[s]=Ot.lerp(a,o,n);else if(Array.isArray(a)&&Array.isArray(o)){let l=Math.min(a.length,o.length);r[s]=Array.from({length:l},(c,h)=>Ot.lerp(a[h],o[h],n))}}return r}new xi;var QU=[["radial",q_],["linear",X_],["grid",$_],["toObject",Y_],["randomnessObject",Z_]];function T9(t,e,i,n,r){let s=t.getValue(n);if(s!==void 0){if(n==="colors")return function(a,o,l,c="colors"){if(!a.hasValue(c)||!(c in l))return;let h=[],d=a.getValue(c),u=o?o[c]:d.map(f=>f.toArray()),p=l[c];for(let f=0;f<d.length;++f){let g=[...u[f]],m=[...p[f]];Gg.isEqual(g,m)||h.push({update:v=>{d[f].fromArray(Gg.lerp(g,m,v))},start:()=>{d[f].fromArray(g)},end:()=>{d[f].fromArray(m)}})}return h.length?h:void 0}(t,e,i,n);if(Array.isArray(s))return n==="steps"?function(a,o,l,c="steps"){if(!a.hasValue(c)||!(c in l))return;let h=[],d=a.getValue(c),u=o?o[c]:d,p=l[c];return Uc(u,p)||h.push({update:f=>{let g=[...d];for(let m=0;m<d.length;++m){let v=u[m],y=p[m];g[m]=Ot.lerp(v,y,f)}a.setValue(c,g)},start:()=>{a.setValue(c,u)},end:()=>{a.setValue(c,p)}}),h.length?h:void 0}(t,e,i,n):void 0;if(typeof s=="number")return function(a,o,l,c,h){if(!a.hasValue(c)||!(c in l))return;let d=o?o[c]:a.getValue(c),u=l[c],p=typeof d=="string"?Number(h.getVariable(d)??0):d,f=typeof u=="string"?Number(h.getVariable(u)??0):u;return{update:g=>{a.setValue(c,Ot.lerp(p,f,g))},start:()=>{a.setValue(c,p)},end:()=>{a.setValue(c,f)}}}(t,e,i,n,r);if(typeof s!="boolean"){if(s instanceof et)return function(a,o,l,c){if(!a.hasValue(c)||!(c in l))return;let h=a.getValue(c),d=o?new et().fromArray(o[c]):h.clone(),u=new et().fromArray(l[c]);return d.equals(u)?void 0:{update:p=>{h.lerpVectors(d,u,p)},start:()=>{h.copy(d)},end:()=>{h.copy(u)}}}(t,e,i,n);if(s instanceof T)return function(a,o,l,c,h){if(!a.hasValue(c)||!(c in l))return;let d=a.getValue(c),u=o?o[c]:void 0,p=l[c],f=u?qb(new T,u,h):d.clone(),g=qb(new T,p,h);return f.equals(g)?void 0:{update:m=>{d.lerpVectors(f,g,m)},start:()=>{d.copy(f)},end:()=>{d.copy(g)}}}(t,e,i,n,r);if(s instanceof yn)return function(a,o,l,c,h){if(!a.hasValue(c)||!(c in l))return;let d=o?o[c]:void 0,u=l[c],p=a.getValue(c),f=d?typeof d=="string"?h.color(d).clone():new Jt().setRGB(d.r,d.g,d.b):p.clone(),g=typeof u=="string"?h.color(u).clone():new yn(u.r,u.g,u.b,u.a);if(f.equals(g))return;let m=p.clone();return{update:v=>{a.getValue(c)!==m&&a.setValue(c,m),m.lerpColors(f,g,v)},start:()=>{m.copy(f)},end:()=>{m.copy(g)}}}(t,e,i,n,r);if(s instanceof Jt)return function(a,o,l,c,h){if(!a.hasValue(c)||!(c in l))return;let d=o?o[c]:void 0,u=l[c],p=a.getValue(c),f=d?typeof d=="string"?h.color(d).clone():new Jt().setRGB(d.r,d.g,d.b):p.clone(),g=typeof u=="string"?h.color(u).clone():new Jt().setRGB(u.r,u.g,u.b);if(f.equals(g))return;let m=p.clone();return{update:v=>{a.getValue(c)!==m&&a.setValue(c,m),m.lerpColors(f,g,v)},start:()=>{m.copy(f)},end:()=>{m.copy(g)}}}(t,e,i,n,r);if("isTexture"in s)return function(a,o,l,c="texture",h){if(!a.hasValue(c)||!(c in l))return;let d=E=>Number(typeof E=="string"?h?.getVariable(E)??0:E??0),u=a.getNode("rotation"),p=o?d(o[c]?.rotation):(u?.value??0)*Ot.RAD2DEG,f=d(l[c]?.rotation);if(u&&Math.abs(p-f)>1e-9)return{update:E=>{u.value=Ot.lerp(p,f,E)*Ot.DEG2RAD},start:()=>{u.value=p*Ot.DEG2RAD},end:()=>{u.value=f*Ot.DEG2RAD}};let g=function(E){let A=E.getNode("mat");if(typeof A?.updateMatrix=="function")return A;let P=E.getValue("mat");return typeof P?.updateMatrix=="function"?P:void 0}(a);if(!g)return;let m=o?o[c]:g,v=l[c],y=[...m.repeat],_=[...m.offset],b=[...v.repeat],x=[...v.offset],w=m.rotation??0,S=v.rotation??0;return to.isEqual(y,b)&&to.isEqual(_,x)&&w===S?void 0:{update:E=>{g.repeat=to.lerp(y,b,E),g.offset=to.lerp(_,x,E),g.rotation=Ot.lerp(w,S,E),g.updateMatrix()},start:()=>{g.repeat=[...y],g.offset=[..._],g.rotation=w,g.updateMatrix()},end:()=>{g.repeat=[...b],g.offset=[...x],g.rotation=S,g.updateMatrix()}}}(t,e,i,n,r)}}}function JU(t,e,i,n){let r=[],s=Oc(i,n)||!!e.layers&&Oc(e,n);r.push(function(a,o){return{update:()=>{a.setTransparent(o)}}}(t,s)),function(a,o,l){let c=a.ensureRainbowNoiseCompiled;if(typeof c=="function")for(let h of[...a.layers]){if(h.type!=="rainbow")continue;let d=o.layers?.data(h.uuid),u=l.layers.data(h.uuid);(vp(d?.noiseStrength)||vp(u?.noiseStrength))&&c.call(a,h.uuid)}}(t,e,i);for(let a of t.layers){let o=e.layers?.data(a.uuid),l=i.layers.data(a.uuid);if(!l||a.type!=="light"&&(!(a.visible??1)||!(l.visible??1)))continue;let c=Ex[a.type]??[],h=a.getNames().filter(d=>!c.includes(d)&&!hx.some(u=>d.includes(u)));for(let d of h)try{let u=T9(a,o,l,d,n);u&&(Array.isArray(u)?r.push(...u):r.push(u))}catch(u){console.error(`lerpMaterial: unexpected material layer for ${d}`,u)}}return r}function tz(t,e,i,n,r,s){let a=T9(e,i,n,t,s);!a||(Array.isArray(a)?a.forEach(o=>o.update(r)):a.update(r))}function Fo(t,e,i){!t||(t[e]={...t[e],...i})}function hnt(t,e,i,n,r,s,a){let o=()=>{a.transform=!0,a.bounds=!0,a.boolean=!0,a.render=!0};switch(t.on){case"position":case"scale":{let l=ja(t.track,i);if(!l)return;let c=Zy(l.from,l.to,l.t);return e[t.on][t.axis]=c,Fo(s,t.on,{[t.axis]:c}),void o()}case"rotation":{let l=ja(t.track,i);if(!l)return;let c=Zy(l.from,l.to,l.t);return e.rotation[t.axis]=c*Ot.DEG2RAD,Fo(s,"rotation",{[t.axis]:c}),void o()}case"shapeSize":{let l=ja(t.track,i);if(!(l&&e instanceof Ai))return;let c=Zy(l.from,l.to,l.t);return e.userData.value={...e.userData.value,[t.axis]:c},Fo(s,"shapeSize",{[t.axis]:c}),a.size=!0,a.bounds=!0,a.boolean=!0,void(a.render=!0)}case"opacity":{let l=ja(t.track,i);if(!l||!(e instanceof Yi)||Array.isArray(e.material))return;let c=e.material.getLayersOfType("light")[0];if(c===void 0)return;let h=Ot.lerp(l.from,l.to,l.t);return e.material.transparent=!0,tz("alphaOverride",c,{alphaOverride:h},{alphaOverride:h+1},0,n.shared),s&&(s.opacity=h),void(a.render=!0)}case"material":{let l=ja(t.track,i);if(!l||Object.keys(l.from).length===0||Object.keys(l.to).length===0)return;let{layer:c}=t,h={};for(let d in c.data){if(!(d in l.from)||!(d in l.to))continue;let u=bC(l.from[d],l.to[d],l.t,r);if(u===void 0)continue;h[d]=u;let p=c.getValue(d);p!==void 0&&(d==="alpha"&&typeof p=="number"&&p>0&&e instanceof Yi&&!Array.isArray(e.material)&&(e.material.transparent=!0),tz(d,c,l.from,l.to,l.t,n.shared))}return Fo(s,"material",{[c.uuid]:h}),void(a.render=!0)}case"light":{let l=ja(t.track,i);if(!l||!(e instanceof p0||e instanceof Px||e instanceof f0))return;let c=bC(l.from,l.to,l.t,r);return e[t.field]=c,Fo(s,"light",{[t.field]:c}),void(a.render=!0)}case"camera":{let l=ja(t.track,i);if(!(l&&e instanceof Zi))return;let c=Zy(l.from,l.to,l.t);return e[t.field]=c,void Fo(s,"camera",{[t.field]:c})}case"cloner":{let l=ja(t.track,i);if(!l)return;let c=e.cloner?.parameters,h=function(d,u,p,f){if(!d)return{};let g=Jy(["count"],u,p,f);g.count!==void 0&&(g.count=Math.trunc(g.count));for(let[m,v]of QU){if(!d[m])continue;let y=Jy(v,u[m],p[m],f);Object.keys(y).length&&(g[m]=y)}return g}(c,l.from,l.to,l.t);return function(d,u){if(d){u.count!==void 0&&(d.count=u.count);for(let[p]of QU){let f=u[p];f&&lnt(d[p],f)}}}(c,h),Fo(s,"cloner",h),a.cloner=!0,a.boolean=!0,void(a.render=!0)}case"pathExtrusion":{let l=ja(t.track,i);if(!l||!fx(e))return;let c=Jy(eb,l.from,l.to,l.t),h=e.geometry.userData.parameters;return h.extrusion={...h.extrusion,...c},Fo(s,"pathExtrusion",c),e.updateGeometryInteractions({extrusion:{...h.extrusion}},n.shared),a.bounds=!0,a.boolean=!0,void(a.render=!0)}case"pathSnapping":{let l=ja(t.track,i);if(!l)return;let c=e,h=Jy(MN,l.from,l.to,l.t);return c.userData.pathSnapping={...c.userData.pathSnapping,...h},Fo(s,"pathSnapping",h),c.updatePathSnapping(c.userData.pathSnapping),void(a.render=!0)}}}function bC(t,e,i,n){if(typeof t=="string"&&n&&(t=n.color(t)),typeof e=="string"&&n&&(e=n.color(e)),typeof t=="number")return Ot.lerp(t,e,i);if(Je.is(t))return Je.lerp(t,e,i);if(Tn.is(t))return Tn.lerp(t,e,i);if(Array.isArray(t))return(t.length>e.length?e:t).map((r,s)=>{if(Array.isArray(r)){let a=t[s].length>e[s].length?e[s].length:t[s].length;return(a===4?Gg:a===3?dh:to).lerp(t[s],e[s],i)}return Ot.lerp(t[s],e[s],i)});if(typeof t=="object"&&t!==null){let r={};for(let s in t){let a=bC(t[s],e[s],i,n);a!==void 0&&(r[s]=a)}return r}}$t(),tt(),_a(),R3(),hl(),ti(),ti(),Bi(),$t(),Ws(),Bi(),Kn(),Ws(),u0(),Xr(),rd(),tt(),$t(),tt(),m0(),Bi(),ti(),Bi(),tt(),Eh(),tt();var rE=new T,ez=new xi;function cnt(t,e,i,n,r){let s=[];return t.data.visible&&s.push(...function(a,o,l,c,h){let d,u,p,f,g,m,v,y,_=[];if(os(a)?(d=Ky("position",a,o,l,h),d&&_.push(d),p=fr("rotation",a,o,l,h),p&&_.push(p),f=Ky("shear",a,o,l,h),f&&_.push(f)):(y={slide:o.pathSnapping?.slide??a.updatedPathSnapping?.slide??a.dataPatched.pathSnapping?.slide??0,offset:o.pathSnapping?.offset??a.updatedPathSnapping?.offset??a.dataPatched.pathSnapping?.offset??0},m=fr("slide",y,o.pathSnapping??a.updatedPathSnapping??a.dataPatched.pathSnapping,l.pathSnapping??a.dataPatched.pathSnapping,h),m&&_.push(m),v=fr("offset",y,o.pathSnapping??a.updatedPathSnapping??a.dataPatched.pathSnapping,l.pathSnapping??a.dataPatched.pathSnapping,h),v&&_.push(v),!m&&!v&&(d=ZU("position",a,o,l,h),d&&_.push(d),u=ZU("scale",a,o,l,h),u&&_.push(u),p=function(b,x,w,S,E){let A=x?.rotation?x.rotation.map(D=>(typeof D=="string"?Number(E.getVariable(D)??0):D)*Ot.DEG2RAD):void 0,P=w.rotation?.map(D=>(typeof D=="string"?Number(E.getVariable(D)??0):D)*Ot.DEG2RAD);if(!P)return;let C=A?new T().fromArray(A):new T().setFromEuler(b.rotation),R=new T().fromArray(P);if(C.equals(R))return;let L=rE.subVectors(R,C);if(S&&L.toArray().every(D=>Math.abs(D)<2*Math.PI)){let D=new Wt().setFromEuler(ez.setFromVector3(C)),F=new Wt().setFromEuler(ez.setFromVector3(R));return{update:V=>{(function(U,j,W,it){if(it===0)return W.copy(U);if(it===1)return W.copy(j);let nt=U.w*j.w+U.x*j.x+U.y*j.y+U.z*j.z;if(nt>=1)return W.copy(U);let Y=1-nt*nt;if(Y<=Number.EPSILON){let J=1-it;return W.w=J*U.w+it*j.w,W.x=J*U.x+it*j.x,W.y=J*U.y+it*j.y,W.z=J*U.z+it*j.z,W.normalize(),W}let ot=Math.sqrt(Y),ht=Math.atan2(ot,nt),ft=Math.sin((1-it)*ht)/ot,pt=Math.sin(it*ht)/ot;W.w=U.w*ft+j.w*pt,W.x=U.x*ft+j.x*pt,W.y=U.y*ft+j.y*pt,W.z=U.z*ft+j.z*pt})(D,F,b.quaternion,V)},start:()=>{b.rotation.setFromVector3(C)},end:()=>{b.rotation.setFromVector3(R)}}}return{update:D=>{rE.lerpVectors(C,R,D),b.rotation.setFromVector3(rE)},start:()=>{b.rotation.setFromVector3(C)},end:()=>{b.rotation.setFromVector3(R)}}}(a,o,l,c,h),p&&_.push(p),g=function(b,x,w,S){let E=w[b]?w[b]:void 0,A=S[b];if(!A)return;let P=x[b],C=E?new At().fromArray(E):P.clone(),R=new T,L=new Wt,D=new T;C.decompose(R,L,D);let F=new At().fromArray(A),V=new T,U=new Wt,j=new T;return F.decompose(V,U,j),C.equals(F)?void 0:{update:W=>{YU.slerpQuaternions(L,U,W),XU.lerpVectors(R,V,W),$U.lerpVectors(D,j,W),P.compose(XU,YU,$U)},start:()=>{P.compose(R,L,D)},end:()=>{P.compose(V,U,j)}}}("hiddenMatrix",a,o,l),g&&_.push(g))),d||u||p||g||m||v){let b=os(a)?()=>{a.updateWorldMatrix(!0,!1,!0),a.resetBBoxNeedsUpdate()}:()=>{a.updateMatrix(),a.hasNonUniformScale&&(a.updateMatrixWorld(),a.updateMatrixWorldRigid()),a.parent?.matrixWorldFusedFalse&&(a.matrixWorld.multiplyMatrices(a.parent.matrixWorldFusedFalse,a.matrix),a.matrixWorldNeedsUpdate=!1),fa(a)&&eo(a.parent)&&a.invalidateDownstreamBooleanData(!0),a.updatePathSnapping(Object.assign({},o.pathSnapping,y))};_.push({update:b,start:b,end:b})}return _}(t,e,i,r,n.shared)),os(t)?s.push(...function(a,o,l,c,h){let d,u,p,f,g,m,v,y,_,b,x,w,S,E,A,P=[];if("width"in a&&(d=fr("width",a,o,l,h),d&&P.push(d)),"height"in a&&(u=fr("height",a,o,l,h),u&&P.push(u)),a instanceof Jn||a instanceof ao){let C={...o.fill},R={...l.fill};C.enabled!==void 0&&C.enabled!==R.enabled&&(P.push(function(L){return{update:()=>{L instanceof Jn&&(L.fill.enabled=!0)}}}(a)),C.enabled||Object.assign(C,{enabled:!0,color:{...C.color,a:0}}),R.enabled||Object.assign(R,{enabled:!0,color:{...R.color,a:0}})),p=Qy("color",a.fill,C,R,h),p&&P.push(p)}if(a instanceof Jn){let C={...o.stroke},R={...l.stroke};(C.enabled||R.enabled)&&(P.push(function(L){return{update:()=>{L instanceof Jn&&(L.stroke.enabled=!0)}}}(a)),C.enabled||Object.assign(C,{enabled:!0,color:{...C.color,a:0}}),R.enabled||Object.assign(R,{enabled:!0,color:{...R.color,a:0}})),f=Qy("color",a.stroke,C,R,h),f&&P.push(f),g=fr("thickness",a.stroke,C,R,h),g&&P.push(g)}if(a instanceof Jn){let C={...o.dropShadow},R={...l.dropShadow};(C.enabled||R.enabled)&&(P.push(function(L){return{update:()=>{L instanceof Jn&&(L.dropShadow.enabled=!0)}}}(a)),C.enabled||Object.assign(C,{enabled:!0,color:{...C.color,a:0}}),R.enabled||Object.assign(R,{enabled:!0,color:{...R.color,a:0}})),m=Qy("color",a.dropShadow,C,R,h),m&&P.push(m),v=fr("blurRadius",a.dropShadow,C,R,h),v&&P.push(v),_=fr("spread",a.dropShadow,C,R,h),_&&P.push(_),y=Ky("offset",a.dropShadow,C,R,h),y&&P.push(y)}if(a instanceof Jn){let C={...o.innerShadow},R={...l.innerShadow};(C.enabled||R.enabled)&&(P.push(function(L){return{update:()=>{L instanceof Jn&&(L.innerShadow.enabled=!0)}}}(a)),C.enabled||Object.assign(C,{enabled:!0,color:{...C.color,a:0}}),R.enabled||Object.assign(R,{enabled:!0,color:{...R.color,a:0}})),b=Qy("color",a.innerShadow,C,R,h),b&&P.push(b),x=fr("blurRadius",a.innerShadow,C,R,h),x&&P.push(x),S=fr("spread",a.innerShadow,C,R,h),S&&P.push(S),w=Ky("offset",a.innerShadow,C,R,h),w&&P.push(w)}if(a instanceof Jn||a instanceof ao){let C={...o.backgroundBlur},R={...l.backgroundBlur};(C.enabled||R.enabled)&&(P.push(function(L){return{update:()=>{L instanceof Jn&&(L.backgroundBlur.enabled=!0)}}}(a)),C.enabled||Object.assign(C,{enabled:!0,radius:0}),R.enabled||Object.assign(R,{enabled:!0,radius:0})),E=fr("radius",a.backgroundBlur,C,R,h),E&&P.push(E)}if(a instanceof Jn){let C={...o.layerBlur},R={...l.layerBlur};(C.enabled||R.enabled)&&(P.push(function(L){return{update:()=>{L instanceof Jn&&(L.layerBlur.enabled=!0)}}}(a)),C.enabled||Object.assign(C,{enabled:!0,radius:0}),R.enabled||Object.assign(R,{enabled:!0,radius:0})),A=fr("radius",a.layerBlur,C,R,h),A&&P.push(A)}if(a instanceof ao||a instanceof y0){let C=_C("cornerRadius",a,o,l,h);C&&P.push(C)}return P}(t,e,i,0,n.shared)):(t.data.visible&&s.push(...function(a,o,l,c){let h=[];if(!("cloner"in l)||!a.cloner)return h;let d=a.cloner,u="cloner"in o?o.cloner:{},p=l.cloner;SA.forEach(_=>{let b;b=_==="count"?fr("count",d.parameters,u,p,c.shared,!0):Fl(_,d.parameters,u??{},p,c.shared),b&&h.push(b)});let f=function(_,b,x,w){if(_.parameters.type!=="radial")return;let S=b.radial,E=x.radial;if(!E)return;let A=_.parameters.radial,P=[];return q_.forEach(C=>{let R=Fl(C,A,S??{},E,w);R&&P.push(R)}),P}(d,u,p,c.shared);f?.length&&h.push(...f);let g=function(_,b,x,w){if(_.parameters.type!=="linear")return;let S=b.linear,E=x.linear;if(!E)return;let A=[],P=_.parameters.linear;return X_.forEach(C=>{let R=Fl(C,P,S??{},E,w);R&&A.push(R)}),A}(d,u,p,c.shared);g?.length&&h.push(...g);let m=function(_,b,x,w){if(_.parameters.type!=="grid")return;let S=b.grid,E=x.grid;if(!E)return;let A=[],P=_.parameters.grid;return $_.forEach(C=>{let R;R=C==="count"?_C(C,P,S??{},E,w,!0):Fl(C,P,S??{},E,w),R&&A.push(R)}),A}(d,u,p,c.shared);m?.length&&h.push(...m);let v=function(_,b,x,w){if(_.parameters.type!=="toObject")return;let S=b.toObject,E=x.toObject;if(!E)return;let A=[],P=_.parameters.toObject;return Y_.forEach(C=>{let R;R=C==="count"?fr(C,P,S??{},E,w,!0):Fl(C,P,S??{},E,w),R&&A.push(R)}),A}(d,u,p,c.shared);v?.length&&h.push(...v);let y=function(_,b,x,w){if(!_.parameters.randomness)return;let S=b.randomnessObject,E=x.randomnessObject;if(!E)return;let A=[],P=_.parameters.randomnessObject;return Z_.forEach(C=>{let R=Fl(C,P,S??{},E,w);R&&A.push(R)}),A}(d,u,p,c.shared);return y?.length&&h.push(...y),h.length&&h.push({update:()=>{d.update(c)}}),h}(t,e,i,n)),t instanceof Yi?(t instanceof Ai&&t.data.visible&&s.push(...function(a,o,l,c){let h=[];if(!("geometry"in l)||ll(a))return h;let d=a.geometry.userData.parameters,u="geometry"in o?o.geometry:{},p=l.geometry;if(a instanceof yp){let f=function(g,m,v,y){if(v.scaleBaked===void 0)return;let _=(m.scaleBaked??g.appliedGeometrySize??g.data.geometry.scaleBaked).map(w=>typeof w=="string"?Number(y.shared.getVariable(w)??0):w),b=v.scaleBaked.map(w=>typeof w=="string"?Number(y.shared.getVariable(w)??0):w);if(dh.isEqual(_,b))return;let x=[];return x.push({update:w=>{g.updateGeometryInteractions({scaleBaked:[Ot.lerp(_[0],b[0],w),Ot.lerp(_[1],b[1],w),Ot.lerp(_[2],b[2],w)]},y.shared),g.invalidateDownstreamBooleanData(),g.refreshAttachedClonersInteractions(y)},start:()=>{g.updateGeometryInteractions({scaleBaked:_},y.shared),g.invalidateDownstreamBooleanData(),g.refreshAttachedClonersInteractions(y)},end:()=>{g.updateGeometryInteractions({scaleBaked:b},y.shared),g.invalidateDownstreamBooleanData(),g.refreshAttachedClonersInteractions(y)}}),x}(a,u,p,c);f&&h.push(...f)}else{let f={},g=a.appliedGeometrySize;if(Object.assign(f,tA(d,T1),g?{width:g[0],height:g[1],depth:g[2]}:{},tA(u,T1)),T1.forEach(m=>{let v=Fl(m,f,u,p,c.shared);v&&h.push(v)}),fx(a)){Object.assign(f,{extrusion:{...d.extrusion}});let m=function(v,y,_,b){if(!_.extrusion)return;let x=v.extrusion,w=y.extrusion??{},S=_.extrusion,E=[];return eb.forEach(A=>{let P=Fl(A,x,w,S,b);P&&E.push(P)}),E}(f,u,p,c.shared);m&&h.push(...m)}h.length&&h.push({update:m=>{a.updateGeometryInteractions(f,c.shared),a.updateGeometryGroupsIfNeeded(),a.refreshAttachedClonersInteractions(c)},start:m=>{a.updateGeometryInteractions(f,c.shared),a.updateGeometryGroupsIfNeeded(),a.refreshAttachedClonersInteractions(c)},end:m=>{a.updateGeometryInteractions(f,c.shared),a.updateGeometryGroupsIfNeeded(),a.refreshAttachedClonersInteractions(c)}})}return h}(t,e,i,n)),t.data.visible&&!(t instanceof Wr&&t.materialOverride)&&s.push(...function(a,o,l,c){let h=[];if(Array.isArray(a.material)){if(!("materials"in l)||!l.materials)return h;let d="materials"in o&&o.materials?o.materials:[],u=l.materials;a.material.forEach((p,f)=>{if(!u[f])return;let g=d[f]??{},m=u[f];typeof g=="string"||typeof m=="string"||h.push(...JU(p,g,m,c))})}else{if(!("material"in l)||!l.material)return h;let d="material"in o&&o.material?o.material:{},u=l.material;if(typeof d=="string"||typeof u=="string")return h;h.push(...JU(a.material,d,u,c))}return h}(t,e,i,n.shared))):Eb.is(t)?t.data.visible&&s.push(...function(a,o,l,c){let h=[];if(l.intensity!==void 0){let d=fr("intensity",a,o,l,c);d&&h.push(d)}if(l.color!==void 0){let d=function(u,p,f,g,m){let v=f[u]?f[u]:void 0,y=g[u];if(!y)return;let _=p[u],b=v?typeof v=="string"?m.getColor(v).clone():new Jt().setRGB(v.r,v.g,v.b):_.clone(),x=typeof y=="string"?m.getColor(y).clone():new Jt().setRGB(y.r,y.g,y.b);if(b.equals(x))return;let w=_.clone();return{update:S=>{w.lerpColors(b,x,S),p[u]?.copy?.(w)},start:()=>{w.copy(b)},end:()=>{w.copy(x)}}}("color",a,o,l,c);d&&h.push(d)}return h}(t,e,i,n.shared)):t instanceof Zi&&s.push(...function(a,o,l,c){let h=[],d=a.cameraType==="OrthographicCamera"?o.orthographic?.zoom:o.perspective?.zoom,u=a.cameraType==="OrthographicCamera"?l.orthographic?.zoom:l.perspective?.zoom;if(u!==void 0){let p=d??a.zoom,f=u;p!==f&&h.push({update:g=>{a.zoom=Ot.lerp(p,f,g),a.updateProjectionMatrix()},start:()=>{a.zoom=p,a.updateProjectionMatrix()},end:()=>{a.zoom=f,a.updateProjectionMatrix()}})}if(l.targetOffset!==void 0){let p=fr("targetOffset",a,o,l,c);p&&h.push(p)}return h}(t,e,i,n.shared))),s.length?{update:a=>{s.forEach(o=>o.update(a))},start:a=>{s.forEach(o=>o.start?.(a))},end:a=>{s.forEach(o=>o.end?.(a))}}:void 0}var C9={type:"beginState"};function P9(t){if(t.easing===5){let{control1:e,control2:i}=t;return{easing:5,control1:e??mp.defaultData.control1,control2:i??mp.defaultData.control2}}if(t.easing===6){let{mass:e,stiffness:i,damping:n,velocity:r}=t;return{easing:6,mass:e??th.defaultData.mass,stiffness:i??th.defaultData.stiffness,damping:n??th.defaultData.damping,velocity:r??th.defaultData.velocity}}return{easing:t.easing}}function D9(t){return{delay:t.delay,delayDirection:t.delayDirection??"start-end",direction:t.direction??"normal",repeat:t.repeat}}var R9={type:"completeState",isfromEntity:!1};function Cg(t,e){let i,n;if(typeof e=="string"?(i=e,n=t.states?.[i]):e===null&&(i=null,n=t.data),i!==void 0&&n!==void 0)return{id:i,data:n}}var dnt=["position","rotation","scale","shear","hiddenMatrix"],xC=new Set,wC=class{constructor(t,e,i,n,r,s,a,o={},l=()=>xC){this.object=t,this.fromRef=e,this.toRef=i,this.data=n,this.sharedAssets=r,this.allowSlerp=s,this.page=a,this.hooks=o,this.inert=l,this.builtReversed=!1,this.startStateId=null,this.buildCallback=()=>{this.builtReversed=this.runner.isReversed,this.startStateId=os(this.object)?null:this.object.transitionState.state,this.callback=cnt(this.object,{},function(c,h){if(h.size===0)return c;let d={...c};for(let u of h)delete d[u];return d}(this.end.data,this.inert()),{scene:this.page.scene,shared:this.sharedAssets},this.allowSlerp)},this.onChange=c=>{this.builtReversed!==this.runner.isReversed&&this.buildCallback(),this.callback&&(this.callback.update(c),this.object.requestRender()),this.writeState(c)},this.runner=new b9(function(c){return{duration:c.duration,ease:P9(c),...D9(c)}}(n),this.onChange,this.buildCallback),this.rebind()}rebind(){let{fromRef:t,toRef:e}=this;if(t===void 0){let n=Cg(this.object,this.object.currentState===e?this.object.prevState:this.object.currentState);if(!n)throw new Error("Missing property");this.from=n}else{let n=Cg(this.object,t);if(!n)throw new Error("Missing property");this.from=n}if(e===void 0)throw new Error("Missing property");let i=Cg(this.object,e);if(!i)throw new Error("Missing property");this.to=i,this.buildCallback()}refresh(){this.buildCallback()}get endpointData(){return[this.from.data,this.to.data]}get targetStateId(){return this.builtReversed?this.from.id:this.to.id}get start(){return this.builtReversed?this.to:this.from}get end(){return this.builtReversed?this.from:this.to}writeState(t){if(t===0||os(this.object))return;let e=t===1,i=t>.5?this.targetStateId:this.startStateId,n=this.object.transitionState;n.settled===e&&n.state===i||(this.object.transitionState={settled:e,state:i},this.object.reversibleToState=this.end.id,this.object.prevState!==this.object.currentState&&(this.object.prevState=this.object.currentState),this.object.currentState=i,this.object.dispatchEvent({type:"transitionState",settled:e,state:i}),this.object.dispatchEvent({type:e?"completeState":"beginState",state:i}),this.object.traverseEntity(r=>{r!==this.object&&r instanceof Zi&&r.dispatchEvent(e?R9:C9)}),e?this.hooks.onComplete?.(i):this.hooks.onBegin?.(i))}};Ws();var SC=new Map,Pg=new Map,ra=class extends Vn{constructor(t,e,i,n,r,s,a){super(),this.id=t,this.data=e,this.scene=i,this.sharedAssets=n,this.object=r,this.eventType=s,this.actionCondition=a,this.evaluators=[],this.elapsed=0,this.lastTime=null,this.direction=1,this._playing=!1,this._finished=!1,this.hasPlayedOnce=!1,this.pauseOnNextCycleEnd=!1,this.lastCycleIndex=0;try{let o=$c.findTimeline(this.scene.data.objects,this.data.timeline),l=o.duration;this.animatedObjectIds=Object.keys(o.objectTimelines),this.animatedObjectIds.forEach(c=>{let h=this.scene.find(c);if(!h)return;let d=o.objectTimelines[c];!d||this.evaluators.push(function(u,p,f,g,m){let v=function(y,_){let b=[];return Nc.groupKeyframes(_.keyframes).forEach(x=>{let w=x.path?.[0],S=x.path[1],E=()=>gu(x.keyframes,A=>A.value);switch(w){case"position":case"rotation":case"scale":return void(S&&Wg.includes(S)&&b.push({on:w,axis:S,track:E()}));case"shape size":return void(S&&Wg.includes(S)&&"geometry"in y&&b.push({on:"shapeSize",axis:S,track:E()}));case"path extrusion":return void(fx(y)&&b.push({on:"pathExtrusion",track:gu(x.keyframes,A=>A.value)}));case"path snapping":return void(y.data.pathSnapping&&b.push({on:"pathSnapping",track:gu(x.keyframes,A=>A.value)}));case"material":return void(y.type==="Mesh"&&"material"in y&&function(A,P){let C=R6(A.material)?A.material:void 0,R=P.layerId;if(!C||!R)return[];let L=P.keyframes.some(W=>vp(W.data.value?.noiseStrength)),D=C.ensureRainbowNoiseCompiled,F=W=>{L&&typeof D=="function"&&D.call(C,W)},V=W=>"data"in W?[{on:"material",layer:W,track:gu(P.keyframes,it=>it.value)}]:[];F(R);let U=C.getLayerByUuid(R);if(U)return V(U);let j=P.path[1];for(let W of C.getLayersOfType(j))F(W.uuid);return(C.getLayersOfType(j)??[]).flatMap(V)}(y,x).forEach(A=>b.push(A)));case"opacity":return void(y.type==="Mesh"&&"material"in y&&b.push({on:"opacity",track:E()}));case"cloner":return void b.push({on:"cloner",track:gu(x.keyframes,A=>A.value)});case"camera":return void(y instanceof Zi&&b.push({on:"camera",field:"zoom",track:E()}));case"light":return void((y instanceof p0||y instanceof Px||y instanceof f0)&&b.push({on:"light",field:x.path[1],track:gu(x.keyframes,A=>A.value)}))}}),b}(u,p);return{duration:f,evaluate(y,_){u.resetBBoxNeedsUpdate();let b={transform:!1,size:!1,cloner:!1,bounds:!1,boolean:!1,render:!1};for(let x of v)hnt(x,u,y,g,m,_,b);(function(x,w,S){if(w.size&&x instanceof Ai){let{x:E,y:A,z:P}=x.userData.value;x.updateGeometryInteractions({width:E,height:A,depth:P},S.shared)}w.cloner&&x.cloner?.update(S),w.transform&&x.updateMatrix(),w.bounds&&x.resetBBoxNeedsUpdate(),w.boolean&&x instanceof Ai&&x.invalidateDownstreamBooleanData(),w.render&&x.dispatchEvent({type:"requestRender"})})(u,b,g)},invalidate(){for(let y of v)ont(y.track)}}}(h,{...d},l,{scene:i,shared:n},this.sharedAssets))}),this.schedule=new qet(function(c,h){return{duration:h,delay:pr(c.delay/1e3),delayDirection:c.delayDirection??"start-end",direction:c.direction??"normal",repeat:c.repeat}}(this.data,l))}catch{throw new Error("Missing property")}r&&(Pg.has(r.uuid)?Pg.get(r.uuid).push(this):Pg.set(r.uuid,[this])),SC.set(t,this)}get playing(){return this._playing}get finished(){return this._finished}get paused(){return!this._playing}update(t){this.lastTime!==null&&(this.elapsed=Math.max(0,this.elapsed+(t-this.lastTime)*this.direction)),this.lastTime=t,this.applyAtElapsed()}applyAtElapsed(){if(this.direction===-1&&this.elapsed===0)return void this.pause();let t=this.schedule.resolve(this.elapsed);if(t){if(t.cycleIndex!==this.lastCycleIndex&&(this.lastCycleIndex=t.cycleIndex,this.pauseOnNextCycleEnd))return this.pauseOnNextCycleEnd=!1,void this.pause();for(let e of this.evaluators)e.evaluate(t.localTime)}else this.direction===1&&this.schedule.isFinished(this.elapsed)&&this.finish()}finish(){this.pause(),this._finished=!0,this.animatedObjectIds.forEach(t=>{let e=this.scene.find(t);e instanceof Zi&&e.dispatchEvent(R9)})}startTicking(){this._playing=!0,this.lastTime=null;for(let t of this.evaluators)t.invalidate();nn.add(this)}play(){let t=this.eventType!==void 0&&fA(this.eventType)&&this.data.runMode==="Once"&&this.hasPlayedOnce&&this.paused&&this.elapsed>0&&!this._finished;if(this.eventType!==void 0&&fA(this.eventType)&&this.data.runMode==="Once"&&this.hasPlayedOnce&&!t||this.eventType===void 0&&this._finished)return!1;this.hasPlayedOnce=!0,this.animatedObjectIds.forEach(e=>{let i=this.scene.find(e);i instanceof Zi&&i.dispatchEvent(C9)}),!t&&(this.elapsed===0||this._finished)&&(this.elapsed=0,this.lastCycleIndex=0,this._finished=!1),this.direction=1,this.startTicking()}pause(){this._playing=!1,this.lastTime=null,nn.remove(this)}stop(){this.pause(),this.elapsed=0,this.lastCycleIndex=0,this.applyAtElapsed(),this._finished=!1}seek(t){let e=this.schedule.totalDuration;this.elapsed=t*(Number.isFinite(e)?e:this.schedule.effectiveCycleDuration);for(let i of this.evaluators)i.invalidate();this.applyAtElapsed()}toggle(t){let e=t??this.direction===-1;this._playing&&this.direction===(e?1:-1)?e&&(this.pauseOnNextCycleEnd=!1):(e?(this._finished&&(this.elapsed=0,this.lastCycleIndex=0,this._finished=!1),this.direction=1,this.pauseOnNextCycleEnd=!1):(this.direction=this.schedule.resolve(this.elapsed)?.isReverse?1:-1,this.pauseOnNextCycleEnd=!0),this.startTicking())}playFromCurrent(){this.toggle(!0)}reverseFromCurrent(){this.toggle(!1)}dispose(){this.pause()}},unt=class{constructor(t){this.data=t}dispatch(){this.data.playTimeline?this.pauseTimeline(this.data.playTimeline):this.data.object?this.pauseAllTimelinesFromObject(this.data.object):this.pauseAllTimelines()}pauseTimeline(t){let e=this.getTimelineActions(t);!e.length||(this.data.delay>0?(this.disposeDelay(),this.timeoutId=window.setTimeout(()=>{e.forEach(i=>{i[this.data.interaction]()}),this.disposeDelay()},this.data.delay)):e.forEach(i=>{i[this.data.interaction]()}))}getTimelineActions(t){let e=SC.get(t);return e?[e]:[...SC.values()].filter(i=>i.data.timeline===t)}pauseAllTimelinesFromObject(t){let e=Pg.get(t);!e?.length||(this.data.delay>0?(this.disposeDelay(),this.timeoutId=window.setTimeout(()=>{e.forEach(i=>i[this.data.interaction]()),this.disposeDelay()},this.data.delay)):e.forEach(i=>i[this.data.interaction]()))}pauseAllTimelines(){let t=[...Pg.values()];!t.length||(this.data.delay>0?(this.disposeDelay(),this.timeoutId=window.setTimeout(()=>{t.forEach(e=>{e.forEach(i=>{i[this.data.interaction]()})}),this.disposeDelay()},this.data.delay)):t.forEach(e=>{e.forEach(i=>{i[this.data.interaction]()})}))}disposeDelay(){clearTimeout(this.timeoutId),delete this.timeoutId}dispose(){clearTimeout(this.timeoutId),delete this.timeoutId}},pnt=class{constructor(t,e,i,n,r,s,a){this.data=e;let o="interaction"in e?e.interaction:"play";if(o==="play"||o===void 0)this.interaction=new ra(t,e,i,n,r,s,a);else{if(o!=="pause"&&o!=="stop")throw new Error("Missing property");this.interaction=new unt(e)}}get playing(){return this.interaction instanceof ra&&this.interaction.playing}get finished(){return!(this.interaction instanceof ra)||this.interaction.finished}get paused(){return!(this.interaction instanceof ra)||this.interaction.paused}play(){if(this.interaction instanceof ra)return this.interaction.play();this.interaction.dispatch()}stop(){this.interaction instanceof ra&&this.interaction.stop()}seek(t){this.interaction instanceof ra&&this.interaction.seek(t)}toggle(t){this.interaction instanceof ra?this.interaction.toggle(t):this.interaction.dispatch()}playFromCurrent(){this.interaction instanceof ra?this.interaction.playFromCurrent():this.interaction.dispatch()}dispatchConditional(){this.interaction instanceof ra?wi(this.interaction.sharedAssets,this.interaction.actionCondition)&&this.interaction.playFromCurrent():this.interaction.dispatch()}reverseFromCurrent(){this.interaction instanceof ra&&this.interaction.reverseFromCurrent()}dispose(){this.interaction.dispose()}};function iz(t){let e=t.tweens[0]?.data;return{delay:e?.delay??t.delay,delayDirection:e?.delayDirection??"start-once",direction:e?.direction??t.direction,repeat:e?.repeat??t.repeat}}ke(),Dr("TimelineAnimation",({id:t,data:e,page:i,shared:n,object:r,eventType:s,actionCondition:a})=>new pnt(t,e,i.scene,n,r,s,a)),Si("timeline"),Bi(),$t(),tt(),Ws();var fnt={state:null,duration:0,delay:0,delayDirection:"start-once",direction:"normal",repeat:0,easing:0},mnt=class extends Vn{constructor(t,e,i,n,r,s){if(super(),this.eventType=t,this.data=e,this.page=i,this.shared=n,this.condition=r,this.runModeOverride=s,this.tweens=[],this.hasPlayedOnce=!1,this.inert=xC,!e.object)throw new Error("Missing property");let a=this.page.scene.find(e.object)??this.page.uiCanvas?.find(e.object)??this.page.scene.find2DInUIObjects(e.object);if(!a)throw new Error("Missing property");if(!a.states)throw new Error("Missing property");if(this.object=a,e.tweens.length<2)throw new Error("Missing property");this.init()}get playing(){return this.runner?.isPlaying===!0}get animating(){return this.runner?.isAnimating===!0}get claimTime(){return this.runner?.claimTime}get contested(){let t=this.object.previousAction;return t!==null&&t!==this&&t.animating}init(){this.initialCurrentState=Cg(this.object,this.object.currentState).id,this.build()}shouldReinit(){return!!wi(this.shared,this.condition)||!(this.animating&&!this.loopsForever)}get loopsForever(){return iz(this.data).repeat===-1||this.data.tweens.some((t,e)=>e>0&&t.data.repeat===-1)}get runMode(){return this.runModeOverride!==void 0?this.runModeOverride:fA(this.eventType)?this.data.runMode:"Repeat"}get currentState(){return this.runMode==="Toggle"?this.initialCurrentState:this.object.currentState}get opensOnCurrent(){return this.data.tweens[0].data.state===void 0&&this.runMode!=="Toggle"}build(){let t=this.data.tweens,e=[];try{let i=t[0].data.state;i!==void 0&&e.push(new wC(this.object,i,i,fnt,this.shared,this.data.allowSlerp??!1,this.page,{},()=>this.inert));for(let n=1;n<t.length;n++){let r=t[n-1],s=t[n];e.push(new wC(this.object,r.data.state===void 0?this.currentState:r.data.state,s.data.state===void 0?this.currentState:s.data.state,s.data,this.shared,this.data.allowSlerp??!1,this.page,{},()=>this.inert))}}catch(i){return void(i instanceof Error&&console.error(i.message))}this.tweens=e,this.syncInert(),this.runner=new _9({...D9(iz(this.data)),runMode:this.runMode},e.map(i=>i.runner),{claim:i=>this.claimObject(i),assignCurrentState:()=>this.rebindTweens(),isOwner:()=>this.object.previousAction===this})}claimObject(t){if(this.object.previousAction===this)return!1;let e=this.object.previousAction;if(e?.animating===!0){if(t!==void 0&&e.claimTime!==void 0&&e.claimTime>t)return!1;e.pause()}return this.object.previousAction=this,!0}rebindTweens(){for(let t of this.tweens)try{t.rebind()}catch(e){e instanceof Error&&console.error(e.message)}this.syncInert(),this.object instanceof Zi&&this.object.wasMovedByUser&&(this.object.wasMovedByUser=!1)}syncInert(){let t=this.tweens.flatMap(e=>e.endpointData);if(this.opensOnCurrent&&t.length>0){let e=Cg(this.object,this.object.currentState);e&&(t[0]=e.data)}this.inert=function(e){if(e.length<2)return xC;let i=new Set,[n,...r]=e;for(let s of dnt){let a=n[s];a!==void 0&&r.every(o=>Uc(o[s],a))&&i.add(s)}return i}(t);for(let e of this.tweens)e.refresh()}update(t){this.runner?.update(t),this.runner?.isPlaying!==!0&&nn.remove(this)}play(){if(wi(this.shared,this.condition)===!1||this.runMode==="Once"&&this.hasPlayedOnce)return!1;this.hasPlayedOnce=!0,this.start()}start(){!this.runner||(this.runner.play(nn.time),this.runner.isPlaying&&nn.add(this))}pause(){this.runner?.stop(),nn.remove(this)}stop(){this.pause();let t=this.data.tweens[0].data.state===void 0?this.initialCurrentState:this.data.tweens[0].data.state;os(this.object)?this.object.changeSelectedState(t,{shared:this.shared}):this.object.changeSelectedState(t,{scene:this.page.scene,shared:this.shared}),this.object.currentState=t}seek(t){if(wi(this.shared,this.condition)===!1)return!1;this.runner?.seek(t)}playDirected(t){if(wi(this.shared,this.condition)===!1)return!1;!this.runner||(this.runner.playDirected(nn.time,t),this.runner.isPlaying&&nn.add(this))}playFromCurrent(){this.playDirected(!0)}reverseFromCurrent(){this.playDirected(!1)}dispose(){this.pause()}};function I9(t){let e=t?.tracks.filter(i=>i.ValueTypeName==="vector"||i.ValueTypeName==="quaternion").map(i=>i.times.length);if(e?.length){let i=function(n){if(!n||n.length===0)return;let r;for(let s of n)s==s&&(r===void 0||s>r)&&(r=s);return r}(e);return i&&i>2?i:2}return 2}$t(),tt(),ti();var ju=new Map,Dg=new WeakSet;function O9(t,e){if(e===void 0)return;let i=t.scene.find(e);return i&&Array.isArray(i.identity)?i.identity[0]:e}var No=class extends Vn{constructor(t,e,i,n,r){super(),this.page=e,this.animationControls=i,this.shared=n,this.condition=r,this.startOnceDelay=0,this.toggleIsForward=!1;let s=O9(e,t.object)??t.object;this.data={...t,object:s};let a=this.animationControls.clipIdToAction[t.clipId+"/"+s];if(this.duration=a?.getClip()?.duration??1,this.data.crop2){let l=I9(a?.getClip());this.leftFrameTime=this.data.crop2[0]/(l-1)*this.duration,this.rightFrameTime=this.data.crop2[1]/(l-1)*this.duration}else{let l=a?.getClip()?.tracks[0]?.times.length;l&&l>1?(this.leftFrameTime=this.data.crop[0]/l*this.duration,this.rightFrameTime=this.data.crop[1]/l*this.duration):(this.leftFrameTime=0,this.rightFrameTime=this.duration)}this.startOnceDelay=t.delay;let o=ju.get(s);o||(o=new Set,ju.set(s,o)),o.add(this)}get playing(){return this.threeAnimAction?.isRunning()??!1}cancelPending(){window.clearTimeout(this.timeoutId),delete this.timeoutId}resume(){let t=this.animationControls.clipIdToAction[this.data.clipId+"/"+this.data.object];return!(!t||!Dg.has(t)||(Dg.delete(t),this.threeAnimAction=t,t.paused=!1,t.play(),this.animationControls.requestRender(),0))}play(t=!1){if(wi(this.shared,this.condition)===!1)return!1;window.clearTimeout(this.timeoutId),this.timeoutId=window.setTimeout(()=>{if(this.resume()||(this.threeAnimAction=this.animationControls.play(this.data),!this.threeAnimAction))return;Dg.delete(this.threeAnimAction),this.threeAnimAction.reset(),this.threeAnimAction.time=this.leftFrameTime,this.threeAnimAction._clip.start=this.leftFrameTime,this.threeAnimAction._clip.duration=this.rightFrameTime;let e=this.data.object;Object.entries(this.animationControls.clipIdToAction).forEach(([i,n])=>{let r=i.split("/")[1];this.threeAnimAction!==n&&r===e&&(t?n.fadeOut(.2):n.stop())}),t&&this.threeAnimAction?.fadeIn(.2)},this.startOnceDelay)}pause(){this.threeAnimAction&&(this.threeAnimAction.paused=!0),this.cancelPending()}stop(){this.threeAnimAction?.fadeOut(.2)}seek(t){this.threeAnimAction=this.animationControls.play(this.data),this.threeAnimAction&&(this.threeAnimAction.paused=!0,this.threeAnimAction.time=Ot.clamp(this.threeAnimAction.time+1/60*t,this.leftFrameTime,this.rightFrameTime-16e-5),this.animationControls.needsUpdate=!0,this.animationControls.requestRender())}toggle(t,e=!1){if(wi(this.shared,this.condition)===!1)return!1;this.toggleIsForward=t??!this.toggleIsForward,this.threeAnimAction&&(this.threeAnimAction._loopCount=0),this.playing||this.resume()?this.threeAnimAction&&(this.threeAnimAction.timeScale=this.toggleIsForward?1:-1,this.toggleIsForward?(this.threeAnimAction._clip.start=this.leftFrameTime,this.threeAnimAction._clip.duration=this.rightFrameTime):(this.threeAnimAction._clip.start=this.rightFrameTime,this.threeAnimAction._clip.duration=this.leftFrameTime)):this.timeoutId=window.setTimeout(()=>{if(this.threeAnimAction=this.animationControls.play(this.data),this.threeAnimAction){this.toggleIsForward?(this.threeAnimAction.time=this.leftFrameTime,this.threeAnimAction._clip.start=this.leftFrameTime,this.threeAnimAction._clip.duration=this.rightFrameTime):(this.threeAnimAction.time=this.rightFrameTime,this.threeAnimAction._clip.start=this.rightFrameTime,this.threeAnimAction._clip.duration=this.leftFrameTime),this.threeAnimAction.paused=!1,this.threeAnimAction.timeScale=this.toggleIsForward?1:-1;let i=this.data.clipId.split("/")[1];Object.entries(this.animationControls.clipIdToAction).forEach(([n,r])=>{let s=n.split("/")[1];this.threeAnimAction!==r&&s===i&&r.isRunning()&&(e?r.fadeOut(.2):r.stop())}),e&&this.threeAnimAction?.fadeIn(.2)}},this.startOnceDelay)}playFromCurrent(){this.toggle(!0)}reverseFromCurrent(){this.toggle(!1)}dispose(){let t=this.animationControls.clipIdToAction[this.data.clipId+"/"+this.data.object]?.getClip();t&&(t.duration=this.duration),this.pause();let e=ju.get(this.data.object);e&&(e.delete(this),e.size===0&&ju.delete(this.data.object))}},gnt=class{constructor(t,e,i){this.data=t,this.page=e,this.animationControls=i,this.objectId=O9(e,t.object)}dispatch(){this.data.delay>0?(this.disposeDelay(),this.timeoutId=window.setTimeout(()=>{this.apply(),this.disposeDelay()},this.data.delay)):this.apply()}targetsClip(t,e){return!(this.objectId!==void 0&&e!==this.objectId||this.data.clipId&&t!==this.data.clipId)}apply(){(this.objectId!==void 0?[ju.get(this.objectId)]:[...ju.values()]).forEach(e=>{e?.forEach(i=>{this.targetsClip(i.data.clipId,i.data.object)&&i.cancelPending()})});let t=!1;Object.entries(this.animationControls.clipIdToAction).forEach(([e,i])=>{let[n,r]=e.split("/");if(this.targetsClip(n,r))if(this.data.interaction==="pause"){if(!i.isRunning())return;i.paused=!0,Dg.add(i)}else{if(!i.enabled||!i.isRunning()&&!i.paused)return;i.paused=!0,Dg.delete(i),i.time=i._clip.start??0,i._loopCount=-1,t=!0}}),t&&(this.animationControls.needsUpdate=!0,this.animationControls.requestRender())}disposeDelay(){clearTimeout(this.timeoutId),delete this.timeoutId}dispose(){this.disposeDelay()}},vnt=class{constructor(t,e,i,n,r){xA.isPause(t)?this.interaction=new gnt(t,e,i):this.interaction=new No(t,e,i,n,r)}get data(){return this.interaction.data}get playing(){return this.interaction instanceof No&&this.interaction.playing}play(t=!1){if(this.interaction instanceof No)return this.interaction.play(t);this.interaction.dispatch()}pause(){this.interaction instanceof No&&this.interaction.pause()}stop(){this.interaction instanceof No&&this.interaction.stop()}seek(t){this.interaction instanceof No&&this.interaction.seek(t)}toggle(t,e=!1){if(this.interaction instanceof No)return this.interaction.toggle(t,e);this.interaction.dispatch()}playFromCurrent(){this.interaction instanceof No?this.interaction.playFromCurrent():this.interaction.dispatch()}reverseFromCurrent(){this.interaction instanceof No&&this.interaction.reverseFromCurrent()}dispose(){this.interaction.dispose()}},L9=null;ke(),L9=wC,Dr("Transition",({eventType:t,data:e,page:i,shared:n,actionCondition:r,runModeOverride:s})=>new mnt(t,e,i,n,r,s)),Dr("Animation",({data:t,page:e,eventManager:i,shared:n,actionCondition:r})=>new vnt(t,e,i.animationControls,n,r)),Si("transitions"),ti();var nz=(t,e)=>e.some(i=>i instanceof RegExp?i.test(t):i===t),ynt=class{constructor({url:t,context:e},i,n,r){if(this.controlsManager=i,this.shared=n,this.condition=r,!t)throw new Error("Missing property");this.url=t.startsWith("mailto:")?t:function(s,a){if(a={defaultProtocol:"http:",normalizeProtocol:!0,forceHttp:!1,forceHttps:!1,stripAuthentication:!0,stripHash:!1,stripTextFragment:!0,stripWWW:!0,removeQueryParameters:[/^utm_\w+/i],removeTrailingSlash:!0,removeSingleSlash:!0,removeDirectoryIndex:!1,sortQueryParameters:!0,...a},s=s.trim(),/^data:/i.test(s))return((h,{stripHash:d})=>{let u=/^data:(?<type>[^,]*?),(?<data>[^#]*?)(?:#(?<hash>.*))?$/.exec(h);if(!u)throw new Error(`Invalid URL: ${h}`);let{type:p,data:f,hash:g}=u.groups,m=p.split(";");g=d?"":g;let v=!1;m[m.length-1]==="base64"&&(m.pop(),v=!0);let y=(m.shift()||"").toLowerCase(),_=[...m.map(b=>{let[x,w=""]=b.split("=").map(S=>S.trim());return x==="charset"&&(w=w.toLowerCase(),w==="us-ascii")?"":`${x}${w?`=${w}`:""}`}).filter(Boolean)];return v&&_.push("base64"),(_.length>0||y&&y!=="text/plain")&&_.unshift(y),`data:${_.join(";")},${v?f.trim():f}${g?`#${g}`:""}`})(s,a);if(/^view-source:/i.test(s))throw new Error("`view-source:` is not supported as it is a non-standard protocol");let o=s.startsWith("//");!o&&/^\.*\//.test(s)||(s=s.replace(/^(?!(?:\w+:)?\/\/)|^\/\//,a.defaultProtocol));let l=new URL(s);if(a.forceHttp&&a.forceHttps)throw new Error("The `forceHttp` and `forceHttps` options cannot be used together");if(a.forceHttp&&l.protocol==="https:"&&(l.protocol="http:"),a.forceHttps&&l.protocol==="http:"&&(l.protocol="https:"),a.stripAuthentication&&(l.username="",l.password=""),a.stripHash?l.hash="":a.stripTextFragment&&(l.hash=l.hash.replace(/#?:~:text.*?$/i,"")),l.pathname){let h=/\b[a-z][a-z\d+\-.]{1,50}:\/\//g,d=0,u="";for(;;){let p=h.exec(l.pathname);if(!p)break;let f=p[0],g=p.index;u+=l.pathname.slice(d,g).replace(/\/{2,}/g,"/"),u+=f,d=g+f.length}u+=l.pathname.slice(d,l.pathname.length).replace(/\/{2,}/g,"/"),l.pathname=u}if(l.pathname)try{l.pathname=decodeURI(l.pathname)}catch{}if(a.removeDirectoryIndex===!0&&(a.removeDirectoryIndex=[/^index\.[a-z]+$/]),Array.isArray(a.removeDirectoryIndex)&&a.removeDirectoryIndex.length>0){let h=l.pathname.split("/"),d=h[h.length-1];nz(d,a.removeDirectoryIndex)&&(h=h.slice(0,-1),l.pathname=h.slice(1).join("/")+"/")}if(l.hostname&&(l.hostname=l.hostname.replace(/\.$/,""),a.stripWWW&&/^www\.(?!www\.)[a-z\-\d]{1,63}\.[a-z.\-\d]{2,63}$/.test(l.hostname)&&(l.hostname=l.hostname.replace(/^www\./,""))),Array.isArray(a.removeQueryParameters))for(let h of[...l.searchParams.keys()])nz(h,a.removeQueryParameters)&&l.searchParams.delete(h);if(a.removeQueryParameters===!0&&(l.search=""),a.sortQueryParameters){l.searchParams.sort();try{l.search=decodeURIComponent(l.search)}catch{}}a.removeTrailingSlash&&(l.pathname=l.pathname.replace(/\/$/,""));let c=s;return s=l.toString(),!a.removeSingleSlash&&l.pathname==="/"&&!c.endsWith("/")&&l.hash===""&&(s=s.replace(/\/$/,"")),(a.removeTrailingSlash||l.pathname==="/")&&l.hash===""&&a.removeSingleSlash&&(s=s.replace(/\/$/,"")),o&&!a.normalizeProtocol&&(s=s.replace(/^http:\/\//,"//")),a.stripProtocol&&(s=s.replace(/^(?:https?:)?\/\//,"")),s}(t,{removeTrailingSlash:!1,removeSingleSlash:!1,stripWWW:!1}),this.context=e??"tab"}dispatch(){if(wi(this.shared,this.condition)===!1)return!1;Qc?window.location.assign(this.url):(this.context==="tab"||$F&&this.context==="none"?window.open(this.url,"_blank"):this.context==="window"?window.open(this.url,"_blank",`width=${window.innerWidth}, height=${window.innerHeight}`):window.open(this.url,"_parent"),this.controlsManager.orbitControls?.onPointerUp(ae[0]),ae.splice(0,ae.length))}},_nt=class{constructor(t,e,i,n,r){this.data=t,this.page=e,this.shared=i,this.eventManager=n,this.condition=r}dispatch(){if(wi(this.shared,this.condition)===!1)return!1;clearTimeout(this.timeoutId),delete this.timeoutId,this.timeoutId=window.setTimeout(()=>{this.shared.reset(this.shared.data,!0),bP(this.page,this.shared,!0),this.eventManager.reset(),this.eventManager.controlsManager.gameControl?.reset(!0),this.page.switchToPlayCamera(),this.eventManager.controlsManager.requestRender(),delete this.timeoutId},1e3*(this.data.delay??0))}dispose(){clearTimeout(this.timeoutId),delete this.timeoutId}};tt();var bnt={type:"beginState"},rz={type:"completeState",isfromEntity:!1},sz={type:"requestRender"},xnt=class extends Vn{constructor(t,e,i,n){super(),this.data=t,this.page=e,this.shared=i,this.condition=n,this.toggleIsForward=!1,this.posStart=new T,this.posEnd=new T,this.qStart=new Wt,this.qEnd=new Wt,this.zoomStart=1,this.zoomEnd=1}init(){}get playing(){return this.runner?.isPlaying===!0}buildAnimation(t=!1){if(!this.data.animate)return;let e=this.page.scene.find(this.data.targetCamera);if(!e||!e.visible)throw new ReferenceError("Target camera not founded or not visible");this.posStart.copy(this.page.activeCamera.position),this.qStart.copy(this.page.activeCamera.quaternion),this.zoomStart=this.page.activeCamera.zoom;let i={duration:this.data.duration,delay:0,delayDirection:"start-once",direction:"normal",repeat:0,ease:P9(this.data)},n=r=>{let s=this.page.activeCamera;s.position.lerpVectors(this.posStart,this.posEnd,r),s.quaternion.slerpQuaternions(this.qStart,this.qEnd,r),s.zoom=this.zoomStart+(this.zoomEnd-this.zoomStart)*r,s.wasMovedBySwitchCameraAction=!0,s.updateMatrix(),s.updateMatrixWorld(),s.updateProjectionMatrix(),s.dispatchEvent(sz),r===1&&s.dispatchEvent(rz)};this.runner=new b9(i,n,()=>{this.data.runMode!=="Toggle"||this.toggleIsForward?(this.posEnd.copy(e.position),this.qEnd.copy(e.quaternion),this.zoomEnd=e.zoom,this.fromCamera=this.page.activeCamera,this.switchCamera(e.uuid)):this.fromCamera&&(this.posEnd.copy(this.fromCamera.position),this.qEnd.copy(this.fromCamera.quaternion),this.zoomEnd=this.fromCamera.zoom,this.switchCamera(this.fromCamera.uuid)),this.page.activeCamera.dispatchEvent(bnt),n(0)})}update(t){this.runner?.update(t),this.runner?.isPlaying!==!0&&nn.remove(this)}start(){!this.runner||(this.runner.start(nn.time),nn.add(this))}switchCamera(t){let e=this.page.activeCamera,i=this.page.scene.find(t);if(!i||!i.visible)throw new ReferenceError("Target camera not founded or not visible");this.page.switchActiveCamera(i),e.dispatchEvent({type:"cameraChange",camera:i})}play(){if(wi(this.shared,this.condition)===!1)return!1;if(!this.playing&&this.page.activeCamera.uuid!==this.data.targetCamera)try{clearTimeout(this.timeoutId),this.timeoutId=window.setTimeout(()=>{delete this.timeoutId,this.data.animate?(this.buildAnimation(),this.start()):this.switchCamera(this.data.targetCamera)},1e3*this.data.delay)}catch{}}pause(){this.runner?.stop(),nn.remove(this),clearTimeout(this.timeoutId),delete this.timeoutId}toggle(t){if(wi(this.shared,this.condition)===!1)return!1;if(window.clearTimeout(this.timeoutId),delete this.timeoutId,t!==this.toggleIsForward)try{this.playing?(this.runner?.stop(),this.toggleIsForward=t??!this.toggleIsForward,this.buildAnimation(!0),this.start()):this.timeoutId=window.setTimeout(()=>{this.toggleIsForward=t??!this.toggleIsForward,this.data.animate?(this.runner?.stop(),this.buildAnimation(),this.start()):(this.toggleIsForward?(this.fromCamera=this.page.activeCamera,this.switchCamera(this.data.targetCamera)):this.fromCamera&&this.switchCamera(this.fromCamera.uuid),this.page.activeCamera.dispatchEvent(rz),this.page.activeCamera.dispatchEvent(sz))},1e3*this.data.delay)}catch{}}playFromCurrent(){this.toggle(!0)}reverseFromCurrent(){this.toggle(!1)}dispose(){this.pause(),this.toggleIsForward=!1}};B3();var wnt=class{constructor(t,e,i,n){this.data=t,this.page=e,this.shared=i,this.condition=n}dispatch(){if(wi(this.shared,this.condition)===!1)return!1;(this.data.target==="single"?this.data.variableId?[this.data.variableId]:[]:Object.keys(this.shared.getVariables())).forEach(t=>{this.shared.getVariable(t);let e=this.shared.data.variables.data(t)?.value;e!==void 0&&this.shared.updateVariable(t,e),this.shared.enableLocalStorageForPersistentVariables&&localStorage.removeItem(yT(t))})}dispose(){}};ke(),Dr("Link",({data:t,eventManager:e,shared:i,actionCondition:n})=>new ynt(t,e.controlsManager,i,n)),Dr("Reset",({data:t,page:e,shared:i,eventManager:n,actionCondition:r})=>new _nt(t,e,i,n,r)),Dr("SwitchCamera",({data:t,page:e,shared:i,actionCondition:n})=>new xnt(t,e,i,n)),Dr("ClearLocalStorage",({data:t,page:e,shared:i,actionCondition:n})=>new wnt(t,e,i,n)),Si("misc-actions"),ke(),Xr(),dl(),q3(),B3();var Snt=class{get sharedAssets(){return this.shared}constructor(t,e={},i=!0){this.shared=new Mb(t.shared,e,!0,i),this.scene=new Dx(t.scene,this.sharedAssets),this.shared.setEntityOpContext({scene:this.scene,shared:this.shared})}reset(t,e){this.scene.clearScene(),this.sharedAssets.reset(t.shared),this.scene.resetAfterClear(t.scene,this.sharedAssets)}resetPersonalCameraFromDocumentData(){for(let t of this.scene.children)t instanceof mn&&!t.uiScene&&t.personalCamera.updateState(t.data.camera,{scene:this.scene,shared:this.shared})}dispose(){this.scene.dispose(),this.shared.dispose()}gc(){this.scene.releaseInstanceGroups(),this.shared.geometryCache.startGc(),this.shared.geometryCache2.startGc(),this.scene.traverseEntity(t=>{t instanceof Ai&&t.markGeometryAsReachable(this.shared)}),this.shared.geometryCache.endGc(),this.shared.geometryCache2.endGc()}};q3(),Ye();var Gu,sE,aE="vertexOrder";function az(t){return sE||(sE=Promise.resolve().then(()=>(TZ(),a8)).then(({DRACOLoader:e})=>((Gu=new e).setDecoderPath(t!==void 0?`${t}/`:"https://www.gstatic.com/draco/versioned/decoders/1.5.2/").preload(),Gu.decoderPending))),sE}async function Mnt(t){if(Gu){let e,i={attributeIDs:{...Gu.defaultAttributeIDs,[aE]:"GENERIC"},attributeTypes:{...Gu.defaultAttributeTypes,[aE]:"Uint32Array"},useUniqueIDs:!1};try{e=await Gu.decodeGeometry(new Int8Array(t).buffer,i)}catch(n){console.error(n)}if(e)return function(n){let r=n.attributes.find(h=>h.name===aE);if(!r)return n;let s=r.array,a=s.length,o=0;for(let h=0;h<a;h++)o=Math.max(o,s[h]+1);let l,c=n.attributes.filter(h=>h!==r).map(({name:h,itemSize:d,array:u})=>{let p=new Float32Array(o*d);for(let f=0;f<a;f++){let g=s[f]*d,m=f*d;for(let v=0;v<d;v++)p[g+v]=u[m+v]}return{name:h,itemSize:d,array:p}});if(n.index){let h=n.index.array,d=new Uint32Array(h.length);for(let u=0;u<h.length;u++)d[u]=s[h[u]];l={array:d}}return{index:l,attributes:c}}({index:e.index?{array:e.index.array}:void 0,attributes:Object.entries(e.attributes).map(([n,r])=>({name:n,itemSize:r.itemSize,array:r.array}))})}return null}async function oz(t){for(let e of t){let i=await Mnt(e.geometry.data.draco);if(i){let n=e.geometry.data;i.index&&(n.index={array:i.index.array,itemSize:1,normalized:!1,type:"Uint32Array"});let r={};i.attributes.forEach(({name:s,array:a,itemSize:o})=>{r[s]={array:a,itemSize:o,type:"Float32Array",normalized:!1}}),n.attributes=r,n.draco=void 0}}}function Ent(t){let e=this._clip.duration,i=this._clip.start??0,n=this.loop,r=this.time+t,s=this._loopCount,a=n===D_;if(t===0)return s===-1||!a||1&~s?r:e-(r-i);if(n===SE){s===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));t:{if(r>=e)r=e;else{if(!(r<0)){this.time=r;break t}r=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=r,this._mixer.dispatchEvent({type:"finished",action:this,direction:t<0?-1:1})}}else{if(s===-1&&(t>=0?(s=0,this._setEndings(!0,this.repetitions===0,a)):this._setEndings(this.repetitions===0,!0,a)),r>=e||r<i){let o=Math.floor((r-i)/(e-i));r-=(e-i)*o,s+=Math.abs(o);let l=this.repetitions-s;if(l<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,a||(r=t>0?e:i,this.repetitions===1&&(r=e)),this.time=r,this._mixer.dispatchEvent({type:"finished",action:this,direction:t>0?1:-1});else{if(l===1){let c=t<0;this._setEndings(c,!c,a)}else this._setEndings(!1,!1,a);this._loopCount=s,this.time=r,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:o})}}else this.time=r;if(a&&!(1&~s))return e-(r-i)}return r}_x(),Ap(),d0(),m0(),b3(),Eh(),wx(),e8(),s8(),_a(),tt(),tt();var lz=!1,Ant=class{constructor(t,e,i,n){this.scene=t,this.requestRender=e,this.updateDisplayProgress=i,this.animationInspectorState=n,this.clipIdToAction={},this.activeClip=null,this.needsUpdate=!1,this.addClip=r=>{r.data.type==="Empty"&&Array.isArray(r.data.animations)&&r.data.animations.forEach((s,a)=>{let o=s[0]+"/";if(Array.isArray(r.identity)?o+=r.identity[0]:o+=r.uuid,this.clipIdToAction[o])return;let l=b1.parse(JSON.parse(s[2]));r.animations[a]=l;let c=this.mixer.clipAction(l,r);lz===!1&&(Object.getPrototypeOf(c)._updateTime=Ent,lz=!0),c.clampWhenFinished=!0,this.clipIdToAction[o]=c})},this.mixer=new jE(t),this.scene.traverseEntity(this.addClip)}rebindClips(){this.mixer.stopAllAction(),this.mixer=new jE(this.scene),this.clipIdToAction={},this.activeClip=null,this.scene.traverseEntity(this.addClip)}deleteClip(t,e){let i=this.scene.find(e);if(!i)return;let n=i.animations.find(s=>s.uuid===t);if(!n)return;let r=this.clipIdToAction[t];!r||(r.stop(),this.mixer.uncacheClip(n),delete this.clipIdToAction[t],i.animations=i.animations.filter(s=>s.uuid!==t))}get isPlaying(){return Object.values(this.clipIdToAction).some(t=>t.isRunning())}playFromInspector(t){this.mixer.stopAllAction();let e=this.clipIdToAction[t];!e||(e.play(),this.activeClip=e.getClip(),this.scene.markShadowsDirty(),this.requestRender())}onExitPlayMode(){Object.values(this.clipIdToAction).forEach(t=>{t.repetitions=1/0,t.loop=P_}),this.mixer.stopAllAction(),this.scene.markShadowsDirty(),this.requestRender()}play(t){let e=t.clipId+"/"+t.object,i=this.clipIdToAction[e];if(i)return i.repetitions=t.repeat>=0?t.repeat+1:1/0,i.loop=t.direction!=="pingpong"&&t.direction!=="pingpong-rewind"||t.repeat===0?P_:D_,i.play(),i.paused=!1,this.requestRender(),i}resumeFromInspector(t){let e=this.clipIdToAction[t];!e||(e.play(),e.paused=!1,this.scene.markShadowsDirty(),this.requestRender())}pauseFromInspector(t){let e=this.clipIdToAction[t];!e||(e.paused=!0)}stop(){this.mixer.stopAllAction(),this.scene.markShadowsDirty(),this.requestRender()}update(t){if(this.needsUpdate)this.needsUpdate=!1;else if(this.isPlaying===!1||this.animationInspectorState?.isScrubbing)return;this.mixer.update(t/1e3),this.activeClip&&this.updateDisplayProgress(Math.round(this.mixer.time/this.activeClip.duration*(this.maxFrames-1)%(this.maxFrames-1))),this.requestRender()}get maxFrames(){return I9(this.activeClip??void 0)}setProgressFromInspector(t,e){if(!this.clipIdToAction[e])return;this.activeClip!==this.clipIdToAction[e].getClip()&&this.playFromInspector(e);let i=this.clipIdToAction[e].paused;this.clipIdToAction[e].paused=!1,this.mixer.setTime(Math.min(t/(this.maxFrames-1),.9999)*this.activeClip.duration),this.scene.markShadowsDirty(),this.requestRender(),i&&(this.clipIdToAction[e].paused=!0)}};co(),dl(),Dk(),rd(),u0(),Ek(),c8();var Tnt={bloom:()=>Promise.resolve().then(()=>(LZ(),OZ)),chromaticAberration:()=>Promise.resolve().then(()=>(zZ(),UZ)),vignette:()=>Promise.resolve().then(()=>(kZ(),NZ)),noise:()=>Promise.resolve().then(()=>(GZ(),jZ)),hueSaturation:()=>Promise.resolve().then(()=>(qZ(),WZ)),brightnessContrast:()=>Promise.resolve().then(()=>(YZ(),$Z)),depthOfField:()=>Promise.resolve().then(()=>(QZ(),KZ)),pixelation:()=>Promise.resolve().then(()=>(eK(),tK))};function Cnt(t){return function(e,i){return Promise.all(e.map(n=>i[n]?.().catch(r=>{console.warn(`[spline] Failed to load the ${n} postprocessing effect (webgl); the effect will be skipped.`,r)}))).then(()=>{})}(t,Tnt)}var t1=new WeakMap,hz=new WeakMap;function cz(t,e,i){let n=r=>{t.removeEventListener(e,n,!0),r.stopImmediatePropagation(),i(r)};return t.addEventListener(e,n,!0),()=>t.removeEventListener(e,n,!0)}ti();var Pnt=bp(iK(),1);function e1(t){return Array.isArray(t)||ArrayBuffer.isView(t)&&!(t instanceof DataView)}function Dnt(t){return{id:t.uuid,name:t.name,type:t.object.data?.type??t.object.type,visible:t.playModeVisible!==!1,position:{x:t.position.x,y:t.position.y,z:t.position.z},rotation:{x:t.rotation.x*Ot.RAD2DEG,y:t.rotation.y*Ot.RAD2DEG,z:t.rotation.z*Ot.RAD2DEG},scale:{x:t.scale.x,y:t.scale.y,z:t.scale.z},spawned:!0}}function i1(t){return{id:t.uuid,name:t.name,type:t.type??"Object",visible:t.visible,position:{x:t.position.x,y:t.position.y,z:t.position.z},rotation:{x:t.rotation.x*Ot.RAD2DEG,y:t.rotation.y*Ot.RAD2DEG,z:t.rotation.z*Ot.RAD2DEG},scale:{x:t.scale.x,y:t.scale.y,z:t.scale.z}}}function B9(t,e,i){let n=a=>t.findObjectById(a)??t.findObjectByName(a),r=new Map,s=a=>{let o=r.get(a);if(o)return o;for(let l of r.values())if(l.name===a)return l};return{setVariable:(a,o)=>a in t.getVariables()?(t.setVariable(a,o),{ok:!0}):{ok:!1,warning:`spline.setVariable: no variable named "${a}" in this scene.`},getVariable:a=>t.getVariable(a),getVariables:()=>t.getVariables(),getAllObjects:()=>t.getAllObjects().map(i1),findObject:a=>{let o=n(a);return o?i1(o):void 0},getGeometry:(a,o)=>{if(!i)return{warning:"spline.getGeometry: not available in this runtime integration."};let l=s(a),c=l?l.object:(()=>{let p=n(a);return p?i.findEntity(p.uuid):void 0})();if(!c)return{warning:`spline.getGeometry: no object named "${a}" (names/ids come from getAllObjects).`};let h,d=l??c;o.space==="world"&&(d.updateWorldMatrix?.(!0,!1),h=d.matrixWorld?.elements);let u=function(p,f){let g=p?.getAttribute("position");if(!g||!g.count)return null;let m=g.count,v=f??null,y=p.getIndex?.()??null,_=Math.floor((y?y.count:m)/3),b=1/0,x=1/0,w=1/0,S=-1/0,E=-1/0,A=-1/0,P=new Float32Array(3*m);for(let D=0;D<m;D++){let F=g.getX(D),V=g.getY(D),U=g.getZ(D);v&&([F,V,U]=P$(v,F,V,U)),F<b&&(b=F),V<x&&(x=V),U<w&&(w=U),F>S&&(S=F),V>E&&(E=V),U>A&&(A=U),P[3*D]=F,P[3*D+1]=V,P[3*D+2]=U}let C={space:v?"world":"local",vertexCount:m,triangleCount:_,indexed:y!==null,bounds:{min:[b,x,w],max:[S,E,A],size:[S-b,E-x,A-w]},vertices:P};if(y){let D=new Uint32Array(y.count);for(let F=0;F<y.count;F++)D[F]=y.getX(F);C.indices=D}let R=p.getAttribute("normal");if(R&&R.count===m){let D=v?function(F){let V=F[0],U=F[4],j=F[8],W=F[1],it=F[5],nt=F[9],Y=F[2],ot=F[6],ht=F[10],ft=V*(it*ht-nt*ot)-U*(W*ht-nt*Y)+j*(W*ot-it*Y);if(!isFinite(ft)||Math.abs(ft)<1e-12)return null;let pt=1/ft,J=[(it*ht-nt*ot)*pt,(j*ot-U*ht)*pt,(U*nt-j*it)*pt,(nt*Y-W*ht)*pt,(V*ht-j*Y)*pt,(j*W-V*nt)*pt,(W*ot-it*Y)*pt,(U*Y-V*ot)*pt,(V*it-U*W)*pt];return[J[0],J[3],J[6],J[1],J[4],J[7],J[2],J[5],J[8]]}(v):void 0;if(!v||D){let F=new Float32Array(3*m);for(let V=0;V<m;V++){let U=R.getX(V),j=R.getY(V),W=R.getZ(V);if(D){let it=D[0]*U+D[1]*j+D[2]*W,nt=D[3]*U+D[4]*j+D[5]*W,Y=D[6]*U+D[7]*j+D[8]*W,ot=Math.hypot(it,nt,Y);ot>1e-12?(U=it/ot,j=nt/ot,W=Y/ot):(U=it,j=nt,W=Y)}F[3*V]=U,F[3*V+1]=j,F[3*V+2]=W}C.normals=F}}let L=p.getAttribute("uv");if(L&&L.count===m){let D=new Float32Array(2*m);for(let F=0;F<m;F++)D[2*F]=L.getX(F),D[2*F+1]=L.getY(F);C.uvs=D}return C}(c.geometry,h);return u?{data:{id:d.uuid,name:d.name,geometry:c.data?.geometry?.type,...u}}:{warning:`spline.getGeometry: "${d.name}" has no readable geometry \u2014 only meshes do (lights, cameras and groups have none; read a group's child meshes instead).`}},updateObject:(a,o)=>{let l=s(a);if(l){let{position:m,rotation:v,scale:y,visible:_}=o;return m&&(typeof m.x=="number"&&(l.position.x=m.x),typeof m.y=="number"&&(l.position.y=m.y),typeof m.z=="number"&&(l.position.z=m.z)),v&&(typeof v.x=="number"&&(l.rotation.x=v.x*Ot.DEG2RAD),typeof v.y=="number"&&(l.rotation.y=v.y*Ot.DEG2RAD),typeof v.z=="number"&&(l.rotation.z=v.z*Ot.DEG2RAD)),y&&(typeof y.x=="number"&&(l.scale.x=y.x),typeof y.y=="number"&&(l.scale.y=y.y),typeof y.z=="number"&&(l.scale.z=y.z)),typeof _=="boolean"&&(l.playModeVisible=_),l.updateMatrix(),t.requestRender(),!0}let c=n(a);if(!c)return!1;let{position:h,rotation:d,scale:u,visible:p,geometry:f,material:g}=o;if(f&&typeof f=="object"&&i){let m=i.findEntity(c.uuid);if(m){let{vertices:v,normals:y,uvs:_,indices:b,...x}=f;e1(v)&&i.shared.updateEntityGeometryVertices(m,{vertices:v,normals:e1(y)?y:void 0,uvs:e1(_)?_:void 0,indices:e1(b)?b:void 0}),Object.keys(x).length>0&&i.shared.updateEntityGeometryParams(m,x)}}if(g&&typeof g=="object"&&i){let m=i.findEntity(c.uuid);m&&i.shared.updateEntityMaterialParams(m,g)}return h&&(typeof h.x=="number"&&(c.position.x=h.x),typeof h.y=="number"&&(c.position.y=h.y),typeof h.z=="number"&&(c.position.z=h.z)),d&&(typeof d.x=="number"&&(c.rotation.x=d.x*Ot.DEG2RAD),typeof d.y=="number"&&(c.rotation.y=d.y*Ot.DEG2RAD),typeof d.z=="number"&&(c.rotation.z=d.z*Ot.DEG2RAD)),u&&(typeof u.x=="number"&&(c.scale.x=u.x),typeof u.y=="number"&&(c.scale.y=u.y),typeof u.z=="number"&&(c.scale.z=u.z)),typeof p=="boolean"&&(c.visible=p),t.requestRender(),!0},createObject:async(a,o)=>i1(await t.createObject(a,o)),createCustomMaterial:a=>t.createCustomMaterial(a),getTexture:(a,o)=>{if(!i)return null;let l=n(a),c=l?i.findEntity(l.uuid):void 0;if(!c)return null;let h=i.shared.getEntityTexture(c,o??{});return h?{texture:h.texture,width:h.width,height:h.height,layer:h.layerType}:null},setMaterial:(a,o)=>t.setMaterial(a,o),cloneObject:(a,o)=>i1(t.cloneObject(a,o)),removeObject:a=>t.removeObject(a),spawnObject:(a,o)=>{if(!i)return{warning:"spline.spawnObject: not available in this runtime integration."};let l=n(a),c=l?i.findEntity(l.uuid):void 0;if(!c)return{warning:`spline.spawnObject: no object named "${a}" to use as a template.`};if(r.size>=500)return{warning:"spline.spawnObject: spawn budget reached (500 live copies) \u2014 destroyObject old copies (or reuse them) instead of spawning more."};let h=i.shared.spawnRuntimeClone(c,o??{});return h?(r.set(h.uuid,h),t.requestRender(),{object:Dnt(h)}):{warning:`spline.spawnObject: "${a}" cannot be spawned from.`}},destroyObject:a=>{let o=s(a);return!(!i||!o||(r.delete(o.uuid),i.shared.destroyRuntimeClone(o),t.requestRender(),0))},setInstanceTransforms:(a,o)=>{if(!i)return-1;let l=n(a),c=l?i.findEntity(l.uuid):void 0;if(!c)return-1;let h=i.shared.setEntityInstanceTransforms(c,o);return h>=0&&t.requestRender(),h},emitEvent:(a,o,l)=>{let c=n(o);return c?(l?c.emitEventReverse(a):c.emitEvent(a),{ok:!0}):{ok:!1,warning:`spline.emitEvent: no object named "${o}".`}},requestRender:()=>t.requestRender(),addSplineEventListener:(a,o)=>{let l=c=>{o({target:{id:c.target?.id??"",name:c.target?.name??""}})};return t.addEventListener(a,l),()=>t.removeEventListener(a,l)},getCanvas:()=>e}}tt(),ti();var U9=class{constructor(t,e,i){this.iframe=t,this.bridge=e,this.observer=i}static mount(t,e,i,n){if(typeof document>"u")return null;let r=e.parentElement;if(!r)return null;getComputedStyle(r).position==="static"&&(r.style.position="relative");let s=document.createElement("iframe");s.setAttribute("sandbox","allow-scripts allow-forms allow-pointer-lock"),s.title="Spline HTML content";let a=s.style;a.position="absolute",a.border="0",a.background="transparent",a.pointerEvents="auto",a.colorScheme="normal";let o=()=>{a.left=`${e.offsetLeft}px`,a.top=`${e.offsetTop}px`,a.width=`${e.offsetWidth}px`,a.height=`${e.offsetHeight}px`};o();let l=new ResizeObserver(o);l.observe(e),l.observe(r),s.srcdoc=function(h){let d=`<script>${KF}<\/script>`,u=/<head(\s[^>]*)?>/i.exec(h);if(u){let f=u.index+u[0].length;return h.slice(0,f)+d+h.slice(f)}let p=/<html(\s[^>]*)?>/i.exec(h);if(p){let f=p.index+p[0].length;return h.slice(0,f)+`<head>${d}</head>`+h.slice(f)}return d+h}(i),r.insertBefore(s,e.nextSibling);let c=new JF(s,B9(t,e,n),(h,d)=>{h==="warn"?console.warn(`[spline html] ${d}`):h==="error"&&console.error(`[spline html] ${d}`)});return c.attach(),new U9(s,c,l)}dispose(){this.bridge.dispose(),this.observer.disconnect(),this.iframe.remove()}};ti();var Y1="data-spline-html-content",Rnt=`
9944
+ `&&r--,this.htmlInput.setSelectionRange(Math.min(t,r),Math.max(t,r))}checkClickedObject(){if(this.virtualInput){let t=this.raycaster.intersectObject(this.virtualInput,!1);if(t.length>0){let e=t[0];if(e.object instanceof _P)return e.object}}return null}selectClosestWord(t,e){if(!this.virtualInput)return;let i=this.virtualInput.wrappedText,n=i[t],r=e+1,s=e;n[e]!==" "&&(r=this.findNextCharOccurence(n,e,"forward"," "),s=this.findNextCharOccurence(n,e,"backward"," "),s>0&&s++,r>=n.length-1&&t===i.length-1&&r++);let a=this.helper,o=a.getGlobalIndexFromLineAndCharIndexes(i,t,s),l=a.getGlobalIndexFromLineAndCharIndexes(i,t,r);this.setInputSelection(o,l)}findNextCharOccurence(t,e,i,n=" "){let r=Math.max(0,t.length-1),s=i==="forward"?r:0,a=i==="forward"?1:-1,o=Math.max(Math.min(e,r),0);for(;o!==s;)if(o+=a,t.charAt(o)===n)return o;return s}getPointOnPlane(){let t=this.virtualInput?.data;if(this.virtualInput&&t&&this.raycaster.ray.intersectsPlane(this.plane)){this.planeIntersection===null&&(this.planeIntersection=new T);let e=this.raycaster.ray.intersectPlane(this.plane,this.planeIntersection);if(e){this.planeIntersection.copy(this.virtualInput.worldToLocal(e));let i=typeof t.geometry.width=="number"?t.geometry.width:1,n=typeof t.geometry.height=="number"?t.geometry.height:1;this.projected.set(e.x+.5*i,e.y-.5*n)}}}updatePlane(){let t=this.virtualInput?.data;this.virtualInput&&t&&(kU.getNormalMatrix(this.virtualInput.matrixWorld),FU.copy($it).applyMatrix3(kU).normalize(),this.virtualInput.localToWorld(NU.set(0,0,t.geometry.depth)),this.plane.setFromNormalAndCoplanarPoint(FU,NU))}setInputSelection(t,e=t){this.htmlInput?.setSelectionRange(t,e),Qc&&this.htmlInput?.focus(),setTimeout(()=>{this.htmlInput?.focus()})}updateTextInputStyles(){let t=this.virtualInput?.data;this.virtualInput&&t&&this.htmlInput&&(this.htmlInput.style.fontSize=t.geometry.fontSize+"px",this.htmlInput.style.letterSpacing=t.geometry.letterSpacing*t.geometry.fontSize+"px",this.htmlInput.style.lineHeight=t.geometry.fontSize*t.geometry.lineHeight+"px",this.htmlInput.style.width=t.geometry.width+"px",this.htmlInput.style.height=t.geometry.height+"px",this.htmlInput.style.textAlign=function(e){return e===4?"justify":e===2?"right":e===3?"center":"left"}(t.geometry.horizontalAlign))}},M9=(t,e)=>{if(typeof t=="string"){let i=e.data(t);if(i)return M9(i.value,e)}return br.getDisplayedValue(t)};function VU(t,e){let i=t.text,n="";if(typeof i=="string"){let r=e.variables.data(n);r&&(n=M9(r.value,e.variables))}else n=i.textValue.toString();return n}var Zit=class extends Lr{constructor(t,e){super(t),this.eventManager=e,this._textInputs=[],this.sceneHelpers=new ss,this.helper=new S9,this._onMouseDownFocusIn=i=>{if(ae.length>1)return;this.eventContext.updateRaycaster(i);let n=null;if(this.eventContext.raycaster){for(let r of this._textInputs)if(this.eventContext.raycaster.intersectObject(r,!0).length>0){n=r;break}}this.focusOnTextInput(n),this._onCaretUpdate(),this._onMouseUp(),this.textInputManager.doubleClickHandler.start(this.eventContext.domElement),this.textInputManager.doubleClickHandler._onMouseDown(i),this._onMouseDown(i)},this.onExit=()=>{let{virtualInput:i}=this.textInputManager;if(i===null)return;let n=this.textInputManager.htmlInput;this.helper.hide(),n?.setSelectionRange(n.value.length,n.value.length),this.eventManager.controlsManager.orbitControls&&(this.eventManager.controlsManager.orbitControls.enabled=!0);let{domElement:r}=this.eventContext;r.removeEventListener("pointerdown",this._onMouseDown,!1),r.removeEventListener("pointerup",this._onMouseUp,!1),r.removeEventListener("pointermove",this._onMouseMove,!1),window.removeEventListener("keydown",this._onKeyPress),this.textInputManager.doubleClickHandler.reset(),r.addEventListener("pointerdown",this._onMouseDownFocusIn),this.eventContext.renderer.sceneHelpersOnTop=void 0,this.eventContext.renderer.pipeline.disableHelpers()},this._onMouseDown=i=>{this.eventContext.updateRaycaster(i),this.textInputManager.handleMouseDown(),this.textInputManager.virtualInput&&this.eventContext.raycaster.intersectObject(this.textInputManager.virtualInput,!0).length>0&&this.eventManager.controlsManager.orbitControls&&(this.eventManager.controlsManager.orbitControls.enabled=!1)},this._onMouseUp=()=>{this.textInputManager.handleMouseUp(),this.eventManager.controlsManager.orbitControls&&!this.eventManager.controlsManager.orbitControls.enabled&&(this.eventManager.controlsManager.orbitControls.enabled=!0)},this._onMouseMove=i=>{this.eventContext.updateRaycaster(i),this.textInputManager.handleMouseMove()},this._onTextEdit=i=>{let{htmlInput:n,virtualInput:r,helper:s}=this.textInputManager;if(!n||!r)return;let a=n.value;r.textGeometry.setText(a,this.eventContext.sharedAssets).then(()=>{this.eventContext.requestRender()});let o=r.data;s.update();let l=o.geometry.text;if(typeof l=="string"){let c=l;this.eventContext.sharedAssets.updateVariable(c,{textValue:a})}this.textInputManager.updateTextInputStyles(),this._onCaretUpdate()},this._onCaretUpdate=i=>{this.textInputManager.handleCaretUpdate(i)},this._onKeyPress=i=>{i.key==="Escape"&&this.onExit()},this.textInputManager=new Yit(this.sceneHelpers,t.raycaster,t.sharedAssets,t.requestRender,this.onExit)}connect(){let t=[];if(this.eventContext.scene.traverseEntity(n=>{n instanceof _P&&t.push(n)}),this._textInputs=t,t.length===0)return;let{domElement:e}=this.eventContext;e.addEventListener("pointerdown",this._onMouseDownFocusIn),this.textInputManager.connect();let i=this.textInputManager.createInput();document.body.appendChild(i),i.style.display="none",i.addEventListener("keyup",this._onCaretUpdate),i.addEventListener("keydown",this._onCaretUpdate),i.addEventListener("beforeinput",this._onCaretUpdate),i.addEventListener("paste",this._onCaretUpdate),i.addEventListener("cut",this._onCaretUpdate),i.addEventListener("select",this._onCaretUpdate),i.addEventListener("selectstart",this._onCaretUpdate)}disconnect(){let t=this.textInputManager.htmlInput,{domElement:e,sharedAssets:i}=this.eventContext;e.removeEventListener("pointerdown",this._onMouseDownFocusIn),t?.removeEventListener("keyup",this._onCaretUpdate),t?.removeEventListener("keydown",this._onCaretUpdate),t?.removeEventListener("beforeinput",this._onCaretUpdate),t?.removeEventListener("paste",this._onCaretUpdate),t?.removeEventListener("cut",this._onCaretUpdate),t?.removeEventListener("select",this._onCaretUpdate),t?.removeEventListener("selectstart",this._onCaretUpdate),this._textInputs.forEach(n=>{let r=VU(n.data.geometry,this.eventContext.sharedAssets.data);n.textGeometry.setText(r,i)}),e.removeEventListener("pointerdown",this._onMouseDown,!1),e.removeEventListener("pointerup",this._onMouseUp,!1),e.removeEventListener("pointermove",this._onMouseMove,!1),window.removeEventListener("keydown",this._onKeyPress),this.eventContext.renderer.sceneHelpersOnTop=void 0,this.eventContext.renderer.pipeline.disableHelpers(),this.textInputManager.disconnect()}focusOnTextInput(t){this.textInputManager.focus(t),this.textInputManager.onTextMaterialChanged();let e=this.textInputManager.htmlInput;if(!e||t===null)return;this.textInputManager.updateTextInputStyles(),this.eventContext.renderer.sceneHelpersOnTop=this.sceneHelpers,this.eventContext.renderer.pipeline.enableHelpers(),this.textInputManager.isDragging=!1;let i=VU(t.textGeometry.userData.parameters,this.eventContext.sharedAssets.data);e.value=i,e.setSelectionRange(0,0),this.textInputManager.helper.show(t),e.style.display="block",e.addEventListener("input",this._onTextEdit),this.textInputManager.updatePlane();let{domElement:n}=this.eventContext;n.removeEventListener("pointerdown",this._onMouseDownFocusIn),n.addEventListener("pointerdown",this._onMouseDown,!1),n.addEventListener("pointerup",this._onMouseUp,!1),n.addEventListener("pointermove",this._onMouseMove,!1),window.addEventListener("keydown",this._onKeyPress)}};ke(),ws("Textfields",({eventContext:t,eventManager:e})=>new Zit(t,e)),Ep("InputGeometry",(t,e,i)=>new _P(t,e,i)),Si("textinputs"),y3();var E9=new Map,Ag=new Map,Yy=class{constructor(t,e,i,n){this.data=e,this.isPlayAudioAction=!0;let{audio:r,volume:s,delay:a,loop:o}=e;if(!r)throw new Error("Missing property");try{let l=typeof r=="string"?n.getAudio(r).src:r.data;this.audioPlayer=new Fu({src:l,volume:s,delay:a,loop:o})}catch{console.warn(`Could not create an audio player for this object: "${i.name}" and this audio: "${r}"`)}Ag.has(i.uuid)?Ag.get(i.uuid).push(this):Ag.set(i.uuid,[this]),E9.set(t,this)}playByToggle(){this.data.toggle==="stop"?this.audioPlayer?.status==="playing"?this.audioPlayer.stop():(this.audioPlayer?.stop(),this.audioPlayer?.play()):this.data.toggle==="pause"?this.audioPlayer?.status==="playing"?this.audioPlayer?.pause():this.audioPlayer?.play():(this.audioPlayer?.stop(),this.audioPlayer?.play())}dispose(){this.audioPlayer?.stop()}},Kit=class{constructor(t){this.data=t,this.isPauseAudioAction=!0}dispatch(){this.data.playAudio?this.pauseAudio(this.data.playAudio):this.data.object?this.pauseAllAudiosFromObject(this.data.object):this.pauseAllAudios()}pauseAudio(t){let e=E9.get(t);!e||(this.data.delay>0?(this.disposeDelay(),this.timeoutId=window.setTimeout(()=>{e.audioPlayer?.[this.data.interaction](),this.disposeDelay()},this.data.delay)):e.audioPlayer?.[this.data.interaction]())}pauseAllAudiosFromObject(t){let e=Ag.get(t);!e?.length||(this.data.delay>0?(this.disposeDelay(),this.timeoutId=window.setTimeout(()=>{e.forEach(i=>i.audioPlayer?.[this.data.interaction]()),this.disposeDelay()},this.data.delay)):e.forEach(i=>i.audioPlayer?.[this.data.interaction]()))}pauseAllAudios(){let t=[...Ag.values()];!t.length||(this.data.delay>0?(this.disposeDelay(),this.timeoutId=window.setTimeout(()=>{t.forEach(e=>{e.forEach(i=>{i.audioPlayer?.[this.data.interaction]()})}),this.disposeDelay()},this.data.delay)):t.forEach(e=>{e.forEach(i=>{i.audioPlayer?.[this.data.interaction]()})}))}disposeDelay(){clearTimeout(this.timeoutId),delete this.timeoutId}dispose(){clearTimeout(this.timeoutId),delete this.timeoutId}},Qit=class{constructor(t,e,i,n,r){if(this.data=e,this.shared=n,this.condition=r,e.interaction==="play")this.interaction=new Yy(t,e,i,n);else{if(e.interaction!=="pause"&&e.interaction!=="stop")throw new Error("Missing property");this.interaction=new Kit(e)}}dispatchBasic(){if(wi(this.shared,this.condition)===!1)return!1;this.interaction instanceof Yy?this.interaction.playByToggle():this.interaction.dispatch()}dispatchConditional(){if(wi(this.shared,this.condition)===!1)return!1;this.interaction instanceof Yy?this.interaction.audioPlayer?.play():this.interaction.dispatch()}dispatchGameControl(t){if(wi(this.shared,this.condition)===!1)return!1;this.interaction instanceof Yy&&(t==="start"?this.interaction.audioPlayer?.play():this.interaction.audioPlayer?.stop())}dispose(){this.interaction.dispose()}};ke(),Dr("Audio",({id:t,data:e,object:i,shared:n,actionCondition:r})=>new Qit(t,e,i,n,r)),Si("audio"),ti();var A9=new Map,Tg=new Map,iE=class{constructor(t,e,i){this.data=e,this.isPlayVideoAction=!0,this.delay=0,this.status="stopped";let{layerId:n,loop:r,volume:s,delay:a}=e;if(this.object=i,n===void 0)throw new Error("Missing property");let o=function(l,c){let h;if("material"in l){let u=l.material;h=Array.isArray(u)?l.material[0].layers.find(p=>p.uuid===c):l.material.layers.find(p=>p.uuid===c)}if(!h)return;let d=h.color?.texture?.image?.img??h.holders?.find(u=>u.isVideo)?.img;return d instanceof HTMLVideoElement?d:void 0}(i,n);o&&(this.videoElement=o,this.videoElement.loop=r===1/0,Qc&&(this.videoElement.autoplay=!0),s!==void 0&&(this.videoElement.volume=s)),a!==void 0&&(this.delay=a),Tg.has(i.uuid)?Tg.get(i.uuid).push(this):Tg.set(i.uuid,[this]),A9.set(t,this),this.pause()}mute(){!this.videoElement||(this.videoElement.muted=!0)}unMute(){!this.videoElement||(this.videoElement.muted=!1)}play(t){if(!this.videoElement)return;let e=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);t?(this.mute(),this.delay+=150):e?(this.mute(),window.setTimeout(()=>{this.unMute()},100)):this.unMute(),this.delayTimerId=window.setTimeout(()=>{if(!this.videoElement)return;let i=this.videoElement.play();i!==void 0&&i.then(n=>{}).catch(n=>{this.play()}),this.clearDelay()},this.delay),this.status="playing"}clearDelay(){this.delayTimerId&&(clearTimeout(this.delayTimerId),delete this.delayTimerId)}pause(){!this.videoElement||(this.videoElement.pause(),this.status="paused")}stop(){!this.videoElement||(this.videoElement.pause(),this.videoElement.currentTime=0,this.status="stopped",this.clearDelay())}seek(t){return new Promise(e=>{if(!this.videoElement)return e();let i=this.videoElement.duration;if(i>0){let n=t%i;this.videoElement.currentTime=n}this.videoElement.addEventListener("seeked",()=>e(),{once:!0})})}playByToggle(){this.data.toggle==="stop"?this.status==="playing"?this.stop():(this.stop(),this.play()):this.data.toggle==="pause"?this.status==="playing"?this.pause():this.play():(this.stop(),this.play())}dispose(){!this.videoElement||(this.stop(),this.videoElement.muted=!0)}},Jit=class{constructor(t){this.data=t,this.isPauseVideoAction=!0}dispatch(){this.data.playVideo?this.pauseVideo(this.data.playVideo):this.data.object?this.pauseAllVideosFromObject(this.data.object):this.pauseAllVideos()}pauseVideo(t){let e=A9.get(t);!e||(this.data.delay>0?(this.disposeDelay(),this.timeoutId=window.setTimeout(()=>{e[this.data.interaction](),this.disposeDelay()},this.data.delay)):e[this.data.interaction]())}pauseAllVideosFromObject(t){let e=Tg.get(t);!e?.length||(this.data.delay>0?(this.disposeDelay(),this.timeoutId=window.setTimeout(()=>{e.forEach(i=>i[this.data.interaction]()),this.disposeDelay()},this.data.delay)):e.forEach(i=>i[this.data.interaction]()))}pauseAllVideos(){let t=[...Tg.values()];!t.length||(this.data.delay>0?(this.disposeDelay(),this.timeoutId=window.setTimeout(()=>{t.forEach(e=>{e.forEach(i=>{i[this.data.interaction]()})}),this.disposeDelay()},this.data.delay)):t.forEach(e=>{e.forEach(i=>{i[this.data.interaction]()})}))}disposeDelay(){clearTimeout(this.timeoutId),delete this.timeoutId}dispose(){clearTimeout(this.timeoutId),delete this.timeoutId}},tnt=class{constructor(t,e,i,n,r){if(this.data=e,this.shared=n,this.condition=r,e.interaction==="play")this.interaction=new iE(t,e,i);else{if(e.interaction!=="pause"&&e.interaction!=="stop")throw new Error("Missing property");this.interaction=new Jit(e)}}dispatchBasic(){if(wi(this.shared,this.condition)===!1)return!1;this.interaction instanceof iE?this.interaction.playByToggle():this.interaction.dispatch()}dispatchConditional(){if(wi(this.shared,this.condition)===!1)return!1;this.interaction instanceof iE?this.interaction.play():this.interaction.dispatch()}dispose(){this.interaction.dispose()}};Bi(),ke(),Dr("Video",({id:t,data:e,object:i,shared:n,actionCondition:r})=>os(i)?null:new tnt(t,e,i,n,r)),Si("video"),ti(),tt(),Cp();var nE=(()=>{let t,e,i,n,r=!1;function s(l){!t&&!jU()&&(e?.sharedGameControlGlobals.createdObjects.length??0)>0&&(t=requestAnimationFrame(a)),l&&(e=l,n=l.requestRender,!r&&typeof document<"u"&&(document.addEventListener("visibilitychange",o),r=!0))}function a(l){if(!e||!n)return t=void 0,void(i=void 0);let c=i?l-i:0,h=e.sharedGameControlGlobals.createdObjects,d=e.sharedGameControlGlobals.nCreatedPerAction,u=h.length,p=0;for(;p<u;){let f=h[p];f.userData.createdTime===void 0&&(f.userData.createdTime=l),f.userData.lifetime===void 0&&f.userData.quantity===void 0||f.userData.lifetime&&l-f.userData.createdTime<f.userData.lifetime||f.userData.quantity&&d[f.userData.actionId]<=f.userData.quantity?(f.userData.velocity&&(f.position.addScaledVector(f.userData.velocity,c/1e3),f.updateMatrix(),n()),p++):(d[f.userData.actionId]>f.userData.quantity&&d[f.userData.actionId]--,h.splice(p,1),f.removeFromParent(),e.sharedGameControlGlobals.rapierWorld&&f.rigidBody?(e.sharedGameControlGlobals.colliderToEntity.delete(f.rigidBody.collider(0).handle),e.sharedGameControlGlobals.rapierWorld.removeRigidBody(f.rigidBody)):(f.bvhGeometry=void 0,e.sharedGameControlGlobals.entitiesWithTransformAnim=e.sharedGameControlGlobals.entitiesWithTransformAnim.filter(g=>g.bvhGeometry!==void 0)),u--,n())}t=p>0?requestAnimationFrame(a):void 0,i=p>0?l:void 0}function o(){jU()?t&&(cancelAnimationFrame(t),t=void 0,i=void 0):s()}return{play:s,dispose:function(){t&&(cancelAnimationFrame(t),t=void 0),r&&typeof document<"u"&&(document.removeEventListener("visibilitychange",o),r=!1),e=void 0,n=void 0,i=void 0}}})();function jU(){return!!document&&document.hidden}var GU=new Wt,ent=new T,int=new T,nnt=class{constructor(t,e,i,n,r){this.data=t,this.page=e,this.controlsManager=i,this.shared=n,this.condition=r,this.intervalId=null,this.timeoutIdQueue=[],this.uniqueId=Ot.generateUUID(),this.dispatch=()=>{if(wi(this.shared,this.condition)===!1)return!1;this.data.delay?this.timeoutIdQueue.push(window.setTimeout(this.dispatchInner,1e3*this.data.delay)):this.dispatchInner()},this.dispatchFromStart=()=>{if(wi(this.shared,this.condition)===!1)return!1;this.timeoutIdQueue.push(window.setTimeout(this.dispatchInner,1e3*this.data.delay))},this.dispatchThrottled=function(a,o=0,l={}){return Vg(a,o,{leading:l.leading!==!1,trailing:l.trailing!==!1,maxWait:o})}(this.dispatch,1e3/this.data.creationSpeed),this.dispatchStart=()=>{this.intervalId===null&&(this.intervalId=window.setInterval(this.dispatch,1e3/this.data.creationSpeed))},this.dispatchStop=()=>{this.intervalId!==null&&(window.clearInterval(this.intervalId),this.intervalId=null)},this.dispatchInner=()=>{this.timeoutIdQueue.shift();let a=new _s(this.object);if(a.playModeVisible=!0,a.expand(),this.data.coordinateSystem!=="world"){let l=this.data.coordinateSystem,c=this.page.scene.find(l);c&&(c.updateMatrixWorldRigid(),a.hiddenMatrix.copy(c.matrixWorldRigid))}a.scale.copy(this.object.scale),a.position.fromArray(this.data.position.map(l=>typeof l=="number"?l:0)),a.rotation.fromArray(this.data.rotation.map(l=>typeof l=="number"?l:0)),a.updateMatrix(),this.page.add(a);let o=this.controlsManager.sharedGameControlGlobals;o.createdObjects.push(a),o.nCreatedPerAction[this.uniqueId]===void 0?o.nCreatedPerAction[this.uniqueId]=1:o.nCreatedPerAction[this.uniqueId]++,a.updateWorldMatrix(!0,!0),a.traverseObject(this.traverseObjectCB),nE.play(),this.controlsManager.requestRender()},this.traverseObjectCB=a=>{let o;if(a.hasNonUniformScale&&a.updateMatrixWorldRigid(),this.controlsManager.sharedGameControlGlobals.rapierWorld){if(a instanceof jc){if(!a.objectForSample)return a.object.dataPatched.physics.fusedBody===!0&&a.object.dataPatched.physics.rigidBody==="dynamic"||void 0;if(a.objectForSample.dataPatched.physics.fusedBody)return;o=a.object}else if(a instanceof _s)o=a.object;else if(o=a,o.dataPatched.cloner?.hideBase)return!0}else{if(a instanceof jc)return;o=a instanceof _s?a.object:a}this.data.destroy==="Time"?a.userData.lifetime=1e3*this.data.lifetime:this.data.destroy==="Quantity"&&(a.userData.quantity=this.data.destroyAfterQuantity,a.userData.actionId=this.uniqueId);let l=new T().fromArray(this.data.velocity.map(h=>typeof h=="number"?h:0)),c=o.dataPatched;if(!(c.physics.enabled==="visibility"?!c.visible:!c.physics.enabled)&&(this.controlsManager.sharedGameControlGlobals.rapierWorld?(this.controlsManager.addRigidBody(a,o,{fromCreate:!0,dynamic:this.data.dynamic}),this.data.destroy==="Collision"&&(a.rigidBody?.collider(0).setActiveEvents(1),a.userData.hasCollisionDestroy=!0),a.matrixWorld.decompose(ent,GU,int),l.applyQuaternion(GU),this.data.velocity.some(h=>h!==0)&&this.data.dynamic&&a.rigidBody?.setLinvel(l.divideScalar(this.controlsManager.pixelsPerMeter),!0)):("geometry"in a.object&&this.controlsManager.addBoundsTree(a),this.data.velocity.some(h=>h!==0)&&this.data.dynamic&&(a.userData.velocity=l)),o.dataPatched.physics?.fusedBody===!0))return!0};let s=this.page.scene.find(this.data.object);if(!s)throw new Error("Missing Property");if(this.object=s,this.data.coordinateSystem!=="world"&&!this.page.scene.find(this.data.coordinateSystem))throw new Error("Missing Property");nE.play(i)}dispose(){this.intervalId!==null&&(window.clearInterval(this.intervalId),this.intervalId=null),this.timeoutIdQueue.forEach(t=>window.clearTimeout(t)),this.timeoutIdQueue=[],this.dispatchThrottled.cancel(),this.page.remove(...this.controlsManager.sharedGameControlGlobals.createdObjects),this.controlsManager.sharedGameControlGlobals.createdObjects=[],nE.dispose()}},rnt=class{constructor(t,e,i,n,r){this.data=t,this.page=e,this.controlsManager=i,this.shared=n,this.condition=r,this.timeoutIdQueue=[],this.dispatchInner=()=>{this.objects.forEach(this.destroyCallback)},this.destroyCallback=s=>{this.timeoutIdQueue.shift();let a=this.page.scene.find(s);if(a===void 0)return;let o=this.controlsManager.sharedGameControlGlobals.rapierWorld,l=!o||a.dataPatched.physics?.fusedBody;if(a.cloner){for(let c of a.cloner.children)l?(c.playModeVisible=!1,a.dataPatched.physics?.rigidBody==="positioned"&&this.removeBody(c),c.bvhGeometry&&(c.bvhGeometry=void 0)):this.clone===void 0||this.clone===c?(c.playModeVisible=!1,this.removeBody(c)):c.playModeVisible===void 0&&(c.playModeVisible=!0);a.cloner.syncInstanceMatrices(),(l||this.clone===void 0||this.clone===!1)&&(a.visible=!1,this.removeBody(a),a.bvhGeometry&&(a.bvhGeometry=void 0))}else this.removeBody(a),a.bvhGeometry&&(a.bvhGeometry=void 0),a.visible=!1;this.controlsManager.sharedGameControlGlobals.entitiesWithTransformAnim=o===void 0?this.controlsManager.sharedGameControlGlobals.entitiesWithTransformAnim.filter(c=>c.bvhGeometry!==void 0):this.controlsManager.sharedGameControlGlobals.entitiesWithTransformAnim.filter(c=>c.rigidBody!==void 0),a.destroyedInAction=!0,this.controlsManager.requestRender()},this.objects=[...t.objects]}removeBody(t){let e=t.rigidBody;if(!e)return;let i=this.controlsManager.sharedGameControlGlobals;i.colliderToEntity.delete(e.collider(0).handle),i.kinematicBodyToEntity.delete(e.handle);let n=this.controlsManager;n.fixedBodiesToWatch=n.fixedBodiesToWatch.filter(([,r])=>r!==e),i.rapierWorld.removeRigidBody(e),t.rigidBody=void 0}dispatch(t){if(wi(this.shared,this.condition)===!1)return!1;this.clone=t,this.data.delay?this.timeoutIdQueue.push(window.setTimeout(this.dispatchInner,1e3*this.data.delay)):this.dispatchInner()}dispatchFromStart(){if(wi(this.shared,this.condition)===!1)return!1;this.timeoutIdQueue.push(window.setTimeout(this.dispatchInner,1e3*this.data.delay))}dispose(){this.timeoutIdQueue.forEach(t=>window.clearTimeout(t))}};ke(),Dr("Create",({data:t,page:e,eventManager:i,shared:n,actionCondition:r})=>new nnt(t,e,i.controlsManager,n,r)),Dr("Destroy",({data:t,page:e,eventManager:i,shared:n,actionCondition:r})=>new rnt(t,e,i.controlsManager,n,r)),Si("create-destroy"),$t(),$t(),qr(),tt(),Ws(),Xr(),Bi();var HU=new T;function bP(t,e,i=!1){let n=[],r=s=>{let a=s.data;delete s.states,s.currentState=null,s.reversibleToState=null,s.currentTransitionEvent=null;for(let o of a.states){let l={...o.data};s.states||(s.states={}),s.states[o.id]=Ac.patch(a,l)}qU(t.scene,s,null,e,a.events.find(o=>o.data.type==="Follow"||o.data.type==="LookAt")!==void 0),WU(t)};t.scene.traverse2D(r),t.traverseChildren(s=>{if(i&&(s.rigidBody?.setTranslation(s.position0,!0),s.rigidBody?.setRotation(s.rotation0,!0),s.rigidBody?.setLinvel(HU,!0),s.rigidBody?.setAngvel(HU,!0)),!Be.is(s))return;let a=s.uuid,o=s.data;if(delete s.states,s.uuid===ed)return;let l=!1;n.some(c=>t.scene.find(a)?.isDescendantOf(c))?l=!0:o.physics?.fusedBody===!0&&o.physics.rigidBody==="dynamic"&&n.push(a),s.data=o,s.currentState=null,s.reversibleToState=null,s.currentTransitionEvent=null,s.transitionState={settled:!0,state:null};for(let c of o.states){let h={...c.data};t.data.globalPhysics.usePhysics===!0&&o.physics&&(o.physics.rigidBody==="dynamic"||l)&&(c.data.position!==void 0&&delete h.position,c.data.rotation!==void 0&&delete h.rotation,c.data.hiddenMatrix!==void 0&&delete h.hiddenMatrix),s.states||(s.states={}),s.states[c.id]=ih.patch(o,h)}qU(t.scene,s,null,e,o.events.find(c=>c.data.type==="Follow"||c.data.type==="LookAt")!==void 0),Pr(s)&&s.frame&&(s.frame.traverse(c=>r(c)),s.uiCanvas?.applySize())}),WU(t),t.frame&&(t.frame.traverse(s=>r(s)),t.uiCanvas?.applySize())}function WU(t){t.traverseEntity(e=>{for(let i of e.data.events){let n=[];switch(i.data.type){case"Follow":case"MouseHover":case"Scroll":case"MouseDown":case"MouseUp":case"MousePress":case"KeyUp":case"KeyDown":case"KeyPress":case"Collision":n.push(...i.data.actions);break;case"GameControl":for(let r of Object.values(i.data.gameActions))n.push(...r);break;case"DragDrop":n.push(...i.data.dragDropActions.drag,...i.data.dragDropActions.drop);break;case"Conditional":n.push(...i.data.inActions,...i.data.outActions)}for(let r of n)if(r.data.type==="Create"&&r.data.hideBase==="Yes"){let s=t.scene.find(r.data.object);s&&(s.visible=!1)}}})}function qU(t,e,i,n,r=!1){if(t.markShadowsDirty(),e instanceof Ai&&!ll(e)&&e.removeInteractionGeometry(n),os(e)?e.changeSelectedState(i,{shared:n},r):e.changeSelectedState(i,{scene:t,shared:n},r),e instanceof Ai&&e.updateGeometryGroupsIfNeeded(),e instanceof Zi&&e.updateCameraState(e.dataPatched,{scene:t,shared:n}),!os(e)){if(e.cloner){let s=!1;for(let a of e.cloner.children)a.playModeVisible=void 0,a.transformOverride!==void 0&&(a.transformOverride=void 0,s=!0);s&&t.addPendingUpdateCloner(e),e.cloner.syncInstanceMatrices()}e.updateVisible()}}var snt=class{constructor(t,e,i,n,r){this.data=t,this.page=e,this.eventManager=i,this.shared=n,this.condition=r,this.timeOutId=-1,this.scene=e.scene}dispatch(){if(wi(this.shared,this.condition)===!1)return!1;this.data.target!==this.page.uuid&&(window.clearTimeout(this.timeOutId),this.timeOutId=window.setTimeout(()=>{this.play()},1e3*this.data.delay))}dispose(){window.clearTimeout(this.timeOutId)}play(){if(this.scene.children.every(e=>e.uuid!==this.data.target||e.data.uiScene))return;this.data.transition==="fade"&&this.data.duration>0&&this.eventManager.eventContext.renderer.renderFromSceneForSceneTransitionPass(this.scene,this.scene.activeCamera,1e3*this.data.duration),this.eventManager.deactivate(),this.eventManager.controlsManager.deactivate();let t=this.scene.activeCamera;this.scene.updatePage(this.data.target),this.scene.traverseVisibleEntity(e=>{e.type==="ParticleSystem"&&(e.sleep(),e.wakeUp(),e.data.autoPlay?e.start():e.stop())}),this.scene.activePage.switchToPlayCamera(),this.scene.activeCamera.copyViewPlaneSize(t),bP(this.scene.activePage,this.shared),this.eventManager.activate(),this.eventManager.controlsManager.activate(this.eventManager)}};function ant(t){return{easing:t.type,control1:Fc(t.cubicControls?.control1,[0,0]),control2:Fc(t.cubicControls?.control2,[1,1]),...t.springParameters}}function gu(t,e){let i=[];for(let n of t??[]){let r=e(n.data);r!==void 0&&i.push({time:n.data.time,ease:ant(n.data.easing),value:r})}return{keyframes:Xet(i)}}function ja(t,e){if(t.keyframes.length===0)return;let{index0:i,index1:n,t:r}=function(o,l){if(o.length===0)throw new Error("sampleKeyframes requires at least one keyframe");if(l<=o[0].time)return{index0:0,index1:0,t:1};let{found:c,index:h}=function(m,v){let y=m.length,_=0,b=y;for(;_<b;){let x=_+Math.floor(y/2),w=m[x].time;if(w<v)_=x+1;else{if(!(w>v))return{found:!0,index:x};b=x}y=b-_}return{found:!1,index:_}}(o,l);if(c)return{index0:h,index1:h,t:1};if(h>=o.length){let m=o.length-1;return{index0:m,index1:m,t:1}}let d=h-1,u=h,p=o[d].time,f=o[u].time;if(f===p)return{index0:d,index1:u,t:.5};let g=XM(f-p);return{index0:d,index1:u,t:y9({...o[d].ease,control2:o[u].ease.control2},g,XM(XM(l-p)/g))}}(t.keyframes,e),s=t.read;if(s&&s.index0===i&&s.index1===n&&s.t===r)return;let a={index0:i,index1:n,from:t.keyframes[i].value,to:t.keyframes[n].value,t:r};return t.read=a,a}function ont(t){t.read=void 0}function Zy(t,e,i){return t+(e-t)*i}ke(),Dr("SceneTransition",({data:t,page:e,eventManager:i,shared:n,actionCondition:r})=>new snt(t,e,i,n,r)),Si("scene-transition"),$t(),tt(),$t(),$t(),tt(),Kn(),Ws(),z3(),j6(),V3(),Xr(),Bi(),hl(),I6(),$t(),ti(),tt(),_a();var{degToRad:urt,radToDeg:prt}=Ot,XU=new T,$U=new T,YU=new Wt;function fr(t,e,i,n,r,s){let a=i[t]!==void 0?i[t]:void 0,o=n[t];if(o==null)return;let l=a!=null?typeof a=="string"?Number(r.getVariable(a)??0):a:e[t],c=typeof o=="string"?Number(r.getVariable(o)??0):o;return l!==c?{update:h=>{let d=Ot.lerp(l,c,h);e[t]=s?Math.trunc(d):d},start:()=>{e[t]=l},end:()=>{e[t]=c}}:void 0}function _C(t,e,i,n,r,s){let a=i[t]?i[t]:void 0,o=n[t];if(!o)return;let l=e[t],c=[...a??l].map(d=>typeof d=="string"?Number(r.getVariable(d)??0):d),h=[...o].map(d=>typeof d=="string"?Number(r.getVariable(d)??0):d);return c.length!==h.length||Uc(c,h)?void 0:{update:d=>{c.forEach((u,p)=>{let f=Ot.lerp(u,h[p],d);e[t][p]=s?Math.trunc(f):f})},start:()=>{Object.assign(e[t],c)},end:()=>{Object.assign(e[t],h)}}}function qb(t,e,i){return e.forEach((n,r)=>{t.setComponent(r,typeof n=="string"?Number(i.getVariable(n)??0):n)}),t}function ZU(t,e,i,n,r){let s=i[t]?i[t]:void 0,a=n[t];if(!a)return;let o=e[t],l=s?qb(new T,s,r):o.clone(),c=qb(new T,a,r);return l.equals(c)?void 0:{update:h=>{o.lerpVectors(l,c,h)},start:()=>{o.copy(l)},end:()=>{o.copy(c)}}}function KU(t,e,i){return e.forEach((n,r)=>{t.setComponent(r,typeof n=="string"?Number(i.getVariable(n)??0):n)}),t}function Ky(t,e,i,n,r){let s=i[t]?i[t]:void 0,a=n[t];if(!a)return;let o=e[t],l=!(o instanceof et),c=o instanceof et?o:new et().fromArray(o),h=s?KU(new et,s,r):c.clone(),d=KU(new et,a,r);return h.equals(d)?void 0:{update:u=>{c.lerpVectors(h,d,u),l&&(e[t]=c.toArray())},start:()=>{c.copy(h),l&&(e[t]=c.toArray())},end:()=>{c.copy(d),l&&(e[t]=c.toArray())}}}function Qy(t,e,i,n,r){let s=i[t]?i[t]:void 0,a=n[t];if(!a)return;let o=e[t],l=new yn(o.r,o.g,o.b,o.a),c=s?typeof s=="string"?r.getColor(s).clone():new yn(s.r,s.g,s.b,s.a):l.clone(),h=typeof a=="string"?r.getColor(a).clone():new yn(a.r,a.g,a.b,a.a);return c.equals(h)?void 0:{update:d=>{l.lerpColors(c,h,d);let u=Ot.lerp(c.a,h.a,d);l.a=u,e[t]={r:l.r,g:l.g,b:l.b,a:l.a}},start:()=>{l.copy(c)},end:()=>{l.copy(h)}}}function Fl(t,e,i,n,r){return typeof e[t]=="number"?fr(t,e,i??{},n,r):Array.isArray(e[t])?_C(t,e,i??{},n,r):void 0}function lnt(t,e){if(t)for(let[i,n]of Object.entries(e)){let r=t[i];if(Array.isArray(r)&&Array.isArray(n)){let s=Math.min(r.length,n.length);for(let a=0;a<s;a++)r[a]=n[a]}else t[i]=n}}function Jy(t,e,i,n){let r={};if(!e||!i)return r;for(let s of t){let a=e[s],o=i[s];if(typeof a=="number"&&typeof o=="number")r[s]=Ot.lerp(a,o,n);else if(Array.isArray(a)&&Array.isArray(o)){let l=Math.min(a.length,o.length);r[s]=Array.from({length:l},(c,h)=>Ot.lerp(a[h],o[h],n))}}return r}new xi;var QU=[["radial",q_],["linear",X_],["grid",$_],["toObject",Y_],["randomnessObject",Z_]];function T9(t,e,i,n,r){let s=t.getValue(n);if(s!==void 0){if(n==="colors")return function(a,o,l,c="colors"){if(!a.hasValue(c)||!(c in l))return;let h=[],d=a.getValue(c),u=o?o[c]:d.map(f=>f.toArray()),p=l[c];for(let f=0;f<d.length;++f){let g=[...u[f]],m=[...p[f]];Gg.isEqual(g,m)||h.push({update:v=>{d[f].fromArray(Gg.lerp(g,m,v))},start:()=>{d[f].fromArray(g)},end:()=>{d[f].fromArray(m)}})}return h.length?h:void 0}(t,e,i,n);if(Array.isArray(s))return n==="steps"?function(a,o,l,c="steps"){if(!a.hasValue(c)||!(c in l))return;let h=[],d=a.getValue(c),u=o?o[c]:d,p=l[c];return Uc(u,p)||h.push({update:f=>{let g=[...d];for(let m=0;m<d.length;++m){let v=u[m],y=p[m];g[m]=Ot.lerp(v,y,f)}a.setValue(c,g)},start:()=>{a.setValue(c,u)},end:()=>{a.setValue(c,p)}}),h.length?h:void 0}(t,e,i,n):void 0;if(typeof s=="number")return function(a,o,l,c,h){if(!a.hasValue(c)||!(c in l))return;let d=o?o[c]:a.getValue(c),u=l[c],p=typeof d=="string"?Number(h.getVariable(d)??0):d,f=typeof u=="string"?Number(h.getVariable(u)??0):u;return{update:g=>{a.setValue(c,Ot.lerp(p,f,g))},start:()=>{a.setValue(c,p)},end:()=>{a.setValue(c,f)}}}(t,e,i,n,r);if(typeof s!="boolean"){if(s instanceof et)return function(a,o,l,c){if(!a.hasValue(c)||!(c in l))return;let h=a.getValue(c),d=o?new et().fromArray(o[c]):h.clone(),u=new et().fromArray(l[c]);return d.equals(u)?void 0:{update:p=>{h.lerpVectors(d,u,p)},start:()=>{h.copy(d)},end:()=>{h.copy(u)}}}(t,e,i,n);if(s instanceof T)return function(a,o,l,c,h){if(!a.hasValue(c)||!(c in l))return;let d=a.getValue(c),u=o?o[c]:void 0,p=l[c],f=u?qb(new T,u,h):d.clone(),g=qb(new T,p,h);return f.equals(g)?void 0:{update:m=>{d.lerpVectors(f,g,m)},start:()=>{d.copy(f)},end:()=>{d.copy(g)}}}(t,e,i,n,r);if(s instanceof yn)return function(a,o,l,c,h){if(!a.hasValue(c)||!(c in l))return;let d=o?o[c]:void 0,u=l[c],p=a.getValue(c),f=d?typeof d=="string"?h.color(d).clone():new Jt().setRGB(d.r,d.g,d.b):p.clone(),g=typeof u=="string"?h.color(u).clone():new yn(u.r,u.g,u.b,u.a);if(f.equals(g))return;let m=p.clone();return{update:v=>{a.getValue(c)!==m&&a.setValue(c,m),m.lerpColors(f,g,v)},start:()=>{m.copy(f)},end:()=>{m.copy(g)}}}(t,e,i,n,r);if(s instanceof Jt)return function(a,o,l,c,h){if(!a.hasValue(c)||!(c in l))return;let d=o?o[c]:void 0,u=l[c],p=a.getValue(c),f=d?typeof d=="string"?h.color(d).clone():new Jt().setRGB(d.r,d.g,d.b):p.clone(),g=typeof u=="string"?h.color(u).clone():new Jt().setRGB(u.r,u.g,u.b);if(f.equals(g))return;let m=p.clone();return{update:v=>{a.getValue(c)!==m&&a.setValue(c,m),m.lerpColors(f,g,v)},start:()=>{m.copy(f)},end:()=>{m.copy(g)}}}(t,e,i,n,r);if("isTexture"in s)return function(a,o,l,c="texture",h){if(!a.hasValue(c)||!(c in l))return;let d=E=>Number(typeof E=="string"?h?.getVariable(E)??0:E??0),u=a.getNode("rotation"),p=o?d(o[c]?.rotation):(u?.value??0)*Ot.RAD2DEG,f=d(l[c]?.rotation);if(u&&Math.abs(p-f)>1e-9)return{update:E=>{u.value=Ot.lerp(p,f,E)*Ot.DEG2RAD},start:()=>{u.value=p*Ot.DEG2RAD},end:()=>{u.value=f*Ot.DEG2RAD}};let g=function(E){let A=E.getNode("mat");if(typeof A?.updateMatrix=="function")return A;let P=E.getValue("mat");return typeof P?.updateMatrix=="function"?P:void 0}(a);if(!g)return;let m=o?o[c]:g,v=l[c],y=[...m.repeat],_=[...m.offset],b=[...v.repeat],x=[...v.offset],w=m.rotation??0,S=v.rotation??0;return to.isEqual(y,b)&&to.isEqual(_,x)&&w===S?void 0:{update:E=>{g.repeat=to.lerp(y,b,E),g.offset=to.lerp(_,x,E),g.rotation=Ot.lerp(w,S,E),g.updateMatrix()},start:()=>{g.repeat=[...y],g.offset=[..._],g.rotation=w,g.updateMatrix()},end:()=>{g.repeat=[...b],g.offset=[...x],g.rotation=S,g.updateMatrix()}}}(t,e,i,n,r)}}}function JU(t,e,i,n){let r=[],s=Oc(i,n)||!!e.layers&&Oc(e,n);r.push(function(a,o){return{update:()=>{a.setTransparent(o)}}}(t,s)),function(a,o,l){let c=a.ensureRainbowNoiseCompiled;if(typeof c=="function")for(let h of[...a.layers]){if(h.type!=="rainbow")continue;let d=o.layers?.data(h.uuid),u=l.layers.data(h.uuid);(vp(d?.noiseStrength)||vp(u?.noiseStrength))&&c.call(a,h.uuid)}}(t,e,i);for(let a of t.layers){let o=e.layers?.data(a.uuid),l=i.layers.data(a.uuid);if(!l||a.type!=="light"&&(!(a.visible??1)||!(l.visible??1)))continue;let c=Ex[a.type]??[],h=a.getNames().filter(d=>!c.includes(d)&&!hx.some(u=>d.includes(u)));for(let d of h)try{let u=T9(a,o,l,d,n);u&&(Array.isArray(u)?r.push(...u):r.push(u))}catch(u){console.error(`lerpMaterial: unexpected material layer for ${d}`,u)}}return r}function tz(t,e,i,n,r,s){let a=T9(e,i,n,t,s);!a||(Array.isArray(a)?a.forEach(o=>o.update(r)):a.update(r))}function Fo(t,e,i){!t||(t[e]={...t[e],...i})}function hnt(t,e,i,n,r,s,a){let o=()=>{a.transform=!0,a.bounds=!0,a.boolean=!0,a.render=!0};switch(t.on){case"position":case"scale":{let l=ja(t.track,i);if(!l)return;let c=Zy(l.from,l.to,l.t);return e[t.on][t.axis]=c,Fo(s,t.on,{[t.axis]:c}),void o()}case"rotation":{let l=ja(t.track,i);if(!l)return;let c=Zy(l.from,l.to,l.t);return e.rotation[t.axis]=c*Ot.DEG2RAD,Fo(s,"rotation",{[t.axis]:c}),void o()}case"shapeSize":{let l=ja(t.track,i);if(!(l&&e instanceof Ai))return;let c=Zy(l.from,l.to,l.t);return e.userData.value={...e.userData.value,[t.axis]:c},Fo(s,"shapeSize",{[t.axis]:c}),a.size=!0,a.bounds=!0,a.boolean=!0,void(a.render=!0)}case"opacity":{let l=ja(t.track,i);if(!l||!(e instanceof Yi)||Array.isArray(e.material))return;let c=e.material.getLayersOfType("light")[0];if(c===void 0)return;let h=Ot.lerp(l.from,l.to,l.t);return e.material.transparent=!0,tz("alphaOverride",c,{alphaOverride:h},{alphaOverride:h+1},0,n.shared),s&&(s.opacity=h),void(a.render=!0)}case"material":{let l=ja(t.track,i);if(!l||Object.keys(l.from).length===0||Object.keys(l.to).length===0)return;let{layer:c}=t,h={};for(let d in c.data){if(!(d in l.from)||!(d in l.to))continue;let u=bC(l.from[d],l.to[d],l.t,r);if(u===void 0)continue;h[d]=u;let p=c.getValue(d);p!==void 0&&(d==="alpha"&&typeof p=="number"&&p>0&&e instanceof Yi&&!Array.isArray(e.material)&&(e.material.transparent=!0),tz(d,c,l.from,l.to,l.t,n.shared))}return Fo(s,"material",{[c.uuid]:h}),void(a.render=!0)}case"light":{let l=ja(t.track,i);if(!l||!(e instanceof p0||e instanceof Px||e instanceof f0))return;let c=bC(l.from,l.to,l.t,r);return e[t.field]=c,Fo(s,"light",{[t.field]:c}),void(a.render=!0)}case"camera":{let l=ja(t.track,i);if(!(l&&e instanceof Zi))return;let c=Zy(l.from,l.to,l.t);return e[t.field]=c,void Fo(s,"camera",{[t.field]:c})}case"cloner":{let l=ja(t.track,i);if(!l)return;let c=e.cloner?.parameters,h=function(d,u,p,f){if(!d)return{};let g=Jy(["count"],u,p,f);g.count!==void 0&&(g.count=Math.trunc(g.count));for(let[m,v]of QU){if(!d[m])continue;let y=Jy(v,u[m],p[m],f);Object.keys(y).length&&(g[m]=y)}return g}(c,l.from,l.to,l.t);return function(d,u){if(d){u.count!==void 0&&(d.count=u.count);for(let[p]of QU){let f=u[p];f&&lnt(d[p],f)}}}(c,h),Fo(s,"cloner",h),a.cloner=!0,a.boolean=!0,void(a.render=!0)}case"pathExtrusion":{let l=ja(t.track,i);if(!l||!fx(e))return;let c=Jy(eb,l.from,l.to,l.t),h=e.geometry.userData.parameters;return h.extrusion={...h.extrusion,...c},Fo(s,"pathExtrusion",c),e.updateGeometryInteractions({extrusion:{...h.extrusion}},n.shared),a.bounds=!0,a.boolean=!0,void(a.render=!0)}case"pathSnapping":{let l=ja(t.track,i);if(!l)return;let c=e,h=Jy(MN,l.from,l.to,l.t);return c.userData.pathSnapping={...c.userData.pathSnapping,...h},Fo(s,"pathSnapping",h),c.updatePathSnapping(c.userData.pathSnapping),void(a.render=!0)}}}function bC(t,e,i,n){if(typeof t=="string"&&n&&(t=n.color(t)),typeof e=="string"&&n&&(e=n.color(e)),typeof t=="number")return Ot.lerp(t,e,i);if(Je.is(t))return Je.lerp(t,e,i);if(Tn.is(t))return Tn.lerp(t,e,i);if(Array.isArray(t))return(t.length>e.length?e:t).map((r,s)=>{if(Array.isArray(r)){let a=t[s].length>e[s].length?e[s].length:t[s].length;return(a===4?Gg:a===3?dh:to).lerp(t[s],e[s],i)}return Ot.lerp(t[s],e[s],i)});if(typeof t=="object"&&t!==null){let r={};for(let s in t){let a=bC(t[s],e[s],i,n);a!==void 0&&(r[s]=a)}return r}}$t(),tt(),_a(),R3(),hl(),ti(),ti(),Bi(),$t(),Ws(),Bi(),Kn(),Ws(),u0(),Xr(),rd(),tt(),$t(),tt(),m0(),Bi(),ti(),Bi(),tt(),Eh(),tt();var rE=new T,ez=new xi;function cnt(t,e,i,n,r){let s=[];return t.data.visible&&s.push(...function(a,o,l,c,h){let d,u,p,f,g,m,v,y,_=[];if(os(a)?(d=Ky("position",a,o,l,h),d&&_.push(d),p=fr("rotation",a,o,l,h),p&&_.push(p),f=Ky("shear",a,o,l,h),f&&_.push(f)):(y={slide:o.pathSnapping?.slide??a.updatedPathSnapping?.slide??a.dataPatched.pathSnapping?.slide??0,offset:o.pathSnapping?.offset??a.updatedPathSnapping?.offset??a.dataPatched.pathSnapping?.offset??0},m=fr("slide",y,o.pathSnapping??a.updatedPathSnapping??a.dataPatched.pathSnapping,l.pathSnapping??a.dataPatched.pathSnapping,h),m&&_.push(m),v=fr("offset",y,o.pathSnapping??a.updatedPathSnapping??a.dataPatched.pathSnapping,l.pathSnapping??a.dataPatched.pathSnapping,h),v&&_.push(v),!m&&!v&&(d=ZU("position",a,o,l,h),d&&_.push(d),u=ZU("scale",a,o,l,h),u&&_.push(u),p=function(b,x,w,S,E){let A=x?.rotation?x.rotation.map(D=>(typeof D=="string"?Number(E.getVariable(D)??0):D)*Ot.DEG2RAD):void 0,P=w.rotation?.map(D=>(typeof D=="string"?Number(E.getVariable(D)??0):D)*Ot.DEG2RAD);if(!P)return;let C=A?new T().fromArray(A):new T().setFromEuler(b.rotation),R=new T().fromArray(P);if(C.equals(R))return;let L=rE.subVectors(R,C);if(S&&L.toArray().every(D=>Math.abs(D)<2*Math.PI)){let D=new Wt().setFromEuler(ez.setFromVector3(C)),F=new Wt().setFromEuler(ez.setFromVector3(R));return{update:V=>{(function(U,j,W,it){if(it===0)return W.copy(U);if(it===1)return W.copy(j);let nt=U.w*j.w+U.x*j.x+U.y*j.y+U.z*j.z;if(nt>=1)return W.copy(U);let Y=1-nt*nt;if(Y<=Number.EPSILON){let J=1-it;return W.w=J*U.w+it*j.w,W.x=J*U.x+it*j.x,W.y=J*U.y+it*j.y,W.z=J*U.z+it*j.z,W.normalize(),W}let ot=Math.sqrt(Y),ht=Math.atan2(ot,nt),ft=Math.sin((1-it)*ht)/ot,pt=Math.sin(it*ht)/ot;W.w=U.w*ft+j.w*pt,W.x=U.x*ft+j.x*pt,W.y=U.y*ft+j.y*pt,W.z=U.z*ft+j.z*pt})(D,F,b.quaternion,V)},start:()=>{b.rotation.setFromVector3(C)},end:()=>{b.rotation.setFromVector3(R)}}}return{update:D=>{rE.lerpVectors(C,R,D),b.rotation.setFromVector3(rE)},start:()=>{b.rotation.setFromVector3(C)},end:()=>{b.rotation.setFromVector3(R)}}}(a,o,l,c,h),p&&_.push(p),g=function(b,x,w,S){let E=w[b]?w[b]:void 0,A=S[b];if(!A)return;let P=x[b],C=E?new At().fromArray(E):P.clone(),R=new T,L=new Wt,D=new T;C.decompose(R,L,D);let F=new At().fromArray(A),V=new T,U=new Wt,j=new T;return F.decompose(V,U,j),C.equals(F)?void 0:{update:W=>{YU.slerpQuaternions(L,U,W),XU.lerpVectors(R,V,W),$U.lerpVectors(D,j,W),P.compose(XU,YU,$U)},start:()=>{P.compose(R,L,D)},end:()=>{P.compose(V,U,j)}}}("hiddenMatrix",a,o,l),g&&_.push(g))),d||u||p||g||m||v){let b=os(a)?()=>{a.updateWorldMatrix(!0,!1,!0),a.resetBBoxNeedsUpdate()}:()=>{a.updateMatrix(),a.hasNonUniformScale&&(a.updateMatrixWorld(),a.updateMatrixWorldRigid()),a.parent?.matrixWorldFusedFalse&&(a.matrixWorld.multiplyMatrices(a.parent.matrixWorldFusedFalse,a.matrix),a.matrixWorldNeedsUpdate=!1),fa(a)&&eo(a.parent)&&a.invalidateDownstreamBooleanData(!0),a.updatePathSnapping(Object.assign({},o.pathSnapping,y))};_.push({update:b,start:b,end:b})}return _}(t,e,i,r,n.shared)),os(t)?s.push(...function(a,o,l,c,h){let d,u,p,f,g,m,v,y,_,b,x,w,S,E,A,P=[];if("width"in a&&(d=fr("width",a,o,l,h),d&&P.push(d)),"height"in a&&(u=fr("height",a,o,l,h),u&&P.push(u)),a instanceof Jn||a instanceof ao){let C={...o.fill},R={...l.fill};C.enabled!==void 0&&C.enabled!==R.enabled&&(P.push(function(L){return{update:()=>{L instanceof Jn&&(L.fill.enabled=!0)}}}(a)),C.enabled||Object.assign(C,{enabled:!0,color:{...C.color,a:0}}),R.enabled||Object.assign(R,{enabled:!0,color:{...R.color,a:0}})),p=Qy("color",a.fill,C,R,h),p&&P.push(p)}if(a instanceof Jn){let C={...o.stroke},R={...l.stroke};(C.enabled||R.enabled)&&(P.push(function(L){return{update:()=>{L instanceof Jn&&(L.stroke.enabled=!0)}}}(a)),C.enabled||Object.assign(C,{enabled:!0,color:{...C.color,a:0}}),R.enabled||Object.assign(R,{enabled:!0,color:{...R.color,a:0}})),f=Qy("color",a.stroke,C,R,h),f&&P.push(f),g=fr("thickness",a.stroke,C,R,h),g&&P.push(g)}if(a instanceof Jn){let C={...o.dropShadow},R={...l.dropShadow};(C.enabled||R.enabled)&&(P.push(function(L){return{update:()=>{L instanceof Jn&&(L.dropShadow.enabled=!0)}}}(a)),C.enabled||Object.assign(C,{enabled:!0,color:{...C.color,a:0}}),R.enabled||Object.assign(R,{enabled:!0,color:{...R.color,a:0}})),m=Qy("color",a.dropShadow,C,R,h),m&&P.push(m),v=fr("blurRadius",a.dropShadow,C,R,h),v&&P.push(v),_=fr("spread",a.dropShadow,C,R,h),_&&P.push(_),y=Ky("offset",a.dropShadow,C,R,h),y&&P.push(y)}if(a instanceof Jn){let C={...o.innerShadow},R={...l.innerShadow};(C.enabled||R.enabled)&&(P.push(function(L){return{update:()=>{L instanceof Jn&&(L.innerShadow.enabled=!0)}}}(a)),C.enabled||Object.assign(C,{enabled:!0,color:{...C.color,a:0}}),R.enabled||Object.assign(R,{enabled:!0,color:{...R.color,a:0}})),b=Qy("color",a.innerShadow,C,R,h),b&&P.push(b),x=fr("blurRadius",a.innerShadow,C,R,h),x&&P.push(x),S=fr("spread",a.innerShadow,C,R,h),S&&P.push(S),w=Ky("offset",a.innerShadow,C,R,h),w&&P.push(w)}if(a instanceof Jn||a instanceof ao){let C={...o.backgroundBlur},R={...l.backgroundBlur};(C.enabled||R.enabled)&&(P.push(function(L){return{update:()=>{L instanceof Jn&&(L.backgroundBlur.enabled=!0)}}}(a)),C.enabled||Object.assign(C,{enabled:!0,radius:0}),R.enabled||Object.assign(R,{enabled:!0,radius:0})),E=fr("radius",a.backgroundBlur,C,R,h),E&&P.push(E)}if(a instanceof Jn){let C={...o.layerBlur},R={...l.layerBlur};(C.enabled||R.enabled)&&(P.push(function(L){return{update:()=>{L instanceof Jn&&(L.layerBlur.enabled=!0)}}}(a)),C.enabled||Object.assign(C,{enabled:!0,radius:0}),R.enabled||Object.assign(R,{enabled:!0,radius:0})),A=fr("radius",a.layerBlur,C,R,h),A&&P.push(A)}if(a instanceof ao||a instanceof y0){let C=_C("cornerRadius",a,o,l,h);C&&P.push(C)}return P}(t,e,i,0,n.shared)):(t.data.visible&&s.push(...function(a,o,l,c){let h=[];if(!("cloner"in l)||!a.cloner)return h;let d=a.cloner,u="cloner"in o?o.cloner:{},p=l.cloner;SA.forEach(_=>{let b;b=_==="count"?fr("count",d.parameters,u,p,c.shared,!0):Fl(_,d.parameters,u??{},p,c.shared),b&&h.push(b)});let f=function(_,b,x,w){if(_.parameters.type!=="radial")return;let S=b.radial,E=x.radial;if(!E)return;let A=_.parameters.radial,P=[];return q_.forEach(C=>{let R=Fl(C,A,S??{},E,w);R&&P.push(R)}),P}(d,u,p,c.shared);f?.length&&h.push(...f);let g=function(_,b,x,w){if(_.parameters.type!=="linear")return;let S=b.linear,E=x.linear;if(!E)return;let A=[],P=_.parameters.linear;return X_.forEach(C=>{let R=Fl(C,P,S??{},E,w);R&&A.push(R)}),A}(d,u,p,c.shared);g?.length&&h.push(...g);let m=function(_,b,x,w){if(_.parameters.type!=="grid")return;let S=b.grid,E=x.grid;if(!E)return;let A=[],P=_.parameters.grid;return $_.forEach(C=>{let R;R=C==="count"?_C(C,P,S??{},E,w,!0):Fl(C,P,S??{},E,w),R&&A.push(R)}),A}(d,u,p,c.shared);m?.length&&h.push(...m);let v=function(_,b,x,w){if(_.parameters.type!=="toObject")return;let S=b.toObject,E=x.toObject;if(!E)return;let A=[],P=_.parameters.toObject;return Y_.forEach(C=>{let R;R=C==="count"?fr(C,P,S??{},E,w,!0):Fl(C,P,S??{},E,w),R&&A.push(R)}),A}(d,u,p,c.shared);v?.length&&h.push(...v);let y=function(_,b,x,w){if(!_.parameters.randomness)return;let S=b.randomnessObject,E=x.randomnessObject;if(!E)return;let A=[],P=_.parameters.randomnessObject;return Z_.forEach(C=>{let R=Fl(C,P,S??{},E,w);R&&A.push(R)}),A}(d,u,p,c.shared);return y?.length&&h.push(...y),h.length&&h.push({update:()=>{d.update(c)}}),h}(t,e,i,n)),t instanceof Yi?(t instanceof Ai&&t.data.visible&&s.push(...function(a,o,l,c){let h=[];if(!("geometry"in l)||ll(a))return h;let d=a.geometry.userData.parameters,u="geometry"in o?o.geometry:{},p=l.geometry;if(a instanceof yp){let f=function(g,m,v,y){if(v.scaleBaked===void 0)return;let _=(m.scaleBaked??g.appliedGeometrySize??g.data.geometry.scaleBaked).map(w=>typeof w=="string"?Number(y.shared.getVariable(w)??0):w),b=v.scaleBaked.map(w=>typeof w=="string"?Number(y.shared.getVariable(w)??0):w);if(dh.isEqual(_,b))return;let x=[];return x.push({update:w=>{g.updateGeometryInteractions({scaleBaked:[Ot.lerp(_[0],b[0],w),Ot.lerp(_[1],b[1],w),Ot.lerp(_[2],b[2],w)]},y.shared),g.invalidateDownstreamBooleanData(),g.refreshAttachedClonersInteractions(y)},start:()=>{g.updateGeometryInteractions({scaleBaked:_},y.shared),g.invalidateDownstreamBooleanData(),g.refreshAttachedClonersInteractions(y)},end:()=>{g.updateGeometryInteractions({scaleBaked:b},y.shared),g.invalidateDownstreamBooleanData(),g.refreshAttachedClonersInteractions(y)}}),x}(a,u,p,c);f&&h.push(...f)}else{let f={},g=a.appliedGeometrySize;if(Object.assign(f,tA(d,T1),g?{width:g[0],height:g[1],depth:g[2]}:{},tA(u,T1)),T1.forEach(m=>{let v=Fl(m,f,u,p,c.shared);v&&h.push(v)}),fx(a)){Object.assign(f,{extrusion:{...d.extrusion}});let m=function(v,y,_,b){if(!_.extrusion)return;let x=v.extrusion,w=y.extrusion??{},S=_.extrusion,E=[];return eb.forEach(A=>{let P=Fl(A,x,w,S,b);P&&E.push(P)}),E}(f,u,p,c.shared);m&&h.push(...m)}h.length&&h.push({update:m=>{a.updateGeometryInteractions(f,c.shared),a.updateGeometryGroupsIfNeeded(),a.refreshAttachedClonersInteractions(c)},start:m=>{a.updateGeometryInteractions(f,c.shared),a.updateGeometryGroupsIfNeeded(),a.refreshAttachedClonersInteractions(c)},end:m=>{a.updateGeometryInteractions(f,c.shared),a.updateGeometryGroupsIfNeeded(),a.refreshAttachedClonersInteractions(c)}})}return h}(t,e,i,n)),t.data.visible&&!(t instanceof Wr&&t.materialOverride)&&s.push(...function(a,o,l,c){let h=[];if(Array.isArray(a.material)){if(!("materials"in l)||!l.materials)return h;let d="materials"in o&&o.materials?o.materials:[],u=l.materials;a.material.forEach((p,f)=>{if(!u[f])return;let g=d[f]??{},m=u[f];typeof g=="string"||typeof m=="string"||h.push(...JU(p,g,m,c))})}else{if(!("material"in l)||!l.material)return h;let d="material"in o&&o.material?o.material:{},u=l.material;if(typeof d=="string"||typeof u=="string")return h;h.push(...JU(a.material,d,u,c))}return h}(t,e,i,n.shared))):Eb.is(t)?t.data.visible&&s.push(...function(a,o,l,c){let h=[];if(l.intensity!==void 0){let d=fr("intensity",a,o,l,c);d&&h.push(d)}if(l.color!==void 0){let d=function(u,p,f,g,m){let v=f[u]?f[u]:void 0,y=g[u];if(!y)return;let _=p[u],b=v?typeof v=="string"?m.getColor(v).clone():new Jt().setRGB(v.r,v.g,v.b):_.clone(),x=typeof y=="string"?m.getColor(y).clone():new Jt().setRGB(y.r,y.g,y.b);if(b.equals(x))return;let w=_.clone();return{update:S=>{w.lerpColors(b,x,S),p[u]?.copy?.(w)},start:()=>{w.copy(b)},end:()=>{w.copy(x)}}}("color",a,o,l,c);d&&h.push(d)}return h}(t,e,i,n.shared)):t instanceof Zi&&s.push(...function(a,o,l,c){let h=[],d=a.cameraType==="OrthographicCamera"?o.orthographic?.zoom:o.perspective?.zoom,u=a.cameraType==="OrthographicCamera"?l.orthographic?.zoom:l.perspective?.zoom;if(u!==void 0){let p=d??a.zoom,f=u;p!==f&&h.push({update:g=>{a.zoom=Ot.lerp(p,f,g),a.updateProjectionMatrix()},start:()=>{a.zoom=p,a.updateProjectionMatrix()},end:()=>{a.zoom=f,a.updateProjectionMatrix()}})}if(l.targetOffset!==void 0){let p=fr("targetOffset",a,o,l,c);p&&h.push(p)}return h}(t,e,i,n.shared))),s.length?{update:a=>{s.forEach(o=>o.update(a))},start:a=>{s.forEach(o=>o.start?.(a))},end:a=>{s.forEach(o=>o.end?.(a))}}:void 0}var C9={type:"beginState"};function P9(t){if(t.easing===5){let{control1:e,control2:i}=t;return{easing:5,control1:e??mp.defaultData.control1,control2:i??mp.defaultData.control2}}if(t.easing===6){let{mass:e,stiffness:i,damping:n,velocity:r}=t;return{easing:6,mass:e??th.defaultData.mass,stiffness:i??th.defaultData.stiffness,damping:n??th.defaultData.damping,velocity:r??th.defaultData.velocity}}return{easing:t.easing}}function D9(t){return{delay:t.delay,delayDirection:t.delayDirection??"start-end",direction:t.direction??"normal",repeat:t.repeat}}var R9={type:"completeState",isfromEntity:!1};function Cg(t,e){let i,n;if(typeof e=="string"?(i=e,n=t.states?.[i]):e===null&&(i=null,n=t.data),i!==void 0&&n!==void 0)return{id:i,data:n}}var dnt=["position","rotation","scale","shear","hiddenMatrix"],xC=new Set,wC=class{constructor(t,e,i,n,r,s,a,o={},l=()=>xC){this.object=t,this.fromRef=e,this.toRef=i,this.data=n,this.sharedAssets=r,this.allowSlerp=s,this.page=a,this.hooks=o,this.inert=l,this.builtReversed=!1,this.startStateId=null,this.buildCallback=()=>{this.builtReversed=this.runner.isReversed,this.startStateId=os(this.object)?null:this.object.transitionState.state,this.callback=cnt(this.object,{},function(c,h){if(h.size===0)return c;let d={...c};for(let u of h)delete d[u];return d}(this.end.data,this.inert()),{scene:this.page.scene,shared:this.sharedAssets},this.allowSlerp)},this.onChange=c=>{this.builtReversed!==this.runner.isReversed&&this.buildCallback(),this.callback&&(this.callback.update(c),this.object.requestRender()),this.writeState(c)},this.runner=new b9(function(c){return{duration:c.duration,ease:P9(c),...D9(c)}}(n),this.onChange,this.buildCallback),this.rebind()}rebind(){let{fromRef:t,toRef:e}=this;if(t===void 0){let n=Cg(this.object,this.object.currentState===e?this.object.prevState:this.object.currentState);if(!n)throw new Error("Missing property");this.from=n}else{let n=Cg(this.object,t);if(!n)throw new Error("Missing property");this.from=n}if(e===void 0)throw new Error("Missing property");let i=Cg(this.object,e);if(!i)throw new Error("Missing property");this.to=i,this.buildCallback()}refresh(){this.buildCallback()}get endpointData(){return[this.from.data,this.to.data]}get targetStateId(){return this.builtReversed?this.from.id:this.to.id}get start(){return this.builtReversed?this.to:this.from}get end(){return this.builtReversed?this.from:this.to}writeState(t){if(t===0||os(this.object))return;let e=t===1,i=t>.5?this.targetStateId:this.startStateId,n=this.object.transitionState;n.settled===e&&n.state===i||(this.object.transitionState={settled:e,state:i},this.object.reversibleToState=this.end.id,this.object.prevState!==this.object.currentState&&(this.object.prevState=this.object.currentState),this.object.currentState=i,this.object.dispatchEvent({type:"transitionState",settled:e,state:i}),this.object.dispatchEvent({type:e?"completeState":"beginState",state:i}),this.object.traverseEntity(r=>{r!==this.object&&r instanceof Zi&&r.dispatchEvent(e?R9:C9)}),e?this.hooks.onComplete?.(i):this.hooks.onBegin?.(i))}};Ws();var SC=new Map,Pg=new Map,ra=class extends Vn{constructor(t,e,i,n,r,s,a){super(),this.id=t,this.data=e,this.scene=i,this.sharedAssets=n,this.object=r,this.eventType=s,this.actionCondition=a,this.evaluators=[],this.elapsed=0,this.lastTime=null,this.direction=1,this._playing=!1,this._finished=!1,this.hasPlayedOnce=!1,this.pauseOnNextCycleEnd=!1,this.lastCycleIndex=0;try{let o=$c.findTimeline(this.scene.data.objects,this.data.timeline),l=o.duration;this.animatedObjectIds=Object.keys(o.objectTimelines),this.animatedObjectIds.forEach(c=>{let h=this.scene.find(c);if(!h)return;let d=o.objectTimelines[c];!d||this.evaluators.push(function(u,p,f,g,m){let v=function(y,_){let b=[];return Nc.groupKeyframes(_.keyframes).forEach(x=>{let w=x.path?.[0],S=x.path[1],E=()=>gu(x.keyframes,A=>A.value);switch(w){case"position":case"rotation":case"scale":return void(S&&Wg.includes(S)&&b.push({on:w,axis:S,track:E()}));case"shape size":return void(S&&Wg.includes(S)&&"geometry"in y&&b.push({on:"shapeSize",axis:S,track:E()}));case"path extrusion":return void(fx(y)&&b.push({on:"pathExtrusion",track:gu(x.keyframes,A=>A.value)}));case"path snapping":return void(y.data.pathSnapping&&b.push({on:"pathSnapping",track:gu(x.keyframes,A=>A.value)}));case"material":return void(y.type==="Mesh"&&"material"in y&&function(A,P){let C=R6(A.material)?A.material:void 0,R=P.layerId;if(!C||!R)return[];let L=P.keyframes.some(W=>vp(W.data.value?.noiseStrength)),D=C.ensureRainbowNoiseCompiled,F=W=>{L&&typeof D=="function"&&D.call(C,W)},V=W=>"data"in W?[{on:"material",layer:W,track:gu(P.keyframes,it=>it.value)}]:[];F(R);let U=C.getLayerByUuid(R);if(U)return V(U);let j=P.path[1];for(let W of C.getLayersOfType(j))F(W.uuid);return(C.getLayersOfType(j)??[]).flatMap(V)}(y,x).forEach(A=>b.push(A)));case"opacity":return void(y.type==="Mesh"&&"material"in y&&b.push({on:"opacity",track:E()}));case"cloner":return void b.push({on:"cloner",track:gu(x.keyframes,A=>A.value)});case"camera":return void(y instanceof Zi&&b.push({on:"camera",field:"zoom",track:E()}));case"light":return void((y instanceof p0||y instanceof Px||y instanceof f0)&&b.push({on:"light",field:x.path[1],track:gu(x.keyframes,A=>A.value)}))}}),b}(u,p);return{duration:f,evaluate(y,_){u.resetBBoxNeedsUpdate();let b={transform:!1,size:!1,cloner:!1,bounds:!1,boolean:!1,render:!1};for(let x of v)hnt(x,u,y,g,m,_,b);(function(x,w,S){if(w.size&&x instanceof Ai){let{x:E,y:A,z:P}=x.userData.value;x.updateGeometryInteractions({width:E,height:A,depth:P},S.shared)}w.cloner&&x.cloner?.update(S),w.transform&&x.updateMatrix(),w.bounds&&x.resetBBoxNeedsUpdate(),w.boolean&&x instanceof Ai&&x.invalidateDownstreamBooleanData(),w.render&&x.dispatchEvent({type:"requestRender"})})(u,b,g)},invalidate(){for(let y of v)ont(y.track)}}}(h,{...d},l,{scene:i,shared:n},this.sharedAssets))}),this.schedule=new qet(function(c,h){return{duration:h,delay:pr(c.delay/1e3),delayDirection:c.delayDirection??"start-end",direction:c.direction??"normal",repeat:c.repeat}}(this.data,l))}catch{throw new Error("Missing property")}r&&(Pg.has(r.uuid)?Pg.get(r.uuid).push(this):Pg.set(r.uuid,[this])),SC.set(t,this)}get playing(){return this._playing}get finished(){return this._finished}get paused(){return!this._playing}update(t){this.lastTime!==null&&(this.elapsed=Math.max(0,this.elapsed+(t-this.lastTime)*this.direction)),this.lastTime=t,this.applyAtElapsed()}applyAtElapsed(){if(this.direction===-1&&this.elapsed===0)return void this.pause();let t=this.schedule.resolve(this.elapsed);if(t){if(t.cycleIndex!==this.lastCycleIndex&&(this.lastCycleIndex=t.cycleIndex,this.pauseOnNextCycleEnd))return this.pauseOnNextCycleEnd=!1,void this.pause();for(let e of this.evaluators)e.evaluate(t.localTime)}else this.direction===1&&this.schedule.isFinished(this.elapsed)&&this.finish()}finish(){this.pause(),this._finished=!0,this.animatedObjectIds.forEach(t=>{let e=this.scene.find(t);e instanceof Zi&&e.dispatchEvent(R9)})}startTicking(){this._playing=!0,this.lastTime=null;for(let t of this.evaluators)t.invalidate();nn.add(this)}play(){let t=this.eventType!==void 0&&fA(this.eventType)&&this.data.runMode==="Once"&&this.hasPlayedOnce&&this.paused&&this.elapsed>0&&!this._finished;if(this.eventType!==void 0&&fA(this.eventType)&&this.data.runMode==="Once"&&this.hasPlayedOnce&&!t||this.eventType===void 0&&this._finished)return!1;this.hasPlayedOnce=!0,this.animatedObjectIds.forEach(e=>{let i=this.scene.find(e);i instanceof Zi&&i.dispatchEvent(C9)}),!t&&(this.elapsed===0||this._finished)&&(this.elapsed=0,this.lastCycleIndex=0,this._finished=!1),this.direction=1,this.startTicking()}pause(){this._playing=!1,this.lastTime=null,nn.remove(this)}stop(){this.pause(),this.elapsed=0,this.lastCycleIndex=0,this.applyAtElapsed(),this._finished=!1}seek(t){let e=this.schedule.totalDuration;this.elapsed=t*(Number.isFinite(e)?e:this.schedule.effectiveCycleDuration);for(let i of this.evaluators)i.invalidate();this.applyAtElapsed()}toggle(t){let e=t??this.direction===-1;this._playing&&this.direction===(e?1:-1)?e&&(this.pauseOnNextCycleEnd=!1):(e?(this._finished&&(this.elapsed=0,this.lastCycleIndex=0,this._finished=!1),this.direction=1,this.pauseOnNextCycleEnd=!1):(this.direction=this.schedule.resolve(this.elapsed)?.isReverse?1:-1,this.pauseOnNextCycleEnd=!0),this.startTicking())}playFromCurrent(){this.toggle(!0)}reverseFromCurrent(){this.toggle(!1)}dispose(){this.pause()}},unt=class{constructor(t){this.data=t}dispatch(){this.data.playTimeline?this.pauseTimeline(this.data.playTimeline):this.data.object?this.pauseAllTimelinesFromObject(this.data.object):this.pauseAllTimelines()}pauseTimeline(t){let e=this.getTimelineActions(t);!e.length||(this.data.delay>0?(this.disposeDelay(),this.timeoutId=window.setTimeout(()=>{e.forEach(i=>{i[this.data.interaction]()}),this.disposeDelay()},this.data.delay)):e.forEach(i=>{i[this.data.interaction]()}))}getTimelineActions(t){let e=SC.get(t);return e?[e]:[...SC.values()].filter(i=>i.data.timeline===t)}pauseAllTimelinesFromObject(t){let e=Pg.get(t);!e?.length||(this.data.delay>0?(this.disposeDelay(),this.timeoutId=window.setTimeout(()=>{e.forEach(i=>i[this.data.interaction]()),this.disposeDelay()},this.data.delay)):e.forEach(i=>i[this.data.interaction]()))}pauseAllTimelines(){let t=[...Pg.values()];!t.length||(this.data.delay>0?(this.disposeDelay(),this.timeoutId=window.setTimeout(()=>{t.forEach(e=>{e.forEach(i=>{i[this.data.interaction]()})}),this.disposeDelay()},this.data.delay)):t.forEach(e=>{e.forEach(i=>{i[this.data.interaction]()})}))}disposeDelay(){clearTimeout(this.timeoutId),delete this.timeoutId}dispose(){clearTimeout(this.timeoutId),delete this.timeoutId}},pnt=class{constructor(t,e,i,n,r,s,a){this.data=e;let o="interaction"in e?e.interaction:"play";if(o==="play"||o===void 0)this.interaction=new ra(t,e,i,n,r,s,a);else{if(o!=="pause"&&o!=="stop")throw new Error("Missing property");this.interaction=new unt(e)}}get playing(){return this.interaction instanceof ra&&this.interaction.playing}get finished(){return!(this.interaction instanceof ra)||this.interaction.finished}get paused(){return!(this.interaction instanceof ra)||this.interaction.paused}play(){if(this.interaction instanceof ra)return this.interaction.play();this.interaction.dispatch()}stop(){this.interaction instanceof ra&&this.interaction.stop()}seek(t){this.interaction instanceof ra&&this.interaction.seek(t)}toggle(t){this.interaction instanceof ra?this.interaction.toggle(t):this.interaction.dispatch()}playFromCurrent(){this.interaction instanceof ra?this.interaction.playFromCurrent():this.interaction.dispatch()}dispatchConditional(){this.interaction instanceof ra?wi(this.interaction.sharedAssets,this.interaction.actionCondition)&&this.interaction.playFromCurrent():this.interaction.dispatch()}reverseFromCurrent(){this.interaction instanceof ra&&this.interaction.reverseFromCurrent()}dispose(){this.interaction.dispose()}};function iz(t){let e=t.tweens[0]?.data;return{delay:e?.delay??t.delay,delayDirection:e?.delayDirection??"start-once",direction:e?.direction??t.direction,repeat:e?.repeat??t.repeat}}ke(),Dr("TimelineAnimation",({id:t,data:e,page:i,shared:n,object:r,eventType:s,actionCondition:a})=>new pnt(t,e,i.scene,n,r,s,a)),Si("timeline"),Bi(),$t(),tt(),Ws();var fnt={state:null,duration:0,delay:0,delayDirection:"start-once",direction:"normal",repeat:0,easing:0},mnt=class extends Vn{constructor(t,e,i,n,r,s){if(super(),this.eventType=t,this.data=e,this.page=i,this.shared=n,this.condition=r,this.runModeOverride=s,this.tweens=[],this.hasPlayedOnce=!1,this.inert=xC,!e.object)throw new Error("Missing property");let a=this.page.scene.find(e.object)??this.page.uiCanvas?.find(e.object)??this.page.scene.find2DInUIObjects(e.object);if(!a)throw new Error("Missing property");if(!a.states)throw new Error("Missing property");if(this.object=a,e.tweens.length<2)throw new Error("Missing property");this.init()}get playing(){return this.runner?.isPlaying===!0}get animating(){return this.runner?.isAnimating===!0}get claimTime(){return this.runner?.claimTime}get contested(){let t=this.object.previousAction;return t!==null&&t!==this&&t.animating}init(){this.initialCurrentState=Cg(this.object,this.object.currentState).id,this.build()}shouldReinit(){return!!wi(this.shared,this.condition)||!(this.animating&&!this.loopsForever)}get loopsForever(){return iz(this.data).repeat===-1||this.data.tweens.some((t,e)=>e>0&&t.data.repeat===-1)}get runMode(){return this.runModeOverride!==void 0?this.runModeOverride:fA(this.eventType)?this.data.runMode:"Repeat"}get currentState(){return this.runMode==="Toggle"?this.initialCurrentState:this.object.currentState}get opensOnCurrent(){return this.data.tweens[0].data.state===void 0&&this.runMode!=="Toggle"}build(){let t=this.data.tweens,e=[];try{let i=t[0].data.state;i!==void 0&&e.push(new wC(this.object,i,i,fnt,this.shared,this.data.allowSlerp??!1,this.page,{},()=>this.inert));for(let n=1;n<t.length;n++){let r=t[n-1],s=t[n];e.push(new wC(this.object,r.data.state===void 0?this.currentState:r.data.state,s.data.state===void 0?this.currentState:s.data.state,s.data,this.shared,this.data.allowSlerp??!1,this.page,{},()=>this.inert))}}catch(i){return void(i instanceof Error&&console.error(i.message))}this.tweens=e,this.syncInert(),this.runner=new _9({...D9(iz(this.data)),runMode:this.runMode},e.map(i=>i.runner),{claim:i=>this.claimObject(i),assignCurrentState:()=>this.rebindTweens(),isOwner:()=>this.object.previousAction===this})}claimObject(t){if(this.object.previousAction===this)return!1;let e=this.object.previousAction;if(e?.animating===!0){if(t!==void 0&&e.claimTime!==void 0&&e.claimTime>t)return!1;e.pause()}return this.object.previousAction=this,!0}rebindTweens(){for(let t of this.tweens)try{t.rebind()}catch(e){e instanceof Error&&console.error(e.message)}this.syncInert(),this.object instanceof Zi&&this.object.wasMovedByUser&&(this.object.wasMovedByUser=!1)}syncInert(){let t=this.tweens.flatMap(e=>e.endpointData);if(this.opensOnCurrent&&t.length>0){let e=Cg(this.object,this.object.currentState);e&&(t[0]=e.data)}this.inert=this.notMovedByOwner(function(e){if(e.length<2)return xC;let i=new Set,[n,...r]=e;for(let s of dnt){let a=n[s];a!==void 0&&r.every(o=>Uc(o[s],a))&&i.add(s)}return i}(t));for(let e of this.tweens)e.refresh()}notMovedByOwner(t){let e=this.object.previousAction;if(t.size===0||e===null||e===this||!e.animating)return t;let i=e.leavesAlone;return new Set([...t].filter(n=>i.has(n)))}get leavesAlone(){return this.inert}update(t){this.runner?.update(t),this.runner?.isPlaying!==!0&&nn.remove(this)}play(){if(wi(this.shared,this.condition)===!1||this.runMode==="Once"&&this.hasPlayedOnce)return!1;this.hasPlayedOnce=!0,this.start()}start(){!this.runner||(this.runner.play(nn.time),this.runner.isPlaying&&nn.add(this))}pause(){this.runner?.stop(),nn.remove(this)}stop(){this.pause();let t=this.data.tweens[0].data.state===void 0?this.initialCurrentState:this.data.tweens[0].data.state;os(this.object)?this.object.changeSelectedState(t,{shared:this.shared}):this.object.changeSelectedState(t,{scene:this.page.scene,shared:this.shared}),this.object.currentState=t}seek(t){if(wi(this.shared,this.condition)===!1)return!1;this.runner?.seek(t)}playDirected(t){if(wi(this.shared,this.condition)===!1)return!1;!this.runner||(this.runner.playDirected(nn.time,t),this.runner.isPlaying&&nn.add(this))}playFromCurrent(){this.playDirected(!0)}reverseFromCurrent(){this.playDirected(!1)}dispose(){this.pause()}};function I9(t){let e=t?.tracks.filter(i=>i.ValueTypeName==="vector"||i.ValueTypeName==="quaternion").map(i=>i.times.length);if(e?.length){let i=function(n){if(!n||n.length===0)return;let r;for(let s of n)s==s&&(r===void 0||s>r)&&(r=s);return r}(e);return i&&i>2?i:2}return 2}$t(),tt(),ti();var ju=new Map,Dg=new WeakSet;function O9(t,e){if(e===void 0)return;let i=t.scene.find(e);return i&&Array.isArray(i.identity)?i.identity[0]:e}var No=class extends Vn{constructor(t,e,i,n,r){super(),this.page=e,this.animationControls=i,this.shared=n,this.condition=r,this.startOnceDelay=0,this.toggleIsForward=!1;let s=O9(e,t.object)??t.object;this.data={...t,object:s};let a=this.animationControls.clipIdToAction[t.clipId+"/"+s];if(this.duration=a?.getClip()?.duration??1,this.data.crop2){let l=I9(a?.getClip());this.leftFrameTime=this.data.crop2[0]/(l-1)*this.duration,this.rightFrameTime=this.data.crop2[1]/(l-1)*this.duration}else{let l=a?.getClip()?.tracks[0]?.times.length;l&&l>1?(this.leftFrameTime=this.data.crop[0]/l*this.duration,this.rightFrameTime=this.data.crop[1]/l*this.duration):(this.leftFrameTime=0,this.rightFrameTime=this.duration)}this.startOnceDelay=t.delay;let o=ju.get(s);o||(o=new Set,ju.set(s,o)),o.add(this)}get playing(){return this.threeAnimAction?.isRunning()??!1}cancelPending(){window.clearTimeout(this.timeoutId),delete this.timeoutId}resume(){let t=this.animationControls.clipIdToAction[this.data.clipId+"/"+this.data.object];return!(!t||!Dg.has(t)||(Dg.delete(t),this.threeAnimAction=t,t.paused=!1,t.play(),this.animationControls.requestRender(),0))}play(t=!1){if(wi(this.shared,this.condition)===!1)return!1;window.clearTimeout(this.timeoutId),this.timeoutId=window.setTimeout(()=>{if(this.resume()||(this.threeAnimAction=this.animationControls.play(this.data),!this.threeAnimAction))return;Dg.delete(this.threeAnimAction),this.threeAnimAction.reset(),this.threeAnimAction.time=this.leftFrameTime,this.threeAnimAction._clip.start=this.leftFrameTime,this.threeAnimAction._clip.duration=this.rightFrameTime;let e=this.data.object;Object.entries(this.animationControls.clipIdToAction).forEach(([i,n])=>{let r=i.split("/")[1];this.threeAnimAction!==n&&r===e&&(t?n.fadeOut(.2):n.stop())}),t&&this.threeAnimAction?.fadeIn(.2)},this.startOnceDelay)}pause(){this.threeAnimAction&&(this.threeAnimAction.paused=!0),this.cancelPending()}stop(){this.threeAnimAction?.fadeOut(.2)}seek(t){this.threeAnimAction=this.animationControls.play(this.data),this.threeAnimAction&&(this.threeAnimAction.paused=!0,this.threeAnimAction.time=Ot.clamp(this.threeAnimAction.time+1/60*t,this.leftFrameTime,this.rightFrameTime-16e-5),this.animationControls.needsUpdate=!0,this.animationControls.requestRender())}toggle(t,e=!1){if(wi(this.shared,this.condition)===!1)return!1;this.toggleIsForward=t??!this.toggleIsForward,this.threeAnimAction&&(this.threeAnimAction._loopCount=0),this.playing||this.resume()?this.threeAnimAction&&(this.threeAnimAction.timeScale=this.toggleIsForward?1:-1,this.toggleIsForward?(this.threeAnimAction._clip.start=this.leftFrameTime,this.threeAnimAction._clip.duration=this.rightFrameTime):(this.threeAnimAction._clip.start=this.rightFrameTime,this.threeAnimAction._clip.duration=this.leftFrameTime)):this.timeoutId=window.setTimeout(()=>{if(this.threeAnimAction=this.animationControls.play(this.data),this.threeAnimAction){this.toggleIsForward?(this.threeAnimAction.time=this.leftFrameTime,this.threeAnimAction._clip.start=this.leftFrameTime,this.threeAnimAction._clip.duration=this.rightFrameTime):(this.threeAnimAction.time=this.rightFrameTime,this.threeAnimAction._clip.start=this.rightFrameTime,this.threeAnimAction._clip.duration=this.leftFrameTime),this.threeAnimAction.paused=!1,this.threeAnimAction.timeScale=this.toggleIsForward?1:-1;let i=this.data.clipId.split("/")[1];Object.entries(this.animationControls.clipIdToAction).forEach(([n,r])=>{let s=n.split("/")[1];this.threeAnimAction!==r&&s===i&&r.isRunning()&&(e?r.fadeOut(.2):r.stop())}),e&&this.threeAnimAction?.fadeIn(.2)}},this.startOnceDelay)}playFromCurrent(){this.toggle(!0)}reverseFromCurrent(){this.toggle(!1)}dispose(){let t=this.animationControls.clipIdToAction[this.data.clipId+"/"+this.data.object]?.getClip();t&&(t.duration=this.duration),this.pause();let e=ju.get(this.data.object);e&&(e.delete(this),e.size===0&&ju.delete(this.data.object))}},gnt=class{constructor(t,e,i){this.data=t,this.page=e,this.animationControls=i,this.objectId=O9(e,t.object)}dispatch(){this.data.delay>0?(this.disposeDelay(),this.timeoutId=window.setTimeout(()=>{this.apply(),this.disposeDelay()},this.data.delay)):this.apply()}targetsClip(t,e){return!(this.objectId!==void 0&&e!==this.objectId||this.data.clipId&&t!==this.data.clipId)}apply(){(this.objectId!==void 0?[ju.get(this.objectId)]:[...ju.values()]).forEach(e=>{e?.forEach(i=>{this.targetsClip(i.data.clipId,i.data.object)&&i.cancelPending()})});let t=!1;Object.entries(this.animationControls.clipIdToAction).forEach(([e,i])=>{let[n,r]=e.split("/");if(this.targetsClip(n,r))if(this.data.interaction==="pause"){if(!i.isRunning())return;i.paused=!0,Dg.add(i)}else{if(!i.enabled||!i.isRunning()&&!i.paused)return;i.paused=!0,Dg.delete(i),i.time=i._clip.start??0,i._loopCount=-1,t=!0}}),t&&(this.animationControls.needsUpdate=!0,this.animationControls.requestRender())}disposeDelay(){clearTimeout(this.timeoutId),delete this.timeoutId}dispose(){this.disposeDelay()}},vnt=class{constructor(t,e,i,n,r){xA.isPause(t)?this.interaction=new gnt(t,e,i):this.interaction=new No(t,e,i,n,r)}get data(){return this.interaction.data}get playing(){return this.interaction instanceof No&&this.interaction.playing}play(t=!1){if(this.interaction instanceof No)return this.interaction.play(t);this.interaction.dispatch()}pause(){this.interaction instanceof No&&this.interaction.pause()}stop(){this.interaction instanceof No&&this.interaction.stop()}seek(t){this.interaction instanceof No&&this.interaction.seek(t)}toggle(t,e=!1){if(this.interaction instanceof No)return this.interaction.toggle(t,e);this.interaction.dispatch()}playFromCurrent(){this.interaction instanceof No?this.interaction.playFromCurrent():this.interaction.dispatch()}reverseFromCurrent(){this.interaction instanceof No&&this.interaction.reverseFromCurrent()}dispose(){this.interaction.dispose()}},L9=null;ke(),L9=wC,Dr("Transition",({eventType:t,data:e,page:i,shared:n,actionCondition:r,runModeOverride:s})=>new mnt(t,e,i,n,r,s)),Dr("Animation",({data:t,page:e,eventManager:i,shared:n,actionCondition:r})=>new vnt(t,e,i.animationControls,n,r)),Si("transitions"),ti();var nz=(t,e)=>e.some(i=>i instanceof RegExp?i.test(t):i===t),ynt=class{constructor({url:t,context:e},i,n,r){if(this.controlsManager=i,this.shared=n,this.condition=r,!t)throw new Error("Missing property");this.url=t.startsWith("mailto:")?t:function(s,a){if(a={defaultProtocol:"http:",normalizeProtocol:!0,forceHttp:!1,forceHttps:!1,stripAuthentication:!0,stripHash:!1,stripTextFragment:!0,stripWWW:!0,removeQueryParameters:[/^utm_\w+/i],removeTrailingSlash:!0,removeSingleSlash:!0,removeDirectoryIndex:!1,sortQueryParameters:!0,...a},s=s.trim(),/^data:/i.test(s))return((h,{stripHash:d})=>{let u=/^data:(?<type>[^,]*?),(?<data>[^#]*?)(?:#(?<hash>.*))?$/.exec(h);if(!u)throw new Error(`Invalid URL: ${h}`);let{type:p,data:f,hash:g}=u.groups,m=p.split(";");g=d?"":g;let v=!1;m[m.length-1]==="base64"&&(m.pop(),v=!0);let y=(m.shift()||"").toLowerCase(),_=[...m.map(b=>{let[x,w=""]=b.split("=").map(S=>S.trim());return x==="charset"&&(w=w.toLowerCase(),w==="us-ascii")?"":`${x}${w?`=${w}`:""}`}).filter(Boolean)];return v&&_.push("base64"),(_.length>0||y&&y!=="text/plain")&&_.unshift(y),`data:${_.join(";")},${v?f.trim():f}${g?`#${g}`:""}`})(s,a);if(/^view-source:/i.test(s))throw new Error("`view-source:` is not supported as it is a non-standard protocol");let o=s.startsWith("//");!o&&/^\.*\//.test(s)||(s=s.replace(/^(?!(?:\w+:)?\/\/)|^\/\//,a.defaultProtocol));let l=new URL(s);if(a.forceHttp&&a.forceHttps)throw new Error("The `forceHttp` and `forceHttps` options cannot be used together");if(a.forceHttp&&l.protocol==="https:"&&(l.protocol="http:"),a.forceHttps&&l.protocol==="http:"&&(l.protocol="https:"),a.stripAuthentication&&(l.username="",l.password=""),a.stripHash?l.hash="":a.stripTextFragment&&(l.hash=l.hash.replace(/#?:~:text.*?$/i,"")),l.pathname){let h=/\b[a-z][a-z\d+\-.]{1,50}:\/\//g,d=0,u="";for(;;){let p=h.exec(l.pathname);if(!p)break;let f=p[0],g=p.index;u+=l.pathname.slice(d,g).replace(/\/{2,}/g,"/"),u+=f,d=g+f.length}u+=l.pathname.slice(d,l.pathname.length).replace(/\/{2,}/g,"/"),l.pathname=u}if(l.pathname)try{l.pathname=decodeURI(l.pathname)}catch{}if(a.removeDirectoryIndex===!0&&(a.removeDirectoryIndex=[/^index\.[a-z]+$/]),Array.isArray(a.removeDirectoryIndex)&&a.removeDirectoryIndex.length>0){let h=l.pathname.split("/"),d=h[h.length-1];nz(d,a.removeDirectoryIndex)&&(h=h.slice(0,-1),l.pathname=h.slice(1).join("/")+"/")}if(l.hostname&&(l.hostname=l.hostname.replace(/\.$/,""),a.stripWWW&&/^www\.(?!www\.)[a-z\-\d]{1,63}\.[a-z.\-\d]{2,63}$/.test(l.hostname)&&(l.hostname=l.hostname.replace(/^www\./,""))),Array.isArray(a.removeQueryParameters))for(let h of[...l.searchParams.keys()])nz(h,a.removeQueryParameters)&&l.searchParams.delete(h);if(a.removeQueryParameters===!0&&(l.search=""),a.sortQueryParameters){l.searchParams.sort();try{l.search=decodeURIComponent(l.search)}catch{}}a.removeTrailingSlash&&(l.pathname=l.pathname.replace(/\/$/,""));let c=s;return s=l.toString(),!a.removeSingleSlash&&l.pathname==="/"&&!c.endsWith("/")&&l.hash===""&&(s=s.replace(/\/$/,"")),(a.removeTrailingSlash||l.pathname==="/")&&l.hash===""&&a.removeSingleSlash&&(s=s.replace(/\/$/,"")),o&&!a.normalizeProtocol&&(s=s.replace(/^http:\/\//,"//")),a.stripProtocol&&(s=s.replace(/^(?:https?:)?\/\//,"")),s}(t,{removeTrailingSlash:!1,removeSingleSlash:!1,stripWWW:!1}),this.context=e??"tab"}dispatch(){if(wi(this.shared,this.condition)===!1)return!1;Qc?window.location.assign(this.url):(this.context==="tab"||$F&&this.context==="none"?window.open(this.url,"_blank"):this.context==="window"?window.open(this.url,"_blank",`width=${window.innerWidth}, height=${window.innerHeight}`):window.open(this.url,"_parent"),this.controlsManager.orbitControls?.onPointerUp(ae[0]),ae.splice(0,ae.length))}},_nt=class{constructor(t,e,i,n,r){this.data=t,this.page=e,this.shared=i,this.eventManager=n,this.condition=r}dispatch(){if(wi(this.shared,this.condition)===!1)return!1;clearTimeout(this.timeoutId),delete this.timeoutId,this.timeoutId=window.setTimeout(()=>{this.shared.reset(this.shared.data,!0),bP(this.page,this.shared,!0),this.eventManager.reset(),this.eventManager.controlsManager.gameControl?.reset(!0),this.page.switchToPlayCamera(),this.eventManager.controlsManager.requestRender(),delete this.timeoutId},1e3*(this.data.delay??0))}dispose(){clearTimeout(this.timeoutId),delete this.timeoutId}};tt();var bnt={type:"beginState"},rz={type:"completeState",isfromEntity:!1},sz={type:"requestRender"},xnt=class extends Vn{constructor(t,e,i,n){super(),this.data=t,this.page=e,this.shared=i,this.condition=n,this.toggleIsForward=!1,this.posStart=new T,this.posEnd=new T,this.qStart=new Wt,this.qEnd=new Wt,this.zoomStart=1,this.zoomEnd=1}init(){}get playing(){return this.runner?.isPlaying===!0}buildAnimation(t=!1){if(!this.data.animate)return;let e=this.page.scene.find(this.data.targetCamera);if(!e||!e.visible)throw new ReferenceError("Target camera not founded or not visible");this.posStart.copy(this.page.activeCamera.position),this.qStart.copy(this.page.activeCamera.quaternion),this.zoomStart=this.page.activeCamera.zoom;let i={duration:this.data.duration,delay:0,delayDirection:"start-once",direction:"normal",repeat:0,ease:P9(this.data)},n=r=>{let s=this.page.activeCamera;s.position.lerpVectors(this.posStart,this.posEnd,r),s.quaternion.slerpQuaternions(this.qStart,this.qEnd,r),s.zoom=this.zoomStart+(this.zoomEnd-this.zoomStart)*r,s.wasMovedBySwitchCameraAction=!0,s.updateMatrix(),s.updateMatrixWorld(),s.updateProjectionMatrix(),s.dispatchEvent(sz),r===1&&s.dispatchEvent(rz)};this.runner=new b9(i,n,()=>{this.data.runMode!=="Toggle"||this.toggleIsForward?(this.posEnd.copy(e.position),this.qEnd.copy(e.quaternion),this.zoomEnd=e.zoom,this.fromCamera=this.page.activeCamera,this.switchCamera(e.uuid)):this.fromCamera&&(this.posEnd.copy(this.fromCamera.position),this.qEnd.copy(this.fromCamera.quaternion),this.zoomEnd=this.fromCamera.zoom,this.switchCamera(this.fromCamera.uuid)),this.page.activeCamera.dispatchEvent(bnt),n(0)})}update(t){this.runner?.update(t),this.runner?.isPlaying!==!0&&nn.remove(this)}start(){!this.runner||(this.runner.start(nn.time),nn.add(this))}switchCamera(t){let e=this.page.activeCamera,i=this.page.scene.find(t);if(!i||!i.visible)throw new ReferenceError("Target camera not founded or not visible");this.page.switchActiveCamera(i),e.dispatchEvent({type:"cameraChange",camera:i})}play(){if(wi(this.shared,this.condition)===!1)return!1;if(!this.playing&&this.page.activeCamera.uuid!==this.data.targetCamera)try{clearTimeout(this.timeoutId),this.timeoutId=window.setTimeout(()=>{delete this.timeoutId,this.data.animate?(this.buildAnimation(),this.start()):this.switchCamera(this.data.targetCamera)},1e3*this.data.delay)}catch{}}pause(){this.runner?.stop(),nn.remove(this),clearTimeout(this.timeoutId),delete this.timeoutId}toggle(t){if(wi(this.shared,this.condition)===!1)return!1;if(window.clearTimeout(this.timeoutId),delete this.timeoutId,t!==this.toggleIsForward)try{this.playing?(this.runner?.stop(),this.toggleIsForward=t??!this.toggleIsForward,this.buildAnimation(!0),this.start()):this.timeoutId=window.setTimeout(()=>{this.toggleIsForward=t??!this.toggleIsForward,this.data.animate?(this.runner?.stop(),this.buildAnimation(),this.start()):(this.toggleIsForward?(this.fromCamera=this.page.activeCamera,this.switchCamera(this.data.targetCamera)):this.fromCamera&&this.switchCamera(this.fromCamera.uuid),this.page.activeCamera.dispatchEvent(rz),this.page.activeCamera.dispatchEvent(sz))},1e3*this.data.delay)}catch{}}playFromCurrent(){this.toggle(!0)}reverseFromCurrent(){this.toggle(!1)}dispose(){this.pause(),this.toggleIsForward=!1}};B3();var wnt=class{constructor(t,e,i,n){this.data=t,this.page=e,this.shared=i,this.condition=n}dispatch(){if(wi(this.shared,this.condition)===!1)return!1;(this.data.target==="single"?this.data.variableId?[this.data.variableId]:[]:Object.keys(this.shared.getVariables())).forEach(t=>{this.shared.getVariable(t);let e=this.shared.data.variables.data(t)?.value;e!==void 0&&this.shared.updateVariable(t,e),this.shared.enableLocalStorageForPersistentVariables&&localStorage.removeItem(yT(t))})}dispose(){}};ke(),Dr("Link",({data:t,eventManager:e,shared:i,actionCondition:n})=>new ynt(t,e.controlsManager,i,n)),Dr("Reset",({data:t,page:e,shared:i,eventManager:n,actionCondition:r})=>new _nt(t,e,i,n,r)),Dr("SwitchCamera",({data:t,page:e,shared:i,actionCondition:n})=>new xnt(t,e,i,n)),Dr("ClearLocalStorage",({data:t,page:e,shared:i,actionCondition:n})=>new wnt(t,e,i,n)),Si("misc-actions"),ke(),Xr(),dl(),q3(),B3();var Snt=class{get sharedAssets(){return this.shared}constructor(t,e={},i=!0){this.shared=new Mb(t.shared,e,!0,i),this.scene=new Dx(t.scene,this.sharedAssets),this.shared.setEntityOpContext({scene:this.scene,shared:this.shared})}reset(t,e){this.scene.clearScene(),this.sharedAssets.reset(t.shared),this.scene.resetAfterClear(t.scene,this.sharedAssets)}resetPersonalCameraFromDocumentData(){for(let t of this.scene.children)t instanceof mn&&!t.uiScene&&t.personalCamera.updateState(t.data.camera,{scene:this.scene,shared:this.shared})}dispose(){this.scene.dispose(),this.shared.dispose()}gc(){this.scene.releaseInstanceGroups(),this.shared.geometryCache.startGc(),this.shared.geometryCache2.startGc(),this.scene.traverseEntity(t=>{t instanceof Ai&&t.markGeometryAsReachable(this.shared)}),this.shared.geometryCache.endGc(),this.shared.geometryCache2.endGc()}};q3(),Ye();var Gu,sE,aE="vertexOrder";function az(t){return sE||(sE=Promise.resolve().then(()=>(TZ(),a8)).then(({DRACOLoader:e})=>((Gu=new e).setDecoderPath(t!==void 0?`${t}/`:"https://www.gstatic.com/draco/versioned/decoders/1.5.2/").preload(),Gu.decoderPending))),sE}async function Mnt(t){if(Gu){let e,i={attributeIDs:{...Gu.defaultAttributeIDs,[aE]:"GENERIC"},attributeTypes:{...Gu.defaultAttributeTypes,[aE]:"Uint32Array"},useUniqueIDs:!1};try{e=await Gu.decodeGeometry(new Int8Array(t).buffer,i)}catch(n){console.error(n)}if(e)return function(n){let r=n.attributes.find(h=>h.name===aE);if(!r)return n;let s=r.array,a=s.length,o=0;for(let h=0;h<a;h++)o=Math.max(o,s[h]+1);let l,c=n.attributes.filter(h=>h!==r).map(({name:h,itemSize:d,array:u})=>{let p=new Float32Array(o*d);for(let f=0;f<a;f++){let g=s[f]*d,m=f*d;for(let v=0;v<d;v++)p[g+v]=u[m+v]}return{name:h,itemSize:d,array:p}});if(n.index){let h=n.index.array,d=new Uint32Array(h.length);for(let u=0;u<h.length;u++)d[u]=s[h[u]];l={array:d}}return{index:l,attributes:c}}({index:e.index?{array:e.index.array}:void 0,attributes:Object.entries(e.attributes).map(([n,r])=>({name:n,itemSize:r.itemSize,array:r.array}))})}return null}async function oz(t){for(let e of t){let i=await Mnt(e.geometry.data.draco);if(i){let n=e.geometry.data;i.index&&(n.index={array:i.index.array,itemSize:1,normalized:!1,type:"Uint32Array"});let r={};i.attributes.forEach(({name:s,array:a,itemSize:o})=>{r[s]={array:a,itemSize:o,type:"Float32Array",normalized:!1}}),n.attributes=r,n.draco=void 0}}}function Ent(t){let e=this._clip.duration,i=this._clip.start??0,n=this.loop,r=this.time+t,s=this._loopCount,a=n===D_;if(t===0)return s===-1||!a||1&~s?r:e-(r-i);if(n===SE){s===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));t:{if(r>=e)r=e;else{if(!(r<0)){this.time=r;break t}r=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=r,this._mixer.dispatchEvent({type:"finished",action:this,direction:t<0?-1:1})}}else{if(s===-1&&(t>=0?(s=0,this._setEndings(!0,this.repetitions===0,a)):this._setEndings(this.repetitions===0,!0,a)),r>=e||r<i){let o=Math.floor((r-i)/(e-i));r-=(e-i)*o,s+=Math.abs(o);let l=this.repetitions-s;if(l<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,a||(r=t>0?e:i,this.repetitions===1&&(r=e)),this.time=r,this._mixer.dispatchEvent({type:"finished",action:this,direction:t>0?1:-1});else{if(l===1){let c=t<0;this._setEndings(c,!c,a)}else this._setEndings(!1,!1,a);this._loopCount=s,this.time=r,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:o})}}else this.time=r;if(a&&!(1&~s))return e-(r-i)}return r}_x(),Ap(),d0(),m0(),b3(),Eh(),wx(),e8(),s8(),_a(),tt(),tt();var lz=!1,Ant=class{constructor(t,e,i,n){this.scene=t,this.requestRender=e,this.updateDisplayProgress=i,this.animationInspectorState=n,this.clipIdToAction={},this.activeClip=null,this.needsUpdate=!1,this.addClip=r=>{r.data.type==="Empty"&&Array.isArray(r.data.animations)&&r.data.animations.forEach((s,a)=>{let o=s[0]+"/";if(Array.isArray(r.identity)?o+=r.identity[0]:o+=r.uuid,this.clipIdToAction[o])return;let l=b1.parse(JSON.parse(s[2]));r.animations[a]=l;let c=this.mixer.clipAction(l,r);lz===!1&&(Object.getPrototypeOf(c)._updateTime=Ent,lz=!0),c.clampWhenFinished=!0,this.clipIdToAction[o]=c})},this.mixer=new jE(t),this.scene.traverseEntity(this.addClip)}rebindClips(){this.mixer.stopAllAction(),this.mixer=new jE(this.scene),this.clipIdToAction={},this.activeClip=null,this.scene.traverseEntity(this.addClip)}deleteClip(t,e){let i=this.scene.find(e);if(!i)return;let n=i.animations.find(s=>s.uuid===t);if(!n)return;let r=this.clipIdToAction[t];!r||(r.stop(),this.mixer.uncacheClip(n),delete this.clipIdToAction[t],i.animations=i.animations.filter(s=>s.uuid!==t))}get isPlaying(){return Object.values(this.clipIdToAction).some(t=>t.isRunning())}playFromInspector(t){this.mixer.stopAllAction();let e=this.clipIdToAction[t];!e||(e.play(),this.activeClip=e.getClip(),this.scene.markShadowsDirty(),this.requestRender())}onExitPlayMode(){Object.values(this.clipIdToAction).forEach(t=>{t.repetitions=1/0,t.loop=P_}),this.mixer.stopAllAction(),this.scene.markShadowsDirty(),this.requestRender()}play(t){let e=t.clipId+"/"+t.object,i=this.clipIdToAction[e];if(i)return i.repetitions=t.repeat>=0?t.repeat+1:1/0,i.loop=t.direction!=="pingpong"&&t.direction!=="pingpong-rewind"||t.repeat===0?P_:D_,i.play(),i.paused=!1,this.requestRender(),i}resumeFromInspector(t){let e=this.clipIdToAction[t];!e||(e.play(),e.paused=!1,this.scene.markShadowsDirty(),this.requestRender())}pauseFromInspector(t){let e=this.clipIdToAction[t];!e||(e.paused=!0)}stop(){this.mixer.stopAllAction(),this.scene.markShadowsDirty(),this.requestRender()}update(t){if(this.needsUpdate)this.needsUpdate=!1;else if(this.isPlaying===!1||this.animationInspectorState?.isScrubbing)return;this.mixer.update(t/1e3),this.activeClip&&this.updateDisplayProgress(Math.round(this.mixer.time/this.activeClip.duration*(this.maxFrames-1)%(this.maxFrames-1))),this.requestRender()}get maxFrames(){return I9(this.activeClip??void 0)}setProgressFromInspector(t,e){if(!this.clipIdToAction[e])return;this.activeClip!==this.clipIdToAction[e].getClip()&&this.playFromInspector(e);let i=this.clipIdToAction[e].paused;this.clipIdToAction[e].paused=!1,this.mixer.setTime(Math.min(t/(this.maxFrames-1),.9999)*this.activeClip.duration),this.scene.markShadowsDirty(),this.requestRender(),i&&(this.clipIdToAction[e].paused=!0)}};co(),dl(),Dk(),rd(),u0(),Ek(),c8();var Tnt={bloom:()=>Promise.resolve().then(()=>(LZ(),OZ)),chromaticAberration:()=>Promise.resolve().then(()=>(zZ(),UZ)),vignette:()=>Promise.resolve().then(()=>(kZ(),NZ)),noise:()=>Promise.resolve().then(()=>(GZ(),jZ)),hueSaturation:()=>Promise.resolve().then(()=>(qZ(),WZ)),brightnessContrast:()=>Promise.resolve().then(()=>(YZ(),$Z)),depthOfField:()=>Promise.resolve().then(()=>(QZ(),KZ)),pixelation:()=>Promise.resolve().then(()=>(eK(),tK))};function Cnt(t){return function(e,i){return Promise.all(e.map(n=>i[n]?.().catch(r=>{console.warn(`[spline] Failed to load the ${n} postprocessing effect (webgl); the effect will be skipped.`,r)}))).then(()=>{})}(t,Tnt)}var t1=new WeakMap,hz=new WeakMap;function cz(t,e,i){let n=r=>{t.removeEventListener(e,n,!0),r.stopImmediatePropagation(),i(r)};return t.addEventListener(e,n,!0),()=>t.removeEventListener(e,n,!0)}ti();var Pnt=bp(iK(),1);function e1(t){return Array.isArray(t)||ArrayBuffer.isView(t)&&!(t instanceof DataView)}function Dnt(t){return{id:t.uuid,name:t.name,type:t.object.data?.type??t.object.type,visible:t.playModeVisible!==!1,position:{x:t.position.x,y:t.position.y,z:t.position.z},rotation:{x:t.rotation.x*Ot.RAD2DEG,y:t.rotation.y*Ot.RAD2DEG,z:t.rotation.z*Ot.RAD2DEG},scale:{x:t.scale.x,y:t.scale.y,z:t.scale.z},spawned:!0}}function i1(t){return{id:t.uuid,name:t.name,type:t.type??"Object",visible:t.visible,position:{x:t.position.x,y:t.position.y,z:t.position.z},rotation:{x:t.rotation.x*Ot.RAD2DEG,y:t.rotation.y*Ot.RAD2DEG,z:t.rotation.z*Ot.RAD2DEG},scale:{x:t.scale.x,y:t.scale.y,z:t.scale.z}}}function B9(t,e,i){let n=a=>t.findObjectById(a)??t.findObjectByName(a),r=new Map,s=a=>{let o=r.get(a);if(o)return o;for(let l of r.values())if(l.name===a)return l};return{setVariable:(a,o)=>a in t.getVariables()?(t.setVariable(a,o),{ok:!0}):{ok:!1,warning:`spline.setVariable: no variable named "${a}" in this scene.`},getVariable:a=>t.getVariable(a),getVariables:()=>t.getVariables(),getAllObjects:()=>t.getAllObjects().map(i1),findObject:a=>{let o=n(a);return o?i1(o):void 0},getGeometry:(a,o)=>{if(!i)return{warning:"spline.getGeometry: not available in this runtime integration."};let l=s(a),c=l?l.object:(()=>{let p=n(a);return p?i.findEntity(p.uuid):void 0})();if(!c)return{warning:`spline.getGeometry: no object named "${a}" (names/ids come from getAllObjects).`};let h,d=l??c;o.space==="world"&&(d.updateWorldMatrix?.(!0,!1),h=d.matrixWorld?.elements);let u=function(p,f){let g=p?.getAttribute("position");if(!g||!g.count)return null;let m=g.count,v=f??null,y=p.getIndex?.()??null,_=Math.floor((y?y.count:m)/3),b=1/0,x=1/0,w=1/0,S=-1/0,E=-1/0,A=-1/0,P=new Float32Array(3*m);for(let D=0;D<m;D++){let F=g.getX(D),V=g.getY(D),U=g.getZ(D);v&&([F,V,U]=P$(v,F,V,U)),F<b&&(b=F),V<x&&(x=V),U<w&&(w=U),F>S&&(S=F),V>E&&(E=V),U>A&&(A=U),P[3*D]=F,P[3*D+1]=V,P[3*D+2]=U}let C={space:v?"world":"local",vertexCount:m,triangleCount:_,indexed:y!==null,bounds:{min:[b,x,w],max:[S,E,A],size:[S-b,E-x,A-w]},vertices:P};if(y){let D=new Uint32Array(y.count);for(let F=0;F<y.count;F++)D[F]=y.getX(F);C.indices=D}let R=p.getAttribute("normal");if(R&&R.count===m){let D=v?function(F){let V=F[0],U=F[4],j=F[8],W=F[1],it=F[5],nt=F[9],Y=F[2],ot=F[6],ht=F[10],ft=V*(it*ht-nt*ot)-U*(W*ht-nt*Y)+j*(W*ot-it*Y);if(!isFinite(ft)||Math.abs(ft)<1e-12)return null;let pt=1/ft,J=[(it*ht-nt*ot)*pt,(j*ot-U*ht)*pt,(U*nt-j*it)*pt,(nt*Y-W*ht)*pt,(V*ht-j*Y)*pt,(j*W-V*nt)*pt,(W*ot-it*Y)*pt,(U*Y-V*ot)*pt,(V*it-U*W)*pt];return[J[0],J[3],J[6],J[1],J[4],J[7],J[2],J[5],J[8]]}(v):void 0;if(!v||D){let F=new Float32Array(3*m);for(let V=0;V<m;V++){let U=R.getX(V),j=R.getY(V),W=R.getZ(V);if(D){let it=D[0]*U+D[1]*j+D[2]*W,nt=D[3]*U+D[4]*j+D[5]*W,Y=D[6]*U+D[7]*j+D[8]*W,ot=Math.hypot(it,nt,Y);ot>1e-12?(U=it/ot,j=nt/ot,W=Y/ot):(U=it,j=nt,W=Y)}F[3*V]=U,F[3*V+1]=j,F[3*V+2]=W}C.normals=F}}let L=p.getAttribute("uv");if(L&&L.count===m){let D=new Float32Array(2*m);for(let F=0;F<m;F++)D[2*F]=L.getX(F),D[2*F+1]=L.getY(F);C.uvs=D}return C}(c.geometry,h);return u?{data:{id:d.uuid,name:d.name,geometry:c.data?.geometry?.type,...u}}:{warning:`spline.getGeometry: "${d.name}" has no readable geometry \u2014 only meshes do (lights, cameras and groups have none; read a group's child meshes instead).`}},updateObject:(a,o)=>{let l=s(a);if(l){let{position:m,rotation:v,scale:y,visible:_}=o;return m&&(typeof m.x=="number"&&(l.position.x=m.x),typeof m.y=="number"&&(l.position.y=m.y),typeof m.z=="number"&&(l.position.z=m.z)),v&&(typeof v.x=="number"&&(l.rotation.x=v.x*Ot.DEG2RAD),typeof v.y=="number"&&(l.rotation.y=v.y*Ot.DEG2RAD),typeof v.z=="number"&&(l.rotation.z=v.z*Ot.DEG2RAD)),y&&(typeof y.x=="number"&&(l.scale.x=y.x),typeof y.y=="number"&&(l.scale.y=y.y),typeof y.z=="number"&&(l.scale.z=y.z)),typeof _=="boolean"&&(l.playModeVisible=_),l.updateMatrix(),t.requestRender(),!0}let c=n(a);if(!c)return!1;let{position:h,rotation:d,scale:u,visible:p,geometry:f,material:g}=o;if(f&&typeof f=="object"&&i){let m=i.findEntity(c.uuid);if(m){let{vertices:v,normals:y,uvs:_,indices:b,...x}=f;e1(v)&&i.shared.updateEntityGeometryVertices(m,{vertices:v,normals:e1(y)?y:void 0,uvs:e1(_)?_:void 0,indices:e1(b)?b:void 0}),Object.keys(x).length>0&&i.shared.updateEntityGeometryParams(m,x)}}if(g&&typeof g=="object"&&i){let m=i.findEntity(c.uuid);m&&i.shared.updateEntityMaterialParams(m,g)}return h&&(typeof h.x=="number"&&(c.position.x=h.x),typeof h.y=="number"&&(c.position.y=h.y),typeof h.z=="number"&&(c.position.z=h.z)),d&&(typeof d.x=="number"&&(c.rotation.x=d.x*Ot.DEG2RAD),typeof d.y=="number"&&(c.rotation.y=d.y*Ot.DEG2RAD),typeof d.z=="number"&&(c.rotation.z=d.z*Ot.DEG2RAD)),u&&(typeof u.x=="number"&&(c.scale.x=u.x),typeof u.y=="number"&&(c.scale.y=u.y),typeof u.z=="number"&&(c.scale.z=u.z)),typeof p=="boolean"&&(c.visible=p),t.requestRender(),!0},createObject:async(a,o)=>i1(await t.createObject(a,o)),createCustomMaterial:a=>t.createCustomMaterial(a),getTexture:(a,o)=>{if(!i)return null;let l=n(a),c=l?i.findEntity(l.uuid):void 0;if(!c)return null;let h=i.shared.getEntityTexture(c,o??{});return h?{texture:h.texture,width:h.width,height:h.height,layer:h.layerType}:null},setMaterial:(a,o)=>t.setMaterial(a,o),cloneObject:(a,o)=>i1(t.cloneObject(a,o)),removeObject:a=>t.removeObject(a),spawnObject:(a,o)=>{if(!i)return{warning:"spline.spawnObject: not available in this runtime integration."};let l=n(a),c=l?i.findEntity(l.uuid):void 0;if(!c)return{warning:`spline.spawnObject: no object named "${a}" to use as a template.`};if(r.size>=500)return{warning:"spline.spawnObject: spawn budget reached (500 live copies) \u2014 destroyObject old copies (or reuse them) instead of spawning more."};let h=i.shared.spawnRuntimeClone(c,o??{});return h?(r.set(h.uuid,h),t.requestRender(),{object:Dnt(h)}):{warning:`spline.spawnObject: "${a}" cannot be spawned from.`}},destroyObject:a=>{let o=s(a);return!(!i||!o||(r.delete(o.uuid),i.shared.destroyRuntimeClone(o),t.requestRender(),0))},setInstanceTransforms:(a,o)=>{if(!i)return-1;let l=n(a),c=l?i.findEntity(l.uuid):void 0;if(!c)return-1;let h=i.shared.setEntityInstanceTransforms(c,o);return h>=0&&t.requestRender(),h},emitEvent:(a,o,l)=>{let c=n(o);return c?(l?c.emitEventReverse(a):c.emitEvent(a),{ok:!0}):{ok:!1,warning:`spline.emitEvent: no object named "${o}".`}},requestRender:()=>t.requestRender(),addSplineEventListener:(a,o)=>{let l=c=>{o({target:{id:c.target?.id??"",name:c.target?.name??""}})};return t.addEventListener(a,l),()=>t.removeEventListener(a,l)},getCanvas:()=>e}}tt(),ti();var U9=class{constructor(t,e,i){this.iframe=t,this.bridge=e,this.observer=i}static mount(t,e,i,n){if(typeof document>"u")return null;let r=e.parentElement;if(!r)return null;getComputedStyle(r).position==="static"&&(r.style.position="relative");let s=document.createElement("iframe");s.setAttribute("sandbox","allow-scripts allow-forms allow-pointer-lock"),s.title="Spline HTML content";let a=s.style;a.position="absolute",a.border="0",a.background="transparent",a.pointerEvents="auto",a.colorScheme="normal";let o=()=>{a.left=`${e.offsetLeft}px`,a.top=`${e.offsetTop}px`,a.width=`${e.offsetWidth}px`,a.height=`${e.offsetHeight}px`};o();let l=new ResizeObserver(o);l.observe(e),l.observe(r),s.srcdoc=function(h){let d=`<script>${KF}<\/script>`,u=/<head(\s[^>]*)?>/i.exec(h);if(u){let f=u.index+u[0].length;return h.slice(0,f)+d+h.slice(f)}let p=/<html(\s[^>]*)?>/i.exec(h);if(p){let f=p.index+p[0].length;return h.slice(0,f)+`<head>${d}</head>`+h.slice(f)}return d+h}(i),r.insertBefore(s,e.nextSibling);let c=new JF(s,B9(t,e,n),(h,d)=>{h==="warn"?console.warn(`[spline html] ${d}`):h==="error"&&console.error(`[spline html] ${d}`)});return c.attach(),new U9(s,c,l)}dispose(){this.bridge.dispose(),this.observer.disconnect(),this.iframe.remove()}};ti();var Y1="data-spline-html-content",Rnt=`
9945
9945
  [${Y1}] { pointer-events: none; }
9946
9946
  [${Y1}] > * { pointer-events: auto; }
9947
9947
  [${Y1}] [data-spline-passthrough] { pointer-events: none; }
9948
- `,z9=class{constructor(t,e,i,n,r,s){this.container=t,this.host=e,this.observer=i,this.spline=n,this.previousSplineGlobal=r,this.removeLateLifecycleShim=s}static mount(t,e,i,n){if(typeof document>"u")return null;let r=e.parentElement;if(!r)return null;getComputedStyle(r).position==="static"&&(r.style.position="relative");let s=document.createElement("div");s.setAttribute(Y1,"");let a=s.style;a.position="absolute",a.overflow="hidden";let o=()=>{a.left=`${e.offsetLeft}px`,a.top=`${e.offsetTop}px`,a.width=`${e.offsetWidth}px`,a.height=`${e.offsetHeight}px`};o();let l=new ResizeObserver(o);l.observe(e),l.observe(r);let c=document.createElement("style");c.textContent=Rnt,s.appendChild(c);let h=new DOMParser().parseFromString(i,"text/html"),d=Array.from(h.querySelectorAll("script"));for(let y of d)y.remove();for(let y of Array.from(h.head.children))(y.tagName==="STYLE"||y.tagName==="LINK"&&y.rel==="stylesheet")&&s.appendChild(y);for(;h.body.firstChild;)s.appendChild(h.body.firstChild);r.insertBefore(s,e.nextSibling);let u=new Map,p=new jC(B9(t,e,n),(y,_)=>{y==="warn"?console.warn(`[spline html] ${_}`):y==="error"&&console.error(`[spline html] ${_}`)},(y,_)=>{let b=u.get(y);if(b)for(let x of b)try{x(_)}catch(w){console.error(w)}}),f=(y,_)=>{try{return Promise.resolve(p.execute(y,_))}catch(b){return Promise.reject(b)}},g={ready:Promise.resolve(),setVariable:(y,_)=>f("setVariable",[y,_]),setVariables:y=>f("setVariables",[y]),getVariable:y=>f("getVariable",[y]),getVariables:()=>f("getVariables",[]),getAllObjects:()=>f("getAllObjects",[]),findObjectByName:y=>f("findObjectByName",[y]),findObjectById:y=>f("findObjectById",[y]),getGeometry:(y,_)=>f("getGeometry",[y,_??{}]),updateObject:(y,_)=>f("updateObject",[y,_]),createObject:(y,_)=>f("createObject",[y,_??{}]),createCustomMaterial:y=>f("createCustomMaterial",[y]),getTexture:(y,_)=>f("getTexture",[y,_??{}]),setMaterial:(y,_)=>f("setMaterial",[y,_]),cloneObject:(y,_)=>f("cloneObject",[y,_??{}]),removeObject:y=>f("removeObject",[y]),spawnObject:(y,_)=>f("spawnObject",[y,_??{}]),destroyObject:y=>f("destroyObject",[y]),setInstanceTransforms:(y,_)=>f("setInstanceTransforms",[y,_??null]),emitEvent:(y,_)=>f("emitEvent",[y,_]),emitEventReverse:(y,_)=>f("emitEventReverse",[y,_]),requestRender:()=>f("requestRender",[]),addEventListener:(y,_)=>{if(typeof _!="function")return;let b=u.get(y);b||(b=new Set,u.set(y,b),f("listenEvent",[y])),b.add(_)},removeEventListener:(y,_)=>{let b=u.get(y);!b||(b.delete(_),b.size===0&&(u.delete(y),f("unlistenEvent",[y])))}},m=window.spline;window.spline=g;let v=function(){if(typeof document>"u"||document.readyState==="loading")return()=>{};let y=[],_=(x,w)=>{let S=new Set,E=x.addEventListener.bind(x),A=x.removeEventListener.bind(x);Object.defineProperty(x,"addEventListener",{configurable:!0,writable:!0,value:(P,C,R)=>{if(E(P,C,R),!w.includes(P)||C==null)return;let L={type:P,listener:C};S.add(L),queueMicrotask(()=>{!S.delete(L)||((D,F,V)=>{let U=new Event(V);try{typeof F=="function"?F.call(D,U):F.handleEvent?.(U)}catch(j){console.error(j)}})(x,L.listener,L.type)})}}),Object.defineProperty(x,"removeEventListener",{configurable:!0,writable:!0,value:(P,C,R)=>{A(P,C,R);for(let L of S)L.type===P&&L.listener===C&&S.delete(L)}}),y.push(()=>{delete x.addEventListener,delete x.removeEventListener,S.clear()})};_(document,["DOMContentLoaded"]),_(window,["load"]);let b=Object.getOwnPropertyDescriptor(window,"onload");return Object.defineProperty(window,"onload",{configurable:!0,get:()=>null,set:x=>{typeof x=="function"&&queueMicrotask(()=>{try{x.call(window,new Event("load"))}catch(w){console.error(w)}})}}),y.push(()=>{b?Object.defineProperty(window,"onload",b):delete window.onload}),()=>{for(let x of y)x()}}();for(let y of d){let _=document.createElement("script");for(let b of Array.from(y.attributes))_.setAttribute(b.name,b.value);y.src?_.async=!1:_.textContent=y.textContent,s.appendChild(_)}return new z9(s,p,l,g,m,v)}dispose(){this.removeLateLifecycleShim(),this.host.dispose(),this.observer.disconnect(),this.container.remove(),window.spline===this.spline&&(window.spline=this.previousSplineGlobal)}};function F9(t){return typeof t=="object"&&t!==null&&t.isMaterial===!0}function dz(t){if(typeof t.material=="function")throw new Error("createObject: a (three) => material factory must be resolved to a material instance before object creation \u2014 this entry point does not support it.");if(!F9(t.material))return{options:t};let e=t.material;if(e.isNodeMaterial===!0){let i=C6()?.NodeMaterial;if(i!==void 0&&e instanceof i)return{options:{...t,material:void 0},material:e};throw new Error("createObject: this TSL NodeMaterial comes from your own three/webgpu module instance, which cannot compile in the runtime's bundled three. Build it with app.createCustomMaterial((three) => \u2026) instead, or use a built-in material (MeshStandardMaterial, MeshBasicMaterial, \u2026).")}if(e.isShaderMaterial===!0)throw new Error("createObject: a GLSL ShaderMaterial cannot compile on the WebGPU backend \u2014 port the shader to TSL with app.createCustomMaterial((three) => \u2026), or use a built-in material (MeshStandardMaterial, \u2026).");return{options:{...t,material:void 0},material:e}}$t(),Ye(),tt(),M6(),_a(),Ye(),$t(),pY(),Mh();var Int=new Set(["name","parent","position","rotation","scale","visible","castShadow","receiveShadow","color","material"]),uz="'Cube', 'Sphere', 'Plane', 'Rectangle', 'Ellipse', 'Triangle', 'Polygon', 'Star', 'Cone', 'Cylinder', 'Pyramid', 'Torus', 'TorusKnot', 'Dodecahedron', 'Icosahedron', 'Helix', 'Backdrop', 'Lathe', 'Text', 'CustomMesh', 'Group', 'PointLight', 'SpotLight', 'DirectionalLight'",Ont={cube:"CubeGeometry",box:"CubeGeometry",sphere:"SphereGeometry",plane:"PlaneGeometry",rectangle:"RectangleGeometry",ellipse:"EllipseGeometry",circle:"EllipseGeometry",triangle:"TriangleGeometry",polygon:"PolygonGeometry",star:"StarGeometry",cone:"ConeGeometry",cylinder:"CylinderGeometry",pyramid:"PyramidGeometry",torus:"TorusGeometry",torusknot:"TorusKnotGeometry",dodecahedron:"DodecahedronGeometry",icosahedron:"IcosahedronGeometry",helix:"HelixGeometry",backdrop:"BackdropGeometry",lathe:"LatheGeometry",text:"TextGeometry",custommesh:"NonParametricGeometry",nonparametric:"NonParametricGeometry"},Lnt={group:"Empty",empty:"Empty",pointlight:"PointLight",spotlight:"SpotLight",directionallight:"DirectionalLight"},Bnt={shapeblend:"Shape Blends are built from member meshes in the editor and cannot be created empty.",path:"Path shapes need authored path data \u2014 clone an existing one with cloneObject() instead.",vector:"Vector shapes need authored shape data \u2014 clone an existing one with cloneObject() instead.",shape:"Vector shapes need authored shape data \u2014 clone an existing one with cloneObject() instead.",boolean:"Boolean operations are not creatable at runtime \u2014 clone an existing Boolean object with cloneObject() instead.",decal:"Decals need a surface to project onto \u2014 clone an existing Decal with cloneObject() instead.",ui:"UI objects need a 2D frame \u2014 clone an existing one with cloneObject() instead.",input:"Text inputs are not creatable at runtime \u2014 clone an existing one with cloneObject() instead.",particle:"Particle emitters are not creatable at runtime \u2014 clone an existing one with cloneObject() instead.",particlecollider:"Particle forces are not creatable at runtime \u2014 clone an existing one with cloneObject() instead.",hair:"Hair systems are not creatable at runtime \u2014 clone an existing one with cloneObject() instead.",camera:"Cameras are not creatable at runtime.",perspectivecamera:"Cameras are not creatable at runtime.",orthographiccamera:"Cameras are not creatable at runtime.",hemispherelight:"Hemisphere lights are not creatable at runtime.",splat:"Splats are not creatable at runtime.",page:"Pages are not creatable at runtime.",component:"Components are authored in the editor.",instance:"Instances are authored in the editor \u2014 clone an existing one with cloneObject() instead.",bone:"Bones are not creatable at runtime.",mesh:"pass the shape name directly, e.g. createObject('Cube')."},Unt={CubeGeometry:"Cube",SphereGeometry:"Sphere",PlaneGeometry:"Plane",RectangleGeometry:"Rectangle",EllipseGeometry:"Ellipse",TriangleGeometry:"Triangle",PolygonGeometry:"Pentagon",StarGeometry:"Star",ConeGeometry:"Cone",CylinderGeometry:"Cylinder",PyramidGeometry:"Pyramid",TorusGeometry:"Torus",TorusKnotGeometry:"Torus Knot",DodecahedronGeometry:"Dodecahedron",IcosahedronGeometry:"Icosahedron",HelixGeometry:"Helix",BackdropGeometry:"Backdrop",LatheGeometry:"Lathe",TextGeometry:"Text",NonParametricGeometry:"Custom Mesh"},znt={Empty:"Group",PointLight:"Point Light",SpotLight:"Spot Light",DirectionalLight:"Directional Light"};function t0(t,e){return t===void 0?[e[0],e[1],e[2]]:Array.isArray(t)?[t[0]??e[0],t[1]??e[1],t[2]??e[2]]:[t.x??e[0],t.y??e[1],t.z??e[2]]}function N9(t){return typeof t=="number"?[t,t,t]:t0(t,[1,1,1])}function MC(t){let e=new yn(0,0,0,1);return e.setStyle(t),{r:e.r,g:e.g,b:e.b}}function pz(t,e){let i=t.material??(t.color!==void 0?{color:t.color}:void 0);if(i===void 0)return Vi.defaultColorMaterial(fz(Ir),"physical","layer1","layer2");if(typeof i=="string"){for(let[a,o]of Object.entries(e.shared.materials))if(a===i||o.name===i)return a;if(function(a){let o=a.trim().toLowerCase();return/^#([0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(o)||/^(rgb|hsl)a?\(/.test(o)||Jt.NAMES[o]!==void 0}(i))return Vi.defaultColorMaterial(MC(i),"physical","layer1","layer2");throw new Error(`createObject: material '${i}' matches no shared material in this document (available: ${function(a){let o=Object.entries(a.shared.materials).map(([,l])=>`'${l.name}'`).filter(l=>l!=="'undefined'");return o.length?o.join(", "):"(none)"}(e)}) and is not a valid CSS color.`)}if(typeof i=="function")throw new Error("createObject: a (three) => material factory must be resolved to a material instance before object creation \u2014 this entry point does not support it.");if(F9(i))throw new Error("createObject: a three.js material instance cannot be stored in the document \u2014 this entry point does not support it.");let n=i.color!==void 0?MC(i.color):fz(Ir),r=Vi.defaultColorMaterial(n,"physical","layer1","layer2"),s=r.layers.find(a=>a.data.type==="light");if(s){let a={};i.roughness!==void 0&&(a.roughness=i.roughness),i.metalness!==void 0&&(a.metalness=i.metalness),i.reflectivity!==void 0&&(a.reflectivity=i.reflectivity),Object.assign(s.data,a)}if(i.alpha!==void 0){let a=r.layers.find(o=>o.data.type==="color");a&&Object.assign(a.data,{alpha:i.alpha})}return r}function fz(t){return{r:(t>>16&255)/255,g:(t>>8&255)/255,b:(255&t)/255}}function Fnt(t){let e=Yo.defaultData("TextGeometry"),{text:i,...n}=t,r=n.fontSize;return r!==void 0&&n.width===void 0&&(n.width=350*r/16),r!==void 0&&n.height===void 0&&(n.height=50*r/16),Object.assign(e,n),i!==void 0&&Object.assign(e,{text:{textValue:String(i)}}),e}function n1(t){return Array.isArray(t)?t:!ArrayBuffer.isView(t)||t instanceof DataView?null:Array.from(t)}function Nnt(t,e){return KN({userData:{type:t,...uT[t].normalizeInputs({parameters:e})}})}function knt(t,e,i){let{objectType:n,geometryType:r}=t,s=function(l){let c={};for(let[h,d]of Object.entries(l))!Int.has(h)&&d!==void 0&&(c[h]=d);return c}(e),a={states:new Vt,events:new Vt};if(n==="Mesh"&&r){if(r==="NonParametricGeometry"){let{geometry:l,doubleSide:c}=function(h){let d=n1(h.vertices);if(!d||d.length<9||d.length%3!=0)throw new Error("createObject('CustomMesh'): `vertices` must be a flat number[] of x,y,z triples (length a multiple of 3, at least one triangle).");let u=d.length/3;if(u>6e4)throw new Error(`createObject('CustomMesh'): too many vertices (${u}); keep it under 60000.`);let p=n1(h.indices);if(p&&p.length){let _=p.find(b=>!Number.isInteger(b)||b<0||b>=u);if(_!==void 0)throw new Error(`createObject('CustomMesh'): index ${_} is out of range (mesh has ${u} vertices).`)}else p=null;let f=new jt;f.setAttribute("position",new Nt(d,3));let g=n1(h.normals),m=g!==null&&g.length===d.length;m&&f.setAttribute("normal",new Nt(g,3));let v=n1(h.uvs);v&&v.length===2*u&&f.setAttribute("uv",new Nt(v,2));let y=!1;if(!m){let _=p??Array.from({length:u},(w,S)=>S),{closed:b,inverted:x}=function(w,S){let E=w.length/3,A=new Map,P=new Array(E);for(let D=0;D<E;D++){let F=`${Math.round(1e4*w[3*D])},${Math.round(1e4*w[3*D+1])},${Math.round(1e4*w[3*D+2])}`,V=A.get(F);V===void 0?(A.set(F,D),P[D]=D):P[D]=V}let C=new Map;for(let D=0;D+2<S.length;D+=3){let F=P[S[D]],V=P[S[D+1]],U=P[S[D+2]];for(let[j,W]of[[F,V],[V,U],[U,F]]){if(j===W)continue;let it=j<W?j+"_"+W:W+"_"+j;C.set(it,(C.get(it)??0)+1)}}let R=C.size>0;for(let D of C.values())if(D!==2){R=!1;break}if(!R)return{closed:!1,inverted:!1};let L=0;for(let D=0;D+2<S.length;D+=3){let F=3*S[D],V=3*S[D+1],U=3*S[D+2],j=w[F],W=w[F+1],it=w[F+2],nt=w[V],Y=w[V+1],ot=w[V+2],ht=w[U],ft=w[U+1],pt=w[U+2];L+=j*(Y*pt-ot*ft)+W*(ot*ht-nt*pt)+it*(nt*ft-Y*ht)}return{closed:!0,inverted:L<0}}(d,_);if(b&&x){for(let w=0;w+2<_.length;w+=3){let S=_[w+1];_[w+1]=_[w+2],_[w+2]=S}p=_}else b||(y=!0)}return p&&f.setIndex(p),m||f.computeVertexNormals(),{geometry:KN({userData:{type:"NonParametricGeometry",parameters:{subdivisions:0}},data:f.toJSON().data}),doubleSide:y}}(s);Object.assign(a,Wa.defaultData,{geometry:l,materials:[pz(e,i)]}),c&&(a.side=2)}else Object.assign(a,Wa.defaultData,{geometry:r==="TextGeometry"?Fnt(s):Nnt(r,s),material:pz(e,i)});e.castShadow!==void 0&&(a.castShadow=e.castShadow),e.receiveShadow!==void 0&&(a.receiveShadow=e.receiveShadow)}else n==="Empty"?Object.assign(a,rb.defaultData):(Object.assign(a,sb.defaultData(n),s),e.color!==void 0&&(a.color=MC(e.color)));a.visible=e.visible??!0,a.position=t0(e.position,[0,0,0]),a.rotation=t0(e.rotation,[0,0,0]),a.scale=N9(e.scale);let o=(r&&Unt[r])??znt[n]??n;return a.name=e.name??k9(o,i.scene.objects),a}function k9(t,e){let i=new Set;if(e.traverse((r,s)=>{i.add(s.name??"")}),!i.has(t))return t;let n=2;for(;i.has(`${t} ${n}`);)n++;return`${t} ${n}`}function V9(t,e){let i=Ot.generateUUID();if(t.data.type==="Component")return{data:{...nl.fromComponentData(t),name:t.data.name+" Instance"},id:i,fi:t.fi,children:[]};e[t.id]=i;let n=t.data;return n.type==="Empty"&&n.animations?.length&&(n={...n,animations:n.animations.map(([r,s,a])=>{let o=Ot.generateUUID(),l=a.indexOf(r);return[o,s,l!==-1?a.slice(0,l)+o+a.slice(l+r.length):a]})}),{...t,id:i,data:n,children:t.children.map(r=>V9(r,e))}}function Vnt(t){let e={};return function(i,n){return Xu(i,n,null)??i}(V9(t,e),e)}function jnt(t){let e=Array.isArray(t)?t[0]:t,i=e.layers?.map(Gnt)??[],n=e.layers?.find(r=>r.type==="light");return{layers:i,alpha:n?.node.alphaOverride?.value??1}}function Gnt(t){return t.type==="texture"||t.type==="video"||t.type==="matcap"?{...t.data,updateTexture:e=>t.color.texture.image.updateSrc(e)}:{...t.data}}Mh(),Bi(),y3(),_a();var bm=new yn(0,0,0,1),Hnt={color:["color"],cavity:[],dust:["color"],fresnel:["color"],normal:[],gradient:["colors"],depth:["colors"],texture:[],video:[],noise:["colorA","colorB","colorC","colorD"],toon:["colors","shadowColor"],outline:["outlineColor","contourColor"],transmission:["attenuationColor"],reflection:[],matcap:[],pattern:["colorA","colorB"],vertexColor:[],light:[],displace:[],rainbow:[],particle:[]};$t(),$t();var Wnt=new et;function mz(t){let e=new yn(0,0,0,1);try{e.setStyle(t)}catch(i){console.error(i)}return e}var j9=class{constructor(t,{renderOnDemand:e,renderMode:i="auto",wasmPath:n,renderer:r,htmlContentMode:s="sandbox"}={}){if(this._rendererBackend="webgl",this._rendererAuto=!1,this._rendererConfigured=!1,this._viewportMode=1,this._viewportWidth=window.innerWidth,this._viewportHeight=window.innerHeight,this._proxyObjectCache=new Map,this._htmlContentMode="sandbox",this._variablesCache=new Map,this._isPaused=!1,this._renderRequested=!1,this._skipRender=!1,this.time=performance.now(),this.dt=0,this.currentTAAFrame=0,this.disposed=!1,this._requestRenderAutoMode=()=>{this._skipRender=!1},this.requestRender=()=>{this._renderRequested=!0},this.render=a=>{if(this.time=a,this._lastTime&&(this.dt=this.time-this._lastTime),this._lastTime=this.time,this._perfs?.start(),this._renderer)if(this._isPaused||!(this.renderMode==="manual"&&!this._renderRequested||this.renderMode==="auto"&&this._skipRender)){if(this._renderRequested=!1,this._skipRender=!0,this._controls&&(this._skipRender=this._controls.update(this.dt)??!1),this._eventManager&&(this._eventManager.handlers?.Start?.hasVideoAction||this._eventManager.handlers?.Basic?.hasVideoAction||this._eventManager.handlers?.Conditional?.hasVideoAction)&&(this._skipRender=!1),this._animationControls?.update(this.dt),this._skipRender?(this.currentTAAFrame++,this.currentTAAFrame<JN?this._skipRender=!1:this.currentTAAFrame=0):this.currentTAAFrame=0,this._scene?.traverseVisibleEntity(o=>{o.type==="ParticleSystem"&&(o.update(this.dt),this._skipRender=!1),Yc(o)&&(this._renderer?.isWebGPUSplineRenderer!==!0&&o.warnClassicFallbackOnce(),o.isSimulating&&(o.update(this.dt),this._skipRender=!1))}),this._scene&&this._scene.activeCamera!==this._camera&&(this._camera=this._scene.activeCamera),this._eventManager?.isEnabled&&(this._eventManager.handlers?.Follow?.onAnimationFrameDamping(),this._eventManager.handlers?.LookAt?.onAnimationFrameDamping(),this._eventManager.handlers?.DragDrop?.onAnimationFrameDamping()),this._scene&&this._camera){if(this._scene.pathConstraints.applyConstraints(this._scene),this._renderer.sceneTransitionTimeRemaining>0){this._renderer.sceneTransitionTimeRemaining-=this.dt;let o=Math.min(1,1-this._renderer.sceneTransitionTimeRemaining/this._renderer.sceneTransitionDuration);this._renderer.pipeline.sceneTransitionPass.uniforms.mixRatio.value=o,this._skipRender=!1}else this._renderer.pipeline.sceneTransitionFromTexture=null;this._renderer.renderSplineScene(this._scene,this._camera),this._renderer.lastFrameIncomplete===!0&&(this._skipRender=!1),this._renderer.skyAnimationActive===!0&&(this._skipRender=!1)}this.canvas.dispatchEvent(this._renderedEvent),this._perfs?.end()}else this._perfs?.end();else this._perfs?.end()},this._resize=a=>{if(this._renderer){if(this._viewportMode===1&&this._frameView&&(this._frameView.frameSize=Wnt.set(this._viewportWidth,this._viewportHeight)),a){let o=this._viewportWidth,l=this._viewportHeight;this._renderer.setSize(o-1,l-1,!1),this._renderer.setSize(o,l,!1)}else this._renderer.setSize(this._viewportWidth,this._viewportHeight,!1);this._camera=this._scene?.activeCamera,this._scene?.updateViewPlaneSize(this._frameView?.frameSize?.x??this._viewportWidth,this._frameView?.frameSize?.y??this._viewportHeight,this._frameView?.enableResponsive??!1),this._camera&&(this._frameView?.setCamera(this._camera),this._frameView?.updateCamera(),this._camera.cameraType==="PerspectiveCamera"&&(this._camera.aspect=this._viewportWidth/this._viewportHeight),this._camera.updateProjectionMatrix()),this.eventManager&&(this.eventManager.eventContext.domRect=this.canvas.getBoundingClientRect()),this._requestRenderAutoMode()}},this._debouncedResize=Vg(this._resize,10),this._onScroll=a=>{this.eventManager&&(this.eventManager.eventContext.domRect=this.canvas.getBoundingClientRect())},this.canvas=t,this._htmlContentMode=s,this.renderMode=e?"auto":i,n!==void 0&&(this._wasmPath=function(a){let o=a.length;for(;o>0&&"/".includes(a[o-1]);)o--;return a.slice(0,o)}(n)),this._rendererBackend=r??"webgl",r===void 0){let a=null;try{a=new URLSearchParams(window.location.search).get("renderer")}catch{}a==="webgpu"||a==="webgl"||a==="webgl2"?this._rendererBackend=a==="webgl2"?"webgl":a:(this._rendererAuto=!0,this._rendererBackend="webgl")}this._renderedEvent=new CustomEvent("rendered",{bubbles:!0}),Object.defineProperty(this._renderedEvent,"target",{writable:!1,value:this}),window.location.search.includes("perfs")&&Promise.resolve().then(()=>(nK(),D8)).then(({Perfs:a})=>{this._perfs=new a({x:10,y:10})}),function(a){a.addEventListener("pointerdown",yI,!0),a.addEventListener("pointerdown",yv,!0),a.addEventListener("pointermove",yv,!0),a.addEventListener("pointerup",Bd,!0),a.addEventListener("pointercancel",Bd,!0),a.addEventListener("pointerleave",Bd,!0),window.addEventListener("keydown",_I,!0),window.addEventListener("keyup",bI,!0)}(t)}async _initRenderer(){if(this.disposed)return null;let t=await this._createRenderer();return this.disposed?(this._disposeRenderer(t),null):t}_disposeRenderer(t){let e=function(n){let r=n.backend;if(r!==void 0)return r.isWebGLBackend===!0?r.gl??null:null;let s=n.getContext,a=typeof s=="function"?s.call(n):null;return a&&typeof a.getExtension=="function"?a:null}(t);if(e&&!function(n,r){return hz.get(n)===r}(this.canvas,this))return void(function(n){return n.backend?.isWebGLBackend===!0}(t)||t.dispose());let i=e?function(n,r){let s=r.getExtension("WEBGL_lose_context");if(!s||r.isContextLost())return()=>{};let a=()=>{},o=new Promise(l=>{a=cz(n,"webglcontextlost",c=>{c.preventDefault(),l(s)})});return t1.set(n,{gl:r,lost:o,stopListening:a}),()=>{r.isContextLost()||s.loseContext()}}(this.canvas,e):void 0;try{t.dispose()}finally{i?.()}}async _createRenderer(){(function(t,e){hz.set(t,e)})(this.canvas,this),await async function(t){let e=t1.get(t);if(e&&(e.restoring??(e.restoring=async function(i,n){if(!n.gl.isContextLost())return void n.stopListening();let r,s=()=>{},a=n.lost.then(l=>new Promise(c=>{s=cz(i,"webglcontextrestored",()=>c()),l.restoreContext()})),o=new Promise(l=>{r=setTimeout(l,2e3)});await Promise.race([a,o]),clearTimeout(r),s(),n.stopListening()}(t,e).finally(()=>{e.restoring=void 0,!e.gl.isContextLost()&&t1.get(t)===e&&t1.delete(t)})),await e.restoring,e.gl.isContextLost()))throw new Error("[spline] The browser did not restore the WebGL context this canvas had before dispose(); the scene cannot render on it. Use a new canvas.")}(this.canvas),this._rendererBackend,this._rendererBackend;{let{SplineRenderer:t,rendererGlobals:e}=await Promise.resolve().then(()=>(z5(),WT));try{new URLSearchParams(window.location.search).get("taa")==="off"&&(e.taaEnabled.value=!1)}catch{}return new t({canvas:this.canvas,antialias:!1,alpha:!0,stencil:!1,depth:!1,powerPreference:"high-performance"})}}_failWebGPURequired(){console.error('[spline] This scene was exported for WebGPU only and this browser does not provide a WebGPU adapter. Re-export with renderer "Both" or "WebGL 2" to support this browser.');try{let t=window.devicePixelRatio||1,e=this.canvas.clientWidth||300,i=this.canvas.clientHeight||150;this.canvas.width=e*t,this.canvas.height=i*t;let n=this.canvas.getContext("2d");n&&(n.scale(t,t),n.fillStyle="rgba(127, 127, 127, 0.85)",n.font="13px system-ui, -apple-system, Segoe UI, Roboto, sans-serif",n.textAlign="center",n.textBaseline="middle",n.fillText("This scene requires a WebGPU-capable browser.",e/2,i/2))}catch{}this.canvas.dispatchEvent(new CustomEvent("splineerror",{bubbles:!0,detail:{reason:"webgpu-required"}}))}async load(t,e,i){(function(r){let s="The Spline Runtime only accepts .splinecode files that are generated from Spline export panel.";r.endsWith(".spline")?console.warn(s+" The .spline files are only meant to be used by the Editor."):r.endsWith(".splinecode")||console.warn(s)})(t),this.disposed=!1;let n=await(await fetch(t,i)).arrayBuffer();await this.start(n,{variables:e})}async start(t,{interactive:e=!0,variables:i}={}){if(this.disposed)return;nn.init();let n=await async function(u){let[p,f]=Bm(jg.deserialize(new Uint8Array(u)));if((p.schema??0)!==132){let{updateDocumentSchema:g}=await Promise.resolve().then(()=>(ux(),VN));g(p)}return f.result().data}(t);this._data=n;let r=function(u){let p=[];return u.scene.objects.traverse((f,g)=>{g.type==="Mesh"&&g.geometry.type==="NonParametricGeometry"&&g.geometry.data.draco!==void 0&&p.push(g)}),p}(n);n.version&&(0,Pnt.default)(n.version,"2.0.77")>0&&console.warn("Your .splinecode file is more recent than the library. Please upgrade @splinetool/runtime to the latest version."),this._wasmPath!==void 0&&(this.setUIWasmUrl(`${this._wasmPath}/hana-ui.wasm`),function(u){h8=u}(this._wasmPath));let s=async function(){}();await Promise.all([s,r.length&&az(this._wasmPath),TL(n)&&xY(this._wasmPath),GY(n)&&jY(this._wasmPath),rZ(n)&&ZY(this._wasmPath),$c.physicsEnabled(n.scene.objects)&&Rtt(this._wasmPath),C4(n)&&VB(),UL(n)&&MZ(),RY(n)&&DY(),OB(n)&&s.then(()=>kA()?.loadHanaUIRUNTIME()),Mtt(n)&&Xtt(this._wasmPath)].filter(Boolean)),r.length&&await oz(r),this._eventManager?.deactivate(),this._controls?.deactivate(),this._scene?.dispose();let a=n.scene.publish.renderer;if(this._rendererAuto&&a==="webgl")this._rendererBackend="webgl";else if(this._rendererAuto&&a==="webgpu")return void this._failWebGPURequired();let o=function(u){let p=new Set;return u.scene.objects.traverse((f,g)=>{if(g.type!=="Page")return;let m=g.postprocessing;if(m&&typeof m=="object"&&m.enabled===!0)for(let[v,y]of Object.entries(m))v!=="enabled"&&y&&typeof y=="object"&&y.enabled===!0&&p.add(v)}),[...p]}(n);this._rendererBackend,this._rendererBackend!=="webgpu"&&await Promise.all([Promise.resolve().then(()=>(z5(),WT)),Cnt(o)]),function(u){Mx=u}((this._rendererBackend,"webgl"));let l=new Snt(n);if(l.resetPersonalCameraFromDocumentData(),this._scene=l.scene,this._sharedAssetsManager=l.sharedAssets,this._camera=this._scene.activeCamera,window.location.search.includes("merge-geometries")){let{mergeStaticGeometries:u}=await Promise.resolve().then(()=>(FQ(),fj)),p=performance.now();u(n,l.scene);let f=performance.now();console.log("Merged geometries in ",f-p," ms")}TL(n)&&this._scene.traverse(u=>{eo(u)&&u.recomputeBoolean()}),this._sharedAssetsManager.setRequestRender(()=>{this._requestRenderAutoMode(),this._scene?.traverse(u=>{zu(u)&&u.pendingMediaLoad&&u.update({scene:this._scene,shared:this._sharedAssetsManager})})}),this._scene?.traverse(u=>{u.type==="ParticleSystem"&&(u.wakeUp(),u.data.autoPlay?u.start():u.stop()),Yc(u)&&u.setPlayMode(!0)});let c=Object.keys(n.shared.fonts).flatMap(u=>{let p=this._sharedAssetsManager.getFont(u);return p?[p.loadingPromise]:[]});if(Promise.all(c).then(()=>{this.disposed||(l.scene.markNeedsUpdateRendererDirty(),this._requestRenderAutoMode())}),C4(n)&&function(u){if($c.physicsEnabled(u.scene.objects))return!0;let p=!1;return u.scene.objects.traverse((f,g)=>{if(g.events){if(Array.isArray(g.events)){for(let m of g.events)if(m.data.disabled!==!0&&m.data.type==="GameControl"&&m.data.collisionEnabled){p=!0;break}}else for(let m of Object.values(g.events))if(m.disabled!==!0&&m.type==="GameControl"&&m.collisionEnabled){p=!0;break}}}),p}(n)&&await Promise.all(c),OB(n)){let u=[];this._scene.traverseEntity(p=>{(Pr(p)||p instanceof mn)&&p.uiCanvas&&u.push(p.uiCanvas)}),await Promise.all(u.map(p=>p.promise))}if(this._scene.rewriteEventsBeforeGoToPlayMode(),bP(this._scene.activePage,this._sharedAssetsManager),!this._renderer){let u=await this._initRenderer();if(!u)return;this._renderer=u}if(!this._rendererConfigured){this._rendererConfigured=!0,this._renderer.hdTransmission=n.scene.publish.hdTransmission===!0;let u=()=>/Mobi|Android|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),p=this._getPixelRatio(u()?n.scene.publish.settings.web.pixelRatioMobile:n.scene.publish.settings.web.pixelRatioDesktop);if(this._renderer.setPixelRatio(p),this._renderer.pipeline.enableUIOverlay(),this._renderer.pipeline.addEventListener("smaaloaded",this._requestRenderAutoMode),n.shared.images.SplineWatermark){let f=this._sharedAssetsManager.getImage("SplineWatermark");await f.loadPromise;let g=f.getTexture(1001);this._renderer.pipeline.setWatermark(g)}}UL(n)&&this._scene.initializeSplatViewer(),n.scene.blueNoiseTextureData!==void 0&&this._renderer.pipeline.updateBlueNoiseTexture(n.scene.blueNoiseTextureData);let h=Object.values(n.frames)[0];if(this._frameView?this._frameView.setCamera(this._camera):(h.preset==="fullscreen"?(this._viewportMode=1,this.canvas.style.display="block",this.canvas.parentElement&&(this._viewportWidth=this.canvas.parentElement.clientWidth||300,this.canvas.style.width="100%"),this.canvas.parentElement&&(this._viewportHeight=this.canvas.parentElement.clientHeight||150,this.canvas.style.height="100%")):(this._viewportMode=2,this._viewportWidth=h.size[0],this._viewportHeight=h.size[1],this.canvas.style.width=`${this._viewportWidth}px`,this.canvas.style.height=`${this._viewportHeight}px`),this._renderer.setSize(this._viewportWidth,this._viewportHeight,!1),this._frameView=new _J(this._renderer,this._camera,new et(this._viewportWidth,this._viewportHeight)),this._frameView.enableResponsive=(h.allowResponsive??!1)&&h.preset==="fullscreen"),e){let u=new QQ(this._renderer,this.data.scene.publish,this._scene,()=>this._scene.activeCamera,this._sharedAssetsManager,this._requestRenderAutoMode,!0,h);this._scene.updateMatrixWorld(!0),this._controls=new Btt(u),this._animationControls=new Ant(this._scene,this._requestRenderAutoMode),this._eventManager=new pJ(n.scene.publish,this._controls,this._animationControls,u,n.shared.variables),this._eventManager.activate(),this._controls.activate(this._eventManager)}this._resize(),this._scene.activePage.data.postprocessing.depthOfField.enabled&&Promise.all(this._sharedAssetsManager.getImageLoadPromises()).then(()=>{this.disposed||this._resize(!0)}),i!==void 0&&this.setVariables(i),this.dt===0&&(this.render(performance.now()),setTimeout(()=>{this._renderer?.setAnimationLoop(this.render)},0)),this._resizeObserverTimeout=setTimeout(()=>{!this._resizeObserver&&this.canvas.parentElement&&(this._resizeObserver=new ResizeObserver(()=>{this._viewportWidth=this.canvas.clientWidth,this._viewportHeight=this.canvas.clientHeight,this._debouncedResize()}),this._resizeObserver.observe(this.canvas.parentElement))},300),document.addEventListener("scroll",this._onScroll),e&&(this._htmlContentOverlay?.dispose(),this._htmlContentOverlay=void 0);let d=n.scene.publish.htmlContent?.html;if(e&&d&&this._htmlContentMode!=="none"){let u={shared:this._sharedAssetsManager,findEntity:p=>this._scene?.getObjectByProperty("uuid",p)??this._scene?.getObjectByName(p)};this._htmlContentOverlay=(this._htmlContentMode==="inline"?z9.mount(this,this.canvas,d,u):U9.mount(this,this.canvas,d,u))??void 0}}setVariables(t){if(this._data!==void 0){let e=Object.entries(t);for(let[i,n]of e)this.setVariable(i,n)}}setVariable(t,e){let i=this._getVariableByName(t);if(i&&!("dynamicVariableType"in i.data)){if(e==null)return void console.warn(`Variable ${t} was not updated: received ${e}. Pass a number, boolean or string.`);let n=e;if(typeof i.data.value=="number"){if(n=typeof e=="number"?e:typeof e=="boolean"?e===!0?1:0:parseFloat(e),!Number.isFinite(n))return void console.warn(`Variable ${t} is a number variable and ${JSON.stringify(e)} cannot be converted to a number. The variable was not updated.`)}else typeof i.data.value=="boolean"?n=typeof e=="number"?!!e:typeof e=="boolean"?e:e.toLocaleLowerCase()!=="false"&&!!e:typeof i.data.value!="string"&&i.data.value.textValue!==void 0&&(n=e.toString());let r=typeof n=="string"?{textValue:n}:n;this._sharedAssetsManager?.updateVariable(i.id,r),this.requestRender(),this._requestRenderAutoMode()}else i===void 0?console.warn(`No variable named ${t} was found in your Spline file. Make sure to create it from Spline editor.`):"dynamicVariableType"in i.data&&console.warn(`Dynamic variables like ${t} cannot be updated from code.`)}getVariables(){let t={};return this._data&&this._data.shared.variables.forEach(e=>{t[e.data.name]===void 0&&(t[e.data.name]=this._getVariableValue(this._sharedAssetsManager.getVariable(e.id)))}),t}getVariable(t){let e=this._getVariableByName(t);if(e){let i=this._sharedAssetsManager.getVariable(e.id);return this._getVariableValue(i)}}_getVariableValue(t){return typeof t!="string"&&br.isTextValue(t)?br.getDisplayedValue(t):t}_getVariableByName(t){if(this._data){if(this._variablesCache.has(t))return this._variablesCache.get(t);let e=this._data.shared.variables.find(i=>i.data.name===t);return e&&this._variablesCache.set(t,e),e}}_getPixelRatio(t){switch(t){case 0:return window.devicePixelRatio;case 1:return 1;case 2:return 2}}findObjectById(t){let e=this._scene?.getObjectByProperty("uuid",t);return this._createProxyObject(e)}findObjectByName(t){let e=this._scene?.getObjectByName(t);return this._createProxyObject(e)}getAllObjects(){let t=[];return this._scene?.traverseEntity(e=>{if(!(e.uuid===ed||this._scene.isInvisibleObjects(e)||e instanceof mn)){let i=this._createProxyObject(e);i&&t.push(i)}}),t}getSplineEvents(){return(this._eventManager?.handlers?.Spline).splineEvents}emitEvent(t,e){(this.findObjectById(e)||this.findObjectByName(e))?.emitEvent(t)}emitEventReverse(t,e){(this.findObjectById(e)||this.findObjectByName(e))?.emitEventReverse(t)}addEventListener(t,e){this.canvas.addEventListener(t,e)}removeEventListener(t,e){this.canvas.removeEventListener(t,e)}setZoom(t){this._controls?.orbitControls instanceof Dj&&this._controls?.orbitControls.setZoom(t)}get eventManager(){return this._eventManager}get controls(){return this._controls}setSize(t,e){this._viewportWidth=t,this._viewportHeight=e,this._viewportMode=2,this._resize()}setBackgroundColor(t){let e=mz(t);this._scene?.activePage.setBackgroundColor(e),this._requestRenderAutoMode()}dispose(){this.disposed=!0,this._htmlContentOverlay?.dispose(),this._htmlContentOverlay=void 0,this._eventManager?.dispose(),this._scene?.dispose(),this._scene=void 0,this._camera=void 0,yg&&yg.disposeAll(),this._sharedAssetsManager?.setRequestRender(()=>{}),this._sharedAssetsManager?.dispose(),this._sharedAssetsManager=void 0,this._proxyObjectCache.forEach(t=>{rM.unsubscribe(t)}),this._proxyObjectCache.clear(),this._variablesCache.clear(),this._renderer?.pipeline.removeEventListener("smaaloaded",this._requestRenderAutoMode),this._renderer?.setAnimationLoop(null),this._renderer&&this._disposeRenderer(this._renderer),this._renderer=void 0,this._rendererConfigured=!1,this._debouncedResize.cancel(),this._resizeObserver&&(this._resizeObserver.disconnect(),this._resizeObserver=void 0),this._resizeObserverTimeout!==void 0&&(clearTimeout(this._resizeObserverTimeout),this._resizeObserverTimeout=void 0),this.canvas.style.width="",this.canvas.style.height="",this.canvas.removeAttribute("width"),this.canvas.removeAttribute("height"),this._frameView=void 0,this._controls?.deactivate(),this._controls=void 0,this._animationControls=void 0,this._eventManager?.eventContext.dispose(),this._eventManager=void 0,this._splatViewer=void 0,this._data=void 0,this._perfs=void 0,this.dt=0,this._lastTime=void 0,function(t){t.removeEventListener("pointerdown",yI,!0),t.removeEventListener("pointerdown",yv,!0),t.removeEventListener("pointermove",yv,!0),t.removeEventListener("pointerup",Bd,!0),t.removeEventListener("pointercancel",Bd,!0),t.removeEventListener("pointerleave",Bd,!0),window.removeEventListener("keydown",_I,!0),window.removeEventListener("keyup",bI,!0)}(this.canvas),document.removeEventListener("scroll",this._onScroll),nn.dispose()}get isStopped(){return this._isPaused}stop(){this._isPaused||(this._renderer?.setAnimationLoop(null),this._isPaused=!0,this._eventManager?.pause(),this._controls?.orbitControls&&(this._controls.orbitControls.enabled=!1))}play(){!this._isPaused||(this._isPaused=!1,this._eventManager?.resume(),this._controls?.orbitControls&&(this._controls.orbitControls.enabled=!0),this._renderer?.setAnimationLoop(this.render))}setGlobalEvents(t){this._eventManager?.updateUseWindowEvents(t)}get data(){return this._data}_createProxyObject(t){if(!this._scene)return;let e,i=this._scene;if(t==null)return;if(this._proxyObjectCache.has(t.uuid))return this._proxyObjectCache.get(t.uuid);t.traverseAncestors(h=>{h instanceof mn&&(e=h.name)});let n=this._sharedAssetsManager,r={shared:n,scene:this._scene},s=h=>{if(h===null||h==="Base State")return null;if(h&&t.data.states){let d=t.data.states.find(u=>u.data.name===h);return d?d.id:void 0}},a="material"in t?t.material:void 0,o=t.materialOverride,l={name:t.name,uuid:t.uuid,visible:t.visible,intensity:t.intensity,position:t.position,rotation:t.rotation,scale:t.scale,type:t.data.type,page:e,material:o??(a?jnt(a):void 0),parentUuid:t.parent instanceof mn||t instanceof Dx?void 0:t.parent?.uuid,emitEvent(h){t.dispatchEvent({type:"userEvent",eventName:h})},emitEventReverse(h){t.dispatchEvent({type:"userEvent",eventName:h,reverse:!0})},hide(){t.visible&&(t.visible=!1,r.shared.requestRender())},show(){t.visible||(t.visible=!0,r.shared.requestRender())},get state(){let h=t.stateSelection;if(h!==null)return t.data.states.find(({id:d})=>d===h)?.data.name},set state(h){let d;if(h!==void 0){let u=typeof h=="string"?t.data.states.find(({id:p})=>p===h):t.data.states[h];if(u)d=u.id;else{let p=typeof h=="string"?s(h):void 0;p&&(d=p)}}t.changeSelectedState(d??null,r),t.currentState=d??null,t.dispatchEvent({type:"completeState",state:d??null}),r.shared.requestRender()},transition(h){let d=L9;if(d===null)return Gn("transitions","obj.transition()"),{transition(b){return this},play(){return this},pause(){return this},reset(){return this},seek(b){return this}};let u,p,f=this,g=[],m=!1,v=()=>{p=new _9({delay:0,delayDirection:"start-once",direction:"normal",repeat:0,runMode:"Repeat"},g.map(b=>b.runner))},y={update(b){p?.update(b),p?.isPlaying!==!0&&nn.remove(y)}},_={transition({from:b,to:x,duration:w,delay:S,...E}){let A=s(b);A===void 0&&(A=u);let P=s(x);return u=P,g.push(new d(t,A,P,{state:P,repeat:0,delay:S??0,delayDirection:"start-once",direction:"normal",duration:w??1e3,...E,...E.easing===6?th.defaultData:E.easing===5?mp.defaultData:{}},n,!1,i.activePage,{onBegin:()=>{(b&&A||b==="Base State"&&!A)&&(f.state=A??void 0)},onComplete:()=>{f.state=P??void 0}})),v(),this},play(){return p?(m=!0,p.play(nn.time),p.isPlaying&&nn.add(y),this):this},pause(){return p?.stop(),nn.remove(y),this},reset(){return this.pause(),m=!1,v(),p?.seek(0),this},seek(b){let x=g.reduce((w,S)=>w+S.runner.duration,0);return x>0&&p?.seek(b/1e3/x),this}};return _.transition(h),(h.autoPlay??!0)&&queueMicrotask(()=>{m||_.play()}),_},set color(h){let d=mz(h);if(Eb.is(t))return void(t.color=d);if(!(t.type==="Mesh"&&"material"in t&&t instanceof Wr))return;let u={r:d.r,g:d.g,b:d.b,a:d.a},p=t.materialOverride;if(p!==void 0){let m=p.color;return void(m?.isColor===!0&&typeof m.setStyle=="function"&&(m.setStyle(h),r.shared.requestRender()))}let f=Array.isArray(t.material)?t.material[0]:t.material,g=f.data.layers.find(m=>m.data.type==="color")?.id;if(g)f.updateByOp({type:0,path:["layers",g],props:{color:{...u}}},f.data,r);else{let m=f.data,v=m.layers.find(S=>S.data.type==="light");if(!v)return;let y=m.layers.indexOf(v)===0?v:null,_=m.layers.at(y?m.layers.indexOf(y)+1:0),b={type:4,fi:y?y.fi+(_?(_.fi-y.fi)/2:1):_?_.fi/2:1,id:Ot.generateUUID(),data:{...tn.defaultData("color"),color:u},localIndex:0},x=m.layers.insertAfterHelper(y?.id??null,1),w=m.layers.runOp({...b,fi:x[0]}).data;Object.assign(f.data,{layers:w}),f.updateByOp({...b,path:["layers"]},f.data,r)}}},c=rM(l,(h,d)=>{let u=t[h],p=function(f){return f.split(".")}(h);p[0]==="material"&&a&&o===void 0&&function(f,g,m){let v=Array.isArray(m)?m[0]:m;if(f[0]==="layers"){let y=parseInt(f[1]),_=v.layers[y],b=f[2];_&&b&&function(x,w,S){let E=x[0];try{if(function(A,P){return!!Hnt[P]?.includes(A)}(E,S.type,x.slice(1)))if(E==="colors"){if(x.length<2)throw new Error("You cannot mutate the colors array, only its items");let A=parseInt(x[1]),P=S.getValue(E)?.[A];if(!P)throw new Error("Color index out of range");bm.setStyle(w),P.set(bm.r,bm.g,bm.b,bm.a)}else S.getValue(E)?.setStyle(w);else if(E==="texture"||E==="video"){let A=S.color;(function(P,C,R,L){let D=P[0];if(D==="repeat"||D==="offset"||D==="rotation"){let F=L.getNode("mat"),V=F&&typeof F.updateMatrix=="function"?F:L.getValue("mat");if(!V)return;if(D==="rotation")V.rotation=parseFloat(C);else{let U=P[1];if(U===void 0)C instanceof Array&&C.length===2&&Object.assign(V,{[D]:C});else{let j=V[D],W=parseInt(U)===0?[parseFloat(C),j[1]]:[j[0],parseFloat(C)];Object.assign(V,{[D]:W})}}V.updateMatrix()}else D==="wrapping"||D==="minFilter"||D==="magFilter"?D==="wrapping"?R.texture.wrap=C:R.texture[D]=C:D==="image"&&P[1]==="data"&&R.texture.image.updateSrc(C)})(x.slice(1),w,A,S)}else{let A=x[1],P=S.getValue(E);P?.isVector3&&A!==void 0||P?.isVector2&&A!==void 0?P.setComponent(parseInt(A),w):S.setValue(E,w)}}catch(A){console.error("Error setting material value",A)}}(f.slice(2),g,_)}else f[0]==="alpha"&&v.layers.forEach(y=>{y.type==="light"&&y.node.alphaOverride!==void 0&&(y.node.alphaOverride.value=g,g<1&&(v.transparent=!0))})}(p.slice(1),d,a),typeof u!="object"&&Object.getOwnPropertyDescriptor(t,h)?.writable&&(t[h]=d),this._requestRenderAutoMode(),t.updateMatrix()});return this._proxyObjectCache.set(t.uuid,c),c}setUIWasmUrl(t){(function(e){pb=e,mx?.setHanaUIWasmUrl(e)})(t)}pauseGameControls(){this._eventManager?.controlsManager.gameControl?.pause()}resumeGameControls(){this._eventManager?.controlsManager.gameControl?.resume()}async swapGeometry(t,e){let i;if(typeof e=="string"){if(!e.endsWith(".splinegeometry"))throw new Error("Only .splinegeometry format is supported");{let l=await(await fetch(e)).arrayBuffer();i=new Uint8Array(l)}}else i=e;let n=jg.deserialize(i),r="data"in n&&n.data.draco!==void 0;r&&await az(this._wasmPath);let s=this._scene?.getObjectByProperty("uuid",t)??this._scene?.getObjectByName(t);if(!s)return void console.warn(`Object ${t} not found`);if(s.data.type!=="Mesh"||!(s instanceof Wr))return void console.warn(`Object ${t} is not a mesh`);let a=s,o={...a.data,geometry:n};r&&await oz([o]),a.updateByOp({type:0,path:[],props:{geometry:o.geometry}},o,{shared:this._sharedAssetsManager,scene:this._scene},!1);for(let l of a.data.states){let c={...l.data};a.states||(a.states={}),a.states[l.id]=ih.patch(o,c)}return i}_applyDocumentTransaction(t){this._data=t.data,this._scene&&(this._scene.data=this._data.scene),this._sharedAssetsManager&&(this._sharedAssetsManager.data=this._data.shared);for(let e of t.actual){let i=e.path;Array.isArray(i)&&i.length===2&&i[0]==="scene"&&i[1]==="objects"&&this._scene?.updateTreeByOp({...e,path:[]},this._sharedAssetsManager)}}_findEntity(t){return this._scene?.getObjectByProperty("uuid",t)??this._scene?.getObjectByName(t)}_resolveParentId(t){if(t===void 0)return this._scene.activePage.uuid;let e=typeof t=="string"?t:t.uuid,i=this._findEntity(e);if(!i)throw new Error(`parent '${e}' \u2014 no object with that name or uuid in the scene.`);return i.uuid}async createCustomMaterial(t){if(this.disposed)throw new Error("createCustomMaterial: this Application was disposed.");if(typeof t!="function")throw new Error("createCustomMaterial: expected a factory function \u2014 createCustomMaterial((three) => new three.MeshStandardNodeMaterial()).");let e=C6();if(e===void 0&&e===void 0)throw new Error("createCustomMaterial: requires the webgpu backend (the runtime default where WebGPU is available). This Application is on the classic WebGL pipeline \u2014 pass { renderer: 'webgpu' } or drop any ?renderer=webgl2 override.");let i=t(e);if(typeof i!="object"||i===null||i.isMaterial!==!0)throw new Error("createCustomMaterial: the factory must return a three.js material built from the namespace it receives \u2014 e.g. (three) => new three.MeshStandardNodeMaterial().");return i}async setMaterial(t,e){if(this.disposed)throw new Error("setMaterial: this Application was disposed.");let i=this._scene;if(!i)throw new Error("setMaterial: no scene loaded \u2014 call load() or start() first.");let n=typeof t=="string"?t:t.uuid,r=this._findEntity(n);if(!r)throw new Error(`setMaterial: '${n}' \u2014 no object with that name or uuid in the scene.`);if(!(r instanceof Wr))throw new Error(`setMaterial: '${n}' is not a mesh \u2014 lights, groups, and cameras have no material.`);let s=typeof e=="function"?await this.createCustomMaterial(e):e;if(Sb()!=="webgpu")throw new Error("setMaterial: custom three.js materials require the webgpu backend (the runtime default where WebGPU is available). This scene is running the classic WebGL pipeline \u2014 pass { renderer: 'webgpu' } or drop any ?renderer=webgl2 override.");let a=dz({material:s});if(a.material===void 0)throw new Error("setMaterial: expected a three.js material instance or a (three) => material factory.");return r.setMaterialOverride(a.material,{scene:i,shared:this._sharedAssetsManager}),this._proxyObjectCache.delete(r.uuid),this._requestRenderAutoMode(),a.material}async createObject(t,e={}){if(this.disposed)throw new Error("createObject: this Application was disposed.");let i=this._scene,n=this._data;if(!i||!n)throw new Error("createObject: no scene loaded \u2014 call load() or start() first.");let r=function(m){if(typeof m!="string"||m.length===0)throw new Error(`createObject: expected a type name string \u2014 one of ${uz}.`);let v=m.replace(/Geometry$/i,"").replace(/[\s_-]/g,"").toLowerCase(),y=Lnt[v];if(y)return{objectType:y};let _=Ont[v];if(_)return{objectType:"Mesh",geometryType:_};let b=Bnt[v];throw b?new Error(`createObject: '${m}' is not supported \u2014 ${b}`):new Error(`createObject: '${m}' is not a creatable Spline type \u2014 use one of ${uz}, e.g. createObject('Cube', { width: 200 }).`)}(t);typeof e.material=="function"&&(e={...e,material:await this.createCustomMaterial(e.material)});let s,a,{options:o,material:l}=dz(e);if(l!==void 0){if(r.objectType!=="Mesh")throw new Error("createObject: a three.js material instance only applies to mesh types \u2014 lights and groups have no material.");if(Sb()!=="webgpu")throw new Error("createObject: three.js material instances require the webgpu backend (the runtime default where WebGPU is available). This scene is running the classic WebGL pipeline \u2014 pass { renderer: 'webgpu' } to the Application, or drop any ?renderer=webgl2 override.")}if(r.geometryType==="TextGeometry"){if(!l3.has("text"))throw new Error("createObject: this runtime build was compiled without the 'text' feature \u2014 re-export the scene with a Text object present, or load the full runtime build.");if(await VB(),a=e.font??Au,n.shared.fonts[a]===void 0){if(a!==Au){let m=Object.keys(n.shared.fonts).join(", ");throw new Error(`createObject: font '${a}' is not in this document \u2014 available fonts: ${m||"(none)"}.`)}s={name:Au,url:SN}}}let c=this._resolveParentId(e.parent),h=knt(r,o,n),d=Ot.generateUUID(),[u,p]=Bm(n);s&&(u.shared.fonts[Au]=s),u.scene.objects.insertAfter(c,null,[{id:d,data:h,children:[]}]);let f=p.result();if(s&&this._sharedAssetsManager.addFont(Au,s),a!==void 0){let m=this._sharedAssetsManager.getFont(a);m&&await m.loadingPromise}this._applyDocumentTransaction(f);let g=i.find(d);return l!==void 0&&g.setMaterialOverride(l,{scene:i,shared:this._sharedAssetsManager}),this._requestRenderAutoMode(),this._createProxyObject(g)}cloneObject(t,e={}){if(this.disposed)throw new Error("cloneObject: this Application was disposed.");let i=this._scene,n=this._data;if(!i||!n)throw new Error("cloneObject: no scene loaded \u2014 call load() or start() first.");let r=typeof t=="string"?t:t?.uuid,s=r?this._findEntity(r):void 0;if(!s)throw new Error(`cloneObject: '${r}' \u2014 no object with that name or uuid in the scene.`);if(s instanceof mn)throw new Error("cloneObject: pages cannot be cloned.");let a=n.scene.objects.get(s.uuid);if(!a)throw new Error(`cloneObject: '${r}' is not part of the document tree (expanded clones and instanced children cannot be cloned \u2014 clone their source object instead).`);let o=function(p,f,g){let m={...p.data};return f.position!==void 0&&(m.position=t0(f.position,[0,0,0])),f.rotation!==void 0&&(m.rotation=t0(f.rotation,[0,0,0])),f.scale!==void 0&&(m.scale=N9(f.scale)),f.visible!==void 0&&(m.visible=f.visible),m.name=f.name??k9(`${p.data.name??"Object"} Copy`,g),{...p,data:m}}(Vnt(a),e,n.scene.objects),l=e.parent!==void 0?this._resolveParentId(e.parent):n.scene.objects.parent(s.uuid)??null,c=e.parent!==void 0?null:s.uuid,[h,d]=Bm(n);h.scene.objects.insertAfter(l,c,[o]),this._applyDocumentTransaction(d.result());let u=i.find(o.id);return this._requestRenderAutoMode(),this._createProxyObject(u)}removeObject(t){let e=this._scene,i=this._data;if(this.disposed||!e||!i)return!1;let n=typeof t=="string"?t:t?.uuid,r=n?this._findEntity(n):void 0;if(!r)return!1;if(r instanceof mn)throw new Error("removeObject: pages cannot be removed.");if(r.data.type==="PerspectiveCamera"||r.data.type==="OrthographicCamera")throw new Error("removeObject: cameras cannot be removed.");if(i.scene.objects.get(r.uuid)===void 0)throw new Error(`removeObject: '${n}' is not part of the document tree (expanded clones and instanced children cannot be removed individually).`);let s=[];r.traverseEntity(l=>{s.push(l.uuid)});let[a,o]=Bm(i);a.scene.objects.delete(r.uuid),this._applyDocumentTransaction(o.result());for(let l of s){let c=this._proxyObjectCache.get(l);c&&(rM.unsubscribe(c),this._proxyObjectCache.delete(l))}return this._requestRenderAutoMode(),!0}};var kx=window,Vx=kx.ShadowRoot&&(kx.ShadyCSS===void 0||kx.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,xP=Symbol(),G9=new WeakMap,_0=class{constructor(e,i,n){if(this._$cssResult$=!0,n!==xP)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=i}get styleSheet(){let e=this.o,i=this.t;if(Vx&&e===void 0){let n=i!==void 0&&i.length===1;n&&(e=G9.get(i)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&G9.set(i,e))}return e}toString(){return this.cssText}},H9=t=>new _0(typeof t=="string"?t:t+"",void 0,xP),wP=(t,...e)=>{let i=t.length===1?t[0]:e.reduce((n,r,s)=>n+(a=>{if(a._$cssResult$===!0)return a.cssText;if(typeof a=="number")return a;throw Error("Value passed to 'css' function must be a 'css' function result: "+a+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(r)+t[s+1],t[0]);return new _0(i,t,xP)},SP=(t,e)=>{Vx?t.adoptedStyleSheets=e.map(i=>i instanceof CSSStyleSheet?i:i.styleSheet):e.forEach(i=>{let n=document.createElement("style"),r=kx.litNonce;r!==void 0&&n.setAttribute("nonce",r),n.textContent=i.cssText,t.appendChild(n)})},jx=Vx?t=>t:t=>t instanceof CSSStyleSheet?(e=>{let i="";for(let n of e.cssRules)i+=n.cssText;return H9(i)})(t):t;var MP,Gx=window,W9=Gx.trustedTypes,qnt=W9?W9.emptyScript:"",q9=Gx.reactiveElementPolyfillSupport,AP={toAttribute(t,e){switch(e){case Boolean:t=t?qnt:null;break;case Object:case Array:t=t==null?t:JSON.stringify(t)}return t},fromAttribute(t,e){let i=t;switch(e){case Boolean:i=t!==null;break;case Number:i=t===null?null:Number(t);break;case Object:case Array:try{i=JSON.parse(t)}catch{i=null}}return i}},X9=(t,e)=>e!==t&&(e==e||t==t),EP={attribute:!0,type:String,converter:AP,reflect:!1,hasChanged:X9},TP="finalized",fl=class extends HTMLElement{constructor(){super(),this._$Ei=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$El=null,this._$Eu()}static addInitializer(e){var i;this.finalize(),((i=this.h)!==null&&i!==void 0?i:this.h=[]).push(e)}static get observedAttributes(){this.finalize();let e=[];return this.elementProperties.forEach((i,n)=>{let r=this._$Ep(n,i);r!==void 0&&(this._$Ev.set(r,n),e.push(r))}),e}static createProperty(e,i=EP){if(i.state&&(i.attribute=!1),this.finalize(),this.elementProperties.set(e,i),!i.noAccessor&&!this.prototype.hasOwnProperty(e)){let n=typeof e=="symbol"?Symbol():"__"+e,r=this.getPropertyDescriptor(e,n,i);r!==void 0&&Object.defineProperty(this.prototype,e,r)}}static getPropertyDescriptor(e,i,n){return{get(){return this[i]},set(r){let s=this[e];this[i]=r,this.requestUpdate(e,s,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)||EP}static finalize(){if(this.hasOwnProperty(TP))return!1;this[TP]=!0;let e=Object.getPrototypeOf(this);if(e.finalize(),e.h!==void 0&&(this.h=[...e.h]),this.elementProperties=new Map(e.elementProperties),this._$Ev=new Map,this.hasOwnProperty("properties")){let i=this.properties,n=[...Object.getOwnPropertyNames(i),...Object.getOwnPropertySymbols(i)];for(let r of n)this.createProperty(r,i[r])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(e){let i=[];if(Array.isArray(e)){let n=new Set(e.flat(1/0).reverse());for(let r of n)i.unshift(jx(r))}else e!==void 0&&i.push(jx(e));return i}static _$Ep(e,i){let n=i.attribute;return n===!1?void 0:typeof n=="string"?n:typeof e=="string"?e.toLowerCase():void 0}_$Eu(){var e;this._$E_=new Promise(i=>this.enableUpdating=i),this._$AL=new Map,this._$Eg(),this.requestUpdate(),(e=this.constructor.h)===null||e===void 0||e.forEach(i=>i(this))}addController(e){var i,n;((i=this._$ES)!==null&&i!==void 0?i:this._$ES=[]).push(e),this.renderRoot!==void 0&&this.isConnected&&((n=e.hostConnected)===null||n===void 0||n.call(e))}removeController(e){var i;(i=this._$ES)===null||i===void 0||i.splice(this._$ES.indexOf(e)>>>0,1)}_$Eg(){this.constructor.elementProperties.forEach((e,i)=>{this.hasOwnProperty(i)&&(this._$Ei.set(i,this[i]),delete this[i])})}createRenderRoot(){var e;let i=(e=this.shadowRoot)!==null&&e!==void 0?e:this.attachShadow(this.constructor.shadowRootOptions);return SP(i,this.constructor.elementStyles),i}connectedCallback(){var e;this.renderRoot===void 0&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(e=this._$ES)===null||e===void 0||e.forEach(i=>{var n;return(n=i.hostConnected)===null||n===void 0?void 0:n.call(i)})}enableUpdating(e){}disconnectedCallback(){var e;(e=this._$ES)===null||e===void 0||e.forEach(i=>{var n;return(n=i.hostDisconnected)===null||n===void 0?void 0:n.call(i)})}attributeChangedCallback(e,i,n){this._$AK(e,n)}_$EO(e,i,n=EP){var r;let s=this.constructor._$Ep(e,n);if(s!==void 0&&n.reflect===!0){let a=(((r=n.converter)===null||r===void 0?void 0:r.toAttribute)!==void 0?n.converter:AP).toAttribute(i,n.type);this._$El=e,a==null?this.removeAttribute(s):this.setAttribute(s,a),this._$El=null}}_$AK(e,i){var n;let r=this.constructor,s=r._$Ev.get(e);if(s!==void 0&&this._$El!==s){let a=r.getPropertyOptions(s),o=typeof a.converter=="function"?{fromAttribute:a.converter}:((n=a.converter)===null||n===void 0?void 0:n.fromAttribute)!==void 0?a.converter:AP;this._$El=s,this[s]=o.fromAttribute(i,a.type),this._$El=null}}requestUpdate(e,i,n){let r=!0;e!==void 0&&(((n=n||this.constructor.getPropertyOptions(e)).hasChanged||X9)(this[e],i)?(this._$AL.has(e)||this._$AL.set(e,i),n.reflect===!0&&this._$El!==e&&(this._$EC===void 0&&(this._$EC=new Map),this._$EC.set(e,n))):r=!1),!this.isUpdatePending&&r&&(this._$E_=this._$Ej())}async _$Ej(){this.isUpdatePending=!0;try{await this._$E_}catch(i){Promise.reject(i)}let e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var e;if(!this.isUpdatePending)return;this.hasUpdated,this._$Ei&&(this._$Ei.forEach((r,s)=>this[s]=r),this._$Ei=void 0);let i=!1,n=this._$AL;try{i=this.shouldUpdate(n),i?(this.willUpdate(n),(e=this._$ES)===null||e===void 0||e.forEach(r=>{var s;return(s=r.hostUpdate)===null||s===void 0?void 0:s.call(r)}),this.update(n)):this._$Ek()}catch(r){throw i=!1,this._$Ek(),r}i&&this._$AE(n)}willUpdate(e){}_$AE(e){var i;(i=this._$ES)===null||i===void 0||i.forEach(n=>{var r;return(r=n.hostUpdated)===null||r===void 0?void 0:r.call(n)}),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$Ek(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$E_}shouldUpdate(e){return!0}update(e){this._$EC!==void 0&&(this._$EC.forEach((i,n)=>this._$EO(n,this[n],i)),this._$EC=void 0),this._$Ek()}updated(e){}firstUpdated(e){}};fl[TP]=!0,fl.elementProperties=new Map,fl.elementStyles=[],fl.shadowRootOptions={mode:"open"},q9?.({ReactiveElement:fl}),((MP=Gx.reactiveElementVersions)!==null&&MP!==void 0?MP:Gx.reactiveElementVersions=[]).push("1.6.3");var CP,Hx=window,Bp=Hx.trustedTypes,$9=Bp?Bp.createPolicy("lit-html",{createHTML:t=>t}):void 0,DP="$lit$",Ch=`lit$${(Math.random()+"").slice(9)}$`,e7="?"+Ch,Xnt=`<${e7}>`,ld=document,x0=()=>ld.createComment(""),w0=t=>t===null||typeof t!="object"&&typeof t!="function",i7=Array.isArray,$nt=t=>i7(t)||typeof t?.[Symbol.iterator]=="function",PP=`[
9948
+ `,z9=class{constructor(t,e,i,n,r,s){this.container=t,this.host=e,this.observer=i,this.spline=n,this.previousSplineGlobal=r,this.removeLateLifecycleShim=s}static mount(t,e,i,n){if(typeof document>"u")return null;let r=e.parentElement;if(!r)return null;getComputedStyle(r).position==="static"&&(r.style.position="relative");let s=document.createElement("div");s.setAttribute(Y1,"");let a=s.style;a.position="absolute",a.overflow="hidden";let o=()=>{a.left=`${e.offsetLeft}px`,a.top=`${e.offsetTop}px`,a.width=`${e.offsetWidth}px`,a.height=`${e.offsetHeight}px`};o();let l=new ResizeObserver(o);l.observe(e),l.observe(r);let c=document.createElement("style");c.textContent=Rnt,s.appendChild(c);let h=new DOMParser().parseFromString(i,"text/html"),d=Array.from(h.querySelectorAll("script"));for(let y of d)y.remove();for(let y of Array.from(h.head.children))(y.tagName==="STYLE"||y.tagName==="LINK"&&y.rel==="stylesheet")&&s.appendChild(y);for(;h.body.firstChild;)s.appendChild(h.body.firstChild);r.insertBefore(s,e.nextSibling);let u=new Map,p=new jC(B9(t,e,n),(y,_)=>{y==="warn"?console.warn(`[spline html] ${_}`):y==="error"&&console.error(`[spline html] ${_}`)},(y,_)=>{let b=u.get(y);if(b)for(let x of b)try{x(_)}catch(w){console.error(w)}}),f=(y,_)=>{try{return Promise.resolve(p.execute(y,_))}catch(b){return Promise.reject(b)}},g={ready:Promise.resolve(),setVariable:(y,_)=>f("setVariable",[y,_]),setVariables:y=>f("setVariables",[y]),getVariable:y=>f("getVariable",[y]),getVariables:()=>f("getVariables",[]),getAllObjects:()=>f("getAllObjects",[]),findObjectByName:y=>f("findObjectByName",[y]),findObjectById:y=>f("findObjectById",[y]),getGeometry:(y,_)=>f("getGeometry",[y,_??{}]),updateObject:(y,_)=>f("updateObject",[y,_]),createObject:(y,_)=>f("createObject",[y,_??{}]),createCustomMaterial:y=>f("createCustomMaterial",[y]),getTexture:(y,_)=>f("getTexture",[y,_??{}]),setMaterial:(y,_)=>f("setMaterial",[y,_]),cloneObject:(y,_)=>f("cloneObject",[y,_??{}]),removeObject:y=>f("removeObject",[y]),spawnObject:(y,_)=>f("spawnObject",[y,_??{}]),destroyObject:y=>f("destroyObject",[y]),setInstanceTransforms:(y,_)=>f("setInstanceTransforms",[y,_??null]),emitEvent:(y,_)=>f("emitEvent",[y,_]),emitEventReverse:(y,_)=>f("emitEventReverse",[y,_]),requestRender:()=>f("requestRender",[]),addEventListener:(y,_)=>{if(typeof _!="function")return;let b=u.get(y);b||(b=new Set,u.set(y,b),f("listenEvent",[y])),b.add(_)},removeEventListener:(y,_)=>{let b=u.get(y);!b||(b.delete(_),b.size===0&&(u.delete(y),f("unlistenEvent",[y])))}},m=window.spline;window.spline=g;let v=function(){if(typeof document>"u"||document.readyState==="loading")return()=>{};let y=[],_=(x,w)=>{let S=new Set,E=x.addEventListener.bind(x),A=x.removeEventListener.bind(x);Object.defineProperty(x,"addEventListener",{configurable:!0,writable:!0,value:(P,C,R)=>{if(E(P,C,R),!w.includes(P)||C==null)return;let L={type:P,listener:C};S.add(L),queueMicrotask(()=>{!S.delete(L)||((D,F,V)=>{let U=new Event(V);try{typeof F=="function"?F.call(D,U):F.handleEvent?.(U)}catch(j){console.error(j)}})(x,L.listener,L.type)})}}),Object.defineProperty(x,"removeEventListener",{configurable:!0,writable:!0,value:(P,C,R)=>{A(P,C,R);for(let L of S)L.type===P&&L.listener===C&&S.delete(L)}}),y.push(()=>{delete x.addEventListener,delete x.removeEventListener,S.clear()})};_(document,["DOMContentLoaded"]),_(window,["load"]);let b=Object.getOwnPropertyDescriptor(window,"onload");return Object.defineProperty(window,"onload",{configurable:!0,get:()=>null,set:x=>{typeof x=="function"&&queueMicrotask(()=>{try{x.call(window,new Event("load"))}catch(w){console.error(w)}})}}),y.push(()=>{b?Object.defineProperty(window,"onload",b):delete window.onload}),()=>{for(let x of y)x()}}();for(let y of d){let _=document.createElement("script");for(let b of Array.from(y.attributes))_.setAttribute(b.name,b.value);y.src?_.async=!1:_.textContent=y.textContent,s.appendChild(_)}return new z9(s,p,l,g,m,v)}dispose(){this.removeLateLifecycleShim(),this.host.dispose(),this.observer.disconnect(),this.container.remove(),window.spline===this.spline&&(window.spline=this.previousSplineGlobal)}};function F9(t){return typeof t=="object"&&t!==null&&t.isMaterial===!0}function dz(t){if(typeof t.material=="function")throw new Error("createObject: a (three) => material factory must be resolved to a material instance before object creation \u2014 this entry point does not support it.");if(!F9(t.material))return{options:t};let e=t.material;if(e.isNodeMaterial===!0){let i=C6()?.NodeMaterial;if(i!==void 0&&e instanceof i)return{options:{...t,material:void 0},material:e};throw new Error("createObject: this TSL NodeMaterial comes from your own three/webgpu module instance, which cannot compile in the runtime's bundled three. Build it with app.createCustomMaterial((three) => \u2026) instead, or use a built-in material (MeshStandardMaterial, MeshBasicMaterial, \u2026).")}if(e.isShaderMaterial===!0)throw new Error("createObject: a GLSL ShaderMaterial cannot compile on the WebGPU backend \u2014 port the shader to TSL with app.createCustomMaterial((three) => \u2026), or use a built-in material (MeshStandardMaterial, \u2026).");return{options:{...t,material:void 0},material:e}}$t(),Ye(),tt(),M6(),_a(),Ye(),$t(),pY(),Mh();var Int=new Set(["name","parent","position","rotation","scale","visible","castShadow","receiveShadow","color","material"]),uz="'Cube', 'Sphere', 'Plane', 'Rectangle', 'Ellipse', 'Triangle', 'Polygon', 'Star', 'Cone', 'Cylinder', 'Pyramid', 'Torus', 'TorusKnot', 'Dodecahedron', 'Icosahedron', 'Helix', 'Backdrop', 'Lathe', 'Text', 'CustomMesh', 'Group', 'PointLight', 'SpotLight', 'DirectionalLight'",Ont={cube:"CubeGeometry",box:"CubeGeometry",sphere:"SphereGeometry",plane:"PlaneGeometry",rectangle:"RectangleGeometry",ellipse:"EllipseGeometry",circle:"EllipseGeometry",triangle:"TriangleGeometry",polygon:"PolygonGeometry",star:"StarGeometry",cone:"ConeGeometry",cylinder:"CylinderGeometry",pyramid:"PyramidGeometry",torus:"TorusGeometry",torusknot:"TorusKnotGeometry",dodecahedron:"DodecahedronGeometry",icosahedron:"IcosahedronGeometry",helix:"HelixGeometry",backdrop:"BackdropGeometry",lathe:"LatheGeometry",text:"TextGeometry",custommesh:"NonParametricGeometry",nonparametric:"NonParametricGeometry"},Lnt={group:"Empty",empty:"Empty",pointlight:"PointLight",spotlight:"SpotLight",directionallight:"DirectionalLight"},Bnt={shapeblend:"Shape Blends are built from member meshes in the editor and cannot be created empty.",path:"Path shapes need authored path data \u2014 clone an existing one with cloneObject() instead.",vector:"Vector shapes need authored shape data \u2014 clone an existing one with cloneObject() instead.",shape:"Vector shapes need authored shape data \u2014 clone an existing one with cloneObject() instead.",boolean:"Boolean operations are not creatable at runtime \u2014 clone an existing Boolean object with cloneObject() instead.",decal:"Decals need a surface to project onto \u2014 clone an existing Decal with cloneObject() instead.",ui:"UI objects need a 2D frame \u2014 clone an existing one with cloneObject() instead.",input:"Text inputs are not creatable at runtime \u2014 clone an existing one with cloneObject() instead.",particle:"Particle emitters are not creatable at runtime \u2014 clone an existing one with cloneObject() instead.",particlecollider:"Particle forces are not creatable at runtime \u2014 clone an existing one with cloneObject() instead.",hair:"Hair systems are not creatable at runtime \u2014 clone an existing one with cloneObject() instead.",camera:"Cameras are not creatable at runtime.",perspectivecamera:"Cameras are not creatable at runtime.",orthographiccamera:"Cameras are not creatable at runtime.",hemispherelight:"Hemisphere lights are not creatable at runtime.",splat:"Splats are not creatable at runtime.",page:"Pages are not creatable at runtime.",component:"Components are authored in the editor.",instance:"Instances are authored in the editor \u2014 clone an existing one with cloneObject() instead.",bone:"Bones are not creatable at runtime.",mesh:"pass the shape name directly, e.g. createObject('Cube')."},Unt={CubeGeometry:"Cube",SphereGeometry:"Sphere",PlaneGeometry:"Plane",RectangleGeometry:"Rectangle",EllipseGeometry:"Ellipse",TriangleGeometry:"Triangle",PolygonGeometry:"Pentagon",StarGeometry:"Star",ConeGeometry:"Cone",CylinderGeometry:"Cylinder",PyramidGeometry:"Pyramid",TorusGeometry:"Torus",TorusKnotGeometry:"Torus Knot",DodecahedronGeometry:"Dodecahedron",IcosahedronGeometry:"Icosahedron",HelixGeometry:"Helix",BackdropGeometry:"Backdrop",LatheGeometry:"Lathe",TextGeometry:"Text",NonParametricGeometry:"Custom Mesh"},znt={Empty:"Group",PointLight:"Point Light",SpotLight:"Spot Light",DirectionalLight:"Directional Light"};function t0(t,e){return t===void 0?[e[0],e[1],e[2]]:Array.isArray(t)?[t[0]??e[0],t[1]??e[1],t[2]??e[2]]:[t.x??e[0],t.y??e[1],t.z??e[2]]}function N9(t){return typeof t=="number"?[t,t,t]:t0(t,[1,1,1])}function MC(t){let e=new yn(0,0,0,1);return e.setStyle(t),{r:e.r,g:e.g,b:e.b}}function pz(t,e){let i=t.material??(t.color!==void 0?{color:t.color}:void 0);if(i===void 0)return Vi.defaultColorMaterial(fz(Ir),"physical","layer1","layer2");if(typeof i=="string"){for(let[a,o]of Object.entries(e.shared.materials))if(a===i||o.name===i)return a;if(function(a){let o=a.trim().toLowerCase();return/^#([0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(o)||/^(rgb|hsl)a?\(/.test(o)||Jt.NAMES[o]!==void 0}(i))return Vi.defaultColorMaterial(MC(i),"physical","layer1","layer2");throw new Error(`createObject: material '${i}' matches no shared material in this document (available: ${function(a){let o=Object.entries(a.shared.materials).map(([,l])=>`'${l.name}'`).filter(l=>l!=="'undefined'");return o.length?o.join(", "):"(none)"}(e)}) and is not a valid CSS color.`)}if(typeof i=="function")throw new Error("createObject: a (three) => material factory must be resolved to a material instance before object creation \u2014 this entry point does not support it.");if(F9(i))throw new Error("createObject: a three.js material instance cannot be stored in the document \u2014 this entry point does not support it.");let n=i.color!==void 0?MC(i.color):fz(Ir),r=Vi.defaultColorMaterial(n,"physical","layer1","layer2"),s=r.layers.find(a=>a.data.type==="light");if(s){let a={};i.roughness!==void 0&&(a.roughness=i.roughness),i.metalness!==void 0&&(a.metalness=i.metalness),i.reflectivity!==void 0&&(a.reflectivity=i.reflectivity),Object.assign(s.data,a)}if(i.alpha!==void 0){let a=r.layers.find(o=>o.data.type==="color");a&&Object.assign(a.data,{alpha:i.alpha})}return r}function fz(t){return{r:(t>>16&255)/255,g:(t>>8&255)/255,b:(255&t)/255}}function Fnt(t){let e=Yo.defaultData("TextGeometry"),{text:i,...n}=t,r=n.fontSize;return r!==void 0&&n.width===void 0&&(n.width=350*r/16),r!==void 0&&n.height===void 0&&(n.height=50*r/16),Object.assign(e,n),i!==void 0&&Object.assign(e,{text:{textValue:String(i)}}),e}function n1(t){return Array.isArray(t)?t:!ArrayBuffer.isView(t)||t instanceof DataView?null:Array.from(t)}function Nnt(t,e){return KN({userData:{type:t,...uT[t].normalizeInputs({parameters:e})}})}function knt(t,e,i){let{objectType:n,geometryType:r}=t,s=function(l){let c={};for(let[h,d]of Object.entries(l))!Int.has(h)&&d!==void 0&&(c[h]=d);return c}(e),a={states:new Vt,events:new Vt};if(n==="Mesh"&&r){if(r==="NonParametricGeometry"){let{geometry:l,doubleSide:c}=function(h){let d=n1(h.vertices);if(!d||d.length<9||d.length%3!=0)throw new Error("createObject('CustomMesh'): `vertices` must be a flat number[] of x,y,z triples (length a multiple of 3, at least one triangle).");let u=d.length/3;if(u>6e4)throw new Error(`createObject('CustomMesh'): too many vertices (${u}); keep it under 60000.`);let p=n1(h.indices);if(p&&p.length){let _=p.find(b=>!Number.isInteger(b)||b<0||b>=u);if(_!==void 0)throw new Error(`createObject('CustomMesh'): index ${_} is out of range (mesh has ${u} vertices).`)}else p=null;let f=new jt;f.setAttribute("position",new Nt(d,3));let g=n1(h.normals),m=g!==null&&g.length===d.length;m&&f.setAttribute("normal",new Nt(g,3));let v=n1(h.uvs);v&&v.length===2*u&&f.setAttribute("uv",new Nt(v,2));let y=!1;if(!m){let _=p??Array.from({length:u},(w,S)=>S),{closed:b,inverted:x}=function(w,S){let E=w.length/3,A=new Map,P=new Array(E);for(let D=0;D<E;D++){let F=`${Math.round(1e4*w[3*D])},${Math.round(1e4*w[3*D+1])},${Math.round(1e4*w[3*D+2])}`,V=A.get(F);V===void 0?(A.set(F,D),P[D]=D):P[D]=V}let C=new Map;for(let D=0;D+2<S.length;D+=3){let F=P[S[D]],V=P[S[D+1]],U=P[S[D+2]];for(let[j,W]of[[F,V],[V,U],[U,F]]){if(j===W)continue;let it=j<W?j+"_"+W:W+"_"+j;C.set(it,(C.get(it)??0)+1)}}let R=C.size>0;for(let D of C.values())if(D!==2){R=!1;break}if(!R)return{closed:!1,inverted:!1};let L=0;for(let D=0;D+2<S.length;D+=3){let F=3*S[D],V=3*S[D+1],U=3*S[D+2],j=w[F],W=w[F+1],it=w[F+2],nt=w[V],Y=w[V+1],ot=w[V+2],ht=w[U],ft=w[U+1],pt=w[U+2];L+=j*(Y*pt-ot*ft)+W*(ot*ht-nt*pt)+it*(nt*ft-Y*ht)}return{closed:!0,inverted:L<0}}(d,_);if(b&&x){for(let w=0;w+2<_.length;w+=3){let S=_[w+1];_[w+1]=_[w+2],_[w+2]=S}p=_}else b||(y=!0)}return p&&f.setIndex(p),m||f.computeVertexNormals(),{geometry:KN({userData:{type:"NonParametricGeometry",parameters:{subdivisions:0}},data:f.toJSON().data}),doubleSide:y}}(s);Object.assign(a,Wa.defaultData,{geometry:l,materials:[pz(e,i)]}),c&&(a.side=2)}else Object.assign(a,Wa.defaultData,{geometry:r==="TextGeometry"?Fnt(s):Nnt(r,s),material:pz(e,i)});e.castShadow!==void 0&&(a.castShadow=e.castShadow),e.receiveShadow!==void 0&&(a.receiveShadow=e.receiveShadow)}else n==="Empty"?Object.assign(a,rb.defaultData):(Object.assign(a,sb.defaultData(n),s),e.color!==void 0&&(a.color=MC(e.color)));a.visible=e.visible??!0,a.position=t0(e.position,[0,0,0]),a.rotation=t0(e.rotation,[0,0,0]),a.scale=N9(e.scale);let o=(r&&Unt[r])??znt[n]??n;return a.name=e.name??k9(o,i.scene.objects),a}function k9(t,e){let i=new Set;if(e.traverse((r,s)=>{i.add(s.name??"")}),!i.has(t))return t;let n=2;for(;i.has(`${t} ${n}`);)n++;return`${t} ${n}`}function V9(t,e){let i=Ot.generateUUID();if(t.data.type==="Component")return{data:{...nl.fromComponentData(t),name:t.data.name+" Instance"},id:i,fi:t.fi,children:[]};e[t.id]=i;let n=t.data;return n.type==="Empty"&&n.animations?.length&&(n={...n,animations:n.animations.map(([r,s,a])=>{let o=Ot.generateUUID(),l=a.indexOf(r);return[o,s,l!==-1?a.slice(0,l)+o+a.slice(l+r.length):a]})}),{...t,id:i,data:n,children:t.children.map(r=>V9(r,e))}}function Vnt(t){let e={};return function(i,n){return Xu(i,n,null)??i}(V9(t,e),e)}function jnt(t){let e=Array.isArray(t)?t[0]:t,i=e.layers?.map(Gnt)??[],n=e.layers?.find(r=>r.type==="light");return{layers:i,alpha:n?.node.alphaOverride?.value??1}}function Gnt(t){return t.type==="texture"||t.type==="video"||t.type==="matcap"?{...t.data,updateTexture:e=>t.color.texture.image.updateSrc(e)}:{...t.data}}Mh(),Bi(),y3(),_a();var bm=new yn(0,0,0,1),Hnt={color:["color"],cavity:[],dust:["color"],fresnel:["color"],normal:[],gradient:["colors"],depth:["colors"],texture:[],video:[],noise:["colorA","colorB","colorC","colorD"],toon:["colors","shadowColor"],outline:["outlineColor","contourColor"],transmission:["attenuationColor"],reflection:[],matcap:[],pattern:["colorA","colorB"],vertexColor:[],light:[],displace:[],rainbow:[],particle:[]};$t(),$t();var Wnt=new et;function mz(t){let e=new yn(0,0,0,1);try{e.setStyle(t)}catch(i){console.error(i)}return e}var j9=class{constructor(t,{renderOnDemand:e,renderMode:i="auto",wasmPath:n,renderer:r,htmlContentMode:s="sandbox"}={}){if(this._rendererBackend="webgl",this._rendererAuto=!1,this._rendererConfigured=!1,this._viewportMode=1,this._viewportWidth=window.innerWidth,this._viewportHeight=window.innerHeight,this._proxyObjectCache=new Map,this._htmlContentMode="sandbox",this._variablesCache=new Map,this._isPaused=!1,this._renderRequested=!1,this._skipRender=!1,this.time=performance.now(),this.dt=0,this.currentTAAFrame=0,this.disposed=!1,this._requestRenderAutoMode=()=>{this._skipRender=!1},this.requestRender=()=>{this._renderRequested=!0},this.render=a=>{if(this.time=a,this._lastTime&&(this.dt=this.time-this._lastTime),this._lastTime=this.time,this._perfs?.start(),this._renderer)if(this._isPaused||!(this.renderMode==="manual"&&!this._renderRequested||this.renderMode==="auto"&&this._skipRender)){if(this._renderRequested=!1,this._skipRender=!0,this._controls&&(this._skipRender=this._controls.update(this.dt)??!1),this._eventManager&&(this._eventManager.handlers?.Start?.hasVideoAction||this._eventManager.handlers?.Basic?.hasVideoAction||this._eventManager.handlers?.Conditional?.hasVideoAction)&&(this._skipRender=!1),this._animationControls?.update(this.dt),this._skipRender?(this.currentTAAFrame++,this.currentTAAFrame<JN?this._skipRender=!1:this.currentTAAFrame=0):this.currentTAAFrame=0,this._scene?.traverseVisibleEntity(o=>{o.type==="ParticleSystem"&&(o.update(this.dt),this._skipRender=!1),Yc(o)&&(this._renderer?.isWebGPUSplineRenderer!==!0&&o.warnClassicFallbackOnce(),o.isSimulating&&(o.update(this.dt),this._skipRender=!1))}),this._scene&&this._scene.activeCamera!==this._camera&&(this._camera=this._scene.activeCamera),this._eventManager?.isEnabled&&(this._eventManager.handlers?.Follow?.onAnimationFrameDamping(),this._eventManager.handlers?.LookAt?.onAnimationFrameDamping(),this._eventManager.handlers?.DragDrop?.onAnimationFrameDamping()),this._scene&&this._camera){if(this._scene.pathConstraints.applyConstraints(this._scene),this._renderer.sceneTransitionTimeRemaining>0){this._renderer.sceneTransitionTimeRemaining-=this.dt;let o=Math.min(1,1-this._renderer.sceneTransitionTimeRemaining/this._renderer.sceneTransitionDuration);this._renderer.pipeline.sceneTransitionPass.uniforms.mixRatio.value=o,this._skipRender=!1}else this._renderer.pipeline.sceneTransitionFromTexture=null;this._renderer.renderSplineScene(this._scene,this._camera),this._renderer.lastFrameIncomplete===!0&&(this._skipRender=!1),this._renderer.skyAnimationActive===!0&&(this._skipRender=!1)}this.canvas.dispatchEvent(this._renderedEvent),this._perfs?.end()}else this._perfs?.end();else this._perfs?.end()},this._resize=a=>{if(this._renderer){if(this._viewportMode===1&&this._frameView&&(this._frameView.frameSize=Wnt.set(this._viewportWidth,this._viewportHeight)),a){let o=this._viewportWidth,l=this._viewportHeight;this._renderer.setSize(o-1,l-1,!1),this._renderer.setSize(o,l,!1)}else this._renderer.setSize(this._viewportWidth,this._viewportHeight,!1);this._camera=this._scene?.activeCamera,this._scene?.updateViewPlaneSize(this._frameView?.frameSize?.x??this._viewportWidth,this._frameView?.frameSize?.y??this._viewportHeight,this._frameView?.enableResponsive??!1),this._camera&&(this._frameView?.setCamera(this._camera),this._frameView?.updateCamera(),this._camera.cameraType==="PerspectiveCamera"&&(this._camera.aspect=this._viewportWidth/this._viewportHeight),this._camera.updateProjectionMatrix()),this.eventManager&&(this.eventManager.eventContext.domRect=this.canvas.getBoundingClientRect()),this._requestRenderAutoMode()}},this._debouncedResize=Vg(this._resize,10),this._onScroll=a=>{this.eventManager&&(this.eventManager.eventContext.domRect=this.canvas.getBoundingClientRect())},this.canvas=t,this._htmlContentMode=s,this.renderMode=e?"auto":i,n!==void 0&&(this._wasmPath=function(a){let o=a.length;for(;o>0&&"/".includes(a[o-1]);)o--;return a.slice(0,o)}(n)),this._rendererBackend=r??"webgl",r===void 0){let a=null;try{a=new URLSearchParams(window.location.search).get("renderer")}catch{}a==="webgpu"||a==="webgl"||a==="webgl2"?this._rendererBackend=a==="webgl2"?"webgl":a:(this._rendererAuto=!0,this._rendererBackend="webgl")}this._renderedEvent=new CustomEvent("rendered",{bubbles:!0}),Object.defineProperty(this._renderedEvent,"target",{writable:!1,value:this}),window.location.search.includes("perfs")&&Promise.resolve().then(()=>(nK(),D8)).then(({Perfs:a})=>{this._perfs=new a({x:10,y:10})}),function(a){a.addEventListener("pointerdown",yI,!0),a.addEventListener("pointerdown",yv,!0),a.addEventListener("pointermove",yv,!0),a.addEventListener("pointerup",Bd,!0),a.addEventListener("pointercancel",Bd,!0),a.addEventListener("pointerleave",Bd,!0),window.addEventListener("keydown",_I,!0),window.addEventListener("keyup",bI,!0)}(t)}async _initRenderer(){if(this.disposed)return null;let t=await this._createRenderer();return this.disposed?(this._disposeRenderer(t),null):t}_disposeRenderer(t){let e=function(n){let r=n.backend;if(r!==void 0)return r.isWebGLBackend===!0?r.gl??null:null;let s=n.getContext,a=typeof s=="function"?s.call(n):null;return a&&typeof a.getExtension=="function"?a:null}(t);if(e&&!function(n,r){return hz.get(n)===r}(this.canvas,this))return void(function(n){return n.backend?.isWebGLBackend===!0}(t)||t.dispose());let i=e?function(n,r){let s=r.getExtension("WEBGL_lose_context");if(!s||r.isContextLost())return()=>{};let a=()=>{},o=new Promise(l=>{a=cz(n,"webglcontextlost",c=>{c.preventDefault(),l(s)})});return t1.set(n,{gl:r,lost:o,stopListening:a}),()=>{r.isContextLost()||s.loseContext()}}(this.canvas,e):void 0;try{t.dispose()}finally{i?.()}}async _createRenderer(){(function(t,e){hz.set(t,e)})(this.canvas,this),await async function(t){let e=t1.get(t);if(e&&(e.restoring??(e.restoring=async function(i,n){if(!n.gl.isContextLost())return void n.stopListening();let r,s=()=>{},a=n.lost.then(l=>new Promise(c=>{s=cz(i,"webglcontextrestored",()=>c()),l.restoreContext()})),o=new Promise(l=>{r=setTimeout(l,2e3)});await Promise.race([a,o]),clearTimeout(r),s(),n.stopListening()}(t,e).finally(()=>{e.restoring=void 0,!e.gl.isContextLost()&&t1.get(t)===e&&t1.delete(t)})),await e.restoring,e.gl.isContextLost()))throw new Error("[spline] The browser did not restore the WebGL context this canvas had before dispose(); the scene cannot render on it. Use a new canvas.")}(this.canvas),this._rendererBackend,this._rendererBackend;{let{SplineRenderer:t,rendererGlobals:e}=await Promise.resolve().then(()=>(z5(),WT));try{new URLSearchParams(window.location.search).get("taa")==="off"&&(e.taaEnabled.value=!1)}catch{}return new t({canvas:this.canvas,antialias:!1,alpha:!0,stencil:!1,depth:!1,powerPreference:"high-performance"})}}_failWebGPURequired(){console.error('[spline] This scene was exported for WebGPU only and this browser does not provide a WebGPU adapter. Re-export with renderer "Both" or "WebGL 2" to support this browser.');try{let t=window.devicePixelRatio||1,e=this.canvas.clientWidth||300,i=this.canvas.clientHeight||150;this.canvas.width=e*t,this.canvas.height=i*t;let n=this.canvas.getContext("2d");n&&(n.scale(t,t),n.fillStyle="rgba(127, 127, 127, 0.85)",n.font="13px system-ui, -apple-system, Segoe UI, Roboto, sans-serif",n.textAlign="center",n.textBaseline="middle",n.fillText("This scene requires a WebGPU-capable browser.",e/2,i/2))}catch{}this.canvas.dispatchEvent(new CustomEvent("splineerror",{bubbles:!0,detail:{reason:"webgpu-required"}}))}async load(t,e,i){(function(r){let s="The Spline Runtime only accepts .splinecode files that are generated from Spline export panel.";r.endsWith(".spline")?console.warn(s+" The .spline files are only meant to be used by the Editor."):r.endsWith(".splinecode")||console.warn(s)})(t),this.disposed=!1;let n=await(await fetch(t,i)).arrayBuffer();await this.start(n,{variables:e})}async start(t,{interactive:e=!0,variables:i}={}){if(this.disposed)return;nn.init();let n=await async function(u){let[p,f]=Bm(jg.deserialize(new Uint8Array(u)));if((p.schema??0)!==132){let{updateDocumentSchema:g}=await Promise.resolve().then(()=>(ux(),VN));g(p)}return f.result().data}(t);this._data=n;let r=function(u){let p=[];return u.scene.objects.traverse((f,g)=>{g.type==="Mesh"&&g.geometry.type==="NonParametricGeometry"&&g.geometry.data.draco!==void 0&&p.push(g)}),p}(n);n.version&&(0,Pnt.default)(n.version,"2.0.79")>0&&console.warn("Your .splinecode file is more recent than the library. Please upgrade @splinetool/runtime to the latest version."),this._wasmPath!==void 0&&(this.setUIWasmUrl(`${this._wasmPath}/hana-ui.wasm`),function(u){h8=u}(this._wasmPath));let s=async function(){}();await Promise.all([s,r.length&&az(this._wasmPath),TL(n)&&xY(this._wasmPath),GY(n)&&jY(this._wasmPath),rZ(n)&&ZY(this._wasmPath),$c.physicsEnabled(n.scene.objects)&&Rtt(this._wasmPath),C4(n)&&VB(),UL(n)&&MZ(),RY(n)&&DY(),OB(n)&&s.then(()=>kA()?.loadHanaUIRUNTIME()),Mtt(n)&&Xtt(this._wasmPath)].filter(Boolean)),r.length&&await oz(r),this._eventManager?.deactivate(),this._controls?.deactivate(),this._scene?.dispose();let a=n.scene.publish.renderer;if(this._rendererAuto&&a==="webgl")this._rendererBackend="webgl";else if(this._rendererAuto&&a==="webgpu")return void this._failWebGPURequired();let o=function(u){let p=new Set;return u.scene.objects.traverse((f,g)=>{if(g.type!=="Page")return;let m=g.postprocessing;if(m&&typeof m=="object"&&m.enabled===!0)for(let[v,y]of Object.entries(m))v!=="enabled"&&y&&typeof y=="object"&&y.enabled===!0&&p.add(v)}),[...p]}(n);this._rendererBackend,this._rendererBackend!=="webgpu"&&await Promise.all([Promise.resolve().then(()=>(z5(),WT)),Cnt(o)]),function(u){Mx=u}((this._rendererBackend,"webgl"));let l=new Snt(n);if(l.resetPersonalCameraFromDocumentData(),this._scene=l.scene,this._sharedAssetsManager=l.sharedAssets,this._camera=this._scene.activeCamera,window.location.search.includes("merge-geometries")){let{mergeStaticGeometries:u}=await Promise.resolve().then(()=>(FQ(),fj)),p=performance.now();u(n,l.scene);let f=performance.now();console.log("Merged geometries in ",f-p," ms")}TL(n)&&this._scene.traverse(u=>{eo(u)&&u.recomputeBoolean()}),this._sharedAssetsManager.setRequestRender(()=>{this._requestRenderAutoMode(),this._scene?.traverse(u=>{zu(u)&&u.pendingMediaLoad&&u.update({scene:this._scene,shared:this._sharedAssetsManager})})}),this._scene?.traverse(u=>{u.type==="ParticleSystem"&&(u.wakeUp(),u.data.autoPlay?u.start():u.stop()),Yc(u)&&u.setPlayMode(!0)});let c=Object.keys(n.shared.fonts).flatMap(u=>{let p=this._sharedAssetsManager.getFont(u);return p?[p.loadingPromise]:[]});if(Promise.all(c).then(()=>{this.disposed||(l.scene.markNeedsUpdateRendererDirty(),this._requestRenderAutoMode())}),C4(n)&&function(u){if($c.physicsEnabled(u.scene.objects))return!0;let p=!1;return u.scene.objects.traverse((f,g)=>{if(g.events){if(Array.isArray(g.events)){for(let m of g.events)if(m.data.disabled!==!0&&m.data.type==="GameControl"&&m.data.collisionEnabled){p=!0;break}}else for(let m of Object.values(g.events))if(m.disabled!==!0&&m.type==="GameControl"&&m.collisionEnabled){p=!0;break}}}),p}(n)&&await Promise.all(c),OB(n)){let u=[];this._scene.traverseEntity(p=>{(Pr(p)||p instanceof mn)&&p.uiCanvas&&u.push(p.uiCanvas)}),await Promise.all(u.map(p=>p.promise))}if(this._scene.rewriteEventsBeforeGoToPlayMode(),bP(this._scene.activePage,this._sharedAssetsManager),!this._renderer){let u=await this._initRenderer();if(!u)return;this._renderer=u}if(!this._rendererConfigured){this._rendererConfigured=!0,this._renderer.hdTransmission=n.scene.publish.hdTransmission===!0;let u=()=>/Mobi|Android|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),p=this._getPixelRatio(u()?n.scene.publish.settings.web.pixelRatioMobile:n.scene.publish.settings.web.pixelRatioDesktop);if(this._renderer.setPixelRatio(p),this._renderer.pipeline.enableUIOverlay(),this._renderer.pipeline.addEventListener("smaaloaded",this._requestRenderAutoMode),n.shared.images.SplineWatermark){let f=this._sharedAssetsManager.getImage("SplineWatermark");await f.loadPromise;let g=f.getTexture(1001);this._renderer.pipeline.setWatermark(g)}}UL(n)&&this._scene.initializeSplatViewer(),n.scene.blueNoiseTextureData!==void 0&&this._renderer.pipeline.updateBlueNoiseTexture(n.scene.blueNoiseTextureData);let h=Object.values(n.frames)[0];if(this._frameView?this._frameView.setCamera(this._camera):(h.preset==="fullscreen"?(this._viewportMode=1,this.canvas.style.display="block",this.canvas.parentElement&&(this._viewportWidth=this.canvas.parentElement.clientWidth||300,this.canvas.style.width="100%"),this.canvas.parentElement&&(this._viewportHeight=this.canvas.parentElement.clientHeight||150,this.canvas.style.height="100%")):(this._viewportMode=2,this._viewportWidth=h.size[0],this._viewportHeight=h.size[1],this.canvas.style.width=`${this._viewportWidth}px`,this.canvas.style.height=`${this._viewportHeight}px`),this._renderer.setSize(this._viewportWidth,this._viewportHeight,!1),this._frameView=new _J(this._renderer,this._camera,new et(this._viewportWidth,this._viewportHeight)),this._frameView.enableResponsive=(h.allowResponsive??!1)&&h.preset==="fullscreen"),e){let u=new QQ(this._renderer,this.data.scene.publish,this._scene,()=>this._scene.activeCamera,this._sharedAssetsManager,this._requestRenderAutoMode,!0,h);this._scene.updateMatrixWorld(!0),this._controls=new Btt(u),this._animationControls=new Ant(this._scene,this._requestRenderAutoMode),this._eventManager=new pJ(n.scene.publish,this._controls,this._animationControls,u,n.shared.variables),this._eventManager.activate(),this._controls.activate(this._eventManager)}this._resize(),this._scene.activePage.data.postprocessing.depthOfField.enabled&&Promise.all(this._sharedAssetsManager.getImageLoadPromises()).then(()=>{this.disposed||this._resize(!0)}),i!==void 0&&this.setVariables(i),this.dt===0&&(this.render(performance.now()),setTimeout(()=>{this._renderer?.setAnimationLoop(this.render)},0)),this._resizeObserverTimeout=setTimeout(()=>{!this._resizeObserver&&this.canvas.parentElement&&(this._resizeObserver=new ResizeObserver(()=>{this._viewportWidth=this.canvas.clientWidth,this._viewportHeight=this.canvas.clientHeight,this._debouncedResize()}),this._resizeObserver.observe(this.canvas.parentElement))},300),document.addEventListener("scroll",this._onScroll),e&&(this._htmlContentOverlay?.dispose(),this._htmlContentOverlay=void 0);let d=n.scene.publish.htmlContent?.html;if(e&&d&&this._htmlContentMode!=="none"){let u={shared:this._sharedAssetsManager,findEntity:p=>this._scene?.getObjectByProperty("uuid",p)??this._scene?.getObjectByName(p)};this._htmlContentOverlay=(this._htmlContentMode==="inline"?z9.mount(this,this.canvas,d,u):U9.mount(this,this.canvas,d,u))??void 0}}setVariables(t){if(this._data!==void 0){let e=Object.entries(t);for(let[i,n]of e)this.setVariable(i,n)}}setVariable(t,e){let i=this._getVariableByName(t);if(i&&!("dynamicVariableType"in i.data)){if(e==null)return void console.warn(`Variable ${t} was not updated: received ${e}. Pass a number, boolean or string.`);let n=e;if(typeof i.data.value=="number"){if(n=typeof e=="number"?e:typeof e=="boolean"?e===!0?1:0:parseFloat(e),!Number.isFinite(n))return void console.warn(`Variable ${t} is a number variable and ${JSON.stringify(e)} cannot be converted to a number. The variable was not updated.`)}else typeof i.data.value=="boolean"?n=typeof e=="number"?!!e:typeof e=="boolean"?e:e.toLocaleLowerCase()!=="false"&&!!e:typeof i.data.value!="string"&&i.data.value.textValue!==void 0&&(n=e.toString());let r=typeof n=="string"?{textValue:n}:n;this._sharedAssetsManager?.updateVariable(i.id,r),this.requestRender(),this._requestRenderAutoMode()}else i===void 0?console.warn(`No variable named ${t} was found in your Spline file. Make sure to create it from Spline editor.`):"dynamicVariableType"in i.data&&console.warn(`Dynamic variables like ${t} cannot be updated from code.`)}getVariables(){let t={};return this._data&&this._data.shared.variables.forEach(e=>{t[e.data.name]===void 0&&(t[e.data.name]=this._getVariableValue(this._sharedAssetsManager.getVariable(e.id)))}),t}getVariable(t){let e=this._getVariableByName(t);if(e){let i=this._sharedAssetsManager.getVariable(e.id);return this._getVariableValue(i)}}_getVariableValue(t){return typeof t!="string"&&br.isTextValue(t)?br.getDisplayedValue(t):t}_getVariableByName(t){if(this._data){if(this._variablesCache.has(t))return this._variablesCache.get(t);let e=this._data.shared.variables.find(i=>i.data.name===t);return e&&this._variablesCache.set(t,e),e}}_getPixelRatio(t){switch(t){case 0:return window.devicePixelRatio;case 1:return 1;case 2:return 2}}findObjectById(t){let e=this._scene?.getObjectByProperty("uuid",t);return this._createProxyObject(e)}findObjectByName(t){let e=this._scene?.getObjectByName(t);return this._createProxyObject(e)}getAllObjects(){let t=[];return this._scene?.traverseEntity(e=>{if(!(e.uuid===ed||this._scene.isInvisibleObjects(e)||e instanceof mn)){let i=this._createProxyObject(e);i&&t.push(i)}}),t}getSplineEvents(){return(this._eventManager?.handlers?.Spline).splineEvents}emitEvent(t,e){(this.findObjectById(e)||this.findObjectByName(e))?.emitEvent(t)}emitEventReverse(t,e){(this.findObjectById(e)||this.findObjectByName(e))?.emitEventReverse(t)}addEventListener(t,e){this.canvas.addEventListener(t,e)}removeEventListener(t,e){this.canvas.removeEventListener(t,e)}setZoom(t){this._controls?.orbitControls instanceof Dj&&this._controls?.orbitControls.setZoom(t)}get eventManager(){return this._eventManager}get controls(){return this._controls}setSize(t,e){this._viewportWidth=t,this._viewportHeight=e,this._viewportMode=2,this._resize()}setBackgroundColor(t){let e=mz(t);this._scene?.activePage.setBackgroundColor(e),this._requestRenderAutoMode()}dispose(){this.disposed=!0,this._htmlContentOverlay?.dispose(),this._htmlContentOverlay=void 0,this._eventManager?.dispose(),this._scene?.dispose(),this._scene=void 0,this._camera=void 0,yg&&yg.disposeAll(),this._sharedAssetsManager?.setRequestRender(()=>{}),this._sharedAssetsManager?.dispose(),this._sharedAssetsManager=void 0,this._proxyObjectCache.forEach(t=>{rM.unsubscribe(t)}),this._proxyObjectCache.clear(),this._variablesCache.clear(),this._renderer?.pipeline.removeEventListener("smaaloaded",this._requestRenderAutoMode),this._renderer?.setAnimationLoop(null),this._renderer&&this._disposeRenderer(this._renderer),this._renderer=void 0,this._rendererConfigured=!1,this._debouncedResize.cancel(),this._resizeObserver&&(this._resizeObserver.disconnect(),this._resizeObserver=void 0),this._resizeObserverTimeout!==void 0&&(clearTimeout(this._resizeObserverTimeout),this._resizeObserverTimeout=void 0),this.canvas.style.width="",this.canvas.style.height="",this.canvas.removeAttribute("width"),this.canvas.removeAttribute("height"),this._frameView=void 0,this._controls?.deactivate(),this._controls=void 0,this._animationControls=void 0,this._eventManager?.eventContext.dispose(),this._eventManager=void 0,this._splatViewer=void 0,this._data=void 0,this._perfs=void 0,this.dt=0,this._lastTime=void 0,function(t){t.removeEventListener("pointerdown",yI,!0),t.removeEventListener("pointerdown",yv,!0),t.removeEventListener("pointermove",yv,!0),t.removeEventListener("pointerup",Bd,!0),t.removeEventListener("pointercancel",Bd,!0),t.removeEventListener("pointerleave",Bd,!0),window.removeEventListener("keydown",_I,!0),window.removeEventListener("keyup",bI,!0)}(this.canvas),document.removeEventListener("scroll",this._onScroll),nn.dispose()}get isStopped(){return this._isPaused}stop(){this._isPaused||(this._renderer?.setAnimationLoop(null),this._isPaused=!0,this._eventManager?.pause(),this._controls?.orbitControls&&(this._controls.orbitControls.enabled=!1))}play(){!this._isPaused||(this._isPaused=!1,this._eventManager?.resume(),this._controls?.orbitControls&&(this._controls.orbitControls.enabled=!0),this._renderer?.setAnimationLoop(this.render))}setGlobalEvents(t){this._eventManager?.updateUseWindowEvents(t)}get data(){return this._data}_createProxyObject(t){if(!this._scene)return;let e,i=this._scene;if(t==null)return;if(this._proxyObjectCache.has(t.uuid))return this._proxyObjectCache.get(t.uuid);t.traverseAncestors(h=>{h instanceof mn&&(e=h.name)});let n=this._sharedAssetsManager,r={shared:n,scene:this._scene},s=h=>{if(h===null||h==="Base State")return null;if(h&&t.data.states){let d=t.data.states.find(u=>u.data.name===h);return d?d.id:void 0}},a="material"in t?t.material:void 0,o=t.materialOverride,l={name:t.name,uuid:t.uuid,visible:t.visible,intensity:t.intensity,position:t.position,rotation:t.rotation,scale:t.scale,type:t.data.type,page:e,material:o??(a?jnt(a):void 0),parentUuid:t.parent instanceof mn||t instanceof Dx?void 0:t.parent?.uuid,emitEvent(h){t.dispatchEvent({type:"userEvent",eventName:h})},emitEventReverse(h){t.dispatchEvent({type:"userEvent",eventName:h,reverse:!0})},hide(){t.visible&&(t.visible=!1,r.shared.requestRender())},show(){t.visible||(t.visible=!0,r.shared.requestRender())},get state(){let h=t.stateSelection;if(h!==null)return t.data.states.find(({id:d})=>d===h)?.data.name},set state(h){let d;if(h!==void 0){let u=typeof h=="string"?t.data.states.find(({id:p})=>p===h):t.data.states[h];if(u)d=u.id;else{let p=typeof h=="string"?s(h):void 0;p&&(d=p)}}t.changeSelectedState(d??null,r),t.currentState=d??null,t.dispatchEvent({type:"completeState",state:d??null}),r.shared.requestRender()},transition(h){let d=L9;if(d===null)return Gn("transitions","obj.transition()"),{transition(b){return this},play(){return this},pause(){return this},reset(){return this},seek(b){return this}};let u,p,f=this,g=[],m=!1,v=()=>{p=new _9({delay:0,delayDirection:"start-once",direction:"normal",repeat:0,runMode:"Repeat"},g.map(b=>b.runner))},y={update(b){p?.update(b),p?.isPlaying!==!0&&nn.remove(y)}},_={transition({from:b,to:x,duration:w,delay:S,...E}){let A=s(b);A===void 0&&(A=u);let P=s(x);return u=P,g.push(new d(t,A,P,{state:P,repeat:0,delay:S??0,delayDirection:"start-once",direction:"normal",duration:w??1e3,...E,...E.easing===6?th.defaultData:E.easing===5?mp.defaultData:{}},n,!1,i.activePage,{onBegin:()=>{(b&&A||b==="Base State"&&!A)&&(f.state=A??void 0)},onComplete:()=>{f.state=P??void 0}})),v(),this},play(){return p?(m=!0,p.play(nn.time),p.isPlaying&&nn.add(y),this):this},pause(){return p?.stop(),nn.remove(y),this},reset(){return this.pause(),m=!1,v(),p?.seek(0),this},seek(b){let x=g.reduce((w,S)=>w+S.runner.duration,0);return x>0&&p?.seek(b/1e3/x),this}};return _.transition(h),(h.autoPlay??!0)&&queueMicrotask(()=>{m||_.play()}),_},set color(h){let d=mz(h);if(Eb.is(t))return void(t.color=d);if(!(t.type==="Mesh"&&"material"in t&&t instanceof Wr))return;let u={r:d.r,g:d.g,b:d.b,a:d.a},p=t.materialOverride;if(p!==void 0){let m=p.color;return void(m?.isColor===!0&&typeof m.setStyle=="function"&&(m.setStyle(h),r.shared.requestRender()))}let f=Array.isArray(t.material)?t.material[0]:t.material,g=f.data.layers.find(m=>m.data.type==="color")?.id;if(g)f.updateByOp({type:0,path:["layers",g],props:{color:{...u}}},f.data,r);else{let m=f.data,v=m.layers.find(S=>S.data.type==="light");if(!v)return;let y=m.layers.indexOf(v)===0?v:null,_=m.layers.at(y?m.layers.indexOf(y)+1:0),b={type:4,fi:y?y.fi+(_?(_.fi-y.fi)/2:1):_?_.fi/2:1,id:Ot.generateUUID(),data:{...tn.defaultData("color"),color:u},localIndex:0},x=m.layers.insertAfterHelper(y?.id??null,1),w=m.layers.runOp({...b,fi:x[0]}).data;Object.assign(f.data,{layers:w}),f.updateByOp({...b,path:["layers"]},f.data,r)}}},c=rM(l,(h,d)=>{let u=t[h],p=function(f){return f.split(".")}(h);p[0]==="material"&&a&&o===void 0&&function(f,g,m){let v=Array.isArray(m)?m[0]:m;if(f[0]==="layers"){let y=parseInt(f[1]),_=v.layers[y],b=f[2];_&&b&&function(x,w,S){let E=x[0];try{if(function(A,P){return!!Hnt[P]?.includes(A)}(E,S.type,x.slice(1)))if(E==="colors"){if(x.length<2)throw new Error("You cannot mutate the colors array, only its items");let A=parseInt(x[1]),P=S.getValue(E)?.[A];if(!P)throw new Error("Color index out of range");bm.setStyle(w),P.set(bm.r,bm.g,bm.b,bm.a)}else S.getValue(E)?.setStyle(w);else if(E==="texture"||E==="video"){let A=S.color;(function(P,C,R,L){let D=P[0];if(D==="repeat"||D==="offset"||D==="rotation"){let F=L.getNode("mat"),V=F&&typeof F.updateMatrix=="function"?F:L.getValue("mat");if(!V)return;if(D==="rotation")V.rotation=parseFloat(C);else{let U=P[1];if(U===void 0)C instanceof Array&&C.length===2&&Object.assign(V,{[D]:C});else{let j=V[D],W=parseInt(U)===0?[parseFloat(C),j[1]]:[j[0],parseFloat(C)];Object.assign(V,{[D]:W})}}V.updateMatrix()}else D==="wrapping"||D==="minFilter"||D==="magFilter"?D==="wrapping"?R.texture.wrap=C:R.texture[D]=C:D==="image"&&P[1]==="data"&&R.texture.image.updateSrc(C)})(x.slice(1),w,A,S)}else{let A=x[1],P=S.getValue(E);P?.isVector3&&A!==void 0||P?.isVector2&&A!==void 0?P.setComponent(parseInt(A),w):S.setValue(E,w)}}catch(A){console.error("Error setting material value",A)}}(f.slice(2),g,_)}else f[0]==="alpha"&&v.layers.forEach(y=>{y.type==="light"&&y.node.alphaOverride!==void 0&&(y.node.alphaOverride.value=g,g<1&&(v.transparent=!0))})}(p.slice(1),d,a),typeof u!="object"&&Object.getOwnPropertyDescriptor(t,h)?.writable&&(t[h]=d),this._requestRenderAutoMode(),t.updateMatrix()});return this._proxyObjectCache.set(t.uuid,c),c}setUIWasmUrl(t){(function(e){pb=e,mx?.setHanaUIWasmUrl(e)})(t)}pauseGameControls(){this._eventManager?.controlsManager.gameControl?.pause()}resumeGameControls(){this._eventManager?.controlsManager.gameControl?.resume()}async swapGeometry(t,e){let i;if(typeof e=="string"){if(!e.endsWith(".splinegeometry"))throw new Error("Only .splinegeometry format is supported");{let l=await(await fetch(e)).arrayBuffer();i=new Uint8Array(l)}}else i=e;let n=jg.deserialize(i),r="data"in n&&n.data.draco!==void 0;r&&await az(this._wasmPath);let s=this._scene?.getObjectByProperty("uuid",t)??this._scene?.getObjectByName(t);if(!s)return void console.warn(`Object ${t} not found`);if(s.data.type!=="Mesh"||!(s instanceof Wr))return void console.warn(`Object ${t} is not a mesh`);let a=s,o={...a.data,geometry:n};r&&await oz([o]),a.updateByOp({type:0,path:[],props:{geometry:o.geometry}},o,{shared:this._sharedAssetsManager,scene:this._scene},!1);for(let l of a.data.states){let c={...l.data};a.states||(a.states={}),a.states[l.id]=ih.patch(o,c)}return i}_applyDocumentTransaction(t){this._data=t.data,this._scene&&(this._scene.data=this._data.scene),this._sharedAssetsManager&&(this._sharedAssetsManager.data=this._data.shared);for(let e of t.actual){let i=e.path;Array.isArray(i)&&i.length===2&&i[0]==="scene"&&i[1]==="objects"&&this._scene?.updateTreeByOp({...e,path:[]},this._sharedAssetsManager)}}_findEntity(t){return this._scene?.getObjectByProperty("uuid",t)??this._scene?.getObjectByName(t)}_resolveParentId(t){if(t===void 0)return this._scene.activePage.uuid;let e=typeof t=="string"?t:t.uuid,i=this._findEntity(e);if(!i)throw new Error(`parent '${e}' \u2014 no object with that name or uuid in the scene.`);return i.uuid}async createCustomMaterial(t){if(this.disposed)throw new Error("createCustomMaterial: this Application was disposed.");if(typeof t!="function")throw new Error("createCustomMaterial: expected a factory function \u2014 createCustomMaterial((three) => new three.MeshStandardNodeMaterial()).");let e=C6();if(e===void 0&&e===void 0)throw new Error("createCustomMaterial: requires the webgpu backend (the runtime default where WebGPU is available). This Application is on the classic WebGL pipeline \u2014 pass { renderer: 'webgpu' } or drop any ?renderer=webgl2 override.");let i=t(e);if(typeof i!="object"||i===null||i.isMaterial!==!0)throw new Error("createCustomMaterial: the factory must return a three.js material built from the namespace it receives \u2014 e.g. (three) => new three.MeshStandardNodeMaterial().");return i}async setMaterial(t,e){if(this.disposed)throw new Error("setMaterial: this Application was disposed.");let i=this._scene;if(!i)throw new Error("setMaterial: no scene loaded \u2014 call load() or start() first.");let n=typeof t=="string"?t:t.uuid,r=this._findEntity(n);if(!r)throw new Error(`setMaterial: '${n}' \u2014 no object with that name or uuid in the scene.`);if(!(r instanceof Wr))throw new Error(`setMaterial: '${n}' is not a mesh \u2014 lights, groups, and cameras have no material.`);let s=typeof e=="function"?await this.createCustomMaterial(e):e;if(Sb()!=="webgpu")throw new Error("setMaterial: custom three.js materials require the webgpu backend (the runtime default where WebGPU is available). This scene is running the classic WebGL pipeline \u2014 pass { renderer: 'webgpu' } or drop any ?renderer=webgl2 override.");let a=dz({material:s});if(a.material===void 0)throw new Error("setMaterial: expected a three.js material instance or a (three) => material factory.");return r.setMaterialOverride(a.material,{scene:i,shared:this._sharedAssetsManager}),this._proxyObjectCache.delete(r.uuid),this._requestRenderAutoMode(),a.material}async createObject(t,e={}){if(this.disposed)throw new Error("createObject: this Application was disposed.");let i=this._scene,n=this._data;if(!i||!n)throw new Error("createObject: no scene loaded \u2014 call load() or start() first.");let r=function(m){if(typeof m!="string"||m.length===0)throw new Error(`createObject: expected a type name string \u2014 one of ${uz}.`);let v=m.replace(/Geometry$/i,"").replace(/[\s_-]/g,"").toLowerCase(),y=Lnt[v];if(y)return{objectType:y};let _=Ont[v];if(_)return{objectType:"Mesh",geometryType:_};let b=Bnt[v];throw b?new Error(`createObject: '${m}' is not supported \u2014 ${b}`):new Error(`createObject: '${m}' is not a creatable Spline type \u2014 use one of ${uz}, e.g. createObject('Cube', { width: 200 }).`)}(t);typeof e.material=="function"&&(e={...e,material:await this.createCustomMaterial(e.material)});let s,a,{options:o,material:l}=dz(e);if(l!==void 0){if(r.objectType!=="Mesh")throw new Error("createObject: a three.js material instance only applies to mesh types \u2014 lights and groups have no material.");if(Sb()!=="webgpu")throw new Error("createObject: three.js material instances require the webgpu backend (the runtime default where WebGPU is available). This scene is running the classic WebGL pipeline \u2014 pass { renderer: 'webgpu' } to the Application, or drop any ?renderer=webgl2 override.")}if(r.geometryType==="TextGeometry"){if(!l3.has("text"))throw new Error("createObject: this runtime build was compiled without the 'text' feature \u2014 re-export the scene with a Text object present, or load the full runtime build.");if(await VB(),a=e.font??Au,n.shared.fonts[a]===void 0){if(a!==Au){let m=Object.keys(n.shared.fonts).join(", ");throw new Error(`createObject: font '${a}' is not in this document \u2014 available fonts: ${m||"(none)"}.`)}s={name:Au,url:SN}}}let c=this._resolveParentId(e.parent),h=knt(r,o,n),d=Ot.generateUUID(),[u,p]=Bm(n);s&&(u.shared.fonts[Au]=s),u.scene.objects.insertAfter(c,null,[{id:d,data:h,children:[]}]);let f=p.result();if(s&&this._sharedAssetsManager.addFont(Au,s),a!==void 0){let m=this._sharedAssetsManager.getFont(a);m&&await m.loadingPromise}this._applyDocumentTransaction(f);let g=i.find(d);return l!==void 0&&g.setMaterialOverride(l,{scene:i,shared:this._sharedAssetsManager}),this._requestRenderAutoMode(),this._createProxyObject(g)}cloneObject(t,e={}){if(this.disposed)throw new Error("cloneObject: this Application was disposed.");let i=this._scene,n=this._data;if(!i||!n)throw new Error("cloneObject: no scene loaded \u2014 call load() or start() first.");let r=typeof t=="string"?t:t?.uuid,s=r?this._findEntity(r):void 0;if(!s)throw new Error(`cloneObject: '${r}' \u2014 no object with that name or uuid in the scene.`);if(s instanceof mn)throw new Error("cloneObject: pages cannot be cloned.");let a=n.scene.objects.get(s.uuid);if(!a)throw new Error(`cloneObject: '${r}' is not part of the document tree (expanded clones and instanced children cannot be cloned \u2014 clone their source object instead).`);let o=function(p,f,g){let m={...p.data};return f.position!==void 0&&(m.position=t0(f.position,[0,0,0])),f.rotation!==void 0&&(m.rotation=t0(f.rotation,[0,0,0])),f.scale!==void 0&&(m.scale=N9(f.scale)),f.visible!==void 0&&(m.visible=f.visible),m.name=f.name??k9(`${p.data.name??"Object"} Copy`,g),{...p,data:m}}(Vnt(a),e,n.scene.objects),l=e.parent!==void 0?this._resolveParentId(e.parent):n.scene.objects.parent(s.uuid)??null,c=e.parent!==void 0?null:s.uuid,[h,d]=Bm(n);h.scene.objects.insertAfter(l,c,[o]),this._applyDocumentTransaction(d.result());let u=i.find(o.id);return this._requestRenderAutoMode(),this._createProxyObject(u)}removeObject(t){let e=this._scene,i=this._data;if(this.disposed||!e||!i)return!1;let n=typeof t=="string"?t:t?.uuid,r=n?this._findEntity(n):void 0;if(!r)return!1;if(r instanceof mn)throw new Error("removeObject: pages cannot be removed.");if(r.data.type==="PerspectiveCamera"||r.data.type==="OrthographicCamera")throw new Error("removeObject: cameras cannot be removed.");if(i.scene.objects.get(r.uuid)===void 0)throw new Error(`removeObject: '${n}' is not part of the document tree (expanded clones and instanced children cannot be removed individually).`);let s=[];r.traverseEntity(l=>{s.push(l.uuid)});let[a,o]=Bm(i);a.scene.objects.delete(r.uuid),this._applyDocumentTransaction(o.result());for(let l of s){let c=this._proxyObjectCache.get(l);c&&(rM.unsubscribe(c),this._proxyObjectCache.delete(l))}return this._requestRenderAutoMode(),!0}};var kx=window,Vx=kx.ShadowRoot&&(kx.ShadyCSS===void 0||kx.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,xP=Symbol(),G9=new WeakMap,_0=class{constructor(e,i,n){if(this._$cssResult$=!0,n!==xP)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=i}get styleSheet(){let e=this.o,i=this.t;if(Vx&&e===void 0){let n=i!==void 0&&i.length===1;n&&(e=G9.get(i)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&G9.set(i,e))}return e}toString(){return this.cssText}},H9=t=>new _0(typeof t=="string"?t:t+"",void 0,xP),wP=(t,...e)=>{let i=t.length===1?t[0]:e.reduce((n,r,s)=>n+(a=>{if(a._$cssResult$===!0)return a.cssText;if(typeof a=="number")return a;throw Error("Value passed to 'css' function must be a 'css' function result: "+a+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(r)+t[s+1],t[0]);return new _0(i,t,xP)},SP=(t,e)=>{Vx?t.adoptedStyleSheets=e.map(i=>i instanceof CSSStyleSheet?i:i.styleSheet):e.forEach(i=>{let n=document.createElement("style"),r=kx.litNonce;r!==void 0&&n.setAttribute("nonce",r),n.textContent=i.cssText,t.appendChild(n)})},jx=Vx?t=>t:t=>t instanceof CSSStyleSheet?(e=>{let i="";for(let n of e.cssRules)i+=n.cssText;return H9(i)})(t):t;var MP,Gx=window,W9=Gx.trustedTypes,qnt=W9?W9.emptyScript:"",q9=Gx.reactiveElementPolyfillSupport,AP={toAttribute(t,e){switch(e){case Boolean:t=t?qnt:null;break;case Object:case Array:t=t==null?t:JSON.stringify(t)}return t},fromAttribute(t,e){let i=t;switch(e){case Boolean:i=t!==null;break;case Number:i=t===null?null:Number(t);break;case Object:case Array:try{i=JSON.parse(t)}catch{i=null}}return i}},X9=(t,e)=>e!==t&&(e==e||t==t),EP={attribute:!0,type:String,converter:AP,reflect:!1,hasChanged:X9},TP="finalized",fl=class extends HTMLElement{constructor(){super(),this._$Ei=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$El=null,this._$Eu()}static addInitializer(e){var i;this.finalize(),((i=this.h)!==null&&i!==void 0?i:this.h=[]).push(e)}static get observedAttributes(){this.finalize();let e=[];return this.elementProperties.forEach((i,n)=>{let r=this._$Ep(n,i);r!==void 0&&(this._$Ev.set(r,n),e.push(r))}),e}static createProperty(e,i=EP){if(i.state&&(i.attribute=!1),this.finalize(),this.elementProperties.set(e,i),!i.noAccessor&&!this.prototype.hasOwnProperty(e)){let n=typeof e=="symbol"?Symbol():"__"+e,r=this.getPropertyDescriptor(e,n,i);r!==void 0&&Object.defineProperty(this.prototype,e,r)}}static getPropertyDescriptor(e,i,n){return{get(){return this[i]},set(r){let s=this[e];this[i]=r,this.requestUpdate(e,s,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)||EP}static finalize(){if(this.hasOwnProperty(TP))return!1;this[TP]=!0;let e=Object.getPrototypeOf(this);if(e.finalize(),e.h!==void 0&&(this.h=[...e.h]),this.elementProperties=new Map(e.elementProperties),this._$Ev=new Map,this.hasOwnProperty("properties")){let i=this.properties,n=[...Object.getOwnPropertyNames(i),...Object.getOwnPropertySymbols(i)];for(let r of n)this.createProperty(r,i[r])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(e){let i=[];if(Array.isArray(e)){let n=new Set(e.flat(1/0).reverse());for(let r of n)i.unshift(jx(r))}else e!==void 0&&i.push(jx(e));return i}static _$Ep(e,i){let n=i.attribute;return n===!1?void 0:typeof n=="string"?n:typeof e=="string"?e.toLowerCase():void 0}_$Eu(){var e;this._$E_=new Promise(i=>this.enableUpdating=i),this._$AL=new Map,this._$Eg(),this.requestUpdate(),(e=this.constructor.h)===null||e===void 0||e.forEach(i=>i(this))}addController(e){var i,n;((i=this._$ES)!==null&&i!==void 0?i:this._$ES=[]).push(e),this.renderRoot!==void 0&&this.isConnected&&((n=e.hostConnected)===null||n===void 0||n.call(e))}removeController(e){var i;(i=this._$ES)===null||i===void 0||i.splice(this._$ES.indexOf(e)>>>0,1)}_$Eg(){this.constructor.elementProperties.forEach((e,i)=>{this.hasOwnProperty(i)&&(this._$Ei.set(i,this[i]),delete this[i])})}createRenderRoot(){var e;let i=(e=this.shadowRoot)!==null&&e!==void 0?e:this.attachShadow(this.constructor.shadowRootOptions);return SP(i,this.constructor.elementStyles),i}connectedCallback(){var e;this.renderRoot===void 0&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(e=this._$ES)===null||e===void 0||e.forEach(i=>{var n;return(n=i.hostConnected)===null||n===void 0?void 0:n.call(i)})}enableUpdating(e){}disconnectedCallback(){var e;(e=this._$ES)===null||e===void 0||e.forEach(i=>{var n;return(n=i.hostDisconnected)===null||n===void 0?void 0:n.call(i)})}attributeChangedCallback(e,i,n){this._$AK(e,n)}_$EO(e,i,n=EP){var r;let s=this.constructor._$Ep(e,n);if(s!==void 0&&n.reflect===!0){let a=(((r=n.converter)===null||r===void 0?void 0:r.toAttribute)!==void 0?n.converter:AP).toAttribute(i,n.type);this._$El=e,a==null?this.removeAttribute(s):this.setAttribute(s,a),this._$El=null}}_$AK(e,i){var n;let r=this.constructor,s=r._$Ev.get(e);if(s!==void 0&&this._$El!==s){let a=r.getPropertyOptions(s),o=typeof a.converter=="function"?{fromAttribute:a.converter}:((n=a.converter)===null||n===void 0?void 0:n.fromAttribute)!==void 0?a.converter:AP;this._$El=s,this[s]=o.fromAttribute(i,a.type),this._$El=null}}requestUpdate(e,i,n){let r=!0;e!==void 0&&(((n=n||this.constructor.getPropertyOptions(e)).hasChanged||X9)(this[e],i)?(this._$AL.has(e)||this._$AL.set(e,i),n.reflect===!0&&this._$El!==e&&(this._$EC===void 0&&(this._$EC=new Map),this._$EC.set(e,n))):r=!1),!this.isUpdatePending&&r&&(this._$E_=this._$Ej())}async _$Ej(){this.isUpdatePending=!0;try{await this._$E_}catch(i){Promise.reject(i)}let e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var e;if(!this.isUpdatePending)return;this.hasUpdated,this._$Ei&&(this._$Ei.forEach((r,s)=>this[s]=r),this._$Ei=void 0);let i=!1,n=this._$AL;try{i=this.shouldUpdate(n),i?(this.willUpdate(n),(e=this._$ES)===null||e===void 0||e.forEach(r=>{var s;return(s=r.hostUpdate)===null||s===void 0?void 0:s.call(r)}),this.update(n)):this._$Ek()}catch(r){throw i=!1,this._$Ek(),r}i&&this._$AE(n)}willUpdate(e){}_$AE(e){var i;(i=this._$ES)===null||i===void 0||i.forEach(n=>{var r;return(r=n.hostUpdated)===null||r===void 0?void 0:r.call(n)}),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$Ek(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$E_}shouldUpdate(e){return!0}update(e){this._$EC!==void 0&&(this._$EC.forEach((i,n)=>this._$EO(n,this[n],i)),this._$EC=void 0),this._$Ek()}updated(e){}firstUpdated(e){}};fl[TP]=!0,fl.elementProperties=new Map,fl.elementStyles=[],fl.shadowRootOptions={mode:"open"},q9?.({ReactiveElement:fl}),((MP=Gx.reactiveElementVersions)!==null&&MP!==void 0?MP:Gx.reactiveElementVersions=[]).push("1.6.3");var CP,Hx=window,Bp=Hx.trustedTypes,$9=Bp?Bp.createPolicy("lit-html",{createHTML:t=>t}):void 0,DP="$lit$",Ch=`lit$${(Math.random()+"").slice(9)}$`,e7="?"+Ch,Xnt=`<${e7}>`,ld=document,x0=()=>ld.createComment(""),w0=t=>t===null||typeof t!="object"&&typeof t!="function",i7=Array.isArray,$nt=t=>i7(t)||typeof t?.[Symbol.iterator]=="function",PP=`[
9949
9949
  \f\r]`,b0=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Y9=/-->/g,Z9=/>/g,ad=RegExp(`>|${PP}(?:([^\\s"'>=/]+)(${PP}*=${PP}*(?:[^
9950
9950
  \f\r"'\`<>=]|("|')|))|$)`,"g"),K9=/'/g,Q9=/"/g,n7=/^(?:script|style|textarea|title)$/i,r7=t=>(e,...i)=>({_$litType$:t,strings:e,values:i}),s7=r7(1),Sft=r7(2),hd=Symbol.for("lit-noChange"),hr=Symbol.for("lit-nothing"),J9=new WeakMap,od=ld.createTreeWalker(ld,129,null,!1);function a7(t,e){if(!Array.isArray(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return $9!==void 0?$9.createHTML(e):e}var Ynt=(t,e)=>{let i=t.length-1,n=[],r,s=e===2?"<svg>":"",a=b0;for(let o=0;o<i;o++){let l=t[o],c,h,d=-1,u=0;for(;u<l.length&&(a.lastIndex=u,h=a.exec(l),h!==null);)u=a.lastIndex,a===b0?h[1]==="!--"?a=Y9:h[1]!==void 0?a=Z9:h[2]!==void 0?(n7.test(h[2])&&(r=RegExp("</"+h[2],"g")),a=ad):h[3]!==void 0&&(a=ad):a===ad?h[0]===">"?(a=r??b0,d=-1):h[1]===void 0?d=-2:(d=a.lastIndex-h[2].length,c=h[1],a=h[3]===void 0?ad:h[3]==='"'?Q9:K9):a===Q9||a===K9?a=ad:a===Y9||a===Z9?a=b0:(a=ad,r=void 0);let p=a===ad&&t[o+1].startsWith("/>")?" ":"";s+=a===b0?l+Xnt:d>=0?(n.push(c),l.slice(0,d)+DP+l.slice(d)+Ch+p):l+Ch+(d===-2?(n.push(void 0),o):p)}return[a7(t,s+(t[i]||"<?>")+(e===2?"</svg>":"")),n]},cd=class{constructor({strings:e,_$litType$:i},n){let r;this.parts=[];let s=0,a=0,o=e.length-1,l=this.parts,[c,h]=Ynt(e,i);if(this.el=cd.createElement(c,n),od.currentNode=this.el.content,i===2){let d=this.el.content,u=d.firstChild;u.remove(),d.append(...u.childNodes)}for(;(r=od.nextNode())!==null&&l.length<o;){if(r.nodeType===1){if(r.hasAttributes()){let d=[];for(let u of r.getAttributeNames())if(u.endsWith(DP)||u.startsWith(Ch)){let p=h[a++];if(d.push(u),p!==void 0){let f=r.getAttribute(p.toLowerCase()+DP).split(Ch),g=/([.?@])?(.*)/.exec(p);l.push({type:1,index:s,name:g[2],strings:f,ctor:g[1]==="."?IP:g[1]==="?"?OP:g[1]==="@"?LP:zp})}else l.push({type:6,index:s})}for(let u of d)r.removeAttribute(u)}if(n7.test(r.tagName)){let d=r.textContent.split(Ch),u=d.length-1;if(u>0){r.textContent=Bp?Bp.emptyScript:"";for(let p=0;p<u;p++)r.append(d[p],x0()),od.nextNode(),l.push({type:2,index:++s});r.append(d[u],x0())}}}else if(r.nodeType===8)if(r.data===e7)l.push({type:2,index:s});else{let d=-1;for(;(d=r.data.indexOf(Ch,d+1))!==-1;)l.push({type:7,index:s}),d+=Ch.length-1}s++}}static createElement(e,i){let n=ld.createElement("template");return n.innerHTML=e,n}};function Up(t,e,i=t,n){var r,s,a,o;if(e===hd)return e;let l=n!==void 0?(r=i._$Co)===null||r===void 0?void 0:r[n]:i._$Cl,c=w0(e)?void 0:e._$litDirective$;return l?.constructor!==c&&((s=l?._$AO)===null||s===void 0||s.call(l,!1),c===void 0?l=void 0:(l=new c(t),l._$AT(t,i,n)),n!==void 0?((a=(o=i)._$Co)!==null&&a!==void 0?a:o._$Co=[])[n]=l:i._$Cl=l),l!==void 0&&(e=Up(t,l._$AS(t,e.values),l,n)),e}var RP=class{constructor(e,i){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=i}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){var i;let{el:{content:n},parts:r}=this._$AD,s=((i=e?.creationScope)!==null&&i!==void 0?i:ld).importNode(n,!0);od.currentNode=s;let a=od.nextNode(),o=0,l=0,c=r[0];for(;c!==void 0;){if(o===c.index){let h;c.type===2?h=new dd(a,a.nextSibling,this,e):c.type===1?h=new c.ctor(a,c.name,c.strings,this,e):c.type===6&&(h=new BP(a,this,e)),this._$AV.push(h),c=r[++l]}o!==c?.index&&(a=od.nextNode(),o++)}return od.currentNode=ld,s}v(e){let i=0;for(let n of this._$AV)n!==void 0&&(n.strings!==void 0?(n._$AI(e,n,i),i+=n.strings.length-2):n._$AI(e[i])),i++}},dd=class{constructor(e,i,n,r){var s;this.type=2,this._$AH=hr,this._$AN=void 0,this._$AA=e,this._$AB=i,this._$AM=n,this.options=r,this._$Cp=(s=r?.isConnected)===null||s===void 0||s}get _$AU(){var e,i;return(i=(e=this._$AM)===null||e===void 0?void 0:e._$AU)!==null&&i!==void 0?i:this._$Cp}get parentNode(){let e=this._$AA.parentNode,i=this._$AM;return i!==void 0&&e?.nodeType===11&&(e=i.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,i=this){e=Up(this,e,i),w0(e)?e===hr||e==null||e===""?(this._$AH!==hr&&this._$AR(),this._$AH=hr):e!==this._$AH&&e!==hd&&this._(e):e._$litType$!==void 0?this.g(e):e.nodeType!==void 0?this.$(e):$nt(e)?this.T(e):this._(e)}k(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}$(e){this._$AH!==e&&(this._$AR(),this._$AH=this.k(e))}_(e){this._$AH!==hr&&w0(this._$AH)?this._$AA.nextSibling.data=e:this.$(ld.createTextNode(e)),this._$AH=e}g(e){var i;let{values:n,_$litType$:r}=e,s=typeof r=="number"?this._$AC(e):(r.el===void 0&&(r.el=cd.createElement(a7(r.h,r.h[0]),this.options)),r);if(((i=this._$AH)===null||i===void 0?void 0:i._$AD)===s)this._$AH.v(n);else{let a=new RP(s,this),o=a.u(this.options);a.v(n),this.$(o),this._$AH=a}}_$AC(e){let i=J9.get(e.strings);return i===void 0&&J9.set(e.strings,i=new cd(e)),i}T(e){i7(this._$AH)||(this._$AH=[],this._$AR());let i=this._$AH,n,r=0;for(let s of e)r===i.length?i.push(n=new dd(this.k(x0()),this.k(x0()),this,this.options)):n=i[r],n._$AI(s),r++;r<i.length&&(this._$AR(n&&n._$AB.nextSibling,r),i.length=r)}_$AR(e=this._$AA.nextSibling,i){var n;for((n=this._$AP)===null||n===void 0||n.call(this,!1,!0,i);e&&e!==this._$AB;){let r=e.nextSibling;e.remove(),e=r}}setConnected(e){var i;this._$AM===void 0&&(this._$Cp=e,(i=this._$AP)===null||i===void 0||i.call(this,e))}},zp=class{constructor(e,i,n,r,s){this.type=1,this._$AH=hr,this._$AN=void 0,this.element=e,this.name=i,this._$AM=r,this.options=s,n.length>2||n[0]!==""||n[1]!==""?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=hr}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(e,i=this,n,r){let s=this.strings,a=!1;if(s===void 0)e=Up(this,e,i,0),a=!w0(e)||e!==this._$AH&&e!==hd,a&&(this._$AH=e);else{let o=e,l,c;for(e=s[0],l=0;l<s.length-1;l++)c=Up(this,o[n+l],i,l),c===hd&&(c=this._$AH[l]),a||(a=!w0(c)||c!==this._$AH[l]),c===hr?e=hr:e!==hr&&(e+=(c??"")+s[l+1]),this._$AH[l]=c}a&&!r&&this.j(e)}j(e){e===hr?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}},IP=class extends zp{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===hr?void 0:e}},Znt=Bp?Bp.emptyScript:"",OP=class extends zp{constructor(){super(...arguments),this.type=4}j(e){e&&e!==hr?this.element.setAttribute(this.name,Znt):this.element.removeAttribute(this.name)}},LP=class extends zp{constructor(e,i,n,r,s){super(e,i,n,r,s),this.type=5}_$AI(e,i=this){var n;if((e=(n=Up(this,e,i,0))!==null&&n!==void 0?n:hr)===hd)return;let r=this._$AH,s=e===hr&&r!==hr||e.capture!==r.capture||e.once!==r.once||e.passive!==r.passive,a=e!==hr&&(r===hr||s);s&&this.element.removeEventListener(this.name,this,r),a&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){var i,n;typeof this._$AH=="function"?this._$AH.call((n=(i=this.options)===null||i===void 0?void 0:i.host)!==null&&n!==void 0?n:this.element,e):this._$AH.handleEvent(e)}},BP=class{constructor(e,i,n){this.element=e,this.type=6,this._$AN=void 0,this._$AM=i,this.options=n}get _$AU(){return this._$AM._$AU}_$AI(e){Up(this,e)}};var t7=Hx.litHtmlPolyfillSupport;t7?.(cd,dd),((CP=Hx.litHtmlVersions)!==null&&CP!==void 0?CP:Hx.litHtmlVersions=[]).push("2.8.0");var S0=(t,e,i)=>{var n,r;let s=(n=i?.renderBefore)!==null&&n!==void 0?n:e,a=s._$litPart$;if(a===void 0){let o=(r=i?.renderBefore)!==null&&r!==void 0?r:null;s._$litPart$=a=new dd(e.insertBefore(x0(),o),o,void 0,i??{})}return a._$AI(t),a};var UP,zP;var Ph=class extends fl{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var e,i;let n=super.createRenderRoot();return(e=(i=this.renderOptions).renderBefore)!==null&&e!==void 0||(i.renderBefore=n.firstChild),n}update(e){let i=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=S0(i,this.renderRoot,this.renderOptions)}connectedCallback(){var e;super.connectedCallback(),(e=this._$Do)===null||e===void 0||e.setConnected(!0)}disconnectedCallback(){var e;super.disconnectedCallback(),(e=this._$Do)===null||e===void 0||e.setConnected(!1)}render(){return hd}};Ph.finalized=!0,Ph._$litElement$=!0,(UP=globalThis.litElementHydrateSupport)===null||UP===void 0||UP.call(globalThis,{LitElement:Ph});var o7=globalThis.litElementPolyfillSupport;o7?.({LitElement:Ph});((zP=globalThis.litElementVersions)!==null&&zP!==void 0?zP:globalThis.litElementVersions=[]).push("3.3.3");var l7=t=>e=>typeof e=="function"?((i,n)=>(customElements.define(i,n),n))(t,e):((i,n)=>{let{kind:r,elements:s}=n;return{kind:r,elements:s,finisher(a){customElements.define(i,a)}}})(t,e);var Knt=(t,e)=>e.kind==="method"&&e.descriptor&&!("value"in e.descriptor)?{...e,finisher(i){i.createProperty(e.key,t)}}:{kind:"field",key:Symbol(),placement:"own",descriptor:{},originalKey:e.key,initializer(){typeof e.initializer=="function"&&(this[e.key]=e.initializer.call(this))},finisher(i){i.createProperty(e.key,t)}},Qnt=(t,e,i)=>{e.constructor.createProperty(i,t)};function Ss(t){return(e,i)=>i!==void 0?Qnt(t,e,i):Knt(t,e)}var FP,Zft=((FP=window.HTMLSlotElement)===null||FP===void 0?void 0:FP.prototype.assignedElements)!=null?(t,e)=>t.assignedElements(e):(t,e)=>t.assignedNodes(e).filter(i=>i.nodeType===Node.ELEMENT_NODE);var Wx=window.IntersectionObserver!=null;var h7=(t=32,e=2)=>{let i=t/2;return s7` <style>
9951
9951
  :host {