@splinetool/viewer 2.0.11 → 2.0.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/build/spline-viewer.cjs
CHANGED
|
@@ -4159,14 +4159,14 @@ void main() {
|
|
|
4159
4159
|
}
|
|
4160
4160
|
post({ kind: 'ready' });
|
|
4161
4161
|
}, 250);
|
|
4162
|
-
})();`}),g1e=k(()=>{J$=class{constructor(e,t,i){this.deps=e,this.onConsole=t,this.onEvent=i,this.disposed=!1,this.eventUnsubs=new Map,this.variablePollHandle=null,this.lastVariables=null}dispose(){this.disposed=!0;for(let e of this.eventUnsubs.values())e();this.eventUnsubs.clear(),this.stopVariablePolling()}execute(e,t){let i=this.deps;switch(e){case"setVariable":{let r=i.setVariable(String(t[0]),t[1]);return r.warning&&this.onConsole("warn",r.warning),r.ok}case"setVariables":{let r=t[0]??{},n=!0;for(let[a,s]of Object.entries(r)){let o=i.setVariable(a,s);o.warning&&this.onConsole("warn",o.warning),n=n&&o.ok}return n}case"getVariable":return i.getVariable(String(t[0]));case"getVariables":return i.getVariables();case"getAllObjects":return i.getAllObjects();case"findObjectByName":case"findObjectById":return i.findObject(String(t[0]));case"getGeometry":{let r=i.getGeometry(String(t[0]),t[1]??{});return r.warning&&this.onConsole("warn",r.warning),r.data}case"updateObject":return i.updateObject(String(t[0]),t[1]??{});case"createObject":return i.createObject(String(t[0]),t[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(t[0]);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(t[0]),t[1]);case"cloneObject":return i.cloneObject(String(t[0]),t[1]??{});case"removeObject":return i.removeObject(String(t[0]));case"spawnObject":{let r=i.spawnObject(String(t[0]),t[1]??{});return r.warning&&this.onConsole("warn",r.warning),r.object}case"destroyObject":return i.destroyObject(String(t[0]));case"setInstanceTransforms":{let r=t[1]===null||t[1]===void 0?null:t[1],n=i.setInstanceTransforms(String(t[0]),r);return n<0&&this.onConsole("warn",`spline.setInstanceTransforms: "${String(t[0])}" has no cloner \u2014 make the object a cloner first (its copies are what this drives).`),n}case"emitEvent":case"emitEventReverse":{let r=i.emitEvent(String(t[0]),String(t[1]),e==="emitEventReverse");return r.warning&&this.onConsole("warn",r.warning),r.ok}case"requestRender":return i.requestRender(),!0;case"listenEvent":{let r=String(t[0]);return r==="variableChange"?this.startVariablePolling():this.eventUnsubs.has(r)||this.eventUnsubs.set(r,i.addSplineEventListener(r,n=>{this.onEvent(r,n)})),!0}case"unlistenEvent":{let r=String(t[0]);return r==="variableChange"?this.stopVariablePolling():(this.eventUnsubs.get(r)?.(),this.eventUnsubs.delete(r)),!0}default:throw new Error(`Unknown spline bridge method: ${e}`)}}startVariablePolling(){this.variablePollHandle===null&&(this.lastVariables=this.deps.getVariables(),this.variablePollHandle=window.setInterval(()=>{if(this.disposed)return;let e=this.deps.getVariables(),t=function(i,r){let n=[];for(let a of Object.keys(r))i[a]!==r[a]&&n.push({name:a,value:r[a]});return n}(this.lastVariables??{},e);this.lastVariables=e;for(let i of t)this.onEvent("variableChange",i)},100))}stopVariablePolling(){this.variablePollHandle!==null&&(window.clearInterval(this.variablePollHandle),this.variablePollHandle=null),this.lastVariables=null}}});function yIe(e,t,i,r){return[e[0]*t+e[4]*i+e[8]*r+e[12],e[1]*t+e[5]*i+e[9]*r+e[13],e[2]*t+e[6]*i+e[10]*r+e[14]]}var _Ie=k(()=>{}),v1e,bIe=k(()=>{}),xIe=k(()=>{eX(),g1e(),v1e=class{constructor(e,t,i){this.iframe=e,this.deps=t,this.onConsole=i,this.disposed=!1,this.handshakeSeen=!1,this.handshakeTimer=null,this.onMessage=r=>{if(this.disposed||r.source!==this.iframe.contentWindow)return;let n=r.data;var a;typeof(a=n)!="object"||a===null||a[mg]!==!0||typeof a.kind!="string"||this.handleMessage(n)},this.host=new J$(t,i,(r,n)=>{this.sendEvent(r,n)})}attach(){window.addEventListener("message",this.onMessage),this.send({[mg]:!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(e){switch(e.kind){case"ready":this.handshakeSeen=!0,this.send({[mg]:!0,kind:"ready-ack"});break;case"console":this.onConsole(e.level,e.text);break;case"call":{let t;try{t=Promise.resolve(this.host.execute(e.method,e.args))}catch(i){t=Promise.reject(i)}t.then(i=>{this.send({[mg]:!0,kind:"result",id:e.id,ok:!0,value:i,error:void 0})},i=>{let r=i instanceof Error?i.message:String(i);this.send({[mg]:!0,kind:"result",id:e.id,ok:!1,value:void 0,error:r}),this.onConsole("error",r)});break}case"input":this.dispatchInput(e.event)}}send(e){this.iframe.contentWindow?.postMessage(e,"*")}sendEvent(e,t){this.send({[mg]:!0,kind:"event",eventName:e,payload:t})}dispatchInput(e){let t=this.deps.getCanvas();if(!t)return;let i=this.iframe.getBoundingClientRect(),r={bubbles:!0,cancelable:!0,view:window,shiftKey:e.shiftKey,ctrlKey:e.ctrlKey,altKey:e.altKey,metaKey:e.metaKey};switch(e.type){case"pointerdown":case"pointermove":case"pointerup":case"pointercancel":t.dispatchEvent(new PointerEvent(e.type,{...r,clientX:(e.x??0)+i.left,clientY:(e.y??0)+i.top,button:e.button,buttons:e.buttons,pointerId:e.pointerId,pointerType:e.pointerType,isPrimary:e.isPrimary,movementX:e.movementX,movementY:e.movementY}));break;case"click":case"dblclick":t.dispatchEvent(new MouseEvent(e.type,{...r,clientX:(e.x??0)+i.left,clientY:(e.y??0)+i.top,button:e.button,buttons:e.buttons}));break;case"wheel":{let n=new WheelEvent("wheel",{...r,clientX:(e.x??0)+i.left,clientY:(e.y??0)+i.top,deltaX:e.deltaX,deltaY:e.deltaY,deltaMode:e.deltaMode});typeof e.wheelDeltaX=="number"&&Object.defineProperty(n,"wheelDeltaX",{value:e.wheelDeltaX}),typeof e.wheelDeltaY=="number"&&Object.defineProperty(n,"wheelDeltaY",{value:e.wheelDeltaY}),t.dispatchEvent(n);break}case"keydown":case"keyup":t.dispatchEvent(new KeyboardEvent(e.type,{...r,key:e.key,code:e.code,repeat:e.repeat}))}}}}),kr=k(()=>{Q$(),rIe(),nIe(),aIe(),oIe(),lIe(),hIe(),uIe(),dIe(),cIe(),pIe(),gIe(),eX(),vIe(),g1e(),_Ie(),bIe(),xIe()}),wIe=k(()=>{});function y1e(e){return Array.isArray(e)?e:[e]}function DO(e,t){let i=0;for(;i<e.length&&i<t.length;){if(e[i]<t[i])return-1;if(e[i]>t[i])return 1;i+=1}return i!==t.length?-1:i!==e.length?1:0}var SIe=k(()=>{});function Gl(e,t){return Object.setPrototypeOf(e,t),e}function jU(e){let t={...e};return Object.setPrototypeOf(t,Object.getPrototypeOf(e)),t}function Ag(e,t,i){if(e===void 0?t===void 0?(e=0,t=10):e=t-10:t===void 0&&(t=e+10),e>t){let a=e;e=t,t=a}let r=[],n=1/(i+1);for(let a=0;a<i;a++){let s=e+(t-e)*(a+.75+.5*Math.random())*n;r.push(s)}return r}function tX(e){return e instanceof Uint8Array||e instanceof Uint16Array||e instanceof Uint32Array||e instanceof Int8Array||e instanceof Int16Array||e instanceof Int32Array||e instanceof Float32Array||e instanceof Float64Array}var TIe=k(()=>{});function iX(e){if(e.deepFreeze!==void 0)return void e.deepFreeze(e);let t=Object.getOwnPropertyNames(e);for(let i of t){let r=e[i];r&&typeof r=="object"&&iX(r)}return Object.freeze(e)}function _1e(e){for(let t of Object.keys(e))e[t]===void 0&&delete e[t];return e}var HU,NO,E7,ti,rX,MIe=k(()=>{}),Js=k(()=>{wIe(),SIe(),TIe(),MIe()}),nX=k(()=>{HU=class{},NO=class extends HU{constructor(e){super(),this.id=e}},E7=class extends HU{constructor(e){super(),this.data=e}}}),EIe=k(()=>{}),b4=k(()=>{ti=class{modifyById(e,t){let i=this;if(i[e]===void 0)throw new Error("not expected");{let r={...i,[e]:t};return Object.setPrototypeOf(r,ti.prototype),r}}add(e,t){return this.runOp({type:1,id:e,data:t})?.data??this}runOp(e){let t=this;if(e.type===1){let i,r=t[e.id];i=r===void 0?{type:2,id:e.id}:{type:1,id:e.id,data:r};let{id:n,data:a}=e,s={...t,[n]:a};return Object.setPrototypeOf(s,ti.prototype),{data:s,actual:e,reverse:i}}if(e.type===2){let{id:i}=e,r=t[i];if(r===void 0)return null;{let n={...t};return Object.setPrototypeOf(n,ti.prototype),delete n[i],{data:n,actual:e,reverse:{type:1,id:i,data:r}}}}return null}}}),aX=k(()=>{rX=class extends Error{}});function b1e(e,t){for(let i of e)t(i.id,i.data)!==!0&&b1e(i.children,t)}function x1e(e,t){if(t(e.id,e.data)!==!0)for(let i of e.children)x1e(i,t)}var As,jC,ew,Nt,o1=k(()=>{Js(),aX(),Js(),As=class extends Array{constructor(...e){super(...e),Fc(this,"partialObjectCaches"),Fc(this,"objCaches"),Fc(this,"parentCaches"),Object.setPrototypeOf(this,As.prototype)}deepFreeze(){let e=0;for(;e<this.length;)iX(this[e]),e++}fillCaches0(e,t){this.objCaches.set(e.id,e),this.parentCaches.set(e.id,t);for(let i of e.children)this.fillCaches0(i,e.id)}fillCaches(){if(this.objCaches===void 0){this.objCaches=new Map,this.parentCaches=new Map;for(let e of this)this.fillCaches0(e,null)}}randomId(){this.fillCaches();let e=Array.from(this.objCaches.keys());if(e.length!==0)return e[Math.max(0,Math.floor(Math.random()*e.length)-1)]}nonExistOrDescendantOf(e,t){if(!this.has(e))return!0;for(;e;){let i=this.parent(e);if(i===t)return!0;e=i}return!1}rootAcestor(e){for(;e;){let t=this.parent(e);if(!t)return e;e=t}return e}isDescendantOf(e,t){for(;e;){let i=this.parent(e);if(i===t)return!0;e=i}return!1}data(e){return this.get(e)?.data}has(e){return this.childrenOf(e)!==void 0}partialCache(e){this.partialObjectCaches===void 0&&(this.partialObjectCaches=new Map);let t=this.get(e);t!==void 0&&this.partialObjectCaches.set(e,t)}get(e){if(this.partialObjectCaches!==void 0){let t=this.partialObjectCaches.get(e);if(t!==void 0)return t}return this.fillCaches(),this.objCaches.get(e)}childrenOf(e){return e===null?this:this.get(e)?.children}traverseFrom(e,t){if(e===null)this.traverse(t);else{let i=this.get(e);i&&x1e(i,t)}}traverse(e){b1e(this,e)}totalSize(){return this.fillCaches(),this.objCaches.size}parent(e){return this.fillCaches(),this.parentCaches.get(e)}childrenArray(e){return e===null?this:this.get(e).children}modifyById(e,t){if(this.get(e)===void 0)throw new Error("not expected");{let i=this.parent(e),r=this.childrenArray(i),n=r.findIndex(o=>o.id===e);if(n<0)throw new Error("not expected");let a=r[n];r=[...r],r[n]={...a,data:t};let s=new Map;return s.set(e,r[n]),this.modifyArrayBy(i,r,s)}}modifyArrayBy(e,t,i=void 0){let r=e,n=t;for(;r!==null;){let s=n,o=r;if(r=this.parent(r),r===void 0)throw new Error;n=this.childrenArray(r);let l=n.findIndex(h=>h.id===o);if(l<0)throw new Error;n=[...n],n[l]={...n[l],children:s},i&&i.set(o,n[l])}Object.setPrototypeOf(n,As.prototype);let a=n;if(i&&this.objCaches!==void 0&&this.parentCaches!==void 0){a.objCaches=this.objCaches;for(let[s,o]of i)a.objCaches.set(s,o);a.parentCaches=this.parentCaches,this.objCaches=void 0,this.parentCaches=void 0}else a.fillCaches();return a}runOp(e){switch(e.type){case 7:return this.addOp(e);case 8:return this.deleteOp(e);case 9:return this.moveOp(e)}return null}checkDuplicatedIdRec({id:e,children:t}){if(this.get(e)!==void 0)return!0;for(let i of t)if(this.checkDuplicatedIdRec(i))return!0;return!1}addOp(e){let{parent:t,fi:i,id:r,data:n,children:a}=e;if(t!==null&&this.get(t)===void 0||this.checkDuplicatedIdRec(e))return null;{let s=t,o=this.childrenArray(s),l={fi:i,id:r,data:n,children:a};return o=[...o,l],o.sort((h,u)=>h.fi-u.fi),e.localIndex=o.indexOf(l),{data:this.modifyArrayBy(s,o),actual:e,reverse:{type:8,id:r}}}}deleteOp(e){let{id:t}=e;if(this.get(t)===null)return null;{let i=this.parent(t);if(i===void 0)return null;let r=this.childrenArray(i),n=r.findIndex(s=>s.id===t);e.localIndex=n,r=[...r];let a=r.splice(n,1)[0];return{data:this.modifyArrayBy(i,r),actual:e,reverse:{type:7,...a,parent:i}}}}moveOp(e){let{parent:t,fi:i,id:r}=e;if(t!==null&&this.get(t)===void 0)return this.deleteOp({type:8,id:r});if(t!==null){let d=t;for(;d!==null;){if(d===void 0)throw new Error;if(d===r)throw new rX("cyclic tree");d=this.parent(d)}}let n=this.parent(r);if(n===void 0)return null;let a=n,s=this.childrenArray(n),o=s.findIndex(d=>d.id===r);s=[...s];let l=s.splice(o,1)[0],h=this.modifyArrayBy(n,s);n=t,s=h.childrenArray(n);let u=l.fi;return l={...l,fi:i},s=[...s,l],s.sort((d,c)=>d.fi-c.fi),e.localIndex=s.indexOf(l),h=h.modifyArrayBy(n,s),{data:h,actual:e,reverse:{type:9,parent:a,fi:u,id:r}}}previous(e,t){if(t===null){let r=this.childrenArray(e);return r.length===0?null:r[r.length-1].id}let i=null;for(let r of this.childrenArray(e)){if(r.id===t)return i;i=r.id}return null}traverseSortNext(e){let t=this.parent(e);if(t!==void 0){let i=this.childrenArray(t),r=i.findIndex(n=>n.id===e)+1;if(r<i.length)return i[r].id;if(t)return this.traverseSortNext(t)}}sortNext(e){let t=this.childrenArray(e);return t.length>0?t[0].id:this.traverseSortNext(e)}traverseSortPrevious(e){let t=this.childrenArray(e);return t.length>0?this.traverseSortPrevious(t[t.length-1].id):e}sortPrevious(e){let t=this.parent(e);if(t!==void 0){let i=this.childrenArray(t),r=i.findIndex(n=>n.id===e)-1;return r>=0?this.traverseSortPrevious(i[r].id):t}}getAllSorted(e){let t=[];for(let i of e){let r=this.getWithSortKey(i.id);r!==void 0&&t.push({...i,...r})}t.sort((i,r)=>DO(i.sortKey,r.sortKey));for(let i of t)delete i.sortKey;return t}getAllIdSorted(e){let t=[];for(let i of e){let r=this.getWithSortKey(i);r!==void 0&&t.push(r)}t.sort((i,r)=>DO(i.sortKey,r.sortKey));for(let i of t)delete i.sortKey;return t.map(i=>i.id)}getWithSortKey(e){let t=e,i=[],r=this.get(t),n=r;if(r!==void 0){for(;t;)i.splice(0,0,r.fi),t=this.parent(t),t!==null&&(r=this.get(t));return{...n,sortKey:i}}}insertBeforeHelper(e,t,i){return this.insertAfterHelper(e,this.previous(e,t),i)}insertAfterHelper(e,t,i){let r=this.childrenArray(e);if(t===null){if(r.length===0)return Ag(0,i,i);{let n=r[0].fi;return Ag(n-i,n,i)}}{let n=this.get(t);if(n===void 0||this.parent(t)!==e)throw new Error("illegal args");let a=r.find(s=>s.fi>n.fi);if(a===void 0){let s=r[r.length-1].fi;return Ag(s,s+i,i)}return Ag(n.fi,a.fi,i)}}}}),sX=k(()=>{var e;jC=null,(e=ew||(ew={})).setPreservePrototype=function(t){jC=t},e.tryPreservePrototype=function(t,i){return Object.getPrototypeOf(t)===jC&&Object.setPrototypeOf(i,jC),i},e.runOp=function(t,i){if(i.type!==0)return null;if(Array.isArray(t)){let r=i.props,n={},a=[...t],s=!1;if(r)for(let o of Object.keys(r)){let l=parseInt(o);if(isNaN(l))throw new Error("wrong index");n[o]=a[l],a[l]=r[o],s=!0}return s?{data:a,actual:i,reverse:{type:0,props:n}}:null}{let r=i.props,n={},a={...t},s=!1;if(r)for(let o of Object.keys(r)){n[o]=a[o];let l=r[o];l===void 0?delete a[o]:a[o]=l,s=!0}return s?{data:e.tryPreservePrototype(t,a),actual:i,reverse:{type:0,props:n}}:null}}}),l1=k(()=>{Js(),Js(),Nt=class extends Array{constructor(...e){super(...e),Fc(this,"objCaches"),Object.setPrototypeOf(this,Nt.prototype)}deepFreeze(){let e=0;for(;e<this.length;)iX(this[e]),e++}fillCaches0(e){this.objCaches.set(e.id,e)}fillCaches(){if(this.objCaches===void 0){this.objCaches=new Map,Object.getOwnPropertyDescriptor(this,"objCaches").enumerable=!1;for(let e of this)this.fillCaches0(e)}}randomId(){this.fillCaches();let e=Array.from(this.objCaches.keys());if(e.length!==0)return e[Math.max(0,Math.floor(Math.random()*e.length)-1)]}data(e){return this.get(e)?.data}get(e){return this.fillCaches(),this.objCaches.get(e)}modifyById(e,t){if(this.get(e)===void 0)throw new Error("not expected");{let i=this,r=i.findIndex(a=>a.id===e);if(r<0)throw new Error("not expected");let n=i[r];return i=[...i],i[r]={...n,data:t},this.modifyArrayBy(i)}}modifyArrayBy(e){Object.setPrototypeOf(e,Nt.prototype);let t=e;return typeof process<"u"||t.fillCaches(),t}runOp(e){switch(e.type){case 4:return this.addOp(e);case 5:return this.deleteOp(e);case 6:return this.moveOp(e)}return null}addOp(e){let{fi:t,id:i,data:r}=e,n=this,a={fi:t,id:i,data:r};return n=[...n,a],n.sort((s,o)=>s.fi-o.fi),e.localIndex=n.indexOf(a),{data:this.modifyArrayBy(n),actual:e,reverse:{type:5,id:i}}}deleteOp(e){let{id:t}=e,i=this,r=i.findIndex(a=>a.id===t);if(r===-1)return null;e.localIndex=r,i=[...i];let n=i.splice(r,1)[0];return{data:this.modifyArrayBy(i),actual:e,reverse:{type:4,...n}}}moveOp(e){let{fi:t,id:i}=e,r=this;r=[...r];let n=r.findIndex(o=>o.id===i);if(n===-1)return null;let a=r[n].fi,s={...r[n],fi:t};return r[n]=s,r.sort((o,l)=>o.fi-l.fi),e.localIndex=r.indexOf(s),{data:this.modifyArrayBy(r),actual:e,reverse:{type:6,fi:a,id:i}}}previous(e){if(e===null)return this.length===0?null:this[this.length-1].id;let t=null;for(let i of this){if(i.id===e)return t;t=i.id}return null}insertBeforeHelper(e,t){return this.insertAfterHelper(this.previous(e),t)}insertAfterHelper(e,t){let i=this;if(e===null){if(i.length===0)return Ag(0,t,t);{let r=i[0].fi;return Ag(r-t,r,t)}}{let r=this.get(e);if(r===void 0)throw new Error("illegal args");let n=i.find(a=>a.fi>r.fi);if(n===void 0){let a=i[i.length-1].fi;return Ag(a,a+t,t)}return Ag(r.fi,n.fi,t)}}}});function AIe(e,t){let i={cur:[],result:[],len:0};return[e=xx(e,t,i)??e,i.result]}function QN(e,t){return e===null?null:(e.cur[e.len]=t,e.len+=1,e)}function JN(e){e&&(e.len-=1)}function w1e(e,t,i){let r=!1,n=e.map(a=>{let s=a.id,o=t[s];if(o!==void 0&&typeof o=="string"&&(r=!0,s=o,i!==null))throw new Error("not supported");let l=xx(a.data,t,QN(i,s));JN(i),r=r||l!==void 0,l===void 0&&(l=a.data);let h=w1e(a.children,t,i);return h!==void 0?r=!0:h=a.children,{...a,id:s,data:l,children:h}});if(r)return n}function xx(e,t,i){if(e instanceof As){let r=w1e(e,t,i);return r!==void 0&&Object.setPrototypeOf(r,Object.getPrototypeOf(e)),r}if(e instanceof Nt)return function(r,n,a){let s=!1,o=r.map(l=>{let h=l.id,u=n[h];if(u!==void 0&&typeof u=="string"&&(s=!0,h=u,a!==null))throw new Error("not supported");let d=xx(l.data,n,QN(a,h));return JN(a),s=s||d!==void 0,d===void 0&&(d=l.data),{...l,id:h,data:d}});if(s)return Object.setPrototypeOf(o,Object.getPrototypeOf(r)),o}(e,t,i);if(Array.isArray(e)){let r=!1,n=e.map((a,s)=>{let o=xx(a,t,QN(i,s));return JN(i),r=r||o!==void 0,o===void 0&&(o=a),o});return r?(Object.setPrototypeOf(n,Object.getPrototypeOf(e)),n):void 0}if(e&&typeof e=="object"&&!tX(e)){let r={},n=!1;for(let[a,s]of Object.entries(e))if(a!=="name"&&a!=="variableId"){let o=t[a];if(typeof o=="string"){if(i!==null)throw new Error("not supported");n=!0,a=o}let l=xx(s,t,QN(i,a));JN(i),n=n||l!==void 0,l===void 0&&(l=s),r[a]=l}else r[a]=s;return n?(Object.setPrototypeOf(r,Object.getPrototypeOf(e)),r):void 0}if(typeof e=="string"){let r=t[e];return r!==void 0&&function(n){if(n===null)return null;n.result.push(n.cur.slice(0,n.len))}(i),r}}var S1e=k(()=>{o1(),l1(),Js()});function wx(e){return e&&typeof e=="object"&&e instanceof Qa}function oX(e,t){if(t===void 0)return;let i=!1,r=e.map(n=>{let a=n.id,s=mE(n.data,t[a]);if(i=i||s!==void 0,s===void 0&&(s=n.data),n.children){let o=oX(n.children,t);return o!==void 0?i=!0:o=n.children,{...n,id:a,data:s,children:o}}return{...n,id:a,data:s}});return i?r:void 0}function mE(e,t){if(!wx(t))return t;if(e instanceof As){let i=oX(e,t);return i!==void 0&&Object.setPrototypeOf(i,Object.getPrototypeOf(e)),i}if(e instanceof Nt)return function(i,r){if(r===void 0)return;let n=!1,a=i.map(s=>{let o=s.id,l=mE(s.data,r[o]);return n=n||l!==void 0,l===void 0&&(l=s.data),{...s,id:o,data:l}});return n?(Object.setPrototypeOf(a,Object.getPrototypeOf(i)),a):void 0}(e,t);if(Array.isArray(e)){let i=!1,r=e.map((n,a)=>{let s=mE(n,t[a]);return i=i||s!==void 0,s===void 0&&(s=n),s});return i?(Object.setPrototypeOf(r,Object.getPrototypeOf(e)),r):void 0}if(e instanceof Qa)return lX(e,t);if(e&&typeof e=="object"){let i={},r=!1;for(let[n,a]of Object.entries(e)){let s=mE(a,t[n]);r=r||s!==void 0,s===void 0&&(s=a),i[n]=s}return r?(Object.setPrototypeOf(i,Object.getPrototypeOf(e)),i):void 0}}function lX(e,t){if(e===void 0)return t;if(t===void 0)return e;if(!wx(t))return t;if(!wx(e))return Ug.apply(e,t);let i=new Set;for(let n of Object.keys(e))i.add(n);for(let n of Object.keys(t))i.add(n);let r=new Qa;for(let n of i){let a=lX(e===void 0?void 0:e[n],t===void 0?void 0:t[n]);r[n]=a}return r}var Qa,Ug,IO,$s,fJ,hX=k(()=>{var e;o1(),l1(),S4(),Js(),Qa=class{unusedFunOverridesTable(t){}runOp(t){let i=[],r=this,n=0,a={};for(;n<t.path.length;){if(i.push(r),r=r===void 0?void 0:r[t.path[n]],r!==void 0&&!wx(r))return null;n+=1}r=r?jU(r):new Qa;for(let[s,o]of Object.entries(t.props)){let l=r[s];a[s]=l,o===void 0?delete r[s]:r[s]=o}for(;n>0;){if(Object.keys(r).length===0){let s=i[n-1];s&&(r=jU(s),delete r[t.path[n-1]])}else{let s=i[n-1];if(s){let o=jU(s);o[t.path[n-1]]=r,r=o}else{let o=new Qa;o[t.path[n-1]]=r,r=o}}n-=1}return{data:Object.setPrototypeOf(r,Qa.prototype),actual:t,reverse:{...t,props:a}}}},(e=Ug||(Ug={})).apply=function(t,i){return mE(t,i)??t},e.merge=function(t,i){return lX(t,i)},e.filterOp=function(t,i){let r=0,n=i.path,a=t;for(;r<n.length&&a!==void 0;){if(a=Ts.zoomOnce(a,n[r]),a===void 0)return i;if(!wx(a))return;r+=1}if(a===void 0)return i;if(wx(a)){if(i.type===0){let s={...i.props};for(let o of Object.keys(a))delete s[o];return{...i,props:s}}if(i.type===1||i.type===4||i.type===7){let s=oX([i],a);return s?s[0]:i}return i}}}),CIe=k(()=>{S4(),b4(),o1(),aX(),sX(),l1(),S1e(),hX(),(IO||(IO={})).replaceProps=function(e,t){let i=Ts.zoom(t,e.path);if(typeof i=="object"){let r={};for(let n of Object.keys(e.props))r[n]=i[n];return{...e,props:r}}return{...e,props:{}}},(e=>{function t(n,a){let s=a.path,o=[];for(;;){let l;if(n instanceof Qa&&a.type===0&&(l=n.runOp({...a,path:s.slice(o.length)}),l===null&&(l=void 0)),l===void 0&&o.length===s.length&&(l=n instanceof As||n instanceof Nt||n instanceof ti?n.runOp(a):ew.runOp(n,a)),l!==void 0){if(l!==null){let d=l.data;for(let c=o.length-1;c>=0;c--){let p=s[c],m=o[c];if(m instanceof As){if(typeof p=="number")throw new Error("illegal arg");d=m.modifyById(p,d)}else if(m instanceof Nt){if(typeof p=="number")throw new Error("illegal arg");d=m.modifyById(p,d)}else if(m instanceof ti){if(typeof p=="number")throw new Error("illegal arg");d=m.modifyById(p,d)}else if(m instanceof Qa){let f={...m,[p]:d};d=Object.setPrototypeOf(f,Qa.prototype)}else{if(typeof m!="object")return null;if(Array.isArray(m)){if(typeof p=="string"&&(p=parseInt(p),isNaN(p)))throw new Error("Invalid path");let f=d;d=[...m],d[p]=f}else d=ew.tryPreservePrototype(m,{...m,[p]:d})}}return{data:d,actual:{...l.actual,path:s},reverse:{...l.reverse,path:s}}}return null}let h,u=s[o.length];if(n instanceof As){if(typeof u=="number")throw new Error("");h=n.get(u)?.data}else if(n instanceof Nt){if(typeof u=="number")throw new Error("");h=n.get(u)?.data}else n!==null&&(h=n[u]);if(h===void 0)return null;o.push(n),n=h}}function i(n,a){for(let s=0;s<n.length&&s<a.length;s++)if(n[s]!==a[s])return!0;return!1}function r(n,a){if(n.length!==a.length)return!1;for(let s=0;s<n.length;s++)if(n[s]!==a[s])return!1;return!0}e.drop=function(n,a){return{...n,path:n.path.slice(a)}},e.applySimple=function(n,a){return t(n,a)?.data??n},e.apply=t,e.pathDisjoint=i,e.pathEq=r,e.commutative=function(n,a){return i(n.path,a.path)},e.subsumed=function(n,a){return!(n.type!==0||a.type!==0||!r(n.path,a.path))&&Object.keys(n.props).every(s=>a.props[s]!==void 0)}})($s||($s={})),(e=>{function t(i,r){let n=i,a=[],s=[];for(let o of r)try{if(o.type===3||o.type===5&&o.path[o.path.length-1]==="variables"){let l,h,u;if(o.type===3?(l=Ts.zoom(n,[...o.path,o.id]),u=$s.apply(n,{...o,type:2})):(l=Ts.zoom(n,[...o.path,o.id,"value"]),u=$s.apply(n,o)),u!==null){n=u.data;let[d,c]=AIe(n,{[o.id]:l});n=d;for(let p=0;p<c.length;p++){let m=c[p],f=m.pop();if(typeof f=="number"){let g=[f];for(let y=p+1;y<c.length;y++){let _=c[y],b=_[_.length-1];if(typeof b!="number"||!Ts.equal(m,_.slice(0,_.length-1)))break;g.push(b),c.splice(y,1)}let v=Ts.zoom(n,m);h=v.map((y,_)=>g.includes(_)?o.id:y),l=v,f=m.pop()}else{if(f==="alphaOverride"||f==="alpha"){l/=100;let g=l,v=Ts.zoom(n,m.slice(0,m.length-2)),y=v.layers.map(_=>_.id===m[m.length-1]?{..._,data:{..._.data,[f]:g}}:_);Object.setPrototypeOf(y,Object.getPrototypeOf(v.layers)),v.layers=y}h=o.id}a.push({type:0,path:m,props:{[f]:l}}),s.push({type:0,path:m,props:{[f]:h}})}s.push(u.reverse),a.push(u.actual)}}else{let l=$s.apply(n,o);l!==null&&(a.push(l.actual),n=l.data,s.push(l.reverse))}}catch(l){if(l instanceof rX)return null;throw l}return{data:n,actual:a,reverse:s.reverse()}}e.empty=function(){return[]},e.removePrefix=function(i,r){let n=[];for(let a of i){let[s,...o]=a.path;s===r&&n.push({...a,path:o})}return n},e.addPrefix=function(i,r){return i.map(n=>({...n,path:[r,...n.path]}))},e.concat=function(i,r){return[...i,...r]},e.compress=function(i,r){return[...i.filter(n=>!r.some(a=>$s.subsumed(n,a))),...r]},e.commutative=function(i,r){return i.every(n=>r.every(a=>$s.commutative(n,a)))},e.applyAll=function(i,r){for(let n of r){let a=t(i,n);a!==null&&(i=a.data)}return i},e.apply=t})(fJ||(fJ={}))});function WU(e,t,i){if(e.length>0){let r=e[e.length-1];if(r.type===0&&t.type===0&&Ts.equal(r.path,i))return void Object.assign(r.props,t.props)}e.push({...t,path:i})}function eI(e,t,i){return i instanceof As?new x4(e,t,i):i instanceof Nt?new w4(e,t,i):i instanceof ti?new Proxy(new M1e(e,t,i),A1e):i!==null&&typeof i=="object"?tX(i)?i:new Proxy(new T1e(e,t,i),E1e):i}function yM(e){let t=new C7(e);return[eI(t,"",e),t]}function OO(e,t){let[i,r]=yM(e);return t(i),r.result()}function $a(e){return e instanceof x4||e instanceof w4?e._current:e!==null&&typeof e=="object"?e[A7]:e}var A7,gJ,RS,G1,T1e,M1e,qU,E1e,A1e,x4,w4,C7,Ts,C1e=k(()=>{b4(),o1(),sX(),l1(),Js(),S4(),A7=Symbol(),gJ=Symbol(),RS=Symbol(),G1=class{reportOp(e,t,i=[]){let r=this;if(t===null)return;r._current=t.data;let n=i;for(;!(r instanceof C7);){let a=r._path,s=r._current;if(a!==""&&n.splice(0,0,a),r=r._parent,r===null)return;r.update(a,s)}r.push(n,e,t.actual,t.reverse)}deleteChildren(e){if(this._children){let t=this._children[e];if(t){let i=t[RS];i&&i(),delete this._children[e]}}}},T1e=class extends G1{constructor(e,t,i){super(),this._parent=e,this._path=t,this._current=i}update(e,t){if(Array.isArray(this._current)){if(typeof e=="string"&&(e=parseInt(e),isNaN(e)))throw new Error("Invalid path");this._current=[...this._current],this._current[e]=t}else this._current=ew.tryPreservePrototype(this._current,{...this._current,[e]:t})}runOp(e){this.reportOp(e,ew.runOp(this._current,e),e.path)}},M1e=class extends G1{constructor(e,t,i){super(),this._parent=e,this._path=t,this._current=i}update(e,t){this._current={...this._current,[e]:t},Object.setPrototypeOf(this._current,ti.prototype)}runOp(e){this.reportOp(e,this._current.runOp(e))}},qU={get(e,t){if(t===RS)return()=>{e._parent=null};if(t===A7)return e._current;if(t===gJ)return e;let{_current:i,_children:r}=e;if(t==="push"&&Array.isArray(i))throw new Error("not supported to expand array");let n=r===void 0?void 0:r[t];if(n!==void 0)return n;let a=i[t],s=eI(e,t,a);return s!==a?(r===void 0&&(r={},e._children=r),r[t]=s,s):a},has:(e,t)=>t in e._current,ownKeys:e=>Reflect.ownKeys(e._current),defineProperty(){throw Error("not supported")},getPrototypeOf:e=>Object.getPrototypeOf(e._current),setPrototypeOf(){throw Error("not supported")},getOwnPropertyDescriptor(e,t){let i=e._current,r=Reflect.getOwnPropertyDescriptor(i,t);return r&&{writable:!0,configurable:!0,enumerable:r.enumerable,value:i[t]}}},E1e={...qU,set(e,t,i){let r={type:0,props:{[t]:$a(i)??i}};return e.deleteChildren(t),e.runOp(r),!0},deleteProperty(e,t){let i={type:0,props:{[t]:void 0}};return e.deleteChildren(t),e.runOp(i),!0}},A1e={...qU,set(e,t,i){return i===void 0?this.deleteProperty(e,t):(e.deleteChildren(t),e.runOp({type:1,id:t,data:i})),!0},deleteProperty:(e,t)=>(e.runOp({type:2,id:t}),!0)},x4=class extends G1{constructor(e,t,i){super(),this._children={},this._parent=e,this._path=t,this._current=i,this[RS]=()=>{this._parent=null}}unproxy(){return this._current}update(e,t){this._current=this._current.modifyById(e,t)}runOp(e){this.reportOp(e,this._current.runOp(e))}randomId(){return this._current.randomId()}isDescendantOf(e,t){return this._current.isDescendantOf(e,t)}childrenOf(e){return this._current.childrenOf(e)}get(e){return this._current.get(e)}parent(e){return this._current.parent(e)}traverse(e){this._current.traverse((t,i)=>{e(t,this.data(t))})}data(e){let{_current:t,_children:i}=this,r=i===void 0?void 0:i[e];if(r!==void 0)return r;let n=t.get(e)?.data,a=eI(this,e,n);return a!==n?(i===void 0&&(i={},this._children=i),i[e]=a,a):n}add(e,t,i,r,n){this.runOp({type:7,parent:e,fi:t,id:i,data:r,children:n})}move(e,t,i){this.runOp({type:9,parent:e,fi:t,id:i})}insertAfter(e,t,i){let r=this._current.insertAfterHelper(e,t,i.length);for(let n=0;n<i.length;n++){let a=i[n];this.add(e,r[n],a.id,a.data,a.children)}}insertBefore(e,t,i){let r=this._current.insertBeforeHelper(e,t,i.length);for(let n=0;n<i.length;n++){let a=i[n];this.add(e,r[n],a.id,a.data,a.children)}}moveAfter(e,t,i){let r=this._current.insertAfterHelper(e,t,i.length);for(let n=0;n<i.length;n++){let a=i[n];this.move(e,r[n],a)}}moveBefore(e,t,i){let r=this._current.insertBeforeHelper(e,t,i.length);for(let n=0;n<i.length;n++){let a=i[n];this.move(e,r[n],a)}}delete(e){this.deleteChildren(e),this.runOp({type:8,id:e})}sortNext(e){return this._current.sortNext(e)}sortPrevious(e){return this._current.sortPrevious(e)}getAllSorted(e){return this._current.getAllSorted(e)}},w4=class extends G1{constructor(e,t,i){super(),this._children={},this._parent=e,this._path=t,this._current=i,this[RS]=()=>{this._parent=null}}unproxy(){return this._current}get length(){return this._current.length}forEach(e){let t=this.length;for(let i=0;i<t;i++){let r=this._current[i].id,n=this._current[i].fi;e(this.data(this._current[i].id),r,n,i)}}find(e){let t=this.length;for(let i=0;i<t;i++){let r=this._current[i].id;if(e(this.data(r),r))return this.get(r)}}update(e,t){this._current=this._current.modifyById(e,t)}randomId(){return this._current.randomId()}get(e){return{...this._current.get(e),data:this.data(e)}}at(e){let{id:t,fi:i}=this._current.at(e);return{id:t,fi:i,data:this.data(t)}}data(e){let{_current:t,_children:i}=this,r=i===void 0?void 0:i[e];if(r!==void 0)return r;let n=t.get(e)?.data,a=eI(this,e,n);return a!==n?(i===void 0&&(i={},this._children=i),i[e]=a,a):n}runOp(e){this.reportOp(e,this._current.runOp(e))}add(e,t,i){this.runOp({type:4,fi:e,id:t,data:i})}move(e,t){this.runOp({type:6,fi:e,id:t})}insertAfter(e,t){let i=this._current.insertAfterHelper(e,t.length);for(let r=0;r<t.length;r++){let n=t[r];this.add(i[r],n.id,n.data)}}insertBefore(e,t){let i=this._current.insertBeforeHelper(e,t.length);for(let r=0;r<t.length;r++){let n=t[r];this.add(i[r],n.id,n.data)}}moveAfter(e,t){let i=this._current.insertAfterHelper(e,t.length);for(let r=0;r<t.length;r++){let n=t[r];this.move(i[r],n)}}moveBefore(e,t){let i=this._current.insertBeforeHelper(e,t.length);for(let r=0;r<t.length;r++){let n=t[r];this.move(i[r],n)}}delete(e){this.deleteChildren(e),this.runOp({type:5,id:e})}},C7=class extends G1{constructor(e){super(),this.ts=[],this.actual=[],this.reverse=[],this._current=e}update(e,t){if(e!=="")throw new Error("");this._current=t}push(e,t,i,r){WU(this.ts,t,e),WU(this.actual,i,e),WU(this.reverse,r,e)}result(){return{data:this._current,ts:this.ts,actual:this.actual,reverse:this.reverse.reverse()}}}}),S4=k(()=>{nX(),C1e(),l1(),o1(),Js(),(e=>{function t(r,n){return(r instanceof As||r instanceof x4)&&typeof n=="string"||(r instanceof Nt||r instanceof w4)&&typeof n=="string"?r.data(n):typeof n=="number"&&Array.isArray(r)||typeof n=="string"&&typeof r=="object"&&r!==null?r[n]:void 0}function i(r,n,a=0){for(;a<n.length&&r!==void 0;)r=t(r,n[a]),a+=1;return r}e.equal=function(r,n){if(n.length!==r.length)return!1;{let a=0;for(;a<r.length;){if(r[a]!==n[a])return!1;a+=1}}return!0},e.removeOverridden=function(r,n,a){let s=i(a,r);if(s!==void 0&&typeof s=="object"&&s!==null){let o={...n};return Object.keys(s).forEach(l=>{delete o[l]}),o}return n},e.zoomOnce=t,e.zoom=i,e.findPathes=function(r,n){let a=[];return function s(o,l){if(o instanceof NO&&o.id===n.id)a.push(l);else if(o instanceof Nt)for(let h=0;h<o.length;h++)s(o[h].data,[...l,o[h].id]);else if(o instanceof As)o.traverse((h,u)=>{s(h,[...l,u])});else if(Array.isArray(o))for(let h=0;h<o.length;h++)s(o[h],[...l,h]);else{if(tX(o))return;if(typeof o=="object"&&o!==null)for(let h in o)s(o[h],[...l,h])}}(r,[]),a}})(Ts||(Ts={}))}),PIe=k(()=>{});function Qr(e,t){let i=[];if(!(t.length<=e.length))return null;{let r=0;for(;r<t.length;){if(t[r]==="*")i.push(e[r]);else if(e[r]!==t[r])return null;r+=1}}return i}var RIe=k(()=>{});function HC(e){try{if(!Rn.trusted&&!_m){let i=Br.sharedLength||0;i<Br.length&&(Br.length=i)}let t;if(Rn.randomAccessStructure&&Pt[Ue]<64&&Pt[Ue]>=32&&wJ?(t=wJ(Pt,Ue,vu,Rn),Pt=null,!(e&&e.lazy)&&t&&(t=t.toJSON()),Ue=vu):t=Za(),Mo&&(Ue=Mo.postBundlePosition,Mo=null),_m&&(Br.restoreStructures=null),Ue==vu)Br&&Br.restoreStructures&&vJ(),Br=null,Pt=null,ym&&(ym=null);else{if(Ue>vu)throw new Error("Unexpected end of MessagePack data");if(!_m){let i;try{i=JSON.stringify(t,(r,n)=>typeof n=="bigint"?`${n}n`:n).slice(0,100)}catch(r){i="(JSON view not available "+r+")"}throw new Error("Data read, but end of buffer not reached "+i)}}return t}catch(t){throw Br&&Br.restoreStructures&&vJ(),R7(),(t instanceof RangeError||t.message.startsWith("Unexpected end of buffer")||Ue>vu)&&(t.incomplete=!0),t}}function vJ(){for(let e in Br.restoreStructures)Br[e]=Br.restoreStructures[e];Br.restoreStructures=null}function Za(){let e=Pt[Ue++];if(e<160){if(e<128){if(e<64)return e;{let t=Br[63&e]||Rn.getStructures&&P1e()[63&e];return t?(t.read||(t.read=P7(t,63&e)),t.read()):e}}if(e<144){if(e-=128,Rn.mapsAsObjects){let t={};for(let i=0;i<e;i++){let r=D1e();r==="__proto__"&&(r="__proto_"),t[r]=Za()}return t}{let t=new Map;for(let i=0;i<e;i++)t.set(Za(),Za());return t}}{e-=144;let t=new Array(e);for(let i=0;i<e;i++)t[i]=Za();return Rn.freezeData?Object.freeze(t):t}}if(e<192){let t=e-160;if(yd>=Ue)return Cg.slice(Ue-Mh,(Ue+=t)-Mh);if(yd==0&&vu<140){let i=t<16?uX(t):R1e(t);if(i!=null)return i}return UO(t)}{let t;switch(e){case 192:return null;case 193:return Mo?(t=Za(),t>0?Mo[1].slice(Mo.position1,Mo.position1+=t):Mo[0].slice(Mo.position0,Mo.position0-=t)):O1e;case 194:return!1;case 195:return!0;case 196:if(t=Pt[Ue++],t===void 0)throw new Error("Unexpected end of buffer");return $U(t);case 197:return t=Er.getUint16(Ue),Ue+=2,$U(t);case 198:return t=Er.getUint32(Ue),Ue+=4,$U(t);case 199:return D0(Pt[Ue++]);case 200:return t=Er.getUint16(Ue),Ue+=2,D0(t);case 201:return t=Er.getUint32(Ue),Ue+=4,D0(t);case 202:if(t=Er.getFloat32(Ue),Rn.useFloat32>2){let i=B7[(127&Pt[Ue])<<1|Pt[Ue+1]>>7];return Ue+=4,(i*t+(t>0?.5:-.5)|0)/i}return Ue+=4,t;case 203:return t=Er.getFloat64(Ue),Ue+=8,t;case 204:return Pt[Ue++];case 205:return t=Er.getUint16(Ue),Ue+=2,t;case 206:return t=Er.getUint32(Ue),Ue+=4,t;case 207:return Rn.int64AsType==="number"?(t=4294967296*Er.getUint32(Ue),t+=Er.getUint32(Ue+4)):Rn.int64AsType==="string"?t=Er.getBigUint64(Ue).toString():Rn.int64AsType==="auto"?(t=Er.getBigUint64(Ue),t<=BigInt(2)<<BigInt(52)&&(t=Number(t))):t=Er.getBigUint64(Ue),Ue+=8,t;case 208:return Er.getInt8(Ue++);case 209:return t=Er.getInt16(Ue),Ue+=2,t;case 210:return t=Er.getInt32(Ue),Ue+=4,t;case 211:return Rn.int64AsType==="number"?(t=4294967296*Er.getInt32(Ue),t+=Er.getUint32(Ue+4)):Rn.int64AsType==="string"?t=Er.getBigInt64(Ue).toString():Rn.int64AsType==="auto"?(t=Er.getBigInt64(Ue),t>=BigInt(-2)<<BigInt(52)&&t<=BigInt(2)<<BigInt(52)&&(t=Number(t))):t=Er.getBigInt64(Ue),Ue+=8,t;case 212:if(t=Pt[Ue++],t==114)return L7(63&Pt[Ue++]);{let i=_o[t];if(i)return i.read?(Ue++,i.read(Za())):i.noBuffer?(Ue++,i()):i(Pt.subarray(Ue,++Ue));throw new Error("Unknown extension "+t)}case 213:return t=Pt[Ue],t==114?(Ue++,L7(63&Pt[Ue++],Pt[Ue++])):D0(2);case 214:return D0(4);case 215:return D0(8);case 216:return D0(16);case 217:return t=Pt[Ue++],yd>=Ue?Cg.slice(Ue-Mh,(Ue+=t)-Mh):B1e(t);case 218:return t=Er.getUint16(Ue),yd>=(Ue+=2)?Cg.slice(Ue-Mh,(Ue+=t)-Mh):U1e(t);case 219:return t=Er.getUint32(Ue),yd>=(Ue+=4)?Cg.slice(Ue-Mh,(Ue+=t)-Mh):F1e(t);case 220:return t=Er.getUint16(Ue),Ue+=2,yJ(t);case 221:return t=Er.getUint32(Ue),Ue+=4,yJ(t);case 222:return t=Er.getUint16(Ue),Ue+=2,_J(t);case 223:return t=Er.getUint32(Ue),Ue+=4,_J(t);default:if(e>=224)return e-256;if(e===void 0){let i=new Error("Unexpected end of MessagePack data");throw i.incomplete=!0,i}throw new Error("Unknown MessagePack token "+e)}}}function P7(e,t){function i(){if(i.count++>N7){let n;try{n=e.read=new Function("r","return function(){return "+(Rn.freezeData?"Object.freeze":"")+"({"+e.map(a=>a==="__proto__"?"__proto_:r()":L1e.test(a)?a+":r()":"["+JSON.stringify(a)+"]:r()").join(",")+"})}")(Za)}catch{return N7=1/0,i()}return e.read0=n,e.highByte===0&&(e.read=I7(t,e.read)),n()}let r={};for(let n=0,a=e.length;n<a;n++){let s=e[n];s==="__proto__"&&(s="__proto_"),r[s]=Za()}return Rn.freezeData?Object.freeze(r):r}return i.count=0,e.read0=i,e.highByte===0?I7(t,i):i}function P1e(){let e=I1e(()=>(Pt=null,Rn.getStructures()));return Br=Rn._mergeStructures(e,Br)}function _M(e){let t;if(e<16&&(t=uX(e)))return t;if(e>64&&D7)return D7.decode(Pt.subarray(Ue,Ue+=e));let i=Ue+e,r=[];for(t="";Ue<i;){let n=Pt[Ue++];if(128&n)if((224&n)==192){let a=(31&n)<<6|63&Pt[Ue++];a<128?r.push(65533):r.push(a)}else if((240&n)==224){let a=(31&n)<<12|(63&Pt[Ue++])<<6|63&Pt[Ue++];a<2048||a>=55296&&a<=57343?r.push(65533):r.push(a)}else if((248&n)==240){let a=(7&n)<<18|(63&Pt[Ue++])<<12|(63&Pt[Ue++])<<6|63&Pt[Ue++];a<65536||a>1114111?r.push(65533):(a>65535&&(a-=65536,r.push(a>>>10&1023|55296),a=56320|1023&a),r.push(a))}else r.push(65533);else r.push(n);r.length>=4096&&(t+=ws.apply(String,r),r.length=0)}return r.length>0&&(t+=ws.apply(String,r)),t}function yJ(e){let t=new Array(e);for(let i=0;i<e;i++)t[i]=Za();return Rn.freezeData?Object.freeze(t):t}function _J(e){if(Rn.mapsAsObjects){let t={};for(let i=0;i<e;i++){let r=D1e();r==="__proto__"&&(r="__proto_"),t[r]=Za()}return t}{let t=new Map;for(let i=0;i<e;i++)t.set(Za(),Za());return t}}function R1e(e){let t=Ue,i=new Array(e);for(let r=0;r<e;r++){let n=Pt[Ue++];if((128&n)>0)return void(Ue=t);i[r]=n}return ws.apply(String,i)}function uX(e){if(e<4){if(e<2){if(e===0)return"";{let t=Pt[Ue++];return(128&t)>1?void(Ue-=1):ws(t)}}{let t=Pt[Ue++],i=Pt[Ue++];if((128&t)>0||(128&i)>0)return void(Ue-=2);if(e<3)return ws(t,i);let r=Pt[Ue++];return(128&r)>0?void(Ue-=3):ws(t,i,r)}}{let t=Pt[Ue++],i=Pt[Ue++],r=Pt[Ue++],n=Pt[Ue++];if((128&t)>0||(128&i)>0||(128&r)>0||(128&n)>0)return void(Ue-=4);if(e<6){if(e===4)return ws(t,i,r,n);{let a=Pt[Ue++];return(128&a)>0?void(Ue-=5):ws(t,i,r,n,a)}}if(e<8){let a=Pt[Ue++],s=Pt[Ue++];if((128&a)>0||(128&s)>0)return void(Ue-=6);if(e<7)return ws(t,i,r,n,a,s);let o=Pt[Ue++];return(128&o)>0?void(Ue-=7):ws(t,i,r,n,a,s,o)}{let a=Pt[Ue++],s=Pt[Ue++],o=Pt[Ue++],l=Pt[Ue++];if((128&a)>0||(128&s)>0||(128&o)>0||(128&l)>0)return void(Ue-=8);if(e<10){if(e===8)return ws(t,i,r,n,a,s,o,l);{let h=Pt[Ue++];return(128&h)>0?void(Ue-=9):ws(t,i,r,n,a,s,o,l,h)}}if(e<12){let h=Pt[Ue++],u=Pt[Ue++];if((128&h)>0||(128&u)>0)return void(Ue-=10);if(e<11)return ws(t,i,r,n,a,s,o,l,h,u);let d=Pt[Ue++];return(128&d)>0?void(Ue-=11):ws(t,i,r,n,a,s,o,l,h,u,d)}{let h=Pt[Ue++],u=Pt[Ue++],d=Pt[Ue++],c=Pt[Ue++];if((128&h)>0||(128&u)>0||(128&d)>0||(128&c)>0)return void(Ue-=12);if(e<14){if(e===12)return ws(t,i,r,n,a,s,o,l,h,u,d,c);{let p=Pt[Ue++];return(128&p)>0?void(Ue-=13):ws(t,i,r,n,a,s,o,l,h,u,d,c,p)}}{let p=Pt[Ue++],m=Pt[Ue++];if((128&p)>0||(128&m)>0)return void(Ue-=14);if(e<15)return ws(t,i,r,n,a,s,o,l,h,u,d,c,p,m);let f=Pt[Ue++];return(128&f)>0?void(Ue-=15):ws(t,i,r,n,a,s,o,l,h,u,d,c,p,m,f)}}}}}function bJ(){let e,t=Pt[Ue++];if(t<192)e=t-160;else switch(t){case 217:e=Pt[Ue++];break;case 218:e=Er.getUint16(Ue),Ue+=2;break;case 219:e=Er.getUint32(Ue),Ue+=4;break;default:throw new Error("Expected string")}return _M(e)}function $U(e){return Rn.copyBuffers?Uint8Array.prototype.slice.call(Pt,Ue,Ue+=e):Pt.subarray(Ue,Ue+=e)}function D0(e){let t=Pt[Ue++];if(_o[t]){let i;return _o[t](Pt.subarray(Ue,i=Ue+=e),r=>{Ue=r;try{return Za()}finally{Ue=i}})}throw new Error("Unknown extension type "+t)}function D1e(){let e=Pt[Ue++];if(!(e>=160&&e<192))return Ue--,N1e(Za());if(e-=160,yd>=Ue)return Cg.slice(Ue-Mh,(Ue+=e)-Mh);if(!(yd==0&&vu<180))return UO(e);let t,i=4095&(e<<5^(e>1?Er.getUint16(Ue):e>0?Pt[Ue]:0)),r=O7[i],n=Ue,a=Ue+e-3,s=0;if(r&&r.bytes==e){for(;n<a;){if(t=Er.getUint32(n),t!=r[s++]){n=1879048192;break}n+=4}for(a+=3;n<a;)if(t=Pt[n++],t!=r[s++]){n=1879048192;break}if(n===a)return Ue=n,r.string;a-=3,n=Ue}for(r=[],O7[i]=r,r.bytes=e;n<a;)t=Er.getUint32(n),r.push(t),n+=4;for(a+=3;n<a;)t=Pt[n++],r.push(t);let o=e<16?uX(e):R1e(e);return r.string=o??UO(e)}function N1e(e){if(typeof e=="string")return e;if(typeof e=="number"||typeof e=="boolean"||typeof e=="bigint")return e.toString();if(e==null)return e+"";if(Rn.allowArraysInMapKeys&&Array.isArray(e)&&e.flat().every(t=>["string","number","boolean","bigint"].includes(typeof t)))return e.flat().toString();throw new Error("Invalid property type for record: "+typeof e)}function I1e(e){SJ&&SJ();let t=vu,i=Ue,r=BO,n=Mh,a=yd,s=Cg,o=LO,l=ym,h=Mo,u=new Uint8Array(Pt.slice(0,vu)),d=Br,c=Br.slice(0,Br.length),p=Rn,m=_m,f=e();return vu=t,Ue=i,BO=r,Mh=n,yd=a,Cg=s,LO=o,ym=l,Mo=h,Pt=u,_m=m,(Br=d).splice(0,Br.length,...c),Rn=p,Er=new DataView(Pt.buffer,Pt.byteOffset,Pt.byteLength),f}function R7(){Pt=null,ym=null,Br=null}function DIe(e){e.unpack?_o[e.type]=e.unpack:_o[e.type]=e}var D7,Pt,vu,Ue,xJ,LO,BO,Rn,Br,Cg,Mh,yd,Mo,ym,_o,Er,XU,O1e,_m,N7,wJ,SJ,bM,L1e,I7,UO,B1e,U1e,F1e,ws,O7,L7,YU,TJ,MJ,EJ,B7,WC,AJ,CJ,PJ,U7,KU,rA,NIe=k(()=>{try{D7=new TextDecoder}catch{}Ue=0,LO=xJ=[],BO=0,Rn={},Mh=0,yd=0,_o=[],XU={useRecords:!1,mapsAsObjects:!0},(O1e=new class{}).name="MessagePack 0xC1",_m=!1,N7=2,bM=class{constructor(e){e&&(e.useRecords===!1&&e.mapsAsObjects===void 0&&(e.mapsAsObjects=!0),e.sequential&&e.trusted!==!1&&(e.trusted=!0,!e.structures&&e.useRecords!=0&&(e.structures=[],e.maxSharedStructures||(e.maxSharedStructures=0))),e.structures?e.structures.sharedLength=e.structures.length:e.getStructures&&((e.structures=[]).uninitialized=!0,e.structures.sharedLength=0),e.int64AsNumber&&(e.int64AsType="number")),Object.assign(this,e)}unpack(e,t){if(Pt)return I1e(()=>(R7(),this?this.unpack(e,t):bM.prototype.unpack.call(XU,e,t)));!e.buffer&&e.constructor===ArrayBuffer&&(e=typeof Buffer<"u"?Buffer.from(e):new Uint8Array(e)),typeof t=="object"?(vu=t.end||e.length,Ue=t.start||0):(Ue=0,vu=t>-1?t:e.length),BO=0,yd=0,Cg=null,LO=xJ,Mo=null,Pt=e;try{Er=e.dataView||(e.dataView=new DataView(e.buffer,e.byteOffset,e.byteLength))}catch(i){throw Pt=null,e instanceof Uint8Array?i:new Error("Source must be a Uint8Array or Buffer but was a "+(e&&typeof e=="object"?e.constructor.name:typeof e))}if(this instanceof bM){if(Rn=this,this.structures)return Br=this.structures,HC(t);(!Br||Br.length>0)&&(Br=[])}else Rn=XU,(!Br||Br.length>0)&&(Br=[]);return HC(t)}unpackMultiple(e,t){let i,r=0;try{_m=!0;let n=e.length,a=this?this.unpack(e,n):WC.unpack(e,n);if(!t){for(i=[a];Ue<n;)r=Ue,i.push(HC());return i}if(t(a,r,Ue)===!1)return;for(;Ue<n;)if(r=Ue,t(HC(),r,Ue)===!1)return}catch(n){throw n.lastPosition=r,n.values=i,n}finally{_m=!1,R7()}}_mergeStructures(e,t){e=e||[],Object.isFrozen(e)&&(e=e.map(i=>i.slice(0)));for(let i=0,r=e.length;i<r;i++){let n=e[i];n&&(n.isShared=!0,i>=32&&(n.highByte=i-32>>5))}e.sharedLength=e.length;for(let i in t||[])if(i>=0){let r=e[i],n=t[i];n&&(r&&((e.restoreStructures||(e.restoreStructures=[]))[i]=r),e[i]=n)}return this.structures=e}decode(e,t){return this.unpack(e,t)}},L1e=/^[a-zA-Z_$][a-zA-Z\d_$]*$/,I7=(e,t)=>function(){let i=Pt[Ue++];if(i===0)return t();let r=e<32?-(e+(i<<5)):e+(i<<5),n=Br[r]||P1e()[r];if(!n)throw new Error("Record id is not defined for "+r);return n.read||(n.read=P7(n,e)),n.read()},UO=_M,B1e=_M,U1e=_M,F1e=_M,ws=String.fromCharCode,O7=new Array(4096),L7=(e,t)=>{let i=Za().map(N1e),r=e;t!==void 0&&(e=e<32?-((t<<5)+e):(t<<5)+e,i.highByte=t);let n=Br[e];return n&&(n.isShared||_m)&&((Br.restoreStructures||(Br.restoreStructures=[]))[e]=n),Br[e]=i,i.read=P7(i,r),(i.read0||i.read)()},_o[0]=()=>{},_o[0].noBuffer=!0,_o[66]=e=>{let t=e.byteLength%8||8,i=BigInt(128&e[0]?e[0]-256:e[0]);for(let r=1;r<t;r++)i<<=BigInt(8),i+=BigInt(e[r]);if(e.byteLength!==t){let r=new DataView(e.buffer,e.byteOffset,e.byteLength),n=(a,s)=>{let o=s-a;if(o<=40){let d=r.getBigUint64(a);for(let c=a+8;c<s;c+=8)d<<=BigInt(64),d|=r.getBigUint64(c);return d}let l=a+(o>>4<<3),h=n(a,l),u=n(l,s);return h<<BigInt(8*(s-l))|u};i=i<<BigInt(8*(r.byteLength-t))|n(t,r.byteLength)}return i},YU={Error,EvalError,RangeError,ReferenceError,SyntaxError,TypeError,URIError,AggregateError:typeof AggregateError=="function"?AggregateError:null},_o[101]=()=>{let e=Za();if(!YU[e[0]]){let t=Error(e[1],{cause:e[2]});return t.name=e[0],t}return YU[e[0]](e[1],{cause:e[2]})},_o[105]=e=>{if(Rn.structuredClone===!1)throw new Error("Structured clone extension is disabled");let t=Er.getUint32(Ue-4);ym||(ym=new Map);let i,r=Pt[Ue];i=r>=144&&r<160||r==220||r==221?[]:r>=128&&r<144||r==222||r==223?new Map:(r>=199&&r<=201||r>=212&&r<=216)&&Pt[Ue+1]===115?new Set:{};let n={target:i};ym.set(t,n);let a=Za();if(!n.used)return n.target=a;if(Object.assign(i,a),i instanceof Map)for(let[s,o]of a.entries())i.set(s,o);if(i instanceof Set)for(let s of Array.from(a))i.add(s);return i},_o[112]=e=>{if(Rn.structuredClone===!1)throw new Error("Structured clone extension is disabled");let t=Er.getUint32(Ue-4),i=ym.get(t);return i.used=!0,i.target},_o[115]=()=>new Set(Za()),TJ=["Int8","Uint8","Uint8Clamped","Int16","Uint16","Int32","Uint32","Float32","Float64","BigInt64","BigUint64"].map(e=>e+"Array"),MJ=typeof globalThis=="object"?globalThis:window,_o[116]=e=>{let t=e[0],i=Uint8Array.prototype.slice.call(e,1).buffer,r=TJ[t];if(!r){if(t===16)return i;if(t===17)return new DataView(i);throw new Error("Could not find typed array for code "+t)}return new MJ[r](i)},_o[120]=()=>{let e=Za();return new RegExp(e[0],e[1])},EJ=[],_o[98]=e=>{let t=(e[0]<<24)+(e[1]<<16)+(e[2]<<8)+e[3],i=Ue;return Ue+=t-e.length,Mo=EJ,(Mo=[bJ(),bJ()]).position0=0,Mo.position1=0,Mo.postBundlePosition=Ue,Ue=i,Za()},_o[255]=e=>e.length==4?new Date(1e3*(16777216*e[0]+(e[1]<<16)+(e[2]<<8)+e[3])):e.length==8?new Date(((e[0]<<22)+(e[1]<<14)+(e[2]<<6)+(e[3]>>2))/1e6+1e3*(4294967296*(3&e[3])+16777216*e[4]+(e[5]<<16)+(e[6]<<8)+e[7])):e.length==12?new Date(((e[0]<<24)+(e[1]<<16)+(e[2]<<8)+e[3])/1e6+1e3*((128&e[4]?-281474976710656:0)+1099511627776*e[6]+4294967296*e[7]+16777216*e[8]+(e[9]<<16)+(e[10]<<8)+e[11])):new Date("invalid"),B7=new Array(147);for(let e=0;e<256;e++)B7[e]=+("1e"+Math.floor(45.15-.30103*e));(WC=new bM({useRecords:!1})).unpack,WC.unpackMultiple,WC.unpack,AJ=new Float32Array(1),new Uint8Array(AJ.buffer,0,4)}),IIe=k(()=>{NIe(),nX(),hX(),l1(),b4(),o1(),CJ=[{Class:ti.prototype.constructor,type:1,write:e=>({...e}),read:e=>(Object.setPrototypeOf(e,ti.prototype),e)},{Class:Nt.prototype.constructor,type:2,write:e=>[...e],read:e=>(Object.setPrototypeOf(e,Nt.prototype),e)},{Class:As.prototype.constructor,type:3,write:e=>[...e],read:e=>(Object.setPrototypeOf(e,As.prototype),e)},{Class:NO.prototype.constructor,type:4,write:e=>e.id,read:e=>new NO(e)},{Class:E7.prototype.constructor,type:5,write:e=>e.data,read:e=>new E7(e)},{Class:Qa.prototype.constructor,type:6,write:e=>({...e}),read:e=>(Object.setPrototypeOf(e,Qa.prototype),e)}];for(let e of CJ)DIe(e);PJ=new bM({structuredClone:!0}),(U7||(U7={})).deserialize=function(e){return PJ.unpack(e)}}),OIe=k(()=>{IIe(),KU=e=>()=>{throw new Error(e+" is not available in the runtime build (decode-only CollabSerialize)")},rA={deserialize:U7.deserialize,serialize:KU("CollabSerialize.serialize"),checksum:KU("CollabSerialize.checksum")}}),Nr=k(()=>{S4(),EIe(),aX(),o1(),b4(),sX(),l1(),CIe(),PIe(),C1e(),RIe(),nX(),OIe(),S1e(),hX()});function FO(e){return e==="MouseDown"||e==="MouseUp"||e==="KeyDown"||e==="KeyUp"||e==="Collision"||e==="Trigger"}var RJ,F7,tx,qC,ZU,DJ,NJ,IJ,z7,V7,OJ,LJ,BJ,UJ,FJ,k7,G7,zJ,VJ,kJ,GJ,z1e=k(()=>{var e,t,i;Nr(),le(),(e=RJ||(RJ={})).toEventUIType=function(r){return r.type==="Conditional"?r.condition.type==="Distance"?"Distance":"StateChange":r.type},e.fromEventUIType=function(r){return r==="Distance"||r==="StateChange"?"Conditional":r},F7={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"]},(r=>{r.is=function(n){return n.type==="MouseDown"||n.type==="MouseUp"||n.type==="MousePress"||n.type==="KeyDown"||n.type==="KeyUp"||n.type==="KeyPress"},r.defaultData=function(n){return n==="MouseDown"||n==="MouseUp"||n==="MousePress"?{type:n,mode:"Object",disabled:!1,name:"",actions:new Nt}:{type:n,disabled:!1,name:"",key:void 0,actions:new Nt}}})(tx||(tx={})),(r=>{r.propertyDefaultData=function(n){return{type:"Property",value:[n??null,"position","x"]}},r.valueDefaultData={type:"Literal",value:0}})(qC||(qC={})),(t=ZU||(ZU={})).comparisonDefaultData=function(r){return{type:"Comparison",operator:"==",lOperand:qC.propertyDefaultData(r),rOperand:{...qC.valueDefaultData}}},t.distanceDefaultData=function(r){return{type:"Distance",toObject:r??null,fromObject:r??null,distance:200}},t.stateDefaultData=function(r,n){return{type:"State",object:r??null,state:n??null}},(DJ||(DJ={})).isConditionalSubActions=function(r){return r.find(n=>n==="ifActions"||n==="elseActions")!==void 0},(r=>{r.is=function(n){return n.type==="Conditional"},r.defaultData=function(n){return{type:"Conditional",disabled:!1,name:"",inActions:new Nt,outActions:new Nt,condition:ZU.distanceDefaultData(n)}}})(NJ||(NJ={})),(IJ||(IJ={})).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 Nt,drop:new Nt}},(z7||(z7={})).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 Nt},(V7||(V7={})).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},(r=>{r.is=function(n){return n.type==="MouseHover"},r.defaultData=function(){return{type:"MouseHover",disabled:!1,name:"",actions:new Nt}}})(OJ||(OJ={})),(r=>{r.is=function(n){return n.type==="Scroll"},r.defaultData=function(){return{type:"Scroll",disabled:!1,name:"",steps:100,trigger:"load",startFrom:"enter",enterAnchor:"top",startOffset:0,endAfter:400,actions:new Nt}}})(LJ||(LJ={})),(r=>{r.is=function(n){return n.type==="Start"},r.defaultData=function(){return{type:"Start",disabled:!1,name:"",actions:new Nt}}})(BJ||(BJ={})),(r=>{r.is=function(n){return n.type==="Collision"},r.defaultData=function(){return{type:"Collision",disabled:!1,name:"",target:"character",actions:new Nt}}})(UJ||(UJ={})),(r=>{r.is=function(n){return n.type==="Trigger"},r.defaultData=function(n,a){return{type:"Trigger",name:"",disabled:!1,target:"all",triggeringObjects:[],actions:new Nt,triggerZone:"box",position:a.toArray(),rotation:[0,0,0],size:n.toArray(),radius:n.length()/2,helperVisible:!0}}})(FJ||(FJ={})),(i=k7||(k7={})).defaultSizes={mobile:[480,480],tablet:[768,768],desktop:[1200,1200],custom:[769,1200]},i.is=function(r){return r.type==="Resize"},i.sizeToDevice=function(r){return typeof r=="string"?r:"custom"},i.deviceToSize=function(r){return typeof r=="string"?[...i.defaultSizes[r]]:[...r]},i.defaultData=function(){let r={size:"mobile",operator:"<",actions:new Nt},n={size:"tablet",operator:"<",actions:new Nt},a={size:[...i.defaultSizes.custom],operator:"<>",actions:new Nt},s=new Nt;return s.push({id:ht.generateUUID(),fi:0,data:r},{id:ht.generateUUID(),fi:1,data:n},{id:ht.generateUUID(),fi:2,data:a}),{type:"Resize",disabled:!1,name:"",orientation:"horizontal",breakpoints:s}},i.defaultBreakpointData=function(){return{size:[...i.defaultSizes.custom],operator:"<>",actions:new Nt}},(r=>{r.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"]},r.is=function(n){return n.type==="VariableChange"},r.defaultData=function(){return{disabled:!1,type:"VariableChange",name:"",actions:new Nt,variableId:"",objectId:null,property:"Position X"}}})(G7||(G7={})),(r=>{r.is=function(n){return n.type==="API"},r.defaultData=function(){return{disabled:!1,type:"API",name:"",successActions:new Nt,errorActions:new Nt,userAPIId:""}}})(zJ||(zJ={})),(r=>{r.is=function(n){return n.type==="WEBHOOK"},r.defaultData=function(){return{disabled:!1,type:"WEBHOOK",name:"",actions:new Nt,userWebhookId:""}}})(VJ||(VJ={})),(r=>{r.is=function(n){return n.type==="AIAssistantListener"},r.defaultData=function(){return{disabled:!1,type:"AIAssistantListener",name:"",actions:new Nt,analysis:"average",analysisRange:[0,71],analysisSingle:0}}})(kJ||(kJ={})),(r=>{r.is=function(n){return n.type==="AIAssistantTrigger"},r.defaultData=function(){return{disabled:!1,description:"",name:"",type:"AIAssistantTrigger",actions:new Nt}}})(GJ||(GJ={}))});function jJ(e){let t=typeof e;return e!==null&&(t==="object"||t==="function")}function HJ(e){return typeof e=="string"&&e.length===36&&/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(e)}var h1,Sx,V1e,eo,WJ,zc,Fg,nA,qJ,yy,ls,Vr,j7,$J,zO,VO,jv,XJ,YJ,KJ,ZJ,QJ,JJ,eee,QU,tee,iee,JU,ree,nee,aee,eF,see,tF,oee,lee,hee,uee,dee,cee,pee,mee,fee,e1,bm,Pg,H7,W7,kO,GO,jO,HO,WO,q7,$7,qO,X7,Tx,gee,iF,rF,Y7,vee,$O,yee,_ee,aA,bee,xee,wee,See,Tee,Mee,Eee,Aee,Cee,dX,k1e,ha,ra,Nb,G1e,sA,XO,Hv,K7,cX,YO,KO,Z7,hm,tI,Yn,nF,xg,Ih=k(()=>{var e,t,i,r,n,a,s,o;h1="personal camera",Sx="a218fcc3-276b-49b9-b485-49037fd14f5f",V1e=2500134,eo=5526619,(e=WJ||{}).x="x",e.y="y",e.z="z",WJ=e,(l=>{function h(c,p){return Math.pow(p[0]-c[0],2)+Math.pow(p[1]-c[1],2)}function u(c,p){return Math.sqrt(h(c,p))}function d(c,p,m){let f=l.sub(p,c),g=l.sub(m,c),v=l.dot(f,g)/l.dot(f,f),y=l.scalarMultiply(f,v);return l.add(c,y)}l.isEqual=function(c,p){return c[0]===p[0]&&c[1]===p[1]},l.lerp=function(c,p,m){return[c[0]+(p[0]-c[0])*m,c[1]+(p[1]-c[1])*m]},l.add=function(c,p){return[c[0]+p[0],c[1]+p[1]]},l.sub=function(c,p){return[c[0]-p[0],c[1]-p[1]]},l.multiply=function(c,p){return[c[0]*p[0],c[1]*p[1]]},l.divide=function(c,p){return[c[0]/p[0],c[1]/p[1]]},l.distanceSquared=h,l.distance=u,l.dot=function(c,p){return c[0]*p[0]+c[1]*p[1]},l.scalarMultiply=function(c,p){return[c[0]*p,c[1]*p]},l.projectionOnto=d,l.projectionOntoDistance=function(c,p,m){return u(c,d(c,p,m))},l.center=function(c,p){return[.5*(c[0]+p[0]),.5*(c[1]+p[1])]}})(zc||(zc={})),(t=Fg||(Fg={})).isEqual=function(l,h){return l[0]===h[0]&&l[1]===h[1]&&l[2]===h[2]},t.add=function(l,h){return[l[0]+h[0],l[1]+h[1],l[2]+h[2]]},t.sub=function(l,h){return[l[0]-h[0],l[1]-h[1],l[2]-h[2]]},t.div=function(l,h){return[l[0]/h[0],l[1]/h[1],l[2]/h[2]]},t.mul=function(l,h){return[l[0]*h[0],l[1]*h[1],l[2]*h[2]]},t.dist=function(l,h){return Math.hypot(l[0]-h[0],l[1]-h[1],l[2]-h[2])},t.lerp=function(l,h,u){return[l[0]+(h[0]-l[0])*u,l[1]+(h[1]-l[1])*u,l[2]+(h[2]-l[2])*u]},(i=nA||(nA={})).isEqual=function(l,h){return l[0]===h[0]&&l[1]===h[1]&&l[2]===h[2]&&l[3]===h[3]},i.lerp=function(l,h,u){return[l[0]+(h[0]-l[0])*u,l[1]+(h[1]-l[1])*u,l[2]+(h[2]-l[2])*u,l[3]+(h[3]-l[3])*u]},(l=>{let h=180/Math.PI,u=Math.PI/180;function d(p){return typeof p=="number"?p*h:p}function c(p){return typeof p=="number"?p*u:p}l.radToDeg=function(p){return[d(p[0]),d(p[1]),d(p[2])]},l.degToRad=function(p){return[c(p[0]),c(p[1]),c(p[2])]}})(qJ||(qJ={})),(r=yy||(yy={})).identity=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],r.isEqual=function(l,h){for(let u=0;u<16;u++)if(l[u]!==h[u])return!1;return!0},r.simplify=function(l){return l??r.identity},r.applyMatrix4=function(l,h){let u=h.slice(0);for(let d=0,c=h.length;d<c;d+=3){let p=l[3]*h[d]+l[7]*h[d+1]+l[11]*h[d+2]+l[15];u[d]=(l[0]*h[d]+l[4]*h[d+1]+l[8]*h[d+2]+l[12])/p,u[d+1]=(l[1]*h[d]+l[5]*h[d+1]+l[9]*h[d+2]+l[13])/p,u[d+2]=(l[2]*h[d]+l[6]*h[d+1]+l[10]*h[d+2]+l[14])/p}return u},(n=ls||(ls={})).isRGB=function(l){return typeof l=="object"&&typeof l.r=="number"&&typeof l.g=="number"&&typeof l.b=="number"},n.white={r:1,g:1,b:1},n.red={r:1,g:0,b:0},n.black={r:0,g:0,b:0},n.toRgb255a1=function(l){return{r:Math.round(255*l.r),g:Math.round(255*l.g),b:Math.round(255*l.b),a:1}},n.clone=function(l){return{r:l.r,g:l.g,b:l.b}},n.fromHex=function(l){return{r:((l=Math.floor(l))>>16&255)/255,g:(l>>8&255)/255,b:(255&l)/255}},n.toHex=function(l){return 65536*Math.round(255*l.r)+256*Math.round(255*l.g)+Math.round(255*l.b)},n.equals=function(l,h){return l.r===h.r&&l.g===h.g&&l.b===h.b},n.equalsFixed=function(l,h){return l.r.toFixed(2)===h.r.toFixed(2)&&l.g.toFixed(2)===h.g.toFixed(2)&&l.b.toFixed(2)===h.b.toFixed(2)},n.lerp=function(l,h,u){return{r:l.r+(h.r-l.r)*u,g:l.g+(h.g-l.g)*u,b:l.b+(h.b-l.b)*u}},n.is=function(l){return!!jJ(l)&&"r"in l&&"g"in l&&"b"in l&&!("a"in l)},(a=Vr||(Vr={})).white={...ls.white,a:1},a.is=function(l){return!!jJ(l)&&"r"in l&&"g"in l&&"b"in l&&"a"in l},a.transparent={...ls.white,a:0},a.from0to1=function(l){return{r:l[0],g:l[1],b:l[2],a:l[3]}},a.fromHexAndA=function(l,h){return{...ls.fromHex(l),a:h}},a.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}},a.equals=function(l,h){return ls.equals(l,h)&&l.a===h.a},a.equalsFixed=function(l,h){return ls.equalsFixed(l,h)&&l.a.toFixed(2)===h.a.toFixed(2)},a.lerp=function(l,h,u){return{r:l.r+(h.r-l.r)*u,g:l.g+(h.g-l.g)*u,b:l.b+(h.b-l.b)*u,a:l.a+(h.a-l.a)*u}},a.toStyle=function({r:l,g:h,b:u,a:d}=a.white){return`rgba(${255*l}, ${255*h}, ${255*u}, ${d})`},(j7||(j7={})).identity={position:[0,0,0],rotation:[0,0,0],scale:[1,1,1],pivot:[0,0,0],pivotRotation:[0,0,0]},(s=$J||{})[s.LINEAR=0]="LINEAR",s[s.EASE=1]="EASE",s[s.EASE_IN=2]="EASE_IN",s[s.EASE_OUT=3]="EASE_OUT",s[s.EASE_IN_OUT=4]="EASE_IN_OUT",s[s.CUBIC=5]="CUBIC",s[s.SPRING=6]="SPRING",s[s.ARC=7]="ARC",s[s.NONE=8]="NONE",$J=s,(zO||(zO={})).defaultData={mass:1,stiffness:80,damping:10,velocity:0},(VO||(VO={})).defaultData={control1:[.5,0],control2:[.5,1]},(o=jv||(jv={})).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]}),LIe=k(()=>{var e,t;Nr(),z1e(),(XJ||(XJ={})).defaultData={type:"SwitchCamera",name:"",targetCamera:"",delay:0,animate:!0,duration:1e3,easing:4,runMode:"Normal"},(YJ||(YJ={})).defaultData={type:"SceneTransition",name:"",target:"",delay:0,duration:1,transition:"none"},(KJ||(KJ={})).defaultData={type:"Link",name:"",url:null,context:"tab"},(ZJ||(ZJ={})).defaultData={type:"Destroy",name:"",objects:[],delay:0},(QJ||(QJ={})).defaultData={type:"Particles",name:"",emitterObjectId:"",delay:0,emission:"start",triggerAfter:"any"},(JJ||(JJ={})).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"},(eee||(eee={})).defaultData={type:"Reset",name:"",delay:0},(QU||(QU={})).defaultData={interaction:"play",delay:0,volume:.5,loop:1},(e=tee||(tee={})).pauseDefaultData={interaction:"pause",delay:0},e.stopDefaultData={interaction:"stop",delay:0},(t=iee||(iee={})).defaultData={type:"Audio",name:"",...QU.defaultData},t.hasAudioByActions=i=>i.some(({data:r})=>r.type==="Audio"&&r.interaction==="play"&&r.audio),t.hasAudioByEvents=i=>{for(let{data:r}of i)if(tx.is(r)||r.type==="Start"||r.type==="Collision"){if(t.hasAudioByActions(r.actions))return!0}else if(r.type==="Conditional"){if(t.hasAudioByActions(r.inActions)||t.hasAudioByActions(r.outActions))return!0}else if(r.type==="GameControl"&&Object.values(r.gameActions).find(n=>t.hasAudioByActions(n)))return!0},t.getAudiosByActions=i=>{let r=[];return i.forEach(n=>{let a=n.data;a.type==="Audio"&&a.interaction==="play"&&a.audio&&r.push(n),a.type==="Conditional"&&(r.push(...t.getAudiosByActions(a.ifActions)),r.push(...t.getAudiosByActions(a.elseActions)))}),r},t.getAudiosByEvents=i=>{let r=[];return i.forEach(({data:n})=>{tx.is(n)||n.type==="Collision"||n.type==="Start"||n.type==="Trigger"?r.push(...t.getAudiosByActions(n.actions)):n.type==="Conditional"?(r.push(...t.getAudiosByActions(n.inActions)),r.push(...t.getAudiosByActions(n.outActions))):n.type==="GameControl"?Object.values(n.gameActions).forEach(a=>{r.push(...t.getAudiosByActions(a))}):n.type==="DragDrop"&&(r.push(...t.getAudiosByActions(n.dragDropActions.drag)),r.push(...t.getAudiosByActions(n.dragDropActions.drop)))}),r},(JU||(JU={})).defaultData={interaction:"play",delay:0,volume:.5,loop:1/0},(i=>{i.pauseDefaultData={interaction:"pause",delay:0},i.stopDefaultData={interaction:"stop",delay:0}})(ree||(ree={})),(i=>{i.defaultData={type:"Video",name:"",triggerAfter:"autoplay",...JU.defaultData},i.hasVideoByActions=r=>r.some(({data:n})=>n.type==="Video"&&n.interaction==="play"&&n.layerId),i.hasVideoByObject=r=>{if(r.events){for(let{data:n}of r.events)if((tx.is(n)||n.type==="Start")&&i.hasVideoByActions(n.actions))return!0}},i.getVideosByActions=r=>{let n=[];return r.forEach(a=>{let s=a.data;s.type==="Video"&&s.interaction==="play"&&s.layerId&&n.push(a)}),n},i.getVideosByEvents=r=>{let n=[];return r.forEach(({data:a})=>{(tx.is(a)||a.type==="Start")&&n.push(...i.getVideosByActions(a.actions))}),n}})(nee||(nee={})),(aee||(aee={})).defaultData=function(i){return{state:i,repeat:0,delay:0,delayDirection:"start-once",direction:"normal",duration:1e3,easing:4}},(eF||(eF={})).defaultData=function(){return{tweens:new Nt,repeat:0,delay:0,delayDirection:"start-once",direction:"normal"}},(see||(see={})).defaultData=function(i){return{type:"Transition",name:"",runMode:"Once",object:i??null,...eF.defaultData()}},(tF||(tF={})).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}})(oee||(oee={})),(lee||(lee={})).defaultData=function(i){return{type:"TimelineAnimation",name:"",...tF.defaultData(i)}},(hee||(hee={})).defaultData=function(i,r,n){return{type:"Animation",name:"",object:i,clipId:r,crop:n,crop2:n,repeat:-1,delay:0,delayDirection:"start-once",direction:"normal",runMode:"Normal"}},(uee||(uee={})).defaultData={type:"SetVariable",name:"",variableId:"",expression:[]},(dee||(dee={})).defaultData=()=>({type:"Conditional",name:"",ifActions:new Nt,elseActions:new Nt,condition:[]}),(cee||(cee={})).defaultData={type:"DynamicVariablePlay",name:"",variableId:"",mode:"PlayPause",delay:0,pauseDelay:0},(pee||(pee={})).defaultData={type:"ClearLocalStorage",name:"",target:"all"},(mee||(mee={})).defaultData={name:"",type:"UserAPI"}}),BIe=k(()=>{var e;(e=fee||(fee={})).emptyAudio={data:Uint8Array.from(atob("UklGRjIAAABXQVZFZm10IBIAAAABAAEAQB8AAEAfAAABAAgAAABmYWN0BAAAAAAAAABkYXRhAAAAAA=="),t=>t.charCodeAt(0)),mimeType:"audio/wav",filename:"unknown"},e.maxSize=2e6}),j1e=k(()=>{var e;(e=e1||(e1={})).all=["PerspectiveCamera","OrthographicCamera"],e.is=function(t){return e.all.includes(t)},(t=>{t.DefaultUp=[0,1,0],t.DefaultTargetOffset=1e3,t.MinTargetOffset=.001,t.sanitizeTargetOffset=function(a){return a===void 0||!Number.isFinite(a)||a<t.MinTargetOffset?t.DefaultTargetOffset:a},t.DefaultAzimuth=-24,t.DefaultElevation=15;let i=t.DefaultAzimuth*Math.PI/180,r=t.DefaultElevation*Math.PI/180,n=180/Math.PI;t.DefaultPosition=[t.DefaultTargetOffset*Math.sin(i)*Math.cos(r),t.DefaultTargetOffset*Math.sin(r),t.DefaultTargetOffset*Math.cos(i)*Math.cos(r)],t.DefaultRotation=[Math.atan2(-Math.sin(r),Math.cos(i)*Math.cos(r))*n,Math.asin(Math.sin(i)*Math.cos(r))*n,Math.atan2(Math.sin(i)*Math.sin(r),Math.cos(i))*n],t.defaultData={far:1e5,type:"PerspectiveCamera",perspective:{near:70,fov:45,zoom:1},orthographic:{near:-1e5,zoom:1},up:t.DefaultUp,isUpVectorFlipped:!1,targetOffset:t.DefaultTargetOffset},t.getZoom=function(a){return a.type==="PerspectiveCamera"?a.perspective?.zoom??1:a.orthographic?.zoom??1}})(bm||(bm={}))}),H1e=k(()=>{var e;(e=Pg||(Pg={})).defaultData=function(t,i=.1){return{disabled:!1,type:"linear",hideBase:!1,instanced:!1,count:3,radial:{radius:2*Math.max(typeof t[0]=="number"?t[0]:1,typeof t[1]=="number"?t[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 t[0]=="number"?t[0]+t[0]:1)*i,0,0],pivot:[0,0,0],pivotRotation:[0,0,0]},grid:{count:[2,2,2],size:t.map(r=>(typeof r=="number"?r: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"}}},e.merge=function(t,i){let r={...t};if(W7.forEach(n=>{Object.assign(r,{[n]:i[n]??t[n]})}),r.radial={...t.radial},i.radial){let n=t.radial,a=i.radial;kO.forEach(s=>{Object.assign(r.radial,{[s]:a[s]??n[s]})})}if(r.linear={...t.linear},i.linear){let n=t.linear,a=i.linear;GO.forEach(s=>{Object.assign(r.linear,{[s]:a[s]??n[s]})})}if(r.grid={...t.grid},i.grid){let n=t.grid,a=i.grid;jO.forEach(s=>{Object.assign(r.grid,{[s]:a[s]??n[s]})})}if(r.toObject={...t.toObject},i.toObject){let n=t.toObject,a=i.toObject;HO.forEach(s=>{Object.assign(r.toObject,{[s]:a[s]??n[s]})})}if(r.randomnessObject={...t.randomnessObject},i.randomnessObject){let n=t.randomnessObject,a=i.randomnessObject;WO.forEach(s=>{Object.assign(r.randomnessObject,{[s]:a[s]??n[s]})})}return r},e.isPartial=function(t){return!(!t.randomnessObject&&!t.toObject)},(t=>{t.defaultData={radial:{},linear:{},grid:{},toObject:{},randomnessObject:{}};let i=["radial","linear","grid","toObject","randomnessObject"];t.toOps=function(r,n){let a=[];r.count!==void 0&&a.push({type:0,path:n,props:{count:r.count}});for(let s of i){let o=r[s];o&&Object.keys(o).length>0&&a.push({type:0,path:[...n,s],props:o})}return a}})(H7||(H7={})),W7=["count"],kO=["radius","start","end","position","scale","rotation"],GO=["position","scale","rotation"],jO=["count","size"],HO=["count","position","scale","rotation"],WO=["strength","scale","rotation","position","movement","seed","freqScale"]}),W1e=k(()=>{var e;Ih(),(e=q7||(q7={})).all=["PointLight","SpotLight","DirectionalLight","HemisphereLight"],e.is=function(t){return e.all.includes(t)},($7||($7={})).defaultData=function(t){return function(i){if(i==="PointLight")return{type:i,color:Vr.white,intensity:1,distance:2e3,decay:1,shadows:!0,shadowResolution:1024,shadowRadius:1,penumbraSize:.5,depth:1e5};if(i==="SpotLight")return{type:i,color:Vr.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:Vr.white,intensity:1,shadows:!0,size:2e3,depth:1e5,penumbraSize:.5,shadowResolution:1024,shadowRadius:1};throw new Error("not implemented")}(t)}}),q1e=k(()=>{var e;(e=qO||(qO={})).defaultShapeData={type:"PlaneEmitterShape",size:[100,100,100]},e.defaultCollisionData={colliderEntityId:null,collisionBounce:.75},e.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:e.defaultShapeData,autoPlay:!0,emitTimeDelay:0,emitTimeCycle:"infinity",emitTimeDuration:1,...e.defaultCollisionData}}),$1e=k(()=>{var e;(e=X7||(X7={})).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},e.regenProps=["hairLength","spreadRadius","guideStrands","headShape","baseObjectId"]}),pX=k(()=>{(Tx||(Tx={})).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]}}),X1e=k(()=>{var e,t;(e=gee||{})[e.Front=0]="Front",e[e.Back=1]="Back",e[e.Double=2]="Double",gee=e,(t=iF||(iF={})).defaultData={castShadow:!0,receiveShadow:!0},t.equals=function(i,r){return i.castShadow===r.castShadow&&i.receiveShadow===r.receiveShadow},(i=>{i.defaultData={flatShading:!1,wireframe:!1,side:0},i.equals=function(r,n){return r.flatShading===n.flatShading&&r.side===n.side&&r.wireframe===n.wireframe&&(r.shadowCatcher??!1)===(n.shadowCatcher??!1)}})(rF||(rF={})),(Y7||(Y7={})).defaultData={...rF.defaultData,...iF.defaultData},(vee||(vee={})).getMaterialData=function(i,r){let n=[];if("material"in i){let a=typeof i.material=="string"?r.materials[i.material]??r.lib.materials[i.material]?.asset:i.material;a&&n.push(a)}else if("materials"in i)for(let a of i.materials){let s=typeof a=="string"?r.materials[a]??r.lib.materials[a]?.asset:a;s&&n.push(s)}return n}}),Y1e=k(()=>{var e;(e=$O||($O={})).defaultVideo={data:"",thumb:"/_assets/_videos/catThumb.png",type:"video",name:"Cat video"},e.maxSize=3e7}),T4=k(()=>{var e,t,i,r;Nr(),Ih(),Y1e(),Ih(),(yee||(yee={})).is=function(n){return n==="texture"||n==="video"||n==="color"||n==="depth"||n==="normal"||n==="gradient"||n==="noise"||n==="fresnel"||n==="cavity"||n==="dust"||n==="rainbow"||n==="toon"||n==="outline"||n==="particle"||n==="transmission"||n==="reflection"||n==="matcap"||n==="displace"||n==="pattern"||n==="vertexColor"||n==="light"},(_ee||(_ee={})).is=function(n){return n==="luminance"||n==="r"||n==="g"||n==="b"||n==="a"},(aA||(aA={})).is=function(n){return typeof n=="object"&&n!==null&&n.image!=null},(bee||(bee={})).is=function(n){return n==="phong"||n==="toon"||n==="lambert"||n==="physical"},(r=xee||{})[r.Linear=0]="Linear",r[r.Radial=1]="Radial",r[r.Polar=2]="Polar",xee=r,wee=(n=>(n[n.RepeatWrapping=1e3]="RepeatWrapping",n[n.ClampToEdgeWrapping=1001]="ClampToEdgeWrapping",n[n.MirroredRepeatWrapping=1002]="MirroredRepeatWrapping",n))(wee||{}),See=(n=>(n[n.NearestFilter=1003]="NearestFilter",n[n.LinearFilter=1006]="LinearFilter",n[n.LinearMipmapLinearFilter=1008]="LinearMipmapLinearFilter",n))(See||{}),(i=Tee||{})[i.UV=0]="UV",i[i.Planar=1]="Planar",i[i.Spherical=2]="Spherical",i[i.Cylindrical=3]="Cylindrical",i[i.Triplanar=4]="Triplanar",Tee=i,(t=Mee||{})[t.Simplex=0]="Simplex",t[t.SimplexFractal=1]="SimplexFractal",t[t.Ashima=2]="Ashima",t[t.Fbm=3]="Fbm",t[t.Perlin=4]="Perlin",t[t.Voronoi=5]="Voronoi",Mee=t,(e=Eee||{})[e.F1=0]="F1",e[e.F2=1]="F2",e[e.F2MinusF1=2]="F2MinusF1",e[e.SmoothBlend=3]="SmoothBlend",e[e.Edge=4]="Edge",e[e.Power=5]="Power",e[e.Lines=6]="Lines",e[e.Cells=7]="Cells",Eee=e,Aee=(n=>(n[n.Lights=0]="Lights",n[n.Static=1]="Static",n[n.Camera=2]="Camera",n))(Aee||{}),Cee=(n=>(n[n.Circle=0]="Circle",n[n.Ring=1]="Ring",n[n.Polygon=2]="Polygon",n[n.Cross=3]="Cross",n[n.Diamond=4]="Diamond",n[n.Checkerboard=5]="Checkerboard",n[n.Line=6]="Line",n[n.Wave=7]="Wave",n))(Cee||{}),dX=["mode","gradientType","noiseType","tracingMode","mirror","displacementType","projection","cnormal","crop","axis","side","roughnessMapChannel","metalnessMap","metalnessMapChannel","normalMap","aoMap","aoMapChannel","emissiveMap","style"],k1e=["wrapping","image","video","name","minFilter","magFilter"],(n=>{n.patch=function(a,s){let{texture:o,...l}=s;if(Object.assign(a,l),o){let h=a.texture;h&&Object.assign(h,o)}},n.defaultColorLayer=function(a){return{...n.defaultData("color"),color:a}},n.defaultData=function(a,s){return a==="light"&&s?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}}}(s):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:$O.defaultVideo,wrapping:1001,repeat:[1,1],offset:[0,0],rotation:0,minFilter:1008,magFilter:1006},crop:!1};case"color":return{...l,type:"color",color:ls.fromHex(eo)};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:{...ls.fromHex(6710886),a:1},colorB:{...ls.fromHex(6710886),a:1},colorC:{...ls.fromHex(16777215),a:1},colorD:{...ls.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:Vr.fromHexAndA(16777215,1),bias:.1,scale:1,intensity:2,factor:1};case"dust":return{...l,type:"dust",color:Vr.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:Vr.fromHexAndA(0,0),offset:[0,0,0]};case"outline":return{...l,type:"outline",outlineColor:Vr.fromHexAndA(0,1),contourColor:Vr.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:{...ls.fromHex(0),a:1},colorB:{...ls.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}}}(a)}})(ha||(ha={})),(n=>{function a(s,o="layer1",l="layer2",h=ls.fromHex(16777215)){let u=new Nt;return u.push({fi:0,data:ha.defaultData("light",s),id:o}),u.push({fi:1,data:ha.defaultData("color"),id:l}),{layers:u}}n.isMergable=function(s){return!s.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")},n.getHash=function(s){let o="";return s.layers.forEach(l=>{Object.entries(l.data).forEach(([h,u])=>{o+=`${h}${u}`,Array.isArray(u)?u.forEach(d=>o+=`${d}`):typeof u=="object"?Object.values(u).forEach(d=>{o+=typeof d=="number"?`${d.toFixed(4)}`:`${d}`}):o+=`${u}`})}),o},n.defaultEmptyData=function(){return{layers:new Nt}},n.defaultData=function(s="layer1",o="layer2"){return a("physical",s,o)},n.withName=function(s,o){return{...s,name:o}},n.defaultTwoLayerData=a,n.defaultColorMaterial=function(s,o,l="layer1",h="layer2"){let u=new Nt;return u.push({fi:0,data:ha.defaultData("light",o),id:l}),u.push({fi:1,data:ha.defaultColorLayer(s),id:h}),{layers:u}},n.defaultUIObjectMaterial=function(s){let o=ha.defaultData("texture");s&&Object.assign(o.texture,{image:s});let l=new Nt;return l.push({fi:0,data:o,id:"layer1"}),l.push({fi:1,data:{...ha.defaultData("transmission"),alpha:1},id:"layer2"}),l.push({fi:2,data:{...ha.defaultData("light","lambert"),alpha:0},id:"layer3"}),{layers:l}},n.defaultTwoLayerTextureData=function(s,o="physical",l="layer1",h="layer2"){let u=ha.defaultData("texture");Object.assign(u.texture,{image:s});let d=new Nt;return d.push({fi:0,data:u,id:l}),d.push({fi:1,data:ha.defaultData("light",o),id:h}),{layers:d}},n.defaultTwoLayerVideoTextureData=function(s,o="physical",l="layer1",h="layer2"){let u=ha.defaultData("video");Object.assign(u.texture,{video:s});let d=new Nt;return d.push({fi:0,data:u,id:l}),d.push({fi:1,data:ha.defaultData("light",o),id:h}),{layers:d}}})(ra||(ra={}))}),UIe=k(()=>{Nb="Roboto_regular",G1e="https://fonts.gstatic.com/s/roboto/v30/KFOmCnqEu92Fr1Me5WZLCzYlKw.ttf"}),K1e=k(()=>{Nr(),(sA||(sA={})).defaultData=function(){return{points:new Nt,roundness:0,shapeHoles:[],isClosed:!1}}}),Z1e=k(()=>{Nr(),(XO||(XO={})).defaultData=function(){return{points:new Nt,lastInsertionPlane:null,subdivisions:12,isClosed:!1,subdivisionMode:"parametric"}},Hv={type:"Ellipse",width:50,height:50,spikes:16,angle:360,innerRadius:0},(K7||(K7={})).merge=function(e,t){let i={...e};return YO.forEach(r=>{Object.assign(i,{[r]:t[r]??e[r]})}),i},cX={shape:Hv,depth:1,offset:0,bevel:50,bevelSides:6,angle:0,twist:0,startScale:1,endScale:1,capType:"flat"},YO=["depth","offset","angle","twist","startScale","endScale"]}),mX=k(()=>{var e,t;K1e(),Z1e(),(e=KO||(KO={})).is2DParametricMesh=function(i){return i==="PolygonGeometry"||i==="RectangleGeometry"||i==="StarGeometry"||i==="TriangleGeometry"||i==="EllipseGeometry"||i==="UIGeometry"},e.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"},e.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"},(Z7||(Z7={})).merge=function(i,r){let n={...i};return Object.assign(n,r),n.type==="PathGeometry"&&"extrusion"in r&&r.extrusion&&(n.extrusion={...i.extrusion},Object.assign(n.extrusion,K7.merge(n.extrusion,r.extrusion))),n},(t=hm||(hm={})).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:XO.defaultData(),extrusion:cX};if(i==="VectorGeometry")return{width:1,height:1,type:i,subdivisions:12,shape:sA.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};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{...t.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")},tI=["width","height","depth"]}),Q1e=k(()=>{Ih(),(e=>{function t(i){return i.mode??"linear"}e.defaultData={enabled:!1,useBackgroundColor:!1,color:ls.white,near:.1,far:2e3,mode:"linear",density:.005,heightFalloff:.01,heightBase:0},e.getMode=t,e.getModeIndex=function(i){let r=t(i);return r==="height"?1:r==="both"?2:0},e.getDensity=function(i){return i.density??e.defaultData.density},e.getHeightFalloff=function(i){return i.heightFalloff??e.defaultData.heightFalloff},e.getHeightBase=function(i){return i.heightBase??e.defaultData.heightBase}})(Yn||(Yn={}))}),fX=k(()=>{(nF||(nF={})).defaultData={image:null,rotation:0,blur:32,showBackground:!0},(xg||(xg={})).defaultData={enabled:!1,mode:"hdri",hdri:nF.defaultData,timeOfDay:10,weather:"partlyCloudy",lighting:!0,lightingIntensity:1,lightingQuality:"full",clouds:!0,windSpeed:2,animateWind:!0,exposure:1,seed:2}});function FIe(e){let t=typeof e=="string"?Number.parseInt(e,10):e;return typeof t=="number"&&Number.isFinite(t)?Math.min(5,Math.max(0,Math.round(t))):3}var oA,_y,aF,sF,oF,Mx,lF,Q7,J7,Pee,j1,J1e,ns,ZO,Ree,Dee,Nee,Iee,bc,fE,QO,JO,xm,by,Oee,Rg,eL,wm,hF,uF,ey,tw,ty,gE,eH,Lee,Ao,dF,Bee,Uee,um,gu,Ex,tH,tL,iL,e_e=k(()=>{(()=>{let e={opacity:1,blendFunction:13,enabled:!1};(oA||(oA={})).defaultData={enabled:!1,pixelation:{...e,blendFunction:16,granularity:15},bloom:{...e,blendFunction:16,intensity:1,blurScale:1,luminanceThreshold:.25,luminanceSmoothing:.025,kernelSize:3},chromaticAberration:{...e,offset:[2,2]},vignette:{...e,darkness:1,offset:0},hueSaturation:{...e,hue:3,saturation:0},brightnessContrast:{...e,brightness:.25,contrast:0},depthOfField:{...e,focusDistance:100,focalLength:20,bokehScale:5},noise:{...e,blendFunction:16}}})()}),gX=k(()=>{var e;Q1e(),fX(),e_e(),Ih(),(e=_y||(_y={})).defaultData={type:"normal",softShadowQuality:"low"},e.isSoft=function(t){return t!=null&&(t.type===void 0||t.type==="soft")},(aF||(aF={})).defaultData={enabled:!0,color:{r:.8274509803921568,g:.8274509803921568,b:.8274509803921568},intensity:.75},(sF||(sF={})).defaultData={occlusion:!1,aoFullRes:!1,radius:256,bias:.5,aoColor:{r:.19607843137254902,g:.19607843137254902,b:.19607843137254902}},(t=>{t.defaultData={pipeline:"classic",toneMapping:"aces",exposure:1},t.isUntouched=function(i){return i===void 0||i.pipeline==="classic"&&(i.toneMapping==="none"||i.toneMapping==="aces")&&i.exposure===1}})(oF||(oF={})),(Mx||(Mx={})).defaultData={usePhysics:!1,gravity:-10},(lF||(lF={})).defaultData={playCamera:h1,gameControlObject:null},(Q7||(Q7={})).defaultData={backgroundColor:Vr.fromHexAndA(V1e,1),postprocessing:oA.defaultData,fog:Yn.defaultData,sky:xg.defaultData,globalPhysics:Mx.defaultData,ambient:aF.defaultData,ao:sF.defaultData,shadow:_y.defaultData,publish:lF.defaultData,grading:oF.defaultData}}),zIe=k(()=>{(J7||(J7={})).defaultData={colliderType:"box",size:[100,100,100],colliderHelperVisible:!0,forceType:"collider",forceRange:"global",forceIntensity:.5,forceDambing:.95}}),M4=k(()=>{var e,t,i;Nr(),j1e(),W1e(),q1e(),$1e(),pX(),X1e(),Ih(),T4(),mX(),H1e(),Js(),gX(),zIe(),(e=Pee||(Pee={})).isComponentRelated=function(r){return r==="Component"||r==="Instance"},e.isEmptyOrComponent=function(r){return r==="Empty"||r==="Instance"},(t=j1||(j1={})).identity={...j7.identity,hiddenMatrix:yy.identity},t.fromObject=function(r){return{position:r.position,rotation:r.rotation,scale:r.scale,pivot:r.pivot,pivotRotation:r.pivotRotation,hiddenMatrix:r.hiddenMatrix}},t.merge=function(r,n){return{position:n?.position||r.position,rotation:n?.rotation||r.rotation,pivot:n?.pivot||r.pivot,pivotRotation:n?.pivotRotation||r.pivotRotation,scale:n?.scale||r.scale,hiddenMatrix:n?.hiddenMatrix||r.hiddenMatrix}},t.diff=function(r,n){return _1e({position:Fg.isEqual(r.position,n.position)?void 0:n.position,rotation:Fg.isEqual(r.rotation,n.rotation)?void 0:n.rotation,scale:Fg.isEqual(r.scale,n.scale)?null:n.scale,hiddenMatrix:yy.isEqual(r.hiddenMatrix,n.hiddenMatrix)?void 0:n.hiddenMatrix})},J1e=["slide","offset"],(ns||(ns={})).defaultData={states:new Nt,events:new Nt,timelineAnimations:new ti,visible:!0,raycastLock:!1,physics:Tx.defaultData,pathSnapping:{pathId:null,slide:0,offset:0,orientation:"tangential"},...j1.identity,cloner:null},(ZO||(ZO={})).defaultData={type:"Empty",...ns.defaultData},(Ree||(Ree={})).defaultData={type:"ParticleCollider",...J7.defaultData,...ns.defaultData},(Dee||(Dee={})).defaultData={type:"Component",...ns.defaultData},(Nee||(Nee={})).defaultData={type:"Particle",...ns.defaultData,...qO.defaultData},(Iee||(Iee={})).defaultData={type:"Hair",...ns.defaultData,...X7.defaultData},(bc||(bc={})).defaultData={type:"Mesh",...ns.defaultData,...Y7.defaultData},(fE||(fE={})).defaultData={...ns.defaultData,...j1.identity,position:bm.DefaultPosition,rotation:bm.DefaultRotation,...bm.defaultData},(r=>{r.defaultData=function(n){return{...ns.defaultData,...$7.defaultData(n)}},r.defaultDirectionalLightData={...r.defaultData("DirectionalLight"),position:[200,300,300],name:"Directional Light",intensity:.7}})(QO||(QO={})),(r=>{function n(a,s,o=0){for(;o<s.length;){let l=a?a[s[o]]:void 0;if(s.length===o+1)return l;if(!l)return;a=l.descendants,o+=1}}r.resolveWithDes=n,r.resolve=function(a,s,o=0){let l=n(a,s,o);if(l){let h=Object.keys(l);if(h.length===1&&h[0]==="descendants")return}return l}})(JO||(JO={})),(r=>{function n(a,s){return{...ns.defaultData,...s,component:a,overrides:new Qa,physics:void 0,events:void 0,type:"Instance"}}r.rootOverrideProps=["physics","events"],r.compositeNonOptionalOverrideProps=["geometry"],r.compositeEntireOverrideOverrideProps=["material"],r.ofComponent=n,r.fromComponentData=function(a){let s=j1.fromObject(a.data);return n(a.id,s)}})(xm||(xm={})),(r=>{r.defaultData={type:"Page",...ns.defaultData,physics:{...Tx.defaultData,fusedBody:!1},...Q7.defaultData,camera:fE.defaultData},r.isUIPage=function(n){return n.uiScene!==void 0}})(by||(by={})),(i=Oee||(Oee={})).defaultCamera={position:[0,0,1e3],scale:[1,1,1],rotation:[0,0,0],pivot:[0,0,0],pivotRotation:[0,0,0],hiddenMatrix:yy.identity,name:"Play Camera",visible:!0,raycastLock:!1,physics:Tx.defaultData,states:new Nt,events:new Nt,timelineAnimations:new ti,cloner:null,pathSnapping:{pathId:null,orientation:"tangential",slide:0,offset:0},...bm.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",...ns.defaultData,...bc.defaultData,geometry:hm.defaultData("RectangleGeometry"),material:ra.defaultTwoLayerData("physical","layer1","layer2")},i.defaultBooleanObject={name:"Boolean",...ns.defaultData,...bc.defaultData,geometry:hm.defaultData("BooleanGeometry"),material:ra.defaultTwoLayerData("physical","layer1","layer2")},i.defaultShapeBlendObject={name:"Shape Blend",...ns.defaultData,...bc.defaultData,geometry:hm.defaultData("ShapeBlendGeometry"),material:ra.defaultTwoLayerData("physical","layer1","layer2")},i.defaultTextObject={name:"Text",...ns.defaultData,...bc.defaultData,geometry:hm.defaultData("TextGeometry"),material:ra.defaultTwoLayerData("physical","layer1","layer2")},i.defaultInputObject={name:"Input",...ns.defaultData,...bc.defaultData,geometry:hm.defaultData("InputGeometry"),material:ra.defaultTwoLayerData("physical","layer1","layer2")},(r=>{r.newEmpty=function(n,a){let s={name:a};return n.type==="Mesh"?(s.geometry={},"material"in n&&(s.material={layers:new Qa}),"materials"in n&&(s.materials=n.materials.map(o=>({layers:new Qa})))):e1.is(n.type)&&(s.perspective={},s.orthographic={}),s},r.toOps=function(n,a){let s,o=[],l={orthographic:0,perspective:0,geometry:0};function h(u,d){for(let[c,p]of Object.entries(d.layers)){let{texture:m,...f}=p;if(m!==void 0&&Object.keys(m).length>0){let g={path:[...u,"layers",c,"texture"],props:m,type:0};o.push(g)}if(Object.keys(f).length>0){let g={path:[...u,"layers",c],props:f,type:0};o.push(g)}}}for(let[u,d]of Object.entries(a)){let c=d;if(u!=="name")if(u==="cloner")o.push(...H7.toOps(c,["cloner"]));else if(u==="pathSnapping")o.push({path:[u],props:{slide:c.slide,offset:c.offset},type:0});else if(u==="material")h(["material"],c);else if(u==="materials")for(let[p,m]of Object.entries(c))h(["materials",p],m);else if(l[u]===0){if(u==="geometry"&&c.extrusion!==void 0){let p={path:[u,"extrusion"],props:c.extrusion,type:0};o.push(p),c={...c},delete c.extrusion}if(Object.keys(c).length>0){let p={path:[u],props:c,type:0};o.push(p)}}else s===void 0&&(s={path:[],props:{},type:0},o.push(s)),s.props[u]=c}return o},r.patch=function(n,a){if(a===void 0)return n;let s={...n};if(Object.assign(s,j1.merge(s,a)),Object.assign(s,{pathSnapping:Object.assign({},s.pathSnapping,{slide:a.pathSnapping?.slide??s.pathSnapping?.slide??0,offset:a.pathSnapping?.offset??s.pathSnapping?.offset??0})}),e1.is(n.type)){s.orthographic={...s.orthographic},s.perspective={...s.perspective};let o=a;o.orthographic?.zoom!==void 0&&(s.orthographic.zoom=o.orthographic.zoom),o.perspective?.zoom!==void 0&&(s.perspective.zoom=o.perspective.zoom),o.isUpVectorFlipped!==void 0&&(s.isUpVectorFlipped=o.isUpVectorFlipped),o.targetOffset!==void 0&&(s.targetOffset=o.targetOffset)}else if(n.type==="Mesh")"geometry"in a&&Object.assign(s,{geometry:Z7.merge(s.geometry,a.geometry)}),(a.material||a.materials)&&(s=function(o,l){if(l===void 0)return o;let h={...o};return"material"in h&&"material"in l&&l.material&&(h.material=OO(h.material,u=>{if(typeof u!="string")for(let[d,c]of Object.entries(l.material.layers)){let p=u.layers.data(d);p&&ha.patch(p,c)}}).data),h.materials&&l.materials&&(h.materials=OO(h.materials,u=>{for(let d=0;d<h.materials.length;d++){let c=l.materials[d];if(typeof c!="string")for(let[p,m]of Object.entries(c.layers)){let f=u[d]?.layers?.data(p);f&&ha.patch(f,m)}}}).data),h}(s,a)),s.cloner&&"cloner"in a&&Object.assign(s,{cloner:Pg.merge(s.cloner,a.cloner)});else if(n.type==="Empty")s.cloner&&"cloner"in a&&Object.assign(s,{cloner:Pg.merge(s.cloner,a.cloner)});else if(q7.is(n.type)){let o=a;o.intensity!==void 0&&(s.intensity=o.intensity),o.color!==void 0&&(typeof o.color=="string"?s.color=o.color:s.color=ls.clone(o.color))}return s}})(Rg||(Rg={}))}),vX=k(()=>{(eL||(eL={})).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}}),E4=k(()=>{vX(),Ih(),(wm||(wm={})).defaultData={orbitControls:eL.defaultData,playPage:Sx,withBackground:!0,preventScroll:!1,preventTouchScroll:!1,hideCursor:!1,mouseEventTarget:"canvas",joystickSizeAndXYOffset:Array(12).fill(0).map((e,t)=>{let i=0,r=0;return t<5?r=-30:t<10&&(r=30),t===0||t===10||t===5?i=30:(t===4||t===11||t===9)&&(i=-30),[120,[i,r],"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}}),t_e=k(()=>{var e;(hF||(hF={})).defaultData={id:"basic",label:"Basic",style:"None",prompt:""},(uF||(uF={})).defaultData={weather:0,shadows:0,lightOrigin:0,temperature:0,sun:0,camera:0,environment:0,particles:0,nature:0,floor:0},(e=ey||(ey={})).defaultData=()=>({mode:"line-art-both",prompt:"",negativePrompt:"",style:{...hF.defaultData},isRandomSeed:!0,seed:e.generateSeed(),guessMode:!1,advanced:!1,steps:20,guidanceScale:7.5,controlNetScale:1,modifiers:uF.defaultData}),e.generateSeed=()=>Math.round(1e5*Math.random())}),yX=k(()=>{M4(),Nr(),E4(),Ih(),Js(),t_e(),(e=>{function t(i,r){let n=i.scene.objects.get(r);if(n&&n.data.type==="Component")return n;{let a=i.shared.lib.components[r];if(a)return{...a.asset,id:r}}}e.physicsEnabled=function(i){return i.find(r=>r.data.type==="Page"&&r.data.globalPhysics.usePhysics)!==void 0},e.getComponentData=t,e.traverseModuleInstances=function(i,r,n){i.scene.objects.traverseFrom(r,(a,s)=>{if(s.type==="Instance"){let o=t(i,s.component)?.data;o&&n(a,s,o.events)}else n(a,s,s.events)})}})(tw||(tw={})),(e=>{function t(r=!0,n=[]){let a=[];r&&a.push({...e.defaultLight}),a.push(...n);let s=new As;return s.push({fi:1,id:Sx,data:{...by.defaultData,name:"Scene 1"},children:a}),s}function i(r){return{...e.defaultData,objects:Gl(r,As.prototype)}}e.TRASH_CAN_ID="830a2708-8ed9-49cf-a68e-085299892222",e.defaultLight={fi:-1,data:QO.defaultDirectionalLightData,id:"830a2708-8ed9-49cf-a68e-085299899103",children:[]},e.createDefaultObjectTreeWithPage=t,e.defaultData={objects:t(),publish:wm.defaultData,styles:ey.defaultData()},e.emptyDataWithoutPage=function(){return{objects:new As,publish:wm.defaultData,styles:ey.defaultData()}},e.emptyDataWithPage=function(r=!0){return{objects:t(r),publish:wm.defaultData,styles:ey.defaultData()}},e.emptyData=function(){return{objects:new As,publish:{...wm.defaultData},styles:ey.defaultData()}},e.withObjs=i,e.withObj=function(r,n){return i([{id:r,data:n,children:[],fi:0}])}})(ty||(ty={}))}),i_e=k(()=>{(gE||(gE={})).defaultData={preset:"fullscreen",allowResponsive:!1,size:[512,512],coords:[0,0],sceneScale:1,color:{r:0,g:0,b:0,a:.5}}}),_X=k(()=>{var e,t;Nr(),Js(),(e=eH||(eH={})).defaultData=i=>({url:i,name:"New Webhook",parametersSchemas:new Nt}),e.defaultParameterValueByType=i=>i==="number"?0:i!=="boolean"&&"",(Lee||(Lee={})).defaultData=(i,r="GET")=>({url:i,method:r,name:"New API",headers:new Nt,queries:new Nt,autoStart:!0}),(i=>{function r(a){return a.textValue!==void 0}function n(a){return typeof a=="boolean"}i.isTextValue=r,i.isNumber=function(a){return typeof a=="number"},i.isBoolean=n,i.typeOfVariable=function(a){return r(a)?"string":n(a)?"boolean":"number"},i.getDisplayedValue=function(a){return i.isTextValue(a)?Array.isArray(a.textValue)?a.textValue.map(s=>s.toString().padStart(a.padding??2,"0")).join(a.deliminator??":")+(a.suffix!==void 0?" "+a.suffix:""):a.textValue.toString():i.isBoolean(a)?a?"True":"False":i.isNumber(a)?parseFloat(a.toFixed(3)).toString():a.toString()}})(Ao||(Ao={})),(dF||(dF={})).all=["images","videos","colors","audios","particles","fonts","materials","variables"],(Bee||(Bee={})).all=[...dF.all,"components"],(Uee||(Uee={})).defaultData=function(){return{images:new ti,videos:new ti,colors:new ti,audios:new ti,particles:new ti,fonts:new ti,materials:new ti,components:new ti,variables:new ti,userAPIs:new ti,userWebhooks:new ti,timelineAnimations:new ti}},(um||(um={})).defaultData=function(){return{images:new ti,videos:new ti,colors:new ti,audios:new ti,particles:new ti,fonts:new ti,materials:new ti,components:new ti,variables:new ti,userAPIs:new ti,userWebhooks:new ti,timelineAnimations:new ti}},(t=gu||(gu={})).defaultColors=function(){return Gl({"89b10010-844c-11ec-a8a3-0242ac120002":{r:.5,g:.5,b:.5,a:1,name:"Default Color"}},ti.prototype)},t.defaultImages=function(){return Gl({},ti.prototype)},t.emptyData=function(){return{catelogs:new ti,materials:new ti,images:new ti,videos:new ti,colors:new ti,timelineAnimations:new ti,audios:new ti,particles:new ti,fonts:new ti,variables:new Nt,userAPIs:new ti,userWebhooks:new ti,lib:um.defaultData()}},t.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 r=[0,0,0];return{name:"Time",value:{textValue:r,deliminator:":",padding:2,suffix:"AM"},dynamicVariableType:"time",format:"HH:mm:ss",format12h24h:"12ampm",timeZone:null,hasEnd:!1,endValue:{textValue:r,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)}},t.getFormattedTimerTime=function(i,r){if(r.format==="HH:mm:ss"){let n=Math.floor(i/3600),a=Math.floor((i-3600*n)/60);return{textValue:[n,a,Math.round(i-3600*n-60*a)]}}if(r.format==="mm:ss"){let n=Math.floor(i/60);return{textValue:[n,Math.round(i-60*n)]}}return r.format==="number"?Math.round(i):Math.round(1e3*i)/1e3}}),VIe=k(()=>{}),r_e=k(()=>{var e;Nr(),yX(),i_e(),_X(),(e=Ex||(Ex={})).defaultData={schema:130,scene:ty.defaultData,frames:new ti().add("72fc2993-2da3-4b6b-96ac-2879db3a28bd",gE.defaultData),shared:{...gu.emptyData(),colors:gu.defaultColors()}},e.createDefaultData=function(){return rA.deserialize(rA.serialize(e.defaultData))},e.emptyDataForImports=function(){return{schema:130,scene:ty.emptyDataWithPage(),frames:new ti().add("72fc2993-2da3-4b6b-96ac-2879db3a28bd",gE.defaultData),shared:{...gu.emptyData(),colors:gu.defaultColors(),images:gu.defaultImages()}}},e.emptyData=function(){return{schema:130,scene:ty.emptyDataWithPage(),frames:new ti().add("72fc2993-2da3-4b6b-96ac-2879db3a28bd",gE.defaultData),shared:gu.emptyData()}},e.clipboard2dData=function(){return{schema:130,scene:ty.emptyData(),frames:new ti,shared:gu.emptyData()}},e.withoutLib=function(t){return{...t,shared:{...t.shared,lib:um.defaultData()}}},e.getComponentData=function(t,i){return tw.getComponentData(t,i)},e.hasSensitiveData=function(t){let i=Object.values(t.shared.userAPIs);for(let r of i){let n=r.headers;for(let a of n)if(a.data.key.toLowerCase()==="authorization"&&a.data.value!=="")return!0}return!1}}),kIe=k(()=>{(tH||(tH={})).emptyImage={data:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVQYV2NgYAAAAAMAAWgmWQ0AAAAASUVORK5CYII=",name:"empty"}}),bX=k(()=>{var e;Ih(),Nr(),(tL||(tL={})).list=["idle","move","jump","run"],(e=iL||(iL={})).defaultColliderData={type:"capsule",height:200,radius:50,position:[0,0,0],rotation:[0,0,0]},e.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:e.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 Nt,move:new Nt,jump:new Nt,run:new Nt},navmesh:{enabled:!1,ch:6,cs:6,walkableClimb:5,walkableHeight:1,walkableRadius:0,zones:"all",objects:[],helperVisible:!0,destinationHelperRadius:0,destinationHelperColor:Vr.fromHexAndA(3728051,1)}}});function Ov(e,...t){let i={};for(let r of t.flat())e!=null&&r in e&&(i[r]=e[r]);return i}function Fee(e){e.layers.forEach(t=>{if(t.type==="depth"&&t.colorA!==void 0){let i=t.colorA,r=t.colorB,n=[[i.r,i.g,i.b,i.a],[r.r,r.g,r.b,r.a]],a=[0,1];for(let o=2;o<10;o++)n.push(n[1]),a.push(1);let s={...Ov($a(t),"type","visible","isVector","isWorldSpace","origin","alpha","mode"),near:Math.max(0,t.near),far:Math.max(0,t.far),colors:n,steps:a,num:2,direction:[1,0,0],smooth:!1,gradientType:1};Object.assign(t,s)}else if(t.type==="depth"&&t.gradientType===1&&(t.near<0||t.far<0)){let i={...$a(t),near:Math.max(t.near,0),far:Math.max(t.far,0)};Object.assign(t,i)}})}function Yp(e,t){Object.values(e.shared.materials).forEach(i=>t(i))}function Kp(e,t){e.scene.objects.traverse((i,r)=>{"materials"in r?r.materials.forEach((n,a)=>{n===void 0&&(r.materials[a]=ra.defaultTwoLayerData("phong"),n=r.materials[a]),typeof n!="string"&&t(n)}):"material"in r?typeof r.material!="string"&&(r.material===void 0&&(r.material=ra.defaultTwoLayerData("phong")),t(r.material)):r.type==="Mesh"&&(r.material===void 0&&(r.material=ra.defaultTwoLayerData("phong")),t(r.material)),"overrides"in r&&Object.values(r.overrides).forEach(n=>{n.material&&typeof n.material!="string"&&Object.getPrototypeOf(n.material)!==Qa.prototype&&t(n.material)})})}function zee(e){e.layers===void 0&&Object.assign(e,ra.defaultTwoLayerData("lambert"))}function cF(e){!e.layers||e.layers.forEach(t=>{if(t.type==="depth"&&t.colors.length===10){let i=[...t.colors];i.push(t.colors[9]);let r=[...t.steps];r.push(t.steps[9]);let n={...$a(t),colors:i,steps:r};Object.assign(t,n)}})}function Vee(e){e.scene.objects.traverse((t,i)=>{"materials"in i?i.materials.forEach(r=>{typeof r!="string"&&cF(r)}):"material"in i&&typeof i.material!="string"&&cF(i.material)}),Object.values(e.shared.materials).forEach(t=>cF(t))}function kee(e){e.layers&&e.layers.forEach(t=>{t.type==="depth"&&t.num!==void 0&&(t.colors=t.colors.slice(0,t.num),t.steps=t.steps.slice(0,t.num),delete t.num)})}function Gee(e){e.layers&&e.layers.forEach(t=>{(function(i){return i.type!=="displace"})(t)&&t.isMask===void 0&&(t.isMask=!1),(t.type==="texture"||t.type==="video")&&t.blending===void 0&&(t.blending=0),(t.type==="noise"||t.type==="displace"&&t.displacementType==="noise")&&(t.voronoiStyle===void 0&&(t.voronoiStyle=0),t.highCut===void 0&&(t.highCut=1),t.lowCut===void 0&&(t.lowCut=0),t.smoothness===void 0&&(t.smoothness=.3),t.seed===void 0&&(t.seed=0),t.quality===void 0&&(t.quality=1))})}function jee(e){let t=e.layers.find(i=>i.type==="light")?.data;if(t?.category==="basic"){let i=ha.defaultData("light","phong"),r=t;Object.assign(r,i),r.visible=!1}}function Hee(e){Yp(e,jee),Kp(e,jee)}function Wee(e){e.layers.forEach(t=>{t.type==="light"&&t.category!=="toon"&&t.occlusion===void 0&&(t.occlusion=!0)})}function qee(e){e.layers&&e.layers.forEach(t=>{t.type==="light"&&t.bumpMapIntensity===void 0&&(t.bumpMapIntensity=5)})}var GIe=k(()=>{T4(),Ih(),vX(),M4(),Nr(),E4(),Js(),le(),mX(),bX(),t_e(),yX(),pX(),gX()}),n_e={};function $ee(e){e.layers&&e.layers.forEach(t=>{t.type==="light"&&t.alphaOverride===void 0&&(t.alphaOverride=1)})}function Xee(e){e.rotation=e.rotation.slice(0,3).map(t=>t*Wv)}function a_e(e){Xee(e),e.type==="Page"&&Xee(e.camera),e.states?.forEach(i=>{i.rotation===void 0||i.rotation===null||(i.rotation=i.rotation.slice(0,3).map(r=>r*Wv))});let t=e.geometry;t&&t.type==="SphereGeometry"&&(t.thetaLength=(t.thetaLength??180)*Wv),t&&t.type==="TorusGeometry"&&(t.arc=t.arc*Wv),t&&t.type==="PathGeometry"&&(t.extrusion.angle*=Wv,t.extrusion.twist*=Wv),e.type==="Mesh"&&e.geometry.type==="TextGeometry"&&(e.geometry.text={textValue:e.geometry.text}),Array.isArray($a(e.events))&&e.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 jIe(e){e.scene.objects.traverse((t,i)=>{})}function HIe(e){let t=e.schema??104;t!==130&&t<130&&(rL(e.asset),e.schema=130)}function ix(e,t){t(e.data);for(let i of e.children)ix(i,t)}function s_e(e){let t=e.schema??104;t!==130&&(t<105&&(ix(e.asset,a_e),e.schema=105),t<118&&(ix(e.asset,l_e),e.schema=118),t<121&&(ix(e.asset,iH),e.schema=121),t<130&&(ix(e.asset,WIe),e.schema=130))}function o_e(e,t){Kp(e,t),Yp(e,t),Object.values(e.shared.lib.materials).forEach(i=>t(i.asset))}function rL(e){e.layers===void 0&&Object.assign(e,ra.defaultTwoLayerData("phong"))}function WIe(e){"materials"in e?e.materials.forEach(t=>{t!==void 0&&typeof t!="string"&&rL(t)}):"material"in e&&e.material!==void 0&&typeof e.material!="string"&&rL(e.material)}function l_e(e){e.timelineAnimations=Gl({},ti.prototype)}function iH(e){e.pivot=[0,0,0],e.pivotRotation=[0,0,0]}function qIe(e){}function $Ie(e){let t=e.schema??0;if(t!==130){console.warn("updating from ",t,"to ",130),function(i,r){if(r<1&&(Kp(i,Fee),Yp(i,Fee),i.schema=1),r<2&&(function(n){Object.assign(n.scene.publish,{orbitControls:{...eL.defaultData,...$a(n.scene.publish.orbitControls)}})}(i),i.schema=2),r<3&&(function(n){function a(s){if(s.layers){for(let o of Object.values(s.layers))if(o){for(let[l,h]of Object.entries(o))if((dX.includes(l)||typeof h=="boolean")&&delete o[l],l==="texture")for(let[u,d]of Object.entries(h))(k1e.includes(u)||typeof d=="boolean")&&delete h[u]}}}n.scene.objects.traverse((s,o)=>{o.states.forEach(l=>{let h=l;h.material?a(h.material):h.materials&&h.materials.forEach(u=>{a(u)})})})}(i),i.schema=3),r<4&&(function(n){n.scene.publish.withBackground=!0}(i),i.schema=4),r<5&&(function(n){n.scene.publish.settings.web={compress:!0,preload:!0,preset:1,logo:!0,hint:!1}}(i),i.schema=5),r<6&&(function(n){n.scene.objects.traverse((a,s)=>{let o=s.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),r<7&&(function(n){n.scene.objects.traverse((a,s)=>{let o=s.geometry;o&&(o.type==="DodecahedronGeometry"||o.type==="IcosahedronGeometry")&&(o.detail=Math.round(o.detail))})}(i),i.schema=7),r<8&&(i.schema=8),r<9&&(Vee(i),i.schema=9),r<10&&(function(n){n.scene.objects.traverse((a,s)=>{s.type==="Mesh"&&(s.geometry.type==="BooleanGeometry"||s.geometry.type==="SubdivGeometry")&&(s.geometry.phongAngle=35)})}(i),i.schema=10),r<11&&(function(n){n.scene.environment.ambientLight.softShadows=!1,n.scene.environment.ambientLight.softShadowQuality="low",n.scene.objects.traverse((a,s)=>{(s.type==="DirectionalLight"||s.type==="SpotLight")&&(s.shadowResolution=1024,s.shadowRadius=1,s.depth=1e5)}),n.shared.penumbraSize=new Array(5).fill(.5)}(i),i.schema=11),r<12&&(Vee(i),i.schema=12),r<13&&(function(n){n.shared.audios=Gl({},ti.prototype)}(i),i.schema=13),r<14&&(function(n){let a=n.shared.materials;Object.entries(a).forEach(([s,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(a,{[s]:l})}})}(i),i.schema=14),r<15&&(function(n){Object.entries($a(n.shared.images)).filter(a=>a[1].asset===!1).map(a=>a[0]).forEach(a=>{delete n.shared.images[a]}),Object.entries($a(n.shared.audios)).filter(a=>a[1].asset===!1).map(a=>a[0]).forEach(a=>{delete n.shared.audios[a]})}(i),i.schema=15),r<16&&(function(n){n.scene.publish.settings.web.preload=!1}(i),i.schema=16),r<17&&(Kp(i,kee),Yp(i,kee),i.schema=17),r<18&&(Kp(i,zee),Yp(i,zee),i.schema=18),r<19&&(function(n){Object.assign(n.scene.publish.settings,{video:{...wm.defaultData.settings.video,...$a(n.scene.publish.settings.video)}})}(i),i.schema=19),r<20&&(function(n){n.shared.fonts=Gl({},ti.prototype)}(i),function(n){let a=[];n.scene.objects.traverse((s,o)=>{let l=o;if(l.type==="TextFrame"){let h=ra.defaultTwoLayerData("phong"),u=typeof l.color=="string"?n.shared.colors[l.color]:l.color;h.layers[1].data.color={r:u.r,g:u.g,b:u.b},h.layers[1].data.alpha=l.alpha;let d=function(m){return m.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(f=>f.charAt(0).toUpperCase()+f.slice(1)).join(" ")}(l.font);n.shared.fonts[d]===void 0&&(n.shared.fonts[d]={name:d});let c={name:l.name,...ns.defaultData,...bc.defaultData,flatShading:!1,wireframe:!1,geometry:{...hm.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:h,states:$a(l.states),events:$a(l.events),visible:l.visible,raycastLock:l.raycastLock,position:l.position,rotation:l.rotation,scale:l.scale,hiddenMatrix:l.hiddenMatrix},p=$a(n.scene.objects).parent(s);n.scene.objects.insertAfter(p??null,s,[{id:s+"new",data:c,children:[]}]),a.push(s)}}),a.forEach(s=>{n.scene.objects.delete(s)})}(i),i.schema=20),r<21&&(function(n){let a={0:"MouseDown",1:"MouseUp",2:"MouseHover",5:"KeyDown",6:"KeyUp",7:"Start",9:"LookAt",10:"Follow",11:"Scroll",12:"Audio",13:"GameControl"};n.scene.objects.traverse((s,o)=>{o.events.forEach(l=>{if(a[Number(l.type)])if(Object.assign(l,{type:a[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 Nt,move:new Nt,jump:new Nt}});else{let h=new Nt;Object.assign(l,{actions:h}),(l.type==="MouseDown"||l.type==="MouseUp"||l.type==="KeyDown"||l.type==="KeyUp")&&"url"in l&&h.push({fi:0,id:ht.generateUUID(),data:{type:"Link",url:l.url,delay:0}}),"targets"in l&&(l.targets.forEach((u,d,c)=>{let p={easing:u.easing,duration:u.duration};u.easing===6?Object.assign(p,Ov(u,"mass","stiffness","damping","velocity")):u.easing===5&&Object.assign(p,{control1:{...u.control1},control2:{...u.control2}});let m={repeat:u.repeat?-1:0,delay:u.delay,delayDirection:u.delayDirection,direction:u.cycle&&u.rewind?"pingpong-rewind":u.cycle?"pingpong":"normal"},f={state:u.state,...m,...p},g={allowSlerp:!0,type:"Transition",object:u.object,repeat:0,delay:0,delayDirection:void 0,direction:"normal",tweens:new Nt({fi:0,id:ht.generateUUID(),data:{state:void 0,repeat:0,delay:0,delayDirection:void 0,direction:"normal",duration:0,easing:4}},{fi:1,id:ht.generateUUID(),data:f})};h.push({fi:c,id:d,data:g})}),delete l.targets)}})})}(i),function(n){n.scene.objects.traverse((a,s)=>{function o(l,h){let u=new Nt,d=[];if(s.events.forEach((c,p,m)=>{if(c.type==="Audio"&&c.trigger===h){let f;d.push(p),c.interaction==="play"?f={...Ov(c,"interaction","audio","delay","volume","loop"),triggerAfter:"after"in c?c.after:void 0,toggle:"after"in c?c.toggle:void 0,type:"Audio"}:(c.interaction==="pause"||c.interaction==="stop")&&(f={...Ov(c,"interaction","delay","object","playAudio"),type:"Audio"}),f&&u.push({fi:m,id:p,data:f})}}),d.forEach(c=>s.events.delete(c)),u.length){let c=s.events.find(p=>p.type===l)?.data;c?"actions"in c&&c.actions.insertBefore(null,u):s.events.insertBefore(null,[{id:ht.generateUUID(),data:{type:l,actions:u}}])}}o("Start","start"),o("MouseDown","mouseDown"),o("MouseUp","mouseUp"),o("KeyDown","keyDown"),o("KeyUp","keyUp")})}(i),i.schema=21),r<22&&(Hee(i),i.schema=22),r<23&&(function(n){n.scene.objects.traverse((a,s)=>{s.type==="Mesh"&&s.geometry.type==="SubdivGeometry"&&(s.geometry.scaleBaked||(s.geometry.scaleBaked=[1,1,1]))})}(i),i.schema=23),r<24&&(function(n){n.scene.objects.traverse((a,s)=>{(s.type==="Empty"||s.type==="Mesh")&&s.cloner&&!s.cloner.randomnessObject&&!s.cloner.toObject&&!s.cloner.randomness&&(s.cloner={...s.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),(r<25||i.shared.videos===void 0)&&(function(n){n.shared.videos=Gl({},ti.prototype)}(i),r<25&&(i.schema=25)),r<26&&(function(n){n.scene.objects.traverse((a,s)=>{let o=n.scene.objects.unproxy().parent(a);if(o){let l=$a(n.scene.objects.data(o));l&&l.type==="Mesh"&&l.geometry.type==="BooleanGeometry"&&s.type==="Mesh"&&(s.visible=$a(s).booleanExclude!==!0)}})}(i),i.schema=26),r<27&&(function(n){n.scene.objects.traverse((a,s)=>{if(s.type==="Mesh"){let o=s;s.geometry.type==="NonParametricGeometry"?o.material!==void 0&&delete o.material:o.materials!==void 0&&delete o.materials}})}(i),i.schema=27),r<28&&(Hee(i),i.schema=28),r<29&&(function(n){function a(o){Object.setPrototypeOf(o,Qa.prototype),o.texture&&Object.setPrototypeOf(o.texture,Qa.prototype)}function s(o){Object.setPrototypeOf(o,Qa.prototype);for(let l in o)a(o[l])}n.scene.objects.traverse((o,l)=>{l.states.forEach(h=>{let u=h;if(u.material){let d=$a(u.material).layers;s(d),u.material.layers=d}if(u.materials)for(let d=0;d<u.materials.length;d++){let c=u.materials[d],p=$a(c).layers;s(p),c.layers=p}})})}(i),i.schema=29),r<30&&(function(n){n.scene.objects.traverse((a,s)=>{s.type==="Mesh"&&s.geometry.type==="NonParametricGeometry"&&!("material"in s)&&!("materials"in s)&&(s.material=ra.defaultTwoLayerData("phong"))})}(i),i.schema=30),r<31&&(function(n){n.scene.publish.orbitControls.autoZoom===void 0&&(n.scene.publish.orbitControls.autoZoom=!1),n.scene.objects.traverse((a,s)=>{(s.type==="OrthographicCamera"||s.type==="PerspectiveCamera")&&(s.orthographic.autoZoom===void 0&&(s.orthographic.autoZoom=!1),s.orthographic.autoZoomFrustumSize===void 0&&(s.orthographic.autoZoomFrustumSize=790))})}(i),i.schema=31),r<33&&(function(n){n.scene.objects.traverse((a,s)=>{s.pathSnapping===void 0&&(s.pathSnapping={pathId:null,slide:0,offset:0,orientation:"tangential"}),s.pathSnapping.offset===void 0&&(s.pathSnapping.offset=0)})}(i),i.schema=33),r<34&&(function(n){n.scene.publish.mouseEventTarget===void 0&&(n.scene.publish.mouseEventTarget="canvas"),n.scene.publish.settings.web.hint===void 0&&(n.scene.publish.settings.web.hint=!1)}(i),i.schema=34),r<35&&(function(n){let{video:a}=n.scene.publish.settings;a.format==="gif"&&a.fps>48&&(a.fps=15)}(i),i.schema=35),r<36&&(function(n){n.scene.objects.traverse((a,s)=>{s.events.forEach(o=>{o.type==="GameControl"&&(o.resetYPosition=Math.abs(o.resetYPosition-s.position[1]))})})}(i),i.schema=36),r<37&&(function(n){let a=n.scene.environment.usePhysics;n.scene.objects.traverse((s,o)=>{a&&o.physics===null?o.collision=!1:o.collision="visibility"})}(i),i.schema=37),r<38&&(Kp(i,Gee),Yp(i,Gee),i.schema=38),r<39&&(function(n){n.scene.objects.traverse((a,s)=>{s.events.forEach(o=>{o.type==="GameControl"&&(o.navmesh=iL.defaultDataThirdPerson.navmesh)})})}(i),i.schema=39),r<40&&(function(n){n.scene.styles||(n.scene.styles=ey.defaultData())}(i),i.schema=40),r<41&&(function(n){n.scene.environment.ambientLight.occlusion===void 0&&(n.scene.environment.ambientLight.occlusion=!1),n.scene.environment.ambientLight.aoFullRes===void 0&&(n.scene.environment.ambientLight.aoFullRes=!1),n.scene.environment.ambientLight.radius===void 0&&(n.scene.environment.ambientLight.radius=256),n.scene.environment.ambientLight.bias===void 0&&(n.scene.environment.ambientLight.bias=.5),n.scene.environment.ambientLight.aoColor===void 0&&(n.scene.environment.ambientLight.aoColor={r:.19607843137254902,g:.19607843137254902,b:.19607843137254902}),Kp(n,Wee),Yp(n,Wee)}(i),i.schema=41),r<42&&(function(n){n.scene.objects.traverse((a,s)=>{s.events.forEach(o=>{o.type==="GameControl"&&Object.assign(o.gameActions,{run:new Nt})})})}(i),i.schema=42),r<43&&(function(n){n.scene.objects.traverse((a,s)=>{s.events.forEach(o=>{o.type==="GameControl"&&(o.keyAssignments=[...o.keyAssignments,["run","\u21E7"],["none","Ctrl"]])})})}(i),i.schema=43),r<99){Kp(i,qee),Yp(i,qee),i.scene.publish.playCamera===null&&(i.scene.publish.playCamera=h1);let n=$a(i.scene.objects),a=i.scene.objects;i.scene.publish.playPage=Sx,a.insertBefore(null,null,[{id:Sx,data:{...by.defaultData,backgroundColor:i.scene.backgroundColor,fog:i.scene.fog,postprocessing:i.scene.postprocessing,ao:Ov(i.scene.environment.ambientLight,"occlusion","aoFullRes","radius","bias","aoColor"),publish:{playCamera:i.scene.publish.playCamera,gameControlObject:i.scene.publish.gameControlObject},shadow:Ov(i.scene.environment.ambientLight,"softShadowQuality"),globalPhysics:{...Mx.defaultData,...Ov(i.scene.environment,"usePhysics","gravity")},camera:$a(i.scene.ownerCamera)??by.defaultData.camera,name:"Scene"},children:[]}]);for(let l of n)l.id!==ty.TRASH_CAN_ID&&a.move(Sx,l.fi,l.id);let s=0,o=0;i.shared.penumbraSize&&i.scene.objects.traverse((l,h)=>{h.type==="DirectionalLight"?(h.penumbraSize=i.shared.penumbraSize[Math.min(s,2)],s+=1):h.type==="SpotLight"&&(h.penumbraSize=i.shared.penumbraSize[3+Math.min(o,1)],o+=1),(h.physics===void 0||h.physics===null)&&h.type!=="Instance"&&(h.physics={},Object.assign(h.physics,Tx.defaultData)),h.physics!==void 0&&h.physics!==null&&(h.physics.enabled=h.collision??"visibility",delete h.collision)}),i.schema=99}}(e,t),t<100&&(e.scene.publish.joystickSizeAndXYOffset===void 0&&(e.scene.publish.joystickSizeAndXYOffset=wm.defaultData.joystickSizeAndXYOffset),e.schema=100),t<101&&(Kp(e,$ee),Yp(e,$ee),e.schema=101),t<102&&(function(i){i.scene.objects.traverse((r,n)=>{let a=n.geometry;a&&a.type==="PathGeometry"&&(a.extrusion.capType="flat",a.extrusion.bevel=50,a.extrusion.bevelSides=6,a.extrusion.shape.type==="Custom"&&(a.extrusion.shape.shapeQuality="low"))})}(e),e.schema=102),t<104&&(e.shared.catelogs=new ti,e.shared.lib=um.defaultData(),e.schema=104),t<105&&(function(i){i.shared.variables=Gl({},ti.prototype)}(e),e.scene.objects.traverse((i,r)=>{a_e(r)}),e.schema=105);for(let i of Object.values(e.shared.lib.components))s_e(i);t<106&&(function(i){let r=$a(i.shared.variables);i.shared.variables=Gl(Object.entries(r??{}).map(([n,a],s)=>({fi:s,id:n,data:a})),Nt.prototype)}(e),e.schema=106),t<107&&(e.shared.lib.variables=um.defaultData().variables,e.schema=107),t<109&&(function(i){i.shared.particles=Gl({},ti.prototype),i.shared.lib&&(i.shared.lib.particles=um.defaultData().particles)}(e),e.schema=109),t<110&&(function(i){i.scene.objects.traverse((r,n)=>{n.type==="Particle"&&typeof n.renderMaterial.size=="number"&&Object.assign(n.renderMaterial,{size:[n.renderMaterial.size,n.renderMaterial.size]})})}(e),e.schema=110),t<111&&(e.scene.objects.traverse((i,r)=>{(function(n){Array.isArray($a(n.events))&&n.events?.forEach(a=>{"disabled"in a||(a.disabled=!1),(a.type==="MouseDown"||a.type==="MouseUp"||a.type==="MousePress")&&(a.mode=a.mode||"Object")})})(r)}),e.schema=111),t<112&&(function(i){i.scene.objects.traverse((r,n)=>{n.type==="Page"&&(n.postprocessing.depthOfField.focusDistance=100,n.postprocessing.depthOfField.focalLength=20,n.postprocessing.depthOfField.bokehScale=5)})}(e),e.schema=112),t<113&&(function(i){i.scene.objects.traverse((r,n)=>{Array.isArray($a(n.events))!==!1&&n.events?.forEach(a=>{let s=a.runMode;a.type==="MouseDown"||a.type==="MouseUp"||a.type==="KeyDown"||a.type==="KeyUp"||a.type==="Collision"||a.type==="Trigger"?a.actions?.forEach(o=>{o.type==="Transition"&&(o.runMode=s??"Repeat"),(o.type==="Animation"||o.type==="SwitchCamera")&&(o.runMode=s==="Toggle"?"Toggle":"Normal")}):a.type==="MouseHover"||a.type==="MousePress"||a.type==="KeyPress"?a.actions?.forEach(o=>{(o.type==="Transition"||o.type==="Animation"||o.type==="SwitchCamera")&&(o.runMode="Toggle")}):a.type==="GameControl"?(delete a.actions,Object.keys(a.gameActions).forEach(o=>{a.gameActions[o]?.forEach(l=>{l.type==="Transition"&&(l.runMode="Repeat"),l.type==="Animation"&&(l.runMode="Normal")})})):a.type==="DragDrop"?(delete a.actions,a.dragDropActions?.drag?.forEach(o=>{(o.type==="Transition"||o.type==="Animation"||o.type==="SwitchCamera")&&(o.runMode="Toggle")}),a.dragDropActions?.drop?.forEach(o=>{(o.type==="Transition"||o.type==="Animation"||o.type==="SwitchCamera")&&(o.runMode="Toggle")})):a.type==="Resize"?(delete a.actions,a.breakpoints?.forEach(o=>{o.actions?.forEach(l=>{(l.type==="Transition"||l.type==="Animation"||l.type==="SwitchCamera")&&(l.runMode="Toggle")})})):a.type==="Start"?a.actions?.forEach(o=>{o.type==="Transition"&&(o.runMode="Once"),(o.type==="Animation"||o.type==="SwitchCamera")&&(o.runMode="Normal")}):a.type==="VariableChange"||a.type==="Scroll"?a.actions?.forEach(o=>{o.type==="Transition"&&(o.runMode="Repeat"),(o.type==="Animation"||o.type==="SwitchCamera")&&(o.runMode="Normal")}):a.type==="Conditional"&&(delete a.actions,a.inActions?.forEach(o=>{o.type==="Transition"&&(o.runMode="Repeat"),(o.type==="Animation"||o.type==="SwitchCamera")&&(o.runMode="Normal")}),a.outActions?.forEach(o=>{o.type==="Transition"&&(o.runMode="Repeat"),(o.type==="Animation"||o.type==="SwitchCamera")&&(o.runMode="Normal")}))})})}(e),e.schema=113),t<114&&(e.scene.publish.settings.web.imageQuality===void 0&&(e.scene.publish.settings.web.imageQuality=70),e.schema=114),t<115&&(function(i){i.shared.userAPIs=Gl({},ti.prototype),i.shared.userWebhooks=Gl({},ti.prototype),i.shared.lib&&(i.shared.lib.userAPIs=um.defaultData().userAPIs,i.shared.lib.userWebhooks=um.defaultData().userWebhooks)}(e),e.schema=115),t<116&&(function(i){i.scene.publish.settings.videoStatic===void 0&&(i.scene.publish.settings.videoStatic=wm.defaultData.settings.videoStatic)}(e),e.schema=116),t<117&&(e.scene.publish.settings.web.pixelRatioMobile===void 0&&(e.scene.publish.settings.web.pixelRatioMobile=0),e.scene.publish.settings.web.pixelRatioDesktop===void 0&&(e.scene.publish.settings.web.pixelRatioDesktop=0),e.schema=117),t<118&&(e.shared.timelineAnimations=Gl({},ti.prototype),e.scene.objects.traverse((i,r)=>{l_e(r)}),e.schema=118),t<119&&(e.scene.publish.settings.videoStatic.format=Ex.defaultData.scene.publish.settings.videoStatic.format,e.scene.publish.settings.videoStatic.imageFormat=Ex.defaultData.scene.publish.settings.videoStatic.imageFormat,e.schema=119),t<120&&(e.scene.publish.settings.image.colorSpace="display-p3",e.scene.publish.settings.videoStatic.colorSpace="display-p3",e.schema=120),t<121&&(e.scene.objects.traverse((i,r)=>{iH(r),r.type==="Page"&&r.camera!==void 0&&iH(r.camera)}),e.schema=121),t<122&&(delete e.scene.publish.settings.video,e.scene.publish.orbitControls.rotationSpeed=Ex.defaultData.scene.publish.orbitControls.rotationSpeed,e.schema=122),t<123&&(e.scene.objects.traverse((i,r)=>{r.type==="Page"&&r.sky===void 0&&(r.sky=xg.defaultData)}),e.schema=123),t<124&&(t>=123&&e.scene.objects.traverse((i,r)=>{let n=r.sky;r.type==="Page"&&n!==void 0&&(typeof n.exposure=="number"&&(n.exposure=Math.round(n.exposure/5e-4*1e4)/1e4),n.lighting===void 0&&(n.lighting=xg.defaultData.lighting))}),e.schema=124),t<125&&(e.scene.objects.traverse((i,r)=>{let n=r.sky;r.type==="Page"&&n!==void 0&&n.lightingIntensity===void 0&&(n.lightingIntensity=xg.defaultData.lightingIntensity)}),e.schema=125),t<126&&(e.scene.objects.traverse((i,r)=>{let n=r.sky;r.type==="Page"&&n!==void 0&&(n.mode===void 0&&(n.mode="physical"),n.hdri===void 0?n.hdri={...xg.defaultData.hdri}:(n.hdri.blur===void 0&&(n.hdri.blur=xg.defaultData.hdri.blur),Array.isArray(n.hdri.rotation)&&(n.hdri.rotation=n.hdri.rotation[1]??0)))}),e.schema=126),t<127&&(e.scene.objects.traverse((i,r)=>{let n=r.sky;r.type==="Page"&&n?.hdri!==void 0&&n.hdri.showBackground===void 0&&(n.hdri.showBackground=!0)}),e.schema=127),t<128&&(e.scene.objects.traverse((i,r)=>{let n=r.sky;r.type==="Page"&&n!==void 0&&n.lightingQuality===void 0&&(n.lightingQuality="full")}),e.schema=128),t<129&&(e.scene.objects.traverse((i,r)=>{if(r.type==="Page"){r.camera===void 0&&(r.camera=by.defaultData.camera);let n=r.camera;n.far=1e5,n.perspective?n.perspective.near=70:n.perspective={near:70,fov:45,zoom:1}}}),e.schema=129),t<130&&(o_e(e,rL),e.schema=130)}}gw(n_e,{updateAllMaterials:()=>o_e,updateDocumentSchema:()=>$Ie,updateLibSchema:()=>qIe,updateMaterialSchema:()=>HIe,updateObjectStateRec:()=>ix,updateObjectsSchema:()=>s_e,updateTextValues:()=>jIe});var Wv,Yee,$C,pF,Kee,XC,iy,DS,H1,YC,mF,iI,fF,gF,Zee,rI,vF,xy,rH,A4=k(()=>{r_e(),Nr(),GIe(),E4(),T4(),Js(),_X(),M4(),fX(),Wv=180/Math.PI}),XIe=k(()=>{var e,t,i;Ih(),Nr(),Js(),(Yee||(Yee={})).is=function(r){return!0},(e=$C||($C={})).defaultData={position:[0,0],scale:[1,1],rotation:0,shear:[0,0]},e.merge=function(r,n){return{position:n?.position??r.position,rotation:n?.rotation??r.rotation,scale:n?.scale??r.scale,shear:n?.shear??r.shear}},e.diff=function(r,n){return _1e({position:zc.isEqual(r.position,n.position)?void 0:n.position,rotation:r.rotation===n.rotation?void 0:n.rotation,scale:zc.isEqual(r.scale,n.scale)?void 0:n.scale,shear:r.shear&&n.shear&&zc.isEqual(r.shear,n.shear)?void 0:n.shear})},(pF||(pF={})).defaultData={horizontalConstraint:0,verticalConstraint:0},(Kee||(Kee={})).defaultData={direction:"row",wrap:"unwrap",align:"top-left",gap:10,rowGap:10,autoGap:!1,autoRowGap:!1,leftPadding:8,rightPadding:8,topPadding:8,bottomPadding:8},(XC||(XC={})).defaultData={opacity:1,fill:{color:Vr.fromHexAndA(eo,1),enabled:!0},stroke:{color:Vr.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:Vr.from0to1([0,0,0,1]),enabled:!1,spread:0},innerShadow:{offset:[10,10],blurRadius:10,color:Vr.from0to1([0,0,0,1]),enabled:!1,spread:0}},(t=iy||(iy={})).newEmpty=function(r,n){return{name:n}},t.patch=function(r,n){if(n===void 0)return r;let a={...r};return Object.assign(a,$C.merge(a,n)),a=function(s,o){if(o===void 0)return s;let l={...s},h=["width","height","cornerRadius"];for(let u of h)u in l&&u in o&&o[u]!==void 0&&Object.assign(l,{[u]:o[u]});return l}(a,n),a=function(s,o){if(o===void 0)return s;let l={...s};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}(a,n),a},t.toOps=function(r,n){let a,s=[];for(let[o,l]of Object.entries(n))o!=="name"&&(a===void 0&&(a={path:[],props:{},type:0},s.push(a)),a.props[o]=l);return s},(DS||(DS={})).defaultData={...$C.defaultData,...pF.defaultData,states:new Nt,events:new Nt,visible:!0,raycastLock:!1},(H1||(H1={})).defaultData={...DS.defaultData,...XC.defaultData},(YC||(YC={})).defaultData={cornerRadius:[0,0,0,0]},(mF||(mF={})).defaultData={...H1.defaultData,type:"ellipse2d",width:100,height:100,name:"Ellipse"},(iI||(iI={})).defaultData={...H1.defaultData,...YC.defaultData,type:"rectangle2d",width:100,height:100,name:"Rectangle"},(fF||(fF={})).defaultData={...H1.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"},(gF||(gF={})).defaultData={...H1.defaultData,type:"path2d",path:"",name:"Path"},(Zee||(Zee={})).is=function(r){return r.type==="ellipse2d"||r.type==="rectangle2d"||r.type==="text2d"||r.type==="vector2d"||r.type==="path2d"},(rI||(rI={})).defaultData={...DS.defaultData,name:"Group",type:"group2d"},(vF||(vF={})).defaultData=()=>({...DS.defaultData,...YC.defaultData,...XC.defaultData,name:"Frame",type:"frame2d",clipped:!0,width:200,height:200,fill:{color:Vr.fromHexAndA(4737101,1),enabled:!0},stroke:{color:Vr.fromHexAndA(0,1),thickness:1,enabled:!1,mode:"inside"},backgroundBlur:{radius:2,enabled:!1},layerBlur:{radius:2,enabled:!1}}),(r=>{r.defaultData=function(n){switch(n){case"rectangle2d":case"vector2d":return{...iI.defaultData};case"ellipse2d":return{...mF.defaultData};case"text2d":return{...fF.defaultData};case"path2d":return{...gF.defaultData};case"frame2d":return{...vF.defaultData()};case"group2d":return{...rI.defaultData}}},r.getPivot=function(n){return"width"in n&&"height"in n?[typeof n.width=="number"?.5*n.width:0,typeof n.height=="number"?.5*n.height:0]:[0,0]},r.isResizeable=function(n){return n.type==="rectangle2d"||n.type==="ellipse2d"||n.type==="text2d"||n.type==="frame2d"},r.isAutoLayoutable=function(n){return n.type==="frame2d"&&n.autoLayout!==void 0},r.hasCorners=function(n){return n.type==="rectangle2d"||n.type==="frame2d"}})(xy||(xy={})),(i=rH||(rH={})).defaultData={name:"UI",type:"scene2d",objects:new As},i.emptyData=function(){return{type:"scene2d",objects:new As}}}),YIe=k(()=>{LIe(),BIe(),j1e(),H1e(),r_e(),z1e(),kIe(),Y1e(),Q1e(),fX(),A4(),i_e(),mX(),pX(),W1e(),T4(),X1e(),e_e(),Ih(),E4(),M4(),vX(),Z1e(),_X(),yX(),UIe(),K1e(),bX(),gX(),q1e(),$1e(),XIe()});function ry(e,t=!1){let i=e[0].index!==null,r=new Set(Object.keys(e[0].attributes)),n=new Set(Object.keys(e[0].morphAttributes)),a={},s={},o=e[0].morphTargetsRelative,l=new At,h=0;for(let u=0;u<e.length;++u){let d=e[u],c=0;if(i!==(d.index!==null))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+". 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(!r.has(p))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+'. All geometries must have compatible attributes; make sure "'+p+'" attribute exists among all geometries, or in none of them.'),null;a[p]===void 0&&(a[p]=[]),a[p].push(d.attributes[p]),c++}if(c!==r.size)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+". 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 "+u+". .morphTargetsRelative must be consistent throughout all geometries."),null;for(let p in d.morphAttributes){if(!n.has(p))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+". .morphAttributes must be consistent throughout all geometries."),null;s[p]===void 0&&(s[p]=[]),s[p].push(d.morphAttributes[p])}if(t){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 "+u+". The geometry must have either an index or a position attribute"),null;p=d.attributes.position.count}l.addGroup(h,p,u),h+=p}}if(i){let u=0,d=[];for(let c=0;c<e.length;++c){let p=e[c].index;for(let m=0;m<p.count;++m)d.push(p.getX(m)+u);u+=e[c].attributes.position.count}l.setIndex(d)}for(let u in a){let d=Qee(a[u]);if(!d)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+u+" attribute."),null;l.setAttribute(u,d)}for(let u in s){let d=s[u][0].length;if(d!==0){l.morphAttributes=l.morphAttributes||{},l.morphAttributes[u]=[];for(let c=0;c<d;++c){let p=[];for(let f=0;f<s[u].length;++f)p.push(s[u][f][c]);let m=Qee(p);if(!m)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+u+" morphAttribute."),null;l.morphAttributes[u].push(m)}}}return l}function Qee(e){let t,i,r,n=-1,a=0;for(let h=0;h<e.length;++h){let u=e[h];if(t===void 0&&(t=u.array.constructor),t!==u.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=u.itemSize),i!==u.itemSize)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes."),null;if(r===void 0&&(r=u.normalized),r!==u.normalized)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes."),null;if(n===-1&&(n=u.gpuType),n!==u.gpuType)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.gpuType must be consistent across matching attributes."),null;a+=u.count*i}let s=new t(a),o=new It(s,i,r),l=0;for(let h=0;h<e.length;++h){let u=e[h];if(u.isInterleavedBufferAttribute){let d=l/i;for(let c=0,p=u.count;c<p;c++)for(let m=0;m<i;m++){let f=u.getComponent(c,m);o.setComponent(c+d,m,f)}}else s.set(u.array,l);l+=u.count*i}return n!==void 0&&(o.gpuType=n),o}var CA=k(()=>{le()});function h_e(e){let t=e.points.length/7,i=new Nt;for(let r=0;r<t;r++){let n=7*r,a=e.points[n+0],s=e.points[n+1],o=e.points[n+2],l=e.points[n+3],h=e.points[n+4],u=e.points[n+5],d=e.points[n+6];i.push({fi:r,id:ht.generateUUID(),data:{roundness:d,position:[a,s],areControlsDirectionsMirrored:!0,controlPrevious:{position:[o,l]},controlNext:{position:[h,u]}}})}return{points:i,isClosed:e.isClosed,roundness:e.roundness,shapeHoles:e.shapeHoles?.map(r=>h_e(r))??[]}}function u_e(e){let{userData:t,uuid:i,...r}=e;if(t===void 0||t.type==="NonParametricGeometry")return function(s){let o,{userData:l,data:h}=s,u=h?.groups,d=h?.attributes??{},c=h?.morphAttributes??{},p=h?.interleavedBuffers,m=h?.arrayBuffers,f=h?.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 M=0;M<v.length;M+=3){let T=v[M],A=v[M+1],E=v[M+2];y=Math.min(y,T),_=Math.min(_,A),b=Math.min(b,E),x=Math.max(x,T),w=Math.max(w,A),S=Math.max(S,E)}return{width:x-y,height:w-_,depth:S-b}}(d.position.array));let g={...l===void 0?{}:l.parameters,data:{attributes:d,morphAttributes:c,interleavedBuffers:p,arrayBuffers:m},...o===void 0?{}:o,type:"NonParametricGeometry"};return f!==void 0&&Object.assign(g.data,{index:f}),u!==void 0&&Object.assign(g.data,{groups:u.map(v=>({...v,materialIndex:v.materialIndex??0}))}),g}(e);if(t.type==="SubdivGeometry"){let s="SubdivGeometry",o=r.data?.attributes;if(o?.positionWASM===void 0){let h=new At;if(o?.position===void 0||o?.faceMap===void 0)return null;let u=o.position.array,d=o.faceMap.array,c=r.data.index.array;h.setAttribute("position",new Et(u,3)),h.setIndex(new zm(c,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,M=Object.keys(v.attributes),T={},A={},E=[],C=["getX","getY","getZ","getW"],N=["setX","setY","setZ","setW"];for(let j=0,$=M.length;j<$;j++){let H=M[j],te=v.attributes[H];T[H]=new te.constructor(new te.array.constructor(te.count*te.itemSize),te.itemSize,te.normalized);let ue=v.morphAttributes[H];ue&&(A[H]||(A[H]=[]),ue.forEach((ae,de)=>{let ye=new ae.array.constructor(ae.count*ae.itemSize);A[H][de]=new ae.constructor(ye,ae.itemSize,ae.normalized)}))}let P=.5*y,I=Math.log10(1/y),L=Math.pow(10,I),B=P*L;for(let j=0;j<w;j++){let $=b?b.getX(j):j,H="";for(let te=0,ue=M.length;te<ue;te++){let ae=M[te],de=v.getAttribute(ae),ye=de.itemSize;for(let Z=0;Z<ye;Z++)H+=~~(de[C[Z]]($)*L+B)+","}if(H in _)E.push(_[H]);else{for(let te=0,ue=M.length;te<ue;te++){let ae=M[te],de=v.getAttribute(ae),ye=v.morphAttributes[ae],Z=de.itemSize,fe=T[ae],W=A[ae];for(let z=0;z<Z;z++){let Y=C[z],ne=N[z];if(fe[ne](S,de[Y]($)),ye)for(let V=0,Q=ye.length;V<Q;V++)W[V][ne](S,ye[V][Y]($))}}_[H]=S,E.push(S),S++}}let G=v.clone();for(let j in v.attributes){let $=T[j];if(G.setAttribute(j,new $.constructor($.array.slice(0,S*$.itemSize),$.itemSize,$.normalized)),j in A)for(let H=0;H<A[j].length;H++){let te=A[j][H];G.morphAttributes[j][H]=new te.constructor(te.array.slice(0,S*te.itemSize),te.itemSize,te.normalized)}}return G.setIndex(E),G}(h),m=[],f=new Array(d[d.length-1]+1).fill(3),g=p.getIndex().array;for(let v=0,y=d.length;v<y;)d[v]===d[v+1]?(f[d[v]]++,m.push(...new Set(g.slice(3*v,3*v+6))),v+=2):(m.push(...g.slice(3*v,3*v+3)),v++);o.indexWASM={array:m},o.positionWASM=p.attributes.position,o.verticesPerFaceWASM={array:f}}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:s,...KIe(o.positionWASM.array)};l.subdivisions=t.parameters.subdivisions;for(let h in o)h==="positionWASM"?l[h]=new Float32Array(o[h].array):h==="indexWASM"?l[h]=new Int32Array(o[h].array):h==="verticesPerFaceWASM"&&(l[h]=new Int8Array(o[h].array));return l.scaleBaked=[1,1,1],l}let n=t.type,a=t.parameters;return n==="VectorGeometry"?(a.extrudeDepth&&(a.depth=a.extrudeDepth),{...a,width:100,height:100,shape:h_e(t.shape),type:n}):n==="LatheGeometry"?{...t.parameters,type:n,points:(t?.parameters.points??[]).map(s=>[s.x,s.y])}:(a.extrudeDepth&&(a.depth=a.extrudeDepth),{...a,type:n})}function KIe(e){return nH.setFromArray(e),nH.getSize(xM),{width:xM.x,height:xM.y,depth:xM.z}}var nH,xM,ZIe=k(()=>{Nr(),le(),CA(),new ke,new Zt,new pn,new D,new D,nH=new fn,xM=new D}),QIe=k(()=>{}),JIe=k(()=>{Nr(),A4()});function as(e,t=[0,0]){return[e&&!isNaN(e[0])?e[0]:t[0],e&&!isNaN(e[1])?e[1]:t[1]]}function Hl(e,t,i){switch(e){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:r,control2:n}=t??{...VO.defaultData};return`cubicBezier( ${r[0]}, ${r[1]}, ${n[0]}, ${n[1]} )`}case 6:{let{mass:r,stiffness:n,damping:a,velocity:s}=i??{...zO.defaultData},o=new d_e(r,n,a,s),l=o.solve(1);return()=>h=>o.solve(h)/l}case 8:return()=>r=>Math.floor(r)}}function Jee(e,t,i){return{id:t,fi:i,data:{id:t,path:e,keyframes:new Nt}}}var ete,tte,aH,d_e,c_e,Hm,vE,p_e,bw,NS,KC,yF,xw,ite,_F,rte,bF,iw,df,cf,up,xF,nte,ate,wF,sH,Sm,eOe=k(()=>{var e;Nr(),Ih(),(ete||(ete={})).is=function(t){return t&&typeof t.x=="number"&&typeof t.y=="number"&&typeof t.z=="number"},(e=tte||(tte={})).getControlsWithDefault=function(t,i){let r=[0,0],n=[1,1];if(t?.cubicControls)r=as(t.cubicControls.control1,r);else switch(t?.type){case 2:case 4:r=[.42,0];break;case 3:case 0:r=[0,0];break;case 1:r=[.25,.1];break;case 7:r=[.25,1]}if(i?.cubicControls)n=as(i.cubicControls.control2,n);else switch(i?.type){case 2:case 0:n=[1,1];break;case 3:case 4:n=[.58,1];break;case 1:n=[.25,1];break;case 7:n=[.5,1]}return{control1:r,control2:n}},e.defaultData=function(t,i){return{id:t,name:i,to:5,properties:new Nt}},e.createMaterialGroup=function(t){let i=new Nt;return t.forEach(({data:r,id:n,fi:a})=>{if(r.type==="light"){let s=Jee(["material",`${r.category} lighting`],n,a);i.push(s)}else{let s=Jee(["material",r.type],n,a);i.push(s)}}),i},e.createName=function(t){return Object.entries(t).reduce((i,[r,n])=>(typeof n!="string"&&i.push({name:n.name}),i),[])},e.Presets=[{name:"Slide in",animationParams:{translateX:{value:[-20,0],easing:Hl(3),duration:1e3},opacity:{value:[0,1],easing:Hl(3),duration:1e3},endDelay:250,loop:!0}},{name:"Rotate",animationParams:{rotate:{value:[0,"1turn"],easing:Hl(5),duration:700},endDelay:250,loop:!0}},{name:"Scale Out",animationParams:{scale:{value:[1,1.5],easing:Hl(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:Hl(5),duration:500},endDelay:500,loop:!0}},{name:"Bounce",animationParams:{translateY:{value:["20px","-20px"],duration:575,easing:"easeOutQuad"},direction:"alternate",loop:!0}}],aH=["x","y","z"],d_e=class{constructor(t=1,i=100,r=10,n=0){this.mass=t,this.stiffness=i,this.damping=r,this.initialVelocity=n,this.m_w0=Math.sqrt(i/t),this.m_zeta=r/(2*Math.sqrt(i*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,i=0,r=0;for(;;)if(i+=t,this.solve(i)===1){if(r++,r>=16)break}else r=0;return i*t*1e3}}}),$t=k(()=>{YIe(),QIe(),VIe(),A4(),JIe(),eOe(),bX(),Nr()}),Xm=k(()=>{c_e=[3,4,8,9],Hm=5,vE=3,p_e=32}),PA=k(()=>{le(),bw=e=>{var t;return(t=class extends e{}).geometryHelper=new Nh(30,30,30),t}}),RA=k(()=>{le(),NS=new vm,KC=new Ws,yF=new ke,xw=(e,t,i,r,n=!1,a=e)=>{let s=t,o=a.matrixWorld;if(s.boundingSphere===null&&s.computeBoundingSphere(),KC.copy(s.boundingSphere),KC.applyMatrix4(o),i.ray.intersectsSphere(KC)===!1||(yF.copy(o).invert(),NS.copy(i.ray).applyMatrix4(yF),s.boundingBox!==null&&NS.intersectsBox(s.boundingBox)===!1))return;let l,h,u,d,c,p,m=s.index,f=s.attributes.position,g=s.drawRange;if(n===!1){for(c=Math.max(0,g.start),p=Math.min(m.count,g.start+g.count);c<p;c+=3)if(h=m.getX(c),u=m.getX(c+1),d=m.getX(c+2),l=v(e,i,NS,f,h,u,d),l)return l.faceIndex=Math.floor(c/3),void r.push(l)}else{let y=s.attributes.position,_=new D,b=new D,x=new D,w=new D,S=2,M=1/((a.scale.x+a.scale.y+a.scale.z)/3),T=M*M;for(let A=Math.max(0,g.start),E=Math.min(y.count,g.start+g.count)-1;A<E;A+=S){if(_.fromBufferAttribute(y,A),b.fromBufferAttribute(y,A+1),NS.distanceSqToSegment(_,b,w,x)>T)continue;w.applyMatrix4(a.matrixWorld);let C=i.ray.origin.distanceTo(w);C<i.near||C>i.far||r.push({distance:C,point:x.clone().applyMatrix4(a.matrixWorld),object:e})}}function v(y,_,b,x,w,S,M){let T=new D,A=new D,E=new D,C=new D,N=new D;if(T.fromBufferAttribute(x,w),A.fromBufferAttribute(x,S),E.fromBufferAttribute(x,M),b.intersectTriangle(T,A,E,!1,C)===null)return null;N.copy(C),N.applyMatrix4(y.matrixWorld);let P=_.ray.origin.distanceTo(N);return P<_.near||P>_.far?null:{faceIndex:1,distance:P,point:N.clone(),object:y}}}}),C4=k(()=>{le(),PA(),RA(),ite=new D(1,1,1),_F=new D,rte=new D,bF=new Zt,iw=class extends bw(Vye){constructor(e,t=15){super(t),this.object=e,this.dummy=new yw,this.object.updateMatrixWorld(),this.name=`EmptyObjectHelper: ${e.uuid}`,this.matrix=this.dummy.matrixWorld,this.matrixAutoUpdate=!1,this.object.isBone&&(this.visible=!1)}raycast(e,t){xw(this.object,iw.geometryHelper,e,t,!1,this.dummy)}update(){}updateMatrix(){}updateMatrixWorld(e){this.object.matrixWorld.decompose(_F,bF,rte),this.matrix.compose(_F,bF,ite),super.updateMatrixWorld(e)}updateWorldMatrix(e,t){}}}),tOe=k(()=>{le(),df=new D,cf=new D,up=new ke,xF=[new D(-1,1,1),new D(-1,-1,1),new D(1,-1,1),new D(1,1,1),new D(-1,1,-1),new D(-1,-1,-1),new D(1,-1,-1),new D(1,1,-1)],nte=[[0,3],[1,2],[5,6],[4,7],[0,1],[3,2],[7,6],[4,5],[0,4],[1,5],[2,6],[3,7]],ate=[[0,2],[7,5],[4,1],[3,6],[4,3],[1,6]],wF=(e,t,i)=>{e.updateEntityBoxSize(df,cf),up.copy(t).multiply(e.matrixWorld),cf.x===0&&cf.y===0&&cf.z===0?i.push(new D(df.x,df.y,df.z).applyMatrix4(up)):xF.forEach(r=>{i.push(r.clone().multiply(cf).add(df).applyMatrix4(up))})},sH=class extends fn{constructor(){super(...arguments),this.matrix=new ke,this.vertices=[],this.faces=[],this.edges=[],this.centerEdges=[]}copy(e){return super.copy(e),this.matrix.copy(e.matrix),this.vertices=e.vertices.map(t=>t.clone()),this.faces=e.faces.map(t=>t.clone()),this.edges=e.edges.map(t=>t.clone()),this.centerEdges=e.centerEdges.map(t=>t.clone()),this}setFromObjectSize(e,t=!1){e.updateWorldMatrix(!1,t),this.makeEmpty(),this.matrix.copy(e.matrixWorld);let i=new ke().copy(e.matrixWorld).invert();return this.expandByObjectSize(e,i,t)}expandByObjectSize(e,t,i=!1){let r=[];if(i===!0){let n=[];e.traverseEntity(a=>{if(a.visible||a.cloner&&a.data.visible){if(!("geometry"in a))return up.copy(t).multiply(a.matrixWorld),void n.push(new D().applyMatrix4(up));wF(a,t,r)}}),r.length===0&&r.push(...n)}else wF(e,t,r);return this.setFromPoints(r)}getCenter(e){return(e=super.getCenter(e)).applyMatrix4(this.matrix),e}getPositionToCenter(e){return(e=super.getCenter(e)).applyMatrix4(up.copy(this.matrix).setPosition(0,0,0)),e}computeVertices(){this.getSize(cf).multiplyScalar(.5),this.getCenter(df),up.copy(this.matrix).setPosition(df),this.vertices=xF.map(e=>e.clone().multiply(cf).applyMatrix4(up))}computeEdges(){this.vertices.length>0&&this.computeVertices(),this.edges=nte.map(([e,t])=>new Ch(this.vertices[e],this.vertices[t])),this.centerEdges=this.edges.map(e=>e.getCenter(new D))}computeFaces(){this.vertices.length>0&&this.computeVertices(),this.faces=ate.map(([e,t])=>this.vertices[e].clone().add(this.vertices[t]).multiplyScalar(.5))}}}),nL=k(()=>{Sm={Cloner:null,changeEntityProptotype:()=>{},createEntity:()=>{}}});function yE(e){return e?.isParticleSystem===!0}function t1(e){return e?.isHairSystem===!0}function $g(e){return e?.isShapeBlendEntity===!0}function xX(e){return e?.isPathObject===!0}function Jl(e){return e?.isObject2D===!0}function Xo(e){return e?.isUIObject===!0}function rx(e){return e?.isCloner===!0}function ny(e){return e?.isClone===!0}function nI(e){return e?.isComponentObject===!0}var sa=k(()=>{});function In(e){wX.add(e)}function Ms(e,t){let i=`${e}:${t}`;hH.has(i)||hH.add(i)}function aL(e,t){SX.set(e,t)}function SF(e){return SX.get(e)}function ww(e,t){TX.set(e,t)}function TF(e){return TX.get(e)}function oH(e,t){MX.set(e,t)}function m_e(e){return MX.get(e)}function lH(){return P4}var wX,hH,SX,TX,MX,P4,sL,_r=k(()=>{wX=new Set,hH=new Set,SX=new Map,TX=new Map,MX=new Map,P4=null,sL=null});function f_e(e){let t=e.elements;cd.set(t[0],t[1],t[2]),pd.set(t[4],t[5],t[6]),Cc.set(t[8],t[9],t[10])}function g_e(){let e=Math.max(cd.lengthSq(),pd.lengthSq(),Cc.lengthSq());cd.lengthSq()>wM*e?Eh.copy(cd).normalize():Eh.set(1,0,0),Ah.crossVectors(Cc,Eh),Ah.lengthSq()<=wM*e&&(Ah.copy(pd).addScaledVector(Eh,-pd.dot(Eh)),Ah.lengthSq()<=wM*e&&function(t,i){t.set(1,0,0).cross(i),t.lengthSq()<=wM&&t.set(0,1,0).cross(i),t.normalize()}(Ah,Eh)),Ah.normalize(),ay.crossVectors(Eh,Ah)}function v_e(e){return f_e(e),g_e(),y_e.makeBasis(Eh,Ah,ay)}var cd,pd,Cc,Eh,Ah,ay,y_e,wM,SM,ZC,sy,R4,__e=k(()=>{le(),cd=new D,pd=new D,Cc=new D,Eh=new D,Ah=new D,ay=new D,y_e=new ke,wM=1e-12,SM=.01}),DA=k(()=>{le(),__e(),ZC=new ke,(sy||(sy={})).is=function(e){return e&&e.__isSPEObject},R4=e=>class extends e{constructor(){super(...arguments),this.previousModelViewMatrix=new ke,this.copyPreviousMatrix=!0,this.hiddenMatrix=new ke,this.pivotMatrix=new ke,this.matrixWorldRigid=new ke,this.shearScale=new ke,this.shearScaleInv=new ke}get __isSPEObject(){return!0}getPhysicsLocalMatrix(t){return!!this.rigidBody?.isDynamic()&&(t.copy(this.matrixWorld),this.hasNonUniformScale&&t.multiply(this.shearScaleInv),this.parent&&t.premultiply(ZC.copy(this.parent.matrixWorld).invert()),t.premultiply(ZC.copy(this.hiddenMatrix).invert()),t.multiply(ZC.copy(this.pivotMatrix).invert()),!0)}isDescendantOf(t){t instanceof un&&(t=t.uuid);let i=this;for(;i.parent;){if(i.parent.uuid===t)return!0;i=i.parent}return!1}updateMatrixWorld(t){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||t)&&(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,t=!0);for(let i of this.children)i.updateMatrixWorld(t)}updateWorldMatrix(t,i){let r=this.parent;if(t&&r!==null&&r.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 n of this.children)n.updateWorldMatrix(!1,!0)}traverseChildren(t,i=0){for(let r of this.children)sy.is(r)&&r.traverseObject(t,i+1)}traverseObject(t,i=0){if(t(this,i)!==!0)for(let r of this.children)sy.is(r)&&r.traverseObject(t,i+1)}updateMatrixWorldRigid(){this.hasNonUniformScale=function(t,i,r){return f_e(t),g_e(),i.makeBasis(Eh,Ah,ay),r.set(Eh.dot(cd),Eh.dot(pd),Eh.dot(Cc),0,Ah.dot(cd),Ah.dot(pd),Ah.dot(Cc),0,ay.dot(cd),ay.dot(pd),ay.dot(Cc),0,0,0,0,1),function(){let n=cd.length(),a=pd.length(),s=Cc.length(),o=Math.max(n,a,s);if(o-n>SM||o-a>SM||o-s>SM)return!0;let l=SM*o*o;return Math.abs(cd.dot(pd))>l||Math.abs(cd.dot(Cc))>l||Math.abs(pd.dot(Cc))>l}()}(this.matrixWorld,this.matrixWorldRigid,this.shearScale),this.matrixWorldRigid.copyPosition(this.matrixWorld),this.shearScaleInv.copy(this.shearScale).invert()}attach(t,i){this.updateWorldMatrix(!0,!1);let r=new ke().copy(this.matrixWorld).invert();return t.parent!==null&&(t.parent.updateWorldMatrix(!0,!1),r.multiply(t.parent.matrixWorld)),"hiddenMatrix"in t&&t.hiddenMatrix instanceof ke?t.hiddenMatrix.premultiply(r):t.applyMatrix4(r),t.updateWorldMatrix(!1,!1),this.add(t),i!==void 0&&(this.children.pop(),this.children.splice(i,0,t)),this}copy(t,i=!1){return super.copy(t,i),this.hasNonUniformScale=t.hasNonUniformScale,this}onAfterRender(t,i,r,n,a,s){this.copyPreviousMatrix&&this.previousModelViewMatrix.copy(this.modelViewMatrix)}}});function ste(e,t,i){return wg.subVectors(t,e),lA.subVectors(t,i),wg.cross(lA).length()<=_E}function b_e(e){let t=cH.get(e.points);if(t!==void 0&&t.isClosed===e.isClosed)return t.curve;let i=function(r){let n=r.points,a=[n[0]],s=[new D(...n[0].data.position)];Lv.copy(s[0]);for(let v=0;v<n.length-1;v++)wg.fromArray(n[v].data.position),lA.fromArray(n[v+1].data.position),Ib.subVectors(wg,Lv),Ob.subVectors(wg,lA),Ib.cross(Ob).length()>_E&&(a.push(n[v]),s.push(new D().copy(wg)),Lv.copy(wg));let o=n[n.length-1];a.push(o),s.push(new D(...o.data.position));let l=r.isClosed,h=a.length-(l?0:1),u=a.length,d=[],c=[];for(let v=0;v<u;v++){let y=a[v].data;d.push(new D(...y.controlPrevious.position)),c.push(new D(...y.controlNext.position))}let p=[];for(let v=0;v<h;v++){let y=v===u-1?0:v+1;p.push(ste(s[v],c[v],s[y])&&ste(s[v],d[y],s[y]))}let m=[];for(let v=0;v<u;v++){let y=a[v].data,_=s[v],b={position:_,prevDir:void 0,nextDir:void 0,controlPrevious:d[v],controlNext:c[v],tan:void 0,baseRoundness:y.roundness,removedLength:0};if(m.push(b),y.roundness===0||!l&&(v===0||v===u-1))continue;let x=l&&v==0?u-1:v-1,w=l&&v==u-1?0:v+1,S=new D().subVectors(s[x],_).normalize(),M=new D().subVectors(s[w],_).normalize();b.prevDir=S,b.nextDir=M;let T=p[l&&v===0?u-1:v-1],A=p[v];if(T&&A){Bv.addVectors(S,M).normalize();let E=Lv.crossVectors(Bv,S).length()/S.dot(Bv);b.tan=E,b.removedLength=y.roundness/E}}for(let v=0;v<h;v++){let y=l&&v===u-1?0:v+1,_=m[v],b=m[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 f=new Array(2*u).fill(null);for(let v=0;v<h;v++){let y=l&&v===u-1?0:v+1,_=m[v],b=m[y],x=null;if(p[v]){let w=_.position.clone(),S=b.position.clone();(_.removedLength!==0||b.removedLength!==0)&&(_.nextDir&&w.add(Lv.copy(_.nextDir).setLength(_.removedLength)),b.prevDir&&S.add(Lv.copy(b.prevDir).setLength(b.removedLength))),w.distanceTo(S)>_E&&(x=new uE(w,w.clone().lerp(S,.3),S.clone().lerp(w,.3),S))}else _.position.distanceTo(b.position)>_E&&(x=new uE(_.position,_.controlNext,b.controlPrevious,b.position));f[2*v+1]=x}for(let v=0;v<u;v++){let y=m[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;Bv.addVectors(y.prevDir,y.nextDir).normalize(),Ib.copy(b).lerp(x,.5);let S=b.distanceTo(x)/2;dH.copy(Bv).multiplyScalar(Math.sqrt(Math.pow(w,2)-Math.pow(S,2))).add(Ib),aI.copy(Bv).multiplyScalar(-w).add(dH);let M=_.distanceTo(aI)/_.distanceTo(Ib);Ob.copy(y.prevDir).multiplyScalar(M*_.distanceTo(b)).add(_),uH.copy(Ob).lerp(aI,2);let T=b.clone().lerp(Ob,4/3),A=x.clone().lerp(uH,4/3);f[2*v]=new uE(b,T,A,x)}let g=new x_e;for(let v=0;v<f.length;v++){let y=f[v];y&&g.add(y)}return g}(e);return cH.set(e.points,{isClosed:e.isClosed,curve:i}),i}var x_e,_E,wg,lA,Lv,Bv,Ib,aI,Ob,uH,dH,cH,hr,xc,ote,lte,W1,MF,QC,JC,hte,EF,AF,D4,pH,u1,Pc,w_e=k(()=>{le(),x_e=class extends r7{constructor(){super()}getPoints(e=12){let t,i=[],r=this.getCurveLengths(),n=r[r.length-1]/r.length;for(let a=0,s=this.curves;a<s.length;a++){let o=s[a],l=a===0?r[a]:r[a]-r[a-1],h=Math.ceil(e*l/n),u=o.getPoints(h);for(let d=0;d<u.length;d++){let c=u[d];t&&t.equals(c)||(i.push(c),t=c)}}return this.autoClose&&i.length>1&&!i[i.length-1].equals(i[0])&&i.push(i[0]),i}},_E=.001,wg=new D,lA=new D,Lv=new D,Bv=new D,Ib=new D,aI=new D,Ob=new D,uH=new D,dH=new D,cH=new WeakMap}),xl=k(()=>{le(),$t(),tOe(),Nr(),nL(),sa(),_r(),DA(),w_e(),kr(),(hr||(hr={})).is=function(e){return e&&e.__isEntity},xc=e=>hr.is(e),ote={type:"completeState",isfromEntity:!0},lte=["x","y","z"],W1=new D,MF=new D(1,1,1),QC=new Zt,JC=new pn,hte=new D().set(0,1,0),EF=new ke,AF=new ke,D4=e=>class extends R4(e){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.currentTransitionEvent=null,this.previousAction=null,this._singleBBox=new sH,this._recursiveBBox=new sH,this.singleBBoxNeedsUpdate=!0,this.recursiveBBoxNeedsUpdate=!0,this._needApplyPathSnapping=!0,this.attachedPaths=new Set}get __isEntity(){return!0}entityChildren(t){let i=this.children[t];if(hr.is(i))return i}entityChildrenCount(){let t=this.children.length;for(;t--;)if(hr.is(this.children[t]))return t+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 t=this;for(;t.data.type!=="Instance";){let i=t.parent;if(!hr.is(i))return;t=i}return t}forInstancesRec(t){this.instances.forEach(i=>{i.disposed||t(i),i.forInstancesRec(t)})}super_Entity(t,i){typeof t=="string"&&(this.uuid=t),this.identity=t,this.data=i,this.matrixAutoUpdate=!1,this.dataPatched=this.data}changeSelectedState(t,i,r=!1){if(this.data.states.length!==0||r){for(let n of this.data.states)Rg.toOps(this.data,n.data).forEach(a=>{let s=IO.replaceProps(a,this.data);this.dataPatched=this.data,this.updateByPatchedOp(s,this.data,i)});if(t!==null){let n=this.data.states.data(t);n&&(this.dataPatched=Rg.patch(this.data,n),Rg.toOps(this.data,n).forEach(a=>{this.updateByPatchedOp(a,this.dataPatched,i)}))}r&&this.updateTransformState(this.dataPatched,i),this.stateSelection=t,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(t,i){t.setScalar(0),i.setScalar(0)}resetBBoxNeedsUpdateSelf(){this.singleBBoxNeedsUpdate=!0,this.recursiveBBoxNeedsUpdate=!0}resetBBoxNeedsUpdate(){this.resetBBoxNeedsUpdateSelf(),this.traverseAncestors(t=>{xc(t)&&t.resetBBoxNeedsUpdateSelf()}),this.traverseEntity(t=>{t.resetBBoxNeedsUpdateSelf()})}find(t){let i;return this.traverseEntity(r=>{r.uuid===t&&(i=r)}),i}traverseSortNextHelper(){let t=this.parent;if(t){let i=t.children,r=i.indexOf(this)+1;if(hr.is(i[r]))return i[r];if(hr.is(t))return t.traverseSortNextHelper()}}sortNext(){let t=this.children;return this.children.length>0&&hr.is(this.children[0])?t[0]:this.traverseSortNextHelper()}goUp(t){let i=this;for(;t>0&&i!==null;)i=i.parent,t-=1;return i}hasAnccestorOrSelf(t){return this===t||this.hasAnccestor(t)}hasAnccestor(t){let i=this.parent;for(;i;){if(t===i)return!0;i=i.parent}return!1}countToAccestor(t){let i=0,r=this;for(;r!==t;){if(r===null)return-1;r=r.parent,i+=1}return i}forEachEntity(t){for(let i of this.children)xc(i)&&t(i)}traverseEntityAncestors(t){this.traverseAncestors(i=>{hr.is(i)&&t(i)})}traverseConcreteEntity(t,i=0){if(t(this,i)!==!0)for(let r of this.children)xc(r)&&r.isConcreteEntity&&r.traverseEntity(t,i+1)}traverseEntity(t,i=0){if(t(this,i)!==!0)for(let r of this.children)xc(r)&&r.traverseEntity(t,i+1)}traverseVisibleEntity(t){t(this);for(let i of this.children)xc(i)&&i.visible&&i.traverseVisibleEntity(t)}updateMatrix(){super.updateMatrix(),this.cloner&&this.cloner.onObjUpdateMatrix(),this.dispatchEvent({type:"updateMatrix"})}updateMatrixWorld(t){super.updateMatrixWorld(t),this.dispatchEvent({type:"updateMatrixWorld"})}copy(t,i=!1){return super.copy(t,i),this.dataPatched=t.dataPatched,this.raycastLock=t.raycastLock,this.scaleLock=t.scaleLock,this.hiddenMatrix.copy(t.hiddenMatrix),this}hasEntityChild(){return this.children.some(t=>xc(t))}isAncestorOf(t){if(this.uuid===t)return!1;let i=!1;return this.traverseEntity(r=>{r.uuid===t&&(i=!0)}),i}toObjectTransformState(t=[]){return this.updateWorldMatrix(!0,!1),M7({position:this.position.toArray(),rotation:[this.rotation.x*ht.RAD2DEG,this.rotation.y*ht.RAD2DEG,this.rotation.z*ht.RAD2DEG],scale:this.scale.toArray(),hiddenMatrix:this.hiddenMatrix.toArray(),pivot:[0,0,0],pivotRotation:[0,0,0]},t)}getTransformValues(t,i,r){return i[t].map((n,a)=>r?.shared.getVariable(n,[this.uuid,t,lte[a]])??n)}updateTransformState(t,i){let r=!1;if(t.position&&(this.position.fromArray(this.getTransformValues("position",t,i)),r=!0),t.rotation&&(W1.fromArray(this.getTransformValues("rotation",t,i)).multiplyScalar(ht.DEG2RAD),this.rotation.setFromVector3(W1),r=!0),t.scale&&(this.scale.fromArray(this.getTransformValues("scale",t,i)),r=!0),t.hiddenMatrix!==void 0&&(r=!0,this.hiddenMatrix.fromArray(t.hiddenMatrix??yy.identity)),t.pivot!==void 0||t.pivotRotation!==void 0){if(r=!0,t.pivot!==void 0&&t.pivotRotation!==void 0)this.pivotMatrix.compose(W1.fromArray(t.pivot).negate(),QC.setFromEuler(JC.fromArray(t.pivotRotation.map(n=>n*ht.DEG2RAD))).invert(),MF);else if(t.pivot!==void 0)this.pivotMatrix.setPosition(-t.pivot[0],-t.pivot[1],-t.pivot[2]);else if(t.pivotRotation!==void 0){let n=W1.setFromMatrixPosition(this.pivotMatrix);QC.setFromEuler(JC.fromArray(t.pivotRotation.map(a=>a*ht.DEG2RAD))).invert(),this.pivotMatrix.compose(n,QC,MF)}}return r&&(this.updateMatrix(),this.resetBBoxNeedsUpdate(),this.invalidateClonerTransform(this),this.traverseEntityAncestors(n=>{n.invalidateClonerTransform(this)})),t.position&&t.rotation&&t.scale&&t.hiddenMatrix!==void 0&&this.updateWorldMatrix(!1,!0),r}onVariableUpdate(t=!1){t?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 t of this.children)hr.is(t)&&t.disposeRecursively()}disposeRecursively(){this.dispose(),this.children.forEach(t=>{hr.is(t)&&t.disposeRecursively()})}toState(t=[]){return M7({name:this.name,visible:this.visible,raycastLock:this.raycastLock,...this.toObjectTransformState(t)},t)}updateByObjUpdateOp(t,i){t!==void 0&&this.updateByOp({type:0,props:t,path:[]},{...this.data,...t},i,!1)}updateByOp(t,i,r,n){let a=this.data;this.data=i;let s=t,o=Qr(t.path,["states","*"]);if(o!==null){if(t.type===0){let[l]=o;if(this?.stateSelection===l){let h={...t.props};if(delete h.name,Object.values(t.props).some(u=>u===void 0)){let u=this.data;if(u!==void 0){let d=Ts.zoom(u,t.path.slice(2));if(d)for(let c in t.props)t.props[c]===void 0&&c in d&&(h[c]=d[c])}}s={...t,props:h,path:t.path.slice(2)}}}}else if(t.type===0){let l=this.stateSelection?this.data.states.data(this.stateSelection):void 0;if(l!==void 0){if(t.props.name!==void 0&&l.name){let{name:u,...d}=l;l=d}if(t.props.material!==void 0&&"material"in l){let{material:u,...d}=l;l=d}let h=Ts.removeOverridden(t.path,t.props,l);s={...t,props:h}}}if(this.updateByPatchedOpBase(s,Rg.patch(this.data,this.stateSelection?this.data.states.data(this.stateSelection):void 0),r),Qr(t.path,["overrides"])){let l=[],h=[...t.path];for(l.push(h[1]),h.splice(0,2);h.length>0&&h[0]==="descendants";)l.push(h[1]),h.splice(0,2);if(l[l.length-1]===void 0){if(t.type===0)for(let u of Object.keys(t.props)){l[l.length-1]=u;let d=r.scene.findInstance([this.uuid,...l]);d&&(d.overrideData=t.props[u],d.updateState(Ug.apply(d.component.data,d.overrideData),r))}}else{let u=r.scene.findInstance([this.uuid,...l]);if(u){let d=Ts.zoom(u.component.data,h);if((t={...t,path:h}).type===0){let c=t.props;if(d)for(let[p,m]of Object.entries(t.props))m===void 0&&(c===t.props&&(c={...t.props}),c[p]=d[p]);t={...t,props:c}}u.overrideData=JO.resolve(i.overrides,l),u.updateByOp(t,$s.applySimple(u.data,t),r,!1)}}}else if(this.instances.length>0){let l;if(t.path.length===0&&t.type===0){let h;for(let u of xm.rootOverrideProps)u in t.props&&(h===void 0&&(h={}),h[u]=t.props[u]);h&&(l={...t,props:h})}else for(let h of xm.rootOverrideProps)if(Qr(t.path,[h])){l=t;break}l!==void 0&&this.instances.forEach(h=>{if(h.isInstanceRoot){let u=Ug.filterOp(h.overrideData,l);u&&h.updateByOp(u,$s.applySimple(h.data,u),r,!0)}}),this.instances.forEach(h=>{if(!h.isInstanceRoot){let u=Ug.filterOp(h.overrideData,t);if(u){let d;d=a===h.data&&t===u?i:$s.applySimple(h.data,u),h.updateByOp(u,d,r,!0)}}})}}updateByPatchedOpBase(t,i,r){if(this.dataPatched=i,t.path.length===0&&t.type===0)t.props.type!==void 0&&!e1.is(t.props.type)&&Sm.changeEntityProptotype(this,i,r);else if(t.path.length===1&&t.path[0]==="geometry"&&t.type===0&&"type"in t.props){Sm.changeEntityProptotype(this,i,r);for(let n of this.children)hr.is(n)&&n.updateVisible(r.scene)}this.updateByPatchedOp(t,i,r)}updateByPatchedOp(t,i,r){if(t.path.length===0&&t.type===0?this.updateState(t.props,r):t.type===0&&("resolutionLevel"in t.props||"useChildrenColors"in t.props)&&this.updateState(i,r),t.path[0]==="morphTargetInfluences"&&t.type===0){let n=i.morphTargetInfluences.get(t.path[1])?.data.name;n&&this.updateMorphInfluences(n,r.shared.getVariable(t.props.value,[this.uuid,"morphTargetInfluences",n]))}if(Qr(t.path,["pathSnapping"])!==null&&this.updatePathSnapping(i.pathSnapping),Qr(t.path,["cloner"])!==null){let n=$s.drop(t,1);n.path.length===0&&n.type===0&&n.props.disabled===!0?this.setFromClonerState(null,r):this.cloner?this.cloner.updateState(i.cloner,r):(this.setFromClonerState(i.cloner,r),this.expandCloner(r)),this.updateVisible(r.scene)}}updatePathSnapping(t=this.dataPatched.pathSnapping){this._updatedPathSnapping=t,this._needApplyPathSnapping=!0}get updatedPathSnapping(){return this._updatedPathSnapping}applyPathSnapping(t){if(this._needApplyPathSnapping===!1)return;let i=this._updatedPathSnapping?.pathId??this.dataPatched.pathSnapping.pathId,r=this._updatedPathSnapping?.slide??this.dataPatched.pathSnapping.slide??0,n=this._updatedPathSnapping?.offset??this.dataPatched.pathSnapping.offset??0,a=this._updatedPathSnapping?.orientation??this.dataPatched.pathSnapping.orientation;if(i===null)return;let s=t.find(i);if(!s)return;this._needApplyPathSnapping=!1;let o=s.data;if(o.geometry.path.points.length<=1)return;let l=b_e(o.geometry.path),h=(r+n)%1;r+n===1&&h===0&&(h=1);let u=null;try{u=l.curves.length?l.getPointAt(h):null}catch{}if(u===null)return;s.updateMatrixWorld();let d=this.parent?EF.copy(this.parent.matrixWorld).invert():EF.identity();d.multiply(s.matrixWorld),u.applyMatrix4(d);let c={position:u.toArray(),rotation:o.rotation};if(a==="tangential"){let p=AF.extractRotation(s.matrixWorld),m=l.getTangentAt(h).applyMatrix4(p).add(u),f=AF.lookAt(u,m,hte),g=W1.setFromEuler(JC.setFromRotationMatrix(f)).multiplyScalar(ht.RAD2DEG);c={...c,rotation:g.toArray()}}this.updateTransformState(c),this.traverseEntity(p=>{p._cameraType&&p.dispatchEvent(ote)})}updateVisible(t){if(this.visible=this.dataPatched.visible&&(!this.dataPatched.cloner||(this.dataPatched.cloner.disabled??!1)||this.dataPatched.cloner?.hideBase!==!0),!t)return;let i=!1;this.traverseEntity(r=>{if(r.data.type==="Splat")return i=!0,!0}),i&&t.reloadSplats()}updateState_Entity(t,i){t.name!==void 0&&(this.name=t.name),t.raycastLock!==void 0&&(this.raycastLock=t.raycastLock),t.visible!==void 0&&(this.updateVisible(i?.scene),this.resetBBoxNeedsUpdate()),i&&"cloner"in t&&t.cloner!==void 0&&(this.setFromClonerState(t.cloner,i),this.updateVisible(i.scene)),this.updateTransformState(t,i)}get attachedSurfaceCloners(){return this.children.filter(t=>rx(t)&&t.parameters.type==="toObject")}setFromClonerState(t,i){if(!this.disposed)if(t===null||t.disabled)this.cloner&&this.cloner.dispose(),this.cloner=void 0;else if(this.cloner===void 0){if(Sm.Cloner===null)return void Ms("cloners","a cloner");this.cloner=new Sm.Cloner(this,t),i.scene.addPendingExpandCloner(this)}else this.cloner.updateState(t,i)}expandCloner(t){!this.disposed&&this.cloner&&this.cloner.expandClones(t)}invalidateClonerTransform(t){this.cloner&&this.cloner.invalidateTransform(t)}requestRender(){this.dispatchEvent({type:"requestRender"})}}}),d1=k(()=>{le(),xl(),(pH||(pH={})).is=e=>"objectHelper"in e,u1=(e,t)=>class extends D4(e){constructor(){super(...arguments),this.objectHelper=new t(this),this.gizmos={}}get geometryHelper(){return t.geometryHelper}raycast(i,r){this.objectHelper.raycast(i,r)}showGizmos(){for(let i in this.gizmos){let r=this.gizmos[i];r instanceof JE&&(r.visible=!0)}}updateEntityBoxSize(i,r){this.objectHelper.visible&&this.geometryHelper instanceof Nh?(i.setScalar(0),r.set(this.geometryHelper.parameters.width,this.geometryHelper.parameters.height,this.geometryHelper.parameters.height).multiplyScalar(.5)):super.updateEntityBoxSize(i,r)}hideGizmos(){for(let i in this.gizmos){let r=this.gizmos[i];r instanceof JE&&(r.visible=!1)}}}}),N4=k(()=>{le(),C4(),d1(),Pc=class extends u1(yw,iw){constructor(e,t){super(),this.super_Entity(e,t),this.objectHelper.update(),this.data.type==="Empty"&&(this.objectHelper.visible=!1)}updateState(e,t){this.updateState_Entity(e,t),"buffer"in e&&Object.keys(e).length===1&&t.scene.reloadSplats()}}});function Du(e,t,i,r,n,a,s){TM.set(n,a,s).unproject(r);let o=t[e];if(o!==void 0){let l=i.getAttribute("position");for(let h=0,u=o.length;h<u;h++)l.setXYZ(o[h],TM.x,TM.y,TM.z)}}var TM,sh,ute,S_e,iOe=k(()=>{le(),PA(),RA(),TM=new D,sh=new Eg,ute=class extends Ab{constructor(e){let t=new At,i=new ld({color:16777215,vertexColors:!0,toneMapped:!1}),r=[],n=[],a={},s=new ot(15711266),o=new ot(15711266),l=new ot(2857471);function h(d,c,p){u(d,p),u(c,p)}function u(d,c){r.push(0,0,0),n.push(c.r,c.g,c.b),a[d]===void 0&&(a[d]=[]),a[d].push(r.length/3-1)}h("n1","n2",s),h("n2","n4",s),h("n4","n3",s),h("n3","n1",s),h("f1","f2",s),h("f2","f4",s),h("f4","f3",s),h("f3","f1",s),h("n1","f1",s),h("n2","f2",s),h("n3","f3",s),h("n4","f4",s),h("p","n1",o),h("p","n2",o),h("p","n3",o),h("p","n4",o),h("u1","u2",l),h("u2","u3",l),h("u3","u1",l),t.setAttribute("position",new Et(r,3)),t.setAttribute("color",new Et(n,3)),super(t,i),this.type="CameraHelper",this.camera=e,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=a,this.update()}update(){let e=this.geometry,t=this.pointMap;sh.projectionMatrixInverse.elements=[.5112609807824982,-0,-0,-0,-0,.41421356237309503,-0,-0,-0,-0,-0,-.099999,-0,-0,-1.0000000000000002,.100001];let i=.8;Du("n1",t,e,sh,-1,-1,i),Du("n2",t,e,sh,1,-1,i),Du("n3",t,e,sh,-1,1,i),Du("n4",t,e,sh,1,1,i);let r=i;Du("f1",t,e,sh,-1,-1,r),Du("f2",t,e,sh,1,-1,r),Du("f3",t,e,sh,-1,1,r),Du("f4",t,e,sh,1,1,r);let n=r;Du("u1",t,e,sh,.35,1.1,n),Du("u2",t,e,sh,-.35,1.1,n),Du("u3",t,e,sh,0,1.55,n),e.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}},S_e=class extends bw(ute){constructor(e){super(e),this.object=e,this.name=`CombinedCameraHelper: ${e.uuid}`}updateMatrixWorld(e){super.updateMatrixWorld(e),this.updateTarget()}updateTarget(){let e=this.object.getTarget();this.updateWorldMatrix(!0,!1),this.worldToLocal(e)}raycast(e,t){xw(this.object,this.geometry,e,t,!0)}}});function dte(e){return 1-Math.pow(1-e,3)}var N0,e3,t3,i3,q1,r3,Xd,na,Uh=k(()=>{le(),iOe(),$t(),d1(),kr(),N0=new D,e3=new D,t3=new Zt,i3=new D,q1=new D,r3=new D,Xd=class extends u1(Eg,S_e){constructor(e="",t={...fE.defaultData,name:""}){super(),this._cameraType="OrthographicCamera",this.targetOffset=bm.DefaultTargetOffset,this.isUpVectorFlipped=!1,this.angleOffsetFromUp=0,this.wasMovedByUser=!1,this.wasMovedBySwitchCameraAction=!1,this._createdAt=typeof performance<"u"?performance.now():0,this._tickProjectionTransition=()=>{let n=this._projectionTransition;if(n===void 0)return;if(this.disposed)return void this._endProjectionTransition();n.raf=requestAnimationFrame(this._tickProjectionTransition);let a=Xd.projectionTransitionRequestRender??n.requestRender;this.updateProjectionMatrix(),a?.()},this.super_Entity(e,t),this.previousProjectionMatrix=new ke,this.matrixAutoUpdate=!0,this.width=window.innerWidth,this.height=window.innerHeight;let i=this.width,r=this.height;this.orthoCamera=new qg(-.5*i,.5*i,.5*r,-.5*r,-5e4,1e4),this.perspCamera=new wh(45,i/r,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(e){let t=Xd.projectionTransitionsEnabled;Xd.projectionTransitionsEnabled=!1;try{return e()}finally{Xd.projectionTransitionsEnabled=t}}get isPerspectiveCamera(){return this.cameraType==="PerspectiveCamera"}get isOrthographicCamera(){return!this.isPerspectiveCamera}get cameraType(){return this._cameraType}set fov(e){this.perspCamera.fov=e}get fov(){return this.perspCamera.fov}setNear(e,t){e==="PerspectiveCamera"?this.perspCamera.near=t:this.orthoCamera.near=t}setZoom(e,t){t>=0&&(e==="PerspectiveCamera"?this.perspCamera.zoom=t:this.orthoCamera.zoom=t)}set cameraType(e){e==="PerspectiveCamera"?this.toPerspective():e==="OrthographicCamera"&&this.toOrthographic()}get near(){return this._cameraType==="PerspectiveCamera"?this.perspCamera.near:this.orthoCamera.near}set near(e){this._cameraType==="PerspectiveCamera"?this.perspCamera.near=e:this.orthoCamera.near=e}get zoom(){return this._cameraType==="PerspectiveCamera"?this.perspCamera.zoom:this.orthoCamera.zoom}set zoom(e){e>=0&&(this._cameraType==="PerspectiveCamera"?this.perspCamera.zoom=e:this.orthoCamera.zoom=e)}lookAt(e,t,i){typeof e=="number"&&(e=new D(e,t,i)),super.lookAt(e),this.getWorldPosition(N0),this.targetOffset=N0.distanceTo(e)}getTarget(e=new D){return this.getWorldDirection(e3),this.getWorldPosition(N0),e3.multiplyScalar(this.targetOffset),e.copy(N0).add(e3),e}getDistanceToTarget(){let e=this.getTarget();return this.getWorldPosition(N0),N0.distanceTo(e)}updateUp(){this.getWorldQuaternion(t3),i3.set(0,0,1).applyQuaternion(t3),q1.copy(un.DEFAULT_UP),this.isUpVectorFlipped&&q1.negate(),q1.applyQuaternion(t3),r3.copy(un.DEFAULT_UP).projectOnPlane(i3),this.angleOffsetFromUp=r3.angleTo(q1),this.angleOffsetFromUp*=r3.cross(q1).dot(i3)>=0?1:-1}updateTransformState(e,t){let i=super.updateTransformState(e,t);return e.isUpVectorFlipped!==void 0&&(this.isUpVectorFlipped=e.isUpVectorFlipped),this.updateUp(),i}getViewFrontToObject(e){let t=e.getWorldPosition(new D),i=e.getWorldDirection(new D).multiplyScalar(this.targetOffset);return{position:t.clone().add(i),target:t}}getViewToTarget(e){let t=this.getWorldDirection(new D).multiplyScalar(this.targetOffset);return{position:e.clone().sub(t),target:e}}getViewToObject(e){let t=new D;return e.getWorldPosition(t),this.getViewToTarget(t)}setViewplaneSize(e,t,i=!1){if(this.aspect=e/t,i){let r=e>t?this.aspect:1,n=e>t?1:this.aspect;this.left=-395*r,this.right=395*r,this.top=1/n*395,this.bottom=1/n*-395}else this.left=.5*-e,this.right=.5*e,this.top=.5*t,this.bottom=.5*-t;this.updateProjectionMatrix()}copyViewPlaneSize(e){this.aspect=e.aspect,this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.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 e=this._projectionTransition;if(e===void 0)return 1;let t=(performance.now()-e.start)/e.duration;return t>=1?1:t<=0?0:dte(t)}get _activeSubCamera(){return this._cameraType==="PerspectiveCamera"?this.perspCamera:this.orthoCamera}_canAnimateProjection(){return Xd.projectionTransitionsEnabled&&typeof requestAnimationFrame=="function"&&typeof performance<"u"&&performance.now()-this._createdAt>=Xd.projectionTransitionMinAgeMs}_beginProjectionTransition(e){let t=this._projectionTransition;t===void 0&&(t={from:new ke,blend:new ke,blendInverse:new ke,start:0,duration:Xd.projectionTransitionDuration,referenceDepth:1,raf:0,requestRender:e},this._projectionTransition=t),t.from.copy(this.projectionMatrix),t.start=performance.now(),t.duration=Xd.projectionTransitionDuration,t.referenceDepth=Number.isFinite(this.targetOffset)?Math.max(1,this.targetOffset):1,e&&(t.requestRender=e),t.raf!==0&&cancelAnimationFrame(t.raf),t.raf=requestAnimationFrame(this._tickProjectionTransition)}_applyProjectionTransition(){let e=this._projectionTransition;if(e===void 0)return;let t=(performance.now()-e.start)/e.duration;if(t>=1)return void this._endProjectionTransition();let i=dte(t),r=e.from.elements,n=this._activeSubCamera.projectionMatrix.elements,a=e.blend.elements,s=e.referenceDepth,o=Math.max(1e-6,r[15]-r[11]*s),l=i*o/(i*o+(1-i)*Math.max(1e-6,n[15]-n[11]*s));for(let h=0;h<16;h++)a[h]=r[h]+(n[h]-r[h])*l;e.blendInverse.copy(e.blend).invert(),this.projectionMatrix=e.blend,this.projectionMatrixInverse=e.blendInverse}_endProjectionTransition(){let e=this._projectionTransition;if(e===void 0)return;e.raf!==0&&cancelAnimationFrame(e.raf),this._projectionTransition=void 0;let t=this._activeSubCamera;this.projectionMatrix=t.projectionMatrix,this.projectionMatrixInverse=t.projectionMatrixInverse}_syncProjectionTransition(e){let t=e._projectionTransition;if(t===void 0)return void(this._projectionTransition!==void 0&&this._endProjectionTransition());let i=this._projectionTransition;i===void 0?(i={from:new ke,blend:new ke,blendInverse:new ke,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(t.from),i.start=t.start,i.duration=t.duration,i.referenceDepth=t.referenceDepth,this._applyProjectionTransition()}setFocalLength(e){this.perspCamera.setFocalLength(e),this.toPerspective()}getFocalLength(){return this.perspCamera.getFocalLength()}getEffectiveFOV(){return this.perspCamera.getEffectiveFOV()}getFilmWidth(){return this.perspCamera.getFilmWidth()}getFilmHeight(){return this.perspCamera.getFilmHeight()}setViewOffset(e,t,i,r,n,a){this._cameraType==="PerspectiveCamera"?this.perspCamera.setViewOffset(e,t,i,r,n,a):this.orthoCamera.setViewOffset(e,t,i,r,n,a),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(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}copy(e,t){return super.copy(e,t),this.parent=e.parent,this.orthoCamera.copy(e.orthoCamera),this.perspCamera.copy(e.perspCamera),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.far=e.far,this.view=e.view===null?null:Object.assign({},e.view),this._cameraType=e._cameraType,this.aspect=e.aspect,this.fov=e.fov,this.focus=e.focus,this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this.targetOffset=bm.sanitizeTargetOffset(e.targetOffset),this.updateProjectionMatrix(),this._syncProjectionTransition(e),this}toCameraState(e=[]){return M7({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},e)}updateCameraSubtype(e,t){let i=e==="perspective"?"PerspectiveCamera":"OrthographicCamera";t.zoom!==void 0&&this.setZoom(i,t.zoom),t.near!==void 0&&this.setNear(i,t.near),t.fov!==void 0&&i==="PerspectiveCamera"&&(this.fov=t.fov)}updateState(e,t){this.updateCameraState(e,t)}updateCameraState(e,t){this.updateState_Entity(e,t),e.far!==void 0&&(this.far=e.far),e.orthographic!==void 0&&this.updateCameraSubtype("orthographic",e.orthographic),e.perspective!==void 0&&this.updateCameraSubtype("perspective",e.perspective),e.type!==void 0&&(e.type!==this._cameraType&&this._canAnimateProjection()&&this._beginProjectionTransition(t?.shared.requestRender),this.cameraType=e.type),e.up!==void 0&&this.up.fromArray(e.up.map(i=>typeof i=="number"?i:0)),e.targetOffset!==void 0&&(this.targetOffset=bm.sanitizeTargetOffset(e.targetOffset)),e.isUpVectorFlipped!==void 0&&(this.isUpVectorFlipped=e.isUpVectorFlipped),this.updateProjectionMatrix()}updateByPatchedOp(e,t,i){super.updateByPatchedOp(e,t,i),e.path.length===1&&e.type===0&&this.updateCameraSubtype(e.path[0],e.props)}toState(e){return{...super.toState(e),...this.toCameraState(e),type:this.cameraType}}},(na=Xd).projectionTransitionsEnabled=!1,na.projectionTransitionDuration=350,na.projectionTransitionMinAgeMs=1e3});function T_e(e){return e.type==="TorusGeometry"&&e.arc===360}var M_e,n3,mH,hA=k(()=>{le(),M_e=class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=Object.assign({},t?.parameters??{width:100,revolutions:2,segments:40,pathRadius:10,pathType:0,pathSegments:30,cornerRadius:30,cornerSegments:4},e.parameters),r=Math.abs(i.width),n=Math.abs(i.height??r),a=Math.abs(i.depth??r),s=Math.abs(Math.min(r,a))/2;return{parameters:Object.assign(i,{width:r,height:n,depth:a,radius:s,segments:Math.round(i.segments),pathSegments:Math.round(i.pathSegments),cornerSegments:Math.round(i.cornerSegments)})}}static build(e){let{width:t,height:i,depth:r,radius:n,revolutions:a,segments:s,pathRadius:o,pathType:l,pathSegments:h,cornerRadius:u,cornerSegments:d}=e.parameters,c=new mH(!1,t,i,r,n,a,s,o,l,h,u,d);return Object.assign(c,{userData:{...e,type:"HelixGeometry"}})}},n3=new zm([0,0,0],1),mH=class extends At{constructor(e=!0,t=1,i=1,r=1,n=1,a=1,s=1,o=1,l=1,h=1,u=1,d=1){if(super(),a===0)return;let c=e&&a===1;c&&(d=0),u>100&&(u=100),u===0&&(d=0);let p,m,f,g,v,y,_,b,x=()=>new D,w=new D,S=x(),M=x(),T=x(),A=x(),E=x(),C=x(),N=x(),P=x(),I=x(),L=x(),B=x(),G=i-2*o+.001,j=G/a,$=Math.ceil(s*a),H=$+1,te=G/$,ue=-G/2,ae=h+1,de=2*Math.PI/h,ye=Math.PI/2/d,Z=Math.min((1-u/100)*o,o-.01),fe=o-Z,W=0,z=2*d+2,Y=ae*z/2,ne=Y+ae*H,V=Math.max(0,ae*(H+z)),[Q,ie,q]=[3,3,2].map(dt=>Array(V*dt).fill(0)),he=[],me=n-o;function Ee(dt,et){let Xt=Math.PI/2;y=et*te,b=2*Math.PI*(y%j)/j+Xt,y+=ue,_=Math.sin(b)*me,v=Math.cos(b)*me,e?dt.set(v,_,y):dt.set(v,y,_)}Ee(w,-1e-10),Ee(S,0),A.copy(w),Ee(w,1);let Se=w.distanceTo(S),qe=c?0:fe+Z,Ne=Se*$+2*qe,He=Z,Pe=Ne-qe;for(let dt=0;dt<=$;dt++){Ee(M,dt),B.subVectors(M,A).normalize(),A.copy(M),I.copy(M).setComponent(+e+1,0).normalize(),L.crossVectors(B,I).normalize();let et=dt===0,Xt=dt===$,si=et?3*Math.PI/2:ye,sr=et?He:Pe,St=et?ae:ne,Dt=et?0:V-ae,Qt=B.clone().multiplyScalar(et?-fe:fe).add(M),Ci=B.clone().multiplyScalar(et?-1:1).normalize();for(let wi=0;wi<ae;wi++){let fi=wi*de;if(E.addVectors(w.copy(I).multiplyScalar(o*Math.cos(fi)),S.copy(L).multiplyScalar(o*Math.sin(fi))),C.copy(E).normalize(),et||Xt){c||(W=Dt+wi,[0,1,2].forEach(Pi=>{Q[3*W+Pi]=Qt.getComponent(Pi),ie[3*W+Pi]=Ci.getComponent(Pi)}),q[2*W]=+Xt,q[2*W+1]=wi/h),S.copy(C).multiplyScalar(Z),T.addVectors(M,S);for(let Pi=0;Pi<d;Pi++){let Ir=Pi*ye+si;N.addVectors(w.copy(B).multiplyScalar(fe*Math.sin(Ir)),S.copy(C).multiplyScalar(fe*Math.cos(Ir))),P.copy(N).normalize(),S.addVectors(T,N),N.normalize(),W=St+Pi*ae+wi,[0,1,2].forEach(ir=>{Q[3*W+ir]=S.getComponent(ir),ie[3*W+ir]=P.getComponent(ir)});let Wr=+et+Math.sin(Ir);q[2*W]=(sr+fe*Wr)/Ne,q[2*W+1]=wi/h}}S.addVectors(M,E),W=Y+dt*ae+wi,[0,1,2].forEach(Pi=>{Q[3*W+Pi]=S.getComponent(Pi),ie[3*W+Pi]=C.getComponent(Pi)}),q[2*W]=(qe+dt*Se)/Ne,q[2*W+1]=wi/h}}let ee=H+2*d+2,[Me,We]=[+c,ee-1];for(let dt=Me;dt<=We-1;dt++){let et=c&&dt===We-1;for(let Xt=0;Xt<ae-1;Xt++)p=dt*ae+Xt,m=p+1,f=(et?Xt:p)+ae,g=(et?Xt+1:m)+ae,dt===0?he.push(m,g,f):dt===ee-2?he.push(p,m,f):he.push(p,m,f,m,g,f)}this.setIndex(he),this.setAttribute("position",new Et(Q,3)),this.setAttribute("normal",new Et(ie,3)),this.setAttribute("uv",new Et(q,2))}getClosedTorusIndicesForBooleanOrSubdiv(){let e,t,i,r,n=this.userData.parameters,a=Math.ceil(n.tubularSegments),s=n.radialSegments,o=s+1,l=[];for(let h=1;h<a;h++)for(let u=0;u<s;u++)e=h*o+u,t=e+1,i=e+o,r=t+o,l.push(e,t,i,t,r,i);for(let h=0;h<s;h++)e=a*o+h,t=e+1,i=h+o,r=h+1+o,l.push(e,t,i,t,r,i);return n3.array=new Uint32Array(l),n3.count=l.length,n3}}});function rOe(e){return pte||(pte=async function(){let t=e??"https://cdn.spline.design/@splinetool/runtime@2.0.11/build",i=import("./boolean.js"),[r,n]=await Promise.all([i,fetch(`${t}/boolean.wasm`).then(a=>a.arrayBuffer())]);await r.default({module_or_path:n}),uA=r}())}function oL(){if(uA===void 0)throw new Error("boolean-wasm is not loaded");return uA}function EX(e){let t=dA.get(e);if(t===void 0)throw new Error("Unknown csg mesh set handle "+e);return t}function AX(e){return dA.set(++fH,e),fH}function nOe(e,t,i){if(uA===void 0)return-1;let{positions:r,indices:n,normals:a}=function(s,o){if(o&&s.userData.positions!==void 0){let p=s.userData,m=[];for(let f=0,g=0;f<p.verticesPerFace.length;f++){let v=p.verticesPerFace[f];for(let y=1;y<v-1;y++)m.push(p.indices[g],p.indices[g+y],p.indices[g+y+1]);g+=v}return{positions:p.positions instanceof Float32Array?p.positions:new Float32Array(p.positions),indices:new Uint32Array(m)}}let l;l=T_e(s.userData.parameters)?s.getClosedTorusIndicesForBooleanOrSubdiv():s.getIndex();let h,u=s.getAttribute("position");if(l===null){h=new Uint32Array(u.count);for(let p=0;p<h.length;p++)h[p]=p}else h=l.array instanceof Uint32Array?l.array:new Uint32Array(l.array);let d=s.getAttribute("normal"),c=d!==void 0&&d.itemSize===3&&d.count===u.count&&d.array instanceof Float32Array&&d.isInterleavedBufferAttribute!==!0?d.array:void 0;return{positions:u.array,indices:h,normals:c}}(e,t);return AX(new uA.CsgMesh(r,n,a))}function cte(e,t){let i=oL(),r=A_e[t];if(r===void 0)throw new Error("Unknown boolean operation "+t);let n=e.map(EX);if(n.length===1)return i.clone_mesh(n[0]);let a,s=[];if(t===2&&n.length>2){let o=n[0];for(let l=1;l<n.length-1;l++)o=i.boolean_mesh(o,n[l],0),s.push(o);a=i.boolean_mesh(n[n.length-1],o,2)}else if(t===2)a=i.boolean_mesh(n[1],n[0],2);else{let o=n[n.length-1];for(let l=0;l<n.length-1&&(o=i.boolean_mesh(o,n[l],r),s.push(o),o.tri_count()!==0);l++);a=o,s.pop()}for(let o of s)o.free();return a}function CF(e,t){EX(e).transform(new Float32Array(t.elements))}function E_e(e){let t=dA.get(e);t!==void 0&&(t.free(),dA.delete(e))}var uA,dA,fH,pte,A_e,I4=k(()=>{le(),hA(),dA=new Map,fH=0,A_e={0:0,1:1,2:2}});function I0(e){return e!==null&&"booleanOp"in e}var gH,C_e,aOe=k(()=>{le(),xl(),I4(),gH=class extends D4(Cr){constructor(){super(...arguments),this.booleanMeshSetAddress=-1,this.booleanWasTransformed=!1,this.booleanMatrixInvOld=new ke}updateVisible(e){super.updateVisible(e),this.visible=!I0(this.parent)&&this.visible,I0(this.parent)&&this.parent.invalidateDownstreamBooleanData()}onClonerLayoutUpdated(){I0(this.parent)&&this.invalidateDownstreamBooleanData()}freeBooleanPointer(){this.booleanMeshSetAddress!==-1&&(E_e(this.booleanMeshSetAddress),this.booleanMeshSetAddress=-1)}invalidateDownstreamBooleanData(e=!1){return e?this.booleanWasTransformed=!0:this.freeBooleanPointer(),I0(this.parent)?this.parent.invalidateDownstreamBooleanData():this}invalidateUpstreamBooleanData(){this.freeBooleanPointer();for(let e of this.children)e instanceof gH&&(e.freeBooleanPointer(),I0(e)&&e.invalidateUpstreamBooleanData())}updateTransformState(e,t){let i=super.updateTransformState(e,t);return i&&I0(this.parent)&&this.invalidateDownstreamBooleanData(!0),i}onVariableUpdate(e=!1){super.onVariableUpdate(e),I0(this.parent)&&this.invalidateDownstreamBooleanData(!0)}}}),sOe=k(()=>{C_e=null});function CX(e,t=0,i=e.count,r,n){let a=1/0,s=1/0,o=1/0,l=-1/0,h=-1/0,u=-1/0;for(let d=t;d<i;d++){let c=e.getX(d),p=e.getY(d),m=e.getZ(d);c<a&&(a=c),p<s&&(s=p),m<o&&(o=m),c>l&&(l=c),p>h&&(h=p),m>u&&(u=m)}MM.min.set(a,s,o),MM.max.set(l,h,u),MM.getCenter(r),MM.getSize(n).multiplyScalar(.5)}var MM,mte,fte,Sa,io=k(()=>{le(),aOe(),sOe(),MM=new fn,mte=new At,fte=new Ql,Sa=class extends gH{constructor(e,t){super(mte,fte),this.super_Entity(e,t)}updateState(e,t){this.updateState_Entity(e,t)}raycast(e,t){let i=C_e;i===null?super.raycast(e,t):i(this,e,t)}updateEntityBoxSize(e,t){let i=this.geometry.getAttribute("position");i!==void 0?CX(i,this.geometry.drawRange.start,this.geometry.drawRange.count<1/0?this.geometry.drawRange.count:i.count,e,t):super.updateEntityBoxSize(e,t)}}});function lL(e){return e?.isClassicNodeMaterial===!0}var Fr,cA,P_e,R_e,bE,D_e,N_e,I_e,PX=k(()=>{}),wu=k(()=>{le(),Fr=class extends ot{constructor(e,t,i,r){super(e,t,i),this.isColorA=!0,this.a=r}setRGBA(e,t,i,r){super.setRGB(e,t,i),this.a=r}copy(e){return super.copy(e),this.a="a"in e?e.a:1,this}clone(){return new this.constructor(this.r,this.g,this.b,this.a)}equals(e){return super.equals(e)&&this.a===e.a}setStyle(e,t="srgb"){let i;if(e==="transparent")return this.setRGBA(0,0,0,0),this;if(i=/^((?:rgb|hsl)a?)\(([^)]*)\)/.exec(e)){let r,n=i[1],a=i[2];switch(n){case"rgb":case"rgba":if(r=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return this.a=n==="rgba"?parseFloat(r[4]):1,super.setStyle(e,t);break;case"hsl":case"hsla":if(r=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)%\s*,\s*(\d*\.?\d+)%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return this.a=n==="hsla"?parseFloat(r[4]):1,super.setStyle(e,t)}}return super.setStyle(e,t)}get x(){return this.r}get y(){return this.g}get z(){return this.b}get w(){return this.a}set x(e){this.r=e}set y(e){this.g=e}set z(e){this.b=e}set w(e){this.a=e}}}),O_e=k(()=>{wu(),cA=class extends Fr{}}),oOe=k(()=>{P_e=class{constructor(e=1e4){this.timeout=e,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(...e){}remove(e){let t=this.cache.get(e);t&&(this.dispose(e,t.data),this.cache.delete(e),t.prev.next=t.next,t.next.prev=t.prev,t.next=null,t.prev=null,t.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 e=Date.now(),t=this.head.next;for(;t.time<e-this.timeout;){this.dispose(t.src,t.data),this.cache.delete(t.src);let i=t;t=t.next,t.prev=this.head,this.head.next=t,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(e){return this.cache.get(e)?.data}load(e){let t=Date.now(),i=this.cache.get(e);return i===void 0?(i={data:this.create(e),src:e,time:t,next:null,prev:null},this.cache.set(e,i)):(i.time=t,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((e,t)=>{this.dispose(t,e.data),e.next=null,e.prev=null,e.data=null}),this.cache.clear(),this.head.next=this.tail,this.tail.prev=this.head}destroy(){this.disposeAll(),this.head=null,this.tail=null}}}),L_e=k(()=>{oOe(),R_e=class extends P_e{create(e){return URL.createObjectURL(new Blob([e]))}dispose(e,t){URL.revokeObjectURL(t)}}}),B_e=k(()=>{D_e=class{constructor(e,t){this.data=e,this.cache=t,this.refCount=0}deref(){this.refCount,this.refCount-=1,this.refCount===0&&(this.cache.remove(this),this.dispose())}dispose(){this.refCount}},N_e=class{constructor(){this.cache=new Map}remove(e){this.cache.delete(e.data)}load(e){let t=this.cache.get(e);return t===void 0&&(t=this.create(e),this.cache.set(e,t)),t.refCount+=1,t}}}),lOe=k(()=>{le(),I_e=class extends Pye{constructor(e){super(e),this.type=ai}parse(e){let t=function(p,m){switch(p){case 1:throw new Error("THREE.HDRLoader: Read Error: "+(m||""));case 2:throw new Error("THREE.HDRLoader: Write Error: "+(m||""));case 3:throw new Error("THREE.HDRLoader: Bad File Format: "+(m||""));default:throw new Error("THREE.HDRLoader: Memory Error: "+(m||""))}},i=function(p,m,f){m=m||1024;let g=p.pos,v=-1,y=0,_="",b=String.fromCharCode.apply(null,new Uint16Array(p.subarray(g,g+128)));for(;0>(v=b.indexOf(`
|
|
4162
|
+
})();`}),g1e=k(()=>{J$=class{constructor(e,t,i){this.deps=e,this.onConsole=t,this.onEvent=i,this.disposed=!1,this.eventUnsubs=new Map,this.variablePollHandle=null,this.lastVariables=null}dispose(){this.disposed=!0;for(let e of this.eventUnsubs.values())e();this.eventUnsubs.clear(),this.stopVariablePolling()}execute(e,t){let i=this.deps;switch(e){case"setVariable":{let r=i.setVariable(String(t[0]),t[1]);return r.warning&&this.onConsole("warn",r.warning),r.ok}case"setVariables":{let r=t[0]??{},n=!0;for(let[a,s]of Object.entries(r)){let o=i.setVariable(a,s);o.warning&&this.onConsole("warn",o.warning),n=n&&o.ok}return n}case"getVariable":return i.getVariable(String(t[0]));case"getVariables":return i.getVariables();case"getAllObjects":return i.getAllObjects();case"findObjectByName":case"findObjectById":return i.findObject(String(t[0]));case"getGeometry":{let r=i.getGeometry(String(t[0]),t[1]??{});return r.warning&&this.onConsole("warn",r.warning),r.data}case"updateObject":return i.updateObject(String(t[0]),t[1]??{});case"createObject":return i.createObject(String(t[0]),t[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(t[0]);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(t[0]),t[1]);case"cloneObject":return i.cloneObject(String(t[0]),t[1]??{});case"removeObject":return i.removeObject(String(t[0]));case"spawnObject":{let r=i.spawnObject(String(t[0]),t[1]??{});return r.warning&&this.onConsole("warn",r.warning),r.object}case"destroyObject":return i.destroyObject(String(t[0]));case"setInstanceTransforms":{let r=t[1]===null||t[1]===void 0?null:t[1],n=i.setInstanceTransforms(String(t[0]),r);return n<0&&this.onConsole("warn",`spline.setInstanceTransforms: "${String(t[0])}" has no cloner \u2014 make the object a cloner first (its copies are what this drives).`),n}case"emitEvent":case"emitEventReverse":{let r=i.emitEvent(String(t[0]),String(t[1]),e==="emitEventReverse");return r.warning&&this.onConsole("warn",r.warning),r.ok}case"requestRender":return i.requestRender(),!0;case"listenEvent":{let r=String(t[0]);return r==="variableChange"?this.startVariablePolling():this.eventUnsubs.has(r)||this.eventUnsubs.set(r,i.addSplineEventListener(r,n=>{this.onEvent(r,n)})),!0}case"unlistenEvent":{let r=String(t[0]);return r==="variableChange"?this.stopVariablePolling():(this.eventUnsubs.get(r)?.(),this.eventUnsubs.delete(r)),!0}default:throw new Error(`Unknown spline bridge method: ${e}`)}}startVariablePolling(){this.variablePollHandle===null&&(this.lastVariables=this.deps.getVariables(),this.variablePollHandle=window.setInterval(()=>{if(this.disposed)return;let e=this.deps.getVariables(),t=function(i,r){let n=[];for(let a of Object.keys(r))i[a]!==r[a]&&n.push({name:a,value:r[a]});return n}(this.lastVariables??{},e);this.lastVariables=e;for(let i of t)this.onEvent("variableChange",i)},100))}stopVariablePolling(){this.variablePollHandle!==null&&(window.clearInterval(this.variablePollHandle),this.variablePollHandle=null),this.lastVariables=null}}});function yIe(e,t,i,r){return[e[0]*t+e[4]*i+e[8]*r+e[12],e[1]*t+e[5]*i+e[9]*r+e[13],e[2]*t+e[6]*i+e[10]*r+e[14]]}var _Ie=k(()=>{}),v1e,bIe=k(()=>{}),xIe=k(()=>{eX(),g1e(),v1e=class{constructor(e,t,i){this.iframe=e,this.deps=t,this.onConsole=i,this.disposed=!1,this.handshakeSeen=!1,this.handshakeTimer=null,this.onMessage=r=>{if(this.disposed||r.source!==this.iframe.contentWindow)return;let n=r.data;var a;typeof(a=n)!="object"||a===null||a[mg]!==!0||typeof a.kind!="string"||this.handleMessage(n)},this.host=new J$(t,i,(r,n)=>{this.sendEvent(r,n)})}attach(){window.addEventListener("message",this.onMessage),this.send({[mg]:!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(e){switch(e.kind){case"ready":this.handshakeSeen=!0,this.send({[mg]:!0,kind:"ready-ack"});break;case"console":this.onConsole(e.level,e.text);break;case"call":{let t;try{t=Promise.resolve(this.host.execute(e.method,e.args))}catch(i){t=Promise.reject(i)}t.then(i=>{this.send({[mg]:!0,kind:"result",id:e.id,ok:!0,value:i,error:void 0})},i=>{let r=i instanceof Error?i.message:String(i);this.send({[mg]:!0,kind:"result",id:e.id,ok:!1,value:void 0,error:r}),this.onConsole("error",r)});break}case"input":this.dispatchInput(e.event)}}send(e){this.iframe.contentWindow?.postMessage(e,"*")}sendEvent(e,t){this.send({[mg]:!0,kind:"event",eventName:e,payload:t})}dispatchInput(e){let t=this.deps.getCanvas();if(!t)return;let i=this.iframe.getBoundingClientRect(),r={bubbles:!0,cancelable:!0,view:window,shiftKey:e.shiftKey,ctrlKey:e.ctrlKey,altKey:e.altKey,metaKey:e.metaKey};switch(e.type){case"pointerdown":case"pointermove":case"pointerup":case"pointercancel":t.dispatchEvent(new PointerEvent(e.type,{...r,clientX:(e.x??0)+i.left,clientY:(e.y??0)+i.top,button:e.button,buttons:e.buttons,pointerId:e.pointerId,pointerType:e.pointerType,isPrimary:e.isPrimary,movementX:e.movementX,movementY:e.movementY}));break;case"click":case"dblclick":t.dispatchEvent(new MouseEvent(e.type,{...r,clientX:(e.x??0)+i.left,clientY:(e.y??0)+i.top,button:e.button,buttons:e.buttons}));break;case"wheel":{let n=new WheelEvent("wheel",{...r,clientX:(e.x??0)+i.left,clientY:(e.y??0)+i.top,deltaX:e.deltaX,deltaY:e.deltaY,deltaMode:e.deltaMode});typeof e.wheelDeltaX=="number"&&Object.defineProperty(n,"wheelDeltaX",{value:e.wheelDeltaX}),typeof e.wheelDeltaY=="number"&&Object.defineProperty(n,"wheelDeltaY",{value:e.wheelDeltaY}),t.dispatchEvent(n);break}case"keydown":case"keyup":t.dispatchEvent(new KeyboardEvent(e.type,{...r,key:e.key,code:e.code,repeat:e.repeat}))}}}}),kr=k(()=>{Q$(),rIe(),nIe(),aIe(),oIe(),lIe(),hIe(),uIe(),dIe(),cIe(),pIe(),gIe(),eX(),vIe(),g1e(),_Ie(),bIe(),xIe()}),wIe=k(()=>{});function y1e(e){return Array.isArray(e)?e:[e]}function DO(e,t){let i=0;for(;i<e.length&&i<t.length;){if(e[i]<t[i])return-1;if(e[i]>t[i])return 1;i+=1}return i!==t.length?-1:i!==e.length?1:0}var SIe=k(()=>{});function Gl(e,t){return Object.setPrototypeOf(e,t),e}function jU(e){let t={...e};return Object.setPrototypeOf(t,Object.getPrototypeOf(e)),t}function Ag(e,t,i){if(e===void 0?t===void 0?(e=0,t=10):e=t-10:t===void 0&&(t=e+10),e>t){let a=e;e=t,t=a}let r=[],n=1/(i+1);for(let a=0;a<i;a++){let s=e+(t-e)*(a+.75+.5*Math.random())*n;r.push(s)}return r}function tX(e){return e instanceof Uint8Array||e instanceof Uint16Array||e instanceof Uint32Array||e instanceof Int8Array||e instanceof Int16Array||e instanceof Int32Array||e instanceof Float32Array||e instanceof Float64Array}var TIe=k(()=>{});function iX(e){if(e.deepFreeze!==void 0)return void e.deepFreeze(e);let t=Object.getOwnPropertyNames(e);for(let i of t){let r=e[i];r&&typeof r=="object"&&iX(r)}return Object.freeze(e)}function _1e(e){for(let t of Object.keys(e))e[t]===void 0&&delete e[t];return e}var HU,NO,E7,ti,rX,MIe=k(()=>{}),Js=k(()=>{wIe(),SIe(),TIe(),MIe()}),nX=k(()=>{HU=class{},NO=class extends HU{constructor(e){super(),this.id=e}},E7=class extends HU{constructor(e){super(),this.data=e}}}),EIe=k(()=>{}),b4=k(()=>{ti=class{modifyById(e,t){let i=this;if(i[e]===void 0)throw new Error("not expected");{let r={...i,[e]:t};return Object.setPrototypeOf(r,ti.prototype),r}}add(e,t){return this.runOp({type:1,id:e,data:t})?.data??this}runOp(e){let t=this;if(e.type===1){let i,r=t[e.id];i=r===void 0?{type:2,id:e.id}:{type:1,id:e.id,data:r};let{id:n,data:a}=e,s={...t,[n]:a};return Object.setPrototypeOf(s,ti.prototype),{data:s,actual:e,reverse:i}}if(e.type===2){let{id:i}=e,r=t[i];if(r===void 0)return null;{let n={...t};return Object.setPrototypeOf(n,ti.prototype),delete n[i],{data:n,actual:e,reverse:{type:1,id:i,data:r}}}}return null}}}),aX=k(()=>{rX=class extends Error{}});function b1e(e,t){for(let i of e)t(i.id,i.data)!==!0&&b1e(i.children,t)}function x1e(e,t){if(t(e.id,e.data)!==!0)for(let i of e.children)x1e(i,t)}var As,jC,ew,Nt,o1=k(()=>{Js(),aX(),Js(),As=class extends Array{constructor(...e){super(...e),Fc(this,"partialObjectCaches"),Fc(this,"objCaches"),Fc(this,"parentCaches"),Object.setPrototypeOf(this,As.prototype)}deepFreeze(){let e=0;for(;e<this.length;)iX(this[e]),e++}fillCaches0(e,t){this.objCaches.set(e.id,e),this.parentCaches.set(e.id,t);for(let i of e.children)this.fillCaches0(i,e.id)}fillCaches(){if(this.objCaches===void 0){this.objCaches=new Map,this.parentCaches=new Map;for(let e of this)this.fillCaches0(e,null)}}randomId(){this.fillCaches();let e=Array.from(this.objCaches.keys());if(e.length!==0)return e[Math.max(0,Math.floor(Math.random()*e.length)-1)]}nonExistOrDescendantOf(e,t){if(!this.has(e))return!0;for(;e;){let i=this.parent(e);if(i===t)return!0;e=i}return!1}rootAcestor(e){for(;e;){let t=this.parent(e);if(!t)return e;e=t}return e}isDescendantOf(e,t){for(;e;){let i=this.parent(e);if(i===t)return!0;e=i}return!1}data(e){return this.get(e)?.data}has(e){return this.childrenOf(e)!==void 0}partialCache(e){this.partialObjectCaches===void 0&&(this.partialObjectCaches=new Map);let t=this.get(e);t!==void 0&&this.partialObjectCaches.set(e,t)}get(e){if(this.partialObjectCaches!==void 0){let t=this.partialObjectCaches.get(e);if(t!==void 0)return t}return this.fillCaches(),this.objCaches.get(e)}childrenOf(e){return e===null?this:this.get(e)?.children}traverseFrom(e,t){if(e===null)this.traverse(t);else{let i=this.get(e);i&&x1e(i,t)}}traverse(e){b1e(this,e)}totalSize(){return this.fillCaches(),this.objCaches.size}parent(e){return this.fillCaches(),this.parentCaches.get(e)}childrenArray(e){return e===null?this:this.get(e).children}modifyById(e,t){if(this.get(e)===void 0)throw new Error("not expected");{let i=this.parent(e),r=this.childrenArray(i),n=r.findIndex(o=>o.id===e);if(n<0)throw new Error("not expected");let a=r[n];r=[...r],r[n]={...a,data:t};let s=new Map;return s.set(e,r[n]),this.modifyArrayBy(i,r,s)}}modifyArrayBy(e,t,i=void 0){let r=e,n=t;for(;r!==null;){let s=n,o=r;if(r=this.parent(r),r===void 0)throw new Error;n=this.childrenArray(r);let l=n.findIndex(h=>h.id===o);if(l<0)throw new Error;n=[...n],n[l]={...n[l],children:s},i&&i.set(o,n[l])}Object.setPrototypeOf(n,As.prototype);let a=n;if(i&&this.objCaches!==void 0&&this.parentCaches!==void 0){a.objCaches=this.objCaches;for(let[s,o]of i)a.objCaches.set(s,o);a.parentCaches=this.parentCaches,this.objCaches=void 0,this.parentCaches=void 0}else a.fillCaches();return a}runOp(e){switch(e.type){case 7:return this.addOp(e);case 8:return this.deleteOp(e);case 9:return this.moveOp(e)}return null}checkDuplicatedIdRec({id:e,children:t}){if(this.get(e)!==void 0)return!0;for(let i of t)if(this.checkDuplicatedIdRec(i))return!0;return!1}addOp(e){let{parent:t,fi:i,id:r,data:n,children:a}=e;if(t!==null&&this.get(t)===void 0||this.checkDuplicatedIdRec(e))return null;{let s=t,o=this.childrenArray(s),l={fi:i,id:r,data:n,children:a};return o=[...o,l],o.sort((h,u)=>h.fi-u.fi),e.localIndex=o.indexOf(l),{data:this.modifyArrayBy(s,o),actual:e,reverse:{type:8,id:r}}}}deleteOp(e){let{id:t}=e;if(this.get(t)===null)return null;{let i=this.parent(t);if(i===void 0)return null;let r=this.childrenArray(i),n=r.findIndex(s=>s.id===t);e.localIndex=n,r=[...r];let a=r.splice(n,1)[0];return{data:this.modifyArrayBy(i,r),actual:e,reverse:{type:7,...a,parent:i}}}}moveOp(e){let{parent:t,fi:i,id:r}=e;if(t!==null&&this.get(t)===void 0)return this.deleteOp({type:8,id:r});if(t!==null){let d=t;for(;d!==null;){if(d===void 0)throw new Error;if(d===r)throw new rX("cyclic tree");d=this.parent(d)}}let n=this.parent(r);if(n===void 0)return null;let a=n,s=this.childrenArray(n),o=s.findIndex(d=>d.id===r);s=[...s];let l=s.splice(o,1)[0],h=this.modifyArrayBy(n,s);n=t,s=h.childrenArray(n);let u=l.fi;return l={...l,fi:i},s=[...s,l],s.sort((d,c)=>d.fi-c.fi),e.localIndex=s.indexOf(l),h=h.modifyArrayBy(n,s),{data:h,actual:e,reverse:{type:9,parent:a,fi:u,id:r}}}previous(e,t){if(t===null){let r=this.childrenArray(e);return r.length===0?null:r[r.length-1].id}let i=null;for(let r of this.childrenArray(e)){if(r.id===t)return i;i=r.id}return null}traverseSortNext(e){let t=this.parent(e);if(t!==void 0){let i=this.childrenArray(t),r=i.findIndex(n=>n.id===e)+1;if(r<i.length)return i[r].id;if(t)return this.traverseSortNext(t)}}sortNext(e){let t=this.childrenArray(e);return t.length>0?t[0].id:this.traverseSortNext(e)}traverseSortPrevious(e){let t=this.childrenArray(e);return t.length>0?this.traverseSortPrevious(t[t.length-1].id):e}sortPrevious(e){let t=this.parent(e);if(t!==void 0){let i=this.childrenArray(t),r=i.findIndex(n=>n.id===e)-1;return r>=0?this.traverseSortPrevious(i[r].id):t}}getAllSorted(e){let t=[];for(let i of e){let r=this.getWithSortKey(i.id);r!==void 0&&t.push({...i,...r})}t.sort((i,r)=>DO(i.sortKey,r.sortKey));for(let i of t)delete i.sortKey;return t}getAllIdSorted(e){let t=[];for(let i of e){let r=this.getWithSortKey(i);r!==void 0&&t.push(r)}t.sort((i,r)=>DO(i.sortKey,r.sortKey));for(let i of t)delete i.sortKey;return t.map(i=>i.id)}getWithSortKey(e){let t=e,i=[],r=this.get(t),n=r;if(r!==void 0){for(;t;)i.splice(0,0,r.fi),t=this.parent(t),t!==null&&(r=this.get(t));return{...n,sortKey:i}}}insertBeforeHelper(e,t,i){return this.insertAfterHelper(e,this.previous(e,t),i)}insertAfterHelper(e,t,i){let r=this.childrenArray(e);if(t===null){if(r.length===0)return Ag(0,i,i);{let n=r[0].fi;return Ag(n-i,n,i)}}{let n=this.get(t);if(n===void 0||this.parent(t)!==e)throw new Error("illegal args");let a=r.find(s=>s.fi>n.fi);if(a===void 0){let s=r[r.length-1].fi;return Ag(s,s+i,i)}return Ag(n.fi,a.fi,i)}}}}),sX=k(()=>{var e;jC=null,(e=ew||(ew={})).setPreservePrototype=function(t){jC=t},e.tryPreservePrototype=function(t,i){return Object.getPrototypeOf(t)===jC&&Object.setPrototypeOf(i,jC),i},e.runOp=function(t,i){if(i.type!==0)return null;if(Array.isArray(t)){let r=i.props,n={},a=[...t],s=!1;if(r)for(let o of Object.keys(r)){let l=parseInt(o);if(isNaN(l))throw new Error("wrong index");n[o]=a[l],a[l]=r[o],s=!0}return s?{data:a,actual:i,reverse:{type:0,props:n}}:null}{let r=i.props,n={},a={...t},s=!1;if(r)for(let o of Object.keys(r)){n[o]=a[o];let l=r[o];l===void 0?delete a[o]:a[o]=l,s=!0}return s?{data:e.tryPreservePrototype(t,a),actual:i,reverse:{type:0,props:n}}:null}}}),l1=k(()=>{Js(),Js(),Nt=class extends Array{constructor(...e){super(...e),Fc(this,"objCaches"),Object.setPrototypeOf(this,Nt.prototype)}deepFreeze(){let e=0;for(;e<this.length;)iX(this[e]),e++}fillCaches0(e){this.objCaches.set(e.id,e)}fillCaches(){if(this.objCaches===void 0){this.objCaches=new Map,Object.getOwnPropertyDescriptor(this,"objCaches").enumerable=!1;for(let e of this)this.fillCaches0(e)}}randomId(){this.fillCaches();let e=Array.from(this.objCaches.keys());if(e.length!==0)return e[Math.max(0,Math.floor(Math.random()*e.length)-1)]}data(e){return this.get(e)?.data}get(e){return this.fillCaches(),this.objCaches.get(e)}modifyById(e,t){if(this.get(e)===void 0)throw new Error("not expected");{let i=this,r=i.findIndex(a=>a.id===e);if(r<0)throw new Error("not expected");let n=i[r];return i=[...i],i[r]={...n,data:t},this.modifyArrayBy(i)}}modifyArrayBy(e){Object.setPrototypeOf(e,Nt.prototype);let t=e;return typeof process<"u"||t.fillCaches(),t}runOp(e){switch(e.type){case 4:return this.addOp(e);case 5:return this.deleteOp(e);case 6:return this.moveOp(e)}return null}addOp(e){let{fi:t,id:i,data:r}=e,n=this,a={fi:t,id:i,data:r};return n=[...n,a],n.sort((s,o)=>s.fi-o.fi),e.localIndex=n.indexOf(a),{data:this.modifyArrayBy(n),actual:e,reverse:{type:5,id:i}}}deleteOp(e){let{id:t}=e,i=this,r=i.findIndex(a=>a.id===t);if(r===-1)return null;e.localIndex=r,i=[...i];let n=i.splice(r,1)[0];return{data:this.modifyArrayBy(i),actual:e,reverse:{type:4,...n}}}moveOp(e){let{fi:t,id:i}=e,r=this;r=[...r];let n=r.findIndex(o=>o.id===i);if(n===-1)return null;let a=r[n].fi,s={...r[n],fi:t};return r[n]=s,r.sort((o,l)=>o.fi-l.fi),e.localIndex=r.indexOf(s),{data:this.modifyArrayBy(r),actual:e,reverse:{type:6,fi:a,id:i}}}previous(e){if(e===null)return this.length===0?null:this[this.length-1].id;let t=null;for(let i of this){if(i.id===e)return t;t=i.id}return null}insertBeforeHelper(e,t){return this.insertAfterHelper(this.previous(e),t)}insertAfterHelper(e,t){let i=this;if(e===null){if(i.length===0)return Ag(0,t,t);{let r=i[0].fi;return Ag(r-t,r,t)}}{let r=this.get(e);if(r===void 0)throw new Error("illegal args");let n=i.find(a=>a.fi>r.fi);if(n===void 0){let a=i[i.length-1].fi;return Ag(a,a+t,t)}return Ag(r.fi,n.fi,t)}}}});function AIe(e,t){let i={cur:[],result:[],len:0};return[e=xx(e,t,i)??e,i.result]}function QN(e,t){return e===null?null:(e.cur[e.len]=t,e.len+=1,e)}function JN(e){e&&(e.len-=1)}function w1e(e,t,i){let r=!1,n=e.map(a=>{let s=a.id,o=t[s];if(o!==void 0&&typeof o=="string"&&(r=!0,s=o,i!==null))throw new Error("not supported");let l=xx(a.data,t,QN(i,s));JN(i),r=r||l!==void 0,l===void 0&&(l=a.data);let h=w1e(a.children,t,i);return h!==void 0?r=!0:h=a.children,{...a,id:s,data:l,children:h}});if(r)return n}function xx(e,t,i){if(e instanceof As){let r=w1e(e,t,i);return r!==void 0&&Object.setPrototypeOf(r,Object.getPrototypeOf(e)),r}if(e instanceof Nt)return function(r,n,a){let s=!1,o=r.map(l=>{let h=l.id,u=n[h];if(u!==void 0&&typeof u=="string"&&(s=!0,h=u,a!==null))throw new Error("not supported");let d=xx(l.data,n,QN(a,h));return JN(a),s=s||d!==void 0,d===void 0&&(d=l.data),{...l,id:h,data:d}});if(s)return Object.setPrototypeOf(o,Object.getPrototypeOf(r)),o}(e,t,i);if(Array.isArray(e)){let r=!1,n=e.map((a,s)=>{let o=xx(a,t,QN(i,s));return JN(i),r=r||o!==void 0,o===void 0&&(o=a),o});return r?(Object.setPrototypeOf(n,Object.getPrototypeOf(e)),n):void 0}if(e&&typeof e=="object"&&!tX(e)){let r={},n=!1;for(let[a,s]of Object.entries(e))if(a!=="name"&&a!=="variableId"){let o=t[a];if(typeof o=="string"){if(i!==null)throw new Error("not supported");n=!0,a=o}let l=xx(s,t,QN(i,a));JN(i),n=n||l!==void 0,l===void 0&&(l=s),r[a]=l}else r[a]=s;return n?(Object.setPrototypeOf(r,Object.getPrototypeOf(e)),r):void 0}if(typeof e=="string"){let r=t[e];return r!==void 0&&function(n){if(n===null)return null;n.result.push(n.cur.slice(0,n.len))}(i),r}}var S1e=k(()=>{o1(),l1(),Js()});function wx(e){return e&&typeof e=="object"&&e instanceof Qa}function oX(e,t){if(t===void 0)return;let i=!1,r=e.map(n=>{let a=n.id,s=mE(n.data,t[a]);if(i=i||s!==void 0,s===void 0&&(s=n.data),n.children){let o=oX(n.children,t);return o!==void 0?i=!0:o=n.children,{...n,id:a,data:s,children:o}}return{...n,id:a,data:s}});return i?r:void 0}function mE(e,t){if(!wx(t))return t;if(e instanceof As){let i=oX(e,t);return i!==void 0&&Object.setPrototypeOf(i,Object.getPrototypeOf(e)),i}if(e instanceof Nt)return function(i,r){if(r===void 0)return;let n=!1,a=i.map(s=>{let o=s.id,l=mE(s.data,r[o]);return n=n||l!==void 0,l===void 0&&(l=s.data),{...s,id:o,data:l}});return n?(Object.setPrototypeOf(a,Object.getPrototypeOf(i)),a):void 0}(e,t);if(Array.isArray(e)){let i=!1,r=e.map((n,a)=>{let s=mE(n,t[a]);return i=i||s!==void 0,s===void 0&&(s=n),s});return i?(Object.setPrototypeOf(r,Object.getPrototypeOf(e)),r):void 0}if(e instanceof Qa)return lX(e,t);if(e&&typeof e=="object"){let i={},r=!1;for(let[n,a]of Object.entries(e)){let s=mE(a,t[n]);r=r||s!==void 0,s===void 0&&(s=a),i[n]=s}return r?(Object.setPrototypeOf(i,Object.getPrototypeOf(e)),i):void 0}}function lX(e,t){if(e===void 0)return t;if(t===void 0)return e;if(!wx(t))return t;if(!wx(e))return Ug.apply(e,t);let i=new Set;for(let n of Object.keys(e))i.add(n);for(let n of Object.keys(t))i.add(n);let r=new Qa;for(let n of i){let a=lX(e===void 0?void 0:e[n],t===void 0?void 0:t[n]);r[n]=a}return r}var Qa,Ug,IO,$s,fJ,hX=k(()=>{var e;o1(),l1(),S4(),Js(),Qa=class{unusedFunOverridesTable(t){}runOp(t){let i=[],r=this,n=0,a={};for(;n<t.path.length;){if(i.push(r),r=r===void 0?void 0:r[t.path[n]],r!==void 0&&!wx(r))return null;n+=1}r=r?jU(r):new Qa;for(let[s,o]of Object.entries(t.props)){let l=r[s];a[s]=l,o===void 0?delete r[s]:r[s]=o}for(;n>0;){if(Object.keys(r).length===0){let s=i[n-1];s&&(r=jU(s),delete r[t.path[n-1]])}else{let s=i[n-1];if(s){let o=jU(s);o[t.path[n-1]]=r,r=o}else{let o=new Qa;o[t.path[n-1]]=r,r=o}}n-=1}return{data:Object.setPrototypeOf(r,Qa.prototype),actual:t,reverse:{...t,props:a}}}},(e=Ug||(Ug={})).apply=function(t,i){return mE(t,i)??t},e.merge=function(t,i){return lX(t,i)},e.filterOp=function(t,i){let r=0,n=i.path,a=t;for(;r<n.length&&a!==void 0;){if(a=Ts.zoomOnce(a,n[r]),a===void 0)return i;if(!wx(a))return;r+=1}if(a===void 0)return i;if(wx(a)){if(i.type===0){let s={...i.props};for(let o of Object.keys(a))delete s[o];return{...i,props:s}}if(i.type===1||i.type===4||i.type===7){let s=oX([i],a);return s?s[0]:i}return i}}}),CIe=k(()=>{S4(),b4(),o1(),aX(),sX(),l1(),S1e(),hX(),(IO||(IO={})).replaceProps=function(e,t){let i=Ts.zoom(t,e.path);if(typeof i=="object"){let r={};for(let n of Object.keys(e.props))r[n]=i[n];return{...e,props:r}}return{...e,props:{}}},(e=>{function t(n,a){let s=a.path,o=[];for(;;){let l;if(n instanceof Qa&&a.type===0&&(l=n.runOp({...a,path:s.slice(o.length)}),l===null&&(l=void 0)),l===void 0&&o.length===s.length&&(l=n instanceof As||n instanceof Nt||n instanceof ti?n.runOp(a):ew.runOp(n,a)),l!==void 0){if(l!==null){let d=l.data;for(let c=o.length-1;c>=0;c--){let p=s[c],m=o[c];if(m instanceof As){if(typeof p=="number")throw new Error("illegal arg");d=m.modifyById(p,d)}else if(m instanceof Nt){if(typeof p=="number")throw new Error("illegal arg");d=m.modifyById(p,d)}else if(m instanceof ti){if(typeof p=="number")throw new Error("illegal arg");d=m.modifyById(p,d)}else if(m instanceof Qa){let f={...m,[p]:d};d=Object.setPrototypeOf(f,Qa.prototype)}else{if(typeof m!="object")return null;if(Array.isArray(m)){if(typeof p=="string"&&(p=parseInt(p),isNaN(p)))throw new Error("Invalid path");let f=d;d=[...m],d[p]=f}else d=ew.tryPreservePrototype(m,{...m,[p]:d})}}return{data:d,actual:{...l.actual,path:s},reverse:{...l.reverse,path:s}}}return null}let h,u=s[o.length];if(n instanceof As){if(typeof u=="number")throw new Error("");h=n.get(u)?.data}else if(n instanceof Nt){if(typeof u=="number")throw new Error("");h=n.get(u)?.data}else n!==null&&(h=n[u]);if(h===void 0)return null;o.push(n),n=h}}function i(n,a){for(let s=0;s<n.length&&s<a.length;s++)if(n[s]!==a[s])return!0;return!1}function r(n,a){if(n.length!==a.length)return!1;for(let s=0;s<n.length;s++)if(n[s]!==a[s])return!1;return!0}e.drop=function(n,a){return{...n,path:n.path.slice(a)}},e.applySimple=function(n,a){return t(n,a)?.data??n},e.apply=t,e.pathDisjoint=i,e.pathEq=r,e.commutative=function(n,a){return i(n.path,a.path)},e.subsumed=function(n,a){return!(n.type!==0||a.type!==0||!r(n.path,a.path))&&Object.keys(n.props).every(s=>a.props[s]!==void 0)}})($s||($s={})),(e=>{function t(i,r){let n=i,a=[],s=[];for(let o of r)try{if(o.type===3||o.type===5&&o.path[o.path.length-1]==="variables"){let l,h,u;if(o.type===3?(l=Ts.zoom(n,[...o.path,o.id]),u=$s.apply(n,{...o,type:2})):(l=Ts.zoom(n,[...o.path,o.id,"value"]),u=$s.apply(n,o)),u!==null){n=u.data;let[d,c]=AIe(n,{[o.id]:l});n=d;for(let p=0;p<c.length;p++){let m=c[p],f=m.pop();if(typeof f=="number"){let g=[f];for(let y=p+1;y<c.length;y++){let _=c[y],b=_[_.length-1];if(typeof b!="number"||!Ts.equal(m,_.slice(0,_.length-1)))break;g.push(b),c.splice(y,1)}let v=Ts.zoom(n,m);h=v.map((y,_)=>g.includes(_)?o.id:y),l=v,f=m.pop()}else{if(f==="alphaOverride"||f==="alpha"){l/=100;let g=l,v=Ts.zoom(n,m.slice(0,m.length-2)),y=v.layers.map(_=>_.id===m[m.length-1]?{..._,data:{..._.data,[f]:g}}:_);Object.setPrototypeOf(y,Object.getPrototypeOf(v.layers)),v.layers=y}h=o.id}a.push({type:0,path:m,props:{[f]:l}}),s.push({type:0,path:m,props:{[f]:h}})}s.push(u.reverse),a.push(u.actual)}}else{let l=$s.apply(n,o);l!==null&&(a.push(l.actual),n=l.data,s.push(l.reverse))}}catch(l){if(l instanceof rX)return null;throw l}return{data:n,actual:a,reverse:s.reverse()}}e.empty=function(){return[]},e.removePrefix=function(i,r){let n=[];for(let a of i){let[s,...o]=a.path;s===r&&n.push({...a,path:o})}return n},e.addPrefix=function(i,r){return i.map(n=>({...n,path:[r,...n.path]}))},e.concat=function(i,r){return[...i,...r]},e.compress=function(i,r){return[...i.filter(n=>!r.some(a=>$s.subsumed(n,a))),...r]},e.commutative=function(i,r){return i.every(n=>r.every(a=>$s.commutative(n,a)))},e.applyAll=function(i,r){for(let n of r){let a=t(i,n);a!==null&&(i=a.data)}return i},e.apply=t})(fJ||(fJ={}))});function WU(e,t,i){if(e.length>0){let r=e[e.length-1];if(r.type===0&&t.type===0&&Ts.equal(r.path,i))return void Object.assign(r.props,t.props)}e.push({...t,path:i})}function eI(e,t,i){return i instanceof As?new x4(e,t,i):i instanceof Nt?new w4(e,t,i):i instanceof ti?new Proxy(new M1e(e,t,i),A1e):i!==null&&typeof i=="object"?tX(i)?i:new Proxy(new T1e(e,t,i),E1e):i}function yM(e){let t=new C7(e);return[eI(t,"",e),t]}function OO(e,t){let[i,r]=yM(e);return t(i),r.result()}function $a(e){return e instanceof x4||e instanceof w4?e._current:e!==null&&typeof e=="object"?e[A7]:e}var A7,gJ,RS,G1,T1e,M1e,qU,E1e,A1e,x4,w4,C7,Ts,C1e=k(()=>{b4(),o1(),sX(),l1(),Js(),S4(),A7=Symbol(),gJ=Symbol(),RS=Symbol(),G1=class{reportOp(e,t,i=[]){let r=this;if(t===null)return;r._current=t.data;let n=i;for(;!(r instanceof C7);){let a=r._path,s=r._current;if(a!==""&&n.splice(0,0,a),r=r._parent,r===null)return;r.update(a,s)}r.push(n,e,t.actual,t.reverse)}deleteChildren(e){if(this._children){let t=this._children[e];if(t){let i=t[RS];i&&i(),delete this._children[e]}}}},T1e=class extends G1{constructor(e,t,i){super(),this._parent=e,this._path=t,this._current=i}update(e,t){if(Array.isArray(this._current)){if(typeof e=="string"&&(e=parseInt(e),isNaN(e)))throw new Error("Invalid path");this._current=[...this._current],this._current[e]=t}else this._current=ew.tryPreservePrototype(this._current,{...this._current,[e]:t})}runOp(e){this.reportOp(e,ew.runOp(this._current,e),e.path)}},M1e=class extends G1{constructor(e,t,i){super(),this._parent=e,this._path=t,this._current=i}update(e,t){this._current={...this._current,[e]:t},Object.setPrototypeOf(this._current,ti.prototype)}runOp(e){this.reportOp(e,this._current.runOp(e))}},qU={get(e,t){if(t===RS)return()=>{e._parent=null};if(t===A7)return e._current;if(t===gJ)return e;let{_current:i,_children:r}=e;if(t==="push"&&Array.isArray(i))throw new Error("not supported to expand array");let n=r===void 0?void 0:r[t];if(n!==void 0)return n;let a=i[t],s=eI(e,t,a);return s!==a?(r===void 0&&(r={},e._children=r),r[t]=s,s):a},has:(e,t)=>t in e._current,ownKeys:e=>Reflect.ownKeys(e._current),defineProperty(){throw Error("not supported")},getPrototypeOf:e=>Object.getPrototypeOf(e._current),setPrototypeOf(){throw Error("not supported")},getOwnPropertyDescriptor(e,t){let i=e._current,r=Reflect.getOwnPropertyDescriptor(i,t);return r&&{writable:!0,configurable:!0,enumerable:r.enumerable,value:i[t]}}},E1e={...qU,set(e,t,i){let r={type:0,props:{[t]:$a(i)??i}};return e.deleteChildren(t),e.runOp(r),!0},deleteProperty(e,t){let i={type:0,props:{[t]:void 0}};return e.deleteChildren(t),e.runOp(i),!0}},A1e={...qU,set(e,t,i){return i===void 0?this.deleteProperty(e,t):(e.deleteChildren(t),e.runOp({type:1,id:t,data:i})),!0},deleteProperty:(e,t)=>(e.runOp({type:2,id:t}),!0)},x4=class extends G1{constructor(e,t,i){super(),this._children={},this._parent=e,this._path=t,this._current=i,this[RS]=()=>{this._parent=null}}unproxy(){return this._current}update(e,t){this._current=this._current.modifyById(e,t)}runOp(e){this.reportOp(e,this._current.runOp(e))}randomId(){return this._current.randomId()}isDescendantOf(e,t){return this._current.isDescendantOf(e,t)}childrenOf(e){return this._current.childrenOf(e)}get(e){return this._current.get(e)}parent(e){return this._current.parent(e)}traverse(e){this._current.traverse((t,i)=>{e(t,this.data(t))})}data(e){let{_current:t,_children:i}=this,r=i===void 0?void 0:i[e];if(r!==void 0)return r;let n=t.get(e)?.data,a=eI(this,e,n);return a!==n?(i===void 0&&(i={},this._children=i),i[e]=a,a):n}add(e,t,i,r,n){this.runOp({type:7,parent:e,fi:t,id:i,data:r,children:n})}move(e,t,i){this.runOp({type:9,parent:e,fi:t,id:i})}insertAfter(e,t,i){let r=this._current.insertAfterHelper(e,t,i.length);for(let n=0;n<i.length;n++){let a=i[n];this.add(e,r[n],a.id,a.data,a.children)}}insertBefore(e,t,i){let r=this._current.insertBeforeHelper(e,t,i.length);for(let n=0;n<i.length;n++){let a=i[n];this.add(e,r[n],a.id,a.data,a.children)}}moveAfter(e,t,i){let r=this._current.insertAfterHelper(e,t,i.length);for(let n=0;n<i.length;n++){let a=i[n];this.move(e,r[n],a)}}moveBefore(e,t,i){let r=this._current.insertBeforeHelper(e,t,i.length);for(let n=0;n<i.length;n++){let a=i[n];this.move(e,r[n],a)}}delete(e){this.deleteChildren(e),this.runOp({type:8,id:e})}sortNext(e){return this._current.sortNext(e)}sortPrevious(e){return this._current.sortPrevious(e)}getAllSorted(e){return this._current.getAllSorted(e)}},w4=class extends G1{constructor(e,t,i){super(),this._children={},this._parent=e,this._path=t,this._current=i,this[RS]=()=>{this._parent=null}}unproxy(){return this._current}get length(){return this._current.length}forEach(e){let t=this.length;for(let i=0;i<t;i++){let r=this._current[i].id,n=this._current[i].fi;e(this.data(this._current[i].id),r,n,i)}}find(e){let t=this.length;for(let i=0;i<t;i++){let r=this._current[i].id;if(e(this.data(r),r))return this.get(r)}}update(e,t){this._current=this._current.modifyById(e,t)}randomId(){return this._current.randomId()}get(e){return{...this._current.get(e),data:this.data(e)}}at(e){let{id:t,fi:i}=this._current.at(e);return{id:t,fi:i,data:this.data(t)}}data(e){let{_current:t,_children:i}=this,r=i===void 0?void 0:i[e];if(r!==void 0)return r;let n=t.get(e)?.data,a=eI(this,e,n);return a!==n?(i===void 0&&(i={},this._children=i),i[e]=a,a):n}runOp(e){this.reportOp(e,this._current.runOp(e))}add(e,t,i){this.runOp({type:4,fi:e,id:t,data:i})}move(e,t){this.runOp({type:6,fi:e,id:t})}insertAfter(e,t){let i=this._current.insertAfterHelper(e,t.length);for(let r=0;r<t.length;r++){let n=t[r];this.add(i[r],n.id,n.data)}}insertBefore(e,t){let i=this._current.insertBeforeHelper(e,t.length);for(let r=0;r<t.length;r++){let n=t[r];this.add(i[r],n.id,n.data)}}moveAfter(e,t){let i=this._current.insertAfterHelper(e,t.length);for(let r=0;r<t.length;r++){let n=t[r];this.move(i[r],n)}}moveBefore(e,t){let i=this._current.insertBeforeHelper(e,t.length);for(let r=0;r<t.length;r++){let n=t[r];this.move(i[r],n)}}delete(e){this.deleteChildren(e),this.runOp({type:5,id:e})}},C7=class extends G1{constructor(e){super(),this.ts=[],this.actual=[],this.reverse=[],this._current=e}update(e,t){if(e!=="")throw new Error("");this._current=t}push(e,t,i,r){WU(this.ts,t,e),WU(this.actual,i,e),WU(this.reverse,r,e)}result(){return{data:this._current,ts:this.ts,actual:this.actual,reverse:this.reverse.reverse()}}}}),S4=k(()=>{nX(),C1e(),l1(),o1(),Js(),(e=>{function t(r,n){return(r instanceof As||r instanceof x4)&&typeof n=="string"||(r instanceof Nt||r instanceof w4)&&typeof n=="string"?r.data(n):typeof n=="number"&&Array.isArray(r)||typeof n=="string"&&typeof r=="object"&&r!==null?r[n]:void 0}function i(r,n,a=0){for(;a<n.length&&r!==void 0;)r=t(r,n[a]),a+=1;return r}e.equal=function(r,n){if(n.length!==r.length)return!1;{let a=0;for(;a<r.length;){if(r[a]!==n[a])return!1;a+=1}}return!0},e.removeOverridden=function(r,n,a){let s=i(a,r);if(s!==void 0&&typeof s=="object"&&s!==null){let o={...n};return Object.keys(s).forEach(l=>{delete o[l]}),o}return n},e.zoomOnce=t,e.zoom=i,e.findPathes=function(r,n){let a=[];return function s(o,l){if(o instanceof NO&&o.id===n.id)a.push(l);else if(o instanceof Nt)for(let h=0;h<o.length;h++)s(o[h].data,[...l,o[h].id]);else if(o instanceof As)o.traverse((h,u)=>{s(h,[...l,u])});else if(Array.isArray(o))for(let h=0;h<o.length;h++)s(o[h],[...l,h]);else{if(tX(o))return;if(typeof o=="object"&&o!==null)for(let h in o)s(o[h],[...l,h])}}(r,[]),a}})(Ts||(Ts={}))}),PIe=k(()=>{});function Qr(e,t){let i=[];if(!(t.length<=e.length))return null;{let r=0;for(;r<t.length;){if(t[r]==="*")i.push(e[r]);else if(e[r]!==t[r])return null;r+=1}}return i}var RIe=k(()=>{});function HC(e){try{if(!Rn.trusted&&!_m){let i=Br.sharedLength||0;i<Br.length&&(Br.length=i)}let t;if(Rn.randomAccessStructure&&Pt[Ue]<64&&Pt[Ue]>=32&&wJ?(t=wJ(Pt,Ue,vu,Rn),Pt=null,!(e&&e.lazy)&&t&&(t=t.toJSON()),Ue=vu):t=Za(),Mo&&(Ue=Mo.postBundlePosition,Mo=null),_m&&(Br.restoreStructures=null),Ue==vu)Br&&Br.restoreStructures&&vJ(),Br=null,Pt=null,ym&&(ym=null);else{if(Ue>vu)throw new Error("Unexpected end of MessagePack data");if(!_m){let i;try{i=JSON.stringify(t,(r,n)=>typeof n=="bigint"?`${n}n`:n).slice(0,100)}catch(r){i="(JSON view not available "+r+")"}throw new Error("Data read, but end of buffer not reached "+i)}}return t}catch(t){throw Br&&Br.restoreStructures&&vJ(),R7(),(t instanceof RangeError||t.message.startsWith("Unexpected end of buffer")||Ue>vu)&&(t.incomplete=!0),t}}function vJ(){for(let e in Br.restoreStructures)Br[e]=Br.restoreStructures[e];Br.restoreStructures=null}function Za(){let e=Pt[Ue++];if(e<160){if(e<128){if(e<64)return e;{let t=Br[63&e]||Rn.getStructures&&P1e()[63&e];return t?(t.read||(t.read=P7(t,63&e)),t.read()):e}}if(e<144){if(e-=128,Rn.mapsAsObjects){let t={};for(let i=0;i<e;i++){let r=D1e();r==="__proto__"&&(r="__proto_"),t[r]=Za()}return t}{let t=new Map;for(let i=0;i<e;i++)t.set(Za(),Za());return t}}{e-=144;let t=new Array(e);for(let i=0;i<e;i++)t[i]=Za();return Rn.freezeData?Object.freeze(t):t}}if(e<192){let t=e-160;if(yd>=Ue)return Cg.slice(Ue-Mh,(Ue+=t)-Mh);if(yd==0&&vu<140){let i=t<16?uX(t):R1e(t);if(i!=null)return i}return UO(t)}{let t;switch(e){case 192:return null;case 193:return Mo?(t=Za(),t>0?Mo[1].slice(Mo.position1,Mo.position1+=t):Mo[0].slice(Mo.position0,Mo.position0-=t)):O1e;case 194:return!1;case 195:return!0;case 196:if(t=Pt[Ue++],t===void 0)throw new Error("Unexpected end of buffer");return $U(t);case 197:return t=Er.getUint16(Ue),Ue+=2,$U(t);case 198:return t=Er.getUint32(Ue),Ue+=4,$U(t);case 199:return D0(Pt[Ue++]);case 200:return t=Er.getUint16(Ue),Ue+=2,D0(t);case 201:return t=Er.getUint32(Ue),Ue+=4,D0(t);case 202:if(t=Er.getFloat32(Ue),Rn.useFloat32>2){let i=B7[(127&Pt[Ue])<<1|Pt[Ue+1]>>7];return Ue+=4,(i*t+(t>0?.5:-.5)|0)/i}return Ue+=4,t;case 203:return t=Er.getFloat64(Ue),Ue+=8,t;case 204:return Pt[Ue++];case 205:return t=Er.getUint16(Ue),Ue+=2,t;case 206:return t=Er.getUint32(Ue),Ue+=4,t;case 207:return Rn.int64AsType==="number"?(t=4294967296*Er.getUint32(Ue),t+=Er.getUint32(Ue+4)):Rn.int64AsType==="string"?t=Er.getBigUint64(Ue).toString():Rn.int64AsType==="auto"?(t=Er.getBigUint64(Ue),t<=BigInt(2)<<BigInt(52)&&(t=Number(t))):t=Er.getBigUint64(Ue),Ue+=8,t;case 208:return Er.getInt8(Ue++);case 209:return t=Er.getInt16(Ue),Ue+=2,t;case 210:return t=Er.getInt32(Ue),Ue+=4,t;case 211:return Rn.int64AsType==="number"?(t=4294967296*Er.getInt32(Ue),t+=Er.getUint32(Ue+4)):Rn.int64AsType==="string"?t=Er.getBigInt64(Ue).toString():Rn.int64AsType==="auto"?(t=Er.getBigInt64(Ue),t>=BigInt(-2)<<BigInt(52)&&t<=BigInt(2)<<BigInt(52)&&(t=Number(t))):t=Er.getBigInt64(Ue),Ue+=8,t;case 212:if(t=Pt[Ue++],t==114)return L7(63&Pt[Ue++]);{let i=_o[t];if(i)return i.read?(Ue++,i.read(Za())):i.noBuffer?(Ue++,i()):i(Pt.subarray(Ue,++Ue));throw new Error("Unknown extension "+t)}case 213:return t=Pt[Ue],t==114?(Ue++,L7(63&Pt[Ue++],Pt[Ue++])):D0(2);case 214:return D0(4);case 215:return D0(8);case 216:return D0(16);case 217:return t=Pt[Ue++],yd>=Ue?Cg.slice(Ue-Mh,(Ue+=t)-Mh):B1e(t);case 218:return t=Er.getUint16(Ue),yd>=(Ue+=2)?Cg.slice(Ue-Mh,(Ue+=t)-Mh):U1e(t);case 219:return t=Er.getUint32(Ue),yd>=(Ue+=4)?Cg.slice(Ue-Mh,(Ue+=t)-Mh):F1e(t);case 220:return t=Er.getUint16(Ue),Ue+=2,yJ(t);case 221:return t=Er.getUint32(Ue),Ue+=4,yJ(t);case 222:return t=Er.getUint16(Ue),Ue+=2,_J(t);case 223:return t=Er.getUint32(Ue),Ue+=4,_J(t);default:if(e>=224)return e-256;if(e===void 0){let i=new Error("Unexpected end of MessagePack data");throw i.incomplete=!0,i}throw new Error("Unknown MessagePack token "+e)}}}function P7(e,t){function i(){if(i.count++>N7){let n;try{n=e.read=new Function("r","return function(){return "+(Rn.freezeData?"Object.freeze":"")+"({"+e.map(a=>a==="__proto__"?"__proto_:r()":L1e.test(a)?a+":r()":"["+JSON.stringify(a)+"]:r()").join(",")+"})}")(Za)}catch{return N7=1/0,i()}return e.read0=n,e.highByte===0&&(e.read=I7(t,e.read)),n()}let r={};for(let n=0,a=e.length;n<a;n++){let s=e[n];s==="__proto__"&&(s="__proto_"),r[s]=Za()}return Rn.freezeData?Object.freeze(r):r}return i.count=0,e.read0=i,e.highByte===0?I7(t,i):i}function P1e(){let e=I1e(()=>(Pt=null,Rn.getStructures()));return Br=Rn._mergeStructures(e,Br)}function _M(e){let t;if(e<16&&(t=uX(e)))return t;if(e>64&&D7)return D7.decode(Pt.subarray(Ue,Ue+=e));let i=Ue+e,r=[];for(t="";Ue<i;){let n=Pt[Ue++];if(128&n)if((224&n)==192){let a=(31&n)<<6|63&Pt[Ue++];a<128?r.push(65533):r.push(a)}else if((240&n)==224){let a=(31&n)<<12|(63&Pt[Ue++])<<6|63&Pt[Ue++];a<2048||a>=55296&&a<=57343?r.push(65533):r.push(a)}else if((248&n)==240){let a=(7&n)<<18|(63&Pt[Ue++])<<12|(63&Pt[Ue++])<<6|63&Pt[Ue++];a<65536||a>1114111?r.push(65533):(a>65535&&(a-=65536,r.push(a>>>10&1023|55296),a=56320|1023&a),r.push(a))}else r.push(65533);else r.push(n);r.length>=4096&&(t+=ws.apply(String,r),r.length=0)}return r.length>0&&(t+=ws.apply(String,r)),t}function yJ(e){let t=new Array(e);for(let i=0;i<e;i++)t[i]=Za();return Rn.freezeData?Object.freeze(t):t}function _J(e){if(Rn.mapsAsObjects){let t={};for(let i=0;i<e;i++){let r=D1e();r==="__proto__"&&(r="__proto_"),t[r]=Za()}return t}{let t=new Map;for(let i=0;i<e;i++)t.set(Za(),Za());return t}}function R1e(e){let t=Ue,i=new Array(e);for(let r=0;r<e;r++){let n=Pt[Ue++];if((128&n)>0)return void(Ue=t);i[r]=n}return ws.apply(String,i)}function uX(e){if(e<4){if(e<2){if(e===0)return"";{let t=Pt[Ue++];return(128&t)>1?void(Ue-=1):ws(t)}}{let t=Pt[Ue++],i=Pt[Ue++];if((128&t)>0||(128&i)>0)return void(Ue-=2);if(e<3)return ws(t,i);let r=Pt[Ue++];return(128&r)>0?void(Ue-=3):ws(t,i,r)}}{let t=Pt[Ue++],i=Pt[Ue++],r=Pt[Ue++],n=Pt[Ue++];if((128&t)>0||(128&i)>0||(128&r)>0||(128&n)>0)return void(Ue-=4);if(e<6){if(e===4)return ws(t,i,r,n);{let a=Pt[Ue++];return(128&a)>0?void(Ue-=5):ws(t,i,r,n,a)}}if(e<8){let a=Pt[Ue++],s=Pt[Ue++];if((128&a)>0||(128&s)>0)return void(Ue-=6);if(e<7)return ws(t,i,r,n,a,s);let o=Pt[Ue++];return(128&o)>0?void(Ue-=7):ws(t,i,r,n,a,s,o)}{let a=Pt[Ue++],s=Pt[Ue++],o=Pt[Ue++],l=Pt[Ue++];if((128&a)>0||(128&s)>0||(128&o)>0||(128&l)>0)return void(Ue-=8);if(e<10){if(e===8)return ws(t,i,r,n,a,s,o,l);{let h=Pt[Ue++];return(128&h)>0?void(Ue-=9):ws(t,i,r,n,a,s,o,l,h)}}if(e<12){let h=Pt[Ue++],u=Pt[Ue++];if((128&h)>0||(128&u)>0)return void(Ue-=10);if(e<11)return ws(t,i,r,n,a,s,o,l,h,u);let d=Pt[Ue++];return(128&d)>0?void(Ue-=11):ws(t,i,r,n,a,s,o,l,h,u,d)}{let h=Pt[Ue++],u=Pt[Ue++],d=Pt[Ue++],c=Pt[Ue++];if((128&h)>0||(128&u)>0||(128&d)>0||(128&c)>0)return void(Ue-=12);if(e<14){if(e===12)return ws(t,i,r,n,a,s,o,l,h,u,d,c);{let p=Pt[Ue++];return(128&p)>0?void(Ue-=13):ws(t,i,r,n,a,s,o,l,h,u,d,c,p)}}{let p=Pt[Ue++],m=Pt[Ue++];if((128&p)>0||(128&m)>0)return void(Ue-=14);if(e<15)return ws(t,i,r,n,a,s,o,l,h,u,d,c,p,m);let f=Pt[Ue++];return(128&f)>0?void(Ue-=15):ws(t,i,r,n,a,s,o,l,h,u,d,c,p,m,f)}}}}}function bJ(){let e,t=Pt[Ue++];if(t<192)e=t-160;else switch(t){case 217:e=Pt[Ue++];break;case 218:e=Er.getUint16(Ue),Ue+=2;break;case 219:e=Er.getUint32(Ue),Ue+=4;break;default:throw new Error("Expected string")}return _M(e)}function $U(e){return Rn.copyBuffers?Uint8Array.prototype.slice.call(Pt,Ue,Ue+=e):Pt.subarray(Ue,Ue+=e)}function D0(e){let t=Pt[Ue++];if(_o[t]){let i;return _o[t](Pt.subarray(Ue,i=Ue+=e),r=>{Ue=r;try{return Za()}finally{Ue=i}})}throw new Error("Unknown extension type "+t)}function D1e(){let e=Pt[Ue++];if(!(e>=160&&e<192))return Ue--,N1e(Za());if(e-=160,yd>=Ue)return Cg.slice(Ue-Mh,(Ue+=e)-Mh);if(!(yd==0&&vu<180))return UO(e);let t,i=4095&(e<<5^(e>1?Er.getUint16(Ue):e>0?Pt[Ue]:0)),r=O7[i],n=Ue,a=Ue+e-3,s=0;if(r&&r.bytes==e){for(;n<a;){if(t=Er.getUint32(n),t!=r[s++]){n=1879048192;break}n+=4}for(a+=3;n<a;)if(t=Pt[n++],t!=r[s++]){n=1879048192;break}if(n===a)return Ue=n,r.string;a-=3,n=Ue}for(r=[],O7[i]=r,r.bytes=e;n<a;)t=Er.getUint32(n),r.push(t),n+=4;for(a+=3;n<a;)t=Pt[n++],r.push(t);let o=e<16?uX(e):R1e(e);return r.string=o??UO(e)}function N1e(e){if(typeof e=="string")return e;if(typeof e=="number"||typeof e=="boolean"||typeof e=="bigint")return e.toString();if(e==null)return e+"";if(Rn.allowArraysInMapKeys&&Array.isArray(e)&&e.flat().every(t=>["string","number","boolean","bigint"].includes(typeof t)))return e.flat().toString();throw new Error("Invalid property type for record: "+typeof e)}function I1e(e){SJ&&SJ();let t=vu,i=Ue,r=BO,n=Mh,a=yd,s=Cg,o=LO,l=ym,h=Mo,u=new Uint8Array(Pt.slice(0,vu)),d=Br,c=Br.slice(0,Br.length),p=Rn,m=_m,f=e();return vu=t,Ue=i,BO=r,Mh=n,yd=a,Cg=s,LO=o,ym=l,Mo=h,Pt=u,_m=m,(Br=d).splice(0,Br.length,...c),Rn=p,Er=new DataView(Pt.buffer,Pt.byteOffset,Pt.byteLength),f}function R7(){Pt=null,ym=null,Br=null}function DIe(e){e.unpack?_o[e.type]=e.unpack:_o[e.type]=e}var D7,Pt,vu,Ue,xJ,LO,BO,Rn,Br,Cg,Mh,yd,Mo,ym,_o,Er,XU,O1e,_m,N7,wJ,SJ,bM,L1e,I7,UO,B1e,U1e,F1e,ws,O7,L7,YU,TJ,MJ,EJ,B7,WC,AJ,CJ,PJ,U7,KU,rA,NIe=k(()=>{try{D7=new TextDecoder}catch{}Ue=0,LO=xJ=[],BO=0,Rn={},Mh=0,yd=0,_o=[],XU={useRecords:!1,mapsAsObjects:!0},(O1e=new class{}).name="MessagePack 0xC1",_m=!1,N7=2,bM=class{constructor(e){e&&(e.useRecords===!1&&e.mapsAsObjects===void 0&&(e.mapsAsObjects=!0),e.sequential&&e.trusted!==!1&&(e.trusted=!0,!e.structures&&e.useRecords!=0&&(e.structures=[],e.maxSharedStructures||(e.maxSharedStructures=0))),e.structures?e.structures.sharedLength=e.structures.length:e.getStructures&&((e.structures=[]).uninitialized=!0,e.structures.sharedLength=0),e.int64AsNumber&&(e.int64AsType="number")),Object.assign(this,e)}unpack(e,t){if(Pt)return I1e(()=>(R7(),this?this.unpack(e,t):bM.prototype.unpack.call(XU,e,t)));!e.buffer&&e.constructor===ArrayBuffer&&(e=typeof Buffer<"u"?Buffer.from(e):new Uint8Array(e)),typeof t=="object"?(vu=t.end||e.length,Ue=t.start||0):(Ue=0,vu=t>-1?t:e.length),BO=0,yd=0,Cg=null,LO=xJ,Mo=null,Pt=e;try{Er=e.dataView||(e.dataView=new DataView(e.buffer,e.byteOffset,e.byteLength))}catch(i){throw Pt=null,e instanceof Uint8Array?i:new Error("Source must be a Uint8Array or Buffer but was a "+(e&&typeof e=="object"?e.constructor.name:typeof e))}if(this instanceof bM){if(Rn=this,this.structures)return Br=this.structures,HC(t);(!Br||Br.length>0)&&(Br=[])}else Rn=XU,(!Br||Br.length>0)&&(Br=[]);return HC(t)}unpackMultiple(e,t){let i,r=0;try{_m=!0;let n=e.length,a=this?this.unpack(e,n):WC.unpack(e,n);if(!t){for(i=[a];Ue<n;)r=Ue,i.push(HC());return i}if(t(a,r,Ue)===!1)return;for(;Ue<n;)if(r=Ue,t(HC(),r,Ue)===!1)return}catch(n){throw n.lastPosition=r,n.values=i,n}finally{_m=!1,R7()}}_mergeStructures(e,t){e=e||[],Object.isFrozen(e)&&(e=e.map(i=>i.slice(0)));for(let i=0,r=e.length;i<r;i++){let n=e[i];n&&(n.isShared=!0,i>=32&&(n.highByte=i-32>>5))}e.sharedLength=e.length;for(let i in t||[])if(i>=0){let r=e[i],n=t[i];n&&(r&&((e.restoreStructures||(e.restoreStructures=[]))[i]=r),e[i]=n)}return this.structures=e}decode(e,t){return this.unpack(e,t)}},L1e=/^[a-zA-Z_$][a-zA-Z\d_$]*$/,I7=(e,t)=>function(){let i=Pt[Ue++];if(i===0)return t();let r=e<32?-(e+(i<<5)):e+(i<<5),n=Br[r]||P1e()[r];if(!n)throw new Error("Record id is not defined for "+r);return n.read||(n.read=P7(n,e)),n.read()},UO=_M,B1e=_M,U1e=_M,F1e=_M,ws=String.fromCharCode,O7=new Array(4096),L7=(e,t)=>{let i=Za().map(N1e),r=e;t!==void 0&&(e=e<32?-((t<<5)+e):(t<<5)+e,i.highByte=t);let n=Br[e];return n&&(n.isShared||_m)&&((Br.restoreStructures||(Br.restoreStructures=[]))[e]=n),Br[e]=i,i.read=P7(i,r),(i.read0||i.read)()},_o[0]=()=>{},_o[0].noBuffer=!0,_o[66]=e=>{let t=e.byteLength%8||8,i=BigInt(128&e[0]?e[0]-256:e[0]);for(let r=1;r<t;r++)i<<=BigInt(8),i+=BigInt(e[r]);if(e.byteLength!==t){let r=new DataView(e.buffer,e.byteOffset,e.byteLength),n=(a,s)=>{let o=s-a;if(o<=40){let d=r.getBigUint64(a);for(let c=a+8;c<s;c+=8)d<<=BigInt(64),d|=r.getBigUint64(c);return d}let l=a+(o>>4<<3),h=n(a,l),u=n(l,s);return h<<BigInt(8*(s-l))|u};i=i<<BigInt(8*(r.byteLength-t))|n(t,r.byteLength)}return i},YU={Error,EvalError,RangeError,ReferenceError,SyntaxError,TypeError,URIError,AggregateError:typeof AggregateError=="function"?AggregateError:null},_o[101]=()=>{let e=Za();if(!YU[e[0]]){let t=Error(e[1],{cause:e[2]});return t.name=e[0],t}return YU[e[0]](e[1],{cause:e[2]})},_o[105]=e=>{if(Rn.structuredClone===!1)throw new Error("Structured clone extension is disabled");let t=Er.getUint32(Ue-4);ym||(ym=new Map);let i,r=Pt[Ue];i=r>=144&&r<160||r==220||r==221?[]:r>=128&&r<144||r==222||r==223?new Map:(r>=199&&r<=201||r>=212&&r<=216)&&Pt[Ue+1]===115?new Set:{};let n={target:i};ym.set(t,n);let a=Za();if(!n.used)return n.target=a;if(Object.assign(i,a),i instanceof Map)for(let[s,o]of a.entries())i.set(s,o);if(i instanceof Set)for(let s of Array.from(a))i.add(s);return i},_o[112]=e=>{if(Rn.structuredClone===!1)throw new Error("Structured clone extension is disabled");let t=Er.getUint32(Ue-4),i=ym.get(t);return i.used=!0,i.target},_o[115]=()=>new Set(Za()),TJ=["Int8","Uint8","Uint8Clamped","Int16","Uint16","Int32","Uint32","Float32","Float64","BigInt64","BigUint64"].map(e=>e+"Array"),MJ=typeof globalThis=="object"?globalThis:window,_o[116]=e=>{let t=e[0],i=Uint8Array.prototype.slice.call(e,1).buffer,r=TJ[t];if(!r){if(t===16)return i;if(t===17)return new DataView(i);throw new Error("Could not find typed array for code "+t)}return new MJ[r](i)},_o[120]=()=>{let e=Za();return new RegExp(e[0],e[1])},EJ=[],_o[98]=e=>{let t=(e[0]<<24)+(e[1]<<16)+(e[2]<<8)+e[3],i=Ue;return Ue+=t-e.length,Mo=EJ,(Mo=[bJ(),bJ()]).position0=0,Mo.position1=0,Mo.postBundlePosition=Ue,Ue=i,Za()},_o[255]=e=>e.length==4?new Date(1e3*(16777216*e[0]+(e[1]<<16)+(e[2]<<8)+e[3])):e.length==8?new Date(((e[0]<<22)+(e[1]<<14)+(e[2]<<6)+(e[3]>>2))/1e6+1e3*(4294967296*(3&e[3])+16777216*e[4]+(e[5]<<16)+(e[6]<<8)+e[7])):e.length==12?new Date(((e[0]<<24)+(e[1]<<16)+(e[2]<<8)+e[3])/1e6+1e3*((128&e[4]?-281474976710656:0)+1099511627776*e[6]+4294967296*e[7]+16777216*e[8]+(e[9]<<16)+(e[10]<<8)+e[11])):new Date("invalid"),B7=new Array(147);for(let e=0;e<256;e++)B7[e]=+("1e"+Math.floor(45.15-.30103*e));(WC=new bM({useRecords:!1})).unpack,WC.unpackMultiple,WC.unpack,AJ=new Float32Array(1),new Uint8Array(AJ.buffer,0,4)}),IIe=k(()=>{NIe(),nX(),hX(),l1(),b4(),o1(),CJ=[{Class:ti.prototype.constructor,type:1,write:e=>({...e}),read:e=>(Object.setPrototypeOf(e,ti.prototype),e)},{Class:Nt.prototype.constructor,type:2,write:e=>[...e],read:e=>(Object.setPrototypeOf(e,Nt.prototype),e)},{Class:As.prototype.constructor,type:3,write:e=>[...e],read:e=>(Object.setPrototypeOf(e,As.prototype),e)},{Class:NO.prototype.constructor,type:4,write:e=>e.id,read:e=>new NO(e)},{Class:E7.prototype.constructor,type:5,write:e=>e.data,read:e=>new E7(e)},{Class:Qa.prototype.constructor,type:6,write:e=>({...e}),read:e=>(Object.setPrototypeOf(e,Qa.prototype),e)}];for(let e of CJ)DIe(e);PJ=new bM({structuredClone:!0}),(U7||(U7={})).deserialize=function(e){return PJ.unpack(e)}}),OIe=k(()=>{IIe(),KU=e=>()=>{throw new Error(e+" is not available in the runtime build (decode-only CollabSerialize)")},rA={deserialize:U7.deserialize,serialize:KU("CollabSerialize.serialize"),checksum:KU("CollabSerialize.checksum")}}),Nr=k(()=>{S4(),EIe(),aX(),o1(),b4(),sX(),l1(),CIe(),PIe(),C1e(),RIe(),nX(),OIe(),S1e(),hX()});function FO(e){return e==="MouseDown"||e==="MouseUp"||e==="KeyDown"||e==="KeyUp"||e==="Collision"||e==="Trigger"}var RJ,F7,tx,qC,ZU,DJ,NJ,IJ,z7,V7,OJ,LJ,BJ,UJ,FJ,k7,G7,zJ,VJ,kJ,GJ,z1e=k(()=>{var e,t,i;Nr(),le(),(e=RJ||(RJ={})).toEventUIType=function(r){return r.type==="Conditional"?r.condition.type==="Distance"?"Distance":"StateChange":r.type},e.fromEventUIType=function(r){return r==="Distance"||r==="StateChange"?"Conditional":r},F7={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"]},(r=>{r.is=function(n){return n.type==="MouseDown"||n.type==="MouseUp"||n.type==="MousePress"||n.type==="KeyDown"||n.type==="KeyUp"||n.type==="KeyPress"},r.defaultData=function(n){return n==="MouseDown"||n==="MouseUp"||n==="MousePress"?{type:n,mode:"Object",disabled:!1,name:"",actions:new Nt}:{type:n,disabled:!1,name:"",key:void 0,actions:new Nt}}})(tx||(tx={})),(r=>{r.propertyDefaultData=function(n){return{type:"Property",value:[n??null,"position","x"]}},r.valueDefaultData={type:"Literal",value:0}})(qC||(qC={})),(t=ZU||(ZU={})).comparisonDefaultData=function(r){return{type:"Comparison",operator:"==",lOperand:qC.propertyDefaultData(r),rOperand:{...qC.valueDefaultData}}},t.distanceDefaultData=function(r){return{type:"Distance",toObject:r??null,fromObject:r??null,distance:200}},t.stateDefaultData=function(r,n){return{type:"State",object:r??null,state:n??null}},(DJ||(DJ={})).isConditionalSubActions=function(r){return r.find(n=>n==="ifActions"||n==="elseActions")!==void 0},(r=>{r.is=function(n){return n.type==="Conditional"},r.defaultData=function(n){return{type:"Conditional",disabled:!1,name:"",inActions:new Nt,outActions:new Nt,condition:ZU.distanceDefaultData(n)}}})(NJ||(NJ={})),(IJ||(IJ={})).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 Nt,drop:new Nt}},(z7||(z7={})).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 Nt},(V7||(V7={})).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},(r=>{r.is=function(n){return n.type==="MouseHover"},r.defaultData=function(){return{type:"MouseHover",disabled:!1,name:"",actions:new Nt}}})(OJ||(OJ={})),(r=>{r.is=function(n){return n.type==="Scroll"},r.defaultData=function(){return{type:"Scroll",disabled:!1,name:"",steps:100,trigger:"load",startFrom:"enter",enterAnchor:"top",startOffset:0,endAfter:400,actions:new Nt}}})(LJ||(LJ={})),(r=>{r.is=function(n){return n.type==="Start"},r.defaultData=function(){return{type:"Start",disabled:!1,name:"",actions:new Nt}}})(BJ||(BJ={})),(r=>{r.is=function(n){return n.type==="Collision"},r.defaultData=function(){return{type:"Collision",disabled:!1,name:"",target:"character",actions:new Nt}}})(UJ||(UJ={})),(r=>{r.is=function(n){return n.type==="Trigger"},r.defaultData=function(n,a){return{type:"Trigger",name:"",disabled:!1,target:"all",triggeringObjects:[],actions:new Nt,triggerZone:"box",position:a.toArray(),rotation:[0,0,0],size:n.toArray(),radius:n.length()/2,helperVisible:!0}}})(FJ||(FJ={})),(i=k7||(k7={})).defaultSizes={mobile:[480,480],tablet:[768,768],desktop:[1200,1200],custom:[769,1200]},i.is=function(r){return r.type==="Resize"},i.sizeToDevice=function(r){return typeof r=="string"?r:"custom"},i.deviceToSize=function(r){return typeof r=="string"?[...i.defaultSizes[r]]:[...r]},i.defaultData=function(){let r={size:"mobile",operator:"<",actions:new Nt},n={size:"tablet",operator:"<",actions:new Nt},a={size:[...i.defaultSizes.custom],operator:"<>",actions:new Nt},s=new Nt;return s.push({id:ht.generateUUID(),fi:0,data:r},{id:ht.generateUUID(),fi:1,data:n},{id:ht.generateUUID(),fi:2,data:a}),{type:"Resize",disabled:!1,name:"",orientation:"horizontal",breakpoints:s}},i.defaultBreakpointData=function(){return{size:[...i.defaultSizes.custom],operator:"<>",actions:new Nt}},(r=>{r.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"]},r.is=function(n){return n.type==="VariableChange"},r.defaultData=function(){return{disabled:!1,type:"VariableChange",name:"",actions:new Nt,variableId:"",objectId:null,property:"Position X"}}})(G7||(G7={})),(r=>{r.is=function(n){return n.type==="API"},r.defaultData=function(){return{disabled:!1,type:"API",name:"",successActions:new Nt,errorActions:new Nt,userAPIId:""}}})(zJ||(zJ={})),(r=>{r.is=function(n){return n.type==="WEBHOOK"},r.defaultData=function(){return{disabled:!1,type:"WEBHOOK",name:"",actions:new Nt,userWebhookId:""}}})(VJ||(VJ={})),(r=>{r.is=function(n){return n.type==="AIAssistantListener"},r.defaultData=function(){return{disabled:!1,type:"AIAssistantListener",name:"",actions:new Nt,analysis:"average",analysisRange:[0,71],analysisSingle:0}}})(kJ||(kJ={})),(r=>{r.is=function(n){return n.type==="AIAssistantTrigger"},r.defaultData=function(){return{disabled:!1,description:"",name:"",type:"AIAssistantTrigger",actions:new Nt}}})(GJ||(GJ={}))});function jJ(e){let t=typeof e;return e!==null&&(t==="object"||t==="function")}function HJ(e){return typeof e=="string"&&e.length===36&&/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(e)}var h1,Sx,V1e,eo,WJ,zc,Fg,nA,qJ,yy,ls,Vr,j7,$J,zO,VO,jv,XJ,YJ,KJ,ZJ,QJ,JJ,eee,QU,tee,iee,JU,ree,nee,aee,eF,see,tF,oee,lee,hee,uee,dee,cee,pee,mee,fee,e1,bm,Pg,H7,W7,kO,GO,jO,HO,WO,q7,$7,qO,X7,Tx,gee,iF,rF,Y7,vee,$O,yee,_ee,aA,bee,xee,wee,See,Tee,Mee,Eee,Aee,Cee,dX,k1e,ha,ra,Nb,G1e,sA,XO,Hv,K7,cX,YO,KO,Z7,hm,tI,Yn,nF,xg,Ih=k(()=>{var e,t,i,r,n,a,s,o;h1="personal camera",Sx="a218fcc3-276b-49b9-b485-49037fd14f5f",V1e=2500134,eo=5526619,(e=WJ||{}).x="x",e.y="y",e.z="z",WJ=e,(l=>{function h(c,p){return Math.pow(p[0]-c[0],2)+Math.pow(p[1]-c[1],2)}function u(c,p){return Math.sqrt(h(c,p))}function d(c,p,m){let f=l.sub(p,c),g=l.sub(m,c),v=l.dot(f,g)/l.dot(f,f),y=l.scalarMultiply(f,v);return l.add(c,y)}l.isEqual=function(c,p){return c[0]===p[0]&&c[1]===p[1]},l.lerp=function(c,p,m){return[c[0]+(p[0]-c[0])*m,c[1]+(p[1]-c[1])*m]},l.add=function(c,p){return[c[0]+p[0],c[1]+p[1]]},l.sub=function(c,p){return[c[0]-p[0],c[1]-p[1]]},l.multiply=function(c,p){return[c[0]*p[0],c[1]*p[1]]},l.divide=function(c,p){return[c[0]/p[0],c[1]/p[1]]},l.distanceSquared=h,l.distance=u,l.dot=function(c,p){return c[0]*p[0]+c[1]*p[1]},l.scalarMultiply=function(c,p){return[c[0]*p,c[1]*p]},l.projectionOnto=d,l.projectionOntoDistance=function(c,p,m){return u(c,d(c,p,m))},l.center=function(c,p){return[.5*(c[0]+p[0]),.5*(c[1]+p[1])]}})(zc||(zc={})),(t=Fg||(Fg={})).isEqual=function(l,h){return l[0]===h[0]&&l[1]===h[1]&&l[2]===h[2]},t.add=function(l,h){return[l[0]+h[0],l[1]+h[1],l[2]+h[2]]},t.sub=function(l,h){return[l[0]-h[0],l[1]-h[1],l[2]-h[2]]},t.div=function(l,h){return[l[0]/h[0],l[1]/h[1],l[2]/h[2]]},t.mul=function(l,h){return[l[0]*h[0],l[1]*h[1],l[2]*h[2]]},t.dist=function(l,h){return Math.hypot(l[0]-h[0],l[1]-h[1],l[2]-h[2])},t.lerp=function(l,h,u){return[l[0]+(h[0]-l[0])*u,l[1]+(h[1]-l[1])*u,l[2]+(h[2]-l[2])*u]},(i=nA||(nA={})).isEqual=function(l,h){return l[0]===h[0]&&l[1]===h[1]&&l[2]===h[2]&&l[3]===h[3]},i.lerp=function(l,h,u){return[l[0]+(h[0]-l[0])*u,l[1]+(h[1]-l[1])*u,l[2]+(h[2]-l[2])*u,l[3]+(h[3]-l[3])*u]},(l=>{let h=180/Math.PI,u=Math.PI/180;function d(p){return typeof p=="number"?p*h:p}function c(p){return typeof p=="number"?p*u:p}l.radToDeg=function(p){return[d(p[0]),d(p[1]),d(p[2])]},l.degToRad=function(p){return[c(p[0]),c(p[1]),c(p[2])]}})(qJ||(qJ={})),(r=yy||(yy={})).identity=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],r.isEqual=function(l,h){for(let u=0;u<16;u++)if(l[u]!==h[u])return!1;return!0},r.simplify=function(l){return l??r.identity},r.applyMatrix4=function(l,h){let u=h.slice(0);for(let d=0,c=h.length;d<c;d+=3){let p=l[3]*h[d]+l[7]*h[d+1]+l[11]*h[d+2]+l[15];u[d]=(l[0]*h[d]+l[4]*h[d+1]+l[8]*h[d+2]+l[12])/p,u[d+1]=(l[1]*h[d]+l[5]*h[d+1]+l[9]*h[d+2]+l[13])/p,u[d+2]=(l[2]*h[d]+l[6]*h[d+1]+l[10]*h[d+2]+l[14])/p}return u},(n=ls||(ls={})).isRGB=function(l){return typeof l=="object"&&typeof l.r=="number"&&typeof l.g=="number"&&typeof l.b=="number"},n.white={r:1,g:1,b:1},n.red={r:1,g:0,b:0},n.black={r:0,g:0,b:0},n.toRgb255a1=function(l){return{r:Math.round(255*l.r),g:Math.round(255*l.g),b:Math.round(255*l.b),a:1}},n.clone=function(l){return{r:l.r,g:l.g,b:l.b}},n.fromHex=function(l){return{r:((l=Math.floor(l))>>16&255)/255,g:(l>>8&255)/255,b:(255&l)/255}},n.toHex=function(l){return 65536*Math.round(255*l.r)+256*Math.round(255*l.g)+Math.round(255*l.b)},n.equals=function(l,h){return l.r===h.r&&l.g===h.g&&l.b===h.b},n.equalsFixed=function(l,h){return l.r.toFixed(2)===h.r.toFixed(2)&&l.g.toFixed(2)===h.g.toFixed(2)&&l.b.toFixed(2)===h.b.toFixed(2)},n.lerp=function(l,h,u){return{r:l.r+(h.r-l.r)*u,g:l.g+(h.g-l.g)*u,b:l.b+(h.b-l.b)*u}},n.is=function(l){return!!jJ(l)&&"r"in l&&"g"in l&&"b"in l&&!("a"in l)},(a=Vr||(Vr={})).white={...ls.white,a:1},a.is=function(l){return!!jJ(l)&&"r"in l&&"g"in l&&"b"in l&&"a"in l},a.transparent={...ls.white,a:0},a.from0to1=function(l){return{r:l[0],g:l[1],b:l[2],a:l[3]}},a.fromHexAndA=function(l,h){return{...ls.fromHex(l),a:h}},a.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}},a.equals=function(l,h){return ls.equals(l,h)&&l.a===h.a},a.equalsFixed=function(l,h){return ls.equalsFixed(l,h)&&l.a.toFixed(2)===h.a.toFixed(2)},a.lerp=function(l,h,u){return{r:l.r+(h.r-l.r)*u,g:l.g+(h.g-l.g)*u,b:l.b+(h.b-l.b)*u,a:l.a+(h.a-l.a)*u}},a.toStyle=function({r:l,g:h,b:u,a:d}=a.white){return`rgba(${255*l}, ${255*h}, ${255*u}, ${d})`},(j7||(j7={})).identity={position:[0,0,0],rotation:[0,0,0],scale:[1,1,1],pivot:[0,0,0],pivotRotation:[0,0,0]},(s=$J||{})[s.LINEAR=0]="LINEAR",s[s.EASE=1]="EASE",s[s.EASE_IN=2]="EASE_IN",s[s.EASE_OUT=3]="EASE_OUT",s[s.EASE_IN_OUT=4]="EASE_IN_OUT",s[s.CUBIC=5]="CUBIC",s[s.SPRING=6]="SPRING",s[s.ARC=7]="ARC",s[s.NONE=8]="NONE",$J=s,(zO||(zO={})).defaultData={mass:1,stiffness:80,damping:10,velocity:0},(VO||(VO={})).defaultData={control1:[.5,0],control2:[.5,1]},(o=jv||(jv={})).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]}),LIe=k(()=>{var e,t;Nr(),z1e(),(XJ||(XJ={})).defaultData={type:"SwitchCamera",name:"",targetCamera:"",delay:0,animate:!0,duration:1e3,easing:4,runMode:"Normal"},(YJ||(YJ={})).defaultData={type:"SceneTransition",name:"",target:"",delay:0,duration:1,transition:"none"},(KJ||(KJ={})).defaultData={type:"Link",name:"",url:null,context:"tab"},(ZJ||(ZJ={})).defaultData={type:"Destroy",name:"",objects:[],delay:0},(QJ||(QJ={})).defaultData={type:"Particles",name:"",emitterObjectId:"",delay:0,emission:"start",triggerAfter:"any"},(JJ||(JJ={})).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"},(eee||(eee={})).defaultData={type:"Reset",name:"",delay:0},(QU||(QU={})).defaultData={interaction:"play",delay:0,volume:.5,loop:1},(e=tee||(tee={})).pauseDefaultData={interaction:"pause",delay:0},e.stopDefaultData={interaction:"stop",delay:0},(t=iee||(iee={})).defaultData={type:"Audio",name:"",...QU.defaultData},t.hasAudioByActions=i=>i.some(({data:r})=>r.type==="Audio"&&r.interaction==="play"&&r.audio),t.hasAudioByEvents=i=>{for(let{data:r}of i)if(tx.is(r)||r.type==="Start"||r.type==="Collision"){if(t.hasAudioByActions(r.actions))return!0}else if(r.type==="Conditional"){if(t.hasAudioByActions(r.inActions)||t.hasAudioByActions(r.outActions))return!0}else if(r.type==="GameControl"&&Object.values(r.gameActions).find(n=>t.hasAudioByActions(n)))return!0},t.getAudiosByActions=i=>{let r=[];return i.forEach(n=>{let a=n.data;a.type==="Audio"&&a.interaction==="play"&&a.audio&&r.push(n),a.type==="Conditional"&&(r.push(...t.getAudiosByActions(a.ifActions)),r.push(...t.getAudiosByActions(a.elseActions)))}),r},t.getAudiosByEvents=i=>{let r=[];return i.forEach(({data:n})=>{tx.is(n)||n.type==="Collision"||n.type==="Start"||n.type==="Trigger"?r.push(...t.getAudiosByActions(n.actions)):n.type==="Conditional"?(r.push(...t.getAudiosByActions(n.inActions)),r.push(...t.getAudiosByActions(n.outActions))):n.type==="GameControl"?Object.values(n.gameActions).forEach(a=>{r.push(...t.getAudiosByActions(a))}):n.type==="DragDrop"&&(r.push(...t.getAudiosByActions(n.dragDropActions.drag)),r.push(...t.getAudiosByActions(n.dragDropActions.drop)))}),r},(JU||(JU={})).defaultData={interaction:"play",delay:0,volume:.5,loop:1/0},(i=>{i.pauseDefaultData={interaction:"pause",delay:0},i.stopDefaultData={interaction:"stop",delay:0}})(ree||(ree={})),(i=>{i.defaultData={type:"Video",name:"",triggerAfter:"autoplay",...JU.defaultData},i.hasVideoByActions=r=>r.some(({data:n})=>n.type==="Video"&&n.interaction==="play"&&n.layerId),i.hasVideoByObject=r=>{if(r.events){for(let{data:n}of r.events)if((tx.is(n)||n.type==="Start")&&i.hasVideoByActions(n.actions))return!0}},i.getVideosByActions=r=>{let n=[];return r.forEach(a=>{let s=a.data;s.type==="Video"&&s.interaction==="play"&&s.layerId&&n.push(a)}),n},i.getVideosByEvents=r=>{let n=[];return r.forEach(({data:a})=>{(tx.is(a)||a.type==="Start")&&n.push(...i.getVideosByActions(a.actions))}),n}})(nee||(nee={})),(aee||(aee={})).defaultData=function(i){return{state:i,repeat:0,delay:0,delayDirection:"start-once",direction:"normal",duration:1e3,easing:4}},(eF||(eF={})).defaultData=function(){return{tweens:new Nt,repeat:0,delay:0,delayDirection:"start-once",direction:"normal"}},(see||(see={})).defaultData=function(i){return{type:"Transition",name:"",runMode:"Once",object:i??null,...eF.defaultData()}},(tF||(tF={})).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}})(oee||(oee={})),(lee||(lee={})).defaultData=function(i){return{type:"TimelineAnimation",name:"",...tF.defaultData(i)}},(hee||(hee={})).defaultData=function(i,r,n){return{type:"Animation",name:"",object:i,clipId:r,crop:n,crop2:n,repeat:-1,delay:0,delayDirection:"start-once",direction:"normal",runMode:"Normal"}},(uee||(uee={})).defaultData={type:"SetVariable",name:"",variableId:"",expression:[]},(dee||(dee={})).defaultData=()=>({type:"Conditional",name:"",ifActions:new Nt,elseActions:new Nt,condition:[]}),(cee||(cee={})).defaultData={type:"DynamicVariablePlay",name:"",variableId:"",mode:"PlayPause",delay:0,pauseDelay:0},(pee||(pee={})).defaultData={type:"ClearLocalStorage",name:"",target:"all"},(mee||(mee={})).defaultData={name:"",type:"UserAPI"}}),BIe=k(()=>{var e;(e=fee||(fee={})).emptyAudio={data:Uint8Array.from(atob("UklGRjIAAABXQVZFZm10IBIAAAABAAEAQB8AAEAfAAABAAgAAABmYWN0BAAAAAAAAABkYXRhAAAAAA=="),t=>t.charCodeAt(0)),mimeType:"audio/wav",filename:"unknown"},e.maxSize=2e6}),j1e=k(()=>{var e;(e=e1||(e1={})).all=["PerspectiveCamera","OrthographicCamera"],e.is=function(t){return e.all.includes(t)},(t=>{t.DefaultUp=[0,1,0],t.DefaultTargetOffset=1e3,t.MinTargetOffset=.001,t.sanitizeTargetOffset=function(a){return a===void 0||!Number.isFinite(a)||a<t.MinTargetOffset?t.DefaultTargetOffset:a},t.DefaultAzimuth=-24,t.DefaultElevation=15;let i=t.DefaultAzimuth*Math.PI/180,r=t.DefaultElevation*Math.PI/180,n=180/Math.PI;t.DefaultPosition=[t.DefaultTargetOffset*Math.sin(i)*Math.cos(r),t.DefaultTargetOffset*Math.sin(r),t.DefaultTargetOffset*Math.cos(i)*Math.cos(r)],t.DefaultRotation=[Math.atan2(-Math.sin(r),Math.cos(i)*Math.cos(r))*n,Math.asin(Math.sin(i)*Math.cos(r))*n,Math.atan2(Math.sin(i)*Math.sin(r),Math.cos(i))*n],t.defaultData={far:1e5,type:"PerspectiveCamera",perspective:{near:70,fov:45,zoom:1},orthographic:{near:-1e5,zoom:1},up:t.DefaultUp,isUpVectorFlipped:!1,targetOffset:t.DefaultTargetOffset},t.getZoom=function(a){return a.type==="PerspectiveCamera"?a.perspective?.zoom??1:a.orthographic?.zoom??1}})(bm||(bm={}))}),H1e=k(()=>{var e;(e=Pg||(Pg={})).defaultData=function(t,i=.1){return{disabled:!1,type:"linear",hideBase:!1,instanced:!1,count:3,radial:{radius:2*Math.max(typeof t[0]=="number"?t[0]:1,typeof t[1]=="number"?t[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 t[0]=="number"?t[0]+t[0]:1)*i,0,0],pivot:[0,0,0],pivotRotation:[0,0,0]},grid:{count:[2,2,2],size:t.map(r=>(typeof r=="number"?r: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"}}},e.merge=function(t,i){let r={...t};if(W7.forEach(n=>{Object.assign(r,{[n]:i[n]??t[n]})}),r.radial={...t.radial},i.radial){let n=t.radial,a=i.radial;kO.forEach(s=>{Object.assign(r.radial,{[s]:a[s]??n[s]})})}if(r.linear={...t.linear},i.linear){let n=t.linear,a=i.linear;GO.forEach(s=>{Object.assign(r.linear,{[s]:a[s]??n[s]})})}if(r.grid={...t.grid},i.grid){let n=t.grid,a=i.grid;jO.forEach(s=>{Object.assign(r.grid,{[s]:a[s]??n[s]})})}if(r.toObject={...t.toObject},i.toObject){let n=t.toObject,a=i.toObject;HO.forEach(s=>{Object.assign(r.toObject,{[s]:a[s]??n[s]})})}if(r.randomnessObject={...t.randomnessObject},i.randomnessObject){let n=t.randomnessObject,a=i.randomnessObject;WO.forEach(s=>{Object.assign(r.randomnessObject,{[s]:a[s]??n[s]})})}return r},e.isPartial=function(t){return!(!t.randomnessObject&&!t.toObject)},(t=>{t.defaultData={radial:{},linear:{},grid:{},toObject:{},randomnessObject:{}};let i=["radial","linear","grid","toObject","randomnessObject"];t.toOps=function(r,n){let a=[];r.count!==void 0&&a.push({type:0,path:n,props:{count:r.count}});for(let s of i){let o=r[s];o&&Object.keys(o).length>0&&a.push({type:0,path:[...n,s],props:o})}return a}})(H7||(H7={})),W7=["count"],kO=["radius","start","end","position","scale","rotation"],GO=["position","scale","rotation"],jO=["count","size"],HO=["count","position","scale","rotation"],WO=["strength","scale","rotation","position","movement","seed","freqScale"]}),W1e=k(()=>{var e;Ih(),(e=q7||(q7={})).all=["PointLight","SpotLight","DirectionalLight","HemisphereLight"],e.is=function(t){return e.all.includes(t)},($7||($7={})).defaultData=function(t){return function(i){if(i==="PointLight")return{type:i,color:Vr.white,intensity:1,distance:2e3,decay:1,shadows:!0,shadowResolution:1024,shadowRadius:1,penumbraSize:.5,depth:1e5};if(i==="SpotLight")return{type:i,color:Vr.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:Vr.white,intensity:1,shadows:!0,size:2e3,depth:1e5,penumbraSize:.5,shadowResolution:1024,shadowRadius:1};throw new Error("not implemented")}(t)}}),q1e=k(()=>{var e;(e=qO||(qO={})).defaultShapeData={type:"PlaneEmitterShape",size:[100,100,100]},e.defaultCollisionData={colliderEntityId:null,collisionBounce:.75},e.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:e.defaultShapeData,autoPlay:!0,emitTimeDelay:0,emitTimeCycle:"infinity",emitTimeDuration:1,...e.defaultCollisionData}}),$1e=k(()=>{var e;(e=X7||(X7={})).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},e.regenProps=["hairLength","spreadRadius","guideStrands","headShape","baseObjectId"]}),pX=k(()=>{(Tx||(Tx={})).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]}}),X1e=k(()=>{var e,t;(e=gee||{})[e.Front=0]="Front",e[e.Back=1]="Back",e[e.Double=2]="Double",gee=e,(t=iF||(iF={})).defaultData={castShadow:!0,receiveShadow:!0},t.equals=function(i,r){return i.castShadow===r.castShadow&&i.receiveShadow===r.receiveShadow},(i=>{i.defaultData={flatShading:!1,wireframe:!1,side:0},i.equals=function(r,n){return r.flatShading===n.flatShading&&r.side===n.side&&r.wireframe===n.wireframe&&(r.shadowCatcher??!1)===(n.shadowCatcher??!1)}})(rF||(rF={})),(Y7||(Y7={})).defaultData={...rF.defaultData,...iF.defaultData},(vee||(vee={})).getMaterialData=function(i,r){let n=[];if("material"in i){let a=typeof i.material=="string"?r.materials[i.material]??r.lib.materials[i.material]?.asset:i.material;a&&n.push(a)}else if("materials"in i)for(let a of i.materials){let s=typeof a=="string"?r.materials[a]??r.lib.materials[a]?.asset:a;s&&n.push(s)}return n}}),Y1e=k(()=>{var e;(e=$O||($O={})).defaultVideo={data:"",thumb:"/_assets/_videos/catThumb.png",type:"video",name:"Cat video"},e.maxSize=3e7}),T4=k(()=>{var e,t,i,r;Nr(),Ih(),Y1e(),Ih(),(yee||(yee={})).is=function(n){return n==="texture"||n==="video"||n==="color"||n==="depth"||n==="normal"||n==="gradient"||n==="noise"||n==="fresnel"||n==="cavity"||n==="dust"||n==="rainbow"||n==="toon"||n==="outline"||n==="particle"||n==="transmission"||n==="reflection"||n==="matcap"||n==="displace"||n==="pattern"||n==="vertexColor"||n==="light"},(_ee||(_ee={})).is=function(n){return n==="luminance"||n==="r"||n==="g"||n==="b"||n==="a"},(aA||(aA={})).is=function(n){return typeof n=="object"&&n!==null&&n.image!=null},(bee||(bee={})).is=function(n){return n==="phong"||n==="toon"||n==="lambert"||n==="physical"},(r=xee||{})[r.Linear=0]="Linear",r[r.Radial=1]="Radial",r[r.Polar=2]="Polar",xee=r,wee=(n=>(n[n.RepeatWrapping=1e3]="RepeatWrapping",n[n.ClampToEdgeWrapping=1001]="ClampToEdgeWrapping",n[n.MirroredRepeatWrapping=1002]="MirroredRepeatWrapping",n))(wee||{}),See=(n=>(n[n.NearestFilter=1003]="NearestFilter",n[n.LinearFilter=1006]="LinearFilter",n[n.LinearMipmapLinearFilter=1008]="LinearMipmapLinearFilter",n))(See||{}),(i=Tee||{})[i.UV=0]="UV",i[i.Planar=1]="Planar",i[i.Spherical=2]="Spherical",i[i.Cylindrical=3]="Cylindrical",i[i.Triplanar=4]="Triplanar",Tee=i,(t=Mee||{})[t.Simplex=0]="Simplex",t[t.SimplexFractal=1]="SimplexFractal",t[t.Ashima=2]="Ashima",t[t.Fbm=3]="Fbm",t[t.Perlin=4]="Perlin",t[t.Voronoi=5]="Voronoi",Mee=t,(e=Eee||{})[e.F1=0]="F1",e[e.F2=1]="F2",e[e.F2MinusF1=2]="F2MinusF1",e[e.SmoothBlend=3]="SmoothBlend",e[e.Edge=4]="Edge",e[e.Power=5]="Power",e[e.Lines=6]="Lines",e[e.Cells=7]="Cells",Eee=e,Aee=(n=>(n[n.Lights=0]="Lights",n[n.Static=1]="Static",n[n.Camera=2]="Camera",n))(Aee||{}),Cee=(n=>(n[n.Circle=0]="Circle",n[n.Ring=1]="Ring",n[n.Polygon=2]="Polygon",n[n.Cross=3]="Cross",n[n.Diamond=4]="Diamond",n[n.Checkerboard=5]="Checkerboard",n[n.Line=6]="Line",n[n.Wave=7]="Wave",n))(Cee||{}),dX=["mode","gradientType","noiseType","tracingMode","mirror","displacementType","projection","cnormal","crop","axis","side","roughnessMapChannel","metalnessMap","metalnessMapChannel","normalMap","aoMap","aoMapChannel","emissiveMap","style"],k1e=["wrapping","image","video","name","minFilter","magFilter"],(n=>{n.patch=function(a,s){let{texture:o,...l}=s;if(Object.assign(a,l),o){let h=a.texture;h&&Object.assign(h,o)}},n.defaultColorLayer=function(a){return{...n.defaultData("color"),color:a}},n.defaultData=function(a,s){return a==="light"&&s?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}}}(s):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:$O.defaultVideo,wrapping:1001,repeat:[1,1],offset:[0,0],rotation:0,minFilter:1008,magFilter:1006},crop:!1};case"color":return{...l,type:"color",color:ls.fromHex(eo)};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:{...ls.fromHex(6710886),a:1},colorB:{...ls.fromHex(6710886),a:1},colorC:{...ls.fromHex(16777215),a:1},colorD:{...ls.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:Vr.fromHexAndA(16777215,1),bias:.1,scale:1,intensity:2,factor:1};case"dust":return{...l,type:"dust",color:Vr.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:Vr.fromHexAndA(0,0),offset:[0,0,0]};case"outline":return{...l,type:"outline",outlineColor:Vr.fromHexAndA(0,1),contourColor:Vr.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:{...ls.fromHex(0),a:1},colorB:{...ls.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}}}(a)}})(ha||(ha={})),(n=>{function a(s,o="layer1",l="layer2",h=ls.fromHex(16777215)){let u=new Nt;return u.push({fi:0,data:ha.defaultData("light",s),id:o}),u.push({fi:1,data:ha.defaultData("color"),id:l}),{layers:u}}n.isMergable=function(s){return!s.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")},n.getHash=function(s){let o="";return s.layers.forEach(l=>{Object.entries(l.data).forEach(([h,u])=>{o+=`${h}${u}`,Array.isArray(u)?u.forEach(d=>o+=`${d}`):typeof u=="object"?Object.values(u).forEach(d=>{o+=typeof d=="number"?`${d.toFixed(4)}`:`${d}`}):o+=`${u}`})}),o},n.defaultEmptyData=function(){return{layers:new Nt}},n.defaultData=function(s="layer1",o="layer2"){return a("physical",s,o)},n.withName=function(s,o){return{...s,name:o}},n.defaultTwoLayerData=a,n.defaultColorMaterial=function(s,o,l="layer1",h="layer2"){let u=new Nt;return u.push({fi:0,data:ha.defaultData("light",o),id:l}),u.push({fi:1,data:ha.defaultColorLayer(s),id:h}),{layers:u}},n.defaultUIObjectMaterial=function(s){let o=ha.defaultData("texture");s&&Object.assign(o.texture,{image:s});let l=new Nt;return l.push({fi:0,data:o,id:"layer1"}),l.push({fi:1,data:{...ha.defaultData("transmission"),alpha:1},id:"layer2"}),l.push({fi:2,data:{...ha.defaultData("light","lambert"),alpha:0},id:"layer3"}),{layers:l}},n.defaultTwoLayerTextureData=function(s,o="physical",l="layer1",h="layer2"){let u=ha.defaultData("texture");Object.assign(u.texture,{image:s});let d=new Nt;return d.push({fi:0,data:u,id:l}),d.push({fi:1,data:ha.defaultData("light",o),id:h}),{layers:d}},n.defaultTwoLayerVideoTextureData=function(s,o="physical",l="layer1",h="layer2"){let u=ha.defaultData("video");Object.assign(u.texture,{video:s});let d=new Nt;return d.push({fi:0,data:u,id:l}),d.push({fi:1,data:ha.defaultData("light",o),id:h}),{layers:d}}})(ra||(ra={}))}),UIe=k(()=>{Nb="Roboto_regular",G1e="https://fonts.gstatic.com/s/roboto/v30/KFOmCnqEu92Fr1Me5WZLCzYlKw.ttf"}),K1e=k(()=>{Nr(),(sA||(sA={})).defaultData=function(){return{points:new Nt,roundness:0,shapeHoles:[],isClosed:!1}}}),Z1e=k(()=>{Nr(),(XO||(XO={})).defaultData=function(){return{points:new Nt,lastInsertionPlane:null,subdivisions:12,isClosed:!1,subdivisionMode:"parametric"}},Hv={type:"Ellipse",width:50,height:50,spikes:16,angle:360,innerRadius:0},(K7||(K7={})).merge=function(e,t){let i={...e};return YO.forEach(r=>{Object.assign(i,{[r]:t[r]??e[r]})}),i},cX={shape:Hv,depth:1,offset:0,bevel:50,bevelSides:6,angle:0,twist:0,startScale:1,endScale:1,capType:"flat"},YO=["depth","offset","angle","twist","startScale","endScale"]}),mX=k(()=>{var e,t;K1e(),Z1e(),(e=KO||(KO={})).is2DParametricMesh=function(i){return i==="PolygonGeometry"||i==="RectangleGeometry"||i==="StarGeometry"||i==="TriangleGeometry"||i==="EllipseGeometry"||i==="UIGeometry"},e.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"},e.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"},(Z7||(Z7={})).merge=function(i,r){let n={...i};return Object.assign(n,r),n.type==="PathGeometry"&&"extrusion"in r&&r.extrusion&&(n.extrusion={...i.extrusion},Object.assign(n.extrusion,K7.merge(n.extrusion,r.extrusion))),n},(t=hm||(hm={})).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:XO.defaultData(),extrusion:cX};if(i==="VectorGeometry")return{width:1,height:1,type:i,subdivisions:12,shape:sA.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};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{...t.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")},tI=["width","height","depth"]}),Q1e=k(()=>{Ih(),(e=>{function t(i){return i.mode??"linear"}e.defaultData={enabled:!1,useBackgroundColor:!1,color:ls.white,near:.1,far:2e3,mode:"linear",density:.005,heightFalloff:.01,heightBase:0},e.getMode=t,e.getModeIndex=function(i){let r=t(i);return r==="height"?1:r==="both"?2:0},e.getDensity=function(i){return i.density??e.defaultData.density},e.getHeightFalloff=function(i){return i.heightFalloff??e.defaultData.heightFalloff},e.getHeightBase=function(i){return i.heightBase??e.defaultData.heightBase}})(Yn||(Yn={}))}),fX=k(()=>{(nF||(nF={})).defaultData={image:null,rotation:0,blur:32,showBackground:!0},(xg||(xg={})).defaultData={enabled:!1,mode:"hdri",hdri:nF.defaultData,timeOfDay:10,weather:"partlyCloudy",lighting:!0,lightingIntensity:1,lightingQuality:"full",clouds:!0,windSpeed:2,animateWind:!0,exposure:1,seed:2}});function FIe(e){let t=typeof e=="string"?Number.parseInt(e,10):e;return typeof t=="number"&&Number.isFinite(t)?Math.min(5,Math.max(0,Math.round(t))):3}var oA,_y,aF,sF,oF,Mx,lF,Q7,J7,Pee,j1,J1e,ns,ZO,Ree,Dee,Nee,Iee,bc,fE,QO,JO,xm,by,Oee,Rg,eL,wm,hF,uF,ey,tw,ty,gE,eH,Lee,Ao,dF,Bee,Uee,um,gu,Ex,tH,tL,iL,e_e=k(()=>{(()=>{let e={opacity:1,blendFunction:13,enabled:!1};(oA||(oA={})).defaultData={enabled:!1,pixelation:{...e,blendFunction:16,granularity:15},bloom:{...e,blendFunction:16,intensity:1,blurScale:1,luminanceThreshold:.25,luminanceSmoothing:.025,kernelSize:3},chromaticAberration:{...e,offset:[2,2]},vignette:{...e,darkness:1,offset:0},hueSaturation:{...e,hue:3,saturation:0},brightnessContrast:{...e,brightness:.25,contrast:0},depthOfField:{...e,focusDistance:100,focalLength:20,bokehScale:5},noise:{...e,blendFunction:16}}})()}),gX=k(()=>{var e;Q1e(),fX(),e_e(),Ih(),(e=_y||(_y={})).defaultData={type:"normal",softShadowQuality:"low"},e.isSoft=function(t){return t!=null&&(t.type===void 0||t.type==="soft")},(aF||(aF={})).defaultData={enabled:!0,color:{r:.8274509803921568,g:.8274509803921568,b:.8274509803921568},intensity:.75},(sF||(sF={})).defaultData={occlusion:!1,aoFullRes:!1,radius:256,bias:.5,aoColor:{r:.19607843137254902,g:.19607843137254902,b:.19607843137254902}},(t=>{t.defaultData={pipeline:"classic",toneMapping:"aces",exposure:1},t.isUntouched=function(i){return i===void 0||i.pipeline==="classic"&&(i.toneMapping==="none"||i.toneMapping==="aces")&&i.exposure===1}})(oF||(oF={})),(Mx||(Mx={})).defaultData={usePhysics:!1,gravity:-10},(lF||(lF={})).defaultData={playCamera:h1,gameControlObject:null},(Q7||(Q7={})).defaultData={backgroundColor:Vr.fromHexAndA(V1e,1),postprocessing:oA.defaultData,fog:Yn.defaultData,sky:xg.defaultData,globalPhysics:Mx.defaultData,ambient:aF.defaultData,ao:sF.defaultData,shadow:_y.defaultData,publish:lF.defaultData,grading:oF.defaultData}}),zIe=k(()=>{(J7||(J7={})).defaultData={colliderType:"box",size:[100,100,100],colliderHelperVisible:!0,forceType:"collider",forceRange:"global",forceIntensity:.5,forceDambing:.95}}),M4=k(()=>{var e,t,i;Nr(),j1e(),W1e(),q1e(),$1e(),pX(),X1e(),Ih(),T4(),mX(),H1e(),Js(),gX(),zIe(),(e=Pee||(Pee={})).isComponentRelated=function(r){return r==="Component"||r==="Instance"},e.isEmptyOrComponent=function(r){return r==="Empty"||r==="Instance"},(t=j1||(j1={})).identity={...j7.identity,hiddenMatrix:yy.identity},t.fromObject=function(r){return{position:r.position,rotation:r.rotation,scale:r.scale,pivot:r.pivot,pivotRotation:r.pivotRotation,hiddenMatrix:r.hiddenMatrix}},t.merge=function(r,n){return{position:n?.position||r.position,rotation:n?.rotation||r.rotation,pivot:n?.pivot||r.pivot,pivotRotation:n?.pivotRotation||r.pivotRotation,scale:n?.scale||r.scale,hiddenMatrix:n?.hiddenMatrix||r.hiddenMatrix}},t.diff=function(r,n){return _1e({position:Fg.isEqual(r.position,n.position)?void 0:n.position,rotation:Fg.isEqual(r.rotation,n.rotation)?void 0:n.rotation,scale:Fg.isEqual(r.scale,n.scale)?null:n.scale,hiddenMatrix:yy.isEqual(r.hiddenMatrix,n.hiddenMatrix)?void 0:n.hiddenMatrix})},J1e=["slide","offset"],(ns||(ns={})).defaultData={states:new Nt,events:new Nt,timelineAnimations:new ti,visible:!0,raycastLock:!1,physics:Tx.defaultData,pathSnapping:{pathId:null,slide:0,offset:0,orientation:"tangential"},...j1.identity,cloner:null},(ZO||(ZO={})).defaultData={type:"Empty",...ns.defaultData},(Ree||(Ree={})).defaultData={type:"ParticleCollider",...J7.defaultData,...ns.defaultData},(Dee||(Dee={})).defaultData={type:"Component",...ns.defaultData},(Nee||(Nee={})).defaultData={type:"Particle",...ns.defaultData,...qO.defaultData},(Iee||(Iee={})).defaultData={type:"Hair",...ns.defaultData,...X7.defaultData},(bc||(bc={})).defaultData={type:"Mesh",...ns.defaultData,...Y7.defaultData},(fE||(fE={})).defaultData={...ns.defaultData,...j1.identity,position:bm.DefaultPosition,rotation:bm.DefaultRotation,...bm.defaultData},(r=>{r.defaultData=function(n){return{...ns.defaultData,...$7.defaultData(n)}},r.defaultDirectionalLightData={...r.defaultData("DirectionalLight"),position:[200,300,300],name:"Directional Light",intensity:.7}})(QO||(QO={})),(r=>{function n(a,s,o=0){for(;o<s.length;){let l=a?a[s[o]]:void 0;if(s.length===o+1)return l;if(!l)return;a=l.descendants,o+=1}}r.resolveWithDes=n,r.resolve=function(a,s,o=0){let l=n(a,s,o);if(l){let h=Object.keys(l);if(h.length===1&&h[0]==="descendants")return}return l}})(JO||(JO={})),(r=>{function n(a,s){return{...ns.defaultData,...s,component:a,overrides:new Qa,physics:void 0,events:void 0,type:"Instance"}}r.rootOverrideProps=["physics","events"],r.compositeNonOptionalOverrideProps=["geometry"],r.compositeEntireOverrideOverrideProps=["material"],r.ofComponent=n,r.fromComponentData=function(a){let s=j1.fromObject(a.data);return n(a.id,s)}})(xm||(xm={})),(r=>{r.defaultData={type:"Page",...ns.defaultData,physics:{...Tx.defaultData,fusedBody:!1},...Q7.defaultData,camera:fE.defaultData},r.isUIPage=function(n){return n.uiScene!==void 0}})(by||(by={})),(i=Oee||(Oee={})).defaultCamera={position:[0,0,1e3],scale:[1,1,1],rotation:[0,0,0],pivot:[0,0,0],pivotRotation:[0,0,0],hiddenMatrix:yy.identity,name:"Play Camera",visible:!0,raycastLock:!1,physics:Tx.defaultData,states:new Nt,events:new Nt,timelineAnimations:new ti,cloner:null,pathSnapping:{pathId:null,orientation:"tangential",slide:0,offset:0},...bm.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",...ns.defaultData,...bc.defaultData,geometry:hm.defaultData("RectangleGeometry"),material:ra.defaultTwoLayerData("physical","layer1","layer2")},i.defaultBooleanObject={name:"Boolean",...ns.defaultData,...bc.defaultData,geometry:hm.defaultData("BooleanGeometry"),material:ra.defaultTwoLayerData("physical","layer1","layer2")},i.defaultShapeBlendObject={name:"Shape Blend",...ns.defaultData,...bc.defaultData,geometry:hm.defaultData("ShapeBlendGeometry"),material:ra.defaultTwoLayerData("physical","layer1","layer2")},i.defaultTextObject={name:"Text",...ns.defaultData,...bc.defaultData,geometry:hm.defaultData("TextGeometry"),material:ra.defaultTwoLayerData("physical","layer1","layer2")},i.defaultInputObject={name:"Input",...ns.defaultData,...bc.defaultData,geometry:hm.defaultData("InputGeometry"),material:ra.defaultTwoLayerData("physical","layer1","layer2")},(r=>{r.newEmpty=function(n,a){let s={name:a};return n.type==="Mesh"?(s.geometry={},"material"in n&&(s.material={layers:new Qa}),"materials"in n&&(s.materials=n.materials.map(o=>({layers:new Qa})))):e1.is(n.type)&&(s.perspective={},s.orthographic={}),s},r.toOps=function(n,a){let s,o=[],l={orthographic:0,perspective:0,geometry:0};function h(u,d){for(let[c,p]of Object.entries(d.layers)){let{texture:m,...f}=p;if(m!==void 0&&Object.keys(m).length>0){let g={path:[...u,"layers",c,"texture"],props:m,type:0};o.push(g)}if(Object.keys(f).length>0){let g={path:[...u,"layers",c],props:f,type:0};o.push(g)}}}for(let[u,d]of Object.entries(a)){let c=d;if(u!=="name")if(u==="cloner")o.push(...H7.toOps(c,["cloner"]));else if(u==="pathSnapping")o.push({path:[u],props:{slide:c.slide,offset:c.offset},type:0});else if(u==="material")h(["material"],c);else if(u==="materials")for(let[p,m]of Object.entries(c))h(["materials",p],m);else if(l[u]===0){if(u==="geometry"&&c.extrusion!==void 0){let p={path:[u,"extrusion"],props:c.extrusion,type:0};o.push(p),c={...c},delete c.extrusion}if(Object.keys(c).length>0){let p={path:[u],props:c,type:0};o.push(p)}}else s===void 0&&(s={path:[],props:{},type:0},o.push(s)),s.props[u]=c}return o},r.patch=function(n,a){if(a===void 0)return n;let s={...n};if(Object.assign(s,j1.merge(s,a)),Object.assign(s,{pathSnapping:Object.assign({},s.pathSnapping,{slide:a.pathSnapping?.slide??s.pathSnapping?.slide??0,offset:a.pathSnapping?.offset??s.pathSnapping?.offset??0})}),e1.is(n.type)){s.orthographic={...s.orthographic},s.perspective={...s.perspective};let o=a;o.orthographic?.zoom!==void 0&&(s.orthographic.zoom=o.orthographic.zoom),o.perspective?.zoom!==void 0&&(s.perspective.zoom=o.perspective.zoom),o.isUpVectorFlipped!==void 0&&(s.isUpVectorFlipped=o.isUpVectorFlipped),o.targetOffset!==void 0&&(s.targetOffset=o.targetOffset)}else if(n.type==="Mesh")"geometry"in a&&Object.assign(s,{geometry:Z7.merge(s.geometry,a.geometry)}),(a.material||a.materials)&&(s=function(o,l){if(l===void 0)return o;let h={...o};return"material"in h&&"material"in l&&l.material&&(h.material=OO(h.material,u=>{if(typeof u!="string")for(let[d,c]of Object.entries(l.material.layers)){let p=u.layers.data(d);p&&ha.patch(p,c)}}).data),h.materials&&l.materials&&(h.materials=OO(h.materials,u=>{for(let d=0;d<h.materials.length;d++){let c=l.materials[d];if(typeof c!="string")for(let[p,m]of Object.entries(c.layers)){let f=u[d]?.layers?.data(p);f&&ha.patch(f,m)}}}).data),h}(s,a)),s.cloner&&"cloner"in a&&Object.assign(s,{cloner:Pg.merge(s.cloner,a.cloner)});else if(n.type==="Empty")s.cloner&&"cloner"in a&&Object.assign(s,{cloner:Pg.merge(s.cloner,a.cloner)});else if(q7.is(n.type)){let o=a;o.intensity!==void 0&&(s.intensity=o.intensity),o.color!==void 0&&(typeof o.color=="string"?s.color=o.color:s.color=ls.clone(o.color))}return s}})(Rg||(Rg={}))}),vX=k(()=>{(eL||(eL={})).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}}),E4=k(()=>{vX(),Ih(),(wm||(wm={})).defaultData={orbitControls:eL.defaultData,playPage:Sx,withBackground:!0,preventScroll:!1,preventTouchScroll:!1,hideCursor:!1,mouseEventTarget:"canvas",joystickSizeAndXYOffset:Array(12).fill(0).map((e,t)=>{let i=0,r=0;return t<5?r=-30:t<10&&(r=30),t===0||t===10||t===5?i=30:(t===4||t===11||t===9)&&(i=-30),[120,[i,r],"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}}),t_e=k(()=>{var e;(hF||(hF={})).defaultData={id:"basic",label:"Basic",style:"None",prompt:""},(uF||(uF={})).defaultData={weather:0,shadows:0,lightOrigin:0,temperature:0,sun:0,camera:0,environment:0,particles:0,nature:0,floor:0},(e=ey||(ey={})).defaultData=()=>({mode:"line-art-both",prompt:"",negativePrompt:"",style:{...hF.defaultData},isRandomSeed:!0,seed:e.generateSeed(),guessMode:!1,advanced:!1,steps:20,guidanceScale:7.5,controlNetScale:1,modifiers:uF.defaultData}),e.generateSeed=()=>Math.round(1e5*Math.random())}),yX=k(()=>{M4(),Nr(),E4(),Ih(),Js(),t_e(),(e=>{function t(i,r){let n=i.scene.objects.get(r);if(n&&n.data.type==="Component")return n;{let a=i.shared.lib.components[r];if(a)return{...a.asset,id:r}}}e.physicsEnabled=function(i){return i.find(r=>r.data.type==="Page"&&r.data.globalPhysics.usePhysics)!==void 0},e.getComponentData=t,e.traverseModuleInstances=function(i,r,n){i.scene.objects.traverseFrom(r,(a,s)=>{if(s.type==="Instance"){let o=t(i,s.component)?.data;o&&n(a,s,o.events)}else n(a,s,s.events)})}})(tw||(tw={})),(e=>{function t(r=!0,n=[]){let a=[];r&&a.push({...e.defaultLight}),a.push(...n);let s=new As;return s.push({fi:1,id:Sx,data:{...by.defaultData,name:"Scene 1"},children:a}),s}function i(r){return{...e.defaultData,objects:Gl(r,As.prototype)}}e.TRASH_CAN_ID="830a2708-8ed9-49cf-a68e-085299892222",e.defaultLight={fi:-1,data:QO.defaultDirectionalLightData,id:"830a2708-8ed9-49cf-a68e-085299899103",children:[]},e.createDefaultObjectTreeWithPage=t,e.defaultData={objects:t(),publish:wm.defaultData,styles:ey.defaultData()},e.emptyDataWithoutPage=function(){return{objects:new As,publish:wm.defaultData,styles:ey.defaultData()}},e.emptyDataWithPage=function(r=!0){return{objects:t(r),publish:wm.defaultData,styles:ey.defaultData()}},e.emptyData=function(){return{objects:new As,publish:{...wm.defaultData},styles:ey.defaultData()}},e.withObjs=i,e.withObj=function(r,n){return i([{id:r,data:n,children:[],fi:0}])}})(ty||(ty={}))}),i_e=k(()=>{(gE||(gE={})).defaultData={preset:"fullscreen",allowResponsive:!1,size:[512,512],coords:[0,0],sceneScale:1,color:{r:0,g:0,b:0,a:.5}}}),_X=k(()=>{var e,t;Nr(),Js(),(e=eH||(eH={})).defaultData=i=>({url:i,name:"New Webhook",parametersSchemas:new Nt}),e.defaultParameterValueByType=i=>i==="number"?0:i!=="boolean"&&"",(Lee||(Lee={})).defaultData=(i,r="GET")=>({url:i,method:r,name:"New API",headers:new Nt,queries:new Nt,autoStart:!0}),(i=>{function r(a){return a.textValue!==void 0}function n(a){return typeof a=="boolean"}i.isTextValue=r,i.isNumber=function(a){return typeof a=="number"},i.isBoolean=n,i.typeOfVariable=function(a){return r(a)?"string":n(a)?"boolean":"number"},i.getDisplayedValue=function(a){return i.isTextValue(a)?Array.isArray(a.textValue)?a.textValue.map(s=>s.toString().padStart(a.padding??2,"0")).join(a.deliminator??":")+(a.suffix!==void 0?" "+a.suffix:""):a.textValue.toString():i.isBoolean(a)?a?"True":"False":i.isNumber(a)?parseFloat(a.toFixed(3)).toString():a.toString()}})(Ao||(Ao={})),(dF||(dF={})).all=["images","videos","colors","audios","particles","fonts","materials","variables"],(Bee||(Bee={})).all=[...dF.all,"components"],(Uee||(Uee={})).defaultData=function(){return{images:new ti,videos:new ti,colors:new ti,audios:new ti,particles:new ti,fonts:new ti,materials:new ti,components:new ti,variables:new ti,userAPIs:new ti,userWebhooks:new ti,timelineAnimations:new ti}},(um||(um={})).defaultData=function(){return{images:new ti,videos:new ti,colors:new ti,audios:new ti,particles:new ti,fonts:new ti,materials:new ti,components:new ti,variables:new ti,userAPIs:new ti,userWebhooks:new ti,timelineAnimations:new ti}},(t=gu||(gu={})).defaultColors=function(){return Gl({"89b10010-844c-11ec-a8a3-0242ac120002":{r:.5,g:.5,b:.5,a:1,name:"Default Color"}},ti.prototype)},t.defaultImages=function(){return Gl({},ti.prototype)},t.emptyData=function(){return{catelogs:new ti,materials:new ti,images:new ti,videos:new ti,colors:new ti,timelineAnimations:new ti,audios:new ti,particles:new ti,fonts:new ti,variables:new Nt,userAPIs:new ti,userWebhooks:new ti,lib:um.defaultData()}},t.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 r=[0,0,0];return{name:"Time",value:{textValue:r,deliminator:":",padding:2,suffix:"AM"},dynamicVariableType:"time",format:"HH:mm:ss",format12h24h:"12ampm",timeZone:null,hasEnd:!1,endValue:{textValue:r,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)}},t.getFormattedTimerTime=function(i,r){if(r.format==="HH:mm:ss"){let n=Math.floor(i/3600),a=Math.floor((i-3600*n)/60);return{textValue:[n,a,Math.round(i-3600*n-60*a)]}}if(r.format==="mm:ss"){let n=Math.floor(i/60);return{textValue:[n,Math.round(i-60*n)]}}return r.format==="number"?Math.round(i):Math.round(1e3*i)/1e3}}),VIe=k(()=>{}),r_e=k(()=>{var e;Nr(),yX(),i_e(),_X(),(e=Ex||(Ex={})).defaultData={schema:130,scene:ty.defaultData,frames:new ti().add("72fc2993-2da3-4b6b-96ac-2879db3a28bd",gE.defaultData),shared:{...gu.emptyData(),colors:gu.defaultColors()}},e.createDefaultData=function(){return rA.deserialize(rA.serialize(e.defaultData))},e.emptyDataForImports=function(){return{schema:130,scene:ty.emptyDataWithPage(),frames:new ti().add("72fc2993-2da3-4b6b-96ac-2879db3a28bd",gE.defaultData),shared:{...gu.emptyData(),colors:gu.defaultColors(),images:gu.defaultImages()}}},e.emptyData=function(){return{schema:130,scene:ty.emptyDataWithPage(),frames:new ti().add("72fc2993-2da3-4b6b-96ac-2879db3a28bd",gE.defaultData),shared:gu.emptyData()}},e.clipboard2dData=function(){return{schema:130,scene:ty.emptyData(),frames:new ti,shared:gu.emptyData()}},e.withoutLib=function(t){return{...t,shared:{...t.shared,lib:um.defaultData()}}},e.getComponentData=function(t,i){return tw.getComponentData(t,i)},e.hasSensitiveData=function(t){let i=Object.values(t.shared.userAPIs);for(let r of i){let n=r.headers;for(let a of n)if(a.data.key.toLowerCase()==="authorization"&&a.data.value!=="")return!0}return!1}}),kIe=k(()=>{(tH||(tH={})).emptyImage={data:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVQYV2NgYAAAAAMAAWgmWQ0AAAAASUVORK5CYII=",name:"empty"}}),bX=k(()=>{var e;Ih(),Nr(),(tL||(tL={})).list=["idle","move","jump","run"],(e=iL||(iL={})).defaultColliderData={type:"capsule",height:200,radius:50,position:[0,0,0],rotation:[0,0,0]},e.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:e.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 Nt,move:new Nt,jump:new Nt,run:new Nt},navmesh:{enabled:!1,ch:6,cs:6,walkableClimb:5,walkableHeight:1,walkableRadius:0,zones:"all",objects:[],helperVisible:!0,destinationHelperRadius:0,destinationHelperColor:Vr.fromHexAndA(3728051,1)}}});function Ov(e,...t){let i={};for(let r of t.flat())e!=null&&r in e&&(i[r]=e[r]);return i}function Fee(e){e.layers.forEach(t=>{if(t.type==="depth"&&t.colorA!==void 0){let i=t.colorA,r=t.colorB,n=[[i.r,i.g,i.b,i.a],[r.r,r.g,r.b,r.a]],a=[0,1];for(let o=2;o<10;o++)n.push(n[1]),a.push(1);let s={...Ov($a(t),"type","visible","isVector","isWorldSpace","origin","alpha","mode"),near:Math.max(0,t.near),far:Math.max(0,t.far),colors:n,steps:a,num:2,direction:[1,0,0],smooth:!1,gradientType:1};Object.assign(t,s)}else if(t.type==="depth"&&t.gradientType===1&&(t.near<0||t.far<0)){let i={...$a(t),near:Math.max(t.near,0),far:Math.max(t.far,0)};Object.assign(t,i)}})}function Yp(e,t){Object.values(e.shared.materials).forEach(i=>t(i))}function Kp(e,t){e.scene.objects.traverse((i,r)=>{"materials"in r?r.materials.forEach((n,a)=>{n===void 0&&(r.materials[a]=ra.defaultTwoLayerData("phong"),n=r.materials[a]),typeof n!="string"&&t(n)}):"material"in r?typeof r.material!="string"&&(r.material===void 0&&(r.material=ra.defaultTwoLayerData("phong")),t(r.material)):r.type==="Mesh"&&(r.material===void 0&&(r.material=ra.defaultTwoLayerData("phong")),t(r.material)),"overrides"in r&&Object.values(r.overrides).forEach(n=>{n.material&&typeof n.material!="string"&&Object.getPrototypeOf(n.material)!==Qa.prototype&&t(n.material)})})}function zee(e){e.layers===void 0&&Object.assign(e,ra.defaultTwoLayerData("lambert"))}function cF(e){!e.layers||e.layers.forEach(t=>{if(t.type==="depth"&&t.colors.length===10){let i=[...t.colors];i.push(t.colors[9]);let r=[...t.steps];r.push(t.steps[9]);let n={...$a(t),colors:i,steps:r};Object.assign(t,n)}})}function Vee(e){e.scene.objects.traverse((t,i)=>{"materials"in i?i.materials.forEach(r=>{typeof r!="string"&&cF(r)}):"material"in i&&typeof i.material!="string"&&cF(i.material)}),Object.values(e.shared.materials).forEach(t=>cF(t))}function kee(e){e.layers&&e.layers.forEach(t=>{t.type==="depth"&&t.num!==void 0&&(t.colors=t.colors.slice(0,t.num),t.steps=t.steps.slice(0,t.num),delete t.num)})}function Gee(e){e.layers&&e.layers.forEach(t=>{(function(i){return i.type!=="displace"})(t)&&t.isMask===void 0&&(t.isMask=!1),(t.type==="texture"||t.type==="video")&&t.blending===void 0&&(t.blending=0),(t.type==="noise"||t.type==="displace"&&t.displacementType==="noise")&&(t.voronoiStyle===void 0&&(t.voronoiStyle=0),t.highCut===void 0&&(t.highCut=1),t.lowCut===void 0&&(t.lowCut=0),t.smoothness===void 0&&(t.smoothness=.3),t.seed===void 0&&(t.seed=0),t.quality===void 0&&(t.quality=1))})}function jee(e){let t=e.layers.find(i=>i.type==="light")?.data;if(t?.category==="basic"){let i=ha.defaultData("light","phong"),r=t;Object.assign(r,i),r.visible=!1}}function Hee(e){Yp(e,jee),Kp(e,jee)}function Wee(e){e.layers.forEach(t=>{t.type==="light"&&t.category!=="toon"&&t.occlusion===void 0&&(t.occlusion=!0)})}function qee(e){e.layers&&e.layers.forEach(t=>{t.type==="light"&&t.bumpMapIntensity===void 0&&(t.bumpMapIntensity=5)})}var GIe=k(()=>{T4(),Ih(),vX(),M4(),Nr(),E4(),Js(),le(),mX(),bX(),t_e(),yX(),pX(),gX()}),n_e={};function $ee(e){e.layers&&e.layers.forEach(t=>{t.type==="light"&&t.alphaOverride===void 0&&(t.alphaOverride=1)})}function Xee(e){e.rotation=e.rotation.slice(0,3).map(t=>t*Wv)}function a_e(e){Xee(e),e.type==="Page"&&Xee(e.camera),e.states?.forEach(i=>{i.rotation===void 0||i.rotation===null||(i.rotation=i.rotation.slice(0,3).map(r=>r*Wv))});let t=e.geometry;t&&t.type==="SphereGeometry"&&(t.thetaLength=(t.thetaLength??180)*Wv),t&&t.type==="TorusGeometry"&&(t.arc=t.arc*Wv),t&&t.type==="PathGeometry"&&(t.extrusion.angle*=Wv,t.extrusion.twist*=Wv),e.type==="Mesh"&&e.geometry.type==="TextGeometry"&&(e.geometry.text={textValue:e.geometry.text}),Array.isArray($a(e.events))&&e.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 jIe(e){e.scene.objects.traverse((t,i)=>{})}function HIe(e){let t=e.schema??104;t!==130&&t<130&&(rL(e.asset),e.schema=130)}function ix(e,t){t(e.data);for(let i of e.children)ix(i,t)}function s_e(e){let t=e.schema??104;t!==130&&(t<105&&(ix(e.asset,a_e),e.schema=105),t<118&&(ix(e.asset,l_e),e.schema=118),t<121&&(ix(e.asset,iH),e.schema=121),t<130&&(ix(e.asset,WIe),e.schema=130))}function o_e(e,t){Kp(e,t),Yp(e,t),Object.values(e.shared.lib.materials).forEach(i=>t(i.asset))}function rL(e){e.layers===void 0&&Object.assign(e,ra.defaultTwoLayerData("phong"))}function WIe(e){"materials"in e?e.materials.forEach(t=>{t!==void 0&&typeof t!="string"&&rL(t)}):"material"in e&&e.material!==void 0&&typeof e.material!="string"&&rL(e.material)}function l_e(e){e.timelineAnimations=Gl({},ti.prototype)}function iH(e){e.pivot=[0,0,0],e.pivotRotation=[0,0,0]}function qIe(e){}function $Ie(e){let t=e.schema??0;if(t!==130){console.warn("updating from ",t,"to ",130),function(i,r){if(r<1&&(Kp(i,Fee),Yp(i,Fee),i.schema=1),r<2&&(function(n){Object.assign(n.scene.publish,{orbitControls:{...eL.defaultData,...$a(n.scene.publish.orbitControls)}})}(i),i.schema=2),r<3&&(function(n){function a(s){if(s.layers){for(let o of Object.values(s.layers))if(o){for(let[l,h]of Object.entries(o))if((dX.includes(l)||typeof h=="boolean")&&delete o[l],l==="texture")for(let[u,d]of Object.entries(h))(k1e.includes(u)||typeof d=="boolean")&&delete h[u]}}}n.scene.objects.traverse((s,o)=>{o.states.forEach(l=>{let h=l;h.material?a(h.material):h.materials&&h.materials.forEach(u=>{a(u)})})})}(i),i.schema=3),r<4&&(function(n){n.scene.publish.withBackground=!0}(i),i.schema=4),r<5&&(function(n){n.scene.publish.settings.web={compress:!0,preload:!0,preset:1,logo:!0,hint:!1}}(i),i.schema=5),r<6&&(function(n){n.scene.objects.traverse((a,s)=>{let o=s.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),r<7&&(function(n){n.scene.objects.traverse((a,s)=>{let o=s.geometry;o&&(o.type==="DodecahedronGeometry"||o.type==="IcosahedronGeometry")&&(o.detail=Math.round(o.detail))})}(i),i.schema=7),r<8&&(i.schema=8),r<9&&(Vee(i),i.schema=9),r<10&&(function(n){n.scene.objects.traverse((a,s)=>{s.type==="Mesh"&&(s.geometry.type==="BooleanGeometry"||s.geometry.type==="SubdivGeometry")&&(s.geometry.phongAngle=35)})}(i),i.schema=10),r<11&&(function(n){n.scene.environment.ambientLight.softShadows=!1,n.scene.environment.ambientLight.softShadowQuality="low",n.scene.objects.traverse((a,s)=>{(s.type==="DirectionalLight"||s.type==="SpotLight")&&(s.shadowResolution=1024,s.shadowRadius=1,s.depth=1e5)}),n.shared.penumbraSize=new Array(5).fill(.5)}(i),i.schema=11),r<12&&(Vee(i),i.schema=12),r<13&&(function(n){n.shared.audios=Gl({},ti.prototype)}(i),i.schema=13),r<14&&(function(n){let a=n.shared.materials;Object.entries(a).forEach(([s,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(a,{[s]:l})}})}(i),i.schema=14),r<15&&(function(n){Object.entries($a(n.shared.images)).filter(a=>a[1].asset===!1).map(a=>a[0]).forEach(a=>{delete n.shared.images[a]}),Object.entries($a(n.shared.audios)).filter(a=>a[1].asset===!1).map(a=>a[0]).forEach(a=>{delete n.shared.audios[a]})}(i),i.schema=15),r<16&&(function(n){n.scene.publish.settings.web.preload=!1}(i),i.schema=16),r<17&&(Kp(i,kee),Yp(i,kee),i.schema=17),r<18&&(Kp(i,zee),Yp(i,zee),i.schema=18),r<19&&(function(n){Object.assign(n.scene.publish.settings,{video:{...wm.defaultData.settings.video,...$a(n.scene.publish.settings.video)}})}(i),i.schema=19),r<20&&(function(n){n.shared.fonts=Gl({},ti.prototype)}(i),function(n){let a=[];n.scene.objects.traverse((s,o)=>{let l=o;if(l.type==="TextFrame"){let h=ra.defaultTwoLayerData("phong"),u=typeof l.color=="string"?n.shared.colors[l.color]:l.color;h.layers[1].data.color={r:u.r,g:u.g,b:u.b},h.layers[1].data.alpha=l.alpha;let d=function(m){return m.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(f=>f.charAt(0).toUpperCase()+f.slice(1)).join(" ")}(l.font);n.shared.fonts[d]===void 0&&(n.shared.fonts[d]={name:d});let c={name:l.name,...ns.defaultData,...bc.defaultData,flatShading:!1,wireframe:!1,geometry:{...hm.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:h,states:$a(l.states),events:$a(l.events),visible:l.visible,raycastLock:l.raycastLock,position:l.position,rotation:l.rotation,scale:l.scale,hiddenMatrix:l.hiddenMatrix},p=$a(n.scene.objects).parent(s);n.scene.objects.insertAfter(p??null,s,[{id:s+"new",data:c,children:[]}]),a.push(s)}}),a.forEach(s=>{n.scene.objects.delete(s)})}(i),i.schema=20),r<21&&(function(n){let a={0:"MouseDown",1:"MouseUp",2:"MouseHover",5:"KeyDown",6:"KeyUp",7:"Start",9:"LookAt",10:"Follow",11:"Scroll",12:"Audio",13:"GameControl"};n.scene.objects.traverse((s,o)=>{o.events.forEach(l=>{if(a[Number(l.type)])if(Object.assign(l,{type:a[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 Nt,move:new Nt,jump:new Nt}});else{let h=new Nt;Object.assign(l,{actions:h}),(l.type==="MouseDown"||l.type==="MouseUp"||l.type==="KeyDown"||l.type==="KeyUp")&&"url"in l&&h.push({fi:0,id:ht.generateUUID(),data:{type:"Link",url:l.url,delay:0}}),"targets"in l&&(l.targets.forEach((u,d,c)=>{let p={easing:u.easing,duration:u.duration};u.easing===6?Object.assign(p,Ov(u,"mass","stiffness","damping","velocity")):u.easing===5&&Object.assign(p,{control1:{...u.control1},control2:{...u.control2}});let m={repeat:u.repeat?-1:0,delay:u.delay,delayDirection:u.delayDirection,direction:u.cycle&&u.rewind?"pingpong-rewind":u.cycle?"pingpong":"normal"},f={state:u.state,...m,...p},g={allowSlerp:!0,type:"Transition",object:u.object,repeat:0,delay:0,delayDirection:void 0,direction:"normal",tweens:new Nt({fi:0,id:ht.generateUUID(),data:{state:void 0,repeat:0,delay:0,delayDirection:void 0,direction:"normal",duration:0,easing:4}},{fi:1,id:ht.generateUUID(),data:f})};h.push({fi:c,id:d,data:g})}),delete l.targets)}})})}(i),function(n){n.scene.objects.traverse((a,s)=>{function o(l,h){let u=new Nt,d=[];if(s.events.forEach((c,p,m)=>{if(c.type==="Audio"&&c.trigger===h){let f;d.push(p),c.interaction==="play"?f={...Ov(c,"interaction","audio","delay","volume","loop"),triggerAfter:"after"in c?c.after:void 0,toggle:"after"in c?c.toggle:void 0,type:"Audio"}:(c.interaction==="pause"||c.interaction==="stop")&&(f={...Ov(c,"interaction","delay","object","playAudio"),type:"Audio"}),f&&u.push({fi:m,id:p,data:f})}}),d.forEach(c=>s.events.delete(c)),u.length){let c=s.events.find(p=>p.type===l)?.data;c?"actions"in c&&c.actions.insertBefore(null,u):s.events.insertBefore(null,[{id:ht.generateUUID(),data:{type:l,actions:u}}])}}o("Start","start"),o("MouseDown","mouseDown"),o("MouseUp","mouseUp"),o("KeyDown","keyDown"),o("KeyUp","keyUp")})}(i),i.schema=21),r<22&&(Hee(i),i.schema=22),r<23&&(function(n){n.scene.objects.traverse((a,s)=>{s.type==="Mesh"&&s.geometry.type==="SubdivGeometry"&&(s.geometry.scaleBaked||(s.geometry.scaleBaked=[1,1,1]))})}(i),i.schema=23),r<24&&(function(n){n.scene.objects.traverse((a,s)=>{(s.type==="Empty"||s.type==="Mesh")&&s.cloner&&!s.cloner.randomnessObject&&!s.cloner.toObject&&!s.cloner.randomness&&(s.cloner={...s.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),(r<25||i.shared.videos===void 0)&&(function(n){n.shared.videos=Gl({},ti.prototype)}(i),r<25&&(i.schema=25)),r<26&&(function(n){n.scene.objects.traverse((a,s)=>{let o=n.scene.objects.unproxy().parent(a);if(o){let l=$a(n.scene.objects.data(o));l&&l.type==="Mesh"&&l.geometry.type==="BooleanGeometry"&&s.type==="Mesh"&&(s.visible=$a(s).booleanExclude!==!0)}})}(i),i.schema=26),r<27&&(function(n){n.scene.objects.traverse((a,s)=>{if(s.type==="Mesh"){let o=s;s.geometry.type==="NonParametricGeometry"?o.material!==void 0&&delete o.material:o.materials!==void 0&&delete o.materials}})}(i),i.schema=27),r<28&&(Hee(i),i.schema=28),r<29&&(function(n){function a(o){Object.setPrototypeOf(o,Qa.prototype),o.texture&&Object.setPrototypeOf(o.texture,Qa.prototype)}function s(o){Object.setPrototypeOf(o,Qa.prototype);for(let l in o)a(o[l])}n.scene.objects.traverse((o,l)=>{l.states.forEach(h=>{let u=h;if(u.material){let d=$a(u.material).layers;s(d),u.material.layers=d}if(u.materials)for(let d=0;d<u.materials.length;d++){let c=u.materials[d],p=$a(c).layers;s(p),c.layers=p}})})}(i),i.schema=29),r<30&&(function(n){n.scene.objects.traverse((a,s)=>{s.type==="Mesh"&&s.geometry.type==="NonParametricGeometry"&&!("material"in s)&&!("materials"in s)&&(s.material=ra.defaultTwoLayerData("phong"))})}(i),i.schema=30),r<31&&(function(n){n.scene.publish.orbitControls.autoZoom===void 0&&(n.scene.publish.orbitControls.autoZoom=!1),n.scene.objects.traverse((a,s)=>{(s.type==="OrthographicCamera"||s.type==="PerspectiveCamera")&&(s.orthographic.autoZoom===void 0&&(s.orthographic.autoZoom=!1),s.orthographic.autoZoomFrustumSize===void 0&&(s.orthographic.autoZoomFrustumSize=790))})}(i),i.schema=31),r<33&&(function(n){n.scene.objects.traverse((a,s)=>{s.pathSnapping===void 0&&(s.pathSnapping={pathId:null,slide:0,offset:0,orientation:"tangential"}),s.pathSnapping.offset===void 0&&(s.pathSnapping.offset=0)})}(i),i.schema=33),r<34&&(function(n){n.scene.publish.mouseEventTarget===void 0&&(n.scene.publish.mouseEventTarget="canvas"),n.scene.publish.settings.web.hint===void 0&&(n.scene.publish.settings.web.hint=!1)}(i),i.schema=34),r<35&&(function(n){let{video:a}=n.scene.publish.settings;a.format==="gif"&&a.fps>48&&(a.fps=15)}(i),i.schema=35),r<36&&(function(n){n.scene.objects.traverse((a,s)=>{s.events.forEach(o=>{o.type==="GameControl"&&(o.resetYPosition=Math.abs(o.resetYPosition-s.position[1]))})})}(i),i.schema=36),r<37&&(function(n){let a=n.scene.environment.usePhysics;n.scene.objects.traverse((s,o)=>{a&&o.physics===null?o.collision=!1:o.collision="visibility"})}(i),i.schema=37),r<38&&(Kp(i,Gee),Yp(i,Gee),i.schema=38),r<39&&(function(n){n.scene.objects.traverse((a,s)=>{s.events.forEach(o=>{o.type==="GameControl"&&(o.navmesh=iL.defaultDataThirdPerson.navmesh)})})}(i),i.schema=39),r<40&&(function(n){n.scene.styles||(n.scene.styles=ey.defaultData())}(i),i.schema=40),r<41&&(function(n){n.scene.environment.ambientLight.occlusion===void 0&&(n.scene.environment.ambientLight.occlusion=!1),n.scene.environment.ambientLight.aoFullRes===void 0&&(n.scene.environment.ambientLight.aoFullRes=!1),n.scene.environment.ambientLight.radius===void 0&&(n.scene.environment.ambientLight.radius=256),n.scene.environment.ambientLight.bias===void 0&&(n.scene.environment.ambientLight.bias=.5),n.scene.environment.ambientLight.aoColor===void 0&&(n.scene.environment.ambientLight.aoColor={r:.19607843137254902,g:.19607843137254902,b:.19607843137254902}),Kp(n,Wee),Yp(n,Wee)}(i),i.schema=41),r<42&&(function(n){n.scene.objects.traverse((a,s)=>{s.events.forEach(o=>{o.type==="GameControl"&&Object.assign(o.gameActions,{run:new Nt})})})}(i),i.schema=42),r<43&&(function(n){n.scene.objects.traverse((a,s)=>{s.events.forEach(o=>{o.type==="GameControl"&&(o.keyAssignments=[...o.keyAssignments,["run","\u21E7"],["none","Ctrl"]])})})}(i),i.schema=43),r<99){Kp(i,qee),Yp(i,qee),i.scene.publish.playCamera===null&&(i.scene.publish.playCamera=h1);let n=$a(i.scene.objects),a=i.scene.objects;i.scene.publish.playPage=Sx,a.insertBefore(null,null,[{id:Sx,data:{...by.defaultData,backgroundColor:i.scene.backgroundColor,fog:i.scene.fog,postprocessing:i.scene.postprocessing,ao:Ov(i.scene.environment.ambientLight,"occlusion","aoFullRes","radius","bias","aoColor"),publish:{playCamera:i.scene.publish.playCamera,gameControlObject:i.scene.publish.gameControlObject},shadow:Ov(i.scene.environment.ambientLight,"softShadowQuality"),globalPhysics:{...Mx.defaultData,...Ov(i.scene.environment,"usePhysics","gravity")},camera:$a(i.scene.ownerCamera)??by.defaultData.camera,name:"Scene"},children:[]}]);for(let l of n)l.id!==ty.TRASH_CAN_ID&&a.move(Sx,l.fi,l.id);let s=0,o=0;i.shared.penumbraSize&&i.scene.objects.traverse((l,h)=>{h.type==="DirectionalLight"?(h.penumbraSize=i.shared.penumbraSize[Math.min(s,2)],s+=1):h.type==="SpotLight"&&(h.penumbraSize=i.shared.penumbraSize[3+Math.min(o,1)],o+=1),(h.physics===void 0||h.physics===null)&&h.type!=="Instance"&&(h.physics={},Object.assign(h.physics,Tx.defaultData)),h.physics!==void 0&&h.physics!==null&&(h.physics.enabled=h.collision??"visibility",delete h.collision)}),i.schema=99}}(e,t),t<100&&(e.scene.publish.joystickSizeAndXYOffset===void 0&&(e.scene.publish.joystickSizeAndXYOffset=wm.defaultData.joystickSizeAndXYOffset),e.schema=100),t<101&&(Kp(e,$ee),Yp(e,$ee),e.schema=101),t<102&&(function(i){i.scene.objects.traverse((r,n)=>{let a=n.geometry;a&&a.type==="PathGeometry"&&(a.extrusion.capType="flat",a.extrusion.bevel=50,a.extrusion.bevelSides=6,a.extrusion.shape.type==="Custom"&&(a.extrusion.shape.shapeQuality="low"))})}(e),e.schema=102),t<104&&(e.shared.catelogs=new ti,e.shared.lib=um.defaultData(),e.schema=104),t<105&&(function(i){i.shared.variables=Gl({},ti.prototype)}(e),e.scene.objects.traverse((i,r)=>{a_e(r)}),e.schema=105);for(let i of Object.values(e.shared.lib.components))s_e(i);t<106&&(function(i){let r=$a(i.shared.variables);i.shared.variables=Gl(Object.entries(r??{}).map(([n,a],s)=>({fi:s,id:n,data:a})),Nt.prototype)}(e),e.schema=106),t<107&&(e.shared.lib.variables=um.defaultData().variables,e.schema=107),t<109&&(function(i){i.shared.particles=Gl({},ti.prototype),i.shared.lib&&(i.shared.lib.particles=um.defaultData().particles)}(e),e.schema=109),t<110&&(function(i){i.scene.objects.traverse((r,n)=>{n.type==="Particle"&&typeof n.renderMaterial.size=="number"&&Object.assign(n.renderMaterial,{size:[n.renderMaterial.size,n.renderMaterial.size]})})}(e),e.schema=110),t<111&&(e.scene.objects.traverse((i,r)=>{(function(n){Array.isArray($a(n.events))&&n.events?.forEach(a=>{"disabled"in a||(a.disabled=!1),(a.type==="MouseDown"||a.type==="MouseUp"||a.type==="MousePress")&&(a.mode=a.mode||"Object")})})(r)}),e.schema=111),t<112&&(function(i){i.scene.objects.traverse((r,n)=>{n.type==="Page"&&(n.postprocessing.depthOfField.focusDistance=100,n.postprocessing.depthOfField.focalLength=20,n.postprocessing.depthOfField.bokehScale=5)})}(e),e.schema=112),t<113&&(function(i){i.scene.objects.traverse((r,n)=>{Array.isArray($a(n.events))!==!1&&n.events?.forEach(a=>{let s=a.runMode;a.type==="MouseDown"||a.type==="MouseUp"||a.type==="KeyDown"||a.type==="KeyUp"||a.type==="Collision"||a.type==="Trigger"?a.actions?.forEach(o=>{o.type==="Transition"&&(o.runMode=s??"Repeat"),(o.type==="Animation"||o.type==="SwitchCamera")&&(o.runMode=s==="Toggle"?"Toggle":"Normal")}):a.type==="MouseHover"||a.type==="MousePress"||a.type==="KeyPress"?a.actions?.forEach(o=>{(o.type==="Transition"||o.type==="Animation"||o.type==="SwitchCamera")&&(o.runMode="Toggle")}):a.type==="GameControl"?(delete a.actions,Object.keys(a.gameActions).forEach(o=>{a.gameActions[o]?.forEach(l=>{l.type==="Transition"&&(l.runMode="Repeat"),l.type==="Animation"&&(l.runMode="Normal")})})):a.type==="DragDrop"?(delete a.actions,a.dragDropActions?.drag?.forEach(o=>{(o.type==="Transition"||o.type==="Animation"||o.type==="SwitchCamera")&&(o.runMode="Toggle")}),a.dragDropActions?.drop?.forEach(o=>{(o.type==="Transition"||o.type==="Animation"||o.type==="SwitchCamera")&&(o.runMode="Toggle")})):a.type==="Resize"?(delete a.actions,a.breakpoints?.forEach(o=>{o.actions?.forEach(l=>{(l.type==="Transition"||l.type==="Animation"||l.type==="SwitchCamera")&&(l.runMode="Toggle")})})):a.type==="Start"?a.actions?.forEach(o=>{o.type==="Transition"&&(o.runMode="Once"),(o.type==="Animation"||o.type==="SwitchCamera")&&(o.runMode="Normal")}):a.type==="VariableChange"||a.type==="Scroll"?a.actions?.forEach(o=>{o.type==="Transition"&&(o.runMode="Repeat"),(o.type==="Animation"||o.type==="SwitchCamera")&&(o.runMode="Normal")}):a.type==="Conditional"&&(delete a.actions,a.inActions?.forEach(o=>{o.type==="Transition"&&(o.runMode="Repeat"),(o.type==="Animation"||o.type==="SwitchCamera")&&(o.runMode="Normal")}),a.outActions?.forEach(o=>{o.type==="Transition"&&(o.runMode="Repeat"),(o.type==="Animation"||o.type==="SwitchCamera")&&(o.runMode="Normal")}))})})}(e),e.schema=113),t<114&&(e.scene.publish.settings.web.imageQuality===void 0&&(e.scene.publish.settings.web.imageQuality=70),e.schema=114),t<115&&(function(i){i.shared.userAPIs=Gl({},ti.prototype),i.shared.userWebhooks=Gl({},ti.prototype),i.shared.lib&&(i.shared.lib.userAPIs=um.defaultData().userAPIs,i.shared.lib.userWebhooks=um.defaultData().userWebhooks)}(e),e.schema=115),t<116&&(function(i){i.scene.publish.settings.videoStatic===void 0&&(i.scene.publish.settings.videoStatic=wm.defaultData.settings.videoStatic)}(e),e.schema=116),t<117&&(e.scene.publish.settings.web.pixelRatioMobile===void 0&&(e.scene.publish.settings.web.pixelRatioMobile=0),e.scene.publish.settings.web.pixelRatioDesktop===void 0&&(e.scene.publish.settings.web.pixelRatioDesktop=0),e.schema=117),t<118&&(e.shared.timelineAnimations=Gl({},ti.prototype),e.scene.objects.traverse((i,r)=>{l_e(r)}),e.schema=118),t<119&&(e.scene.publish.settings.videoStatic.format=Ex.defaultData.scene.publish.settings.videoStatic.format,e.scene.publish.settings.videoStatic.imageFormat=Ex.defaultData.scene.publish.settings.videoStatic.imageFormat,e.schema=119),t<120&&(e.scene.publish.settings.image.colorSpace="display-p3",e.scene.publish.settings.videoStatic.colorSpace="display-p3",e.schema=120),t<121&&(e.scene.objects.traverse((i,r)=>{iH(r),r.type==="Page"&&r.camera!==void 0&&iH(r.camera)}),e.schema=121),t<122&&(delete e.scene.publish.settings.video,e.scene.publish.orbitControls.rotationSpeed=Ex.defaultData.scene.publish.orbitControls.rotationSpeed,e.schema=122),t<123&&(e.scene.objects.traverse((i,r)=>{r.type==="Page"&&r.sky===void 0&&(r.sky=xg.defaultData)}),e.schema=123),t<124&&(t>=123&&e.scene.objects.traverse((i,r)=>{let n=r.sky;r.type==="Page"&&n!==void 0&&(typeof n.exposure=="number"&&(n.exposure=Math.round(n.exposure/5e-4*1e4)/1e4),n.lighting===void 0&&(n.lighting=xg.defaultData.lighting))}),e.schema=124),t<125&&(e.scene.objects.traverse((i,r)=>{let n=r.sky;r.type==="Page"&&n!==void 0&&n.lightingIntensity===void 0&&(n.lightingIntensity=xg.defaultData.lightingIntensity)}),e.schema=125),t<126&&(e.scene.objects.traverse((i,r)=>{let n=r.sky;r.type==="Page"&&n!==void 0&&(n.mode===void 0&&(n.mode="physical"),n.hdri===void 0?n.hdri={...xg.defaultData.hdri}:(n.hdri.blur===void 0&&(n.hdri.blur=xg.defaultData.hdri.blur),Array.isArray(n.hdri.rotation)&&(n.hdri.rotation=n.hdri.rotation[1]??0)))}),e.schema=126),t<127&&(e.scene.objects.traverse((i,r)=>{let n=r.sky;r.type==="Page"&&n?.hdri!==void 0&&n.hdri.showBackground===void 0&&(n.hdri.showBackground=!0)}),e.schema=127),t<128&&(e.scene.objects.traverse((i,r)=>{let n=r.sky;r.type==="Page"&&n!==void 0&&n.lightingQuality===void 0&&(n.lightingQuality="full")}),e.schema=128),t<129&&(e.scene.objects.traverse((i,r)=>{if(r.type==="Page"){r.camera===void 0&&(r.camera=by.defaultData.camera);let n=r.camera;n.far=1e5,n.perspective?n.perspective.near=70:n.perspective={near:70,fov:45,zoom:1}}}),e.schema=129),t<130&&(o_e(e,rL),e.schema=130)}}gw(n_e,{updateAllMaterials:()=>o_e,updateDocumentSchema:()=>$Ie,updateLibSchema:()=>qIe,updateMaterialSchema:()=>HIe,updateObjectStateRec:()=>ix,updateObjectsSchema:()=>s_e,updateTextValues:()=>jIe});var Wv,Yee,$C,pF,Kee,XC,iy,DS,H1,YC,mF,iI,fF,gF,Zee,rI,vF,xy,rH,A4=k(()=>{r_e(),Nr(),GIe(),E4(),T4(),Js(),_X(),M4(),fX(),Wv=180/Math.PI}),XIe=k(()=>{var e,t,i;Ih(),Nr(),Js(),(Yee||(Yee={})).is=function(r){return!0},(e=$C||($C={})).defaultData={position:[0,0],scale:[1,1],rotation:0,shear:[0,0]},e.merge=function(r,n){return{position:n?.position??r.position,rotation:n?.rotation??r.rotation,scale:n?.scale??r.scale,shear:n?.shear??r.shear}},e.diff=function(r,n){return _1e({position:zc.isEqual(r.position,n.position)?void 0:n.position,rotation:r.rotation===n.rotation?void 0:n.rotation,scale:zc.isEqual(r.scale,n.scale)?void 0:n.scale,shear:r.shear&&n.shear&&zc.isEqual(r.shear,n.shear)?void 0:n.shear})},(pF||(pF={})).defaultData={horizontalConstraint:0,verticalConstraint:0},(Kee||(Kee={})).defaultData={direction:"row",wrap:"unwrap",align:"top-left",gap:10,rowGap:10,autoGap:!1,autoRowGap:!1,leftPadding:8,rightPadding:8,topPadding:8,bottomPadding:8},(XC||(XC={})).defaultData={opacity:1,fill:{color:Vr.fromHexAndA(eo,1),enabled:!0},stroke:{color:Vr.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:Vr.from0to1([0,0,0,1]),enabled:!1,spread:0},innerShadow:{offset:[10,10],blurRadius:10,color:Vr.from0to1([0,0,0,1]),enabled:!1,spread:0}},(t=iy||(iy={})).newEmpty=function(r,n){return{name:n}},t.patch=function(r,n){if(n===void 0)return r;let a={...r};return Object.assign(a,$C.merge(a,n)),a=function(s,o){if(o===void 0)return s;let l={...s},h=["width","height","cornerRadius"];for(let u of h)u in l&&u in o&&o[u]!==void 0&&Object.assign(l,{[u]:o[u]});return l}(a,n),a=function(s,o){if(o===void 0)return s;let l={...s};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}(a,n),a},t.toOps=function(r,n){let a,s=[];for(let[o,l]of Object.entries(n))o!=="name"&&(a===void 0&&(a={path:[],props:{},type:0},s.push(a)),a.props[o]=l);return s},(DS||(DS={})).defaultData={...$C.defaultData,...pF.defaultData,states:new Nt,events:new Nt,visible:!0,raycastLock:!1},(H1||(H1={})).defaultData={...DS.defaultData,...XC.defaultData},(YC||(YC={})).defaultData={cornerRadius:[0,0,0,0]},(mF||(mF={})).defaultData={...H1.defaultData,type:"ellipse2d",width:100,height:100,name:"Ellipse"},(iI||(iI={})).defaultData={...H1.defaultData,...YC.defaultData,type:"rectangle2d",width:100,height:100,name:"Rectangle"},(fF||(fF={})).defaultData={...H1.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"},(gF||(gF={})).defaultData={...H1.defaultData,type:"path2d",path:"",name:"Path"},(Zee||(Zee={})).is=function(r){return r.type==="ellipse2d"||r.type==="rectangle2d"||r.type==="text2d"||r.type==="vector2d"||r.type==="path2d"},(rI||(rI={})).defaultData={...DS.defaultData,name:"Group",type:"group2d"},(vF||(vF={})).defaultData=()=>({...DS.defaultData,...YC.defaultData,...XC.defaultData,name:"Frame",type:"frame2d",clipped:!0,width:200,height:200,fill:{color:Vr.fromHexAndA(4737101,1),enabled:!0},stroke:{color:Vr.fromHexAndA(0,1),thickness:1,enabled:!1,mode:"inside"},backgroundBlur:{radius:2,enabled:!1},layerBlur:{radius:2,enabled:!1}}),(r=>{r.defaultData=function(n){switch(n){case"rectangle2d":case"vector2d":return{...iI.defaultData};case"ellipse2d":return{...mF.defaultData};case"text2d":return{...fF.defaultData};case"path2d":return{...gF.defaultData};case"frame2d":return{...vF.defaultData()};case"group2d":return{...rI.defaultData}}},r.getPivot=function(n){return"width"in n&&"height"in n?[typeof n.width=="number"?.5*n.width:0,typeof n.height=="number"?.5*n.height:0]:[0,0]},r.isResizeable=function(n){return n.type==="rectangle2d"||n.type==="ellipse2d"||n.type==="text2d"||n.type==="frame2d"},r.isAutoLayoutable=function(n){return n.type==="frame2d"&&n.autoLayout!==void 0},r.hasCorners=function(n){return n.type==="rectangle2d"||n.type==="frame2d"}})(xy||(xy={})),(i=rH||(rH={})).defaultData={name:"UI",type:"scene2d",objects:new As},i.emptyData=function(){return{type:"scene2d",objects:new As}}}),YIe=k(()=>{LIe(),BIe(),j1e(),H1e(),r_e(),z1e(),kIe(),Y1e(),Q1e(),fX(),A4(),i_e(),mX(),pX(),W1e(),T4(),X1e(),e_e(),Ih(),E4(),M4(),vX(),Z1e(),_X(),yX(),UIe(),K1e(),bX(),gX(),q1e(),$1e(),XIe()});function ry(e,t=!1){let i=e[0].index!==null,r=new Set(Object.keys(e[0].attributes)),n=new Set(Object.keys(e[0].morphAttributes)),a={},s={},o=e[0].morphTargetsRelative,l=new At,h=0;for(let u=0;u<e.length;++u){let d=e[u],c=0;if(i!==(d.index!==null))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+". 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(!r.has(p))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+'. All geometries must have compatible attributes; make sure "'+p+'" attribute exists among all geometries, or in none of them.'),null;a[p]===void 0&&(a[p]=[]),a[p].push(d.attributes[p]),c++}if(c!==r.size)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+". 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 "+u+". .morphTargetsRelative must be consistent throughout all geometries."),null;for(let p in d.morphAttributes){if(!n.has(p))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+". .morphAttributes must be consistent throughout all geometries."),null;s[p]===void 0&&(s[p]=[]),s[p].push(d.morphAttributes[p])}if(t){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 "+u+". The geometry must have either an index or a position attribute"),null;p=d.attributes.position.count}l.addGroup(h,p,u),h+=p}}if(i){let u=0,d=[];for(let c=0;c<e.length;++c){let p=e[c].index;for(let m=0;m<p.count;++m)d.push(p.getX(m)+u);u+=e[c].attributes.position.count}l.setIndex(d)}for(let u in a){let d=Qee(a[u]);if(!d)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+u+" attribute."),null;l.setAttribute(u,d)}for(let u in s){let d=s[u][0].length;if(d!==0){l.morphAttributes=l.morphAttributes||{},l.morphAttributes[u]=[];for(let c=0;c<d;++c){let p=[];for(let f=0;f<s[u].length;++f)p.push(s[u][f][c]);let m=Qee(p);if(!m)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+u+" morphAttribute."),null;l.morphAttributes[u].push(m)}}}return l}function Qee(e){let t,i,r,n=-1,a=0;for(let h=0;h<e.length;++h){let u=e[h];if(t===void 0&&(t=u.array.constructor),t!==u.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=u.itemSize),i!==u.itemSize)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes."),null;if(r===void 0&&(r=u.normalized),r!==u.normalized)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes."),null;if(n===-1&&(n=u.gpuType),n!==u.gpuType)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.gpuType must be consistent across matching attributes."),null;a+=u.count*i}let s=new t(a),o=new It(s,i,r),l=0;for(let h=0;h<e.length;++h){let u=e[h];if(u.isInterleavedBufferAttribute){let d=l/i;for(let c=0,p=u.count;c<p;c++)for(let m=0;m<i;m++){let f=u.getComponent(c,m);o.setComponent(c+d,m,f)}}else s.set(u.array,l);l+=u.count*i}return n!==void 0&&(o.gpuType=n),o}var CA=k(()=>{le()});function h_e(e){let t=e.points.length/7,i=new Nt;for(let r=0;r<t;r++){let n=7*r,a=e.points[n+0],s=e.points[n+1],o=e.points[n+2],l=e.points[n+3],h=e.points[n+4],u=e.points[n+5],d=e.points[n+6];i.push({fi:r,id:ht.generateUUID(),data:{roundness:d,position:[a,s],areControlsDirectionsMirrored:!0,controlPrevious:{position:[o,l]},controlNext:{position:[h,u]}}})}return{points:i,isClosed:e.isClosed,roundness:e.roundness,shapeHoles:e.shapeHoles?.map(r=>h_e(r))??[]}}function u_e(e){let{userData:t,uuid:i,...r}=e;if(t===void 0||t.type==="NonParametricGeometry")return function(s){let o,{userData:l,data:h}=s,u=h?.groups,d=h?.attributes??{},c=h?.morphAttributes??{},p=h?.interleavedBuffers,m=h?.arrayBuffers,f=h?.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 M=0;M<v.length;M+=3){let T=v[M],A=v[M+1],E=v[M+2];y=Math.min(y,T),_=Math.min(_,A),b=Math.min(b,E),x=Math.max(x,T),w=Math.max(w,A),S=Math.max(S,E)}return{width:x-y,height:w-_,depth:S-b}}(d.position.array));let g={...l===void 0?{}:l.parameters,data:{attributes:d,morphAttributes:c,interleavedBuffers:p,arrayBuffers:m},...o===void 0?{}:o,type:"NonParametricGeometry"};return f!==void 0&&Object.assign(g.data,{index:f}),u!==void 0&&Object.assign(g.data,{groups:u.map(v=>({...v,materialIndex:v.materialIndex??0}))}),g}(e);if(t.type==="SubdivGeometry"){let s="SubdivGeometry",o=r.data?.attributes;if(o?.positionWASM===void 0){let h=new At;if(o?.position===void 0||o?.faceMap===void 0)return null;let u=o.position.array,d=o.faceMap.array,c=r.data.index.array;h.setAttribute("position",new Et(u,3)),h.setIndex(new zm(c,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,M=Object.keys(v.attributes),T={},A={},E=[],C=["getX","getY","getZ","getW"],N=["setX","setY","setZ","setW"];for(let j=0,$=M.length;j<$;j++){let H=M[j],te=v.attributes[H];T[H]=new te.constructor(new te.array.constructor(te.count*te.itemSize),te.itemSize,te.normalized);let ue=v.morphAttributes[H];ue&&(A[H]||(A[H]=[]),ue.forEach((ae,de)=>{let ye=new ae.array.constructor(ae.count*ae.itemSize);A[H][de]=new ae.constructor(ye,ae.itemSize,ae.normalized)}))}let P=.5*y,I=Math.log10(1/y),L=Math.pow(10,I),B=P*L;for(let j=0;j<w;j++){let $=b?b.getX(j):j,H="";for(let te=0,ue=M.length;te<ue;te++){let ae=M[te],de=v.getAttribute(ae),ye=de.itemSize;for(let Z=0;Z<ye;Z++)H+=~~(de[C[Z]]($)*L+B)+","}if(H in _)E.push(_[H]);else{for(let te=0,ue=M.length;te<ue;te++){let ae=M[te],de=v.getAttribute(ae),ye=v.morphAttributes[ae],Z=de.itemSize,fe=T[ae],W=A[ae];for(let z=0;z<Z;z++){let Y=C[z],ne=N[z];if(fe[ne](S,de[Y]($)),ye)for(let V=0,Q=ye.length;V<Q;V++)W[V][ne](S,ye[V][Y]($))}}_[H]=S,E.push(S),S++}}let G=v.clone();for(let j in v.attributes){let $=T[j];if(G.setAttribute(j,new $.constructor($.array.slice(0,S*$.itemSize),$.itemSize,$.normalized)),j in A)for(let H=0;H<A[j].length;H++){let te=A[j][H];G.morphAttributes[j][H]=new te.constructor(te.array.slice(0,S*te.itemSize),te.itemSize,te.normalized)}}return G.setIndex(E),G}(h),m=[],f=new Array(d[d.length-1]+1).fill(3),g=p.getIndex().array;for(let v=0,y=d.length;v<y;)d[v]===d[v+1]?(f[d[v]]++,m.push(...new Set(g.slice(3*v,3*v+6))),v+=2):(m.push(...g.slice(3*v,3*v+3)),v++);o.indexWASM={array:m},o.positionWASM=p.attributes.position,o.verticesPerFaceWASM={array:f}}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:s,...KIe(o.positionWASM.array)};l.subdivisions=t.parameters.subdivisions;for(let h in o)h==="positionWASM"?l[h]=new Float32Array(o[h].array):h==="indexWASM"?l[h]=new Int32Array(o[h].array):h==="verticesPerFaceWASM"&&(l[h]=new Int8Array(o[h].array));return l.scaleBaked=[1,1,1],l}let n=t.type,a=t.parameters;return n==="VectorGeometry"?(a.extrudeDepth&&(a.depth=a.extrudeDepth),{...a,width:100,height:100,shape:h_e(t.shape),type:n}):n==="LatheGeometry"?{...t.parameters,type:n,points:(t?.parameters.points??[]).map(s=>[s.x,s.y])}:(a.extrudeDepth&&(a.depth=a.extrudeDepth),{...a,type:n})}function KIe(e){return nH.setFromArray(e),nH.getSize(xM),{width:xM.x,height:xM.y,depth:xM.z}}var nH,xM,ZIe=k(()=>{Nr(),le(),CA(),new ke,new Zt,new pn,new D,new D,nH=new fn,xM=new D}),QIe=k(()=>{}),JIe=k(()=>{Nr(),A4()});function as(e,t=[0,0]){return[e&&!isNaN(e[0])?e[0]:t[0],e&&!isNaN(e[1])?e[1]:t[1]]}function Hl(e,t,i){switch(e){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:r,control2:n}=t??{...VO.defaultData};return`cubicBezier( ${r[0]}, ${r[1]}, ${n[0]}, ${n[1]} )`}case 6:{let{mass:r,stiffness:n,damping:a,velocity:s}=i??{...zO.defaultData},o=new d_e(r,n,a,s),l=o.solve(1);return()=>h=>o.solve(h)/l}case 8:return()=>r=>Math.floor(r)}}function Jee(e,t,i){return{id:t,fi:i,data:{id:t,path:e,keyframes:new Nt}}}var ete,tte,aH,d_e,c_e,Hm,vE,p_e,bw,NS,KC,yF,xw,ite,_F,rte,bF,iw,df,cf,up,xF,nte,ate,wF,sH,Sm,eOe=k(()=>{var e;Nr(),Ih(),(ete||(ete={})).is=function(t){return t&&typeof t.x=="number"&&typeof t.y=="number"&&typeof t.z=="number"},(e=tte||(tte={})).getControlsWithDefault=function(t,i){let r=[0,0],n=[1,1];if(t?.cubicControls)r=as(t.cubicControls.control1,r);else switch(t?.type){case 2:case 4:r=[.42,0];break;case 3:case 0:r=[0,0];break;case 1:r=[.25,.1];break;case 7:r=[.25,1]}if(i?.cubicControls)n=as(i.cubicControls.control2,n);else switch(i?.type){case 2:case 0:n=[1,1];break;case 3:case 4:n=[.58,1];break;case 1:n=[.25,1];break;case 7:n=[.5,1]}return{control1:r,control2:n}},e.defaultData=function(t,i){return{id:t,name:i,to:5,properties:new Nt}},e.createMaterialGroup=function(t){let i=new Nt;return t.forEach(({data:r,id:n,fi:a})=>{if(r.type==="light"){let s=Jee(["material",`${r.category} lighting`],n,a);i.push(s)}else{let s=Jee(["material",r.type],n,a);i.push(s)}}),i},e.createName=function(t){return Object.entries(t).reduce((i,[r,n])=>(typeof n!="string"&&i.push({name:n.name}),i),[])},e.Presets=[{name:"Slide in",animationParams:{translateX:{value:[-20,0],easing:Hl(3),duration:1e3},opacity:{value:[0,1],easing:Hl(3),duration:1e3},endDelay:250,loop:!0}},{name:"Rotate",animationParams:{rotate:{value:[0,"1turn"],easing:Hl(5),duration:700},endDelay:250,loop:!0}},{name:"Scale Out",animationParams:{scale:{value:[1,1.5],easing:Hl(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:Hl(5),duration:500},endDelay:500,loop:!0}},{name:"Bounce",animationParams:{translateY:{value:["20px","-20px"],duration:575,easing:"easeOutQuad"},direction:"alternate",loop:!0}}],aH=["x","y","z"],d_e=class{constructor(t=1,i=100,r=10,n=0){this.mass=t,this.stiffness=i,this.damping=r,this.initialVelocity=n,this.m_w0=Math.sqrt(i/t),this.m_zeta=r/(2*Math.sqrt(i*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,i=0,r=0;for(;;)if(i+=t,this.solve(i)===1){if(r++,r>=16)break}else r=0;return i*t*1e3}}}),$t=k(()=>{YIe(),QIe(),VIe(),A4(),JIe(),eOe(),bX(),Nr()}),Xm=k(()=>{c_e=[3,4,8,9],Hm=5,vE=3,p_e=32}),PA=k(()=>{le(),bw=e=>{var t;return(t=class extends e{}).geometryHelper=new Nh(30,30,30),t}}),RA=k(()=>{le(),NS=new vm,KC=new Ws,yF=new ke,xw=(e,t,i,r,n=!1,a=e)=>{let s=t,o=a.matrixWorld;if(s.boundingSphere===null&&s.computeBoundingSphere(),KC.copy(s.boundingSphere),KC.applyMatrix4(o),i.ray.intersectsSphere(KC)===!1||(yF.copy(o).invert(),NS.copy(i.ray).applyMatrix4(yF),s.boundingBox!==null&&NS.intersectsBox(s.boundingBox)===!1))return;let l,h,u,d,c,p,m=s.index,f=s.attributes.position,g=s.drawRange;if(n===!1){for(c=Math.max(0,g.start),p=Math.min(m.count,g.start+g.count);c<p;c+=3)if(h=m.getX(c),u=m.getX(c+1),d=m.getX(c+2),l=v(e,i,NS,f,h,u,d),l)return l.faceIndex=Math.floor(c/3),void r.push(l)}else{let y=s.attributes.position,_=new D,b=new D,x=new D,w=new D,S=2,M=1/((a.scale.x+a.scale.y+a.scale.z)/3),T=M*M;for(let A=Math.max(0,g.start),E=Math.min(y.count,g.start+g.count)-1;A<E;A+=S){if(_.fromBufferAttribute(y,A),b.fromBufferAttribute(y,A+1),NS.distanceSqToSegment(_,b,w,x)>T)continue;w.applyMatrix4(a.matrixWorld);let C=i.ray.origin.distanceTo(w);C<i.near||C>i.far||r.push({distance:C,point:x.clone().applyMatrix4(a.matrixWorld),object:e})}}function v(y,_,b,x,w,S,M){let T=new D,A=new D,E=new D,C=new D,N=new D;if(T.fromBufferAttribute(x,w),A.fromBufferAttribute(x,S),E.fromBufferAttribute(x,M),b.intersectTriangle(T,A,E,!1,C)===null)return null;N.copy(C),N.applyMatrix4(y.matrixWorld);let P=_.ray.origin.distanceTo(N);return P<_.near||P>_.far?null:{faceIndex:1,distance:P,point:N.clone(),object:y}}}}),C4=k(()=>{le(),PA(),RA(),ite=new D(1,1,1),_F=new D,rte=new D,bF=new Zt,iw=class extends bw(Vye){constructor(e,t=15){super(t),this.object=e,this.dummy=new yw,this.object.updateMatrixWorld(),this.name=`EmptyObjectHelper: ${e.uuid}`,this.matrix=this.dummy.matrixWorld,this.matrixAutoUpdate=!1,this.object.isBone&&(this.visible=!1)}raycast(e,t){xw(this.object,iw.geometryHelper,e,t,!1,this.dummy)}update(){}updateMatrix(){}updateMatrixWorld(e){this.object.matrixWorld.decompose(_F,bF,rte),this.matrix.compose(_F,bF,ite),super.updateMatrixWorld(e)}updateWorldMatrix(e,t){}}}),tOe=k(()=>{le(),df=new D,cf=new D,up=new ke,xF=[new D(-1,1,1),new D(-1,-1,1),new D(1,-1,1),new D(1,1,1),new D(-1,1,-1),new D(-1,-1,-1),new D(1,-1,-1),new D(1,1,-1)],nte=[[0,3],[1,2],[5,6],[4,7],[0,1],[3,2],[7,6],[4,5],[0,4],[1,5],[2,6],[3,7]],ate=[[0,2],[7,5],[4,1],[3,6],[4,3],[1,6]],wF=(e,t,i)=>{e.updateEntityBoxSize(df,cf),up.copy(t).multiply(e.matrixWorld),cf.x===0&&cf.y===0&&cf.z===0?i.push(new D(df.x,df.y,df.z).applyMatrix4(up)):xF.forEach(r=>{i.push(r.clone().multiply(cf).add(df).applyMatrix4(up))})},sH=class extends fn{constructor(){super(...arguments),this.matrix=new ke,this.vertices=[],this.faces=[],this.edges=[],this.centerEdges=[]}copy(e){return super.copy(e),this.matrix.copy(e.matrix),this.vertices=e.vertices.map(t=>t.clone()),this.faces=e.faces.map(t=>t.clone()),this.edges=e.edges.map(t=>t.clone()),this.centerEdges=e.centerEdges.map(t=>t.clone()),this}setFromObjectSize(e,t=!1){e.updateWorldMatrix(!1,t),this.makeEmpty(),this.matrix.copy(e.matrixWorld);let i=new ke().copy(e.matrixWorld).invert();return this.expandByObjectSize(e,i,t)}expandByObjectSize(e,t,i=!1){let r=[];if(i===!0){let n=[];e.traverseEntity(a=>{if(a.visible||a.cloner&&a.data.visible){if(!("geometry"in a))return up.copy(t).multiply(a.matrixWorld),void n.push(new D().applyMatrix4(up));wF(a,t,r)}}),r.length===0&&r.push(...n)}else wF(e,t,r);return this.setFromPoints(r)}getCenter(e){return(e=super.getCenter(e)).applyMatrix4(this.matrix),e}getPositionToCenter(e){return(e=super.getCenter(e)).applyMatrix4(up.copy(this.matrix).setPosition(0,0,0)),e}computeVertices(){this.getSize(cf).multiplyScalar(.5),this.getCenter(df),up.copy(this.matrix).setPosition(df),this.vertices=xF.map(e=>e.clone().multiply(cf).applyMatrix4(up))}computeEdges(){this.vertices.length>0&&this.computeVertices(),this.edges=nte.map(([e,t])=>new Ch(this.vertices[e],this.vertices[t])),this.centerEdges=this.edges.map(e=>e.getCenter(new D))}computeFaces(){this.vertices.length>0&&this.computeVertices(),this.faces=ate.map(([e,t])=>this.vertices[e].clone().add(this.vertices[t]).multiplyScalar(.5))}}}),nL=k(()=>{Sm={Cloner:null,changeEntityProptotype:()=>{},createEntity:()=>{}}});function yE(e){return e?.isParticleSystem===!0}function t1(e){return e?.isHairSystem===!0}function $g(e){return e?.isShapeBlendEntity===!0}function xX(e){return e?.isPathObject===!0}function Jl(e){return e?.isObject2D===!0}function Xo(e){return e?.isUIObject===!0}function rx(e){return e?.isCloner===!0}function ny(e){return e?.isClone===!0}function nI(e){return e?.isComponentObject===!0}var sa=k(()=>{});function In(e){wX.add(e)}function Ms(e,t){let i=`${e}:${t}`;hH.has(i)||hH.add(i)}function aL(e,t){SX.set(e,t)}function SF(e){return SX.get(e)}function ww(e,t){TX.set(e,t)}function TF(e){return TX.get(e)}function oH(e,t){MX.set(e,t)}function m_e(e){return MX.get(e)}function lH(){return P4}var wX,hH,SX,TX,MX,P4,sL,_r=k(()=>{wX=new Set,hH=new Set,SX=new Map,TX=new Map,MX=new Map,P4=null,sL=null});function f_e(e){let t=e.elements;cd.set(t[0],t[1],t[2]),pd.set(t[4],t[5],t[6]),Cc.set(t[8],t[9],t[10])}function g_e(){let e=Math.max(cd.lengthSq(),pd.lengthSq(),Cc.lengthSq());cd.lengthSq()>wM*e?Eh.copy(cd).normalize():Eh.set(1,0,0),Ah.crossVectors(Cc,Eh),Ah.lengthSq()<=wM*e&&(Ah.copy(pd).addScaledVector(Eh,-pd.dot(Eh)),Ah.lengthSq()<=wM*e&&function(t,i){t.set(1,0,0).cross(i),t.lengthSq()<=wM&&t.set(0,1,0).cross(i),t.normalize()}(Ah,Eh)),Ah.normalize(),ay.crossVectors(Eh,Ah)}function v_e(e){return f_e(e),g_e(),y_e.makeBasis(Eh,Ah,ay)}var cd,pd,Cc,Eh,Ah,ay,y_e,wM,SM,ZC,sy,R4,__e=k(()=>{le(),cd=new D,pd=new D,Cc=new D,Eh=new D,Ah=new D,ay=new D,y_e=new ke,wM=1e-12,SM=.01}),DA=k(()=>{le(),__e(),ZC=new ke,(sy||(sy={})).is=function(e){return e&&e.__isSPEObject},R4=e=>class extends e{constructor(){super(...arguments),this.previousModelViewMatrix=new ke,this.copyPreviousMatrix=!0,this.hiddenMatrix=new ke,this.pivotMatrix=new ke,this.matrixWorldRigid=new ke,this.shearScale=new ke,this.shearScaleInv=new ke}get __isSPEObject(){return!0}getPhysicsLocalMatrix(t){return!!this.rigidBody?.isDynamic()&&(t.copy(this.matrixWorld),this.hasNonUniformScale&&t.multiply(this.shearScaleInv),this.parent&&t.premultiply(ZC.copy(this.parent.matrixWorld).invert()),t.premultiply(ZC.copy(this.hiddenMatrix).invert()),t.multiply(ZC.copy(this.pivotMatrix).invert()),!0)}isDescendantOf(t){t instanceof un&&(t=t.uuid);let i=this;for(;i.parent;){if(i.parent.uuid===t)return!0;i=i.parent}return!1}updateMatrixWorld(t){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||t)&&(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,t=!0);for(let i of this.children)i.updateMatrixWorld(t)}updateWorldMatrix(t,i){let r=this.parent;if(t&&r!==null&&r.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 n of this.children)n.updateWorldMatrix(!1,!0)}traverseChildren(t,i=0){for(let r of this.children)sy.is(r)&&r.traverseObject(t,i+1)}traverseObject(t,i=0){if(t(this,i)!==!0)for(let r of this.children)sy.is(r)&&r.traverseObject(t,i+1)}updateMatrixWorldRigid(){this.hasNonUniformScale=function(t,i,r){return f_e(t),g_e(),i.makeBasis(Eh,Ah,ay),r.set(Eh.dot(cd),Eh.dot(pd),Eh.dot(Cc),0,Ah.dot(cd),Ah.dot(pd),Ah.dot(Cc),0,ay.dot(cd),ay.dot(pd),ay.dot(Cc),0,0,0,0,1),function(){let n=cd.length(),a=pd.length(),s=Cc.length(),o=Math.max(n,a,s);if(o-n>SM||o-a>SM||o-s>SM)return!0;let l=SM*o*o;return Math.abs(cd.dot(pd))>l||Math.abs(cd.dot(Cc))>l||Math.abs(pd.dot(Cc))>l}()}(this.matrixWorld,this.matrixWorldRigid,this.shearScale),this.matrixWorldRigid.copyPosition(this.matrixWorld),this.shearScaleInv.copy(this.shearScale).invert()}attach(t,i){this.updateWorldMatrix(!0,!1);let r=new ke().copy(this.matrixWorld).invert();return t.parent!==null&&(t.parent.updateWorldMatrix(!0,!1),r.multiply(t.parent.matrixWorld)),"hiddenMatrix"in t&&t.hiddenMatrix instanceof ke?t.hiddenMatrix.premultiply(r):t.applyMatrix4(r),t.updateWorldMatrix(!1,!1),this.add(t),i!==void 0&&(this.children.pop(),this.children.splice(i,0,t)),this}copy(t,i=!1){return super.copy(t,i),this.hasNonUniformScale=t.hasNonUniformScale,this}onAfterRender(t,i,r,n,a,s){this.copyPreviousMatrix&&this.previousModelViewMatrix.copy(this.modelViewMatrix)}}});function ste(e,t,i){return wg.subVectors(t,e),lA.subVectors(t,i),wg.cross(lA).length()<=_E}function b_e(e){let t=cH.get(e.points);if(t!==void 0&&t.isClosed===e.isClosed)return t.curve;let i=function(r){let n=r.points,a=[n[0]],s=[new D(...n[0].data.position)];Lv.copy(s[0]);for(let v=0;v<n.length-1;v++)wg.fromArray(n[v].data.position),lA.fromArray(n[v+1].data.position),Ib.subVectors(wg,Lv),Ob.subVectors(wg,lA),Ib.cross(Ob).length()>_E&&(a.push(n[v]),s.push(new D().copy(wg)),Lv.copy(wg));let o=n[n.length-1];a.push(o),s.push(new D(...o.data.position));let l=r.isClosed,h=a.length-(l?0:1),u=a.length,d=[],c=[];for(let v=0;v<u;v++){let y=a[v].data;d.push(new D(...y.controlPrevious.position)),c.push(new D(...y.controlNext.position))}let p=[];for(let v=0;v<h;v++){let y=v===u-1?0:v+1;p.push(ste(s[v],c[v],s[y])&&ste(s[v],d[y],s[y]))}let m=[];for(let v=0;v<u;v++){let y=a[v].data,_=s[v],b={position:_,prevDir:void 0,nextDir:void 0,controlPrevious:d[v],controlNext:c[v],tan:void 0,baseRoundness:y.roundness,removedLength:0};if(m.push(b),y.roundness===0||!l&&(v===0||v===u-1))continue;let x=l&&v==0?u-1:v-1,w=l&&v==u-1?0:v+1,S=new D().subVectors(s[x],_).normalize(),M=new D().subVectors(s[w],_).normalize();b.prevDir=S,b.nextDir=M;let T=p[l&&v===0?u-1:v-1],A=p[v];if(T&&A){Bv.addVectors(S,M).normalize();let E=Lv.crossVectors(Bv,S).length()/S.dot(Bv);b.tan=E,b.removedLength=y.roundness/E}}for(let v=0;v<h;v++){let y=l&&v===u-1?0:v+1,_=m[v],b=m[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 f=new Array(2*u).fill(null);for(let v=0;v<h;v++){let y=l&&v===u-1?0:v+1,_=m[v],b=m[y],x=null;if(p[v]){let w=_.position.clone(),S=b.position.clone();(_.removedLength!==0||b.removedLength!==0)&&(_.nextDir&&w.add(Lv.copy(_.nextDir).setLength(_.removedLength)),b.prevDir&&S.add(Lv.copy(b.prevDir).setLength(b.removedLength))),w.distanceTo(S)>_E&&(x=new uE(w,w.clone().lerp(S,.3),S.clone().lerp(w,.3),S))}else _.position.distanceTo(b.position)>_E&&(x=new uE(_.position,_.controlNext,b.controlPrevious,b.position));f[2*v+1]=x}for(let v=0;v<u;v++){let y=m[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;Bv.addVectors(y.prevDir,y.nextDir).normalize(),Ib.copy(b).lerp(x,.5);let S=b.distanceTo(x)/2;dH.copy(Bv).multiplyScalar(Math.sqrt(Math.pow(w,2)-Math.pow(S,2))).add(Ib),aI.copy(Bv).multiplyScalar(-w).add(dH);let M=_.distanceTo(aI)/_.distanceTo(Ib);Ob.copy(y.prevDir).multiplyScalar(M*_.distanceTo(b)).add(_),uH.copy(Ob).lerp(aI,2);let T=b.clone().lerp(Ob,4/3),A=x.clone().lerp(uH,4/3);f[2*v]=new uE(b,T,A,x)}let g=new x_e;for(let v=0;v<f.length;v++){let y=f[v];y&&g.add(y)}return g}(e);return cH.set(e.points,{isClosed:e.isClosed,curve:i}),i}var x_e,_E,wg,lA,Lv,Bv,Ib,aI,Ob,uH,dH,cH,hr,xc,ote,lte,W1,MF,QC,JC,hte,EF,AF,D4,pH,u1,Pc,w_e=k(()=>{le(),x_e=class extends r7{constructor(){super()}getPoints(e=12){let t,i=[],r=this.getCurveLengths(),n=r[r.length-1]/r.length;for(let a=0,s=this.curves;a<s.length;a++){let o=s[a],l=a===0?r[a]:r[a]-r[a-1],h=Math.ceil(e*l/n),u=o.getPoints(h);for(let d=0;d<u.length;d++){let c=u[d];t&&t.equals(c)||(i.push(c),t=c)}}return this.autoClose&&i.length>1&&!i[i.length-1].equals(i[0])&&i.push(i[0]),i}},_E=.001,wg=new D,lA=new D,Lv=new D,Bv=new D,Ib=new D,aI=new D,Ob=new D,uH=new D,dH=new D,cH=new WeakMap}),xl=k(()=>{le(),$t(),tOe(),Nr(),nL(),sa(),_r(),DA(),w_e(),kr(),(hr||(hr={})).is=function(e){return e&&e.__isEntity},xc=e=>hr.is(e),ote={type:"completeState",isfromEntity:!0},lte=["x","y","z"],W1=new D,MF=new D(1,1,1),QC=new Zt,JC=new pn,hte=new D().set(0,1,0),EF=new ke,AF=new ke,D4=e=>class extends R4(e){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.currentTransitionEvent=null,this.previousAction=null,this._singleBBox=new sH,this._recursiveBBox=new sH,this.singleBBoxNeedsUpdate=!0,this.recursiveBBoxNeedsUpdate=!0,this._needApplyPathSnapping=!0,this.attachedPaths=new Set}get __isEntity(){return!0}entityChildren(t){let i=this.children[t];if(hr.is(i))return i}entityChildrenCount(){let t=this.children.length;for(;t--;)if(hr.is(this.children[t]))return t+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 t=this;for(;t.data.type!=="Instance";){let i=t.parent;if(!hr.is(i))return;t=i}return t}forInstancesRec(t){this.instances.forEach(i=>{i.disposed||t(i),i.forInstancesRec(t)})}super_Entity(t,i){typeof t=="string"&&(this.uuid=t),this.identity=t,this.data=i,this.matrixAutoUpdate=!1,this.dataPatched=this.data}changeSelectedState(t,i,r=!1){if(this.data.states.length!==0||r){for(let n of this.data.states)Rg.toOps(this.data,n.data).forEach(a=>{let s=IO.replaceProps(a,this.data);this.dataPatched=this.data,this.updateByPatchedOp(s,this.data,i)});if(t!==null){let n=this.data.states.data(t);n&&(this.dataPatched=Rg.patch(this.data,n),Rg.toOps(this.data,n).forEach(a=>{this.updateByPatchedOp(a,this.dataPatched,i)}))}r&&this.updateTransformState(this.dataPatched,i),this.stateSelection=t,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(t,i){t.setScalar(0),i.setScalar(0)}resetBBoxNeedsUpdateSelf(){this.singleBBoxNeedsUpdate=!0,this.recursiveBBoxNeedsUpdate=!0}resetBBoxNeedsUpdate(){this.resetBBoxNeedsUpdateSelf(),this.traverseAncestors(t=>{xc(t)&&t.resetBBoxNeedsUpdateSelf()}),this.traverseEntity(t=>{t.resetBBoxNeedsUpdateSelf()})}find(t){let i;return this.traverseEntity(r=>{r.uuid===t&&(i=r)}),i}traverseSortNextHelper(){let t=this.parent;if(t){let i=t.children,r=i.indexOf(this)+1;if(hr.is(i[r]))return i[r];if(hr.is(t))return t.traverseSortNextHelper()}}sortNext(){let t=this.children;return this.children.length>0&&hr.is(this.children[0])?t[0]:this.traverseSortNextHelper()}goUp(t){let i=this;for(;t>0&&i!==null;)i=i.parent,t-=1;return i}hasAnccestorOrSelf(t){return this===t||this.hasAnccestor(t)}hasAnccestor(t){let i=this.parent;for(;i;){if(t===i)return!0;i=i.parent}return!1}countToAccestor(t){let i=0,r=this;for(;r!==t;){if(r===null)return-1;r=r.parent,i+=1}return i}forEachEntity(t){for(let i of this.children)xc(i)&&t(i)}traverseEntityAncestors(t){this.traverseAncestors(i=>{hr.is(i)&&t(i)})}traverseConcreteEntity(t,i=0){if(t(this,i)!==!0)for(let r of this.children)xc(r)&&r.isConcreteEntity&&r.traverseEntity(t,i+1)}traverseEntity(t,i=0){if(t(this,i)!==!0)for(let r of this.children)xc(r)&&r.traverseEntity(t,i+1)}traverseVisibleEntity(t){t(this);for(let i of this.children)xc(i)&&i.visible&&i.traverseVisibleEntity(t)}updateMatrix(){super.updateMatrix(),this.cloner&&this.cloner.onObjUpdateMatrix(),this.dispatchEvent({type:"updateMatrix"})}updateMatrixWorld(t){super.updateMatrixWorld(t),this.dispatchEvent({type:"updateMatrixWorld"})}copy(t,i=!1){return super.copy(t,i),this.dataPatched=t.dataPatched,this.raycastLock=t.raycastLock,this.scaleLock=t.scaleLock,this.hiddenMatrix.copy(t.hiddenMatrix),this}hasEntityChild(){return this.children.some(t=>xc(t))}isAncestorOf(t){if(this.uuid===t)return!1;let i=!1;return this.traverseEntity(r=>{r.uuid===t&&(i=!0)}),i}toObjectTransformState(t=[]){return this.updateWorldMatrix(!0,!1),M7({position:this.position.toArray(),rotation:[this.rotation.x*ht.RAD2DEG,this.rotation.y*ht.RAD2DEG,this.rotation.z*ht.RAD2DEG],scale:this.scale.toArray(),hiddenMatrix:this.hiddenMatrix.toArray(),pivot:[0,0,0],pivotRotation:[0,0,0]},t)}getTransformValues(t,i,r){return i[t].map((n,a)=>r?.shared.getVariable(n,[this.uuid,t,lte[a]])??n)}updateTransformState(t,i){let r=!1;if(t.position&&(this.position.fromArray(this.getTransformValues("position",t,i)),r=!0),t.rotation&&(W1.fromArray(this.getTransformValues("rotation",t,i)).multiplyScalar(ht.DEG2RAD),this.rotation.setFromVector3(W1),r=!0),t.scale&&(this.scale.fromArray(this.getTransformValues("scale",t,i)),r=!0),t.hiddenMatrix!==void 0&&(r=!0,this.hiddenMatrix.fromArray(t.hiddenMatrix??yy.identity)),t.pivot!==void 0||t.pivotRotation!==void 0){if(r=!0,t.pivot!==void 0&&t.pivotRotation!==void 0)this.pivotMatrix.compose(W1.fromArray(t.pivot).negate(),QC.setFromEuler(JC.fromArray(t.pivotRotation.map(n=>n*ht.DEG2RAD))).invert(),MF);else if(t.pivot!==void 0)this.pivotMatrix.setPosition(-t.pivot[0],-t.pivot[1],-t.pivot[2]);else if(t.pivotRotation!==void 0){let n=W1.setFromMatrixPosition(this.pivotMatrix);QC.setFromEuler(JC.fromArray(t.pivotRotation.map(a=>a*ht.DEG2RAD))).invert(),this.pivotMatrix.compose(n,QC,MF)}}return r&&(this.updateMatrix(),this.resetBBoxNeedsUpdate(),this.invalidateClonerTransform(this),this.traverseEntityAncestors(n=>{n.invalidateClonerTransform(this)})),t.position&&t.rotation&&t.scale&&t.hiddenMatrix!==void 0&&this.updateWorldMatrix(!1,!0),r}onVariableUpdate(t=!1){t?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 t of this.children)hr.is(t)&&t.disposeRecursively()}disposeRecursively(){this.dispose(),this.children.forEach(t=>{hr.is(t)&&t.disposeRecursively()})}toState(t=[]){return M7({name:this.name,visible:this.visible,raycastLock:this.raycastLock,...this.toObjectTransformState(t)},t)}updateByObjUpdateOp(t,i){t!==void 0&&this.updateByOp({type:0,props:t,path:[]},{...this.data,...t},i,!1)}updateByOp(t,i,r,n){let a=this.data;this.data=i;let s=t,o=Qr(t.path,["states","*"]);if(o!==null){if(t.type===0){let[l]=o;if(this?.stateSelection===l){let h={...t.props};if(delete h.name,Object.values(t.props).some(u=>u===void 0)){let u=this.data;if(u!==void 0){let d=Ts.zoom(u,t.path.slice(2));if(d)for(let c in t.props)t.props[c]===void 0&&c in d&&(h[c]=d[c])}}s={...t,props:h,path:t.path.slice(2)}}}}else if(t.type===0){let l=this.stateSelection?this.data.states.data(this.stateSelection):void 0;if(l!==void 0){if(t.props.name!==void 0&&l.name){let{name:u,...d}=l;l=d}if(t.props.material!==void 0&&"material"in l){let{material:u,...d}=l;l=d}let h=Ts.removeOverridden(t.path,t.props,l);s={...t,props:h}}}if(this.updateByPatchedOpBase(s,Rg.patch(this.data,this.stateSelection?this.data.states.data(this.stateSelection):void 0),r),Qr(t.path,["overrides"])){let l=[],h=[...t.path];for(l.push(h[1]),h.splice(0,2);h.length>0&&h[0]==="descendants";)l.push(h[1]),h.splice(0,2);if(l[l.length-1]===void 0){if(t.type===0)for(let u of Object.keys(t.props)){l[l.length-1]=u;let d=r.scene.findInstance([this.uuid,...l]);d&&(d.overrideData=t.props[u],d.updateState(Ug.apply(d.component.data,d.overrideData),r))}}else{let u=r.scene.findInstance([this.uuid,...l]);if(u){let d=Ts.zoom(u.component.data,h);if((t={...t,path:h}).type===0){let c=t.props;if(d)for(let[p,m]of Object.entries(t.props))m===void 0&&(c===t.props&&(c={...t.props}),c[p]=d[p]);t={...t,props:c}}u.overrideData=JO.resolve(i.overrides,l),u.updateByOp(t,$s.applySimple(u.data,t),r,!1)}}}else if(this.instances.length>0){let l;if(t.path.length===0&&t.type===0){let h;for(let u of xm.rootOverrideProps)u in t.props&&(h===void 0&&(h={}),h[u]=t.props[u]);h&&(l={...t,props:h})}else for(let h of xm.rootOverrideProps)if(Qr(t.path,[h])){l=t;break}l!==void 0&&this.instances.forEach(h=>{if(h.isInstanceRoot){let u=Ug.filterOp(h.overrideData,l);u&&h.updateByOp(u,$s.applySimple(h.data,u),r,!0)}}),this.instances.forEach(h=>{if(!h.isInstanceRoot){let u=Ug.filterOp(h.overrideData,t);if(u){let d;d=a===h.data&&t===u?i:$s.applySimple(h.data,u),h.updateByOp(u,d,r,!0)}}})}}updateByPatchedOpBase(t,i,r){if(this.dataPatched=i,t.path.length===0&&t.type===0)t.props.type!==void 0&&!e1.is(t.props.type)&&Sm.changeEntityProptotype(this,i,r);else if(t.path.length===1&&t.path[0]==="geometry"&&t.type===0&&"type"in t.props){Sm.changeEntityProptotype(this,i,r);for(let n of this.children)hr.is(n)&&n.updateVisible(r.scene)}this.updateByPatchedOp(t,i,r)}updateByPatchedOp(t,i,r){if(t.path.length===0&&t.type===0?this.updateState(t.props,r):t.type===0&&("resolutionLevel"in t.props||"useChildrenColors"in t.props)&&this.updateState(i,r),t.path[0]==="morphTargetInfluences"&&t.type===0){let n=i.morphTargetInfluences.get(t.path[1])?.data.name;n&&this.updateMorphInfluences(n,r.shared.getVariable(t.props.value,[this.uuid,"morphTargetInfluences",n]))}if(Qr(t.path,["pathSnapping"])!==null&&this.updatePathSnapping(i.pathSnapping),Qr(t.path,["cloner"])!==null){let n=$s.drop(t,1);n.path.length===0&&n.type===0&&n.props.disabled===!0?this.setFromClonerState(null,r):this.cloner?this.cloner.updateState(i.cloner,r):(this.setFromClonerState(i.cloner,r),this.expandCloner(r)),this.updateVisible(r.scene)}}updatePathSnapping(t=this.dataPatched.pathSnapping){this._updatedPathSnapping=t,this._needApplyPathSnapping=!0}get updatedPathSnapping(){return this._updatedPathSnapping}applyPathSnapping(t){if(this._needApplyPathSnapping===!1)return;let i=this._updatedPathSnapping?.pathId??this.dataPatched.pathSnapping.pathId,r=this._updatedPathSnapping?.slide??this.dataPatched.pathSnapping.slide??0,n=this._updatedPathSnapping?.offset??this.dataPatched.pathSnapping.offset??0,a=this._updatedPathSnapping?.orientation??this.dataPatched.pathSnapping.orientation;if(i===null)return;let s=t.find(i);if(!s)return;this._needApplyPathSnapping=!1;let o=s.data;if(o.geometry.path.points.length<=1)return;let l=b_e(o.geometry.path),h=(r+n)%1;r+n===1&&h===0&&(h=1);let u=null;try{u=l.curves.length?l.getPointAt(h):null}catch{}if(u===null)return;s.updateMatrixWorld();let d=this.parent?EF.copy(this.parent.matrixWorld).invert():EF.identity();d.multiply(s.matrixWorld),u.applyMatrix4(d);let c={position:u.toArray(),rotation:o.rotation};if(a==="tangential"){let p=AF.extractRotation(s.matrixWorld),m=l.getTangentAt(h).applyMatrix4(p).add(u),f=AF.lookAt(u,m,hte),g=W1.setFromEuler(JC.setFromRotationMatrix(f)).multiplyScalar(ht.RAD2DEG);c={...c,rotation:g.toArray()}}this.updateTransformState(c),this.traverseEntity(p=>{p._cameraType&&p.dispatchEvent(ote)})}updateVisible(t){if(this.visible=this.dataPatched.visible&&(!this.dataPatched.cloner||(this.dataPatched.cloner.disabled??!1)||this.dataPatched.cloner?.hideBase!==!0),!t)return;let i=!1;this.traverseEntity(r=>{if(r.data.type==="Splat")return i=!0,!0}),i&&t.reloadSplats()}updateState_Entity(t,i){t.name!==void 0&&(this.name=t.name),t.raycastLock!==void 0&&(this.raycastLock=t.raycastLock),t.visible!==void 0&&(this.updateVisible(i?.scene),this.resetBBoxNeedsUpdate()),i&&"cloner"in t&&t.cloner!==void 0&&(this.setFromClonerState(t.cloner,i),this.updateVisible(i.scene)),this.updateTransformState(t,i)}get attachedSurfaceCloners(){return this.children.filter(t=>rx(t)&&t.parameters.type==="toObject")}setFromClonerState(t,i){if(!this.disposed)if(t===null||t.disabled)this.cloner&&this.cloner.dispose(),this.cloner=void 0;else if(this.cloner===void 0){if(Sm.Cloner===null)return void Ms("cloners","a cloner");this.cloner=new Sm.Cloner(this,t),i.scene.addPendingExpandCloner(this)}else this.cloner.updateState(t,i)}expandCloner(t){!this.disposed&&this.cloner&&this.cloner.expandClones(t)}invalidateClonerTransform(t){this.cloner&&this.cloner.invalidateTransform(t)}requestRender(){this.dispatchEvent({type:"requestRender"})}}}),d1=k(()=>{le(),xl(),(pH||(pH={})).is=e=>"objectHelper"in e,u1=(e,t)=>class extends D4(e){constructor(){super(...arguments),this.objectHelper=new t(this),this.gizmos={}}get geometryHelper(){return t.geometryHelper}raycast(i,r){this.objectHelper.raycast(i,r)}showGizmos(){for(let i in this.gizmos){let r=this.gizmos[i];r instanceof JE&&(r.visible=!0)}}updateEntityBoxSize(i,r){this.objectHelper.visible&&this.geometryHelper instanceof Nh?(i.setScalar(0),r.set(this.geometryHelper.parameters.width,this.geometryHelper.parameters.height,this.geometryHelper.parameters.height).multiplyScalar(.5)):super.updateEntityBoxSize(i,r)}hideGizmos(){for(let i in this.gizmos){let r=this.gizmos[i];r instanceof JE&&(r.visible=!1)}}}}),N4=k(()=>{le(),C4(),d1(),Pc=class extends u1(yw,iw){constructor(e,t){super(),this.super_Entity(e,t),this.objectHelper.update(),this.data.type==="Empty"&&(this.objectHelper.visible=!1)}updateState(e,t){this.updateState_Entity(e,t),"buffer"in e&&Object.keys(e).length===1&&t.scene.reloadSplats()}}});function Du(e,t,i,r,n,a,s){TM.set(n,a,s).unproject(r);let o=t[e];if(o!==void 0){let l=i.getAttribute("position");for(let h=0,u=o.length;h<u;h++)l.setXYZ(o[h],TM.x,TM.y,TM.z)}}var TM,sh,ute,S_e,iOe=k(()=>{le(),PA(),RA(),TM=new D,sh=new Eg,ute=class extends Ab{constructor(e){let t=new At,i=new ld({color:16777215,vertexColors:!0,toneMapped:!1}),r=[],n=[],a={},s=new ot(15711266),o=new ot(15711266),l=new ot(2857471);function h(d,c,p){u(d,p),u(c,p)}function u(d,c){r.push(0,0,0),n.push(c.r,c.g,c.b),a[d]===void 0&&(a[d]=[]),a[d].push(r.length/3-1)}h("n1","n2",s),h("n2","n4",s),h("n4","n3",s),h("n3","n1",s),h("f1","f2",s),h("f2","f4",s),h("f4","f3",s),h("f3","f1",s),h("n1","f1",s),h("n2","f2",s),h("n3","f3",s),h("n4","f4",s),h("p","n1",o),h("p","n2",o),h("p","n3",o),h("p","n4",o),h("u1","u2",l),h("u2","u3",l),h("u3","u1",l),t.setAttribute("position",new Et(r,3)),t.setAttribute("color",new Et(n,3)),super(t,i),this.type="CameraHelper",this.camera=e,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=a,this.update()}update(){let e=this.geometry,t=this.pointMap;sh.projectionMatrixInverse.elements=[.5112609807824982,-0,-0,-0,-0,.41421356237309503,-0,-0,-0,-0,-0,-.099999,-0,-0,-1.0000000000000002,.100001];let i=.8;Du("n1",t,e,sh,-1,-1,i),Du("n2",t,e,sh,1,-1,i),Du("n3",t,e,sh,-1,1,i),Du("n4",t,e,sh,1,1,i);let r=i;Du("f1",t,e,sh,-1,-1,r),Du("f2",t,e,sh,1,-1,r),Du("f3",t,e,sh,-1,1,r),Du("f4",t,e,sh,1,1,r);let n=r;Du("u1",t,e,sh,.35,1.1,n),Du("u2",t,e,sh,-.35,1.1,n),Du("u3",t,e,sh,0,1.55,n),e.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}},S_e=class extends bw(ute){constructor(e){super(e),this.object=e,this.name=`CombinedCameraHelper: ${e.uuid}`}updateMatrixWorld(e){super.updateMatrixWorld(e),this.updateTarget()}updateTarget(){let e=this.object.getTarget();this.updateWorldMatrix(!0,!1),this.worldToLocal(e)}raycast(e,t){xw(this.object,this.geometry,e,t,!0)}}});function dte(e){return 1-Math.pow(1-e,3)}var N0,e3,t3,i3,q1,r3,Xd,na,Uh=k(()=>{le(),iOe(),$t(),d1(),kr(),N0=new D,e3=new D,t3=new Zt,i3=new D,q1=new D,r3=new D,Xd=class extends u1(Eg,S_e){constructor(e="",t={...fE.defaultData,name:""}){super(),this._cameraType="OrthographicCamera",this.targetOffset=bm.DefaultTargetOffset,this.isUpVectorFlipped=!1,this.angleOffsetFromUp=0,this.wasMovedByUser=!1,this.wasMovedBySwitchCameraAction=!1,this._createdAt=typeof performance<"u"?performance.now():0,this._tickProjectionTransition=()=>{let n=this._projectionTransition;if(n===void 0)return;if(this.disposed)return void this._endProjectionTransition();n.raf=requestAnimationFrame(this._tickProjectionTransition);let a=Xd.projectionTransitionRequestRender??n.requestRender;this.updateProjectionMatrix(),a?.()},this.super_Entity(e,t),this.previousProjectionMatrix=new ke,this.matrixAutoUpdate=!0,this.width=window.innerWidth,this.height=window.innerHeight;let i=this.width,r=this.height;this.orthoCamera=new qg(-.5*i,.5*i,.5*r,-.5*r,-5e4,1e4),this.perspCamera=new wh(45,i/r,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(e){let t=Xd.projectionTransitionsEnabled;Xd.projectionTransitionsEnabled=!1;try{return e()}finally{Xd.projectionTransitionsEnabled=t}}get isPerspectiveCamera(){return this.cameraType==="PerspectiveCamera"}get isOrthographicCamera(){return!this.isPerspectiveCamera}get cameraType(){return this._cameraType}set fov(e){this.perspCamera.fov=e}get fov(){return this.perspCamera.fov}setNear(e,t){e==="PerspectiveCamera"?this.perspCamera.near=t:this.orthoCamera.near=t}setZoom(e,t){t>=0&&(e==="PerspectiveCamera"?this.perspCamera.zoom=t:this.orthoCamera.zoom=t)}set cameraType(e){e==="PerspectiveCamera"?this.toPerspective():e==="OrthographicCamera"&&this.toOrthographic()}get near(){return this._cameraType==="PerspectiveCamera"?this.perspCamera.near:this.orthoCamera.near}set near(e){this._cameraType==="PerspectiveCamera"?this.perspCamera.near=e:this.orthoCamera.near=e}get zoom(){return this._cameraType==="PerspectiveCamera"?this.perspCamera.zoom:this.orthoCamera.zoom}set zoom(e){e>=0&&(this._cameraType==="PerspectiveCamera"?this.perspCamera.zoom=e:this.orthoCamera.zoom=e)}lookAt(e,t,i){typeof e=="number"&&(e=new D(e,t,i)),super.lookAt(e),this.getWorldPosition(N0),this.targetOffset=N0.distanceTo(e)}getTarget(e=new D){return this.getWorldDirection(e3),this.getWorldPosition(N0),e3.multiplyScalar(this.targetOffset),e.copy(N0).add(e3),e}getDistanceToTarget(){let e=this.getTarget();return this.getWorldPosition(N0),N0.distanceTo(e)}updateUp(){this.getWorldQuaternion(t3),i3.set(0,0,1).applyQuaternion(t3),q1.copy(un.DEFAULT_UP),this.isUpVectorFlipped&&q1.negate(),q1.applyQuaternion(t3),r3.copy(un.DEFAULT_UP).projectOnPlane(i3),this.angleOffsetFromUp=r3.angleTo(q1),this.angleOffsetFromUp*=r3.cross(q1).dot(i3)>=0?1:-1}updateTransformState(e,t){let i=super.updateTransformState(e,t);return e.isUpVectorFlipped!==void 0&&(this.isUpVectorFlipped=e.isUpVectorFlipped),this.updateUp(),i}getViewFrontToObject(e){let t=e.getWorldPosition(new D),i=e.getWorldDirection(new D).multiplyScalar(this.targetOffset);return{position:t.clone().add(i),target:t}}getViewToTarget(e){let t=this.getWorldDirection(new D).multiplyScalar(this.targetOffset);return{position:e.clone().sub(t),target:e}}getViewToObject(e){let t=new D;return e.getWorldPosition(t),this.getViewToTarget(t)}setViewplaneSize(e,t,i=!1){if(this.aspect=e/t,i){let r=e>t?this.aspect:1,n=e>t?1:this.aspect;this.left=-395*r,this.right=395*r,this.top=1/n*395,this.bottom=1/n*-395}else this.left=.5*-e,this.right=.5*e,this.top=.5*t,this.bottom=.5*-t;this.updateProjectionMatrix()}copyViewPlaneSize(e){this.aspect=e.aspect,this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.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 e=this._projectionTransition;if(e===void 0)return 1;let t=(performance.now()-e.start)/e.duration;return t>=1?1:t<=0?0:dte(t)}get _activeSubCamera(){return this._cameraType==="PerspectiveCamera"?this.perspCamera:this.orthoCamera}_canAnimateProjection(){return Xd.projectionTransitionsEnabled&&typeof requestAnimationFrame=="function"&&typeof performance<"u"&&performance.now()-this._createdAt>=Xd.projectionTransitionMinAgeMs}_beginProjectionTransition(e){let t=this._projectionTransition;t===void 0&&(t={from:new ke,blend:new ke,blendInverse:new ke,start:0,duration:Xd.projectionTransitionDuration,referenceDepth:1,raf:0,requestRender:e},this._projectionTransition=t),t.from.copy(this.projectionMatrix),t.start=performance.now(),t.duration=Xd.projectionTransitionDuration,t.referenceDepth=Number.isFinite(this.targetOffset)?Math.max(1,this.targetOffset):1,e&&(t.requestRender=e),t.raf!==0&&cancelAnimationFrame(t.raf),t.raf=requestAnimationFrame(this._tickProjectionTransition)}_applyProjectionTransition(){let e=this._projectionTransition;if(e===void 0)return;let t=(performance.now()-e.start)/e.duration;if(t>=1)return void this._endProjectionTransition();let i=dte(t),r=e.from.elements,n=this._activeSubCamera.projectionMatrix.elements,a=e.blend.elements,s=e.referenceDepth,o=Math.max(1e-6,r[15]-r[11]*s),l=i*o/(i*o+(1-i)*Math.max(1e-6,n[15]-n[11]*s));for(let h=0;h<16;h++)a[h]=r[h]+(n[h]-r[h])*l;e.blendInverse.copy(e.blend).invert(),this.projectionMatrix=e.blend,this.projectionMatrixInverse=e.blendInverse}_endProjectionTransition(){let e=this._projectionTransition;if(e===void 0)return;e.raf!==0&&cancelAnimationFrame(e.raf),this._projectionTransition=void 0;let t=this._activeSubCamera;this.projectionMatrix=t.projectionMatrix,this.projectionMatrixInverse=t.projectionMatrixInverse}_syncProjectionTransition(e){let t=e._projectionTransition;if(t===void 0)return void(this._projectionTransition!==void 0&&this._endProjectionTransition());let i=this._projectionTransition;i===void 0?(i={from:new ke,blend:new ke,blendInverse:new ke,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(t.from),i.start=t.start,i.duration=t.duration,i.referenceDepth=t.referenceDepth,this._applyProjectionTransition()}setFocalLength(e){this.perspCamera.setFocalLength(e),this.toPerspective()}getFocalLength(){return this.perspCamera.getFocalLength()}getEffectiveFOV(){return this.perspCamera.getEffectiveFOV()}getFilmWidth(){return this.perspCamera.getFilmWidth()}getFilmHeight(){return this.perspCamera.getFilmHeight()}setViewOffset(e,t,i,r,n,a){this._cameraType==="PerspectiveCamera"?this.perspCamera.setViewOffset(e,t,i,r,n,a):this.orthoCamera.setViewOffset(e,t,i,r,n,a),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(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}copy(e,t){return super.copy(e,t),this.parent=e.parent,this.orthoCamera.copy(e.orthoCamera),this.perspCamera.copy(e.perspCamera),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.far=e.far,this.view=e.view===null?null:Object.assign({},e.view),this._cameraType=e._cameraType,this.aspect=e.aspect,this.fov=e.fov,this.focus=e.focus,this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this.targetOffset=bm.sanitizeTargetOffset(e.targetOffset),this.updateProjectionMatrix(),this._syncProjectionTransition(e),this}toCameraState(e=[]){return M7({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},e)}updateCameraSubtype(e,t){let i=e==="perspective"?"PerspectiveCamera":"OrthographicCamera";t.zoom!==void 0&&this.setZoom(i,t.zoom),t.near!==void 0&&this.setNear(i,t.near),t.fov!==void 0&&i==="PerspectiveCamera"&&(this.fov=t.fov)}updateState(e,t){this.updateCameraState(e,t)}updateCameraState(e,t){this.updateState_Entity(e,t),e.far!==void 0&&(this.far=e.far),e.orthographic!==void 0&&this.updateCameraSubtype("orthographic",e.orthographic),e.perspective!==void 0&&this.updateCameraSubtype("perspective",e.perspective),e.type!==void 0&&(e.type!==this._cameraType&&this._canAnimateProjection()&&this._beginProjectionTransition(t?.shared.requestRender),this.cameraType=e.type),e.up!==void 0&&this.up.fromArray(e.up.map(i=>typeof i=="number"?i:0)),e.targetOffset!==void 0&&(this.targetOffset=bm.sanitizeTargetOffset(e.targetOffset)),e.isUpVectorFlipped!==void 0&&(this.isUpVectorFlipped=e.isUpVectorFlipped),this.updateProjectionMatrix()}updateByPatchedOp(e,t,i){super.updateByPatchedOp(e,t,i),e.path.length===1&&e.type===0&&this.updateCameraSubtype(e.path[0],e.props)}toState(e){return{...super.toState(e),...this.toCameraState(e),type:this.cameraType}}},(na=Xd).projectionTransitionsEnabled=!1,na.projectionTransitionDuration=350,na.projectionTransitionMinAgeMs=1e3});function T_e(e){return e.type==="TorusGeometry"&&e.arc===360}var M_e,n3,mH,hA=k(()=>{le(),M_e=class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=Object.assign({},t?.parameters??{width:100,revolutions:2,segments:40,pathRadius:10,pathType:0,pathSegments:30,cornerRadius:30,cornerSegments:4},e.parameters),r=Math.abs(i.width),n=Math.abs(i.height??r),a=Math.abs(i.depth??r),s=Math.abs(Math.min(r,a))/2;return{parameters:Object.assign(i,{width:r,height:n,depth:a,radius:s,segments:Math.round(i.segments),pathSegments:Math.round(i.pathSegments),cornerSegments:Math.round(i.cornerSegments)})}}static build(e){let{width:t,height:i,depth:r,radius:n,revolutions:a,segments:s,pathRadius:o,pathType:l,pathSegments:h,cornerRadius:u,cornerSegments:d}=e.parameters,c=new mH(!1,t,i,r,n,a,s,o,l,h,u,d);return Object.assign(c,{userData:{...e,type:"HelixGeometry"}})}},n3=new zm([0,0,0],1),mH=class extends At{constructor(e=!0,t=1,i=1,r=1,n=1,a=1,s=1,o=1,l=1,h=1,u=1,d=1){if(super(),a===0)return;let c=e&&a===1;c&&(d=0),u>100&&(u=100),u===0&&(d=0);let p,m,f,g,v,y,_,b,x=()=>new D,w=new D,S=x(),M=x(),T=x(),A=x(),E=x(),C=x(),N=x(),P=x(),I=x(),L=x(),B=x(),G=i-2*o+.001,j=G/a,$=Math.ceil(s*a),H=$+1,te=G/$,ue=-G/2,ae=h+1,de=2*Math.PI/h,ye=Math.PI/2/d,Z=Math.min((1-u/100)*o,o-.01),fe=o-Z,W=0,z=2*d+2,Y=ae*z/2,ne=Y+ae*H,V=Math.max(0,ae*(H+z)),[Q,ie,q]=[3,3,2].map(dt=>Array(V*dt).fill(0)),he=[],me=n-o;function Ee(dt,et){let Xt=Math.PI/2;y=et*te,b=2*Math.PI*(y%j)/j+Xt,y+=ue,_=Math.sin(b)*me,v=Math.cos(b)*me,e?dt.set(v,_,y):dt.set(v,y,_)}Ee(w,-1e-10),Ee(S,0),A.copy(w),Ee(w,1);let Se=w.distanceTo(S),qe=c?0:fe+Z,Ne=Se*$+2*qe,He=Z,Pe=Ne-qe;for(let dt=0;dt<=$;dt++){Ee(M,dt),B.subVectors(M,A).normalize(),A.copy(M),I.copy(M).setComponent(+e+1,0).normalize(),L.crossVectors(B,I).normalize();let et=dt===0,Xt=dt===$,si=et?3*Math.PI/2:ye,sr=et?He:Pe,St=et?ae:ne,Dt=et?0:V-ae,Qt=B.clone().multiplyScalar(et?-fe:fe).add(M),Ci=B.clone().multiplyScalar(et?-1:1).normalize();for(let wi=0;wi<ae;wi++){let fi=wi*de;if(E.addVectors(w.copy(I).multiplyScalar(o*Math.cos(fi)),S.copy(L).multiplyScalar(o*Math.sin(fi))),C.copy(E).normalize(),et||Xt){c||(W=Dt+wi,[0,1,2].forEach(Pi=>{Q[3*W+Pi]=Qt.getComponent(Pi),ie[3*W+Pi]=Ci.getComponent(Pi)}),q[2*W]=+Xt,q[2*W+1]=wi/h),S.copy(C).multiplyScalar(Z),T.addVectors(M,S);for(let Pi=0;Pi<d;Pi++){let Ir=Pi*ye+si;N.addVectors(w.copy(B).multiplyScalar(fe*Math.sin(Ir)),S.copy(C).multiplyScalar(fe*Math.cos(Ir))),P.copy(N).normalize(),S.addVectors(T,N),N.normalize(),W=St+Pi*ae+wi,[0,1,2].forEach(ir=>{Q[3*W+ir]=S.getComponent(ir),ie[3*W+ir]=P.getComponent(ir)});let Wr=+et+Math.sin(Ir);q[2*W]=(sr+fe*Wr)/Ne,q[2*W+1]=wi/h}}S.addVectors(M,E),W=Y+dt*ae+wi,[0,1,2].forEach(Pi=>{Q[3*W+Pi]=S.getComponent(Pi),ie[3*W+Pi]=C.getComponent(Pi)}),q[2*W]=(qe+dt*Se)/Ne,q[2*W+1]=wi/h}}let ee=H+2*d+2,[Me,We]=[+c,ee-1];for(let dt=Me;dt<=We-1;dt++){let et=c&&dt===We-1;for(let Xt=0;Xt<ae-1;Xt++)p=dt*ae+Xt,m=p+1,f=(et?Xt:p)+ae,g=(et?Xt+1:m)+ae,dt===0?he.push(m,g,f):dt===ee-2?he.push(p,m,f):he.push(p,m,f,m,g,f)}this.setIndex(he),this.setAttribute("position",new Et(Q,3)),this.setAttribute("normal",new Et(ie,3)),this.setAttribute("uv",new Et(q,2))}getClosedTorusIndicesForBooleanOrSubdiv(){let e,t,i,r,n=this.userData.parameters,a=Math.ceil(n.tubularSegments),s=n.radialSegments,o=s+1,l=[];for(let h=1;h<a;h++)for(let u=0;u<s;u++)e=h*o+u,t=e+1,i=e+o,r=t+o,l.push(e,t,i,t,r,i);for(let h=0;h<s;h++)e=a*o+h,t=e+1,i=h+o,r=h+1+o,l.push(e,t,i,t,r,i);return n3.array=new Uint32Array(l),n3.count=l.length,n3}}});function rOe(e){return pte||(pte=async function(){let t=e??"https://cdn.spline.design/@splinetool/runtime@2.0.13/build",i=import("./boolean.js"),[r,n]=await Promise.all([i,fetch(`${t}/boolean.wasm`).then(a=>a.arrayBuffer())]);await r.default({module_or_path:n}),uA=r}())}function oL(){if(uA===void 0)throw new Error("boolean-wasm is not loaded");return uA}function EX(e){let t=dA.get(e);if(t===void 0)throw new Error("Unknown csg mesh set handle "+e);return t}function AX(e){return dA.set(++fH,e),fH}function nOe(e,t,i){if(uA===void 0)return-1;let{positions:r,indices:n,normals:a}=function(s,o){if(o&&s.userData.positions!==void 0){let p=s.userData,m=[];for(let f=0,g=0;f<p.verticesPerFace.length;f++){let v=p.verticesPerFace[f];for(let y=1;y<v-1;y++)m.push(p.indices[g],p.indices[g+y],p.indices[g+y+1]);g+=v}return{positions:p.positions instanceof Float32Array?p.positions:new Float32Array(p.positions),indices:new Uint32Array(m)}}let l;l=T_e(s.userData.parameters)?s.getClosedTorusIndicesForBooleanOrSubdiv():s.getIndex();let h,u=s.getAttribute("position");if(l===null){h=new Uint32Array(u.count);for(let p=0;p<h.length;p++)h[p]=p}else h=l.array instanceof Uint32Array?l.array:new Uint32Array(l.array);let d=s.getAttribute("normal"),c=d!==void 0&&d.itemSize===3&&d.count===u.count&&d.array instanceof Float32Array&&d.isInterleavedBufferAttribute!==!0?d.array:void 0;return{positions:u.array,indices:h,normals:c}}(e,t);return AX(new uA.CsgMesh(r,n,a))}function cte(e,t){let i=oL(),r=A_e[t];if(r===void 0)throw new Error("Unknown boolean operation "+t);let n=e.map(EX);if(n.length===1)return i.clone_mesh(n[0]);let a,s=[];if(t===2&&n.length>2){let o=n[0];for(let l=1;l<n.length-1;l++)o=i.boolean_mesh(o,n[l],0),s.push(o);a=i.boolean_mesh(n[n.length-1],o,2)}else if(t===2)a=i.boolean_mesh(n[1],n[0],2);else{let o=n[n.length-1];for(let l=0;l<n.length-1&&(o=i.boolean_mesh(o,n[l],r),s.push(o),o.tri_count()!==0);l++);a=o,s.pop()}for(let o of s)o.free();return a}function CF(e,t){EX(e).transform(new Float32Array(t.elements))}function E_e(e){let t=dA.get(e);t!==void 0&&(t.free(),dA.delete(e))}var uA,dA,fH,pte,A_e,I4=k(()=>{le(),hA(),dA=new Map,fH=0,A_e={0:0,1:1,2:2}});function I0(e){return e!==null&&"booleanOp"in e}var gH,C_e,aOe=k(()=>{le(),xl(),I4(),gH=class extends D4(Cr){constructor(){super(...arguments),this.booleanMeshSetAddress=-1,this.booleanWasTransformed=!1,this.booleanMatrixInvOld=new ke}updateVisible(e){super.updateVisible(e),this.visible=!I0(this.parent)&&this.visible,I0(this.parent)&&this.parent.invalidateDownstreamBooleanData()}onClonerLayoutUpdated(){I0(this.parent)&&this.invalidateDownstreamBooleanData()}freeBooleanPointer(){this.booleanMeshSetAddress!==-1&&(E_e(this.booleanMeshSetAddress),this.booleanMeshSetAddress=-1)}invalidateDownstreamBooleanData(e=!1){return e?this.booleanWasTransformed=!0:this.freeBooleanPointer(),I0(this.parent)?this.parent.invalidateDownstreamBooleanData():this}invalidateUpstreamBooleanData(){this.freeBooleanPointer();for(let e of this.children)e instanceof gH&&(e.freeBooleanPointer(),I0(e)&&e.invalidateUpstreamBooleanData())}updateTransformState(e,t){let i=super.updateTransformState(e,t);return i&&I0(this.parent)&&this.invalidateDownstreamBooleanData(!0),i}onVariableUpdate(e=!1){super.onVariableUpdate(e),I0(this.parent)&&this.invalidateDownstreamBooleanData(!0)}}}),sOe=k(()=>{C_e=null});function CX(e,t=0,i=e.count,r,n){let a=1/0,s=1/0,o=1/0,l=-1/0,h=-1/0,u=-1/0;for(let d=t;d<i;d++){let c=e.getX(d),p=e.getY(d),m=e.getZ(d);c<a&&(a=c),p<s&&(s=p),m<o&&(o=m),c>l&&(l=c),p>h&&(h=p),m>u&&(u=m)}MM.min.set(a,s,o),MM.max.set(l,h,u),MM.getCenter(r),MM.getSize(n).multiplyScalar(.5)}var MM,mte,fte,Sa,io=k(()=>{le(),aOe(),sOe(),MM=new fn,mte=new At,fte=new Ql,Sa=class extends gH{constructor(e,t){super(mte,fte),this.super_Entity(e,t)}updateState(e,t){this.updateState_Entity(e,t)}raycast(e,t){let i=C_e;i===null?super.raycast(e,t):i(this,e,t)}updateEntityBoxSize(e,t){let i=this.geometry.getAttribute("position");i!==void 0?CX(i,this.geometry.drawRange.start,this.geometry.drawRange.count<1/0?this.geometry.drawRange.count:i.count,e,t):super.updateEntityBoxSize(e,t)}}});function lL(e){return e?.isClassicNodeMaterial===!0}var Fr,cA,P_e,R_e,bE,D_e,N_e,I_e,PX=k(()=>{}),wu=k(()=>{le(),Fr=class extends ot{constructor(e,t,i,r){super(e,t,i),this.isColorA=!0,this.a=r}setRGBA(e,t,i,r){super.setRGB(e,t,i),this.a=r}copy(e){return super.copy(e),this.a="a"in e?e.a:1,this}clone(){return new this.constructor(this.r,this.g,this.b,this.a)}equals(e){return super.equals(e)&&this.a===e.a}setStyle(e,t="srgb"){let i;if(e==="transparent")return this.setRGBA(0,0,0,0),this;if(i=/^((?:rgb|hsl)a?)\(([^)]*)\)/.exec(e)){let r,n=i[1],a=i[2];switch(n){case"rgb":case"rgba":if(r=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return this.a=n==="rgba"?parseFloat(r[4]):1,super.setStyle(e,t);break;case"hsl":case"hsla":if(r=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)%\s*,\s*(\d*\.?\d+)%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return this.a=n==="hsla"?parseFloat(r[4]):1,super.setStyle(e,t)}}return super.setStyle(e,t)}get x(){return this.r}get y(){return this.g}get z(){return this.b}get w(){return this.a}set x(e){this.r=e}set y(e){this.g=e}set z(e){this.b=e}set w(e){this.a=e}}}),O_e=k(()=>{wu(),cA=class extends Fr{}}),oOe=k(()=>{P_e=class{constructor(e=1e4){this.timeout=e,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(...e){}remove(e){let t=this.cache.get(e);t&&(this.dispose(e,t.data),this.cache.delete(e),t.prev.next=t.next,t.next.prev=t.prev,t.next=null,t.prev=null,t.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 e=Date.now(),t=this.head.next;for(;t.time<e-this.timeout;){this.dispose(t.src,t.data),this.cache.delete(t.src);let i=t;t=t.next,t.prev=this.head,this.head.next=t,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(e){return this.cache.get(e)?.data}load(e){let t=Date.now(),i=this.cache.get(e);return i===void 0?(i={data:this.create(e),src:e,time:t,next:null,prev:null},this.cache.set(e,i)):(i.time=t,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((e,t)=>{this.dispose(t,e.data),e.next=null,e.prev=null,e.data=null}),this.cache.clear(),this.head.next=this.tail,this.tail.prev=this.head}destroy(){this.disposeAll(),this.head=null,this.tail=null}}}),L_e=k(()=>{oOe(),R_e=class extends P_e{create(e){return URL.createObjectURL(new Blob([e]))}dispose(e,t){URL.revokeObjectURL(t)}}}),B_e=k(()=>{D_e=class{constructor(e,t){this.data=e,this.cache=t,this.refCount=0}deref(){this.refCount,this.refCount-=1,this.refCount===0&&(this.cache.remove(this),this.dispose())}dispose(){this.refCount}},N_e=class{constructor(){this.cache=new Map}remove(e){this.cache.delete(e.data)}load(e){let t=this.cache.get(e);return t===void 0&&(t=this.create(e),this.cache.set(e,t)),t.refCount+=1,t}}}),lOe=k(()=>{le(),I_e=class extends Pye{constructor(e){super(e),this.type=ai}parse(e){let t=function(p,m){switch(p){case 1:throw new Error("THREE.HDRLoader: Read Error: "+(m||""));case 2:throw new Error("THREE.HDRLoader: Write Error: "+(m||""));case 3:throw new Error("THREE.HDRLoader: Bad File Format: "+(m||""));default:throw new Error("THREE.HDRLoader: Memory Error: "+(m||""))}},i=function(p,m,f){m=m||1024;let g=p.pos,v=-1,y=0,_="",b=String.fromCharCode.apply(null,new Uint16Array(p.subarray(g,g+128)));for(;0>(v=b.indexOf(`
|
|
4163
4163
|
`))&&y<m&&g<p.byteLength;)_+=b,y+=b.length,g+=128,b=String.fromCharCode.apply(null,new Uint16Array(p.subarray(g,g+128)));return-1<v&&(f!==!1&&(p.pos+=y+v+1),_+b.slice(0,v))},r=function(p,m,f,g){let v=p[m+3],y=Math.pow(2,v-128)/255;f[g+0]=p[m+0]*y,f[g+1]=p[m+1]*y,f[g+2]=p[m+2]*y,f[g+3]=1},n=function(p,m,f,g){let v=p[m+3],y=Math.pow(2,v-128)/255;f[g+0]=Sd.toHalfFloat(Math.min(p[m+0]*y,65504)),f[g+1]=Sd.toHalfFloat(Math.min(p[m+1]*y,65504)),f[g+2]=Sd.toHalfFloat(Math.min(p[m+2]*y,65504)),f[g+3]=Sd.toHalfFloat(1)},a=new Uint8Array(e);a.pos=0;let s,o,l,h=function(p){let m,f,g=/^#\?(\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||!(m=i(p)))&&t(1,"no header found"),(f=m.match(g))||t(3,"bad initial token"),x.valid|=1,x.programtype=f[1],x.string+=m+`
|
|
4164
4164
|
`;m=i(p),m!==!1;)if(x.string+=m+`
|
|
4165
4165
|
`,m.charAt(0)!=="#"){if((f=m.match(v))&&(x.gamma=parseFloat(f[1])),(f=m.match(y))&&(x.exposure=parseFloat(f[1])),(f=m.match(_))&&(x.valid|=2,x.format=f[1]),(f=m.match(b))&&(x.valid|=4,x.height=parseInt(f[1],10),x.width=parseInt(f[2],10)),2&x.valid&&4&x.valid)break}else x.comments+=m+`
|
|
4166
4166
|
`;return 2&x.valid||t(3,"missing format specifier"),4&x.valid||t(3,"missing image size specifier"),x}(a),u=h.width,d=h.height,c=function(p,m,f){let g=m;if(g<8||g>32767||p[0]!==2||p[1]!==2||128&p[2])return new Uint8Array(p);g!==(p[2]<<8|p[3])&&t(3,"wrong scanline width");let v=new Uint8Array(4*m*f);v.length||t(4,"unable to allocate buffer space");let y=0,_=0,b=4*g,x=new Uint8Array(4),w=new Uint8Array(b),S=f;for(;S>0&&_<p.byteLength;){_+4>p.byteLength&&t(1),x[0]=p[_++],x[1]=p[_++],x[2]=p[_++],x[3]=p[_++],(x[0]!=2||x[1]!=2||(x[2]<<8|x[3])!=g)&&t(3,"bad rgbe scanline format");let M,T=0;for(;T<b&&_<p.byteLength;){M=p[_++];let E=M>128;if(E&&(M-=128),(M===0||T+M>b)&&t(3,"bad scanline data"),E){let C=p[_++];for(let N=0;N<M;N++)w[T++]=C}else w.set(p.subarray(_,_+M),T),T+=M,_+=M}let A=g;for(let E=0;E<A;E++){let C=0;v[y]=w[E+C],C+=g,v[y+1]=w[E+C],C+=g,v[y+2]=w[E+C],C+=g,v[y+3]=w[E+C],y+=4}S--}return v}(a.subarray(a.pos),u,d);switch(this.type){case jt:l=c.length/4;let p=new Float32Array(4*l);for(let f=0;f<l;f++)r(c,4*f,p,4*f);s=p,o=jt;break;case ai:l=c.length/4;let m=new Uint16Array(4*l);for(let f=0;f<l;f++)n(c,4*f,m,4*f);s=m,o=ai;break;default:throw new Error("THREE.HDRLoader: Unsupported type: "+this.type)}return{width:u,height:d,data:s,header:h.string,gamma:h.gamma,exposure:h.exposure,type:o,colorSpace:Ad,minFilter:nt,magFilter:nt,generateMipmaps:!1,flipY:!0}}setDataType(e){return this.type=e,this}}});function gte(e){return e.length>2&&e[0]===35&&e[1]===63}function PF(e){return typeof e=="object"&&e!==null&&e.isSplineHdr===!0}function U_e(e){let t=new Dr(e.data,e.width,e.height,Jr,ai);return t.flipY=!1,t.image.isSplineHdr=!0,t.needsUpdate=!0,t}var vte,RX,Nc,F_e=k(()=>{le(),lOe()}),z_e=k(()=>{le(),L_e(),B_e(),F_e(),vte=0,RX=class extends D_e{constructor(e,t){super(e,t.imageHolderCache),this.data=e,this.shared=t,this.instanceId=++vte,this.loaded=!1,this.isVideo=!1,this.isBuffer=!1,this.isHdr=!1,this._cache={1e3:{},1001:{},1002:{}},this.isVideo=e.type==="video",this.isBuffer=e.isWebGLRenderTarget===!0,this.loadPromise=this.updateSrc(this.isBuffer?e:e.data)}async updateSrc(e){if(typeof document>"u")return;this.disposeTextures(),this.loaded=!1,this.isHdr=!1;let t=()=>{this.loaded=!0;for(let r of Object.values(this._cache))for(let n of Object.values(r))for(let a of Object.values(n))a&&(a.image=this.img,a.needsUpdate=!0);this.shared.requestRender()};if(this.isBuffer)this.img=e,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 e!="string"){let r,n=new FileReader;n.readAsDataURL(new Blob([e],{type:"video/mp4"})),await new Promise(a=>{n.onloadend=s=>{r=s.target?.result,a(null)}}),this.img.src=r}else this.img.src=e;this.img.onloadeddata=()=>{t()}}else if(e instanceof Uint8Array?gte(e):typeof e=="string"&&/\.hdr($|[?#])/i.test(e)){let r=e instanceof Uint8Array?e:null;if(r===null)try{r=new Uint8Array(await(await fetch(e)).arrayBuffer())}catch{r=null}let n=r!==null&>e(r)?function(a){try{let s=new I_e().parse(a.buffer.slice(a.byteOffset,a.byteOffset+a.byteLength));if(!s||!s.width||!s.height)return null;let{width:o,height:l}=s,h=s.data,u=new Uint16Array(h.length),d=4*o,c=f=>Sd.toHalfFloat(Math.pow(Math.max(Sd.fromHalfFloat(f),0),1/2.2)),p=new Map,m=f=>{let g=p.get(f);return g===void 0&&(g=c(f),p.set(f,g)),g};for(let f=0;f<l;f++){let g=f*d,v=(l-1-f)*d;for(let y=0;y<d;y+=4)u[v+y]=m(h[g+y]),u[v+y+1]=m(h[g+y+1]),u[v+y+2]=m(h[g+y+2]),u[v+y+3]=h[g+y+3]}return{isSplineHdr:!0,data:u,width:o,height:l}}catch{return null}}(r):null;n!==null&&(this.isHdr=!0,this.img=n,t())}else this.img=new Image,this.img.src=typeof(i=e)=="string"?i:(bE||(bE=new R_e),bE.load(i)),this.img.onload=t,await new Promise(r=>{this.img.onload=()=>{t(),r(null)}});var i}getTexture(e,t=1008,i=1006){let r=this._cache[e]?.[t]?.[i];if(r)return r;{let n;return this.isBuffer?n=this.img.texture:this.isVideo?n=new U$(this.img,void 0,e,e):this.isHdr?(n=U_e(this.img),n.wrapS=e,n.wrapT=e,n.magFilter=i,n.minFilter=t):n=new Di(this.img,void 0,e,e,i,t),this.isBuffer||(n.anisotropy=8,n.generateMipmaps=t===1008),this.loaded&&(n.needsUpdate=!0),this._cache[e]===void 0&&(this._cache[e]={}),this._cache[e][t]===void 0&&(this._cache[e][t]={}),this._cache[e][t][i]=n,n}}setNeedsUpdate(e){if(!this.isBuffer)for(let t of Object.values(this._cache))for(let i of Object.values(t))for(let r of Object.values(i))r&&(r.needsUpdate=e)}disposeTextures(){for(let[e,t]of Object.entries(this._cache))for(let[i,r]of Object.entries(t))for(let[n,a]of Object.entries(r))a?.dispose(),this._cache[e]!==void 0&&this._cache[e][i]!==void 0&&(this._cache[e][i][n]=void 0)}dispose(){super.dispose(),this.disposeTextures()}}}),O4=k(()=>{z_e(),Nc=class extends RX{}});function hOe(e){if(typeof e=="string")return e;let t=vH.get(e);return t||(t={url:URL.createObjectURL(new Blob([e]))},vH.set(e,t)),t.url}var vH,uOe=k(()=>{vH=new Map});function dOe(){if(!yH)return yte||(yte=async function(){await Promise.resolve().then(()=>(WK(),yCe)),V_e(window!==void 0?window:global),yH=!0}())}var V_e,k_e,yH,yte,G_e=k(()=>{k_e=new Promise(e=>{V_e=e}),yH=!1});function _te(e,t){e.forEach(i=>{"dragDropActions"in i.data?(t.push(...i.data.dragDropActions.drag),t.push(...i.data.dragDropActions.drop)):"inActions"in i.data?(t.push(...i.data.inActions),t.push(...i.data.outActions)):"gameActions"in i.data?(t.push(...i.data.gameActions.idle),t.push(...i.data.gameActions.move),t.push(...i.data.gameActions.jump),t.push(...i.data.gameActions.run)):"breakpoints"in i.data?i.data.breakpoints.forEach(r=>{t.push(...r.data.actions)}):"actions"in i.data&&(t.push(...i.data.actions),i.data.actions.forEach(r=>{r.data.type==="Conditional"&&r.data.ifActions&&(t.push(...r.data.ifActions),t.push(...r.data.elseActions))}))})}function cOe(e){let t=!1,i=[];return e.scene.objects.traverse((r,n)=>{if(n.type==="Page"&&n.uiScene!==void 0&&n.uiScene.objects.traverse((a,s)=>{if(s.events===void 0||Array.isArray(s.events)===!1)return!0;_te(s.events,i),t=t||i.some(o=>o.data.type==="Audio")}),n.events===void 0||Array.isArray(n.events)===!1)return!0;_te(n.events,i),t=t||i.some(a=>a.data.type==="Audio")}),t}var bte,nx,DX=k(()=>{uOe(),G_e(),k_e.then(e=>bte=e),nx=class{constructor({src:e,volume:t,delay:i,loop:r}){let n;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)},n=typeof e=="string"?{src:e}:{src:hOe(e),format:"wav"},this.sound=new bte.Howl(n),this.sound.on("end",this.onEnd),this.src=e,t!==void 0&&(this.volume=t),i!==void 0&&(this.delay=i),r!==void 0&&(this.loop=r)}get status(){return this._status}get volume(){return this._volume}set volume(e){this._volume=e,this.sound.volume(e)}get loop(){return this._loop}set loop(e){this._loop=e,this.loopsRemaining=e}replay(){this.clearDelay(),this.delayTimerId=window.setTimeout(()=>{this.sound.play(),this.clearDelay()},this.delay)}fade(e,t=1e3){e?(this.sound.volume(this._volume),this.clearFade(),this.fadeTimerId=window.setTimeout(()=>{this.sound.fade(this._volume,0,t),this.clearFade()},e)):this.sound.fade(this._volume,0,t)}on(e,t,i){this.sound.on(e,t,i)}off(e,t,i){this.sound.off(e,t,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(e=!1){this.off(),this.stop(),this.clearFade(),this.clearDelay()}}});function xte(e){let t=!1;return e.scene.objects.traverse((i,r)=>{r.type==="Mesh"&&(r.geometry.type==="TextGeometry"||r.geometry.type==="InputGeometry")&&(t=!0)}),t}var NX,IX=k(()=>{NX=null});function wte(e){return new J(e.y,-e.x)}var OX,_H,j_e,H_e,a3,Ste,hL,W_e,RF,uL=k(()=>{le(),OX=class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=e.parameters?.radiusTop,r=e.parameters?.radiusBottom,n=Object.assign({},t?.parameters??{width:100,radialSegments:64,heightSegments:1,openEnded:!1,thetaStart:0,thetaLength:360,cornerRadius:8,cornerSegments:8,hollow:0},e.parameters);n.thetaLength=ht.clamp(n.thetaLength,0,360),n.hollow=ht.clamp(n.hollow??0,0,1);let a=n.width/2,s=n.radiusTop??a,o=n.radiusBottom??a;if(s===o?(s=a,o=a):s>o?(s=a,o=o*a/s):(s=s*a/o,o=a),n.shapeBlendNode){s=i??a,o=r??a;let l=2*Math.max(s,o);n.width=l,n.depth=l}return{parameters:Object.assign(n,{width:Math.abs(n.width),height:Math.abs(n.height??n.width),depth:Math.abs(n.depth??n.width),radiusTop:s,radiusBottom:o})}}static build(e){let t,{width:i,depth:r,height:n,radialSegments:a,heightSegments:s,openEnded:o,thetaStart:l,thetaLength:h,radiusTop:u,radiusBottom:d,cornerRadius:c,cornerSegments:p,hollow:m}=e.parameters;h===0?(t=new At,t.setAttribute("position",new Et([],3))):t=c||m?new _H(u,d,n,a,s,o,l,h*Math.PI/180,c,c,p,m):new hE(u,d,n,a,s,o,l,h*Math.PI/180);let f=r/i;return f!==1&&t.scale(1,1,f),Object.assign(t,{userData:{...e,type:"CylinderGeometry"}})}},_H=class extends At{constructor(e,t,i,r,n,a,s,o,l,h,u,d,c=!1){super(),this.type="RoundedCylinderBufferGeometry",e=e!==void 0?e:1,t=t!==void 0?t:1,i=i||1,r=Math.floor(r)||8,n=Math.floor(n)||1,a=a!==void 0&&a,s=s!==void 0?s:0,o=o!==void 0?o:2*Math.PI,a&&(l=0,h=0);let p=i/2;c&&e==0&&(e=l),c&&t==0&&(t=h);let m=new J(e,p),f=new J(t,-p),g=null,v=null,y=null,_=null,b=m.clone().sub(f),x=0,w=0,S=0;d>0&&(x=Math.min(e,t)*(1-d),w=e-x,S=t-x);let M=m.clone();M.x-=x;let T=Math.PI-b.angle(),A=b.angle(),E=Math.tan(A/2),C=Math.tan(T/2),N=E+C,P=d?N:C,I=d?N:E;if(l=Math.min(l,(e-w)/P,b.length()/N),h=Math.min(h,(t-S)/I,b.length()/N),l>0){let he=l/E;g=m.clone().sub(new J(he,l)),d&&(y=g.clone(),y.x-=x-N*l),m.sub(b.clone().setLength(he))}if(h>0){let he=h/C;v=f.clone().sub(new J(he,-h)),f.add(b.clone().setLength(he)),d&&(_=v.clone(),_.x-=x-N*h,M.sub(b.clone().setLength(he)))}b=m.clone().sub(f);let L=b.length()<.5,B=[],G=[],j=[],$=[],H=[],te=[],ue=(he,me,Ee,Se,qe)=>{for(let Ne=0;Ne<u+1;Ne++){let He=Ne/u,Pe=Se<0?He:1-He;qe&&(Pe-=1),Pe*=he;let ee=Math.sin(Pe),Me=Math.cos(Pe)*Se,We=Me*me+Ee.y;B.push(ee*me+Ee.x),G.push(We),j.push(ee),$.push(Me),H.push(.5+We/i),te.push(!1)}},ae=(he,me,Ee)=>{let Se=[he,me];Ee<0&&Se.reverse();for(let qe of Se)B.push(qe),G.push(p*Ee),j.push(0),$.push(Ee),H.push(.5),te.push(!0)};if(_&&v?(ue(T,h,_,-1,!0),ue(A,h,v,-1,!1)):v?(ae(v.x,0,-1),ue(A,h,v,-1,!1)):a||ae(t,S,-1),!L){let he=wte(b).normalize();for(let me=0;me<=n;me++){let Ee=me/n,Se=b.y*Ee+f.y;B.push(b.x*Ee+f.x),G.push(Se),j.push(he.x),$.push(he.y),H.push(.5+Se/i),te.push(!1)}}if(y&&g?(ue(T,l,g,1,!1),ue(A,l,y,1,!0)):g?(ue(T,l,g,1,!1),ae(g.x,0,1)):a||ae(e,w,1),d&&!L){let he=wte(b).multiplyScalar(-1).normalize();for(let me=0;me<=n;me++){let Ee=me/n,Se=b.y*-Ee+M.y;B.push(b.x*-Ee+M.x),G.push(Se),j.push(he.x),$.push(he.y),H.push(.5+Se/i),te.push(!1)}}let de=B.length,ye=de+(d&&!a?1:0),Z=(he,me)=>he*de+(me===de?0:me),fe=o<2*Math.PI,W=(r+1)*de+(fe?2*(1+ye):0),z=new Float32Array(3*W),Y=new Float32Array(3*W),ne=new Float32Array(2*W),V=W-1>65535?new Uint32Array(r*Math.max(0,ye-1)*6+(fe?2*(ye+1)*3:0)):new Uint16Array(r*Math.max(0,ye-1)*6+(fe?2*(ye+1)*3:0)),Q=0,ie=0;for(let he=0;he<=r;he++){let me=he/r,Ee=me*o+s,Se=Math.sin(Ee),qe=Math.cos(Ee);for(let Ne=0;Ne<de;Ne++){let He=3*ie,Pe=2*ie,ee=B[Ne],Me=j[Ne];z[He]=ee*Se,z[He+1]=G[Ne],z[He+2]=ee*qe,Y[He]=Me*Se,Y[He+1]=$[Ne],Y[He+2]=Me*qe,te[Ne]?(ne[Pe]=.5,ne[Pe+1]=.5):(ne[Pe]=me,ne[Pe+1]=H[Ne]),ie++}}for(let he=0;he<r;he++)for(let me=0;me<ye-1;me++){if(a&&d&&me==n)continue;let Ee=Z(he,me),Se=Z(he+1,me),qe=Z(he+1,me+1),Ne=Z(he,me+1),He=z[3*qe+0],Pe=z[3*qe+2];V[Q++]=Ee,V[Q++]=Se,V[Q++]=Ne,(He!=0||Pe!=0)&&(V[Q++]=Se,V[Q++]=qe,V[Q++]=Ne)}function q(he,me,Ee){let Se=Math.sin(Ee),qe=Math.cos(Ee),Ne=-qe,He=Se,Pe=he<0?(et,Xt,si)=>{V[Q++]=et,V[Q++]=Xt,V[Q++]=si}:(et,Xt,si)=>{V[Q++]=et,V[Q++]=si,V[Q++]=Xt},ee=(e+t+w+S)/4,Me=3*ie,We=2*ie;z[Me]=ee*Se,z[Me+1]=0,z[Me+2]=ee*qe,Y[Me]=Ne,Y[Me+1]=0,Y[Me+2]=He,ne[We]=.5,ne[We+1]=.5;let dt=ie++;for(let et=0;et<ye;et++){let Xt=3*(me+(et===de?0:et));Me=3*ie,We=2*ie,z[Me]=z[Xt],z[Me+1]=z[Xt+1],z[Me+2]=z[Xt+2],Y[Me]=Ne,Y[Me+1]=0,Y[Me+2]=He;let si=Xt/3*2|0;ne[We]=ne[si],ne[We+1]=ne[si+1],ie++}for(let et=dt+1;et<ie-1;et++)Pe(dt,et,et+1);Pe(dt,ie-1,dt+1)}fe&&(q(-1,0,s),q(1,r*de,s+o)),this.setIndex(new It(V.slice(0,Q),1)),this.setAttribute("position",new It(z,3)),this.setAttribute("normal",new It(Y,3)),this.setAttribute("uv",new It(ne,2))}}}),Tte=k(()=>{le(),uL(),j_e=class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=Object.assign({},t?.parameters??{width:100,radialSegments:32,heightSegments:8,openEnded:!1,thetaStart:0,thetaLength:360,cornerRadiusTop:8,cornerRadiusBottom:8,cornerSegments:8},e.parameters);return i.thetaLength=ht.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(e){let t,{width:i,depth:r,height:n,radialSegments:a,heightSegments:s,openEnded:o,thetaStart:l,thetaLength:h,cornerRadiusTop:u,cornerRadiusBottom:d,cornerSegments:c}=e.parameters;h===0?(t=new At,t.setAttribute("position",new Et([],3))):t=u>0||d>0||h<360?new _H(0,i/2,n,a,s,o,l,h*Math.PI/180,u,d,c,0,!0):new AO(i/2,n,a,s,o);let p=r/i;return p!==1&&t.scale(1,1,p),Object.assign(t,{userData:{...e,type:"ConeGeometry"}})}}}),Mte=k(()=>{le(),H_e=class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=Object.assign({},t?.parameters??{width:100,widthSegments:1,heightSegments:1,depthSegments:1,cornerRadius:8,cornerSegments:8},e.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(e){let t,{width:i,height:r,depth:n,widthSegments:a,heightSegments:s,depthSegments:o,cornerRadius:l,cornerSegments:h}=e.parameters;return t=l===0?new Nh(i,r,n,a,s,o):new Ste(i,r,n,a,s,o,l,h),Object.assign(t,{userData:{...e,type:"CubeGeometry"}})}},a3=Math.PI/2,Ste=class extends At{constructor(e=1,t=1,i=1,r=1,n=1,a=1,s=0,o=4){super(),this.type="BoxGeometry",r=Math.floor(r),n=Math.floor(n),a=Math.floor(a),o=Math.floor(o);let l=(s=Math.min(s,e/2,t/2,i/2))>0,h=o+1,u=2*((a+1)*(n+1)+(r+1)*(a+1)+(r+1)*(n+1))+(l?4*h*(a+1+(r+1)+(n+1))+h*(h+1)/2*8:0),d=2*(a*n+r*a+r*n)+(l?4*o*(a+r+n):0),c=l?8*o*o:0,p=new Float32Array(3*u),m=new Float32Array(3*u),f=new Float32Array(2*u),g=u-1>65535?new Uint32Array(6*d+3*c):new Uint16Array(6*d+3*c),v=0,y=0,_=new Float64Array(h),b=new Float64Array(h),x=new Float64Array(h),w=new Float64Array(h);for(let N=0;N<h;N++){let P=N/o*a3;_[N]=Math.sin(P)*s,b[N]=(1-Math.cos(P))*s,x[N]=Math.sin(P),w[N]=Math.cos(P)}let S=h*(h+1)/2,M=new Float64Array(3*S),T=new Float64Array(3*S);{let N=new D(e/2,t/2,i/2);N.subScalar(s);let P=0;for(let I=0;I<=o;I++){let L=a3*(1-I/o),B=Math.cos(L),G=Math.sin(L),j=0;for(let $=0;$<=I;$++){let H=B*Math.cos(j),te=G,ue=B*Math.sin(j);M[3*P]=H,M[3*P+1]=te,M[3*P+2]=ue,T[3*P]=N.x+H*s,T[3*P+1]=N.y+te*s,T[3*P+2]=N.z+ue*s,P++,j+=a3/I}}}function A(N,P,I,L,B,G,j,$,H,te){let ue=(G-2*s)/H,ae=(j-2*s)/te,de=G/2-s,ye=j/2-s,Z=$/2,fe=H+1,W=te+1,z=0,Y=new D;for(let ne=0;ne<W;ne++){let V=ne*ae-ye;for(let Q=0;Q<fe;Q++){let ie=Q*ue-de,q=3*(v+z),he=2*(v+z);Y[N]=ie*L,Y[P]=V*B,Y[I]=Z,p[q]=Y.x,p[q+1]=Y.y,p[q+2]=Y.z,Y[N]=0,Y[P]=0,Y[I]=$>0?1:-1,m[q]=Y.x,m[q+1]=Y.y,m[q+2]=Y.z,f[he]=Q/H,f[he+1]=1-ne/te,z+=1}}for(let ne=0;ne<te;ne++)for(let V=0;V<H;V++){let Q=v+V+fe*ne,ie=v+V+fe*(ne+1),q=v+(V+1)+fe*(ne+1),he=v+(V+1)+fe*ne;g[y++]=Q,g[y++]=ie,g[y++]=he,g[y++]=ie,g[y++]=q,g[y++]=he}v+=z}function E(N,P,I,L,B,G,j,$,H,te){let ue=(j-2*s)/te,ae=j/2-s,de=$/2-s,ye=H/2,Z=te+1,fe=0,W=new D,z=new D;for(let Y=0;Y<o+1;Y++){W[P]=(de+_[Y])*B,W[I]=(ye-b[Y])*G,z[N]=0,z[P]=x[Y]*Math.sign(W[P]),z[I]=w[Y]*Math.sign(W[I]);for(let ne=0;ne<Z;ne++){let V=ne*ue-ae;W[N]=V*L;let Q=3*(v+fe),ie=2*(v+fe);p[Q]=W.x,p[Q+1]=W.y,p[Q+2]=W.z,m[Q]=z.x,m[Q+1]=z.y,m[Q+2]=z.z,f[ie]=ne/te,f[ie+1]=0,fe+=1}}for(let Y=0;Y<o;Y++)for(let ne=0;ne<te;ne++){let V=v+ne+Z*Y,Q=v+ne+Z*(Y+1),ie=v+(ne+1)+Z*(Y+1),q=v+(ne+1)+Z*Y;g[y++]=V,g[y++]=Q,g[y++]=q,g[y++]=Q,g[y++]=ie,g[y++]=q}v+=fe}function C(N,P,I){let L=N*P*I>0?(G,j,$)=>{g[y++]=G,g[y++]=j,g[y++]=$}:(G,j,$)=>{g[y++]=G,g[y++]=$,g[y++]=j},B=v;for(let G=0;G<S;G++){let j=3*G,$=3*v,H=2*v;p[$]=N*T[j],p[$+1]=P*T[j+1],p[$+2]=I*T[j+2],m[$]=N*M[j],m[$+1]=P*M[j+1],m[$+2]=I*M[j+2],f[H]=0,f[H+1]=0,v++}for(let G=0;G<o;G++){let j=B+G*(G+1)/2,$=B+(G+1)*(G+2)/2;L(j,$+1,$);for(let H=1;H<=G;H++)L(j+H-1,j+H,$+H),L(j+H,$+H+1,$+H)}}A("z","y","x",-1,-1,i,t,e,a,n),A("z","y","x",1,-1,i,t,-e,a,n),A("x","z","y",1,1,e,i,t,r,a),A("x","z","y",1,-1,e,i,-t,r,a),A("x","y","z",1,-1,e,t,i,r,n),A("x","y","z",-1,-1,e,t,-i,r,n),s>0&&(E("z","y","x",-1,-1,1,i,t,e,a),E("z","y","x",1,-1,-1,i,t,e,a),E("z","y","x",-1,1,-1,i,t,e,a),E("z","y","x",1,1,1,i,t,e,a),E("x","y","z",-1,-1,-1,e,t,i,r),E("x","y","z",1,-1,1,e,t,i,r),E("x","y","z",-1,1,1,e,t,i,r),E("x","y","z",1,1,-1,e,t,i,r),E("y","x","z",-1,-1,1,t,e,i,n),E("y","x","z",1,-1,-1,t,e,i,n),E("y","x","z",1,1,1,t,e,i,n),E("y","x","z",-1,1,-1,t,e,i,n),C(1,1,1),C(-1,1,1),C(1,-1,1),C(-1,-1,1),C(1,1,-1),C(-1,1,-1),C(1,-1,-1),C(-1,-1,-1)),this.setIndex(new It(g,1)),this.setAttribute("position",new It(p,3)),this.setAttribute("normal",new It(m,3)),this.setAttribute("uv",new It(f,2))}}}),q_e=k(()=>{le(),hL=class extends At{constructor(e=[],t=[],i="",r=1,n=.2,a=4){super(),this.type="PolyhedronGeometryRound";let s,o,l,h=0;return function(){(n=Math.min(.99999,n))==0&&(a=0);let u={IcosahedronGeometry:5,DodecahedronGeometry:3,HexahedronGeometry:3,OctahedronGeometry:4,TetrahedronGeometry:3}[i],d=new D,c=d.clone(),p=new Ba,m=n*r,f=r-m,g=a+1,v=new D,y=(Z,fe)=>v.subVectors(Z,fe).normalize(),_=(Z,fe)=>Array(Z).fill(void 0).map(fe),b=_(e.length/3,(Z,fe)=>new D().fromArray(e,3*fe).setLength(r)),x=[],w=1e6;for(let Z=0;Z<b.length;Z++){let fe,W,z,Y=b[Z],ne=[],V=1e10,Q=-1;for(;(Q=t.indexOf(Z,Q+1))!=-1;){let me=Q-Q%3;fe=t[me+(Q+1)%3],W=t[me+(Q+2)%3],z=Y.distanceToSquared(b[fe]),V=Math.min(V,z),ne.push([fe,W,z])}V+=1e-6;let ie=[],q=0,he=ne.length;for(let me=0;me<he;me++){[fe,W,z]=ne[q];let Ee=x[fe]?.includes(Z)==1;z<=V&&ie.push(fe+ +Ee*w),q=ne.findIndex(Se=>Se[0]==W)}x.push(ie)}let S=[];{let Z,fe,W=0,z=0,Y=u==3;for(let ne=0;ne<=a;ne++){Z=ne*(ne+1)/2,fe=(ne+1)*(ne+2)/2;for(let V=0;V<a-ne;V++)[W,z]=[Z+V+ne+2,fe+V+ne+3],S.push(Z,fe,...Y?[z,Z]:[W,fe],z,W),[Z,fe]=[W,z];S.push(Z,fe,Z+a+2)}}let M=0;for(let Z=0;Z<x.length;Z++)for(let fe=0;fe<u;fe++)x[Z][fe]<w&&M++;let T=b.length*u*S.length*3+M*g*6*3+2*M*3*3;s=new Float64Array(T),o=new Float64Array(T),l=new Float64Array(T/3*2);let A=(Z,fe,W)=>{let z=h/3*2;l[z]=Math.atan2(W,-Z)/2/Math.PI+.5,l[z+1]=1-(Math.atan2(-fe,Math.sqrt(Z*Z+W*W))/Math.PI+.5)},E=Z=>{s[h]=Z.x,s[h+1]=Z.y,s[h+2]=Z.z,o[h]=v.x,o[h+1]=v.y,o[h+2]=v.z,A(Z.x,Z.y,Z.z),h+=3},C=Z=>{s[h]=Z[0].x,s[h+1]=Z[0].y,s[h+2]=Z[0].z,o[h]=Z[1].x,o[h+1]=Z[1].y,o[h+2]=Z[1].z,A(Z[0].x,Z[0].y,Z[0].z),h+=3},N=(a+2)*(a+3)/2,P=new Float64Array(3*N),I=new Float64Array(3*N),L=new Float64Array(2*N),B=_(2*u*g,()=>new D),G=_(a*Math.max(0,a-1)/2,()=>new D),j=d.clone(),$=d.clone(),H=d.clone(),te=d.clone(),ue=d.clone(),ae=[],de=_(b.length,()=>_(u,()=>d.clone()));for(let Z=0;Z<b.length;Z++){d.copy(b[Z]).normalize(),j.copy(d).multiplyScalar(f);let fe=x[Z];for(let ie=0;ie<fe.length;ie++){let q=fe[ie],he=fe[(ie+1)%u];p.setFromPointsAndIndices(b,Z,q%w,he%w),p.b.sub(p.a).setLength(1e10).add(p.a),p.c.sub(p.a).setLength(1e10).add(p.a),p.closestPointToPoint(j,de[Z][ie])}let W=0,z=[],Y=[],ne=new D;a==0&&[...de[Z]].reduce((ie,q)=>ie.add(q),ne).multiplyScalar(1/u);for(let ie=0;ie<u;ie++){let q=[],he=(ie-1+u)%u,me=de[Z][he],Ee=de[Z][ie];d.copy(me).sub(j),c.copy(Ee).sub(j);let Se=j.angleTo(d),qe=d.angleTo(c),Ne=Math.cos(Se)*m;a==0?$.copy(ne):$.copy(j).setLength(f+Ne),z.push(Ne);let He=[$,me,Ee];for(let Pe=0;Pe<2;Pe++){let ee=He[Pe],Me=He[Pe+1];te.subVectors(ee,j),ue.subVectors(Me,j),H.crossVectors(te,ue).normalize();for(let We=0;We<g;We++){let dt=[Se,qe][Pe]*We/g;d.copy(te).applyAxisAngle(H,dt).add(j),B[W++].copy(d),Pe&&(y(d,j),q.push([We==0?ee:d.clone(),v.clone()]))}Pe&&(y(Me,j),q.push([Me,v.clone()]))}Y.push(q)}ae.push(Y);let V=2*g,Q=2;for(let ie=0;ie<u;ie++){let q=V*ie,he=V*((ie+1)%u),me=0,Ee=[B[q]];for(let Se=1;Se<g;Se++){let qe=B[q+Se],Ne=B[he+Se];Ee.push(qe);for(let He=1,Pe=Se-Q+1;He<=Pe;He++)d.lerpVectors(qe,Ne,He/(Pe+1)),d.sub(j).setLength(z[ie]).add(j),Ee.push(G[me++].copy(d));Ee.push(Ne)}for(let Se=0;Se<g;Se++)Ee.push(B[Se+g+q]);Ee.push(B[he+g]);for(let Se=0,qe=Ee.length;Se<qe;Se++){let Ne=Ee[Se],He=3*Se,Pe=2*Se;P[He]=Ne.x,P[He+1]=Ne.y,P[He+2]=Ne.z,y(Ne,j),I[He]=v.x,I[He+1]=v.y,I[He+2]=v.z,L[Pe]=Math.atan2(Ne.z,-Ne.x)/2/Math.PI+.5,L[Pe+1]=1-(Math.atan2(-Ne.y,Math.sqrt(Ne.x*Ne.x+Ne.z*Ne.z))/Math.PI+.5)}for(let Se=0,qe=S.length;Se<qe;Se++){let Ne=3*S[Se],He=2*S[Se],Pe=h/3*2;s[h]=P[Ne],s[h+1]=P[Ne+1],s[h+2]=P[Ne+2],o[h]=I[Ne],o[h+1]=I[Ne+1],o[h+2]=I[Ne+2],l[Pe]=L[He],l[Pe+1]=L[He+1],h+=3}}}let ye=[];for(let Z=0;Z<x.length;Z++)for(let fe=0;fe<u;fe++){let W=x[Z][fe];if(W<w){let z=x[W].findIndex(V=>V%w==Z),Y=ae[Z][fe],ne=ae[W][z];for(let V=0;V<g;V++){let Q=Y[V],ie=ne[g-V],q=Y[V+1],he=ne[g-(V+1)];C(Q),C(ie),C(q),C(q),C(ie),C(he)}ye.push(Y[0][0],ne[g][0],Y[g][0],ne[0][0])}}for(;ye.length;){let Z,fe,W,[z,Y]=ye.splice(0,2);Z=Y;let ne=[z];for(;z!=Z;)ne.push(Z),fe=ye.indexOf(Z),W=fe%2,Z=ye.splice(fe-W,2)[1-W];v.subVectors(ne[0],ne[1]).cross(d.subVectors(ne[0],ne[2])).normalize();let V=v.dot(ne[0])<0;V&&v.negate();for(let Q=1;Q<=ne.length-2;Q++)E(ne[Q+ +V]),E(ne[Q+1-+V]),E(ne[0])}}(),function(){let u=new D,d=new D,c=new D,p=new D,m=new J,f=new J,g=new J,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<h;b+=9,x+=6){u.set(s[b+0],s[b+1],s[b+2]),d.set(s[b+3],s[b+4],s[b+5]),c.set(s[b+6],s[b+7],s[b+8]),m.set(l[x+0],l[x+1]),f.set(l[x+2],l[x+3]),g.set(l[x+4],l[x+5]),p.copy(u).add(d).add(c).divideScalar(3);let w=_(p);v(m,x+0,u,w),v(f,x+2,d,w),v(g,x+4,c,w)}let y=h/3*2;for(let b=0;b<y;b+=6){let x=l[b+0],w=l[b+2],S=l[b+4],M=Math.max(x,w,S),T=Math.min(x,w,S);M>.9&&T<.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 It(new Float32Array(s.subarray(0,h)),3)),this.setAttribute("normal",new It(new Float32Array(o.subarray(0,h)),3)),void this.setAttribute("uv",new It(new Float32Array(l.subarray(0,h/3*2)),2))}static fromJSON(e){return new hL(e.vertices,e.indices,e.radius,e.corner,e.cornerSides)}}}),Ete=k(()=>{q_e(),le(),W_e=class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=Object.assign({},t?.parameters??{width:100,detail:0,corner:0,cornerSides:4},e.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(e){let{width:t,height:i,depth:r,detail:n,corner:a,cornerSides:s}=e.parameters,o=n===0&&a!==0?new RF(.5*t,a,s):new t7(.5*t,n),l=i/t,h=r/t;return(l!==1||h!==1)&&o.scale(1,l,h),Object.assign(o,{userData:{...e,type:"DodecahedronGeometry"}})}},RF=class extends hL{constructor(e=1,t=.2,i=4){let r=(1+Math.sqrt(5))/2,n=1/r,a="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,-n,-r,0,-n,r,0,n,-r,0,n,r,-n,-r,0,-n,r,0,n,-r,0,n,r,0,-r,0,-n,r,0,-n,-r,0,n,r,0,n],[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],a,e,t,i),this.type=a}static fromJSON(e){return new RF(e.radius,e.corner,e.cornerSides)}}});function Ate(e,t=new J){let i=e.length();return t.set(-e.y/i,e.x/i)}function pOe(e){let t=new J;t.addVectors(e.v0,ly.subVectors(e.v1,e.v0).multiplyScalar(2/3));let i=new J;return i.addVectors(e.v2,pA.subVectors(e.v1,e.v2).multiplyScalar(2/3)),new fu(e.v0,t,i,e.v2)}function EM(e,t,i=Number.EPSILON){return Math.abs(e-t)<i}function mOe(e,t,i=Number.EPSILON){return e.distanceTo(t)<i}function fOe(e,t,i=Number.EPSILON){return e.distanceTo(t)<i}function $_e(e,t,i){let r=Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2)),n=Math.sqrt(Math.pow(t.x-i.x,2)+Math.pow(t.y-i.y,2)),a=Math.sqrt(Math.pow(i.x-e.x,2)+Math.pow(i.y-e.y,2));return Math.acos((n*n+r*r-a*a)/(2*n*r))}function gOe(e,t,i){return Pte(e,t)&&Pte(t,i)&&bH(e.position,t.position,i.position)}function bH(e,t,i){return ly.copy(t).sub(e).cross(pA.copy(i).sub(e))===0}function vOe(e,t,i,r,n){let a=Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2)),s=(e.y+t.y)/2,o=(e.x+t.x)/2,l=Math.sqrt(Math.pow(i,2)-Math.pow(a/2,2))*(e.y-t.y)/a,h=Math.sqrt(Math.pow(i,2)-Math.pow(a/2,2))*(t.x-e.x)/a;return r.set(o+l,s+h),n.set(o-l,s-h),[r,n]}function yOe(e,t,i){return e.distanceTo(i)<t.distanceTo(i)?t:e}function _Oe(e,t,i,r,n,a){let s,o=t.x-e.x,l=t.y-e.y,h=i.x-e.x,u=i.y-e.y,d=Math.sqrt((o+h)*(o+h)+(l+u)*(l+u));return $_e(t,e,i)>Math.PI&&(d*=-1),s=EM(u,l)?(l+u)*(r/d-.5)*8/3/(o-h):(o+h)*(r/d-.5)*8/3/(u-l),n.set(t.x-s*l,t.y+s*o),a.set(i.x+s*u,i.y-s*h),[n,a]}function Cte(e,t){return e.position.equals(e.controls[1].position)&&t.position.equals(t.controls[0].position)}function Pte(e,t){return bH(e.position,e.controls[1].position,t.position)&&bH(e.position,t.controls[0].position,t.position)}function Rte(e,t=12,i=!1){let r=[];for(let n=0,a=e.length;n<a;n++){let s=e[n],o=0;if(i&&s.roundedCurveCorner!==void 0){let l=.5*oy(s.roundedCurveCorner,t);n>0&&(r[n-1]+=l),o+=l}s.curveAfter!==void 0&&(o+=oy(s.curveAfter,t)),r.push(o)}return e.length>0&&i&&e[0].roundedCurveCorner!==void 0&&(r[e.length-1]+=.5*oy(e[0].roundedCurveCorner,t)),r}function oy(e,t=12){return e&&e instanceof pM?2*t:e&&(e instanceof Th||e instanceof i7)?1:e&&e instanceof $N?t*e.points.length:t}var Lb,s3,o3,wy,sI,ly,pA,X_e,Y_e,K_e,Z_e,xH,wH,l3,Dte,Nte,Ite,Ote,Lte,da,Q_e=k(()=>{le(),Lb=1e-12,s3=class{constructor(e){this.position=new J,this.startPosition=new J,this.uuid=ht.generateUUID(),this.position=e.clone()}start(){this.reset()}reset(){this.startPosition.copy(this.position)}applyOffset(e){this.position.copy(this.startPosition).add(e)}copy(e){return this.position.copy(e.position),this.startPosition.copy(e.startPosition),this}clone(){return new s3(this.position).copy(this)}toJSON(){return[this.position.x,this.position.y]}},o3=class extends s3{constructor(e){super(e.position),this.parent=e}copy(e){return super.copy(e),this}clone(){return new o3(this.parent).copy(this)}},wy=class extends s3{constructor(e,t){super(t),this.controls=[],this.roundness=0,this.areControlsDirectionsMirrored=!0,this.uuid=e,this.controls.push(new o3(this),new o3(this))}static create(e,t){let i=new wy(e,new J(...t.position));return i.controls[0].position.set(...t.controlPrevious.position),i.controls[1].position.set(...t.controlNext.position),i.roundness=t.roundness,i.areControlsDirectionsMirrored=t.areControlsDirectionsMirrored,i}getOppositeControl(e){let t=this.controls.indexOf(e);return t===0?this.controls[1]:t===1?this.controls[0]:null}applyOffsetToControls(e,t=1){for(let i=0,r=this.controls.length;i<r;i++){let n=this.controls[i];this.position.distanceTo(n.position)<=t?n.position.copy(this.position):n.applyOffset(e)}}controlsMoved(){return!(this.position.equals(this.controls[0].position)&&this.position.equals(this.controls[1].position))}copy(e){return super.copy(e),this.controls[0].copy(e.controls[0]),this.controls[1].copy(e.controls[1]),this.roundness=e.roundness,this.uuid=e.uuid,this}clone(){return new wy(this.uuid,this.position).copy(this)}toJSON(){return super.toJSON().concat(this.controls[0].toJSON(),this.controls[1].toJSON(),[this.roundness])}computeTangents(){let e=this.curveBefore?.getTangentAt(1),t=this.curveAfter?.getTangentAt(0);return[e,t]}computeNormals(e=new J,t=new J){let[i,r]=this.computeTangents();return i&&r&&(Ate(i,e),Ate(r,t)),[e,t]}computeTangent(e=new J){let[t,i]=this.computeTangents();return t&&i&&e.copy(t).add(i).normalize(),e}computeNormal(e=new J){let[t,i]=this.computeNormals();return e.copy(t).add(i).normalize(),e}},sI=e=>e,ly=new J,pA=new J,X_e=new J,Y_e=new J,K_e=new J,Z_e=new J,xH=new D,wH=new D}),i0=k(()=>{le(),Q_e(),l3=new J,Dte=new J,Nte=new J,Ite=new J,Ote=new J,Lte=new J,da=class extends YE{constructor(e=100,t=100){super(),this.points=[],this.shapeHoles=[],this.plane=new qs(new D(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=ht.generateUUID(),this.needsUpdate=!1,this.roundedCurves=[],this._width=e,this._height=t}static createFromState(e,t,i){let r=new da;return r.isClosed=e.isClosed,r.points=e.points.map(n=>wy.create(n.id,n.data)),typeof e.roundness=="number"&&(r.roundness=e.roundness),r.shapeHoles=e.shapeHoles.map(n=>da.createFromState(n)),t!==void 0&&i!==void 0&&r.applySize(t,i),r.update(),r}get width(){return this._width}get height(){return this._height}get roundness(){return this._roundness}set roundness(e){if(this._roundness!==e){this._roundness=e;for(let t=0,i=this.points.length;t<i;t++)this.points[t].roundness=e;this.needsUpdate=!0}}getPointsIndexesByIds(e){return e.map(t=>this.getPointIndexById(t)).filter(t=>t>=0)}getPointIndexById(e){let t=this.points.length,i=this.points.findIndex(r=>r.uuid===e);if(i<0){let r=t;for(let n=0,a=this.shapeHoles.length;n<a;n++){let s=this.shapeHoles[n],o=s.points.length,l=s.getPointIndexById(e);if(!(l<0))return l+r;r+=o}}return i}getLineIndexById(e){return this.getPointIndexById(e)}getBezierPoint(e){if(e<=this.points.length-1)return this.points[e];if(this.shapeHoles.length>0){let t=this.points.length;for(let i=0,r=this.shapeHoles.length;i<r;i++){let n=this.shapeHoles[i],a=e-t;if(a<=n.points.length-1)return n.points[a];t+=n.points.length}}throw new Error("This shape does not have a point for this index: "+e)}getBezierPointIndex(e){let t=this.points.indexOf(e);if(t>=0)return t;if(t=this.points.length,this.shapeHoles.length>0)for(let i=0,r=this.shapeHoles.length;i<r;i++){let n=this.shapeHoles[i],a=n.points.indexOf(e);if(a>=0)return t+a;t+=n.points.length}return-1}getAllPoints(){let e=[].concat(...this.shapeHoles.map(t=>t.points));return[...this.points,...e]}applySize(e,t){e===0&&(e=.001),t===0&&(t=.001),this._width=e,this._height=t}applyScale(e,t){let i=l3.set(e,t);for(let r=0,n=this.points.length;r<n;r++){let a=this.points[r];a.position.multiply(i),a.controls[0].position.multiply(i),a.controls[1].position.multiply(i)}for(let r=0,n=this.shapeHoles.length;r<n;r++)this.shapeHoles[r].applyScale(e,t);this._update()}createPoint(e,t=0,i=ht.generateUUID()){let r;r=e instanceof J?e:new J(e,t);let n=new wy(i,r);return n.roundness=this.roundness,n}addPoint(e){this.points.push(e),this.needsUpdate=!0}addPointAt(e,t){this.points.splice(t,0,e),this.needsUpdate=!0}getPointByUuid(e){for(let t=0,i=this.points.length;t<i;t++){let r=this.points[t];if(r.uuid===e)return r}for(let t=0,i=this.shapeHoles.length;t<i;t++){let r=this.shapeHoles[t].getPointByUuid(e);if(r)return r}}getFirstPoint(){return this.points[0]}getLastPoint(){return this.points[this.points.length-1]}removePoint(e){let t=this.points.indexOf(e);t>=0&&this.points.splice(t,1),this.needsUpdate=!0}removePointById(e){let t=this.points.find(i=>i.uuid===e);t&&this.removePoint(t)}update(){for(let e=0,t=this.shapeHoles.length;e<t;e++)this.shapeHoles[e].update();this._update()}extractShapePointsToBuffer(e,t=12,i=!1){this.subdivision=t,this.curveDivisions===void 0&&this.computeCurveDivisions(t);let r=i?this.roundedCurveDivisions:this.curveDivisions;return function(n,a,s=12,o=!0){let l,h=wH.set(0,0,0),u=0,d=[];for(let c=0;c<a.length;c++){let p=sI(a[c]),m=ly,f=oy(p,s);d.push(f);for(let g=0;g<=f;g++)if(p instanceof fu||p instanceof lm||p instanceof Th){if(p.getPoint(g/f,m),h.set(m.x,m.y,0),l!==void 0&&fOe(l,h))continue;l===void 0&&(l=xH),l.copy(h),n.setXYZ(u,h.x,h.y,h.z),u++}}o&&u>1&&(n.getX(u-1)!==n.getX(0)||n.getY(u-1)!==n.getY(0)||n.getZ(u-1)!==n.getZ(0))&&(n.setXYZ(u,n.getX(0),n.getY(0),n.getZ(0)),u++)}(e,i?this.roundedCurves:this.curves,t,this.autoClose),r.reduce((n,a)=>n+a,0)+1}computeCurveDivisions(e=12){return this.curveDivisions=Rte(this.points,e,!1),this.roundedCurveDivisions=Rte(this.points,e,!0),this.curveDivisions}extractFilteredShapePointsToBuffer(e,t,i=12){return 2*function(r,n,a,s=12,o=!0){let l=wH.set(0,0,0),h=0,u=[];for(let d=0;d<n.length;d++){if(a[d]===!1)continue;let c,p=sI(n[d]),m=ly,f=oy(p,s);u.push(f);for(let g=0;g<=f;g++)if(p instanceof fu||p instanceof lm||p instanceof Th){if(p.getPoint(g/f,m),l.set(m.x,m.y,0),c?.equals(l))continue;c===void 0?c=xH:(r.setXYZ(h,c.x,c.y,c.z),h++,r.setXYZ(h,l.x,l.y,l.z),h++),c.copy(l)}}return 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++),u}(e,this.curves,t,i,this.autoClose).reduce((r,n)=>r+n,0)}extractShapePointsToFlatArray(e,t=12){return this.subdivision=t,this.curveDivisions===void 0&&this.computeCurveDivisions(t),function(i,r,n=12,a=!0){let s,o=0;for(let l=0;l<r.length;l++){let h=sI(r[l]),u=oy(h,n),d=ly;for(let c=0;c<=u;c++)if(h instanceof fu||h instanceof lm||h instanceof Th){if(h.getPoint(c/u,d),s!==void 0&&mOe(s,d,Lb))continue;s===void 0&&(s=pA),s.copy(d),i.push(d.x,d.y),o++}}return EM(i[0],i[i.length-2],Lb)&&EM(i[1],i[i.length-1],Lb)&&(i.pop(),i.pop()),a&&o>1&&!(EM(i[o-1],i[1],Lb)&&EM(i[o-2],i[0],Lb))&&(i.push(i[0],i[1]),o++),i}(e,this.roundedCurves,t,this.autoClose)}getCurveIndexFromVertexId(e,t=!1){let i=0;this.curveDivisions===void 0&&this.computeCurveDivisions(this.subdivision);let r=t?this.roundedCurveDivisions:this.curveDivisions,n=0;t&&this.points[0].roundedCurveCorner!==void 0&&(n=.5*oy(this.points[0].roundedCurveCorner,this.subdivision));let a=e-n;a<0&&(a+=r.reduce((s,o)=>s+o,0));for(let s=0,o=r.length;s<o;s++){let l=r[s];if(a<i+l)return[s,(a-i+1)/l];i+=l}return[0,1]}getCurveT(e,t,i){let r=this.points[e],n=this.points[e>=this.points.length-1?0:e+1],a=this.curveDivisions,s=a[e];if(Cte(r,n)){let l=r.position.distanceTo(n.position);return r.position.distanceTo(l3.set(i.x,i.y))/l}let o=0;for(let l=0;l<e;l++)o+=a[l];return(t-o)/s}dispose(){}_applyCurveForPoint(e,t){Cte(t,e)?this.lineTo(e.position.x,e.position.y):this.bezierCurveTo(t.controls[1].position.x,t.controls[1].position.y,e.controls[0].position.x,e.controls[0].position.y,e.position.x,e.position.y);let i=this.curves[this.curves.length-1];e.curveBefore=i,t.curveAfter=i;let r=i.clone();e.roundedCurveBefore=r,t.roundedCurveAfter=r,e.roundedCurveCorner=void 0,this.roundedCurves.push(r)}_update(){if(this.curves=[],this.roundedCurves=[],!this.points.length)return;for(let t=0,i=this.points.length;t<i;t++){let r=this.points[t];if(t===0)this.moveTo(r.position.x,r.position.y);else{let n=this.points[t-1];this._applyCurveForPoint(r,n)}}let e=this.getLastPoint();if(e?.curveAfter&&(e.curveAfter=void 0),this.isClosed){let t=this.points[0],i=this.points[this.points.length-1];this._applyCurveForPoint(t,i)}if(this.points.length>2){let t=0;for(let i=0,r=this.points.length;i<r;i++){let n=this.points[i],a=this.points[i-1]??this.points[this.points.length-1],s=this.points[i+1]??this.points[0],o=n.roundness,l=a&&s&&gOe(a,n,s);if(!n.controlsMoved()&&o>0&&!l){let h=n.curveBefore,u=n.curveAfter;if(h===void 0||u===void 0)continue;let d,c=n.roundedCurveBefore,p=n.roundedCurveAfter,m=h instanceof Th?h.v1.distanceTo(h.v2):h.getLength(),f=u instanceof Th?u.v1.distanceTo(u.v2):u.getLength(),g=Math.min(o,.499*m),v=Math.min(o,.499*f),y=Math.min(g,v),_=1-y/m,b=y/f,x=h.getPointAt(_,l3),w=u.getPointAt(b,Dte);if(this._subSplitCurve(h,c,_,x,void 0),this._subSplitCurve(u,p,b,void 0,w),this.useCubicForRoundedCorners){let S=$_e(x,n.position,w)/2,M=Math.tan(S)*x.distanceTo(n.position),[T,A]=vOe(x,w,M,Nte,Ite),E=yOe(T,A,n.position),[C,N]=_Oe(E,x,w,M,Ote,Lte);d=new fu(x.clone(),C.clone(),N.clone(),w.clone())}else d=new lm(x.clone(),n.position.clone(),w.clone());n.roundedCurveCorner=d,this.roundedCurves.splice(i+t,0,d),t++}}}}_subSplitCurve(e,t,i,r,n){if(!(e instanceof Th)){let a=e,s=t,o=a.getUtoTmapping(i,0),l=function(h,u,d,c,p=.5){let m=ly.subVectors(u,h).multiplyScalar(p).add(h),f=pA.subVectors(d,u).multiplyScalar(p).add(u),g=X_e.subVectors(c,d).multiplyScalar(p).add(d),v=m,y=Y_e.subVectors(f,m).multiplyScalar(p).add(m),_=K_e.subVectors(g,f).multiplyScalar(p).add(f),b=g,x=Z_e.subVectors(_,y).multiplyScalar(p).add(y);return[h.x,h.y,v.x,v.y,y.x,y.y,x.x,x.y,_.x,_.y,b.x,b.y,c.x,c.y]}(a.v0,a.v1,a.v2,a.v3,o);return r!==void 0&&(s.v0.set(l[0],l[1]),s.v1.set(l[2],l[3]),s.v2.set(l[4],l[5]),s.v3.set(l[6],l[7])),n!==void 0&&(s.v0.set(l[6],l[7]),s.v1.set(l[8],l[9]),s.v2.set(l[10],l[11]),s.v3.set(l[12],l[13])),s}return r!==void 0&&t.v2.copy(r),n!==void 0&&t.v1.copy(n),t}clone(){let e=new da(this._width,this._height);return e.points=this.points.map(t=>t.clone()),e.isClosed=this.isClosed,e.roundness=this.roundness,e.isMesh2D=this.isMesh2D,e.shapeHoles=this.shapeHoles.map(t=>t.clone()),e}toJSON(){return{points:this.points.reduce((e,t)=>e.concat(t.toJSON()),[]),shapeHoles:this.shapeHoles.map(e=>e.toJSON()),isClosed:this.isClosed,roundness:this.roundness}}fromJSON(e){this.points=[],this.pointIDs=0;let t=e.points.length/7;for(let i=0;i<t;i++){let r=7*i,n=e.points[r+0],a=e.points[r+1],s=e.points[r+2],o=e.points[r+3],l=e.points[r+4],h=e.points[r+5],u=e.points[r+6],d=new wy(ht.generateUUID(),new J(n,a));d.controls[0].position.set(s,o),d.controls[1].position.set(l,h),d.roundness=u,this.points.push(d)}return this.shapeHoles=e.shapeHoles?.length?e.shapeHoles.map(i=>{let r=new da;return r.fromJSON(i),r}):[],this.isClosed=e.isClosed,this._roundness=e.roundness,this._update(),this}fromShape(e,t=!1){this.isText=t;let i=(r,n)=>{n instanceof fu&&n.v3.equals(r.position)&&r.controls[0].position.copy(n.v2)};return this.points=(r=>{let n,a,s=[];for(n=0,a=r.length;n<a;n++)r[n]instanceof lm&&(r[n]=pOe(r[n]));for(n=0,a=r.length;n<a;n++){let h,u=r[n],d=n>0?r[n-1]:null;u instanceof fu?(h=this.createPoint(u.v0),h.controls[1].position.copy(u.v1)):u instanceof Th&&(h=this.createPoint(u.v1)),h!==void 0&&(d!==null&&i(h,d),s.push(h))}let o=r[r.length-1],l=!1;return o instanceof fu?o.v3.equals(s[0].position)&&(s[0].controls[0].position.copy(o.v2),l=!0):o instanceof Th&&o.v2.equals(s[0].position)&&(l=!0),this.isClosed=l,s})(e.curves),e instanceof YE&&(this.shapeHoles=e.holes.map(r=>{let n=new da;return n.fromShape(r),n})),this.update(),this}updatePoint(e,t){let i=this.getPointByUuid(e);i&&(t.position!==void 0&&i.position.fromArray(t.position),t.roundness!==void 0&&(i.roundness=t.roundness),t.areControlsDirectionsMirrored!==void 0&&(i.areControlsDirectionsMirrored=t.areControlsDirectionsMirrored),this.needsUpdate=!0)}updatePreviousControl(e,t){let i=this.getPointByUuid(e)?.controls[0];i&&(t.position&&i.position.fromArray(t.position),this.needsUpdate=!0)}updateNextControl(e,t){let i=this.getPointByUuid(e)?.controls[1];i&&(t.position&&i.position.fromArray(t.position),this.needsUpdate=!0)}}});function DF({x:e,y:t},i,r,n,a){return{x:e*i+n,y:t*r+a}}function bOe(e,t){let i=t===1.5707963267948966?.551915024494:t===-1.5707963267948966?-.551915024494:1.3333333333333333*Math.tan(t/4),r=Math.cos(e),n=Math.sin(e),a=Math.cos(e+t),s=Math.sin(e+t);return[{x:r-n*i,y:n+r*i},{x:a+s*i,y:s-a*i},{x:a,y:s}]}function Bte(e,t,i,r){let n=e*r-t*i<0?-1:1,a=Math.min(1,Math.max(-1,e*i+t*r));return n*Math.acos(a)}var oI,xOe=k(()=>{oI=2*Math.PI});function Mi(e,t){if(!e)throw t||"Assertion Failed!"}function Dg(e){var t=e.windingRule,i=t===void 0?xn.ODD:t,r=e.elementType,n=r===void 0?os.POLYGONS:r,a=e.polySize,s=a===void 0?3:a,o=e.vertexSize,l=o===void 0?2:o,h=e.normal,u=h===void 0?[0,0,1]:h,d=e.contours,c=d===void 0?[]:d,p=e.strict,m=p===void 0||p,f=e.debug,g=f!==void 0&&f;if(!c&&m)throw new Error("Contours can't be empty");if(c){var v=new J_e;e.edgeCreateCallback&&(v.edgeCreateCallback=e.edgeCreateCallback),e.vertexIdCallback&&(v.vertexIdCallback=e.vertexIdCallback);for(var y=0;y<c.length;y++)v.addContour(l||2,c[y]);return v.tesselate(i,n,s,l,u,m),{vertices:v.vertices,vertexIndices:v.vertexIndices,vertexCount:v.vertexCount,elements:v.elements,elementCount:v.elementCount,mesh:g?v.mesh:void 0}}}var xn,os,pi,$1,IS,O0,NF,IF,OF,Ute,h3,LF,Fte,zte,J_e,BF,ebe,tbe,Sw=k(()=>{var e;(e=xn||(xn={}))[e.ODD=0]="ODD",e[e.NONZERO=1]="NONZERO",e[e.POSITIVE=2]="POSITIVE",e[e.NEGATIVE=3]="NEGATIVE",e[e.ABS_GEQ_TWO=4]="ABS_GEQ_TWO",function(t){t[t.POLYGONS=0]="POLYGONS",t[t.CONNECTED_POLYGONS=1]="CONNECTED_POLYGONS",t[t.BOUNDARY_CONTOURS=2]="BOUNDARY_CONTOURS"}(os||(os={})),pi=function(){function t(){}return t.vertEq=function(i,r){return i.s===r.s&&i.t===r.t},t.vertLeq=function(i,r){return i.s<r.s||i.s===r.s&&i.t<=r.t},t.transLeq=function(i,r){return i.t<r.t||i.t===r.t&&i.s<=r.s},t.edgeGoesLeft=function(i){return t.vertLeq(i.Dst,i.Org)},t.edgeGoesRight=function(i){return t.vertLeq(i.Org,i.Dst)},t.vertL1dist=function(i,r){return Math.abs(i.s-r.s)+Math.abs(i.t-r.t)},t.edgeEval=function(i,r,n){Mi(t.vertLeq(i,r)&&t.vertLeq(r,n));var a=r.s-i.s,s=n.s-r.s;return a+s>0?a<s?r.t-i.t+(i.t-n.t)*(a/(a+s)):r.t-n.t+(n.t-i.t)*(s/(a+s)):0},t.edgeSign=function(i,r,n){Mi(t.vertLeq(i,r)&&t.vertLeq(r,n));var a=r.s-i.s,s=n.s-r.s;return a+s>0?(r.t-n.t)*a+(r.t-i.t)*s:0},t.transEval=function(i,r,n){Mi(t.transLeq(i,r)&&t.transLeq(r,n));var a=r.t-i.t,s=n.t-r.t;return a+s>0?a<s?r.s-i.s+(i.s-n.s)*(a/(a+s)):r.s-n.s+(n.s-i.s)*(s/(a+s)):0},t.transSign=function(i,r,n){Mi(t.transLeq(i,r)&&t.transLeq(r,n));var a=r.t-i.t,s=n.t-r.t;return a+s>0?(r.s-n.s)*a+(r.s-i.s)*s:0},t.vertCCW=function(i,r,n){return i.s*(r.t-n.t)+r.s*(n.t-i.t)+n.s*(i.t-r.t)>=0},t.interpolate=function(i,r,n,a){return(i=i<0?0:i)<=(n=n<0?0:n)?n===0?(r+a)/2:r+i/(i+n)*(a-r):a+n/(i+n)*(r-a)},t.intersect=function(i,r,n,a,s){var o,l,h;t.vertLeq(i,r)||(h=i,i=r,r=h),t.vertLeq(n,a)||(h=n,n=a,a=h),t.vertLeq(i,n)||(h=i,i=n,n=h,h=r,r=a,a=h),t.vertLeq(n,r)?t.vertLeq(r,a)?((o=t.edgeEval(i,n,r))+(l=t.edgeEval(n,r,a))<0&&(o=-o,l=-l),s.s=t.interpolate(o,n.s,l,r.s)):((o=t.edgeSign(i,n,r))+(l=-t.edgeSign(i,a,r))<0&&(o=-o,l=-l),s.s=t.interpolate(o,n.s,l,a.s)):s.s=(n.s+r.s)/2,t.transLeq(i,r)||(h=i,i=r,r=h),t.transLeq(n,a)||(h=n,n=a,a=h),t.transLeq(i,n)||(h=i,i=n,n=h,h=r,r=a,a=h),t.transLeq(n,r)?t.transLeq(r,a)?((o=t.transEval(i,n,r))+(l=t.transEval(n,r,a))<0&&(o=-o,l=-l),s.t=t.interpolate(o,n.t,l,r.t)):((o=t.transSign(i,n,r))+(l=-t.transSign(i,a,r))<0&&(o=-o,l=-l),s.t=t.interpolate(o,n.t,l,a.t)):s.t=(n.t+r.t)/2},t}(),$1=function(){this.next=null,this.prev=null,this.anEdge=null,this.trail=null,this.n=0,this.marked=!1,this.inside=!1},IS=function(){function t(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(t.prototype,"Rface",{get:function(){return this.Sym.Lface},set:function(i){this.Sym.Lface=i},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"Dst",{get:function(){return this.Sym.Org},set:function(i){this.Sym.Org=i},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"Oprev",{get:function(){return this.Sym.Lnext},set:function(i){this.Sym.Lnext=i},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"Lprev",{get:function(){return this.Onext.Sym},set:function(i){this.Onext.Sym=i},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"Dprev",{get:function(){return this.Lnext.Sym},set:function(i){this.Lnext.Sym=i},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"Rprev",{get:function(){return this.Sym.Onext},set:function(i){this.Sym.Onext=i},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"Dnext",{get:function(){return this.Sym.Onext.Sym},set:function(i){this.Sym.Onext.Sym=i},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"Rnext",{get:function(){return this.Sym.Lnext.Sym},set:function(i){this.Sym.Lnext.Sym=i},enumerable:!0,configurable:!0}),t}(),O0=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},NF=function(){function t(){var i=new O0,r=new $1,n=new IS(0),a=new IS(1);i.next=i.prev=i,i.anEdge=null,r.next=r.prev=r,n.next=n,n.Sym=a,a.next=a,a.Sym=n,this.vHead=i,this.fHead=r,this.eHead=n,this.eHeadSym=a}return t.prototype.makeEdge_=function(i){var r=new IS(0),n=new IS(1);i.Sym.side<i.side&&(i=i.Sym);var a=i.Sym.next;return n.next=a,a.Sym.next=r,r.next=i,i.Sym.next=n,r.Sym=n,r.Onext=r,r.Lnext=n,r.Org=null,r.Lface=null,r.winding=0,r.activeRegion=null,n.Sym=r,n.Onext=n,n.Lnext=r,n.Org=null,n.Lface=null,n.winding=0,n.activeRegion=null,r},t.prototype.splice_=function(i,r){var n=i.Onext,a=r.Onext;n.Sym.Lnext=r,a.Sym.Lnext=i,i.Onext=a,r.Onext=n},t.prototype.makeVertex_=function(i,r,n){var a=i;Mi(a,"Vertex can't be null!");var s=n.prev;a.prev=s,s.next=a,a.next=n,n.prev=a,a.anEdge=r;var o=r;do o.Org=a,o=o.Onext;while(o!==r)},t.prototype.makeFace_=function(i,r,n){var a=i;Mi(a,"Face can't be null");var s=n.prev;a.prev=s,s.next=a,a.next=n,n.prev=a,a.anEdge=r,a.trail=null,a.marked=!1,a.inside=n.inside;var o=r;do o.Lface=a,o=o.Lnext;while(o!==r)},t.prototype.killEdge_=function(i){i.Sym.side<i.side&&(i=i.Sym);var r=i.next,n=i.Sym.next;r.Sym.next=n,n.Sym.next=r},t.prototype.killVertex_=function(i,r){var n=i.anEdge,a=n;do a.Org=r,a=a.Onext;while(a!==n);var s=i.prev,o=i.next;o.prev=s,s.next=o},t.prototype.killFace_=function(i,r){var n=i.anEdge,a=n;do a.Lface=r,a=a.Lnext;while(a!==n);var s=i.prev,o=i.next;o.prev=s,s.next=o},t.prototype.makeEdge=function(){var i=new O0,r=new O0,n=new $1,a=this.makeEdge_(this.eHead);return this.makeVertex_(i,a,this.vHead),this.makeVertex_(r,a.Sym,this.vHead),this.makeFace_(n,a,this.fHead),a},t.prototype.splice=function(i,r){var n=!1,a=!1;if(i!==r){if(r.Org!==i.Org&&(a=!0,this.killVertex_(r.Org,i.Org)),r.Lface!==i.Lface&&(n=!0,this.killFace_(r.Lface,i.Lface)),this.splice_(r,i),!a){var s=new O0;this.makeVertex_(s,r,i.Org),i.Org.anEdge=i}if(!n){var o=new $1;this.makeFace_(o,r,i.Lface),i.Lface.anEdge=i}}},t.prototype.delete=function(i){var r=i.Sym,n=!1;if(i.Lface!==i.Rface&&(n=!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),!n){var a=new $1;this.makeFace_(a,i,i.Lface)}r.Onext===r?(this.killVertex_(r.Org,null),this.killFace_(r.Lface,null)):(i.Lface.anEdge=r.Oprev,r.Org.anEdge=r.Onext,this.splice_(r,r.Oprev)),this.killEdge_(i)},t.prototype.addEdgeVertex=function(i){var r=this.makeEdge_(i),n=r.Sym;this.splice_(r,i.Lnext),r.Org=i.Dst;var a=new O0;return this.makeVertex_(a,n,r.Org),r.Lface=n.Lface=i.Lface,r},t.prototype.splitEdge=function(i){var r=this.addEdgeVertex(i).Sym;return this.splice_(i.Sym,i.Sym.Oprev),this.splice_(i.Sym,r),i.Dst=r.Org,r.Dst.anEdge=r.Sym,r.Rface=i.Rface,r.winding=i.winding,r.Sym.winding=i.Sym.winding,r.idx=i.idx,r.Sym.idx=i.Sym.idx,r},t.prototype.connect=function(i,r){var n=!1,a=this.makeEdge_(i),s=a.Sym;if(r.Lface!==i.Lface&&(n=!0,this.killFace_(r.Lface,i.Lface)),this.splice_(a,i.Lnext),this.splice_(s,r),a.Org=i.Dst,s.Org=r.Org,a.Lface=s.Lface=i.Lface,i.Lface.anEdge=s,!n){var o=new $1;this.makeFace_(o,a,i.Lface)}return a},t.prototype.zapFace=function(i){var r,n,a,s,o,l=i.anEdge;n=l.Lnext;do n=(r=n).Lnext,r.Lface=null,r.Rface===null&&(r.Onext===r?this.killVertex_(r.Org,null):(r.Org.anEdge=r.Onext,this.splice_(r,r.Oprev)),(a=r.Sym).Onext===a?this.killVertex_(a.Org,null):(a.Org.anEdge=a.Onext,this.splice_(a,a.Oprev)),this.killEdge_(r));while(r!=l);s=i.prev,(o=i.next).prev=s,s.next=o},t.prototype.countFaceVerts_=function(i){var r=i.anEdge,n=0;do n++,r=r.Lnext;while(r!==i.anEdge);return n},t.prototype.mergeConvexFaces=function(i){var r,n,a,s,o;for(r=this.fHead.next;r!==this.fHead;r=r.next)if(r.inside)for(o=(n=r.anEdge).Org;a=n.Lnext,(s=n.Sym)&&s.Lface&&s.Lface.inside&&this.countFaceVerts_(r)+this.countFaceVerts_(s.Lface)-2<=i&&pi.vertCCW(n.Lprev.Org,n.Org,s.Lnext.Lnext.Org)&&pi.vertCCW(s.Lprev.Org,s.Org,n.Lnext.Lnext.Org)&&(a=s.Lnext,this.delete(s),n=null,s=null),!n||n.Lnext.Org!==o;)n=a;return!0},t.prototype.check=function(){var i,r,n,a,s,o,l=this.fHead,h=this.vHead,u=this.eHead;for(r=l,r=l;(i=r.next)!==l;r=i){Mi(i.prev===r),s=i.anEdge;do Mi(s.Sym!==s),Mi(s.Sym.Sym===s),Mi(s.Lnext.Onext.Sym===s),Mi(s.Onext.Sym.Lnext===s),Mi(s.Lface===i),s=s.Lnext;while(s!==i.anEdge)}for(Mi(i.prev===r&&i.anEdge===null),a=h,a=h;(n=a.next)!==h;a=n){Mi(n.prev===a),s=n.anEdge;do Mi(s.Sym!==s),Mi(s.Sym.Sym===s),Mi(s.Lnext.Onext.Sym===s),Mi(s.Onext.Sym.Lnext===s),Mi(s.Org===n),s=s.Onext;while(s!==n.anEdge)}for(Mi(n.prev===a&&n.anEdge===null),o=u,o=u;(s=o.next)!==u;o=s)Mi(s.Sym.next===o.Sym),Mi(s.Sym!==s),Mi(s.Sym.Sym===s),Mi(s.Org!==null),Mi(s.Dst!==null),Mi(s.Lnext.Onext.Sym===s),Mi(s.Onext.Sym.Lnext===s);Mi(s.Sym.next===o.Sym&&s.Sym===this.eHeadSym&&s.Sym.Sym===s&&s.Org===null&&s.Dst===null&&s.Lface===null&&s.Rface===null)},t}(),IF=function(){this.handle=null},OF=function(){this.key=null,this.node=0},Ute=function(){function t(i,r){this.leq=r,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 n=0;n<i+1;n++)this.nodes[n]=new IF,this.handles[n]=new OF;this.initialized=!1,this.nodes[1].handle=1,this.handles[1].key=null}return t.prototype.floatDown_=function(i){var r,n,a,s=this.nodes,o=this.handles;for(r=s[i].handle;;){if((a=i<<1)<this.size&&this.leq(o[s[a+1].handle].key,o[s[a].handle].key)&&++a,Mi(a<=this.max),n=s[a].handle,a>this.size||this.leq(o[r].key,o[n].key)){s[i].handle=r,o[r].node=i;break}s[i].handle=n,o[n].node=i,i=a}},t.prototype.floatUp_=function(i){var r,n,a,s=this.nodes,o=this.handles;for(r=s[i].handle;;){if(n=s[a=i>>1].handle,a===0||this.leq(o[n].key,o[r].key)){s[i].handle=r,o[r].node=i;break}s[i].handle=n,o[n].node=i,i=a}},t.prototype.init=function(){for(var i=this.size;i>=1;--i)this.floatDown_(i);this.initialized=!0},t.prototype.min=function(){return this.handles[this.nodes[1].handle].key},t.prototype.insert=function(i){var r,n;if(2*(r=++this.size)>this.max){var a,s;for(this.max*=2,s=this.nodes.length,this.nodes.length=this.max+1,a=s;a<this.nodes.length;a++)this.nodes[a]=new IF;for(s=this.handles.length,this.handles.length=this.max+1,a=s;a<this.handles.length;a++)this.handles[a]=new OF}return this.freeList===0?n=r:(n=this.freeList,this.freeList=this.handles[n].node),this.nodes[r].handle=n,this.handles[n].node=r,this.handles[n].key=i,this.initialized&&this.floatUp_(r),n},t.prototype.extractMin=function(){var i=this.nodes,r=this.handles,n=i[1].handle,a=r[n].key;return this.size>0&&(i[1].handle=i[this.size].handle,r[i[1].handle].node=1,r[n].key=null,r[n].node=this.freeList,this.freeList=n,--this.size,this.size>0&&this.floatDown_(1)),a},t.prototype.delete=function(i){var r,n=this.nodes,a=this.handles;Mi(i>=1&&i<=this.max&&a[i].key!==null),n[r=a[i].node].handle=n[this.size].handle,a[n[r].handle].node=r,--this.size,r<=this.size&&(r<=1||this.leq(a[n[r>>1].handle].key,a[n[r].handle].key)?this.floatDown_(r):this.floatUp_(r)),a[i].key=null,a[i].node=this.freeList,this.freeList=i},t}(),h3=function(){this.eUp=null,this.nodeUp=null,this.windingNumber=0,this.inside=!1,this.sentinel=!1,this.dirty=!1,this.fixUpperEdge=!1},LF=function(){this.key=null,this.next=null,this.prev=null},Fte=function(){function t(i,r){this.frame=i,this.leq=r,this.head=new LF,this.head.next=this.head,this.head.prev=this.head}return t.prototype.min=function(){return this.head.next},t.prototype.max=function(){return this.head.prev},t.prototype.insert=function(i){return this.insertBefore(this.head,i)},t.prototype.search=function(i){var r=this.head;do r=r.next;while(r.key!==null&&!this.leq(this.frame,i,r.key));return r},t.prototype.insertBefore=function(i,r){do i=i.prev;while(i.key!==null&&!this.leq(this.frame,i.key,r));var n=new LF;return n.key=r,n.next=i.next,i.next.prev=n,n.prev=i,i.next=n,n},t.prototype.delete=function(i){i.next.prev=i.prev,i.prev.next=i.next},t}(),zte=function(){function t(){}return t.regionBelow=function(i){return i.nodeUp.prev.key},t.regionAbove=function(i){return i.nodeUp.next.key},t.debugEvent=function(i){},t.addWinding=function(i,r){i.winding+=r.winding,i.Sym.winding+=r.Sym.winding},t.edgeLeq=function(i,r,n){var a=i.event,s=r.eUp,o=n.eUp;return s.Dst===a?o.Dst===a?pi.vertLeq(s.Org,o.Org)?pi.edgeSign(o.Dst,s.Org,o.Org)<=0:pi.edgeSign(s.Dst,o.Org,s.Org)>=0:pi.edgeSign(o.Dst,a,o.Org)<=0:o.Dst===a?pi.edgeSign(s.Dst,a,s.Org)>=0:pi.edgeEval(s.Dst,a,s.Org)>=pi.edgeEval(o.Dst,a,o.Org)},t.deleteRegion=function(i,r){r.fixUpperEdge&&Mi(r.eUp.winding===0),r.eUp.activeRegion=null,i.dict.delete(r.nodeUp)},t.fixUpperEdge=function(i,r,n){Mi(r.fixUpperEdge),i.mesh.delete(r.eUp),r.fixUpperEdge=!1,r.eUp=n,n.activeRegion=r},t.topLeftRegion=function(i,r){var n,a=r.eUp.Org;do r=t.regionAbove(r);while(r.eUp.Org===a);if(r.fixUpperEdge){if((n=i.mesh.connect(t.regionBelow(r).eUp.Sym,r.eUp.Lnext))===null)return null;t.fixUpperEdge(i,r,n),r=t.regionAbove(r)}return r},t.topRightRegion=function(i){var r=i.eUp.Dst;do i=t.regionAbove(i);while(i.eUp.Dst===r);return i},t.addRegionBelow=function(i,r,n){var a=new h3;return a.eUp=n,a.nodeUp=i.dict.insertBefore(r.nodeUp,a),a.fixUpperEdge=!1,a.sentinel=!1,a.dirty=!1,n.activeRegion=a,a},t.isWindingInside=function(i,r){switch(i.windingRule){case xn.ODD:return!!(1&r);case xn.NONZERO:return r!==0;case xn.POSITIVE:return r>0;case xn.NEGATIVE:return r<0;case xn.ABS_GEQ_TWO:return r>=2||r<=-2}throw new Error("Invalid winding rulle")},t.computeWinding=function(i,r){r.windingNumber=t.regionAbove(r).windingNumber+r.eUp.winding,r.inside=t.isWindingInside(i,r.windingNumber)},t.finishRegion=function(i,r){var n=r.eUp,a=n.Lface;a.inside=r.inside,a.anEdge=n,t.deleteRegion(i,r)},t.finishLeftRegions=function(i,r,n){for(var a,s=null,o=r,l=r.eUp;o!==n;){if(o.fixUpperEdge=!1,(a=(s=t.regionBelow(o)).eUp).Org!=l.Org){if(!s.fixUpperEdge){t.finishRegion(i,o);break}a=i.mesh.connect(l.Lprev,a.Sym),t.fixUpperEdge(i,s,a)}l.Onext!==a&&(i.mesh.splice(a.Oprev,a),i.mesh.splice(l,a)),t.finishRegion(i,o),l=s.eUp,o=s}return l},t.addRightEdges=function(i,r,n,a,s,o){var l,h,u,d,c=!0;u=n;do Mi(pi.vertLeq(u.Org,u.Dst)),t.addRegionBelow(i,r,u.Sym),u=u.Onext;while(u!==a);for(s===null&&(s=t.regionBelow(r).eUp.Rprev),h=r,d=s;(u=(l=t.regionBelow(h)).eUp.Sym).Org===d.Org;)u.Onext!==d&&(i.mesh.splice(u.Oprev,u),i.mesh.splice(d.Oprev,u)),l.windingNumber=h.windingNumber-u.winding,l.inside=t.isWindingInside(i,l.windingNumber),h.dirty=!0,!c&&t.checkForRightSplice(i,h)&&(t.addWinding(u,d),t.deleteRegion(i,h),i.mesh.delete(d)),c=!1,h=l,d=u;h.dirty=!0,Mi(h.windingNumber-u.winding===l.windingNumber),o&&t.walkDirtyRegions(i,h)},t.spliceMergeVertices=function(i,r,n){i.mesh.splice(r,n)},t.vertexWeights=function(i,r,n){var a=pi.vertL1dist(r,i),s=pi.vertL1dist(n,i),o=.5*s/(a+s),l=.5*a/(a+s);i.coords[0]+=o*r.coords[0]+l*n.coords[0],i.coords[1]+=o*r.coords[1]+l*n.coords[1],i.coords[2]+=o*r.coords[2]+l*n.coords[2]},t.getIntersectData=function(i,r,n,a,s,o){r.coords[0]=r.coords[1]=r.coords[2]=0,r.idx=-1,t.vertexWeights(r,n,a),t.vertexWeights(r,s,o)},t.checkForRightSplice=function(i,r){var n=t.regionBelow(r),a=r.eUp,s=n.eUp;if(pi.vertLeq(a.Org,s.Org)){if(pi.edgeSign(s.Dst,a.Org,s.Org)>0)return!1;pi.vertEq(a.Org,s.Org)?a.Org!==s.Org&&(i.pq.delete(a.Org.pqHandle),t.spliceMergeVertices(i,s.Oprev,a)):(i.mesh.splitEdge(s.Sym),i.mesh.splice(a,s.Oprev),r.dirty=n.dirty=!0)}else{if(pi.edgeSign(a.Dst,s.Org,a.Org)<0)return!1;t.regionAbove(r).dirty=r.dirty=!0,i.mesh.splitEdge(a.Sym),i.mesh.splice(s.Oprev,a)}return!0},t.checkForLeftSplice=function(i,r){var n,a=t.regionBelow(r),s=r.eUp,o=a.eUp;if(Mi(!pi.vertEq(s.Dst,o.Dst)),pi.vertLeq(s.Dst,o.Dst)){if(pi.edgeSign(s.Dst,o.Dst,s.Org)<0)return!1;t.regionAbove(r).dirty=r.dirty=!0,n=i.mesh.splitEdge(s),i.mesh.splice(o.Sym,n),n.Lface.inside=r.inside}else{if(pi.edgeSign(o.Dst,s.Dst,o.Org)>0)return!1;r.dirty=a.dirty=!0,n=i.mesh.splitEdge(o),i.mesh.splice(s.Lnext,o.Sym),n.Rface.inside=r.inside}return!0},t.checkForIntersect=function(i,r){var n,a,s=t.regionBelow(r),o=r.eUp,l=s.eUp,h=o.Org,u=l.Org,d=o.Dst,c=l.Dst,p=new O0;if(Mi(!pi.vertEq(c,d)),Mi(pi.edgeSign(d,i.event,h)<=0),Mi(pi.edgeSign(c,i.event,u)>=0),Mi(h!==i.event&&u!==i.event),Mi(!r.fixUpperEdge&&!s.fixUpperEdge),h===u||Math.min(h.t,d.t)>Math.max(u.t,c.t))return!1;if(pi.vertLeq(h,u)){if(pi.edgeSign(c,h,u)>0)return!1}else if(pi.edgeSign(d,u,h)<0)return!1;return t.debugEvent(i),pi.intersect(d,h,c,u,p),Mi(Math.min(h.t,d.t)<=p.t),Mi(p.t<=Math.max(u.t,c.t)),Mi(Math.min(c.s,d.s)<=p.s),Mi(p.s<=Math.max(u.s,h.s)),pi.vertLeq(p,i.event)&&(p.s=i.event.s,p.t=i.event.t),n=pi.vertLeq(h,u)?h:u,pi.vertLeq(n,p)&&(p.s=n.s,p.t=n.t),pi.vertEq(p,h)||pi.vertEq(p,u)?(t.checkForRightSplice(i,r),!1):!pi.vertEq(d,i.event)&&pi.edgeSign(d,i.event,p)>=0||!pi.vertEq(c,i.event)&&pi.edgeSign(c,i.event,p)<=0?c===i.event?(i.mesh.splitEdge(o.Sym),i.mesh.splice(l.Sym,o),r=t.topLeftRegion(i,r),o=t.regionBelow(r).eUp,t.finishLeftRegions(i,t.regionBelow(r),s),t.addRightEdges(i,r,o.Oprev,o,o,!0),!0):d===i.event?(i.mesh.splitEdge(l.Sym),i.mesh.splice(o.Lnext,l.Oprev),s=r,r=t.topRightRegion(r),a=t.regionBelow(r).eUp.Rprev,s.eUp=l.Oprev,l=t.finishLeftRegions(i,s,null),t.addRightEdges(i,r,l.Onext,o.Rprev,a,!0),!0):(pi.edgeSign(d,i.event,p)>=0&&(t.regionAbove(r).dirty=r.dirty=!0,i.mesh.splitEdge(o.Sym),o.Org.s=i.event.s,o.Org.t=i.event.t),pi.edgeSign(c,i.event,p)<=0&&(r.dirty=s.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),t.getIntersectData(i,o.Org,h,d,u,c),t.regionAbove(r).dirty=r.dirty=s.dirty=!0,!1)},t.walkDirtyRegions=function(i,r){for(var n,a,s=t.regionBelow(r);;){for(;s.dirty;)r=s,s=t.regionBelow(s);if(!r.dirty&&(s=r,(r=t.regionAbove(r))===null||!r.dirty))return;if(r.dirty=!1,n=r.eUp,a=s.eUp,n.Dst!==a.Dst&&t.checkForLeftSplice(i,r)&&(s.fixUpperEdge?(t.deleteRegion(i,s),i.mesh.delete(a),a=(s=t.regionBelow(r)).eUp):r.fixUpperEdge&&(t.deleteRegion(i,r),i.mesh.delete(n),n=(r=t.regionAbove(s)).eUp)),n.Org!==a.Org){if(n.Dst===a.Dst||r.fixUpperEdge||s.fixUpperEdge||n.Dst!==i.event&&a.Dst!==i.event)t.checkForRightSplice(i,r);else if(t.checkForIntersect(i,r))return}n.Org===a.Org&&n.Dst===a.Dst&&(t.addWinding(a,n),t.deleteRegion(i,r),i.mesh.delete(n),r=t.regionAbove(s))}},t.connectRightVertex=function(i,r,n){var a,s=n.Onext,o=t.regionBelow(r),l=r.eUp,h=o.eUp,u=!1;l.Dst!==h.Dst&&t.checkForIntersect(i,r),pi.vertEq(l.Org,i.event)&&(i.mesh.splice(s.Oprev,l),r=t.topLeftRegion(i,r),s=t.regionBelow(r).eUp,t.finishLeftRegions(i,t.regionBelow(r),o),u=!0),pi.vertEq(h.Org,i.event)&&(i.mesh.splice(n,h.Oprev),n=t.finishLeftRegions(i,o,null),u=!0),u?t.addRightEdges(i,r,n.Onext,s,s,!0):(a=pi.vertLeq(h.Org,l.Org)?h.Oprev:l,a=i.mesh.connect(n.Lprev,a),t.addRightEdges(i,r,a,a.Onext,a.Onext,!1),a.Sym.activeRegion.fixUpperEdge=!0,t.walkDirtyRegions(i,r))},t.connectLeftDegenerate=function(i,r,n){var a,s,o,l,h;return a=r.eUp,pi.vertEq(a.Org,n)?(Mi(!1),void t.spliceMergeVertices(i,a,n.anEdge)):pi.vertEq(a.Dst,n)?(Mi(!1),r=t.topRightRegion(r),s=l=(o=(h=t.regionBelow(r)).eUp.Sym).Onext,h.fixUpperEdge&&(Mi(s!==o),t.deleteRegion(i,h),i.mesh.delete(o),o=s.Oprev),i.mesh.splice(n.anEdge,o),pi.edgeGoesLeft(s)||(s=null),void t.addRightEdges(i,r,o.Onext,l,s,!0)):(i.mesh.splitEdge(a.Sym),r.fixUpperEdge&&(i.mesh.delete(a.Onext),r.fixUpperEdge=!1),i.mesh.splice(n.anEdge,a),void t.sweepEvent(i,n))},t.connectLeftVertex=function(i,r){var n,a,s,o,l,h,u=new h3;if(u.eUp=r.anEdge.Sym,n=i.dict.search(u).key,a=t.regionBelow(n)){if(o=n.eUp,l=a.eUp,pi.edgeSign(o.Dst,r,o.Org)===0)return void t.connectLeftDegenerate(i,n,r);s=pi.vertLeq(l.Dst,o.Dst)?n:a,n.inside||s.fixUpperEdge?(h=s===n?i.mesh.connect(r.anEdge.Sym,o.Lnext):i.mesh.connect(l.Dnext,r.anEdge).Sym,s.fixUpperEdge?t.fixUpperEdge(i,s,h):t.computeWinding(i,t.addRegionBelow(i,n,h)),t.sweepEvent(i,r)):t.addRightEdges(i,n,r.anEdge,r.anEdge,null,!0)}},t.sweepEvent=function(i,r){i.event=r,t.debugEvent(i);for(var n=r.anEdge;n.activeRegion===null;)if((n=n.Onext)===r.anEdge)return void t.connectLeftVertex(i,r);var a=t.topLeftRegion(i,n.activeRegion);Mi(a!==null);var s=t.regionBelow(a),o=s.eUp,l=t.finishLeftRegions(i,s,null);l.Onext===o?t.connectRightVertex(i,a,l):t.addRightEdges(i,a,l.Onext,o,o,!0)},t.addSentinel=function(i,r,n,a){var s=new h3,o=i.mesh.makeEdge();o.Org.s=n,o.Org.t=a,o.Dst.s=r,o.Dst.t=a,i.event=o.Dst,s.eUp=o,s.windingNumber=0,s.inside=!1,s.fixUpperEdge=!1,s.sentinel=!0,s.dirty=!1,s.nodeUp=i.dict.insert(s)},t.initEdgeDict=function(i){i.dict=new Fte(i,t.edgeLeq);var r=i.bmax[0]-i.bmin[0],n=i.bmax[1]-i.bmin[1],a=i.bmin[0]-r,s=i.bmax[0]+r,o=i.bmin[1]-n,l=i.bmax[1]+n;t.addSentinel(i,a,s,o),t.addSentinel(i,a,s,l)},t.doneEdgeDict=function(i){for(var r,n=0;(r=i.dict.min().key)!==null;)r.sentinel||(Mi(r.fixUpperEdge),Mi(++n===1)),Mi(r.windingNumber===0),t.deleteRegion(i,r)},t.removeDegenerateEdges=function(i){var r,n,a,s=i.mesh.eHead;for(r=s.next;r!==s;r=n)n=r.next,a=r.Lnext,pi.vertEq(r.Org,r.Dst)&&r.Lnext.Lnext!==r&&(t.spliceMergeVertices(i,a,r),i.mesh.delete(r),a=(r=a).Lnext),a.Lnext===r&&(a!==r&&((a===n||a===n.Sym)&&(n=n.next),i.mesh.delete(a)),(r===n||r===n.Sym)&&(n=n.next),i.mesh.delete(r))},t.initPriorityQ=function(i){var r,n,a,s=0;for(n=(a=i.mesh.vHead).next;n!==a;n=n.next)s++;for(s+=8,r=i.pq=new Ute(s,pi.vertLeq),n=(a=i.mesh.vHead).next;n!==a;n=n.next)n.pqHandle=r.insert(n);return n===a&&(r.init(),!0)},t.donePriorityQ=function(i){i.pq=null},t.removeDegenerateFaces=function(i,r){var n,a,s;for(n=r.fHead.next;n!==r.fHead;n=a)a=n.next,Mi((s=n.anEdge).Lnext!==s),s.Lnext.Lnext===s&&(t.addWinding(s.Onext,s),i.mesh.delete(s));return!0},t.computeInterior=function(i,r){var n,a;if(r===void 0&&(r=!0),t.removeDegenerateEdges(i),!t.initPriorityQ(i))return!1;for(t.initEdgeDict(i);(n=i.pq.extractMin())!==null;){for(;(a=i.pq.min())!==null&&pi.vertEq(a,n);)a=i.pq.extractMin(),t.spliceMergeVertices(i,n.anEdge,a.anEdge);t.sweepEvent(i,n)}return i.event=i.dict.min().key.eUp.Org,t.debugEvent(i),t.doneEdgeDict(i),t.donePriorityQ(i),!!t.removeDegenerateFaces(i,i.mesh)&&(r&&i.mesh.check(),!0)},t}(),J_e=function(){function t(){this.mesh=new NF,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=xn.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 t.prototype.dot_=function(i,r){return i[0]*r[0]+i[1]*r[1]+i[2]*r[2]},t.prototype.normalize_=function(i){var r=i[0]*i[0]+i[1]*i[1]+i[2]*i[2];if(!r)throw"Zero-size vector!";r=Math.sqrt(r),i[0]/=r,i[1]/=r,i[2]/=r},t.prototype.longAxis_=function(i){var r=0;return Math.abs(i[1])>Math.abs(i[0])&&(r=1),Math.abs(i[2])>Math.abs(i[r])&&(r=2),r},t.prototype.computeNormal_=function(i){var r,n,a,s,o,l,h=[0,0,0],u=[0,0,0],d=[0,0,0],c=[0,0,0],p=[0,0,0],m=[null,null,null],f=[null,null,null],g=this.mesh.vHead;r=g.next;for(var v=0;v<3;++v)s=r.coords[v],u[v]=s,f[v]=r,h[v]=s,m[v]=r;for(r=g.next;r!==g;r=r.next)for(var y=0;y<3;++y)(s=r.coords[y])<u[y]&&(u[y]=s,f[y]=r),s>h[y]&&(h[y]=s,m[y]=r);var _=0;if(h[1]-u[1]>h[0]-u[0]&&(_=1),h[2]-u[2]>h[_]-u[_]&&(_=2),u[_]>=h[_])return i[0]=0,i[1]=0,void(i[2]=1);for(l=0,n=f[_],a=m[_],d[0]=n.coords[0]-a.coords[0],d[1]=n.coords[1]-a.coords[1],d[2]=n.coords[2]-a.coords[2],r=g.next;r!==g;r=r.next)c[0]=r.coords[0]-a.coords[0],c[1]=r.coords[1]-a.coords[1],c[2]=r.coords[2]-a.coords[2],p[0]=d[1]*c[2]-d[2]*c[1],p[1]=d[2]*c[0]-d[0]*c[2],p[2]=d[0]*c[1]-d[1]*c[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)},t.prototype.checkOrientation_=function(){for(var i,r,n=this.mesh.fHead,a=this.mesh.vHead,s=0,o=n.next;o!==n;o=o.next)if(!((r=o.anEdge).winding<=0))do s+=(r.Org.s-r.Dst.s)*(r.Org.t+r.Dst.t),r=r.Lnext;while(r!==o.anEdge);if(s<0){for(i=a.next;i!==a;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]}},t.prototype.projectPolygon_=function(){var i,r,n=this.mesh.vHead,a=[0,0,0],s=!1;a[0]=this.normal[0],a[1]=this.normal[1],a[2]=this.normal[2],!a[0]&&!a[1]&&!a[2]&&(this.computeNormal_(a),s=!0),i=this.sUnit,r=this.tUnit;var o=this.longAxis_(a);i[o]=0,i[(o+1)%3]=1,i[(o+2)%3]=0,r[o]=0,r[(o+1)%3]=0,r[(o+2)%3]=a[o]>0?1:-1;for(var l=n.next;l!==n;l=l.next)l.s=this.dot_(l.coords,i),l.t=this.dot_(l.coords,r);s&&this.checkOrientation_();for(var h=!0,u=n.next;u!==n;u=u.next)h?(this.bmin[0]=this.bmax[0]=u.s,this.bmin[1]=this.bmax[1]=u.t,h=!1):(u.s<this.bmin[0]&&(this.bmin[0]=u.s),u.s>this.bmax[0]&&(this.bmax[0]=u.s),u.t<this.bmin[1]&&(this.bmin[1]=u.t),u.t>this.bmax[1]&&(this.bmax[1]=u.t))},t.prototype.addWinding_=function(i,r){i.winding+=r.winding,i.Sym.winding+=r.Sym.winding},t.prototype.tessellateMonoRegion_=function(i,r){var n,a;if((n=r.anEdge).Lnext===n||n.Lnext.Lnext===n)throw"Mono region invalid";for(;pi.vertLeq(n.Dst,n.Org);n=n.Lprev);for(;pi.vertLeq(n.Org,n.Dst);n=n.Lnext);for(a=n.Lprev;n.Lnext!==a;)if(pi.vertLeq(n.Dst,a.Org)){for(;a.Lnext!==n&&(pi.edgeGoesLeft(a.Lnext)||pi.edgeSign(a.Org,a.Dst,a.Lnext.Dst)<=0);)a=i.connect(a.Lnext,a).Sym;a=a.Lprev}else{for(;a.Lnext!==n&&(pi.edgeGoesRight(n.Lprev)||pi.edgeSign(n.Dst,n.Org,n.Lprev.Org)>=0);)n=i.connect(n,n.Lprev).Sym;n=n.Lnext}if(a.Lnext===n)throw"Mono region invalid";for(;a.Lnext.Lnext!==n;)a=i.connect(a.Lnext,a).Sym;return!0},t.prototype.tessellateInterior_=function(i){for(var r,n=i.fHead.next;n!==i.fHead;n=r)if(r=n.next,n.inside&&!this.tessellateMonoRegion_(i,n))return!1;return!0},t.prototype.discardExterior_=function(i){for(var r,n=i.fHead.next;n!==i.fHead;n=r)r=n.next,n.inside||i.zapFace(n)},t.prototype.setWindingNumber_=function(i,r,n){for(var a,s=i.eHead.next;s!==i.eHead;s=a)a=s.next,s.Rface.inside!==s.Lface.inside?s.winding=s.Lface.inside?r:-r:n?i.delete(s):s.winding=0},t.prototype.getNeighbourFace_=function(i){return i.Rface&&i.Rface.inside?i.Rface.n:-1},t.prototype.outputPolymesh_=function(i,r,n,a){var s,o,l=0,h=0;n>3&&i.mergeConvexFaces(n);for(var u=i.vHead.next;u!==i.vHead;u=u.next)u.n=-1;for(var d=i.fHead.next;d!==i.fHead;d=d.next)if(d.n=-1,d.inside){s=d.anEdge,o=0;do(u=s.Org).n===-1&&(u.n=h,h++),o++,s=s.Lnext;while(s!==d.anEdge);if(o>n)throw"Face vertex greater that support polygon";d.n=l,++l}for(this.elementCount=l,r===os.CONNECTED_POLYGONS&&(l*=2),this.elements=[],this.elements.length=l*n,this.vertexCount=h,this.vertices=[],this.vertices.length=h*a,this.vertexIndices=[],this.vertexIndices.length=h,u=i.vHead.next;u!==i.vHead;u=u.next)if(u.n!==-1){var c=u.n*a;this.vertices[c+0]=u.coords[0],this.vertices[c+1]=u.coords[1],a>2&&(this.vertices[c+2]=u.coords[2]),this.vertexIndices[u.n]=u.idx}var p=0;for(d=i.fHead.next;d!==i.fHead;d=d.next)if(d.inside){s=d.anEdge,o=0;do u=s.Org,this.elements[p++]=u.n,o++,s=s.Lnext;while(s!==d.anEdge);for(var m=o;m<n;++m)this.elements[p++]=-1;if(r===os.CONNECTED_POLYGONS){s=d.anEdge;do this.elements[p++]=this.getNeighbourFace_(s),s=s.Lnext;while(s!==d.anEdge);for(var f=o;f<n;++f)this.elements[p++]=-1}}},t.prototype.outputContours_=function(i,r){var n,a,s=0,o=0;this.vertexCount=0,this.elementCount=0;for(var l=i.fHead.next;l!==i.fHead;l=l.next)if(l.inside){a=n=l.anEdge;do this.vertexCount++,n=n.Lnext;while(n!==a);this.elementCount++}this.elements=[],this.elements.length=2*this.elementCount,this.vertices=[],this.vertices.length=this.vertexCount*r,this.vertexIndices=[],this.vertexIndices.length=this.vertexCount;var h=0,u=0,d=0;for(s=0,l=i.fHead.next;l!==i.fHead;l=l.next)if(l.inside){o=0,a=n=l.anEdge;do this.vertices[h++]=n.Org.coords[0],this.vertices[h++]=n.Org.coords[1],r>2&&(this.vertices[h++]=n.Org.coords[2]),this.vertexIndices[u++]=this.vertexIdCallback?this.vertexIdCallback(n):n.Org.idx,o++,n=n.Lnext;while(n!==a);this.elements[d++]=s,this.elements[d++]=o,s+=o}},t.prototype.addContour=function(i,r){this.mesh===null&&(this.mesh=new NF),i<2&&(i=2),i>3&&(i=3);for(var n=null,a=0;a<r.length;a+=i)n===null?(n=this.mesh.makeEdge(),this.mesh.splice(n,n.Sym)):(this.mesh.splitEdge(n),n=n.Lnext),n.Org.coords[0]=r[a+0],n.Org.coords[1]=r[a+1],n.Org.coords[2]=i>2?r[a+2]:0,n.Org.idx=this.vertexIndexCounter++,this.edgeCreateCallback&&this.edgeCreateCallback(n),n.winding=1,n.Sym.winding=-1},t.prototype.tesselate=function(i,r,n,a,s,o){if(i===void 0&&(i=xn.ODD),r===void 0&&(r=os.POLYGONS),o===void 0&&(o=!0),this.vertices=[],this.elements=[],this.vertexIndices=[],this.vertexIndexCounter=0,s&&(this.normal[0]=s[0],this.normal[1]=s[1],this.normal[2]=s[2]),this.windingRule=i,a<2&&(a=2),a>3&&(a=3),!this.mesh)return!1;this.projectPolygon_(),zte.computeInterior(this,o);var l=this.mesh;return r===os.BOUNDARY_CONTOURS?this.setWindingNumber_(l,1,!0):this.tessellateInterior_(l),o&&l.check(),r===os.BOUNDARY_CONTOURS?this.outputContours_(l,a):this.outputPolymesh_(l,r,n,a),!0},t}(),xn.ODD,xn.NONZERO,xn.POSITIVE,xn.NEGATIVE,xn.ABS_GEQ_TWO,os.POLYGONS,os.CONNECTED_POLYGONS,os.BOUNDARY_CONTOURS}),wOe=k(()=>{(ebe=BF=class{constructor(e=256,t=!1){this.capacity=e,this.size=0,this.debug=t,this.debug&&console.log(`allocating with cap ${e}`);let i=e*BF.eSize;this.buffer=new ArrayBuffer(i);let r=Float32Array.BYTES_PER_ELEMENT,n=0;this.positions=new Float32Array(this.buffer,n*r,3*e),n+=3*e,this.normals=new Float32Array(this.buffer,n*r,3*e),n+=3*e,this.uvs=new Float32Array(this.buffer,n*r,2*e)}realloc(e,t=!1){if(e<this.size)throw Error("cannot shrink buffer");if(e<=this.capacity&&!t)return;this.debug&&console.log(`resizing from ${this.capacity} \u2192 ${e}`);let i=e*BF.eSize,r=new ArrayBuffer(i),n=Float32Array.BYTES_PER_ELEMENT,a=0,s=new Float32Array(r,a*n,3*e);a+=3*e;let o=new Float32Array(r,a*n,3*e);a+=3*e;let l=new Float32Array(r,a*n,2*e);t?(s.set(this.positions.subarray(0,3*this.size)),o.set(this.normals.subarray(0,3*this.size)),l.set(this.uvs.subarray(0,2*this.size))):(s.set(this.positions),o.set(this.normals),l.set(this.uvs)),this.buffer=r,this.positions=s,this.normals=o,this.uvs=l,this.capacity=e}get(e=1){let t=this.size+e;if(t>this.capacity){let r=this.capacity;for(;t>r;)r*=2;this.realloc(r)}let i=this.size;return this.size=t,i}reserve(e){let t=this.size+e;t>this.capacity&&this.realloc(t)}shrink(){this.debug&&console.log(`shrinking ${this.capacity} \u2192 ${this.size}`),this.realloc(this.size,!0)}}).eSize=8*Float32Array.BYTES_PER_ELEMENT}),SOe=k(()=>{tbe=class{constructor(e=[],t=(i,r)=>i<r?-1:i>r?1:0){if(this.data=e,this.length=this.data.length,this.compare=t,this.length>0)for(let i=(this.length>>1)-1;i>=0;i--)this._down(i)}push(e){this.data.push(e),this._up(this.length++)}pop(){if(this.length===0)return;let e=this.data[0],t=this.data.pop();return--this.length>0&&(this.data[0]=t,this._down(0)),e}peek(){return this.data[0]}_up(e){let{data:t,compare:i}=this,r=t[e];for(;e>0;){let n=e-1>>1,a=t[n];if(i(r,a)>=0)break;t[e]=a,e=n}t[e]=r}_down(e){let{data:t,compare:i}=this,r=this.length>>1,n=t[e];for(;e<r;){let a=1+(e<<1),s=a+1;if(s<this.length&&i(t[s],t[a])<0&&(a=s),i(t[a],n)>=0)break;t[e]=t[a],e=a}t[e]=n}}});function u3(e,t,i,r){this.x=e,this.y=t,this.h=i,this.d=function(n,a,s){let o=!1,l=1/0;for(let h of s)for(let u=0,d=h.length,c=d-1;u<d;c=u++){let p=h[u],m=h[c];p[1]>a!=m[1]>a&&n<(m[0]-p[0])*(a-p[1])/(m[1]-p[1])+p[0]&&(o=!o),l=Math.min(l,TOe(n,a,p,m))}return l===0?0:(o?1:-1)*Math.sqrt(l)}(e,t,r),this.max=this.d+this.h*Math.SQRT2}function TOe(e,t,i,r){let n=i[0],a=i[1],s=r[0]-n,o=r[1]-a;if(s!==0||o!==0){let l=((e-n)*s+(t-a)*o)/(s*s+o*o);l>1?(n=r[0],a=r[1]):l>0&&(n+=s*l,a+=o*l)}return s=e-n,o=t-a,s*s+o*o}var dL,SH,TH,d3,cL,MH,EH,r0,MOe=k(()=>{SOe()}),LX=k(()=>{le(),Sw(),wOe(),kr(),MOe(),dL={vertices:[160,160,-160,160,-160,-160,160,-160],vertexIndices:[1,0,3,2],vertexCount:4,elements:[0,4],elementCount:1,mesh:void 0},SH={vertices:[],vertexIndices:[],vertexCount:0,elements:[],elementCount:0,mesh:void 0},TH={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},d3=(e,t)=>([i,r])=>(r<i&&(r+=t),(e>=i?e:e+t)<=r),cL=class extends At{constructor(e,t,i=0,r=12,n=3,a=xn.ODD,s=!1){super(),this.forPathBevel=s,this.type="ShapeGeometry",this.vertexCache={},this._shape=e,this._depth=t,this._curveSegments=r,this._bevelSegmentsInput=n;let o,l,h,u=this._shape.extractShapePointsToFlatArray([],r),d=this._shape.shapeHoles.map(T=>{let A=T.extractShapePointsToFlatArray([],r),E=[];for(let C=A.length-1;C>=1;C-=2){let N=A[C-1],P=A[C-0];E.push(N,P)}return E}),c=[],p=[];for(let T=0;T<u.length;T+=2)p.push([u[T],u[T+1]]);c.push(p);for(let T=0;T<d.length;T++){let A=d[T],E=[];for(let C=0;C<A.length;C+=2)E.push([A[C],A[C+1]]);c.push(E)}o=e.isText?.1*new v4().setFromPoints(e.points.map(T=>T.position)).getSize(new J).length():c[0].length===0?i:i>0?function(T,A,E=1,C=!1){let N=1/0,P=1/0,I=-1/0,L=-1/0;for(let[Z,fe]of T[0])Z<N&&(N=Z),fe<P&&(P=fe),Z>I&&(I=Z),fe>L&&(L=fe);let B=I-N,G=L-P,j=Math.max(E,Math.min(B,G));if(j===E){let Z=[N,P];return Z.distance=0,Z.distance}let $=new tbe([],(Z,fe)=>fe.max-Z.max),H=function(Z){let fe=0,W=0,z=0,Y=Z[0];for(let V=0,Q=Y.length,ie=Q-1;V<Q;ie=V++){let q=Y[V],he=Y[ie],me=q[0]*he[1]-he[0]*q[1];W+=(q[0]+he[0])*me,z+=(q[1]+he[1])*me,fe+=3*me}let ne=new u3(W/fe,z/fe,0,Z);return fe===0||ne.d<0?new u3(Y[0][0],Y[0][1],0,Z):ne}(T),te=new u3(N+B/2,P+G/2,0,T);te.d>H.d&&(H=te);let ue=2;function ae(Z,fe,W){let z=new u3(Z,fe,W,T);if(ue++,z.max>H.d+E&&$.push(z),z.d>H.d&&(H=z,C&&console.log(`found best ${Math.round(1e4*z.d)/1e4} after ${ue} probes`),H.d>A))return A}let de=j/2;for(let Z=N;Z<I;Z+=j)for(let fe=P;fe<L;fe+=j)ae(Z+de,fe+de,de);for(;$.length;){let{max:Z,x:fe,y:W,h:z}=$.pop();if(Z-H.d<=E)break;de=z/2,ae(fe-de,W-de,de),ae(fe+de,W-de,de),ae(fe-de,W+de,de),ae(fe+de,W+de,de)}C&&console.log(`num probes: ${ue}
|
|
4167
4167
|
best distance: ${H.d}`);let ye=[H.x,H.y];return ye.distance=H.d,ye.distance}(c,i):1e-5,i<=0?(this._bevel=0,this._bevelSegments=0):(this._bevel=Math.min(i,o,t/2),this._bevelSegments=Math.floor(n));try{l=Dg({windingRule:a,elementType:os.BOUNDARY_CONTOURS,vertexSize:2,strict:!0,contours:[u]})}catch{l=dL}try{h=Dg({windingRule:xn.ODD,elementType:os.BOUNDARY_CONTOURS,vertexSize:2,strict:!0,contours:[...d]})}catch{h=SH}if(!l)throw new Error("error generating geometry");let m=l.elementCount;if(h){l.elementCount+=h.elementCount;for(let T=0;T<h.elements.length;T++){let A=h.elements[T],E=T%2==0?l.vertexCount:0;l.elements.push(A+E)}for(let T=0;T<h.vertexIndices.length;T++){let A=h.vertexIndices[T],E=l.vertexCount;l.vertexIndices.push(A+E)}for(let T=0;T<h.vertices.length;T++){let A=h.vertices[T];l.vertices.push(A)}}let f=1/0,g=-1/0,v=1/0,y=-1/0;for(let T=0,A=l.vertexCount;T<A;T++){let E=2*T,C=l.vertices[E+0],N=l.vertices[E+1];C<f&&(f=C),C>g&&(g=C),N<v&&(v=N),N>y&&(y=N)}this._minX=f,this._minY=v,this._width=g-f,this._height=y-v,this._buffer=new ebe(this._computeBufferEstimatedSize(l));let _=[],b=[];for(let T=l.elementCount-1;T>=0;T--){let A=T>=m,E=2*T,C=l.elements[E+0],N=l.elements[E+1],P=C+N,I={start:C,count:N,normals:[],continuous:[],concave:[]},L=C,B=P-1,G=C+1,j=this._shape.roundedCurves.length;do{let ae=L-C,de=l.vertices[2*B+0],ye=l.vertices[2*B+1],Z=l.vertices[2*L+0],fe=l.vertices[2*L+1],W=l.vertices[2*G+0],z=l.vertices[2*G+1],Y=Z-de,ne=fe-ye,V=Math.sqrt(Y*Y+ne*ne);Y/=V,ne/=V;let Q=Z-W,ie=fe-z,q=Math.sqrt(Q*Q+ie*ie);Q/=q,ie/=q,I.normals[2*ae+0]=-ie,I.normals[2*ae+1]=Q,I.concave[ae]=Y*ie-ne*Q>0;let he=l.vertexIndices[L];if(Array.isArray(he))I.continuous[ae]=!1;else{let[me,Ee]=this._shape.getCurveIndexFromVertexId(he-1,!0);if(Ee>0&&Ee<1)I.continuous[ae]=!0;else{let Se=Ee===1?me+1:me-1;Se=(Se+j)%j;let qe=Ee===1?0:1,Ne=this._shape.roundedCurves[me].getTangent(Ee),He=this._shape.roundedCurves[Se].getTangent(qe);I.continuous[ae]=Ne.dot(He)>.95}}A&&(I.normals[2*ae+0]*=-1,I.normals[2*ae+1]*=-1),[B,L,G]=[L,G,G+1],G>=P&&(G-=N)}while(G!==C+1);let $=[];$.push({bevelI:0,angle:0,size:0,boundary:{vertices:l.vertices.slice(2*C,2*P),vertexCount:N,vertexIndices:new Array(N).fill(!0).map((ae,de)=>[de,de]),elements:[0,N],elementCount:1,mesh:null},reverseMap:[],insetPoints:l.vertices.slice(2*C,2*P)});let H=0;for(let ae=1;ae<=this._bevelSegments;ae++){let de=ae/this._bevelSegments*Math.PI/2,ye=(1-Math.cos(de))*this._bevel,Z=[],fe=[],W=[],z=[],Y=0;for(let V=0;V<N;V++){let Q=2*V,ie=(V-1+N)%N*2,q=l.vertices[2*I.start+Q+0],he=l.vertices[2*I.start+Q+1],me=-I.normals[ie+0]*ye,Ee=-I.normals[ie+1]*ye,Se=-I.normals[Q+0]*ye,qe=-I.normals[Q+1]*ye;if(I.concave[V]||!I.concave[V]&&A){let Ne=Math.atan2(Ee,me),He=Math.atan2(qe,Se);He>Ne&&(He-=2*Math.PI);let Pe=He-Ne;if(I.continuous[V]||A){let ee=Ne+Pe/2,Me=Math.cos(ee)*ye,We=Math.sin(ee)*ye;Z[2*Y+0]=q+Me*(A?-1:1),Z[2*Y+1]=he+We*(A?-1:1),z[Y]=V,Y++}else{let ee=Math.max(1,Math.floor(r/4*Math.abs(Pe)/Math.PI));for(let Me=0;Me<=ee;Me++){let We=Ne+Pe*(Me/ee),dt=Math.cos(We)*ye,et=Math.sin(We)*ye;Z[2*Y+0]=q+dt,Z[2*Y+1]=he+et,z[Y]=V,Y++}}}else Z[2*Y+0]=q+me,Z[2*Y+1]=he+Ee,z[Y]=V,fe[V]=Y,Y++,Z[2*Y+0]=q,Z[2*Y+1]=he,z[Y]=V,Y++,Z[2*Y+0]=q+Se,Z[2*Y+1]=he+qe,z[Y]=V,W[V]=Y,Y++}let ne=Dg({windingRule:xn.POSITIVE,elementType:os.BOUNDARY_CONTOURS,vertexSize:2,strict:!0,contours:[Z],edgeCreateCallback:V=>{let Q=V.Org.idx,ie=z[Q],q=z[(Q+1)%z.length];V.idx=[ie,q],V.Sym.idx=[q,ie]},vertexIdCallback:V=>{let Q=V.Lprev.idx;return[Q?Q[1]:0,V.idx?V.idx[0]:0]}});if(!ne)throw console.log("Error"),new Error(`error generating bevel geometry for ${ae}'th loop`);if(!ne.vertexCount){let V=(ae-1)/this._bevelSegments*Math.PI/2;H=(1-Math.sin(V))*this._bevel;break}for(let V=0;V<ne.vertexIndices.length;V++){let[Q,ie]=ne.vertexIndices[V];if(Q===ie)continue;let q=ie;ie<Q&&(q+=N);for(let he=Q;he<q;he++){let me=he%N,Ee=(he+1)%N;if(!I.continuous[me]||!I.continuous[Ee]){ne.vertexIndices[V]=[Q,me],ne.vertexIndices.splice(V+1,0,[Ee,ie]),ne.vertices.splice(2*(V+1),0,ne.vertices[2*V],ne.vertices[2*V+1]);break}}}$.push({bevelI:ae,angle:de,size:ye,boundary:ne,reverseMap:z,insetPoints:Z})}let te=(ae,de,ye)=>{let Z=0,fe=ae.boundary.vertexIndices.length;for(;Z<fe&&ye(ae.boundary.vertexIndices[de]);)de=(de+1)%fe,Z++;return Z},ue=_.length;for(let ae=1;ae<$.length;ae++){let de=$[ae-1],ye=$[ae],Z=de.boundary.vertexIndices.length,fe=ye.boundary.vertexIndices.length;if(!Z||!fe)break;let W=I.concave.length,z=0,Y=d3(z,N);for(;!de.boundary.vertexIndices.filter(Y).length||!ye.boundary.vertexIndices.filter(Y).length;)z++,Y=d3(z,N);let ne=de.boundary.vertexIndices.findIndex(Y),V=ye.boundary.vertexIndices.findIndex(Y);do ne=(ne+1)%Z;while(Y(de.boundary.vertexIndices[ne]));do V=(V+1)%fe;while(Y(ye.boundary.vertexIndices[V]));z=(z+1)%N;let Q,ie,q=z,he=0,me=this._buildBevelVert(I,de,(ne-1+Z)%Z,void 0,he),Ee=this._buildBevelVert(I,ye,(V-1+fe)%fe,void 0,he),Se=!1;do{he=(z||W)/W,Y=d3(z,N);let qe=te(de,ne,Y),Ne=te(ye,V,Y),He=Se;if(Se=!1,qe&&!Ne){for(let Pe=0;Pe<qe;Pe++)Q=this._buildBevelVert(I,de,(ne+Pe)%Z,Pe/(qe-1),he),_.push(me.topN,Q.topP,Ee.topN),s===!1&&_.push(Q.bottomP,me.bottomN,Ee.bottomN),me=Q;Se=!0}else if(!qe&&Ne)for(let Pe=0;Pe<Ne;Pe++)ie=this._buildBevelVert(I,ye,(V+Pe)%fe,Pe/(Ne-1),he),_.push(Ee.topN,me.topP,ie.topP),s===!1&&_.push(me.bottomP,Ee.bottomN,ie.bottomP),Ee=ie;else if(qe&&Ne)if(Q=this._buildBevelVert(I,de,ne,0,he),ie=this._buildBevelVert(I,ye,V,0,he),He?(_.push(me.topN,ie.topP,Ee.topN),_.push(me.topN,Q.topP,ie.topP),s===!1&&(_.push(ie.bottomP,me.bottomN,Ee.bottomN),_.push(ie.bottomP,Q.bottomP,me.bottomN))):(_.push(Ee.topN,me.topN,Q.topP),_.push(Ee.topN,Q.topP,ie.topP),s===!1&&(_.push(Q.bottomP,me.bottomN,Ee.bottomN),_.push(Q.bottomP,Ee.bottomN,ie.bottomP))),me=Q,Ee=ie,qe===Ne)for(let Pe=1;Pe<qe;Pe++)Q=this._buildBevelVert(I,de,(ne+Pe)%Z,Pe/(qe-1),he),ie=this._buildBevelVert(I,ye,(V+Pe)%fe,Pe/(Ne-1),he),_.push(me.topN,Q.topP,Ee.topN),_.push(Ee.topN,Q.topP,ie.topP),s===!1&&(_.push(Q.bottomP,me.bottomN,Ee.bottomN),_.push(Q.bottomP,Ee.bottomN,ie.bottomP)),me=Q,Ee=ie;else if(qe>Ne){let Pe=qe/Ne,ee=0;for(let Me=1;Me<qe;Me++)Q=this._buildBevelVert(I,de,(ne+Me)%Z,Me/(qe-1),he),_.push(me.topN,Q.topP,Ee.topN),s===!1&&_.push(Q.bottomP,me.bottomN,Ee.bottomN),me=Q,Me>(ee+1)*Pe&&(ee++,ie=this._buildBevelVert(I,ye,(V+ee)%fe,ee/(Ne-1),he),_.push(Ee.topN,Q.topP,ie.topP),s===!1&&_.push(Q.bottomP,Ee.bottomN,ie.bottomP),Ee=ie)}else{let Pe=Ne/qe,ee=0;for(let Me=1;Me<Ne;Me++)ie=this._buildBevelVert(I,ye,(V+Me)%fe,Me/(Ne-1),he),_.push(Ee.topN,Q.topP,ie.topP),s===!1&&_.push(Q.bottomP,Ee.bottomN,ie.bottomP),Ee=ie,Me>(ee+1)*Pe&&(ee++,Q=this._buildBevelVert(I,de,(ne+ee)%Z,ee/(qe-1),he),_.push(me.topN,Q.topP,Ee.topN),s===!1&&_.push(Q.bottomP,me.bottomN,Ee.bottomN),me=Q)}ne=(ne+qe)%Z,V=(V+Ne)%fe,z=(z+1)%W}while(z!==q)}if(s===!1&&this._depth>2*this._bevel&&this._buildWall($,I,_),A){let ae=[];for(let de=_.length-1;de>=ue+2;de-=3){let ye=_[de-2],Z=_[de-1],fe=_[de-0];ae.push(fe,Z,ye)}_.splice(ue,_.length-ue,...ae)}if(A){let ae=[];for(let de=$[$.length-1].boundary.vertices.length-1;de>=1;de-=2){let ye=$[$.length-1].boundary.vertices[de-1],Z=$[$.length-1].boundary.vertices[de-0];ae.push(ye,Z)}b.push(ae)}if(!A){let ae,de=$[$.length-1];try{ae=Dg({windingRule:$.length>1?xn.POSITIVE:xn.ODD,elementType:os.POLYGONS,vertexSize:2,strict:!0,contours:[de.insetPoints,...b]})}catch{ae=TH}if(!ae)throw new Error("Error generating geometry for surface");d.length===0&&this._bevel<o&&Object.assign(this,{useNgonForTopBottomFaceDuringBake:!0});for(let ye=0;ye<3*ae.elementCount;ye+=3){let Z=this._buildSurfaceVert(ae,ae.elements[ye+0],H),fe=this._buildSurfaceVert(ae,ae.elements[ye+1],H),W=this._buildSurfaceVert(ae,ae.elements[ye+2],H);_.push(Z.top,fe.top,W.top),s===!1&&_.push(W.bottom,fe.bottom,Z.bottom)}}this.vertexCache={}}this._buffer.shrink();let x=new It(Uint32Array.from(_),1),w=new It(this._buffer.positions,3),S=new It(this._buffer.normals,3),M=new It(this._buffer.uvs,2);w.needsUpdate=!0,S.needsUpdate=!0,M.needsUpdate=!0,x.needsUpdate=!0,this.setAttribute("position",w),this.setAttribute("normal",S),this.setAttribute("uv",M),this.setIndex(x)}_computeBufferEstimatedSize(e){return 2*e.vertexCount*(2+this._bevelSegments)}_buildWall(e,t,i){let r=e[0];for(let n=0,a=r.boundary.vertexCount;n<a;n++){let s=this._buildBevelVert(t,r,n),o=this._buildBevelVert(t,r,(n+1)%a);i.push(o.topP,s.topN,s.bottomN),i.push(o.topP,s.bottomN,o.bottomP)}}_buildSurfaceVert(e,t,i){let r=t.toString();if(r in this.vertexCache)return this.vertexCache[r];let n=e.vertices[2*t+0],a=e.vertices[2*t+1],s=(n-this._minX)/this._width,o=(a-this._minY)/this._height;this.forPathBevel&&(o=1);let l=this._buffer.get(this.forPathBevel?1:2),h=3*l,u=2*l,d={top:l+0,bottom:l+1};return this._buffer.positions[h+0]=n,this._buffer.positions[h+1]=a,this._buffer.positions[h+2]=this.forPathBevel?this._bevel:this._depth-i,this._buffer.normals[h+0]=0,this._buffer.normals[h+1]=0,this._buffer.normals[h+2]=1,this._buffer.uvs[u+0]=s,this._buffer.uvs[u+1]=o,this.forPathBevel===!1&&(this._buffer.positions[h+3]=n,this._buffer.positions[h+4]=a,this._buffer.positions[h+5]=i,this._buffer.normals[h+3]=0,this._buffer.normals[h+4]=0,this._buffer.normals[h+5]=-1,this._buffer.uvs[u+2]=s,this._buffer.uvs[u+3]=o),this.vertexCache[r]=d,d}_buildBevelVert(e,t,i,r=1,n){let a=`${t.bevelI}:${i}`;if(a in this.vertexCache&&n!==0&&n!==1&&(!n||n===this.vertexCache[a].pathBevelUCoord))return this.vertexCache[a];let s,o,l,h,[u,d]=t.boundary.vertexIndices[i];u!==d?(o=u,s=d,h=!1,l=e.continuous[o]&&e.continuous[s]):(s=u,o=(s-1+e.count)%e.count,h=e.concave[s]&&t.bevelI>0,l=e.continuous[s]||h);let c=Math.cos(t.angle),p=Math.sin(t.angle),m=2*i,f=2*s,g=2*o,v=t.boundary.vertices[m+0],y=t.boundary.vertices[m+1],_=(1-p)*this._bevel,b=(v-this._minX)/this._width,x=(y-this._minY)/this._height;this.forPathBevel&&(n!==void 0&&(b=n),x=1);let w=e.normals[f+0],S=e.normals[f+1],M=e.normals[g+0],T=e.normals[g+1];if(h){w+=(M-w)*(1-r),S+=(T-S)*(1-r);let P=Math.sqrt(w*w+S*S);w/=P,S/=P}let A=this.forPathBevel?this._buffer.get(l?1:2):this._buffer.get(l?2:4),E=3*A,C=2*A,N={i,fi:s,topP:A+0,topN:A+0,bottomP:A+1,bottomN:A+1,pathBevelUCoord:n};return this._buffer.positions[E+0]=v,this._buffer.positions[E+1]=y,this._buffer.positions[E+2]=(this.forPathBevel?this._bevel:this._depth)-_,this._buffer.normals[E+0]=w*c,this._buffer.normals[E+1]=S*c,this._buffer.normals[E+2]=p,this._buffer.uvs[C+0]=b,this._buffer.uvs[C+1]=x,this.forPathBevel===!1&&(this._buffer.positions[E+3]=v,this._buffer.positions[E+4]=y,this._buffer.positions[E+5]=_,this._buffer.normals[E+3]=w*c,this._buffer.normals[E+4]=S*c,this._buffer.normals[E+5]=-p,this._buffer.uvs[C+2]=x,this._buffer.uvs[C+3]=b),l||(this.forPathBevel?(A+=1,E+=3,C+=2):(A+=2,E+=6,C+=4),N.topP=A+0,N.bottomP=A+1,this._buffer.positions[E+0]=v,this._buffer.positions[E+1]=y,this._buffer.positions[E+2]=(this.forPathBevel?this._bevel:this._depth)-_,this._buffer.normals[E+0]=M*c,this._buffer.normals[E+1]=T*c,this._buffer.normals[E+2]=p,this._buffer.uvs[C+0]=b,this._buffer.uvs[C+1]=x,this.forPathBevel===!1&&(this._buffer.positions[E+3]=v,this._buffer.positions[E+4]=y,this._buffer.positions[E+5]=_,this._buffer.normals[E+3]=M*c,this._buffer.normals[E+4]=T*c,this._buffer.normals[E+5]=-p,this._buffer.uvs[C+2]=x,this._buffer.uvs[C+3]=b)),this.vertexCache[a]=N,N}clone(){let e=new cL(this._shape,this._depth,this._bevel,this._curveSegments,this._bevelSegmentsInput);return e.userData=_4(this.userData),e}}}),ibe=k(()=>{le(),Sw(),kr(),LX(),MH=class extends At{constructor(e,t=12,i={}){super(),this.type="ShapeGeometry",this.windingRule=xn.ODD,this.elementType=os.POLYGONS,this.polySize=3,this.vertexSize=2,this.strict=!0,this._shape=e,this._curveSegments=t,this._triangulationOptions=Object.assign({windingRule:xn.ODD,elementType:os.POLYGONS,polySize:3,vertexSize:2,strict:!0},i);let r,n,a,s=this._shape.extractShapePointsToFlatArray([],this._curveSegments),o=this._shape.shapeHoles.map(c=>c.extractShapePointsToFlatArray([],this._curveSegments)),l=!0,h=!0;for(let c=0,p=s.length/2;c<p;c++){let m=2*c,f=s[m+0],g=s[m+1];if(n!==void 0&&f!==n&&(l=!1),a!==void 0&&g!==a&&(h=!1),n=f,a=g,!l&&!h)break}if(!l&&!h)try{r=Dg({contours:[s,...o],windingRule:this._triangulationOptions.windingRule,elementType:this._triangulationOptions.elementType,polySize:this._triangulationOptions.polySize,vertexSize:this._triangulationOptions.vertexSize,strict:this._triangulationOptions.strict})}catch{r=dL}let u=r?.vertexCount??1,d=r?.elementCount??1;if(this._positionAttribute=new It(new Float32Array(3*u),3),this._normalAttribute=new It(new Float32Array(3*u),3),this._uvAttribute=new It(new Float32Array(2*u),2),this._indexAttribute=new It(new Uint32Array(3*d),1),r){let c=1/0,p=-1/0,m=1/0,f=-1/0;for(let y=0,_=u;y<_;y++){let b=2*y,x=r.vertices[b+0],w=r.vertices[b+1];x<c&&(c=x),x>p&&(p=x),w<m&&(m=w),w>f&&(f=w)}let g=p-c,v=f-m;for(let y=0,_=u;y<_;y++){let b=2*y,x=r.vertices[b+0],w=r.vertices[b+1],S=(x-c)/g,M=(w-m)/v;this._positionAttribute.setXYZ(y,x,w,0),this._normalAttribute.setXYZ(y,0,0,1),this._uvAttribute.setXY(y,S,M)}for(let y=0,_=d;y<_;y++){let b=3*y,x=r.elements[b+0],w=r.elements[b+1],S=r.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*(r?.elementCount??1))}clone(){let e=new MH(this._shape,this._curveSegments);return e.userData=_4(this.userData),e}}}),EOe=k(()=>{Sw(),kr(),LX(),EH=class extends cL{constructor(e,t,i=0,r=12,n=3,a=xn.ODD){super(e,t,i,r,n,a),this.type="ShapeGeometry"}_computeBufferEstimatedSize(e){return 2*e.vertexCount*(2+this._bevelSegments)}_buildWall(e,t,i){let r=e[0];for(let n=0,a=r.boundary.vertexCount;n<a;n++){let s=this._buildBevelVert(t,r,n),o=this._buildBevelVert(t,r,(n+1)%a);i.push(o.topP,s.topN,s.bottomN),i.push(o.topP,s.bottomN,o.bottomP)}}clone(){let e=new EH(this._shape,this._depth,this._bevel,this._curveSegments,this._bevelSegmentsInput);return e.userData=_4(this.userData),e}}}),Xg=k(()=>{i0(),ibe(),EOe(),Sw(),r0=class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i,r=Object.assign({},t?.parameters??{width:100,subdivisions:40,roundness:0,extrudeBevelSize:0,extrudeBevelSegments:3,windingRule:xn.ODD},e.parameters),n=Math.abs(r.width),a=Math.abs(r.height??r.width),s=Math.abs(r.depth??0),o=e.shape??t?.shape,l=o?.roundness??r.roundness;o!==void 0&&(o instanceof da?(i=o,(i.width!==n||i.height!==a)&&i.applySize(n,a)):i=new da(n,a).fromJSON(o),e.parameters?.roundness!==void 0&&e.parameters?.roundness>0&&i.update());let h=i??new da(n,a);return{parameters:Object.assign(r,{width:n,height:a,depth:s,roundness:l}),shape:h}}static build(e){let t,{depth:i,extrudeBevelSize:r,extrudeBevelSegments:n,subdivisions:a,roundness:s,windingRule:o}=e.parameters;return e.shape.roundness=s,t=i<=0?new MH(e.shape,a,{windingRule:o}):new EH(e.shape,i,r,a,n,o),Object.assign(t,{userData:{...e,type:"VectorGeometry"}})}}});function AOe(e,t,i,r,n,a){if(r>=BX)return n>30||n%4==0?(function(u,d,c,p=0,m=0,f=0){let g=.5522847498,v=d*g,y=c*g;u.addPoint(c3(m-d,f,m-d,f-y,m-d,f+y)),u.addPoint(c3(m,f+c,m-v,f+c,m+v,f+c)),u.addPoint(c3(m+d,f,m+d,f+y,m+d,f-y)),u.addPoint(c3(m,f-c,m+v,f-c,m-v,f-c)),p>0&&nbe(u,d,c,p)}(e,t,i,a),Math.round(n/4)):Vte(e,r,n,t,i,a);let s={x:0,y:i},o=(r=Math.max(r,.001))+.5*Math.PI,l={x:Math.cos(o)*t,y:Math.sin(o)*i},h=function({px:u,py:d,cx:c,cy:p,rx:m,ry:f,largeArcFlag:g,sweepFlag:v}){let y=[];if(m===0||f===0)return[];let _=(u-c)/2,b=(d-p)/2;if(_===0&&b===0)return[];m=Math.abs(m),f=Math.abs(f);let x=Math.pow(_,2)/Math.pow(m,2)+Math.pow(b,2)/Math.pow(f,2);x>1&&(m*=Math.sqrt(x),f*=Math.sqrt(x));let w=function(N,P,I,L,B,G,j,$,H,te){let ue=Math.pow(B,2),ae=Math.pow(G,2),de=Math.pow(j,2),ye=Math.pow($,2),Z=ue*ae-ue*ye-ae*de;Z<0&&(Z=0),Z/=ue*ye+ae*de,Z=Math.sqrt(Z)*(H===te?-1:1);let fe=Z*B/G*$,W=Z*-G/B*j,z=fe+(N+I)/2,Y=W+(P+L)/2,ne=(j-fe)/B,V=($-W)/G,Q=(-j-fe)/B,ie=(-$-W)/G,q=Bte(1,0,ne,V),he=Bte(ne,V,Q,ie);return!te&&he>0&&(he-=oI),te&&he<0&&(he+=oI),{centerx:z,centery:Y,ang1:q,ang2:he}}(u,d,c,p,m,f,_,b,g,v),{ang1:S,ang2:M}=w,{centerx:T,centery:A}=w,E=Math.abs(M)/(oI/4);Math.abs(1-E)<1e-7&&(E=1);let C=Math.max(Math.ceil(E),1);M/=C;for(let N=0;N<C;N++)y.push(bOe(S,M)),S+=M;return y.map(N=>{let{x:P,y:I}=DF(N[0],m,f,T,A),{x:L,y:B}=DF(N[1],m,f,T,A),{x:G,y:j}=DF(N[2],m,f,T,A);return{x1:P,y1:I,x2:L,y2:B,x:G,y:j}})}({px:s.x,py:s.y,cx:l.x,cy:l.y,rx:t,ry:i,largeArcFlag:r>Math.PI,sweepFlag:!0});return n>30||n%h.length===0?function(u,d,c,p,m,f,g,v){let y=Math.round(m/p.length);u.addPoint(Ax(d,c));for(let _=0,b=p.length;_<b;_++){let x=p[_],w=u.points[_],S=Ax(x.x,x.y);w.controls[1].position.set(x.x1,x.y1),S.controls[0].position.set(x.x2,x.y2),u.addPoint(S)}return v>0?rbe(u,f,g,v):u.addPoint(Ax(0,0)),y}(e,s.x,s.y,h,n,t,i,a):Vte(e,r,n,t,i,a)}function Vte(e,t,i,r,n,a){let s=-t/i;for(let o=0;o<=i;o++){let l=s*o,h=Math.sin(l)*r,u=Math.cos(l)*n;e.addPoint(Ax(h,u))}return t<BX?a>0?rbe(e,r,n,a):e.addPoint(Ax(0,0)):(e.removePoint(e.points[e.points.length-1]),a>0&&nbe(e,r,n,a)),1}function Ax(e,t){return new wy(ht.generateUUID(),new J(e,t))}function c3(e,t,i,r,n,a){let s=Ax(e,t);return s.controls[0].position.set(i,r),s.controls[1].position.set(n,a),s}function rbe(e,t,i,r){abe(e,t,i,r).forEach(n=>e.addPoint(n))}function nbe(e,t,i,r){let n=abe(e,t,i,r),a=new da;n.forEach(s=>a.addPoint(s)),a.isClosed=!0,e.shapeHoles.push(a)}function abe(e,t,i,r){let n=r*t/100,a=n*(Math.abs(i)/Math.abs(t)),s=new J(n/t,a/i),o=e.points.map(l=>{let h=l.clone();return h.uuid=ht.generateUUID(),h}).reverse();return o.forEach(l=>{l.position.multiply(s);let h=l.controls[0].position.clone().multiply(s),u=l.controls[1].position.clone().multiply(s);l.controls[0].position.copy(u),l.controls[1].position.copy(h)}),o}var BX,L4,sbe,UF,obe,pL=k(()=>{i0(),Q_e(),xOe(),Xg(),le(),BX=2*Math.PI,L4=class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=Object.assign({},t?.parameters??{width:100,depth:0,spikes:64,angle:360,innerRadius:0,extrudeBevelSize:0,extrudeBevelSegments:1},e.parameters);return i.angle=ht.clamp(i.angle,0,360),{shape:e.shape&&e.shape instanceof da?e.shape:new da,parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??0)})}}static build(e){let t,{width:i,height:r,spikes:n,angle:a,innerRadius:s,depth:o,extrudeBevelSize:l,extrudeBevelSegments:h}=e.parameters,u=e.shape,d=AOe(u,.5*i,.5*r,a*Math.PI/180,n,s);return u.isClosed=!0,u.update(),a===0?(t=new At,t.setAttribute("position",new Et([],3))):t=r0.create({shape:u,parameters:{subdivisions:d,depth:o,extrudeBevelSize:l,extrudeBevelSegments:h}}),Object.assign(t,{userData:{...e,type:"EllipseGeometry"}})}}}),kte=k(()=>{le(),q_e(),sbe=class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=Object.assign({},t?.parameters??{width:100,detail:0,corner:0,cornerSides:4},e.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(e){let{width:t,height:i,depth:r,detail:n,corner:a,cornerSides:s}=e.parameters,o=n===0&&a!==0?new UF(.5*t,a,s):new a7(.5*t,n),l=i/t,h=r/t;return(l!==1||h!==1)&&o.scale(1,l,h),Object.assign(o,{userData:{...e,type:"IcosahedronGeometry"}})}},UF=class extends hL{constructor(e=1,t=.2,i=4){let r=(1+Math.sqrt(5))/2,n="IcosahedronGeometry";super([-1,r,0,1,r,0,-1,-r,0,1,-r,0,0,-1,r,0,1,r,0,-1,-r,0,1,-r,r,0,-1,r,0,1,-r,0,-1,-r,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],n,e,t,i),this.type=n}static fromJSON(e){return new UF(e.radius,e.corner,e.cornerSides)}}}),Gte=k(()=>{le(),obe=class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){(e.parameters?.points??[]).forEach(r=>{Array.isArray(r)&&(r.x=r[0],r.y=r[1])});let i=Object.assign({},t?.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}]},e.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(e){let{points:t,segments:i,verticalSegments:r}=e.parameters,n=new YE;n.moveTo(t[0].x,t[0].y),n.bezierCurveTo(t[1].x,t[1].y,t[2].x,t[2].y,t[3].x,t[3].y);let a=new s7(n.extractPoints(r).shape,i);return a.rotateZ(Math.PI),Object.assign(a,{userData:{...e,type:"LatheGeometry"}})}}});function X1(e,t){return Math.abs(t-e)/2+Math.min(e,t)}function COe(e){let{positions:t,faces:i,materialIndices:r,uvs:n}=e,a=t.length/3,s=i.length/3,o=n!==null&&s>0,l=3*s,h=new Uint32Array(l),u=new Uint32Array(l),d=new Uint32Array(l),c=new Uint32Array(l),p=new Uint32Array(l),m=0,f=8;for(;f<2*l;)f*=2;let g=f-1,v=new Int32Array(f).fill(-1),y=(P,I)=>{let L=(Math.imul(P,2654435761)^I)&g;for(;;){let B=v[L];if(B===-1)return v[L]=m,h[m]=P,u[m]=I,m++;if(h[B]===P&&u[B]===I)return B;L=L+1&g}},_=(P,I)=>{let L=P<I?P:I,B=P<I?I:P,G=(Math.imul(L,2654435761)^B)&g;for(;;){let j=v[G];if(h[j]===L&&u[j]===B)return j;G=G+1&g}},b=new Uint32Array(a),x=new Float64Array(3*a),w=(P,I,L)=>{let B=P<I?y(P,I):y(I,P),G=++d[B];G===1?c[B]=L:G===2&&(p[B]=L),b[P]++,b[I]++,x[3*P]+=t[3*I],x[3*P+1]+=t[3*I+1],x[3*P+2]+=t[3*I+2],x[3*I]+=t[3*P],x[3*I+1]+=t[3*P+1],x[3*I+2]+=t[3*P+2]};for(let P=0;P<s;P++){let I=i[3*P],L=i[3*P+1],B=i[3*P+2];w(I,L,B),w(L,B,I),w(B,I,L)}let S=new Float64Array(3*m);for(let P=0;P<m;P++){let I=3*h[P],L=3*u[P];if(d[P]===2){let B=3*c[P],G=3*p[P];S[3*P]=.375*(t[I]+t[L])+.125*(t[B]+t[G]),S[3*P+1]=.375*(t[I+1]+t[L+1])+.125*(t[B+1]+t[G+1]),S[3*P+2]=.375*(t[I+2]+t[L+2])+.125*(t[B+2]+t[G+2])}else S[3*P]=.5*(t[I]+t[L]),S[3*P+1]=.5*(t[I+1]+t[L+1]),S[3*P+2]=.5*(t[I+2]+t[L+2])}let M,T=new Float64Array(3*a);for(let P=0;P<a;P++){let I=b[P];I===3?M=3/16:I>3&&(M=3/(8*I));let L=1-I*Number(M),B=Number(M);I===2&&(L=3/4,B=1/8),T[3*P]=t[3*P]*L+x[3*P]*B,T[3*P+1]=t[3*P+1]*L+x[3*P+1]*B,T[3*P+2]=t[3*P+2]*L+x[3*P+2]*B}let A=new Float64Array(3*(a+m));A.set(T),A.set(S,3*a);let E=new Uint32Array(12*s),C=new Array(4*s),N=o?new Float64Array(24*s):null;for(let P=0;P<s;P++){let I=i[3*P],L=i[3*P+1],B=i[3*P+2],G=_(I,L)+a,j=_(L,B)+a,$=_(B,I)+a,H=12*P;E[H++]=G,E[H++]=j,E[H++]=$,E[H++]=I,E[H++]=G,E[H++]=$,E[H++]=L,E[H++]=j,E[H++]=G,E[H++]=B,E[H++]=$,E[H++]=j;let te=r[P];if(C[4*P]=te,C[4*P+1]=te,C[4*P+2]=te,C[4*P+3]=te,N!==null){let ue=6*P,ae=n[ue],de=n[ue+1],ye=n[ue+2],Z=n[ue+3],fe=n[ue+4],W=n[ue+5],z=X1(ae,ye),Y=X1(de,Z),ne=X1(ye,fe),V=X1(Z,W),Q=X1(ae,fe),ie=X1(de,W),q=24*P;N[q++]=z,N[q++]=Y,N[q++]=ne,N[q++]=V,N[q++]=Q,N[q++]=ie,N[q++]=ae,N[q++]=de,N[q++]=z,N[q++]=Y,N[q++]=Q,N[q++]=ie,N[q++]=ye,N[q++]=Z,N[q++]=ne,N[q++]=V,N[q++]=z,N[q++]=Y,N[q++]=fe,N[q++]=W,N[q++]=Q,N[q++]=ie,N[q++]=ne,N[q++]=V}}return{positions:A,faces:E,materialIndices:C,uvs:N}}var p3,lbe,ts,hbe,UX,POe=k(()=>{le(),p3=1e4,lbe=class{constructor(e=1){this.subdivisions=e}modify(e){let t=function(r){let n=r.getAttribute("position");if(n===void 0)return console.error("SubdivisionModifier: Position attribute required for subdivision."),{positions:new Float64Array(0),faces:new Uint32Array(0),materialIndices:[],uvs:null};let a=r.getAttribute("uv"),s=r.getIndex(),o=n.count,l=new Map,h=new Uint32Array(o),u=[],d=0;for(let y=0;y<o;y++){let _=n.getX(y),b=n.getY(y),x=n.getZ(y),w=Math.round(_*p3),S=Math.round(b*p3),M=Math.round(x*p3),T=l.get(w);T===void 0&&(T=new Map,l.set(w,T));let A=T.get(S);A===void 0&&(A=new Map,T.set(S,A));let E=A.get(M);E===void 0&&(E=d++,A.set(M,E),u.push(_,b,x)),h[y]=E}let c=[],p=[],m=a===void 0?null:[],f=s!==null?s.count:o,g=(y,_)=>{let b=s!==null?s.getX(y):y,x=s!==null?s.getX(y+1):y+1,w=s!==null?s.getX(y+2):y+2;if(!(b<o&&x<o&&w<o))return;let S=h[b],M=h[x],T=h[w];S===M||M===T||T===S||(c.push(S,M,T),p.push(_),m!==null&&m.push(a.getX(b),a.getY(b),a.getX(x),a.getY(x),a.getX(w),a.getY(w)))},v=r.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,f);for(let S=x;S<w&&S+2<f;S+=3)g(S,b)}else for(let y=0;y+2<f;y+=3)g(y,0);return{positions:Float64Array.from(u),faces:Uint32Array.from(c),materialIndices:p,uvs:m===null?null:Float64Array.from(m)}}(e),i=this.subdivisions;for(;i-- >0;)t=COe(t);return function(r,n){let{positions:a,faces:s,materialIndices:o,uvs:l}=r,h=a.length/3,u=s.length/3,d=new Float64Array(3*h);for(let v=0;v<u;v++){let y=3*s[3*v],_=3*s[3*v+1],b=3*s[3*v+2],x=a[b]-a[_],w=a[b+1]-a[_+1],S=a[b+2]-a[_+2],M=a[y]-a[_],T=a[y+1]-a[_+1],A=a[y+2]-a[_+2],E=w*A-S*T,C=S*M-x*A,N=x*T-w*M;d[y]+=E,d[y+1]+=C,d[y+2]+=N,d[_]+=E,d[_+1]+=C,d[_+2]+=N,d[b]+=E,d[b+1]+=C,d[b+2]+=N}for(let v=0;v<h;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 c=3*u,p=new Float32Array(3*c),m=new Float32Array(3*c),f=l!==null&&l.length>0?new Float32Array(2*c):null;for(let v=0;v<c;v++){let y=3*s[v];p[3*v]=a[y],p[3*v+1]=a[y+1],p[3*v+2]=a[y+2],m[3*v]=d[y],m[3*v+1]=d[y+1],m[3*v+2]=d[y+2]}f!==null&&f.set(l.subarray(0,2*c));let g=new At;g.setAttribute("position",new It(p,3)),c>0&&(g.setAttribute("normal",new It(m,3)),g.setAttribute("color",new It(new Float32Array(3*c).fill(1),3))),f!==null&&g.setAttribute("uv",new It(f,2));for(let v=0;v<u;){let y=o[v],_=v;do v++;while(v<u&&o[v]===y);g.addGroup(3*_,3*(v-_),y)}return n.boundingBox!==null&&(g.boundingBox=n.boundingBox.clone()),n.boundingSphere!==null&&(g.boundingSphere=n.boundingSphere.clone()),g}(t,e)}}}),jte=k(()=>{le(),POe(),ts=new D,hbe=class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i,r=e.geometry??t?.geometry??new At().copy(new Nh(100,100,100));t===void 0?(r.computeBoundingBox(),r.boundingBox.getSize(ts),i={width:ts.x,height:ts.y,depth:ts.z,subdivisions:0}):i=t.parameters;let n={...i,...e.parameters};return{parameters:{width:Math.abs(n.width),height:Math.abs(n.height),depth:Math.abs(n.depth),subdivisions:Math.abs(n.subdivisions)},geometry:r}}static build(e){let{width:t,height:i,depth:r,subdivisions:n}=e.parameters,a=e.geometry??new At().copy(new Nh(100,100,100)),s=a.userData.parameters;s===void 0?(a.boundingBox=function(l){let h=new fn,u=l.attributes.position;return u?(h.setFromBufferAttribute(u),h):(h.makeEmpty(),h)}(a),a.boundingBox.getSize(ts)):ts.set(s.width,s.height,s.depth),(t!==ts.x||i!==ts.y||r!==ts.z)&&a.scale(ts.x===0?1:t/ts.x,ts.y===0?1:i/ts.y,ts.z===0?1:r/ts.z);let o=a.originalGeometry;try{n>0?(o===void 0||s?.subdivisions!==n)&&(o===void 0&&(o=a),a=new lbe(n).modify(o)):(o!==void 0&&(a=o),o=void 0,a.getAttribute("normal")===void 0&&a.computeVertexNormals())}catch{o!==void 0&&(a=o),o=void 0,a.getAttribute("normal")===void 0&&a.computeVertexNormals()}return o!==void 0&&Object.assign(a,{originalGeometry:o}),delete e.geometry,Object.assign(a,{userData:{...e,type:"NonParametricGeometry"}})}static loadFromUrl(e,t,i){new j$(i).load(e,r=>{let n=this.normalizeInputs({geometry:r});r.boundingBox.getSize(ts);let a=100/ts.x;Object.assign(n.parameters,{width:100,height:ts.y*a,depth:ts.z*a}),t(this.build(n))})}}}),AH=k(()=>{i0(),Xg(),UX=class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=Object.assign({},t?.parameters??{width:100,depth:0,spikes:5,cornerRadius:0,extrudeBevelSize:0,extrudeBevelSegments:3},e.parameters);return{shape:e.shape&&e.shape instanceof da?e.shape:new da,parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??0)})}}static build(e){let{width:t,height:i,spikes:r,cornerRadius:n,depth:a,extrudeBevelSize:s,extrudeBevelSegments:o}=e.parameters,l=e.shape,h=.5*t,u=.5*i,d=2*Math.PI/r;for(let p=0;p<r;p++){let m=d*p,f=0+Math.sin(m)*h,g=0+Math.cos(m)*u;l.addPoint(l.createPoint(f,g))}l.isClosed=!0;for(let p=0,m=l.points.length;p<m;p++)l.points[p].roundness=n;l.roundness=n,l.update();let c=r0.create({shape:l,parameters:{roundness:n,depth:a,extrudeBevelSize:s,extrudeBevelSegments:o}});return Object.assign(c,{userData:{...e,type:"PolygonGeometry"}})}}});function OS(e,t,i){i.x=e.x*t.x,i.y=e.y,i.z=e.x*t.y}function FF(e,t,i,r,n,a){let s=dbe.copy(t).sub(e),o=cbe.copy(i).sub(e),l=s.angleTo(o);if(s.normalize(),o.normalize(),r===n){let h=s.add(o).normalize();a.copy(e).addScaledVector(h,r/Math.sin(l/2))}else{let h=s.angleTo(o);a.copy(e),a.addScaledVector(s,n/Math.sin(h)),a.addScaledVector(o,r/Math.sin(h))}}function ROe(e,t,i){let r=e.clone().sub(t),n=i.clone().sub(t);return r.projectOnVector(n),r.add(t)}var ube,dbe,cbe,Hte,B4,pbe,mbe,fbe,Wte,FX,gbe,vbe,ybe,_be,qte=k(()=>{le(),ube=class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=Object.assign({},t?.parameters??{width:100,radialSegments:4,heightSegments:1,cornerRadius:0,cornerSegments:8,openEnded:!1},e.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(e){let{width:t,height:i,depth:r,radialSegments:n,heightSegments:a,openEnded:s,cornerRadius:o,cornerSegments:l}=e.parameters,h=new Hte(.5*t,i,n,a,s,o,l),u=r/t;return u!==1&&h.scale(1,1,u),Object.assign(h,{userData:{...e,type:"PyramidGeometry"}})}},dbe=new D,cbe=new D,Hte=class extends At{constructor(e=.5,t=1,i=4,r=1,n=!1,a=0,s=4){super(),i=Math.floor(Math.max(3,i)),r=Math.floor(r),s=Math.floor(s);let o,l=[],h=[],u=[],d=[],c=0,p=t/2,m=Math.PI/i,f=e*Math.cos(Math.PI/i),g=2*Math.PI/i,v=(i-2)*Math.PI/i,y=Math.PI-v,_=new D(0,-p,0),b=new D(0,p,0),x=new J(e,-p),w=new J(f,-p),S=new J(0,b.y).sub(w),M=new J(0,b.y).sub(x),T=new J(S.y,-S.x).normalize(),A=new J(M.y,-M.x).normalize(),E=e*Math.cos(Math.PI/i)*Math.tan((Math.PI-S.angle())/2)-1e-8;a=Math.min(a,E);{let G=new D(T.x,T.y,0),j=new D(Math.cos(g)*G.x,G.y,Math.sin(g)*G.x);o=G.angleTo(j)}let C=a/Math.tan((Math.PI-S.angle())/2),N=a/Math.tan((Math.PI-o)/2),P=new D;if(!n){h.push(_.x,_.y,_.z),u.push(0,-1,0),d.push(0,0);let G=c++,j=[],$=x.clone(),H=C/Math.cos(Math.PI/i);$.x-=H;for(let te=0;te<i;te++){let ue=te/i*Math.PI*2+m;OS($,new J(Math.sin(ue),Math.cos(ue)),P),h.push(P.x,P.y,P.z),u.push(0,-1,0),d.push(0,0),j.push(c++)}for(let te=0;te<j.length;te++)l.push(j[te],G,j[(te+1)%j.length])}let I=[];{let G=new D,j=new D,$=new D,H=new D,te=new D,ue=new D;for(let ae=0;ae<i;ae++){let de=ae/i*Math.PI*2+m,ye=(ae+.5)/i*Math.PI*2+m,Z=(ae+1)/i*Math.PI*2+m,fe=new J(Math.sin(de),Math.cos(de)),W=new J(Math.sin(ye),Math.cos(ye)),z=new J(Math.sin(Z),Math.cos(Z));OS(x,fe,j),OS(x,z,$),OS(T,W,G),FF(b,j,$,N,N,H),h.push(H.x,H.y,H.z),FF(j,b,$,N,C,te),h.push(te.x,te.y,te.z),FF($,j,b,C,N,ue),h.push(ue.x,ue.y,ue.z),u.push(G.x,G.y,G.z),u.push(G.x,G.y,G.z),u.push(G.x,G.y,G.z),d.push(0,0),d.push(0,0),d.push(0,0);let Y=c++,ne=c++,V=c++;if(l.push(Y,ne,V),a>0){{let q=j.clone().add($).multiplyScalar(.5),he=b.clone().sub(q).normalize(),me=_.clone().sub(q).normalize().add(he).normalize().multiplyScalar(-1);L(q,ue.clone().sub(te),me,S.angle())}let Q,ie;{let q=new D;OS(A,z,q);let he=ue.clone().add(H).multiplyScalar(.5);he=ROe(he,$,b);let me=ue.clone().sub(H);[Q,ie]=L(he,me,q,o,H.y)}{let q=Q,he=q.clone().setY(0).normalize(),me=new D(0,-1,0),Ee=he.clone().cross(me);B(q,he,me,Ee)}I.concat(ie);{let q=S.angle(),he=Math.PI-q,me=b.clone();me.y-=a/Math.sin(q-Math.PI/2);let Ee=new D,Se=[];for(let Ne=0;Ne<s;Ne++){let He=[],Pe=Math.PI/2-he*Ne/s,ee=Math.cos(Pe),Me=Math.sin(Pe),We=ye;for(let dt=0;dt<=Ne;dt++){let et=Math.cos(We),Xt=Math.sin(We);G.x=ee*Xt,G.y=Me,G.z=ee*et,Ee.copy(me).addScaledVector(G,a),h.push(Ee.x,Ee.y,Ee.z),u.push(G.x,G.y,G.z),d.push(0,0),He.push(c++),We+=2*Math.PI/Ne/i}Se.push(He)}ie.reverse(),Se.push(ie);let qe=Se.length-1;for(let Ne=0;Ne<qe;Ne++){let He=Se[Ne],Pe=Se[Ne+1],ee=He.length-1;l.push(Pe[1],He[0],Pe[0]);for(let Me=1;Me<=ee;Me++)l.push(He[Me],He[Me-1],Pe[Me]),l.push(Pe[Me+1],He[Me],Pe[Me])}}}}}function L(G,j,$,H,te){let ue=-H/2,ae=(Math.PI-H)/2,de=j.clone().normalize().cross($);G.addScaledVector($,-a/Math.sin(ae));let ye=new D,Z=new D,fe=c,W=[];for(let z=0;z<=s;z++){let Y=ue+z/s*H;Z.set(0,0,0),Z.addScaledVector(de,Math.sin(Y)),Z.addScaledVector($,Math.cos(Y));for(let ne=0;ne<=1;ne++){let V=ne/1-.5;if(ye.copy(G),ye.addScaledVector(j,V),ye.addScaledVector(Z,a),te!=null){let Q=Math.max(0,ye.y-te);ye.addScaledVector(j,-Q/j.y)}h.push(ye.x,ye.y,ye.z),u.push(Z.x,Z.y,Z.z),d.push(0,0),ne===0&&W.push(c),c++}}for(let z=0;z<s;z++)for(let Y=0;Y<1;Y++){let ne=fe+Y+2*z,V=ne+2,Q=V+1,ie=ne+1;l.push(ne,V,ie),l.push(V,Q,ie)}return[G.clone().addScaledVector(j,.5),W]}function B(G,j,$,H){let te=Math.PI/2,ue=M.angle()-te,ae=[],de=new D,ye=new D;for(let fe=0;fe<=s;fe++){let W=[],z=fe/s;for(let Y=0;Y<=fe;Y++){let ne=((fe?Y/fe:0)-.5)*y,V=Math.cos(ne),Q=Math.sin(ne),ie=(te+Math.atan(Math.tan(ue)*V))*z,q=Math.cos(ie),he=Math.sin(ie);de.set(0,0,0),de.addScaledVector(j,he*V),de.addScaledVector($,q),de.addScaledVector(H,he*Q),ye.copy(G).addScaledVector(de,a),h.push(ye.x,ye.y,ye.z),u.push(de.x,de.y,de.z),d.push(0,0),W.push(c++)}ae.push(W)}let Z=ae.length-1;for(let fe=0;fe<Z;fe++){let W=ae[fe],z=ae[fe+1],Y=W.length-1;l.push(W[0],z[1],z[0]);for(let ne=1;ne<=Y;ne++)l.push(W[ne-1],W[ne],z[ne]),l.push(W[ne],z[ne+1],z[ne])}}this.setIndex(l),this.setAttribute("position",new Et(h,3)),this.setAttribute("normal",new Et(u,3)),this.setAttribute("uv",new Et(d,2))}}}),mL=k(()=>{i0(),Xg(),B4=class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=Object.assign({},t?.parameters??{width:100,depth:0,cornerRadius:[0,0,0,0],cornerType:1,extrudeBevelSize:0,extrudeBevelSegments:1},e.parameters),r=Object.assign(t?.ui??{enabledIndieCorners:!1},e.ui);return{shape:e.shape&&e.shape instanceof da?e.shape:new da,parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??0)}),ui:r}}static build(e){let t=e.shape,{width:i,height:r,cornerRadius:n,cornerType:a,depth:s,extrudeBevelSize:o,extrudeBevelSegments:l}=e.parameters,h={x:.5*i,y:.5*r},u={x:-h.x,y:-h.y},d={x:h.x,y:h.y};function c(b,x,w){return x>i&&w>r?Math.min(b*i/x,b*r/w):x>i?b*i/x:w>r?b*r/w:b}let p=[];p[0]=n[0]===0?0:c(n[0],n[0]+n[3],n[0]+n[1]),p[1]=n[1]===0?0:c(n[1],n[1]+n[2],n[1]+n[0]),p[2]=n[2]===0?0:c(n[2],n[2]+n[1],n[2]+n[3]),p[3]=n[3]===0?0:c(n[3],n[3]+n[0],n[3]+n[2]);let m=u.x,f=d.x,g=d.y,v=u.y;t.addPoint(t.createPoint(m,g)),t.addPoint(t.createPoint(f,g)),t.addPoint(t.createPoint(f,v)),t.addPoint(t.createPoint(m,v)),t.isClosed=!0;let y=!0;for(let b=0,x=t.points.length;b<x;b++)t.points[b].roundness=p[b],b>0&&p[b]!==p[b-1]&&(y=!1);y&&(t.roundness=p[0]),t.useCubicForRoundedCorners=a!==1,t.update();let _=r0.create({shape:t,parameters:{depth:s,extrudeBevelSize:o,extrudeBevelSegments:l}});return Object.assign(_,{userData:{...e,type:"RectangleGeometry"}})}}}),$te=k(()=>{le(),pbe=class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=Object.assign({},t?.parameters??{width:100,widthSegments:64,heightSegments:64,phiStart:0,phiLength:2*Math.PI,thetaStart:0,thetaLength:180},e.parameters);return i.thetaLength=ht.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(e){let t,{width:i=100,height:r=i,depth:n=i,widthSegments:a=64,heightSegments:s=64,phiStart:o,phiLength:l,thetaStart:h,thetaLength:u}=e.parameters;return u===0?(t=new At,t.setAttribute("position",new Et([],3))):t=new Vm(.5*i,a,s,o,l,h,u*ht.DEG2RAD),t.scale(1,r/i,n/i),Object.assign(t,{userData:{...e,type:"SphereGeometry"}})}}}),Xte=k(()=>{le(),mbe=class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=Object.assign({},t?.parameters??{width:100,depth:0,widthSegments:8,heightSegments:8},e.parameters);return{parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:0})}}static build(e){let{width:t=100,height:i=t,widthSegments:r=8,heightSegments:n=8}=e.parameters,a=new Yc(t,i,r,n);return a.scale(1,1,1),Object.assign(a,{userData:{...e,type:"PlaneGeometry"}})}}}),Yte=k(()=>{le(),fbe=class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=Object.assign({},t?.parameters??{width:100,angle:90,cornerRadius:24,cornerSegments:8},e.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(e){let{width:t,height:i,depth:r,angle:n,cornerRadius:a,cornerSegments:s}=e.parameters,o=new Wte(t,i,r,n,a,s);return Object.assign(o,{userData:{...e,type:"BackdropGeometry"}})}},Wte=class extends At{constructor(e=1,t=1,i=1,r=90,n=10,a=24){super(),this.type="BackdropGeometry";let s=[],o=[],l=[],h=.001;n==0&&(a=1),a=Math.max(1,Math.floor(a)),n=Math.min(n,100),r=Math.min(180-h,r),r*=Math.PI/180;let u=[],d=Math.PI/2,c=(ye=0,Z=0,fe=0)=>new D(ye,Z,fe),p=c(),m=c(),[f,g,v]=[t/2,e/2,i/2],y=-g,_=+g,[b,x,w]=[c(y,-f,+v),c(y,-f,-v),c(y,+f,-v)],S=(ye,Z=!1)=>Math.sin(ye-Math.PI/(+Z+1)),M=(ye,Z=!1)=>Math.cos(ye-Math.PI/(+Z+1));w.y=Math.sin(r)*t-f;let T=Math.cos(r)*t-v,A=b.z-h;r<=d?(w.z=Math.min(T,A),w.z==A&&(w.y-=(T-A)/Math.tan(d-r))):x.z=Math.min(x.z-T-v,b.z-h),p.subVectors(b,x),m.subVectors(w,x);let E=Math.min(p.length(),m.length())*n/100,C=E*Math.tan(r/2),N=E/Math.cos(r/2),P=p.clone().normalize().add(m.normalize()).setLength(N).add(x);p.set(0,S(r,!0),M(r,!0)),u.push([w,p.clone()]);let I=(Math.PI-r)/a;for(let ye=0;ye<=a;ye++){let Z=d+r+ye*I;p.set(0,Math.sin(Z)*C,Math.cos(Z)*C),p.add(P),m.set(0,S(Z),M(Z)),u.push([p.clone(),m.clone()])}u.push([b,c(0,1,0)]);let L=Math.sin(I/2)*C*2,B=u.length-1,G=u[0][0].distanceTo(u[1][0]),j=G+L*a+u[B-1][0].distanceTo(u[B][0]);u[0].push(1);for(let ye=0;ye<=a;ye++)u[ye+1].push(1-(G+ye*L)/j);u[B].push(0);let $,H,te,[ue,ae,de]=u[0];for(let ye=1;ye<u.length;ye++)[$,H,te]=u[ye],s.push(y,ue.y,ue.z,y,$.y,$.z,_,ue.y,ue.z,_,ue.y,ue.z,y,$.y,$.z,_,$.y,$.z),o.push(0,ae.y,ae.z,0,H.y,H.z,0,ae.y,ae.z,0,ae.y,ae.z,0,H.y,H.z,0,H.y,H.z),l.push(0,de,0,te,1,de,1,de,0,te,1,te),[ue,ae,de]=[$,H,te];this.setAttribute("position",new Et(s,3)),this.setAttribute("normal",new Et(o,3)),this.setAttribute("uv",new Et(l,2))}}}),CH=k(()=>{i0(),Xg(),FX=class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=Object.assign({},t?.parameters??{width:100,depth:0,innerRadiusPercent:38.19,spikes:5,cornerRadius:0,angle:360,extrudeBevelSize:0,extrudeBevelSegments:1},e.parameters);return{shape:e.shape&&e.shape instanceof da?e.shape:new da,parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??0)})}}static build(e){let{width:t,height:i,innerRadiusPercent:r,spikes:n,cornerRadius:a,angle:s,depth:o,extrudeBevelSize:l,extrudeBevelSegments:h}=e.parameters,u=e.shape,d=.5*t,c=.5*i,p=s*Math.PI/360/n,m=Math.PI/2*3*-1,f=d*r/100,g=c*r/100;if(n===3&&r===50){p=2*Math.PI/n;for(let y=0;y<n;y++){let _=p*y,b=0+Math.sin(_)*d,x=0+Math.cos(_)*c;u.addPoint(u.createPoint(b,x))}}else for(let y=0;y<n;y++){let _=0+Math.cos(m)*d,b=0+Math.sin(m)*c;u.addPoint(u.createPoint(_,b)),m+=p,_=0+Math.cos(m)*f,b=0+Math.sin(m)*g,u.addPoint(u.createPoint(_,b)),m+=p}u.isClosed=!0;for(let y=0,_=u.points.length;y<_;y++)u.points[y].roundness=a;u.roundness=a,u.update();let v=r0.create({shape:u,parameters:{roundness:a,depth:o,extrudeBevelSize:l,extrudeBevelSegments:h}});return Object.assign(v,{userData:{...e,type:"StarGeometry"}})}}}),Kte=k(()=>{le(),gbe=class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=Object.assign({},t?.parameters??{width:100,depth:0},e.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(e){let{width:t,height:i}=e.parameters,r=new Yc(t,i);return Object.assign(r,{userData:{...e,type:"TextFrameGeometry"}})}}}),Zte=k(()=>{le(),hA(),vbe=class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=Object.assign({},t?.parameters??{width:100,radialSegments:32,tubularSegments:64,arc:360,cornerRadius:30,cornerSegments:8},e.parameters),r=Math.abs(i.width),n=Math.abs(i.height??i.width);i.shapeBlendNode&&(n=r);let a=Math.round(Math.abs(i.depth??.25*i.width));return{parameters:Object.assign(i,{width:r,height:n,depth:a})}}static build(e){let{width:t,height:i,depth:r,radialSegments:n,tubularSegments:a,arc:s,cornerRadius:o,cornerSegments:l}=e.parameters,h=function(u,d,c,p,m,f,g,v,y,_,b){[d,c]=[c,d],g=d/2;let x=ht.clamp(m/360,0,1);if(x===0){let w=new At;return w.setAttribute("position",new Et([],3)),w}return x===1&&(_=0),new mH(!0,u,d,c,p,x,f,g,0,y,_,b)}(t,i,r,.5*t,s,a,0,0,n,o,l);return h.scale(1,i/t,1),Object.assign(h,{userData:{...e,type:"TorusGeometry"}})}}}),Qte=k(()=>{le(),ybe=class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=Object.assign({},t?.parameters??{width:100,tubularSegments:64,radialSegments:32,p:2,q:3},e.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(e){let{width:t,tube:i,tubularSegments:r,radialSegments:n,p:a,q:s}=e.parameters,o=.5*t;o!==i&&(o-=i);let l=new o7(o,i,r,n,a,s);return Object.assign(l,{userData:{...e,type:"TorusKnotGeometry"}})}}}),Jte=k(()=>{i0(),Xg(),_be=class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=Object.assign({},t?.parameters??{width:100,depth:0,spikes:5,cornerRadius:0,extrudeBevelSize:0,extrudeBevelSegments:1,isRect:!1},e.parameters);return{shape:e.shape&&e.shape instanceof da?e.shape:new da,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(e){let{width:t=100,height:i,cornerRadius:r,depth:n,extrudeBevelSize:a,extrudeBevelSegments:s,isRect:o}=e.parameters,l=e.shape,h=.5*t,u=.5*i;o?(l.addPoint(l.createPoint(-h,u)),l.addPoint(l.createPoint(h,-u)),l.addPoint(l.createPoint(-h,-u))):(l.addPoint(l.createPoint(0,u)),l.addPoint(l.createPoint(h,-u)),l.addPoint(l.createPoint(-h,-u))),l.isClosed=!0;for(let c=0,p=l.points.length;c<p;c++)l.points[c].roundness=r;l.roundness=r,l.update();let d=r0.create({shape:l,parameters:{roundness:r,depth:n,extrudeBevelSize:a,extrudeBevelSegments:s}});return Object.assign(d,{userData:{...e,type:"TriangleGeometry"}})}}}),DOe=k(()=>{}),NOe=k(()=>{le(),new Ws,new ke,new vm,new D,new D,new D,new D});function eie(){let e=new At;return e.setAttribute("position",new It(new Float32Array([]),3)),e.setIndex(new It(new Uint16Array([]),1)),e}var tie,PH,bbe=k(()=>{Js(),$t(),Sw(),le(),CA(),i0(),Xg(),tie=eie().attributes,PH=class extends At{constructor(e,t){super(),this.isTextGeometry=!0,this.charWidths=[],this.charCoords=[],this.wrappedText=[],this.isLowResolution=!1,this.vectorShapes=[],Object.assign(this.attributes,tie),this.userData={parameters:e,type:"TextGeometry"};let i=t.getFont(e.font);i?.isLoaded?(this.font=i,this.update(e,t)):this.updateFont(e.font,t).then(()=>{this.update(e,t),t?.requestRender()})}async updateFont(e,t){let i=t.getFont(e);i&&(this.font=i,await i.loadingPromise)}update(e,t){let i=this.font;if(this.userData={parameters:e,type:"TextGeometry"},!i?.isLoaded)return void console.warn("Cannot update text because its font is not loaded");let{width:r,height:n,depth:a,extrudeBevelSize:s,extrudeBevelSegments:o,text:l,textTransform:h}=e,u=Ao.getDisplayedValue(l),d=function(b,x,w,S){let M=typeof b.width=="string"?Number(S.getVariable(b.width)):b.width,T=[""],A="";for(let E of w)A+=E,E===" "||E===`
|
|
4168
4168
|
`?(T[T.length-1]+=A,A="",E===`
|
|
4169
|
-
`&&T.push("")):x.getTextWidth(T[T.length-1]+A,b)>M&&(T[T.length-1].length&&T.push(""),x.getTextWidth(T[T.length-1]+A,b)>M&&(A.length===1?(T[T.length-1]+=A,A=""):(T[T.length-1]+=A.slice(0,-1),A=A[A.length-1],T.push(""))));return T[T.length-1]+=A,T}(e,i,h===2?u.toUpperCase():h===3?u.toLowerCase():u,t),{shapes:c,charWidths:p,charCoords:m}=i.generateShapes(d,e,t),f=.5*(typeof r=="number"?r:Number(t.getVariable(r))),g=.5*(typeof n=="number"?n:Number(t.getVariable(n))),v=c.map(b=>new da().fromShape(b,!0));this.vectorShapes=v;let y=v.map(b=>r0.create({shape:b,parameters:{depth:a,extrudeBevelSegments:o,extrudeBevelSize:s,windingRule:a<=0?xn.NONZERO:xn.ODD,subdivisions:this.isLowResolution&&a>0?1:12}})),_=y.length?ry(y):eie();_.translate(-f,g,0),this.dispose(),this.wrappedText=d,this.charCoords=m,this.charWidths=p,this.deleteAttribute("extrudeNormal"),Object.entries(_.attributes).forEach(([b,x])=>{this.setAttribute(b,x)}),this.setIndex(_.index),this.computeBoundingSphere()}clone(){let e=Gl(new At,PH.prototype);return e.copy(this),console.log("CloneGeometry",this,e),e}copy(e){return Object.entries(e.attributes).forEach(([t,i])=>{this.setAttribute(t,i)}),this.setIndex(e.index),this.userData={parameters:{...e.userData.parameters},type:"TextGeometry"},this}async setText(e,t){this.font&&await this.font.loadingPromise,await this.update({...this.userData.parameters,text:{textValue:e}},t)}get text(){return this.userData.parameters.text??""}}});function IOe(e){if(!RH)return iie||(iie=async function(){let t=e??"https://cdn.spline.design/@splinetool/runtime@2.0.11/build",i=import("./process.js"),[r,n]=await Promise.all([i,fetch(`${t}/process.wasm`).then(o=>o.arrayBuffer())]),a=r.default,s=await a({wasmBinary:n});xbe(s),RH=!0}())}var xbe,zX,RH,iie,U4=k(()=>{zX=new Promise(e=>{xbe=e}),RH=!1});function zF(e,t){if(Object.keys(e.morphAttributes).length>0||Object.keys(t.morphAttributes).length>0)return!1;let i=Object.keys(e.attributes),r=Object.keys(t.attributes);if(i.length!==r.length)return!1;for(let o of r){let l=e.attributes[o],h=t.attributes[o];if(l===void 0||l.isInterleavedBufferAttribute===!0||h.isInterleavedBufferAttribute===!0||l.itemSize!==h.itemSize||l.normalized!==h.normalized||l.array.constructor!==h.array.constructor||l.array.length!==h.array.length)return!1}let n=e.index,a=t.index;if(n===null!=(a===null))return!1;let s=!1;if(n!==null&&a!==null){if(n.array.length!==a.array.length)return!1;let o=n.array.constructor,l=a.array.constructor;if(o!==l){if(o!==Uint32Array||l!==Uint16Array)return!1;s=!0}}if(e.groups.length!==t.groups.length)return!1;for(let o=0;o<t.groups.length;o++){let l=e.groups[o],h=t.groups[o];if(l.start!==h.start||l.count!==h.count||l.materialIndex!==h.materialIndex)return!1}for(let o of r){let l=e.attributes[o],h=t.attributes[o];l.array.set(h.array),l.needsUpdate=!0}if(n!==null&&a!==null){if(s){let o=n.array,l=a.array;for(let h=0,u=l.length;h<u;h++){let d=l[h];o[h]=d===65535?4294967295:d}}else n.array.set(a.array);n.needsUpdate=!0}return e.drawRange.start=t.drawRange.start,e.drawRange.count=t.drawRange.count,e.userData=t.userData,e.boundingBox=null,e.boundingSphere=null,!0}function DH(e,t,i,r){let n,a,s,o=e.position.array,l=e.normal.array,h=wbe.makeScale(t,i,r).invert().elements;for(let u=0,d=o.length;u<d;u+=3)o[u]*=t,o[u+1]*=i,o[u+2]*=r,n=l[u],a=l[u+1],s=l[u+2],l[u]=h[0]*n+h[4]*a+h[8]*s,l[u+1]=h[1]*n+h[5]*a+h[9]*s,l[u+2]=h[2]*n+h[6]*a+h[10]*s;e.position.needsUpdate=!0,e.normal.needsUpdate=!0}var wbe,Sbe=k(()=>{le(),wbe=new ke});function Tbe(e){let t=Object.keys(e);return t.length===1&&t[0]==="subdivisions"}function VX(e,t){let i=t?t.count:e.count,r=0,n=1e4,a=new Map,s=new Uint32Array(i),o=[];for(let u=0;u<i;u++){let d=t?t.getX(u):u,c=e.getX(d),p=e.getY(d),m=e.getZ(d),f=Math.round(c*n),g=Math.round(p*n),v=Math.round(m*n),y=a.get(f);y===void 0&&(y=new Map,a.set(f,y));let _=y.get(g);_===void 0&&(_=new Map,y.set(g,_));let b=_.get(v);b===void 0&&(b=r++,_.set(v,b),o.push(c,p,m)),s[u]=b}let l=[],h=[];for(let u=0;u<s.length;u+=3)s[u]===s[u+1]||s[u]===s[u+2]||s[u+1]===s[u+2]||(l.push(s[u],s[u+1],s[u+2]),h.push(t?t.getX(u):u,t?t.getX(u+1):u+1,t?t.getX(u+2):u+2));return{positions:o,triIndices:l,triOriginals:h}}var LS,L0,ni,VF,kF,GF,ua,BS,m3,f3,g3,NH,lI,Tw=k(()=>{le(),U4(),$t(),F4(),Sbe(),hA(),LS=new fn,L0=new D,zX.then(e=>{ni=e}),VF=new Float32Array([10,10,0,-10,10,0,-10,-10,0,10,-10,0]),kF=new Uint32Array([0,1,2,3]),GF=new Uint8Array([4]),ua=class extends At{constructor(e,t){super(),this.data=e,this.flatShading=t,this.subdivPointer=0,this.rebuild(),this.freeSubdivPointer()}mutateDirectlyScaleBaked(e,t){this.freeSubdivPointer();let i=this.data.scaleBaked.map(s=>typeof s=="number"?s:1),r=Fg.div(t.map(s=>typeof s=="number"?s:0),i);if(r.every(s=>s===1))return;this.subdividedGeometry&&DH(this.subdividedGeometry.attributes,...r),this.originalGeometry&&DH(this.originalGeometry.attributes,...r),this.data=e;let n=this.userData.parameters;this.userData.parameters={width:n.width*r[0],height:n.height*r[1],depth:n.depth*r[2]},this.originalGeometry.boundingSphere.center.multiply(L0.fromArray(r));let a=L0.set(n.width,n.height,n.depth).length();this.originalGeometry.boundingSphere.radius=a/2}ensureSubdivPointer(){return this.subdivPointer===0&&this.rebuild(),this.subdivPointer}mutateDirectlySubdivisions(e){this.freeSubdivPointer(),this.data=e;let t=e.phongAngle??35;this.flatShading&&(t=-1);let i=null;if(e.subdivisions>0){let n=0;try{n=ua.allocate(e),i=ua.buildRefined(n,e.subdivisions,t)}catch(a){console.error(a,e)}finally{n&&ua.freeSubdivPointer(n)}}this.subdividedGeometry?.dispose(),this.subdividedGeometry=i??void 0,this.subdividedGeometry&&(this.subdividedGeometry.boundingSphere=this.originalGeometry.boundingSphere);let r=this.userData.parameters;Object.assign(this,this.subdividedGeometry??this.originalGeometry),this.userData.parameters=r}rebuild(){let e,t,i;try{({originalGeometry:e,subdividedGeometry:t,subdivPointer:i}=ua.build(this.data,void 0,!this.flatShading,void 0))}catch{e=new Nh(100,100,100),i=0}this.subdivPointer=i,this.originalGeometry=e,this.subdividedGeometry=t??void 0;let r=this.subdividedGeometry??this.originalGeometry;Object.assign(this,r),this.calcBoundingBox()}freeSubdivPointer(){this.subdivPointer&&(ua.freeSubdivPointer(this.subdivPointer),this.subdivPointer=0)}dispose(){super.dispose(),this.freeSubdivPointer()}calcBoundingBox(){let e=this.originalGeometry;e.boundingSphere===null&&(e.boundingSphere=new Ws,this.subdividedGeometry&&(this.subdividedGeometry.boundingSphere=e.boundingSphere));let t=e.attributes.position,i=e.boundingSphere.center;LS.setFromBufferAttribute(t),LS.getCenter(i),e.boundingSphere.radius=i.distanceTo(LS.max),isNaN(e.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this),LS.getSize(L0);let r={width:L0.x,height:L0.y,depth:L0.z};return this.userData.parameters=r,r}static build(e,t,i,r){let n,a,s=e?.phongAngle??35;i===!1&&(s=-1),t&&(ni.free_bvh(t),ni.free_subdivision_surface(t));try{n=ua.allocate(e,r)}catch(l){console.error(l,e),n=ua.allocate({positionWASM:VF,indexWASM:kF,verticesPerFaceWASM:GF},r)}ni.set_destination_refinement_level(n,0);let o=ua.buildLevel(n,!0,s);return a=e.subdivisions>0?ua.buildRefined(n,e.subdivisions,s):null,{subdivPointer:n,originalGeometry:o,subdividedGeometry:a}}static buildRefined(e,t,i){try{return ni.set_destination_refinement_level(e,t),ua.buildLevel(e,!1,i)??null}catch{try{return ni.set_destination_refinement_level(e,t-1),ua.buildLevel(e,!1,i)??null}catch{return null}}}static primitiveToQuads(e,t,i){e.widthSegments>16&&(e.widthSegments=16),e.heightSegments>16&&(e.heightSegments=16),e.depthSegments>16&&(e.depthSegments=16),e.radialSegments>16&&(e.radialSegments=16),e.type==="DodecahedronGeometry"&&(e.detail=0);let r,n=e.shape!==void 0||e.path!==void 0?t.geometry:Ng(e,i,!1,t);r=T_e(e)?n.getClosedTorusIndicesForBooleanOrSubdiv():n.getIndex();let a,{positions:s,triIndices:o,triOriginals:l}=VX(n.getAttribute("position"),r);if(e.type==="CylinderGeometry"&&e.cornerRadius===0&&e.hollow===0&&e.openEnded===!1){let c=e.radialSegments*e.heightSegments*3*2;a=[c,c+3*e.radialSegments]}let{indices:h,verticesPerFace:u,uvs:d}=function(c,p,m,f,g){let v=[],y=[],_=g?m.getAttribute("uv"):void 0,b=_&&_.itemSize===2?[]:void 0,x=M=>{if(b){let T=g[M];b.push(_.getX(T),_.getY(T))}};if(m.userData.shape!==void 0&&m.userData.parameters.depth===0&&m.userData.shape.shapeHoles.length===0){let M=m.userData.shape.extractShapePointsToFlatArray([]),T=m.userData.parameters.spikes;if(m.userData.type==="EllipseGeometry"&&T<=24&&T%4==0&&m.userData.parameters.angle>=360){let C=M.length/2/T;M=M.filter((N,P)=>Math.floor(P/2)%C===0)}let A=0;for(let C=0;C<M.length;C+=2)A+=(M[C]-M[(C===0?M.length:C)-2])*(M[C+1]+M[(C===0?M.length:C)-1]);c.length=0;let E=0;if(A<0)for(let C=0;C<M.length;C+=2)c.push(M[C],M[C+1],0),v.push(E++);else for(let C=M.length-2;C>=0;C-=2)c.push(M[C],M[C+1],0),v.push(E++);return y.push(E),{indices:v,verticesPerFace:y}}let w=new Float32Array([m.userData.parameters.depth])[0],S=0;for(;S<p.length;){if(m.useNgonForTopBottomFaceDuringBake){let M=0;if((c[3*p[S]+2]===w||c[3*p[S]+2]===0)&&M++,(c[3*p[S+1]+2]===w||c[3*p[S+1]+2]===0)&&M++,(c[3*p[S+2]+2]===w||c[3*p[S+2]+2]===0)&&M++,M===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]){BS.set(c[3*p[S]],c[3*p[S]+1],c[3*p[S]+2]),m3.set(c[3*p[S+1]],c[3*p[S+1]+1],c[3*p[S+1]+2]),f3.set(c[3*p[S+4]],c[3*p[S+4]+1],c[3*p[S+4]+2]),g3.set(c[3*p[S+5]],c[3*p[S+5]+1],c[3*p[S+5]+2]),m3.sub(BS).normalize(),f3.sub(BS).normalize(),g3.sub(BS).normalize();let M=m3.cross(f3).dot(g3),T=S;Math.abs(M)>.005||f&&f.some((A,E)=>E%2!=1&&T>=f[E]&&T<f[E+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(m.useNgonForTopBottomFaceDuringBake){let M=[],T=[],A=0;for(let E=0,C=0;E<c.length;E+=3,C++)c[E+2]===0&&(M.push(C),A++),c[E+2]===w&&T.push(C);if(m.userData.parameters.extrudeBevelSize===0){let E=T[0];T[0]=T[1],T[1]=E}M.reverse(),v.push(...M,...T),y.push(A,A),b=void 0}return{indices:v,verticesPerFace:y,uvs:b}}(s,o,n,a,l);return{positions:s,indices:h,verticesPerFace:u,uvs:d}}static allocate(e,t){let i,r,n,a=[],s=[];e.positionWASM&&e.positionWASM.length>0?(i=e.positionWASM,r=e.indexWASM,n=e.verticesPerFaceWASM,ni.alloc_subdivision_surface_uvs&&e.uvWASM&&e.uvWASM.length===2*r.length&&(s=e.uvWASM)):(i=VF,r=kF,n=GF);let o,l=i.length,h=r.length,u=n.length,d=i.length+a.length+s.length,c=r.length+n.length,p=d*Float32Array.BYTES_PER_ELEMENT+c*Uint32Array.BYTES_PER_ELEMENT,m=d*Float32Array.BYTES_PER_ELEMENT,f=ni._malloc(p),g=new Float32Array(ni.HEAPF32.buffer,f,d),v=new Uint32Array(ni.HEAPU32.buffer,f+m,c);g.set(i,0),g.set(a,i.length),g.set(s,i.length+a.length),v.set(r,0),v.set(n,r.length),e?.scaleBaked?.some(b=>b!==1)&&(o=new ke().makeScale(...e.scaleBaked.map(b=>typeof b=="number"?b:1))),t&&(o?o.premultiply(t):o=t);let y=f+(i.length+a.length)*Float32Array.BYTES_PER_ELEMENT,_=s.length?o?ni.alloc_subdivision_surface_uvs2(f,l,f+m,h,f+m+r.length*Uint32Array.BYTES_PER_ELEMENT,u,y,s.length,o.elements):ni.alloc_subdivision_surface_uvs(f,l,f+m,h,f+m+r.length*Uint32Array.BYTES_PER_ELEMENT,u,y,s.length):o?ni.alloc_subdivision_surface2(f,l,f+m,h,f+m+r.length*Uint32Array.BYTES_PER_ELEMENT,u,o.elements):ni.alloc_subdivision_surface(f,l,f+m,h,f+m+r.length*Uint32Array.BYTES_PER_ELEMENT,u);return ni._free(f),_}static buildLevel(e,t,i,r,n,a=!1){let s=n?ni.get_mesh_data2(e,t?ni.Level.CONTROL:ni.Level.REFINED,i,n.elements):ni.get_mesh_data(e,t?ni.Level.CONTROL:ni.Level.REFINED,i),o=ni.HEAPU32.subarray(s>>2,10+(s>>2)),l=o.subarray(4,8),h=0,u=ni.HEAPU32[o[h]>>2],d=ni.HEAPF32.subarray(u>>2,(u>>2)+l[h]);h++;let c=ni.HEAPU32[o[h]>>2],p=ni.HEAPF32.subarray(c>>2,(c>>2)+l[h]);h++;let m=ni.HEAPU32[o[h]>>2],f=ni.HEAPU32.subarray(m>>2,(m>>2)+l[h]);h++;let g,v=ni.HEAPU32[o[h]>>2],y=ni.HEAPU32.subarray(v>>2,(v>>2)+l[h]);if(h++,ni.alloc_subdivision_surface_uvs){let b=o[9];if(b>0){let x=ni.HEAPU32[o[8]>>2];g=ni.HEAPF32.subarray(x>>2,(x>>2)+b)}}if(r===void 0){let b=new At;if(b.setIndex(new zm(y,1)),b.setAttribute("position",new Et(d,3)),b.setAttribute("normal",new Et(p,3)),g&&b.setAttribute("uv",new Et(g,2)),t){b.setAttribute("faceMap",new zm(f,1));let x=new Float32Array(p.length/3*4).fill(0);b.setAttribute("color",new It(x,4))}return ni.free_mesh_data(s),b.userData.type="SubdivGeometry",b}if(r.getAttribute("position").copyArray(d),r.getAttribute("normal").copyArray(p),r.attributes.position.needsUpdate=!0,r.attributes.normal.needsUpdate=!0,a){let b=r.getIndex();b!==null&&b.array.length===y.length&&(b.copyArray(y),b.needsUpdate=!0)}let _=r.getAttribute("uv");g&&_&&_.array.length===g.length&&(_.copyArray(g),_.needsUpdate=!0),ni.free_mesh_data(s)}static freeSubdivPointer(e){ni.free_bvh(e),ni.free_subdivision_surface(e)}static buildControlCageWireframe(e,t,i){let r=ni.get_wireframe_data_for_base_level(e),n=ni.HEAPU32.subarray(r>>2,4+(r>>2)),a=n.subarray(2,4),s=0,o=ni.HEAPU32[n[s]>>2],l=ni.HEAPF32.subarray(o>>2,(o>>2)+a[s]);s++;let h=ni.HEAPU32[n[s]>>2],u=ni.HEAPU32.subarray(h>>2,(h>>2)+a[s]);if(t===void 0){let d=new At;d.setAttribute("position",new Et(l,3));let c=new Float32Array(l.length);for(let p=0,m=l.length;p<m;)c[p++]=i.r,c[p++]=i.g,c[p++]=i.b;return d.setAttribute("color",new It(c,3)),d.setIndex(new zm(u,1)),ni.free_wireframe_data_for_base_level(r),d}t.getAttribute("position").copyArray(l),t.attributes.position.needsUpdate=!0,ni.free_wireframe_data_for_base_level(r)}static updateCollabMesh(e,t,i){let r=t===0;r||ni.set_destination_refinement_level(e,t);let n=i?ni.get_topological_data2(e,r?ni.Level.CONTROL:ni.Level.REFINED,i.elements):ni.get_topological_data(e,r?ni.Level.CONTROL:ni.Level.REFINED),a=ni.HEAPU32.subarray(n>>2,8+(n>>2)),s=a.subarray(3,6),o=0,l=ni.HEAPU32[a[o]>>2],h=new Float32Array(ni.HEAPF32.subarray(l>>2,(l>>2)+s[o]));o++;let u=ni.HEAPU32[a[o]>>2],d=new Uint32Array(ni.HEAPU32.subarray(u>>2,(u>>2)+s[o]));o++;let c,p=ni.HEAPU32[a[o]>>2],m=new Uint8Array(ni.HEAPU32.subarray(p>>2,(p>>2)+s[o]));if(ni.alloc_subdivision_surface_uvs){let f=a[7];if(f>0){let g=ni.HEAPU32[a[6]>>2];c=new Float32Array(ni.HEAPF32.subarray(g>>2,(g>>2)+f))}}return ni.free_topological_data(n),{positions:h,indices:d,verticesPerFace:m,uvs:c}}},BS=new D,m3=new D,f3=new D,g3=new D}),Mbe=k(()=>{Tte(),Mte(),uL(),Ete(),pL(),hA(),kte(),Gte(),jte(),AH(),qte(),mL(),$te(),Xte(),Yte(),CH(),Kte(),Zte(),Qte(),Jte(),Xg(),_r(),Tte(),Mte(),uL(),Ete(),pL(),DOe(),hA(),kte(),Gte(),jte(),AH(),qte(),mL(),$te(),Xte(),Yte(),CH(),Kte(),Zte(),Qte(),Jte(),Xg(),NOe(),ibe(),bbe(),Tw(),U4(),I4(),NH={ConeGeometry:j_e,CubeGeometry:H_e,CylinderGeometry:OX,DodecahedronGeometry:W_e,EllipseGeometry:L4,HelixGeometry:M_e,IcosahedronGeometry:sbe,LatheGeometry:obe,NonParametricGeometry:hbe,PolygonGeometry:UX,PyramidGeometry:ube,RectangleGeometry:B4,SphereGeometry:pbe,PlaneGeometry:mbe,BackdropGeometry:fbe,StarGeometry:FX,TextFrameGeometry:gbe,TorusGeometry:vbe,TorusKnotGeometry:ybe,TriangleGeometry:_be,VectorGeometry:r0},lI=e=>{let t=NH[e.type]??m_e(e.type);if(t===void 0)throw new Error(`No geometry factory registered for "${e.type}" \u2014 was its feature compiled out of this runtime build?`);return t.create(e)}});function Ng(e,t,i,r){let n,a,s;e.type==="PathGeometry"?(a=JSON.parse(JSON.stringify(e)),s=[[],["extrusion"]]):(a={...e},s=[[]]);for(let h of s){let u=a;for(let d of h)u=u[d];for(n in u){let d=u[n];HJ(d)&&!Ebe.includes(n)&&(u[n]=t.getVariable(d,[r.uuid,"geometry",...h,n]),HJ(u[n])&&(u[n]=1))}}let o,l={parameters:a,type:a.type};if(a.type==="PathGeometry")l.path=a.path;else if(a.type==="VectorGeometry"){let h=da.createFromState(a.shape,a.width,a.height);l.shape=h}else if(a.type==="NonParametricGeometry"){if(a.data.groups&&a.data.groups?.forEach(h=>h.materialIndex=Math.max(h.materialIndex??0,0)),l.geometry=new j$().parse(a),l.geometry.groups.length===0){let h=l.geometry;h.addGroup(0,Math.max(h.getIndex()?.count??0,h.getAttribute("position").count),0)}}else{if(a.type==="SubdivGeometry"){let h=new ua(a,i);return h.data=e,h}if(a.type==="TextGeometry"||a.type==="InputGeometry"){let h=m_e(a.type);if(h)return h.create(a,t);Ms("text",`a ${a.type}`);let u=da.createFromState(sA.defaultData(),100,100);return lI({...a,shape:u,type:"VectorGeometry"})}if(a.type==="UIGeometry")return B4.create({parameters:{width:a.width,height:a.height,cornerRadius:a.cornerRadius,cornerType:a.cornerType}})}try{o=lI(l)}catch(h){console.error(h),console.error(`Error generating geometry with inputs: ${l}`);let u=da.createFromState(sA.defaultData(),100,100);l.shape=u,l.type="VectorGeometry",o=lI(l)}return o}var Ebe,rie,IH,F4=k(()=>{$t(),le(),Mbe(),_r(),mL(),i0(),Tw(),Ebe=["font"]}),OOe=k(()=>{F4(),rie=class{constructor(){this.objects=new Map,this.unreachable=new Set}getCached(e){return this.objects.get(e)}get size(){return this.objects.size}get(e,t,i){let r=this.objects.get(e);return r===void 0?(r=this.createObject(e,t,i),this.objects.set(e,r)):r.isShared=!0,r}forceDelete(e){let t=this.objects.get(e);t&&(this.disposeObject(t),this.objects.delete(e))}adopt(e,t){this.objects.set(e,t)}mutateIfUnique(e,t){let i=this.objects.get(e);if(i&&i.isShared!==!0)return this.objects.delete(e),this.objects.set(t,i),i}startGc(){this.unreachable=new Set(this.objects.keys())}markAsReachable(e,t){t===this.objects.get(e)&&this.unreachable.delete(e)}endGc(){this.unreachable.forEach(e=>{this.disposeObject(this.objects.get(e)),this.objects.delete(e)}),this.unreachable.clear()}dispose(){this.objects.forEach(e=>{this.disposeObject(e)}),this.objects.clear()}},IH=class extends rie{constructor(e){super(),this.flatShading=e}disposeObject(e){e.dispose()}createObject(e,t,i){let r=Ng(e,t,this.flatShading,i);return r.computeBoundingSphere(),r}}});function fL(){return NA}function Abe(){if(NA==="webgpu"){if(LH!==void 0)return LH;UH||(UH=!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(BH===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 BH}function Cbe(e,t){return Abe().createRootMaterial(e,t)}function nie(e,t,i){return Abe().createSharedMaterial(e,t,i)}function aie(e){return e.getLayersOfType===void 0&&Object.assign(e,{layers:[],getLayersOfType:()=>[],hasAO:!1,assetsLoaded:()=>!0}),e}function OH(){return Rbe}var NA,LH,BH,UH,FH,Pbe,Rbe,zH,Dbe,Ym=k(()=>{NA="webgl",UH=!1}),LOe=k(()=>{Dbe={markNeedsUpdateRendererDirty:()=>{}}});function Td(e,t){let i=0;if(!e.layers||e.layers.length===0)return!1;let r=e.layers?.find(n=>n.data.type==="light");if(r){let n=r.data,a=Number(t.getVariable(n.alphaOverride));if((typeof n.alphaOverride=="string"?a/100:n.alphaOverride)<1)return!0}for(let n of e.layers){if(n.data.type!=="displace"&&n.data.isMask)return!0;if(n.data.type!=="displace"&&"alpha"in n.data&&n.data.type!=="light"&&n.data.type!=="fresnel"&&n.data.type!=="cavity"&&n.data.type!=="dust"&&n.data.type!=="texture"&&n.data.type!=="matcap"&&n.data.type!=="rainbow"&&n.data.type!=="outline"&&n.data.type!=="pattern"){let a=n.data.visible?n.data.alpha:0;if(typeof a=="string"&&(a=Math.max(0,Math.min(1,Number(t.getVariable(a)??100)/100))),a===1&&n.data.type==="depth"||n.data.type==="gradient"){for(let s of n.data.colors)if(s[3]<1){a=s[3];break}}else if(a===1&&n.data.type==="noise"){let s=t.color(n.data.colorA).a,o=t.color(n.data.colorB).a,l=t.color(n.data.colorC).a,h=t.color(n.data.colorD).a,u=Math.min(s,Math.min(o,Math.min(l,h)));u<1&&(a=u)}i+=(1-i)*a}}return i<1}var z4=k(()=>{});function km(e){return typeof e=="string"||typeof e=="number"&&e!==0}var Oh,Lt,Mw,kX,sie,oie,Dh,Pd=k(()=>{Oh=(e,t,i)=>Math.max(0,Math.min(1,Number(t.getVariable(typeof e=="number"?100*e:e,i)??100)/100))??1,Lt=(e,t,i)=>typeof e=="number"?e:t.getVariable(e,i),Mw={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"]},kX={depth:["colors"],gradient:["colors","steps"],toon:["colors","steps"]}}),Ew=k(()=>{le(),DA(),sie=class extends R4(un){},oie=e=>e.type==="Mesh",Dh=class extends sie{constructor(e){super(),this.object=e,this.isClone=!0,this.matrixAutoUpdate=!1,this.hasNonUniformScale=e.hasNonUniformScale}raycast(e,t){}expand(){let e=0,t=this.object.entityChildren(e);for(;t;){let i=this.children[e];i?.object!==t&&(i&&this.remove(i),i=new Dh(t),this.add(i),this.children.splice(e,0,this.children.pop()),i.matrixWorldNeedsUpdate=!0,i.matrixAutoUpdate=!1,i.matrix=t.matrix,i.hiddenMatrix=t.hiddenMatrix,i.pivotMatrix=t.pivotMatrix),i.expand(),e+=1,t=this.object.entityChildren(e)}for(;this.children.length>e;)this.remove(this.children[e]);this.pivotMatrix=this.object.pivotMatrix}get visible(){let e=this.object.cloner;return(e===void 0||this.parent!==e||!e.instancingActive&&!e.insideBoolean)&&(this.playModeVisible!==void 0?this.playModeVisible:this.object.visible||this.object.dataPatched.visible&&this.object.dataPatched.cloner?.hideBase===!0)}set visible(e){}get castShadow(){return this.object.castShadow}set castShadow(e){}get receiveShadow(){return this.object.receiveShadow}set receiveShadow(e){}get isMesh(){return oie(this.object)}get isLight(){return this.object.isLight}get layers(){return this.object.layers}set layers(e){}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(e){}}});function lie(){return GX}var GX,jX,HX=k(()=>{GX=null,jX=null});function VH(e){return"variable_"+e}var jF,HF,WF,hie,qF,uie,die,gL,WX=k(()=>{$t(),O_e(),z_e(),O4(),wu(),DX(),IX(),OOe(),Ym(),B_e(),LOe(),z4(),Pd(),xl(),Ew(),Nr(),le(),HX(),_r(),jF=new ke,HF=new D,WF=new Zt,hie=new D,qF=new pn,uie=class extends N_e{constructor(e){super(),this.shared=e}create(e){return new RX(e,this.shared)}},(gL=die=class{constructor(e,t={},i=!0,r=!1){if(this.data=e,this.needsJitter=i,this.enableLocalStorageForPersistentVariables=r,this.geometryCache=new IH(!0),this.geometryCache2=new IH(!1),this.imageHolderCache=new uie(this),this.thisContext={scene:Dbe,shared:this},this.deletedImage=new Nc(tH.emptyImage,this),this.deletedVideo=new Nc($O.defaultVideo,this),this.materials={},this.images={},this.uiBuffers={},this.videos={},this.colors={},this.audios={},this.particles={},this.fonts={},this.timelineAnimations={},this.variables={},this.userAPIs={},this.userWebhooks={},this.mouseProperty=null,this.raycastProperty=null,this.requestRender=()=>{this._requestRender&&this._requestRender()},this.transientGeometryKeys=new WeakSet,t.images)for(let[n,a]of Object.entries(t.images))this.addImage(n,a);if(t.videos)for(let[n,a]of Object.entries(t.videos))this.addVideo(n,a);if(t.audios)for(let[n,a]of Object.entries(t.audios))this.addAudio(n,a);if(t.particles)for(let[n,a]of Object.entries(t.particles))this.addParticle(n,a);this.reset(e)}get deletedMaterial(){return this._deletedMaterial??(this._deletedMaterial=nie(ra.defaultTwoLayerData("phong"),this.thisContext,"")),this._deletedMaterial}setRequestRender(e){this._requestRender=e}getImageLoadPromises(){return Object.values(this.images).map(e=>e.loadPromise)}setEntityOpContext(e){this.entityOpContext=e}reset(e,t=!1,i=!1){this.data=e,this.resetLib(e.lib);for(let{id:r,data:n}of e.variables)this.addVariableHolder(r,n),t&&this.updateVariableHolder(r,n);for(let[r,n]of Object.entries(e.userAPIs??{}))this.addUserAPI(r,n);for(let[r,n]of Object.entries(e.userWebhooks??{}))this.addUserWebhook(r,n);if(!i){for(let[r,n]of Object.entries(e.images))this.addImage(r,n);for(let[r,n]of Object.entries(e.videos))this.addVideo(r,n)}for(let[r,n]of Object.entries(e.colors))this.addColor(r,n);for(let[r,n]of Object.entries(e.lib.materials))this.addMaterial(r,n.asset);for(let[r,n]of Object.entries(e.materials))this.addMaterial(r,n);for(let[r,n]of Object.entries(e.audios))this.addAudio(r,n);for(let[r,n]of Object.entries(e.particles))this.addParticle(r,n);for(let[r,n]of Object.entries(e.fonts))this.addFont(r,n);for(let[r,n]of Object.entries(e.timelineAnimations??{}))this.addAnimation(r,n)}addMaterial(e,t){if(t.layers===void 0&&(t={...t,layers:ra.defaultTwoLayerData("phong").layers}),this.materials[e]){let i=this.materials[e];i.reset(t,this.thisContext),i.dispose()}else{let i=nie(t,this.thisContext,e);this.materials[e]=i}}deleteMaterial(e){this.materials[e]&&(this.materials[e].nodeMaterialDispose(),delete this.materials[e])}getMaterial(e){return this.materials[e]}getMaterialOrDeletedPlaceholder(e){return this.materials[e]??this.deletedMaterial}material(e){return typeof e=="string"?this.getMaterialOrDeletedPlaceholder(e):e==null?(console.error("material is undefined or null"),this.deletedMaterial):(e.layers===void 0&&(e={...e,layers:ra.defaultTwoLayerData("phong").layers}),Cbe(e,this.thisContext))}getMaterials(){return this.materials}addImage(e,t){return this.images[e]?(this.onColorOrImageUpdate&&this.onColorOrImageUpdate(),this.images[e].updateSrc(t.data),!0):(this.images[e]=new Nc(t,this),!1)}deleteImage(e){let t=this.images[e];t&&(t.dispose(),delete this.images[e])}getDefaultImage(){return this.images.image_0}getImage(e){return this.images[e]??this.deletedImage}image(e){return typeof e=="string"?this.getImage(e):this.imageHolderCache.load(e)}addUIBuffer(e,t){return this.uiBuffers[e]?(this.onColorOrImageUpdate&&this.onColorOrImageUpdate(),this.uiBuffers[e].updateSrc(t),!0):(this.uiBuffers[e]=new Nc(t,this),!1)}uiBuffer(e){return this.uiBuffers[e]}addVideo(e,t){return this.videos[e]?(this.videos[e].updateSrc(t.data),!0):(this.videos[e]=new Nc(t,this),!1)}deleteVideo(e){let t=this.videos[e];t&&(t.dispose(),delete this.videos[e])}getVideo(e){return this.videos[e]??this.deletedVideo}video(e){return typeof e=="string"?this.getVideo(e):this.imageHolderCache.load(e)}addColor(e,t){return this.colors[e]?(this.onColorOrImageUpdate&&this.onColorOrImageUpdate(),"a"in t?this.colors[e].setRGBA(t.r,t.g,t.b,t.a):this.colors[e].setRGBA(t.r,t.g,t.b,1),!0):(this.colors[e]=new cA(t.r,t.g,t.b,"a"in t?t.a:1),!1)}updateColor(e,t){if(this.colors[e]){this.onColorOrImageUpdate&&this.onColorOrImageUpdate();let i=this.colors[e];return this.colors[e].r=t.r??i.r,this.colors[e].g=t.g??i.g,this.colors[e].b=t.b??i.b,this.colors[e].a=t.a??i.a,!0}return!1}deleteColor(e){this.colors[e]&&delete this.colors[e]}getColor(e){return this.colors[e]}getColorNames(){return Object.values(this.data.colors).map(e=>e.name)}getColorByName(e){for(let t in this.data.colors)if(this.data.colors[t].name===e)return{color:this.colors[t],id:t}}color(e){let t;if(typeof e!="string")return new Fr(e.r,e.g,e.b,"a"in e?e.a:1);{let i=this.getColor(e);i?t=i:(console.warn("Tried to create color layer params with a color key that does not exist in the assets manager"),t=new Fr(0,0,0,0))}return t}addAudio(e,t){this.audios[e]=t}getAudio(e){let t=this.audios[e];if(t instanceof nx)return t;{let i=new nx({src:t.data});return this.audios[e]=i,i}}addParticle(e,t){this.particles[e]=t}getParticle(e){return this.particles[e]}deleteParticle(e){this.particles[e]&&delete this.particles[e]}deleteAudio(e){let t=this.audios[e];t&&(t instanceof nx&&t.dispose(),delete this.audios[e])}addFont(e,t){let i=NX;i!==null?(this.fonts[e]=new i(t),this.fonts[e].loadingPromise.then(()=>this.requestRender())):Ms("text","a font asset")}getFont(e){return this.fonts[e]}deleteFont(e){this.fonts[e]&&delete this.fonts[e]}addAnimation(e,t){this.timelineAnimations[e]=t}getAnimation(e){return this.timelineAnimations[e]}deleteAniamtion(e){this.timelineAnimations[e]&&delete this.timelineAnimations[e]}dispose(){Object.keys(this.materials).forEach(e=>this.deleteMaterial(e)),this._requestRender=void 0,Object.values(this.audios).forEach(e=>{e instanceof nx&&e.dispose()}),this.audios={},this.particles={},this.geometryCache.dispose(),this.geometryCache2.dispose()}addVariableHolder(e,t){if(this.variables[e]===void 0){let i=t.value;if(this.enableLocalStorageForPersistentVariables&&t.persistent){let r=localStorage.getItem(VH(e));i=r!==null?JSON.parse(r):t.value}return this.variables[e]={value:i,locations:[],persistent:t.persistent},"dynamicVariableType"in t&&(this.variables[e].dynamicVariablePlayState="Playing",this.variables[e].dynamicVariableToggleIsForward=void 0),!0}return this.variables[e].value=t.value,!1}resetDynamicVariablePlayState(){for(let e in this.variables)this.variables[e].dynamicVariablePlayState!==void 0&&(this.variables[e].dynamicVariablePlayState="Playing",this.variables[e].dynamicVariableToggleIsForward=void 0)}updateVariableHolder(e,t){this.updateVariable(e,t.value)}updateVariable(e,t){if(this.variables[e]===void 0)return!1;this.variables[e].value=t,this.enableLocalStorageForPersistentVariables&&this.variables[e].persistent&&localStorage.setItem(VH(e),JSON.stringify(t));let i=t;for(;typeof i=="string";)i=this.variables[i].value;let r=this.entityOpContext.scene,n=!1;for(let a=this.variables[e].locations.length-1;a>=0;a--){let s=this.variables[e].locations[a];if(s[0]==="material"){let o=s[1],l=i,h={scene:r,shared:this},u=s.slice(2);r.traverseMaterial(c=>{let p=c.root??c;p.uuid===o&&p.onVariableUpdate(u,l,h)});let d=this.materials[o];d&&d.onVariableUpdate(u,l,h)}else{let o=r.find(s[0]);if(o===void 0){this.variables[e].locations.splice(a,1);continue}if(n=!0,s[1]!=="geometry"&&s[1]!=="particles"){for(let l=1;l<s.length-1;l++)o=o[s[l]];s[1]==="rotation"?o[s[s.length-1]]=i*ht.DEG2RAD:o[s[s.length-1]]=i}if(o=r.find(s[0]),o.type==="ParticleEmitter"&&o.updateVariableState(i,s),hr.is(o))if(s[1]==="position"||s[1]==="rotation"||s[1]==="scale")o.onVariableUpdate();else if(s[1]==="geometry"){let l=o;o.component&&(l=o.component);let h=l.dataPatched;l.chooseGeoemtryCache(this).forceDelete(h.geometry),l.createGeometryDelayed(this.entityOpContext),l.onVariableUpdate(!0),l.invalidateDownstreamBooleanData(),l.instances.forEach(u=>{let d=u.dataPatched;u.chooseGeoemtryCache(this).forceDelete(d.geometry),u.createGeometryDelayed(this.entityOpContext),u.onVariableUpdate(!0),u.invalidateDownstreamBooleanData()})}else s[1]==="morphTargetInfluences"&&o.updateMorphInfluences(s[2],i)}}return n&&r.markShadowsDirty(),this.requestRender(),!0}updateEntityGeometryParams(e,t){let i=e;if(i.component&&(i=i.component),typeof i.chooseGeoemtryCache!="function")return!1;let r=i.dataPatched,n=r?.geometry;if(!n||typeof n.type!="string"||n.type==="VectorGeometry"||n.type==="PathGeometry")return!1;let a=h=>h.toLowerCase().replace(/[\s_.-]+/g,""),s=new Map;for(let h of Object.keys(n))s.set(a(h),h);let o={};for(let[h,u]of Object.entries(t??{})){let d=s.get(a(h));if(d===void 0||d==="type"||d==="font"||d==="shape"||d==="path"||d==="data")continue;if(d==="text"){(typeof u=="string"||typeof u=="number")&&(o[d]={textValue:String(u)});continue}let c=n[d];typeof u=="number"&&isFinite(u)&&(typeof c=="number"||typeof c=="string")&&(o[d]=u)}if(Object.keys(o).length===0)return!1;let l={...n,...o};return i.dataPatched={...r,geometry:l},this.transientGeometryKeys.has(n)&&i.chooseGeoemtryCache(this).forceDelete(r.geometry),this.transientGeometryKeys.add(l),i.createGeometryDelayed(this.entityOpContext),i.onVariableUpdate(!0),i.invalidateDownstreamBooleanData(),this.entityOpContext.scene.markShadowsDirty(),this.requestRender(),!0}resetEntityGeometryParams(e){let t=e;if(t.component&&(t=t.component),typeof t.chooseGeoemtryCache!="function")return!1;let i=t.dataPatched?.geometry;return!(!i||!this.transientGeometryKeys.has(i)||(t.dataPatched=t.data,t.chooseGeoemtryCache(this).forceDelete(i),t.createGeometryDelayed(this.entityOpContext),t.onVariableUpdate(!0),t.invalidateDownstreamBooleanData(),this.entityOpContext.scene.markShadowsDirty(),this.requestRender(),0))}updateEntityGeometryVertices(e,t){let i=e;if(i.component&&(i=i.component),typeof i.chooseGeoemtryCache!="function")return!1;let r=i.dataPatched,n=r?.geometry;if(!n||n.type!=="NonParametricGeometry")return!1;let a=t?.vertices;if(a===void 0||typeof a.length!="number"||a.length<9||a.length%3!=0||a.length/3>die.MAX_TRANSIENT_VERTICES)return!1;let s,o,l,h=a instanceof Float32Array?a:Float32Array.from(a),u=h.length/3;if(t.normals!==void 0){if(t.normals.length!==h.length)return!1;s=t.normals instanceof Float32Array?t.normals:Float32Array.from(t.normals)}if(t.uvs!==void 0){if(t.uvs.length!==2*u)return!1;o=t.uvs instanceof Float32Array?t.uvs:Float32Array.from(t.uvs)}if(t.indices!==void 0){let x=u>65535?Uint32Array.from(t.indices):Uint16Array.from(t.indices);if(x.length===0||x.length%3!=0)return!1;for(let w=0;w<x.length;w++)if(x[w]>=u)return!1;l={array:x,itemSize:1,type:x.constructor.name,normalized:!1}}else{let x=n.data,w=x?.index;if(w?.array?.length){if(u<(x?.attributes?.position?.array?.length??0)/3){let S=w.array;for(let M=0;M<S.length;M++)if(S[M]>=u)return!1}l=w}}let d=1/0,c=1/0,p=1/0,m=-1/0,f=-1/0,g=-1/0;for(let x=0;x<h.length;x+=3){let w=h[x],S=h[x+1],M=h[x+2];w<d&&(d=w),w>m&&(m=w),S<c&&(c=S),S>f&&(f=S),M<p&&(p=M),M>g&&(g=M)}let v=(x,w)=>({array:x,itemSize:w,type:"Float32Array",normalized:!1}),y={position:v(h,3)};s&&(y.normal=v(s,3)),o&&(y.uv=v(o,2));let _={...n,width:m-d,height:f-c,depth:g-p,data:{attributes:y,...l?{index:l}:{}}},b=this.transientGeometryKeys.has(n);return i.dataPatched={...r,geometry:_},this.transientGeometryKeys.add(_),i.applyTransientGeometryData(this.entityOpContext,b),i.onVariableUpdate(!0),i.invalidateDownstreamBooleanData(),this.entityOpContext.scene.markShadowsDirty(),this.requestRender(),!0}setEntityInstanceTransforms(e,t){let i=e;i.component&&(i=i.component);let r=i.cloner;if(r===void 0)return-1;let n=r.children,a=Math.PI/180,s=!1;if(t===null)for(let o of n)o.transformOverride!==void 0&&(o.transformOverride=void 0,s=!0);else{if(!Array.isArray(t))return n.length;{let o=Math.min(t.length,n.length);for(let l=0;l<o;l++){let h=t[l],u=n[l];if(h==null){u.transformOverride!==void 0&&(u.transformOverride=void 0,s=!0);continue}let d=u.transformOverride??{position:[u.position.x,u.position.y,u.position.z],rotation:[u.rotation.x,u.rotation.y,u.rotation.z],scale:[u.scale.x,u.scale.y,u.scale.z]};h.position&&(typeof h.position.x=="number"&&(d.position[0]=h.position.x),typeof h.position.y=="number"&&(d.position[1]=h.position.y),typeof h.position.z=="number"&&(d.position[2]=h.position.z)),h.rotation&&(typeof h.rotation.x=="number"&&(d.rotation[0]=h.rotation.x*a),typeof h.rotation.y=="number"&&(d.rotation[1]=h.rotation.y*a),typeof h.rotation.z=="number"&&(d.rotation[2]=h.rotation.z*a)),h.scale&&(typeof h.scale.x=="number"&&(d.scale[0]=h.scale.x),typeof h.scale.y=="number"&&(d.scale[1]=h.scale.y),typeof h.scale.z=="number"&&(d.scale[2]=h.scale.z)),u.transformOverride=d,u.position.fromArray(d.position),u.rotation.fromArray(d.rotation),u.scale.fromArray(d.scale),u.updateMatrix(),u.hasNonUniformScale&&(u.updateMatrixWorld(),u.updateMatrixWorldRigid())}}}return s?r.update(this.entityOpContext):r.syncInstanceMatrices(),r.invalidateTransform(i),this.entityOpContext.scene.markShadowsDirty(),this.requestRender(),n.length}spawnRuntimeClone(e,t={}){if(typeof e.entityChildren!="function")return;let i=e.parent;if(i===null)return;let r=new Dh(e);r.playModeVisible=t.visible!==!1,r.expand(),typeof t.name=="string"&&(r.name=t.name);let n=Math.PI/180;return r.position.copy(e.position),r.rotation.copy(e.rotation),r.scale.copy(e.scale),r.hiddenMatrix.copy(e.hiddenMatrix),t.position&&(typeof t.position.x=="number"&&(r.position.x=t.position.x),typeof t.position.y=="number"&&(r.position.y=t.position.y),typeof t.position.z=="number"&&(r.position.z=t.position.z)),t.rotation&&(typeof t.rotation.x=="number"&&(r.rotation.x=t.rotation.x*n),typeof t.rotation.y=="number"&&(r.rotation.y=t.rotation.y*n),typeof t.rotation.z=="number"&&(r.rotation.z=t.rotation.z*n)),t.scale&&(typeof t.scale.x=="number"&&(r.scale.x=t.scale.x),typeof t.scale.y=="number"&&(r.scale.y=t.scale.y),typeof t.scale.z=="number"&&(r.scale.z=t.scale.z)),r.updateMatrix(),i.add(r),r.updateWorldMatrix(!0,!0),this.entityOpContext.scene.markShadowsDirty(),this.requestRender(),r}destroyRuntimeClone(e){e.removeFromParent(),this.entityOpContext.scene.markShadowsDirty(),this.requestRender()}updateEntityMaterialParams(e,t){let i=e.material;if(!i)return!1;let r=[];for(let h of Array.isArray(i)?i:[i]){let u=h.root??h;u&&Array.isArray(u.layers)&&u.data&&!r.includes(u)&&r.push(u)}if(r.length===0)return!1;let n={scene:this.entityOpContext.scene,shared:this},a=h=>h.toLowerCase().replace(/[\s_.-]+/g,""),s=h=>{if(typeof h=="string"){let u=new Fr(1,1,1,1);try{u.set(h)}catch{return null}return{r:u.r,g:u.g,b:u.b,a:void 0}}if(h&&typeof h=="object"&&"r"in h){let u=h;if([u.r,u.g,u.b].some(c=>typeof c!="number"||!isFinite(c)))return null;let d=Math.max(u.r,u.g,u.b)>1?1/255:1;return{r:u.r*d,g:u.g*d,b:u.b*d,a:typeof u.a=="number"?Math.max(0,Math.min(u.a,1)):void 0}}return null},o=(h,u,d)=>{if(!h.hasValue(u))return!1;let c=h.getValue(u);if(!c||typeof c!="object"||!c.isColor)return!1;let p=d.a??(typeof c.a=="number"?c.a:1);return c instanceof cA?h.setValue(u,new Fr(d.r,d.g,d.b,p)):typeof c.setRGBA=="function"?c.setRGBA(d.r,d.g,d.b,p):c.setRGB(d.r,d.g,d.b),!0},l=!1;for(let h of r){let u=h.data.layers??[],d=c=>h.layers.find(p=>p.uuid===c);if(t.color!==void 0){let c=s(t.color),p=u.find(f=>f.data.type==="color"),m=p&&d(p.id);if(c&&m&&o(m,"color",c)&&(l=!0,c.a!==void 0)){let f=c.a<1||Td(h.data,this);h.setTransparent?h.setTransparent(f,n.scene):h.transparent=f}}typeof t.alpha=="number"&&isFinite(t.alpha)&&(h.onVariableUpdate?.(["alphaOverride"],Math.max(0,Math.min(t.alpha,100)),n),l=!0);for(let c of t.layers??[]){if(!c||typeof c!="object")continue;let p=typeof c.id=="string"?u.find(v=>v.id===c.id):typeof c.index=="number"?u[c.index]:typeof c.type=="string"?u.find(v=>v.data.type===c.type):void 0,m=p&&d(p.id);if(!p||!m)continue;let f=Mw[p.data.type]??[],g=Object.keys(p.data);for(let[v,y]of Object.entries(c)){if(v==="id"||v==="index"||v==="type")continue;let _=g.find(x=>x===v)??g.find(x=>a(x)===a(v))??v;if(f.includes(_))continue;let b=s(y);if(b&&o(m,_,b))l=!0;else if(typeof y=="number"&&isFinite(y))h.onVariableUpdate?.(["layer",p.id,_],y,n),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)=>{h.onVariableUpdate?.(["layer",p.id,_,x[S]],w,n)}),l=!0}}}}return l&&this.requestRender(),l}deleteVariable(e){this.variables[e]&&delete this.variables[e]}getVariable(e,t){if(Array.isArray(e)){if(e[0]==="mouse")return this.mouseProperty?.[e[1]]??0;if(e[0]==="raycast")return this.raycastProperty?.[e[1]]??0;let i=this.entityOpContext.scene.find(e[0]);if(e[1]==="width"||e[1]==="height"||e[1]==="depth")return i.geometry.userData.parameters[e[1]];if((e[1]==="position"||e[1]==="rotation")&&e.length>2&&i?.getPhysicsLocalMatrix?.(jF))return jF.decompose(HF,WF,hie),e[1]==="position"?HF[e[2]]:(qF.setFromQuaternion(WF,i.rotation.order),qF[e[2]]*ht.RAD2DEG);for(let r=1;r<e.length;r++)i=i[e[r]];return e[1]==="rotation"&&(i*=ht.RAD2DEG),i}for(let i in this.variables){if(t===void 0)break;let r=this.variables[i],n=r.locations?.findIndex(a=>Ts.equal(a,t));n!==void 0&&n!==-1&&r.locations.splice(n,1)}if(typeof e=="string"){let i=e,r=e;do{if(r=i,this.variables[i]===void 0)break;let n=this.variables[i].value;t&&this.variables[r]!==void 0&&this.variables[r].locations.push(t),i=n}while(typeof i=="string");return i}return e}getVariables(){return this.variables}getVariablesNames(){return this.data.variables.map(e=>e.data.name)}getVariableByName(e){for(let t of this.data.variables)if(t.data.name===e)return{variable:t.data,id:t.id}}getDynamicVariablePlayState(e){return this.variables[e]?.dynamicVariablePlayState}setDynamicVariablePlayState(e,t){this.variables[e]!==void 0&&(this.variables[e].dynamicVariablePlayState=t)}getDynamicVariableToggleIsForward(e){return this.variables[e]?.dynamicVariableToggleIsForward}setDynamicVariableToggleIsForward(e,t){this.variables[e]!==void 0&&(this.variables[e].dynamicVariableToggleIsForward=t)}resetLib(e){for(let[t,i]of Object.entries(e.images))this.addImage(t,i.asset);for(let[t,i]of Object.entries(e.audios))this.addAudio(t,i.asset);for(let[t,i]of Object.entries(e.particles))this.addParticle(t,i.asset);for(let[t,i]of Object.entries(e.colors))this.addColor(t,i.asset);for(let[t,i]of Object.entries(e.fonts))this.addFont(t,i.asset);for(let[t,i]of Object.entries(e.videos))this.addVideo(t,i.asset);for(let[t,i]of Object.entries(e.variables))this.addVariableHolder(t,i.asset)}updateLibByOp(e,t){e.path[0]==="images"?e.path.length===1&&e.type===1?this.addImage(e.id,e.data.asset):e.path.length===1&&e.type===2&&this.deleteImage(e.id):e.path[0]==="videos"?e.path.length===1&&e.type===1?this.addVideo(e.id,e.data.asset):e.path.length===1&&e.type===2&&this.deleteVideo(e.id):e.path[0]==="audios"?e.path.length===1&&e.type===1?this.addAudio(e.id,e.data.asset):e.path.length===1&&e.type===2&&this.deleteAudio(e.id):e.path[0]==="particles"?e.path.length===1&&e.type===1?this.addParticle(e.id,e.data.asset):e.path.length===1&&e.type===2&&this.deleteParticle(e.id):e.path[0]==="colors"?e.path.length===1&&e.type===1?this.addColor(e.id,e.data.asset):e.path.length===1&&e.type===2&&this.deleteColor(e.id):e.path[0]==="materials"?e.path.length===1&&e.type===1?this.addMaterial(e.id,e.data.asset):e.path.length===1&&e.type===2&&this.deleteMaterial(e.id):e.path[0]==="fonts"?e.path.length===1&&e.type===1?this.addFont(e.id,e.data.asset):e.path.length===1&&e.type===2&&this.deleteFont(e.id):e.path[0]==="variables"?e.path.length===1&&e.type===1?this.addVariableHolder(e.id,e.data.asset):e.path.length===1&&e.type===2&&this.deleteVariable(e.id):e.path[0]==="components"&&t.updateByLibOp(e,this)}updateByOp(e,t,i){if(this.data=t,e.path[0]==="images")e.path.length===2&&e.type===0?e.props.data&&this.getImage(e.path[1]).updateSrc(e.props.data):e.path.length===1&&e.type===1?this.addImage(e.id,e.data):e.path.length===1&&e.type===2&&this.deleteImage(e.id);else if(e.path[0]==="videos")e.path.length===2&&e.type===0?e.props.data&&this.getVideo(e.path[1]).updateSrc(e.props.data):e.path.length===1&&e.type===1?this.addVideo(e.id,e.data):e.path.length===1&&e.type===2&&this.deleteVideo(e.id);else if(e.path[0]==="audios")e.path.length===2&&e.type===0?e.props.data&&this.addAudio(e.path[1],t.audios[e.path[1]]):e.path.length===1&&e.type===1?this.addAudio(e.id,e.data):e.path.length===1&&e.type===2&&this.deleteAudio(e.id);else if(e.path[0]==="particles")e.path.length===2&&e.type===0?e.props.data&&this.addParticle(e.path[1],t.particles[e.path[1]]):e.path.length===1&&e.type===1?this.addParticle(e.id,e.data):e.path.length===1&&e.type===2&&this.deleteParticle(e.id);else if(e.path[0]==="colors")e.path.length===2&&e.type===0?this.updateColor(e.path[1],e.props):e.path.length===1&&e.type===1?this.addColor(e.id,e.data):e.path.length===1&&e.type===2&&this.deleteColor(e.id);else if(e.path[0]==="materials")e.path.length===1&&e.type===1?this.addMaterial(e.id,e.data):e.path.length===1&&e.type===2?this.deleteMaterial(e.id):e.path.length>1&&this.getMaterial(e.path[1]).updateByOp($s.drop(e,2),t.materials[e.path[1]],{shared:this,scene:i});else if(e.path[0]==="fonts")e.path.length===2&&e.type===0?this.updateFont(e.path[1],e,i):e.path.length===1&&e.type===1?this.addFont(e.id,e.data):e.path.length===1&&e.type===2&&this.deleteFont(e.id);else if(e.path[0]==="variables")e.path.length===2&&e.type===0?"value"in e.props?this.updateVariable(e.path[1],e.props.value):"persistent"in e.props&&(this.variables[e.path[1]].persistent=e.props.persistent):e.path.length===1&&e.type===4?this.addVariableHolder(e.id,e.data):e.path.length===1&&e.type===5&&this.deleteVariable(e.id);else if(e.path[0]==="userAPIs"){if(e.path.length===1&&e.type===1)this.addUserAPI(e.id,e.data);else if(e.path.length===1&&e.type===2)this.deleteUserAPI(e.id);else if(typeof e.path[1]=="string"){let r=t.userAPIs[e.path[1]];if(r){let n=e.type===0&&e.props.debounce===void 0,a=this.getUserAPI(e.path[1]);a!==void 0&&a===this.openAIRealtime?a.update(r):a?.update(r,this,n)}}}else if(e.path[0]==="userWebhooks"){if(e.path.length===1&&e.type===1)this.addUserWebhook(e.id,e.data);else if(e.path.length===1&&e.type===2)this.deleteUserWebhook(e.id);else if(typeof e.path[1]=="string"){let r=t.userWebhooks[e.path[1]];r&&this.getUserWebhook(e.path[1])?.update(r)}}else e.path[0]==="lib"&&this.updateLibByOp($s.drop(e,1),i)}updateFont(e,t,i){if(t.props.url){let r=this.getFont(e),n={...this.data.fonts[e],url:t.props.url};r.update(n),r.loadingPromise.then(()=>this.requestRender()),i.updateFont(e,this)}}addUserAPI(e,t){if(this.userAPIs[e])return this.userAPIs[e].update(t,this),!0;if(this.openAIRealtime?.id===e)return this.openAIRealtime.update(t),!0;if(t.integration?.type==="VoiceAssistant"){let i=jX;return i===null?(Ms("ai-assistant","a voice-assistant integration"),!1):(this.openAIRealtime=i(t,e,this),!1)}{let i=lie();return i===null?(Ms("api-services","a user API integration"),!1):(this.userAPIs[e]=i.createUserAPI(e,t,this),!1)}}getUserAPI(e){return this.openAIRealtime?.id===e?this.openAIRealtime:this.userAPIs[e]}getUserAPIs(){return this.userAPIs}deleteUserAPI(e){let t=this.userAPIs[e];t&&(t.dispose(),delete this.userAPIs[e])}addUserWebhook(e,t){if(this.userWebhooks[e])return this.userWebhooks[e].update(t),!0;{let i=lie();return i===null?(Ms("api-services","a user webhook"),!1):(this.userWebhooks[e]=i.createUserWebhook(e,t),!1)}}getUserWebhook(e){return this.userWebhooks[e]}getUserWebhooks(){return this.userWebhooks}deleteUserWebhook(e){let t=this.userWebhooks[e];t&&(t.dispose(),delete this.userWebhooks[e])}get scene(){return this.entityOpContext.scene}}).MAX_TRANSIENT_VERTICES=6e4,new gL(gu.emptyData())});function Nbe(e){return lL(e)||e?.isTSLNodeMaterial===!0}var bl,$F,XF,YF,cie,KF,An,Ibe=k(()=>{PX()}),c1=k(()=>{$t(),io(),Ym(),Ibe(),Nr(),Js(),bl=class extends Sa{setMaterialOverride(e,t){this.materialOverride=aie(e),this.material!==this.shadowCatcherMaterial&&(this.disposeMaterial(),this.material=this.materialOverride,this.layers.set(0),this.syncShapeBlendNodeLayer(),t.scene.markNeedsUpdateRendererDirty())}updateByPatchedOp(e,t,i){if(super.updateByPatchedOp(e,t,i),Qr(e.path,["geometry"])&&this.syncShadowCatcher(i),function(r,n){let a=[];if(n.length!==r.length)return null;{let s=0;for(;s<r.length;){if(n[s]==="*")a.push(r[s]);else if(r[s]!==n[s])return null;s+=1}}return a}(e.path,["materials"])!==null&&e.type===0&&Array.isArray(this.material))for(let[r,n]of Object.entries(e.props)){let a=this.material[Number(r)],s=i.shared.material(n);s!==a&&bl.disposeOneMaterial(a),this.material[Number(r)]=s}else if(Qr(e.path,["material"])){let r=this.material;!Array.isArray(r)&&typeof r?.updateByOp=="function"&&"material"in t&&typeof t.material!="string"&&r.updateByOp($s.drop(e,1),t.material,i)}else if(Qr(e.path,["materials","*"])&&Array.isArray(this.material)){let r=e.path[1];if("materials"in t&&r<this.material.length){let n=t.materials[r];typeof n!="string"&&this.material[r].updateByOp($s.drop(e,2),n,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(e,t){super.updateState(e,t),e.castShadow!==void 0&&(this.castShadow=e.castShadow),e.receiveShadow!==void 0&&(this.receiveShadow=e.receiveShadow);let i,r=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 n=this.materialOverride!==void 0;!n&&e.geometry?.type!=="NonParametricGeometry"&&"material"in e&&e.material!==void 0&&(this.disposeMaterial(),this.material=t.shared.material(e.material).getFlavor(r.flatShading,r.side,r.wireframe,i),t.scene.markNeedsUpdateRendererDirty()),!n&&(e.geometry?.type==="NonParametricGeometry"||"materials"in e)&&("materials"in e&&e.materials!==void 0?(this.disposeMaterial(),this.material=e.materials.map(s=>t.shared.material(s).getFlavor(r.flatShading,r.side,r.wireframe)),t.scene.markNeedsUpdateRendererDirty()):"material"in e&&e.material!==void 0&&(this.disposeMaterial(),this.material=[t.shared.material(e.material).getFlavor(r.flatShading,r.side,r.wireframe)],t.scene.markNeedsUpdateRendererDirty()));let a=this.data;if(!n&&a.geometry?.type!=="NonParametricGeometry"&&"materials"in a&&a.materials!==void 0&&(this.disposeMaterial(),this.material=t.shared.material(a.materials[0]).getFlavor(r.flatShading,r.side,r.wireframe)),!n&&(e.flatShading!==void 0||e.wireframe!==void 0||e.side!==void 0))if(Array.isArray(this.material))for(let s=0;s<this.material.length;s++)this.material[s]=this.material[s].getFlavor(r.flatShading,r.side,r.wireframe);else this.material=this.material.getFlavor(r.flatShading,r.side,r.wireframe,i);this.syncShadowCatcher(t)}shadowCatcherActive(){let e=this.dataPatched,t=e.geometry?.type;return e.shadowCatcher===!0&&(t==="RectangleGeometry"||t==="PlaneGeometry")}syncShadowCatcher(e){let t=this.dataPatched;if(this.shadowCatcherActive()){if(this.shadowCatcherMaterial===void 0){let i=function(){let r=NA==="webgpu"&&FH!==void 0?FH:Pbe;return r===void 0?null:aie(r())}();if(i===null)return;this.shadowCatcherMaterial=i}this.shadowCatcherMaterial.side=t.side,this.material!==this.shadowCatcherMaterial&&(this.disposeMaterial(),this.material=this.shadowCatcherMaterial,e.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,e.scene.markNeedsUpdateRendererDirty()):"material"in t&&t.material!==void 0&&(this.material=e.shared.material(t.material).getFlavor(t.flatShading,t.side,t.wireframe),e.scene.markNeedsUpdateRendererDirty(),this.needsAO&&this.layers.enable(5)),this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow)}static disposeOneMaterial(e){var t;Nbe(e)&&!function(i){return i?.isClassicSharedMaterial===!0}(t=e)&&t?.isTSLSharedMaterial!==!0&&e.nodeMaterialDispose()}disposeMaterial(){this.material&&y1e(this.material).forEach(e=>{bl.disposeOneMaterial(e)})}dispose(){this.disposeMaterial(),this.shadowCatcherMaterial?.dispose(),super.dispose()}}}),th=k(()=>{$t(),Nr(),WX(),c1(),le(),F4(),Tw(),Sbe(),$F=new D,XF=new pt,YF=new pt,cie=new D,KF=new ke,An=class extends bl{constructor(e,t,i){super(e,t),this.data=t,this.isSkinnedMesh=!1,this.localGeometry=void 0,t.bindMode&&t.bindMatrix&&(this.bindMode=t.bindMode,this.bindMatrix=new ke().fromArray(t.bindMatrix),this.bindMatrixInverse=new ke)}chooseGeoemtryCache(e){return e.geometryCache}supportsInPlaceGeometryUpdate(e){return e.isTextGeometry!==!0}markGeometryAsReachable(e){this.geometryCreateDeleyed instanceof At&&this.chooseGeoemtryCache(e).markAsReachable(this.dataPatched.geometry,this.geometryCreateDeleyed)}get builtSharedGeometry(){if(this.localGeometry===void 0)return this.geometryCreateDeleyed instanceof At?this.geometryCreateDeleyed:void 0}get geometry(){if(this.localGeometry!==void 0)return this.localGeometry;if(this.geometryCreateDeleyed instanceof gL){let e=this.geometryCreateDeleyed,t=this.chooseGeoemtryCache(e),i=this.dataPatched.geometry;this.geometryCreateDeleyed=t.get(i,e,this),this._geometryCacheKey=i}return this.geometryCreateDeleyed}set geometry(e){this.localGeometry=e}get is2DAndNoDepth(){let e=this.dataPatched.geometry;return KO.is2DParametricMesh(e.type)&&e.depth===0}get is2DType(){return KO.is2DParametricMesh(this.geometry.userData.type)}get isNonParametric(){return this.geometry.userData.type==="NonParametricGeometry"}updateByPatchedOp(e,t,i){super.updateByPatchedOp(e,t,i),Qr(e.path,["geometry"])&&this.updateByPatchedOpGeometry($s.drop(e,1),t.geometry,i)}removeInteractionGeometry(e){this.localGeometry?.dispose(),this.localGeometry=void 0}updateGeometryInteractions(e,t){this.invalidateDownstreamBooleanData();let i=this.data.geometry.type;if(i==="NonParametricGeometry"||i==="SubdivGeometry"){let r,n,a,s=e;if(this.localGeometry===void 0){let d={...this.data.geometry,...s};this.localGeometry=Ng(d,t,this.data.flatShading,this)}s.scaleBaked?[r,n,a]=s.scaleBaked:{width:r,height:n,depth:a}=s;let o=this.localGeometry.userData,l=typeof r=="number"?r:1,h=typeof n=="number"?n:1,u=typeof a=="number"?a:1;o.sxPrev!==void 0&&DH(this.localGeometry.attributes,l/o.sxPrev,h/o.syPrev,u/o.szPrev),o.sxPrev=l,o.syPrev=h,o.szPrev=u}else{let r=Ng({...this.data.geometry,...e},t,this.data.flatShading,this);this.localGeometry!==void 0&&this.supportsInPlaceGeometryUpdate(this.localGeometry)&&zF(this.localGeometry,r)?r.dispose():(this.localGeometry?.dispose(),this.localGeometry=r)}}refreshAttachedClonersInteractions(e){for(let t of this.attachedSurfaceCloners)t.update(e)}refreshAttachedCloners(e){for(let t of this.attachedSurfaceCloners)e.scene.addPendingUpdateCloner(t.object)}refreshAttachedPaths(e){for(let t of this.attachedPaths)e.scene.addPendingCommand(()=>t.updateShape())}createGeometryDelayed(e){this.geometryCreateDeleyed=e.shared,this.refreshAttachedCloners(e),this.refreshAttachedPaths(e)}updateByPatchedOpGeometry(e,t,i){let r=!1;if(e.type===0&&e.path.length===0&&Object.keys(e.props).includes("scaleBaked")&&this.geometryCreateDeleyed instanceof ua&&this.chooseGeoemtryCache(i.shared).mutateIfUnique(this.geometryCreateDeleyed.data,t)===this.geometryCreateDeleyed&&(r=!0,this.geometryCreateDeleyed.mutateDirectlyScaleBaked(t,e.props.scaleBaked),this.refreshAttachedCloners(i),this.refreshAttachedPaths(i)),!r&&e.type===0&&e.path.length===0&&Tbe(e.props)&&this.geometryCreateDeleyed instanceof ua&&this.chooseGeoemtryCache(i.shared).mutateIfUnique(this.geometryCreateDeleyed.data,t)===this.geometryCreateDeleyed&&(r=!0,this.geometryCreateDeleyed.mutateDirectlySubdivisions(t),this.refreshAttachedCloners(i),this.refreshAttachedPaths(i)),!r&&e.type===0&&e.path.length===0&&this.geometryCreateDeleyed instanceof At&&!(this.geometryCreateDeleyed instanceof ua)&&this.supportsInPlaceGeometryUpdate(this.geometryCreateDeleyed)&&this._geometryCacheKey!==void 0){let n=i.shared,a=this.chooseGeoemtryCache(n),s=this.geometryCreateDeleyed;if(a.getCached(this._geometryCacheKey)===s&&s.isShared!==!0){let o=this.dataPatched.geometry,l=Ng(o,n,this.data.flatShading,this);zF(s,l)?(l.dispose(),s.computeBoundingSphere(),a.mutateIfUnique(this._geometryCacheKey,o)):(l.computeBoundingSphere(),a.forceDelete(this._geometryCacheKey),a.adopt(o,l),this.geometryCreateDeleyed=l),this._geometryCacheKey=o,r=!0,this.refreshAttachedCloners(i),this.refreshAttachedPaths(i)}}r||(i.scene?.markGeometryCacheDirty(),this.createGeometryDelayed(i)),this.syncShapeBlendNodeLayer(),this.resetBBoxNeedsUpdate(),this.invalidateDownstreamBooleanData()}updateGeometryOnStateUpdate(e,t){this.createGeometryDelayed(t)}applyTransientGeometryData(e,t){let i=e.shared,r=this.dataPatched.geometry;if(this.geometryCreateDeleyed instanceof At&&!(this.geometryCreateDeleyed instanceof ua)&&this.supportsInPlaceGeometryUpdate(this.geometryCreateDeleyed)&&this._geometryCacheKey!==void 0){let n=this.chooseGeoemtryCache(i),a=this.geometryCreateDeleyed;if(n.getCached(this._geometryCacheKey)===a&&a.isShared!==!0){let s=Ng(r,i,this.data.flatShading,this);return zF(a,s)?(s.dispose(),a.computeBoundingSphere(),n.mutateIfUnique(this._geometryCacheKey,r)):(s.computeBoundingSphere(),n.forceDelete(this._geometryCacheKey),n.adopt(r,s),this.geometryCreateDeleyed=s),this._geometryCacheKey=r,this.refreshAttachedCloners(e),void this.refreshAttachedPaths(e)}}t&&this._geometryCacheKey!==void 0&&this.chooseGeoemtryCache(i).forceDelete(this._geometryCacheKey),e.scene?.markGeometryCacheDirty(),this.createGeometryDelayed(e)}updateState(e,t){e.geometry!==void 0&&this.updateGeometryOnStateUpdate(e.geometry,t);let i=e.morphTargetInfluences;if(i){this.updateMorphTargets(),this.geometry.morphTargetsRelative=!0;for(let{data:{name:r,value:n}}of i)this.updateMorphInfluences(r,t.shared.getVariable(n,[this.uuid,"morphTargetInfluences",r]))}super.updateState(e,t)}updateMorphInfluences(e,t){if(this.morphTargetDictionary===void 0)return;let i=this.morphTargetDictionary[e];i!==void 0&&(this.morphTargetInfluences[i]=t)}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(e,t){let i=this.geometry.userData.parameters;this.is2DType?e.set(0,0,.5*i.depth):this.isNonParametric?(e.setScalar(0),this.geometry.boundingSphere&&e.copy(this.geometry.boundingSphere.center),t.set(i.width,i.height,i.depth??0).multiplyScalar(.5)):i.centerOffset?e.fromArray(i.centerOffset):e.setScalar(0),t.set(i.width,i.height,i.depth??0).multiplyScalar(.5)}updateMatrixWorld(e){super.updateMatrixWorld(e),this.bindMode==="attached"?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode==="detached"&&this.bindMatrixInverse.copy(this.bindMatrix).invert()}bind(e,t){this.skeleton=e,this.isSkinnedMesh=!0,t===void 0&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),t=this.matrixWorld),this.bindMatrix.copy(t),this.bindMatrixInverse.copy(t).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(e){let t=new pt,i=this.geometry.attributes.skinWeight;for(let r=0,n=i.count;r<n;r++){t.fromBufferAttribute(i,r);let a=1/t.manhattanLength();a!==1/0?t.multiplyScalar(a):t.set(1,0,0,0),i.setXYZW(r,t.x,t.y,t.z,t.w)}}boneTransform(e,t){let i=this.skeleton;if(i===void 0)return;let r=this.geometry;XF.fromBufferAttribute(r.attributes.skinIndex,e),YF.fromBufferAttribute(r.attributes.skinWeight,e),$F.copy(t).applyMatrix4(this.bindMatrix),t.set(0,0,0);for(let n=0;n<4;n++){let a=YF.getComponent(n);if(a!==0){let s=XF.getComponent(n);KF.multiplyMatrices(i.bones[s].matrixWorld,i.boneInverses[s]),t.addScaledVector(cie.copy($F).applyMatrix4(KF),a)}}return t.applyMatrix4(this.bindMatrixInverse)}}});function Cx(e){if(Array.isArray(e.material)){for(let t of e.material)if(t.getLayersOfType("outline").length===0)return}else if(!lL(e.material)||e.material.getLayersOfType("outline").length===0)return;e instanceof An&&e.is2DAndNoDepth?function(t){if(t.geometry.attributes.extrudeNormals||!t.geometry.attributes.position)return;let i=t.geometry.attributes.position.array,r=new Float32Array(i.length),n=new D;for(let a=0;a<i.length;a+=3)n.set(i[a],i[a+1],i[a+2]).normalize(),r[a]=n.x,r[a+1]=n.y,r[a+2]=n.z;t.geometry.setAttribute("extrudeNormal",new Et(r,3))}(e):function(t){if(t.geometry.attributes.extrudeNormal||!t.geometry.attributes.position||!t.geometry.attributes.normal)return;let i=new Map,r=t.geometry.attributes,n=r.position.array,a=r.normal.array,s=new Float32Array(n.length);for(let o=0;o<n.length;o+=3){let l=`${n[o]}_${n[o+1]}_${n[o+2]}`,h=new D(a[o],a[o+1],a[o+2]);i.has(l)?i.get(l)?.normals.push(h):i.set(l,{normals:[h],result:new D})}i.forEach((o,l)=>{for(let h of o.normals)o.result.add(h);o.result.divideScalar(o.normals.length)});for(let o=0;o<n.length;o+=3){let l=`${n[o]}_${n[o+1]}_${n[o+2]}`,h=i.get(l)?.result;h&&(s[o]=h.x,s[o+1]=h.y,s[o+2]=h.z)}t.geometry.setAttribute("extrudeNormal",new Et(s,3))}(e)}function ZF(e){return Math.min(2047,Math.max(1,Math.round(2048*e)))/2048}function Px(e){if(!e.geometry.attributes.position)return;let t=e.geometry.attributes,i=t.position.array,r=t.randomColor;if(r!==void 0&&3*r.count===i.length)return;let n=new Float32Array(i.length),a=parseInt(e.uuid.replace(/\D/g,"")),s=[ZF(ht.seededRandom(a)),ZF(ht.seededRandom(a+1e4)),ZF(ht.seededRandom(a+2e4))];for(let o=0;o<i.length;o++)n[o]=s[o%3];e.geometry.setAttribute("randomColor",new It(n,3))}var V4=k(()=>{le(),PX(),th()});function pie(e){let t=!1;return e.scene.objects.traverse((i,r)=>{r.geometry?.type==="BooleanGeometry"&&(t=!0)}),t}function BOe(e,t){let i=e.cloner;return i!==void 0&&i.parent===t?i:void 0}function mie(e,t,i,r){let n=16*(t.children.length+1);AM.length<n&&(AM=new Float32Array(n));let a=0,s=l=>{l.toArray(AM,16*a),a++},o=t.parameters.hideBase!==!0;o&&s(r),kH.multiplyMatrices(e.hiddenMatrix,e.matrix);for(let l of t.children)!ny(l)||l.playModeVisible===!1||(GH.multiplyMatrices(l.hiddenMatrix,l.matrix).multiply(l.pivotMatrix),hI.multiplyMatrices(kH,GH),(!o||!hI.equals(r))&&s(hI));try{return a===0?0:function(l,h){return AX(oL().instanced_union(EX(l),h))}(i,AM.subarray(0,16*a))}finally{E_e(i)}}var dp,fie,kH,GH,hI,AM,zg,vL,k4,_d,Vc,yL,IA=k(()=>{io(),le(),I4(),V4(),c1(),sa(),dp=new ke,fie=new ke,kH=new ke,GH=new ke,hI=new ke,AM=new Float32Array(0),zg=class extends bl{constructor(e,t,i){super(e,t),this.data=t,this.meshSetAddresses=[],this.needsTransformForDownstream=!1,this.geometry=new At,this.onAfterRender=(r,n,a,s,o,l)=>{super.onAfterRender(r,n,a,s,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(e,t,i){super.updateByPatchedOp(e,t,i),e.path.length===1&&e.path[0]==="geometry"&&e.type===0&&e.props.operation!==void 0&&(this.freeBooleanPointer(),this.resetBBoxNeedsUpdate())}freeBooleanPointer(){super.freeBooleanPointer(),this.geometry.dispose()}recomputeBoolean(e,t=!0){if(this.booleanMeshSetAddress!==-1&&!e)return;for(let r=0;r<this.children.length;r++){let n=this.children[r];n instanceof zg&&n.dataPatched.visible===!0&&n.recomputeBoolean(e===!0,t)}this.meshSetAddresses=[];for(let r=0;r<this.children.length;r++){let n=this.children[r];if(n instanceof Sa&&n.dataPatched.visible===!0&&n.geometry.attributes.position?.count>0&&n.geometry.drawRange.count>0&&n.booleanMeshSetAddress!==0){dp.multiplyMatrices(n.hiddenMatrix,n.matrix).multiply(n.pivotMatrix);try{let a=BOe(n,this);if(n.booleanMeshSetAddress===-1){if((n.geometry.index??n.geometry.getAttribute("position")).count/3<15e5){let s=nOe(n.geometry,e===!0);n.booleanMeshSetAddress=a===void 0||s===-1?s:mie(n,a,s,dp)}if(n.booleanMeshSetAddress===-1)return;a===void 0&&CF(n.booleanMeshSetAddress,dp),n.booleanMatrixInvOld.copy(dp).invert(),n.booleanWasTransformed=!1}else n instanceof zg&&n.needsTransformForDownstream===!0?(a===void 0?CF(n.booleanMeshSetAddress,dp):n.booleanMeshSetAddress=mie(n,a,n.booleanMeshSetAddress,dp),n.needsTransformForDownstream=!1):n.booleanWasTransformed===!0&&(CF(n.booleanMeshSetAddress,fie.multiplyMatrices(dp,n.booleanMatrixInvOld)),n.booleanMatrixInvOld.copy(dp).invert(),n.booleanWasTransformed=!1)}catch(a){console.error(a),n.booleanMeshSetAddress=0,n.geometry.userData.booleanOperationDidFail=!0;continue}if(n.booleanMeshSetAddress===0)continue;this.meshSetAddresses.push(n.booleanMeshSetAddress),n.geometry.userData.booleanOperationDidFail=!1}}if(this.meshSetAddresses.length===0){if(this.geometry.getAttribute("position")?.array.length!==0){let r=this.geometry;r.dispose(),this.geometry=new At,this.geometry.userData=r.userData,this.geometry.boundingSphere=r.boundingSphere,this.geometry.setAttribute("position",new Et([],3))}return void this.geometry.setDrawRange(0,0)}if(e===!0)return function(r,n){let a=oL(),s=cte(r,n),o=a.mesh_topological_data(s),l=o.positions(),h=o.indices();return o.free(),s.free(),{positions:l,indices:h,verticesPerFace:new Uint8Array(h.length/3).fill(3)}}(this.meshSetAddresses,this.booleanOp);let i=this.geometry;i.dispose(),this.geometry=new At,this.geometry.userData=i.userData,this.geometry.boundingSphere=i.boundingSphere;try{this.booleanMeshSetAddress=function(r,n,a,s){let o=oL(),l=cte(r,n),h=o.mesh_render_data(l,Math.max(s,0));if(a.setAttribute("position",new Et(h.positions(),3)),a.setAttribute("normal",new Et(h.normals(),3)),h.free(),a.boundingSphere===null&&(a.boundingSphere=new Ws),l.tri_count()===0)a.boundingSphere.center.set(0,0,0),a.boundingSphere.radius=0,a.userData.parameters={width:0,height:0,depth:0};else{let u=l.bounds();a.boundingSphere.center.set(u[0],u[1],u[2]),a.boundingSphere.radius=(u[3]**2+u[4]**2+u[5]**2)**.5,a.userData.parameters={width:2*u[3],height:2*u[4],depth:2*u[5]}}return AX(l)}(this.meshSetAddresses,this.booleanOp,this.geometry,this.phongAngle)}catch(r){this.booleanMeshSetAddress=0,this.geometry.userData.booleanOperationDidFail=!0,console.error(r)}this.booleanMatrixInvOld.copy(this.matrix).invert(),this.needsTransformForDownstream=!0,Cx(this),Px(this)}dispose(){super.dispose(),this.geometry.dispose()}}}),OA=k(()=>{le(),xl(),d1(),(vL||(vL={})).is=function(e){return hr.is(e)&&e instanceof Hp},k4=(e,t)=>class extends u1(e,t){updateState_Light(i,r){if(this.updateState_Entity(i,r),i.color!==void 0&&(this.color=r.shared.color(i.color)),i.intensity!==void 0&&(this.intensity=i.intensity*Math.PI),i.depth!==void 0){let n=this.shadow;n.camera.far=i.depth,n.needsUpdate=!0}i.shadows!==void 0&&(this.castShadow=i.shadows)}}}),n0=k(()=>{IA(),io(),d1(),_d=e=>e instanceof Sa,Vc=e=>e!==null&&e instanceof zg,yL=e=>pH.is(e)});function vo(e,t){return t.color(e)}function gie(e=new Date,t){let i=t.format,r=e.getSeconds(),n=e;t&&t.timeZone!==null&&(n=function(d,c){try{let p=new Intl.DateTimeFormat("en-US",{timeZone:c,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hourCycle:"h23"}).formatToParts(d),m=f=>Number(p.find(g=>g.type===f)?.value);return new Date(m("year"),m("month")-1,m("day"),m("hour"),m("minute"),m("second"),d.getMilliseconds())}catch{return new Date(NaN)}}(new Date,t.timeZone));let a,s=n.getHours(),o=n.getMinutes();t.format12h24h==="12ampm"&&(a=s>=12?"PM":"AM");let l,h,u=s;switch(t.format12h24h!=="24"&&(u=s%12,u===0&&(u=12)),i){case"HH:mm:ss":l=[u,o,r];break;case"HH:mm":l=[u,o];break;case"HH":l=[u],a=void 0;break;case"mm":l=[o],a=void 0;break;case"ss":l=[r],a=void 0;break;case"year":h=n.getFullYear();break;case"month":h=n.getMonth()+1;break;case"dayOfYear":h=Math.floor((n.getTime()-new Date(n.getFullYear(),0,0).getTime())/864e5);break;case"dayOfMonth":h=n.getDate();break;case"secondOfDay":h=60*s*60+60*o+r;break;default:console.error("Unknown time format",i),h=0}return l!==void 0?{textValue:l,suffix:a}:h}var jH,rw,qX=k(()=>{}),UOe=k(()=>{le(),PA(),RA(),jH=class extends bw(zye){constructor(e,t=15,i=10066329){super(e,t,i),this.object=e,this.added=!1,this.name=`DirectionalLightHelper: ${e.uuid}`}raycast(e,t){xw(this.object,jH.geometryHelper,e,t)}}}),LA=k(()=>{le(),UOe(),OA(),rw=class extends k4(ZE,jH){constructor(e,t,i){super(),this.super_Entity(e,t),this.castShadow=!0,this.shadow.mapSize.width=2048,this.shadow.mapSize.height=2048,this.shadow.normalBias=1,this.layers.enable(3);let r=this.shadow.camera;r.top=1250,r.bottom=-1250,r.right=1250,r.left=-1250,r.near=-1e4,r.far=2500;let n=new QE(this.shadow.camera);n.visible=!1,this.gizmos.shadowmap=n}update(){this.shadow.camera.updateProjectionMatrix();for(let e in this.gizmos){let t=this.gizmos[e];t instanceof QE&&t.update()}}updateMatrixWorld(e){super.updateMatrixWorld(e),this.objectHelper&&this.objectHelper.update()}updateState(e,t){this.updateState_Light(e,t);let i=e.depth!==void 0&&e.depth!==this.shadow.camera.far||e.size!==void 0&&e.size/2!==this.shadow.camera.right;e.size!==void 0&&function(r,n){r.shadow.camera.right=n/2,r.shadow.camera.left=-n/2,r.shadow.camera.top=n/2,r.shadow.camera.bottom=-n/2,r.shadow.needsUpdate=!0}(this,e.size),e.shadowRadius!==void 0&&(this.shadow.radius=e.shadowRadius),e.shadowResolution!==void 0&&(this.shadow.mapSize.set(e.shadowResolution,e.shadowResolution),this.shadow.map&&(this.shadow.map.dispose(),this.shadow.map=null)),e.penumbraSize!==void 0&&t.scene.markPenumbraSizeDirty(),i&&this.update()}}});function $X(e){return e instanceof bl&&e.needsAO&&!$g(e)&&e.isDecalObject!==!0}function XX(e){let t=e.cloner;if(t&&Array.isArray(t.children))for(let i of t.children)i?.layers&&(i.layers.mask=e.layers.mask)}function YX(e){return e.getLayersOfType("reflection").filter(t=>t.data.visible).length}function FOe(e){let t=1/0,i=-1/0;for(let r of e.getLayersOfType("reflection")){let n=r.data;if(!n.visible||n.mirror===1)continue;let a=typeof n.blur=="number"?n.blur:null;t=Math.min(t,a??0),i=Math.max(i,a??10)}return t===1/0?null:{min:t,max:i}}function zOe(e){for(let t of e.getLayersOfType("reflection")){let i=t.data;if(!i.visible)continue;let{blur:r,thickness:n,steps:a,stepSize:s}=i;return typeof r!="number"||typeof n!="number"||typeof a!="number"||typeof s!="number"?"variable":{blur:r,thickness:n,steps:a,stepSize:s,tracingMode:i.tracingMode===1?1:0}}return null}function vie(e,t){let i={outline:!1,cavity:!1},r=e.layers.mask&G4,n=t.getLayersOfType("transmission"),a=t.getLayersOfType("outline"),s=YX(t),o=t.getLayersOfType("cavity");return(a.length>0||o.length>0)&&(e.layers.set(8),n.length>0&&e.layers.enable(3),s>0&&e.layers.enable(4),i.outline=a.length>0,i.cavity=o.length>0,Px(e),Cx(e)),n.length===0&&a.length===0&&o.length===0&&s===0&&e.layers.set(0),r&&e.layers.set(9),!r&&$X(e)&&e.layers.enable(5),XX(e),i}function yie(e,t){if(!t.layers)return!1;let i=e.layers.mask&G4,r=!1,n=t.getLayersOfType("transmission").filter(l=>l.data.visible),a=t.getLayersOfType("outline").filter(l=>l.data.visible),s=YX(t),o=t.getLayersOfType("cavity").filter(l=>l.data.visible);return n.length>0&&(e.layers.set(3),(a.length>0||o.length>0)&&e.layers.enable(8),s>0&&e.layers.enable(4),r=!0),n.length===0&&a.length===0&&o.length===0&&s===0&&e.layers.set(0),i&&e.layers.set(9),!i&&$X(e)&&e.layers.enable(5),XX(e),r}function _ie(e,t){var i;if(!t.layers)return!1;let r=e.layers.mask&G4,n=!1,a=YX(t),s=t.getLayersOfType("transmission").filter(h=>h.data.visible),o=t.getLayersOfType("outline").filter(h=>h.data.visible),l=t.getLayersOfType("cavity").filter(h=>h.data.visible);return a>0&&((i=e.userData).__splinePlanarMirror??(i.__splinePlanarMirror=0),e.layers.set(4),s.length>0&&e.layers.enable(3),(o.length>0||l.length>0)&&e.layers.enable(8),n=!0),a===0&&s.length===0&&o.length===0&&l.length===0&&e.layers.set(0),r&&e.layers.set(9),!r&&$X(e)&&e.layers.enable(5),XX(e),n}function HH(e,t,i,r=!1){let n=e.cloner;if(n){let a=null;if(e.raycast===Cr.prototype.raycast||e.raycast===Sa.prototype.raycast){let s=e.geometry;s&&(s.boundingSphere===null&&s.computeBoundingSphere(),a=s.boundingSphere)}for(let s of n.children){if(a!==null&&(WH.copy(a).applyMatrix4(s.matrixWorld),!t.ray.intersectsSphere(WH)))continue;let o=Lbe.copy(s.matrixWorld).invert(),l=Bbe.copy(t.ray).applyMatrix4(o),h=e.matrixWorld;l.applyMatrix4(h);let u=Obe;u.set(l.origin,l.direction),u.near=t.near,u.far=t.far,u.layers.mask=t.layers.mask;let d=u.intersectObject(e,!1);d.length>0&&i.push({...d[0],object:r?s:e})}}}var G4,Obe,Lbe,Bbe,WH,v3,Ube,QF,JF,e5,nw,Ka,KX=k(()=>{sa(),V4(),io(),c1(),le(),G4=512,Obe=new W$,Lbe=new ke,Bbe=new vm,WH=new Ws}),VOe=k(()=>{le(),PA(),RA(),v3=class extends bw(Uye){constructor(e,t=6710886){super(e,t),this.object=e,this.matrix=e.matrixWorld,this.name=`SpotLightHelper: ${e.uuid}`}raycast(e,t){xw(this.object,v3.geometryHelper,e,t)}update(){if(this.object!==void 0){let e=v3._vector,t=this.object.distance?this.object.distance:1e3,i=t*Math.tan(this.object.angle);this.cone.scale.set(i,i,t),e.setFromMatrixPosition(this.object.target.matrixWorld),this.cone.lookAt(e);let r=this.color!==void 0?this.color:this.light.color;if(this.cone.material instanceof Array)for(let n=0,a=this.cone.material.length;n<a;n++)this.cone.material[n].color.set(r);else this.cone.material.color.set(r)}}},(Ube=v3)._vector=new D}),BA=k(()=>{le(),VOe(),OA(),QF=new D,JF=new D,e5=new Zt,nw=class extends k4(vy,Ube){constructor(e,t,i){super(),this.super_Entity(e,t),this.castShadow=!0,this.shadow.mapSize.width=1024,this.shadow.mapSize.height=1024,this.shadow.normalBias=1,this.layers.enable(3);let r=this.shadow.camera;r.fov=2*ht.RAD2DEG*this.angle,r.aspect=1,r.near=100,r.far=2500;let n=new QE(this.shadow.camera);n.visible=!1,this.gizmos.shadowmap=n,this.update()}update(){this.shadow.camera.updateProjectionMatrix();for(let e in this.gizmos){let t=this.gizmos[e];t instanceof QE&&t.update()}}updateMatrixWorld(e){super.updateMatrixWorld(e),JF.setFromMatrixPosition(this.matrixWorld),e5.setFromRotationMatrix(this.matrixWorld),QF.copy(this.up).applyQuaternion(e5).negate().multiplyScalar(this.distance),this.target.position.copy(JF).add(QF),this.target.updateMatrixWorld(),this.objectHelper&&this.objectHelper.update()}updateState(e,t){this.updateState_Light(e,t),e.distance!==void 0&&(this.distance=e.distance),e.decay!==void 0&&(this.decay=e.decay),e.angle!==void 0&&(this.angle=e.angle),e.penumbra!==void 0&&(this.penumbra=e.penumbra),e.shadowRadius!==void 0&&(this.shadow.radius=e.shadowRadius),e.penumbraSize!==void 0&&t.scene.markPenumbraSizeDirty(),e.shadowResolution!==void 0&&(this.shadow.mapSize.set(e.shadowResolution,e.shadowResolution),this.shadow.map&&(this.shadow.map.dispose(),this.shadow.map=null))}}}),Km=k(()=>{$t(),Uh(),le(),xl(),wu(),qX(),Xm(),LA(),Nr(),Ym(),le(),c1(),n0(),KX(),BA(),_r(),IA(),Ka=class extends D4(Zo){constructor(e,t,i){if(super(),this.data=t,this.bgColor=new Fr(1,1,1,1),this.fog=null,this.backupFog=new qj(16777215,.1,2e3),this.fogUseBGColor=!1,this.fogMode="linear",this.fogDensity=Yn.getDensity({}),this.fogHeightFalloff=Yn.getHeightFalloff({}),this.fogHeightBase=Yn.getHeightBase({}),this.isActive=!1,this.skyState=null,this.skyStateVersion=0,this.gradingState=null,this.skyHdriHolder=null,this.aoColor=new ot,this.penumbraSizeArrayCache=null,this.super_Entity(e,t),this.personalCamera=new na(h1,{...fE.defaultData,...t.camera,name:"Personal Camera"}),this.personalCamera.objectHelper.visible=!1,this.add(this.personalCamera),this.activeCamera=this.personalCamera,this.ambientLight=new g4(13882323,8553090,.75*Math.PI),this.ambientLight.name="Default Ambient Light",this.ambientLight.layers.enable(3),this.ambientLight.removeFromParent(),this.add(this.ambientLight),t.uiScene){let r=lH();r===null?Ms("ui-2d","a page's 2D scene"):this.uiScene=new r.Scene2D((Array.isArray(e)?e[0]:e)+"-ui",t.uiScene,{dpr:window.devicePixelRatio,shared:i.shared})}else t.uiFrame&&this.createUICanvas(t.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(e,t){let i=lH();i!==null?(this.uiCanvas=new i.UICanvas(this.uuid+"-uiscreen",window.innerWidth,window.innerHeight,t),this.uiCanvas.isScreenSpace=!0,this.uiCanvas.promise.then(()=>{this.uiCanvas?.applyFrame(e),this.uiCanvas?.applySize()})):Ms("ui-2d","a page's UI canvas")}updateVisible(){}setBackgroundColor(e){this.bgColor=e,this.fogUseBGColor===!0&&(this.backupFog.color=e)}entityChildrenCount(){return this.uiScene?this.uiScene.children.length:super.entityChildrenCount()}updateAmbientLight(e,t){e.color!==void 0&&(this.ambientLight.color=vo(e.color,t)),e.intensity!==void 0&&(this.ambientLight.intensity=e.intensity*Math.PI),e.enabled!==void 0&&(e.enabled?this.add(this.ambientLight):this.remove(this.ambientLight))}onDeactive(){this.isActive=!1}onActive(e){this.isActive=!0,e.fog=this.fog,this.traverseEntity(t=>{t instanceof zg&&t.recomputeBoolean()}),this.updateShadow(this.data.shadow)}forceMaterialsUpdate(){this.traverseEntity(e=>{if(e instanceof bl)if(Array.isArray(e.material))for(let t of e.material)t.needsUpdate=!0;else e.material.needsUpdate=!0,e.material.dispose()})}updateShadow(e){if(e.softShadowQuality===void 0&&e.type===void 0||!this.isActive)return;let t=this.data.shadow;var i,r;i=_y.isSoft(t),r=t?.softShadowQuality,zH!==void 0&&zH(i,r)&&this.forceMaterialsUpdate()}updateFog(e,t){e.enabled?this.fog=this.backupFog:this.fog=null,this.isActive&&(this.scene.fog=this.fog),this.fogUseBGColor=e.useBackgroundColor,e.useBackgroundColor?this.backupFog.color.set(this.bgColor):this.backupFog.color=vo(e.color,t),this.backupFog.near=e.near,this.backupFog.far=e.far,this.fogMode=Yn.getMode(e),this.fogDensity=Yn.getDensity(e),this.fogHeightFalloff=Yn.getHeightFalloff(e),this.fogHeightBase=Yn.getHeightBase(e)}updateSky(e,t){this.skyState=e??null,this.skyStateVersion++;let i=e?.hdri?.image;this.skyHdriHolder=i!=null?t.image(i):null}updateAo(e,t){e.aoColor!==void 0&&(this.aoColor=vo(e.aoColor,t))}updateByOp(e,t,i,r){let n=this.data.uiFrame;super.updateByOp(e,t,i,r);let a=t;Qr(e.path,["fog"])?this.updateFog(a.fog,i.shared):Qr(e.path,["sky"])?this.updateSky(a.sky,i.shared):Qr(e.path,["grading"])?this.gradingState=a.grading??null:Qr(e.path,["ao"])?this.updateAo(a.ao,i.shared):Qr(e.path,["ambient"])?this.updateAmbientLight(a.ambient,i.shared):Qr(e.path,["shadow"])?this.updateShadow(a.shadow):e.type===0&&e.path.length===0&&(e.props.uiFrame!==void 0||n!==a.uiFrame)&&this.updateUIFrame(e.props.uiFrame,i)}updateUIFrame(e,t){e?(this.uiCanvas||this.createUICanvas(e,t),this.uiCanvas.enabled=!0,this.uiCanvas.applyFrame(e)):this.uiCanvas&&(this.uiCanvas.enabled=!1)}updateState(e,t){this.updateState_Entity(e,t),e.backgroundColor!==void 0&&this.setBackgroundColor(vo(e.backgroundColor,t.shared)),e.fog!==void 0&&this.updateFog(e.fog,t.shared),e.sky!==void 0&&this.updateSky(e.sky,t.shared),e.grading!==void 0&&(this.gradingState=e.grading),e.ambient!==void 0&&this.updateAmbientLight(e.ambient,t.shared),e.ao!==void 0&&this.updateAo(e.ao,t.shared),e.shadow!==void 0&&this.updateShadow(e.shadow)}createFrame(e,t){}raycast(e,t){super.raycast(e,t)}switchActiveCamera(e){e&&e.isDescendantOf(this)&&(this.activeCamera!==this.personalCamera&&(this.activeCamera.objectHelper.visible=!0),this.activeCamera=e,e.objectHelper.visible=!1)}get playCamera(){return this.scene?.find(this.data.publish.playCamera)??this.personalCamera}switchToPlayCamera(){this.switchActiveCamera(this.playCamera)}get penumbraSizeArray(){return this.penumbraSizeArrayCache===null&&this.updatePenumbraSizeArray(),this.penumbraSizeArrayCache}updatePenumbraSizeArray(){this.penumbraSizeArrayCache=new Array(Hm).fill(.5);let e=0,t=0;this.traverseEntity(i=>{if(!i.visible)return!0;i instanceof rw&&i.visible&&e<vE&&(this.penumbraSizeArrayCache[e]=i.data.penumbraSize??.5,e+=1),i instanceof nw&&i.visible&&e<Hm-vE&&(this.penumbraSizeArrayCache[vE+t]=i.data.penumbraSize??.5,t+=1)})}raycastWithClones(e){let t=[],i=r=>{for(let n of r.children){let a=n.cloner;hr.is(n)&&(n.visible||a?.object.data.visible)&&((_d(n)||yL(n)&&this.scene.enableHelpers&&n.objectHelper.visible)&&(e.intersectObject(n,!1,t),HH(n,e,t,!0)),i(n))}};return i(this),t}updateEntity2DByOp(e,t,i,r){this.uiCanvas?.updateEntity2DByOp(e,t,i,r)}}});function bie(){return ZX}function t5(){if(_L===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 _L}function i5(e){return e?.isWebGPUSplineRenderer===!0}var ZX,_L,QX=k(()=>{ZX=null,_L=null});function qH(){return eY}var JX,eY,tY=k(()=>{JX=null,eY=null});function xie(e,t,i){return CM.setRGB(e,t,i,Yi),{r:CM.r,g:CM.g,b:CM.b}}function kOe(e,t,i){let r,n=mA(e.angle,0),[a,s]=$H(e.offset),[o,l]=$H(e.morph),h=e.colors??[],u=e.steps??[],d=Math.min(10,h.length,u.length);if(d===0)return[1,1,1,1];if(e.gradientType===1){let g=3*(t+o)-(t+a)-1,v=3*(i+l)-(i+s)-1;r=Math.hypot(g,v)+n}else if(e.gradientType===2){let g=-1*Math.atan2(t+o-.5+a,i+l-.5+s),v=n/Math.PI/-2+.5*g/Math.PI;r=v-Math.floor(v)}else{let g=.5+o/(t!==0?t:1e-6),v=l/(i!==0?i:1e-6),y=Math.cos(n)*g-Math.sin(n)*v,_=Math.sin(n)*g+Math.cos(n)*v,b=y*y+_*_;r=b>1e-12?(((t-.5+a)/2+y/2)*y+((i-.5+s)/2+_/2)*_)/b:0}let c=h[0][0],p=h[0][1],m=h[0][2],f=h[0][3];for(let g=1;g<d;g++){let v=u[g-1],y=u[g]-v,_=y!==0?Math.min(1,Math.max(0,(r-v)/y)):r>=v?1:0;e.smooth&&(_=_*_*(3-2*_)),c+=(h[g][0]-c)*_,p+=(h[g][1]-p)*_,m+=(h[g][2]-m)*_,f+=(h[g][3]-f)*_}return[c,p,m,f]}function GOe(e,t){let i=e,r=i?.data?.layers;if(r&&typeof r.forEach=="function"){let n=t,a=[];return r.forEach(s=>{let o=s.data;if(o.visible===!1||o.isMask===!0)return;let l=mA(o.alpha,1);if(!(l<=0))if(o.type==="color"){let h,u=o.color;typeof u=="string"?h=typeof n?.color=="function"?n.color(u):void 0:u&&typeof u.r=="number"&&(h=u),h&&a.push({kind:"color",layer:o,rgb:{...xie(h.r,h.g,h.b),a:h.a??1},alpha:l})}else o.type==="gradient"&&a.push({kind:"gradient",layer:o,alpha:l})}),a.length===0?null:(s,o)=>{let l=1,h=1,u=1,d=!0;for(let c of a){let p,m,f,g;if(c.kind==="color")({r:p,g:m,b:f}=c.rgb),g=c.rgb.a;else{let[y,_,b,x]=kOe(c.layer,s,o);({r:p,g:m,b:f}=xie(y,_,b)),g=x}let v=d?1:Math.min(1,Math.max(0,g*c.alpha));l+=(p-l)*v,h+=(m-h)*v,u+=(f-u)*v,d=!1}return{r:l,g:h,b:u}}}if(i?.color&&i.color.isColor===!0){let{r:n,g:a,b:s}=i.color;return()=>({r:n,g:a,b:s})}return null}var CM,mA,$H,jOe=k(()=>{le(),CM=new ot,mA=(e,t)=>typeof e=="number"&&Number.isFinite(e)?e:t,$H=e=>Array.isArray(e)&&typeof e[0]=="number"&&typeof e[1]=="number"?[e[0],e[1]]:[0,0]});function HOe(e,t){if(e==="torus"){let l=t()*Math.PI*2,h=t()*Math.PI*2,u=Math.cos(l),d=Math.sin(l),c=Math.cos(h),p=Math.sin(h);return{x:(1.4+.7*c)*u,y:-(1.4+.7*c)*d,z:.7*p,nx:c*u,ny:-c*d,nz:p,cr:1,cg:1,cb:1}}if(e==="cylinder"){let l=t()*Math.PI*2,h=Math.cos(l),u=Math.sin(l);return{x:.8*h,y:1.6*(t()-.5),z:.8*u,nx:h,ny:0,nz:u,cr:1,cg:1,cb:1}}let i=t()*Math.PI*2,r=2*t()-1,n=Math.acos(r),a=Math.sin(n)*Math.cos(i),s=Math.cos(n),o=Math.sin(n)*Math.sin(i);return{x:a,y:s,z:o,nx:a,ny:s,nz:o,cr:1,cg:1,cb:1}}function WOe(e){let{geometry:t,matrix:i}=e,r=t.getAttribute("position");if(!r||r.count<3)return null;let n=t.getAttribute("normal"),a=t.getAttribute("uv"),s=t.getAttribute("color"),o=t.getIndex(),l=o?o.count/3:r.count/3;if(l<1)return null;let h=(v,y)=>o?o.getX(3*v+y):3*v+y,u=i?i.elements:null,d=i?new hi().getNormalMatrix(i).elements:null,c=v=>{let y=r.getX(v),_=r.getY(v),b=r.getZ(v);return u?u[0]*y+u[4]*_+u[8]*b+u[12]:y},p=v=>{let y=r.getX(v),_=r.getY(v),b=r.getZ(v);return u?u[1]*y+u[5]*_+u[9]*b+u[13]:_},m=v=>{let y=r.getX(v),_=r.getY(v),b=r.getZ(v);return u?u[2]*y+u[6]*_+u[10]*b+u[14]:b},f=new Float64Array(l),g=0;for(let v=0;v<l;v++){let y=h(v,0),_=h(v,1),b=h(v,2),x=c(y),w=p(y),S=m(y),M=c(_)-x,T=p(_)-w,A=m(_)-S,E=c(b)-x,C=p(b)-w,N=m(b)-S,P=T*N-A*C,I=A*E-M*N,L=M*C-T*E;g+=.5*Math.sqrt(P*P+I*I+L*L),f[v]=g}return g<=0?null:{total:g,sample:(v,y)=>{let _=0,b=l-1;for(;_<b;){let te=_+b>>1;f[te]<v?_=te+1:b=te}let x=_,w=h(x,0),S=h(x,1),M=h(x,2),T=y(),A=y();T+A>1&&(T=1-T,A=1-A);let E,C,N,P=1-T-A,I=c(w)*P+c(S)*T+c(M)*A,L=p(w)*P+p(S)*T+p(M)*A,B=m(w)*P+m(S)*T+m(M)*A;if(n){if(E=n.getX(w)*P+n.getX(S)*T+n.getX(M)*A,C=n.getY(w)*P+n.getY(S)*T+n.getY(M)*A,N=n.getZ(w)*P+n.getZ(S)*T+n.getZ(M)*A,d){let te=d[0]*E+d[3]*C+d[6]*N,ue=d[1]*E+d[4]*C+d[7]*N,ae=d[2]*E+d[5]*C+d[8]*N;E=te,C=ue,N=ae}}else{let te=c(w),ue=p(w),ae=m(w),de=c(S)-te,ye=p(S)-ue,Z=m(S)-ae,fe=c(M)-te,W=p(M)-ue,z=m(M)-ae;E=ye*z-Z*W,C=Z*fe-de*z,N=de*W-ye*fe}let G=Math.sqrt(E*E+C*C+N*N)||1,j=1,$=1,H=1;if(s)j=s.getX(w)*P+s.getX(S)*T+s.getX(M)*A,$=s.getY(w)*P+s.getY(S)*T+s.getY(M)*A,H=s.getZ(w)*P+s.getZ(S)*T+s.getZ(M)*A;else if(e.sampleColor){let te=a?a.getX(w)*P+a.getX(S)*T+a.getX(M)*A:.5,ue=a?a.getY(w)*P+a.getY(S)*T+a.getY(M)*A:.5,ae=e.sampleColor(te,ue);ae&&(j=ae.r,$=ae.g,H=ae.b)}return{x:I,y:L,z:B,nx:E/G,ny:C/G,nz:N/G,cr:j,cg:$,cb:H}}}}function wie(e){let t=Math.min(Math.max(1,Math.floor(e.guideStrands)),Rx),i=function(l){let h=l>>>0;return()=>{h|=0,h=h+1831565813|0;let u=Math.imul(h^h>>>15,1|h);return u=u+Math.imul(u^u>>>7,61|u)^u,((u^u>>>14)>>>0)/4294967296}}(e.seed??1337),r=e.shape==="object"&&e.sampler,n=r?e.samplerRadius??hd:hd,a=new Float32Array(4*em),s=new Float32Array(em),o=new Float32Array(4*Rx).fill(1);for(let l=0;l<t;l++){let h=r?e.sampler(i):HOe(e.shape,i),u=r?h.x:h.x*n,d=r?h.y:h.y*n,c=r?h.z:h.z*n,{nx:p,ny:m,nz:f}=h;o[4*l+0]=h.cr,o[4*l+1]=h.cg,o[4*l+2]=h.cb;let g,v,y,_=l*qv,b=(1.8+.8*i())*e.hairLength*n/(qv-1),x=.5+1.5*i(),w=(.02+.06*i())*n;Math.abs(m)<.99?(g=-f,v=0,y=p):(g=1,v=0,y=0);let S=Math.sqrt(g*g+v*v+y*y)||1;for(let M=0;M<qv;M++){let T=M/(qv-1),A=T*T*.4*n,E=w*Math.sin(T*x*Math.PI*2),C=4*(_+M);a[C+0]=u+p*b*M+E*g/S,a[C+1]=d+m*b*M-A+E*v/S,a[C+2]=c+f*b*M+E*y/S,a[C+3]=M===0?0:1,M<qv-1&&(s[_+M]=b)}}return{initialPositions:a,restLengths:s,unitScale:n,rootColors:o}}var qv,Rx,em,hd,fg,US,Y1,B0,K1,uI,Fbe=k(()=>{le(),em=(Rx=16384)*(qv=32),hd=100}),zbe=k(()=>{le(),io(),tY(),jOe(),Fbe(),fg=1/60,US=new ke,Y1=new Zt,B0=new D,K1=new D,uI=class extends Sa{constructor(e,t,i){super(e,t),this.type="HairSystem",this.isHairSystem=!0,this.simRunning=!1,this.previewRequested=!1,this.playModeActive=!1,this.pendingSimSeconds=0,this.simTime=0,this.resetRequested=!0,this.generation=0,this.settledSimSeconds=0,this.lastMotionFingerprint=0,this.lastBoneQuat=new Zt,this.lastBonePos=new D,this.hasLastBone=!1,this.baseFoundAtRegen=!1,this.baseSourceGeomsAtRegen=[],this.baseSourceHashesAtRegen=[],this.baseColorHashAtRegen=0,this.baseScaleAtRegen=0,this.classicFallbackWarned=!1,this.regenSnapshot=null,this.context=i,this.data=t,this.geometry.setAttribute("position",new It(new Float32Array(0),3)),this.material=new Ql({colorWrite:!1,depthWrite:!1}),this.frustumCulled=!1,this.scalpMesh=new Cr(new Vm(hd,48,32),new Ql({color:5448477})),this.scalpMesh.name="HairScalp",this.add(this.scalpMesh);let r=new PO;r.setAttribute("position",new It(new Float32Array(12),3)),r.setIndex([0,2,1,2,3,1]),r.instanceCount=0,this.ribbonMesh=new Cr(r,new Ql({visible:!1})),this.ribbonMesh.name="HairRibbons",this.ribbonMesh.frustumCulled=!1,this.ribbonMesh.visible=!1,this.ribbonMesh.matrixAutoUpdate=!1,this.ribbonMesh.updateMatrixWorld=()=>{this.ribbonMesh.matrixWorld.identity()},this.ribbonMesh.updateWorldMatrix=()=>{this.ribbonMesh.matrixWorld.identity()},this.add(this.ribbonMesh),this.activeGuideStrands=t.guideStrands,this.roots=this.buildRoots(),this.regenSnapshot={guideStrands:t.guideStrands,hairLength:t.hairLength,spreadRadius:t.spreadRadius,headShape:t.headShape,baseObjectId:t.baseObjectId},this.applyScalpState(),this.applyShadowState(),this.syncSimRunning()}update(e){!this.simRunning||(this.pendingSimSeconds=Math.min(this.pendingSimSeconds+e/1e3,4*fg*2),this.trackMotionRest(e/1e3))}trackMotionRest(e){this.boneTransform(Y1,B0);let t=this.hasLastBone&&(Math.abs(this.lastBoneQuat.dot(Y1))<.9999995||this.lastBonePos.distanceToSquared(B0)>1e-8),i=this.motionFingerprint(),r=!this.hasLastBone||t||this.resetRequested||i!==this.lastMotionFingerprint||this.data.windStrength>.001;this.lastBoneQuat.copy(Y1),this.lastBonePos.copy(B0),this.lastMotionFingerprint=i,this.hasLastBone=!0,this.settledSimSeconds=r?0:this.settledSimSeconds+e}motionFingerprint(){let e=this.data;return e.gravity+2*e.damping+3*e.localStiffness+4*e.globalStiffness+5*e.globalRange+6*e.stiffnessFalloff+7*e.windStrength+8*e.vspCoefficient+9*e.kink+10*e.kinkFrequency+11*e.clumpStrength+12*e.clumpSize+13*e.clumpTipScale}get isSimulating(){return(this.simRunning||this.resetRequested)&&this.visible}get isMotionSettled(){return this.settledSimSeconds>6}get isVisiblyAnimating(){return this.isSimulating&&!this.isMotionSettled}startPreview(){this.previewRequested=!0,this.syncSimRunning()}stopPreview(){this.previewRequested=!1,this.syncSimRunning()}setPlayMode(e){this.playModeActive=e,e&&this.resetSimulation(),this.syncSimRunning()}resetSimulation(){this.resetRequested=!0,this.pendingSimSeconds=0,this.simTime=0,this.settledSimSeconds=0}warnClassicFallbackOnce(){this.classicFallbackWarned||(this.classicFallbackWarned=!0,console.warn("[spline] Hair System strands require the WebGPU renderer \u2014 the WebGL fallback shows only the scalp. Reload with ?renderer=webgpu in a WebGPU-capable browser."))}syncSimRunning(){this.simRunning=this.playModeActive||this.previewRequested||this.data.autoPlay}updateState(e,t){super.updateState(e,t),this.updateHairState(e)}updateHairState(e){if((e.guideStrands!==void 0||e.hairLength!==void 0||e.spreadRadius!==void 0||e.headShape!==void 0||e.baseObjectId!==void 0)&&this.regenerate(),(e.headShape!==void 0||e.baseObjectId!==void 0)&&this.applyScalpState(),e.headColor!==void 0){let t=this.scalpMesh.material;t.isMeshBasicMaterial===!0&&t.color.setRGB(e.headColor.r,e.headColor.g,e.headColor.b,Yi)}(e.castShadow!==void 0||e.receiveShadow!==void 0)&&this.applyShadowState(),e.autoPlay!==void 0&&this.syncSimRunning()}applyShadowState(){let e=this.data.castShadow??!0,t=this.data.receiveShadow??!0;this.castShadow=e,this.receiveShadow=t,this.scalpMesh.castShadow=e,this.scalpMesh.receiveShadow=t,this.ribbonMesh.castShadow=e,this.ribbonMesh.receiveShadow=t}regenerate(){this.activeGuideStrands=Math.max(1,Math.min(Math.floor(this.data.guideStrands),16384)),this.roots=this.buildRoots(),this.generation++,this.regenSnapshot={guideStrands:this.data.guideStrands,hairLength:this.data.hairLength,spreadRadius:this.data.spreadRadius,headShape:this.data.headShape,baseObjectId:this.data.baseObjectId},this.resetSimulation()}checkDataDrift(){let e=this.data,t=this.regenSnapshot;if(t===null||t.guideStrands!==e.guideStrands||t.hairLength!==e.hairLength||t.spreadRadius!==e.spreadRadius||t.headShape!==e.headShape||t.baseObjectId!==e.baseObjectId){let i=t===null||t.headShape!==e.headShape||t.baseObjectId!==e.baseObjectId;this.regenerate(),i&&this.applyScalpState()}this.syncSimRunning(),this.applyShadowState(),this.checkBaseDrift()}buildRoots(){let{headShape:e,baseObjectId:t,guideStrands:i,hairLength:r}=this.data;if(this.baseFoundAtRegen=!1,this.baseSourceGeomsAtRegen=[],this.baseSourceHashesAtRegen=[],this.baseColorHashAtRegen=0,this.baseScaleAtRegen=0,e==="object"&&t){let n=this.context.scene.find(t);if(n){this.baseFoundAtRegen=!0,n.updateWorldMatrix(!0,!0);let a=this.collectBaseSources(n),s=a?function(o){let l=[];for(let d of o){let c=WOe(d);c&&l.push(c)}if(l.length===0)return null;let h=new Float64Array(l.length),u=0;for(let d=0;d<l.length;d++)u+=l[d].total,h[d]=u;return u<=0?null:d=>{let c=d()*u,p=0,m=l.length-1;for(;p<m;){let g=p+m>>1;h[g]<c?p=g+1:m=g}let f=p===0?c:c-h[p-1];return l[p].sample(f,d)}}(a.sources):null;if(this.baseSourceGeomsAtRegen=a?.sources.map(o=>o.geometry)??[],this.baseSourceHashesAtRegen=a?.hashes??[],this.baseColorHashAtRegen=a?.colorHash??0,a&&s){let o=this.baseWorldScale(n),l=Math.max(a.radius*o,.001);this.baseScaleAtRegen=o;let h=o;return wie({shape:"object",guideStrands:i,hairLength:r,sampler:u=>{let d=s(u);return{...d,x:d.x*h,y:d.y*h,z:d.z*h}},samplerRadius:l})}}}return wie({shape:e==="object"?"sphere":e,guideStrands:i,hairLength:r})}collectBaseSources(e){let t=[],i=[],r=0,n=0;US.copy(e.matrixWorld).invert();let a=US.clone(),s=o=>{if(o.isHairSystem===!0||o!==e&&o.visible===!1)return;let l=o.geometry;if(o.isMesh===!0&&l&&(l.getAttribute("position")?.count??0)>=3){let h=o===e?void 0:new ke().multiplyMatrices(a,o.matrixWorld),u=Array.isArray(o.material)?o.material[0]:o.material;t.push({geometry:l,matrix:h,sampleColor:GOe(u,this.context.shared)??void 0}),i.push(uI.matrixHash(h)),n+=function(c,p){let m=c,f=0,g=1,v=_=>{f+=_*g,g+=1},y=m?.data?.layers;if(y&&typeof y.forEach=="function"){let _=p;y.forEach(b=>{let x=b.data;if(x.visible!==!1){if(x.type==="color"){let w=x.color,S=typeof w=="string"?typeof _?.color=="function"?_.color(w):void 0:w;S&&typeof S.r=="number"&&(v(S.r),v(S.g),v(S.b)),v(mA(x.alpha,1))}else if(x.type==="gradient"){let w=x;for(let S of w.colors??[])v(S[0]),v(S[1]),v(S[2]),v(S[3]);for(let S of w.steps??[])v(S);v(mA(w.angle,0)),v(w.gradientType),v(w.smooth?1:0)}}})}else m?.color&&m.color.isColor===!0&&(v(m.color.r),v(m.color.g),v(m.color.b));return f}(u,this.context.shared),l.boundingSphere===null&&l.computeBoundingSphere();let d=l.boundingSphere;if(d){let c=0,p=1;h?(B0.copy(d.center).applyMatrix4(h),c=B0.length(),p=uI.matrixMaxScale(h)):c=d.center.length(),r=Math.max(r,c+d.radius*p)}}for(let h of o.children)s(h)};return s(e),t.length===0?null:{sources:t,hashes:i,radius:Math.max(r,.001),colorHash:n}}static matrixHash(e){if(!e)return 0;let t=e.elements,i=0;for(let r=0;r<16;r++)i+=t[r]*(r+1);return i}static matrixMaxScale(e){let t=e.elements,i=Math.hypot(t[0],t[1],t[2]),r=Math.hypot(t[4],t[5],t[6]),n=Math.hypot(t[8],t[9],t[10]);return Math.max(i,r,n,1e-6)}baseWorldScale(e){return US.copy(e.matrixWorld).decompose(B0,Y1,K1),Math.max(Math.abs(K1.x),Math.abs(K1.y),Math.abs(K1.z),1e-6)}get widthWorldScale(){return this.data.headShape==="object"&&this.data.baseObjectId&&this.baseScaleAtRegen>0?this.baseScaleAtRegen:1}checkBaseDrift(){if(this.data.headShape!=="object"||!this.data.baseObjectId)return;let e=this.context.scene.find(this.data.baseObjectId);if(!e)return;if(!this.baseFoundAtRegen)return void this.regenerate();e.updateWorldMatrix(!0,!0);let t=this.collectBaseSources(e),i=t?.sources??[],r=t?.hashes??[],n=this.baseSourceGeomsAtRegen,a=this.baseSourceHashesAtRegen,s=i.length!==n.length;if(!s){for(let o=0;o<i.length;o++)if(i[o].geometry!==n[o]||Math.abs(r[o]-a[o])>1e-4*Math.max(Math.abs(a[o]),1)){s=!0;break}}if(!s&&this.data.hairColorSource==="object"&&(t?.colorHash??0)!==this.baseColorHashAtRegen&&(s=!0),!s&&i.length>0){let o=this.baseWorldScale(e);s=Math.abs(o-this.baseScaleAtRegen)>.001*Math.max(this.baseScaleAtRegen,1e-6)}s&&this.regenerate()}applyScalpState(){let e=this.data.headShape,t=e==="object"&&this.data.baseObjectId!==null;this.scalpMesh.visible=!t,!t&&(this.scalpMesh.geometry.dispose(),this.scalpMesh.geometry=e==="torus"?new CO(1.4*hd,.7*hd,24,48):e==="cylinder"?new hE(.8*hd,.8*hd,1.6*hd,48,1):new Vm(hd,48,32))}boneTransform(e,t){let i=this.matrixWorld;if(this.data.headShape==="object"&&this.data.baseObjectId){let r=this.context.scene.find(this.data.baseObjectId)?.matrixWorld;r&&(i=r)}US.copy(i).decompose(t,e,K1)}raycast(e,t){if(!this.scalpMesh.visible)return;let i=[];this.scalpMesh.raycast(e,i);for(let r of i)r.object=this,t.push(r)}get shadowBoundsRadius(){let e=this.data.headShape==="torus"?2.6:1.5;return this.roots.unitScale*(e+2.6*Math.max(this.data.hairLength,0))}getShadowBoundsCenter(e){return this.boneTransform(Y1,e),e}updateEntityBoxSize(e,t){let i=this.shadowBoundsRadius;e.set(0,0,0),t.set(i,i,i)}dispose(){super.dispose(),this.scalpMesh.geometry.dispose(),this.scalpMesh.material.dispose(),this.ribbonMesh.geometry.dispose(),this.ribbonMesh.material.dispose?.(),qH()?.release(this)}}});function dI(){return{shapeInput:()=>`
|
|
4169
|
+
`&&T.push("")):x.getTextWidth(T[T.length-1]+A,b)>M&&(T[T.length-1].length&&T.push(""),x.getTextWidth(T[T.length-1]+A,b)>M&&(A.length===1?(T[T.length-1]+=A,A=""):(T[T.length-1]+=A.slice(0,-1),A=A[A.length-1],T.push(""))));return T[T.length-1]+=A,T}(e,i,h===2?u.toUpperCase():h===3?u.toLowerCase():u,t),{shapes:c,charWidths:p,charCoords:m}=i.generateShapes(d,e,t),f=.5*(typeof r=="number"?r:Number(t.getVariable(r))),g=.5*(typeof n=="number"?n:Number(t.getVariable(n))),v=c.map(b=>new da().fromShape(b,!0));this.vectorShapes=v;let y=v.map(b=>r0.create({shape:b,parameters:{depth:a,extrudeBevelSegments:o,extrudeBevelSize:s,windingRule:a<=0?xn.NONZERO:xn.ODD,subdivisions:this.isLowResolution&&a>0?1:12}})),_=y.length?ry(y):eie();_.translate(-f,g,0),this.dispose(),this.wrappedText=d,this.charCoords=m,this.charWidths=p,this.deleteAttribute("extrudeNormal"),Object.entries(_.attributes).forEach(([b,x])=>{this.setAttribute(b,x)}),this.setIndex(_.index),this.computeBoundingSphere()}clone(){let e=Gl(new At,PH.prototype);return e.copy(this),console.log("CloneGeometry",this,e),e}copy(e){return Object.entries(e.attributes).forEach(([t,i])=>{this.setAttribute(t,i)}),this.setIndex(e.index),this.userData={parameters:{...e.userData.parameters},type:"TextGeometry"},this}async setText(e,t){this.font&&await this.font.loadingPromise,await this.update({...this.userData.parameters,text:{textValue:e}},t)}get text(){return this.userData.parameters.text??""}}});function IOe(e){if(!RH)return iie||(iie=async function(){let t=e??"https://cdn.spline.design/@splinetool/runtime@2.0.13/build",i=import("./process.js"),[r,n]=await Promise.all([i,fetch(`${t}/process.wasm`).then(o=>o.arrayBuffer())]),a=r.default,s=await a({wasmBinary:n});xbe(s),RH=!0}())}var xbe,zX,RH,iie,U4=k(()=>{zX=new Promise(e=>{xbe=e}),RH=!1});function zF(e,t){if(Object.keys(e.morphAttributes).length>0||Object.keys(t.morphAttributes).length>0)return!1;let i=Object.keys(e.attributes),r=Object.keys(t.attributes);if(i.length!==r.length)return!1;for(let o of r){let l=e.attributes[o],h=t.attributes[o];if(l===void 0||l.isInterleavedBufferAttribute===!0||h.isInterleavedBufferAttribute===!0||l.itemSize!==h.itemSize||l.normalized!==h.normalized||l.array.constructor!==h.array.constructor||l.array.length!==h.array.length)return!1}let n=e.index,a=t.index;if(n===null!=(a===null))return!1;let s=!1;if(n!==null&&a!==null){if(n.array.length!==a.array.length)return!1;let o=n.array.constructor,l=a.array.constructor;if(o!==l){if(o!==Uint32Array||l!==Uint16Array)return!1;s=!0}}if(e.groups.length!==t.groups.length)return!1;for(let o=0;o<t.groups.length;o++){let l=e.groups[o],h=t.groups[o];if(l.start!==h.start||l.count!==h.count||l.materialIndex!==h.materialIndex)return!1}for(let o of r){let l=e.attributes[o],h=t.attributes[o];l.array.set(h.array),l.needsUpdate=!0}if(n!==null&&a!==null){if(s){let o=n.array,l=a.array;for(let h=0,u=l.length;h<u;h++){let d=l[h];o[h]=d===65535?4294967295:d}}else n.array.set(a.array);n.needsUpdate=!0}return e.drawRange.start=t.drawRange.start,e.drawRange.count=t.drawRange.count,e.userData=t.userData,e.boundingBox=null,e.boundingSphere=null,!0}function DH(e,t,i,r){let n,a,s,o=e.position.array,l=e.normal.array,h=wbe.makeScale(t,i,r).invert().elements;for(let u=0,d=o.length;u<d;u+=3)o[u]*=t,o[u+1]*=i,o[u+2]*=r,n=l[u],a=l[u+1],s=l[u+2],l[u]=h[0]*n+h[4]*a+h[8]*s,l[u+1]=h[1]*n+h[5]*a+h[9]*s,l[u+2]=h[2]*n+h[6]*a+h[10]*s;e.position.needsUpdate=!0,e.normal.needsUpdate=!0}var wbe,Sbe=k(()=>{le(),wbe=new ke});function Tbe(e){let t=Object.keys(e);return t.length===1&&t[0]==="subdivisions"}function VX(e,t){let i=t?t.count:e.count,r=0,n=1e4,a=new Map,s=new Uint32Array(i),o=[];for(let u=0;u<i;u++){let d=t?t.getX(u):u,c=e.getX(d),p=e.getY(d),m=e.getZ(d),f=Math.round(c*n),g=Math.round(p*n),v=Math.round(m*n),y=a.get(f);y===void 0&&(y=new Map,a.set(f,y));let _=y.get(g);_===void 0&&(_=new Map,y.set(g,_));let b=_.get(v);b===void 0&&(b=r++,_.set(v,b),o.push(c,p,m)),s[u]=b}let l=[],h=[];for(let u=0;u<s.length;u+=3)s[u]===s[u+1]||s[u]===s[u+2]||s[u+1]===s[u+2]||(l.push(s[u],s[u+1],s[u+2]),h.push(t?t.getX(u):u,t?t.getX(u+1):u+1,t?t.getX(u+2):u+2));return{positions:o,triIndices:l,triOriginals:h}}var LS,L0,ni,VF,kF,GF,ua,BS,m3,f3,g3,NH,lI,Tw=k(()=>{le(),U4(),$t(),F4(),Sbe(),hA(),LS=new fn,L0=new D,zX.then(e=>{ni=e}),VF=new Float32Array([10,10,0,-10,10,0,-10,-10,0,10,-10,0]),kF=new Uint32Array([0,1,2,3]),GF=new Uint8Array([4]),ua=class extends At{constructor(e,t){super(),this.data=e,this.flatShading=t,this.subdivPointer=0,this.rebuild(),this.freeSubdivPointer()}mutateDirectlyScaleBaked(e,t){this.freeSubdivPointer();let i=this.data.scaleBaked.map(s=>typeof s=="number"?s:1),r=Fg.div(t.map(s=>typeof s=="number"?s:0),i);if(r.every(s=>s===1))return;this.subdividedGeometry&&DH(this.subdividedGeometry.attributes,...r),this.originalGeometry&&DH(this.originalGeometry.attributes,...r),this.data=e;let n=this.userData.parameters;this.userData.parameters={width:n.width*r[0],height:n.height*r[1],depth:n.depth*r[2]},this.originalGeometry.boundingSphere.center.multiply(L0.fromArray(r));let a=L0.set(n.width,n.height,n.depth).length();this.originalGeometry.boundingSphere.radius=a/2}ensureSubdivPointer(){return this.subdivPointer===0&&this.rebuild(),this.subdivPointer}mutateDirectlySubdivisions(e){this.freeSubdivPointer(),this.data=e;let t=e.phongAngle??35;this.flatShading&&(t=-1);let i=null;if(e.subdivisions>0){let n=0;try{n=ua.allocate(e),i=ua.buildRefined(n,e.subdivisions,t)}catch(a){console.error(a,e)}finally{n&&ua.freeSubdivPointer(n)}}this.subdividedGeometry?.dispose(),this.subdividedGeometry=i??void 0,this.subdividedGeometry&&(this.subdividedGeometry.boundingSphere=this.originalGeometry.boundingSphere);let r=this.userData.parameters;Object.assign(this,this.subdividedGeometry??this.originalGeometry),this.userData.parameters=r}rebuild(){let e,t,i;try{({originalGeometry:e,subdividedGeometry:t,subdivPointer:i}=ua.build(this.data,void 0,!this.flatShading,void 0))}catch{e=new Nh(100,100,100),i=0}this.subdivPointer=i,this.originalGeometry=e,this.subdividedGeometry=t??void 0;let r=this.subdividedGeometry??this.originalGeometry;Object.assign(this,r),this.calcBoundingBox()}freeSubdivPointer(){this.subdivPointer&&(ua.freeSubdivPointer(this.subdivPointer),this.subdivPointer=0)}dispose(){super.dispose(),this.freeSubdivPointer()}calcBoundingBox(){let e=this.originalGeometry;e.boundingSphere===null&&(e.boundingSphere=new Ws,this.subdividedGeometry&&(this.subdividedGeometry.boundingSphere=e.boundingSphere));let t=e.attributes.position,i=e.boundingSphere.center;LS.setFromBufferAttribute(t),LS.getCenter(i),e.boundingSphere.radius=i.distanceTo(LS.max),isNaN(e.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this),LS.getSize(L0);let r={width:L0.x,height:L0.y,depth:L0.z};return this.userData.parameters=r,r}static build(e,t,i,r){let n,a,s=e?.phongAngle??35;i===!1&&(s=-1),t&&(ni.free_bvh(t),ni.free_subdivision_surface(t));try{n=ua.allocate(e,r)}catch(l){console.error(l,e),n=ua.allocate({positionWASM:VF,indexWASM:kF,verticesPerFaceWASM:GF},r)}ni.set_destination_refinement_level(n,0);let o=ua.buildLevel(n,!0,s);return a=e.subdivisions>0?ua.buildRefined(n,e.subdivisions,s):null,{subdivPointer:n,originalGeometry:o,subdividedGeometry:a}}static buildRefined(e,t,i){try{return ni.set_destination_refinement_level(e,t),ua.buildLevel(e,!1,i)??null}catch{try{return ni.set_destination_refinement_level(e,t-1),ua.buildLevel(e,!1,i)??null}catch{return null}}}static primitiveToQuads(e,t,i){e.widthSegments>16&&(e.widthSegments=16),e.heightSegments>16&&(e.heightSegments=16),e.depthSegments>16&&(e.depthSegments=16),e.radialSegments>16&&(e.radialSegments=16),e.type==="DodecahedronGeometry"&&(e.detail=0);let r,n=e.shape!==void 0||e.path!==void 0?t.geometry:Ng(e,i,!1,t);r=T_e(e)?n.getClosedTorusIndicesForBooleanOrSubdiv():n.getIndex();let a,{positions:s,triIndices:o,triOriginals:l}=VX(n.getAttribute("position"),r);if(e.type==="CylinderGeometry"&&e.cornerRadius===0&&e.hollow===0&&e.openEnded===!1){let c=e.radialSegments*e.heightSegments*3*2;a=[c,c+3*e.radialSegments]}let{indices:h,verticesPerFace:u,uvs:d}=function(c,p,m,f,g){let v=[],y=[],_=g?m.getAttribute("uv"):void 0,b=_&&_.itemSize===2?[]:void 0,x=M=>{if(b){let T=g[M];b.push(_.getX(T),_.getY(T))}};if(m.userData.shape!==void 0&&m.userData.parameters.depth===0&&m.userData.shape.shapeHoles.length===0){let M=m.userData.shape.extractShapePointsToFlatArray([]),T=m.userData.parameters.spikes;if(m.userData.type==="EllipseGeometry"&&T<=24&&T%4==0&&m.userData.parameters.angle>=360){let C=M.length/2/T;M=M.filter((N,P)=>Math.floor(P/2)%C===0)}let A=0;for(let C=0;C<M.length;C+=2)A+=(M[C]-M[(C===0?M.length:C)-2])*(M[C+1]+M[(C===0?M.length:C)-1]);c.length=0;let E=0;if(A<0)for(let C=0;C<M.length;C+=2)c.push(M[C],M[C+1],0),v.push(E++);else for(let C=M.length-2;C>=0;C-=2)c.push(M[C],M[C+1],0),v.push(E++);return y.push(E),{indices:v,verticesPerFace:y}}let w=new Float32Array([m.userData.parameters.depth])[0],S=0;for(;S<p.length;){if(m.useNgonForTopBottomFaceDuringBake){let M=0;if((c[3*p[S]+2]===w||c[3*p[S]+2]===0)&&M++,(c[3*p[S+1]+2]===w||c[3*p[S+1]+2]===0)&&M++,(c[3*p[S+2]+2]===w||c[3*p[S+2]+2]===0)&&M++,M===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]){BS.set(c[3*p[S]],c[3*p[S]+1],c[3*p[S]+2]),m3.set(c[3*p[S+1]],c[3*p[S+1]+1],c[3*p[S+1]+2]),f3.set(c[3*p[S+4]],c[3*p[S+4]+1],c[3*p[S+4]+2]),g3.set(c[3*p[S+5]],c[3*p[S+5]+1],c[3*p[S+5]+2]),m3.sub(BS).normalize(),f3.sub(BS).normalize(),g3.sub(BS).normalize();let M=m3.cross(f3).dot(g3),T=S;Math.abs(M)>.005||f&&f.some((A,E)=>E%2!=1&&T>=f[E]&&T<f[E+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(m.useNgonForTopBottomFaceDuringBake){let M=[],T=[],A=0;for(let E=0,C=0;E<c.length;E+=3,C++)c[E+2]===0&&(M.push(C),A++),c[E+2]===w&&T.push(C);if(m.userData.parameters.extrudeBevelSize===0){let E=T[0];T[0]=T[1],T[1]=E}M.reverse(),v.push(...M,...T),y.push(A,A),b=void 0}return{indices:v,verticesPerFace:y,uvs:b}}(s,o,n,a,l);return{positions:s,indices:h,verticesPerFace:u,uvs:d}}static allocate(e,t){let i,r,n,a=[],s=[];e.positionWASM&&e.positionWASM.length>0?(i=e.positionWASM,r=e.indexWASM,n=e.verticesPerFaceWASM,ni.alloc_subdivision_surface_uvs&&e.uvWASM&&e.uvWASM.length===2*r.length&&(s=e.uvWASM)):(i=VF,r=kF,n=GF);let o,l=i.length,h=r.length,u=n.length,d=i.length+a.length+s.length,c=r.length+n.length,p=d*Float32Array.BYTES_PER_ELEMENT+c*Uint32Array.BYTES_PER_ELEMENT,m=d*Float32Array.BYTES_PER_ELEMENT,f=ni._malloc(p),g=new Float32Array(ni.HEAPF32.buffer,f,d),v=new Uint32Array(ni.HEAPU32.buffer,f+m,c);g.set(i,0),g.set(a,i.length),g.set(s,i.length+a.length),v.set(r,0),v.set(n,r.length),e?.scaleBaked?.some(b=>b!==1)&&(o=new ke().makeScale(...e.scaleBaked.map(b=>typeof b=="number"?b:1))),t&&(o?o.premultiply(t):o=t);let y=f+(i.length+a.length)*Float32Array.BYTES_PER_ELEMENT,_=s.length?o?ni.alloc_subdivision_surface_uvs2(f,l,f+m,h,f+m+r.length*Uint32Array.BYTES_PER_ELEMENT,u,y,s.length,o.elements):ni.alloc_subdivision_surface_uvs(f,l,f+m,h,f+m+r.length*Uint32Array.BYTES_PER_ELEMENT,u,y,s.length):o?ni.alloc_subdivision_surface2(f,l,f+m,h,f+m+r.length*Uint32Array.BYTES_PER_ELEMENT,u,o.elements):ni.alloc_subdivision_surface(f,l,f+m,h,f+m+r.length*Uint32Array.BYTES_PER_ELEMENT,u);return ni._free(f),_}static buildLevel(e,t,i,r,n,a=!1){let s=n?ni.get_mesh_data2(e,t?ni.Level.CONTROL:ni.Level.REFINED,i,n.elements):ni.get_mesh_data(e,t?ni.Level.CONTROL:ni.Level.REFINED,i),o=ni.HEAPU32.subarray(s>>2,10+(s>>2)),l=o.subarray(4,8),h=0,u=ni.HEAPU32[o[h]>>2],d=ni.HEAPF32.subarray(u>>2,(u>>2)+l[h]);h++;let c=ni.HEAPU32[o[h]>>2],p=ni.HEAPF32.subarray(c>>2,(c>>2)+l[h]);h++;let m=ni.HEAPU32[o[h]>>2],f=ni.HEAPU32.subarray(m>>2,(m>>2)+l[h]);h++;let g,v=ni.HEAPU32[o[h]>>2],y=ni.HEAPU32.subarray(v>>2,(v>>2)+l[h]);if(h++,ni.alloc_subdivision_surface_uvs){let b=o[9];if(b>0){let x=ni.HEAPU32[o[8]>>2];g=ni.HEAPF32.subarray(x>>2,(x>>2)+b)}}if(r===void 0){let b=new At;if(b.setIndex(new zm(y,1)),b.setAttribute("position",new Et(d,3)),b.setAttribute("normal",new Et(p,3)),g&&b.setAttribute("uv",new Et(g,2)),t){b.setAttribute("faceMap",new zm(f,1));let x=new Float32Array(p.length/3*4).fill(0);b.setAttribute("color",new It(x,4))}return ni.free_mesh_data(s),b.userData.type="SubdivGeometry",b}if(r.getAttribute("position").copyArray(d),r.getAttribute("normal").copyArray(p),r.attributes.position.needsUpdate=!0,r.attributes.normal.needsUpdate=!0,a){let b=r.getIndex();b!==null&&b.array.length===y.length&&(b.copyArray(y),b.needsUpdate=!0)}let _=r.getAttribute("uv");g&&_&&_.array.length===g.length&&(_.copyArray(g),_.needsUpdate=!0),ni.free_mesh_data(s)}static freeSubdivPointer(e){ni.free_bvh(e),ni.free_subdivision_surface(e)}static buildControlCageWireframe(e,t,i){let r=ni.get_wireframe_data_for_base_level(e),n=ni.HEAPU32.subarray(r>>2,4+(r>>2)),a=n.subarray(2,4),s=0,o=ni.HEAPU32[n[s]>>2],l=ni.HEAPF32.subarray(o>>2,(o>>2)+a[s]);s++;let h=ni.HEAPU32[n[s]>>2],u=ni.HEAPU32.subarray(h>>2,(h>>2)+a[s]);if(t===void 0){let d=new At;d.setAttribute("position",new Et(l,3));let c=new Float32Array(l.length);for(let p=0,m=l.length;p<m;)c[p++]=i.r,c[p++]=i.g,c[p++]=i.b;return d.setAttribute("color",new It(c,3)),d.setIndex(new zm(u,1)),ni.free_wireframe_data_for_base_level(r),d}t.getAttribute("position").copyArray(l),t.attributes.position.needsUpdate=!0,ni.free_wireframe_data_for_base_level(r)}static updateCollabMesh(e,t,i){let r=t===0;r||ni.set_destination_refinement_level(e,t);let n=i?ni.get_topological_data2(e,r?ni.Level.CONTROL:ni.Level.REFINED,i.elements):ni.get_topological_data(e,r?ni.Level.CONTROL:ni.Level.REFINED),a=ni.HEAPU32.subarray(n>>2,8+(n>>2)),s=a.subarray(3,6),o=0,l=ni.HEAPU32[a[o]>>2],h=new Float32Array(ni.HEAPF32.subarray(l>>2,(l>>2)+s[o]));o++;let u=ni.HEAPU32[a[o]>>2],d=new Uint32Array(ni.HEAPU32.subarray(u>>2,(u>>2)+s[o]));o++;let c,p=ni.HEAPU32[a[o]>>2],m=new Uint8Array(ni.HEAPU32.subarray(p>>2,(p>>2)+s[o]));if(ni.alloc_subdivision_surface_uvs){let f=a[7];if(f>0){let g=ni.HEAPU32[a[6]>>2];c=new Float32Array(ni.HEAPF32.subarray(g>>2,(g>>2)+f))}}return ni.free_topological_data(n),{positions:h,indices:d,verticesPerFace:m,uvs:c}}},BS=new D,m3=new D,f3=new D,g3=new D}),Mbe=k(()=>{Tte(),Mte(),uL(),Ete(),pL(),hA(),kte(),Gte(),jte(),AH(),qte(),mL(),$te(),Xte(),Yte(),CH(),Kte(),Zte(),Qte(),Jte(),Xg(),_r(),Tte(),Mte(),uL(),Ete(),pL(),DOe(),hA(),kte(),Gte(),jte(),AH(),qte(),mL(),$te(),Xte(),Yte(),CH(),Kte(),Zte(),Qte(),Jte(),Xg(),NOe(),ibe(),bbe(),Tw(),U4(),I4(),NH={ConeGeometry:j_e,CubeGeometry:H_e,CylinderGeometry:OX,DodecahedronGeometry:W_e,EllipseGeometry:L4,HelixGeometry:M_e,IcosahedronGeometry:sbe,LatheGeometry:obe,NonParametricGeometry:hbe,PolygonGeometry:UX,PyramidGeometry:ube,RectangleGeometry:B4,SphereGeometry:pbe,PlaneGeometry:mbe,BackdropGeometry:fbe,StarGeometry:FX,TextFrameGeometry:gbe,TorusGeometry:vbe,TorusKnotGeometry:ybe,TriangleGeometry:_be,VectorGeometry:r0},lI=e=>{let t=NH[e.type]??m_e(e.type);if(t===void 0)throw new Error(`No geometry factory registered for "${e.type}" \u2014 was its feature compiled out of this runtime build?`);return t.create(e)}});function Ng(e,t,i,r){let n,a,s;e.type==="PathGeometry"?(a=JSON.parse(JSON.stringify(e)),s=[[],["extrusion"]]):(a={...e},s=[[]]);for(let h of s){let u=a;for(let d of h)u=u[d];for(n in u){let d=u[n];HJ(d)&&!Ebe.includes(n)&&(u[n]=t.getVariable(d,[r.uuid,"geometry",...h,n]),HJ(u[n])&&(u[n]=1))}}let o,l={parameters:a,type:a.type};if(a.type==="PathGeometry")l.path=a.path;else if(a.type==="VectorGeometry"){let h=da.createFromState(a.shape,a.width,a.height);l.shape=h}else if(a.type==="NonParametricGeometry"){if(a.data.groups&&a.data.groups?.forEach(h=>h.materialIndex=Math.max(h.materialIndex??0,0)),l.geometry=new j$().parse(a),l.geometry.groups.length===0){let h=l.geometry;h.addGroup(0,Math.max(h.getIndex()?.count??0,h.getAttribute("position").count),0)}}else{if(a.type==="SubdivGeometry"){let h=new ua(a,i);return h.data=e,h}if(a.type==="TextGeometry"||a.type==="InputGeometry"){let h=m_e(a.type);if(h)return h.create(a,t);Ms("text",`a ${a.type}`);let u=da.createFromState(sA.defaultData(),100,100);return lI({...a,shape:u,type:"VectorGeometry"})}if(a.type==="UIGeometry")return B4.create({parameters:{width:a.width,height:a.height,cornerRadius:a.cornerRadius,cornerType:a.cornerType}})}try{o=lI(l)}catch(h){console.error(h),console.error(`Error generating geometry with inputs: ${l}`);let u=da.createFromState(sA.defaultData(),100,100);l.shape=u,l.type="VectorGeometry",o=lI(l)}return o}var Ebe,rie,IH,F4=k(()=>{$t(),le(),Mbe(),_r(),mL(),i0(),Tw(),Ebe=["font"]}),OOe=k(()=>{F4(),rie=class{constructor(){this.objects=new Map,this.unreachable=new Set}getCached(e){return this.objects.get(e)}get size(){return this.objects.size}get(e,t,i){let r=this.objects.get(e);return r===void 0?(r=this.createObject(e,t,i),this.objects.set(e,r)):r.isShared=!0,r}forceDelete(e){let t=this.objects.get(e);t&&(this.disposeObject(t),this.objects.delete(e))}adopt(e,t){this.objects.set(e,t)}mutateIfUnique(e,t){let i=this.objects.get(e);if(i&&i.isShared!==!0)return this.objects.delete(e),this.objects.set(t,i),i}startGc(){this.unreachable=new Set(this.objects.keys())}markAsReachable(e,t){t===this.objects.get(e)&&this.unreachable.delete(e)}endGc(){this.unreachable.forEach(e=>{this.disposeObject(this.objects.get(e)),this.objects.delete(e)}),this.unreachable.clear()}dispose(){this.objects.forEach(e=>{this.disposeObject(e)}),this.objects.clear()}},IH=class extends rie{constructor(e){super(),this.flatShading=e}disposeObject(e){e.dispose()}createObject(e,t,i){let r=Ng(e,t,this.flatShading,i);return r.computeBoundingSphere(),r}}});function fL(){return NA}function Abe(){if(NA==="webgpu"){if(LH!==void 0)return LH;UH||(UH=!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(BH===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 BH}function Cbe(e,t){return Abe().createRootMaterial(e,t)}function nie(e,t,i){return Abe().createSharedMaterial(e,t,i)}function aie(e){return e.getLayersOfType===void 0&&Object.assign(e,{layers:[],getLayersOfType:()=>[],hasAO:!1,assetsLoaded:()=>!0}),e}function OH(){return Rbe}var NA,LH,BH,UH,FH,Pbe,Rbe,zH,Dbe,Ym=k(()=>{NA="webgl",UH=!1}),LOe=k(()=>{Dbe={markNeedsUpdateRendererDirty:()=>{}}});function Td(e,t){let i=0;if(!e.layers||e.layers.length===0)return!1;let r=e.layers?.find(n=>n.data.type==="light");if(r){let n=r.data,a=Number(t.getVariable(n.alphaOverride));if((typeof n.alphaOverride=="string"?a/100:n.alphaOverride)<1)return!0}for(let n of e.layers){if(n.data.type!=="displace"&&n.data.isMask)return!0;if(n.data.type!=="displace"&&"alpha"in n.data&&n.data.type!=="light"&&n.data.type!=="fresnel"&&n.data.type!=="cavity"&&n.data.type!=="dust"&&n.data.type!=="texture"&&n.data.type!=="matcap"&&n.data.type!=="rainbow"&&n.data.type!=="outline"&&n.data.type!=="pattern"){let a=n.data.visible?n.data.alpha:0;if(typeof a=="string"&&(a=Math.max(0,Math.min(1,Number(t.getVariable(a)??100)/100))),a===1&&n.data.type==="depth"||n.data.type==="gradient"){for(let s of n.data.colors)if(s[3]<1){a=s[3];break}}else if(a===1&&n.data.type==="noise"){let s=t.color(n.data.colorA).a,o=t.color(n.data.colorB).a,l=t.color(n.data.colorC).a,h=t.color(n.data.colorD).a,u=Math.min(s,Math.min(o,Math.min(l,h)));u<1&&(a=u)}i+=(1-i)*a}}return i<1}var z4=k(()=>{});function km(e){return typeof e=="string"||typeof e=="number"&&e!==0}var Oh,Lt,Mw,kX,sie,oie,Dh,Pd=k(()=>{Oh=(e,t,i)=>Math.max(0,Math.min(1,Number(t.getVariable(typeof e=="number"?100*e:e,i)??100)/100))??1,Lt=(e,t,i)=>typeof e=="number"?e:t.getVariable(e,i),Mw={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"]},kX={depth:["colors"],gradient:["colors","steps"],toon:["colors","steps"]}}),Ew=k(()=>{le(),DA(),sie=class extends R4(un){},oie=e=>e.type==="Mesh",Dh=class extends sie{constructor(e){super(),this.object=e,this.isClone=!0,this.matrixAutoUpdate=!1,this.hasNonUniformScale=e.hasNonUniformScale}raycast(e,t){}expand(){let e=0,t=this.object.entityChildren(e);for(;t;){let i=this.children[e];i?.object!==t&&(i&&this.remove(i),i=new Dh(t),this.add(i),this.children.splice(e,0,this.children.pop()),i.matrixWorldNeedsUpdate=!0,i.matrixAutoUpdate=!1,i.matrix=t.matrix,i.hiddenMatrix=t.hiddenMatrix,i.pivotMatrix=t.pivotMatrix),i.expand(),e+=1,t=this.object.entityChildren(e)}for(;this.children.length>e;)this.remove(this.children[e]);this.pivotMatrix=this.object.pivotMatrix}get visible(){let e=this.object.cloner;return(e===void 0||this.parent!==e||!e.instancingActive&&!e.insideBoolean)&&(this.playModeVisible!==void 0?this.playModeVisible:this.object.visible||this.object.dataPatched.visible&&this.object.dataPatched.cloner?.hideBase===!0)}set visible(e){}get castShadow(){return this.object.castShadow}set castShadow(e){}get receiveShadow(){return this.object.receiveShadow}set receiveShadow(e){}get isMesh(){return oie(this.object)}get isLight(){return this.object.isLight}get layers(){return this.object.layers}set layers(e){}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(e){}}});function lie(){return GX}var GX,jX,HX=k(()=>{GX=null,jX=null});function VH(e){return"variable_"+e}var jF,HF,WF,hie,qF,uie,die,gL,WX=k(()=>{$t(),O_e(),z_e(),O4(),wu(),DX(),IX(),OOe(),Ym(),B_e(),LOe(),z4(),Pd(),xl(),Ew(),Nr(),le(),HX(),_r(),jF=new ke,HF=new D,WF=new Zt,hie=new D,qF=new pn,uie=class extends N_e{constructor(e){super(),this.shared=e}create(e){return new RX(e,this.shared)}},(gL=die=class{constructor(e,t={},i=!0,r=!1){if(this.data=e,this.needsJitter=i,this.enableLocalStorageForPersistentVariables=r,this.geometryCache=new IH(!0),this.geometryCache2=new IH(!1),this.imageHolderCache=new uie(this),this.thisContext={scene:Dbe,shared:this},this.deletedImage=new Nc(tH.emptyImage,this),this.deletedVideo=new Nc($O.defaultVideo,this),this.materials={},this.images={},this.uiBuffers={},this.videos={},this.colors={},this.audios={},this.particles={},this.fonts={},this.timelineAnimations={},this.variables={},this.userAPIs={},this.userWebhooks={},this.mouseProperty=null,this.raycastProperty=null,this.requestRender=()=>{this._requestRender&&this._requestRender()},this.transientGeometryKeys=new WeakSet,t.images)for(let[n,a]of Object.entries(t.images))this.addImage(n,a);if(t.videos)for(let[n,a]of Object.entries(t.videos))this.addVideo(n,a);if(t.audios)for(let[n,a]of Object.entries(t.audios))this.addAudio(n,a);if(t.particles)for(let[n,a]of Object.entries(t.particles))this.addParticle(n,a);this.reset(e)}get deletedMaterial(){return this._deletedMaterial??(this._deletedMaterial=nie(ra.defaultTwoLayerData("phong"),this.thisContext,"")),this._deletedMaterial}setRequestRender(e){this._requestRender=e}getImageLoadPromises(){return Object.values(this.images).map(e=>e.loadPromise)}setEntityOpContext(e){this.entityOpContext=e}reset(e,t=!1,i=!1){this.data=e,this.resetLib(e.lib);for(let{id:r,data:n}of e.variables)this.addVariableHolder(r,n),t&&this.updateVariableHolder(r,n);for(let[r,n]of Object.entries(e.userAPIs??{}))this.addUserAPI(r,n);for(let[r,n]of Object.entries(e.userWebhooks??{}))this.addUserWebhook(r,n);if(!i){for(let[r,n]of Object.entries(e.images))this.addImage(r,n);for(let[r,n]of Object.entries(e.videos))this.addVideo(r,n)}for(let[r,n]of Object.entries(e.colors))this.addColor(r,n);for(let[r,n]of Object.entries(e.lib.materials))this.addMaterial(r,n.asset);for(let[r,n]of Object.entries(e.materials))this.addMaterial(r,n);for(let[r,n]of Object.entries(e.audios))this.addAudio(r,n);for(let[r,n]of Object.entries(e.particles))this.addParticle(r,n);for(let[r,n]of Object.entries(e.fonts))this.addFont(r,n);for(let[r,n]of Object.entries(e.timelineAnimations??{}))this.addAnimation(r,n)}addMaterial(e,t){if(t.layers===void 0&&(t={...t,layers:ra.defaultTwoLayerData("phong").layers}),this.materials[e]){let i=this.materials[e];i.reset(t,this.thisContext),i.dispose()}else{let i=nie(t,this.thisContext,e);this.materials[e]=i}}deleteMaterial(e){this.materials[e]&&(this.materials[e].nodeMaterialDispose(),delete this.materials[e])}getMaterial(e){return this.materials[e]}getMaterialOrDeletedPlaceholder(e){return this.materials[e]??this.deletedMaterial}material(e){return typeof e=="string"?this.getMaterialOrDeletedPlaceholder(e):e==null?(console.error("material is undefined or null"),this.deletedMaterial):(e.layers===void 0&&(e={...e,layers:ra.defaultTwoLayerData("phong").layers}),Cbe(e,this.thisContext))}getMaterials(){return this.materials}addImage(e,t){return this.images[e]?(this.onColorOrImageUpdate&&this.onColorOrImageUpdate(),this.images[e].updateSrc(t.data),!0):(this.images[e]=new Nc(t,this),!1)}deleteImage(e){let t=this.images[e];t&&(t.dispose(),delete this.images[e])}getDefaultImage(){return this.images.image_0}getImage(e){return this.images[e]??this.deletedImage}image(e){return typeof e=="string"?this.getImage(e):this.imageHolderCache.load(e)}addUIBuffer(e,t){return this.uiBuffers[e]?(this.onColorOrImageUpdate&&this.onColorOrImageUpdate(),this.uiBuffers[e].updateSrc(t),!0):(this.uiBuffers[e]=new Nc(t,this),!1)}uiBuffer(e){return this.uiBuffers[e]}addVideo(e,t){return this.videos[e]?(this.videos[e].updateSrc(t.data),!0):(this.videos[e]=new Nc(t,this),!1)}deleteVideo(e){let t=this.videos[e];t&&(t.dispose(),delete this.videos[e])}getVideo(e){return this.videos[e]??this.deletedVideo}video(e){return typeof e=="string"?this.getVideo(e):this.imageHolderCache.load(e)}addColor(e,t){return this.colors[e]?(this.onColorOrImageUpdate&&this.onColorOrImageUpdate(),"a"in t?this.colors[e].setRGBA(t.r,t.g,t.b,t.a):this.colors[e].setRGBA(t.r,t.g,t.b,1),!0):(this.colors[e]=new cA(t.r,t.g,t.b,"a"in t?t.a:1),!1)}updateColor(e,t){if(this.colors[e]){this.onColorOrImageUpdate&&this.onColorOrImageUpdate();let i=this.colors[e];return this.colors[e].r=t.r??i.r,this.colors[e].g=t.g??i.g,this.colors[e].b=t.b??i.b,this.colors[e].a=t.a??i.a,!0}return!1}deleteColor(e){this.colors[e]&&delete this.colors[e]}getColor(e){return this.colors[e]}getColorNames(){return Object.values(this.data.colors).map(e=>e.name)}getColorByName(e){for(let t in this.data.colors)if(this.data.colors[t].name===e)return{color:this.colors[t],id:t}}color(e){let t;if(typeof e!="string")return new Fr(e.r,e.g,e.b,"a"in e?e.a:1);{let i=this.getColor(e);i?t=i:(console.warn("Tried to create color layer params with a color key that does not exist in the assets manager"),t=new Fr(0,0,0,0))}return t}addAudio(e,t){this.audios[e]=t}getAudio(e){let t=this.audios[e];if(t instanceof nx)return t;{let i=new nx({src:t.data});return this.audios[e]=i,i}}addParticle(e,t){this.particles[e]=t}getParticle(e){return this.particles[e]}deleteParticle(e){this.particles[e]&&delete this.particles[e]}deleteAudio(e){let t=this.audios[e];t&&(t instanceof nx&&t.dispose(),delete this.audios[e])}addFont(e,t){let i=NX;i!==null?(this.fonts[e]=new i(t),this.fonts[e].loadingPromise.then(()=>this.requestRender())):Ms("text","a font asset")}getFont(e){return this.fonts[e]}deleteFont(e){this.fonts[e]&&delete this.fonts[e]}addAnimation(e,t){this.timelineAnimations[e]=t}getAnimation(e){return this.timelineAnimations[e]}deleteAniamtion(e){this.timelineAnimations[e]&&delete this.timelineAnimations[e]}dispose(){Object.keys(this.materials).forEach(e=>this.deleteMaterial(e)),this._requestRender=void 0,Object.values(this.audios).forEach(e=>{e instanceof nx&&e.dispose()}),this.audios={},this.particles={},this.geometryCache.dispose(),this.geometryCache2.dispose()}addVariableHolder(e,t){if(this.variables[e]===void 0){let i=t.value;if(this.enableLocalStorageForPersistentVariables&&t.persistent){let r=localStorage.getItem(VH(e));i=r!==null?JSON.parse(r):t.value}return this.variables[e]={value:i,locations:[],persistent:t.persistent},"dynamicVariableType"in t&&(this.variables[e].dynamicVariablePlayState="Playing",this.variables[e].dynamicVariableToggleIsForward=void 0),!0}return this.variables[e].value=t.value,!1}resetDynamicVariablePlayState(){for(let e in this.variables)this.variables[e].dynamicVariablePlayState!==void 0&&(this.variables[e].dynamicVariablePlayState="Playing",this.variables[e].dynamicVariableToggleIsForward=void 0)}updateVariableHolder(e,t){this.updateVariable(e,t.value)}updateVariable(e,t){if(this.variables[e]===void 0)return!1;this.variables[e].value=t,this.enableLocalStorageForPersistentVariables&&this.variables[e].persistent&&localStorage.setItem(VH(e),JSON.stringify(t));let i=t;for(;typeof i=="string";)i=this.variables[i].value;let r=this.entityOpContext.scene,n=!1;for(let a=this.variables[e].locations.length-1;a>=0;a--){let s=this.variables[e].locations[a];if(s[0]==="material"){let o=s[1],l=i,h={scene:r,shared:this},u=s.slice(2);r.traverseMaterial(c=>{let p=c.root??c;p.uuid===o&&p.onVariableUpdate(u,l,h)});let d=this.materials[o];d&&d.onVariableUpdate(u,l,h)}else{let o=r.find(s[0]);if(o===void 0){this.variables[e].locations.splice(a,1);continue}if(n=!0,s[1]!=="geometry"&&s[1]!=="particles"){for(let l=1;l<s.length-1;l++)o=o[s[l]];s[1]==="rotation"?o[s[s.length-1]]=i*ht.DEG2RAD:o[s[s.length-1]]=i}if(o=r.find(s[0]),o.type==="ParticleEmitter"&&o.updateVariableState(i,s),hr.is(o))if(s[1]==="position"||s[1]==="rotation"||s[1]==="scale")o.onVariableUpdate();else if(s[1]==="geometry"){let l=o;o.component&&(l=o.component);let h=l.dataPatched;l.chooseGeoemtryCache(this).forceDelete(h.geometry),l.createGeometryDelayed(this.entityOpContext),l.onVariableUpdate(!0),l.invalidateDownstreamBooleanData(),l.instances.forEach(u=>{let d=u.dataPatched;u.chooseGeoemtryCache(this).forceDelete(d.geometry),u.createGeometryDelayed(this.entityOpContext),u.onVariableUpdate(!0),u.invalidateDownstreamBooleanData()})}else s[1]==="morphTargetInfluences"&&o.updateMorphInfluences(s[2],i)}}return n&&r.markShadowsDirty(),this.requestRender(),!0}updateEntityGeometryParams(e,t){let i=e;if(i.component&&(i=i.component),typeof i.chooseGeoemtryCache!="function")return!1;let r=i.dataPatched,n=r?.geometry;if(!n||typeof n.type!="string"||n.type==="VectorGeometry"||n.type==="PathGeometry")return!1;let a=h=>h.toLowerCase().replace(/[\s_.-]+/g,""),s=new Map;for(let h of Object.keys(n))s.set(a(h),h);let o={};for(let[h,u]of Object.entries(t??{})){let d=s.get(a(h));if(d===void 0||d==="type"||d==="font"||d==="shape"||d==="path"||d==="data")continue;if(d==="text"){(typeof u=="string"||typeof u=="number")&&(o[d]={textValue:String(u)});continue}let c=n[d];typeof u=="number"&&isFinite(u)&&(typeof c=="number"||typeof c=="string")&&(o[d]=u)}if(Object.keys(o).length===0)return!1;let l={...n,...o};return i.dataPatched={...r,geometry:l},this.transientGeometryKeys.has(n)&&i.chooseGeoemtryCache(this).forceDelete(r.geometry),this.transientGeometryKeys.add(l),i.createGeometryDelayed(this.entityOpContext),i.onVariableUpdate(!0),i.invalidateDownstreamBooleanData(),this.entityOpContext.scene.markShadowsDirty(),this.requestRender(),!0}resetEntityGeometryParams(e){let t=e;if(t.component&&(t=t.component),typeof t.chooseGeoemtryCache!="function")return!1;let i=t.dataPatched?.geometry;return!(!i||!this.transientGeometryKeys.has(i)||(t.dataPatched=t.data,t.chooseGeoemtryCache(this).forceDelete(i),t.createGeometryDelayed(this.entityOpContext),t.onVariableUpdate(!0),t.invalidateDownstreamBooleanData(),this.entityOpContext.scene.markShadowsDirty(),this.requestRender(),0))}updateEntityGeometryVertices(e,t){let i=e;if(i.component&&(i=i.component),typeof i.chooseGeoemtryCache!="function")return!1;let r=i.dataPatched,n=r?.geometry;if(!n||n.type!=="NonParametricGeometry")return!1;let a=t?.vertices;if(a===void 0||typeof a.length!="number"||a.length<9||a.length%3!=0||a.length/3>die.MAX_TRANSIENT_VERTICES)return!1;let s,o,l,h=a instanceof Float32Array?a:Float32Array.from(a),u=h.length/3;if(t.normals!==void 0){if(t.normals.length!==h.length)return!1;s=t.normals instanceof Float32Array?t.normals:Float32Array.from(t.normals)}if(t.uvs!==void 0){if(t.uvs.length!==2*u)return!1;o=t.uvs instanceof Float32Array?t.uvs:Float32Array.from(t.uvs)}if(t.indices!==void 0){let x=u>65535?Uint32Array.from(t.indices):Uint16Array.from(t.indices);if(x.length===0||x.length%3!=0)return!1;for(let w=0;w<x.length;w++)if(x[w]>=u)return!1;l={array:x,itemSize:1,type:x.constructor.name,normalized:!1}}else{let x=n.data,w=x?.index;if(w?.array?.length){if(u<(x?.attributes?.position?.array?.length??0)/3){let S=w.array;for(let M=0;M<S.length;M++)if(S[M]>=u)return!1}l=w}}let d=1/0,c=1/0,p=1/0,m=-1/0,f=-1/0,g=-1/0;for(let x=0;x<h.length;x+=3){let w=h[x],S=h[x+1],M=h[x+2];w<d&&(d=w),w>m&&(m=w),S<c&&(c=S),S>f&&(f=S),M<p&&(p=M),M>g&&(g=M)}let v=(x,w)=>({array:x,itemSize:w,type:"Float32Array",normalized:!1}),y={position:v(h,3)};s&&(y.normal=v(s,3)),o&&(y.uv=v(o,2));let _={...n,width:m-d,height:f-c,depth:g-p,data:{attributes:y,...l?{index:l}:{}}},b=this.transientGeometryKeys.has(n);return i.dataPatched={...r,geometry:_},this.transientGeometryKeys.add(_),i.applyTransientGeometryData(this.entityOpContext,b),i.onVariableUpdate(!0),i.invalidateDownstreamBooleanData(),this.entityOpContext.scene.markShadowsDirty(),this.requestRender(),!0}setEntityInstanceTransforms(e,t){let i=e;i.component&&(i=i.component);let r=i.cloner;if(r===void 0)return-1;let n=r.children,a=Math.PI/180,s=!1;if(t===null)for(let o of n)o.transformOverride!==void 0&&(o.transformOverride=void 0,s=!0);else{if(!Array.isArray(t))return n.length;{let o=Math.min(t.length,n.length);for(let l=0;l<o;l++){let h=t[l],u=n[l];if(h==null){u.transformOverride!==void 0&&(u.transformOverride=void 0,s=!0);continue}let d=u.transformOverride??{position:[u.position.x,u.position.y,u.position.z],rotation:[u.rotation.x,u.rotation.y,u.rotation.z],scale:[u.scale.x,u.scale.y,u.scale.z]};h.position&&(typeof h.position.x=="number"&&(d.position[0]=h.position.x),typeof h.position.y=="number"&&(d.position[1]=h.position.y),typeof h.position.z=="number"&&(d.position[2]=h.position.z)),h.rotation&&(typeof h.rotation.x=="number"&&(d.rotation[0]=h.rotation.x*a),typeof h.rotation.y=="number"&&(d.rotation[1]=h.rotation.y*a),typeof h.rotation.z=="number"&&(d.rotation[2]=h.rotation.z*a)),h.scale&&(typeof h.scale.x=="number"&&(d.scale[0]=h.scale.x),typeof h.scale.y=="number"&&(d.scale[1]=h.scale.y),typeof h.scale.z=="number"&&(d.scale[2]=h.scale.z)),u.transformOverride=d,u.position.fromArray(d.position),u.rotation.fromArray(d.rotation),u.scale.fromArray(d.scale),u.updateMatrix(),u.hasNonUniformScale&&(u.updateMatrixWorld(),u.updateMatrixWorldRigid())}}}return s?r.update(this.entityOpContext):r.syncInstanceMatrices(),r.invalidateTransform(i),this.entityOpContext.scene.markShadowsDirty(),this.requestRender(),n.length}spawnRuntimeClone(e,t={}){if(typeof e.entityChildren!="function")return;let i=e.parent;if(i===null)return;let r=new Dh(e);r.playModeVisible=t.visible!==!1,r.expand(),typeof t.name=="string"&&(r.name=t.name);let n=Math.PI/180;return r.position.copy(e.position),r.rotation.copy(e.rotation),r.scale.copy(e.scale),r.hiddenMatrix.copy(e.hiddenMatrix),t.position&&(typeof t.position.x=="number"&&(r.position.x=t.position.x),typeof t.position.y=="number"&&(r.position.y=t.position.y),typeof t.position.z=="number"&&(r.position.z=t.position.z)),t.rotation&&(typeof t.rotation.x=="number"&&(r.rotation.x=t.rotation.x*n),typeof t.rotation.y=="number"&&(r.rotation.y=t.rotation.y*n),typeof t.rotation.z=="number"&&(r.rotation.z=t.rotation.z*n)),t.scale&&(typeof t.scale.x=="number"&&(r.scale.x=t.scale.x),typeof t.scale.y=="number"&&(r.scale.y=t.scale.y),typeof t.scale.z=="number"&&(r.scale.z=t.scale.z)),r.updateMatrix(),i.add(r),r.updateWorldMatrix(!0,!0),this.entityOpContext.scene.markShadowsDirty(),this.requestRender(),r}destroyRuntimeClone(e){e.removeFromParent(),this.entityOpContext.scene.markShadowsDirty(),this.requestRender()}updateEntityMaterialParams(e,t){let i=e.material;if(!i)return!1;let r=[];for(let h of Array.isArray(i)?i:[i]){let u=h.root??h;u&&Array.isArray(u.layers)&&u.data&&!r.includes(u)&&r.push(u)}if(r.length===0)return!1;let n={scene:this.entityOpContext.scene,shared:this},a=h=>h.toLowerCase().replace(/[\s_.-]+/g,""),s=h=>{if(typeof h=="string"){let u=new Fr(1,1,1,1);try{u.set(h)}catch{return null}return{r:u.r,g:u.g,b:u.b,a:void 0}}if(h&&typeof h=="object"&&"r"in h){let u=h;if([u.r,u.g,u.b].some(c=>typeof c!="number"||!isFinite(c)))return null;let d=Math.max(u.r,u.g,u.b)>1?1/255:1;return{r:u.r*d,g:u.g*d,b:u.b*d,a:typeof u.a=="number"?Math.max(0,Math.min(u.a,1)):void 0}}return null},o=(h,u,d)=>{if(!h.hasValue(u))return!1;let c=h.getValue(u);if(!c||typeof c!="object"||!c.isColor)return!1;let p=d.a??(typeof c.a=="number"?c.a:1);return c instanceof cA?h.setValue(u,new Fr(d.r,d.g,d.b,p)):typeof c.setRGBA=="function"?c.setRGBA(d.r,d.g,d.b,p):c.setRGB(d.r,d.g,d.b),!0},l=!1;for(let h of r){let u=h.data.layers??[],d=c=>h.layers.find(p=>p.uuid===c);if(t.color!==void 0){let c=s(t.color),p=u.find(f=>f.data.type==="color"),m=p&&d(p.id);if(c&&m&&o(m,"color",c)&&(l=!0,c.a!==void 0)){let f=c.a<1||Td(h.data,this);h.setTransparent?h.setTransparent(f,n.scene):h.transparent=f}}typeof t.alpha=="number"&&isFinite(t.alpha)&&(h.onVariableUpdate?.(["alphaOverride"],Math.max(0,Math.min(t.alpha,100)),n),l=!0);for(let c of t.layers??[]){if(!c||typeof c!="object")continue;let p=typeof c.id=="string"?u.find(v=>v.id===c.id):typeof c.index=="number"?u[c.index]:typeof c.type=="string"?u.find(v=>v.data.type===c.type):void 0,m=p&&d(p.id);if(!p||!m)continue;let f=Mw[p.data.type]??[],g=Object.keys(p.data);for(let[v,y]of Object.entries(c)){if(v==="id"||v==="index"||v==="type")continue;let _=g.find(x=>x===v)??g.find(x=>a(x)===a(v))??v;if(f.includes(_))continue;let b=s(y);if(b&&o(m,_,b))l=!0;else if(typeof y=="number"&&isFinite(y))h.onVariableUpdate?.(["layer",p.id,_],y,n),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)=>{h.onVariableUpdate?.(["layer",p.id,_,x[S]],w,n)}),l=!0}}}}return l&&this.requestRender(),l}deleteVariable(e){this.variables[e]&&delete this.variables[e]}getVariable(e,t){if(Array.isArray(e)){if(e[0]==="mouse")return this.mouseProperty?.[e[1]]??0;if(e[0]==="raycast")return this.raycastProperty?.[e[1]]??0;let i=this.entityOpContext.scene.find(e[0]);if(e[1]==="width"||e[1]==="height"||e[1]==="depth")return i.geometry.userData.parameters[e[1]];if((e[1]==="position"||e[1]==="rotation")&&e.length>2&&i?.getPhysicsLocalMatrix?.(jF))return jF.decompose(HF,WF,hie),e[1]==="position"?HF[e[2]]:(qF.setFromQuaternion(WF,i.rotation.order),qF[e[2]]*ht.RAD2DEG);for(let r=1;r<e.length;r++)i=i[e[r]];return e[1]==="rotation"&&(i*=ht.RAD2DEG),i}for(let i in this.variables){if(t===void 0)break;let r=this.variables[i],n=r.locations?.findIndex(a=>Ts.equal(a,t));n!==void 0&&n!==-1&&r.locations.splice(n,1)}if(typeof e=="string"){let i=e,r=e;do{if(r=i,this.variables[i]===void 0)break;let n=this.variables[i].value;t&&this.variables[r]!==void 0&&this.variables[r].locations.push(t),i=n}while(typeof i=="string");return i}return e}getVariables(){return this.variables}getVariablesNames(){return this.data.variables.map(e=>e.data.name)}getVariableByName(e){for(let t of this.data.variables)if(t.data.name===e)return{variable:t.data,id:t.id}}getDynamicVariablePlayState(e){return this.variables[e]?.dynamicVariablePlayState}setDynamicVariablePlayState(e,t){this.variables[e]!==void 0&&(this.variables[e].dynamicVariablePlayState=t)}getDynamicVariableToggleIsForward(e){return this.variables[e]?.dynamicVariableToggleIsForward}setDynamicVariableToggleIsForward(e,t){this.variables[e]!==void 0&&(this.variables[e].dynamicVariableToggleIsForward=t)}resetLib(e){for(let[t,i]of Object.entries(e.images))this.addImage(t,i.asset);for(let[t,i]of Object.entries(e.audios))this.addAudio(t,i.asset);for(let[t,i]of Object.entries(e.particles))this.addParticle(t,i.asset);for(let[t,i]of Object.entries(e.colors))this.addColor(t,i.asset);for(let[t,i]of Object.entries(e.fonts))this.addFont(t,i.asset);for(let[t,i]of Object.entries(e.videos))this.addVideo(t,i.asset);for(let[t,i]of Object.entries(e.variables))this.addVariableHolder(t,i.asset)}updateLibByOp(e,t){e.path[0]==="images"?e.path.length===1&&e.type===1?this.addImage(e.id,e.data.asset):e.path.length===1&&e.type===2&&this.deleteImage(e.id):e.path[0]==="videos"?e.path.length===1&&e.type===1?this.addVideo(e.id,e.data.asset):e.path.length===1&&e.type===2&&this.deleteVideo(e.id):e.path[0]==="audios"?e.path.length===1&&e.type===1?this.addAudio(e.id,e.data.asset):e.path.length===1&&e.type===2&&this.deleteAudio(e.id):e.path[0]==="particles"?e.path.length===1&&e.type===1?this.addParticle(e.id,e.data.asset):e.path.length===1&&e.type===2&&this.deleteParticle(e.id):e.path[0]==="colors"?e.path.length===1&&e.type===1?this.addColor(e.id,e.data.asset):e.path.length===1&&e.type===2&&this.deleteColor(e.id):e.path[0]==="materials"?e.path.length===1&&e.type===1?this.addMaterial(e.id,e.data.asset):e.path.length===1&&e.type===2&&this.deleteMaterial(e.id):e.path[0]==="fonts"?e.path.length===1&&e.type===1?this.addFont(e.id,e.data.asset):e.path.length===1&&e.type===2&&this.deleteFont(e.id):e.path[0]==="variables"?e.path.length===1&&e.type===1?this.addVariableHolder(e.id,e.data.asset):e.path.length===1&&e.type===2&&this.deleteVariable(e.id):e.path[0]==="components"&&t.updateByLibOp(e,this)}updateByOp(e,t,i){if(this.data=t,e.path[0]==="images")e.path.length===2&&e.type===0?e.props.data&&this.getImage(e.path[1]).updateSrc(e.props.data):e.path.length===1&&e.type===1?this.addImage(e.id,e.data):e.path.length===1&&e.type===2&&this.deleteImage(e.id);else if(e.path[0]==="videos")e.path.length===2&&e.type===0?e.props.data&&this.getVideo(e.path[1]).updateSrc(e.props.data):e.path.length===1&&e.type===1?this.addVideo(e.id,e.data):e.path.length===1&&e.type===2&&this.deleteVideo(e.id);else if(e.path[0]==="audios")e.path.length===2&&e.type===0?e.props.data&&this.addAudio(e.path[1],t.audios[e.path[1]]):e.path.length===1&&e.type===1?this.addAudio(e.id,e.data):e.path.length===1&&e.type===2&&this.deleteAudio(e.id);else if(e.path[0]==="particles")e.path.length===2&&e.type===0?e.props.data&&this.addParticle(e.path[1],t.particles[e.path[1]]):e.path.length===1&&e.type===1?this.addParticle(e.id,e.data):e.path.length===1&&e.type===2&&this.deleteParticle(e.id);else if(e.path[0]==="colors")e.path.length===2&&e.type===0?this.updateColor(e.path[1],e.props):e.path.length===1&&e.type===1?this.addColor(e.id,e.data):e.path.length===1&&e.type===2&&this.deleteColor(e.id);else if(e.path[0]==="materials")e.path.length===1&&e.type===1?this.addMaterial(e.id,e.data):e.path.length===1&&e.type===2?this.deleteMaterial(e.id):e.path.length>1&&this.getMaterial(e.path[1]).updateByOp($s.drop(e,2),t.materials[e.path[1]],{shared:this,scene:i});else if(e.path[0]==="fonts")e.path.length===2&&e.type===0?this.updateFont(e.path[1],e,i):e.path.length===1&&e.type===1?this.addFont(e.id,e.data):e.path.length===1&&e.type===2&&this.deleteFont(e.id);else if(e.path[0]==="variables")e.path.length===2&&e.type===0?"value"in e.props?this.updateVariable(e.path[1],e.props.value):"persistent"in e.props&&(this.variables[e.path[1]].persistent=e.props.persistent):e.path.length===1&&e.type===4?this.addVariableHolder(e.id,e.data):e.path.length===1&&e.type===5&&this.deleteVariable(e.id);else if(e.path[0]==="userAPIs"){if(e.path.length===1&&e.type===1)this.addUserAPI(e.id,e.data);else if(e.path.length===1&&e.type===2)this.deleteUserAPI(e.id);else if(typeof e.path[1]=="string"){let r=t.userAPIs[e.path[1]];if(r){let n=e.type===0&&e.props.debounce===void 0,a=this.getUserAPI(e.path[1]);a!==void 0&&a===this.openAIRealtime?a.update(r):a?.update(r,this,n)}}}else if(e.path[0]==="userWebhooks"){if(e.path.length===1&&e.type===1)this.addUserWebhook(e.id,e.data);else if(e.path.length===1&&e.type===2)this.deleteUserWebhook(e.id);else if(typeof e.path[1]=="string"){let r=t.userWebhooks[e.path[1]];r&&this.getUserWebhook(e.path[1])?.update(r)}}else e.path[0]==="lib"&&this.updateLibByOp($s.drop(e,1),i)}updateFont(e,t,i){if(t.props.url){let r=this.getFont(e),n={...this.data.fonts[e],url:t.props.url};r.update(n),r.loadingPromise.then(()=>this.requestRender()),i.updateFont(e,this)}}addUserAPI(e,t){if(this.userAPIs[e])return this.userAPIs[e].update(t,this),!0;if(this.openAIRealtime?.id===e)return this.openAIRealtime.update(t),!0;if(t.integration?.type==="VoiceAssistant"){let i=jX;return i===null?(Ms("ai-assistant","a voice-assistant integration"),!1):(this.openAIRealtime=i(t,e,this),!1)}{let i=lie();return i===null?(Ms("api-services","a user API integration"),!1):(this.userAPIs[e]=i.createUserAPI(e,t,this),!1)}}getUserAPI(e){return this.openAIRealtime?.id===e?this.openAIRealtime:this.userAPIs[e]}getUserAPIs(){return this.userAPIs}deleteUserAPI(e){let t=this.userAPIs[e];t&&(t.dispose(),delete this.userAPIs[e])}addUserWebhook(e,t){if(this.userWebhooks[e])return this.userWebhooks[e].update(t),!0;{let i=lie();return i===null?(Ms("api-services","a user webhook"),!1):(this.userWebhooks[e]=i.createUserWebhook(e,t),!1)}}getUserWebhook(e){return this.userWebhooks[e]}getUserWebhooks(){return this.userWebhooks}deleteUserWebhook(e){let t=this.userWebhooks[e];t&&(t.dispose(),delete this.userWebhooks[e])}get scene(){return this.entityOpContext.scene}}).MAX_TRANSIENT_VERTICES=6e4,new gL(gu.emptyData())});function Nbe(e){return lL(e)||e?.isTSLNodeMaterial===!0}var bl,$F,XF,YF,cie,KF,An,Ibe=k(()=>{PX()}),c1=k(()=>{$t(),io(),Ym(),Ibe(),Nr(),Js(),bl=class extends Sa{setMaterialOverride(e,t){this.materialOverride=aie(e),this.material!==this.shadowCatcherMaterial&&(this.disposeMaterial(),this.material=this.materialOverride,this.layers.set(0),this.syncShapeBlendNodeLayer(),t.scene.markNeedsUpdateRendererDirty())}updateByPatchedOp(e,t,i){if(super.updateByPatchedOp(e,t,i),Qr(e.path,["geometry"])&&this.syncShadowCatcher(i),function(r,n){let a=[];if(n.length!==r.length)return null;{let s=0;for(;s<r.length;){if(n[s]==="*")a.push(r[s]);else if(r[s]!==n[s])return null;s+=1}}return a}(e.path,["materials"])!==null&&e.type===0&&Array.isArray(this.material))for(let[r,n]of Object.entries(e.props)){let a=this.material[Number(r)],s=i.shared.material(n);s!==a&&bl.disposeOneMaterial(a),this.material[Number(r)]=s}else if(Qr(e.path,["material"])){let r=this.material;!Array.isArray(r)&&typeof r?.updateByOp=="function"&&"material"in t&&typeof t.material!="string"&&r.updateByOp($s.drop(e,1),t.material,i)}else if(Qr(e.path,["materials","*"])&&Array.isArray(this.material)){let r=e.path[1];if("materials"in t&&r<this.material.length){let n=t.materials[r];typeof n!="string"&&this.material[r].updateByOp($s.drop(e,2),n,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(e,t){super.updateState(e,t),e.castShadow!==void 0&&(this.castShadow=e.castShadow),e.receiveShadow!==void 0&&(this.receiveShadow=e.receiveShadow);let i,r=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 n=this.materialOverride!==void 0;!n&&e.geometry?.type!=="NonParametricGeometry"&&"material"in e&&e.material!==void 0&&(this.disposeMaterial(),this.material=t.shared.material(e.material).getFlavor(r.flatShading,r.side,r.wireframe,i),t.scene.markNeedsUpdateRendererDirty()),!n&&(e.geometry?.type==="NonParametricGeometry"||"materials"in e)&&("materials"in e&&e.materials!==void 0?(this.disposeMaterial(),this.material=e.materials.map(s=>t.shared.material(s).getFlavor(r.flatShading,r.side,r.wireframe)),t.scene.markNeedsUpdateRendererDirty()):"material"in e&&e.material!==void 0&&(this.disposeMaterial(),this.material=[t.shared.material(e.material).getFlavor(r.flatShading,r.side,r.wireframe)],t.scene.markNeedsUpdateRendererDirty()));let a=this.data;if(!n&&a.geometry?.type!=="NonParametricGeometry"&&"materials"in a&&a.materials!==void 0&&(this.disposeMaterial(),this.material=t.shared.material(a.materials[0]).getFlavor(r.flatShading,r.side,r.wireframe)),!n&&(e.flatShading!==void 0||e.wireframe!==void 0||e.side!==void 0))if(Array.isArray(this.material))for(let s=0;s<this.material.length;s++)this.material[s]=this.material[s].getFlavor(r.flatShading,r.side,r.wireframe);else this.material=this.material.getFlavor(r.flatShading,r.side,r.wireframe,i);this.syncShadowCatcher(t)}shadowCatcherActive(){let e=this.dataPatched,t=e.geometry?.type;return e.shadowCatcher===!0&&(t==="RectangleGeometry"||t==="PlaneGeometry")}syncShadowCatcher(e){let t=this.dataPatched;if(this.shadowCatcherActive()){if(this.shadowCatcherMaterial===void 0){let i=function(){let r=NA==="webgpu"&&FH!==void 0?FH:Pbe;return r===void 0?null:aie(r())}();if(i===null)return;this.shadowCatcherMaterial=i}this.shadowCatcherMaterial.side=t.side,this.material!==this.shadowCatcherMaterial&&(this.disposeMaterial(),this.material=this.shadowCatcherMaterial,e.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,e.scene.markNeedsUpdateRendererDirty()):"material"in t&&t.material!==void 0&&(this.material=e.shared.material(t.material).getFlavor(t.flatShading,t.side,t.wireframe),e.scene.markNeedsUpdateRendererDirty(),this.needsAO&&this.layers.enable(5)),this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow)}static disposeOneMaterial(e){var t;Nbe(e)&&!function(i){return i?.isClassicSharedMaterial===!0}(t=e)&&t?.isTSLSharedMaterial!==!0&&e.nodeMaterialDispose()}disposeMaterial(){this.material&&y1e(this.material).forEach(e=>{bl.disposeOneMaterial(e)})}dispose(){this.disposeMaterial(),this.shadowCatcherMaterial?.dispose(),super.dispose()}}}),th=k(()=>{$t(),Nr(),WX(),c1(),le(),F4(),Tw(),Sbe(),$F=new D,XF=new pt,YF=new pt,cie=new D,KF=new ke,An=class extends bl{constructor(e,t,i){super(e,t),this.data=t,this.isSkinnedMesh=!1,this.localGeometry=void 0,t.bindMode&&t.bindMatrix&&(this.bindMode=t.bindMode,this.bindMatrix=new ke().fromArray(t.bindMatrix),this.bindMatrixInverse=new ke)}chooseGeoemtryCache(e){return e.geometryCache}supportsInPlaceGeometryUpdate(e){return e.isTextGeometry!==!0}markGeometryAsReachable(e){this.geometryCreateDeleyed instanceof At&&this.chooseGeoemtryCache(e).markAsReachable(this.dataPatched.geometry,this.geometryCreateDeleyed)}get builtSharedGeometry(){if(this.localGeometry===void 0)return this.geometryCreateDeleyed instanceof At?this.geometryCreateDeleyed:void 0}get geometry(){if(this.localGeometry!==void 0)return this.localGeometry;if(this.geometryCreateDeleyed instanceof gL){let e=this.geometryCreateDeleyed,t=this.chooseGeoemtryCache(e),i=this.dataPatched.geometry;this.geometryCreateDeleyed=t.get(i,e,this),this._geometryCacheKey=i}return this.geometryCreateDeleyed}set geometry(e){this.localGeometry=e}get is2DAndNoDepth(){let e=this.dataPatched.geometry;return KO.is2DParametricMesh(e.type)&&e.depth===0}get is2DType(){return KO.is2DParametricMesh(this.geometry.userData.type)}get isNonParametric(){return this.geometry.userData.type==="NonParametricGeometry"}updateByPatchedOp(e,t,i){super.updateByPatchedOp(e,t,i),Qr(e.path,["geometry"])&&this.updateByPatchedOpGeometry($s.drop(e,1),t.geometry,i)}removeInteractionGeometry(e){this.localGeometry?.dispose(),this.localGeometry=void 0}updateGeometryInteractions(e,t){this.invalidateDownstreamBooleanData();let i=this.data.geometry.type;if(i==="NonParametricGeometry"||i==="SubdivGeometry"){let r,n,a,s=e;if(this.localGeometry===void 0){let d={...this.data.geometry,...s};this.localGeometry=Ng(d,t,this.data.flatShading,this)}s.scaleBaked?[r,n,a]=s.scaleBaked:{width:r,height:n,depth:a}=s;let o=this.localGeometry.userData,l=typeof r=="number"?r:1,h=typeof n=="number"?n:1,u=typeof a=="number"?a:1;o.sxPrev!==void 0&&DH(this.localGeometry.attributes,l/o.sxPrev,h/o.syPrev,u/o.szPrev),o.sxPrev=l,o.syPrev=h,o.szPrev=u}else{let r=Ng({...this.data.geometry,...e},t,this.data.flatShading,this);this.localGeometry!==void 0&&this.supportsInPlaceGeometryUpdate(this.localGeometry)&&zF(this.localGeometry,r)?r.dispose():(this.localGeometry?.dispose(),this.localGeometry=r)}}refreshAttachedClonersInteractions(e){for(let t of this.attachedSurfaceCloners)t.update(e)}refreshAttachedCloners(e){for(let t of this.attachedSurfaceCloners)e.scene.addPendingUpdateCloner(t.object)}refreshAttachedPaths(e){for(let t of this.attachedPaths)e.scene.addPendingCommand(()=>t.updateShape())}createGeometryDelayed(e){this.geometryCreateDeleyed=e.shared,this.refreshAttachedCloners(e),this.refreshAttachedPaths(e)}updateByPatchedOpGeometry(e,t,i){let r=!1;if(e.type===0&&e.path.length===0&&Object.keys(e.props).includes("scaleBaked")&&this.geometryCreateDeleyed instanceof ua&&this.chooseGeoemtryCache(i.shared).mutateIfUnique(this.geometryCreateDeleyed.data,t)===this.geometryCreateDeleyed&&(r=!0,this.geometryCreateDeleyed.mutateDirectlyScaleBaked(t,e.props.scaleBaked),this.refreshAttachedCloners(i),this.refreshAttachedPaths(i)),!r&&e.type===0&&e.path.length===0&&Tbe(e.props)&&this.geometryCreateDeleyed instanceof ua&&this.chooseGeoemtryCache(i.shared).mutateIfUnique(this.geometryCreateDeleyed.data,t)===this.geometryCreateDeleyed&&(r=!0,this.geometryCreateDeleyed.mutateDirectlySubdivisions(t),this.refreshAttachedCloners(i),this.refreshAttachedPaths(i)),!r&&e.type===0&&e.path.length===0&&this.geometryCreateDeleyed instanceof At&&!(this.geometryCreateDeleyed instanceof ua)&&this.supportsInPlaceGeometryUpdate(this.geometryCreateDeleyed)&&this._geometryCacheKey!==void 0){let n=i.shared,a=this.chooseGeoemtryCache(n),s=this.geometryCreateDeleyed;if(a.getCached(this._geometryCacheKey)===s&&s.isShared!==!0){let o=this.dataPatched.geometry,l=Ng(o,n,this.data.flatShading,this);zF(s,l)?(l.dispose(),s.computeBoundingSphere(),a.mutateIfUnique(this._geometryCacheKey,o)):(l.computeBoundingSphere(),a.forceDelete(this._geometryCacheKey),a.adopt(o,l),this.geometryCreateDeleyed=l),this._geometryCacheKey=o,r=!0,this.refreshAttachedCloners(i),this.refreshAttachedPaths(i)}}r||(i.scene?.markGeometryCacheDirty(),this.createGeometryDelayed(i)),this.syncShapeBlendNodeLayer(),this.resetBBoxNeedsUpdate(),this.invalidateDownstreamBooleanData()}updateGeometryOnStateUpdate(e,t){this.createGeometryDelayed(t)}applyTransientGeometryData(e,t){let i=e.shared,r=this.dataPatched.geometry;if(this.geometryCreateDeleyed instanceof At&&!(this.geometryCreateDeleyed instanceof ua)&&this.supportsInPlaceGeometryUpdate(this.geometryCreateDeleyed)&&this._geometryCacheKey!==void 0){let n=this.chooseGeoemtryCache(i),a=this.geometryCreateDeleyed;if(n.getCached(this._geometryCacheKey)===a&&a.isShared!==!0){let s=Ng(r,i,this.data.flatShading,this);return zF(a,s)?(s.dispose(),a.computeBoundingSphere(),n.mutateIfUnique(this._geometryCacheKey,r)):(s.computeBoundingSphere(),n.forceDelete(this._geometryCacheKey),n.adopt(r,s),this.geometryCreateDeleyed=s),this._geometryCacheKey=r,this.refreshAttachedCloners(e),void this.refreshAttachedPaths(e)}}t&&this._geometryCacheKey!==void 0&&this.chooseGeoemtryCache(i).forceDelete(this._geometryCacheKey),e.scene?.markGeometryCacheDirty(),this.createGeometryDelayed(e)}updateState(e,t){e.geometry!==void 0&&this.updateGeometryOnStateUpdate(e.geometry,t);let i=e.morphTargetInfluences;if(i){this.updateMorphTargets(),this.geometry.morphTargetsRelative=!0;for(let{data:{name:r,value:n}}of i)this.updateMorphInfluences(r,t.shared.getVariable(n,[this.uuid,"morphTargetInfluences",r]))}super.updateState(e,t)}updateMorphInfluences(e,t){if(this.morphTargetDictionary===void 0)return;let i=this.morphTargetDictionary[e];i!==void 0&&(this.morphTargetInfluences[i]=t)}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(e,t){let i=this.geometry.userData.parameters;this.is2DType?e.set(0,0,.5*i.depth):this.isNonParametric?(e.setScalar(0),this.geometry.boundingSphere&&e.copy(this.geometry.boundingSphere.center),t.set(i.width,i.height,i.depth??0).multiplyScalar(.5)):i.centerOffset?e.fromArray(i.centerOffset):e.setScalar(0),t.set(i.width,i.height,i.depth??0).multiplyScalar(.5)}updateMatrixWorld(e){super.updateMatrixWorld(e),this.bindMode==="attached"?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode==="detached"&&this.bindMatrixInverse.copy(this.bindMatrix).invert()}bind(e,t){this.skeleton=e,this.isSkinnedMesh=!0,t===void 0&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),t=this.matrixWorld),this.bindMatrix.copy(t),this.bindMatrixInverse.copy(t).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(e){let t=new pt,i=this.geometry.attributes.skinWeight;for(let r=0,n=i.count;r<n;r++){t.fromBufferAttribute(i,r);let a=1/t.manhattanLength();a!==1/0?t.multiplyScalar(a):t.set(1,0,0,0),i.setXYZW(r,t.x,t.y,t.z,t.w)}}boneTransform(e,t){let i=this.skeleton;if(i===void 0)return;let r=this.geometry;XF.fromBufferAttribute(r.attributes.skinIndex,e),YF.fromBufferAttribute(r.attributes.skinWeight,e),$F.copy(t).applyMatrix4(this.bindMatrix),t.set(0,0,0);for(let n=0;n<4;n++){let a=YF.getComponent(n);if(a!==0){let s=XF.getComponent(n);KF.multiplyMatrices(i.bones[s].matrixWorld,i.boneInverses[s]),t.addScaledVector(cie.copy($F).applyMatrix4(KF),a)}}return t.applyMatrix4(this.bindMatrixInverse)}}});function Cx(e){if(Array.isArray(e.material)){for(let t of e.material)if(t.getLayersOfType("outline").length===0)return}else if(!lL(e.material)||e.material.getLayersOfType("outline").length===0)return;e instanceof An&&e.is2DAndNoDepth?function(t){if(t.geometry.attributes.extrudeNormals||!t.geometry.attributes.position)return;let i=t.geometry.attributes.position.array,r=new Float32Array(i.length),n=new D;for(let a=0;a<i.length;a+=3)n.set(i[a],i[a+1],i[a+2]).normalize(),r[a]=n.x,r[a+1]=n.y,r[a+2]=n.z;t.geometry.setAttribute("extrudeNormal",new Et(r,3))}(e):function(t){if(t.geometry.attributes.extrudeNormal||!t.geometry.attributes.position||!t.geometry.attributes.normal)return;let i=new Map,r=t.geometry.attributes,n=r.position.array,a=r.normal.array,s=new Float32Array(n.length);for(let o=0;o<n.length;o+=3){let l=`${n[o]}_${n[o+1]}_${n[o+2]}`,h=new D(a[o],a[o+1],a[o+2]);i.has(l)?i.get(l)?.normals.push(h):i.set(l,{normals:[h],result:new D})}i.forEach((o,l)=>{for(let h of o.normals)o.result.add(h);o.result.divideScalar(o.normals.length)});for(let o=0;o<n.length;o+=3){let l=`${n[o]}_${n[o+1]}_${n[o+2]}`,h=i.get(l)?.result;h&&(s[o]=h.x,s[o+1]=h.y,s[o+2]=h.z)}t.geometry.setAttribute("extrudeNormal",new Et(s,3))}(e)}function ZF(e){return Math.min(2047,Math.max(1,Math.round(2048*e)))/2048}function Px(e){if(!e.geometry.attributes.position)return;let t=e.geometry.attributes,i=t.position.array,r=t.randomColor;if(r!==void 0&&3*r.count===i.length)return;let n=new Float32Array(i.length),a=parseInt(e.uuid.replace(/\D/g,"")),s=[ZF(ht.seededRandom(a)),ZF(ht.seededRandom(a+1e4)),ZF(ht.seededRandom(a+2e4))];for(let o=0;o<i.length;o++)n[o]=s[o%3];e.geometry.setAttribute("randomColor",new It(n,3))}var V4=k(()=>{le(),PX(),th()});function pie(e){let t=!1;return e.scene.objects.traverse((i,r)=>{r.geometry?.type==="BooleanGeometry"&&(t=!0)}),t}function BOe(e,t){let i=e.cloner;return i!==void 0&&i.parent===t?i:void 0}function mie(e,t,i,r){let n=16*(t.children.length+1);AM.length<n&&(AM=new Float32Array(n));let a=0,s=l=>{l.toArray(AM,16*a),a++},o=t.parameters.hideBase!==!0;o&&s(r),kH.multiplyMatrices(e.hiddenMatrix,e.matrix);for(let l of t.children)!ny(l)||l.playModeVisible===!1||(GH.multiplyMatrices(l.hiddenMatrix,l.matrix).multiply(l.pivotMatrix),hI.multiplyMatrices(kH,GH),(!o||!hI.equals(r))&&s(hI));try{return a===0?0:function(l,h){return AX(oL().instanced_union(EX(l),h))}(i,AM.subarray(0,16*a))}finally{E_e(i)}}var dp,fie,kH,GH,hI,AM,zg,vL,k4,_d,Vc,yL,IA=k(()=>{io(),le(),I4(),V4(),c1(),sa(),dp=new ke,fie=new ke,kH=new ke,GH=new ke,hI=new ke,AM=new Float32Array(0),zg=class extends bl{constructor(e,t,i){super(e,t),this.data=t,this.meshSetAddresses=[],this.needsTransformForDownstream=!1,this.geometry=new At,this.onAfterRender=(r,n,a,s,o,l)=>{super.onAfterRender(r,n,a,s,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(e,t,i){super.updateByPatchedOp(e,t,i),e.path.length===1&&e.path[0]==="geometry"&&e.type===0&&e.props.operation!==void 0&&(this.freeBooleanPointer(),this.resetBBoxNeedsUpdate())}freeBooleanPointer(){super.freeBooleanPointer(),this.geometry.dispose()}recomputeBoolean(e,t=!0){if(this.booleanMeshSetAddress!==-1&&!e)return;for(let r=0;r<this.children.length;r++){let n=this.children[r];n instanceof zg&&n.dataPatched.visible===!0&&n.recomputeBoolean(e===!0,t)}this.meshSetAddresses=[];for(let r=0;r<this.children.length;r++){let n=this.children[r];if(n instanceof Sa&&n.dataPatched.visible===!0&&n.geometry.attributes.position?.count>0&&n.geometry.drawRange.count>0&&n.booleanMeshSetAddress!==0){dp.multiplyMatrices(n.hiddenMatrix,n.matrix).multiply(n.pivotMatrix);try{let a=BOe(n,this);if(n.booleanMeshSetAddress===-1){if((n.geometry.index??n.geometry.getAttribute("position")).count/3<15e5){let s=nOe(n.geometry,e===!0);n.booleanMeshSetAddress=a===void 0||s===-1?s:mie(n,a,s,dp)}if(n.booleanMeshSetAddress===-1)return;a===void 0&&CF(n.booleanMeshSetAddress,dp),n.booleanMatrixInvOld.copy(dp).invert(),n.booleanWasTransformed=!1}else n instanceof zg&&n.needsTransformForDownstream===!0?(a===void 0?CF(n.booleanMeshSetAddress,dp):n.booleanMeshSetAddress=mie(n,a,n.booleanMeshSetAddress,dp),n.needsTransformForDownstream=!1):n.booleanWasTransformed===!0&&(CF(n.booleanMeshSetAddress,fie.multiplyMatrices(dp,n.booleanMatrixInvOld)),n.booleanMatrixInvOld.copy(dp).invert(),n.booleanWasTransformed=!1)}catch(a){console.error(a),n.booleanMeshSetAddress=0,n.geometry.userData.booleanOperationDidFail=!0;continue}if(n.booleanMeshSetAddress===0)continue;this.meshSetAddresses.push(n.booleanMeshSetAddress),n.geometry.userData.booleanOperationDidFail=!1}}if(this.meshSetAddresses.length===0){if(this.geometry.getAttribute("position")?.array.length!==0){let r=this.geometry;r.dispose(),this.geometry=new At,this.geometry.userData=r.userData,this.geometry.boundingSphere=r.boundingSphere,this.geometry.setAttribute("position",new Et([],3))}return void this.geometry.setDrawRange(0,0)}if(e===!0)return function(r,n){let a=oL(),s=cte(r,n),o=a.mesh_topological_data(s),l=o.positions(),h=o.indices();return o.free(),s.free(),{positions:l,indices:h,verticesPerFace:new Uint8Array(h.length/3).fill(3)}}(this.meshSetAddresses,this.booleanOp);let i=this.geometry;i.dispose(),this.geometry=new At,this.geometry.userData=i.userData,this.geometry.boundingSphere=i.boundingSphere;try{this.booleanMeshSetAddress=function(r,n,a,s){let o=oL(),l=cte(r,n),h=o.mesh_render_data(l,Math.max(s,0));if(a.setAttribute("position",new Et(h.positions(),3)),a.setAttribute("normal",new Et(h.normals(),3)),h.free(),a.boundingSphere===null&&(a.boundingSphere=new Ws),l.tri_count()===0)a.boundingSphere.center.set(0,0,0),a.boundingSphere.radius=0,a.userData.parameters={width:0,height:0,depth:0};else{let u=l.bounds();a.boundingSphere.center.set(u[0],u[1],u[2]),a.boundingSphere.radius=(u[3]**2+u[4]**2+u[5]**2)**.5,a.userData.parameters={width:2*u[3],height:2*u[4],depth:2*u[5]}}return AX(l)}(this.meshSetAddresses,this.booleanOp,this.geometry,this.phongAngle)}catch(r){this.booleanMeshSetAddress=0,this.geometry.userData.booleanOperationDidFail=!0,console.error(r)}this.booleanMatrixInvOld.copy(this.matrix).invert(),this.needsTransformForDownstream=!0,Cx(this),Px(this)}dispose(){super.dispose(),this.geometry.dispose()}}}),OA=k(()=>{le(),xl(),d1(),(vL||(vL={})).is=function(e){return hr.is(e)&&e instanceof Hp},k4=(e,t)=>class extends u1(e,t){updateState_Light(i,r){if(this.updateState_Entity(i,r),i.color!==void 0&&(this.color=r.shared.color(i.color)),i.intensity!==void 0&&(this.intensity=i.intensity*Math.PI),i.depth!==void 0){let n=this.shadow;n.camera.far=i.depth,n.needsUpdate=!0}i.shadows!==void 0&&(this.castShadow=i.shadows)}}}),n0=k(()=>{IA(),io(),d1(),_d=e=>e instanceof Sa,Vc=e=>e!==null&&e instanceof zg,yL=e=>pH.is(e)});function vo(e,t){return t.color(e)}function gie(e=new Date,t){let i=t.format,r=e.getSeconds(),n=e;t&&t.timeZone!==null&&(n=function(d,c){try{let p=new Intl.DateTimeFormat("en-US",{timeZone:c,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hourCycle:"h23"}).formatToParts(d),m=f=>Number(p.find(g=>g.type===f)?.value);return new Date(m("year"),m("month")-1,m("day"),m("hour"),m("minute"),m("second"),d.getMilliseconds())}catch{return new Date(NaN)}}(new Date,t.timeZone));let a,s=n.getHours(),o=n.getMinutes();t.format12h24h==="12ampm"&&(a=s>=12?"PM":"AM");let l,h,u=s;switch(t.format12h24h!=="24"&&(u=s%12,u===0&&(u=12)),i){case"HH:mm:ss":l=[u,o,r];break;case"HH:mm":l=[u,o];break;case"HH":l=[u],a=void 0;break;case"mm":l=[o],a=void 0;break;case"ss":l=[r],a=void 0;break;case"year":h=n.getFullYear();break;case"month":h=n.getMonth()+1;break;case"dayOfYear":h=Math.floor((n.getTime()-new Date(n.getFullYear(),0,0).getTime())/864e5);break;case"dayOfMonth":h=n.getDate();break;case"secondOfDay":h=60*s*60+60*o+r;break;default:console.error("Unknown time format",i),h=0}return l!==void 0?{textValue:l,suffix:a}:h}var jH,rw,qX=k(()=>{}),UOe=k(()=>{le(),PA(),RA(),jH=class extends bw(zye){constructor(e,t=15,i=10066329){super(e,t,i),this.object=e,this.added=!1,this.name=`DirectionalLightHelper: ${e.uuid}`}raycast(e,t){xw(this.object,jH.geometryHelper,e,t)}}}),LA=k(()=>{le(),UOe(),OA(),rw=class extends k4(ZE,jH){constructor(e,t,i){super(),this.super_Entity(e,t),this.castShadow=!0,this.shadow.mapSize.width=2048,this.shadow.mapSize.height=2048,this.shadow.normalBias=1,this.layers.enable(3);let r=this.shadow.camera;r.top=1250,r.bottom=-1250,r.right=1250,r.left=-1250,r.near=-1e4,r.far=2500;let n=new QE(this.shadow.camera);n.visible=!1,this.gizmos.shadowmap=n}update(){this.shadow.camera.updateProjectionMatrix();for(let e in this.gizmos){let t=this.gizmos[e];t instanceof QE&&t.update()}}updateMatrixWorld(e){super.updateMatrixWorld(e),this.objectHelper&&this.objectHelper.update()}updateState(e,t){this.updateState_Light(e,t);let i=e.depth!==void 0&&e.depth!==this.shadow.camera.far||e.size!==void 0&&e.size/2!==this.shadow.camera.right;e.size!==void 0&&function(r,n){r.shadow.camera.right=n/2,r.shadow.camera.left=-n/2,r.shadow.camera.top=n/2,r.shadow.camera.bottom=-n/2,r.shadow.needsUpdate=!0}(this,e.size),e.shadowRadius!==void 0&&(this.shadow.radius=e.shadowRadius),e.shadowResolution!==void 0&&(this.shadow.mapSize.set(e.shadowResolution,e.shadowResolution),this.shadow.map&&(this.shadow.map.dispose(),this.shadow.map=null)),e.penumbraSize!==void 0&&t.scene.markPenumbraSizeDirty(),i&&this.update()}}});function $X(e){return e instanceof bl&&e.needsAO&&!$g(e)&&e.isDecalObject!==!0}function XX(e){let t=e.cloner;if(t&&Array.isArray(t.children))for(let i of t.children)i?.layers&&(i.layers.mask=e.layers.mask)}function YX(e){return e.getLayersOfType("reflection").filter(t=>t.data.visible).length}function FOe(e){let t=1/0,i=-1/0;for(let r of e.getLayersOfType("reflection")){let n=r.data;if(!n.visible||n.mirror===1)continue;let a=typeof n.blur=="number"?n.blur:null;t=Math.min(t,a??0),i=Math.max(i,a??10)}return t===1/0?null:{min:t,max:i}}function zOe(e){for(let t of e.getLayersOfType("reflection")){let i=t.data;if(!i.visible)continue;let{blur:r,thickness:n,steps:a,stepSize:s}=i;return typeof r!="number"||typeof n!="number"||typeof a!="number"||typeof s!="number"?"variable":{blur:r,thickness:n,steps:a,stepSize:s,tracingMode:i.tracingMode===1?1:0}}return null}function vie(e,t){let i={outline:!1,cavity:!1},r=e.layers.mask&G4,n=t.getLayersOfType("transmission"),a=t.getLayersOfType("outline"),s=YX(t),o=t.getLayersOfType("cavity");return(a.length>0||o.length>0)&&(e.layers.set(8),n.length>0&&e.layers.enable(3),s>0&&e.layers.enable(4),i.outline=a.length>0,i.cavity=o.length>0,Px(e),Cx(e)),n.length===0&&a.length===0&&o.length===0&&s===0&&e.layers.set(0),r&&e.layers.set(9),!r&&$X(e)&&e.layers.enable(5),XX(e),i}function yie(e,t){if(!t.layers)return!1;let i=e.layers.mask&G4,r=!1,n=t.getLayersOfType("transmission").filter(l=>l.data.visible),a=t.getLayersOfType("outline").filter(l=>l.data.visible),s=YX(t),o=t.getLayersOfType("cavity").filter(l=>l.data.visible);return n.length>0&&(e.layers.set(3),(a.length>0||o.length>0)&&e.layers.enable(8),s>0&&e.layers.enable(4),r=!0),n.length===0&&a.length===0&&o.length===0&&s===0&&e.layers.set(0),i&&e.layers.set(9),!i&&$X(e)&&e.layers.enable(5),XX(e),r}function _ie(e,t){var i;if(!t.layers)return!1;let r=e.layers.mask&G4,n=!1,a=YX(t),s=t.getLayersOfType("transmission").filter(h=>h.data.visible),o=t.getLayersOfType("outline").filter(h=>h.data.visible),l=t.getLayersOfType("cavity").filter(h=>h.data.visible);return a>0&&((i=e.userData).__splinePlanarMirror??(i.__splinePlanarMirror=0),e.layers.set(4),s.length>0&&e.layers.enable(3),(o.length>0||l.length>0)&&e.layers.enable(8),n=!0),a===0&&s.length===0&&o.length===0&&l.length===0&&e.layers.set(0),r&&e.layers.set(9),!r&&$X(e)&&e.layers.enable(5),XX(e),n}function HH(e,t,i,r=!1){let n=e.cloner;if(n){let a=null;if(e.raycast===Cr.prototype.raycast||e.raycast===Sa.prototype.raycast){let s=e.geometry;s&&(s.boundingSphere===null&&s.computeBoundingSphere(),a=s.boundingSphere)}for(let s of n.children){if(a!==null&&(WH.copy(a).applyMatrix4(s.matrixWorld),!t.ray.intersectsSphere(WH)))continue;let o=Lbe.copy(s.matrixWorld).invert(),l=Bbe.copy(t.ray).applyMatrix4(o),h=e.matrixWorld;l.applyMatrix4(h);let u=Obe;u.set(l.origin,l.direction),u.near=t.near,u.far=t.far,u.layers.mask=t.layers.mask;let d=u.intersectObject(e,!1);d.length>0&&i.push({...d[0],object:r?s:e})}}}var G4,Obe,Lbe,Bbe,WH,v3,Ube,QF,JF,e5,nw,Ka,KX=k(()=>{sa(),V4(),io(),c1(),le(),G4=512,Obe=new W$,Lbe=new ke,Bbe=new vm,WH=new Ws}),VOe=k(()=>{le(),PA(),RA(),v3=class extends bw(Uye){constructor(e,t=6710886){super(e,t),this.object=e,this.matrix=e.matrixWorld,this.name=`SpotLightHelper: ${e.uuid}`}raycast(e,t){xw(this.object,v3.geometryHelper,e,t)}update(){if(this.object!==void 0){let e=v3._vector,t=this.object.distance?this.object.distance:1e3,i=t*Math.tan(this.object.angle);this.cone.scale.set(i,i,t),e.setFromMatrixPosition(this.object.target.matrixWorld),this.cone.lookAt(e);let r=this.color!==void 0?this.color:this.light.color;if(this.cone.material instanceof Array)for(let n=0,a=this.cone.material.length;n<a;n++)this.cone.material[n].color.set(r);else this.cone.material.color.set(r)}}},(Ube=v3)._vector=new D}),BA=k(()=>{le(),VOe(),OA(),QF=new D,JF=new D,e5=new Zt,nw=class extends k4(vy,Ube){constructor(e,t,i){super(),this.super_Entity(e,t),this.castShadow=!0,this.shadow.mapSize.width=1024,this.shadow.mapSize.height=1024,this.shadow.normalBias=1,this.layers.enable(3);let r=this.shadow.camera;r.fov=2*ht.RAD2DEG*this.angle,r.aspect=1,r.near=100,r.far=2500;let n=new QE(this.shadow.camera);n.visible=!1,this.gizmos.shadowmap=n,this.update()}update(){this.shadow.camera.updateProjectionMatrix();for(let e in this.gizmos){let t=this.gizmos[e];t instanceof QE&&t.update()}}updateMatrixWorld(e){super.updateMatrixWorld(e),JF.setFromMatrixPosition(this.matrixWorld),e5.setFromRotationMatrix(this.matrixWorld),QF.copy(this.up).applyQuaternion(e5).negate().multiplyScalar(this.distance),this.target.position.copy(JF).add(QF),this.target.updateMatrixWorld(),this.objectHelper&&this.objectHelper.update()}updateState(e,t){this.updateState_Light(e,t),e.distance!==void 0&&(this.distance=e.distance),e.decay!==void 0&&(this.decay=e.decay),e.angle!==void 0&&(this.angle=e.angle),e.penumbra!==void 0&&(this.penumbra=e.penumbra),e.shadowRadius!==void 0&&(this.shadow.radius=e.shadowRadius),e.penumbraSize!==void 0&&t.scene.markPenumbraSizeDirty(),e.shadowResolution!==void 0&&(this.shadow.mapSize.set(e.shadowResolution,e.shadowResolution),this.shadow.map&&(this.shadow.map.dispose(),this.shadow.map=null))}}}),Km=k(()=>{$t(),Uh(),le(),xl(),wu(),qX(),Xm(),LA(),Nr(),Ym(),le(),c1(),n0(),KX(),BA(),_r(),IA(),Ka=class extends D4(Zo){constructor(e,t,i){if(super(),this.data=t,this.bgColor=new Fr(1,1,1,1),this.fog=null,this.backupFog=new qj(16777215,.1,2e3),this.fogUseBGColor=!1,this.fogMode="linear",this.fogDensity=Yn.getDensity({}),this.fogHeightFalloff=Yn.getHeightFalloff({}),this.fogHeightBase=Yn.getHeightBase({}),this.isActive=!1,this.skyState=null,this.skyStateVersion=0,this.gradingState=null,this.skyHdriHolder=null,this.aoColor=new ot,this.penumbraSizeArrayCache=null,this.super_Entity(e,t),this.personalCamera=new na(h1,{...fE.defaultData,...t.camera,name:"Personal Camera"}),this.personalCamera.objectHelper.visible=!1,this.add(this.personalCamera),this.activeCamera=this.personalCamera,this.ambientLight=new g4(13882323,8553090,.75*Math.PI),this.ambientLight.name="Default Ambient Light",this.ambientLight.layers.enable(3),this.ambientLight.removeFromParent(),this.add(this.ambientLight),t.uiScene){let r=lH();r===null?Ms("ui-2d","a page's 2D scene"):this.uiScene=new r.Scene2D((Array.isArray(e)?e[0]:e)+"-ui",t.uiScene,{dpr:window.devicePixelRatio,shared:i.shared})}else t.uiFrame&&this.createUICanvas(t.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(e,t){let i=lH();i!==null?(this.uiCanvas=new i.UICanvas(this.uuid+"-uiscreen",window.innerWidth,window.innerHeight,t),this.uiCanvas.isScreenSpace=!0,this.uiCanvas.promise.then(()=>{this.uiCanvas?.applyFrame(e),this.uiCanvas?.applySize()})):Ms("ui-2d","a page's UI canvas")}updateVisible(){}setBackgroundColor(e){this.bgColor=e,this.fogUseBGColor===!0&&(this.backupFog.color=e)}entityChildrenCount(){return this.uiScene?this.uiScene.children.length:super.entityChildrenCount()}updateAmbientLight(e,t){e.color!==void 0&&(this.ambientLight.color=vo(e.color,t)),e.intensity!==void 0&&(this.ambientLight.intensity=e.intensity*Math.PI),e.enabled!==void 0&&(e.enabled?this.add(this.ambientLight):this.remove(this.ambientLight))}onDeactive(){this.isActive=!1}onActive(e){this.isActive=!0,e.fog=this.fog,this.traverseEntity(t=>{t instanceof zg&&t.recomputeBoolean()}),this.updateShadow(this.data.shadow)}forceMaterialsUpdate(){this.traverseEntity(e=>{if(e instanceof bl)if(Array.isArray(e.material))for(let t of e.material)t.needsUpdate=!0;else e.material.needsUpdate=!0,e.material.dispose()})}updateShadow(e){if(e.softShadowQuality===void 0&&e.type===void 0||!this.isActive)return;let t=this.data.shadow;var i,r;i=_y.isSoft(t),r=t?.softShadowQuality,zH!==void 0&&zH(i,r)&&this.forceMaterialsUpdate()}updateFog(e,t){e.enabled?this.fog=this.backupFog:this.fog=null,this.isActive&&(this.scene.fog=this.fog),this.fogUseBGColor=e.useBackgroundColor,e.useBackgroundColor?this.backupFog.color.set(this.bgColor):this.backupFog.color=vo(e.color,t),this.backupFog.near=e.near,this.backupFog.far=e.far,this.fogMode=Yn.getMode(e),this.fogDensity=Yn.getDensity(e),this.fogHeightFalloff=Yn.getHeightFalloff(e),this.fogHeightBase=Yn.getHeightBase(e)}updateSky(e,t){this.skyState=e??null,this.skyStateVersion++;let i=e?.hdri?.image;this.skyHdriHolder=i!=null?t.image(i):null}updateAo(e,t){e.aoColor!==void 0&&(this.aoColor=vo(e.aoColor,t))}updateByOp(e,t,i,r){let n=this.data.uiFrame;super.updateByOp(e,t,i,r);let a=t;Qr(e.path,["fog"])?this.updateFog(a.fog,i.shared):Qr(e.path,["sky"])?this.updateSky(a.sky,i.shared):Qr(e.path,["grading"])?this.gradingState=a.grading??null:Qr(e.path,["ao"])?this.updateAo(a.ao,i.shared):Qr(e.path,["ambient"])?this.updateAmbientLight(a.ambient,i.shared):Qr(e.path,["shadow"])?this.updateShadow(a.shadow):e.type===0&&e.path.length===0&&(e.props.uiFrame!==void 0||n!==a.uiFrame)&&this.updateUIFrame(e.props.uiFrame,i)}updateUIFrame(e,t){e?(this.uiCanvas||this.createUICanvas(e,t),this.uiCanvas.enabled=!0,this.uiCanvas.applyFrame(e)):this.uiCanvas&&(this.uiCanvas.enabled=!1)}updateState(e,t){this.updateState_Entity(e,t),e.backgroundColor!==void 0&&this.setBackgroundColor(vo(e.backgroundColor,t.shared)),e.fog!==void 0&&this.updateFog(e.fog,t.shared),e.sky!==void 0&&this.updateSky(e.sky,t.shared),e.grading!==void 0&&(this.gradingState=e.grading),e.ambient!==void 0&&this.updateAmbientLight(e.ambient,t.shared),e.ao!==void 0&&this.updateAo(e.ao,t.shared),e.shadow!==void 0&&this.updateShadow(e.shadow)}createFrame(e,t){}raycast(e,t){super.raycast(e,t)}switchActiveCamera(e){e&&e.isDescendantOf(this)&&(this.activeCamera!==this.personalCamera&&(this.activeCamera.objectHelper.visible=!0),this.activeCamera=e,e.objectHelper.visible=!1)}get playCamera(){return this.scene?.find(this.data.publish.playCamera)??this.personalCamera}switchToPlayCamera(){this.switchActiveCamera(this.playCamera)}get penumbraSizeArray(){return this.penumbraSizeArrayCache===null&&this.updatePenumbraSizeArray(),this.penumbraSizeArrayCache}updatePenumbraSizeArray(){this.penumbraSizeArrayCache=new Array(Hm).fill(.5);let e=0,t=0;this.traverseEntity(i=>{if(!i.visible)return!0;i instanceof rw&&i.visible&&e<vE&&(this.penumbraSizeArrayCache[e]=i.data.penumbraSize??.5,e+=1),i instanceof nw&&i.visible&&e<Hm-vE&&(this.penumbraSizeArrayCache[vE+t]=i.data.penumbraSize??.5,t+=1)})}raycastWithClones(e){let t=[],i=r=>{for(let n of r.children){let a=n.cloner;hr.is(n)&&(n.visible||a?.object.data.visible)&&((_d(n)||yL(n)&&this.scene.enableHelpers&&n.objectHelper.visible)&&(e.intersectObject(n,!1,t),HH(n,e,t,!0)),i(n))}};return i(this),t}updateEntity2DByOp(e,t,i,r){this.uiCanvas?.updateEntity2DByOp(e,t,i,r)}}});function bie(){return ZX}function t5(){if(_L===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 _L}function i5(e){return e?.isWebGPUSplineRenderer===!0}var ZX,_L,QX=k(()=>{ZX=null,_L=null});function qH(){return eY}var JX,eY,tY=k(()=>{JX=null,eY=null});function xie(e,t,i){return CM.setRGB(e,t,i,Yi),{r:CM.r,g:CM.g,b:CM.b}}function kOe(e,t,i){let r,n=mA(e.angle,0),[a,s]=$H(e.offset),[o,l]=$H(e.morph),h=e.colors??[],u=e.steps??[],d=Math.min(10,h.length,u.length);if(d===0)return[1,1,1,1];if(e.gradientType===1){let g=3*(t+o)-(t+a)-1,v=3*(i+l)-(i+s)-1;r=Math.hypot(g,v)+n}else if(e.gradientType===2){let g=-1*Math.atan2(t+o-.5+a,i+l-.5+s),v=n/Math.PI/-2+.5*g/Math.PI;r=v-Math.floor(v)}else{let g=.5+o/(t!==0?t:1e-6),v=l/(i!==0?i:1e-6),y=Math.cos(n)*g-Math.sin(n)*v,_=Math.sin(n)*g+Math.cos(n)*v,b=y*y+_*_;r=b>1e-12?(((t-.5+a)/2+y/2)*y+((i-.5+s)/2+_/2)*_)/b:0}let c=h[0][0],p=h[0][1],m=h[0][2],f=h[0][3];for(let g=1;g<d;g++){let v=u[g-1],y=u[g]-v,_=y!==0?Math.min(1,Math.max(0,(r-v)/y)):r>=v?1:0;e.smooth&&(_=_*_*(3-2*_)),c+=(h[g][0]-c)*_,p+=(h[g][1]-p)*_,m+=(h[g][2]-m)*_,f+=(h[g][3]-f)*_}return[c,p,m,f]}function GOe(e,t){let i=e,r=i?.data?.layers;if(r&&typeof r.forEach=="function"){let n=t,a=[];return r.forEach(s=>{let o=s.data;if(o.visible===!1||o.isMask===!0)return;let l=mA(o.alpha,1);if(!(l<=0))if(o.type==="color"){let h,u=o.color;typeof u=="string"?h=typeof n?.color=="function"?n.color(u):void 0:u&&typeof u.r=="number"&&(h=u),h&&a.push({kind:"color",layer:o,rgb:{...xie(h.r,h.g,h.b),a:h.a??1},alpha:l})}else o.type==="gradient"&&a.push({kind:"gradient",layer:o,alpha:l})}),a.length===0?null:(s,o)=>{let l=1,h=1,u=1,d=!0;for(let c of a){let p,m,f,g;if(c.kind==="color")({r:p,g:m,b:f}=c.rgb),g=c.rgb.a;else{let[y,_,b,x]=kOe(c.layer,s,o);({r:p,g:m,b:f}=xie(y,_,b)),g=x}let v=d?1:Math.min(1,Math.max(0,g*c.alpha));l+=(p-l)*v,h+=(m-h)*v,u+=(f-u)*v,d=!1}return{r:l,g:h,b:u}}}if(i?.color&&i.color.isColor===!0){let{r:n,g:a,b:s}=i.color;return()=>({r:n,g:a,b:s})}return null}var CM,mA,$H,jOe=k(()=>{le(),CM=new ot,mA=(e,t)=>typeof e=="number"&&Number.isFinite(e)?e:t,$H=e=>Array.isArray(e)&&typeof e[0]=="number"&&typeof e[1]=="number"?[e[0],e[1]]:[0,0]});function HOe(e,t){if(e==="torus"){let l=t()*Math.PI*2,h=t()*Math.PI*2,u=Math.cos(l),d=Math.sin(l),c=Math.cos(h),p=Math.sin(h);return{x:(1.4+.7*c)*u,y:-(1.4+.7*c)*d,z:.7*p,nx:c*u,ny:-c*d,nz:p,cr:1,cg:1,cb:1}}if(e==="cylinder"){let l=t()*Math.PI*2,h=Math.cos(l),u=Math.sin(l);return{x:.8*h,y:1.6*(t()-.5),z:.8*u,nx:h,ny:0,nz:u,cr:1,cg:1,cb:1}}let i=t()*Math.PI*2,r=2*t()-1,n=Math.acos(r),a=Math.sin(n)*Math.cos(i),s=Math.cos(n),o=Math.sin(n)*Math.sin(i);return{x:a,y:s,z:o,nx:a,ny:s,nz:o,cr:1,cg:1,cb:1}}function WOe(e){let{geometry:t,matrix:i}=e,r=t.getAttribute("position");if(!r||r.count<3)return null;let n=t.getAttribute("normal"),a=t.getAttribute("uv"),s=t.getAttribute("color"),o=t.getIndex(),l=o?o.count/3:r.count/3;if(l<1)return null;let h=(v,y)=>o?o.getX(3*v+y):3*v+y,u=i?i.elements:null,d=i?new hi().getNormalMatrix(i).elements:null,c=v=>{let y=r.getX(v),_=r.getY(v),b=r.getZ(v);return u?u[0]*y+u[4]*_+u[8]*b+u[12]:y},p=v=>{let y=r.getX(v),_=r.getY(v),b=r.getZ(v);return u?u[1]*y+u[5]*_+u[9]*b+u[13]:_},m=v=>{let y=r.getX(v),_=r.getY(v),b=r.getZ(v);return u?u[2]*y+u[6]*_+u[10]*b+u[14]:b},f=new Float64Array(l),g=0;for(let v=0;v<l;v++){let y=h(v,0),_=h(v,1),b=h(v,2),x=c(y),w=p(y),S=m(y),M=c(_)-x,T=p(_)-w,A=m(_)-S,E=c(b)-x,C=p(b)-w,N=m(b)-S,P=T*N-A*C,I=A*E-M*N,L=M*C-T*E;g+=.5*Math.sqrt(P*P+I*I+L*L),f[v]=g}return g<=0?null:{total:g,sample:(v,y)=>{let _=0,b=l-1;for(;_<b;){let te=_+b>>1;f[te]<v?_=te+1:b=te}let x=_,w=h(x,0),S=h(x,1),M=h(x,2),T=y(),A=y();T+A>1&&(T=1-T,A=1-A);let E,C,N,P=1-T-A,I=c(w)*P+c(S)*T+c(M)*A,L=p(w)*P+p(S)*T+p(M)*A,B=m(w)*P+m(S)*T+m(M)*A;if(n){if(E=n.getX(w)*P+n.getX(S)*T+n.getX(M)*A,C=n.getY(w)*P+n.getY(S)*T+n.getY(M)*A,N=n.getZ(w)*P+n.getZ(S)*T+n.getZ(M)*A,d){let te=d[0]*E+d[3]*C+d[6]*N,ue=d[1]*E+d[4]*C+d[7]*N,ae=d[2]*E+d[5]*C+d[8]*N;E=te,C=ue,N=ae}}else{let te=c(w),ue=p(w),ae=m(w),de=c(S)-te,ye=p(S)-ue,Z=m(S)-ae,fe=c(M)-te,W=p(M)-ue,z=m(M)-ae;E=ye*z-Z*W,C=Z*fe-de*z,N=de*W-ye*fe}let G=Math.sqrt(E*E+C*C+N*N)||1,j=1,$=1,H=1;if(s)j=s.getX(w)*P+s.getX(S)*T+s.getX(M)*A,$=s.getY(w)*P+s.getY(S)*T+s.getY(M)*A,H=s.getZ(w)*P+s.getZ(S)*T+s.getZ(M)*A;else if(e.sampleColor){let te=a?a.getX(w)*P+a.getX(S)*T+a.getX(M)*A:.5,ue=a?a.getY(w)*P+a.getY(S)*T+a.getY(M)*A:.5,ae=e.sampleColor(te,ue);ae&&(j=ae.r,$=ae.g,H=ae.b)}return{x:I,y:L,z:B,nx:E/G,ny:C/G,nz:N/G,cr:j,cg:$,cb:H}}}}function wie(e){let t=Math.min(Math.max(1,Math.floor(e.guideStrands)),Rx),i=function(l){let h=l>>>0;return()=>{h|=0,h=h+1831565813|0;let u=Math.imul(h^h>>>15,1|h);return u=u+Math.imul(u^u>>>7,61|u)^u,((u^u>>>14)>>>0)/4294967296}}(e.seed??1337),r=e.shape==="object"&&e.sampler,n=r?e.samplerRadius??hd:hd,a=new Float32Array(4*em),s=new Float32Array(em),o=new Float32Array(4*Rx).fill(1);for(let l=0;l<t;l++){let h=r?e.sampler(i):HOe(e.shape,i),u=r?h.x:h.x*n,d=r?h.y:h.y*n,c=r?h.z:h.z*n,{nx:p,ny:m,nz:f}=h;o[4*l+0]=h.cr,o[4*l+1]=h.cg,o[4*l+2]=h.cb;let g,v,y,_=l*qv,b=(1.8+.8*i())*e.hairLength*n/(qv-1),x=.5+1.5*i(),w=(.02+.06*i())*n;Math.abs(m)<.99?(g=-f,v=0,y=p):(g=1,v=0,y=0);let S=Math.sqrt(g*g+v*v+y*y)||1;for(let M=0;M<qv;M++){let T=M/(qv-1),A=T*T*.4*n,E=w*Math.sin(T*x*Math.PI*2),C=4*(_+M);a[C+0]=u+p*b*M+E*g/S,a[C+1]=d+m*b*M-A+E*v/S,a[C+2]=c+f*b*M+E*y/S,a[C+3]=M===0?0:1,M<qv-1&&(s[_+M]=b)}}return{initialPositions:a,restLengths:s,unitScale:n,rootColors:o}}var qv,Rx,em,hd,fg,US,Y1,B0,K1,uI,Fbe=k(()=>{le(),em=(Rx=16384)*(qv=32),hd=100}),zbe=k(()=>{le(),io(),tY(),jOe(),Fbe(),fg=1/60,US=new ke,Y1=new Zt,B0=new D,K1=new D,uI=class extends Sa{constructor(e,t,i){super(e,t),this.type="HairSystem",this.isHairSystem=!0,this.simRunning=!1,this.previewRequested=!1,this.playModeActive=!1,this.pendingSimSeconds=0,this.simTime=0,this.resetRequested=!0,this.generation=0,this.settledSimSeconds=0,this.lastMotionFingerprint=0,this.lastBoneQuat=new Zt,this.lastBonePos=new D,this.hasLastBone=!1,this.baseFoundAtRegen=!1,this.baseSourceGeomsAtRegen=[],this.baseSourceHashesAtRegen=[],this.baseColorHashAtRegen=0,this.baseScaleAtRegen=0,this.classicFallbackWarned=!1,this.regenSnapshot=null,this.context=i,this.data=t,this.geometry.setAttribute("position",new It(new Float32Array(0),3)),this.material=new Ql({colorWrite:!1,depthWrite:!1}),this.frustumCulled=!1,this.scalpMesh=new Cr(new Vm(hd,48,32),new Ql({color:5448477})),this.scalpMesh.name="HairScalp",this.add(this.scalpMesh);let r=new PO;r.setAttribute("position",new It(new Float32Array(12),3)),r.setIndex([0,2,1,2,3,1]),r.instanceCount=0,this.ribbonMesh=new Cr(r,new Ql({visible:!1})),this.ribbonMesh.name="HairRibbons",this.ribbonMesh.frustumCulled=!1,this.ribbonMesh.visible=!1,this.ribbonMesh.matrixAutoUpdate=!1,this.ribbonMesh.updateMatrixWorld=()=>{this.ribbonMesh.matrixWorld.identity()},this.ribbonMesh.updateWorldMatrix=()=>{this.ribbonMesh.matrixWorld.identity()},this.add(this.ribbonMesh),this.activeGuideStrands=t.guideStrands,this.roots=this.buildRoots(),this.regenSnapshot={guideStrands:t.guideStrands,hairLength:t.hairLength,spreadRadius:t.spreadRadius,headShape:t.headShape,baseObjectId:t.baseObjectId},this.applyScalpState(),this.applyShadowState(),this.syncSimRunning()}update(e){!this.simRunning||(this.pendingSimSeconds=Math.min(this.pendingSimSeconds+e/1e3,4*fg*2),this.trackMotionRest(e/1e3))}trackMotionRest(e){this.boneTransform(Y1,B0);let t=this.hasLastBone&&(Math.abs(this.lastBoneQuat.dot(Y1))<.9999995||this.lastBonePos.distanceToSquared(B0)>1e-8),i=this.motionFingerprint(),r=!this.hasLastBone||t||this.resetRequested||i!==this.lastMotionFingerprint||this.data.windStrength>.001;this.lastBoneQuat.copy(Y1),this.lastBonePos.copy(B0),this.lastMotionFingerprint=i,this.hasLastBone=!0,this.settledSimSeconds=r?0:this.settledSimSeconds+e}motionFingerprint(){let e=this.data;return e.gravity+2*e.damping+3*e.localStiffness+4*e.globalStiffness+5*e.globalRange+6*e.stiffnessFalloff+7*e.windStrength+8*e.vspCoefficient+9*e.kink+10*e.kinkFrequency+11*e.clumpStrength+12*e.clumpSize+13*e.clumpTipScale}get isSimulating(){return(this.simRunning||this.resetRequested)&&this.visible}get isMotionSettled(){return this.settledSimSeconds>6}get isVisiblyAnimating(){return this.isSimulating&&!this.isMotionSettled}startPreview(){this.previewRequested=!0,this.syncSimRunning()}stopPreview(){this.previewRequested=!1,this.syncSimRunning()}setPlayMode(e){this.playModeActive=e,e&&this.resetSimulation(),this.syncSimRunning()}resetSimulation(){this.resetRequested=!0,this.pendingSimSeconds=0,this.simTime=0,this.settledSimSeconds=0}warnClassicFallbackOnce(){this.classicFallbackWarned||(this.classicFallbackWarned=!0,console.warn("[spline] Hair System strands require the WebGPU renderer \u2014 the WebGL fallback shows only the scalp. Reload with ?renderer=webgpu in a WebGPU-capable browser."))}syncSimRunning(){this.simRunning=this.playModeActive||this.previewRequested||this.data.autoPlay}updateState(e,t){super.updateState(e,t),this.updateHairState(e)}updateHairState(e){if((e.guideStrands!==void 0||e.hairLength!==void 0||e.spreadRadius!==void 0||e.headShape!==void 0||e.baseObjectId!==void 0)&&this.regenerate(),(e.headShape!==void 0||e.baseObjectId!==void 0)&&this.applyScalpState(),e.headColor!==void 0){let t=this.scalpMesh.material;t.isMeshBasicMaterial===!0&&t.color.setRGB(e.headColor.r,e.headColor.g,e.headColor.b,Yi)}(e.castShadow!==void 0||e.receiveShadow!==void 0)&&this.applyShadowState(),e.autoPlay!==void 0&&this.syncSimRunning()}applyShadowState(){let e=this.data.castShadow??!0,t=this.data.receiveShadow??!0;this.castShadow=e,this.receiveShadow=t,this.scalpMesh.castShadow=e,this.scalpMesh.receiveShadow=t,this.ribbonMesh.castShadow=e,this.ribbonMesh.receiveShadow=t}regenerate(){this.activeGuideStrands=Math.max(1,Math.min(Math.floor(this.data.guideStrands),16384)),this.roots=this.buildRoots(),this.generation++,this.regenSnapshot={guideStrands:this.data.guideStrands,hairLength:this.data.hairLength,spreadRadius:this.data.spreadRadius,headShape:this.data.headShape,baseObjectId:this.data.baseObjectId},this.resetSimulation()}checkDataDrift(){let e=this.data,t=this.regenSnapshot;if(t===null||t.guideStrands!==e.guideStrands||t.hairLength!==e.hairLength||t.spreadRadius!==e.spreadRadius||t.headShape!==e.headShape||t.baseObjectId!==e.baseObjectId){let i=t===null||t.headShape!==e.headShape||t.baseObjectId!==e.baseObjectId;this.regenerate(),i&&this.applyScalpState()}this.syncSimRunning(),this.applyShadowState(),this.checkBaseDrift()}buildRoots(){let{headShape:e,baseObjectId:t,guideStrands:i,hairLength:r}=this.data;if(this.baseFoundAtRegen=!1,this.baseSourceGeomsAtRegen=[],this.baseSourceHashesAtRegen=[],this.baseColorHashAtRegen=0,this.baseScaleAtRegen=0,e==="object"&&t){let n=this.context.scene.find(t);if(n){this.baseFoundAtRegen=!0,n.updateWorldMatrix(!0,!0);let a=this.collectBaseSources(n),s=a?function(o){let l=[];for(let d of o){let c=WOe(d);c&&l.push(c)}if(l.length===0)return null;let h=new Float64Array(l.length),u=0;for(let d=0;d<l.length;d++)u+=l[d].total,h[d]=u;return u<=0?null:d=>{let c=d()*u,p=0,m=l.length-1;for(;p<m;){let g=p+m>>1;h[g]<c?p=g+1:m=g}let f=p===0?c:c-h[p-1];return l[p].sample(f,d)}}(a.sources):null;if(this.baseSourceGeomsAtRegen=a?.sources.map(o=>o.geometry)??[],this.baseSourceHashesAtRegen=a?.hashes??[],this.baseColorHashAtRegen=a?.colorHash??0,a&&s){let o=this.baseWorldScale(n),l=Math.max(a.radius*o,.001);this.baseScaleAtRegen=o;let h=o;return wie({shape:"object",guideStrands:i,hairLength:r,sampler:u=>{let d=s(u);return{...d,x:d.x*h,y:d.y*h,z:d.z*h}},samplerRadius:l})}}}return wie({shape:e==="object"?"sphere":e,guideStrands:i,hairLength:r})}collectBaseSources(e){let t=[],i=[],r=0,n=0;US.copy(e.matrixWorld).invert();let a=US.clone(),s=o=>{if(o.isHairSystem===!0||o!==e&&o.visible===!1)return;let l=o.geometry;if(o.isMesh===!0&&l&&(l.getAttribute("position")?.count??0)>=3){let h=o===e?void 0:new ke().multiplyMatrices(a,o.matrixWorld),u=Array.isArray(o.material)?o.material[0]:o.material;t.push({geometry:l,matrix:h,sampleColor:GOe(u,this.context.shared)??void 0}),i.push(uI.matrixHash(h)),n+=function(c,p){let m=c,f=0,g=1,v=_=>{f+=_*g,g+=1},y=m?.data?.layers;if(y&&typeof y.forEach=="function"){let _=p;y.forEach(b=>{let x=b.data;if(x.visible!==!1){if(x.type==="color"){let w=x.color,S=typeof w=="string"?typeof _?.color=="function"?_.color(w):void 0:w;S&&typeof S.r=="number"&&(v(S.r),v(S.g),v(S.b)),v(mA(x.alpha,1))}else if(x.type==="gradient"){let w=x;for(let S of w.colors??[])v(S[0]),v(S[1]),v(S[2]),v(S[3]);for(let S of w.steps??[])v(S);v(mA(w.angle,0)),v(w.gradientType),v(w.smooth?1:0)}}})}else m?.color&&m.color.isColor===!0&&(v(m.color.r),v(m.color.g),v(m.color.b));return f}(u,this.context.shared),l.boundingSphere===null&&l.computeBoundingSphere();let d=l.boundingSphere;if(d){let c=0,p=1;h?(B0.copy(d.center).applyMatrix4(h),c=B0.length(),p=uI.matrixMaxScale(h)):c=d.center.length(),r=Math.max(r,c+d.radius*p)}}for(let h of o.children)s(h)};return s(e),t.length===0?null:{sources:t,hashes:i,radius:Math.max(r,.001),colorHash:n}}static matrixHash(e){if(!e)return 0;let t=e.elements,i=0;for(let r=0;r<16;r++)i+=t[r]*(r+1);return i}static matrixMaxScale(e){let t=e.elements,i=Math.hypot(t[0],t[1],t[2]),r=Math.hypot(t[4],t[5],t[6]),n=Math.hypot(t[8],t[9],t[10]);return Math.max(i,r,n,1e-6)}baseWorldScale(e){return US.copy(e.matrixWorld).decompose(B0,Y1,K1),Math.max(Math.abs(K1.x),Math.abs(K1.y),Math.abs(K1.z),1e-6)}get widthWorldScale(){return this.data.headShape==="object"&&this.data.baseObjectId&&this.baseScaleAtRegen>0?this.baseScaleAtRegen:1}checkBaseDrift(){if(this.data.headShape!=="object"||!this.data.baseObjectId)return;let e=this.context.scene.find(this.data.baseObjectId);if(!e)return;if(!this.baseFoundAtRegen)return void this.regenerate();e.updateWorldMatrix(!0,!0);let t=this.collectBaseSources(e),i=t?.sources??[],r=t?.hashes??[],n=this.baseSourceGeomsAtRegen,a=this.baseSourceHashesAtRegen,s=i.length!==n.length;if(!s){for(let o=0;o<i.length;o++)if(i[o].geometry!==n[o]||Math.abs(r[o]-a[o])>1e-4*Math.max(Math.abs(a[o]),1)){s=!0;break}}if(!s&&this.data.hairColorSource==="object"&&(t?.colorHash??0)!==this.baseColorHashAtRegen&&(s=!0),!s&&i.length>0){let o=this.baseWorldScale(e);s=Math.abs(o-this.baseScaleAtRegen)>.001*Math.max(this.baseScaleAtRegen,1e-6)}s&&this.regenerate()}applyScalpState(){let e=this.data.headShape,t=e==="object"&&this.data.baseObjectId!==null;this.scalpMesh.visible=!t,!t&&(this.scalpMesh.geometry.dispose(),this.scalpMesh.geometry=e==="torus"?new CO(1.4*hd,.7*hd,24,48):e==="cylinder"?new hE(.8*hd,.8*hd,1.6*hd,48,1):new Vm(hd,48,32))}boneTransform(e,t){let i=this.matrixWorld;if(this.data.headShape==="object"&&this.data.baseObjectId){let r=this.context.scene.find(this.data.baseObjectId)?.matrixWorld;r&&(i=r)}US.copy(i).decompose(t,e,K1)}raycast(e,t){if(!this.scalpMesh.visible)return;let i=[];this.scalpMesh.raycast(e,i);for(let r of i)r.object=this,t.push(r)}get shadowBoundsRadius(){let e=this.data.headShape==="torus"?2.6:1.5;return this.roots.unitScale*(e+2.6*Math.max(this.data.hairLength,0))}getShadowBoundsCenter(e){return this.boneTransform(Y1,e),e}updateEntityBoxSize(e,t){let i=this.shadowBoundsRadius;e.set(0,0,0),t.set(i,i,i)}dispose(){super.dispose(),this.scalpMesh.geometry.dispose(),this.scalpMesh.material.dispose(),this.ribbonMesh.geometry.dispose(),this.ribbonMesh.material.dispose?.(),qH()?.release(this)}}});function dI(){return{shapeInput:()=>`
|
|
4170
4170
|
const float posRowCoord = ${.5/dm};
|
|
4171
4171
|
const float quatRowCoord = ${1.5/dm};
|
|
4172
4172
|
const float param1RowCoord = ${2.5/dm};
|
|
@@ -12888,11 +12888,11 @@ void main() {
|
|
|
12888
12888
|
void main() {
|
|
12889
12889
|
vec4 texel = texture2D( tDiffuse, vUv );
|
|
12890
12890
|
gl_FragColor = texel;
|
|
12891
|
-
}`}),w5e=new class{constructor(e){this._mesh=new Cr(x5e,e)}dispose(){this._mesh.geometry.dispose()}render(e){e.render(this._mesh,b5e)}get material(){return this._mesh.material}set material(e){this._mesh.material=e}}(jEe),Y9=null,K9=null,S5e=Fi.identity(),HEe=class{constructor(e,t,i,r){var n;this.uuid=e,this.width=t,this.height=i,this.context=r,this.enabled=!0,this.isScreenSpace=!1,this.dpr=window.devicePixelRatio,this.isFrameDirty=!1,this.onRenderRequestedDownstream=()=>{this.isFrameDirty=!0,this.isScreenSpace||TE.add(this),this.context.shared.requestRender()},this._innerApplySize=()=>{let a=this.width,s=this.height;this.renderer.dpr=h0e(a,s,this.dpr,this.isScreenSpace),this.renderer.setSize(a,s)},this.onFrameOverrideObjectEvent=a=>{if(a.target?.uuid!==void 0){let s=this.frameRoot?.find(a.target.uuid);s&&s.dispatchEvent({...a,target:s})}},this.scene2d=new lK(ht.generateUUID(),rH.defaultData,{dpr:window.devicePixelRatio,shared:r.shared}),this.canvas=(Y9===null&&(Y9=document.createElement("canvas")),Y9),this.renderer=(n=this.canvas,K9===null&&(K9=new p5e(n)),K9),this.promise=this.init(),this.renderTarget=new yr(1,1,{type:ai,stencilBuffer:!1,depthBuffer:!1}),r.shared.addUIBuffer(this.uuid,this.renderTarget),this.textureHolder=r.shared.uiBuffer(this.uuid)}get canvasTexture(){return this._canvasTexture||(this._canvasTexture=new F$(this.canvas)),this._canvasTexture}async init(){await this.renderer.init(),this.renderer.uiFontReady?.then(()=>{this.frameOverride&&this.onRenderRequestedDownstream()})}render(e){if(this.isFrameDirty){if(this.isFrameDirty=!1,this._innerApplySize(),this.renderer.clear(),this.frameOverride?.draw(this.renderer),this.renderer.render(),this.canvasTexture.needsUpdate=!0,e.blitTextureToTarget)e.blitTextureToTarget(this.canvasTexture,this.renderTarget);else{jEe.uniforms.tDiffuse.value=this.canvasTexture;let t=e.getRenderTarget();e.setRenderTarget(this.renderTarget),e.clear(),w5e.render(e),e.setRenderTarget(t)}this.textureHolder?.setNeedsUpdate(!0)}}updateEntity2DByOp(e,t,i,r){this.scene2d.updateEntityByOp(e,t,i,r),this.applySize()}updateTreeByOp(e,t){this.scene2d.updateTreeByOp(e,t),this.applySize()}applyOverrides(e){if(this.frameOverride&&this.frameRoot){this.frameOverride.position=[0,0],this.frameOverride.rotation=0;let t=e?.width??this.width,i=e?.height??this.height;this.frameOverride.width=t,this.frameOverride.height=i,this.frameOverride.localMatrix=S5e,this.isScreenSpace&&(this.frameOverride.fill.color=Vr.from0to1([0,0,0,0])),this.frameOverride.data={...this.frameOverride.data,width:t,height:i},WEe({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(e,t=window.devicePixelRatio){let i=Math.max(1,e?.width??this.width),r=Math.max(1,e?.height??this.height);this.dpr=t,this.width=i,this.height=r,this._innerApplySize();let n=function(a,s,o,l){let h=h0e(a,s,o,l),u=Math.max(o,512/Math.min(a,s)),d=Math.min(u,h);return{width:Math.max(1,Math.ceil(a*d)),height:Math.max(1,Math.ceil(s*d))}}(i,r,t,this.isScreenSpace);this.renderTarget.setSize(n.width,n.height),this._canvasTexture?.dispose(),this._canvasTexture=void 0,this.applyOverrides(e),this.frameOverride?.requestRender()}applyFrame(e){let t=this.context.scene.find2D(e);if(t&&t instanceof $c)return this.disposeFrameOverride(),this.frameRoot=t,this.frameOverride=t.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(),t}get frame(){return this.frameOverride}get frameId(){return this.frame?.uuid}find(e){return this.scene2d.find(e)}get texture(){return this.textureHolder?.getTexture(1001)}disposeFrameOverride(){this.frameOverride?.removeEventListener("render",this.onRenderRequestedDownstream),this.frameOverride?.traverse(e=>{e.removeEventListener("beginState",this.onFrameOverrideObjectEvent),e.removeEventListener("completeState",this.onFrameOverrideObjectEvent)}),this.frameOverride&&this.scene2d.remove(this.frameOverride)}};function WEe({objectOverride:e,objectRoot:t,newParentWidth:i,newParentHeight:r,initialParentWidth:n,initialParentHeight:a}){if(e instanceof $c&&t instanceof $c||e instanceof Gg&&t instanceof Gg)for(let s=0,o=e.children.length;s<o;s++){let l=e.children[s],h=t.children[s];l&&h&&l.uuid===h.uuid&&T5e({objectOverride:l,objectRoot:h,newParentWidth:i,newParentHeight:r,initialParentWidth:n,initialParentHeight:a})}}function T5e({objectOverride:e,objectRoot:t,newParentWidth:i,newParentHeight:r,initialParentWidth:n,initialParentHeight:a}){let[s,o]=function(d){if(Z9(d))return[d.width,d.height];if(d instanceof n4){let[c,p]=d.getHalfSize();return[2*c,2*p]}if(d instanceof Gg){let[c,p]=d.recursiveBBox.getHalfSize();return[2*c,2*p]}return[0,0]}(t),{width:l,height:h,position:u}=GEe({constraints:e.data,newParentWidth:i,newParentHeight:r,initialParentWidth:n,initialParentHeight:a,objectInitialWidth:s,objectInitialHeight:o,objectInitialPosition:t.position});if(e.position=u,e.data={...e.data,position:u},e.states)for(let d in e.states)M5e({stateId:d,objectOverride:e,objectRoot:t,newParentWidth:i,newParentHeight:r,initialParentWidth:n,initialParentHeight:a});if(Z9(e)||e instanceof Gg)Z9(e)&&(e.width=l,e.height=h,e.data={...e.data,width:l,height:h}),WEe({objectOverride:e,objectRoot:t,newParentWidth:l,newParentHeight:h,initialParentWidth:s,initialParentHeight:o});else if(e instanceof n4){let d=t,c=s!==0?l/s:1,p=o!==0?h/o:1;e.path=function(m,f=1,g=1){if(f<=0||g<=0)return m;if(VEe(m))return console.warn("Cannot scale invalid path",m),X9([]);if(f===1&&g===1)return m;try{return X9((0,_5e.parseSVG)(m).map(v=>{let y={...v};return"x"in y&&(y.x=y.x*f),"y"in y&&(y.y=y.y*g),"x1"in y&&(y.x1=y.x1*f),"x2"in y&&(y.x2=y.x2*f),"y1"in y&&(y.y1=y.y1*g),"y2"in y&&(y.y2=y.y2*g),"rx"in y&&(y.rx=y.rx*f),"ry"in y&&(y.ry=y.ry*g),y}))}catch(v){return console.warn("Error parsing SVG path",v),X9([])}}(d.path,c,p),e.data={...e.data,path:e.path}}}function M5e({stateId:e,objectOverride:t,objectRoot:i,newParentWidth:r,newParentHeight:n,initialParentWidth:a,initialParentHeight:s}){let o=t.states?.[e],l=i.states?.[e];if(o&&l){let{width:h,height:u,position:d}=GEe({constraints:t.data,newParentWidth:r,newParentHeight:n,initialParentWidth:a,initialParentHeight:s,objectInitialWidth:xy.isResizeable(l)?l.width:0,objectInitialHeight:xy.isResizeable(l)?l.height:0,objectInitialPosition:l.position});Object.assign(t.states[e],{position:d}),xy.isResizeable(o)&&Object.assign(t.states[e],{width:h,height:u})}}function Z9(e){return e instanceof GA||e instanceof $c||e instanceof sK||e instanceof oK}F4();var u0e,E5e=class extends An{constructor(e,t,i){super(e,t,i),this.isUIObject=!0,this.uiCanvas=new HEe(e+"-canvas",t.geometry.width,t.geometry.height,i),this.uiCanvas.promise.then(()=>{this.applyFrame(this.dataPatched.geometry.frame,i.shared)})}updateByPatchedOpGeometry(e,t,i){super.updateByPatchedOpGeometry(e,t,i),e.type===0&&(e.props.frame!==void 0&&this.applyFrame(e.props.frame,i.shared),(e.props.width!==void 0||e.props.height!==void 0)&&this.applySize(e.props,i.shared))}applySize(e,t){let i=e?.width??this.dataPatched.geometry.width,r=e?.height??this.dataPatched.geometry.height;this.uiCanvas.applySize({width:i,height:r}),this.applyGeometryParametersFromFrame(t)}applyFrame(e,t){this.uiCanvas.applyFrame(e),this.applyGeometryParametersFromFrame(t),this.applyMaterialParametersFromFrame({shared:t})}applyGeometryParametersFromFrame(e){let t=this.frame;t&&(Object.assign(this.data,{geometry:Object.assign(this.data.geometry,{cornerRadius:t.cornerRadius,cornerType:0})}),Object.assign(this.dataPatched,{geometry:Object.assign(this.dataPatched.geometry,{cornerRadius:t.cornerRadius,cornerType:0})}),this.localGeometry?.dispose(),this.localGeometry=Ng(this.dataPatched.geometry,e,this.data.flatShading,this))}applyMaterialParametersFromFrame(e){let t=this.frame;if(t){let i=t.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,e,!0)}}updateEntity2DByOp(e,t,i,r){this.uiCanvas.updateEntity2DByOp(e,t,i,r),e===this.frameId&&t.type===0&&(t.props.cornerRadius!==void 0?this.applyGeometryParametersFromFrame(r):Qr(t.path,["backgroundBlur"])&&this.applyMaterialParametersFromFrame({shared:r}))}get frame(){return this.uiCanvas.frame}get frameId(){return this.frame?.uuid}removeInteractionGeometry(e){super.removeInteractionGeometry(e),this.applySize({},e)}updateGeometryInteractions(e,t){super.updateGeometryInteractions(e,t),this.applySize({width:e.width,height:e.height},t);let i={...this.data.geometry,...e};this.localGeometry?.dispose(),this.localGeometry=Ng(i,t,this.data.flatShading,this)}};_r(),ww("UIGeometry",(e,t,i)=>new E5e(e,t,i)),P4=u0e={Scene2D:lK,UICanvas:HEe,loadHanaUIRUNTIME:function(){return t4||(t4=async()=>async function(e,t){return await e.default(t?{module_or_path:t}:void 0),Object.getOwnPropertyDescriptor(e.Engine.prototype,"scene")||Object.defineProperty(e.Engine.prototype,"scene",{get:function(){let i=Object.create(e.SceneController.prototype);return i.__wbg_ptr=this.__wbg_ptr,i}}),{createEngine:i=>e.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(()=>(kZ(),VZ)),Kge??function(){let e=typeof process<"u"?"2.0.11":void 0;return`https://cdn.spline.design/@splinetool/runtime${e?`@${e}`:""}/build/hana-ui.wasm`}())),FEe().then(()=>{})},setHanaUIWasmUrl:function(e){Kge=e}},sL!==null&&u0e.setHanaUIWasmUrl(sL),In("ui-2d"),aY(),bbe(),le();var qEe,Q9,A5e=class{constructor(){this.type="ShapePath",this.color=new ot,this.subPaths=[],this.currentPath=null}moveTo(e,t){return this.currentPath=new dE,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this}lineTo(e,t){return this.currentPath?.lineTo(e,t),this}quadraticCurveTo(e,t,i,r){return this.currentPath?.quadraticCurveTo(e,t,i,r),this}bezierCurveTo(e,t,i,r,n,a){return this.currentPath?.bezierCurveTo(e,t,i,r,n,a),this}splineThru(e){return this.currentPath?.splineThru(e),this}toShapes(){let e={loc:0,t:0};function t(h,u,d,c){let p=h.x,m=u.x,f=d.x,g=c.x,v=h.y,y=u.y,_=d.y,b=c.y,x=(g-f)*(v-_)-(b-_)*(p-f),w=(b-_)*(m-p)-(g-f)*(y-v),S=x/w,M=((m-p)*(v-_)-(y-v)*(p-f))/w;if(w===0&&x!==0||S<=0||S>=1||M<0||M>1)return null;if(x===0&&w===0){for(let T=0;T<2;T++){if(i(T===0?d:c,h,u),e.loc===0){let A=T===0?d:c;return{x:A.x,y:A.y,t:e.t}}if(e.loc===2)return{x:+(p+e.t*(m-p)).toPrecision(10),y:+(v+e.t*(y-v)).toPrecision(10),t:e.t}}return null}for(let T=0;T<2;T++)if(i(T===0?d:c,h,u),e.loc===0){let A=T===0?d:c;return{x:A.x,y:A.y,t:e.t}}return{x:+(p+S*(m-p)).toPrecision(10),y:+(v+S*(y-v)).toPrecision(10),t:S}}function i(h,u,d){let c,p=d.x-u.x,m=d.y-u.y,f=h.x-u.x,g=h.y-u.y,v=p*g-f*m;return h.x===u.x&&h.y===u.y?(e.loc=0,void(e.t=0)):h.x===d.x&&h.y===d.y?(e.loc=1,void(e.t=1)):void(v<-Number.EPSILON?e.loc=3:v>Number.EPSILON?e.loc=4:p*f<0||m*g<0?e.loc=5:Math.sqrt(p*p+m*m)<Math.sqrt(f*f+g*g)?e.loc=6:(c=p!==0?f/p:g/m,e.loc=2,e.t=c))}let r=0,n=999999999,a=-999999999,s=[];this.subPaths.forEach(h=>{let u=h.getPoints(),d=-999999999,c=999999999,p=-999999999,m=999999999;for(let f=0;f<u.length;f++){let g=u[f];g.y>d&&(d=g.y),g.y<c&&(c=g.y),g.x>p&&(p=g.x),g.x<m&&(m=g.x)}a<=p&&(a=p+1),n>=m&&(n=m-1),u.length&&s.push({curves:h.curves,points:u,isCW:n7.isClockWise(u),identifier:r++,boundingBox:new v4(new J(m,c),new J(p,d))})});let o=s.map(h=>function(u,d,c,p,m){(m==null||m==="")&&(m="nonzero");let f=new J;u.boundingBox.getCenter(f);let g=function(w,S,M){let T=new J;S.getCenter(T);let A=[];return M.forEach(E=>{E.boundingBox.containsPoint(T)&&function(C,N){let P=[],I=[];for(let L=1;L<C.length;L++){let B=C[L-1],G=C[L];for(let j=1;j<N.length;j++){let $=t(B,G,N[j-1],N[j]);$!==null&&P.find(H=>H.t<=$.t+Number.EPSILON&&H.t>=$.t-Number.EPSILON)===void 0&&(P.push($),I.push(new J($.x,$.y)))}}return I}(w,E.points).forEach(C=>{A.push({identifier:E.identifier,isCW:E.isCW,point:C})})}),A.sort((E,C)=>E.point.x-C.point.x),A}([new J(c,f.y),new J(p,f.y)],u.boundingBox,d);g.sort((w,S)=>w.point.x-S.point.x);let v=[],y=[];g.forEach(w=>{w.identifier===u.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(u.identifier),m==="evenodd"){let w=b.length%2==0,S=b[b.length-2];return{identifier:u.identifier,isHole:w,for:S}}if(m==="nonzero"){let w=!0,S=null,M=null;for(let T=0;T<b.length;T++){let A=b[T];d[A]&&(w?(M=d[A].isCW,w=!1,S=A):M!==d[A].isCW&&(M=d[A].isCW,w=!0))}return{identifier:u.identifier,isHole:w,for:S}}console.warn('fill-rule: "'+m+'" is currently not implemented.')}(h,s,n,a,this.userData?.style.fillRule)),l=[];return s.forEach(h=>{let u=o[h.identifier];if(u&&!u.isHole){let d=new YE;d.curves=h.curves,o.filter(c=>c?.isHole&&c.for===h.identifier).forEach(c=>{if(c){let p=s[c.identifier],m=new dE;m.curves=p.curves,d.holes.push(m)}}),l.push(d)}}),l}},$Ee=!1,d0e=new Promise(e=>{qEe=e}),c0e=!1;function p0e(){if($Ee=!0,!c0e)return Q9||(Q9=async function(){let e=await import("./opentype.js");qEe(e),c0e=!0}(),Q9)}var C5e=new class{async load(e,t,i=()=>{}){let{load:r}=await d0e;r(e,(n,a)=>{n||!a?i(n??"Something went wrong"):t(a)})}async parse(e){let{parse:t,Bidi:i}=await d0e;try{let r=t(e),n=new i,a=s=>r.charToGlyphIndex(s.char);return n.registerModifier("glyphIndex",null,a),n.applyFeatures(r,r.defaultRenderOptions.features),{font:r,bidi:n}}catch(r){console.error(r)}}};function P5e(e,t){return t.state.glyphIndex===e||t.state.fina===e||t.state.medi===e||t.state.init===e}le(),IX(),_r(),ww("TextGeometry",(e,t,i)=>new H4(e,t,i));var m0e={create:(e,t)=>new PH(e,t)};oH("TextGeometry",m0e),oH("InputGeometry",m0e),NX=class{constructor(e){this._arrayBuffer=new ArrayBuffer(1),this._isLoaded=!1,this._intercepted=!1,this._layoutErrorWarned=!1,this._isUserFont=e.isUserFont??!1,this._loadingPromise=this.load(e)}update(e){this._isLoaded=!1,this._isUserFont=e.isUserFont??!1,this._loadingPromise=this.load(e)}async load(e){try{this._layoutErrorWarned=!1;let t=await async function(i){let r,n,a=!1;if(i.url?(r=await async function(s){let o;try{o=await fetch(s)}catch(l){throw new Error(`could not fetch the font at ${s}: ${l}`)}if(!o.ok)throw new Error(`${o.status} ${o.statusText} fetching the font at ${s}`);return await o.arrayBuffer()}(i.url),n=i.url,a=i.url.startsWith("/")):i.data&&(r=i.data.buffer.slice(i.data.byteOffset,i.data.byteOffset+i.data.byteLength)),r){if(!$Ee)return{font:void 0,url:n,intercepted:a,arr:r,bidi:null};{let s=await C5e.parse(r);if(s)return{font:s.font,url:n,intercepted:a,arr:r,bidi:s.bidi}}}}(e);t&&(this._arrayBuffer=t.arr,this._url=t.url,this.font=t.font,this._intercepted=t.intercepted,this._isLoaded=!0,this._bidi=t.bidi)}catch(t){console.warn(`Could not load the font "${e.url??"(inline data)"}"`,t)}}warnLayoutError(e){this._layoutErrorWarned||(this._layoutErrorWarned=!0,console.warn(`Text layout failed for the font "${this._url??"(inline data)"}"`,e))}get url(){return this._url}get intercepted(){return this._intercepted}get isLoaded(){return this._isLoaded}get loadingPromise(){return this._loadingPromise}reverseLigaturesTable(e,t,i){if(!this._bidi)return[];let r=this._bidi;r.getTextGlyphs(t);let n=r.tokenizer.tokens,a=[],s=0,o=i.length===n.length;for(let l=0;l<i.length;l++){let h=i[l].index,u=String.fromCharCode(i[l].unicode),d=n[s];if(P5e(h,d)||o)a.push({char:u,index:h,replacements:[d.state.glyphIndex],replacementChars:[d.char]}),s++;else{let c=d.char,p="",m=[d.state.glyphIndex],f=[],g=!1;for(;!g;)s++,p=t.charAt(s),c+=p,m.push(e.charToGlyphIndex(p)),f=e.stringToGlyphs(c),f.length===1&&f[0].index===h&&(g=!0),s>t.length&&(g=!0);a.push({char:u,index:h,replacements:m,replacementChars:Array.from(c)}),s++}}return a}generateShapes(e,t,i){if(!this._isLoaded)return;let r=this.font,n=t.fontSize/this.unitsPerEm,a=t.fontSize*t.lineHeight,s=e.map(v=>this.getTextWidth(v,t)),o=typeof t.width=="string"?Number(i.getVariable(t.width)):t.width,l=typeof t.height=="string"?Number(i.getVariable(t.height)):t.height,h=this.getCharWidth(`
|
|
12891
|
+
}`}),w5e=new class{constructor(e){this._mesh=new Cr(x5e,e)}dispose(){this._mesh.geometry.dispose()}render(e){e.render(this._mesh,b5e)}get material(){return this._mesh.material}set material(e){this._mesh.material=e}}(jEe),Y9=null,K9=null,S5e=Fi.identity(),HEe=class{constructor(e,t,i,r){var n;this.uuid=e,this.width=t,this.height=i,this.context=r,this.enabled=!0,this.isScreenSpace=!1,this.dpr=window.devicePixelRatio,this.isFrameDirty=!1,this.onRenderRequestedDownstream=()=>{this.isFrameDirty=!0,this.isScreenSpace||TE.add(this),this.context.shared.requestRender()},this._innerApplySize=()=>{let a=this.width,s=this.height;this.renderer.dpr=h0e(a,s,this.dpr,this.isScreenSpace),this.renderer.setSize(a,s)},this.onFrameOverrideObjectEvent=a=>{if(a.target?.uuid!==void 0){let s=this.frameRoot?.find(a.target.uuid);s&&s.dispatchEvent({...a,target:s})}},this.scene2d=new lK(ht.generateUUID(),rH.defaultData,{dpr:window.devicePixelRatio,shared:r.shared}),this.canvas=(Y9===null&&(Y9=document.createElement("canvas")),Y9),this.renderer=(n=this.canvas,K9===null&&(K9=new p5e(n)),K9),this.promise=this.init(),this.renderTarget=new yr(1,1,{type:ai,stencilBuffer:!1,depthBuffer:!1}),r.shared.addUIBuffer(this.uuid,this.renderTarget),this.textureHolder=r.shared.uiBuffer(this.uuid)}get canvasTexture(){return this._canvasTexture||(this._canvasTexture=new F$(this.canvas)),this._canvasTexture}async init(){await this.renderer.init(),this.renderer.uiFontReady?.then(()=>{this.frameOverride&&this.onRenderRequestedDownstream()})}render(e){if(this.isFrameDirty){if(this.isFrameDirty=!1,this._innerApplySize(),this.renderer.clear(),this.frameOverride?.draw(this.renderer),this.renderer.render(),this.canvasTexture.needsUpdate=!0,e.blitTextureToTarget)e.blitTextureToTarget(this.canvasTexture,this.renderTarget);else{jEe.uniforms.tDiffuse.value=this.canvasTexture;let t=e.getRenderTarget();e.setRenderTarget(this.renderTarget),e.clear(),w5e.render(e),e.setRenderTarget(t)}this.textureHolder?.setNeedsUpdate(!0)}}updateEntity2DByOp(e,t,i,r){this.scene2d.updateEntityByOp(e,t,i,r),this.applySize()}updateTreeByOp(e,t){this.scene2d.updateTreeByOp(e,t),this.applySize()}applyOverrides(e){if(this.frameOverride&&this.frameRoot){this.frameOverride.position=[0,0],this.frameOverride.rotation=0;let t=e?.width??this.width,i=e?.height??this.height;this.frameOverride.width=t,this.frameOverride.height=i,this.frameOverride.localMatrix=S5e,this.isScreenSpace&&(this.frameOverride.fill.color=Vr.from0to1([0,0,0,0])),this.frameOverride.data={...this.frameOverride.data,width:t,height:i},WEe({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(e,t=window.devicePixelRatio){let i=Math.max(1,e?.width??this.width),r=Math.max(1,e?.height??this.height);this.dpr=t,this.width=i,this.height=r,this._innerApplySize();let n=function(a,s,o,l){let h=h0e(a,s,o,l),u=Math.max(o,512/Math.min(a,s)),d=Math.min(u,h);return{width:Math.max(1,Math.ceil(a*d)),height:Math.max(1,Math.ceil(s*d))}}(i,r,t,this.isScreenSpace);this.renderTarget.setSize(n.width,n.height),this._canvasTexture?.dispose(),this._canvasTexture=void 0,this.applyOverrides(e),this.frameOverride?.requestRender()}applyFrame(e){let t=this.context.scene.find2D(e);if(t&&t instanceof $c)return this.disposeFrameOverride(),this.frameRoot=t,this.frameOverride=t.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(),t}get frame(){return this.frameOverride}get frameId(){return this.frame?.uuid}find(e){return this.scene2d.find(e)}get texture(){return this.textureHolder?.getTexture(1001)}disposeFrameOverride(){this.frameOverride?.removeEventListener("render",this.onRenderRequestedDownstream),this.frameOverride?.traverse(e=>{e.removeEventListener("beginState",this.onFrameOverrideObjectEvent),e.removeEventListener("completeState",this.onFrameOverrideObjectEvent)}),this.frameOverride&&this.scene2d.remove(this.frameOverride)}};function WEe({objectOverride:e,objectRoot:t,newParentWidth:i,newParentHeight:r,initialParentWidth:n,initialParentHeight:a}){if(e instanceof $c&&t instanceof $c||e instanceof Gg&&t instanceof Gg)for(let s=0,o=e.children.length;s<o;s++){let l=e.children[s],h=t.children[s];l&&h&&l.uuid===h.uuid&&T5e({objectOverride:l,objectRoot:h,newParentWidth:i,newParentHeight:r,initialParentWidth:n,initialParentHeight:a})}}function T5e({objectOverride:e,objectRoot:t,newParentWidth:i,newParentHeight:r,initialParentWidth:n,initialParentHeight:a}){let[s,o]=function(d){if(Z9(d))return[d.width,d.height];if(d instanceof n4){let[c,p]=d.getHalfSize();return[2*c,2*p]}if(d instanceof Gg){let[c,p]=d.recursiveBBox.getHalfSize();return[2*c,2*p]}return[0,0]}(t),{width:l,height:h,position:u}=GEe({constraints:e.data,newParentWidth:i,newParentHeight:r,initialParentWidth:n,initialParentHeight:a,objectInitialWidth:s,objectInitialHeight:o,objectInitialPosition:t.position});if(e.position=u,e.data={...e.data,position:u},e.states)for(let d in e.states)M5e({stateId:d,objectOverride:e,objectRoot:t,newParentWidth:i,newParentHeight:r,initialParentWidth:n,initialParentHeight:a});if(Z9(e)||e instanceof Gg)Z9(e)&&(e.width=l,e.height=h,e.data={...e.data,width:l,height:h}),WEe({objectOverride:e,objectRoot:t,newParentWidth:l,newParentHeight:h,initialParentWidth:s,initialParentHeight:o});else if(e instanceof n4){let d=t,c=s!==0?l/s:1,p=o!==0?h/o:1;e.path=function(m,f=1,g=1){if(f<=0||g<=0)return m;if(VEe(m))return console.warn("Cannot scale invalid path",m),X9([]);if(f===1&&g===1)return m;try{return X9((0,_5e.parseSVG)(m).map(v=>{let y={...v};return"x"in y&&(y.x=y.x*f),"y"in y&&(y.y=y.y*g),"x1"in y&&(y.x1=y.x1*f),"x2"in y&&(y.x2=y.x2*f),"y1"in y&&(y.y1=y.y1*g),"y2"in y&&(y.y2=y.y2*g),"rx"in y&&(y.rx=y.rx*f),"ry"in y&&(y.ry=y.ry*g),y}))}catch(v){return console.warn("Error parsing SVG path",v),X9([])}}(d.path,c,p),e.data={...e.data,path:e.path}}}function M5e({stateId:e,objectOverride:t,objectRoot:i,newParentWidth:r,newParentHeight:n,initialParentWidth:a,initialParentHeight:s}){let o=t.states?.[e],l=i.states?.[e];if(o&&l){let{width:h,height:u,position:d}=GEe({constraints:t.data,newParentWidth:r,newParentHeight:n,initialParentWidth:a,initialParentHeight:s,objectInitialWidth:xy.isResizeable(l)?l.width:0,objectInitialHeight:xy.isResizeable(l)?l.height:0,objectInitialPosition:l.position});Object.assign(t.states[e],{position:d}),xy.isResizeable(o)&&Object.assign(t.states[e],{width:h,height:u})}}function Z9(e){return e instanceof GA||e instanceof $c||e instanceof sK||e instanceof oK}F4();var u0e,E5e=class extends An{constructor(e,t,i){super(e,t,i),this.isUIObject=!0,this.uiCanvas=new HEe(e+"-canvas",t.geometry.width,t.geometry.height,i),this.uiCanvas.promise.then(()=>{this.applyFrame(this.dataPatched.geometry.frame,i.shared)})}updateByPatchedOpGeometry(e,t,i){super.updateByPatchedOpGeometry(e,t,i),e.type===0&&(e.props.frame!==void 0&&this.applyFrame(e.props.frame,i.shared),(e.props.width!==void 0||e.props.height!==void 0)&&this.applySize(e.props,i.shared))}applySize(e,t){let i=e?.width??this.dataPatched.geometry.width,r=e?.height??this.dataPatched.geometry.height;this.uiCanvas.applySize({width:i,height:r}),this.applyGeometryParametersFromFrame(t)}applyFrame(e,t){this.uiCanvas.applyFrame(e),this.applyGeometryParametersFromFrame(t),this.applyMaterialParametersFromFrame({shared:t})}applyGeometryParametersFromFrame(e){let t=this.frame;t&&(Object.assign(this.data,{geometry:Object.assign(this.data.geometry,{cornerRadius:t.cornerRadius,cornerType:0})}),Object.assign(this.dataPatched,{geometry:Object.assign(this.dataPatched.geometry,{cornerRadius:t.cornerRadius,cornerType:0})}),this.localGeometry?.dispose(),this.localGeometry=Ng(this.dataPatched.geometry,e,this.data.flatShading,this))}applyMaterialParametersFromFrame(e){let t=this.frame;if(t){let i=t.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,e,!0)}}updateEntity2DByOp(e,t,i,r){this.uiCanvas.updateEntity2DByOp(e,t,i,r),e===this.frameId&&t.type===0&&(t.props.cornerRadius!==void 0?this.applyGeometryParametersFromFrame(r):Qr(t.path,["backgroundBlur"])&&this.applyMaterialParametersFromFrame({shared:r}))}get frame(){return this.uiCanvas.frame}get frameId(){return this.frame?.uuid}removeInteractionGeometry(e){super.removeInteractionGeometry(e),this.applySize({},e)}updateGeometryInteractions(e,t){super.updateGeometryInteractions(e,t),this.applySize({width:e.width,height:e.height},t);let i={...this.data.geometry,...e};this.localGeometry?.dispose(),this.localGeometry=Ng(i,t,this.data.flatShading,this)}};_r(),ww("UIGeometry",(e,t,i)=>new E5e(e,t,i)),P4=u0e={Scene2D:lK,UICanvas:HEe,loadHanaUIRUNTIME:function(){return t4||(t4=async()=>async function(e,t){return await e.default(t?{module_or_path:t}:void 0),Object.getOwnPropertyDescriptor(e.Engine.prototype,"scene")||Object.defineProperty(e.Engine.prototype,"scene",{get:function(){let i=Object.create(e.SceneController.prototype);return i.__wbg_ptr=this.__wbg_ptr,i}}),{createEngine:i=>e.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(()=>(kZ(),VZ)),Kge??function(){let e=typeof process<"u"?"2.0.13":void 0;return`https://cdn.spline.design/@splinetool/runtime${e?`@${e}`:""}/build/hana-ui.wasm`}())),FEe().then(()=>{})},setHanaUIWasmUrl:function(e){Kge=e}},sL!==null&&u0e.setHanaUIWasmUrl(sL),In("ui-2d"),aY(),bbe(),le();var qEe,Q9,A5e=class{constructor(){this.type="ShapePath",this.color=new ot,this.subPaths=[],this.currentPath=null}moveTo(e,t){return this.currentPath=new dE,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this}lineTo(e,t){return this.currentPath?.lineTo(e,t),this}quadraticCurveTo(e,t,i,r){return this.currentPath?.quadraticCurveTo(e,t,i,r),this}bezierCurveTo(e,t,i,r,n,a){return this.currentPath?.bezierCurveTo(e,t,i,r,n,a),this}splineThru(e){return this.currentPath?.splineThru(e),this}toShapes(){let e={loc:0,t:0};function t(h,u,d,c){let p=h.x,m=u.x,f=d.x,g=c.x,v=h.y,y=u.y,_=d.y,b=c.y,x=(g-f)*(v-_)-(b-_)*(p-f),w=(b-_)*(m-p)-(g-f)*(y-v),S=x/w,M=((m-p)*(v-_)-(y-v)*(p-f))/w;if(w===0&&x!==0||S<=0||S>=1||M<0||M>1)return null;if(x===0&&w===0){for(let T=0;T<2;T++){if(i(T===0?d:c,h,u),e.loc===0){let A=T===0?d:c;return{x:A.x,y:A.y,t:e.t}}if(e.loc===2)return{x:+(p+e.t*(m-p)).toPrecision(10),y:+(v+e.t*(y-v)).toPrecision(10),t:e.t}}return null}for(let T=0;T<2;T++)if(i(T===0?d:c,h,u),e.loc===0){let A=T===0?d:c;return{x:A.x,y:A.y,t:e.t}}return{x:+(p+S*(m-p)).toPrecision(10),y:+(v+S*(y-v)).toPrecision(10),t:S}}function i(h,u,d){let c,p=d.x-u.x,m=d.y-u.y,f=h.x-u.x,g=h.y-u.y,v=p*g-f*m;return h.x===u.x&&h.y===u.y?(e.loc=0,void(e.t=0)):h.x===d.x&&h.y===d.y?(e.loc=1,void(e.t=1)):void(v<-Number.EPSILON?e.loc=3:v>Number.EPSILON?e.loc=4:p*f<0||m*g<0?e.loc=5:Math.sqrt(p*p+m*m)<Math.sqrt(f*f+g*g)?e.loc=6:(c=p!==0?f/p:g/m,e.loc=2,e.t=c))}let r=0,n=999999999,a=-999999999,s=[];this.subPaths.forEach(h=>{let u=h.getPoints(),d=-999999999,c=999999999,p=-999999999,m=999999999;for(let f=0;f<u.length;f++){let g=u[f];g.y>d&&(d=g.y),g.y<c&&(c=g.y),g.x>p&&(p=g.x),g.x<m&&(m=g.x)}a<=p&&(a=p+1),n>=m&&(n=m-1),u.length&&s.push({curves:h.curves,points:u,isCW:n7.isClockWise(u),identifier:r++,boundingBox:new v4(new J(m,c),new J(p,d))})});let o=s.map(h=>function(u,d,c,p,m){(m==null||m==="")&&(m="nonzero");let f=new J;u.boundingBox.getCenter(f);let g=function(w,S,M){let T=new J;S.getCenter(T);let A=[];return M.forEach(E=>{E.boundingBox.containsPoint(T)&&function(C,N){let P=[],I=[];for(let L=1;L<C.length;L++){let B=C[L-1],G=C[L];for(let j=1;j<N.length;j++){let $=t(B,G,N[j-1],N[j]);$!==null&&P.find(H=>H.t<=$.t+Number.EPSILON&&H.t>=$.t-Number.EPSILON)===void 0&&(P.push($),I.push(new J($.x,$.y)))}}return I}(w,E.points).forEach(C=>{A.push({identifier:E.identifier,isCW:E.isCW,point:C})})}),A.sort((E,C)=>E.point.x-C.point.x),A}([new J(c,f.y),new J(p,f.y)],u.boundingBox,d);g.sort((w,S)=>w.point.x-S.point.x);let v=[],y=[];g.forEach(w=>{w.identifier===u.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(u.identifier),m==="evenodd"){let w=b.length%2==0,S=b[b.length-2];return{identifier:u.identifier,isHole:w,for:S}}if(m==="nonzero"){let w=!0,S=null,M=null;for(let T=0;T<b.length;T++){let A=b[T];d[A]&&(w?(M=d[A].isCW,w=!1,S=A):M!==d[A].isCW&&(M=d[A].isCW,w=!0))}return{identifier:u.identifier,isHole:w,for:S}}console.warn('fill-rule: "'+m+'" is currently not implemented.')}(h,s,n,a,this.userData?.style.fillRule)),l=[];return s.forEach(h=>{let u=o[h.identifier];if(u&&!u.isHole){let d=new YE;d.curves=h.curves,o.filter(c=>c?.isHole&&c.for===h.identifier).forEach(c=>{if(c){let p=s[c.identifier],m=new dE;m.curves=p.curves,d.holes.push(m)}}),l.push(d)}}),l}},$Ee=!1,d0e=new Promise(e=>{qEe=e}),c0e=!1;function p0e(){if($Ee=!0,!c0e)return Q9||(Q9=async function(){let e=await import("./opentype.js");qEe(e),c0e=!0}(),Q9)}var C5e=new class{async load(e,t,i=()=>{}){let{load:r}=await d0e;r(e,(n,a)=>{n||!a?i(n??"Something went wrong"):t(a)})}async parse(e){let{parse:t,Bidi:i}=await d0e;try{let r=t(e),n=new i,a=s=>r.charToGlyphIndex(s.char);return n.registerModifier("glyphIndex",null,a),n.applyFeatures(r,r.defaultRenderOptions.features),{font:r,bidi:n}}catch(r){console.error(r)}}};function P5e(e,t){return t.state.glyphIndex===e||t.state.fina===e||t.state.medi===e||t.state.init===e}le(),IX(),_r(),ww("TextGeometry",(e,t,i)=>new H4(e,t,i));var m0e={create:(e,t)=>new PH(e,t)};oH("TextGeometry",m0e),oH("InputGeometry",m0e),NX=class{constructor(e){this._arrayBuffer=new ArrayBuffer(1),this._isLoaded=!1,this._intercepted=!1,this._layoutErrorWarned=!1,this._isUserFont=e.isUserFont??!1,this._loadingPromise=this.load(e)}update(e){this._isLoaded=!1,this._isUserFont=e.isUserFont??!1,this._loadingPromise=this.load(e)}async load(e){try{this._layoutErrorWarned=!1;let t=await async function(i){let r,n,a=!1;if(i.url?(r=await async function(s){let o;try{o=await fetch(s)}catch(l){throw new Error(`could not fetch the font at ${s}: ${l}`)}if(!o.ok)throw new Error(`${o.status} ${o.statusText} fetching the font at ${s}`);return await o.arrayBuffer()}(i.url),n=i.url,a=i.url.startsWith("/")):i.data&&(r=i.data.buffer.slice(i.data.byteOffset,i.data.byteOffset+i.data.byteLength)),r){if(!$Ee)return{font:void 0,url:n,intercepted:a,arr:r,bidi:null};{let s=await C5e.parse(r);if(s)return{font:s.font,url:n,intercepted:a,arr:r,bidi:s.bidi}}}}(e);t&&(this._arrayBuffer=t.arr,this._url=t.url,this.font=t.font,this._intercepted=t.intercepted,this._isLoaded=!0,this._bidi=t.bidi)}catch(t){console.warn(`Could not load the font "${e.url??"(inline data)"}"`,t)}}warnLayoutError(e){this._layoutErrorWarned||(this._layoutErrorWarned=!0,console.warn(`Text layout failed for the font "${this._url??"(inline data)"}"`,e))}get url(){return this._url}get intercepted(){return this._intercepted}get isLoaded(){return this._isLoaded}get loadingPromise(){return this._loadingPromise}reverseLigaturesTable(e,t,i){if(!this._bidi)return[];let r=this._bidi;r.getTextGlyphs(t);let n=r.tokenizer.tokens,a=[],s=0,o=i.length===n.length;for(let l=0;l<i.length;l++){let h=i[l].index,u=String.fromCharCode(i[l].unicode),d=n[s];if(P5e(h,d)||o)a.push({char:u,index:h,replacements:[d.state.glyphIndex],replacementChars:[d.char]}),s++;else{let c=d.char,p="",m=[d.state.glyphIndex],f=[],g=!1;for(;!g;)s++,p=t.charAt(s),c+=p,m.push(e.charToGlyphIndex(p)),f=e.stringToGlyphs(c),f.length===1&&f[0].index===h&&(g=!0),s>t.length&&(g=!0);a.push({char:u,index:h,replacements:m,replacementChars:Array.from(c)}),s++}}return a}generateShapes(e,t,i){if(!this._isLoaded)return;let r=this.font,n=t.fontSize/this.unitsPerEm,a=t.fontSize*t.lineHeight,s=e.map(v=>this.getTextWidth(v,t)),o=typeof t.width=="string"?Number(i.getVariable(t.width)):t.width,l=typeof t.height=="string"?Number(i.getVariable(t.height)):t.height,h=this.getCharWidth(`
|
|
12892
12892
|
`,t),u=t.horizontalAlign===1?h:0,d=this.getLineInitialOffsetX(s[0],o,t.horizontalAlign,e[0],h),c=this.getLineInitialOffsetY(a,e.length,l,n,t.verticalAlign),p=[],m=e.map(()=>[]),f=e.map(()=>[]);for(let v=0;v<e.length;v++){let y=e[v],_={features:{liga:!0},letterSpacing:t.letterSpacing},b=[];try{b=r.stringToGlyphs(y,_)}catch(T){this.warnLayoutError(T)}d=this.getLineInitialOffsetX(s[v],o,t.horizontalAlign,y,h);let x=[];try{x=this.reverseLigaturesTable(r,y,b)}catch(T){this.warnLayoutError(T)}let w=this.computeSpaceWidthForLine(e,v,t,i),S=0,M=b[0];M&&t.horizontalAlign===2&&M.leftSideBearing!==void 0&&(d-=M.leftSideBearing*n);try{this.font?.forEachGlyph(y,d,c,t.fontSize,_,(T,A,E,C,N)=>{let P=T.index===0?`
|
|
12893
12893
|
`:T.unicode?String.fromCharCode(T.unicode):void 0,I=x[S],L=0;if(P===`
|
|
12894
12894
|
`)L=u;else if(P===" ")L=w;else{let B=this.createPath(T,n,A,E,t);B&&(L=B.offsetX,p.push(B.path))}if(I&&I.replacements.length!==1){let B=I.replacements.map(H=>(r.glyphs.get(H).advanceWidth??0)*n),G=B.reduce((H,te)=>H+te,0),j=B.map(H=>H/G),$=A;for(let H=0;H<j.length;H++){let te=L*j[H];f[v].push([$,E]),m[v].push(te),$+=te}}else f[v].push([A,E]),m[v].push(L);S++})}catch(T){this.warnLayoutError(T)}c-=a}let g=[];for(let v=0,y=p.length;v<y;v++)g.push(...p[v].toShapes());return{shapes:g,charWidths:m,lineWidths:s,charCoords:f}}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(e,t,i,r,n){return(i===3||i===2)&&r.indexOf(`
|
|
12895
|
-
`)>=0&&(e-=n),i===3?.5*t-.5*e:i===2?t-e:0}getLineInitialOffsetY(e,t,i,r,n){let a=t*e,s=e-Math.abs(this.ascender-this.descender)*r,o=-this.ascender*r-s/2;return n===3?-(i-a-o):n===2?-(.5*i-.5*a-o):o}createPath(e,t,i,r,n){let a=e.getPath(i,-r,n.fontSize,{kerning:!1,letterSpacing:n.letterSpacing});if(!a)return void console.error('THREE.Font: character "'+e+'" does not exists in font family '+this.familyName+".");let s=new A5e,o=(e.advanceWidth??1)*t;if(e)for(let l of a.commands){let h=s.currentPath?.currentPoint;if(!h||l.type==="Z"||h.x!==l.x||-h.y!==l.y)switch(l.type){case"M":s.moveTo(l.x,-l.y);break;case"L":s.lineTo(l.x,-l.y);break;case"Q":s.quadraticCurveTo(l.x1,-l.y1,l.x,-l.y);break;case"C":s.bezierCurveTo(l.x1,-l.y1,l.x2,-l.y2,l.x,-l.y)}}return s.subPaths.forEach(l=>{let h=function(u){if(u.length){let d=u[0];if(d instanceof Th)return d.v1;if(d instanceof fu||d instanceof lm)return d.v0}}(l.curves);h!==void 0&&l.currentPoint.distanceTo(h)>0&&l.lineTo(h.x,h.y)}),{offsetX:o,path:s}}getCharWidth(e,t){try{return this.font?.getAdvanceWidth(e,t.fontSize,{kerning:!0,letterSpacing:t.letterSpacing})??0}catch(i){return this.warnLayoutError(i),0}}getTextWidth(e,t){try{return this.font?.getAdvanceWidth(e,t.fontSize,{kerning:!0,letterSpacing:t.letterSpacing})??0}catch(i){return this.warnLayoutError(i),0}}computeSpaceWidthForLine(e,t,i,r){let n=this.getCharWidth(" ",i),a=e[t];if(a){let s=this.countSpaces(a.trimEnd());if(i.horizontalAlign===4&&t<e.length-1&&s)return((typeof i.width=="string"?Number(r.getVariable(i.width)):i.width)-(this.getTextWidth(a,i)-s*n))/s}return n}countSpaces(e){return(e.match(/ /g)||[]).length}},In("text"),$t();var XEe=null;function f0e(){return XEe}function R5e(e){let t=!1;return e.scene.objects.forEach(i=>{i.data.type==="Page"&&!t&&i.data.publish.gameControlObject&&tw.traverseModuleInstances(e,i.id,(r,n,a)=>{for(let s of a)s.data.type==="GameControl"&&s.data.navmesh.enabled&&(t=!0)})}),t}kr();var pN=(e,t)=>{let i=t.x-e.x,r=t.y-e.y;return Math.sqrt(i*i+r*r)},J9=e=>e*(Math.PI/180),mN=new Map,a4=(e,t,i)=>{let r,n=t.split(/[ ,]+/g);for(let a=0;a<n.length;a+=1)r=n[a],e.addEventListener?e.addEventListener(r,i,!1):e.attachEvent&&e.attachEvent(r,i)},s4=(e,t,i)=>{let r,n=t.split(/[ ,]+/g);for(let a=0;a<n.length;a+=1)r=n[a],e.removeEventListener?e.removeEventListener(r,i):e.detachEvent&&e.detachEvent(r,i)},YEe=e=>(e.preventDefault(),e.type.match(/^touch/)?e.changedTouches:e),g0e=()=>{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}},ej=(e,t)=>{t.top||t.right||t.bottom||t.left?(e.style.top=t.top,e.style.right=t.right,e.style.bottom=t.bottom,e.style.left=t.left):(e.style.left=t.x+"px",e.style.top=t.y+"px")},tj=(e,t,i)=>{let r=KEe(e);for(let n in r)if(Object.prototype.hasOwnProperty.call(r,n))if(typeof t=="string")r[n]=t+" "+i;else{let a="";for(let s=0,o=t.length;s<o;s+=1)a+=t[s]+" "+i+", ";r[n]=a.slice(0,-2)}return r},KEe=e=>{let t={};return t[e]="",["webkit","Moz","o"].forEach(function(i){t[i+e.charAt(0).toUpperCase()+e.slice(1)]=""}),t},ij=(e,t)=>{for(let i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},r$=(e,t)=>{if(e.length)for(let i=0,r=e.length;i<r;i+=1)t(e[i]);else t(e)};typeof window<"u"&&(ZEe="ontouchstart"in window,QEe=!!window.PointerEvent,JEe=!!window.MSPointerEvent);var ZEe,QEe,JEe,ob,v0e={start:"mousedown",move:"mousemove",end:"mouseup"},W2={};function kv(){}QEe?ob={start:"pointerdown",move:"pointermove",end:"pointerup, pointercancel"}:JEe?ob={start:"MSPointerDown",move:"MSPointerMove",end:"MSPointerUp"}:ZEe?(ob={start:"touchstart",move:"touchmove",end:"touchend, touchcancel"},W2=v0e):ob=v0e,kv.prototype.on=function(e,t){var i,r=this,n=e.split(/[ ,]+/g);r._handlers_=r._handlers_||{};for(var a=0;a<n.length;a+=1)i=n[a],r._handlers_[i]=r._handlers_[i]||[],r._handlers_[i].push(t);return r},kv.prototype.off=function(e,t){var i=this;return i._handlers_=i._handlers_||{},e===void 0?i._handlers_={}:t===void 0?i._handlers_[e]=null:i._handlers_[e]&&i._handlers_[e].indexOf(t)>=0&&i._handlers_[e].splice(i._handlers_[e].indexOf(t),1),i},kv.prototype.trigger=function(e,t){var i,r=this,n=e.split(/[ ,]+/g);r._handlers_=r._handlers_||{};for(var a=0;a<n.length;a+=1)i=n[a],r._handlers_[i]&&r._handlers_[i].length&&r._handlers_[i].forEach(function(s){s.call(r,{type:i,target:r},t)})},kv.prototype.config=function(e){var t=this;t.options=t.defaults||{},e&&(t.options=((i,r)=>{let n={};for(let a in i)Object.prototype.hasOwnProperty.call(i,a)&&Object.prototype.hasOwnProperty.call(r,a)?n[a]=r[a]:Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a]);return n})(t.options,e))},kv.prototype.bindEvt=function(e,t){var i=this;return i._domHandlers_=i._domHandlers_||{},i._domHandlers_[t]=function(){typeof i["on"+t]=="function"?i["on"+t].apply(i,arguments):console.warn('[WARNING] : Missing "on'+t+'" handler.')},a4(e,ob[t],i._domHandlers_[t]),W2[t]&&a4(e,W2[t],i._domHandlers_[t]),i},kv.prototype.unbindEvt=function(e,t){var i=this;return i._domHandlers_=i._domHandlers_||{},s4(e,ob[t],i._domHandlers_[t]),W2[t]&&s4(e,W2[t],i._domHandlers_[t]),delete i._domHandlers_[t],this};var hK=kv;function xs(e,t){return this.identifier=t.identifier,this.position=t.position,this.frontPosition=t.frontPosition,this.collection=e,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(t),this.options.mode==="dynamic"&&(this.options.restOpacity=0),this.id=xs.id,xs.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}xs.prototype=new hK,xs.constructor=xs,xs.id=0,xs.prototype.buildEl=function(e){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},xs.prototype.stylize=function(){if(this.options.dataOnly)return this;var e=this.options.fadeTime+"ms",t=(()=>{let n=KEe("borderRadius");for(let a in n)Object.prototype.hasOwnProperty.call(n,a)&&(n[a]="50%");return n})(),i=tj("transition","opacity",e),r={};return r.el={position:"absolute",opacity:this.options.restOpacity,display:"block",zIndex:999},r.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)"},r.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)"},ij(r.el,i),this.options.shape==="circle"&&ij(r.back,t),ij(r.front,t),this.applyStyles(r),this},xs.prototype.applyStyles=function(e){for(var t in this.ui)if(Object.prototype.hasOwnProperty.call(this.ui,t))for(var i in e[t])this.ui[t].style[i]=e[t][i];return this},xs.prototype.addToDom=function(){return this.options.dataOnly||document.body.contains(this.ui.el)||this.options.zone.appendChild(this.ui.el),this},xs.prototype.removeFromDom=function(){return this.options.dataOnly||!document.body.contains(this.ui.el)||this.options.zone.removeChild(this.ui.el),this},xs.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},xs.prototype.show=function(e){var t=this;return t.options.dataOnly||(clearTimeout(t.removeTimeout),clearTimeout(t.showTimeout),clearTimeout(t.restTimeout),t.addToDom(),t.restCallback(),setTimeout(function(){t.ui.el.style.opacity=1},0),t.showTimeout=setTimeout(function(){t.trigger("shown",t.instance),typeof e=="function"&&e.call(this)},t.options.fadeTime)),t},xs.prototype.hide=function(e){var t=this;if(t.options.dataOnly)return t;if(t.ui.el.style.opacity=t.options.restOpacity,clearTimeout(t.removeTimeout),clearTimeout(t.showTimeout),clearTimeout(t.restTimeout),t.removeTimeout=setTimeout(function(){var i=t.options.mode==="dynamic"?"none":"block";t.ui.el.style.display=i,typeof e=="function"&&e.call(t),t.trigger("hidden",t.instance)},t.options.fadeTime),t.options.restJoystick){let i=t.options.restJoystick,r={};r.x=i===!0||i.x!==!1?0:t.instance.frontPosition.x,r.y=i===!0||i.y!==!1?0:t.instance.frontPosition.y,t.setPosition(e,r)}return t},xs.prototype.setPosition=function(e,t){var i=this;i.frontPosition={x:t.x,y:t.y};var r=i.options.fadeTime+"ms",n={};n.front=tj("transition",["top","left"],r);var a={front:{}};a.front={left:i.frontPosition.x+"px",top:i.frontPosition.y+"px"},i.applyStyles(n),i.applyStyles(a),i.restTimeout=setTimeout(function(){typeof e=="function"&&e.call(i),i.restCallback()},i.options.fadeTime)},xs.prototype.restCallback=function(){var e=this,t={};t.front=tj("transition","none",""),e.applyStyles(t),e.trigger("rested",e.instance)},xs.prototype.resetDirection=function(){this.direction={x:!1,y:!1,angle:!1}},xs.prototype.computeDirection=function(e){var t,i,r,n=e.angle.radian,a=Math.PI/4,s=Math.PI/2;if(n>a&&n<3*a&&!e.lockX?t="up":n>-a&&n<=a&&!e.lockY?t="left":n>3*-a&&n<=-a&&!e.lockX?t="down":e.lockY||(t="right"),e.lockY||(i=n>-s&&n<s?"left":"right"),e.lockX||(r=n>0?"up":"down"),e.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 h={};for(o in this.direction={x:i,y:r,angle:t},e.direction=this.direction,l)l[o]===this.direction[o]&&(h[o]=!0);if(h.x&&h.y&&h.angle)return e;(!h.x||!h.y)&&this.trigger("plain",e),h.x||this.trigger("plain:"+i,e),h.y||this.trigger("plain:"+r,e),h.angle||this.trigger("dir dir:"+t,e)}else this.resetDirection();return e};var D5e=xs;function qa(e,t){var i=this;i.nipples=[],i.idles=[],i.actives=[],i.ids=[],i.pressureIntervals={},i.manager=e,i.id=qa.id,qa.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(t),(i.options.mode==="static"||i.options.mode==="semi")&&(i.options.multitouch=!1),i.options.multitouch||(i.options.maxNumberOfNipples=1);let r=getComputedStyle(i.options.zone.parentElement);return r&&r.display==="flex"&&(i.parentIsFlex=!0),i.updateBox(),i.prepareNipples(),i.bindings(),i.begin(),i.nipples}qa.prototype=new hK,qa.constructor=qa,qa.id=0,qa.prototype.prepareNipples=function(){var e=this,t=e.nipples;t.on=e.on.bind(e),t.off=e.off.bind(e),t.options=e.options,t.destroy=e.destroy.bind(e),t.ids=e.ids,t.id=e.id,t.processOnMove=e.processOnMove.bind(e),t.processOnEnd=e.processOnEnd.bind(e),t.get=function(i){if(i===void 0)return t[0];for(var r=0,n=t.length;r<n;r+=1)if(t[r].identifier===i)return t[r];return!1}},qa.prototype.bindings=function(){var e=this;e.bindEvt(e.options.zone,"start"),e.options.zone.style.touchAction="none",e.options.zone.style.msTouchAction="none"},qa.prototype.begin=function(){var e=this,t=e.options;if(t.mode==="static"){var i=e.createNipple(t.position,e.manager.getIdentifier());i.add(),e.idles.push(i)}},qa.prototype.createNipple=function(e,t){var i=this,r=i.manager.scroll,n={},a=i.options,s=i.parentIsFlex?r.x:r.x+i.box.left,o=i.parentIsFlex?r.y:r.y+i.box.top;if(e.x&&e.y)n={x:e.x-s,y:e.y-o};else if(e.top||e.right||e.bottom||e.left){var l=document.createElement("DIV");l.style.display="hidden",l.style.top=e.top,l.style.right=e.right,l.style.bottom=e.bottom,l.style.left=e.left,l.style.position="absolute",a.zone.appendChild(l);var h=l.getBoundingClientRect();a.zone.removeChild(l),n=e,e={x:h.left+r.x,y:h.top+r.y}}var u=new D5e(i,{color:a.color,size:a.size,threshold:a.threshold,fadeTime:a.fadeTime,dataOnly:a.dataOnly,restJoystick:a.restJoystick,restOpacity:a.restOpacity,mode:a.mode,identifier:t,position:e,zone:a.zone,frontPosition:{x:0,y:0},shape:a.shape});return a.dataOnly||(ej(u.ui.el,n),ej(u.ui.front,u.frontPosition)),i.nipples.push(u),i.trigger("added "+u.identifier+":added",u),i.manager.trigger("added "+u.identifier+":added",u),i.bindNipple(u),u},qa.prototype.updateBox=function(){this.box=this.options.zone.getBoundingClientRect()},qa.prototype.bindNipple=function(e){var t,i=this,r=function(n,a){t=n.type+" "+a.id+":"+n.type,i.trigger(t,a)};e.on("destroyed",i.onDestroyed.bind(i)),e.on("shown hidden rested dir plain",r),e.on("dir:up dir:right dir:down dir:left",r),e.on("plain:up plain:right plain:down plain:left",r)},qa.prototype.pressureFn=function(e,t,i){var r=this,n=0;clearInterval(r.pressureIntervals[i]),r.pressureIntervals[i]=setInterval(function(){var a=e.force||e.pressure||e.webkitForce||0;a!==n&&(t.trigger("pressure",a),r.trigger("pressure "+t.identifier+":pressure",a),n=a)}.bind(r),100)},qa.prototype.onstart=function(e){var t=this,i=t.options,r=e;return e=YEe(e),t.updateBox(),r$(e,function(n){t.actives.length<i.maxNumberOfNipples?t.processOnStart(n):r.type.match(/^touch/)&&(Object.keys(t.manager.ids).forEach(function(a){if(Object.values(r.touches).findIndex(function(o){return o.identifier===a})<0){var s=[e[0]];s.identifier=a,t.processOnEnd(s)}}),t.actives.length<i.maxNumberOfNipples&&t.processOnStart(n))}),t.manager.bindDocument(),!1},qa.prototype.processOnStart=function(e){var t,i=this,r=i.options,n=i.manager.getIdentifier(e),a=e.force||e.pressure||e.webkitForce||0,s={x:e.pageX,y:e.pageY},o=i.getOrCreate(n,s);o.identifier!==n&&i.manager.removeIdentifier(o.identifier),o.identifier=n;var l=function(h){h.trigger("start",h),i.trigger("start "+h.id+":start",h),h.show(),a>0&&i.pressureFn(e,h,h.identifier),i.processOnMove(e)};if((t=i.idles.indexOf(o))>=0&&i.idles.splice(t,1),i.actives.push(o),i.ids.push(o.identifier),r.mode!=="semi")l(o);else{if(!(pN(s,o.position)<=r.catchDistance))return o.destroy(),void i.processOnStart(e);l(o)}return o},qa.prototype.getOrCreate=function(e,t){var i,r=this,n=r.options;return/(semi|static)/.test(n.mode)?(i=r.idles[0])?(r.idles.splice(0,1),i):n.mode==="semi"?r.createNipple(t,e):(console.warn("Coudln't find the needed nipple."),!1):i=r.createNipple(t,e)},qa.prototype.processOnMove=function(e){var t=this,i=t.options,r=t.manager.getIdentifier(e),n=t.nipples.get(r),a=t.manager.scroll;if((_=>isNaN(_.buttons)?_.pressure!==0:_.buttons!==0)(e)){if(!n)return console.error("Found zombie joystick with ID "+r),void t.manager.removeIdentifier(r);if(i.dynamicPage){var s=n.el.getBoundingClientRect();n.position={x:a.x+s.left,y:a.y+s.top}}n.identifier=r;var o=n.options.size/2,l={x:e.pageX,y:e.pageY};i.lockX&&(l.y=n.position.y),i.lockY&&(l.x=n.position.x);var h,u,d=pN(l,n.position),c=((_,b)=>{let x=b.x-_.x,w=b.y-_.y;return(S=>S*(180/Math.PI))(Math.atan2(w,x))})(l,n.position),p=J9(c),m=d/o,f={distance:d,position:l};if(n.options.shape==="circle"?(h=Math.min(d,o),u=((_,b,x)=>{let w={x:0,y:0};return x=J9(x),w.x=_.x-b*Math.cos(x),w.y=_.y-b*Math.sin(x),w})(n.position,h,c)):(u=((_,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,n.position,o),h=pN(u,n.position)),i.follow){if(d>o){let _=l.x-u.x,b=l.y-u.y;n.position.x+=_,n.position.y+=b,n.el.style.top=n.position.y-(t.box.top+a.y)+"px",n.el.style.left=n.position.x-(t.box.left+a.x)+"px",d=pN(l,n.position)}}else l=u,d=h;var g=l.x-n.position.x,v=l.y-n.position.y;n.frontPosition={x:g,y:v},i.dataOnly||ej(n.ui.front,n.frontPosition);var y={identifier:n.identifier,position:l,force:m,pressure:e.force||e.pressure||e.webkitForce||0,distance:d,angle:{radian:p,degree:c},vector:{x:g/o,y:-v/o},raw:f,instance:n,lockX:i.lockX,lockY:i.lockY};(y=n.computeDirection(y)).angle={radian:J9(180-c),degree:180-c},n.trigger("move",y),t.trigger("move "+n.id+":move",y)}else this.processOnEnd(e)},qa.prototype.processOnEnd=function(e){var t=this,i=t.options,r=t.manager.getIdentifier(e),n=t.nipples.get(r),a=t.manager.removeIdentifier(n.identifier);!n||(i.dataOnly||n.hide(function(){i.mode==="dynamic"&&(n.trigger("removed",n),t.trigger("removed "+n.id+":removed",n),t.manager.trigger("removed "+n.id+":removed",n),n.destroy())}),clearInterval(t.pressureIntervals[n.identifier]),n.resetDirection(),n.trigger("end",n),t.trigger("end "+n.id+":end",n),t.ids.indexOf(n.identifier)>=0&&t.ids.splice(t.ids.indexOf(n.identifier),1),t.actives.indexOf(n)>=0&&t.actives.splice(t.actives.indexOf(n),1),/(semi|static)/.test(i.mode)?t.idles.push(n):t.nipples.indexOf(n)>=0&&t.nipples.splice(t.nipples.indexOf(n),1),t.manager.unbindDocument(),/(semi|static)/.test(i.mode)&&(t.manager.ids[a.id]=a.identifier))},qa.prototype.onDestroyed=function(e,t){var i=this;i.nipples.indexOf(t)>=0&&i.nipples.splice(i.nipples.indexOf(t),1),i.actives.indexOf(t)>=0&&i.actives.splice(i.actives.indexOf(t),1),i.idles.indexOf(t)>=0&&i.idles.splice(i.idles.indexOf(t),1),i.ids.indexOf(t.identifier)>=0&&i.ids.splice(i.ids.indexOf(t.identifier),1),i.manager.removeIdentifier(t.identifier),i.manager.unbindDocument()},qa.prototype.destroy=function(){var e=this;for(var t in e.unbindEvt(e.options.zone,"start"),e.nipples.forEach(function(i){i.destroy()}),e.pressureIntervals)Object.prototype.hasOwnProperty.call(e.pressureIntervals,t)&&clearInterval(e.pressureIntervals[t]);e.trigger("destroyed",e.nipples),e.manager.unbindDocument(),e.off(),e.pressureIntervals={},e.nipples=[],e.idles=[],e.actives=[],e.ids=[],e.manager=null};var N5e=qa;function rs(e){var t=this;t.ids={},t.index=0,t.collections=[],t.scroll=g0e(),t._windowBound=!1,t.config(e),t.prepareCollections();var i=function(){var r;t.collections.forEach(function(n){n.forEach(function(a){r=a.el.getBoundingClientRect(),a.position={x:t.scroll.x+r.left,y:t.scroll.y+r.top}})})};return t._onResize=function(){(r=>{mN.has(r)&&clearTimeout(mN.get(r)),mN.set(r,setTimeout(function(){mN.delete(r),r()},100))})(i)},t._onScroll=function(){t.scroll=g0e()},t.collections}rs.prototype=new hK,rs.constructor=rs,rs.prototype.prepareCollections=function(){var e=this;e.collections.create=e.create.bind(e),e.collections.on=e.on.bind(e),e.collections.off=e.off.bind(e),e.collections.destroy=e.destroy.bind(e),e.collections.get=function(t){var i;return e.collections.every(function(r){return!(i=r.get(t))}),i}},rs.prototype.create=function(e){return this.createCollection(e)},rs.prototype.bindWindowEvents=function(){var e=this;e._windowBound||typeof window>"u"||(e._windowBound=!0,a4(window,"resize",e._onResize),a4(window,"scroll",e._onScroll))},rs.prototype.unbindWindowEvents=function(){var e=this;!e._windowBound||typeof window>"u"||(e._windowBound=!1,s4(window,"resize",e._onResize),s4(window,"scroll",e._onScroll))},rs.prototype.createCollection=function(e){var t=this,i=new N5e(t,e);return t.bindCollection(i),t.collections.push(i),t.bindWindowEvents(),i},rs.prototype.bindCollection=function(e){var t,i=this,r=function(n,a){t=n.type+" "+a.id+":"+n.type,i.trigger(t,a)};e.on("destroyed",i.onDestroyed.bind(i)),e.on("shown hidden rested dir plain",r),e.on("dir:up dir:right dir:down dir:left",r),e.on("plain:up plain:right plain:down plain:left",r)},rs.prototype.bindDocument=function(){var e=this;e.binded||(e.bindEvt(document,"move").bindEvt(document,"end"),e.binded=!0)},rs.prototype.unbindDocument=function(e){var t=this;(!Object.keys(t.ids).length||e===!0)&&(t.unbindEvt(document,"move").unbindEvt(document,"end"),t.binded=!1)},rs.prototype.getIdentifier=function(e){var t;return e?(t=e.identifier===void 0?e.pointerId:e.identifier)===void 0&&(t=this.latest||0):t=this.index,this.ids[t]===void 0&&(this.ids[t]=this.index,this.index+=1),this.latest=t,this.ids[t]},rs.prototype.removeIdentifier=function(e){var t={};for(var i in this.ids)if(this.ids[i]===e){t.id=i,t.identifier=this.ids[i],delete this.ids[i];break}return t},rs.prototype.onmove=function(e){return this.onAny("move",e),!1},rs.prototype.onend=function(e){return this.onAny("end",e),!1},rs.prototype.oncancel=function(e){return this.onAny("end",e),!1},rs.prototype.onAny=function(e,t){var i,r=this,n="processOn"+e.charAt(0).toUpperCase()+e.slice(1);t=YEe(t);var a=function(s,o,l){l.ids.indexOf(o)>=0&&(l[n](s),s._found_=!0)};return r$(t,function(s){i=r.getIdentifier(s),r$(r.collections,a.bind(null,s,i)),s._found_||r.removeIdentifier(i)}),!1},rs.prototype.destroy=function(){var e=this;e.unbindDocument(!0),e.unbindWindowEvents(),e.ids={},e.index=0,e.collections.forEach(function(t){t.destroy()}),e.collections=[],e.off()},rs.prototype.onDestroyed=function(e,t){var i=this;if(i.collections.indexOf(t)<0)return!1;i.collections.splice(i.collections.indexOf(t),1),i.collections.length===0&&i.unbindWindowEvents()};var I5e=rs,kx=null;function y0e(){return kx||(kx=new I5e),kx}var O5e={create:function(e){return y0e().create(e)},destroy:function(){kx&&(kx.destroy(),kx=null)},get factory(){return y0e()}},L5e=O5e;kr(),$t(),le(),Uh(),xl(),$t();var eAe=null;function rj(){return eAe}var tAe,nj,B5e=new Promise(e=>{tAe=e});function U5e(e){return nj||(nj=async function(){let t=e??"https://cdn.spline.design/@splinetool/runtime@2.0.11/build",i=import("./physics.js"),[r,n]=await Promise.all([i,fetch(`${t}/physics.wasm`).then(a=>a.arrayBuffer())]);await r.init(n),tAe(r)}(),nj)}function iAe(e){let t=e.elements,i=t[0]**2+t[1]**2+t[2]**2,r=t[4]**2+t[5]**2+t[6]**2,n=t[8]**2+t[9]**2+t[10]**2,a=t[0]**2+t[4]**2+t[8]**2,s=t[1]**2+t[5]**2+t[9]**2,o=t[2]**2+t[6]**2+t[10]**2,l=1e-8;return i<l||r<l||n<l||a<l||s<l||o<l}function am(e,t){let i=new At;if(t&&iAe(t))return i.setAttribute("position",new Et([],3)),i.setIndex([]),i;if(!e.getAttribute("position"))return i.setAttribute("position",new Et([],3)),i.setIndex([]),i;let{positions:r,triIndices:n}=VX(e.getAttribute("position"),e.getIndex());return i.setAttribute("position",new Et(r,3)),i.setIndex(n),t&&i.applyMatrix4(t),i}sa(),xl(),_r(),iY(),le(),le(),Tw(),CA();var Mr,F5e=class{constructor(e,t,i,r,n,a){this.id=e,this.data=t,this.object=i,this.initialDisabled=!1,this.actions=us(t,t.actions,r,n,a,i),this.target=t.target}disconnect(){Ks(this.actions)}dispatch(e){this.initialDisabled||(this.actions.Transition.forEach(t=>{t.object.currentTransitionEvent!==this&&(t.object.currentTransitionEvent=this,t.init())}),this.object.dispatchEvent({type:"beginEvent",eventName:"Collision"}),this.actions.Transition.forEach(t=>{t.data.runMode==="Toggle"?t.toggle():t.play()}),this.actions.Animation.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.Reset.forEach(t=>{t.dispatch()}),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(e??!1)}),this.actions.SetVariable.forEach(t=>t.checkConditions()),this.actions.SetVariable.forEach(t=>t.dispatch()),this.actions.DynamicVariablePlay.forEach(t=>t.dispatch()),this.actions.Audio.forEach(t=>{t.dispatchBasic()}),this.actions.Particles.forEach(t=>{t.dispatchBasic()}),this.actions.Video.forEach(t=>{t.dispatchBasic()}),this.actions.ClearLocalStorage.forEach(t=>t.dispatch()),this.actions.UserAPI.forEach(t=>t.dispatch()))}},_0e=class{constructor(e,t,i,r,n,a){this.id=e,this.data=t,this.object=i,this.page=r,this.currentIntersectedObjects=[],this.actions=us(t,t.actions,r,n,a,i),this.target=t.target,this.triggeringObjects=[];for(let s of t.triggeringObjects){let o=r.scene.find(s);o&&this.triggeringObjects.push(o)}}isValidTriggeringObject(e){return this.target==="all"||this.triggeringObjects.some(t=>t===e||t.isAncestorOf(e.uuid)||e.isAncestorOf(t.uuid))}disconnect(){Ks(this.actions)}dispatch(){this.object.destroyedInAction||(this.actions.Transition.forEach(e=>{e.object.currentTransitionEvent!==this&&(e.object.currentTransitionEvent=this,e.init())}),this.object.dispatchEvent({type:"beginEvent",eventName:"Trigger"}),this.actions.Transition.forEach(e=>{e.data.runMode==="Toggle"?e.toggle():e.play()}),this.actions.SwitchCamera.forEach(e=>{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.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(!1)}),this.actions.Audio.forEach(e=>{e.dispatchBasic()}),this.actions.Particles.forEach(e=>{e.dispatchBasic()}),this.actions.Video.forEach(e=>{e.dispatchBasic()}),this.actions.SceneTransition.forEach(e=>{e.dispatch()}),this.actions.SetVariable.forEach(e=>e.checkConditions()),this.actions.SetVariable.forEach(e=>e.dispatch()),this.actions.DynamicVariablePlay.forEach(e=>e.dispatch()),this.actions.ClearLocalStorage.forEach(e=>e.dispatch()),this.actions.UserAPI.forEach(e=>e.dispatch()))}};sa(),B5e.then(e=>Mr=e);var is=new D,ou=new Zt,Kf=new D,b0e=(new pn(0,0,0,"YXZ"),new pn(0,0,0,"XYZ")),Qu=new D,aj=new D,sj=new D(1,1,1),lb=new Zt,fN=new ke,x0e=new ke,z5e={type:"updateMatrix"},w0e=new Zt,oj=new Ws,lj=.01,n$={type:"beginEvent",eventName:"Collision"},V5e={type:"beginEvent",eventName:"Trigger"},o4=e=>e.states.some(t=>t.data.position!==void 0||t.data.rotation!==void 0||t.data.hiddenMatrix!==void 0||t.data.cloner!==void 0||t.data.pathSnapping!==void 0);function hb(e){return function(t){return typeof t=="object"&&t!==null&&"booleanOp"in t}(ny(e)?e.object:e)}var k5e=class{constructor(e){this.eventContext=e,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=t=>{if(t.bodyType()!==Mr.RigidBodyType.Dynamic)return;t.isSleeping()||this.nActiveRigidBodies++;let[i,r,n]=this.rigidBodyToMesh.get(t.handle);if(is.copy(t.translation()).multiplyScalar(this.pixelsPerMeter),ou.copy(t.rotation()),i.matrixWorld.compose(is,ou,r),i.hasNonUniformScale&&i.matrixWorld.multiply(i.shearScale),i.dispatchEvent(z5e),n){let a=i.cloner;if(a&&a.objectForSample===void 0){a.matrixWorld.copy(i.matrixWorld);for(let s of a.children)s.updateMatrixWorld(!0)}for(let s of i.children)s.updateMatrixWorld(!0)}},this.accumulator=0,this.handleCollisionEvents=(t,i,r)=>{if(r===!1)return;let n,a;if(this.sensorToTriggerEvent[t]?(n=this.sensorToTriggerEvent[t],a=this.sharedGameControlGlobals.colliderToEntity.get(i)):this.sensorToTriggerEvent[i]&&(n=this.sensorToTriggerEvent[i],a=this.sharedGameControlGlobals.colliderToEntity.get(t)),n&&a&&n.isValidTriggeringObject(a))n.dispatch();else{for(let s=this.sharedGameControlGlobals.createdObjects.length-1;s>=0;s--){let o=this.sharedGameControlGlobals.createdObjects[s];if(o.userData.hasCollisionDestroy&&(o.rigidBody?.collider(0).handle===t||o.rigidBody?.collider(0).handle===i)){this.sharedGameControlGlobals.createdObjects.splice(s,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(t)){let s=this.sharedGameControlGlobals.colliderToEntity.get(i),o=this.sharedGameControlGlobals.entityToCollisionEvents[s.uuid];if(o===void 0)return;for(let l of o)l.data.target==="character"&&this.dispatchCollisionEvent(l,s,i)}else if(this.gameControl?.object!==void 0&&this.gameControl.object===this.sharedGameControlGlobals.colliderToEntity.get(i)){let s=this.sharedGameControlGlobals.colliderToEntity.get(t),o=this.sharedGameControlGlobals.entityToCollisionEvents[s.uuid];if(o===void 0)return;for(let l of o)l.data.target==="character"&&this.dispatchCollisionEvent(l,s,t)}else{let s=this.sharedGameControlGlobals.colliderToEntity.get(t),o=this.sharedGameControlGlobals.entityToCollisionEvents[s.uuid];if(o!==void 0)for(let u of o)u.data.target==="scene"&&this.dispatchCollisionEvent(u,s,t);let l=this.sharedGameControlGlobals.colliderToEntity.get(i),h=this.sharedGameControlGlobals.entityToCollisionEvents[l?.uuid];if(h!==void 0)for(let u of h)u.data.target==="scene"&&this.dispatchCollisionEvent(u,l,i)}}},this.isExport=e.isExport,this.sharedAssets=e.sharedAssets,this.renderer=e.renderer,this.requestRender=e.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(e=>{let t=e.dataPatched;for(let i of t.events){if(i.data.disabled===!0)continue;let r=i.data.actions?.find(n=>n.data.type==="Destroy")?.data;if(r)for(let n of r.objects){let a=this.page.scene.find(n);a&&(a.userData.hasDestroy=!0)}}})}markIsDragObject(){this.page.traverseVisibleEntity(e=>{let t=e.dataPatched;for(let i of t.events)if(i.data.disabled!==!0&&i.data.type==="DragDrop")for(let r of i.data.objects){let n=this.page.scene.find(r);n&&(n.userData.hasDrag=!0)}})}_staticBVHIdOf(e){let t=this._staticBVHAttrIds.get(e);return t===void 0&&(t=this._staticBVHNextAttrId++,this._staticBVHAttrIds.set(e,t)),t}initBVH(){if(rj()===null)return void Ms("collision-bvh","trigger/collision detection");let e=[],t=[];if(this.page.traverseChildren(i=>{let r,n=i instanceof Dx,a=yE(i);if(rx(i)||n||a)return;r=ny(i)?i.object:i;let s=r.dataPatched;if(s.physics?.enabled==="visibility"?!s.visible:!s.physics?.enabled)return!0;let o=i.geometry,l=r.userData.hasDestroy===!0,h=r.userData.hasDrag===!0;if(o4(s)||l||h||r.dataPatched.events.some(u=>u.data.disabled!==!0&&(u.data.type==="GameControl"||u.data.type==="Follow")))return i.updateMatrixWorldRigid(),this.addBoundsTree(i),!0;if(o){let u=o.getAttribute("position");if(u!==void 0&&u.count>0){e.push({geometry:o,matrixWorld:i.matrixWorld}),t.push(o.id,this._staticBVHIdOf(u),u.version,o.index!==null?this._staticBVHIdOf(o.index):-1,o.index!==null?o.index.version:-1);for(let d of i.matrixWorld.elements)t.push(d)}}return!!hb(i)||void 0}),e.length>0){let i=this._staticBVHCache;if(i!==void 0&&i.signature.length===t.length&&i.signature.every((a,s)=>a===t[s]))return void(this.sharedGameControlGlobals.staticMeshBVH=i.bvh);let r=ry(e.map(a=>am(a.geometry,a.matrixWorld)),!1),n=new(rj())(r);this._staticBVHCache={signature:t,bvh:n},this.sharedGameControlGlobals.staticMeshBVH=n}}addRigidBody(e,t,i){if(iAe(e.matrixWorld))return;let r=[],n="geometry"in e?e.geometry:void 0,a=t.dataPatched;if(n?.getAttribute("position")!==void 0&&r.push(am(n,e.shearScale)),a.physics.fusedBody){let s=this.gatherChildrenGeom(e,r);e.traverseObject(s),e.children.forEach(l=>l.updateMatrixWorld(!0));let o=e.cloner;o&&o.objectForSample===void 0&&a.physics.rigidBody==="dynamic"&&(o.traverseObject(s),o.children.forEach(l=>l.updateMatrixWorld(!0)))}if(r.length>0){let s,o=!1,l=!i.fromCreate&&a.physics.rigidBody==="dynamic"||i.fromCreate&&i.dynamic;l?(s=Mr.RigidBodyDesc.dynamic(),s.setLinearDamping(a.physics.damping).setAngularDamping(a.physics.damping).setAdditionalMass(1e-9).setGravityScale(a.physics.gravityScale).enabledRotations(...a.physics.enabledRotation).enabledTranslations(...a.physics.enabledTranslation)):(i.hasTransformAnim||i.hasFollow||i.hasDrag)&&!i.fromCreate?(s=Mr.RigidBodyDesc.kinematicPositionBased(),o=!0):s=Mr.RigidBodyDesc.fixed();let h=ry(r);(e.hasNonUniformScale?e.matrixWorldRigid:e.matrixWorld).decompose(is,ou,Kf),e.position0=is.clone().divideScalar(this.pixelsPerMeter),e.rotation0=ou.clone(),is.divideScalar(this.pixelsPerMeter),s.setTranslation(is.x,is.y,is.z).setRotation(ou),n?h?.scale(1/this.pixelsPerMeter,1/this.pixelsPerMeter,1/this.pixelsPerMeter):h?.scale(Kf.x/this.pixelsPerMeter,Kf.y/this.pixelsPerMeter,Kf.z/this.pixelsPerMeter);let u=this.sharedGameControlGlobals.rapierWorld.createRigidBody(s),d=!(a.geometry===void 0||a.geometry.type==="SubdivGeometry"||a.geometry.type==="NonParametricGeometry"||a.geometry.type==="BooleanGeometry"||a.geometry.type==="VectorGeometry"||a.geometry.type==="StarGeometry"||a.geometry.type==="RectangleGeometry"||a.geometry.type==="EllipseGeometry"||a.geometry.type==="TriangleGeometry"||a.geometry.type==="TorusGeometry"||a.geometry.type==="HelixGeometry");try{this.addCollider(u,a.physics,h,t,d)}catch{try{this.addCollider(u,a.physics,h,t,!1)}catch(c){console.error(c)}}if(u.numColliders()===0)return void this.sharedGameControlGlobals.rapierWorld.removeRigidBody(u);l?this.rigidBodyToMesh.set(u.handle,[e,Kf.clone(),a.physics.fusedBody]):o?(this.sharedGameControlGlobals.kinematicBodyToEntity.set(u.handle,e),this.sharedGameControlGlobals.entitiesWithTransformAnim.push(e)):this.fixedBodiesToWatch.push([e,u,(e.hasNonUniformScale?e.matrixWorldRigid:e.matrixWorld).clone()]),e.rigidBody=u}}addBoundsTree(e){let t=[];if(e.geometry?.getAttribute("position")!==void 0&&e.geometry?.getAttribute("position").count>0&&t.push(am(e.geometry,e.shearScale)),e.traverseObject(this.gatherChildrenGeom(e,t)),e.children.forEach(i=>i.updateMatrixWorld(!0)),t.length>0){let i=ry(t,!1);e.bvhGeometry=i,i.getAttribute("position").count>0&&(e.bvhGeometry.boundsTree=new(rj())(i),this.sharedGameControlGlobals.entitiesWithTransformAnim.push(e))}}addCollider(e,t,i,r,n=!0){if(i?.getAttribute("position").count===0||i?.getIndex()?.count===0)return;let a;i&&(a=t.colliderType==="trimesh"?Mr.ColliderDesc.trimesh(i.getAttribute("position").array,i.getIndex().array):Mr.ColliderDesc.convexMesh(i.getAttribute("position").array,n?i.getIndex().array:void 0)),a.setFrictionCombineRule(Mr.CoefficientCombineRule.Average).setRestitutionCombineRule(Mr.CoefficientCombineRule.Average).setDensity(t.density).setFriction(t.friction).setRestitution(t.restitution);let s=this.sharedGameControlGlobals.rapierWorld.createCollider(a,e);this.sharedGameControlGlobals.colliderToEntity.set(s.handle,r),this.sharedGameControlGlobals.entityToCollisionEvents[r.uuid]?.some(o=>o.target==="scene")&&s.setActiveEvents(Mr.ActiveEvents.COLLISION_EVENTS)}gatherChildrenGeom(e,t){let i=hb(e);return(r,n)=>{if(n===0)return;if(i&&r.parent===e)return!0;let a;if(rx(r)){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;a=r.object}else if(ny(r))a=r.object;else if(a=r,a.dataPatched.cloner?.hideBase)return!0;let s=a.dataPatched;if(s.physics.enabled==="visibility"?!s.visible:!s.physics.enabled)return!0;n===1?e.hasNonUniformScale?r.matrixWorld.multiplyMatrices(e.shearScale,r.hiddenMatrix):r.matrixWorld.copy(r.hiddenMatrix):r.matrixWorld.multiplyMatrices(r.parent.matrixWorld,r.hiddenMatrix),r.matrixWorld.multiply(r.matrix);let o=r.geometry;return o?.getAttribute("position")!==void 0&&t.push(am(o,r.matrixWorld)),!!hb(r)||void 0}}activate(e){if(this.isEnabled)return;this.isEnabled=!0,this.eventManager=e,this.usePhysics=this.page.data.globalPhysics.usePhysics;let t=this.page.playCamera,i=!1;this.page.traverseEntity(s=>{for(let o of s.dataPatched.events)if(o.data.disabled===!1&&o.data.type==="Trigger")return this.needsCollisionDetection=!0,!0});let r=f0e();if(r!==null?i=r.setup({manager:this,camera:t,renderer:this.renderer,sharedAssets:this.sharedAssets,eventContext:this.eventContext,isExport:this.isExport})||i:this.page.data.publish.gameControlObject!==null&&Ms("game-controls","the scene's game controls"),i===!1){let{enableRotate:s,enablePan:o,enableZoom:l,autoRotate:h,hoverRotatePanMode:u}=this.eventManager.publish.orbitControls;(s||o||l||h||u!==0)&&(this.orbitControls=new IEe(t,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 n=this.renderer.domElement.width/this.renderer.getPixelRatio(),a=this.renderer.domElement.height/this.renderer.getPixelRatio();f0e()?.createJoysticks(this,n,a),this.markIsDestroyTarget(),this.markIsDragObject(),this.rebuildBVH(),this.initializationCounter++,window.setTimeout(()=>{this.collisionEvents.forEach(s=>s.initialDisabled=!1)},80)}initPhysics(){this.sharedGameControlGlobals.rapierWorld?.free(),this.sharedGameControlGlobals.rapierWorld=new Mr.World(new Mr.Vector3(0,this.gravity,0)),this.events=new Mr.EventQueue(!0);let e=[],t=[];if(this.page.traverseChildren(s=>{let o;if(rx(s)){if(!s.objectForSample)return s.object.dataPatched.physics.fusedBody===!0&&s.object.dataPatched.physics.rigidBody==="dynamic"||void 0;if(s.objectForSample.dataPatched.physics.fusedBody)return;o=s.object}else if(ny(s))o=s.object;else{if(yE(s)||t1(s)||s instanceof Dx)return;if(o=s,o.dataPatched.cloner?.disabled===!1&&o.dataPatched.cloner?.hideBase&&o.dataPatched.physics?.fusedBody!==!0)return!0}let l,h=o.dataPatched;for(let g of h.events)g.data.disabled!==!0&&g.data.type==="GameControl"&&(l=g.data);if(!h.physics||(h.physics.enabled==="visibility"?!h.visible:!h.physics.enabled))return!0;s.updateMatrixWorldRigid();let u=o4(h),d=!1,c=o.userData.hasDestroy,p=o.userData.hasDrag,m=!1;for(let g of h.events)if(g.data.disabled!==!0){if(g.data.type==="Collision"){d=!0;let v=new F5e(g.id,g.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!==g.id)?this.sharedGameControlGlobals.entityToCollisionEvents[o.uuid].push(v):this.sharedGameControlGlobals.entityToCollisionEvents[o.uuid]=[v]}else if(g.data.type==="Follow"){m=!0;let v=g.data.target;s.traverseVisible(y=>{y.userData.isFollowingObj=v})}}h.physics.rigidBody==="dynamic"&&h.physics.fusedBody===!1&&(s.matrixWorldFusedFalse=s.matrixWorld.clone());let f=s.geometry;if(l!==void 0){let g=Mr.RigidBodyDesc.kinematicPositionBased();(s.hasNonUniformScale?s.matrixWorldRigid:s.matrixWorld).decompose(is,ou,Kf),s.position0=is.clone().divideScalar(this.pixelsPerMeter),s.rotation0=ou.clone(),is.divideScalar(this.pixelsPerMeter),g.setTranslation(is.x,is.y,is.z).setRotation(ou);let v,y=this.sharedGameControlGlobals.rapierWorld.createRigidBody(g);s.rigidBody=y,v=l.collider.type==="sphere"?Mr.ColliderDesc.ball(l.collider.radius/this.pixelsPerMeter):l.collider.type==="capsule"?Mr.ColliderDesc.capsule((l.collider.height/2-l.collider.radius)/this.pixelsPerMeter,l.collider.radius/this.pixelsPerMeter):Mr.ColliderDesc.cuboid(l.collider.width/this.pixelsPerMeter/2,l.collider.height/this.pixelsPerMeter/2,l.collider.depth/this.pixelsPerMeter/2),v.setFrictionCombineRule(Mr.CoefficientCombineRule.Average).setDensity(h.physics.density).setFriction(h.physics.friction).setRestitution(0).setRestitutionCombineRule(Mr.CoefficientCombineRule.Min);let _=this.sharedGameControlGlobals.rapierWorld.createCollider(v,y);this.sharedGameControlGlobals.colliderToEntity.set(_.handle,o),is.fromArray(l.collider.position.map(x=>typeof x=="number"?x:0)).multiply(Kf.setFromMatrixScale(o.matrixWorld)).divideScalar(this.pixelsPerMeter),_.setTranslationWrtParent(is);let b=new Zt().setFromEuler(new pn().setFromVector3(new D().fromArray(l.collider.rotation.map(x=>typeof x=="number"?x:0))));_.setRotationWrtParent(b),_.setActiveEvents(Mr.ActiveEvents.COLLISION_EVENTS),this.generateSensorColliderDescs(o,!0)}else h.physics.rigidBody==="dynamic"||u||m||c||p||d?(this.addRigidBody(s,o,{hasFollow:m,hasTransformAnim:u,hasDrag:p}),this.generateSensorColliderDescs(o,h.physics.fusedBody)):(f&&e.push(am(f,s.matrixWorld)),h.physics.fusedBody&&!hb(s)&&s.traverseObject((g,v)=>{if(v===0)return;let y;if(rx(g)){if(!g.objectForSample)return g.object.dataPatched.physics.fusedBody===!0&&g.object.dataPatched.physics.rigidBody==="dynamic"||void 0;if(g.objectForSample.dataPatched.physics.fusedBody)return;y=g.object}else{if(yE(g)||t1(g)||g instanceof Dx)return;if(ny(g))y=g.object;else if(y=g,y.dataPatched.cloner?.hideBase)return!0}let _=y.dataPatched;if(_.physics.enabled==="visibility"?!_.visible:!_.physics.enabled)return!0;let b=g.geometry;return b?.getAttribute("position")!==void 0&&e.push(am(b,g.matrixWorld)),!!hb(g)||void 0}),this.generateSensorColliderDescs(o,h.physics.fusedBody,t));return!(h.physics?.fusedBody!==!0&&!l&&!hb(s))||void 0}),e.length===0)return;let i=ry(e),r=i.getIndex().count>0;if(!r&&t.length===0)return;i.scale(1/this.pixelsPerMeter,1/this.pixelsPerMeter,1/this.pixelsPerMeter);let n=Mr.RigidBodyDesc.fixed(),a=this.sharedGameControlGlobals.rapierWorld.createRigidBody(n);if(r){let s=Mr.ColliderDesc.trimesh(i.getAttribute("position").array,i.getIndex().array).setFrictionCombineRule(Mr.CoefficientCombineRule.Multiply).setRestitutionCombineRule(Mr.CoefficientCombineRule.Multiply).setFriction(1).setRestitution(1);this.sharedGameControlGlobals.rapierWorld.createCollider(s,a)}for(let[s,o]of t){let l=this.sharedGameControlGlobals.rapierWorld.createCollider(s,a);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(e=>{for(let t of e.dataPatched.events)if(t.data.type==="Trigger"&&t.data.disabled!==!0){let i=new _0e(t.id,t.data,e,this.page,this.sharedAssets,this.eventManager),r=new ke().compose(Qu.fromArray(t.data.position.map(n=>typeof n=="number"?n:0)),lb.setFromEuler(b0e.fromArray(t.data.rotation.map(n=>typeof n=="number"?n:0))),sj);if(t.data.triggerZone==="box"){let n=new fn;n.min.fromArray(t.data.size.map(a=>typeof a=="number"?a:0)).multiplyScalar(-.5),n.max.fromArray(t.data.size.map(a=>typeof a=="number"?a:0)).multiplyScalar(.5),this.sharedGameControlGlobals.triggers.push([n,r,e,i])}else this.sharedGameControlGlobals.triggers.push([t.data.radius,r,e,i])}}),this.needsCollisionDetection&&this.initBVH())}disconnectEvents(){this.collisionEvents.forEach(e=>e.disconnect()),this.sharedGameControlGlobals.triggers.forEach(e=>e[3].disconnect()),this.sharedGameControlGlobals.triggers.length=0}deactivate(){if(this.isEnabled){this.isEnabled=!1,this.page.traverse(e=>{let t=e;t.matrixWorldFusedFalse&&(t.matrixWorldFusedFalse=void 0),t.rigidBody&&(t.rigidBody=void 0),t.position0&&(t.position0=void 0),t.rotation0&&(t.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(([e,t])=>{e?.destroy(),t.remove()}),this.joystickToGameControls=[],this.joysticks=[],this.orbitControls&&(this.orbitControls.dispose(),this.orbitControls=void 0),this.navigationMeshWrapper?.dispose(),this.navigationMeshWrapper=void 0;for(let e of Object.values(this.sharedGameControlGlobals.entityToCollisionEvents))e.forEach(t=>t.disconnect());this.sharedGameControlGlobals.entityToCollisionEvents={},this.page.updateMatrixWorld(!0)}}update(e){if(!this.isEnabled)return!0;let t=!0;if(this.orbitControls!==void 0&&this.orbitControls.needsUpdate&&(this.orbitControls.update(),t=!this.orbitControls.isCurrentlyDamping),this.initializationCounter>=0&&this.initializationCounter<2?(this.initializationCounter++,t=!1):this.initializationCounter===2&&this.gameControl&&(t=!this.gameControl.update(e)&&t),this.usePhysics===!1&&this.checkTrigger(),this.usePhysics){let i=.016666666666666666;if(e===0)t=this.stepPhysics()&&t;else{let r=e/1e3;r<i&&r>.55*i&&(r=i),this.accumulator+=r;let n=performance.now(),a=0,s=6;for(;this.accumulator>=i&&a<s&&(t=this.stepPhysics()&&t,this.accumulator-=i,a++,!(performance.now()-n>1e3*i)););this.accumulator=this.accumulator%i}}this.skipRender=t}recordPhysicsPose(e){(e.hasNonUniformScale?e.matrixWorldRigid:e.matrixWorld).decompose(is,ou,Kf);let t=e;t.prevQ===void 0?(t.prevQ=ou.clone(),t.prevT=is.clone()):(t.prevQ.copy(ou),t.prevT.copy(is))}promoteMovedFixedBodies(){for(let e=this.fixedBodiesToWatch.length-1;e>=0;e--){let[t,i,r]=this.fixedBodiesToWatch[e];(t.hasNonUniformScale?t.matrixWorldRigid:t.matrixWorld).equals(r)||(i.setBodyType(Mr.RigidBodyType.KinematicPositionBased,!0),this.sharedGameControlGlobals.kinematicBodyToEntity.set(i.handle,t),this.sharedGameControlGlobals.entitiesWithTransformAnim.push(t),this.fixedBodiesToWatch.splice(e,1))}}clampPushedBodies(){let e=this.gameControl?.object.rigidBody;if(e===void 0)return;let t=this.sharedGameControlGlobals.rapierWorld,i=e.linvel(),r=e.translation(),n=Math.hypot(i.x,i.z);for(let a=0;a<e.numColliders();a++){let s=e.collider(a);t.contactPairsWith(s,o=>{let l=o.parent();if(l===null||!l.isDynamic())return;let h=l.translation(),u=-1/0,d=0,c=0;if(t.contactPair(s,o,v=>{let y=v.normal(),_=y.x*(h.x-r.x)+y.y*(h.y-r.y)+y.z*(h.z-r.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>u&&(u=S,d=b/w,c=x/w)}),u===-1/0)return;let p=i.x*d+i.z*c;if(p<-lj)return;let m=l.linvel();if(n>lj&&p>lj){let v=m.x*d+m.z*c;if(v<=0)return;let y=Math.min(v,p);return void l.setLinvel({x:d*y,y:m.y,z:c*y},!0)}let f=m.x*d+m.z*c-Math.max(0,p);if(f<=0)return;let g=.5*f;l.setLinvel({x:m.x-d*g,y:m.y,z:m.z-c*g},!0)})}}stepPhysics(){this.promoteMovedFixedBodies();for(let e of this.sharedGameControlGlobals.kinematicBodyToEntity.values())this.recordPhysicsPose(e),e.rigidBody.setNextKinematicTranslation(is.divideScalar(this.pixelsPerMeter)),e.rigidBody.setNextKinematicRotation(ou);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(e,t,i){let r,n=(this.sharedGameControlGlobals.rapierWorld?.getCollider(i))._parent;if(t.cloner){for(let a of t.cloner.children)if(a.rigidBody===n){r=a;break}}e.dispatch(r),t.dispatchEvent(n$)}updateUseWindowEvents(e){this.orbitControls?.updateUseWindowEvents(e)}generateSensorColliderDescs(e,t,i){let r=x0e.copy(e.matrixWorld).invert();e.traverseEntity((n,a)=>{if(t===!1&&a===1)return!0;for(let s of n.dataPatched.events)if(s.data.type==="Trigger"&&s.data.disabled!==!0){let o,l=new _0e(s.id,s.data,n,this.page,this.sharedAssets,this.eventManager);if(o=s.data.triggerZone==="box"?Mr.ColliderDesc.cuboid(...s.data.size.map(h=>(typeof h=="number"?h:1)/(2*this.pixelsPerMeter))):Mr.ColliderDesc.ball(s.data.radius/this.pixelsPerMeter),o.setDensity(0).setSensor(!0).setActiveEvents(Mr.ActiveEvents.COLLISION_EVENTS),Qu.fromArray(s.data.position.map(h=>typeof h=="number"?h:0)),lb.setFromEuler(b0e.fromArray(s.data.rotation.map(h=>typeof h=="number"?h:0))),fN.compose(Qu,lb,sj).premultiply(n.matrixWorld),i?(fN.decompose(Qu,lb,aj),o.setActiveCollisionTypes(Mr.ActiveCollisionTypes.KINEMATIC_FIXED|Mr.ActiveCollisionTypes.DYNAMIC_FIXED)):(fN.premultiply(r).decompose(Qu,lb,aj),e.rigidBody.bodyType()===Mr.RigidBodyType.Dynamic||(e.rigidBody.bodyType()===Mr.RigidBodyType.Fixed?o.setActiveCollisionTypes(Mr.ActiveCollisionTypes.KINEMATIC_FIXED|Mr.ActiveCollisionTypes.DYNAMIC_FIXED):o.setActiveCollisionTypes(Mr.ActiveCollisionTypes.KINEMATIC_KINEMATIC|Mr.ActiveCollisionTypes.DYNAMIC_KINEMATIC))),Qu.divideScalar(this.pixelsPerMeter),o.setTranslation(Qu.x,Qu.y,Qu.z),o.setRotation(lb),i)i.push([o,l]);else{let h=this.sharedGameControlGlobals.rapierWorld.createCollider(o,e.rigidBody);this.sensorToTriggerEvent[h.handle]=l}}})}checkTrigger(){let e;for(let t=0;t<this.sharedGameControlGlobals.triggers.length;t++){let[i,r,n,a]=this.sharedGameControlGlobals.triggers[t];for(let s=0;s<this.sharedGameControlGlobals.entitiesWithTransformAnim.length;s++){let o=this.sharedGameControlGlobals.entitiesWithTransformAnim[s];if(n===o||a.isValidTriggeringObject(hr.is(o)?o:o.object)===!1)continue;let l=x0e.copy(n.matrixWorld).decompose(Qu,w0e,aj).compose(Qu,w0e,sj).multiply(r),h=fN.copy(o.matrixWorld).invert().multiply(l),u=o.bvhGeometry.boundsTree;i instanceof fn?e=u.intersectsBox(i,h):(oj.radius=i,oj.center.setFromMatrixPosition(h),e=u.intersectsSphere(oj)),e?a.currentIntersectedObjects.indexOf(o)===-1&&(a.currentIntersectedObjects.push(o),a.dispatch(),n.dispatchEvent(V5e)):a.currentIntersectedObjects=a.currentIntersectedObjects.filter(d=>d!==o)}}}};Ew(),le(),uL(),Nr(),Ym();var hj=.02,S0e=new D,T0e=new D,G5e=new D,jo=new D,Vp=new D,ub=new D,uj=new ke,M0e=new ke,j5e=new ke,vh=new Zt,Ev=new Zt,db=new pn(0,0,0,"YXZ"),H5e=new D(1,0,0),fc=new D(0,1,0),W5e=new D(0,0,1),E0e=new D(1,1,1),A0e=[],C0e=e=>A0e[e]??(A0e[e]=new D),dj=new D,q5e=new D,$5e=new D,X5e=new D,P0e=new Zt,Y5e=new D,R0e=new Zt,zs=new Ch,lu=new fn,K5e={type:"requestRender"},Z5e={type:"updateMatrix"},a$=class extends xa{constructor(e,t,i,r,n,a,s,o,l){super(),this.object=e,this.domElement=t,this.data=i,this.gloabalPhysics=r,this.controlsManager=n,this.cameraFollow=a,this.camera=s,this.page=o,this.sharedAssets=l,this.enableDamping=!0,this.hiddenMatrix0=new ke,this.target0=new D,this.zoom0=1,this.rotForce=1,this.moveForce=1,this.pixelsPerMeter=200,this.euler0=new pn(0,0,0,"YXZ"),this.position0Cam=new D,this.quat0Cam=new Zt,this.scale0Cam=new D,this.hiddenMatrix0Cam=new ke,this.threshEndTranslate=.01,this.threshEndRotate=1e-8,this.threshEndRotVel=.005,this.collider={type:"capsule",radius:40,segment:new Ch(new D(0,-40,0),new D(0,40,0)),matrix:new ke,position:new D,rotation:new Zt},this.euler=new pn(0,0,0,"YXZ"),this.eulerDelta=new D,this.lastPosition=new D,this.lastCameraQuaternion=new Zt,this.lastCameraPosition=new D,this.PI_2=Math.PI/2,this.prevMouse=new J,this.velocityTarget=new D,this.velocity=new D,this.directionXZ=new D,this.rotVelocityStick=new D,this.rotVelocityTarget=new D,this.rotVelocity=new D,this.rotDirection=new D,this.nonColliderRotOffset=new ke,this.nonColliderPosOffset=new ke,this.firstPointerId=-1,this.rot=new D,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 ke,this.objectToTarget=new D,this.objectToTarget0=new D,this.objectToCamXZ=new D,this.objectToCamXZ0=new D,this.targetToCamera=new D,this.targetToCamera0=new D,this.cameraPolarAxis0=new D,this.targetPos=new D,this.targetQuat=new Zt,this.lerpFactorPos=new D().setScalar(.3),this.lerpFactorPosStart=.3,this.lerpFactorPosEnd=.3,this.lerpFactorRotStart=.3,this.lerpFactorRotEnd=.3,this.lerpFactorPosCamera=.3,this.lerpFactorRotCamera=.3,this.objXZQuat=new Zt,this.objXZQuatInv=new Zt,this.objXZRotMat=new ke,this.isFirstPerson=!1,this.didHit=!1,this.groundVelocity=new D,this.pushedVelocity=new D,this.groundYRotation=0,this.objectRealQuat=new Zt,this.colliderWorldQuat=new Zt,this.groundNormal=new D,this.groundTilt=new Zt,this.groundTiltInv=new Zt,this.lastHitObj=null,this.isFirstFrame=!0,this.rotationAccumWhenOrientWithCamera=0,this.navMeshPathDest=null,this.position=new D,this.quaternion=new Zt,this.scale=new D,this.initialAction=!0,this.onPointerDown=m=>{!(m.target===this.domElement||m.target instanceof HTMLElement&&m.target.tagName==="SPLINE-VIEWER"&&m.target.shadowRoot?.contains(this.domElement))||this.firstPointerId!==-1||(this.firstPointerId=m.pointerId,this.domElement.ownerDocument.addEventListener("pointermove",this.onPointerMove),this.domElement.ownerDocument.addEventListener("pointerup",this.onPointerUp),this.rotBy!=="keys"&&!Zl&&!w7&&this.domElement.requestPointerLock(),this.prevMouse.set(m.clientX,m.clientY))},this.onPointerUp=m=>{this.firstPointerId=-1,this.domElement.ownerDocument.removeEventListener("pointermove",this.onPointerMove),this.domElement.ownerDocument.removeEventListener("pointerup",this.onPointerUp),m.pointerType==="mouse"&&this.domElement.ownerDocument.exitPointerLock()},this.onPointerMove=m=>{if(m.pointerId!==this.firstPointerId)return;let f=m.clientX-this.prevMouse.x,g=m.clientY-this.prevMouse.y;this.prevMouse.set(m.clientX,m.clientY),m.pointerType==="mouse"&&this.rotBy!=="keys"&&(w7&&m1e<15.5&&!Zl?(this.eulerDelta.y=-f*this.mouseOrbitSensitivity,this.eulerDelta.x=-g*this.mouseOrbitSensitivity):(this.eulerDelta.y=-m.movementX*this.mouseOrbitSensitivity,this.eulerDelta.x=-m.movementY*this.mouseOrbitSensitivity)),m.pointerType!=="mouse"&&this.rotByTouch==="drag"&&(this.eulerDelta.y=-f*this.mouseOrbitSensitivity*5,this.eulerDelta.x=-g*this.mouseOrbitSensitivity*5),this.controlsManager.requestRender()},this.onPointerlockChange=m=>{this.domElement.ownerDocument.pointerLockElement===this.domElement?a$.isLocked=!0:a$.isLocked=!1},this.onPointerlockError=()=>{console.error("SPE.GameControls: Unable to use Pointer Lock API")},this.handleVisibilityChange=()=>{if(document?.hidden)for(let m in this.movementState)this.movementState[m]=0},this.onKeyDown=m=>{!(m.target instanceof HTMLInputElement)&&(m.code==="ArrowLeft"||m.code==="ArrowUp"||m.code==="ArrowRight"||m.code==="ArrowDown"||m.code==="Space")&&m.preventDefault();for(let f of this.keyAssignments)if(m.key.toUpperCase()===f[1]||m.key===f[1]){this.movementState[f[0]]=1;break}this.controlsManager.requestRender()},this.onKeyUp=m=>{for(let f of this.keyAssignments)if(m.key.toUpperCase()===f[1]||m.key===f[1]||m.code.slice(3,m.code.length).toUpperCase()===f[1]){this.movementState[f[0]]=0;break}},this.copyVRGamePadValues=(m,f)=>{for(let g=2;g<4;g++){let v=m.axes[g];f===0?g===2?this.movementState.movePosX=v:this.movementState.movePosZ=v:(m.buttons[3].pressed?this.movementState.jump=1:this.movementState.jump=0,g===2?this.movementState.rotPosY=v:this.moveMode==="fly"&&(this.movementState.moveNegY=v))}},this.sharedGameControlGlobals=n.sharedGameControlGlobals,e===s&&(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 h=this.euler0.clone(),u=h.y;if(this.objectRealQuat.copy(this.quaternion),h.y=0,this.quaternion.setFromEuler(h),this.objXZQuat.copy(this.quaternion),this.objXZQuatInv.copy(this.objXZQuat).invert(),this.objXZRotMat.makeRotationFromQuaternion(this.quaternion),h.set(0,u,0),this.quaternion.setFromEuler(h),this.rot.setFromEuler(h),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 m,f=new D(0,0,-1).applyQuaternion(this.camera.quaternion),g=new D().subVectors(this.position,this.camera.position);this.objectToCamXZ.copy(g),this.objectToCamXZ.y=0,this.objectToCamXZ0.copy(this.objectToCamXZ),Math.abs(f.y)<1e-6?(g.y=0,f.y=0,m=g.projectOnVector(f)):m=g.y/f.y>0?f.multiplyScalar(g.y/f.y):f.multiplyScalar(g.length()),this.targetToCamera0.copy(m).negate();let v=this.camera.position.clone().add(m);this.objectToTarget0.subVectors(v,this.position);let y=new pn().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 na&&(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(m=>{let f=[m[0],m[1]];return f[1]==="\u25B2"?f[1]="ArrowUp":f[1]==="\u25C0"?f[1]="ArrowLeft":f[1]==="\u25BC"?f[1]="ArrowDown":f[1]==="\u25B6"?f[1]="ArrowRight":f[1]==="\u21E7"?f[1]="Shift":f[1]==="\u21B5"?f[1]="Enter":f[1]==="Space"?f[1]=" ":f[1]==="\u2318"?f[1]="Meta":f[1]==="Ctrl"?f[1]="Control":f[1]==="Esc"&&(f[1]="Escape"),f}),i.rotBy==="mouse"){let m;m=this.keyAssignments.findIndex(f=>f[0]==="rotNegX"),m!==-1&&(this.keyAssignments[m][1]=""),m=this.keyAssignments.findIndex(f=>f[0]==="rotPosX"),m!==-1&&(this.keyAssignments[m][1]=""),m=this.keyAssignments.findIndex(f=>f[0]==="rotPosY"),m!==-1&&(this.keyAssignments[m][1]=""),m=this.keyAssignments.findIndex(f=>f[0]==="rotNegY"),m!==-1&&(this.keyAssignments[m][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??Mx.defaultData.gravity),this.usePhysics=this.gloabalPhysics.usePhysics??Mx.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??iL.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*hj/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*hj/this.pixelsPerMeter,this.stepThresh=2*i.collider.radius*.3/this.pixelsPerMeter,this.colliderHeight=2*i.collider.radius):(this.offset=i.collider.height*hj/this.pixelsPerMeter,this.stepThresh=.3*i.collider.height/this.pixelsPerMeter,this.colliderHeight=i.collider.height),this.collider.type=i.collider.type;let d=new D().fromArray(i.collider.position.map(m=>typeof m=="number"?m:0)),c=new Zt().setFromEuler(new pn().fromArray([...i.collider.rotation.map(m=>typeof m=="number"?m:0),"XYZ"]));this.collider.position.copy(d).multiply(this.scale),this.collider.rotation.copy(c),this.collider.matrix.compose(d,c,E0e),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 m=new Nt;m.push({fi:0,data:{...ha.defaultData("light","phong"),alpha:0},id:"layer1"}),m.push({fi:0,data:{...ha.defaultData("color"),color:i.navmesh.destinationHelperColor,alpha:i.navmesh.destinationHelperColor.a},id:"layer2"});let f=Cbe({layers:m},{scene:this.page.scene,shared:this.sharedAssets});this.navMeshPathDest=new Cr(OX.create({parameters:{width:p,height:p/10,hollow:.7}}),f),this.navMeshPathDest.material.userData.opacity0=i.navmesh.destinationHelperColor.a}this.activate()}reset(e=!1){if(this.object.hiddenMatrix.copy(this.hiddenMatrix0),e){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 t=new pn().setFromQuaternion(this.quaternion,"YXZ"),i=t.y;this.objectRealQuat.copy(this.quaternion),t.y=0,this.quaternion.setFromEuler(t),this.objXZQuat.copy(this.quaternion),this.objXZQuatInv.copy(this.objXZQuat).invert(),this.objXZRotMat.makeRotationFromQuaternion(this.quaternion),t.set(0,i,0),this.quaternion.setFromEuler(t),this.rot.setFromEuler(t),this.euler.setFromQuaternion(this.quaternion,"YXZ"),this.velocityTarget.set(0,0,0),this.velocity.set(0,0,0)}else this.object instanceof na?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 e=this.data,t=this.sharedAssets;e.gameActions!==void 0&&(this.actions={},tL.list.forEach(i=>{this.actions[i]=us({...e,disabled:!1,type:"GameControl"},e.gameActions[i],this.page,t,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"),Ks(this.actions.idle),Ks(this.actions.move),Ks(this.actions.run),Ks(this.actions.jump)}dispatchStartEvent(e){this.actions[e]!==void 0&&(this.actionState[e]||(this.actionState[e]=!0,this.actions[e].Transition.forEach(t=>{t.play()}),this.actions[e].Animation.forEach(t=>{t.play(this.initialAction===!1)}),this.actions[e].TimelineAnimation.forEach(t=>{t.play()}),this.actions[e].Create.forEach(t=>{t.dispatchStart()}),this.actions[e].Audio.forEach(t=>{t.dispatchGameControl("start")}),this.actions[e].Particles.forEach(t=>{t.dispatchGameControl("start")})))}dispatchStopEvent(e){this.actions[e]!==void 0&&(!this.actionState[e]||(this.actionState[e]=!1,this.actions[e].Transition.forEach(t=>{t.stop(),t.object.currentState!==null&&t.object.changeSelectedState(null,{scene:this.page.scene,shared:this.sharedAssets})}),this.actions[e].TimelineAnimation.forEach(t=>{t.stop()}),this.actions[e].Create.forEach(t=>{t.dispatchStop()}),this.actions[e].Audio.forEach(t=>{t.dispatchGameControl("stop")}),this.actions[e].Particles.forEach(t=>{t.dispatchGameControl("stop")})))}get colliderWorldPosition(){return jo.copy(this.collider.position).applyQuaternion(this.objectRealQuat).add(this.position)}update(e){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 t=(this.isFirstFrame?16.6:e)/1e3;this.isFirstFrame&&(this.isFirstFrame=!1);let i=60*t,r=!1;if(this.groundYRotation=0,this.groundVelocity.set(0,0,0),this.usePhysics&&this.collisionEnabled&&this.object.rigidBody?.collider(0).shape){let a=Vp.set(0,(this.velocity.y===0?this.pixelsPerMeter*Math.max(Math.abs(this.gravity)/120,1)*(this.gravity>0?1:-1):this.velocity.y)*t,0).divideScalar(this.pixelsPerMeter),s=this.sharedGameControlGlobals.rapierWorld.castShape(this.colliderWorldPosition.divideScalar(this.pixelsPerMeter),this.colliderWorldQuat,a,this.object.rigidBody?.collider(0).shape,0,1,!1,8,void 0,void 0,this.object.rigidBody);if(s){this.onObject=!0,this.groundNormal.set(s.normal2.x,s.normal2.y,s.normal2.z).applyQuaternion(this.colliderWorldQuat).negate(),this.alignToGround&&this.groundTiltAdjustment(this.groundNormal),Math.acos(this.groundNormal.y)<this.slopeThresh&&(r=!0),s.collider.parent()?.bodyType()===0&&Math.acos(this.groundNormal.y)*(180/Math.PI)>45&&(this.onObject=!1);let o=s.collider.parent(),l=o!==null&&o.isKinematic()?o:null,h=l===null?void 0:this.sharedGameControlGlobals.kinematicBodyToEntity.get(l.handle);if(l!==null&&h?.userData.isFollowingObj!==this.object.uuid){let u=this.object.getWorldPosition(jo).add(this.collider.position).divideScalar(this.pixelsPerMeter),d=l.velocityAtPoint(u);this.groundVelocity.set(d.x,d.y,d.z).multiplyScalar(this.pixelsPerMeter),this.groundYRotation=l.angvel().y*t}}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 a=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 s=jo.subVectors(this.path[1],this.position),o=Vp.subVectors(this.path[1],this.path[0]);s.dot(o)<0?this.path.shift():(this.directionXZ.x=o.x,this.directionXZ.z=o.z),a.opacity=a.userData.opacity0}else a.opacity-=.05*a.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 n=G5e.copy(this.velocity);if(this.orientMode!=="none"&&this.isFirstPerson===!1){let a=Vp.copy(n);a.y=0,n.set(0,n.y,a.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 a=jo;this.camera.getWorldDirection(a);let s=ub.copy(fc).multiplyScalar(a.dot(fc));a.sub(s);let o=Vp.copy(this.directionXZ);o.x*=-1,this.rot.y=a.angleTo(o)*(a.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(db.setFromVector3(this.rot),this.moveMode==="walk"&&(db.x=0),n.applyEuler(db),r&&(Ev.setFromUnitVectors(fc,this.groundNormal),n.applyQuaternion(Ev)),this.usePhysics===!0&&this.object.rigidBody){this.pushedVelocity.set(0,0,0);let a=0;for(let s of this.sharedGameControlGlobals.entitiesWithTransformAnim){if(s.rigidBody===void 0||s.prevQ===void 0)continue;(s.hasNonUniformScale?s.matrixWorldRigid:s.matrixWorld).decompose(dj,P0e,q5e);let o=this.object.getWorldPosition($5e).add(this.collider.position).sub(dj);R0e.copy(s.prevQ).invert().premultiply(P0e);let l=ub.subVectors(dj,s.prevT).add(X5e.copy(o).applyQuaternion(R0e).sub(o)).divideScalar(t).divideScalar(this.pixelsPerMeter),h=s.rigidBody.collider(0).castCollider(l,this.object.rigidBody.collider(0),jo.copy(n).divideScalar(this.pixelsPerMeter),0,t,!1);l.multiplyScalar(this.pixelsPerMeter);let u=hr.is(s)?s:s.object;if(h!==null&&this.lastHitObj!==u){let d;s instanceof Dh&&(d=s);let c=this.sharedGameControlGlobals.entityToCollisionEvents[u.uuid];if(c)for(let p of c)p.data.target==="character"&&(p.dispatch(d),u.dispatchEvent(n$));this.lastHitObj=u}h!==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),C0e(a++).copy(h.normal1).applyQuaternion(s.quaternion))}if(a>0){for(let s=0;s<a;s++){let o=C0e(s),l=o.dot(n);l<0&&n.addScaledVector(o,-l)}n.add(this.pushedVelocity)}else n.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(t),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*t,this.euler.y+=this.rotVelocity.y*t+this.groundYRotation,this.rotVelocityTarget.y===0&&this.directionXZ.manhattanLength()===0?this.rotationAccumWhenOrientWithCamera=0:(this.cameraFollow===!1||this.cameraYAxis==="Locked")&&(this.rotationAccumWhenOrientWithCamera+=this.rotVelocity.y*t),this.isFirstPerson===!1&&this.orientMode!=="none"&&this.directionXZ.manhattanLength()>0){if(this.orientMode==="radial"){this.objectToCamXZ.copy(this.objectToCamXZ0).applyAxisAngle(fc,this.euler.y-this.euler0.y);let a=Vp.copy(this.objectToCamXZ).normalize(),s=ub.copy(n).multiplyScalar(t);s.y=0;let o=s.sub(jo.copy(a).multiplyScalar(s.dot(a))).cross(a).y;this.euler.y-=Math.atan2(o,this.objectToCamXZ.length())}}else this.rot.y+=this.rotVelocity.y*t+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=ht.clamp(this.euler.x,-this.maxPolarAngle+this.cameraPolarOffset+1e-6,-this.minPolarAngle+this.cameraPolarOffset-1e-6):this.euler.x=ht.clamp(this.euler.x,-this.PI_2+this.cameraPolarOffset,this.PI_2+this.cameraPolarOffset):this.cameraXAxis==="Limit"&&(this.euler.x=ht.clamp(this.euler.x,-this.PI_2,this.PI_2))),this.moveMode==="fly"?this.rot.x=this.euler.x:this.isFirstPerson&&(db.copy(this.euler),db.y=0,this.nonColliderRotOffset.makeRotationFromEuler(db)),vh.setFromAxisAngle(H5e,this.rot.x),Ev.setFromAxisAngle(fc,this.rot.y),Ev.multiply(vh),vh.setFromAxisAngle(W5e,this.rot.z),Ev.multiply(vh),this.quaternion.copy(Ev),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 a=Vp.copy(n).multiplyScalar(t/this.pixelsPerMeter),s=null;this.didHit=!1;let o=new D;for(let u=0;u<5;u++){let d=a.length(),c=ub.copy(a).normalize();if(s=this.sharedGameControlGlobals.rapierWorld.castShape(this.colliderWorldPosition.divideScalar(this.pixelsPerMeter).add(o),this.colliderWorldQuat,c,this.object.rigidBody.collider(0).shape,0,d,!1,12,void 0,void 0,this.object.rigidBody),s===null){u===0&&this.directionXZ.manhattanLength()!==0&&(this.lastHitObj=null),o.add(a);break}{this.didHit=!0;let p=this.sharedGameControlGlobals.colliderToEntity.get(s.collider.handle);if(p!==this.lastHitObj&&u===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(s.collider.handle))._parent;if(p.cloner){for(let x of p.cloner.children)if(x.rigidBody===b){_=x;break}}y.dispatch(_),p.dispatchEvent(n$)}}}let m=S0e.set(s.normal2.x,s.normal2.y,s.normal2.z).applyQuaternion(this.colliderWorldQuat),f=T0e.copy(c).multiplyScalar(s.time_of_impact).dot(m),g=s.time_of_impact;if(g===0&&(this.position.y+=this.offset*this.pixelsPerMeter),f>this.offset&&(g=s.time_of_impact*(f-this.offset)/f,o.addScaledVector(c,g)),a.copy(c).multiplyScalar(d-g),Math.acos(-m.y)>this.slopeThresh){let v=this.colliderWorldPosition.divideScalar(this.pixelsPerMeter).add(o),y=ub.copy(s.witness2).applyQuaternion(this.colliderWorldQuat);y.y=0;let _=v.add(y);_.y+=this.stepThresh;let b=this.sharedGameControlGlobals.rapierWorld.castShape(_,this.colliderWorldQuat,a,this.object.rigidBody?.collider(0).shape,0,1,!1,12,void 0,void 0,this.object.rigidBody);b!==null&&b.time_of_impact===0&&(m.y=0,m.normalize())}a.addScaledVector(m,-a.dot(m))}}this.position.addScaledVector(o,this.pixelsPerMeter),jo.copy(this.position).divideScalar(this.pixelsPerMeter),vh.copy(this.quaternion).premultiply(this.groundTilt).multiply(this.objXZQuat);let l=this.object.rigidBody,h=l!==void 0&&Y5e.copy(jo).sub(l.translation()).lengthSq()>1;l!==void 0&&(h?(l.setTranslation(jo,!0),l.setRotation(vh,!0)):(l.setNextKinematicTranslation(jo),l.setNextKinematicRotation(vh)))}else{let a=this.onObject?1:5,s=n.multiplyScalar(t/a);for(let o=0;o<a;o++)this.position.add(s),this.collisionAdjustment(t/a)}else this.position.addScaledVector(n,t);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 a=this.objectToTarget.add(this.position),s=this.targetToCamera.add(a);uj.lookAt(s,a,fc).setPosition(s),uj.decompose(this.targetPos,this.targetQuat,jo),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=ht.clamp(this.euler.y,this.minAzimuthAngleRel,this.maxAzimuthAngleRel)),this.euler.x=ht.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(Z5e),!(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(K5e),0))}updateFollowArms(){this.objectToTarget.copy(this.objectToTarget0),this.targetToCamera.copy(this.targetToCamera0);let e,t=vh.setFromAxisAngle(fc,this.cameraYAxis==="Limit"&&this.orientMode!=="radial"?ht.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(t),e=this.cameraXAxis==="Limit"?ht.clamp(this.euler.x,-this.maxPolarAngle+this.cameraPolarOffset+1e-6,-this.minPolarAngle+this.cameraPolarOffset-1e-6):ht.clamp(this.euler.x,-this.PI_2+this.cameraPolarOffset+1e-6,this.PI_2+this.cameraPolarOffset-1e-6);let i=jo.copy(this.cameraPolarAxis0);(this.cameraYAxis!=="Locked"||this.orientMode==="radial")&&i.applyQuaternion(t);let r=Ev.setFromAxisAngle(i,e);this.cameraYAxis!=="Locked"&&this.targetToCamera.applyQuaternion(t),this.cameraXAxis!=="Locked"&&this.targetToCamera.applyQuaternion(r)}groundTiltAdjustment(e){180*fc.angleTo(e)/Math.PI<15||180*fc.angleTo(e)/Math.PI>85?vh.identity():vh.setFromUnitVectors(fc,e),this.groundTilt.slerp(vh,.06),this.groundTiltInv.copy(this.groundTilt).invert()}collisionAdjustment(e){let t=T0e.set(0,0,0);this.object.matrix.compose(this.position,this.quaternion,this.scale);let i=uj.multiplyMatrices(this.object.matrix,this.objXZRotMat).multiply(this.collider.matrix).decompose(jo,vh,Vp).compose(jo,vh,E0e);this.sharedGameControlGlobals.entitiesWithTransformAnim.forEach(n=>{if(n===this.object||n.isDescendantOf(this.object)||!n.bvhGeometry||!n.bvhGeometry.boundsTree)return;lu.makeEmpty(),n.updateMatrixWorldRigid();let a=n.matrixWorldRigid,s=M0e.copy(a).invert(),o=j5e.copy(M0e).multiply(i);zs.copy(this.collider.segment),zs.start.applyMatrix4(o),zs.end.applyMatrix4(o);let l=S0e.copy(this.position).applyMatrix4(s);lu.expandByPoint(zs.start),lu.expandByPoint(zs.end),lu.min.addScalar(-this.collider.radius),lu.max.addScalar(this.collider.radius),n.bvhGeometry.boundsTree.shapecast({boundsTraverseOrder:h=>h.distanceToPoint(zs.end),intersectsBounds:h=>h.intersectsBox(lu),intersectsTriangle:h=>{let u=jo,d=Vp,c=h.closestPointToSegment(zs,u,d);if(c<this.collider.radius){let p=this.collider.radius-c,m=d.sub(u).normalize(),f=ub.copy(l);f.addScaledVector(m,p);let g=f.applyMatrix4(a).sub(this.position);t.add(g),zs.start.addScaledVector(m,p),zs.end.addScaledVector(m,p)}}})}),lu.makeEmpty(),zs.copy(this.collider.segment),zs.start.applyMatrix4(i),zs.end.applyMatrix4(i),lu.expandByPoint(zs.start),lu.expandByPoint(zs.end),lu.min.addScalar(-this.collider.radius),lu.max.addScalar(this.collider.radius),this.sharedGameControlGlobals.staticMeshBVH?.shapecast({boundsTraverseOrder:n=>n.distanceToPoint(zs.end),intersectsBounds:n=>n.intersectsBox(lu),intersectsTriangle:n=>{let a=jo,s=Vp,o=n.closestPointToSegment(zs,a,s);if(o<this.collider.radius){let l=this.collider.radius-o,h=s.sub(a).normalize();this.alignToGround&&this.groundTiltAdjustment(h),t.addScaledVector(h,l),zs.start.addScaledVector(h,l),zs.end.addScaledVector(h,l)}}}),this.onObject=Math.abs(t.y)>Math.abs(e*this.velocity.y*.25),this.onObject&&this.dispatchStopEvent("jump");let r=Math.max(0,t.length()-1e-5);t.normalize().multiplyScalar(r),this.position.add(t)}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()}},rAe=a$;rAe.isLocked=!1,le(),CA(),W4(),Ew(),Tw();var nAe,aAe,cj,Q5e=new Promise(e=>{nAe=e});function J5e(e){return cj||(cj=async function(){let t=e??"https://cdn.spline.design/@splinetool/runtime@2.0.11/build";typeof window<"u"&&(aAe=new URL(t.endsWith("/")?t:`${t}/`,window.location.href).href);let i=import("./navmesh.js"),[r,n]=await Promise.all([i,fetch(`${t}/navmesh.wasm`).then(o=>o.arrayBuffer())]),a=r.default,s=await a({wasmBinary:n});nAe(s)}(),cj)}kr();var sAe,fr,mo,eze=e=>`
|
|
12895
|
+
`)>=0&&(e-=n),i===3?.5*t-.5*e:i===2?t-e:0}getLineInitialOffsetY(e,t,i,r,n){let a=t*e,s=e-Math.abs(this.ascender-this.descender)*r,o=-this.ascender*r-s/2;return n===3?-(i-a-o):n===2?-(.5*i-.5*a-o):o}createPath(e,t,i,r,n){let a=e.getPath(i,-r,n.fontSize,{kerning:!1,letterSpacing:n.letterSpacing});if(!a)return void console.error('THREE.Font: character "'+e+'" does not exists in font family '+this.familyName+".");let s=new A5e,o=(e.advanceWidth??1)*t;if(e)for(let l of a.commands){let h=s.currentPath?.currentPoint;if(!h||l.type==="Z"||h.x!==l.x||-h.y!==l.y)switch(l.type){case"M":s.moveTo(l.x,-l.y);break;case"L":s.lineTo(l.x,-l.y);break;case"Q":s.quadraticCurveTo(l.x1,-l.y1,l.x,-l.y);break;case"C":s.bezierCurveTo(l.x1,-l.y1,l.x2,-l.y2,l.x,-l.y)}}return s.subPaths.forEach(l=>{let h=function(u){if(u.length){let d=u[0];if(d instanceof Th)return d.v1;if(d instanceof fu||d instanceof lm)return d.v0}}(l.curves);h!==void 0&&l.currentPoint.distanceTo(h)>0&&l.lineTo(h.x,h.y)}),{offsetX:o,path:s}}getCharWidth(e,t){try{return this.font?.getAdvanceWidth(e,t.fontSize,{kerning:!0,letterSpacing:t.letterSpacing})??0}catch(i){return this.warnLayoutError(i),0}}getTextWidth(e,t){try{return this.font?.getAdvanceWidth(e,t.fontSize,{kerning:!0,letterSpacing:t.letterSpacing})??0}catch(i){return this.warnLayoutError(i),0}}computeSpaceWidthForLine(e,t,i,r){let n=this.getCharWidth(" ",i),a=e[t];if(a){let s=this.countSpaces(a.trimEnd());if(i.horizontalAlign===4&&t<e.length-1&&s)return((typeof i.width=="string"?Number(r.getVariable(i.width)):i.width)-(this.getTextWidth(a,i)-s*n))/s}return n}countSpaces(e){return(e.match(/ /g)||[]).length}},In("text"),$t();var XEe=null;function f0e(){return XEe}function R5e(e){let t=!1;return e.scene.objects.forEach(i=>{i.data.type==="Page"&&!t&&i.data.publish.gameControlObject&&tw.traverseModuleInstances(e,i.id,(r,n,a)=>{for(let s of a)s.data.type==="GameControl"&&s.data.navmesh.enabled&&(t=!0)})}),t}kr();var pN=(e,t)=>{let i=t.x-e.x,r=t.y-e.y;return Math.sqrt(i*i+r*r)},J9=e=>e*(Math.PI/180),mN=new Map,a4=(e,t,i)=>{let r,n=t.split(/[ ,]+/g);for(let a=0;a<n.length;a+=1)r=n[a],e.addEventListener?e.addEventListener(r,i,!1):e.attachEvent&&e.attachEvent(r,i)},s4=(e,t,i)=>{let r,n=t.split(/[ ,]+/g);for(let a=0;a<n.length;a+=1)r=n[a],e.removeEventListener?e.removeEventListener(r,i):e.detachEvent&&e.detachEvent(r,i)},YEe=e=>(e.preventDefault(),e.type.match(/^touch/)?e.changedTouches:e),g0e=()=>{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}},ej=(e,t)=>{t.top||t.right||t.bottom||t.left?(e.style.top=t.top,e.style.right=t.right,e.style.bottom=t.bottom,e.style.left=t.left):(e.style.left=t.x+"px",e.style.top=t.y+"px")},tj=(e,t,i)=>{let r=KEe(e);for(let n in r)if(Object.prototype.hasOwnProperty.call(r,n))if(typeof t=="string")r[n]=t+" "+i;else{let a="";for(let s=0,o=t.length;s<o;s+=1)a+=t[s]+" "+i+", ";r[n]=a.slice(0,-2)}return r},KEe=e=>{let t={};return t[e]="",["webkit","Moz","o"].forEach(function(i){t[i+e.charAt(0).toUpperCase()+e.slice(1)]=""}),t},ij=(e,t)=>{for(let i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},r$=(e,t)=>{if(e.length)for(let i=0,r=e.length;i<r;i+=1)t(e[i]);else t(e)};typeof window<"u"&&(ZEe="ontouchstart"in window,QEe=!!window.PointerEvent,JEe=!!window.MSPointerEvent);var ZEe,QEe,JEe,ob,v0e={start:"mousedown",move:"mousemove",end:"mouseup"},W2={};function kv(){}QEe?ob={start:"pointerdown",move:"pointermove",end:"pointerup, pointercancel"}:JEe?ob={start:"MSPointerDown",move:"MSPointerMove",end:"MSPointerUp"}:ZEe?(ob={start:"touchstart",move:"touchmove",end:"touchend, touchcancel"},W2=v0e):ob=v0e,kv.prototype.on=function(e,t){var i,r=this,n=e.split(/[ ,]+/g);r._handlers_=r._handlers_||{};for(var a=0;a<n.length;a+=1)i=n[a],r._handlers_[i]=r._handlers_[i]||[],r._handlers_[i].push(t);return r},kv.prototype.off=function(e,t){var i=this;return i._handlers_=i._handlers_||{},e===void 0?i._handlers_={}:t===void 0?i._handlers_[e]=null:i._handlers_[e]&&i._handlers_[e].indexOf(t)>=0&&i._handlers_[e].splice(i._handlers_[e].indexOf(t),1),i},kv.prototype.trigger=function(e,t){var i,r=this,n=e.split(/[ ,]+/g);r._handlers_=r._handlers_||{};for(var a=0;a<n.length;a+=1)i=n[a],r._handlers_[i]&&r._handlers_[i].length&&r._handlers_[i].forEach(function(s){s.call(r,{type:i,target:r},t)})},kv.prototype.config=function(e){var t=this;t.options=t.defaults||{},e&&(t.options=((i,r)=>{let n={};for(let a in i)Object.prototype.hasOwnProperty.call(i,a)&&Object.prototype.hasOwnProperty.call(r,a)?n[a]=r[a]:Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a]);return n})(t.options,e))},kv.prototype.bindEvt=function(e,t){var i=this;return i._domHandlers_=i._domHandlers_||{},i._domHandlers_[t]=function(){typeof i["on"+t]=="function"?i["on"+t].apply(i,arguments):console.warn('[WARNING] : Missing "on'+t+'" handler.')},a4(e,ob[t],i._domHandlers_[t]),W2[t]&&a4(e,W2[t],i._domHandlers_[t]),i},kv.prototype.unbindEvt=function(e,t){var i=this;return i._domHandlers_=i._domHandlers_||{},s4(e,ob[t],i._domHandlers_[t]),W2[t]&&s4(e,W2[t],i._domHandlers_[t]),delete i._domHandlers_[t],this};var hK=kv;function xs(e,t){return this.identifier=t.identifier,this.position=t.position,this.frontPosition=t.frontPosition,this.collection=e,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(t),this.options.mode==="dynamic"&&(this.options.restOpacity=0),this.id=xs.id,xs.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}xs.prototype=new hK,xs.constructor=xs,xs.id=0,xs.prototype.buildEl=function(e){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},xs.prototype.stylize=function(){if(this.options.dataOnly)return this;var e=this.options.fadeTime+"ms",t=(()=>{let n=KEe("borderRadius");for(let a in n)Object.prototype.hasOwnProperty.call(n,a)&&(n[a]="50%");return n})(),i=tj("transition","opacity",e),r={};return r.el={position:"absolute",opacity:this.options.restOpacity,display:"block",zIndex:999},r.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)"},r.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)"},ij(r.el,i),this.options.shape==="circle"&&ij(r.back,t),ij(r.front,t),this.applyStyles(r),this},xs.prototype.applyStyles=function(e){for(var t in this.ui)if(Object.prototype.hasOwnProperty.call(this.ui,t))for(var i in e[t])this.ui[t].style[i]=e[t][i];return this},xs.prototype.addToDom=function(){return this.options.dataOnly||document.body.contains(this.ui.el)||this.options.zone.appendChild(this.ui.el),this},xs.prototype.removeFromDom=function(){return this.options.dataOnly||!document.body.contains(this.ui.el)||this.options.zone.removeChild(this.ui.el),this},xs.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},xs.prototype.show=function(e){var t=this;return t.options.dataOnly||(clearTimeout(t.removeTimeout),clearTimeout(t.showTimeout),clearTimeout(t.restTimeout),t.addToDom(),t.restCallback(),setTimeout(function(){t.ui.el.style.opacity=1},0),t.showTimeout=setTimeout(function(){t.trigger("shown",t.instance),typeof e=="function"&&e.call(this)},t.options.fadeTime)),t},xs.prototype.hide=function(e){var t=this;if(t.options.dataOnly)return t;if(t.ui.el.style.opacity=t.options.restOpacity,clearTimeout(t.removeTimeout),clearTimeout(t.showTimeout),clearTimeout(t.restTimeout),t.removeTimeout=setTimeout(function(){var i=t.options.mode==="dynamic"?"none":"block";t.ui.el.style.display=i,typeof e=="function"&&e.call(t),t.trigger("hidden",t.instance)},t.options.fadeTime),t.options.restJoystick){let i=t.options.restJoystick,r={};r.x=i===!0||i.x!==!1?0:t.instance.frontPosition.x,r.y=i===!0||i.y!==!1?0:t.instance.frontPosition.y,t.setPosition(e,r)}return t},xs.prototype.setPosition=function(e,t){var i=this;i.frontPosition={x:t.x,y:t.y};var r=i.options.fadeTime+"ms",n={};n.front=tj("transition",["top","left"],r);var a={front:{}};a.front={left:i.frontPosition.x+"px",top:i.frontPosition.y+"px"},i.applyStyles(n),i.applyStyles(a),i.restTimeout=setTimeout(function(){typeof e=="function"&&e.call(i),i.restCallback()},i.options.fadeTime)},xs.prototype.restCallback=function(){var e=this,t={};t.front=tj("transition","none",""),e.applyStyles(t),e.trigger("rested",e.instance)},xs.prototype.resetDirection=function(){this.direction={x:!1,y:!1,angle:!1}},xs.prototype.computeDirection=function(e){var t,i,r,n=e.angle.radian,a=Math.PI/4,s=Math.PI/2;if(n>a&&n<3*a&&!e.lockX?t="up":n>-a&&n<=a&&!e.lockY?t="left":n>3*-a&&n<=-a&&!e.lockX?t="down":e.lockY||(t="right"),e.lockY||(i=n>-s&&n<s?"left":"right"),e.lockX||(r=n>0?"up":"down"),e.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 h={};for(o in this.direction={x:i,y:r,angle:t},e.direction=this.direction,l)l[o]===this.direction[o]&&(h[o]=!0);if(h.x&&h.y&&h.angle)return e;(!h.x||!h.y)&&this.trigger("plain",e),h.x||this.trigger("plain:"+i,e),h.y||this.trigger("plain:"+r,e),h.angle||this.trigger("dir dir:"+t,e)}else this.resetDirection();return e};var D5e=xs;function qa(e,t){var i=this;i.nipples=[],i.idles=[],i.actives=[],i.ids=[],i.pressureIntervals={},i.manager=e,i.id=qa.id,qa.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(t),(i.options.mode==="static"||i.options.mode==="semi")&&(i.options.multitouch=!1),i.options.multitouch||(i.options.maxNumberOfNipples=1);let r=getComputedStyle(i.options.zone.parentElement);return r&&r.display==="flex"&&(i.parentIsFlex=!0),i.updateBox(),i.prepareNipples(),i.bindings(),i.begin(),i.nipples}qa.prototype=new hK,qa.constructor=qa,qa.id=0,qa.prototype.prepareNipples=function(){var e=this,t=e.nipples;t.on=e.on.bind(e),t.off=e.off.bind(e),t.options=e.options,t.destroy=e.destroy.bind(e),t.ids=e.ids,t.id=e.id,t.processOnMove=e.processOnMove.bind(e),t.processOnEnd=e.processOnEnd.bind(e),t.get=function(i){if(i===void 0)return t[0];for(var r=0,n=t.length;r<n;r+=1)if(t[r].identifier===i)return t[r];return!1}},qa.prototype.bindings=function(){var e=this;e.bindEvt(e.options.zone,"start"),e.options.zone.style.touchAction="none",e.options.zone.style.msTouchAction="none"},qa.prototype.begin=function(){var e=this,t=e.options;if(t.mode==="static"){var i=e.createNipple(t.position,e.manager.getIdentifier());i.add(),e.idles.push(i)}},qa.prototype.createNipple=function(e,t){var i=this,r=i.manager.scroll,n={},a=i.options,s=i.parentIsFlex?r.x:r.x+i.box.left,o=i.parentIsFlex?r.y:r.y+i.box.top;if(e.x&&e.y)n={x:e.x-s,y:e.y-o};else if(e.top||e.right||e.bottom||e.left){var l=document.createElement("DIV");l.style.display="hidden",l.style.top=e.top,l.style.right=e.right,l.style.bottom=e.bottom,l.style.left=e.left,l.style.position="absolute",a.zone.appendChild(l);var h=l.getBoundingClientRect();a.zone.removeChild(l),n=e,e={x:h.left+r.x,y:h.top+r.y}}var u=new D5e(i,{color:a.color,size:a.size,threshold:a.threshold,fadeTime:a.fadeTime,dataOnly:a.dataOnly,restJoystick:a.restJoystick,restOpacity:a.restOpacity,mode:a.mode,identifier:t,position:e,zone:a.zone,frontPosition:{x:0,y:0},shape:a.shape});return a.dataOnly||(ej(u.ui.el,n),ej(u.ui.front,u.frontPosition)),i.nipples.push(u),i.trigger("added "+u.identifier+":added",u),i.manager.trigger("added "+u.identifier+":added",u),i.bindNipple(u),u},qa.prototype.updateBox=function(){this.box=this.options.zone.getBoundingClientRect()},qa.prototype.bindNipple=function(e){var t,i=this,r=function(n,a){t=n.type+" "+a.id+":"+n.type,i.trigger(t,a)};e.on("destroyed",i.onDestroyed.bind(i)),e.on("shown hidden rested dir plain",r),e.on("dir:up dir:right dir:down dir:left",r),e.on("plain:up plain:right plain:down plain:left",r)},qa.prototype.pressureFn=function(e,t,i){var r=this,n=0;clearInterval(r.pressureIntervals[i]),r.pressureIntervals[i]=setInterval(function(){var a=e.force||e.pressure||e.webkitForce||0;a!==n&&(t.trigger("pressure",a),r.trigger("pressure "+t.identifier+":pressure",a),n=a)}.bind(r),100)},qa.prototype.onstart=function(e){var t=this,i=t.options,r=e;return e=YEe(e),t.updateBox(),r$(e,function(n){t.actives.length<i.maxNumberOfNipples?t.processOnStart(n):r.type.match(/^touch/)&&(Object.keys(t.manager.ids).forEach(function(a){if(Object.values(r.touches).findIndex(function(o){return o.identifier===a})<0){var s=[e[0]];s.identifier=a,t.processOnEnd(s)}}),t.actives.length<i.maxNumberOfNipples&&t.processOnStart(n))}),t.manager.bindDocument(),!1},qa.prototype.processOnStart=function(e){var t,i=this,r=i.options,n=i.manager.getIdentifier(e),a=e.force||e.pressure||e.webkitForce||0,s={x:e.pageX,y:e.pageY},o=i.getOrCreate(n,s);o.identifier!==n&&i.manager.removeIdentifier(o.identifier),o.identifier=n;var l=function(h){h.trigger("start",h),i.trigger("start "+h.id+":start",h),h.show(),a>0&&i.pressureFn(e,h,h.identifier),i.processOnMove(e)};if((t=i.idles.indexOf(o))>=0&&i.idles.splice(t,1),i.actives.push(o),i.ids.push(o.identifier),r.mode!=="semi")l(o);else{if(!(pN(s,o.position)<=r.catchDistance))return o.destroy(),void i.processOnStart(e);l(o)}return o},qa.prototype.getOrCreate=function(e,t){var i,r=this,n=r.options;return/(semi|static)/.test(n.mode)?(i=r.idles[0])?(r.idles.splice(0,1),i):n.mode==="semi"?r.createNipple(t,e):(console.warn("Coudln't find the needed nipple."),!1):i=r.createNipple(t,e)},qa.prototype.processOnMove=function(e){var t=this,i=t.options,r=t.manager.getIdentifier(e),n=t.nipples.get(r),a=t.manager.scroll;if((_=>isNaN(_.buttons)?_.pressure!==0:_.buttons!==0)(e)){if(!n)return console.error("Found zombie joystick with ID "+r),void t.manager.removeIdentifier(r);if(i.dynamicPage){var s=n.el.getBoundingClientRect();n.position={x:a.x+s.left,y:a.y+s.top}}n.identifier=r;var o=n.options.size/2,l={x:e.pageX,y:e.pageY};i.lockX&&(l.y=n.position.y),i.lockY&&(l.x=n.position.x);var h,u,d=pN(l,n.position),c=((_,b)=>{let x=b.x-_.x,w=b.y-_.y;return(S=>S*(180/Math.PI))(Math.atan2(w,x))})(l,n.position),p=J9(c),m=d/o,f={distance:d,position:l};if(n.options.shape==="circle"?(h=Math.min(d,o),u=((_,b,x)=>{let w={x:0,y:0};return x=J9(x),w.x=_.x-b*Math.cos(x),w.y=_.y-b*Math.sin(x),w})(n.position,h,c)):(u=((_,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,n.position,o),h=pN(u,n.position)),i.follow){if(d>o){let _=l.x-u.x,b=l.y-u.y;n.position.x+=_,n.position.y+=b,n.el.style.top=n.position.y-(t.box.top+a.y)+"px",n.el.style.left=n.position.x-(t.box.left+a.x)+"px",d=pN(l,n.position)}}else l=u,d=h;var g=l.x-n.position.x,v=l.y-n.position.y;n.frontPosition={x:g,y:v},i.dataOnly||ej(n.ui.front,n.frontPosition);var y={identifier:n.identifier,position:l,force:m,pressure:e.force||e.pressure||e.webkitForce||0,distance:d,angle:{radian:p,degree:c},vector:{x:g/o,y:-v/o},raw:f,instance:n,lockX:i.lockX,lockY:i.lockY};(y=n.computeDirection(y)).angle={radian:J9(180-c),degree:180-c},n.trigger("move",y),t.trigger("move "+n.id+":move",y)}else this.processOnEnd(e)},qa.prototype.processOnEnd=function(e){var t=this,i=t.options,r=t.manager.getIdentifier(e),n=t.nipples.get(r),a=t.manager.removeIdentifier(n.identifier);!n||(i.dataOnly||n.hide(function(){i.mode==="dynamic"&&(n.trigger("removed",n),t.trigger("removed "+n.id+":removed",n),t.manager.trigger("removed "+n.id+":removed",n),n.destroy())}),clearInterval(t.pressureIntervals[n.identifier]),n.resetDirection(),n.trigger("end",n),t.trigger("end "+n.id+":end",n),t.ids.indexOf(n.identifier)>=0&&t.ids.splice(t.ids.indexOf(n.identifier),1),t.actives.indexOf(n)>=0&&t.actives.splice(t.actives.indexOf(n),1),/(semi|static)/.test(i.mode)?t.idles.push(n):t.nipples.indexOf(n)>=0&&t.nipples.splice(t.nipples.indexOf(n),1),t.manager.unbindDocument(),/(semi|static)/.test(i.mode)&&(t.manager.ids[a.id]=a.identifier))},qa.prototype.onDestroyed=function(e,t){var i=this;i.nipples.indexOf(t)>=0&&i.nipples.splice(i.nipples.indexOf(t),1),i.actives.indexOf(t)>=0&&i.actives.splice(i.actives.indexOf(t),1),i.idles.indexOf(t)>=0&&i.idles.splice(i.idles.indexOf(t),1),i.ids.indexOf(t.identifier)>=0&&i.ids.splice(i.ids.indexOf(t.identifier),1),i.manager.removeIdentifier(t.identifier),i.manager.unbindDocument()},qa.prototype.destroy=function(){var e=this;for(var t in e.unbindEvt(e.options.zone,"start"),e.nipples.forEach(function(i){i.destroy()}),e.pressureIntervals)Object.prototype.hasOwnProperty.call(e.pressureIntervals,t)&&clearInterval(e.pressureIntervals[t]);e.trigger("destroyed",e.nipples),e.manager.unbindDocument(),e.off(),e.pressureIntervals={},e.nipples=[],e.idles=[],e.actives=[],e.ids=[],e.manager=null};var N5e=qa;function rs(e){var t=this;t.ids={},t.index=0,t.collections=[],t.scroll=g0e(),t._windowBound=!1,t.config(e),t.prepareCollections();var i=function(){var r;t.collections.forEach(function(n){n.forEach(function(a){r=a.el.getBoundingClientRect(),a.position={x:t.scroll.x+r.left,y:t.scroll.y+r.top}})})};return t._onResize=function(){(r=>{mN.has(r)&&clearTimeout(mN.get(r)),mN.set(r,setTimeout(function(){mN.delete(r),r()},100))})(i)},t._onScroll=function(){t.scroll=g0e()},t.collections}rs.prototype=new hK,rs.constructor=rs,rs.prototype.prepareCollections=function(){var e=this;e.collections.create=e.create.bind(e),e.collections.on=e.on.bind(e),e.collections.off=e.off.bind(e),e.collections.destroy=e.destroy.bind(e),e.collections.get=function(t){var i;return e.collections.every(function(r){return!(i=r.get(t))}),i}},rs.prototype.create=function(e){return this.createCollection(e)},rs.prototype.bindWindowEvents=function(){var e=this;e._windowBound||typeof window>"u"||(e._windowBound=!0,a4(window,"resize",e._onResize),a4(window,"scroll",e._onScroll))},rs.prototype.unbindWindowEvents=function(){var e=this;!e._windowBound||typeof window>"u"||(e._windowBound=!1,s4(window,"resize",e._onResize),s4(window,"scroll",e._onScroll))},rs.prototype.createCollection=function(e){var t=this,i=new N5e(t,e);return t.bindCollection(i),t.collections.push(i),t.bindWindowEvents(),i},rs.prototype.bindCollection=function(e){var t,i=this,r=function(n,a){t=n.type+" "+a.id+":"+n.type,i.trigger(t,a)};e.on("destroyed",i.onDestroyed.bind(i)),e.on("shown hidden rested dir plain",r),e.on("dir:up dir:right dir:down dir:left",r),e.on("plain:up plain:right plain:down plain:left",r)},rs.prototype.bindDocument=function(){var e=this;e.binded||(e.bindEvt(document,"move").bindEvt(document,"end"),e.binded=!0)},rs.prototype.unbindDocument=function(e){var t=this;(!Object.keys(t.ids).length||e===!0)&&(t.unbindEvt(document,"move").unbindEvt(document,"end"),t.binded=!1)},rs.prototype.getIdentifier=function(e){var t;return e?(t=e.identifier===void 0?e.pointerId:e.identifier)===void 0&&(t=this.latest||0):t=this.index,this.ids[t]===void 0&&(this.ids[t]=this.index,this.index+=1),this.latest=t,this.ids[t]},rs.prototype.removeIdentifier=function(e){var t={};for(var i in this.ids)if(this.ids[i]===e){t.id=i,t.identifier=this.ids[i],delete this.ids[i];break}return t},rs.prototype.onmove=function(e){return this.onAny("move",e),!1},rs.prototype.onend=function(e){return this.onAny("end",e),!1},rs.prototype.oncancel=function(e){return this.onAny("end",e),!1},rs.prototype.onAny=function(e,t){var i,r=this,n="processOn"+e.charAt(0).toUpperCase()+e.slice(1);t=YEe(t);var a=function(s,o,l){l.ids.indexOf(o)>=0&&(l[n](s),s._found_=!0)};return r$(t,function(s){i=r.getIdentifier(s),r$(r.collections,a.bind(null,s,i)),s._found_||r.removeIdentifier(i)}),!1},rs.prototype.destroy=function(){var e=this;e.unbindDocument(!0),e.unbindWindowEvents(),e.ids={},e.index=0,e.collections.forEach(function(t){t.destroy()}),e.collections=[],e.off()},rs.prototype.onDestroyed=function(e,t){var i=this;if(i.collections.indexOf(t)<0)return!1;i.collections.splice(i.collections.indexOf(t),1),i.collections.length===0&&i.unbindWindowEvents()};var I5e=rs,kx=null;function y0e(){return kx||(kx=new I5e),kx}var O5e={create:function(e){return y0e().create(e)},destroy:function(){kx&&(kx.destroy(),kx=null)},get factory(){return y0e()}},L5e=O5e;kr(),$t(),le(),Uh(),xl(),$t();var eAe=null;function rj(){return eAe}var tAe,nj,B5e=new Promise(e=>{tAe=e});function U5e(e){return nj||(nj=async function(){let t=e??"https://cdn.spline.design/@splinetool/runtime@2.0.13/build",i=import("./physics.js"),[r,n]=await Promise.all([i,fetch(`${t}/physics.wasm`).then(a=>a.arrayBuffer())]);await r.init(n),tAe(r)}(),nj)}function iAe(e){let t=e.elements,i=t[0]**2+t[1]**2+t[2]**2,r=t[4]**2+t[5]**2+t[6]**2,n=t[8]**2+t[9]**2+t[10]**2,a=t[0]**2+t[4]**2+t[8]**2,s=t[1]**2+t[5]**2+t[9]**2,o=t[2]**2+t[6]**2+t[10]**2,l=1e-8;return i<l||r<l||n<l||a<l||s<l||o<l}function am(e,t){let i=new At;if(t&&iAe(t))return i.setAttribute("position",new Et([],3)),i.setIndex([]),i;if(!e.getAttribute("position"))return i.setAttribute("position",new Et([],3)),i.setIndex([]),i;let{positions:r,triIndices:n}=VX(e.getAttribute("position"),e.getIndex());return i.setAttribute("position",new Et(r,3)),i.setIndex(n),t&&i.applyMatrix4(t),i}sa(),xl(),_r(),iY(),le(),le(),Tw(),CA();var Mr,F5e=class{constructor(e,t,i,r,n,a){this.id=e,this.data=t,this.object=i,this.initialDisabled=!1,this.actions=us(t,t.actions,r,n,a,i),this.target=t.target}disconnect(){Ks(this.actions)}dispatch(e){this.initialDisabled||(this.actions.Transition.forEach(t=>{t.object.currentTransitionEvent!==this&&(t.object.currentTransitionEvent=this,t.init())}),this.object.dispatchEvent({type:"beginEvent",eventName:"Collision"}),this.actions.Transition.forEach(t=>{t.data.runMode==="Toggle"?t.toggle():t.play()}),this.actions.Animation.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.Reset.forEach(t=>{t.dispatch()}),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(e??!1)}),this.actions.SetVariable.forEach(t=>t.checkConditions()),this.actions.SetVariable.forEach(t=>t.dispatch()),this.actions.DynamicVariablePlay.forEach(t=>t.dispatch()),this.actions.Audio.forEach(t=>{t.dispatchBasic()}),this.actions.Particles.forEach(t=>{t.dispatchBasic()}),this.actions.Video.forEach(t=>{t.dispatchBasic()}),this.actions.ClearLocalStorage.forEach(t=>t.dispatch()),this.actions.UserAPI.forEach(t=>t.dispatch()))}},_0e=class{constructor(e,t,i,r,n,a){this.id=e,this.data=t,this.object=i,this.page=r,this.currentIntersectedObjects=[],this.actions=us(t,t.actions,r,n,a,i),this.target=t.target,this.triggeringObjects=[];for(let s of t.triggeringObjects){let o=r.scene.find(s);o&&this.triggeringObjects.push(o)}}isValidTriggeringObject(e){return this.target==="all"||this.triggeringObjects.some(t=>t===e||t.isAncestorOf(e.uuid)||e.isAncestorOf(t.uuid))}disconnect(){Ks(this.actions)}dispatch(){this.object.destroyedInAction||(this.actions.Transition.forEach(e=>{e.object.currentTransitionEvent!==this&&(e.object.currentTransitionEvent=this,e.init())}),this.object.dispatchEvent({type:"beginEvent",eventName:"Trigger"}),this.actions.Transition.forEach(e=>{e.data.runMode==="Toggle"?e.toggle():e.play()}),this.actions.SwitchCamera.forEach(e=>{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.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(!1)}),this.actions.Audio.forEach(e=>{e.dispatchBasic()}),this.actions.Particles.forEach(e=>{e.dispatchBasic()}),this.actions.Video.forEach(e=>{e.dispatchBasic()}),this.actions.SceneTransition.forEach(e=>{e.dispatch()}),this.actions.SetVariable.forEach(e=>e.checkConditions()),this.actions.SetVariable.forEach(e=>e.dispatch()),this.actions.DynamicVariablePlay.forEach(e=>e.dispatch()),this.actions.ClearLocalStorage.forEach(e=>e.dispatch()),this.actions.UserAPI.forEach(e=>e.dispatch()))}};sa(),B5e.then(e=>Mr=e);var is=new D,ou=new Zt,Kf=new D,b0e=(new pn(0,0,0,"YXZ"),new pn(0,0,0,"XYZ")),Qu=new D,aj=new D,sj=new D(1,1,1),lb=new Zt,fN=new ke,x0e=new ke,z5e={type:"updateMatrix"},w0e=new Zt,oj=new Ws,lj=.01,n$={type:"beginEvent",eventName:"Collision"},V5e={type:"beginEvent",eventName:"Trigger"},o4=e=>e.states.some(t=>t.data.position!==void 0||t.data.rotation!==void 0||t.data.hiddenMatrix!==void 0||t.data.cloner!==void 0||t.data.pathSnapping!==void 0);function hb(e){return function(t){return typeof t=="object"&&t!==null&&"booleanOp"in t}(ny(e)?e.object:e)}var k5e=class{constructor(e){this.eventContext=e,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=t=>{if(t.bodyType()!==Mr.RigidBodyType.Dynamic)return;t.isSleeping()||this.nActiveRigidBodies++;let[i,r,n]=this.rigidBodyToMesh.get(t.handle);if(is.copy(t.translation()).multiplyScalar(this.pixelsPerMeter),ou.copy(t.rotation()),i.matrixWorld.compose(is,ou,r),i.hasNonUniformScale&&i.matrixWorld.multiply(i.shearScale),i.dispatchEvent(z5e),n){let a=i.cloner;if(a&&a.objectForSample===void 0){a.matrixWorld.copy(i.matrixWorld);for(let s of a.children)s.updateMatrixWorld(!0)}for(let s of i.children)s.updateMatrixWorld(!0)}},this.accumulator=0,this.handleCollisionEvents=(t,i,r)=>{if(r===!1)return;let n,a;if(this.sensorToTriggerEvent[t]?(n=this.sensorToTriggerEvent[t],a=this.sharedGameControlGlobals.colliderToEntity.get(i)):this.sensorToTriggerEvent[i]&&(n=this.sensorToTriggerEvent[i],a=this.sharedGameControlGlobals.colliderToEntity.get(t)),n&&a&&n.isValidTriggeringObject(a))n.dispatch();else{for(let s=this.sharedGameControlGlobals.createdObjects.length-1;s>=0;s--){let o=this.sharedGameControlGlobals.createdObjects[s];if(o.userData.hasCollisionDestroy&&(o.rigidBody?.collider(0).handle===t||o.rigidBody?.collider(0).handle===i)){this.sharedGameControlGlobals.createdObjects.splice(s,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(t)){let s=this.sharedGameControlGlobals.colliderToEntity.get(i),o=this.sharedGameControlGlobals.entityToCollisionEvents[s.uuid];if(o===void 0)return;for(let l of o)l.data.target==="character"&&this.dispatchCollisionEvent(l,s,i)}else if(this.gameControl?.object!==void 0&&this.gameControl.object===this.sharedGameControlGlobals.colliderToEntity.get(i)){let s=this.sharedGameControlGlobals.colliderToEntity.get(t),o=this.sharedGameControlGlobals.entityToCollisionEvents[s.uuid];if(o===void 0)return;for(let l of o)l.data.target==="character"&&this.dispatchCollisionEvent(l,s,t)}else{let s=this.sharedGameControlGlobals.colliderToEntity.get(t),o=this.sharedGameControlGlobals.entityToCollisionEvents[s.uuid];if(o!==void 0)for(let u of o)u.data.target==="scene"&&this.dispatchCollisionEvent(u,s,t);let l=this.sharedGameControlGlobals.colliderToEntity.get(i),h=this.sharedGameControlGlobals.entityToCollisionEvents[l?.uuid];if(h!==void 0)for(let u of h)u.data.target==="scene"&&this.dispatchCollisionEvent(u,l,i)}}},this.isExport=e.isExport,this.sharedAssets=e.sharedAssets,this.renderer=e.renderer,this.requestRender=e.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(e=>{let t=e.dataPatched;for(let i of t.events){if(i.data.disabled===!0)continue;let r=i.data.actions?.find(n=>n.data.type==="Destroy")?.data;if(r)for(let n of r.objects){let a=this.page.scene.find(n);a&&(a.userData.hasDestroy=!0)}}})}markIsDragObject(){this.page.traverseVisibleEntity(e=>{let t=e.dataPatched;for(let i of t.events)if(i.data.disabled!==!0&&i.data.type==="DragDrop")for(let r of i.data.objects){let n=this.page.scene.find(r);n&&(n.userData.hasDrag=!0)}})}_staticBVHIdOf(e){let t=this._staticBVHAttrIds.get(e);return t===void 0&&(t=this._staticBVHNextAttrId++,this._staticBVHAttrIds.set(e,t)),t}initBVH(){if(rj()===null)return void Ms("collision-bvh","trigger/collision detection");let e=[],t=[];if(this.page.traverseChildren(i=>{let r,n=i instanceof Dx,a=yE(i);if(rx(i)||n||a)return;r=ny(i)?i.object:i;let s=r.dataPatched;if(s.physics?.enabled==="visibility"?!s.visible:!s.physics?.enabled)return!0;let o=i.geometry,l=r.userData.hasDestroy===!0,h=r.userData.hasDrag===!0;if(o4(s)||l||h||r.dataPatched.events.some(u=>u.data.disabled!==!0&&(u.data.type==="GameControl"||u.data.type==="Follow")))return i.updateMatrixWorldRigid(),this.addBoundsTree(i),!0;if(o){let u=o.getAttribute("position");if(u!==void 0&&u.count>0){e.push({geometry:o,matrixWorld:i.matrixWorld}),t.push(o.id,this._staticBVHIdOf(u),u.version,o.index!==null?this._staticBVHIdOf(o.index):-1,o.index!==null?o.index.version:-1);for(let d of i.matrixWorld.elements)t.push(d)}}return!!hb(i)||void 0}),e.length>0){let i=this._staticBVHCache;if(i!==void 0&&i.signature.length===t.length&&i.signature.every((a,s)=>a===t[s]))return void(this.sharedGameControlGlobals.staticMeshBVH=i.bvh);let r=ry(e.map(a=>am(a.geometry,a.matrixWorld)),!1),n=new(rj())(r);this._staticBVHCache={signature:t,bvh:n},this.sharedGameControlGlobals.staticMeshBVH=n}}addRigidBody(e,t,i){if(iAe(e.matrixWorld))return;let r=[],n="geometry"in e?e.geometry:void 0,a=t.dataPatched;if(n?.getAttribute("position")!==void 0&&r.push(am(n,e.shearScale)),a.physics.fusedBody){let s=this.gatherChildrenGeom(e,r);e.traverseObject(s),e.children.forEach(l=>l.updateMatrixWorld(!0));let o=e.cloner;o&&o.objectForSample===void 0&&a.physics.rigidBody==="dynamic"&&(o.traverseObject(s),o.children.forEach(l=>l.updateMatrixWorld(!0)))}if(r.length>0){let s,o=!1,l=!i.fromCreate&&a.physics.rigidBody==="dynamic"||i.fromCreate&&i.dynamic;l?(s=Mr.RigidBodyDesc.dynamic(),s.setLinearDamping(a.physics.damping).setAngularDamping(a.physics.damping).setAdditionalMass(1e-9).setGravityScale(a.physics.gravityScale).enabledRotations(...a.physics.enabledRotation).enabledTranslations(...a.physics.enabledTranslation)):(i.hasTransformAnim||i.hasFollow||i.hasDrag)&&!i.fromCreate?(s=Mr.RigidBodyDesc.kinematicPositionBased(),o=!0):s=Mr.RigidBodyDesc.fixed();let h=ry(r);(e.hasNonUniformScale?e.matrixWorldRigid:e.matrixWorld).decompose(is,ou,Kf),e.position0=is.clone().divideScalar(this.pixelsPerMeter),e.rotation0=ou.clone(),is.divideScalar(this.pixelsPerMeter),s.setTranslation(is.x,is.y,is.z).setRotation(ou),n?h?.scale(1/this.pixelsPerMeter,1/this.pixelsPerMeter,1/this.pixelsPerMeter):h?.scale(Kf.x/this.pixelsPerMeter,Kf.y/this.pixelsPerMeter,Kf.z/this.pixelsPerMeter);let u=this.sharedGameControlGlobals.rapierWorld.createRigidBody(s),d=!(a.geometry===void 0||a.geometry.type==="SubdivGeometry"||a.geometry.type==="NonParametricGeometry"||a.geometry.type==="BooleanGeometry"||a.geometry.type==="VectorGeometry"||a.geometry.type==="StarGeometry"||a.geometry.type==="RectangleGeometry"||a.geometry.type==="EllipseGeometry"||a.geometry.type==="TriangleGeometry"||a.geometry.type==="TorusGeometry"||a.geometry.type==="HelixGeometry");try{this.addCollider(u,a.physics,h,t,d)}catch{try{this.addCollider(u,a.physics,h,t,!1)}catch(c){console.error(c)}}if(u.numColliders()===0)return void this.sharedGameControlGlobals.rapierWorld.removeRigidBody(u);l?this.rigidBodyToMesh.set(u.handle,[e,Kf.clone(),a.physics.fusedBody]):o?(this.sharedGameControlGlobals.kinematicBodyToEntity.set(u.handle,e),this.sharedGameControlGlobals.entitiesWithTransformAnim.push(e)):this.fixedBodiesToWatch.push([e,u,(e.hasNonUniformScale?e.matrixWorldRigid:e.matrixWorld).clone()]),e.rigidBody=u}}addBoundsTree(e){let t=[];if(e.geometry?.getAttribute("position")!==void 0&&e.geometry?.getAttribute("position").count>0&&t.push(am(e.geometry,e.shearScale)),e.traverseObject(this.gatherChildrenGeom(e,t)),e.children.forEach(i=>i.updateMatrixWorld(!0)),t.length>0){let i=ry(t,!1);e.bvhGeometry=i,i.getAttribute("position").count>0&&(e.bvhGeometry.boundsTree=new(rj())(i),this.sharedGameControlGlobals.entitiesWithTransformAnim.push(e))}}addCollider(e,t,i,r,n=!0){if(i?.getAttribute("position").count===0||i?.getIndex()?.count===0)return;let a;i&&(a=t.colliderType==="trimesh"?Mr.ColliderDesc.trimesh(i.getAttribute("position").array,i.getIndex().array):Mr.ColliderDesc.convexMesh(i.getAttribute("position").array,n?i.getIndex().array:void 0)),a.setFrictionCombineRule(Mr.CoefficientCombineRule.Average).setRestitutionCombineRule(Mr.CoefficientCombineRule.Average).setDensity(t.density).setFriction(t.friction).setRestitution(t.restitution);let s=this.sharedGameControlGlobals.rapierWorld.createCollider(a,e);this.sharedGameControlGlobals.colliderToEntity.set(s.handle,r),this.sharedGameControlGlobals.entityToCollisionEvents[r.uuid]?.some(o=>o.target==="scene")&&s.setActiveEvents(Mr.ActiveEvents.COLLISION_EVENTS)}gatherChildrenGeom(e,t){let i=hb(e);return(r,n)=>{if(n===0)return;if(i&&r.parent===e)return!0;let a;if(rx(r)){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;a=r.object}else if(ny(r))a=r.object;else if(a=r,a.dataPatched.cloner?.hideBase)return!0;let s=a.dataPatched;if(s.physics.enabled==="visibility"?!s.visible:!s.physics.enabled)return!0;n===1?e.hasNonUniformScale?r.matrixWorld.multiplyMatrices(e.shearScale,r.hiddenMatrix):r.matrixWorld.copy(r.hiddenMatrix):r.matrixWorld.multiplyMatrices(r.parent.matrixWorld,r.hiddenMatrix),r.matrixWorld.multiply(r.matrix);let o=r.geometry;return o?.getAttribute("position")!==void 0&&t.push(am(o,r.matrixWorld)),!!hb(r)||void 0}}activate(e){if(this.isEnabled)return;this.isEnabled=!0,this.eventManager=e,this.usePhysics=this.page.data.globalPhysics.usePhysics;let t=this.page.playCamera,i=!1;this.page.traverseEntity(s=>{for(let o of s.dataPatched.events)if(o.data.disabled===!1&&o.data.type==="Trigger")return this.needsCollisionDetection=!0,!0});let r=f0e();if(r!==null?i=r.setup({manager:this,camera:t,renderer:this.renderer,sharedAssets:this.sharedAssets,eventContext:this.eventContext,isExport:this.isExport})||i:this.page.data.publish.gameControlObject!==null&&Ms("game-controls","the scene's game controls"),i===!1){let{enableRotate:s,enablePan:o,enableZoom:l,autoRotate:h,hoverRotatePanMode:u}=this.eventManager.publish.orbitControls;(s||o||l||h||u!==0)&&(this.orbitControls=new IEe(t,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 n=this.renderer.domElement.width/this.renderer.getPixelRatio(),a=this.renderer.domElement.height/this.renderer.getPixelRatio();f0e()?.createJoysticks(this,n,a),this.markIsDestroyTarget(),this.markIsDragObject(),this.rebuildBVH(),this.initializationCounter++,window.setTimeout(()=>{this.collisionEvents.forEach(s=>s.initialDisabled=!1)},80)}initPhysics(){this.sharedGameControlGlobals.rapierWorld?.free(),this.sharedGameControlGlobals.rapierWorld=new Mr.World(new Mr.Vector3(0,this.gravity,0)),this.events=new Mr.EventQueue(!0);let e=[],t=[];if(this.page.traverseChildren(s=>{let o;if(rx(s)){if(!s.objectForSample)return s.object.dataPatched.physics.fusedBody===!0&&s.object.dataPatched.physics.rigidBody==="dynamic"||void 0;if(s.objectForSample.dataPatched.physics.fusedBody)return;o=s.object}else if(ny(s))o=s.object;else{if(yE(s)||t1(s)||s instanceof Dx)return;if(o=s,o.dataPatched.cloner?.disabled===!1&&o.dataPatched.cloner?.hideBase&&o.dataPatched.physics?.fusedBody!==!0)return!0}let l,h=o.dataPatched;for(let g of h.events)g.data.disabled!==!0&&g.data.type==="GameControl"&&(l=g.data);if(!h.physics||(h.physics.enabled==="visibility"?!h.visible:!h.physics.enabled))return!0;s.updateMatrixWorldRigid();let u=o4(h),d=!1,c=o.userData.hasDestroy,p=o.userData.hasDrag,m=!1;for(let g of h.events)if(g.data.disabled!==!0){if(g.data.type==="Collision"){d=!0;let v=new F5e(g.id,g.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!==g.id)?this.sharedGameControlGlobals.entityToCollisionEvents[o.uuid].push(v):this.sharedGameControlGlobals.entityToCollisionEvents[o.uuid]=[v]}else if(g.data.type==="Follow"){m=!0;let v=g.data.target;s.traverseVisible(y=>{y.userData.isFollowingObj=v})}}h.physics.rigidBody==="dynamic"&&h.physics.fusedBody===!1&&(s.matrixWorldFusedFalse=s.matrixWorld.clone());let f=s.geometry;if(l!==void 0){let g=Mr.RigidBodyDesc.kinematicPositionBased();(s.hasNonUniformScale?s.matrixWorldRigid:s.matrixWorld).decompose(is,ou,Kf),s.position0=is.clone().divideScalar(this.pixelsPerMeter),s.rotation0=ou.clone(),is.divideScalar(this.pixelsPerMeter),g.setTranslation(is.x,is.y,is.z).setRotation(ou);let v,y=this.sharedGameControlGlobals.rapierWorld.createRigidBody(g);s.rigidBody=y,v=l.collider.type==="sphere"?Mr.ColliderDesc.ball(l.collider.radius/this.pixelsPerMeter):l.collider.type==="capsule"?Mr.ColliderDesc.capsule((l.collider.height/2-l.collider.radius)/this.pixelsPerMeter,l.collider.radius/this.pixelsPerMeter):Mr.ColliderDesc.cuboid(l.collider.width/this.pixelsPerMeter/2,l.collider.height/this.pixelsPerMeter/2,l.collider.depth/this.pixelsPerMeter/2),v.setFrictionCombineRule(Mr.CoefficientCombineRule.Average).setDensity(h.physics.density).setFriction(h.physics.friction).setRestitution(0).setRestitutionCombineRule(Mr.CoefficientCombineRule.Min);let _=this.sharedGameControlGlobals.rapierWorld.createCollider(v,y);this.sharedGameControlGlobals.colliderToEntity.set(_.handle,o),is.fromArray(l.collider.position.map(x=>typeof x=="number"?x:0)).multiply(Kf.setFromMatrixScale(o.matrixWorld)).divideScalar(this.pixelsPerMeter),_.setTranslationWrtParent(is);let b=new Zt().setFromEuler(new pn().setFromVector3(new D().fromArray(l.collider.rotation.map(x=>typeof x=="number"?x:0))));_.setRotationWrtParent(b),_.setActiveEvents(Mr.ActiveEvents.COLLISION_EVENTS),this.generateSensorColliderDescs(o,!0)}else h.physics.rigidBody==="dynamic"||u||m||c||p||d?(this.addRigidBody(s,o,{hasFollow:m,hasTransformAnim:u,hasDrag:p}),this.generateSensorColliderDescs(o,h.physics.fusedBody)):(f&&e.push(am(f,s.matrixWorld)),h.physics.fusedBody&&!hb(s)&&s.traverseObject((g,v)=>{if(v===0)return;let y;if(rx(g)){if(!g.objectForSample)return g.object.dataPatched.physics.fusedBody===!0&&g.object.dataPatched.physics.rigidBody==="dynamic"||void 0;if(g.objectForSample.dataPatched.physics.fusedBody)return;y=g.object}else{if(yE(g)||t1(g)||g instanceof Dx)return;if(ny(g))y=g.object;else if(y=g,y.dataPatched.cloner?.hideBase)return!0}let _=y.dataPatched;if(_.physics.enabled==="visibility"?!_.visible:!_.physics.enabled)return!0;let b=g.geometry;return b?.getAttribute("position")!==void 0&&e.push(am(b,g.matrixWorld)),!!hb(g)||void 0}),this.generateSensorColliderDescs(o,h.physics.fusedBody,t));return!(h.physics?.fusedBody!==!0&&!l&&!hb(s))||void 0}),e.length===0)return;let i=ry(e),r=i.getIndex().count>0;if(!r&&t.length===0)return;i.scale(1/this.pixelsPerMeter,1/this.pixelsPerMeter,1/this.pixelsPerMeter);let n=Mr.RigidBodyDesc.fixed(),a=this.sharedGameControlGlobals.rapierWorld.createRigidBody(n);if(r){let s=Mr.ColliderDesc.trimesh(i.getAttribute("position").array,i.getIndex().array).setFrictionCombineRule(Mr.CoefficientCombineRule.Multiply).setRestitutionCombineRule(Mr.CoefficientCombineRule.Multiply).setFriction(1).setRestitution(1);this.sharedGameControlGlobals.rapierWorld.createCollider(s,a)}for(let[s,o]of t){let l=this.sharedGameControlGlobals.rapierWorld.createCollider(s,a);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(e=>{for(let t of e.dataPatched.events)if(t.data.type==="Trigger"&&t.data.disabled!==!0){let i=new _0e(t.id,t.data,e,this.page,this.sharedAssets,this.eventManager),r=new ke().compose(Qu.fromArray(t.data.position.map(n=>typeof n=="number"?n:0)),lb.setFromEuler(b0e.fromArray(t.data.rotation.map(n=>typeof n=="number"?n:0))),sj);if(t.data.triggerZone==="box"){let n=new fn;n.min.fromArray(t.data.size.map(a=>typeof a=="number"?a:0)).multiplyScalar(-.5),n.max.fromArray(t.data.size.map(a=>typeof a=="number"?a:0)).multiplyScalar(.5),this.sharedGameControlGlobals.triggers.push([n,r,e,i])}else this.sharedGameControlGlobals.triggers.push([t.data.radius,r,e,i])}}),this.needsCollisionDetection&&this.initBVH())}disconnectEvents(){this.collisionEvents.forEach(e=>e.disconnect()),this.sharedGameControlGlobals.triggers.forEach(e=>e[3].disconnect()),this.sharedGameControlGlobals.triggers.length=0}deactivate(){if(this.isEnabled){this.isEnabled=!1,this.page.traverse(e=>{let t=e;t.matrixWorldFusedFalse&&(t.matrixWorldFusedFalse=void 0),t.rigidBody&&(t.rigidBody=void 0),t.position0&&(t.position0=void 0),t.rotation0&&(t.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(([e,t])=>{e?.destroy(),t.remove()}),this.joystickToGameControls=[],this.joysticks=[],this.orbitControls&&(this.orbitControls.dispose(),this.orbitControls=void 0),this.navigationMeshWrapper?.dispose(),this.navigationMeshWrapper=void 0;for(let e of Object.values(this.sharedGameControlGlobals.entityToCollisionEvents))e.forEach(t=>t.disconnect());this.sharedGameControlGlobals.entityToCollisionEvents={},this.page.updateMatrixWorld(!0)}}update(e){if(!this.isEnabled)return!0;let t=!0;if(this.orbitControls!==void 0&&this.orbitControls.needsUpdate&&(this.orbitControls.update(),t=!this.orbitControls.isCurrentlyDamping),this.initializationCounter>=0&&this.initializationCounter<2?(this.initializationCounter++,t=!1):this.initializationCounter===2&&this.gameControl&&(t=!this.gameControl.update(e)&&t),this.usePhysics===!1&&this.checkTrigger(),this.usePhysics){let i=.016666666666666666;if(e===0)t=this.stepPhysics()&&t;else{let r=e/1e3;r<i&&r>.55*i&&(r=i),this.accumulator+=r;let n=performance.now(),a=0,s=6;for(;this.accumulator>=i&&a<s&&(t=this.stepPhysics()&&t,this.accumulator-=i,a++,!(performance.now()-n>1e3*i)););this.accumulator=this.accumulator%i}}this.skipRender=t}recordPhysicsPose(e){(e.hasNonUniformScale?e.matrixWorldRigid:e.matrixWorld).decompose(is,ou,Kf);let t=e;t.prevQ===void 0?(t.prevQ=ou.clone(),t.prevT=is.clone()):(t.prevQ.copy(ou),t.prevT.copy(is))}promoteMovedFixedBodies(){for(let e=this.fixedBodiesToWatch.length-1;e>=0;e--){let[t,i,r]=this.fixedBodiesToWatch[e];(t.hasNonUniformScale?t.matrixWorldRigid:t.matrixWorld).equals(r)||(i.setBodyType(Mr.RigidBodyType.KinematicPositionBased,!0),this.sharedGameControlGlobals.kinematicBodyToEntity.set(i.handle,t),this.sharedGameControlGlobals.entitiesWithTransformAnim.push(t),this.fixedBodiesToWatch.splice(e,1))}}clampPushedBodies(){let e=this.gameControl?.object.rigidBody;if(e===void 0)return;let t=this.sharedGameControlGlobals.rapierWorld,i=e.linvel(),r=e.translation(),n=Math.hypot(i.x,i.z);for(let a=0;a<e.numColliders();a++){let s=e.collider(a);t.contactPairsWith(s,o=>{let l=o.parent();if(l===null||!l.isDynamic())return;let h=l.translation(),u=-1/0,d=0,c=0;if(t.contactPair(s,o,v=>{let y=v.normal(),_=y.x*(h.x-r.x)+y.y*(h.y-r.y)+y.z*(h.z-r.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>u&&(u=S,d=b/w,c=x/w)}),u===-1/0)return;let p=i.x*d+i.z*c;if(p<-lj)return;let m=l.linvel();if(n>lj&&p>lj){let v=m.x*d+m.z*c;if(v<=0)return;let y=Math.min(v,p);return void l.setLinvel({x:d*y,y:m.y,z:c*y},!0)}let f=m.x*d+m.z*c-Math.max(0,p);if(f<=0)return;let g=.5*f;l.setLinvel({x:m.x-d*g,y:m.y,z:m.z-c*g},!0)})}}stepPhysics(){this.promoteMovedFixedBodies();for(let e of this.sharedGameControlGlobals.kinematicBodyToEntity.values())this.recordPhysicsPose(e),e.rigidBody.setNextKinematicTranslation(is.divideScalar(this.pixelsPerMeter)),e.rigidBody.setNextKinematicRotation(ou);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(e,t,i){let r,n=(this.sharedGameControlGlobals.rapierWorld?.getCollider(i))._parent;if(t.cloner){for(let a of t.cloner.children)if(a.rigidBody===n){r=a;break}}e.dispatch(r),t.dispatchEvent(n$)}updateUseWindowEvents(e){this.orbitControls?.updateUseWindowEvents(e)}generateSensorColliderDescs(e,t,i){let r=x0e.copy(e.matrixWorld).invert();e.traverseEntity((n,a)=>{if(t===!1&&a===1)return!0;for(let s of n.dataPatched.events)if(s.data.type==="Trigger"&&s.data.disabled!==!0){let o,l=new _0e(s.id,s.data,n,this.page,this.sharedAssets,this.eventManager);if(o=s.data.triggerZone==="box"?Mr.ColliderDesc.cuboid(...s.data.size.map(h=>(typeof h=="number"?h:1)/(2*this.pixelsPerMeter))):Mr.ColliderDesc.ball(s.data.radius/this.pixelsPerMeter),o.setDensity(0).setSensor(!0).setActiveEvents(Mr.ActiveEvents.COLLISION_EVENTS),Qu.fromArray(s.data.position.map(h=>typeof h=="number"?h:0)),lb.setFromEuler(b0e.fromArray(s.data.rotation.map(h=>typeof h=="number"?h:0))),fN.compose(Qu,lb,sj).premultiply(n.matrixWorld),i?(fN.decompose(Qu,lb,aj),o.setActiveCollisionTypes(Mr.ActiveCollisionTypes.KINEMATIC_FIXED|Mr.ActiveCollisionTypes.DYNAMIC_FIXED)):(fN.premultiply(r).decompose(Qu,lb,aj),e.rigidBody.bodyType()===Mr.RigidBodyType.Dynamic||(e.rigidBody.bodyType()===Mr.RigidBodyType.Fixed?o.setActiveCollisionTypes(Mr.ActiveCollisionTypes.KINEMATIC_FIXED|Mr.ActiveCollisionTypes.DYNAMIC_FIXED):o.setActiveCollisionTypes(Mr.ActiveCollisionTypes.KINEMATIC_KINEMATIC|Mr.ActiveCollisionTypes.DYNAMIC_KINEMATIC))),Qu.divideScalar(this.pixelsPerMeter),o.setTranslation(Qu.x,Qu.y,Qu.z),o.setRotation(lb),i)i.push([o,l]);else{let h=this.sharedGameControlGlobals.rapierWorld.createCollider(o,e.rigidBody);this.sensorToTriggerEvent[h.handle]=l}}})}checkTrigger(){let e;for(let t=0;t<this.sharedGameControlGlobals.triggers.length;t++){let[i,r,n,a]=this.sharedGameControlGlobals.triggers[t];for(let s=0;s<this.sharedGameControlGlobals.entitiesWithTransformAnim.length;s++){let o=this.sharedGameControlGlobals.entitiesWithTransformAnim[s];if(n===o||a.isValidTriggeringObject(hr.is(o)?o:o.object)===!1)continue;let l=x0e.copy(n.matrixWorld).decompose(Qu,w0e,aj).compose(Qu,w0e,sj).multiply(r),h=fN.copy(o.matrixWorld).invert().multiply(l),u=o.bvhGeometry.boundsTree;i instanceof fn?e=u.intersectsBox(i,h):(oj.radius=i,oj.center.setFromMatrixPosition(h),e=u.intersectsSphere(oj)),e?a.currentIntersectedObjects.indexOf(o)===-1&&(a.currentIntersectedObjects.push(o),a.dispatch(),n.dispatchEvent(V5e)):a.currentIntersectedObjects=a.currentIntersectedObjects.filter(d=>d!==o)}}}};Ew(),le(),uL(),Nr(),Ym();var hj=.02,S0e=new D,T0e=new D,G5e=new D,jo=new D,Vp=new D,ub=new D,uj=new ke,M0e=new ke,j5e=new ke,vh=new Zt,Ev=new Zt,db=new pn(0,0,0,"YXZ"),H5e=new D(1,0,0),fc=new D(0,1,0),W5e=new D(0,0,1),E0e=new D(1,1,1),A0e=[],C0e=e=>A0e[e]??(A0e[e]=new D),dj=new D,q5e=new D,$5e=new D,X5e=new D,P0e=new Zt,Y5e=new D,R0e=new Zt,zs=new Ch,lu=new fn,K5e={type:"requestRender"},Z5e={type:"updateMatrix"},a$=class extends xa{constructor(e,t,i,r,n,a,s,o,l){super(),this.object=e,this.domElement=t,this.data=i,this.gloabalPhysics=r,this.controlsManager=n,this.cameraFollow=a,this.camera=s,this.page=o,this.sharedAssets=l,this.enableDamping=!0,this.hiddenMatrix0=new ke,this.target0=new D,this.zoom0=1,this.rotForce=1,this.moveForce=1,this.pixelsPerMeter=200,this.euler0=new pn(0,0,0,"YXZ"),this.position0Cam=new D,this.quat0Cam=new Zt,this.scale0Cam=new D,this.hiddenMatrix0Cam=new ke,this.threshEndTranslate=.01,this.threshEndRotate=1e-8,this.threshEndRotVel=.005,this.collider={type:"capsule",radius:40,segment:new Ch(new D(0,-40,0),new D(0,40,0)),matrix:new ke,position:new D,rotation:new Zt},this.euler=new pn(0,0,0,"YXZ"),this.eulerDelta=new D,this.lastPosition=new D,this.lastCameraQuaternion=new Zt,this.lastCameraPosition=new D,this.PI_2=Math.PI/2,this.prevMouse=new J,this.velocityTarget=new D,this.velocity=new D,this.directionXZ=new D,this.rotVelocityStick=new D,this.rotVelocityTarget=new D,this.rotVelocity=new D,this.rotDirection=new D,this.nonColliderRotOffset=new ke,this.nonColliderPosOffset=new ke,this.firstPointerId=-1,this.rot=new D,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 ke,this.objectToTarget=new D,this.objectToTarget0=new D,this.objectToCamXZ=new D,this.objectToCamXZ0=new D,this.targetToCamera=new D,this.targetToCamera0=new D,this.cameraPolarAxis0=new D,this.targetPos=new D,this.targetQuat=new Zt,this.lerpFactorPos=new D().setScalar(.3),this.lerpFactorPosStart=.3,this.lerpFactorPosEnd=.3,this.lerpFactorRotStart=.3,this.lerpFactorRotEnd=.3,this.lerpFactorPosCamera=.3,this.lerpFactorRotCamera=.3,this.objXZQuat=new Zt,this.objXZQuatInv=new Zt,this.objXZRotMat=new ke,this.isFirstPerson=!1,this.didHit=!1,this.groundVelocity=new D,this.pushedVelocity=new D,this.groundYRotation=0,this.objectRealQuat=new Zt,this.colliderWorldQuat=new Zt,this.groundNormal=new D,this.groundTilt=new Zt,this.groundTiltInv=new Zt,this.lastHitObj=null,this.isFirstFrame=!0,this.rotationAccumWhenOrientWithCamera=0,this.navMeshPathDest=null,this.position=new D,this.quaternion=new Zt,this.scale=new D,this.initialAction=!0,this.onPointerDown=m=>{!(m.target===this.domElement||m.target instanceof HTMLElement&&m.target.tagName==="SPLINE-VIEWER"&&m.target.shadowRoot?.contains(this.domElement))||this.firstPointerId!==-1||(this.firstPointerId=m.pointerId,this.domElement.ownerDocument.addEventListener("pointermove",this.onPointerMove),this.domElement.ownerDocument.addEventListener("pointerup",this.onPointerUp),this.rotBy!=="keys"&&!Zl&&!w7&&this.domElement.requestPointerLock(),this.prevMouse.set(m.clientX,m.clientY))},this.onPointerUp=m=>{this.firstPointerId=-1,this.domElement.ownerDocument.removeEventListener("pointermove",this.onPointerMove),this.domElement.ownerDocument.removeEventListener("pointerup",this.onPointerUp),m.pointerType==="mouse"&&this.domElement.ownerDocument.exitPointerLock()},this.onPointerMove=m=>{if(m.pointerId!==this.firstPointerId)return;let f=m.clientX-this.prevMouse.x,g=m.clientY-this.prevMouse.y;this.prevMouse.set(m.clientX,m.clientY),m.pointerType==="mouse"&&this.rotBy!=="keys"&&(w7&&m1e<15.5&&!Zl?(this.eulerDelta.y=-f*this.mouseOrbitSensitivity,this.eulerDelta.x=-g*this.mouseOrbitSensitivity):(this.eulerDelta.y=-m.movementX*this.mouseOrbitSensitivity,this.eulerDelta.x=-m.movementY*this.mouseOrbitSensitivity)),m.pointerType!=="mouse"&&this.rotByTouch==="drag"&&(this.eulerDelta.y=-f*this.mouseOrbitSensitivity*5,this.eulerDelta.x=-g*this.mouseOrbitSensitivity*5),this.controlsManager.requestRender()},this.onPointerlockChange=m=>{this.domElement.ownerDocument.pointerLockElement===this.domElement?a$.isLocked=!0:a$.isLocked=!1},this.onPointerlockError=()=>{console.error("SPE.GameControls: Unable to use Pointer Lock API")},this.handleVisibilityChange=()=>{if(document?.hidden)for(let m in this.movementState)this.movementState[m]=0},this.onKeyDown=m=>{!(m.target instanceof HTMLInputElement)&&(m.code==="ArrowLeft"||m.code==="ArrowUp"||m.code==="ArrowRight"||m.code==="ArrowDown"||m.code==="Space")&&m.preventDefault();for(let f of this.keyAssignments)if(m.key.toUpperCase()===f[1]||m.key===f[1]){this.movementState[f[0]]=1;break}this.controlsManager.requestRender()},this.onKeyUp=m=>{for(let f of this.keyAssignments)if(m.key.toUpperCase()===f[1]||m.key===f[1]||m.code.slice(3,m.code.length).toUpperCase()===f[1]){this.movementState[f[0]]=0;break}},this.copyVRGamePadValues=(m,f)=>{for(let g=2;g<4;g++){let v=m.axes[g];f===0?g===2?this.movementState.movePosX=v:this.movementState.movePosZ=v:(m.buttons[3].pressed?this.movementState.jump=1:this.movementState.jump=0,g===2?this.movementState.rotPosY=v:this.moveMode==="fly"&&(this.movementState.moveNegY=v))}},this.sharedGameControlGlobals=n.sharedGameControlGlobals,e===s&&(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 h=this.euler0.clone(),u=h.y;if(this.objectRealQuat.copy(this.quaternion),h.y=0,this.quaternion.setFromEuler(h),this.objXZQuat.copy(this.quaternion),this.objXZQuatInv.copy(this.objXZQuat).invert(),this.objXZRotMat.makeRotationFromQuaternion(this.quaternion),h.set(0,u,0),this.quaternion.setFromEuler(h),this.rot.setFromEuler(h),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 m,f=new D(0,0,-1).applyQuaternion(this.camera.quaternion),g=new D().subVectors(this.position,this.camera.position);this.objectToCamXZ.copy(g),this.objectToCamXZ.y=0,this.objectToCamXZ0.copy(this.objectToCamXZ),Math.abs(f.y)<1e-6?(g.y=0,f.y=0,m=g.projectOnVector(f)):m=g.y/f.y>0?f.multiplyScalar(g.y/f.y):f.multiplyScalar(g.length()),this.targetToCamera0.copy(m).negate();let v=this.camera.position.clone().add(m);this.objectToTarget0.subVectors(v,this.position);let y=new pn().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 na&&(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(m=>{let f=[m[0],m[1]];return f[1]==="\u25B2"?f[1]="ArrowUp":f[1]==="\u25C0"?f[1]="ArrowLeft":f[1]==="\u25BC"?f[1]="ArrowDown":f[1]==="\u25B6"?f[1]="ArrowRight":f[1]==="\u21E7"?f[1]="Shift":f[1]==="\u21B5"?f[1]="Enter":f[1]==="Space"?f[1]=" ":f[1]==="\u2318"?f[1]="Meta":f[1]==="Ctrl"?f[1]="Control":f[1]==="Esc"&&(f[1]="Escape"),f}),i.rotBy==="mouse"){let m;m=this.keyAssignments.findIndex(f=>f[0]==="rotNegX"),m!==-1&&(this.keyAssignments[m][1]=""),m=this.keyAssignments.findIndex(f=>f[0]==="rotPosX"),m!==-1&&(this.keyAssignments[m][1]=""),m=this.keyAssignments.findIndex(f=>f[0]==="rotPosY"),m!==-1&&(this.keyAssignments[m][1]=""),m=this.keyAssignments.findIndex(f=>f[0]==="rotNegY"),m!==-1&&(this.keyAssignments[m][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??Mx.defaultData.gravity),this.usePhysics=this.gloabalPhysics.usePhysics??Mx.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??iL.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*hj/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*hj/this.pixelsPerMeter,this.stepThresh=2*i.collider.radius*.3/this.pixelsPerMeter,this.colliderHeight=2*i.collider.radius):(this.offset=i.collider.height*hj/this.pixelsPerMeter,this.stepThresh=.3*i.collider.height/this.pixelsPerMeter,this.colliderHeight=i.collider.height),this.collider.type=i.collider.type;let d=new D().fromArray(i.collider.position.map(m=>typeof m=="number"?m:0)),c=new Zt().setFromEuler(new pn().fromArray([...i.collider.rotation.map(m=>typeof m=="number"?m:0),"XYZ"]));this.collider.position.copy(d).multiply(this.scale),this.collider.rotation.copy(c),this.collider.matrix.compose(d,c,E0e),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 m=new Nt;m.push({fi:0,data:{...ha.defaultData("light","phong"),alpha:0},id:"layer1"}),m.push({fi:0,data:{...ha.defaultData("color"),color:i.navmesh.destinationHelperColor,alpha:i.navmesh.destinationHelperColor.a},id:"layer2"});let f=Cbe({layers:m},{scene:this.page.scene,shared:this.sharedAssets});this.navMeshPathDest=new Cr(OX.create({parameters:{width:p,height:p/10,hollow:.7}}),f),this.navMeshPathDest.material.userData.opacity0=i.navmesh.destinationHelperColor.a}this.activate()}reset(e=!1){if(this.object.hiddenMatrix.copy(this.hiddenMatrix0),e){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 t=new pn().setFromQuaternion(this.quaternion,"YXZ"),i=t.y;this.objectRealQuat.copy(this.quaternion),t.y=0,this.quaternion.setFromEuler(t),this.objXZQuat.copy(this.quaternion),this.objXZQuatInv.copy(this.objXZQuat).invert(),this.objXZRotMat.makeRotationFromQuaternion(this.quaternion),t.set(0,i,0),this.quaternion.setFromEuler(t),this.rot.setFromEuler(t),this.euler.setFromQuaternion(this.quaternion,"YXZ"),this.velocityTarget.set(0,0,0),this.velocity.set(0,0,0)}else this.object instanceof na?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 e=this.data,t=this.sharedAssets;e.gameActions!==void 0&&(this.actions={},tL.list.forEach(i=>{this.actions[i]=us({...e,disabled:!1,type:"GameControl"},e.gameActions[i],this.page,t,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"),Ks(this.actions.idle),Ks(this.actions.move),Ks(this.actions.run),Ks(this.actions.jump)}dispatchStartEvent(e){this.actions[e]!==void 0&&(this.actionState[e]||(this.actionState[e]=!0,this.actions[e].Transition.forEach(t=>{t.play()}),this.actions[e].Animation.forEach(t=>{t.play(this.initialAction===!1)}),this.actions[e].TimelineAnimation.forEach(t=>{t.play()}),this.actions[e].Create.forEach(t=>{t.dispatchStart()}),this.actions[e].Audio.forEach(t=>{t.dispatchGameControl("start")}),this.actions[e].Particles.forEach(t=>{t.dispatchGameControl("start")})))}dispatchStopEvent(e){this.actions[e]!==void 0&&(!this.actionState[e]||(this.actionState[e]=!1,this.actions[e].Transition.forEach(t=>{t.stop(),t.object.currentState!==null&&t.object.changeSelectedState(null,{scene:this.page.scene,shared:this.sharedAssets})}),this.actions[e].TimelineAnimation.forEach(t=>{t.stop()}),this.actions[e].Create.forEach(t=>{t.dispatchStop()}),this.actions[e].Audio.forEach(t=>{t.dispatchGameControl("stop")}),this.actions[e].Particles.forEach(t=>{t.dispatchGameControl("stop")})))}get colliderWorldPosition(){return jo.copy(this.collider.position).applyQuaternion(this.objectRealQuat).add(this.position)}update(e){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 t=(this.isFirstFrame?16.6:e)/1e3;this.isFirstFrame&&(this.isFirstFrame=!1);let i=60*t,r=!1;if(this.groundYRotation=0,this.groundVelocity.set(0,0,0),this.usePhysics&&this.collisionEnabled&&this.object.rigidBody?.collider(0).shape){let a=Vp.set(0,(this.velocity.y===0?this.pixelsPerMeter*Math.max(Math.abs(this.gravity)/120,1)*(this.gravity>0?1:-1):this.velocity.y)*t,0).divideScalar(this.pixelsPerMeter),s=this.sharedGameControlGlobals.rapierWorld.castShape(this.colliderWorldPosition.divideScalar(this.pixelsPerMeter),this.colliderWorldQuat,a,this.object.rigidBody?.collider(0).shape,0,1,!1,8,void 0,void 0,this.object.rigidBody);if(s){this.onObject=!0,this.groundNormal.set(s.normal2.x,s.normal2.y,s.normal2.z).applyQuaternion(this.colliderWorldQuat).negate(),this.alignToGround&&this.groundTiltAdjustment(this.groundNormal),Math.acos(this.groundNormal.y)<this.slopeThresh&&(r=!0),s.collider.parent()?.bodyType()===0&&Math.acos(this.groundNormal.y)*(180/Math.PI)>45&&(this.onObject=!1);let o=s.collider.parent(),l=o!==null&&o.isKinematic()?o:null,h=l===null?void 0:this.sharedGameControlGlobals.kinematicBodyToEntity.get(l.handle);if(l!==null&&h?.userData.isFollowingObj!==this.object.uuid){let u=this.object.getWorldPosition(jo).add(this.collider.position).divideScalar(this.pixelsPerMeter),d=l.velocityAtPoint(u);this.groundVelocity.set(d.x,d.y,d.z).multiplyScalar(this.pixelsPerMeter),this.groundYRotation=l.angvel().y*t}}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 a=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 s=jo.subVectors(this.path[1],this.position),o=Vp.subVectors(this.path[1],this.path[0]);s.dot(o)<0?this.path.shift():(this.directionXZ.x=o.x,this.directionXZ.z=o.z),a.opacity=a.userData.opacity0}else a.opacity-=.05*a.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 n=G5e.copy(this.velocity);if(this.orientMode!=="none"&&this.isFirstPerson===!1){let a=Vp.copy(n);a.y=0,n.set(0,n.y,a.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 a=jo;this.camera.getWorldDirection(a);let s=ub.copy(fc).multiplyScalar(a.dot(fc));a.sub(s);let o=Vp.copy(this.directionXZ);o.x*=-1,this.rot.y=a.angleTo(o)*(a.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(db.setFromVector3(this.rot),this.moveMode==="walk"&&(db.x=0),n.applyEuler(db),r&&(Ev.setFromUnitVectors(fc,this.groundNormal),n.applyQuaternion(Ev)),this.usePhysics===!0&&this.object.rigidBody){this.pushedVelocity.set(0,0,0);let a=0;for(let s of this.sharedGameControlGlobals.entitiesWithTransformAnim){if(s.rigidBody===void 0||s.prevQ===void 0)continue;(s.hasNonUniformScale?s.matrixWorldRigid:s.matrixWorld).decompose(dj,P0e,q5e);let o=this.object.getWorldPosition($5e).add(this.collider.position).sub(dj);R0e.copy(s.prevQ).invert().premultiply(P0e);let l=ub.subVectors(dj,s.prevT).add(X5e.copy(o).applyQuaternion(R0e).sub(o)).divideScalar(t).divideScalar(this.pixelsPerMeter),h=s.rigidBody.collider(0).castCollider(l,this.object.rigidBody.collider(0),jo.copy(n).divideScalar(this.pixelsPerMeter),0,t,!1);l.multiplyScalar(this.pixelsPerMeter);let u=hr.is(s)?s:s.object;if(h!==null&&this.lastHitObj!==u){let d;s instanceof Dh&&(d=s);let c=this.sharedGameControlGlobals.entityToCollisionEvents[u.uuid];if(c)for(let p of c)p.data.target==="character"&&(p.dispatch(d),u.dispatchEvent(n$));this.lastHitObj=u}h!==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),C0e(a++).copy(h.normal1).applyQuaternion(s.quaternion))}if(a>0){for(let s=0;s<a;s++){let o=C0e(s),l=o.dot(n);l<0&&n.addScaledVector(o,-l)}n.add(this.pushedVelocity)}else n.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(t),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*t,this.euler.y+=this.rotVelocity.y*t+this.groundYRotation,this.rotVelocityTarget.y===0&&this.directionXZ.manhattanLength()===0?this.rotationAccumWhenOrientWithCamera=0:(this.cameraFollow===!1||this.cameraYAxis==="Locked")&&(this.rotationAccumWhenOrientWithCamera+=this.rotVelocity.y*t),this.isFirstPerson===!1&&this.orientMode!=="none"&&this.directionXZ.manhattanLength()>0){if(this.orientMode==="radial"){this.objectToCamXZ.copy(this.objectToCamXZ0).applyAxisAngle(fc,this.euler.y-this.euler0.y);let a=Vp.copy(this.objectToCamXZ).normalize(),s=ub.copy(n).multiplyScalar(t);s.y=0;let o=s.sub(jo.copy(a).multiplyScalar(s.dot(a))).cross(a).y;this.euler.y-=Math.atan2(o,this.objectToCamXZ.length())}}else this.rot.y+=this.rotVelocity.y*t+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=ht.clamp(this.euler.x,-this.maxPolarAngle+this.cameraPolarOffset+1e-6,-this.minPolarAngle+this.cameraPolarOffset-1e-6):this.euler.x=ht.clamp(this.euler.x,-this.PI_2+this.cameraPolarOffset,this.PI_2+this.cameraPolarOffset):this.cameraXAxis==="Limit"&&(this.euler.x=ht.clamp(this.euler.x,-this.PI_2,this.PI_2))),this.moveMode==="fly"?this.rot.x=this.euler.x:this.isFirstPerson&&(db.copy(this.euler),db.y=0,this.nonColliderRotOffset.makeRotationFromEuler(db)),vh.setFromAxisAngle(H5e,this.rot.x),Ev.setFromAxisAngle(fc,this.rot.y),Ev.multiply(vh),vh.setFromAxisAngle(W5e,this.rot.z),Ev.multiply(vh),this.quaternion.copy(Ev),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 a=Vp.copy(n).multiplyScalar(t/this.pixelsPerMeter),s=null;this.didHit=!1;let o=new D;for(let u=0;u<5;u++){let d=a.length(),c=ub.copy(a).normalize();if(s=this.sharedGameControlGlobals.rapierWorld.castShape(this.colliderWorldPosition.divideScalar(this.pixelsPerMeter).add(o),this.colliderWorldQuat,c,this.object.rigidBody.collider(0).shape,0,d,!1,12,void 0,void 0,this.object.rigidBody),s===null){u===0&&this.directionXZ.manhattanLength()!==0&&(this.lastHitObj=null),o.add(a);break}{this.didHit=!0;let p=this.sharedGameControlGlobals.colliderToEntity.get(s.collider.handle);if(p!==this.lastHitObj&&u===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(s.collider.handle))._parent;if(p.cloner){for(let x of p.cloner.children)if(x.rigidBody===b){_=x;break}}y.dispatch(_),p.dispatchEvent(n$)}}}let m=S0e.set(s.normal2.x,s.normal2.y,s.normal2.z).applyQuaternion(this.colliderWorldQuat),f=T0e.copy(c).multiplyScalar(s.time_of_impact).dot(m),g=s.time_of_impact;if(g===0&&(this.position.y+=this.offset*this.pixelsPerMeter),f>this.offset&&(g=s.time_of_impact*(f-this.offset)/f,o.addScaledVector(c,g)),a.copy(c).multiplyScalar(d-g),Math.acos(-m.y)>this.slopeThresh){let v=this.colliderWorldPosition.divideScalar(this.pixelsPerMeter).add(o),y=ub.copy(s.witness2).applyQuaternion(this.colliderWorldQuat);y.y=0;let _=v.add(y);_.y+=this.stepThresh;let b=this.sharedGameControlGlobals.rapierWorld.castShape(_,this.colliderWorldQuat,a,this.object.rigidBody?.collider(0).shape,0,1,!1,12,void 0,void 0,this.object.rigidBody);b!==null&&b.time_of_impact===0&&(m.y=0,m.normalize())}a.addScaledVector(m,-a.dot(m))}}this.position.addScaledVector(o,this.pixelsPerMeter),jo.copy(this.position).divideScalar(this.pixelsPerMeter),vh.copy(this.quaternion).premultiply(this.groundTilt).multiply(this.objXZQuat);let l=this.object.rigidBody,h=l!==void 0&&Y5e.copy(jo).sub(l.translation()).lengthSq()>1;l!==void 0&&(h?(l.setTranslation(jo,!0),l.setRotation(vh,!0)):(l.setNextKinematicTranslation(jo),l.setNextKinematicRotation(vh)))}else{let a=this.onObject?1:5,s=n.multiplyScalar(t/a);for(let o=0;o<a;o++)this.position.add(s),this.collisionAdjustment(t/a)}else this.position.addScaledVector(n,t);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 a=this.objectToTarget.add(this.position),s=this.targetToCamera.add(a);uj.lookAt(s,a,fc).setPosition(s),uj.decompose(this.targetPos,this.targetQuat,jo),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=ht.clamp(this.euler.y,this.minAzimuthAngleRel,this.maxAzimuthAngleRel)),this.euler.x=ht.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(Z5e),!(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(K5e),0))}updateFollowArms(){this.objectToTarget.copy(this.objectToTarget0),this.targetToCamera.copy(this.targetToCamera0);let e,t=vh.setFromAxisAngle(fc,this.cameraYAxis==="Limit"&&this.orientMode!=="radial"?ht.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(t),e=this.cameraXAxis==="Limit"?ht.clamp(this.euler.x,-this.maxPolarAngle+this.cameraPolarOffset+1e-6,-this.minPolarAngle+this.cameraPolarOffset-1e-6):ht.clamp(this.euler.x,-this.PI_2+this.cameraPolarOffset+1e-6,this.PI_2+this.cameraPolarOffset-1e-6);let i=jo.copy(this.cameraPolarAxis0);(this.cameraYAxis!=="Locked"||this.orientMode==="radial")&&i.applyQuaternion(t);let r=Ev.setFromAxisAngle(i,e);this.cameraYAxis!=="Locked"&&this.targetToCamera.applyQuaternion(t),this.cameraXAxis!=="Locked"&&this.targetToCamera.applyQuaternion(r)}groundTiltAdjustment(e){180*fc.angleTo(e)/Math.PI<15||180*fc.angleTo(e)/Math.PI>85?vh.identity():vh.setFromUnitVectors(fc,e),this.groundTilt.slerp(vh,.06),this.groundTiltInv.copy(this.groundTilt).invert()}collisionAdjustment(e){let t=T0e.set(0,0,0);this.object.matrix.compose(this.position,this.quaternion,this.scale);let i=uj.multiplyMatrices(this.object.matrix,this.objXZRotMat).multiply(this.collider.matrix).decompose(jo,vh,Vp).compose(jo,vh,E0e);this.sharedGameControlGlobals.entitiesWithTransformAnim.forEach(n=>{if(n===this.object||n.isDescendantOf(this.object)||!n.bvhGeometry||!n.bvhGeometry.boundsTree)return;lu.makeEmpty(),n.updateMatrixWorldRigid();let a=n.matrixWorldRigid,s=M0e.copy(a).invert(),o=j5e.copy(M0e).multiply(i);zs.copy(this.collider.segment),zs.start.applyMatrix4(o),zs.end.applyMatrix4(o);let l=S0e.copy(this.position).applyMatrix4(s);lu.expandByPoint(zs.start),lu.expandByPoint(zs.end),lu.min.addScalar(-this.collider.radius),lu.max.addScalar(this.collider.radius),n.bvhGeometry.boundsTree.shapecast({boundsTraverseOrder:h=>h.distanceToPoint(zs.end),intersectsBounds:h=>h.intersectsBox(lu),intersectsTriangle:h=>{let u=jo,d=Vp,c=h.closestPointToSegment(zs,u,d);if(c<this.collider.radius){let p=this.collider.radius-c,m=d.sub(u).normalize(),f=ub.copy(l);f.addScaledVector(m,p);let g=f.applyMatrix4(a).sub(this.position);t.add(g),zs.start.addScaledVector(m,p),zs.end.addScaledVector(m,p)}}})}),lu.makeEmpty(),zs.copy(this.collider.segment),zs.start.applyMatrix4(i),zs.end.applyMatrix4(i),lu.expandByPoint(zs.start),lu.expandByPoint(zs.end),lu.min.addScalar(-this.collider.radius),lu.max.addScalar(this.collider.radius),this.sharedGameControlGlobals.staticMeshBVH?.shapecast({boundsTraverseOrder:n=>n.distanceToPoint(zs.end),intersectsBounds:n=>n.intersectsBox(lu),intersectsTriangle:n=>{let a=jo,s=Vp,o=n.closestPointToSegment(zs,a,s);if(o<this.collider.radius){let l=this.collider.radius-o,h=s.sub(a).normalize();this.alignToGround&&this.groundTiltAdjustment(h),t.addScaledVector(h,l),zs.start.addScaledVector(h,l),zs.end.addScaledVector(h,l)}}}),this.onObject=Math.abs(t.y)>Math.abs(e*this.velocity.y*.25),this.onObject&&this.dispatchStopEvent("jump");let r=Math.max(0,t.length()-1e-5);t.normalize().multiplyScalar(r),this.position.add(t)}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()}},rAe=a$;rAe.isLocked=!1,le(),CA(),W4(),Ew(),Tw();var nAe,aAe,cj,Q5e=new Promise(e=>{nAe=e});function J5e(e){return cj||(cj=async function(){let t=e??"https://cdn.spline.design/@splinetool/runtime@2.0.13/build";typeof window<"u"&&(aAe=new URL(t.endsWith("/")?t:`${t}/`,window.location.href).href);let i=import("./navmesh.js"),[r,n]=await Promise.all([i,fetch(`${t}/navmesh.wasm`).then(o=>o.arrayBuffer())]),a=r.default,s=await a({wasmBinary:n});nAe(s)}(),cj)}kr();var sAe,fr,mo,eze=e=>`
|
|
12896
12896
|
(async function() {
|
|
12897
12897
|
const [wasmImport, wasmBinary] = await Promise.all([
|
|
12898
12898
|
import('${e}' + 'navmesh.js'),
|
|
@@ -12902,7 +12902,7 @@ void main() {
|
|
|
12902
12902
|
self.module = await wasmModule({ wasmBinary });
|
|
12903
12903
|
postMessage('ready');
|
|
12904
12904
|
})();
|
|
12905
|
-
`,tze={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};Q5e.then(e=>{sAe=e,fr=new e.Vec3,mo=new e.Vec3});var ize=new D,rze=class{constructor(e=!1,t=!1){this.usePhysics=e,this.isExport=t,this.onPointerDown=i=>{if(vi.length!==1)return;let{raycaster:r,page:n}=this.eventContext;this.eventContext.updateRaycaster(i);let a=n.raycastWithClones(r);if(a.length!==0){if(this.gameControl){let s=ize.copy(this.gameControl.colliderWorldPosition);s.y-=this.gameControl.colliderHeight/2,this.gameControl.path=this.computePath(s,a[0].point)}this.eventContext.requestRender()}},this.traverseWithPhysics=(i,r)=>n=>{let a;if(n instanceof Vg){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;a=n.object}else if(n instanceof Dh)a=n.object;else if(a=n,a.dataPatched.cloner?.disabled===!1&&a.dataPatched.cloner?.hideBase&&a.dataPatched.physics?.fusedBody!==!0)return!0;if(r&&!a.userData.navmesh)return;let s=a.dataPatched;if(!s.visible&&s.physics?.enabled!==!0)return!0;n.updateMatrixWorldRigid();let o=o4(s),l=a.userData.hasDestroy,h=a.userData.hasDrag,u=!1,d=!1;for(let c of s.events)c.data.disabled!==!0&&(c.data.type==="GameControl"?u=!0:c.data.type==="Follow"&&(d=!0));if(u||o||d||l||h)return!0;if(this.usePhysics&&s.physics?.rigidBody==="dynamic"){if(this.usePhysics&&s.physics?.fusedBody)return!0}else if("geometry"in n&&n.geometry&&i.push(am(n.geometry,n.matrixWorld)),this.usePhysics&&s.physics?.fusedBody)return n.traverseObject((c,p)=>{if(p===0)return;let m;if(c instanceof Vg){if(!c.objectForSample)return c.object.dataPatched.physics.fusedBody===!0&&c.object.dataPatched.physics.rigidBody==="dynamic"||void 0;if(c.objectForSample.dataPatched.physics.fusedBody)return;m=c.object}else if(c instanceof Dh)m=c.object;else if(m=c,c.dataPatched.cloner?.hideBase)return!0;let f=m.dataPatched;if(!f.visible&&f.physics?.enabled!==!0)return!0;"geometry"in c&&c.geometry&&i.push(am(c.geometry,c.matrixWorld))}),!0},this.traverseNoPhysics=(i,r)=>n=>{let a;if(n instanceof Vg)return;a=n instanceof Dh?n.object:n;let s=a.dataPatched;if(s.physics.enabled==="visibility"?!s.visible:!s.physics.enabled)return!0;if(r&&!a.userData.navmesh)return;let o=n.geometry,l=a.userData.hasDestroy===!0,h=a.userData.hasDrag===!0;if(o4(s)||l||h||a.dataPatched.events.some(u=>u.data.disabled!==!0&&u.data.type==="GameControl"))return!0;o&&i.push(am(o,n.matrixWorld))},this.navmeshWasm=sAe,this.navMesh=new this.navmeshWasm.NavMesh,this._workerURL=URL.createObjectURL(new Blob([(t?eze(aAe??"https://cdn.spline.design/@splinetool/runtime@2.0.
|
|
12905
|
+
`,tze={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};Q5e.then(e=>{sAe=e,fr=new e.Vec3,mo=new e.Vec3});var ize=new D,rze=class{constructor(e=!1,t=!1){this.usePhysics=e,this.isExport=t,this.onPointerDown=i=>{if(vi.length!==1)return;let{raycaster:r,page:n}=this.eventContext;this.eventContext.updateRaycaster(i);let a=n.raycastWithClones(r);if(a.length!==0){if(this.gameControl){let s=ize.copy(this.gameControl.colliderWorldPosition);s.y-=this.gameControl.colliderHeight/2,this.gameControl.path=this.computePath(s,a[0].point)}this.eventContext.requestRender()}},this.traverseWithPhysics=(i,r)=>n=>{let a;if(n instanceof Vg){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;a=n.object}else if(n instanceof Dh)a=n.object;else if(a=n,a.dataPatched.cloner?.disabled===!1&&a.dataPatched.cloner?.hideBase&&a.dataPatched.physics?.fusedBody!==!0)return!0;if(r&&!a.userData.navmesh)return;let s=a.dataPatched;if(!s.visible&&s.physics?.enabled!==!0)return!0;n.updateMatrixWorldRigid();let o=o4(s),l=a.userData.hasDestroy,h=a.userData.hasDrag,u=!1,d=!1;for(let c of s.events)c.data.disabled!==!0&&(c.data.type==="GameControl"?u=!0:c.data.type==="Follow"&&(d=!0));if(u||o||d||l||h)return!0;if(this.usePhysics&&s.physics?.rigidBody==="dynamic"){if(this.usePhysics&&s.physics?.fusedBody)return!0}else if("geometry"in n&&n.geometry&&i.push(am(n.geometry,n.matrixWorld)),this.usePhysics&&s.physics?.fusedBody)return n.traverseObject((c,p)=>{if(p===0)return;let m;if(c instanceof Vg){if(!c.objectForSample)return c.object.dataPatched.physics.fusedBody===!0&&c.object.dataPatched.physics.rigidBody==="dynamic"||void 0;if(c.objectForSample.dataPatched.physics.fusedBody)return;m=c.object}else if(c instanceof Dh)m=c.object;else if(m=c,c.dataPatched.cloner?.hideBase)return!0;let f=m.dataPatched;if(!f.visible&&f.physics?.enabled!==!0)return!0;"geometry"in c&&c.geometry&&i.push(am(c.geometry,c.matrixWorld))}),!0},this.traverseNoPhysics=(i,r)=>n=>{let a;if(n instanceof Vg)return;a=n instanceof Dh?n.object:n;let s=a.dataPatched;if(s.physics.enabled==="visibility"?!s.visible:!s.physics.enabled)return!0;if(r&&!a.userData.navmesh)return;let o=n.geometry,l=a.userData.hasDestroy===!0,h=a.userData.hasDrag===!0;if(o4(s)||l||h||a.dataPatched.events.some(u=>u.data.disabled!==!0&&u.data.type==="GameControl"))return!0;o&&i.push(am(o,n.matrixWorld))},this.navmeshWasm=sAe,this.navMesh=new this.navmeshWasm.NavMesh,this._workerURL=URL.createObjectURL(new Blob([(t?eze(aAe??"https://cdn.spline.design/@splinetool/runtime@2.0.13/build/"):`
|
|
12906
12906
|
(async function() {
|
|
12907
12907
|
const [wasmImport, wasmBinary] = await Promise.all([
|
|
12908
12908
|
import(self.location.origin + '/_libraries/navmesh.js'),
|
|
@@ -12979,7 +12979,7 @@ onmessage = function(messageEvent) {
|
|
|
12979
12979
|
[${tO}] { pointer-events: none; }
|
|
12980
12980
|
[${tO}] > * { pointer-events: auto; }
|
|
12981
12981
|
[${tO}] [data-spline-passthrough] { pointer-events: none; }
|
|
12982
|
-
`,zAe=class{constructor(e,t,i,r,n){this.container=e,this.host=t,this.observer=i,this.previousSplineGlobal=r,this.removeLateLifecycleShim=n}static mount(e,t,i,r){if(typeof document>"u")return null;let n=t.parentElement;if(!n)return null;getComputedStyle(n).position==="static"&&(n.style.position="relative");let a=document.createElement("div");a.setAttribute(tO,"");let s=a.style;s.position="absolute",s.overflow="hidden";let o=()=>{s.left=`${t.offsetLeft}px`,s.top=`${t.offsetTop}px`,s.width=`${t.offsetWidth}px`,s.height=`${t.offsetHeight}px`};o();let l=new ResizeObserver(o);l.observe(t),l.observe(n);let h=document.createElement("style");h.textContent=_ke,a.appendChild(h);let u=new DOMParser().parseFromString(i,"text/html"),d=Array.from(u.querySelectorAll("script"));for(let y of d)y.remove();for(let y of Array.from(u.head.children))(y.tagName==="STYLE"||y.tagName==="LINK"&&y.rel==="stylesheet")&&a.appendChild(y);for(;u.body.firstChild;)a.appendChild(u.body.firstChild);n.insertBefore(a,t.nextSibling);let c=new Map,p=new J$(UAe(e,t,r),(y,_)=>{y==="warn"?console.warn(`[spline html] ${_}`):y==="error"&&console.error(`[spline html] ${_}`)},(y,_)=>{let b=c.get(y);if(b)for(let x of b)try{x(_)}catch(w){console.error(w)}}),m=(y,_)=>{try{return Promise.resolve(p.execute(y,_))}catch(b){return Promise.reject(b)}},f={ready:Promise.resolve(),setVariable:(y,_)=>m("setVariable",[y,_]),setVariables:y=>m("setVariables",[y]),getVariable:y=>m("getVariable",[y]),getVariables:()=>m("getVariables",[]),getAllObjects:()=>m("getAllObjects",[]),findObjectByName:y=>m("findObjectByName",[y]),findObjectById:y=>m("findObjectById",[y]),getGeometry:(y,_)=>m("getGeometry",[y,_??{}]),updateObject:(y,_)=>m("updateObject",[y,_]),createObject:(y,_)=>m("createObject",[y,_??{}]),createCustomMaterial:y=>m("createCustomMaterial",[y]),setMaterial:(y,_)=>m("setMaterial",[y,_]),cloneObject:(y,_)=>m("cloneObject",[y,_??{}]),removeObject:y=>m("removeObject",[y]),spawnObject:(y,_)=>m("spawnObject",[y,_??{}]),destroyObject:y=>m("destroyObject",[y]),setInstanceTransforms:(y,_)=>m("setInstanceTransforms",[y,_??null]),emitEvent:(y,_)=>m("emitEvent",[y,_]),emitEventReverse:(y,_)=>m("emitEventReverse",[y,_]),requestRender:()=>m("requestRender",[]),addEventListener:(y,_)=>{if(typeof _!="function")return;let b=c.get(y);b||(b=new Set,c.set(y,b),m("listenEvent",[y])),b.add(_)},removeEventListener:(y,_)=>{let b=c.get(y);!b||(b.delete(_),b.size===0&&(c.delete(y),m("unlistenEvent",[y])))}},g=window.spline;window.spline=f;let v=function(){if(typeof document>"u"||document.readyState==="loading")return()=>{};let y=[],_=(x,w)=>{let S=new Set,M=x.addEventListener.bind(x),T=x.removeEventListener.bind(x);Object.defineProperty(x,"addEventListener",{configurable:!0,writable:!0,value:(A,E,C)=>{if(M(A,E,C),!w.includes(A)||E==null)return;let N={type:A,listener:E};S.add(N),queueMicrotask(()=>{!S.delete(N)||((P,I,L)=>{let B=new Event(L);try{typeof I=="function"?I.call(P,B):I.handleEvent?.(B)}catch(G){console.error(G)}})(x,N.listener,N.type)})}}),Object.defineProperty(x,"removeEventListener",{configurable:!0,writable:!0,value:(A,E,C)=>{T(A,E,C);for(let N of S)N.type===A&&N.listener===E&&S.delete(N)}}),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,a.appendChild(_)}return new zAe(a,p,l,g,v)}dispose(){this.removeLateLifecycleShim(),this.host.dispose(),this.observer.disconnect(),this.container.remove(),window.spline!==void 0&&(window.spline=this.previousSplineGlobal)}};function VAe(e){return typeof e=="object"&&e!==null&&e.isMaterial===!0}function Uve(e){if(typeof e.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(!VAe(e.material))return{options:e};let t=e.material;if(t.isNodeMaterial===!0){let i=OH()?.NodeMaterial;if(i!==void 0&&t instanceof i)return{options:{...e,material:void 0},material:t};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(t.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:{...e,material:void 0},material:t}}$t(),Nr(),le(),Mbe(),wu(),Nr(),$t(),ZIe(),Ym();var bke=new Set(["name","parent","position","rotation","scale","visible","castShadow","receiveShadow","color","material"]),Fve="'Cube', 'Sphere', 'Plane', 'Rectangle', 'Ellipse', 'Triangle', 'Polygon', 'Star', 'Cone', 'Cylinder', 'Pyramid', 'Torus', 'TorusKnot', 'Dodecahedron', 'Icosahedron', 'Helix', 'Backdrop', 'Lathe', 'Text', 'CustomMesh', 'Group', 'PointLight', 'SpotLight', 'DirectionalLight'",xke={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"},wke={group:"Empty",empty:"Empty",pointlight:"PointLight",spotlight:"SpotLight",directionallight:"DirectionalLight"},Ske={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')."},Tke={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"},Mke={Empty:"Group",PointLight:"Point Light",SpotLight:"Spot Light",DirectionalLight:"Directional Light"};function AA(e,t){return e===void 0?[t[0],t[1],t[2]]:Array.isArray(e)?[e[0]??t[0],e[1]??t[1],e[2]??t[2]]:[e.x??t[0],e.y??t[1],e.z??t[2]]}function kAe(e){return typeof e=="number"?[e,e,e]:AA(e,[1,1,1])}function C$(e){let t=new Fr(0,0,0,1);return t.setStyle(e),{r:t.r,g:t.g,b:t.b}}function zve(e,t){let i=e.material??(e.color!==void 0?{color:e.color}:void 0);if(i===void 0)return ra.defaultColorMaterial(Vve(eo),"physical","layer1","layer2");if(typeof i=="string"){for(let[s,o]of Object.entries(t.shared.materials))if(s===i||o.name===i)return s;if(function(s){let o=s.trim().toLowerCase();return/^#([0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(o)||/^(rgb|hsl)a?\(/.test(o)||ot.NAMES[o]!==void 0}(i))return ra.defaultColorMaterial(C$(i),"physical","layer1","layer2");throw new Error(`createObject: material '${i}' matches no shared material in this document (available: ${function(s){let o=Object.entries(s.shared.materials).map(([,l])=>`'${l.name}'`).filter(l=>l!=="'undefined'");return o.length?o.join(", "):"(none)"}(t)}) 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(VAe(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 r=i.color!==void 0?C$(i.color):Vve(eo),n=ra.defaultColorMaterial(r,"physical","layer1","layer2"),a=n.layers.find(s=>s.data.type==="light");if(a){let s={};i.roughness!==void 0&&(s.roughness=i.roughness),i.metalness!==void 0&&(s.metalness=i.metalness),i.reflectivity!==void 0&&(s.reflectivity=i.reflectivity),Object.assign(a.data,s)}if(i.alpha!==void 0){let s=n.layers.find(o=>o.data.type==="color");s&&Object.assign(s.data,{alpha:i.alpha})}return n}function Vve(e){return{r:(e>>16&255)/255,g:(e>>8&255)/255,b:(255&e)/255}}function Eke(e){let t=hm.defaultData("TextGeometry"),{text:i,...r}=e,n=r.fontSize;return n!==void 0&&r.width===void 0&&(r.width=350*n/16),n!==void 0&&r.height===void 0&&(r.height=50*n/16),Object.assign(t,r),i!==void 0&&Object.assign(t,{text:{textValue:String(i)}}),t}function FN(e){return Array.isArray(e)?e:!ArrayBuffer.isView(e)||e instanceof DataView?null:Array.from(e)}function Ake(e,t){return u_e({userData:{type:e,...NH[e].normalizeInputs({parameters:t})}})}function Cke(e,t,i){let{objectType:r,geometryType:n}=e,a=function(l){let h={};for(let[u,d]of Object.entries(l))!bke.has(u)&&d!==void 0&&(h[u]=d);return h}(t),s={states:new Nt,events:new Nt,timelineAnimations:new ti};if(r==="Mesh"&&n){if(n==="NonParametricGeometry"){let{geometry:l,doubleSide:h}=function(u){let d=FN(u.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 c=d.length/3;if(c>6e4)throw new Error(`createObject('CustomMesh'): too many vertices (${c}); keep it under 60000.`);let p=FN(u.indices);if(p&&p.length){let _=p.find(b=>!Number.isInteger(b)||b<0||b>=c);if(_!==void 0)throw new Error(`createObject('CustomMesh'): index ${_} is out of range (mesh has ${c} vertices).`)}else p=null;let m=new At;m.setAttribute("position",new Et(d,3));let f=FN(u.normals),g=f!==null&&f.length===d.length;g&&m.setAttribute("normal",new Et(f,3));let v=FN(u.uvs);v&&v.length===2*c&&m.setAttribute("uv",new Et(v,2));let y=!1;if(!g){let _=p??Array.from({length:c},(w,S)=>S),{closed:b,inverted:x}=function(w,S){let M=w.length/3,T=new Map,A=new Array(M);for(let P=0;P<M;P++){let I=`${Math.round(1e4*w[3*P])},${Math.round(1e4*w[3*P+1])},${Math.round(1e4*w[3*P+2])}`,L=T.get(I);L===void 0?(T.set(I,P),A[P]=P):A[P]=L}let E=new Map;for(let P=0;P+2<S.length;P+=3){let I=A[S[P]],L=A[S[P+1]],B=A[S[P+2]];for(let[G,j]of[[I,L],[L,B],[B,I]]){if(G===j)continue;let $=G<j?G+"_"+j:j+"_"+G;E.set($,(E.get($)??0)+1)}}let C=E.size>0;for(let P of E.values())if(P!==2){C=!1;break}if(!C)return{closed:!1,inverted:!1};let N=0;for(let P=0;P+2<S.length;P+=3){let I=3*S[P],L=3*S[P+1],B=3*S[P+2],G=w[I],j=w[I+1],$=w[I+2],H=w[L],te=w[L+1],ue=w[L+2],ae=w[B],de=w[B+1],ye=w[B+2];N+=G*(te*ye-ue*de)+j*(ue*ae-H*ye)+$*(H*de-te*ae)}return{closed:!0,inverted:N<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&&m.setIndex(p),g||m.computeVertexNormals(),{geometry:u_e({userData:{type:"NonParametricGeometry",parameters:{subdivisions:0}},data:m.toJSON().data}),doubleSide:y}}(a);Object.assign(s,bc.defaultData,{geometry:l,materials:[zve(t,i)]}),h&&(s.side=2)}else Object.assign(s,bc.defaultData,{geometry:n==="TextGeometry"?Eke(a):Ake(n,a),material:zve(t,i)});t.castShadow!==void 0&&(s.castShadow=t.castShadow),t.receiveShadow!==void 0&&(s.receiveShadow=t.receiveShadow)}else r==="Empty"?Object.assign(s,ZO.defaultData):(Object.assign(s,QO.defaultData(r),a),t.color!==void 0&&(s.color=C$(t.color)));s.visible=t.visible??!0,s.position=AA(t.position,[0,0,0]),s.rotation=AA(t.rotation,[0,0,0]),s.scale=kAe(t.scale);let o=(n&&Tke[n])??Mke[r]??r;return s.name=t.name??GAe(o,i.scene.objects),s}function GAe(e,t){let i=new Set;if(t.traverse((n,a)=>{i.add(a.name??"")}),!i.has(e))return e;let r=2;for(;i.has(`${e} ${r}`);)r++;return`${e} ${r}`}function jAe(e,t){let i=ht.generateUUID();if(e.data.type==="Component")return{data:{...xm.fromComponentData(e),name:e.data.name+" Instance"},id:i,fi:e.fi,children:[]};t[e.id]=i;let r=e.data;return r.type==="Empty"&&r.animations?.length&&(r={...r,animations:r.animations.map(([n,a,s])=>{let o=ht.generateUUID(),l=s.indexOf(n);return[o,a,l!==-1?s.slice(0,l)+o+s.slice(l+n.length):s]})}),{...e,id:i,data:r,children:e.children.map(n=>jAe(n,t))}}function Pke(e){let t={};return function(i,r){return xx(i,r,null)??i}(jAe(e,t),t)}function Rke(e){let t=Array.isArray(e)?e[0]:e,i=t.layers?.map(Dke)??[],r=t.layers?.find(n=>n.type==="light");return{layers:i,alpha:r?.node.alphaOverride?.value??1}}function Dke(e){return e.type==="texture"||e.type==="video"||e.type==="matcap"?{...e.data,updateTexture:t=>e.color.texture.image.updateSrc(t)}:{...e.data}}Ym(),sa(),DX(),wu();var nM=new Fr(0,0,0,1),Nke={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 Ike=new J;function kve(e){let t=new Fr(0,0,0,1);try{t.setStyle(e)}catch(i){console.error(i)}return t}var HAe=class{constructor(e,{renderOnDemand:t,renderMode:i="auto",wasmPath:r,renderer:n,htmlContentMode:a="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=s=>{if(this.time=s,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<p_e?this._skipRender=!1:this.currentTAAFrame=0):this.currentTAAFrame=0,this._scene?.traverseVisibleEntity(o=>{o.type==="ParticleSystem"&&(o.update(this.dt),this._skipRender=!1),t1(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=s=>{if(this._renderer){if(this._viewportMode===1&&this._frameView&&(this._frameView.frameSize=Ike.set(this._viewportWidth,this._viewportHeight)),s){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);if(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){let o=Object.values(this._data?.frames??{})[0].preset??"fullscreen";this._frameView?.setCamera(this._camera),this._frameView?.updateCamera(o!=="fullscreen"),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=iA(this._resize,10),this._onScroll=s=>{this.eventManager&&(this.eventManager.eventContext.domRect=this.canvas.getBoundingClientRect())},this.canvas=e,this._htmlContentMode=a,this.renderMode=t?"auto":i,r!==void 0&&(this._wasmPath=function(s){let o=s.length;for(;o>0&&"/".includes(s[o-1]);)o--;return s.slice(0,o)}(r)),this._rendererBackend=n??"webgl",n===void 0){let s=null;try{s=new URLSearchParams(window.location.search).get("renderer")}catch{}s==="webgpu"||s==="webgl"||s==="webgl2"?this._rendererBackend=s==="webgl2"?"webgl":s:(this._rendererAuto=!0,this._rendererBackend=typeof navigator<"u"&&"gpu"in navigator?"webgpu":"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(()=>(l4e(),gSe)).then(({Perfs:s})=>{this._perfs=new s({x:10,y:10})}),function(s){s.addEventListener("pointerdown",cJ,!0),s.addEventListener("pointerdown",kC,!0),s.addEventListener("pointermove",kC,!0),s.addEventListener("pointerup",k1,!0),s.addEventListener("pointercancel",k1,!0),s.addEventListener("pointerleave",k1,!0),window.addEventListener("keydown",pJ,!0),window.addEventListener("keyup",mJ,!0)}(e)}async _createRenderer(){if(this._rendererBackend==="webgpu"&&this._rendererAuto)try{await navigator.gpu?.requestAdapter()||(this._rendererBackend="webgl")}catch{this._rendererBackend="webgl"}if(this._rendererBackend==="webgpu")try{let{createWebGPUSplineRenderer:e,isWebGPUSupported:t}=await Promise.resolve().then(()=>(T9(),XI));t();let i=!0,r=!1,n=this._data?.scene.publish?.asyncShaderCompilation!==!1;try{let s=new URLSearchParams(window.location.search),o=s.get("bundles");o==="rerecord"?i="rerecord":(o==="off"||o==="0"||o==="false"||o==="no")&&(i=!1),r=s.get("forcegl")==="1";let l=s.get("asynccomp");l==="off"||l==="0"||l==="false"||l==="no"?n=!1:(l==="on"||l==="1"||l==="true"||l==="always")&&(n=!0)}catch{}let a=await e({canvas:this.canvas,antialias:!1,alpha:!0,powerPreference:"high-performance",sceneBundles:!r&&i,forceWebGL:r,asyncCompilation:!r&&n});return a.onBackgroundWorkReady=()=>{this._skipRender=!1,this._renderRequested=!0},a.skyAnimationAllowed=!0,a}catch(e){console.error("[spline] Failed to initialize the WebGPU renderer, falling back to WebGL:",e),this._rendererBackend="webgl"}{let{SplineRenderer:e,rendererGlobals:t}=await Promise.resolve().then(()=>(Pge(),Yq));try{new URLSearchParams(window.location.search).get("taa")==="off"&&(t.taaEnabled.value=!1)}catch{}return new e({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 e=window.devicePixelRatio||1,t=this.canvas.clientWidth||300,i=this.canvas.clientHeight||150;this.canvas.width=t*e,this.canvas.height=i*e;let r=this.canvas.getContext("2d");r&&(r.scale(e,e),r.fillStyle="rgba(127, 127, 127, 0.85)",r.font="13px system-ui, -apple-system, Segoe UI, Roboto, sans-serif",r.textAlign="center",r.textBaseline="middle",r.fillText("This scene requires a WebGPU-capable browser.",t/2,i/2))}catch{}this.canvas.dispatchEvent(new CustomEvent("splineerror",{bubbles:!0,detail:{reason:"webgpu-required"}}))}async load(e,t,i){(function(n){let a="The Spline Runtime only accepts .splinecode files that are generated from Spline export panel.";n.endsWith(".spline")?console.warn(a+" The .spline files are only meant to be used by the Editor."):n.endsWith(".splinecode")||console.warn(a)})(e),this.disposed=!1;let r=await(await fetch(e,i)).arrayBuffer();await this.start(r,{variables:t})}async start(e,{interactive:t=!0,variables:i}={}){if(this.disposed)return;Hg.init();let r=await async function(c){let[p,m]=yM(rA.deserialize(new Uint8Array(c)));if((p.schema??0)!==130){let{updateDocumentSchema:f}=await Promise.resolve().then(()=>(A4(),n_e));f(p)}return m.result().data}(e);this._data=r;let n=function(c){let p=[];return c.scene.objects.traverse((m,f)=>{f.type==="Mesh"&&f.geometry.type==="NonParametricGeometry"&&f.geometry.data.draco!==void 0&&p.push(f)}),p}(r);r.version&&(0,vke.default)(r.version,"2.0.11")>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(c){nW=c}(this._wasmPath));let a=async function(){}();await Promise.all([a,n.length&&Ove(this._wasmPath),pie(r)&&rOe(this._wasmPath),YOe(r)&&IOe(this._wasmPath),tw.physicsEnabled(r.scene.objects)&&U5e(this._wasmPath),xte(r)&&p0e(),Oie(r)&&vLe(),cOe(r)&&dOe(),a0e(r)&&a.then(()=>lH()?.loadHanaUIRUNTIME()),R5e(r)&&J5e(this._wasmPath)].filter(Boolean)),n.length&&await Lve(n),this._eventManager?.deactivate(),this._controls?.deactivate(),this._scene?.dispose();let s=r.scene.publish.renderer;if(this._rendererAuto&&s==="webgl")this._rendererBackend="webgl";else if(this._rendererAuto&&s==="webgpu"){if(this._rendererBackend!=="webgpu"||!await navigator.gpu?.requestAdapter().catch(()=>null))return void this._failWebGPURequired();this._rendererAuto=!1}let o=function(c){let p=new Set;return c.scene.objects.traverse((m,f)=>{if(f.type!=="Page")return;let g=f.postprocessing;if(g&&typeof g=="object"&&g.enabled===!0)for(let[v,y]of Object.entries(g))v!=="enabled"&&y&&typeof y=="object"&&y.enabled===!0&&p.add(v)}),[...p]}(r);if(this._rendererBackend==="webgpu")try{await Promise.all([Promise.resolve().then(()=>(T9(),XI)),gke(o)]),this._renderer||(this._renderer=await this._createRenderer())}catch(c){console.error("[spline] Failed to load the WebGPU material backend, using WebGL:",c),this._rendererBackend="webgl"}this._rendererBackend!=="webgpu"&&await Promise.all([Promise.resolve().then(()=>(Pge(),Yq)),fke(o)]),function(c){NA=c}(this._rendererBackend==="webgpu"?"webgpu":"webgl");let l=new hke(r);if(l.resetPersonalCameraFromDocumentData(),this._scene=l.scene,this._sharedAssetsManager=l.sharedAssets,this._camera=this._scene.activeCamera,window.location.search.includes("merge-geometries")){let{mergeStaticGeometries:c}=await Promise.resolve().then(()=>(pFe(),vEe)),p=performance.now();c(r,l.scene);let m=performance.now();console.log("Merged geometries in ",m-p," ms")}pie(r)&&this._scene.traverse(c=>{Vc(c)&&c.recomputeBoolean()}),this._sharedAssetsManager.setRequestRender(()=>{this._requestRenderAutoMode(),this._scene?.traverse(c=>{rx(c)&&c.pendingMediaLoad&&c.update({scene:this._scene,shared:this._sharedAssetsManager})})}),this._scene?.traverse(c=>{c.type==="ParticleSystem"&&(c.wakeUp(),c.data.autoPlay?c.start():c.stop()),t1(c)&&c.setPlayMode(!0)});let h=Object.keys(r.shared.fonts).map(c=>this._sharedAssetsManager.getFont(c).loadingPromise);if(Promise.all(h).then(()=>{this.disposed||(l.scene.markNeedsUpdateRendererDirty(),this._requestRenderAutoMode())}),xte(r)&&function(c){if(tw.physicsEnabled(c.scene.objects))return!0;let p=!1;return c.scene.objects.traverse((m,f)=>{if(f.events){if(Array.isArray(f.events)){for(let g of f.events)if(g.data.disabled!==!0&&g.data.type==="GameControl"&&g.data.collisionEnabled){p=!0;break}}else for(let g of Object.values(f.events))if(g.disabled!==!0&&g.type==="GameControl"&&g.collisionEnabled){p=!0;break}}}),p}(r)&&await Promise.all(h),a0e(r)){let c=[];this._scene.traverseEntity(p=>{(Xo(p)||p instanceof Ka)&&p.uiCanvas&&c.push(p.uiCanvas)}),await Promise.all(c.map(p=>p.promise))}if(this._scene.rewriteEventsBeforeGoToPlayMode(),fK(this._scene.activePage,this._sharedAssetsManager),this._renderer||(this._renderer=await this._createRenderer()),!this._rendererConfigured){this._rendererConfigured=!0,this._renderer.hdTransmission=r.scene.publish.hdTransmission===!0;let c=()=>/Mobi|Android|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),p=this._getPixelRatio(c()?r.scene.publish.settings.web.pixelRatioMobile:r.scene.publish.settings.web.pixelRatioDesktop);if(this._renderer.setPixelRatio(p),this._renderer.pipeline.enableUIOverlay(),this._renderer.pipeline.addEventListener("smaaloaded",this._requestRenderAutoMode),r.shared.images.SplineWatermark){let m=this._sharedAssetsManager.getImage("SplineWatermark");await m.loadPromise;let f=m.getTexture(1001);this._renderer.pipeline.setWatermark(f)}}Oie(r)&&this._scene.initializeSplatViewer(),r.scene.blueNoiseTextureData!==void 0&&this._renderer.pipeline.updateBlueNoiseTexture(r.scene.blueNoiseTextureData);let u=Object.values(r.frames)[0];if(this._frameView?this._frameView.setCamera(this._camera):(u.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=u.size[0],this._viewportHeight=u.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 XFe(this._renderer,this._camera,new J(this._viewportWidth,this._viewportHeight),new J(window.innerWidth,window.innerHeight)),this._frameView.enableResponsive=(u.allowResponsive??!1)&&u.preset==="fullscreen"),t){let c=new AFe(this._renderer,this.data.scene.publish,this._scene,()=>this._scene.activeCamera,this._sharedAssetsManager,this._requestRenderAutoMode,!0,u);this._scene.updateMatrixWorld(!0),this._controls=new k5e(c),this._animationControls=new cke(this._scene,this._requestRenderAutoMode),this._eventManager=new GFe(r.scene.publish,this._controls,this._animationControls,c,r.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),this._htmlContentOverlay?.dispose(),this._htmlContentOverlay=void 0;let d=r.scene.publish.htmlContent?.html;if(t&&d&&this._htmlContentMode!=="none"){let c={shared:this._sharedAssetsManager,findEntity:p=>this._scene?.getObjectByProperty("uuid",p)??this._scene?.getObjectByName(p)};this._htmlContentOverlay=(this._htmlContentMode==="inline"?zAe.mount(this,this.canvas,d,c):FAe.mount(this,this.canvas,d,c))??void 0}}setVariables(e){if(this._data!==void 0){let t=Object.entries(e);for(let[i,r]of t)this.setVariable(i,r)}}setVariable(e,t){let i=this._getVariableByName(e);if(i&&!("dynamicVariableType"in i.data)){let r=t;typeof i.data.value=="number"?r=typeof t=="number"?t:typeof t=="boolean"?t===!0?1:0:parseFloat(t):typeof i.data.value=="boolean"?r=typeof t=="number"?!!t:typeof t=="boolean"?t:t.toLocaleLowerCase()!=="false"&&!!t:typeof i.data.value!="string"&&i.data.value.textValue!==void 0&&(r=t.toString());let n=typeof r=="string"?{textValue:r}:r;this._sharedAssetsManager?.updateVariable(i.id,n),this.requestRender(),this._requestRenderAutoMode()}else i===void 0?console.warn(`No variable named ${e} was found in your Spline file. Make sure to create it from Spline editor.`):"dynamicVariableType"in i.data&&console.warn(`Dynamic variables like ${e} cannot be updated from code.`)}getVariables(){let e={};return this._data&&this._data.shared.variables.forEach(t=>{e[t.data.name]===void 0&&(e[t.data.name]=this._getVariableValue(this._sharedAssetsManager.getVariable(t.id)))}),e}getVariable(e){let t=this._getVariableByName(e);if(t){let i=this._sharedAssetsManager.getVariable(t.id);return this._getVariableValue(i)}}_getVariableValue(e){return typeof e!="string"&&Ao.isTextValue(e)?Ao.getDisplayedValue(e):e}_getVariableByName(e){if(this._data){if(this._variablesCache.has(e))return this._variablesCache.get(e);let t=this._data.shared.variables.find(i=>i.data.name===e);return t&&this._variablesCache.set(e,t),t}}_getPixelRatio(e){switch(e){case 0:return window.devicePixelRatio;case 1:return 1;case 2:return 2}}findObjectById(e){let t=this._scene?.getObjectByProperty("uuid",e);return this._createProxyObject(t)}findObjectByName(e){let t=this._scene?.getObjectByName(e);return this._createProxyObject(t)}getAllObjects(){let e=[];return this._scene?.traverseEntity(t=>{if(!(t.uuid===h1||this._scene.isInvisibleObjects(t)||t instanceof Ka)){let i=this._createProxyObject(t);i&&e.push(i)}}),e}getSplineEvents(){return(this._eventManager?.handlers?.Spline).splineEvents}emitEvent(e,t){(this.findObjectById(t)||this.findObjectByName(t))?.emitEvent(e)}emitEventReverse(e,t){(this.findObjectById(t)||this.findObjectByName(t))?.emitEventReverse(e)}addEventListener(e,t){this.canvas.addEventListener(e,t)}removeEventListener(e,t){this.canvas.removeEventListener(e,t)}setZoom(e){this._controls?.orbitControls instanceof IEe&&this._controls?.orbitControls.setZoom(e)}get eventManager(){return this._eventManager}get controls(){return this._controls}setSize(e,t){this._viewportWidth=e,this._viewportHeight=t,this._viewportMode=2,this._resize()}setBackgroundColor(e){let t=kve(e);this._scene?.activePage.setBackgroundColor(t),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,bE&&bE.disposeAll(),this._sharedAssetsManager?.setRequestRender(()=>{}),this._sharedAssetsManager?.dispose(),this._sharedAssetsManager=void 0,this._proxyObjectCache.forEach(e=>{V9.unsubscribe(e)}),this._proxyObjectCache.clear(),this._variablesCache.clear(),this._renderer?.pipeline.removeEventListener("smaaloaded",this._requestRenderAutoMode),this._renderer?.setAnimationLoop(null),this._renderer?.dispose(),this._renderer=void 0,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(e){e.removeEventListener("pointerdown",cJ,!0),e.removeEventListener("pointerdown",kC,!0),e.removeEventListener("pointermove",kC,!0),e.removeEventListener("pointerup",k1,!0),e.removeEventListener("pointercancel",k1,!0),e.removeEventListener("pointerleave",k1,!0),window.removeEventListener("keydown",pJ,!0),window.removeEventListener("keyup",mJ,!0)}(this.canvas),document.removeEventListener("scroll",this._onScroll),Hg.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(e){this._eventManager?.updateUseWindowEvents(e)}get data(){return this._data}_createProxyObject(e){if(!this._scene)return;let t,i=this._scene;if(e==null)return;if(this._proxyObjectCache.has(e.uuid))return this._proxyObjectCache.get(e.uuid);e.traverseAncestors(u=>{u instanceof Ka&&(t=u.name)});let r=this._sharedAssetsManager,n={shared:r,scene:this._scene},a=u=>{if(u===null||u==="Base State")return null;if(u&&e.data.states){let d=e.data.states.find(c=>c.data.name===u);return d?d.id:void 0}},s="material"in e?e.material:void 0,o=e.materialOverride,l={name:e.name,uuid:e.uuid,visible:e.visible,intensity:e.intensity,position:e.position,rotation:e.rotation,scale:e.scale,type:e.data.type,page:t,material:o??(s?Rke(s):void 0),parentUuid:e.parent instanceof Ka||e instanceof Og?void 0:e.parent?.uuid,emitEvent(u){e.dispatchEvent({type:"userEvent",eventName:u})},emitEventReverse(u){e.dispatchEvent({type:"userEvent",eventName:u,reverse:!0})},hide(){e.visible&&(e.visible=!1,n.shared.requestRender())},show(){e.visible||(e.visible=!0,n.shared.requestRender())},get state(){let u=e.stateSelection;if(u!==null)return e.data.states.find(({id:d})=>d===u)?.data.name},set state(u){let d;if(u!==void 0){let c=typeof u=="string"?e.data.states.find(({id:p})=>p===u):e.data.states[u];if(c)d=c.id;else{let p=typeof u=="string"?a(u):void 0;p&&(d=p)}}e.changeSelectedState(d??null,n),e.currentState=d??null,e.dispatchEvent({type:"completeState",state:d??null}),n.shared.requestRender()},transition(u){let d=LAe;if(d===null)return Ms("transitions","obj.transition()"),{transition(g){return this},play(){return this},pause(){return this},reset(){return this},seek(g){return this}};let c,p=this,m=Hg.timeline({autoplay:u.autoPlay??!0}),f={transition({from:g,to:v,duration:y,delay:_,...b}){let x=a(g);x===void 0&&(x=c);let w=a(v);c=w;let S=new d(e,x,w,{state:w,repeat:0,delay:_??0,delayDirection:"start-once",direction:"normal",duration:y??1e3,...b,...b.easing===6?zO.defaultData:b.easing===5?VO.defaultData:{}},r,!1,i.activePage);return m.add({...S.params,begin:()=>{(g&&x||g==="Base State"&&!x)&&(p.state=x??void 0)},complete:()=>{p.state=w??void 0}},m.duration),this},play(){return m.play(),this},pause(){return m.pause(),this},reset(){return m.reset(),this},seek(g){return m.seek(g),this}};return f.transition(u),f},set color(u){let d=kve(u);if(vL.is(e))return void(e.color=d);if(!(e.type==="Mesh"&&"material"in e&&e instanceof bl))return;let c={r:d.r,g:d.g,b:d.b,a:d.a},p=e.materialOverride;if(p!==void 0){let g=p.color;return void(g?.isColor===!0&&typeof g.setStyle=="function"&&(g.setStyle(u),n.shared.requestRender()))}let m=Array.isArray(e.material)?e.material[0]:e.material,f=m.data.layers.find(g=>g.data.type==="color")?.id;if(f)m.updateByOp({type:0,path:["layers",f],props:{color:{...c}}},m.data,n);else{let g=m.data,v=g.layers.find(S=>S.data.type==="light");if(!v)return;let y=g.layers.indexOf(v)===0?v:null,_=g.layers.at(y?g.layers.indexOf(y)+1:0),b={type:4,fi:y?y.fi+(_?(_.fi-y.fi)/2:1):_?_.fi/2:1,id:ht.generateUUID(),data:{...ha.defaultData("color"),color:c},localIndex:0},x=g.layers.insertAfterHelper(y?.id??null,1),w=g.layers.runOp({...b,fi:x[0]}).data;Object.assign(m.data,{layers:w}),m.updateByOp({...b,path:["layers"]},m.data,n)}}},h=V9(l,(u,d)=>{let c=e[u],p=function(m){return m.split(".")}(u);p[0]==="material"&&s&&o===void 0&&function(m,f,g){let v=Array.isArray(g)?g[0]:g;if(m[0]==="layers"){let y=parseInt(m[1]),_=v.layers[y],b=m[2];_&&b&&function(x,w,S){let M=x[0];try{if(function(T,A){return!!Nke[A]?.includes(T)}(M,S.type,x.slice(1)))if(M==="colors"){if(x.length<2)throw new Error("You cannot mutate the colors array, only its items");let T=parseInt(x[1]),A=S.getValue(M)?.[T];if(!A)throw new Error("Color index out of range");nM.setStyle(w),A.set(nM.r,nM.g,nM.b,nM.a)}else S.getValue(M)?.setStyle(w);else if(M==="texture"||M==="video"){let T=S.color;(function(A,E,C,N){let P=A[0];if(P==="repeat"||P==="offset"||P==="rotation"){let I=N.getNode("mat"),L=I&&typeof I.updateMatrix=="function"?I:N.getValue("mat");if(!L)return;if(P==="rotation")L.rotation=parseFloat(E);else{let B=A[1];if(B===void 0)E instanceof Array&&E.length===2&&Object.assign(L,{[P]:E});else{let G=L[P],j=parseInt(B)===0?[parseFloat(E),G[1]]:[G[0],parseFloat(E)];Object.assign(L,{[P]:j})}}L.updateMatrix()}else P==="wrapping"||P==="minFilter"||P==="magFilter"?P==="wrapping"?C.texture.wrap=E:C.texture[P]=E:P==="image"&&A[1]==="data"&&C.texture.image.updateSrc(E)})(x.slice(1),w,T,S)}else{let T=x[1],A=S.getValue(M);A?.isVector3&&T!==void 0||A?.isVector2&&T!==void 0?A.setComponent(parseInt(T),w):S.setValue(M,w)}}catch(T){console.error("Error setting material value",T)}}(m.slice(2),f,_)}else m[0]==="alpha"&&v.layers.forEach(y=>{y.type==="light"&&y.node.alphaOverride!==void 0&&(y.node.alphaOverride.value=f,f<1&&(v.transparent=!0))})}(p.slice(1),d,s),typeof c!="object"&&Object.getOwnPropertyDescriptor(e,u)?.writable&&(e[u]=d),this._requestRenderAutoMode(),e.updateMatrix()});return this._proxyObjectCache.set(e.uuid,h),h}setUIWasmUrl(e){(function(t){sL=t,P4?.setHanaUIWasmUrl(t)})(e)}pauseGameControls(){this._eventManager?.controlsManager.gameControl?.pause()}resumeGameControls(){this._eventManager?.controlsManager.gameControl?.resume()}async swapGeometry(e,t){let i;if(typeof t=="string"){if(!t.endsWith(".splinegeometry"))throw new Error("Only .splinegeometry format is supported");{let l=await(await fetch(t)).arrayBuffer();i=new Uint8Array(l)}}else i=t;let r=rA.deserialize(i),n="data"in r&&r.data.draco!==void 0;n&&await Ove(this._wasmPath);let a=this._scene?.getObjectByProperty("uuid",e)??this._scene?.getObjectByName(e);if(!a)return void console.warn(`Object ${e} not found`);if(a.data.type!=="Mesh"||!(a instanceof bl))return void console.warn(`Object ${e} is not a mesh`);let s=a,o={...s.data,geometry:r};n&&await Lve([o]),s.updateByOp({type:0,path:[],props:{geometry:o.geometry}},o,{shared:this._sharedAssetsManager,scene:this._scene},!1);for(let l of s.data.states){let h={...l.data};s.states||(s.states={}),s.states[l.id]=Rg.patch(o,h)}return i}_applyDocumentTransaction(e){this._data=e.data,this._scene&&(this._scene.data=this._data.scene),this._sharedAssetsManager&&(this._sharedAssetsManager.data=this._data.shared);for(let t of e.actual){let i=t.path;Array.isArray(i)&&i.length===2&&i[0]==="scene"&&i[1]==="objects"&&this._scene?.updateTreeByOp({...t,path:[]},this._sharedAssetsManager)}}_findEntity(e){return this._scene?.getObjectByProperty("uuid",e)??this._scene?.getObjectByName(e)}_resolveParentId(e){if(e===void 0)return this._scene.activePage.uuid;let t=typeof e=="string"?e:e.uuid,i=this._findEntity(t);if(!i)throw new Error(`parent '${t}' \u2014 no object with that name or uuid in the scene.`);return i.uuid}async createCustomMaterial(e){if(this.disposed)throw new Error("createCustomMaterial: this Application was disposed.");if(typeof e!="function")throw new Error("createCustomMaterial: expected a factory function \u2014 createCustomMaterial((three) => new three.MeshStandardNodeMaterial()).");let t=OH();if(t===void 0&&(this._rendererBackend==="webgpu"&&(await Promise.resolve().then(()=>(T9(),XI)),t=OH()),t===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=e(t);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(e,t){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 r=typeof e=="string"?e:e.uuid,n=this._findEntity(r);if(!n)throw new Error(`setMaterial: '${r}' \u2014 no object with that name or uuid in the scene.`);if(!(n instanceof bl))throw new Error(`setMaterial: '${r}' is not a mesh \u2014 lights, groups, and cameras have no material.`);let a=typeof t=="function"?await this.createCustomMaterial(t):t;if(fL()!=="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 s=Uve({material:a});if(s.material===void 0)throw new Error("setMaterial: expected a three.js material instance or a (three) => material factory.");return n.setMaterialOverride(s.material,{scene:i,shared:this._sharedAssetsManager}),this._proxyObjectCache.delete(n.uuid),this._requestRenderAutoMode(),s.material}async createObject(e,t={}){if(this.disposed)throw new Error("createObject: this Application was disposed.");let i=this._scene,r=this._data;if(!i||!r)throw new Error("createObject: no scene loaded \u2014 call load() or start() first.");let n=function(g){if(typeof g!="string"||g.length===0)throw new Error(`createObject: expected a type name string \u2014 one of ${Fve}.`);let v=g.replace(/Geometry$/i,"").replace(/[\s_-]/g,"").toLowerCase(),y=wke[v];if(y)return{objectType:y};let _=xke[v];if(_)return{objectType:"Mesh",geometryType:_};let b=Ske[v];throw b?new Error(`createObject: '${g}' is not supported \u2014 ${b}`):new Error(`createObject: '${g}' is not a creatable Spline type \u2014 use one of ${Fve}, e.g. createObject('Cube', { width: 200 }).`)}(e);typeof t.material=="function"&&(t={...t,material:await this.createCustomMaterial(t.material)});let a,s,{options:o,material:l}=Uve(t);if(l!==void 0){if(n.objectType!=="Mesh")throw new Error("createObject: a three.js material instance only applies to mesh types \u2014 lights and groups have no material.");if(fL()!=="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(n.geometryType==="TextGeometry"){if(!wX.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 p0e(),s=t.font??Nb,r.shared.fonts[s]===void 0){if(s!==Nb){let g=Object.keys(r.shared.fonts).join(", ");throw new Error(`createObject: font '${s}' is not in this document \u2014 available fonts: ${g||"(none)"}.`)}a={name:Nb,url:G1e}}}let h=this._resolveParentId(t.parent),u=Cke(n,o,r),d=ht.generateUUID(),[c,p]=yM(r);a&&(c.shared.fonts[Nb]=a),c.scene.objects.insertAfter(h,null,[{id:d,data:u,children:[]}]);let m=p.result();if(a&&this._sharedAssetsManager.addFont(Nb,a),s!==void 0){let g=this._sharedAssetsManager.getFont(s);g&&await g.loadingPromise}this._applyDocumentTransaction(m);let f=i.find(d);return l!==void 0&&f.setMaterialOverride(l,{scene:i,shared:this._sharedAssetsManager}),this._requestRenderAutoMode(),this._createProxyObject(f)}cloneObject(e,t={}){if(this.disposed)throw new Error("cloneObject: this Application was disposed.");let i=this._scene,r=this._data;if(!i||!r)throw new Error("cloneObject: no scene loaded \u2014 call load() or start() first.");let n=typeof e=="string"?e:e?.uuid,a=n?this._findEntity(n):void 0;if(!a)throw new Error(`cloneObject: '${n}' \u2014 no object with that name or uuid in the scene.`);if(a instanceof Ka)throw new Error("cloneObject: pages cannot be cloned.");let s=r.scene.objects.get(a.uuid);if(!s)throw new Error(`cloneObject: '${n}' 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,m,f){let g={...p.data};return m.position!==void 0&&(g.position=AA(m.position,[0,0,0])),m.rotation!==void 0&&(g.rotation=AA(m.rotation,[0,0,0])),m.scale!==void 0&&(g.scale=kAe(m.scale)),m.visible!==void 0&&(g.visible=m.visible),g.name=m.name??GAe(`${p.data.name??"Object"} Copy`,f),{...p,data:g}}(Pke(s),t,r.scene.objects),l=t.parent!==void 0?this._resolveParentId(t.parent):r.scene.objects.parent(a.uuid)??null,h=t.parent!==void 0?null:a.uuid,[u,d]=yM(r);u.scene.objects.insertAfter(l,h,[o]),this._applyDocumentTransaction(d.result());let c=i.find(o.id);return this._requestRenderAutoMode(),this._createProxyObject(c)}removeObject(e){let t=this._scene,i=this._data;if(this.disposed||!t||!i)return!1;let r=typeof e=="string"?e:e?.uuid,n=r?this._findEntity(r):void 0;if(!n)return!1;if(n instanceof Ka)throw new Error("removeObject: pages cannot be removed.");if(n.data.type==="PerspectiveCamera"||n.data.type==="OrthographicCamera")throw new Error("removeObject: cameras cannot be removed.");if(i.scene.objects.get(n.uuid)===void 0)throw new Error(`removeObject: '${r}' is not part of the document tree (expanded clones and instanced children cannot be removed individually).`);let a=[];n.traverseEntity(l=>{a.push(l.uuid)});let[s,o]=yM(i);s.scene.objects.delete(n.uuid),this._applyDocumentTransaction(o.result());for(let l of a){let h=this._proxyObjectCache.get(l);h&&(V9.unsubscribe(h),this._proxyObjectCache.delete(l))}return this._requestRenderAutoMode(),!0}};var vB=window,yB=vB.ShadowRoot&&(vB.ShadyCSS===void 0||vB.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,TK=Symbol(),WAe=new WeakMap,jA=class{constructor(t,i,r){if(this._$cssResult$=!0,r!==TK)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=i}get styleSheet(){let t=this.o,i=this.t;if(yB&&t===void 0){let r=i!==void 0&&i.length===1;r&&(t=WAe.get(i)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),r&&WAe.set(i,t))}return t}toString(){return this.cssText}},qAe=e=>new jA(typeof e=="string"?e:e+"",void 0,TK),MK=(e,...t)=>{let i=e.length===1?e[0]:t.reduce((r,n,a)=>r+(s=>{if(s._$cssResult$===!0)return s.cssText;if(typeof s=="number")return s;throw Error("Value passed to 'css' function must be a 'css' function result: "+s+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(n)+e[a+1],e[0]);return new jA(i,e,TK)},EK=(e,t)=>{yB?e.adoptedStyleSheets=t.map(i=>i instanceof CSSStyleSheet?i:i.styleSheet):t.forEach(i=>{let r=document.createElement("style"),n=vB.litNonce;n!==void 0&&r.setAttribute("nonce",n),r.textContent=i.cssText,e.appendChild(r)})},_B=yB?e=>e:e=>e instanceof CSSStyleSheet?(t=>{let i="";for(let r of t.cssRules)i+=r.cssText;return qAe(i)})(e):e;var AK,bB=window,$Ae=bB.trustedTypes,Oke=$Ae?$Ae.emptyScript:"",XAe=bB.reactiveElementPolyfillSupport,PK={toAttribute(e,t){switch(t){case Boolean:e=e?Oke:null;break;case Object:case Array:e=e==null?e:JSON.stringify(e)}return e},fromAttribute(e,t){let i=e;switch(t){case Boolean:i=e!==null;break;case Number:i=e===null?null:Number(e);break;case Object:case Array:try{i=JSON.parse(e)}catch{i=null}}return i}},YAe=(e,t)=>t!==e&&(t==t||e==e),CK={attribute:!0,type:String,converter:PK,reflect:!1,hasChanged:YAe},RK="finalized",Jm=class extends HTMLElement{constructor(){super(),this._$Ei=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$El=null,this._$Eu()}static addInitializer(t){var i;this.finalize(),((i=this.h)!==null&&i!==void 0?i:this.h=[]).push(t)}static get observedAttributes(){this.finalize();let t=[];return this.elementProperties.forEach((i,r)=>{let n=this._$Ep(r,i);n!==void 0&&(this._$Ev.set(n,r),t.push(n))}),t}static createProperty(t,i=CK){if(i.state&&(i.attribute=!1),this.finalize(),this.elementProperties.set(t,i),!i.noAccessor&&!this.prototype.hasOwnProperty(t)){let r=typeof t=="symbol"?Symbol():"__"+t,n=this.getPropertyDescriptor(t,r,i);n!==void 0&&Object.defineProperty(this.prototype,t,n)}}static getPropertyDescriptor(t,i,r){return{get(){return this[i]},set(n){let a=this[t];this[i]=n,this.requestUpdate(t,a,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)||CK}static finalize(){if(this.hasOwnProperty(RK))return!1;this[RK]=!0;let t=Object.getPrototypeOf(this);if(t.finalize(),t.h!==void 0&&(this.h=[...t.h]),this.elementProperties=new Map(t.elementProperties),this._$Ev=new Map,this.hasOwnProperty("properties")){let i=this.properties,r=[...Object.getOwnPropertyNames(i),...Object.getOwnPropertySymbols(i)];for(let n of r)this.createProperty(n,i[n])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(t){let i=[];if(Array.isArray(t)){let r=new Set(t.flat(1/0).reverse());for(let n of r)i.unshift(_B(n))}else t!==void 0&&i.push(_B(t));return i}static _$Ep(t,i){let r=i.attribute;return r===!1?void 0:typeof r=="string"?r:typeof t=="string"?t.toLowerCase():void 0}_$Eu(){var t;this._$E_=new Promise(i=>this.enableUpdating=i),this._$AL=new Map,this._$Eg(),this.requestUpdate(),(t=this.constructor.h)===null||t===void 0||t.forEach(i=>i(this))}addController(t){var i,r;((i=this._$ES)!==null&&i!==void 0?i:this._$ES=[]).push(t),this.renderRoot!==void 0&&this.isConnected&&((r=t.hostConnected)===null||r===void 0||r.call(t))}removeController(t){var i;(i=this._$ES)===null||i===void 0||i.splice(this._$ES.indexOf(t)>>>0,1)}_$Eg(){this.constructor.elementProperties.forEach((t,i)=>{this.hasOwnProperty(i)&&(this._$Ei.set(i,this[i]),delete this[i])})}createRenderRoot(){var t;let i=(t=this.shadowRoot)!==null&&t!==void 0?t:this.attachShadow(this.constructor.shadowRootOptions);return EK(i,this.constructor.elementStyles),i}connectedCallback(){var t;this.renderRoot===void 0&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(t=this._$ES)===null||t===void 0||t.forEach(i=>{var r;return(r=i.hostConnected)===null||r===void 0?void 0:r.call(i)})}enableUpdating(t){}disconnectedCallback(){var t;(t=this._$ES)===null||t===void 0||t.forEach(i=>{var r;return(r=i.hostDisconnected)===null||r===void 0?void 0:r.call(i)})}attributeChangedCallback(t,i,r){this._$AK(t,r)}_$EO(t,i,r=CK){var n;let a=this.constructor._$Ep(t,r);if(a!==void 0&&r.reflect===!0){let s=(((n=r.converter)===null||n===void 0?void 0:n.toAttribute)!==void 0?r.converter:PK).toAttribute(i,r.type);this._$El=t,s==null?this.removeAttribute(a):this.setAttribute(a,s),this._$El=null}}_$AK(t,i){var r;let n=this.constructor,a=n._$Ev.get(t);if(a!==void 0&&this._$El!==a){let s=n.getPropertyOptions(a),o=typeof s.converter=="function"?{fromAttribute:s.converter}:((r=s.converter)===null||r===void 0?void 0:r.fromAttribute)!==void 0?s.converter:PK;this._$El=a,this[a]=o.fromAttribute(i,s.type),this._$El=null}}requestUpdate(t,i,r){let n=!0;t!==void 0&&(((r=r||this.constructor.getPropertyOptions(t)).hasChanged||YAe)(this[t],i)?(this._$AL.has(t)||this._$AL.set(t,i),r.reflect===!0&&this._$El!==t&&(this._$EC===void 0&&(this._$EC=new Map),this._$EC.set(t,r))):n=!1),!this.isUpdatePending&&n&&(this._$E_=this._$Ej())}async _$Ej(){this.isUpdatePending=!0;try{await this._$E_}catch(i){Promise.reject(i)}let t=this.scheduleUpdate();return t!=null&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var t;if(!this.isUpdatePending)return;this.hasUpdated,this._$Ei&&(this._$Ei.forEach((n,a)=>this[a]=n),this._$Ei=void 0);let i=!1,r=this._$AL;try{i=this.shouldUpdate(r),i?(this.willUpdate(r),(t=this._$ES)===null||t===void 0||t.forEach(n=>{var a;return(a=n.hostUpdate)===null||a===void 0?void 0:a.call(n)}),this.update(r)):this._$Ek()}catch(n){throw i=!1,this._$Ek(),n}i&&this._$AE(r)}willUpdate(t){}_$AE(t){var i;(i=this._$ES)===null||i===void 0||i.forEach(r=>{var n;return(n=r.hostUpdated)===null||n===void 0?void 0:n.call(r)}),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$Ek(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$E_}shouldUpdate(t){return!0}update(t){this._$EC!==void 0&&(this._$EC.forEach((i,r)=>this._$EO(r,this[r],i)),this._$EC=void 0),this._$Ek()}updated(t){}firstUpdated(t){}};Jm[RK]=!0,Jm.elementProperties=new Map,Jm.elementStyles=[],Jm.shadowRootOptions={mode:"open"},XAe?.({ReactiveElement:Jm}),((AK=bB.reactiveElementVersions)!==null&&AK!==void 0?AK:bB.reactiveElementVersions=[]).push("1.6.3");var DK,xB=window,Lw=xB.trustedTypes,KAe=Lw?Lw.createPolicy("lit-html",{createHTML:e=>e}):void 0,IK="$lit$",o0=`lit$${(Math.random()+"").slice(9)}$`,rCe="?"+o0,Lke=`<${rCe}>`,g1=document,WA=()=>g1.createComment(""),qA=e=>e===null||typeof e!="object"&&typeof e!="function",nCe=Array.isArray,Bke=e=>nCe(e)||typeof e?.[Symbol.iterator]=="function",NK=`[
|
|
12982
|
+
`,zAe=class{constructor(e,t,i,r,n){this.container=e,this.host=t,this.observer=i,this.previousSplineGlobal=r,this.removeLateLifecycleShim=n}static mount(e,t,i,r){if(typeof document>"u")return null;let n=t.parentElement;if(!n)return null;getComputedStyle(n).position==="static"&&(n.style.position="relative");let a=document.createElement("div");a.setAttribute(tO,"");let s=a.style;s.position="absolute",s.overflow="hidden";let o=()=>{s.left=`${t.offsetLeft}px`,s.top=`${t.offsetTop}px`,s.width=`${t.offsetWidth}px`,s.height=`${t.offsetHeight}px`};o();let l=new ResizeObserver(o);l.observe(t),l.observe(n);let h=document.createElement("style");h.textContent=_ke,a.appendChild(h);let u=new DOMParser().parseFromString(i,"text/html"),d=Array.from(u.querySelectorAll("script"));for(let y of d)y.remove();for(let y of Array.from(u.head.children))(y.tagName==="STYLE"||y.tagName==="LINK"&&y.rel==="stylesheet")&&a.appendChild(y);for(;u.body.firstChild;)a.appendChild(u.body.firstChild);n.insertBefore(a,t.nextSibling);let c=new Map,p=new J$(UAe(e,t,r),(y,_)=>{y==="warn"?console.warn(`[spline html] ${_}`):y==="error"&&console.error(`[spline html] ${_}`)},(y,_)=>{let b=c.get(y);if(b)for(let x of b)try{x(_)}catch(w){console.error(w)}}),m=(y,_)=>{try{return Promise.resolve(p.execute(y,_))}catch(b){return Promise.reject(b)}},f={ready:Promise.resolve(),setVariable:(y,_)=>m("setVariable",[y,_]),setVariables:y=>m("setVariables",[y]),getVariable:y=>m("getVariable",[y]),getVariables:()=>m("getVariables",[]),getAllObjects:()=>m("getAllObjects",[]),findObjectByName:y=>m("findObjectByName",[y]),findObjectById:y=>m("findObjectById",[y]),getGeometry:(y,_)=>m("getGeometry",[y,_??{}]),updateObject:(y,_)=>m("updateObject",[y,_]),createObject:(y,_)=>m("createObject",[y,_??{}]),createCustomMaterial:y=>m("createCustomMaterial",[y]),setMaterial:(y,_)=>m("setMaterial",[y,_]),cloneObject:(y,_)=>m("cloneObject",[y,_??{}]),removeObject:y=>m("removeObject",[y]),spawnObject:(y,_)=>m("spawnObject",[y,_??{}]),destroyObject:y=>m("destroyObject",[y]),setInstanceTransforms:(y,_)=>m("setInstanceTransforms",[y,_??null]),emitEvent:(y,_)=>m("emitEvent",[y,_]),emitEventReverse:(y,_)=>m("emitEventReverse",[y,_]),requestRender:()=>m("requestRender",[]),addEventListener:(y,_)=>{if(typeof _!="function")return;let b=c.get(y);b||(b=new Set,c.set(y,b),m("listenEvent",[y])),b.add(_)},removeEventListener:(y,_)=>{let b=c.get(y);!b||(b.delete(_),b.size===0&&(c.delete(y),m("unlistenEvent",[y])))}},g=window.spline;window.spline=f;let v=function(){if(typeof document>"u"||document.readyState==="loading")return()=>{};let y=[],_=(x,w)=>{let S=new Set,M=x.addEventListener.bind(x),T=x.removeEventListener.bind(x);Object.defineProperty(x,"addEventListener",{configurable:!0,writable:!0,value:(A,E,C)=>{if(M(A,E,C),!w.includes(A)||E==null)return;let N={type:A,listener:E};S.add(N),queueMicrotask(()=>{!S.delete(N)||((P,I,L)=>{let B=new Event(L);try{typeof I=="function"?I.call(P,B):I.handleEvent?.(B)}catch(G){console.error(G)}})(x,N.listener,N.type)})}}),Object.defineProperty(x,"removeEventListener",{configurable:!0,writable:!0,value:(A,E,C)=>{T(A,E,C);for(let N of S)N.type===A&&N.listener===E&&S.delete(N)}}),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,a.appendChild(_)}return new zAe(a,p,l,g,v)}dispose(){this.removeLateLifecycleShim(),this.host.dispose(),this.observer.disconnect(),this.container.remove(),window.spline!==void 0&&(window.spline=this.previousSplineGlobal)}};function VAe(e){return typeof e=="object"&&e!==null&&e.isMaterial===!0}function Uve(e){if(typeof e.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(!VAe(e.material))return{options:e};let t=e.material;if(t.isNodeMaterial===!0){let i=OH()?.NodeMaterial;if(i!==void 0&&t instanceof i)return{options:{...e,material:void 0},material:t};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(t.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:{...e,material:void 0},material:t}}$t(),Nr(),le(),Mbe(),wu(),Nr(),$t(),ZIe(),Ym();var bke=new Set(["name","parent","position","rotation","scale","visible","castShadow","receiveShadow","color","material"]),Fve="'Cube', 'Sphere', 'Plane', 'Rectangle', 'Ellipse', 'Triangle', 'Polygon', 'Star', 'Cone', 'Cylinder', 'Pyramid', 'Torus', 'TorusKnot', 'Dodecahedron', 'Icosahedron', 'Helix', 'Backdrop', 'Lathe', 'Text', 'CustomMesh', 'Group', 'PointLight', 'SpotLight', 'DirectionalLight'",xke={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"},wke={group:"Empty",empty:"Empty",pointlight:"PointLight",spotlight:"SpotLight",directionallight:"DirectionalLight"},Ske={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')."},Tke={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"},Mke={Empty:"Group",PointLight:"Point Light",SpotLight:"Spot Light",DirectionalLight:"Directional Light"};function AA(e,t){return e===void 0?[t[0],t[1],t[2]]:Array.isArray(e)?[e[0]??t[0],e[1]??t[1],e[2]??t[2]]:[e.x??t[0],e.y??t[1],e.z??t[2]]}function kAe(e){return typeof e=="number"?[e,e,e]:AA(e,[1,1,1])}function C$(e){let t=new Fr(0,0,0,1);return t.setStyle(e),{r:t.r,g:t.g,b:t.b}}function zve(e,t){let i=e.material??(e.color!==void 0?{color:e.color}:void 0);if(i===void 0)return ra.defaultColorMaterial(Vve(eo),"physical","layer1","layer2");if(typeof i=="string"){for(let[s,o]of Object.entries(t.shared.materials))if(s===i||o.name===i)return s;if(function(s){let o=s.trim().toLowerCase();return/^#([0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(o)||/^(rgb|hsl)a?\(/.test(o)||ot.NAMES[o]!==void 0}(i))return ra.defaultColorMaterial(C$(i),"physical","layer1","layer2");throw new Error(`createObject: material '${i}' matches no shared material in this document (available: ${function(s){let o=Object.entries(s.shared.materials).map(([,l])=>`'${l.name}'`).filter(l=>l!=="'undefined'");return o.length?o.join(", "):"(none)"}(t)}) 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(VAe(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 r=i.color!==void 0?C$(i.color):Vve(eo),n=ra.defaultColorMaterial(r,"physical","layer1","layer2"),a=n.layers.find(s=>s.data.type==="light");if(a){let s={};i.roughness!==void 0&&(s.roughness=i.roughness),i.metalness!==void 0&&(s.metalness=i.metalness),i.reflectivity!==void 0&&(s.reflectivity=i.reflectivity),Object.assign(a.data,s)}if(i.alpha!==void 0){let s=n.layers.find(o=>o.data.type==="color");s&&Object.assign(s.data,{alpha:i.alpha})}return n}function Vve(e){return{r:(e>>16&255)/255,g:(e>>8&255)/255,b:(255&e)/255}}function Eke(e){let t=hm.defaultData("TextGeometry"),{text:i,...r}=e,n=r.fontSize;return n!==void 0&&r.width===void 0&&(r.width=350*n/16),n!==void 0&&r.height===void 0&&(r.height=50*n/16),Object.assign(t,r),i!==void 0&&Object.assign(t,{text:{textValue:String(i)}}),t}function FN(e){return Array.isArray(e)?e:!ArrayBuffer.isView(e)||e instanceof DataView?null:Array.from(e)}function Ake(e,t){return u_e({userData:{type:e,...NH[e].normalizeInputs({parameters:t})}})}function Cke(e,t,i){let{objectType:r,geometryType:n}=e,a=function(l){let h={};for(let[u,d]of Object.entries(l))!bke.has(u)&&d!==void 0&&(h[u]=d);return h}(t),s={states:new Nt,events:new Nt,timelineAnimations:new ti};if(r==="Mesh"&&n){if(n==="NonParametricGeometry"){let{geometry:l,doubleSide:h}=function(u){let d=FN(u.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 c=d.length/3;if(c>6e4)throw new Error(`createObject('CustomMesh'): too many vertices (${c}); keep it under 60000.`);let p=FN(u.indices);if(p&&p.length){let _=p.find(b=>!Number.isInteger(b)||b<0||b>=c);if(_!==void 0)throw new Error(`createObject('CustomMesh'): index ${_} is out of range (mesh has ${c} vertices).`)}else p=null;let m=new At;m.setAttribute("position",new Et(d,3));let f=FN(u.normals),g=f!==null&&f.length===d.length;g&&m.setAttribute("normal",new Et(f,3));let v=FN(u.uvs);v&&v.length===2*c&&m.setAttribute("uv",new Et(v,2));let y=!1;if(!g){let _=p??Array.from({length:c},(w,S)=>S),{closed:b,inverted:x}=function(w,S){let M=w.length/3,T=new Map,A=new Array(M);for(let P=0;P<M;P++){let I=`${Math.round(1e4*w[3*P])},${Math.round(1e4*w[3*P+1])},${Math.round(1e4*w[3*P+2])}`,L=T.get(I);L===void 0?(T.set(I,P),A[P]=P):A[P]=L}let E=new Map;for(let P=0;P+2<S.length;P+=3){let I=A[S[P]],L=A[S[P+1]],B=A[S[P+2]];for(let[G,j]of[[I,L],[L,B],[B,I]]){if(G===j)continue;let $=G<j?G+"_"+j:j+"_"+G;E.set($,(E.get($)??0)+1)}}let C=E.size>0;for(let P of E.values())if(P!==2){C=!1;break}if(!C)return{closed:!1,inverted:!1};let N=0;for(let P=0;P+2<S.length;P+=3){let I=3*S[P],L=3*S[P+1],B=3*S[P+2],G=w[I],j=w[I+1],$=w[I+2],H=w[L],te=w[L+1],ue=w[L+2],ae=w[B],de=w[B+1],ye=w[B+2];N+=G*(te*ye-ue*de)+j*(ue*ae-H*ye)+$*(H*de-te*ae)}return{closed:!0,inverted:N<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&&m.setIndex(p),g||m.computeVertexNormals(),{geometry:u_e({userData:{type:"NonParametricGeometry",parameters:{subdivisions:0}},data:m.toJSON().data}),doubleSide:y}}(a);Object.assign(s,bc.defaultData,{geometry:l,materials:[zve(t,i)]}),h&&(s.side=2)}else Object.assign(s,bc.defaultData,{geometry:n==="TextGeometry"?Eke(a):Ake(n,a),material:zve(t,i)});t.castShadow!==void 0&&(s.castShadow=t.castShadow),t.receiveShadow!==void 0&&(s.receiveShadow=t.receiveShadow)}else r==="Empty"?Object.assign(s,ZO.defaultData):(Object.assign(s,QO.defaultData(r),a),t.color!==void 0&&(s.color=C$(t.color)));s.visible=t.visible??!0,s.position=AA(t.position,[0,0,0]),s.rotation=AA(t.rotation,[0,0,0]),s.scale=kAe(t.scale);let o=(n&&Tke[n])??Mke[r]??r;return s.name=t.name??GAe(o,i.scene.objects),s}function GAe(e,t){let i=new Set;if(t.traverse((n,a)=>{i.add(a.name??"")}),!i.has(e))return e;let r=2;for(;i.has(`${e} ${r}`);)r++;return`${e} ${r}`}function jAe(e,t){let i=ht.generateUUID();if(e.data.type==="Component")return{data:{...xm.fromComponentData(e),name:e.data.name+" Instance"},id:i,fi:e.fi,children:[]};t[e.id]=i;let r=e.data;return r.type==="Empty"&&r.animations?.length&&(r={...r,animations:r.animations.map(([n,a,s])=>{let o=ht.generateUUID(),l=s.indexOf(n);return[o,a,l!==-1?s.slice(0,l)+o+s.slice(l+n.length):s]})}),{...e,id:i,data:r,children:e.children.map(n=>jAe(n,t))}}function Pke(e){let t={};return function(i,r){return xx(i,r,null)??i}(jAe(e,t),t)}function Rke(e){let t=Array.isArray(e)?e[0]:e,i=t.layers?.map(Dke)??[],r=t.layers?.find(n=>n.type==="light");return{layers:i,alpha:r?.node.alphaOverride?.value??1}}function Dke(e){return e.type==="texture"||e.type==="video"||e.type==="matcap"?{...e.data,updateTexture:t=>e.color.texture.image.updateSrc(t)}:{...e.data}}Ym(),sa(),DX(),wu();var nM=new Fr(0,0,0,1),Nke={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 Ike=new J;function kve(e){let t=new Fr(0,0,0,1);try{t.setStyle(e)}catch(i){console.error(i)}return t}var HAe=class{constructor(e,{renderOnDemand:t,renderMode:i="auto",wasmPath:r,renderer:n,htmlContentMode:a="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=s=>{if(this.time=s,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<p_e?this._skipRender=!1:this.currentTAAFrame=0):this.currentTAAFrame=0,this._scene?.traverseVisibleEntity(o=>{o.type==="ParticleSystem"&&(o.update(this.dt),this._skipRender=!1),t1(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=s=>{if(this._renderer){if(this._viewportMode===1&&this._frameView&&(this._frameView.frameSize=Ike.set(this._viewportWidth,this._viewportHeight)),s){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);if(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){let o=Object.values(this._data?.frames??{})[0].preset??"fullscreen";this._frameView?.setCamera(this._camera),this._frameView?.updateCamera(o!=="fullscreen"),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=iA(this._resize,10),this._onScroll=s=>{this.eventManager&&(this.eventManager.eventContext.domRect=this.canvas.getBoundingClientRect())},this.canvas=e,this._htmlContentMode=a,this.renderMode=t?"auto":i,r!==void 0&&(this._wasmPath=function(s){let o=s.length;for(;o>0&&"/".includes(s[o-1]);)o--;return s.slice(0,o)}(r)),this._rendererBackend=n??"webgl",n===void 0){let s=null;try{s=new URLSearchParams(window.location.search).get("renderer")}catch{}s==="webgpu"||s==="webgl"||s==="webgl2"?this._rendererBackend=s==="webgl2"?"webgl":s:(this._rendererAuto=!0,this._rendererBackend=typeof navigator<"u"&&"gpu"in navigator?"webgpu":"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(()=>(l4e(),gSe)).then(({Perfs:s})=>{this._perfs=new s({x:10,y:10})}),function(s){s.addEventListener("pointerdown",cJ,!0),s.addEventListener("pointerdown",kC,!0),s.addEventListener("pointermove",kC,!0),s.addEventListener("pointerup",k1,!0),s.addEventListener("pointercancel",k1,!0),s.addEventListener("pointerleave",k1,!0),window.addEventListener("keydown",pJ,!0),window.addEventListener("keyup",mJ,!0)}(e)}async _createRenderer(){if(this._rendererBackend==="webgpu"&&this._rendererAuto)try{await navigator.gpu?.requestAdapter()||(this._rendererBackend="webgl")}catch{this._rendererBackend="webgl"}if(this._rendererBackend==="webgpu")try{let{createWebGPUSplineRenderer:e,isWebGPUSupported:t}=await Promise.resolve().then(()=>(T9(),XI));t();let i=!0,r=!1,n=this._data?.scene.publish?.asyncShaderCompilation!==!1;try{let s=new URLSearchParams(window.location.search),o=s.get("bundles");o==="rerecord"?i="rerecord":(o==="off"||o==="0"||o==="false"||o==="no")&&(i=!1),r=s.get("forcegl")==="1";let l=s.get("asynccomp");l==="off"||l==="0"||l==="false"||l==="no"?n=!1:(l==="on"||l==="1"||l==="true"||l==="always")&&(n=!0)}catch{}let a=await e({canvas:this.canvas,antialias:!1,alpha:!0,powerPreference:"high-performance",sceneBundles:!r&&i,forceWebGL:r,asyncCompilation:!r&&n});return a.onBackgroundWorkReady=()=>{this._skipRender=!1,this._renderRequested=!0},a.skyAnimationAllowed=!0,a}catch(e){console.error("[spline] Failed to initialize the WebGPU renderer, falling back to WebGL:",e),this._rendererBackend="webgl"}{let{SplineRenderer:e,rendererGlobals:t}=await Promise.resolve().then(()=>(Pge(),Yq));try{new URLSearchParams(window.location.search).get("taa")==="off"&&(t.taaEnabled.value=!1)}catch{}return new e({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 e=window.devicePixelRatio||1,t=this.canvas.clientWidth||300,i=this.canvas.clientHeight||150;this.canvas.width=t*e,this.canvas.height=i*e;let r=this.canvas.getContext("2d");r&&(r.scale(e,e),r.fillStyle="rgba(127, 127, 127, 0.85)",r.font="13px system-ui, -apple-system, Segoe UI, Roboto, sans-serif",r.textAlign="center",r.textBaseline="middle",r.fillText("This scene requires a WebGPU-capable browser.",t/2,i/2))}catch{}this.canvas.dispatchEvent(new CustomEvent("splineerror",{bubbles:!0,detail:{reason:"webgpu-required"}}))}async load(e,t,i){(function(n){let a="The Spline Runtime only accepts .splinecode files that are generated from Spline export panel.";n.endsWith(".spline")?console.warn(a+" The .spline files are only meant to be used by the Editor."):n.endsWith(".splinecode")||console.warn(a)})(e),this.disposed=!1;let r=await(await fetch(e,i)).arrayBuffer();await this.start(r,{variables:t})}async start(e,{interactive:t=!0,variables:i}={}){if(this.disposed)return;Hg.init();let r=await async function(c){let[p,m]=yM(rA.deserialize(new Uint8Array(c)));if((p.schema??0)!==130){let{updateDocumentSchema:f}=await Promise.resolve().then(()=>(A4(),n_e));f(p)}return m.result().data}(e);this._data=r;let n=function(c){let p=[];return c.scene.objects.traverse((m,f)=>{f.type==="Mesh"&&f.geometry.type==="NonParametricGeometry"&&f.geometry.data.draco!==void 0&&p.push(f)}),p}(r);r.version&&(0,vke.default)(r.version,"2.0.13")>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(c){nW=c}(this._wasmPath));let a=async function(){}();await Promise.all([a,n.length&&Ove(this._wasmPath),pie(r)&&rOe(this._wasmPath),YOe(r)&&IOe(this._wasmPath),tw.physicsEnabled(r.scene.objects)&&U5e(this._wasmPath),xte(r)&&p0e(),Oie(r)&&vLe(),cOe(r)&&dOe(),a0e(r)&&a.then(()=>lH()?.loadHanaUIRUNTIME()),R5e(r)&&J5e(this._wasmPath)].filter(Boolean)),n.length&&await Lve(n),this._eventManager?.deactivate(),this._controls?.deactivate(),this._scene?.dispose();let s=r.scene.publish.renderer;if(this._rendererAuto&&s==="webgl")this._rendererBackend="webgl";else if(this._rendererAuto&&s==="webgpu"){if(this._rendererBackend!=="webgpu"||!await navigator.gpu?.requestAdapter().catch(()=>null))return void this._failWebGPURequired();this._rendererAuto=!1}let o=function(c){let p=new Set;return c.scene.objects.traverse((m,f)=>{if(f.type!=="Page")return;let g=f.postprocessing;if(g&&typeof g=="object"&&g.enabled===!0)for(let[v,y]of Object.entries(g))v!=="enabled"&&y&&typeof y=="object"&&y.enabled===!0&&p.add(v)}),[...p]}(r);if(this._rendererBackend==="webgpu")try{await Promise.all([Promise.resolve().then(()=>(T9(),XI)),gke(o)]),this._renderer||(this._renderer=await this._createRenderer())}catch(c){console.error("[spline] Failed to load the WebGPU material backend, using WebGL:",c),this._rendererBackend="webgl"}this._rendererBackend!=="webgpu"&&await Promise.all([Promise.resolve().then(()=>(Pge(),Yq)),fke(o)]),function(c){NA=c}(this._rendererBackend==="webgpu"?"webgpu":"webgl");let l=new hke(r);if(l.resetPersonalCameraFromDocumentData(),this._scene=l.scene,this._sharedAssetsManager=l.sharedAssets,this._camera=this._scene.activeCamera,window.location.search.includes("merge-geometries")){let{mergeStaticGeometries:c}=await Promise.resolve().then(()=>(pFe(),vEe)),p=performance.now();c(r,l.scene);let m=performance.now();console.log("Merged geometries in ",m-p," ms")}pie(r)&&this._scene.traverse(c=>{Vc(c)&&c.recomputeBoolean()}),this._sharedAssetsManager.setRequestRender(()=>{this._requestRenderAutoMode(),this._scene?.traverse(c=>{rx(c)&&c.pendingMediaLoad&&c.update({scene:this._scene,shared:this._sharedAssetsManager})})}),this._scene?.traverse(c=>{c.type==="ParticleSystem"&&(c.wakeUp(),c.data.autoPlay?c.start():c.stop()),t1(c)&&c.setPlayMode(!0)});let h=Object.keys(r.shared.fonts).map(c=>this._sharedAssetsManager.getFont(c).loadingPromise);if(Promise.all(h).then(()=>{this.disposed||(l.scene.markNeedsUpdateRendererDirty(),this._requestRenderAutoMode())}),xte(r)&&function(c){if(tw.physicsEnabled(c.scene.objects))return!0;let p=!1;return c.scene.objects.traverse((m,f)=>{if(f.events){if(Array.isArray(f.events)){for(let g of f.events)if(g.data.disabled!==!0&&g.data.type==="GameControl"&&g.data.collisionEnabled){p=!0;break}}else for(let g of Object.values(f.events))if(g.disabled!==!0&&g.type==="GameControl"&&g.collisionEnabled){p=!0;break}}}),p}(r)&&await Promise.all(h),a0e(r)){let c=[];this._scene.traverseEntity(p=>{(Xo(p)||p instanceof Ka)&&p.uiCanvas&&c.push(p.uiCanvas)}),await Promise.all(c.map(p=>p.promise))}if(this._scene.rewriteEventsBeforeGoToPlayMode(),fK(this._scene.activePage,this._sharedAssetsManager),this._renderer||(this._renderer=await this._createRenderer()),!this._rendererConfigured){this._rendererConfigured=!0,this._renderer.hdTransmission=r.scene.publish.hdTransmission===!0;let c=()=>/Mobi|Android|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),p=this._getPixelRatio(c()?r.scene.publish.settings.web.pixelRatioMobile:r.scene.publish.settings.web.pixelRatioDesktop);if(this._renderer.setPixelRatio(p),this._renderer.pipeline.enableUIOverlay(),this._renderer.pipeline.addEventListener("smaaloaded",this._requestRenderAutoMode),r.shared.images.SplineWatermark){let m=this._sharedAssetsManager.getImage("SplineWatermark");await m.loadPromise;let f=m.getTexture(1001);this._renderer.pipeline.setWatermark(f)}}Oie(r)&&this._scene.initializeSplatViewer(),r.scene.blueNoiseTextureData!==void 0&&this._renderer.pipeline.updateBlueNoiseTexture(r.scene.blueNoiseTextureData);let u=Object.values(r.frames)[0];if(this._frameView?this._frameView.setCamera(this._camera):(u.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=u.size[0],this._viewportHeight=u.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 XFe(this._renderer,this._camera,new J(this._viewportWidth,this._viewportHeight),new J(window.innerWidth,window.innerHeight)),this._frameView.enableResponsive=(u.allowResponsive??!1)&&u.preset==="fullscreen"),t){let c=new AFe(this._renderer,this.data.scene.publish,this._scene,()=>this._scene.activeCamera,this._sharedAssetsManager,this._requestRenderAutoMode,!0,u);this._scene.updateMatrixWorld(!0),this._controls=new k5e(c),this._animationControls=new cke(this._scene,this._requestRenderAutoMode),this._eventManager=new GFe(r.scene.publish,this._controls,this._animationControls,c,r.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),this._htmlContentOverlay?.dispose(),this._htmlContentOverlay=void 0;let d=r.scene.publish.htmlContent?.html;if(t&&d&&this._htmlContentMode!=="none"){let c={shared:this._sharedAssetsManager,findEntity:p=>this._scene?.getObjectByProperty("uuid",p)??this._scene?.getObjectByName(p)};this._htmlContentOverlay=(this._htmlContentMode==="inline"?zAe.mount(this,this.canvas,d,c):FAe.mount(this,this.canvas,d,c))??void 0}}setVariables(e){if(this._data!==void 0){let t=Object.entries(e);for(let[i,r]of t)this.setVariable(i,r)}}setVariable(e,t){let i=this._getVariableByName(e);if(i&&!("dynamicVariableType"in i.data)){let r=t;typeof i.data.value=="number"?r=typeof t=="number"?t:typeof t=="boolean"?t===!0?1:0:parseFloat(t):typeof i.data.value=="boolean"?r=typeof t=="number"?!!t:typeof t=="boolean"?t:t.toLocaleLowerCase()!=="false"&&!!t:typeof i.data.value!="string"&&i.data.value.textValue!==void 0&&(r=t.toString());let n=typeof r=="string"?{textValue:r}:r;this._sharedAssetsManager?.updateVariable(i.id,n),this.requestRender(),this._requestRenderAutoMode()}else i===void 0?console.warn(`No variable named ${e} was found in your Spline file. Make sure to create it from Spline editor.`):"dynamicVariableType"in i.data&&console.warn(`Dynamic variables like ${e} cannot be updated from code.`)}getVariables(){let e={};return this._data&&this._data.shared.variables.forEach(t=>{e[t.data.name]===void 0&&(e[t.data.name]=this._getVariableValue(this._sharedAssetsManager.getVariable(t.id)))}),e}getVariable(e){let t=this._getVariableByName(e);if(t){let i=this._sharedAssetsManager.getVariable(t.id);return this._getVariableValue(i)}}_getVariableValue(e){return typeof e!="string"&&Ao.isTextValue(e)?Ao.getDisplayedValue(e):e}_getVariableByName(e){if(this._data){if(this._variablesCache.has(e))return this._variablesCache.get(e);let t=this._data.shared.variables.find(i=>i.data.name===e);return t&&this._variablesCache.set(e,t),t}}_getPixelRatio(e){switch(e){case 0:return window.devicePixelRatio;case 1:return 1;case 2:return 2}}findObjectById(e){let t=this._scene?.getObjectByProperty("uuid",e);return this._createProxyObject(t)}findObjectByName(e){let t=this._scene?.getObjectByName(e);return this._createProxyObject(t)}getAllObjects(){let e=[];return this._scene?.traverseEntity(t=>{if(!(t.uuid===h1||this._scene.isInvisibleObjects(t)||t instanceof Ka)){let i=this._createProxyObject(t);i&&e.push(i)}}),e}getSplineEvents(){return(this._eventManager?.handlers?.Spline).splineEvents}emitEvent(e,t){(this.findObjectById(t)||this.findObjectByName(t))?.emitEvent(e)}emitEventReverse(e,t){(this.findObjectById(t)||this.findObjectByName(t))?.emitEventReverse(e)}addEventListener(e,t){this.canvas.addEventListener(e,t)}removeEventListener(e,t){this.canvas.removeEventListener(e,t)}setZoom(e){this._controls?.orbitControls instanceof IEe&&this._controls?.orbitControls.setZoom(e)}get eventManager(){return this._eventManager}get controls(){return this._controls}setSize(e,t){this._viewportWidth=e,this._viewportHeight=t,this._viewportMode=2,this._resize()}setBackgroundColor(e){let t=kve(e);this._scene?.activePage.setBackgroundColor(t),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,bE&&bE.disposeAll(),this._sharedAssetsManager?.setRequestRender(()=>{}),this._sharedAssetsManager?.dispose(),this._sharedAssetsManager=void 0,this._proxyObjectCache.forEach(e=>{V9.unsubscribe(e)}),this._proxyObjectCache.clear(),this._variablesCache.clear(),this._renderer?.pipeline.removeEventListener("smaaloaded",this._requestRenderAutoMode),this._renderer?.setAnimationLoop(null),this._renderer?.dispose(),this._renderer=void 0,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(e){e.removeEventListener("pointerdown",cJ,!0),e.removeEventListener("pointerdown",kC,!0),e.removeEventListener("pointermove",kC,!0),e.removeEventListener("pointerup",k1,!0),e.removeEventListener("pointercancel",k1,!0),e.removeEventListener("pointerleave",k1,!0),window.removeEventListener("keydown",pJ,!0),window.removeEventListener("keyup",mJ,!0)}(this.canvas),document.removeEventListener("scroll",this._onScroll),Hg.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(e){this._eventManager?.updateUseWindowEvents(e)}get data(){return this._data}_createProxyObject(e){if(!this._scene)return;let t,i=this._scene;if(e==null)return;if(this._proxyObjectCache.has(e.uuid))return this._proxyObjectCache.get(e.uuid);e.traverseAncestors(u=>{u instanceof Ka&&(t=u.name)});let r=this._sharedAssetsManager,n={shared:r,scene:this._scene},a=u=>{if(u===null||u==="Base State")return null;if(u&&e.data.states){let d=e.data.states.find(c=>c.data.name===u);return d?d.id:void 0}},s="material"in e?e.material:void 0,o=e.materialOverride,l={name:e.name,uuid:e.uuid,visible:e.visible,intensity:e.intensity,position:e.position,rotation:e.rotation,scale:e.scale,type:e.data.type,page:t,material:o??(s?Rke(s):void 0),parentUuid:e.parent instanceof Ka||e instanceof Og?void 0:e.parent?.uuid,emitEvent(u){e.dispatchEvent({type:"userEvent",eventName:u})},emitEventReverse(u){e.dispatchEvent({type:"userEvent",eventName:u,reverse:!0})},hide(){e.visible&&(e.visible=!1,n.shared.requestRender())},show(){e.visible||(e.visible=!0,n.shared.requestRender())},get state(){let u=e.stateSelection;if(u!==null)return e.data.states.find(({id:d})=>d===u)?.data.name},set state(u){let d;if(u!==void 0){let c=typeof u=="string"?e.data.states.find(({id:p})=>p===u):e.data.states[u];if(c)d=c.id;else{let p=typeof u=="string"?a(u):void 0;p&&(d=p)}}e.changeSelectedState(d??null,n),e.currentState=d??null,e.dispatchEvent({type:"completeState",state:d??null}),n.shared.requestRender()},transition(u){let d=LAe;if(d===null)return Ms("transitions","obj.transition()"),{transition(g){return this},play(){return this},pause(){return this},reset(){return this},seek(g){return this}};let c,p=this,m=Hg.timeline({autoplay:u.autoPlay??!0}),f={transition({from:g,to:v,duration:y,delay:_,...b}){let x=a(g);x===void 0&&(x=c);let w=a(v);c=w;let S=new d(e,x,w,{state:w,repeat:0,delay:_??0,delayDirection:"start-once",direction:"normal",duration:y??1e3,...b,...b.easing===6?zO.defaultData:b.easing===5?VO.defaultData:{}},r,!1,i.activePage);return m.add({...S.params,begin:()=>{(g&&x||g==="Base State"&&!x)&&(p.state=x??void 0)},complete:()=>{p.state=w??void 0}},m.duration),this},play(){return m.play(),this},pause(){return m.pause(),this},reset(){return m.reset(),this},seek(g){return m.seek(g),this}};return f.transition(u),f},set color(u){let d=kve(u);if(vL.is(e))return void(e.color=d);if(!(e.type==="Mesh"&&"material"in e&&e instanceof bl))return;let c={r:d.r,g:d.g,b:d.b,a:d.a},p=e.materialOverride;if(p!==void 0){let g=p.color;return void(g?.isColor===!0&&typeof g.setStyle=="function"&&(g.setStyle(u),n.shared.requestRender()))}let m=Array.isArray(e.material)?e.material[0]:e.material,f=m.data.layers.find(g=>g.data.type==="color")?.id;if(f)m.updateByOp({type:0,path:["layers",f],props:{color:{...c}}},m.data,n);else{let g=m.data,v=g.layers.find(S=>S.data.type==="light");if(!v)return;let y=g.layers.indexOf(v)===0?v:null,_=g.layers.at(y?g.layers.indexOf(y)+1:0),b={type:4,fi:y?y.fi+(_?(_.fi-y.fi)/2:1):_?_.fi/2:1,id:ht.generateUUID(),data:{...ha.defaultData("color"),color:c},localIndex:0},x=g.layers.insertAfterHelper(y?.id??null,1),w=g.layers.runOp({...b,fi:x[0]}).data;Object.assign(m.data,{layers:w}),m.updateByOp({...b,path:["layers"]},m.data,n)}}},h=V9(l,(u,d)=>{let c=e[u],p=function(m){return m.split(".")}(u);p[0]==="material"&&s&&o===void 0&&function(m,f,g){let v=Array.isArray(g)?g[0]:g;if(m[0]==="layers"){let y=parseInt(m[1]),_=v.layers[y],b=m[2];_&&b&&function(x,w,S){let M=x[0];try{if(function(T,A){return!!Nke[A]?.includes(T)}(M,S.type,x.slice(1)))if(M==="colors"){if(x.length<2)throw new Error("You cannot mutate the colors array, only its items");let T=parseInt(x[1]),A=S.getValue(M)?.[T];if(!A)throw new Error("Color index out of range");nM.setStyle(w),A.set(nM.r,nM.g,nM.b,nM.a)}else S.getValue(M)?.setStyle(w);else if(M==="texture"||M==="video"){let T=S.color;(function(A,E,C,N){let P=A[0];if(P==="repeat"||P==="offset"||P==="rotation"){let I=N.getNode("mat"),L=I&&typeof I.updateMatrix=="function"?I:N.getValue("mat");if(!L)return;if(P==="rotation")L.rotation=parseFloat(E);else{let B=A[1];if(B===void 0)E instanceof Array&&E.length===2&&Object.assign(L,{[P]:E});else{let G=L[P],j=parseInt(B)===0?[parseFloat(E),G[1]]:[G[0],parseFloat(E)];Object.assign(L,{[P]:j})}}L.updateMatrix()}else P==="wrapping"||P==="minFilter"||P==="magFilter"?P==="wrapping"?C.texture.wrap=E:C.texture[P]=E:P==="image"&&A[1]==="data"&&C.texture.image.updateSrc(E)})(x.slice(1),w,T,S)}else{let T=x[1],A=S.getValue(M);A?.isVector3&&T!==void 0||A?.isVector2&&T!==void 0?A.setComponent(parseInt(T),w):S.setValue(M,w)}}catch(T){console.error("Error setting material value",T)}}(m.slice(2),f,_)}else m[0]==="alpha"&&v.layers.forEach(y=>{y.type==="light"&&y.node.alphaOverride!==void 0&&(y.node.alphaOverride.value=f,f<1&&(v.transparent=!0))})}(p.slice(1),d,s),typeof c!="object"&&Object.getOwnPropertyDescriptor(e,u)?.writable&&(e[u]=d),this._requestRenderAutoMode(),e.updateMatrix()});return this._proxyObjectCache.set(e.uuid,h),h}setUIWasmUrl(e){(function(t){sL=t,P4?.setHanaUIWasmUrl(t)})(e)}pauseGameControls(){this._eventManager?.controlsManager.gameControl?.pause()}resumeGameControls(){this._eventManager?.controlsManager.gameControl?.resume()}async swapGeometry(e,t){let i;if(typeof t=="string"){if(!t.endsWith(".splinegeometry"))throw new Error("Only .splinegeometry format is supported");{let l=await(await fetch(t)).arrayBuffer();i=new Uint8Array(l)}}else i=t;let r=rA.deserialize(i),n="data"in r&&r.data.draco!==void 0;n&&await Ove(this._wasmPath);let a=this._scene?.getObjectByProperty("uuid",e)??this._scene?.getObjectByName(e);if(!a)return void console.warn(`Object ${e} not found`);if(a.data.type!=="Mesh"||!(a instanceof bl))return void console.warn(`Object ${e} is not a mesh`);let s=a,o={...s.data,geometry:r};n&&await Lve([o]),s.updateByOp({type:0,path:[],props:{geometry:o.geometry}},o,{shared:this._sharedAssetsManager,scene:this._scene},!1);for(let l of s.data.states){let h={...l.data};s.states||(s.states={}),s.states[l.id]=Rg.patch(o,h)}return i}_applyDocumentTransaction(e){this._data=e.data,this._scene&&(this._scene.data=this._data.scene),this._sharedAssetsManager&&(this._sharedAssetsManager.data=this._data.shared);for(let t of e.actual){let i=t.path;Array.isArray(i)&&i.length===2&&i[0]==="scene"&&i[1]==="objects"&&this._scene?.updateTreeByOp({...t,path:[]},this._sharedAssetsManager)}}_findEntity(e){return this._scene?.getObjectByProperty("uuid",e)??this._scene?.getObjectByName(e)}_resolveParentId(e){if(e===void 0)return this._scene.activePage.uuid;let t=typeof e=="string"?e:e.uuid,i=this._findEntity(t);if(!i)throw new Error(`parent '${t}' \u2014 no object with that name or uuid in the scene.`);return i.uuid}async createCustomMaterial(e){if(this.disposed)throw new Error("createCustomMaterial: this Application was disposed.");if(typeof e!="function")throw new Error("createCustomMaterial: expected a factory function \u2014 createCustomMaterial((three) => new three.MeshStandardNodeMaterial()).");let t=OH();if(t===void 0&&(this._rendererBackend==="webgpu"&&(await Promise.resolve().then(()=>(T9(),XI)),t=OH()),t===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=e(t);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(e,t){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 r=typeof e=="string"?e:e.uuid,n=this._findEntity(r);if(!n)throw new Error(`setMaterial: '${r}' \u2014 no object with that name or uuid in the scene.`);if(!(n instanceof bl))throw new Error(`setMaterial: '${r}' is not a mesh \u2014 lights, groups, and cameras have no material.`);let a=typeof t=="function"?await this.createCustomMaterial(t):t;if(fL()!=="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 s=Uve({material:a});if(s.material===void 0)throw new Error("setMaterial: expected a three.js material instance or a (three) => material factory.");return n.setMaterialOverride(s.material,{scene:i,shared:this._sharedAssetsManager}),this._proxyObjectCache.delete(n.uuid),this._requestRenderAutoMode(),s.material}async createObject(e,t={}){if(this.disposed)throw new Error("createObject: this Application was disposed.");let i=this._scene,r=this._data;if(!i||!r)throw new Error("createObject: no scene loaded \u2014 call load() or start() first.");let n=function(g){if(typeof g!="string"||g.length===0)throw new Error(`createObject: expected a type name string \u2014 one of ${Fve}.`);let v=g.replace(/Geometry$/i,"").replace(/[\s_-]/g,"").toLowerCase(),y=wke[v];if(y)return{objectType:y};let _=xke[v];if(_)return{objectType:"Mesh",geometryType:_};let b=Ske[v];throw b?new Error(`createObject: '${g}' is not supported \u2014 ${b}`):new Error(`createObject: '${g}' is not a creatable Spline type \u2014 use one of ${Fve}, e.g. createObject('Cube', { width: 200 }).`)}(e);typeof t.material=="function"&&(t={...t,material:await this.createCustomMaterial(t.material)});let a,s,{options:o,material:l}=Uve(t);if(l!==void 0){if(n.objectType!=="Mesh")throw new Error("createObject: a three.js material instance only applies to mesh types \u2014 lights and groups have no material.");if(fL()!=="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(n.geometryType==="TextGeometry"){if(!wX.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 p0e(),s=t.font??Nb,r.shared.fonts[s]===void 0){if(s!==Nb){let g=Object.keys(r.shared.fonts).join(", ");throw new Error(`createObject: font '${s}' is not in this document \u2014 available fonts: ${g||"(none)"}.`)}a={name:Nb,url:G1e}}}let h=this._resolveParentId(t.parent),u=Cke(n,o,r),d=ht.generateUUID(),[c,p]=yM(r);a&&(c.shared.fonts[Nb]=a),c.scene.objects.insertAfter(h,null,[{id:d,data:u,children:[]}]);let m=p.result();if(a&&this._sharedAssetsManager.addFont(Nb,a),s!==void 0){let g=this._sharedAssetsManager.getFont(s);g&&await g.loadingPromise}this._applyDocumentTransaction(m);let f=i.find(d);return l!==void 0&&f.setMaterialOverride(l,{scene:i,shared:this._sharedAssetsManager}),this._requestRenderAutoMode(),this._createProxyObject(f)}cloneObject(e,t={}){if(this.disposed)throw new Error("cloneObject: this Application was disposed.");let i=this._scene,r=this._data;if(!i||!r)throw new Error("cloneObject: no scene loaded \u2014 call load() or start() first.");let n=typeof e=="string"?e:e?.uuid,a=n?this._findEntity(n):void 0;if(!a)throw new Error(`cloneObject: '${n}' \u2014 no object with that name or uuid in the scene.`);if(a instanceof Ka)throw new Error("cloneObject: pages cannot be cloned.");let s=r.scene.objects.get(a.uuid);if(!s)throw new Error(`cloneObject: '${n}' 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,m,f){let g={...p.data};return m.position!==void 0&&(g.position=AA(m.position,[0,0,0])),m.rotation!==void 0&&(g.rotation=AA(m.rotation,[0,0,0])),m.scale!==void 0&&(g.scale=kAe(m.scale)),m.visible!==void 0&&(g.visible=m.visible),g.name=m.name??GAe(`${p.data.name??"Object"} Copy`,f),{...p,data:g}}(Pke(s),t,r.scene.objects),l=t.parent!==void 0?this._resolveParentId(t.parent):r.scene.objects.parent(a.uuid)??null,h=t.parent!==void 0?null:a.uuid,[u,d]=yM(r);u.scene.objects.insertAfter(l,h,[o]),this._applyDocumentTransaction(d.result());let c=i.find(o.id);return this._requestRenderAutoMode(),this._createProxyObject(c)}removeObject(e){let t=this._scene,i=this._data;if(this.disposed||!t||!i)return!1;let r=typeof e=="string"?e:e?.uuid,n=r?this._findEntity(r):void 0;if(!n)return!1;if(n instanceof Ka)throw new Error("removeObject: pages cannot be removed.");if(n.data.type==="PerspectiveCamera"||n.data.type==="OrthographicCamera")throw new Error("removeObject: cameras cannot be removed.");if(i.scene.objects.get(n.uuid)===void 0)throw new Error(`removeObject: '${r}' is not part of the document tree (expanded clones and instanced children cannot be removed individually).`);let a=[];n.traverseEntity(l=>{a.push(l.uuid)});let[s,o]=yM(i);s.scene.objects.delete(n.uuid),this._applyDocumentTransaction(o.result());for(let l of a){let h=this._proxyObjectCache.get(l);h&&(V9.unsubscribe(h),this._proxyObjectCache.delete(l))}return this._requestRenderAutoMode(),!0}};var vB=window,yB=vB.ShadowRoot&&(vB.ShadyCSS===void 0||vB.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,TK=Symbol(),WAe=new WeakMap,jA=class{constructor(t,i,r){if(this._$cssResult$=!0,r!==TK)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=i}get styleSheet(){let t=this.o,i=this.t;if(yB&&t===void 0){let r=i!==void 0&&i.length===1;r&&(t=WAe.get(i)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),r&&WAe.set(i,t))}return t}toString(){return this.cssText}},qAe=e=>new jA(typeof e=="string"?e:e+"",void 0,TK),MK=(e,...t)=>{let i=e.length===1?e[0]:t.reduce((r,n,a)=>r+(s=>{if(s._$cssResult$===!0)return s.cssText;if(typeof s=="number")return s;throw Error("Value passed to 'css' function must be a 'css' function result: "+s+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(n)+e[a+1],e[0]);return new jA(i,e,TK)},EK=(e,t)=>{yB?e.adoptedStyleSheets=t.map(i=>i instanceof CSSStyleSheet?i:i.styleSheet):t.forEach(i=>{let r=document.createElement("style"),n=vB.litNonce;n!==void 0&&r.setAttribute("nonce",n),r.textContent=i.cssText,e.appendChild(r)})},_B=yB?e=>e:e=>e instanceof CSSStyleSheet?(t=>{let i="";for(let r of t.cssRules)i+=r.cssText;return qAe(i)})(e):e;var AK,bB=window,$Ae=bB.trustedTypes,Oke=$Ae?$Ae.emptyScript:"",XAe=bB.reactiveElementPolyfillSupport,PK={toAttribute(e,t){switch(t){case Boolean:e=e?Oke:null;break;case Object:case Array:e=e==null?e:JSON.stringify(e)}return e},fromAttribute(e,t){let i=e;switch(t){case Boolean:i=e!==null;break;case Number:i=e===null?null:Number(e);break;case Object:case Array:try{i=JSON.parse(e)}catch{i=null}}return i}},YAe=(e,t)=>t!==e&&(t==t||e==e),CK={attribute:!0,type:String,converter:PK,reflect:!1,hasChanged:YAe},RK="finalized",Jm=class extends HTMLElement{constructor(){super(),this._$Ei=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$El=null,this._$Eu()}static addInitializer(t){var i;this.finalize(),((i=this.h)!==null&&i!==void 0?i:this.h=[]).push(t)}static get observedAttributes(){this.finalize();let t=[];return this.elementProperties.forEach((i,r)=>{let n=this._$Ep(r,i);n!==void 0&&(this._$Ev.set(n,r),t.push(n))}),t}static createProperty(t,i=CK){if(i.state&&(i.attribute=!1),this.finalize(),this.elementProperties.set(t,i),!i.noAccessor&&!this.prototype.hasOwnProperty(t)){let r=typeof t=="symbol"?Symbol():"__"+t,n=this.getPropertyDescriptor(t,r,i);n!==void 0&&Object.defineProperty(this.prototype,t,n)}}static getPropertyDescriptor(t,i,r){return{get(){return this[i]},set(n){let a=this[t];this[i]=n,this.requestUpdate(t,a,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)||CK}static finalize(){if(this.hasOwnProperty(RK))return!1;this[RK]=!0;let t=Object.getPrototypeOf(this);if(t.finalize(),t.h!==void 0&&(this.h=[...t.h]),this.elementProperties=new Map(t.elementProperties),this._$Ev=new Map,this.hasOwnProperty("properties")){let i=this.properties,r=[...Object.getOwnPropertyNames(i),...Object.getOwnPropertySymbols(i)];for(let n of r)this.createProperty(n,i[n])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(t){let i=[];if(Array.isArray(t)){let r=new Set(t.flat(1/0).reverse());for(let n of r)i.unshift(_B(n))}else t!==void 0&&i.push(_B(t));return i}static _$Ep(t,i){let r=i.attribute;return r===!1?void 0:typeof r=="string"?r:typeof t=="string"?t.toLowerCase():void 0}_$Eu(){var t;this._$E_=new Promise(i=>this.enableUpdating=i),this._$AL=new Map,this._$Eg(),this.requestUpdate(),(t=this.constructor.h)===null||t===void 0||t.forEach(i=>i(this))}addController(t){var i,r;((i=this._$ES)!==null&&i!==void 0?i:this._$ES=[]).push(t),this.renderRoot!==void 0&&this.isConnected&&((r=t.hostConnected)===null||r===void 0||r.call(t))}removeController(t){var i;(i=this._$ES)===null||i===void 0||i.splice(this._$ES.indexOf(t)>>>0,1)}_$Eg(){this.constructor.elementProperties.forEach((t,i)=>{this.hasOwnProperty(i)&&(this._$Ei.set(i,this[i]),delete this[i])})}createRenderRoot(){var t;let i=(t=this.shadowRoot)!==null&&t!==void 0?t:this.attachShadow(this.constructor.shadowRootOptions);return EK(i,this.constructor.elementStyles),i}connectedCallback(){var t;this.renderRoot===void 0&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(t=this._$ES)===null||t===void 0||t.forEach(i=>{var r;return(r=i.hostConnected)===null||r===void 0?void 0:r.call(i)})}enableUpdating(t){}disconnectedCallback(){var t;(t=this._$ES)===null||t===void 0||t.forEach(i=>{var r;return(r=i.hostDisconnected)===null||r===void 0?void 0:r.call(i)})}attributeChangedCallback(t,i,r){this._$AK(t,r)}_$EO(t,i,r=CK){var n;let a=this.constructor._$Ep(t,r);if(a!==void 0&&r.reflect===!0){let s=(((n=r.converter)===null||n===void 0?void 0:n.toAttribute)!==void 0?r.converter:PK).toAttribute(i,r.type);this._$El=t,s==null?this.removeAttribute(a):this.setAttribute(a,s),this._$El=null}}_$AK(t,i){var r;let n=this.constructor,a=n._$Ev.get(t);if(a!==void 0&&this._$El!==a){let s=n.getPropertyOptions(a),o=typeof s.converter=="function"?{fromAttribute:s.converter}:((r=s.converter)===null||r===void 0?void 0:r.fromAttribute)!==void 0?s.converter:PK;this._$El=a,this[a]=o.fromAttribute(i,s.type),this._$El=null}}requestUpdate(t,i,r){let n=!0;t!==void 0&&(((r=r||this.constructor.getPropertyOptions(t)).hasChanged||YAe)(this[t],i)?(this._$AL.has(t)||this._$AL.set(t,i),r.reflect===!0&&this._$El!==t&&(this._$EC===void 0&&(this._$EC=new Map),this._$EC.set(t,r))):n=!1),!this.isUpdatePending&&n&&(this._$E_=this._$Ej())}async _$Ej(){this.isUpdatePending=!0;try{await this._$E_}catch(i){Promise.reject(i)}let t=this.scheduleUpdate();return t!=null&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var t;if(!this.isUpdatePending)return;this.hasUpdated,this._$Ei&&(this._$Ei.forEach((n,a)=>this[a]=n),this._$Ei=void 0);let i=!1,r=this._$AL;try{i=this.shouldUpdate(r),i?(this.willUpdate(r),(t=this._$ES)===null||t===void 0||t.forEach(n=>{var a;return(a=n.hostUpdate)===null||a===void 0?void 0:a.call(n)}),this.update(r)):this._$Ek()}catch(n){throw i=!1,this._$Ek(),n}i&&this._$AE(r)}willUpdate(t){}_$AE(t){var i;(i=this._$ES)===null||i===void 0||i.forEach(r=>{var n;return(n=r.hostUpdated)===null||n===void 0?void 0:n.call(r)}),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$Ek(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$E_}shouldUpdate(t){return!0}update(t){this._$EC!==void 0&&(this._$EC.forEach((i,r)=>this._$EO(r,this[r],i)),this._$EC=void 0),this._$Ek()}updated(t){}firstUpdated(t){}};Jm[RK]=!0,Jm.elementProperties=new Map,Jm.elementStyles=[],Jm.shadowRootOptions={mode:"open"},XAe?.({ReactiveElement:Jm}),((AK=bB.reactiveElementVersions)!==null&&AK!==void 0?AK:bB.reactiveElementVersions=[]).push("1.6.3");var DK,xB=window,Lw=xB.trustedTypes,KAe=Lw?Lw.createPolicy("lit-html",{createHTML:e=>e}):void 0,IK="$lit$",o0=`lit$${(Math.random()+"").slice(9)}$`,rCe="?"+o0,Lke=`<${rCe}>`,g1=document,WA=()=>g1.createComment(""),qA=e=>e===null||typeof e!="object"&&typeof e!="function",nCe=Array.isArray,Bke=e=>nCe(e)||typeof e?.[Symbol.iterator]=="function",NK=`[
|
|
12983
12983
|
\f\r]`,HA=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,ZAe=/-->/g,QAe=/>/g,m1=RegExp(`>|${NK}(?:([^\\s"'>=/]+)(${NK}*=${NK}*(?:[^
|
|
12984
12984
|
\f\r"'\`<>=]|("|')|))|$)`,"g"),JAe=/'/g,eCe=/"/g,aCe=/^(?:script|style|textarea|title)$/i,sCe=e=>(t,...i)=>({_$litType$:e,strings:t,values:i}),oCe=sCe(1),Uet=sCe(2),v1=Symbol.for("lit-noChange"),no=Symbol.for("lit-nothing"),tCe=new WeakMap,f1=g1.createTreeWalker(g1,129,null,!1);function lCe(e,t){if(!Array.isArray(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return KAe!==void 0?KAe.createHTML(t):t}var Uke=(e,t)=>{let i=e.length-1,r=[],n,a=t===2?"<svg>":"",s=HA;for(let o=0;o<i;o++){let l=e[o],h,u,d=-1,c=0;for(;c<l.length&&(s.lastIndex=c,u=s.exec(l),u!==null);)c=s.lastIndex,s===HA?u[1]==="!--"?s=ZAe:u[1]!==void 0?s=QAe:u[2]!==void 0?(aCe.test(u[2])&&(n=RegExp("</"+u[2],"g")),s=m1):u[3]!==void 0&&(s=m1):s===m1?u[0]===">"?(s=n??HA,d=-1):u[1]===void 0?d=-2:(d=s.lastIndex-u[2].length,h=u[1],s=u[3]===void 0?m1:u[3]==='"'?eCe:JAe):s===eCe||s===JAe?s=m1:s===ZAe||s===QAe?s=HA:(s=m1,n=void 0);let p=s===m1&&e[o+1].startsWith("/>")?" ":"";a+=s===HA?l+Lke:d>=0?(r.push(h),l.slice(0,d)+IK+l.slice(d)+o0+p):l+o0+(d===-2?(r.push(void 0),o):p)}return[lCe(e,a+(e[i]||"<?>")+(t===2?"</svg>":"")),r]},y1=class{constructor({strings:t,_$litType$:i},r){let n;this.parts=[];let a=0,s=0,o=t.length-1,l=this.parts,[h,u]=Uke(t,i);if(this.el=y1.createElement(h,r),f1.currentNode=this.el.content,i===2){let d=this.el.content,c=d.firstChild;c.remove(),d.append(...c.childNodes)}for(;(n=f1.nextNode())!==null&&l.length<o;){if(n.nodeType===1){if(n.hasAttributes()){let d=[];for(let c of n.getAttributeNames())if(c.endsWith(IK)||c.startsWith(o0)){let p=u[s++];if(d.push(c),p!==void 0){let m=n.getAttribute(p.toLowerCase()+IK).split(o0),f=/([.?@])?(.*)/.exec(p);l.push({type:1,index:a,name:f[2],strings:m,ctor:f[1]==="."?LK:f[1]==="?"?BK:f[1]==="@"?UK:Uw})}else l.push({type:6,index:a})}for(let c of d)n.removeAttribute(c)}if(aCe.test(n.tagName)){let d=n.textContent.split(o0),c=d.length-1;if(c>0){n.textContent=Lw?Lw.emptyScript:"";for(let p=0;p<c;p++)n.append(d[p],WA()),f1.nextNode(),l.push({type:2,index:++a});n.append(d[c],WA())}}}else if(n.nodeType===8)if(n.data===rCe)l.push({type:2,index:a});else{let d=-1;for(;(d=n.data.indexOf(o0,d+1))!==-1;)l.push({type:7,index:a}),d+=o0.length-1}a++}}static createElement(t,i){let r=g1.createElement("template");return r.innerHTML=t,r}};function Bw(e,t,i=e,r){var n,a,s,o;if(t===v1)return t;let l=r!==void 0?(n=i._$Co)===null||n===void 0?void 0:n[r]:i._$Cl,h=qA(t)?void 0:t._$litDirective$;return l?.constructor!==h&&((a=l?._$AO)===null||a===void 0||a.call(l,!1),h===void 0?l=void 0:(l=new h(e),l._$AT(e,i,r)),r!==void 0?((s=(o=i)._$Co)!==null&&s!==void 0?s:o._$Co=[])[r]=l:i._$Cl=l),l!==void 0&&(t=Bw(e,l._$AS(e,t.values),l,r)),t}var OK=class{constructor(t,i){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=i}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){var i;let{el:{content:r},parts:n}=this._$AD,a=((i=t?.creationScope)!==null&&i!==void 0?i:g1).importNode(r,!0);f1.currentNode=a;let s=f1.nextNode(),o=0,l=0,h=n[0];for(;h!==void 0;){if(o===h.index){let u;h.type===2?u=new _1(s,s.nextSibling,this,t):h.type===1?u=new h.ctor(s,h.name,h.strings,this,t):h.type===6&&(u=new FK(s,this,t)),this._$AV.push(u),h=n[++l]}o!==h?.index&&(s=f1.nextNode(),o++)}return f1.currentNode=g1,a}v(t){let i=0;for(let r of this._$AV)r!==void 0&&(r.strings!==void 0?(r._$AI(t,r,i),i+=r.strings.length-2):r._$AI(t[i])),i++}},_1=class{constructor(t,i,r,n){var a;this.type=2,this._$AH=no,this._$AN=void 0,this._$AA=t,this._$AB=i,this._$AM=r,this.options=n,this._$Cp=(a=n?.isConnected)===null||a===void 0||a}get _$AU(){var t,i;return(i=(t=this._$AM)===null||t===void 0?void 0:t._$AU)!==null&&i!==void 0?i:this._$Cp}get parentNode(){let t=this._$AA.parentNode,i=this._$AM;return i!==void 0&&t?.nodeType===11&&(t=i.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,i=this){t=Bw(this,t,i),qA(t)?t===no||t==null||t===""?(this._$AH!==no&&this._$AR(),this._$AH=no):t!==this._$AH&&t!==v1&&this._(t):t._$litType$!==void 0?this.g(t):t.nodeType!==void 0?this.$(t):Bke(t)?this.T(t):this._(t)}k(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}$(t){this._$AH!==t&&(this._$AR(),this._$AH=this.k(t))}_(t){this._$AH!==no&&qA(this._$AH)?this._$AA.nextSibling.data=t:this.$(g1.createTextNode(t)),this._$AH=t}g(t){var i;let{values:r,_$litType$:n}=t,a=typeof n=="number"?this._$AC(t):(n.el===void 0&&(n.el=y1.createElement(lCe(n.h,n.h[0]),this.options)),n);if(((i=this._$AH)===null||i===void 0?void 0:i._$AD)===a)this._$AH.v(r);else{let s=new OK(a,this),o=s.u(this.options);s.v(r),this.$(o),this._$AH=s}}_$AC(t){let i=tCe.get(t.strings);return i===void 0&&tCe.set(t.strings,i=new y1(t)),i}T(t){nCe(this._$AH)||(this._$AH=[],this._$AR());let i=this._$AH,r,n=0;for(let a of t)n===i.length?i.push(r=new _1(this.k(WA()),this.k(WA()),this,this.options)):r=i[n],r._$AI(a),n++;n<i.length&&(this._$AR(r&&r._$AB.nextSibling,n),i.length=n)}_$AR(t=this._$AA.nextSibling,i){var r;for((r=this._$AP)===null||r===void 0||r.call(this,!1,!0,i);t&&t!==this._$AB;){let n=t.nextSibling;t.remove(),t=n}}setConnected(t){var i;this._$AM===void 0&&(this._$Cp=t,(i=this._$AP)===null||i===void 0||i.call(this,t))}},Uw=class{constructor(t,i,r,n,a){this.type=1,this._$AH=no,this._$AN=void 0,this.element=t,this.name=i,this._$AM=n,this.options=a,r.length>2||r[0]!==""||r[1]!==""?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=no}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(t,i=this,r,n){let a=this.strings,s=!1;if(a===void 0)t=Bw(this,t,i,0),s=!qA(t)||t!==this._$AH&&t!==v1,s&&(this._$AH=t);else{let o=t,l,h;for(t=a[0],l=0;l<a.length-1;l++)h=Bw(this,o[r+l],i,l),h===v1&&(h=this._$AH[l]),s||(s=!qA(h)||h!==this._$AH[l]),h===no?t=no:t!==no&&(t+=(h??"")+a[l+1]),this._$AH[l]=h}s&&!n&&this.j(t)}j(t){t===no?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}},LK=class extends Uw{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===no?void 0:t}},Fke=Lw?Lw.emptyScript:"",BK=class extends Uw{constructor(){super(...arguments),this.type=4}j(t){t&&t!==no?this.element.setAttribute(this.name,Fke):this.element.removeAttribute(this.name)}},UK=class extends Uw{constructor(t,i,r,n,a){super(t,i,r,n,a),this.type=5}_$AI(t,i=this){var r;if((t=(r=Bw(this,t,i,0))!==null&&r!==void 0?r:no)===v1)return;let n=this._$AH,a=t===no&&n!==no||t.capture!==n.capture||t.once!==n.once||t.passive!==n.passive,s=t!==no&&(n===no||a);a&&this.element.removeEventListener(this.name,this,n),s&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){var i,r;typeof this._$AH=="function"?this._$AH.call((r=(i=this.options)===null||i===void 0?void 0:i.host)!==null&&r!==void 0?r:this.element,t):this._$AH.handleEvent(t)}},FK=class{constructor(t,i,r){this.element=t,this.type=6,this._$AN=void 0,this._$AM=i,this.options=r}get _$AU(){return this._$AM._$AU}_$AI(t){Bw(this,t)}};var iCe=xB.litHtmlPolyfillSupport;iCe?.(y1,_1),((DK=xB.litHtmlVersions)!==null&&DK!==void 0?DK:xB.litHtmlVersions=[]).push("2.8.0");var $A=(e,t,i)=>{var r,n;let a=(r=i?.renderBefore)!==null&&r!==void 0?r:t,s=a._$litPart$;if(s===void 0){let o=(n=i?.renderBefore)!==null&&n!==void 0?n:null;a._$litPart$=s=new _1(t.insertBefore(WA(),o),o,void 0,i??{})}return s._$AI(e),s};var zK,VK;var l0=class extends Jm{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var t,i;let r=super.createRenderRoot();return(t=(i=this.renderOptions).renderBefore)!==null&&t!==void 0||(i.renderBefore=r.firstChild),r}update(t){let i=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=$A(i,this.renderRoot,this.renderOptions)}connectedCallback(){var t;super.connectedCallback(),(t=this._$Do)===null||t===void 0||t.setConnected(!0)}disconnectedCallback(){var t;super.disconnectedCallback(),(t=this._$Do)===null||t===void 0||t.setConnected(!1)}render(){return v1}};l0.finalized=!0,l0._$litElement$=!0,(zK=globalThis.litElementHydrateSupport)===null||zK===void 0||zK.call(globalThis,{LitElement:l0});var hCe=globalThis.litElementPolyfillSupport;hCe?.({LitElement:l0});((VK=globalThis.litElementVersions)!==null&&VK!==void 0?VK:globalThis.litElementVersions=[]).push("3.3.3");var uCe=e=>t=>typeof t=="function"?((i,r)=>(customElements.define(i,r),r))(e,t):((i,r)=>{let{kind:n,elements:a}=r;return{kind:n,elements:a,finisher(s){customElements.define(i,s)}}})(e,t);var zke=(e,t)=>t.kind==="method"&&t.descriptor&&!("value"in t.descriptor)?{...t,finisher(i){i.createProperty(t.key,e)}}:{kind:"field",key:Symbol(),placement:"own",descriptor:{},originalKey:t.key,initializer(){typeof t.initializer=="function"&&(this[t.key]=t.initializer.call(this))},finisher(i){i.createProperty(t.key,e)}},Vke=(e,t,i)=>{t.constructor.createProperty(i,e)};function Fh(e){return(t,i)=>i!==void 0?Vke(e,t,i):zke(e,t)}var kK,utt=((kK=window.HTMLSlotElement)===null||kK===void 0?void 0:kK.prototype.assignedElements)!=null?(e,t)=>e.assignedElements(t):(e,t)=>e.assignedNodes(t).filter(i=>i.nodeType===Node.ELEMENT_NODE);var wB=window.IntersectionObserver!=null;var dCe=(e=32,t=2)=>{let i=e/2;return oCe` <style>
|
|
12985
12985
|
:host {
|