@splinetool/viewer 2.0.122 → 2.0.123
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 +10 -10
- package/build/spline-viewer.js +10 -10
- package/build/spline-viewer.webgl.js +10 -10
- package/build/spline-viewer.webgpu.js +10 -10
- package/package.json +1 -1
package/build/spline-viewer.js
CHANGED
|
@@ -4183,13 +4183,13 @@ void main() {
|
|
|
4183
4183
|
}
|
|
4184
4184
|
post({ kind: 'ready' });
|
|
4185
4185
|
}, 250);
|
|
4186
|
-
})();`});function m3(e){return e==null||e===""?void 0:String(e)}var uY,k_e=U(()=>{uY=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[s,a]of Object.entries(r)){let o=i.setVariable(s,a);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"getTexture":if(i.getTexture===void 0)throw new Error("getTexture: not available on this surface \u2014 a three.js texture instance needs the inline HTML-content mode (editor Preview/Play and web exports).");return i.getTexture(String(t[0]),t[1]??{});case"setMaterial":if(i.setMaterial===void 0)throw new Error("setMaterial: not available on this surface \u2014 custom three.js/TSL materials need the inline HTML-content mode (editor Preview/Play and web exports).");return i.setMaterial(String(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"getAnimations":{let r=i.getAnimations(m3(t[0]));return r.warning&&this.onConsole("warn",`spline.${e}: ${r.warning}`),r.clips}case"playAnimation":{let r=typeof t[1]=="object"&&t[1]!==null,n=i.playAnimation(String(t[0]),r?void 0:m3(t[1]),(r?t[1]:t[2])??{});return n.warning&&this.onConsole("warn",`spline.${e}: ${n.warning}`),n.clip}case"pauseAnimation":case"stopAnimation":{let r=m3(t[0]),n=m3(t[1]),s=e==="pauseAnimation"?i.pauseAnimation(r,n):i.stopAnimation(r,n);return s.warning&&this.onConsole("warn",`spline.${e}: ${s.warning}`),s.ok}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 s of Object.keys(r))i[s]!==r[s]&&n.push({name:s,value:r[s]});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 JLe(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 e4e=U(()=>{}),V_e,t4e=U(()=>{}),i4e=U(()=>{hY(),k_e(),V_e=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 s;typeof(s=n)!="object"||s===null||s[gg]!==!0||typeof s.kind!="string"||this.handleMessage(n)},this.host=new uY(t,i,(r,n)=>{this.sendEvent(r,n)})}attach(){window.addEventListener("message",this.onMessage),this.send({[gg]:!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({[gg]:!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({[gg]:!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({[gg]:!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({[gg]:!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}))}}}}),jr=U(()=>{lY(),ULe(),zLe(),kLe(),GLe(),jLe(),WLe(),HLe(),qLe(),$Le(),XLe(),ZLe(),hY(),QLe(),k_e(),e4e(),t4e(),i4e()}),r4e=U(()=>{});function G_e(e){return Array.isArray(e)?e:[e]}function wL(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 n4e=U(()=>{});function jo(e,t){return Object.setPrototypeOf(e,t),e}function UU(e){let t={...e};return Object.setPrototypeOf(t,Object.getPrototypeOf(e)),t}function Rg(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 s=e;e=t,t=s}let r=[],n=1/(i+1);for(let s=0;s<i;s++){let a=e+(t-e)*(s+.75+.5*Math.random())*n;r.push(a)}return r}function i1(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 s4e=U(()=>{});function dY(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"&&dY(r)}return Object.freeze(e)}function j_e(e){for(let t of Object.keys(e))e[t]===void 0&&delete e[t];return e}var zU,SL,DW,si,cY,a4e=U(()=>{}),la=U(()=>{r4e(),n4e(),s4e(),a4e()}),pY=U(()=>{zU=class{},SL=class extends zU{constructor(e){super(),this.id=e}},DW=class extends zU{constructor(e){super(),this.data=e}}}),o4e=U(()=>{}),cB=U(()=>{si=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,si.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:s}=e,a={...t,[n]:s};return Object.setPrototypeOf(a,si.prototype),{data:a,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,si.prototype),delete n[i],{data:n,actual:e,reverse:{type:1,id:i,data:r}}}}return null}}}),fY=U(()=>{cY=class extends Error{}});function W_e(e,t){for(let i of e)t(i.id,i.data)!==!0&&W_e(i.children,t)}function H_e(e,t){if(t(e.id,e.data)!==!0)for(let i of e.children)H_e(i,t)}var Aa,g3,rw,Ct,h1=U(()=>{la(),fY(),la(),Aa=class extends Array{constructor(...e){super(...e),Fc(this,"partialObjectCaches"),Fc(this,"objCaches"),Fc(this,"parentCaches"),Object.setPrototypeOf(this,Aa.prototype)}deepFreeze(){let e=0;for(;e<this.length;)dY(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&&H_e(i,t)}}traverse(e){W_e(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 s=r[n];r=[...r],r[n]={...s,data:t};let a=new Map;return a.set(e,r[n]),this.modifyArrayBy(i,r,a)}}modifyArrayBy(e,t,i=void 0){let r=e,n=t;for(;r!==null;){let a=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:a},i&&i.set(o,n[l])}Object.setPrototypeOf(n,Aa.prototype);let s=n;if(i&&this.objCaches!==void 0&&this.parentCaches!==void 0){s.objCaches=this.objCaches;for(let[a,o]of i)s.objCaches.set(a,o);s.parentCaches=this.parentCaches,this.objCaches=void 0,this.parentCaches=void 0}else s.fillCaches();return s}runOp(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:s}=e;if(t!==null&&this.get(t)===void 0||this.checkDuplicatedIdRec(e))return null;{let a=t,o=this.childrenArray(a),l={fi:i,id:r,data:n,children:s};return o=[...o,l],o.sort((h,u)=>h.fi-u.fi),e.localIndex=o.indexOf(l),{data:this.modifyArrayBy(a,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(a=>a.id===t);e.localIndex=n,r=[...r];let s=r.splice(n,1)[0];return{data:this.modifyArrayBy(i,r),actual:e,reverse:{type:7,...s,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 cY("cyclic tree");d=this.parent(d)}}let n=this.parent(r);if(n===void 0)return null;let s=n,a=this.childrenArray(n),o=a.findIndex(d=>d.id===r);a=[...a];let l=a.splice(o,1)[0],h=this.modifyArrayBy(n,a);n=t,a=h.childrenArray(n);let u=l.fi;return l={...l,fi:i},a=[...a,l],a.sort((d,c)=>d.fi-c.fi),e.localIndex=a.indexOf(l),h=h.modifyArrayBy(n,a),{data:h,actual:e,reverse:{type:9,parent:s,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)=>wL(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)=>wL(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 Rg(0,i,i);{let n=r[0].fi;return Rg(n-i,n,i)}}{let n=this.get(t);if(n===void 0||this.parent(t)!==e)throw new Error("illegal args");let s=r.find(a=>a.fi>n.fi);if(s===void 0){let a=r[r.length-1].fi;return Rg(a,a+i,i)}return Rg(n.fi,s.fi,i)}}}}),mY=U(()=>{var e;la(),g3=null,(e=rw||(rw={})).setPreservePrototype=function(t){g3=t},e.tryPreservePrototype=function(t,i){return Object.getPrototypeOf(t)===g3&&Object.setPrototypeOf(i,g3),i},e.runOp=function(t,i){if(i.type!==0)return null;if(Array.isArray(t)||i1(t)){let r=i.props,n={},s=i1(t)?t.slice():[...t],a=!1;if(r)for(let o of Object.keys(r)){let l=parseInt(o);if(isNaN(l))throw new Error("wrong index");n[o]=s[l],s[l]=r[o],a=!0}return a?{data:s,actual:i,reverse:{type:0,props:n}}:null}{let r=i.props,n={},s={...t},a=!1;if(r)for(let o of Object.keys(r)){n[o]=s[o];let l=r[o];l===void 0?delete s[o]:s[o]=l,a=!0}return a?{data:e.tryPreservePrototype(t,s),actual:i,reverse:{type:0,props:n}}:null}}}),u1=U(()=>{la(),la(),Ct=class extends Array{constructor(...e){super(...e),Fc(this,"objCaches"),Object.setPrototypeOf(this,Ct.prototype)}deepFreeze(){let e=0;for(;e<this.length;)dY(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(s=>s.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,Ct.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,s={fi:t,id:i,data:r};return n=[...n,s],n.sort((a,o)=>a.fi-o.fi),e.localIndex=n.indexOf(s),{data:this.modifyArrayBy(n),actual:e,reverse:{type:5,id:i}}}deleteOp(e){let{id:t}=e,i=this,r=i.findIndex(s=>s.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 s=r[n].fi,a={...r[n],fi:t};return r[n]=a,r.sort((o,l)=>o.fi-l.fi),e.localIndex=r.indexOf(a),{data:this.modifyArrayBy(r),actual:e,reverse:{type:6,fi:s,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 Rg(0,t,t);{let r=i[0].fi;return Rg(r-t,r,t)}}{let r=this.get(e);if(r===void 0)throw new Error("illegal args");let n=i.find(s=>s.fi>r.fi);if(n===void 0){let s=i[i.length-1].fi;return Rg(s,s+t,t)}return Rg(r.fi,n.fi,t)}}}});function l4e(e,t){let i={cur:[],result:[],len:0};return[e=Sx(e,t,i)??e,i.result]}function BI(e,t){return e===null?null:(e.cur[e.len]=t,e.len+=1,e)}function FI(e){e&&(e.len-=1)}function q_e(e,t,i){let r=!1,n=e.map(s=>{let a=s.id,o=t[a];if(o!==void 0&&typeof o=="string"&&(r=!0,a=o,i!==null))throw new Error("not supported");let l=Sx(s.data,t,BI(i,a));FI(i),r=r||l!==void 0,l===void 0&&(l=s.data);let h=q_e(s.children,t,i);return h!==void 0?r=!0:h=s.children,{...s,id:a,data:l,children:h}});if(r)return n}function Sx(e,t,i){if(e instanceof Aa){let r=q_e(e,t,i);return r!==void 0&&Object.setPrototypeOf(r,Object.getPrototypeOf(e)),r}if(e instanceof Ct)return function(r,n,s){let a=!1,o=r.map(l=>{let h=l.id,u=n[h];if(u!==void 0&&typeof u=="string"&&(a=!0,h=u,s!==null))throw new Error("not supported");let d=Sx(l.data,n,BI(s,h));return FI(s),a=a||d!==void 0,d===void 0&&(d=l.data),{...l,id:h,data:d}});if(a)return Object.setPrototypeOf(o,Object.getPrototypeOf(r)),o}(e,t,i);if(Array.isArray(e)){let r=!1,n=e.map((s,a)=>{let o=Sx(s,t,BI(i,a));return FI(i),r=r||o!==void 0,o===void 0&&(o=s),o});return r?(Object.setPrototypeOf(n,Object.getPrototypeOf(e)),n):void 0}if(e&&typeof e=="object"&&!i1(e)){let r={},n=!1;for(let[s,a]of Object.entries(e))if(s!=="name"&&s!=="variableId"){let o=t[s];if(typeof o=="string"){if(i!==null)throw new Error("not supported");n=!0,s=o}let l=Sx(a,t,BI(i,s));FI(i),n=n||l!==void 0,l===void 0&&(l=a),r[s]=l}else r[s]=a;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 $_e=U(()=>{h1(),u1(),la()});function Tx(e){return e&&typeof e=="object"&&e instanceof Ms}function gY(e,t){if(t===void 0)return;let i=!1,r=e.map(n=>{let s=n.id,a=DE(n.data,t[s]);if(i=i||a!==void 0,a===void 0&&(a=n.data),n.children){let o=gY(n.children,t);return o!==void 0?i=!0:o=n.children,{...n,id:s,data:a,children:o}}return{...n,id:s,data:a}});return i?r:void 0}function DE(e,t){if(!Tx(t))return t;if(e instanceof Aa){let i=gY(e,t);return i!==void 0&&Object.setPrototypeOf(i,Object.getPrototypeOf(e)),i}if(e instanceof Ct)return function(i,r){if(r===void 0)return;let n=!1,s=i.map(a=>{let o=a.id,l=DE(a.data,r[o]);return n=n||l!==void 0,l===void 0&&(l=a.data),{...a,id:o,data:l}});return n?(Object.setPrototypeOf(s,Object.getPrototypeOf(i)),s):void 0}(e,t);if(Array.isArray(e)){let i=!1,r=e.map((n,s)=>{let a=DE(n,t[s]);return i=i||a!==void 0,a===void 0&&(a=n),a});return i?(Object.setPrototypeOf(r,Object.getPrototypeOf(e)),r):void 0}if(e instanceof Ms)return vY(e,t);if(e&&typeof e=="object"){let i={},r=!1;for(let[n,s]of Object.entries(e)){let a=DE(s,t[n]);r=r||a!==void 0,a===void 0&&(a=s),i[n]=a}return r?(Object.setPrototypeOf(i,Object.getPrototypeOf(e)),i):void 0}}function vY(e,t){if(e===void 0)return t;if(t===void 0)return e;if(!Tx(t))return t;if(!Tx(e))return Gg.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 Ms;for(let n of i){let s=vY(e===void 0?void 0:e[n],t===void 0?void 0:t[n]);r[n]=s}return r}var Ms,Gg,TL,$a,Dee,pB=U(()=>{var e;h1(),u1(),fB(),la(),Ms=class{unusedFunOverridesTable(t){}runOp(t){let i=[],r=this,n=0,s={};for(;n<t.path.length;){if(i.push(r),r=r===void 0?void 0:r[t.path[n]],r!==void 0&&!Tx(r))return null;n+=1}r=r?UU(r):new Ms;for(let[a,o]of Object.entries(t.props)){let l=r[a];s[a]=l,o===void 0?delete r[a]:r[a]=o}for(;n>0;){if(Object.keys(r).length===0){let a=i[n-1];a&&(r=UU(a),delete r[t.path[n-1]])}else{let a=i[n-1];if(a){let o=UU(a);o[t.path[n-1]]=r,r=o}else{let o=new Ms;o[t.path[n-1]]=r,r=o}}n-=1}return{data:Object.setPrototypeOf(r,Ms.prototype),actual:t,reverse:{...t,props:s}}}},(e=Gg||(Gg={})).apply=function(t,i){return DE(t,i)??t},e.merge=function(t,i){return vY(t,i)},e.filterOp=function(t,i){let r=0,n=i.path,s=t;for(;r<n.length&&s!==void 0;){if(s=Sa.zoomOnce(s,n[r]),s===void 0)return i;if(!Tx(s))return;r+=1}if(s===void 0)return i;if(Tx(s)){if(i.type===0){let a={...i.props};for(let o of Object.keys(s))delete a[o];return{...i,props:a}}if(i.type===1||i.type===4||i.type===7){let a=gY([i],s);return a?a[0]:i}return i}}}),h4e=U(()=>{la(),fB(),cB(),h1(),fY(),mY(),u1(),$_e(),pB(),(TL||(TL={})).replaceProps=function(e,t){let i=Sa.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,s){let a=s.path,o=[];for(;;){let l;if(n instanceof Ms&&s.type===0&&(l=n.runOp({...s,path:a.slice(o.length)}),l===null&&(l=void 0)),l===void 0&&o.length===a.length&&(l=n instanceof Aa||n instanceof Ct||n instanceof si?n.runOp(s):rw.runOp(n,s)),l!==void 0){if(l!==null){let d=l.data;for(let c=o.length-1;c>=0;c--){let p=a[c],f=o[c];if(f instanceof Aa){if(typeof p=="number")throw new Error("illegal arg");d=f.modifyById(p,d)}else if(f instanceof Ct){if(typeof p=="number")throw new Error("illegal arg");d=f.modifyById(p,d)}else if(f instanceof si){if(typeof p=="number")throw new Error("illegal arg");d=f.modifyById(p,d)}else if(f instanceof Ms){let m={...f,[p]:d};d=Object.setPrototypeOf(m,Ms.prototype)}else{if(typeof f!="object")return null;if(Array.isArray(f)||i1(f)){if(typeof p=="string"&&(p=parseInt(p),isNaN(p)))throw new Error("Invalid path");let m=d;d=i1(f)?f.slice():[...f],d[p]=m}else d=rw.tryPreservePrototype(f,{...f,[p]:d})}}return{data:d,actual:{...l.actual,path:a},reverse:{...l.reverse,path:a}}}return null}let h,u=a[o.length];if(n instanceof Aa){if(typeof u=="number")throw new Error("");h=n.get(u)?.data}else if(n instanceof Ct){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,s){for(let a=0;a<n.length&&a<s.length;a++)if(n[a]!==s[a])return!0;return!1}function r(n,s){if(n.length!==s.length)return!1;for(let a=0;a<n.length;a++)if(n[a]!==s[a])return!1;return!0}e.drop=function(n,s){return{...n,path:n.path.slice(s)}},e.applySimple=function(n,s){return t(n,s)?.data??n},e.apply=t,e.pathDisjoint=i,e.pathEq=r,e.commutative=function(n,s){return i(n.path,s.path)},e.subsumed=function(n,s){return!(n.type!==0||s.type!==0||!r(n.path,s.path))&&Object.keys(n.props).every(a=>s.props[a]!==void 0)}})($a||($a={})),(e=>{function t(i,r){let n=i,s=[],a=[];for(let o of r)try{if(o.type===3||o.type===5&&o.path[o.path.length-1]==="variables"){let l,h;if(o.type===3?(l=Sa.zoom(n,[...o.path,o.id]),h=$a.apply(n,{...o,type:2})):(l=Sa.zoom(n,[...o.path,o.id,"value"]),h=$a.apply(n,o)),h!==null){n=h.data;let[u,d]=l4e(n,{[o.id]:l});n=u;for(let c=0;c<d.length;c++){let p,f,m=d[c],g=m.pop();if(typeof g=="number"){let v=[g];for(let _=c+1;_<d.length;_++){let b=d[_],x=b[b.length-1];if(typeof x!="number"||!Sa.equal(m,b.slice(0,b.length-1)))break;v.push(x),d.splice(_,1)}let y=Sa.zoom(n,m);f=y.map((_,b)=>v.includes(b)?o.id:_),p=y,g=m.pop()}else p=l,(g==="alphaOverride"||g==="alpha")&&(p=l/100,Sa.zoom(n,m)[g]=p),f=o.id;s.push({type:0,path:m,props:{[g]:p}}),a.push({type:0,path:m,props:{[g]:f}})}a.push(h.reverse),s.push(h.actual)}}else{let l=$a.apply(n,o);l!==null&&(s.push(l.actual),n=l.data,a.push(l.reverse))}}catch(l){if(l instanceof cY)return null;throw l}return{data:n,actual:s,reverse:a.reverse()}}e.empty=function(){return[]},e.removePrefix=function(i,r){let n=[];for(let s of i){let[a,...o]=s.path;a===r&&n.push({...s,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(s=>$a.subsumed(n,s))),...r]},e.commutative=function(i,r){return i.every(n=>r.every(s=>$a.commutative(n,s)))},e.applyAll=function(i,r){for(let n of r){let s=t(i,n);s!==null&&(i=s.data)}return i},e.apply=t})(Dee||(Dee={}))});function Nee(e,t){return e instanceof Ms?Object.setPrototypeOf(t,Ms.prototype):rw.tryPreservePrototype(e,t)}function kU(e,t,i){if(e.length>0){let r=e[e.length-1];if(r.type===0&&t.type===0&&Sa.equal(r.path,i))return void Object.assign(r.props,t.props)}e.push({...t,path:i})}function UI(e,t,i){return i instanceof Aa?new YA(e,t,i):i instanceof Ct?new KA(e,t,i):i instanceof si?new Proxy(new Y_e(e,t,i),Z_e):i!==null&&typeof i=="object"?i1(i)?i:new Proxy(new X_e(e,t,i),K_e):i}function IM(e){let t=new NW(e);return[UI(t,"",e),t]}function ML(e,t){let[i,r]=IM(e);return t(i),r.result()}function Os(e){return e instanceof YA||e instanceof KA?e._current:e!==null&&typeof e=="object"?e[EL]:e}function OM(e){if(e instanceof YA||e instanceof KA)return e._current;if(e!==null&&typeof e=="object"){let t=e[EL];return t!==void 0?t:e}return e}var EL,Iee,zS,H1,X_e,Y_e,VU,K_e,Z_e,YA,KA,NW,Sa,Q_e=U(()=>{cB(),h1(),mY(),u1(),la(),fB(),pB(),EL=Symbol(),Iee=Symbol(),zS=Symbol(),H1=class{reportOp(e,t,i=[]){let r=this;if(t===null)return;r._current=t.data;let n=i;for(;!(r instanceof NW);){let s=r._path,a=r._current;if(s!==""&&n.splice(0,0,s),r=r._parent,r===null)return;r.update(s,a)}r.push(n,e,t.actual,t.reverse)}deleteChildren(e){if(this._children){let t=this._children[e];if(t){let i=t[zS];i&&i(),delete this._children[e]}}}},X_e=class extends H1{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=Nee(this._current,{...this._current,[e]:t})}runOp(e){let t=rw.runOp(this._current,e);t!==null&&(t.data=Nee(this._current,t.data)),this.reportOp(e,t,e.path)}},Y_e=class extends H1{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,si.prototype)}runOp(e){this.reportOp(e,this._current.runOp(e))}},VU={get(e,t){if(t===zS)return()=>{e._parent=null};if(t===EL)return e._current;if(t===Iee)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 s=i[t],a=UI(e,t,s);return a!==s?(r===void 0&&(r={},e._children=r),r[t]=a,a):s},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]}}},K_e={...VU,set(e,t,i){let r={type:0,props:{[t]:Os(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}},Z_e={...VU,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)},YA=class extends H1{constructor(e,t,i){super(),this._children={},this._parent=e,this._path=t,this._current=i,this[zS]=()=>{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,s=UI(this,e,n);return s!==n?(i===void 0&&(i={},this._children=i),i[e]=s,s):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 s=i[n];this.add(e,r[n],s.id,s.data,s.children)}}insertBefore(e,t,i){let r=this._current.insertBeforeHelper(e,t,i.length);for(let n=0;n<i.length;n++){let s=i[n];this.add(e,r[n],s.id,s.data,s.children)}}moveAfter(e,t,i){let r=this._current.insertAfterHelper(e,t,i.length);for(let n=0;n<i.length;n++){let s=i[n];this.move(e,r[n],s)}}moveBefore(e,t,i){let r=this._current.insertBeforeHelper(e,t,i.length);for(let n=0;n<i.length;n++){let s=i[n];this.move(e,r[n],s)}}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)}},KA=class extends H1{constructor(e,t,i){super(),this._children={},this._parent=e,this._path=t,this._current=i,this[zS]=()=>{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,s=UI(this,e,n);return s!==n?(i===void 0&&(i={},this._children=i),i[e]=s,s):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})}},NW=class extends H1{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){kU(this.ts,t,e),kU(this.actual,i,e),kU(this.reverse,r,e)}result(){return{data:this._current,ts:this.ts,actual:this.actual,reverse:this.reverse.reverse()}}}}),fB=U(()=>{pY(),Q_e(),u1(),h1(),la(),(e=>{function t(r,n){return(r instanceof Aa||r instanceof YA)&&typeof n=="string"||(r instanceof Ct||r instanceof KA)&&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,s=0){for(;s<n.length&&r!==void 0;)r=t(r,n[s]),s+=1;return r}e.equal=function(r,n){if(n.length!==r.length)return!1;{let s=0;for(;s<r.length;){if(r[s]!==n[s])return!1;s+=1}}return!0},e.removeOverridden=function(r,n,s){let a=i(s,r);if(a!==void 0&&typeof a=="object"&&a!==null){let o={...n};return Object.keys(a).forEach(l=>{delete o[l]}),o}return n},e.zoomOnce=t,e.zoom=i,e.findPathes=function(r,n){let s=[];return function a(o,l){if(o instanceof SL&&o.id===n.id)s.push(l);else if(o instanceof Ct)for(let h=0;h<o.length;h++)a(o[h].data,[...l,o[h].id]);else if(o instanceof Aa)o.traverse((h,u)=>{a(u,[...l,h])});else if(Array.isArray(o)){if(typeof o[0]=="number")return;for(let h=0;h<o.length;h++)a(o[h],[...l,h])}else{if(i1(o))return;if(typeof o=="object"&&o!==null)for(let h in o)a(o[h],[...l,h])}}(r,[]),s}})(Sa||(Sa={}))}),u4e=U(()=>{});function Jr(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 d4e=U(()=>{});function v3(e){try{if(!An.trusted&&!Sf){let i=Ur.sharedLength||0;i<Ur.length&&(Ur.length=i)}let t;if(An.randomAccessStructure&&Rt[Le]<64&&Rt[Le]>=32&&zee?(t=zee(Rt,Le,vu,An),Rt=null,!(e&&e.lazy)&&t&&(t=t.toJSON()),Le=vu):t=Qs(),To&&(Le=To.postBundlePosition,To=null),Sf&&(Ur.restoreStructures=null),Le==vu)Ur&&Ur.restoreStructures&&Oee(),Ur=null,Rt=null,wf&&(wf=null);else{if(Le>vu)throw new Error("Unexpected end of MessagePack data");if(!Sf){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 Ur&&Ur.restoreStructures&&Oee(),OW(),(t instanceof RangeError||t.message.startsWith("Unexpected end of buffer")||Le>vu)&&(t.incomplete=!0),t}}function Oee(){for(let e in Ur.restoreStructures)Ur[e]=Ur.restoreStructures[e];Ur.restoreStructures=null}function Qs(){let e=Rt[Le++];if(e<160){if(e<128){if(e<64)return e;{let t=Ur[63&e]||An.getStructures&&J_e()[63&e];return t?(t.read||(t.read=IW(t,63&e)),t.read()):e}}if(e<144){if(e-=128,An.mapsAsObjects){let t={};for(let i=0;i<e;i++){let r=tbe();r==="__proto__"&&(r="__proto_"),t[r]=Qs()}return t}{let t=new Map;for(let i=0;i<e;i++)t.set(Qs(),Qs());return t}}{e-=144;let t=new Array(e);for(let i=0;i<e;i++)t[i]=Qs();return An.freezeData?Object.freeze(t):t}}if(e<192){let t=e-160;if(vd>=Le)return Dg.slice(Le-Mh,(Le+=t)-Mh);if(vd==0&&vu<140){let i=t<16?yY(t):ebe(t);if(i!=null)return i}return PL(t)}{let t;switch(e){case 192:return null;case 193:return To?(t=Qs(),t>0?To[1].slice(To.position1,To.position1+=t):To[0].slice(To.position0,To.position0-=t)):nbe;case 194:return!1;case 195:return!0;case 196:if(t=Rt[Le++],t===void 0)throw new Error("Unexpected end of buffer");return GU(t);case 197:return t=Ar.getUint16(Le),Le+=2,GU(t);case 198:return t=Ar.getUint32(Le),Le+=4,GU(t);case 199:return O0(Rt[Le++]);case 200:return t=Ar.getUint16(Le),Le+=2,O0(t);case 201:return t=Ar.getUint32(Le),Le+=4,O0(t);case 202:if(t=Ar.getFloat32(Le),An.useFloat32>2){let i=kW[(127&Rt[Le])<<1|Rt[Le+1]>>7];return Le+=4,(i*t+(t>0?.5:-.5)|0)/i}return Le+=4,t;case 203:return t=Ar.getFloat64(Le),Le+=8,t;case 204:return Rt[Le++];case 205:return t=Ar.getUint16(Le),Le+=2,t;case 206:return t=Ar.getUint32(Le),Le+=4,t;case 207:return An.int64AsType==="number"?(t=4294967296*Ar.getUint32(Le),t+=Ar.getUint32(Le+4)):An.int64AsType==="string"?t=Ar.getBigUint64(Le).toString():An.int64AsType==="auto"?(t=Ar.getBigUint64(Le),t<=BigInt(2)<<BigInt(52)&&(t=Number(t))):t=Ar.getBigUint64(Le),Le+=8,t;case 208:return Ar.getInt8(Le++);case 209:return t=Ar.getInt16(Le),Le+=2,t;case 210:return t=Ar.getInt32(Le),Le+=4,t;case 211:return An.int64AsType==="number"?(t=4294967296*Ar.getInt32(Le),t+=Ar.getUint32(Le+4)):An.int64AsType==="string"?t=Ar.getBigInt64(Le).toString():An.int64AsType==="auto"?(t=Ar.getBigInt64(Le),t>=BigInt(-2)<<BigInt(52)&&t<=BigInt(2)<<BigInt(52)&&(t=Number(t))):t=Ar.getBigInt64(Le),Le+=8,t;case 212:if(t=Rt[Le++],t==114)return zW(63&Rt[Le++]);{let i=yo[t];if(i)return i.read?(Le++,i.read(Qs())):i.noBuffer?(Le++,i()):i(Rt.subarray(Le,++Le));throw new Error("Unknown extension "+t)}case 213:return t=Rt[Le],t==114?(Le++,zW(63&Rt[Le++],Rt[Le++])):O0(2);case 214:return O0(4);case 215:return O0(8);case 216:return O0(16);case 217:return t=Rt[Le++],vd>=Le?Dg.slice(Le-Mh,(Le+=t)-Mh):abe(t);case 218:return t=Ar.getUint16(Le),vd>=(Le+=2)?Dg.slice(Le-Mh,(Le+=t)-Mh):obe(t);case 219:return t=Ar.getUint32(Le),vd>=(Le+=4)?Dg.slice(Le-Mh,(Le+=t)-Mh):lbe(t);case 220:return t=Ar.getUint16(Le),Le+=2,Lee(t);case 221:return t=Ar.getUint32(Le),Le+=4,Lee(t);case 222:return t=Ar.getUint16(Le),Le+=2,Bee(t);case 223:return t=Ar.getUint32(Le),Le+=4,Bee(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 IW(e,t){function i(){if(i.count++>BW){let n;try{n=e.read=new Function("r","return function(){return "+(An.freezeData?"Object.freeze":"")+"({"+e.map(s=>s==="__proto__"?"__proto_:r()":sbe.test(s)?s+":r()":"["+JSON.stringify(s)+"]:r()").join(",")+"})}")(Qs)}catch{return BW=1/0,i()}return e.read0=n,e.highByte===0&&(e.read=FW(t,e.read)),n()}let r={};for(let n=0,s=e.length;n<s;n++){let a=e[n];a==="__proto__"&&(a="__proto_"),r[a]=Qs()}return An.freezeData?Object.freeze(r):r}return i.count=0,e.read0=i,e.highByte===0?FW(t,i):i}function J_e(){let e=rbe(()=>(Rt=null,An.getStructures()));return Ur=An._mergeStructures(e,Ur)}function LM(e){let t;if(e<16&&(t=yY(e)))return t;if(e>64&&LW)return LW.decode(Rt.subarray(Le,Le+=e));let i=Le+e,r=[];for(t="";Le<i;){let n=Rt[Le++];if(128&n)if((224&n)==192){let s=(31&n)<<6|63&Rt[Le++];s<128?r.push(65533):r.push(s)}else if((240&n)==224){let s=(31&n)<<12|(63&Rt[Le++])<<6|63&Rt[Le++];s<2048||s>=55296&&s<=57343?r.push(65533):r.push(s)}else if((248&n)==240){let s=(7&n)<<18|(63&Rt[Le++])<<12|(63&Rt[Le++])<<6|63&Rt[Le++];s<65536||s>1114111?r.push(65533):(s>65535&&(s-=65536,r.push(s>>>10&1023|55296),s=56320|1023&s),r.push(s))}else r.push(65533);else r.push(n);r.length>=4096&&(t+=xa.apply(String,r),r.length=0)}return r.length>0&&(t+=xa.apply(String,r)),t}function Lee(e){let t=new Array(e);for(let i=0;i<e;i++)t[i]=Qs();return An.freezeData?Object.freeze(t):t}function Bee(e){if(An.mapsAsObjects){let t={};for(let i=0;i<e;i++){let r=tbe();r==="__proto__"&&(r="__proto_"),t[r]=Qs()}return t}{let t=new Map;for(let i=0;i<e;i++)t.set(Qs(),Qs());return t}}function ebe(e){let t=Le,i=new Array(e);for(let r=0;r<e;r++){let n=Rt[Le++];if((128&n)>0)return void(Le=t);i[r]=n}return xa.apply(String,i)}function yY(e){if(e<4){if(e<2){if(e===0)return"";{let t=Rt[Le++];return(128&t)>1?void(Le-=1):xa(t)}}{let t=Rt[Le++],i=Rt[Le++];if((128&t)>0||(128&i)>0)return void(Le-=2);if(e<3)return xa(t,i);let r=Rt[Le++];return(128&r)>0?void(Le-=3):xa(t,i,r)}}{let t=Rt[Le++],i=Rt[Le++],r=Rt[Le++],n=Rt[Le++];if((128&t)>0||(128&i)>0||(128&r)>0||(128&n)>0)return void(Le-=4);if(e<6){if(e===4)return xa(t,i,r,n);{let s=Rt[Le++];return(128&s)>0?void(Le-=5):xa(t,i,r,n,s)}}if(e<8){let s=Rt[Le++],a=Rt[Le++];if((128&s)>0||(128&a)>0)return void(Le-=6);if(e<7)return xa(t,i,r,n,s,a);let o=Rt[Le++];return(128&o)>0?void(Le-=7):xa(t,i,r,n,s,a,o)}{let s=Rt[Le++],a=Rt[Le++],o=Rt[Le++],l=Rt[Le++];if((128&s)>0||(128&a)>0||(128&o)>0||(128&l)>0)return void(Le-=8);if(e<10){if(e===8)return xa(t,i,r,n,s,a,o,l);{let h=Rt[Le++];return(128&h)>0?void(Le-=9):xa(t,i,r,n,s,a,o,l,h)}}if(e<12){let h=Rt[Le++],u=Rt[Le++];if((128&h)>0||(128&u)>0)return void(Le-=10);if(e<11)return xa(t,i,r,n,s,a,o,l,h,u);let d=Rt[Le++];return(128&d)>0?void(Le-=11):xa(t,i,r,n,s,a,o,l,h,u,d)}{let h=Rt[Le++],u=Rt[Le++],d=Rt[Le++],c=Rt[Le++];if((128&h)>0||(128&u)>0||(128&d)>0||(128&c)>0)return void(Le-=12);if(e<14){if(e===12)return xa(t,i,r,n,s,a,o,l,h,u,d,c);{let p=Rt[Le++];return(128&p)>0?void(Le-=13):xa(t,i,r,n,s,a,o,l,h,u,d,c,p)}}{let p=Rt[Le++],f=Rt[Le++];if((128&p)>0||(128&f)>0)return void(Le-=14);if(e<15)return xa(t,i,r,n,s,a,o,l,h,u,d,c,p,f);let m=Rt[Le++];return(128&m)>0?void(Le-=15):xa(t,i,r,n,s,a,o,l,h,u,d,c,p,f,m)}}}}}function Fee(){let e,t=Rt[Le++];if(t<192)e=t-160;else switch(t){case 217:e=Rt[Le++];break;case 218:e=Ar.getUint16(Le),Le+=2;break;case 219:e=Ar.getUint32(Le),Le+=4;break;default:throw new Error("Expected string")}return LM(e)}function GU(e){return An.copyBuffers?Uint8Array.prototype.slice.call(Rt,Le,Le+=e):Rt.subarray(Le,Le+=e)}function O0(e){let t=Rt[Le++];if(yo[t]){let i;return yo[t](Rt.subarray(Le,i=Le+=e),r=>{Le=r;try{return Qs()}finally{Le=i}})}throw new Error("Unknown extension type "+t)}function tbe(){let e=Rt[Le++];if(!(e>=160&&e<192))return Le--,ibe(Qs());if(e-=160,vd>=Le)return Dg.slice(Le-Mh,(Le+=e)-Mh);if(!(vd==0&&vu<180))return PL(e);let t,i=4095&(e<<5^(e>1?Ar.getUint16(Le):e>0?Rt[Le]:0)),r=UW[i],n=Le,s=Le+e-3,a=0;if(r&&r.bytes==e){for(;n<s;){if(t=Ar.getUint32(n),t!=r[a++]){n=1879048192;break}n+=4}for(s+=3;n<s;)if(t=Rt[n++],t!=r[a++]){n=1879048192;break}if(n===s)return Le=n,r.string;s-=3,n=Le}for(r=[],UW[i]=r,r.bytes=e;n<s;)t=Ar.getUint32(n),r.push(t),n+=4;for(s+=3;n<s;)t=Rt[n++],r.push(t);let o=e<16?yY(e):ebe(e);return r.string=o??PL(e)}function ibe(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(An.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 rbe(e){kee&&kee();let t=vu,i=Le,r=CL,n=Mh,s=vd,a=Dg,o=AL,l=wf,h=To,u=new Uint8Array(Rt.slice(0,vu)),d=Ur,c=Ur.slice(0,Ur.length),p=An,f=Sf,m=e();return vu=t,Le=i,CL=r,Mh=n,vd=s,Dg=a,AL=o,wf=l,To=h,Rt=u,Sf=f,(Ur=d).splice(0,Ur.length,...c),An=p,Ar=new DataView(Rt.buffer,Rt.byteOffset,Rt.byteLength),m}function OW(){Rt=null,wf=null,Ur=null}function c4e(e){e.unpack?yo[e.type]=e.unpack:yo[e.type]=e}var LW,Rt,vu,Le,Uee,AL,CL,An,Ur,Dg,Mh,vd,To,wf,yo,Ar,jU,nbe,Sf,BW,zee,kee,BM,sbe,FW,PL,abe,obe,lbe,xa,UW,zW,WU,Vee,Gee,jee,kW,y3,Wee,Hee,qee,VW,HU,MA,p4e=U(()=>{try{LW=new TextDecoder}catch{}Le=0,AL=Uee=[],CL=0,An={},Mh=0,vd=0,yo=[],jU={useRecords:!1,mapsAsObjects:!0},(nbe=new class{}).name="MessagePack 0xC1",Sf=!1,BW=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(Rt)return rbe(()=>(OW(),this?this.unpack(e,t):BM.prototype.unpack.call(jU,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,Le=t.start||0):(Le=0,vu=t>-1?t:e.length),CL=0,vd=0,Dg=null,AL=Uee,To=null,Rt=e;try{Ar=e.dataView||(e.dataView=new DataView(e.buffer,e.byteOffset,e.byteLength))}catch(i){throw Rt=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(An=this,this.structures)return Ur=this.structures,v3(t);(!Ur||Ur.length>0)&&(Ur=[])}else An=jU,(!Ur||Ur.length>0)&&(Ur=[]);return v3(t)}unpackMultiple(e,t){let i,r=0;try{Sf=!0;let n=e.length,s=this?this.unpack(e,n):y3.unpack(e,n);if(!t){for(i=[s];Le<n;)r=Le,i.push(v3());return i}if(t(s,r,Le)===!1)return;for(;Le<n;)if(r=Le,t(v3(),r,Le)===!1)return}catch(n){throw n.lastPosition=r,n.values=i,n}finally{Sf=!1,OW()}}_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)}},sbe=/^[a-zA-Z_$][a-zA-Z\d_$]*$/,FW=(e,t)=>function(){let i=Rt[Le++];if(i===0)return t();let r=e<32?-(e+(i<<5)):e+(i<<5),n=Ur[r]||J_e()[r];if(!n)throw new Error("Record id is not defined for "+r);return n.read||(n.read=IW(n,e)),n.read()},PL=LM,abe=LM,obe=LM,lbe=LM,xa=String.fromCharCode,UW=new Array(4096),zW=(e,t)=>{let i=Qs().map(ibe),r=e;t!==void 0&&(e=e<32?-((t<<5)+e):(t<<5)+e,i.highByte=t);let n=Ur[e];return n&&(n.isShared||Sf)&&((Ur.restoreStructures||(Ur.restoreStructures=[]))[e]=n),Ur[e]=i,i.read=IW(i,r),(i.read0||i.read)()},yo[0]=()=>{},yo[0].noBuffer=!0,yo[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=(s,a)=>{let o=a-s;if(o<=40){let d=r.getBigUint64(s);for(let c=s+8;c<a;c+=8)d<<=BigInt(64),d|=r.getBigUint64(c);return d}let l=s+(o>>4<<3),h=n(s,l),u=n(l,a);return h<<BigInt(8*(a-l))|u};i=i<<BigInt(8*(r.byteLength-t))|n(t,r.byteLength)}return i},WU={Error,EvalError,RangeError,ReferenceError,SyntaxError,TypeError,URIError,AggregateError:typeof AggregateError=="function"?AggregateError:null},yo[101]=()=>{let e=Qs();if(!WU[e[0]]){let t=Error(e[1],{cause:e[2]});return t.name=e[0],t}return WU[e[0]](e[1],{cause:e[2]})},yo[105]=e=>{if(An.structuredClone===!1)throw new Error("Structured clone extension is disabled");let t=Ar.getUint32(Le-4);wf||(wf=new Map);let i,r=Rt[Le];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)&&Rt[Le+1]===115?new Set:{};let n={target:i};wf.set(t,n);let s=Qs();if(!n.used)return n.target=s;if(Object.assign(i,s),i instanceof Map)for(let[a,o]of s.entries())i.set(a,o);if(i instanceof Set)for(let a of Array.from(s))i.add(a);return i},yo[112]=e=>{if(An.structuredClone===!1)throw new Error("Structured clone extension is disabled");let t=Ar.getUint32(Le-4),i=wf.get(t);return i.used=!0,i.target},yo[115]=()=>new Set(Qs()),Vee=["Int8","Uint8","Uint8Clamped","Int16","Uint16","Int32","Uint32","Float32","Float64","BigInt64","BigUint64"].map(e=>e+"Array"),Gee=typeof globalThis=="object"?globalThis:window,yo[116]=e=>{let t=e[0],i=Uint8Array.prototype.slice.call(e,1).buffer,r=Vee[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 Gee[r](i)},yo[120]=()=>{let e=Qs();return new RegExp(e[0],e[1])},jee=[],yo[98]=e=>{let t=(e[0]<<24)+(e[1]<<16)+(e[2]<<8)+e[3],i=Le;return Le+=t-e.length,To=jee,(To=[Fee(),Fee()]).position0=0,To.position1=0,To.postBundlePosition=Le,Le=i,Qs()},yo[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"),kW=new Array(147);for(let e=0;e<256;e++)kW[e]=+("1e"+Math.floor(45.15-.30103*e));(y3=new BM({useRecords:!1})).unpack,y3.unpackMultiple,y3.unpack,Wee=new Float32Array(1),new Uint8Array(Wee.buffer,0,4)}),f4e=U(()=>{p4e(),pY(),pB(),u1(),cB(),h1(),Hee=[{Class:si.prototype.constructor,type:1,write:e=>({...e}),read:e=>(Object.setPrototypeOf(e,si.prototype),e)},{Class:Ct.prototype.constructor,type:2,write:e=>[...e],read:e=>(Object.setPrototypeOf(e,Ct.prototype),e)},{Class:Aa.prototype.constructor,type:3,write:e=>[...e],read:e=>(Object.setPrototypeOf(e,Aa.prototype),e)},{Class:SL.prototype.constructor,type:4,write:e=>e.id,read:e=>new SL(e)},{Class:DW.prototype.constructor,type:5,write:e=>e.data,read:e=>new DW(e)},{Class:Ms.prototype.constructor,type:6,write:e=>({...e}),read:e=>(Object.setPrototypeOf(e,Ms.prototype),e)}];for(let e of Hee)c4e(e);qee=new BM({structuredClone:!0}),(VW||(VW={})).deserialize=function(e){return qee.unpack(e)}}),m4e=U(()=>{f4e(),HU=e=>()=>{throw new Error(e+" is not available in the runtime build (decode-only CollabSerialize)")},MA={deserialize:VW.deserialize,serialize:HU("CollabSerialize.serialize"),checksum:HU("CollabSerialize.checksum")}}),Or=U(()=>{fB(),o4e(),fY(),h1(),cB(),mY(),u1(),h4e(),u4e(),Q_e(),d4e(),pY(),m4e(),$_e(),pB()});function GW(e){return e==="MouseDown"||e==="MouseUp"||e==="KeyDown"||e==="KeyUp"||e==="Collision"||e==="Trigger"}var $ee,jW,NE,_3,qU,Xee,Yee,Kee,WW,HW,Zee,Qee,Jee,ete,tte,qW,$W,ite,rte,nte,ste,hbe=U(()=>{var e,t,i;Or(),ae(),(e=$ee||($ee={})).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},jW={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 Ct}:{type:n,disabled:!1,name:"",key:void 0,actions:new Ct}}})(NE||(NE={})),(r=>{r.propertyDefaultData=function(n){return{type:"Property",value:[n??null,"position","x"]}},r.valueDefaultData={type:"Literal",value:0}})(_3||(_3={})),(t=qU||(qU={})).comparisonDefaultData=function(r){return{type:"Comparison",operator:"==",lOperand:_3.propertyDefaultData(r),rOperand:{..._3.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}},(Xee||(Xee={})).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 Ct,outActions:new Ct,condition:qU.distanceDefaultData(n)}}})(Yee||(Yee={})),(Kee||(Kee={})).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 Ct,drop:new Ct}},(WW||(WW={})).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 Ct},(HW||(HW={})).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 Ct}}})(Zee||(Zee={})),(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 Ct}}})(Qee||(Qee={})),(r=>{r.is=function(n){return n.type==="Start"},r.defaultData=function(){return{type:"Start",disabled:!1,name:"",actions:new Ct}}})(Jee||(Jee={})),(r=>{r.is=function(n){return n.type==="Collision"},r.defaultData=function(){return{type:"Collision",disabled:!1,name:"",target:"character",actions:new Ct}}})(ete||(ete={})),(r=>{r.is=function(n){return n.type==="Trigger"},r.defaultData=function(n,s){return{type:"Trigger",name:"",disabled:!1,target:"all",triggeringObjects:[],actions:new Ct,triggerZone:"box",position:s.toArray(),rotation:[0,0,0],size:n.toArray(),radius:n.length()/2,helperVisible:!0}}})(tte||(tte={})),(i=qW||(qW={})).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 Ct},n={size:"tablet",operator:"<",actions:new Ct},s={size:[...i.defaultSizes.custom],operator:"<>",actions:new Ct},a=new Ct;return a.push({id:et.generateUUID(),fi:0,data:r},{id:et.generateUUID(),fi:1,data:n},{id:et.generateUUID(),fi:2,data:s}),{type:"Resize",disabled:!1,name:"",orientation:"horizontal",breakpoints:a}},i.defaultBreakpointData=function(){return{size:[...i.defaultSizes.custom],operator:"<>",actions:new Ct}},(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 Ct,variableId:"",objectId:null,property:"Position X"}}})($W||($W={})),(r=>{r.is=function(n){return n.type==="API"},r.defaultData=function(){return{disabled:!1,type:"API",name:"",successActions:new Ct,errorActions:new Ct,userAPIId:""}}})(ite||(ite={})),(r=>{r.is=function(n){return n.type==="WEBHOOK"},r.defaultData=function(){return{disabled:!1,type:"WEBHOOK",name:"",actions:new Ct,userWebhookId:""}}})(rte||(rte={})),(r=>{r.is=function(n){return n.type==="AIAssistantListener"},r.defaultData=function(){return{disabled:!1,type:"AIAssistantListener",name:"",actions:new Ct,analysis:"average",analysisRange:[0,71],analysisSingle:0}}})(nte||(nte={})),(r=>{r.is=function(n){return n.type==="AIAssistantTrigger"},r.defaultData=function(){return{disabled:!1,description:"",name:"",type:"AIAssistantTrigger",actions:new Ct}}})(ste||(ste={}))});function ate(e){let t=typeof e;return e!==null&&(t==="object"||t==="function")}function XW(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 d1,Mx,ube,Ja,ote,Uc,jg,EA,lte,$U,Dh,Ks,Gr,YW,hte,Ng,nw,ute,dte,cte,pte,fte,mte,gte,vte,XU,yte,_te,YU,bte,xte,wte,KU,Ste,ZU,Tte,Mte,QU,Ete,KW,Ate,Cte,Pte,Rte,Dte,Nte,r1,Tf,Ig,ZW,QW,RL,DL,NL,IL,OL,JW,eH,LL,tH,Ex,Ite,JU,e5,iH,Ote,BL,FL,t5,Lte,AA,i5,Bte,Fte,Ute,zte,kte,Vte,Gte,jte,mB,_Y,rs,Kn,Ib,dbe,sw,UL,Xv,rH,bY,zL,kL,VL,ff,zI,Yn,r5,Tg,th=U(()=>{var e,t,i,r,n,s,a,o;d1="personal camera",Mx="a218fcc3-276b-49b9-b485-49037fd14f5f",ube=2500134,Ja=5526619,(e=ote||{}).x="x",e.y="y",e.z="z",ote=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,f){let m=l.sub(p,c),g=l.sub(f,c),v=l.dot(m,g)/l.dot(m,m),y=l.scalarMultiply(m,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,f){return[c[0]+(p[0]-c[0])*f,c[1]+(p[1]-c[1])*f]},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,f){return u(c,d(c,p,f))},l.center=function(c,p){return[.5*(c[0]+p[0]),.5*(c[1]+p[1])]}})(Uc||(Uc={})),(t=jg||(jg={})).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=EA||(EA={})).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])]}})(lte||(lte={})),(r=$U||($U={})).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},(l=>{l.zero=[0,0,0,0,0,0],l.INDEX_MAP=[4,8,1,9,2,6],l.toMatrix=function(h){let u=[...$U.identity];for(let d=0;d<6;d++)u[l.INDEX_MAP[d]]=h[d];return u},l.fromMatrix=function(h){return[h[l.INDEX_MAP[0]],h[l.INDEX_MAP[1]],h[l.INDEX_MAP[2]],h[l.INDEX_MAP[3]],h[l.INDEX_MAP[4]],h[l.INDEX_MAP[5]]]}})(Dh||(Dh={})),(n=Ks||(Ks={})).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!!ate(l)&&"r"in l&&"g"in l&&"b"in l&&!("a"in l)},(s=Gr||(Gr={})).white={...Ks.white,a:1},s.is=function(l){return!!ate(l)&&"r"in l&&"g"in l&&"b"in l&&"a"in l},s.transparent={...Ks.white,a:0},s.from0to1=function(l){return{r:l[0],g:l[1],b:l[2],a:l[3]}},s.fromHexAndA=function(l,h){return{...Ks.fromHex(l),a:h}},s.toRgb255a1=function(l){return{r:Math.round(255*l.r),g:Math.round(255*l.g),b:Math.round(255*l.b),a:l.a}},s.equals=function(l,h){return Ks.equals(l,h)&&l.a===h.a},s.equalsFixed=function(l,h){return Ks.equalsFixed(l,h)&&l.a.toFixed(2)===h.a.toFixed(2)},s.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}},s.toStyle=function({r:l,g:h,b:u,a:d}=s.white){return`rgba(${255*l}, ${255*h}, ${255*u}, ${d})`},(YW||(YW={})).identity={position:[0,0,0],rotation:[0,0,0],scale:[1,1,1],pivot:[0,0,0],pivotRotation:[0,0,0]},(a=hte||{})[a.LINEAR=0]="LINEAR",a[a.EASE=1]="EASE",a[a.EASE_IN=2]="EASE_IN",a[a.EASE_OUT=3]="EASE_OUT",a[a.EASE_IN_OUT=4]="EASE_IN_OUT",a[a.CUBIC=5]="CUBIC",a[a.SPRING=6]="SPRING",a[a.ARC=7]="ARC",a[a.NONE=8]="NONE",hte=a,(Ng||(Ng={})).defaultData={mass:1,stiffness:80,damping:10,velocity:0},(nw||(nw={})).defaultData={control1:[.5,0],control2:[.5,1]},(o=ute||(ute={})).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]}),g4e=U(()=>{var e,t;Or(),hbe(),(dte||(dte={})).defaultData={type:"SwitchCamera",name:"",targetCamera:"",delay:0,animate:!0,duration:1e3,easing:4,runMode:"Normal"},(cte||(cte={})).defaultData={type:"SceneTransition",name:"",target:"",delay:0,duration:1,transition:"none"},(pte||(pte={})).defaultData={type:"Link",name:"",url:null,context:"tab"},(fte||(fte={})).defaultData={type:"Destroy",name:"",objects:[],delay:0},(mte||(mte={})).defaultData={type:"Particles",name:"",emitterObjectId:"",delay:0,emission:"start",triggerAfter:"any"},(gte||(gte={})).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"},(vte||(vte={})).defaultData={type:"Reset",name:"",delay:0},(XU||(XU={})).defaultData={interaction:"play",delay:0,volume:.5,loop:1},(e=yte||(yte={})).pauseDefaultData={interaction:"pause",delay:0},e.stopDefaultData={interaction:"stop",delay:0},(t=_te||(_te={})).defaultData={type:"Audio",name:"",...XU.defaultData},t.hasAudioByActions=i=>i.some(({data:r})=>r.type==="Audio"&&r.interaction==="play"&&r.audio),t.hasAudioByEvents=i=>t.getAudiosByEvents(i).length>0,t.getAudiosByActions=i=>{let r=[];return i.forEach(n=>{let s=n.data;s.type==="Audio"&&s.interaction==="play"&&s.audio&&r.push(n),s.type==="Conditional"&&(r.push(...t.getAudiosByActions(s.ifActions)),r.push(...t.getAudiosByActions(s.elseActions)))}),r},t.getAudiosByEvents=i=>{let r=[];return i.forEach(({data:n})=>{NE.is(n)||n.type==="Collision"||n.type==="Start"||n.type==="Trigger"||n.type==="VariableChange"||n.type==="WEBHOOK"||n.type==="AIAssistantTrigger"?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(s=>{r.push(...t.getAudiosByActions(s))}):n.type==="DragDrop"?(r.push(...t.getAudiosByActions(n.dragDropActions.drag)),r.push(...t.getAudiosByActions(n.dragDropActions.drop))):n.type==="Resize"?n.breakpoints.forEach(({data:s})=>{r.push(...t.getAudiosByActions(s.actions))}):n.type==="API"&&(r.push(...t.getAudiosByActions(n.successActions)),r.push(...t.getAudiosByActions(n.errorActions)))}),r},(YU||(YU={})).defaultData={interaction:"play",delay:0,volume:.5,loop:1/0},(i=>{i.pauseDefaultData={interaction:"pause",delay:0},i.stopDefaultData={interaction:"stop",delay:0}})(bte||(bte={})),(i=>{i.defaultData={type:"Video",name:"",triggerAfter:"autoplay",...YU.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((NE.is(n)||n.type==="Start")&&i.hasVideoByActions(n.actions))return!0}},i.getVideosByActions=r=>{let n=[];return r.forEach(s=>{let a=s.data;a.type==="Video"&&a.interaction==="play"&&a.layerId&&n.push(s)}),n},i.getVideosByEvents=r=>{let n=[];return r.forEach(({data:s})=>{(NE.is(s)||s.type==="Start")&&n.push(...i.getVideosByActions(s.actions))}),n}})(xte||(xte={})),(wte||(wte={})).defaultData=function(i){return{state:i,repeat:0,delay:0,delayDirection:"start-once",direction:"normal",duration:1e3,easing:4}},(KU||(KU={})).defaultData=function(){return{tweens:new Ct,repeat:0,delay:0,delayDirection:"start-once",direction:"normal"}},(Ste||(Ste={})).defaultData=function(i){return{type:"Transition",name:"",runMode:"Once",object:i??null,...KU.defaultData()}},(ZU||(ZU={})).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}})(Tte||(Tte={})),(Mte||(Mte={})).defaultData=function(i){return{type:"TimelineAnimation",name:"",...ZU.defaultData(i)}},(QU||(QU={})).defaultData=function(i,r,n){return{interaction:"play",object:i,clipId:r,crop:n,crop2:n,repeat:-1,delay:0,delayDirection:"start-once",direction:"normal",runMode:"Normal"}},(i=>{i.pauseDefaultData={interaction:"pause",delay:0},i.stopDefaultData={interaction:"stop",delay:0}})(Ete||(Ete={})),(i=>{i.defaultData=function(r,n,s){return{type:"Animation",name:"",...QU.defaultData(r,n,s)}},i.isPause=function(r){return r.interaction==="pause"||r.interaction==="stop"}})(KW||(KW={})),(Ate||(Ate={})).defaultData={type:"SetVariable",name:"",variableId:"",expression:[]},(Cte||(Cte={})).defaultData=()=>({type:"Conditional",name:"",ifActions:new Ct,elseActions:new Ct,condition:[]}),(Pte||(Pte={})).defaultData={type:"DynamicVariablePlay",name:"",variableId:"",mode:"PlayPause",delay:0,pauseDelay:0},(Rte||(Rte={})).defaultData={type:"ClearLocalStorage",name:"",target:"all"},(Dte||(Dte={})).defaultData={name:"",type:"UserAPI"}}),v4e=U(()=>{var e;(e=Nte||(Nte={})).emptyAudio={data:Uint8Array.from(atob("UklGRjIAAABXQVZFZm10IBIAAAABAAEAQB8AAEAfAAABAAgAAABmYWN0BAAAAAAAAABkYXRhAAAAAA=="),t=>t.charCodeAt(0)),mimeType:"audio/wav",filename:"unknown"},e.maxSize=2e6}),cbe=U(()=>{var e;(e=r1||(r1={})).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(s){return s===void 0||!Number.isFinite(s)||s<t.MinTargetOffset?t.DefaultTargetOffset:s},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(s){return s.type==="PerspectiveCamera"?s.perspective?.zoom??1:s.orthographic?.zoom??1}})(Tf||(Tf={}))}),pbe=U(()=>{var e;(e=Ig||(Ig={})).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(QW.forEach(n=>{Object.assign(r,{[n]:i[n]??t[n]})}),r.radial={...t.radial},i.radial){let n=t.radial,s=i.radial;RL.forEach(a=>{Object.assign(r.radial,{[a]:s[a]??n[a]})})}if(r.linear={...t.linear},i.linear){let n=t.linear,s=i.linear;DL.forEach(a=>{Object.assign(r.linear,{[a]:s[a]??n[a]})})}if(r.grid={...t.grid},i.grid){let n=t.grid,s=i.grid;NL.forEach(a=>{Object.assign(r.grid,{[a]:s[a]??n[a]})})}if(r.toObject={...t.toObject},i.toObject){let n=t.toObject,s=i.toObject;IL.forEach(a=>{Object.assign(r.toObject,{[a]:s[a]??n[a]})})}if(r.randomnessObject={...t.randomnessObject},i.randomnessObject){let n=t.randomnessObject,s=i.randomnessObject;OL.forEach(a=>{Object.assign(r.randomnessObject,{[a]:s[a]??n[a]})})}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 s=[];r.count!==void 0&&s.push({type:0,path:n,props:{count:r.count}});for(let a of i){let o=r[a];o&&Object.keys(o).length>0&&s.push({type:0,path:[...n,a],props:o})}return s}})(ZW||(ZW={})),QW=["count"],RL=["radius","start","end","position","scale","rotation"],DL=["position","scale","rotation"],NL=["count","size"],IL=["count","position","scale","rotation"],OL=["strength","scale","rotation","position","movement","seed","freqScale"]}),fbe=U(()=>{var e;th(),(e=JW||(JW={})).all=["PointLight","SpotLight","DirectionalLight","HemisphereLight"],e.is=function(t){return e.all.includes(t)},(eH||(eH={})).defaultData=function(t){return function(i){if(i==="PointLight")return{type:i,color:Gr.white,intensity:1,distance:2e3,decay:1,shadows:!0,shadowResolution:1024,shadowRadius:1,penumbraSize:.5,depth:1e5};if(i==="SpotLight")return{type:i,color:Gr.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:Gr.white,intensity:1,shadows:!0,size:2e3,depth:1e5,penumbraSize:.5,shadowResolution:1024,shadowRadius:1};throw new Error("not implemented")}(t)}}),mbe=U(()=>{var e;(e=LL||(LL={})).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}}),gbe=U(()=>{var e;(e=tH||(tH={})).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"]}),xY=U(()=>{(Ex||(Ex={})).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]}}),vbe=U(()=>{var e,t;(e=Ite||{})[e.Front=0]="Front",e[e.Back=1]="Back",e[e.Double=2]="Double",Ite=e,(t=JU||(JU={})).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)}})(e5||(e5={})),(iH||(iH={})).defaultData={...e5.defaultData,...JU.defaultData},(Ote||(Ote={})).getMaterialData=function(i,r){let n=[];if("material"in i){let s=typeof i.material=="string"?r.materials[i.material]??r.lib.materials[i.material]?.asset:i.material;s&&n.push(s)}else if("materials"in i)for(let s of i.materials){let a=typeof s=="string"?r.materials[s]??r.lib.materials[s]?.asset:s;a&&n.push(a)}return n}}),ybe=U(()=>{var e;(e=BL||(BL={})).bytesFromFlattened=function(t){if(typeof t!="object"||t===null||Array.isArray(t)||ArrayBuffer.isView(t)||typeof t[0]!="number")return null;let i=Object.getPrototypeOf(t);if(i!==Object.prototype&&i!==null)return null;let r=Object.keys(t),n=new Uint8Array(r.length),s=t;for(let a=0;a<r.length;a++){let o=s[a];if(r[a]!==String(a)||typeof o!="number"||!Number.isInteger(o)||o<0||o>255)return null;n[a]=o}return n},e.emptyImage={data:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVQYV2NgYAAAAAMAAWgmWQ0AAAAASUVORK5CYII=",name:"empty"}}),_be=U(()=>{var e;(e=FL||(FL={})).defaultVideo={data:"",thumb:"/_assets/_videos/catThumb.png",type:"video",name:"Cat video"},e.maxSize=3e7}),ZA=U(()=>{var e,t,i,r;Or(),th(),ybe(),_be(),th(),(t5||(t5={})).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"},(Lte||(Lte={})).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},(i5||(i5={})).is=function(n){return n==="phong"||n==="toon"||n==="lambert"||n==="physical"},(r=Bte||{})[r.Linear=0]="Linear",r[r.Radial=1]="Radial",r[r.Polar=2]="Polar",Bte=r,Fte=(n=>(n[n.RepeatWrapping=1e3]="RepeatWrapping",n[n.ClampToEdgeWrapping=1001]="ClampToEdgeWrapping",n[n.MirroredRepeatWrapping=1002]="MirroredRepeatWrapping",n))(Fte||{}),Ute=(n=>(n[n.NearestFilter=1003]="NearestFilter",n[n.LinearFilter=1006]="LinearFilter",n[n.LinearMipmapLinearFilter=1008]="LinearMipmapLinearFilter",n))(Ute||{}),(i=zte||{})[i.UV=0]="UV",i[i.Planar=1]="Planar",i[i.Spherical=2]="Spherical",i[i.Cylindrical=3]="Cylindrical",i[i.Triplanar=4]="Triplanar",zte=i,(t=kte||{})[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",kte=t,(e=Vte||{})[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",Vte=e,Gte=(n=>(n[n.Lights=0]="Lights",n[n.Static=1]="Static",n[n.Camera=2]="Camera",n))(Gte||{}),jte=(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))(jte||{}),mB=["mode","gradientType","noiseType","tracingMode","mirror","displacementType","projection","cnormal","crop","axis","side","roughnessMapChannel","metalnessMap","metalnessMapChannel","normalMap","aoMap","aoMapChannel","emissiveMap","style"],_Y=["wrapping","image","video","name","minFilter","magFilter"],(n=>{function s(a,o){return a==="light"&&o?function(l){let h={mode:0,isMask:!1,visible:!0,bumpMap:void 0,bumpMapIntensity:5,roughnessMap:void 0,alphaOverride:1};switch(l){case"phong":return{...h,category:"phong",specular:{r:.2,g:.2,b:.2},shininess:5,type:"light",visible:!0,mode:0,occlusion:!0,alpha:.6};case"toon":return{...h,category:"toon",specular:{r:.2,g:.2,b:.2},shininess:10,type:"light",alpha:1};case"lambert":return{...h,category:"lambert",emissive:{r:0,g:0,b:0},type:"light",alpha:1,visible:!0,mode:0,occlusion:!0};case"physical":return{...h,category:"physical",roughness:.6,metalness:.2,reflectivity:.2,type:"light",alpha:.6,visible:!0,mode:0,occlusion:!0}}}(o):function(l){let h={alpha:1,mode:0,isMask:!1,visible:!0};switch(l){case"texture":return{...h,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{...h,type:"video",size:[128,128],blending:0,axis:"x",side:2,projection:0,texture:{video:FL.defaultVideo,wrapping:1001,repeat:[1,1],offset:[0,0],rotation:0,minFilter:1008,magFilter:1006},crop:!1};case"color":return{...h,type:"color",color:Ks.fromHex(Ja)};case"vertexColor":return{...h,type:"vertexColor"};case"depth":return{...h,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{...h,type:"normal",cnormal:[1,1,1]};case"gradient":return{...h,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{...h,type:"noise",size:[100,100,100],noiseType:0,scale:1,move:1,colorA:{...Ks.fromHex(6710886),a:1},colorB:{...Ks.fromHex(6710886),a:1},colorC:{...Ks.fromHex(16777215),a:1},colorD:{...Ks.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{...h,type:"cavity",mode:3,ridge:1,valley:1};case"fresnel":return{...h,type:"fresnel",color:Gr.fromHexAndA(16777215,1),bias:.1,scale:1,intensity:2,factor:1};case"dust":return{...h,type:"dust",color:Gr.fromHexAndA(10323813,1),coverage:.2,softness:.2,noiseStrength:.2,noiseScale:1};case"rainbow":return{...h,type:"rainbow",filmThickness:30,movement:0,wavelengths:[0,0,0],noiseStrength:0,noiseScale:1,offset:[0,0,0]};case"toon":return{...h,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:Gr.fromHexAndA(0,0),offset:[0,0,0]};case"outline":return{...h,type:"outline",outlineColor:Gr.fromHexAndA(0,1),contourColor:Gr.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{...h,type:"matcap",texture:{image:"matcap_0",wrapping:1001,repeat:[1,1],offset:[0,0],rotation:0,minFilter:1008,magFilter:1006}};case"transmission":return{...h,type:"transmission",thickness:10,ior:1.5,roughness:1};case"reflection":return{...h,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{...h,type:"pattern",style:0,projection:0,axis:"y",blending:0,offset:[0,0],colorA:{...Ks.fromHex(0),a:1},colorB:{...Ks.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)}n.patch=function(a,o){let{texture:l,...h}=o;if(Object.assign(a,h),l){let u=a.texture;u&&Object.assign(u,l)}},n.defaultColorLayer=function(a){return{...n.defaultData("color"),color:a}},n.defaultData=s,n.defaultDataFor=function(a,o){return a!=="light"?s(a):s("light",typeof o=="string"&&i5.is(o)?o:"physical")}})(rs||(rs={})),(n=>{function s(l,h){if(typeof l!="string"||!/^#[0-9a-f]{6}([0-9a-f]{2})?$/i.test(l))return l;let{r:u,g:d,b:c}=Ks.fromHex(parseInt(l.slice(1,7),16)),p=l.length===9?parseInt(l.slice(7),16)/255:void 0;if(Array.isArray(h))return h.length>3?[u,d,c,p??h[3]]:[u,d,c];let f=h;return typeof f?.r!="number"?l:typeof f.a=="number"?{r:u,g:d,b:c,a:p??f.a}:{r:u,g:d,b:c}}function a(l){let h=l?.data;return typeof h=="object"&&h!==null}function o(l,h="layer1",u="layer2",d=Ks.fromHex(16777215)){let c=new Ct;return c.push({fi:0,data:rs.defaultData("light",l),id:h}),c.push({fi:1,data:rs.defaultData("color"),id:u}),{layers:c}}n.restoreImageBytes=function(l){let h=[],u=new Map,d=(p,f)=>{let m=OM(p);if(typeof m!="object"||m===null||ArrayBuffer.isView(m))return p;if(u.has(m))return u.get(m)??p;u.set(m,void 0);let g=c(m,f)??p;return u.set(m,g),g},c=(p,f)=>{let m=p;if(!Array.isArray(p)){if(typeof m[0]=="number")return;if(typeof m.name=="string"){let v=BL.bytesFromFlattened(OM(m.data));if(v!==null)return h.push({path:`${f}/data`,bytes:v.byteLength}),Object.setPrototypeOf({...m,data:v},Object.getPrototypeOf(p))}}let g=null;for(let v of Object.keys(p)){let y=m[v],_=d(y,`${f}/${v}`);_!==y&&(g===null&&(g=Array.isArray(p)?[...p]:{...m},Object.setPrototypeOf(g,Object.getPrototypeOf(p))),g[v]=_)}return g??void 0};return{material:d(l,""),restored:h}},n.restoreLayersSeq=function(l){let h=OM(l.layers);if(!Array.isArray(h)||h instanceof Ct||!h.every(c=>typeof c=="object"&&c!==null&&typeof c.id=="string"&&typeof c.data=="object"))return{material:l,restored:!1};let u=Object.setPrototypeOf([...h],Ct.prototype),d=OM(l);return{material:Object.setPrototypeOf({...d,layers:u},Object.getPrototypeOf(d)),restored:!0}},n.isMergable=function(l){return!l.layers.some(h=>h.data.type==="texture"&&h.data.projection!==0||h.data.type==="depth"&&!h.data.isWorldSpace||h.data.type==="noise"||h.data.type==="dust"&&h.data.noiseStrength!==0||h.data.type==="displace")},n.getHash=function(l){let h="";return l.layers.forEach(u=>{Object.entries(u.data).forEach(([d,c])=>{h+=`${d}${c}`,Array.isArray(c)?c.forEach(p=>h+=`${p}`):typeof c=="object"?Object.values(c).forEach(p=>{h+=typeof p=="number"?`${p.toFixed(4)}`:`${p}`}):h+=`${c}`})}),h},n.defaultEmptyData=function(){return{layers:new Ct}},n.defaultData=function(l="layer1",h="layer2"){return o("physical",l,h)},n.withName=function(l,h){return{...l,name:h}},n.isLayerEntry=a,n.withRepairedLayers=function(l){if(l.layers===void 0)return{...l,layers:o("phong").layers};let h=Array.from(l.layers);if(h.every(a))return l;let u=new Ct;return h.forEach((d,c)=>{if(a(d))return void u.push(d);let{id:p,fi:f,...m}=d??{};if(typeof m.type!="string"||!t5.is(m.type))return;let g=rs.defaultDataFor(m.type,m.category),v={...g,...m};for(let[y,_]of Object.entries(m)){let b=g[y];v[y]=Array.isArray(_)&&Array.isArray(b)&&Array.isArray(b[0])?_.map(x=>s(x,b[0])):s(_,b)}u.push({id:typeof p=="string"&&p?p:`layer${c+1}`,fi:typeof f=="number"?f:c,data:v})}),{...l,layers:u}},n.defaultTwoLayerData=o,n.defaultColorMaterial=function(l,h,u="layer1",d="layer2"){let c=new Ct;return c.push({fi:0,data:rs.defaultData("light",h),id:u}),c.push({fi:1,data:rs.defaultColorLayer(l),id:d}),{layers:c}},n.defaultUIObjectMaterial=function(l){let h=rs.defaultData("texture");l&&Object.assign(h.texture,{image:l});let u=new Ct;return u.push({fi:0,data:h,id:"layer1"}),u.push({fi:1,data:{...rs.defaultData("transmission"),alpha:1},id:"layer2"}),u.push({fi:2,data:{...rs.defaultData("light","lambert"),alpha:0},id:"layer3"}),{layers:u}},n.defaultTwoLayerTextureData=function(l,h="physical",u="layer1",d="layer2"){let c=rs.defaultData("texture");Object.assign(c.texture,{image:l});let p=new Ct;return p.push({fi:0,data:c,id:u}),p.push({fi:1,data:rs.defaultData("light",h),id:d}),{layers:p}},n.defaultTwoLayerVideoTextureData=function(l,h="physical",u="layer1",d="layer2"){let c=rs.defaultData("video");Object.assign(c.texture,{video:l});let p=new Ct;return p.push({fi:0,data:c,id:u}),p.push({fi:1,data:rs.defaultData("light",h),id:d}),{layers:p}}})(Kn||(Kn={}))}),y4e=U(()=>{Ib="Roboto_regular",dbe="https://fonts.gstatic.com/s/roboto/v30/KFOmCnqEu92Fr1Me5WZLCzYlKw.ttf"}),_4e=U(()=>{y4e()}),bbe=U(()=>{var e;Or(),(e=sw||(sw={})).defaultData=function(){return{points:new Ct,roundness:0,shapeHoles:[],isClosed:!1}},e.scaled=function t(i,r,n){let s=a=>[a[0]*r,a[1]*n];return{...i,points:new Ct(...i.points.map(({id:a,fi:o,data:l})=>({id:a,fi:o,data:{...l,position:s(l.position),controlPrevious:{position:s(l.controlPrevious.position)},controlNext:{position:s(l.controlNext.position)}}}))),shapeHoles:i.shapeHoles.map(a=>t(a,r,n))}}}),xbe=U(()=>{Or(),(UL||(UL={})).defaultData=function(){return{points:new Ct,lastInsertionPlane:null,subdivisions:12,isClosed:!1,subdivisionMode:"parametric"}},Xv={type:"Ellipse",width:50,height:50,spikes:16,angle:360,innerRadius:0},(rH||(rH={})).merge=function(e,t){let i={...e};return zL.forEach(r=>{Object.assign(i,{[r]:t[r]??e[r]})}),i},bY={shape:Xv,depth:1,offset:0,bevel:50,bevelSides:6,angle:0,twist:0,startScale:1,endScale:1,capType:"flat"},zL=["depth","offset","angle","twist","startScale","endScale"]}),wY=U(()=>{var e,t;bbe(),xbe(),(e=kL||(kL={})).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"},(VL||(VL={})).merge=function(i,r){let n={...i};if(Object.assign(n,r),n.type==="PathGeometry"&&"extrusion"in r&&r.extrusion&&(n.extrusion={...i.extrusion},Object.assign(n.extrusion,rH.merge(n.extrusion,r.extrusion))),i.type==="VectorGeometry"&&n.type==="VectorGeometry"){let s=(l,h)=>typeof l=="number"&&typeof h=="number"&&h!==0?l/h:1,a=s(n.width,i.width),o=s(n.height,i.height);(a!==1||o!==1)&&(n.shape=sw.scaled(i.shape,a,o))}return n},(t=ff||(ff={})).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:UL.defaultData(),extrusion:bY};if(i==="VectorGeometry")return{width:1,height:1,type:i,subdivisions:12,shape:sw.defaultData(),depth:0,extrudeBevelSize:0,extrudeBevelSegments:1};if(i==="BooleanGeometry")return{type:i,operation:2,width:0,height:0,depth:0,phongAngle:35};if(i==="ShapeBlendGeometry")return{type:i,width:0,height:0,depth:0,resolutionLevel:6,blendRange:100,useChildrenColors:!1};if(i==="DecalGeometry")return{type:i,width:200,height:200,depth:200,offset:1,projection:"all",projectionTargets:[]};if(i==="TextGeometry")return{type:i,width:100,height:100,depth:0,horizontalAlign:1,verticalAlign:1,fontSize:16,lineHeight:1.2,letterSpacing:0,text:{textValue:""},textTransform:1,font:"Roboto_regular",editable:!1,extrudeBevelSize:0,extrudeBevelSegments:1};if(i==="InputGeometry")return{...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")},zI=["width","height","depth"]}),wbe=U(()=>{th(),(e=>{function t(i){return i.mode??"linear"}e.defaultData={enabled:!1,useBackgroundColor:!1,color:Ks.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={}))}),SY=U(()=>{(r5||(r5={})).defaultData={image:null,rotation:0,blur:32,showBackground:!0},(Tg||(Tg={})).defaultData={enabled:!1,mode:"hdri",hdri:r5.defaultData,timeOfDay:10,weather:"partlyCloudy",lighting:!0,lightingIntensity:1,lightingQuality:"full",clouds:!0,windSpeed:2,animateWind:!0,exposure:1,seed:2}});function b4e(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 CA,_y,n5,s5,a5,Ax,o5,nH,sH,Wte,q1,Sbe,na,GL,Hte,qte,$te,Xte,xc,IE,jL,WL,Mf,by,Yte,Og,HL,Ef,l5,h5,ty,n1,iy,OE,aH,Kte,Mo,u5,Zte,Qte,mf,gu,Cx,Tbe=U(()=>{(()=>{let e={opacity:1,blendFunction:13,enabled:!1};(CA||(CA={})).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}}})()}),TY=U(()=>{var e;wbe(),SY(),Tbe(),th(),(e=_y||(_y={})).defaultData={type:"normal",softShadowQuality:"low"},e.isSoft=function(t){return t!=null&&(t.type===void 0||t.type==="soft")},(n5||(n5={})).defaultData={enabled:!0,color:{r:.8274509803921568,g:.8274509803921568,b:.8274509803921568},intensity:.75},(s5||(s5={})).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}})(a5||(a5={})),(Ax||(Ax={})).defaultData={usePhysics:!1,gravity:-10},(o5||(o5={})).defaultData={playCamera:d1,gameControlObject:null},(nH||(nH={})).defaultData={backgroundColor:Gr.fromHexAndA(ube,1),postprocessing:CA.defaultData,fog:Yn.defaultData,sky:Tg.defaultData,globalPhysics:Ax.defaultData,ambient:n5.defaultData,ao:s5.defaultData,shadow:_y.defaultData,publish:o5.defaultData,grading:a5.defaultData}}),x4e=U(()=>{(sH||(sH={})).defaultData={colliderType:"box",size:[100,100,100],colliderHelperVisible:!0,forceType:"collider",forceRange:"global",forceIntensity:.5,forceDambing:.95}}),gB=U(()=>{var e,t,i;Or(),cbe(),fbe(),mbe(),gbe(),xY(),vbe(),th(),ZA(),wY(),pbe(),la(),TY(),x4e(),(e=Wte||(Wte={})).isComponentRelated=function(r){return r==="Component"||r==="Instance"},e.isEmptyOrComponent=function(r){return r==="Empty"||r==="Instance"},(t=q1||(q1={})).identity={...YW.identity,shear:Dh.zero},t.fromObject=function(r){return{position:r.position,rotation:r.rotation,scale:r.scale,pivot:r.pivot,pivotRotation:r.pivotRotation,shear:r.shear}},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,shear:n?.shear||r.shear}},t.diff=function(r,n){return j_e({position:jg.isEqual(r.position,n.position)?void 0:n.position,rotation:jg.isEqual(r.rotation,n.rotation)?void 0:n.rotation,scale:jg.isEqual(r.scale,n.scale)?null:n.scale,shear:n.shear?.every((s,a)=>s===r.shear?.[a])?void 0:n.shear})},Sbe=["slide","offset"],(na||(na={})).defaultData={states:new Ct,events:new Ct,visible:!0,raycastLock:!1,physics:Ex.defaultData,pathSnapping:{pathId:null,slide:0,offset:0,orientation:"tangential"},...q1.identity,cloner:null},(GL||(GL={})).defaultData={type:"Empty",...na.defaultData},(Hte||(Hte={})).defaultData={type:"ParticleCollider",...sH.defaultData,...na.defaultData},(qte||(qte={})).defaultData={type:"Component",...na.defaultData},($te||($te={})).defaultData={type:"Particle",...na.defaultData,...LL.defaultData},(Xte||(Xte={})).defaultData={type:"Hair",...na.defaultData,...tH.defaultData},(xc||(xc={})).defaultData={type:"Mesh",...na.defaultData,...iH.defaultData},(IE||(IE={})).defaultData={...na.defaultData,...q1.identity,position:Tf.DefaultPosition,rotation:Tf.DefaultRotation,...Tf.defaultData},(r=>{r.defaultData=function(n){return{...na.defaultData,...eH.defaultData(n)}},r.defaultDirectionalLightData={...r.defaultData("DirectionalLight"),position:[200,300,300],name:"Directional Light",intensity:.7}})(jL||(jL={})),(r=>{function n(s,a,o=0){for(;o<a.length;){let l=s?s[a[o]]:void 0;if(a.length===o+1)return l;if(!l)return;s=l.descendants,o+=1}}r.resolveWithDes=n,r.resolve=function(s,a,o=0){let l=n(s,a,o);if(l){let h=Object.keys(l);if(h.length===1&&h[0]==="descendants")return}return l}})(WL||(WL={})),(r=>{function n(s,a){return{...na.defaultData,...a,component:s,overrides:new Ms,physics:void 0,events:void 0,type:"Instance"}}r.rootOverrideProps=["physics","events"],r.compositeNonOptionalOverrideProps=["geometry"],r.compositeEntireOverrideOverrideProps=["material"],r.ofComponent=n,r.fromComponentData=function(s){let a=q1.fromObject(s.data);return n(s.id,a)}})(Mf||(Mf={})),(r=>{r.defaultData={type:"Page",...na.defaultData,physics:{...Ex.defaultData,fusedBody:!1},...nH.defaultData,camera:IE.defaultData,timelines:new si},r.isUIPage=function(n){return n.uiScene!==void 0}})(by||(by={})),(i=Yte||(Yte={})).defaultCamera={position:[0,0,1e3],scale:[1,1,1],rotation:[0,0,0],pivot:[0,0,0],pivotRotation:[0,0,0],shear:Dh.zero,name:"Play Camera",visible:!0,raycastLock:!1,physics:Ex.defaultData,states:new Ct,events:new Ct,cloner:null,pathSnapping:{pathId:null,orientation:"tangential",slide:0,offset:0},...Tf.defaultData},i.KeysByResetCategory={States:["states"],Events:["events"],Material:["material","materials"],Geometry:["geometry"],Position:["position"],Rotation:["rotation"],Scale:["scale"],Transform:["position","scale","rotation","shear"],Name:["name"],Visibility:["visible","raycastLock","flatShading","wireframe","side","shadowCatcher"],Shadows:["castShadow","receiveShadow"],Cloner:["cloner"],Physics:["physics"]},i.defaultMeshObject={name:"Rectangle",...na.defaultData,...xc.defaultData,geometry:ff.defaultData("RectangleGeometry"),material:Kn.defaultTwoLayerData("physical","layer1","layer2")},i.defaultBooleanObject={name:"Boolean",...na.defaultData,...xc.defaultData,geometry:ff.defaultData("BooleanGeometry"),material:Kn.defaultTwoLayerData("physical","layer1","layer2")},i.defaultShapeBlendObject={name:"Shape Blend",...na.defaultData,...xc.defaultData,geometry:ff.defaultData("ShapeBlendGeometry"),material:Kn.defaultTwoLayerData("physical","layer1","layer2")},i.defaultTextObject={name:"Text",...na.defaultData,...xc.defaultData,geometry:ff.defaultData("TextGeometry"),material:Kn.defaultTwoLayerData("physical","layer1","layer2")},i.defaultInputObject={name:"Input",...na.defaultData,...xc.defaultData,geometry:ff.defaultData("InputGeometry"),material:Kn.defaultTwoLayerData("physical","layer1","layer2")},(r=>{r.newEmpty=function(n,s){let a={name:s};return n.type==="Mesh"?(a.geometry={},"material"in n&&(a.material={layers:new Ms}),"materials"in n&&(a.materials=n.materials.map(o=>({layers:new Ms})))):r1.is(n.type)&&(a.perspective={},a.orthographic={}),a},r.toOps=function(n,s){let a,o=[],l={orthographic:0,perspective:0,geometry:0};function h(u,d){for(let[c,p]of Object.entries(d.layers)){let{texture:f,...m}=p;if(f!==void 0&&Object.keys(f).length>0){let g={path:[...u,"layers",c,"texture"],props:f,type:0};o.push(g)}if(Object.keys(m).length>0){let g={path:[...u,"layers",c],props:m,type:0};o.push(g)}}}for(let[u,d]of Object.entries(s)){let c=d;if(u!=="name")if(u==="cloner")o.push(...ZW.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,f]of Object.entries(c))h(["materials",p],f);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 a===void 0&&(a={path:[],props:{},type:0},o.push(a)),a.props[u]=c}return o},r.patch=function(n,s){if(s===void 0)return n;let a={...n};if(Object.assign(a,q1.merge(a,s)),Object.assign(a,{pathSnapping:Object.assign({},a.pathSnapping,{slide:s.pathSnapping?.slide??a.pathSnapping?.slide??0,offset:s.pathSnapping?.offset??a.pathSnapping?.offset??0})}),r1.is(n.type)){a.orthographic={...a.orthographic},a.perspective={...a.perspective};let o=s;o.orthographic?.zoom!==void 0&&(a.orthographic.zoom=o.orthographic.zoom),o.perspective?.zoom!==void 0&&(a.perspective.zoom=o.perspective.zoom),o.isUpVectorFlipped!==void 0&&(a.isUpVectorFlipped=o.isUpVectorFlipped),o.targetOffset!==void 0&&(a.targetOffset=o.targetOffset)}else if(n.type==="Mesh")"geometry"in s&&Object.assign(a,{geometry:VL.merge(a.geometry,s.geometry)}),(s.material||s.materials)&&(a=function(o,l){if(l===void 0)return o;let h={...o};return"material"in h&&"material"in l&&l.material&&(h.material=ML(h.material,u=>{if(typeof u!="string")for(let[d,c]of Object.entries(l.material.layers)){let p=u.layers.data(d);p&&rs.patch(p,c)}}).data),h.materials&&l.materials&&(h.materials=ML(h.materials,u=>{for(let d=0;d<h.materials.length;d++){let c=l.materials[d];if(typeof c!="string")for(let[p,f]of Object.entries(c.layers)){let m=u[d]?.layers?.data(p);m&&rs.patch(m,f)}}}).data),h}(a,s)),a.cloner&&"cloner"in s&&Object.assign(a,{cloner:Ig.merge(a.cloner,s.cloner)});else if(n.type==="Empty")a.cloner&&"cloner"in s&&Object.assign(a,{cloner:Ig.merge(a.cloner,s.cloner)});else if(JW.is(n.type)){let o=s;o.intensity!==void 0&&(a.intensity=o.intensity),o.color!==void 0&&(typeof o.color=="string"?a.color=o.color:a.color=Ks.clone(o.color))}return a}})(Og||(Og={}))}),MY=U(()=>{(HL||(HL={})).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}}),vB=U(()=>{MY(),th(),(Ef||(Ef={})).defaultData={orbitControls:HL.defaultData,playPage:Mx,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}}),Mbe=U(()=>{var e;(l5||(l5={})).defaultData={id:"basic",label:"Basic",style:"None",prompt:""},(h5||(h5={})).defaultData={weather:0,shadows:0,lightOrigin:0,temperature:0,sun:0,camera:0,environment:0,particles:0,nature:0,floor:0},(e=ty||(ty={})).defaultData=()=>({mode:"line-art-both",prompt:"",negativePrompt:"",style:{...l5.defaultData},isRandomSeed:!0,seed:e.generateSeed(),guessMode:!1,advanced:!1,steps:20,guidanceScale:7.5,controlNetScale:1,modifiers:h5.defaultData}),e.generateSeed=()=>Math.round(1e5*Math.random())}),EY=U(()=>{gB(),Or(),vB(),th(),la(),Mbe(),(e=>{function t(i,r){let n=i.scene.objects.get(r);if(n&&n.data.type==="Component")return n;{let s=i.shared.lib.components[r];if(s)return{...s.asset,id:r}}}e.physicsEnabled=function(i){return i.find(r=>r.data.type==="Page"&&r.data.globalPhysics.usePhysics)!==void 0},e.findTimeline=function(i,r){let n=i.find(s=>s.data.type==="Page"&&s.data.timelines?.[r]!==void 0);return n&&n.data.timelines?.[r]},e.getComponentData=t,e.traverseModuleInstances=function(i,r,n){i.scene.objects.traverseFrom(r,(s,a)=>{if(a.type==="Instance"){let o=t(i,a.component)?.data;o&&n(s,a,o.events)}else n(s,a,a.events)})}})(n1||(n1={})),(e=>{function t(r=!0,n=[]){let s=[];r&&s.push({...e.defaultLight}),s.push(...n);let a=new Aa;return a.push({fi:1,id:Mx,data:{...by.defaultData,name:"Scene 1"},children:s}),a}function i(r){return{...e.defaultData,objects:jo(r,Aa.prototype)}}e.TRASH_CAN_ID="830a2708-8ed9-49cf-a68e-085299892222",e.defaultLight={fi:-1,data:jL.defaultDirectionalLightData,id:"830a2708-8ed9-49cf-a68e-085299899103",children:[]},e.createDefaultObjectTreeWithPage=t,e.defaultData={objects:t(),publish:Ef.defaultData,styles:ty.defaultData()},e.emptyDataWithoutPage=function(){return{objects:new Aa,publish:Ef.defaultData,styles:ty.defaultData()}},e.emptyDataWithPage=function(r=!0){return{objects:t(r),publish:Ef.defaultData,styles:ty.defaultData()}},e.emptyData=function(){return{objects:new Aa,publish:{...Ef.defaultData},styles:ty.defaultData()}},e.withObjs=i,e.withObj=function(r,n){return i([{id:r,data:n,children:[],fi:0}])}})(iy||(iy={}))}),Ebe=U(()=>{(OE||(OE={})).defaultData={preset:"fullscreen",allowResponsive:!1,size:[512,512],coords:[0,0],sceneScale:1,color:{r:0,g:0,b:0,a:.5}}}),AY=U(()=>{var e,t;Or(),la(),(e=aH||(aH={})).defaultData=i=>({url:i,name:"New Webhook",parametersSchemas:new Ct}),e.defaultParameterValueByType=i=>i==="number"?0:i!=="boolean"&&"",(Kte||(Kte={})).defaultData=(i,r="GET")=>({url:i,method:r,name:"New API",headers:new Ct,queries:new Ct,autoStart:!0}),(i=>{function r(s){return s.textValue!==void 0}function n(s){return typeof s=="boolean"}i.isTextValue=r,i.isNumber=function(s){return typeof s=="number"},i.isBoolean=n,i.typeOfVariable=function(s){return r(s)?"string":n(s)?"boolean":"number"},i.getDisplayedValue=function(s){return i.isTextValue(s)?Array.isArray(s.textValue)?s.textValue.map(a=>a.toString().padStart(s.padding??2,"0")).join(s.deliminator??":")+(s.suffix!==void 0?" "+s.suffix:""):s.textValue.toString():i.isBoolean(s)?s?"True":"False":i.isNumber(s)?parseFloat(s.toFixed(3)).toString():s.toString()}})(Mo||(Mo={})),(u5||(u5={})).all=["images","videos","colors","audios","particles","fonts","materials","variables"],(Zte||(Zte={})).all=[...u5.all,"components"],(Qte||(Qte={})).defaultData=function(){return{images:new si,videos:new si,colors:new si,audios:new si,particles:new si,fonts:new si,materials:new si,components:new si,variables:new si,userAPIs:new si,userWebhooks:new si}},(mf||(mf={})).defaultData=function(){return{images:new si,videos:new si,colors:new si,audios:new si,particles:new si,fonts:new si,materials:new si,components:new si,variables:new si,userAPIs:new si,userWebhooks:new si}},(t=gu||(gu={})).defaultColors=function(){return jo({"89b10010-844c-11ec-a8a3-0242ac120002":{r:.5,g:.5,b:.5,a:1,name:"Default Color"}},si.prototype)},t.defaultImages=function(){return jo({},si.prototype)},t.emptyData=function(){return{catelogs:new si,materials:new si,images:new si,videos:new si,colors:new si,audios:new si,particles:new si,fonts:new si,variables:new Ct,userAPIs:new si,userWebhooks:new si,lib:mf.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),s=Math.floor((i-3600*n)/60);return{textValue:[n,s,Math.round(i-3600*n-60*s)]}}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}}),w4e=U(()=>{}),Abe=U(()=>{var e;Or(),EY(),Ebe(),AY(),(e=Cx||(Cx={})).defaultData={schema:135,scene:iy.defaultData,frames:new si().add("72fc2993-2da3-4b6b-96ac-2879db3a28bd",OE.defaultData),shared:{...gu.emptyData(),colors:gu.defaultColors()}},e.createDefaultData=function(){return MA.deserialize(MA.serialize(e.defaultData))},e.emptyDataForImports=function(){return{schema:135,scene:iy.emptyDataWithPage(),frames:new si().add("72fc2993-2da3-4b6b-96ac-2879db3a28bd",OE.defaultData),shared:{...gu.emptyData(),colors:gu.defaultColors(),images:gu.defaultImages()}}},e.emptyData=function(){return{schema:135,scene:iy.emptyDataWithPage(),frames:new si().add("72fc2993-2da3-4b6b-96ac-2879db3a28bd",OE.defaultData),shared:gu.emptyData()}},e.clipboard2dData=function(){return{schema:135,scene:iy.emptyData(),frames:new si,shared:gu.emptyData()}},e.withoutLib=function(t){return{...t,shared:{...t.shared,lib:mf.defaultData()}}},e.getComponentData=function(t,i){return n1.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 s of n)if(s.data.key.toLowerCase()==="authorization"&&s.data.value!=="")return!0}return!1}});function qf(e,t=[0,0]){return[e&&!isNaN(e[0])?e[0]:t[0],e&&!isNaN(e[1])?e[1]:t[1]]}function kS(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??{...nw.defaultData};return`cubicBezier( ${r[0]}, ${r[1]}, ${n[0]}, ${n[1]} )`}case 6:{let{mass:r,stiffness:n,damping:s,velocity:a}=i??{...Ng.defaultData},o=new Cbe(r,n,s,a),l=o.solve(1);return()=>h=>o.solve(h)/l}case 8:return()=>r=>Math.floor(r)}}var Jte,eie,Wg,PA,Cbe,qL,$L,CY=U(()=>{Or(),th(),(Jte||(Jte={})).defaultData=function(e,t){return{id:e,name:t,duration:5,objectTimelines:new si}},(eie||(eie={})).is=function(e){return e&&typeof e.x=="number"&&typeof e.y=="number"&&typeof e.z=="number"},(e=>{function t(u,d){let c=[0,0],p=[1,1];if(u?.cubicControls)c=qf(u.cubicControls.control1,c);else switch(u?.type){case 2:case 4:c=[.42,0];break;case 3:case 0:c=[0,0];break;case 1:c=[.25,.1];break;case 7:c=[.25,1]}if(d?.cubicControls)p=qf(d.cubicControls.control2,p);else switch(d?.type){case 2:case 0:p=[1,1];break;case 3:case 4:p=[.58,1];break;case 1:p=[.25,1];break;case 7:p=[.5,1]}return{control1:c,control2:p}}function i(u){if(!e.BEZIER_PRESETS.includes(u))return;let d={type:u};return{control1:t(d).control1,control2:t(void 0,d).control2}}function r(u,d){return Math.abs(u[0]-d[0])<.001&&Math.abs(u[1]-d[1])<.001}function n(u){let d=e.ROOT_PROPERTY_ORDER.indexOf(u[0]);return d===-1?e.ROOT_PROPERTY_ORDER.length:d}function s(u){return u.layerId??u.path.join(".")}function a(u){let d=u[u.length-1];return PA.includes(d)?d:void 0}function o(u){return u.layerId?u.layerId:(a(u.path)?u.path.slice(0,-1):u.path).join(".")}function l(u){return["material",u.type==="light"?`${u.category} lighting`:u.type]}function h(u,d,c){return{id:u,data:{id:u,time:c?.time??0,path:d,value:{},layerId:c?.layerId,index:c?.index,isPlaceholder:!0,easing:{type:5,cubicControls:{control1:[.42,0],control2:[.58,1]}}}}}e.getControlsWithDefault=t,e.BEZIER_PRESETS=[0,1,2,3,4,7],e.presetHandles=i,e.presetForHandles=function(u){return e.BEZIER_PRESETS.find(d=>{let c=i(d);return c!==void 0&&r(c.control1,u.control1)&&r(c.control2,u.control2)})},e.defaultData=function(u){return{id:u,keyframes:new Ct}},e.ROOT_PROPERTY_ORDER=["position","rotation","scale","shape size","material","opacity","camera","light","cloner","path extrusion","path snapping"],e.rowOrder=n,e.propertyKey=s,e.groupKeyframes=function(u,d){let c=new Map;for(let p of u){let f=p.data;if(d?.(f))continue;let m=s(f),g=c.get(m);g||(g={id:m,path:f.path,keyframes:[],layerId:f.layerId,index:f.index},c.set(m,g)),f.isPlaceholder?g.placeholder=p.id:g.keyframes.push(p)}return[...c.values()].sort((p,f)=>{let m=n(p.path)-n(f.path);return m!==0?m:(p.index??0)-(f.index??0)})},e.rowAxis=a,e.drawnRowKey=o,e.drawnRows=function(u){let d=new Map;for(let c of u){let p=a(c.path),f=p?c.path.slice(0,-1):c.path,m=o(c),g=d.get(m);g||(g={id:m,path:f,layerId:c.layerId,index:c.index,tracks:[]},d.set(m,g)),g.tracks.push({axis:p,property:c})}return[...d.values()]},e.sortedKeyframes=function(u){return[...u].sort((d,c)=>d.data.time-c.data.time)},e.materialLayerPath=l,e.createMaterialGroup=function(u,d){return u.map(({data:c,id:p},f)=>h(d(),l(c),{layerId:p,index:f}))},e.placeholderKeyframe=h,e.createName=function(u){return Object.entries(u).reduce((d,[c,p])=>(typeof p!="string"&&d.push({name:p.name}),d),[])},e.Presets=[{name:"Slide in",animationParams:{translateX:{value:[-20,0],easing:kS(3),duration:1e3},opacity:{value:[0,1],easing:kS(3),duration:1e3},endDelay:250,loop:!0}},{name:"Rotate",animationParams:{rotate:{value:[0,"1turn"],easing:kS(5),duration:700},endDelay:250,loop:!0}},{name:"Scale Out",animationParams:{scale:{value:[1,1.5],easing:kS(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:kS(5),duration:500},endDelay:500,loop:!0}},{name:"Bounce",animationParams:{translateY:{value:["20px","-20px"],duration:575,easing:"easeOutQuad"},direction:"alternate",loop:!0}}]})(Wg||(Wg={})),PA=["x","y","z"],Cbe=class{constructor(e=1,t=100,i=10,r=0){this.mass=e,this.stiffness=t,this.damping=i,this.initialVelocity=r,this.m_w0=Math.sqrt(t/e),this.m_zeta=i/(2*Math.sqrt(t*e)),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-r)/this.m_wd):(this.m_wd=0,this.m_A=1,this.m_B=-r+this.m_w0)}solve(e){return 1-(this.m_zeta<1?Math.exp(-e*this.m_zeta*this.m_w0)*(this.m_A*Math.cos(this.m_wd*e)+this.m_B*Math.sin(this.m_wd*e)):(this.m_A+this.m_B*e)*Math.exp(-e*this.m_w0))}getDuration(){let e=.16666666666666666,t=0,i=0;for(;;)if(t+=e,this.solve(t)===1){if(i++,i>=16)break}else i=0;return t*e*1e3}}}),PY=U(()=>{var e;th(),Or(),(qL||(qL={})).list=["idle","move","jump","run"],(e=$L||($L={})).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 Ct,move:new Ct,jump:new Ct,run:new Ct},navmesh:{enabled:!1,ch:6,cs:6,walkableClimb:5,walkableHeight:1,walkableRadius:0,zones:"all",objects:[],helperVisible:!0,destinationHelperRadius:0,destinationHelperColor:Gr.fromHexAndA(3728051,1)}}});function Uv(e,...t){let i={};for(let r of t.flat())e!=null&&r in e&&(i[r]=e[r]);return i}function tie(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]],s=[0,1];for(let o=2;o<10;o++)n.push(n[1]),s.push(1);let a={...Uv(Os(t),"type","visible","isVector","isWorldSpace","origin","alpha","mode"),near:Math.max(0,t.near),far:Math.max(0,t.far),colors:n,steps:s,num:2,direction:[1,0,0],smooth:!1,gradientType:1};Object.assign(t,a)}else if(t.type==="depth"&&t.gradientType===1&&(t.near<0||t.far<0)){let i={...Os(t),near:Math.max(t.near,0),far:Math.max(t.far,0)};Object.assign(t,i)}})}function Jp(e,t){Object.values(e.shared.materials).forEach(i=>t(i))}function ef(e,t){e.scene.objects.traverse((i,r)=>{"materials"in r?r.materials.forEach((n,s)=>{n===void 0&&(r.materials[s]=Kn.defaultTwoLayerData("phong"),n=r.materials[s]),typeof n!="string"&&t(n)}):"material"in r?typeof r.material!="string"&&(r.material===void 0&&(r.material=Kn.defaultTwoLayerData("phong")),t(r.material)):r.type==="Mesh"&&(r.material===void 0&&(r.material=Kn.defaultTwoLayerData("phong")),t(r.material)),"overrides"in r&&Object.values(r.overrides).forEach(n=>{n.material&&typeof n.material!="string"&&Object.getPrototypeOf(n.material)!==Ms.prototype&&t(n.material)})})}function iie(e){e.layers===void 0&&Object.assign(e,Kn.defaultTwoLayerData("lambert"))}function d5(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={...Os(t),colors:i,steps:r};Object.assign(t,n)}})}function rie(e){e.scene.objects.traverse((t,i)=>{"materials"in i?i.materials.forEach(r=>{typeof r!="string"&&d5(r)}):"material"in i&&typeof i.material!="string"&&d5(i.material)}),Object.values(e.shared.materials).forEach(t=>d5(t))}function nie(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 sie(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 aie(e){let t=e.layers.find(i=>i.type==="light")?.data;if(t?.category==="basic"){let i=rs.defaultData("light","phong"),r=t;Object.assign(r,i),r.visible=!1}}function oie(e){Jp(e,aie),ef(e,aie)}function lie(e){e.layers.forEach(t=>{t.type==="light"&&t.category!=="toon"&&t.occlusion===void 0&&(t.occlusion=!0)})}function hie(e){e.layers&&e.layers.forEach(t=>{t.type==="light"&&t.bumpMapIntensity===void 0&&(t.bumpMapIntensity=5)})}var S4e=U(()=>{ZA(),th(),MY(),gB(),Or(),vB(),la(),ae(),wY(),PY(),Mbe(),EY(),xY(),TY()});function Pbe(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 Rbe(){let e=Math.max(cd.lengthSq(),pd.lengthSq(),Cc.lengthSq());cd.lengthSq()>FM*e?Eh.copy(cd).normalize():Eh.set(1,0,0),Ah.crossVectors(Cc,Eh),Ah.lengthSq()<=FM*e&&(Ah.copy(pd).addScaledVector(Eh,-pd.dot(Eh)),Ah.lengthSq()<=FM*e&&function(t,i){t.set(1,0,0).cross(i),t.lengthSq()<=FM&&t.set(0,1,0).cross(i),t.normalize()}(Ah,Eh)),Ah.normalize(),ry.crossVectors(Eh,Ah)}function Dbe(e,t,i){return Pbe(e),Rbe(),t.makeBasis(Eh,Ah,ry),i.set(Eh.dot(cd),Eh.dot(pd),Eh.dot(Cc),0,Ah.dot(cd),Ah.dot(pd),Ah.dot(Cc),0,ry.dot(cd),ry.dot(pd),ry.dot(Cc),0,0,0,0,1),function(){let r=cd.length(),n=pd.length(),s=Cc.length(),a=Math.max(r,n,s);if(a-r>UM||a-n>UM||a-s>UM)return!0;let o=UM*a*a;return Math.abs(cd.dot(pd))>o||Math.abs(cd.dot(Cc))>o||Math.abs(pd.dot(Cc))>o}()}function Nbe(e){return Pbe(e),Rbe(),Ibe.makeBasis(Eh,Ah,ry)}var cd,pd,Cc,Eh,Ah,ry,Ibe,FM,UM,yB=U(()=>{ae(),cd=new R,pd=new R,Cc=new R,Eh=new R,Ah=new R,ry=new R,Ibe=new Ue,FM=1e-12,UM=.01});function $1(e,t){return t===0?0:e/t}function RY(e){Dbe(e,lH,oH),nx.setFromRotationMatrix(lH);let t=function(r,n,s){let a=2*Math.PI,o=d=>d-a*Math.round(d/a),l=o(r+Math.PI),h=o(Math.PI-n),u=o(s+Math.PI);return Math.abs(l)+Math.abs(u)<Math.abs(r)+Math.abs(s)-1e-9?[l,h,u]:[r,n,s]}(nx.x,nx.y,nx.z),i=oH.elements;return{position:[e.elements[12],e.elements[13],e.elements[14]],rotation:[t[0]*et.RAD2DEG,t[1]*et.RAD2DEG,t[2]*et.RAD2DEG],scale:[i[0],i[5],i[10]],shear:[$1(i[4],i[5]),$1(i[8],i[10]),$1(i[1],i[0]),$1(i[9],i[10]),$1(i[2],i[0]),$1(i[6],i[5])]}}function Af(e,{translation:t,quaternion:i,scale:r,shearMatrix:n}={}){let s=RY(e);if(t!==void 0&&t.fromArray(s.position),i!==void 0){let a=s.rotation;i.setFromEuler(nx.set(a[0]*et.DEG2RAD,a[1]*et.DEG2RAD,a[2]*et.DEG2RAD))}r!==void 0&&r.fromArray(s.scale),n!==void 0&&n.fromArray(Dh.toMatrix(s.shear))}var oH,lH,nx,QA=U(()=>{ae(),yB(),cxe(),oH=new Ue,lH=new Ue,nx=new Dr});function Obe(e){return e.length>=4&&function(t){return typeof t=="object"&&t!==null&&t.v===1&&t.data instanceof Float32Array&&Array.isArray(t.tracks)}(e[3])}function Lbe(e,t,i){let r={name:t,duration:i.duration,tracks:[],uuid:e};return i.blendMode!==void 0&&(r.blendMode=i.blendMode),JSON.stringify(r)}function T4e(e,t,i){for(let r=0;r<i.length;r++)if(!Object.is(e[t+r],i[r]))return!1;return!0}function M4e(e){if(!Array.isArray(e)||e.length>3)return e;let t,[i,r,n]=e;if(typeof i!="string"||typeof n!="string")return e;try{t=JSON.parse(n)}catch{return e}return t&&Array.isArray(t.tracks)&&!t.tracks.some(s=>!s?.type||!s.times||!s.values)?function(s,a,o){let l=[],h=0,u=g=>{let v=[h,g.length];return l.push(g),h+=g.length,v},d=new Map,c=o.tracks.map(g=>{let v=(b=>{let x=Float32Array.from(b),w=x.length+":"+x[0]+":"+x[x.length-1],S=d.get(w)??[];for(let M of S)if(T4e(M.run,0,x))return M.span;let T=u(x);return S.push({span:T,run:x}),d.set(w,S),T})(g.times),y=!Bbe.has(g.type),_={name:g.name,type:g.type,times:v,values:y?u(Float32Array.from(g.values)):[0,0]};return y||(_.list=Array.from(g.values)),g.interpolation!==void 0&&(_.interpolation=g.interpolation),_}),p=new Float32Array(h),f=0;for(let g of l)p.set(g,f),f+=g.length;let m={v:1,duration:o.duration,data:p,tracks:c};return o.blendMode!==void 0&&(m.blendMode=o.blendMode),o.userData!==void 0&&o.userData!=="{}"&&(m.userData=o.userData),[s,a,Lbe(s,a,m),m]}(i,typeof t.name=="string"?t.name:r,t):e}function E4e(e,t,i){return e.map(r=>{let n=t();return i[r[0]]=n,function(s,a){let[o,l,h]=s;if(Obe(s))return[a,l,Lbe(a,l,s[3]),s[3]];let u=h.indexOf(o);return[a,l,u!==-1?h.slice(0,u)+a+h.slice(u+o.length):h,...s.slice(3)]}(r,n)})}var Bbe,Fbe=U(()=>{Bbe=new Set(["bool","string"])});function b3(e,[t,i]){return Math.min(Math.max(e,t),i)}function Ube(e,t,i,r,n){e=b3(e,jbe),t=b3(t,Wbe),i=b3(i,Hbe),r=b3(r,qbe);let s=Math.sqrt(t/e),a=i/(2*Math.sqrt(t*e)),o=a<1?s*Math.sqrt(1-a*a):0,l=a<1?(a*s-r)/o:-r+s;return h=>{let u=n!==void 0?n*h:h;return u=a<1?Math.exp(-u*a*s)*(1*Math.cos(o*u)+l*Math.sin(o*u)):(1+l*u)*Math.exp(-u*s),h===0||h===1?h:1-u}}function zbe(e,t){return Ui(Ui(1-Ui(3*t))+Ui(3*e))}function kbe(e,t){return Ui(Ui(3*t)-Ui(6*e))}function Vbe(e){return Ui(3*e)}function x3(e,t,i){return Ui(Ui(Ui(Ui(Ui(zbe(t,i)*e)+kbe(t,i))*e)+Vbe(t))*e)}function uie(e,t,i){let r=Ui(Ui(Ui(3*zbe(t,i))*e)*e),n=Ui(Ui(2*kbe(t,i))*e);return Ui(Ui(r+n)+Vbe(t))}function X1(e,t,i,r){if(e=Ui(e),t=Ui(t),i=Ui(i),r=Ui(r),e<0||e>1||i<0||i>1||e===t&&i===r)return Zbe;let n=new Float32Array(kI);for(let s=0;s<kI;s++)n[s]=x3(Ui(s*zM),e,i);return s=>(s=Ui(s))===0||s===1?s:x3((a=>{let o=0,l=1,h=kI-1;for(;l!==h&&n[l]<=a;)o=Ui(o+zM),l+=1;l-=1;let u=Ui(Ui(a-n[l])/Ui(n[l+1]-n[l])),d=Ui(o+Ui(u*zM)),c=uie(d,e,i);return c>=Xbe?function(p,f,m,g){for(let v=0;v<$be;v++){let y=uie(f,m,g);if(y===0)return f;let _=Ui(x3(f,m,g)-p);f=Ui(f-Ui(_/y))}return f}(a,d,e,i):c===0?d:function(p,f,m,g,v){let y,_=0,b=0;do _=Ui(f+Ui(Ui(m-f)/2)),y=Ui(x3(_,g,v)-p),y>0?m=_:f=_,b+=1;while(Math.abs(y)>Ybe&&b<Kbe);return _}(a,o,Ui(o+zM),e,i)})(s),t,r)}function Gbe(e,t,i){switch(e.easing){case 0:default:return i;case 1:return X1(.25,.1,.25,1)(i);case 2:return X1(.42,0,1,1)(i);case 3:return X1(0,0,.58,1)(i);case 4:return X1(.42,0,.58,1)(i);case 7:return X1(.25,1,.5,1)(i);case 8:return Math.floor(i);case 5:{let{control1:r,control2:n}=e;return r&&n?X1(r[0],r[1],n[0],n[1])(i):i}case 6:{let{mass:r,stiffness:n,damping:s,velocity:a}=e;return r===void 0||n===void 0||s===void 0||a===void 0?i:Ui(Ube(r,n,s,a,t)(i))}}}var Ui,jbe,Wbe,Hbe,qbe,$be,Xbe,Ybe,Kbe,kI,zM,Zbe,die,A4e=U(()=>{Ui=Math.fround,jbe=[.01,100],Wbe=[.01,1e4],Hbe=[.01,1e3],qbe=[.01,1e3],$be=4,Xbe=Ui(.001),Ybe=Ui(1e-7),Kbe=10,zM=Ui(1/((kI=11)-1)),Zbe=e=>e,die=Ui(1.70158),Ui(die+1)});function Qbe(e,t){if(e.length===0)throw new Error("sampleKeyframes requires at least one keyframe");if(t<=e[0].time)return{index0:0,index1:0,t:1};let{found:i,index:r}=function(h,u){let d=h.length,c=0,p=d;for(;c<p;){let f=c+Math.floor(d/2),m=h[f].time;if(m<u)c=f+1;else{if(!(m>u))return{found:!0,index:f};p=f}d=p-c}return{found:!1,index:c}}(e,t);if(i)return{index0:r,index1:r,t:1};if(r>=e.length){let h=e.length-1;return{index0:h,index1:h,t:1}}let n=r-1,s=r,a=e[n].time,o=e[s].time;if(o===a)return{index0:n,index1:s,t:.5};let l=VI(o-a);return{index0:n,index1:s,t:Gbe({...e[n].ease,control2:e[s].ease.control2},l,VI(VI(t-a)/l))}}function Jbe(e){return[...e].sort((t,i)=>t.time-i.time)}var VI,C4e=U(()=>{A4e(),VI=Math.fround});function P4e(e){if(e?.length!==2)return;let t=`${e[0]}.${e[1]}`;return DY.includes(t)?t:void 0}function exe(e){return e.slice(0,e.indexOf("."))}function txe(e){return Hg.indexOf(e.slice(-1))}function R4e(e){return{easing:e?.type,control1:qf(e?.cubicControls?.control1,[0,0]),control2:qf(e?.cubicControls?.control2,[1,1]),...e?.springParameters}}function D4e(e){let t=e?.cubicControls;return{...e,cubicControls:{control1:[...t?.control1??[0,0]],control2:[...t?.control2??[1,1]]},...e?.springParameters?{springParameters:{...e.springParameters}}:{}}}function cie(e,t,i){let r=exe(e);if(r==="position"){let n=txe(e);return Hg.flatMap((s,a)=>Math.abs(t.elements[4*a+n])>1e-9?[`position.${s}`]:[])}return(i?[r]:["rotation","scale"]).flatMap(n=>Hg.map(s=>`${n}.${s}`))}function N4e(e,t){let[i,r,n]=e,s=[[i,r,n],[i+180,180-r,n+180]],a=[i,r,n],o=1/0;for(let l of s){let h=l.map((d,c)=>d+360*Math.round((t[c]-d)/360)),u=h.reduce((d,c,p)=>d+Math.abs(c-t[p]),0);u<o-1e-9&&(a=h,o=u)}return a}function I4e(e,t,i){if(e==="rotation"){let r=((t-i)%360+540)%360-180;return Math.abs(r)<1e-6}return Math.abs(t-i)<1e-9*Math.max(1,Math.abs(t),Math.abs(i))}function O4e(e,t,i,r){let n=new Map;for(let{id:p,data:f}of e.unproxy()){if(f.isPlaceholder)continue;let m=P4e(f.path);if(!m){if(kM.includes(f.path?.[0]))return;continue}if(typeof f.value!="number"||!Number.isFinite(f.value))return;let g=n.get(m)??{keys:[],sampled:[]};g.keys.push({id:p,time:f.time,value:f.value,keyframe:f}),n.set(m,g)}if(n.size===0)return;for(let p of n.values())p.keys.sort((f,m)=>f.time-m.time),p.sampled=Jbe(p.keys.map(f=>({time:f.time,ease:R4e(f.keyframe.easing),value:f.value})));let s=(p,f)=>{let m=n.get(p);return m?function(g,v){let{index0:y,index1:_,t:b}=Qbe(g.sampled,v),x=g.sampled[y].value;return x+(g.sampled[_].value-x)*b}(m,f):i[exe(p)][txe(p)]},a=new jt,o=new Dr,l=new Ue,h=new R,u=new R,d=p=>{let f=(m=>{let g={};for(let v of kM)g[v]=Hg.map((y,_)=>s(DY[3*kM.indexOf(v)+_],m));return g})(p);return o.set(f.rotation[0]*et.DEG2RAD,f.rotation[1]*et.DEG2RAD,f.rotation[2]*et.DEG2RAD),l.compose(h.fromArray(f.position),a.setFromEuler(o),u.fromArray(f.scale)).premultiply(t),{pose:f,out:RY(l)}},c=function(p){let f=p.elements,m=[0,4,8].map(y=>new R(f[y],f[y+1],f[y+2])),g=m[0].lengthSq(),v=1e-9*Math.max(1,g);return Math.abs(m[1].lengthSq()-g)<v&&Math.abs(m[2].lengthSq()-g)<v&&Math.abs(m[0].dot(m[1]))<v&&Math.abs(m[0].dot(m[2]))<v&&Math.abs(m[1].dot(m[2]))<v}(t);for(let p of kM){let f,m=Hg.map(_=>`${p}.${_}`),g=_=>{let b=new Set;for(let x of cie(_,t,c))for(let w of n.get(x)?.keys??[])b.add(w.time);return[...b].sort((x,w)=>x-w)},v=[...new Set(m.flatMap(_=>g(_)))].sort((_,b)=>_-b),y=new Map;for(let _ of v){let{pose:b,out:x}=d(_),w=[...x[p]];p==="rotation"&&(w=N4e(w,f?f.out.map((S,T)=>S+b.rotation[T]-f.in[T]):b.rotation),f={in:b.rotation,out:w}),y.set(_,w)}m.forEach((_,b)=>{let x=n.get(_)?.keys??[],w=g(_),S=new Set(w);if(x.length!==0||!w.every(T=>I4e(p,y.get(T)[b],r[p][b]))){for(let T of x)S.has(T.time)||e.delete(T.id);for(let T of w){let M=y.get(T)[b],E=x.find(N=>N.time===T);if(E){let N=e.data(E.id);N&&(N.value=M);continue}let A=cie(_,t,c).sort((N,D)=>Number(D===_)-Number(N===_)).map(N=>n.get(N)?.keys.find(D=>D.time===T)).find(N=>N!==void 0),P=et.generateUUID();e.insertBefore(null,[{id:P,data:{id:P,time:T,path:[p,Hg[b]],value:M,easing:D4e(A.keyframe.easing),index:Wg.rowOrder([p])}}])}}})}}var kM,Hg,DY,L4e=U(()=>{ae(),CY(),C4e(),QA(),Hg=["x","y","z"],DY=(kM=["position","rotation","scale"]).flatMap(e=>Hg.map(t=>`${e}.${t}`))}),ixe={};function pie(e){e.layers&&e.layers.forEach(t=>{t.type==="light"&&t.alphaOverride===void 0&&(t.alphaOverride=1)})}function rxe(e){let t=e.geometry;t!==void 0&&hxe.has(t.type)&&t.extrusionVersion===void 0&&(t.extrusionVersion=1)}function nxe(e){if(e.type!=="Empty")return;let t=Os(e.animations);if(!Array.isArray(t))return;let i=t.map(M4e);i.some((r,n)=>r!==t[n])&&(e.animations=i)}function fie(e,t){let[i,r,n]=e,s=Math.cos(i),a=Math.sin(i),o=Math.cos(r),l=Math.sin(r),h=Math.cos(n),u=Math.sin(n),d=[o*h,s*u+a*h*l,a*u-s*h*l],c=Math.hypot(t[0],t[1],t[2])||1;return Math.abs((d[0]*t[0]+d[1]*t[1]+d[2]*t[2])/c)}function sxe(e){(function(i){i.rotation=i.rotation.slice(0,3).map(r=>r*og)})(e),e.type==="Page"&&function(i){let r=i.rotation.slice(0,3);(function(n,s){let a=Array.isArray(s)&&s.length>=3&&s.every(h=>typeof h=="number"&&Number.isFinite(h))?s:[0,1,0],o=fie(n,a),l=fie(n.map(h=>h*uxe),a);return Math.abs(o-l)<1e-6?n.some(h=>Math.abs(h)>Math.PI):l<o})(r,i.up)?i.rotation=r:i.rotation=r.map(n=>n*og)}(e.camera),e.states?.forEach(i=>{i.rotation===void 0||i.rotation===null||(i.rotation=i.rotation.slice(0,3).map(r=>r*og))});let t=e.geometry;t&&t.type==="SphereGeometry"&&(t.thetaLength=(t.thetaLength??180)*og),t&&t.type==="TorusGeometry"&&(t.arc=t.arc*og),t&&t.type==="PathGeometry"&&(t.extrusion.angle*=og,t.extrusion.twist*=og),e.type==="Mesh"&&e.geometry.type==="TextGeometry"&&(e.geometry.text={textValue:e.geometry.text}),Array.isArray(Os(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 B4e(e){e.scene.objects.traverse((t,i)=>{})}function F4e(e){let t=e.schema??104;t!==135&&(t<130&&(NY(e.asset),e.schema=130),t<135&&(IY(e.asset),e.schema=135))}function bc(e,t){t(e.data);for(let i of e.children)bc(i,t)}function axe(e){let t=e.schema??104;t!==135&&(t<105&&(bc(e.asset,sxe),e.schema=105),t<118&&(bc(e.asset,oxe),e.schema=118),t<121&&(bc(e.asset,dH),e.schema=121),t<130&&(bc(e.asset,i=>mie(i,NY)),e.schema=130),t<132&&(bc(e.asset,rxe),e.schema=132),t<133&&(bc(e.asset,i=>lxe(i,()=>{})),e.schema=133),t<134&&(bc(e.asset,nxe),e.schema=134),t<135&&(bc(e.asset,i=>mie(i,IY)),e.schema=135))}function hH(e,t){ef(e,t),Jp(e,t),Object.values(e.shared.lib.materials).forEach(i=>t(i.asset))}function NY(e){e.layers===void 0&&Object.assign(e,Kn.defaultTwoLayerData("phong"))}function IY(e){let t=OM(e),i=Kn.withRepairedLayers(t);i!==t&&(e.layers=i.layers)}function mie(e,t){"materials"in e?e.materials.forEach(i=>{i!==void 0&&typeof i!="string"&&t(i)}):"material"in e&&e.material!==void 0&&typeof e.material!="string"&&t(e.material)}function oxe(e){e.timelineAnimations=jo({},si.prototype)}function U4e(e){let t=[];return e?(e.forEach((i,r)=>{let{path:n,keyframes:s}=i.data,a=n[0]==="material"?i.id:void 0;s?.length?s.forEach(({id:o,data:l})=>{t.push({id:o,data:{...l,path:n,layerId:a,index:r}})}):t.push(Wg.placeholderKeyframe(i.id,n,{layerId:a,index:r}))}),t.sort((i,r)=>i.data.time-r.data.time),new Ct(...t.map((i,r)=>({...i,fi:r})))):new Ct}function z4e(e){for(let{id:t,data:i}of[...e.unproxy()]){let r=i.path?.[0];if(!r||!dxe.includes(r))continue;let n=uH(i.value);if(!n.length)continue;let s=e.data(t);if(!s)continue;let a=i.value,[o,...l]=n;for(let h of l){let u=et.generateUUID();e.insertBefore(null,[{id:u,data:{...i,id:u,path:[r,h],value:a[h],easing:k4e(i.easing)}}])}s.path=[r,o],s.value=a[o]}}function uH(e){return e===null||typeof e!="object"?[]:PA.filter(t=>t in e)}function k4e(e){let t=e?.cubicControls;return{...e,cubicControls:{control1:[...t?.control1??[0,0]],control2:[...t?.control2??[1,1]]},...e?.springParameters?{springParameters:{...e.springParameters}}:{}}}function V4e(e,t){return Math.abs(e[0]-t[0])<1e-6&&Math.abs(e[1]-t[1])<1e-6}function G4e(e){let t=function(s){let a=[];for(let o of Wg.groupKeyframes(s)){let l=new Set(o.keyframes.flatMap(u=>uH(u.data.value))),h=l.size?[...l].map(u=>o.keyframes.filter(d=>uH(d.data.value).includes(u))):[o.keyframes];for(let u of h){let d=[...u].sort((c,p)=>c.data.time-p.data.time);for(let c=0;c+1<d.length;c++)a.push({left:d[c],right:d[c+1]})}}return a}([...e.unproxy()]),i=new Map,r=new Set;for(let{left:s,right:a}of t){let o=s.data.easing?.type,l=(o===void 0?void 0:Wg.presetHandles(o))?.control2??(o===5?qf(a.data.easing?.cubicControls?.control2,[1,1]):void 0);if(!l)continue;let h=i.get(a.id);h?V4e(h,l)||r.add(a.id):i.set(a.id,l)}let n=new Map;for(let{id:s,data:a}of e.unproxy()){let o=a.easing?.type,l=o===void 0?void 0:Wg.presetHandles(o);l&&n.set(s,l.control1)}for(let{left:s,right:a}of t)r.has(a.id)&&n.delete(s.id);for(let[s,a]of n){let o=e.data(s);!o?.easing||(o.easing.cubicControls={control1:a,control2:qf(o.easing.cubicControls?.control2,[1,1])},o.easing.type=5)}for(let{left:s,right:a}of t){if(!n.has(s.id))continue;let o=e.data(a.id),l=i.get(a.id);!o?.easing||!l||(o.easing.cubicControls={control1:qf(o.easing.cubicControls?.control1,[0,0]),control2:l})}}function gie(e,t){e.scene.objects.traverse((i,r)=>{let n=r;if(n.type==="Page"&&n.timelines)for(let s of Object.values(n.timelines))for(let a of Object.values(s.objectTimelines??{}))t(a.keyframes)})}function dH(e){e.pivot=[0,0,0],e.pivotRotation=[0,0,0]}function lxe(e,t,i=[]){let r=["position","rotation","scale","shear"];function n(c,p,f){return c?.map(m=>typeof m=="string"?t(m)??f:m)??[...p]}function s(c,p){if(c&&!function(f){return f.every((m,g)=>Math.abs(m-(g%5==0?1:0))<1e-6)}(c))return RY(new Ue().fromArray(c).multiply(new Ue().compose(new R().fromArray(p.position),new jt().setFromEuler(new Dr(p.rotation[0]*et.DEG2RAD,p.rotation[1]*et.DEG2RAD,p.rotation[2]*et.DEG2RAD)),new R().fromArray(p.scale))))}function a(c,p){return c.length===p.length&&c.every((f,m)=>f===p[m])}e.shear=Dh.zero;let o=e,l=o.hiddenMatrix;l!==void 0&&delete o.hiddenMatrix;let h={position:n(o.position,[0,0,0],0),rotation:n(o.rotation,[0,0,0],0),scale:n(o.scale,[1,1,1],1)},u=s(l,h);if(u&&Object.assign(o,u),u){let c=new Ue().fromArray(l);for(let p of i)O4e(p,c,h,u)}let d=u??{...h,shear:[...Dh.zero]};o.states?.forEach(c=>{let p=c.hiddenMatrix;if(p!==void 0&&delete c.hiddenMatrix,p===void 0&&c.position==null&&c.rotation==null&&c.scale==null)return;let f={position:n(c.position,h.position,0),rotation:n(c.rotation,h.rotation,0),scale:n(c.scale,h.scale,1)},m=s(p??l,f);if(!u&&!m)return;let g=m??{...f,shear:[...Dh.zero]};for(let v of r)(c[v]!=null||!a(g[v],d[v]))&&(c[v]=g[v])})}function j4e(e){}function W4e(e){let t=e.schema??0;if(t!==135){if(t>135)return void console.error(`This scene was created with a newer version of Spline (file format ${t}, this runtime reads 135). Update @splinetool/runtime to the latest version to load it correctly.`);console.warn("updating from ",t,"to ",135),function(i,r){if(r<1&&(ef(i,tie),Jp(i,tie),i.schema=1),r<2&&(function(n){Object.assign(n.scene.publish,{orbitControls:{...HL.defaultData,...Os(n.scene.publish.orbitControls)}})}(i),i.schema=2),r<3&&(function(n){function s(a){if(a.layers){for(let o of Object.values(a.layers))if(o){for(let[l,h]of Object.entries(o))if((mB.includes(l)||typeof h=="boolean")&&delete o[l],l==="texture")for(let[u,d]of Object.entries(h))(_Y.includes(u)||typeof d=="boolean")&&delete h[u]}}}n.scene.objects.traverse((a,o)=>{o.states.forEach(l=>{let h=l;h.material?s(h.material):h.materials&&h.materials.forEach(u=>{s(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((s,a)=>{let o=a.cloner;o&&(o.radial.scale=o.radial.scale.map(l=>l+1),o.linear.scale=o.linear.scale.map(l=>l+1))})}(i),i.schema=6),r<7&&(function(n){n.scene.objects.traverse((s,a)=>{let o=a.geometry;o&&(o.type==="DodecahedronGeometry"||o.type==="IcosahedronGeometry")&&(o.detail=Math.round(o.detail))})}(i),i.schema=7),r<8&&(i.schema=8),r<9&&(rie(i),i.schema=9),r<10&&(function(n){n.scene.objects.traverse((s,a)=>{a.type==="Mesh"&&(a.geometry.type==="BooleanGeometry"||a.geometry.type==="SubdivGeometry")&&(a.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((s,a)=>{(a.type==="DirectionalLight"||a.type==="SpotLight")&&(a.shadowResolution=1024,a.shadowRadius=1,a.depth=1e5)}),n.shared.penumbraSize=new Array(5).fill(.5)}(i),i.schema=11),r<12&&(rie(i),i.schema=12),r<13&&(function(n){n.shared.audios=jo({},si.prototype)}(i),i.schema=13),r<14&&(function(n){let s=n.shared.materials;Object.entries(s).forEach(([a,o])=>{if(!o.layers){let l={name:"Untitled Material",layers:[{fi:0,data:{type:"light",category:"phong",alpha:.6,visible:!0,mode:0,specular:{r:.2,g:.2,b:.2},shininess:5},id:"layer1"},{fi:1,data:{type:"color",alpha:1,visible:!0,mode:0,color:{r:.2823529411764706,g:.2823529411764706,b:.30196078431372547}},id:"layer2"}]};Object.assign(s,{[a]:l})}})}(i),i.schema=14),r<15&&(function(n){Object.entries(Os(n.shared.images)).filter(s=>s[1].asset===!1).map(s=>s[0]).forEach(s=>{delete n.shared.images[s]}),Object.entries(Os(n.shared.audios)).filter(s=>s[1].asset===!1).map(s=>s[0]).forEach(s=>{delete n.shared.audios[s]})}(i),i.schema=15),r<16&&(function(n){n.scene.publish.settings.web.preload=!1}(i),i.schema=16),r<17&&(ef(i,nie),Jp(i,nie),i.schema=17),r<18&&(ef(i,iie),Jp(i,iie),i.schema=18),r<19&&(function(n){Object.assign(n.scene.publish.settings,{video:{...Ef.defaultData.settings.video,...Os(n.scene.publish.settings.video)}})}(i),i.schema=19),r<20&&(function(n){n.shared.fonts=jo({},si.prototype)}(i),function(n){let s=[];n.scene.objects.traverse((a,o)=>{let l=o;if(l.type==="TextFrame"){let h=Kn.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(f){return f.replace(".typeface","").replace(/optimer/gi,"open sans").replace("space_mono","space mono").replace(/alma_mono/gi,"varela round").replace(/droid_sans_mono/gi,"noto sans mono").replace(/droid_sans|gentilis|gnomon_(simple|foreground)|helvetiker/gi,"roboto").replace(/droid_serif/gi,"roboto slab").replace("_sans"," sans").replace("crimson_text","crimson text").replace("medium_medium","medium").replace("fatface_fatface","fatface").replace("100hairline","thin").replace("200thin","extralight").replace("300light","light").replace("500medium","medium").replace("600semi","semibold").replace("800heavy","extrabold").replace("900black","black").replace(/bodoni_(11|16|24|36|48|72|96)([^_])/gi,"bodoni_$1_$2").replace(/bodoni_(11|16|24|36|48|72|96)/gi,"bodoni moda").replace(/(thin|hairline)(_regular)?/gi,"100").replace(/(extra|ultra)light(_regular)?/gi,"200").replace(/light(_regular)?/gi,"300").replace(/_book|_normal|_roman/gi,"_regular").replace(/medium(_regular)?/gi,"500").replace(/(semi|demi)bold(_regular)?/gi,"600").replace(/(extra|ultra)bold(_regular)?/gi,"800").replace(/bold(_regular)?/gi,"700").replace(/(black|heavy|fatface)(_regular)?/gi,"900").replace(/([1-9]00)_italic/gi,"$1italic").replace(/regularitalic/gi,"italic").replace(/regularitalic/gi,"italic").split(" ").map(m=>m.charAt(0).toUpperCase()+m.slice(1)).join(" ")}(l.font);n.shared.fonts[d]===void 0&&(n.shared.fonts[d]={name:d});let c={name:l.name,...na.defaultData,...xc.defaultData,flatShading:!1,wireframe:!1,geometry:{...ff.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:Os(l.states),events:Os(l.events),visible:l.visible,raycastLock:l.raycastLock,position:l.position,rotation:l.rotation,scale:l.scale,hiddenMatrix:l.hiddenMatrix},p=Os(n.scene.objects).parent(a);n.scene.objects.insertAfter(p??null,a,[{id:a+"new",data:c,children:[]}]),s.push(a)}}),s.forEach(a=>{n.scene.objects.delete(a)})}(i),i.schema=20),r<21&&(function(n){let s={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((a,o)=>{o.events.forEach(l=>{if(s[Number(l.type)])if(Object.assign(l,{type:s[Number(l.type)]}),l.type==="Audio"&&"audioEvent"in l&&(Object.assign(l,{playAudio:l.audioEvent}),delete l.audioEvent),l.type==="GameControl")Object.assign(l,{gameActions:{idle:new Ct,move:new Ct,jump:new Ct}});else{let h=new Ct;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:et.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,Uv(u,"mass","stiffness","damping","velocity")):u.easing===5&&Object.assign(p,{control1:{...u.control1},control2:{...u.control2}});let f={repeat:u.repeat?-1:0,delay:u.delay,delayDirection:u.delayDirection,direction:u.cycle&&u.rewind?"pingpong-rewind":u.cycle?"pingpong":"normal"},m={state:u.state,...f,...p},g={allowSlerp:!0,type:"Transition",object:u.object,repeat:0,delay:0,delayDirection:void 0,direction:"normal",tweens:new Ct({fi:0,id:et.generateUUID(),data:{state:void 0,repeat:0,delay:0,delayDirection:void 0,direction:"normal",duration:0,easing:4}},{fi:1,id:et.generateUUID(),data:m})};h.push({fi:c,id:d,data:g})}),delete l.targets)}})})}(i),function(n){n.scene.objects.traverse((s,a)=>{function o(l,h){let u=new Ct,d=[];if(a.events.forEach((c,p,f)=>{if(c.type==="Audio"&&c.trigger===h){let m;d.push(p),c.interaction==="play"?m={...Uv(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")&&(m={...Uv(c,"interaction","delay","object","playAudio"),type:"Audio"}),m&&u.push({fi:f,id:p,data:m})}}),d.forEach(c=>a.events.delete(c)),u.length){let c=a.events.find(p=>p.type===l)?.data;c?"actions"in c&&c.actions.insertBefore(null,u):a.events.insertBefore(null,[{id:et.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&&(oie(i),i.schema=22),r<23&&(function(n){n.scene.objects.traverse((s,a)=>{a.type==="Mesh"&&a.geometry.type==="SubdivGeometry"&&(a.geometry.scaleBaked||(a.geometry.scaleBaked=[1,1,1]))})}(i),i.schema=23),r<24&&(function(n){n.scene.objects.traverse((s,a)=>{(a.type==="Empty"||a.type==="Mesh")&&a.cloner&&!a.cloner.randomnessObject&&!a.cloner.toObject&&!a.cloner.randomness&&(a.cloner={...a.cloner,toObject:{object:"",spreadType:"random",scale:[0,0,0],rotation:[0,0,0],position:[0,0,0],axis:"x",seed:0,count:99,align:"normal"},randomness:!1,randomnessObject:{strength:100,scale:[0,0,0],rotation:[0,0,0],position:[0,0,0],movement:1,seed:0,freqScale:10,noiseType:"perlin"}})})}(i),i.schema=24),(r<25||i.shared.videos===void 0)&&(function(n){n.shared.videos=jo({},si.prototype)}(i),r<25&&(i.schema=25)),r<26&&(function(n){n.scene.objects.traverse((s,a)=>{let o=n.scene.objects.unproxy().parent(s);if(o){let l=Os(n.scene.objects.data(o));l&&l.type==="Mesh"&&l.geometry.type==="BooleanGeometry"&&a.type==="Mesh"&&(a.visible=Os(a).booleanExclude!==!0)}})}(i),i.schema=26),r<27&&(function(n){n.scene.objects.traverse((s,a)=>{if(a.type==="Mesh"){let o=a;a.geometry.type==="NonParametricGeometry"?o.material!==void 0&&delete o.material:o.materials!==void 0&&delete o.materials}})}(i),i.schema=27),r<28&&(oie(i),i.schema=28),r<29&&(function(n){function s(o){Object.setPrototypeOf(o,Ms.prototype),o.texture&&Object.setPrototypeOf(o.texture,Ms.prototype)}function a(o){Object.setPrototypeOf(o,Ms.prototype);for(let l in o)s(o[l])}n.scene.objects.traverse((o,l)=>{l.states.forEach(h=>{let u=h;if(u.material){let d=Os(u.material).layers;a(d),u.material.layers=d}if(u.materials)for(let d=0;d<u.materials.length;d++){let c=u.materials[d],p=Os(c).layers;a(p),c.layers=p}})})}(i),i.schema=29),r<30&&(function(n){n.scene.objects.traverse((s,a)=>{a.type==="Mesh"&&a.geometry.type==="NonParametricGeometry"&&!("material"in a)&&!("materials"in a)&&(a.material=Kn.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((s,a)=>{(a.type==="OrthographicCamera"||a.type==="PerspectiveCamera")&&(a.orthographic.autoZoom===void 0&&(a.orthographic.autoZoom=!1),a.orthographic.autoZoomFrustumSize===void 0&&(a.orthographic.autoZoomFrustumSize=790))})}(i),i.schema=31),r<33&&(function(n){n.scene.objects.traverse((s,a)=>{a.pathSnapping===void 0&&(a.pathSnapping={pathId:null,slide:0,offset:0,orientation:"tangential"}),a.pathSnapping.offset===void 0&&(a.pathSnapping.offset=0)})}(i),i.schema=33),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:s}=n.scene.publish.settings;s.format==="gif"&&s.fps>48&&(s.fps=15)}(i),i.schema=35),r<36&&(function(n){n.scene.objects.traverse((s,a)=>{a.events.forEach(o=>{o.type==="GameControl"&&(o.resetYPosition=Math.abs(o.resetYPosition-a.position[1]))})})}(i),i.schema=36),r<37&&(function(n){let s=n.scene.environment.usePhysics;n.scene.objects.traverse((a,o)=>{s&&o.physics===null?o.collision=!1:o.collision="visibility"})}(i),i.schema=37),r<38&&(ef(i,sie),Jp(i,sie),i.schema=38),r<39&&(function(n){n.scene.objects.traverse((s,a)=>{a.events.forEach(o=>{o.type==="GameControl"&&(o.navmesh=$L.defaultDataThirdPerson.navmesh)})})}(i),i.schema=39),r<40&&(function(n){n.scene.styles||(n.scene.styles=ty.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}),ef(n,lie),Jp(n,lie)}(i),i.schema=41),r<42&&(function(n){n.scene.objects.traverse((s,a)=>{a.events.forEach(o=>{o.type==="GameControl"&&Object.assign(o.gameActions,{run:new Ct})})})}(i),i.schema=42),r<43&&(function(n){n.scene.objects.traverse((s,a)=>{a.events.forEach(o=>{o.type==="GameControl"&&(o.keyAssignments=[...o.keyAssignments,["run","\u21E7"],["none","Ctrl"]])})})}(i),i.schema=43),r<99){ef(i,hie),Jp(i,hie),i.scene.publish.playCamera===null&&(i.scene.publish.playCamera=d1);let n=Os(i.scene.objects),s=i.scene.objects;i.scene.publish.playPage=Mx,s.insertBefore(null,null,[{id:Mx,data:{...by.defaultData,backgroundColor:i.scene.backgroundColor,fog:i.scene.fog,postprocessing:i.scene.postprocessing,ao:Uv(i.scene.environment.ambientLight,"occlusion","aoFullRes","radius","bias","aoColor"),publish:{playCamera:i.scene.publish.playCamera,gameControlObject:i.scene.publish.gameControlObject},shadow:Uv(i.scene.environment.ambientLight,"softShadowQuality"),globalPhysics:{...Ax.defaultData,...Uv(i.scene.environment,"usePhysics","gravity")},camera:Os(i.scene.ownerCamera)??by.defaultData.camera,name:"Scene"},children:[]}]);for(let l of n)l.id!==iy.TRASH_CAN_ID&&s.move(Mx,l.fi,l.id);let a=0,o=0;i.shared.penumbraSize&&i.scene.objects.traverse((l,h)=>{h.type==="DirectionalLight"?(h.penumbraSize=i.shared.penumbraSize[Math.min(a,2)],a+=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,Ex.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=Ef.defaultData.joystickSizeAndXYOffset),e.schema=100),t<101&&(ef(e,pie),Jp(e,pie),e.schema=101),t<102&&(function(i){i.scene.objects.traverse((r,n)=>{let s=n.geometry;s&&s.type==="PathGeometry"&&(s.extrusion.capType="flat",s.extrusion.bevel=50,s.extrusion.bevelSides=6,s.extrusion.shape.type==="Custom"&&(s.extrusion.shape.shapeQuality="low"))})}(e),e.schema=102),t<104&&(e.shared.catelogs=new si,e.shared.lib=mf.defaultData(),e.schema=104),t<105&&(function(i){i.shared.variables=jo({},si.prototype)}(e),e.scene.objects.traverse((i,r)=>{sxe(r)}),e.schema=105);for(let i of Object.values(e.shared.lib.components))axe(i);if(t<106&&(function(i){let r=Os(i.shared.variables);i.shared.variables=jo(Object.entries(r??{}).map(([n,s],a)=>({fi:a,id:n,data:s})),Ct.prototype)}(e),e.schema=106),t<107&&(e.shared.lib.variables=mf.defaultData().variables,e.schema=107),t<109&&(function(i){i.shared.particles=jo({},si.prototype),i.shared.lib&&(i.shared.lib.particles=mf.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(Os(n.events))&&n.events?.forEach(s=>{"disabled"in s||(s.disabled=!1),(s.type==="MouseDown"||s.type==="MouseUp"||s.type==="MousePress")&&(s.mode=s.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(Os(n.events))!==!1&&n.events?.forEach(s=>{let a=s.runMode;s.type==="MouseDown"||s.type==="MouseUp"||s.type==="KeyDown"||s.type==="KeyUp"||s.type==="Collision"||s.type==="Trigger"?s.actions?.forEach(o=>{o.type==="Transition"&&(o.runMode=a??"Repeat"),(o.type==="Animation"&&"runMode"in o||o.type==="SwitchCamera")&&(o.runMode=a==="Toggle"?"Toggle":"Normal")}):s.type==="MouseHover"||s.type==="MousePress"||s.type==="KeyPress"?s.actions?.forEach(o=>{(o.type==="Transition"||o.type==="Animation"&&"runMode"in o||o.type==="SwitchCamera")&&(o.runMode="Toggle")}):s.type==="GameControl"?(delete s.actions,Object.keys(s.gameActions).forEach(o=>{s.gameActions[o]?.forEach(l=>{l.type==="Transition"&&(l.runMode="Repeat"),l.type==="Animation"&&"runMode"in l&&(l.runMode="Normal")})})):s.type==="DragDrop"?(delete s.actions,s.dragDropActions?.drag?.forEach(o=>{(o.type==="Transition"||o.type==="Animation"&&"runMode"in o||o.type==="SwitchCamera")&&(o.runMode="Toggle")}),s.dragDropActions?.drop?.forEach(o=>{(o.type==="Transition"||o.type==="Animation"&&"runMode"in o||o.type==="SwitchCamera")&&(o.runMode="Toggle")})):s.type==="Resize"?(delete s.actions,s.breakpoints?.forEach(o=>{o.actions?.forEach(l=>{(l.type==="Transition"||l.type==="Animation"&&"runMode"in l||l.type==="SwitchCamera")&&(l.runMode="Toggle")})})):s.type==="Start"?s.actions?.forEach(o=>{o.type==="Transition"&&(o.runMode="Once"),(o.type==="Animation"&&"runMode"in o||o.type==="SwitchCamera")&&(o.runMode="Normal")}):s.type==="VariableChange"||s.type==="Scroll"?s.actions?.forEach(o=>{o.type==="Transition"&&(o.runMode="Repeat"),(o.type==="Animation"&&"runMode"in o||o.type==="SwitchCamera")&&(o.runMode="Normal")}):s.type==="Conditional"&&(delete s.actions,s.inActions?.forEach(o=>{o.type==="Transition"&&(o.runMode="Repeat"),(o.type==="Animation"&&"runMode"in o||o.type==="SwitchCamera")&&(o.runMode="Normal")}),s.outActions?.forEach(o=>{o.type==="Transition"&&(o.runMode="Repeat"),(o.type==="Animation"&&"runMode"in o||o.type==="SwitchCamera")&&(o.runMode="Normal")}))})})}(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=jo({},si.prototype),i.shared.userWebhooks=jo({},si.prototype),i.shared.lib&&(i.shared.lib.userAPIs=mf.defaultData().userAPIs,i.shared.lib.userWebhooks=mf.defaultData().userWebhooks)}(e),e.schema=115),t<116&&(function(i){i.scene.publish.settings.videoStatic===void 0&&(i.scene.publish.settings.videoStatic=Ef.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=jo({},si.prototype),e.scene.objects.traverse((i,r)=>{oxe(r)}),e.schema=118),t<119&&(e.scene.publish.settings.videoStatic.format=Cx.defaultData.scene.publish.settings.videoStatic.format,e.scene.publish.settings.videoStatic.imageFormat=Cx.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)=>{dH(r),r.type==="Page"&&r.camera!==void 0&&dH(r.camera)}),e.schema=121),t<122&&(delete e.scene.publish.settings.video,e.scene.publish.orbitControls.rotationSpeed=Cx.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=Tg.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=Tg.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=Tg.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={...Tg.defaultData.hdri}:(n.hdri.blur===void 0&&(n.hdri.blur=Tg.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&&(hH(e,NY),e.schema=130),t<131&&(function(i){i.scene.objects.traverse((r,n)=>{let s=n.states;if(!s)return;let a=n.timelineAnimations,o=[];s.forEach((l,h)=>{(l.isAnimation||a?.[h])&&o.push(h)}),o.forEach(l=>s.delete(l))})}(e),function(i){let r=i.shared,n=r.timelineAnimations;if(!n)return;let s=i.scene.objects,a=s.unproxy().find(o=>o.data.type==="Page")?.id;for(let[o,l]of Object.entries(n)){let h=jo({},si.prototype),u=0,d=Boolean(l.loop);for(let[f,m]of Object.entries(l.mapping??{})){let g=s.data(f)?.timelineAnimations?.[m];!g||(u=Math.max(u,g.to??0),d=d||Boolean(g.loop),h[f]={id:f,keyframes:U4e(g.properties?.unproxy())})}let c=l.page??a,p=c?s.data(c):void 0;p&&p.type==="Page"&&((p.timelines??(p.timelines=jo({},si.prototype)))[o]={id:o,name:l.name,duration:u||5,...d?{loop:d}:{},objectTimelines:h})}delete r.timelineAnimations,s.traverse((o,l)=>{delete l.timelineAnimations})}(e),gie(e,z4e),gie(e,G4e),e.schema=131),t<132&&(e.scene.objects.traverse((i,r)=>rxe(r)),e.schema=132),t<133){let i=function(n){return s=>n.get(s)?.data?.value}(e.shared.variables),r=new Map;e.scene.objects.traverse((n,s)=>{let a=s;if(a.type==="Page"&&a.timelines)for(let o of Object.values(a.timelines))for(let[l,h]of Object.entries(o.objectTimelines??{})){let u=r.get(l)??[];u.push(h.keyframes),r.set(l,u)}}),e.scene.objects.traverse((n,s)=>lxe(s,i,r.get(n))),e.schema=133}t<134&&(e.scene.objects.traverse((i,r)=>nxe(r)),e.schema=134),t<135&&(hH(e,IY),e.schema=135)}}yw(ixe,{updateAllMaterials:()=>hH,updateDocumentSchema:()=>W4e,updateLibSchema:()=>j4e,updateMaterialSchema:()=>F4e,updateObjectStateRec:()=>bc,updateObjectsSchema:()=>axe,updateTextValues:()=>B4e});var hxe,og,uxe,dxe,vie,w3,c5,yie,S3,ny,VS,Y1,T3,p5,GI,f5,m5,_ie,jI,g5,xy,cH,_B=U(()=>{ae(),Abe(),Or(),CY(),S4e(),vB(),ZA(),th(),la(),AY(),gB(),SY(),QA(),Fbe(),L4e(),hxe=new Set(["RectangleGeometry","EllipseGeometry","StarGeometry","PolygonGeometry","TriangleGeometry","VectorGeometry","TextGeometry","InputGeometry","PathGeometry"]),og=180/Math.PI,uxe=Math.PI/180,dxe=["position","rotation","scale","shape size"]}),H4e=U(()=>{var e,t,i;th(),Or(),la(),(vie||(vie={})).is=function(r){return!0},(e=w3||(w3={})).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 j_e({position:Uc.isEqual(r.position,n.position)?void 0:n.position,rotation:r.rotation===n.rotation?void 0:n.rotation,scale:Uc.isEqual(r.scale,n.scale)?void 0:n.scale,shear:r.shear&&n.shear&&Uc.isEqual(r.shear,n.shear)?void 0:n.shear})},(c5||(c5={})).defaultData={horizontalConstraint:0,verticalConstraint:0},(yie||(yie={})).defaultData={direction:"row",wrap:"unwrap",align:"top-left",gap:10,rowGap:10,autoGap:!1,autoRowGap:!1,leftPadding:8,rightPadding:8,topPadding:8,bottomPadding:8},(S3||(S3={})).defaultData={opacity:1,fill:{color:Gr.fromHexAndA(Ja,1),enabled:!0},stroke:{color:Gr.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:Gr.from0to1([0,0,0,1]),enabled:!1,spread:0},innerShadow:{offset:[10,10],blurRadius:10,color:Gr.from0to1([0,0,0,1]),enabled:!1,spread:0}},(t=ny||(ny={})).newEmpty=function(r,n){return{name:n}},t.patch=function(r,n){if(n===void 0)return r;let s={...r};return Object.assign(s,w3.merge(s,n)),s=function(a,o){if(o===void 0)return a;let l={...a},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}(s,n),s=function(a,o){if(o===void 0)return a;let l={...a};return"fill"in l&&"fill"in o&&o.fill!==void 0&&Object.assign(l,{fill:{...l.fill,...o.fill}}),"stroke"in l&&"stroke"in o&&o.stroke!==void 0&&Object.assign(l,{stroke:{...l.stroke,...o.stroke}}),"layerBlur"in l&&"layerBlur"in o&&o.layerBlur!==void 0&&Object.assign(l,{layerBlur:{...l.layerBlur,...o.layerBlur}}),"backgroundBlur"in l&&"backgroundBlur"in o&&o.backgroundBlur!==void 0&&Object.assign(l,{backgroundBlur:{...l.backgroundBlur,...o.backgroundBlur}}),"dropShadow"in l&&"dropShadow"in o&&o.dropShadow!==void 0&&Object.assign(l,{dropShadow:{...l.dropShadow,...o.dropShadow}}),"innerShadow"in l&&"innerShadow"in o&&o.innerShadow!==void 0&&Object.assign(l,{innerShadow:{...l.innerShadow,...o.innerShadow}}),l}(s,n),s},t.toOps=function(r,n){let s,a=[];for(let[o,l]of Object.entries(n))o!=="name"&&(s===void 0&&(s={path:[],props:{},type:0},a.push(s)),s.props[o]=l);return a},(VS||(VS={})).defaultData={...w3.defaultData,...c5.defaultData,states:new Ct,events:new Ct,visible:!0,raycastLock:!1},(Y1||(Y1={})).defaultData={...VS.defaultData,...S3.defaultData},(T3||(T3={})).defaultData={cornerRadius:[0,0,0,0]},(p5||(p5={})).defaultData={...Y1.defaultData,type:"ellipse2d",width:100,height:100,name:"Ellipse"},(GI||(GI={})).defaultData={...Y1.defaultData,...T3.defaultData,type:"rectangle2d",width:100,height:100,name:"Rectangle"},(f5||(f5={})).defaultData={...Y1.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"},(m5||(m5={})).defaultData={...Y1.defaultData,type:"path2d",path:"",name:"Path"},(_ie||(_ie={})).is=function(r){return r.type==="ellipse2d"||r.type==="rectangle2d"||r.type==="text2d"||r.type==="vector2d"||r.type==="path2d"},(jI||(jI={})).defaultData={...VS.defaultData,name:"Group",type:"group2d"},(g5||(g5={})).defaultData=()=>({...VS.defaultData,...T3.defaultData,...S3.defaultData,name:"Frame",type:"frame2d",clipped:!0,width:200,height:200,fill:{color:Gr.fromHexAndA(4737101,1),enabled:!0},stroke:{color:Gr.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{...GI.defaultData};case"ellipse2d":return{...p5.defaultData};case"text2d":return{...f5.defaultData};case"path2d":return{...m5.defaultData};case"frame2d":return{...g5.defaultData()};case"group2d":return{...jI.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=cH||(cH={})).defaultData={name:"UI",type:"scene2d",objects:new Aa},i.emptyData=function(){return{type:"scene2d",objects:new Aa}}}),cxe=U(()=>{g4e(),v4e(),cbe(),pbe(),Abe(),hbe(),ybe(),_be(),wbe(),SY(),_B(),Ebe(),wY(),xY(),fbe(),ZA(),vbe(),Tbe(),th(),vB(),gB(),Fbe(),MY(),xbe(),AY(),EY(),_4e(),bbe(),PY(),TY(),mbe(),gbe(),H4e()});function sy(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)),s={},a={},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;s[p]===void 0&&(s[p]=[]),s[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;a[p]===void 0&&(a[p]=[]),a[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 f=0;f<p.count;++f)d.push(p.getX(f)+u);u+=e[c].attributes.position.count}l.setIndex(d)}for(let u in s){let d=bie(s[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 a){let d=a[u][0].length;if(d!==0){l.morphAttributes=l.morphAttributes||{},l.morphAttributes[u]=[];for(let c=0;c<d;++c){let p=[];for(let m=0;m<a[u].length;++m)p.push(a[u][m][c]);let f=bie(p);if(!f)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+u+" morphAttribute."),null;l.morphAttributes[u].push(f)}}}return l}function bie(e){let t,i,r,n=-1,s=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;s+=u.count*i}let a=new t(s),o=new Dt(a,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 f=0;f<i;f++){let m=u.getComponent(c,f);o.setComponent(c+d,f,m)}}else a.set(u.array,l);l+=u.count*i}return n!==void 0&&(o.gpuType=n),o}var JA=U(()=>{ae()});function pxe(e){let t=e.points.length/7,i=new Ct;for(let r=0;r<t;r++){let n=7*r,s=e.points[n+0],a=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:et.generateUUID(),data:{roundness:d,position:[s,a],areControlsDirectionsMirrored:!0,controlPrevious:{position:[o,l]},controlNext:{position:[h,u]}}})}return{points:i,isClosed:e.isClosed,roundness:e.roundness,shapeHoles:e.shapeHoles?.map(r=>pxe(r))??[]}}function fxe(e){let{userData:t,uuid:i,...r}=e;if(t===void 0||t.type==="NonParametricGeometry")return function(a){let o,{userData:l,data:h}=a,u=h?.groups,d=h?.attributes??{},c=h?.morphAttributes??{},p=h?.interleavedBuffers,f=h?.arrayBuffers,m=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 T=0;T<v.length;T+=3){let M=v[T],E=v[T+1],A=v[T+2];y=Math.min(y,M),_=Math.min(_,E),b=Math.min(b,A),x=Math.max(x,M),w=Math.max(w,E),S=Math.max(S,A)}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:f},...o===void 0?{}:o,type:"NonParametricGeometry"};return m!==void 0&&Object.assign(g.data,{index:m}),u!==void 0&&Object.assign(g.data,{groups:u.map(v=>({...v,materialIndex:v.materialIndex??0}))}),g}(e);if(t.type==="SubdivGeometry"){let a="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 Wf(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,T=Object.keys(v.attributes),M={},E={},A=[],P=["getX","getY","getZ","getW"],N=["setX","setY","setZ","setW"];for(let j=0,K=T.length;j<K;j++){let $=T[j],Q=v.attributes[$];M[$]=new Q.constructor(new Q.array.constructor(Q.count*Q.itemSize),Q.itemSize,Q.normalized);let ce=v.morphAttributes[$];ce&&(E[$]||(E[$]=[]),ce.forEach((pe,ye)=>{let we=new pe.array.constructor(pe.count*pe.itemSize);E[$][ye]=new pe.constructor(we,pe.itemSize,pe.normalized)}))}let D=.5*y,O=Math.log10(1/y),z=Math.pow(10,O),B=D*z;for(let j=0;j<w;j++){let K=b?b.getX(j):j,$="";for(let Q=0,ce=T.length;Q<ce;Q++){let pe=T[Q],ye=v.getAttribute(pe),we=ye.itemSize;for(let ne=0;ne<we;ne++)$+=~~(ye[P[ne]](K)*z+B)+","}if($ in _)A.push(_[$]);else{for(let Q=0,ce=T.length;Q<ce;Q++){let pe=T[Q],ye=v.getAttribute(pe),we=v.morphAttributes[pe],ne=ye.itemSize,Se=M[pe],W=E[pe];for(let k=0;k<ne;k++){let Y=P[k],ie=N[k];if(Se[ie](S,ye[Y](K)),we)for(let G=0,oe=we.length;G<oe;G++)W[G][ie](S,we[G][Y](K))}}_[$]=S,A.push(S),S++}}let V=v.clone();for(let j in v.attributes){let K=M[j];if(V.setAttribute(j,new K.constructor(K.array.slice(0,S*K.itemSize),K.itemSize,K.normalized)),j in E)for(let $=0;$<E[j].length;$++){let Q=E[j][$];V.morphAttributes[j][$]=new Q.constructor(Q.array.slice(0,S*Q.itemSize),Q.itemSize,Q.normalized)}}return V.setIndex(A),V}(h),f=[],m=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]?(m[d[v]]++,f.push(...new Set(g.slice(3*v,3*v+6))),v+=2):(f.push(...g.slice(3*v,3*v+3)),v++);o.indexWASM={array:f},o.positionWASM=p.attributes.position,o.verticesPerFaceWASM={array:m}}if(o?.positionWASM===void 0||o?.positionWASM.length===0||o?.indexWASM===void 0||o?.indexWASM.length===0||o?.verticesPerFaceWASM===void 0||o?.verticesPerFaceWASM.length===0)return null;let l={type:a,...q4e(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,s=t.parameters;return n==="VectorGeometry"?(s.extrudeDepth&&(s.depth=s.extrudeDepth),{...s,width:100,height:100,shape:pxe(t.shape),type:n}):n==="LatheGeometry"?{...t.parameters,type:n,points:(t?.parameters.points??[]).map(a=>[a.x,a.y])}:(s.extrudeDepth&&(s.depth=s.extrudeDepth),{...s,type:n})}function q4e(e){return pH.setFromArray(e),pH.getSize(VM),{width:VM.x,height:VM.y,depth:VM.z}}var pH,VM,v5,$4e=U(()=>{Or(),ae(),JA(),new Ue,new jt,new Dr,new R,new R,pH=new pn,VM=new R}),X4e=U(()=>{var e;(e=v5||{}).view="view",e.edit="edit",((v5=e)||(v5={})).canWrite=function(t){return t!=="view"},class extends Error{constructor(t,i){super(`This is a ${t.toUpperCase()} document, but it was opened as a ${i.toUpperCase()} one`),this.actual=t,this.expected=i,this.name="DocumentKindMismatchError"}}}),mxe,Kf,LE,gxe,OY,ww,GS,M3,y5,Sw,xie,_5,wie,b5,aw,mm,gm,up,x5,Sie,Tie,w5,fH,Cf,vxe=U(()=>{X4e()}),Y4e=U(()=>{}),K4e=U(()=>{Or(),_B(),vxe()}),Z4e=U(()=>{ZA(),[...mB],new Set(_Y)}),zt=U(()=>{cxe(),Y4e(),w4e(),_B(),K4e(),vxe(),CY(),Z4e(),PY(),Or()}),Pd=U(()=>{mxe=[3,4,8,9],Kf=5,LE=3,gxe=32,OY=.98}),eC=U(()=>{ae(),ww=e=>{var t;return(t=class extends e{}).geometryHelper=new Ih(30,30,30),t}}),tC=U(()=>{ae(),GS=new xf,M3=new Ha,y5=new Ue,Sw=(e,t,i,r,n=!1,s=e)=>{let a=t,o=s.matrixWorld;if(a.boundingSphere===null&&a.computeBoundingSphere(),M3.copy(a.boundingSphere),M3.applyMatrix4(o),i.ray.intersectsSphere(M3)===!1||(y5.copy(o).invert(),GS.copy(i.ray).applyMatrix4(y5),a.boundingBox!==null&&GS.intersectsBox(a.boundingBox)===!1))return;let l,h,u,d,c,p,f=a.index,m=a.attributes.position,g=a.drawRange;if(n===!1){for(c=Math.max(0,g.start),p=Math.min(f.count,g.start+g.count);c<p;c+=3)if(h=f.getX(c),u=f.getX(c+1),d=f.getX(c+2),l=v(e,i,GS,m,h,u,d),l)return l.faceIndex=Math.floor(c/3),void r.push(l)}else{let y=a.attributes.position,_=new R,b=new R,x=new R,w=new R,S=2,T=1/((s.scale.x+s.scale.y+s.scale.z)/3),M=T*T;for(let E=Math.max(0,g.start),A=Math.min(y.count,g.start+g.count)-1;E<A;E+=S){if(_.fromBufferAttribute(y,E),b.fromBufferAttribute(y,E+1),GS.distanceSqToSegment(_,b,w,x)>M)continue;w.applyMatrix4(s.matrixWorld);let P=i.ray.origin.distanceTo(w);P<i.near||P>i.far||r.push({distance:P,point:x.clone().applyMatrix4(s.matrixWorld),object:e})}}function v(y,_,b,x,w,S,T){let M=new R,E=new R,A=new R,P=new R,N=new R;if(M.fromBufferAttribute(x,w),E.fromBufferAttribute(x,S),A.fromBufferAttribute(x,T),b.intersectTriangle(M,E,A,!1,P)===null)return null;N.copy(P),N.applyMatrix4(y.matrixWorld);let D=_.ray.origin.distanceTo(N);return D<_.near||D>_.far?null:{faceIndex:1,distance:D,point:N.clone(),object:y}}}}),bB=U(()=>{ae(),eC(),tC(),xie=new R(1,1,1),_5=new R,wie=new R,b5=new jt,aw=class extends ww(u_e){constructor(e,t=15){super(t),this.object=e,this.dummy=new bw,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){Sw(this.object,aw.geometryHelper,e,t,!1,this.dummy)}update(){}updateMatrix(){}updateMatrixWorld(e){this.object.matrixWorld.decompose(_5,b5,wie),this.matrix.compose(_5,b5,xie),super.updateMatrixWorld(e)}updateWorldMatrix(e,t){}}}),Q4e=U(()=>{ae(),mm=new R,gm=new R,up=new Ue,x5=[new R(-1,1,1),new R(-1,-1,1),new R(1,-1,1),new R(1,1,1),new R(-1,1,-1),new R(-1,-1,-1),new R(1,-1,-1),new R(1,1,-1)],Sie=[[0,3],[1,2],[5,6],[4,7],[0,1],[3,2],[7,6],[4,5],[0,4],[1,5],[2,6],[3,7]],Tie=[[0,2],[7,5],[4,1],[3,6],[4,3],[1,6]],w5=(e,t,i)=>{e.updateEntityBoxSize(mm,gm),up.copy(t).multiply(e.matrixWorld),gm.x===0&&gm.y===0&&gm.z===0?i.push(new R(mm.x,mm.y,mm.z).applyMatrix4(up)):x5.forEach(r=>{i.push(r.clone().multiply(gm).add(mm).applyMatrix4(up))})},fH=class extends pn{constructor(){super(...arguments),this.matrix=new Ue,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 Ue().copy(e.matrixWorld).invert();return this.expandByObjectSize(e,i,t)}expandByObjectSize(e,t,i=!1){let r=[];if(i===!0){let n=[];e.traverseEntity(s=>{if(s.visible||s.cloner&&s.data.visible){if(!("geometry"in s))return up.copy(t).multiply(s.matrixWorld),void n.push(new R().applyMatrix4(up));w5(s,t,r)}}),r.length===0&&r.push(...n)}else w5(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(gm).multiplyScalar(.5),this.getCenter(mm),up.copy(this.matrix).setPosition(mm),this.vertices=x5.map(e=>e.clone().multiply(gm).applyMatrix4(up))}computeEdges(){this.vertices.length>0&&this.computeVertices(),this.edges=Sie.map(([e,t])=>new Ch(this.vertices[e],this.vertices[t])),this.centerEdges=this.edges.map(e=>e.getCenter(new R))}computeFaces(){this.vertices.length>0&&this.computeVertices(),this.faces=Tie.map(([e,t])=>this.vertices[e].clone().add(this.vertices[t]).multiplyScalar(.5))}}}),XL=U(()=>{Cf={Cloner:null,changeEntityProptotype:()=>{},createEntity:()=>{}}});function BE(e){return e?.isParticleSystem===!0}function s1(e){return e?.isHairSystem===!0}function Zf(e){return e?.isShapeBlendEntity===!0}function xB(e){return e?.isPathObject===!0}function Jl(e){return e?.isObject2D===!0}function $o(e){return e?.isUIObject===!0}function Lg(e){return e?.isCloner===!0}function Bg(e){return e?.isClone===!0}function WI(e){return e?.isComponentObject===!0}var Zn=U(()=>{});function In(e){LY.add(e)}function Ta(e,t){let i=`${e}:${t}`;vH.has(i)||vH.add(i)}function YL(e,t){BY.set(e,t)}function S5(e){return BY.get(e)}function Tw(e,t){FY.set(e,t)}function T5(e){return FY.get(e)}function mH(e,t){UY.set(e,t)}function yxe(e){return UY.get(e)}function gH(){return wB}var LY,vH,BY,FY,UY,wB,KL,_r=U(()=>{LY=new Set,vH=new Set,BY=new Map,FY=new Map,UY=new Map,wB=null,KL=null});function _xe(e,t,i,r,n=new Ue){return n.compose(e,t,bxe).multiply(i).scale(r)}var bxe,M5,ay,SB,Mw=U(()=>{ae(),yB(),bxe=new R(1,1,1),M5=new Ue,(ay||(ay={})).is=function(e){return e&&e.__isSPEObject},SB=e=>class extends e{constructor(){super(...arguments),this.previousModelViewMatrix=new Ue,this.copyPreviousMatrix=!0,this.pivotMatrix=new Ue,this.matrixWorldRigid=new Ue,this.shearScale=new Ue,this.shearScaleInv=new Ue,this.shearMatrix=new Ue}get __isSPEObject(){return!0}getPhysicsLocalMatrix(t){return!!this.rigidBody?.isDynamic()&&(t.copy(this.matrixWorld),this.hasNonUniformScale&&t.multiply(this.shearScaleInv),this.parent&&t.premultiply(M5.copy(this.parent.matrixWorld).invert()),t.multiply(M5.copy(this.pivotMatrix).invert()),!0)}isDescendantOf(t){t instanceof hn&&(t=t.uuid);let i=this;for(;i.parent;){if(i.parent.uuid===t)return!0;i=i.parent}return!1}updateMatrix(){!this.shearMatrix||(_xe(this.position,this.quaternion,this.shearMatrix,this.scale,this.matrix),this.matrixWorldNeedsUpdate=!0)}updateMatrixWorld(t){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||t)&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.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.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.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)ay.is(r)&&r.traverseObject(t,i+1)}traverseObject(t,i=0){if(t(this,i)!==!0)for(let r of this.children)ay.is(r)&&r.traverseObject(t,i+1)}updateMatrixWorldRigid(){this.hasNonUniformScale=Dbe(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 Ue().copy(this.matrixWorld).invert();return t.parent!==null&&(t.parent.updateWorldMatrix(!0,!1),r.multiply(t.parent.matrixWorld)),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}onAfterRender(t,i,r,n,s,a){this.copyPreviousMatrix&&this.previousModelViewMatrix.copy(this.modelViewMatrix)}}});function Mie(e,t,i){return Mg.subVectors(t,e),RA.subVectors(t,i),Mg.cross(RA).length()<=FE}function xxe(e){let t=bH.get(e.points);if(t!==void 0&&t.isClosed===e.isClosed)return t.curve;let i=function(r){let n=r.points,s=[n[0]],a=[new R(...n[0].data.position)];zv.copy(a[0]);for(let v=0;v<n.length-1;v++)Mg.fromArray(n[v].data.position),RA.fromArray(n[v+1].data.position),Ob.subVectors(Mg,zv),Lb.subVectors(Mg,RA),Ob.cross(Lb).length()>FE&&(s.push(n[v]),a.push(new R().copy(Mg)),zv.copy(Mg));let o=n[n.length-1];s.push(o),a.push(new R(...o.data.position));let l=r.isClosed,h=s.length-(l?0:1),u=s.length,d=[],c=[];for(let v=0;v<u;v++){let y=s[v].data;d.push(new R(...y.controlPrevious.position)),c.push(new R(...y.controlNext.position))}let p=[];for(let v=0;v<h;v++){let y=v===u-1?0:v+1;p.push(Mie(a[v],c[v],a[y])&&Mie(a[v],d[y],a[y]))}let f=[];for(let v=0;v<u;v++){let y=s[v].data,_=a[v],b={position:_,prevDir:void 0,nextDir:void 0,controlPrevious:d[v],controlNext:c[v],tan:void 0,baseRoundness:y.roundness,removedLength:0};if(f.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 R().subVectors(a[x],_).normalize(),T=new R().subVectors(a[w],_).normalize();b.prevDir=S,b.nextDir=T;let M=p[l&&v===0?u-1:v-1],E=p[v];if(M&&E){kv.addVectors(S,T).normalize();let A=zv.crossVectors(kv,S).length()/S.dot(kv);b.tan=A,b.removedLength=y.roundness/A}}for(let v=0;v<h;v++){let y=l&&v===u-1?0:v+1,_=f[v],b=f[y];if(_.removedLength!==0||b.removedLength!==0){let x=_.position.distanceTo(b.position);_.removedLength=Math.min(_.removedLength,x/2),b.removedLength=Math.min(b.removedLength,x/2)}}let m=new Array(2*u).fill(null);for(let v=0;v<h;v++){let y=l&&v===u-1?0:v+1,_=f[v],b=f[y],x=null;if(p[v]){let w=_.position.clone(),S=b.position.clone();(_.removedLength!==0||b.removedLength!==0)&&(_.nextDir&&w.add(zv.copy(_.nextDir).setLength(_.removedLength)),b.prevDir&&S.add(zv.copy(b.prevDir).setLength(b.removedLength))),w.distanceTo(S)>FE&&(x=new AE(w,w.clone().lerp(S,.3),S.clone().lerp(w,.3),S))}else _.position.distanceTo(b.position)>FE&&(x=new AE(_.position,_.controlNext,b.controlPrevious,b.position));m[2*v+1]=x}for(let v=0;v<u;v++){let y=f[v];if(y.removedLength===0)continue;let _=y.position,b=y.prevDir.clone().multiplyScalar(y.removedLength).add(_),x=y.nextDir.clone().multiplyScalar(y.removedLength).add(_),w=y.tan*y.removedLength;kv.addVectors(y.prevDir,y.nextDir).normalize(),Ob.copy(b).lerp(x,.5);let S=b.distanceTo(x)/2;_H.copy(kv).multiplyScalar(Math.sqrt(Math.pow(w,2)-Math.pow(S,2))).add(Ob),HI.copy(kv).multiplyScalar(-w).add(_H);let T=_.distanceTo(HI)/_.distanceTo(Ob);Lb.copy(y.prevDir).multiplyScalar(T*_.distanceTo(b)).add(_),yH.copy(Lb).lerp(HI,2);let M=b.clone().lerp(Lb,4/3),E=x.clone().lerp(yH,4/3);m[2*v]=new AE(b,M,E,x)}let g=new wxe;for(let v=0;v<m.length;v++){let y=m[v];y&&g.add(y)}return g}(e);return bH.set(e.points,{isClosed:e.isClosed,curve:i}),i}var wxe,FE,Mg,RA,zv,kv,Ob,HI,Lb,yH,_H,bH,Bb,xH,qI,Sxe,Txe,Mxe,nr,wc,Eie,Aie,jS,E5,E3,A5,C5,TB,wH,c1,Pc,Exe=U(()=>{ae(),wxe=class extends oW{constructor(){super()}getPoints(e=12){let t,i=[],r=this.getCurveLengths(),n=r[r.length-1]/r.length;for(let s=0,a=this.curves;s<a.length;s++){let o=a[s],l=s===0?r[s]:r[s]-r[s-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}},FE=.001,Mg=new R,RA=new R,zv=new R,kv=new R,Ob=new R,HI=new R,Lb=new R,yH=new R,_H=new R,bH=new WeakMap}),J4e=U(()=>{ae(),Bb=new Ue,xH=new jt,qI=new jt,Sxe=new Dr,Txe=new R,Mxe=new R(0,1,0)}),wl=U(()=>{ae(),zt(),Q4e(),Or(),XL(),Zn(),_r(),Mw(),Exe(),J4e(),jr(),(nr||(nr={})).is=function(e){return e&&e.__isEntity},wc=e=>nr.is(e),Eie={type:"completeState",isfromEntity:!0},Aie=["x","y","z"],jS=new R,E5=new R(1,1,1),E3=new jt,A5=new Dr,C5=new Ue,TB=e=>class extends SB(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.transitionState={settled:!0,state:null},this.currentTransitionEvent=null,this.previousAction=null,this._singleBBox=new fH,this._recursiveBBox=new fH,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(nr.is(i))return i}entityChildrenCount(){let t=this.children.length;for(;t--;)if(nr.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(!nr.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)Og.toOps(this.data,n.data).forEach(s=>{let a=TL.replaceProps(s,this.data);this.dataPatched=this.data,this.updateByPatchedOp(a,this.data,i)});if(t!==null){let n=this.data.states.data(t);n&&(this.dataPatched=Og.patch(this.data,n),Og.toOps(this.data,n).forEach(s=>{this.updateByPatchedOp(s,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=>{wc(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(nr.is(i[r]))return i[r];if(nr.is(t))return t.traverseSortNextHelper()}}sortNext(){let t=this.children;return this.children.length>0&&nr.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)wc(i)&&t(i)}traverseEntityAncestors(t){this.traverseAncestors(i=>{nr.is(i)&&t(i)})}traverseConcreteEntity(t,i=0){if(t(this,i)!==!0)for(let r of this.children)wc(r)&&r.isConcreteEntity&&r.traverseEntity(t,i+1)}traverseEntity(t,i=0){if(t(this,i)!==!0)for(let r of this.children)wc(r)&&r.traverseEntity(t,i+1)}traverseVisibleEntity(t){t(this);for(let i of this.children)wc(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}hasEntityChild(){return this.children.some(t=>wc(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),RW({position:this.position.toArray(),rotation:[this.rotation.x*et.RAD2DEG,this.rotation.y*et.RAD2DEG,this.rotation.z*et.RAD2DEG],scale:this.scale.toArray(),shear:Dh.fromMatrix(this.shearMatrix.toArray()),pivot:[0,0,0],pivotRotation:[0,0,0]},t)}getTransformValues(t,i,r){return i[t].map((n,s)=>r?.shared.getVariable(n,[this.uuid,t,Aie[s]])??n)}updateTransformState(t,i){let r=!1;if(t.position&&(this.position.fromArray(this.getTransformValues("position",t,i)),r=!0),t.rotation&&(jS.fromArray(this.getTransformValues("rotation",t,i)).multiplyScalar(et.DEG2RAD),this.rotation.setFromVector3(jS),r=!0),t.scale&&(this.scale.fromArray(this.getTransformValues("scale",t,i)),r=!0),t.shear&&(this.shearMatrix.fromArray(Dh.toMatrix(t.shear)),r=!0),t.pivot!==void 0||t.pivotRotation!==void 0){if(r=!0,t.pivot!==void 0&&t.pivotRotation!==void 0)this.pivotMatrix.compose(jS.fromArray(t.pivot).negate(),E3.setFromEuler(A5.fromArray(t.pivotRotation.map(n=>n*et.DEG2RAD))).invert(),E5);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=jS.setFromMatrixPosition(this.pivotMatrix);E3.setFromEuler(A5.fromArray(t.pivotRotation.map(s=>s*et.DEG2RAD))).invert(),this.pivotMatrix.compose(n,E3,E5)}}return r&&(this.updateMatrix(),this.resetBBoxNeedsUpdate(),this.invalidateClonerTransform(this),this.traverseEntityAncestors(n=>{n.invalidateClonerTransform(this)})),t.position&&t.rotation&&t.scale&&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)nr.is(t)&&t.disposeRecursively()}disposeRecursively(){this.dispose(),this.children.forEach(t=>{nr.is(t)&&t.disposeRecursively()})}toState(t=[]){return RW({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 s=this.data;this.data=i;let a=t,o=Jr(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=Sa.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])}}a={...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=Sa.removeOverridden(t.path,t.props,l);a={...t,props:h}}}if(this.updateByPatchedOpBase(a,Og.patch(this.data,this.stateSelection?this.data.states.data(this.stateSelection):void 0),r),Jr(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(Gg.apply(d.component.data,d.overrideData),r))}}else{let u=r.scene.findInstance([this.uuid,...l]);if(u){let d=Sa.zoom(u.component.data,h);if((t={...t,path:h}).type===0){let c=t.props;if(d)for(let[p,f]of Object.entries(t.props))f===void 0&&(c===t.props&&(c={...t.props}),c[p]=d[p]);t={...t,props:c}}u.overrideData=WL.resolve(i.overrides,l),u.updateByOp(t,$a.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 Mf.rootOverrideProps)u in t.props&&(h===void 0&&(h={}),h[u]=t.props[u]);h&&(l={...t,props:h})}else for(let h of Mf.rootOverrideProps)if(Jr(t.path,[h])){l=t;break}l!==void 0&&this.instances.forEach(h=>{if(h.isInstanceRoot){let u=Gg.filterOp(h.overrideData,l);u&&h.updateByOp(u,$a.applySimple(h.data,u),r,!0)}}),this.instances.forEach(h=>{if(!h.isInstanceRoot){let u=Gg.filterOp(h.overrideData,t);if(u){let d;d=s===h.data&&t===u?i:$a.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&&!r1.is(t.props.type)&&Cf.changeEntityProptotype(this,this.data,r);else if(t.path.length===1&&t.path[0]==="geometry"&&t.type===0&&"type"in t.props){Cf.changeEntityProptotype(this,this.data,r);for(let n of this.children)nr.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(Jr(t.path,["pathSnapping"])!==null&&(this.updatePathSnapping(i.pathSnapping),this.isVirtualEntity&&r.scene?.syncInstancePathConstraint(this)),Jr(t.path,["cloner"])!==null){let n=$a.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,s=this._updatedPathSnapping?.orientation??this.dataPatched.pathSnapping.orientation;if(i===null)return;let a=t.find(this.isVirtualEntity&&t.pathConstraints.getConstraint(this.uuid)||i);if(!a)return;this._needApplyPathSnapping=!1;let o=a.data;if(o.geometry.path.points.length<=1)return;let l=xxe(o.geometry.path),h=function(p){let f=p%1;return f<0?f+1:f===0&&p>0?1:f}(r+n),u=null;try{u=l.curves.length?l.getPointAt(h):null}catch{}if(u===null)return;a.updateMatrixWorld();let d=this.parent?C5.copy(this.parent.matrixWorld):C5.identity(),c=function(p,f,m,g){xH.setFromRotationMatrix(Bb.extractRotation(g));let v=p.clone().applyMatrix4(Bb.copy(g).invert().multiply(m));if(f===null)qI.setFromRotationMatrix(Bb.extractRotation(m));else{let y=f.clone().applyMatrix4(Bb.extractRotation(m));qI.setFromRotationMatrix(Bb.lookAt(Txe.set(0,0,0),y,Mxe))}return{position:v,rotation:new R().setFromEuler(Sxe.setFromQuaternion(xH.invert().multiply(qI))).multiplyScalar(et.RAD2DEG)}}(u,s==="tangential"?l.getTangentAt(h):null,a.matrixWorld,d);this.updateTransformState({position:c.position.toArray(),rotation:c.rotation.toArray()}),this.traverseEntity(p=>{p._cameraType&&p.dispatchEvent(Eie)})}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=>Lg(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(Cf.Cloner===null)return void Ta("cloners","a cloner");this.cloner=new Cf.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"})}}}),p1=U(()=>{ae(),wl(),(wH||(wH={})).is=e=>"objectHelper"in e,c1=(e,t)=>class extends TB(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 xA&&(r.visible=!0)}}updateEntityBoxSize(i,r){this.objectHelper.visible&&this.geometryHelper instanceof Ih?(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 xA&&(r.visible=!1)}}}}),MB=U(()=>{ae(),bB(),p1(),Pc=class extends c1(bw,aw){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 Iu(e,t,i,r,n,s,a){GM.set(n,s,a).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],GM.x,GM.y,GM.z)}}var GM,ah,Cie,Axe,eBe=U(()=>{ae(),eC(),tC(),GM=new R,ah=new Pg,Cie=class extends Cb{constructor(e){let t=new At,i=new ld({color:16777215,vertexColors:!0,toneMapped:!1}),r=[],n=[],s={},a=new lt(15711266),o=new lt(15711266),l=new lt(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),s[d]===void 0&&(s[d]=[]),s[d].push(r.length/3-1)}h("n1","n2",a),h("n2","n4",a),h("n4","n3",a),h("n3","n1",a),h("f1","f2",a),h("f2","f4",a),h("f4","f3",a),h("f3","f1",a),h("n1","f1",a),h("n2","f2",a),h("n3","f3",a),h("n4","f4",a),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=s,this.update()}update(){let e=this.geometry,t=this.pointMap;ah.projectionMatrixInverse.elements=[.5112609807824982,-0,-0,-0,-0,.41421356237309503,-0,-0,-0,-0,-0,-.099999,-0,-0,-1.0000000000000002,.100001];let i=.8;Iu("n1",t,e,ah,-1,-1,i),Iu("n2",t,e,ah,1,-1,i),Iu("n3",t,e,ah,-1,1,i),Iu("n4",t,e,ah,1,1,i);let r=i;Iu("f1",t,e,ah,-1,-1,r),Iu("f2",t,e,ah,1,-1,r),Iu("f3",t,e,ah,-1,1,r),Iu("f4",t,e,ah,1,1,r);let n=r;Iu("u1",t,e,ah,.35,1.1,n),Iu("u2",t,e,ah,-.35,1.1,n),Iu("u3",t,e,ah,0,1.55,n),e.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}},Axe=class extends ww(Cie){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){Sw(this.object,this.geometry,e,t,!0)}}});function Pie(e){return 1-Math.pow(1-e,3)}var L0,A3,C3,P3,K1,R3,qd,Qn,Oh=U(()=>{ae(),eBe(),zt(),p1(),jr(),L0=new R,A3=new R,C3=new jt,P3=new R,K1=new R,R3=new R,qd=class extends c1(Pg,Axe){constructor(e="",t={...IE.defaultData,name:""}){super(),this._cameraType="OrthographicCamera",this.targetOffset=Tf.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 s=qd.projectionTransitionRequestRender??n.requestRender;this.updateProjectionMatrix(),s?.()},this.super_Entity(e,t),this.previousProjectionMatrix=new Ue,this.matrixAutoUpdate=!0,this.width=window.innerWidth,this.height=window.innerHeight;let i=this.width,r=this.height;this.orthoCamera=new Zg(-.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=qd.projectionTransitionsEnabled;qd.projectionTransitionsEnabled=!1;try{return e()}finally{qd.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 R(e,t,i)),super.lookAt(e),this.getWorldPosition(L0),this.targetOffset=L0.distanceTo(e)}getTarget(e=new R){return this.getWorldDirection(A3),this.getWorldPosition(L0),A3.multiplyScalar(this.targetOffset),e.copy(L0).add(A3),e}getDistanceToTarget(){let e=this.getTarget();return this.getWorldPosition(L0),L0.distanceTo(e)}updateUp(){this.getWorldQuaternion(C3),P3.set(0,0,1).applyQuaternion(C3),K1.copy(hn.DEFAULT_UP),this.isUpVectorFlipped&&K1.negate(),K1.applyQuaternion(C3),R3.copy(hn.DEFAULT_UP).projectOnPlane(P3),this.angleOffsetFromUp=R3.angleTo(K1),this.angleOffsetFromUp*=R3.cross(K1).dot(P3)>=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 R),i=e.getWorldDirection(new R).multiplyScalar(this.targetOffset);return{position:t.clone().add(i),target:t}}getViewToTarget(e){let t=this.getWorldDirection(new R).multiplyScalar(this.targetOffset);return{position:e.clone().sub(t),target:e}}getViewToObject(e){let t=new R;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:Pie(t)}get _activeSubCamera(){return this._cameraType==="PerspectiveCamera"?this.perspCamera:this.orthoCamera}_canAnimateProjection(){return qd.projectionTransitionsEnabled&&typeof requestAnimationFrame=="function"&&typeof performance<"u"&&performance.now()-this._createdAt>=qd.projectionTransitionMinAgeMs}_beginProjectionTransition(e){let t=this._projectionTransition;t===void 0&&(t={from:new Ue,blend:new Ue,blendInverse:new Ue,start:0,duration:qd.projectionTransitionDuration,referenceDepth:1,raf:0,requestRender:e},this._projectionTransition=t),t.from.copy(this.projectionMatrix),t.start=performance.now(),t.duration=qd.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=Pie(t),r=e.from.elements,n=this._activeSubCamera.projectionMatrix.elements,s=e.blend.elements,a=e.referenceDepth,o=Math.max(1e-6,r[15]-r[11]*a),l=i*o/(i*o+(1-i)*Math.max(1e-6,n[15]-n[11]*a));for(let h=0;h<16;h++)s[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 Ue,blend:new Ue,blendInverse:new Ue,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,s){this._cameraType==="PerspectiveCamera"?this.perspCamera.setViewOffset(e,t,i,r,n,s):this.orthoCamera.setViewOffset(e,t,i,r,n,s),this._applyProjectionTransition()}clearViewOffset(){this._cameraType==="PerspectiveCamera"?(this.perspCamera.clearViewOffset(),this.toPerspective()):(this.orthoCamera.clearViewOffset(),this.toOrthographic())}copyHistory(){this.previousProjectionMatrix&&this.previousProjectionMatrix.copy(this.projectionMatrix)}updateProjectionMatrix(){this._cameraType==="PerspectiveCamera"?this.toPerspective():this._cameraType==="OrthographicCamera"&&this.toOrthographic()}updateMatrixWorld(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=Tf.sanitizeTargetOffset(e.targetOffset),this.updateProjectionMatrix(),this._syncProjectionTransition(e),this}toCameraState(e=[]){return RW({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=Tf.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}}},(Qn=qd).projectionTransitionsEnabled=!1,Qn.projectionTransitionDuration=350,Qn.projectionTransitionMinAgeMs=1e3});function Cxe(e){return e.type==="TorusGeometry"&&e.arc===360}var Pxe,D3,SH,DA=U(()=>{ae(),Pxe=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),s=Math.abs(i.depth??r),a=Math.abs(Math.min(r,s))/2;return{parameters:Object.assign(i,{width:r,height:n,depth:s,radius:a,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:s,segments:a,pathRadius:o,pathType:l,pathSegments:h,cornerRadius:u,cornerSegments:d}=e.parameters,c=new SH(!1,t,i,r,n,s,a,o,l,h,u,d);return Object.assign(c,{userData:{...e,type:"HelixGeometry"}})}},D3=new Wf([0,0,0],1),SH=class extends At{constructor(e=!0,t=1,i=1,r=1,n=1,s=1,a=1,o=1,l=1,h=1,u=1,d=1){if(super(),s===0)return;let c=e&&s===1;c&&(d=0),u>100&&(u=100),u===0&&(d=0);let p,f,m,g,v,y,_,b,x=()=>new R,w=new R,S=x(),T=x(),M=x(),E=x(),A=x(),P=x(),N=x(),D=x(),O=x(),z=x(),B=x(),V=i-2*o+.001,j=V/s,K=Math.ceil(a*s),$=K+1,Q=V/K,ce=-V/2,pe=h+1,ye=2*Math.PI/h,we=Math.PI/2/d,ne=Math.min((1-u/100)*o,o-.01),Se=o-ne,W=0,k=2*d+2,Y=pe*k/2,ie=Y+pe*$,G=Math.max(0,pe*($+k)),[oe,se,H]=[3,3,2].map(pt=>Array(G*pt).fill(0)),me=[],xe=n-o;function ke(pt,it){let Yt=Math.PI/2;y=it*Q,b=2*Math.PI*(y%j)/j+Yt,y+=ce,_=Math.sin(b)*xe,v=Math.cos(b)*xe,e?pt.set(v,_,y):pt.set(v,y,_)}ke(w,-1e-10),ke(S,0),E.copy(w),ke(w,1);let Te=w.distanceTo(S),Ze=c?0:Se+ne,ze=Te*K+2*Ze,qe=ne,Ne=ze-Ze;for(let pt=0;pt<=K;pt++){ke(T,pt),B.subVectors(T,E).normalize(),E.copy(T),O.copy(T).setComponent(+e+1,0).normalize(),z.crossVectors(B,O).normalize();let it=pt===0,Yt=pt===K,ni=it?3*Math.PI/2:we,or=it?qe:Ne,St=it?pe:ie,It=it?0:G-pe,Qt=B.clone().multiplyScalar(it?-Se:Se).add(T),Ei=B.clone().multiplyScalar(it?-1:1).normalize();for(let xi=0;xi<pe;xi++){let mi=xi*ye;if(A.addVectors(w.copy(O).multiplyScalar(o*Math.cos(mi)),S.copy(z).multiplyScalar(o*Math.sin(mi))),P.copy(A).normalize(),it||Yt){c||(W=It+xi,[0,1,2].forEach(Ai=>{oe[3*W+Ai]=Qt.getComponent(Ai),se[3*W+Ai]=Ei.getComponent(Ai)}),H[2*W]=+Yt,H[2*W+1]=xi/h),S.copy(P).multiplyScalar(ne),M.addVectors(T,S);for(let Ai=0;Ai<d;Ai++){let Lr=Ai*we+ni;N.addVectors(w.copy(B).multiplyScalar(Se*Math.sin(Lr)),S.copy(P).multiplyScalar(Se*Math.cos(Lr))),D.copy(N).normalize(),S.addVectors(M,N),N.normalize(),W=St+Ai*pe+xi,[0,1,2].forEach(ir=>{oe[3*W+ir]=S.getComponent(ir),se[3*W+ir]=D.getComponent(ir)});let qr=+it+Math.sin(Lr);H[2*W]=(or+Se*qr)/ze,H[2*W+1]=xi/h}}S.addVectors(T,A),W=Y+pt*pe+xi,[0,1,2].forEach(Ai=>{oe[3*W+Ai]=S.getComponent(Ai),se[3*W+Ai]=P.getComponent(Ai)}),H[2*W]=(Ze+pt*Te)/ze,H[2*W+1]=xi/h}}let ee=$+2*d+2,[Ce,He]=[+c,ee-1];for(let pt=Ce;pt<=He-1;pt++){let it=c&&pt===He-1;for(let Yt=0;Yt<pe-1;Yt++)p=pt*pe+Yt,f=p+1,m=(it?Yt:p)+pe,g=(it?Yt+1:f)+pe,pt===0?me.push(f,g,m):pt===ee-2?me.push(p,f,m):me.push(p,f,m,f,g,m)}this.setIndex(me),this.setAttribute("position",new Et(oe,3)),this.setAttribute("normal",new Et(se,3)),this.setAttribute("uv",new Et(H,2))}getClosedTorusIndicesForBooleanOrSubdiv(){let e,t,i,r,n=this.userData.parameters,s=Math.ceil(n.tubularSegments),a=n.radialSegments,o=a+1,l=[];for(let h=1;h<s;h++)for(let u=0;u<a;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<a;h++)e=s*o+h,t=e+1,i=h+o,r=h+1+o,l.push(e,t,i,t,r,i);return D3.array=new Uint32Array(l),D3.count=l.length,D3}}});function tBe(e){return Die||(Die=async function(){let t=e??"https://cdn.spline.design/@splinetool/runtime@2.0.122/build",i=import("./boolean.js"),[r,n]=await Promise.all([i,fetch(`${t}/boolean.wasm`).then(s=>s.arrayBuffer())]);await r.default({module_or_path:n}),NA=r}())}function ZL(){if(NA===void 0)throw new Error("boolean-wasm is not loaded");return NA}function zY(e){let t=IA.get(e);if(t===void 0)throw new Error("Unknown csg mesh set handle "+e);return t}function kY(e){return IA.set(++TH,e),TH}function iBe(e,t,i){if(NA===void 0)return-1;let{positions:r,indices:n,normals:s}=function(a,o){if(o&&a.userData.positions!==void 0){let p=a.userData,f=[];for(let m=0,g=0;m<p.verticesPerFace.length;m++){let v=p.verticesPerFace[m];for(let y=1;y<v-1;y++)f.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(f)}}let l;l=Cxe(a.userData.parameters)?a.getClosedTorusIndicesForBooleanOrSubdiv():a.getIndex();let h,u=a.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=a.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 kY(new NA.CsgMesh(r,n,s))}function Rie(e,t){let i=ZL(),r=Dxe[t];if(r===void 0)throw new Error("Unknown boolean operation "+t);let n=e.map(zY);if(n.length===1)return i.clone_mesh(n[0]);let s,a=[];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),a.push(o);s=i.boolean_mesh(n[n.length-1],o,2)}else if(t===2)s=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),a.push(o),o.tri_count()!==0);l++);s=o,a.pop()}for(let o of a)o.free();return s}function P5(e,t){zY(e).transform(new Float32Array(t.elements))}function Rxe(e){let t=IA.get(e);t!==void 0&&(t.free(),IA.delete(e))}var NA,IA,TH,Die,Dxe,EB=U(()=>{ae(),DA(),IA=new Map,TH=0,Dxe={0:0,1:1,2:2}});function B0(e){return e!==null&&"booleanOp"in e}var MH,Nxe,rBe=U(()=>{ae(),wl(),EB(),MH=class extends TB(Tr){constructor(){super(...arguments),this.booleanMeshSetAddress=-1,this.booleanWasTransformed=!1,this.booleanMatrixInvOld=new Ue}updateVisible(e){super.updateVisible(e),this.visible=!B0(this.parent)&&this.visible,B0(this.parent)&&this.parent.invalidateDownstreamBooleanData()}onClonerLayoutUpdated(){B0(this.parent)&&this.invalidateDownstreamBooleanData()}freeBooleanPointer(){this.booleanMeshSetAddress!==-1&&(Rxe(this.booleanMeshSetAddress),this.booleanMeshSetAddress=-1)}dispose(){super.dispose(),this.freeBooleanPointer()}invalidateDownstreamBooleanData(e=!1){return e?this.booleanWasTransformed=!0:this.freeBooleanPointer(),B0(this.parent)?this.parent.invalidateDownstreamBooleanData():this}invalidateUpstreamBooleanData(){this.freeBooleanPointer();for(let e of this.children)e instanceof MH&&(e.freeBooleanPointer(),B0(e)&&e.invalidateUpstreamBooleanData())}updateTransformState(e,t){let i=super.updateTransformState(e,t);return i&&B0(this.parent)&&this.invalidateDownstreamBooleanData(!0),i}onVariableUpdate(e=!1){super.onVariableUpdate(e),B0(this.parent)&&this.invalidateDownstreamBooleanData(!0)}}}),nBe=U(()=>{Nxe=null});function VY(e,t=0,i=e.count,r,n){let s=1/0,a=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),f=e.getZ(d);c<s&&(s=c),p<a&&(a=p),f<o&&(o=f),c>l&&(l=c),p>h&&(h=p),f>u&&(u=f)}jM.min.set(s,a,o),jM.max.set(l,h,u),jM.getCenter(r),jM.getSize(n).multiplyScalar(.5)}var jM,Nie,Iie,Es,Na=U(()=>{ae(),rBe(),nBe(),jM=new pn,Nie=new At,Iie=new Ql,Es=class extends MH{constructor(e,t){super(Nie,Iie),this.super_Entity(e,t)}updateState(e,t){this.updateState_Entity(e,t)}raycast(e,t){if(this.raycastDeformed(e,t))return;let i=Nxe;i===null?super.raycast(e,t):i(this,e,t)}raycastDeformed(e,t){return!1}updateEntityBoxSize(e,t){let i=this.geometry.getAttribute("position");i!==void 0?VY(i,this.geometry.drawRange.start,this.geometry.drawRange.count<1/0?this.geometry.drawRange.count:i.count,e,t):super.updateEntityBoxSize(e,t)}}});function Ixe(e){return e?.isClassicNodeMaterial===!0}var kr,OA,Oxe,Lxe,UE,Bxe,Fxe,Uxe,zxe=U(()=>{}),Su=U(()=>{ae(),kr=class extends lt{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],s=i[2];switch(n){case"rgb":case"rgba":if(r=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))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(s))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}}}),kxe=U(()=>{Su(),OA=class extends kr{}}),sBe=U(()=>{Oxe=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}}}),Vxe=U(()=>{sBe(),Lxe=class extends Oxe{create(e){return URL.createObjectURL(new Blob([e]))}dispose(e,t){URL.revokeObjectURL(t)}}}),Gxe=U(()=>{Bxe=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}},Fxe=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}}}),aBe=U(()=>{ae(),Uxe=class extends e_e{constructor(e){super(e),this.type=di}parse(e){let t=function(p,f){switch(p){case 1:throw new Error("THREE.HDRLoader: Read Error: "+(f||""));case 2:throw new Error("THREE.HDRLoader: Write Error: "+(f||""));case 3:throw new Error("THREE.HDRLoader: Bad File Format: "+(f||""));default:throw new Error("THREE.HDRLoader: Memory Error: "+(f||""))}},i=function(p,f,m){f=f||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(`
|
|
4186
|
+
})();`});function m3(e){return e==null||e===""?void 0:String(e)}var uY,k_e=U(()=>{uY=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[s,a]of Object.entries(r)){let o=i.setVariable(s,a);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"getTexture":if(i.getTexture===void 0)throw new Error("getTexture: not available on this surface \u2014 a three.js texture instance needs the inline HTML-content mode (editor Preview/Play and web exports).");return i.getTexture(String(t[0]),t[1]??{});case"setMaterial":if(i.setMaterial===void 0)throw new Error("setMaterial: not available on this surface \u2014 custom three.js/TSL materials need the inline HTML-content mode (editor Preview/Play and web exports).");return i.setMaterial(String(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"getAnimations":{let r=i.getAnimations(m3(t[0]));return r.warning&&this.onConsole("warn",`spline.${e}: ${r.warning}`),r.clips}case"playAnimation":{let r=typeof t[1]=="object"&&t[1]!==null,n=i.playAnimation(String(t[0]),r?void 0:m3(t[1]),(r?t[1]:t[2])??{});return n.warning&&this.onConsole("warn",`spline.${e}: ${n.warning}`),n.clip}case"pauseAnimation":case"stopAnimation":{let r=m3(t[0]),n=m3(t[1]),s=e==="pauseAnimation"?i.pauseAnimation(r,n):i.stopAnimation(r,n);return s.warning&&this.onConsole("warn",`spline.${e}: ${s.warning}`),s.ok}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 s of Object.keys(r))i[s]!==r[s]&&n.push({name:s,value:r[s]});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 JLe(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 e4e=U(()=>{}),V_e,t4e=U(()=>{}),i4e=U(()=>{hY(),k_e(),V_e=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 s;typeof(s=n)!="object"||s===null||s[gg]!==!0||typeof s.kind!="string"||this.handleMessage(n)},this.host=new uY(t,i,(r,n)=>{this.sendEvent(r,n)})}attach(){window.addEventListener("message",this.onMessage),this.send({[gg]:!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({[gg]:!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({[gg]:!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({[gg]:!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({[gg]:!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}))}}}}),jr=U(()=>{lY(),ULe(),zLe(),kLe(),GLe(),jLe(),WLe(),HLe(),qLe(),$Le(),XLe(),ZLe(),hY(),QLe(),k_e(),e4e(),t4e(),i4e()}),r4e=U(()=>{});function G_e(e){return Array.isArray(e)?e:[e]}function wL(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 n4e=U(()=>{});function jo(e,t){return Object.setPrototypeOf(e,t),e}function UU(e){let t={...e};return Object.setPrototypeOf(t,Object.getPrototypeOf(e)),t}function Rg(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 s=e;e=t,t=s}let r=[],n=1/(i+1);for(let s=0;s<i;s++){let a=e+(t-e)*(s+.75+.5*Math.random())*n;r.push(a)}return r}function i1(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 s4e=U(()=>{});function dY(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"&&dY(r)}return Object.freeze(e)}function j_e(e){for(let t of Object.keys(e))e[t]===void 0&&delete e[t];return e}var zU,SL,DW,si,cY,a4e=U(()=>{}),la=U(()=>{r4e(),n4e(),s4e(),a4e()}),pY=U(()=>{zU=class{},SL=class extends zU{constructor(e){super(),this.id=e}},DW=class extends zU{constructor(e){super(),this.data=e}}}),o4e=U(()=>{}),cB=U(()=>{si=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,si.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:s}=e,a={...t,[n]:s};return Object.setPrototypeOf(a,si.prototype),{data:a,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,si.prototype),delete n[i],{data:n,actual:e,reverse:{type:1,id:i,data:r}}}}return null}}}),fY=U(()=>{cY=class extends Error{}});function W_e(e,t){for(let i of e)t(i.id,i.data)!==!0&&W_e(i.children,t)}function H_e(e,t){if(t(e.id,e.data)!==!0)for(let i of e.children)H_e(i,t)}var Aa,g3,rw,Ct,h1=U(()=>{la(),fY(),la(),Aa=class extends Array{constructor(...e){super(...e),Fc(this,"partialObjectCaches"),Fc(this,"objCaches"),Fc(this,"parentCaches"),Object.setPrototypeOf(this,Aa.prototype)}deepFreeze(){let e=0;for(;e<this.length;)dY(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&&H_e(i,t)}}traverse(e){W_e(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 s=r[n];r=[...r],r[n]={...s,data:t};let a=new Map;return a.set(e,r[n]),this.modifyArrayBy(i,r,a)}}modifyArrayBy(e,t,i=void 0){let r=e,n=t;for(;r!==null;){let a=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:a},i&&i.set(o,n[l])}Object.setPrototypeOf(n,Aa.prototype);let s=n;if(i&&this.objCaches!==void 0&&this.parentCaches!==void 0){s.objCaches=this.objCaches;for(let[a,o]of i)s.objCaches.set(a,o);s.parentCaches=this.parentCaches,this.objCaches=void 0,this.parentCaches=void 0}else s.fillCaches();return s}runOp(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:s}=e;if(t!==null&&this.get(t)===void 0||this.checkDuplicatedIdRec(e))return null;{let a=t,o=this.childrenArray(a),l={fi:i,id:r,data:n,children:s};return o=[...o,l],o.sort((h,u)=>h.fi-u.fi),e.localIndex=o.indexOf(l),{data:this.modifyArrayBy(a,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(a=>a.id===t);e.localIndex=n,r=[...r];let s=r.splice(n,1)[0];return{data:this.modifyArrayBy(i,r),actual:e,reverse:{type:7,...s,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 cY("cyclic tree");d=this.parent(d)}}let n=this.parent(r);if(n===void 0)return null;let s=n,a=this.childrenArray(n),o=a.findIndex(d=>d.id===r);a=[...a];let l=a.splice(o,1)[0],h=this.modifyArrayBy(n,a);n=t,a=h.childrenArray(n);let u=l.fi;return l={...l,fi:i},a=[...a,l],a.sort((d,c)=>d.fi-c.fi),e.localIndex=a.indexOf(l),h=h.modifyArrayBy(n,a),{data:h,actual:e,reverse:{type:9,parent:s,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)=>wL(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)=>wL(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 Rg(0,i,i);{let n=r[0].fi;return Rg(n-i,n,i)}}{let n=this.get(t);if(n===void 0||this.parent(t)!==e)throw new Error("illegal args");let s=r.find(a=>a.fi>n.fi);if(s===void 0){let a=r[r.length-1].fi;return Rg(a,a+i,i)}return Rg(n.fi,s.fi,i)}}}}),mY=U(()=>{var e;la(),g3=null,(e=rw||(rw={})).setPreservePrototype=function(t){g3=t},e.tryPreservePrototype=function(t,i){return Object.getPrototypeOf(t)===g3&&Object.setPrototypeOf(i,g3),i},e.runOp=function(t,i){if(i.type!==0)return null;if(Array.isArray(t)||i1(t)){let r=i.props,n={},s=i1(t)?t.slice():[...t],a=!1;if(r)for(let o of Object.keys(r)){let l=parseInt(o);if(isNaN(l))throw new Error("wrong index");n[o]=s[l],s[l]=r[o],a=!0}return a?{data:s,actual:i,reverse:{type:0,props:n}}:null}{let r=i.props,n={},s={...t},a=!1;if(r)for(let o of Object.keys(r)){n[o]=s[o];let l=r[o];l===void 0?delete s[o]:s[o]=l,a=!0}return a?{data:e.tryPreservePrototype(t,s),actual:i,reverse:{type:0,props:n}}:null}}}),u1=U(()=>{la(),la(),Ct=class extends Array{constructor(...e){super(...e),Fc(this,"objCaches"),Object.setPrototypeOf(this,Ct.prototype)}deepFreeze(){let e=0;for(;e<this.length;)dY(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(s=>s.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,Ct.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,s={fi:t,id:i,data:r};return n=[...n,s],n.sort((a,o)=>a.fi-o.fi),e.localIndex=n.indexOf(s),{data:this.modifyArrayBy(n),actual:e,reverse:{type:5,id:i}}}deleteOp(e){let{id:t}=e,i=this,r=i.findIndex(s=>s.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 s=r[n].fi,a={...r[n],fi:t};return r[n]=a,r.sort((o,l)=>o.fi-l.fi),e.localIndex=r.indexOf(a),{data:this.modifyArrayBy(r),actual:e,reverse:{type:6,fi:s,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 Rg(0,t,t);{let r=i[0].fi;return Rg(r-t,r,t)}}{let r=this.get(e);if(r===void 0)throw new Error("illegal args");let n=i.find(s=>s.fi>r.fi);if(n===void 0){let s=i[i.length-1].fi;return Rg(s,s+t,t)}return Rg(r.fi,n.fi,t)}}}});function l4e(e,t){let i={cur:[],result:[],len:0};return[e=Sx(e,t,i)??e,i.result]}function BI(e,t){return e===null?null:(e.cur[e.len]=t,e.len+=1,e)}function FI(e){e&&(e.len-=1)}function q_e(e,t,i){let r=!1,n=e.map(s=>{let a=s.id,o=t[a];if(o!==void 0&&typeof o=="string"&&(r=!0,a=o,i!==null))throw new Error("not supported");let l=Sx(s.data,t,BI(i,a));FI(i),r=r||l!==void 0,l===void 0&&(l=s.data);let h=q_e(s.children,t,i);return h!==void 0?r=!0:h=s.children,{...s,id:a,data:l,children:h}});if(r)return n}function Sx(e,t,i){if(e instanceof Aa){let r=q_e(e,t,i);return r!==void 0&&Object.setPrototypeOf(r,Object.getPrototypeOf(e)),r}if(e instanceof Ct)return function(r,n,s){let a=!1,o=r.map(l=>{let h=l.id,u=n[h];if(u!==void 0&&typeof u=="string"&&(a=!0,h=u,s!==null))throw new Error("not supported");let d=Sx(l.data,n,BI(s,h));return FI(s),a=a||d!==void 0,d===void 0&&(d=l.data),{...l,id:h,data:d}});if(a)return Object.setPrototypeOf(o,Object.getPrototypeOf(r)),o}(e,t,i);if(Array.isArray(e)){let r=!1,n=e.map((s,a)=>{let o=Sx(s,t,BI(i,a));return FI(i),r=r||o!==void 0,o===void 0&&(o=s),o});return r?(Object.setPrototypeOf(n,Object.getPrototypeOf(e)),n):void 0}if(e&&typeof e=="object"&&!i1(e)){let r={},n=!1;for(let[s,a]of Object.entries(e))if(s!=="name"&&s!=="variableId"){let o=t[s];if(typeof o=="string"){if(i!==null)throw new Error("not supported");n=!0,s=o}let l=Sx(a,t,BI(i,s));FI(i),n=n||l!==void 0,l===void 0&&(l=a),r[s]=l}else r[s]=a;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 $_e=U(()=>{h1(),u1(),la()});function Tx(e){return e&&typeof e=="object"&&e instanceof Ms}function gY(e,t){if(t===void 0)return;let i=!1,r=e.map(n=>{let s=n.id,a=DE(n.data,t[s]);if(i=i||a!==void 0,a===void 0&&(a=n.data),n.children){let o=gY(n.children,t);return o!==void 0?i=!0:o=n.children,{...n,id:s,data:a,children:o}}return{...n,id:s,data:a}});return i?r:void 0}function DE(e,t){if(!Tx(t))return t;if(e instanceof Aa){let i=gY(e,t);return i!==void 0&&Object.setPrototypeOf(i,Object.getPrototypeOf(e)),i}if(e instanceof Ct)return function(i,r){if(r===void 0)return;let n=!1,s=i.map(a=>{let o=a.id,l=DE(a.data,r[o]);return n=n||l!==void 0,l===void 0&&(l=a.data),{...a,id:o,data:l}});return n?(Object.setPrototypeOf(s,Object.getPrototypeOf(i)),s):void 0}(e,t);if(Array.isArray(e)){let i=!1,r=e.map((n,s)=>{let a=DE(n,t[s]);return i=i||a!==void 0,a===void 0&&(a=n),a});return i?(Object.setPrototypeOf(r,Object.getPrototypeOf(e)),r):void 0}if(e instanceof Ms)return vY(e,t);if(e&&typeof e=="object"){let i={},r=!1;for(let[n,s]of Object.entries(e)){let a=DE(s,t[n]);r=r||a!==void 0,a===void 0&&(a=s),i[n]=a}return r?(Object.setPrototypeOf(i,Object.getPrototypeOf(e)),i):void 0}}function vY(e,t){if(e===void 0)return t;if(t===void 0)return e;if(!Tx(t))return t;if(!Tx(e))return Gg.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 Ms;for(let n of i){let s=vY(e===void 0?void 0:e[n],t===void 0?void 0:t[n]);r[n]=s}return r}var Ms,Gg,TL,$a,Dee,pB=U(()=>{var e;h1(),u1(),fB(),la(),Ms=class{unusedFunOverridesTable(t){}runOp(t){let i=[],r=this,n=0,s={};for(;n<t.path.length;){if(i.push(r),r=r===void 0?void 0:r[t.path[n]],r!==void 0&&!Tx(r))return null;n+=1}r=r?UU(r):new Ms;for(let[a,o]of Object.entries(t.props)){let l=r[a];s[a]=l,o===void 0?delete r[a]:r[a]=o}for(;n>0;){if(Object.keys(r).length===0){let a=i[n-1];a&&(r=UU(a),delete r[t.path[n-1]])}else{let a=i[n-1];if(a){let o=UU(a);o[t.path[n-1]]=r,r=o}else{let o=new Ms;o[t.path[n-1]]=r,r=o}}n-=1}return{data:Object.setPrototypeOf(r,Ms.prototype),actual:t,reverse:{...t,props:s}}}},(e=Gg||(Gg={})).apply=function(t,i){return DE(t,i)??t},e.merge=function(t,i){return vY(t,i)},e.filterOp=function(t,i){let r=0,n=i.path,s=t;for(;r<n.length&&s!==void 0;){if(s=Sa.zoomOnce(s,n[r]),s===void 0)return i;if(!Tx(s))return;r+=1}if(s===void 0)return i;if(Tx(s)){if(i.type===0){let a={...i.props};for(let o of Object.keys(s))delete a[o];return{...i,props:a}}if(i.type===1||i.type===4||i.type===7){let a=gY([i],s);return a?a[0]:i}return i}}}),h4e=U(()=>{la(),fB(),cB(),h1(),fY(),mY(),u1(),$_e(),pB(),(TL||(TL={})).replaceProps=function(e,t){let i=Sa.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,s){let a=s.path,o=[];for(;;){let l;if(n instanceof Ms&&s.type===0&&(l=n.runOp({...s,path:a.slice(o.length)}),l===null&&(l=void 0)),l===void 0&&o.length===a.length&&(l=n instanceof Aa||n instanceof Ct||n instanceof si?n.runOp(s):rw.runOp(n,s)),l!==void 0){if(l!==null){let d=l.data;for(let c=o.length-1;c>=0;c--){let p=a[c],f=o[c];if(f instanceof Aa){if(typeof p=="number")throw new Error("illegal arg");d=f.modifyById(p,d)}else if(f instanceof Ct){if(typeof p=="number")throw new Error("illegal arg");d=f.modifyById(p,d)}else if(f instanceof si){if(typeof p=="number")throw new Error("illegal arg");d=f.modifyById(p,d)}else if(f instanceof Ms){let m={...f,[p]:d};d=Object.setPrototypeOf(m,Ms.prototype)}else{if(typeof f!="object")return null;if(Array.isArray(f)||i1(f)){if(typeof p=="string"&&(p=parseInt(p),isNaN(p)))throw new Error("Invalid path");let m=d;d=i1(f)?f.slice():[...f],d[p]=m}else d=rw.tryPreservePrototype(f,{...f,[p]:d})}}return{data:d,actual:{...l.actual,path:a},reverse:{...l.reverse,path:a}}}return null}let h,u=a[o.length];if(n instanceof Aa){if(typeof u=="number")throw new Error("");h=n.get(u)?.data}else if(n instanceof Ct){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,s){for(let a=0;a<n.length&&a<s.length;a++)if(n[a]!==s[a])return!0;return!1}function r(n,s){if(n.length!==s.length)return!1;for(let a=0;a<n.length;a++)if(n[a]!==s[a])return!1;return!0}e.drop=function(n,s){return{...n,path:n.path.slice(s)}},e.applySimple=function(n,s){return t(n,s)?.data??n},e.apply=t,e.pathDisjoint=i,e.pathEq=r,e.commutative=function(n,s){return i(n.path,s.path)},e.subsumed=function(n,s){return!(n.type!==0||s.type!==0||!r(n.path,s.path))&&Object.keys(n.props).every(a=>s.props[a]!==void 0)}})($a||($a={})),(e=>{function t(i,r){let n=i,s=[],a=[];for(let o of r)try{if(o.type===3||o.type===5&&o.path[o.path.length-1]==="variables"){let l,h;if(o.type===3?(l=Sa.zoom(n,[...o.path,o.id]),h=$a.apply(n,{...o,type:2})):(l=Sa.zoom(n,[...o.path,o.id,"value"]),h=$a.apply(n,o)),h!==null){n=h.data;let[u,d]=l4e(n,{[o.id]:l});n=u;for(let c=0;c<d.length;c++){let p,f,m=d[c],g=m.pop();if(typeof g=="number"){let v=[g];for(let _=c+1;_<d.length;_++){let b=d[_],x=b[b.length-1];if(typeof x!="number"||!Sa.equal(m,b.slice(0,b.length-1)))break;v.push(x),d.splice(_,1)}let y=Sa.zoom(n,m);f=y.map((_,b)=>v.includes(b)?o.id:_),p=y,g=m.pop()}else p=l,(g==="alphaOverride"||g==="alpha")&&(p=l/100,Sa.zoom(n,m)[g]=p),f=o.id;s.push({type:0,path:m,props:{[g]:p}}),a.push({type:0,path:m,props:{[g]:f}})}a.push(h.reverse),s.push(h.actual)}}else{let l=$a.apply(n,o);l!==null&&(s.push(l.actual),n=l.data,a.push(l.reverse))}}catch(l){if(l instanceof cY)return null;throw l}return{data:n,actual:s,reverse:a.reverse()}}e.empty=function(){return[]},e.removePrefix=function(i,r){let n=[];for(let s of i){let[a,...o]=s.path;a===r&&n.push({...s,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(s=>$a.subsumed(n,s))),...r]},e.commutative=function(i,r){return i.every(n=>r.every(s=>$a.commutative(n,s)))},e.applyAll=function(i,r){for(let n of r){let s=t(i,n);s!==null&&(i=s.data)}return i},e.apply=t})(Dee||(Dee={}))});function Nee(e,t){return e instanceof Ms?Object.setPrototypeOf(t,Ms.prototype):rw.tryPreservePrototype(e,t)}function kU(e,t,i){if(e.length>0){let r=e[e.length-1];if(r.type===0&&t.type===0&&Sa.equal(r.path,i))return void Object.assign(r.props,t.props)}e.push({...t,path:i})}function UI(e,t,i){return i instanceof Aa?new YA(e,t,i):i instanceof Ct?new KA(e,t,i):i instanceof si?new Proxy(new Y_e(e,t,i),Z_e):i!==null&&typeof i=="object"?i1(i)?i:new Proxy(new X_e(e,t,i),K_e):i}function IM(e){let t=new NW(e);return[UI(t,"",e),t]}function ML(e,t){let[i,r]=IM(e);return t(i),r.result()}function Os(e){return e instanceof YA||e instanceof KA?e._current:e!==null&&typeof e=="object"?e[EL]:e}function OM(e){if(e instanceof YA||e instanceof KA)return e._current;if(e!==null&&typeof e=="object"){let t=e[EL];return t!==void 0?t:e}return e}var EL,Iee,zS,H1,X_e,Y_e,VU,K_e,Z_e,YA,KA,NW,Sa,Q_e=U(()=>{cB(),h1(),mY(),u1(),la(),fB(),pB(),EL=Symbol(),Iee=Symbol(),zS=Symbol(),H1=class{reportOp(e,t,i=[]){let r=this;if(t===null)return;r._current=t.data;let n=i;for(;!(r instanceof NW);){let s=r._path,a=r._current;if(s!==""&&n.splice(0,0,s),r=r._parent,r===null)return;r.update(s,a)}r.push(n,e,t.actual,t.reverse)}deleteChildren(e){if(this._children){let t=this._children[e];if(t){let i=t[zS];i&&i(),delete this._children[e]}}}},X_e=class extends H1{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=Nee(this._current,{...this._current,[e]:t})}runOp(e){let t=rw.runOp(this._current,e);t!==null&&(t.data=Nee(this._current,t.data)),this.reportOp(e,t,e.path)}},Y_e=class extends H1{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,si.prototype)}runOp(e){this.reportOp(e,this._current.runOp(e))}},VU={get(e,t){if(t===zS)return()=>{e._parent=null};if(t===EL)return e._current;if(t===Iee)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 s=i[t],a=UI(e,t,s);return a!==s?(r===void 0&&(r={},e._children=r),r[t]=a,a):s},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]}}},K_e={...VU,set(e,t,i){let r={type:0,props:{[t]:Os(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}},Z_e={...VU,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)},YA=class extends H1{constructor(e,t,i){super(),this._children={},this._parent=e,this._path=t,this._current=i,this[zS]=()=>{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,s=UI(this,e,n);return s!==n?(i===void 0&&(i={},this._children=i),i[e]=s,s):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 s=i[n];this.add(e,r[n],s.id,s.data,s.children)}}insertBefore(e,t,i){let r=this._current.insertBeforeHelper(e,t,i.length);for(let n=0;n<i.length;n++){let s=i[n];this.add(e,r[n],s.id,s.data,s.children)}}moveAfter(e,t,i){let r=this._current.insertAfterHelper(e,t,i.length);for(let n=0;n<i.length;n++){let s=i[n];this.move(e,r[n],s)}}moveBefore(e,t,i){let r=this._current.insertBeforeHelper(e,t,i.length);for(let n=0;n<i.length;n++){let s=i[n];this.move(e,r[n],s)}}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)}},KA=class extends H1{constructor(e,t,i){super(),this._children={},this._parent=e,this._path=t,this._current=i,this[zS]=()=>{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,s=UI(this,e,n);return s!==n?(i===void 0&&(i={},this._children=i),i[e]=s,s):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})}},NW=class extends H1{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){kU(this.ts,t,e),kU(this.actual,i,e),kU(this.reverse,r,e)}result(){return{data:this._current,ts:this.ts,actual:this.actual,reverse:this.reverse.reverse()}}}}),fB=U(()=>{pY(),Q_e(),u1(),h1(),la(),(e=>{function t(r,n){return(r instanceof Aa||r instanceof YA)&&typeof n=="string"||(r instanceof Ct||r instanceof KA)&&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,s=0){for(;s<n.length&&r!==void 0;)r=t(r,n[s]),s+=1;return r}e.equal=function(r,n){if(n.length!==r.length)return!1;{let s=0;for(;s<r.length;){if(r[s]!==n[s])return!1;s+=1}}return!0},e.removeOverridden=function(r,n,s){let a=i(s,r);if(a!==void 0&&typeof a=="object"&&a!==null){let o={...n};return Object.keys(a).forEach(l=>{delete o[l]}),o}return n},e.zoomOnce=t,e.zoom=i,e.findPathes=function(r,n){let s=[];return function a(o,l){if(o instanceof SL&&o.id===n.id)s.push(l);else if(o instanceof Ct)for(let h=0;h<o.length;h++)a(o[h].data,[...l,o[h].id]);else if(o instanceof Aa)o.traverse((h,u)=>{a(u,[...l,h])});else if(Array.isArray(o)){if(typeof o[0]=="number")return;for(let h=0;h<o.length;h++)a(o[h],[...l,h])}else{if(i1(o))return;if(typeof o=="object"&&o!==null)for(let h in o)a(o[h],[...l,h])}}(r,[]),s}})(Sa||(Sa={}))}),u4e=U(()=>{});function Jr(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 d4e=U(()=>{});function v3(e){try{if(!An.trusted&&!Sf){let i=Ur.sharedLength||0;i<Ur.length&&(Ur.length=i)}let t;if(An.randomAccessStructure&&Rt[Le]<64&&Rt[Le]>=32&&zee?(t=zee(Rt,Le,vu,An),Rt=null,!(e&&e.lazy)&&t&&(t=t.toJSON()),Le=vu):t=Qs(),To&&(Le=To.postBundlePosition,To=null),Sf&&(Ur.restoreStructures=null),Le==vu)Ur&&Ur.restoreStructures&&Oee(),Ur=null,Rt=null,wf&&(wf=null);else{if(Le>vu)throw new Error("Unexpected end of MessagePack data");if(!Sf){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 Ur&&Ur.restoreStructures&&Oee(),OW(),(t instanceof RangeError||t.message.startsWith("Unexpected end of buffer")||Le>vu)&&(t.incomplete=!0),t}}function Oee(){for(let e in Ur.restoreStructures)Ur[e]=Ur.restoreStructures[e];Ur.restoreStructures=null}function Qs(){let e=Rt[Le++];if(e<160){if(e<128){if(e<64)return e;{let t=Ur[63&e]||An.getStructures&&J_e()[63&e];return t?(t.read||(t.read=IW(t,63&e)),t.read()):e}}if(e<144){if(e-=128,An.mapsAsObjects){let t={};for(let i=0;i<e;i++){let r=tbe();r==="__proto__"&&(r="__proto_"),t[r]=Qs()}return t}{let t=new Map;for(let i=0;i<e;i++)t.set(Qs(),Qs());return t}}{e-=144;let t=new Array(e);for(let i=0;i<e;i++)t[i]=Qs();return An.freezeData?Object.freeze(t):t}}if(e<192){let t=e-160;if(vd>=Le)return Dg.slice(Le-Mh,(Le+=t)-Mh);if(vd==0&&vu<140){let i=t<16?yY(t):ebe(t);if(i!=null)return i}return PL(t)}{let t;switch(e){case 192:return null;case 193:return To?(t=Qs(),t>0?To[1].slice(To.position1,To.position1+=t):To[0].slice(To.position0,To.position0-=t)):nbe;case 194:return!1;case 195:return!0;case 196:if(t=Rt[Le++],t===void 0)throw new Error("Unexpected end of buffer");return GU(t);case 197:return t=Ar.getUint16(Le),Le+=2,GU(t);case 198:return t=Ar.getUint32(Le),Le+=4,GU(t);case 199:return O0(Rt[Le++]);case 200:return t=Ar.getUint16(Le),Le+=2,O0(t);case 201:return t=Ar.getUint32(Le),Le+=4,O0(t);case 202:if(t=Ar.getFloat32(Le),An.useFloat32>2){let i=kW[(127&Rt[Le])<<1|Rt[Le+1]>>7];return Le+=4,(i*t+(t>0?.5:-.5)|0)/i}return Le+=4,t;case 203:return t=Ar.getFloat64(Le),Le+=8,t;case 204:return Rt[Le++];case 205:return t=Ar.getUint16(Le),Le+=2,t;case 206:return t=Ar.getUint32(Le),Le+=4,t;case 207:return An.int64AsType==="number"?(t=4294967296*Ar.getUint32(Le),t+=Ar.getUint32(Le+4)):An.int64AsType==="string"?t=Ar.getBigUint64(Le).toString():An.int64AsType==="auto"?(t=Ar.getBigUint64(Le),t<=BigInt(2)<<BigInt(52)&&(t=Number(t))):t=Ar.getBigUint64(Le),Le+=8,t;case 208:return Ar.getInt8(Le++);case 209:return t=Ar.getInt16(Le),Le+=2,t;case 210:return t=Ar.getInt32(Le),Le+=4,t;case 211:return An.int64AsType==="number"?(t=4294967296*Ar.getInt32(Le),t+=Ar.getUint32(Le+4)):An.int64AsType==="string"?t=Ar.getBigInt64(Le).toString():An.int64AsType==="auto"?(t=Ar.getBigInt64(Le),t>=BigInt(-2)<<BigInt(52)&&t<=BigInt(2)<<BigInt(52)&&(t=Number(t))):t=Ar.getBigInt64(Le),Le+=8,t;case 212:if(t=Rt[Le++],t==114)return zW(63&Rt[Le++]);{let i=yo[t];if(i)return i.read?(Le++,i.read(Qs())):i.noBuffer?(Le++,i()):i(Rt.subarray(Le,++Le));throw new Error("Unknown extension "+t)}case 213:return t=Rt[Le],t==114?(Le++,zW(63&Rt[Le++],Rt[Le++])):O0(2);case 214:return O0(4);case 215:return O0(8);case 216:return O0(16);case 217:return t=Rt[Le++],vd>=Le?Dg.slice(Le-Mh,(Le+=t)-Mh):abe(t);case 218:return t=Ar.getUint16(Le),vd>=(Le+=2)?Dg.slice(Le-Mh,(Le+=t)-Mh):obe(t);case 219:return t=Ar.getUint32(Le),vd>=(Le+=4)?Dg.slice(Le-Mh,(Le+=t)-Mh):lbe(t);case 220:return t=Ar.getUint16(Le),Le+=2,Lee(t);case 221:return t=Ar.getUint32(Le),Le+=4,Lee(t);case 222:return t=Ar.getUint16(Le),Le+=2,Bee(t);case 223:return t=Ar.getUint32(Le),Le+=4,Bee(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 IW(e,t){function i(){if(i.count++>BW){let n;try{n=e.read=new Function("r","return function(){return "+(An.freezeData?"Object.freeze":"")+"({"+e.map(s=>s==="__proto__"?"__proto_:r()":sbe.test(s)?s+":r()":"["+JSON.stringify(s)+"]:r()").join(",")+"})}")(Qs)}catch{return BW=1/0,i()}return e.read0=n,e.highByte===0&&(e.read=FW(t,e.read)),n()}let r={};for(let n=0,s=e.length;n<s;n++){let a=e[n];a==="__proto__"&&(a="__proto_"),r[a]=Qs()}return An.freezeData?Object.freeze(r):r}return i.count=0,e.read0=i,e.highByte===0?FW(t,i):i}function J_e(){let e=rbe(()=>(Rt=null,An.getStructures()));return Ur=An._mergeStructures(e,Ur)}function LM(e){let t;if(e<16&&(t=yY(e)))return t;if(e>64&&LW)return LW.decode(Rt.subarray(Le,Le+=e));let i=Le+e,r=[];for(t="";Le<i;){let n=Rt[Le++];if(128&n)if((224&n)==192){let s=(31&n)<<6|63&Rt[Le++];s<128?r.push(65533):r.push(s)}else if((240&n)==224){let s=(31&n)<<12|(63&Rt[Le++])<<6|63&Rt[Le++];s<2048||s>=55296&&s<=57343?r.push(65533):r.push(s)}else if((248&n)==240){let s=(7&n)<<18|(63&Rt[Le++])<<12|(63&Rt[Le++])<<6|63&Rt[Le++];s<65536||s>1114111?r.push(65533):(s>65535&&(s-=65536,r.push(s>>>10&1023|55296),s=56320|1023&s),r.push(s))}else r.push(65533);else r.push(n);r.length>=4096&&(t+=xa.apply(String,r),r.length=0)}return r.length>0&&(t+=xa.apply(String,r)),t}function Lee(e){let t=new Array(e);for(let i=0;i<e;i++)t[i]=Qs();return An.freezeData?Object.freeze(t):t}function Bee(e){if(An.mapsAsObjects){let t={};for(let i=0;i<e;i++){let r=tbe();r==="__proto__"&&(r="__proto_"),t[r]=Qs()}return t}{let t=new Map;for(let i=0;i<e;i++)t.set(Qs(),Qs());return t}}function ebe(e){let t=Le,i=new Array(e);for(let r=0;r<e;r++){let n=Rt[Le++];if((128&n)>0)return void(Le=t);i[r]=n}return xa.apply(String,i)}function yY(e){if(e<4){if(e<2){if(e===0)return"";{let t=Rt[Le++];return(128&t)>1?void(Le-=1):xa(t)}}{let t=Rt[Le++],i=Rt[Le++];if((128&t)>0||(128&i)>0)return void(Le-=2);if(e<3)return xa(t,i);let r=Rt[Le++];return(128&r)>0?void(Le-=3):xa(t,i,r)}}{let t=Rt[Le++],i=Rt[Le++],r=Rt[Le++],n=Rt[Le++];if((128&t)>0||(128&i)>0||(128&r)>0||(128&n)>0)return void(Le-=4);if(e<6){if(e===4)return xa(t,i,r,n);{let s=Rt[Le++];return(128&s)>0?void(Le-=5):xa(t,i,r,n,s)}}if(e<8){let s=Rt[Le++],a=Rt[Le++];if((128&s)>0||(128&a)>0)return void(Le-=6);if(e<7)return xa(t,i,r,n,s,a);let o=Rt[Le++];return(128&o)>0?void(Le-=7):xa(t,i,r,n,s,a,o)}{let s=Rt[Le++],a=Rt[Le++],o=Rt[Le++],l=Rt[Le++];if((128&s)>0||(128&a)>0||(128&o)>0||(128&l)>0)return void(Le-=8);if(e<10){if(e===8)return xa(t,i,r,n,s,a,o,l);{let h=Rt[Le++];return(128&h)>0?void(Le-=9):xa(t,i,r,n,s,a,o,l,h)}}if(e<12){let h=Rt[Le++],u=Rt[Le++];if((128&h)>0||(128&u)>0)return void(Le-=10);if(e<11)return xa(t,i,r,n,s,a,o,l,h,u);let d=Rt[Le++];return(128&d)>0?void(Le-=11):xa(t,i,r,n,s,a,o,l,h,u,d)}{let h=Rt[Le++],u=Rt[Le++],d=Rt[Le++],c=Rt[Le++];if((128&h)>0||(128&u)>0||(128&d)>0||(128&c)>0)return void(Le-=12);if(e<14){if(e===12)return xa(t,i,r,n,s,a,o,l,h,u,d,c);{let p=Rt[Le++];return(128&p)>0?void(Le-=13):xa(t,i,r,n,s,a,o,l,h,u,d,c,p)}}{let p=Rt[Le++],f=Rt[Le++];if((128&p)>0||(128&f)>0)return void(Le-=14);if(e<15)return xa(t,i,r,n,s,a,o,l,h,u,d,c,p,f);let m=Rt[Le++];return(128&m)>0?void(Le-=15):xa(t,i,r,n,s,a,o,l,h,u,d,c,p,f,m)}}}}}function Fee(){let e,t=Rt[Le++];if(t<192)e=t-160;else switch(t){case 217:e=Rt[Le++];break;case 218:e=Ar.getUint16(Le),Le+=2;break;case 219:e=Ar.getUint32(Le),Le+=4;break;default:throw new Error("Expected string")}return LM(e)}function GU(e){return An.copyBuffers?Uint8Array.prototype.slice.call(Rt,Le,Le+=e):Rt.subarray(Le,Le+=e)}function O0(e){let t=Rt[Le++];if(yo[t]){let i;return yo[t](Rt.subarray(Le,i=Le+=e),r=>{Le=r;try{return Qs()}finally{Le=i}})}throw new Error("Unknown extension type "+t)}function tbe(){let e=Rt[Le++];if(!(e>=160&&e<192))return Le--,ibe(Qs());if(e-=160,vd>=Le)return Dg.slice(Le-Mh,(Le+=e)-Mh);if(!(vd==0&&vu<180))return PL(e);let t,i=4095&(e<<5^(e>1?Ar.getUint16(Le):e>0?Rt[Le]:0)),r=UW[i],n=Le,s=Le+e-3,a=0;if(r&&r.bytes==e){for(;n<s;){if(t=Ar.getUint32(n),t!=r[a++]){n=1879048192;break}n+=4}for(s+=3;n<s;)if(t=Rt[n++],t!=r[a++]){n=1879048192;break}if(n===s)return Le=n,r.string;s-=3,n=Le}for(r=[],UW[i]=r,r.bytes=e;n<s;)t=Ar.getUint32(n),r.push(t),n+=4;for(s+=3;n<s;)t=Rt[n++],r.push(t);let o=e<16?yY(e):ebe(e);return r.string=o??PL(e)}function ibe(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(An.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 rbe(e){kee&&kee();let t=vu,i=Le,r=CL,n=Mh,s=vd,a=Dg,o=AL,l=wf,h=To,u=new Uint8Array(Rt.slice(0,vu)),d=Ur,c=Ur.slice(0,Ur.length),p=An,f=Sf,m=e();return vu=t,Le=i,CL=r,Mh=n,vd=s,Dg=a,AL=o,wf=l,To=h,Rt=u,Sf=f,(Ur=d).splice(0,Ur.length,...c),An=p,Ar=new DataView(Rt.buffer,Rt.byteOffset,Rt.byteLength),m}function OW(){Rt=null,wf=null,Ur=null}function c4e(e){e.unpack?yo[e.type]=e.unpack:yo[e.type]=e}var LW,Rt,vu,Le,Uee,AL,CL,An,Ur,Dg,Mh,vd,To,wf,yo,Ar,jU,nbe,Sf,BW,zee,kee,BM,sbe,FW,PL,abe,obe,lbe,xa,UW,zW,WU,Vee,Gee,jee,kW,y3,Wee,Hee,qee,VW,HU,MA,p4e=U(()=>{try{LW=new TextDecoder}catch{}Le=0,AL=Uee=[],CL=0,An={},Mh=0,vd=0,yo=[],jU={useRecords:!1,mapsAsObjects:!0},(nbe=new class{}).name="MessagePack 0xC1",Sf=!1,BW=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(Rt)return rbe(()=>(OW(),this?this.unpack(e,t):BM.prototype.unpack.call(jU,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,Le=t.start||0):(Le=0,vu=t>-1?t:e.length),CL=0,vd=0,Dg=null,AL=Uee,To=null,Rt=e;try{Ar=e.dataView||(e.dataView=new DataView(e.buffer,e.byteOffset,e.byteLength))}catch(i){throw Rt=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(An=this,this.structures)return Ur=this.structures,v3(t);(!Ur||Ur.length>0)&&(Ur=[])}else An=jU,(!Ur||Ur.length>0)&&(Ur=[]);return v3(t)}unpackMultiple(e,t){let i,r=0;try{Sf=!0;let n=e.length,s=this?this.unpack(e,n):y3.unpack(e,n);if(!t){for(i=[s];Le<n;)r=Le,i.push(v3());return i}if(t(s,r,Le)===!1)return;for(;Le<n;)if(r=Le,t(v3(),r,Le)===!1)return}catch(n){throw n.lastPosition=r,n.values=i,n}finally{Sf=!1,OW()}}_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)}},sbe=/^[a-zA-Z_$][a-zA-Z\d_$]*$/,FW=(e,t)=>function(){let i=Rt[Le++];if(i===0)return t();let r=e<32?-(e+(i<<5)):e+(i<<5),n=Ur[r]||J_e()[r];if(!n)throw new Error("Record id is not defined for "+r);return n.read||(n.read=IW(n,e)),n.read()},PL=LM,abe=LM,obe=LM,lbe=LM,xa=String.fromCharCode,UW=new Array(4096),zW=(e,t)=>{let i=Qs().map(ibe),r=e;t!==void 0&&(e=e<32?-((t<<5)+e):(t<<5)+e,i.highByte=t);let n=Ur[e];return n&&(n.isShared||Sf)&&((Ur.restoreStructures||(Ur.restoreStructures=[]))[e]=n),Ur[e]=i,i.read=IW(i,r),(i.read0||i.read)()},yo[0]=()=>{},yo[0].noBuffer=!0,yo[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=(s,a)=>{let o=a-s;if(o<=40){let d=r.getBigUint64(s);for(let c=s+8;c<a;c+=8)d<<=BigInt(64),d|=r.getBigUint64(c);return d}let l=s+(o>>4<<3),h=n(s,l),u=n(l,a);return h<<BigInt(8*(a-l))|u};i=i<<BigInt(8*(r.byteLength-t))|n(t,r.byteLength)}return i},WU={Error,EvalError,RangeError,ReferenceError,SyntaxError,TypeError,URIError,AggregateError:typeof AggregateError=="function"?AggregateError:null},yo[101]=()=>{let e=Qs();if(!WU[e[0]]){let t=Error(e[1],{cause:e[2]});return t.name=e[0],t}return WU[e[0]](e[1],{cause:e[2]})},yo[105]=e=>{if(An.structuredClone===!1)throw new Error("Structured clone extension is disabled");let t=Ar.getUint32(Le-4);wf||(wf=new Map);let i,r=Rt[Le];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)&&Rt[Le+1]===115?new Set:{};let n={target:i};wf.set(t,n);let s=Qs();if(!n.used)return n.target=s;if(Object.assign(i,s),i instanceof Map)for(let[a,o]of s.entries())i.set(a,o);if(i instanceof Set)for(let a of Array.from(s))i.add(a);return i},yo[112]=e=>{if(An.structuredClone===!1)throw new Error("Structured clone extension is disabled");let t=Ar.getUint32(Le-4),i=wf.get(t);return i.used=!0,i.target},yo[115]=()=>new Set(Qs()),Vee=["Int8","Uint8","Uint8Clamped","Int16","Uint16","Int32","Uint32","Float32","Float64","BigInt64","BigUint64"].map(e=>e+"Array"),Gee=typeof globalThis=="object"?globalThis:window,yo[116]=e=>{let t=e[0],i=Uint8Array.prototype.slice.call(e,1).buffer,r=Vee[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 Gee[r](i)},yo[120]=()=>{let e=Qs();return new RegExp(e[0],e[1])},jee=[],yo[98]=e=>{let t=(e[0]<<24)+(e[1]<<16)+(e[2]<<8)+e[3],i=Le;return Le+=t-e.length,To=jee,(To=[Fee(),Fee()]).position0=0,To.position1=0,To.postBundlePosition=Le,Le=i,Qs()},yo[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"),kW=new Array(147);for(let e=0;e<256;e++)kW[e]=+("1e"+Math.floor(45.15-.30103*e));(y3=new BM({useRecords:!1})).unpack,y3.unpackMultiple,y3.unpack,Wee=new Float32Array(1),new Uint8Array(Wee.buffer,0,4)}),f4e=U(()=>{p4e(),pY(),pB(),u1(),cB(),h1(),Hee=[{Class:si.prototype.constructor,type:1,write:e=>({...e}),read:e=>(Object.setPrototypeOf(e,si.prototype),e)},{Class:Ct.prototype.constructor,type:2,write:e=>[...e],read:e=>(Object.setPrototypeOf(e,Ct.prototype),e)},{Class:Aa.prototype.constructor,type:3,write:e=>[...e],read:e=>(Object.setPrototypeOf(e,Aa.prototype),e)},{Class:SL.prototype.constructor,type:4,write:e=>e.id,read:e=>new SL(e)},{Class:DW.prototype.constructor,type:5,write:e=>e.data,read:e=>new DW(e)},{Class:Ms.prototype.constructor,type:6,write:e=>({...e}),read:e=>(Object.setPrototypeOf(e,Ms.prototype),e)}];for(let e of Hee)c4e(e);qee=new BM({structuredClone:!0}),(VW||(VW={})).deserialize=function(e){return qee.unpack(e)}}),m4e=U(()=>{f4e(),HU=e=>()=>{throw new Error(e+" is not available in the runtime build (decode-only CollabSerialize)")},MA={deserialize:VW.deserialize,serialize:HU("CollabSerialize.serialize"),checksum:HU("CollabSerialize.checksum")}}),Or=U(()=>{fB(),o4e(),fY(),h1(),cB(),mY(),u1(),h4e(),u4e(),Q_e(),d4e(),pY(),m4e(),$_e(),pB()});function GW(e){return e==="MouseDown"||e==="MouseUp"||e==="KeyDown"||e==="KeyUp"||e==="Collision"||e==="Trigger"}var $ee,jW,NE,_3,qU,Xee,Yee,Kee,WW,HW,Zee,Qee,Jee,ete,tte,qW,$W,ite,rte,nte,ste,hbe=U(()=>{var e,t,i;Or(),ae(),(e=$ee||($ee={})).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},jW={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 Ct}:{type:n,disabled:!1,name:"",key:void 0,actions:new Ct}}})(NE||(NE={})),(r=>{r.propertyDefaultData=function(n){return{type:"Property",value:[n??null,"position","x"]}},r.valueDefaultData={type:"Literal",value:0}})(_3||(_3={})),(t=qU||(qU={})).comparisonDefaultData=function(r){return{type:"Comparison",operator:"==",lOperand:_3.propertyDefaultData(r),rOperand:{..._3.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}},(Xee||(Xee={})).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 Ct,outActions:new Ct,condition:qU.distanceDefaultData(n)}}})(Yee||(Yee={})),(Kee||(Kee={})).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 Ct,drop:new Ct}},(WW||(WW={})).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 Ct},(HW||(HW={})).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 Ct}}})(Zee||(Zee={})),(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 Ct}}})(Qee||(Qee={})),(r=>{r.is=function(n){return n.type==="Start"},r.defaultData=function(){return{type:"Start",disabled:!1,name:"",actions:new Ct}}})(Jee||(Jee={})),(r=>{r.is=function(n){return n.type==="Collision"},r.defaultData=function(){return{type:"Collision",disabled:!1,name:"",target:"character",actions:new Ct}}})(ete||(ete={})),(r=>{r.is=function(n){return n.type==="Trigger"},r.defaultData=function(n,s){return{type:"Trigger",name:"",disabled:!1,target:"all",triggeringObjects:[],actions:new Ct,triggerZone:"box",position:s.toArray(),rotation:[0,0,0],size:n.toArray(),radius:n.length()/2,helperVisible:!0}}})(tte||(tte={})),(i=qW||(qW={})).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 Ct},n={size:"tablet",operator:"<",actions:new Ct},s={size:[...i.defaultSizes.custom],operator:"<>",actions:new Ct},a=new Ct;return a.push({id:et.generateUUID(),fi:0,data:r},{id:et.generateUUID(),fi:1,data:n},{id:et.generateUUID(),fi:2,data:s}),{type:"Resize",disabled:!1,name:"",orientation:"horizontal",breakpoints:a}},i.defaultBreakpointData=function(){return{size:[...i.defaultSizes.custom],operator:"<>",actions:new Ct}},(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 Ct,variableId:"",objectId:null,property:"Position X"}}})($W||($W={})),(r=>{r.is=function(n){return n.type==="API"},r.defaultData=function(){return{disabled:!1,type:"API",name:"",successActions:new Ct,errorActions:new Ct,userAPIId:""}}})(ite||(ite={})),(r=>{r.is=function(n){return n.type==="WEBHOOK"},r.defaultData=function(){return{disabled:!1,type:"WEBHOOK",name:"",actions:new Ct,userWebhookId:""}}})(rte||(rte={})),(r=>{r.is=function(n){return n.type==="AIAssistantListener"},r.defaultData=function(){return{disabled:!1,type:"AIAssistantListener",name:"",actions:new Ct,analysis:"average",analysisRange:[0,71],analysisSingle:0}}})(nte||(nte={})),(r=>{r.is=function(n){return n.type==="AIAssistantTrigger"},r.defaultData=function(){return{disabled:!1,description:"",name:"",type:"AIAssistantTrigger",actions:new Ct}}})(ste||(ste={}))});function ate(e){let t=typeof e;return e!==null&&(t==="object"||t==="function")}function XW(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 d1,Mx,ube,Ja,ote,Uc,jg,EA,lte,$U,Dh,Ks,Gr,YW,hte,Ng,nw,ute,dte,cte,pte,fte,mte,gte,vte,XU,yte,_te,YU,bte,xte,wte,KU,Ste,ZU,Tte,Mte,QU,Ete,KW,Ate,Cte,Pte,Rte,Dte,Nte,r1,Tf,Ig,ZW,QW,RL,DL,NL,IL,OL,JW,eH,LL,tH,Ex,Ite,JU,e5,iH,Ote,BL,FL,t5,Lte,AA,i5,Bte,Fte,Ute,zte,kte,Vte,Gte,jte,mB,_Y,rs,Kn,Ib,dbe,sw,UL,Xv,rH,bY,zL,kL,VL,ff,zI,Yn,r5,Tg,th=U(()=>{var e,t,i,r,n,s,a,o;d1="personal camera",Mx="a218fcc3-276b-49b9-b485-49037fd14f5f",ube=2500134,Ja=5526619,(e=ote||{}).x="x",e.y="y",e.z="z",ote=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,f){let m=l.sub(p,c),g=l.sub(f,c),v=l.dot(m,g)/l.dot(m,m),y=l.scalarMultiply(m,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,f){return[c[0]+(p[0]-c[0])*f,c[1]+(p[1]-c[1])*f]},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,f){return u(c,d(c,p,f))},l.center=function(c,p){return[.5*(c[0]+p[0]),.5*(c[1]+p[1])]}})(Uc||(Uc={})),(t=jg||(jg={})).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=EA||(EA={})).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])]}})(lte||(lte={})),(r=$U||($U={})).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},(l=>{l.zero=[0,0,0,0,0,0],l.INDEX_MAP=[4,8,1,9,2,6],l.toMatrix=function(h){let u=[...$U.identity];for(let d=0;d<6;d++)u[l.INDEX_MAP[d]]=h[d];return u},l.fromMatrix=function(h){return[h[l.INDEX_MAP[0]],h[l.INDEX_MAP[1]],h[l.INDEX_MAP[2]],h[l.INDEX_MAP[3]],h[l.INDEX_MAP[4]],h[l.INDEX_MAP[5]]]}})(Dh||(Dh={})),(n=Ks||(Ks={})).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!!ate(l)&&"r"in l&&"g"in l&&"b"in l&&!("a"in l)},(s=Gr||(Gr={})).white={...Ks.white,a:1},s.is=function(l){return!!ate(l)&&"r"in l&&"g"in l&&"b"in l&&"a"in l},s.transparent={...Ks.white,a:0},s.from0to1=function(l){return{r:l[0],g:l[1],b:l[2],a:l[3]}},s.fromHexAndA=function(l,h){return{...Ks.fromHex(l),a:h}},s.toRgb255a1=function(l){return{r:Math.round(255*l.r),g:Math.round(255*l.g),b:Math.round(255*l.b),a:l.a}},s.equals=function(l,h){return Ks.equals(l,h)&&l.a===h.a},s.equalsFixed=function(l,h){return Ks.equalsFixed(l,h)&&l.a.toFixed(2)===h.a.toFixed(2)},s.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}},s.toStyle=function({r:l,g:h,b:u,a:d}=s.white){return`rgba(${255*l}, ${255*h}, ${255*u}, ${d})`},(YW||(YW={})).identity={position:[0,0,0],rotation:[0,0,0],scale:[1,1,1],pivot:[0,0,0],pivotRotation:[0,0,0]},(a=hte||{})[a.LINEAR=0]="LINEAR",a[a.EASE=1]="EASE",a[a.EASE_IN=2]="EASE_IN",a[a.EASE_OUT=3]="EASE_OUT",a[a.EASE_IN_OUT=4]="EASE_IN_OUT",a[a.CUBIC=5]="CUBIC",a[a.SPRING=6]="SPRING",a[a.ARC=7]="ARC",a[a.NONE=8]="NONE",hte=a,(Ng||(Ng={})).defaultData={mass:1,stiffness:80,damping:10,velocity:0},(nw||(nw={})).defaultData={control1:[.5,0],control2:[.5,1]},(o=ute||(ute={})).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]}),g4e=U(()=>{var e,t;Or(),hbe(),(dte||(dte={})).defaultData={type:"SwitchCamera",name:"",targetCamera:"",delay:0,animate:!0,duration:1e3,easing:4,runMode:"Normal"},(cte||(cte={})).defaultData={type:"SceneTransition",name:"",target:"",delay:0,duration:1,transition:"none"},(pte||(pte={})).defaultData={type:"Link",name:"",url:null,context:"tab"},(fte||(fte={})).defaultData={type:"Destroy",name:"",objects:[],delay:0},(mte||(mte={})).defaultData={type:"Particles",name:"",emitterObjectId:"",delay:0,emission:"start",triggerAfter:"any"},(gte||(gte={})).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"},(vte||(vte={})).defaultData={type:"Reset",name:"",delay:0},(XU||(XU={})).defaultData={interaction:"play",delay:0,volume:.5,loop:1},(e=yte||(yte={})).pauseDefaultData={interaction:"pause",delay:0},e.stopDefaultData={interaction:"stop",delay:0},(t=_te||(_te={})).defaultData={type:"Audio",name:"",...XU.defaultData},t.hasAudioByActions=i=>i.some(({data:r})=>r.type==="Audio"&&r.interaction==="play"&&r.audio),t.hasAudioByEvents=i=>t.getAudiosByEvents(i).length>0,t.getAudiosByActions=i=>{let r=[];return i.forEach(n=>{let s=n.data;s.type==="Audio"&&s.interaction==="play"&&s.audio&&r.push(n),s.type==="Conditional"&&(r.push(...t.getAudiosByActions(s.ifActions)),r.push(...t.getAudiosByActions(s.elseActions)))}),r},t.getAudiosByEvents=i=>{let r=[];return i.forEach(({data:n})=>{NE.is(n)||n.type==="Collision"||n.type==="Start"||n.type==="Trigger"||n.type==="VariableChange"||n.type==="WEBHOOK"||n.type==="AIAssistantTrigger"?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(s=>{r.push(...t.getAudiosByActions(s))}):n.type==="DragDrop"?(r.push(...t.getAudiosByActions(n.dragDropActions.drag)),r.push(...t.getAudiosByActions(n.dragDropActions.drop))):n.type==="Resize"?n.breakpoints.forEach(({data:s})=>{r.push(...t.getAudiosByActions(s.actions))}):n.type==="API"&&(r.push(...t.getAudiosByActions(n.successActions)),r.push(...t.getAudiosByActions(n.errorActions)))}),r},(YU||(YU={})).defaultData={interaction:"play",delay:0,volume:.5,loop:1/0},(i=>{i.pauseDefaultData={interaction:"pause",delay:0},i.stopDefaultData={interaction:"stop",delay:0}})(bte||(bte={})),(i=>{i.defaultData={type:"Video",name:"",triggerAfter:"autoplay",...YU.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((NE.is(n)||n.type==="Start")&&i.hasVideoByActions(n.actions))return!0}},i.getVideosByActions=r=>{let n=[];return r.forEach(s=>{let a=s.data;a.type==="Video"&&a.interaction==="play"&&a.layerId&&n.push(s)}),n},i.getVideosByEvents=r=>{let n=[];return r.forEach(({data:s})=>{(NE.is(s)||s.type==="Start")&&n.push(...i.getVideosByActions(s.actions))}),n}})(xte||(xte={})),(wte||(wte={})).defaultData=function(i){return{state:i,repeat:0,delay:0,delayDirection:"start-once",direction:"normal",duration:1e3,easing:4}},(KU||(KU={})).defaultData=function(){return{tweens:new Ct,repeat:0,delay:0,delayDirection:"start-once",direction:"normal"}},(Ste||(Ste={})).defaultData=function(i){return{type:"Transition",name:"",runMode:"Once",object:i??null,...KU.defaultData()}},(ZU||(ZU={})).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}})(Tte||(Tte={})),(Mte||(Mte={})).defaultData=function(i){return{type:"TimelineAnimation",name:"",...ZU.defaultData(i)}},(QU||(QU={})).defaultData=function(i,r,n){return{interaction:"play",object:i,clipId:r,crop:n,crop2:n,repeat:-1,delay:0,delayDirection:"start-once",direction:"normal",runMode:"Normal"}},(i=>{i.pauseDefaultData={interaction:"pause",delay:0},i.stopDefaultData={interaction:"stop",delay:0}})(Ete||(Ete={})),(i=>{i.defaultData=function(r,n,s){return{type:"Animation",name:"",...QU.defaultData(r,n,s)}},i.isPause=function(r){return r.interaction==="pause"||r.interaction==="stop"}})(KW||(KW={})),(Ate||(Ate={})).defaultData={type:"SetVariable",name:"",variableId:"",expression:[]},(Cte||(Cte={})).defaultData=()=>({type:"Conditional",name:"",ifActions:new Ct,elseActions:new Ct,condition:[]}),(Pte||(Pte={})).defaultData={type:"DynamicVariablePlay",name:"",variableId:"",mode:"PlayPause",delay:0,pauseDelay:0},(Rte||(Rte={})).defaultData={type:"ClearLocalStorage",name:"",target:"all"},(Dte||(Dte={})).defaultData={name:"",type:"UserAPI"}}),v4e=U(()=>{var e;(e=Nte||(Nte={})).emptyAudio={data:Uint8Array.from(atob("UklGRjIAAABXQVZFZm10IBIAAAABAAEAQB8AAEAfAAABAAgAAABmYWN0BAAAAAAAAABkYXRhAAAAAA=="),t=>t.charCodeAt(0)),mimeType:"audio/wav",filename:"unknown"},e.maxSize=2e6}),cbe=U(()=>{var e;(e=r1||(r1={})).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(s){return s===void 0||!Number.isFinite(s)||s<t.MinTargetOffset?t.DefaultTargetOffset:s},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(s){return s.type==="PerspectiveCamera"?s.perspective?.zoom??1:s.orthographic?.zoom??1}})(Tf||(Tf={}))}),pbe=U(()=>{var e;(e=Ig||(Ig={})).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(QW.forEach(n=>{Object.assign(r,{[n]:i[n]??t[n]})}),r.radial={...t.radial},i.radial){let n=t.radial,s=i.radial;RL.forEach(a=>{Object.assign(r.radial,{[a]:s[a]??n[a]})})}if(r.linear={...t.linear},i.linear){let n=t.linear,s=i.linear;DL.forEach(a=>{Object.assign(r.linear,{[a]:s[a]??n[a]})})}if(r.grid={...t.grid},i.grid){let n=t.grid,s=i.grid;NL.forEach(a=>{Object.assign(r.grid,{[a]:s[a]??n[a]})})}if(r.toObject={...t.toObject},i.toObject){let n=t.toObject,s=i.toObject;IL.forEach(a=>{Object.assign(r.toObject,{[a]:s[a]??n[a]})})}if(r.randomnessObject={...t.randomnessObject},i.randomnessObject){let n=t.randomnessObject,s=i.randomnessObject;OL.forEach(a=>{Object.assign(r.randomnessObject,{[a]:s[a]??n[a]})})}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 s=[];r.count!==void 0&&s.push({type:0,path:n,props:{count:r.count}});for(let a of i){let o=r[a];o&&Object.keys(o).length>0&&s.push({type:0,path:[...n,a],props:o})}return s}})(ZW||(ZW={})),QW=["count"],RL=["radius","start","end","position","scale","rotation"],DL=["position","scale","rotation"],NL=["count","size"],IL=["count","position","scale","rotation"],OL=["strength","scale","rotation","position","movement","seed","freqScale"]}),fbe=U(()=>{var e;th(),(e=JW||(JW={})).all=["PointLight","SpotLight","DirectionalLight","HemisphereLight"],e.is=function(t){return e.all.includes(t)},(eH||(eH={})).defaultData=function(t){return function(i){if(i==="PointLight")return{type:i,color:Gr.white,intensity:1,distance:2e3,decay:1,shadows:!0,shadowResolution:1024,shadowRadius:1,penumbraSize:.5,depth:1e5};if(i==="SpotLight")return{type:i,color:Gr.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:Gr.white,intensity:1,shadows:!0,size:2e3,depth:1e5,penumbraSize:.5,shadowResolution:1024,shadowRadius:1};throw new Error("not implemented")}(t)}}),mbe=U(()=>{var e;(e=LL||(LL={})).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}}),gbe=U(()=>{var e;(e=tH||(tH={})).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"]}),xY=U(()=>{(Ex||(Ex={})).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]}}),vbe=U(()=>{var e,t;(e=Ite||{})[e.Front=0]="Front",e[e.Back=1]="Back",e[e.Double=2]="Double",Ite=e,(t=JU||(JU={})).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)}})(e5||(e5={})),(iH||(iH={})).defaultData={...e5.defaultData,...JU.defaultData},(Ote||(Ote={})).getMaterialData=function(i,r){let n=[];if("material"in i){let s=typeof i.material=="string"?r.materials[i.material]??r.lib.materials[i.material]?.asset:i.material;s&&n.push(s)}else if("materials"in i)for(let s of i.materials){let a=typeof s=="string"?r.materials[s]??r.lib.materials[s]?.asset:s;a&&n.push(a)}return n}}),ybe=U(()=>{var e;(e=BL||(BL={})).bytesFromFlattened=function(t){if(typeof t!="object"||t===null||Array.isArray(t)||ArrayBuffer.isView(t)||typeof t[0]!="number")return null;let i=Object.getPrototypeOf(t);if(i!==Object.prototype&&i!==null)return null;let r=Object.keys(t),n=new Uint8Array(r.length),s=t;for(let a=0;a<r.length;a++){let o=s[a];if(r[a]!==String(a)||typeof o!="number"||!Number.isInteger(o)||o<0||o>255)return null;n[a]=o}return n},e.emptyImage={data:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVQYV2NgYAAAAAMAAWgmWQ0AAAAASUVORK5CYII=",name:"empty"}}),_be=U(()=>{var e;(e=FL||(FL={})).defaultVideo={data:"",thumb:"/_assets/_videos/catThumb.png",type:"video",name:"Cat video"},e.maxSize=3e7}),ZA=U(()=>{var e,t,i,r;Or(),th(),ybe(),_be(),th(),(t5||(t5={})).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"},(Lte||(Lte={})).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},(i5||(i5={})).is=function(n){return n==="phong"||n==="toon"||n==="lambert"||n==="physical"},(r=Bte||{})[r.Linear=0]="Linear",r[r.Radial=1]="Radial",r[r.Polar=2]="Polar",Bte=r,Fte=(n=>(n[n.RepeatWrapping=1e3]="RepeatWrapping",n[n.ClampToEdgeWrapping=1001]="ClampToEdgeWrapping",n[n.MirroredRepeatWrapping=1002]="MirroredRepeatWrapping",n))(Fte||{}),Ute=(n=>(n[n.NearestFilter=1003]="NearestFilter",n[n.LinearFilter=1006]="LinearFilter",n[n.LinearMipmapLinearFilter=1008]="LinearMipmapLinearFilter",n))(Ute||{}),(i=zte||{})[i.UV=0]="UV",i[i.Planar=1]="Planar",i[i.Spherical=2]="Spherical",i[i.Cylindrical=3]="Cylindrical",i[i.Triplanar=4]="Triplanar",zte=i,(t=kte||{})[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",kte=t,(e=Vte||{})[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",Vte=e,Gte=(n=>(n[n.Lights=0]="Lights",n[n.Static=1]="Static",n[n.Camera=2]="Camera",n))(Gte||{}),jte=(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))(jte||{}),mB=["mode","gradientType","noiseType","tracingMode","mirror","displacementType","projection","cnormal","crop","axis","side","roughnessMapChannel","metalnessMap","metalnessMapChannel","normalMap","aoMap","aoMapChannel","emissiveMap","style"],_Y=["wrapping","image","video","name","minFilter","magFilter"],(n=>{function s(a,o){return a==="light"&&o?function(l){let h={mode:0,isMask:!1,visible:!0,bumpMap:void 0,bumpMapIntensity:5,roughnessMap:void 0,alphaOverride:1};switch(l){case"phong":return{...h,category:"phong",specular:{r:.2,g:.2,b:.2},shininess:5,type:"light",visible:!0,mode:0,occlusion:!0,alpha:.6};case"toon":return{...h,category:"toon",specular:{r:.2,g:.2,b:.2},shininess:10,type:"light",alpha:1};case"lambert":return{...h,category:"lambert",emissive:{r:0,g:0,b:0},type:"light",alpha:1,visible:!0,mode:0,occlusion:!0};case"physical":return{...h,category:"physical",roughness:.6,metalness:.2,reflectivity:.2,type:"light",alpha:.6,visible:!0,mode:0,occlusion:!0}}}(o):function(l){let h={alpha:1,mode:0,isMask:!1,visible:!0};switch(l){case"texture":return{...h,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{...h,type:"video",size:[128,128],blending:0,axis:"x",side:2,projection:0,texture:{video:FL.defaultVideo,wrapping:1001,repeat:[1,1],offset:[0,0],rotation:0,minFilter:1008,magFilter:1006},crop:!1};case"color":return{...h,type:"color",color:Ks.fromHex(Ja)};case"vertexColor":return{...h,type:"vertexColor"};case"depth":return{...h,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{...h,type:"normal",cnormal:[1,1,1]};case"gradient":return{...h,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{...h,type:"noise",size:[100,100,100],noiseType:0,scale:1,move:1,colorA:{...Ks.fromHex(6710886),a:1},colorB:{...Ks.fromHex(6710886),a:1},colorC:{...Ks.fromHex(16777215),a:1},colorD:{...Ks.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{...h,type:"cavity",mode:3,ridge:1,valley:1};case"fresnel":return{...h,type:"fresnel",color:Gr.fromHexAndA(16777215,1),bias:.1,scale:1,intensity:2,factor:1};case"dust":return{...h,type:"dust",color:Gr.fromHexAndA(10323813,1),coverage:.2,softness:.2,noiseStrength:.2,noiseScale:1};case"rainbow":return{...h,type:"rainbow",filmThickness:30,movement:0,wavelengths:[0,0,0],noiseStrength:0,noiseScale:1,offset:[0,0,0]};case"toon":return{...h,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:Gr.fromHexAndA(0,0),offset:[0,0,0]};case"outline":return{...h,type:"outline",outlineColor:Gr.fromHexAndA(0,1),contourColor:Gr.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{...h,type:"matcap",texture:{image:"matcap_0",wrapping:1001,repeat:[1,1],offset:[0,0],rotation:0,minFilter:1008,magFilter:1006}};case"transmission":return{...h,type:"transmission",thickness:10,ior:1.5,roughness:1};case"reflection":return{...h,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{...h,type:"pattern",style:0,projection:0,axis:"y",blending:0,offset:[0,0],colorA:{...Ks.fromHex(0),a:1},colorB:{...Ks.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)}n.patch=function(a,o){let{texture:l,...h}=o;if(Object.assign(a,h),l){let u=a.texture;u&&Object.assign(u,l)}},n.defaultColorLayer=function(a){return{...n.defaultData("color"),color:a}},n.defaultData=s,n.defaultDataFor=function(a,o){return a!=="light"?s(a):s("light",typeof o=="string"&&i5.is(o)?o:"physical")}})(rs||(rs={})),(n=>{function s(l,h){if(typeof l!="string"||!/^#[0-9a-f]{6}([0-9a-f]{2})?$/i.test(l))return l;let{r:u,g:d,b:c}=Ks.fromHex(parseInt(l.slice(1,7),16)),p=l.length===9?parseInt(l.slice(7),16)/255:void 0;if(Array.isArray(h))return h.length>3?[u,d,c,p??h[3]]:[u,d,c];let f=h;return typeof f?.r!="number"?l:typeof f.a=="number"?{r:u,g:d,b:c,a:p??f.a}:{r:u,g:d,b:c}}function a(l){let h=l?.data;return typeof h=="object"&&h!==null}function o(l,h="layer1",u="layer2",d=Ks.fromHex(16777215)){let c=new Ct;return c.push({fi:0,data:rs.defaultData("light",l),id:h}),c.push({fi:1,data:rs.defaultData("color"),id:u}),{layers:c}}n.restoreImageBytes=function(l){let h=[],u=new Map,d=(p,f)=>{let m=OM(p);if(typeof m!="object"||m===null||ArrayBuffer.isView(m))return p;if(u.has(m))return u.get(m)??p;u.set(m,void 0);let g=c(m,f)??p;return u.set(m,g),g},c=(p,f)=>{let m=p;if(!Array.isArray(p)){if(typeof m[0]=="number")return;if(typeof m.name=="string"){let v=BL.bytesFromFlattened(OM(m.data));if(v!==null)return h.push({path:`${f}/data`,bytes:v.byteLength}),Object.setPrototypeOf({...m,data:v},Object.getPrototypeOf(p))}}let g=null;for(let v of Object.keys(p)){let y=m[v],_=d(y,`${f}/${v}`);_!==y&&(g===null&&(g=Array.isArray(p)?[...p]:{...m},Object.setPrototypeOf(g,Object.getPrototypeOf(p))),g[v]=_)}return g??void 0};return{material:d(l,""),restored:h}},n.restoreLayersSeq=function(l){let h=OM(l.layers);if(!Array.isArray(h)||h instanceof Ct||!h.every(c=>typeof c=="object"&&c!==null&&typeof c.id=="string"&&typeof c.data=="object"))return{material:l,restored:!1};let u=Object.setPrototypeOf([...h],Ct.prototype),d=OM(l);return{material:Object.setPrototypeOf({...d,layers:u},Object.getPrototypeOf(d)),restored:!0}},n.isMergable=function(l){return!l.layers.some(h=>h.data.type==="texture"&&h.data.projection!==0||h.data.type==="depth"&&!h.data.isWorldSpace||h.data.type==="noise"||h.data.type==="dust"&&h.data.noiseStrength!==0||h.data.type==="displace")},n.getHash=function(l){let h="";return l.layers.forEach(u=>{Object.entries(u.data).forEach(([d,c])=>{h+=`${d}${c}`,Array.isArray(c)?c.forEach(p=>h+=`${p}`):typeof c=="object"?Object.values(c).forEach(p=>{h+=typeof p=="number"?`${p.toFixed(4)}`:`${p}`}):h+=`${c}`})}),h},n.defaultEmptyData=function(){return{layers:new Ct}},n.defaultData=function(l="layer1",h="layer2"){return o("physical",l,h)},n.withName=function(l,h){return{...l,name:h}},n.isLayerEntry=a,n.withRepairedLayers=function(l){if(l.layers===void 0)return{...l,layers:o("phong").layers};let h=Array.from(l.layers);if(h.every(a))return l;let u=new Ct;return h.forEach((d,c)=>{if(a(d))return void u.push(d);let{id:p,fi:f,...m}=d??{};if(typeof m.type!="string"||!t5.is(m.type))return;let g=rs.defaultDataFor(m.type,m.category),v={...g,...m};for(let[y,_]of Object.entries(m)){let b=g[y];v[y]=Array.isArray(_)&&Array.isArray(b)&&Array.isArray(b[0])?_.map(x=>s(x,b[0])):s(_,b)}u.push({id:typeof p=="string"&&p?p:`layer${c+1}`,fi:typeof f=="number"?f:c,data:v})}),{...l,layers:u}},n.defaultTwoLayerData=o,n.defaultColorMaterial=function(l,h,u="layer1",d="layer2"){let c=new Ct;return c.push({fi:0,data:rs.defaultData("light",h),id:u}),c.push({fi:1,data:rs.defaultColorLayer(l),id:d}),{layers:c}},n.defaultUIObjectMaterial=function(l){let h=rs.defaultData("texture");l&&Object.assign(h.texture,{image:l});let u=new Ct;return u.push({fi:0,data:h,id:"layer1"}),u.push({fi:1,data:{...rs.defaultData("transmission"),alpha:1},id:"layer2"}),u.push({fi:2,data:{...rs.defaultData("light","lambert"),alpha:0},id:"layer3"}),{layers:u}},n.defaultTwoLayerTextureData=function(l,h="physical",u="layer1",d="layer2"){let c=rs.defaultData("texture");Object.assign(c.texture,{image:l});let p=new Ct;return p.push({fi:0,data:c,id:u}),p.push({fi:1,data:rs.defaultData("light",h),id:d}),{layers:p}},n.defaultTwoLayerVideoTextureData=function(l,h="physical",u="layer1",d="layer2"){let c=rs.defaultData("video");Object.assign(c.texture,{video:l});let p=new Ct;return p.push({fi:0,data:c,id:u}),p.push({fi:1,data:rs.defaultData("light",h),id:d}),{layers:p}}})(Kn||(Kn={}))}),y4e=U(()=>{Ib="Roboto_regular",dbe="https://fonts.gstatic.com/s/roboto/v30/KFOmCnqEu92Fr1Me5WZLCzYlKw.ttf"}),_4e=U(()=>{y4e()}),bbe=U(()=>{var e;Or(),(e=sw||(sw={})).defaultData=function(){return{points:new Ct,roundness:0,shapeHoles:[],isClosed:!1}},e.scaled=function t(i,r,n){let s=a=>[a[0]*r,a[1]*n];return{...i,points:new Ct(...i.points.map(({id:a,fi:o,data:l})=>({id:a,fi:o,data:{...l,position:s(l.position),controlPrevious:{position:s(l.controlPrevious.position)},controlNext:{position:s(l.controlNext.position)}}}))),shapeHoles:i.shapeHoles.map(a=>t(a,r,n))}}}),xbe=U(()=>{Or(),(UL||(UL={})).defaultData=function(){return{points:new Ct,lastInsertionPlane:null,subdivisions:12,isClosed:!1,subdivisionMode:"parametric"}},Xv={type:"Ellipse",width:50,height:50,spikes:16,angle:360,innerRadius:0},(rH||(rH={})).merge=function(e,t){let i={...e};return zL.forEach(r=>{Object.assign(i,{[r]:t[r]??e[r]})}),i},bY={shape:Xv,depth:1,offset:0,bevel:50,bevelSides:6,angle:0,twist:0,startScale:1,endScale:1,capType:"flat"},zL=["depth","offset","angle","twist","startScale","endScale"]}),wY=U(()=>{var e,t;bbe(),xbe(),(e=kL||(kL={})).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"},(VL||(VL={})).merge=function(i,r){let n={...i};if(Object.assign(n,r),n.type==="PathGeometry"&&"extrusion"in r&&r.extrusion&&(n.extrusion={...i.extrusion},Object.assign(n.extrusion,rH.merge(n.extrusion,r.extrusion))),i.type==="VectorGeometry"&&n.type==="VectorGeometry"){let s=(l,h)=>typeof l=="number"&&typeof h=="number"&&h!==0?l/h:1,a=s(n.width,i.width),o=s(n.height,i.height);(a!==1||o!==1)&&(n.shape=sw.scaled(i.shape,a,o))}return n},(t=ff||(ff={})).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:UL.defaultData(),extrusion:bY};if(i==="VectorGeometry")return{width:1,height:1,type:i,subdivisions:12,shape:sw.defaultData(),depth:0,extrudeBevelSize:0,extrudeBevelSegments:1};if(i==="BooleanGeometry")return{type:i,operation:2,width:0,height:0,depth:0,phongAngle:35};if(i==="ShapeBlendGeometry")return{type:i,width:0,height:0,depth:0,resolutionLevel:6,blendRange:100,useChildrenColors:!1};if(i==="DecalGeometry")return{type:i,width:200,height:200,depth:200,offset:1,projection:"all",projectionTargets:[]};if(i==="TextGeometry")return{type:i,width:100,height:100,depth:0,horizontalAlign:1,verticalAlign:1,fontSize:16,lineHeight:1.2,letterSpacing:0,text:{textValue:""},textTransform:1,font:"Roboto_regular",editable:!1,extrudeBevelSize:0,extrudeBevelSegments:1};if(i==="InputGeometry")return{...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")},zI=["width","height","depth"]}),wbe=U(()=>{th(),(e=>{function t(i){return i.mode??"linear"}e.defaultData={enabled:!1,useBackgroundColor:!1,color:Ks.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={}))}),SY=U(()=>{(r5||(r5={})).defaultData={image:null,rotation:0,blur:32,showBackground:!0},(Tg||(Tg={})).defaultData={enabled:!1,mode:"hdri",hdri:r5.defaultData,timeOfDay:10,weather:"partlyCloudy",lighting:!0,lightingIntensity:1,lightingQuality:"full",clouds:!0,windSpeed:2,animateWind:!0,exposure:1,seed:2}});function b4e(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 CA,_y,n5,s5,a5,Ax,o5,nH,sH,Wte,q1,Sbe,na,GL,Hte,qte,$te,Xte,xc,IE,jL,WL,Mf,by,Yte,Og,HL,Ef,l5,h5,ty,n1,iy,OE,aH,Kte,Mo,u5,Zte,Qte,mf,gu,Cx,Tbe=U(()=>{(()=>{let e={opacity:1,blendFunction:13,enabled:!1};(CA||(CA={})).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}}})()}),TY=U(()=>{var e;wbe(),SY(),Tbe(),th(),(e=_y||(_y={})).defaultData={type:"normal",softShadowQuality:"low"},e.isSoft=function(t){return t!=null&&(t.type===void 0||t.type==="soft")},(n5||(n5={})).defaultData={enabled:!0,color:{r:.8274509803921568,g:.8274509803921568,b:.8274509803921568},intensity:.75},(s5||(s5={})).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}})(a5||(a5={})),(Ax||(Ax={})).defaultData={usePhysics:!1,gravity:-10},(o5||(o5={})).defaultData={playCamera:d1,gameControlObject:null},(nH||(nH={})).defaultData={backgroundColor:Gr.fromHexAndA(ube,1),postprocessing:CA.defaultData,fog:Yn.defaultData,sky:Tg.defaultData,globalPhysics:Ax.defaultData,ambient:n5.defaultData,ao:s5.defaultData,shadow:_y.defaultData,publish:o5.defaultData,grading:a5.defaultData}}),x4e=U(()=>{(sH||(sH={})).defaultData={colliderType:"box",size:[100,100,100],colliderHelperVisible:!0,forceType:"collider",forceRange:"global",forceIntensity:.5,forceDambing:.95}}),gB=U(()=>{var e,t,i;Or(),cbe(),fbe(),mbe(),gbe(),xY(),vbe(),th(),ZA(),wY(),pbe(),la(),TY(),x4e(),(e=Wte||(Wte={})).isComponentRelated=function(r){return r==="Component"||r==="Instance"},e.isEmptyOrComponent=function(r){return r==="Empty"||r==="Instance"},(t=q1||(q1={})).identity={...YW.identity,shear:Dh.zero},t.fromObject=function(r){return{position:r.position,rotation:r.rotation,scale:r.scale,pivot:r.pivot,pivotRotation:r.pivotRotation,shear:r.shear}},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,shear:n?.shear||r.shear}},t.diff=function(r,n){return j_e({position:jg.isEqual(r.position,n.position)?void 0:n.position,rotation:jg.isEqual(r.rotation,n.rotation)?void 0:n.rotation,scale:jg.isEqual(r.scale,n.scale)?null:n.scale,shear:n.shear?.every((s,a)=>s===r.shear?.[a])?void 0:n.shear})},Sbe=["slide","offset"],(na||(na={})).defaultData={states:new Ct,events:new Ct,visible:!0,raycastLock:!1,physics:Ex.defaultData,pathSnapping:{pathId:null,slide:0,offset:0,orientation:"tangential"},...q1.identity,cloner:null},(GL||(GL={})).defaultData={type:"Empty",...na.defaultData},(Hte||(Hte={})).defaultData={type:"ParticleCollider",...sH.defaultData,...na.defaultData},(qte||(qte={})).defaultData={type:"Component",...na.defaultData},($te||($te={})).defaultData={type:"Particle",...na.defaultData,...LL.defaultData},(Xte||(Xte={})).defaultData={type:"Hair",...na.defaultData,...tH.defaultData},(xc||(xc={})).defaultData={type:"Mesh",...na.defaultData,...iH.defaultData},(IE||(IE={})).defaultData={...na.defaultData,...q1.identity,position:Tf.DefaultPosition,rotation:Tf.DefaultRotation,...Tf.defaultData},(r=>{r.defaultData=function(n){return{...na.defaultData,...eH.defaultData(n)}},r.defaultDirectionalLightData={...r.defaultData("DirectionalLight"),position:[200,300,300],name:"Directional Light",intensity:.7}})(jL||(jL={})),(r=>{function n(s,a,o=0){for(;o<a.length;){let l=s?s[a[o]]:void 0;if(a.length===o+1)return l;if(!l)return;s=l.descendants,o+=1}}r.resolveWithDes=n,r.resolve=function(s,a,o=0){let l=n(s,a,o);if(l){let h=Object.keys(l);if(h.length===1&&h[0]==="descendants")return}return l}})(WL||(WL={})),(r=>{function n(s,a){return{...na.defaultData,...a,component:s,overrides:new Ms,physics:void 0,events:void 0,type:"Instance"}}r.rootOverrideProps=["physics","events"],r.compositeNonOptionalOverrideProps=["geometry"],r.compositeEntireOverrideOverrideProps=["material"],r.ofComponent=n,r.fromComponentData=function(s){let a=q1.fromObject(s.data);return n(s.id,a)}})(Mf||(Mf={})),(r=>{r.defaultData={type:"Page",...na.defaultData,physics:{...Ex.defaultData,fusedBody:!1},...nH.defaultData,camera:IE.defaultData,timelines:new si},r.isUIPage=function(n){return n.uiScene!==void 0}})(by||(by={})),(i=Yte||(Yte={})).defaultCamera={position:[0,0,1e3],scale:[1,1,1],rotation:[0,0,0],pivot:[0,0,0],pivotRotation:[0,0,0],shear:Dh.zero,name:"Play Camera",visible:!0,raycastLock:!1,physics:Ex.defaultData,states:new Ct,events:new Ct,cloner:null,pathSnapping:{pathId:null,orientation:"tangential",slide:0,offset:0},...Tf.defaultData},i.KeysByResetCategory={States:["states"],Events:["events"],Material:["material","materials"],Geometry:["geometry"],Position:["position"],Rotation:["rotation"],Scale:["scale"],Transform:["position","scale","rotation","shear"],Name:["name"],Visibility:["visible","raycastLock","flatShading","wireframe","side","shadowCatcher"],Shadows:["castShadow","receiveShadow"],Cloner:["cloner"],Physics:["physics"]},i.defaultMeshObject={name:"Rectangle",...na.defaultData,...xc.defaultData,geometry:ff.defaultData("RectangleGeometry"),material:Kn.defaultTwoLayerData("physical","layer1","layer2")},i.defaultBooleanObject={name:"Boolean",...na.defaultData,...xc.defaultData,geometry:ff.defaultData("BooleanGeometry"),material:Kn.defaultTwoLayerData("physical","layer1","layer2")},i.defaultShapeBlendObject={name:"Shape Blend",...na.defaultData,...xc.defaultData,geometry:ff.defaultData("ShapeBlendGeometry"),material:Kn.defaultTwoLayerData("physical","layer1","layer2")},i.defaultTextObject={name:"Text",...na.defaultData,...xc.defaultData,geometry:ff.defaultData("TextGeometry"),material:Kn.defaultTwoLayerData("physical","layer1","layer2")},i.defaultInputObject={name:"Input",...na.defaultData,...xc.defaultData,geometry:ff.defaultData("InputGeometry"),material:Kn.defaultTwoLayerData("physical","layer1","layer2")},(r=>{r.newEmpty=function(n,s){let a={name:s};return n.type==="Mesh"?(a.geometry={},"material"in n&&(a.material={layers:new Ms}),"materials"in n&&(a.materials=n.materials.map(o=>({layers:new Ms})))):r1.is(n.type)&&(a.perspective={},a.orthographic={}),a},r.toOps=function(n,s){let a,o=[],l={orthographic:0,perspective:0,geometry:0};function h(u,d){for(let[c,p]of Object.entries(d.layers)){let{texture:f,...m}=p;if(f!==void 0&&Object.keys(f).length>0){let g={path:[...u,"layers",c,"texture"],props:f,type:0};o.push(g)}if(Object.keys(m).length>0){let g={path:[...u,"layers",c],props:m,type:0};o.push(g)}}}for(let[u,d]of Object.entries(s)){let c=d;if(u!=="name")if(u==="cloner")o.push(...ZW.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,f]of Object.entries(c))h(["materials",p],f);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 a===void 0&&(a={path:[],props:{},type:0},o.push(a)),a.props[u]=c}return o},r.patch=function(n,s){if(s===void 0)return n;let a={...n};if(Object.assign(a,q1.merge(a,s)),Object.assign(a,{pathSnapping:Object.assign({},a.pathSnapping,{slide:s.pathSnapping?.slide??a.pathSnapping?.slide??0,offset:s.pathSnapping?.offset??a.pathSnapping?.offset??0})}),r1.is(n.type)){a.orthographic={...a.orthographic},a.perspective={...a.perspective};let o=s;o.orthographic?.zoom!==void 0&&(a.orthographic.zoom=o.orthographic.zoom),o.perspective?.zoom!==void 0&&(a.perspective.zoom=o.perspective.zoom),o.isUpVectorFlipped!==void 0&&(a.isUpVectorFlipped=o.isUpVectorFlipped),o.targetOffset!==void 0&&(a.targetOffset=o.targetOffset)}else if(n.type==="Mesh")"geometry"in s&&Object.assign(a,{geometry:VL.merge(a.geometry,s.geometry)}),(s.material||s.materials)&&(a=function(o,l){if(l===void 0)return o;let h={...o};return"material"in h&&"material"in l&&l.material&&(h.material=ML(h.material,u=>{if(typeof u!="string")for(let[d,c]of Object.entries(l.material.layers)){let p=u.layers.data(d);p&&rs.patch(p,c)}}).data),h.materials&&l.materials&&(h.materials=ML(h.materials,u=>{for(let d=0;d<h.materials.length;d++){let c=l.materials[d];if(typeof c!="string")for(let[p,f]of Object.entries(c.layers)){let m=u[d]?.layers?.data(p);m&&rs.patch(m,f)}}}).data),h}(a,s)),a.cloner&&"cloner"in s&&Object.assign(a,{cloner:Ig.merge(a.cloner,s.cloner)});else if(n.type==="Empty")a.cloner&&"cloner"in s&&Object.assign(a,{cloner:Ig.merge(a.cloner,s.cloner)});else if(JW.is(n.type)){let o=s;o.intensity!==void 0&&(a.intensity=o.intensity),o.color!==void 0&&(typeof o.color=="string"?a.color=o.color:a.color=Ks.clone(o.color))}return a}})(Og||(Og={}))}),MY=U(()=>{(HL||(HL={})).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}}),vB=U(()=>{MY(),th(),(Ef||(Ef={})).defaultData={orbitControls:HL.defaultData,playPage:Mx,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}}),Mbe=U(()=>{var e;(l5||(l5={})).defaultData={id:"basic",label:"Basic",style:"None",prompt:""},(h5||(h5={})).defaultData={weather:0,shadows:0,lightOrigin:0,temperature:0,sun:0,camera:0,environment:0,particles:0,nature:0,floor:0},(e=ty||(ty={})).defaultData=()=>({mode:"line-art-both",prompt:"",negativePrompt:"",style:{...l5.defaultData},isRandomSeed:!0,seed:e.generateSeed(),guessMode:!1,advanced:!1,steps:20,guidanceScale:7.5,controlNetScale:1,modifiers:h5.defaultData}),e.generateSeed=()=>Math.round(1e5*Math.random())}),EY=U(()=>{gB(),Or(),vB(),th(),la(),Mbe(),(e=>{function t(i,r){let n=i.scene.objects.get(r);if(n&&n.data.type==="Component")return n;{let s=i.shared.lib.components[r];if(s)return{...s.asset,id:r}}}e.physicsEnabled=function(i){return i.find(r=>r.data.type==="Page"&&r.data.globalPhysics.usePhysics)!==void 0},e.findTimeline=function(i,r){let n=i.find(s=>s.data.type==="Page"&&s.data.timelines?.[r]!==void 0);return n&&n.data.timelines?.[r]},e.getComponentData=t,e.traverseModuleInstances=function(i,r,n){i.scene.objects.traverseFrom(r,(s,a)=>{if(a.type==="Instance"){let o=t(i,a.component)?.data;o&&n(s,a,o.events)}else n(s,a,a.events)})}})(n1||(n1={})),(e=>{function t(r=!0,n=[]){let s=[];r&&s.push({...e.defaultLight}),s.push(...n);let a=new Aa;return a.push({fi:1,id:Mx,data:{...by.defaultData,name:"Scene 1"},children:s}),a}function i(r){return{...e.defaultData,objects:jo(r,Aa.prototype)}}e.TRASH_CAN_ID="830a2708-8ed9-49cf-a68e-085299892222",e.defaultLight={fi:-1,data:jL.defaultDirectionalLightData,id:"830a2708-8ed9-49cf-a68e-085299899103",children:[]},e.createDefaultObjectTreeWithPage=t,e.defaultData={objects:t(),publish:Ef.defaultData,styles:ty.defaultData()},e.emptyDataWithoutPage=function(){return{objects:new Aa,publish:Ef.defaultData,styles:ty.defaultData()}},e.emptyDataWithPage=function(r=!0){return{objects:t(r),publish:Ef.defaultData,styles:ty.defaultData()}},e.emptyData=function(){return{objects:new Aa,publish:{...Ef.defaultData},styles:ty.defaultData()}},e.withObjs=i,e.withObj=function(r,n){return i([{id:r,data:n,children:[],fi:0}])}})(iy||(iy={}))}),Ebe=U(()=>{(OE||(OE={})).defaultData={preset:"fullscreen",allowResponsive:!1,size:[512,512],coords:[0,0],sceneScale:1,color:{r:0,g:0,b:0,a:.5}}}),AY=U(()=>{var e,t;Or(),la(),(e=aH||(aH={})).defaultData=i=>({url:i,name:"New Webhook",parametersSchemas:new Ct}),e.defaultParameterValueByType=i=>i==="number"?0:i!=="boolean"&&"",(Kte||(Kte={})).defaultData=(i,r="GET")=>({url:i,method:r,name:"New API",headers:new Ct,queries:new Ct,autoStart:!0}),(i=>{function r(s){return s.textValue!==void 0}function n(s){return typeof s=="boolean"}i.isTextValue=r,i.isNumber=function(s){return typeof s=="number"},i.isBoolean=n,i.typeOfVariable=function(s){return r(s)?"string":n(s)?"boolean":"number"},i.getDisplayedValue=function(s){return i.isTextValue(s)?Array.isArray(s.textValue)?s.textValue.map(a=>a.toString().padStart(s.padding??2,"0")).join(s.deliminator??":")+(s.suffix!==void 0?" "+s.suffix:""):s.textValue.toString():i.isBoolean(s)?s?"True":"False":i.isNumber(s)?parseFloat(s.toFixed(3)).toString():s.toString()}})(Mo||(Mo={})),(u5||(u5={})).all=["images","videos","colors","audios","particles","fonts","materials","variables"],(Zte||(Zte={})).all=[...u5.all,"components"],(Qte||(Qte={})).defaultData=function(){return{images:new si,videos:new si,colors:new si,audios:new si,particles:new si,fonts:new si,materials:new si,components:new si,variables:new si,userAPIs:new si,userWebhooks:new si}},(mf||(mf={})).defaultData=function(){return{images:new si,videos:new si,colors:new si,audios:new si,particles:new si,fonts:new si,materials:new si,components:new si,variables:new si,userAPIs:new si,userWebhooks:new si}},(t=gu||(gu={})).defaultColors=function(){return jo({"89b10010-844c-11ec-a8a3-0242ac120002":{r:.5,g:.5,b:.5,a:1,name:"Default Color"}},si.prototype)},t.defaultImages=function(){return jo({},si.prototype)},t.emptyData=function(){return{catelogs:new si,materials:new si,images:new si,videos:new si,colors:new si,audios:new si,particles:new si,fonts:new si,variables:new Ct,userAPIs:new si,userWebhooks:new si,lib:mf.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),s=Math.floor((i-3600*n)/60);return{textValue:[n,s,Math.round(i-3600*n-60*s)]}}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}}),w4e=U(()=>{}),Abe=U(()=>{var e;Or(),EY(),Ebe(),AY(),(e=Cx||(Cx={})).defaultData={schema:135,scene:iy.defaultData,frames:new si().add("72fc2993-2da3-4b6b-96ac-2879db3a28bd",OE.defaultData),shared:{...gu.emptyData(),colors:gu.defaultColors()}},e.createDefaultData=function(){return MA.deserialize(MA.serialize(e.defaultData))},e.emptyDataForImports=function(){return{schema:135,scene:iy.emptyDataWithPage(),frames:new si().add("72fc2993-2da3-4b6b-96ac-2879db3a28bd",OE.defaultData),shared:{...gu.emptyData(),colors:gu.defaultColors(),images:gu.defaultImages()}}},e.emptyData=function(){return{schema:135,scene:iy.emptyDataWithPage(),frames:new si().add("72fc2993-2da3-4b6b-96ac-2879db3a28bd",OE.defaultData),shared:gu.emptyData()}},e.clipboard2dData=function(){return{schema:135,scene:iy.emptyData(),frames:new si,shared:gu.emptyData()}},e.withoutLib=function(t){return{...t,shared:{...t.shared,lib:mf.defaultData()}}},e.getComponentData=function(t,i){return n1.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 s of n)if(s.data.key.toLowerCase()==="authorization"&&s.data.value!=="")return!0}return!1}});function qf(e,t=[0,0]){return[e&&!isNaN(e[0])?e[0]:t[0],e&&!isNaN(e[1])?e[1]:t[1]]}function kS(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??{...nw.defaultData};return`cubicBezier( ${r[0]}, ${r[1]}, ${n[0]}, ${n[1]} )`}case 6:{let{mass:r,stiffness:n,damping:s,velocity:a}=i??{...Ng.defaultData},o=new Cbe(r,n,s,a),l=o.solve(1);return()=>h=>o.solve(h)/l}case 8:return()=>r=>Math.floor(r)}}var Jte,eie,Wg,PA,Cbe,qL,$L,CY=U(()=>{Or(),th(),(Jte||(Jte={})).defaultData=function(e,t){return{id:e,name:t,duration:5,objectTimelines:new si}},(eie||(eie={})).is=function(e){return e&&typeof e.x=="number"&&typeof e.y=="number"&&typeof e.z=="number"},(e=>{function t(u,d){let c=[0,0],p=[1,1];if(u?.cubicControls)c=qf(u.cubicControls.control1,c);else switch(u?.type){case 2:case 4:c=[.42,0];break;case 3:case 0:c=[0,0];break;case 1:c=[.25,.1];break;case 7:c=[.25,1]}if(d?.cubicControls)p=qf(d.cubicControls.control2,p);else switch(d?.type){case 2:case 0:p=[1,1];break;case 3:case 4:p=[.58,1];break;case 1:p=[.25,1];break;case 7:p=[.5,1]}return{control1:c,control2:p}}function i(u){if(!e.BEZIER_PRESETS.includes(u))return;let d={type:u};return{control1:t(d).control1,control2:t(void 0,d).control2}}function r(u,d){return Math.abs(u[0]-d[0])<.001&&Math.abs(u[1]-d[1])<.001}function n(u){let d=e.ROOT_PROPERTY_ORDER.indexOf(u[0]);return d===-1?e.ROOT_PROPERTY_ORDER.length:d}function s(u){return u.layerId??u.path.join(".")}function a(u){let d=u[u.length-1];return PA.includes(d)?d:void 0}function o(u){return u.layerId?u.layerId:(a(u.path)?u.path.slice(0,-1):u.path).join(".")}function l(u){return["material",u.type==="light"?`${u.category} lighting`:u.type]}function h(u,d,c){return{id:u,data:{id:u,time:c?.time??0,path:d,value:{},layerId:c?.layerId,index:c?.index,isPlaceholder:!0,easing:{type:5,cubicControls:{control1:[.42,0],control2:[.58,1]}}}}}e.getControlsWithDefault=t,e.BEZIER_PRESETS=[0,1,2,3,4,7],e.presetHandles=i,e.presetForHandles=function(u){return e.BEZIER_PRESETS.find(d=>{let c=i(d);return c!==void 0&&r(c.control1,u.control1)&&r(c.control2,u.control2)})},e.defaultData=function(u){return{id:u,keyframes:new Ct}},e.ROOT_PROPERTY_ORDER=["position","rotation","scale","shape size","material","opacity","camera","light","cloner","path extrusion","path snapping"],e.rowOrder=n,e.propertyKey=s,e.groupKeyframes=function(u,d){let c=new Map;for(let p of u){let f=p.data;if(d?.(f))continue;let m=s(f),g=c.get(m);g||(g={id:m,path:f.path,keyframes:[],layerId:f.layerId,index:f.index},c.set(m,g)),f.isPlaceholder?g.placeholder=p.id:g.keyframes.push(p)}return[...c.values()].sort((p,f)=>{let m=n(p.path)-n(f.path);return m!==0?m:(p.index??0)-(f.index??0)})},e.rowAxis=a,e.drawnRowKey=o,e.drawnRows=function(u){let d=new Map;for(let c of u){let p=a(c.path),f=p?c.path.slice(0,-1):c.path,m=o(c),g=d.get(m);g||(g={id:m,path:f,layerId:c.layerId,index:c.index,tracks:[]},d.set(m,g)),g.tracks.push({axis:p,property:c})}return[...d.values()]},e.sortedKeyframes=function(u){return[...u].sort((d,c)=>d.data.time-c.data.time)},e.materialLayerPath=l,e.createMaterialGroup=function(u,d){return u.map(({data:c,id:p},f)=>h(d(),l(c),{layerId:p,index:f}))},e.placeholderKeyframe=h,e.createName=function(u){return Object.entries(u).reduce((d,[c,p])=>(typeof p!="string"&&d.push({name:p.name}),d),[])},e.Presets=[{name:"Slide in",animationParams:{translateX:{value:[-20,0],easing:kS(3),duration:1e3},opacity:{value:[0,1],easing:kS(3),duration:1e3},endDelay:250,loop:!0}},{name:"Rotate",animationParams:{rotate:{value:[0,"1turn"],easing:kS(5),duration:700},endDelay:250,loop:!0}},{name:"Scale Out",animationParams:{scale:{value:[1,1.5],easing:kS(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:kS(5),duration:500},endDelay:500,loop:!0}},{name:"Bounce",animationParams:{translateY:{value:["20px","-20px"],duration:575,easing:"easeOutQuad"},direction:"alternate",loop:!0}}]})(Wg||(Wg={})),PA=["x","y","z"],Cbe=class{constructor(e=1,t=100,i=10,r=0){this.mass=e,this.stiffness=t,this.damping=i,this.initialVelocity=r,this.m_w0=Math.sqrt(t/e),this.m_zeta=i/(2*Math.sqrt(t*e)),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-r)/this.m_wd):(this.m_wd=0,this.m_A=1,this.m_B=-r+this.m_w0)}solve(e){return 1-(this.m_zeta<1?Math.exp(-e*this.m_zeta*this.m_w0)*(this.m_A*Math.cos(this.m_wd*e)+this.m_B*Math.sin(this.m_wd*e)):(this.m_A+this.m_B*e)*Math.exp(-e*this.m_w0))}getDuration(){let e=.16666666666666666,t=0,i=0;for(;;)if(t+=e,this.solve(t)===1){if(i++,i>=16)break}else i=0;return t*e*1e3}}}),PY=U(()=>{var e;th(),Or(),(qL||(qL={})).list=["idle","move","jump","run"],(e=$L||($L={})).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 Ct,move:new Ct,jump:new Ct,run:new Ct},navmesh:{enabled:!1,ch:6,cs:6,walkableClimb:5,walkableHeight:1,walkableRadius:0,zones:"all",objects:[],helperVisible:!0,destinationHelperRadius:0,destinationHelperColor:Gr.fromHexAndA(3728051,1)}}});function Uv(e,...t){let i={};for(let r of t.flat())e!=null&&r in e&&(i[r]=e[r]);return i}function tie(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]],s=[0,1];for(let o=2;o<10;o++)n.push(n[1]),s.push(1);let a={...Uv(Os(t),"type","visible","isVector","isWorldSpace","origin","alpha","mode"),near:Math.max(0,t.near),far:Math.max(0,t.far),colors:n,steps:s,num:2,direction:[1,0,0],smooth:!1,gradientType:1};Object.assign(t,a)}else if(t.type==="depth"&&t.gradientType===1&&(t.near<0||t.far<0)){let i={...Os(t),near:Math.max(t.near,0),far:Math.max(t.far,0)};Object.assign(t,i)}})}function Jp(e,t){Object.values(e.shared.materials).forEach(i=>t(i))}function ef(e,t){e.scene.objects.traverse((i,r)=>{"materials"in r?r.materials.forEach((n,s)=>{n===void 0&&(r.materials[s]=Kn.defaultTwoLayerData("phong"),n=r.materials[s]),typeof n!="string"&&t(n)}):"material"in r?typeof r.material!="string"&&(r.material===void 0&&(r.material=Kn.defaultTwoLayerData("phong")),t(r.material)):r.type==="Mesh"&&(r.material===void 0&&(r.material=Kn.defaultTwoLayerData("phong")),t(r.material)),"overrides"in r&&Object.values(r.overrides).forEach(n=>{n.material&&typeof n.material!="string"&&Object.getPrototypeOf(n.material)!==Ms.prototype&&t(n.material)})})}function iie(e){e.layers===void 0&&Object.assign(e,Kn.defaultTwoLayerData("lambert"))}function d5(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={...Os(t),colors:i,steps:r};Object.assign(t,n)}})}function rie(e){e.scene.objects.traverse((t,i)=>{"materials"in i?i.materials.forEach(r=>{typeof r!="string"&&d5(r)}):"material"in i&&typeof i.material!="string"&&d5(i.material)}),Object.values(e.shared.materials).forEach(t=>d5(t))}function nie(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 sie(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 aie(e){let t=e.layers.find(i=>i.type==="light")?.data;if(t?.category==="basic"){let i=rs.defaultData("light","phong"),r=t;Object.assign(r,i),r.visible=!1}}function oie(e){Jp(e,aie),ef(e,aie)}function lie(e){e.layers.forEach(t=>{t.type==="light"&&t.category!=="toon"&&t.occlusion===void 0&&(t.occlusion=!0)})}function hie(e){e.layers&&e.layers.forEach(t=>{t.type==="light"&&t.bumpMapIntensity===void 0&&(t.bumpMapIntensity=5)})}var S4e=U(()=>{ZA(),th(),MY(),gB(),Or(),vB(),la(),ae(),wY(),PY(),Mbe(),EY(),xY(),TY()});function Pbe(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 Rbe(){let e=Math.max(cd.lengthSq(),pd.lengthSq(),Cc.lengthSq());cd.lengthSq()>FM*e?Eh.copy(cd).normalize():Eh.set(1,0,0),Ah.crossVectors(Cc,Eh),Ah.lengthSq()<=FM*e&&(Ah.copy(pd).addScaledVector(Eh,-pd.dot(Eh)),Ah.lengthSq()<=FM*e&&function(t,i){t.set(1,0,0).cross(i),t.lengthSq()<=FM&&t.set(0,1,0).cross(i),t.normalize()}(Ah,Eh)),Ah.normalize(),ry.crossVectors(Eh,Ah)}function Dbe(e,t,i){return Pbe(e),Rbe(),t.makeBasis(Eh,Ah,ry),i.set(Eh.dot(cd),Eh.dot(pd),Eh.dot(Cc),0,Ah.dot(cd),Ah.dot(pd),Ah.dot(Cc),0,ry.dot(cd),ry.dot(pd),ry.dot(Cc),0,0,0,0,1),function(){let r=cd.length(),n=pd.length(),s=Cc.length(),a=Math.max(r,n,s);if(a-r>UM||a-n>UM||a-s>UM)return!0;let o=UM*a*a;return Math.abs(cd.dot(pd))>o||Math.abs(cd.dot(Cc))>o||Math.abs(pd.dot(Cc))>o}()}function Nbe(e){return Pbe(e),Rbe(),Ibe.makeBasis(Eh,Ah,ry)}var cd,pd,Cc,Eh,Ah,ry,Ibe,FM,UM,yB=U(()=>{ae(),cd=new R,pd=new R,Cc=new R,Eh=new R,Ah=new R,ry=new R,Ibe=new Ue,FM=1e-12,UM=.01});function $1(e,t){return t===0?0:e/t}function RY(e){Dbe(e,lH,oH),nx.setFromRotationMatrix(lH);let t=function(r,n,s){let a=2*Math.PI,o=d=>d-a*Math.round(d/a),l=o(r+Math.PI),h=o(Math.PI-n),u=o(s+Math.PI);return Math.abs(l)+Math.abs(u)<Math.abs(r)+Math.abs(s)-1e-9?[l,h,u]:[r,n,s]}(nx.x,nx.y,nx.z),i=oH.elements;return{position:[e.elements[12],e.elements[13],e.elements[14]],rotation:[t[0]*et.RAD2DEG,t[1]*et.RAD2DEG,t[2]*et.RAD2DEG],scale:[i[0],i[5],i[10]],shear:[$1(i[4],i[5]),$1(i[8],i[10]),$1(i[1],i[0]),$1(i[9],i[10]),$1(i[2],i[0]),$1(i[6],i[5])]}}function Af(e,{translation:t,quaternion:i,scale:r,shearMatrix:n}={}){let s=RY(e);if(t!==void 0&&t.fromArray(s.position),i!==void 0){let a=s.rotation;i.setFromEuler(nx.set(a[0]*et.DEG2RAD,a[1]*et.DEG2RAD,a[2]*et.DEG2RAD))}r!==void 0&&r.fromArray(s.scale),n!==void 0&&n.fromArray(Dh.toMatrix(s.shear))}var oH,lH,nx,QA=U(()=>{ae(),yB(),cxe(),oH=new Ue,lH=new Ue,nx=new Dr});function Obe(e){return e.length>=4&&function(t){return typeof t=="object"&&t!==null&&t.v===1&&t.data instanceof Float32Array&&Array.isArray(t.tracks)}(e[3])}function Lbe(e,t,i){let r={name:t,duration:i.duration,tracks:[],uuid:e};return i.blendMode!==void 0&&(r.blendMode=i.blendMode),JSON.stringify(r)}function T4e(e,t,i){for(let r=0;r<i.length;r++)if(!Object.is(e[t+r],i[r]))return!1;return!0}function M4e(e){if(!Array.isArray(e)||e.length>3)return e;let t,[i,r,n]=e;if(typeof i!="string"||typeof n!="string")return e;try{t=JSON.parse(n)}catch{return e}return t&&Array.isArray(t.tracks)&&!t.tracks.some(s=>!s?.type||!s.times||!s.values)?function(s,a,o){let l=[],h=0,u=g=>{let v=[h,g.length];return l.push(g),h+=g.length,v},d=new Map,c=o.tracks.map(g=>{let v=(b=>{let x=Float32Array.from(b),w=x.length+":"+x[0]+":"+x[x.length-1],S=d.get(w)??[];for(let M of S)if(T4e(M.run,0,x))return M.span;let T=u(x);return S.push({span:T,run:x}),d.set(w,S),T})(g.times),y=!Bbe.has(g.type),_={name:g.name,type:g.type,times:v,values:y?u(Float32Array.from(g.values)):[0,0]};return y||(_.list=Array.from(g.values)),g.interpolation!==void 0&&(_.interpolation=g.interpolation),_}),p=new Float32Array(h),f=0;for(let g of l)p.set(g,f),f+=g.length;let m={v:1,duration:o.duration,data:p,tracks:c};return o.blendMode!==void 0&&(m.blendMode=o.blendMode),o.userData!==void 0&&o.userData!=="{}"&&(m.userData=o.userData),[s,a,Lbe(s,a,m),m]}(i,typeof t.name=="string"?t.name:r,t):e}function E4e(e,t,i){return e.map(r=>{let n=t();return i[r[0]]=n,function(s,a){let[o,l,h]=s;if(Obe(s))return[a,l,Lbe(a,l,s[3]),s[3]];let u=h.indexOf(o);return[a,l,u!==-1?h.slice(0,u)+a+h.slice(u+o.length):h,...s.slice(3)]}(r,n)})}var Bbe,Fbe=U(()=>{Bbe=new Set(["bool","string"])});function b3(e,[t,i]){return Math.min(Math.max(e,t),i)}function Ube(e,t,i,r,n){e=b3(e,jbe),t=b3(t,Wbe),i=b3(i,Hbe),r=b3(r,qbe);let s=Math.sqrt(t/e),a=i/(2*Math.sqrt(t*e)),o=a<1?s*Math.sqrt(1-a*a):0,l=a<1?(a*s-r)/o:-r+s;return h=>{let u=n!==void 0?n*h:h;return u=a<1?Math.exp(-u*a*s)*(1*Math.cos(o*u)+l*Math.sin(o*u)):(1+l*u)*Math.exp(-u*s),h===0||h===1?h:1-u}}function zbe(e,t){return Ui(Ui(1-Ui(3*t))+Ui(3*e))}function kbe(e,t){return Ui(Ui(3*t)-Ui(6*e))}function Vbe(e){return Ui(3*e)}function x3(e,t,i){return Ui(Ui(Ui(Ui(Ui(zbe(t,i)*e)+kbe(t,i))*e)+Vbe(t))*e)}function uie(e,t,i){let r=Ui(Ui(Ui(3*zbe(t,i))*e)*e),n=Ui(Ui(2*kbe(t,i))*e);return Ui(Ui(r+n)+Vbe(t))}function X1(e,t,i,r){if(e=Ui(e),t=Ui(t),i=Ui(i),r=Ui(r),e<0||e>1||i<0||i>1||e===t&&i===r)return Zbe;let n=new Float32Array(kI);for(let s=0;s<kI;s++)n[s]=x3(Ui(s*zM),e,i);return s=>(s=Ui(s))===0||s===1?s:x3((a=>{let o=0,l=1,h=kI-1;for(;l!==h&&n[l]<=a;)o=Ui(o+zM),l+=1;l-=1;let u=Ui(Ui(a-n[l])/Ui(n[l+1]-n[l])),d=Ui(o+Ui(u*zM)),c=uie(d,e,i);return c>=Xbe?function(p,f,m,g){for(let v=0;v<$be;v++){let y=uie(f,m,g);if(y===0)return f;let _=Ui(x3(f,m,g)-p);f=Ui(f-Ui(_/y))}return f}(a,d,e,i):c===0?d:function(p,f,m,g,v){let y,_=0,b=0;do _=Ui(f+Ui(Ui(m-f)/2)),y=Ui(x3(_,g,v)-p),y>0?m=_:f=_,b+=1;while(Math.abs(y)>Ybe&&b<Kbe);return _}(a,o,Ui(o+zM),e,i)})(s),t,r)}function Gbe(e,t,i){switch(e.easing){case 0:default:return i;case 1:return X1(.25,.1,.25,1)(i);case 2:return X1(.42,0,1,1)(i);case 3:return X1(0,0,.58,1)(i);case 4:return X1(.42,0,.58,1)(i);case 7:return X1(.25,1,.5,1)(i);case 8:return Math.floor(i);case 5:{let{control1:r,control2:n}=e;return r&&n?X1(r[0],r[1],n[0],n[1])(i):i}case 6:{let{mass:r,stiffness:n,damping:s,velocity:a}=e;return r===void 0||n===void 0||s===void 0||a===void 0?i:Ui(Ube(r,n,s,a,t)(i))}}}var Ui,jbe,Wbe,Hbe,qbe,$be,Xbe,Ybe,Kbe,kI,zM,Zbe,die,A4e=U(()=>{Ui=Math.fround,jbe=[.01,100],Wbe=[.01,1e4],Hbe=[.01,1e3],qbe=[.01,1e3],$be=4,Xbe=Ui(.001),Ybe=Ui(1e-7),Kbe=10,zM=Ui(1/((kI=11)-1)),Zbe=e=>e,die=Ui(1.70158),Ui(die+1)});function Qbe(e,t){if(e.length===0)throw new Error("sampleKeyframes requires at least one keyframe");if(t<=e[0].time)return{index0:0,index1:0,t:1};let{found:i,index:r}=function(h,u){let d=h.length,c=0,p=d;for(;c<p;){let f=c+Math.floor(d/2),m=h[f].time;if(m<u)c=f+1;else{if(!(m>u))return{found:!0,index:f};p=f}d=p-c}return{found:!1,index:c}}(e,t);if(i)return{index0:r,index1:r,t:1};if(r>=e.length){let h=e.length-1;return{index0:h,index1:h,t:1}}let n=r-1,s=r,a=e[n].time,o=e[s].time;if(o===a)return{index0:n,index1:s,t:.5};let l=VI(o-a);return{index0:n,index1:s,t:Gbe({...e[n].ease,control2:e[s].ease.control2},l,VI(VI(t-a)/l))}}function Jbe(e){return[...e].sort((t,i)=>t.time-i.time)}var VI,C4e=U(()=>{A4e(),VI=Math.fround});function P4e(e){if(e?.length!==2)return;let t=`${e[0]}.${e[1]}`;return DY.includes(t)?t:void 0}function exe(e){return e.slice(0,e.indexOf("."))}function txe(e){return Hg.indexOf(e.slice(-1))}function R4e(e){return{easing:e?.type,control1:qf(e?.cubicControls?.control1,[0,0]),control2:qf(e?.cubicControls?.control2,[1,1]),...e?.springParameters}}function D4e(e){let t=e?.cubicControls;return{...e,cubicControls:{control1:[...t?.control1??[0,0]],control2:[...t?.control2??[1,1]]},...e?.springParameters?{springParameters:{...e.springParameters}}:{}}}function cie(e,t,i){let r=exe(e);if(r==="position"){let n=txe(e);return Hg.flatMap((s,a)=>Math.abs(t.elements[4*a+n])>1e-9?[`position.${s}`]:[])}return(i?[r]:["rotation","scale"]).flatMap(n=>Hg.map(s=>`${n}.${s}`))}function N4e(e,t){let[i,r,n]=e,s=[[i,r,n],[i+180,180-r,n+180]],a=[i,r,n],o=1/0;for(let l of s){let h=l.map((d,c)=>d+360*Math.round((t[c]-d)/360)),u=h.reduce((d,c,p)=>d+Math.abs(c-t[p]),0);u<o-1e-9&&(a=h,o=u)}return a}function I4e(e,t,i){if(e==="rotation"){let r=((t-i)%360+540)%360-180;return Math.abs(r)<1e-6}return Math.abs(t-i)<1e-9*Math.max(1,Math.abs(t),Math.abs(i))}function O4e(e,t,i,r){let n=new Map;for(let{id:p,data:f}of e.unproxy()){if(f.isPlaceholder)continue;let m=P4e(f.path);if(!m){if(kM.includes(f.path?.[0]))return;continue}if(typeof f.value!="number"||!Number.isFinite(f.value))return;let g=n.get(m)??{keys:[],sampled:[]};g.keys.push({id:p,time:f.time,value:f.value,keyframe:f}),n.set(m,g)}if(n.size===0)return;for(let p of n.values())p.keys.sort((f,m)=>f.time-m.time),p.sampled=Jbe(p.keys.map(f=>({time:f.time,ease:R4e(f.keyframe.easing),value:f.value})));let s=(p,f)=>{let m=n.get(p);return m?function(g,v){let{index0:y,index1:_,t:b}=Qbe(g.sampled,v),x=g.sampled[y].value;return x+(g.sampled[_].value-x)*b}(m,f):i[exe(p)][txe(p)]},a=new jt,o=new Dr,l=new Ue,h=new R,u=new R,d=p=>{let f=(m=>{let g={};for(let v of kM)g[v]=Hg.map((y,_)=>s(DY[3*kM.indexOf(v)+_],m));return g})(p);return o.set(f.rotation[0]*et.DEG2RAD,f.rotation[1]*et.DEG2RAD,f.rotation[2]*et.DEG2RAD),l.compose(h.fromArray(f.position),a.setFromEuler(o),u.fromArray(f.scale)).premultiply(t),{pose:f,out:RY(l)}},c=function(p){let f=p.elements,m=[0,4,8].map(y=>new R(f[y],f[y+1],f[y+2])),g=m[0].lengthSq(),v=1e-9*Math.max(1,g);return Math.abs(m[1].lengthSq()-g)<v&&Math.abs(m[2].lengthSq()-g)<v&&Math.abs(m[0].dot(m[1]))<v&&Math.abs(m[0].dot(m[2]))<v&&Math.abs(m[1].dot(m[2]))<v}(t);for(let p of kM){let f,m=Hg.map(_=>`${p}.${_}`),g=_=>{let b=new Set;for(let x of cie(_,t,c))for(let w of n.get(x)?.keys??[])b.add(w.time);return[...b].sort((x,w)=>x-w)},v=[...new Set(m.flatMap(_=>g(_)))].sort((_,b)=>_-b),y=new Map;for(let _ of v){let{pose:b,out:x}=d(_),w=[...x[p]];p==="rotation"&&(w=N4e(w,f?f.out.map((S,T)=>S+b.rotation[T]-f.in[T]):b.rotation),f={in:b.rotation,out:w}),y.set(_,w)}m.forEach((_,b)=>{let x=n.get(_)?.keys??[],w=g(_),S=new Set(w);if(x.length!==0||!w.every(T=>I4e(p,y.get(T)[b],r[p][b]))){for(let T of x)S.has(T.time)||e.delete(T.id);for(let T of w){let M=y.get(T)[b],E=x.find(N=>N.time===T);if(E){let N=e.data(E.id);N&&(N.value=M);continue}let A=cie(_,t,c).sort((N,D)=>Number(D===_)-Number(N===_)).map(N=>n.get(N)?.keys.find(D=>D.time===T)).find(N=>N!==void 0),P=et.generateUUID();e.insertBefore(null,[{id:P,data:{id:P,time:T,path:[p,Hg[b]],value:M,easing:D4e(A.keyframe.easing),index:Wg.rowOrder([p])}}])}}})}}var kM,Hg,DY,L4e=U(()=>{ae(),CY(),C4e(),QA(),Hg=["x","y","z"],DY=(kM=["position","rotation","scale"]).flatMap(e=>Hg.map(t=>`${e}.${t}`))}),ixe={};function pie(e){e.layers&&e.layers.forEach(t=>{t.type==="light"&&t.alphaOverride===void 0&&(t.alphaOverride=1)})}function rxe(e){let t=e.geometry;t!==void 0&&hxe.has(t.type)&&t.extrusionVersion===void 0&&(t.extrusionVersion=1)}function nxe(e){if(e.type!=="Empty")return;let t=Os(e.animations);if(!Array.isArray(t))return;let i=t.map(M4e);i.some((r,n)=>r!==t[n])&&(e.animations=i)}function fie(e,t){let[i,r,n]=e,s=Math.cos(i),a=Math.sin(i),o=Math.cos(r),l=Math.sin(r),h=Math.cos(n),u=Math.sin(n),d=[o*h,s*u+a*h*l,a*u-s*h*l],c=Math.hypot(t[0],t[1],t[2])||1;return Math.abs((d[0]*t[0]+d[1]*t[1]+d[2]*t[2])/c)}function sxe(e){(function(i){i.rotation=i.rotation.slice(0,3).map(r=>r*og)})(e),e.type==="Page"&&function(i){let r=i.rotation.slice(0,3);(function(n,s){let a=Array.isArray(s)&&s.length>=3&&s.every(h=>typeof h=="number"&&Number.isFinite(h))?s:[0,1,0],o=fie(n,a),l=fie(n.map(h=>h*uxe),a);return Math.abs(o-l)<1e-6?n.some(h=>Math.abs(h)>Math.PI):l<o})(r,i.up)?i.rotation=r:i.rotation=r.map(n=>n*og)}(e.camera),e.states?.forEach(i=>{i.rotation===void 0||i.rotation===null||(i.rotation=i.rotation.slice(0,3).map(r=>r*og))});let t=e.geometry;t&&t.type==="SphereGeometry"&&(t.thetaLength=(t.thetaLength??180)*og),t&&t.type==="TorusGeometry"&&(t.arc=t.arc*og),t&&t.type==="PathGeometry"&&(t.extrusion.angle*=og,t.extrusion.twist*=og),e.type==="Mesh"&&e.geometry.type==="TextGeometry"&&(e.geometry.text={textValue:e.geometry.text}),Array.isArray(Os(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 B4e(e){e.scene.objects.traverse((t,i)=>{})}function F4e(e){let t=e.schema??104;t!==135&&(t<130&&(NY(e.asset),e.schema=130),t<135&&(IY(e.asset),e.schema=135))}function bc(e,t){t(e.data);for(let i of e.children)bc(i,t)}function axe(e){let t=e.schema??104;t!==135&&(t<105&&(bc(e.asset,sxe),e.schema=105),t<118&&(bc(e.asset,oxe),e.schema=118),t<121&&(bc(e.asset,dH),e.schema=121),t<130&&(bc(e.asset,i=>mie(i,NY)),e.schema=130),t<132&&(bc(e.asset,rxe),e.schema=132),t<133&&(bc(e.asset,i=>lxe(i,()=>{})),e.schema=133),t<134&&(bc(e.asset,nxe),e.schema=134),t<135&&(bc(e.asset,i=>mie(i,IY)),e.schema=135))}function hH(e,t){ef(e,t),Jp(e,t),Object.values(e.shared.lib.materials).forEach(i=>t(i.asset))}function NY(e){e.layers===void 0&&Object.assign(e,Kn.defaultTwoLayerData("phong"))}function IY(e){let t=OM(e),i=Kn.withRepairedLayers(t);i!==t&&(e.layers=i.layers)}function mie(e,t){"materials"in e?e.materials.forEach(i=>{i!==void 0&&typeof i!="string"&&t(i)}):"material"in e&&e.material!==void 0&&typeof e.material!="string"&&t(e.material)}function oxe(e){e.timelineAnimations=jo({},si.prototype)}function U4e(e){let t=[];return e?(e.forEach((i,r)=>{let{path:n,keyframes:s}=i.data,a=n[0]==="material"?i.id:void 0;s?.length?s.forEach(({id:o,data:l})=>{t.push({id:o,data:{...l,path:n,layerId:a,index:r}})}):t.push(Wg.placeholderKeyframe(i.id,n,{layerId:a,index:r}))}),t.sort((i,r)=>i.data.time-r.data.time),new Ct(...t.map((i,r)=>({...i,fi:r})))):new Ct}function z4e(e){for(let{id:t,data:i}of[...e.unproxy()]){let r=i.path?.[0];if(!r||!dxe.includes(r))continue;let n=uH(i.value);if(!n.length)continue;let s=e.data(t);if(!s)continue;let a=i.value,[o,...l]=n;for(let h of l){let u=et.generateUUID();e.insertBefore(null,[{id:u,data:{...i,id:u,path:[r,h],value:a[h],easing:k4e(i.easing)}}])}s.path=[r,o],s.value=a[o]}}function uH(e){return e===null||typeof e!="object"?[]:PA.filter(t=>t in e)}function k4e(e){let t=e?.cubicControls;return{...e,cubicControls:{control1:[...t?.control1??[0,0]],control2:[...t?.control2??[1,1]]},...e?.springParameters?{springParameters:{...e.springParameters}}:{}}}function V4e(e,t){return Math.abs(e[0]-t[0])<1e-6&&Math.abs(e[1]-t[1])<1e-6}function G4e(e){let t=function(s){let a=[];for(let o of Wg.groupKeyframes(s)){let l=new Set(o.keyframes.flatMap(u=>uH(u.data.value))),h=l.size?[...l].map(u=>o.keyframes.filter(d=>uH(d.data.value).includes(u))):[o.keyframes];for(let u of h){let d=[...u].sort((c,p)=>c.data.time-p.data.time);for(let c=0;c+1<d.length;c++)a.push({left:d[c],right:d[c+1]})}}return a}([...e.unproxy()]),i=new Map,r=new Set;for(let{left:s,right:a}of t){let o=s.data.easing?.type,l=(o===void 0?void 0:Wg.presetHandles(o))?.control2??(o===5?qf(a.data.easing?.cubicControls?.control2,[1,1]):void 0);if(!l)continue;let h=i.get(a.id);h?V4e(h,l)||r.add(a.id):i.set(a.id,l)}let n=new Map;for(let{id:s,data:a}of e.unproxy()){let o=a.easing?.type,l=o===void 0?void 0:Wg.presetHandles(o);l&&n.set(s,l.control1)}for(let{left:s,right:a}of t)r.has(a.id)&&n.delete(s.id);for(let[s,a]of n){let o=e.data(s);!o?.easing||(o.easing.cubicControls={control1:a,control2:qf(o.easing.cubicControls?.control2,[1,1])},o.easing.type=5)}for(let{left:s,right:a}of t){if(!n.has(s.id))continue;let o=e.data(a.id),l=i.get(a.id);!o?.easing||!l||(o.easing.cubicControls={control1:qf(o.easing.cubicControls?.control1,[0,0]),control2:l})}}function gie(e,t){e.scene.objects.traverse((i,r)=>{let n=r;if(n.type==="Page"&&n.timelines)for(let s of Object.values(n.timelines))for(let a of Object.values(s.objectTimelines??{}))t(a.keyframes)})}function dH(e){e.pivot=[0,0,0],e.pivotRotation=[0,0,0]}function lxe(e,t,i=[]){let r=["position","rotation","scale","shear"];function n(c,p,f){return c?.map(m=>typeof m=="string"?t(m)??f:m)??[...p]}function s(c,p){if(c&&!function(f){return f.every((m,g)=>Math.abs(m-(g%5==0?1:0))<1e-6)}(c))return RY(new Ue().fromArray(c).multiply(new Ue().compose(new R().fromArray(p.position),new jt().setFromEuler(new Dr(p.rotation[0]*et.DEG2RAD,p.rotation[1]*et.DEG2RAD,p.rotation[2]*et.DEG2RAD)),new R().fromArray(p.scale))))}function a(c,p){return c.length===p.length&&c.every((f,m)=>f===p[m])}e.shear=Dh.zero;let o=e,l=o.hiddenMatrix;l!==void 0&&delete o.hiddenMatrix;let h={position:n(o.position,[0,0,0],0),rotation:n(o.rotation,[0,0,0],0),scale:n(o.scale,[1,1,1],1)},u=s(l,h);if(u&&Object.assign(o,u),u){let c=new Ue().fromArray(l);for(let p of i)O4e(p,c,h,u)}let d=u??{...h,shear:[...Dh.zero]};o.states?.forEach(c=>{let p=c.hiddenMatrix;if(p!==void 0&&delete c.hiddenMatrix,p===void 0&&c.position==null&&c.rotation==null&&c.scale==null)return;let f={position:n(c.position,h.position,0),rotation:n(c.rotation,h.rotation,0),scale:n(c.scale,h.scale,1)},m=s(p??l,f);if(!u&&!m)return;let g=m??{...f,shear:[...Dh.zero]};for(let v of r)(c[v]!=null||!a(g[v],d[v]))&&(c[v]=g[v])})}function j4e(e){}function W4e(e){let t=e.schema??0;if(t!==135){if(t>135)return void console.error(`This scene was created with a newer version of Spline (file format ${t}, this runtime reads 135). Update @splinetool/runtime to the latest version to load it correctly.`);console.warn("updating from ",t,"to ",135),function(i,r){if(r<1&&(ef(i,tie),Jp(i,tie),i.schema=1),r<2&&(function(n){Object.assign(n.scene.publish,{orbitControls:{...HL.defaultData,...Os(n.scene.publish.orbitControls)}})}(i),i.schema=2),r<3&&(function(n){function s(a){if(a.layers){for(let o of Object.values(a.layers))if(o){for(let[l,h]of Object.entries(o))if((mB.includes(l)||typeof h=="boolean")&&delete o[l],l==="texture")for(let[u,d]of Object.entries(h))(_Y.includes(u)||typeof d=="boolean")&&delete h[u]}}}n.scene.objects.traverse((a,o)=>{o.states.forEach(l=>{let h=l;h.material?s(h.material):h.materials&&h.materials.forEach(u=>{s(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((s,a)=>{let o=a.cloner;o&&(o.radial.scale=o.radial.scale.map(l=>l+1),o.linear.scale=o.linear.scale.map(l=>l+1))})}(i),i.schema=6),r<7&&(function(n){n.scene.objects.traverse((s,a)=>{let o=a.geometry;o&&(o.type==="DodecahedronGeometry"||o.type==="IcosahedronGeometry")&&(o.detail=Math.round(o.detail))})}(i),i.schema=7),r<8&&(i.schema=8),r<9&&(rie(i),i.schema=9),r<10&&(function(n){n.scene.objects.traverse((s,a)=>{a.type==="Mesh"&&(a.geometry.type==="BooleanGeometry"||a.geometry.type==="SubdivGeometry")&&(a.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((s,a)=>{(a.type==="DirectionalLight"||a.type==="SpotLight")&&(a.shadowResolution=1024,a.shadowRadius=1,a.depth=1e5)}),n.shared.penumbraSize=new Array(5).fill(.5)}(i),i.schema=11),r<12&&(rie(i),i.schema=12),r<13&&(function(n){n.shared.audios=jo({},si.prototype)}(i),i.schema=13),r<14&&(function(n){let s=n.shared.materials;Object.entries(s).forEach(([a,o])=>{if(!o.layers){let l={name:"Untitled Material",layers:[{fi:0,data:{type:"light",category:"phong",alpha:.6,visible:!0,mode:0,specular:{r:.2,g:.2,b:.2},shininess:5},id:"layer1"},{fi:1,data:{type:"color",alpha:1,visible:!0,mode:0,color:{r:.2823529411764706,g:.2823529411764706,b:.30196078431372547}},id:"layer2"}]};Object.assign(s,{[a]:l})}})}(i),i.schema=14),r<15&&(function(n){Object.entries(Os(n.shared.images)).filter(s=>s[1].asset===!1).map(s=>s[0]).forEach(s=>{delete n.shared.images[s]}),Object.entries(Os(n.shared.audios)).filter(s=>s[1].asset===!1).map(s=>s[0]).forEach(s=>{delete n.shared.audios[s]})}(i),i.schema=15),r<16&&(function(n){n.scene.publish.settings.web.preload=!1}(i),i.schema=16),r<17&&(ef(i,nie),Jp(i,nie),i.schema=17),r<18&&(ef(i,iie),Jp(i,iie),i.schema=18),r<19&&(function(n){Object.assign(n.scene.publish.settings,{video:{...Ef.defaultData.settings.video,...Os(n.scene.publish.settings.video)}})}(i),i.schema=19),r<20&&(function(n){n.shared.fonts=jo({},si.prototype)}(i),function(n){let s=[];n.scene.objects.traverse((a,o)=>{let l=o;if(l.type==="TextFrame"){let h=Kn.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(f){return f.replace(".typeface","").replace(/optimer/gi,"open sans").replace("space_mono","space mono").replace(/alma_mono/gi,"varela round").replace(/droid_sans_mono/gi,"noto sans mono").replace(/droid_sans|gentilis|gnomon_(simple|foreground)|helvetiker/gi,"roboto").replace(/droid_serif/gi,"roboto slab").replace("_sans"," sans").replace("crimson_text","crimson text").replace("medium_medium","medium").replace("fatface_fatface","fatface").replace("100hairline","thin").replace("200thin","extralight").replace("300light","light").replace("500medium","medium").replace("600semi","semibold").replace("800heavy","extrabold").replace("900black","black").replace(/bodoni_(11|16|24|36|48|72|96)([^_])/gi,"bodoni_$1_$2").replace(/bodoni_(11|16|24|36|48|72|96)/gi,"bodoni moda").replace(/(thin|hairline)(_regular)?/gi,"100").replace(/(extra|ultra)light(_regular)?/gi,"200").replace(/light(_regular)?/gi,"300").replace(/_book|_normal|_roman/gi,"_regular").replace(/medium(_regular)?/gi,"500").replace(/(semi|demi)bold(_regular)?/gi,"600").replace(/(extra|ultra)bold(_regular)?/gi,"800").replace(/bold(_regular)?/gi,"700").replace(/(black|heavy|fatface)(_regular)?/gi,"900").replace(/([1-9]00)_italic/gi,"$1italic").replace(/regularitalic/gi,"italic").replace(/regularitalic/gi,"italic").split(" ").map(m=>m.charAt(0).toUpperCase()+m.slice(1)).join(" ")}(l.font);n.shared.fonts[d]===void 0&&(n.shared.fonts[d]={name:d});let c={name:l.name,...na.defaultData,...xc.defaultData,flatShading:!1,wireframe:!1,geometry:{...ff.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:Os(l.states),events:Os(l.events),visible:l.visible,raycastLock:l.raycastLock,position:l.position,rotation:l.rotation,scale:l.scale,hiddenMatrix:l.hiddenMatrix},p=Os(n.scene.objects).parent(a);n.scene.objects.insertAfter(p??null,a,[{id:a+"new",data:c,children:[]}]),s.push(a)}}),s.forEach(a=>{n.scene.objects.delete(a)})}(i),i.schema=20),r<21&&(function(n){let s={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((a,o)=>{o.events.forEach(l=>{if(s[Number(l.type)])if(Object.assign(l,{type:s[Number(l.type)]}),l.type==="Audio"&&"audioEvent"in l&&(Object.assign(l,{playAudio:l.audioEvent}),delete l.audioEvent),l.type==="GameControl")Object.assign(l,{gameActions:{idle:new Ct,move:new Ct,jump:new Ct}});else{let h=new Ct;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:et.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,Uv(u,"mass","stiffness","damping","velocity")):u.easing===5&&Object.assign(p,{control1:{...u.control1},control2:{...u.control2}});let f={repeat:u.repeat?-1:0,delay:u.delay,delayDirection:u.delayDirection,direction:u.cycle&&u.rewind?"pingpong-rewind":u.cycle?"pingpong":"normal"},m={state:u.state,...f,...p},g={allowSlerp:!0,type:"Transition",object:u.object,repeat:0,delay:0,delayDirection:void 0,direction:"normal",tweens:new Ct({fi:0,id:et.generateUUID(),data:{state:void 0,repeat:0,delay:0,delayDirection:void 0,direction:"normal",duration:0,easing:4}},{fi:1,id:et.generateUUID(),data:m})};h.push({fi:c,id:d,data:g})}),delete l.targets)}})})}(i),function(n){n.scene.objects.traverse((s,a)=>{function o(l,h){let u=new Ct,d=[];if(a.events.forEach((c,p,f)=>{if(c.type==="Audio"&&c.trigger===h){let m;d.push(p),c.interaction==="play"?m={...Uv(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")&&(m={...Uv(c,"interaction","delay","object","playAudio"),type:"Audio"}),m&&u.push({fi:f,id:p,data:m})}}),d.forEach(c=>a.events.delete(c)),u.length){let c=a.events.find(p=>p.type===l)?.data;c?"actions"in c&&c.actions.insertBefore(null,u):a.events.insertBefore(null,[{id:et.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&&(oie(i),i.schema=22),r<23&&(function(n){n.scene.objects.traverse((s,a)=>{a.type==="Mesh"&&a.geometry.type==="SubdivGeometry"&&(a.geometry.scaleBaked||(a.geometry.scaleBaked=[1,1,1]))})}(i),i.schema=23),r<24&&(function(n){n.scene.objects.traverse((s,a)=>{(a.type==="Empty"||a.type==="Mesh")&&a.cloner&&!a.cloner.randomnessObject&&!a.cloner.toObject&&!a.cloner.randomness&&(a.cloner={...a.cloner,toObject:{object:"",spreadType:"random",scale:[0,0,0],rotation:[0,0,0],position:[0,0,0],axis:"x",seed:0,count:99,align:"normal"},randomness:!1,randomnessObject:{strength:100,scale:[0,0,0],rotation:[0,0,0],position:[0,0,0],movement:1,seed:0,freqScale:10,noiseType:"perlin"}})})}(i),i.schema=24),(r<25||i.shared.videos===void 0)&&(function(n){n.shared.videos=jo({},si.prototype)}(i),r<25&&(i.schema=25)),r<26&&(function(n){n.scene.objects.traverse((s,a)=>{let o=n.scene.objects.unproxy().parent(s);if(o){let l=Os(n.scene.objects.data(o));l&&l.type==="Mesh"&&l.geometry.type==="BooleanGeometry"&&a.type==="Mesh"&&(a.visible=Os(a).booleanExclude!==!0)}})}(i),i.schema=26),r<27&&(function(n){n.scene.objects.traverse((s,a)=>{if(a.type==="Mesh"){let o=a;a.geometry.type==="NonParametricGeometry"?o.material!==void 0&&delete o.material:o.materials!==void 0&&delete o.materials}})}(i),i.schema=27),r<28&&(oie(i),i.schema=28),r<29&&(function(n){function s(o){Object.setPrototypeOf(o,Ms.prototype),o.texture&&Object.setPrototypeOf(o.texture,Ms.prototype)}function a(o){Object.setPrototypeOf(o,Ms.prototype);for(let l in o)s(o[l])}n.scene.objects.traverse((o,l)=>{l.states.forEach(h=>{let u=h;if(u.material){let d=Os(u.material).layers;a(d),u.material.layers=d}if(u.materials)for(let d=0;d<u.materials.length;d++){let c=u.materials[d],p=Os(c).layers;a(p),c.layers=p}})})}(i),i.schema=29),r<30&&(function(n){n.scene.objects.traverse((s,a)=>{a.type==="Mesh"&&a.geometry.type==="NonParametricGeometry"&&!("material"in a)&&!("materials"in a)&&(a.material=Kn.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((s,a)=>{(a.type==="OrthographicCamera"||a.type==="PerspectiveCamera")&&(a.orthographic.autoZoom===void 0&&(a.orthographic.autoZoom=!1),a.orthographic.autoZoomFrustumSize===void 0&&(a.orthographic.autoZoomFrustumSize=790))})}(i),i.schema=31),r<33&&(function(n){n.scene.objects.traverse((s,a)=>{a.pathSnapping===void 0&&(a.pathSnapping={pathId:null,slide:0,offset:0,orientation:"tangential"}),a.pathSnapping.offset===void 0&&(a.pathSnapping.offset=0)})}(i),i.schema=33),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:s}=n.scene.publish.settings;s.format==="gif"&&s.fps>48&&(s.fps=15)}(i),i.schema=35),r<36&&(function(n){n.scene.objects.traverse((s,a)=>{a.events.forEach(o=>{o.type==="GameControl"&&(o.resetYPosition=Math.abs(o.resetYPosition-a.position[1]))})})}(i),i.schema=36),r<37&&(function(n){let s=n.scene.environment.usePhysics;n.scene.objects.traverse((a,o)=>{s&&o.physics===null?o.collision=!1:o.collision="visibility"})}(i),i.schema=37),r<38&&(ef(i,sie),Jp(i,sie),i.schema=38),r<39&&(function(n){n.scene.objects.traverse((s,a)=>{a.events.forEach(o=>{o.type==="GameControl"&&(o.navmesh=$L.defaultDataThirdPerson.navmesh)})})}(i),i.schema=39),r<40&&(function(n){n.scene.styles||(n.scene.styles=ty.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}),ef(n,lie),Jp(n,lie)}(i),i.schema=41),r<42&&(function(n){n.scene.objects.traverse((s,a)=>{a.events.forEach(o=>{o.type==="GameControl"&&Object.assign(o.gameActions,{run:new Ct})})})}(i),i.schema=42),r<43&&(function(n){n.scene.objects.traverse((s,a)=>{a.events.forEach(o=>{o.type==="GameControl"&&(o.keyAssignments=[...o.keyAssignments,["run","\u21E7"],["none","Ctrl"]])})})}(i),i.schema=43),r<99){ef(i,hie),Jp(i,hie),i.scene.publish.playCamera===null&&(i.scene.publish.playCamera=d1);let n=Os(i.scene.objects),s=i.scene.objects;i.scene.publish.playPage=Mx,s.insertBefore(null,null,[{id:Mx,data:{...by.defaultData,backgroundColor:i.scene.backgroundColor,fog:i.scene.fog,postprocessing:i.scene.postprocessing,ao:Uv(i.scene.environment.ambientLight,"occlusion","aoFullRes","radius","bias","aoColor"),publish:{playCamera:i.scene.publish.playCamera,gameControlObject:i.scene.publish.gameControlObject},shadow:Uv(i.scene.environment.ambientLight,"softShadowQuality"),globalPhysics:{...Ax.defaultData,...Uv(i.scene.environment,"usePhysics","gravity")},camera:Os(i.scene.ownerCamera)??by.defaultData.camera,name:"Scene"},children:[]}]);for(let l of n)l.id!==iy.TRASH_CAN_ID&&s.move(Mx,l.fi,l.id);let a=0,o=0;i.shared.penumbraSize&&i.scene.objects.traverse((l,h)=>{h.type==="DirectionalLight"?(h.penumbraSize=i.shared.penumbraSize[Math.min(a,2)],a+=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,Ex.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=Ef.defaultData.joystickSizeAndXYOffset),e.schema=100),t<101&&(ef(e,pie),Jp(e,pie),e.schema=101),t<102&&(function(i){i.scene.objects.traverse((r,n)=>{let s=n.geometry;s&&s.type==="PathGeometry"&&(s.extrusion.capType="flat",s.extrusion.bevel=50,s.extrusion.bevelSides=6,s.extrusion.shape.type==="Custom"&&(s.extrusion.shape.shapeQuality="low"))})}(e),e.schema=102),t<104&&(e.shared.catelogs=new si,e.shared.lib=mf.defaultData(),e.schema=104),t<105&&(function(i){i.shared.variables=jo({},si.prototype)}(e),e.scene.objects.traverse((i,r)=>{sxe(r)}),e.schema=105);for(let i of Object.values(e.shared.lib.components))axe(i);if(t<106&&(function(i){let r=Os(i.shared.variables);i.shared.variables=jo(Object.entries(r??{}).map(([n,s],a)=>({fi:a,id:n,data:s})),Ct.prototype)}(e),e.schema=106),t<107&&(e.shared.lib.variables=mf.defaultData().variables,e.schema=107),t<109&&(function(i){i.shared.particles=jo({},si.prototype),i.shared.lib&&(i.shared.lib.particles=mf.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(Os(n.events))&&n.events?.forEach(s=>{"disabled"in s||(s.disabled=!1),(s.type==="MouseDown"||s.type==="MouseUp"||s.type==="MousePress")&&(s.mode=s.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(Os(n.events))!==!1&&n.events?.forEach(s=>{let a=s.runMode;s.type==="MouseDown"||s.type==="MouseUp"||s.type==="KeyDown"||s.type==="KeyUp"||s.type==="Collision"||s.type==="Trigger"?s.actions?.forEach(o=>{o.type==="Transition"&&(o.runMode=a??"Repeat"),(o.type==="Animation"&&"runMode"in o||o.type==="SwitchCamera")&&(o.runMode=a==="Toggle"?"Toggle":"Normal")}):s.type==="MouseHover"||s.type==="MousePress"||s.type==="KeyPress"?s.actions?.forEach(o=>{(o.type==="Transition"||o.type==="Animation"&&"runMode"in o||o.type==="SwitchCamera")&&(o.runMode="Toggle")}):s.type==="GameControl"?(delete s.actions,Object.keys(s.gameActions).forEach(o=>{s.gameActions[o]?.forEach(l=>{l.type==="Transition"&&(l.runMode="Repeat"),l.type==="Animation"&&"runMode"in l&&(l.runMode="Normal")})})):s.type==="DragDrop"?(delete s.actions,s.dragDropActions?.drag?.forEach(o=>{(o.type==="Transition"||o.type==="Animation"&&"runMode"in o||o.type==="SwitchCamera")&&(o.runMode="Toggle")}),s.dragDropActions?.drop?.forEach(o=>{(o.type==="Transition"||o.type==="Animation"&&"runMode"in o||o.type==="SwitchCamera")&&(o.runMode="Toggle")})):s.type==="Resize"?(delete s.actions,s.breakpoints?.forEach(o=>{o.actions?.forEach(l=>{(l.type==="Transition"||l.type==="Animation"&&"runMode"in l||l.type==="SwitchCamera")&&(l.runMode="Toggle")})})):s.type==="Start"?s.actions?.forEach(o=>{o.type==="Transition"&&(o.runMode="Once"),(o.type==="Animation"&&"runMode"in o||o.type==="SwitchCamera")&&(o.runMode="Normal")}):s.type==="VariableChange"||s.type==="Scroll"?s.actions?.forEach(o=>{o.type==="Transition"&&(o.runMode="Repeat"),(o.type==="Animation"&&"runMode"in o||o.type==="SwitchCamera")&&(o.runMode="Normal")}):s.type==="Conditional"&&(delete s.actions,s.inActions?.forEach(o=>{o.type==="Transition"&&(o.runMode="Repeat"),(o.type==="Animation"&&"runMode"in o||o.type==="SwitchCamera")&&(o.runMode="Normal")}),s.outActions?.forEach(o=>{o.type==="Transition"&&(o.runMode="Repeat"),(o.type==="Animation"&&"runMode"in o||o.type==="SwitchCamera")&&(o.runMode="Normal")}))})})}(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=jo({},si.prototype),i.shared.userWebhooks=jo({},si.prototype),i.shared.lib&&(i.shared.lib.userAPIs=mf.defaultData().userAPIs,i.shared.lib.userWebhooks=mf.defaultData().userWebhooks)}(e),e.schema=115),t<116&&(function(i){i.scene.publish.settings.videoStatic===void 0&&(i.scene.publish.settings.videoStatic=Ef.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=jo({},si.prototype),e.scene.objects.traverse((i,r)=>{oxe(r)}),e.schema=118),t<119&&(e.scene.publish.settings.videoStatic.format=Cx.defaultData.scene.publish.settings.videoStatic.format,e.scene.publish.settings.videoStatic.imageFormat=Cx.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)=>{dH(r),r.type==="Page"&&r.camera!==void 0&&dH(r.camera)}),e.schema=121),t<122&&(delete e.scene.publish.settings.video,e.scene.publish.orbitControls.rotationSpeed=Cx.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=Tg.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=Tg.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=Tg.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={...Tg.defaultData.hdri}:(n.hdri.blur===void 0&&(n.hdri.blur=Tg.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&&(hH(e,NY),e.schema=130),t<131&&(function(i){i.scene.objects.traverse((r,n)=>{let s=n.states;if(!s)return;let a=n.timelineAnimations,o=[];s.forEach((l,h)=>{(l.isAnimation||a?.[h])&&o.push(h)}),o.forEach(l=>s.delete(l))})}(e),function(i){let r=i.shared,n=r.timelineAnimations;if(!n)return;let s=i.scene.objects,a=s.unproxy().find(o=>o.data.type==="Page")?.id;for(let[o,l]of Object.entries(n)){let h=jo({},si.prototype),u=0,d=Boolean(l.loop);for(let[f,m]of Object.entries(l.mapping??{})){let g=s.data(f)?.timelineAnimations?.[m];!g||(u=Math.max(u,g.to??0),d=d||Boolean(g.loop),h[f]={id:f,keyframes:U4e(g.properties?.unproxy())})}let c=l.page??a,p=c?s.data(c):void 0;p&&p.type==="Page"&&((p.timelines??(p.timelines=jo({},si.prototype)))[o]={id:o,name:l.name,duration:u||5,...d?{loop:d}:{},objectTimelines:h})}delete r.timelineAnimations,s.traverse((o,l)=>{delete l.timelineAnimations})}(e),gie(e,z4e),gie(e,G4e),e.schema=131),t<132&&(e.scene.objects.traverse((i,r)=>rxe(r)),e.schema=132),t<133){let i=function(n){return s=>n.get(s)?.data?.value}(e.shared.variables),r=new Map;e.scene.objects.traverse((n,s)=>{let a=s;if(a.type==="Page"&&a.timelines)for(let o of Object.values(a.timelines))for(let[l,h]of Object.entries(o.objectTimelines??{})){let u=r.get(l)??[];u.push(h.keyframes),r.set(l,u)}}),e.scene.objects.traverse((n,s)=>lxe(s,i,r.get(n))),e.schema=133}t<134&&(e.scene.objects.traverse((i,r)=>nxe(r)),e.schema=134),t<135&&(hH(e,IY),e.schema=135)}}yw(ixe,{updateAllMaterials:()=>hH,updateDocumentSchema:()=>W4e,updateLibSchema:()=>j4e,updateMaterialSchema:()=>F4e,updateObjectStateRec:()=>bc,updateObjectsSchema:()=>axe,updateTextValues:()=>B4e});var hxe,og,uxe,dxe,vie,w3,c5,yie,S3,ny,VS,Y1,T3,p5,GI,f5,m5,_ie,jI,g5,xy,cH,_B=U(()=>{ae(),Abe(),Or(),CY(),S4e(),vB(),ZA(),th(),la(),AY(),gB(),SY(),QA(),Fbe(),L4e(),hxe=new Set(["RectangleGeometry","EllipseGeometry","StarGeometry","PolygonGeometry","TriangleGeometry","VectorGeometry","TextGeometry","InputGeometry","PathGeometry"]),og=180/Math.PI,uxe=Math.PI/180,dxe=["position","rotation","scale","shape size"]}),H4e=U(()=>{var e,t,i;th(),Or(),la(),(vie||(vie={})).is=function(r){return!0},(e=w3||(w3={})).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 j_e({position:Uc.isEqual(r.position,n.position)?void 0:n.position,rotation:r.rotation===n.rotation?void 0:n.rotation,scale:Uc.isEqual(r.scale,n.scale)?void 0:n.scale,shear:r.shear&&n.shear&&Uc.isEqual(r.shear,n.shear)?void 0:n.shear})},(c5||(c5={})).defaultData={horizontalConstraint:0,verticalConstraint:0},(yie||(yie={})).defaultData={direction:"row",wrap:"unwrap",align:"top-left",gap:10,rowGap:10,autoGap:!1,autoRowGap:!1,leftPadding:8,rightPadding:8,topPadding:8,bottomPadding:8},(S3||(S3={})).defaultData={opacity:1,fill:{color:Gr.fromHexAndA(Ja,1),enabled:!0},stroke:{color:Gr.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:Gr.from0to1([0,0,0,1]),enabled:!1,spread:0},innerShadow:{offset:[10,10],blurRadius:10,color:Gr.from0to1([0,0,0,1]),enabled:!1,spread:0}},(t=ny||(ny={})).newEmpty=function(r,n){return{name:n}},t.patch=function(r,n){if(n===void 0)return r;let s={...r};return Object.assign(s,w3.merge(s,n)),s=function(a,o){if(o===void 0)return a;let l={...a},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}(s,n),s=function(a,o){if(o===void 0)return a;let l={...a};return"fill"in l&&"fill"in o&&o.fill!==void 0&&Object.assign(l,{fill:{...l.fill,...o.fill}}),"stroke"in l&&"stroke"in o&&o.stroke!==void 0&&Object.assign(l,{stroke:{...l.stroke,...o.stroke}}),"layerBlur"in l&&"layerBlur"in o&&o.layerBlur!==void 0&&Object.assign(l,{layerBlur:{...l.layerBlur,...o.layerBlur}}),"backgroundBlur"in l&&"backgroundBlur"in o&&o.backgroundBlur!==void 0&&Object.assign(l,{backgroundBlur:{...l.backgroundBlur,...o.backgroundBlur}}),"dropShadow"in l&&"dropShadow"in o&&o.dropShadow!==void 0&&Object.assign(l,{dropShadow:{...l.dropShadow,...o.dropShadow}}),"innerShadow"in l&&"innerShadow"in o&&o.innerShadow!==void 0&&Object.assign(l,{innerShadow:{...l.innerShadow,...o.innerShadow}}),l}(s,n),s},t.toOps=function(r,n){let s,a=[];for(let[o,l]of Object.entries(n))o!=="name"&&(s===void 0&&(s={path:[],props:{},type:0},a.push(s)),s.props[o]=l);return a},(VS||(VS={})).defaultData={...w3.defaultData,...c5.defaultData,states:new Ct,events:new Ct,visible:!0,raycastLock:!1},(Y1||(Y1={})).defaultData={...VS.defaultData,...S3.defaultData},(T3||(T3={})).defaultData={cornerRadius:[0,0,0,0]},(p5||(p5={})).defaultData={...Y1.defaultData,type:"ellipse2d",width:100,height:100,name:"Ellipse"},(GI||(GI={})).defaultData={...Y1.defaultData,...T3.defaultData,type:"rectangle2d",width:100,height:100,name:"Rectangle"},(f5||(f5={})).defaultData={...Y1.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"},(m5||(m5={})).defaultData={...Y1.defaultData,type:"path2d",path:"",name:"Path"},(_ie||(_ie={})).is=function(r){return r.type==="ellipse2d"||r.type==="rectangle2d"||r.type==="text2d"||r.type==="vector2d"||r.type==="path2d"},(jI||(jI={})).defaultData={...VS.defaultData,name:"Group",type:"group2d"},(g5||(g5={})).defaultData=()=>({...VS.defaultData,...T3.defaultData,...S3.defaultData,name:"Frame",type:"frame2d",clipped:!0,width:200,height:200,fill:{color:Gr.fromHexAndA(4737101,1),enabled:!0},stroke:{color:Gr.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{...GI.defaultData};case"ellipse2d":return{...p5.defaultData};case"text2d":return{...f5.defaultData};case"path2d":return{...m5.defaultData};case"frame2d":return{...g5.defaultData()};case"group2d":return{...jI.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=cH||(cH={})).defaultData={name:"UI",type:"scene2d",objects:new Aa},i.emptyData=function(){return{type:"scene2d",objects:new Aa}}}),cxe=U(()=>{g4e(),v4e(),cbe(),pbe(),Abe(),hbe(),ybe(),_be(),wbe(),SY(),_B(),Ebe(),wY(),xY(),fbe(),ZA(),vbe(),Tbe(),th(),vB(),gB(),Fbe(),MY(),xbe(),AY(),EY(),_4e(),bbe(),PY(),TY(),mbe(),gbe(),H4e()});function sy(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)),s={},a={},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;s[p]===void 0&&(s[p]=[]),s[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;a[p]===void 0&&(a[p]=[]),a[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 f=0;f<p.count;++f)d.push(p.getX(f)+u);u+=e[c].attributes.position.count}l.setIndex(d)}for(let u in s){let d=bie(s[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 a){let d=a[u][0].length;if(d!==0){l.morphAttributes=l.morphAttributes||{},l.morphAttributes[u]=[];for(let c=0;c<d;++c){let p=[];for(let m=0;m<a[u].length;++m)p.push(a[u][m][c]);let f=bie(p);if(!f)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+u+" morphAttribute."),null;l.morphAttributes[u].push(f)}}}return l}function bie(e){let t,i,r,n=-1,s=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;s+=u.count*i}let a=new t(s),o=new Dt(a,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 f=0;f<i;f++){let m=u.getComponent(c,f);o.setComponent(c+d,f,m)}}else a.set(u.array,l);l+=u.count*i}return n!==void 0&&(o.gpuType=n),o}var JA=U(()=>{ae()});function pxe(e){let t=e.points.length/7,i=new Ct;for(let r=0;r<t;r++){let n=7*r,s=e.points[n+0],a=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:et.generateUUID(),data:{roundness:d,position:[s,a],areControlsDirectionsMirrored:!0,controlPrevious:{position:[o,l]},controlNext:{position:[h,u]}}})}return{points:i,isClosed:e.isClosed,roundness:e.roundness,shapeHoles:e.shapeHoles?.map(r=>pxe(r))??[]}}function fxe(e){let{userData:t,uuid:i,...r}=e;if(t===void 0||t.type==="NonParametricGeometry")return function(a){let o,{userData:l,data:h}=a,u=h?.groups,d=h?.attributes??{},c=h?.morphAttributes??{},p=h?.interleavedBuffers,f=h?.arrayBuffers,m=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 T=0;T<v.length;T+=3){let M=v[T],E=v[T+1],A=v[T+2];y=Math.min(y,M),_=Math.min(_,E),b=Math.min(b,A),x=Math.max(x,M),w=Math.max(w,E),S=Math.max(S,A)}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:f},...o===void 0?{}:o,type:"NonParametricGeometry"};return m!==void 0&&Object.assign(g.data,{index:m}),u!==void 0&&Object.assign(g.data,{groups:u.map(v=>({...v,materialIndex:v.materialIndex??0}))}),g}(e);if(t.type==="SubdivGeometry"){let a="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 Wf(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,T=Object.keys(v.attributes),M={},E={},A=[],P=["getX","getY","getZ","getW"],N=["setX","setY","setZ","setW"];for(let j=0,K=T.length;j<K;j++){let $=T[j],Q=v.attributes[$];M[$]=new Q.constructor(new Q.array.constructor(Q.count*Q.itemSize),Q.itemSize,Q.normalized);let ce=v.morphAttributes[$];ce&&(E[$]||(E[$]=[]),ce.forEach((pe,ye)=>{let we=new pe.array.constructor(pe.count*pe.itemSize);E[$][ye]=new pe.constructor(we,pe.itemSize,pe.normalized)}))}let D=.5*y,O=Math.log10(1/y),z=Math.pow(10,O),B=D*z;for(let j=0;j<w;j++){let K=b?b.getX(j):j,$="";for(let Q=0,ce=T.length;Q<ce;Q++){let pe=T[Q],ye=v.getAttribute(pe),we=ye.itemSize;for(let ne=0;ne<we;ne++)$+=~~(ye[P[ne]](K)*z+B)+","}if($ in _)A.push(_[$]);else{for(let Q=0,ce=T.length;Q<ce;Q++){let pe=T[Q],ye=v.getAttribute(pe),we=v.morphAttributes[pe],ne=ye.itemSize,Se=M[pe],W=E[pe];for(let k=0;k<ne;k++){let Y=P[k],ie=N[k];if(Se[ie](S,ye[Y](K)),we)for(let G=0,oe=we.length;G<oe;G++)W[G][ie](S,we[G][Y](K))}}_[$]=S,A.push(S),S++}}let V=v.clone();for(let j in v.attributes){let K=M[j];if(V.setAttribute(j,new K.constructor(K.array.slice(0,S*K.itemSize),K.itemSize,K.normalized)),j in E)for(let $=0;$<E[j].length;$++){let Q=E[j][$];V.morphAttributes[j][$]=new Q.constructor(Q.array.slice(0,S*Q.itemSize),Q.itemSize,Q.normalized)}}return V.setIndex(A),V}(h),f=[],m=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]?(m[d[v]]++,f.push(...new Set(g.slice(3*v,3*v+6))),v+=2):(f.push(...g.slice(3*v,3*v+3)),v++);o.indexWASM={array:f},o.positionWASM=p.attributes.position,o.verticesPerFaceWASM={array:m}}if(o?.positionWASM===void 0||o?.positionWASM.length===0||o?.indexWASM===void 0||o?.indexWASM.length===0||o?.verticesPerFaceWASM===void 0||o?.verticesPerFaceWASM.length===0)return null;let l={type:a,...q4e(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,s=t.parameters;return n==="VectorGeometry"?(s.extrudeDepth&&(s.depth=s.extrudeDepth),{...s,width:100,height:100,shape:pxe(t.shape),type:n}):n==="LatheGeometry"?{...t.parameters,type:n,points:(t?.parameters.points??[]).map(a=>[a.x,a.y])}:(s.extrudeDepth&&(s.depth=s.extrudeDepth),{...s,type:n})}function q4e(e){return pH.setFromArray(e),pH.getSize(VM),{width:VM.x,height:VM.y,depth:VM.z}}var pH,VM,v5,$4e=U(()=>{Or(),ae(),JA(),new Ue,new jt,new Dr,new R,new R,pH=new pn,VM=new R}),X4e=U(()=>{var e;(e=v5||{}).view="view",e.edit="edit",((v5=e)||(v5={})).canWrite=function(t){return t!=="view"},class extends Error{constructor(t,i){super(`This is a ${t.toUpperCase()} document, but it was opened as a ${i.toUpperCase()} one`),this.actual=t,this.expected=i,this.name="DocumentKindMismatchError"}}}),mxe,Kf,LE,gxe,OY,ww,GS,M3,y5,Sw,xie,_5,wie,b5,aw,mm,gm,up,x5,Sie,Tie,w5,fH,Cf,vxe=U(()=>{X4e()}),Y4e=U(()=>{}),K4e=U(()=>{Or(),_B(),vxe()}),Z4e=U(()=>{ZA(),[...mB],new Set(_Y)}),zt=U(()=>{cxe(),Y4e(),w4e(),_B(),K4e(),vxe(),CY(),Z4e(),PY(),Or()}),Pd=U(()=>{mxe=[3,4,8,9],Kf=5,LE=3,gxe=32,OY=.98}),eC=U(()=>{ae(),ww=e=>{var t;return(t=class extends e{}).geometryHelper=new Ih(30,30,30),t}}),tC=U(()=>{ae(),GS=new xf,M3=new Ha,y5=new Ue,Sw=(e,t,i,r,n=!1,s=e)=>{let a=t,o=s.matrixWorld;if(a.boundingSphere===null&&a.computeBoundingSphere(),M3.copy(a.boundingSphere),M3.applyMatrix4(o),i.ray.intersectsSphere(M3)===!1||(y5.copy(o).invert(),GS.copy(i.ray).applyMatrix4(y5),a.boundingBox!==null&&GS.intersectsBox(a.boundingBox)===!1))return;let l,h,u,d,c,p,f=a.index,m=a.attributes.position,g=a.drawRange;if(n===!1){for(c=Math.max(0,g.start),p=Math.min(f.count,g.start+g.count);c<p;c+=3)if(h=f.getX(c),u=f.getX(c+1),d=f.getX(c+2),l=v(e,i,GS,m,h,u,d),l)return l.faceIndex=Math.floor(c/3),void r.push(l)}else{let y=a.attributes.position,_=new R,b=new R,x=new R,w=new R,S=2,T=1/((s.scale.x+s.scale.y+s.scale.z)/3),M=T*T;for(let E=Math.max(0,g.start),A=Math.min(y.count,g.start+g.count)-1;E<A;E+=S){if(_.fromBufferAttribute(y,E),b.fromBufferAttribute(y,E+1),GS.distanceSqToSegment(_,b,w,x)>M)continue;w.applyMatrix4(s.matrixWorld);let P=i.ray.origin.distanceTo(w);P<i.near||P>i.far||r.push({distance:P,point:x.clone().applyMatrix4(s.matrixWorld),object:e})}}function v(y,_,b,x,w,S,T){let M=new R,E=new R,A=new R,P=new R,N=new R;if(M.fromBufferAttribute(x,w),E.fromBufferAttribute(x,S),A.fromBufferAttribute(x,T),b.intersectTriangle(M,E,A,!1,P)===null)return null;N.copy(P),N.applyMatrix4(y.matrixWorld);let D=_.ray.origin.distanceTo(N);return D<_.near||D>_.far?null:{faceIndex:1,distance:D,point:N.clone(),object:y}}}}),bB=U(()=>{ae(),eC(),tC(),xie=new R(1,1,1),_5=new R,wie=new R,b5=new jt,aw=class extends ww(u_e){constructor(e,t=15){super(t),this.object=e,this.dummy=new bw,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){Sw(this.object,aw.geometryHelper,e,t,!1,this.dummy)}update(){}updateMatrix(){}updateMatrixWorld(e){this.object.matrixWorld.decompose(_5,b5,wie),this.matrix.compose(_5,b5,xie),super.updateMatrixWorld(e)}updateWorldMatrix(e,t){}}}),Q4e=U(()=>{ae(),mm=new R,gm=new R,up=new Ue,x5=[new R(-1,1,1),new R(-1,-1,1),new R(1,-1,1),new R(1,1,1),new R(-1,1,-1),new R(-1,-1,-1),new R(1,-1,-1),new R(1,1,-1)],Sie=[[0,3],[1,2],[5,6],[4,7],[0,1],[3,2],[7,6],[4,5],[0,4],[1,5],[2,6],[3,7]],Tie=[[0,2],[7,5],[4,1],[3,6],[4,3],[1,6]],w5=(e,t,i)=>{e.updateEntityBoxSize(mm,gm),up.copy(t).multiply(e.matrixWorld),gm.x===0&&gm.y===0&&gm.z===0?i.push(new R(mm.x,mm.y,mm.z).applyMatrix4(up)):x5.forEach(r=>{i.push(r.clone().multiply(gm).add(mm).applyMatrix4(up))})},fH=class extends pn{constructor(){super(...arguments),this.matrix=new Ue,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 Ue().copy(e.matrixWorld).invert();return this.expandByObjectSize(e,i,t)}expandByObjectSize(e,t,i=!1){let r=[];if(i===!0){let n=[];e.traverseEntity(s=>{if(s.visible||s.cloner&&s.data.visible){if(!("geometry"in s))return up.copy(t).multiply(s.matrixWorld),void n.push(new R().applyMatrix4(up));w5(s,t,r)}}),r.length===0&&r.push(...n)}else w5(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(gm).multiplyScalar(.5),this.getCenter(mm),up.copy(this.matrix).setPosition(mm),this.vertices=x5.map(e=>e.clone().multiply(gm).applyMatrix4(up))}computeEdges(){this.vertices.length>0&&this.computeVertices(),this.edges=Sie.map(([e,t])=>new Ch(this.vertices[e],this.vertices[t])),this.centerEdges=this.edges.map(e=>e.getCenter(new R))}computeFaces(){this.vertices.length>0&&this.computeVertices(),this.faces=Tie.map(([e,t])=>this.vertices[e].clone().add(this.vertices[t]).multiplyScalar(.5))}}}),XL=U(()=>{Cf={Cloner:null,changeEntityProptotype:()=>{},createEntity:()=>{}}});function BE(e){return e?.isParticleSystem===!0}function s1(e){return e?.isHairSystem===!0}function Zf(e){return e?.isShapeBlendEntity===!0}function xB(e){return e?.isPathObject===!0}function Jl(e){return e?.isObject2D===!0}function $o(e){return e?.isUIObject===!0}function Lg(e){return e?.isCloner===!0}function Bg(e){return e?.isClone===!0}function WI(e){return e?.isComponentObject===!0}var Zn=U(()=>{});function In(e){LY.add(e)}function Ta(e,t){let i=`${e}:${t}`;vH.has(i)||vH.add(i)}function YL(e,t){BY.set(e,t)}function S5(e){return BY.get(e)}function Tw(e,t){FY.set(e,t)}function T5(e){return FY.get(e)}function mH(e,t){UY.set(e,t)}function yxe(e){return UY.get(e)}function gH(){return wB}var LY,vH,BY,FY,UY,wB,KL,_r=U(()=>{LY=new Set,vH=new Set,BY=new Map,FY=new Map,UY=new Map,wB=null,KL=null});function _xe(e,t,i,r,n=new Ue){return n.compose(e,t,bxe).multiply(i).scale(r)}var bxe,M5,ay,SB,Mw=U(()=>{ae(),yB(),bxe=new R(1,1,1),M5=new Ue,(ay||(ay={})).is=function(e){return e&&e.__isSPEObject},SB=e=>class extends e{constructor(){super(...arguments),this.previousModelViewMatrix=new Ue,this.copyPreviousMatrix=!0,this.pivotMatrix=new Ue,this.matrixWorldRigid=new Ue,this.shearScale=new Ue,this.shearScaleInv=new Ue,this.shearMatrix=new Ue}get __isSPEObject(){return!0}getPhysicsLocalMatrix(t){return!!this.rigidBody?.isDynamic()&&(t.copy(this.matrixWorld),this.hasNonUniformScale&&t.multiply(this.shearScaleInv),this.parent&&t.premultiply(M5.copy(this.parent.matrixWorld).invert()),t.multiply(M5.copy(this.pivotMatrix).invert()),!0)}isDescendantOf(t){t instanceof hn&&(t=t.uuid);let i=this;for(;i.parent;){if(i.parent.uuid===t)return!0;i=i.parent}return!1}updateMatrix(){!this.shearMatrix||(_xe(this.position,this.quaternion,this.shearMatrix,this.scale,this.matrix),this.matrixWorldNeedsUpdate=!0)}updateMatrixWorld(t){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||t)&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.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.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.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)ay.is(r)&&r.traverseObject(t,i+1)}traverseObject(t,i=0){if(t(this,i)!==!0)for(let r of this.children)ay.is(r)&&r.traverseObject(t,i+1)}updateMatrixWorldRigid(){this.hasNonUniformScale=Dbe(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 Ue().copy(this.matrixWorld).invert();return t.parent!==null&&(t.parent.updateWorldMatrix(!0,!1),r.multiply(t.parent.matrixWorld)),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}onAfterRender(t,i,r,n,s,a){this.copyPreviousMatrix&&this.previousModelViewMatrix.copy(this.modelViewMatrix)}}});function Mie(e,t,i){return Mg.subVectors(t,e),RA.subVectors(t,i),Mg.cross(RA).length()<=FE}function xxe(e){let t=bH.get(e.points);if(t!==void 0&&t.isClosed===e.isClosed)return t.curve;let i=function(r){let n=r.points,s=[n[0]],a=[new R(...n[0].data.position)];zv.copy(a[0]);for(let v=0;v<n.length-1;v++)Mg.fromArray(n[v].data.position),RA.fromArray(n[v+1].data.position),Ob.subVectors(Mg,zv),Lb.subVectors(Mg,RA),Ob.cross(Lb).length()>FE&&(s.push(n[v]),a.push(new R().copy(Mg)),zv.copy(Mg));let o=n[n.length-1];s.push(o),a.push(new R(...o.data.position));let l=r.isClosed,h=s.length-(l?0:1),u=s.length,d=[],c=[];for(let v=0;v<u;v++){let y=s[v].data;d.push(new R(...y.controlPrevious.position)),c.push(new R(...y.controlNext.position))}let p=[];for(let v=0;v<h;v++){let y=v===u-1?0:v+1;p.push(Mie(a[v],c[v],a[y])&&Mie(a[v],d[y],a[y]))}let f=[];for(let v=0;v<u;v++){let y=s[v].data,_=a[v],b={position:_,prevDir:void 0,nextDir:void 0,controlPrevious:d[v],controlNext:c[v],tan:void 0,baseRoundness:y.roundness,removedLength:0};if(f.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 R().subVectors(a[x],_).normalize(),T=new R().subVectors(a[w],_).normalize();b.prevDir=S,b.nextDir=T;let M=p[l&&v===0?u-1:v-1],E=p[v];if(M&&E){kv.addVectors(S,T).normalize();let A=zv.crossVectors(kv,S).length()/S.dot(kv);b.tan=A,b.removedLength=y.roundness/A}}for(let v=0;v<h;v++){let y=l&&v===u-1?0:v+1,_=f[v],b=f[y];if(_.removedLength!==0||b.removedLength!==0){let x=_.position.distanceTo(b.position);_.removedLength=Math.min(_.removedLength,x/2),b.removedLength=Math.min(b.removedLength,x/2)}}let m=new Array(2*u).fill(null);for(let v=0;v<h;v++){let y=l&&v===u-1?0:v+1,_=f[v],b=f[y],x=null;if(p[v]){let w=_.position.clone(),S=b.position.clone();(_.removedLength!==0||b.removedLength!==0)&&(_.nextDir&&w.add(zv.copy(_.nextDir).setLength(_.removedLength)),b.prevDir&&S.add(zv.copy(b.prevDir).setLength(b.removedLength))),w.distanceTo(S)>FE&&(x=new AE(w,w.clone().lerp(S,.3),S.clone().lerp(w,.3),S))}else _.position.distanceTo(b.position)>FE&&(x=new AE(_.position,_.controlNext,b.controlPrevious,b.position));m[2*v+1]=x}for(let v=0;v<u;v++){let y=f[v];if(y.removedLength===0)continue;let _=y.position,b=y.prevDir.clone().multiplyScalar(y.removedLength).add(_),x=y.nextDir.clone().multiplyScalar(y.removedLength).add(_),w=y.tan*y.removedLength;kv.addVectors(y.prevDir,y.nextDir).normalize(),Ob.copy(b).lerp(x,.5);let S=b.distanceTo(x)/2;_H.copy(kv).multiplyScalar(Math.sqrt(Math.pow(w,2)-Math.pow(S,2))).add(Ob),HI.copy(kv).multiplyScalar(-w).add(_H);let T=_.distanceTo(HI)/_.distanceTo(Ob);Lb.copy(y.prevDir).multiplyScalar(T*_.distanceTo(b)).add(_),yH.copy(Lb).lerp(HI,2);let M=b.clone().lerp(Lb,4/3),E=x.clone().lerp(yH,4/3);m[2*v]=new AE(b,M,E,x)}let g=new wxe;for(let v=0;v<m.length;v++){let y=m[v];y&&g.add(y)}return g}(e);return bH.set(e.points,{isClosed:e.isClosed,curve:i}),i}var wxe,FE,Mg,RA,zv,kv,Ob,HI,Lb,yH,_H,bH,Bb,xH,qI,Sxe,Txe,Mxe,nr,wc,Eie,Aie,jS,E5,E3,A5,C5,TB,wH,c1,Pc,Exe=U(()=>{ae(),wxe=class extends oW{constructor(){super()}getPoints(e=12){let t,i=[],r=this.getCurveLengths(),n=r[r.length-1]/r.length;for(let s=0,a=this.curves;s<a.length;s++){let o=a[s],l=s===0?r[s]:r[s]-r[s-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}},FE=.001,Mg=new R,RA=new R,zv=new R,kv=new R,Ob=new R,HI=new R,Lb=new R,yH=new R,_H=new R,bH=new WeakMap}),J4e=U(()=>{ae(),Bb=new Ue,xH=new jt,qI=new jt,Sxe=new Dr,Txe=new R,Mxe=new R(0,1,0)}),wl=U(()=>{ae(),zt(),Q4e(),Or(),XL(),Zn(),_r(),Mw(),Exe(),J4e(),jr(),(nr||(nr={})).is=function(e){return e&&e.__isEntity},wc=e=>nr.is(e),Eie={type:"completeState",isfromEntity:!0},Aie=["x","y","z"],jS=new R,E5=new R(1,1,1),E3=new jt,A5=new Dr,C5=new Ue,TB=e=>class extends SB(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.transitionState={settled:!0,state:null},this.currentTransitionEvent=null,this.previousAction=null,this._singleBBox=new fH,this._recursiveBBox=new fH,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(nr.is(i))return i}entityChildrenCount(){let t=this.children.length;for(;t--;)if(nr.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(!nr.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)Og.toOps(this.data,n.data).forEach(s=>{let a=TL.replaceProps(s,this.data);this.dataPatched=this.data,this.updateByPatchedOp(a,this.data,i)});if(t!==null){let n=this.data.states.data(t);n&&(this.dataPatched=Og.patch(this.data,n),Og.toOps(this.data,n).forEach(s=>{this.updateByPatchedOp(s,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=>{wc(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(nr.is(i[r]))return i[r];if(nr.is(t))return t.traverseSortNextHelper()}}sortNext(){let t=this.children;return this.children.length>0&&nr.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)wc(i)&&t(i)}traverseEntityAncestors(t){this.traverseAncestors(i=>{nr.is(i)&&t(i)})}traverseConcreteEntity(t,i=0){if(t(this,i)!==!0)for(let r of this.children)wc(r)&&r.isConcreteEntity&&r.traverseEntity(t,i+1)}traverseEntity(t,i=0){if(t(this,i)!==!0)for(let r of this.children)wc(r)&&r.traverseEntity(t,i+1)}traverseVisibleEntity(t){t(this);for(let i of this.children)wc(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}hasEntityChild(){return this.children.some(t=>wc(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),RW({position:this.position.toArray(),rotation:[this.rotation.x*et.RAD2DEG,this.rotation.y*et.RAD2DEG,this.rotation.z*et.RAD2DEG],scale:this.scale.toArray(),shear:Dh.fromMatrix(this.shearMatrix.toArray()),pivot:[0,0,0],pivotRotation:[0,0,0]},t)}getTransformValues(t,i,r){return i[t].map((n,s)=>r?.shared.getVariable(n,[this.uuid,t,Aie[s]])??n)}updateTransformState(t,i){let r=!1;if(t.position&&(this.position.fromArray(this.getTransformValues("position",t,i)),r=!0),t.rotation&&(jS.fromArray(this.getTransformValues("rotation",t,i)).multiplyScalar(et.DEG2RAD),this.rotation.setFromVector3(jS),r=!0),t.scale&&(this.scale.fromArray(this.getTransformValues("scale",t,i)),r=!0),t.shear&&(this.shearMatrix.fromArray(Dh.toMatrix(t.shear)),r=!0),t.pivot!==void 0||t.pivotRotation!==void 0){if(r=!0,t.pivot!==void 0&&t.pivotRotation!==void 0)this.pivotMatrix.compose(jS.fromArray(t.pivot).negate(),E3.setFromEuler(A5.fromArray(t.pivotRotation.map(n=>n*et.DEG2RAD))).invert(),E5);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=jS.setFromMatrixPosition(this.pivotMatrix);E3.setFromEuler(A5.fromArray(t.pivotRotation.map(s=>s*et.DEG2RAD))).invert(),this.pivotMatrix.compose(n,E3,E5)}}return r&&(this.updateMatrix(),this.resetBBoxNeedsUpdate(),this.invalidateClonerTransform(this),this.traverseEntityAncestors(n=>{n.invalidateClonerTransform(this)})),t.position&&t.rotation&&t.scale&&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)nr.is(t)&&t.disposeRecursively()}disposeRecursively(){this.dispose(),this.children.forEach(t=>{nr.is(t)&&t.disposeRecursively()})}toState(t=[]){return RW({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 s=this.data;this.data=i;let a=t,o=Jr(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=Sa.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])}}a={...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=Sa.removeOverridden(t.path,t.props,l);a={...t,props:h}}}if(this.updateByPatchedOpBase(a,Og.patch(this.data,this.stateSelection?this.data.states.data(this.stateSelection):void 0),r),Jr(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(Gg.apply(d.component.data,d.overrideData),r))}}else{let u=r.scene.findInstance([this.uuid,...l]);if(u){let d=Sa.zoom(u.component.data,h);if((t={...t,path:h}).type===0){let c=t.props;if(d)for(let[p,f]of Object.entries(t.props))f===void 0&&(c===t.props&&(c={...t.props}),c[p]=d[p]);t={...t,props:c}}u.overrideData=WL.resolve(i.overrides,l),u.updateByOp(t,$a.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 Mf.rootOverrideProps)u in t.props&&(h===void 0&&(h={}),h[u]=t.props[u]);h&&(l={...t,props:h})}else for(let h of Mf.rootOverrideProps)if(Jr(t.path,[h])){l=t;break}l!==void 0&&this.instances.forEach(h=>{if(h.isInstanceRoot){let u=Gg.filterOp(h.overrideData,l);u&&h.updateByOp(u,$a.applySimple(h.data,u),r,!0)}}),this.instances.forEach(h=>{if(!h.isInstanceRoot){let u=Gg.filterOp(h.overrideData,t);if(u){let d;d=s===h.data&&t===u?i:$a.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&&!r1.is(t.props.type)&&Cf.changeEntityProptotype(this,this.data,r);else if(t.path.length===1&&t.path[0]==="geometry"&&t.type===0&&"type"in t.props){Cf.changeEntityProptotype(this,this.data,r);for(let n of this.children)nr.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(Jr(t.path,["pathSnapping"])!==null&&(this.updatePathSnapping(i.pathSnapping),this.isVirtualEntity&&r.scene?.syncInstancePathConstraint(this)),Jr(t.path,["cloner"])!==null){let n=$a.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,s=this._updatedPathSnapping?.orientation??this.dataPatched.pathSnapping.orientation;if(i===null)return;let a=t.find(this.isVirtualEntity&&t.pathConstraints.getConstraint(this.uuid)||i);if(!a)return;this._needApplyPathSnapping=!1;let o=a.data;if(o.geometry.path.points.length<=1)return;let l=xxe(o.geometry.path),h=function(p){let f=p%1;return f<0?f+1:f===0&&p>0?1:f}(r+n),u=null;try{u=l.curves.length?l.getPointAt(h):null}catch{}if(u===null)return;a.updateMatrixWorld();let d=this.parent?C5.copy(this.parent.matrixWorld):C5.identity(),c=function(p,f,m,g){xH.setFromRotationMatrix(Bb.extractRotation(g));let v=p.clone().applyMatrix4(Bb.copy(g).invert().multiply(m));if(f===null)qI.setFromRotationMatrix(Bb.extractRotation(m));else{let y=f.clone().applyMatrix4(Bb.extractRotation(m));qI.setFromRotationMatrix(Bb.lookAt(Txe.set(0,0,0),y,Mxe))}return{position:v,rotation:new R().setFromEuler(Sxe.setFromQuaternion(xH.invert().multiply(qI))).multiplyScalar(et.RAD2DEG)}}(u,s==="tangential"?l.getTangentAt(h):null,a.matrixWorld,d);this.updateTransformState({position:c.position.toArray(),rotation:c.rotation.toArray()}),this.traverseEntity(p=>{p._cameraType&&p.dispatchEvent(Eie)})}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=>Lg(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(Cf.Cloner===null)return void Ta("cloners","a cloner");this.cloner=new Cf.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"})}}}),p1=U(()=>{ae(),wl(),(wH||(wH={})).is=e=>"objectHelper"in e,c1=(e,t)=>class extends TB(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 xA&&(r.visible=!0)}}updateEntityBoxSize(i,r){this.objectHelper.visible&&this.geometryHelper instanceof Ih?(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 xA&&(r.visible=!1)}}}}),MB=U(()=>{ae(),bB(),p1(),Pc=class extends c1(bw,aw){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 Iu(e,t,i,r,n,s,a){GM.set(n,s,a).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],GM.x,GM.y,GM.z)}}var GM,ah,Cie,Axe,eBe=U(()=>{ae(),eC(),tC(),GM=new R,ah=new Pg,Cie=class extends Cb{constructor(e){let t=new At,i=new ld({color:16777215,vertexColors:!0,toneMapped:!1}),r=[],n=[],s={},a=new lt(15711266),o=new lt(15711266),l=new lt(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),s[d]===void 0&&(s[d]=[]),s[d].push(r.length/3-1)}h("n1","n2",a),h("n2","n4",a),h("n4","n3",a),h("n3","n1",a),h("f1","f2",a),h("f2","f4",a),h("f4","f3",a),h("f3","f1",a),h("n1","f1",a),h("n2","f2",a),h("n3","f3",a),h("n4","f4",a),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=s,this.update()}update(){let e=this.geometry,t=this.pointMap;ah.projectionMatrixInverse.elements=[.5112609807824982,-0,-0,-0,-0,.41421356237309503,-0,-0,-0,-0,-0,-.099999,-0,-0,-1.0000000000000002,.100001];let i=.8;Iu("n1",t,e,ah,-1,-1,i),Iu("n2",t,e,ah,1,-1,i),Iu("n3",t,e,ah,-1,1,i),Iu("n4",t,e,ah,1,1,i);let r=i;Iu("f1",t,e,ah,-1,-1,r),Iu("f2",t,e,ah,1,-1,r),Iu("f3",t,e,ah,-1,1,r),Iu("f4",t,e,ah,1,1,r);let n=r;Iu("u1",t,e,ah,.35,1.1,n),Iu("u2",t,e,ah,-.35,1.1,n),Iu("u3",t,e,ah,0,1.55,n),e.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}},Axe=class extends ww(Cie){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){Sw(this.object,this.geometry,e,t,!0)}}});function Pie(e){return 1-Math.pow(1-e,3)}var L0,A3,C3,P3,K1,R3,qd,Qn,Oh=U(()=>{ae(),eBe(),zt(),p1(),jr(),L0=new R,A3=new R,C3=new jt,P3=new R,K1=new R,R3=new R,qd=class extends c1(Pg,Axe){constructor(e="",t={...IE.defaultData,name:""}){super(),this._cameraType="OrthographicCamera",this.targetOffset=Tf.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 s=qd.projectionTransitionRequestRender??n.requestRender;this.updateProjectionMatrix(),s?.()},this.super_Entity(e,t),this.previousProjectionMatrix=new Ue,this.matrixAutoUpdate=!0,this.width=window.innerWidth,this.height=window.innerHeight;let i=this.width,r=this.height;this.orthoCamera=new Zg(-.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=qd.projectionTransitionsEnabled;qd.projectionTransitionsEnabled=!1;try{return e()}finally{qd.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 R(e,t,i)),super.lookAt(e),this.getWorldPosition(L0),this.targetOffset=L0.distanceTo(e)}getTarget(e=new R){return this.getWorldDirection(A3),this.getWorldPosition(L0),A3.multiplyScalar(this.targetOffset),e.copy(L0).add(A3),e}getDistanceToTarget(){let e=this.getTarget();return this.getWorldPosition(L0),L0.distanceTo(e)}updateUp(){this.getWorldQuaternion(C3),P3.set(0,0,1).applyQuaternion(C3),K1.copy(hn.DEFAULT_UP),this.isUpVectorFlipped&&K1.negate(),K1.applyQuaternion(C3),R3.copy(hn.DEFAULT_UP).projectOnPlane(P3),this.angleOffsetFromUp=R3.angleTo(K1),this.angleOffsetFromUp*=R3.cross(K1).dot(P3)>=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 R),i=e.getWorldDirection(new R).multiplyScalar(this.targetOffset);return{position:t.clone().add(i),target:t}}getViewToTarget(e){let t=this.getWorldDirection(new R).multiplyScalar(this.targetOffset);return{position:e.clone().sub(t),target:e}}getViewToObject(e){let t=new R;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:Pie(t)}get _activeSubCamera(){return this._cameraType==="PerspectiveCamera"?this.perspCamera:this.orthoCamera}_canAnimateProjection(){return qd.projectionTransitionsEnabled&&typeof requestAnimationFrame=="function"&&typeof performance<"u"&&performance.now()-this._createdAt>=qd.projectionTransitionMinAgeMs}_beginProjectionTransition(e){let t=this._projectionTransition;t===void 0&&(t={from:new Ue,blend:new Ue,blendInverse:new Ue,start:0,duration:qd.projectionTransitionDuration,referenceDepth:1,raf:0,requestRender:e},this._projectionTransition=t),t.from.copy(this.projectionMatrix),t.start=performance.now(),t.duration=qd.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=Pie(t),r=e.from.elements,n=this._activeSubCamera.projectionMatrix.elements,s=e.blend.elements,a=e.referenceDepth,o=Math.max(1e-6,r[15]-r[11]*a),l=i*o/(i*o+(1-i)*Math.max(1e-6,n[15]-n[11]*a));for(let h=0;h<16;h++)s[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 Ue,blend:new Ue,blendInverse:new Ue,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,s){this._cameraType==="PerspectiveCamera"?this.perspCamera.setViewOffset(e,t,i,r,n,s):this.orthoCamera.setViewOffset(e,t,i,r,n,s),this._applyProjectionTransition()}clearViewOffset(){this._cameraType==="PerspectiveCamera"?(this.perspCamera.clearViewOffset(),this.toPerspective()):(this.orthoCamera.clearViewOffset(),this.toOrthographic())}copyHistory(){this.previousProjectionMatrix&&this.previousProjectionMatrix.copy(this.projectionMatrix)}updateProjectionMatrix(){this._cameraType==="PerspectiveCamera"?this.toPerspective():this._cameraType==="OrthographicCamera"&&this.toOrthographic()}updateMatrixWorld(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=Tf.sanitizeTargetOffset(e.targetOffset),this.updateProjectionMatrix(),this._syncProjectionTransition(e),this}toCameraState(e=[]){return RW({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=Tf.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}}},(Qn=qd).projectionTransitionsEnabled=!1,Qn.projectionTransitionDuration=350,Qn.projectionTransitionMinAgeMs=1e3});function Cxe(e){return e.type==="TorusGeometry"&&e.arc===360}var Pxe,D3,SH,DA=U(()=>{ae(),Pxe=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),s=Math.abs(i.depth??r),a=Math.abs(Math.min(r,s))/2;return{parameters:Object.assign(i,{width:r,height:n,depth:s,radius:a,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:s,segments:a,pathRadius:o,pathType:l,pathSegments:h,cornerRadius:u,cornerSegments:d}=e.parameters,c=new SH(!1,t,i,r,n,s,a,o,l,h,u,d);return Object.assign(c,{userData:{...e,type:"HelixGeometry"}})}},D3=new Wf([0,0,0],1),SH=class extends At{constructor(e=!0,t=1,i=1,r=1,n=1,s=1,a=1,o=1,l=1,h=1,u=1,d=1){if(super(),s===0)return;let c=e&&s===1;c&&(d=0),u>100&&(u=100),u===0&&(d=0);let p,f,m,g,v,y,_,b,x=()=>new R,w=new R,S=x(),T=x(),M=x(),E=x(),A=x(),P=x(),N=x(),D=x(),O=x(),z=x(),B=x(),V=i-2*o+.001,j=V/s,K=Math.ceil(a*s),$=K+1,Q=V/K,ce=-V/2,pe=h+1,ye=2*Math.PI/h,we=Math.PI/2/d,ne=Math.min((1-u/100)*o,o-.01),Se=o-ne,W=0,k=2*d+2,Y=pe*k/2,ie=Y+pe*$,G=Math.max(0,pe*($+k)),[oe,se,H]=[3,3,2].map(pt=>Array(G*pt).fill(0)),me=[],xe=n-o;function ke(pt,it){let Yt=Math.PI/2;y=it*Q,b=2*Math.PI*(y%j)/j+Yt,y+=ce,_=Math.sin(b)*xe,v=Math.cos(b)*xe,e?pt.set(v,_,y):pt.set(v,y,_)}ke(w,-1e-10),ke(S,0),E.copy(w),ke(w,1);let Te=w.distanceTo(S),Ze=c?0:Se+ne,ze=Te*K+2*Ze,qe=ne,Ne=ze-Ze;for(let pt=0;pt<=K;pt++){ke(T,pt),B.subVectors(T,E).normalize(),E.copy(T),O.copy(T).setComponent(+e+1,0).normalize(),z.crossVectors(B,O).normalize();let it=pt===0,Yt=pt===K,ni=it?3*Math.PI/2:we,or=it?qe:Ne,St=it?pe:ie,It=it?0:G-pe,Qt=B.clone().multiplyScalar(it?-Se:Se).add(T),Ei=B.clone().multiplyScalar(it?-1:1).normalize();for(let xi=0;xi<pe;xi++){let mi=xi*ye;if(A.addVectors(w.copy(O).multiplyScalar(o*Math.cos(mi)),S.copy(z).multiplyScalar(o*Math.sin(mi))),P.copy(A).normalize(),it||Yt){c||(W=It+xi,[0,1,2].forEach(Ai=>{oe[3*W+Ai]=Qt.getComponent(Ai),se[3*W+Ai]=Ei.getComponent(Ai)}),H[2*W]=+Yt,H[2*W+1]=xi/h),S.copy(P).multiplyScalar(ne),M.addVectors(T,S);for(let Ai=0;Ai<d;Ai++){let Lr=Ai*we+ni;N.addVectors(w.copy(B).multiplyScalar(Se*Math.sin(Lr)),S.copy(P).multiplyScalar(Se*Math.cos(Lr))),D.copy(N).normalize(),S.addVectors(M,N),N.normalize(),W=St+Ai*pe+xi,[0,1,2].forEach(ir=>{oe[3*W+ir]=S.getComponent(ir),se[3*W+ir]=D.getComponent(ir)});let qr=+it+Math.sin(Lr);H[2*W]=(or+Se*qr)/ze,H[2*W+1]=xi/h}}S.addVectors(T,A),W=Y+pt*pe+xi,[0,1,2].forEach(Ai=>{oe[3*W+Ai]=S.getComponent(Ai),se[3*W+Ai]=P.getComponent(Ai)}),H[2*W]=(Ze+pt*Te)/ze,H[2*W+1]=xi/h}}let ee=$+2*d+2,[Ce,He]=[+c,ee-1];for(let pt=Ce;pt<=He-1;pt++){let it=c&&pt===He-1;for(let Yt=0;Yt<pe-1;Yt++)p=pt*pe+Yt,f=p+1,m=(it?Yt:p)+pe,g=(it?Yt+1:f)+pe,pt===0?me.push(f,g,m):pt===ee-2?me.push(p,f,m):me.push(p,f,m,f,g,m)}this.setIndex(me),this.setAttribute("position",new Et(oe,3)),this.setAttribute("normal",new Et(se,3)),this.setAttribute("uv",new Et(H,2))}getClosedTorusIndicesForBooleanOrSubdiv(){let e,t,i,r,n=this.userData.parameters,s=Math.ceil(n.tubularSegments),a=n.radialSegments,o=a+1,l=[];for(let h=1;h<s;h++)for(let u=0;u<a;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<a;h++)e=s*o+h,t=e+1,i=h+o,r=h+1+o,l.push(e,t,i,t,r,i);return D3.array=new Uint32Array(l),D3.count=l.length,D3}}});function tBe(e){return Die||(Die=async function(){let t=e??"https://cdn.spline.design/@splinetool/runtime@2.0.123/build",i=import("./boolean.js"),[r,n]=await Promise.all([i,fetch(`${t}/boolean.wasm`).then(s=>s.arrayBuffer())]);await r.default({module_or_path:n}),NA=r}())}function ZL(){if(NA===void 0)throw new Error("boolean-wasm is not loaded");return NA}function zY(e){let t=IA.get(e);if(t===void 0)throw new Error("Unknown csg mesh set handle "+e);return t}function kY(e){return IA.set(++TH,e),TH}function iBe(e,t,i){if(NA===void 0)return-1;let{positions:r,indices:n,normals:s}=function(a,o){if(o&&a.userData.positions!==void 0){let p=a.userData,f=[];for(let m=0,g=0;m<p.verticesPerFace.length;m++){let v=p.verticesPerFace[m];for(let y=1;y<v-1;y++)f.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(f)}}let l;l=Cxe(a.userData.parameters)?a.getClosedTorusIndicesForBooleanOrSubdiv():a.getIndex();let h,u=a.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=a.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 kY(new NA.CsgMesh(r,n,s))}function Rie(e,t){let i=ZL(),r=Dxe[t];if(r===void 0)throw new Error("Unknown boolean operation "+t);let n=e.map(zY);if(n.length===1)return i.clone_mesh(n[0]);let s,a=[];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),a.push(o);s=i.boolean_mesh(n[n.length-1],o,2)}else if(t===2)s=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),a.push(o),o.tri_count()!==0);l++);s=o,a.pop()}for(let o of a)o.free();return s}function P5(e,t){zY(e).transform(new Float32Array(t.elements))}function Rxe(e){let t=IA.get(e);t!==void 0&&(t.free(),IA.delete(e))}var NA,IA,TH,Die,Dxe,EB=U(()=>{ae(),DA(),IA=new Map,TH=0,Dxe={0:0,1:1,2:2}});function B0(e){return e!==null&&"booleanOp"in e}var MH,Nxe,rBe=U(()=>{ae(),wl(),EB(),MH=class extends TB(Tr){constructor(){super(...arguments),this.booleanMeshSetAddress=-1,this.booleanWasTransformed=!1,this.booleanMatrixInvOld=new Ue}updateVisible(e){super.updateVisible(e),this.visible=!B0(this.parent)&&this.visible,B0(this.parent)&&this.parent.invalidateDownstreamBooleanData()}onClonerLayoutUpdated(){B0(this.parent)&&this.invalidateDownstreamBooleanData()}freeBooleanPointer(){this.booleanMeshSetAddress!==-1&&(Rxe(this.booleanMeshSetAddress),this.booleanMeshSetAddress=-1)}dispose(){super.dispose(),this.freeBooleanPointer()}invalidateDownstreamBooleanData(e=!1){return e?this.booleanWasTransformed=!0:this.freeBooleanPointer(),B0(this.parent)?this.parent.invalidateDownstreamBooleanData():this}invalidateUpstreamBooleanData(){this.freeBooleanPointer();for(let e of this.children)e instanceof MH&&(e.freeBooleanPointer(),B0(e)&&e.invalidateUpstreamBooleanData())}updateTransformState(e,t){let i=super.updateTransformState(e,t);return i&&B0(this.parent)&&this.invalidateDownstreamBooleanData(!0),i}onVariableUpdate(e=!1){super.onVariableUpdate(e),B0(this.parent)&&this.invalidateDownstreamBooleanData(!0)}}}),nBe=U(()=>{Nxe=null});function VY(e,t=0,i=e.count,r,n){let s=1/0,a=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),f=e.getZ(d);c<s&&(s=c),p<a&&(a=p),f<o&&(o=f),c>l&&(l=c),p>h&&(h=p),f>u&&(u=f)}jM.min.set(s,a,o),jM.max.set(l,h,u),jM.getCenter(r),jM.getSize(n).multiplyScalar(.5)}var jM,Nie,Iie,Es,Na=U(()=>{ae(),rBe(),nBe(),jM=new pn,Nie=new At,Iie=new Ql,Es=class extends MH{constructor(e,t){super(Nie,Iie),this.super_Entity(e,t)}updateState(e,t){this.updateState_Entity(e,t)}raycast(e,t){if(this.raycastDeformed(e,t))return;let i=Nxe;i===null?super.raycast(e,t):i(this,e,t)}raycastDeformed(e,t){return!1}updateEntityBoxSize(e,t){let i=this.geometry.getAttribute("position");i!==void 0?VY(i,this.geometry.drawRange.start,this.geometry.drawRange.count<1/0?this.geometry.drawRange.count:i.count,e,t):super.updateEntityBoxSize(e,t)}}});function Ixe(e){return e?.isClassicNodeMaterial===!0}var kr,OA,Oxe,Lxe,UE,Bxe,Fxe,Uxe,zxe=U(()=>{}),Su=U(()=>{ae(),kr=class extends lt{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],s=i[2];switch(n){case"rgb":case"rgba":if(r=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))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(s))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}}}),kxe=U(()=>{Su(),OA=class extends kr{}}),sBe=U(()=>{Oxe=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}}}),Vxe=U(()=>{sBe(),Lxe=class extends Oxe{create(e){return URL.createObjectURL(new Blob([e]))}dispose(e,t){URL.revokeObjectURL(t)}}}),Gxe=U(()=>{Bxe=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}},Fxe=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}}}),aBe=U(()=>{ae(),Uxe=class extends e_e{constructor(e){super(e),this.type=di}parse(e){let t=function(p,f){switch(p){case 1:throw new Error("THREE.HDRLoader: Read Error: "+(f||""));case 2:throw new Error("THREE.HDRLoader: Write Error: "+(f||""));case 3:throw new Error("THREE.HDRLoader: Bad File Format: "+(f||""));default:throw new Error("THREE.HDRLoader: Memory Error: "+(f||""))}},i=function(p,f,m){f=f||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(`
|
|
4187
4187
|
`))&&y<f&&g<p.byteLength;)_+=b,y+=b.length,g+=128,b=String.fromCharCode.apply(null,new Uint16Array(p.subarray(g,g+128)));return-1<v&&(m!==!1&&(p.pos+=y+v+1),_+b.slice(0,v))},r=function(p,f,m,g){let v=p[f+3],y=Math.pow(2,v-128)/255;m[g+0]=p[f+0]*y,m[g+1]=p[f+1]*y,m[g+2]=p[f+2]*y,m[g+3]=1},n=function(p,f,m,g){let v=p[f+3],y=Math.pow(2,v-128)/255;m[g+0]=Sd.toHalfFloat(Math.min(p[f+0]*y,65504)),m[g+1]=Sd.toHalfFloat(Math.min(p[f+1]*y,65504)),m[g+2]=Sd.toHalfFloat(Math.min(p[f+2]*y,65504)),m[g+3]=Sd.toHalfFloat(1)},s=new Uint8Array(e);s.pos=0;let a,o,l,h=function(p){let f,m,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||!(f=i(p)))&&t(1,"no header found"),(m=f.match(g))||t(3,"bad initial token"),x.valid|=1,x.programtype=m[1],x.string+=f+`
|
|
4188
4188
|
`;f=i(p),f!==!1;)if(x.string+=f+`
|
|
4189
4189
|
`,f.charAt(0)!=="#"){if((m=f.match(v))&&(x.gamma=parseFloat(m[1])),(m=f.match(y))&&(x.exposure=parseFloat(m[1])),(m=f.match(_))&&(x.valid|=2,x.format=m[1]),(m=f.match(b))&&(x.valid|=4,x.height=parseInt(m[1],10),x.width=parseInt(m[2],10)),2&x.valid&&4&x.valid)break}else x.comments+=f+`
|
|
4190
|
-
`;return 2&x.valid||t(3,"missing format specifier"),4&x.valid||t(3,"missing image size specifier"),x}(s),u=h.width,d=h.height,c=function(p,f,m){let g=f;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*f*m);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=m;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 T,M=0;for(;M<b&&_<p.byteLength;){T=p[_++];let A=T>128;if(A&&(T-=128),(T===0||M+T>b)&&t(3,"bad scanline data"),A){let P=p[_++];for(let N=0;N<T;N++)w[M++]=P}else w.set(p.subarray(_,_+T),M),M+=T,_+=T}let E=g;for(let A=0;A<E;A++){let P=0;v[y]=w[A+P],P+=g,v[y+1]=w[A+P],P+=g,v[y+2]=w[A+P],P+=g,v[y+3]=w[A+P],y+=4}S--}return v}(s.subarray(s.pos),u,d);switch(this.type){case Wt:l=c.length/4;let p=new Float32Array(4*l);for(let m=0;m<l;m++)r(c,4*m,p,4*m);a=p,o=Wt;break;case di:l=c.length/4;let f=new Uint16Array(4*l);for(let m=0;m<l;m++)n(c,4*m,f,4*m);a=f,o=di;break;default:throw new Error("THREE.HDRLoader: Unsupported type: "+this.type)}return{width:u,height:d,data:a,header:h.string,gamma:h.gamma,exposure:h.exposure,type:o,colorSpace:Ed,minFilter:nt,magFilter:nt,generateMipmaps:!1,flipY:!0}}setDataType(e){return this.type=e,this}}});function Oie(e){return e.length>2&&e[0]===35&&e[1]===63}function R5(e){return typeof e=="object"&&e!==null&&e.isSplineHdr===!0}function jxe(e){let t=new Ir(e.data,e.width,e.height,fn,di);return t.flipY=!1,t.image.isSplineHdr=!0,t.needsUpdate=!0,t}var Lie,GY,Nc,Wxe=U(()=>{ae(),aBe()}),Hxe=U(()=>{ae(),Vxe(),Gxe(),Wxe(),Lie=0,GY=class extends Bxe{constructor(e,t){super(e,t.imageHolderCache),this.data=e,this.shared=t,this.instanceId=++Lie,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 s of Object.values(n))s&&(s.image=this.img,s.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(s=>{n.onloadend=a=>{r=a.target?.result,s(null)}}),this.img.src=r}else this.img.src=e;this.img.onloadeddata=()=>{t()}}else if(e instanceof Uint8Array?Oie(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&&Oie(r)?function(s){try{let a=new Uxe().parse(s.buffer.slice(s.byteOffset,s.byteOffset+s.byteLength));if(!a||!a.width||!a.height)return null;let{width:o,height:l}=a,h=a.data,u=new Uint16Array(h.length),d=4*o,c=m=>Sd.toHalfFloat(Math.pow(Math.max(Sd.fromHalfFloat(m),0),1/2.2)),p=new Map,f=m=>{let g=p.get(m);return g===void 0&&(g=c(m),p.set(m,g)),g};for(let m=0;m<l;m++){let g=m*d,v=(l-1-m)*d;for(let y=0;y<d;y+=4)u[v+y]=f(h[g+y]),u[v+y+1]=f(h[g+y+1]),u[v+y+2]=f(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:(UE||(UE=new Lxe),UE.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 $X(this.img,void 0,e,e):this.isHdr?(n=jxe(this.img),n.wrapS=e,n.wrapT=e,n.magFilter=i,n.minFilter=t):n=new Ri(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,s]of Object.entries(r))s?.dispose(),this._cache[e]!==void 0&&this._cache[e][i]!==void 0&&(this._cache[e][i][n]=void 0)}dispose(){super.dispose(),this.disposeTextures()}}}),AB=U(()=>{Hxe(),Nc=class extends GY{}});function oBe(e){if(typeof e=="string")return e;let t=EH.get(e);return t||(t={url:URL.createObjectURL(new Blob([e]))},EH.set(e,t)),t.url}var EH,lBe=U(()=>{EH=new Map});function hBe(){if(!AH)return Bie||(Bie=async function(){await Promise.resolve().then(()=>(eQ(),zPe)),qxe(window!==void 0?window:global),AH=!0}())}var qxe,$xe,AH,Bie,Xxe=U(()=>{$xe=new Promise(e=>{qxe=e}),AH=!1});function Fie(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 uBe(e){let t=!1,i=[];return e.scene.objects.traverse((r,n)=>{if(n.type==="Page"&&n.uiScene!==void 0&&n.uiScene.objects.traverse((s,a)=>{if(a.events===void 0||Array.isArray(a.events)===!1)return!0;Fie(a.events,i),t=t||i.some(o=>o.data.type==="Audio")}),n.events===void 0||Array.isArray(n.events)===!1)return!0;Fie(n.events,i),t=t||i.some(s=>s.data.type==="Audio")}),t}var Uie,sx,jY=U(()=>{lBe(),Xxe(),$xe.then(e=>Uie=e),sx=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:oBe(e),format:"wav"},this.sound=new Uie.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 zie(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 WY,HY=U(()=>{WY=null});function kie(e){return new Z(e.y,-e.x)}var qY,CH,Yxe,Kxe,N3,Vie,QL,Zxe,D5,JL=U(()=>{ae(),qY=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=et.clamp(n.thetaLength,0,360),n.hollow=et.clamp(n.hollow??0,0,1);let s=n.width/2,a=n.radiusTop??s,o=n.radiusBottom??s;if(a===o?(a=s,o=s):a>o?(a=s,o=o*s/a):(a=a*s/o,o=s),n.shapeBlendNode){a=i??s,o=r??s;let l=2*Math.max(a,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:a,radiusBottom:o})}}static build(e){let t,{width:i,depth:r,height:n,radialSegments:s,heightSegments:a,openEnded:o,thetaStart:l,thetaLength:h,radiusTop:u,radiusBottom:d,cornerRadius:c,cornerSegments:p,hollow:f}=e.parameters;h===0?(t=new At,t.setAttribute("position",new Et([],3))):t=c||f?new CH(u,d,n,s,a,o,l,h*Math.PI/180,c,c,p,f):new EE(u,d,n,s,a,o,l,h*Math.PI/180);let m=r/i;return m!==1&&t.scale(1,1,m),Object.assign(t,{userData:{...e,type:"CylinderGeometry"}})}},CH=class extends At{constructor(e,t,i,r,n,s,a,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,s=s!==void 0&&s,a=a!==void 0?a:0,o=o!==void 0?o:2*Math.PI,s&&(l=0,h=0);let p=i/2;c&&e==0&&(e=l),c&&t==0&&(t=h);let f=new Z(e,p),m=new Z(t,-p),g=null,v=null,y=null,_=null,b=f.clone().sub(m),x=0,w=0,S=0;d>0&&(x=Math.min(e,t)*(1-d),w=e-x,S=t-x);let T=f.clone();T.x-=x;let M=Math.PI-b.angle(),E=b.angle(),A=Math.tan(E/2),P=Math.tan(M/2),N=A+P,D=d?N:P,O=d?N:A;if(l=Math.min(l,(e-w)/D,b.length()/N),h=Math.min(h,(t-S)/O,b.length()/N),l>0){let me=l/A;g=f.clone().sub(new Z(me,l)),d&&(y=g.clone(),y.x-=x-N*l),f.sub(b.clone().setLength(me))}if(h>0){let me=h/P;v=m.clone().sub(new Z(me,-h)),m.add(b.clone().setLength(me)),d&&(_=v.clone(),_.x-=x-N*h,T.sub(b.clone().setLength(me)))}b=f.clone().sub(m);let z=b.length()<.5,B=[],V=[],j=[],K=[],$=[],Q=[],ce=(me,xe,ke,Te,Ze)=>{for(let ze=0;ze<u+1;ze++){let qe=ze/u,Ne=Te<0?qe:1-qe;Ze&&(Ne-=1),Ne*=me;let ee=Math.sin(Ne),Ce=Math.cos(Ne)*Te,He=Ce*xe+ke.y;B.push(ee*xe+ke.x),V.push(He),j.push(ee),K.push(Ce),$.push(.5+He/i),Q.push(!1)}},pe=(me,xe,ke)=>{let Te=[me,xe];ke<0&&Te.reverse();for(let Ze of Te)B.push(Ze),V.push(p*ke),j.push(0),K.push(ke),$.push(.5),Q.push(!0)};if(_&&v?(ce(M,h,_,-1,!0),ce(E,h,v,-1,!1)):v?(pe(v.x,0,-1),ce(E,h,v,-1,!1)):s||pe(t,S,-1),!z){let me=kie(b).normalize();for(let xe=0;xe<=n;xe++){let ke=xe/n,Te=b.y*ke+m.y;B.push(b.x*ke+m.x),V.push(Te),j.push(me.x),K.push(me.y),$.push(.5+Te/i),Q.push(!1)}}if(y&&g?(ce(M,l,g,1,!1),ce(E,l,y,1,!0)):g?(ce(M,l,g,1,!1),pe(g.x,0,1)):s||pe(e,w,1),d&&!z){let me=kie(b).multiplyScalar(-1).normalize();for(let xe=0;xe<=n;xe++){let ke=xe/n,Te=b.y*-ke+T.y;B.push(b.x*-ke+T.x),V.push(Te),j.push(me.x),K.push(me.y),$.push(.5+Te/i),Q.push(!1)}}let ye=B.length,we=ye+(d&&!s?1:0),ne=(me,xe)=>me*ye+(xe===ye?0:xe),Se=o<2*Math.PI,W=(r+1)*ye+(Se?2*(1+we):0),k=new Float32Array(3*W),Y=new Float32Array(3*W),ie=new Float32Array(2*W),G=W-1>65535?new Uint32Array(r*Math.max(0,we-1)*6+(Se?2*(we+1)*3:0)):new Uint16Array(r*Math.max(0,we-1)*6+(Se?2*(we+1)*3:0)),oe=0,se=0;for(let me=0;me<=r;me++){let xe=me/r,ke=xe*o+a,Te=Math.sin(ke),Ze=Math.cos(ke);for(let ze=0;ze<ye;ze++){let qe=3*se,Ne=2*se,ee=B[ze],Ce=j[ze];k[qe]=ee*Te,k[qe+1]=V[ze],k[qe+2]=ee*Ze,Y[qe]=Ce*Te,Y[qe+1]=K[ze],Y[qe+2]=Ce*Ze,Q[ze]?(ie[Ne]=.5,ie[Ne+1]=.5):(ie[Ne]=xe,ie[Ne+1]=$[ze]),se++}}for(let me=0;me<r;me++)for(let xe=0;xe<we-1;xe++){if(s&&d&&xe==n)continue;let ke=ne(me,xe),Te=ne(me+1,xe),Ze=ne(me+1,xe+1),ze=ne(me,xe+1),qe=k[3*Ze+0],Ne=k[3*Ze+2];G[oe++]=ke,G[oe++]=Te,G[oe++]=ze,(qe!=0||Ne!=0)&&(G[oe++]=Te,G[oe++]=Ze,G[oe++]=ze)}function H(me,xe,ke){let Te=Math.sin(ke),Ze=Math.cos(ke),ze=-Ze,qe=Te,Ne=me<0?(it,Yt,ni)=>{G[oe++]=it,G[oe++]=Yt,G[oe++]=ni}:(it,Yt,ni)=>{G[oe++]=it,G[oe++]=ni,G[oe++]=Yt},ee=(e+t+w+S)/4,Ce=3*se,He=2*se;k[Ce]=ee*Te,k[Ce+1]=0,k[Ce+2]=ee*Ze,Y[Ce]=ze,Y[Ce+1]=0,Y[Ce+2]=qe,ie[He]=.5,ie[He+1]=.5;let pt=se++;for(let it=0;it<we;it++){let Yt=3*(xe+(it===ye?0:it));Ce=3*se,He=2*se,k[Ce]=k[Yt],k[Ce+1]=k[Yt+1],k[Ce+2]=k[Yt+2],Y[Ce]=ze,Y[Ce+1]=0,Y[Ce+2]=qe;let ni=Yt/3*2|0;ie[He]=ie[ni],ie[He+1]=ie[ni+1],se++}for(let it=pt+1;it<se-1;it++)Ne(pt,it,it+1);Ne(pt,se-1,pt+1)}Se&&(H(-1,0,a),H(1,r*ye,a+o)),this.setIndex(new Dt(G.slice(0,oe),1)),this.setAttribute("position",new Dt(k,3)),this.setAttribute("normal",new Dt(Y,3)),this.setAttribute("uv",new Dt(ie,2))}}}),Gie=U(()=>{ae(),JL(),Yxe=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=et.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:s,heightSegments:a,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 CH(0,i/2,n,s,a,o,l,h*Math.PI/180,u,d,c,0,!0):new yL(i/2,n,s,a,o);let p=r/i;return p!==1&&t.scale(1,1,p),Object.assign(t,{userData:{...e,type:"ConeGeometry"}})}}}),jie=U(()=>{ae(),Kxe=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:s,heightSegments:a,depthSegments:o,cornerRadius:l,cornerSegments:h}=e.parameters;return t=l===0?new Ih(i,r,n,s,a,o):new Vie(i,r,n,s,a,o,l,h),Object.assign(t,{userData:{...e,type:"CubeGeometry"}})}},N3=Math.PI/2,Vie=class extends At{constructor(e=1,t=1,i=1,r=1,n=1,s=1,a=0,o=4){super(),this.type="BoxGeometry",r=Math.floor(r),n=Math.floor(n),s=Math.floor(s),o=Math.floor(o);let l=(a=Math.min(a,e/2,t/2,i/2))>0,h=o+1,u=2*((s+1)*(n+1)+(r+1)*(s+1)+(r+1)*(n+1))+(l?4*h*(s+1+(r+1)+(n+1))+h*(h+1)/2*8:0),d=2*(s*n+r*s+r*n)+(l?4*o*(s+r+n):0),c=l?8*o*o:0,p=new Float32Array(3*u),f=new Float32Array(3*u),m=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 D=N/o*N3;_[N]=Math.sin(D)*a,b[N]=(1-Math.cos(D))*a,x[N]=Math.sin(D),w[N]=Math.cos(D)}let S=h*(h+1)/2,T=new Float64Array(3*S),M=new Float64Array(3*S);{let N=new R(e/2,t/2,i/2);N.subScalar(a);let D=0;for(let O=0;O<=o;O++){let z=N3*(1-O/o),B=Math.cos(z),V=Math.sin(z),j=0;for(let K=0;K<=O;K++){let $=B*Math.cos(j),Q=V,ce=B*Math.sin(j);T[3*D]=$,T[3*D+1]=Q,T[3*D+2]=ce,M[3*D]=N.x+$*a,M[3*D+1]=N.y+Q*a,M[3*D+2]=N.z+ce*a,D++,j+=N3/O}}}function E(N,D,O,z,B,V,j,K,$,Q){let ce=(V-2*a)/$,pe=(j-2*a)/Q,ye=V/2-a,we=j/2-a,ne=K/2,Se=$+1,W=Q+1,k=0,Y=new R;for(let ie=0;ie<W;ie++){let G=ie*pe-we;for(let oe=0;oe<Se;oe++){let se=oe*ce-ye,H=3*(v+k),me=2*(v+k);Y[N]=se*z,Y[D]=G*B,Y[O]=ne,p[H]=Y.x,p[H+1]=Y.y,p[H+2]=Y.z,Y[N]=0,Y[D]=0,Y[O]=K>0?1:-1,f[H]=Y.x,f[H+1]=Y.y,f[H+2]=Y.z,m[me]=oe/$,m[me+1]=1-ie/Q,k+=1}}for(let ie=0;ie<Q;ie++)for(let G=0;G<$;G++){let oe=v+G+Se*ie,se=v+G+Se*(ie+1),H=v+(G+1)+Se*(ie+1),me=v+(G+1)+Se*ie;g[y++]=oe,g[y++]=se,g[y++]=me,g[y++]=se,g[y++]=H,g[y++]=me}v+=k}function A(N,D,O,z,B,V,j,K,$,Q){let ce=(j-2*a)/Q,pe=j/2-a,ye=K/2-a,we=$/2,ne=Q+1,Se=0,W=new R,k=new R;for(let Y=0;Y<o+1;Y++){W[D]=(ye+_[Y])*B,W[O]=(we-b[Y])*V,k[N]=0,k[D]=x[Y]*Math.sign(W[D]),k[O]=w[Y]*Math.sign(W[O]);for(let ie=0;ie<ne;ie++){let G=ie*ce-pe;W[N]=G*z;let oe=3*(v+Se),se=2*(v+Se);p[oe]=W.x,p[oe+1]=W.y,p[oe+2]=W.z,f[oe]=k.x,f[oe+1]=k.y,f[oe+2]=k.z,m[se]=ie/Q,m[se+1]=0,Se+=1}}for(let Y=0;Y<o;Y++)for(let ie=0;ie<Q;ie++){let G=v+ie+ne*Y,oe=v+ie+ne*(Y+1),se=v+(ie+1)+ne*(Y+1),H=v+(ie+1)+ne*Y;g[y++]=G,g[y++]=oe,g[y++]=H,g[y++]=oe,g[y++]=se,g[y++]=H}v+=Se}function P(N,D,O){let z=N*D*O>0?(V,j,K)=>{g[y++]=V,g[y++]=j,g[y++]=K}:(V,j,K)=>{g[y++]=V,g[y++]=K,g[y++]=j},B=v;for(let V=0;V<S;V++){let j=3*V,K=3*v,$=2*v;p[K]=N*M[j],p[K+1]=D*M[j+1],p[K+2]=O*M[j+2],f[K]=N*T[j],f[K+1]=D*T[j+1],f[K+2]=O*T[j+2],m[$]=0,m[$+1]=0,v++}for(let V=0;V<o;V++){let j=B+V*(V+1)/2,K=B+(V+1)*(V+2)/2;z(j,K+1,K);for(let $=1;$<=V;$++)z(j+$-1,j+$,K+$),z(j+$,K+$+1,K+$)}}E("z","y","x",-1,-1,i,t,e,s,n),E("z","y","x",1,-1,i,t,-e,s,n),E("x","z","y",1,1,e,i,t,r,s),E("x","z","y",1,-1,e,i,-t,r,s),E("x","y","z",1,-1,e,t,i,r,n),E("x","y","z",-1,-1,e,t,-i,r,n),a>0&&(A("z","y","x",-1,-1,1,i,t,e,s),A("z","y","x",1,-1,-1,i,t,e,s),A("z","y","x",-1,1,-1,i,t,e,s),A("z","y","x",1,1,1,i,t,e,s),A("x","y","z",-1,-1,-1,e,t,i,r),A("x","y","z",1,-1,1,e,t,i,r),A("x","y","z",-1,1,1,e,t,i,r),A("x","y","z",1,1,-1,e,t,i,r),A("y","x","z",-1,-1,1,t,e,i,n),A("y","x","z",1,-1,-1,t,e,i,n),A("y","x","z",1,1,1,t,e,i,n),A("y","x","z",-1,1,-1,t,e,i,n),P(1,1,1),P(-1,1,1),P(1,-1,1),P(-1,-1,1),P(1,1,-1),P(-1,1,-1),P(1,-1,-1),P(-1,-1,-1)),this.setIndex(new Dt(g,1)),this.setAttribute("position",new Dt(p,3)),this.setAttribute("normal",new Dt(f,3)),this.setAttribute("uv",new Dt(m,2))}}}),Qxe=U(()=>{ae(),QL=class extends At{constructor(e=[],t=[],i="",r=1,n=.2,s=4){super(),this.type="PolyhedronGeometryRound";let a,o,l,h=0;return function(){(n=Math.min(.99999,n))==0&&(s=0);let u={IcosahedronGeometry:5,DodecahedronGeometry:3,HexahedronGeometry:3,OctahedronGeometry:4,TetrahedronGeometry:3}[i],d=new R,c=d.clone(),p=new Us,f=n*r,m=r-f,g=s+1,v=new R,y=(ne,Se)=>v.subVectors(ne,Se).normalize(),_=(ne,Se)=>Array(ne).fill(void 0).map(Se),b=_(e.length/3,(ne,Se)=>new R().fromArray(e,3*Se).setLength(r)),x=[],w=1e6;for(let ne=0;ne<b.length;ne++){let Se,W,k,Y=b[ne],ie=[],G=1e10,oe=-1;for(;(oe=t.indexOf(ne,oe+1))!=-1;){let xe=oe-oe%3;Se=t[xe+(oe+1)%3],W=t[xe+(oe+2)%3],k=Y.distanceToSquared(b[Se]),G=Math.min(G,k),ie.push([Se,W,k])}G+=1e-6;let se=[],H=0,me=ie.length;for(let xe=0;xe<me;xe++){[Se,W,k]=ie[H];let ke=x[Se]?.includes(ne)==1;k<=G&&se.push(Se+ +ke*w),H=ie.findIndex(Te=>Te[0]==W)}x.push(se)}let S=[];{let ne,Se,W=0,k=0,Y=u==3;for(let ie=0;ie<=s;ie++){ne=ie*(ie+1)/2,Se=(ie+1)*(ie+2)/2;for(let G=0;G<s-ie;G++)[W,k]=[ne+G+ie+2,Se+G+ie+3],S.push(ne,Se,...Y?[k,ne]:[W,Se],k,W),[ne,Se]=[W,k];S.push(ne,Se,ne+s+2)}}let T=0;for(let ne=0;ne<x.length;ne++)for(let Se=0;Se<u;Se++)x[ne][Se]<w&&T++;let M=b.length*u*S.length*3+T*g*6*3+2*T*3*3;a=new Float64Array(M),o=new Float64Array(M),l=new Float64Array(M/3*2);let E=(ne,Se,W)=>{let k=h/3*2;l[k]=Math.atan2(W,-ne)/2/Math.PI+.5,l[k+1]=1-(Math.atan2(-Se,Math.sqrt(ne*ne+W*W))/Math.PI+.5)},A=ne=>{a[h]=ne.x,a[h+1]=ne.y,a[h+2]=ne.z,o[h]=v.x,o[h+1]=v.y,o[h+2]=v.z,E(ne.x,ne.y,ne.z),h+=3},P=ne=>{a[h]=ne[0].x,a[h+1]=ne[0].y,a[h+2]=ne[0].z,o[h]=ne[1].x,o[h+1]=ne[1].y,o[h+2]=ne[1].z,E(ne[0].x,ne[0].y,ne[0].z),h+=3},N=(s+2)*(s+3)/2,D=new Float64Array(3*N),O=new Float64Array(3*N),z=new Float64Array(2*N),B=_(2*u*g,()=>new R),V=_(s*Math.max(0,s-1)/2,()=>new R),j=d.clone(),K=d.clone(),$=d.clone(),Q=d.clone(),ce=d.clone(),pe=[],ye=_(b.length,()=>_(u,()=>d.clone()));for(let ne=0;ne<b.length;ne++){d.copy(b[ne]).normalize(),j.copy(d).multiplyScalar(m);let Se=x[ne];for(let se=0;se<Se.length;se++){let H=Se[se],me=Se[(se+1)%u];p.setFromPointsAndIndices(b,ne,H%w,me%w),p.b.sub(p.a).setLength(1e10).add(p.a),p.c.sub(p.a).setLength(1e10).add(p.a),p.closestPointToPoint(j,ye[ne][se])}let W=0,k=[],Y=[],ie=new R;s==0&&[...ye[ne]].reduce((se,H)=>se.add(H),ie).multiplyScalar(1/u);for(let se=0;se<u;se++){let H=[],me=(se-1+u)%u,xe=ye[ne][me],ke=ye[ne][se];d.copy(xe).sub(j),c.copy(ke).sub(j);let Te=j.angleTo(d),Ze=d.angleTo(c),ze=Math.cos(Te)*f;s==0?K.copy(ie):K.copy(j).setLength(m+ze),k.push(ze);let qe=[K,xe,ke];for(let Ne=0;Ne<2;Ne++){let ee=qe[Ne],Ce=qe[Ne+1];Q.subVectors(ee,j),ce.subVectors(Ce,j),$.crossVectors(Q,ce).normalize();for(let He=0;He<g;He++){let pt=[Te,Ze][Ne]*He/g;d.copy(Q).applyAxisAngle($,pt).add(j),B[W++].copy(d),Ne&&(y(d,j),H.push([He==0?ee:d.clone(),v.clone()]))}Ne&&(y(Ce,j),H.push([Ce,v.clone()]))}Y.push(H)}pe.push(Y);let G=2*g,oe=2;for(let se=0;se<u;se++){let H=G*se,me=G*((se+1)%u),xe=0,ke=[B[H]];for(let Te=1;Te<g;Te++){let Ze=B[H+Te],ze=B[me+Te];ke.push(Ze);for(let qe=1,Ne=Te-oe+1;qe<=Ne;qe++)d.lerpVectors(Ze,ze,qe/(Ne+1)),d.sub(j).setLength(k[se]).add(j),ke.push(V[xe++].copy(d));ke.push(ze)}for(let Te=0;Te<g;Te++)ke.push(B[Te+g+H]);ke.push(B[me+g]);for(let Te=0,Ze=ke.length;Te<Ze;Te++){let ze=ke[Te],qe=3*Te,Ne=2*Te;D[qe]=ze.x,D[qe+1]=ze.y,D[qe+2]=ze.z,y(ze,j),O[qe]=v.x,O[qe+1]=v.y,O[qe+2]=v.z,z[Ne]=Math.atan2(ze.z,-ze.x)/2/Math.PI+.5,z[Ne+1]=1-(Math.atan2(-ze.y,Math.sqrt(ze.x*ze.x+ze.z*ze.z))/Math.PI+.5)}for(let Te=0,Ze=S.length;Te<Ze;Te++){let ze=3*S[Te],qe=2*S[Te],Ne=h/3*2;a[h]=D[ze],a[h+1]=D[ze+1],a[h+2]=D[ze+2],o[h]=O[ze],o[h+1]=O[ze+1],o[h+2]=O[ze+2],l[Ne]=z[qe],l[Ne+1]=z[qe+1],h+=3}}}let we=[];for(let ne=0;ne<x.length;ne++)for(let Se=0;Se<u;Se++){let W=x[ne][Se];if(W<w){let k=x[W].findIndex(G=>G%w==ne),Y=pe[ne][Se],ie=pe[W][k];for(let G=0;G<g;G++){let oe=Y[G],se=ie[g-G],H=Y[G+1],me=ie[g-(G+1)];P(oe),P(se),P(H),P(H),P(se),P(me)}we.push(Y[0][0],ie[g][0],Y[g][0],ie[0][0])}}for(;we.length;){let ne,Se,W,[k,Y]=we.splice(0,2);ne=Y;let ie=[k];for(;k!=ne;)ie.push(ne),Se=we.indexOf(ne),W=Se%2,ne=we.splice(Se-W,2)[1-W];v.subVectors(ie[0],ie[1]).cross(d.subVectors(ie[0],ie[2])).normalize();let G=v.dot(ie[0])<0;G&&v.negate();for(let oe=1;oe<=ie.length-2;oe++)A(ie[oe+ +G]),A(ie[oe+1-+G]),A(ie[0])}}(),function(){let u=new R,d=new R,c=new R,p=new R,f=new Z,m=new Z,g=new Z,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(a[b+0],a[b+1],a[b+2]),d.set(a[b+3],a[b+4],a[b+5]),c.set(a[b+6],a[b+7],a[b+8]),f.set(l[x+0],l[x+1]),m.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(f,x+0,u,w),v(m,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],T=Math.max(x,w,S),M=Math.min(x,w,S);T>.9&&M<.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 Dt(new Float32Array(a.subarray(0,h)),3)),this.setAttribute("normal",new Dt(new Float32Array(o.subarray(0,h)),3)),void this.setAttribute("uv",new Dt(new Float32Array(l.subarray(0,h/3*2)),2))}static fromJSON(e){return new QL(e.vertices,e.indices,e.radius,e.corner,e.cornerSides)}}}),Wie=U(()=>{Qxe(),ae(),Zxe=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:s,cornerSides:a}=e.parameters,o=n===0&&s!==0?new D5(.5*t,s,a):new sW(.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"}})}},D5=class extends QL{constructor(e=1,t=.2,i=4){let r=(1+Math.sqrt(5))/2,n=1/r,s="DodecahedronGeometry";super([-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-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],s,e,t,i),this.type=s}static fromJSON(e){return new D5(e.radius,e.corner,e.cornerSides)}}});function Hie(e,t=new Z){let i=e.length();return t.set(-e.y/i,e.x/i)}function dBe(e){let t=new Z;t.addVectors(e.v0,ly.subVectors(e.v1,e.v0).multiplyScalar(2/3));let i=new Z;return i.addVectors(e.v2,LA.subVectors(e.v1,e.v2).multiplyScalar(2/3)),new mu(e.v0,t,i,e.v2)}function WM(e,t,i=Number.EPSILON){return Math.abs(e-t)<i}function cBe(e,t,i=Number.EPSILON){return e.distanceTo(t)<i}function pBe(e,t,i=Number.EPSILON){return e.distanceTo(t)<i}function Jxe(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)),s=Math.sqrt(Math.pow(i.x-e.x,2)+Math.pow(i.y-e.y,2));return Math.acos((n*n+r*r-s*s)/(2*n*r))}function fBe(e,t,i){return $ie(e,t)&&$ie(t,i)&&PH(e.position,t.position,i.position)}function PH(e,t,i){return ly.copy(t).sub(e).cross(LA.copy(i).sub(e))===0}function mBe(e,t,i,r,n){let s=Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2)),a=(e.y+t.y)/2,o=(e.x+t.x)/2,l=Math.sqrt(Math.pow(i,2)-Math.pow(s/2,2))*(e.y-t.y)/s,h=Math.sqrt(Math.pow(i,2)-Math.pow(s/2,2))*(t.x-e.x)/s;return r.set(o+l,a+h),n.set(o-l,a-h),[r,n]}function gBe(e,t,i){return e.distanceTo(i)<t.distanceTo(i)?t:e}function vBe(e,t,i,r,n,s){let a,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 Jxe(t,e,i)>Math.PI&&(d*=-1),a=WM(u,l)?(l+u)*(r/d-.5)*8/3/(o-h):(o+h)*(r/d-.5)*8/3/(u-l),n.set(t.x-a*l,t.y+a*o),s.set(i.x+a*u,i.y-a*h),[n,s]}function qie(e,t){return e.position.equals(e.controls[1].position)&&t.position.equals(t.controls[0].position)}function $ie(e,t){return PH(e.position,e.controls[1].position,t.position)&&PH(e.position,t.controls[0].position,t.position)}function Xie(e,t=12,i=!1){let r=[];for(let n=0,s=e.length;n<s;n++){let a=e[n],o=0;if(i&&a.roundedCurveCorner!==void 0){let l=.5*oy(a.roundedCurveCorner,t);n>0&&(r[n-1]+=l),o+=l}a.curveAfter!==void 0&&(o+=oy(a.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 CM?2*t:e&&(e instanceof Th||e instanceof aW)?1:e&&e instanceof DI?t*e.points.length:t}var Fb,I3,O3,wy,$I,ly,LA,ewe,twe,iwe,rwe,RH,DH,L3,Yie,Kie,Zie,Qie,Jie,ps,nwe=U(()=>{ae(),Fb=1e-12,I3=class{constructor(e){this.position=new Z,this.startPosition=new Z,this.uuid=et.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 I3(this.position).copy(this)}toJSON(){return[this.position.x,this.position.y]}},O3=class extends I3{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 I3{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 Z(...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 Z,t=new Z){let[i,r]=this.computeTangents();return i&&r&&(Hie(i,e),Hie(r,t)),[e,t]}computeTangent(e=new Z){let[t,i]=this.computeTangents();return t&&i&&e.copy(t).add(i).normalize(),e}computeNormal(e=new Z){let[t,i]=this.computeNormals();return e.copy(t).add(i).normalize(),e}},$I=e=>e,ly=new Z,LA=new Z,ewe=new Z,twe=new Z,iwe=new Z,rwe=new Z,RH=new R,DH=new R}),s0=U(()=>{ae(),nwe(),L3=new Z,Yie=new Z,Kie=new Z,Zie=new Z,Qie=new Z,Jie=new Z,ps=class extends vA{constructor(e=100,t=100){super(),this.points=[],this.shapeHoles=[],this.plane=new qa(new R(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=et.generateUUID(),this.needsUpdate=!1,this.roundedCurves=[],this._width=e,this._height=t}static createFromState(e,t,i){let r=new ps;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=>ps.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,s=this.shapeHoles.length;n<s;n++){let a=this.shapeHoles[n],o=a.points.length,l=a.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],s=e-t;if(s<=n.points.length-1)return n.points[s];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],s=n.points.indexOf(e);if(s>=0)return t+s;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 s=this.points[r];s.position.multiply(i),s.controls[0].position.multiply(i),s.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=et.generateUUID()){let r;r=e instanceof Z?e:new Z(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,s,a=12,o=!0){let l,h=DH.set(0,0,0),u=0,d=[];for(let c=0;c<s.length;c++){let p=$I(s[c]),f=ly,m=oy(p,a);d.push(m);for(let g=0;g<=m;g++)if(p instanceof mu||p instanceof pf||p instanceof Th){if(p.getPoint(g/m,f),h.set(f.x,f.y,0),l!==void 0&&pBe(l,h))continue;l===void 0&&(l=RH),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,s)=>n+s,0)+1}computeCurveDivisions(e=12){return this.curveDivisions=Xie(this.points,e,!1),this.roundedCurveDivisions=Xie(this.points,e,!0),this.curveDivisions}extractFilteredShapePointsToBuffer(e,t,i=12){return 2*function(r,n,s,a=12,o=!0){let l=DH.set(0,0,0),h=0,u=[];for(let d=0;d<n.length;d++){if(s[d]===!1)continue;let c,p=$I(n[d]),f=ly,m=oy(p,a);u.push(m);for(let g=0;g<=m;g++)if(p instanceof mu||p instanceof pf||p instanceof Th){if(p.getPoint(g/m,f),l.set(f.x,f.y,0),c?.equals(l))continue;c===void 0?c=RH:(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,s=!0){let a,o=0;for(let l=0;l<r.length;l++){let h=$I(r[l]),u=oy(h,n),d=ly;for(let c=0;c<=u;c++)if(h instanceof mu||h instanceof pf||h instanceof Th){if(h.getPoint(c/u,d),a!==void 0&&cBe(a,d,Fb))continue;a===void 0&&(a=LA),a.copy(d),i.push(d.x,d.y),o++}}return WM(i[0],i[i.length-2],Fb)&&WM(i[1],i[i.length-1],Fb)&&(i.pop(),i.pop()),s&&o>1&&!(WM(i[o-1],i[1],Fb)&&WM(i[o-2],i[0],Fb))&&(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 s=e-n;s<0&&(s+=r.reduce((a,o)=>a+o,0));for(let a=0,o=r.length;a<o;a++){let l=r[a];if(s<i+l)return[a,(s-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],s=this.curveDivisions,a=s[e];if(qie(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+=s[l];return(t-o)/a}dispose(){}_applyCurveForPoint(e,t){qie(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],s=this.points[i-1]??this.points[this.points.length-1],a=this.points[i+1]??this.points[0],o=n.roundness,l=s&&a&&fBe(s,n,a);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,f=h instanceof Th?h.v1.distanceTo(h.v2):h.getLength(),m=u instanceof Th?u.v1.distanceTo(u.v2):u.getLength(),g=Math.min(o,.499*f),v=Math.min(o,.499*m),y=Math.min(g,v),_=1-y/f,b=y/m,x=h.getPointAt(_,L3),w=u.getPointAt(b,Yie);if(this._subSplitCurve(h,c,_,x,void 0),this._subSplitCurve(u,p,b,void 0,w),this.useCubicForRoundedCorners){let S=Jxe(x,n.position,w)/2,T=Math.tan(S)*x.distanceTo(n.position),[M,E]=mBe(x,w,T,Kie,Zie),A=gBe(M,E,n.position),[P,N]=vBe(A,x,w,T,Qie,Jie);d=new mu(x.clone(),P.clone(),N.clone(),w.clone())}else d=new pf(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 s=e,a=t,o=s.getUtoTmapping(i,0),l=function(h,u,d,c,p=.5){let f=ly.subVectors(u,h).multiplyScalar(p).add(h),m=LA.subVectors(d,u).multiplyScalar(p).add(u),g=ewe.subVectors(c,d).multiplyScalar(p).add(d),v=f,y=twe.subVectors(m,f).multiplyScalar(p).add(f),_=iwe.subVectors(g,m).multiplyScalar(p).add(m),b=g,x=rwe.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]}(s.v0,s.v1,s.v2,s.v3,o);return r!==void 0&&(a.v0.set(l[0],l[1]),a.v1.set(l[2],l[3]),a.v2.set(l[4],l[5]),a.v3.set(l[6],l[7])),n!==void 0&&(a.v0.set(l[6],l[7]),a.v1.set(l[8],l[9]),a.v2.set(l[10],l[11]),a.v3.set(l[12],l[13])),a}return r!==void 0&&t.v2.copy(r),n!==void 0&&t.v1.copy(n),t}clone(){let e=new ps(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],s=e.points[r+1],a=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(et.generateUUID(),new Z(n,s));d.controls[0].position.set(a,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 ps;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 mu&&n.v3.equals(r.position)&&r.controls[0].position.copy(n.v2)};return this.points=(r=>{let n,s,a=[];for(n=0,s=r.length;n<s;n++)r[n]instanceof pf&&(r[n]=dBe(r[n]));for(n=0,s=r.length;n<s;n++){let h,u=r[n],d=n>0?r[n-1]:null;u instanceof mu?(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),a.push(h))}let o=r[r.length-1],l=!1;return o instanceof mu?o.v3.equals(a[0].position)&&(a[0].controls[0].position.copy(o.v2),l=!0):o instanceof Th&&o.v2.equals(a[0].position)&&(l=!0),this.isClosed=l,a})(e.curves),e instanceof vA&&(this.shapeHoles=e.holes.map(r=>{let n=new ps;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 N5({x:e,y:t},i,r,n,s){return{x:e*i+n,y:t*r+s}}function yBe(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),s=Math.cos(e+t),a=Math.sin(e+t);return[{x:r-n*i,y:n+r*i},{x:s+a*i,y:a-s*i},{x:s,y:a}]}function ere(e,t,i,r){let n=e*r-t*i<0?-1:1,s=Math.min(1,Math.max(-1,e*i+t*r));return n*Math.acos(s)}var XI,_Be=U(()=>{XI=2*Math.PI});function Ti(e,t){if(!e)throw t||"Assertion Failed!"}function zE(e){var t=e.windingRule,i=t===void 0?ns.ODD:t,r=e.elementType,n=r===void 0?wo.POLYGONS:r,s=e.polySize,a=s===void 0?3:s,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,f=p===void 0||p,m=e.debug,g=m!==void 0&&m;if(!c&&f)throw new Error("Contours can't be empty");if(c){var v=new swe;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,a,l,u,f),{vertices:v.vertices,vertexIndices:v.vertexIndices,vertexCount:v.vertexCount,elements:v.elements,elementCount:v.elementCount,mesh:g?v.mesh:void 0}}}var ns,wo,fi,Z1,WS,F0,I5,O5,L5,tre,B3,B5,ire,rre,swe,iC=U(()=>{var e;(e=ns||(ns={}))[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"}(wo||(wo={})),fi=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){Ti(t.vertLeq(i,r)&&t.vertLeq(r,n));var s=r.s-i.s,a=n.s-r.s;return s+a>0?s<a?r.t-i.t+(i.t-n.t)*(s/(s+a)):r.t-n.t+(n.t-i.t)*(a/(s+a)):0},t.edgeSign=function(i,r,n){Ti(t.vertLeq(i,r)&&t.vertLeq(r,n));var s=r.s-i.s,a=n.s-r.s;return s+a>0?(r.t-n.t)*s+(r.t-i.t)*a:0},t.transEval=function(i,r,n){Ti(t.transLeq(i,r)&&t.transLeq(r,n));var s=r.t-i.t,a=n.t-r.t;return s+a>0?s<a?r.s-i.s+(i.s-n.s)*(s/(s+a)):r.s-n.s+(n.s-i.s)*(a/(s+a)):0},t.transSign=function(i,r,n){Ti(t.transLeq(i,r)&&t.transLeq(r,n));var s=r.t-i.t,a=n.t-r.t;return s+a>0?(r.s-n.s)*s+(r.s-i.s)*a: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,s){return(i=i<0?0:i)<=(n=n<0?0:n)?n===0?(r+s)/2:r+i/(i+n)*(s-r):s+n/(i+n)*(r-s)},t.intersect=function(i,r,n,s,a){var o,l,h;t.vertLeq(i,r)||(h=i,i=r,r=h),t.vertLeq(n,s)||(h=n,n=s,s=h),t.vertLeq(i,n)||(h=i,i=n,n=h,h=r,r=s,s=h),t.vertLeq(n,r)?t.vertLeq(r,s)?((o=t.edgeEval(i,n,r))+(l=t.edgeEval(n,r,s))<0&&(o=-o,l=-l),a.s=t.interpolate(o,n.s,l,r.s)):((o=t.edgeSign(i,n,r))+(l=-t.edgeSign(i,s,r))<0&&(o=-o,l=-l),a.s=t.interpolate(o,n.s,l,s.s)):a.s=(n.s+r.s)/2,t.transLeq(i,r)||(h=i,i=r,r=h),t.transLeq(n,s)||(h=n,n=s,s=h),t.transLeq(i,n)||(h=i,i=n,n=h,h=r,r=s,s=h),t.transLeq(n,r)?t.transLeq(r,s)?((o=t.transEval(i,n,r))+(l=t.transEval(n,r,s))<0&&(o=-o,l=-l),a.t=t.interpolate(o,n.t,l,r.t)):((o=t.transSign(i,n,r))+(l=-t.transSign(i,s,r))<0&&(o=-o,l=-l),a.t=t.interpolate(o,n.t,l,s.t)):a.t=(n.t+r.t)/2},t}(),Z1=function(){this.next=null,this.prev=null,this.anEdge=null,this.trail=null,this.n=0,this.marked=!1,this.inside=!1},WS=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}(),F0=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},I5=function(){function t(){var i=new F0,r=new Z1,n=new WS(0),s=new WS(1);i.next=i.prev=i,i.anEdge=null,r.next=r.prev=r,n.next=n,n.Sym=s,s.next=s,s.Sym=n,this.vHead=i,this.fHead=r,this.eHead=n,this.eHeadSym=s}return t.prototype.makeEdge_=function(i){var r=new WS(0),n=new WS(1);i.Sym.side<i.side&&(i=i.Sym);var s=i.Sym.next;return n.next=s,s.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,s=r.Onext;n.Sym.Lnext=r,s.Sym.Lnext=i,i.Onext=s,r.Onext=n},t.prototype.makeVertex_=function(i,r,n){var s=i;Ti(s,"Vertex can't be null!");var a=n.prev;s.prev=a,a.next=s,s.next=n,n.prev=s,s.anEdge=r;var o=r;do o.Org=s,o=o.Onext;while(o!==r)},t.prototype.makeFace_=function(i,r,n){var s=i;Ti(s,"Face can't be null");var a=n.prev;s.prev=a,a.next=s,s.next=n,n.prev=s,s.anEdge=r,s.trail=null,s.marked=!1,s.inside=n.inside;var o=r;do o.Lface=s,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,s=n;do s.Org=r,s=s.Onext;while(s!==n);var a=i.prev,o=i.next;o.prev=a,a.next=o},t.prototype.killFace_=function(i,r){var n=i.anEdge,s=n;do s.Lface=r,s=s.Lnext;while(s!==n);var a=i.prev,o=i.next;o.prev=a,a.next=o},t.prototype.makeEdge=function(){var i=new F0,r=new F0,n=new Z1,s=this.makeEdge_(this.eHead);return this.makeVertex_(i,s,this.vHead),this.makeVertex_(r,s.Sym,this.vHead),this.makeFace_(n,s,this.fHead),s},t.prototype.splice=function(i,r){var n=!1,s=!1;if(i!==r){if(r.Org!==i.Org&&(s=!0,this.killVertex_(r.Org,i.Org)),r.Lface!==i.Lface&&(n=!0,this.killFace_(r.Lface,i.Lface)),this.splice_(r,i),!s){var a=new F0;this.makeVertex_(a,r,i.Org),i.Org.anEdge=i}if(!n){var o=new Z1;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 s=new Z1;this.makeFace_(s,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 s=new F0;return this.makeVertex_(s,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,s=this.makeEdge_(i),a=s.Sym;if(r.Lface!==i.Lface&&(n=!0,this.killFace_(r.Lface,i.Lface)),this.splice_(s,i.Lnext),this.splice_(a,r),s.Org=i.Dst,a.Org=r.Org,s.Lface=a.Lface=i.Lface,i.Lface.anEdge=a,!n){var o=new Z1;this.makeFace_(o,s,i.Lface)}return s},t.prototype.zapFace=function(i){var r,n,s,a,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)),(s=r.Sym).Onext===s?this.killVertex_(s.Org,null):(s.Org.anEdge=s.Onext,this.splice_(s,s.Oprev)),this.killEdge_(r));while(r!=l);a=i.prev,(o=i.next).prev=a,a.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,s,a,o;for(r=this.fHead.next;r!==this.fHead;r=r.next)if(r.inside)for(o=(n=r.anEdge).Org;s=n.Lnext,(a=n.Sym)&&a.Lface&&a.Lface.inside&&this.countFaceVerts_(r)+this.countFaceVerts_(a.Lface)-2<=i&&fi.vertCCW(n.Lprev.Org,n.Org,a.Lnext.Lnext.Org)&&fi.vertCCW(a.Lprev.Org,a.Org,n.Lnext.Lnext.Org)&&(s=a.Lnext,this.delete(a),n=null,a=null),!n||n.Lnext.Org!==o;)n=s;return!0},t.prototype.check=function(){var i,r,n,s,a,o,l=this.fHead,h=this.vHead,u=this.eHead;for(r=l,r=l;(i=r.next)!==l;r=i){Ti(i.prev===r),a=i.anEdge;do Ti(a.Sym!==a),Ti(a.Sym.Sym===a),Ti(a.Lnext.Onext.Sym===a),Ti(a.Onext.Sym.Lnext===a),Ti(a.Lface===i),a=a.Lnext;while(a!==i.anEdge)}for(Ti(i.prev===r&&i.anEdge===null),s=h,s=h;(n=s.next)!==h;s=n){Ti(n.prev===s),a=n.anEdge;do Ti(a.Sym!==a),Ti(a.Sym.Sym===a),Ti(a.Lnext.Onext.Sym===a),Ti(a.Onext.Sym.Lnext===a),Ti(a.Org===n),a=a.Onext;while(a!==n.anEdge)}for(Ti(n.prev===s&&n.anEdge===null),o=u,o=u;(a=o.next)!==u;o=a)Ti(a.Sym.next===o.Sym),Ti(a.Sym!==a),Ti(a.Sym.Sym===a),Ti(a.Org!==null),Ti(a.Dst!==null),Ti(a.Lnext.Onext.Sym===a),Ti(a.Onext.Sym.Lnext===a);Ti(a.Sym.next===o.Sym&&a.Sym===this.eHeadSym&&a.Sym.Sym===a&&a.Org===null&&a.Dst===null&&a.Lface===null&&a.Rface===null)},t}(),O5=function(){this.handle=null},L5=function(){this.key=null,this.node=0},tre=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 O5,this.handles[n]=new L5;this.initialized=!1,this.nodes[1].handle=1,this.handles[1].key=null}return t.prototype.floatDown_=function(i){var r,n,s,a=this.nodes,o=this.handles;for(r=a[i].handle;;){if((s=i<<1)<this.size&&this.leq(o[a[s+1].handle].key,o[a[s].handle].key)&&++s,Ti(s<=this.max),n=a[s].handle,s>this.size||this.leq(o[r].key,o[n].key)){a[i].handle=r,o[r].node=i;break}a[i].handle=n,o[n].node=i,i=s}},t.prototype.floatUp_=function(i){var r,n,s,a=this.nodes,o=this.handles;for(r=a[i].handle;;){if(n=a[s=i>>1].handle,s===0||this.leq(o[n].key,o[r].key)){a[i].handle=r,o[r].node=i;break}a[i].handle=n,o[n].node=i,i=s}},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 s,a;for(this.max*=2,a=this.nodes.length,this.nodes.length=this.max+1,s=a;s<this.nodes.length;s++)this.nodes[s]=new O5;for(a=this.handles.length,this.handles.length=this.max+1,s=a;s<this.handles.length;s++)this.handles[s]=new L5}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,s=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)),s},t.prototype.delete=function(i){var r,n=this.nodes,s=this.handles;Ti(i>=1&&i<=this.max&&s[i].key!==null),n[r=s[i].node].handle=n[this.size].handle,s[n[r].handle].node=r,--this.size,r<=this.size&&(r<=1||this.leq(s[n[r>>1].handle].key,s[n[r].handle].key)?this.floatDown_(r):this.floatUp_(r)),s[i].key=null,s[i].node=this.freeList,this.freeList=i},t}(),B3=function(){this.eUp=null,this.nodeUp=null,this.windingNumber=0,this.inside=!1,this.sentinel=!1,this.dirty=!1,this.fixUpperEdge=!1},B5=function(){this.key=null,this.next=null,this.prev=null},ire=function(){function t(i,r){this.frame=i,this.leq=r,this.head=new B5,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 B5;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}(),rre=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 s=i.event,a=r.eUp,o=n.eUp;return a.Dst===s?o.Dst===s?fi.vertLeq(a.Org,o.Org)?fi.edgeSign(o.Dst,a.Org,o.Org)<=0:fi.edgeSign(a.Dst,o.Org,a.Org)>=0:fi.edgeSign(o.Dst,s,o.Org)<=0:o.Dst===s?fi.edgeSign(a.Dst,s,a.Org)>=0:fi.edgeEval(a.Dst,s,a.Org)>=fi.edgeEval(o.Dst,s,o.Org)},t.deleteRegion=function(i,r){r.fixUpperEdge&&Ti(r.eUp.winding===0),r.eUp.activeRegion=null,i.dict.delete(r.nodeUp)},t.fixUpperEdge=function(i,r,n){Ti(r.fixUpperEdge),i.mesh.delete(r.eUp),r.fixUpperEdge=!1,r.eUp=n,n.activeRegion=r},t.topLeftRegion=function(i,r){var n,s=r.eUp.Org;do r=t.regionAbove(r);while(r.eUp.Org===s);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 s=new B3;return s.eUp=n,s.nodeUp=i.dict.insertBefore(r.nodeUp,s),s.fixUpperEdge=!1,s.sentinel=!1,s.dirty=!1,n.activeRegion=s,s},t.isWindingInside=function(i,r){switch(i.windingRule){case ns.ODD:return!!(1&r);case ns.NONZERO:return r!==0;case ns.POSITIVE:return r>0;case ns.NEGATIVE:return r<0;case ns.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,s=n.Lface;s.inside=r.inside,s.anEdge=n,t.deleteRegion(i,r)},t.finishLeftRegions=function(i,r,n){for(var s,a=null,o=r,l=r.eUp;o!==n;){if(o.fixUpperEdge=!1,(s=(a=t.regionBelow(o)).eUp).Org!=l.Org){if(!a.fixUpperEdge){t.finishRegion(i,o);break}s=i.mesh.connect(l.Lprev,s.Sym),t.fixUpperEdge(i,a,s)}l.Onext!==s&&(i.mesh.splice(s.Oprev,s),i.mesh.splice(l,s)),t.finishRegion(i,o),l=a.eUp,o=a}return l},t.addRightEdges=function(i,r,n,s,a,o){var l,h,u,d,c=!0;u=n;do Ti(fi.vertLeq(u.Org,u.Dst)),t.addRegionBelow(i,r,u.Sym),u=u.Onext;while(u!==s);for(a===null&&(a=t.regionBelow(r).eUp.Rprev),h=r,d=a;(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,Ti(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 s=fi.vertL1dist(r,i),a=fi.vertL1dist(n,i),o=.5*a/(s+a),l=.5*s/(s+a);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,s,a,o){r.coords[0]=r.coords[1]=r.coords[2]=0,r.idx=-1,t.vertexWeights(r,n,s),t.vertexWeights(r,a,o)},t.checkForRightSplice=function(i,r){var n=t.regionBelow(r),s=r.eUp,a=n.eUp;if(fi.vertLeq(s.Org,a.Org)){if(fi.edgeSign(a.Dst,s.Org,a.Org)>0)return!1;fi.vertEq(s.Org,a.Org)?s.Org!==a.Org&&(i.pq.delete(s.Org.pqHandle),t.spliceMergeVertices(i,a.Oprev,s)):(i.mesh.splitEdge(a.Sym),i.mesh.splice(s,a.Oprev),r.dirty=n.dirty=!0)}else{if(fi.edgeSign(s.Dst,a.Org,s.Org)<0)return!1;t.regionAbove(r).dirty=r.dirty=!0,i.mesh.splitEdge(s.Sym),i.mesh.splice(a.Oprev,s)}return!0},t.checkForLeftSplice=function(i,r){var n,s=t.regionBelow(r),a=r.eUp,o=s.eUp;if(Ti(!fi.vertEq(a.Dst,o.Dst)),fi.vertLeq(a.Dst,o.Dst)){if(fi.edgeSign(a.Dst,o.Dst,a.Org)<0)return!1;t.regionAbove(r).dirty=r.dirty=!0,n=i.mesh.splitEdge(a),i.mesh.splice(o.Sym,n),n.Lface.inside=r.inside}else{if(fi.edgeSign(o.Dst,a.Dst,o.Org)>0)return!1;r.dirty=s.dirty=!0,n=i.mesh.splitEdge(o),i.mesh.splice(a.Lnext,o.Sym),n.Rface.inside=r.inside}return!0},t.checkForIntersect=function(i,r){var n,s,a=t.regionBelow(r),o=r.eUp,l=a.eUp,h=o.Org,u=l.Org,d=o.Dst,c=l.Dst,p=new F0;if(Ti(!fi.vertEq(c,d)),Ti(fi.edgeSign(d,i.event,h)<=0),Ti(fi.edgeSign(c,i.event,u)>=0),Ti(h!==i.event&&u!==i.event),Ti(!r.fixUpperEdge&&!a.fixUpperEdge),h===u||Math.min(h.t,d.t)>Math.max(u.t,c.t))return!1;if(fi.vertLeq(h,u)){if(fi.edgeSign(c,h,u)>0)return!1}else if(fi.edgeSign(d,u,h)<0)return!1;return t.debugEvent(i),fi.intersect(d,h,c,u,p),Ti(Math.min(h.t,d.t)<=p.t),Ti(p.t<=Math.max(u.t,c.t)),Ti(Math.min(c.s,d.s)<=p.s),Ti(p.s<=Math.max(u.s,h.s)),fi.vertLeq(p,i.event)&&(p.s=i.event.s,p.t=i.event.t),n=fi.vertLeq(h,u)?h:u,fi.vertLeq(n,p)&&(p.s=n.s,p.t=n.t),fi.vertEq(p,h)||fi.vertEq(p,u)?(t.checkForRightSplice(i,r),!1):!fi.vertEq(d,i.event)&&fi.edgeSign(d,i.event,p)>=0||!fi.vertEq(c,i.event)&&fi.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),a),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),a=r,r=t.topRightRegion(r),s=t.regionBelow(r).eUp.Rprev,a.eUp=l.Oprev,l=t.finishLeftRegions(i,a,null),t.addRightEdges(i,r,l.Onext,o.Rprev,s,!0),!0):(fi.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),fi.edgeSign(c,i.event,p)<=0&&(r.dirty=a.dirty=!0,i.mesh.splitEdge(l.Sym),l.Org.s=i.event.s,l.Org.t=i.event.t),!1):(i.mesh.splitEdge(o.Sym),i.mesh.splitEdge(l.Sym),i.mesh.splice(l.Oprev,o),o.Org.s=p.s,o.Org.t=p.t,o.Org.pqHandle=i.pq.insert(o.Org),t.getIntersectData(i,o.Org,h,d,u,c),t.regionAbove(r).dirty=r.dirty=a.dirty=!0,!1)},t.walkDirtyRegions=function(i,r){for(var n,s,a=t.regionBelow(r);;){for(;a.dirty;)r=a,a=t.regionBelow(a);if(!r.dirty&&(a=r,(r=t.regionAbove(r))===null||!r.dirty))return;if(r.dirty=!1,n=r.eUp,s=a.eUp,n.Dst!==s.Dst&&t.checkForLeftSplice(i,r)&&(a.fixUpperEdge?(t.deleteRegion(i,a),i.mesh.delete(s),s=(a=t.regionBelow(r)).eUp):r.fixUpperEdge&&(t.deleteRegion(i,r),i.mesh.delete(n),n=(r=t.regionAbove(a)).eUp)),n.Org!==s.Org){if(n.Dst===s.Dst||r.fixUpperEdge||a.fixUpperEdge||n.Dst!==i.event&&s.Dst!==i.event)t.checkForRightSplice(i,r);else if(t.checkForIntersect(i,r))return}n.Org===s.Org&&n.Dst===s.Dst&&(t.addWinding(s,n),t.deleteRegion(i,r),i.mesh.delete(n),r=t.regionAbove(a))}},t.connectRightVertex=function(i,r,n){var s,a=n.Onext,o=t.regionBelow(r),l=r.eUp,h=o.eUp,u=!1;l.Dst!==h.Dst&&t.checkForIntersect(i,r),fi.vertEq(l.Org,i.event)&&(i.mesh.splice(a.Oprev,l),r=t.topLeftRegion(i,r),a=t.regionBelow(r).eUp,t.finishLeftRegions(i,t.regionBelow(r),o),u=!0),fi.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,a,a,!0):(s=fi.vertLeq(h.Org,l.Org)?h.Oprev:l,s=i.mesh.connect(n.Lprev,s),t.addRightEdges(i,r,s,s.Onext,s.Onext,!1),s.Sym.activeRegion.fixUpperEdge=!0,t.walkDirtyRegions(i,r))},t.connectLeftDegenerate=function(i,r,n){var s,a,o,l,h;return s=r.eUp,fi.vertEq(s.Org,n)?(Ti(!1),void t.spliceMergeVertices(i,s,n.anEdge)):fi.vertEq(s.Dst,n)?(Ti(!1),r=t.topRightRegion(r),a=l=(o=(h=t.regionBelow(r)).eUp.Sym).Onext,h.fixUpperEdge&&(Ti(a!==o),t.deleteRegion(i,h),i.mesh.delete(o),o=a.Oprev),i.mesh.splice(n.anEdge,o),fi.edgeGoesLeft(a)||(a=null),void t.addRightEdges(i,r,o.Onext,l,a,!0)):(i.mesh.splitEdge(s.Sym),r.fixUpperEdge&&(i.mesh.delete(s.Onext),r.fixUpperEdge=!1),i.mesh.splice(n.anEdge,s),void t.sweepEvent(i,n))},t.connectLeftVertex=function(i,r){var n,s,a,o,l,h,u=new B3;if(u.eUp=r.anEdge.Sym,n=i.dict.search(u).key,s=t.regionBelow(n)){if(o=n.eUp,l=s.eUp,fi.edgeSign(o.Dst,r,o.Org)===0)return void t.connectLeftDegenerate(i,n,r);a=fi.vertLeq(l.Dst,o.Dst)?n:s,n.inside||a.fixUpperEdge?(h=a===n?i.mesh.connect(r.anEdge.Sym,o.Lnext):i.mesh.connect(l.Dnext,r.anEdge).Sym,a.fixUpperEdge?t.fixUpperEdge(i,a,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 s=t.topLeftRegion(i,n.activeRegion);Ti(s!==null);var a=t.regionBelow(s),o=a.eUp,l=t.finishLeftRegions(i,a,null);l.Onext===o?t.connectRightVertex(i,s,l):t.addRightEdges(i,s,l.Onext,o,o,!0)},t.addSentinel=function(i,r,n,s){var a=new B3,o=i.mesh.makeEdge();o.Org.s=n,o.Org.t=s,o.Dst.s=r,o.Dst.t=s,i.event=o.Dst,a.eUp=o,a.windingNumber=0,a.inside=!1,a.fixUpperEdge=!1,a.sentinel=!0,a.dirty=!1,a.nodeUp=i.dict.insert(a)},t.initEdgeDict=function(i){i.dict=new ire(i,t.edgeLeq);var r=i.bmax[0]-i.bmin[0],n=i.bmax[1]-i.bmin[1],s=i.bmin[0]-r,a=i.bmax[0]+r,o=i.bmin[1]-n,l=i.bmax[1]+n;t.addSentinel(i,s,a,o),t.addSentinel(i,s,a,l)},t.doneEdgeDict=function(i){for(var r,n=0;(r=i.dict.min().key)!==null;)r.sentinel||(Ti(r.fixUpperEdge),Ti(++n===1)),Ti(r.windingNumber===0),t.deleteRegion(i,r)},t.removeDegenerateEdges=function(i){var r,n,s,a=i.mesh.eHead;for(r=a.next;r!==a;r=n)n=r.next,s=r.Lnext,fi.vertEq(r.Org,r.Dst)&&r.Lnext.Lnext!==r&&(t.spliceMergeVertices(i,s,r),i.mesh.delete(r),s=(r=s).Lnext),s.Lnext===r&&(s!==r&&((s===n||s===n.Sym)&&(n=n.next),i.mesh.delete(s)),(r===n||r===n.Sym)&&(n=n.next),i.mesh.delete(r))},t.initPriorityQ=function(i){var r,n,s,a=0;for(n=(s=i.mesh.vHead).next;n!==s;n=n.next)a++;for(a+=8,r=i.pq=new tre(a,fi.vertLeq),n=(s=i.mesh.vHead).next;n!==s;n=n.next)n.pqHandle=r.insert(n);return n===s&&(r.init(),!0)},t.donePriorityQ=function(i){i.pq=null},t.removeDegenerateFaces=function(i,r){var n,s,a;for(n=r.fHead.next;n!==r.fHead;n=s)s=n.next,Ti((a=n.anEdge).Lnext!==a),a.Lnext.Lnext===a&&(t.addWinding(a.Onext,a),i.mesh.delete(a));return!0},t.computeInterior=function(i,r){var n,s;if(r===void 0&&(r=!0),t.removeDegenerateEdges(i),!t.initPriorityQ(i))return!1;for(t.initEdgeDict(i);(n=i.pq.extractMin())!==null;){for(;(s=i.pq.min())!==null&&fi.vertEq(s,n);)s=i.pq.extractMin(),t.spliceMergeVertices(i,n.anEdge,s.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}(),swe=function(){function t(){this.mesh=new I5,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=ns.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,s,a,o,l,h=[0,0,0],u=[0,0,0],d=[0,0,0],c=[0,0,0],p=[0,0,0],f=[null,null,null],m=[null,null,null],g=this.mesh.vHead;r=g.next;for(var v=0;v<3;++v)a=r.coords[v],u[v]=a,m[v]=r,h[v]=a,f[v]=r;for(r=g.next;r!==g;r=r.next)for(var y=0;y<3;++y)(a=r.coords[y])<u[y]&&(u[y]=a,m[y]=r),a>h[y]&&(h[y]=a,f[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=m[_],s=f[_],d[0]=n.coords[0]-s.coords[0],d[1]=n.coords[1]-s.coords[1],d[2]=n.coords[2]-s.coords[2],r=g.next;r!==g;r=r.next)c[0]=r.coords[0]-s.coords[0],c[1]=r.coords[1]-s.coords[1],c[2]=r.coords[2]-s.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,s=this.mesh.vHead,a=0,o=n.next;o!==n;o=o.next)if(!((r=o.anEdge).winding<=0))do a+=(r.Org.s-r.Dst.s)*(r.Org.t+r.Dst.t),r=r.Lnext;while(r!==o.anEdge);if(a<0){for(i=s.next;i!==s;i=i.next)i.t=-i.t;this.tUnit[0]=-this.tUnit[0],this.tUnit[1]=-this.tUnit[1],this.tUnit[2]=-this.tUnit[2]}},t.prototype.projectPolygon_=function(){var i,r,n=this.mesh.vHead,s=[0,0,0],a=!1;s[0]=this.normal[0],s[1]=this.normal[1],s[2]=this.normal[2],!s[0]&&!s[1]&&!s[2]&&(this.computeNormal_(s),a=!0),i=this.sUnit,r=this.tUnit;var o=this.longAxis_(s);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]=s[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);a&&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,s;if((n=r.anEdge).Lnext===n||n.Lnext.Lnext===n)throw"Mono region invalid";for(;fi.vertLeq(n.Dst,n.Org);n=n.Lprev);for(;fi.vertLeq(n.Org,n.Dst);n=n.Lnext);for(s=n.Lprev;n.Lnext!==s;)if(fi.vertLeq(n.Dst,s.Org)){for(;s.Lnext!==n&&(fi.edgeGoesLeft(s.Lnext)||fi.edgeSign(s.Org,s.Dst,s.Lnext.Dst)<=0);)s=i.connect(s.Lnext,s).Sym;s=s.Lprev}else{for(;s.Lnext!==n&&(fi.edgeGoesRight(n.Lprev)||fi.edgeSign(n.Dst,n.Org,n.Lprev.Org)>=0);)n=i.connect(n,n.Lprev).Sym;n=n.Lnext}if(s.Lnext===n)throw"Mono region invalid";for(;s.Lnext.Lnext!==n;)s=i.connect(s.Lnext,s).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 s,a=i.eHead.next;a!==i.eHead;a=s)s=a.next,a.Rface.inside!==a.Lface.inside?a.winding=a.Lface.inside?r:-r:n?i.delete(a):a.winding=0},t.prototype.getNeighbourFace_=function(i){return i.Rface&&i.Rface.inside?i.Rface.n:-1},t.prototype.outputPolymesh_=function(i,r,n,s){var a,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){a=d.anEdge,o=0;do(u=a.Org).n===-1&&(u.n=h,h++),o++,a=a.Lnext;while(a!==d.anEdge);if(o>n)throw"Face vertex greater that support polygon";d.n=l,++l}for(this.elementCount=l,r===wo.CONNECTED_POLYGONS&&(l*=2),this.elements=[],this.elements.length=l*n,this.vertexCount=h,this.vertices=[],this.vertices.length=h*s,this.vertexIndices=[],this.vertexIndices.length=h,u=i.vHead.next;u!==i.vHead;u=u.next)if(u.n!==-1){var c=u.n*s;this.vertices[c+0]=u.coords[0],this.vertices[c+1]=u.coords[1],s>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){a=d.anEdge,o=0;do u=a.Org,this.elements[p++]=u.n,o++,a=a.Lnext;while(a!==d.anEdge);for(var f=o;f<n;++f)this.elements[p++]=-1;if(r===wo.CONNECTED_POLYGONS){a=d.anEdge;do this.elements[p++]=this.getNeighbourFace_(a),a=a.Lnext;while(a!==d.anEdge);for(var m=o;m<n;++m)this.elements[p++]=-1}}},t.prototype.outputContours_=function(i,r){var n,s,a=0,o=0;this.vertexCount=0,this.elementCount=0;for(var l=i.fHead.next;l!==i.fHead;l=l.next)if(l.inside){s=n=l.anEdge;do this.vertexCount++,n=n.Lnext;while(n!==s);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(a=0,l=i.fHead.next;l!==i.fHead;l=l.next)if(l.inside){o=0,s=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!==s);this.elements[d++]=a,this.elements[d++]=o,a+=o}},t.prototype.addContour=function(i,r){this.mesh===null&&(this.mesh=new I5),i<2&&(i=2),i>3&&(i=3);for(var n=null,s=0;s<r.length;s+=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[s+0],n.Org.coords[1]=r[s+1],n.Org.coords[2]=i>2?r[s+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,s,a,o){if(i===void 0&&(i=ns.ODD),r===void 0&&(r=wo.POLYGONS),o===void 0&&(o=!0),this.vertices=[],this.elements=[],this.vertexIndices=[],this.vertexIndexCounter=0,a&&(this.normal[0]=a[0],this.normal[1]=a[1],this.normal[2]=a[2]),this.windingRule=i,s<2&&(s=2),s>3&&(s=3),!this.mesh)return!1;this.projectPolygon_(),rre.computeInterior(this,o);var l=this.mesh;return r===wo.BOUNDARY_CONTOURS?this.setWindingNumber_(l,1,!0):this.tessellateInterior_(l),o&&l.check(),r===wo.BOUNDARY_CONTOURS?this.outputContours_(l,s):this.outputPolymesh_(l,r,n,s),!0},t}(),ns.ODD,ns.NONZERO,ns.POSITIVE,ns.NEGATIVE,ns.ABS_GEQ_TWO,wo.POLYGONS,wo.CONNECTED_POLYGONS,wo.BOUNDARY_CONTOURS});function awe(e,t){let i=e.length/2;if(i<2)return[];let r=0;for(let l=0;l<i;l++){let h=(l+1)%i;r+=e[2*l]*e[2*h+1]-e[2*h]*e[2*l+1]}let n=r>0!==t?1:-1,s=[];for(let l=0;l<i;l++){let h=(l+1)%i,u=e[2*h]-e[2*l],d=e[2*h+1]-e[2*l+1],c=Math.hypot(u,d);s.push(c>0?[n*d/c,-n*u/c]:[0,0])}let a=Math.cos(40*Math.PI/180),o=(l,h)=>{if(l[0]*h[0]+l[1]*h[1]<=a)return l;let[u,d]=[l[0]+h[0],l[1]+h[1]],c=Math.hypot(u,d);return c>0?[u/c,d/c]:l};return s.map((l,h)=>[o(l,s[(h+i-1)%i]),o(l,s[(h+1)%i])])}function owe(e,t,i){let r=e.length/2,n=new Float32Array(r+1);if(!(t>0)||!(i>0)||r<2)return{u:n,vScale:0};let s=0;for(let a=0;a<r;a++){let o=(a+1)%r;s+=Math.hypot((e[2*o]-e[2*a])/t,(e[2*o+1]-e[2*a+1])/i),n[a+1]=s}return{u:n,vScale:Math.sqrt(t*i)}}function lwe(e,t,i){for(let r=0;r<i.length;r+=3){let n=3*i[r],s=3*i[r+1],a=3*i[r+2],o=e[s]-e[n],l=e[s+1]-e[n+1],h=e[s+2]-e[n+2],u=e[a]-e[n],d=e[a+1]-e[n+1],c=e[a+2]-e[n+2],p=h*u-o*c,f=o*d-l*u;if((l*c-h*d)*(t[n]+t[s]+t[a])+p*(t[n+1]+t[s+1]+t[a+1])+f*(t[n+2]+t[s+2]+t[a+2])<0){let m=i[r+1];i[r+1]=i[r+2],i[r+2]=m}}}var $Y,hwe,XY,uwe=U(()=>{}),YY=U(()=>{$Y={vertices:[160,160,-160,160,-160,-160,160,-160],vertexIndices:[1,0,3,2],vertexCount:4,elements:[0,4],elementCount:1,mesh:void 0},hwe={vertices:[],vertexIndices:[],vertexCount:0,elements:[],elementCount:0,mesh:void 0},XY={vertices:[-160,160,160,-160,160,160,-160,-160],vertexIndices:[1,3,0,2],vertexCount:4,elements:[0,1,2,1,0,3],elementCount:2,mesh:void 0}});function dwe(e,t){return e.normals[3*t+2]<.9999}function cwe(e){let t=NH.get(e);if(t!==void 0)return t;if(!(e.rise>0))return e;let i=new Float32Array(e.normals),r=e.positions.length/3;for(let s=0;s<r;s++){if(!dwe(e,s))continue;let a=i[3*s],o=i[3*s+1],l=Math.hypot(a,o);if(l===0)continue;let h=e.rise-e.positions[3*s+2],u=Math.min(1,Math.max(0,1-h/e.rise)),d=Math.sqrt(1-u*u);i[3*s]=a/l*d,i[3*s+1]=o/l*d,i[3*s+2]=u}let n={...e,normals:i};return NH.set(e,n),n}function pwe(e,t,i,r){let n=(t-e.minX)/e.spanX,s=(i-e.minY)/e.spanY;return r?[s,n]:[n,s]}var NH,e4,IH,KY=U(()=>{NH=new WeakMap}),bBe=U(()=>{ae(),iC(),jr(),uwe(),YY(),KY(),e4=class extends At{constructor(e,t,i=12,r=ns.ODD,n,s=!1){super(),this.type="FlatExtrusionGeometry",this._nearSide=new Uint8Array(0),this._vScale=0,this._shape=e,this._depth=t,this._curveSegments=i,this._windingRule=r,this._uvPitch=s?void 0:n,this._legacy=s;let a,o=[e.extractShapePointsToFlatArray([],i),...e.shapeHoles.map(B=>B.extractShapePointsToFlatArray([],i))];try{a=zE({contours:o,windingRule:r,elementType:wo.POLYGONS,polySize:3,vertexSize:2,strict:!0})}catch{a=XY}let l=a?.vertexCount??0,h=a?.elementCount??0,u=1/0,d=1/0,c=-1/0,p=-1/0;for(let B of o)for(let V=0;V<B.length;V+=2)B[V]<u&&(u=B[V]),B[V]>c&&(c=B[V]),B[V+1]<d&&(d=B[V+1]),B[V+1]>p&&(p=B[V+1]);let f=this._uvPitch,m=f??(c-u||1),g=f??(p-d||1),v=f===void 0?u:0,y=f===void 0?d:0,_=o.map((B,V)=>awe(B,V>0)),b=0;for(let B of _)b+=B.length;let x=2*l+4*b,w=3*h*2+6*b,S=new Float32Array(3*x),T=new Float32Array(3*x),M=new Float32Array(2*x),E=new Uint32Array(w),A=new Uint8Array(x),P=0,N=0,D=0,O=!1,z=(B,V,j,K,$,Q,ce=(B-v)/m,pe=(V-y)/g)=>{let ye=3*N;S[ye]=B,S[ye+1]=V,S[ye+2]=j,T[ye]=K,T[ye+1]=$,T[ye+2]=Q,A[N]=j===t?O?2:1:0,M[2*N]=ce,M[2*N+1]=pe,N++};if(a!==void 0)for(let[B,V]of[[t,1],[0,-1]]){let j=N;for(let K=0;K<l;K++)z(a.vertices[2*K],a.vertices[2*K+1],B,0,0,V);for(let K=0;K<h;K++){let[$,Q,ce]=[a.elements[3*K],a.elements[3*K+1],a.elements[3*K+2]];E[D++]=j+$,E[D++]=j+(V>0?Q:ce),E[D++]=j+(V>0?ce:Q)}}O=!0;for(let B=0;B<o.length;B++){let V=o[B],j=_[B],K=V.length/2,{u:$,vScale:Q}=s?{u:new Float32Array(K+1),vScale:0}:owe(V,m,g);P=Q;let ce=Q===0?0:t/Q,pe={minX:v,minY:y,spanX:m,spanY:g},ye=(we,[ne,Se],W,k)=>{let Y=V[2*we],ie=V[2*we+1],[G,oe]=s?pwe(pe,Y,ie,W):[k,W?0:ce];z(Y,ie,W?0:t,ne,Se,0,G,oe)};for(let we=0;we<j.length;we++){let ne=(we+1)%K,[Se,W]=j[we],[k,Y]=[$[we],$[we+1]],ie=N;ye(we,Se,!1,k),ye(we,Se,!0,k),ye(ne,W,!1,Y),ye(ne,W,!0,Y),E[D++]=ie,E[D++]=ie+1,E[D++]=ie+2,E[D++]=ie+3,E[D++]=ie+2,E[D++]=ie+1}}lwe(S,T,E),this.setAttribute("position",new Dt(S,3)),this.setAttribute("normal",new Dt(T,3)),this.setAttribute("uv",new Dt(M,2)),this.setIndex(new Dt(E,1)),this._nearSide=A,this._vScale=P}takeDepthStateFrom(e){let t=e;t._nearSide!==void 0&&(this._depth=t._depth??this._depth,this._nearSide=t._nearSide,this._vScale=t._vScale??this._vScale)}canShiftDepthTo(e){return this._nearSide.length>0&&this._depth>0&&e>0}shiftDepthTo(e){if(!this.canShiftDepthTo(e))return!1;let t=e-this._depth;if(this._depth=e,t===0)return!0;let i=this.getAttribute("position");if(i===void 0)return!1;let r=i.array,n=this.getAttribute("uv"),s=n?.array,a=this._vScale>0?t/this._vScale:0,o=this._nearSide;for(let l=0;l<o.length;l++){let h=o[l];h!==0&&(r[3*l+2]+=t,h===2&&s!==void 0&&(s[2*l+1]+=a))}return i.needsUpdate=!0,n!==void 0&&a!==0&&(n.needsUpdate=!0),this.refreshDepthBounds(e),!0}refreshDepthBounds(e){if(this.boundingBox===null&&this.boundingSphere===null)return;this.boundingBox===null&&this.computeBoundingBox();let t=this.boundingBox;t.min.z=Math.min(0,e),t.max.z=Math.max(0,e),this.boundingSphere!==null&&t.getBoundingSphere(this.boundingSphere)}clone(){let e=new e4(this._shape,this._depth,this._curveSegments,this._windingRule,this._uvPitch,this._legacy);return e.userData=dB(this.userData),e}}}),fwe=U(()=>{ae(),iC(),jr(),YY(),IH=class extends At{constructor(e,t=12,i={}){super(),this.type="ShapeGeometry",this.windingRule=ns.ODD,this.elementType=wo.POLYGONS,this.polySize=3,this.vertexSize=2,this.strict=!0,this._shape=e,this._curveSegments=t,this._triangulationOptions=Object.assign({windingRule:ns.ODD,elementType:wo.POLYGONS,polySize:3,vertexSize:2,strict:!0},i);let r,n,s,a=this._shape.extractShapePointsToFlatArray([],this._curveSegments),o=this._shape.shapeHoles.map(c=>c.extractShapePointsToFlatArray([],this._curveSegments)),l=!0,h=!0;for(let c=0,p=a.length/2;c<p;c++){let f=2*c,m=a[f+0],g=a[f+1];if(n!==void 0&&m!==n&&(l=!1),s!==void 0&&g!==s&&(h=!1),n=m,s=g,!l&&!h)break}if(!l&&!h)try{r=zE({contours:[a,...o],windingRule:this._triangulationOptions.windingRule,elementType:this._triangulationOptions.elementType,polySize:this._triangulationOptions.polySize,vertexSize:this._triangulationOptions.vertexSize,strict:this._triangulationOptions.strict})}catch{r=$Y}let u=r?.vertexCount??1,d=r?.elementCount??1;if(this._positionAttribute=new Dt(new Float32Array(3*u),3),this._normalAttribute=new Dt(new Float32Array(3*u),3),this._uvAttribute=new Dt(new Float32Array(2*u),2),this._indexAttribute=new Dt(new Uint32Array(3*d),1),r){let c=1/0,p=-1/0,f=1/0,m=-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<f&&(f=w),w>m&&(m=w)}let g=p-c,v=m-f;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,T=(w-f)/v;this._positionAttribute.setXYZ(y,x,w,0),this._normalAttribute.setXYZ(y,0,0,1),this._uvAttribute.setXY(y,S,T)}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 IH(this._shape,this._curveSegments);return e.userData=dB(this.userData),e}}});function xBe(e){return nre||(nre=async function(){let t=e??"https://unpkg.com/@splinetool/runtime@2.0.122/build",i=Promise.resolve().then(()=>(aQ(),sQ)),[r,n]=await Promise.all([i,fetch(`${t}/bevel.wasm`).then(s=>s.arrayBuffer())]);await r.default({module_or_path:n}),rC=r}())}function wBe(e){let t=!1;return e.scene.objects.traverse((i,r)=>{let n=r.geometry;if(n!==void 0&&(ywe.has(n.type)&&n.depth!==void 0&&n.depth>0&&(n.extrudeBevelSize??0)>0&&(t=!0),n.type==="PathGeometry")){let s=n.extrusion;s!==void 0&&s.capType==="round"&&(s.bevel??0)>0&&(t=!0)}}),t}function mwe(e,t){let i=[e.extractShapePointsToFlatArray([],t)];for(let o of e.shapeHoles)i.push(o.extractShapePointsToFlatArray([],t));let r=0;for(let o of i)r+=o.length>>1;let n=new Float64Array(2*r),s=new Uint32Array(i.length),a=0;for(let o=0;o<i.length;o++)n.set(i[o],2*a),a+=i[o].length>>1,s[o]=a;return{points:n,ends:s}}function t4(e,t,i,r,n,s){let a=e.positions.length/3,o=n.elements,l=_we.getNormalMatrix(n).elements;for(let u=0;u<a;u++){let d=3*u,c=3*(i+u),p=e.positions[d],f=e.positions[d+1],m=e.positions[d+2];t.positions[c]=o[0]*p+o[4]*f+o[8]*m+o[12],t.positions[c+1]=o[1]*p+o[5]*f+o[9]*m+o[13],t.positions[c+2]=o[2]*p+o[6]*f+o[10]*m+o[14];let g=e.normals[d],v=e.normals[d+1],y=e.normals[d+2];t.normals[c]=l[0]*g+l[3]*v+l[6]*y,t.normals[c+1]=l[1]*g+l[4]*v+l[7]*y,t.normals[c+2]=l[2]*g+l[5]*v+l[8]*y;let _=2*(i+u);if(s===void 0)t.uvs[_]=e.uvs[2*u],t.uvs[_+1]=e.uvs[2*u+1];else{let[b,x]=s(p,f,e.uvs[2*u],e.uvs[2*u+1],u);t.uvs[_]=b,t.uvs[_+1]=x}}let h=n.determinant()<0;for(let u=0;u<e.indices.length;u+=3)t.indices[r+u]=e.indices[u]+i,t.indices[r+u+1]=e.indices[u+(h?2:1)]+i,t.indices[r+u+2]=e.indices[u+(h?1:2)]+i}function gwe(e){let{owner:t,shape:i,curveSegments:r,assembledAt:n,bevel:s,bevelSegments:a}=e,o=function(c,p){let f=[p],m=g=>{f.push(g.points.length,g.isClosed?1:0,g.roundness??0);for(let v of g.points){f.push(v.roundness??0,v.position.x,v.position.y);for(let y of v.controls)f.push(y.position.x,y.position.y)}f.push(g.shapeHoles.length);for(let v of g.shapeHoles)m(v)};return m(c),function(g){let v=2166136261;for(let y=0;y<g.length;y++)v^=g[y],v=Math.imul(v,16777619)>>>0;return v}(new Uint8Array(new Float64Array(f).buffer))}(i,r),l=t??`outline:${o}`,h=`${s}/${a}`,u=i4.get(l);if(u!==void 0&&u.outlineVersion===o&&u.capKey===h&&(e.stillServes?.(u)??1))return OH.placements++,u.cap;let d=function(c,p,f,m,g){let{points:v,ends:y}=mwe(c,p);return rC.assemble_cap(v,y,f,m,0,Math.max(1,Math.floor(g)),vwe,40)}(i,r,n,s,a);OH.assemblies++;try{let c=function(p,f){return function(m,g,v,y,_){let b=1/0;for(let x=2;x<m.length;x+=3)m[x]<b&&(b=m[x]);if(b===1/0&&(b=0),b!==0)for(let x=2;x<m.length;x+=3)m[x]-=b;return{positions:m,normals:g,uvs:v,indices:y,rise:_-b}}(p.positions(),p.normals(),p.uvs(),p.indices(),f)}(d,n);return i4.set(l,{outlineVersion:o,capKey:h,assembledAt:n,cap:c}),c}finally{d.free()}}function ax(e,t){return .5*t>1.001*e}var rC,vwe,nre,ywe,_we,sre,are,ore,i4,OH,LH,a0,Ew=U(()=>{ae(),jr(),uwe(),KY(),vwe=.4,ywe=new Set(["VectorGeometry","TextGeometry","InputGeometry","PolygonGeometry","RectangleGeometry","StarGeometry","TriangleGeometry","EllipseGeometry"]),_we=new oi,sre=new Ue,are=new Ue,ore=new Ue().makeScale(1,1,-1),i4=new Map,OH={assemblies:0,placements:0},LH=class extends At{constructor(e,t,i=0,r=12,n=3,s,a,o=!1){if(super(),this.type="ShapeGeometry",this._nearSide=new Uint8Array(0),this._effectiveBevel=0,this._vScale=0,rC===void 0)throw new Error("bevel-wasm is not loaded");this._shape=e,this._uvPitch=a,this._legacy=o,this._depth=t,this._bevel=i,this._curveSegments=r,this._bevelSegments=n,this._ownerId=s,this.rebuild()}takeDepthStateFrom(e){let t=e;t._nearSide!==void 0&&(this._depth=t._depth??this._depth,this._nearSide=t._nearSide,this._vScale=t._vScale??this._vScale,this._effectiveBevel=t._effectiveBevel??this._effectiveBevel)}canShiftDepthTo(e){return this._nearSide.length>0&&ax(this._effectiveBevel,e)&&ax(this._effectiveBevel,this._depth)}shiftDepthTo(e){if(!this.canShiftDepthTo(e))return!1;let t=e-this._depth;if(this._depth=e,t===0)return!0;let i=this.getAttribute("position");if(i===void 0)return!1;let r=i.array,n=this.getAttribute("uv"),s=n?.array,a=this._vScale>0?t/this._vScale:0,o=this._nearSide;for(let l=0;l<o.length;l++){let h=o[l];h!==0&&(r[3*l+2]+=t,h===2&&s!==void 0&&(s[2*l+1]+=a))}return i.needsUpdate=!0,n!==void 0&&a!==0&&(n.needsUpdate=!0),this.refreshDepthBounds(e),!0}refreshDepthBounds(e){if(this.boundingBox===null&&this.boundingSphere===null)return;this.boundingBox===null&&this.computeBoundingBox();let t=this.boundingBox;t.min.z=Math.min(0,e),t.max.z=Math.max(0,e),this.boundingSphere!==null&&t.getBoundingSphere(this.boundingSphere)}setDepth(e){e!==this._depth&&(this._depth=e,this.rebuild(),this.computeBoundingSphere(),this.computeBoundingBox())}rebuild(){let e=gwe({owner:this._ownerId,shape:this._shape,curveSegments:this._curveSegments,assembledAt:this._depth,bevel:this._bevel,bevelSegments:this._bevelSegments,stillServes:a=>ax(a.cap.rise,this._depth)&&ax(a.cap.rise,a.assembledAt)}),t=function(a,o,l,h,u,d=!1){let c=h.positions.length/3,p=l-h.rise,f=h.rise,{points:m,ends:g}=mwe(a,o),v=1/0,y=1/0,_=-1/0,b=-1/0;for(let pe=0;pe<m.length;pe+=2)m[pe]<v&&(v=m[pe]),m[pe]>_&&(_=m[pe]),m[pe+1]<y&&(y=m[pe+1]),m[pe+1]>b&&(b=m[pe+1]);d&&(u=void 0);let x=u??_-v,w=u??b-y,S={minX:v,minY:y,spanX:_-v||1,spanY:b-y||1},T=[],M=0;for(let pe of g)T.push({at:M,count:pe-M}),M=pe;let E=0;for(let pe of T)E+=pe.count;let A=2*c+4*E,P=new Float32Array(3*A),N=new Float32Array(3*A),D=new Float32Array(2*A),O=new Uint32Array(2*h.indices.length+6*E),z=new Uint8Array(A),B=0,V=u===void 0?void 0:(pe,ye)=>[pe/u,ye/u],j=d?(pe,ye,we,ne,Se)=>dwe(h,Se)?[ne,we]:[we,ne]:V,K=d?cwe(h):h,$={positions:P,normals:N,uvs:D,indices:O};t4(K,$,0,0,sre.makeTranslation(0,0,p),V),t4(K,$,c,h.indices.length,are.makeTranslation(0,0,f).multiply(ore),j),z.fill(1,0,c);let Q=2*c,ce=2*h.indices.length;for(let pe=0;pe<T.length;pe++){let{at:ye,count:we}=T[pe],ne=m.subarray(2*ye,2*(ye+we)),Se=awe(ne,pe>0),W=d?{u:new Float32Array(we+1),vScale:0}:owe(ne,x,w),k=W.u;B=W.vScale;for(let Y=0;Y<we;Y++){let ie=(Y+1)%we,[G,oe]=Se[Y],se=Q;for(let[H,me,xe,ke,Te,Ze]of[[ne[2*Y],ne[2*Y+1],G,p,k[Y],2],[ne[2*ie],ne[2*ie+1],oe,p,k[Y+1],2],[ne[2*ie],ne[2*ie+1],oe,f,k[Y+1],0],[ne[2*Y],ne[2*Y+1],G,f,k[Y],0]]){let ze=3*Q;if(P[ze]=H,P[ze+1]=me,P[ze+2]=ke,N[ze]=xe[0],N[ze+1]=xe[1],N[ze+2]=0,d){let[qe,Ne]=pwe(S,H,me,Ze===0);D[2*Q]=qe,D[2*Q+1]=Ne}else D[2*Q]=Te,D[2*Q+1]=B===0?0:(ke-f)/B;z[Q]=Ze,Q++}O[ce++]=se,O[ce++]=se+1,O[ce++]=se+2,O[ce++]=se,O[ce++]=se+2,O[ce++]=se+3}}return lwe(P,N,O),{positions:P,normals:N,uvs:D,indices:O,nearSide:z,vScale:B}}(this._shape,this._curveSegments,this._depth,e,this._uvPitch,this._legacy);this._nearSide=t.nearSide,this._vScale=t.vScale,this._effectiveBevel=e.rise;let i=this.getAttribute("position"),r=this.getAttribute("normal"),n=this.getAttribute("uv"),s=this.getIndex();if(i!==void 0&&r!==void 0&&n!==void 0&&s!==null&&i.array.length===t.positions.length&&r.array.length===t.normals.length&&n.array.length===t.uvs.length&&s.array.length===t.indices.length)return i.array.set(t.positions),r.array.set(t.normals),n.array.set(t.uvs),s.array.set(t.indices),i.needsUpdate=!0,r.needsUpdate=!0,n.needsUpdate=!0,void(s.needsUpdate=!0);this.setAttribute("position",new Dt(t.positions,3)),this.setAttribute("normal",new Dt(t.normals,3)),this.setAttribute("uv",new Dt(t.uvs,2)),this.setIndex(new Dt(t.indices,1))}clone(){let e=new LH(this._shape,this._depth,this._bevel,this._curveSegments,this._bevelSegments,this._ownerId,this._uvPitch,this._legacy);return e.userData=dB(this.userData),e}}}),Qg=U(()=>{s0(),bBe(),fwe(),Ew(),iC(),a0=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:ns.ODD},e.parameters),n=Math.abs(r.width),s=Math.abs(r.height??r.width),a=Math.abs(r.depth??0),o=e.shape??t?.shape,l=o?.roundness??r.roundness;o!==void 0&&(o instanceof ps?(i=o,(i.width!==n||i.height!==s)&&i.applySize(n,s)):i=new ps(n,s).fromJSON(o),e.parameters?.roundness!==void 0&&e.parameters?.roundness>0&&i.update());let h=i??new ps(n,s);return{parameters:Object.assign(r,{width:n,height:s,depth:a,roundness:l}),shape:h,ownerId:e.ownerId??t?.ownerId}}static build(e){let t,{depth:i,extrudeBevelSize:r,extrudeBevelSegments:n,subdivisions:s,roundness:a,windingRule:o,uvPitch:l,extrusionVersion:h}=e.parameters,u=h===1;return e.shape.roundness=a,i<=0?t=new IH(e.shape,s,{windingRule:o}):r<=0?t=new e4(e.shape,i,s,o,l,u):rC!==void 0?t=new LH(e.shape,i,r,s,n,e.ownerId,l,u):(console.error("[extrude] engine not loaded \u2014 extruding without a bevel"),t=new e4(e.shape,i,s,o,l,u)),Object.assign(t,{userData:{...e,type:"VectorGeometry"}})}}});function SBe(e,t,i,r,n,s){if(r>=ZY)return n>30||n%4==0?(function(u,d,c,p=0,f=0,m=0){let g=.5522847498,v=d*g,y=c*g;u.addPoint(F3(f-d,m,f-d,m-y,f-d,m+y)),u.addPoint(F3(f,m+c,f-v,m+c,f+v,m+c)),u.addPoint(F3(f+d,m,f+d,m+y,f+d,m-y)),u.addPoint(F3(f,m-c,f+v,m-c,f-v,m-c)),p>0&&xwe(u,d,c,p)}(e,t,i,s),Math.round(n/4)):lre(e,r,n,t,i,s);let a={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:f,ry:m,largeArcFlag:g,sweepFlag:v}){let y=[];if(f===0||m===0)return[];let _=(u-c)/2,b=(d-p)/2;if(_===0&&b===0)return[];f=Math.abs(f),m=Math.abs(m);let x=Math.pow(_,2)/Math.pow(f,2)+Math.pow(b,2)/Math.pow(m,2);x>1&&(f*=Math.sqrt(x),m*=Math.sqrt(x));let w=function(N,D,O,z,B,V,j,K,$,Q){let ce=Math.pow(B,2),pe=Math.pow(V,2),ye=Math.pow(j,2),we=Math.pow(K,2),ne=ce*pe-ce*we-pe*ye;ne<0&&(ne=0),ne/=ce*we+pe*ye,ne=Math.sqrt(ne)*($===Q?-1:1);let Se=ne*B/V*K,W=ne*-V/B*j,k=Se+(N+O)/2,Y=W+(D+z)/2,ie=(j-Se)/B,G=(K-W)/V,oe=(-j-Se)/B,se=(-K-W)/V,H=ere(1,0,ie,G),me=ere(ie,G,oe,se);return!Q&&me>0&&(me-=XI),Q&&me<0&&(me+=XI),{centerx:k,centery:Y,ang1:H,ang2:me}}(u,d,c,p,f,m,_,b,g,v),{ang1:S,ang2:T}=w,{centerx:M,centery:E}=w,A=Math.abs(T)/(XI/4);Math.abs(1-A)<1e-7&&(A=1);let P=Math.max(Math.ceil(A),1);T/=P;for(let N=0;N<P;N++)y.push(yBe(S,T)),S+=T;return y.map(N=>{let{x:D,y:O}=N5(N[0],f,m,M,E),{x:z,y:B}=N5(N[1],f,m,M,E),{x:V,y:j}=N5(N[2],f,m,M,E);return{x1:D,y1:O,x2:z,y2:B,x:V,y:j}})}({px:a.x,py:a.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,f,m,g,v){let y=Math.round(f/p.length);u.addPoint(Px(d,c));for(let _=0,b=p.length;_<b;_++){let x=p[_],w=u.points[_],S=Px(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?bwe(u,m,g,v):u.addPoint(Px(0,0)),y}(e,a.x,a.y,h,n,t,i,s):lre(e,r,n,t,i,s)}function lre(e,t,i,r,n,s){let a=-t/i;for(let o=0;o<=i;o++){let l=a*o,h=Math.sin(l)*r,u=Math.cos(l)*n;e.addPoint(Px(h,u))}return t<ZY?s>0?bwe(e,r,n,s):e.addPoint(Px(0,0)):(e.removePoint(e.points[e.points.length-1]),s>0&&xwe(e,r,n,s)),1}function Px(e,t){return new wy(et.generateUUID(),new Z(e,t))}function F3(e,t,i,r,n,s){let a=Px(e,t);return a.controls[0].position.set(i,r),a.controls[1].position.set(n,s),a}function bwe(e,t,i,r){wwe(e,t,i,r).forEach(n=>e.addPoint(n))}function xwe(e,t,i,r){let n=wwe(e,t,i,r),s=new ps;n.forEach(a=>s.addPoint(a)),s.isClosed=!0,e.shapeHoles.push(s)}function wwe(e,t,i,r){let n=r*t/100,s=n*(Math.abs(i)/Math.abs(t)),a=new Z(n/t,s/i),o=e.points.map(l=>{let h=l.clone();return h.uuid=et.generateUUID(),h}).reverse();return o.forEach(l=>{l.position.multiply(a);let h=l.controls[0].position.clone().multiply(a),u=l.controls[1].position.clone().multiply(a);l.controls[0].position.copy(u),l.controls[1].position.copy(h)}),o}var ZY,CB,Swe,F5,Twe,r4=U(()=>{s0(),nwe(),_Be(),Qg(),ae(),ZY=2*Math.PI,CB=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=et.clamp(i.angle,0,360),{shape:e.shape&&e.shape instanceof ps?e.shape:new ps,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:s,innerRadius:a,depth:o,extrudeBevelSize:l,extrudeBevelSegments:h,extrusionVersion:u}=e.parameters,d=e.shape,c=SBe(d,.5*i,.5*r,s*Math.PI/180,n,a);return d.isClosed=!0,d.update(),s===0?(t=new At,t.setAttribute("position",new Et([],3))):t=a0.create({shape:d,parameters:{subdivisions:c,depth:o,extrudeBevelSize:l,extrudeBevelSegments:h,extrusionVersion:u}}),Object.assign(t,{userData:{...e,type:"EllipseGeometry"}})}}}),hre=U(()=>{ae(),Qxe(),Swe=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:s,cornerSides:a}=e.parameters,o=n===0&&s!==0?new F5(.5*t,s,a):new hW(.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"}})}},F5=class extends QL{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 F5(e.radius,e.corner,e.cornerSides)}}}),ure=U(()=>{ae(),Twe=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 vA;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 s=new uW(n.extractPoints(r).shape,i);return s.rotateZ(Math.PI),Object.assign(s,{userData:{...e,type:"LatheGeometry"}})}}});function Q1(e,t){return Math.abs(t-e)/2+Math.min(e,t)}function TBe(e){let{positions:t,faces:i,materialIndices:r,uvs:n}=e,s=t.length/3,a=i.length/3,o=n!==null&&a>0,l=3*a,h=new Uint32Array(l),u=new Uint32Array(l),d=new Uint32Array(l),c=new Uint32Array(l),p=new Uint32Array(l),f=0,m=8;for(;m<2*l;)m*=2;let g=m-1,v=new Int32Array(m).fill(-1),y=(D,O)=>{let z=(Math.imul(D,2654435761)^O)&g;for(;;){let B=v[z];if(B===-1)return v[z]=f,h[f]=D,u[f]=O,f++;if(h[B]===D&&u[B]===O)return B;z=z+1&g}},_=(D,O)=>{let z=D<O?D:O,B=D<O?O:D,V=(Math.imul(z,2654435761)^B)&g;for(;;){let j=v[V];if(h[j]===z&&u[j]===B)return j;V=V+1&g}},b=new Uint32Array(s),x=new Float64Array(3*s),w=(D,O,z)=>{let B=D<O?y(D,O):y(O,D),V=++d[B];V===1?c[B]=z:V===2&&(p[B]=z),b[D]++,b[O]++,x[3*D]+=t[3*O],x[3*D+1]+=t[3*O+1],x[3*D+2]+=t[3*O+2],x[3*O]+=t[3*D],x[3*O+1]+=t[3*D+1],x[3*O+2]+=t[3*D+2]};for(let D=0;D<a;D++){let O=i[3*D],z=i[3*D+1],B=i[3*D+2];w(O,z,B),w(z,B,O),w(B,O,z)}let S=new Float64Array(3*f);for(let D=0;D<f;D++){let O=3*h[D],z=3*u[D];if(d[D]===2){let B=3*c[D],V=3*p[D];S[3*D]=.375*(t[O]+t[z])+.125*(t[B]+t[V]),S[3*D+1]=.375*(t[O+1]+t[z+1])+.125*(t[B+1]+t[V+1]),S[3*D+2]=.375*(t[O+2]+t[z+2])+.125*(t[B+2]+t[V+2])}else S[3*D]=.5*(t[O]+t[z]),S[3*D+1]=.5*(t[O+1]+t[z+1]),S[3*D+2]=.5*(t[O+2]+t[z+2])}let T,M=new Float64Array(3*s);for(let D=0;D<s;D++){let O=b[D];O===3?T=3/16:O>3&&(T=3/(8*O));let z=1-O*Number(T),B=Number(T);O===2&&(z=3/4,B=1/8),M[3*D]=t[3*D]*z+x[3*D]*B,M[3*D+1]=t[3*D+1]*z+x[3*D+1]*B,M[3*D+2]=t[3*D+2]*z+x[3*D+2]*B}let E=new Float64Array(3*(s+f));E.set(M),E.set(S,3*s);let A=new Uint32Array(12*a),P=new Array(4*a),N=o?new Float64Array(24*a):null;for(let D=0;D<a;D++){let O=i[3*D],z=i[3*D+1],B=i[3*D+2],V=_(O,z)+s,j=_(z,B)+s,K=_(B,O)+s,$=12*D;A[$++]=V,A[$++]=j,A[$++]=K,A[$++]=O,A[$++]=V,A[$++]=K,A[$++]=z,A[$++]=j,A[$++]=V,A[$++]=B,A[$++]=K,A[$++]=j;let Q=r[D];if(P[4*D]=Q,P[4*D+1]=Q,P[4*D+2]=Q,P[4*D+3]=Q,N!==null){let ce=6*D,pe=n[ce],ye=n[ce+1],we=n[ce+2],ne=n[ce+3],Se=n[ce+4],W=n[ce+5],k=Q1(pe,we),Y=Q1(ye,ne),ie=Q1(we,Se),G=Q1(ne,W),oe=Q1(pe,Se),se=Q1(ye,W),H=24*D;N[H++]=k,N[H++]=Y,N[H++]=ie,N[H++]=G,N[H++]=oe,N[H++]=se,N[H++]=pe,N[H++]=ye,N[H++]=k,N[H++]=Y,N[H++]=oe,N[H++]=se,N[H++]=we,N[H++]=ne,N[H++]=ie,N[H++]=G,N[H++]=k,N[H++]=Y,N[H++]=Se,N[H++]=W,N[H++]=oe,N[H++]=se,N[H++]=ie,N[H++]=G}}return{positions:E,faces:A,materialIndices:P,uvs:N}}var U3,Mwe,ta,Ewe,QY,MBe=U(()=>{ae(),U3=1e4,Mwe=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 s=r.getAttribute("uv"),a=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(_*U3),S=Math.round(b*U3),T=Math.round(x*U3),M=l.get(w);M===void 0&&(M=new Map,l.set(w,M));let E=M.get(S);E===void 0&&(E=new Map,M.set(S,E));let A=E.get(T);A===void 0&&(A=d++,E.set(T,A),u.push(_,b,x)),h[y]=A}let c=[],p=[],f=s===void 0?null:[],m=a!==null?a.count:o,g=(y,_)=>{let b=a!==null?a.getX(y):y,x=a!==null?a.getX(y+1):y+1,w=a!==null?a.getX(y+2):y+2;if(!(b<o&&x<o&&w<o))return;let S=h[b],T=h[x],M=h[w];S===T||T===M||M===S||(c.push(S,T,M),p.push(_),f!==null&&f.push(s.getX(b),s.getY(b),s.getX(x),s.getY(x),s.getX(w),s.getY(w)))},v=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,m);for(let S=x;S<w&&S+2<m;S+=3)g(S,b)}else for(let y=0;y+2<m;y+=3)g(y,0);return{positions:Float64Array.from(u),faces:Uint32Array.from(c),materialIndices:p,uvs:f===null?null:Float64Array.from(f)}}(e),i=this.subdivisions;for(;i-- >0;)t=TBe(t);return function(r,n){let{positions:s,faces:a,materialIndices:o,uvs:l}=r,h=s.length/3,u=a.length/3,d=new Float64Array(3*h);for(let v=0;v<u;v++){let y=3*a[3*v],_=3*a[3*v+1],b=3*a[3*v+2],x=s[b]-s[_],w=s[b+1]-s[_+1],S=s[b+2]-s[_+2],T=s[y]-s[_],M=s[y+1]-s[_+1],E=s[y+2]-s[_+2],A=w*E-S*M,P=S*T-x*E,N=x*M-w*T;d[y]+=A,d[y+1]+=P,d[y+2]+=N,d[_]+=A,d[_+1]+=P,d[_+2]+=N,d[b]+=A,d[b+1]+=P,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),f=new Float32Array(3*c),m=l!==null&&l.length>0?new Float32Array(2*c):null;for(let v=0;v<c;v++){let y=3*a[v];p[3*v]=s[y],p[3*v+1]=s[y+1],p[3*v+2]=s[y+2],f[3*v]=d[y],f[3*v+1]=d[y+1],f[3*v+2]=d[y+2]}m!==null&&m.set(l.subarray(0,2*c));let g=new At;g.setAttribute("position",new Dt(p,3)),c>0&&(g.setAttribute("normal",new Dt(f,3)),g.setAttribute("color",new Dt(new Float32Array(3*c).fill(1),3))),m!==null&&g.setAttribute("uv",new Dt(m,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)}}}),dre=U(()=>{ae(),MBe(),ta=new R,Ewe=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 Ih(100,100,100));t===void 0?(r.computeBoundingBox(),r.boundingBox.getSize(ta),i={width:ta.x,height:ta.y,depth:ta.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,s=e.geometry??new At().copy(new Ih(100,100,100)),a=s.userData.parameters;a===void 0?(s.boundingBox=function(l){let h=new pn,u=l.attributes.position;return u?(h.setFromBufferAttribute(u),h):(h.makeEmpty(),h)}(s),s.boundingBox.getSize(ta)):ta.set(a.width,a.height,a.depth),(t!==ta.x||i!==ta.y||r!==ta.z)&&s.scale(ta.x===0?1:t/ta.x,ta.y===0?1:i/ta.y,ta.z===0?1:r/ta.z);let o=s.originalGeometry;try{n>0?(o===void 0||a?.subdivisions!==n)&&(o===void 0&&(o=s),s=new Mwe(n).modify(o)):(o!==void 0&&(s=o),o=void 0,s.getAttribute("normal")===void 0&&s.computeVertexNormals())}catch{o!==void 0&&(s=o),o=void 0,s.getAttribute("normal")===void 0&&s.computeVertexNormals()}return o!==void 0&&Object.assign(s,{originalGeometry:o}),delete e.geometry,Object.assign(s,{userData:{...e,type:"NonParametricGeometry"}})}static loadFromUrl(e,t,i){new JX(i).load(e,r=>{let n=this.normalizeInputs({geometry:r});r.boundingBox.getSize(ta);let s=100/ta.x;Object.assign(n.parameters,{width:100,height:ta.y*s,depth:ta.z*s}),t(this.build(n))})}}}),BH=U(()=>{s0(),Qg(),QY=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 ps?e.shape:new ps,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:s,extrudeBevelSize:a,extrudeBevelSegments:o,extrusionVersion:l}=e.parameters,h=e.shape,u=.5*t,d=.5*i,c=2*Math.PI/r;for(let f=0;f<r;f++){let m=c*f,g=0+Math.sin(m)*u,v=0+Math.cos(m)*d;h.addPoint(h.createPoint(g,v))}h.isClosed=!0;for(let f=0,m=h.points.length;f<m;f++)h.points[f].roundness=n;h.roundness=n,h.update();let p=a0.create({shape:h,parameters:{roundness:n,depth:s,extrudeBevelSize:a,extrudeBevelSegments:o,extrusionVersion:l}});return Object.assign(p,{userData:{...e,type:"PolygonGeometry"}})}}});function HS(e,t,i){i.x=e.x*t.x,i.y=e.y,i.z=e.x*t.y}function U5(e,t,i,r,n,s){let a=Cwe.copy(t).sub(e),o=Pwe.copy(i).sub(e),l=a.angleTo(o);if(a.normalize(),o.normalize(),r===n){let h=a.add(o).normalize();s.copy(e).addScaledVector(h,r/Math.sin(l/2))}else{let h=a.angleTo(o);s.copy(e),s.addScaledVector(a,n/Math.sin(h)),s.addScaledVector(o,r/Math.sin(h))}}function EBe(e,t,i){let r=e.clone().sub(t),n=i.clone().sub(t);return r.projectOnVector(n),r.add(t)}var Awe,Cwe,Pwe,cre,PB,Rwe,Dwe,Nwe,pre,JY,Iwe,Owe,Lwe,Bwe,fre=U(()=>{ae(),Awe=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:s,openEnded:a,cornerRadius:o,cornerSegments:l}=e.parameters,h=new cre(.5*t,i,n,s,a,o,l),u=r/t;return u!==1&&h.scale(1,1,u),Object.assign(h,{userData:{...e,type:"PyramidGeometry"}})}},Cwe=new R,Pwe=new R,cre=class extends At{constructor(e=.5,t=1,i=4,r=1,n=!1,s=0,a=4){super(),i=Math.floor(Math.max(3,i)),r=Math.floor(r),a=Math.floor(a);let o,l=[],h=[],u=[],d=[],c=0,p=t/2,f=Math.PI/i,m=e*Math.cos(Math.PI/i),g=2*Math.PI/i,v=(i-2)*Math.PI/i,y=Math.PI-v,_=new R(0,-p,0),b=new R(0,p,0),x=new Z(e,-p),w=new Z(m,-p),S=new Z(0,b.y).sub(w),T=new Z(0,b.y).sub(x),M=new Z(S.y,-S.x).normalize(),E=new Z(T.y,-T.x).normalize(),A=e*Math.cos(Math.PI/i)*Math.tan((Math.PI-S.angle())/2)-1e-8;s=Math.min(s,A);{let V=new R(M.x,M.y,0),j=new R(Math.cos(g)*V.x,V.y,Math.sin(g)*V.x);o=V.angleTo(j)}let P=s/Math.tan((Math.PI-S.angle())/2),N=s/Math.tan((Math.PI-o)/2),D=new R;if(!n){h.push(_.x,_.y,_.z),u.push(0,-1,0),d.push(0,0);let V=c++,j=[],K=x.clone(),$=P/Math.cos(Math.PI/i);K.x-=$;for(let Q=0;Q<i;Q++){let ce=Q/i*Math.PI*2+f;HS(K,new Z(Math.sin(ce),Math.cos(ce)),D),h.push(D.x,D.y,D.z),u.push(0,-1,0),d.push(0,0),j.push(c++)}for(let Q=0;Q<j.length;Q++)l.push(j[Q],V,j[(Q+1)%j.length])}let O=[];{let V=new R,j=new R,K=new R,$=new R,Q=new R,ce=new R;for(let pe=0;pe<i;pe++){let ye=pe/i*Math.PI*2+f,we=(pe+.5)/i*Math.PI*2+f,ne=(pe+1)/i*Math.PI*2+f,Se=new Z(Math.sin(ye),Math.cos(ye)),W=new Z(Math.sin(we),Math.cos(we)),k=new Z(Math.sin(ne),Math.cos(ne));HS(x,Se,j),HS(x,k,K),HS(M,W,V),U5(b,j,K,N,N,$),h.push($.x,$.y,$.z),U5(j,b,K,N,P,Q),h.push(Q.x,Q.y,Q.z),U5(K,j,b,P,N,ce),h.push(ce.x,ce.y,ce.z),u.push(V.x,V.y,V.z),u.push(V.x,V.y,V.z),u.push(V.x,V.y,V.z),d.push(0,0),d.push(0,0),d.push(0,0);let Y=c++,ie=c++,G=c++;if(l.push(Y,ie,G),s>0){{let H=j.clone().add(K).multiplyScalar(.5),me=b.clone().sub(H).normalize(),xe=_.clone().sub(H).normalize().add(me).normalize().multiplyScalar(-1);z(H,ce.clone().sub(Q),xe,S.angle())}let oe,se;{let H=new R;HS(E,k,H);let me=ce.clone().add($).multiplyScalar(.5);me=EBe(me,K,b);let xe=ce.clone().sub($);[oe,se]=z(me,xe,H,o,$.y)}{let H=oe,me=H.clone().setY(0).normalize(),xe=new R(0,-1,0),ke=me.clone().cross(xe);B(H,me,xe,ke)}O.concat(se);{let H=S.angle(),me=Math.PI-H,xe=b.clone();xe.y-=s/Math.sin(H-Math.PI/2);let ke=new R,Te=[];for(let ze=0;ze<a;ze++){let qe=[],Ne=Math.PI/2-me*ze/a,ee=Math.cos(Ne),Ce=Math.sin(Ne),He=we;for(let pt=0;pt<=ze;pt++){let it=Math.cos(He),Yt=Math.sin(He);V.x=ee*Yt,V.y=Ce,V.z=ee*it,ke.copy(xe).addScaledVector(V,s),h.push(ke.x,ke.y,ke.z),u.push(V.x,V.y,V.z),d.push(0,0),qe.push(c++),He+=2*Math.PI/ze/i}Te.push(qe)}se.reverse(),Te.push(se);let Ze=Te.length-1;for(let ze=0;ze<Ze;ze++){let qe=Te[ze],Ne=Te[ze+1],ee=qe.length-1;l.push(Ne[1],qe[0],Ne[0]);for(let Ce=1;Ce<=ee;Ce++)l.push(qe[Ce],qe[Ce-1],Ne[Ce]),l.push(Ne[Ce+1],qe[Ce],Ne[Ce])}}}}}function z(V,j,K,$,Q){let ce=-$/2,pe=(Math.PI-$)/2,ye=j.clone().normalize().cross(K);V.addScaledVector(K,-s/Math.sin(pe));let we=new R,ne=new R,Se=c,W=[];for(let k=0;k<=a;k++){let Y=ce+k/a*$;ne.set(0,0,0),ne.addScaledVector(ye,Math.sin(Y)),ne.addScaledVector(K,Math.cos(Y));for(let ie=0;ie<=1;ie++){let G=ie/1-.5;if(we.copy(V),we.addScaledVector(j,G),we.addScaledVector(ne,s),Q!=null){let oe=Math.max(0,we.y-Q);we.addScaledVector(j,-oe/j.y)}h.push(we.x,we.y,we.z),u.push(ne.x,ne.y,ne.z),d.push(0,0),ie===0&&W.push(c),c++}}for(let k=0;k<a;k++)for(let Y=0;Y<1;Y++){let ie=Se+Y+2*k,G=ie+2,oe=G+1,se=ie+1;l.push(ie,G,se),l.push(G,oe,se)}return[V.clone().addScaledVector(j,.5),W]}function B(V,j,K,$){let Q=Math.PI/2,ce=T.angle()-Q,pe=[],ye=new R,we=new R;for(let Se=0;Se<=a;Se++){let W=[],k=Se/a;for(let Y=0;Y<=Se;Y++){let ie=((Se?Y/Se:0)-.5)*y,G=Math.cos(ie),oe=Math.sin(ie),se=(Q+Math.atan(Math.tan(ce)*G))*k,H=Math.cos(se),me=Math.sin(se);ye.set(0,0,0),ye.addScaledVector(j,me*G),ye.addScaledVector(K,H),ye.addScaledVector($,me*oe),we.copy(V).addScaledVector(ye,s),h.push(we.x,we.y,we.z),u.push(ye.x,ye.y,ye.z),d.push(0,0),W.push(c++)}pe.push(W)}let ne=pe.length-1;for(let Se=0;Se<ne;Se++){let W=pe[Se],k=pe[Se+1],Y=W.length-1;l.push(W[0],k[1],k[0]);for(let ie=1;ie<=Y;ie++)l.push(W[ie-1],W[ie],k[ie]),l.push(W[ie],k[ie+1],k[ie])}}this.setIndex(l),this.setAttribute("position",new Et(h,3)),this.setAttribute("normal",new Et(u,3)),this.setAttribute("uv",new Et(d,2))}}}),n4=U(()=>{s0(),Qg(),PB=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 ps?e.shape:new ps,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:s,depth:a,extrudeBevelSize:o,extrudeBevelSegments:l,extrusionVersion:h}=e.parameters,u={x:.5*i,y:.5*r},d={x:-u.x,y:-u.y},c={x:u.x,y:u.y};function p(x,w,S){return w>i&&S>r?Math.min(x*i/w,x*r/S):w>i?x*i/w:S>r?x*r/S:x}let f=[];f[0]=n[0]===0?0:p(n[0],n[0]+n[3],n[0]+n[1]),f[1]=n[1]===0?0:p(n[1],n[1]+n[2],n[1]+n[0]),f[2]=n[2]===0?0:p(n[2],n[2]+n[1],n[2]+n[3]),f[3]=n[3]===0?0:p(n[3],n[3]+n[0],n[3]+n[2]);let m=d.x,g=c.x,v=c.y,y=d.y;t.addPoint(t.createPoint(m,v)),t.addPoint(t.createPoint(g,v)),t.addPoint(t.createPoint(g,y)),t.addPoint(t.createPoint(m,y)),t.isClosed=!0;let _=!0;for(let x=0,w=t.points.length;x<w;x++)t.points[x].roundness=f[x],x>0&&f[x]!==f[x-1]&&(_=!1);_&&(t.roundness=f[0]),t.useCubicForRoundedCorners=s!==1,t.update();let b=a0.create({shape:t,parameters:{depth:a,extrudeBevelSize:o,extrudeBevelSegments:l,extrusionVersion:h}});return Object.assign(b,{userData:{...e,type:"RectangleGeometry"}})}}}),mre=U(()=>{ae(),Rwe=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=et.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:s=64,heightSegments:a=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 Hf(.5*i,s,a,o,l,h,u*et.DEG2RAD),t.scale(1,r/i,n/i),Object.assign(t,{userData:{...e,type:"SphereGeometry"}})}}}),gre=U(()=>{ae(),Dwe=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,s=new $c(t,i,r,n);return s.scale(1,1,1),Object.assign(s,{userData:{...e,type:"PlaneGeometry"}})}}}),vre=U(()=>{ae(),Nwe=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:s,cornerSegments:a}=e.parameters,o=new pre(t,i,r,n,s,a);return Object.assign(o,{userData:{...e,type:"BackdropGeometry"}})}},pre=class extends At{constructor(e=1,t=1,i=1,r=90,n=10,s=24){super(),this.type="BackdropGeometry";let a=[],o=[],l=[],h=.001;n==0&&(s=1),s=Math.max(1,Math.floor(s)),n=Math.min(n,100),r=Math.min(180-h,r),r*=Math.PI/180;let u=[],d=Math.PI/2,c=(we=0,ne=0,Se=0)=>new R(we,ne,Se),p=c(),f=c(),[m,g,v]=[t/2,e/2,i/2],y=-g,_=+g,[b,x,w]=[c(y,-m,+v),c(y,-m,-v),c(y,+m,-v)],S=(we,ne=!1)=>Math.sin(we-Math.PI/(+ne+1)),T=(we,ne=!1)=>Math.cos(we-Math.PI/(+ne+1));w.y=Math.sin(r)*t-m;let M=Math.cos(r)*t-v,E=b.z-h;r<=d?(w.z=Math.min(M,E),w.z==E&&(w.y-=(M-E)/Math.tan(d-r))):x.z=Math.min(x.z-M-v,b.z-h),p.subVectors(b,x),f.subVectors(w,x);let A=Math.min(p.length(),f.length())*n/100,P=A*Math.tan(r/2),N=A/Math.cos(r/2),D=p.clone().normalize().add(f.normalize()).setLength(N).add(x);p.set(0,S(r,!0),T(r,!0)),u.push([w,p.clone()]);let O=(Math.PI-r)/s;for(let we=0;we<=s;we++){let ne=d+r+we*O;p.set(0,Math.sin(ne)*P,Math.cos(ne)*P),p.add(D),f.set(0,S(ne),T(ne)),u.push([p.clone(),f.clone()])}u.push([b,c(0,1,0)]);let z=Math.sin(O/2)*P*2,B=u.length-1,V=u[0][0].distanceTo(u[1][0]),j=V+z*s+u[B-1][0].distanceTo(u[B][0]);u[0].push(1);for(let we=0;we<=s;we++)u[we+1].push(1-(V+we*z)/j);u[B].push(0);let K,$,Q,[ce,pe,ye]=u[0];for(let we=1;we<u.length;we++)[K,$,Q]=u[we],a.push(y,ce.y,ce.z,y,K.y,K.z,_,ce.y,ce.z,_,ce.y,ce.z,y,K.y,K.z,_,K.y,K.z),o.push(0,pe.y,pe.z,0,$.y,$.z,0,pe.y,pe.z,0,pe.y,pe.z,0,$.y,$.z,0,$.y,$.z),l.push(0,ye,0,Q,1,ye,1,ye,0,Q,1,Q),[ce,pe,ye]=[K,$,Q];this.setAttribute("position",new Et(a,3)),this.setAttribute("normal",new Et(o,3)),this.setAttribute("uv",new Et(l,2))}}}),FH=U(()=>{s0(),Qg(),JY=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 ps?e.shape:new ps,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:s,angle:a,depth:o,extrudeBevelSize:l,extrudeBevelSegments:h,extrusionVersion:u}=e.parameters,d=e.shape,c=.5*t,p=.5*i,f=a*Math.PI/360/n,m=Math.PI/2*3*-1,g=c*r/100,v=p*r/100;if(n===3&&r===50){f=2*Math.PI/n;for(let _=0;_<n;_++){let b=f*_,x=0+Math.sin(b)*c,w=0+Math.cos(b)*p;d.addPoint(d.createPoint(x,w))}}else for(let _=0;_<n;_++){let b=0+Math.cos(m)*c,x=0+Math.sin(m)*p;d.addPoint(d.createPoint(b,x)),m+=f,b=0+Math.cos(m)*g,x=0+Math.sin(m)*v,d.addPoint(d.createPoint(b,x)),m+=f}d.isClosed=!0;for(let _=0,b=d.points.length;_<b;_++)d.points[_].roundness=s;d.roundness=s,d.update();let y=a0.create({shape:d,parameters:{roundness:s,depth:o,extrudeBevelSize:l,extrudeBevelSegments:h,extrusionVersion:u}});return Object.assign(y,{userData:{...e,type:"StarGeometry"}})}}}),yre=U(()=>{ae(),Iwe=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 $c(t,i);return Object.assign(r,{userData:{...e,type:"TextFrameGeometry"}})}}}),_re=U(()=>{ae(),DA(),Owe=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 s=Math.round(Math.abs(i.depth??.25*i.width));return{parameters:Object.assign(i,{width:r,height:n,depth:s})}}static build(e){let{width:t,height:i,depth:r,radialSegments:n,tubularSegments:s,arc:a,cornerRadius:o,cornerSegments:l}=e.parameters,h=function(u,d,c,p,f,m,g,v,y,_,b){[d,c]=[c,d],g=d/2;let x=et.clamp(f/360,0,1);if(x===0){let w=new At;return w.setAttribute("position",new Et([],3)),w}return x===1&&(_=0),new SH(!0,u,d,c,p,x,m,g,0,y,_,b)}(t,i,r,.5*t,a,s,0,0,n,o,l);return h.scale(1,i/t,1),Object.assign(h,{userData:{...e,type:"TorusGeometry"}})}}}),bre=U(()=>{ae(),Lwe=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:s,q:a}=e.parameters,o=.5*t;o!==i&&(o-=i);let l=new dW(o,i,r,n,s,a);return Object.assign(l,{userData:{...e,type:"TorusKnotGeometry"}})}}}),xre=U(()=>{s0(),Qg(),Bwe=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 ps?e.shape:new ps,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:s,extrudeBevelSegments:a,isRect:o,extrusionVersion:l}=e.parameters,h=e.shape,u=.5*t,d=.5*i;o?(h.addPoint(h.createPoint(-u,d)),h.addPoint(h.createPoint(u,-d)),h.addPoint(h.createPoint(-u,-d))):(h.addPoint(h.createPoint(0,d)),h.addPoint(h.createPoint(u,-d)),h.addPoint(h.createPoint(-u,-d))),h.isClosed=!0;for(let p=0,f=h.points.length;p<f;p++)h.points[p].roundness=r;h.roundness=r,h.update();let c=a0.create({shape:h,parameters:{roundness:r,depth:n,extrudeBevelSize:s,extrudeBevelSegments:a,extrusionVersion:l}});return Object.assign(c,{userData:{...e,type:"TriangleGeometry"}})}}}),ABe=U(()=>{}),CBe=U(()=>{ae(),new Ha,new Ue,new xf,new R,new R,new R,new R});function wre(){let e=new At;return e.setAttribute("position",new Dt(new Float32Array([]),3)),e.setIndex(new Dt(new Uint16Array([]),1)),e}var Sre,UH,Fwe=U(()=>{la(),zt(),iC(),ae(),JA(),s0(),Qg(),Ew(),Sre=wre().attributes,UH=class extends At{constructor(e,t){super(),this.isTextGeometry=!0,this.charWidths=[],this.charCoords=[],this.wrappedText=[],this.isLowResolution=!1,this.vectorShapes=[],this._nearSide=new Uint8Array(0),this._depth=0,this._effectiveBevel=0,this._vScale=0,Object.assign(this.attributes,Sre),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:s,extrudeBevelSize:a,extrudeBevelSegments:o,text:l,textTransform:h,fontSize:u,extrusionVersion:d}=e,c=Mo.getDisplayedValue(l),p=function(w,S,T,M){let E=typeof w.width=="string"?Number(M.getVariable(w.width)):w.width,A=[""],P="";for(let N of T)P+=N,N===" "||N===`
|
|
4190
|
+
`;return 2&x.valid||t(3,"missing format specifier"),4&x.valid||t(3,"missing image size specifier"),x}(s),u=h.width,d=h.height,c=function(p,f,m){let g=f;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*f*m);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=m;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 T,M=0;for(;M<b&&_<p.byteLength;){T=p[_++];let A=T>128;if(A&&(T-=128),(T===0||M+T>b)&&t(3,"bad scanline data"),A){let P=p[_++];for(let N=0;N<T;N++)w[M++]=P}else w.set(p.subarray(_,_+T),M),M+=T,_+=T}let E=g;for(let A=0;A<E;A++){let P=0;v[y]=w[A+P],P+=g,v[y+1]=w[A+P],P+=g,v[y+2]=w[A+P],P+=g,v[y+3]=w[A+P],y+=4}S--}return v}(s.subarray(s.pos),u,d);switch(this.type){case Wt:l=c.length/4;let p=new Float32Array(4*l);for(let m=0;m<l;m++)r(c,4*m,p,4*m);a=p,o=Wt;break;case di:l=c.length/4;let f=new Uint16Array(4*l);for(let m=0;m<l;m++)n(c,4*m,f,4*m);a=f,o=di;break;default:throw new Error("THREE.HDRLoader: Unsupported type: "+this.type)}return{width:u,height:d,data:a,header:h.string,gamma:h.gamma,exposure:h.exposure,type:o,colorSpace:Ed,minFilter:nt,magFilter:nt,generateMipmaps:!1,flipY:!0}}setDataType(e){return this.type=e,this}}});function Oie(e){return e.length>2&&e[0]===35&&e[1]===63}function R5(e){return typeof e=="object"&&e!==null&&e.isSplineHdr===!0}function jxe(e){let t=new Ir(e.data,e.width,e.height,fn,di);return t.flipY=!1,t.image.isSplineHdr=!0,t.needsUpdate=!0,t}var Lie,GY,Nc,Wxe=U(()=>{ae(),aBe()}),Hxe=U(()=>{ae(),Vxe(),Gxe(),Wxe(),Lie=0,GY=class extends Bxe{constructor(e,t){super(e,t.imageHolderCache),this.data=e,this.shared=t,this.instanceId=++Lie,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 s of Object.values(n))s&&(s.image=this.img,s.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(s=>{n.onloadend=a=>{r=a.target?.result,s(null)}}),this.img.src=r}else this.img.src=e;this.img.onloadeddata=()=>{t()}}else if(e instanceof Uint8Array?Oie(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&&Oie(r)?function(s){try{let a=new Uxe().parse(s.buffer.slice(s.byteOffset,s.byteOffset+s.byteLength));if(!a||!a.width||!a.height)return null;let{width:o,height:l}=a,h=a.data,u=new Uint16Array(h.length),d=4*o,c=m=>Sd.toHalfFloat(Math.pow(Math.max(Sd.fromHalfFloat(m),0),1/2.2)),p=new Map,f=m=>{let g=p.get(m);return g===void 0&&(g=c(m),p.set(m,g)),g};for(let m=0;m<l;m++){let g=m*d,v=(l-1-m)*d;for(let y=0;y<d;y+=4)u[v+y]=f(h[g+y]),u[v+y+1]=f(h[g+y+1]),u[v+y+2]=f(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:(UE||(UE=new Lxe),UE.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 $X(this.img,void 0,e,e):this.isHdr?(n=jxe(this.img),n.wrapS=e,n.wrapT=e,n.magFilter=i,n.minFilter=t):n=new Ri(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,s]of Object.entries(r))s?.dispose(),this._cache[e]!==void 0&&this._cache[e][i]!==void 0&&(this._cache[e][i][n]=void 0)}dispose(){super.dispose(),this.disposeTextures()}}}),AB=U(()=>{Hxe(),Nc=class extends GY{}});function oBe(e){if(typeof e=="string")return e;let t=EH.get(e);return t||(t={url:URL.createObjectURL(new Blob([e]))},EH.set(e,t)),t.url}var EH,lBe=U(()=>{EH=new Map});function hBe(){if(!AH)return Bie||(Bie=async function(){await Promise.resolve().then(()=>(eQ(),zPe)),qxe(window!==void 0?window:global),AH=!0}())}var qxe,$xe,AH,Bie,Xxe=U(()=>{$xe=new Promise(e=>{qxe=e}),AH=!1});function Fie(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 uBe(e){let t=!1,i=[];return e.scene.objects.traverse((r,n)=>{if(n.type==="Page"&&n.uiScene!==void 0&&n.uiScene.objects.traverse((s,a)=>{if(a.events===void 0||Array.isArray(a.events)===!1)return!0;Fie(a.events,i),t=t||i.some(o=>o.data.type==="Audio")}),n.events===void 0||Array.isArray(n.events)===!1)return!0;Fie(n.events,i),t=t||i.some(s=>s.data.type==="Audio")}),t}var Uie,sx,jY=U(()=>{lBe(),Xxe(),$xe.then(e=>Uie=e),sx=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:oBe(e),format:"wav"},this.sound=new Uie.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 zie(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 WY,HY=U(()=>{WY=null});function kie(e){return new Z(e.y,-e.x)}var qY,CH,Yxe,Kxe,N3,Vie,QL,Zxe,D5,JL=U(()=>{ae(),qY=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=et.clamp(n.thetaLength,0,360),n.hollow=et.clamp(n.hollow??0,0,1);let s=n.width/2,a=n.radiusTop??s,o=n.radiusBottom??s;if(a===o?(a=s,o=s):a>o?(a=s,o=o*s/a):(a=a*s/o,o=s),n.shapeBlendNode){a=i??s,o=r??s;let l=2*Math.max(a,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:a,radiusBottom:o})}}static build(e){let t,{width:i,depth:r,height:n,radialSegments:s,heightSegments:a,openEnded:o,thetaStart:l,thetaLength:h,radiusTop:u,radiusBottom:d,cornerRadius:c,cornerSegments:p,hollow:f}=e.parameters;h===0?(t=new At,t.setAttribute("position",new Et([],3))):t=c||f?new CH(u,d,n,s,a,o,l,h*Math.PI/180,c,c,p,f):new EE(u,d,n,s,a,o,l,h*Math.PI/180);let m=r/i;return m!==1&&t.scale(1,1,m),Object.assign(t,{userData:{...e,type:"CylinderGeometry"}})}},CH=class extends At{constructor(e,t,i,r,n,s,a,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,s=s!==void 0&&s,a=a!==void 0?a:0,o=o!==void 0?o:2*Math.PI,s&&(l=0,h=0);let p=i/2;c&&e==0&&(e=l),c&&t==0&&(t=h);let f=new Z(e,p),m=new Z(t,-p),g=null,v=null,y=null,_=null,b=f.clone().sub(m),x=0,w=0,S=0;d>0&&(x=Math.min(e,t)*(1-d),w=e-x,S=t-x);let T=f.clone();T.x-=x;let M=Math.PI-b.angle(),E=b.angle(),A=Math.tan(E/2),P=Math.tan(M/2),N=A+P,D=d?N:P,O=d?N:A;if(l=Math.min(l,(e-w)/D,b.length()/N),h=Math.min(h,(t-S)/O,b.length()/N),l>0){let me=l/A;g=f.clone().sub(new Z(me,l)),d&&(y=g.clone(),y.x-=x-N*l),f.sub(b.clone().setLength(me))}if(h>0){let me=h/P;v=m.clone().sub(new Z(me,-h)),m.add(b.clone().setLength(me)),d&&(_=v.clone(),_.x-=x-N*h,T.sub(b.clone().setLength(me)))}b=f.clone().sub(m);let z=b.length()<.5,B=[],V=[],j=[],K=[],$=[],Q=[],ce=(me,xe,ke,Te,Ze)=>{for(let ze=0;ze<u+1;ze++){let qe=ze/u,Ne=Te<0?qe:1-qe;Ze&&(Ne-=1),Ne*=me;let ee=Math.sin(Ne),Ce=Math.cos(Ne)*Te,He=Ce*xe+ke.y;B.push(ee*xe+ke.x),V.push(He),j.push(ee),K.push(Ce),$.push(.5+He/i),Q.push(!1)}},pe=(me,xe,ke)=>{let Te=[me,xe];ke<0&&Te.reverse();for(let Ze of Te)B.push(Ze),V.push(p*ke),j.push(0),K.push(ke),$.push(.5),Q.push(!0)};if(_&&v?(ce(M,h,_,-1,!0),ce(E,h,v,-1,!1)):v?(pe(v.x,0,-1),ce(E,h,v,-1,!1)):s||pe(t,S,-1),!z){let me=kie(b).normalize();for(let xe=0;xe<=n;xe++){let ke=xe/n,Te=b.y*ke+m.y;B.push(b.x*ke+m.x),V.push(Te),j.push(me.x),K.push(me.y),$.push(.5+Te/i),Q.push(!1)}}if(y&&g?(ce(M,l,g,1,!1),ce(E,l,y,1,!0)):g?(ce(M,l,g,1,!1),pe(g.x,0,1)):s||pe(e,w,1),d&&!z){let me=kie(b).multiplyScalar(-1).normalize();for(let xe=0;xe<=n;xe++){let ke=xe/n,Te=b.y*-ke+T.y;B.push(b.x*-ke+T.x),V.push(Te),j.push(me.x),K.push(me.y),$.push(.5+Te/i),Q.push(!1)}}let ye=B.length,we=ye+(d&&!s?1:0),ne=(me,xe)=>me*ye+(xe===ye?0:xe),Se=o<2*Math.PI,W=(r+1)*ye+(Se?2*(1+we):0),k=new Float32Array(3*W),Y=new Float32Array(3*W),ie=new Float32Array(2*W),G=W-1>65535?new Uint32Array(r*Math.max(0,we-1)*6+(Se?2*(we+1)*3:0)):new Uint16Array(r*Math.max(0,we-1)*6+(Se?2*(we+1)*3:0)),oe=0,se=0;for(let me=0;me<=r;me++){let xe=me/r,ke=xe*o+a,Te=Math.sin(ke),Ze=Math.cos(ke);for(let ze=0;ze<ye;ze++){let qe=3*se,Ne=2*se,ee=B[ze],Ce=j[ze];k[qe]=ee*Te,k[qe+1]=V[ze],k[qe+2]=ee*Ze,Y[qe]=Ce*Te,Y[qe+1]=K[ze],Y[qe+2]=Ce*Ze,Q[ze]?(ie[Ne]=.5,ie[Ne+1]=.5):(ie[Ne]=xe,ie[Ne+1]=$[ze]),se++}}for(let me=0;me<r;me++)for(let xe=0;xe<we-1;xe++){if(s&&d&&xe==n)continue;let ke=ne(me,xe),Te=ne(me+1,xe),Ze=ne(me+1,xe+1),ze=ne(me,xe+1),qe=k[3*Ze+0],Ne=k[3*Ze+2];G[oe++]=ke,G[oe++]=Te,G[oe++]=ze,(qe!=0||Ne!=0)&&(G[oe++]=Te,G[oe++]=Ze,G[oe++]=ze)}function H(me,xe,ke){let Te=Math.sin(ke),Ze=Math.cos(ke),ze=-Ze,qe=Te,Ne=me<0?(it,Yt,ni)=>{G[oe++]=it,G[oe++]=Yt,G[oe++]=ni}:(it,Yt,ni)=>{G[oe++]=it,G[oe++]=ni,G[oe++]=Yt},ee=(e+t+w+S)/4,Ce=3*se,He=2*se;k[Ce]=ee*Te,k[Ce+1]=0,k[Ce+2]=ee*Ze,Y[Ce]=ze,Y[Ce+1]=0,Y[Ce+2]=qe,ie[He]=.5,ie[He+1]=.5;let pt=se++;for(let it=0;it<we;it++){let Yt=3*(xe+(it===ye?0:it));Ce=3*se,He=2*se,k[Ce]=k[Yt],k[Ce+1]=k[Yt+1],k[Ce+2]=k[Yt+2],Y[Ce]=ze,Y[Ce+1]=0,Y[Ce+2]=qe;let ni=Yt/3*2|0;ie[He]=ie[ni],ie[He+1]=ie[ni+1],se++}for(let it=pt+1;it<se-1;it++)Ne(pt,it,it+1);Ne(pt,se-1,pt+1)}Se&&(H(-1,0,a),H(1,r*ye,a+o)),this.setIndex(new Dt(G.slice(0,oe),1)),this.setAttribute("position",new Dt(k,3)),this.setAttribute("normal",new Dt(Y,3)),this.setAttribute("uv",new Dt(ie,2))}}}),Gie=U(()=>{ae(),JL(),Yxe=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=et.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:s,heightSegments:a,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 CH(0,i/2,n,s,a,o,l,h*Math.PI/180,u,d,c,0,!0):new yL(i/2,n,s,a,o);let p=r/i;return p!==1&&t.scale(1,1,p),Object.assign(t,{userData:{...e,type:"ConeGeometry"}})}}}),jie=U(()=>{ae(),Kxe=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:s,heightSegments:a,depthSegments:o,cornerRadius:l,cornerSegments:h}=e.parameters;return t=l===0?new Ih(i,r,n,s,a,o):new Vie(i,r,n,s,a,o,l,h),Object.assign(t,{userData:{...e,type:"CubeGeometry"}})}},N3=Math.PI/2,Vie=class extends At{constructor(e=1,t=1,i=1,r=1,n=1,s=1,a=0,o=4){super(),this.type="BoxGeometry",r=Math.floor(r),n=Math.floor(n),s=Math.floor(s),o=Math.floor(o);let l=(a=Math.min(a,e/2,t/2,i/2))>0,h=o+1,u=2*((s+1)*(n+1)+(r+1)*(s+1)+(r+1)*(n+1))+(l?4*h*(s+1+(r+1)+(n+1))+h*(h+1)/2*8:0),d=2*(s*n+r*s+r*n)+(l?4*o*(s+r+n):0),c=l?8*o*o:0,p=new Float32Array(3*u),f=new Float32Array(3*u),m=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 D=N/o*N3;_[N]=Math.sin(D)*a,b[N]=(1-Math.cos(D))*a,x[N]=Math.sin(D),w[N]=Math.cos(D)}let S=h*(h+1)/2,T=new Float64Array(3*S),M=new Float64Array(3*S);{let N=new R(e/2,t/2,i/2);N.subScalar(a);let D=0;for(let O=0;O<=o;O++){let z=N3*(1-O/o),B=Math.cos(z),V=Math.sin(z),j=0;for(let K=0;K<=O;K++){let $=B*Math.cos(j),Q=V,ce=B*Math.sin(j);T[3*D]=$,T[3*D+1]=Q,T[3*D+2]=ce,M[3*D]=N.x+$*a,M[3*D+1]=N.y+Q*a,M[3*D+2]=N.z+ce*a,D++,j+=N3/O}}}function E(N,D,O,z,B,V,j,K,$,Q){let ce=(V-2*a)/$,pe=(j-2*a)/Q,ye=V/2-a,we=j/2-a,ne=K/2,Se=$+1,W=Q+1,k=0,Y=new R;for(let ie=0;ie<W;ie++){let G=ie*pe-we;for(let oe=0;oe<Se;oe++){let se=oe*ce-ye,H=3*(v+k),me=2*(v+k);Y[N]=se*z,Y[D]=G*B,Y[O]=ne,p[H]=Y.x,p[H+1]=Y.y,p[H+2]=Y.z,Y[N]=0,Y[D]=0,Y[O]=K>0?1:-1,f[H]=Y.x,f[H+1]=Y.y,f[H+2]=Y.z,m[me]=oe/$,m[me+1]=1-ie/Q,k+=1}}for(let ie=0;ie<Q;ie++)for(let G=0;G<$;G++){let oe=v+G+Se*ie,se=v+G+Se*(ie+1),H=v+(G+1)+Se*(ie+1),me=v+(G+1)+Se*ie;g[y++]=oe,g[y++]=se,g[y++]=me,g[y++]=se,g[y++]=H,g[y++]=me}v+=k}function A(N,D,O,z,B,V,j,K,$,Q){let ce=(j-2*a)/Q,pe=j/2-a,ye=K/2-a,we=$/2,ne=Q+1,Se=0,W=new R,k=new R;for(let Y=0;Y<o+1;Y++){W[D]=(ye+_[Y])*B,W[O]=(we-b[Y])*V,k[N]=0,k[D]=x[Y]*Math.sign(W[D]),k[O]=w[Y]*Math.sign(W[O]);for(let ie=0;ie<ne;ie++){let G=ie*ce-pe;W[N]=G*z;let oe=3*(v+Se),se=2*(v+Se);p[oe]=W.x,p[oe+1]=W.y,p[oe+2]=W.z,f[oe]=k.x,f[oe+1]=k.y,f[oe+2]=k.z,m[se]=ie/Q,m[se+1]=0,Se+=1}}for(let Y=0;Y<o;Y++)for(let ie=0;ie<Q;ie++){let G=v+ie+ne*Y,oe=v+ie+ne*(Y+1),se=v+(ie+1)+ne*(Y+1),H=v+(ie+1)+ne*Y;g[y++]=G,g[y++]=oe,g[y++]=H,g[y++]=oe,g[y++]=se,g[y++]=H}v+=Se}function P(N,D,O){let z=N*D*O>0?(V,j,K)=>{g[y++]=V,g[y++]=j,g[y++]=K}:(V,j,K)=>{g[y++]=V,g[y++]=K,g[y++]=j},B=v;for(let V=0;V<S;V++){let j=3*V,K=3*v,$=2*v;p[K]=N*M[j],p[K+1]=D*M[j+1],p[K+2]=O*M[j+2],f[K]=N*T[j],f[K+1]=D*T[j+1],f[K+2]=O*T[j+2],m[$]=0,m[$+1]=0,v++}for(let V=0;V<o;V++){let j=B+V*(V+1)/2,K=B+(V+1)*(V+2)/2;z(j,K+1,K);for(let $=1;$<=V;$++)z(j+$-1,j+$,K+$),z(j+$,K+$+1,K+$)}}E("z","y","x",-1,-1,i,t,e,s,n),E("z","y","x",1,-1,i,t,-e,s,n),E("x","z","y",1,1,e,i,t,r,s),E("x","z","y",1,-1,e,i,-t,r,s),E("x","y","z",1,-1,e,t,i,r,n),E("x","y","z",-1,-1,e,t,-i,r,n),a>0&&(A("z","y","x",-1,-1,1,i,t,e,s),A("z","y","x",1,-1,-1,i,t,e,s),A("z","y","x",-1,1,-1,i,t,e,s),A("z","y","x",1,1,1,i,t,e,s),A("x","y","z",-1,-1,-1,e,t,i,r),A("x","y","z",1,-1,1,e,t,i,r),A("x","y","z",-1,1,1,e,t,i,r),A("x","y","z",1,1,-1,e,t,i,r),A("y","x","z",-1,-1,1,t,e,i,n),A("y","x","z",1,-1,-1,t,e,i,n),A("y","x","z",1,1,1,t,e,i,n),A("y","x","z",-1,1,-1,t,e,i,n),P(1,1,1),P(-1,1,1),P(1,-1,1),P(-1,-1,1),P(1,1,-1),P(-1,1,-1),P(1,-1,-1),P(-1,-1,-1)),this.setIndex(new Dt(g,1)),this.setAttribute("position",new Dt(p,3)),this.setAttribute("normal",new Dt(f,3)),this.setAttribute("uv",new Dt(m,2))}}}),Qxe=U(()=>{ae(),QL=class extends At{constructor(e=[],t=[],i="",r=1,n=.2,s=4){super(),this.type="PolyhedronGeometryRound";let a,o,l,h=0;return function(){(n=Math.min(.99999,n))==0&&(s=0);let u={IcosahedronGeometry:5,DodecahedronGeometry:3,HexahedronGeometry:3,OctahedronGeometry:4,TetrahedronGeometry:3}[i],d=new R,c=d.clone(),p=new Us,f=n*r,m=r-f,g=s+1,v=new R,y=(ne,Se)=>v.subVectors(ne,Se).normalize(),_=(ne,Se)=>Array(ne).fill(void 0).map(Se),b=_(e.length/3,(ne,Se)=>new R().fromArray(e,3*Se).setLength(r)),x=[],w=1e6;for(let ne=0;ne<b.length;ne++){let Se,W,k,Y=b[ne],ie=[],G=1e10,oe=-1;for(;(oe=t.indexOf(ne,oe+1))!=-1;){let xe=oe-oe%3;Se=t[xe+(oe+1)%3],W=t[xe+(oe+2)%3],k=Y.distanceToSquared(b[Se]),G=Math.min(G,k),ie.push([Se,W,k])}G+=1e-6;let se=[],H=0,me=ie.length;for(let xe=0;xe<me;xe++){[Se,W,k]=ie[H];let ke=x[Se]?.includes(ne)==1;k<=G&&se.push(Se+ +ke*w),H=ie.findIndex(Te=>Te[0]==W)}x.push(se)}let S=[];{let ne,Se,W=0,k=0,Y=u==3;for(let ie=0;ie<=s;ie++){ne=ie*(ie+1)/2,Se=(ie+1)*(ie+2)/2;for(let G=0;G<s-ie;G++)[W,k]=[ne+G+ie+2,Se+G+ie+3],S.push(ne,Se,...Y?[k,ne]:[W,Se],k,W),[ne,Se]=[W,k];S.push(ne,Se,ne+s+2)}}let T=0;for(let ne=0;ne<x.length;ne++)for(let Se=0;Se<u;Se++)x[ne][Se]<w&&T++;let M=b.length*u*S.length*3+T*g*6*3+2*T*3*3;a=new Float64Array(M),o=new Float64Array(M),l=new Float64Array(M/3*2);let E=(ne,Se,W)=>{let k=h/3*2;l[k]=Math.atan2(W,-ne)/2/Math.PI+.5,l[k+1]=1-(Math.atan2(-Se,Math.sqrt(ne*ne+W*W))/Math.PI+.5)},A=ne=>{a[h]=ne.x,a[h+1]=ne.y,a[h+2]=ne.z,o[h]=v.x,o[h+1]=v.y,o[h+2]=v.z,E(ne.x,ne.y,ne.z),h+=3},P=ne=>{a[h]=ne[0].x,a[h+1]=ne[0].y,a[h+2]=ne[0].z,o[h]=ne[1].x,o[h+1]=ne[1].y,o[h+2]=ne[1].z,E(ne[0].x,ne[0].y,ne[0].z),h+=3},N=(s+2)*(s+3)/2,D=new Float64Array(3*N),O=new Float64Array(3*N),z=new Float64Array(2*N),B=_(2*u*g,()=>new R),V=_(s*Math.max(0,s-1)/2,()=>new R),j=d.clone(),K=d.clone(),$=d.clone(),Q=d.clone(),ce=d.clone(),pe=[],ye=_(b.length,()=>_(u,()=>d.clone()));for(let ne=0;ne<b.length;ne++){d.copy(b[ne]).normalize(),j.copy(d).multiplyScalar(m);let Se=x[ne];for(let se=0;se<Se.length;se++){let H=Se[se],me=Se[(se+1)%u];p.setFromPointsAndIndices(b,ne,H%w,me%w),p.b.sub(p.a).setLength(1e10).add(p.a),p.c.sub(p.a).setLength(1e10).add(p.a),p.closestPointToPoint(j,ye[ne][se])}let W=0,k=[],Y=[],ie=new R;s==0&&[...ye[ne]].reduce((se,H)=>se.add(H),ie).multiplyScalar(1/u);for(let se=0;se<u;se++){let H=[],me=(se-1+u)%u,xe=ye[ne][me],ke=ye[ne][se];d.copy(xe).sub(j),c.copy(ke).sub(j);let Te=j.angleTo(d),Ze=d.angleTo(c),ze=Math.cos(Te)*f;s==0?K.copy(ie):K.copy(j).setLength(m+ze),k.push(ze);let qe=[K,xe,ke];for(let Ne=0;Ne<2;Ne++){let ee=qe[Ne],Ce=qe[Ne+1];Q.subVectors(ee,j),ce.subVectors(Ce,j),$.crossVectors(Q,ce).normalize();for(let He=0;He<g;He++){let pt=[Te,Ze][Ne]*He/g;d.copy(Q).applyAxisAngle($,pt).add(j),B[W++].copy(d),Ne&&(y(d,j),H.push([He==0?ee:d.clone(),v.clone()]))}Ne&&(y(Ce,j),H.push([Ce,v.clone()]))}Y.push(H)}pe.push(Y);let G=2*g,oe=2;for(let se=0;se<u;se++){let H=G*se,me=G*((se+1)%u),xe=0,ke=[B[H]];for(let Te=1;Te<g;Te++){let Ze=B[H+Te],ze=B[me+Te];ke.push(Ze);for(let qe=1,Ne=Te-oe+1;qe<=Ne;qe++)d.lerpVectors(Ze,ze,qe/(Ne+1)),d.sub(j).setLength(k[se]).add(j),ke.push(V[xe++].copy(d));ke.push(ze)}for(let Te=0;Te<g;Te++)ke.push(B[Te+g+H]);ke.push(B[me+g]);for(let Te=0,Ze=ke.length;Te<Ze;Te++){let ze=ke[Te],qe=3*Te,Ne=2*Te;D[qe]=ze.x,D[qe+1]=ze.y,D[qe+2]=ze.z,y(ze,j),O[qe]=v.x,O[qe+1]=v.y,O[qe+2]=v.z,z[Ne]=Math.atan2(ze.z,-ze.x)/2/Math.PI+.5,z[Ne+1]=1-(Math.atan2(-ze.y,Math.sqrt(ze.x*ze.x+ze.z*ze.z))/Math.PI+.5)}for(let Te=0,Ze=S.length;Te<Ze;Te++){let ze=3*S[Te],qe=2*S[Te],Ne=h/3*2;a[h]=D[ze],a[h+1]=D[ze+1],a[h+2]=D[ze+2],o[h]=O[ze],o[h+1]=O[ze+1],o[h+2]=O[ze+2],l[Ne]=z[qe],l[Ne+1]=z[qe+1],h+=3}}}let we=[];for(let ne=0;ne<x.length;ne++)for(let Se=0;Se<u;Se++){let W=x[ne][Se];if(W<w){let k=x[W].findIndex(G=>G%w==ne),Y=pe[ne][Se],ie=pe[W][k];for(let G=0;G<g;G++){let oe=Y[G],se=ie[g-G],H=Y[G+1],me=ie[g-(G+1)];P(oe),P(se),P(H),P(H),P(se),P(me)}we.push(Y[0][0],ie[g][0],Y[g][0],ie[0][0])}}for(;we.length;){let ne,Se,W,[k,Y]=we.splice(0,2);ne=Y;let ie=[k];for(;k!=ne;)ie.push(ne),Se=we.indexOf(ne),W=Se%2,ne=we.splice(Se-W,2)[1-W];v.subVectors(ie[0],ie[1]).cross(d.subVectors(ie[0],ie[2])).normalize();let G=v.dot(ie[0])<0;G&&v.negate();for(let oe=1;oe<=ie.length-2;oe++)A(ie[oe+ +G]),A(ie[oe+1-+G]),A(ie[0])}}(),function(){let u=new R,d=new R,c=new R,p=new R,f=new Z,m=new Z,g=new Z,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(a[b+0],a[b+1],a[b+2]),d.set(a[b+3],a[b+4],a[b+5]),c.set(a[b+6],a[b+7],a[b+8]),f.set(l[x+0],l[x+1]),m.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(f,x+0,u,w),v(m,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],T=Math.max(x,w,S),M=Math.min(x,w,S);T>.9&&M<.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 Dt(new Float32Array(a.subarray(0,h)),3)),this.setAttribute("normal",new Dt(new Float32Array(o.subarray(0,h)),3)),void this.setAttribute("uv",new Dt(new Float32Array(l.subarray(0,h/3*2)),2))}static fromJSON(e){return new QL(e.vertices,e.indices,e.radius,e.corner,e.cornerSides)}}}),Wie=U(()=>{Qxe(),ae(),Zxe=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:s,cornerSides:a}=e.parameters,o=n===0&&s!==0?new D5(.5*t,s,a):new sW(.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"}})}},D5=class extends QL{constructor(e=1,t=.2,i=4){let r=(1+Math.sqrt(5))/2,n=1/r,s="DodecahedronGeometry";super([-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-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],s,e,t,i),this.type=s}static fromJSON(e){return new D5(e.radius,e.corner,e.cornerSides)}}});function Hie(e,t=new Z){let i=e.length();return t.set(-e.y/i,e.x/i)}function dBe(e){let t=new Z;t.addVectors(e.v0,ly.subVectors(e.v1,e.v0).multiplyScalar(2/3));let i=new Z;return i.addVectors(e.v2,LA.subVectors(e.v1,e.v2).multiplyScalar(2/3)),new mu(e.v0,t,i,e.v2)}function WM(e,t,i=Number.EPSILON){return Math.abs(e-t)<i}function cBe(e,t,i=Number.EPSILON){return e.distanceTo(t)<i}function pBe(e,t,i=Number.EPSILON){return e.distanceTo(t)<i}function Jxe(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)),s=Math.sqrt(Math.pow(i.x-e.x,2)+Math.pow(i.y-e.y,2));return Math.acos((n*n+r*r-s*s)/(2*n*r))}function fBe(e,t,i){return $ie(e,t)&&$ie(t,i)&&PH(e.position,t.position,i.position)}function PH(e,t,i){return ly.copy(t).sub(e).cross(LA.copy(i).sub(e))===0}function mBe(e,t,i,r,n){let s=Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2)),a=(e.y+t.y)/2,o=(e.x+t.x)/2,l=Math.sqrt(Math.pow(i,2)-Math.pow(s/2,2))*(e.y-t.y)/s,h=Math.sqrt(Math.pow(i,2)-Math.pow(s/2,2))*(t.x-e.x)/s;return r.set(o+l,a+h),n.set(o-l,a-h),[r,n]}function gBe(e,t,i){return e.distanceTo(i)<t.distanceTo(i)?t:e}function vBe(e,t,i,r,n,s){let a,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 Jxe(t,e,i)>Math.PI&&(d*=-1),a=WM(u,l)?(l+u)*(r/d-.5)*8/3/(o-h):(o+h)*(r/d-.5)*8/3/(u-l),n.set(t.x-a*l,t.y+a*o),s.set(i.x+a*u,i.y-a*h),[n,s]}function qie(e,t){return e.position.equals(e.controls[1].position)&&t.position.equals(t.controls[0].position)}function $ie(e,t){return PH(e.position,e.controls[1].position,t.position)&&PH(e.position,t.controls[0].position,t.position)}function Xie(e,t=12,i=!1){let r=[];for(let n=0,s=e.length;n<s;n++){let a=e[n],o=0;if(i&&a.roundedCurveCorner!==void 0){let l=.5*oy(a.roundedCurveCorner,t);n>0&&(r[n-1]+=l),o+=l}a.curveAfter!==void 0&&(o+=oy(a.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 CM?2*t:e&&(e instanceof Th||e instanceof aW)?1:e&&e instanceof DI?t*e.points.length:t}var Fb,I3,O3,wy,$I,ly,LA,ewe,twe,iwe,rwe,RH,DH,L3,Yie,Kie,Zie,Qie,Jie,ps,nwe=U(()=>{ae(),Fb=1e-12,I3=class{constructor(e){this.position=new Z,this.startPosition=new Z,this.uuid=et.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 I3(this.position).copy(this)}toJSON(){return[this.position.x,this.position.y]}},O3=class extends I3{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 I3{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 Z(...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 Z,t=new Z){let[i,r]=this.computeTangents();return i&&r&&(Hie(i,e),Hie(r,t)),[e,t]}computeTangent(e=new Z){let[t,i]=this.computeTangents();return t&&i&&e.copy(t).add(i).normalize(),e}computeNormal(e=new Z){let[t,i]=this.computeNormals();return e.copy(t).add(i).normalize(),e}},$I=e=>e,ly=new Z,LA=new Z,ewe=new Z,twe=new Z,iwe=new Z,rwe=new Z,RH=new R,DH=new R}),s0=U(()=>{ae(),nwe(),L3=new Z,Yie=new Z,Kie=new Z,Zie=new Z,Qie=new Z,Jie=new Z,ps=class extends vA{constructor(e=100,t=100){super(),this.points=[],this.shapeHoles=[],this.plane=new qa(new R(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=et.generateUUID(),this.needsUpdate=!1,this.roundedCurves=[],this._width=e,this._height=t}static createFromState(e,t,i){let r=new ps;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=>ps.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,s=this.shapeHoles.length;n<s;n++){let a=this.shapeHoles[n],o=a.points.length,l=a.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],s=e-t;if(s<=n.points.length-1)return n.points[s];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],s=n.points.indexOf(e);if(s>=0)return t+s;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 s=this.points[r];s.position.multiply(i),s.controls[0].position.multiply(i),s.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=et.generateUUID()){let r;r=e instanceof Z?e:new Z(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,s,a=12,o=!0){let l,h=DH.set(0,0,0),u=0,d=[];for(let c=0;c<s.length;c++){let p=$I(s[c]),f=ly,m=oy(p,a);d.push(m);for(let g=0;g<=m;g++)if(p instanceof mu||p instanceof pf||p instanceof Th){if(p.getPoint(g/m,f),h.set(f.x,f.y,0),l!==void 0&&pBe(l,h))continue;l===void 0&&(l=RH),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,s)=>n+s,0)+1}computeCurveDivisions(e=12){return this.curveDivisions=Xie(this.points,e,!1),this.roundedCurveDivisions=Xie(this.points,e,!0),this.curveDivisions}extractFilteredShapePointsToBuffer(e,t,i=12){return 2*function(r,n,s,a=12,o=!0){let l=DH.set(0,0,0),h=0,u=[];for(let d=0;d<n.length;d++){if(s[d]===!1)continue;let c,p=$I(n[d]),f=ly,m=oy(p,a);u.push(m);for(let g=0;g<=m;g++)if(p instanceof mu||p instanceof pf||p instanceof Th){if(p.getPoint(g/m,f),l.set(f.x,f.y,0),c?.equals(l))continue;c===void 0?c=RH:(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,s=!0){let a,o=0;for(let l=0;l<r.length;l++){let h=$I(r[l]),u=oy(h,n),d=ly;for(let c=0;c<=u;c++)if(h instanceof mu||h instanceof pf||h instanceof Th){if(h.getPoint(c/u,d),a!==void 0&&cBe(a,d,Fb))continue;a===void 0&&(a=LA),a.copy(d),i.push(d.x,d.y),o++}}return WM(i[0],i[i.length-2],Fb)&&WM(i[1],i[i.length-1],Fb)&&(i.pop(),i.pop()),s&&o>1&&!(WM(i[o-1],i[1],Fb)&&WM(i[o-2],i[0],Fb))&&(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 s=e-n;s<0&&(s+=r.reduce((a,o)=>a+o,0));for(let a=0,o=r.length;a<o;a++){let l=r[a];if(s<i+l)return[a,(s-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],s=this.curveDivisions,a=s[e];if(qie(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+=s[l];return(t-o)/a}dispose(){}_applyCurveForPoint(e,t){qie(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],s=this.points[i-1]??this.points[this.points.length-1],a=this.points[i+1]??this.points[0],o=n.roundness,l=s&&a&&fBe(s,n,a);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,f=h instanceof Th?h.v1.distanceTo(h.v2):h.getLength(),m=u instanceof Th?u.v1.distanceTo(u.v2):u.getLength(),g=Math.min(o,.499*f),v=Math.min(o,.499*m),y=Math.min(g,v),_=1-y/f,b=y/m,x=h.getPointAt(_,L3),w=u.getPointAt(b,Yie);if(this._subSplitCurve(h,c,_,x,void 0),this._subSplitCurve(u,p,b,void 0,w),this.useCubicForRoundedCorners){let S=Jxe(x,n.position,w)/2,T=Math.tan(S)*x.distanceTo(n.position),[M,E]=mBe(x,w,T,Kie,Zie),A=gBe(M,E,n.position),[P,N]=vBe(A,x,w,T,Qie,Jie);d=new mu(x.clone(),P.clone(),N.clone(),w.clone())}else d=new pf(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 s=e,a=t,o=s.getUtoTmapping(i,0),l=function(h,u,d,c,p=.5){let f=ly.subVectors(u,h).multiplyScalar(p).add(h),m=LA.subVectors(d,u).multiplyScalar(p).add(u),g=ewe.subVectors(c,d).multiplyScalar(p).add(d),v=f,y=twe.subVectors(m,f).multiplyScalar(p).add(f),_=iwe.subVectors(g,m).multiplyScalar(p).add(m),b=g,x=rwe.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]}(s.v0,s.v1,s.v2,s.v3,o);return r!==void 0&&(a.v0.set(l[0],l[1]),a.v1.set(l[2],l[3]),a.v2.set(l[4],l[5]),a.v3.set(l[6],l[7])),n!==void 0&&(a.v0.set(l[6],l[7]),a.v1.set(l[8],l[9]),a.v2.set(l[10],l[11]),a.v3.set(l[12],l[13])),a}return r!==void 0&&t.v2.copy(r),n!==void 0&&t.v1.copy(n),t}clone(){let e=new ps(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],s=e.points[r+1],a=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(et.generateUUID(),new Z(n,s));d.controls[0].position.set(a,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 ps;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 mu&&n.v3.equals(r.position)&&r.controls[0].position.copy(n.v2)};return this.points=(r=>{let n,s,a=[];for(n=0,s=r.length;n<s;n++)r[n]instanceof pf&&(r[n]=dBe(r[n]));for(n=0,s=r.length;n<s;n++){let h,u=r[n],d=n>0?r[n-1]:null;u instanceof mu?(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),a.push(h))}let o=r[r.length-1],l=!1;return o instanceof mu?o.v3.equals(a[0].position)&&(a[0].controls[0].position.copy(o.v2),l=!0):o instanceof Th&&o.v2.equals(a[0].position)&&(l=!0),this.isClosed=l,a})(e.curves),e instanceof vA&&(this.shapeHoles=e.holes.map(r=>{let n=new ps;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 N5({x:e,y:t},i,r,n,s){return{x:e*i+n,y:t*r+s}}function yBe(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),s=Math.cos(e+t),a=Math.sin(e+t);return[{x:r-n*i,y:n+r*i},{x:s+a*i,y:a-s*i},{x:s,y:a}]}function ere(e,t,i,r){let n=e*r-t*i<0?-1:1,s=Math.min(1,Math.max(-1,e*i+t*r));return n*Math.acos(s)}var XI,_Be=U(()=>{XI=2*Math.PI});function Ti(e,t){if(!e)throw t||"Assertion Failed!"}function zE(e){var t=e.windingRule,i=t===void 0?ns.ODD:t,r=e.elementType,n=r===void 0?wo.POLYGONS:r,s=e.polySize,a=s===void 0?3:s,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,f=p===void 0||p,m=e.debug,g=m!==void 0&&m;if(!c&&f)throw new Error("Contours can't be empty");if(c){var v=new swe;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,a,l,u,f),{vertices:v.vertices,vertexIndices:v.vertexIndices,vertexCount:v.vertexCount,elements:v.elements,elementCount:v.elementCount,mesh:g?v.mesh:void 0}}}var ns,wo,fi,Z1,WS,F0,I5,O5,L5,tre,B3,B5,ire,rre,swe,iC=U(()=>{var e;(e=ns||(ns={}))[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"}(wo||(wo={})),fi=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){Ti(t.vertLeq(i,r)&&t.vertLeq(r,n));var s=r.s-i.s,a=n.s-r.s;return s+a>0?s<a?r.t-i.t+(i.t-n.t)*(s/(s+a)):r.t-n.t+(n.t-i.t)*(a/(s+a)):0},t.edgeSign=function(i,r,n){Ti(t.vertLeq(i,r)&&t.vertLeq(r,n));var s=r.s-i.s,a=n.s-r.s;return s+a>0?(r.t-n.t)*s+(r.t-i.t)*a:0},t.transEval=function(i,r,n){Ti(t.transLeq(i,r)&&t.transLeq(r,n));var s=r.t-i.t,a=n.t-r.t;return s+a>0?s<a?r.s-i.s+(i.s-n.s)*(s/(s+a)):r.s-n.s+(n.s-i.s)*(a/(s+a)):0},t.transSign=function(i,r,n){Ti(t.transLeq(i,r)&&t.transLeq(r,n));var s=r.t-i.t,a=n.t-r.t;return s+a>0?(r.s-n.s)*s+(r.s-i.s)*a: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,s){return(i=i<0?0:i)<=(n=n<0?0:n)?n===0?(r+s)/2:r+i/(i+n)*(s-r):s+n/(i+n)*(r-s)},t.intersect=function(i,r,n,s,a){var o,l,h;t.vertLeq(i,r)||(h=i,i=r,r=h),t.vertLeq(n,s)||(h=n,n=s,s=h),t.vertLeq(i,n)||(h=i,i=n,n=h,h=r,r=s,s=h),t.vertLeq(n,r)?t.vertLeq(r,s)?((o=t.edgeEval(i,n,r))+(l=t.edgeEval(n,r,s))<0&&(o=-o,l=-l),a.s=t.interpolate(o,n.s,l,r.s)):((o=t.edgeSign(i,n,r))+(l=-t.edgeSign(i,s,r))<0&&(o=-o,l=-l),a.s=t.interpolate(o,n.s,l,s.s)):a.s=(n.s+r.s)/2,t.transLeq(i,r)||(h=i,i=r,r=h),t.transLeq(n,s)||(h=n,n=s,s=h),t.transLeq(i,n)||(h=i,i=n,n=h,h=r,r=s,s=h),t.transLeq(n,r)?t.transLeq(r,s)?((o=t.transEval(i,n,r))+(l=t.transEval(n,r,s))<0&&(o=-o,l=-l),a.t=t.interpolate(o,n.t,l,r.t)):((o=t.transSign(i,n,r))+(l=-t.transSign(i,s,r))<0&&(o=-o,l=-l),a.t=t.interpolate(o,n.t,l,s.t)):a.t=(n.t+r.t)/2},t}(),Z1=function(){this.next=null,this.prev=null,this.anEdge=null,this.trail=null,this.n=0,this.marked=!1,this.inside=!1},WS=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}(),F0=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},I5=function(){function t(){var i=new F0,r=new Z1,n=new WS(0),s=new WS(1);i.next=i.prev=i,i.anEdge=null,r.next=r.prev=r,n.next=n,n.Sym=s,s.next=s,s.Sym=n,this.vHead=i,this.fHead=r,this.eHead=n,this.eHeadSym=s}return t.prototype.makeEdge_=function(i){var r=new WS(0),n=new WS(1);i.Sym.side<i.side&&(i=i.Sym);var s=i.Sym.next;return n.next=s,s.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,s=r.Onext;n.Sym.Lnext=r,s.Sym.Lnext=i,i.Onext=s,r.Onext=n},t.prototype.makeVertex_=function(i,r,n){var s=i;Ti(s,"Vertex can't be null!");var a=n.prev;s.prev=a,a.next=s,s.next=n,n.prev=s,s.anEdge=r;var o=r;do o.Org=s,o=o.Onext;while(o!==r)},t.prototype.makeFace_=function(i,r,n){var s=i;Ti(s,"Face can't be null");var a=n.prev;s.prev=a,a.next=s,s.next=n,n.prev=s,s.anEdge=r,s.trail=null,s.marked=!1,s.inside=n.inside;var o=r;do o.Lface=s,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,s=n;do s.Org=r,s=s.Onext;while(s!==n);var a=i.prev,o=i.next;o.prev=a,a.next=o},t.prototype.killFace_=function(i,r){var n=i.anEdge,s=n;do s.Lface=r,s=s.Lnext;while(s!==n);var a=i.prev,o=i.next;o.prev=a,a.next=o},t.prototype.makeEdge=function(){var i=new F0,r=new F0,n=new Z1,s=this.makeEdge_(this.eHead);return this.makeVertex_(i,s,this.vHead),this.makeVertex_(r,s.Sym,this.vHead),this.makeFace_(n,s,this.fHead),s},t.prototype.splice=function(i,r){var n=!1,s=!1;if(i!==r){if(r.Org!==i.Org&&(s=!0,this.killVertex_(r.Org,i.Org)),r.Lface!==i.Lface&&(n=!0,this.killFace_(r.Lface,i.Lface)),this.splice_(r,i),!s){var a=new F0;this.makeVertex_(a,r,i.Org),i.Org.anEdge=i}if(!n){var o=new Z1;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 s=new Z1;this.makeFace_(s,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 s=new F0;return this.makeVertex_(s,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,s=this.makeEdge_(i),a=s.Sym;if(r.Lface!==i.Lface&&(n=!0,this.killFace_(r.Lface,i.Lface)),this.splice_(s,i.Lnext),this.splice_(a,r),s.Org=i.Dst,a.Org=r.Org,s.Lface=a.Lface=i.Lface,i.Lface.anEdge=a,!n){var o=new Z1;this.makeFace_(o,s,i.Lface)}return s},t.prototype.zapFace=function(i){var r,n,s,a,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)),(s=r.Sym).Onext===s?this.killVertex_(s.Org,null):(s.Org.anEdge=s.Onext,this.splice_(s,s.Oprev)),this.killEdge_(r));while(r!=l);a=i.prev,(o=i.next).prev=a,a.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,s,a,o;for(r=this.fHead.next;r!==this.fHead;r=r.next)if(r.inside)for(o=(n=r.anEdge).Org;s=n.Lnext,(a=n.Sym)&&a.Lface&&a.Lface.inside&&this.countFaceVerts_(r)+this.countFaceVerts_(a.Lface)-2<=i&&fi.vertCCW(n.Lprev.Org,n.Org,a.Lnext.Lnext.Org)&&fi.vertCCW(a.Lprev.Org,a.Org,n.Lnext.Lnext.Org)&&(s=a.Lnext,this.delete(a),n=null,a=null),!n||n.Lnext.Org!==o;)n=s;return!0},t.prototype.check=function(){var i,r,n,s,a,o,l=this.fHead,h=this.vHead,u=this.eHead;for(r=l,r=l;(i=r.next)!==l;r=i){Ti(i.prev===r),a=i.anEdge;do Ti(a.Sym!==a),Ti(a.Sym.Sym===a),Ti(a.Lnext.Onext.Sym===a),Ti(a.Onext.Sym.Lnext===a),Ti(a.Lface===i),a=a.Lnext;while(a!==i.anEdge)}for(Ti(i.prev===r&&i.anEdge===null),s=h,s=h;(n=s.next)!==h;s=n){Ti(n.prev===s),a=n.anEdge;do Ti(a.Sym!==a),Ti(a.Sym.Sym===a),Ti(a.Lnext.Onext.Sym===a),Ti(a.Onext.Sym.Lnext===a),Ti(a.Org===n),a=a.Onext;while(a!==n.anEdge)}for(Ti(n.prev===s&&n.anEdge===null),o=u,o=u;(a=o.next)!==u;o=a)Ti(a.Sym.next===o.Sym),Ti(a.Sym!==a),Ti(a.Sym.Sym===a),Ti(a.Org!==null),Ti(a.Dst!==null),Ti(a.Lnext.Onext.Sym===a),Ti(a.Onext.Sym.Lnext===a);Ti(a.Sym.next===o.Sym&&a.Sym===this.eHeadSym&&a.Sym.Sym===a&&a.Org===null&&a.Dst===null&&a.Lface===null&&a.Rface===null)},t}(),O5=function(){this.handle=null},L5=function(){this.key=null,this.node=0},tre=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 O5,this.handles[n]=new L5;this.initialized=!1,this.nodes[1].handle=1,this.handles[1].key=null}return t.prototype.floatDown_=function(i){var r,n,s,a=this.nodes,o=this.handles;for(r=a[i].handle;;){if((s=i<<1)<this.size&&this.leq(o[a[s+1].handle].key,o[a[s].handle].key)&&++s,Ti(s<=this.max),n=a[s].handle,s>this.size||this.leq(o[r].key,o[n].key)){a[i].handle=r,o[r].node=i;break}a[i].handle=n,o[n].node=i,i=s}},t.prototype.floatUp_=function(i){var r,n,s,a=this.nodes,o=this.handles;for(r=a[i].handle;;){if(n=a[s=i>>1].handle,s===0||this.leq(o[n].key,o[r].key)){a[i].handle=r,o[r].node=i;break}a[i].handle=n,o[n].node=i,i=s}},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 s,a;for(this.max*=2,a=this.nodes.length,this.nodes.length=this.max+1,s=a;s<this.nodes.length;s++)this.nodes[s]=new O5;for(a=this.handles.length,this.handles.length=this.max+1,s=a;s<this.handles.length;s++)this.handles[s]=new L5}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,s=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)),s},t.prototype.delete=function(i){var r,n=this.nodes,s=this.handles;Ti(i>=1&&i<=this.max&&s[i].key!==null),n[r=s[i].node].handle=n[this.size].handle,s[n[r].handle].node=r,--this.size,r<=this.size&&(r<=1||this.leq(s[n[r>>1].handle].key,s[n[r].handle].key)?this.floatDown_(r):this.floatUp_(r)),s[i].key=null,s[i].node=this.freeList,this.freeList=i},t}(),B3=function(){this.eUp=null,this.nodeUp=null,this.windingNumber=0,this.inside=!1,this.sentinel=!1,this.dirty=!1,this.fixUpperEdge=!1},B5=function(){this.key=null,this.next=null,this.prev=null},ire=function(){function t(i,r){this.frame=i,this.leq=r,this.head=new B5,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 B5;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}(),rre=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 s=i.event,a=r.eUp,o=n.eUp;return a.Dst===s?o.Dst===s?fi.vertLeq(a.Org,o.Org)?fi.edgeSign(o.Dst,a.Org,o.Org)<=0:fi.edgeSign(a.Dst,o.Org,a.Org)>=0:fi.edgeSign(o.Dst,s,o.Org)<=0:o.Dst===s?fi.edgeSign(a.Dst,s,a.Org)>=0:fi.edgeEval(a.Dst,s,a.Org)>=fi.edgeEval(o.Dst,s,o.Org)},t.deleteRegion=function(i,r){r.fixUpperEdge&&Ti(r.eUp.winding===0),r.eUp.activeRegion=null,i.dict.delete(r.nodeUp)},t.fixUpperEdge=function(i,r,n){Ti(r.fixUpperEdge),i.mesh.delete(r.eUp),r.fixUpperEdge=!1,r.eUp=n,n.activeRegion=r},t.topLeftRegion=function(i,r){var n,s=r.eUp.Org;do r=t.regionAbove(r);while(r.eUp.Org===s);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 s=new B3;return s.eUp=n,s.nodeUp=i.dict.insertBefore(r.nodeUp,s),s.fixUpperEdge=!1,s.sentinel=!1,s.dirty=!1,n.activeRegion=s,s},t.isWindingInside=function(i,r){switch(i.windingRule){case ns.ODD:return!!(1&r);case ns.NONZERO:return r!==0;case ns.POSITIVE:return r>0;case ns.NEGATIVE:return r<0;case ns.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,s=n.Lface;s.inside=r.inside,s.anEdge=n,t.deleteRegion(i,r)},t.finishLeftRegions=function(i,r,n){for(var s,a=null,o=r,l=r.eUp;o!==n;){if(o.fixUpperEdge=!1,(s=(a=t.regionBelow(o)).eUp).Org!=l.Org){if(!a.fixUpperEdge){t.finishRegion(i,o);break}s=i.mesh.connect(l.Lprev,s.Sym),t.fixUpperEdge(i,a,s)}l.Onext!==s&&(i.mesh.splice(s.Oprev,s),i.mesh.splice(l,s)),t.finishRegion(i,o),l=a.eUp,o=a}return l},t.addRightEdges=function(i,r,n,s,a,o){var l,h,u,d,c=!0;u=n;do Ti(fi.vertLeq(u.Org,u.Dst)),t.addRegionBelow(i,r,u.Sym),u=u.Onext;while(u!==s);for(a===null&&(a=t.regionBelow(r).eUp.Rprev),h=r,d=a;(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,Ti(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 s=fi.vertL1dist(r,i),a=fi.vertL1dist(n,i),o=.5*a/(s+a),l=.5*s/(s+a);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,s,a,o){r.coords[0]=r.coords[1]=r.coords[2]=0,r.idx=-1,t.vertexWeights(r,n,s),t.vertexWeights(r,a,o)},t.checkForRightSplice=function(i,r){var n=t.regionBelow(r),s=r.eUp,a=n.eUp;if(fi.vertLeq(s.Org,a.Org)){if(fi.edgeSign(a.Dst,s.Org,a.Org)>0)return!1;fi.vertEq(s.Org,a.Org)?s.Org!==a.Org&&(i.pq.delete(s.Org.pqHandle),t.spliceMergeVertices(i,a.Oprev,s)):(i.mesh.splitEdge(a.Sym),i.mesh.splice(s,a.Oprev),r.dirty=n.dirty=!0)}else{if(fi.edgeSign(s.Dst,a.Org,s.Org)<0)return!1;t.regionAbove(r).dirty=r.dirty=!0,i.mesh.splitEdge(s.Sym),i.mesh.splice(a.Oprev,s)}return!0},t.checkForLeftSplice=function(i,r){var n,s=t.regionBelow(r),a=r.eUp,o=s.eUp;if(Ti(!fi.vertEq(a.Dst,o.Dst)),fi.vertLeq(a.Dst,o.Dst)){if(fi.edgeSign(a.Dst,o.Dst,a.Org)<0)return!1;t.regionAbove(r).dirty=r.dirty=!0,n=i.mesh.splitEdge(a),i.mesh.splice(o.Sym,n),n.Lface.inside=r.inside}else{if(fi.edgeSign(o.Dst,a.Dst,o.Org)>0)return!1;r.dirty=s.dirty=!0,n=i.mesh.splitEdge(o),i.mesh.splice(a.Lnext,o.Sym),n.Rface.inside=r.inside}return!0},t.checkForIntersect=function(i,r){var n,s,a=t.regionBelow(r),o=r.eUp,l=a.eUp,h=o.Org,u=l.Org,d=o.Dst,c=l.Dst,p=new F0;if(Ti(!fi.vertEq(c,d)),Ti(fi.edgeSign(d,i.event,h)<=0),Ti(fi.edgeSign(c,i.event,u)>=0),Ti(h!==i.event&&u!==i.event),Ti(!r.fixUpperEdge&&!a.fixUpperEdge),h===u||Math.min(h.t,d.t)>Math.max(u.t,c.t))return!1;if(fi.vertLeq(h,u)){if(fi.edgeSign(c,h,u)>0)return!1}else if(fi.edgeSign(d,u,h)<0)return!1;return t.debugEvent(i),fi.intersect(d,h,c,u,p),Ti(Math.min(h.t,d.t)<=p.t),Ti(p.t<=Math.max(u.t,c.t)),Ti(Math.min(c.s,d.s)<=p.s),Ti(p.s<=Math.max(u.s,h.s)),fi.vertLeq(p,i.event)&&(p.s=i.event.s,p.t=i.event.t),n=fi.vertLeq(h,u)?h:u,fi.vertLeq(n,p)&&(p.s=n.s,p.t=n.t),fi.vertEq(p,h)||fi.vertEq(p,u)?(t.checkForRightSplice(i,r),!1):!fi.vertEq(d,i.event)&&fi.edgeSign(d,i.event,p)>=0||!fi.vertEq(c,i.event)&&fi.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),a),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),a=r,r=t.topRightRegion(r),s=t.regionBelow(r).eUp.Rprev,a.eUp=l.Oprev,l=t.finishLeftRegions(i,a,null),t.addRightEdges(i,r,l.Onext,o.Rprev,s,!0),!0):(fi.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),fi.edgeSign(c,i.event,p)<=0&&(r.dirty=a.dirty=!0,i.mesh.splitEdge(l.Sym),l.Org.s=i.event.s,l.Org.t=i.event.t),!1):(i.mesh.splitEdge(o.Sym),i.mesh.splitEdge(l.Sym),i.mesh.splice(l.Oprev,o),o.Org.s=p.s,o.Org.t=p.t,o.Org.pqHandle=i.pq.insert(o.Org),t.getIntersectData(i,o.Org,h,d,u,c),t.regionAbove(r).dirty=r.dirty=a.dirty=!0,!1)},t.walkDirtyRegions=function(i,r){for(var n,s,a=t.regionBelow(r);;){for(;a.dirty;)r=a,a=t.regionBelow(a);if(!r.dirty&&(a=r,(r=t.regionAbove(r))===null||!r.dirty))return;if(r.dirty=!1,n=r.eUp,s=a.eUp,n.Dst!==s.Dst&&t.checkForLeftSplice(i,r)&&(a.fixUpperEdge?(t.deleteRegion(i,a),i.mesh.delete(s),s=(a=t.regionBelow(r)).eUp):r.fixUpperEdge&&(t.deleteRegion(i,r),i.mesh.delete(n),n=(r=t.regionAbove(a)).eUp)),n.Org!==s.Org){if(n.Dst===s.Dst||r.fixUpperEdge||a.fixUpperEdge||n.Dst!==i.event&&s.Dst!==i.event)t.checkForRightSplice(i,r);else if(t.checkForIntersect(i,r))return}n.Org===s.Org&&n.Dst===s.Dst&&(t.addWinding(s,n),t.deleteRegion(i,r),i.mesh.delete(n),r=t.regionAbove(a))}},t.connectRightVertex=function(i,r,n){var s,a=n.Onext,o=t.regionBelow(r),l=r.eUp,h=o.eUp,u=!1;l.Dst!==h.Dst&&t.checkForIntersect(i,r),fi.vertEq(l.Org,i.event)&&(i.mesh.splice(a.Oprev,l),r=t.topLeftRegion(i,r),a=t.regionBelow(r).eUp,t.finishLeftRegions(i,t.regionBelow(r),o),u=!0),fi.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,a,a,!0):(s=fi.vertLeq(h.Org,l.Org)?h.Oprev:l,s=i.mesh.connect(n.Lprev,s),t.addRightEdges(i,r,s,s.Onext,s.Onext,!1),s.Sym.activeRegion.fixUpperEdge=!0,t.walkDirtyRegions(i,r))},t.connectLeftDegenerate=function(i,r,n){var s,a,o,l,h;return s=r.eUp,fi.vertEq(s.Org,n)?(Ti(!1),void t.spliceMergeVertices(i,s,n.anEdge)):fi.vertEq(s.Dst,n)?(Ti(!1),r=t.topRightRegion(r),a=l=(o=(h=t.regionBelow(r)).eUp.Sym).Onext,h.fixUpperEdge&&(Ti(a!==o),t.deleteRegion(i,h),i.mesh.delete(o),o=a.Oprev),i.mesh.splice(n.anEdge,o),fi.edgeGoesLeft(a)||(a=null),void t.addRightEdges(i,r,o.Onext,l,a,!0)):(i.mesh.splitEdge(s.Sym),r.fixUpperEdge&&(i.mesh.delete(s.Onext),r.fixUpperEdge=!1),i.mesh.splice(n.anEdge,s),void t.sweepEvent(i,n))},t.connectLeftVertex=function(i,r){var n,s,a,o,l,h,u=new B3;if(u.eUp=r.anEdge.Sym,n=i.dict.search(u).key,s=t.regionBelow(n)){if(o=n.eUp,l=s.eUp,fi.edgeSign(o.Dst,r,o.Org)===0)return void t.connectLeftDegenerate(i,n,r);a=fi.vertLeq(l.Dst,o.Dst)?n:s,n.inside||a.fixUpperEdge?(h=a===n?i.mesh.connect(r.anEdge.Sym,o.Lnext):i.mesh.connect(l.Dnext,r.anEdge).Sym,a.fixUpperEdge?t.fixUpperEdge(i,a,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 s=t.topLeftRegion(i,n.activeRegion);Ti(s!==null);var a=t.regionBelow(s),o=a.eUp,l=t.finishLeftRegions(i,a,null);l.Onext===o?t.connectRightVertex(i,s,l):t.addRightEdges(i,s,l.Onext,o,o,!0)},t.addSentinel=function(i,r,n,s){var a=new B3,o=i.mesh.makeEdge();o.Org.s=n,o.Org.t=s,o.Dst.s=r,o.Dst.t=s,i.event=o.Dst,a.eUp=o,a.windingNumber=0,a.inside=!1,a.fixUpperEdge=!1,a.sentinel=!0,a.dirty=!1,a.nodeUp=i.dict.insert(a)},t.initEdgeDict=function(i){i.dict=new ire(i,t.edgeLeq);var r=i.bmax[0]-i.bmin[0],n=i.bmax[1]-i.bmin[1],s=i.bmin[0]-r,a=i.bmax[0]+r,o=i.bmin[1]-n,l=i.bmax[1]+n;t.addSentinel(i,s,a,o),t.addSentinel(i,s,a,l)},t.doneEdgeDict=function(i){for(var r,n=0;(r=i.dict.min().key)!==null;)r.sentinel||(Ti(r.fixUpperEdge),Ti(++n===1)),Ti(r.windingNumber===0),t.deleteRegion(i,r)},t.removeDegenerateEdges=function(i){var r,n,s,a=i.mesh.eHead;for(r=a.next;r!==a;r=n)n=r.next,s=r.Lnext,fi.vertEq(r.Org,r.Dst)&&r.Lnext.Lnext!==r&&(t.spliceMergeVertices(i,s,r),i.mesh.delete(r),s=(r=s).Lnext),s.Lnext===r&&(s!==r&&((s===n||s===n.Sym)&&(n=n.next),i.mesh.delete(s)),(r===n||r===n.Sym)&&(n=n.next),i.mesh.delete(r))},t.initPriorityQ=function(i){var r,n,s,a=0;for(n=(s=i.mesh.vHead).next;n!==s;n=n.next)a++;for(a+=8,r=i.pq=new tre(a,fi.vertLeq),n=(s=i.mesh.vHead).next;n!==s;n=n.next)n.pqHandle=r.insert(n);return n===s&&(r.init(),!0)},t.donePriorityQ=function(i){i.pq=null},t.removeDegenerateFaces=function(i,r){var n,s,a;for(n=r.fHead.next;n!==r.fHead;n=s)s=n.next,Ti((a=n.anEdge).Lnext!==a),a.Lnext.Lnext===a&&(t.addWinding(a.Onext,a),i.mesh.delete(a));return!0},t.computeInterior=function(i,r){var n,s;if(r===void 0&&(r=!0),t.removeDegenerateEdges(i),!t.initPriorityQ(i))return!1;for(t.initEdgeDict(i);(n=i.pq.extractMin())!==null;){for(;(s=i.pq.min())!==null&&fi.vertEq(s,n);)s=i.pq.extractMin(),t.spliceMergeVertices(i,n.anEdge,s.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}(),swe=function(){function t(){this.mesh=new I5,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=ns.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,s,a,o,l,h=[0,0,0],u=[0,0,0],d=[0,0,0],c=[0,0,0],p=[0,0,0],f=[null,null,null],m=[null,null,null],g=this.mesh.vHead;r=g.next;for(var v=0;v<3;++v)a=r.coords[v],u[v]=a,m[v]=r,h[v]=a,f[v]=r;for(r=g.next;r!==g;r=r.next)for(var y=0;y<3;++y)(a=r.coords[y])<u[y]&&(u[y]=a,m[y]=r),a>h[y]&&(h[y]=a,f[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=m[_],s=f[_],d[0]=n.coords[0]-s.coords[0],d[1]=n.coords[1]-s.coords[1],d[2]=n.coords[2]-s.coords[2],r=g.next;r!==g;r=r.next)c[0]=r.coords[0]-s.coords[0],c[1]=r.coords[1]-s.coords[1],c[2]=r.coords[2]-s.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,s=this.mesh.vHead,a=0,o=n.next;o!==n;o=o.next)if(!((r=o.anEdge).winding<=0))do a+=(r.Org.s-r.Dst.s)*(r.Org.t+r.Dst.t),r=r.Lnext;while(r!==o.anEdge);if(a<0){for(i=s.next;i!==s;i=i.next)i.t=-i.t;this.tUnit[0]=-this.tUnit[0],this.tUnit[1]=-this.tUnit[1],this.tUnit[2]=-this.tUnit[2]}},t.prototype.projectPolygon_=function(){var i,r,n=this.mesh.vHead,s=[0,0,0],a=!1;s[0]=this.normal[0],s[1]=this.normal[1],s[2]=this.normal[2],!s[0]&&!s[1]&&!s[2]&&(this.computeNormal_(s),a=!0),i=this.sUnit,r=this.tUnit;var o=this.longAxis_(s);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]=s[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);a&&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,s;if((n=r.anEdge).Lnext===n||n.Lnext.Lnext===n)throw"Mono region invalid";for(;fi.vertLeq(n.Dst,n.Org);n=n.Lprev);for(;fi.vertLeq(n.Org,n.Dst);n=n.Lnext);for(s=n.Lprev;n.Lnext!==s;)if(fi.vertLeq(n.Dst,s.Org)){for(;s.Lnext!==n&&(fi.edgeGoesLeft(s.Lnext)||fi.edgeSign(s.Org,s.Dst,s.Lnext.Dst)<=0);)s=i.connect(s.Lnext,s).Sym;s=s.Lprev}else{for(;s.Lnext!==n&&(fi.edgeGoesRight(n.Lprev)||fi.edgeSign(n.Dst,n.Org,n.Lprev.Org)>=0);)n=i.connect(n,n.Lprev).Sym;n=n.Lnext}if(s.Lnext===n)throw"Mono region invalid";for(;s.Lnext.Lnext!==n;)s=i.connect(s.Lnext,s).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 s,a=i.eHead.next;a!==i.eHead;a=s)s=a.next,a.Rface.inside!==a.Lface.inside?a.winding=a.Lface.inside?r:-r:n?i.delete(a):a.winding=0},t.prototype.getNeighbourFace_=function(i){return i.Rface&&i.Rface.inside?i.Rface.n:-1},t.prototype.outputPolymesh_=function(i,r,n,s){var a,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){a=d.anEdge,o=0;do(u=a.Org).n===-1&&(u.n=h,h++),o++,a=a.Lnext;while(a!==d.anEdge);if(o>n)throw"Face vertex greater that support polygon";d.n=l,++l}for(this.elementCount=l,r===wo.CONNECTED_POLYGONS&&(l*=2),this.elements=[],this.elements.length=l*n,this.vertexCount=h,this.vertices=[],this.vertices.length=h*s,this.vertexIndices=[],this.vertexIndices.length=h,u=i.vHead.next;u!==i.vHead;u=u.next)if(u.n!==-1){var c=u.n*s;this.vertices[c+0]=u.coords[0],this.vertices[c+1]=u.coords[1],s>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){a=d.anEdge,o=0;do u=a.Org,this.elements[p++]=u.n,o++,a=a.Lnext;while(a!==d.anEdge);for(var f=o;f<n;++f)this.elements[p++]=-1;if(r===wo.CONNECTED_POLYGONS){a=d.anEdge;do this.elements[p++]=this.getNeighbourFace_(a),a=a.Lnext;while(a!==d.anEdge);for(var m=o;m<n;++m)this.elements[p++]=-1}}},t.prototype.outputContours_=function(i,r){var n,s,a=0,o=0;this.vertexCount=0,this.elementCount=0;for(var l=i.fHead.next;l!==i.fHead;l=l.next)if(l.inside){s=n=l.anEdge;do this.vertexCount++,n=n.Lnext;while(n!==s);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(a=0,l=i.fHead.next;l!==i.fHead;l=l.next)if(l.inside){o=0,s=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!==s);this.elements[d++]=a,this.elements[d++]=o,a+=o}},t.prototype.addContour=function(i,r){this.mesh===null&&(this.mesh=new I5),i<2&&(i=2),i>3&&(i=3);for(var n=null,s=0;s<r.length;s+=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[s+0],n.Org.coords[1]=r[s+1],n.Org.coords[2]=i>2?r[s+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,s,a,o){if(i===void 0&&(i=ns.ODD),r===void 0&&(r=wo.POLYGONS),o===void 0&&(o=!0),this.vertices=[],this.elements=[],this.vertexIndices=[],this.vertexIndexCounter=0,a&&(this.normal[0]=a[0],this.normal[1]=a[1],this.normal[2]=a[2]),this.windingRule=i,s<2&&(s=2),s>3&&(s=3),!this.mesh)return!1;this.projectPolygon_(),rre.computeInterior(this,o);var l=this.mesh;return r===wo.BOUNDARY_CONTOURS?this.setWindingNumber_(l,1,!0):this.tessellateInterior_(l),o&&l.check(),r===wo.BOUNDARY_CONTOURS?this.outputContours_(l,s):this.outputPolymesh_(l,r,n,s),!0},t}(),ns.ODD,ns.NONZERO,ns.POSITIVE,ns.NEGATIVE,ns.ABS_GEQ_TWO,wo.POLYGONS,wo.CONNECTED_POLYGONS,wo.BOUNDARY_CONTOURS});function awe(e,t){let i=e.length/2;if(i<2)return[];let r=0;for(let l=0;l<i;l++){let h=(l+1)%i;r+=e[2*l]*e[2*h+1]-e[2*h]*e[2*l+1]}let n=r>0!==t?1:-1,s=[];for(let l=0;l<i;l++){let h=(l+1)%i,u=e[2*h]-e[2*l],d=e[2*h+1]-e[2*l+1],c=Math.hypot(u,d);s.push(c>0?[n*d/c,-n*u/c]:[0,0])}let a=Math.cos(40*Math.PI/180),o=(l,h)=>{if(l[0]*h[0]+l[1]*h[1]<=a)return l;let[u,d]=[l[0]+h[0],l[1]+h[1]],c=Math.hypot(u,d);return c>0?[u/c,d/c]:l};return s.map((l,h)=>[o(l,s[(h+i-1)%i]),o(l,s[(h+1)%i])])}function owe(e,t,i){let r=e.length/2,n=new Float32Array(r+1);if(!(t>0)||!(i>0)||r<2)return{u:n,vScale:0};let s=0;for(let a=0;a<r;a++){let o=(a+1)%r;s+=Math.hypot((e[2*o]-e[2*a])/t,(e[2*o+1]-e[2*a+1])/i),n[a+1]=s}return{u:n,vScale:Math.sqrt(t*i)}}function lwe(e,t,i){for(let r=0;r<i.length;r+=3){let n=3*i[r],s=3*i[r+1],a=3*i[r+2],o=e[s]-e[n],l=e[s+1]-e[n+1],h=e[s+2]-e[n+2],u=e[a]-e[n],d=e[a+1]-e[n+1],c=e[a+2]-e[n+2],p=h*u-o*c,f=o*d-l*u;if((l*c-h*d)*(t[n]+t[s]+t[a])+p*(t[n+1]+t[s+1]+t[a+1])+f*(t[n+2]+t[s+2]+t[a+2])<0){let m=i[r+1];i[r+1]=i[r+2],i[r+2]=m}}}var $Y,hwe,XY,uwe=U(()=>{}),YY=U(()=>{$Y={vertices:[160,160,-160,160,-160,-160,160,-160],vertexIndices:[1,0,3,2],vertexCount:4,elements:[0,4],elementCount:1,mesh:void 0},hwe={vertices:[],vertexIndices:[],vertexCount:0,elements:[],elementCount:0,mesh:void 0},XY={vertices:[-160,160,160,-160,160,160,-160,-160],vertexIndices:[1,3,0,2],vertexCount:4,elements:[0,1,2,1,0,3],elementCount:2,mesh:void 0}});function dwe(e,t){return e.normals[3*t+2]<.9999}function cwe(e){let t=NH.get(e);if(t!==void 0)return t;if(!(e.rise>0))return e;let i=new Float32Array(e.normals),r=e.positions.length/3;for(let s=0;s<r;s++){if(!dwe(e,s))continue;let a=i[3*s],o=i[3*s+1],l=Math.hypot(a,o);if(l===0)continue;let h=e.rise-e.positions[3*s+2],u=Math.min(1,Math.max(0,1-h/e.rise)),d=Math.sqrt(1-u*u);i[3*s]=a/l*d,i[3*s+1]=o/l*d,i[3*s+2]=u}let n={...e,normals:i};return NH.set(e,n),n}function pwe(e,t,i,r){let n=(t-e.minX)/e.spanX,s=(i-e.minY)/e.spanY;return r?[s,n]:[n,s]}var NH,e4,IH,KY=U(()=>{NH=new WeakMap}),bBe=U(()=>{ae(),iC(),jr(),uwe(),YY(),KY(),e4=class extends At{constructor(e,t,i=12,r=ns.ODD,n,s=!1){super(),this.type="FlatExtrusionGeometry",this._nearSide=new Uint8Array(0),this._vScale=0,this._shape=e,this._depth=t,this._curveSegments=i,this._windingRule=r,this._uvPitch=s?void 0:n,this._legacy=s;let a,o=[e.extractShapePointsToFlatArray([],i),...e.shapeHoles.map(B=>B.extractShapePointsToFlatArray([],i))];try{a=zE({contours:o,windingRule:r,elementType:wo.POLYGONS,polySize:3,vertexSize:2,strict:!0})}catch{a=XY}let l=a?.vertexCount??0,h=a?.elementCount??0,u=1/0,d=1/0,c=-1/0,p=-1/0;for(let B of o)for(let V=0;V<B.length;V+=2)B[V]<u&&(u=B[V]),B[V]>c&&(c=B[V]),B[V+1]<d&&(d=B[V+1]),B[V+1]>p&&(p=B[V+1]);let f=this._uvPitch,m=f??(c-u||1),g=f??(p-d||1),v=f===void 0?u:0,y=f===void 0?d:0,_=o.map((B,V)=>awe(B,V>0)),b=0;for(let B of _)b+=B.length;let x=2*l+4*b,w=3*h*2+6*b,S=new Float32Array(3*x),T=new Float32Array(3*x),M=new Float32Array(2*x),E=new Uint32Array(w),A=new Uint8Array(x),P=0,N=0,D=0,O=!1,z=(B,V,j,K,$,Q,ce=(B-v)/m,pe=(V-y)/g)=>{let ye=3*N;S[ye]=B,S[ye+1]=V,S[ye+2]=j,T[ye]=K,T[ye+1]=$,T[ye+2]=Q,A[N]=j===t?O?2:1:0,M[2*N]=ce,M[2*N+1]=pe,N++};if(a!==void 0)for(let[B,V]of[[t,1],[0,-1]]){let j=N;for(let K=0;K<l;K++)z(a.vertices[2*K],a.vertices[2*K+1],B,0,0,V);for(let K=0;K<h;K++){let[$,Q,ce]=[a.elements[3*K],a.elements[3*K+1],a.elements[3*K+2]];E[D++]=j+$,E[D++]=j+(V>0?Q:ce),E[D++]=j+(V>0?ce:Q)}}O=!0;for(let B=0;B<o.length;B++){let V=o[B],j=_[B],K=V.length/2,{u:$,vScale:Q}=s?{u:new Float32Array(K+1),vScale:0}:owe(V,m,g);P=Q;let ce=Q===0?0:t/Q,pe={minX:v,minY:y,spanX:m,spanY:g},ye=(we,[ne,Se],W,k)=>{let Y=V[2*we],ie=V[2*we+1],[G,oe]=s?pwe(pe,Y,ie,W):[k,W?0:ce];z(Y,ie,W?0:t,ne,Se,0,G,oe)};for(let we=0;we<j.length;we++){let ne=(we+1)%K,[Se,W]=j[we],[k,Y]=[$[we],$[we+1]],ie=N;ye(we,Se,!1,k),ye(we,Se,!0,k),ye(ne,W,!1,Y),ye(ne,W,!0,Y),E[D++]=ie,E[D++]=ie+1,E[D++]=ie+2,E[D++]=ie+3,E[D++]=ie+2,E[D++]=ie+1}}lwe(S,T,E),this.setAttribute("position",new Dt(S,3)),this.setAttribute("normal",new Dt(T,3)),this.setAttribute("uv",new Dt(M,2)),this.setIndex(new Dt(E,1)),this._nearSide=A,this._vScale=P}takeDepthStateFrom(e){let t=e;t._nearSide!==void 0&&(this._depth=t._depth??this._depth,this._nearSide=t._nearSide,this._vScale=t._vScale??this._vScale)}canShiftDepthTo(e){return this._nearSide.length>0&&this._depth>0&&e>0}shiftDepthTo(e){if(!this.canShiftDepthTo(e))return!1;let t=e-this._depth;if(this._depth=e,t===0)return!0;let i=this.getAttribute("position");if(i===void 0)return!1;let r=i.array,n=this.getAttribute("uv"),s=n?.array,a=this._vScale>0?t/this._vScale:0,o=this._nearSide;for(let l=0;l<o.length;l++){let h=o[l];h!==0&&(r[3*l+2]+=t,h===2&&s!==void 0&&(s[2*l+1]+=a))}return i.needsUpdate=!0,n!==void 0&&a!==0&&(n.needsUpdate=!0),this.refreshDepthBounds(e),!0}refreshDepthBounds(e){if(this.boundingBox===null&&this.boundingSphere===null)return;this.boundingBox===null&&this.computeBoundingBox();let t=this.boundingBox;t.min.z=Math.min(0,e),t.max.z=Math.max(0,e),this.boundingSphere!==null&&t.getBoundingSphere(this.boundingSphere)}clone(){let e=new e4(this._shape,this._depth,this._curveSegments,this._windingRule,this._uvPitch,this._legacy);return e.userData=dB(this.userData),e}}}),fwe=U(()=>{ae(),iC(),jr(),YY(),IH=class extends At{constructor(e,t=12,i={}){super(),this.type="ShapeGeometry",this.windingRule=ns.ODD,this.elementType=wo.POLYGONS,this.polySize=3,this.vertexSize=2,this.strict=!0,this._shape=e,this._curveSegments=t,this._triangulationOptions=Object.assign({windingRule:ns.ODD,elementType:wo.POLYGONS,polySize:3,vertexSize:2,strict:!0},i);let r,n,s,a=this._shape.extractShapePointsToFlatArray([],this._curveSegments),o=this._shape.shapeHoles.map(c=>c.extractShapePointsToFlatArray([],this._curveSegments)),l=!0,h=!0;for(let c=0,p=a.length/2;c<p;c++){let f=2*c,m=a[f+0],g=a[f+1];if(n!==void 0&&m!==n&&(l=!1),s!==void 0&&g!==s&&(h=!1),n=m,s=g,!l&&!h)break}if(!l&&!h)try{r=zE({contours:[a,...o],windingRule:this._triangulationOptions.windingRule,elementType:this._triangulationOptions.elementType,polySize:this._triangulationOptions.polySize,vertexSize:this._triangulationOptions.vertexSize,strict:this._triangulationOptions.strict})}catch{r=$Y}let u=r?.vertexCount??1,d=r?.elementCount??1;if(this._positionAttribute=new Dt(new Float32Array(3*u),3),this._normalAttribute=new Dt(new Float32Array(3*u),3),this._uvAttribute=new Dt(new Float32Array(2*u),2),this._indexAttribute=new Dt(new Uint32Array(3*d),1),r){let c=1/0,p=-1/0,f=1/0,m=-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<f&&(f=w),w>m&&(m=w)}let g=p-c,v=m-f;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,T=(w-f)/v;this._positionAttribute.setXYZ(y,x,w,0),this._normalAttribute.setXYZ(y,0,0,1),this._uvAttribute.setXY(y,S,T)}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 IH(this._shape,this._curveSegments);return e.userData=dB(this.userData),e}}});function xBe(e){return nre||(nre=async function(){let t=e??"https://unpkg.com/@splinetool/runtime@2.0.123/build",i=Promise.resolve().then(()=>(aQ(),sQ)),[r,n]=await Promise.all([i,fetch(`${t}/bevel.wasm`).then(s=>s.arrayBuffer())]);await r.default({module_or_path:n}),rC=r}())}function wBe(e){let t=!1;return e.scene.objects.traverse((i,r)=>{let n=r.geometry;if(n!==void 0&&(ywe.has(n.type)&&n.depth!==void 0&&n.depth>0&&(n.extrudeBevelSize??0)>0&&(t=!0),n.type==="PathGeometry")){let s=n.extrusion;s!==void 0&&s.capType==="round"&&(s.bevel??0)>0&&(t=!0)}}),t}function mwe(e,t){let i=[e.extractShapePointsToFlatArray([],t)];for(let o of e.shapeHoles)i.push(o.extractShapePointsToFlatArray([],t));let r=0;for(let o of i)r+=o.length>>1;let n=new Float64Array(2*r),s=new Uint32Array(i.length),a=0;for(let o=0;o<i.length;o++)n.set(i[o],2*a),a+=i[o].length>>1,s[o]=a;return{points:n,ends:s}}function t4(e,t,i,r,n,s){let a=e.positions.length/3,o=n.elements,l=_we.getNormalMatrix(n).elements;for(let u=0;u<a;u++){let d=3*u,c=3*(i+u),p=e.positions[d],f=e.positions[d+1],m=e.positions[d+2];t.positions[c]=o[0]*p+o[4]*f+o[8]*m+o[12],t.positions[c+1]=o[1]*p+o[5]*f+o[9]*m+o[13],t.positions[c+2]=o[2]*p+o[6]*f+o[10]*m+o[14];let g=e.normals[d],v=e.normals[d+1],y=e.normals[d+2];t.normals[c]=l[0]*g+l[3]*v+l[6]*y,t.normals[c+1]=l[1]*g+l[4]*v+l[7]*y,t.normals[c+2]=l[2]*g+l[5]*v+l[8]*y;let _=2*(i+u);if(s===void 0)t.uvs[_]=e.uvs[2*u],t.uvs[_+1]=e.uvs[2*u+1];else{let[b,x]=s(p,f,e.uvs[2*u],e.uvs[2*u+1],u);t.uvs[_]=b,t.uvs[_+1]=x}}let h=n.determinant()<0;for(let u=0;u<e.indices.length;u+=3)t.indices[r+u]=e.indices[u]+i,t.indices[r+u+1]=e.indices[u+(h?2:1)]+i,t.indices[r+u+2]=e.indices[u+(h?1:2)]+i}function gwe(e){let{owner:t,shape:i,curveSegments:r,assembledAt:n,bevel:s,bevelSegments:a}=e,o=function(c,p){let f=[p],m=g=>{f.push(g.points.length,g.isClosed?1:0,g.roundness??0);for(let v of g.points){f.push(v.roundness??0,v.position.x,v.position.y);for(let y of v.controls)f.push(y.position.x,y.position.y)}f.push(g.shapeHoles.length);for(let v of g.shapeHoles)m(v)};return m(c),function(g){let v=2166136261;for(let y=0;y<g.length;y++)v^=g[y],v=Math.imul(v,16777619)>>>0;return v}(new Uint8Array(new Float64Array(f).buffer))}(i,r),l=t??`outline:${o}`,h=`${s}/${a}`,u=i4.get(l);if(u!==void 0&&u.outlineVersion===o&&u.capKey===h&&(e.stillServes?.(u)??1))return OH.placements++,u.cap;let d=function(c,p,f,m,g){let{points:v,ends:y}=mwe(c,p);return rC.assemble_cap(v,y,f,m,0,Math.max(1,Math.floor(g)),vwe,40)}(i,r,n,s,a);OH.assemblies++;try{let c=function(p,f){return function(m,g,v,y,_){let b=1/0;for(let x=2;x<m.length;x+=3)m[x]<b&&(b=m[x]);if(b===1/0&&(b=0),b!==0)for(let x=2;x<m.length;x+=3)m[x]-=b;return{positions:m,normals:g,uvs:v,indices:y,rise:_-b}}(p.positions(),p.normals(),p.uvs(),p.indices(),f)}(d,n);return i4.set(l,{outlineVersion:o,capKey:h,assembledAt:n,cap:c}),c}finally{d.free()}}function ax(e,t){return .5*t>1.001*e}var rC,vwe,nre,ywe,_we,sre,are,ore,i4,OH,LH,a0,Ew=U(()=>{ae(),jr(),uwe(),KY(),vwe=.4,ywe=new Set(["VectorGeometry","TextGeometry","InputGeometry","PolygonGeometry","RectangleGeometry","StarGeometry","TriangleGeometry","EllipseGeometry"]),_we=new oi,sre=new Ue,are=new Ue,ore=new Ue().makeScale(1,1,-1),i4=new Map,OH={assemblies:0,placements:0},LH=class extends At{constructor(e,t,i=0,r=12,n=3,s,a,o=!1){if(super(),this.type="ShapeGeometry",this._nearSide=new Uint8Array(0),this._effectiveBevel=0,this._vScale=0,rC===void 0)throw new Error("bevel-wasm is not loaded");this._shape=e,this._uvPitch=a,this._legacy=o,this._depth=t,this._bevel=i,this._curveSegments=r,this._bevelSegments=n,this._ownerId=s,this.rebuild()}takeDepthStateFrom(e){let t=e;t._nearSide!==void 0&&(this._depth=t._depth??this._depth,this._nearSide=t._nearSide,this._vScale=t._vScale??this._vScale,this._effectiveBevel=t._effectiveBevel??this._effectiveBevel)}canShiftDepthTo(e){return this._nearSide.length>0&&ax(this._effectiveBevel,e)&&ax(this._effectiveBevel,this._depth)}shiftDepthTo(e){if(!this.canShiftDepthTo(e))return!1;let t=e-this._depth;if(this._depth=e,t===0)return!0;let i=this.getAttribute("position");if(i===void 0)return!1;let r=i.array,n=this.getAttribute("uv"),s=n?.array,a=this._vScale>0?t/this._vScale:0,o=this._nearSide;for(let l=0;l<o.length;l++){let h=o[l];h!==0&&(r[3*l+2]+=t,h===2&&s!==void 0&&(s[2*l+1]+=a))}return i.needsUpdate=!0,n!==void 0&&a!==0&&(n.needsUpdate=!0),this.refreshDepthBounds(e),!0}refreshDepthBounds(e){if(this.boundingBox===null&&this.boundingSphere===null)return;this.boundingBox===null&&this.computeBoundingBox();let t=this.boundingBox;t.min.z=Math.min(0,e),t.max.z=Math.max(0,e),this.boundingSphere!==null&&t.getBoundingSphere(this.boundingSphere)}setDepth(e){e!==this._depth&&(this._depth=e,this.rebuild(),this.computeBoundingSphere(),this.computeBoundingBox())}rebuild(){let e=gwe({owner:this._ownerId,shape:this._shape,curveSegments:this._curveSegments,assembledAt:this._depth,bevel:this._bevel,bevelSegments:this._bevelSegments,stillServes:a=>ax(a.cap.rise,this._depth)&&ax(a.cap.rise,a.assembledAt)}),t=function(a,o,l,h,u,d=!1){let c=h.positions.length/3,p=l-h.rise,f=h.rise,{points:m,ends:g}=mwe(a,o),v=1/0,y=1/0,_=-1/0,b=-1/0;for(let pe=0;pe<m.length;pe+=2)m[pe]<v&&(v=m[pe]),m[pe]>_&&(_=m[pe]),m[pe+1]<y&&(y=m[pe+1]),m[pe+1]>b&&(b=m[pe+1]);d&&(u=void 0);let x=u??_-v,w=u??b-y,S={minX:v,minY:y,spanX:_-v||1,spanY:b-y||1},T=[],M=0;for(let pe of g)T.push({at:M,count:pe-M}),M=pe;let E=0;for(let pe of T)E+=pe.count;let A=2*c+4*E,P=new Float32Array(3*A),N=new Float32Array(3*A),D=new Float32Array(2*A),O=new Uint32Array(2*h.indices.length+6*E),z=new Uint8Array(A),B=0,V=u===void 0?void 0:(pe,ye)=>[pe/u,ye/u],j=d?(pe,ye,we,ne,Se)=>dwe(h,Se)?[ne,we]:[we,ne]:V,K=d?cwe(h):h,$={positions:P,normals:N,uvs:D,indices:O};t4(K,$,0,0,sre.makeTranslation(0,0,p),V),t4(K,$,c,h.indices.length,are.makeTranslation(0,0,f).multiply(ore),j),z.fill(1,0,c);let Q=2*c,ce=2*h.indices.length;for(let pe=0;pe<T.length;pe++){let{at:ye,count:we}=T[pe],ne=m.subarray(2*ye,2*(ye+we)),Se=awe(ne,pe>0),W=d?{u:new Float32Array(we+1),vScale:0}:owe(ne,x,w),k=W.u;B=W.vScale;for(let Y=0;Y<we;Y++){let ie=(Y+1)%we,[G,oe]=Se[Y],se=Q;for(let[H,me,xe,ke,Te,Ze]of[[ne[2*Y],ne[2*Y+1],G,p,k[Y],2],[ne[2*ie],ne[2*ie+1],oe,p,k[Y+1],2],[ne[2*ie],ne[2*ie+1],oe,f,k[Y+1],0],[ne[2*Y],ne[2*Y+1],G,f,k[Y],0]]){let ze=3*Q;if(P[ze]=H,P[ze+1]=me,P[ze+2]=ke,N[ze]=xe[0],N[ze+1]=xe[1],N[ze+2]=0,d){let[qe,Ne]=pwe(S,H,me,Ze===0);D[2*Q]=qe,D[2*Q+1]=Ne}else D[2*Q]=Te,D[2*Q+1]=B===0?0:(ke-f)/B;z[Q]=Ze,Q++}O[ce++]=se,O[ce++]=se+1,O[ce++]=se+2,O[ce++]=se,O[ce++]=se+2,O[ce++]=se+3}}return lwe(P,N,O),{positions:P,normals:N,uvs:D,indices:O,nearSide:z,vScale:B}}(this._shape,this._curveSegments,this._depth,e,this._uvPitch,this._legacy);this._nearSide=t.nearSide,this._vScale=t.vScale,this._effectiveBevel=e.rise;let i=this.getAttribute("position"),r=this.getAttribute("normal"),n=this.getAttribute("uv"),s=this.getIndex();if(i!==void 0&&r!==void 0&&n!==void 0&&s!==null&&i.array.length===t.positions.length&&r.array.length===t.normals.length&&n.array.length===t.uvs.length&&s.array.length===t.indices.length)return i.array.set(t.positions),r.array.set(t.normals),n.array.set(t.uvs),s.array.set(t.indices),i.needsUpdate=!0,r.needsUpdate=!0,n.needsUpdate=!0,void(s.needsUpdate=!0);this.setAttribute("position",new Dt(t.positions,3)),this.setAttribute("normal",new Dt(t.normals,3)),this.setAttribute("uv",new Dt(t.uvs,2)),this.setIndex(new Dt(t.indices,1))}clone(){let e=new LH(this._shape,this._depth,this._bevel,this._curveSegments,this._bevelSegments,this._ownerId,this._uvPitch,this._legacy);return e.userData=dB(this.userData),e}}}),Qg=U(()=>{s0(),bBe(),fwe(),Ew(),iC(),a0=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:ns.ODD},e.parameters),n=Math.abs(r.width),s=Math.abs(r.height??r.width),a=Math.abs(r.depth??0),o=e.shape??t?.shape,l=o?.roundness??r.roundness;o!==void 0&&(o instanceof ps?(i=o,(i.width!==n||i.height!==s)&&i.applySize(n,s)):i=new ps(n,s).fromJSON(o),e.parameters?.roundness!==void 0&&e.parameters?.roundness>0&&i.update());let h=i??new ps(n,s);return{parameters:Object.assign(r,{width:n,height:s,depth:a,roundness:l}),shape:h,ownerId:e.ownerId??t?.ownerId}}static build(e){let t,{depth:i,extrudeBevelSize:r,extrudeBevelSegments:n,subdivisions:s,roundness:a,windingRule:o,uvPitch:l,extrusionVersion:h}=e.parameters,u=h===1;return e.shape.roundness=a,i<=0?t=new IH(e.shape,s,{windingRule:o}):r<=0?t=new e4(e.shape,i,s,o,l,u):rC!==void 0?t=new LH(e.shape,i,r,s,n,e.ownerId,l,u):(console.error("[extrude] engine not loaded \u2014 extruding without a bevel"),t=new e4(e.shape,i,s,o,l,u)),Object.assign(t,{userData:{...e,type:"VectorGeometry"}})}}});function SBe(e,t,i,r,n,s){if(r>=ZY)return n>30||n%4==0?(function(u,d,c,p=0,f=0,m=0){let g=.5522847498,v=d*g,y=c*g;u.addPoint(F3(f-d,m,f-d,m-y,f-d,m+y)),u.addPoint(F3(f,m+c,f-v,m+c,f+v,m+c)),u.addPoint(F3(f+d,m,f+d,m+y,f+d,m-y)),u.addPoint(F3(f,m-c,f+v,m-c,f-v,m-c)),p>0&&xwe(u,d,c,p)}(e,t,i,s),Math.round(n/4)):lre(e,r,n,t,i,s);let a={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:f,ry:m,largeArcFlag:g,sweepFlag:v}){let y=[];if(f===0||m===0)return[];let _=(u-c)/2,b=(d-p)/2;if(_===0&&b===0)return[];f=Math.abs(f),m=Math.abs(m);let x=Math.pow(_,2)/Math.pow(f,2)+Math.pow(b,2)/Math.pow(m,2);x>1&&(f*=Math.sqrt(x),m*=Math.sqrt(x));let w=function(N,D,O,z,B,V,j,K,$,Q){let ce=Math.pow(B,2),pe=Math.pow(V,2),ye=Math.pow(j,2),we=Math.pow(K,2),ne=ce*pe-ce*we-pe*ye;ne<0&&(ne=0),ne/=ce*we+pe*ye,ne=Math.sqrt(ne)*($===Q?-1:1);let Se=ne*B/V*K,W=ne*-V/B*j,k=Se+(N+O)/2,Y=W+(D+z)/2,ie=(j-Se)/B,G=(K-W)/V,oe=(-j-Se)/B,se=(-K-W)/V,H=ere(1,0,ie,G),me=ere(ie,G,oe,se);return!Q&&me>0&&(me-=XI),Q&&me<0&&(me+=XI),{centerx:k,centery:Y,ang1:H,ang2:me}}(u,d,c,p,f,m,_,b,g,v),{ang1:S,ang2:T}=w,{centerx:M,centery:E}=w,A=Math.abs(T)/(XI/4);Math.abs(1-A)<1e-7&&(A=1);let P=Math.max(Math.ceil(A),1);T/=P;for(let N=0;N<P;N++)y.push(yBe(S,T)),S+=T;return y.map(N=>{let{x:D,y:O}=N5(N[0],f,m,M,E),{x:z,y:B}=N5(N[1],f,m,M,E),{x:V,y:j}=N5(N[2],f,m,M,E);return{x1:D,y1:O,x2:z,y2:B,x:V,y:j}})}({px:a.x,py:a.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,f,m,g,v){let y=Math.round(f/p.length);u.addPoint(Px(d,c));for(let _=0,b=p.length;_<b;_++){let x=p[_],w=u.points[_],S=Px(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?bwe(u,m,g,v):u.addPoint(Px(0,0)),y}(e,a.x,a.y,h,n,t,i,s):lre(e,r,n,t,i,s)}function lre(e,t,i,r,n,s){let a=-t/i;for(let o=0;o<=i;o++){let l=a*o,h=Math.sin(l)*r,u=Math.cos(l)*n;e.addPoint(Px(h,u))}return t<ZY?s>0?bwe(e,r,n,s):e.addPoint(Px(0,0)):(e.removePoint(e.points[e.points.length-1]),s>0&&xwe(e,r,n,s)),1}function Px(e,t){return new wy(et.generateUUID(),new Z(e,t))}function F3(e,t,i,r,n,s){let a=Px(e,t);return a.controls[0].position.set(i,r),a.controls[1].position.set(n,s),a}function bwe(e,t,i,r){wwe(e,t,i,r).forEach(n=>e.addPoint(n))}function xwe(e,t,i,r){let n=wwe(e,t,i,r),s=new ps;n.forEach(a=>s.addPoint(a)),s.isClosed=!0,e.shapeHoles.push(s)}function wwe(e,t,i,r){let n=r*t/100,s=n*(Math.abs(i)/Math.abs(t)),a=new Z(n/t,s/i),o=e.points.map(l=>{let h=l.clone();return h.uuid=et.generateUUID(),h}).reverse();return o.forEach(l=>{l.position.multiply(a);let h=l.controls[0].position.clone().multiply(a),u=l.controls[1].position.clone().multiply(a);l.controls[0].position.copy(u),l.controls[1].position.copy(h)}),o}var ZY,CB,Swe,F5,Twe,r4=U(()=>{s0(),nwe(),_Be(),Qg(),ae(),ZY=2*Math.PI,CB=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=et.clamp(i.angle,0,360),{shape:e.shape&&e.shape instanceof ps?e.shape:new ps,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:s,innerRadius:a,depth:o,extrudeBevelSize:l,extrudeBevelSegments:h,extrusionVersion:u}=e.parameters,d=e.shape,c=SBe(d,.5*i,.5*r,s*Math.PI/180,n,a);return d.isClosed=!0,d.update(),s===0?(t=new At,t.setAttribute("position",new Et([],3))):t=a0.create({shape:d,parameters:{subdivisions:c,depth:o,extrudeBevelSize:l,extrudeBevelSegments:h,extrusionVersion:u}}),Object.assign(t,{userData:{...e,type:"EllipseGeometry"}})}}}),hre=U(()=>{ae(),Qxe(),Swe=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:s,cornerSides:a}=e.parameters,o=n===0&&s!==0?new F5(.5*t,s,a):new hW(.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"}})}},F5=class extends QL{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 F5(e.radius,e.corner,e.cornerSides)}}}),ure=U(()=>{ae(),Twe=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 vA;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 s=new uW(n.extractPoints(r).shape,i);return s.rotateZ(Math.PI),Object.assign(s,{userData:{...e,type:"LatheGeometry"}})}}});function Q1(e,t){return Math.abs(t-e)/2+Math.min(e,t)}function TBe(e){let{positions:t,faces:i,materialIndices:r,uvs:n}=e,s=t.length/3,a=i.length/3,o=n!==null&&a>0,l=3*a,h=new Uint32Array(l),u=new Uint32Array(l),d=new Uint32Array(l),c=new Uint32Array(l),p=new Uint32Array(l),f=0,m=8;for(;m<2*l;)m*=2;let g=m-1,v=new Int32Array(m).fill(-1),y=(D,O)=>{let z=(Math.imul(D,2654435761)^O)&g;for(;;){let B=v[z];if(B===-1)return v[z]=f,h[f]=D,u[f]=O,f++;if(h[B]===D&&u[B]===O)return B;z=z+1&g}},_=(D,O)=>{let z=D<O?D:O,B=D<O?O:D,V=(Math.imul(z,2654435761)^B)&g;for(;;){let j=v[V];if(h[j]===z&&u[j]===B)return j;V=V+1&g}},b=new Uint32Array(s),x=new Float64Array(3*s),w=(D,O,z)=>{let B=D<O?y(D,O):y(O,D),V=++d[B];V===1?c[B]=z:V===2&&(p[B]=z),b[D]++,b[O]++,x[3*D]+=t[3*O],x[3*D+1]+=t[3*O+1],x[3*D+2]+=t[3*O+2],x[3*O]+=t[3*D],x[3*O+1]+=t[3*D+1],x[3*O+2]+=t[3*D+2]};for(let D=0;D<a;D++){let O=i[3*D],z=i[3*D+1],B=i[3*D+2];w(O,z,B),w(z,B,O),w(B,O,z)}let S=new Float64Array(3*f);for(let D=0;D<f;D++){let O=3*h[D],z=3*u[D];if(d[D]===2){let B=3*c[D],V=3*p[D];S[3*D]=.375*(t[O]+t[z])+.125*(t[B]+t[V]),S[3*D+1]=.375*(t[O+1]+t[z+1])+.125*(t[B+1]+t[V+1]),S[3*D+2]=.375*(t[O+2]+t[z+2])+.125*(t[B+2]+t[V+2])}else S[3*D]=.5*(t[O]+t[z]),S[3*D+1]=.5*(t[O+1]+t[z+1]),S[3*D+2]=.5*(t[O+2]+t[z+2])}let T,M=new Float64Array(3*s);for(let D=0;D<s;D++){let O=b[D];O===3?T=3/16:O>3&&(T=3/(8*O));let z=1-O*Number(T),B=Number(T);O===2&&(z=3/4,B=1/8),M[3*D]=t[3*D]*z+x[3*D]*B,M[3*D+1]=t[3*D+1]*z+x[3*D+1]*B,M[3*D+2]=t[3*D+2]*z+x[3*D+2]*B}let E=new Float64Array(3*(s+f));E.set(M),E.set(S,3*s);let A=new Uint32Array(12*a),P=new Array(4*a),N=o?new Float64Array(24*a):null;for(let D=0;D<a;D++){let O=i[3*D],z=i[3*D+1],B=i[3*D+2],V=_(O,z)+s,j=_(z,B)+s,K=_(B,O)+s,$=12*D;A[$++]=V,A[$++]=j,A[$++]=K,A[$++]=O,A[$++]=V,A[$++]=K,A[$++]=z,A[$++]=j,A[$++]=V,A[$++]=B,A[$++]=K,A[$++]=j;let Q=r[D];if(P[4*D]=Q,P[4*D+1]=Q,P[4*D+2]=Q,P[4*D+3]=Q,N!==null){let ce=6*D,pe=n[ce],ye=n[ce+1],we=n[ce+2],ne=n[ce+3],Se=n[ce+4],W=n[ce+5],k=Q1(pe,we),Y=Q1(ye,ne),ie=Q1(we,Se),G=Q1(ne,W),oe=Q1(pe,Se),se=Q1(ye,W),H=24*D;N[H++]=k,N[H++]=Y,N[H++]=ie,N[H++]=G,N[H++]=oe,N[H++]=se,N[H++]=pe,N[H++]=ye,N[H++]=k,N[H++]=Y,N[H++]=oe,N[H++]=se,N[H++]=we,N[H++]=ne,N[H++]=ie,N[H++]=G,N[H++]=k,N[H++]=Y,N[H++]=Se,N[H++]=W,N[H++]=oe,N[H++]=se,N[H++]=ie,N[H++]=G}}return{positions:E,faces:A,materialIndices:P,uvs:N}}var U3,Mwe,ta,Ewe,QY,MBe=U(()=>{ae(),U3=1e4,Mwe=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 s=r.getAttribute("uv"),a=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(_*U3),S=Math.round(b*U3),T=Math.round(x*U3),M=l.get(w);M===void 0&&(M=new Map,l.set(w,M));let E=M.get(S);E===void 0&&(E=new Map,M.set(S,E));let A=E.get(T);A===void 0&&(A=d++,E.set(T,A),u.push(_,b,x)),h[y]=A}let c=[],p=[],f=s===void 0?null:[],m=a!==null?a.count:o,g=(y,_)=>{let b=a!==null?a.getX(y):y,x=a!==null?a.getX(y+1):y+1,w=a!==null?a.getX(y+2):y+2;if(!(b<o&&x<o&&w<o))return;let S=h[b],T=h[x],M=h[w];S===T||T===M||M===S||(c.push(S,T,M),p.push(_),f!==null&&f.push(s.getX(b),s.getY(b),s.getX(x),s.getY(x),s.getX(w),s.getY(w)))},v=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,m);for(let S=x;S<w&&S+2<m;S+=3)g(S,b)}else for(let y=0;y+2<m;y+=3)g(y,0);return{positions:Float64Array.from(u),faces:Uint32Array.from(c),materialIndices:p,uvs:f===null?null:Float64Array.from(f)}}(e),i=this.subdivisions;for(;i-- >0;)t=TBe(t);return function(r,n){let{positions:s,faces:a,materialIndices:o,uvs:l}=r,h=s.length/3,u=a.length/3,d=new Float64Array(3*h);for(let v=0;v<u;v++){let y=3*a[3*v],_=3*a[3*v+1],b=3*a[3*v+2],x=s[b]-s[_],w=s[b+1]-s[_+1],S=s[b+2]-s[_+2],T=s[y]-s[_],M=s[y+1]-s[_+1],E=s[y+2]-s[_+2],A=w*E-S*M,P=S*T-x*E,N=x*M-w*T;d[y]+=A,d[y+1]+=P,d[y+2]+=N,d[_]+=A,d[_+1]+=P,d[_+2]+=N,d[b]+=A,d[b+1]+=P,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),f=new Float32Array(3*c),m=l!==null&&l.length>0?new Float32Array(2*c):null;for(let v=0;v<c;v++){let y=3*a[v];p[3*v]=s[y],p[3*v+1]=s[y+1],p[3*v+2]=s[y+2],f[3*v]=d[y],f[3*v+1]=d[y+1],f[3*v+2]=d[y+2]}m!==null&&m.set(l.subarray(0,2*c));let g=new At;g.setAttribute("position",new Dt(p,3)),c>0&&(g.setAttribute("normal",new Dt(f,3)),g.setAttribute("color",new Dt(new Float32Array(3*c).fill(1),3))),m!==null&&g.setAttribute("uv",new Dt(m,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)}}}),dre=U(()=>{ae(),MBe(),ta=new R,Ewe=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 Ih(100,100,100));t===void 0?(r.computeBoundingBox(),r.boundingBox.getSize(ta),i={width:ta.x,height:ta.y,depth:ta.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,s=e.geometry??new At().copy(new Ih(100,100,100)),a=s.userData.parameters;a===void 0?(s.boundingBox=function(l){let h=new pn,u=l.attributes.position;return u?(h.setFromBufferAttribute(u),h):(h.makeEmpty(),h)}(s),s.boundingBox.getSize(ta)):ta.set(a.width,a.height,a.depth),(t!==ta.x||i!==ta.y||r!==ta.z)&&s.scale(ta.x===0?1:t/ta.x,ta.y===0?1:i/ta.y,ta.z===0?1:r/ta.z);let o=s.originalGeometry;try{n>0?(o===void 0||a?.subdivisions!==n)&&(o===void 0&&(o=s),s=new Mwe(n).modify(o)):(o!==void 0&&(s=o),o=void 0,s.getAttribute("normal")===void 0&&s.computeVertexNormals())}catch{o!==void 0&&(s=o),o=void 0,s.getAttribute("normal")===void 0&&s.computeVertexNormals()}return o!==void 0&&Object.assign(s,{originalGeometry:o}),delete e.geometry,Object.assign(s,{userData:{...e,type:"NonParametricGeometry"}})}static loadFromUrl(e,t,i){new JX(i).load(e,r=>{let n=this.normalizeInputs({geometry:r});r.boundingBox.getSize(ta);let s=100/ta.x;Object.assign(n.parameters,{width:100,height:ta.y*s,depth:ta.z*s}),t(this.build(n))})}}}),BH=U(()=>{s0(),Qg(),QY=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 ps?e.shape:new ps,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:s,extrudeBevelSize:a,extrudeBevelSegments:o,extrusionVersion:l}=e.parameters,h=e.shape,u=.5*t,d=.5*i,c=2*Math.PI/r;for(let f=0;f<r;f++){let m=c*f,g=0+Math.sin(m)*u,v=0+Math.cos(m)*d;h.addPoint(h.createPoint(g,v))}h.isClosed=!0;for(let f=0,m=h.points.length;f<m;f++)h.points[f].roundness=n;h.roundness=n,h.update();let p=a0.create({shape:h,parameters:{roundness:n,depth:s,extrudeBevelSize:a,extrudeBevelSegments:o,extrusionVersion:l}});return Object.assign(p,{userData:{...e,type:"PolygonGeometry"}})}}});function HS(e,t,i){i.x=e.x*t.x,i.y=e.y,i.z=e.x*t.y}function U5(e,t,i,r,n,s){let a=Cwe.copy(t).sub(e),o=Pwe.copy(i).sub(e),l=a.angleTo(o);if(a.normalize(),o.normalize(),r===n){let h=a.add(o).normalize();s.copy(e).addScaledVector(h,r/Math.sin(l/2))}else{let h=a.angleTo(o);s.copy(e),s.addScaledVector(a,n/Math.sin(h)),s.addScaledVector(o,r/Math.sin(h))}}function EBe(e,t,i){let r=e.clone().sub(t),n=i.clone().sub(t);return r.projectOnVector(n),r.add(t)}var Awe,Cwe,Pwe,cre,PB,Rwe,Dwe,Nwe,pre,JY,Iwe,Owe,Lwe,Bwe,fre=U(()=>{ae(),Awe=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:s,openEnded:a,cornerRadius:o,cornerSegments:l}=e.parameters,h=new cre(.5*t,i,n,s,a,o,l),u=r/t;return u!==1&&h.scale(1,1,u),Object.assign(h,{userData:{...e,type:"PyramidGeometry"}})}},Cwe=new R,Pwe=new R,cre=class extends At{constructor(e=.5,t=1,i=4,r=1,n=!1,s=0,a=4){super(),i=Math.floor(Math.max(3,i)),r=Math.floor(r),a=Math.floor(a);let o,l=[],h=[],u=[],d=[],c=0,p=t/2,f=Math.PI/i,m=e*Math.cos(Math.PI/i),g=2*Math.PI/i,v=(i-2)*Math.PI/i,y=Math.PI-v,_=new R(0,-p,0),b=new R(0,p,0),x=new Z(e,-p),w=new Z(m,-p),S=new Z(0,b.y).sub(w),T=new Z(0,b.y).sub(x),M=new Z(S.y,-S.x).normalize(),E=new Z(T.y,-T.x).normalize(),A=e*Math.cos(Math.PI/i)*Math.tan((Math.PI-S.angle())/2)-1e-8;s=Math.min(s,A);{let V=new R(M.x,M.y,0),j=new R(Math.cos(g)*V.x,V.y,Math.sin(g)*V.x);o=V.angleTo(j)}let P=s/Math.tan((Math.PI-S.angle())/2),N=s/Math.tan((Math.PI-o)/2),D=new R;if(!n){h.push(_.x,_.y,_.z),u.push(0,-1,0),d.push(0,0);let V=c++,j=[],K=x.clone(),$=P/Math.cos(Math.PI/i);K.x-=$;for(let Q=0;Q<i;Q++){let ce=Q/i*Math.PI*2+f;HS(K,new Z(Math.sin(ce),Math.cos(ce)),D),h.push(D.x,D.y,D.z),u.push(0,-1,0),d.push(0,0),j.push(c++)}for(let Q=0;Q<j.length;Q++)l.push(j[Q],V,j[(Q+1)%j.length])}let O=[];{let V=new R,j=new R,K=new R,$=new R,Q=new R,ce=new R;for(let pe=0;pe<i;pe++){let ye=pe/i*Math.PI*2+f,we=(pe+.5)/i*Math.PI*2+f,ne=(pe+1)/i*Math.PI*2+f,Se=new Z(Math.sin(ye),Math.cos(ye)),W=new Z(Math.sin(we),Math.cos(we)),k=new Z(Math.sin(ne),Math.cos(ne));HS(x,Se,j),HS(x,k,K),HS(M,W,V),U5(b,j,K,N,N,$),h.push($.x,$.y,$.z),U5(j,b,K,N,P,Q),h.push(Q.x,Q.y,Q.z),U5(K,j,b,P,N,ce),h.push(ce.x,ce.y,ce.z),u.push(V.x,V.y,V.z),u.push(V.x,V.y,V.z),u.push(V.x,V.y,V.z),d.push(0,0),d.push(0,0),d.push(0,0);let Y=c++,ie=c++,G=c++;if(l.push(Y,ie,G),s>0){{let H=j.clone().add(K).multiplyScalar(.5),me=b.clone().sub(H).normalize(),xe=_.clone().sub(H).normalize().add(me).normalize().multiplyScalar(-1);z(H,ce.clone().sub(Q),xe,S.angle())}let oe,se;{let H=new R;HS(E,k,H);let me=ce.clone().add($).multiplyScalar(.5);me=EBe(me,K,b);let xe=ce.clone().sub($);[oe,se]=z(me,xe,H,o,$.y)}{let H=oe,me=H.clone().setY(0).normalize(),xe=new R(0,-1,0),ke=me.clone().cross(xe);B(H,me,xe,ke)}O.concat(se);{let H=S.angle(),me=Math.PI-H,xe=b.clone();xe.y-=s/Math.sin(H-Math.PI/2);let ke=new R,Te=[];for(let ze=0;ze<a;ze++){let qe=[],Ne=Math.PI/2-me*ze/a,ee=Math.cos(Ne),Ce=Math.sin(Ne),He=we;for(let pt=0;pt<=ze;pt++){let it=Math.cos(He),Yt=Math.sin(He);V.x=ee*Yt,V.y=Ce,V.z=ee*it,ke.copy(xe).addScaledVector(V,s),h.push(ke.x,ke.y,ke.z),u.push(V.x,V.y,V.z),d.push(0,0),qe.push(c++),He+=2*Math.PI/ze/i}Te.push(qe)}se.reverse(),Te.push(se);let Ze=Te.length-1;for(let ze=0;ze<Ze;ze++){let qe=Te[ze],Ne=Te[ze+1],ee=qe.length-1;l.push(Ne[1],qe[0],Ne[0]);for(let Ce=1;Ce<=ee;Ce++)l.push(qe[Ce],qe[Ce-1],Ne[Ce]),l.push(Ne[Ce+1],qe[Ce],Ne[Ce])}}}}}function z(V,j,K,$,Q){let ce=-$/2,pe=(Math.PI-$)/2,ye=j.clone().normalize().cross(K);V.addScaledVector(K,-s/Math.sin(pe));let we=new R,ne=new R,Se=c,W=[];for(let k=0;k<=a;k++){let Y=ce+k/a*$;ne.set(0,0,0),ne.addScaledVector(ye,Math.sin(Y)),ne.addScaledVector(K,Math.cos(Y));for(let ie=0;ie<=1;ie++){let G=ie/1-.5;if(we.copy(V),we.addScaledVector(j,G),we.addScaledVector(ne,s),Q!=null){let oe=Math.max(0,we.y-Q);we.addScaledVector(j,-oe/j.y)}h.push(we.x,we.y,we.z),u.push(ne.x,ne.y,ne.z),d.push(0,0),ie===0&&W.push(c),c++}}for(let k=0;k<a;k++)for(let Y=0;Y<1;Y++){let ie=Se+Y+2*k,G=ie+2,oe=G+1,se=ie+1;l.push(ie,G,se),l.push(G,oe,se)}return[V.clone().addScaledVector(j,.5),W]}function B(V,j,K,$){let Q=Math.PI/2,ce=T.angle()-Q,pe=[],ye=new R,we=new R;for(let Se=0;Se<=a;Se++){let W=[],k=Se/a;for(let Y=0;Y<=Se;Y++){let ie=((Se?Y/Se:0)-.5)*y,G=Math.cos(ie),oe=Math.sin(ie),se=(Q+Math.atan(Math.tan(ce)*G))*k,H=Math.cos(se),me=Math.sin(se);ye.set(0,0,0),ye.addScaledVector(j,me*G),ye.addScaledVector(K,H),ye.addScaledVector($,me*oe),we.copy(V).addScaledVector(ye,s),h.push(we.x,we.y,we.z),u.push(ye.x,ye.y,ye.z),d.push(0,0),W.push(c++)}pe.push(W)}let ne=pe.length-1;for(let Se=0;Se<ne;Se++){let W=pe[Se],k=pe[Se+1],Y=W.length-1;l.push(W[0],k[1],k[0]);for(let ie=1;ie<=Y;ie++)l.push(W[ie-1],W[ie],k[ie]),l.push(W[ie],k[ie+1],k[ie])}}this.setIndex(l),this.setAttribute("position",new Et(h,3)),this.setAttribute("normal",new Et(u,3)),this.setAttribute("uv",new Et(d,2))}}}),n4=U(()=>{s0(),Qg(),PB=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 ps?e.shape:new ps,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:s,depth:a,extrudeBevelSize:o,extrudeBevelSegments:l,extrusionVersion:h}=e.parameters,u={x:.5*i,y:.5*r},d={x:-u.x,y:-u.y},c={x:u.x,y:u.y};function p(x,w,S){return w>i&&S>r?Math.min(x*i/w,x*r/S):w>i?x*i/w:S>r?x*r/S:x}let f=[];f[0]=n[0]===0?0:p(n[0],n[0]+n[3],n[0]+n[1]),f[1]=n[1]===0?0:p(n[1],n[1]+n[2],n[1]+n[0]),f[2]=n[2]===0?0:p(n[2],n[2]+n[1],n[2]+n[3]),f[3]=n[3]===0?0:p(n[3],n[3]+n[0],n[3]+n[2]);let m=d.x,g=c.x,v=c.y,y=d.y;t.addPoint(t.createPoint(m,v)),t.addPoint(t.createPoint(g,v)),t.addPoint(t.createPoint(g,y)),t.addPoint(t.createPoint(m,y)),t.isClosed=!0;let _=!0;for(let x=0,w=t.points.length;x<w;x++)t.points[x].roundness=f[x],x>0&&f[x]!==f[x-1]&&(_=!1);_&&(t.roundness=f[0]),t.useCubicForRoundedCorners=s!==1,t.update();let b=a0.create({shape:t,parameters:{depth:a,extrudeBevelSize:o,extrudeBevelSegments:l,extrusionVersion:h}});return Object.assign(b,{userData:{...e,type:"RectangleGeometry"}})}}}),mre=U(()=>{ae(),Rwe=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=et.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:s=64,heightSegments:a=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 Hf(.5*i,s,a,o,l,h,u*et.DEG2RAD),t.scale(1,r/i,n/i),Object.assign(t,{userData:{...e,type:"SphereGeometry"}})}}}),gre=U(()=>{ae(),Dwe=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,s=new $c(t,i,r,n);return s.scale(1,1,1),Object.assign(s,{userData:{...e,type:"PlaneGeometry"}})}}}),vre=U(()=>{ae(),Nwe=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:s,cornerSegments:a}=e.parameters,o=new pre(t,i,r,n,s,a);return Object.assign(o,{userData:{...e,type:"BackdropGeometry"}})}},pre=class extends At{constructor(e=1,t=1,i=1,r=90,n=10,s=24){super(),this.type="BackdropGeometry";let a=[],o=[],l=[],h=.001;n==0&&(s=1),s=Math.max(1,Math.floor(s)),n=Math.min(n,100),r=Math.min(180-h,r),r*=Math.PI/180;let u=[],d=Math.PI/2,c=(we=0,ne=0,Se=0)=>new R(we,ne,Se),p=c(),f=c(),[m,g,v]=[t/2,e/2,i/2],y=-g,_=+g,[b,x,w]=[c(y,-m,+v),c(y,-m,-v),c(y,+m,-v)],S=(we,ne=!1)=>Math.sin(we-Math.PI/(+ne+1)),T=(we,ne=!1)=>Math.cos(we-Math.PI/(+ne+1));w.y=Math.sin(r)*t-m;let M=Math.cos(r)*t-v,E=b.z-h;r<=d?(w.z=Math.min(M,E),w.z==E&&(w.y-=(M-E)/Math.tan(d-r))):x.z=Math.min(x.z-M-v,b.z-h),p.subVectors(b,x),f.subVectors(w,x);let A=Math.min(p.length(),f.length())*n/100,P=A*Math.tan(r/2),N=A/Math.cos(r/2),D=p.clone().normalize().add(f.normalize()).setLength(N).add(x);p.set(0,S(r,!0),T(r,!0)),u.push([w,p.clone()]);let O=(Math.PI-r)/s;for(let we=0;we<=s;we++){let ne=d+r+we*O;p.set(0,Math.sin(ne)*P,Math.cos(ne)*P),p.add(D),f.set(0,S(ne),T(ne)),u.push([p.clone(),f.clone()])}u.push([b,c(0,1,0)]);let z=Math.sin(O/2)*P*2,B=u.length-1,V=u[0][0].distanceTo(u[1][0]),j=V+z*s+u[B-1][0].distanceTo(u[B][0]);u[0].push(1);for(let we=0;we<=s;we++)u[we+1].push(1-(V+we*z)/j);u[B].push(0);let K,$,Q,[ce,pe,ye]=u[0];for(let we=1;we<u.length;we++)[K,$,Q]=u[we],a.push(y,ce.y,ce.z,y,K.y,K.z,_,ce.y,ce.z,_,ce.y,ce.z,y,K.y,K.z,_,K.y,K.z),o.push(0,pe.y,pe.z,0,$.y,$.z,0,pe.y,pe.z,0,pe.y,pe.z,0,$.y,$.z,0,$.y,$.z),l.push(0,ye,0,Q,1,ye,1,ye,0,Q,1,Q),[ce,pe,ye]=[K,$,Q];this.setAttribute("position",new Et(a,3)),this.setAttribute("normal",new Et(o,3)),this.setAttribute("uv",new Et(l,2))}}}),FH=U(()=>{s0(),Qg(),JY=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 ps?e.shape:new ps,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:s,angle:a,depth:o,extrudeBevelSize:l,extrudeBevelSegments:h,extrusionVersion:u}=e.parameters,d=e.shape,c=.5*t,p=.5*i,f=a*Math.PI/360/n,m=Math.PI/2*3*-1,g=c*r/100,v=p*r/100;if(n===3&&r===50){f=2*Math.PI/n;for(let _=0;_<n;_++){let b=f*_,x=0+Math.sin(b)*c,w=0+Math.cos(b)*p;d.addPoint(d.createPoint(x,w))}}else for(let _=0;_<n;_++){let b=0+Math.cos(m)*c,x=0+Math.sin(m)*p;d.addPoint(d.createPoint(b,x)),m+=f,b=0+Math.cos(m)*g,x=0+Math.sin(m)*v,d.addPoint(d.createPoint(b,x)),m+=f}d.isClosed=!0;for(let _=0,b=d.points.length;_<b;_++)d.points[_].roundness=s;d.roundness=s,d.update();let y=a0.create({shape:d,parameters:{roundness:s,depth:o,extrudeBevelSize:l,extrudeBevelSegments:h,extrusionVersion:u}});return Object.assign(y,{userData:{...e,type:"StarGeometry"}})}}}),yre=U(()=>{ae(),Iwe=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 $c(t,i);return Object.assign(r,{userData:{...e,type:"TextFrameGeometry"}})}}}),_re=U(()=>{ae(),DA(),Owe=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 s=Math.round(Math.abs(i.depth??.25*i.width));return{parameters:Object.assign(i,{width:r,height:n,depth:s})}}static build(e){let{width:t,height:i,depth:r,radialSegments:n,tubularSegments:s,arc:a,cornerRadius:o,cornerSegments:l}=e.parameters,h=function(u,d,c,p,f,m,g,v,y,_,b){[d,c]=[c,d],g=d/2;let x=et.clamp(f/360,0,1);if(x===0){let w=new At;return w.setAttribute("position",new Et([],3)),w}return x===1&&(_=0),new SH(!0,u,d,c,p,x,m,g,0,y,_,b)}(t,i,r,.5*t,a,s,0,0,n,o,l);return h.scale(1,i/t,1),Object.assign(h,{userData:{...e,type:"TorusGeometry"}})}}}),bre=U(()=>{ae(),Lwe=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:s,q:a}=e.parameters,o=.5*t;o!==i&&(o-=i);let l=new dW(o,i,r,n,s,a);return Object.assign(l,{userData:{...e,type:"TorusKnotGeometry"}})}}}),xre=U(()=>{s0(),Qg(),Bwe=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 ps?e.shape:new ps,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:s,extrudeBevelSegments:a,isRect:o,extrusionVersion:l}=e.parameters,h=e.shape,u=.5*t,d=.5*i;o?(h.addPoint(h.createPoint(-u,d)),h.addPoint(h.createPoint(u,-d)),h.addPoint(h.createPoint(-u,-d))):(h.addPoint(h.createPoint(0,d)),h.addPoint(h.createPoint(u,-d)),h.addPoint(h.createPoint(-u,-d))),h.isClosed=!0;for(let p=0,f=h.points.length;p<f;p++)h.points[p].roundness=r;h.roundness=r,h.update();let c=a0.create({shape:h,parameters:{roundness:r,depth:n,extrudeBevelSize:s,extrudeBevelSegments:a,extrusionVersion:l}});return Object.assign(c,{userData:{...e,type:"TriangleGeometry"}})}}}),ABe=U(()=>{}),CBe=U(()=>{ae(),new Ha,new Ue,new xf,new R,new R,new R,new R});function wre(){let e=new At;return e.setAttribute("position",new Dt(new Float32Array([]),3)),e.setIndex(new Dt(new Uint16Array([]),1)),e}var Sre,UH,Fwe=U(()=>{la(),zt(),iC(),ae(),JA(),s0(),Qg(),Ew(),Sre=wre().attributes,UH=class extends At{constructor(e,t){super(),this.isTextGeometry=!0,this.charWidths=[],this.charCoords=[],this.wrappedText=[],this.isLowResolution=!1,this.vectorShapes=[],this._nearSide=new Uint8Array(0),this._depth=0,this._effectiveBevel=0,this._vScale=0,Object.assign(this.attributes,Sre),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:s,extrudeBevelSize:a,extrudeBevelSegments:o,text:l,textTransform:h,fontSize:u,extrusionVersion:d}=e,c=Mo.getDisplayedValue(l),p=function(w,S,T,M){let E=typeof w.width=="string"?Number(M.getVariable(w.width)):w.width,A=[""],P="";for(let N of T)P+=N,N===" "||N===`
|
|
4191
4191
|
`?(A[A.length-1]+=P,P="",N===`
|
|
4192
|
-
`&&A.push("")):S.getTextWidth(A[A.length-1]+P,w)>E&&(A[A.length-1].length&&A.push(""),S.getTextWidth(A[A.length-1]+P,w)>E&&(P.length===1?(A[A.length-1]+=P,P=""):(A[A.length-1]+=P.slice(0,-1),P=P[P.length-1],A.push(""))));return A[A.length-1]+=P,A}(e,i,h===2?c.toUpperCase():h===3?c.toLowerCase():c,t),{shapes:f,charWidths:m,charCoords:g}=i.generateShapes(p,e,t),v=.5*(typeof r=="number"?r:Number(t.getVariable(r))),y=.5*(typeof n=="number"?n:Number(t.getVariable(n))),_=f.map(w=>new ps().fromShape(w,!0));this.vectorShapes=_;let b=_.map(w=>a0.create({shape:w,parameters:{depth:s,extrudeBevelSegments:o,extrudeBevelSize:a,uvPitch:d===1?void 0:u,extrusionVersion:d,windingRule:s<=0?ns.NONZERO:ns.ODD,subdivisions:this.isLowResolution&&s>0?1:12}})),x=b.length?sy(b):wre();x.translate(-v,y,0),this.dispose(),this.wrappedText=p,this.charCoords=g,this.charWidths=m,this.deleteAttribute("extrudeNormal"),Object.entries(x.attributes).forEach(([w,S])=>{this.setAttribute(w,S)}),this.setIndex(x.index),this.adoptNearSide(b,s),this.computeBoundingSphere()}adoptNearSide(e,t){this._depth=t;let i=0,r=0,n=0;for(let o of e){let l=o,h=l._nearSide;if(h===void 0||h.length===0)return this._nearSide=new Uint8Array(0),this._effectiveBevel=0,void(this._vScale=0);i+=h.length,r=Math.max(r,l._effectiveBevel??0),n=l._vScale??n}this._effectiveBevel=r,this._vScale=n;let s=new Uint8Array(i),a=0;for(let o of e){let l=o._nearSide;s.set(l,a),a+=l.length}this._nearSide=s}takeDepthStateFrom(e){let t=e;t._nearSide!==void 0&&(this._depth=t._depth??this._depth,this._nearSide=t._nearSide,this._vScale=t._vScale??this._vScale,this._effectiveBevel=t._effectiveBevel??this._effectiveBevel)}canShiftDepthTo(e){return this._nearSide.length===this.getAttribute("position")?.count&&ax(this._effectiveBevel,e)&&ax(this._effectiveBevel,this._depth)}shiftDepthTo(e){if(!this.canShiftDepthTo(e))return!1;let t=e-this._depth;if(this._depth=e,t===0)return!0;let i=this.getAttribute("position"),r=i.array,n=this.getAttribute("uv"),s=n?.array,a=this._vScale>0?t/this._vScale:0,o=this._nearSide;for(let l=0;l<o.length;l++){let h=o[l];h!==0&&(r[3*l+2]+=t,h===2&&s!==void 0&&(s[2*l+1]+=a))}return i.needsUpdate=!0,n!==void 0&&a!==0&&(n.needsUpdate=!0),this.refreshDepthBounds(e),!0}refreshDepthBounds(e){if(this.boundingBox===null&&this.boundingSphere===null)return;this.boundingBox===null&&this.computeBoundingBox();let t=this.boundingBox;t.min.z=Math.min(0,e),t.max.z=Math.max(0,e),this.boundingSphere!==null&&t.getBoundingSphere(this.boundingSphere)}clone(){let e=jo(new At,UH.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 PBe(e){if(!zH)return Tre||(Tre=async function(){let t=e??"https://cdn.spline.design/@splinetool/runtime@2.0.122/build",i=import("./process.js"),[r,n]=await Promise.all([i,fetch(`${t}/process.wasm`).then(o=>o.arrayBuffer())]),s=r.default,a=await s({wasmBinary:n});Uwe(a),zH=!0}())}var Uwe,eK,zH,Tre,RB=U(()=>{eK=new Promise(e=>{Uwe=e}),zH=!1});function z5(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 l of r){let h=e.attributes[l],u=t.attributes[l];if(h===void 0||h.isInterleavedBufferAttribute===!0||u.isInterleavedBufferAttribute===!0||h.itemSize!==u.itemSize||h.normalized!==u.normalized||h.array.constructor!==u.array.constructor||h.array.length!==u.array.length)return!1}let n=e.index,s=t.index;if(n===null!=(s===null))return!1;let a=!1;if(n!==null&&s!==null){if(n.array.length!==s.array.length)return!1;let l=n.array.constructor,h=s.array.constructor;if(l!==h){if(l!==Uint32Array||h!==Uint16Array)return!1;a=!0}}if(e.groups.length!==t.groups.length)return!1;for(let l=0;l<t.groups.length;l++){let h=e.groups[l],u=t.groups[l];if(h.start!==u.start||h.count!==u.count||h.materialIndex!==u.materialIndex)return!1}for(let l of r){let h=e.attributes[l],u=t.attributes[l];h.array.set(u.array),h.needsUpdate=!0}let o=e.takeDepthStateFrom;if(typeof o=="function"&&o.call(e,t),n!==null&&s!==null){if(a){let l=n.array,h=s.array;for(let u=0,d=h.length;u<d;u++){let c=h[u];l[u]=c===65535?4294967295:c}}else n.array.set(s.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 kH(e,t,i,r){let n,s,a,o=e.position.array,l=e.normal.array,h=zwe.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],s=l[u+1],a=l[u+2],l[u]=h[0]*n+h[4]*s+h[8]*a,l[u+1]=h[1]*n+h[5]*s+h[9]*a,l[u+2]=h[2]*n+h[6]*s+h[10]*a;e.position.needsUpdate=!0,e.normal.needsUpdate=!0}var zwe,kwe=U(()=>{ae(),zwe=new Ue});function VH(e){let t=Number(e);return Number.isInteger(t)&&t>=0&&String(t)===e?t:-1}function z3(e){if(e!=null){if(Array.isArray(e)||ArrayBuffer.isView(e)&&!(e instanceof DataView))return e;if(typeof e=="object")return function(t){let i=Object.keys(t),r=0;for(let s of i){let a=VH(s);a>=r&&(r=a+1)}if(r===0||r>i.length)return;let n=new Array(r);for(let s=0;s<r;s++){let a=t[s];if(typeof a!="number")return;n[s]=a}return n}(e)}}function k5(e){if(e==null)return"missing";if(Array.isArray(e))return`Array(${e.length})`;if(ArrayBuffer.isView(e)){let l=e;return`${e.constructor.name}(${l.length})`}if(typeof e!="object")return typeof e;let t=Object.keys(e),i=t.filter(l=>VH(l)===-1),r=0;for(let l of t){let h=VH(l);h>=r&&(r=h+1)}let n=e,s=-1,a=-1;for(let l=0;l<r;l++)l in n?typeof n[l]!="number"&&a===-1&&(a=l):s===-1&&(s=l);let o=[`${t.length} keys`,"max index "+(r-1)];return s!==-1&&o.push(`first missing index ${s}`),a!==-1&&o.push(`non-number at ${a} (${typeof n[a]})`),i.length&&o.push(`stray keys ${i.slice(0,3).join(",")}`),`Object{${o.join(", ")}}`}function Vwe(e){let t=Object.keys(e);return t.length===1&&t[0]==="subdivisions"}function tK(e,t){let i=t?t.count:e.count,r=0,n=1e4,s=new Map,a=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),f=e.getZ(d),m=Math.round(c*n),g=Math.round(p*n),v=Math.round(f*n),y=s.get(m);y===void 0&&(y=new Map,s.set(m,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,f)),a[u]=b}let l=[],h=[];for(let u=0;u<a.length;u+=3)a[u]===a[u+1]||a[u]===a[u+2]||a[u+1]===a[u+2]||(l.push(a[u],a[u+1],a[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 qS,U0,ri,V5,G5,j5,ds,$S,k3,V3,G3,GH,YI,Aw=U(()=>{ae(),RB(),zt(),DB(),kwe(),DA(),qS=new pn,U0=new R,eK.then(e=>{ri=e}),V5=new Float32Array([10,10,0,-10,10,0,-10,-10,0,10,-10,0]),G5=new Uint32Array([0,1,2,3]),j5=new Uint8Array([4]),ds=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(a=>typeof a=="number"?a:1),r=jg.div(t.map(a=>typeof a=="number"?a:0),i);if(r.every(a=>a===1))return;this.subdividedGeometry&&kH(this.subdividedGeometry.attributes,...r),this.originalGeometry&&kH(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(U0.fromArray(r));let s=U0.set(n.width,n.height,n.depth).length();this.originalGeometry.boundingSphere.radius=s/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=ds.allocate(e),i=ds.buildRefined(n,e.subdivisions,t)}catch(s){console.error(s,e)}finally{n&&ds.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}=ds.build(this.data,void 0,!this.flatShading,void 0))}catch{e=new Ih(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&&(ds.freeSubdivPointer(this.subdivPointer),this.subdivPointer=0)}dispose(){super.dispose(),this.freeSubdivPointer()}calcBoundingBox(){let e=this.originalGeometry;e.boundingSphere===null&&(e.boundingSphere=new Ha,this.subdividedGeometry&&(this.subdividedGeometry.boundingSphere=e.boundingSphere));let t=e.attributes.position,i=e.boundingSphere.center;qS.setFromBufferAttribute(t),qS.getCenter(i),e.boundingSphere.radius=i.distanceTo(qS.max),isNaN(e.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this),qS.getSize(U0);let r={width:U0.x,height:U0.y,depth:U0.z};return this.userData.parameters=r,r}static build(e,t,i,r){let n,s,a=e?.phongAngle??35;i===!1&&(a=-1),t&&(ri.free_bvh(t),ri.free_subdivision_surface(t));try{n=ds.allocate(e,r)}catch(l){console.error(l,e),n=ds.allocate({positionWASM:V5,indexWASM:G5,verticesPerFaceWASM:j5},r)}ri.set_destination_refinement_level(n,0);let o=ds.buildLevel(n,!0,a);return s=e.subdivisions>0?ds.buildRefined(n,e.subdivisions,a):null,{subdivPointer:n,originalGeometry:o,subdividedGeometry:s}}static buildRefined(e,t,i){try{return ri.set_destination_refinement_level(e,t),ds.buildLevel(e,!1,i)??null}catch{try{return ri.set_destination_refinement_level(e,t-1),ds.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:Fg(e,i,!1,t);r=Cxe(e)?n.getClosedTorusIndicesForBooleanOrSubdiv():n.getIndex();let s,{positions:a,triIndices:o,triOriginals:l}=tK(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;s=[c,c+3*e.radialSegments]}let{indices:h,verticesPerFace:u,uvs:d}=function(c,p,f,m,g){let v=[],y=[],_=g?f.getAttribute("uv"):void 0,b=_&&_.itemSize===2?[]:void 0,x=T=>{if(b){let M=g[T];b.push(_.getX(M),_.getY(M))}};if(f.userData.shape!==void 0&&f.userData.parameters.depth===0&&f.userData.shape.shapeHoles.length===0){let T=f.userData.shape.extractShapePointsToFlatArray([]),M=f.userData.parameters.spikes;if(f.userData.type==="EllipseGeometry"&&M<=24&&M%4==0&&f.userData.parameters.angle>=360){let P=T.length/2/M;T=T.filter((N,D)=>Math.floor(D/2)%P===0)}let E=0;for(let P=0;P<T.length;P+=2)E+=(T[P]-T[(P===0?T.length:P)-2])*(T[P+1]+T[(P===0?T.length:P)-1]);c.length=0;let A=0;if(E<0)for(let P=0;P<T.length;P+=2)c.push(T[P],T[P+1],0),v.push(A++);else for(let P=T.length-2;P>=0;P-=2)c.push(T[P],T[P+1],0),v.push(A++);return y.push(A),{indices:v,verticesPerFace:y}}let w=new Float32Array([f.userData.parameters.depth])[0],S=0;for(;S<p.length;){if(f.useNgonForTopBottomFaceDuringBake){let T=0;if((c[3*p[S]+2]===w||c[3*p[S]+2]===0)&&T++,(c[3*p[S+1]+2]===w||c[3*p[S+1]+2]===0)&&T++,(c[3*p[S+2]+2]===w||c[3*p[S+2]+2]===0)&&T++,T===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]){$S.set(c[3*p[S]],c[3*p[S]+1],c[3*p[S]+2]),k3.set(c[3*p[S+1]],c[3*p[S+1]+1],c[3*p[S+1]+2]),V3.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]),k3.sub($S).normalize(),V3.sub($S).normalize(),G3.sub($S).normalize();let T=k3.cross(V3).dot(G3),M=S;Math.abs(T)>.005||m&&m.some((E,A)=>A%2!=1&&M>=m[A]&&M<m[A+1])?(v.push(p[S],p[S+1],p[S+2]),x(S),x(S+1),x(S+2),y.push(3),S+=3):(v.push(p[S],p[S+1],p[S+4],p[S+5]),x(S),x(S+1),x(S+4),x(S+5),y.push(4),S+=6)}else v.push(p[S],p[S+1],p[S+2]),x(S),x(S+1),x(S+2),y.push(3),S+=3}if(f.useNgonForTopBottomFaceDuringBake){let T=[],M=[],E=0;for(let A=0,P=0;A<c.length;A+=3,P++)c[A+2]===0&&(T.push(P),E++),c[A+2]===w&&M.push(P);if(f.userData.parameters.extrudeBevelSize===0){let A=M[0];M[0]=M[1],M[1]=A}T.reverse(),v.push(...T,...M),y.push(E,E),b=void 0}return{indices:v,verticesPerFace:y,uvs:b}}(a,o,n,s,l);return{positions:a,indices:h,verticesPerFace:u,uvs:d}}static allocate(e,t){let i,r,n,s=[],a=[],o=z3(e.positionWASM),l=z3(e.indexWASM),h=z3(e.verticesPerFaceWASM);if(o&&o.length>0){if(!l?.length||!h?.length)throw new Error(`SubdivGeometry.allocate: unusable cage topology \u2014 positionWASM ${k5(e.positionWASM)}, indexWASM ${k5(e.indexWASM)}, verticesPerFaceWASM ${k5(e.verticesPerFaceWASM)}`);i=o,r=l,n=h;let S=z3(e.uvWASM);ri.alloc_subdivision_surface_uvs&&S&&S.length===2*r.length&&(a=S)}else i=V5,r=G5,n=j5;let u=i.length,d=r.length,c=n.length,p=i.length+s.length+a.length,f=r.length+n.length,m=p*Float32Array.BYTES_PER_ELEMENT+f*Uint32Array.BYTES_PER_ELEMENT,g=p*Float32Array.BYTES_PER_ELEMENT,v=ri._malloc(m);if(!v)throw new Error(`SubdivGeometry.allocate: wasm _malloc(${m}) failed`);let y,_=new Float32Array(ri.HEAPF32.buffer,v,p),b=new Uint32Array(ri.HEAPU32.buffer,v+g,f);_.set(i,0),_.set(s,i.length),_.set(a,i.length+s.length),b.set(r,0),b.set(n,r.length),e?.scaleBaked?.some(S=>S!==1)&&(y=new Ue().makeScale(...e.scaleBaked.map(S=>typeof S=="number"?S:1))),t&&(y?y.premultiply(t):y=t);let x=v+(i.length+s.length)*Float32Array.BYTES_PER_ELEMENT,w=a.length?y?ri.alloc_subdivision_surface_uvs2(v,u,v+g,d,v+g+r.length*Uint32Array.BYTES_PER_ELEMENT,c,x,a.length,y.elements):ri.alloc_subdivision_surface_uvs(v,u,v+g,d,v+g+r.length*Uint32Array.BYTES_PER_ELEMENT,c,x,a.length):y?ri.alloc_subdivision_surface2(v,u,v+g,d,v+g+r.length*Uint32Array.BYTES_PER_ELEMENT,c,y.elements):ri.alloc_subdivision_surface(v,u,v+g,d,v+g+r.length*Uint32Array.BYTES_PER_ELEMENT,c);return ri._free(v),w}static buildLevel(e,t,i,r,n,s=!1){let a=n?ri.get_mesh_data2(e,t?ri.Level.CONTROL:ri.Level.REFINED,i,n.elements):ri.get_mesh_data(e,t?ri.Level.CONTROL:ri.Level.REFINED,i),o=ri.HEAPU32.subarray(a>>2,10+(a>>2)),l=o.subarray(4,8),h=0,u=ri.HEAPU32[o[h]>>2],d=ri.HEAPF32.subarray(u>>2,(u>>2)+l[h]);h++;let c=ri.HEAPU32[o[h]>>2],p=ri.HEAPF32.subarray(c>>2,(c>>2)+l[h]);h++;let f=ri.HEAPU32[o[h]>>2],m=ri.HEAPU32.subarray(f>>2,(f>>2)+l[h]);h++;let g,v=ri.HEAPU32[o[h]>>2],y=ri.HEAPU32.subarray(v>>2,(v>>2)+l[h]);if(h++,ri.alloc_subdivision_surface_uvs){let b=o[9];if(b>0){let x=ri.HEAPU32[o[8]>>2];g=ri.HEAPF32.subarray(x>>2,(x>>2)+b)}}if(r===void 0){let b=new At;if(b.setIndex(new Wf(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 Wf(m,1));let x=new Float32Array(p.length/3*4).fill(0);b.setAttribute("color",new Dt(x,4))}return ri.free_mesh_data(a),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,s){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),ri.free_mesh_data(a)}static freeSubdivPointer(e){ri.free_bvh(e),ri.free_subdivision_surface(e)}static buildControlCageWireframe(e,t,i){let r=ri.get_wireframe_data_for_base_level(e),n=ri.HEAPU32.subarray(r>>2,4+(r>>2)),s=n.subarray(2,4),a=0,o=ri.HEAPU32[n[a]>>2],l=ri.HEAPF32.subarray(o>>2,(o>>2)+s[a]);a++;let h=ri.HEAPU32[n[a]>>2],u=ri.HEAPU32.subarray(h>>2,(h>>2)+s[a]);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,f=l.length;p<f;)c[p++]=i.r,c[p++]=i.g,c[p++]=i.b;return d.setAttribute("color",new Dt(c,3)),d.setIndex(new Wf(u,1)),ri.free_wireframe_data_for_base_level(r),d}t.getAttribute("position").copyArray(l),t.attributes.position.needsUpdate=!0,ri.free_wireframe_data_for_base_level(r)}static updateCollabMesh(e,t,i){let r=t===0;r||ri.set_destination_refinement_level(e,t);let n=i?ri.get_topological_data2(e,r?ri.Level.CONTROL:ri.Level.REFINED,i.elements):ri.get_topological_data(e,r?ri.Level.CONTROL:ri.Level.REFINED),s=ri.HEAPU32.subarray(n>>2,8+(n>>2)),a=s.subarray(3,6),o=0,l=ri.HEAPU32[s[o]>>2],h=new Float32Array(ri.HEAPF32.subarray(l>>2,(l>>2)+a[o]));o++;let u=ri.HEAPU32[s[o]>>2],d=new Uint32Array(ri.HEAPU32.subarray(u>>2,(u>>2)+a[o]));o++;let c,p=ri.HEAPU32[s[o]>>2],f=new Uint8Array(ri.HEAPU32.subarray(p>>2,(p>>2)+a[o]));if(ri.alloc_subdivision_surface_uvs){let m=s[7];if(m>0){let g=ri.HEAPU32[s[6]>>2];c=new Float32Array(ri.HEAPF32.subarray(g>>2,(g>>2)+m))}}return ri.free_topological_data(n),{positions:h,indices:d,verticesPerFace:f,uvs:c}}},$S=new R,k3=new R,V3=new R,G3=new R}),Gwe=U(()=>{Gie(),jie(),JL(),Wie(),r4(),DA(),hre(),ure(),dre(),BH(),fre(),n4(),mre(),gre(),vre(),FH(),yre(),_re(),bre(),xre(),Qg(),_r(),Gie(),jie(),JL(),Wie(),r4(),ABe(),DA(),hre(),ure(),dre(),BH(),fre(),n4(),mre(),gre(),vre(),FH(),yre(),_re(),bre(),xre(),Qg(),CBe(),fwe(),Fwe(),Aw(),RB(),EB(),Ew(),GH={ConeGeometry:Yxe,CubeGeometry:Kxe,CylinderGeometry:qY,DodecahedronGeometry:Zxe,EllipseGeometry:CB,HelixGeometry:Pxe,IcosahedronGeometry:Swe,LatheGeometry:Twe,NonParametricGeometry:Ewe,PolygonGeometry:QY,PyramidGeometry:Awe,RectangleGeometry:PB,SphereGeometry:Rwe,PlaneGeometry:Dwe,BackdropGeometry:Nwe,StarGeometry:JY,TextFrameGeometry:Iwe,TorusGeometry:Owe,TorusKnotGeometry:Lwe,TriangleGeometry:Bwe,VectorGeometry:a0},YI=e=>{let t=GH[e.type]??yxe(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 Fg(e,t,i,r){let n,s,a;e.type==="PathGeometry"?(s={...e,extrusion:{...e.extrusion}},a=[[],["extrusion"]]):(s={...e},a=[[]]);for(let h of a){let u=s;for(let d of h)u=u[d];for(n in u){let d=u[n];XW(d)&&!jwe.includes(n)&&(u[n]=t.getVariable(d,[r.uuid,"geometry",...h,n]),XW(u[n])&&(u[n]=1))}}let o,l={parameters:s,type:s.type};if(s.type==="PathGeometry"){l.path=s.path;let h=r.profileShape;h!==void 0&&(l.shapeData=h),l.ownerId=r.uuid}else if(s.type==="VectorGeometry"){let h=ps.createFromState(s.shape,s.width,s.height);l.shape=h,l.ownerId=r.uuid}else if(s.type==="NonParametricGeometry"){if(s.data.groups&&s.data.groups?.forEach(h=>h.materialIndex=Math.max(h.materialIndex??0,0)),l.geometry=new JX().parse(s),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(s.type==="SubdivGeometry"){let h=new ds(s,i);return h.data=e,h}if(s.type==="TextGeometry"||s.type==="InputGeometry"){let h=yxe(s.type);if(h)return h.create(s,t);Ta("text",`a ${s.type}`);let u=ps.createFromState(sw.defaultData(),100,100);return YI({...s,shape:u,type:"VectorGeometry"})}if(s.type==="UIGeometry")return PB.create({parameters:{width:s.width,height:s.height,cornerRadius:s.cornerRadius,cornerType:s.cornerType}})}try{o=YI(l)}catch(h){console.error(h),console.error(`Error generating geometry with inputs: ${l}`);let u=ps.createFromState(sw.defaultData(),100,100);l.shape=u,l.type="VectorGeometry",o=YI(l)}return o}var jwe,DB=U(()=>{zt(),ae(),Gwe(),_r(),n4(),s0(),Aw(),jwe=["font"]});function jH(e){switch(typeof e){case"number":return Number.isFinite(e)?JSON.stringify(e):void 0;case"boolean":return JSON.stringify(e);case"string":return XW(e)?void 0:JSON.stringify(e);case"object":{if(e===null)return"null";if(Array.isArray(e)){let n="[";for(let s=0;s<e.length;s++){let a=jH(e[s]);if(a===void 0)return;n+=(s>0?",":"")+a}return n+"]"}let t=e,i="{",r=!0;for(let n of Object.keys(t).sort()){if(t[n]===void 0)continue;let s=jH(t[n]);if(s===void 0)return;i+=`${r?"":","}${JSON.stringify(n)}:${s}`,r=!1}return i+"}"}default:return}}var Wwe,Mre,WH,RBe=U(()=>{zt(),Wwe=new Set(["CubeGeometry","SphereGeometry","CylinderGeometry","ConeGeometry","TorusGeometry","TorusKnotGeometry","IcosahedronGeometry","DodecahedronGeometry","PyramidGeometry","PlaneGeometry","BackdropGeometry","HelixGeometry"])}),DBe=U(()=>{DB(),RBe(),Mre=class{constructor(){this.objects=new Map,this.refs=new Map,this.sharedByKey=new WeakSet,this.unreachable=new Set}resolveObject(e,t,i){return this.createObject(e,t,i)}onObjectDisposed(e){}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.resolveObject(e,t,i),this.objects.set(e,r),this.retain(r)):(this.sharedByKey.add(r),r.isShared=!0),r}forceDelete(e){let t=this.objects.get(e);t&&(this.objects.delete(e),this.release(t))}adopt(e,t){this.replace(e,t),this.retain(t)}mutateIfUnique(e,t){let i=this.objects.get(e);if(i&&i.isShared!==!0)return this.objects.delete(e),this.replace(t,i),i}replace(e,t){let i=this.objects.get(e);this.objects.set(e,t),i!==void 0&&i!==t&&this.release(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=>{let t=this.objects.get(e);this.objects.delete(e),this.release(t)}),this.unreachable.clear()}dispose(){new Set(this.objects.values()).forEach(e=>{this.disposeObject(e),this.onObjectDisposed(e)}),this.objects.clear(),this.refs.clear()}retain(e){let t=(this.refs.get(e)??0)+1;this.refs.set(e,t),t>1&&(e.isShared=!0)}release(e){let t=(this.refs.get(e)??1)-1;if(t>0)return this.refs.set(e,t),void(t===1&&!this.sharedByKey.has(e)&&(e.isShared=!1));this.refs.delete(e),this.disposeObject(e),this.onObjectDisposed(e)}},WH=class extends Mre{constructor(e){super(),this.flatShading=e,this.dedupeByValue=!1,this.byValue=new Map,this.valueKeyOf=new Map}disposeObject(e){e.dispose()}createObject(e,t,i){let r=Fg(e,t,this.flatShading,i);return r.computeBoundingSphere(),r}resolveObject(e,t,i){let r=this.dedupeByValue?function(s,a,o){if(!Wwe.has(s.type))return;let l=s;if(l.shapeBlendNode!=null||o.isTransientGeometryKey(s))return;let h=a.material;if(h===void 0||Array.isArray(h))return;let u=h;if(typeof u.getLayersOfType!="function"||u.getLayersOfType("outline").length>0||u.getLayersOfType("cavity").length>0)return;let d=s.type;for(let c of Object.keys(l).sort()){let p=l[c];if(p===void 0||c==="type")continue;let f=jH(p);if(f===void 0)return;d+=`|${c}=${f}`}return d}(e,i,t):void 0;if(r!==void 0){let s=this.byValue.get(r);if(s!==void 0)return s}let n=this.createObject(e,t,i);return r!==void 0&&(this.byValue.set(r,n),this.valueKeyOf.set(n,r)),n}mutateIfUnique(e,t){let i=super.mutateIfUnique(e,t);return i!==void 0&&this.forgetValue(i),i}onObjectDisposed(e){this.forgetValue(e)}forgetValue(e){let t=this.valueKeyOf.get(e);t!==void 0&&(this.valueKeyOf.delete(e),this.byValue.get(t)===e&&this.byValue.delete(t))}}});function s4(){return nC}function Hwe(){if(nC==="webgpu"){if(qH!==void 0)return qH;XH||(XH=!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($H===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 $H}function qwe(e,t){return Hwe().createRootMaterial(e,t)}function Ere(e,t,i){return Hwe().createSharedMaterial(e,t,i)}function Are(e){return e.getLayersOfType===void 0&&Object.assign(e,{layers:[],getLayersOfType:()=>[],hasAO:!1,assetsLoaded:()=>!0}),e}function HH(){return Xwe}var nC,qH,$H,XH,YH,$we,Xwe,KH,Ywe,em=U(()=>{nC="webgl",XH=!1}),NBe=U(()=>{Ywe={markNeedsUpdateRendererDirty:()=>{}}});function Cre(e){return e.data.type!=="displace"&&!!e.data.isMask}function _u(e,t){let i=0;if(!e.layers||e.layers.length===0)return!1;let r=e.layers?.find(s=>s.data.type==="light");if(r){let s=r.data,a=Number(t.getVariable(s.alphaOverride));if((typeof s.alphaOverride=="string"?a/100:s.alphaOverride)<1)return!0}let n=e.layers;for(let s=0;s<n.length;s++){let a=n[s];if(!Cre(a)){if(s>0&&Cre(n[s-1])){if(a.data.type==="light"&&!a.data.visible)return!0;continue}if(a.data.type!=="displace"&&"alpha"in a.data&&a.data.type!=="light"&&a.data.type!=="fresnel"&&a.data.type!=="cavity"&&a.data.type!=="dust"&&a.data.type!=="texture"&&a.data.type!=="matcap"&&a.data.type!=="rainbow"&&a.data.type!=="outline"&&a.data.type!=="pattern"){let o=a.data.visible?a.data.alpha:0;if(typeof o=="string"&&(o=Math.max(0,Math.min(1,Number(t.getVariable(o)??100)/100))),o===1&&a.data.type==="depth"||a.data.type==="gradient"){for(let l of a.data.colors)if(l[3]<1){o=l[3];break}}else if(o===1&&a.data.type==="noise"){let l=t.color(a.data.colorA).a,h=t.color(a.data.colorB).a,u=t.color(a.data.colorC).a,d=t.color(a.data.colorD).a,c=Math.min(l,Math.min(h,Math.min(u,d)));c<1&&(o=c)}i+=(1-i)*o}}}return i<1}var sC=U(()=>{});function Kwe(e,t){return e==="displace"?t==="intensity":t==="alpha"}function Zwe(e,t,i){let r=e==="alpha"?Math.max(0,Math.min(Number(t)/100,1)):Number(t);return i?r:0}function $f(e){return typeof e=="string"||typeof e=="number"&&e!==0}var Lh,Ot,Xc,Td,Cw,iK,Pre,Rre,Zo,Ad=U(()=>{ae(),Lh=(e,t,i)=>Math.max(0,Math.min(1,Number(t.getVariable(typeof e=="number"?100*e:e,i)??100)/100))??1,Ot=(e,t,i)=>typeof e=="number"?e:t.getVariable(e,i),Xc=(e,t)=>(e||(e=new R),e.x=Ot(e.x,t)??0,e.y=Ot(e.y,t)??0,e.z=Ot(e.z,t)??0,e),Td=(e,t)=>(e||(e=new Z),e.x=Ot(e.x,t)??0,e.y=Ot(e.y,t)??0,e),Cw={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"]},iK={depth:["colors"],gradient:["colors","steps"],toon:["colors","steps"]}}),Pw=U(()=>{ae(),Mw(),Zn(),Pre=class extends SB(hn){},Rre=e=>e.type==="Mesh",Zo=class extends Pre{constructor(e){super(),this.object=e,this.isClone=!0,this.matrixAutoUpdate=!1}raycast(e,t){}expand(){let e=0,t=this.object.entityChildren(e);for(;t;){let i=this.children[e];(!(i instanceof Zo)||i.object!==t)&&(i=new Zo(t),this._replaceChildAt(e,i),i.matrixWorldNeedsUpdate=!0,i.matrixAutoUpdate=!1,i.matrix=t.matrix,i.shearMatrix=t.shearMatrix,i.pivotMatrix=t.pivotMatrix),i.expand(),e+=1,t=this.object.entityChildren(e)}for(let i of this.object.children){if(!Lg(i)||i.object.parent!==this.object)continue;let r=this.children[e];r?.source!==i&&(r=i.createCopy(),this._replaceChildAt(e,r)),r.expand(),e+=1}for(;this.children.length>e;)this.remove(this.children[e]);this.pivotMatrix=this.object.pivotMatrix}_replaceChildAt(e,t){let i=this.children[e];i&&this.remove(i),this.add(t),this.children.splice(e,0,this.children.pop())}get visible(){let e=this.parent,t=Lg(e)&&e.object===this.object;return(!t||!e.instancingActive&&!e.insideBoolean)&&(this.playModeVisible!==void 0?this.playModeVisible:this.object.visible||t&&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 Rre(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 Dre(){return rK}var rK,nK,sK=U(()=>{rK=null,nK=null});function ZH(e){return"variable_"+e}var W5,H5,q5,Nre,$5,Ire,X5,Ore,a4,aK=U(()=>{zt(),kxe(),Hxe(),AB(),Su(),jY(),HY(),DBe(),em(),Gxe(),NBe(),sC(),Ad(),wl(),Pw(),Or(),ae(),sK(),_r(),W5=new Ue,H5=new R,q5=new jt,Nre=new R,$5=new Dr,Ire=class extends Fxe{constructor(e){super(),this.shared=e}create(e){return new GY(e,this.shared)}},X5=new Set,(a4=Ore=class{constructor(e,t={},i=!0,r=!1){if(this.data=e,this.needsJitter=i,this.enableLocalStorageForPersistentVariables=r,this.geometryCache=new WH(!0),this.geometryCache2=new WH(!1),this.imageHolderCache=new Ire(this),this.thisContext={scene:Ywe,shared:this},this.deletedImage=new Nc(BL.emptyImage,this),this.deletedVideo=new Nc(FL.defaultVideo,this),this.materials={},this.images={},this.uiBuffers={},this.videos={},this.colors={},this.audios={},this.particles={},this.fonts={},this.variables={},this.userAPIs={},this.userWebhooks={},this.mouseProperty=null,this.raycastProperty=null,this.requestRender=()=>{this._requestRender&&this._requestRender()},this.transientGeometryKeys=new WeakSet,t.images)for(let[n,s]of Object.entries(t.images))this.addImage(n,s);if(t.videos)for(let[n,s]of Object.entries(t.videos))this.addVideo(n,s);if(t.audios)for(let[n,s]of Object.entries(t.audios))this.addAudio(n,s);if(t.particles)for(let[n,s]of Object.entries(t.particles))this.addParticle(n,s);this.reset(e)}get deletedMaterial(){return this._deletedMaterial??(this._deletedMaterial=Ere(Kn.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)}addMaterial(e,t){if(t=Kn.withRepairedLayers(t),this.materials[e]){let i=this.materials[e];i.reset(t,this.thisContext),i.dispose()}else{let i=Ere(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):qwe(Kn.withRepairedLayers(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]}getEntityTexture(e,t={}){let i=e.material;if(!i)return null;for(let r of Array.isArray(i)?i:[i]){let n=r.root??r;for(let s of n?.data?.layers??[]){let a=s?.data;if(a?.type!=="texture"&&a?.type!=="matcap"||t.layer!==void 0&&s.id!==t.layer&&a.type!==t.layer)continue;let o=a.texture?.image;if(o==null)continue;let l=(typeof o=="string"?this.uiBuffer(o):void 0)??this.image(o);if(!l)continue;let h=l.getTexture(a.texture.wrapping??(a.type==="texture"?1e3:1001),a.texture.minFilter??1008,a.texture.magFilter??1006),u=l.img;return{texture:h,width:u?.width??0,height:u?.height??0,layerId:s.id,layerType:a.type}}}return null}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 OA(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 kr(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 kr(0,0,0,0))}return t}addAudio(e,t){this.audios[e]=t}getAudio(e){let t=this.audios[e];if(t instanceof sx)return t;{let i=new sx({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 sx&&t.dispose(),delete this.audios[e])}addFont(e,t){let i=WY;i!==null?(this.fonts[e]=new i(t),this.fonts[e].loadingPromise.then(()=>this.requestRender())):Ta("text","a font asset")}getFont(e){return this.fonts[e]}deleteFont(e){this.fonts[e]&&delete this.fonts[e]}dispose(){Object.keys(this.materials).forEach(e=>this.deleteMaterial(e)),this._requestRender=void 0,Object.values(this.audios).forEach(e=>{e instanceof sx&&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(ZH(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(ZH(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 s=this.variables[e].locations.length-1;s>=0;s--){let a=this.variables[e].locations[s];if(a[0]==="material"){let o=a[1],l=i,h={scene:r,shared:this},u=a.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(a[0]);if(o===void 0){this.variables[e].locations.splice(s,1);continue}if(n=!0,a[1]!=="geometry"&&a[1]!=="particles"){for(let l=1;l<a.length-1;l++)o=o[a[l]];a[1]==="rotation"?o[a[a.length-1]]=i*et.DEG2RAD:o[a[a.length-1]]=i}if(o=r.find(a[0]),o.type==="ParticleEmitter"&&o.updateVariableState(i,a),nr.is(o))if(a[1]==="position"||a[1]==="rotation"||a[1]==="scale")o.onVariableUpdate();else if(a[1]==="geometry"){let l=o;o.component&&(l=o.component);let 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 a[1]==="morphTargetInfluences"&&o.updateMorphInfluences(a[2],i)}}return n&&r.markShadowsDirty(),this.requestRender(),!0}isTransientGeometryKey(e){return this.transientGeometryKeys.has(e)}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 s=h=>h.toLowerCase().replace(/[\s_.-]+/g,""),a=new Map;for(let h of Object.keys(n))a.set(s(h),h);let o={};for(let[h,u]of Object.entries(t??{})){let d=a.get(s(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 s=t?.vertices;if(s===void 0||typeof s.length!="number"||s.length<9||s.length%3!=0||s.length/3>Ore.MAX_TRANSIENT_VERTICES)return!1;let a,o,l,h=s instanceof Float32Array?s:Float32Array.from(s),u=h.length/3;if(t.normals!==void 0){if(t.normals.length!==h.length)return!1;a=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){let S=(x?.attributes?.position?.array?.length??0)/3;if(u!==S)return function(T,M){let E=`${T}/${M}`;X5.has(E)||(X5.add(E),console.warn(`[spline] updateObject: ignoring a geometry update of ${T} vertices for a mesh that holds ${M}. Without \`indices\` the write is taken as a morph of the mesh's own vertices, which only means anything at the same count \u2014 send \`indices\` alongside \`vertices\` to replace the topology too.`))}(u,S),!1;l=w}}let d=1/0,c=1/0,p=1/0,f=-1/0,m=-1/0,g=-1/0;for(let x=0;x<h.length;x+=3){let w=h[x],S=h[x+1],T=h[x+2];w<d&&(d=w),w>f&&(f=w),S<c&&(c=S),S>m&&(m=S),T<p&&(p=T),T>g&&(g=T)}let v=(x,w)=>({array:x,itemSize:w,type:"Float32Array",normalized:!1}),y={position:v(h,3)};a&&(y.normal=v(a,3)),o&&(y.uv=v(o,2));let _={...n,width:f-d,height:m-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,s=Math.PI/180,a=!1;if(t===null)for(let o of n)o.transformOverride!==void 0&&(o.transformOverride=void 0,a=!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,a=!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*s),typeof h.rotation.y=="number"&&(d.rotation[1]=h.rotation.y*s),typeof h.rotation.z=="number"&&(d.rotation[2]=h.rotation.z*s)),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 a?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 Zo(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.shearMatrix.copy(e.shearMatrix),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},s=h=>h.toLowerCase().replace(/[\s_.-]+/g,""),a=h=>{if(typeof h=="string"){let u=new kr(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 OA?h.setValue(u,new kr(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=a(t.color),p=u.find(m=>m.data.type==="color"),f=p&&d(p.id);if(c&&f&&o(f,"color",c)&&(l=!0,c.a!==void 0)){let m=c.a<1||_u(h.data,this);h.setTransparent?h.setTransparent(m,n.scene):h.transparent=m}}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,f=p&&d(p.id);if(!p||!f)continue;let m=Cw[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=>s(x)===s(v))??v;if(m.includes(_))continue;let b=a(y);if(b&&o(f,_,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]}referencesMissingObject(e){return Array.isArray(e)&&e[0]!=="mouse"&&e[0]!=="raycast"&&this.entityOpContext.scene.find(e[0])===void 0}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(i===void 0)return;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?.(W5))return W5.decompose(H5,q5,Nre),e[1]==="position"?H5[e[2]]:($5.setFromQuaternion(q5,i.rotation.order),$5[e[2]]*et.RAD2DEG);for(let r=1;r<e.length;r++)i=i[e[r]];return e[1]==="rotation"&&(i*=et.RAD2DEG),i}for(let i in this.variables){if(t===void 0)break;let r=this.variables[i],n=r.locations?.findIndex(s=>Sa.equal(s,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($a.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,s=this.getUserAPI(e.path[1]);s!==void 0&&s===this.openAIRealtime?s.update(r):s?.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($a.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=nK;return i===null?(Ta("ai-assistant","a voice-assistant integration"),!1):(this.openAIRealtime=i(t,e,this),!1)}{let i=Dre();return i===null?(Ta("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=Dre();return i===null?(Ta("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 a4(gu.emptyData())});function o4(e){return Ixe(e)||e?.isTSLNodeMaterial===!0}var xl,Y5,K5,Z5,Lre,Q5,dp,Bre,Fre,XS,zn,oK=U(()=>{zxe()}),f1=U(()=>{zt(),Na(),em(),oK(),Or(),la(),xl=class extends Es{setMaterialOverride(e,t){this.materialOverride=Are(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),Jr(e.path,["geometry"])&&this.syncShadowCatcher(i),function(r,n){let s=[];if(n.length!==r.length)return null;{let a=0;for(;a<r.length;){if(n[a]==="*")s.push(r[a]);else if(r[a]!==n[a])return null;a+=1}}return s}(e.path,["materials"])!==null&&e.type===0&&Array.isArray(this.material))for(let[r,n]of Object.entries(e.props)){let s=this.material[Number(r)],a=i.shared.material(n);a!==s&&xl.disposeOneMaterial(s),this.material[Number(r)]=a}else if(Jr(e.path,["material"])){let r=this.material;!Array.isArray(r)&&typeof r?.updateByOp=="function"&&"material"in t&&typeof t.material!="string"&&r.updateByOp($a.drop(e,1),t.material,i)}else if(Jr(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($a.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(a=>t.shared.material(a).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 s=this.data;if(!n&&s.geometry?.type!=="NonParametricGeometry"&&"materials"in s&&s.materials!==void 0&&(this.disposeMaterial(),this.material=t.shared.material(s.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 a=0;a<this.material.length;a++)this.material[a]=this.material[a].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=nC==="webgpu"&&YH!==void 0?YH:$we;return r===void 0?null:Are(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;o4(e)&&!function(i){return i?.isClassicSharedMaterial===!0}(t=e)&&t?.isTSLSharedMaterial!==!0&&e.nodeMaterialDispose()}disposeMaterial(){this.material&&G_e(this.material).forEach(e=>{xl.disposeOneMaterial(e)})}dispose(){this.disposeMaterial(),this.shadowCatcherMaterial?.dispose(),super.dispose()}}}),Sl=U(()=>{zt(),Or(),aK(),f1(),ae(),DB(),Ew(),Aw(),kwe(),Y5=new R,K5=new ct,Z5=new ct,Lre=new R,Q5=new Ue,dp=new Tr,Bre=dp.geometry,Fre=dp.material,XS=new R,zn=class extends xl{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 Ue().fromArray(t.bindMatrix),this.bindMatrixInverse=new Ue)}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 a4){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 kL.is2DParametricMesh(e.type)&&e.depth===0}get is2DType(){return kL.is2DParametricMesh(this.geometry.userData.type)}get isTextType(){return this.geometry.isTextGeometry===!0}get isNonParametric(){return this.geometry.userData.type==="NonParametricGeometry"}updateByPatchedOp(e,t,i){super.updateByPatchedOp(e,t,i),Jr(e.path,["geometry"])&&this.updateByPatchedOpGeometry($a.drop(e,1),t.geometry,i)}removeInteractionGeometry(e){this.localGeometry?.dispose(),this.localGeometry=void 0}dispose(){var e;super.dispose(),e=this.uuid,i4.delete(e),this._posed=void 0}get appliedGeometrySize(){let e=this.localGeometry?.userData;if(e!==void 0&&e.sxPrev!==void 0)return[e.sxPrev,e.syPrev,e.szPrev]}updateGeometryInteractions(e,t){this.invalidateDownstreamBooleanData();let i=this.data.geometry.type;if(i==="NonParametricGeometry"||i==="SubdivGeometry"){let r,n,s,a=e;if(this.localGeometry===void 0){let d={...this.data.geometry,...a};this.localGeometry=Fg(d,t,this.data.flatShading,this)}a.scaleBaked?[r,n,s]=a.scaleBaked:{width:r,height:n,depth:s}=a;let o=this.localGeometry.userData,l=typeof r=="number"?r:1,h=typeof n=="number"?n:1,u=typeof s=="number"?s:1;o.sxPrev!==void 0&&kH(this.localGeometry.attributes,l/o.sxPrev,h/o.syPrev,u/o.szPrev),o.sxPrev=l,o.syPrev=h,o.szPrev=u}else if(!this.absorbDepthInteraction(e)){let r=Fg(i==="VectorGeometry"?VL.merge(this.data.geometry,e):{...this.data.geometry,...e},t,this.data.flatShading,this);this.localGeometry!==void 0&&this.supportsInPlaceGeometryUpdate(this.localGeometry)&&z5(this.localGeometry,r)?r.dispose():(this.localGeometry?.dispose(),this.localGeometry=r)}}absorbDepthInteraction(e){let t=this.localGeometry;if(t?.shiftDepthTo===void 0)return!1;let i=e;if(typeof i.depth!="number")return!1;let r=t.userData?.parameters;if(r===void 0)return!1;for(let n of Object.keys(i))if(n!=="depth"&&i[n]!==r[n])return!1;return!!t.shiftDepthTo(i.depth)&&(r.depth=i.depth,!0)}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 ds&&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&&Vwe(e.props)&&this.geometryCreateDeleyed instanceof ds&&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 ds)&&this.supportsInPlaceGeometryUpdate(this.geometryCreateDeleyed)&&this._geometryCacheKey!==void 0){let n=i.shared,s=this.chooseGeoemtryCache(n),a=this.geometryCreateDeleyed;if(s.getCached(this._geometryCacheKey)===a&&a.isShared!==!0){let o=this.dataPatched.geometry,l=Fg(o,n,this.data.flatShading,this);z5(a,l)?(l.dispose(),a.computeBoundingSphere(),s.mutateIfUnique(this._geometryCacheKey,o)):(l.computeBoundingSphere(),s.forceDelete(this._geometryCacheKey),s.adopt(o,l),this.geometryCreateDeleyed=l),this._geometryCacheKey=o,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 ds)&&this.supportsInPlaceGeometryUpdate(this.geometryCreateDeleyed)&&this._geometryCacheKey!==void 0){let n=this.chooseGeoemtryCache(i),s=this.geometryCreateDeleyed;if(n.getCached(this._geometryCacheKey)===s&&s.isShared!==!0){let a=Fg(r,i,this.data.flatShading,this);return z5(s,a)?(a.dispose(),s.computeBoundingSphere(),n.mutateIfUnique(this._geometryCacheKey,r)):(a.computeBoundingSphere(),n.forceDelete(this._geometryCacheKey),n.adopt(r,a),this.geometryCreateDeleyed=a),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.posedGeometry()?.boundingBox;if(i)return i.getCenter(e),void i.getSize(t).multiplyScalar(.5);let r=this.geometry.userData.parameters;this.is2DType||this.isTextType?e.set(0,0,.5*r.depth):this.isNonParametric?(e.setScalar(0),this.geometry.boundingSphere&&e.copy(this.geometry.boundingSphere.center),t.set(r.width,r.height,r.depth??0).multiplyScalar(.5)):r.centerOffset?e.fromArray(r.centerOffset):e.setScalar(0),t.set(r.width,r.height,r.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 ct,i=this.geometry.attributes.skinWeight;for(let r=0,n=i.count;r<n;r++){t.fromBufferAttribute(i,r);let s=1/t.manhattanLength();s!==1/0?t.multiplyScalar(s):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;K5.fromBufferAttribute(r.attributes.skinIndex,e),Z5.fromBufferAttribute(r.attributes.skinWeight,e),Y5.copy(t).applyMatrix4(this.bindMatrix),t.set(0,0,0);for(let n=0;n<4;n++){let s=Z5.getComponent(n);if(s!==0){let a=K5.getComponent(n);Q5.multiplyMatrices(i.bones[a].matrixWorld,i.boneInverses[a]),t.addScaledVector(Lre.copy(Y5).applyMatrix4(Q5),s)}}return t.applyMatrix4(this.bindMatrixInverse)}raycastDeformed(e,t){let i=this.posedGeometry();if(i===void 0)return!1;dp.geometry=i,dp.material=this.material,dp.matrixWorld.copy(this.matrixWorld);let r=t.length;dp.raycast(e,t);for(let n=r;n<t.length;n++)t[n].object=this;return dp.geometry=Bre,dp.material=Fre,!0}posedGeometry(){let e=this.skeleton;if(!this.isSkinnedMesh||e===void 0)return;let t=this.geometry,{position:i,skinIndex:r,skinWeight:n}=t.attributes;if(!i||!r||!n)return;let s=[...this.bindMatrix.elements,...this.bindMatrixInverse.elements,...this.morphTargetInfluences??[]];for(let d=0;d<e.bones.length;d++){let c=e.bones[d];if(!c||!e.boneInverses[d])return;s.push(...c.matrixWorld.elements)}let a=this._posed;if(a?.source===t&&a.version===i.version&&a.pose.length===s.length&&a.pose.every((d,c)=>d===s[c]))return a.geometry;let o=i.count,l=a?.geometry.attributes.position,h=l?.count===o?l:new Dt(new Float32Array(3*o),3);for(let d=0;d<o;d++)this.boneTransform(d,this.getVertexPosition(d,XS)),h.setXYZ(d,XS.x,XS.y,XS.z);let u=new At;u.setAttribute("position",h);for(let d of["normal","uv","uv1"]){let c=t.attributes[d];c&&u.setAttribute(d,c)}return u.setIndex(t.index),u.groups=t.groups,u.drawRange=t.drawRange,u.computeBoundingSphere(),u.computeBoundingBox(),this._posed={source:t,version:i.version,pose:s,geometry:u},u}}});function Rx(e){if(Array.isArray(e.material)){for(let t of e.material)if(t.getLayersOfType("outline").length===0)return}else if(!Ixe(e.material)||e.material.getLayersOfType("outline").length===0)return;e instanceof zn&&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 R;for(let s=0;s<i.length;s+=3)n.set(i[s],i[s+1],i[s+2]).normalize(),r[s]=n.x,r[s+1]=n.y,r[s+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,s=r.normal.array,a=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 R(s[o],s[o+1],s[o+2]);i.has(l)?i.get(l)?.normals.push(h):i.set(l,{normals:[h],result:new R})}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&&(a[o]=h.x,a[o+1]=h.y,a[o+2]=h.z)}t.geometry.setAttribute("extrudeNormal",new Et(a,3))}(e)}function J5(e){return Math.min(2047,Math.max(1,Math.round(2048*e)))/2048}function Dx(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),s=parseInt(e.uuid.replace(/\D/g,"")),a=[J5(et.seededRandom(s)),J5(et.seededRandom(s+1e4)),J5(et.seededRandom(s+2e4))];for(let o=0;o<i.length;o++)n[o]=a[o%3];e.geometry.setAttribute("randomColor",new Dt(n,3))}var NB=U(()=>{ae(),zxe(),Sl()});function Ure(e){let t=!1;return e.scene.objects.traverse((i,r)=>{r.geometry?.type==="BooleanGeometry"&&(t=!0)}),t}function IBe(e,t){let i=e.cloner;return i!==void 0&&i.parent===t?i:void 0}function zre(e,t,i,r){let n=16*(t.children.length+1);HM.length<n&&(HM=new Float32Array(n));let s=0,a=l=>{l.toArray(HM,16*s),s++},o=t.parameters.hideBase!==!0;o&&a(r),QH.copy(e.matrix);for(let l of t.children)!Bg(l)||l.playModeVisible===!1||(JH.copy(l.matrix).multiply(l.pivotMatrix),KI.multiplyMatrices(QH,JH),(!o||!KI.equals(r))&&a(KI));try{return s===0?0:function(l,h){return kY(ZL().instanced_union(zY(l),h))}(i,HM.subarray(0,16*s))}finally{Rxe(i)}}var cp,kre,QH,JH,KI,HM,qg,aC=U(()=>{Na(),ae(),EB(),NB(),f1(),Zn(),cp=new Ue,kre=new Ue,QH=new Ue,JH=new Ue,KI=new Ue,HM=new Float32Array(0),qg=class extends xl{constructor(e,t,i){super(e,t),this.data=t,this.meshSetAddresses=[],this.needsTransformForDownstream=!1,this.geometry=new At,this.onAfterRender=(r,n,s,a,o,l)=>{super.onAfterRender(r,n,s,a,o,l),this.recomputeBoolean()},this.geometry.userData.parameters={width:0,height:0,depth:0}}get booleanOp(){return this.data.geometry.operation}get phongAngle(){return this.data.geometry.phongAngle??45}get isLOD(){return this.recomputeBoolean(),!1}updateByPatchedOp(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 qg&&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 Es&&n.dataPatched.visible===!0&&n.geometry.attributes.position?.count>0&&n.geometry.drawRange.count>0&&n.booleanMeshSetAddress!==0){cp.copy(n.matrix).multiply(n.pivotMatrix);try{let s=IBe(n,this);if(n.booleanMeshSetAddress===-1){if((n.geometry.index??n.geometry.getAttribute("position")).count/3<15e5){let a=iBe(n.geometry,e===!0);n.booleanMeshSetAddress=s===void 0||a===-1?a:zre(n,s,a,cp)}if(n.booleanMeshSetAddress===-1)return;s===void 0&&P5(n.booleanMeshSetAddress,cp),n.booleanMatrixInvOld.copy(cp).invert(),n.booleanWasTransformed=!1}else n instanceof qg&&n.needsTransformForDownstream===!0?(s===void 0?P5(n.booleanMeshSetAddress,cp):n.booleanMeshSetAddress=zre(n,s,n.booleanMeshSetAddress,cp),n.needsTransformForDownstream=!1):n.booleanWasTransformed===!0&&(P5(n.booleanMeshSetAddress,kre.multiplyMatrices(cp,n.booleanMatrixInvOld)),n.booleanMatrixInvOld.copy(cp).invert(),n.booleanWasTransformed=!1)}catch(s){console.error(s),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 s=ZL(),a=Rie(r,n),o=s.mesh_topological_data(a),l=o.positions(),h=o.indices();return o.free(),a.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,s,a){let o=ZL(),l=Rie(r,n),h=o.mesh_render_data(l,Math.max(a,0));if(s.setAttribute("position",new Et(h.positions(),3)),s.setAttribute("normal",new Et(h.normals(),3)),h.free(),s.boundingSphere===null&&(s.boundingSphere=new Ha),l.tri_count()===0)s.boundingSphere.center.set(0,0,0),s.boundingSphere.radius=0,s.userData.parameters={width:0,height:0,depth:0};else{let u=l.bounds();s.boundingSphere.center.set(u[0],u[1],u[2]),s.boundingSphere.radius=(u[3]**2+u[4]**2+u[5]**2)**.5,s.userData.parameters={width:2*u[3],height:2*u[4],depth:2*u[5]}}return kY(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,Rx(this),Dx(this)}dispose(){super.dispose(),this.geometry.dispose()}}});function OBe(e){return e.isPointLight?ZI.PointLight:e.isSpotLight?ZI.SpotLight:ZI.DirectionalLight}function Vre(e){return e.isDirectionalLight?0:e.isSpotLight?1:2}function Qwe(e){Vv.length=0,e.traverseVisible(r=>{(function(n){let s=n;return s.isPointLight===!0||s.isSpotLight===!0||s.isDirectionalLight===!0})(r)&&(r.castShadow===!0||kE.has(r))&&Vv.push(r)});let t=!1;if(Vv.length===0)return t;Vv.sort((r,n)=>Vre(r)-Vre(n)||r.id-n.id);let i=12;for(let r of Vv){let n=OBe(r);n<=i?(i-=n,kE.delete(r)&&(r.castShadow=!0,t=!0)):r.castShadow===!0&&(r.castShadow=!1,kE.add(r))}return Vv.length=0,t}var ZI,kE,Vv,l4,IB,yd,zc,h4,lK=U(()=>{ZI={PointLight:1,SpotLight:3,DirectionalLight:3},kE=new WeakSet,Vv=[]}),oC=U(()=>{ae(),lK(),wl(),p1(),(l4||(l4={})).is=function(e){return nr.is(e)&&e instanceof Xp},IB=(e,t)=>class extends c1(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&&(function(n){kE.delete(n)}(this),this.castShadow=i.shadows)}}}),o0=U(()=>{aC(),Na(),p1(),yd=e=>e instanceof Es,zc=e=>e!==null&&e instanceof qg,h4=e=>wH.is(e)});function go(e,t){return t.color(e)}function Gre(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),f=m=>Number(p.find(g=>g.type===m)?.value);return new Date(f("year"),f("month")-1,f("day"),f("hour"),f("minute"),f("second"),d.getMilliseconds())}catch{return new Date(NaN)}}(new Date,t.timeZone));let s,a=n.getHours(),o=n.getMinutes();t.format12h24h==="12ampm"&&(s=a>=12?"PM":"AM");let l,h,u=a;switch(t.format12h24h!=="24"&&(u=a%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],s=void 0;break;case"mm":l=[o],s=void 0;break;case"ss":l=[r],s=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*a*60+60*o+r;break;default:console.error("Unknown time format",i),h=0}return l!==void 0?{textValue:l,suffix:s}:h}var eq,Rw,hK=U(()=>{}),LBe=U(()=>{ae(),eC(),tC(),eq=class extends ww(h_e){constructor(e,t=15,i=10066329){super(e,t,i),this.object=e,this.added=!1,this.name=`DirectionalLightHelper: ${e.uuid}`}raycast(e,t){Sw(this.object,eq.geometryHelper,e,t)}}}),OB=U(()=>{ae(),LBe(),oC(),Rw=class extends IB(_A,eq){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 bA(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 bA&&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 uK(e){return e instanceof xl&&e.needsAO&&!Zf(e)&&e.isDecalObject!==!0}function dK(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 cK(e){return e.getLayersOfType("reflection").filter(t=>t.data.visible).length}function BBe(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 s=typeof n.blur=="number"?n.blur:null;t=Math.min(t,s??0),i=Math.max(i,s??10)}return t===1/0?null:{min:t,max:i}}function FBe(e){for(let t of e.getLayersOfType("reflection")){let i=t.data;if(!i.visible)continue;let{blur:r,thickness:n,steps:s,stepSize:a}=i;return typeof r!="number"||typeof n!="number"||typeof s!="number"||typeof a!="number"?"variable":{blur:r,thickness:n,steps:s,stepSize:a,tracingMode:i.tracingMode===1?1:0}}return null}function jre(e,t){let i={outline:!1,cavity:!1},r=e.layers.mask&LB,n=t.getLayersOfType("transmission"),s=t.getLayersOfType("outline"),a=cK(t),o=t.getLayersOfType("cavity");return(s.length>0||o.length>0)&&(e.layers.set(8),n.length>0&&e.layers.enable(3),a>0&&e.layers.enable(4),i.outline=s.length>0,i.cavity=o.length>0,Dx(e),Rx(e)),n.length===0&&s.length===0&&o.length===0&&a===0&&e.layers.set(0),r&&e.layers.set(9),!r&&uK(e)&&e.layers.enable(5),dK(e),i}function Wre(e,t){if(!t.layers)return!1;let i=e.layers.mask&LB,r=!1,n=t.getLayersOfType("transmission").filter(l=>l.data.visible),s=t.getLayersOfType("outline").filter(l=>l.data.visible),a=cK(t),o=t.getLayersOfType("cavity").filter(l=>l.data.visible);return n.length>0&&(e.layers.set(3),(s.length>0||o.length>0)&&e.layers.enable(8),a>0&&e.layers.enable(4),r=!0),n.length===0&&s.length===0&&o.length===0&&a===0&&e.layers.set(0),i&&e.layers.set(9),!i&&uK(e)&&e.layers.enable(5),dK(e),r}function Hre(e,t){var i;if(!t.layers)return!1;let r=e.layers.mask&LB,n=!1,s=cK(t),a=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 s>0&&((i=e.userData).__splinePlanarMirror??(i.__splinePlanarMirror=0),e.layers.set(4),a.length>0&&e.layers.enable(3),(o.length>0||l.length>0)&&e.layers.enable(8),n=!0),s===0&&a.length===0&&o.length===0&&l.length===0&&e.layers.set(0),r&&e.layers.set(9),!r&&uK(e)&&e.layers.enable(5),dK(e),n}function tq(e,t,i,r=!1){let n=e.cloner;if(n){let s=null;if((e.raycast===Tr.prototype.raycast||e.raycast===Es.prototype.raycast)&&e.isSkinnedMesh!==!0){let a=e.geometry;a&&(a.boundingSphere===null&&a.computeBoundingSphere(),s=a.boundingSphere)}for(let a of n.children){if(s!==null&&(iq.copy(s).applyMatrix4(a.matrixWorld),!t.ray.intersectsSphere(iq)))continue;let o=eSe.copy(a.matrixWorld).invert(),l=tSe.copy(t.ray).applyMatrix4(o),h=e.matrixWorld;l.applyMatrix4(h);let u=Jwe;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?a:e})}}}var LB,Jwe,eSe,tSe,iq,j3,iSe,ez,tz,iz,Dw,Dn,pK=U(()=>{Zn(),NB(),Na(),f1(),ae(),LB=512,Jwe=new hB,eSe=new Ue,tSe=new xf,iq=new Ha}),UBe=U(()=>{ae(),eC(),tC(),j3=class extends ww(o_e){constructor(e,t=6710886){super(e,t),this.object=e,this.matrix=e.matrixWorld,this.name=`SpotLightHelper: ${e.uuid}`}raycast(e,t){Sw(this.object,j3.geometryHelper,e,t)}update(){if(this.object!==void 0){let e=j3._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,s=this.cone.material.length;n<s;n++)this.cone.material[n].color.set(r);else this.cone.material.color.set(r)}}},(iSe=j3)._vector=new R}),BB=U(()=>{ae(),UBe(),oC(),ez=new R,tz=new R,iz=new jt,Dw=class extends IB(vy,iSe){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*et.RAD2DEG*this.angle,r.aspect=1,r.near=100,r.far=2500;let n=new bA(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 bA&&t.update()}}updateMatrixWorld(e){super.updateMatrixWorld(e),tz.setFromMatrixPosition(this.matrixWorld),iz.setFromRotationMatrix(this.matrixWorld),ez.copy(this.up).applyQuaternion(iz).negate().multiplyScalar(this.distance),this.target.position.copy(tz).add(ez),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))}}}),Tu=U(()=>{zt(),Oh(),ae(),wl(),Su(),hK(),Pd(),OB(),Or(),em(),ae(),f1(),o0(),pK(),BB(),_r(),aC(),Dn=class extends TB(Ko){constructor(e,t,i){if(super(),this.data=t,this.bgColor=new kr(1,1,1,1),this.fog=null,this.backupFog=new K7(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 lt,this.penumbraSizeArrayCache=null,this.super_Entity(e,t),this.personalCamera=new Qn(d1,{...IE.defaultData,...t.camera,name:"Personal Camera"}),this.personalCamera.objectHelper.visible=!1,this.add(this.personalCamera),this.activeCamera=this.personalCamera,this.ambientLight=new lB(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=gH();r===null?Ta("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=gH();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()})):Ta("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=go(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 qg&&t.recomputeBoolean()}),this.updateShadow(this.data.shadow)}forceMaterialsUpdate(){this.traverseEntity(e=>{if(e instanceof xl)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,KH!==void 0&&KH(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=go(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=go(e.aoColor,t))}updateByOp(e,t,i,r){let n=this.data.uiFrame;super.updateByOp(e,t,i,r);let s=t;Jr(e.path,["fog"])?this.updateFog(s.fog,i.shared):Jr(e.path,["sky"])?this.updateSky(s.sky,i.shared):Jr(e.path,["grading"])?this.gradingState=s.grading??null:Jr(e.path,["ao"])?this.updateAo(s.ao,i.shared):Jr(e.path,["ambient"])?this.updateAmbientLight(s.ambient,i.shared):Jr(e.path,["shadow"])?this.updateShadow(s.shadow):e.type===0&&e.path.length===0&&(e.props.uiFrame!==void 0||n!==s.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(go(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 instanceof Qn&&e.isDescendantOf(this)&&(this.activeCamera!==this.personalCamera&&(this.activeCamera.objectHelper.visible=!0),this.activeCamera=e,e.objectHelper.visible=!1)}get playCamera(){let e=this.scene?.find(this.data.publish.playCamera);return e instanceof Qn?e:this.personalCamera}switchToPlayCamera(){this.switchActiveCamera(this.playCamera)}get penumbraSizeArray(){return this.penumbraSizeArrayCache===null&&this.updatePenumbraSizeArray(),this.penumbraSizeArrayCache}updatePenumbraSizeArray(){this.penumbraSizeArrayCache=new Array(Kf).fill(.5);let e=0,t=0;this.traverseEntity(i=>{if(!i.visible)return!0;i instanceof Rw&&i.visible&&e<LE&&(this.penumbraSizeArrayCache[e]=i.data.penumbraSize??.5,e+=1),i instanceof Dw&&i.visible&&e<Kf-LE&&(this.penumbraSizeArrayCache[LE+t]=i.data.penumbraSize??.5,t+=1)})}raycastWithClones(e){let t=[],i=r=>{for(let n of r.children){let s=n.cloner;nr.is(n)&&(n.visible||s?.object.data.visible)&&((yd(n)||h4(n)&&this.scene.enableHelpers&&n.objectHelper.visible)&&(e.intersectObject(n,!1,t),tq(n,e,t,!0)),i(n))}};return i(this),t}updateEntity2DByOp(e,t,i,r){this.uiCanvas?.updateEntity2DByOp(e,t,i,r)}}});function qre(){return fK}function rz(){if(u4===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 u4}function nz(e){return e?.isWebGPUSplineRenderer===!0}var fK,u4,mK=U(()=>{fK=null,u4=null});function rq(){return vK}var gK,vK,yK=U(()=>{gK=null,vK=null});function $re(e,t,i){return qM.setRGB(e,t,i,Xi),{r:qM.r,g:qM.g,b:qM.b}}function zBe(e,t,i){let r,n=BA(e.angle,0),[s,a]=nq(e.offset),[o,l]=nq(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+s)-1,v=3*(i+l)-(i+a)-1;r=Math.hypot(g,v)+n}else if(e.gradientType===2){let g=-1*Math.atan2(t+o-.5+s,i+l-.5+a),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+s)/2+y/2)*y+((i-.5+a)/2+_/2)*_)/b:0}let c=h[0][0],p=h[0][1],f=h[0][2],m=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)*_,f+=(h[g][2]-f)*_,m+=(h[g][3]-m)*_}return[c,p,f,m]}function kBe(e,t){let i=e,r=i?.data?.layers;if(r&&typeof r.forEach=="function"){let n=t,s=[];return r.forEach(a=>{let o=a.data;if(o.visible===!1||o.isMask===!0)return;let l=BA(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&&s.push({kind:"color",layer:o,rgb:{...$re(h.r,h.g,h.b),a:h.a??1},alpha:l})}else o.type==="gradient"&&s.push({kind:"gradient",layer:o,alpha:l})}),s.length===0?null:(a,o)=>{let l=1,h=1,u=1,d=!0;for(let c of s){let p,f,m,g;if(c.kind==="color")({r:p,g:f,b:m}=c.rgb),g=c.rgb.a;else{let[y,_,b,x]=zBe(c.layer,a,o);({r:p,g:f,b:m}=$re(y,_,b)),g=x}let v=d?1:Math.min(1,Math.max(0,g*c.alpha));l+=(p-l)*v,h+=(f-h)*v,u+=(m-u)*v,d=!1}return{r:l,g:h,b:u}}}if(i?.color&&i.color.isColor===!0){let{r:n,g:s,b:a}=i.color;return()=>({r:n,g:s,b:a})}return null}var qM,BA,nq,VBe=U(()=>{ae(),qM=new lt,BA=(e,t)=>typeof e=="number"&&Number.isFinite(e)?e:t,nq=e=>Array.isArray(e)&&typeof e[0]=="number"&&typeof e[1]=="number"?[e[0],e[1]]:[0,0]});function GBe(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),s=Math.sin(n)*Math.cos(i),a=Math.cos(n),o=Math.sin(n)*Math.sin(i);return{x:s,y:a,z:o,nx:s,ny:a,nz:o,cr:1,cg:1,cb:1}}function jBe(e){let{geometry:t,matrix:i}=e,r=t.getAttribute("position");if(!r||r.count<3)return null;let n=t.getAttribute("normal"),s=t.getAttribute("uv"),a=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 oi().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]:_},f=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},m=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=f(y),T=c(_)-x,M=p(_)-w,E=f(_)-S,A=c(b)-x,P=p(b)-w,N=f(b)-S,D=M*N-E*P,O=E*A-T*N,z=T*P-M*A;g+=.5*Math.sqrt(D*D+O*O+z*z),m[v]=g}return g<=0?null:{total:g,sample:(v,y)=>{let _=0,b=l-1;for(;_<b;){let Q=_+b>>1;m[Q]<v?_=Q+1:b=Q}let x=_,w=h(x,0),S=h(x,1),T=h(x,2),M=y(),E=y();M+E>1&&(M=1-M,E=1-E);let A,P,N,D=1-M-E,O=c(w)*D+c(S)*M+c(T)*E,z=p(w)*D+p(S)*M+p(T)*E,B=f(w)*D+f(S)*M+f(T)*E;if(n){if(A=n.getX(w)*D+n.getX(S)*M+n.getX(T)*E,P=n.getY(w)*D+n.getY(S)*M+n.getY(T)*E,N=n.getZ(w)*D+n.getZ(S)*M+n.getZ(T)*E,d){let Q=d[0]*A+d[3]*P+d[6]*N,ce=d[1]*A+d[4]*P+d[7]*N,pe=d[2]*A+d[5]*P+d[8]*N;A=Q,P=ce,N=pe}}else{let Q=c(w),ce=p(w),pe=f(w),ye=c(S)-Q,we=p(S)-ce,ne=f(S)-pe,Se=c(T)-Q,W=p(T)-ce,k=f(T)-pe;A=we*k-ne*W,P=ne*Se-ye*k,N=ye*W-we*Se}let V=Math.sqrt(A*A+P*P+N*N)||1,j=1,K=1,$=1;if(a)j=a.getX(w)*D+a.getX(S)*M+a.getX(T)*E,K=a.getY(w)*D+a.getY(S)*M+a.getY(T)*E,$=a.getZ(w)*D+a.getZ(S)*M+a.getZ(T)*E;else if(e.sampleColor){let Q=s?s.getX(w)*D+s.getX(S)*M+s.getX(T)*E:.5,ce=s?s.getY(w)*D+s.getY(S)*M+s.getY(T)*E:.5,pe=e.sampleColor(Q,ce);pe&&(j=pe.r,K=pe.g,$=pe.b)}return{x:O,y:z,z:B,nx:A/V,ny:P/V,nz:N/V,cr:j,cg:K,cb:$}}}}function Xre(e){let t=Math.min(Math.max(1,Math.floor(e.guideStrands)),Nx),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,s=new Float32Array(4*sf),a=new Float32Array(sf),o=new Float32Array(4*Nx).fill(1);for(let l=0;l<t;l++){let h=r?e.sampler(i):GBe(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:f,nz:m}=h;o[4*l+0]=h.cr,o[4*l+1]=h.cg,o[4*l+2]=h.cb;let g,v,y,_=l*Yv,b=(1.8+.8*i())*e.hairLength*n/(Yv-1),x=.5+1.5*i(),w=(.02+.06*i())*n;Math.abs(f)<.99?(g=-m,v=0,y=p):(g=1,v=0,y=0);let S=Math.sqrt(g*g+v*v+y*y)||1;for(let T=0;T<Yv;T++){let M=T/(Yv-1),E=M*M*.4*n,A=w*Math.sin(M*x*Math.PI*2),P=4*(_+T);s[P+0]=u+p*b*T+A*g/S,s[P+1]=d+f*b*T-E+A*v/S,s[P+2]=c+m*b*T+A*y/S,s[P+3]=T===0?0:1,T<Yv-1&&(a[_+T]=b)}}return{initialPositions:s,restLengths:a,unitScale:n,rootColors:o}}var Yv,Nx,sf,hd,vg,YS,J1,z0,e_,QI,rSe=U(()=>{ae(),sf=(Nx=16384)*(Yv=32),hd=100}),nSe=U(()=>{ae(),Na(),yK(),VBe(),rSe(),vg=1/60,YS=new Ue,J1=new jt,z0=new R,e_=new R,QI=class extends Es{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 jt,this.lastBonePos=new R,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 Dt(new Float32Array(0),3)),this.material=new Ql({colorWrite:!1,depthWrite:!1}),this.frustumCulled=!1,this.scalpMesh=new Tr(new Hf(hd,48,32),new Ql({color:5448477})),this.scalpMesh.name="HairScalp",this.add(this.scalpMesh);let r=new bL;r.setAttribute("position",new Dt(new Float32Array(12),3)),r.setIndex([0,2,1,2,3,1]),r.instanceCount=0,this.ribbonMesh=new Tr(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*vg*2),this.trackMotionRest(e/1e3))}trackMotionRest(e){this.boneTransform(J1,z0);let t=this.hasLastBone&&(Math.abs(this.lastBoneQuat.dot(J1))<.9999995||this.lastBonePos.distanceToSquared(z0)>1e-8),i=this.motionFingerprint(),r=!this.hasLastBone||t||this.resetRequested||i!==this.lastMotionFingerprint||this.data.windStrength>.001;this.lastBoneQuat.copy(J1),this.lastBonePos.copy(z0),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,Xi)}(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 s=this.collectBaseSources(n),a=s?function(o){let l=[];for(let d of o){let c=jBe(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,f=l.length-1;for(;p<f;){let g=p+f>>1;h[g]<c?p=g+1:f=g}let m=p===0?c:c-h[p-1];return l[p].sample(m,d)}}(s.sources):null;if(this.baseSourceGeomsAtRegen=s?.sources.map(o=>o.geometry)??[],this.baseSourceHashesAtRegen=s?.hashes??[],this.baseColorHashAtRegen=s?.colorHash??0,s&&a){let o=this.baseWorldScale(n),l=Math.max(s.radius*o,.001);this.baseScaleAtRegen=o;let h=o;return Xre({shape:"object",guideStrands:i,hairLength:r,sampler:u=>{let d=a(u);return{...d,x:d.x*h,y:d.y*h,z:d.z*h}},samplerRadius:l})}}}return Xre({shape:e==="object"?"sphere":e,guideStrands:i,hairLength:r})}collectBaseSources(e){let t=[],i=[],r=0,n=0;YS.copy(e.matrixWorld).invert();let s=YS.clone(),a=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 Ue().multiplyMatrices(s,o.matrixWorld),u=Array.isArray(o.material)?o.material[0]:o.material;t.push({geometry:l,matrix:h,sampleColor:kBe(u,this.context.shared)??void 0}),i.push(QI.matrixHash(h)),n+=function(c,p){let f=c,m=0,g=1,v=_=>{m+=_*g,g+=1},y=f?.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(BA(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(BA(w.angle,0)),v(w.gradientType),v(w.smooth?1:0)}}})}else f?.color&&f.color.isColor===!0&&(v(f.color.r),v(f.color.g),v(f.color.b));return m}(u,this.context.shared),l.boundingSphere===null&&l.computeBoundingSphere();let d=l.boundingSphere;if(d){let c=0,p=1;h?(z0.copy(d.center).applyMatrix4(h),c=z0.length(),p=QI.matrixMaxScale(h)):c=d.center.length(),r=Math.max(r,c+d.radius*p)}}for(let h of o.children)a(h)};return a(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 YS.copy(e.matrixWorld).decompose(z0,J1,e_),Math.max(Math.abs(e_.x),Math.abs(e_.y),Math.abs(e_.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,s=this.baseSourceHashesAtRegen,a=i.length!==n.length;if(!a){for(let o=0;o<i.length;o++)if(i[o].geometry!==n[o]||Math.abs(r[o]-s[o])>1e-4*Math.max(Math.abs(s[o]),1)){a=!0;break}}if(!a&&this.data.hairColorSource==="object"&&(t?.colorHash??0)!==this.baseColorHashAtRegen&&(a=!0),!a&&i.length>0){let o=this.baseWorldScale(e);a=Math.abs(o-this.baseScaleAtRegen)>.001*Math.max(this.baseScaleAtRegen,1e-6)}a&&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 _L(1.4*hd,.7*hd,24,48):e==="cylinder"?new EE(.8*hd,.8*hd,1.6*hd,48,1):new Hf(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)}YS.copy(i).decompose(t,e,e_)}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(J1,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?.(),rq()?.release(this)}}});function JI(){return{shapeInput:()=>`
|
|
4192
|
+
`&&A.push("")):S.getTextWidth(A[A.length-1]+P,w)>E&&(A[A.length-1].length&&A.push(""),S.getTextWidth(A[A.length-1]+P,w)>E&&(P.length===1?(A[A.length-1]+=P,P=""):(A[A.length-1]+=P.slice(0,-1),P=P[P.length-1],A.push(""))));return A[A.length-1]+=P,A}(e,i,h===2?c.toUpperCase():h===3?c.toLowerCase():c,t),{shapes:f,charWidths:m,charCoords:g}=i.generateShapes(p,e,t),v=.5*(typeof r=="number"?r:Number(t.getVariable(r))),y=.5*(typeof n=="number"?n:Number(t.getVariable(n))),_=f.map(w=>new ps().fromShape(w,!0));this.vectorShapes=_;let b=_.map(w=>a0.create({shape:w,parameters:{depth:s,extrudeBevelSegments:o,extrudeBevelSize:a,uvPitch:d===1?void 0:u,extrusionVersion:d,windingRule:s<=0?ns.NONZERO:ns.ODD,subdivisions:this.isLowResolution&&s>0?1:12}})),x=b.length?sy(b):wre();x.translate(-v,y,0),this.dispose(),this.wrappedText=p,this.charCoords=g,this.charWidths=m,this.deleteAttribute("extrudeNormal"),Object.entries(x.attributes).forEach(([w,S])=>{this.setAttribute(w,S)}),this.setIndex(x.index),this.adoptNearSide(b,s),this.computeBoundingSphere()}adoptNearSide(e,t){this._depth=t;let i=0,r=0,n=0;for(let o of e){let l=o,h=l._nearSide;if(h===void 0||h.length===0)return this._nearSide=new Uint8Array(0),this._effectiveBevel=0,void(this._vScale=0);i+=h.length,r=Math.max(r,l._effectiveBevel??0),n=l._vScale??n}this._effectiveBevel=r,this._vScale=n;let s=new Uint8Array(i),a=0;for(let o of e){let l=o._nearSide;s.set(l,a),a+=l.length}this._nearSide=s}takeDepthStateFrom(e){let t=e;t._nearSide!==void 0&&(this._depth=t._depth??this._depth,this._nearSide=t._nearSide,this._vScale=t._vScale??this._vScale,this._effectiveBevel=t._effectiveBevel??this._effectiveBevel)}canShiftDepthTo(e){return this._nearSide.length===this.getAttribute("position")?.count&&ax(this._effectiveBevel,e)&&ax(this._effectiveBevel,this._depth)}shiftDepthTo(e){if(!this.canShiftDepthTo(e))return!1;let t=e-this._depth;if(this._depth=e,t===0)return!0;let i=this.getAttribute("position"),r=i.array,n=this.getAttribute("uv"),s=n?.array,a=this._vScale>0?t/this._vScale:0,o=this._nearSide;for(let l=0;l<o.length;l++){let h=o[l];h!==0&&(r[3*l+2]+=t,h===2&&s!==void 0&&(s[2*l+1]+=a))}return i.needsUpdate=!0,n!==void 0&&a!==0&&(n.needsUpdate=!0),this.refreshDepthBounds(e),!0}refreshDepthBounds(e){if(this.boundingBox===null&&this.boundingSphere===null)return;this.boundingBox===null&&this.computeBoundingBox();let t=this.boundingBox;t.min.z=Math.min(0,e),t.max.z=Math.max(0,e),this.boundingSphere!==null&&t.getBoundingSphere(this.boundingSphere)}clone(){let e=jo(new At,UH.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 PBe(e){if(!zH)return Tre||(Tre=async function(){let t=e??"https://cdn.spline.design/@splinetool/runtime@2.0.123/build",i=import("./process.js"),[r,n]=await Promise.all([i,fetch(`${t}/process.wasm`).then(o=>o.arrayBuffer())]),s=r.default,a=await s({wasmBinary:n});Uwe(a),zH=!0}())}var Uwe,eK,zH,Tre,RB=U(()=>{eK=new Promise(e=>{Uwe=e}),zH=!1});function z5(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 l of r){let h=e.attributes[l],u=t.attributes[l];if(h===void 0||h.isInterleavedBufferAttribute===!0||u.isInterleavedBufferAttribute===!0||h.itemSize!==u.itemSize||h.normalized!==u.normalized||h.array.constructor!==u.array.constructor||h.array.length!==u.array.length)return!1}let n=e.index,s=t.index;if(n===null!=(s===null))return!1;let a=!1;if(n!==null&&s!==null){if(n.array.length!==s.array.length)return!1;let l=n.array.constructor,h=s.array.constructor;if(l!==h){if(l!==Uint32Array||h!==Uint16Array)return!1;a=!0}}if(e.groups.length!==t.groups.length)return!1;for(let l=0;l<t.groups.length;l++){let h=e.groups[l],u=t.groups[l];if(h.start!==u.start||h.count!==u.count||h.materialIndex!==u.materialIndex)return!1}for(let l of r){let h=e.attributes[l],u=t.attributes[l];h.array.set(u.array),h.needsUpdate=!0}let o=e.takeDepthStateFrom;if(typeof o=="function"&&o.call(e,t),n!==null&&s!==null){if(a){let l=n.array,h=s.array;for(let u=0,d=h.length;u<d;u++){let c=h[u];l[u]=c===65535?4294967295:c}}else n.array.set(s.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 kH(e,t,i,r){let n,s,a,o=e.position.array,l=e.normal.array,h=zwe.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],s=l[u+1],a=l[u+2],l[u]=h[0]*n+h[4]*s+h[8]*a,l[u+1]=h[1]*n+h[5]*s+h[9]*a,l[u+2]=h[2]*n+h[6]*s+h[10]*a;e.position.needsUpdate=!0,e.normal.needsUpdate=!0}var zwe,kwe=U(()=>{ae(),zwe=new Ue});function VH(e){let t=Number(e);return Number.isInteger(t)&&t>=0&&String(t)===e?t:-1}function z3(e){if(e!=null){if(Array.isArray(e)||ArrayBuffer.isView(e)&&!(e instanceof DataView))return e;if(typeof e=="object")return function(t){let i=Object.keys(t),r=0;for(let s of i){let a=VH(s);a>=r&&(r=a+1)}if(r===0||r>i.length)return;let n=new Array(r);for(let s=0;s<r;s++){let a=t[s];if(typeof a!="number")return;n[s]=a}return n}(e)}}function k5(e){if(e==null)return"missing";if(Array.isArray(e))return`Array(${e.length})`;if(ArrayBuffer.isView(e)){let l=e;return`${e.constructor.name}(${l.length})`}if(typeof e!="object")return typeof e;let t=Object.keys(e),i=t.filter(l=>VH(l)===-1),r=0;for(let l of t){let h=VH(l);h>=r&&(r=h+1)}let n=e,s=-1,a=-1;for(let l=0;l<r;l++)l in n?typeof n[l]!="number"&&a===-1&&(a=l):s===-1&&(s=l);let o=[`${t.length} keys`,"max index "+(r-1)];return s!==-1&&o.push(`first missing index ${s}`),a!==-1&&o.push(`non-number at ${a} (${typeof n[a]})`),i.length&&o.push(`stray keys ${i.slice(0,3).join(",")}`),`Object{${o.join(", ")}}`}function Vwe(e){let t=Object.keys(e);return t.length===1&&t[0]==="subdivisions"}function tK(e,t){let i=t?t.count:e.count,r=0,n=1e4,s=new Map,a=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),f=e.getZ(d),m=Math.round(c*n),g=Math.round(p*n),v=Math.round(f*n),y=s.get(m);y===void 0&&(y=new Map,s.set(m,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,f)),a[u]=b}let l=[],h=[];for(let u=0;u<a.length;u+=3)a[u]===a[u+1]||a[u]===a[u+2]||a[u+1]===a[u+2]||(l.push(a[u],a[u+1],a[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 qS,U0,ri,V5,G5,j5,ds,$S,k3,V3,G3,GH,YI,Aw=U(()=>{ae(),RB(),zt(),DB(),kwe(),DA(),qS=new pn,U0=new R,eK.then(e=>{ri=e}),V5=new Float32Array([10,10,0,-10,10,0,-10,-10,0,10,-10,0]),G5=new Uint32Array([0,1,2,3]),j5=new Uint8Array([4]),ds=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(a=>typeof a=="number"?a:1),r=jg.div(t.map(a=>typeof a=="number"?a:0),i);if(r.every(a=>a===1))return;this.subdividedGeometry&&kH(this.subdividedGeometry.attributes,...r),this.originalGeometry&&kH(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(U0.fromArray(r));let s=U0.set(n.width,n.height,n.depth).length();this.originalGeometry.boundingSphere.radius=s/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=ds.allocate(e),i=ds.buildRefined(n,e.subdivisions,t)}catch(s){console.error(s,e)}finally{n&&ds.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}=ds.build(this.data,void 0,!this.flatShading,void 0))}catch{e=new Ih(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&&(ds.freeSubdivPointer(this.subdivPointer),this.subdivPointer=0)}dispose(){super.dispose(),this.freeSubdivPointer()}calcBoundingBox(){let e=this.originalGeometry;e.boundingSphere===null&&(e.boundingSphere=new Ha,this.subdividedGeometry&&(this.subdividedGeometry.boundingSphere=e.boundingSphere));let t=e.attributes.position,i=e.boundingSphere.center;qS.setFromBufferAttribute(t),qS.getCenter(i),e.boundingSphere.radius=i.distanceTo(qS.max),isNaN(e.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this),qS.getSize(U0);let r={width:U0.x,height:U0.y,depth:U0.z};return this.userData.parameters=r,r}static build(e,t,i,r){let n,s,a=e?.phongAngle??35;i===!1&&(a=-1),t&&(ri.free_bvh(t),ri.free_subdivision_surface(t));try{n=ds.allocate(e,r)}catch(l){console.error(l,e),n=ds.allocate({positionWASM:V5,indexWASM:G5,verticesPerFaceWASM:j5},r)}ri.set_destination_refinement_level(n,0);let o=ds.buildLevel(n,!0,a);return s=e.subdivisions>0?ds.buildRefined(n,e.subdivisions,a):null,{subdivPointer:n,originalGeometry:o,subdividedGeometry:s}}static buildRefined(e,t,i){try{return ri.set_destination_refinement_level(e,t),ds.buildLevel(e,!1,i)??null}catch{try{return ri.set_destination_refinement_level(e,t-1),ds.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:Fg(e,i,!1,t);r=Cxe(e)?n.getClosedTorusIndicesForBooleanOrSubdiv():n.getIndex();let s,{positions:a,triIndices:o,triOriginals:l}=tK(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;s=[c,c+3*e.radialSegments]}let{indices:h,verticesPerFace:u,uvs:d}=function(c,p,f,m,g){let v=[],y=[],_=g?f.getAttribute("uv"):void 0,b=_&&_.itemSize===2?[]:void 0,x=T=>{if(b){let M=g[T];b.push(_.getX(M),_.getY(M))}};if(f.userData.shape!==void 0&&f.userData.parameters.depth===0&&f.userData.shape.shapeHoles.length===0){let T=f.userData.shape.extractShapePointsToFlatArray([]),M=f.userData.parameters.spikes;if(f.userData.type==="EllipseGeometry"&&M<=24&&M%4==0&&f.userData.parameters.angle>=360){let P=T.length/2/M;T=T.filter((N,D)=>Math.floor(D/2)%P===0)}let E=0;for(let P=0;P<T.length;P+=2)E+=(T[P]-T[(P===0?T.length:P)-2])*(T[P+1]+T[(P===0?T.length:P)-1]);c.length=0;let A=0;if(E<0)for(let P=0;P<T.length;P+=2)c.push(T[P],T[P+1],0),v.push(A++);else for(let P=T.length-2;P>=0;P-=2)c.push(T[P],T[P+1],0),v.push(A++);return y.push(A),{indices:v,verticesPerFace:y}}let w=new Float32Array([f.userData.parameters.depth])[0],S=0;for(;S<p.length;){if(f.useNgonForTopBottomFaceDuringBake){let T=0;if((c[3*p[S]+2]===w||c[3*p[S]+2]===0)&&T++,(c[3*p[S+1]+2]===w||c[3*p[S+1]+2]===0)&&T++,(c[3*p[S+2]+2]===w||c[3*p[S+2]+2]===0)&&T++,T===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]){$S.set(c[3*p[S]],c[3*p[S]+1],c[3*p[S]+2]),k3.set(c[3*p[S+1]],c[3*p[S+1]+1],c[3*p[S+1]+2]),V3.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]),k3.sub($S).normalize(),V3.sub($S).normalize(),G3.sub($S).normalize();let T=k3.cross(V3).dot(G3),M=S;Math.abs(T)>.005||m&&m.some((E,A)=>A%2!=1&&M>=m[A]&&M<m[A+1])?(v.push(p[S],p[S+1],p[S+2]),x(S),x(S+1),x(S+2),y.push(3),S+=3):(v.push(p[S],p[S+1],p[S+4],p[S+5]),x(S),x(S+1),x(S+4),x(S+5),y.push(4),S+=6)}else v.push(p[S],p[S+1],p[S+2]),x(S),x(S+1),x(S+2),y.push(3),S+=3}if(f.useNgonForTopBottomFaceDuringBake){let T=[],M=[],E=0;for(let A=0,P=0;A<c.length;A+=3,P++)c[A+2]===0&&(T.push(P),E++),c[A+2]===w&&M.push(P);if(f.userData.parameters.extrudeBevelSize===0){let A=M[0];M[0]=M[1],M[1]=A}T.reverse(),v.push(...T,...M),y.push(E,E),b=void 0}return{indices:v,verticesPerFace:y,uvs:b}}(a,o,n,s,l);return{positions:a,indices:h,verticesPerFace:u,uvs:d}}static allocate(e,t){let i,r,n,s=[],a=[],o=z3(e.positionWASM),l=z3(e.indexWASM),h=z3(e.verticesPerFaceWASM);if(o&&o.length>0){if(!l?.length||!h?.length)throw new Error(`SubdivGeometry.allocate: unusable cage topology \u2014 positionWASM ${k5(e.positionWASM)}, indexWASM ${k5(e.indexWASM)}, verticesPerFaceWASM ${k5(e.verticesPerFaceWASM)}`);i=o,r=l,n=h;let S=z3(e.uvWASM);ri.alloc_subdivision_surface_uvs&&S&&S.length===2*r.length&&(a=S)}else i=V5,r=G5,n=j5;let u=i.length,d=r.length,c=n.length,p=i.length+s.length+a.length,f=r.length+n.length,m=p*Float32Array.BYTES_PER_ELEMENT+f*Uint32Array.BYTES_PER_ELEMENT,g=p*Float32Array.BYTES_PER_ELEMENT,v=ri._malloc(m);if(!v)throw new Error(`SubdivGeometry.allocate: wasm _malloc(${m}) failed`);let y,_=new Float32Array(ri.HEAPF32.buffer,v,p),b=new Uint32Array(ri.HEAPU32.buffer,v+g,f);_.set(i,0),_.set(s,i.length),_.set(a,i.length+s.length),b.set(r,0),b.set(n,r.length),e?.scaleBaked?.some(S=>S!==1)&&(y=new Ue().makeScale(...e.scaleBaked.map(S=>typeof S=="number"?S:1))),t&&(y?y.premultiply(t):y=t);let x=v+(i.length+s.length)*Float32Array.BYTES_PER_ELEMENT,w=a.length?y?ri.alloc_subdivision_surface_uvs2(v,u,v+g,d,v+g+r.length*Uint32Array.BYTES_PER_ELEMENT,c,x,a.length,y.elements):ri.alloc_subdivision_surface_uvs(v,u,v+g,d,v+g+r.length*Uint32Array.BYTES_PER_ELEMENT,c,x,a.length):y?ri.alloc_subdivision_surface2(v,u,v+g,d,v+g+r.length*Uint32Array.BYTES_PER_ELEMENT,c,y.elements):ri.alloc_subdivision_surface(v,u,v+g,d,v+g+r.length*Uint32Array.BYTES_PER_ELEMENT,c);return ri._free(v),w}static buildLevel(e,t,i,r,n,s=!1){let a=n?ri.get_mesh_data2(e,t?ri.Level.CONTROL:ri.Level.REFINED,i,n.elements):ri.get_mesh_data(e,t?ri.Level.CONTROL:ri.Level.REFINED,i),o=ri.HEAPU32.subarray(a>>2,10+(a>>2)),l=o.subarray(4,8),h=0,u=ri.HEAPU32[o[h]>>2],d=ri.HEAPF32.subarray(u>>2,(u>>2)+l[h]);h++;let c=ri.HEAPU32[o[h]>>2],p=ri.HEAPF32.subarray(c>>2,(c>>2)+l[h]);h++;let f=ri.HEAPU32[o[h]>>2],m=ri.HEAPU32.subarray(f>>2,(f>>2)+l[h]);h++;let g,v=ri.HEAPU32[o[h]>>2],y=ri.HEAPU32.subarray(v>>2,(v>>2)+l[h]);if(h++,ri.alloc_subdivision_surface_uvs){let b=o[9];if(b>0){let x=ri.HEAPU32[o[8]>>2];g=ri.HEAPF32.subarray(x>>2,(x>>2)+b)}}if(r===void 0){let b=new At;if(b.setIndex(new Wf(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 Wf(m,1));let x=new Float32Array(p.length/3*4).fill(0);b.setAttribute("color",new Dt(x,4))}return ri.free_mesh_data(a),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,s){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),ri.free_mesh_data(a)}static freeSubdivPointer(e){ri.free_bvh(e),ri.free_subdivision_surface(e)}static buildControlCageWireframe(e,t,i){let r=ri.get_wireframe_data_for_base_level(e),n=ri.HEAPU32.subarray(r>>2,4+(r>>2)),s=n.subarray(2,4),a=0,o=ri.HEAPU32[n[a]>>2],l=ri.HEAPF32.subarray(o>>2,(o>>2)+s[a]);a++;let h=ri.HEAPU32[n[a]>>2],u=ri.HEAPU32.subarray(h>>2,(h>>2)+s[a]);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,f=l.length;p<f;)c[p++]=i.r,c[p++]=i.g,c[p++]=i.b;return d.setAttribute("color",new Dt(c,3)),d.setIndex(new Wf(u,1)),ri.free_wireframe_data_for_base_level(r),d}t.getAttribute("position").copyArray(l),t.attributes.position.needsUpdate=!0,ri.free_wireframe_data_for_base_level(r)}static updateCollabMesh(e,t,i){let r=t===0;r||ri.set_destination_refinement_level(e,t);let n=i?ri.get_topological_data2(e,r?ri.Level.CONTROL:ri.Level.REFINED,i.elements):ri.get_topological_data(e,r?ri.Level.CONTROL:ri.Level.REFINED),s=ri.HEAPU32.subarray(n>>2,8+(n>>2)),a=s.subarray(3,6),o=0,l=ri.HEAPU32[s[o]>>2],h=new Float32Array(ri.HEAPF32.subarray(l>>2,(l>>2)+a[o]));o++;let u=ri.HEAPU32[s[o]>>2],d=new Uint32Array(ri.HEAPU32.subarray(u>>2,(u>>2)+a[o]));o++;let c,p=ri.HEAPU32[s[o]>>2],f=new Uint8Array(ri.HEAPU32.subarray(p>>2,(p>>2)+a[o]));if(ri.alloc_subdivision_surface_uvs){let m=s[7];if(m>0){let g=ri.HEAPU32[s[6]>>2];c=new Float32Array(ri.HEAPF32.subarray(g>>2,(g>>2)+m))}}return ri.free_topological_data(n),{positions:h,indices:d,verticesPerFace:f,uvs:c}}},$S=new R,k3=new R,V3=new R,G3=new R}),Gwe=U(()=>{Gie(),jie(),JL(),Wie(),r4(),DA(),hre(),ure(),dre(),BH(),fre(),n4(),mre(),gre(),vre(),FH(),yre(),_re(),bre(),xre(),Qg(),_r(),Gie(),jie(),JL(),Wie(),r4(),ABe(),DA(),hre(),ure(),dre(),BH(),fre(),n4(),mre(),gre(),vre(),FH(),yre(),_re(),bre(),xre(),Qg(),CBe(),fwe(),Fwe(),Aw(),RB(),EB(),Ew(),GH={ConeGeometry:Yxe,CubeGeometry:Kxe,CylinderGeometry:qY,DodecahedronGeometry:Zxe,EllipseGeometry:CB,HelixGeometry:Pxe,IcosahedronGeometry:Swe,LatheGeometry:Twe,NonParametricGeometry:Ewe,PolygonGeometry:QY,PyramidGeometry:Awe,RectangleGeometry:PB,SphereGeometry:Rwe,PlaneGeometry:Dwe,BackdropGeometry:Nwe,StarGeometry:JY,TextFrameGeometry:Iwe,TorusGeometry:Owe,TorusKnotGeometry:Lwe,TriangleGeometry:Bwe,VectorGeometry:a0},YI=e=>{let t=GH[e.type]??yxe(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 Fg(e,t,i,r){let n,s,a;e.type==="PathGeometry"?(s={...e,extrusion:{...e.extrusion}},a=[[],["extrusion"]]):(s={...e},a=[[]]);for(let h of a){let u=s;for(let d of h)u=u[d];for(n in u){let d=u[n];XW(d)&&!jwe.includes(n)&&(u[n]=t.getVariable(d,[r.uuid,"geometry",...h,n]),XW(u[n])&&(u[n]=1))}}let o,l={parameters:s,type:s.type};if(s.type==="PathGeometry"){l.path=s.path;let h=r.profileShape;h!==void 0&&(l.shapeData=h),l.ownerId=r.uuid}else if(s.type==="VectorGeometry"){let h=ps.createFromState(s.shape,s.width,s.height);l.shape=h,l.ownerId=r.uuid}else if(s.type==="NonParametricGeometry"){if(s.data.groups&&s.data.groups?.forEach(h=>h.materialIndex=Math.max(h.materialIndex??0,0)),l.geometry=new JX().parse(s),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(s.type==="SubdivGeometry"){let h=new ds(s,i);return h.data=e,h}if(s.type==="TextGeometry"||s.type==="InputGeometry"){let h=yxe(s.type);if(h)return h.create(s,t);Ta("text",`a ${s.type}`);let u=ps.createFromState(sw.defaultData(),100,100);return YI({...s,shape:u,type:"VectorGeometry"})}if(s.type==="UIGeometry")return PB.create({parameters:{width:s.width,height:s.height,cornerRadius:s.cornerRadius,cornerType:s.cornerType}})}try{o=YI(l)}catch(h){console.error(h),console.error(`Error generating geometry with inputs: ${l}`);let u=ps.createFromState(sw.defaultData(),100,100);l.shape=u,l.type="VectorGeometry",o=YI(l)}return o}var jwe,DB=U(()=>{zt(),ae(),Gwe(),_r(),n4(),s0(),Aw(),jwe=["font"]});function jH(e){switch(typeof e){case"number":return Number.isFinite(e)?JSON.stringify(e):void 0;case"boolean":return JSON.stringify(e);case"string":return XW(e)?void 0:JSON.stringify(e);case"object":{if(e===null)return"null";if(Array.isArray(e)){let n="[";for(let s=0;s<e.length;s++){let a=jH(e[s]);if(a===void 0)return;n+=(s>0?",":"")+a}return n+"]"}let t=e,i="{",r=!0;for(let n of Object.keys(t).sort()){if(t[n]===void 0)continue;let s=jH(t[n]);if(s===void 0)return;i+=`${r?"":","}${JSON.stringify(n)}:${s}`,r=!1}return i+"}"}default:return}}var Wwe,Mre,WH,RBe=U(()=>{zt(),Wwe=new Set(["CubeGeometry","SphereGeometry","CylinderGeometry","ConeGeometry","TorusGeometry","TorusKnotGeometry","IcosahedronGeometry","DodecahedronGeometry","PyramidGeometry","PlaneGeometry","BackdropGeometry","HelixGeometry"])}),DBe=U(()=>{DB(),RBe(),Mre=class{constructor(){this.objects=new Map,this.refs=new Map,this.sharedByKey=new WeakSet,this.unreachable=new Set}resolveObject(e,t,i){return this.createObject(e,t,i)}onObjectDisposed(e){}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.resolveObject(e,t,i),this.objects.set(e,r),this.retain(r)):(this.sharedByKey.add(r),r.isShared=!0),r}forceDelete(e){let t=this.objects.get(e);t&&(this.objects.delete(e),this.release(t))}adopt(e,t){this.replace(e,t),this.retain(t)}mutateIfUnique(e,t){let i=this.objects.get(e);if(i&&i.isShared!==!0)return this.objects.delete(e),this.replace(t,i),i}replace(e,t){let i=this.objects.get(e);this.objects.set(e,t),i!==void 0&&i!==t&&this.release(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=>{let t=this.objects.get(e);this.objects.delete(e),this.release(t)}),this.unreachable.clear()}dispose(){new Set(this.objects.values()).forEach(e=>{this.disposeObject(e),this.onObjectDisposed(e)}),this.objects.clear(),this.refs.clear()}retain(e){let t=(this.refs.get(e)??0)+1;this.refs.set(e,t),t>1&&(e.isShared=!0)}release(e){let t=(this.refs.get(e)??1)-1;if(t>0)return this.refs.set(e,t),void(t===1&&!this.sharedByKey.has(e)&&(e.isShared=!1));this.refs.delete(e),this.disposeObject(e),this.onObjectDisposed(e)}},WH=class extends Mre{constructor(e){super(),this.flatShading=e,this.dedupeByValue=!1,this.byValue=new Map,this.valueKeyOf=new Map}disposeObject(e){e.dispose()}createObject(e,t,i){let r=Fg(e,t,this.flatShading,i);return r.computeBoundingSphere(),r}resolveObject(e,t,i){let r=this.dedupeByValue?function(s,a,o){if(!Wwe.has(s.type))return;let l=s;if(l.shapeBlendNode!=null||o.isTransientGeometryKey(s))return;let h=a.material;if(h===void 0||Array.isArray(h))return;let u=h;if(typeof u.getLayersOfType!="function"||u.getLayersOfType("outline").length>0||u.getLayersOfType("cavity").length>0)return;let d=s.type;for(let c of Object.keys(l).sort()){let p=l[c];if(p===void 0||c==="type")continue;let f=jH(p);if(f===void 0)return;d+=`|${c}=${f}`}return d}(e,i,t):void 0;if(r!==void 0){let s=this.byValue.get(r);if(s!==void 0)return s}let n=this.createObject(e,t,i);return r!==void 0&&(this.byValue.set(r,n),this.valueKeyOf.set(n,r)),n}mutateIfUnique(e,t){let i=super.mutateIfUnique(e,t);return i!==void 0&&this.forgetValue(i),i}onObjectDisposed(e){this.forgetValue(e)}forgetValue(e){let t=this.valueKeyOf.get(e);t!==void 0&&(this.valueKeyOf.delete(e),this.byValue.get(t)===e&&this.byValue.delete(t))}}});function s4(){return nC}function Hwe(){if(nC==="webgpu"){if(qH!==void 0)return qH;XH||(XH=!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($H===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 $H}function qwe(e,t){return Hwe().createRootMaterial(e,t)}function Ere(e,t,i){return Hwe().createSharedMaterial(e,t,i)}function Are(e){return e.getLayersOfType===void 0&&Object.assign(e,{layers:[],getLayersOfType:()=>[],hasAO:!1,assetsLoaded:()=>!0}),e}function HH(){return Xwe}var nC,qH,$H,XH,YH,$we,Xwe,KH,Ywe,em=U(()=>{nC="webgl",XH=!1}),NBe=U(()=>{Ywe={markNeedsUpdateRendererDirty:()=>{}}});function Cre(e){return e.data.type!=="displace"&&!!e.data.isMask}function _u(e,t){let i=0;if(!e.layers||e.layers.length===0)return!1;let r=e.layers?.find(s=>s.data.type==="light");if(r){let s=r.data,a=Number(t.getVariable(s.alphaOverride));if((typeof s.alphaOverride=="string"?a/100:s.alphaOverride)<1)return!0}let n=e.layers;for(let s=0;s<n.length;s++){let a=n[s];if(!Cre(a)){if(s>0&&Cre(n[s-1])){if(a.data.type==="light"&&!a.data.visible)return!0;continue}if(a.data.type!=="displace"&&"alpha"in a.data&&a.data.type!=="light"&&a.data.type!=="fresnel"&&a.data.type!=="cavity"&&a.data.type!=="dust"&&a.data.type!=="texture"&&a.data.type!=="matcap"&&a.data.type!=="rainbow"&&a.data.type!=="outline"&&a.data.type!=="pattern"){let o=a.data.visible?a.data.alpha:0;if(typeof o=="string"&&(o=Math.max(0,Math.min(1,Number(t.getVariable(o)??100)/100))),o===1&&a.data.type==="depth"||a.data.type==="gradient"){for(let l of a.data.colors)if(l[3]<1){o=l[3];break}}else if(o===1&&a.data.type==="noise"){let l=t.color(a.data.colorA).a,h=t.color(a.data.colorB).a,u=t.color(a.data.colorC).a,d=t.color(a.data.colorD).a,c=Math.min(l,Math.min(h,Math.min(u,d)));c<1&&(o=c)}i+=(1-i)*o}}}return i<1}var sC=U(()=>{});function Kwe(e,t){return e==="displace"?t==="intensity":t==="alpha"}function Zwe(e,t,i){let r=e==="alpha"?Math.max(0,Math.min(Number(t)/100,1)):Number(t);return i?r:0}function $f(e){return typeof e=="string"||typeof e=="number"&&e!==0}var Lh,Ot,Xc,Td,Cw,iK,Pre,Rre,Zo,Ad=U(()=>{ae(),Lh=(e,t,i)=>Math.max(0,Math.min(1,Number(t.getVariable(typeof e=="number"?100*e:e,i)??100)/100))??1,Ot=(e,t,i)=>typeof e=="number"?e:t.getVariable(e,i),Xc=(e,t)=>(e||(e=new R),e.x=Ot(e.x,t)??0,e.y=Ot(e.y,t)??0,e.z=Ot(e.z,t)??0,e),Td=(e,t)=>(e||(e=new Z),e.x=Ot(e.x,t)??0,e.y=Ot(e.y,t)??0,e),Cw={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"]},iK={depth:["colors"],gradient:["colors","steps"],toon:["colors","steps"]}}),Pw=U(()=>{ae(),Mw(),Zn(),Pre=class extends SB(hn){},Rre=e=>e.type==="Mesh",Zo=class extends Pre{constructor(e){super(),this.object=e,this.isClone=!0,this.matrixAutoUpdate=!1}raycast(e,t){}expand(){let e=0,t=this.object.entityChildren(e);for(;t;){let i=this.children[e];(!(i instanceof Zo)||i.object!==t)&&(i=new Zo(t),this._replaceChildAt(e,i),i.matrixWorldNeedsUpdate=!0,i.matrixAutoUpdate=!1,i.matrix=t.matrix,i.shearMatrix=t.shearMatrix,i.pivotMatrix=t.pivotMatrix),i.expand(),e+=1,t=this.object.entityChildren(e)}for(let i of this.object.children){if(!Lg(i)||i.object.parent!==this.object)continue;let r=this.children[e];r?.source!==i&&(r=i.createCopy(),this._replaceChildAt(e,r)),r.expand(),e+=1}for(;this.children.length>e;)this.remove(this.children[e]);this.pivotMatrix=this.object.pivotMatrix}_replaceChildAt(e,t){let i=this.children[e];i&&this.remove(i),this.add(t),this.children.splice(e,0,this.children.pop())}get visible(){let e=this.parent,t=Lg(e)&&e.object===this.object;return(!t||!e.instancingActive&&!e.insideBoolean)&&(this.playModeVisible!==void 0?this.playModeVisible:this.object.visible||t&&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 Rre(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 Dre(){return rK}var rK,nK,sK=U(()=>{rK=null,nK=null});function ZH(e){return"variable_"+e}var W5,H5,q5,Nre,$5,Ire,X5,Ore,a4,aK=U(()=>{zt(),kxe(),Hxe(),AB(),Su(),jY(),HY(),DBe(),em(),Gxe(),NBe(),sC(),Ad(),wl(),Pw(),Or(),ae(),sK(),_r(),W5=new Ue,H5=new R,q5=new jt,Nre=new R,$5=new Dr,Ire=class extends Fxe{constructor(e){super(),this.shared=e}create(e){return new GY(e,this.shared)}},X5=new Set,(a4=Ore=class{constructor(e,t={},i=!0,r=!1){if(this.data=e,this.needsJitter=i,this.enableLocalStorageForPersistentVariables=r,this.geometryCache=new WH(!0),this.geometryCache2=new WH(!1),this.imageHolderCache=new Ire(this),this.thisContext={scene:Ywe,shared:this},this.deletedImage=new Nc(BL.emptyImage,this),this.deletedVideo=new Nc(FL.defaultVideo,this),this.materials={},this.images={},this.uiBuffers={},this.videos={},this.colors={},this.audios={},this.particles={},this.fonts={},this.variables={},this.userAPIs={},this.userWebhooks={},this.mouseProperty=null,this.raycastProperty=null,this.requestRender=()=>{this._requestRender&&this._requestRender()},this.transientGeometryKeys=new WeakSet,t.images)for(let[n,s]of Object.entries(t.images))this.addImage(n,s);if(t.videos)for(let[n,s]of Object.entries(t.videos))this.addVideo(n,s);if(t.audios)for(let[n,s]of Object.entries(t.audios))this.addAudio(n,s);if(t.particles)for(let[n,s]of Object.entries(t.particles))this.addParticle(n,s);this.reset(e)}get deletedMaterial(){return this._deletedMaterial??(this._deletedMaterial=Ere(Kn.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)}addMaterial(e,t){if(t=Kn.withRepairedLayers(t),this.materials[e]){let i=this.materials[e];i.reset(t,this.thisContext),i.dispose()}else{let i=Ere(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):qwe(Kn.withRepairedLayers(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]}getEntityTexture(e,t={}){let i=e.material;if(!i)return null;for(let r of Array.isArray(i)?i:[i]){let n=r.root??r;for(let s of n?.data?.layers??[]){let a=s?.data;if(a?.type!=="texture"&&a?.type!=="matcap"||t.layer!==void 0&&s.id!==t.layer&&a.type!==t.layer)continue;let o=a.texture?.image;if(o==null)continue;let l=(typeof o=="string"?this.uiBuffer(o):void 0)??this.image(o);if(!l)continue;let h=l.getTexture(a.texture.wrapping??(a.type==="texture"?1e3:1001),a.texture.minFilter??1008,a.texture.magFilter??1006),u=l.img;return{texture:h,width:u?.width??0,height:u?.height??0,layerId:s.id,layerType:a.type}}}return null}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 OA(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 kr(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 kr(0,0,0,0))}return t}addAudio(e,t){this.audios[e]=t}getAudio(e){let t=this.audios[e];if(t instanceof sx)return t;{let i=new sx({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 sx&&t.dispose(),delete this.audios[e])}addFont(e,t){let i=WY;i!==null?(this.fonts[e]=new i(t),this.fonts[e].loadingPromise.then(()=>this.requestRender())):Ta("text","a font asset")}getFont(e){return this.fonts[e]}deleteFont(e){this.fonts[e]&&delete this.fonts[e]}dispose(){Object.keys(this.materials).forEach(e=>this.deleteMaterial(e)),this._requestRender=void 0,Object.values(this.audios).forEach(e=>{e instanceof sx&&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(ZH(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(ZH(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 s=this.variables[e].locations.length-1;s>=0;s--){let a=this.variables[e].locations[s];if(a[0]==="material"){let o=a[1],l=i,h={scene:r,shared:this},u=a.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(a[0]);if(o===void 0){this.variables[e].locations.splice(s,1);continue}if(n=!0,a[1]!=="geometry"&&a[1]!=="particles"){for(let l=1;l<a.length-1;l++)o=o[a[l]];a[1]==="rotation"?o[a[a.length-1]]=i*et.DEG2RAD:o[a[a.length-1]]=i}if(o=r.find(a[0]),o.type==="ParticleEmitter"&&o.updateVariableState(i,a),nr.is(o))if(a[1]==="position"||a[1]==="rotation"||a[1]==="scale")o.onVariableUpdate();else if(a[1]==="geometry"){let l=o;o.component&&(l=o.component);let 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 a[1]==="morphTargetInfluences"&&o.updateMorphInfluences(a[2],i)}}return n&&r.markShadowsDirty(),this.requestRender(),!0}isTransientGeometryKey(e){return this.transientGeometryKeys.has(e)}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 s=h=>h.toLowerCase().replace(/[\s_.-]+/g,""),a=new Map;for(let h of Object.keys(n))a.set(s(h),h);let o={};for(let[h,u]of Object.entries(t??{})){let d=a.get(s(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 s=t?.vertices;if(s===void 0||typeof s.length!="number"||s.length<9||s.length%3!=0||s.length/3>Ore.MAX_TRANSIENT_VERTICES)return!1;let a,o,l,h=s instanceof Float32Array?s:Float32Array.from(s),u=h.length/3;if(t.normals!==void 0){if(t.normals.length!==h.length)return!1;a=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){let S=(x?.attributes?.position?.array?.length??0)/3;if(u!==S)return function(T,M){let E=`${T}/${M}`;X5.has(E)||(X5.add(E),console.warn(`[spline] updateObject: ignoring a geometry update of ${T} vertices for a mesh that holds ${M}. Without \`indices\` the write is taken as a morph of the mesh's own vertices, which only means anything at the same count \u2014 send \`indices\` alongside \`vertices\` to replace the topology too.`))}(u,S),!1;l=w}}let d=1/0,c=1/0,p=1/0,f=-1/0,m=-1/0,g=-1/0;for(let x=0;x<h.length;x+=3){let w=h[x],S=h[x+1],T=h[x+2];w<d&&(d=w),w>f&&(f=w),S<c&&(c=S),S>m&&(m=S),T<p&&(p=T),T>g&&(g=T)}let v=(x,w)=>({array:x,itemSize:w,type:"Float32Array",normalized:!1}),y={position:v(h,3)};a&&(y.normal=v(a,3)),o&&(y.uv=v(o,2));let _={...n,width:f-d,height:m-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,s=Math.PI/180,a=!1;if(t===null)for(let o of n)o.transformOverride!==void 0&&(o.transformOverride=void 0,a=!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,a=!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*s),typeof h.rotation.y=="number"&&(d.rotation[1]=h.rotation.y*s),typeof h.rotation.z=="number"&&(d.rotation[2]=h.rotation.z*s)),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 a?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 Zo(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.shearMatrix.copy(e.shearMatrix),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},s=h=>h.toLowerCase().replace(/[\s_.-]+/g,""),a=h=>{if(typeof h=="string"){let u=new kr(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 OA?h.setValue(u,new kr(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=a(t.color),p=u.find(m=>m.data.type==="color"),f=p&&d(p.id);if(c&&f&&o(f,"color",c)&&(l=!0,c.a!==void 0)){let m=c.a<1||_u(h.data,this);h.setTransparent?h.setTransparent(m,n.scene):h.transparent=m}}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,f=p&&d(p.id);if(!p||!f)continue;let m=Cw[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=>s(x)===s(v))??v;if(m.includes(_))continue;let b=a(y);if(b&&o(f,_,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]}referencesMissingObject(e){return Array.isArray(e)&&e[0]!=="mouse"&&e[0]!=="raycast"&&this.entityOpContext.scene.find(e[0])===void 0}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(i===void 0)return;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?.(W5))return W5.decompose(H5,q5,Nre),e[1]==="position"?H5[e[2]]:($5.setFromQuaternion(q5,i.rotation.order),$5[e[2]]*et.RAD2DEG);for(let r=1;r<e.length;r++)i=i[e[r]];return e[1]==="rotation"&&(i*=et.RAD2DEG),i}for(let i in this.variables){if(t===void 0)break;let r=this.variables[i],n=r.locations?.findIndex(s=>Sa.equal(s,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($a.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,s=this.getUserAPI(e.path[1]);s!==void 0&&s===this.openAIRealtime?s.update(r):s?.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($a.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=nK;return i===null?(Ta("ai-assistant","a voice-assistant integration"),!1):(this.openAIRealtime=i(t,e,this),!1)}{let i=Dre();return i===null?(Ta("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=Dre();return i===null?(Ta("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 a4(gu.emptyData())});function o4(e){return Ixe(e)||e?.isTSLNodeMaterial===!0}var xl,Y5,K5,Z5,Lre,Q5,dp,Bre,Fre,XS,zn,oK=U(()=>{zxe()}),f1=U(()=>{zt(),Na(),em(),oK(),Or(),la(),xl=class extends Es{setMaterialOverride(e,t){this.materialOverride=Are(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),Jr(e.path,["geometry"])&&this.syncShadowCatcher(i),function(r,n){let s=[];if(n.length!==r.length)return null;{let a=0;for(;a<r.length;){if(n[a]==="*")s.push(r[a]);else if(r[a]!==n[a])return null;a+=1}}return s}(e.path,["materials"])!==null&&e.type===0&&Array.isArray(this.material))for(let[r,n]of Object.entries(e.props)){let s=this.material[Number(r)],a=i.shared.material(n);a!==s&&xl.disposeOneMaterial(s),this.material[Number(r)]=a}else if(Jr(e.path,["material"])){let r=this.material;!Array.isArray(r)&&typeof r?.updateByOp=="function"&&"material"in t&&typeof t.material!="string"&&r.updateByOp($a.drop(e,1),t.material,i)}else if(Jr(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($a.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(a=>t.shared.material(a).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 s=this.data;if(!n&&s.geometry?.type!=="NonParametricGeometry"&&"materials"in s&&s.materials!==void 0&&(this.disposeMaterial(),this.material=t.shared.material(s.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 a=0;a<this.material.length;a++)this.material[a]=this.material[a].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=nC==="webgpu"&&YH!==void 0?YH:$we;return r===void 0?null:Are(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;o4(e)&&!function(i){return i?.isClassicSharedMaterial===!0}(t=e)&&t?.isTSLSharedMaterial!==!0&&e.nodeMaterialDispose()}disposeMaterial(){this.material&&G_e(this.material).forEach(e=>{xl.disposeOneMaterial(e)})}dispose(){this.disposeMaterial(),this.shadowCatcherMaterial?.dispose(),super.dispose()}}}),Sl=U(()=>{zt(),Or(),aK(),f1(),ae(),DB(),Ew(),Aw(),kwe(),Y5=new R,K5=new ct,Z5=new ct,Lre=new R,Q5=new Ue,dp=new Tr,Bre=dp.geometry,Fre=dp.material,XS=new R,zn=class extends xl{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 Ue().fromArray(t.bindMatrix),this.bindMatrixInverse=new Ue)}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 a4){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 kL.is2DParametricMesh(e.type)&&e.depth===0}get is2DType(){return kL.is2DParametricMesh(this.geometry.userData.type)}get isTextType(){return this.geometry.isTextGeometry===!0}get isNonParametric(){return this.geometry.userData.type==="NonParametricGeometry"}updateByPatchedOp(e,t,i){super.updateByPatchedOp(e,t,i),Jr(e.path,["geometry"])&&this.updateByPatchedOpGeometry($a.drop(e,1),t.geometry,i)}removeInteractionGeometry(e){this.localGeometry?.dispose(),this.localGeometry=void 0}dispose(){var e;super.dispose(),e=this.uuid,i4.delete(e),this._posed=void 0}get appliedGeometrySize(){let e=this.localGeometry?.userData;if(e!==void 0&&e.sxPrev!==void 0)return[e.sxPrev,e.syPrev,e.szPrev]}updateGeometryInteractions(e,t){this.invalidateDownstreamBooleanData();let i=this.data.geometry.type;if(i==="NonParametricGeometry"||i==="SubdivGeometry"){let r,n,s,a=e;if(this.localGeometry===void 0){let d={...this.data.geometry,...a};this.localGeometry=Fg(d,t,this.data.flatShading,this)}a.scaleBaked?[r,n,s]=a.scaleBaked:{width:r,height:n,depth:s}=a;let o=this.localGeometry.userData,l=typeof r=="number"?r:1,h=typeof n=="number"?n:1,u=typeof s=="number"?s:1;o.sxPrev!==void 0&&kH(this.localGeometry.attributes,l/o.sxPrev,h/o.syPrev,u/o.szPrev),o.sxPrev=l,o.syPrev=h,o.szPrev=u}else if(!this.absorbDepthInteraction(e)){let r=Fg(i==="VectorGeometry"?VL.merge(this.data.geometry,e):{...this.data.geometry,...e},t,this.data.flatShading,this);this.localGeometry!==void 0&&this.supportsInPlaceGeometryUpdate(this.localGeometry)&&z5(this.localGeometry,r)?r.dispose():(this.localGeometry?.dispose(),this.localGeometry=r)}}absorbDepthInteraction(e){let t=this.localGeometry;if(t?.shiftDepthTo===void 0)return!1;let i=e;if(typeof i.depth!="number")return!1;let r=t.userData?.parameters;if(r===void 0)return!1;for(let n of Object.keys(i))if(n!=="depth"&&i[n]!==r[n])return!1;return!!t.shiftDepthTo(i.depth)&&(r.depth=i.depth,!0)}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 ds&&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&&Vwe(e.props)&&this.geometryCreateDeleyed instanceof ds&&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 ds)&&this.supportsInPlaceGeometryUpdate(this.geometryCreateDeleyed)&&this._geometryCacheKey!==void 0){let n=i.shared,s=this.chooseGeoemtryCache(n),a=this.geometryCreateDeleyed;if(s.getCached(this._geometryCacheKey)===a&&a.isShared!==!0){let o=this.dataPatched.geometry,l=Fg(o,n,this.data.flatShading,this);z5(a,l)?(l.dispose(),a.computeBoundingSphere(),s.mutateIfUnique(this._geometryCacheKey,o)):(l.computeBoundingSphere(),s.forceDelete(this._geometryCacheKey),s.adopt(o,l),this.geometryCreateDeleyed=l),this._geometryCacheKey=o,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 ds)&&this.supportsInPlaceGeometryUpdate(this.geometryCreateDeleyed)&&this._geometryCacheKey!==void 0){let n=this.chooseGeoemtryCache(i),s=this.geometryCreateDeleyed;if(n.getCached(this._geometryCacheKey)===s&&s.isShared!==!0){let a=Fg(r,i,this.data.flatShading,this);return z5(s,a)?(a.dispose(),s.computeBoundingSphere(),n.mutateIfUnique(this._geometryCacheKey,r)):(a.computeBoundingSphere(),n.forceDelete(this._geometryCacheKey),n.adopt(r,a),this.geometryCreateDeleyed=a),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.posedGeometry()?.boundingBox;if(i)return i.getCenter(e),void i.getSize(t).multiplyScalar(.5);let r=this.geometry.userData.parameters;this.is2DType||this.isTextType?e.set(0,0,.5*r.depth):this.isNonParametric?(e.setScalar(0),this.geometry.boundingSphere&&e.copy(this.geometry.boundingSphere.center),t.set(r.width,r.height,r.depth??0).multiplyScalar(.5)):r.centerOffset?e.fromArray(r.centerOffset):e.setScalar(0),t.set(r.width,r.height,r.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 ct,i=this.geometry.attributes.skinWeight;for(let r=0,n=i.count;r<n;r++){t.fromBufferAttribute(i,r);let s=1/t.manhattanLength();s!==1/0?t.multiplyScalar(s):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;K5.fromBufferAttribute(r.attributes.skinIndex,e),Z5.fromBufferAttribute(r.attributes.skinWeight,e),Y5.copy(t).applyMatrix4(this.bindMatrix),t.set(0,0,0);for(let n=0;n<4;n++){let s=Z5.getComponent(n);if(s!==0){let a=K5.getComponent(n);Q5.multiplyMatrices(i.bones[a].matrixWorld,i.boneInverses[a]),t.addScaledVector(Lre.copy(Y5).applyMatrix4(Q5),s)}}return t.applyMatrix4(this.bindMatrixInverse)}raycastDeformed(e,t){let i=this.posedGeometry();if(i===void 0)return!1;dp.geometry=i,dp.material=this.material,dp.matrixWorld.copy(this.matrixWorld);let r=t.length;dp.raycast(e,t);for(let n=r;n<t.length;n++)t[n].object=this;return dp.geometry=Bre,dp.material=Fre,!0}posedGeometry(){let e=this.skeleton;if(!this.isSkinnedMesh||e===void 0)return;let t=this.geometry,{position:i,skinIndex:r,skinWeight:n}=t.attributes;if(!i||!r||!n)return;let s=[...this.bindMatrix.elements,...this.bindMatrixInverse.elements,...this.morphTargetInfluences??[]];for(let d=0;d<e.bones.length;d++){let c=e.bones[d];if(!c||!e.boneInverses[d])return;s.push(...c.matrixWorld.elements)}let a=this._posed;if(a?.source===t&&a.version===i.version&&a.pose.length===s.length&&a.pose.every((d,c)=>d===s[c]))return a.geometry;let o=i.count,l=a?.geometry.attributes.position,h=l?.count===o?l:new Dt(new Float32Array(3*o),3);for(let d=0;d<o;d++)this.boneTransform(d,this.getVertexPosition(d,XS)),h.setXYZ(d,XS.x,XS.y,XS.z);let u=new At;u.setAttribute("position",h);for(let d of["normal","uv","uv1"]){let c=t.attributes[d];c&&u.setAttribute(d,c)}return u.setIndex(t.index),u.groups=t.groups,u.drawRange=t.drawRange,u.computeBoundingSphere(),u.computeBoundingBox(),this._posed={source:t,version:i.version,pose:s,geometry:u},u}}});function Rx(e){if(Array.isArray(e.material)){for(let t of e.material)if(t.getLayersOfType("outline").length===0)return}else if(!Ixe(e.material)||e.material.getLayersOfType("outline").length===0)return;e instanceof zn&&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 R;for(let s=0;s<i.length;s+=3)n.set(i[s],i[s+1],i[s+2]).normalize(),r[s]=n.x,r[s+1]=n.y,r[s+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,s=r.normal.array,a=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 R(s[o],s[o+1],s[o+2]);i.has(l)?i.get(l)?.normals.push(h):i.set(l,{normals:[h],result:new R})}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&&(a[o]=h.x,a[o+1]=h.y,a[o+2]=h.z)}t.geometry.setAttribute("extrudeNormal",new Et(a,3))}(e)}function J5(e){return Math.min(2047,Math.max(1,Math.round(2048*e)))/2048}function Dx(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),s=parseInt(e.uuid.replace(/\D/g,"")),a=[J5(et.seededRandom(s)),J5(et.seededRandom(s+1e4)),J5(et.seededRandom(s+2e4))];for(let o=0;o<i.length;o++)n[o]=a[o%3];e.geometry.setAttribute("randomColor",new Dt(n,3))}var NB=U(()=>{ae(),zxe(),Sl()});function Ure(e){let t=!1;return e.scene.objects.traverse((i,r)=>{r.geometry?.type==="BooleanGeometry"&&(t=!0)}),t}function IBe(e,t){let i=e.cloner;return i!==void 0&&i.parent===t?i:void 0}function zre(e,t,i,r){let n=16*(t.children.length+1);HM.length<n&&(HM=new Float32Array(n));let s=0,a=l=>{l.toArray(HM,16*s),s++},o=t.parameters.hideBase!==!0;o&&a(r),QH.copy(e.matrix);for(let l of t.children)!Bg(l)||l.playModeVisible===!1||(JH.copy(l.matrix).multiply(l.pivotMatrix),KI.multiplyMatrices(QH,JH),(!o||!KI.equals(r))&&a(KI));try{return s===0?0:function(l,h){return kY(ZL().instanced_union(zY(l),h))}(i,HM.subarray(0,16*s))}finally{Rxe(i)}}var cp,kre,QH,JH,KI,HM,qg,aC=U(()=>{Na(),ae(),EB(),NB(),f1(),Zn(),cp=new Ue,kre=new Ue,QH=new Ue,JH=new Ue,KI=new Ue,HM=new Float32Array(0),qg=class extends xl{constructor(e,t,i){super(e,t),this.data=t,this.meshSetAddresses=[],this.needsTransformForDownstream=!1,this.geometry=new At,this.onAfterRender=(r,n,s,a,o,l)=>{super.onAfterRender(r,n,s,a,o,l),this.recomputeBoolean()},this.geometry.userData.parameters={width:0,height:0,depth:0}}get booleanOp(){return this.data.geometry.operation}get phongAngle(){return this.data.geometry.phongAngle??45}get isLOD(){return this.recomputeBoolean(),!1}updateByPatchedOp(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 qg&&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 Es&&n.dataPatched.visible===!0&&n.geometry.attributes.position?.count>0&&n.geometry.drawRange.count>0&&n.booleanMeshSetAddress!==0){cp.copy(n.matrix).multiply(n.pivotMatrix);try{let s=IBe(n,this);if(n.booleanMeshSetAddress===-1){if((n.geometry.index??n.geometry.getAttribute("position")).count/3<15e5){let a=iBe(n.geometry,e===!0);n.booleanMeshSetAddress=s===void 0||a===-1?a:zre(n,s,a,cp)}if(n.booleanMeshSetAddress===-1)return;s===void 0&&P5(n.booleanMeshSetAddress,cp),n.booleanMatrixInvOld.copy(cp).invert(),n.booleanWasTransformed=!1}else n instanceof qg&&n.needsTransformForDownstream===!0?(s===void 0?P5(n.booleanMeshSetAddress,cp):n.booleanMeshSetAddress=zre(n,s,n.booleanMeshSetAddress,cp),n.needsTransformForDownstream=!1):n.booleanWasTransformed===!0&&(P5(n.booleanMeshSetAddress,kre.multiplyMatrices(cp,n.booleanMatrixInvOld)),n.booleanMatrixInvOld.copy(cp).invert(),n.booleanWasTransformed=!1)}catch(s){console.error(s),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 s=ZL(),a=Rie(r,n),o=s.mesh_topological_data(a),l=o.positions(),h=o.indices();return o.free(),a.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,s,a){let o=ZL(),l=Rie(r,n),h=o.mesh_render_data(l,Math.max(a,0));if(s.setAttribute("position",new Et(h.positions(),3)),s.setAttribute("normal",new Et(h.normals(),3)),h.free(),s.boundingSphere===null&&(s.boundingSphere=new Ha),l.tri_count()===0)s.boundingSphere.center.set(0,0,0),s.boundingSphere.radius=0,s.userData.parameters={width:0,height:0,depth:0};else{let u=l.bounds();s.boundingSphere.center.set(u[0],u[1],u[2]),s.boundingSphere.radius=(u[3]**2+u[4]**2+u[5]**2)**.5,s.userData.parameters={width:2*u[3],height:2*u[4],depth:2*u[5]}}return kY(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,Rx(this),Dx(this)}dispose(){super.dispose(),this.geometry.dispose()}}});function OBe(e){return e.isPointLight?ZI.PointLight:e.isSpotLight?ZI.SpotLight:ZI.DirectionalLight}function Vre(e){return e.isDirectionalLight?0:e.isSpotLight?1:2}function Qwe(e){Vv.length=0,e.traverseVisible(r=>{(function(n){let s=n;return s.isPointLight===!0||s.isSpotLight===!0||s.isDirectionalLight===!0})(r)&&(r.castShadow===!0||kE.has(r))&&Vv.push(r)});let t=!1;if(Vv.length===0)return t;Vv.sort((r,n)=>Vre(r)-Vre(n)||r.id-n.id);let i=12;for(let r of Vv){let n=OBe(r);n<=i?(i-=n,kE.delete(r)&&(r.castShadow=!0,t=!0)):r.castShadow===!0&&(r.castShadow=!1,kE.add(r))}return Vv.length=0,t}var ZI,kE,Vv,l4,IB,yd,zc,h4,lK=U(()=>{ZI={PointLight:1,SpotLight:3,DirectionalLight:3},kE=new WeakSet,Vv=[]}),oC=U(()=>{ae(),lK(),wl(),p1(),(l4||(l4={})).is=function(e){return nr.is(e)&&e instanceof Xp},IB=(e,t)=>class extends c1(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&&(function(n){kE.delete(n)}(this),this.castShadow=i.shadows)}}}),o0=U(()=>{aC(),Na(),p1(),yd=e=>e instanceof Es,zc=e=>e!==null&&e instanceof qg,h4=e=>wH.is(e)});function go(e,t){return t.color(e)}function Gre(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),f=m=>Number(p.find(g=>g.type===m)?.value);return new Date(f("year"),f("month")-1,f("day"),f("hour"),f("minute"),f("second"),d.getMilliseconds())}catch{return new Date(NaN)}}(new Date,t.timeZone));let s,a=n.getHours(),o=n.getMinutes();t.format12h24h==="12ampm"&&(s=a>=12?"PM":"AM");let l,h,u=a;switch(t.format12h24h!=="24"&&(u=a%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],s=void 0;break;case"mm":l=[o],s=void 0;break;case"ss":l=[r],s=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*a*60+60*o+r;break;default:console.error("Unknown time format",i),h=0}return l!==void 0?{textValue:l,suffix:s}:h}var eq,Rw,hK=U(()=>{}),LBe=U(()=>{ae(),eC(),tC(),eq=class extends ww(h_e){constructor(e,t=15,i=10066329){super(e,t,i),this.object=e,this.added=!1,this.name=`DirectionalLightHelper: ${e.uuid}`}raycast(e,t){Sw(this.object,eq.geometryHelper,e,t)}}}),OB=U(()=>{ae(),LBe(),oC(),Rw=class extends IB(_A,eq){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 bA(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 bA&&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 uK(e){return e instanceof xl&&e.needsAO&&!Zf(e)&&e.isDecalObject!==!0}function dK(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 cK(e){return e.getLayersOfType("reflection").filter(t=>t.data.visible).length}function BBe(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 s=typeof n.blur=="number"?n.blur:null;t=Math.min(t,s??0),i=Math.max(i,s??10)}return t===1/0?null:{min:t,max:i}}function FBe(e){for(let t of e.getLayersOfType("reflection")){let i=t.data;if(!i.visible)continue;let{blur:r,thickness:n,steps:s,stepSize:a}=i;return typeof r!="number"||typeof n!="number"||typeof s!="number"||typeof a!="number"?"variable":{blur:r,thickness:n,steps:s,stepSize:a,tracingMode:i.tracingMode===1?1:0}}return null}function jre(e,t){let i={outline:!1,cavity:!1},r=e.layers.mask&LB,n=t.getLayersOfType("transmission"),s=t.getLayersOfType("outline"),a=cK(t),o=t.getLayersOfType("cavity");return(s.length>0||o.length>0)&&(e.layers.set(8),n.length>0&&e.layers.enable(3),a>0&&e.layers.enable(4),i.outline=s.length>0,i.cavity=o.length>0,Dx(e),Rx(e)),n.length===0&&s.length===0&&o.length===0&&a===0&&e.layers.set(0),r&&e.layers.set(9),!r&&uK(e)&&e.layers.enable(5),dK(e),i}function Wre(e,t){if(!t.layers)return!1;let i=e.layers.mask&LB,r=!1,n=t.getLayersOfType("transmission").filter(l=>l.data.visible),s=t.getLayersOfType("outline").filter(l=>l.data.visible),a=cK(t),o=t.getLayersOfType("cavity").filter(l=>l.data.visible);return n.length>0&&(e.layers.set(3),(s.length>0||o.length>0)&&e.layers.enable(8),a>0&&e.layers.enable(4),r=!0),n.length===0&&s.length===0&&o.length===0&&a===0&&e.layers.set(0),i&&e.layers.set(9),!i&&uK(e)&&e.layers.enable(5),dK(e),r}function Hre(e,t){var i;if(!t.layers)return!1;let r=e.layers.mask&LB,n=!1,s=cK(t),a=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 s>0&&((i=e.userData).__splinePlanarMirror??(i.__splinePlanarMirror=0),e.layers.set(4),a.length>0&&e.layers.enable(3),(o.length>0||l.length>0)&&e.layers.enable(8),n=!0),s===0&&a.length===0&&o.length===0&&l.length===0&&e.layers.set(0),r&&e.layers.set(9),!r&&uK(e)&&e.layers.enable(5),dK(e),n}function tq(e,t,i,r=!1){let n=e.cloner;if(n){let s=null;if((e.raycast===Tr.prototype.raycast||e.raycast===Es.prototype.raycast)&&e.isSkinnedMesh!==!0){let a=e.geometry;a&&(a.boundingSphere===null&&a.computeBoundingSphere(),s=a.boundingSphere)}for(let a of n.children){if(s!==null&&(iq.copy(s).applyMatrix4(a.matrixWorld),!t.ray.intersectsSphere(iq)))continue;let o=eSe.copy(a.matrixWorld).invert(),l=tSe.copy(t.ray).applyMatrix4(o),h=e.matrixWorld;l.applyMatrix4(h);let u=Jwe;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?a:e})}}}var LB,Jwe,eSe,tSe,iq,j3,iSe,ez,tz,iz,Dw,Dn,pK=U(()=>{Zn(),NB(),Na(),f1(),ae(),LB=512,Jwe=new hB,eSe=new Ue,tSe=new xf,iq=new Ha}),UBe=U(()=>{ae(),eC(),tC(),j3=class extends ww(o_e){constructor(e,t=6710886){super(e,t),this.object=e,this.matrix=e.matrixWorld,this.name=`SpotLightHelper: ${e.uuid}`}raycast(e,t){Sw(this.object,j3.geometryHelper,e,t)}update(){if(this.object!==void 0){let e=j3._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,s=this.cone.material.length;n<s;n++)this.cone.material[n].color.set(r);else this.cone.material.color.set(r)}}},(iSe=j3)._vector=new R}),BB=U(()=>{ae(),UBe(),oC(),ez=new R,tz=new R,iz=new jt,Dw=class extends IB(vy,iSe){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*et.RAD2DEG*this.angle,r.aspect=1,r.near=100,r.far=2500;let n=new bA(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 bA&&t.update()}}updateMatrixWorld(e){super.updateMatrixWorld(e),tz.setFromMatrixPosition(this.matrixWorld),iz.setFromRotationMatrix(this.matrixWorld),ez.copy(this.up).applyQuaternion(iz).negate().multiplyScalar(this.distance),this.target.position.copy(tz).add(ez),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))}}}),Tu=U(()=>{zt(),Oh(),ae(),wl(),Su(),hK(),Pd(),OB(),Or(),em(),ae(),f1(),o0(),pK(),BB(),_r(),aC(),Dn=class extends TB(Ko){constructor(e,t,i){if(super(),this.data=t,this.bgColor=new kr(1,1,1,1),this.fog=null,this.backupFog=new K7(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 lt,this.penumbraSizeArrayCache=null,this.super_Entity(e,t),this.personalCamera=new Qn(d1,{...IE.defaultData,...t.camera,name:"Personal Camera"}),this.personalCamera.objectHelper.visible=!1,this.add(this.personalCamera),this.activeCamera=this.personalCamera,this.ambientLight=new lB(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=gH();r===null?Ta("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=gH();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()})):Ta("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=go(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 qg&&t.recomputeBoolean()}),this.updateShadow(this.data.shadow)}forceMaterialsUpdate(){this.traverseEntity(e=>{if(e instanceof xl)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,KH!==void 0&&KH(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=go(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=go(e.aoColor,t))}updateByOp(e,t,i,r){let n=this.data.uiFrame;super.updateByOp(e,t,i,r);let s=t;Jr(e.path,["fog"])?this.updateFog(s.fog,i.shared):Jr(e.path,["sky"])?this.updateSky(s.sky,i.shared):Jr(e.path,["grading"])?this.gradingState=s.grading??null:Jr(e.path,["ao"])?this.updateAo(s.ao,i.shared):Jr(e.path,["ambient"])?this.updateAmbientLight(s.ambient,i.shared):Jr(e.path,["shadow"])?this.updateShadow(s.shadow):e.type===0&&e.path.length===0&&(e.props.uiFrame!==void 0||n!==s.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(go(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 instanceof Qn&&e.isDescendantOf(this)&&(this.activeCamera!==this.personalCamera&&(this.activeCamera.objectHelper.visible=!0),this.activeCamera=e,e.objectHelper.visible=!1)}get playCamera(){let e=this.scene?.find(this.data.publish.playCamera);return e instanceof Qn?e:this.personalCamera}switchToPlayCamera(){this.switchActiveCamera(this.playCamera)}get penumbraSizeArray(){return this.penumbraSizeArrayCache===null&&this.updatePenumbraSizeArray(),this.penumbraSizeArrayCache}updatePenumbraSizeArray(){this.penumbraSizeArrayCache=new Array(Kf).fill(.5);let e=0,t=0;this.traverseEntity(i=>{if(!i.visible)return!0;i instanceof Rw&&i.visible&&e<LE&&(this.penumbraSizeArrayCache[e]=i.data.penumbraSize??.5,e+=1),i instanceof Dw&&i.visible&&e<Kf-LE&&(this.penumbraSizeArrayCache[LE+t]=i.data.penumbraSize??.5,t+=1)})}raycastWithClones(e){let t=[],i=r=>{for(let n of r.children){let s=n.cloner;nr.is(n)&&(n.visible||s?.object.data.visible)&&((yd(n)||h4(n)&&this.scene.enableHelpers&&n.objectHelper.visible)&&(e.intersectObject(n,!1,t),tq(n,e,t,!0)),i(n))}};return i(this),t}updateEntity2DByOp(e,t,i,r){this.uiCanvas?.updateEntity2DByOp(e,t,i,r)}}});function qre(){return fK}function rz(){if(u4===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 u4}function nz(e){return e?.isWebGPUSplineRenderer===!0}var fK,u4,mK=U(()=>{fK=null,u4=null});function rq(){return vK}var gK,vK,yK=U(()=>{gK=null,vK=null});function $re(e,t,i){return qM.setRGB(e,t,i,Xi),{r:qM.r,g:qM.g,b:qM.b}}function zBe(e,t,i){let r,n=BA(e.angle,0),[s,a]=nq(e.offset),[o,l]=nq(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+s)-1,v=3*(i+l)-(i+a)-1;r=Math.hypot(g,v)+n}else if(e.gradientType===2){let g=-1*Math.atan2(t+o-.5+s,i+l-.5+a),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+s)/2+y/2)*y+((i-.5+a)/2+_/2)*_)/b:0}let c=h[0][0],p=h[0][1],f=h[0][2],m=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)*_,f+=(h[g][2]-f)*_,m+=(h[g][3]-m)*_}return[c,p,f,m]}function kBe(e,t){let i=e,r=i?.data?.layers;if(r&&typeof r.forEach=="function"){let n=t,s=[];return r.forEach(a=>{let o=a.data;if(o.visible===!1||o.isMask===!0)return;let l=BA(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&&s.push({kind:"color",layer:o,rgb:{...$re(h.r,h.g,h.b),a:h.a??1},alpha:l})}else o.type==="gradient"&&s.push({kind:"gradient",layer:o,alpha:l})}),s.length===0?null:(a,o)=>{let l=1,h=1,u=1,d=!0;for(let c of s){let p,f,m,g;if(c.kind==="color")({r:p,g:f,b:m}=c.rgb),g=c.rgb.a;else{let[y,_,b,x]=zBe(c.layer,a,o);({r:p,g:f,b:m}=$re(y,_,b)),g=x}let v=d?1:Math.min(1,Math.max(0,g*c.alpha));l+=(p-l)*v,h+=(f-h)*v,u+=(m-u)*v,d=!1}return{r:l,g:h,b:u}}}if(i?.color&&i.color.isColor===!0){let{r:n,g:s,b:a}=i.color;return()=>({r:n,g:s,b:a})}return null}var qM,BA,nq,VBe=U(()=>{ae(),qM=new lt,BA=(e,t)=>typeof e=="number"&&Number.isFinite(e)?e:t,nq=e=>Array.isArray(e)&&typeof e[0]=="number"&&typeof e[1]=="number"?[e[0],e[1]]:[0,0]});function GBe(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),s=Math.sin(n)*Math.cos(i),a=Math.cos(n),o=Math.sin(n)*Math.sin(i);return{x:s,y:a,z:o,nx:s,ny:a,nz:o,cr:1,cg:1,cb:1}}function jBe(e){let{geometry:t,matrix:i}=e,r=t.getAttribute("position");if(!r||r.count<3)return null;let n=t.getAttribute("normal"),s=t.getAttribute("uv"),a=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 oi().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]:_},f=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},m=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=f(y),T=c(_)-x,M=p(_)-w,E=f(_)-S,A=c(b)-x,P=p(b)-w,N=f(b)-S,D=M*N-E*P,O=E*A-T*N,z=T*P-M*A;g+=.5*Math.sqrt(D*D+O*O+z*z),m[v]=g}return g<=0?null:{total:g,sample:(v,y)=>{let _=0,b=l-1;for(;_<b;){let Q=_+b>>1;m[Q]<v?_=Q+1:b=Q}let x=_,w=h(x,0),S=h(x,1),T=h(x,2),M=y(),E=y();M+E>1&&(M=1-M,E=1-E);let A,P,N,D=1-M-E,O=c(w)*D+c(S)*M+c(T)*E,z=p(w)*D+p(S)*M+p(T)*E,B=f(w)*D+f(S)*M+f(T)*E;if(n){if(A=n.getX(w)*D+n.getX(S)*M+n.getX(T)*E,P=n.getY(w)*D+n.getY(S)*M+n.getY(T)*E,N=n.getZ(w)*D+n.getZ(S)*M+n.getZ(T)*E,d){let Q=d[0]*A+d[3]*P+d[6]*N,ce=d[1]*A+d[4]*P+d[7]*N,pe=d[2]*A+d[5]*P+d[8]*N;A=Q,P=ce,N=pe}}else{let Q=c(w),ce=p(w),pe=f(w),ye=c(S)-Q,we=p(S)-ce,ne=f(S)-pe,Se=c(T)-Q,W=p(T)-ce,k=f(T)-pe;A=we*k-ne*W,P=ne*Se-ye*k,N=ye*W-we*Se}let V=Math.sqrt(A*A+P*P+N*N)||1,j=1,K=1,$=1;if(a)j=a.getX(w)*D+a.getX(S)*M+a.getX(T)*E,K=a.getY(w)*D+a.getY(S)*M+a.getY(T)*E,$=a.getZ(w)*D+a.getZ(S)*M+a.getZ(T)*E;else if(e.sampleColor){let Q=s?s.getX(w)*D+s.getX(S)*M+s.getX(T)*E:.5,ce=s?s.getY(w)*D+s.getY(S)*M+s.getY(T)*E:.5,pe=e.sampleColor(Q,ce);pe&&(j=pe.r,K=pe.g,$=pe.b)}return{x:O,y:z,z:B,nx:A/V,ny:P/V,nz:N/V,cr:j,cg:K,cb:$}}}}function Xre(e){let t=Math.min(Math.max(1,Math.floor(e.guideStrands)),Nx),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,s=new Float32Array(4*sf),a=new Float32Array(sf),o=new Float32Array(4*Nx).fill(1);for(let l=0;l<t;l++){let h=r?e.sampler(i):GBe(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:f,nz:m}=h;o[4*l+0]=h.cr,o[4*l+1]=h.cg,o[4*l+2]=h.cb;let g,v,y,_=l*Yv,b=(1.8+.8*i())*e.hairLength*n/(Yv-1),x=.5+1.5*i(),w=(.02+.06*i())*n;Math.abs(f)<.99?(g=-m,v=0,y=p):(g=1,v=0,y=0);let S=Math.sqrt(g*g+v*v+y*y)||1;for(let T=0;T<Yv;T++){let M=T/(Yv-1),E=M*M*.4*n,A=w*Math.sin(M*x*Math.PI*2),P=4*(_+T);s[P+0]=u+p*b*T+A*g/S,s[P+1]=d+f*b*T-E+A*v/S,s[P+2]=c+m*b*T+A*y/S,s[P+3]=T===0?0:1,T<Yv-1&&(a[_+T]=b)}}return{initialPositions:s,restLengths:a,unitScale:n,rootColors:o}}var Yv,Nx,sf,hd,vg,YS,J1,z0,e_,QI,rSe=U(()=>{ae(),sf=(Nx=16384)*(Yv=32),hd=100}),nSe=U(()=>{ae(),Na(),yK(),VBe(),rSe(),vg=1/60,YS=new Ue,J1=new jt,z0=new R,e_=new R,QI=class extends Es{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 jt,this.lastBonePos=new R,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 Dt(new Float32Array(0),3)),this.material=new Ql({colorWrite:!1,depthWrite:!1}),this.frustumCulled=!1,this.scalpMesh=new Tr(new Hf(hd,48,32),new Ql({color:5448477})),this.scalpMesh.name="HairScalp",this.add(this.scalpMesh);let r=new bL;r.setAttribute("position",new Dt(new Float32Array(12),3)),r.setIndex([0,2,1,2,3,1]),r.instanceCount=0,this.ribbonMesh=new Tr(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*vg*2),this.trackMotionRest(e/1e3))}trackMotionRest(e){this.boneTransform(J1,z0);let t=this.hasLastBone&&(Math.abs(this.lastBoneQuat.dot(J1))<.9999995||this.lastBonePos.distanceToSquared(z0)>1e-8),i=this.motionFingerprint(),r=!this.hasLastBone||t||this.resetRequested||i!==this.lastMotionFingerprint||this.data.windStrength>.001;this.lastBoneQuat.copy(J1),this.lastBonePos.copy(z0),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,Xi)}(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 s=this.collectBaseSources(n),a=s?function(o){let l=[];for(let d of o){let c=jBe(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,f=l.length-1;for(;p<f;){let g=p+f>>1;h[g]<c?p=g+1:f=g}let m=p===0?c:c-h[p-1];return l[p].sample(m,d)}}(s.sources):null;if(this.baseSourceGeomsAtRegen=s?.sources.map(o=>o.geometry)??[],this.baseSourceHashesAtRegen=s?.hashes??[],this.baseColorHashAtRegen=s?.colorHash??0,s&&a){let o=this.baseWorldScale(n),l=Math.max(s.radius*o,.001);this.baseScaleAtRegen=o;let h=o;return Xre({shape:"object",guideStrands:i,hairLength:r,sampler:u=>{let d=a(u);return{...d,x:d.x*h,y:d.y*h,z:d.z*h}},samplerRadius:l})}}}return Xre({shape:e==="object"?"sphere":e,guideStrands:i,hairLength:r})}collectBaseSources(e){let t=[],i=[],r=0,n=0;YS.copy(e.matrixWorld).invert();let s=YS.clone(),a=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 Ue().multiplyMatrices(s,o.matrixWorld),u=Array.isArray(o.material)?o.material[0]:o.material;t.push({geometry:l,matrix:h,sampleColor:kBe(u,this.context.shared)??void 0}),i.push(QI.matrixHash(h)),n+=function(c,p){let f=c,m=0,g=1,v=_=>{m+=_*g,g+=1},y=f?.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(BA(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(BA(w.angle,0)),v(w.gradientType),v(w.smooth?1:0)}}})}else f?.color&&f.color.isColor===!0&&(v(f.color.r),v(f.color.g),v(f.color.b));return m}(u,this.context.shared),l.boundingSphere===null&&l.computeBoundingSphere();let d=l.boundingSphere;if(d){let c=0,p=1;h?(z0.copy(d.center).applyMatrix4(h),c=z0.length(),p=QI.matrixMaxScale(h)):c=d.center.length(),r=Math.max(r,c+d.radius*p)}}for(let h of o.children)a(h)};return a(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 YS.copy(e.matrixWorld).decompose(z0,J1,e_),Math.max(Math.abs(e_.x),Math.abs(e_.y),Math.abs(e_.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,s=this.baseSourceHashesAtRegen,a=i.length!==n.length;if(!a){for(let o=0;o<i.length;o++)if(i[o].geometry!==n[o]||Math.abs(r[o]-s[o])>1e-4*Math.max(Math.abs(s[o]),1)){a=!0;break}}if(!a&&this.data.hairColorSource==="object"&&(t?.colorHash??0)!==this.baseColorHashAtRegen&&(a=!0),!a&&i.length>0){let o=this.baseWorldScale(e);a=Math.abs(o-this.baseScaleAtRegen)>.001*Math.max(this.baseScaleAtRegen,1e-6)}a&&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 _L(1.4*hd,.7*hd,24,48):e==="cylinder"?new EE(.8*hd,.8*hd,1.6*hd,48,1):new Hf(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)}YS.copy(i).decompose(t,e,e_)}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(J1,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?.(),rq()?.release(this)}}});function JI(){return{shapeInput:()=>`
|
|
4193
4193
|
const float posRowCoord = ${.5/gf};
|
|
4194
4194
|
const float quatRowCoord = ${1.5/gf};
|
|
4195
4195
|
const float param1RowCoord = ${2.5/gf};
|
|
@@ -5386,7 +5386,7 @@ function sortWorker(self) {
|
|
|
5386
5386
|
gl_FragColor = vec4(color.rgb, A);
|
|
5387
5387
|
gVelocity = vec4(0.0);
|
|
5388
5388
|
}`,transparent:!0,alphaTest:1,blending:sa,depthTest:!0,depthWrite:!1,side:zr})}static buildGeomtery(e){let t=new At;t.setIndex([0,1,2,0,2,3]);let i=new Float32Array(12),r=new Dt(i,3);t.setAttribute("position",r),r.setXYZ(0,-1,-1,0),r.setXYZ(1,-1,1,0),r.setXYZ(2,1,1,0),r.setXYZ(3,1,-1,0),r.needsUpdate=!0;let n=new bL().copy(t),s=new Uint32Array(e),a=new gl(s,1,!1);return a.setUsage(wd),n.setAttribute("splatIndex",a),n.instanceCount=e,n}resetLocalSplatDataAndTexturesFromSplatBuffer(){this.updateLocalSplatDataFromSplatBuffer(),this.allocateAndStoreLocalSplatDataInTextures()}updateLocalSplatDataFromSplatBuffer(){this.splatBuffers.forEach(r=>r.buildPreComputedBuffers()),this.covariances=new Float32Array(6*this.splatCount),this.colors=new Uint8Array(4*this.splatCount),this.centers=new Float32Array(3*this.splatCount);let e=0,t=0,i=0;for(let r of this.splatBuffers){let n=r.nsplats;this.colors.subarray(e,e+4*n).set(r.colorsA),e+=4*n,this.centers.subarray(t,t+3*n).set(r.decoded.xyz.denormDequant().data),t+=3*n,this.covariances.subarray(i,i+6*n).set(new Float32Array(r.precomputedCovarianceBufferData)),i+=6*n}}allocateAndStoreLocalSplatDataInTextures(){let e=this.splatCount,t=new Z(4096,1024);for(;t.x*t.y*2<6*e;)t.y*=2;let i,r,n=new Z(4096,1024);for(;n.x*n.y*4<4*e;)n.y*=2;if(this.halfPrecisionCovariancesOnGPU){r=new Uint16Array(t.x*t.y*2);for(let h=0;h<this.covariances.length;h++)r[h]=Sd.toHalfFloat(this.covariances[h]);i=new Ir(r,t.x,t.y,Ss,di)}else r=new Float32Array(t.x*t.y*2),r.set(this.covariances),i=new Ir(r,t.x,t.y,Ss,Wt);i.needsUpdate=!0,this.material.uniforms.covariancesTexture.value=i,this.material.uniforms.covariancesTextureSize.value.copy(t);let s=new Uint32Array(n.x*n.y*4);for(let h=0;h<e;h++){let u=4*h,d=3*h,c=4*h;s[c]=USe(this.colors[u],this.colors[u+1],this.colors[u+2],this.colors[u+3]),s[c+1]=rO(this.centers[d]),s[c+2]=rO(this.centers[d+1]),s[c+3]=rO(this.centers[d+2])}let a=new Ir(s,n.x,n.y,Kg,dn);s4()!=="webgpu"&&(a.internalFormat="RGBA32UI"),a.needsUpdate=!0,this.material.uniforms.centersColorsTexture.value=a,this.material.uniforms.centersColorsTextureSize.value.copy(n);let o=new Float32Array(4096);for(let h=0;h<this.meshMatrixWorlds.length;h++)o.set(this.meshMatrixWorlds[h].elements,16*h);let l=new Ir(o,1024,1,fn,Wt);l.needsUpdate=!0,this.material.uniforms.meshMatrixWorldsTexture.value=l,this.material.uniformsNeedUpdate=!0,this.splatDataTextures={covariances:{data:r,texture:i,size:t},centerColors:{data:s,texture:a,size:n},meshMatrixWorlds:{data:o,texture:l}}}updateIndexes(e){let t=this.geometry;t.attributes.splatIndex.set(e),t.attributes.splatIndex.needsUpdate=!0,t.instanceCount=e.length}updateUniforms(e,t,i,r){this.splatCount>0&&(JS.set(e.x*this.devicePixelRatio,e.y*this.devicePixelRatio),this.material.uniforms.viewport.value.copy(JS),this.material.uniforms.basisViewport.value.set(2/JS.x,2/JS.y),this.material.uniforms.focal.value.set(t,i),this.material.uniforms.orthoZoom.value=r,this.material.uniformsNeedUpdate=!0)}getSplatDataTextures(){return this.splatDataTextures}getSplatCount(){return this.splatCount}getCenters(){return this.centers}getColors(){return this.colors}getCovariances(){return this.covariances}dispose(){this.geometry.dispose(),this.material.dispose(),this.splatDataTextures&&(this.splatDataTextures.covariances.texture.dispose(),this.splatDataTextures.centerColors.texture.dispose(),this.splatDataTextures.meshMatrixWorlds.texture.dispose()),this.removeFromParent()}}});function gFe(){if(!pq)return hne||(hne=async function(){let e=await Promise.resolve().then(()=>(LQ(),OQ));VSe(e),pq=!0}())}var VSe,GSe,pq,hne,une,jSe,g4,wz,zg,WSe=U(()=>{GSe=new Promise(e=>{VSe=e}),pq=!1}),vFe=U(()=>{fFe(),ae(),kSe(),WSe(),GSe.then(e=>une=e),jSe=class{constructor(e={}){Fc(this,"updateView",function(){let t=new Ue,i=[],r=new R(0,0,-1),n=new R(0,0,-1),s=new R,a=new R;return function(o=!1,l){let h=this.updateMatrixWorldsInWorkerIfNeeded(),u=this.cropsChanged();if(!o){n.set(0,0,-1).applyQuaternion(l.quaternion);let c=!1,p=!1;if(n.dot(r)<=.95&&(c=!0),a.copy(l.position).sub(s).length()>=1&&(p=!0),!(c||p||h||u||this.needsInitialRender))return}this.needsInitialRender=!1,s.copy(l.position),r.copy(n),t.copy(l.matrixWorld).invert(),t.premultiply(this.dummyPerspectiveMatrix),i[0]=l.position.x,i[1]=l.position.y,i[2]=l.position.z;let d={sort:{view:t.elements,cameraPosition:i,splatRenderCount:this.splatRenderCount,splatSortCount:this.splatRenderCount},...h?{newMatrixWorlds:this.meshMatrixWorlds}:{},...u?{newCropsArray:this.cropsArray}:{}};this.sortRunning?this.queuedMessage=d:(this.queuedMessage=null,this.sortRunning=!0,this.sortWorker.postMessage(d))}}()),this.scene=e.scene,this.currentPage=null,this.devicePixelRatio=window.devicePixelRatio,this.sortWorker=null,this.splatRenderCount=0,this.splatSortCount=0,this.splatMesh=null,this.sortRunning=!1,this.meshMatrixWorlds=null,this.meshMatrixWorldsOld=null,this.cropsArray=null,this.splatEntries=null,this.queuedMessage=null,this.needsInitialRender=!0,this.dummyPerspectiveMatrix=new Ue().makePerspective(-1,1,-1,1,.1,1e3)}updateSplatMeshUniforms(e,t){let i=new Z;this.splatMesh!==null&&this.splatMesh.getSplatCount()>0&&(e.getSize(i),this.cameraFocalLengthX=t.projectionMatrix.elements[0]*this.devicePixelRatio*i.x*.45,this.cameraFocalLengthY=t.projectionMatrix.elements[5]*this.devicePixelRatio*i.y*.45,this.splatMesh.updateUniforms(i,this.cameraFocalLengthX,this.cameraFocalLengthY,t.isPerspectiveCamera?-1:t.zoom*this.devicePixelRatio))}loadSplat(e={}){this.activePage=this.scene.activePage,e.position&&(e.position=new R().fromArray(e.position)),e.orientation&&(e.orientation=new jt().fromArray(e.orientation)),e.halfPrecisionCovariances=!!e.halfPrecisionCovariances;let t=[];if(this.splatEntries=t,this.activePage.traverseVisibleEntity(s=>{s.data.type==="Splat"&&t.push(s)}),this.splatMesh&&this.splatMesh.dispose(),t.length===0)return this.splatMesh=null,!1;this.meshMatrixWorlds=t.map(s=>s.matrixWorld),this.meshMatrixWorldsOld=t.map(s=>s.matrixWorld.clone()),this.cropsArray=t.map(s=>s.data.crops.map(a=>a.data)),this._splatBufferCache??(this._splatBufferCache=new WeakMap);let i=t.map(s=>{let a=this._splatBufferCache.get(s.data.buffer);return a===void 0&&(a=new une.GSplineBuffer(new Uint8Array(s.data.buffer).buffer),this._splatBufferCache.set(s.data.buffer,a)),a}),r=0,n=[0];for(let s of i)r+=s.getSplatCount(),n.push(r);return this.setupSplatMesh(i,r,e.position,e.orientation,e.halfPrecisionCovariances,this.devicePixelRatio,n,this.meshMatrixWorlds),this.setupSortWorker(r),!0}updateMatrixWorldsInWorkerIfNeeded(){let e=this.splatDataTextures.meshMatrixWorlds.data;for(let t=0;t<this.meshMatrixWorlds.length;t++)e.set(this.meshMatrixWorlds[t].elements,16*t);return this.splatDataTextures.meshMatrixWorlds.texture.needsUpdate=!0,!this.meshMatrixWorlds.every((t,i)=>t.equals(this.meshMatrixWorldsOld[i]))&&(this.meshMatrixWorldsOld=this.meshMatrixWorlds.map(t=>t.clone()),!0)}cropsChanged(){let e=!1;return this.splatEntries.forEach((t,i)=>{t.data.crops.forEach((r,n)=>{this.cropsArray[i][n]===void 0?(e=!0,this.cropsArray[i][n]=r.data):Object.entries(r.data).forEach(([s,a])=>{(Array.isArray(a)&&a.some((o,l)=>o!==this.cropsArray[i][n][s][l])||a!==this.cropsArray[i][n]?.[s])&&(e=!0,this.cropsArray[i][n][s]=a)})}),t.data.crops.length!==this.cropsArray[i]?.length&&(this.cropsArray[i].length=t.data.crops.length,e=!0)}),e}setupSplatMesh(e,t,i=new R,r=new jt,n=!1,s=1,a,o){this.splatMesh=JM.buildMesh(e,t,n,s,a,o),this.splatMesh.position.copy(i),this.splatMesh.quaternion.copy(r),this.splatMesh.frustumCulled=!1,this.splatMesh.renderOrder=99999,this.splatRenderCount=t,this.splatMesh.onBeforeRender=(l,h,u)=>this.update(l,u)}setupSortWorker(e){this.sortWorker=function(t){let i=new Worker(URL.createObjectURL(new Blob(["(",FSe,")(self)"],{type:"application/javascript"}))),r=atob(BSe),n=new Uint8Array(r.length);for(let s=0;s<r.length;s++)n[s]=r.charCodeAt(s);return i.postMessage({init:{sorterWasmBytes:n.buffer,splatCount:t,Constants:{BytesPerFloat:Ug.BytesPerFloat,BytesPerInt:Ug.BytesPerInt,DepthMapRange:Ug.DepthMapRange,MemoryPageSize:Ug.MemoryPageSize}}}),i}(e),this.sortWorker.onmessage=t=>{t.data.sortDone?(this.sortRunning=!1,this.splatMesh?.updateIndexes(new Uint32Array(t.data.indexesBuffer)),this.lastSortTime=t.data.sortTime,this.queuedMessage&&(this.sortWorker.postMessage(this.queuedMessage),this.queuedMessage=null)):t.data.sortCanceled?this.sortRunning=!1:t.data.sortSetupPhase1Complete?this.sortWorker.postMessage({positions:this.splatMesh.getCenters().buffer,meshMatrixWorlds:this.splatMesh.meshMatrixWorlds,meshIndexIntervals:this.splatMesh.meshIndexIntervals,cropsArray:this.cropsArray}):t.data.sortSetupComplete&&(this.splatDataTextures=this.splatMesh.getSplatDataTextures(),this.scene.activePage.add(this.splatMesh),this.needsInitialRender=!0)}}update(e,t){this.splatMesh!==null&&(this.updateSplatMeshUniforms(e,t),this.updateView(!1,t))}getSplatMesh(){return this.splatMesh}}}),kB=U(()=>{ae(),Oh(),wl(),o0(),zt(),RSe(),Or(),pK(),oK(),Na(),aC(),uFe(),MB(),Sl(),Zn(),Tu(),TSe(),Zn(),la(),Mw(),dFe(),vFe(),(g4=new Ql).wireframe=!0,wz=new R,zg=class extends Ko{constructor(e,t){super(),this.data=e,this.sharedAssets=t,this.enableHelpers=!1,this.wireframeState=!1,this.needsTransmissionDirty=!0,this.needsNormalDirty=!0,this.needsReflectionDirty=!0,this._needsTransmission=!1,this._needsNormal=!1,this._normalPassNeeds={outline:!1,cavity:!1},this._needsReflection=!1,this.geometryCacheChanged=!1,this.splatViewer=null,this.shapeBlendIntances=[],this.hairInstances=[],this.shadowsDirty=!0,this.instanceGroupsDirty=!0,this._autoInstancing=null,this.entityByUuid={},this.entityIdentityToEntity={},this.toExpandCloner=new Set,this.toUpdateCloner=new Set,this.pendingCommands=[],this.pathConstraints=new LSe,this.invisibleObjects=new Pc("jflkdsafjasdifjaslk",{...GL.defaultData,visible:!1,name:"buildin invisible"}),this.needsRecomputeInstances=!1,this.init(e,t),this.matrixAutoUpdate=!1,this.errorPage=new Dn("fdasfa",{...by.defaultData,name:""},{shared:t,scene:this})}markGeometryCacheDirty(){this.geometryCacheChanged=!0}markShadowsDirty(){this.shadowsDirty=!0}markInstanceGroupsDirty(){this.instanceGroupsDirty=!0}get autoInstancing(){return this._autoInstancing}updateInstanceGroups(e,t){let i=this._autoInstancing;(i===null||i.minGroupSize!==t)&&(i?.dispose(),i=new PSe(t),this._autoInstancing=i);let r=this.instanceGroupsDirty;return this.instanceGroupsDirty=!1,i.update(e,r),i.stats}releaseInstanceGroups(){this._autoInstancing?.teardown(),this.instanceGroupsDirty=!0}markNeedsUpdateRendererDirty(){this.needsTransmissionDirty=!0,this.needsNormalDirty=!0,this.needsReflectionDirty=!0,this.shadowsDirty=!0,this.instanceGroupsDirty=!0}needsTransmission(){return this.needsTransmissionDirty&&(this._needsTransmission=function(e){let t=!1;return e.traverseEntity(i=>{if(i instanceof xl)if(Array.isArray(i.material))for(let r=0;r<i.material.length;r++)Wre(i,i.material[r])&&(t=!0);else Wre(i,i.material)&&(t=!0)}),t}(this),this.needsTransmissionDirty=!1),this._needsTransmission}needsNormal(){return this.needsNormalDirty&&(this._normalPassNeeds=function(e){let t={outline:!1,cavity:!1},i=r=>{t.outline=t.outline||r.outline,t.cavity=t.cavity||r.cavity};return e.traverseEntity(r=>{if(r instanceof xl)if(Array.isArray(r.material))for(let n=0;n<r.material.length;n++)i(jre(r,r.material[n]));else i(jre(r,r.material))}),t}(this),this._needsNormal=this._normalPassNeeds.outline||this._normalPassNeeds.cavity,this.needsNormalDirty=!1),this._needsNormal}normalPassNeeds(){return this.needsNormal(),this._normalPassNeeds}needsReflection(){return this.needsReflectionDirty&&(this._needsReflection=function(e){let t=!1;return e.traverseEntity(i=>{if(i instanceof xl)if(Array.isArray(i.material))for(let r=0;r<i.material.length;r++)Hre(i,i.material[r])&&(t=!0);else Hre(i,i.material)&&(t=!0)}),t}(this),this.needsReflectionDirty=!1),this._needsReflection}registerInstanceAndSetUuid(e){let t=e.identity.join("-"),i=this.entityIdentityToEntity[t];i&&(e.uuid=i.uuid),this.entityIdentityToEntity[t]=e,this.entityByUuid[e.uuid]=e}markPenumbraSizeDirty(){for(let e of this.children)e instanceof Dn&&(e.penumbraSizeArrayCache=null)}findInstance(e){return this.entityIdentityToEntity[e.join("-")]}findInInstance(e,t){let i=t??null;if(!nr.is(i))return;let r=i.data.type==="Instance";if(!r&&!i.isVirtualEntity)return;let n=typeof i.identity=="string"?[i.identity]:i.identity;for(let s=n.length-(r?0:1);s>=1;s--){let a=this.findInstance([...n.slice(0,s),e]);if(a)return a}for(let s=i;nr.is(s);s=s.parent)if(s.data.type==="Instance"&&s.data.component===e)return s}findFrom(e,t){return this.findInInstance(e,t)??this.find(e)}syncInstancePathConstraint(e){let t=e.data.pathSnapping?.pathId;if(t){let i=this.findFrom(t,e);this.pathConstraints.setConstraint(e.uuid,i?.uuid??t)}else this.pathConstraints.removeDependencies(e.uuid)}get bgColor(){return this.activePage.bgColor}get postprocessing(){return this.activePage.data.postprocessing}getWithSortKey(e){let t=this.find(e);if(t===void 0)return;let i=[],r=t;for(;r!==this;){let n=r;r=r.parent;let s=r.children.indexOf(n);i.splice(0,0,s)}return{entity:t,sortKey:i}}getAllSorted(e){let t=[];for(let i of e){let r=this.getWithSortKey(i.id);r!==void 0&&t.push(r)}return t.sort((i,r)=>wL(i.sortKey,r.sortKey)),t.map(i=>i.entity)}nonExistOrDescendantOf(e,t){let i=this.find(e);if(i===void 0)return!0;for(;i;){if(i.uuid===t)return!0;i=i.parent}return!1}find(e){if(this.activePage&&this.activePage.personalCamera.parent){if(e==="f23858d0-4a3b-4bd8-8173-66ed0af7f6fb-personalCamera")return this.activePage.personalCamera;if(e===d1)return this.activePage.personalCamera}if(e===""||e===void 0)return;let t=this.entityByUuid[e];return t===void 0?this.getObjectByProperty("uuid",e):t}find2D(e){for(let t of this.children)if(t instanceof Dn&&t.uiScene){let i=t.uiScene.find(e);if(i)return i}}findScene2DfromObject2D(e){for(let t of this.children)if(t instanceof Dn&&t.uiScene&&t.uiScene.find(e))return t.uiScene}find2DInUIObjects(e){let t;return this.traverseEntity(i=>{t===void 0&&$o(i)&&(t=i.uiCanvas.find(e))}),t}traverse2D(e){for(let t of this.children)t instanceof Dn&&t.uiScene&&t.uiScene.traverse(e)}debugEnsureEntity(e){let t=this.find(e);t?Array.isArray(t.identity)&&this.findInstance(t.identity)===void 0&&console.error("not found instance"):console.error("not found")}addPendingExpandCloner(e){this.toExpandCloner.add(e)}addPendingUpdateCloner(e){this.toUpdateCloner.add(e)}markToExpandCloner(e){this.toExpandCloner.add(e),e.traverseEntityAncestors(t=>{this.toExpandCloner.add(t)})}doPendingExpandCloner(e){this.toExpandCloner.forEach(t=>{t.expandCloner(e)}),this.toExpandCloner.clear()}doPendingUpdateCloner(e){this.toUpdateCloner.forEach(t=>{t.cloner?.update(e)}),this.toUpdateCloner.clear()}doPendingUpdates(e){this.doPendingExpandCloner(e),this.doPendingUpdateCloner(e),this.applyPendingCommands()}addPendingCommand(e){this.pendingCommands.push(e)}applyPendingCommands(){this.pendingCommands.forEach(e=>e()),this.pendingCommands.length=0}updateByLibOp(e,t){e.path.length===1&&e.path[0]==="components"&&e.type===1&&this.createChildrenObjects([{...e.data.asset,id:e.id}],this.invisibleObjects,t)}updateTreeByOp(e,t){if(e.path.length===0&&e.type===7){let i=e.parent===null?this:this.find(e.parent);if(i===void 0)throw new Error(`scene tree add: parent ${e.parent} not found for object ${e.id}`);let r=this.createObject(e.id,e.data,e.children,i,e.localIndex,t);r.updateVisible(this),r.resetBBoxNeedsUpdate(),yd(r)&&zc(r.parent)&&(r.invalidateUpstreamBooleanData(),r.parent.invalidateDownstreamBooleanData().recomputeBoolean()),this.markNeedsRecomputeInstancesForAncessors(i),this.markNeedsRecomputeInstancesForChildren(r),this.markToExpandCloner(r),this.markPenumbraSizeDirty(),r.updatePathSnapping()}else if(e.path.length===0&&e.type===8){let i=this.find(e.id);if(i===void 0)throw new Error(`scene tree delete: object ${e.id} not found`);i.traverseEntity(n=>{Zf(n)&&(this.shapeBlendIntances=this.shapeBlendIntances.filter(s=>s!==n)),s1(n)&&(this.hairInstances=this.hairInstances.filter(s=>s!==n))}),this.markToExpandCloner(i),i.resetBBoxNeedsUpdate(),this.unregisterObject(i);let r=i.parent;this.markNeedsRecomputeInstancesForAncessors(r),this.markNeedsRecomputeInstancesForChildren(i),this.markPenumbraSizeDirty(),i.parent.remove(i),zc(i.parent)&&(i.parent.invalidateUpstreamBooleanData(),i.parent.invalidateDownstreamBooleanData().recomputeBoolean()),yd(i)&&(i.freeBooleanPointer(),r instanceof qg&&r.invalidateDownstreamBooleanData().recomputeBoolean()),xB(i)&&i.detachShape(),this.disposeAndUnregisterEntityRecursivelyIfNotReregistered(i),this.pathConstraints.removeDependencies(i.uuid),i.updatePathSnapping()}else if(e.path.length===0&&e.type===9){let i=this.find(e.id);if(i===void 0)throw new Error(`scene tree move: object ${e.id} not found`);this.markNeedsRecomputeInstancesForChildren(i);let r=i.parent;this.markNeedsRecomputeInstancesForAncessors(r),i.cloner?.resetOnMove(),this.markToExpandCloner(i);let n=e.parent===null?this:this.find(e.parent);if(n===void 0)throw new Error(`scene tree move: new parent ${e.parent} not found for object ${e.id}`);n.add(i),this.markNeedsRecomputeInstancesForAncessors(n),this.markToExpandCloner(i),i.invalidateClonerTransform(i),i.updateVisible(this),i.resetBBoxNeedsUpdate(),this.markPenumbraSizeDirty();let s=e.localIndex;n.children.splice(s,0,n.children.pop()),yd(i)&&(i.invalidateUpstreamBooleanData(),zc(i.parent)?i.parent.invalidateDownstreamBooleanData().recomputeBoolean():r instanceof qg&&r.invalidateDownstreamBooleanData().recomputeBoolean()),i.updatePathSnapping()}this.markNeedsUpdateRendererDirty(),this.markGeometryCacheDirty()}get playPage(){return this.find(this.data.publish.playPage)??this.errorPage}updatePage(e){this.shadowsDirty=!0,this.activePage&&this.activePage.onDeactive(),this.activePage=this.errorPage;for(let t of this.children)t instanceof Dn&&(t.visible=t.uuid===e,t.visible&&(this.activePage=t,this.activePage.onActive(this)));this.activePage!==this.splatViewer?.activePage&&this.reloadSplats()}updateEntityByOp(e,t,i,r){if(this.shadowsDirty=!0,t.type===0){if(("overrides"in t.props||"component"in t.props)&&this.markNeedsRecomputeInstances(),"visible"in t.props&&this.markPenumbraSizeDirty(),t.path.includes("overrides")&&"states"in t.props){let{rest:s}=t.props;t={...t,props:s},this.markNeedsRecomputeInstances()}t.path[0]==="pathSnapping"&&t.props.pathId!==void 0&&this.pathConstraints.setConstraint(e,t.props.pathId)}let n=this.find(e);if(n)try{(function(s,a,o,l){s.updateByOp(a,o,l,!1)})(n,t,i,{scene:this,shared:r}),n instanceof zn&&n.updateGeometryGroupsIfNeeded()}catch(s){console.error(s)}}updateEntity2DByOp(e,t,i,r,n,s=[]){e.updateEntityByOp(t,i,r,n),this.traverseEntity(a=>{($o(a)||a instanceof Dn)&&(s.includes(a.frameId??"")||a.frameId===t)&&a.updateEntity2DByOp(t,i,r,n)})}get activeCamera(){return this.activePage.activeCamera}switchActiveCamera(e){this.activePage.switchActiveCamera(e)}isInvisibleObjects(e){return e===this.invisibleObjects||e.hasAnccestor(this.invisibleObjects)}init(e,t){let i=Object.entries(t.data.lib.components).map((r,n)=>({data:r[1].asset.data,children:r[1].asset.children,id:r[0],fi:n}));this.invisibleObjects.updateState(this.invisibleObjects.data,{scene:this,shared:t}),this.add(this.invisibleObjects),this.createChildrenObjects(i,this.invisibleObjects,t),this.createChildrenObjects(e.objects,this,t),this.updatePage(e.publish.playPage),this.activePage.switchToPlayCamera(),this.expandInstances(t,!0),this.traverseEntity(r=>{r instanceof Qn&&r.updateUp()}),this.doPendingExpandCloner({scene:this,shared:t}),this.applyPendingCommands()}markNeedsRecomputeInstances(){this.needsRecomputeInstances=!0}markNeedsRecomputeInstancesForChildren(e){e.traverseEntity(t=>{(t.data.type==="Component"||t.data.type==="Instance")&&this.markNeedsRecomputeInstances()})}markNeedsRecomputeInstancesForAncessors(e){nr.is(e)&&(e.data.type==="Component"&&this.markNeedsRecomputeInstances(),e.traverseAncestors(t=>{nr.is(t)&&t.data.type==="Component"&&this.markNeedsRecomputeInstances()}))}relativeizeInner(e,t,i,r,n,s,a){if(e){let o=r.find(e);o&&o!==r&&n.forInstancesRec(l=>{l.data=ML(l.data,h=>{let u=h.events.data(a.id),d=l.goUp(s);if(d){let c=[...G_e(d.identity),e].join("-"),p=this.entityIdentityToEntity[c];if(p){let f=p.uuid;Sa.zoom(u,t)[i]=f}else console.warn("cannot find instance")}}).data})}}rewriteActions(e,t,i,r,n,s){e.forEach(a=>{a.data.type==="Transition"||a.data.type==="Animation"&&a.data.object?this.relativeizeInner(a.data.object,[...t,a.id],"object",i,r,n,s):a.data.type==="Conditional"&&(this.rewriteActions(a.data.ifActions,[...t,a.id,"ifActions"],i,r,n,s),this.rewriteActions(a.data.elseActions,[...t,a.id,"elseActions"],i,r,n,s))})}rewriteEventsBeforeGoToPlayMode(){this.traverseEntity(e=>{if(WI(e)&&typeof e.identity=="string"&&e.data.type==="Component")return e.traverseEntity((t,i)=>{t.data.events.forEach(r=>{if(r.data.type==="GameControl"){let n=!1;if(t.forInstancesRec(s=>{s.data=ML(s.data,a=>{s.isInstanceRoot||(a.events.delete(r.id),n=!0)}).data}),n===!1)for(let s of qL.list)this.rewriteActions(r.data.gameActions[s],["gameActions",s],e,t,i,r)}else r.data.type==="Conditional"?(r.data.condition.type==="Distance"?(this.relativeizeInner(r.data.condition.fromObject,["condition"],"fromObject",e,t,i,r),this.relativeizeInner(r.data.condition.toObject,["condition"],"toObject",e,t,i,r)):r.data.condition.type==="State"?this.relativeizeInner(r.data.condition.object,["condition"],"object",e,t,i,r):r.data.condition.type==="Comparison"&&(r.data.condition.lOperand.type==="Property"&&this.relativeizeInner(r.data.condition.lOperand.value[0],["condition","lOperand","value"],0,e,t,i,r),r.data.condition.rOperand.type==="Property"&&this.relativeizeInner(r.data.condition.rOperand.value[0],["condition","rOperand","value"],0,e,t,i,r)),this.rewriteActions(r.data.inActions,["inActions"],e,t,i,r),this.rewriteActions(r.data.outActions,["outActions"],e,t,i,r)):"actions"in r.data&&this.rewriteActions(r.data.actions,["actions"],e,t,i,r)})}),!0})}expandInstances(e,t,i){let r=new Set;this.traverseEntity(n=>{if(WI(n)&&n.isInstanceRoot)return n.expandInstanceChildren({scene:this,shared:e,pendingDeletes:r}),t||n.resetBBoxNeedsUpdate(),i&&n.traverseEntity(s=>{i.addClip(s)}),!0});for(let n of r)this.disposeAndUnregisterEntityRecursivelyIfNotReregistered(n),MK(n)}recomputeInstances(e,t){this.needsRecomputeInstances&&(this.needsRecomputeInstances=!1,this.traverseEntity(i=>{WI(i)&&i.isInstanceRoot&&(i.component=void 0)}),this.expandInstances(e,!1,t))}disposeAndUnregisterEntityRecursivelyIfNotReregistered(e){e.traverseEntity(t=>{let i=typeof t.identity=="string"?t.identity:t.identity.join("-");this.entityIdentityToEntity[i]===t&&(delete this.entityByUuid[t.uuid],delete this.entityIdentityToEntity[i],this.pathConstraints.removeDependencies(t.uuid)),t.dispose()})}clearScene(){this._autoInstancing?.dispose(),this._autoInstancing=null,this.instanceGroupsDirty=!0;for(let e of this.children)nr.is(e)&&e.disposeRecursively();this.children.length=0}resetAfterClear(e,t){this.init(e,t)}raycast(e){return this.raycast1(e,!1)}raycast1(e,t){let i=[],r=n=>{for(let s of n.children){let a=s.cloner;if(nr.is(s)&&!s.raycastLock&&(s.visible||a?.object.data.visible))if(t===!0&&s.isInstanceRoot){let o=[];if(e.intersectObject(s,!0,o),o.length){let l=o[0];l.object=s,l.point.applyMatrix4(l.object.matrixWorld);let h=s.matrixWorld.clone().invert();l.point.applyMatrix4(h),i.push(l)}}else(yd(s)||h4(s)&&this.enableHelpers&&s.objectHelper.visible)&&(e.intersectObject(s,!1,i),tq(s,e,i)),r(s)}};return r(this.activePage),i}raycastWithClones(e){let t=[],i=r=>{for(let n of r.children){let s=n.cloner;nr.is(n)&&(n.visible||s?.object.data.visible)&&((yd(n)||h4(n)&&this.enableHelpers&&n.objectHelper.visible)&&(e.intersectObject(n,!1,t),tq(n,e,t,!0)),i(n))}};return i(this),t}forEachEntity(e){for(let t of this.children)nr.is(t)&&e(t)}traverseConcreteEntity(e){for(let t of this.children)nr.is(t)&&t.isConcreteEntity&&t.traverseEntity(e)}traverseEntity(e){for(let t of this.children)nr.is(t)&&t.traverseEntity(e)}updateFont(e,t){this.traverseEntity(i=>{if(i instanceof zn&&i.data.type==="Mesh"&&(i.data.geometry.type==="TextGeometry"||i.data.geometry.type==="InputGeometry")&&i.data.geometry.font===e){let r=i.geometry,n=i.data.geometry;r.updateFont(e,t).then(()=>{r.update(n,t);let s=i.invalidateDownstreamBooleanData();zc(s)&&s.recomputeBoolean()})}})}traverseObject(e){for(let t of this.children)ay.is(t)&&t.traverseObject(e)}traverseVisibleEntity(e){for(let t of this.children)nr.is(t)&&t.visible&&t.traverseVisibleEntity(e)}dispose(){this.clearScene()}createChildrenObjects(e,t,i){let r=0;for(let n of e)this.createObject(n.id,n.data,n.children,t,r,i),r+=1}registerObjectCreatedInLegacy(e){this.entityByUuid[e.uuid]=e}unregisterObject(e){delete this.entityByUuid[e.uuid];for(let t of e.children)this.unregisterObject(t)}createObject(e,t,i,r,n,s){let a={scene:this,shared:s},o=PK(e,t,a);return Zf(o)&&this.shapeBlendIntances.push(o),s1(o)&&this.hairInstances.push(o),o&&(this.entityByUuid[e]=o,r.add(o),r.children.splice(n,0,r.children.pop()),i.length>0&&(o.isInstanceRoot?console.error("instance should not have children!"):this.createChildrenObjects(i,o,s)),o.updateState(t,a),o instanceof zn&&o.updateGeometryGroupsIfNeeded(),o.updateVisible(this),o.cloner&&this.toExpandCloner.add(o),t.pathSnapping?.pathId&&this.pathConstraints.setConstraint(e,t.pathSnapping.pathId)),t.type==="Empty"&&t.animations&&o.traverseEntity(l=>{let h=l.dataPatched;if(l instanceof zn&&h.bones&&h.boneInverses){let u=h.bones.map(p=>this.find(p)),d=h.boneInverses.map(p=>new Ue().fromArray(p)),c=new vL(u,d);l.bind(c,l.bindMatrix)}else l.matrixAutoUpdate=!0}),o}getCenter(e){let t=[];for(let r=0,n=e.length;r<n;++r){let{id:s,recursive:a}=e[r],o=this.find(s),l=a?o.recursiveBBox:o.singleBBox;t.push(...l.vertices)}let i=new pn;return i.setFromPoints(t),i.getCenter(wz),wz}copyMatrixWorld(e,t){if(e===null)return void t.identity();let i=this.find(e);i?(i.updateWorldMatrix(!0,!1),t.copy(i.matrixWorld)):t.identity()}copyParentMatrixWorld(e,t){if(e===null)return void t.identity();let i=this.find(e)?.parent;i?(i.updateWorldMatrix(!0,!1),t.copy(i.matrixWorld)):t.identity()}traverseMaterial(e){this.traverseEntity(t=>{if(t instanceof Es)if(Array.isArray(t.material))for(let i of t.material)o4(i)&&e(i);else o4(t.material)&&e(t.material)})}updateViewPlaneSize(e,t,i=!1){this.traverseConcreteEntity(r=>{r instanceof Qn&&r.setViewplaneSize(e,t,i)})}initializeSplatViewer(){this.splatViewer=new jSe({scene:this}),this.reloadSplats()}reloadSplats(){this.splatViewer?.loadSplat()}}}),HSe={};function yFe(){let e,t;function i(r,n,s,a,o,l){let h=s.num_points(),u=l.num_components(),d=function(b,x){switch(x){case Float32Array:return b.DT_FLOAT32;case Int8Array:return b.DT_INT8;case Int16Array:return b.DT_INT16;case Int32Array:return b.DT_INT32;case Uint8Array:return b.DT_UINT8;case Uint16Array:return b.DT_UINT16;case Uint32Array:return b.DT_UINT32}}(r,o),c=u*o.BYTES_PER_ELEMENT,p=4*Math.ceil(c/4),f=p/o.BYTES_PER_ELEMENT,m=h*c,g=h*p,v=r._malloc(m);n.GetAttributeDataArrayForAllPoints(s,l,d,m,v);let y,_=new o(r.HEAPF32.buffer,v,m/o.BYTES_PER_ELEMENT);if(c===p)y=_.slice();else{y=new o(g/o.BYTES_PER_ELEMENT);let b=0;for(let x=0,w=_.length;x<w;x++){for(let S=0;S<u;S++)y[b+S]=_[x*u+S];b+=f}}return r._free(v),{name:a,count:h,itemSize:u,array:y,stride:f}}onmessage=function(r){let n=r.data;switch(n.type){case"init":e=n.decoderConfig,t=new Promise(function(o){e.onModuleLoaded=function(l){o({draco:l})},DracoDecoderModule(e)});break;case"decode":let s=n.buffer,a=n.taskConfig;t.then(o=>{let l=o.draco,h=new l.Decoder;try{let u=function(c,p,f,m){let g,v,y=m.attributeIDs,_=m.attributeTypes,b=p.GetEncodedGeometryType(f);if(b===c.TRIANGULAR_MESH)g=new c.Mesh,v=p.DecodeArrayToMesh(f,f.byteLength,g);else{if(b!==c.POINT_CLOUD)throw new Error("THREE.DRACOLoader: Unexpected geometry type.");g=new c.PointCloud,v=p.DecodeArrayToPointCloud(f,f.byteLength,g)}if(!v.ok()||g.ptr===0)throw new Error("THREE.DRACOLoader: Decoding failed: "+v.error_msg());let x={index:null,attributes:[]};for(let w in y){let S,T,M=self[_[w]];if(m.useUniqueIDs)T=y[w],S=p.GetAttributeByUniqueId(g,T);else{if(T=p.GetAttributeId(g,c[y[w]]),T===-1)continue;S=p.GetAttribute(g,T)}let E=i(c,p,g,w,M,S);w==="color"&&(E.vertexColorSpace=m.vertexColorSpace),x.attributes.push(E)}return b===c.TRIANGULAR_MESH&&(x.index=function(w,S,T){let M=3*T.num_faces(),E=4*M,A=w._malloc(E);S.GetTrianglesUInt32Array(T,E,A);let P=new Uint32Array(w.HEAPF32.buffer,A,M).slice();return w._free(A),{array:P,itemSize:1}}(c,p,g)),c.destroy(g),x}(l,h,new Int8Array(s),a),d=u.attributes.map(c=>c.array.buffer);u.index&&d.push(u.index.array.buffer),self.postMessage({type:"decode",id:n.id,geometry:u},d)}catch(u){console.error(u),self.postMessage({type:"error",id:n.id,error:u.message})}finally{l.destroy(h)}})}}}yw(HSe,{DRACOLoader:()=>$Se,DRACO_GLTF_CONFIG:()=>qSe});var Q3,qSe,$Se,_Fe=U(()=>{ae(),Q3=new WeakMap,qSe={js:"",wasm:""},$Se=class extends Fv{constructor(e){super(e),this.decoderPaths={js:"",wasm:"",dep_js:""},this.decoderConfig={},this.decoderBinary=null,this.decoderPending=null,this.workerLimit=4,this.workerPool=[],this.workerNextTaskID=1,this.workerSourceURL="",this.defaultAttributeIDs={position:"POSITION",normal:"NORMAL",color:"COLOR",uv:"TEX_COORD"},this.defaultAttributeTypes={position:"Float32Array",normal:"Float32Array",color:"Float32Array",uv:"Float32Array"}}setDecoderPath(e){let{decoderPaths:t}=this;return typeof e=="object"?(t.js=e.js,t.wasm=e.wasm,t.dep_js=null):(t.js=II.resolveURL("draco_wasm_wrapper.js",e),t.wasm=II.resolveURL("draco_decoder.wasm",e),t.dep_js=II.resolveURL("draco_decoder.js",e)),this}setDecoderConfig(e){return console.warn("THREE.DRACOLoader: setDecoderConfig to has been deprecated and will be removed in r194."),this.decoderConfig=e,this}setWorkerLimit(e){return this.workerLimit=e,this}load(e,t,i,r){let n=new PE(this.manager);n.setPath(this.path),n.setResponseType("arraybuffer"),n.setRequestHeader(this.requestHeader),n.setWithCredentials(this.withCredentials),n.load(e,s=>{this.parse(s,t,r)},i,r)}parse(e,t,i=()=>{}){this.decodeDracoFile(e,t,null,null,Xi,i).catch(i)}decodeDracoFile(e,t,i,r,n=Ed,s=()=>{}){let a={attributeIDs:i||this.defaultAttributeIDs,attributeTypes:r||this.defaultAttributeTypes,useUniqueIDs:!!i,vertexColorSpace:n};return this.decodeGeometry(e,a).then(t).catch(s)}decodeGeometry(e,t){let i=JSON.stringify(t);if(Q3.has(e)){let o=Q3.get(e);if(o.key===i)return o.promise;if(e.byteLength===0)throw new Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.")}let r,n=this.workerNextTaskID++,s=e.byteLength,a=this._getWorker(n,s).then(o=>(r=o,new Promise((l,h)=>{r._callbacks[n]={resolve:l,reject:h},r.postMessage({type:"decode",id:n,taskConfig:t,buffer:e},[e])}))).then(o=>this._createGeometry(o.geometry));return a.catch(()=>!0).then(()=>{r&&n&&this._releaseTask(r,n)}),Q3.set(e,{key:i,promise:a}),a}_createGeometry(e){let t=new At;e.index&&t.setIndex(new Dt(e.index.array,1));for(let i=0;i<e.attributes.length;i++){let r,{name:n,array:s,itemSize:a,stride:o,vertexColorSpace:l}=e.attributes[i];if(a===o)r=new Dt(s,a);else{let h=new ix(s,o);r=new mg(h,a,0)}n==="color"&&(this._assignVertexColorSpace(r,l),r.normalized=!(s instanceof Float32Array)),t.setAttribute(n,r)}return t}_assignVertexColorSpace(e,t){if(t!==Xi)return;let i=new lt;for(let r=0,n=e.count;r<n;r++)i.fromBufferAttribute(e,r),ai.colorSpaceToWorking(i,Xi),e.setXYZ(r,i.r,i.g,i.b)}_loadLibrary(e,t){let i=new PE(this.manager);return i.setResponseType(t),i.setWithCredentials(this.withCredentials),new Promise((r,n)=>{i.load(e,r,void 0,n)})}preload(){return this._initDecoder(),this}_initDecoder(){if(this.decoderPending)return this.decoderPending;let e=typeof WebAssembly!="object"||this.decoderConfig.type==="js",t=[],{decoderPaths:i}=this;if(e){if(i.dep_js===null)throw new Error("THREE.DRACOLoader: WebAssembly is required when using a custom decoder paths.");t.push(this._loadLibrary(i.dep_js,"text"))}else t.push(this._loadLibrary(i.js,"text")),t.push(this._loadLibrary(i.wasm,"arraybuffer"));return this.decoderPending=Promise.all(t).then(r=>{let n=r[0];e||(this.decoderConfig.wasmBinary=r[1]);let s=yFe.toString(),a=["/* draco decoder */",n,"","/* worker */",s.substring(s.indexOf("{")+1,s.lastIndexOf("}"))].join(`
|
|
5389
|
-
`);this.workerSourceURL=URL.createObjectURL(new Blob([a]))}),this.decoderPending}_getWorker(e,t){return this._initDecoder().then(()=>{if(this.workerPool.length<this.workerLimit){let r=new Worker(this.workerSourceURL);r._callbacks={},r._taskCosts={},r._taskLoad=0,r.postMessage({type:"init",decoderConfig:this.decoderConfig}),r.onmessage=function(n){let s=n.data;switch(s.type){case"decode":r._callbacks[s.id].resolve(s);break;case"error":r._callbacks[s.id].reject(s);break;default:console.error('THREE.DRACOLoader: Unexpected message, "'+s.type+'"')}},this.workerPool.push(r)}else this.workerPool.sort(function(r,n){return r._taskLoad>n._taskLoad?-1:1});let i=this.workerPool[this.workerPool.length-1];return i._taskCosts[e]=t,i._taskLoad+=t,i})}_releaseTask(e,t){e._taskLoad-=e._taskCosts[t],delete e._callbacks[t],delete e._taskCosts[t]}debug(){console.log("Task load: ",this.workerPool.map(e=>e._taskLoad))}dispose(){for(let e=0;e<this.workerPool.length;++e)this.workerPool[e].terminate();return this.workerPool.length=0,this.workerSourceURL!==""&&URL.revokeObjectURL(this.workerSourceURL),this}}}),bFe=U(()=>{});function XSe(e){return function(t,{basePath:i,moduleUrl:r,cdnBuild:n}){if(i!==void 0)return{url:`${i}/${t}`};let s=`${n}/${t}`;if(r===void 0||r.startsWith("file:"))return{url:s};let a=r.slice(0,r.lastIndexOf("/")+1)+t;return a===s?{url:a}:{url:a,fallback:s}}(e,{basePath:YSe,moduleUrl:typeof import.meta.url=="string"?import.meta.url:void 0,cdnBuild:"https://cdn.spline.design/@splinetool/runtime@2.0.
|
|
5389
|
+
`);this.workerSourceURL=URL.createObjectURL(new Blob([a]))}),this.decoderPending}_getWorker(e,t){return this._initDecoder().then(()=>{if(this.workerPool.length<this.workerLimit){let r=new Worker(this.workerSourceURL);r._callbacks={},r._taskCosts={},r._taskLoad=0,r.postMessage({type:"init",decoderConfig:this.decoderConfig}),r.onmessage=function(n){let s=n.data;switch(s.type){case"decode":r._callbacks[s.id].resolve(s);break;case"error":r._callbacks[s.id].reject(s);break;default:console.error('THREE.DRACOLoader: Unexpected message, "'+s.type+'"')}},this.workerPool.push(r)}else this.workerPool.sort(function(r,n){return r._taskLoad>n._taskLoad?-1:1});let i=this.workerPool[this.workerPool.length-1];return i._taskCosts[e]=t,i._taskLoad+=t,i})}_releaseTask(e,t){e._taskLoad-=e._taskCosts[t],delete e._callbacks[t],delete e._taskCosts[t]}debug(){console.log("Task load: ",this.workerPool.map(e=>e._taskLoad))}dispose(){for(let e=0;e<this.workerPool.length;++e)this.workerPool[e].terminate();return this.workerPool.length=0,this.workerSourceURL!==""&&URL.revokeObjectURL(this.workerSourceURL),this}}}),bFe=U(()=>{});function XSe(e){return function(t,{basePath:i,moduleUrl:r,cdnBuild:n}){if(i!==void 0)return{url:`${i}/${t}`};let s=`${n}/${t}`;if(r===void 0||r.startsWith("file:"))return{url:s};let a=r.slice(0,r.lastIndexOf("/")+1)+t;return a===s?{url:a}:{url:a,fallback:s}}(e,{basePath:YSe,moduleUrl:typeof import.meta.url=="string"?import.meta.url:void 0,cdnBuild:"https://cdn.spline.design/@splinetool/runtime@2.0.123/build"})}function v4(e,t){let{url:i,fallback:r}=XSe(t);r!==void 0&&e.addEventListener("error",()=>{e.src=r},{once:!0}),e.src=i}var YSe,VB=U(()=>{bFe()});function l0(e,t){GB.set(e,t)}function xFe(e){return GB.get(e)}function KSe(e,t){RK.set(e,t)}function dne(e){return RK.get(e)}function fq(e,t){let i=`${t}:${e}`;mq.has(i)||mq.add(i)}var GB,RK,mq,Mu=U(()=>{GB=new Map,RK=new Map,mq=new Set});function cne(e,t,i){return e*(t-i)-t}function Sz(e,t,i){return Math.min(Math.max((e+t)/(t-i),0),1)}function pne(e,t,i){for(let r of t){let n="$1"+e+r.charAt(0).toUpperCase()+r.slice(1),s=new RegExp("([^\\.])(\\b"+r+"\\b)","g");for(let a of i.entries())a[1]!==null&&i.set(a[0],a[1].replace(s,n))}}function wFe(e,t,i,r,n,s,a){let o=new Map([["fragment",t.getFragmentShader()],["vertex",t.getVertexShader()]]),l=o.get("fragment")!==void 0&&/mainImage/.test(o.get("fragment")),h=o.get("fragment")!==void 0&&/mainUv/.test(o.get("fragment")),u=[],d=[],c=!1,p=!1;if(o.get("fragment")===void 0)console.error("Missing fragment shader",t);else if(h&&(a&ad.CONVOLUTION)!==0)console.error("Effects that transform UV coordinates are incompatible with convolution effects",t);else if(l||h){let f=/(?:\w+\s+(\w+)\([\w\s,]*\)\s*{[^}]+})/g,m=nO.Section;if(h){let v=` ${e}MainUv(UV);
|
|
5390
5390
|
`;i.set(m.FRAGMENT_MAIN_UV,i.get(m.FRAGMENT_MAIN_UV)+v),c=!0}if(o.get("vertex")!==null&&/mainSupport/.test(o.get("vertex"))){let v=` ${e}MainSupport(`;v+=/mainSupport *\([\w\s]*?uv\s*?\)/.test(o.get("vertex"))?`vUv);
|
|
5391
5391
|
`:`);
|
|
5392
5392
|
`,i.set(m.VERTEX_MAIN_SUPPORT,i.get(m.VERTEX_MAIN_SUPPORT)+v),u=u.concat([...o.get("vertex").matchAll(/(?:varying\s+\w+\s+(\w*))/g)].map(y=>y[1])),d=d.concat(u).concat([...o.get("vertex").matchAll(f)].map(y=>y[1]))}d=d.concat([...o.get("fragment").matchAll(f)].map(v=>v[1])),d=d.concat([...t.defines.keys()].map(v=>v.replace(/\([\w\s,]*\)/g,""))),d=d.concat([...t.uniforms.keys()]),t.uniforms.forEach((v,y)=>s.set(e+y.charAt(0).toUpperCase()+y.slice(1),v)),t.defines.forEach((v,y)=>n.set(e+y.charAt(0).toUpperCase()+y.slice(1),v)),pne(e,d,n),pne(e,d,o);let g=t.blendMode;if(r.set(g.blendFunction,g),l){let v=/MainImage *\([\w\s,]*?depth[\w\s,]*?\)/,y=`${e}MainImage(color0, UV, `;(a&ad.DEPTH)!==0&&v.test(o.get("fragment"))&&(y+="depth, ",p=!0),y+=`color1);
|
|
@@ -12288,7 +12288,7 @@ void main() {
|
|
|
12288
12288
|
gl_FragColor = texel;
|
|
12289
12289
|
}
|
|
12290
12290
|
`,uniforms:{inputBuffer:new Qe(null),uResolution:new Qe(new Z),uDPR:new Qe(1)}}),"inputBuffer"),this.needsSwap=!0}get uniforms(){return this.fullscreenMaterial.uniforms}}});function K0e(e,t){return t&&t.enabled&&e.push(t.effect),e}var Z0e,YCe,au,V9,KCe,vke=U(()=>{ks(),zt(),ae(),Oh(),Mu(),ike(),XCe(),rke(),$Ce(),nke(),dke(),cke(),pke(),fke(),mke(),gke(),Z0e=e=>Object.values(Pr).includes(e)?e:Pr.NORMAL,YCe=class extends cs{constructor(e,t){super(),this._needsDOFResize=t,this.postprocessingState=CA.defaultData,this._scene=new Ko,this._camera=new Qn,this.effects=new Map,this.blueNoiseTexture=new Ir,this._renderToScreen=!0,this._isUIOverlayEnabled=!1,this.timer=new a_e,this.renderer=e,this.debug=!1;for(let[r,n]of GB)this.effects.set(r,n());this.effectComposer=new ICe(this.renderer),this.effectComposer.autoRenderToScreen=!1,this.opaquePass=new X4(!0,this.scene,this.camera),this.opaquePass.clear=!0,this.transmissionPass=new NCe(this.scene,this.camera,this.renderer),this.aoPass=new VCe(this.scene,this.camera),this.taaPass=new DCe,this.taaPass.renderToScreen=!1,this.helperPass=new OCe(this.camera),this.helperPass.renderToScreen=!1;let i=()=>{this.dispatchEvent({type:"smaaloaded"})};this.aoPass.onSmaaTexturesLoaded=i,this.helperPass.onSmaaTexturesLoaded=i,this.stylesOverlayPass=new GCe,this.stylesOverlayPass.enabled=!1,this.uiOverlayPass=new WCe,this.uiOverlayPass.enabled=!1,this.logoOverlayPass=new HCe,this.logoOverlayPass.enabled=!1,this.sceneTransitionPass=new jCe,this.sceneTransitionPass.enabled=!1,this.srgbToLinear=new qCe,this.srgbToLinear.enabled=!1,this._initCopyPass(),this._initPasses()}set overlayTexture(e){e!==void 0?(this.stylesOverlayPass.texture=e,this.stylesOverlayPass.enabled=!0):this.stylesOverlayPass.enabled=!1}get overlayTexture(){return this.stylesOverlayPass.texture}set sceneHelpers(e){this.helperPass.sceneHelpers=e}get sceneHelpers(){return this.helperPass.sceneHelpers}set sceneHelpersOnTop(e){this.helperPass.sceneHelpersOnTop=e}get sceneHelpersOnTop(){return this.helperPass.sceneHelpersOnTop}get scene(){return this._scene}set scene(e){this._scene=e,this.opaquePass.setScene(e),this.transmissionPass.setScene(e),this.aoPass.setScene(e)}get camera(){return this._camera}set camera(e){let t=this._camera!==e;this._camera=e,this.opaquePass.setCamera(e),this.transmissionPass.setCamera(e),t&&this.transmissionPass.updatePasses(this.renderer),this.aoPass.setCamera(e),this.helperPass.setCamera(e),this.effects.get("depthOfField")?.setCamera(e)}updateRenderToScreen(){let e=!1;for(let t=this.effectComposer.passes.length-1;t>=0;t--){let i=this.effectComposer.passes[t];i.enabled!==!0||e||!this._renderToScreen?i.renderToScreen=!1:(i.renderToScreen=!0,e=!0)}}get isUIOverlayEnabled(){return this._isUIOverlayEnabled}disableUIOverlay(){this._isUIOverlayEnabled=!1}enableUIOverlay(){this._isUIOverlayEnabled=!0}disableHelpers(){this.helperPass.enabled=!1,this.updateRenderToScreen()}enableHelpers(){this.helperPass.enabled=!0,this.updateRenderToScreen()}updateBlueNoiseTexture(e){this.blueNoiseTexture=new Ir(e,128,128),this.blueNoiseTexture.wrapS=ss,this.blueNoiseTexture.wrapT=ss,this.blueNoiseTexture.minFilter=yt,this.blueNoiseTexture.magFilter=yt,this.blueNoiseTexture.needsUpdate=!0}setAmbientOcclusionParams(e,t,i,r,n,s,a,o,l){this.aoPass.enabled=e,this.aoPass.radius=t,this.aoPass.bias=i,this.aoPass.aoColor=r,this.aoPass.fogEnabled=n,this.aoPass.fogNear=s,this.aoPass.fogFar=a,this.aoPass.fogMode=Yn.getModeIndex({mode:o.mode}),this.aoPass.fogHeightParams.set(o.density,o.heightFalloff,o.heightBase),this.aoPass.runHalfRes!==!l&&(this.aoPass.runHalfRes=!l)}setTransmissionPassEnabled(e){this.transmissionPass.enabled=e,this.opaquePass.hasTransmissionPass=e}_initPasses(){if(this.uvEffectPass?.dispose(),this.effectPass?.dispose(),this.effectComposer.removeAllPasses(),this.transmissionPass.updatePasses(this.renderer),this.effectComposer.addPass(this.aoPass),this.effectComposer.addPass(this.opaquePass),this.effectComposer.addPass(this.transmissionPass),this.effectComposer.addPass(this.taaPass),this.postprocessingState.enabled){let e=[this.effects.get("pixelation")].reduce(K0e,[]);e.length>0&&(this.uvEffectPass=new FA(this.camera,...e),this.uvEffectPass.renderToScreen=!1,this.uvEffectPass.encodeOutput=!1,this.effectComposer.addPass(this.uvEffectPass));let t=[this.effects.get("chromaticAberration"),this.effects.get("bloom"),this.effects.get("depthOfField"),this.effects.get("colorAverage"),this.effects.get("hueSaturation"),this.effects.get("brightnessContrast"),this.effects.get("vignette"),this.effects.get("noise")].reduce(K0e,[]);if(t.length>0&&(this.effectPass=new FA(this.camera,...t),this.effectPass.renderToScreen=!1,this.effectPass.encodeOutput=!1,this.effectComposer.addPass(this.effectPass),this._needsDOFResize&&this.effects.get("depthOfField")?.enabled&&window!==void 0)){let i=this.renderer.viewportWidth,r=this.renderer.viewportHeight;this.renderer.setSize(i-1,r-1),this.renderer.setSize(i,r)}}this.effectComposer.addPass(this.stylesOverlayPass),this.effectComposer.addPass(this.uiOverlayPass),this.effectComposer.addPass(this.sceneTransitionPass),this.effectComposer.addPass(this.helperPass),this.effectComposer.addPass(this.srgbToLinear),this.effectComposer.addPass(this.logoOverlayPass)}_initCopyPass(){if(this._savePass)return;let e=new Z;this.renderer.getDrawingBufferSize(e),this._rt=new yr(e.x,e.y,{depthBuffer:!1,stencilBuffer:!1,wrapS:ss,wrapT:ss}),this._rt.samples=0,this.renderer.outputColorSpace===Xi&&(this._rt.texture.colorSpace=Xi),this._savePass=new y4(this._rt,!1),this._savePass.renderToScreen=!1}setCopyPass(e){this._rt=e,this._savePass=new y4(this._rt,!1),this.renderToScreen=!1}get renderToScreen(){return this._renderToScreen}set renderToScreen(e){if(this._renderToScreen===e)return;let t=this.effectComposer;!t||(e===!0?t.removePass(this._savePass):t.addPass(this._savePass),this._renderToScreen=e,this.updateRenderToScreen())}get sceneTransitionFromTexture(){return this.sceneTransitionPass.texture}set sceneTransitionFromTexture(e){e!==this.sceneTransitionPass.texture&&(e!==null?this.sceneTransitionPass.enabled=!0:(this.sceneTransitionPass.enabled=!1,this.updateRenderToScreen()),this.sceneTransitionPass.texture=e)}setWatermark(e){this.logoOverlayPass.enabled=e!==null,e&&(this.logoOverlayPass.texture=e)}get texture(){return this._rt&&this._rt.texture}get renderTarget(){return this._rt}updatePostprocessing(e){let{enabled:t,...i}=e,r=!1;t!==this.postprocessingState.enabled&&(r=!0);for(let n of Object.entries(i)){let s=n[1],a=this.effects.get(n[0]);if(!a){let o=xFe(n[0]);o?(a=o(),this.effects.set(n[0],a),n[0]==="depthOfField"&&a.setCamera(this._camera)):s?.enabled&&fq(n[0],"webgl")}if(a){a.enabled!==s.enabled&&(r=!0),a.enabled=s.enabled;for(let[o,l]of Object.entries(s))o==="blendFunction"?a.blendFunction=Z0e(l):a[o]=l}}this.postprocessingState=e,r&&this._initPasses()}render(){this.renderer.shadowMap.type===cA&&this._normalizeShadowDepthTextures(),this.timer.update(),this.effectComposer.render(this.timer.getDelta())}_normalizeShadowDepthTextures(){this._scene.traverse(e=>{let t=e;if(!t.isLight)return;let i=t.shadow?.map?.depthTexture;i&&i.compareFunction!==null&&(i.compareFunction=null,i.minFilter=yt,i.magFilter=yt,i.needsUpdate=!0)})}setScissor(e,t,i,r){e instanceof ct?(this.effectComposer.inputBuffer.scissor.set(e.x,e.y,e.z,e.w),this.effectComposer.outputBuffer.scissor.set(e.x,e.y,e.z,e.w)):(this.effectComposer.inputBuffer.scissor.set(e,t,i,r),this.effectComposer.outputBuffer.scissor.set(e,t,i,r));let n=this.renderer.getPixelRatio();this.effectComposer.inputBuffer.scissor.multiplyScalar(n),this.effectComposer.outputBuffer.scissor.multiplyScalar(n),this.renderer.setScissor(e,t,i,r)}setScissorTest(e){this.effectComposer.inputBuffer.scissorTest=e,this.effectComposer.outputBuffer.scissorTest=e,this.renderer.setScissorTest(e)}setViewport(e,t,i,r){e instanceof ct?(this.effectComposer.inputBuffer.viewport.copy(e),this.effectComposer.outputBuffer.viewport.copy(e)):(this.effectComposer.inputBuffer.viewport.set(e,t,i,r),this.effectComposer.outputBuffer.viewport.set(e,t,i,r))}resize(e,t,i){if(this.effectComposer.setSize(e,t,i),this._rt){let r=this.renderer.getPixelRatio();this._rt.setSize(e*r,t*r)}}dispose(){this.uvEffectPass?.dispose(),this.effectPass?.dispose(),this.effectComposer.dispose(),this.blueNoiseTexture.dispose(),this._rt?.dispose(),this.effects.forEach(e=>e.dispose()),this.effects.clear(),this._scene=void 0,this._camera=void 0,this.renderer=void 0}}}),yke=U(()=>{ae(),Kze(),AK(),Zze(),kB(),Oh(),Rd(),QB(),MMe(),lK(),vke(),kw(),oCe(),zt(),jr(),au=new Ri,V9=new Z,KCe=class extends L_e{constructor(e){super(e),this._pixelRatio=this.getPixelRatio(),this.viewportWidth=1,this.viewportHeight=1,this.resolution=new Z,this.dummyCamera=new Qn,this.sceneTransitionDuration=0,this.sceneTransitionTimeRemaining=-1,this.manageShadowUpdates=!1,this.forceShadowUpdates=!1,this.clear=(n=!0,s=!0,a=!0)=>{let o=this.getContext(),l=0;n&&(l|=o.COLOR_BUFFER_BIT),s&&(l|=o.DEPTH_BUFFER_BIT),a&&(l|=o.STENCIL_BUFFER_BIT),o.clear(l),o.clearBufferfv(o.COLOR,1,[0,0,0,1])},ECe(),this.pipeline=new YCe(this,e?.needsDOFResize??!1),this.autoClear=!1;let t=this.renderBufferDirect;this.renderBufferDirect=(n,s,a,o,l,h)=>{$2e(o)&&t.call(this,n,s,a,o.getDepthPrepassTwin(o.side),l,h),t.call(this,n,s,a,o,l,h)};let i=this.setPixelRatio.bind(this),r=this.setSize.bind(this);this.shadowMap.enabled=!0,this.shadowMap.type=cA,this.dummyCamera.matrixAutoUpdate=!1,this.domElement.removeAttribute("data-engine"),this._applyPreferredDrawingBufferColorSpace(),this.setPixelRatio=n=>{this._pixelRatio!==n&&(this._pixelRatio=n,i(n))},this.setSize=(n,s,a=!0)=>{(this.viewportWidth!==n||this.viewportHeight!==s)&&(this.viewportWidth=n,this.viewportHeight=s,r(n,s,a),this.normalRenderTarget?.setSize(n*this._pixelRatio,s*this._pixelRatio),this._resizeTransmission(n,s),this.transmissionDepthTarget?.setSize(n*this._pixelRatio/2,s*this._pixelRatio/2),this.pipeline.resize(n,s,a))},this._superDispose=this.dispose,this.dispose=this._currentDispose}_applyPreferredDrawingBufferColorSpace(){let e=this.getContext();if(e&&"drawingBufferColorSpace"in e)try{e.drawingBufferColorSpace="display-p3"}catch(t){console.warn(t)}}get outputColorSpace(){return super.outputColorSpace}set outputColorSpace(e){super.outputColorSpace=e,this._applyPreferredDrawingBufferColorSpace()}createAORenderTarget(){this.aoRenderTarget===void 0&&(this.aoRenderTarget=new yr(this.viewportWidth*this._pixelRatio,this.viewportHeight*this._pixelRatio,{generateMipmaps:!1,minFilter:nt,magFilter:nt,wrapS:vr,wrapT:vr,depthBuffer:!1}))}_resizeTransmission(e,t){this.transmissionRenderTarget?.setSize(e*this._pixelRatio/(this.hdTransmission?1:2),t*this._pixelRatio/(this.hdTransmission?1:2)),this.aoRenderTarget?.setSize(e*this._pixelRatio/1,t*this._pixelRatio/1)}get hdTransmission(){return $t.transmissionLod.value===1}set hdTransmission(e){$t.transmissionLod.value=e===!0?1:2,this._resizeTransmission(this.viewportWidth,this.viewportHeight)}createTransmissionRenderTarget(){this.transmissionRenderTarget===void 0&&(this.transmissionRenderTarget=new yr(this.viewportWidth*this._pixelRatio/(this.hdTransmission?1:2),this.viewportHeight*this._pixelRatio/(this.hdTransmission?1:2),{generateMipmaps:!0,minFilter:Rn,magFilter:nt,wrapS:vr,wrapT:vr,depthBuffer:!1}),this.transmissionDepthTarget=new yr(this.viewportWidth*this._pixelRatio/2,this.viewportHeight*this._pixelRatio/2,{minFilter:yt,magFilter:yt,depthBuffer:!1}))}createNormalRenderTarget(e){let t=e.outline&&e.cavity?"both":e.cavity?"normals":"hash";this.normalRenderTarget!==void 0&&this.normalRenderTargetFlavor!==t&&(this.normalRenderTarget.depthTexture?.dispose(),this.normalRenderTarget.dispose(),this.normalRenderTarget=void 0),this.normalRenderTarget===void 0&&(this.normalRenderTarget=new yr(this.viewportWidth*this._pixelRatio,this.viewportHeight*this._pixelRatio,{count:t==="both"?2:1,generateMipmaps:!1,minFilter:yt,magFilter:yt,type:t==="normals"?di:Wt,depthTexture:new as(this.viewportWidth*this._pixelRatio,this.viewportHeight*this._pixelRatio)}),t==="both"&&(this.normalRenderTarget.textures[1].type=di),this.normalRenderTargetFlavor=t)}renderNormal(e,t,i){if(this.normalRenderTarget){this.setClearColor(0),i.layers.enable(8),i.layers.disable(0),i.layers.disable(3),t.traverseEntity(n=>{n.layers.isEnabled(8)&&(n.copyPreviousMatrix=!1)}),this.setRenderTarget(this.normalRenderTarget),this.clear(),aX.value=i instanceof Qn?(i.far-i.near)/1e4:1;let r=this.normalRenderTargetFlavor??"hash";t.overrideMaterial=r==="both"?MCe:r==="normals"?TCe:SCe,this.render(t,i),this.setClearColor(t.bgColor,t.bgColor.a),this.setRenderTarget(null),t.overrideMaterial=e.wireframeState?g4:null,i.layers.enable(0),i.layers.enable(3),t.traverseEntity(n=>{n.layers.isEnabled(8)&&(n.copyPreviousMatrix=!0)})}}renderSplineSceneWithDummyCamera(e,t,i=1){this.dummyCamera.updateCameraState(t.dataPatched),this.dummyCamera.matrix.copy(t.matrixWorld);let r=t.height,n=t.width,s=this.viewportWidth/this.viewportHeight;n<r?n=r*s:r=n/s,this.dummyCamera.setViewplaneSize(n,r);for(let a=0;a<i;a++)this.renderSplineScene(e,this.dummyCamera)}renderSplineScene(e,t,{sceneHelpers:i=this.sceneHelpers,sceneHelpersOnTop:r=this.sceneHelpersOnTop,overrideTransmission:n,overrideNormal:s}={}){MSe(this);let a=e instanceof zg?e.activePage:e,o=a.visible;a.visible=!0;let l=a.scene,h=_y.isSoft(a.data.shadow)?cA:If;if(this.shadowMap.type!==h&&(this.shadowMap.type=h,a.traverseEntity(g=>{let v=g;v.isLight&&v.shadow?.map&&(v.shadow.map.dispose(),v.shadow.map=null,v.shadow.needsUpdate=!0)}),l.markShadowsDirty()),this.setClearColor(a.bgColor,a.bgColor.a),a.penumbraSizeArray.forEach((g,v)=>{$t.penumbraSize.value[v]=g}),$t.pixelRatioNode.value=this.getPixelRatio(),this.resolution.x!==0&&this.resolution.y!==0?$t.resolution.value.set(this.resolution.x,this.resolution.y):$t.resolution.value.set(this.viewportWidth*this._pixelRatio,this.viewportHeight*this._pixelRatio),s!==void 0)$t.normalRenderTarget.value=s,$t.normalRenderTargetDepth.value=au,$t.normalViewRenderTarget.value=au;else if(l.needsNormal()){let g=l.normalPassNeeds();this.createNormalRenderTarget(g);let v=this.normalRenderTargetFlavor,y=this.normalRenderTarget.textures;$t.normalRenderTarget.value=v==="normals"?au:y[0],$t.normalRenderTargetDepth.value=this.normalRenderTarget.depthTexture,$t.normalViewRenderTarget.value=v==="both"?y[1]:v==="normals"?y[0]:au,this.renderNormal(l,a,t)}i0.spe_fogMode.value=Yn.getModeIndex({mode:a.fogMode}),i0.spe_fogHeightParams.value.set(a.fogDensity??Yn.getDensity({}),a.fogHeightFalloff??Yn.getHeightFalloff({}),a.fogHeightBase??Yn.getHeightBase({}));let u=a.data.ao,d=u.occlusion&&!My.enabled;if(d&&(this.createAORenderTarget(),$t.aoRenderTarget.value=this.aoRenderTarget.texture),$t.aoEnabled.value=d,this.pipeline.setAmbientOcclusionParams(d,u.radius,u.bias,a.aoColor,a.fog!==null,a.backupFog.near,a.backupFog.far,{mode:a.fogMode??"linear",density:a.fogDensity??Yn.getDensity({}),heightFalloff:a.fogHeightFalloff??Yn.getHeightFalloff({}),heightBase:a.fogHeightBase??Yn.getHeightBase({})},u.aoFullRes&&!l1),this.pipeline.aoPass.setBlueNoiseTexture(this.pipeline.blueNoiseTexture),this.pipeline.isUIOverlayEnabled&&a.uiCanvas?.enabled&&a.uiCanvas.texture&&a.uiCanvas.texture.image.width>0){let g=this.getSize(V9),v=this.getPixelRatio();(a.uiCanvas.width!==this.viewportWidth||a.uiCanvas.height!==this.viewportHeight||a.uiCanvas.dpr!==v)&&a.uiCanvas.applySize({width:this.viewportWidth,height:this.viewportHeight},v),a.uiCanvas.render(this),this.pipeline.uiOverlayPass.uiCanvas=a.uiCanvas,this.pipeline.uiOverlayPass.enabled=!0,this.pipeline.uiOverlayPass.setResolution(g.x,g.y,v),this.pipeline.updateRenderToScreen()}else this.pipeline.uiOverlayPass.enabled=!1,this.pipeline.updateRenderToScreen();if(this.pipeline.logoOverlayPass.enabled){let g=this.getSize(V9),v=this.getPixelRatio();this.pipeline.logoOverlayPass.uniforms.uResolution.value.set(g.x,g.y),this.pipeline.logoOverlayPass.uniforms.uDPR.value=v}let c=!1;if(n!==void 0)$t.transmissionRenderTarget.value=n,$t.transmissionRenderTargetDepth.value=au,this.pipeline.setTransmissionPassEnabled(!1);else{let g=l.needsTransmission();g&&(this.transmissionRenderTarget===void 0&&(c=!0),this.createTransmissionRenderTarget(),$t.transmissionRenderTarget.value=this.transmissionRenderTarget.texture,$t.aspectRatio.value=(p=this.viewportWidth)>=(f=this.viewportHeight)?new Z(f/p,1):new Z(1,p/f),$t.transmissionRenderTargetDepth.value=this.transmissionDepthTarget.texture),this.pipeline.setTransmissionPassEnabled(g)}var p,f;t.layers.enable(3),t.layers.enable(8),t.layers.enable(4),this.pipeline.sceneHelpers=i,this.pipeline.sceneHelpersOnTop=r,this.pipeline.taaPass.enabled=$t.taaEnabled.value,this.pipeline.scene=a,this.pipeline.camera=t,c&&this.pipeline.transmissionPass.updatePasses(this);let m=TMe(a.postprocessing);this.pipeline.postprocessingState!==m&&(this.pipeline.updatePostprocessing(m),!i&&!r&&this.pipeline.disableHelpers()),this.clearAlphaOverride!==void 0&&this.setClearAlpha(this.clearAlphaOverride),l.shapeBlendIntances.forEach(g=>{g.onBeforeShadowPass(this)}),!My.enabled&&Qwe(a)&&(l.shadowsDirty=!0),this.manageShadowUpdates&&(this.shadowMap.autoUpdate=!1,(l.shadowsDirty||this.forceShadowUpdates)&&(this.shadowMap.needsUpdate=!0)),a.overrideMaterial=l.wireframeState?g4:null,this.pipeline.render(),this.manageShadowUpdates&&(l.shadowsDirty=!1),$t.taaEnabled.value&&($t.frameIndex.value=($t.frameIndex.value+1)%16),t instanceof Qn&&t.copyHistory(),a.visible=o}renderFromSceneForSceneTransitionPass(e,t,i){this.pipeline.renderToScreen=!1,this.pipeline.renderTarget,this.renderSplineScene(e,t),this.pipeline.sceneTransitionFromTexture=this.pipeline.renderTarget.texture,this.sceneTransitionDuration=i,this.sceneTransitionTimeRemaining=i,this.pipeline.renderToScreen=!0;let r=this.pipeline.sceneTransitionPass.uniforms;r.uDPR.value=window.devicePixelRatio,r.uResolution.value.set(this.domElement.width,this.domElement.height).divideScalar(window.devicePixelRatio)}_currentDispose(){this._superDispose(),this.pipeline.dispose(),this.aoRenderTarget?.dispose(),this.aoRenderTarget=void 0,this.transmissionRenderTarget?.dispose(),this.transmissionRenderTarget=void 0,this.transmissionDepthTarget?.dispose(),this.transmissionDepthTarget=void 0,this.normalRenderTarget?.depthTexture?.dispose(),this.normalRenderTarget?.dispose(),this.normalRenderTarget=void 0,this.normalRenderTargetFlavor=void 0,this.dummyCamera.dispose(),this.dummyCamera=void 0,$t.normalRenderTarget.value=au,$t.normalRenderTargetDepth.value=au,$t.normalViewRenderTarget.value=au,$t.transmissionRenderTarget.value=au,$t.transmissionRenderTargetDepth.value=au,$t.aoRenderTarget.value=au}}}),oX={};yw(oX,{SplineRenderer:()=>KCe,rendererGlobals:()=>$t});var Q0e=U(()=>{Yze(),yke(),Rd()}),ZCe={};function QCe(e){let t;if(e.index)for(let i=0;i<e.index.array.length;i+=3)t=e.index.array[i],e.index.array[i]=e.index.array[i+2],e.index.array[i+2]=t}function eM(e){return e instanceof ow?"SubdivObject":e.geometry.type==="NonParametricGeometry"?"NonParametric":"Mesh"}function _ke(e,t){let i=function(c,p){let f={};return c.traverseEntity(m=>{if(!m.visible||!(m instanceof Es)||m.type!=="Mesh"||Array.isArray(m.material)||m.states&&Object.keys(m.states).length)return;let g=m.parent;for(;g;){if(g instanceof Es&&m.states&&Object.keys(m.states).length)return;g=g.parent}let v=m.material.uuid,y=p.shared.materials[v];if(y){if(!Kn.isMergable(y))return}else{let b=p.scene.objects.get(m.uuid)?.data;if(b&&"material"in b&&typeof b.material!="string"){if(!Kn.isMergable(b.material))return;v=Kn.getHash(b.material)}}f[v]||(f[v]={});let _=f[v][eM(m)];if(_){if(_.push(m),m.cloner)for(let b of m.cloner.children)_.push(b)}else if(f[v][eM(m)]=[m],m.cloner)for(let b of m.cloner.children)f[v][eM(m)].push(b)}),f}(t,e),r=function(c){let p=0;return Object.values(c).forEach(f=>{Object.values(f).forEach(m=>{let g=m.length;g>p&&(p=g)})}),p}(i),n=new Array(r),s=0,a=new Array(r),o=0,l=new Array(r),h=0,u=new Array(r),d=0;for(let[c,p]of Object.entries(i))for(let f of Object.values(p)){if(o=0,h=0,f.forEach(g=>{g instanceof Es&&(a[o++]=g.geometry.clone(),l[h++]=g)}),h<2)continue;for(let g=0;g<h;g++)l[g].updateWorldMatrix(!0,!1),a[g].applyMatrix4(l[g].matrixWorld),l[g].matrixWorld.determinant()<0&&QCe(a[g]);let m=sy(a.slice(0,o),!1);if(m){let g;c==="SubdivObject"?(console.warn("Turning subdiv object into mesh"),g=new Tr(m,l[0].material)):g=new Tr(m,l[0].material),g.castShadow=l[0].castShadow,g.receiveShadow=l[0].receiveShadow,t.add(g);let v=y=>{d=0;for(let _ of y)_.children&&v(_.children),_ instanceof Es&&(Array.isArray(_.material)||i[_.material.uuid]&&i[_.material.uuid][eM(_)]&&i[_.material.uuid][eM(_)].length>1||(u[d++]=_));for(let _=0;_<d;_++)t.attach(u[_])};for(let y=0;y<h;y++){let _=l[y];v(_.children),n[s++]=_}}}for(let c=0;c<s;c++)n[c].removeFromParent()}yw(ZCe,{mergeStaticGeometries:()=>_ke,reverseWindingOrder:()=>QCe});var bke=U(()=>{zt(),ae(),JA(),Na(),lC()});ae();var tM=".",lX=Symbol("target"),JCe=Symbol("unsubscribe");function hX(e){return e instanceof Date||e instanceof Set||e instanceof Map||e instanceof WeakSet||e instanceof WeakMap||ArrayBuffer.isView(e)}var Lc=Array.isArray;function wZ(e){return typeof e=="symbol"}var xke={after:(e,t)=>Lc(e)?e.slice(t.length):t===""?e:e.slice(t.length+1),concat:(e,t)=>Lc(e)?(e=[...e],t&&e.push(t),e):t&&t.toString!==void 0?(e!==""&&(e+=tM),wZ(t)?e+t.toString():e+t):e,initial:e=>{if(Lc(e))return e.slice(0,-1);if(e==="")return e;let t=e.lastIndexOf(tM);return t===-1?"":e.slice(0,t)},last:e=>{if(Lc(e))return e[e.length-1]||"";if(e==="")return e;let t=e.lastIndexOf(tM);return t===-1?e:e.slice(t+1)},walk:(e,t)=>{if(Lc(e))for(let i of e)t(i);else if(e!==""){let i=0,r=e.indexOf(tM);if(r===-1)t(e);else for(;i<e.length;)r===-1&&(r=e.length),t(e.slice(i,r)),i=r+1,r=e.indexOf(tM,i)}},get(e,t){return this.walk(t,i=>{e&&(e=e[i])}),e}},pu=xke;function J0e(e,t,i){return e.isUnsubscribed||t.ignoreSymbols&&wZ(i)||t.ignoreUnderscores&&i.charAt(0)==="_"||"ignoreKeys"in t&&t.ignoreKeys.includes(i)}var wke=class{constructor(e){this._equals=e,this._proxyCache=new WeakMap,this._pathCache=new WeakMap,this.isUnsubscribed=!1}_getDescriptorCache(){return this._descriptorCache===void 0&&(this._descriptorCache=new WeakMap),this._descriptorCache}_getProperties(e){let t=this._getDescriptorCache(),i=t.get(e);return i===void 0&&(i={},t.set(e,i)),i}_getOwnPropertyDescriptor(e,t){if(this.isUnsubscribed)return Reflect.getOwnPropertyDescriptor(e,t);let i=this._getProperties(e),r=i[t];return r===void 0&&(r=Reflect.getOwnPropertyDescriptor(e,t),i[t]=r),r}getProxy(e,t,i,r){if(this.isUnsubscribed)return e;let n=e[r],s=n||e;this._pathCache.set(s,t);let a=this._proxyCache.get(s);return a===void 0&&(a=n===void 0?new Proxy(e,i):e,this._proxyCache.set(s,a)),a}getPath(e){return this.isUnsubscribed?void 0:this._pathCache.get(e)}isDetached(e,t){return!Object.is(e,pu.get(t,this.getPath(e)))}defineProperty(e,t,i){return!!Reflect.defineProperty(e,t,i)&&(this.isUnsubscribed||(this._getProperties(e)[t]=i),!0)}setProperty(e,t,i,r,n){if(!this._equals(n,i)||!(t in e)){let s=this._getOwnPropertyDescriptor(e,t);return s!==void 0&&"set"in s?Reflect.set(e,t,i,r):Reflect.set(e,t,i)}return!0}deleteProperty(e,t,i){if(Reflect.deleteProperty(e,t)){if(!this.isUnsubscribed){let r=this._getDescriptorCache().get(e);r&&(delete r[t],this._pathCache.delete(i))}return!0}return!1}isSameDescriptor(e,t,i){let r=this._getOwnPropertyDescriptor(t,i);return e!==void 0&&r!==void 0&&Object.is(e.value,r.value)&&(e.writable||!1)===(r.writable||!1)&&(e.enumerable||!1)===(r.enumerable||!1)&&(e.configurable||!1)===(r.configurable||!1)&&e.get===r.get&&e.set===r.set}isGetInvariant(e,t){let i=this._getOwnPropertyDescriptor(e,t);return i!==void 0&&i.configurable!==!0&&i.writable!==!0}unsubscribe(){this._descriptorCache=null,this._pathCache=null,this._proxyCache=null,this.isUnsubscribed=!0}};function uX(e){return toString.call(e)==="[object Object]"}function IN(){return!0}function ab(e,t){return e.length!==t.length||e.some((i,r)=>t[r]!==i)}var e3e=new Set(["hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]),Ske=new Set(["concat","includes","indexOf","join","keys","lastIndexOf"]),t3e={push:IN,pop:IN,shift:IN,unshift:IN,copyWithin:ab,reverse:ab,sort:ab,splice:ab,flat:ab,fill:ab},Tke=new Set([...e3e,...Ske,...Object.keys(t3e)]);function ON(e,t){if(e.size!==t.size)return!0;for(let i of e)if(!t.has(i))return!0;return!1}var i3e=["keys","values","entries"],r3e=new Set(["has","toString"]),n3e={add:ON,clear:ON,delete:ON,forEach:ON},Mke=new Set([...r3e,...Object.keys(n3e),...i3e]);function LN(e,t){if(e.size!==t.size)return!0;let i;for(let[r,n]of e)if(i=t.get(r),i!==n||i===void 0&&!t.has(r))return!0;return!1}var Eke=new Set([...r3e,"get"]),s3e={set:LN,clear:LN,delete:LN,forEach:LN},Ake=new Set([...Eke,...Object.keys(s3e),...i3e]),r0=class{constructor(e,t,i,r){this._path=t,this._isChanged=!1,this._clonedCache=new Set,this._hasOnValidate=r,this._changes=r?[]:null,this.clone=t===void 0?e:this._shallowClone(e)}static isHandledMethod(e){return e3e.has(e)}_shallowClone(e){let t=e;if(uX(e))t={...e};else if(Lc(e))t=[...e];else if(e instanceof Date)t=new Date(e);else if(e instanceof Set)t=new Set([...e].map(i=>this._shallowClone(i)));else if(e instanceof Map){t=new Map;for(let[i,r]of e.entries())t.set(i,this._shallowClone(r))}return this._clonedCache.add(t),t}preferredThisArg(e,t,i,r){return e?(Lc(r)?this._onIsChanged=t3e[t]:r instanceof Set?this._onIsChanged=n3e[t]:r instanceof Map&&(this._onIsChanged=s3e[t]),r):i}update(e,t,i){let r=pu.after(e,this._path);if(t!=="length"){let n=this.clone;pu.walk(r,s=>{n&&n[s]&&(this._clonedCache.has(n[s])||(n[s]=this._shallowClone(n[s])),n=n[s])}),this._hasOnValidate&&this._changes.push({path:r,property:t,previous:i}),n&&n[t]&&(n[t]=i)}this._isChanged=!0}undo(e){let t;for(let i=this._changes.length-1;i!==-1;i--)t=this._changes[i],pu.get(e,t.path)[t.property]=t.previous}isChanged(e){return this._onIsChanged===void 0?this._isChanged:this._onIsChanged(this.clone,e)}},eve=class extends r0{static isHandledMethod(e){return Tke.has(e)}},Cke=class extends r0{undo(e){e.setTime(this.clone.getTime())}isChanged(e,t){return!t(this.clone.valueOf(),e.valueOf())}},tve=class extends r0{static isHandledMethod(e){return Mke.has(e)}undo(e){for(let t of this.clone)e.add(t);for(let t of e)this.clone.has(t)||e.delete(t)}},ive=class extends r0{static isHandledMethod(e){return Ake.has(e)}undo(e){for(let[t,i]of this.clone.entries())e.set(t,i);for(let t of e.keys())this.clone.has(t)||e.delete(t)}},Pke=class extends r0{constructor(e,t,i,r){super(void 0,t,i,r),this._arg1=i[0],this._weakValue=e.has(this._arg1)}isChanged(e){return this._weakValue!==e.has(this._arg1)}undo(e){this._weakValue&&!e.has(this._arg1)?e.add(this._arg1):e.delete(this._arg1)}},Rke=class extends r0{constructor(e,t,i,r){super(void 0,t,i,r),this._weakKey=i[0],this._weakHas=e.has(this._weakKey),this._weakValue=e.get(this._weakKey)}isChanged(e){return this._weakValue!==e.get(this._weakKey)}undo(e){let t=e.has(this._weakKey);this._weakHas&&!t?e.set(this._weakKey,this._weakValue):!this._weakHas&&t?e.delete(this._weakKey):this._weakValue!==e.get(this._weakKey)&&e.set(this._weakKey,this._weakValue)}},Qb=class{constructor(e){this._stack=[],this._hasOnValidate=e}static isHandledType(e){return uX(e)||Lc(e)||hX(e)}static isHandledMethod(e,t){return uX(e)?r0.isHandledMethod(t):Lc(e)?eve.isHandledMethod(t):e instanceof Set?tve.isHandledMethod(t):e instanceof Map?ive.isHandledMethod(t):hX(e)}get isCloning(){return this._stack.length>0}start(e,t,i){let r=r0;Lc(e)?r=eve:e instanceof Date?r=Cke:e instanceof Set?r=tve:e instanceof Map?r=ive:e instanceof WeakSet?r=Pke:e instanceof WeakMap&&(r=Rke),this._stack.push(new r(e,t,i,this._hasOnValidate))}update(e,t,i){this._stack[this._stack.length-1].update(e,t,i)}preferredThisArg(e,t,i){let{name:r}=e,n=Qb.isHandledMethod(i,r);return this._stack[this._stack.length-1].preferredThisArg(n,r,t,i)}isChanged(e,t,i){return this._stack[this._stack.length-1].isChanged(e,t,i)}undo(e){this._previousClone!==void 0&&this._previousClone.undo(e)}stop(){return this._previousClone=this._stack.pop(),this._previousClone.clone}},Dke={equals:Object.is,isShallow:!1,pathAsArray:!1,ignoreSymbols:!1,ignoreUnderscores:!1,ignoreDetached:!1,details:!1},dX=(e,t,i={})=>{i={...Dke,...i};let r=Symbol("ProxyTarget"),{equals:n,isShallow:s,ignoreDetached:a,details:o}=i,l=new wke(n),h=typeof i.onValidate=="function",u=new Qb(h),d=(y,_,b,x,w)=>!h||u.isCloning||i.onValidate(pu.concat(l.getPath(y),_),b,x,w)===!0,c=(y,_,b,x)=>{!J0e(l,i,_)&&(!a||!l.isDetached(y,e))&&p(l.getPath(y),_,b,x)},p=(y,_,b,x,w)=>{u.isCloning?u.update(y,_,x):t(pu.concat(y,_),b,x,w)},f=y=>y&&(y[r]||y),m=(y,_,b,x)=>function(w){return(typeof w=="object"?w===null:typeof w!="function")||w instanceof RegExp}(y)||b==="constructor"||s&&!Qb.isHandledMethod(_,b)||J0e(l,i,b)||l.isGetInvariant(_,b)||a&&l.isDetached(_,e)?y:(x===void 0&&(x=l.getPath(_)),l.getProxy(y,pu.concat(x,b),g,r)),g={get(y,_,b){if(wZ(_)){if(_===r||_===lX)return y;if(_===JCe&&!l.isUnsubscribed&&l.getPath(y).length===0)return l.unsubscribe(),y}let x=hX(y)?Reflect.get(y,_):Reflect.get(y,_,b);return m(x,y,_)},set(y,_,b,x){b=f(b);let w=y[r]||y,S=w[_];if(n(S,b)&&_ in y)return!0;let T=d(y,_,b,S);return T&&l.setProperty(w,_,b,x,S)?(c(y,_,y[_],S),!0):!T},defineProperty(y,_,b){if(!l.isSameDescriptor(b,y,_)){let x=y[_];d(y,_,b.value,x)&&l.defineProperty(y,_,b,x)&&c(y,_,b.value,x)}return!0},deleteProperty(y,_){if(!Reflect.has(y,_))return!0;let b=Reflect.get(y,_),x=d(y,_,void 0,b);return x&&l.deleteProperty(y,_,b)?(c(y,_,void 0,b),!0):!x},apply(y,_,b){let x=_[r]||_;if(l.isUnsubscribed)return Reflect.apply(y,x,b);if((o===!1||o!==!0&&!o.includes(y.name))&&Qb.isHandledType(x)){let w=pu.initial(l.getPath(y)),S=Qb.isHandledMethod(x,y.name);u.start(x,w,b);let T=Reflect.apply(y,u.preferredThisArg(y,_,x),S?b.map(A=>f(A)):b),M=u.isChanged(x,n),E=u.stop();if(Qb.isHandledType(T)&&S&&(_ instanceof Map&&y.name==="get"&&(w=pu.concat(w,b[0])),T=l.getProxy(T,w,g)),M){let A={name:y.name,args:b,result:T},P=u.isCloning?pu.initial(w):w,N=u.isCloning?pu.last(w):"";d(pu.get(e,P),N,x,E,A)?p(P,N,x,E,A):u.undo(x)}return(_ instanceof Map||_ instanceof Set)&&function(A){return typeof A=="object"&&typeof A.next=="function"}(T)?function(A,P,N,D,O){let z=A.next;if(P.name==="entries")A.next=function(){let B=z.call(this);return B.done===!1&&(B.value[0]=O(B.value[0],P,B.value[0],D),B.value[1]=O(B.value[1],P,B.value[0],D)),B};else if(P.name==="values"){let B=N[lX].keys();A.next=function(){let V=z.call(this);return V.done===!1&&(V.value=O(V.value,P,B.next().value,D)),V}}else A.next=function(){let B=z.call(this);return B.done===!1&&(B.value=O(B.value,P,B.value,D)),B};return A}(T,y,_,w,m):T}return Reflect.apply(y,_,b)}},v=l.getProxy(e,i.pathAsArray?[]:"",g);return t=t.bind(v),h&&(i.onValidate=i.onValidate.bind(v)),v};dX.target=e=>e&&e[lX]||e,dX.unsubscribe=e=>e[JCe]||e;var G9=dX;jr(),jr(),ae(),Pd();var Nke=class extends hB{constructor(){super(),function(e){for(let t of mxe)e.enable(t)}(this.layers)}setFromCamera(e,t){t.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,-1).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld),this.camera=t):t.isPerspectiveCamera?(this.ray.origin.set(e.x,e.y,-1).unproject(t),this.ray.direction.set(e.x,e.y,.5).unproject(t).sub(this.ray.origin).normalize(),this.camera=t):console.error("Raycaster: Unsupported camera type.")}intersectVisibleObjects(e,t=!0,i=[]){return e.forEach(r=>{r.visible&&this.intersectObject(r,t,i)}),i}createRaycastLineHelper(){let e=new ld({color:65280,linewidth:10}),t=new R(this.ray.origin.x,this.ray.origin.y,this.ray.origin.z),i=new R(this.ray.direction.x,this.ray.direction.y,this.ray.direction.z),r=this.camera.far-this.camera.near,n=new R().addVectors(t,i.multiplyScalar(r)),s=new At;return s.setFromPoints([t,n]),new AM(s,e)}};MB(),wl(),o0(),Zn();var a3e=e=>e instanceof Pc||WI(e);function Ike(e,t){return e.distance-t.distance}function o3e(e,t,i){if(wc(t)&&t.visible){yd(t)&&t.raycast(e,i);for(let r of t.children)o3e(e,r,i)}}function VO(e,t,i,r=!1){if(!r&&!i.some(s=>Y4(e,s)!==void 0))return[];let n=[];return t.children.forEach(s=>o3e(e,s,n)),n.sort(Ike),n}function cX(e){let t=[];if(e.length){let i=e[0].object;wc(i)&&t.push(i);let r=i.parent;for(;r;)a3e(r)&&t.push(r),r=r.parent}return t}function hf(e,t,i,r){let n=e.frame;if(n){let s=t[0]*n.width,a=(1-t[1])*n.height;for(let o of i){let l=o===n.uuid?n:n.find(o);if(l?.intersects(s,a))return r(l),!0}}return!1}function Y4(e,t){if(yd(t)){if(t.visible){let i=[];return t.raycast(e,i),i.length?i[0]:void 0}}else if(a3e(t))return l3e(e,t)}function l3e(e,t){if(wc(t)&&t.visible){if(yd(t)){let i=[];if(t.raycast(e,i),i.length)return i[0]}for(let i of t.children){let r=l3e(e,i);if(r)return r}}}var Oke=class{constructor(e,t,i,r,n,s,a,o){this.renderer=e,this.publish=t,this.scene=i,this.getCamera=r,this.sharedAssets=n,this.requestRender=s,this.isExport=a,this.frame=o,this.raycaster=new Nke,this._useWindowEvents=!1,this.pointerWorld={x:0,y:0},this.pointerScreen={x:0,y:0},this._useWindowEvents=t.mouseEventTarget==="window",this.domElement=e.domElement,this.eventElement=this._useWindowEvents?window:e.domElement,this._domRect=this.domElement.getBoundingClientRect()}get stopRaycast(){return this.publish.stopRaycast}get page(){return this.scene.activePage}set useWindowEvents(e){this._useWindowEvents=e,this.eventElement=e?window:this.renderer.domElement}get useWindowEvents(){return this._useWindowEvents}set domRect(e){this._domRect=e}get domRect(){return this._domRect}updateRaycaster(e){let{pageX:t,pageY:i}=e.touches?.length>0?e.touches[0]:e;this.pointerWorld=function(r,n,s){return{x:(r-(s.left+window.scrollX))/s.width*2-1,y:-(n-(s.top+window.scrollY))/s.height*2+1}}(t,i,this._domRect),this.pointerScreen=function(r,n,s){return{x:(r-(s.left+window.scrollX))/s.width,y:1-(n-(s.top+window.scrollY))/s.height}}(t,i,this._domRect),this.raycaster.setFromCamera(this.pointerWorld,this.getCamera())}dispose(){this.scene=void 0,this.sharedAssets=void 0,this.publish=void 0,this.getCamera=void 0,this.requestRender=void 0,this.frame=void 0,this.isExport=void 0}},nl=class{constructor(e){this.eventContext=e,this.domEventsNeeded=new Set,this.hasVideoAction=!1}connect(){}disconnect(){}dispose(){this.disconnect(),this.eventContext=void 0}};zt(),zt();var Ke=class{static get version(){return"1.3.8"}static toString(){return"JavaScript Expression Parser (JSEP) v"+Ke.version}static addUnaryOp(e){return Ke.max_unop_len=Math.max(e.length,Ke.max_unop_len),Ke.unary_ops[e]=1,Ke}static addBinaryOp(e,t,i){return Ke.max_binop_len=Math.max(e.length,Ke.max_binop_len),Ke.binary_ops[e]=t,i?Ke.right_associative.add(e):Ke.right_associative.delete(e),Ke}static addIdentifierChar(e){return Ke.additional_identifier_chars.add(e),Ke}static addLiteral(e,t){return Ke.literals[e]=t,Ke}static removeUnaryOp(e){return delete Ke.unary_ops[e],e.length===Ke.max_unop_len&&(Ke.max_unop_len=Ke.getMaxKeyLen(Ke.unary_ops)),Ke}static removeAllUnaryOps(){return Ke.unary_ops={},Ke.max_unop_len=0,Ke}static removeIdentifierChar(e){return Ke.additional_identifier_chars.delete(e),Ke}static removeBinaryOp(e){return delete Ke.binary_ops[e],e.length===Ke.max_binop_len&&(Ke.max_binop_len=Ke.getMaxKeyLen(Ke.binary_ops)),Ke.right_associative.delete(e),Ke}static removeAllBinaryOps(){return Ke.binary_ops={},Ke.max_binop_len=0,Ke}static removeLiteral(e){return delete Ke.literals[e],Ke}static removeAllLiterals(){return Ke.literals={},Ke}get char(){return this.expr.charAt(this.index)}get code(){return this.expr.charCodeAt(this.index)}constructor(e){this.expr=e,this.index=0}static parse(e){return new Ke(e).parse()}static getMaxKeyLen(e){return Math.max(0,...Object.keys(e).map(t=>t.length))}static isDecimalDigit(e){return e>=48&&e<=57}static binaryPrecedence(e){return Ke.binary_ops[e]||0}static isIdentifierStart(e){return e>=65&&e<=90||e>=97&&e<=122||e>=128&&!Ke.binary_ops[String.fromCharCode(e)]||Ke.additional_identifier_chars.has(String.fromCharCode(e))}static isIdentifierPart(e){return Ke.isIdentifierStart(e)||Ke.isDecimalDigit(e)}throwError(e){let t=new Error(e+" at character "+this.index);throw t.index=this.index,t.description=e,t}runHook(e,t){if(Ke.hooks[e]){let i={context:this,node:t};return Ke.hooks.run(e,i),i.node}return t}searchHook(e){if(Ke.hooks[e]){let t={context:this};return Ke.hooks[e].find(function(i){return i.call(t.context,t),t.node}),t.node}}gobbleSpaces(){let e=this.code;for(;e===Ke.SPACE_CODE||e===Ke.TAB_CODE||e===Ke.LF_CODE||e===Ke.CR_CODE;)e=this.expr.charCodeAt(++this.index);this.runHook("gobble-spaces")}parse(){this.runHook("before-all");let e=this.gobbleExpressions(),t=e.length===1?e[0]:{type:Ke.COMPOUND,body:e};return this.runHook("after-all",t)}gobbleExpressions(e){let t,i,r=[];for(;this.index<this.expr.length;)if(t=this.code,t===Ke.SEMCOL_CODE||t===Ke.COMMA_CODE)this.index++;else if(i=this.gobbleExpression())r.push(i);else if(this.index<this.expr.length){if(t===e)break;this.throwError('Unexpected "'+this.char+'"')}return r}gobbleExpression(){let e=this.searchHook("gobble-expression")||this.gobbleBinaryExpression();return this.gobbleSpaces(),this.runHook("after-expression",e)}gobbleBinaryOp(){this.gobbleSpaces();let e=this.expr.substr(this.index,Ke.max_binop_len),t=e.length;for(;t>0;){if(Ke.binary_ops.hasOwnProperty(e)&&(!Ke.isIdentifierStart(this.code)||this.index+e.length<this.expr.length&&!Ke.isIdentifierPart(this.expr.charCodeAt(this.index+e.length))))return this.index+=t,e;e=e.substr(0,--t)}return!1}gobbleBinaryExpression(){let e,t,i,r,n,s,a,o,l;if(s=this.gobbleToken(),!s||(t=this.gobbleBinaryOp(),!t))return s;for(n={value:t,prec:Ke.binaryPrecedence(t),right_a:Ke.right_associative.has(t)},a=this.gobbleToken(),a||this.throwError("Expected expression after "+t),r=[s,n,a];t=this.gobbleBinaryOp();){if(i=Ke.binaryPrecedence(t),i===0){this.index-=t.length;break}n={value:t,prec:i,right_a:Ke.right_associative.has(t)},l=t;let h=u=>n.right_a&&u.right_a?i>u.prec:i<=u.prec;for(;r.length>2&&h(r[r.length-2]);)a=r.pop(),t=r.pop().value,s=r.pop(),e={type:Ke.BINARY_EXP,operator:t,left:s,right:a},r.push(e);e=this.gobbleToken(),e||this.throwError("Expected expression after "+l),r.push(n,e)}for(o=r.length-1,e=r[o];o>1;)e={type:Ke.BINARY_EXP,operator:r[o-1].value,left:r[o-2],right:e},o-=2;return e}gobbleToken(){let e,t,i,r;if(this.gobbleSpaces(),r=this.searchHook("gobble-token"),r)return this.runHook("after-token",r);if(e=this.code,Ke.isDecimalDigit(e)||e===Ke.PERIOD_CODE)return this.gobbleNumericLiteral();if(e===Ke.SQUOTE_CODE||e===Ke.DQUOTE_CODE)r=this.gobbleStringLiteral();else if(e===Ke.OBRACK_CODE)r=this.gobbleArray();else{for(t=this.expr.substr(this.index,Ke.max_unop_len),i=t.length;i>0;){if(Ke.unary_ops.hasOwnProperty(t)&&(!Ke.isIdentifierStart(this.code)||this.index+t.length<this.expr.length&&!Ke.isIdentifierPart(this.expr.charCodeAt(this.index+t.length)))){this.index+=i;let n=this.gobbleToken();return n||this.throwError("missing unaryOp argument"),this.runHook("after-token",{type:Ke.UNARY_EXP,operator:t,argument:n,prefix:!0})}t=t.substr(0,--i)}Ke.isIdentifierStart(e)?(r=this.gobbleIdentifier(),Ke.literals.hasOwnProperty(r.name)?r={type:Ke.LITERAL,value:Ke.literals[r.name],raw:r.name}:r.name===Ke.this_str&&(r={type:Ke.THIS_EXP})):e===Ke.OPAREN_CODE&&(r=this.gobbleGroup())}return r?(r=this.gobbleTokenProperty(r),this.runHook("after-token",r)):this.runHook("after-token",!1)}gobbleTokenProperty(e){this.gobbleSpaces();let t=this.code;for(;t===Ke.PERIOD_CODE||t===Ke.OBRACK_CODE||t===Ke.OPAREN_CODE||t===Ke.QUMARK_CODE;){let i;if(t===Ke.QUMARK_CODE){if(this.expr.charCodeAt(this.index+1)!==Ke.PERIOD_CODE)break;i=!0,this.index+=2,this.gobbleSpaces(),t=this.code}this.index++,t===Ke.OBRACK_CODE?(e={type:Ke.MEMBER_EXP,computed:!0,object:e,property:this.gobbleExpression()},this.gobbleSpaces(),t=this.code,t!==Ke.CBRACK_CODE&&this.throwError("Unclosed ["),this.index++):t===Ke.OPAREN_CODE?e={type:Ke.CALL_EXP,arguments:this.gobbleArguments(Ke.CPAREN_CODE),callee:e}:(t===Ke.PERIOD_CODE||i)&&(i&&this.index--,this.gobbleSpaces(),e={type:Ke.MEMBER_EXP,computed:!1,object:e,property:this.gobbleIdentifier()}),i&&(e.optional=!0),this.gobbleSpaces(),t=this.code}return e}gobbleNumericLiteral(){let e,t,i="";for(;Ke.isDecimalDigit(this.code);)i+=this.expr.charAt(this.index++);if(this.code===Ke.PERIOD_CODE)for(i+=this.expr.charAt(this.index++);Ke.isDecimalDigit(this.code);)i+=this.expr.charAt(this.index++);if(e=this.char,e==="e"||e==="E"){for(i+=this.expr.charAt(this.index++),e=this.char,(e==="+"||e==="-")&&(i+=this.expr.charAt(this.index++));Ke.isDecimalDigit(this.code);)i+=this.expr.charAt(this.index++);Ke.isDecimalDigit(this.expr.charCodeAt(this.index-1))||this.throwError("Expected exponent ("+i+this.char+")")}return t=this.code,Ke.isIdentifierStart(t)?this.throwError("Variable names cannot start with a number ("+i+this.char+")"):(t===Ke.PERIOD_CODE||i.length===1&&i.charCodeAt(0)===Ke.PERIOD_CODE)&&this.throwError("Unexpected period"),{type:Ke.LITERAL,value:parseFloat(i),raw:i}}gobbleStringLiteral(){let e="",t=this.index,i=this.expr.charAt(this.index++),r=!1;for(;this.index<this.expr.length;){let n=this.expr.charAt(this.index++);if(n===i){r=!0;break}if(n==="\\")switch(n=this.expr.charAt(this.index++),n){case"n":e+=`
|
|
12291
|
-
`;break;case"r":e+="\r";break;case"t":e+=" ";break;case"b":e+="\b";break;case"f":e+="\f";break;case"v":e+="\v";break;default:e+=n}else e+=n}return r||this.throwError('Unclosed quote after "'+e+'"'),{type:Ke.LITERAL,value:e,raw:this.expr.substring(t,this.index)}}gobbleIdentifier(){let e=this.code,t=this.index;for(Ke.isIdentifierStart(e)?this.index++:this.throwError("Unexpected "+this.char);this.index<this.expr.length&&(e=this.code,Ke.isIdentifierPart(e));)this.index++;return{type:Ke.IDENTIFIER,name:this.expr.slice(t,this.index)}}gobbleArguments(e){let t=[],i=!1,r=0;for(;this.index<this.expr.length;){this.gobbleSpaces();let n=this.code;if(n===e){i=!0,this.index++,e===Ke.CPAREN_CODE&&r&&r>=t.length&&this.throwError("Unexpected token "+String.fromCharCode(e));break}if(n===Ke.COMMA_CODE){if(this.index++,r++,r!==t.length){if(e===Ke.CPAREN_CODE)this.throwError("Unexpected token ,");else if(e===Ke.CBRACK_CODE)for(let s=t.length;s<r;s++)t.push(null)}}else if(t.length!==r&&r!==0)this.throwError("Expected comma");else{let s=this.gobbleExpression();(!s||s.type===Ke.COMPOUND)&&this.throwError("Expected comma"),t.push(s)}}return i||this.throwError("Expected "+String.fromCharCode(e)),t}gobbleGroup(){this.index++;let e=this.gobbleExpressions(Ke.CPAREN_CODE);if(this.code===Ke.CPAREN_CODE)return this.index++,e.length===1?e[0]:!!e.length&&{type:Ke.SEQUENCE_EXP,expressions:e};this.throwError("Unclosed (")}gobbleArray(){return this.index++,{type:Ke.ARRAY_EXP,elements:this.gobbleArguments(Ke.CBRACK_CODE)}}},Lke=new class{add(e,t,i){if(typeof arguments[0]!="string")for(let r in arguments[0])this.add(r,arguments[0][r],arguments[1]);else(Array.isArray(e)?e:[e]).forEach(function(r){this[r]=this[r]||[],t&&this[r][i?"unshift":"push"](t)},this)}run(e,t){this[e]=this[e]||[],this[e].forEach(function(i){i.call(t&&t.context?t.context:t,t)})}};Object.assign(Ke,{hooks:Lke,plugins:new class{constructor(e){this.jsep=e,this.registered={}}register(...e){e.forEach(t=>{if(typeof t!="object"||!t.name||!t.init)throw new Error("Invalid JSEP plugin format");this.registered[t.name]||(t.init(this.jsep),this.registered[t.name]=t)})}}(Ke),COMPOUND:"Compound",SEQUENCE_EXP:"SequenceExpression",IDENTIFIER:"Identifier",MEMBER_EXP:"MemberExpression",LITERAL:"Literal",THIS_EXP:"ThisExpression",CALL_EXP:"CallExpression",UNARY_EXP:"UnaryExpression",BINARY_EXP:"BinaryExpression",ARRAY_EXP:"ArrayExpression",TAB_CODE:9,LF_CODE:10,CR_CODE:13,SPACE_CODE:32,PERIOD_CODE:46,COMMA_CODE:44,SQUOTE_CODE:39,DQUOTE_CODE:34,OPAREN_CODE:40,CPAREN_CODE:41,OBRACK_CODE:91,CBRACK_CODE:93,QUMARK_CODE:63,SEMCOL_CODE:59,COLON_CODE:58,unary_ops:{"-":1,"!":1,"~":1,"+":1},binary_ops:{"||":1,"&&":2,"|":3,"^":4,"&":5,"==":6,"!=":6,"===":6,"!==":6,"<":7,">":7,"<=":7,">=":7,"<<":8,">>":8,">>>":8,"+":9,"-":9,"*":10,"/":10,"%":10},right_associative:new Set,additional_identifier_chars:new Set(["$","_"]),literals:{true:!0,false:!1,null:null},this_str:"this"}),Ke.max_unop_len=Ke.getMaxKeyLen(Ke.unary_ops),Ke.max_binop_len=Ke.getMaxKeyLen(Ke.binary_ops);var Wx=e=>new Ke(e).parse();Object.getOwnPropertyNames(Ke).forEach(e=>{Wx[e]===void 0&&e!=="prototype"&&(Wx[e]=Ke[e])}),Wx.Jsep=Ke;var Bke={name:"ternary",init(e){e.hooks.add("after-expression",function(t){if(t.node&&this.code===e.QUMARK_CODE){this.index++;let i=t.node,r=this.gobbleExpression();if(r||this.throwError("Expected expression"),this.gobbleSpaces(),this.code===e.COLON_CODE){this.index++;let n=this.gobbleExpression();if(n||this.throwError("Expected expression"),t.node={type:"ConditionalExpression",test:i,consequent:r,alternate:n},i.operator&&e.binary_ops[i.operator]<=.9){let s=i;for(;s.right.operator&&e.binary_ops[s.right.operator]<=.9;)s=s.right;t.node.test=s.right,s.right=t.node,t.node=i}}else this.throwError("Expected :")}})}};Wx.plugins.register(Bke);var Fke=["+","-","*","/","(",")","==","!=",">","<",">=","<=","and","or","!","%","^",","],Uke=["0","1","2","3","4","5","6","7","8","9","."],zke=["sin","cos","tan","asin","acos","atan","atan2","sqrt","abs","log","exp","floor","ceil","round","min","max","random"];function kke(e){return typeof e=="string"&&!isNaN(e)&&!isNaN(parseFloat(e))}function h3e(e,t,i="number"){let r,n,s="";for(let a=0;a<e.length;a++){let o=e[a];if("objType"in o&&o.objType==="api"){let l=JSON.parse(o.id),h=l[0],u=t.getUserAPI(h);if(u!==void 0&&typeof u.retrieveValue=="function"){let d=u.retrieveValue(l.slice(1));d!==void 0&&(s+=d)}continue}if("objType"in o&&o.objType==="webhook"){let l=JSON.parse(o.id),[h,u]=l,d=t.getUserWebhook(h);if(d!==void 0){let c=d.getParameterValue(u);c!==void 0&&(s+=c)}continue}if("objType"in o&&o.objType==="aiAssistant"){let l=t.openAIRealtime;if("objId"in o&&o.objId!==void 0){let h;if(t.scene.data.objects.traverse((u,d)=>{let c=d.events?.find(p=>p.id===o.objId);c&&(h=c)}),h!==void 0&&h.data.type==="AIAssistantListener"){let u=l?.computeAnalysisForListenerEvent(h.data);if(u!==void 0){s+=u;continue}}}s+=l?.voice??0;continue}if("id"in o){let l=e[a-1];if(a>0&&"id"in l)return void console.error("Two variables in a row",e);if(Array.isArray(o.id)&&t.referencesMissingObject(o.id))return;let h=t.getVariable(o.id),u=Mo.getDisplayedValue(h);i==="number"&&Mo.isTextValue(h)&&Array.isArray(h.textValue)&&h.textValue.length===1?u=parseFloat(u).toString():i==="boolean"&&Mo.isBoolean(h)?u=h?"true":"false":i==="boolean"&&Mo.isTextValue(h)&&!Array.isArray(h.textValue)&&(u='"'+u+'"'),s+=u;continue}i!=="string"?o.name!=="and"?o.name!=="or"?o.name!=="True"?o.name!=="False"?i!=="boolean"||kke(o.name)||Uke.includes(o.name)||Fke.includes(o.name)||zke.includes(o.name.replace(/\($/g,""))?s+=o.name:s+='"'+o.name+'"':s+="false":s+="true":s+="||":s+="&&":(o.name!=='"'&&(o.name!=="+"||o.escaped)&&(s+=o.name),o.name==="+"&&!o.escaped&&s[s.length-1]==="\\"&&(s=s.slice(0,-1)+o.name))}if(i==="string")return s;if(e.length===0){if(i==="number")return 0;if(i==="boolean")return!1}try{r=Wx(s)}catch(a){return void console.error(s,a)}try{n=Fr(r)}catch(a){console.error(s,r,a)}if(i!=="number"||n===void 0||Number.isFinite(n))return n;console.error(s,"evaluated to",n)}function Fr(e){switch(e.type){case"BinaryExpression":switch(e.operator){case"==":return Number(Fr(e.left)===Fr(e.right));case"!=":return Number(Fr(e.left)!==Fr(e.right));case">":return Number(Fr(e.left)>Fr(e.right));case">=":return Number(Fr(e.left)>=Fr(e.right));case"<":return Number(Fr(e.left)<Fr(e.right));case"<=":return Number(Fr(e.left)<=Fr(e.right));case"+":return Fr(e.left)+Fr(e.right);case"-":return Fr(e.left)-Fr(e.right);case"*":return Fr(e.left)*Fr(e.right);case"/":return Fr(e.left)/Fr(e.right);case"%":return Fr(e.left)%Fr(e.right);case"&&":return Fr(e.left)&&Fr(e.right);case"||":return Fr(e.left)||Fr(e.right);case"^":return Math.pow(Fr(e.left),Fr(e.right));default:throw new Error("Unknown operator: "+e.operator)}case"UnaryExpression":switch(e.operator){case"-":return-Fr(e.argument);case"!":return Number(!Fr(e.argument));default:throw new Error("Unknown operator: "+e.operator)}case"Identifier":throw new Error("Unknown identifier: "+e.name);case"Literal":return e.value;case"CallExpression":if(e.callee.type==="Identifier"){if(e.callee.name==="random"){let t=0,i=1;if(e.arguments.length>=1)try{t=Fr(e.arguments[0])}catch(r){console.warn(r)}if(e.arguments.length>=2)try{i=Fr(e.arguments[1])}catch(r){console.warn(r)}return t=Math.min(i,t),i=Math.max(i,t),t+Math.random()*(i-t)}return Math[e.callee.name].apply(null,e.arguments.map(Fr))}throw new Error("Unknown node");default:throw new Error("Unknown node type: "+e.type)}}Wx.addBinaryOp("^",11,!0);var u3e=new Map;function Jo(e,t){u3e.set(e,t)}_r(),Object.keys({mousehover:!0,scroll:!0,dragdrop:!0,tracking:!0,resize:!0,conditional:!0,variables:!0,"api-services":!0,"ai-assistant":!0,textinputs:!0,audio:!0,video:!0,"create-destroy":!0,"scene-transition":!0,timeline:!0,transitions:!0,"misc-actions":!0});var Vke={MouseHover:"mousehover",Scroll:"scroll",DragDrop:"dragdrop",Follow:"tracking",LookAt:"tracking",Resize:"resize",Conditional:"conditional",VariableChange:"variables",API:"api-services",WEBHOOK:"api-services",AIAssistantListener:"ai-assistant",AIAssistantTrigger:"ai-assistant"},Gke={Audio:"audio",Video:"video",Particles:"particles",Link:"misc-actions",Reset:"misc-actions",SwitchCamera:"misc-actions",ClearLocalStorage:"misc-actions",Create:"create-destroy",Destroy:"create-destroy",Transition:"transitions",Animation:"transitions",TimelineAnimation:"timeline",SceneTransition:"scene-transition",SetVariable:"variables",DynamicVariablePlay:"variables",UserAPI:"api-services"};function Nn(e,t){if(t===void 0)return!0;if(t.expression.length===0||function(r,n){return r.some(s=>"id"in s&&Array.isArray(s.id)&&n.referencesMissingObject(s.id))}(t.expression,e))return!1;let i=h3e(t.expression,e,"boolean");return t.negate?!i:!!i}function ha(e,t,i,r,n,s,a){let o={Audio:[],Video:[],Particles:[],Link:[],Destroy:[],Create:[],Reset:[],Transition:[],TimelineAnimation:[],SwitchCamera:[],Animation:[],SceneTransition:[],SetVariable:[],DynamicVariablePlay:[],ClearLocalStorage:[],UserAPI:[]},l=h=>({id:u,data:d})=>{try{if(d.type==="Conditional")return void(jW[e.type].includes("Conditional")&&(d.ifActions.forEach(l({expression:d.condition,negate:!1})),d.elseActions.forEach(l({expression:d.condition,negate:!0}))));if(!jW[e.type].includes(d.type))return;let c=function(f){return u3e.get(f)}(d.type);if(c===void 0)return void Ta(Gke[d.type]??"misc-actions",`a "${d.type}" action`);let p=c({id:u,data:d,object:s,page:i,shared:r,eventManager:n,eventType:e.type,actionCondition:h,runModeOverride:a});p!=null&&d.type in o&&o[d.type].push(p)}catch{}};return t.forEach(l()),o}function Ka(e){Object.values(e).forEach(t=>{t.forEach(i=>{typeof i.dispose=="function"&&i.dispose()})})}var SZ=[["start","Start"],["keyDown","KeyDown"],["keyUp","KeyUp"],["mouseDown","MouseDown"],["mouseUp","MouseUp"],["mouseHover","MouseHover"],["collision","Collision"],["lookAt","LookAt"],["follow","Follow"],["scroll","Scroll"]],d3e=e=>SZ.find(([t,i])=>i===e)?.[0],pC=e=>SZ.find(([t])=>t===e)?.[1],jke=(e,t)=>{let i=d3e(e);if(i){let r=new CustomEvent(i,{bubbles:!0});return Object.defineProperty(r,"target",{writable:!1,value:t}),r}},Wke=class extends nl{constructor(){super(...arguments),this.objectsPerEvents=new Map,this.splineEvents={},this.onBeginEvent=e=>{if(!e.eventName||!e.target||e.eventName==="Scroll")return;let t=this.splineEvents[d3e(e.eventName)]?.[e.target.uuid];if(!t)return;e.eventName==="Scroll"&&e.deltaY!==void 0&&Object.assign(t,{deltaY:e.deltaY});let{domElement:i}=this.eventContext;i.dispatchEvent(t)}}connect(){let{page:e}=this.eventContext;e.traverseEntity(t=>{if(t.data?.events.length){for(let[i,r]of SZ)if(t.data.events.some(n=>n.data.type===r&&!n.data.disabled)){this.objectsPerEvents.has(i)?this.objectsPerEvents.get(i)?.push(t):this.objectsPerEvents.set(i,[t]);let n={id:t.uuid,name:t.name},s=jke(r,n),a=this.splineEvents[i];a?a[t.uuid]=s:this.splineEvents[i]={[t.uuid]:s}}}}),this.objectsPerEvents.forEach(t=>{t.forEach(i=>{i.addEventListener("beginEvent",this.onBeginEvent)})})}disconnect(){this.objectsPerEvents.forEach(e=>{e.forEach(t=>{t.removeEventListener("beginEvent",this.onBeginEvent)})})}};Sl(),Zn(),Tu();var Hke=class{constructor(e,t,i,r,n,s){if(this.id=e,this.data=t,this.object=i,this.entered=!1,(t.type==="KeyDown"||t.type==="KeyUp"||t.type==="KeyPress")&&!t.key)throw new Error("Missing property");this.actions=ha(t,t.actions,r,n,s,i)}disconnect(){Ka(this.actions)}dispatchHeld(e){this.actions.Create.forEach(t=>{e&&t.dispatchThrottled.cancel(),t.dispatchThrottled()})}dispatch(e=!1){this.actions.Transition.forEach(t=>{t.object.currentTransitionEvent!==this&&(t.object.currentTransitionEvent=this,t.init())}),this.data.type==="MousePress"||this.data.type==="KeyPress"?this.entered||(this.entered=!0,this.actions.Transition.forEach(t=>t.playFromCurrent()),this.actions.Animation.forEach(t=>t.playFromCurrent()),this.actions.TimelineAnimation.forEach(t=>t.playFromCurrent()),this.actions.SwitchCamera.forEach(t=>t.playFromCurrent()),this.actions.Create.forEach(t=>t.dispatchStart())):(this.actions.Transition.some(t=>t.playing&&t.data.runMode!=="Toggle")||this.actions.Transition.forEach(t=>t.play()),this.actions.SwitchCamera.some(t=>t.playing&&t.data.runMode!=="Toggle")||this.actions.SwitchCamera.forEach(t=>{t.data.runMode==="Toggle"?t.toggle():t.play()}),this.actions.Animation.forEach(t=>{"runMode"in t.data&&t.data.runMode==="Toggle"?t.toggle():t.play()}),this.actions.TimelineAnimation.forEach(t=>{"runMode"in t.data&&t.data.runMode==="Toggle"?t.toggle():t.play()})),this.actions.Link.forEach(t=>{t.dispatch()}),this.actions.SceneTransition.forEach(t=>{t.dispatch()}),e===!1&&this.actions.Create.forEach(t=>{t.dispatch()}),this.actions.Destroy.forEach(t=>{t.dispatch()}),this.actions.Reset.forEach(t=>{t.dispatch()}),this.actions.Audio.forEach(t=>{t.dispatchBasic()}),this.actions.Video.forEach(t=>{t.dispatchBasic()}),this.actions.Particles.forEach(t=>{t.dispatchBasic()}),this.actions.SetVariable.forEach(t=>t.checkConditions()),this.actions.SetVariable.forEach(t=>t.dispatch()),this.actions.DynamicVariablePlay.forEach(t=>t.dispatch()),this.actions.ClearLocalStorage.forEach(t=>t.dispatch()),this.actions.UserAPI.forEach(t=>t.dispatch())}dispatchRelease(){this.entered&&(this.entered=!1,this.actions.Transition.forEach(e=>e.reverseFromCurrent()),this.actions.Particles.forEach(e=>e.reverseFromCurrent()),this.actions.Animation.forEach(e=>e.reverseFromCurrent()),this.actions.SwitchCamera.forEach(e=>e.reverseFromCurrent()),this.actions.Create.forEach(e=>e.dispatchStop()))}dispatchUserEvent(e){this.actions.Transition.forEach(t=>{t.object.currentTransitionEvent!==this&&(t.object.currentTransitionEvent=this,t.init())}),e?(this.actions.Transition.forEach(t=>t.reverseFromCurrent()),this.actions.Animation.forEach(t=>t.reverseFromCurrent()),this.actions.TimelineAnimation.forEach(t=>t.reverseFromCurrent()),this.actions.SwitchCamera.forEach(t=>t.reverseFromCurrent())):(this.actions.Transition.forEach(t=>t.playFromCurrent()),this.actions.Animation.forEach(t=>t.playFromCurrent()),this.actions.TimelineAnimation.forEach(t=>t.playFromCurrent()),this.actions.SwitchCamera.forEach(t=>t.playFromCurrent())),this.actions.Link.forEach(t=>{t.dispatch()}),this.actions.SceneTransition.forEach(t=>{t.dispatch()}),this.actions.Create.forEach(t=>{t.dispatch()}),this.actions.Destroy.forEach(t=>{t.dispatch()}),this.actions.Reset.forEach(t=>{t.dispatch()}),this.actions.Audio.forEach(t=>{t.dispatchBasic()}),this.actions.Video.forEach(t=>{t.dispatchBasic()}),this.actions.Particles.forEach(t=>{t.dispatchBasic()}),this.actions.SetVariable.forEach(t=>t.checkConditions()),this.actions.SetVariable.forEach(t=>t.dispatch()),this.actions.DynamicVariablePlay.forEach(t=>t.dispatch()),this.actions.ClearLocalStorage.forEach(t=>t.dispatch()),this.actions.UserAPI.forEach(t=>t.dispatch())}},qke=class extends nl{constructor(e,t,i){super(e),this.eventManager=t,this.useForRaycastProperty=i,this.objectsPerTypes={MouseDown:[],MouseUp:[],MousePress:[],KeyDown:[],KeyUp:[],KeyPress:[]},this.canvasMouseEvents=[],this.eventsPerObjects={MouseDown:{},MouseUp:{},MousePress:{},KeyDown:{},KeyUp:{},KeyPress:{}},this.heldKeys={},this.heldKeysPress={},this._prevObjects=[],this.sceneInterects=null,this.onCanvasRaycast=r=>{if(this.useForRaycastProperty===!0&&this.sceneInterects===null){this.eventContext.updateRaycaster(r);let{raycaster:n,page:s}=this.eventContext,a=VO(n,s,[],!0);this.sceneInterects=a,a.length&&(this.eventContext.sharedAssets.raycastProperty={x:a[0].point.x,y:a[0].point.y,z:a[0].point.z,objX:a[0].object.matrixWorld.elements[12],objY:a[0].object.matrixWorld.elements[13],objZ:a[0].object.matrixWorld.elements[14]})}},this.onCanvasMouseDown=r=>{(r.target===this.eventContext.domElement||r.target.tagName==="SPLINE-VIEWER")&&this.canvasMouseEvents.forEach(n=>{(n.data.type==="MouseDown"||n.data.type==="MousePress")&&(this.onCanvasRaycast(r),n.dispatch())})},this.onCanvasMouseUp=r=>{(r.target===this.eventContext.domElement||r.target.tagName==="SPLINE-VIEWER")&&this.canvasMouseEvents.forEach(n=>{n.data.type==="MouseUp"?(this.onCanvasRaycast(r),n.dispatch()):n.data.type==="MousePress"&&n.dispatchRelease()})},this.onMouseDown=r=>{vi.length>1||(this.eventContext.updateRaycaster(r),this.handleMouseEvent("MouseDown"))},this.onMouseUp=r=>{vi.length>1||(this.eventContext.updateRaycaster(r),this.handleMouseEvent("MouseUp"))},this.onMousePressDown=r=>{vi.length>1||(this.eventContext.updateRaycaster(r),this.handleMousePressEvent())},this.onMousePressRelease=r=>{vi.length>1||(this.eventContext.updateRaycaster(r),this.handleMousePressEvent(!0))},this.onKeyDown=r=>{this.heldKeys[r.key]||(this.handleKeyEvent(r,"KeyDown"),this.handleKeyEventHeld(r,"KeyDown",!0)),this.heldKeys[r.key]=!0},this.onKeyUp=r=>{this.handleKeyEvent(r,"KeyUp"),this.handleKeyEventHeld(r,"KeyUp",!0)},this.onKeyPressDown=r=>{this.heldKeysPress[r.key]?this.handleKeyEventHeld(r,"KeyPress"):(this.handleKeyEvent(r,"KeyPress"),this.handleKeyEventHeld(r,"KeyPress",!0)),this.heldKeysPress[r.key]=!0},this.onKeyPressUp=r=>{this.handleKeyEvent(r,"KeyPress",!0)},this.releaseHeldKey=r=>{delete this.heldKeys[r.key]},this.releaseHeldKeyPress=r=>{delete this.heldKeysPress[r.key]},this._onUserEvent=({eventName:r,target:n,reverse:s})=>{if(!r||!n)return;let a=pC(r);a&&(a==="MouseDown"||a==="MouseUp"||a==="MousePress"?(n.dispatchEvent({type:"beginEvent",eventName:a}),this.eventsPerObjects[a]?.[n.uuid]?.forEach(o=>{o.dispatchUserEvent(s)}),this.canvasMouseEvents.forEach(o=>{o.dispatchUserEvent(s)})):(a==="KeyDown"||a==="KeyUp"||a==="KeyPress")&&(n.dispatchEvent({type:"beginEvent",eventName:a}),this.eventsPerObjects[a]?.[n.uuid]?.forEach(o=>{o.dispatchUserEvent()})))}}connect(){let{page:e,sharedAssets:t,domElement:i}=this.eventContext,r=(n,s)=>{if(!n.data?.events.length)return;let a=["MouseDown","MouseUp","MousePress","KeyDown","KeyUp","KeyPress"];for(let o of a){let l=this.eventsPerObjects[o];if(n.data.events.filter(({data:h})=>h.type===o&&h.disabled!==!0).forEach(({id:h,data:u})=>{try{let d=new Hke(h,u,n,e,t,this.eventManager);d.actions.Video.length&&(this.hasVideoAction=!0),u.type!=="MouseDown"&&u.type!=="MouseUp"&&u.type!=="MousePress"||u.mode!=="Canvas"&&u.mode!=="Window"?(l[n.uuid]?l[n.uuid].some(c=>c.id===d.id)||l[n.uuid].push(d):l[n.uuid]=[d],Zf(n)&&n.traverseChildren(c=>{if(!c.visible)return!0;c instanceof zn&&"shapeBlendNode"in c.data.geometry&&c.data.geometry.shapeBlendNode?.operation!==2&&(l[c.uuid]?l[c.uuid].push(d):l[c.uuid]=[d])})):this.canvasMouseEvents.push(d)}catch{}}),l[n.uuid]?.length&&(this.objectsPerTypes[o].push(!Jl(n)||o!=="MouseDown"&&o!=="MouseUp"&&o!=="MousePress"?n:s),Zf(n))){let h=this.objectsPerTypes[o];n.traverseChildren(u=>{if(!u.visible)return!0;u instanceof zn&&h.indexOf(u)===-1&&h.push(u)})}}};e.traverseEntity(n=>{($o(n)||n instanceof Dn)&&n.frame?.traverse(s=>{r(s,n)}),r(n)}),this.heldKeys={},this.heldKeysPress={},this.domEventsNeeded.clear(),i.addEventListener("pointerdown",this.onCanvasMouseDown),i.addEventListener("pointerup",this.onCanvasMouseUp),(this.objectsPerTypes.MouseDown?.length||this.useForRaycastProperty)&&(this.domEventsNeeded.add("pointerdown"),i.addEventListener("pointerdown",this.onMouseDown)),this.objectsPerTypes.MouseUp?.length&&(this.domEventsNeeded.add("pointerup"),i.addEventListener("pointerup",this.onMouseUp)),this.objectsPerTypes.MousePress?.length&&(this.domEventsNeeded.add("pointerdown"),i.addEventListener("pointerdown",this.onMousePressDown),this.domEventsNeeded.add("pointerup"),i.addEventListener("pointerup",this.onMousePressRelease)),this.objectsPerTypes.KeyDown?.length&&(this.domEventsNeeded.add("keydown"),document.addEventListener("keydown",this.onKeyDown),document.addEventListener("keyup",this.releaseHeldKey)),this.objectsPerTypes.KeyUp?.length&&(this.domEventsNeeded.add("keyup"),document.addEventListener("keyup",this.onKeyUp)),this.objectsPerTypes.KeyPress?.length&&(this.domEventsNeeded.add("keydown"),document.addEventListener("keydown",this.onKeyPressDown),document.addEventListener("keyup",this.releaseHeldKeyPress),this.domEventsNeeded.add("keyup"),document.addEventListener("keyup",this.onKeyPressUp)),Object.entries(this.objectsPerTypes).forEach(([n,s])=>{s.forEach(a=>{a.addEventListener("userEvent",this._onUserEvent)})}),this.canvasMouseEvents.forEach(n=>{n.object.addEventListener("userEvent",this._onUserEvent)})}disconnect(){let{domElement:e}=this.eventContext;this.domEventsNeeded.clear(),this.heldKeys={},this.heldKeysPress={},e.removeEventListener("pointerdown",this.onCanvasMouseDown),e.removeEventListener("pointerup",this.onCanvasMouseUp),e.removeEventListener("pointerdown",this.onMouseDown),e.removeEventListener("pointerdown",this.onMousePressDown),e.removeEventListener("pointerup",this.onMouseUp),e.removeEventListener("pointerup",this.onMousePressRelease),document.removeEventListener("keydown",this.onKeyDown),document.removeEventListener("keyup",this.onKeyUp),document.removeEventListener("keydown",this.onKeyPressDown),document.removeEventListener("keyup",this.onKeyPressUp),document.removeEventListener("keyup",this.releaseHeldKey),Object.values(this.eventsPerObjects).forEach(t=>{Object.values(t).forEach(i=>{i.forEach(r=>{r.disconnect()})})}),this.canvasMouseEvents.forEach(t=>{t.disconnect()}),Object.entries(this.objectsPerTypes).forEach(([t,i])=>{i.forEach(r=>{r.removeEventListener("userEvent",this._onUserEvent)})}),this.canvasMouseEvents.forEach(t=>{t.object.removeEventListener("userEvent",this._onUserEvent)})}handleMouseEvent(e){let{stopRaycast:t,raycaster:i,page:r,pointerScreen:n}=this.eventContext,s=this.objectsPerTypes[e],a=s.filter(o=>!Jl(o));if((s.length||this.useForRaycastProperty)&&(!r.uiCanvas||!hf(r,[n.x,n.y],Object.keys(this.eventsPerObjects[e]),o=>{this.handleObjectMouseEventDispatch(o,e)}))){if(t||this.useForRaycastProperty){let o;if(this.sceneInterects===null?o=VO(i,r,a,this.useForRaycastProperty):(o=this.sceneInterects,this.sceneInterects=null),this.useForRaycastProperty&&o.length&&(this.eventContext.sharedAssets.raycastProperty={x:o[0].point.x,y:o[0].point.y,z:o[0].point.z,objX:o[0].object.matrixWorld.elements[12],objY:o[0].object.matrixWorld.elements[13],objZ:o[0].object.matrixWorld.elements[14]}),t){let l=[o[0]?.uv?.x??0,o[0]?.uv?.y??0];cX(o).forEach(h=>{$o(h)&&hf(h,l,Object.keys(this.eventsPerObjects[e]),u=>{this.handleObjectMouseEventDispatch(u,e)}),this.eventsPerObjects[e][h.uuid]&&this.handleObjectMouseEventDispatch(h,e)})}}t||a.forEach(o=>{let l=Y4(i,o);l&&(this.handleObjectMouseEventDispatch(o,e),$o(o)&&hf(o,[l?.uv?.x??0,l?.uv?.y??0],Object.keys(this.eventsPerObjects[e]),h=>{this.handleObjectMouseEventDispatch(h,e)}))})}}handleMousePressEvent(e=!1){let t="MousePress",i=this.objectsPerTypes[t],r=i.filter(s=>!Jl(s)),n=[];if(i.length){if(!e){let{stopRaycast:s,raycaster:a,page:o,pointerScreen:l}=this.eventContext,h=!1;if(o.uiCanvas&&(h=hf(o,[l.x,l.y],Object.keys(this.eventsPerObjects[t]),u=>{n.push(u)})),s&&!h){let u=VO(a,o,r);n=cX(u),u.forEach(d=>{$o(d.object)&&hf(d.object,[d?.uv?.x??0,d?.uv?.y??0],Object.keys(this.eventsPerObjects[t]),c=>{n.push(c)})})}else r.forEach(u=>{let d=Y4(a,u);d&&(n.push(u),$o(u)&&hf(u,[d?.uv?.x??0,d?.uv?.y??0],Object.keys(this.eventsPerObjects[t]),c=>{n.push(c)}))})}this._prevObjects.length&&this._prevObjects.forEach(s=>{n.includes(s)||this.handleObjectMouseEventDispatchRelease(s,t)}),n.length&&n.forEach(s=>{this.handleObjectMouseEventDispatch(s,t)}),this._prevObjects=n}}handleObjectMouseEventDispatch(e,t){e.dispatchEvent({type:"beginEvent",eventName:t}),this.eventsPerObjects[t]?.[e.uuid]?.forEach(i=>{i.dispatch()})}handleObjectMouseEventDispatchRelease(e,t){e.dispatchEvent({type:"beginEvent",eventName:t}),this.eventsPerObjects[t]?.[e.uuid]?.forEach(i=>{i.dispatchRelease()})}handleKeyEvent(e,t,i=!1){this.objectsPerTypes[t].forEach(r=>{let n=this.eventsPerObjects[t][r.uuid];n.some(({data:s})=>"key"in s&&s.key===e.key)&&r.dispatchEvent({type:"beginEvent",eventName:t}),n.forEach(s=>{"key"in s.data&&s.data.key===e.key&&(i?s.dispatchRelease():s.dispatch(!0))})})}handleKeyEventHeld(e,t,i=!1){this.objectsPerTypes[t].forEach(r=>{this.eventsPerObjects[t][r.uuid].forEach(n=>{"key"in n.data&&n.data.key===e.key&&n.dispatchHeld(i)})})}};Zn(),Tu();var pX=e=>e?.isPlayAudioAction===!0,rve=e=>e?.isPauseAudioAction===!0,_E=e=>e?.isPlayVideoAction===!0,nve=e=>e?.isPauseVideoAction===!0,$ke=class{constructor(e,t,i,r,n,s){this.id=e,this.data=t,this.object=i,this.actions=ha(t,t.actions,r,n,s,i)}disconnect(){Ka(this.actions)}dispatch(){this.actions.Transition.forEach(e=>{e.play()}),this.actions.Animation.forEach(e=>{e.play()}),this.actions.TimelineAnimation.forEach(e=>{e.play()}),this.actions.SwitchCamera.forEach(e=>{e.play()}),this.actions.SceneTransition.forEach(e=>{e.dispatch()}),this.actions.Reset.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()),this.actions.Create.forEach(e=>{e.dispatchFromStart()}),this.actions.Destroy.forEach(e=>{e.dispatchFromStart()})}dispatchAfter(e){this.actions.Audio.forEach(t=>{(t.interaction.data.triggerAfter??"any")===e&&(pX(t.interaction)?t.interaction.audioPlayer?.play():rve(t.interaction)&&t.interaction.dispatch())}),this.actions.Video.forEach(t=>{let i=t.interaction.data.triggerAfter??"autoplay";i===e&&(_E(t.interaction)?t.interaction.play(i==="autoplay"):nve(t.interaction)&&t.interaction.dispatch())}),this.actions.Particles.forEach(t=>{(t.data.triggerAfter??"any")===e&&t.dispatchBasic()})}async seekVideos(e){let t=[];this.actions.Video.forEach(i=>{(i.interaction.data.triggerAfter??"autoplay")==="autoplay"&&_E(i.interaction)&&t.push(i.interaction.seek(e))}),await Promise.all(t)}pauseVideos(){this.actions.Video.forEach(e=>{_E(e.interaction)&&e.interaction.pause()})}dispatchUserEvent(e){this.actions.Transition.forEach(t=>{t.object.currentTransitionEvent!==this&&(t.object.currentTransitionEvent=this,t.init())}),e?(this.actions.Transition.forEach(t=>t.reverseFromCurrent()),this.actions.Animation.forEach(t=>t.reverseFromCurrent()),this.actions.TimelineAnimation.forEach(t=>t.reverseFromCurrent()),this.actions.SwitchCamera.forEach(t=>t.reverseFromCurrent())):(this.actions.Transition.forEach(t=>t.playFromCurrent()),this.actions.Animation.forEach(t=>t.playFromCurrent()),this.actions.TimelineAnimation.forEach(t=>t.playFromCurrent()),this.actions.SwitchCamera.forEach(t=>t.playFromCurrent())),this.actions.SceneTransition.forEach(t=>t.dispatch()),this.actions.Reset.forEach(t=>t.dispatch()),this.actions.SetVariable.forEach(t=>t.checkConditions()),this.actions.SetVariable.forEach(t=>t.dispatch()),this.actions.DynamicVariablePlay.forEach(t=>t.dispatch()),this.actions.ClearLocalStorage.forEach(t=>t.dispatch()),this.actions.UserAPI.forEach(t=>t.dispatch()),this.actions.Create.forEach(t=>{t.dispatch()}),this.actions.Destroy.forEach(t=>{t.dispatch()}),this.actions.Audio.forEach(t=>{pX(t.interaction)?t.interaction.audioPlayer?.play():rve(t.interaction)&&t.interaction.dispatch()}),this.actions.Video.forEach(t=>{_E(t.interaction)?t.interaction.play():nve(t.interaction)&&t.interaction.dispatch()}),this.actions.Particles.forEach(t=>{t.dispatchBasic()})}},Xke=class extends nl{constructor(e,t){super(e),this.eventManager=t,this.eventsPerObject=new Map,this.eventsAfterPerObject=new Map,this.onMouseDown=()=>{[...this.eventsAfterPerObject.entries()].forEach(([i,r])=>{i.dispatchEvent({type:"beginEvent",eventName:"Start"}),r.forEach(n=>{n.dispatchAfter("mouseDown")})})},this.onKeyDown=()=>{[...this.eventsAfterPerObject.entries()].forEach(([i,r])=>{i.dispatchEvent({type:"beginEvent",eventName:"Start"}),r.forEach(n=>{n.dispatchAfter("keyDown")})})},this.onAny=()=>{let{domElement:i,isExport:r}=this.eventContext,n=r?document:i;n.removeEventListener("pointerdown",this.onAny),n.removeEventListener("mousedown",this.onAny),document.removeEventListener("keydown",this.onAny),[...this.eventsAfterPerObject.entries()].forEach(([s,a])=>{s.dispatchEvent({type:"beginEvent",eventName:"Start"}),a.forEach(o=>{o.dispatchAfter("any")})})},this.onSceneTransitionAudioVideoPlay=()=>{[...this.eventsAfterPerObject.entries()].forEach(([i,r])=>{i.dispatchEvent({type:"beginEvent",eventName:"Start"}),r.forEach(n=>{n.actions.Audio.forEach(s=>{pX(s.interaction)&&s.interaction.audioPlayer?.play()}),n.actions.Video.forEach(s=>{let a=s.interaction.data.triggerAfter??"autoplay";_E(s.interaction)&&s.interaction.play(a==="autoplay")}),n.actions.Particles.forEach(s=>{s.dispatchBasic()})})})},this.onPlay=()=>{[...this.eventsAfterPerObject.entries()].forEach(([i,r])=>{i.dispatchEvent({type:"beginEvent",eventName:"Start"}),r.forEach(n=>{n.dispatchAfter("autoplay")})})},this.seekVideos=async i=>{let r=[];[...this.eventsAfterPerObject.entries()].forEach(([n,s])=>{!n.data.visible||s.forEach(a=>{r.push(a.seekVideos(i))})}),await Promise.all(r)},this.pauseVideos=()=>{[...this.eventsAfterPerObject.entries()].forEach(([i,r])=>{r.forEach(n=>{n.pauseVideos()})})},this.onUserEvent=({eventName:i,target:r,reverse:n})=>{if(!i||!r)return;let s=pC(i);s&&s==="Start"&&(Jl(r)||r.dispatchEvent({type:"beginEvent",eventName:"Start"}),this.eventsPerObject.get(r)?.forEach(a=>{a.dispatchUserEvent(n)}),this.eventsAfterPerObject.get(r)?.forEach(a=>{a.dispatchUserEvent(n)}))}}connect(){let{sharedAssets:e,page:t}=this.eventContext,i=r=>{if(r.data?.events.length)for(let{id:n,data:s}of r.data.events){if(s.disabled||s.type!=="Start")continue;let a=new $ke(n,s,r,t,e,this.eventManager);(a.actions.Transition.length||a.actions.TimelineAnimation.length||a.actions.Animation.length||a.actions.SwitchCamera.length||a.actions.Create.length||a.actions.Destroy.length||a.actions.SceneTransition.length||a.actions.Reset.length||a.actions.SetVariable.length||a.actions.DynamicVariablePlay.length||a.actions.ClearLocalStorage.length||a.actions.UserAPI.length)&&(this.eventsPerObject.has(r)?this.eventsPerObject.get(r)?.push(a):this.eventsPerObject.set(r,[a])),a.actions.Audio.length&&(this.eventsAfterPerObject.has(r)?this.eventsAfterPerObject.get(r)?.push(a):this.eventsAfterPerObject.set(r,[a])),a.actions.Video.length&&(this.hasVideoAction=!0,this.eventsAfterPerObject.has(r)?this.eventsAfterPerObject.get(r)?.push(a):this.eventsAfterPerObject.set(r,[a])),a.actions.Particles.length&&(this.eventsAfterPerObject.has(r)?this.eventsAfterPerObject.get(r)?.push(a):this.eventsAfterPerObject.set(r,[a]))}};if(t.traverseEntity(r=>{($o(r)||r instanceof Dn)&&r.frame?.traverse(n=>{i(n)}),i(r)}),[...this.eventsAfterPerObject.values()].some(r=>r.length)){if(this.eventManager.activateCount===0){let{domElement:r,isExport:n}=this.eventContext,s=n?document:r;s.addEventListener("pointerdown",this.onMouseDown,{once:!0}),s.addEventListener("mousedown",this.onMouseDown,{once:!0}),document.addEventListener("keydown",this.onKeyDown,{once:!0}),s.addEventListener("pointerdown",this.onAny),s.addEventListener("mousedown",this.onAny),document.addEventListener("keydown",this.onAny),[...this.eventsAfterPerObject.entries()].forEach(([a,o])=>{a.addEventListener("userEvent",this.onUserEvent)})}else this.onSceneTransitionAudioVideoPlay();this.onPlay()}[...this.eventsPerObject.entries()].forEach(([r,n])=>{r.dispatchEvent({type:"beginEvent",eventName:"Start"}),n.forEach(s=>s.dispatch()),r.addEventListener("userEvent",this.onUserEvent)})}disconnect(){if([...this.eventsAfterPerObject.values()].some(e=>e.length)){let{domElement:e,isExport:t}=this.eventContext,i=t?document:e;i.removeEventListener("pointerdown",this.onMouseDown),i.removeEventListener("mousedown",this.onMouseDown),document.removeEventListener("keydown",this.onKeyDown),i.removeEventListener("pointerdown",this.onAny),i.removeEventListener("mousedown",this.onAny),document.removeEventListener("keydown",this.onAny),[...this.eventsAfterPerObject.entries()].forEach(([r,n])=>{r.removeEventListener("userEvent",this.onUserEvent),n.forEach(s=>s.disconnect())})}[...this.eventsPerObject.entries()].forEach(([e,t])=>{e.removeEventListener("userEvent",this.onUserEvent),t.forEach(i=>i.disconnect())}),this.eventsPerObject.clear(),this.eventsAfterPerObject.clear()}},c3e=new Map;function Fh(e,t){c3e.set(e,t)}_r();var Yke=class{constructor(e,t,i,r,n){this.publish=e,this.controlsManager=t,this.animationControls=i,this.eventContext=r,this.sharedVariables=n,this.isEnabled=!1,this.activateCount=0,this.needsMouse=!1,this.needsRaycast=!1,this.onTouchMovePreventScroll=s=>{let a=window.parent!==window,o=document.documentElement.scrollHeight>document.documentElement.clientHeight||document.documentElement.scrollWidth>document.documentElement.clientWidth;(s.touches.length>1||this.preventTouchScroll||a===!1&&o===!1)&&s.preventDefault()},this.onMouseWheelPreventScroll=s=>{this.preventScroll&&s.preventDefault()},this.onMouseMove=s=>{this.eventContext.sharedAssets.mouseProperty={...this.getMousePosition(s),pressed:s.buttons>0}},this.onMouseDown=s=>{this.eventContext.sharedAssets.mouseProperty={...this.getMousePosition(s),pressed:!0}},this.onMouseUp=s=>{this.eventContext.sharedAssets.mouseProperty={...this.getMousePosition(s),pressed:!1}},this.getMousePosition=s=>{let{domRect:a}=this.eventContext,{pageX:o,pageY:l}=s.touches?.length>0?s.touches[0]:s;return{x:o-(a.left+window.scrollX),y:l-(a.top+window.scrollY)}},this.stopRaycast=e.stopRaycast,this.preventScroll=e.preventScroll,this.preventTouchScroll=e.preventTouchScroll,this.hideCursor=e.hideCursor,this.requestRender=r.requestRender}warnMissingEventFeatures(){this.eventContext.page.traverseEntity(e=>{for(let t of e.dataPatched.events){if(t.data.disabled===!0)continue;let i=t.data.type;if(this.handlers[i]!==void 0)continue;let r=Vke[i];r!==void 0&&Ta(r,`a "${i}" event`)}})}activate(e=!1){if(this.isEnabled)return;this.isEnabled=!0,this.initializeActionsDependentStates(),this.needsMouse&&(this.eventContext.domElement.addEventListener("pointermove",this.onMouseMove),this.eventContext.domElement.addEventListener("pointerdown",this.onMouseDown));let t={eventContext:this.eventContext,eventManager:this,sharedVariables:this.sharedVariables,needsMouse:this.needsMouse,needsRaycast:this.needsRaycast};this.handlers={};let i=(s,a)=>{let o=(l=s,c3e.get(l));var l;o!==void 0?this.handlers[s]=o(t):a!==void 0&&(this.handlers[s]=a())};i("Spline",()=>new Wke(this.eventContext)),i("VariableChange"),i("API"),i("WEBHOOK"),i("AIAssistantListener"),i("AIAssistantTrigger"),i("Conditional"),i("Start",()=>new Xke(this.eventContext,this)),i("Basic",()=>new qke(this.eventContext,this,this.needsRaycast)),i("MouseHover"),i("Scroll"),i("Follow"),i("DragDrop"),i("LookAt"),i("Resize"),i("Textfields"),this.warnMissingEventFeatures();let{page:r,domElement:n}=this.eventContext;this.hideCursor&&(n.style.cursor="none"),r.traverseEntity(s=>{s.addEventListener("requestRender",this.requestRender)}),Object.values(this.handlers).forEach(s=>s.connect()),n.addEventListener("wheel",this.onMouseWheelPreventScroll),n.addEventListener("touchmove",this.onTouchMovePreventScroll),this.activateCount++,e||this.eventContext.sharedAssets.openAIRealtime?.connect()}deactivate(e=!1){if(!this.isEnabled)return;this.isEnabled=!1,this.eventContext.domElement.removeEventListener("pointermove",this.onMouseMove),this.eventContext.domElement.removeEventListener("pointerdown",this.onMouseDown),this.eventContext.domElement.removeEventListener("pointerup",this.onMouseUp),this.eventContext.sharedAssets.mouseProperty=null,this.eventContext.sharedAssets.raycastProperty=null;let{page:t,domElement:i}=this.eventContext;i.style.cursor="",Object.values(this.handlers).forEach(r=>r.disconnect()),this.controlsManager.gameControl?.disposeActions(),this.controlsManager.disconnectEvents(),t.traverseEntity(r=>{r.removeEventListener("requestRender",this.requestRender),r.destroyedInAction=!1}),i.removeEventListener("touchmove",this.onTouchMovePreventScroll),i.removeEventListener("wheel",this.onMouseWheelPreventScroll),this.animationControls.onExitPlayMode(),e||this.eventContext.sharedAssets.openAIRealtime?.disconnect()}dispose(){this.deactivate(),Object.values(this.handlers).forEach(e=>e.dispose())}get isPaused(){return this.isEnabled}pause(){this.deactivate()}resume(){this.activate()}reset(){this.deactivate(!0),this.activate(!0),this.controlsManager.deactivate(),this.controlsManager.activate(this),this.controlsManager.page.updateMatrixWorld(!0),this.controlsManager.rebuildBVH()}updateUseWindowEvents(e){let t=this.isEnabled;t&&this.deactivate(),this.eventContext.useWindowEvents=e,t&&this.activate()}initializeActionsDependentStates(){let e=this.eventContext.sharedAssets;e.resetDynamicVariablePlayState();let t=i=>{if(i.data.type==="Conditional"&&(i.data.ifActions.forEach(t),i.data.elseActions.forEach(t)),i.data.type==="Conditional"||i.data.type==="SetVariable")for(let r of i.data.type==="Conditional"?i.data.condition:i.data.expression)"id"in r&&Array.isArray(r.id)&&(r.id[0]==="mouse"&&(this.needsMouse=!0),r.id[0]==="raycast"&&(this.needsRaycast=!0));i.data.type==="DynamicVariablePlay"&&i.data.variableId!==""&&(i.data.mode==="Play"||i.data.mode==="PlayPause"||i.data.mode==="Toggle")&&e.setDynamicVariablePlayState(i.data.variableId,"Stopped")};this.eventContext.page.traverseEntity(i=>{if(i.data?.events.length)for(let r of i.data.events)if(r.data.type==="VariableChange"&&(r.data.variableId==="mouseProperty"&&(this.needsMouse=!0),r.data.variableId==="raycastProperty"&&(this.needsRaycast=!0)),r.data.type==="Conditional")for(let n of["inActions","outActions"])r.data[n].forEach(t);else if(r.data.type==="DragDrop")for(let n of["drag","drop"])r.data.dragDropActions[n].forEach(t);else if(r.data.type==="GameControl")for(let n of["idle","move","jump","run"])r.data.gameActions[n].forEach(t);else if(r.data.type==="Resize")for(let n of r.data.breakpoints)n.data.actions.forEach(t);else r.data.type==="LookAt"||r.data.type==="API"||r.data.actions.forEach(t)})}};ae(),jr(),jr();var BN={type:"change"},iM={type:"start"},Cv={type:"end",nonOrbit:!0},Kke={type:"end",nonOrbit:!1},Zke={type:"end",isZoom:!0,nonOrbit:!0},Qke={type:"end",changed:!1},j9={type:"cameraAnimatingInTimeline"},W9=new jt,sve=new Z,Jke=2*Math.PI,FN=new R,UN=new Z,rM=new R,nM=new jt,ave=new Ue,eVe={type:"requestRender"},p3e=class extends cs{constructor(e,t,i={isPlayMode:!1,isExport:!1},r){super(),this.object=e,this.domElement=t,this.options=i,this.timelineState=r,this.enabled=!0,this.useKeyEvents=!0,this.enableDamping=!1,this.enableZoom=!0,this.enableRotate=!0,this.enablePan=!0,this.autoRotate=!1,this.rotationLimitsMode=0,this.panLimitsMode=0,this.rotationSoftLimit=2,this.panSoftLimit=2,this.hoverRotatePanMode=0,this.zoomLimitsEnabled=!1,this.mouseButtons=[0,5],this.mouseButtonsPlay=[3,4,5],this.touches=[null,yh.DOLLY_ROTATE,yh.PAN],this.offset=new R,this.eye=new R,this.lastPosition=new R,this.lastQuaternion=new jt,this.current=new Z,this.overShoot=new Z,this.overRatio=new Z,this.spherical=new vW,this.sphericalDelta=new vW,this.panOffset=new R,this.panLeftV=new R,this.panUpV=new R,this.panV=new R,this.rotateStart=new Z,this.rotateEnd=new Z,this.rotateDelta=new Z,this.panStart=new Z,this.panEnd=new Z,this.panDelta=new Z,this.dollyStart=new Z,this.dollyEnd=new Z,this.dollyDelta=new Z,this.rotationRangeFactor=new Z,this.panRangeFactor=new Z,this.state=-1,this.zoomChanged=!1,this.isPointerDown=!1,this.isThetaFlipped=!1,this.prevScale=0,this.scale=1,this.gesture=!1,this.lastTrackpadPanTime=-1/0,this.lastMouseWheelZoomTime=-1/0,this.timer=-1,this.timerHover=-1,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minPhi=0,this.maxPhi=Math.PI,this.minTheta=-1/0,this.maxTheta=1/0,this.minH=0,this.maxH=Math.PI,this.minV=-1/0,this.maxV=1/0,this.autoRotateClockwise=!0,this.isPanOverShoot=!1,this.isRotateOverShoot=!1,this.resetHoverEffectOnPointerLeave=!1,this.hasChange=!1,this.useWindowEvents=!1,this.isTouchZoom=!0,this.autoRotateSpeed=2,this.dampingFactor=.125,this.zoomSpeed=2,this.rotateSpeed=1,this.rotateFactor=1,this.panSpeed=1,this.hoverRotatePanStrength=.1,this.hoverRotateDamping=this.dampingFactor,this.isCurrentlyDamping=!1,this.thetaIsFree=!1,this.phiIsFree=!1,this.needsUpdate=!0,this.onCameraChange=n=>{this.object.removeEventListener("beginState",this.onBeginState),this.object.removeEventListener("completeState",this.onCompleteState),this.object.removeEventListener("cameraChange",this.onCameraChange),this.object=n.camera,this.object.addEventListener("beginState",this.onBeginState),this.object.addEventListener("completeState",this.onCompleteState),this.object.addEventListener("cameraChange",this.onCameraChange)},this.update=()=>{this.object.updateWorldMatrix(!0,!1),this.object.matrixWorld.decompose(rM,nM,FN),this.offset.copy(rM).sub(this.target),this.spherical.setFromVector3(this.offset),this.object.isUpVectorFlipped&&(this.spherical.phi*=-1,this.spherical.theta-=Math.PI),this.autoRotate&&this.state===-1&&this.rotateLeft((this.autoRotateClockwise===!0?1:-1)*this.getAutoRotationAngle()),this.rotationLimitsMode!==0&&this.applyLimits(this.sphericalDelta,this.rotationLimitsMode,this.rotationSoftLimit,this.maxTheta,this.minTheta,this.maxPhi,this.minPhi,this.rotationRangeFactor),this.rotationLimitsMode!==2&&(this.spherical.phi+=this.sphericalDelta.phi),(this.rotationLimitsMode!==1||this.autoRotate===!0)&&(this.spherical.theta+=this.sphericalDelta.theta),this.spherical.radius*=this.scale,this.zoomLimitsEnabled&&this.object.isPerspectiveCamera&&(this.spherical.radius=Math.max(this.minDistance,Math.min(this.maxDistance,this.spherical.radius))),this.panLimitsMode!==0&&(this.target.applyQuaternion(W9.copy(nM).invert()),this.panOffset.applyQuaternion(W9),this.applyLimits(this.panOffset,this.panLimitsMode,this.panSoftLimit,this.maxH,this.minH,this.maxV,this.minV,this.panRangeFactor),this.target.applyQuaternion(nM),this.panOffset.applyQuaternion(nM)),this.panLimitsMode===2&&(this.panOffset.y=0),this.panLimitsMode===1&&(this.panOffset.x=0),this.state!==-1||this.gesture?(this.target.add(this.panOffset),this.panOffset.set(0,0,0)):(this.panOffset.multiplyScalar(1-this.dampingFactor),this.target.add(this.panOffset)),this.offset.setFromSpherical(this.spherical),rM.copy(this.target).add(this.offset),this.object.position.copy(this.target).add(this.offset),this.object.parent&&(ave.copy(this.object.parent.matrixWorld).invert(),this.object.position.applyMatrix4(ave));let n=this.spherical.phi%Jke;if(this.eye.copy(this.offset).normalize(),this.object.up.copy(hn.DEFAULT_UP).applyAxisAngle(this.eye,this.object.angleOffsetFromUp),n>0&&n>Math.PI||n<0&&n>-Math.PI?(this.object.up.negate(),this.object.lookAt(this.target),this.object.isUpVectorFlipped=!0):(this.object.lookAt(this.target),this.object.isUpVectorFlipped=!1),this.state===-1||this.enableDamping===!0){let s=this.hoverRotatePanMode===1?this.hoverRotateDamping:this.dampingFactor;this.sphericalDelta.theta*=1-s,this.sphericalDelta.phi*=1-s}else this.sphericalDelta.set(0,0,0);if(this.scale=1,this.lastPosition.distanceToSquared(this.object.position)>.01||8*(1-this.lastQuaternion.dot(this.object.quaternion))>1e-8)return this.dispatchEvent(BN),this.object.dispatchEvent(eVe),this.lastPosition.copy(this.object.position),this.lastQuaternion.copy(this.object.quaternion),void(this.isCurrentlyDamping=!0);this.isPanOverShoot=!1,this.isRotateOverShoot=!1,this.object.wasMovedBySwitchCameraAction=!1,this.sphericalDelta.set(0,0,0),this.panOffset.set(0,0,0),this.isCurrentlyDamping=!1},this.onPointerDown=n=>{this.enabled!==!1&&(n.pointerType==="touch"||n.pointerType==="pen"&&Zl?this.onPointerDownTouch(n):this.onPointerDownMouse(n),this.state!==-1&&(this.isPointerDown=!0,this.dispatchEvent(iM),this.domElement.addEventListener("pointermove",this.onPointerMove),this.domElement.addEventListener("pointerup",this.onPointerUp),n.stopPropagation(),n.pointerType==="touch"||n.pointerType==="pen"&&Zl||this.domElement.setPointerCapture(n.pointerId)))},this.onPointerLeave=n=>{this.resetHoverEffectOnPointerLeave&&!this.useWindowEvents?(this.hoverRotatePanMode===1?(this.sphericalDelta.theta=-this.spherical.theta,this.sphericalDelta.phi=-this.spherical.phi,FN.subVectors(this.position0,this.target0),this.spherical.setFromVector3(FN),this.sphericalDelta.theta+=this.spherical.theta,this.sphericalDelta.phi+=this.spherical.phi,this.sphericalDelta.theta/=8,this.sphericalDelta.phi/=8):this.hoverRotatePanMode===2&&this.panOffset.subVectors(this.target0,this.target).divideScalar(8),this.update()):this.pointerLeaveEvent=n},this.onPointerEnter=n=>{this.resetHoverEffectOnPointerLeave||this.pointerLeaveEvent===void 0?UN.set(n.clientX-this.domElement.clientWidth/2,n.clientY-this.domElement.clientHeight/2):UN.set(n.clientX-this.pointerLeaveEvent.clientX,n.clientY-this.pointerLeaveEvent.clientY),this.hoverRotatePanMode===1?(this.rotateDelta.copy(UN).multiplyScalar(this.rotateSpeed*this.hoverRotatePanStrength).rotateAround(sve,-this.object.angleOffsetFromUp),this.rotateLeft(2*Math.PI*this.rotateDelta.x/this.domElement.clientHeight),this.rotateUp(2*Math.PI*this.rotateDelta.y/this.domElement.clientHeight),this.rotateStart.set(n.clientX,n.clientY)):this.hoverRotatePanMode===2&&(this.panDelta.copy(UN).multiplyScalar(this.panSpeed*this.hoverRotatePanStrength),this.pan(this.panDelta.x,this.panDelta.y),this.panStart.set(n.clientX,n.clientY)),this.update()},this.onPointerMove=n=>{this.timelineState?.isPlayingCameraAnimation?this.dispatchEvent(j9):this.enabled!==!1&&(this.checkRaycastLock()||(n.pointerType==="touch"||n.pointerType==="pen"&&Zl?this.onPointerMoveTouch(n):this.onPointerMoveMouse(n),n.stopPropagation()))},this.onPointerUp=n=>{this.isPointerDown=!1,vi.length===0&&(this.domElement.removeEventListener("pointermove",this.onPointerMove),this.domElement.removeEventListener("pointerup",this.onPointerUp)),vi.length>1&&n.preventDefault(),this.hasChange?this.dispatchEvent(this.state===0?Kke:Cv):this.dispatchEvent(Qke),this.state=-1,n&&(n.stopPropagation(),n.pointerType==="touch"||n.pointerType==="pen"&&Zl||this.domElement.releasePointerCapture(n.pointerId))},this.onPointerDownMouse=n=>{let s;switch(s=this.useKeyEvents?this.mouseButtons[n.button]:this.mouseButtonsPlay[n.button],s){case 0:if(n.altKey!==!0||n.shiftKey||US(n)){if(this.key===" "){if(this.enablePan===!1)return;this.handleMouseDownPan(n),this.state=2}}else{if(this.enableRotate===!1)return;this.handleMouseDownRotate(n),this.state=0}break;case 4:if(this.enablePan===!1)return;this.handleMouseDownPan(n),this.state=2;break;case 3:if(US(n)||n.shiftKey){if(this.enablePan===!1)return;this.handleMouseDownPan(n),this.state=2}else{if(this.enableRotate===!1)return;this.handleMouseDownRotate(n),this.state=0}break;case 5:if(US(n)||n.shiftKey){if(this.enableRotate===!1)return;this.handleMouseDownRotate(n),this.state=0}else{if(this.enablePan===!1)return;this.handleMouseDownPan(n),this.state=2}break;default:this.state=-1}},this.onPointerMoveMouse=n=>{switch(this.state){case 0:if(this.enableRotate===!1)return;this.handleMouseMoveRotate(n);break;case 1:if(this.enableZoom===!1)return;this.handleMouseMoveDolly(n);break;case 2:if(this.enablePan===!1)return;this.handleMouseMovePan(n)}this.object.wasMovedByUser=!0},this.onPointerDownTouch=n=>{switch(vi.length>1&&n.preventDefault(),this.touches[vi.length-1]){case yh.ROTATE:if(this.enableRotate===!1)return void(this.state=-1);this.handleTouchStartRotate(),this.state=3;break;case yh.PAN:if(this.enablePan===!1)return void(this.state=-1);this.handleTouchStartPan(),this.state=4;break;case yh.DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this.handleTouchStartDollyPan(),this.state=5;break;case yh.DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this.handleTouchStartDollyRotate(),this.state=6;break;default:this.state=-1}},this.onPointerMoveTouch=n=>{switch(vi.length>1&&n.preventDefault(),this.state){case 3:if(this.enableRotate===!1)return;this.handleTouchMoveRotate(n),this.update();break;case 4:if(this.enablePan===!1)return;this.handleTouchMovePan(n),this.update();break;case 5:if(this.enableZoom===!1&&this.enablePan===!1)return;this.handleTouchMoveDollyPan(n),this.update();break;case 6:if(this.enableZoom===!1&&this.enableRotate===!1)return;this.handleTouchMoveDollyRotate(n),this.update();break;default:this.state=-1}this.object.wasMovedByUser=!0},this.dispatchEndDebounced=TA(()=>{this.zoomChanged?this.dispatchEvent(Zke):this.dispatchEvent(Cv),this.zoomChanged=!1},33),this.onMouseWheel=n=>{if(this.enabled!==!1&&(this.enableZoom!==!1||this.enablePan!==!1)&&!this.checkRaycastLock()){if(!this.options.isExport&&this.domElement.clientHeight===document.body.clientHeight&&this.domElement.clientWidth===document.body.clientWidth&&n.preventDefault(),this.dispatchEvent(iM),this.timelineState?.isPlayingCameraAnimation)return void this.dispatchEvent(j9);this.handleMouseWheel(n),this.dispatchEndDebounced(),this.object.wasMovedByUser=!0}},this.onGesture=n=>{if(n.preventDefault(),this.enabled!==!1&&!this.checkRaycastLock()&&!l1){if(this.timelineState?.isPlayingCameraAnimation)return void this.dispatchEvent(j9);if(n.type==="gesturechange"){if(this.enableZoom===!1||this.isTouchZoom===!1)return;this.dispatchEvent(iM),n.scale>this.prevScale?this.dollyIn(this.getZoomScale()):n.scale<this.prevScale&&this.dollyOut(this.getZoomScale()),this.prevScale=n.scale,this.update(),this.object.wasMovedByUser=!0}else this.dispatchEvent(Cv)}},this.onContextMenu=n=>{n.preventDefault()},this.onTouchEnd=n=>{n.preventDefault()},this.onKeyDown=n=>{this.enabled!==!1&&(this.key=n.key,n.key===" "&&this.dispatchEvent(iM))},this.onKeyUp=n=>{this.key=void 0,this.enabled!==!1&&(this.state!==-1&&n.key==="Alt"&&this.onPointerUp(vi[0]),n.key===" "&&this.dispatchEvent(Cv))},this.onPointerHover=n=>{n.pointerType!=="mouse"||this.enabled===!1||this.state!==-1||this.hoverRotatePanMode===2&&this.isPanOverShoot||this.hoverRotatePanMode===1&&this.isRotateOverShoot||(this.isPointerDown=!0,this.hoverRotatePanMode===2?this.handleMouseMovePan(n,this.hoverRotatePanStrength):this.hoverRotatePanMode===1&&this.handleMouseMoveRotate(n,this.hoverRotatePanStrength))},this.onBeginState=()=>{this.enabled=!1,this.needsUpdate=!1},this.onCompleteState=n=>{n.isfromEntity&&this.options.isPlayMode||(this.enabled=!0,this.needsUpdate=!0,this.object.updateUp(),this.object.getTarget(this.target))},this.target=this.object.getTarget(),this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this.quat0=this.object.quaternion.clone(),this.isUpVectorFlipped0=this.object.isUpVectorFlipped,this.object.updateWorldMatrix(!0,!1),this.object.matrixWorld.decompose(rM,nM,FN),this.offset.copy(rM).sub(this.target),this.spherical.setFromVector3(this.offset),this.object.isUpVectorFlipped&&(this.spherical.phi*=-1,this.spherical.theta-=Math.PI),this.initialSphericalRadius=this.spherical.radius,this.addEventListenersToCamera()}dispatchEvent(e){e.type==="start"?this.hasChange=!1:this.hasChange=!0,super.dispatchEvent(e)}addEventListenersToCamera(){this.object.addEventListener("beginState",this.onBeginState),this.object.addEventListener("completeState",this.onCompleteState),this.object.addEventListener("cameraChange",this.onCameraChange)}removeEventListenersFromCamera(){this.object.removeEventListener("beginState",this.onBeginState),this.object.removeEventListener("completeState",this.onCompleteState),this.object.removeEventListener("cameraChange",this.onCameraChange)}updateUseWindowEvents(e){if(window.removeEventListener("pointermove",this.onPointerHover),this.domElement.removeEventListener("pointermove",this.onPointerHover),this.useWindowEvents=e,this.hoverRotatePanMode!==0&&(this.useWindowEvents?window.addEventListener("pointermove",this.onPointerHover):this.domElement.addEventListener("pointermove",this.onPointerHover)),this.domElement.removeEventListener("pointerleave",this.onPointerLeave),this.domElement.removeEventListener("pointerenter",this.onPointerEnter),window.removeEventListener("pointerleave",this.onPointerLeave),window.removeEventListener("pointerenter",this.onPointerEnter),this.hoverRotatePanMode!==0&&!this.useWindowEvents){let t=this.useWindowEvents?window:this.domElement;t.addEventListener("pointerleave",this.onPointerLeave),t.addEventListener("pointerenter",this.onPointerEnter)}}fromJSON(e,t){this.rotateFactor=e.rotationSpeed??1,this.setEnableDampingSpeed(e.enableDamping),this.enablePan=e.enablePan,this.enableZoom=e.enableZoom,this.enableRotate=e.enableRotate,this.rotationLimitsMode=e.rotationLimitsMode,this.thetaIsFree=e.rotationHorizontalOffset.min===e.rotationHorizontalOffset.max&&e.rotationHorizontalOffset.min===Math.PI,this.phiIsFree=e.rotationVerticalOffset.min===e.rotationVerticalOffset.max&&e.rotationVerticalOffset.min===Math.PI,this.panLimitsMode=e.panLimitsMode,this.panSoftLimit=e.panSoftLimit,this.rotationSoftLimit=e.rotationSoftLimit,this.hoverRotatePanMode=e.hoverRotatePanMode,this.hoverRotateDamping=e.hoverRotateDamping??this.dampingFactor,this.useWindowEvents=t==="window",this.hoverRotatePanMode!==0&&(this.useWindowEvents?window.addEventListener("pointermove",this.onPointerHover):this.domElement.addEventListener("pointermove",this.onPointerHover));let i=e.hoverRotatePanStrength/100;this.hoverRotatePanStrength=i**2,this.zoomLimitsEnabled=e.zoomLimitsEnabled,this.minZoom=e.zoomLimits.min,this.maxZoom=Math.max(e.zoomLimits.min,e.zoomLimits.max),this.minDistance=1e3/this.maxZoom,this.maxDistance=Math.max(this.minDistance,1e3/e.zoomLimits.min),this.autoRotate=e.autoRotate,this.autoRotateSpeed=e.autoRotateSpeed,this.autoRotateClockwise=e.autoRotateClockwise;let r=this.object.getTarget().applyQuaternion(W9.copy(this.object.quaternion).invert());this.minV=-e.panVerticalOffset.min+r.y,this.maxV=e.panVerticalOffset.max+r.y,this.minH=-e.panHorizontalOffset.min+r.x,this.maxH=e.panHorizontalOffset.max+r.x,this.panRangeFactor.set(this.maxH-this.minH,this.maxV-this.minV).divideScalar(2),this.rotationRangeFactor.setScalar(Math.PI).divideScalar(4),this.minPhi=cc(this.spherical.phi-e.rotationVerticalOffset.min),this.maxPhi=cc(this.spherical.phi+e.rotationVerticalOffset.max),this.minTheta=cc(cc(this.spherical.theta)-e.rotationHorizontalOffset.min),this.maxTheta=cc(cc(this.spherical.theta)+e.rotationHorizontalOffset.max),this.isThetaFlipped=this.minTheta>this.maxTheta,e.orbitTouches===1&&(this.touches[0]=yh.ROTATE),e.panTouches===1&&(this.touches[0]=yh.PAN),e.orbitTouches===2&&(this.touches[1]=yh.DOLLY_ROTATE),e.panTouches===2&&(this.touches[1]=yh.DOLLY_PAN),e.orbitTouches===3&&(this.touches[2]=yh.ROTATE),e.panTouches===3&&(this.touches[2]=yh.PAN),this.isTouchZoom=e.isTouchZoom,this.resetHoverEffectOnPointerLeave=e.resetHoverEffectOnPointerLeave??!1}connect(){if(this.domElement.addEventListener("contextmenu",this.onContextMenu),this.domElement.addEventListener("pointerdown",this.onPointerDown),this.domElement.addEventListener("wheel",this.onMouseWheel),window.addEventListener("keydown",this.onKeyDown,!1),window.addEventListener("keyup",this.onKeyUp,!1),this.domElement.addEventListener("gesturestart",this.onGesture),this.domElement.addEventListener("gesturechange",this.onGesture),this.domElement.addEventListener("gestureend",this.onGesture),this.domElement.addEventListener("touchend",this.onTouchEnd),this.hoverRotatePanMode!==0&&!this.useWindowEvents){let e=this.useWindowEvents?window:this.domElement;e.addEventListener("pointerleave",this.onPointerLeave),e.addEventListener("pointerenter",this.onPointerEnter)}this.pointerLeaveEvent=void 0}dispose(){this.removeEventListenersFromCamera(),this.domElement.removeEventListener("contextmenu",this.onContextMenu),this.domElement.removeEventListener("pointerdown",this.onPointerDown),this.domElement.removeEventListener("wheel",this.onMouseWheel),window.removeEventListener("keydown",this.onKeyDown,!1),window.removeEventListener("keyup",this.onKeyUp,!1),this.domElement.removeEventListener("pointermove",this.onPointerHover),window.removeEventListener("pointermove",this.onPointerHover),this.domElement.removeEventListener("gesturestart",this.onGesture),this.domElement.removeEventListener("gesturechange",this.onGesture),this.domElement.removeEventListener("gestureend",this.onGesture),this.domElement.removeEventListener("touchend",this.onTouchEnd),this.domElement.removeEventListener("pointerleave",this.onPointerLeave),this.domElement.removeEventListener("pointerenter",this.onPointerEnter),window.removeEventListener("pointerleave",this.onPointerLeave),window.removeEventListener("pointerenter",this.onPointerEnter),this.domElement.removeEventListener("pointermove",this.onPointerMove),this.domElement.removeEventListener("pointerup",this.onPointerUp)}applyLimits(e,t,i,r,n,s,a,o){let l,h,u;this.overShoot.set(0,0),e instanceof R?(l=e.x,h=e.y,this.current.set(this.target.x,this.target.y),u=!0):(l=e.theta,h=e.phi,this.current.set(cc(this.spherical.theta),cc(this.spherical.phi)),u=!1),i===0&&(this.current.x+=l,this.current.y+=h),(t===3||t===2)&&(!u&&this.isThetaFlipped?this.current.x>r&&this.current.x<0?this.overShoot.x=r-this.current.x:this.current.x<n&&this.current.x>0&&(this.overShoot.x=n-this.current.x):this.current.x>r?this.overShoot.x=r-this.current.x:this.current.x<n&&(this.overShoot.x=n-this.current.x)),(t===3||t===1)&&(this.current.y>s?this.overShoot.y=s-this.current.y:this.current.y<a&&(this.overShoot.y=a-this.current.y)),u||(this.overShoot.x=cc(this.overShoot.x),this.overShoot.y=cc(this.overShoot.y)),i!==0?(this.overRatio.copy(this.overShoot).divide(o),this.overRatio.x=Math.min(Math.abs(this.overRatio.x),1),this.overRatio.y=Math.min(Math.abs(this.overRatio.y),1),i===1&&(this.overRatio.x=ove(Math.abs(this.overRatio.x)),this.overRatio.y=ove(Math.abs(this.overRatio.y))),this.isPointerDown||i===1?i===2&&(this.overRatio.x>.9&&!this.thetaIsFree||this.overRatio.y>.9&&!this.phiIsFree)?this.isPointerDown=!1:(l*this.overShoot.x<0&&!this.thetaIsFree&&(l*=1-this.overRatio.x),h*this.overShoot.y<0&&!this.phiIsFree&&(h*=1-this.overRatio.y)):i===2&&(!u&&(this.overRatio.x>.002&&!this.thetaIsFree||this.overRatio.y>.002&&!this.phiIsFree)||u&&(Math.abs(this.overShoot.x)>2||Math.abs(this.overShoot.y)>2)?(this.thetaIsFree||(l=.05*this.overShoot.x),this.phiIsFree||(h=.05*this.overShoot.y),u?this.isPanOverShoot=!0:this.isRotateOverShoot=!0):u?this.isPanOverShoot=!1:this.isRotateOverShoot=!1)):(l+=this.overShoot.x,h+=this.overShoot.y),e instanceof R?(e.x=l,e.y=h):(this.thetaIsFree||(e.theta=l),this.phiIsFree||(e.phi=h))}setEnableDampingSpeed(e){this.enableDamping=e,this.rotateSpeed=(e===!0?.2:1)*this.rotateFactor}stopDamping(){this.sphericalDelta.theta=0,this.sphericalDelta.phi=0,this.panOffset.set(0,0,0)}setTarget(e,t,i){this.stopDamping(),this.target.set(e,t,i)}getAutoRotationAngle(){return 2*Math.PI/60/60*this.autoRotateSpeed}getZoomScale(){return Math.pow(.95,this.zoomSpeed)}rotateLeft(e){this.sphericalDelta.theta-=e}rotateUp(e){this.sphericalDelta.phi-=e}panLeft(e,t){this.panLeftV.setFromMatrixColumn(t,0),this.panLeftV.multiplyScalar(-e),this.panOffset.add(this.panLeftV)}panUp(e,t){this.panUpV.setFromMatrixColumn(t,1),this.panUpV.multiplyScalar(e),this.panOffset.add(this.panUpV)}pan(e,t){let i=this.domElement;if(i&&this.object.isPerspectiveCamera){let r=this.object.position;this.panV.copy(r).sub(this.target);let n=this.panV.length();n*=Math.tan(this.object.fov/2*Math.PI/180),this.panLeft(2*e*n/i.clientHeight,this.object.matrixWorld),this.panUp(2*t*n/i.clientHeight,this.object.matrixWorld)}else i&&this.object.isOrthographicCamera&&(this.panLeft(e*(this.object.right-this.object.left)/this.object.zoom/i.clientWidth,this.object.matrixWorld),this.panUp(t*(this.object.top-this.object.bottom)/this.object.zoom/i.clientHeight,this.object.matrixWorld));this.dispatchEvent(BN)}dollyOut(e){this.object.isPerspectiveCamera?this.scale/=e:this.object.isOrthographicCamera&&(this.object.zoom*=e,this.zoomLimitsEnabled&&(this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom))),this.object.updateProjectionMatrix(),this.zoomChanged=!0),this.dispatchEvent(BN)}dollyIn(e){this.object.isPerspectiveCamera?this.scale*=e:this.object.isOrthographicCamera&&(this.object.zoom/=e,this.zoomLimitsEnabled&&(this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom))),this.object.updateProjectionMatrix(),this.zoomChanged=!0),this.dispatchEvent(BN)}setZoom(e){if(this.dispatchEvent(iM),this.object.isPerspectiveCamera){let t=this.initialSphericalRadius/e/this.spherical.radius;this.scale=t}else this.object.isOrthographicCamera&&(this.object.zoom=e,this.zoomLimitsEnabled&&(this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom))),this.object.updateProjectionMatrix(),this.zoomChanged=!0);this.dispatchEvent(Cv)}handleMouseDownRotate(e){this.rotateStart.set(e.clientX,e.clientY)}handleMouseDownDolly(e){this.dollyStart.set(e.clientX,e.clientY)}handleMouseDownPan(e){this.panStart.set(e.clientX,e.clientY)}handleMouseMoveRotate(e,t=1){e.movementX!==void 0?this.rotateDelta.set(e.movementX,e.movementY):(this.rotateEnd.set(e.clientX,e.clientY),this.rotateDelta.subVectors(this.rotateEnd,this.rotateStart),this.rotateStart.copy(this.rotateEnd)),this.rotateDelta.multiplyScalar(this.rotateSpeed*t).rotateAround(sve,-this.object.angleOffsetFromUp);let i=this.domElement,r=this.useWindowEvents?window.innerHeight:i.clientHeight,n=2*Math.PI*this.rotateDelta.x/r,s=2*Math.PI*this.rotateDelta.y/r;this.rotateLeft(n),this.rotateUp(s),this.update()}handleMouseMoveDolly(e){this.dollyEnd.set(e.clientX,e.clientY),this.dollyDelta.subVectors(this.dollyEnd,this.dollyStart),this.dollyDelta.y>0?this.dollyOut(this.getZoomScale()):this.dollyDelta.y<0&&this.dollyIn(this.getZoomScale()),this.dollyStart.copy(this.dollyEnd),this.update()}handleMouseMovePan(e,t=1){e.movementX!==void 0?this.panDelta.set(e.movementX,e.movementY):(this.panEnd.set(e.clientX,e.clientY),this.panDelta.subVectors(this.panEnd,this.panStart),this.panStart.copy(this.panEnd)),this.panDelta.multiplyScalar(this.panSpeed*t),this.pan(this.panDelta.x,this.panDelta.y),this.update()}handleMouseWheel(e){if(e.deltaX===0&&e.deltaY===0)return;let t=e.ctrlKey===!0||US(e)===!0,i=US(e)===!1&&((s=e).wheelDeltaY===0||s.deltaY===0?!(wA&&s.shiftKey&&Math.abs(s.wheelDeltaX)>=120)&&(s.wheelDeltaX?Aee(s.wheelDeltaX,s.deltaX):s.deltaMode===0):s.wheelDeltaY?Aee(s.wheelDeltaY,s.deltaY):s.deltaMode===0)===!0,r=t===!1&&(this.gesture===!0||e.timeStamp-this.lastTrackpadPanTime<300),n=t===!1&&r===!1&&e.timeStamp-this.lastMouseWheelZoomTime<300;var s;if(F_e!==!1||n!==!1||i!==!0&&r!==!0){if(this.enableZoom===!1)return;this.gesture&&(window.clearTimeout(this.timer),this.gesture=!1,this.isPointerDown=!1,this.dispatchEvent(Cv)),t===!1&&i===!1&&(this.lastMouseWheelZoomTime=e.timeStamp),e.deltaY===0?e.deltaX<0?this.dollyIn(this.getZoomScale()):e.deltaX>0&&this.dollyOut(this.getZoomScale()):e.deltaY<0?this.dollyIn(this.getZoomScale()):e.deltaY>0&&this.dollyOut(this.getZoomScale()),this.update(),this.gesture=!1,this.isPointerDown=!1}else{if(this.enablePan===!1)return;let a=this.gesture===!1&&r===!1;this.lastTrackpadPanTime=e.timeStamp,this.gesture||(this.gesture=!0,this.isPointerDown=!0),a===!1&&(this.panDelta.set(-e.deltaX,-e.deltaY).multiplyScalar(this.panSpeed),this.panDelta.x=Math.min(Math.abs(this.panDelta.x),100)*(this.panDelta.x<0?-1:1),this.panDelta.y=Math.min(Math.abs(this.panDelta.y),100)*(this.panDelta.y<0?-1:1),e.altKey?this.pan(0,this.panDelta.y):e.shiftKey?this.pan(this.panDelta.x,0):this.pan(this.panDelta.x,this.panDelta.y),this.update()),window.clearTimeout(this.timer),this.timer=window.setTimeout(()=>{this.gesture=!1,this.isPointerDown=!1,this.dispatchEvent(Cv)},100)}}handleTouchStartRotate(){if(vi.length===2){let e=.5*(vi[0].pageX+vi[1].pageX),t=.5*(vi[0].pageY+vi[1].pageY);this.rotateStart.set(e,t)}else this.rotateStart.set(vi[0].pageX,vi[0].pageY)}handleTouchStartPan(){if(vi.length===2){let e=.5*(vi[0].pageX+vi[1].pageX),t=.5*(vi[0].pageY+vi[1].pageY);this.panStart.set(e,t)}else this.panStart.set(vi[0].pageX,vi[0].pageY)}handleTouchStartDolly(){let e=vi[0].pageX-vi[1].pageX,t=vi[0].pageY-vi[1].pageY,i=Math.sqrt(e*e+t*t);this.dollyStart.set(0,i)}handleTouchStartDollyPan(){this.enableZoom&&this.isTouchZoom===!0&&this.handleTouchStartDolly(),this.enablePan&&this.handleTouchStartPan()}handleTouchStartDollyRotate(){this.enableZoom&&this.isTouchZoom===!0&&this.handleTouchStartDolly(),this.enableRotate&&this.handleTouchStartRotate()}handleTouchMoveRotate(e){if(vi.length===2){let i=FU(e),r=.5*(e.pageX+i.x),n=.5*(e.pageY+i.y);this.rotateEnd.set(r,n)}else{if(e.pointerId!==vi[0].pointerId)return;this.rotateEnd.set(e.pageX,e.pageY)}this.rotateDelta.subVectors(this.rotateEnd,this.rotateStart).multiplyScalar(this.rotateSpeed);let t=this.domElement;t&&(this.rotateLeft(2*Math.PI*this.rotateDelta.x/t.clientHeight),this.rotateUp(2*Math.PI*this.rotateDelta.y/t.clientHeight)),this.rotateStart.copy(this.rotateEnd)}handleTouchMovePan(e){if(vi.length===2){let t=FU(e),i=.5*(e.pageX+t.x),r=.5*(e.pageY+t.y);this.panEnd.set(i,r)}else{if(e.pointerId!==vi[0].pointerId)return;this.panEnd.set(e.pageX,e.pageY)}this.panDelta.subVectors(this.panEnd,this.panStart).multiplyScalar(this.panSpeed),this.pan(this.panDelta.x,this.panDelta.y),this.panStart.copy(this.panEnd)}handleTouchMoveDolly(e){let t=FU(e),i=e.pageX-t.x,r=e.pageY-t.y,n=Math.sqrt(i*i+r*r);this.dollyEnd.set(0,n),this.dollyDelta.set(0,Math.pow(this.dollyEnd.y/this.dollyStart.y,this.zoomSpeed)),this.dollyOut(this.dollyDelta.y),this.dollyStart.copy(this.dollyEnd)}handleTouchMoveDollyPan(e){this.enableZoom&&this.isTouchZoom===!0&&this.handleTouchMoveDolly(e),this.enablePan&&this.handleTouchMovePan(e)}handleTouchMoveDollyRotate(e){this.enableZoom&&this.isTouchZoom===!0&&this.handleTouchMoveDolly(e),this.enableRotate&&this.handleTouchMoveRotate(e)}checkRaycastLock(){if(this.object.data.raycastLock){if(this.options.isPlayMode)return!1;{let e=this.options?.showCameraLock;return e&&e(),!0}}return!1}};function cc(e){let t=2*Math.PI;for(;e<=-Math.PI;)e+=t;for(;e>Math.PI;)e-=t;return e}function ove(e){return 1-Math.pow(1-e,4)}ae();var tVe=class{constructor(e,t,i,r){this.enableResponsive=!1,this._renderer=e,this._camera=t,this._frameSize=new Z().copy(i),this._fov=r??t.fov}set frameSize(e){this._frameSize.copy(e)}setRenderSize(e,t){this._renderSize=e===void 0||t===void 0?void 0:new Z(e,t)}updateRenderer(){if(!this._renderer)return;let e=this._renderSize??this._frameSize;this._renderer.setSize(e.x,e.y)}updateViewport(){if(!this._renderer||!this._camera||this._camera.cameraType!=="PerspectiveCamera")return;let e=this._renderSize??this._frameSize;this._renderer.setViewport(0,0,e.x,e.y)}updateCamera(){!this._camera||(this._camera.cameraType==="PerspectiveCamera"?(this._camera.aspect=this._frameSize.x/this._frameSize.y,this._camera.updateProjectionMatrix()):this._camera.setViewplaneSize(this._frameSize.x,this._frameSize.y,this.enableResponsive))}setCamera(e){this._camera=e,this._fov=e.fov}revert(){let e=window.innerWidth,t=window.innerHeight;this._renderer&&(this._renderer.setViewport(0,0,e,t),this._renderer.setSize(e,t)),this._camera&&(this._camera.aspect=e/t,this._camera.fov=this._fov,this._camera.setViewplaneSize(e,t,this.enableResponsive),this._camera.updateProjectionMatrix())}};Na(),ae(),ae(),ae();var _s=new Us,zN=new R,lve=new Z,hve=new Z,uve=new Z,iVe=class{constructor(e){this.geometry=e.geometry,this.randomFunction=Math.random,this.indexAttribute=this.geometry.index,this.positionAttribute=this.geometry.getAttribute("position"),this.normalAttribute=this.geometry.getAttribute("normal"),this.colorAttribute=this.geometry.getAttribute("color"),this.uvAttribute=this.geometry.getAttribute("uv"),this.weightAttribute=null,this.distribution=null}setWeightAttribute(e){return this.weightAttribute=e?this.geometry.getAttribute(e):null,this}build(){let e=this.indexAttribute,t=this.positionAttribute,i=this.weightAttribute,r=e?e.count/3:t.count/3,n=new Float32Array(r);for(let o=0;o<r;o++){let l=1,h=3*o,u=3*o+1,d=3*o+2;e&&(h=e.getX(h),u=e.getX(u),d=e.getX(d)),i&&(l=i.getX(h)+i.getX(u)+i.getX(d)),_s.a.fromBufferAttribute(t,h),_s.b.fromBufferAttribute(t,u),_s.c.fromBufferAttribute(t,d),l*=_s.getArea(),n[o]=l}let s=new Float32Array(r),a=0;for(let o=0;o<r;o++)a+=n[o],s[o]=a;return this.distribution=s,this}setRandomGenerator(e){return this.randomFunction=e,this}sample(e,t,i,r){let n=this._sampleFaceIndex();return this._sampleFace(n,e,t,i,r)}_sampleFaceIndex(){let e=this.distribution[this.distribution.length-1];return this._binarySearch(this.randomFunction()*e)}_binarySearch(e){let t=this.distribution,i=0,r=t.length-1,n=-1;for(;i<=r;){let s=Math.ceil((i+r)/2);if(s===0||t[s-1]<=e&&t[s]>e){n=s;break}e<t[s]?r=s-1:i=s+1}return n}_sampleFace(e,t,i,r,n){let s=this.randomFunction(),a=this.randomFunction();s+a>1&&(s=1-s,a=1-a);let o=this.indexAttribute,l=3*e,h=3*e+1,u=3*e+2;return o&&(l=o.getX(l),h=o.getX(h),u=o.getX(u)),_s.a.fromBufferAttribute(this.positionAttribute,l),_s.b.fromBufferAttribute(this.positionAttribute,h),_s.c.fromBufferAttribute(this.positionAttribute,u),t.set(0,0,0).addScaledVector(_s.a,s).addScaledVector(_s.b,a).addScaledVector(_s.c,1-(s+a)),i!==void 0&&(this.normalAttribute!==void 0?(_s.a.fromBufferAttribute(this.normalAttribute,l),_s.b.fromBufferAttribute(this.normalAttribute,h),_s.c.fromBufferAttribute(this.normalAttribute,u),i.set(0,0,0).addScaledVector(_s.a,s).addScaledVector(_s.b,a).addScaledVector(_s.c,1-(s+a)).normalize()):_s.getNormal(i)),r!==void 0&&this.colorAttribute!==void 0&&(_s.a.fromBufferAttribute(this.colorAttribute,l),_s.b.fromBufferAttribute(this.colorAttribute,h),_s.c.fromBufferAttribute(this.colorAttribute,u),zN.set(0,0,0).addScaledVector(_s.a,s).addScaledVector(_s.b,a).addScaledVector(_s.c,1-(s+a)),r.r=zN.x,r.g=zN.y,r.b=zN.z),n!==void 0&&this.uvAttribute!==void 0&&(lve.fromBufferAttribute(this.uvAttribute,l),hve.fromBufferAttribute(this.uvAttribute,h),uve.fromBufferAttribute(this.uvAttribute,u),n.set(0,0).addScaledVector(lve,s).addScaledVector(hve,a).addScaledVector(uve,1-(s+a))),this}};function dve(e,t){let i=e,r=new Float32Array(4*t*t);for(let s=0;s<t*t;s++)r[4*s]=i[3*s],r[4*s+1]=i[3*s+1],r[4*s+2]=i[3*s+2],r[4*s+3]=0;let n=new Ir(r,t,t,fn,Wt);return n.needsUpdate=!0,n}mK(),ae(),ae(),ae(),ae();var H9=class{constructor(e,t,i,r){this.type="SphereEmitterShape",this.targetMesh=void 0,this.size=e,this.type=i,this.textureSize=function(o){let l=Math.ceil(Math.sqrt(o));return Math.max(l,1)}(t),this.targetMesh=r?.geometry.type==="BufferGeometry"||r?.type==="Mesh"&&r&&r.geometry.hasAttribute("position")&&r.geometry.hasAttribute("normal")?r:this.getMesh(i,1);let{positions:n,dataTexture:s,dataTextureNormals:a}=this.createPositions(this.textureSize,this.targetMesh??this.getMesh(i,1));this.positionsTexture=s,this.positionsAttribute=n,this.directionsTexture=a}createPositions(e,t){let{positions:i,normals:r}=function(n,s){let a=new Tr(n.geometry,n.material),o=[],l=[],h=new R,u=new R;a.geometry.index!==null&&(a.geometry=a.geometry.toNonIndexed());let d=new iVe(a).build();for(let c=0;c<s;c++)d.sample(h,u),o.push(h.x,h.y,h.z),l.push(u.x,u.y,u.z);return{positions:new Float32Array(o),normals:new Float32Array(l)}}(t,e*e);return{dataTexture:dve(i,e),positions:i,dataTextureNormals:dve(r,e)}}getMesh(e,t){let i=null;switch(e){case"SphereEmitterShape":i=new Hf(.5*t,32,32);break;case"TorusEmitterShape":i=new _L(.5*t,.3,15,40);break;case"ConeEmitterShape":i=new yL(t,t,15);break;case"BoxEmitterShape":i=new Ih(t,t,t);break;case"PlaneEmitterShape":i=new $c(t,t),i.rotateX(-Math.PI/2);break;default:i=new Hf(t,32,32)}return new Tr(i,new Ql({color:16711680}))}applyToShader(e,t){this.size=new R().fromArray(t.size.map(i=>typeof i=="number"?i:1)),e.uEmitterSize.value=this.size}dispose(){this.positionsTexture.dispose(),this.directionsTexture.dispose(),this.positionsAttribute=new Float32Array}};function Jb(e){let t={...e},i=LL.defaultData;t.forceFieldObjectId&&(t.colliderEntityId=t.forceFieldObjectId);let r={...i.shape,...t.shape},n={...i.renderMaterial,...t.renderMaterial};return{...i,...t,shape:r,renderMaterial:n}}zt();var rVe=class extends hn{constructor(e,t){super(),this.type="ParticleEmitter",this.debugMode=!1,this.worldSpace=!0,this.rootObject=null,this.gpuCompute=null,this.positionSimRT=null,this.velocitySimRT=null,this.emissionRateSimRT=null,this.emitterShape=void 0,this.isEmitting=!1,this.hasBeenReset=!1,this.emittedParticlesAmount=0,this.lastEmitTime=0,this.globalTime=0,this.targetFPS=60,this.previousRatio=1,this.lerpFactor=.4,this.particlesAmount=0,this.noiseStrength=0,this.noiseScale=0,this.isBillboardBased=!0,this.simFeaturesDefinition={USE_COLLIDER:!1,USE_ATTRACTOR:!1,USE_VORTEX:!1,USE_SPHERE_COLLIDER:!1,USE_BOX_COLLIDER:!1,USE_FORCE_LOCAL_SPACE:!1,USE_NORMALS:!1,USE_CURL_NOISE:!0,USE_SIMPLEX_NOISE:!1,USE_FBM_NOISE:!1},this.textureLoader=new t_e,this.textureRequestId=0,this.currentWorldPosition=new R,this.systemQuaternion=new jt,this.worldGravity=new R(0,0,0),this.directionAxis=new R(0,0,0),this.colliderV3=new R(0,0,0),this.colliderQuaternion=new jt(0,0,0,1),this.matrixAutoUpdate=!0,this.renderer=e,this.system=t,this.shared=t.context.shared;let i=t.data;this.material=nz(e)?qre()?.createMaterial(i.renderMaterial,t.context)??rz().createMaterial(i.renderMaterial,t.context):rz().createMaterial(i.renderMaterial,t.context),this.material.uniforms={uSize:{value:0},uSizeEnd:{value:0},uColor:{value:i.renderMaterial.color},uColor2:{value:i.renderMaterial.color2},uPosition:{value:new R(0,0,0)},uEmissionData:{value:new R(0,0,0)},uTexture:{value:this.defaultTexture},uWorldOffset:{value:new R(0,0,0)},uWorldQuaternion:{value:new ct(0,0,0,1)},uRandScaleFactor:{value:i.randomScale??0},uRandRotationFactor:{value:i.randomRotation??0},uRotation:{value:i.renderMaterial.spriteRotation[0]??0},uRotationEnd:{value:i.renderMaterial.spriteRotation[1]??0}},this.setTexture(this.material.uniforms,i.renderMaterial.texture),this.init(i)}setTexture(e,t){let i=t.data,r=++this.textureRequestId;if(typeof t=="string"){let n=this.shared.image(t),s=()=>{if(r!==this.textureRequestId)return;let a=new Ri(n.img);a.needsUpdate=!0,e.uTexture.value=a};return void(n.loaded?s():n.loadPromise.then(s))}if(typeof i!="string"){let n=new Image;n.onload=()=>{if(r!==this.textureRequestId)return;let o=new Ri(n);o.needsUpdate=!0,e.uTexture.value=o};let s=new Blob([i],{type:"image/*"}),a=URL.createObjectURL(s);n.src=a}}updateGeometryAttributes(e,t){let i=function(n){let s=new Float32Array(n*n*2);for(let a=0;a<n;a++)for(let o=0;o<n;o++){let l=a*n+o;s[2*l+0]=a/(n-1),s[2*l+1]=o/(n-1)}return s}(t);if(!this.emitterShape?.positionsAttribute)return;let r=new gl(i,2);e.geometry.setAttribute("ref",r),nz(this.renderer)&&e.geometry.setAttribute("particleRef",r)}applyWorldSpace(){if(!(this.system.started&&this.worldSpace&&this.positionSimRT&&this.velocitySimRT))return;let e=this.system;e.getWorldQuaternion(this.systemQuaternion),this.systemQuaternion.invert(),e.getWorldPosition(this.currentWorldPosition),this.material.uniforms.uWorldOffset.value=this.currentWorldPosition,this.material.uniforms.uWorldQuaternion.value.copy(this.systemQuaternion.normalize()),this.positionSimRT.material.uniforms.uWorldOffset.value=this.currentWorldPosition,this.systemQuaternion.invert(),this.positionSimRT.material.uniforms.uWorldQuaternion.value.copy(this.systemQuaternion.normalize()),this.velocitySimRT.material.uniforms.uWorldQuaternion.value.copy(this.systemQuaternion.normalize())}update(e,t){if(!this.gpuCompute||!this.positionSimRT||!this.velocitySimRT||!this.emissionRateSimRT||this.hasBeenReset)return;if(this.checkIfAllParticlesAreDead()&&!this.hasBeenReset)return void this.reset();this.applyWorldSpace(),this.globalTime=e,this.positionSimRT.material.uniforms.uTime.value=e,this.emissionRateSimRT.material.uniforms.uTime.value=e;let i=1e3/t,r=this.targetFPS/i,n=this.previousRatio+(r-this.previousRatio)*this.lerpFactor;this.positionSimRT.material.uniforms.uFPSRatio.value=n,this.previousRatio=n;let s=this.isEmitting?this.GoEmitSomeParticles(e,this.system.data.birthRatePerSec):0;this.emissionRateSimRT.material.uniforms.uLastIndexEmitted.value=this.emittedParticlesAmount,this.emissionRateSimRT.material.uniforms.uParticlesToEmit.value=s,this.material.uniforms.uPosition.value=this.gpuCompute.getCurrentRenderTarget(this.positionSimRT)?.texture,this.system.colliderEntities.length>0&&this.renderColliders(),this.gpuCompute.compute()}renderColliders(){if(!this.velocitySimRT)return;let e=this.system.colliderEntities[0],t=this.simFeaturesDefinition.USE_COLLIDER||this.simFeaturesDefinition.USE_ATTRACTOR||this.simFeaturesDefinition.USE_VORTEX;if(e.destroyedInAction&&t&&this.init(Jb({...this.system.data,colliderEntityId:null})),!e||e.destroyedInAction)return;e.getWorldPosition(this.colliderV3),this.colliderV3.y===0&&(this.colliderV3.y=1e-4),this.velocitySimRT.material.uniforms.uColliderPos.value.copy(this.colliderV3);let i=e.data.size;this.colliderV3.fromArray(i),this.velocitySimRT.material.uniforms.uColliderSize.value.copy(this.simFeaturesDefinition.USE_SPHERE_COLLIDER?this.colliderV3.multiplyScalar(.5):this.colliderV3),e.getWorldQuaternion(this.colliderQuaternion),this.velocitySimRT.material.uniforms.uColliderQuaternion.value.copy(this.colliderQuaternion.normalize()),this.velocitySimRT.material.uniforms.uColliderQuaternionInvert.value.copy(this.colliderQuaternion.normalize().invert())}updateState(e){!this.velocitySimRT||!this.positionSimRT||(e.renderMaterial&&this.updateMaterialState(e.renderMaterial),this.updateParticleState(e))}updateVariableState(e,t){if(!this.velocitySimRT||!this.positionSimRT)return;t[2]==="size"&&this.material.updateState({size:[e,this.material.uniforms.uSizeEnd.value]}),t[2]==="sizeEnd"&&this.material.updateState({size:[this.material.uniforms.uSize.value,e]});let i=(r,n)=>{let s=[...this.system.data.shape.size];s[r]=n,this.updateParticleState({shape:{...this.system.data.shape,size:s}})};t[2]==="shape_size_0"&&i(0,e),t[2]==="shape_size_1"&&i(1,e),t[2]==="shape_size_2"&&i(2,e),t[2]==="speed"&&(this.velocitySimRT.material.uniforms.uSpeed.value=e/10),t[2]==="gravity"&&this.worldGravity.set(0,e/100,0),t[2]==="noiseStrength"&&(this.noiseStrength=e,this.velocitySimRT.material.uniforms.uNoiseStrength.value=this.noiseStrength),t[2]==="noiseScale"&&(this.noiseScale=e,this.velocitySimRT.material.uniforms.uNoiseScale.value=this.noiseScale),t[2]==="direction_x"&&(this.directionAxis=this.getDirectionAxis([Number(e),this.system.data.direction[1],this.system.data.direction[2]])),t[2]==="direction_y"&&(this.directionAxis=this.getDirectionAxis([this.system.data.direction[0],Number(e),this.system.data.direction[2]])),t[2]==="direction_z"&&(this.directionAxis=this.getDirectionAxis([this.system.data.direction[0],this.system.data.direction[1],Number(e)]))}updateMaterialState(e){this.material.updateState({...e,size:e.size?[Number(this.shared.getVariable(e.size[0],[this.uuid,"particles","size"])),Number(this.shared.getVariable(e.size[1],[this.uuid,"particles","sizeEnd"]))]:[0,0]}),e.texture&&(this.setTexture(this.material.uniforms,e.texture),this.material.needsUpdate=!0)}updateParticleState(e){if(this.positionSimRT&&this.velocitySimRT){if(this.shouldReInitGPUCompute(e)&&this.init(Jb(this.system.data)),e.life!==void 0&&(this.positionSimRT.material.uniforms.uMaxLifeTime.value=e.life),e.speed!==void 0&&(this.velocitySimRT.material.uniforms.uSpeed.value=Number(this.shared.getVariable(e.speed,[this.uuid,"particles","speed"]))/10),e.collisionBounce!==void 0&&(this.velocitySimRT.material.uniforms.uBounce.value=e.collisionBounce),e.noiseStrength!==void 0&&(this.noiseStrength=Number(this.shared.getVariable(e.noiseStrength,[this.uuid,"particles","noiseStrength"])),this.velocitySimRT.material.uniforms.uNoiseStrength.value=this.noiseStrength),e.noiseScale!==void 0&&(this.noiseScale=Number(this.shared.getVariable(e.noiseScale,[this.uuid,"particles","noiseScale"])),this.velocitySimRT.material.uniforms.uNoiseScale.value=this.noiseScale),e.noiseSeed!==void 0&&(this.velocitySimRT.material.uniforms.uNoiseSeed.value=e.noiseSeed),e.randomMass!==void 0&&(this.velocitySimRT.material.uniforms.uRandomMassFactor.value=e.randomMass),e.renderMaterial?.size!==void 0){let t=this.shared.getVariable(e.renderMaterial.size[0],[this.uuid,"particles","size"]);this.velocitySimRT.material.uniforms.particleSize.value=Number(t)}if(e.renderMaterial?.spriteRotation!==void 0&&(this.material.uniforms.uRotation.value=e.renderMaterial.spriteRotation[0],this.material.uniforms.uRotationEnd.value=e.renderMaterial.spriteRotation[1]),e.shape!==void 0){let t=e.shape.size??this.system.data.shape.size,i=[Number(this.shared.getVariable(t[0],[this.uuid,"particles","shape_size_0"])),Number(this.shared.getVariable(t[1],[this.uuid,"particles","shape_size_1"])),Number(this.shared.getVariable(t[2],[this.uuid,"particles","shape_size_2"]))],r={...Jb(this.system.data).shape,size:i};this.emitterShape?.applyToShader(this.positionSimRT.material.uniforms,r)}if(e.gravity!==void 0&&(this.worldGravity.set(0,Number(this.shared.getVariable(this.system.data.gravity,[this.uuid,"particles","gravity"]))/100,0),this.velocitySimRT.material.uniforms.uGravity={value:this.worldGravity}),e.direction!==void 0){let t=this.getDirectionFromVariable(e.direction);this.directionAxis=this.getDirectionAxis(t),this.velocitySimRT.material.uniforms.uDirectionsAxis.value=this.directionAxis}e.randomRotation!==void 0&&(this.material.uniforms.uRandRotationFactor.value=e.randomRotation),e.randomScale!==void 0&&(this.material.uniforms.uRandScaleFactor.value=e.randomScale)}}updateForceFieldParameters(e){!this.velocitySimRT||(e.forceIntensity!==void 0&&(this.velocitySimRT.material.uniforms.uForceIntensity.value=e.forceIntensity),e.forceDambing!==void 0&&(this.velocitySimRT.material.uniforms.uForceDamping.value=e.forceDambing))}getDirectionAxis(e){let t=[Number(e[0])*et.DEG2RAD,Number(e[1])*et.DEG2RAD,Number(e[2])*et.DEG2RAD],i=new Dr(t[0],t[1],t[2],"XYZ");return this.directionAxis.set(0,1,0).applyEuler(i).normalize(),this.velocitySimRT&&(this.velocitySimRT.material.uniforms.uDirectionsAxis.value=this.directionAxis),this.directionAxis}shouldReInitGPUCompute(e){let{birthRatePerSec:t,rootObjectType:i,colliderEntityId:r,shape:n,emitTimeDuration:s,emitTimeCycle:a,life:o,directionMode:l,noiseType:h}=e;return t!==void 0||i!==void 0||r||r===null||a!==void 0||n!==void 0||o!==void 0||s!==void 0||l!==void 0||h!==void 0}init(e){this.dispose(),this.particlesAmount=this.getMaxParticlesAmount({birthRatePerSecond:e.birthRatePerSec,particleMaxLifeTime:e.life,loopDuration:e.emitTimeCycle==="infinity"?0:e.emitTimeDuration}),this.particlesAmount>1e5&&(console.warn("The maximum number of particles is limited to 100000."),this.particlesAmount=1e5),this.emitterShape=this.createShape(e.shape,this.particlesAmount);let t=setInterval(()=>{if(!this.emitterShape)return;let m=this.emitterShape.positionsTexture.source.data.data;m&&!isNaN(m[0])?clearInterval(t):this.init(e)},100);if(!this.emitterShape)return;let i=this.updateSimulationDefinition(e),r=nz(this.renderer)?qre().createComputation(this.emitterShape.textureSize,this.emitterShape.textureSize,this.renderer,this.simFeaturesDefinition):rz().createComputation(this.emitterShape.textureSize,this.emitterShape.textureSize,this.renderer),n=r.addVariable("uCurrentPosition",i+`
|
|
12291
|
+
`;break;case"r":e+="\r";break;case"t":e+=" ";break;case"b":e+="\b";break;case"f":e+="\f";break;case"v":e+="\v";break;default:e+=n}else e+=n}return r||this.throwError('Unclosed quote after "'+e+'"'),{type:Ke.LITERAL,value:e,raw:this.expr.substring(t,this.index)}}gobbleIdentifier(){let e=this.code,t=this.index;for(Ke.isIdentifierStart(e)?this.index++:this.throwError("Unexpected "+this.char);this.index<this.expr.length&&(e=this.code,Ke.isIdentifierPart(e));)this.index++;return{type:Ke.IDENTIFIER,name:this.expr.slice(t,this.index)}}gobbleArguments(e){let t=[],i=!1,r=0;for(;this.index<this.expr.length;){this.gobbleSpaces();let n=this.code;if(n===e){i=!0,this.index++,e===Ke.CPAREN_CODE&&r&&r>=t.length&&this.throwError("Unexpected token "+String.fromCharCode(e));break}if(n===Ke.COMMA_CODE){if(this.index++,r++,r!==t.length){if(e===Ke.CPAREN_CODE)this.throwError("Unexpected token ,");else if(e===Ke.CBRACK_CODE)for(let s=t.length;s<r;s++)t.push(null)}}else if(t.length!==r&&r!==0)this.throwError("Expected comma");else{let s=this.gobbleExpression();(!s||s.type===Ke.COMPOUND)&&this.throwError("Expected comma"),t.push(s)}}return i||this.throwError("Expected "+String.fromCharCode(e)),t}gobbleGroup(){this.index++;let e=this.gobbleExpressions(Ke.CPAREN_CODE);if(this.code===Ke.CPAREN_CODE)return this.index++,e.length===1?e[0]:!!e.length&&{type:Ke.SEQUENCE_EXP,expressions:e};this.throwError("Unclosed (")}gobbleArray(){return this.index++,{type:Ke.ARRAY_EXP,elements:this.gobbleArguments(Ke.CBRACK_CODE)}}},Lke=new class{add(e,t,i){if(typeof arguments[0]!="string")for(let r in arguments[0])this.add(r,arguments[0][r],arguments[1]);else(Array.isArray(e)?e:[e]).forEach(function(r){this[r]=this[r]||[],t&&this[r][i?"unshift":"push"](t)},this)}run(e,t){this[e]=this[e]||[],this[e].forEach(function(i){i.call(t&&t.context?t.context:t,t)})}};Object.assign(Ke,{hooks:Lke,plugins:new class{constructor(e){this.jsep=e,this.registered={}}register(...e){e.forEach(t=>{if(typeof t!="object"||!t.name||!t.init)throw new Error("Invalid JSEP plugin format");this.registered[t.name]||(t.init(this.jsep),this.registered[t.name]=t)})}}(Ke),COMPOUND:"Compound",SEQUENCE_EXP:"SequenceExpression",IDENTIFIER:"Identifier",MEMBER_EXP:"MemberExpression",LITERAL:"Literal",THIS_EXP:"ThisExpression",CALL_EXP:"CallExpression",UNARY_EXP:"UnaryExpression",BINARY_EXP:"BinaryExpression",ARRAY_EXP:"ArrayExpression",TAB_CODE:9,LF_CODE:10,CR_CODE:13,SPACE_CODE:32,PERIOD_CODE:46,COMMA_CODE:44,SQUOTE_CODE:39,DQUOTE_CODE:34,OPAREN_CODE:40,CPAREN_CODE:41,OBRACK_CODE:91,CBRACK_CODE:93,QUMARK_CODE:63,SEMCOL_CODE:59,COLON_CODE:58,unary_ops:{"-":1,"!":1,"~":1,"+":1},binary_ops:{"||":1,"&&":2,"|":3,"^":4,"&":5,"==":6,"!=":6,"===":6,"!==":6,"<":7,">":7,"<=":7,">=":7,"<<":8,">>":8,">>>":8,"+":9,"-":9,"*":10,"/":10,"%":10},right_associative:new Set,additional_identifier_chars:new Set(["$","_"]),literals:{true:!0,false:!1,null:null},this_str:"this"}),Ke.max_unop_len=Ke.getMaxKeyLen(Ke.unary_ops),Ke.max_binop_len=Ke.getMaxKeyLen(Ke.binary_ops);var Wx=e=>new Ke(e).parse();Object.getOwnPropertyNames(Ke).forEach(e=>{Wx[e]===void 0&&e!=="prototype"&&(Wx[e]=Ke[e])}),Wx.Jsep=Ke;var Bke={name:"ternary",init(e){e.hooks.add("after-expression",function(t){if(t.node&&this.code===e.QUMARK_CODE){this.index++;let i=t.node,r=this.gobbleExpression();if(r||this.throwError("Expected expression"),this.gobbleSpaces(),this.code===e.COLON_CODE){this.index++;let n=this.gobbleExpression();if(n||this.throwError("Expected expression"),t.node={type:"ConditionalExpression",test:i,consequent:r,alternate:n},i.operator&&e.binary_ops[i.operator]<=.9){let s=i;for(;s.right.operator&&e.binary_ops[s.right.operator]<=.9;)s=s.right;t.node.test=s.right,s.right=t.node,t.node=i}}else this.throwError("Expected :")}})}};Wx.plugins.register(Bke);var Fke=["+","-","*","/","(",")","==","!=",">","<",">=","<=","and","or","!","%","^",","],Uke=["0","1","2","3","4","5","6","7","8","9","."],zke=["sin","cos","tan","asin","acos","atan","atan2","sqrt","abs","log","exp","floor","ceil","round","min","max","random"];function kke(e){return typeof e=="string"&&!isNaN(e)&&!isNaN(parseFloat(e))}function h3e(e,t,i="number"){let r,n,s="";for(let a=0;a<e.length;a++){let o=e[a];if("objType"in o&&o.objType==="api"){let l=JSON.parse(o.id),h=l[0],u=t.getUserAPI(h);if(u!==void 0&&typeof u.retrieveValue=="function"){let d=u.retrieveValue(l.slice(1));d!==void 0&&(s+=d)}continue}if("objType"in o&&o.objType==="webhook"){let l=JSON.parse(o.id),[h,u]=l,d=t.getUserWebhook(h);if(d!==void 0){let c=d.getParameterValue(u);c!==void 0&&(s+=c)}continue}if("objType"in o&&o.objType==="aiAssistant"){let l=t.openAIRealtime;if("objId"in o&&o.objId!==void 0){let h;if(t.scene.data.objects.traverse((u,d)=>{let c=d.events?.find(p=>p.id===o.objId);c&&(h=c)}),h!==void 0&&h.data.type==="AIAssistantListener"){let u=l?.computeAnalysisForListenerEvent(h.data);if(u!==void 0){s+=u;continue}}}s+=l?.voice??0;continue}if("id"in o){let l=e[a-1];if(a>0&&"id"in l)return void console.error("Two variables in a row",e);if(Array.isArray(o.id)&&t.referencesMissingObject(o.id))return;let h=t.getVariable(o.id),u=Mo.getDisplayedValue(h);i==="number"&&Mo.isTextValue(h)&&Array.isArray(h.textValue)&&h.textValue.length===1?u=parseFloat(u).toString():i==="boolean"&&Mo.isBoolean(h)?u=h?"true":"false":i==="boolean"&&Mo.isTextValue(h)&&!Array.isArray(h.textValue)&&(u='"'+u+'"'),s+=u;continue}i!=="string"?o.name!=="and"?o.name!=="or"?o.name!=="True"?o.name!=="False"?i!=="boolean"||kke(o.name)||Uke.includes(o.name)||Fke.includes(o.name)||zke.includes(o.name.replace(/\($/g,""))?s+=o.name:s+='"'+o.name+'"':s+="false":s+="true":s+="||":s+="&&":(o.name!=='"'&&(o.name!=="+"||o.escaped)&&(s+=o.name),o.name==="+"&&!o.escaped&&s[s.length-1]==="\\"&&(s=s.slice(0,-1)+o.name))}if(i==="string")return s;if(e.length===0){if(i==="number")return 0;if(i==="boolean")return!1}try{r=Wx(s)}catch(a){return void console.error(s,a)}try{n=Fr(r)}catch(a){console.error(s,r,a)}if(i!=="number"||n===void 0||Number.isFinite(n))return n;console.error(s,"evaluated to",n)}function Fr(e){switch(e.type){case"BinaryExpression":switch(e.operator){case"==":return Number(Fr(e.left)===Fr(e.right));case"!=":return Number(Fr(e.left)!==Fr(e.right));case">":return Number(Fr(e.left)>Fr(e.right));case">=":return Number(Fr(e.left)>=Fr(e.right));case"<":return Number(Fr(e.left)<Fr(e.right));case"<=":return Number(Fr(e.left)<=Fr(e.right));case"+":return Fr(e.left)+Fr(e.right);case"-":return Fr(e.left)-Fr(e.right);case"*":return Fr(e.left)*Fr(e.right);case"/":return Fr(e.left)/Fr(e.right);case"%":return Fr(e.left)%Fr(e.right);case"&&":return Fr(e.left)&&Fr(e.right);case"||":return Fr(e.left)||Fr(e.right);case"^":return Math.pow(Fr(e.left),Fr(e.right));default:throw new Error("Unknown operator: "+e.operator)}case"UnaryExpression":switch(e.operator){case"-":return-Fr(e.argument);case"!":return Number(!Fr(e.argument));default:throw new Error("Unknown operator: "+e.operator)}case"Identifier":throw new Error("Unknown identifier: "+e.name);case"Literal":return e.value;case"CallExpression":if(e.callee.type==="Identifier"){if(e.callee.name==="random"){let t=0,i=1;if(e.arguments.length>=1)try{t=Fr(e.arguments[0])}catch(r){console.warn(r)}if(e.arguments.length>=2)try{i=Fr(e.arguments[1])}catch(r){console.warn(r)}return t=Math.min(i,t),i=Math.max(i,t),t+Math.random()*(i-t)}return Math[e.callee.name].apply(null,e.arguments.map(Fr))}throw new Error("Unknown node");default:throw new Error("Unknown node type: "+e.type)}}Wx.addBinaryOp("^",11,!0);var u3e=new Map;function Jo(e,t){u3e.set(e,t)}_r(),Object.keys({mousehover:!0,scroll:!0,dragdrop:!0,tracking:!0,resize:!0,conditional:!0,variables:!0,"api-services":!0,"ai-assistant":!0,textinputs:!0,audio:!0,video:!0,"create-destroy":!0,"scene-transition":!0,timeline:!0,transitions:!0,"misc-actions":!0});var Vke={MouseHover:"mousehover",Scroll:"scroll",DragDrop:"dragdrop",Follow:"tracking",LookAt:"tracking",Resize:"resize",Conditional:"conditional",VariableChange:"variables",API:"api-services",WEBHOOK:"api-services",AIAssistantListener:"ai-assistant",AIAssistantTrigger:"ai-assistant"},Gke={Audio:"audio",Video:"video",Particles:"particles",Link:"misc-actions",Reset:"misc-actions",SwitchCamera:"misc-actions",ClearLocalStorage:"misc-actions",Create:"create-destroy",Destroy:"create-destroy",Transition:"transitions",Animation:"transitions",TimelineAnimation:"timeline",SceneTransition:"scene-transition",SetVariable:"variables",DynamicVariablePlay:"variables",UserAPI:"api-services"};function Nn(e,t){if(t===void 0)return!0;if(t.expression.length===0||function(r,n){return r.some(s=>"id"in s&&Array.isArray(s.id)&&n.referencesMissingObject(s.id))}(t.expression,e))return!1;let i=h3e(t.expression,e,"boolean");return t.negate?!i:!!i}function ha(e,t,i,r,n,s,a){let o={Audio:[],Video:[],Particles:[],Link:[],Destroy:[],Create:[],Reset:[],Transition:[],TimelineAnimation:[],SwitchCamera:[],Animation:[],SceneTransition:[],SetVariable:[],DynamicVariablePlay:[],ClearLocalStorage:[],UserAPI:[]},l=h=>({id:u,data:d})=>{try{if(d.type==="Conditional")return void(jW[e.type].includes("Conditional")&&(d.ifActions.forEach(l({expression:d.condition,negate:!1})),d.elseActions.forEach(l({expression:d.condition,negate:!0}))));if(!jW[e.type].includes(d.type))return;let c=function(f){return u3e.get(f)}(d.type);if(c===void 0)return void Ta(Gke[d.type]??"misc-actions",`a "${d.type}" action`);let p=c({id:u,data:d,object:s,page:i,shared:r,eventManager:n,eventType:e.type,actionCondition:h,runModeOverride:a});p!=null&&d.type in o&&o[d.type].push(p)}catch{}};return t.forEach(l()),o}function Ka(e){Object.values(e).forEach(t=>{t.forEach(i=>{typeof i.dispose=="function"&&i.dispose()})})}var SZ=[["start","Start"],["keyDown","KeyDown"],["keyUp","KeyUp"],["mouseDown","MouseDown"],["mouseUp","MouseUp"],["mouseHover","MouseHover"],["collision","Collision"],["lookAt","LookAt"],["follow","Follow"],["scroll","Scroll"]],d3e=e=>SZ.find(([t,i])=>i===e)?.[0],pC=e=>SZ.find(([t])=>t===e)?.[1],jke=(e,t)=>{let i=d3e(e);if(i){let r=new CustomEvent(i,{bubbles:!0});return Object.defineProperty(r,"target",{writable:!1,value:t}),r}},Wke=class extends nl{constructor(){super(...arguments),this.objectsPerEvents=new Map,this.splineEvents={},this.onBeginEvent=e=>{if(!e.eventName||!e.target||e.eventName==="Scroll")return;let t=this.splineEvents[d3e(e.eventName)]?.[e.target.uuid];if(!t)return;e.eventName==="Scroll"&&e.deltaY!==void 0&&Object.assign(t,{deltaY:e.deltaY});let{domElement:i}=this.eventContext;i.dispatchEvent(t)}}connect(){let{page:e}=this.eventContext;e.traverseEntity(t=>{if(t.data?.events.length){for(let[i,r]of SZ)if(t.data.events.some(n=>n.data.type===r&&!n.data.disabled)){this.objectsPerEvents.has(i)?this.objectsPerEvents.get(i)?.push(t):this.objectsPerEvents.set(i,[t]);let n={id:t.uuid,name:t.name},s=jke(r,n),a=this.splineEvents[i];a?a[t.uuid]=s:this.splineEvents[i]={[t.uuid]:s}}}}),this.objectsPerEvents.forEach(t=>{t.forEach(i=>{i.addEventListener("beginEvent",this.onBeginEvent)})})}disconnect(){this.objectsPerEvents.forEach(e=>{e.forEach(t=>{t.removeEventListener("beginEvent",this.onBeginEvent)})})}};Sl(),Zn(),Tu();var Hke=class{constructor(e,t,i,r,n,s){if(this.id=e,this.data=t,this.object=i,this.entered=!1,(t.type==="KeyDown"||t.type==="KeyUp"||t.type==="KeyPress")&&!t.key)throw new Error("Missing property");this.actions=ha(t,t.actions,r,n,s,i)}disconnect(){Ka(this.actions)}dispatchHeld(e){this.actions.Create.forEach(t=>{e&&t.dispatchThrottled.cancel(),t.dispatchThrottled()})}dispatch(e=!1){this.actions.Transition.forEach(t=>{t.object.currentTransitionEvent!==this&&(t.object.currentTransitionEvent=this,t.init())}),this.data.type==="MousePress"||this.data.type==="KeyPress"?this.entered||(this.entered=!0,this.actions.Transition.forEach(t=>t.playFromCurrent()),this.actions.Animation.forEach(t=>t.playFromCurrent()),this.actions.TimelineAnimation.forEach(t=>t.playFromCurrent()),this.actions.SwitchCamera.forEach(t=>t.playFromCurrent()),this.actions.Create.forEach(t=>t.dispatchStart())):(this.actions.Transition.some(t=>t.playing&&t.data.runMode!=="Toggle")||this.actions.Transition.forEach(t=>t.play()),this.actions.SwitchCamera.some(t=>t.playing&&t.data.runMode!=="Toggle")||this.actions.SwitchCamera.forEach(t=>{t.data.runMode==="Toggle"?t.toggle():t.play()}),this.actions.Animation.forEach(t=>{"runMode"in t.data&&t.data.runMode==="Toggle"?t.toggle():t.play()}),this.actions.TimelineAnimation.forEach(t=>{"runMode"in t.data&&t.data.runMode==="Toggle"?t.toggle():t.play()})),this.actions.Link.forEach(t=>{t.dispatch()}),this.actions.SceneTransition.forEach(t=>{t.dispatch()}),e===!1&&this.actions.Create.forEach(t=>{t.dispatch()}),this.actions.Destroy.forEach(t=>{t.dispatch()}),this.actions.Reset.forEach(t=>{t.dispatch()}),this.actions.Audio.forEach(t=>{t.dispatchBasic()}),this.actions.Video.forEach(t=>{t.dispatchBasic()}),this.actions.Particles.forEach(t=>{t.dispatchBasic()}),this.actions.SetVariable.forEach(t=>t.checkConditions()),this.actions.SetVariable.forEach(t=>t.dispatch()),this.actions.DynamicVariablePlay.forEach(t=>t.dispatch()),this.actions.ClearLocalStorage.forEach(t=>t.dispatch()),this.actions.UserAPI.forEach(t=>t.dispatch())}dispatchRelease(){this.entered&&(this.entered=!1,this.actions.Transition.forEach(e=>e.reverseFromCurrent()),this.actions.Particles.forEach(e=>e.reverseFromCurrent()),this.actions.Animation.forEach(e=>e.reverseFromCurrent()),this.actions.SwitchCamera.forEach(e=>e.reverseFromCurrent()),this.actions.Create.forEach(e=>e.dispatchStop()))}dispatchUserEvent(e){this.actions.Transition.forEach(t=>{t.object.currentTransitionEvent!==this&&(t.object.currentTransitionEvent=this,t.init())}),e?(this.actions.Transition.forEach(t=>t.reverseFromCurrent()),this.actions.Animation.forEach(t=>t.reverseFromCurrent()),this.actions.TimelineAnimation.forEach(t=>t.reverseFromCurrent()),this.actions.SwitchCamera.forEach(t=>t.reverseFromCurrent())):(this.actions.Transition.forEach(t=>t.playFromCurrent()),this.actions.Animation.forEach(t=>t.playFromCurrent()),this.actions.TimelineAnimation.forEach(t=>t.playFromCurrent()),this.actions.SwitchCamera.forEach(t=>t.playFromCurrent())),this.actions.Link.forEach(t=>{t.dispatch()}),this.actions.SceneTransition.forEach(t=>{t.dispatch()}),this.actions.Create.forEach(t=>{t.dispatch()}),this.actions.Destroy.forEach(t=>{t.dispatch()}),this.actions.Reset.forEach(t=>{t.dispatch()}),this.actions.Audio.forEach(t=>{t.dispatchBasic()}),this.actions.Video.forEach(t=>{t.dispatchBasic()}),this.actions.Particles.forEach(t=>{t.dispatchBasic()}),this.actions.SetVariable.forEach(t=>t.checkConditions()),this.actions.SetVariable.forEach(t=>t.dispatch()),this.actions.DynamicVariablePlay.forEach(t=>t.dispatch()),this.actions.ClearLocalStorage.forEach(t=>t.dispatch()),this.actions.UserAPI.forEach(t=>t.dispatch())}},qke=class extends nl{constructor(e,t,i){super(e),this.eventManager=t,this.useForRaycastProperty=i,this.objectsPerTypes={MouseDown:[],MouseUp:[],MousePress:[],KeyDown:[],KeyUp:[],KeyPress:[]},this.canvasMouseEvents=[],this.eventsPerObjects={MouseDown:{},MouseUp:{},MousePress:{},KeyDown:{},KeyUp:{},KeyPress:{}},this.heldKeys={},this.heldKeysPress={},this._prevObjects=[],this.sceneInterects=null,this.onCanvasRaycast=r=>{if(this.useForRaycastProperty===!0&&this.sceneInterects===null){this.eventContext.updateRaycaster(r);let{raycaster:n,page:s}=this.eventContext,a=VO(n,s,[],!0);this.sceneInterects=a,a.length&&(this.eventContext.sharedAssets.raycastProperty={x:a[0].point.x,y:a[0].point.y,z:a[0].point.z,objX:a[0].object.matrixWorld.elements[12],objY:a[0].object.matrixWorld.elements[13],objZ:a[0].object.matrixWorld.elements[14]})}},this.onCanvasMouseDown=r=>{(r.target===this.eventContext.domElement||r.target.tagName==="SPLINE-VIEWER")&&this.canvasMouseEvents.forEach(n=>{(n.data.type==="MouseDown"||n.data.type==="MousePress")&&(this.onCanvasRaycast(r),n.dispatch())})},this.onCanvasMouseUp=r=>{(r.target===this.eventContext.domElement||r.target.tagName==="SPLINE-VIEWER")&&this.canvasMouseEvents.forEach(n=>{n.data.type==="MouseUp"?(this.onCanvasRaycast(r),n.dispatch()):n.data.type==="MousePress"&&n.dispatchRelease()})},this.onMouseDown=r=>{vi.length>1||(this.eventContext.updateRaycaster(r),this.handleMouseEvent("MouseDown"))},this.onMouseUp=r=>{vi.length>1||(this.eventContext.updateRaycaster(r),this.handleMouseEvent("MouseUp"))},this.onMousePressDown=r=>{vi.length>1||(this.eventContext.updateRaycaster(r),this.handleMousePressEvent())},this.onMousePressRelease=r=>{vi.length>1||(this.eventContext.updateRaycaster(r),this.handleMousePressEvent(!0))},this.onKeyDown=r=>{this.heldKeys[r.key]||(this.handleKeyEvent(r,"KeyDown"),this.handleKeyEventHeld(r,"KeyDown",!0)),this.heldKeys[r.key]=!0},this.onKeyUp=r=>{this.handleKeyEvent(r,"KeyUp"),this.handleKeyEventHeld(r,"KeyUp",!0)},this.onKeyPressDown=r=>{this.heldKeysPress[r.key]?this.handleKeyEventHeld(r,"KeyPress"):(this.handleKeyEvent(r,"KeyPress"),this.handleKeyEventHeld(r,"KeyPress",!0)),this.heldKeysPress[r.key]=!0},this.onKeyPressUp=r=>{this.handleKeyEvent(r,"KeyPress",!0)},this.releaseHeldKey=r=>{delete this.heldKeys[r.key]},this.releaseHeldKeyPress=r=>{delete this.heldKeysPress[r.key]},this._onUserEvent=({eventName:r,target:n,reverse:s})=>{if(!r||!n)return;let a=pC(r);a&&(a==="MouseDown"||a==="MouseUp"||a==="MousePress"?(n.dispatchEvent({type:"beginEvent",eventName:a}),this.eventsPerObjects[a]?.[n.uuid]?.forEach(o=>{o.dispatchUserEvent(s)}),this.canvasMouseEvents.forEach(o=>{o.dispatchUserEvent(s)})):(a==="KeyDown"||a==="KeyUp"||a==="KeyPress")&&(n.dispatchEvent({type:"beginEvent",eventName:a}),this.eventsPerObjects[a]?.[n.uuid]?.forEach(o=>{o.dispatchUserEvent()})))}}connect(){let{page:e,sharedAssets:t,domElement:i}=this.eventContext,r=(n,s)=>{if(!n.data?.events.length)return;let a=["MouseDown","MouseUp","MousePress","KeyDown","KeyUp","KeyPress"];for(let o of a){let l=this.eventsPerObjects[o];if(n.data.events.filter(({data:h})=>h.type===o&&h.disabled!==!0).forEach(({id:h,data:u})=>{try{let d=new Hke(h,u,n,e,t,this.eventManager);d.actions.Video.length&&(this.hasVideoAction=!0),u.type!=="MouseDown"&&u.type!=="MouseUp"&&u.type!=="MousePress"||u.mode!=="Canvas"&&u.mode!=="Window"?(l[n.uuid]?l[n.uuid].some(c=>c.id===d.id)||l[n.uuid].push(d):l[n.uuid]=[d],Zf(n)&&n.traverseChildren(c=>{if(!c.visible)return!0;c instanceof zn&&"shapeBlendNode"in c.data.geometry&&c.data.geometry.shapeBlendNode?.operation!==2&&(l[c.uuid]?l[c.uuid].push(d):l[c.uuid]=[d])})):this.canvasMouseEvents.push(d)}catch{}}),l[n.uuid]?.length&&(this.objectsPerTypes[o].push(!Jl(n)||o!=="MouseDown"&&o!=="MouseUp"&&o!=="MousePress"?n:s),Zf(n))){let h=this.objectsPerTypes[o];n.traverseChildren(u=>{if(!u.visible)return!0;u instanceof zn&&h.indexOf(u)===-1&&h.push(u)})}}};e.traverseEntity(n=>{($o(n)||n instanceof Dn)&&n.frame?.traverse(s=>{r(s,n)}),r(n)}),this.heldKeys={},this.heldKeysPress={},this.domEventsNeeded.clear(),i.addEventListener("pointerdown",this.onCanvasMouseDown),i.addEventListener("pointerup",this.onCanvasMouseUp),(this.objectsPerTypes.MouseDown?.length||this.useForRaycastProperty)&&(this.domEventsNeeded.add("pointerdown"),i.addEventListener("pointerdown",this.onMouseDown)),this.objectsPerTypes.MouseUp?.length&&(this.domEventsNeeded.add("pointerup"),i.addEventListener("pointerup",this.onMouseUp)),this.objectsPerTypes.MousePress?.length&&(this.domEventsNeeded.add("pointerdown"),i.addEventListener("pointerdown",this.onMousePressDown),this.domEventsNeeded.add("pointerup"),i.addEventListener("pointerup",this.onMousePressRelease)),this.objectsPerTypes.KeyDown?.length&&(this.domEventsNeeded.add("keydown"),document.addEventListener("keydown",this.onKeyDown),document.addEventListener("keyup",this.releaseHeldKey)),this.objectsPerTypes.KeyUp?.length&&(this.domEventsNeeded.add("keyup"),document.addEventListener("keyup",this.onKeyUp)),this.objectsPerTypes.KeyPress?.length&&(this.domEventsNeeded.add("keydown"),document.addEventListener("keydown",this.onKeyPressDown),document.addEventListener("keyup",this.releaseHeldKeyPress),this.domEventsNeeded.add("keyup"),document.addEventListener("keyup",this.onKeyPressUp)),Object.entries(this.objectsPerTypes).forEach(([n,s])=>{s.forEach(a=>{a.addEventListener("userEvent",this._onUserEvent)})}),this.canvasMouseEvents.forEach(n=>{n.object.addEventListener("userEvent",this._onUserEvent)})}disconnect(){let{domElement:e}=this.eventContext;this.domEventsNeeded.clear(),this.heldKeys={},this.heldKeysPress={},e.removeEventListener("pointerdown",this.onCanvasMouseDown),e.removeEventListener("pointerup",this.onCanvasMouseUp),e.removeEventListener("pointerdown",this.onMouseDown),e.removeEventListener("pointerdown",this.onMousePressDown),e.removeEventListener("pointerup",this.onMouseUp),e.removeEventListener("pointerup",this.onMousePressRelease),document.removeEventListener("keydown",this.onKeyDown),document.removeEventListener("keyup",this.onKeyUp),document.removeEventListener("keydown",this.onKeyPressDown),document.removeEventListener("keyup",this.onKeyPressUp),document.removeEventListener("keyup",this.releaseHeldKey),Object.values(this.eventsPerObjects).forEach(t=>{Object.values(t).forEach(i=>{i.forEach(r=>{r.disconnect()})})}),this.canvasMouseEvents.forEach(t=>{t.disconnect()}),Object.entries(this.objectsPerTypes).forEach(([t,i])=>{i.forEach(r=>{r.removeEventListener("userEvent",this._onUserEvent)})}),this.canvasMouseEvents.forEach(t=>{t.object.removeEventListener("userEvent",this._onUserEvent)})}handleMouseEvent(e){let{stopRaycast:t,raycaster:i,page:r,pointerScreen:n}=this.eventContext,s=this.objectsPerTypes[e],a=s.filter(o=>!Jl(o));if((s.length||this.useForRaycastProperty)&&(!r.uiCanvas||!hf(r,[n.x,n.y],Object.keys(this.eventsPerObjects[e]),o=>{this.handleObjectMouseEventDispatch(o,e)}))){if(t||this.useForRaycastProperty){let o;if(this.sceneInterects===null?o=VO(i,r,a,this.useForRaycastProperty):(o=this.sceneInterects,this.sceneInterects=null),this.useForRaycastProperty&&o.length&&(this.eventContext.sharedAssets.raycastProperty={x:o[0].point.x,y:o[0].point.y,z:o[0].point.z,objX:o[0].object.matrixWorld.elements[12],objY:o[0].object.matrixWorld.elements[13],objZ:o[0].object.matrixWorld.elements[14]}),t){let l=[o[0]?.uv?.x??0,o[0]?.uv?.y??0];cX(o).forEach(h=>{$o(h)&&hf(h,l,Object.keys(this.eventsPerObjects[e]),u=>{this.handleObjectMouseEventDispatch(u,e)}),this.eventsPerObjects[e][h.uuid]&&this.handleObjectMouseEventDispatch(h,e)})}}t||a.forEach(o=>{let l=Y4(i,o);l&&(this.handleObjectMouseEventDispatch(o,e),$o(o)&&hf(o,[l?.uv?.x??0,l?.uv?.y??0],Object.keys(this.eventsPerObjects[e]),h=>{this.handleObjectMouseEventDispatch(h,e)}))})}}handleMousePressEvent(e=!1){let t="MousePress",i=this.objectsPerTypes[t],r=i.filter(s=>!Jl(s)),n=[];if(i.length){if(!e){let{stopRaycast:s,raycaster:a,page:o,pointerScreen:l}=this.eventContext,h=!1;if(o.uiCanvas&&(h=hf(o,[l.x,l.y],Object.keys(this.eventsPerObjects[t]),u=>{n.push(u)})),s&&!h){let u=VO(a,o,r);n=cX(u),u.forEach(d=>{$o(d.object)&&hf(d.object,[d?.uv?.x??0,d?.uv?.y??0],Object.keys(this.eventsPerObjects[t]),c=>{n.push(c)})})}else r.forEach(u=>{let d=Y4(a,u);d&&(n.push(u),$o(u)&&hf(u,[d?.uv?.x??0,d?.uv?.y??0],Object.keys(this.eventsPerObjects[t]),c=>{n.push(c)}))})}this._prevObjects.length&&this._prevObjects.forEach(s=>{n.includes(s)||this.handleObjectMouseEventDispatchRelease(s,t)}),n.length&&n.forEach(s=>{this.handleObjectMouseEventDispatch(s,t)}),this._prevObjects=n}}handleObjectMouseEventDispatch(e,t){e.dispatchEvent({type:"beginEvent",eventName:t}),this.eventsPerObjects[t]?.[e.uuid]?.forEach(i=>{i.dispatch()})}handleObjectMouseEventDispatchRelease(e,t){e.dispatchEvent({type:"beginEvent",eventName:t}),this.eventsPerObjects[t]?.[e.uuid]?.forEach(i=>{i.dispatchRelease()})}handleKeyEvent(e,t,i=!1){this.objectsPerTypes[t].forEach(r=>{let n=this.eventsPerObjects[t][r.uuid];n.some(({data:s})=>"key"in s&&s.key===e.key)&&r.dispatchEvent({type:"beginEvent",eventName:t}),n.forEach(s=>{"key"in s.data&&s.data.key===e.key&&(i?s.dispatchRelease():s.dispatch(!0))})})}handleKeyEventHeld(e,t,i=!1){this.objectsPerTypes[t].forEach(r=>{this.eventsPerObjects[t][r.uuid].forEach(n=>{"key"in n.data&&n.data.key===e.key&&n.dispatchHeld(i)})})}};Zn(),Tu();var pX=e=>e?.isPlayAudioAction===!0,rve=e=>e?.isPauseAudioAction===!0,_E=e=>e?.isPlayVideoAction===!0,nve=e=>e?.isPauseVideoAction===!0,$ke=class{constructor(e,t,i,r,n,s){this.id=e,this.data=t,this.object=i,this.actions=ha(t,t.actions,r,n,s,i)}disconnect(){Ka(this.actions)}dispatch(){this.actions.Transition.forEach(e=>{e.play()}),this.actions.Animation.forEach(e=>{e.play()}),this.actions.TimelineAnimation.forEach(e=>{e.play()}),this.actions.SwitchCamera.forEach(e=>{e.play()}),this.actions.SceneTransition.forEach(e=>{e.dispatch()}),this.actions.Reset.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()),this.actions.Create.forEach(e=>{e.dispatchFromStart()}),this.actions.Destroy.forEach(e=>{e.dispatchFromStart()})}dispatchAfter(e){this.actions.Audio.forEach(t=>{(t.interaction.data.triggerAfter??"any")===e&&(pX(t.interaction)?t.interaction.audioPlayer?.play():rve(t.interaction)&&t.interaction.dispatch())}),this.actions.Video.forEach(t=>{let i=t.interaction.data.triggerAfter??"autoplay";i===e&&(_E(t.interaction)?t.interaction.play(i==="autoplay"):nve(t.interaction)&&t.interaction.dispatch())}),this.actions.Particles.forEach(t=>{(t.data.triggerAfter??"any")===e&&t.dispatchBasic()})}async seekVideos(e){let t=[];this.actions.Video.forEach(i=>{(i.interaction.data.triggerAfter??"autoplay")==="autoplay"&&_E(i.interaction)&&t.push(i.interaction.seek(e))}),await Promise.all(t)}pauseVideos(){this.actions.Video.forEach(e=>{_E(e.interaction)&&e.interaction.pause()})}dispatchUserEvent(e){this.actions.Transition.forEach(t=>{t.object.currentTransitionEvent!==this&&(t.object.currentTransitionEvent=this,t.init())}),e?(this.actions.Transition.forEach(t=>t.reverseFromCurrent()),this.actions.Animation.forEach(t=>t.reverseFromCurrent()),this.actions.TimelineAnimation.forEach(t=>t.reverseFromCurrent()),this.actions.SwitchCamera.forEach(t=>t.reverseFromCurrent())):(this.actions.Transition.forEach(t=>t.playFromCurrent()),this.actions.Animation.forEach(t=>t.playFromCurrent()),this.actions.TimelineAnimation.forEach(t=>t.playFromCurrent()),this.actions.SwitchCamera.forEach(t=>t.playFromCurrent())),this.actions.SceneTransition.forEach(t=>t.dispatch()),this.actions.Reset.forEach(t=>t.dispatch()),this.actions.SetVariable.forEach(t=>t.checkConditions()),this.actions.SetVariable.forEach(t=>t.dispatch()),this.actions.DynamicVariablePlay.forEach(t=>t.dispatch()),this.actions.ClearLocalStorage.forEach(t=>t.dispatch()),this.actions.UserAPI.forEach(t=>t.dispatch()),this.actions.Create.forEach(t=>{t.dispatch()}),this.actions.Destroy.forEach(t=>{t.dispatch()}),this.actions.Audio.forEach(t=>{pX(t.interaction)?t.interaction.audioPlayer?.play():rve(t.interaction)&&t.interaction.dispatch()}),this.actions.Video.forEach(t=>{_E(t.interaction)?t.interaction.play():nve(t.interaction)&&t.interaction.dispatch()}),this.actions.Particles.forEach(t=>{t.dispatchBasic()})}},Xke=class extends nl{constructor(e,t){super(e),this.eventManager=t,this.eventsPerObject=new Map,this.eventsAfterPerObject=new Map,this.onMouseDown=()=>{[...this.eventsAfterPerObject.entries()].forEach(([i,r])=>{i.dispatchEvent({type:"beginEvent",eventName:"Start"}),r.forEach(n=>{n.dispatchAfter("mouseDown")})})},this.onKeyDown=()=>{[...this.eventsAfterPerObject.entries()].forEach(([i,r])=>{i.dispatchEvent({type:"beginEvent",eventName:"Start"}),r.forEach(n=>{n.dispatchAfter("keyDown")})})},this.onAny=()=>{let{domElement:i,isExport:r}=this.eventContext,n=r?document:i;n.removeEventListener("pointerdown",this.onAny),n.removeEventListener("mousedown",this.onAny),document.removeEventListener("keydown",this.onAny),[...this.eventsAfterPerObject.entries()].forEach(([s,a])=>{s.dispatchEvent({type:"beginEvent",eventName:"Start"}),a.forEach(o=>{o.dispatchAfter("any")})})},this.onSceneTransitionAudioVideoPlay=()=>{[...this.eventsAfterPerObject.entries()].forEach(([i,r])=>{i.dispatchEvent({type:"beginEvent",eventName:"Start"}),r.forEach(n=>{n.actions.Audio.forEach(s=>{pX(s.interaction)&&s.interaction.audioPlayer?.play()}),n.actions.Video.forEach(s=>{let a=s.interaction.data.triggerAfter??"autoplay";_E(s.interaction)&&s.interaction.play(a==="autoplay")}),n.actions.Particles.forEach(s=>{s.dispatchBasic()})})})},this.onPlay=()=>{[...this.eventsAfterPerObject.entries()].forEach(([i,r])=>{i.dispatchEvent({type:"beginEvent",eventName:"Start"}),r.forEach(n=>{n.dispatchAfter("autoplay")})})},this.seekVideos=async i=>{let r=[];[...this.eventsAfterPerObject.entries()].forEach(([n,s])=>{!n.data.visible||s.forEach(a=>{r.push(a.seekVideos(i))})}),await Promise.all(r)},this.pauseVideos=()=>{[...this.eventsAfterPerObject.entries()].forEach(([i,r])=>{r.forEach(n=>{n.pauseVideos()})})},this.onUserEvent=({eventName:i,target:r,reverse:n})=>{if(!i||!r)return;let s=pC(i);s&&s==="Start"&&(Jl(r)||r.dispatchEvent({type:"beginEvent",eventName:"Start"}),this.eventsPerObject.get(r)?.forEach(a=>{a.dispatchUserEvent(n)}),this.eventsAfterPerObject.get(r)?.forEach(a=>{a.dispatchUserEvent(n)}))}}connect(){let{sharedAssets:e,page:t}=this.eventContext,i=r=>{if(r.data?.events.length)for(let{id:n,data:s}of r.data.events){if(s.disabled||s.type!=="Start")continue;let a=new $ke(n,s,r,t,e,this.eventManager);(a.actions.Transition.length||a.actions.TimelineAnimation.length||a.actions.Animation.length||a.actions.SwitchCamera.length||a.actions.Create.length||a.actions.Destroy.length||a.actions.SceneTransition.length||a.actions.Reset.length||a.actions.SetVariable.length||a.actions.DynamicVariablePlay.length||a.actions.ClearLocalStorage.length||a.actions.UserAPI.length)&&(this.eventsPerObject.has(r)?this.eventsPerObject.get(r)?.push(a):this.eventsPerObject.set(r,[a])),a.actions.Audio.length&&(this.eventsAfterPerObject.has(r)?this.eventsAfterPerObject.get(r)?.push(a):this.eventsAfterPerObject.set(r,[a])),a.actions.Video.length&&(this.hasVideoAction=!0,this.eventsAfterPerObject.has(r)?this.eventsAfterPerObject.get(r)?.push(a):this.eventsAfterPerObject.set(r,[a])),a.actions.Particles.length&&(this.eventsAfterPerObject.has(r)?this.eventsAfterPerObject.get(r)?.push(a):this.eventsAfterPerObject.set(r,[a]))}};if(t.traverseEntity(r=>{($o(r)||r instanceof Dn)&&r.frame?.traverse(n=>{i(n)}),i(r)}),[...this.eventsAfterPerObject.values()].some(r=>r.length)){if(this.eventManager.activateCount===0){let{domElement:r,isExport:n}=this.eventContext,s=n?document:r;s.addEventListener("pointerdown",this.onMouseDown,{once:!0}),s.addEventListener("mousedown",this.onMouseDown,{once:!0}),document.addEventListener("keydown",this.onKeyDown,{once:!0}),s.addEventListener("pointerdown",this.onAny),s.addEventListener("mousedown",this.onAny),document.addEventListener("keydown",this.onAny),[...this.eventsAfterPerObject.entries()].forEach(([a,o])=>{a.addEventListener("userEvent",this.onUserEvent)})}else this.onSceneTransitionAudioVideoPlay();this.onPlay()}[...this.eventsPerObject.entries()].forEach(([r,n])=>{r.dispatchEvent({type:"beginEvent",eventName:"Start"}),n.forEach(s=>s.dispatch()),r.addEventListener("userEvent",this.onUserEvent)})}disconnect(){if([...this.eventsAfterPerObject.values()].some(e=>e.length)){let{domElement:e,isExport:t}=this.eventContext,i=t?document:e;i.removeEventListener("pointerdown",this.onMouseDown),i.removeEventListener("mousedown",this.onMouseDown),document.removeEventListener("keydown",this.onKeyDown),i.removeEventListener("pointerdown",this.onAny),i.removeEventListener("mousedown",this.onAny),document.removeEventListener("keydown",this.onAny),[...this.eventsAfterPerObject.entries()].forEach(([r,n])=>{r.removeEventListener("userEvent",this.onUserEvent),n.forEach(s=>s.disconnect())})}[...this.eventsPerObject.entries()].forEach(([e,t])=>{e.removeEventListener("userEvent",this.onUserEvent),t.forEach(i=>i.disconnect())}),this.eventsPerObject.clear(),this.eventsAfterPerObject.clear()}},c3e=new Map;function Fh(e,t){c3e.set(e,t)}_r();var Yke=class{constructor(e,t,i,r,n){this.publish=e,this.controlsManager=t,this.animationControls=i,this.eventContext=r,this.sharedVariables=n,this.isEnabled=!1,this.activateCount=0,this.needsMouse=!1,this.needsRaycast=!1,this.onTouchMovePreventScroll=s=>{let a=window.parent!==window,o=document.documentElement.scrollHeight>document.documentElement.clientHeight||document.documentElement.scrollWidth>document.documentElement.clientWidth;(s.touches.length>1||this.preventTouchScroll||a===!1&&o===!1)&&s.preventDefault()},this.onMouseWheelPreventScroll=s=>{this.preventScroll&&s.preventDefault()},this.onMouseMove=s=>{this.eventContext.sharedAssets.mouseProperty={...this.getMousePosition(s),pressed:s.buttons>0}},this.onMouseDown=s=>{this.eventContext.sharedAssets.mouseProperty={...this.getMousePosition(s),pressed:!0}},this.onMouseUp=s=>{this.eventContext.sharedAssets.mouseProperty={...this.getMousePosition(s),pressed:!1}},this.getMousePosition=s=>{let{domRect:a}=this.eventContext,{pageX:o,pageY:l}=s.touches?.length>0?s.touches[0]:s;return{x:o-(a.left+window.scrollX),y:l-(a.top+window.scrollY)}},this.stopRaycast=e.stopRaycast,this.preventScroll=e.preventScroll,this.preventTouchScroll=e.preventTouchScroll,this.hideCursor=e.hideCursor,this.requestRender=r.requestRender}warnMissingEventFeatures(){this.eventContext.page.traverseEntity(e=>{for(let t of e.dataPatched.events){if(t.data.disabled===!0)continue;let i=t.data.type;if(this.handlers[i]!==void 0)continue;let r=Vke[i];r!==void 0&&Ta(r,`a "${i}" event`)}})}activate(e=!1){if(this.isEnabled)return;this.isEnabled=!0,this.initializeActionsDependentStates(),this.needsMouse&&(this.eventContext.domElement.addEventListener("pointermove",this.onMouseMove),this.eventContext.domElement.addEventListener("pointerdown",this.onMouseDown));let t={eventContext:this.eventContext,eventManager:this,sharedVariables:this.sharedVariables,needsMouse:this.needsMouse,needsRaycast:this.needsRaycast};this.handlers={};let i=(s,a)=>{let o=(l=s,c3e.get(l));var l;o!==void 0?this.handlers[s]=o(t):a!==void 0&&(this.handlers[s]=a())};i("Spline",()=>new Wke(this.eventContext)),i("VariableChange"),i("API"),i("WEBHOOK"),i("AIAssistantListener"),i("AIAssistantTrigger"),i("Conditional"),i("Start",()=>new Xke(this.eventContext,this)),i("Basic",()=>new qke(this.eventContext,this,this.needsRaycast)),i("MouseHover"),i("Scroll"),i("Follow"),i("DragDrop"),i("LookAt"),i("Resize"),i("Textfields"),this.warnMissingEventFeatures();let{page:r,domElement:n}=this.eventContext;this.hideCursor&&(n.style.cursor="none"),r.traverseEntity(s=>{s.addEventListener("requestRender",this.requestRender)}),Object.values(this.handlers).forEach(s=>s.connect()),n.addEventListener("wheel",this.onMouseWheelPreventScroll),n.addEventListener("touchmove",this.onTouchMovePreventScroll),this.activateCount++,e||this.eventContext.sharedAssets.openAIRealtime?.connect()}deactivate(e=!1){if(!this.isEnabled)return;this.isEnabled=!1,this.eventContext.domElement.removeEventListener("pointermove",this.onMouseMove),this.eventContext.domElement.removeEventListener("pointerdown",this.onMouseDown),this.eventContext.domElement.removeEventListener("pointerup",this.onMouseUp),this.eventContext.sharedAssets.mouseProperty=null,this.eventContext.sharedAssets.raycastProperty=null;let{page:t,domElement:i}=this.eventContext;i.style.cursor="",Object.values(this.handlers).forEach(r=>r.disconnect()),this.controlsManager.gameControl?.disposeActions(),this.controlsManager.disconnectEvents(),t.traverseEntity(r=>{r.removeEventListener("requestRender",this.requestRender),r.destroyedInAction=!1}),i.removeEventListener("touchmove",this.onTouchMovePreventScroll),i.removeEventListener("wheel",this.onMouseWheelPreventScroll),this.animationControls.onExitPlayMode(),e||this.eventContext.sharedAssets.openAIRealtime?.disconnect()}dispose(){this.deactivate(),Object.values(this.handlers).forEach(e=>e.dispose())}get isPaused(){return this.isEnabled}pause(){this.deactivate()}resume(){this.activate()}reset(){this.deactivate(!0),this.activate(!0),this.controlsManager.deactivate(),this.controlsManager.activate(this),this.controlsManager.page.updateMatrixWorld(!0),this.controlsManager.rebuildBVH()}updateUseWindowEvents(e){let t=this.isEnabled;t&&this.deactivate(),this.eventContext.useWindowEvents=e,t&&this.activate()}initializeActionsDependentStates(){let e=this.eventContext.sharedAssets;e.resetDynamicVariablePlayState();let t=i=>{if(i.data.type==="Conditional"&&(i.data.ifActions.forEach(t),i.data.elseActions.forEach(t)),i.data.type==="Conditional"||i.data.type==="SetVariable")for(let r of i.data.type==="Conditional"?i.data.condition:i.data.expression)"id"in r&&Array.isArray(r.id)&&(r.id[0]==="mouse"&&(this.needsMouse=!0),r.id[0]==="raycast"&&(this.needsRaycast=!0));i.data.type==="DynamicVariablePlay"&&i.data.variableId!==""&&(i.data.mode==="Play"||i.data.mode==="PlayPause"||i.data.mode==="Toggle")&&e.setDynamicVariablePlayState(i.data.variableId,"Stopped")};this.eventContext.page.traverseEntity(i=>{if(i.data?.events.length)for(let r of i.data.events)if(r.data.type==="VariableChange"&&(r.data.variableId==="mouseProperty"&&(this.needsMouse=!0),r.data.variableId==="raycastProperty"&&(this.needsRaycast=!0)),r.data.type==="Conditional")for(let n of["inActions","outActions"])r.data[n].forEach(t);else if(r.data.type==="DragDrop")for(let n of["drag","drop"])r.data.dragDropActions[n].forEach(t);else if(r.data.type==="GameControl")for(let n of["idle","move","jump","run"])r.data.gameActions[n].forEach(t);else if(r.data.type==="Resize")for(let n of r.data.breakpoints)n.data.actions.forEach(t);else r.data.type==="LookAt"||r.data.type==="API"||r.data.actions.forEach(t)})}};ae(),jr(),jr();var BN={type:"change"},iM={type:"start"},Cv={type:"end",nonOrbit:!0},Kke={type:"end",nonOrbit:!1},Zke={type:"end",isZoom:!0,nonOrbit:!0},Qke={type:"end",changed:!1},j9={type:"cameraAnimatingInTimeline"},W9=new jt,sve=new Z,Jke=2*Math.PI,FN=new R,UN=new Z,rM=new R,nM=new jt,ave=new Ue,eVe={type:"requestRender"},p3e=class extends cs{constructor(e,t,i={isPlayMode:!1,isExport:!1},r){super(),this.object=e,this.domElement=t,this.options=i,this.timelineState=r,this.enabled=!0,this.useKeyEvents=!0,this.enableDamping=!1,this.enableZoom=!0,this.enableRotate=!0,this.enablePan=!0,this.autoRotate=!1,this.rotationLimitsMode=0,this.panLimitsMode=0,this.rotationSoftLimit=2,this.panSoftLimit=2,this.hoverRotatePanMode=0,this.zoomLimitsEnabled=!1,this.mouseButtons=[0,5],this.mouseButtonsPlay=[3,4,5],this.touches=[null,yh.DOLLY_ROTATE,yh.PAN],this.offset=new R,this.eye=new R,this.lastPosition=new R,this.lastQuaternion=new jt,this.current=new Z,this.overShoot=new Z,this.overRatio=new Z,this.spherical=new vW,this.sphericalDelta=new vW,this.panOffset=new R,this.panLeftV=new R,this.panUpV=new R,this.panV=new R,this.rotateStart=new Z,this.rotateEnd=new Z,this.rotateDelta=new Z,this.panStart=new Z,this.panEnd=new Z,this.panDelta=new Z,this.dollyStart=new Z,this.dollyEnd=new Z,this.dollyDelta=new Z,this.rotationRangeFactor=new Z,this.panRangeFactor=new Z,this.state=-1,this.zoomChanged=!1,this.isPointerDown=!1,this.isThetaFlipped=!1,this.prevScale=0,this.scale=1,this.gesture=!1,this.lastTrackpadPanTime=-1/0,this.lastMouseWheelZoomTime=-1/0,this.timer=-1,this.timerHover=-1,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minPhi=0,this.maxPhi=Math.PI,this.minTheta=-1/0,this.maxTheta=1/0,this.minH=0,this.maxH=Math.PI,this.minV=-1/0,this.maxV=1/0,this.autoRotateClockwise=!0,this.isPanOverShoot=!1,this.isRotateOverShoot=!1,this.resetHoverEffectOnPointerLeave=!1,this.hasChange=!1,this.useWindowEvents=!1,this.isTouchZoom=!0,this.autoRotateSpeed=2,this.dampingFactor=.125,this.zoomSpeed=2,this.rotateSpeed=1,this.rotateFactor=1,this.panSpeed=1,this.hoverRotatePanStrength=.1,this.hoverRotateDamping=this.dampingFactor,this.isCurrentlyDamping=!1,this.thetaIsFree=!1,this.phiIsFree=!1,this.needsUpdate=!0,this.onCameraChange=n=>{this.object.removeEventListener("beginState",this.onBeginState),this.object.removeEventListener("completeState",this.onCompleteState),this.object.removeEventListener("cameraChange",this.onCameraChange),this.object=n.camera,this.object.addEventListener("beginState",this.onBeginState),this.object.addEventListener("completeState",this.onCompleteState),this.object.addEventListener("cameraChange",this.onCameraChange)},this.update=()=>{this.object.updateWorldMatrix(!0,!1),this.object.matrixWorld.decompose(rM,nM,FN),this.offset.copy(rM).sub(this.target),this.spherical.setFromVector3(this.offset),this.object.isUpVectorFlipped&&(this.spherical.phi*=-1,this.spherical.theta-=Math.PI),this.autoRotate&&this.state===-1&&this.rotateLeft((this.autoRotateClockwise===!0?1:-1)*this.getAutoRotationAngle()),this.rotationLimitsMode!==0&&this.applyLimits(this.sphericalDelta,this.rotationLimitsMode,this.rotationSoftLimit,this.maxTheta,this.minTheta,this.maxPhi,this.minPhi,this.rotationRangeFactor),this.rotationLimitsMode!==2&&(this.spherical.phi+=this.sphericalDelta.phi),(this.rotationLimitsMode!==1||this.autoRotate===!0)&&(this.spherical.theta+=this.sphericalDelta.theta),this.spherical.radius*=this.scale,this.zoomLimitsEnabled&&this.object.isPerspectiveCamera&&(this.spherical.radius=Math.max(this.minDistance,Math.min(this.maxDistance,this.spherical.radius))),this.panLimitsMode!==0&&(this.target.applyQuaternion(W9.copy(nM).invert()),this.panOffset.applyQuaternion(W9),this.applyLimits(this.panOffset,this.panLimitsMode,this.panSoftLimit,this.maxH,this.minH,this.maxV,this.minV,this.panRangeFactor),this.target.applyQuaternion(nM),this.panOffset.applyQuaternion(nM)),this.panLimitsMode===2&&(this.panOffset.y=0),this.panLimitsMode===1&&(this.panOffset.x=0),this.state!==-1||this.gesture?(this.target.add(this.panOffset),this.panOffset.set(0,0,0)):(this.panOffset.multiplyScalar(1-this.dampingFactor),this.target.add(this.panOffset)),this.offset.setFromSpherical(this.spherical),rM.copy(this.target).add(this.offset),this.object.position.copy(this.target).add(this.offset),this.object.parent&&(ave.copy(this.object.parent.matrixWorld).invert(),this.object.position.applyMatrix4(ave));let n=this.spherical.phi%Jke;if(this.eye.copy(this.offset).normalize(),this.object.up.copy(hn.DEFAULT_UP).applyAxisAngle(this.eye,this.object.angleOffsetFromUp),n>0&&n>Math.PI||n<0&&n>-Math.PI?(this.object.up.negate(),this.object.lookAt(this.target),this.object.isUpVectorFlipped=!0):(this.object.lookAt(this.target),this.object.isUpVectorFlipped=!1),this.state===-1||this.enableDamping===!0){let s=this.hoverRotatePanMode===1?this.hoverRotateDamping:this.dampingFactor;this.sphericalDelta.theta*=1-s,this.sphericalDelta.phi*=1-s}else this.sphericalDelta.set(0,0,0);if(this.scale=1,this.lastPosition.distanceToSquared(this.object.position)>.01||8*(1-this.lastQuaternion.dot(this.object.quaternion))>1e-8)return this.dispatchEvent(BN),this.object.dispatchEvent(eVe),this.lastPosition.copy(this.object.position),this.lastQuaternion.copy(this.object.quaternion),void(this.isCurrentlyDamping=!0);this.isPanOverShoot=!1,this.isRotateOverShoot=!1,this.object.wasMovedBySwitchCameraAction=!1,this.sphericalDelta.set(0,0,0),this.panOffset.set(0,0,0),this.isCurrentlyDamping=!1},this.onPointerDown=n=>{this.enabled!==!1&&(n.pointerType==="touch"||n.pointerType==="pen"&&Zl?this.onPointerDownTouch(n):this.onPointerDownMouse(n),this.state!==-1&&(this.isPointerDown=!0,this.dispatchEvent(iM),this.domElement.addEventListener("pointermove",this.onPointerMove),this.domElement.addEventListener("pointerup",this.onPointerUp),n.stopPropagation(),n.pointerType==="touch"||n.pointerType==="pen"&&Zl||this.domElement.setPointerCapture(n.pointerId)))},this.onPointerLeave=n=>{this.resetHoverEffectOnPointerLeave&&!this.useWindowEvents?(this.hoverRotatePanMode===1?(this.sphericalDelta.theta=-this.spherical.theta,this.sphericalDelta.phi=-this.spherical.phi,FN.subVectors(this.position0,this.target0),this.spherical.setFromVector3(FN),this.sphericalDelta.theta+=this.spherical.theta,this.sphericalDelta.phi+=this.spherical.phi,this.sphericalDelta.theta/=8,this.sphericalDelta.phi/=8):this.hoverRotatePanMode===2&&this.panOffset.subVectors(this.target0,this.target).divideScalar(8),this.update()):this.pointerLeaveEvent=n},this.onPointerEnter=n=>{this.resetHoverEffectOnPointerLeave||this.pointerLeaveEvent===void 0?UN.set(n.clientX-this.domElement.clientWidth/2,n.clientY-this.domElement.clientHeight/2):UN.set(n.clientX-this.pointerLeaveEvent.clientX,n.clientY-this.pointerLeaveEvent.clientY),this.hoverRotatePanMode===1?(this.rotateDelta.copy(UN).multiplyScalar(this.rotateSpeed*this.hoverRotatePanStrength).rotateAround(sve,-this.object.angleOffsetFromUp),this.rotateLeft(2*Math.PI*this.rotateDelta.x/this.domElement.clientHeight),this.rotateUp(2*Math.PI*this.rotateDelta.y/this.domElement.clientHeight),this.rotateStart.set(n.clientX,n.clientY)):this.hoverRotatePanMode===2&&(this.panDelta.copy(UN).multiplyScalar(this.panSpeed*this.hoverRotatePanStrength),this.pan(this.panDelta.x,this.panDelta.y),this.panStart.set(n.clientX,n.clientY)),this.update()},this.onPointerMove=n=>{this.timelineState?.isPlayingCameraAnimation?this.dispatchEvent(j9):this.enabled!==!1&&(this.checkRaycastLock()||(n.pointerType==="touch"||n.pointerType==="pen"&&Zl?this.onPointerMoveTouch(n):this.onPointerMoveMouse(n),n.stopPropagation()))},this.onPointerUp=n=>{this.isPointerDown=!1,vi.length===0&&(this.domElement.removeEventListener("pointermove",this.onPointerMove),this.domElement.removeEventListener("pointerup",this.onPointerUp)),vi.length>1&&n.preventDefault(),this.hasChange?this.dispatchEvent(this.state===0?Kke:Cv):this.dispatchEvent(Qke),this.state=-1,n&&(n.stopPropagation(),n.pointerType==="touch"||n.pointerType==="pen"&&Zl||this.domElement.releasePointerCapture(n.pointerId))},this.onPointerDownMouse=n=>{let s;switch(s=this.useKeyEvents?this.mouseButtons[n.button]:this.mouseButtonsPlay[n.button],s){case 0:if(n.altKey!==!0||n.shiftKey||US(n)){if(this.key===" "){if(this.enablePan===!1)return;this.handleMouseDownPan(n),this.state=2}}else{if(this.enableRotate===!1)return;this.handleMouseDownRotate(n),this.state=0}break;case 4:if(this.enablePan===!1)return;this.handleMouseDownPan(n),this.state=2;break;case 3:if(US(n)||n.shiftKey){if(this.enablePan===!1)return;this.handleMouseDownPan(n),this.state=2}else{if(this.enableRotate===!1)return;this.handleMouseDownRotate(n),this.state=0}break;case 5:if(US(n)||n.shiftKey){if(this.enableRotate===!1)return;this.handleMouseDownRotate(n),this.state=0}else{if(this.enablePan===!1)return;this.handleMouseDownPan(n),this.state=2}break;default:this.state=-1}},this.onPointerMoveMouse=n=>{switch(this.state){case 0:if(this.enableRotate===!1)return;this.handleMouseMoveRotate(n);break;case 1:if(this.enableZoom===!1)return;this.handleMouseMoveDolly(n);break;case 2:if(this.enablePan===!1)return;this.handleMouseMovePan(n)}this.object.wasMovedByUser=!0},this.onPointerDownTouch=n=>{switch(vi.length>1&&n.preventDefault(),this.touches[vi.length-1]){case yh.ROTATE:if(this.enableRotate===!1)return void(this.state=-1);this.handleTouchStartRotate(),this.state=3;break;case yh.PAN:if(this.enablePan===!1)return void(this.state=-1);this.handleTouchStartPan(),this.state=4;break;case yh.DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this.handleTouchStartDollyPan(),this.state=5;break;case yh.DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this.handleTouchStartDollyRotate(),this.state=6;break;default:this.state=-1}},this.onPointerMoveTouch=n=>{switch(vi.length>1&&n.preventDefault(),this.state){case 3:if(this.enableRotate===!1)return;this.handleTouchMoveRotate(n),this.update();break;case 4:if(this.enablePan===!1)return;this.handleTouchMovePan(n),this.update();break;case 5:if(this.enableZoom===!1&&this.enablePan===!1)return;this.handleTouchMoveDollyPan(n),this.update();break;case 6:if(this.enableZoom===!1&&this.enableRotate===!1)return;this.handleTouchMoveDollyRotate(n),this.update();break;default:this.state=-1}this.object.wasMovedByUser=!0},this.dispatchEndDebounced=TA(()=>{this.zoomChanged?this.dispatchEvent(Zke):this.dispatchEvent(Cv),this.zoomChanged=!1},33),this.onMouseWheel=n=>{if(this.enabled!==!1&&(this.enableZoom!==!1||this.enablePan!==!1)&&!this.checkRaycastLock()){if(!this.options.isExport&&this.domElement.clientHeight===document.body.clientHeight&&this.domElement.clientWidth===document.body.clientWidth&&n.preventDefault(),this.dispatchEvent(iM),this.timelineState?.isPlayingCameraAnimation)return void this.dispatchEvent(j9);n.ctrlKey&&this.enableZoom&&n.preventDefault(),this.handleMouseWheel(n),this.dispatchEndDebounced(),this.object.wasMovedByUser=!0}},this.onGesture=n=>{if(n.preventDefault(),this.enabled!==!1&&!this.checkRaycastLock()&&!l1){if(this.timelineState?.isPlayingCameraAnimation)return void this.dispatchEvent(j9);if(n.type==="gesturechange"){if(this.enableZoom===!1||this.isTouchZoom===!1)return;this.dispatchEvent(iM),n.scale>this.prevScale?this.dollyIn(this.getZoomScale()):n.scale<this.prevScale&&this.dollyOut(this.getZoomScale()),this.prevScale=n.scale,this.update(),this.object.wasMovedByUser=!0}else this.dispatchEvent(Cv)}},this.onContextMenu=n=>{n.preventDefault()},this.onTouchEnd=n=>{n.preventDefault()},this.onKeyDown=n=>{this.enabled!==!1&&(this.key=n.key,n.key===" "&&this.dispatchEvent(iM))},this.onKeyUp=n=>{this.key=void 0,this.enabled!==!1&&(this.state!==-1&&n.key==="Alt"&&this.onPointerUp(vi[0]),n.key===" "&&this.dispatchEvent(Cv))},this.onPointerHover=n=>{n.pointerType!=="mouse"||this.enabled===!1||this.state!==-1||this.hoverRotatePanMode===2&&this.isPanOverShoot||this.hoverRotatePanMode===1&&this.isRotateOverShoot||(this.isPointerDown=!0,this.hoverRotatePanMode===2?this.handleMouseMovePan(n,this.hoverRotatePanStrength):this.hoverRotatePanMode===1&&this.handleMouseMoveRotate(n,this.hoverRotatePanStrength))},this.onBeginState=()=>{this.enabled=!1,this.needsUpdate=!1},this.onCompleteState=n=>{n.isfromEntity&&this.options.isPlayMode||(this.enabled=!0,this.needsUpdate=!0,this.object.updateUp(),this.object.getTarget(this.target))},this.target=this.object.getTarget(),this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this.quat0=this.object.quaternion.clone(),this.isUpVectorFlipped0=this.object.isUpVectorFlipped,this.object.updateWorldMatrix(!0,!1),this.object.matrixWorld.decompose(rM,nM,FN),this.offset.copy(rM).sub(this.target),this.spherical.setFromVector3(this.offset),this.object.isUpVectorFlipped&&(this.spherical.phi*=-1,this.spherical.theta-=Math.PI),this.initialSphericalRadius=this.spherical.radius,this.addEventListenersToCamera()}dispatchEvent(e){e.type==="start"?this.hasChange=!1:this.hasChange=!0,super.dispatchEvent(e)}addEventListenersToCamera(){this.object.addEventListener("beginState",this.onBeginState),this.object.addEventListener("completeState",this.onCompleteState),this.object.addEventListener("cameraChange",this.onCameraChange)}removeEventListenersFromCamera(){this.object.removeEventListener("beginState",this.onBeginState),this.object.removeEventListener("completeState",this.onCompleteState),this.object.removeEventListener("cameraChange",this.onCameraChange)}updateUseWindowEvents(e){if(window.removeEventListener("pointermove",this.onPointerHover),this.domElement.removeEventListener("pointermove",this.onPointerHover),this.useWindowEvents=e,this.hoverRotatePanMode!==0&&(this.useWindowEvents?window.addEventListener("pointermove",this.onPointerHover):this.domElement.addEventListener("pointermove",this.onPointerHover)),this.domElement.removeEventListener("pointerleave",this.onPointerLeave),this.domElement.removeEventListener("pointerenter",this.onPointerEnter),window.removeEventListener("pointerleave",this.onPointerLeave),window.removeEventListener("pointerenter",this.onPointerEnter),this.hoverRotatePanMode!==0&&!this.useWindowEvents){let t=this.useWindowEvents?window:this.domElement;t.addEventListener("pointerleave",this.onPointerLeave),t.addEventListener("pointerenter",this.onPointerEnter)}}fromJSON(e,t){this.rotateFactor=e.rotationSpeed??1,this.setEnableDampingSpeed(e.enableDamping),this.enablePan=e.enablePan,this.enableZoom=e.enableZoom,this.enableRotate=e.enableRotate,this.rotationLimitsMode=e.rotationLimitsMode,this.thetaIsFree=e.rotationHorizontalOffset.min===e.rotationHorizontalOffset.max&&e.rotationHorizontalOffset.min===Math.PI,this.phiIsFree=e.rotationVerticalOffset.min===e.rotationVerticalOffset.max&&e.rotationVerticalOffset.min===Math.PI,this.panLimitsMode=e.panLimitsMode,this.panSoftLimit=e.panSoftLimit,this.rotationSoftLimit=e.rotationSoftLimit,this.hoverRotatePanMode=e.hoverRotatePanMode,this.hoverRotateDamping=e.hoverRotateDamping??this.dampingFactor,this.useWindowEvents=t==="window",this.hoverRotatePanMode!==0&&(this.useWindowEvents?window.addEventListener("pointermove",this.onPointerHover):this.domElement.addEventListener("pointermove",this.onPointerHover));let i=e.hoverRotatePanStrength/100;this.hoverRotatePanStrength=i**2,this.zoomLimitsEnabled=e.zoomLimitsEnabled,this.minZoom=e.zoomLimits.min,this.maxZoom=Math.max(e.zoomLimits.min,e.zoomLimits.max),this.minDistance=1e3/this.maxZoom,this.maxDistance=Math.max(this.minDistance,1e3/e.zoomLimits.min),this.autoRotate=e.autoRotate,this.autoRotateSpeed=e.autoRotateSpeed,this.autoRotateClockwise=e.autoRotateClockwise;let r=this.object.getTarget().applyQuaternion(W9.copy(this.object.quaternion).invert());this.minV=-e.panVerticalOffset.min+r.y,this.maxV=e.panVerticalOffset.max+r.y,this.minH=-e.panHorizontalOffset.min+r.x,this.maxH=e.panHorizontalOffset.max+r.x,this.panRangeFactor.set(this.maxH-this.minH,this.maxV-this.minV).divideScalar(2),this.rotationRangeFactor.setScalar(Math.PI).divideScalar(4),this.minPhi=cc(this.spherical.phi-e.rotationVerticalOffset.min),this.maxPhi=cc(this.spherical.phi+e.rotationVerticalOffset.max),this.minTheta=cc(cc(this.spherical.theta)-e.rotationHorizontalOffset.min),this.maxTheta=cc(cc(this.spherical.theta)+e.rotationHorizontalOffset.max),this.isThetaFlipped=this.minTheta>this.maxTheta,e.orbitTouches===1&&(this.touches[0]=yh.ROTATE),e.panTouches===1&&(this.touches[0]=yh.PAN),e.orbitTouches===2&&(this.touches[1]=yh.DOLLY_ROTATE),e.panTouches===2&&(this.touches[1]=yh.DOLLY_PAN),e.orbitTouches===3&&(this.touches[2]=yh.ROTATE),e.panTouches===3&&(this.touches[2]=yh.PAN),this.isTouchZoom=e.isTouchZoom,this.resetHoverEffectOnPointerLeave=e.resetHoverEffectOnPointerLeave??!1}connect(){if(this.domElement.addEventListener("contextmenu",this.onContextMenu),this.domElement.addEventListener("pointerdown",this.onPointerDown),this.domElement.addEventListener("wheel",this.onMouseWheel),window.addEventListener("keydown",this.onKeyDown,!1),window.addEventListener("keyup",this.onKeyUp,!1),this.domElement.addEventListener("gesturestart",this.onGesture),this.domElement.addEventListener("gesturechange",this.onGesture),this.domElement.addEventListener("gestureend",this.onGesture),this.domElement.addEventListener("touchend",this.onTouchEnd),this.hoverRotatePanMode!==0&&!this.useWindowEvents){let e=this.useWindowEvents?window:this.domElement;e.addEventListener("pointerleave",this.onPointerLeave),e.addEventListener("pointerenter",this.onPointerEnter)}this.pointerLeaveEvent=void 0}dispose(){this.removeEventListenersFromCamera(),this.domElement.removeEventListener("contextmenu",this.onContextMenu),this.domElement.removeEventListener("pointerdown",this.onPointerDown),this.domElement.removeEventListener("wheel",this.onMouseWheel),window.removeEventListener("keydown",this.onKeyDown,!1),window.removeEventListener("keyup",this.onKeyUp,!1),this.domElement.removeEventListener("pointermove",this.onPointerHover),window.removeEventListener("pointermove",this.onPointerHover),this.domElement.removeEventListener("gesturestart",this.onGesture),this.domElement.removeEventListener("gesturechange",this.onGesture),this.domElement.removeEventListener("gestureend",this.onGesture),this.domElement.removeEventListener("touchend",this.onTouchEnd),this.domElement.removeEventListener("pointerleave",this.onPointerLeave),this.domElement.removeEventListener("pointerenter",this.onPointerEnter),window.removeEventListener("pointerleave",this.onPointerLeave),window.removeEventListener("pointerenter",this.onPointerEnter),this.domElement.removeEventListener("pointermove",this.onPointerMove),this.domElement.removeEventListener("pointerup",this.onPointerUp)}applyLimits(e,t,i,r,n,s,a,o){let l,h,u;this.overShoot.set(0,0),e instanceof R?(l=e.x,h=e.y,this.current.set(this.target.x,this.target.y),u=!0):(l=e.theta,h=e.phi,this.current.set(cc(this.spherical.theta),cc(this.spherical.phi)),u=!1),i===0&&(this.current.x+=l,this.current.y+=h),(t===3||t===2)&&(!u&&this.isThetaFlipped?this.current.x>r&&this.current.x<0?this.overShoot.x=r-this.current.x:this.current.x<n&&this.current.x>0&&(this.overShoot.x=n-this.current.x):this.current.x>r?this.overShoot.x=r-this.current.x:this.current.x<n&&(this.overShoot.x=n-this.current.x)),(t===3||t===1)&&(this.current.y>s?this.overShoot.y=s-this.current.y:this.current.y<a&&(this.overShoot.y=a-this.current.y)),u||(this.overShoot.x=cc(this.overShoot.x),this.overShoot.y=cc(this.overShoot.y)),i!==0?(this.overRatio.copy(this.overShoot).divide(o),this.overRatio.x=Math.min(Math.abs(this.overRatio.x),1),this.overRatio.y=Math.min(Math.abs(this.overRatio.y),1),i===1&&(this.overRatio.x=ove(Math.abs(this.overRatio.x)),this.overRatio.y=ove(Math.abs(this.overRatio.y))),this.isPointerDown||i===1?i===2&&(this.overRatio.x>.9&&!this.thetaIsFree||this.overRatio.y>.9&&!this.phiIsFree)?this.isPointerDown=!1:(l*this.overShoot.x<0&&!this.thetaIsFree&&(l*=1-this.overRatio.x),h*this.overShoot.y<0&&!this.phiIsFree&&(h*=1-this.overRatio.y)):i===2&&(!u&&(this.overRatio.x>.002&&!this.thetaIsFree||this.overRatio.y>.002&&!this.phiIsFree)||u&&(Math.abs(this.overShoot.x)>2||Math.abs(this.overShoot.y)>2)?(this.thetaIsFree||(l=.05*this.overShoot.x),this.phiIsFree||(h=.05*this.overShoot.y),u?this.isPanOverShoot=!0:this.isRotateOverShoot=!0):u?this.isPanOverShoot=!1:this.isRotateOverShoot=!1)):(l+=this.overShoot.x,h+=this.overShoot.y),e instanceof R?(e.x=l,e.y=h):(this.thetaIsFree||(e.theta=l),this.phiIsFree||(e.phi=h))}setEnableDampingSpeed(e){this.enableDamping=e,this.rotateSpeed=(e===!0?.2:1)*this.rotateFactor}stopDamping(){this.sphericalDelta.theta=0,this.sphericalDelta.phi=0,this.panOffset.set(0,0,0)}setTarget(e,t,i){this.stopDamping(),this.target.set(e,t,i)}getAutoRotationAngle(){return 2*Math.PI/60/60*this.autoRotateSpeed}getZoomScale(){return Math.pow(.95,this.zoomSpeed)}rotateLeft(e){this.sphericalDelta.theta-=e}rotateUp(e){this.sphericalDelta.phi-=e}panLeft(e,t){this.panLeftV.setFromMatrixColumn(t,0),this.panLeftV.multiplyScalar(-e),this.panOffset.add(this.panLeftV)}panUp(e,t){this.panUpV.setFromMatrixColumn(t,1),this.panUpV.multiplyScalar(e),this.panOffset.add(this.panUpV)}pan(e,t){let i=this.domElement;if(i&&this.object.isPerspectiveCamera){let r=this.object.position;this.panV.copy(r).sub(this.target);let n=this.panV.length();n*=Math.tan(this.object.fov/2*Math.PI/180),this.panLeft(2*e*n/i.clientHeight,this.object.matrixWorld),this.panUp(2*t*n/i.clientHeight,this.object.matrixWorld)}else i&&this.object.isOrthographicCamera&&(this.panLeft(e*(this.object.right-this.object.left)/this.object.zoom/i.clientWidth,this.object.matrixWorld),this.panUp(t*(this.object.top-this.object.bottom)/this.object.zoom/i.clientHeight,this.object.matrixWorld));this.dispatchEvent(BN)}dollyOut(e){this.object.isPerspectiveCamera?this.scale/=e:this.object.isOrthographicCamera&&(this.object.zoom*=e,this.zoomLimitsEnabled&&(this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom))),this.object.updateProjectionMatrix(),this.zoomChanged=!0),this.dispatchEvent(BN)}dollyIn(e){this.object.isPerspectiveCamera?this.scale*=e:this.object.isOrthographicCamera&&(this.object.zoom/=e,this.zoomLimitsEnabled&&(this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom))),this.object.updateProjectionMatrix(),this.zoomChanged=!0),this.dispatchEvent(BN)}setZoom(e){if(this.dispatchEvent(iM),this.object.isPerspectiveCamera){let t=this.initialSphericalRadius/e/this.spherical.radius;this.scale=t}else this.object.isOrthographicCamera&&(this.object.zoom=e,this.zoomLimitsEnabled&&(this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom))),this.object.updateProjectionMatrix(),this.zoomChanged=!0);this.dispatchEvent(Cv)}handleMouseDownRotate(e){this.rotateStart.set(e.clientX,e.clientY)}handleMouseDownDolly(e){this.dollyStart.set(e.clientX,e.clientY)}handleMouseDownPan(e){this.panStart.set(e.clientX,e.clientY)}handleMouseMoveRotate(e,t=1){e.movementX!==void 0?this.rotateDelta.set(e.movementX,e.movementY):(this.rotateEnd.set(e.clientX,e.clientY),this.rotateDelta.subVectors(this.rotateEnd,this.rotateStart),this.rotateStart.copy(this.rotateEnd)),this.rotateDelta.multiplyScalar(this.rotateSpeed*t).rotateAround(sve,-this.object.angleOffsetFromUp);let i=this.domElement,r=this.useWindowEvents?window.innerHeight:i.clientHeight,n=2*Math.PI*this.rotateDelta.x/r,s=2*Math.PI*this.rotateDelta.y/r;this.rotateLeft(n),this.rotateUp(s),this.update()}handleMouseMoveDolly(e){this.dollyEnd.set(e.clientX,e.clientY),this.dollyDelta.subVectors(this.dollyEnd,this.dollyStart),this.dollyDelta.y>0?this.dollyOut(this.getZoomScale()):this.dollyDelta.y<0&&this.dollyIn(this.getZoomScale()),this.dollyStart.copy(this.dollyEnd),this.update()}handleMouseMovePan(e,t=1){e.movementX!==void 0?this.panDelta.set(e.movementX,e.movementY):(this.panEnd.set(e.clientX,e.clientY),this.panDelta.subVectors(this.panEnd,this.panStart),this.panStart.copy(this.panEnd)),this.panDelta.multiplyScalar(this.panSpeed*t),this.pan(this.panDelta.x,this.panDelta.y),this.update()}handleMouseWheel(e){if(e.deltaX===0&&e.deltaY===0)return;let t=e.ctrlKey===!0||US(e)===!0,i=US(e)===!1&&((s=e).wheelDeltaY===0||s.deltaY===0?!(wA&&s.shiftKey&&Math.abs(s.wheelDeltaX)>=120)&&(s.wheelDeltaX?Aee(s.wheelDeltaX,s.deltaX):s.deltaMode===0):s.wheelDeltaY?Aee(s.wheelDeltaY,s.deltaY):s.deltaMode===0)===!0,r=t===!1&&(this.gesture===!0||e.timeStamp-this.lastTrackpadPanTime<300),n=t===!1&&r===!1&&e.timeStamp-this.lastMouseWheelZoomTime<300;var s;if(F_e!==!1||n!==!1||i!==!0&&r!==!0){if(this.enableZoom===!1)return;this.gesture&&(window.clearTimeout(this.timer),this.gesture=!1,this.isPointerDown=!1,this.dispatchEvent(Cv)),t===!1&&i===!1&&(this.lastMouseWheelZoomTime=e.timeStamp),e.deltaY===0?e.deltaX<0?this.dollyIn(this.getZoomScale()):e.deltaX>0&&this.dollyOut(this.getZoomScale()):e.deltaY<0?this.dollyIn(this.getZoomScale()):e.deltaY>0&&this.dollyOut(this.getZoomScale()),this.update(),this.gesture=!1,this.isPointerDown=!1}else{if(this.enablePan===!1)return;let a=this.gesture===!1&&r===!1;this.lastTrackpadPanTime=e.timeStamp,this.gesture||(this.gesture=!0,this.isPointerDown=!0),a===!1&&(this.panDelta.set(-e.deltaX,-e.deltaY).multiplyScalar(this.panSpeed),this.panDelta.x=Math.min(Math.abs(this.panDelta.x),100)*(this.panDelta.x<0?-1:1),this.panDelta.y=Math.min(Math.abs(this.panDelta.y),100)*(this.panDelta.y<0?-1:1),e.altKey?this.pan(0,this.panDelta.y):e.shiftKey?this.pan(this.panDelta.x,0):this.pan(this.panDelta.x,this.panDelta.y),this.update()),window.clearTimeout(this.timer),this.timer=window.setTimeout(()=>{this.gesture=!1,this.isPointerDown=!1,this.dispatchEvent(Cv)},100)}}handleTouchStartRotate(){if(vi.length===2){let e=.5*(vi[0].pageX+vi[1].pageX),t=.5*(vi[0].pageY+vi[1].pageY);this.rotateStart.set(e,t)}else this.rotateStart.set(vi[0].pageX,vi[0].pageY)}handleTouchStartPan(){if(vi.length===2){let e=.5*(vi[0].pageX+vi[1].pageX),t=.5*(vi[0].pageY+vi[1].pageY);this.panStart.set(e,t)}else this.panStart.set(vi[0].pageX,vi[0].pageY)}handleTouchStartDolly(){let e=vi[0].pageX-vi[1].pageX,t=vi[0].pageY-vi[1].pageY,i=Math.sqrt(e*e+t*t);this.dollyStart.set(0,i)}handleTouchStartDollyPan(){this.enableZoom&&this.isTouchZoom===!0&&this.handleTouchStartDolly(),this.enablePan&&this.handleTouchStartPan()}handleTouchStartDollyRotate(){this.enableZoom&&this.isTouchZoom===!0&&this.handleTouchStartDolly(),this.enableRotate&&this.handleTouchStartRotate()}handleTouchMoveRotate(e){if(vi.length===2){let i=FU(e),r=.5*(e.pageX+i.x),n=.5*(e.pageY+i.y);this.rotateEnd.set(r,n)}else{if(e.pointerId!==vi[0].pointerId)return;this.rotateEnd.set(e.pageX,e.pageY)}this.rotateDelta.subVectors(this.rotateEnd,this.rotateStart).multiplyScalar(this.rotateSpeed);let t=this.domElement;t&&(this.rotateLeft(2*Math.PI*this.rotateDelta.x/t.clientHeight),this.rotateUp(2*Math.PI*this.rotateDelta.y/t.clientHeight)),this.rotateStart.copy(this.rotateEnd)}handleTouchMovePan(e){if(vi.length===2){let t=FU(e),i=.5*(e.pageX+t.x),r=.5*(e.pageY+t.y);this.panEnd.set(i,r)}else{if(e.pointerId!==vi[0].pointerId)return;this.panEnd.set(e.pageX,e.pageY)}this.panDelta.subVectors(this.panEnd,this.panStart).multiplyScalar(this.panSpeed),this.pan(this.panDelta.x,this.panDelta.y),this.panStart.copy(this.panEnd)}handleTouchMoveDolly(e){let t=FU(e),i=e.pageX-t.x,r=e.pageY-t.y,n=Math.sqrt(i*i+r*r);this.dollyEnd.set(0,n),this.dollyDelta.set(0,Math.pow(this.dollyEnd.y/this.dollyStart.y,this.zoomSpeed)),this.dollyOut(this.dollyDelta.y),this.dollyStart.copy(this.dollyEnd)}handleTouchMoveDollyPan(e){this.enableZoom&&this.isTouchZoom===!0&&this.handleTouchMoveDolly(e),this.enablePan&&this.handleTouchMovePan(e)}handleTouchMoveDollyRotate(e){this.enableZoom&&this.isTouchZoom===!0&&this.handleTouchMoveDolly(e),this.enableRotate&&this.handleTouchMoveRotate(e)}checkRaycastLock(){if(this.object.data.raycastLock){if(this.options.isPlayMode)return!1;{let e=this.options?.showCameraLock;return e&&e(),!0}}return!1}};function cc(e){let t=2*Math.PI;for(;e<=-Math.PI;)e+=t;for(;e>Math.PI;)e-=t;return e}function ove(e){return 1-Math.pow(1-e,4)}ae();var tVe=class{constructor(e,t,i,r){this.enableResponsive=!1,this._renderer=e,this._camera=t,this._frameSize=new Z().copy(i),this._fov=r??t.fov}set frameSize(e){this._frameSize.copy(e)}setRenderSize(e,t){this._renderSize=e===void 0||t===void 0?void 0:new Z(e,t)}updateRenderer(){if(!this._renderer)return;let e=this._renderSize??this._frameSize;this._renderer.setSize(e.x,e.y)}updateViewport(){if(!this._renderer||!this._camera||this._camera.cameraType!=="PerspectiveCamera")return;let e=this._renderSize??this._frameSize;this._renderer.setViewport(0,0,e.x,e.y)}updateCamera(){!this._camera||(this._camera.cameraType==="PerspectiveCamera"?(this._camera.aspect=this._frameSize.x/this._frameSize.y,this._camera.updateProjectionMatrix()):this._camera.setViewplaneSize(this._frameSize.x,this._frameSize.y,this.enableResponsive))}setCamera(e){this._camera=e,this._fov=e.fov}revert(){let e=window.innerWidth,t=window.innerHeight;this._renderer&&(this._renderer.setViewport(0,0,e,t),this._renderer.setSize(e,t)),this._camera&&(this._camera.aspect=e/t,this._camera.fov=this._fov,this._camera.setViewplaneSize(e,t,this.enableResponsive),this._camera.updateProjectionMatrix())}};Na(),ae(),ae(),ae();var _s=new Us,zN=new R,lve=new Z,hve=new Z,uve=new Z,iVe=class{constructor(e){this.geometry=e.geometry,this.randomFunction=Math.random,this.indexAttribute=this.geometry.index,this.positionAttribute=this.geometry.getAttribute("position"),this.normalAttribute=this.geometry.getAttribute("normal"),this.colorAttribute=this.geometry.getAttribute("color"),this.uvAttribute=this.geometry.getAttribute("uv"),this.weightAttribute=null,this.distribution=null}setWeightAttribute(e){return this.weightAttribute=e?this.geometry.getAttribute(e):null,this}build(){let e=this.indexAttribute,t=this.positionAttribute,i=this.weightAttribute,r=e?e.count/3:t.count/3,n=new Float32Array(r);for(let o=0;o<r;o++){let l=1,h=3*o,u=3*o+1,d=3*o+2;e&&(h=e.getX(h),u=e.getX(u),d=e.getX(d)),i&&(l=i.getX(h)+i.getX(u)+i.getX(d)),_s.a.fromBufferAttribute(t,h),_s.b.fromBufferAttribute(t,u),_s.c.fromBufferAttribute(t,d),l*=_s.getArea(),n[o]=l}let s=new Float32Array(r),a=0;for(let o=0;o<r;o++)a+=n[o],s[o]=a;return this.distribution=s,this}setRandomGenerator(e){return this.randomFunction=e,this}sample(e,t,i,r){let n=this._sampleFaceIndex();return this._sampleFace(n,e,t,i,r)}_sampleFaceIndex(){let e=this.distribution[this.distribution.length-1];return this._binarySearch(this.randomFunction()*e)}_binarySearch(e){let t=this.distribution,i=0,r=t.length-1,n=-1;for(;i<=r;){let s=Math.ceil((i+r)/2);if(s===0||t[s-1]<=e&&t[s]>e){n=s;break}e<t[s]?r=s-1:i=s+1}return n}_sampleFace(e,t,i,r,n){let s=this.randomFunction(),a=this.randomFunction();s+a>1&&(s=1-s,a=1-a);let o=this.indexAttribute,l=3*e,h=3*e+1,u=3*e+2;return o&&(l=o.getX(l),h=o.getX(h),u=o.getX(u)),_s.a.fromBufferAttribute(this.positionAttribute,l),_s.b.fromBufferAttribute(this.positionAttribute,h),_s.c.fromBufferAttribute(this.positionAttribute,u),t.set(0,0,0).addScaledVector(_s.a,s).addScaledVector(_s.b,a).addScaledVector(_s.c,1-(s+a)),i!==void 0&&(this.normalAttribute!==void 0?(_s.a.fromBufferAttribute(this.normalAttribute,l),_s.b.fromBufferAttribute(this.normalAttribute,h),_s.c.fromBufferAttribute(this.normalAttribute,u),i.set(0,0,0).addScaledVector(_s.a,s).addScaledVector(_s.b,a).addScaledVector(_s.c,1-(s+a)).normalize()):_s.getNormal(i)),r!==void 0&&this.colorAttribute!==void 0&&(_s.a.fromBufferAttribute(this.colorAttribute,l),_s.b.fromBufferAttribute(this.colorAttribute,h),_s.c.fromBufferAttribute(this.colorAttribute,u),zN.set(0,0,0).addScaledVector(_s.a,s).addScaledVector(_s.b,a).addScaledVector(_s.c,1-(s+a)),r.r=zN.x,r.g=zN.y,r.b=zN.z),n!==void 0&&this.uvAttribute!==void 0&&(lve.fromBufferAttribute(this.uvAttribute,l),hve.fromBufferAttribute(this.uvAttribute,h),uve.fromBufferAttribute(this.uvAttribute,u),n.set(0,0).addScaledVector(lve,s).addScaledVector(hve,a).addScaledVector(uve,1-(s+a))),this}};function dve(e,t){let i=e,r=new Float32Array(4*t*t);for(let s=0;s<t*t;s++)r[4*s]=i[3*s],r[4*s+1]=i[3*s+1],r[4*s+2]=i[3*s+2],r[4*s+3]=0;let n=new Ir(r,t,t,fn,Wt);return n.needsUpdate=!0,n}mK(),ae(),ae(),ae(),ae();var H9=class{constructor(e,t,i,r){this.type="SphereEmitterShape",this.targetMesh=void 0,this.size=e,this.type=i,this.textureSize=function(o){let l=Math.ceil(Math.sqrt(o));return Math.max(l,1)}(t),this.targetMesh=r?.geometry.type==="BufferGeometry"||r?.type==="Mesh"&&r&&r.geometry.hasAttribute("position")&&r.geometry.hasAttribute("normal")?r:this.getMesh(i,1);let{positions:n,dataTexture:s,dataTextureNormals:a}=this.createPositions(this.textureSize,this.targetMesh??this.getMesh(i,1));this.positionsTexture=s,this.positionsAttribute=n,this.directionsTexture=a}createPositions(e,t){let{positions:i,normals:r}=function(n,s){let a=new Tr(n.geometry,n.material),o=[],l=[],h=new R,u=new R;a.geometry.index!==null&&(a.geometry=a.geometry.toNonIndexed());let d=new iVe(a).build();for(let c=0;c<s;c++)d.sample(h,u),o.push(h.x,h.y,h.z),l.push(u.x,u.y,u.z);return{positions:new Float32Array(o),normals:new Float32Array(l)}}(t,e*e);return{dataTexture:dve(i,e),positions:i,dataTextureNormals:dve(r,e)}}getMesh(e,t){let i=null;switch(e){case"SphereEmitterShape":i=new Hf(.5*t,32,32);break;case"TorusEmitterShape":i=new _L(.5*t,.3,15,40);break;case"ConeEmitterShape":i=new yL(t,t,15);break;case"BoxEmitterShape":i=new Ih(t,t,t);break;case"PlaneEmitterShape":i=new $c(t,t),i.rotateX(-Math.PI/2);break;default:i=new Hf(t,32,32)}return new Tr(i,new Ql({color:16711680}))}applyToShader(e,t){this.size=new R().fromArray(t.size.map(i=>typeof i=="number"?i:1)),e.uEmitterSize.value=this.size}dispose(){this.positionsTexture.dispose(),this.directionsTexture.dispose(),this.positionsAttribute=new Float32Array}};function Jb(e){let t={...e},i=LL.defaultData;t.forceFieldObjectId&&(t.colliderEntityId=t.forceFieldObjectId);let r={...i.shape,...t.shape},n={...i.renderMaterial,...t.renderMaterial};return{...i,...t,shape:r,renderMaterial:n}}zt();var rVe=class extends hn{constructor(e,t){super(),this.type="ParticleEmitter",this.debugMode=!1,this.worldSpace=!0,this.rootObject=null,this.gpuCompute=null,this.positionSimRT=null,this.velocitySimRT=null,this.emissionRateSimRT=null,this.emitterShape=void 0,this.isEmitting=!1,this.hasBeenReset=!1,this.emittedParticlesAmount=0,this.lastEmitTime=0,this.globalTime=0,this.targetFPS=60,this.previousRatio=1,this.lerpFactor=.4,this.particlesAmount=0,this.noiseStrength=0,this.noiseScale=0,this.isBillboardBased=!0,this.simFeaturesDefinition={USE_COLLIDER:!1,USE_ATTRACTOR:!1,USE_VORTEX:!1,USE_SPHERE_COLLIDER:!1,USE_BOX_COLLIDER:!1,USE_FORCE_LOCAL_SPACE:!1,USE_NORMALS:!1,USE_CURL_NOISE:!0,USE_SIMPLEX_NOISE:!1,USE_FBM_NOISE:!1},this.textureLoader=new t_e,this.textureRequestId=0,this.currentWorldPosition=new R,this.systemQuaternion=new jt,this.worldGravity=new R(0,0,0),this.directionAxis=new R(0,0,0),this.colliderV3=new R(0,0,0),this.colliderQuaternion=new jt(0,0,0,1),this.matrixAutoUpdate=!0,this.renderer=e,this.system=t,this.shared=t.context.shared;let i=t.data;this.material=nz(e)?qre()?.createMaterial(i.renderMaterial,t.context)??rz().createMaterial(i.renderMaterial,t.context):rz().createMaterial(i.renderMaterial,t.context),this.material.uniforms={uSize:{value:0},uSizeEnd:{value:0},uColor:{value:i.renderMaterial.color},uColor2:{value:i.renderMaterial.color2},uPosition:{value:new R(0,0,0)},uEmissionData:{value:new R(0,0,0)},uTexture:{value:this.defaultTexture},uWorldOffset:{value:new R(0,0,0)},uWorldQuaternion:{value:new ct(0,0,0,1)},uRandScaleFactor:{value:i.randomScale??0},uRandRotationFactor:{value:i.randomRotation??0},uRotation:{value:i.renderMaterial.spriteRotation[0]??0},uRotationEnd:{value:i.renderMaterial.spriteRotation[1]??0}},this.setTexture(this.material.uniforms,i.renderMaterial.texture),this.init(i)}setTexture(e,t){let i=t.data,r=++this.textureRequestId;if(typeof t=="string"){let n=this.shared.image(t),s=()=>{if(r!==this.textureRequestId)return;let a=new Ri(n.img);a.needsUpdate=!0,e.uTexture.value=a};return void(n.loaded?s():n.loadPromise.then(s))}if(typeof i!="string"){let n=new Image;n.onload=()=>{if(r!==this.textureRequestId)return;let o=new Ri(n);o.needsUpdate=!0,e.uTexture.value=o};let s=new Blob([i],{type:"image/*"}),a=URL.createObjectURL(s);n.src=a}}updateGeometryAttributes(e,t){let i=function(n){let s=new Float32Array(n*n*2);for(let a=0;a<n;a++)for(let o=0;o<n;o++){let l=a*n+o;s[2*l+0]=a/(n-1),s[2*l+1]=o/(n-1)}return s}(t);if(!this.emitterShape?.positionsAttribute)return;let r=new gl(i,2);e.geometry.setAttribute("ref",r),nz(this.renderer)&&e.geometry.setAttribute("particleRef",r)}applyWorldSpace(){if(!(this.system.started&&this.worldSpace&&this.positionSimRT&&this.velocitySimRT))return;let e=this.system;e.getWorldQuaternion(this.systemQuaternion),this.systemQuaternion.invert(),e.getWorldPosition(this.currentWorldPosition),this.material.uniforms.uWorldOffset.value=this.currentWorldPosition,this.material.uniforms.uWorldQuaternion.value.copy(this.systemQuaternion.normalize()),this.positionSimRT.material.uniforms.uWorldOffset.value=this.currentWorldPosition,this.systemQuaternion.invert(),this.positionSimRT.material.uniforms.uWorldQuaternion.value.copy(this.systemQuaternion.normalize()),this.velocitySimRT.material.uniforms.uWorldQuaternion.value.copy(this.systemQuaternion.normalize())}update(e,t){if(!this.gpuCompute||!this.positionSimRT||!this.velocitySimRT||!this.emissionRateSimRT||this.hasBeenReset)return;if(this.checkIfAllParticlesAreDead()&&!this.hasBeenReset)return void this.reset();this.applyWorldSpace(),this.globalTime=e,this.positionSimRT.material.uniforms.uTime.value=e,this.emissionRateSimRT.material.uniforms.uTime.value=e;let i=1e3/t,r=this.targetFPS/i,n=this.previousRatio+(r-this.previousRatio)*this.lerpFactor;this.positionSimRT.material.uniforms.uFPSRatio.value=n,this.previousRatio=n;let s=this.isEmitting?this.GoEmitSomeParticles(e,this.system.data.birthRatePerSec):0;this.emissionRateSimRT.material.uniforms.uLastIndexEmitted.value=this.emittedParticlesAmount,this.emissionRateSimRT.material.uniforms.uParticlesToEmit.value=s,this.material.uniforms.uPosition.value=this.gpuCompute.getCurrentRenderTarget(this.positionSimRT)?.texture,this.system.colliderEntities.length>0&&this.renderColliders(),this.gpuCompute.compute()}renderColliders(){if(!this.velocitySimRT)return;let e=this.system.colliderEntities[0],t=this.simFeaturesDefinition.USE_COLLIDER||this.simFeaturesDefinition.USE_ATTRACTOR||this.simFeaturesDefinition.USE_VORTEX;if(e.destroyedInAction&&t&&this.init(Jb({...this.system.data,colliderEntityId:null})),!e||e.destroyedInAction)return;e.getWorldPosition(this.colliderV3),this.colliderV3.y===0&&(this.colliderV3.y=1e-4),this.velocitySimRT.material.uniforms.uColliderPos.value.copy(this.colliderV3);let i=e.data.size;this.colliderV3.fromArray(i),this.velocitySimRT.material.uniforms.uColliderSize.value.copy(this.simFeaturesDefinition.USE_SPHERE_COLLIDER?this.colliderV3.multiplyScalar(.5):this.colliderV3),e.getWorldQuaternion(this.colliderQuaternion),this.velocitySimRT.material.uniforms.uColliderQuaternion.value.copy(this.colliderQuaternion.normalize()),this.velocitySimRT.material.uniforms.uColliderQuaternionInvert.value.copy(this.colliderQuaternion.normalize().invert())}updateState(e){!this.velocitySimRT||!this.positionSimRT||(e.renderMaterial&&this.updateMaterialState(e.renderMaterial),this.updateParticleState(e))}updateVariableState(e,t){if(!this.velocitySimRT||!this.positionSimRT)return;t[2]==="size"&&this.material.updateState({size:[e,this.material.uniforms.uSizeEnd.value]}),t[2]==="sizeEnd"&&this.material.updateState({size:[this.material.uniforms.uSize.value,e]});let i=(r,n)=>{let s=[...this.system.data.shape.size];s[r]=n,this.updateParticleState({shape:{...this.system.data.shape,size:s}})};t[2]==="shape_size_0"&&i(0,e),t[2]==="shape_size_1"&&i(1,e),t[2]==="shape_size_2"&&i(2,e),t[2]==="speed"&&(this.velocitySimRT.material.uniforms.uSpeed.value=e/10),t[2]==="gravity"&&this.worldGravity.set(0,e/100,0),t[2]==="noiseStrength"&&(this.noiseStrength=e,this.velocitySimRT.material.uniforms.uNoiseStrength.value=this.noiseStrength),t[2]==="noiseScale"&&(this.noiseScale=e,this.velocitySimRT.material.uniforms.uNoiseScale.value=this.noiseScale),t[2]==="direction_x"&&(this.directionAxis=this.getDirectionAxis([Number(e),this.system.data.direction[1],this.system.data.direction[2]])),t[2]==="direction_y"&&(this.directionAxis=this.getDirectionAxis([this.system.data.direction[0],Number(e),this.system.data.direction[2]])),t[2]==="direction_z"&&(this.directionAxis=this.getDirectionAxis([this.system.data.direction[0],this.system.data.direction[1],Number(e)]))}updateMaterialState(e){this.material.updateState({...e,size:e.size?[Number(this.shared.getVariable(e.size[0],[this.uuid,"particles","size"])),Number(this.shared.getVariable(e.size[1],[this.uuid,"particles","sizeEnd"]))]:[0,0]}),e.texture&&(this.setTexture(this.material.uniforms,e.texture),this.material.needsUpdate=!0)}updateParticleState(e){if(this.positionSimRT&&this.velocitySimRT){if(this.shouldReInitGPUCompute(e)&&this.init(Jb(this.system.data)),e.life!==void 0&&(this.positionSimRT.material.uniforms.uMaxLifeTime.value=e.life),e.speed!==void 0&&(this.velocitySimRT.material.uniforms.uSpeed.value=Number(this.shared.getVariable(e.speed,[this.uuid,"particles","speed"]))/10),e.collisionBounce!==void 0&&(this.velocitySimRT.material.uniforms.uBounce.value=e.collisionBounce),e.noiseStrength!==void 0&&(this.noiseStrength=Number(this.shared.getVariable(e.noiseStrength,[this.uuid,"particles","noiseStrength"])),this.velocitySimRT.material.uniforms.uNoiseStrength.value=this.noiseStrength),e.noiseScale!==void 0&&(this.noiseScale=Number(this.shared.getVariable(e.noiseScale,[this.uuid,"particles","noiseScale"])),this.velocitySimRT.material.uniforms.uNoiseScale.value=this.noiseScale),e.noiseSeed!==void 0&&(this.velocitySimRT.material.uniforms.uNoiseSeed.value=e.noiseSeed),e.randomMass!==void 0&&(this.velocitySimRT.material.uniforms.uRandomMassFactor.value=e.randomMass),e.renderMaterial?.size!==void 0){let t=this.shared.getVariable(e.renderMaterial.size[0],[this.uuid,"particles","size"]);this.velocitySimRT.material.uniforms.particleSize.value=Number(t)}if(e.renderMaterial?.spriteRotation!==void 0&&(this.material.uniforms.uRotation.value=e.renderMaterial.spriteRotation[0],this.material.uniforms.uRotationEnd.value=e.renderMaterial.spriteRotation[1]),e.shape!==void 0){let t=e.shape.size??this.system.data.shape.size,i=[Number(this.shared.getVariable(t[0],[this.uuid,"particles","shape_size_0"])),Number(this.shared.getVariable(t[1],[this.uuid,"particles","shape_size_1"])),Number(this.shared.getVariable(t[2],[this.uuid,"particles","shape_size_2"]))],r={...Jb(this.system.data).shape,size:i};this.emitterShape?.applyToShader(this.positionSimRT.material.uniforms,r)}if(e.gravity!==void 0&&(this.worldGravity.set(0,Number(this.shared.getVariable(this.system.data.gravity,[this.uuid,"particles","gravity"]))/100,0),this.velocitySimRT.material.uniforms.uGravity={value:this.worldGravity}),e.direction!==void 0){let t=this.getDirectionFromVariable(e.direction);this.directionAxis=this.getDirectionAxis(t),this.velocitySimRT.material.uniforms.uDirectionsAxis.value=this.directionAxis}e.randomRotation!==void 0&&(this.material.uniforms.uRandRotationFactor.value=e.randomRotation),e.randomScale!==void 0&&(this.material.uniforms.uRandScaleFactor.value=e.randomScale)}}updateForceFieldParameters(e){!this.velocitySimRT||(e.forceIntensity!==void 0&&(this.velocitySimRT.material.uniforms.uForceIntensity.value=e.forceIntensity),e.forceDambing!==void 0&&(this.velocitySimRT.material.uniforms.uForceDamping.value=e.forceDambing))}getDirectionAxis(e){let t=[Number(e[0])*et.DEG2RAD,Number(e[1])*et.DEG2RAD,Number(e[2])*et.DEG2RAD],i=new Dr(t[0],t[1],t[2],"XYZ");return this.directionAxis.set(0,1,0).applyEuler(i).normalize(),this.velocitySimRT&&(this.velocitySimRT.material.uniforms.uDirectionsAxis.value=this.directionAxis),this.directionAxis}shouldReInitGPUCompute(e){let{birthRatePerSec:t,rootObjectType:i,colliderEntityId:r,shape:n,emitTimeDuration:s,emitTimeCycle:a,life:o,directionMode:l,noiseType:h}=e;return t!==void 0||i!==void 0||r||r===null||a!==void 0||n!==void 0||o!==void 0||s!==void 0||l!==void 0||h!==void 0}init(e){this.dispose(),this.particlesAmount=this.getMaxParticlesAmount({birthRatePerSecond:e.birthRatePerSec,particleMaxLifeTime:e.life,loopDuration:e.emitTimeCycle==="infinity"?0:e.emitTimeDuration}),this.particlesAmount>1e5&&(console.warn("The maximum number of particles is limited to 100000."),this.particlesAmount=1e5),this.emitterShape=this.createShape(e.shape,this.particlesAmount);let t=setInterval(()=>{if(!this.emitterShape)return;let m=this.emitterShape.positionsTexture.source.data.data;m&&!isNaN(m[0])?clearInterval(t):this.init(e)},100);if(!this.emitterShape)return;let i=this.updateSimulationDefinition(e),r=nz(this.renderer)?qre().createComputation(this.emitterShape.textureSize,this.emitterShape.textureSize,this.renderer,this.simFeaturesDefinition):rz().createComputation(this.emitterShape.textureSize,this.emitterShape.textureSize,this.renderer),n=r.addVariable("uCurrentPosition",i+`
|
|
12292
12292
|
|
|
12293
12293
|
|
|
12294
12294
|
|
|
@@ -12924,11 +12924,11 @@ void main() {
|
|
|
12924
12924
|
void main() {
|
|
12925
12925
|
vec4 texel = texture2D( tDiffuse, vUv );
|
|
12926
12926
|
gl_FragColor = texel;
|
|
12927
|
-
}`}),AVe=new class{constructor(e){this._mesh=new Tr(EVe,e)}dispose(){this._mesh.geometry.dispose()}render(e){e.render(this._mesh,MVe)}get material(){return this._mesh.material}set material(e){this._mesh.material=e}}(S3e),Q9=null,J9=null,CVe=Bi.identity(),T3e=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||WE.add(this),this.context.shared.requestRender()},this._innerApplySize=()=>{let s=this.width,a=this.height;this.renderer.dpr=Ive(s,a,this.dpr,this.isScreenSpace),this.renderer.setSize(s,a)},this.onFrameOverrideObjectEvent=s=>{if(s.target?.uuid!==void 0){let a=this.frameRoot?.find(s.target.uuid);a&&a.dispatchEvent({...s,target:a})}},this.scene2d=new EZ(et.generateUUID(),cH.defaultData,{dpr:window.devicePixelRatio,shared:r.shared}),this.canvas=(Q9===null&&(Q9=document.createElement("canvas")),Q9),this.renderer=(n=this.canvas,J9===null&&(J9=new yVe(n)),J9),this.promise=this.init(),this.renderTarget=new yr(1,1,{type:di,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 XX(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{S3e.uniforms.tDiffuse.value=this.canvasTexture;let t=e.getRenderTarget();e.setRenderTarget(this.renderTarget),e.clear(),AVe.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=CVe,this.isScreenSpace&&(this.frameOverride.fill.color=Gr.from0to1([0,0,0,0])),this.frameOverride.data={...this.frameOverride.data,width:t,height:i},M3e({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(s,a,o,l){let h=Ive(s,a,o,l),u=Math.max(o,512/Math.min(s,a)),d=Math.min(u,h);return{width:Math.max(1,Math.ceil(s*d)),height:Math.max(1,Math.ceil(a*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 Hc)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 M3e({objectOverride:e,objectRoot:t,newParentWidth:i,newParentHeight:r,initialParentWidth:n,initialParentHeight:s}){if(e instanceof Hc&&t instanceof Hc||e instanceof Xg&&t instanceof Xg)for(let a=0,o=e.children.length;a<o;a++){let l=e.children[a],h=t.children[a];l&&h&&l.uuid===h.uuid&&PVe({objectOverride:l,objectRoot:h,newParentWidth:i,newParentHeight:r,initialParentWidth:n,initialParentHeight:s})}}function PVe({objectOverride:e,objectRoot:t,newParentWidth:i,newParentHeight:r,initialParentWidth:n,initialParentHeight:s}){let[a,o]=function(d){if(e7(d))return[d.width,d.height];if(d instanceof J4){let[c,p]=d.getHalfSize();return[2*c,2*p]}if(d instanceof Xg){let[c,p]=d.recursiveBBox.getHalfSize();return[2*c,2*p]}return[0,0]}(t),{width:l,height:h,position:u}=w3e({constraints:e.data,newParentWidth:i,newParentHeight:r,initialParentWidth:n,initialParentHeight:s,objectInitialWidth:a,objectInitialHeight:o,objectInitialPosition:t.position});if(e.position=u,e.data={...e.data,position:u},e.states)for(let d in e.states)RVe({stateId:d,objectOverride:e,objectRoot:t,newParentWidth:i,newParentHeight:r,initialParentWidth:n,initialParentHeight:s});if(e7(e)||e instanceof Xg)e7(e)&&(e.width=l,e.height=h,e.data={...e.data,width:l,height:h}),M3e({objectOverride:e,objectRoot:t,newParentWidth:l,newParentHeight:h,initialParentWidth:a,initialParentHeight:o});else if(e instanceof J4){let d=t,c=a!==0?l/a:1,p=o!==0?h/o:1;e.path=function(f,m=1,g=1){if(m<=0||g<=0)return f;if(b3e(f))return console.warn("Cannot scale invalid path",f),Z9([]);if(m===1&&g===1)return f;try{return Z9((0,TVe.parseSVG)(f).map(v=>{let y={...v};return"x"in y&&(y.x=y.x*m),"y"in y&&(y.y=y.y*g),"x1"in y&&(y.x1=y.x1*m),"x2"in y&&(y.x2=y.x2*m),"y1"in y&&(y.y1=y.y1*g),"y2"in y&&(y.y2=y.y2*g),"rx"in y&&(y.rx=y.rx*m),"ry"in y&&(y.ry=y.ry*g),y}))}catch(v){return console.warn("Error parsing SVG path",v),Z9([])}}(d.path,c,p),e.data={...e.data,path:e.path}}}function RVe({stateId:e,objectOverride:t,objectRoot:i,newParentWidth:r,newParentHeight:n,initialParentWidth:s,initialParentHeight:a}){let o=t.states?.[e],l=i.states?.[e];if(o&&l){let{width:h,height:u,position:d}=w3e({constraints:t.data,newParentWidth:r,newParentHeight:n,initialParentWidth:s,initialParentHeight:a,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 e7(e){return e instanceof fC||e instanceof Hc||e instanceof TZ||e instanceof MZ}DB();var Ove,DVe=class extends zn{constructor(e,t,i){super(e,t,i),this.isUIObject=!0,this.uiCanvas=new T3e(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=Fg(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):Jr(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=Fg(i,t,this.data.flatShading,this)}};_r(),Tw("UIGeometry",(e,t,i)=>new DVe(e,t,i)),wB=Ove={Scene2D:EZ,UICanvas:T3e,loadHanaUIRUNTIME:function(){return K4||(K4=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(()=>(rJ(),iJ)),_ve??function(){let e=typeof process<"u"?"2.0.122":void 0;return`https://cdn.spline.design/@splinetool/runtime${e?`@${e}`:""}/build/hana-ui.wasm`}())),y3e().then(()=>{})},setHanaUIWasmUrl:function(e){_ve=e}},KL!==null&&Ove.setHanaUIWasmUrl(KL),In("ui-2d"),wK(),Fwe(),ae();var E3e,t7,NVe=class{constructor(){this.type="ShapePath",this.color=new lt,this.subPaths=[],this.currentPath=null}moveTo(e,t){return this.currentPath=new CE,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,s){return this.currentPath?.bezierCurveTo(e,t,i,r,n,s),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,f=u.x,m=d.x,g=c.x,v=h.y,y=u.y,_=d.y,b=c.y,x=(g-m)*(v-_)-(b-_)*(p-m),w=(b-_)*(f-p)-(g-m)*(y-v),S=x/w,T=((f-p)*(v-_)-(y-v)*(p-m))/w;if(w===0&&x!==0||S<=0||S>=1||T<0||T>1)return null;if(x===0&&w===0){for(let M=0;M<2;M++){if(i(M===0?d:c,h,u),e.loc===0){let E=M===0?d:c;return{x:E.x,y:E.y,t:e.t}}if(e.loc===2)return{x:+(p+e.t*(f-p)).toPrecision(10),y:+(v+e.t*(y-v)).toPrecision(10),t:e.t}}return null}for(let M=0;M<2;M++)if(i(M===0?d:c,h,u),e.loc===0){let E=M===0?d:c;return{x:E.x,y:E.y,t:e.t}}return{x:+(p+S*(f-p)).toPrecision(10),y:+(v+S*(y-v)).toPrecision(10),t:S}}function i(h,u,d){let c,p=d.x-u.x,f=d.y-u.y,m=h.x-u.x,g=h.y-u.y,v=p*g-m*f;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*m<0||f*g<0?e.loc=5:Math.sqrt(p*p+f*f)<Math.sqrt(m*m+g*g)?e.loc=6:(c=p!==0?m/p:g/f,e.loc=2,e.t=c))}let r=0,n=999999999,s=-999999999,a=[];this.subPaths.forEach(h=>{let u=h.getPoints(),d=-999999999,c=999999999,p=-999999999,f=999999999;for(let m=0;m<u.length;m++){let g=u[m];g.y>d&&(d=g.y),g.y<c&&(c=g.y),g.x>p&&(p=g.x),g.x<f&&(f=g.x)}s<=p&&(s=p+1),n>=f&&(n=f-1),u.length&&a.push({curves:h.curves,points:u,isCW:lW.isClockWise(u),identifier:r++,boundingBox:new iY(new Z(f,c),new Z(p,d))})});let o=a.map(h=>function(u,d,c,p,f){(f==null||f==="")&&(f="nonzero");let m=new Z;u.boundingBox.getCenter(m);let g=function(w,S,T){let M=new Z;S.getCenter(M);let E=[];return T.forEach(A=>{A.boundingBox.containsPoint(M)&&function(P,N){let D=[],O=[];for(let z=1;z<P.length;z++){let B=P[z-1],V=P[z];for(let j=1;j<N.length;j++){let K=t(B,V,N[j-1],N[j]);K!==null&&D.find($=>$.t<=K.t+Number.EPSILON&&$.t>=K.t-Number.EPSILON)===void 0&&(D.push(K),O.push(new Z(K.x,K.y)))}}return O}(w,A.points).forEach(P=>{E.push({identifier:A.identifier,isCW:A.isCW,point:P})})}),E.sort((A,P)=>A.point.x-P.point.x),E}([new Z(c,m.y),new Z(p,m.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),f==="evenodd"){let w=b.length%2==0,S=b[b.length-2];return{identifier:u.identifier,isHole:w,for:S}}if(f==="nonzero"){let w=!0,S=null,T=null;for(let M=0;M<b.length;M++){let E=b[M];d[E]&&(w?(T=d[E].isCW,w=!1,S=E):T!==d[E].isCW&&(T=d[E].isCW,w=!0))}return{identifier:u.identifier,isHole:w,for:S}}console.warn('fill-rule: "'+f+'" is currently not implemented.')}(h,a,n,s,this.userData?.style.fillRule)),l=[];return a.forEach(h=>{let u=o[h.identifier];if(u&&!u.isHole){let d=new vA;d.curves=h.curves,o.filter(c=>c?.isHole&&c.for===h.identifier).forEach(c=>{if(c){let p=a[c.identifier],f=new CE;f.curves=p.curves,d.holes.push(f)}}),l.push(d)}}),l}},A3e=!1,Lve=new Promise(e=>{E3e=e}),Bve=!1;function Fve(){if(A3e=!0,!Bve)return t7||(t7=async function(){let e=await import("./opentype.js");E3e(e),Bve=!0}(),t7)}var IVe=new class{async load(e,t,i=()=>{}){let{load:r}=await Lve;r(e,(n,s)=>{n||!s?i(n??"Something went wrong"):t(s)})}async parse(e){let{parse:t,Bidi:i}=await Lve;try{let r=t(e),n=new i,s=a=>r.charToGlyphIndex(a.char);return n.registerModifier("glyphIndex",null,s),n.applyFeatures(r,r.defaultRenderOptions.features),{font:r,bidi:n}}catch(r){console.error(r)}}};function OVe(e,t){return t.state.glyphIndex===e||t.state.fina===e||t.state.medi===e||t.state.init===e}ae(),HY(),_r(),Tw("TextGeometry",(e,t,i)=>new UB(e,t,i));var Uve={create:(e,t)=>new UH(e,t)};mH("TextGeometry",Uve),mH("InputGeometry",Uve),WY=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,s=!1;if(i.url?(r=await async function(a){let o;try{o=await fetch(a)}catch(l){throw new Error(`could not fetch the font at ${a}: ${l}`)}if(!o.ok)throw new Error(`${o.status} ${o.statusText} fetching the font at ${a}`);return await o.arrayBuffer()}(i.url),n=i.url,s=i.url.startsWith("/")):i.data&&(r=i.data.buffer.slice(i.data.byteOffset,i.data.byteOffset+i.data.byteLength)),r){if(!A3e)return{font:void 0,url:n,intercepted:s,arr:r,bidi:null};{let a=await IVe.parse(r);if(a)return{font:a.font,url:n,intercepted:s,arr:r,bidi:a.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,s=[],a=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[a];if(OVe(h,d)||o)s.push({char:u,index:h,replacements:[d.state.glyphIndex],replacementChars:[d.char]}),a++;else{let c=d.char,p="",f=[d.state.glyphIndex],m=[],g=!1;for(;!g;)a++,p=t.charAt(a),c+=p,f.push(e.charToGlyphIndex(p)),m=e.stringToGlyphs(c),m.length===1&&m[0].index===h&&(g=!0),a>t.length&&(g=!0);s.push({char:u,index:h,replacements:f,replacementChars:Array.from(c)}),a++}}return s}generateShapes(e,t,i){if(!this._isLoaded)return;let r=this.font,n=t.fontSize/this.unitsPerEm,s=t.fontSize*t.lineHeight,a=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(`
|
|
12927
|
+
}`}),AVe=new class{constructor(e){this._mesh=new Tr(EVe,e)}dispose(){this._mesh.geometry.dispose()}render(e){e.render(this._mesh,MVe)}get material(){return this._mesh.material}set material(e){this._mesh.material=e}}(S3e),Q9=null,J9=null,CVe=Bi.identity(),T3e=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||WE.add(this),this.context.shared.requestRender()},this._innerApplySize=()=>{let s=this.width,a=this.height;this.renderer.dpr=Ive(s,a,this.dpr,this.isScreenSpace),this.renderer.setSize(s,a)},this.onFrameOverrideObjectEvent=s=>{if(s.target?.uuid!==void 0){let a=this.frameRoot?.find(s.target.uuid);a&&a.dispatchEvent({...s,target:a})}},this.scene2d=new EZ(et.generateUUID(),cH.defaultData,{dpr:window.devicePixelRatio,shared:r.shared}),this.canvas=(Q9===null&&(Q9=document.createElement("canvas")),Q9),this.renderer=(n=this.canvas,J9===null&&(J9=new yVe(n)),J9),this.promise=this.init(),this.renderTarget=new yr(1,1,{type:di,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 XX(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{S3e.uniforms.tDiffuse.value=this.canvasTexture;let t=e.getRenderTarget();e.setRenderTarget(this.renderTarget),e.clear(),AVe.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=CVe,this.isScreenSpace&&(this.frameOverride.fill.color=Gr.from0to1([0,0,0,0])),this.frameOverride.data={...this.frameOverride.data,width:t,height:i},M3e({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(s,a,o,l){let h=Ive(s,a,o,l),u=Math.max(o,512/Math.min(s,a)),d=Math.min(u,h);return{width:Math.max(1,Math.ceil(s*d)),height:Math.max(1,Math.ceil(a*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 Hc)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 M3e({objectOverride:e,objectRoot:t,newParentWidth:i,newParentHeight:r,initialParentWidth:n,initialParentHeight:s}){if(e instanceof Hc&&t instanceof Hc||e instanceof Xg&&t instanceof Xg)for(let a=0,o=e.children.length;a<o;a++){let l=e.children[a],h=t.children[a];l&&h&&l.uuid===h.uuid&&PVe({objectOverride:l,objectRoot:h,newParentWidth:i,newParentHeight:r,initialParentWidth:n,initialParentHeight:s})}}function PVe({objectOverride:e,objectRoot:t,newParentWidth:i,newParentHeight:r,initialParentWidth:n,initialParentHeight:s}){let[a,o]=function(d){if(e7(d))return[d.width,d.height];if(d instanceof J4){let[c,p]=d.getHalfSize();return[2*c,2*p]}if(d instanceof Xg){let[c,p]=d.recursiveBBox.getHalfSize();return[2*c,2*p]}return[0,0]}(t),{width:l,height:h,position:u}=w3e({constraints:e.data,newParentWidth:i,newParentHeight:r,initialParentWidth:n,initialParentHeight:s,objectInitialWidth:a,objectInitialHeight:o,objectInitialPosition:t.position});if(e.position=u,e.data={...e.data,position:u},e.states)for(let d in e.states)RVe({stateId:d,objectOverride:e,objectRoot:t,newParentWidth:i,newParentHeight:r,initialParentWidth:n,initialParentHeight:s});if(e7(e)||e instanceof Xg)e7(e)&&(e.width=l,e.height=h,e.data={...e.data,width:l,height:h}),M3e({objectOverride:e,objectRoot:t,newParentWidth:l,newParentHeight:h,initialParentWidth:a,initialParentHeight:o});else if(e instanceof J4){let d=t,c=a!==0?l/a:1,p=o!==0?h/o:1;e.path=function(f,m=1,g=1){if(m<=0||g<=0)return f;if(b3e(f))return console.warn("Cannot scale invalid path",f),Z9([]);if(m===1&&g===1)return f;try{return Z9((0,TVe.parseSVG)(f).map(v=>{let y={...v};return"x"in y&&(y.x=y.x*m),"y"in y&&(y.y=y.y*g),"x1"in y&&(y.x1=y.x1*m),"x2"in y&&(y.x2=y.x2*m),"y1"in y&&(y.y1=y.y1*g),"y2"in y&&(y.y2=y.y2*g),"rx"in y&&(y.rx=y.rx*m),"ry"in y&&(y.ry=y.ry*g),y}))}catch(v){return console.warn("Error parsing SVG path",v),Z9([])}}(d.path,c,p),e.data={...e.data,path:e.path}}}function RVe({stateId:e,objectOverride:t,objectRoot:i,newParentWidth:r,newParentHeight:n,initialParentWidth:s,initialParentHeight:a}){let o=t.states?.[e],l=i.states?.[e];if(o&&l){let{width:h,height:u,position:d}=w3e({constraints:t.data,newParentWidth:r,newParentHeight:n,initialParentWidth:s,initialParentHeight:a,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 e7(e){return e instanceof fC||e instanceof Hc||e instanceof TZ||e instanceof MZ}DB();var Ove,DVe=class extends zn{constructor(e,t,i){super(e,t,i),this.isUIObject=!0,this.uiCanvas=new T3e(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=Fg(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):Jr(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=Fg(i,t,this.data.flatShading,this)}};_r(),Tw("UIGeometry",(e,t,i)=>new DVe(e,t,i)),wB=Ove={Scene2D:EZ,UICanvas:T3e,loadHanaUIRUNTIME:function(){return K4||(K4=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(()=>(rJ(),iJ)),_ve??function(){let e=typeof process<"u"?"2.0.123":void 0;return`https://cdn.spline.design/@splinetool/runtime${e?`@${e}`:""}/build/hana-ui.wasm`}())),y3e().then(()=>{})},setHanaUIWasmUrl:function(e){_ve=e}},KL!==null&&Ove.setHanaUIWasmUrl(KL),In("ui-2d"),wK(),Fwe(),ae();var E3e,t7,NVe=class{constructor(){this.type="ShapePath",this.color=new lt,this.subPaths=[],this.currentPath=null}moveTo(e,t){return this.currentPath=new CE,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,s){return this.currentPath?.bezierCurveTo(e,t,i,r,n,s),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,f=u.x,m=d.x,g=c.x,v=h.y,y=u.y,_=d.y,b=c.y,x=(g-m)*(v-_)-(b-_)*(p-m),w=(b-_)*(f-p)-(g-m)*(y-v),S=x/w,T=((f-p)*(v-_)-(y-v)*(p-m))/w;if(w===0&&x!==0||S<=0||S>=1||T<0||T>1)return null;if(x===0&&w===0){for(let M=0;M<2;M++){if(i(M===0?d:c,h,u),e.loc===0){let E=M===0?d:c;return{x:E.x,y:E.y,t:e.t}}if(e.loc===2)return{x:+(p+e.t*(f-p)).toPrecision(10),y:+(v+e.t*(y-v)).toPrecision(10),t:e.t}}return null}for(let M=0;M<2;M++)if(i(M===0?d:c,h,u),e.loc===0){let E=M===0?d:c;return{x:E.x,y:E.y,t:e.t}}return{x:+(p+S*(f-p)).toPrecision(10),y:+(v+S*(y-v)).toPrecision(10),t:S}}function i(h,u,d){let c,p=d.x-u.x,f=d.y-u.y,m=h.x-u.x,g=h.y-u.y,v=p*g-m*f;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*m<0||f*g<0?e.loc=5:Math.sqrt(p*p+f*f)<Math.sqrt(m*m+g*g)?e.loc=6:(c=p!==0?m/p:g/f,e.loc=2,e.t=c))}let r=0,n=999999999,s=-999999999,a=[];this.subPaths.forEach(h=>{let u=h.getPoints(),d=-999999999,c=999999999,p=-999999999,f=999999999;for(let m=0;m<u.length;m++){let g=u[m];g.y>d&&(d=g.y),g.y<c&&(c=g.y),g.x>p&&(p=g.x),g.x<f&&(f=g.x)}s<=p&&(s=p+1),n>=f&&(n=f-1),u.length&&a.push({curves:h.curves,points:u,isCW:lW.isClockWise(u),identifier:r++,boundingBox:new iY(new Z(f,c),new Z(p,d))})});let o=a.map(h=>function(u,d,c,p,f){(f==null||f==="")&&(f="nonzero");let m=new Z;u.boundingBox.getCenter(m);let g=function(w,S,T){let M=new Z;S.getCenter(M);let E=[];return T.forEach(A=>{A.boundingBox.containsPoint(M)&&function(P,N){let D=[],O=[];for(let z=1;z<P.length;z++){let B=P[z-1],V=P[z];for(let j=1;j<N.length;j++){let K=t(B,V,N[j-1],N[j]);K!==null&&D.find($=>$.t<=K.t+Number.EPSILON&&$.t>=K.t-Number.EPSILON)===void 0&&(D.push(K),O.push(new Z(K.x,K.y)))}}return O}(w,A.points).forEach(P=>{E.push({identifier:A.identifier,isCW:A.isCW,point:P})})}),E.sort((A,P)=>A.point.x-P.point.x),E}([new Z(c,m.y),new Z(p,m.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),f==="evenodd"){let w=b.length%2==0,S=b[b.length-2];return{identifier:u.identifier,isHole:w,for:S}}if(f==="nonzero"){let w=!0,S=null,T=null;for(let M=0;M<b.length;M++){let E=b[M];d[E]&&(w?(T=d[E].isCW,w=!1,S=E):T!==d[E].isCW&&(T=d[E].isCW,w=!0))}return{identifier:u.identifier,isHole:w,for:S}}console.warn('fill-rule: "'+f+'" is currently not implemented.')}(h,a,n,s,this.userData?.style.fillRule)),l=[];return a.forEach(h=>{let u=o[h.identifier];if(u&&!u.isHole){let d=new vA;d.curves=h.curves,o.filter(c=>c?.isHole&&c.for===h.identifier).forEach(c=>{if(c){let p=a[c.identifier],f=new CE;f.curves=p.curves,d.holes.push(f)}}),l.push(d)}}),l}},A3e=!1,Lve=new Promise(e=>{E3e=e}),Bve=!1;function Fve(){if(A3e=!0,!Bve)return t7||(t7=async function(){let e=await import("./opentype.js");E3e(e),Bve=!0}(),t7)}var IVe=new class{async load(e,t,i=()=>{}){let{load:r}=await Lve;r(e,(n,s)=>{n||!s?i(n??"Something went wrong"):t(s)})}async parse(e){let{parse:t,Bidi:i}=await Lve;try{let r=t(e),n=new i,s=a=>r.charToGlyphIndex(a.char);return n.registerModifier("glyphIndex",null,s),n.applyFeatures(r,r.defaultRenderOptions.features),{font:r,bidi:n}}catch(r){console.error(r)}}};function OVe(e,t){return t.state.glyphIndex===e||t.state.fina===e||t.state.medi===e||t.state.init===e}ae(),HY(),_r(),Tw("TextGeometry",(e,t,i)=>new UB(e,t,i));var Uve={create:(e,t)=>new UH(e,t)};mH("TextGeometry",Uve),mH("InputGeometry",Uve),WY=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,s=!1;if(i.url?(r=await async function(a){let o;try{o=await fetch(a)}catch(l){throw new Error(`could not fetch the font at ${a}: ${l}`)}if(!o.ok)throw new Error(`${o.status} ${o.statusText} fetching the font at ${a}`);return await o.arrayBuffer()}(i.url),n=i.url,s=i.url.startsWith("/")):i.data&&(r=i.data.buffer.slice(i.data.byteOffset,i.data.byteOffset+i.data.byteLength)),r){if(!A3e)return{font:void 0,url:n,intercepted:s,arr:r,bidi:null};{let a=await IVe.parse(r);if(a)return{font:a.font,url:n,intercepted:s,arr:r,bidi:a.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,s=[],a=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[a];if(OVe(h,d)||o)s.push({char:u,index:h,replacements:[d.state.glyphIndex],replacementChars:[d.char]}),a++;else{let c=d.char,p="",f=[d.state.glyphIndex],m=[],g=!1;for(;!g;)a++,p=t.charAt(a),c+=p,f.push(e.charToGlyphIndex(p)),m=e.stringToGlyphs(c),m.length===1&&m[0].index===h&&(g=!0),a>t.length&&(g=!0);s.push({char:u,index:h,replacements:f,replacementChars:Array.from(c)}),a++}}return s}generateShapes(e,t,i){if(!this._isLoaded)return;let r=this.font,n=t.fontSize/this.unitsPerEm,s=t.fontSize*t.lineHeight,a=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(`
|
|
12928
12928
|
`,t),u=t.horizontalAlign===1?h:0,d=this.getLineInitialOffsetX(a[0],o,t.horizontalAlign,e[0],h),c=this.getLineInitialOffsetY(s,e.length,l,n,t.verticalAlign),p=[],f=e.map(()=>[]),m=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(M){this.warnLayoutError(M)}d=this.getLineInitialOffsetX(a[v],o,t.horizontalAlign,y,h);let x=[];try{x=this.reverseLigaturesTable(r,y,b)}catch(M){this.warnLayoutError(M)}let w=this.computeSpaceWidthForLine(e,v,t,i),S=0,T=b[0];T&&t.horizontalAlign===2&&T.leftSideBearing!==void 0&&(d-=T.leftSideBearing*n);try{this.font?.forEachGlyph(y,d,c,t.fontSize,_,(M,E,A,P,N)=>{let D=M.index===0?`
|
|
12929
12929
|
`:M.unicode?String.fromCharCode(M.unicode):void 0,O=x[S],z=0;if(D===`
|
|
12930
12930
|
`)z=u;else if(D===" ")z=w;else{let B=this.createPath(M,n,E,A,t);B&&(z=B.offsetX,p.push(B.path))}if(O&&O.replacements.length!==1){let B=O.replacements.map($=>(r.glyphs.get($).advanceWidth??0)*n),V=B.reduce(($,Q)=>$+Q,0),j=B.map($=>$/V),K=E;for(let $=0;$<j.length;$++){let Q=z*j[$];m[v].push([K,A]),f[v].push(Q),K+=Q}}else m[v].push([E,A]),f[v].push(z);S++})}catch(M){this.warnLayoutError(M)}c-=s}let g=[];for(let v=0,y=p.length;v<y;v++)g.push(...p[v].toShapes());return{shapes:g,charWidths:f,lineWidths:a,charCoords:m}}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(`
|
|
12931
|
-
`)>=0&&(e-=n),i===3?.5*t-.5*e:i===2?t-e:0}getLineInitialOffsetY(e,t,i,r,n){let s=t*e,a=e-Math.abs(this.ascender-this.descender)*r,o=-this.ascender*r-a/2;return n===3?-(i-s-o):n===2?-(.5*i-.5*s-o):o}createPath(e,t,i,r,n){let s=e.getPath(i,-r,n.fontSize,{kerning:!1,letterSpacing:n.letterSpacing});if(!s)return void console.error('THREE.Font: character "'+e+'" does not exists in font family '+this.familyName+".");let a=new NVe,o=(e.advanceWidth??1)*t;if(e)for(let l of s.commands){let h=a.currentPath?.currentPoint;if(!h||l.type==="Z"||h.x!==l.x||-h.y!==l.y)switch(l.type){case"M":a.moveTo(l.x,-l.y);break;case"L":a.lineTo(l.x,-l.y);break;case"Q":a.quadraticCurveTo(l.x1,-l.y1,l.x,-l.y);break;case"C":a.bezierCurveTo(l.x1,-l.y1,l.x2,-l.y2,l.x,-l.y)}}return a.subPaths.forEach(l=>{let h=function(u){if(u.length){let d=u[0];if(d instanceof Th)return d.v1;if(d instanceof mu||d instanceof pf)return d.v0}}(l.curves);h!==void 0&&l.currentPoint.distanceTo(h)>0&&l.lineTo(h.x,h.y)}),{offsetX:o,path:a}}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),s=e[t];if(s){let a=this.countSpaces(s.trimEnd());if(i.horizontalAlign===4&&t<e.length-1&&a)return((typeof i.width=="string"?Number(r.getVariable(i.width)):i.width)-(this.getTextWidth(s,i)-a*n))/a}return n}countSpaces(e){return(e.match(/ /g)||[]).length}},In("text"),zt();var C3e=null;function zve(){return C3e}function LVe(e){let t=!1;return e.scene.objects.forEach(i=>{i.data.type==="Page"&&!t&&i.data.publish.gameControlObject&&n1.traverseModuleInstances(e,i.id,(r,n,s)=>{for(let a of s)a.data.type==="GameControl"&&a.data.navmesh.enabled&&(t=!0)})}),t}jr();var WN=(e,t)=>{let i=t.x-e.x,r=t.y-e.y;return Math.sqrt(i*i+r*r)},i7=e=>e*(Math.PI/180),HN=new Map,eB=(e,t,i)=>{let r,n=t.split(/[ ,]+/g);for(let s=0;s<n.length;s+=1)r=n[s],e.addEventListener?e.addEventListener(r,i,!1):e.attachEvent&&e.attachEvent(r,i)},tB=(e,t,i)=>{let r,n=t.split(/[ ,]+/g);for(let s=0;s<n.length;s+=1)r=n[s],e.removeEventListener?e.removeEventListener(r,i):e.detachEvent&&e.detachEvent(r,i)},P3e=e=>(e.preventDefault(),e.type.match(/^touch/)?e.changedTouches:e),kve=()=>{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}},r7=(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")},n7=(e,t,i)=>{let r=R3e(e);for(let n in r)if(Object.prototype.hasOwnProperty.call(r,n))if(typeof t=="string")r[n]=t+" "+i;else{let s="";for(let a=0,o=t.length;a<o;a+=1)s+=t[a]+" "+i+", ";r[n]=s.slice(0,-2)}return r},R3e=e=>{let t={};return t[e]="",["webkit","Moz","o"].forEach(function(i){t[i+e.charAt(0).toUpperCase()+e.slice(1)]=""}),t},s7=(e,t)=>{for(let i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},mX=(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"&&(D3e="ontouchstart"in window,N3e=!!window.PointerEvent,I3e=!!window.MSPointerEvent);var D3e,N3e,I3e,hb,Vve={start:"mousedown",move:"mousemove",end:"mouseup"},sM={};function qv(){}N3e?hb={start:"pointerdown",move:"pointermove",end:"pointerup, pointercancel"}:I3e?hb={start:"MSPointerDown",move:"MSPointerMove",end:"MSPointerUp"}:D3e?(hb={start:"touchstart",move:"touchmove",end:"touchend, touchcancel"},sM=Vve):hb=Vve,qv.prototype.on=function(e,t){var i,r=this,n=e.split(/[ ,]+/g);r._handlers_=r._handlers_||{};for(var s=0;s<n.length;s+=1)i=n[s],r._handlers_[i]=r._handlers_[i]||[],r._handlers_[i].push(t);return r},qv.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},qv.prototype.trigger=function(e,t){var i,r=this,n=e.split(/[ ,]+/g);r._handlers_=r._handlers_||{};for(var s=0;s<n.length;s+=1)i=n[s],r._handlers_[i]&&r._handlers_[i].length&&r._handlers_[i].forEach(function(a){a.call(r,{type:i,target:r},t)})},qv.prototype.config=function(e){var t=this;t.options=t.defaults||{},e&&(t.options=((i,r)=>{let n={};for(let s in i)Object.prototype.hasOwnProperty.call(i,s)&&Object.prototype.hasOwnProperty.call(r,s)?n[s]=r[s]:Object.prototype.hasOwnProperty.call(i,s)&&(n[s]=i[s]);return n})(t.options,e))},qv.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.')},eB(e,hb[t],i._domHandlers_[t]),sM[t]&&eB(e,sM[t],i._domHandlers_[t]),i},qv.prototype.unbindEvt=function(e,t){var i=this;return i._domHandlers_=i._domHandlers_||{},tB(e,hb[t],i._domHandlers_[t]),sM[t]&&tB(e,sM[t],i._domHandlers_[t]),delete i._domHandlers_[t],this};var AZ=qv;function ba(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=ba.id,ba.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}ba.prototype=new AZ,ba.constructor=ba,ba.id=0,ba.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},ba.prototype.stylize=function(){if(this.options.dataOnly)return this;var e=this.options.fadeTime+"ms",t=(()=>{let n=R3e("borderRadius");for(let s in n)Object.prototype.hasOwnProperty.call(n,s)&&(n[s]="50%");return n})(),i=n7("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)"},s7(r.el,i),this.options.shape==="circle"&&s7(r.back,t),s7(r.front,t),this.applyStyles(r),this},ba.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},ba.prototype.addToDom=function(){return this.options.dataOnly||document.body.contains(this.ui.el)||this.options.zone.appendChild(this.ui.el),this},ba.prototype.removeFromDom=function(){return this.options.dataOnly||!document.body.contains(this.ui.el)||this.options.zone.removeChild(this.ui.el),this},ba.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},ba.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},ba.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},ba.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=n7("transition",["top","left"],r);var s={front:{}};s.front={left:i.frontPosition.x+"px",top:i.frontPosition.y+"px"},i.applyStyles(n),i.applyStyles(s),i.restTimeout=setTimeout(function(){typeof e=="function"&&e.call(i),i.restCallback()},i.options.fadeTime)},ba.prototype.restCallback=function(){var e=this,t={};t.front=n7("transition","none",""),e.applyStyles(t),e.trigger("rested",e.instance)},ba.prototype.resetDirection=function(){this.direction={x:!1,y:!1,angle:!1}},ba.prototype.computeDirection=function(e){var t,i,r,n=e.angle.radian,s=Math.PI/4,a=Math.PI/2;if(n>s&&n<3*s&&!e.lockX?t="up":n>-s&&n<=s&&!e.lockY?t="left":n>3*-s&&n<=-s&&!e.lockX?t="down":e.lockY||(t="right"),e.lockY||(i=n>-a&&n<a?"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 BVe=ba;function Xs(e,t){var i=this;i.nipples=[],i.idles=[],i.actives=[],i.ids=[],i.pressureIntervals={},i.manager=e,i.id=Xs.id,Xs.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}Xs.prototype=new AZ,Xs.constructor=Xs,Xs.id=0,Xs.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}},Xs.prototype.bindings=function(){var e=this;e.bindEvt(e.options.zone,"start"),e.options.zone.style.touchAction="none",e.options.zone.style.msTouchAction="none"},Xs.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)}},Xs.prototype.createNipple=function(e,t){var i=this,r=i.manager.scroll,n={},s=i.options,a=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-a,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",s.zone.appendChild(l);var h=l.getBoundingClientRect();s.zone.removeChild(l),n=e,e={x:h.left+r.x,y:h.top+r.y}}var u=new BVe(i,{color:s.color,size:s.size,threshold:s.threshold,fadeTime:s.fadeTime,dataOnly:s.dataOnly,restJoystick:s.restJoystick,restOpacity:s.restOpacity,mode:s.mode,identifier:t,position:e,zone:s.zone,frontPosition:{x:0,y:0},shape:s.shape});return s.dataOnly||(r7(u.ui.el,n),r7(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},Xs.prototype.updateBox=function(){this.box=this.options.zone.getBoundingClientRect()},Xs.prototype.bindNipple=function(e){var t,i=this,r=function(n,s){t=n.type+" "+s.id+":"+n.type,i.trigger(t,s)};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)},Xs.prototype.pressureFn=function(e,t,i){var r=this,n=0;clearInterval(r.pressureIntervals[i]),r.pressureIntervals[i]=setInterval(function(){var s=e.force||e.pressure||e.webkitForce||0;s!==n&&(t.trigger("pressure",s),r.trigger("pressure "+t.identifier+":pressure",s),n=s)}.bind(r),100)},Xs.prototype.onstart=function(e){var t=this,i=t.options,r=e;return e=P3e(e),t.updateBox(),mX(e,function(n){t.actives.length<i.maxNumberOfNipples?t.processOnStart(n):r.type.match(/^touch/)&&(Object.keys(t.manager.ids).forEach(function(s){if(Object.values(r.touches).findIndex(function(o){return o.identifier===s})<0){var a=[e[0]];a.identifier=s,t.processOnEnd(a)}}),t.actives.length<i.maxNumberOfNipples&&t.processOnStart(n))}),t.manager.bindDocument(),!1},Xs.prototype.processOnStart=function(e){var t,i=this,r=i.options,n=i.manager.getIdentifier(e),s=e.force||e.pressure||e.webkitForce||0,a={x:e.pageX,y:e.pageY},o=i.getOrCreate(n,a);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(),s>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(!(WN(a,o.position)<=r.catchDistance))return o.destroy(),void i.processOnStart(e);l(o)}return o},Xs.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)},Xs.prototype.processOnMove=function(e){var t=this,i=t.options,r=t.manager.getIdentifier(e),n=t.nipples.get(r),s=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 a=n.el.getBoundingClientRect();n.position={x:s.x+a.left,y:s.y+a.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=WN(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=i7(c),f=d/o,m={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=i7(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=WN(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+s.y)+"px",n.el.style.left=n.position.x-(t.box.left+s.x)+"px",d=WN(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||r7(n.ui.front,n.frontPosition);var y={identifier:n.identifier,position:l,force:f,pressure:e.force||e.pressure||e.webkitForce||0,distance:d,angle:{radian:p,degree:c},vector:{x:g/o,y:-v/o},raw:m,instance:n,lockX:i.lockX,lockY:i.lockY};(y=n.computeDirection(y)).angle={radian:i7(180-c),degree:180-c},n.trigger("move",y),t.trigger("move "+n.id+":move",y)}else this.processOnEnd(e)},Xs.prototype.processOnEnd=function(e){var t=this,i=t.options,r=t.manager.getIdentifier(e),n=t.nipples.get(r),s=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[s.id]=s.identifier))},Xs.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()},Xs.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 FVe=Xs;function ra(e){var t=this;t.ids={},t.index=0,t.collections=[],t.scroll=kve(),t._windowBound=!1,t.config(e),t.prepareCollections();var i=function(){var r;t.collections.forEach(function(n){n.forEach(function(s){r=s.el.getBoundingClientRect(),s.position={x:t.scroll.x+r.left,y:t.scroll.y+r.top}})})};return t._onResize=function(){(r=>{HN.has(r)&&clearTimeout(HN.get(r)),HN.set(r,setTimeout(function(){HN.delete(r),r()},100))})(i)},t._onScroll=function(){t.scroll=kve()},t.collections}ra.prototype=new AZ,ra.constructor=ra,ra.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}},ra.prototype.create=function(e){return this.createCollection(e)},ra.prototype.bindWindowEvents=function(){var e=this;e._windowBound||typeof window>"u"||(e._windowBound=!0,eB(window,"resize",e._onResize),eB(window,"scroll",e._onScroll))},ra.prototype.unbindWindowEvents=function(){var e=this;!e._windowBound||typeof window>"u"||(e._windowBound=!1,tB(window,"resize",e._onResize),tB(window,"scroll",e._onScroll))},ra.prototype.createCollection=function(e){var t=this,i=new FVe(t,e);return t.bindCollection(i),t.collections.push(i),t.bindWindowEvents(),i},ra.prototype.bindCollection=function(e){var t,i=this,r=function(n,s){t=n.type+" "+s.id+":"+n.type,i.trigger(t,s)};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)},ra.prototype.bindDocument=function(){var e=this;e.binded||(e.bindEvt(document,"move").bindEvt(document,"end"),e.binded=!0)},ra.prototype.unbindDocument=function(e){var t=this;(!Object.keys(t.ids).length||e===!0)&&(t.unbindEvt(document,"move").unbindEvt(document,"end"),t.binded=!1)},ra.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]},ra.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},ra.prototype.onmove=function(e){return this.onAny("move",e),!1},ra.prototype.onend=function(e){return this.onAny("end",e),!1},ra.prototype.oncancel=function(e){return this.onAny("end",e),!1},ra.prototype.onAny=function(e,t){var i,r=this,n="processOn"+e.charAt(0).toUpperCase()+e.slice(1);t=P3e(t);var s=function(a,o,l){l.ids.indexOf(o)>=0&&(l[n](a),a._found_=!0)};return mX(t,function(a){i=r.getIdentifier(a),mX(r.collections,s.bind(null,a,i)),a._found_||r.removeIdentifier(i)}),!1},ra.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()},ra.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 UVe=ra,Hx=null;function Gve(){return Hx||(Hx=new UVe),Hx}var zVe={create:function(e){return Gve().create(e)},destroy:function(){Hx&&(Hx.destroy(),Hx=null)},get factory(){return Gve()}},kVe=zVe;jr(),zt(),ae(),Oh(),Mw(),Tu(),wl(),zt();var O3e=null;function a7(){return O3e}var L3e,o7,VVe=new Promise(e=>{L3e=e});function GVe(e){return o7||(o7=async function(){let t=e??"https://cdn.spline.design/@splinetool/runtime@2.0.122/build",i=import("./physics.js"),[r,n]=await Promise.all([i,fetch(`${t}/physics.wasm`).then(s=>s.arrayBuffer())]);await r.init(n),L3e(r)}(),o7)}function B3e(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,s=t[0]**2+t[4]**2+t[8]**2,a=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||s<l||a<l||o<l}function uf(e,t){let i=new At;if(t&&B3e(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}=tK(e.getAttribute("position"),e.getIndex());return i.setAttribute("position",new Et(r,3)),i.setIndex(n),t&&i.applyMatrix4(t),i}Zn(),wl(),_r(),_K(),ae(),ae(),Aw(),JA();var Er,jVe=class{constructor(e,t,i,r,n,s){this.id=e,this.data=t,this.object=i,this.initialDisabled=!1,this.actions=ha(t,t.actions,r,n,s,i),this.target=t.target}disconnect(){Ka(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.play()),this.actions.Animation.forEach(t=>{"runMode"in t.data&&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()))}},jve=class{constructor(e,t,i,r,n,s){this.id=e,this.data=t,this.object=i,this.page=r,this.currentIntersectedObjects=[],this.actions=ha(t,t.actions,r,n,s,i),this.target=t.target,this.triggeringObjects=[];for(let a of t.triggeringObjects){let o=r.scene.findFrom(a,i);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(){Ka(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.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()))}};Zn(),QA(),yB(),VVe.then(e=>Er=e);var ia=new R,ou=new jt,l7=new R,WVe=new R(1,1,1),h7=(new Dr(0,0,0,"YXZ"),new Dr(0,0,0,"XYZ")),Vp=new R,Wve=new R,aM=new jt,qN=new Ue,Hve=new Ue,HVe={type:"updateMatrix"},u7=(new jt,new Ha),d7=.01,gX={type:"beginEvent",eventName:"Collision"},qVe={type:"beginEvent",eventName:"Trigger"},iB=e=>e.states.some(t=>t.data.position!==void 0||t.data.rotation!==void 0||t.data.shear!==void 0||t.data.cloner!==void 0||t.data.pathSnapping!==void 0);function ub(e){return function(t){return typeof t=="object"&&t!==null&&"booleanOp"in t}(Bg(e)?e.object:e)}var $Ve=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()!==Er.RigidBodyType.Dynamic)return;t.isSleeping()||this.nActiveRigidBodies++;let[i,r]=this.rigidBodyToMesh.get(t.handle);if(ia.copy(t.translation()).multiplyScalar(this.pixelsPerMeter),ou.copy(t.rotation()),i.matrixWorld.makeRotationFromQuaternion(ou).setPosition(ia),i.matrixWorld.multiply(i.shearScale),i.dispatchEvent(HVe),r){let n=i.cloner;if(n&&n.objectForSample===void 0){n.matrixWorld.copy(i.matrixWorld);for(let s of n.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,s;if(this.sensorToTriggerEvent[t]?(n=this.sensorToTriggerEvent[t],s=this.sharedGameControlGlobals.colliderToEntity.get(i)):this.sensorToTriggerEvent[i]&&(n=this.sensorToTriggerEvent[i],s=this.sharedGameControlGlobals.colliderToEntity.get(t)),n&&s&&n.isValidTriggeringObject(s))n.dispatch();else{for(let a=this.sharedGameControlGlobals.createdObjects.length-1;a>=0;a--){let o=this.sharedGameControlGlobals.createdObjects[a];if(o.userData.hasCollisionDestroy&&(o.rigidBody?.collider(0).handle===t||o.rigidBody?.collider(0).handle===i)){this.sharedGameControlGlobals.createdObjects.splice(a,1),o.removeFromParent();let l=o.rigidBody;requestAnimationFrame(()=>{o.rigidBody===l&&(this.sharedGameControlGlobals.rapierWorld?.removeRigidBody(l),o.rigidBody=void 0)});break}}if(this.gameControl?.object!==void 0&&this.gameControl.object===this.sharedGameControlGlobals.colliderToEntity.get(t)){let a=this.sharedGameControlGlobals.colliderToEntity.get(i),o=this.sharedGameControlGlobals.entityToCollisionEvents[a.uuid];if(o===void 0)return;for(let l of o)l.data.target==="character"&&this.dispatchCollisionEvent(l,a,i)}else if(this.gameControl?.object!==void 0&&this.gameControl.object===this.sharedGameControlGlobals.colliderToEntity.get(i)){let a=this.sharedGameControlGlobals.colliderToEntity.get(t),o=this.sharedGameControlGlobals.entityToCollisionEvents[a.uuid];if(o===void 0)return;for(let l of o)l.data.target==="character"&&this.dispatchCollisionEvent(l,a,t)}else{let a=this.sharedGameControlGlobals.colliderToEntity.get(t),o=this.sharedGameControlGlobals.entityToCollisionEvents[a.uuid];if(o!==void 0)for(let u of o)u.data.target==="scene"&&this.dispatchCollisionEvent(u,a,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 s=this.page.scene.find(n);s&&(s.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(a7()===null)return void Ta("collision-bvh","trigger/collision detection");let e=[],t=[];if(this.page.traverseChildren(i=>{let r,n=i instanceof Ix,s=BE(i);if(Lg(i)||n||s)return;r=Bg(i)?i.object:i;let a=r.dataPatched;if(a.physics?.enabled==="visibility"?!a.visible:!a.physics?.enabled)return!0;let o=i.geometry,l=r.userData.hasDestroy===!0,h=r.userData.hasDrag===!0;if(iB(a)||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!!ub(i)||void 0}),e.length>0){let i=this._staticBVHCache;if(i!==void 0&&i.signature.length===t.length&&i.signature.every((s,a)=>s===t[a]))return void(this.sharedGameControlGlobals.staticMeshBVH=i.bvh);let r=sy(e.map(s=>uf(s.geometry,s.matrixWorld)),!1),n=new(a7())(r);this._staticBVHCache={signature:t,bvh:n},this.sharedGameControlGlobals.staticMeshBVH=n}}addRigidBody(e,t,i){if(B3e(e.matrixWorld))return;let r=[],n="geometry"in e?e.geometry:void 0,s=t.dataPatched;if(n?.getAttribute("position")!==void 0&&r.push(uf(n,e.shearScale)),s.physics.fusedBody){let a=this.gatherChildrenGeom(e,r);e.traverseObject(a),e.children.forEach(l=>l.updateMatrixWorld(!0));let o=e.cloner;o&&o.objectForSample===void 0&&s.physics.rigidBody==="dynamic"&&(o.traverseObject(a),o.children.forEach(l=>l.updateMatrixWorld(!0)))}if(r.length>0){let a,o=!1,l=!i.fromCreate&&s.physics.rigidBody==="dynamic"||i.fromCreate&&i.dynamic;l?(a=Er.RigidBodyDesc.dynamic(),a.setLinearDamping(s.physics.damping).setAngularDamping(s.physics.damping).setAdditionalMass(1e-9).setGravityScale(s.physics.gravityScale).enabledRotations(...s.physics.enabledRotation).enabledTranslations(...s.physics.enabledTranslation)):(i.hasTransformAnim||i.hasFollow||i.hasDrag)&&!i.fromCreate?(a=Er.RigidBodyDesc.kinematicPositionBased(),o=!0):a=Er.RigidBodyDesc.fixed();let h=sy(r);ia.setFromMatrixPosition(e.matrixWorld),ou.setFromRotationMatrix(e.matrixWorldRigid),e.position0=ia.clone().divideScalar(this.pixelsPerMeter),e.rotation0=ou.clone(),ia.divideScalar(this.pixelsPerMeter),a.setTranslation(ia.x,ia.y,ia.z).setRotation(ou),h?.scale(1/this.pixelsPerMeter,1/this.pixelsPerMeter,1/this.pixelsPerMeter);let u=this.sharedGameControlGlobals.rapierWorld.createRigidBody(a),d=!(s.geometry===void 0||s.geometry.type==="SubdivGeometry"||s.geometry.type==="NonParametricGeometry"||s.geometry.type==="BooleanGeometry"||s.geometry.type==="VectorGeometry"||s.geometry.type==="StarGeometry"||s.geometry.type==="RectangleGeometry"||s.geometry.type==="EllipseGeometry"||s.geometry.type==="TriangleGeometry"||s.geometry.type==="TorusGeometry"||s.geometry.type==="HelixGeometry");try{this.addCollider(u,s.physics,h,t,d)}catch{try{this.addCollider(u,s.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,s.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(uf(e.geometry,e.shearScale)),e.traverseObject(this.gatherChildrenGeom(e,t)),e.children.forEach(i=>i.updateMatrixWorld(!0)),t.length>0){let i=sy(t,!1);e.bvhGeometry=i,i.getAttribute("position").count>0&&(e.bvhGeometry.boundsTree=new(a7())(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 s;i&&(s=t.colliderType==="trimesh"?Er.ColliderDesc.trimesh(i.getAttribute("position").array,i.getIndex().array):Er.ColliderDesc.convexMesh(i.getAttribute("position").array,n?i.getIndex().array:void 0)),s.setFrictionCombineRule(Er.CoefficientCombineRule.Average).setRestitutionCombineRule(Er.CoefficientCombineRule.Average).setDensity(t.density).setFriction(t.friction).setRestitution(t.restitution);let a=this.sharedGameControlGlobals.rapierWorld.createCollider(s,e);this.sharedGameControlGlobals.colliderToEntity.set(a.handle,r),this.sharedGameControlGlobals.entityToCollisionEvents[r.uuid]?.some(o=>o.target==="scene")&&a.setActiveEvents(Er.ActiveEvents.COLLISION_EVENTS)}gatherChildrenGeom(e,t){let i=ub(e);return(r,n)=>{if(n===0)return;if(i&&r.parent===e)return!0;let s;if(Lg(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;s=r.object}else if(Bg(r))s=r.object;else if(s=r,s.dataPatched.cloner?.hideBase)return!0;let a=s.dataPatched;if(a.physics.enabled==="visibility"?!a.visible:!a.physics.enabled)return!0;n===1?r.matrixWorld.copy(e.shearScale):r.matrixWorld.copy(r.parent.matrixWorld),r.matrixWorld.multiply(r.matrix);let o=r.geometry;return o?.getAttribute("position")!==void 0&&t.push(uf(o,r.matrixWorld)),!!ub(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(a=>{for(let o of a.dataPatched.events)if(o.data.disabled===!1&&o.data.type==="Trigger")return this.needsCollisionDetection=!0,!0});let r=zve();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&&Ta("game-controls","the scene's game controls"),i===!1){let{enableRotate:a,enablePan:o,enableZoom:l,autoRotate:h,hoverRotatePanMode:u}=this.eventManager.publish.orbitControls;(a||o||l||h||u!==0)&&(this.orbitControls=new p3e(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(),s=this.renderer.domElement.height/this.renderer.getPixelRatio();zve()?.createJoysticks(this,n,s),this.markIsDestroyTarget(),this.markIsDragObject(),this.rebuildBVH(),this.initializationCounter++,window.setTimeout(()=>{this.collisionEvents.forEach(a=>a.initialDisabled=!1)},80)}initPhysics(){this.sharedGameControlGlobals.rapierWorld?.free(),this.sharedGameControlGlobals.rapierWorld=new Er.World(new Er.Vector3(0,this.gravity,0)),this.events=new Er.EventQueue(!0);let e=[],t=[];if(this.page.traverseChildren(a=>{let o;if(Lg(a)){if(!a.objectForSample)return a.object.dataPatched.physics.fusedBody===!0&&a.object.dataPatched.physics.rigidBody==="dynamic"||void 0;if(a.objectForSample.dataPatched.physics.fusedBody)return;o=a.object}else if(Bg(a))o=a.object;else{if(BE(a)||s1(a)||a instanceof Ix)return;if(o=a,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;a.updateMatrixWorldRigid();let u=iB(h),d=!1,c=o.userData.hasDestroy,p=o.userData.hasDrag,f=!1;for(let g of h.events)if(g.data.disabled!==!0){if(g.data.type==="Collision"){d=!0;let v=new jVe(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"){f=!0;let v=g.data.target;a.traverseVisible(y=>{y.userData.isFollowingObj=v})}}h.physics.rigidBody==="dynamic"&&h.physics.fusedBody===!1&&(a.matrixWorldFusedFalse=a.matrixWorld.clone());let m=a.geometry;if(l!==void 0){let g=Er.RigidBodyDesc.kinematicPositionBased();(a.hasNonUniformScale?a.matrixWorldRigid:a.matrixWorld).decompose(ia,ou,l7),a.position0=ia.clone().divideScalar(this.pixelsPerMeter),a.rotation0=ou.clone(),ia.divideScalar(this.pixelsPerMeter),g.setTranslation(ia.x,ia.y,ia.z).setRotation(ou);let v,y=this.sharedGameControlGlobals.rapierWorld.createRigidBody(g);a.rigidBody=y,v=l.collider.type==="sphere"?Er.ColliderDesc.ball(l.collider.radius/this.pixelsPerMeter):l.collider.type==="capsule"?Er.ColliderDesc.capsule((l.collider.height/2-l.collider.radius)/this.pixelsPerMeter,l.collider.radius/this.pixelsPerMeter):Er.ColliderDesc.cuboid(l.collider.width/this.pixelsPerMeter/2,l.collider.height/this.pixelsPerMeter/2,l.collider.depth/this.pixelsPerMeter/2),v.setFrictionCombineRule(Er.CoefficientCombineRule.Average).setDensity(h.physics.density).setFriction(h.physics.friction).setRestitution(0).setRestitutionCombineRule(Er.CoefficientCombineRule.Min);let _=this.sharedGameControlGlobals.rapierWorld.createCollider(v,y);this.sharedGameControlGlobals.colliderToEntity.set(_.handle,o),ia.fromArray(l.collider.position.map(x=>typeof x=="number"?x:0)).multiply(l7.setFromMatrixScale(o.matrixWorld)).divideScalar(this.pixelsPerMeter),_.setTranslationWrtParent(ia);let b=new jt().setFromEuler(new Dr().setFromVector3(new R().fromArray(l.collider.rotation.map(x=>typeof x=="number"?x:0))));_.setRotationWrtParent(b),_.setActiveEvents(Er.ActiveEvents.COLLISION_EVENTS),this.generateSensorColliderDescs(o,!0)}else h.physics.rigidBody==="dynamic"||u||f||c||p||d?(this.addRigidBody(a,o,{hasFollow:f,hasTransformAnim:u,hasDrag:p}),this.generateSensorColliderDescs(o,h.physics.fusedBody)):(m&&e.push(uf(m,a.matrixWorld)),h.physics.fusedBody&&!ub(a)&&a.traverseObject((g,v)=>{if(v===0)return;let y;if(Lg(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(BE(g)||s1(g)||g instanceof Ix)return;if(Bg(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(uf(b,g.matrixWorld)),!!ub(g)||void 0}),this.generateSensorColliderDescs(o,h.physics.fusedBody,t));return!(h.physics?.fusedBody!==!0&&!l&&!ub(a))||void 0}),e.length===0)return;let i=sy(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=Er.RigidBodyDesc.fixed(),s=this.sharedGameControlGlobals.rapierWorld.createRigidBody(n);if(r){let a=Er.ColliderDesc.trimesh(i.getAttribute("position").array,i.getIndex().array).setFrictionCombineRule(Er.CoefficientCombineRule.Multiply).setRestitutionCombineRule(Er.CoefficientCombineRule.Multiply).setFriction(1).setRestitution(1);this.sharedGameControlGlobals.rapierWorld.createCollider(a,s)}for(let[a,o]of t){let l=this.sharedGameControlGlobals.rapierWorld.createCollider(a,s);this.sensorToTriggerEvent[l.handle]=o}}updatePositions(){return this.nActiveRigidBodies=0,this.sharedGameControlGlobals.rapierWorld.forEachRigidBody(this.processRigidBody),this.nActiveRigidBodies>0}rebuildBVH(){this.usePhysics?this.initPhysics():(this.page.traverseEntity(e=>{for(let t of e.dataPatched.events)if(t.data.type==="Trigger"&&t.data.disabled!==!0){let i=new jve(t.id,t.data,e,this.page,this.sharedAssets,this.eventManager),r=new Ue().compose(Vp.fromArray(t.data.position.map(n=>typeof n=="number"?n:0)),aM.setFromEuler(h7.fromArray(t.data.rotation.map(n=>typeof n=="number"?n:0))),WVe);if(t.data.triggerZone==="box"){let n=new pn;n.min.fromArray(t.data.size.map(s=>typeof s=="number"?s:0)).multiplyScalar(-.5),n.max.fromArray(t.data.size.map(s=>typeof s=="number"?s: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(),s=0,a=6;for(;this.accumulator>=i&&s<a&&(t=this.stepPhysics()&&t,this.accumulator-=i,s++,!(performance.now()-n>1e3*i)););this.accumulator=this.accumulator%i}}this.skipRender=t}recordPhysicsPose(e){(e.hasNonUniformScale?e.matrixWorldRigid:e.matrixWorld).decompose(ia,ou,l7);let t=e;t.prevQ===void 0?(t.prevQ=ou.clone(),t.prevT=ia.clone()):(t.prevQ.copy(ou),t.prevT.copy(ia))}promoteMovedFixedBodies(){for(let e=this.fixedBodiesToWatch.length-1;e>=0;e--){let[t,i,r]=this.fixedBodiesToWatch[e];t.rigidBody===i?(t.hasNonUniformScale?t.matrixWorldRigid:t.matrixWorld).equals(r)||(i.setBodyType(Er.RigidBodyType.KinematicPositionBased,!0),this.sharedGameControlGlobals.kinematicBodyToEntity.set(i.handle,t),this.sharedGameControlGlobals.entitiesWithTransformAnim.push(t),this.fixedBodiesToWatch.splice(e,1)):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 s=0;s<e.numColliders();s++){let a=e.collider(s);t.contactPairsWith(a,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(a,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<-d7)return;let f=l.linvel();if(n>d7&&p>d7){let v=f.x*d+f.z*c;if(v<=0)return;let y=Math.min(v,p);return void l.setLinvel({x:d*y,y:f.y,z:c*y},!0)}let m=f.x*d+f.z*c-Math.max(0,p);if(m<=0)return;let g=.5*m;l.setLinvel({x:f.x-d*g,y:f.y,z:f.z-c*g},!0)})}}stepPhysics(){this.promoteMovedFixedBodies();let e=this.sharedGameControlGlobals.kinematicBodyToEntity;for(let[t,i]of e)i.rigidBody!==void 0?(this.recordPhysicsPose(i),i.rigidBody.setNextKinematicTranslation(ia.divideScalar(this.pixelsPerMeter)),i.rigidBody.setNextKinematicRotation(ou)):e.delete(t);for(let t of this.sharedGameControlGlobals.entitiesWithTransformAnim)t.rigidBody?.isKinematic()!==!0&&this.recordPhysicsPose(t);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 s of t.cloner.children)if(s.rigidBody===n){r=s;break}}e.dispatch(r),t.dispatchEvent(gX)}updateUseWindowEvents(e){this.orbitControls?.updateUseWindowEvents(e)}generateSensorColliderDescs(e,t,i){let r=Hve.copy(e.matrixWorld).invert();e.traverseEntity((n,s)=>{if(t===!1&&s===1)return!0;for(let a of n.dataPatched.events)if(a.data.type==="Trigger"&&a.data.disabled!==!0){let o,l=new jve(a.id,a.data,n,this.page,this.sharedAssets,this.eventManager);if(o=a.data.triggerZone==="box"?Er.ColliderDesc.cuboid(...a.data.size.map(h=>(typeof h=="number"?h:1)/(2*this.pixelsPerMeter))):Er.ColliderDesc.ball(a.data.radius/this.pixelsPerMeter),o.setDensity(0).setSensor(!0).setActiveEvents(Er.ActiveEvents.COLLISION_EVENTS),Vp.fromArray(a.data.position.map(h=>typeof h=="number"?h:0)),aM.setFromEuler(h7.fromArray(a.data.rotation.map(h=>typeof h=="number"?h:0))),qN.makeRotationFromEuler(h7).setPosition(Vp).premultiply(n.matrixWorld),i?(Af(qN,{translation:Vp,quaternion:aM,scale:Wve}),o.setActiveCollisionTypes(Er.ActiveCollisionTypes.KINEMATIC_FIXED|Er.ActiveCollisionTypes.DYNAMIC_FIXED)):(Af(qN.premultiply(r),{translation:Vp,quaternion:aM,scale:Wve}),e.rigidBody.bodyType()===Er.RigidBodyType.Dynamic||(e.rigidBody.bodyType()===Er.RigidBodyType.Fixed?o.setActiveCollisionTypes(Er.ActiveCollisionTypes.KINEMATIC_FIXED|Er.ActiveCollisionTypes.DYNAMIC_FIXED):o.setActiveCollisionTypes(Er.ActiveCollisionTypes.KINEMATIC_KINEMATIC|Er.ActiveCollisionTypes.DYNAMIC_KINEMATIC))),Vp.divideScalar(this.pixelsPerMeter),o.setTranslation(Vp.x,Vp.y,Vp.z),o.setRotation(aM),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,s]=this.sharedGameControlGlobals.triggers[t];for(let a=0;a<this.sharedGameControlGlobals.entitiesWithTransformAnim.length;a++){let o=this.sharedGameControlGlobals.entitiesWithTransformAnim[a];if(n===o||s.isValidTriggeringObject(nr.is(o)?o:o.object)===!1)continue;let l=Hve.copy(Nbe(n.matrixWorld)).copyPosition(n.matrixWorld).multiply(r),h=qN.copy(o.matrixWorld).invert().multiply(l),u=o.bvhGeometry.boundsTree;i instanceof pn?e=u.intersectsBox(i,h):(u7.radius=i,u7.center.setFromMatrixPosition(h),e=u.intersectsSphere(u7)),e?s.currentIntersectedObjects.indexOf(o)===-1&&(s.currentIntersectedObjects.push(o),s.dispatch(),n.dispatchEvent(qVe)):s.currentIntersectedObjects=s.currentIntersectedObjects.filter(d=>d!==o)}}}};Pw(),ae(),JL(),Or(),QA(),em();var c7=.02,qve=new R,$ve=new R,XVe=new R,ko=new R,Gp=new R,db=new R,p7=new Ue,Xve=new Ue,YVe=new Ue,vh=new jt,Pv=new jt,cb=new Dr(0,0,0,"YXZ"),KVe=new R(1,0,0),pc=new R(0,1,0),ZVe=new R(0,0,1),Yve=new R(1,1,1),Kve=[],Zve=e=>Kve[e]??(Kve[e]=new R),f7=new R,QVe=new R,JVe=new R,e6e=new R,Qve=new jt,t6e=new R,Jve=new jt,za=new Ch,lu=new pn,i6e={type:"requestRender"},r6e={type:"updateMatrix"},vX=class extends cs{constructor(e,t,i,r,n,s,a,o,l){super(),this.object=e,this.domElement=t,this.data=i,this.gloabalPhysics=r,this.controlsManager=n,this.cameraFollow=s,this.camera=a,this.page=o,this.sharedAssets=l,this.enableDamping=!0,this.target0=new R,this.zoom0=1,this.rotForce=1,this.moveForce=1,this.pixelsPerMeter=200,this.euler0=new Dr(0,0,0,"YXZ"),this.shearMatrix0=new Ue,this.cameraShearMatrix0=new Ue,this.position0Cam=new R,this.quat0Cam=new jt,this.scale0Cam=new R,this.threshEndTranslate=.01,this.threshEndRotate=1e-8,this.threshEndRotVel=.005,this.collider={type:"capsule",radius:40,segment:new Ch(new R(0,-40,0),new R(0,40,0)),matrix:new Ue,position:new R,rotation:new jt},this.euler=new Dr(0,0,0,"YXZ"),this.eulerDelta=new R,this.lastPosition=new R,this.lastCameraQuaternion=new jt,this.lastCameraPosition=new R,this.PI_2=Math.PI/2,this.prevMouse=new Z,this.velocityTarget=new R,this.velocity=new R,this.directionXZ=new R,this.rotVelocityStick=new R,this.rotVelocityTarget=new R,this.rotVelocity=new R,this.rotDirection=new R,this.nonColliderRotOffset=new Ue,this.nonColliderPosOffset=new Ue,this.firstPointerId=-1,this.rot=new R,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 Ue,this.objectToTarget=new R,this.objectToTarget0=new R,this.objectToCamXZ=new R,this.objectToCamXZ0=new R,this.targetToCamera=new R,this.targetToCamera0=new R,this.cameraPolarAxis0=new R,this.targetPos=new R,this.targetQuat=new jt,this.lerpFactorPos=new R().setScalar(.3),this.lerpFactorPosStart=.3,this.lerpFactorPosEnd=.3,this.lerpFactorRotStart=.3,this.lerpFactorRotEnd=.3,this.lerpFactorPosCamera=.3,this.lerpFactorRotCamera=.3,this.objXZQuat=new jt,this.objXZQuatInv=new jt,this.objXZRotMat=new Ue,this.isFirstPerson=!1,this.didHit=!1,this.groundVelocity=new R,this.pushedVelocity=new R,this.groundYRotation=0,this.objectRealQuat=new jt,this.colliderWorldQuat=new jt,this.groundNormal=new R,this.groundTilt=new jt,this.groundTiltInv=new jt,this.lastHitObj=null,this.isFirstFrame=!0,this.rotationAccumWhenOrientWithCamera=0,this.navMeshPathDest=null,this.position=new R,this.quaternion=new jt,this.scale=new R,this.initialAction=!0,this.onPointerDown=f=>{!(f.target===this.domElement||f.target instanceof HTMLElement&&f.target.tagName==="SPLINE-VIEWER"&&f.target.shadowRoot?.contains(this.domElement))||this.firstPointerId!==-1||(this.firstPointerId=f.pointerId,this.domElement.ownerDocument.addEventListener("pointermove",this.onPointerMove),this.domElement.ownerDocument.addEventListener("pointerup",this.onPointerUp),this.rotBy!=="keys"&&!Zl&&!AW&&this.domElement.requestPointerLock(),this.prevMouse.set(f.clientX,f.clientY))},this.onPointerUp=f=>{this.firstPointerId=-1,this.domElement.ownerDocument.removeEventListener("pointermove",this.onPointerMove),this.domElement.ownerDocument.removeEventListener("pointerup",this.onPointerUp),f.pointerType==="mouse"&&this.domElement.ownerDocument.exitPointerLock()},this.onPointerMove=f=>{if(f.pointerId!==this.firstPointerId)return;let m=f.clientX-this.prevMouse.x,g=f.clientY-this.prevMouse.y;this.prevMouse.set(f.clientX,f.clientY),f.pointerType==="mouse"&&this.rotBy!=="keys"&&(AW&&U_e<15.5&&!Zl?(this.eulerDelta.y=-m*this.mouseOrbitSensitivity,this.eulerDelta.x=-g*this.mouseOrbitSensitivity):(this.eulerDelta.y=-f.movementX*this.mouseOrbitSensitivity,this.eulerDelta.x=-f.movementY*this.mouseOrbitSensitivity)),f.pointerType!=="mouse"&&this.rotByTouch==="drag"&&(this.eulerDelta.y=-m*this.mouseOrbitSensitivity*5,this.eulerDelta.x=-g*this.mouseOrbitSensitivity*5),this.controlsManager.requestRender()},this.onPointerlockChange=f=>{this.domElement.ownerDocument.pointerLockElement===this.domElement?vX.isLocked=!0:vX.isLocked=!1},this.onPointerlockError=()=>{console.error("SPE.GameControls: Unable to use Pointer Lock API")},this.handleVisibilityChange=()=>{if(document?.hidden)for(let f in this.movementState)this.movementState[f]=0},this.onKeyDown=f=>{!(f.target instanceof HTMLInputElement)&&(f.code==="ArrowLeft"||f.code==="ArrowUp"||f.code==="ArrowRight"||f.code==="ArrowDown"||f.code==="Space")&&f.preventDefault();for(let m of this.keyAssignments)if(f.key.toUpperCase()===m[1]||f.key===m[1]){this.movementState[m[0]]=1;break}this.controlsManager.requestRender()},this.onKeyUp=f=>{for(let m of this.keyAssignments)if(f.key.toUpperCase()===m[1]||f.key===m[1]||f.code.slice(3,f.code.length).toUpperCase()===m[1]){this.movementState[m[0]]=0;break}},this.copyVRGamePadValues=(f,m)=>{for(let g=2;g<4;g++){let v=f.axes[g];m===0?g===2?this.movementState.movePosX=v:this.movementState.movePosZ=v:(f.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===a&&(this.isFirstPerson=!0),this.object.parent instanceof Dn||(this.object.matrixWorldAutoUpdate=!1,this.object.matrix.copy(this.object.matrixWorld)),this.shearMatrix0.copy(this.object.shearMatrix),Af(this.object.matrix,{translation:this.position,quaternion:this.quaternion,scale:this.scale,shearMatrix:this.object.shearMatrix}),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.camera.parent instanceof Dn||(this.camera.matrixWorldAutoUpdate=!1,this.camera.matrix.copy(this.camera.matrixWorld),this.cameraShearMatrix0.copy(this.camera.shearMatrix),Af(this.camera.matrix,{translation:this.camera.position,quaternion:this.camera.quaternion,scale:this.camera.scale,shearMatrix:this.camera.shearMatrix})),this.camera.matrixAutoUpdate=!1,this.offsetMatrix.copy(this.object.matrix).invert().multiply(this.camera.matrix);let f,m=new R(0,0,-1).applyQuaternion(this.camera.quaternion),g=new R().subVectors(this.position,this.camera.position);this.objectToCamXZ.copy(g),this.objectToCamXZ.y=0,this.objectToCamXZ0.copy(this.objectToCamXZ),Math.abs(m.y)<1e-6?(g.y=0,m.y=0,f=g.projectOnVector(m)):f=g.y/m.y>0?m.multiplyScalar(g.y/m.y):m.multiplyScalar(g.length()),this.targetToCamera0.copy(f).negate();let v=this.camera.position.clone().add(f);this.objectToTarget0.subVectors(v,this.position);let y=new Dr().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 Qn&&(this.object.matrixAutoUpdate=!1),this.euler.setFromQuaternion(this.quaternion,"YXZ"),this.rotByTouch=i.rotByTouch??"joystick",this.rotBy=i.rotBy??"keys",this.rotationMode=i.rotationMode??"normal",this.moveMode=i.moveMode??"walk",this.collisionEnabled=i.collisionEnabled,this.speedTranslate=1*(i.speedTranslate??250),this.speedOrbit=.025*(i.speedRotate??100),this.mouseOrbitSensitivity=16e-6*(i.speedRotate??100),this.keyAssignments=i.keyAssignments.map(f=>{let m=[f[0],f[1]];return m[1]==="\u25B2"?m[1]="ArrowUp":m[1]==="\u25C0"?m[1]="ArrowLeft":m[1]==="\u25BC"?m[1]="ArrowDown":m[1]==="\u25B6"?m[1]="ArrowRight":m[1]==="\u21E7"?m[1]="Shift":m[1]==="\u21B5"?m[1]="Enter":m[1]==="Space"?m[1]=" ":m[1]==="\u2318"?m[1]="Meta":m[1]==="Ctrl"?m[1]="Control":m[1]==="Esc"&&(m[1]="Escape"),m}),i.rotBy==="mouse"){let f;f=this.keyAssignments.findIndex(m=>m[0]==="rotNegX"),f!==-1&&(this.keyAssignments[f][1]=""),f=this.keyAssignments.findIndex(m=>m[0]==="rotPosX"),f!==-1&&(this.keyAssignments[f][1]=""),f=this.keyAssignments.findIndex(m=>m[0]==="rotPosY"),f!==-1&&(this.keyAssignments[f][1]=""),f=this.keyAssignments.findIndex(m=>m[0]==="rotNegY"),f!==-1&&(this.keyAssignments[f][1]="")}this.lerpFactorPosStart=1-.02**(1/(60*(i.delayPos[0]??.3))),this.lerpFactorPosEnd=1-.02**(1/(60*(i.delayPos[1]??.3))),this.lerpFactorPos.setScalar(this.lerpFactorPosStart),this.lerpFactorRotStart=1-.02**(1/(60*(i.delayRot[0]??.3))),this.lerpFactorRotEnd=1-.02**(1/(60*(i.delayRot[1]??.3))),this.lerpFactorPosCamera=1-.02**(1/(60*(i.delayPosCamera??.3))),this.lerpFactorRotCamera=1-.02**(1/(60*(i.delayRotCamera??.3))),this.gravity=12*(this.gloabalPhysics.gravity??Ax.defaultData.gravity),this.usePhysics=this.gloabalPhysics.usePhysics??Ax.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??$L.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*c7/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*c7/this.pixelsPerMeter,this.stepThresh=2*i.collider.radius*.3/this.pixelsPerMeter,this.colliderHeight=2*i.collider.radius):(this.offset=i.collider.height*c7/this.pixelsPerMeter,this.stepThresh=.3*i.collider.height/this.pixelsPerMeter,this.colliderHeight=i.collider.height),this.collider.type=i.collider.type;let d=new R().fromArray(i.collider.position.map(f=>typeof f=="number"?f:0)),c=new jt().setFromEuler(new Dr().fromArray([...i.collider.rotation.map(f=>typeof f=="number"?f:0),"XYZ"]));this.collider.position.copy(d).multiply(this.scale),this.collider.rotation.copy(c),this.collider.matrix.compose(d,c,Yve),i.cameraXAxis!==void 0&&(this.cameraXAxis=i.cameraXAxis,this.cameraYAxis=i.cameraYAxis,this.minPolarAngle=i.cameraRotXLimits[0],this.maxPolarAngle=i.cameraRotXLimits[1],this.minAzimuthAngleRel=i.cameraRotYLimits[0],this.maxAzimuthAngleRel=i.cameraRotYLimits[1]),this.forwardDir=i.forwardDirection??"-z",this.isFirstPerson&&(this.forwardDir="-z"),this.runMultiplier=i.runMultiplier??2;let p=2*i.navmesh.destinationHelperRadius;if(p>0){let f=new Ct;f.push({fi:0,data:{...rs.defaultData("light","phong"),alpha:0},id:"layer1"}),f.push({fi:0,data:{...rs.defaultData("color"),color:i.navmesh.destinationHelperColor,alpha:i.navmesh.destinationHelperColor.a},id:"layer2"});let m=qwe({layers:f},{scene:this.page.scene,shared:this.sharedAssets});this.navMeshPathDest=new Tr(qY.create({parameters:{width:p,height:p/10,hollow:.7}}),m),this.navMeshPathDest.material.userData.opacity0=i.navmesh.destinationHelperColor.a}this.activate()}reset(e=!1){if(this.object.matrixWorldAutoUpdate=!0,this.camera.matrixWorldAutoUpdate=!0,this.object.shearMatrix.copy(this.shearMatrix0),e){this.object.updateMatrix(),this.object.updateMatrixWorld(),this.object.parent instanceof Dn||(this.object.matrixWorldAutoUpdate=!1,this.object.matrix.copy(this.object.matrixWorld)),Af(this.object.matrix,{translation:this.position,quaternion:this.quaternion,scale:this.scale,shearMatrix:this.object.shearMatrix});let t=new Dr().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 Qn?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.shearMatrix.copy(this.cameraShearMatrix0),e?(this.camera.updateMatrix(),this.camera.updateMatrixWorld(),this.camera.parent instanceof Dn||(this.camera.matrixWorldAutoUpdate=!1,this.camera.matrix.copy(this.camera.matrixWorld),Af(this.camera.matrix,{translation:this.camera.position,quaternion:this.camera.quaternion,scale:this.camera.scale,shearMatrix:this.camera.shearMatrix}))):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={},qL.list.forEach(i=>{this.actions[i]=ha({...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"),Ka(this.actions.idle),Ka(this.actions.move),Ka(this.actions.run),Ka(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 ko.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 s=Gp.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),a=this.sharedGameControlGlobals.rapierWorld.castShape(this.colliderWorldPosition.divideScalar(this.pixelsPerMeter),this.colliderWorldQuat,s,this.object.rigidBody?.collider(0).shape,0,1,!1,8,void 0,void 0,this.object.rigidBody);if(a){this.onObject=!0,this.groundNormal.set(a.normal2.x,a.normal2.y,a.normal2.z).applyQuaternion(this.colliderWorldQuat).negate(),this.alignToGround&&this.groundTiltAdjustment(this.groundNormal),Math.acos(this.groundNormal.y)<this.slopeThresh&&(r=!0),a.collider.parent()?.bodyType()===0&&Math.acos(this.groundNormal.y)*(180/Math.PI)>45&&(this.onObject=!1);let o=a.collider.parent(),l=o!==null&&o.isKinematic()?o:null,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(ko).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 s=this.navMeshPathDest.material;if(this.moveMode==="walk"&&this.path.length>1){this.navMeshPathDest.position.copy(this.path[this.path.length-1]),this.navMeshPathDest.parent||this.page.add(this.navMeshPathDest);let a=ko.subVectors(this.path[1],this.position),o=Gp.subVectors(this.path[1],this.path[0]);a.dot(o)<0?this.path.shift():(this.directionXZ.x=o.x,this.directionXZ.z=o.z),s.opacity=s.userData.opacity0}else s.opacity-=.05*s.userData.opacity0,this.navMeshPathDest.material.opacity<=0&&this.navMeshPathDest.parent&&this.page.remove(this.navMeshPathDest)}this.directionXZ.normalize(),this.movementState.run?this.moveForce=this.runMultiplier:this.moveForce=1,this.velocityTarget.z=this.directionXZ.z*this.speedTranslate*this.moveForce,this.velocityTarget.x=this.directionXZ.x*this.speedTranslate*this.moveForce,(this.moveMode==="walk"?this.velocityTarget.x+this.velocityTarget.z===0:this.velocityTarget.manhattanLength()===0)?this.lerpFactorPos.setScalar(this.lerpFactorPosEnd):this.lerpFactorPos.setScalar(this.lerpFactorPosStart),this.moveMode==="walk"&&(this.lerpFactorPos.y=1),this.didHit===!1&&this.pushedVelocity.manhattanLength()===0||this.usePhysics===!1?(this.velocity.x+=(this.velocityTarget.x-this.velocity.x)*(1-(1-this.lerpFactorPos.x)**i),this.velocity.y+=(this.velocityTarget.y-this.velocity.y)*(1-(1-this.lerpFactorPos.y)**i),this.velocity.z+=(this.velocityTarget.z-this.velocity.z)*(1-(1-this.lerpFactorPos.z)**i)):this.velocity.copy(this.velocityTarget),(this.moveMode==="walk"?this.velocity.x**2+this.velocity.z**2<this.speedTranslate:this.velocity.lengthSq()<this.speedTranslate)?(this.dispatchStopEvent("move"),this.dispatchStopEvent("run"),this.onObject&&(this.dispatchStopEvent("jump"),this.dispatchStartEvent("idle"))):(this.dispatchStopEvent("idle"),(this.onObject||this.moveMode==="fly")&&(this.dispatchStopEvent("jump"),this.movementState.run?(this.dispatchStopEvent("move"),this.dispatchStartEvent("run")):(this.dispatchStopEvent("run"),this.dispatchStartEvent("move"))));let n=XVe.copy(this.velocity);if(this.orientMode!=="none"&&this.isFirstPerson===!1){let s=Gp.copy(n);s.y=0,n.set(0,n.y,s.length()*(this.forwardDir==="+z"?1:-1))}if(this.directionXZ.manhattanLength()>0&&this.orientMode!=="none"&&this.isFirstPerson===!1)if(this.orientWith==="camera"&&this.path.length<=1){let s=ko;this.camera.getWorldDirection(s);let a=db.copy(pc).multiplyScalar(s.dot(pc));s.sub(a);let o=Gp.copy(this.directionXZ);o.x*=-1,this.rot.y=s.angleTo(o)*(s.cross(o).y>0?-1:1)+this.rotationAccumWhenOrientWithCamera}else this.rot.y=(this.path.length>1?0:this.euler.y)+Math.atan2(-this.directionXZ.z,this.directionXZ.x)+Math.PI/2*(this.forwardDir==="+z"?1:-1);if(cb.setFromVector3(this.rot),this.moveMode==="walk"&&(cb.x=0),n.applyEuler(cb),r&&(Pv.setFromUnitVectors(pc,this.groundNormal),n.applyQuaternion(Pv)),this.usePhysics===!0&&this.object.rigidBody){this.pushedVelocity.set(0,0,0);let s=0;for(let a of this.sharedGameControlGlobals.entitiesWithTransformAnim){if(a.rigidBody===void 0||a.prevQ===void 0)continue;(a.hasNonUniformScale?a.matrixWorldRigid:a.matrixWorld).decompose(f7,Qve,QVe);let o=this.object.getWorldPosition(JVe).add(this.collider.position).sub(f7);Jve.copy(a.prevQ).invert().premultiply(Qve);let l=db.subVectors(f7,a.prevT).add(e6e.copy(o).applyQuaternion(Jve).sub(o)).divideScalar(t).divideScalar(this.pixelsPerMeter),h=a.rigidBody.collider(0).castCollider(l,this.object.rigidBody.collider(0),ko.copy(n).divideScalar(this.pixelsPerMeter),0,t,!1);l.multiplyScalar(this.pixelsPerMeter);let u=nr.is(a)?a:a.object;if(h!==null&&this.lastHitObj!==u){let d;a instanceof Zo&&(d=a);let c=this.sharedGameControlGlobals.entityToCollisionEvents[u.uuid];if(c)for(let p of c)p.data.target==="character"&&(p.dispatch(d),u.dispatchEvent(gX));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),Zve(s++).copy(h.normal1).applyQuaternion(a.quaternion))}if(s>0){for(let a=0;a<s;a++){let o=Zve(a),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(pc,this.euler.y-this.euler0.y);let s=Gp.copy(this.objectToCamXZ).normalize(),a=db.copy(n).multiplyScalar(t);a.y=0;let o=a.sub(ko.copy(s).multiplyScalar(a.dot(s))).cross(s).y;this.euler.y-=Math.atan2(o,this.objectToCamXZ.length())}}else this.rot.y+=this.rotVelocity.y*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=et.clamp(this.euler.x,-this.maxPolarAngle+this.cameraPolarOffset+1e-6,-this.minPolarAngle+this.cameraPolarOffset-1e-6):this.euler.x=et.clamp(this.euler.x,-this.PI_2+this.cameraPolarOffset,this.PI_2+this.cameraPolarOffset):this.cameraXAxis==="Limit"&&(this.euler.x=et.clamp(this.euler.x,-this.PI_2,this.PI_2))),this.moveMode==="fly"?this.rot.x=this.euler.x:this.isFirstPerson&&(cb.copy(this.euler),cb.y=0,this.nonColliderRotOffset.makeRotationFromEuler(cb)),vh.setFromAxisAngle(KVe,this.rot.x),Pv.setFromAxisAngle(pc,this.rot.y),Pv.multiply(vh),vh.setFromAxisAngle(ZVe,this.rot.z),Pv.multiply(vh),this.quaternion.copy(Pv),this.objectRealQuat.multiplyQuaternions(this.quaternion,this.objXZQuat),this.colliderWorldQuat.copy(this.objectRealQuat).multiply(this.collider.rotation),this.collisionEnabled)if(this.usePhysics&&this.object.rigidBody?.collider(0).shape){let s=Gp.copy(n).multiplyScalar(t/this.pixelsPerMeter),a=null;this.didHit=!1;let o=new R;for(let u=0;u<5;u++){let d=s.length(),c=db.copy(s).normalize();if(a=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),a===null){u===0&&this.directionXZ.manhattanLength()!==0&&(this.lastHitObj=null),o.add(s);break}{this.didHit=!0;let p=this.sharedGameControlGlobals.colliderToEntity.get(a.collider.handle);if(p!==this.lastHitObj&&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(a.collider.handle))._parent;if(p.cloner){for(let x of p.cloner.children)if(x.rigidBody===b){_=x;break}}y.dispatch(_),p.dispatchEvent(gX)}}}let f=qve.set(a.normal2.x,a.normal2.y,a.normal2.z).applyQuaternion(this.colliderWorldQuat),m=$ve.copy(c).multiplyScalar(a.time_of_impact).dot(f),g=a.time_of_impact;if(g===0&&(this.position.y+=this.offset*this.pixelsPerMeter),m>this.offset&&(g=a.time_of_impact*(m-this.offset)/m,o.addScaledVector(c,g)),s.copy(c).multiplyScalar(d-g),Math.acos(-f.y)>this.slopeThresh){let v=this.colliderWorldPosition.divideScalar(this.pixelsPerMeter).add(o),y=db.copy(a.witness2).applyQuaternion(this.colliderWorldQuat);y.y=0;let _=v.add(y);_.y+=this.stepThresh;let b=this.sharedGameControlGlobals.rapierWorld.castShape(_,this.colliderWorldQuat,s,this.object.rigidBody?.collider(0).shape,0,1,!1,12,void 0,void 0,this.object.rigidBody);b!==null&&b.time_of_impact===0&&(f.y=0,f.normalize())}s.addScaledVector(f,-s.dot(f))}}this.position.addScaledVector(o,this.pixelsPerMeter),ko.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&&t6e.copy(ko).sub(l.translation()).lengthSq()>1;l!==void 0&&(h?(l.setTranslation(ko,!0),l.setRotation(vh,!0)):(l.setNextKinematicTranslation(ko),l.setNextKinematicRotation(vh)))}else{let s=this.onObject?1:5,a=n.multiplyScalar(t/s);for(let o=0;o<s;o++)this.position.add(a),this.collisionAdjustment(t/s)}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),_xe(this.position,this.quaternion,this.object.shearMatrix,this.scale,this.object.matrix).multiply(this.nonColliderPosOffset).multiply(this.nonColliderRotOffset),this.object.parent instanceof Dn?this.object.matrixWorld.multiplyMatrices(this.object.parent.matrixWorld,this.object.matrix).multiply(this.object.pivotMatrix):this.object.matrixWorld.copy(this.object.matrix),this.object.children.forEach(s=>{s.updateMatrixWorld(!0)}),this.quaternion.premultiply(this.groundTiltInv).multiply(this.objXZQuatInv),this.cameraFollow===!0){this.updateFollowArms();let s=this.objectToTarget.add(this.position),a=this.targetToCamera.add(s);p7.lookAt(a,s,pc).setPosition(a),p7.decompose(this.targetPos,this.targetQuat,ko),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.matrixWorld.copy(this.camera.matrix),this.cameraYAxis==="Limit"&&this.orientMode==="cartesian"&&(this.euler.y=et.clamp(this.euler.y,this.minAzimuthAngleRel,this.maxAzimuthAngleRel)),this.euler.x=et.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(r6e),!(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(i6e),0))}updateFollowArms(){this.objectToTarget.copy(this.objectToTarget0),this.targetToCamera.copy(this.targetToCamera0);let e,t=vh.setFromAxisAngle(pc,this.cameraYAxis==="Limit"&&this.orientMode!=="radial"?et.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"?et.clamp(this.euler.x,-this.maxPolarAngle+this.cameraPolarOffset+1e-6,-this.minPolarAngle+this.cameraPolarOffset-1e-6):et.clamp(this.euler.x,-this.PI_2+this.cameraPolarOffset+1e-6,this.PI_2+this.cameraPolarOffset-1e-6);let i=ko.copy(this.cameraPolarAxis0);(this.cameraYAxis!=="Locked"||this.orientMode==="radial")&&i.applyQuaternion(t);let r=Pv.setFromAxisAngle(i,e);this.cameraYAxis!=="Locked"&&this.targetToCamera.applyQuaternion(t),this.cameraXAxis!=="Locked"&&this.targetToCamera.applyQuaternion(r)}groundTiltAdjustment(e){180*pc.angleTo(e)/Math.PI<15||180*pc.angleTo(e)/Math.PI>85?vh.identity():vh.setFromUnitVectors(pc,e),this.groundTilt.slerp(vh,.06),this.groundTiltInv.copy(this.groundTilt).invert()}collisionAdjustment(e){let t=$ve.set(0,0,0);this.object.matrix.compose(this.position,this.quaternion,this.scale);let i=p7.multiplyMatrices(this.object.matrix,this.objXZRotMat).multiply(this.collider.matrix).decompose(ko,vh,Gp).compose(ko,vh,Yve);this.sharedGameControlGlobals.entitiesWithTransformAnim.forEach(n=>{if(n===this.object||n.isDescendantOf(this.object)||!n.bvhGeometry||!n.bvhGeometry.boundsTree)return;lu.makeEmpty(),n.updateMatrixWorldRigid();let s=n.matrixWorldRigid,a=Xve.copy(s).invert(),o=YVe.copy(Xve).multiply(i);za.copy(this.collider.segment),za.start.applyMatrix4(o),za.end.applyMatrix4(o);let l=qve.copy(this.position).applyMatrix4(a);lu.expandByPoint(za.start),lu.expandByPoint(za.end),lu.min.addScalar(-this.collider.radius),lu.max.addScalar(this.collider.radius),n.bvhGeometry.boundsTree.shapecast({boundsTraverseOrder:h=>h.distanceToPoint(za.end),intersectsBounds:h=>h.intersectsBox(lu),intersectsTriangle:h=>{let u=ko,d=Gp,c=h.closestPointToSegment(za,u,d);if(c<this.collider.radius){let p=this.collider.radius-c,f=d.sub(u).normalize(),m=db.copy(l);m.addScaledVector(f,p);let g=m.applyMatrix4(s).sub(this.position);t.add(g),za.start.addScaledVector(f,p),za.end.addScaledVector(f,p)}}})}),lu.makeEmpty(),za.copy(this.collider.segment),za.start.applyMatrix4(i),za.end.applyMatrix4(i),lu.expandByPoint(za.start),lu.expandByPoint(za.end),lu.min.addScalar(-this.collider.radius),lu.max.addScalar(this.collider.radius),this.sharedGameControlGlobals.staticMeshBVH?.shapecast({boundsTraverseOrder:n=>n.distanceToPoint(za.end),intersectsBounds:n=>n.intersectsBox(lu),intersectsTriangle:n=>{let s=ko,a=Gp,o=n.closestPointToSegment(za,s,a);if(o<this.collider.radius){let l=this.collider.radius-o,h=a.sub(s).normalize();this.alignToGround&&this.groundTiltAdjustment(h),t.addScaledVector(h,l),za.start.addScaledVector(h,l),za.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()}},F3e=vX;F3e.isLocked=!1,ae(),JA(),zB(),Pw(),Aw();var U3e,z3e,m7,n6e=new Promise(e=>{U3e=e});function s6e(e){return m7||(m7=async function(){let t=e??"https://cdn.spline.design/@splinetool/runtime@2.0.122/build";typeof window<"u"&&(z3e=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())]),s=r.default,a=await s({wasmBinary:n});U3e(a)}(),m7)}jr();var k3e,mr,co,a6e=e=>`
|
|
12931
|
+
`)>=0&&(e-=n),i===3?.5*t-.5*e:i===2?t-e:0}getLineInitialOffsetY(e,t,i,r,n){let s=t*e,a=e-Math.abs(this.ascender-this.descender)*r,o=-this.ascender*r-a/2;return n===3?-(i-s-o):n===2?-(.5*i-.5*s-o):o}createPath(e,t,i,r,n){let s=e.getPath(i,-r,n.fontSize,{kerning:!1,letterSpacing:n.letterSpacing});if(!s)return void console.error('THREE.Font: character "'+e+'" does not exists in font family '+this.familyName+".");let a=new NVe,o=(e.advanceWidth??1)*t;if(e)for(let l of s.commands){let h=a.currentPath?.currentPoint;if(!h||l.type==="Z"||h.x!==l.x||-h.y!==l.y)switch(l.type){case"M":a.moveTo(l.x,-l.y);break;case"L":a.lineTo(l.x,-l.y);break;case"Q":a.quadraticCurveTo(l.x1,-l.y1,l.x,-l.y);break;case"C":a.bezierCurveTo(l.x1,-l.y1,l.x2,-l.y2,l.x,-l.y)}}return a.subPaths.forEach(l=>{let h=function(u){if(u.length){let d=u[0];if(d instanceof Th)return d.v1;if(d instanceof mu||d instanceof pf)return d.v0}}(l.curves);h!==void 0&&l.currentPoint.distanceTo(h)>0&&l.lineTo(h.x,h.y)}),{offsetX:o,path:a}}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),s=e[t];if(s){let a=this.countSpaces(s.trimEnd());if(i.horizontalAlign===4&&t<e.length-1&&a)return((typeof i.width=="string"?Number(r.getVariable(i.width)):i.width)-(this.getTextWidth(s,i)-a*n))/a}return n}countSpaces(e){return(e.match(/ /g)||[]).length}},In("text"),zt();var C3e=null;function zve(){return C3e}function LVe(e){let t=!1;return e.scene.objects.forEach(i=>{i.data.type==="Page"&&!t&&i.data.publish.gameControlObject&&n1.traverseModuleInstances(e,i.id,(r,n,s)=>{for(let a of s)a.data.type==="GameControl"&&a.data.navmesh.enabled&&(t=!0)})}),t}jr();var WN=(e,t)=>{let i=t.x-e.x,r=t.y-e.y;return Math.sqrt(i*i+r*r)},i7=e=>e*(Math.PI/180),HN=new Map,eB=(e,t,i)=>{let r,n=t.split(/[ ,]+/g);for(let s=0;s<n.length;s+=1)r=n[s],e.addEventListener?e.addEventListener(r,i,!1):e.attachEvent&&e.attachEvent(r,i)},tB=(e,t,i)=>{let r,n=t.split(/[ ,]+/g);for(let s=0;s<n.length;s+=1)r=n[s],e.removeEventListener?e.removeEventListener(r,i):e.detachEvent&&e.detachEvent(r,i)},P3e=e=>(e.preventDefault(),e.type.match(/^touch/)?e.changedTouches:e),kve=()=>{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}},r7=(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")},n7=(e,t,i)=>{let r=R3e(e);for(let n in r)if(Object.prototype.hasOwnProperty.call(r,n))if(typeof t=="string")r[n]=t+" "+i;else{let s="";for(let a=0,o=t.length;a<o;a+=1)s+=t[a]+" "+i+", ";r[n]=s.slice(0,-2)}return r},R3e=e=>{let t={};return t[e]="",["webkit","Moz","o"].forEach(function(i){t[i+e.charAt(0).toUpperCase()+e.slice(1)]=""}),t},s7=(e,t)=>{for(let i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},mX=(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"&&(D3e="ontouchstart"in window,N3e=!!window.PointerEvent,I3e=!!window.MSPointerEvent);var D3e,N3e,I3e,hb,Vve={start:"mousedown",move:"mousemove",end:"mouseup"},sM={};function qv(){}N3e?hb={start:"pointerdown",move:"pointermove",end:"pointerup, pointercancel"}:I3e?hb={start:"MSPointerDown",move:"MSPointerMove",end:"MSPointerUp"}:D3e?(hb={start:"touchstart",move:"touchmove",end:"touchend, touchcancel"},sM=Vve):hb=Vve,qv.prototype.on=function(e,t){var i,r=this,n=e.split(/[ ,]+/g);r._handlers_=r._handlers_||{};for(var s=0;s<n.length;s+=1)i=n[s],r._handlers_[i]=r._handlers_[i]||[],r._handlers_[i].push(t);return r},qv.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},qv.prototype.trigger=function(e,t){var i,r=this,n=e.split(/[ ,]+/g);r._handlers_=r._handlers_||{};for(var s=0;s<n.length;s+=1)i=n[s],r._handlers_[i]&&r._handlers_[i].length&&r._handlers_[i].forEach(function(a){a.call(r,{type:i,target:r},t)})},qv.prototype.config=function(e){var t=this;t.options=t.defaults||{},e&&(t.options=((i,r)=>{let n={};for(let s in i)Object.prototype.hasOwnProperty.call(i,s)&&Object.prototype.hasOwnProperty.call(r,s)?n[s]=r[s]:Object.prototype.hasOwnProperty.call(i,s)&&(n[s]=i[s]);return n})(t.options,e))},qv.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.')},eB(e,hb[t],i._domHandlers_[t]),sM[t]&&eB(e,sM[t],i._domHandlers_[t]),i},qv.prototype.unbindEvt=function(e,t){var i=this;return i._domHandlers_=i._domHandlers_||{},tB(e,hb[t],i._domHandlers_[t]),sM[t]&&tB(e,sM[t],i._domHandlers_[t]),delete i._domHandlers_[t],this};var AZ=qv;function ba(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=ba.id,ba.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}ba.prototype=new AZ,ba.constructor=ba,ba.id=0,ba.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},ba.prototype.stylize=function(){if(this.options.dataOnly)return this;var e=this.options.fadeTime+"ms",t=(()=>{let n=R3e("borderRadius");for(let s in n)Object.prototype.hasOwnProperty.call(n,s)&&(n[s]="50%");return n})(),i=n7("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)"},s7(r.el,i),this.options.shape==="circle"&&s7(r.back,t),s7(r.front,t),this.applyStyles(r),this},ba.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},ba.prototype.addToDom=function(){return this.options.dataOnly||document.body.contains(this.ui.el)||this.options.zone.appendChild(this.ui.el),this},ba.prototype.removeFromDom=function(){return this.options.dataOnly||!document.body.contains(this.ui.el)||this.options.zone.removeChild(this.ui.el),this},ba.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},ba.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},ba.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},ba.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=n7("transition",["top","left"],r);var s={front:{}};s.front={left:i.frontPosition.x+"px",top:i.frontPosition.y+"px"},i.applyStyles(n),i.applyStyles(s),i.restTimeout=setTimeout(function(){typeof e=="function"&&e.call(i),i.restCallback()},i.options.fadeTime)},ba.prototype.restCallback=function(){var e=this,t={};t.front=n7("transition","none",""),e.applyStyles(t),e.trigger("rested",e.instance)},ba.prototype.resetDirection=function(){this.direction={x:!1,y:!1,angle:!1}},ba.prototype.computeDirection=function(e){var t,i,r,n=e.angle.radian,s=Math.PI/4,a=Math.PI/2;if(n>s&&n<3*s&&!e.lockX?t="up":n>-s&&n<=s&&!e.lockY?t="left":n>3*-s&&n<=-s&&!e.lockX?t="down":e.lockY||(t="right"),e.lockY||(i=n>-a&&n<a?"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 BVe=ba;function Xs(e,t){var i=this;i.nipples=[],i.idles=[],i.actives=[],i.ids=[],i.pressureIntervals={},i.manager=e,i.id=Xs.id,Xs.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}Xs.prototype=new AZ,Xs.constructor=Xs,Xs.id=0,Xs.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}},Xs.prototype.bindings=function(){var e=this;e.bindEvt(e.options.zone,"start"),e.options.zone.style.touchAction="none",e.options.zone.style.msTouchAction="none"},Xs.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)}},Xs.prototype.createNipple=function(e,t){var i=this,r=i.manager.scroll,n={},s=i.options,a=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-a,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",s.zone.appendChild(l);var h=l.getBoundingClientRect();s.zone.removeChild(l),n=e,e={x:h.left+r.x,y:h.top+r.y}}var u=new BVe(i,{color:s.color,size:s.size,threshold:s.threshold,fadeTime:s.fadeTime,dataOnly:s.dataOnly,restJoystick:s.restJoystick,restOpacity:s.restOpacity,mode:s.mode,identifier:t,position:e,zone:s.zone,frontPosition:{x:0,y:0},shape:s.shape});return s.dataOnly||(r7(u.ui.el,n),r7(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},Xs.prototype.updateBox=function(){this.box=this.options.zone.getBoundingClientRect()},Xs.prototype.bindNipple=function(e){var t,i=this,r=function(n,s){t=n.type+" "+s.id+":"+n.type,i.trigger(t,s)};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)},Xs.prototype.pressureFn=function(e,t,i){var r=this,n=0;clearInterval(r.pressureIntervals[i]),r.pressureIntervals[i]=setInterval(function(){var s=e.force||e.pressure||e.webkitForce||0;s!==n&&(t.trigger("pressure",s),r.trigger("pressure "+t.identifier+":pressure",s),n=s)}.bind(r),100)},Xs.prototype.onstart=function(e){var t=this,i=t.options,r=e;return e=P3e(e),t.updateBox(),mX(e,function(n){t.actives.length<i.maxNumberOfNipples?t.processOnStart(n):r.type.match(/^touch/)&&(Object.keys(t.manager.ids).forEach(function(s){if(Object.values(r.touches).findIndex(function(o){return o.identifier===s})<0){var a=[e[0]];a.identifier=s,t.processOnEnd(a)}}),t.actives.length<i.maxNumberOfNipples&&t.processOnStart(n))}),t.manager.bindDocument(),!1},Xs.prototype.processOnStart=function(e){var t,i=this,r=i.options,n=i.manager.getIdentifier(e),s=e.force||e.pressure||e.webkitForce||0,a={x:e.pageX,y:e.pageY},o=i.getOrCreate(n,a);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(),s>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(!(WN(a,o.position)<=r.catchDistance))return o.destroy(),void i.processOnStart(e);l(o)}return o},Xs.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)},Xs.prototype.processOnMove=function(e){var t=this,i=t.options,r=t.manager.getIdentifier(e),n=t.nipples.get(r),s=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 a=n.el.getBoundingClientRect();n.position={x:s.x+a.left,y:s.y+a.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=WN(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=i7(c),f=d/o,m={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=i7(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=WN(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+s.y)+"px",n.el.style.left=n.position.x-(t.box.left+s.x)+"px",d=WN(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||r7(n.ui.front,n.frontPosition);var y={identifier:n.identifier,position:l,force:f,pressure:e.force||e.pressure||e.webkitForce||0,distance:d,angle:{radian:p,degree:c},vector:{x:g/o,y:-v/o},raw:m,instance:n,lockX:i.lockX,lockY:i.lockY};(y=n.computeDirection(y)).angle={radian:i7(180-c),degree:180-c},n.trigger("move",y),t.trigger("move "+n.id+":move",y)}else this.processOnEnd(e)},Xs.prototype.processOnEnd=function(e){var t=this,i=t.options,r=t.manager.getIdentifier(e),n=t.nipples.get(r),s=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[s.id]=s.identifier))},Xs.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()},Xs.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 FVe=Xs;function ra(e){var t=this;t.ids={},t.index=0,t.collections=[],t.scroll=kve(),t._windowBound=!1,t.config(e),t.prepareCollections();var i=function(){var r;t.collections.forEach(function(n){n.forEach(function(s){r=s.el.getBoundingClientRect(),s.position={x:t.scroll.x+r.left,y:t.scroll.y+r.top}})})};return t._onResize=function(){(r=>{HN.has(r)&&clearTimeout(HN.get(r)),HN.set(r,setTimeout(function(){HN.delete(r),r()},100))})(i)},t._onScroll=function(){t.scroll=kve()},t.collections}ra.prototype=new AZ,ra.constructor=ra,ra.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}},ra.prototype.create=function(e){return this.createCollection(e)},ra.prototype.bindWindowEvents=function(){var e=this;e._windowBound||typeof window>"u"||(e._windowBound=!0,eB(window,"resize",e._onResize),eB(window,"scroll",e._onScroll))},ra.prototype.unbindWindowEvents=function(){var e=this;!e._windowBound||typeof window>"u"||(e._windowBound=!1,tB(window,"resize",e._onResize),tB(window,"scroll",e._onScroll))},ra.prototype.createCollection=function(e){var t=this,i=new FVe(t,e);return t.bindCollection(i),t.collections.push(i),t.bindWindowEvents(),i},ra.prototype.bindCollection=function(e){var t,i=this,r=function(n,s){t=n.type+" "+s.id+":"+n.type,i.trigger(t,s)};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)},ra.prototype.bindDocument=function(){var e=this;e.binded||(e.bindEvt(document,"move").bindEvt(document,"end"),e.binded=!0)},ra.prototype.unbindDocument=function(e){var t=this;(!Object.keys(t.ids).length||e===!0)&&(t.unbindEvt(document,"move").unbindEvt(document,"end"),t.binded=!1)},ra.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]},ra.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},ra.prototype.onmove=function(e){return this.onAny("move",e),!1},ra.prototype.onend=function(e){return this.onAny("end",e),!1},ra.prototype.oncancel=function(e){return this.onAny("end",e),!1},ra.prototype.onAny=function(e,t){var i,r=this,n="processOn"+e.charAt(0).toUpperCase()+e.slice(1);t=P3e(t);var s=function(a,o,l){l.ids.indexOf(o)>=0&&(l[n](a),a._found_=!0)};return mX(t,function(a){i=r.getIdentifier(a),mX(r.collections,s.bind(null,a,i)),a._found_||r.removeIdentifier(i)}),!1},ra.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()},ra.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 UVe=ra,Hx=null;function Gve(){return Hx||(Hx=new UVe),Hx}var zVe={create:function(e){return Gve().create(e)},destroy:function(){Hx&&(Hx.destroy(),Hx=null)},get factory(){return Gve()}},kVe=zVe;jr(),zt(),ae(),Oh(),Mw(),Tu(),wl(),zt();var O3e=null;function a7(){return O3e}var L3e,o7,VVe=new Promise(e=>{L3e=e});function GVe(e){return o7||(o7=async function(){let t=e??"https://cdn.spline.design/@splinetool/runtime@2.0.123/build",i=import("./physics.js"),[r,n]=await Promise.all([i,fetch(`${t}/physics.wasm`).then(s=>s.arrayBuffer())]);await r.init(n),L3e(r)}(),o7)}function B3e(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,s=t[0]**2+t[4]**2+t[8]**2,a=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||s<l||a<l||o<l}function uf(e,t){let i=new At;if(t&&B3e(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}=tK(e.getAttribute("position"),e.getIndex());return i.setAttribute("position",new Et(r,3)),i.setIndex(n),t&&i.applyMatrix4(t),i}Zn(),wl(),_r(),_K(),ae(),ae(),Aw(),JA();var Er,jVe=class{constructor(e,t,i,r,n,s){this.id=e,this.data=t,this.object=i,this.initialDisabled=!1,this.actions=ha(t,t.actions,r,n,s,i),this.target=t.target}disconnect(){Ka(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.play()),this.actions.Animation.forEach(t=>{"runMode"in t.data&&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()))}},jve=class{constructor(e,t,i,r,n,s){this.id=e,this.data=t,this.object=i,this.page=r,this.currentIntersectedObjects=[],this.actions=ha(t,t.actions,r,n,s,i),this.target=t.target,this.triggeringObjects=[];for(let a of t.triggeringObjects){let o=r.scene.findFrom(a,i);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(){Ka(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.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()))}};Zn(),QA(),yB(),VVe.then(e=>Er=e);var ia=new R,ou=new jt,l7=new R,WVe=new R(1,1,1),h7=(new Dr(0,0,0,"YXZ"),new Dr(0,0,0,"XYZ")),Vp=new R,Wve=new R,aM=new jt,qN=new Ue,Hve=new Ue,HVe={type:"updateMatrix"},u7=(new jt,new Ha),d7=.01,gX={type:"beginEvent",eventName:"Collision"},qVe={type:"beginEvent",eventName:"Trigger"},iB=e=>e.states.some(t=>t.data.position!==void 0||t.data.rotation!==void 0||t.data.shear!==void 0||t.data.cloner!==void 0||t.data.pathSnapping!==void 0);function ub(e){return function(t){return typeof t=="object"&&t!==null&&"booleanOp"in t}(Bg(e)?e.object:e)}var $Ve=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()!==Er.RigidBodyType.Dynamic)return;t.isSleeping()||this.nActiveRigidBodies++;let[i,r]=this.rigidBodyToMesh.get(t.handle);if(ia.copy(t.translation()).multiplyScalar(this.pixelsPerMeter),ou.copy(t.rotation()),i.matrixWorld.makeRotationFromQuaternion(ou).setPosition(ia),i.matrixWorld.multiply(i.shearScale),i.dispatchEvent(HVe),r){let n=i.cloner;if(n&&n.objectForSample===void 0){n.matrixWorld.copy(i.matrixWorld);for(let s of n.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,s;if(this.sensorToTriggerEvent[t]?(n=this.sensorToTriggerEvent[t],s=this.sharedGameControlGlobals.colliderToEntity.get(i)):this.sensorToTriggerEvent[i]&&(n=this.sensorToTriggerEvent[i],s=this.sharedGameControlGlobals.colliderToEntity.get(t)),n&&s&&n.isValidTriggeringObject(s))n.dispatch();else{for(let a=this.sharedGameControlGlobals.createdObjects.length-1;a>=0;a--){let o=this.sharedGameControlGlobals.createdObjects[a];if(o.userData.hasCollisionDestroy&&(o.rigidBody?.collider(0).handle===t||o.rigidBody?.collider(0).handle===i)){this.sharedGameControlGlobals.createdObjects.splice(a,1),o.removeFromParent();let l=o.rigidBody;requestAnimationFrame(()=>{o.rigidBody===l&&(this.sharedGameControlGlobals.rapierWorld?.removeRigidBody(l),o.rigidBody=void 0)});break}}if(this.gameControl?.object!==void 0&&this.gameControl.object===this.sharedGameControlGlobals.colliderToEntity.get(t)){let a=this.sharedGameControlGlobals.colliderToEntity.get(i),o=this.sharedGameControlGlobals.entityToCollisionEvents[a.uuid];if(o===void 0)return;for(let l of o)l.data.target==="character"&&this.dispatchCollisionEvent(l,a,i)}else if(this.gameControl?.object!==void 0&&this.gameControl.object===this.sharedGameControlGlobals.colliderToEntity.get(i)){let a=this.sharedGameControlGlobals.colliderToEntity.get(t),o=this.sharedGameControlGlobals.entityToCollisionEvents[a.uuid];if(o===void 0)return;for(let l of o)l.data.target==="character"&&this.dispatchCollisionEvent(l,a,t)}else{let a=this.sharedGameControlGlobals.colliderToEntity.get(t),o=this.sharedGameControlGlobals.entityToCollisionEvents[a.uuid];if(o!==void 0)for(let u of o)u.data.target==="scene"&&this.dispatchCollisionEvent(u,a,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 s=this.page.scene.find(n);s&&(s.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(a7()===null)return void Ta("collision-bvh","trigger/collision detection");let e=[],t=[];if(this.page.traverseChildren(i=>{let r,n=i instanceof Ix,s=BE(i);if(Lg(i)||n||s)return;r=Bg(i)?i.object:i;let a=r.dataPatched;if(a.physics?.enabled==="visibility"?!a.visible:!a.physics?.enabled)return!0;let o=i.geometry,l=r.userData.hasDestroy===!0,h=r.userData.hasDrag===!0;if(iB(a)||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!!ub(i)||void 0}),e.length>0){let i=this._staticBVHCache;if(i!==void 0&&i.signature.length===t.length&&i.signature.every((s,a)=>s===t[a]))return void(this.sharedGameControlGlobals.staticMeshBVH=i.bvh);let r=sy(e.map(s=>uf(s.geometry,s.matrixWorld)),!1),n=new(a7())(r);this._staticBVHCache={signature:t,bvh:n},this.sharedGameControlGlobals.staticMeshBVH=n}}addRigidBody(e,t,i){if(B3e(e.matrixWorld))return;let r=[],n="geometry"in e?e.geometry:void 0,s=t.dataPatched;if(n?.getAttribute("position")!==void 0&&r.push(uf(n,e.shearScale)),s.physics.fusedBody){let a=this.gatherChildrenGeom(e,r);e.traverseObject(a),e.children.forEach(l=>l.updateMatrixWorld(!0));let o=e.cloner;o&&o.objectForSample===void 0&&s.physics.rigidBody==="dynamic"&&(o.traverseObject(a),o.children.forEach(l=>l.updateMatrixWorld(!0)))}if(r.length>0){let a,o=!1,l=!i.fromCreate&&s.physics.rigidBody==="dynamic"||i.fromCreate&&i.dynamic;l?(a=Er.RigidBodyDesc.dynamic(),a.setLinearDamping(s.physics.damping).setAngularDamping(s.physics.damping).setAdditionalMass(1e-9).setGravityScale(s.physics.gravityScale).enabledRotations(...s.physics.enabledRotation).enabledTranslations(...s.physics.enabledTranslation)):(i.hasTransformAnim||i.hasFollow||i.hasDrag)&&!i.fromCreate?(a=Er.RigidBodyDesc.kinematicPositionBased(),o=!0):a=Er.RigidBodyDesc.fixed();let h=sy(r);ia.setFromMatrixPosition(e.matrixWorld),ou.setFromRotationMatrix(e.matrixWorldRigid),e.position0=ia.clone().divideScalar(this.pixelsPerMeter),e.rotation0=ou.clone(),ia.divideScalar(this.pixelsPerMeter),a.setTranslation(ia.x,ia.y,ia.z).setRotation(ou),h?.scale(1/this.pixelsPerMeter,1/this.pixelsPerMeter,1/this.pixelsPerMeter);let u=this.sharedGameControlGlobals.rapierWorld.createRigidBody(a),d=!(s.geometry===void 0||s.geometry.type==="SubdivGeometry"||s.geometry.type==="NonParametricGeometry"||s.geometry.type==="BooleanGeometry"||s.geometry.type==="VectorGeometry"||s.geometry.type==="StarGeometry"||s.geometry.type==="RectangleGeometry"||s.geometry.type==="EllipseGeometry"||s.geometry.type==="TriangleGeometry"||s.geometry.type==="TorusGeometry"||s.geometry.type==="HelixGeometry");try{this.addCollider(u,s.physics,h,t,d)}catch{try{this.addCollider(u,s.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,s.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(uf(e.geometry,e.shearScale)),e.traverseObject(this.gatherChildrenGeom(e,t)),e.children.forEach(i=>i.updateMatrixWorld(!0)),t.length>0){let i=sy(t,!1);e.bvhGeometry=i,i.getAttribute("position").count>0&&(e.bvhGeometry.boundsTree=new(a7())(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 s;i&&(s=t.colliderType==="trimesh"?Er.ColliderDesc.trimesh(i.getAttribute("position").array,i.getIndex().array):Er.ColliderDesc.convexMesh(i.getAttribute("position").array,n?i.getIndex().array:void 0)),s.setFrictionCombineRule(Er.CoefficientCombineRule.Average).setRestitutionCombineRule(Er.CoefficientCombineRule.Average).setDensity(t.density).setFriction(t.friction).setRestitution(t.restitution);let a=this.sharedGameControlGlobals.rapierWorld.createCollider(s,e);this.sharedGameControlGlobals.colliderToEntity.set(a.handle,r),this.sharedGameControlGlobals.entityToCollisionEvents[r.uuid]?.some(o=>o.target==="scene")&&a.setActiveEvents(Er.ActiveEvents.COLLISION_EVENTS)}gatherChildrenGeom(e,t){let i=ub(e);return(r,n)=>{if(n===0)return;if(i&&r.parent===e)return!0;let s;if(Lg(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;s=r.object}else if(Bg(r))s=r.object;else if(s=r,s.dataPatched.cloner?.hideBase)return!0;let a=s.dataPatched;if(a.physics.enabled==="visibility"?!a.visible:!a.physics.enabled)return!0;n===1?r.matrixWorld.copy(e.shearScale):r.matrixWorld.copy(r.parent.matrixWorld),r.matrixWorld.multiply(r.matrix);let o=r.geometry;return o?.getAttribute("position")!==void 0&&t.push(uf(o,r.matrixWorld)),!!ub(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(a=>{for(let o of a.dataPatched.events)if(o.data.disabled===!1&&o.data.type==="Trigger")return this.needsCollisionDetection=!0,!0});let r=zve();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&&Ta("game-controls","the scene's game controls"),i===!1){let{enableRotate:a,enablePan:o,enableZoom:l,autoRotate:h,hoverRotatePanMode:u}=this.eventManager.publish.orbitControls;(a||o||l||h||u!==0)&&(this.orbitControls=new p3e(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(),s=this.renderer.domElement.height/this.renderer.getPixelRatio();zve()?.createJoysticks(this,n,s),this.markIsDestroyTarget(),this.markIsDragObject(),this.rebuildBVH(),this.initializationCounter++,window.setTimeout(()=>{this.collisionEvents.forEach(a=>a.initialDisabled=!1)},80)}initPhysics(){this.sharedGameControlGlobals.rapierWorld?.free(),this.sharedGameControlGlobals.rapierWorld=new Er.World(new Er.Vector3(0,this.gravity,0)),this.events=new Er.EventQueue(!0);let e=[],t=[];if(this.page.traverseChildren(a=>{let o;if(Lg(a)){if(!a.objectForSample)return a.object.dataPatched.physics.fusedBody===!0&&a.object.dataPatched.physics.rigidBody==="dynamic"||void 0;if(a.objectForSample.dataPatched.physics.fusedBody)return;o=a.object}else if(Bg(a))o=a.object;else{if(BE(a)||s1(a)||a instanceof Ix)return;if(o=a,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;a.updateMatrixWorldRigid();let u=iB(h),d=!1,c=o.userData.hasDestroy,p=o.userData.hasDrag,f=!1;for(let g of h.events)if(g.data.disabled!==!0){if(g.data.type==="Collision"){d=!0;let v=new jVe(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"){f=!0;let v=g.data.target;a.traverseVisible(y=>{y.userData.isFollowingObj=v})}}h.physics.rigidBody==="dynamic"&&h.physics.fusedBody===!1&&(a.matrixWorldFusedFalse=a.matrixWorld.clone());let m=a.geometry;if(l!==void 0){let g=Er.RigidBodyDesc.kinematicPositionBased();(a.hasNonUniformScale?a.matrixWorldRigid:a.matrixWorld).decompose(ia,ou,l7),a.position0=ia.clone().divideScalar(this.pixelsPerMeter),a.rotation0=ou.clone(),ia.divideScalar(this.pixelsPerMeter),g.setTranslation(ia.x,ia.y,ia.z).setRotation(ou);let v,y=this.sharedGameControlGlobals.rapierWorld.createRigidBody(g);a.rigidBody=y,v=l.collider.type==="sphere"?Er.ColliderDesc.ball(l.collider.radius/this.pixelsPerMeter):l.collider.type==="capsule"?Er.ColliderDesc.capsule((l.collider.height/2-l.collider.radius)/this.pixelsPerMeter,l.collider.radius/this.pixelsPerMeter):Er.ColliderDesc.cuboid(l.collider.width/this.pixelsPerMeter/2,l.collider.height/this.pixelsPerMeter/2,l.collider.depth/this.pixelsPerMeter/2),v.setFrictionCombineRule(Er.CoefficientCombineRule.Average).setDensity(h.physics.density).setFriction(h.physics.friction).setRestitution(0).setRestitutionCombineRule(Er.CoefficientCombineRule.Min);let _=this.sharedGameControlGlobals.rapierWorld.createCollider(v,y);this.sharedGameControlGlobals.colliderToEntity.set(_.handle,o),ia.fromArray(l.collider.position.map(x=>typeof x=="number"?x:0)).multiply(l7.setFromMatrixScale(o.matrixWorld)).divideScalar(this.pixelsPerMeter),_.setTranslationWrtParent(ia);let b=new jt().setFromEuler(new Dr().setFromVector3(new R().fromArray(l.collider.rotation.map(x=>typeof x=="number"?x:0))));_.setRotationWrtParent(b),_.setActiveEvents(Er.ActiveEvents.COLLISION_EVENTS),this.generateSensorColliderDescs(o,!0)}else h.physics.rigidBody==="dynamic"||u||f||c||p||d?(this.addRigidBody(a,o,{hasFollow:f,hasTransformAnim:u,hasDrag:p}),this.generateSensorColliderDescs(o,h.physics.fusedBody)):(m&&e.push(uf(m,a.matrixWorld)),h.physics.fusedBody&&!ub(a)&&a.traverseObject((g,v)=>{if(v===0)return;let y;if(Lg(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(BE(g)||s1(g)||g instanceof Ix)return;if(Bg(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(uf(b,g.matrixWorld)),!!ub(g)||void 0}),this.generateSensorColliderDescs(o,h.physics.fusedBody,t));return!(h.physics?.fusedBody!==!0&&!l&&!ub(a))||void 0}),e.length===0)return;let i=sy(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=Er.RigidBodyDesc.fixed(),s=this.sharedGameControlGlobals.rapierWorld.createRigidBody(n);if(r){let a=Er.ColliderDesc.trimesh(i.getAttribute("position").array,i.getIndex().array).setFrictionCombineRule(Er.CoefficientCombineRule.Multiply).setRestitutionCombineRule(Er.CoefficientCombineRule.Multiply).setFriction(1).setRestitution(1);this.sharedGameControlGlobals.rapierWorld.createCollider(a,s)}for(let[a,o]of t){let l=this.sharedGameControlGlobals.rapierWorld.createCollider(a,s);this.sensorToTriggerEvent[l.handle]=o}}updatePositions(){return this.nActiveRigidBodies=0,this.sharedGameControlGlobals.rapierWorld.forEachRigidBody(this.processRigidBody),this.nActiveRigidBodies>0}rebuildBVH(){this.usePhysics?this.initPhysics():(this.page.traverseEntity(e=>{for(let t of e.dataPatched.events)if(t.data.type==="Trigger"&&t.data.disabled!==!0){let i=new jve(t.id,t.data,e,this.page,this.sharedAssets,this.eventManager),r=new Ue().compose(Vp.fromArray(t.data.position.map(n=>typeof n=="number"?n:0)),aM.setFromEuler(h7.fromArray(t.data.rotation.map(n=>typeof n=="number"?n:0))),WVe);if(t.data.triggerZone==="box"){let n=new pn;n.min.fromArray(t.data.size.map(s=>typeof s=="number"?s:0)).multiplyScalar(-.5),n.max.fromArray(t.data.size.map(s=>typeof s=="number"?s: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(),s=0,a=6;for(;this.accumulator>=i&&s<a&&(t=this.stepPhysics()&&t,this.accumulator-=i,s++,!(performance.now()-n>1e3*i)););this.accumulator=this.accumulator%i}}this.skipRender=t}recordPhysicsPose(e){(e.hasNonUniformScale?e.matrixWorldRigid:e.matrixWorld).decompose(ia,ou,l7);let t=e;t.prevQ===void 0?(t.prevQ=ou.clone(),t.prevT=ia.clone()):(t.prevQ.copy(ou),t.prevT.copy(ia))}promoteMovedFixedBodies(){for(let e=this.fixedBodiesToWatch.length-1;e>=0;e--){let[t,i,r]=this.fixedBodiesToWatch[e];t.rigidBody===i?(t.hasNonUniformScale?t.matrixWorldRigid:t.matrixWorld).equals(r)||(i.setBodyType(Er.RigidBodyType.KinematicPositionBased,!0),this.sharedGameControlGlobals.kinematicBodyToEntity.set(i.handle,t),this.sharedGameControlGlobals.entitiesWithTransformAnim.push(t),this.fixedBodiesToWatch.splice(e,1)):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 s=0;s<e.numColliders();s++){let a=e.collider(s);t.contactPairsWith(a,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(a,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<-d7)return;let f=l.linvel();if(n>d7&&p>d7){let v=f.x*d+f.z*c;if(v<=0)return;let y=Math.min(v,p);return void l.setLinvel({x:d*y,y:f.y,z:c*y},!0)}let m=f.x*d+f.z*c-Math.max(0,p);if(m<=0)return;let g=.5*m;l.setLinvel({x:f.x-d*g,y:f.y,z:f.z-c*g},!0)})}}stepPhysics(){this.promoteMovedFixedBodies();let e=this.sharedGameControlGlobals.kinematicBodyToEntity;for(let[t,i]of e)i.rigidBody!==void 0?(this.recordPhysicsPose(i),i.rigidBody.setNextKinematicTranslation(ia.divideScalar(this.pixelsPerMeter)),i.rigidBody.setNextKinematicRotation(ou)):e.delete(t);for(let t of this.sharedGameControlGlobals.entitiesWithTransformAnim)t.rigidBody?.isKinematic()!==!0&&this.recordPhysicsPose(t);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 s of t.cloner.children)if(s.rigidBody===n){r=s;break}}e.dispatch(r),t.dispatchEvent(gX)}updateUseWindowEvents(e){this.orbitControls?.updateUseWindowEvents(e)}generateSensorColliderDescs(e,t,i){let r=Hve.copy(e.matrixWorld).invert();e.traverseEntity((n,s)=>{if(t===!1&&s===1)return!0;for(let a of n.dataPatched.events)if(a.data.type==="Trigger"&&a.data.disabled!==!0){let o,l=new jve(a.id,a.data,n,this.page,this.sharedAssets,this.eventManager);if(o=a.data.triggerZone==="box"?Er.ColliderDesc.cuboid(...a.data.size.map(h=>(typeof h=="number"?h:1)/(2*this.pixelsPerMeter))):Er.ColliderDesc.ball(a.data.radius/this.pixelsPerMeter),o.setDensity(0).setSensor(!0).setActiveEvents(Er.ActiveEvents.COLLISION_EVENTS),Vp.fromArray(a.data.position.map(h=>typeof h=="number"?h:0)),aM.setFromEuler(h7.fromArray(a.data.rotation.map(h=>typeof h=="number"?h:0))),qN.makeRotationFromEuler(h7).setPosition(Vp).premultiply(n.matrixWorld),i?(Af(qN,{translation:Vp,quaternion:aM,scale:Wve}),o.setActiveCollisionTypes(Er.ActiveCollisionTypes.KINEMATIC_FIXED|Er.ActiveCollisionTypes.DYNAMIC_FIXED)):(Af(qN.premultiply(r),{translation:Vp,quaternion:aM,scale:Wve}),e.rigidBody.bodyType()===Er.RigidBodyType.Dynamic||(e.rigidBody.bodyType()===Er.RigidBodyType.Fixed?o.setActiveCollisionTypes(Er.ActiveCollisionTypes.KINEMATIC_FIXED|Er.ActiveCollisionTypes.DYNAMIC_FIXED):o.setActiveCollisionTypes(Er.ActiveCollisionTypes.KINEMATIC_KINEMATIC|Er.ActiveCollisionTypes.DYNAMIC_KINEMATIC))),Vp.divideScalar(this.pixelsPerMeter),o.setTranslation(Vp.x,Vp.y,Vp.z),o.setRotation(aM),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,s]=this.sharedGameControlGlobals.triggers[t];for(let a=0;a<this.sharedGameControlGlobals.entitiesWithTransformAnim.length;a++){let o=this.sharedGameControlGlobals.entitiesWithTransformAnim[a];if(n===o||s.isValidTriggeringObject(nr.is(o)?o:o.object)===!1)continue;let l=Hve.copy(Nbe(n.matrixWorld)).copyPosition(n.matrixWorld).multiply(r),h=qN.copy(o.matrixWorld).invert().multiply(l),u=o.bvhGeometry.boundsTree;i instanceof pn?e=u.intersectsBox(i,h):(u7.radius=i,u7.center.setFromMatrixPosition(h),e=u.intersectsSphere(u7)),e?s.currentIntersectedObjects.indexOf(o)===-1&&(s.currentIntersectedObjects.push(o),s.dispatch(),n.dispatchEvent(qVe)):s.currentIntersectedObjects=s.currentIntersectedObjects.filter(d=>d!==o)}}}};Pw(),ae(),JL(),Or(),QA(),em();var c7=.02,qve=new R,$ve=new R,XVe=new R,ko=new R,Gp=new R,db=new R,p7=new Ue,Xve=new Ue,YVe=new Ue,vh=new jt,Pv=new jt,cb=new Dr(0,0,0,"YXZ"),KVe=new R(1,0,0),pc=new R(0,1,0),ZVe=new R(0,0,1),Yve=new R(1,1,1),Kve=[],Zve=e=>Kve[e]??(Kve[e]=new R),f7=new R,QVe=new R,JVe=new R,e6e=new R,Qve=new jt,t6e=new R,Jve=new jt,za=new Ch,lu=new pn,i6e={type:"requestRender"},r6e={type:"updateMatrix"},vX=class extends cs{constructor(e,t,i,r,n,s,a,o,l){super(),this.object=e,this.domElement=t,this.data=i,this.gloabalPhysics=r,this.controlsManager=n,this.cameraFollow=s,this.camera=a,this.page=o,this.sharedAssets=l,this.enableDamping=!0,this.target0=new R,this.zoom0=1,this.rotForce=1,this.moveForce=1,this.pixelsPerMeter=200,this.euler0=new Dr(0,0,0,"YXZ"),this.shearMatrix0=new Ue,this.cameraShearMatrix0=new Ue,this.position0Cam=new R,this.quat0Cam=new jt,this.scale0Cam=new R,this.threshEndTranslate=.01,this.threshEndRotate=1e-8,this.threshEndRotVel=.005,this.collider={type:"capsule",radius:40,segment:new Ch(new R(0,-40,0),new R(0,40,0)),matrix:new Ue,position:new R,rotation:new jt},this.euler=new Dr(0,0,0,"YXZ"),this.eulerDelta=new R,this.lastPosition=new R,this.lastCameraQuaternion=new jt,this.lastCameraPosition=new R,this.PI_2=Math.PI/2,this.prevMouse=new Z,this.velocityTarget=new R,this.velocity=new R,this.directionXZ=new R,this.rotVelocityStick=new R,this.rotVelocityTarget=new R,this.rotVelocity=new R,this.rotDirection=new R,this.nonColliderRotOffset=new Ue,this.nonColliderPosOffset=new Ue,this.firstPointerId=-1,this.rot=new R,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 Ue,this.objectToTarget=new R,this.objectToTarget0=new R,this.objectToCamXZ=new R,this.objectToCamXZ0=new R,this.targetToCamera=new R,this.targetToCamera0=new R,this.cameraPolarAxis0=new R,this.targetPos=new R,this.targetQuat=new jt,this.lerpFactorPos=new R().setScalar(.3),this.lerpFactorPosStart=.3,this.lerpFactorPosEnd=.3,this.lerpFactorRotStart=.3,this.lerpFactorRotEnd=.3,this.lerpFactorPosCamera=.3,this.lerpFactorRotCamera=.3,this.objXZQuat=new jt,this.objXZQuatInv=new jt,this.objXZRotMat=new Ue,this.isFirstPerson=!1,this.didHit=!1,this.groundVelocity=new R,this.pushedVelocity=new R,this.groundYRotation=0,this.objectRealQuat=new jt,this.colliderWorldQuat=new jt,this.groundNormal=new R,this.groundTilt=new jt,this.groundTiltInv=new jt,this.lastHitObj=null,this.isFirstFrame=!0,this.rotationAccumWhenOrientWithCamera=0,this.navMeshPathDest=null,this.position=new R,this.quaternion=new jt,this.scale=new R,this.initialAction=!0,this.onPointerDown=f=>{!(f.target===this.domElement||f.target instanceof HTMLElement&&f.target.tagName==="SPLINE-VIEWER"&&f.target.shadowRoot?.contains(this.domElement))||this.firstPointerId!==-1||(this.firstPointerId=f.pointerId,this.domElement.ownerDocument.addEventListener("pointermove",this.onPointerMove),this.domElement.ownerDocument.addEventListener("pointerup",this.onPointerUp),this.rotBy!=="keys"&&!Zl&&!AW&&this.domElement.requestPointerLock(),this.prevMouse.set(f.clientX,f.clientY))},this.onPointerUp=f=>{this.firstPointerId=-1,this.domElement.ownerDocument.removeEventListener("pointermove",this.onPointerMove),this.domElement.ownerDocument.removeEventListener("pointerup",this.onPointerUp),f.pointerType==="mouse"&&this.domElement.ownerDocument.exitPointerLock()},this.onPointerMove=f=>{if(f.pointerId!==this.firstPointerId)return;let m=f.clientX-this.prevMouse.x,g=f.clientY-this.prevMouse.y;this.prevMouse.set(f.clientX,f.clientY),f.pointerType==="mouse"&&this.rotBy!=="keys"&&(AW&&U_e<15.5&&!Zl?(this.eulerDelta.y=-m*this.mouseOrbitSensitivity,this.eulerDelta.x=-g*this.mouseOrbitSensitivity):(this.eulerDelta.y=-f.movementX*this.mouseOrbitSensitivity,this.eulerDelta.x=-f.movementY*this.mouseOrbitSensitivity)),f.pointerType!=="mouse"&&this.rotByTouch==="drag"&&(this.eulerDelta.y=-m*this.mouseOrbitSensitivity*5,this.eulerDelta.x=-g*this.mouseOrbitSensitivity*5),this.controlsManager.requestRender()},this.onPointerlockChange=f=>{this.domElement.ownerDocument.pointerLockElement===this.domElement?vX.isLocked=!0:vX.isLocked=!1},this.onPointerlockError=()=>{console.error("SPE.GameControls: Unable to use Pointer Lock API")},this.handleVisibilityChange=()=>{if(document?.hidden)for(let f in this.movementState)this.movementState[f]=0},this.onKeyDown=f=>{!(f.target instanceof HTMLInputElement)&&(f.code==="ArrowLeft"||f.code==="ArrowUp"||f.code==="ArrowRight"||f.code==="ArrowDown"||f.code==="Space")&&f.preventDefault();for(let m of this.keyAssignments)if(f.key.toUpperCase()===m[1]||f.key===m[1]){this.movementState[m[0]]=1;break}this.controlsManager.requestRender()},this.onKeyUp=f=>{for(let m of this.keyAssignments)if(f.key.toUpperCase()===m[1]||f.key===m[1]||f.code.slice(3,f.code.length).toUpperCase()===m[1]){this.movementState[m[0]]=0;break}},this.copyVRGamePadValues=(f,m)=>{for(let g=2;g<4;g++){let v=f.axes[g];m===0?g===2?this.movementState.movePosX=v:this.movementState.movePosZ=v:(f.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===a&&(this.isFirstPerson=!0),this.object.parent instanceof Dn||(this.object.matrixWorldAutoUpdate=!1,this.object.matrix.copy(this.object.matrixWorld)),this.shearMatrix0.copy(this.object.shearMatrix),Af(this.object.matrix,{translation:this.position,quaternion:this.quaternion,scale:this.scale,shearMatrix:this.object.shearMatrix}),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.camera.parent instanceof Dn||(this.camera.matrixWorldAutoUpdate=!1,this.camera.matrix.copy(this.camera.matrixWorld),this.cameraShearMatrix0.copy(this.camera.shearMatrix),Af(this.camera.matrix,{translation:this.camera.position,quaternion:this.camera.quaternion,scale:this.camera.scale,shearMatrix:this.camera.shearMatrix})),this.camera.matrixAutoUpdate=!1,this.offsetMatrix.copy(this.object.matrix).invert().multiply(this.camera.matrix);let f,m=new R(0,0,-1).applyQuaternion(this.camera.quaternion),g=new R().subVectors(this.position,this.camera.position);this.objectToCamXZ.copy(g),this.objectToCamXZ.y=0,this.objectToCamXZ0.copy(this.objectToCamXZ),Math.abs(m.y)<1e-6?(g.y=0,m.y=0,f=g.projectOnVector(m)):f=g.y/m.y>0?m.multiplyScalar(g.y/m.y):m.multiplyScalar(g.length()),this.targetToCamera0.copy(f).negate();let v=this.camera.position.clone().add(f);this.objectToTarget0.subVectors(v,this.position);let y=new Dr().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 Qn&&(this.object.matrixAutoUpdate=!1),this.euler.setFromQuaternion(this.quaternion,"YXZ"),this.rotByTouch=i.rotByTouch??"joystick",this.rotBy=i.rotBy??"keys",this.rotationMode=i.rotationMode??"normal",this.moveMode=i.moveMode??"walk",this.collisionEnabled=i.collisionEnabled,this.speedTranslate=1*(i.speedTranslate??250),this.speedOrbit=.025*(i.speedRotate??100),this.mouseOrbitSensitivity=16e-6*(i.speedRotate??100),this.keyAssignments=i.keyAssignments.map(f=>{let m=[f[0],f[1]];return m[1]==="\u25B2"?m[1]="ArrowUp":m[1]==="\u25C0"?m[1]="ArrowLeft":m[1]==="\u25BC"?m[1]="ArrowDown":m[1]==="\u25B6"?m[1]="ArrowRight":m[1]==="\u21E7"?m[1]="Shift":m[1]==="\u21B5"?m[1]="Enter":m[1]==="Space"?m[1]=" ":m[1]==="\u2318"?m[1]="Meta":m[1]==="Ctrl"?m[1]="Control":m[1]==="Esc"&&(m[1]="Escape"),m}),i.rotBy==="mouse"){let f;f=this.keyAssignments.findIndex(m=>m[0]==="rotNegX"),f!==-1&&(this.keyAssignments[f][1]=""),f=this.keyAssignments.findIndex(m=>m[0]==="rotPosX"),f!==-1&&(this.keyAssignments[f][1]=""),f=this.keyAssignments.findIndex(m=>m[0]==="rotPosY"),f!==-1&&(this.keyAssignments[f][1]=""),f=this.keyAssignments.findIndex(m=>m[0]==="rotNegY"),f!==-1&&(this.keyAssignments[f][1]="")}this.lerpFactorPosStart=1-.02**(1/(60*(i.delayPos[0]??.3))),this.lerpFactorPosEnd=1-.02**(1/(60*(i.delayPos[1]??.3))),this.lerpFactorPos.setScalar(this.lerpFactorPosStart),this.lerpFactorRotStart=1-.02**(1/(60*(i.delayRot[0]??.3))),this.lerpFactorRotEnd=1-.02**(1/(60*(i.delayRot[1]??.3))),this.lerpFactorPosCamera=1-.02**(1/(60*(i.delayPosCamera??.3))),this.lerpFactorRotCamera=1-.02**(1/(60*(i.delayRotCamera??.3))),this.gravity=12*(this.gloabalPhysics.gravity??Ax.defaultData.gravity),this.usePhysics=this.gloabalPhysics.usePhysics??Ax.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??$L.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*c7/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*c7/this.pixelsPerMeter,this.stepThresh=2*i.collider.radius*.3/this.pixelsPerMeter,this.colliderHeight=2*i.collider.radius):(this.offset=i.collider.height*c7/this.pixelsPerMeter,this.stepThresh=.3*i.collider.height/this.pixelsPerMeter,this.colliderHeight=i.collider.height),this.collider.type=i.collider.type;let d=new R().fromArray(i.collider.position.map(f=>typeof f=="number"?f:0)),c=new jt().setFromEuler(new Dr().fromArray([...i.collider.rotation.map(f=>typeof f=="number"?f:0),"XYZ"]));this.collider.position.copy(d).multiply(this.scale),this.collider.rotation.copy(c),this.collider.matrix.compose(d,c,Yve),i.cameraXAxis!==void 0&&(this.cameraXAxis=i.cameraXAxis,this.cameraYAxis=i.cameraYAxis,this.minPolarAngle=i.cameraRotXLimits[0],this.maxPolarAngle=i.cameraRotXLimits[1],this.minAzimuthAngleRel=i.cameraRotYLimits[0],this.maxAzimuthAngleRel=i.cameraRotYLimits[1]),this.forwardDir=i.forwardDirection??"-z",this.isFirstPerson&&(this.forwardDir="-z"),this.runMultiplier=i.runMultiplier??2;let p=2*i.navmesh.destinationHelperRadius;if(p>0){let f=new Ct;f.push({fi:0,data:{...rs.defaultData("light","phong"),alpha:0},id:"layer1"}),f.push({fi:0,data:{...rs.defaultData("color"),color:i.navmesh.destinationHelperColor,alpha:i.navmesh.destinationHelperColor.a},id:"layer2"});let m=qwe({layers:f},{scene:this.page.scene,shared:this.sharedAssets});this.navMeshPathDest=new Tr(qY.create({parameters:{width:p,height:p/10,hollow:.7}}),m),this.navMeshPathDest.material.userData.opacity0=i.navmesh.destinationHelperColor.a}this.activate()}reset(e=!1){if(this.object.matrixWorldAutoUpdate=!0,this.camera.matrixWorldAutoUpdate=!0,this.object.shearMatrix.copy(this.shearMatrix0),e){this.object.updateMatrix(),this.object.updateMatrixWorld(),this.object.parent instanceof Dn||(this.object.matrixWorldAutoUpdate=!1,this.object.matrix.copy(this.object.matrixWorld)),Af(this.object.matrix,{translation:this.position,quaternion:this.quaternion,scale:this.scale,shearMatrix:this.object.shearMatrix});let t=new Dr().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 Qn?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.shearMatrix.copy(this.cameraShearMatrix0),e?(this.camera.updateMatrix(),this.camera.updateMatrixWorld(),this.camera.parent instanceof Dn||(this.camera.matrixWorldAutoUpdate=!1,this.camera.matrix.copy(this.camera.matrixWorld),Af(this.camera.matrix,{translation:this.camera.position,quaternion:this.camera.quaternion,scale:this.camera.scale,shearMatrix:this.camera.shearMatrix}))):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={},qL.list.forEach(i=>{this.actions[i]=ha({...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"),Ka(this.actions.idle),Ka(this.actions.move),Ka(this.actions.run),Ka(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 ko.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 s=Gp.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),a=this.sharedGameControlGlobals.rapierWorld.castShape(this.colliderWorldPosition.divideScalar(this.pixelsPerMeter),this.colliderWorldQuat,s,this.object.rigidBody?.collider(0).shape,0,1,!1,8,void 0,void 0,this.object.rigidBody);if(a){this.onObject=!0,this.groundNormal.set(a.normal2.x,a.normal2.y,a.normal2.z).applyQuaternion(this.colliderWorldQuat).negate(),this.alignToGround&&this.groundTiltAdjustment(this.groundNormal),Math.acos(this.groundNormal.y)<this.slopeThresh&&(r=!0),a.collider.parent()?.bodyType()===0&&Math.acos(this.groundNormal.y)*(180/Math.PI)>45&&(this.onObject=!1);let o=a.collider.parent(),l=o!==null&&o.isKinematic()?o:null,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(ko).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 s=this.navMeshPathDest.material;if(this.moveMode==="walk"&&this.path.length>1){this.navMeshPathDest.position.copy(this.path[this.path.length-1]),this.navMeshPathDest.parent||this.page.add(this.navMeshPathDest);let a=ko.subVectors(this.path[1],this.position),o=Gp.subVectors(this.path[1],this.path[0]);a.dot(o)<0?this.path.shift():(this.directionXZ.x=o.x,this.directionXZ.z=o.z),s.opacity=s.userData.opacity0}else s.opacity-=.05*s.userData.opacity0,this.navMeshPathDest.material.opacity<=0&&this.navMeshPathDest.parent&&this.page.remove(this.navMeshPathDest)}this.directionXZ.normalize(),this.movementState.run?this.moveForce=this.runMultiplier:this.moveForce=1,this.velocityTarget.z=this.directionXZ.z*this.speedTranslate*this.moveForce,this.velocityTarget.x=this.directionXZ.x*this.speedTranslate*this.moveForce,(this.moveMode==="walk"?this.velocityTarget.x+this.velocityTarget.z===0:this.velocityTarget.manhattanLength()===0)?this.lerpFactorPos.setScalar(this.lerpFactorPosEnd):this.lerpFactorPos.setScalar(this.lerpFactorPosStart),this.moveMode==="walk"&&(this.lerpFactorPos.y=1),this.didHit===!1&&this.pushedVelocity.manhattanLength()===0||this.usePhysics===!1?(this.velocity.x+=(this.velocityTarget.x-this.velocity.x)*(1-(1-this.lerpFactorPos.x)**i),this.velocity.y+=(this.velocityTarget.y-this.velocity.y)*(1-(1-this.lerpFactorPos.y)**i),this.velocity.z+=(this.velocityTarget.z-this.velocity.z)*(1-(1-this.lerpFactorPos.z)**i)):this.velocity.copy(this.velocityTarget),(this.moveMode==="walk"?this.velocity.x**2+this.velocity.z**2<this.speedTranslate:this.velocity.lengthSq()<this.speedTranslate)?(this.dispatchStopEvent("move"),this.dispatchStopEvent("run"),this.onObject&&(this.dispatchStopEvent("jump"),this.dispatchStartEvent("idle"))):(this.dispatchStopEvent("idle"),(this.onObject||this.moveMode==="fly")&&(this.dispatchStopEvent("jump"),this.movementState.run?(this.dispatchStopEvent("move"),this.dispatchStartEvent("run")):(this.dispatchStopEvent("run"),this.dispatchStartEvent("move"))));let n=XVe.copy(this.velocity);if(this.orientMode!=="none"&&this.isFirstPerson===!1){let s=Gp.copy(n);s.y=0,n.set(0,n.y,s.length()*(this.forwardDir==="+z"?1:-1))}if(this.directionXZ.manhattanLength()>0&&this.orientMode!=="none"&&this.isFirstPerson===!1)if(this.orientWith==="camera"&&this.path.length<=1){let s=ko;this.camera.getWorldDirection(s);let a=db.copy(pc).multiplyScalar(s.dot(pc));s.sub(a);let o=Gp.copy(this.directionXZ);o.x*=-1,this.rot.y=s.angleTo(o)*(s.cross(o).y>0?-1:1)+this.rotationAccumWhenOrientWithCamera}else this.rot.y=(this.path.length>1?0:this.euler.y)+Math.atan2(-this.directionXZ.z,this.directionXZ.x)+Math.PI/2*(this.forwardDir==="+z"?1:-1);if(cb.setFromVector3(this.rot),this.moveMode==="walk"&&(cb.x=0),n.applyEuler(cb),r&&(Pv.setFromUnitVectors(pc,this.groundNormal),n.applyQuaternion(Pv)),this.usePhysics===!0&&this.object.rigidBody){this.pushedVelocity.set(0,0,0);let s=0;for(let a of this.sharedGameControlGlobals.entitiesWithTransformAnim){if(a.rigidBody===void 0||a.prevQ===void 0)continue;(a.hasNonUniformScale?a.matrixWorldRigid:a.matrixWorld).decompose(f7,Qve,QVe);let o=this.object.getWorldPosition(JVe).add(this.collider.position).sub(f7);Jve.copy(a.prevQ).invert().premultiply(Qve);let l=db.subVectors(f7,a.prevT).add(e6e.copy(o).applyQuaternion(Jve).sub(o)).divideScalar(t).divideScalar(this.pixelsPerMeter),h=a.rigidBody.collider(0).castCollider(l,this.object.rigidBody.collider(0),ko.copy(n).divideScalar(this.pixelsPerMeter),0,t,!1);l.multiplyScalar(this.pixelsPerMeter);let u=nr.is(a)?a:a.object;if(h!==null&&this.lastHitObj!==u){let d;a instanceof Zo&&(d=a);let c=this.sharedGameControlGlobals.entityToCollisionEvents[u.uuid];if(c)for(let p of c)p.data.target==="character"&&(p.dispatch(d),u.dispatchEvent(gX));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),Zve(s++).copy(h.normal1).applyQuaternion(a.quaternion))}if(s>0){for(let a=0;a<s;a++){let o=Zve(a),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(pc,this.euler.y-this.euler0.y);let s=Gp.copy(this.objectToCamXZ).normalize(),a=db.copy(n).multiplyScalar(t);a.y=0;let o=a.sub(ko.copy(s).multiplyScalar(a.dot(s))).cross(s).y;this.euler.y-=Math.atan2(o,this.objectToCamXZ.length())}}else this.rot.y+=this.rotVelocity.y*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=et.clamp(this.euler.x,-this.maxPolarAngle+this.cameraPolarOffset+1e-6,-this.minPolarAngle+this.cameraPolarOffset-1e-6):this.euler.x=et.clamp(this.euler.x,-this.PI_2+this.cameraPolarOffset,this.PI_2+this.cameraPolarOffset):this.cameraXAxis==="Limit"&&(this.euler.x=et.clamp(this.euler.x,-this.PI_2,this.PI_2))),this.moveMode==="fly"?this.rot.x=this.euler.x:this.isFirstPerson&&(cb.copy(this.euler),cb.y=0,this.nonColliderRotOffset.makeRotationFromEuler(cb)),vh.setFromAxisAngle(KVe,this.rot.x),Pv.setFromAxisAngle(pc,this.rot.y),Pv.multiply(vh),vh.setFromAxisAngle(ZVe,this.rot.z),Pv.multiply(vh),this.quaternion.copy(Pv),this.objectRealQuat.multiplyQuaternions(this.quaternion,this.objXZQuat),this.colliderWorldQuat.copy(this.objectRealQuat).multiply(this.collider.rotation),this.collisionEnabled)if(this.usePhysics&&this.object.rigidBody?.collider(0).shape){let s=Gp.copy(n).multiplyScalar(t/this.pixelsPerMeter),a=null;this.didHit=!1;let o=new R;for(let u=0;u<5;u++){let d=s.length(),c=db.copy(s).normalize();if(a=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),a===null){u===0&&this.directionXZ.manhattanLength()!==0&&(this.lastHitObj=null),o.add(s);break}{this.didHit=!0;let p=this.sharedGameControlGlobals.colliderToEntity.get(a.collider.handle);if(p!==this.lastHitObj&&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(a.collider.handle))._parent;if(p.cloner){for(let x of p.cloner.children)if(x.rigidBody===b){_=x;break}}y.dispatch(_),p.dispatchEvent(gX)}}}let f=qve.set(a.normal2.x,a.normal2.y,a.normal2.z).applyQuaternion(this.colliderWorldQuat),m=$ve.copy(c).multiplyScalar(a.time_of_impact).dot(f),g=a.time_of_impact;if(g===0&&(this.position.y+=this.offset*this.pixelsPerMeter),m>this.offset&&(g=a.time_of_impact*(m-this.offset)/m,o.addScaledVector(c,g)),s.copy(c).multiplyScalar(d-g),Math.acos(-f.y)>this.slopeThresh){let v=this.colliderWorldPosition.divideScalar(this.pixelsPerMeter).add(o),y=db.copy(a.witness2).applyQuaternion(this.colliderWorldQuat);y.y=0;let _=v.add(y);_.y+=this.stepThresh;let b=this.sharedGameControlGlobals.rapierWorld.castShape(_,this.colliderWorldQuat,s,this.object.rigidBody?.collider(0).shape,0,1,!1,12,void 0,void 0,this.object.rigidBody);b!==null&&b.time_of_impact===0&&(f.y=0,f.normalize())}s.addScaledVector(f,-s.dot(f))}}this.position.addScaledVector(o,this.pixelsPerMeter),ko.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&&t6e.copy(ko).sub(l.translation()).lengthSq()>1;l!==void 0&&(h?(l.setTranslation(ko,!0),l.setRotation(vh,!0)):(l.setNextKinematicTranslation(ko),l.setNextKinematicRotation(vh)))}else{let s=this.onObject?1:5,a=n.multiplyScalar(t/s);for(let o=0;o<s;o++)this.position.add(a),this.collisionAdjustment(t/s)}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),_xe(this.position,this.quaternion,this.object.shearMatrix,this.scale,this.object.matrix).multiply(this.nonColliderPosOffset).multiply(this.nonColliderRotOffset),this.object.parent instanceof Dn?this.object.matrixWorld.multiplyMatrices(this.object.parent.matrixWorld,this.object.matrix).multiply(this.object.pivotMatrix):this.object.matrixWorld.copy(this.object.matrix),this.object.children.forEach(s=>{s.updateMatrixWorld(!0)}),this.quaternion.premultiply(this.groundTiltInv).multiply(this.objXZQuatInv),this.cameraFollow===!0){this.updateFollowArms();let s=this.objectToTarget.add(this.position),a=this.targetToCamera.add(s);p7.lookAt(a,s,pc).setPosition(a),p7.decompose(this.targetPos,this.targetQuat,ko),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.matrixWorld.copy(this.camera.matrix),this.cameraYAxis==="Limit"&&this.orientMode==="cartesian"&&(this.euler.y=et.clamp(this.euler.y,this.minAzimuthAngleRel,this.maxAzimuthAngleRel)),this.euler.x=et.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(r6e),!(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(i6e),0))}updateFollowArms(){this.objectToTarget.copy(this.objectToTarget0),this.targetToCamera.copy(this.targetToCamera0);let e,t=vh.setFromAxisAngle(pc,this.cameraYAxis==="Limit"&&this.orientMode!=="radial"?et.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"?et.clamp(this.euler.x,-this.maxPolarAngle+this.cameraPolarOffset+1e-6,-this.minPolarAngle+this.cameraPolarOffset-1e-6):et.clamp(this.euler.x,-this.PI_2+this.cameraPolarOffset+1e-6,this.PI_2+this.cameraPolarOffset-1e-6);let i=ko.copy(this.cameraPolarAxis0);(this.cameraYAxis!=="Locked"||this.orientMode==="radial")&&i.applyQuaternion(t);let r=Pv.setFromAxisAngle(i,e);this.cameraYAxis!=="Locked"&&this.targetToCamera.applyQuaternion(t),this.cameraXAxis!=="Locked"&&this.targetToCamera.applyQuaternion(r)}groundTiltAdjustment(e){180*pc.angleTo(e)/Math.PI<15||180*pc.angleTo(e)/Math.PI>85?vh.identity():vh.setFromUnitVectors(pc,e),this.groundTilt.slerp(vh,.06),this.groundTiltInv.copy(this.groundTilt).invert()}collisionAdjustment(e){let t=$ve.set(0,0,0);this.object.matrix.compose(this.position,this.quaternion,this.scale);let i=p7.multiplyMatrices(this.object.matrix,this.objXZRotMat).multiply(this.collider.matrix).decompose(ko,vh,Gp).compose(ko,vh,Yve);this.sharedGameControlGlobals.entitiesWithTransformAnim.forEach(n=>{if(n===this.object||n.isDescendantOf(this.object)||!n.bvhGeometry||!n.bvhGeometry.boundsTree)return;lu.makeEmpty(),n.updateMatrixWorldRigid();let s=n.matrixWorldRigid,a=Xve.copy(s).invert(),o=YVe.copy(Xve).multiply(i);za.copy(this.collider.segment),za.start.applyMatrix4(o),za.end.applyMatrix4(o);let l=qve.copy(this.position).applyMatrix4(a);lu.expandByPoint(za.start),lu.expandByPoint(za.end),lu.min.addScalar(-this.collider.radius),lu.max.addScalar(this.collider.radius),n.bvhGeometry.boundsTree.shapecast({boundsTraverseOrder:h=>h.distanceToPoint(za.end),intersectsBounds:h=>h.intersectsBox(lu),intersectsTriangle:h=>{let u=ko,d=Gp,c=h.closestPointToSegment(za,u,d);if(c<this.collider.radius){let p=this.collider.radius-c,f=d.sub(u).normalize(),m=db.copy(l);m.addScaledVector(f,p);let g=m.applyMatrix4(s).sub(this.position);t.add(g),za.start.addScaledVector(f,p),za.end.addScaledVector(f,p)}}})}),lu.makeEmpty(),za.copy(this.collider.segment),za.start.applyMatrix4(i),za.end.applyMatrix4(i),lu.expandByPoint(za.start),lu.expandByPoint(za.end),lu.min.addScalar(-this.collider.radius),lu.max.addScalar(this.collider.radius),this.sharedGameControlGlobals.staticMeshBVH?.shapecast({boundsTraverseOrder:n=>n.distanceToPoint(za.end),intersectsBounds:n=>n.intersectsBox(lu),intersectsTriangle:n=>{let s=ko,a=Gp,o=n.closestPointToSegment(za,s,a);if(o<this.collider.radius){let l=this.collider.radius-o,h=a.sub(s).normalize();this.alignToGround&&this.groundTiltAdjustment(h),t.addScaledVector(h,l),za.start.addScaledVector(h,l),za.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()}},F3e=vX;F3e.isLocked=!1,ae(),JA(),zB(),Pw(),Aw();var U3e,z3e,m7,n6e=new Promise(e=>{U3e=e});function s6e(e){return m7||(m7=async function(){let t=e??"https://cdn.spline.design/@splinetool/runtime@2.0.123/build";typeof window<"u"&&(z3e=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())]),s=r.default,a=await s({wasmBinary:n});U3e(a)}(),m7)}jr();var k3e,mr,co,a6e=e=>`
|
|
12932
12932
|
(async function() {
|
|
12933
12933
|
const [wasmImport, wasmBinary] = await Promise.all([
|
|
12934
12934
|
import('${e}' + 'navmesh.js'),
|
|
@@ -12938,7 +12938,7 @@ void main() {
|
|
|
12938
12938
|
self.module = await wasmModule({ wasmBinary });
|
|
12939
12939
|
postMessage('ready');
|
|
12940
12940
|
})();
|
|
12941
|
-
`,o6e={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};n6e.then(e=>{k3e=e,mr=new e.Vec3,co=new e.Vec3});var l6e=new R,h6e=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 s=n.raycastWithClones(r);if(s.length!==0){if(this.gameControl){let a=l6e.copy(this.gameControl.colliderWorldPosition);a.y-=this.gameControl.colliderHeight/2,this.gameControl.path=this.computePath(a,s[0].point)}this.eventContext.requestRender()}},this.traverseWithPhysics=(i,r)=>n=>{let s;if(n instanceof Xf){if(!n.objectForSample)return n.object.dataPatched.physics.fusedBody===!0&&n.object.dataPatched.physics.rigidBody==="dynamic"||void 0;if(n.objectForSample.dataPatched.physics.fusedBody)return;s=n.object}else if(n instanceof Zo)s=n.object;else if(s=n,s.dataPatched.cloner?.disabled===!1&&s.dataPatched.cloner?.hideBase&&s.dataPatched.physics?.fusedBody!==!0)return!0;if(r&&!s.userData.navmesh)return;let a=s.dataPatched;if(!a.visible&&a.physics?.enabled!==!0)return!0;n.updateMatrixWorldRigid();let o=iB(a),l=s.userData.hasDestroy,h=s.userData.hasDrag,u=!1,d=!1;for(let c of a.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&&a.physics?.rigidBody==="dynamic"){if(this.usePhysics&&a.physics?.fusedBody)return!0}else if("geometry"in n&&n.geometry&&i.push(uf(n.geometry,n.matrixWorld)),this.usePhysics&&a.physics?.fusedBody)return n.traverseObject((c,p)=>{if(p===0)return;let f;if(c instanceof Xf){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;f=c.object}else if(c instanceof Zo)f=c.object;else if(f=c,c.dataPatched.cloner?.hideBase)return!0;let m=f.dataPatched;if(!m.visible&&m.physics?.enabled!==!0)return!0;"geometry"in c&&c.geometry&&i.push(uf(c.geometry,c.matrixWorld))}),!0},this.traverseNoPhysics=(i,r)=>n=>{let s;if(n instanceof Xf)return;s=n instanceof Zo?n.object:n;let a=s.dataPatched;if(a.physics.enabled==="visibility"?!a.visible:!a.physics.enabled)return!0;if(r&&!s.userData.navmesh)return;let o=n.geometry,l=s.userData.hasDestroy===!0,h=s.userData.hasDrag===!0;if(iB(a)||l||h||s.dataPatched.events.some(u=>u.data.disabled!==!0&&u.data.type==="GameControl"))return!0;o&&i.push(uf(o,n.matrixWorld))},this.navmeshWasm=k3e,this.navMesh=new this.navmeshWasm.NavMesh,this._workerURL=URL.createObjectURL(new Blob([(t?a6e(z3e??"https://cdn.spline.design/@splinetool/runtime@2.0.
|
|
12941
|
+
`,o6e={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};n6e.then(e=>{k3e=e,mr=new e.Vec3,co=new e.Vec3});var l6e=new R,h6e=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 s=n.raycastWithClones(r);if(s.length!==0){if(this.gameControl){let a=l6e.copy(this.gameControl.colliderWorldPosition);a.y-=this.gameControl.colliderHeight/2,this.gameControl.path=this.computePath(a,s[0].point)}this.eventContext.requestRender()}},this.traverseWithPhysics=(i,r)=>n=>{let s;if(n instanceof Xf){if(!n.objectForSample)return n.object.dataPatched.physics.fusedBody===!0&&n.object.dataPatched.physics.rigidBody==="dynamic"||void 0;if(n.objectForSample.dataPatched.physics.fusedBody)return;s=n.object}else if(n instanceof Zo)s=n.object;else if(s=n,s.dataPatched.cloner?.disabled===!1&&s.dataPatched.cloner?.hideBase&&s.dataPatched.physics?.fusedBody!==!0)return!0;if(r&&!s.userData.navmesh)return;let a=s.dataPatched;if(!a.visible&&a.physics?.enabled!==!0)return!0;n.updateMatrixWorldRigid();let o=iB(a),l=s.userData.hasDestroy,h=s.userData.hasDrag,u=!1,d=!1;for(let c of a.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&&a.physics?.rigidBody==="dynamic"){if(this.usePhysics&&a.physics?.fusedBody)return!0}else if("geometry"in n&&n.geometry&&i.push(uf(n.geometry,n.matrixWorld)),this.usePhysics&&a.physics?.fusedBody)return n.traverseObject((c,p)=>{if(p===0)return;let f;if(c instanceof Xf){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;f=c.object}else if(c instanceof Zo)f=c.object;else if(f=c,c.dataPatched.cloner?.hideBase)return!0;let m=f.dataPatched;if(!m.visible&&m.physics?.enabled!==!0)return!0;"geometry"in c&&c.geometry&&i.push(uf(c.geometry,c.matrixWorld))}),!0},this.traverseNoPhysics=(i,r)=>n=>{let s;if(n instanceof Xf)return;s=n instanceof Zo?n.object:n;let a=s.dataPatched;if(a.physics.enabled==="visibility"?!a.visible:!a.physics.enabled)return!0;if(r&&!s.userData.navmesh)return;let o=n.geometry,l=s.userData.hasDestroy===!0,h=s.userData.hasDrag===!0;if(iB(a)||l||h||s.dataPatched.events.some(u=>u.data.disabled!==!0&&u.data.type==="GameControl"))return!0;o&&i.push(uf(o,n.matrixWorld))},this.navmeshWasm=k3e,this.navMesh=new this.navmeshWasm.NavMesh,this._workerURL=URL.createObjectURL(new Blob([(t?a6e(z3e??"https://cdn.spline.design/@splinetool/runtime@2.0.123/build/"):`
|
|
12942
12942
|
(async function() {
|
|
12943
12943
|
const [wasmImport, wasmBinary] = await Promise.all([
|
|
12944
12944
|
import(self.location.origin + '/_libraries/navmesh.js'),
|
|
@@ -13009,11 +13009,11 @@ onmessage = function(messageEvent) {
|
|
|
13009
13009
|
`:"")+xE(i.children,t);if(i.type==="variable"){let n=t.getVariable(i.variableId);if(n!==void 0)return X3e(n,t)}}return""}).join("");zt();var N7=1e3,Pye=512e3,N8e=class{constructor(e,t){this.id=e,this.userWebhook=t,this.result=void 0,this._connected=!1,this.emitter=oF(),this.reconnectWaitFor=N7,this._onError=i=>{this.eventSource?.removeEventListener("message",this._onMessage),this.eventSource?.removeEventListener("error",this._onError),this.eventSource?.removeEventListener("open",this._onConnected),this._scheduleReconnect()},this._onConnected=i=>{clearTimeout(this.scheduledReconnectHandle),this.reconnectWaitFor=N7,this._connected=!0},this._onDisconnected=()=>{clearTimeout(this.scheduledReconnectHandle),this.reconnectWaitFor=N7,this._connected=!1},this._onMessage=i=>{let r,n=i.data;try{r=JSON.parse(n)}catch(s){console.error("Error parsing webhook message",s)}if(r){let s=!1;this.userWebhook.parametersSchemas.forEach(({data:a})=>{r[a.name]!==void 0&&function(o,l){let h=typeof o;return!!((l==="string"||l==="number")&&h===l||l==="boolean"&&(o==="true"||o==="false"||o===!0||o===!1)||l==="image"&&h==="string"&&o.startsWith("http"))}(r[a.name],a.type)&&(this.result===void 0&&(this.result={}),this.result[a.name]=r[a.name],s=!0)}),s&&this.emitter.emit("message",{userWebhookId:this.id})}}}connect(){clearTimeout(this.scheduledReconnectHandle),this.userWebhook.url&&(this.eventSource=new EventSource("https://hooks.spline.design/events?hashFile="+this.userWebhook.url),this.eventSource.addEventListener("message",this._onMessage),this.eventSource.addEventListener("error",this._onError),this.eventSource.addEventListener("open",this._onConnected))}disconnect(){this.eventSource?.removeEventListener("message",this._onMessage),this.eventSource?.removeEventListener("error",this._onError),this.eventSource?.removeEventListener("open",this._onConnected),this.eventSource?.close(),this._onDisconnected(),clearTimeout(this.scheduledReconnectHandle)}_scheduleReconnect(){this.reconnectWaitFor*=2,this.reconnectWaitFor>Pye&&(this.reconnectWaitFor=Pye),clearTimeout(this.scheduledReconnectHandle),this.scheduledReconnectHandle=setTimeout(()=>{this.scheduledReconnectHandle=void 0,this.connect()},this.reconnectWaitFor)}update(e){this.userWebhook=e}dispose(){this._connected&&this.disconnect()}get connected(){return this._connected}on(e,t){this.emitter.on(e,t)}off(e,t){this.emitter.off(e,t)}getParametersKeys(){return this.userWebhook.parametersSchemas.map(e=>e.data.name)}getParameterValue(e){if(this.getParametersKeys().includes(e)){if(this.result)return this.result?.[e];for(let t of this.userWebhook.parametersSchemas)if(t.data.name===e)return aH.defaultParameterValueByType(t.data.type)}}};_r(),Fh("API",({eventContext:e,eventManager:t})=>new M8e(e,t)),Fh("WEBHOOK",({eventContext:e,eventManager:t})=>new A8e(e,t)),Jo("UserAPI",({data:e,page:t,shared:i,actionCondition:r})=>new P8e(e,t,i,r)),function(e){rK=e}({createUserAPI:(e,t,i)=>new R8e(e,t,i),createUserWebhook:(e,t)=>new N8e(e,t)}),In("api-services");var I8e=class extends nl{constructor(e,t){super(e),this.eventManager=t,this.events=[],this.onVoice=({value:i,frequencies:r})=>{this.events.forEach(n=>{n.dispatch()})}}connect(){this.openAIRealtime=this.eventContext.sharedAssets.openAIRealtime,this.openAIRealtime&&(this.eventContext.page.traverseEntity(e=>{e.data?.events.filter(t=>t.data.type==="AIAssistantListener"&&!t.data.disabled).forEach(t=>{this.events.push(new O8e(t.id,t.data,e,this.eventContext.page,this.eventContext.sharedAssets,this.eventManager))})}),this.openAIRealtime.on("voice",this.onVoice))}disconnect(){this.openAIRealtime?.off("voice",this.onVoice)}},O8e=class{constructor(e,t,i,r,n,s){this.id=e,this.data=t,this.object=i,this.actions=ha(t,t.actions,r,n,s,i)}dispatch(){this.dispatchActions(this.actions)}dispatchActions(e){e.Audio.forEach(t=>t.dispatchConditional()),e.Particles.forEach(t=>t.dispatchConditional()),e.Video.forEach(t=>t.dispatchConditional()),e.Create.forEach(t=>t.dispatch()),e.Destroy.forEach(t=>t.dispatch()),e.Reset.forEach(t=>t.dispatch()),e.Transition.forEach(t=>{!t.shouldReinit()||(t.object.currentTransitionEvent!==this&&(t.object.currentTransitionEvent=this),t.init())}),e.Transition.forEach(t=>t.play()),e.Animation.forEach(t=>t.play()),e.SwitchCamera.forEach(t=>t.play()),e.SceneTransition.forEach(t=>t.dispatch()),e.SetVariable.forEach(t=>t.checkConditions()),e.SetVariable.forEach(t=>t.dispatch()),e.DynamicVariablePlay.forEach(t=>t.dispatch()),e.ClearLocalStorage.forEach(t=>t.dispatch()),e.UserAPI.forEach(t=>t.dispatch())}},L8e=class extends nl{constructor(e,t){super(e),this.eventManager=t,this.events=[],this.onTriggerEvent=({description:i,direction:r})=>{let n=this.events.find(s=>s.data.description===i);n&&(r==="backward"?n.dispatchReverse():n.dispatch())}}connect(){this.openAIRealtime=this.eventContext.sharedAssets.openAIRealtime,this.openAIRealtime&&(this.eventContext.page.traverseEntity(e=>{e.data?.events.filter(t=>t.data.type==="AIAssistantTrigger"&&!t.data.disabled).forEach(t=>{this.events.push(new B8e(t.id,t.data,e,this.eventContext.page,this.eventContext.sharedAssets,this.eventManager))})}),this.openAIRealtime.on("trigger_event",this.onTriggerEvent))}disconnect(){this.openAIRealtime?.off("trigger_event",this.onTriggerEvent)}},B8e=class{constructor(e,t,i,r,n,s){this.id=e,this.data=t,this.object=i,this.actions=ha(t,t.actions,r,n,s,i)}dispatch(){let e=this.actions;e.Audio.forEach(t=>t.dispatchConditional()),e.Particles.forEach(t=>t.dispatchConditional()),e.Video.forEach(t=>t.dispatchConditional()),e.Create.forEach(t=>t.dispatch()),e.Destroy.forEach(t=>t.dispatch()),e.Reset.forEach(t=>t.dispatch()),e.Transition.forEach(t=>{!t.shouldReinit()||(t.object.currentTransitionEvent!==this&&(t.object.currentTransitionEvent=this),t.init())}),e.Transition.forEach(t=>t.play()),e.Animation.forEach(t=>t.play()),e.SwitchCamera.forEach(t=>t.play()),e.SceneTransition.forEach(t=>t.dispatch()),e.SetVariable.forEach(t=>t.checkConditions()),e.SetVariable.forEach(t=>t.dispatch()),e.DynamicVariablePlay.forEach(t=>t.dispatch()),e.ClearLocalStorage.forEach(t=>t.dispatch()),e.UserAPI.forEach(t=>t.dispatch())}dispatchReverse(){let e=this.actions;e.Transition.forEach(t=>t.reverseFromCurrent()),e.Particles.forEach(t=>t.reverseFromCurrent()),e.Animation.forEach(t=>t.reverseFromCurrent()),e.SwitchCamera.forEach(t=>t.reverseFromCurrent()),e.Create.forEach(t=>t.dispatchStop())}};sK();var F8e=function(e){e=e.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i,(i,r,n,s)=>String(r+r+n+n+s+s));let t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);return t?{r:parseInt(t[1],16),g:parseInt(t[2],16),b:parseInt(t[3],16)}:null},Rye=[4186.01,4434.92,4698.63,4978.03,5274.04,5587.65,5919.91,6271.93,6644.88,7040,7458.62,7902.13],U8e=["C","C#","D","D#","E","F","F#","G","G#","A","A#","B"],Yg=[],DZ=[];for(let e=1;e<=8;e++)for(let t=0;t<Rye.length;t++){let i=Rye[t];Yg.push(i/Math.pow(2,8-e)),DZ.push(U8e[t]+e)}var nB=[32,2e3],Dye=Yg.filter((e,t)=>Yg[t]>nB[0]&&Yg[t]<nB[1]),z8e=DZ.filter((e,t)=>Yg[t]>nB[0]&&Yg[t]<nB[1]),k8e=class{static getFrequencies(e,t,i,r="frequency",n=-100,s=-30){i||(i=new Float32Array(e.frequencyBinCount),e.getFloatFrequencyData(i));let a,o,l,h=t/2,u=1/i.length*h;if(r==="music"||r==="voice"){let c=r==="voice"?Dye:Yg,p=Array(c.length).fill(n);for(let f=0;f<i.length;f++){let m=f*u,g=i[f];for(let v=c.length-1;v>=0;v--)if(m>c[v]){p[v]=Math.max(p[v],g);break}}a=p,o=r==="voice"?Dye:Yg,l=r==="voice"?z8e:DZ}else a=Array.from(i),o=a.map((c,p)=>u*p),l=o.map(c=>`${c.toFixed(2)} Hz`);let d=a.map(c=>Math.max(0,Math.min((c-n)/(s-n),1)));return{values:new Float32Array(d),frequencies:o,labels:l}}},V8e=class{constructor(e){this.value=0,this.frequencies=new Float32Array(0);let t=new AudioContext;this.source=t.createMediaStreamSource(e),this.analyser=t.createAnalyser(),this.source.connect(this.analyser),this.analyser.fftSize=8192,this.analyser.smoothingTimeConstant=.1}getFrequencies(e=-100,t=-30){if(!this.analyser)throw new Error("Not connected, please call .connect() first");return k8e.getFrequencies(this.analyser,44100,void 0,"voice",e,t)}update(){let e=this.getFrequencies(),t=e.values.reduce((i,r)=>i+r,0)/e.values.length;this.value=t,this.frequencies=e.values}disconnect(){this.source.disconnect(),this.analyser.disconnect()}},G8e=class{constructor(e){this.callbacks=e,this.rafId=0,this.isOpen=!1,this.onMessage=t=>{this.callbacks.onMessage(t.data)},this.onOpen=()=>{this.isOpen=!0,this.callbacks.onOpen()},this.animate=()=>{this.rafId=requestAnimationFrame(this.animate),this.isOpen&&this.analyser&&(this.analyser.update(),this.callbacks.onVoice(this.analyser.value,this.analyser.frequencies))}}async connect(e){let t=await async function(s){try{return(await(await fetch("https://relayserver.spline.design/session?uuidfile="+s)).json()).token}catch(a){console.error("Token generation error:",a)}}(e);this.pc=new RTCPeerConnection,this.audioElement=document.createElement("audio"),this.audioElement.autoplay=!0,this.pc.ontrack=s=>{let a=s.streams[0];this.audioElement.srcObject=a,this.analyser=new V8e(a)};let i=await navigator.mediaDevices.getUserMedia({audio:!0});this.pc.addTrack(i.getTracks()[0]),this.dc=this.pc.createDataChannel("oai-events"),this.dc.addEventListener("message",this.onMessage),this.dc.addEventListener("open",this.onOpen);let r=await this.pc.createOffer();await this.pc.setLocalDescription(r);let n={type:"answer",sdp:await(await fetch("https://api.openai.com/v1/realtime/calls?model=gpt-realtime",{method:"POST",body:r.sdp,headers:{Authorization:`Bearer ${t}`,"Content-Type":"application/sdp"}})).text()};await this.pc.setRemoteDescription(n),this.animate()}send(e){return!!this.dc&&(this.dc.send(e),!0)}disconnect(){cancelAnimationFrame(this.rafId),this.analyser?.disconnect(),this.isOpen=!1,this.dc?.removeEventListener("message",this.onMessage),this.dc?.removeEventListener("open",this.onOpen),this.dc?.close(),this.pc?.getSenders().forEach(e=>{e.track&&e.track.stop()}),this.pc?.close(),this.pc=void 0}},j8e=class{constructor(e,t,i){this.data=e,this.id=t,this.shared=i,this.emitter=oF(),this.voice=0,this.frequencies=new Float32Array([0]),this.events=[],this.isConnected=!1,this.isToolsAdded=!1,this.tools=[],this.onServerEvent=r=>{let n=JSON.parse(r);if(this.appendEvent(n),n.type==="session.created"&&this.onSessionCreated(),n.type==="response.done"&&n.response?.output){for(let s of n.response.output)if(s.type==="function_call")for(let[a,o]of this.tools)s.name===a.name&&(o(JSON.parse(s.arguments)),setTimeout(()=>{this.sendClientEvent({type:"response.create",response:{instructions:"notice the user about what you just did"}})}))}},this.onSessionCreated=()=>{this.isToolsAdded||this.registerTools()},this.onOpen=()=>{this.events=[],this.isConnected=!0,this.sendClientEvent({type:"response.create",response:{instructions:"Say hi"}})}}update(e){this.data=e}setColorByName(e,t){let i=this.shared.getColorByName(e);if(i){let{id:r}=i,{r:n,g:s,b:a}=F8e(t)??{r:0,g:0,b:0};this.shared.updateColor(r,{r:n/255,g:s/255,b:a/255})}}async connect(){if(this.isConnected||this.session||this.hosted)return;let e={onMessage:this.onServerEvent,onOpen:this.onOpen,onVoice:(t,i)=>{this.voice=t,this.frequencies=i,this.emitter.emit("voice",{value:t,frequencies:i})}};this.hosted=function(t,i,r){if(!function(){try{return window.__SPLINE_PLAY_VOICE_HOST__===!0&&window.parent!==window}catch{return!1}}())return null;let n=!1,s=o=>{window.parent.postMessage({__splinePlayFrame:!0,...o},"*")},a=o=>{if(o.source!==window.parent)return;let l=o.data;!l||l.__splinePlayFrameHost!==!0||l.id!==t||(l.type==="voice-open"?(n=!0,r.onOpen()):l.type==="voice-message"&&typeof l.data=="string"?r.onMessage(l.data):l.type==="voice-level"&&typeof l.value=="number"?r.onVoice(l.value,l.frequencies instanceof Float32Array?l.frequencies:new Float32Array(0)):l.type==="voice-error"&&console.error("Voice assistant host error:",l.message))};return window.addEventListener("message",a),s({type:"voice-connect",id:t,hash:i}),{send:o=>!!n&&(s({type:"voice-send",id:t,message:o}),!0),disconnect:()=>{n=!1,window.removeEventListener("message",a),s({type:"voice-disconnect",id:t})}}}(this.id,this.data.integration.hash,e),!this.hosted&&(this.session=new G8e(e),await this.session.connect(this.data.integration.hash))}appendEvent(e){this.events=[e,...this.events]}sendClientEvent(e){e.event_id=e.event_id||crypto.randomUUID();let t=JSON.stringify(e);(this.hosted?this.hosted.send(t):this.session?.send(t))?this.appendEvent(e):console.error("Failed to send message - no data channel available",e)}registerTools(){this.isToolsAdded=!0,this.registerTool({type:"function",name:"set_personality_color",description:"returns a color based on the voice personality of the ai assistant. This should be called by the voice assistant each time it is asks to speak differently. If a color cannot be associated to the personality, the color should be a neutral color.",parameters:{type:"object",properties:{color:{type:"string",description:"css hex color string, reflecting the personality"},personality:{type:"string",description:"the personality of the voice assistant"}},required:["color","personality"]}},({color:n})=>{this.setColorByName("Voice Assistant Color",n)});let e=this.shared.getVariablesNames().join(", ");this.registerTool({type:"function",name:"set_variable",description:"Sets a Spline variable value when asked by the user.",parameters:{type:"object",properties:{name:{type:"string",description:`The name of the variable that needs to be set. Here's a list of available variables: ${e}. It the variable does not exist, don't call the function and warn the user about it.`},value:{type:"string",description:"The new value for this variable, should always be a string even for number and boolean variables, assume that the value will be cast to the proper type afterwards."}},required:["name","value","type"]}},({name:n,value:s})=>{let a=this.shared.getVariableByName(n);if(a){let o,l=this.shared.getVariable(a.id);if(typeof l=="number"){if(o=parseFloat(s),!Number.isFinite(o))return}else o=typeof l=="boolean"?s.toLowerCase()==="true":{textValue:s};this.shared.updateVariable(a.id,o)}});let t=this.shared.getColorNames().join(", ");this.registerTool({type:"function",name:"set_color",description:"Sets a Spline color asset value when asked by the user.",parameters:{type:"object",properties:{name:{type:"string",description:`The name of the color asset that needs to be set. Here's a list of available color assets: ${t}. It the color asset does not exist, don't call the function and warn the user about it.`},value:{type:"string",description:"css hex color string"}},required:["name","value"]}},({name:n,value:s})=>{this.setColorByName(n,s)});let i=this.shared.scene,r=[];i.traverseEntity(n=>{n.data.events.forEach(s=>{if(s.data.type==="AIAssistantTrigger"){let{description:a}=s.data;r.push(a)}})}),this.registerTool({type:"function",name:"trigger_event",description:"Trigger an event by name, here are the available events, please match what the user is asking for to one of these if it applies, otherwise don't call the function and warn the user.",parameters:{type:"object",properties:{description:{type:"string",description:`The name of the event that needs to be triggered. Here's a list of available events: ${JSON.stringify(r)}.`},direction:{type:"string",description:"default is forward, but can be forward or backward. Always set to forward unless the user ask to reverse or cancel the event, then set to backward."}},required:["description","direction"]}},({description:n,direction:s})=>{this.emitter.emit("trigger_event",{description:n,direction:s})}),this.sendClientEvent({type:"session.update",session:{type:"realtime",tools:this.tools.map(([n])=>n)}})}registerTool(e,t){this.tools.push([e,t])}disconnect(){this.voice=0,this.isConnected=!1,this.isToolsAdded=!1,this.session?.disconnect(),this.session=void 0,this.hosted?.disconnect(),this.hosted=null}computeAnalysisForListenerEvent(e){if(e.analysis==="range"){let t=this.frequencies.slice(...e.analysisRange);return t.reduce((i,r)=>i+r,0)/t.length}return e.analysis==="single"?this.frequencies[e.analysisSingle]:this.voice}on(e,t){this.emitter.on(e,t)}off(e,t){this.emitter.off(e,t)}};_r(),Fh("AIAssistantListener",({eventContext:e,eventManager:t})=>new I8e(e,t)),Fh("AIAssistantTrigger",({eventContext:e,eventManager:t})=>new L8e(e,t)),nK=(e,t,i)=>new j8e(e,t,i),In("ai-assistant"),jr(),wK();var NZ=class extends UB{constructor(e,t,i){super(e,t,i),this.data=t}};zt(),ae(),zt(),ae();var Y3e=class extends bw{constructor(){super(),this.caretIndex=0,this._caretVisibleAlpha=1,this._selectionVisibleAlpha=.3,this.current={start:0,end:void 0},this.matrixAutoUpdate=!1,this.caretMesh=new Tr(new $c(1,1),new Ql({transparent:!0,opacity:0,side:zr})),this.add(this.caretMesh),this.selectionMesh=new Tr(new $c(1,1),new Ql({color:2857471,transparent:!0,depthTest:!1,depthWrite:!1,opacity:0,side:zr})),this.add(this.selectionMesh),this.hide()}get caretHeight(){return this.object?.AD??0}show(e){this.visible=!0,this.object=e,this.caretMesh.scale.set(1,this.caretHeight,1),this.caretMesh.position.y=.5*-this.caretHeight,this.setCaretPosition(this.caretIndex),this.update()}hide(){this.visible=!1}update(){if(this.object===void 0)return;this.updateHelperMatrix();let{depth:e}=this.object.geometry.userData.parameters;this.caretMesh.position.z=e,this.selectionMesh.position.z=e}updateHelperMatrix(){if(this.object===void 0)return;let e=this.object,t=e.parent;t!==null&&t.updateWorldMatrix(!0,!1),e.matrixAutoUpdate&&e.updateMatrix(),t!==null?(this.matrixWorld.copy(t.matrixWorld),this.matrixWorld.multiplyMatrices(this.matrixWorld,e.matrix)):this.matrixWorld.copy(e.matrix),this.matrix.copy(this.matrixWorld);for(let i of this.children)i.matrixWorld.copy(this.matrixWorld);e.updateWorldMatrix(!0,!0)}setCaretColor(e){let t=this.caretMesh.material;t.color.setRGB(e.r,e.g,e.b);let i=this._caretVisibleAlpha===t.opacity;this._caretVisibleAlpha=e.a,i&&(t.opacity=this._caretVisibleAlpha)}setSelectionColor(e){this.selectionMesh.material.color.setRGB(e.r,e.g,e.b)}setCaretPosition(e,t={}){if(this.object===void 0)return;this.caretIndex=e;let i=this.object.wrappedText,[r,n]=cI(i,e),[s,a]=e>0?cI(i,e-1):[null,null];(e>0&&i.length?i[s].charAt(a):null)===`
|
|
13010
13010
|
`&&(r++,n=0),this.current.start=e,this.current.end=void 0;let[o,l]=I7(this.object,r,n),{AD:h,descender:u}=this.object,d=u+.5*h,{width:c,height:p,depth:f}=this.object.geometry.userData.parameters,m=typeof c=="string"?0:c,g=typeof p=="string"?0:p;this.caretMesh.scale.set(1,this.caretHeight,1),this.caretMesh.position.set(o-.5*m,l+d+.5*g,f),this.hideSelectionMesh(),this.showCaretMesh()}setSelection(e,t){if(this.object===void 0)return;let i=this.object.wrappedText;this.current.start=e,this.current.end=t;let r=[],n=[],s=function(g,v,y){let[_,b]=cI(g,v),[x,w]=cI(g,y),S=[];b>=g[_].length&&(_++,b=0);for(let T=_;T<=x;T++){let M=g[T],E=T===_?b:0,A=T===x?w:M.length;S.push([T,E,A])}return S}(i,e,t),{lineHeight:a,AD:o,descender:l}=this.object,h=l+.5*o-.5*a;for(let[g,v,y]of s)if(v!==y){let[_,b]=I7(this.object,g,v),[x,w]=I7(this.object,g,y),S=b,T=w;S+=h,T+=h,T+=a;let M=r.length/3;r.push(_,S,0),r.push(x,S,0),r.push(x,T,0),r.push(_,T,0),n.push(M+0,M+1,M+2),n.push(M+2,M+3,M+0)}let u=new At;u.setIndex(n),u.setAttribute("position",new Et(r,3));let{width:d,height:c,depth:p}=this.object.geometry.userData.parameters,f=typeof d=="string"?0:d,m=typeof c=="string"?0:c;this.selectionMesh.geometry.dispose(),this.selectionMesh.geometry=u,this.selectionMesh.position.x=.5*-f,this.selectionMesh.position.y=.5*m,this.selectionMesh.position.z=p,this.showSelectionMesh(),this.hideCaretMesh()}getSelectionFromPosition(e,t,i="previous"){if(this.object===void 0||this.object.font===void 0)return;let r=this.object.wrappedText,n=r.length,s=this.object.lineHeight,a=n*s,{height:o,verticalAlign:l}=this.object.geometry.userData.parameters,h=typeof o=="string"?0:o,u=0;l===3?u=h-a:l===2&&(u=.5*h-.5*a);let d=Math.min(Math.floor(Math.max(Math.min(-t-u,a),0)/s),n-1),c=this.object.charCoords[d],p=this.object.charWidths[d],f=0,m=!1;if(i==="previous"){for(let g=0;g<c.length;g++)if(c[g][0]+.5*p[g]-e>0){f=g,m=!0;break}}else if(i==="closest"){let g=1/0;for(let v=0;v<c.length;v++){let y=c[v][0]+.5*p[v],_=Math.abs(y-e);_<g&&(g=_,f=v,m=!0)}}else for(let g=0;g<c.length;g++){let v=c[g][0],y=c[g][0]+p[g];if(e>=v&&e<y){f=g,m=!0;break}}return m||(f=c.length),{index:this.getGlobalIndexFromLineAndCharIndexes(r,d,f),lineIndex:d,characterIndex:f}}getGlobalIndexFromLineAndCharIndexes(e,t,i){return e.slice(0,t).reduce((r,n)=>r+n.length,0)+i}showSelectionMesh(){this.selectionMesh.material.opacity=this._selectionVisibleAlpha}hideSelectionMesh(){this.selectionMesh.material.opacity=0}showCaretMesh(){this.caretMesh.material.opacity=this._caretVisibleAlpha}hideCaretMesh(){this.caretMesh.material.opacity=0}};function I7(e,t,i){let{charCoords:r,charWidths:n,initialOffsetY:s,lineHeight:a}=e;if(r[t]&&r[t].length===0||r.length===0){let d=0,{horizontalAlign:c}=e.data.geometry,p=e.wrappedText,{width:f}=e.geometry.userData.parameters;return p.length===1&&p[0].length===0&&(c===3?d=.5*f:c===2&&(d=f)),[d,s-a*t]}let o=r[t];if(o===void 0||o.length===0)return[0,0];let[l,h]=o[Math.min(i,o.length-1)],u=l;return i>=o.length&&(u+=n[t][i-1]),[u,h]}function cI(e,t){let i=0;for(let r=0;r<e.length;r++){let n=e[r],s=t-i;if(s<=n.length)return[r,s];i+=n.length}return[Math.max(0,e.length-1),e[e.length-1]?.length??0]}function W8e(e,t){return typeof e=="string"?t.data.colors[e]:e}function H8e(e){return e.colors[0]}ae();var q8e=class{constructor(){this._clickCount=0,this._lastTime=0,this._lastPosition=[0,0],this._delay=500,this._distance=2,this._onMouseDown=e=>{let t=[e.clientX,e.clientY],i=new Date().getTime();if(this._clickCount>0){let r=t[0]-this._lastPosition[0],n=t[1]-this._lastPosition[1];Math.sqrt(r*r+n*n)>this._distance&&(this._clickCount=0)}this._lastPosition=t,this._clickCount=i-this._lastTime>this._delay?1:this._clickCount+1,this._lastTime=i},this._onMouseUp=e=>{}}start(e,t=500,i=2){this._target&&this.stop(),this.reset(),this._delay=t,this._distance=i,this._target=e,this._target.addEventListener("pointerdown",this._onMouseDown,!1),this._target.addEventListener("pointerup",this._onMouseUp,!1)}stop(){this._target&&(this._target.removeEventListener("pointerdown",this._onMouseDown,!1),this._target.removeEventListener("pointerup",this._onMouseUp,!1),this._target=void 0)}get clickCount(){return this._clickCount}reset(){this._clickCount=0,this._lastTime=0,this._lastPosition=[0,0]}};jr();var $8e=new R(0,0,1),Nye=new R,Iye=new R,Oye=new oi,X8e=class{constructor(e,t,i,r,n){this.containerScene=e,this.raycaster=t,this.sharedAssets=i,this.requestRender=r,this.onExit=n,this.htmlInput=null,this.virtualInput=null,this.helper=new Y3e,this.doubleClickHandler=new q8e,this.isDragging=!1,this.plane=new qa,this.caretInterval=0,this.planeIntersection=new R,this.projected=new Z,this._lastIndex=0,this._isFirstDragMove=!1,this.selectionOnDragStart=0,this.onTextMaterialChanged=()=>{let s=this.virtualInput?.data;if(this.virtualInput!==void 0&&s){let a=s.material,o=function(l,h){let u=Ks.fromHex(3223857),d=.8;for(let c of l.layers){if(c.data.type==="light"||c.data.type==="displace"||c.data.type==="fresnel"||c.data.type==="dust"||c.data.type==="matcap"||c.data.type==="texture"||c.data.type==="toon"||c.data.type==="outline"||c.data.type==="transmission"||c.data.type==="noise"||c.data.type==="vertexColor")continue;let p=typeof c.data.alpha=="string"?Number(h.getVariable(c.data.alpha)):c.data.alpha;if(c.data.type==="color"&&p>.3){u=W8e(c.data.color,h),d=p;break}if((c.data.type==="depth"||c.data.type==="gradient")&&p>.3){let f=H8e(c.data);u={r:f[0],g:f[1],b:f[2]},d=typeof c.data.alpha=="string"?1:c.data.alpha;break}}return{...u,a:d}}(typeof a=="string"?this.sharedAssets.data.materials[a]:a,this.sharedAssets);this.helper.setCaretColor(o)}},this.stopAnimateTextCursor=()=>{clearInterval(this.caretInterval),this.helper&&(this.helper.caretMesh.visible=!1)},this.startAnimateTextCursor=()=>{this.stopAnimateTextCursor(),this.helper&&(this.helper.caretMesh.visible=!0,this.caretInterval=setInterval(()=>{this.helper&&(this.helper.caretMesh.visible=!this.helper.caretMesh.visible),this.requestRender()},600))},this.handleCaretUpdate=s=>{if(!this.htmlInput||!this.virtualInput)return;let a=this.helper,o=s?.key==="ArrowLeft"||s?.key==="ArrowRight",l=s?.key==="ArrowUp"||s?.key==="ArrowDown";this.htmlInput.selectionStart===this.htmlInput.selectionEnd?(a.setCaretPosition(this.htmlInput.selectionStart,{horizontalKeyMove:o,verticalKeyMove:l}),this.startAnimateTextCursor()):a.setSelection(this.htmlInput.selectionStart,this.htmlInput.selectionEnd),this.requestRender()},this.containerScene.add(this.helper)}createInput(){return this.htmlInput=function(){let e=document.createElement("textarea");return e.style.position="fixed",e.style.top="200px",e.style.left="400px",e.style.zIndex="-1",e.style.border="1px solid rgba(255,0,0,0.5)",e.style.width="10px",e.style.height="500px",e.style.color="white",e.style.opacity="0.5",e.style.background="transparent",e.style.display="none",e.style.margin="0px",e.style.padding="0px",e.style.boxSizing="content-box",e.style.pointerEvents="none",e}(),this.htmlInput}connect(){}disconnect(){this.stopAnimateTextCursor(),this.helper.hide(),this.htmlInput?.remove(),this.doubleClickHandler.stop()}handleMouseDown(){if(!this.htmlInput||!this.virtualInput)return!0;this.getPointOnPlane();let e=this.doubleClickHandler.clickCount,t=this.helper.getSelectionFromPosition(this.projected.x,this.projected.y,e>1?"inside":"previous")??{index:0,lineIndex:0,characterIndex:0},{lineIndex:i}=t,{index:r,characterIndex:n}=t;this.virtualInput?.wrappedText?.length&&this.virtualInput.wrappedText[i][Math.max(0,n-1)]===`
|
|
13011
13011
|
`&&(r--,n--),this._lastIndex=r,this._isFirstDragMove=!0;let s=this.checkClickedObject();if(e===1){if(s===null)return this.onExit(this.virtualInput),!0;this.selectionOnDragStart=r,this.isDragging=!0,this.setInputSelection(r)}else s===this.virtualInput&&(e===2?this.selectClosestWord(i,n):e>2&&(this.setInputSelection(0,this.htmlInput.value.length),this.doubleClickHandler.reset()))}handleMouseUp(){this.applyRangeToTextInput(),this.isDragging=!1,this._isFirstDragMove=!1}handleMouseMove(){!this.virtualInput||(this._isFirstDragMove&&this.doubleClickHandler.clickCount>1&&(this.selectionOnDragStart=this._lastIndex,this.isDragging=!0,this.setInputSelection(this._lastIndex)),this._isFirstDragMove=!1,this.getPointOnPlane(),this.applyRangeToTextInput())}focus(e){if(this.virtualInput=e,this.updateTextInputStyles(),this.htmlInput)if(e){let t=this.data?.geometry.text;this.htmlInput.value=typeof t=="string"?"":t?.textValue.toString()??""}else this.htmlInput.value=""}blur(){}get data(){let{virtualInput:e}=this;if(e)return e.dataPatched}applyRangeToTextInput(){if(!this.isDragging||!this.virtualInput||!this.htmlInput)return;let e=this.selectionOnDragStart,{index:t,lineIndex:i,characterIndex:r}=this.helper.getSelectionFromPosition(this.projected.x,this.projected.y,this.doubleClickHandler.clickCount>2?"inside":"previous")??{index:0},n=t;i!==void 0&&r!==void 0&&this.virtualInput?.wrappedText[i][r-1]===`
|
|
13012
|
-
`&&n--,this.htmlInput.setSelectionRange(Math.min(e,n),Math.max(e,n))}checkClickedObject(){if(this.virtualInput){let e=this.raycaster.intersectObject(this.virtualInput,!1);if(e.length>0){let t=e[0];if(t.object instanceof NZ)return t.object}}return null}selectClosestWord(e,t){if(!this.virtualInput)return;let i=this.virtualInput.wrappedText,r=i[e],n=t+1,s=t;r[t]!==" "&&(n=this.findNextCharOccurence(r,t,"forward"," "),s=this.findNextCharOccurence(r,t,"backward"," "),s>0&&s++,n>=r.length-1&&e===i.length-1&&n++);let a=this.helper,o=a.getGlobalIndexFromLineAndCharIndexes(i,e,s),l=a.getGlobalIndexFromLineAndCharIndexes(i,e,n);this.setInputSelection(o,l)}findNextCharOccurence(e,t,i,r=" "){let n=Math.max(0,e.length-1),s=i==="forward"?n:0,a=i==="forward"?1:-1,o=Math.max(Math.min(t,n),0);for(;o!==s;)if(o+=a,e.charAt(o)===r)return o;return s}getPointOnPlane(){let e=this.virtualInput?.data;if(this.virtualInput&&e&&this.raycaster.ray.intersectsPlane(this.plane)){this.planeIntersection===null&&(this.planeIntersection=new R);let t=this.raycaster.ray.intersectPlane(this.plane,this.planeIntersection);if(t){this.planeIntersection.copy(this.virtualInput.worldToLocal(t));let i=typeof e.geometry.width=="number"?e.geometry.width:1,r=typeof e.geometry.height=="number"?e.geometry.height:1;this.projected.set(t.x+.5*i,t.y-.5*r)}}}updatePlane(){let e=this.virtualInput?.data;this.virtualInput&&e&&(Oye.getNormalMatrix(this.virtualInput.matrixWorld),Nye.copy($8e).applyMatrix3(Oye).normalize(),this.virtualInput.localToWorld(Iye.set(0,0,e.geometry.depth)),this.plane.setFromNormalAndCoplanarPoint(Nye,Iye))}setInputSelection(e,t=e){this.htmlInput?.setSelectionRange(e,t),l1&&this.htmlInput?.focus(),setTimeout(()=>{this.htmlInput?.focus()})}updateTextInputStyles(){let e=this.virtualInput?.data;this.virtualInput&&e&&this.htmlInput&&(this.htmlInput.style.fontSize=e.geometry.fontSize+"px",this.htmlInput.style.letterSpacing=e.geometry.letterSpacing*e.geometry.fontSize+"px",this.htmlInput.style.lineHeight=e.geometry.fontSize*e.geometry.lineHeight+"px",this.htmlInput.style.width=e.geometry.width+"px",this.htmlInput.style.height=e.geometry.height+"px",this.htmlInput.style.textAlign=function(t){return t===4?"justify":t===2?"right":t===3?"center":"left"}(e.geometry.horizontalAlign))}},K3e=(e,t)=>{if(typeof e=="string"){let i=t.data(e);if(i)return K3e(i.value,t)}return Mo.getDisplayedValue(e)};function Lye(e,t){let i=e.text,r="";if(typeof i=="string"){let n=t.variables.data(r);n&&(r=K3e(n.value,t.variables))}else r=i.textValue.toString();return r}var Y8e=class extends nl{constructor(e,t){super(e),this.eventManager=t,this._textInputs=[],this.sceneHelpers=new Ko,this.helper=new Y3e,this._onMouseDownFocusIn=i=>{if(vi.length>1)return;this.eventContext.updateRaycaster(i);let r=null;if(this.eventContext.raycaster){for(let n of this._textInputs)if(this.eventContext.raycaster.intersectObject(n,!0).length>0){r=n;break}}this.focusOnTextInput(r),this._onCaretUpdate(),this._onMouseUp(),this.textInputManager.doubleClickHandler.start(this.eventContext.domElement),this.textInputManager.doubleClickHandler._onMouseDown(i),this._onMouseDown(i)},this.onExit=()=>{let{virtualInput:i}=this.textInputManager;if(i===null)return;let r=this.textInputManager.htmlInput;this.helper.hide(),r?.setSelectionRange(r.value.length,r.value.length),this.eventManager.controlsManager.orbitControls&&(this.eventManager.controlsManager.orbitControls.enabled=!0);let{domElement:n}=this.eventContext;n.removeEventListener("pointerdown",this._onMouseDown,!1),n.removeEventListener("pointerup",this._onMouseUp,!1),n.removeEventListener("pointermove",this._onMouseMove,!1),window.removeEventListener("keydown",this._onKeyPress),this.textInputManager.doubleClickHandler.reset(),n.addEventListener("pointerdown",this._onMouseDownFocusIn),this.eventContext.renderer.sceneHelpersOnTop=void 0,this.eventContext.renderer.pipeline.disableHelpers()},this._onMouseDown=i=>{this.eventContext.updateRaycaster(i),this.textInputManager.handleMouseDown(),this.textInputManager.virtualInput&&this.eventContext.raycaster.intersectObject(this.textInputManager.virtualInput,!0).length>0&&this.eventManager.controlsManager.orbitControls&&(this.eventManager.controlsManager.orbitControls.enabled=!1)},this._onMouseUp=()=>{this.textInputManager.handleMouseUp(),this.eventManager.controlsManager.orbitControls&&!this.eventManager.controlsManager.orbitControls.enabled&&(this.eventManager.controlsManager.orbitControls.enabled=!0)},this._onMouseMove=i=>{this.eventContext.updateRaycaster(i),this.textInputManager.handleMouseMove()},this._onTextEdit=i=>{let{htmlInput:r,virtualInput:n,helper:s}=this.textInputManager;if(!r||!n)return;let a=r.value;n.textGeometry.setText(a,this.eventContext.sharedAssets).then(()=>{this.eventContext.requestRender()});let o=n.data;s.update();let l=o.geometry.text;if(typeof l=="string"){let h=l;this.eventContext.sharedAssets.updateVariable(h,{textValue:a})}this.textInputManager.updateTextInputStyles(),this._onCaretUpdate()},this._onCaretUpdate=i=>{this.textInputManager.handleCaretUpdate(i)},this._onKeyPress=i=>{i.key==="Escape"&&this.onExit()},this.textInputManager=new X8e(this.sceneHelpers,e.raycaster,e.sharedAssets,e.requestRender,this.onExit)}connect(){let e=[];if(this.eventContext.scene.traverseEntity(r=>{r instanceof NZ&&e.push(r)}),this._textInputs=e,e.length===0)return;let{domElement:t}=this.eventContext;t.addEventListener("pointerdown",this._onMouseDownFocusIn),this.textInputManager.connect();let i=this.textInputManager.createInput();document.body.appendChild(i),i.style.display="none",i.addEventListener("keyup",this._onCaretUpdate),i.addEventListener("keydown",this._onCaretUpdate),i.addEventListener("beforeinput",this._onCaretUpdate),i.addEventListener("paste",this._onCaretUpdate),i.addEventListener("cut",this._onCaretUpdate),i.addEventListener("select",this._onCaretUpdate),i.addEventListener("selectstart",this._onCaretUpdate)}disconnect(){let e=this.textInputManager.htmlInput,{domElement:t,sharedAssets:i}=this.eventContext;t.removeEventListener("pointerdown",this._onMouseDownFocusIn),e?.removeEventListener("keyup",this._onCaretUpdate),e?.removeEventListener("keydown",this._onCaretUpdate),e?.removeEventListener("beforeinput",this._onCaretUpdate),e?.removeEventListener("paste",this._onCaretUpdate),e?.removeEventListener("cut",this._onCaretUpdate),e?.removeEventListener("select",this._onCaretUpdate),e?.removeEventListener("selectstart",this._onCaretUpdate),this._textInputs.forEach(r=>{let n=Lye(r.data.geometry,this.eventContext.sharedAssets.data);r.textGeometry.setText(n,i)}),t.removeEventListener("pointerdown",this._onMouseDown,!1),t.removeEventListener("pointerup",this._onMouseUp,!1),t.removeEventListener("pointermove",this._onMouseMove,!1),window.removeEventListener("keydown",this._onKeyPress),this.eventContext.renderer.sceneHelpersOnTop=void 0,this.eventContext.renderer.pipeline.disableHelpers(),this.textInputManager.disconnect()}focusOnTextInput(e){this.textInputManager.focus(e),this.textInputManager.onTextMaterialChanged();let t=this.textInputManager.htmlInput;if(!t||e===null)return;this.textInputManager.updateTextInputStyles(),this.eventContext.renderer.sceneHelpersOnTop=this.sceneHelpers,this.eventContext.renderer.pipeline.enableHelpers(),this.textInputManager.isDragging=!1;let i=Lye(e.textGeometry.userData.parameters,this.eventContext.sharedAssets.data);t.value=i,t.setSelectionRange(0,0),this.textInputManager.helper.show(e),t.style.display="block",t.addEventListener("input",this._onTextEdit),this.textInputManager.updatePlane();let{domElement:r}=this.eventContext;r.removeEventListener("pointerdown",this._onMouseDownFocusIn),r.addEventListener("pointerdown",this._onMouseDown,!1),r.addEventListener("pointerup",this._onMouseUp,!1),r.addEventListener("pointermove",this._onMouseMove,!1),window.addEventListener("keydown",this._onKeyPress)}};_r(),Fh("Textfields",({eventContext:e,eventManager:t})=>new Y8e(e,t)),Tw("InputGeometry",(e,t,i)=>new NZ(e,t,i)),In("textinputs"),jY();var Z3e=new Map,nA=new Map,pI=class{constructor(e,t,i,r){this.data=t,this.isPlayAudioAction=!0;let{audio:n,volume:s,delay:a,loop:o}=t;if(!n)throw new Error("Missing property");try{let l=typeof n=="string"?r.getAudio(n).src:n.data;this.audioPlayer=new sx({src:l,volume:s,delay:a,loop:o})}catch{console.warn(`Could not create an audio player for this object: "${i.name}" and this audio: "${n}"`)}nA.has(i.uuid)?nA.get(i.uuid).push(this):nA.set(i.uuid,[this]),Z3e.set(e,this)}playByToggle(){this.data.toggle==="stop"?this.audioPlayer?.status==="playing"?this.audioPlayer.stop():(this.audioPlayer?.stop(),this.audioPlayer?.play()):this.data.toggle==="pause"?this.audioPlayer?.status==="playing"?this.audioPlayer?.pause():this.audioPlayer?.play():(this.audioPlayer?.stop(),this.audioPlayer?.play())}dispose(){this.audioPlayer?.stop()}},K8e=class{constructor(e){this.data=e,this.isPauseAudioAction=!0}dispatch(){this.data.playAudio?this.pauseAudio(this.data.playAudio):this.data.object?this.pauseAllAudiosFromObject(this.data.object):this.pauseAllAudios()}pauseAudio(e){let t=Z3e.get(e);!t||(this.data.delay>0?(this.disposeDelay(),this.timeoutId=window.setTimeout(()=>{t.audioPlayer?.[this.data.interaction](),this.disposeDelay()},this.data.delay)):t.audioPlayer?.[this.data.interaction]())}pauseAllAudiosFromObject(e){let t=nA.get(e);!t?.length||(this.data.delay>0?(this.disposeDelay(),this.timeoutId=window.setTimeout(()=>{t.forEach(i=>i.audioPlayer?.[this.data.interaction]()),this.disposeDelay()},this.data.delay)):t.forEach(i=>i.audioPlayer?.[this.data.interaction]()))}pauseAllAudios(){let e=[...nA.values()];!e.length||(this.data.delay>0?(this.disposeDelay(),this.timeoutId=window.setTimeout(()=>{e.forEach(t=>{t.forEach(i=>{i.audioPlayer?.[this.data.interaction]()})}),this.disposeDelay()},this.data.delay)):e.forEach(t=>{t.forEach(i=>{i.audioPlayer?.[this.data.interaction]()})}))}disposeDelay(){clearTimeout(this.timeoutId),delete this.timeoutId}dispose(){clearTimeout(this.timeoutId),delete this.timeoutId}},Z8e=class{constructor(e,t,i,r,n){if(this.data=t,this.shared=r,this.condition=n,t.interaction==="play")this.interaction=new pI(e,t,i,r);else{if(t.interaction!=="pause"&&t.interaction!=="stop")throw new Error("Missing property");this.interaction=new K8e(t)}}dispatchBasic(){if(Nn(this.shared,this.condition)===!1)return!1;this.interaction instanceof pI?this.interaction.playByToggle():this.interaction.dispatch()}dispatchConditional(){if(Nn(this.shared,this.condition)===!1)return!1;this.interaction instanceof pI?this.interaction.audioPlayer?.play():this.interaction.dispatch()}dispatchGameControl(e){if(Nn(this.shared,this.condition)===!1)return!1;this.interaction instanceof pI&&(e==="start"?this.interaction.audioPlayer?.play():this.interaction.audioPlayer?.stop())}dispose(){this.interaction.dispose()}};_r(),Jo("Audio",({id:e,data:t,object:i,shared:r,actionCondition:n})=>new Z8e(e,t,i,r,n)),In("audio"),jr();var Q3e=new Map,sA=new Map,O7=class{constructor(e,t,i){this.data=t,this.isPlayVideoAction=!0,this.delay=0,this.status="stopped";let{layerId:r,loop:n,volume:s,delay:a}=t;if(this.object=i,r===void 0)throw new Error("Missing property");let o=function(l,h){let u;if("material"in l){let c=l.material;u=Array.isArray(c)?l.material[0].layers.find(p=>p.uuid===h):l.material.layers.find(p=>p.uuid===h)}if(!u)return;let d=u.color?.texture?.image?.img??u.holders?.find(c=>c.isVideo)?.img;return d instanceof HTMLVideoElement?d:void 0}(i,r);o&&(this.videoElement=o,this.videoElement.loop=n===1/0,l1&&(this.videoElement.autoplay=!0),s!==void 0&&(this.videoElement.volume=s)),a!==void 0&&(this.delay=a),sA.has(i.uuid)?sA.get(i.uuid).push(this):sA.set(i.uuid,[this]),Q3e.set(e,this),this.pause()}mute(){!this.videoElement||(this.videoElement.muted=!0)}unMute(){!this.videoElement||(this.videoElement.muted=!1)}play(e){if(!this.videoElement)return;let t=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);e?(this.mute(),this.delay+=150):t?(this.mute(),window.setTimeout(()=>{this.unMute()},100)):this.unMute(),this.delayTimerId=window.setTimeout(()=>{if(!this.videoElement)return;let i=this.videoElement.play();i!==void 0&&i.then(r=>{}).catch(r=>{this.play()}),this.clearDelay()},this.delay),this.status="playing"}clearDelay(){this.delayTimerId&&(clearTimeout(this.delayTimerId),delete this.delayTimerId)}pause(){!this.videoElement||(this.videoElement.pause(),this.status="paused")}stop(){!this.videoElement||(this.videoElement.pause(),this.videoElement.currentTime=0,this.status="stopped",this.clearDelay())}seek(e){return new Promise(t=>{if(!this.videoElement)return t();let i=this.videoElement.duration;if(i>0){let r=e%i;this.videoElement.currentTime=r}this.videoElement.addEventListener("seeked",()=>t(),{once:!0})})}playByToggle(){this.data.toggle==="stop"?this.status==="playing"?this.stop():(this.stop(),this.play()):this.data.toggle==="pause"?this.status==="playing"?this.pause():this.play():(this.stop(),this.play())}dispose(){!this.videoElement||(this.stop(),this.videoElement.muted=!0)}},Q8e=class{constructor(e){this.data=e,this.isPauseVideoAction=!0}dispatch(){this.data.playVideo?this.pauseVideo(this.data.playVideo):this.data.object?this.pauseAllVideosFromObject(this.data.object):this.pauseAllVideos()}pauseVideo(e){let t=Q3e.get(e);!t||(this.data.delay>0?(this.disposeDelay(),this.timeoutId=window.setTimeout(()=>{t[this.data.interaction](),this.disposeDelay()},this.data.delay)):t[this.data.interaction]())}pauseAllVideosFromObject(e){let t=sA.get(e);!t?.length||(this.data.delay>0?(this.disposeDelay(),this.timeoutId=window.setTimeout(()=>{t.forEach(i=>i[this.data.interaction]()),this.disposeDelay()},this.data.delay)):t.forEach(i=>i[this.data.interaction]()))}pauseAllVideos(){let e=[...sA.values()];!e.length||(this.data.delay>0?(this.disposeDelay(),this.timeoutId=window.setTimeout(()=>{e.forEach(t=>{t.forEach(i=>{i[this.data.interaction]()})}),this.disposeDelay()},this.data.delay)):e.forEach(t=>{t.forEach(i=>{i[this.data.interaction]()})}))}disposeDelay(){clearTimeout(this.timeoutId),delete this.timeoutId}dispose(){clearTimeout(this.timeoutId),delete this.timeoutId}},J8e=class{constructor(e,t,i,r,n){if(this.data=t,this.shared=r,this.condition=n,t.interaction==="play")this.interaction=new O7(e,t,i);else{if(t.interaction!=="pause"&&t.interaction!=="stop")throw new Error("Missing property");this.interaction=new Q8e(t)}}dispatchBasic(){if(Nn(this.shared,this.condition)===!1)return!1;this.interaction instanceof O7?this.interaction.playByToggle():this.interaction.dispatch()}dispatchConditional(){if(Nn(this.shared,this.condition)===!1)return!1;this.interaction instanceof O7?this.interaction.play():this.interaction.dispatch()}dispose(){this.interaction.dispose()}};Zn(),_r(),Jo("Video",({id:e,data:t,object:i,shared:r,actionCondition:n})=>Jl(i)?null:new J8e(e,t,i,r,n)),In("video"),jr(),ae(),zB(),Pw();var L7=(()=>{let e,t,i,r,n=!1;function s(l){!e&&!Bye()&&(t?.sharedGameControlGlobals.createdObjects.length??0)>0&&(e=requestAnimationFrame(a)),l&&(t=l,r=l.requestRender,!n&&typeof document<"u"&&(document.addEventListener("visibilitychange",o),n=!0))}function a(l){if(!t||!r)return e=void 0,void(i=void 0);let h=i?l-i:0,u=t.sharedGameControlGlobals.createdObjects,d=t.sharedGameControlGlobals.nCreatedPerAction,c=u.length,p=0;for(;p<c;){let f=u[p];f.userData.createdTime===void 0&&(f.userData.createdTime=l),f.userData.lifetime===void 0&&f.userData.quantity===void 0||f.userData.lifetime&&l-f.userData.createdTime<f.userData.lifetime||f.userData.quantity&&d[f.userData.actionId]<=f.userData.quantity?(f.userData.velocity&&(f.position.addScaledVector(f.userData.velocity,h/1e3),f.updateMatrix(),f.userData.parentMatrix&&f.matrix.premultiply(f.userData.parentMatrix),r()),p++):(d[f.userData.actionId]>f.userData.quantity&&d[f.userData.actionId]--,u.splice(p,1),f.removeFromParent(),t.sharedGameControlGlobals.rapierWorld&&f.rigidBody?(t.sharedGameControlGlobals.colliderToEntity.delete(f.rigidBody.collider(0).handle),t.sharedGameControlGlobals.rapierWorld.removeRigidBody(f.rigidBody)):(f.bvhGeometry=void 0,t.sharedGameControlGlobals.entitiesWithTransformAnim=t.sharedGameControlGlobals.entitiesWithTransformAnim.filter(m=>m.bvhGeometry!==void 0)),c--,r())}e=p>0?requestAnimationFrame(a):void 0,i=p>0?l:void 0}function o(){Bye()?e&&(cancelAnimationFrame(e),e=void 0,i=void 0):s()}return{play:s,dispose:function(){e&&(cancelAnimationFrame(e),e=void 0),n&&typeof document<"u"&&(document.removeEventListener("visibilitychange",o),n=!1),t=void 0,r=void 0,i=void 0}}})();function Bye(){return!!document&&document.hidden}var Fye=new jt,eGe=new R,tGe=new R,iGe=class{constructor(e,t,i,r,n){this.data=e,this.page=t,this.controlsManager=i,this.shared=r,this.condition=n,this.intervalId=null,this.timeoutIdQueue=[],this.uniqueId=et.generateUUID(),this.dispatch=()=>{if(Nn(this.shared,this.condition)===!1)return!1;this.data.delay?this.timeoutIdQueue.push(window.setTimeout(this.dispatchInner,1e3*this.data.delay)):this.dispatchInner()},this.dispatchFromStart=()=>{if(Nn(this.shared,this.condition)===!1)return!1;this.timeoutIdQueue.push(window.setTimeout(this.dispatchInner,1e3*this.data.delay))},this.dispatchThrottled=function(a,o=0,l={}){return TA(a,o,{leading:l.leading!==!1,trailing:l.trailing!==!1,maxWait:o})}(this.dispatch,1e3/this.data.creationSpeed),this.dispatchStart=()=>{this.intervalId===null&&(this.intervalId=window.setInterval(this.dispatch,1e3/this.data.creationSpeed))},this.dispatchStop=()=>{this.intervalId!==null&&(window.clearInterval(this.intervalId),this.intervalId=null)},this.dispatchInner=()=>{this.timeoutIdQueue.shift();let a=new Zo(this.object);if(a.playModeVisible=!0,a.expand(),this.data.coordinateSystem!=="world"){let l=this.data.coordinateSystem,h=this.page.scene.find(l);h&&(h.updateMatrixWorldRigid(),a.userData.parentMatrix=h.matrixWorldRigid)}a.scale.copy(this.object.scale),a.position.fromArray(this.data.position.map(l=>typeof l=="number"?l:0)),a.rotation.fromArray(this.data.rotation.map(l=>typeof l=="number"?l:0)),a.updateMatrix(),a.userData.parentMatrix&&a.matrix.premultiply(a.userData.parentMatrix),this.page.add(a);let o=this.controlsManager.sharedGameControlGlobals;o.createdObjects.push(a),o.nCreatedPerAction[this.uniqueId]===void 0?o.nCreatedPerAction[this.uniqueId]=1:o.nCreatedPerAction[this.uniqueId]++,a.updateWorldMatrix(!0,!0),a.traverseObject(this.traverseObjectCB),L7.play(),this.controlsManager.requestRender()},this.traverseObjectCB=a=>{let o;if(a.updateMatrixWorldRigid(),this.controlsManager.sharedGameControlGlobals.rapierWorld){if(a instanceof Xf){if(!a.objectForSample)return a.object.dataPatched.physics.fusedBody===!0&&a.object.dataPatched.physics.rigidBody==="dynamic"||void 0;if(a.objectForSample.dataPatched.physics.fusedBody)return;o=a.object}else if(a instanceof Zo)o=a.object;else if(o=a,o.dataPatched.cloner?.hideBase)return!0}else{if(a instanceof Xf)return;o=a instanceof Zo?a.object:a}this.data.destroy==="Time"?a.userData.lifetime=1e3*this.data.lifetime:this.data.destroy==="Quantity"&&(a.userData.quantity=this.data.destroyAfterQuantity,a.userData.actionId=this.uniqueId);let l=new R().fromArray(this.data.velocity.map(u=>typeof u=="number"?u:0)),h=o.dataPatched;if(!(h.physics.enabled==="visibility"?!h.visible:!h.physics.enabled)&&(this.controlsManager.sharedGameControlGlobals.rapierWorld?(this.controlsManager.addRigidBody(a,o,{fromCreate:!0,dynamic:this.data.dynamic}),this.data.destroy==="Collision"&&(a.rigidBody?.collider(0).setActiveEvents(1),a.userData.hasCollisionDestroy=!0),a.matrixWorld.decompose(eGe,Fye,tGe),l.applyQuaternion(Fye),this.data.velocity.some(u=>u!==0)&&this.data.dynamic&&a.rigidBody?.setLinvel(l.divideScalar(this.controlsManager.pixelsPerMeter),!0)):("geometry"in a.object&&this.controlsManager.addBoundsTree(a),this.data.velocity.some(u=>u!==0)&&this.data.dynamic&&(a.userData.velocity=l)),o.dataPatched.physics?.fusedBody===!0))return!0};let s=this.page.scene.find(this.data.object);if(!s)throw new Error("Missing Property");if(this.object=s,this.data.coordinateSystem!=="world"&&!this.page.scene.find(this.data.coordinateSystem))throw new Error("Missing Property");L7.play(i)}dispose(){this.intervalId!==null&&(window.clearInterval(this.intervalId),this.intervalId=null),this.timeoutIdQueue.forEach(e=>window.clearTimeout(e)),this.timeoutIdQueue=[],this.dispatchThrottled.cancel(),this.page.remove(...this.controlsManager.sharedGameControlGlobals.createdObjects),this.controlsManager.sharedGameControlGlobals.createdObjects=[],L7.dispose()}},rGe=class{constructor(e,t,i,r,n){this.data=e,this.page=t,this.controlsManager=i,this.shared=r,this.condition=n,this.timeoutIdQueue=[],this.dispatchInner=()=>{this.objects.forEach(this.destroyCallback)},this.destroyCallback=s=>{this.timeoutIdQueue.shift();let a=this.page.scene.find(s);if(a===void 0)return;let o=this.controlsManager.sharedGameControlGlobals.rapierWorld,l=!o||a.dataPatched.physics?.fusedBody;if(a.cloner){for(let h of a.cloner.children)l?(h.playModeVisible=!1,a.dataPatched.physics?.rigidBody==="positioned"&&this.removeBody(h),h.bvhGeometry&&(h.bvhGeometry=void 0)):this.clone===void 0||this.clone===h?(h.playModeVisible=!1,this.removeBody(h)):h.playModeVisible===void 0&&(h.playModeVisible=!0);a.cloner.syncInstanceMatrices(),(l||this.clone===void 0||this.clone===!1)&&(a.visible=!1,this.removeBody(a),a.bvhGeometry&&(a.bvhGeometry=void 0))}else this.removeBody(a),a.bvhGeometry&&(a.bvhGeometry=void 0),a.visible=!1;this.controlsManager.sharedGameControlGlobals.entitiesWithTransformAnim=o===void 0?this.controlsManager.sharedGameControlGlobals.entitiesWithTransformAnim.filter(h=>h.bvhGeometry!==void 0):this.controlsManager.sharedGameControlGlobals.entitiesWithTransformAnim.filter(h=>h.rigidBody!==void 0),a.destroyedInAction=!0,this.controlsManager.requestRender()},this.objects=[...e.objects]}removeBody(e){let t=e.rigidBody;if(!t)return;let i=this.controlsManager.sharedGameControlGlobals;i.colliderToEntity.delete(t.collider(0).handle),i.kinematicBodyToEntity.delete(t.handle);let r=this.controlsManager;r.fixedBodiesToWatch=r.fixedBodiesToWatch.filter(([,n])=>n!==t),i.rapierWorld.removeRigidBody(t),e.rigidBody=void 0}dispatch(e){if(Nn(this.shared,this.condition)===!1)return!1;this.clone=e,this.data.delay?this.timeoutIdQueue.push(window.setTimeout(this.dispatchInner,1e3*this.data.delay)):this.dispatchInner()}dispatchFromStart(){if(Nn(this.shared,this.condition)===!1)return!1;this.timeoutIdQueue.push(window.setTimeout(this.dispatchInner,1e3*this.data.delay))}dispose(){this.timeoutIdQueue.forEach(e=>window.clearTimeout(e))}};_r(),Jo("Create",({data:e,page:t,eventManager:i,shared:r,actionCondition:n})=>new iGe(e,t,i.controlsManager,r,n)),Jo("Destroy",({data:e,page:t,eventManager:i,shared:r,actionCondition:n})=>new rGe(e,t,i.controlsManager,r,n)),In("create-destroy"),zt(),zt(),wl(),ae(),Oh(),Sl(),Zn();var Uye=new R;function IZ(e,t,i=!1){let r=[],n=s=>{let a=s.data;delete s.states,s.currentState=null,s.reversibleToState=null,s.currentTransitionEvent=null;for(let o of a.states){let l={...o.data};s.states||(s.states={}),s.states[o.id]=ny.patch(a,l)}kye(e.scene,s,null,t,a.events.find(o=>o.data.type==="Follow"||o.data.type==="LookAt")!==void 0),zye(e)};e.scene.traverse2D(n),e.traverseChildren(s=>{if(i&&(s.rigidBody?.setTranslation(s.position0,!0),s.rigidBody?.setRotation(s.rotation0,!0),s.rigidBody?.setLinvel(Uye,!0),s.rigidBody?.setAngvel(Uye,!0)),!nr.is(s))return;let a=s.uuid,o=s.data;if(delete s.states,s.uuid===d1)return;let l=!1;r.some(h=>e.scene.find(a)?.isDescendantOf(h))?l=!0:o.physics?.fusedBody===!0&&o.physics.rigidBody==="dynamic"&&r.push(a),s.data=o,s.currentState=null,s.reversibleToState=null,s.currentTransitionEvent=null,s.transitionState={settled:!0,state:null};for(let h of o.states){let u={...h.data};e.data.globalPhysics.usePhysics===!0&&o.physics&&(o.physics.rigidBody==="dynamic"||l)&&(h.data.position!==void 0&&delete u.position,h.data.rotation!==void 0&&delete u.rotation),s.states||(s.states={}),s.states[h.id]=Og.patch(o,u)}kye(e.scene,s,null,t,o.events.find(h=>h.data.type==="Follow"||h.data.type==="LookAt")!==void 0),$o(s)&&s.frame&&(s.frame.traverse(h=>n(h)),s.uiCanvas?.applySize())}),zye(e),e.frame&&(e.frame.traverse(s=>n(s)),e.uiCanvas?.applySize())}function zye(e){e.traverseEntity(t=>{for(let i of t.data.events){let r=[];switch(i.data.type){case"Follow":case"MouseHover":case"Scroll":case"MouseDown":case"MouseUp":case"MousePress":case"KeyUp":case"KeyDown":case"KeyPress":case"Collision":r.push(...i.data.actions);break;case"GameControl":for(let n of Object.values(i.data.gameActions))r.push(...n);break;case"DragDrop":r.push(...i.data.dragDropActions.drag,...i.data.dragDropActions.drop);break;case"Conditional":r.push(...i.data.inActions,...i.data.outActions)}for(let n of r)if(n.data.type==="Create"&&n.data.hideBase==="Yes"){let s=e.scene.find(n.data.object);s&&(s.visible=!1)}}})}function kye(e,t,i,r,n=!1){if(e.markShadowsDirty(),t instanceof zn&&!Zf(t)&&t.removeInteractionGeometry(r),Jl(t)?t.changeSelectedState(i,{shared:r},n):t.changeSelectedState(i,{scene:e,shared:r},n),t instanceof zn&&t.updateGeometryGroupsIfNeeded(),t instanceof Qn&&t.updateCameraState(t.dataPatched,{scene:e,shared:r}),!Jl(t)){if(t.cloner){let s=!1;for(let a of t.cloner.children)a.playModeVisible=void 0,a.transformOverride!==void 0&&(a.transformOverride=void 0,s=!0);s&&e.addPendingUpdateCloner(t),t.cloner.syncInstanceMatrices()}t.updateVisible()}}var nGe=class{constructor(e,t,i,r,n){this.data=e,this.page=t,this.eventManager=i,this.shared=r,this.condition=n,this.timeOutId=-1,this.scene=t.scene}dispatch(){if(Nn(this.shared,this.condition)===!1)return!1;this.data.target!==this.page.uuid&&(window.clearTimeout(this.timeOutId),this.timeOutId=window.setTimeout(()=>{this.play()},1e3*this.data.delay))}dispose(){window.clearTimeout(this.timeOutId)}play(){if(this.scene.children.every(t=>t.uuid!==this.data.target||t.data.uiScene))return;this.data.transition==="fade"&&this.data.duration>0&&this.eventManager.eventContext.renderer.renderFromSceneForSceneTransitionPass(this.scene,this.scene.activeCamera,1e3*this.data.duration),this.eventManager.deactivate(),this.eventManager.controlsManager.deactivate();let e=this.scene.activeCamera;this.scene.updatePage(this.data.target),this.scene.traverseVisibleEntity(t=>{t.type==="ParticleSystem"&&(t.sleep(),t.wakeUp(),t.data.autoPlay?t.start():t.stop())}),this.scene.activePage.switchToPlayCamera(),this.scene.activeCamera.copyViewPlaneSize(e),IZ(this.scene.activePage,this.shared),this.eventManager.activate(),this.eventManager.controlsManager.activate(this.eventManager)}};function sGe(e){return{easing:e.type,control1:qf(e.cubicControls?.control1,[0,0]),control2:qf(e.cubicControls?.control2,[1,1]),...e.springParameters}}function Tb(e,t){let i=[];for(let r of e??[]){let n=t(r.data);n!==void 0&&i.push({time:r.data.time,ease:sGe(r.data.easing),value:n})}return{keyframes:Jbe(i)}}function gc(e,t){if(e.keyframes.length===0)return;let{index0:i,index1:r,t:n}=Qbe(e.keyframes,t),s=e.read;if(s&&s.index0===i&&s.index1===r&&s.t===n)return;let a={index0:i,index1:r,from:e.keyframes[i].value,to:e.keyframes[r].value,t:n};return e.read=a,a}function aGe(e){e.read=void 0}function fI(e,t,i){return e+(t-e)*i}_r(),Jo("SceneTransition",({data:e,page:t,eventManager:i,shared:r,actionCondition:n})=>new nGe(e,t,i,r,n)),In("scene-transition"),zt(),ae(),zt(),zt(),ae(),Na(),Oh(),OB(),CK(),BB(),Sl(),Zn(),Ad(),oK(),sC(),zt(),jr(),zt(),ae(),Su();var{degToRad:mje,radToDeg:gje}=et;function fo(e,t,i,r,n,s){let a=i[e]!==void 0?i[e]:void 0,o=r[e];if(o==null)return;let l=a!=null?typeof a=="string"?Number(n.getVariable(a)??0):a:t[e],h=typeof o=="string"?Number(n.getVariable(o)??0):o;return l!==h?{update:u=>{let d=et.lerp(l,h,u);t[e]=s?Math.trunc(d):d},start:()=>{t[e]=l},end:()=>{t[e]=h}}:void 0}function NX(e,t,i,r,n,s){let a=i[e]?i[e]:void 0,o=r[e];if(!o)return;let l=t[e],h=[...a??l].map(d=>typeof d=="string"?Number(n.getVariable(d)??0):d),u=[...o].map(d=>typeof d=="string"?Number(n.getVariable(d)??0):d);return h.length!==u.length||yy(h,u)?void 0:{update:d=>{h.forEach((c,p)=>{let f=et.lerp(c,u[p],d);t[e][p]=s?Math.trunc(f):f})},start:()=>{Object.assign(t[e],h)},end:()=>{Object.assign(t[e],u)}}}function sB(e,t,i){return t.forEach((r,n)=>{e.setComponent(n,typeof r=="string"?Number(i.getVariable(r)??0):r)}),e}function Vye(e,t,i,r,n){let s=i[e]?i[e]:void 0,a=r[e];if(!a)return;let o=t[e],l=s?sB(new R,s,n):o.clone(),h=sB(new R,a,n);return l.equals(h)?void 0:{update:u=>{o.lerpVectors(l,h,u)},start:()=>{o.copy(l)},end:()=>{o.copy(h)}}}function Gye(e,t,i){return t.forEach((r,n)=>{e.setComponent(n,typeof r=="string"?Number(i.getVariable(r)??0):r)}),e}function mI(e,t,i,r,n){let s=i[e]?i[e]:void 0,a=r[e];if(!a)return;let o=t[e],l=!(o instanceof Z),h=o instanceof Z?o:new Z().fromArray(o),u=s?Gye(new Z,s,n):h.clone(),d=Gye(new Z,a,n);return u.equals(d)?void 0:{update:c=>{h.lerpVectors(u,d,c),l&&(t[e]=h.toArray())},start:()=>{h.copy(u),l&&(t[e]=h.toArray())},end:()=>{h.copy(d),l&&(t[e]=h.toArray())}}}function gI(e,t,i,r,n){let s=i[e]?i[e]:void 0,a=r[e];if(!a)return;let o=t[e],l=new kr(o.r,o.g,o.b,o.a),h=s?typeof s=="string"?n.getColor(s).clone():new kr(s.r,s.g,s.b,s.a):l.clone(),u=typeof a=="string"?n.getColor(a).clone():new kr(a.r,a.g,a.b,a.a);return h.equals(u)?void 0:{update:d=>{l.lerpColors(h,u,d);let c=et.lerp(h.a,u.a,d);l.a=c,t[e]={r:l.r,g:l.g,b:l.b,a:l.a}},start:()=>{l.copy(h)},end:()=>{l.copy(u)}}}function rg(e,t,i,r,n){return typeof t[e]=="number"?fo(e,t,i??{},r,n):Array.isArray(t[e])?NX(e,t,i??{},r,n):void 0}function oGe(e,t){if(e)for(let[i,r]of Object.entries(t)){let n=e[i];if(Array.isArray(n)&&Array.isArray(r)){let s=Math.min(n.length,r.length);for(let a=0;a<s;a++)n[a]=r[a]}else e[i]=r}}function vI(e,t,i,r){let n={};if(!t||!i)return n;for(let s of e){let a=t[s],o=i[s];if(typeof a=="number"&&typeof o=="number")n[s]=et.lerp(a,o,r);else if(Array.isArray(a)&&Array.isArray(o)){let l=Math.min(a.length,o.length);n[s]=Array.from({length:l},(h,u)=>et.lerp(a[u],o[u],r))}}return n}new R,new Dr;var jye=[["radial",RL],["linear",DL],["grid",NL],["toObject",IL],["randomnessObject",OL]];function J3e(e,t,i,r,n){let s=e.getValue(r);if(s!==void 0){if(r==="colors")return function(a,o,l,h="colors"){if(!a.hasValue(h)||!(h in l))return;let u=[],d=a.getValue(h),c=o?o[h]:d.map(f=>f.toArray()),p=l[h];for(let f=0;f<d.length;++f){let m=[...c[f]],g=[...p[f]];EA.isEqual(m,g)||u.push({update:v=>{d[f].fromArray(EA.lerp(m,g,v))},start:()=>{d[f].fromArray(m)},end:()=>{d[f].fromArray(g)}})}return u.length?u:void 0}(e,t,i,r);if(Array.isArray(s))return r==="steps"?function(a,o,l,h="steps"){if(!a.hasValue(h)||!(h in l))return;let u=[],d=a.getValue(h),c=o?o[h]:d,p=l[h];return yy(c,p)||u.push({update:f=>{let m=[...d];for(let g=0;g<d.length;++g){let v=c[g],y=p[g];m[g]=et.lerp(v,y,f)}a.setValue(h,m)},start:()=>{a.setValue(h,c)},end:()=>{a.setValue(h,p)}}),u.length?u:void 0}(e,t,i,r):void 0;if(typeof s=="number")return function(a,o,l,h,u){if(!a.hasValue(h)||!(h in l))return;let d=o?o[h]:a.getValue(h),c=l[h],p=typeof d=="string"?Number(u.getVariable(d)??0):d,f=typeof c=="string"?Number(u.getVariable(c)??0):c;return{update:m=>{a.setValue(h,et.lerp(p,f,m))},start:()=>{a.setValue(h,p)},end:()=>{a.setValue(h,f)}}}(e,t,i,r,n);if(typeof s!="boolean"){if(s instanceof Z)return function(a,o,l,h){if(!a.hasValue(h)||!(h in l))return;let u=a.getValue(h),d=o?new Z().fromArray(o[h]):u.clone(),c=new Z().fromArray(l[h]);return d.equals(c)?void 0:{update:p=>{u.lerpVectors(d,c,p)},start:()=>{u.copy(d)},end:()=>{u.copy(c)}}}(e,t,i,r);if(s instanceof R)return function(a,o,l,h,u){if(!a.hasValue(h)||!(h in l))return;let d=a.getValue(h),c=o?o[h]:void 0,p=l[h],f=c?sB(new R,c,u):d.clone(),m=sB(new R,p,u);return f.equals(m)?void 0:{update:g=>{d.lerpVectors(f,m,g)},start:()=>{d.copy(f)},end:()=>{d.copy(m)}}}(e,t,i,r,n);if(s instanceof kr)return function(a,o,l,h,u){if(!a.hasValue(h)||!(h in l))return;let d=o?o[h]:void 0,c=l[h],p=a.getValue(h),f=d?typeof d=="string"?u.color(d).clone():new lt().setRGB(d.r,d.g,d.b):p.clone(),m=typeof c=="string"?u.color(c).clone():new kr(c.r,c.g,c.b,c.a);if(f.equals(m))return;let g=p.clone();return{update:v=>{a.getValue(h)!==g&&a.setValue(h,g),g.lerpColors(f,m,v)},start:()=>{g.copy(f)},end:()=>{g.copy(m)}}}(e,t,i,r,n);if(s instanceof lt)return function(a,o,l,h,u){if(!a.hasValue(h)||!(h in l))return;let d=o?o[h]:void 0,c=l[h],p=a.getValue(h),f=d?typeof d=="string"?u.color(d).clone():new lt().setRGB(d.r,d.g,d.b):p.clone(),m=typeof c=="string"?u.color(c).clone():new lt().setRGB(c.r,c.g,c.b);if(f.equals(m))return;let g=p.clone();return{update:v=>{a.getValue(h)!==g&&a.setValue(h,g),g.lerpColors(f,m,v)},start:()=>{g.copy(f)},end:()=>{g.copy(m)}}}(e,t,i,r,n);if("isTexture"in s)return function(a,o,l,h="texture",u){if(!a.hasValue(h)||!(h in l))return;let d=T=>Number(typeof T=="string"?u?.getVariable(T)??0:T??0),c=a.getNode("rotation"),p=o?d(o[h]?.rotation):(c?.value??0)*et.RAD2DEG,f=d(l[h]?.rotation);if(c&&Math.abs(p-f)>1e-9)return{update:T=>{c.value=et.lerp(p,f,T)*et.DEG2RAD},start:()=>{c.value=p*et.DEG2RAD},end:()=>{c.value=f*et.DEG2RAD}};let m=function(T){let M=T.getNode("mat");if(typeof M?.updateMatrix=="function")return M;let E=T.getValue("mat");return typeof E?.updateMatrix=="function"?E:void 0}(a);if(!m)return;let g=o?o[h]:m,v=l[h],y=[...g.repeat],_=[...g.offset],b=[...v.repeat],x=[...v.offset],w=g.rotation??0,S=v.rotation??0;return Uc.isEqual(y,b)&&Uc.isEqual(_,x)&&w===S?void 0:{update:T=>{m.repeat=Uc.lerp(y,b,T),m.offset=Uc.lerp(_,x,T),m.rotation=et.lerp(w,S,T),m.updateMatrix()},start:()=>{m.repeat=[...y],m.offset=[..._],m.rotation=w,m.updateMatrix()},end:()=>{m.repeat=[...b],m.offset=[...x],m.rotation=S,m.updateMatrix()}}}(e,t,i,r,n)}}}function Wye(e,t,i,r){let n=[],s=t.layers?_u(t,r):e.transparent,a=_u(i,r);n.push(function(o,l,h){let u=l||h;return{update:d=>{o.setTransparent(d===1?h:u)}}}(e,s,a)),function(o,l,h){let u=o.ensureRainbowNoiseCompiled;if(typeof u=="function")for(let d of[...o.layers]){if(d.type!=="rainbow")continue;let c=l.layers?.data(d.uuid),p=h.layers.data(d.uuid);($f(c?.noiseStrength)||$f(p?.noiseStrength))&&u.call(o,d.uuid)}}(e,t,i);for(let o of e.layers){let l=t.layers?.data(o.uuid),h=i.layers.data(o.uuid);if(!h||o.type!=="light"&&(!(o.visible??1)||!(h.visible??1)))continue;let u=Cw[o.type]??[],d=o.getNames().filter(c=>!u.includes(c)&&!mB.some(p=>c.includes(p)));for(let c of d)try{let p=J3e(o,l,h,c,r);p&&(Array.isArray(p)?n.push(...p):n.push(p))}catch(p){console.error(`lerpMaterial: unexpected material layer for ${c}`,p)}}return n}function Hye(e,t,i,r,n,s){let a=J3e(t,i,r,e,s);!a||(Array.isArray(a)?a.forEach(o=>o.update(n)):a.update(n))}function qp(e,t,i){!e||(e[t]={...e[t],...i})}function lGe(e,t,i,r,n,s,a){let o=()=>{a.transform=!0,a.bounds=!0,a.boolean=!0,a.render=!0};switch(e.on){case"position":case"scale":{let l=gc(e.track,i);if(!l)return;let h=fI(l.from,l.to,l.t);return t[e.on][e.axis]=h,qp(s,e.on,{[e.axis]:h}),void o()}case"rotation":{let l=gc(e.track,i);if(!l)return;let h=fI(l.from,l.to,l.t);return t.rotation[e.axis]=h*et.DEG2RAD,qp(s,"rotation",{[e.axis]:h}),void o()}case"shapeSize":{let l=gc(e.track,i);if(!(l&&t instanceof zn))return;let h=fI(l.from,l.to,l.t);return t.userData.value={...t.userData.value,[e.axis]:h},qp(s,"shapeSize",{[e.axis]:h}),a.size=!0,a.bounds=!0,a.boolean=!0,void(a.render=!0)}case"opacity":{let l=gc(e.track,i);if(!l||!(t instanceof Es)||Array.isArray(t.material))return;let h=t.material.getLayersOfType("light")[0];if(h===void 0)return;let u=et.lerp(l.from,l.to,l.t),d=t.material,c=l.to>=1&&(l.t===1||l.from>=1);return d.setTransparent(!c||_u(d.data,r.shared),r.scene),Hye("alphaOverride",h,{alphaOverride:u},{alphaOverride:u+1},0,r.shared),s&&(s.opacity=u),void(a.render=!0)}case"material":{let l=gc(e.track,i);if(!l||Object.keys(l.from).length===0||Object.keys(l.to).length===0)return;let{layer:h}=e,u={};for(let d in h.data){if(!(d in l.from)||!(d in l.to))continue;let c=IX(l.from[d],l.to[d],l.t,n);if(c===void 0)continue;u[d]=c;let p=h.getValue(d);p!==void 0&&(d==="alpha"&&typeof p=="number"&&p>0&&t instanceof Es&&!Array.isArray(t.material)&&(t.material.transparent=!0),Hye(d,h,l.from,l.to,l.t,r.shared))}return qp(s,"material",{[h.uuid]:u}),void(a.render=!0)}case"light":{let l=gc(e.track,i);if(!l||!(t instanceof Rw||t instanceof hC||t instanceof Dw))return;let h=IX(l.from,l.to,l.t,n);return t[e.field]=h,qp(s,"light",{[e.field]:h}),void(a.render=!0)}case"camera":{let l=gc(e.track,i);if(!(l&&t instanceof Qn))return;let h=fI(l.from,l.to,l.t);return t[e.field]=h,void qp(s,"camera",{[e.field]:h})}case"cloner":{let l=gc(e.track,i);if(!l)return;let h=t.cloner?.parameters,u=function(d,c,p,f){if(!d)return{};let m=vI(["count"],c,p,f);m.count!==void 0&&(m.count=Math.trunc(m.count));for(let[g,v]of jye){if(!d[g])continue;let y=vI(v,c[g],p[g],f);Object.keys(y).length&&(m[g]=y)}return m}(h,l.from,l.to,l.t);return function(d,c){if(d){c.count!==void 0&&(d.count=c.count);for(let[p]of jye){let f=c[p];f&&oGe(d[p],f)}}}(h,u),qp(s,"cloner",u),a.cloner=!0,a.boolean=!0,void(a.render=!0)}case"pathExtrusion":{let l=gc(e.track,i);if(!l||!xB(t))return;let h=vI(zL,l.from,l.to,l.t),u=t.geometry.userData.parameters;return u.extrusion={...u.extrusion,...h},qp(s,"pathExtrusion",h),t.updateGeometryInteractions({extrusion:{...u.extrusion}},r.shared),a.bounds=!0,a.boolean=!0,void(a.render=!0)}case"pathSnapping":{let l=gc(e.track,i);if(!l)return;let h=t,u=vI(Sbe,l.from,l.to,l.t);return h.userData.pathSnapping={...h.userData.pathSnapping,...u},qp(s,"pathSnapping",u),h.updatePathSnapping(h.userData.pathSnapping),void(a.render=!0)}}}function IX(e,t,i,r){if(typeof e=="string"&&r&&(e=r.color(e)),typeof t=="string"&&r&&(t=r.color(t)),typeof e=="number")return et.lerp(e,t,i);if(Gr.is(e))return Gr.lerp(e,t,i);if(Ks.is(e))return Ks.lerp(e,t,i);if(Array.isArray(e))return(e.length>t.length?t:e).map((n,s)=>{if(Array.isArray(n)){let a=e[s].length>t[s].length?t[s].length:e[s].length;return(a===4?EA:a===3?jg:Uc).lerp(e[s],t[s],i)}return et.lerp(e[s],t[s],i)});if(typeof e=="object"&&e!==null){let n={};for(let s in e){let a=IX(e[s],t[s],i,r);a!==void 0&&(n[s]=a)}return n}}zt(),ae(),Su(),sC(),Ad(),jr(),jr(),Zn(),zt(),Oh(),Zn(),Na(),Oh(),oC(),Sl(),f1(),ae(),zt(),ae(),lC(),Zn(),jr(),Zn(),ae(),o0(),ae();var B7=new R,qye=new Dr;function hGe(e,t,i,r,n){let s=[];return e.data.visible&&s.push(...function(a,o,l,h,u){let d,c,p,f,m,g,v,y=[];if(Jl(a)?(d=mI("position",a,o,l,u),d&&y.push(d),p=fo("rotation",a,o,l,u),p&&y.push(p),f=mI("shear",a,o,l,u),f&&y.push(f)):(v={slide:o.pathSnapping?.slide??a.updatedPathSnapping?.slide??a.dataPatched.pathSnapping?.slide??0,offset:o.pathSnapping?.offset??a.updatedPathSnapping?.offset??a.dataPatched.pathSnapping?.offset??0},m=fo("slide",v,o.pathSnapping??a.updatedPathSnapping??a.dataPatched.pathSnapping,l.pathSnapping??a.dataPatched.pathSnapping,u),m&&y.push(m),g=fo("offset",v,o.pathSnapping??a.updatedPathSnapping??a.dataPatched.pathSnapping,l.pathSnapping??a.dataPatched.pathSnapping,u),g&&y.push(g),!m&&!g&&(d=Vye("position",a,o,l,u),d&&y.push(d),c=Vye("scale",a,o,l,u),c&&y.push(c),p=function(_,b,x,w,S){let T=b?.rotation?b.rotation.map(N=>(typeof N=="string"?Number(S.getVariable(N)??0):N)*et.DEG2RAD):void 0,M=x.rotation?.map(N=>(typeof N=="string"?Number(S.getVariable(N)??0):N)*et.DEG2RAD);if(!M)return;let E=T?new R().fromArray(T):new R().setFromEuler(_.rotation),A=new R().fromArray(M);if(E.equals(A))return;let P=B7.subVectors(A,E);if(w&&P.toArray().every(N=>Math.abs(N)<2*Math.PI)){let N=new jt().setFromEuler(qye.setFromVector3(E)),D=new jt().setFromEuler(qye.setFromVector3(A));return{update:O=>{(function(z,B,V,j){if(j===0)return V.copy(z);if(j===1)return V.copy(B);let K=z.w*B.w+z.x*B.x+z.y*B.y+z.z*B.z;if(K>=1)return V.copy(z);let $=1-K*K;if($<=Number.EPSILON){let we=1-j;return V.w=we*z.w+j*B.w,V.x=we*z.x+j*B.x,V.y=we*z.y+j*B.y,V.z=we*z.z+j*B.z,V.normalize(),V}let Q=Math.sqrt($),ce=Math.atan2(Q,K),pe=Math.sin((1-j)*ce)/Q,ye=Math.sin(j*ce)/Q;V.w=z.w*pe+B.w*ye,V.x=z.x*pe+B.x*ye,V.y=z.y*pe+B.y*ye,V.z=z.z*pe+B.z*ye})(N,D,_.quaternion,O)},start:()=>{_.rotation.setFromVector3(E)},end:()=>{_.rotation.setFromVector3(A)}}}return{update:N=>{B7.lerpVectors(E,A,N),_.rotation.setFromVector3(B7)},start:()=>{_.rotation.setFromVector3(E)},end:()=>{_.rotation.setFromVector3(A)}}}(a,o,l,h,u),p&&y.push(p),f=function(_,b,x){let w=b.shear,S=x.shear;if(!S)return;let T=_.shearMatrix,M=w??[T.elements[4],T.elements[8],T.elements[1],T.elements[9],T.elements[2],T.elements[6]],E=S;return M.every((A,P)=>A===E[P])?void 0:{update:A=>{M.forEach((P,N)=>{let D=et.lerp(P,E[N],A);T.elements[Dh.INDEX_MAP[N]]=D})},start:()=>{M.forEach((A,P)=>{T.elements[Dh.INDEX_MAP[P]]=A})},end:()=>{E.forEach((A,P)=>{T.elements[Dh.INDEX_MAP[P]]=A})}}}(a,o,l),f&&y.push(f))),d||c||p||f||m||g){let _=Jl(a)?()=>{a.updateWorldMatrix(!0,!1,!0),a.resetBBoxNeedsUpdate()}:()=>{a.updateMatrix(),a.hasNonUniformScale&&(a.updateMatrixWorld(),a.updateMatrixWorldRigid()),a.parent?.matrixWorldFusedFalse&&(a.matrixWorld.multiplyMatrices(a.parent.matrixWorldFusedFalse,a.matrix),a.matrixWorldNeedsUpdate=!1),yd(a)&&zc(a.parent)&&a.invalidateDownstreamBooleanData(!0),a.updatePathSnapping(Object.assign({},o.pathSnapping,v))};y.push({update:_,start:_,end:_})}return y}(e,t,i,n,r.shared)),Jl(e)?s.push(...function(a,o,l,h,u){let d,c,p,f,m,g,v,y,_,b,x,w,S,T,M,E=[];if("width"in a&&(d=fo("width",a,o,l,u),d&&E.push(d)),"height"in a&&(c=fo("height",a,o,l,u),c&&E.push(c)),a instanceof Va||a instanceof Hc){let A={...o.fill},P={...l.fill};A.enabled!==void 0&&A.enabled!==P.enabled&&(E.push(function(N){return{update:()=>{N instanceof Va&&(N.fill.enabled=!0)}}}(a)),A.enabled||Object.assign(A,{enabled:!0,color:{...A.color,a:0}}),P.enabled||Object.assign(P,{enabled:!0,color:{...P.color,a:0}})),p=gI("color",a.fill,A,P,u),p&&E.push(p)}if(a instanceof Va){let A={...o.stroke},P={...l.stroke};(A.enabled||P.enabled)&&(E.push(function(N){return{update:()=>{N instanceof Va&&(N.stroke.enabled=!0)}}}(a)),A.enabled||Object.assign(A,{enabled:!0,color:{...A.color,a:0}}),P.enabled||Object.assign(P,{enabled:!0,color:{...P.color,a:0}})),f=gI("color",a.stroke,A,P,u),f&&E.push(f),m=fo("thickness",a.stroke,A,P,u),m&&E.push(m)}if(a instanceof Va){let A={...o.dropShadow},P={...l.dropShadow};(A.enabled||P.enabled)&&(E.push(function(N){return{update:()=>{N instanceof Va&&(N.dropShadow.enabled=!0)}}}(a)),A.enabled||Object.assign(A,{enabled:!0,color:{...A.color,a:0}}),P.enabled||Object.assign(P,{enabled:!0,color:{...P.color,a:0}})),g=gI("color",a.dropShadow,A,P,u),g&&E.push(g),v=fo("blurRadius",a.dropShadow,A,P,u),v&&E.push(v),_=fo("spread",a.dropShadow,A,P,u),_&&E.push(_),y=mI("offset",a.dropShadow,A,P,u),y&&E.push(y)}if(a instanceof Va){let A={...o.innerShadow},P={...l.innerShadow};(A.enabled||P.enabled)&&(E.push(function(N){return{update:()=>{N instanceof Va&&(N.innerShadow.enabled=!0)}}}(a)),A.enabled||Object.assign(A,{enabled:!0,color:{...A.color,a:0}}),P.enabled||Object.assign(P,{enabled:!0,color:{...P.color,a:0}})),b=gI("color",a.innerShadow,A,P,u),b&&E.push(b),x=fo("blurRadius",a.innerShadow,A,P,u),x&&E.push(x),S=fo("spread",a.innerShadow,A,P,u),S&&E.push(S),w=mI("offset",a.innerShadow,A,P,u),w&&E.push(w)}if(a instanceof Va||a instanceof Hc){let A={...o.backgroundBlur},P={...l.backgroundBlur};(A.enabled||P.enabled)&&(E.push(function(N){return{update:()=>{N instanceof Va&&(N.backgroundBlur.enabled=!0)}}}(a)),A.enabled||Object.assign(A,{enabled:!0,radius:0}),P.enabled||Object.assign(P,{enabled:!0,radius:0})),T=fo("radius",a.backgroundBlur,A,P,u),T&&E.push(T)}if(a instanceof Va){let A={...o.layerBlur},P={...l.layerBlur};(A.enabled||P.enabled)&&(E.push(function(N){return{update:()=>{N instanceof Va&&(N.layerBlur.enabled=!0)}}}(a)),A.enabled||Object.assign(A,{enabled:!0,radius:0}),P.enabled||Object.assign(P,{enabled:!0,radius:0})),M=fo("radius",a.layerBlur,A,P,u),M&&E.push(M)}if(a instanceof Hc||a instanceof fC){let A=NX("cornerRadius",a,o,l,u);A&&E.push(A)}return E}(e,t,i,0,r.shared)):(e.data.visible&&s.push(...function(a,o,l,h){let u=[];if(!("cloner"in l)||!a.cloner)return u;let d=a.cloner,c="cloner"in o?o.cloner:{},p=l.cloner;QW.forEach(_=>{let b;b=_==="count"?fo("count",d.parameters,c,p,h.shared,!0):rg(_,d.parameters,c??{},p,h.shared),b&&u.push(b)});let f=function(_,b,x,w){if(_.parameters.type!=="radial")return;let S=b.radial,T=x.radial;if(!T)return;let M=_.parameters.radial,E=[];return RL.forEach(A=>{let P=rg(A,M,S??{},T,w);P&&E.push(P)}),E}(d,c,p,h.shared);f?.length&&u.push(...f);let m=function(_,b,x,w){if(_.parameters.type!=="linear")return;let S=b.linear,T=x.linear;if(!T)return;let M=[],E=_.parameters.linear;return DL.forEach(A=>{let P=rg(A,E,S??{},T,w);P&&M.push(P)}),M}(d,c,p,h.shared);m?.length&&u.push(...m);let g=function(_,b,x,w){if(_.parameters.type!=="grid")return;let S=b.grid,T=x.grid;if(!T)return;let M=[],E=_.parameters.grid;return NL.forEach(A=>{let P;P=A==="count"?NX(A,E,S??{},T,w,!0):rg(A,E,S??{},T,w),P&&M.push(P)}),M}(d,c,p,h.shared);g?.length&&u.push(...g);let v=function(_,b,x,w){if(_.parameters.type!=="toObject")return;let S=b.toObject,T=x.toObject;if(!T)return;let M=[],E=_.parameters.toObject;return IL.forEach(A=>{let P;P=A==="count"?fo(A,E,S??{},T,w,!0):rg(A,E,S??{},T,w),P&&M.push(P)}),M}(d,c,p,h.shared);v?.length&&u.push(...v);let y=function(_,b,x,w){if(!_.parameters.randomness)return;let S=b.randomnessObject,T=x.randomnessObject;if(!T)return;let M=[],E=_.parameters.randomnessObject;return OL.forEach(A=>{let P=rg(A,E,S??{},T,w);P&&M.push(P)}),M}(d,c,p,h.shared);return y?.length&&u.push(...y),u.length&&u.push({update:()=>{d.update(h)}}),u}(e,t,i,r)),e instanceof Es?(e instanceof zn&&e.data.visible&&s.push(...function(a,o,l,h){let u=[];if(!("geometry"in l)||Zf(a))return u;let d=a.geometry.userData.parameters,c="geometry"in o?o.geometry:{},p=l.geometry;if(a instanceof ow){let f=function(m,g,v,y){if(v.scaleBaked===void 0)return;let _=(g.scaleBaked??m.appliedGeometrySize??m.data.geometry.scaleBaked).map(w=>typeof w=="string"?Number(y.shared.getVariable(w)??0):w),b=v.scaleBaked.map(w=>typeof w=="string"?Number(y.shared.getVariable(w)??0):w);if(jg.isEqual(_,b))return;let x=[];return x.push({update:w=>{m.updateGeometryInteractions({scaleBaked:[et.lerp(_[0],b[0],w),et.lerp(_[1],b[1],w),et.lerp(_[2],b[2],w)]},y.shared),m.invalidateDownstreamBooleanData(),m.refreshAttachedClonersInteractions(y)},start:()=>{m.updateGeometryInteractions({scaleBaked:_},y.shared),m.invalidateDownstreamBooleanData(),m.refreshAttachedClonersInteractions(y)},end:()=>{m.updateGeometryInteractions({scaleBaked:b},y.shared),m.invalidateDownstreamBooleanData(),m.refreshAttachedClonersInteractions(y)}}),x}(a,c,p,h);f&&u.push(...f)}else{let f={},m=a.appliedGeometrySize;if(Object.assign(f,PW(d,zI),m?{width:m[0],height:m[1],depth:m[2]}:{},PW(c,zI)),zI.forEach(g=>{let v=rg(g,f,c,p,h.shared);v&&u.push(v)}),xB(a)){Object.assign(f,{extrusion:{...d.extrusion}});let g=function(v,y,_,b){if(!_.extrusion)return;let x=v.extrusion,w=y.extrusion??{},S=_.extrusion,T=[];return zL.forEach(M=>{let E=rg(M,x,w,S,b);E&&T.push(E)}),T}(f,c,p,h.shared);g&&u.push(...g)}u.length&&u.push({update:g=>{a.updateGeometryInteractions(f,h.shared),a.updateGeometryGroupsIfNeeded(),a.refreshAttachedClonersInteractions(h)},start:g=>{a.updateGeometryInteractions(f,h.shared),a.updateGeometryGroupsIfNeeded(),a.refreshAttachedClonersInteractions(h)},end:g=>{a.updateGeometryInteractions(f,h.shared),a.updateGeometryGroupsIfNeeded(),a.refreshAttachedClonersInteractions(h)}})}return u}(e,t,i,r)),e.data.visible&&!(e instanceof xl&&e.materialOverride)&&s.push(...function(a,o,l,h){let u=[];if(Array.isArray(a.material)){if(!("materials"in l)||!l.materials)return u;let d="materials"in o&&o.materials?o.materials:[],c=l.materials;a.material.forEach((p,f)=>{if(!c[f])return;let m=d[f]??{},g=c[f];typeof m=="string"||typeof g=="string"||u.push(...Wye(p,m,g,h))})}else{if(!("material"in l)||!l.material)return u;let d="material"in o&&o.material?o.material:{},c=l.material;if(typeof d=="string"||typeof c=="string")return u;u.push(...Wye(a.material,d,c,h))}return u}(e,t,i,r.shared))):l4.is(e)?e.data.visible&&s.push(...function(a,o,l,h){let u=[];if(l.intensity!==void 0){let d=fo("intensity",a,o,l,h);d&&u.push(d)}if(l.color!==void 0){let d=function(c,p,f,m,g){let v=f[c]?f[c]:void 0,y=m[c];if(!y)return;let _=p[c],b=v?typeof v=="string"?g.getColor(v).clone():new lt().setRGB(v.r,v.g,v.b):_.clone(),x=typeof y=="string"?g.getColor(y).clone():new lt().setRGB(y.r,y.g,y.b);if(b.equals(x))return;let w=_.clone();return{update:S=>{w.lerpColors(b,x,S),p[c]?.copy?.(w)},start:()=>{w.copy(b)},end:()=>{w.copy(x)}}}("color",a,o,l,h);d&&u.push(d)}return u}(e,t,i,r.shared)):e instanceof Qn&&s.push(...function(a,o,l,h){let u=[],d=a.cameraType==="OrthographicCamera"?o.orthographic?.zoom:o.perspective?.zoom,c=a.cameraType==="OrthographicCamera"?l.orthographic?.zoom:l.perspective?.zoom;if(c!==void 0){let p=d??a.zoom,f=c;p!==f&&u.push({update:m=>{a.zoom=et.lerp(p,f,m),a.updateProjectionMatrix()},start:()=>{a.zoom=p,a.updateProjectionMatrix()},end:()=>{a.zoom=f,a.updateProjectionMatrix()}})}if(l.targetOffset!==void 0){let p=fo("targetOffset",a,o,l,h);p&&u.push(p)}return u}(e,t,i,r.shared))),s.length?{update:a=>{s.forEach(o=>o.update(a))},start:a=>{s.forEach(o=>o.start?.(a))},end:a=>{s.forEach(o=>o.end?.(a))}}:void 0}var ePe={type:"beginState"};function tPe(e){if(e.easing===5){let{control1:t,control2:i}=e;return{easing:5,control1:t??nw.defaultData.control1,control2:i??nw.defaultData.control2}}if(e.easing===6){let{mass:t,stiffness:i,damping:r,velocity:n}=e;return{easing:6,mass:t??Ng.defaultData.mass,stiffness:i??Ng.defaultData.stiffness,damping:r??Ng.defaultData.damping,velocity:n??Ng.defaultData.velocity}}return{easing:e.easing}}function iPe(e){return{delay:e.delay,delayDirection:e.delayDirection??"start-end",direction:e.direction??"normal",repeat:e.repeat}}var rPe={type:"completeState",isfromEntity:!1};function aA(e,t){let i,r;if(typeof t=="string"?(i=t,r=e.states?.[i]):t===null&&(i=null,r=e.data),i!==void 0&&r!==void 0)return{id:i,data:r}}var uGe=["position","rotation","scale","shear"],OX=new Set,LX=class{constructor(e,t,i,r,n,s,a,o={},l=()=>OX){this.object=e,this.fromRef=t,this.toRef=i,this.data=r,this.sharedAssets=n,this.allowSlerp=s,this.page=a,this.hooks=o,this.inert=l,this.builtReversed=!1,this.startStateId=null,this.buildCallback=()=>{this.builtReversed=this.runner.isReversed,this.startStateId=Jl(this.object)?null:this.object.transitionState.state,this.callback=hGe(this.object,{},function(h,u){if(u.size===0)return h;let d={...h};for(let c of u)delete d[c];return d}(this.end.data,this.inert()),{scene:this.page.scene,shared:this.sharedAssets},this.allowSlerp)},this.onChange=h=>{this.builtReversed!==this.runner.isReversed&&this.buildCallback(),this.callback&&(this.callback.update(h),this.object.requestRender()),this.writeState(h)},this.runner=new H3e(function(h){return{duration:h.duration,ease:tPe(h),...iPe(h)}}(r),this.onChange,this.buildCallback),this.rebind()}rebind(){let{fromRef:e,toRef:t}=this;if(e===void 0){let r=aA(this.object,this.object.currentState===t?this.object.prevState:this.object.currentState);if(!r)throw new Error("Missing property");this.from=r}else{let r=aA(this.object,e);if(!r)throw new Error("Missing property");this.from=r}if(t===void 0)throw new Error("Missing property");let i=aA(this.object,t);if(!i)throw new Error("Missing property");this.to=i,this.buildCallback()}refresh(){this.buildCallback()}get endpointData(){return[this.from.data,this.to.data]}get targetStateId(){return this.builtReversed?this.from.id:this.to.id}get start(){return this.builtReversed?this.to:this.from}get end(){return this.builtReversed?this.from:this.to}writeState(e){if(e===0||Jl(this.object))return;let t=e===1,i=e>.5?this.targetStateId:this.startStateId,r=this.object.transitionState;r.settled===t&&r.state===i||(this.object.transitionState={settled:t,state:i},this.object.reversibleToState=this.end.id,this.object.prevState!==this.object.currentState&&(this.object.prevState=this.object.currentState),this.object.currentState=i,this.object.dispatchEvent({type:"transitionState",settled:t,state:i}),this.object.dispatchEvent({type:t?"completeState":"beginState",state:i}),this.object.traverseEntity(n=>{n!==this.object&&n instanceof Qn&&n.dispatchEvent(t?rPe:ePe)}),t?this.hooks.onComplete?.(i):this.hooks.onBegin?.(i))}};Oh();var BX=new Map,oA=new Map,du=class extends cs{constructor(e,t,i,r,n,s){super(),this.id=e,this.data=t,this.scene=i,this.sharedAssets=r,this.object=n,this.eventType=s,this.evaluators=[],this.elapsed=0,this.lastTime=null,this.direction=1,this._playing=!1,this._finished=!1,this.hasPlayedOnce=!1,this.pauseOnNextCycleEnd=!1,this.lastCycleIndex=0;try{let a=n1.findTimeline(this.scene.data.objects,this.data.timeline),o=a.duration;this.animatedObjectIds=Object.keys(a.objectTimelines),this.animatedObjectIds.forEach(l=>{let h=this.scene.find(l);if(!h)return;let u=a.objectTimelines[l];!u||this.evaluators.push(function(d,c,p,f,m){let g=function(v,y){let _=[];return Wg.groupKeyframes(y.keyframes).forEach(b=>{let x=b.path?.[0],w=b.path[1],S=()=>Tb(b.keyframes,T=>T.value);switch(x){case"position":case"rotation":case"scale":return void(w&&PA.includes(w)&&_.push({on:x,axis:w,track:S()}));case"shape size":return void(w&&PA.includes(w)&&"geometry"in v&&_.push({on:"shapeSize",axis:w,track:S()}));case"path extrusion":return void(xB(v)&&_.push({on:"pathExtrusion",track:Tb(b.keyframes,T=>T.value)}));case"path snapping":return void(v.data.pathSnapping&&_.push({on:"pathSnapping",track:Tb(b.keyframes,T=>T.value)}));case"material":return void(v.type==="Mesh"&&"material"in v&&function(T,M){let E=o4(T.material)?T.material:void 0,A=M.layerId;if(!E||!A)return[];let P=M.keyframes.some(V=>$f(V.data.value?.noiseStrength)),N=E.ensureRainbowNoiseCompiled,D=V=>{P&&typeof N=="function"&&N.call(E,V)},O=V=>"data"in V?[{on:"material",layer:V,track:Tb(M.keyframes,j=>j.value)}]:[];D(A);let z=E.getLayerByUuid(A);if(z)return O(z);let B=M.path[1];for(let V of E.getLayersOfType(B))D(V.uuid);return(E.getLayersOfType(B)??[]).flatMap(O)}(v,b).forEach(T=>_.push(T)));case"opacity":return void(v.type==="Mesh"&&"material"in v&&_.push({on:"opacity",track:S()}));case"cloner":return void _.push({on:"cloner",track:Tb(b.keyframes,T=>T.value)});case"camera":return void(v instanceof Qn&&_.push({on:"camera",field:"zoom",track:S()}));case"light":return void((v instanceof Rw||v instanceof hC||v instanceof Dw)&&_.push({on:"light",field:b.path[1],track:Tb(b.keyframes,T=>T.value)}))}}),_}(d,c);return{duration:p,evaluate(v,y){d.resetBBoxNeedsUpdate();let _={transform:!1,size:!1,cloner:!1,bounds:!1,boolean:!1,render:!1};for(let b of g)lGe(b,d,v,f,m,y,_);(function(b,x,w){if(x.size&&b instanceof zn){let{x:S,y:T,z:M}=b.userData.value;b.updateGeometryInteractions({width:S,height:T,depth:M},w.shared)}x.cloner&&b.cloner?.update(w),x.transform&&b.updateMatrix(),x.bounds&&b.resetBBoxNeedsUpdate(),x.boolean&&b instanceof zn&&b.invalidateDownstreamBooleanData(),x.render&&b.dispatchEvent({type:"requestRender"})})(d,_,f)},invalidate(){for(let v of g)aGe(v.track)}}}(h,{...u},o,{scene:i,shared:r},this.sharedAssets))}),this.schedule=new X6e(function(l,h){return{duration:h,delay:po(l.delay/1e3),delayDirection:l.delayDirection??"start-end",direction:l.direction??"normal",repeat:l.repeat}}(this.data,o))}catch{throw new Error("Missing property")}n&&(oA.has(n.uuid)?oA.get(n.uuid).push(this):oA.set(n.uuid,[this])),BX.set(e,this)}get playing(){return this._playing}get finished(){return this._finished}get paused(){return!this._playing}update(e){this.lastTime!==null&&(this.elapsed=Math.max(0,this.elapsed+(e-this.lastTime)*this.direction)),this.lastTime=e,this.applyAtElapsed()}applyAtElapsed(){if(this.direction===-1&&this.elapsed===0)return void this.pause();let e=this.schedule.resolve(this.elapsed);if(e){if(e.cycleIndex!==this.lastCycleIndex&&(this.lastCycleIndex=e.cycleIndex,this.pauseOnNextCycleEnd))return this.pauseOnNextCycleEnd=!1,void this.pause();for(let t of this.evaluators)t.evaluate(e.localTime)}else this.direction===1&&this.schedule.isFinished(this.elapsed)&&this.finish()}finish(){this.pause(),this._finished=!0,this.animatedObjectIds.forEach(e=>{let t=this.scene.find(e);t instanceof Qn&&t.dispatchEvent(rPe)})}startTicking(){this._playing=!0,this.lastTime=null;for(let e of this.evaluators)e.invalidate();zs.add(this)}play(){let e=this.eventType!==void 0&&GW(this.eventType)&&this.data.runMode==="Once"&&this.hasPlayedOnce&&this.paused&&this.elapsed>0&&!this._finished;if(this.eventType!==void 0&&GW(this.eventType)&&this.data.runMode==="Once"&&this.hasPlayedOnce&&!e||this.eventType===void 0&&this._finished)return!1;this.hasPlayedOnce=!0,this.animatedObjectIds.forEach(t=>{let i=this.scene.find(t);i instanceof Qn&&i.dispatchEvent(ePe)}),!e&&(this.elapsed===0||this._finished)&&(this.elapsed=0,this.lastCycleIndex=0,this._finished=!1),this.direction=1,this.startTicking()}pause(){this._playing=!1,this.lastTime=null,zs.remove(this)}rewind(){this.pause(),this.elapsed=0,this.lastCycleIndex=0}stop(){this.rewind(),this.applyAtElapsed(),this._finished=!1}pauseAndRewind(){this.rewind(),this.direction=1,this.pauseOnNextCycleEnd=!1,this._finished=!1}seek(e){let t=this.schedule.totalDuration;this.elapsed=e*(Number.isFinite(t)?t:this.schedule.effectiveCycleDuration);for(let i of this.evaluators)i.invalidate();this.applyAtElapsed()}toggle(e){let t=e??this.direction===-1;this._playing&&this.direction===(t?1:-1)?t&&(this.pauseOnNextCycleEnd=!1):(t?(this._finished&&(this.elapsed=0,this.lastCycleIndex=0,this._finished=!1),this.direction=1,this.pauseOnNextCycleEnd=!1):(this.direction=this.schedule.resolve(this.elapsed)?.isReverse?1:-1,this.pauseOnNextCycleEnd=!0),this.startTicking())}playFromCurrent(){this.toggle(!0)}reverseFromCurrent(){this.toggle(!1)}dispose(){this.pause()}},dGe=class{constructor(e){this.data=e}dispatch(){this.data.playTimeline?this.pauseTimeline(this.data.playTimeline):this.data.object?this.pauseAllTimelinesFromObject(this.data.object):this.pauseAllTimelines()}pauseTimeline(e){let t=this.getTimelineActions(e);!t.length||(this.data.delay>0?(this.disposeDelay(),this.timeoutId=window.setTimeout(()=>{t.forEach(i=>{i[this.data.interaction]()}),this.disposeDelay()},this.data.delay)):t.forEach(i=>{i[this.data.interaction]()}))}getTimelineActions(e){let t=BX.get(e);return t?[t]:[...BX.values()].filter(i=>i.data.timeline===e)}pauseAllTimelinesFromObject(e){let t=oA.get(e);!t?.length||(this.data.delay>0?(this.disposeDelay(),this.timeoutId=window.setTimeout(()=>{t.forEach(i=>i[this.data.interaction]()),this.disposeDelay()},this.data.delay)):t.forEach(i=>i[this.data.interaction]()))}pauseAllTimelines(){let e=[...oA.values()];!e.length||(this.data.delay>0?(this.disposeDelay(),this.timeoutId=window.setTimeout(()=>{e.forEach(t=>{t.forEach(i=>{i[this.data.interaction]()})}),this.disposeDelay()},this.data.delay)):e.forEach(t=>{t.forEach(i=>{i[this.data.interaction]()})}))}disposeDelay(){clearTimeout(this.timeoutId),delete this.timeoutId}dispose(){clearTimeout(this.timeoutId),delete this.timeoutId}},cGe=class{constructor(e,t,i,r,n,s,a){this.data=t,this.sharedAssets=r,this.actionCondition=a;let o="interaction"in t?t.interaction:"play";if(o==="play"||o===void 0)this.interaction=new du(e,t,i,r,n,s);else{if(o!=="pause"&&o!=="stop")throw new Error("Missing property");this.interaction=new dGe(t)}}get playing(){return this.interaction instanceof du&&this.interaction.playing}get finished(){return!(this.interaction instanceof du)||this.interaction.finished}get paused(){return!(this.interaction instanceof du)||this.interaction.paused}branchTaken(){return Nn(this.sharedAssets,this.actionCondition)}play(){return!!this.branchTaken()&&(this.interaction instanceof du?this.interaction.play():void this.interaction.dispatch())}get animatedObjectIds(){return this.interaction instanceof du?this.interaction.animatedObjectIds:[]}pauseAndRewind(){this.interaction instanceof du&&this.interaction.pauseAndRewind()}stop(){this.interaction instanceof du&&this.interaction.stop()}seek(e){!this.branchTaken()||this.interaction instanceof du&&this.interaction.seek(e)}toggle(e){!this.branchTaken()||(this.interaction instanceof du?this.interaction.toggle(e):this.interaction.dispatch())}playFromCurrent(){!this.branchTaken()||(this.interaction instanceof du?this.interaction.playFromCurrent():this.interaction.dispatch())}dispatchConditional(){this.playFromCurrent()}reverseFromCurrent(){!this.branchTaken()||this.interaction instanceof du&&this.interaction.reverseFromCurrent()}dispose(){this.interaction.dispose()}};function $ye(e){let t=e.tweens[0]?.data;return{delay:t?.delay??e.delay,delayDirection:t?.delayDirection??"start-once",direction:t?.direction??e.direction,repeat:t?.repeat??e.repeat}}_r(),Jo("TimelineAnimation",({id:e,data:t,page:i,shared:r,object:n,eventType:s,actionCondition:a})=>new cGe(e,t,i.scene,r,n,s,a)),In("timeline"),Zn(),zt(),ae(),Oh();var pGe={state:null,duration:0,delay:0,delayDirection:"start-once",direction:"normal",repeat:0,easing:0},fGe=class extends cs{constructor(e,t,i,r,n,s,a){if(super(),this.eventType=e,this.data=t,this.page=i,this.shared=r,this.condition=n,this.runModeOverride=s,this.tweens=[],this.hasPlayedOnce=!1,this.inert=OX,!t.object)throw new Error("Missing property");let o=this.page.scene.findFrom(t.object,a)??this.page.uiCanvas?.find(t.object)??this.page.scene.find2DInUIObjects(t.object);if(!o)throw new Error("Missing property");if(!o.states)throw new Error("Missing property");if(this.object=o,t.tweens.length<2)throw new Error("Missing property");this.init()}get playing(){return this.runner?.isPlaying===!0}get animating(){return this.runner?.isAnimating===!0}get claimTime(){return this.runner?.claimTime}get contested(){let e=this.object.previousAction;return e!==null&&e!==this&&e.animating}init(){this.initialCurrentState=aA(this.object,this.object.currentState).id,this.build()}shouldReinit(){return!!Nn(this.shared,this.condition)||!(this.animating&&!this.loopsForever)}get loopsForever(){return $ye(this.data).repeat===-1||this.data.tweens.some((e,t)=>t>0&&e.data.repeat===-1)}get runMode(){return this.runModeOverride!==void 0?this.runModeOverride:GW(this.eventType)?this.data.runMode:"Repeat"}get currentState(){return this.runMode==="Toggle"?this.initialCurrentState:this.object.currentState}get opensOnCurrent(){return this.data.tweens[0].data.state===void 0&&this.runMode!=="Toggle"}build(){let e=this.data.tweens,t=[];try{let i=e[0].data.state;i!==void 0&&t.push(new LX(this.object,i,i,pGe,this.shared,this.data.allowSlerp??!1,this.page,{},()=>this.inert));for(let r=1;r<e.length;r++){let n=e[r-1],s=e[r];t.push(new LX(this.object,n.data.state===void 0?this.currentState:n.data.state,s.data.state===void 0?this.currentState:s.data.state,s.data,this.shared,this.data.allowSlerp??!1,this.page,{},()=>this.inert))}}catch(i){return void(i instanceof Error&&console.error(i.message))}this.tweens=t,this.syncInert(),this.runner=new W3e({...iPe($ye(this.data)),runMode:this.runMode},t.map(i=>i.runner),{claim:i=>this.claimObject(i),assignCurrentState:()=>this.rebindTweens(),isOwner:()=>this.object.previousAction===this})}claimObject(e){if(this.object.previousAction===this)return!1;let t=this.object.previousAction;if(t?.animating===!0){if(e!==void 0&&t.claimTime!==void 0&&t.claimTime>e)return!1;t.pause()}return this.object.previousAction=this,!0}rebindTweens(){for(let e of this.tweens)try{e.rebind()}catch(t){t instanceof Error&&console.error(t.message)}this.syncInert(),this.object instanceof Qn&&this.object.wasMovedByUser&&(this.object.wasMovedByUser=!1)}syncInert(){let e=this.tweens.flatMap(t=>t.endpointData);if(this.opensOnCurrent&&e.length>0){let t=aA(this.object,this.object.currentState);t&&(e[0]=t.data)}this.inert=this.notMovedByOwner(function(t){if(t.length<2)return OX;let i=new Set,[r,...n]=t;for(let s of uGe){let a=r[s];a!==void 0&&n.every(o=>yy(o[s],a))&&i.add(s)}return i}(e));for(let t of this.tweens)t.refresh()}notMovedByOwner(e){let t=this.object.previousAction;if(e.size===0||t===null||t===this||!t.animating)return e;let i=t.leavesAlone;return new Set([...e].filter(r=>i.has(r)))}get leavesAlone(){return this.inert}update(e){this.runner?.update(e),this.runner?.isPlaying!==!0&&zs.remove(this)}branchTaken(){return Nn(this.shared,this.condition)}play(){if(!this.branchTaken()||this.runMode==="Once"&&this.hasPlayedOnce)return!1;this.hasPlayedOnce=!0,this.start()}start(){!this.runner||(this.runner.play(zs.time),this.runner.isPlaying&&zs.add(this))}pause(){this.runner?.stop(),zs.remove(this)}stop(){this.pause();let e=this.data.tweens[0].data.state===void 0?this.initialCurrentState:this.data.tweens[0].data.state;Jl(this.object)?this.object.changeSelectedState(e,{shared:this.shared}):this.object.changeSelectedState(e,{scene:this.page.scene,shared:this.shared}),this.object.currentState=e}seek(e){if(Nn(this.shared,this.condition)===!1)return!1;this.runner?.seek(e)}playDirected(e){if(Nn(this.shared,this.condition)===!1)return!1;!this.runner||(this.runner.playDirected(zs.time,e),this.runner.isPlaying&&zs.add(this))}playFromCurrent(){this.playDirected(!0)}reverseFromCurrent(){this.playDirected(!1)}dispose(){this.pause()}};function mGe(e){let t=this._clip.duration,i=this._clip.start??0,r=this.loop,n=this.time+e,s=this._loopCount,a=r===hL;if(e===0)return s===-1||!a||1&~s?n:t-(n-i);if(r===q7){s===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(n>=t)n=t;else{if(!(n<0)){this.time=n;break e}n=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=n,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(s===-1&&(e>=0?(s=0,this._setEndings(!0,this.repetitions===0,a)):this._setEndings(this.repetitions===0,!0,a)),n>=t||n<i){let o=Math.floor((n-i)/(t-i));n-=(t-i)*o,s+=Math.abs(o);let l=this.repetitions-s;if(l<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,a||(n=e>0?t:i,this.repetitions===1&&(n=t)),this.time=n,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(l===1){let h=e<0;this._setEndings(h,!h,a)}else this._setEndings(!1,!1,a);this._loopCount=s,this.time=n,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:o})}}else this.time=n;if(a&&!(1&~s))return t-(n-i)}return n}function nPe(e){let t=e?.tracks.filter(i=>i.ValueTypeName==="vector"||i.ValueTypeName==="quaternion").map(i=>i.times.length);if(t?.length){let i=function(r){if(!r||r.length===0)return;let n;for(let s of r)s==s&&(n===void 0||s>n)&&(n=s);return n}(t);return i&&i>2?i:2}return 2}zt(),ae(),zt(),ae(),ae(),jr();var Xye=!1,Lv=new WeakSet;function FX(e){return Array.isArray(e.identity)?e.identity[0]:e.uuid}function yI(e){return e.data.type==="Empty"&&Array.isArray(e.data.animations)?e.data.animations:[]}function gGe(e){return e===void 0||e===!0?-1:typeof e=="number"&&e>=1?Math.round(e)-1:0}function Yye(e,t){return typeof e=="number"&&isFinite(e)&&e>0?e:t}function Kye(e,t){let i=e.filter(a=>a.info.id===t);if(i.length)return i;let r=e.filter(a=>a.info.name===t);if(r.length)return r;let n=t.toLowerCase(),s=e.filter(a=>a.info.name.toLowerCase()===n);return s.length?s:e.filter(a=>a.info.name.toLowerCase().endsWith("_"+n))}function Zye(e){return`"${e.name}" has no imported animation clips \u2014 getAnimations() lists the objects that do.`}function Qye(e,t,i){if(!i)return`no clip "${e}" in the scene \u2014 getAnimations() lists them.`;let r=t.map(n=>`"${n.info.name}"`).join(", ");return`"${i.name}" has no clip "${e}" \u2014 its clips: ${r}.`}var vGe=class{constructor(e,t,i,r){this.scene=e,this.requestRender=t,this.updateDisplayProgress=i,this.animationInspectorState=r,this.clipIdToAction={},this.activeClip=null,this.clipDurations=new WeakMap,this.needsUpdate=!1,this.addClip=n=>{n.data.type==="Empty"&&Array.isArray(n.data.animations)&&n.data.animations.forEach((s,a)=>{let o=s[0]+"/"+FX(n);if(this.clipIdToAction[o])return;let l=NI.parse(function(u){if(!Obe(u))return JSON.parse(u[2]);let[d,c,,p]=u,f=([g,v])=>p.data.slice(g,g+v),m={name:c,duration:p.duration,uuid:d,tracks:p.tracks.map(g=>{let v={name:g.name,type:g.type,times:f(g.times),values:g.list?[...g.list]:f(g.values)};return g.interpolation!==void 0&&(v.interpolation=g.interpolation),v})};return p.blendMode!==void 0&&(m.blendMode=p.blendMode),p.userData!==void 0&&(m.userData=p.userData),m}(s));n.animations[a]=l,this.clipDurations.set(l,l.duration);let h=this.mixer.clipAction(l,n);Xye===!1&&(Object.getPrototypeOf(h)._updateTime=mGe,Xye=!0),h.clampWhenFinished=!0,this.clipIdToAction[o]=h})},this.mixer=new gW(e),this.scene.traverseEntity(this.addClip)}rebindClips(){this.mixer.stopAllAction(),this.mixer=new gW(this.scene),this.clipIdToAction={},this.activeClip=null,this.scene.traverseEntity(this.addClip)}deleteClip(e,t){let i=this.scene.find(t);if(!i)return;let r=i.animations.find(s=>s.uuid===e);if(!r)return;let n=this.clipIdToAction[e];!n||(n.stop(),this.mixer.uncacheClip(r),delete this.clipIdToAction[e],i.animations=i.animations.filter(s=>s.uuid!==e))}get isPlaying(){return Object.values(this.clipIdToAction).some(e=>e.isRunning())}playFromInspector(e){this.mixer.stopAllAction();let t=this.clipIdToAction[e];!t||(t.play(),this.activeClip=t.getClip(),this.scene.markShadowsDirty(),this.requestRender())}onExitPlayMode(){Object.values(this.clipIdToAction).forEach(e=>{e.repetitions=1/0,e.loop=lL,e.timeScale=1,Lv.delete(e)}),this.mixer.stopAllAction(),this.scene.markShadowsDirty(),this.requestRender()}play(e){let t=e.clipId+"/"+e.object,i=this.clipIdToAction[t];if(i)return i.repetitions=e.repeat>=0?e.repeat+1:1/0,i.loop=e.direction!=="pingpong"&&e.direction!=="pingpong-rewind"||e.repeat===0?lL:hL,i.play(),i.paused=!1,this.requestRender(),i}startClip(e,t,{start:i=0,end:r,fade:n=0}){Lv.delete(e),e.reset(),e.time=i;let s=e.getClip();s.start=i,s.duration=r??this.fullDuration(e),this.replaceOtherClips(e,t,n)}replaceOtherClips(e,t,i=0){Object.entries(this.clipIdToAction).forEach(([r,n])=>{n===e||r.split("/")[1]!==t||(Lv.delete(n),i>0?n.fadeOut(i):n.stop())}),i>0&&e.fadeIn(i)}resumeClip(e){return!!Lv.has(e)&&(Lv.delete(e),e.paused=!1,e.play(),this.requestRender(),!0)}holdClips(e,t){let i=!1;Object.entries(this.clipIdToAction).forEach(([r,n])=>{let[s,a]=r.split("/");if(t(s,a))if(e==="pause"){if(!n.isRunning())return;n.paused=!0,Lv.add(n)}else{if(!n.enabled||!n.isRunning()&&!n.paused)return;n.paused=!0,Lv.delete(n),n.time=n.getClip().start??0,n._loopCount=-1,i=!0}}),i&&(this.needsUpdate=!0,this.scene.markShadowsDirty(),this.requestRender())}animatedEntity(e){let t;return e.traverseEntity(i=>!!t||(yI(i).length?(t=i,!0):void 0)),t||e.traverseEntityAncestors(i=>{!t&&yI(i).length&&(t=i)}),t}clips(e){return this.ownedClips(e).map(t=>t.info)}playClip(e,t,i={}){let r=this.ownedClips(e);if(!r.length)return{ok:!1,warning:Zye(e)};let n=t===void 0?r[0]:Kye(r,t)[0];if(!n)return{ok:!1,warning:Qye(t,r,e)};let s=this.play({clipId:n.info.id,object:n.key,repeat:gGe(i.loop),direction:i.pingpong?"pingpong":"normal"});return s?(s.timeScale=Yye(i.speed,1),this.resumeClip(s)||this.startClip(s,n.key,{fade:Yye(i.fade,0)}),{ok:!0,clip:n.info}):{ok:!1,warning:`clip "${n.info.name}" has not loaded yet.`}}holdClipsOf(e,t,i){let r=this.ownedClips(t);if(t&&!r.length)return{ok:!1,warning:Zye(t)};if(i!==void 0){let s=Kye(r,i);if(!s.length)return{ok:!1,warning:Qye(i,r,t)};r=s}let n=new Set(r.map(s=>s.info.id+"/"+s.key));return this.holdClips(e,(s,a)=>n.has(s+"/"+a)),{ok:!0}}ownedClips(e){let t=[];if(e){let i=this.animatedEntity(e);i&&t.push(i)}else this.scene.traverseEntity(i=>{yI(i).length&&t.push(i)});return t.flatMap(i=>{let r=FX(i),n={id:i.uuid,name:i.name};return yI(i).map(([s,a])=>{let o=this.clipIdToAction[s+"/"+r];return{info:{id:s,name:a,duration:o?Math.round(1e3*this.fullDuration(o))/1e3:0,object:n},key:r,action:o}})})}fullDuration(e){let t=e.getClip();return this.clipDurations.get(t)??t.duration}resumeFromInspector(e){let t=this.clipIdToAction[e];!t||(t.play(),t.paused=!1,this.scene.markShadowsDirty(),this.requestRender())}pauseFromInspector(e){let t=this.clipIdToAction[e];!t||(t.paused=!0)}stop(){this.mixer.stopAllAction(),this.scene.markShadowsDirty(),this.requestRender()}update(e){if(this.needsUpdate)this.needsUpdate=!1;else if(this.isPlaying===!1||this.animationInspectorState?.isScrubbing)return;this.mixer.update(e/1e3),this.activeClip&&this.updateDisplayProgress(Math.round(this.mixer.time/this.activeClip.duration*(this.maxFrames-1)%(this.maxFrames-1))),this.requestRender()}get maxFrames(){return nPe(this.activeClip??void 0)}setProgressFromInspector(e,t){if(!this.clipIdToAction[t])return;this.activeClip!==this.clipIdToAction[t].getClip()&&this.playFromInspector(t);let i=this.clipIdToAction[t].paused;this.clipIdToAction[t].paused=!1,this.mixer.setTime(Math.min(e/(this.maxFrames-1),.9999)*this.activeClip.duration),this.scene.markShadowsDirty(),this.requestRender(),i&&(this.clipIdToAction[t].paused=!0)}},F7="imported animations only play while the scene runs (Play mode, the Preview tab, exports).";function yGe(e,t){let i=n=>`no object named "${n}".`,r=(n,s,a)=>{let o=e();if(!o)return{ok:!1,warning:F7};if(s===void 0)return o.holdClipsOf(n,void 0,a);let l=t(s);return l?o.holdClipsOf(n,l,a):{ok:!1,warning:i(s)}};return{getAnimations:n=>{let s=e();if(!s)return{clips:[],warning:F7};if(n===void 0)return{clips:s.clips()};let a=t(n);return a?{clips:s.clips(a)}:{clips:[],warning:i(n)}},playAnimation:(n,s,a)=>{let o=e();if(!o)return{warning:F7};let l=t(n);if(!l)return{warning:i(n)};let h=o.playClip(l,s,a);return{clip:h.clip,warning:h.warning}},pauseAnimation:(n,s)=>r("pause",n,s),stopAnimation:(n,s)=>r("stop",n,s)}}var fx=new Map;function sPe(e,t){if(t===void 0)return;let i=e.scene.find(t);return i?FX(i):t}var $p=class extends cs{constructor(e,t,i,r,n){super(),this.page=t,this.animationControls=i,this.shared=r,this.condition=n,this.startOnceDelay=0,this.toggleIsForward=!1;let s=sPe(t,e.object)??e.object;this.data={...e,object:s};let a=this.animationControls.clipIdToAction[e.clipId+"/"+s];if(this.duration=a?.getClip()?.duration??1,this.data.crop2){let l=nPe(a?.getClip());this.leftFrameTime=this.data.crop2[0]/(l-1)*this.duration,this.rightFrameTime=this.data.crop2[1]/(l-1)*this.duration}else{let l=a?.getClip()?.tracks[0]?.times.length;l&&l>1?(this.leftFrameTime=this.data.crop[0]/l*this.duration,this.rightFrameTime=this.data.crop[1]/l*this.duration):(this.leftFrameTime=0,this.rightFrameTime=this.duration)}this.startOnceDelay=e.delay;let o=fx.get(s);o||(o=new Set,fx.set(s,o)),o.add(this)}get playing(){return this.threeAnimAction?.isRunning()??!1}cancelPending(){window.clearTimeout(this.timeoutId),delete this.timeoutId}resume(){let e=this.animationControls.clipIdToAction[this.data.clipId+"/"+this.data.object];return!(!e||!this.animationControls.resumeClip(e)||(this.threeAnimAction=e,0))}play(e=!1){if(Nn(this.shared,this.condition)===!1)return!1;window.clearTimeout(this.timeoutId),this.timeoutId=window.setTimeout(()=>{this.resume()||(this.threeAnimAction=this.animationControls.play(this.data),this.threeAnimAction&&this.animationControls.startClip(this.threeAnimAction,this.data.object,{start:this.leftFrameTime,end:this.rightFrameTime,fade:e?.2:0}))},this.startOnceDelay)}pause(){this.threeAnimAction&&(this.threeAnimAction.paused=!0),this.cancelPending()}stop(){this.threeAnimAction?.fadeOut(.2)}seek(e){this.threeAnimAction=this.animationControls.play(this.data),this.threeAnimAction&&(this.threeAnimAction.paused=!0,this.threeAnimAction.time=et.clamp(this.threeAnimAction.time+1/60*e,this.leftFrameTime,this.rightFrameTime-16e-5),this.animationControls.needsUpdate=!0,this.animationControls.requestRender())}toggle(e,t=!1){if(Nn(this.shared,this.condition)===!1)return!1;this.toggleIsForward=e??!this.toggleIsForward,this.threeAnimAction&&(this.threeAnimAction._loopCount=0),this.playing||this.resume()?this.threeAnimAction&&(this.threeAnimAction.timeScale=this.toggleIsForward?1:-1,this.toggleIsForward?(this.threeAnimAction._clip.start=this.leftFrameTime,this.threeAnimAction._clip.duration=this.rightFrameTime):(this.threeAnimAction._clip.start=this.rightFrameTime,this.threeAnimAction._clip.duration=this.leftFrameTime)):this.timeoutId=window.setTimeout(()=>{if(this.threeAnimAction=this.animationControls.play(this.data),!this.threeAnimAction)return;let[i,r]=this.toggleIsForward?[this.leftFrameTime,this.rightFrameTime]:[this.rightFrameTime,this.leftFrameTime];this.threeAnimAction.time=i,this.threeAnimAction._clip.start=i,this.threeAnimAction._clip.duration=r,this.threeAnimAction.timeScale=this.toggleIsForward?1:-1,this.animationControls.replaceOtherClips(this.threeAnimAction,this.data.object,t?.2:0)},this.startOnceDelay)}playFromCurrent(){this.toggle(!0)}reverseFromCurrent(){this.toggle(!1)}dispose(){let e=this.animationControls.clipIdToAction[this.data.clipId+"/"+this.data.object]?.getClip();e&&(e.duration=this.duration),this.pause();let t=fx.get(this.data.object);t&&(t.delete(this),t.size===0&&fx.delete(this.data.object))}},_Ge=class{constructor(e,t,i){this.data=e,this.page=t,this.animationControls=i,this.objectId=sPe(t,e.object)}dispatch(){this.data.delay>0?(this.disposeDelay(),this.timeoutId=window.setTimeout(()=>{this.apply(),this.disposeDelay()},this.data.delay)):this.apply()}targetsClip(e,t){return!(this.objectId!==void 0&&t!==this.objectId||this.data.clipId&&e!==this.data.clipId)}apply(){(this.objectId!==void 0?[fx.get(this.objectId)]:[...fx.values()]).forEach(e=>{e?.forEach(t=>{this.targetsClip(t.data.clipId,t.data.object)&&t.cancelPending()})}),this.animationControls.holdClips(this.data.interaction,(e,t)=>this.targetsClip(e,t))}disposeDelay(){clearTimeout(this.timeoutId),delete this.timeoutId}dispose(){this.disposeDelay()}},bGe=class{constructor(e,t,i,r,n){KW.isPause(e)?this.interaction=new _Ge(e,t,i):this.interaction=new $p(e,t,i,r,n)}get data(){return this.interaction.data}get playing(){return this.interaction instanceof $p&&this.interaction.playing}play(e=!1){if(this.interaction instanceof $p)return this.interaction.play(e);this.interaction.dispatch()}pause(){this.interaction instanceof $p&&this.interaction.pause()}stop(){this.interaction instanceof $p&&this.interaction.stop()}seek(e){this.interaction instanceof $p&&this.interaction.seek(e)}toggle(e,t=!1){if(this.interaction instanceof $p)return this.interaction.toggle(e,t);this.interaction.dispatch()}playFromCurrent(){this.interaction instanceof $p?this.interaction.playFromCurrent():this.interaction.dispatch()}reverseFromCurrent(){this.interaction instanceof $p&&this.interaction.reverseFromCurrent()}dispose(){this.interaction.dispose()}},aPe=null;_r(),aPe=LX,Jo("Transition",({eventType:e,data:t,page:i,shared:r,actionCondition:n,runModeOverride:s,object:a})=>new fGe(e,t,i,r,n,s,a)),Jo("Animation",({data:e,page:t,eventManager:i,shared:r,actionCondition:n})=>new bGe(e,t,i.animationControls,r,n)),In("transitions"),jr();var Jye=(e,t)=>t.some(i=>i instanceof RegExp?i.test(e):i===e),xGe=class{constructor({url:e,context:t},i,r,n){if(this.controlsManager=i,this.shared=r,this.condition=n,!e)throw new Error("Missing property");this.url=e.startsWith("mailto:")?e:function(s,a){if(a={defaultProtocol:"http:",normalizeProtocol:!0,forceHttp:!1,forceHttps:!1,stripAuthentication:!0,stripHash:!1,stripTextFragment:!0,stripWWW:!0,removeQueryParameters:[/^utm_\w+/i],removeTrailingSlash:!0,removeSingleSlash:!0,removeDirectoryIndex:!1,sortQueryParameters:!0,...a},s=s.trim(),/^data:/i.test(s))return((u,{stripHash:d})=>{let c=/^data:(?<type>[^,]*?),(?<data>[^#]*?)(?:#(?<hash>.*))?$/.exec(u);if(!c)throw new Error(`Invalid URL: ${u}`);let{type:p,data:f,hash:m}=c.groups,g=p.split(";");m=d?"":m;let v=!1;g[g.length-1]==="base64"&&(g.pop(),v=!0);let y=(g.shift()||"").toLowerCase(),_=[...g.map(b=>{let[x,w=""]=b.split("=").map(S=>S.trim());return x==="charset"&&(w=w.toLowerCase(),w==="us-ascii")?"":`${x}${w?`=${w}`:""}`}).filter(Boolean)];return v&&_.push("base64"),(_.length>0||y&&y!=="text/plain")&&_.unshift(y),`data:${_.join(";")},${v?f.trim():f}${m?`#${m}`:""}`})(s,a);if(/^view-source:/i.test(s))throw new Error("`view-source:` is not supported as it is a non-standard protocol");let o=s.startsWith("//");!o&&/^\.*\//.test(s)||(s=s.replace(/^(?!(?:\w+:)?\/\/)|^\/\//,a.defaultProtocol));let l=new URL(s);if(a.forceHttp&&a.forceHttps)throw new Error("The `forceHttp` and `forceHttps` options cannot be used together");if(a.forceHttp&&l.protocol==="https:"&&(l.protocol="http:"),a.forceHttps&&l.protocol==="http:"&&(l.protocol="https:"),a.stripAuthentication&&(l.username="",l.password=""),a.stripHash?l.hash="":a.stripTextFragment&&(l.hash=l.hash.replace(/#?:~:text.*?$/i,"")),l.pathname){let u=/\b[a-z][a-z\d+\-.]{1,50}:\/\//g,d=0,c="";for(;;){let p=u.exec(l.pathname);if(!p)break;let f=p[0],m=p.index;c+=l.pathname.slice(d,m).replace(/\/{2,}/g,"/"),c+=f,d=m+f.length}c+=l.pathname.slice(d,l.pathname.length).replace(/\/{2,}/g,"/"),l.pathname=c}if(l.pathname)try{l.pathname=decodeURI(l.pathname)}catch{}if(a.removeDirectoryIndex===!0&&(a.removeDirectoryIndex=[/^index\.[a-z]+$/]),Array.isArray(a.removeDirectoryIndex)&&a.removeDirectoryIndex.length>0){let u=l.pathname.split("/"),d=u[u.length-1];Jye(d,a.removeDirectoryIndex)&&(u=u.slice(0,-1),l.pathname=u.slice(1).join("/")+"/")}if(l.hostname&&(l.hostname=l.hostname.replace(/\.$/,""),a.stripWWW&&/^www\.(?!www\.)[a-z\-\d]{1,63}\.[a-z.\-\d]{2,63}$/.test(l.hostname)&&(l.hostname=l.hostname.replace(/^www\./,""))),Array.isArray(a.removeQueryParameters))for(let u of[...l.searchParams.keys()])Jye(u,a.removeQueryParameters)&&l.searchParams.delete(u);if(a.removeQueryParameters===!0&&(l.search=""),a.sortQueryParameters){l.searchParams.sort();try{l.search=decodeURIComponent(l.search)}catch{}}a.removeTrailingSlash&&(l.pathname=l.pathname.replace(/\/$/,""));let h=s;return s=l.toString(),!a.removeSingleSlash&&l.pathname==="/"&&!h.endsWith("/")&&l.hash===""&&(s=s.replace(/\/$/,"")),(a.removeTrailingSlash||l.pathname==="/")&&l.hash===""&&a.removeSingleSlash&&(s=s.replace(/\/$/,"")),o&&!a.normalizeProtocol&&(s=s.replace(/^http:\/\//,"//")),a.stripProtocol&&(s=s.replace(/^(?:https?:)?\/\//,"")),s}(e,{removeTrailingSlash:!1,removeSingleSlash:!1,stripWWW:!1}),this.context=t??"tab"}dispatch(){if(Nn(this.shared,this.condition)===!1)return!1;l1?window.location.assign(this.url):(this.context==="tab"||B_e&&this.context==="none"?window.open(this.url,"_blank"):this.context==="window"?window.open(this.url,"_blank",`width=${window.innerWidth}, height=${window.innerHeight}`):window.open(this.url,"_parent"),this.controlsManager.orbitControls?.onPointerUp(vi[0]),vi.splice(0,vi.length))}},wGe=class{constructor(e,t,i,r,n){this.data=e,this.page=t,this.shared=i,this.eventManager=r,this.condition=n}dispatch(){if(Nn(this.shared,this.condition)===!1)return!1;clearTimeout(this.timeoutId),delete this.timeoutId,this.timeoutId=window.setTimeout(()=>{this.shared.reset(this.shared.data,!0),IZ(this.page,this.shared,!0),this.eventManager.reset(),this.eventManager.controlsManager.gameControl?.reset(!0),this.page.switchToPlayCamera(),this.eventManager.controlsManager.requestRender(),delete this.timeoutId},1e3*(this.data.delay??0))}dispose(){clearTimeout(this.timeoutId),delete this.timeoutId}};ae();var SGe={type:"beginState"},e1e={type:"completeState",isfromEntity:!1},t1e={type:"requestRender"},TGe=class extends cs{constructor(e,t,i,r){super(),this.data=e,this.page=t,this.shared=i,this.condition=r,this.toggleIsForward=!1,this.posStart=new R,this.posEnd=new R,this.qStart=new jt,this.qEnd=new jt,this.zoomStart=1,this.zoomEnd=1}init(){}get playing(){return this.runner?.isPlaying===!0}buildAnimation(e){if(!this.data.animate)return;let t=this.page.scene.find(this.data.targetCamera);if(!t||!t.visible)throw new ReferenceError("Target camera not founded or not visible");this.posStart.copy(this.page.activeCamera.position),this.qStart.copy(this.page.activeCamera.quaternion),this.zoomStart=this.page.activeCamera.zoom;let i={duration:this.data.duration,delay:0,delayDirection:"start-once",direction:"normal",repeat:0,ease:tPe(this.data)},r=n=>{let s=this.page.activeCamera;s.position.lerpVectors(this.posStart,this.posEnd,n),s.quaternion.slerpQuaternions(this.qStart,this.qEnd,n),s.zoom=this.zoomStart+(this.zoomEnd-this.zoomStart)*n,s.wasMovedBySwitchCameraAction=!0,s.updateMatrix(),s.updateMatrixWorld(),s.updateProjectionMatrix(),s.dispatchEvent(t1e),n===1&&s.dispatchEvent(e1e)};this.runner=new H3e(i,r,()=>{e?this.fromCamera&&(this.posEnd.copy(this.fromCamera.position),this.qEnd.copy(this.fromCamera.quaternion),this.zoomEnd=this.fromCamera.zoom,this.switchCamera(this.fromCamera.uuid)):(this.posEnd.copy(t.position),this.qEnd.copy(t.quaternion),this.zoomEnd=t.zoom,this.fromCamera=this.page.activeCamera,this.switchCamera(t.uuid)),this.page.activeCamera.dispatchEvent(SGe),r(0)})}get togglesBack(){return this.data.runMode==="Toggle"&&!this.toggleIsForward}update(e){this.runner?.update(e),this.runner?.isPlaying!==!0&&zs.remove(this)}start(){!this.runner||(this.runner.start(zs.time),zs.add(this))}switchCamera(e){let t=this.page.activeCamera,i=this.page.scene.find(e);if(!i||!i.visible)throw new ReferenceError("Target camera not founded or not visible");this.page.switchActiveCamera(i),t.dispatchEvent({type:"cameraChange",camera:i})}jumpToCamera(e){this.switchCamera(e),this.page.activeCamera.dispatchEvent(e1e),this.page.activeCamera.dispatchEvent(t1e)}play(){if(Nn(this.shared,this.condition)===!1)return!1;if(!this.playing&&this.page.activeCamera.uuid!==this.data.targetCamera)try{clearTimeout(this.timeoutId),this.timeoutId=window.setTimeout(()=>{delete this.timeoutId,this.data.animate?(this.buildAnimation(!1),this.start()):this.jumpToCamera(this.data.targetCamera)},1e3*this.data.delay)}catch{}}pause(){this.runner?.stop(),zs.remove(this),clearTimeout(this.timeoutId),delete this.timeoutId}toggle(e){if(Nn(this.shared,this.condition)===!1)return!1;if(window.clearTimeout(this.timeoutId),delete this.timeoutId,e!==this.toggleIsForward)try{this.playing?(this.runner?.stop(),this.toggleIsForward=e??!this.toggleIsForward,this.buildAnimation(this.togglesBack),this.start()):this.timeoutId=window.setTimeout(()=>{this.toggleIsForward=e??!this.toggleIsForward,this.data.animate?(this.runner?.stop(),this.buildAnimation(this.togglesBack),this.start()):this.toggleIsForward?(this.fromCamera=this.page.activeCamera,this.jumpToCamera(this.data.targetCamera)):this.fromCamera&&this.jumpToCamera(this.fromCamera.uuid)},1e3*this.data.delay)}catch{}}playFromCurrent(){this.toggle(!0)}reverseFromCurrent(){this.toggle(!1)}dispose(){this.pause(),this.toggleIsForward=!1}};aK();var MGe=class{constructor(e,t,i,r){this.data=e,this.page=t,this.shared=i,this.condition=r}dispatch(){if(Nn(this.shared,this.condition)===!1)return!1;(this.data.target==="single"?this.data.variableId?[this.data.variableId]:[]:Object.keys(this.shared.getVariables())).forEach(e=>{this.shared.getVariable(e);let t=this.shared.data.variables.data(e)?.value;t!==void 0&&this.shared.updateVariable(e,t),this.shared.enableLocalStorageForPersistentVariables&&localStorage.removeItem(ZH(e))})}dispose(){}};_r(),Jo("Link",({data:e,eventManager:t,shared:i,actionCondition:r})=>new xGe(e,t.controlsManager,i,r)),Jo("Reset",({data:e,page:t,shared:i,eventManager:r,actionCondition:n})=>new wGe(e,t,i,r,n)),Jo("SwitchCamera",({data:e,page:t,shared:i,actionCondition:r})=>new TGe(e,t,i,r)),Jo("ClearLocalStorage",({data:e,page:t,shared:i,actionCondition:r})=>new MGe(e,t,i,r)),In("misc-actions"),_r(),Sl(),Tu(),kB(),aK();var EGe=class{get sharedAssets(){return this.shared}constructor(e,t={},i=!0,{dedupeParametricGeometries:r=!1}={}){this.shared=new a4(e.shared,t,!0,i),this.shared.geometryCache.dedupeByValue=r,this.scene=new zg(e.scene,this.sharedAssets),this.shared.setEntityOpContext({scene:this.scene,shared:this.shared})}reset(e,t){this.scene.clearScene(),this.sharedAssets.reset(e.shared),this.scene.resetAfterClear(e.scene,this.sharedAssets)}resetPersonalCameraFromDocumentData(){for(let e of this.scene.children)e instanceof Dn&&!e.uiScene&&e.personalCamera.updateState(e.data.camera,{scene:this.scene,shared:this.shared})}dispose(){this.scene.dispose(),this.shared.dispose()}gc(){this.scene.releaseInstanceGroups(),this.shared.geometryCache.startGc(),this.shared.geometryCache2.startGc(),this.scene.traverseEntity(e=>{e instanceof zn&&e.markGeometryAsReachable(this.shared)}),this.shared.geometryCache.endGc(),this.shared.geometryCache2.endGc()}};kB(),Or();var mx,U7,z7="vertexOrder";function i1e(e){return U7||(U7=Promise.resolve().then(()=>(_Fe(),HSe)).then(({DRACOLoader:t})=>((mx=new t).setDecoderPath(e!==void 0?`${e}/`:"https://www.gstatic.com/draco/versioned/decoders/1.5.2/").preload(),mx.decoderPending))),U7}async function AGe(e){if(mx){let t,i={attributeIDs:{...mx.defaultAttributeIDs,[z7]:"GENERIC"},attributeTypes:{...mx.defaultAttributeTypes,[z7]:"Uint32Array"},useUniqueIDs:!1};try{t=await mx.decodeGeometry(new Int8Array(e).buffer,i)}catch(r){console.error(r)}if(t)return function(r){let n=r.attributes.find(u=>u.name===z7);if(!n)return r;let s=n.array,a=s.length,o=0;for(let u=0;u<a;u++)o=Math.max(o,s[u]+1);let l,h=r.attributes.filter(u=>u!==n).map(({name:u,itemSize:d,array:c})=>{let p=new Float32Array(o*d);for(let f=0;f<a;f++){let m=s[f]*d,g=f*d;for(let v=0;v<d;v++)p[m+v]=c[g+v]}return{name:u,itemSize:d,array:p}});if(r.index){let u=r.index.array,d=new Uint32Array(u.length);for(let c=0;c<u.length;c++)d[c]=s[u[c]];l={array:d}}return{index:l,attributes:h}}({index:t.index?{array:t.index.array}:void 0,attributes:Object.entries(t.attributes).map(([r,n])=>({name:r,itemSize:n.itemSize,array:n.array}))})}return null}async function r1e(e){for(let t of e){let i=await AGe(t.geometry.data.draco);if(i){let r=t.geometry.data;i.index&&(r.index={array:i.index.array,itemSize:1,normalized:!1,type:"Uint32Array"});let n={};i.attributes.forEach(({name:s,array:a,itemSize:o})=>{n[s]={array:a,itemSize:o,type:"Float32Array",normalized:!1}}),r.attributes=n,r.draco=void 0}}}EB(),Ew(),aC(),lC(),HY(),o0(),RB(),kSe(),WSe(),Su(),Pd(),Tu(),Xxe(),f1(),oC(),Vxe(),VB();var CGe={bloom:()=>Promise.resolve().then(()=>(MFe(),TFe)),chromaticAberration:()=>Promise.resolve().then(()=>(CFe(),AFe)),vignette:()=>Promise.resolve().then(()=>(DFe(),RFe)),noise:()=>Promise.resolve().then(()=>(OFe(),IFe)),hueSaturation:()=>Promise.resolve().then(()=>(FFe(),BFe)),brightnessContrast:()=>Promise.resolve().then(()=>(kFe(),zFe)),depthOfField:()=>Promise.resolve().then(()=>(jFe(),GFe)),pixelation:()=>Promise.resolve().then(()=>(qFe(),HFe))},PGe={bloom:()=>Promise.resolve().then(()=>(iUe(),tUe)),depthOfField:()=>Promise.resolve().then(()=>(aUe(),sUe))};function oPe(e,t,i){return Promise.all(e.map(r=>t[r]?.().catch(n=>{console.warn(`[spline] Failed to load the ${r} postprocessing effect (${i}); the effect will be skipped.`,n)}))).then(()=>{})}function RGe(e){return oPe(e,CGe,"webgl")}function DGe(e){return oPe(e,PGe,"webgpu")}var _I=new WeakMap,n1e=new WeakMap;function s1e(e,t,i){let r=n=>{e.removeEventListener(t,r,!0),n.stopImmediatePropagation(),i(n)};return e.addEventListener(t,r,!0),()=>e.removeEventListener(t,r,!0)}jr();var NGe=_w(oUe(),1);function bI(e){return Array.isArray(e)||ArrayBuffer.isView(e)&&!(e instanceof DataView)}function IGe(e){return{id:e.uuid,name:e.name,type:e.object.data?.type??e.object.type,visible:e.playModeVisible!==!1,position:{x:e.position.x,y:e.position.y,z:e.position.z},rotation:{x:e.rotation.x*et.RAD2DEG,y:e.rotation.y*et.RAD2DEG,z:e.rotation.z*et.RAD2DEG},scale:{x:e.scale.x,y:e.scale.y,z:e.scale.z},spawned:!0}}function xI(e){return{id:e.uuid,name:e.name,type:e.type??"Object",visible:e.visible,position:{x:e.position.x,y:e.position.y,z:e.position.z},rotation:{x:e.rotation.x*et.RAD2DEG,y:e.rotation.y*et.RAD2DEG,z:e.rotation.z*et.RAD2DEG},scale:{x:e.scale.x,y:e.scale.y,z:e.scale.z}}}function lPe(e,t,i){let r=a=>e.findObjectById(a)??e.findObjectByName(a),n=new Map,s=a=>{let o=n.get(a);if(o)return o;for(let l of n.values())if(l.name===a)return l};return{setVariable:(a,o)=>a in e.getVariables()?(e.setVariable(a,o),{ok:!0}):{ok:!1,warning:`spline.setVariable: no variable named "${a}" in this scene.`},getVariable:a=>e.getVariable(a),getVariables:()=>e.getVariables(),getAllObjects:()=>e.getAllObjects().map(xI),findObject:a=>{let o=r(a);return o?xI(o):void 0},getGeometry:(a,o)=>{if(!i)return{warning:"spline.getGeometry: not available in this runtime integration."};let l=s(a),h=l?l.object:(()=>{let p=r(a);return p?i.findEntity(p.uuid):void 0})();if(!h)return{warning:`spline.getGeometry: no object named "${a}" (names/ids come from getAllObjects).`};let u,d=l??h;o.space==="world"&&(d.updateWorldMatrix?.(!0,!1),u=d.matrixWorld?.elements);let c=function(p,f){let m=p?.getAttribute("position");if(!m||!m.count)return null;let g=m.count,v=f??null,y=p.getIndex?.()??null,_=Math.floor((y?y.count:g)/3),b=1/0,x=1/0,w=1/0,S=-1/0,T=-1/0,M=-1/0,E=new Float32Array(3*g);for(let D=0;D<g;D++){let O=m.getX(D),z=m.getY(D),B=m.getZ(D);v&&([O,z,B]=JLe(v,O,z,B)),O<b&&(b=O),z<x&&(x=z),B<w&&(w=B),O>S&&(S=O),z>T&&(T=z),B>M&&(M=B),E[3*D]=O,E[3*D+1]=z,E[3*D+2]=B}let A={space:v?"world":"local",vertexCount:g,triangleCount:_,indexed:y!==null,bounds:{min:[b,x,w],max:[S,T,M],size:[S-b,T-x,M-w]},vertices:E};if(y){let D=new Uint32Array(y.count);for(let O=0;O<y.count;O++)D[O]=y.getX(O);A.indices=D}let P=p.getAttribute("normal");if(P&&P.count===g){let D=v?function(O){let z=O[0],B=O[4],V=O[8],j=O[1],K=O[5],$=O[9],Q=O[2],ce=O[6],pe=O[10],ye=z*(K*pe-$*ce)-B*(j*pe-$*Q)+V*(j*ce-K*Q);if(!isFinite(ye)||Math.abs(ye)<1e-12)return null;let we=1/ye,ne=[(K*pe-$*ce)*we,(V*ce-B*pe)*we,(B*$-V*K)*we,($*Q-j*pe)*we,(z*pe-V*Q)*we,(V*j-z*$)*we,(j*ce-K*Q)*we,(B*Q-z*ce)*we,(z*K-B*j)*we];return[ne[0],ne[3],ne[6],ne[1],ne[4],ne[7],ne[2],ne[5],ne[8]]}(v):void 0;if(!v||D){let O=new Float32Array(3*g);for(let z=0;z<g;z++){let B=P.getX(z),V=P.getY(z),j=P.getZ(z);if(D){let K=D[0]*B+D[1]*V+D[2]*j,$=D[3]*B+D[4]*V+D[5]*j,Q=D[6]*B+D[7]*V+D[8]*j,ce=Math.hypot(K,$,Q);ce>1e-12?(B=K/ce,V=$/ce,j=Q/ce):(B=K,V=$,j=Q)}O[3*z]=B,O[3*z+1]=V,O[3*z+2]=j}A.normals=O}}let N=p.getAttribute("uv");if(N&&N.count===g){let D=new Float32Array(2*g);for(let O=0;O<g;O++)D[2*O]=N.getX(O),D[2*O+1]=N.getY(O);A.uvs=D}return A}(h.geometry,u);return c?{data:{id:d.uuid,name:d.name,geometry:h.data?.geometry?.type,...c}}:{warning:`spline.getGeometry: "${d.name}" has no readable geometry \u2014 only meshes do (lights, cameras and groups have none; read a group's child meshes instead).`}},updateObject:(a,o)=>{let l=s(a);if(l){let{position:g,rotation:v,scale:y,visible:_}=o;return g&&(typeof g.x=="number"&&(l.position.x=g.x),typeof g.y=="number"&&(l.position.y=g.y),typeof g.z=="number"&&(l.position.z=g.z)),v&&(typeof v.x=="number"&&(l.rotation.x=v.x*et.DEG2RAD),typeof v.y=="number"&&(l.rotation.y=v.y*et.DEG2RAD),typeof v.z=="number"&&(l.rotation.z=v.z*et.DEG2RAD)),y&&(typeof y.x=="number"&&(l.scale.x=y.x),typeof y.y=="number"&&(l.scale.y=y.y),typeof y.z=="number"&&(l.scale.z=y.z)),typeof _=="boolean"&&(l.playModeVisible=_),l.updateMatrix(),e.requestRender(),!0}let h=r(a);if(!h)return!1;let{position:u,rotation:d,scale:c,visible:p,geometry:f,material:m}=o;if(f&&typeof f=="object"&&i){let g=i.findEntity(h.uuid);if(g){let{vertices:v,normals:y,uvs:_,indices:b,...x}=f;bI(v)&&i.shared.updateEntityGeometryVertices(g,{vertices:v,normals:bI(y)?y:void 0,uvs:bI(_)?_:void 0,indices:bI(b)?b:void 0}),Object.keys(x).length>0&&i.shared.updateEntityGeometryParams(g,x)}}if(m&&typeof m=="object"&&i){let g=i.findEntity(h.uuid);g&&i.shared.updateEntityMaterialParams(g,m)}return u&&(typeof u.x=="number"&&(h.position.x=u.x),typeof u.y=="number"&&(h.position.y=u.y),typeof u.z=="number"&&(h.position.z=u.z)),d&&(typeof d.x=="number"&&(h.rotation.x=d.x*et.DEG2RAD),typeof d.y=="number"&&(h.rotation.y=d.y*et.DEG2RAD),typeof d.z=="number"&&(h.rotation.z=d.z*et.DEG2RAD)),c&&(typeof c.x=="number"&&(h.scale.x=c.x),typeof c.y=="number"&&(h.scale.y=c.y),typeof c.z=="number"&&(h.scale.z=c.z)),typeof p=="boolean"&&(h.visible=p),e.requestRender(),!0},createObject:async(a,o)=>xI(await e.createObject(a,o)),createCustomMaterial:a=>e.createCustomMaterial(a),getTexture:(a,o)=>{if(!i)return null;let l=r(a),h=l?i.findEntity(l.uuid):void 0;if(!h)return null;let u=i.shared.getEntityTexture(h,o??{});return u?{texture:u.texture,width:u.width,height:u.height,layer:u.layerType}:null},setMaterial:(a,o)=>e.setMaterial(a,o),cloneObject:(a,o)=>xI(e.cloneObject(a,o)),removeObject:a=>e.removeObject(a),spawnObject:(a,o)=>{if(!i)return{warning:"spline.spawnObject: not available in this runtime integration."};let l=r(a),h=l?i.findEntity(l.uuid):void 0;if(!h)return{warning:`spline.spawnObject: no object named "${a}" to use as a template.`};if(n.size>=500)return{warning:"spline.spawnObject: spawn budget reached (500 live copies) \u2014 destroyObject old copies (or reuse them) instead of spawning more."};let u=i.shared.spawnRuntimeClone(h,o??{});return u?(n.set(u.uuid,u),e.requestRender(),{object:IGe(u)}):{warning:`spline.spawnObject: "${a}" cannot be spawned from.`}},destroyObject:a=>{let o=s(a);return!(!i||!o||(n.delete(o.uuid),i.shared.destroyRuntimeClone(o),e.requestRender(),0))},setInstanceTransforms:(a,o)=>{if(!i)return-1;let l=r(a),h=l?i.findEntity(l.uuid):void 0;if(!h)return-1;let u=i.shared.setEntityInstanceTransforms(h,o);return u>=0&&e.requestRender(),u},...yGe(()=>i?.getAnimationControls(),a=>{let o=r(a);return o?i?.findEntity(o.uuid):void 0}),emitEvent:(a,o,l)=>{let h=r(o);return h?(l?h.emitEventReverse(a):h.emitEvent(a),{ok:!0}):{ok:!1,warning:`spline.emitEvent: no object named "${o}".`}},requestRender:()=>e.requestRender(),addSplineEventListener:(a,o)=>{let l=h=>{o({target:{id:h.target?.id??"",name:h.target?.name??""}})};return e.addEventListener(a,l),()=>e.removeEventListener(a,l)},getCanvas:()=>t}}ae(),jr();var hPe=class{constructor(e,t,i){this.iframe=e,this.bridge=t,this.observer=i}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 s=document.createElement("iframe");s.setAttribute("sandbox","allow-scripts allow-forms allow-pointer-lock"),s.title="Spline HTML content";let a=s.style;a.position="absolute",a.border="0",a.background="transparent",a.pointerEvents="auto",a.colorScheme="normal";let o=()=>{a.left=`${t.offsetLeft}px`,a.top=`${t.offsetTop}px`,a.width=`${t.offsetWidth}px`,a.height=`${t.offsetHeight}px`};o();let l=new ResizeObserver(o);l.observe(t),l.observe(n),s.srcdoc=function(u){let d=`<script>${z_e}<\/script>`,c=/<head(\s[^>]*)?>/i.exec(u);if(c){let f=c.index+c[0].length;return u.slice(0,f)+d+u.slice(f)}let p=/<html(\s[^>]*)?>/i.exec(u);if(p){let f=p.index+p[0].length;return u.slice(0,f)+`<head>${d}</head>`+u.slice(f)}return d+u}(i),n.insertBefore(s,t.nextSibling);let h=new V_e(s,lPe(e,t,r),(u,d)=>{u==="warn"?console.warn(`[spline html] ${d}`):u==="error"&&console.error(`[spline html] ${d}`)});return h.attach(),new hPe(s,h,l)}dispose(){this.bridge.dispose(),this.observer.disconnect(),this.iframe.remove()}};jr();var HO="data-spline-html-content",OGe=`
|
|
13012
|
+
`&&n--,this.htmlInput.setSelectionRange(Math.min(e,n),Math.max(e,n))}checkClickedObject(){if(this.virtualInput){let e=this.raycaster.intersectObject(this.virtualInput,!1);if(e.length>0){let t=e[0];if(t.object instanceof NZ)return t.object}}return null}selectClosestWord(e,t){if(!this.virtualInput)return;let i=this.virtualInput.wrappedText,r=i[e],n=t+1,s=t;r[t]!==" "&&(n=this.findNextCharOccurence(r,t,"forward"," "),s=this.findNextCharOccurence(r,t,"backward"," "),s>0&&s++,n>=r.length-1&&e===i.length-1&&n++);let a=this.helper,o=a.getGlobalIndexFromLineAndCharIndexes(i,e,s),l=a.getGlobalIndexFromLineAndCharIndexes(i,e,n);this.setInputSelection(o,l)}findNextCharOccurence(e,t,i,r=" "){let n=Math.max(0,e.length-1),s=i==="forward"?n:0,a=i==="forward"?1:-1,o=Math.max(Math.min(t,n),0);for(;o!==s;)if(o+=a,e.charAt(o)===r)return o;return s}getPointOnPlane(){let e=this.virtualInput?.data;if(this.virtualInput&&e&&this.raycaster.ray.intersectsPlane(this.plane)){this.planeIntersection===null&&(this.planeIntersection=new R);let t=this.raycaster.ray.intersectPlane(this.plane,this.planeIntersection);if(t){this.planeIntersection.copy(this.virtualInput.worldToLocal(t));let i=typeof e.geometry.width=="number"?e.geometry.width:1,r=typeof e.geometry.height=="number"?e.geometry.height:1;this.projected.set(t.x+.5*i,t.y-.5*r)}}}updatePlane(){let e=this.virtualInput?.data;this.virtualInput&&e&&(Oye.getNormalMatrix(this.virtualInput.matrixWorld),Nye.copy($8e).applyMatrix3(Oye).normalize(),this.virtualInput.localToWorld(Iye.set(0,0,e.geometry.depth)),this.plane.setFromNormalAndCoplanarPoint(Nye,Iye))}setInputSelection(e,t=e){this.htmlInput?.setSelectionRange(e,t),l1&&this.htmlInput?.focus(),setTimeout(()=>{this.htmlInput?.focus()})}updateTextInputStyles(){let e=this.virtualInput?.data;this.virtualInput&&e&&this.htmlInput&&(this.htmlInput.style.fontSize=e.geometry.fontSize+"px",this.htmlInput.style.letterSpacing=e.geometry.letterSpacing*e.geometry.fontSize+"px",this.htmlInput.style.lineHeight=e.geometry.fontSize*e.geometry.lineHeight+"px",this.htmlInput.style.width=e.geometry.width+"px",this.htmlInput.style.height=e.geometry.height+"px",this.htmlInput.style.textAlign=function(t){return t===4?"justify":t===2?"right":t===3?"center":"left"}(e.geometry.horizontalAlign))}},K3e=(e,t)=>{if(typeof e=="string"){let i=t.data(e);if(i)return K3e(i.value,t)}return Mo.getDisplayedValue(e)};function Lye(e,t){let i=e.text,r="";if(typeof i=="string"){let n=t.variables.data(r);n&&(r=K3e(n.value,t.variables))}else r=i.textValue.toString();return r}var Y8e=class extends nl{constructor(e,t){super(e),this.eventManager=t,this._textInputs=[],this.sceneHelpers=new Ko,this.helper=new Y3e,this._onMouseDownFocusIn=i=>{if(vi.length>1)return;this.eventContext.updateRaycaster(i);let r=null;if(this.eventContext.raycaster){for(let n of this._textInputs)if(this.eventContext.raycaster.intersectObject(n,!0).length>0){r=n;break}}this.focusOnTextInput(r),this._onCaretUpdate(),this._onMouseUp(),this.textInputManager.doubleClickHandler.start(this.eventContext.domElement),this.textInputManager.doubleClickHandler._onMouseDown(i),this._onMouseDown(i)},this.onExit=()=>{let{virtualInput:i}=this.textInputManager;if(i===null)return;let r=this.textInputManager.htmlInput;this.helper.hide(),r?.setSelectionRange(r.value.length,r.value.length),this.eventManager.controlsManager.orbitControls&&(this.eventManager.controlsManager.orbitControls.enabled=!0);let{domElement:n}=this.eventContext;n.removeEventListener("pointerdown",this._onMouseDown,!1),n.removeEventListener("pointerup",this._onMouseUp,!1),n.removeEventListener("pointermove",this._onMouseMove,!1),window.removeEventListener("keydown",this._onKeyPress),this.textInputManager.doubleClickHandler.reset(),n.addEventListener("pointerdown",this._onMouseDownFocusIn),this.eventContext.renderer.sceneHelpersOnTop=void 0,this.eventContext.renderer.pipeline.disableHelpers()},this._onMouseDown=i=>{this.eventContext.updateRaycaster(i),this.textInputManager.handleMouseDown(),this.textInputManager.virtualInput&&this.eventContext.raycaster.intersectObject(this.textInputManager.virtualInput,!0).length>0&&this.eventManager.controlsManager.orbitControls&&(this.eventManager.controlsManager.orbitControls.enabled=!1)},this._onMouseUp=()=>{this.textInputManager.handleMouseUp(),this.eventManager.controlsManager.orbitControls&&!this.eventManager.controlsManager.orbitControls.enabled&&(this.eventManager.controlsManager.orbitControls.enabled=!0)},this._onMouseMove=i=>{this.eventContext.updateRaycaster(i),this.textInputManager.handleMouseMove()},this._onTextEdit=i=>{let{htmlInput:r,virtualInput:n,helper:s}=this.textInputManager;if(!r||!n)return;let a=r.value;n.textGeometry.setText(a,this.eventContext.sharedAssets).then(()=>{this.eventContext.requestRender()});let o=n.data;s.update();let l=o.geometry.text;if(typeof l=="string"){let h=l;this.eventContext.sharedAssets.updateVariable(h,{textValue:a})}this.textInputManager.updateTextInputStyles(),this._onCaretUpdate()},this._onCaretUpdate=i=>{this.textInputManager.handleCaretUpdate(i)},this._onKeyPress=i=>{i.key==="Escape"&&this.onExit()},this.textInputManager=new X8e(this.sceneHelpers,e.raycaster,e.sharedAssets,e.requestRender,this.onExit)}connect(){let e=[];if(this.eventContext.scene.traverseEntity(r=>{r instanceof NZ&&e.push(r)}),this._textInputs=e,e.length===0)return;let{domElement:t}=this.eventContext;t.addEventListener("pointerdown",this._onMouseDownFocusIn),this.textInputManager.connect();let i=this.textInputManager.createInput();document.body.appendChild(i),i.style.display="none",i.addEventListener("keyup",this._onCaretUpdate),i.addEventListener("keydown",this._onCaretUpdate),i.addEventListener("beforeinput",this._onCaretUpdate),i.addEventListener("paste",this._onCaretUpdate),i.addEventListener("cut",this._onCaretUpdate),i.addEventListener("select",this._onCaretUpdate),i.addEventListener("selectstart",this._onCaretUpdate)}disconnect(){let e=this.textInputManager.htmlInput,{domElement:t,sharedAssets:i}=this.eventContext;t.removeEventListener("pointerdown",this._onMouseDownFocusIn),e?.removeEventListener("keyup",this._onCaretUpdate),e?.removeEventListener("keydown",this._onCaretUpdate),e?.removeEventListener("beforeinput",this._onCaretUpdate),e?.removeEventListener("paste",this._onCaretUpdate),e?.removeEventListener("cut",this._onCaretUpdate),e?.removeEventListener("select",this._onCaretUpdate),e?.removeEventListener("selectstart",this._onCaretUpdate),this._textInputs.forEach(r=>{let n=Lye(r.data.geometry,this.eventContext.sharedAssets.data);r.textGeometry.setText(n,i)}),t.removeEventListener("pointerdown",this._onMouseDown,!1),t.removeEventListener("pointerup",this._onMouseUp,!1),t.removeEventListener("pointermove",this._onMouseMove,!1),window.removeEventListener("keydown",this._onKeyPress),this.eventContext.renderer.sceneHelpersOnTop=void 0,this.eventContext.renderer.pipeline.disableHelpers(),this.textInputManager.disconnect()}focusOnTextInput(e){this.textInputManager.focus(e),this.textInputManager.onTextMaterialChanged();let t=this.textInputManager.htmlInput;if(!t||e===null)return;this.textInputManager.updateTextInputStyles(),this.eventContext.renderer.sceneHelpersOnTop=this.sceneHelpers,this.eventContext.renderer.pipeline.enableHelpers(),this.textInputManager.isDragging=!1;let i=Lye(e.textGeometry.userData.parameters,this.eventContext.sharedAssets.data);t.value=i,t.setSelectionRange(0,0),this.textInputManager.helper.show(e),t.style.display="block",t.addEventListener("input",this._onTextEdit),this.textInputManager.updatePlane();let{domElement:r}=this.eventContext;r.removeEventListener("pointerdown",this._onMouseDownFocusIn),r.addEventListener("pointerdown",this._onMouseDown,!1),r.addEventListener("pointerup",this._onMouseUp,!1),r.addEventListener("pointermove",this._onMouseMove,!1),window.addEventListener("keydown",this._onKeyPress)}};_r(),Fh("Textfields",({eventContext:e,eventManager:t})=>new Y8e(e,t)),Tw("InputGeometry",(e,t,i)=>new NZ(e,t,i)),In("textinputs"),jY();var Z3e=new Map,nA=new Map,pI=class{constructor(e,t,i,r){this.data=t,this.isPlayAudioAction=!0;let{audio:n,volume:s,delay:a,loop:o}=t;if(!n)throw new Error("Missing property");try{let l=typeof n=="string"?r.getAudio(n).src:n.data;this.audioPlayer=new sx({src:l,volume:s,delay:a,loop:o})}catch{console.warn(`Could not create an audio player for this object: "${i.name}" and this audio: "${n}"`)}nA.has(i.uuid)?nA.get(i.uuid).push(this):nA.set(i.uuid,[this]),Z3e.set(e,this)}playByToggle(){this.data.toggle==="stop"?this.audioPlayer?.status==="playing"?this.audioPlayer.stop():(this.audioPlayer?.stop(),this.audioPlayer?.play()):this.data.toggle==="pause"?this.audioPlayer?.status==="playing"?this.audioPlayer?.pause():this.audioPlayer?.play():(this.audioPlayer?.stop(),this.audioPlayer?.play())}dispose(){this.audioPlayer?.stop()}},K8e=class{constructor(e){this.data=e,this.isPauseAudioAction=!0}dispatch(){this.data.playAudio?this.pauseAudio(this.data.playAudio):this.data.object?this.pauseAllAudiosFromObject(this.data.object):this.pauseAllAudios()}pauseAudio(e){let t=Z3e.get(e);!t||(this.data.delay>0?(this.disposeDelay(),this.timeoutId=window.setTimeout(()=>{t.audioPlayer?.[this.data.interaction](),this.disposeDelay()},this.data.delay)):t.audioPlayer?.[this.data.interaction]())}pauseAllAudiosFromObject(e){let t=nA.get(e);!t?.length||(this.data.delay>0?(this.disposeDelay(),this.timeoutId=window.setTimeout(()=>{t.forEach(i=>i.audioPlayer?.[this.data.interaction]()),this.disposeDelay()},this.data.delay)):t.forEach(i=>i.audioPlayer?.[this.data.interaction]()))}pauseAllAudios(){let e=[...nA.values()];!e.length||(this.data.delay>0?(this.disposeDelay(),this.timeoutId=window.setTimeout(()=>{e.forEach(t=>{t.forEach(i=>{i.audioPlayer?.[this.data.interaction]()})}),this.disposeDelay()},this.data.delay)):e.forEach(t=>{t.forEach(i=>{i.audioPlayer?.[this.data.interaction]()})}))}disposeDelay(){clearTimeout(this.timeoutId),delete this.timeoutId}dispose(){clearTimeout(this.timeoutId),delete this.timeoutId}},Z8e=class{constructor(e,t,i,r,n){if(this.data=t,this.shared=r,this.condition=n,t.interaction==="play")this.interaction=new pI(e,t,i,r);else{if(t.interaction!=="pause"&&t.interaction!=="stop")throw new Error("Missing property");this.interaction=new K8e(t)}}dispatchBasic(){if(Nn(this.shared,this.condition)===!1)return!1;this.interaction instanceof pI?this.interaction.playByToggle():this.interaction.dispatch()}dispatchConditional(){if(Nn(this.shared,this.condition)===!1)return!1;this.interaction instanceof pI?this.interaction.audioPlayer?.play():this.interaction.dispatch()}dispatchGameControl(e){if(Nn(this.shared,this.condition)===!1)return!1;this.interaction instanceof pI&&(e==="start"?this.interaction.audioPlayer?.play():this.interaction.audioPlayer?.stop())}dispose(){this.interaction.dispose()}};_r(),Jo("Audio",({id:e,data:t,object:i,shared:r,actionCondition:n})=>new Z8e(e,t,i,r,n)),In("audio"),jr();var Q3e=new Map,sA=new Map,O7=class{constructor(e,t,i){this.data=t,this.isPlayVideoAction=!0,this.delay=0,this.status="stopped";let{layerId:r,loop:n,volume:s,delay:a}=t;if(this.object=i,r===void 0)throw new Error("Missing property");let o=function(l,h){let u;if("material"in l){let c=l.material;u=Array.isArray(c)?l.material[0].layers.find(p=>p.uuid===h):l.material.layers.find(p=>p.uuid===h)}if(!u)return;let d=u.color?.texture?.image?.img??u.holders?.find(c=>c.isVideo)?.img;return d instanceof HTMLVideoElement?d:void 0}(i,r);o&&(this.videoElement=o,this.videoElement.loop=n===1/0,l1&&(this.videoElement.autoplay=!0),s!==void 0&&(this.videoElement.volume=s)),a!==void 0&&(this.delay=a),sA.has(i.uuid)?sA.get(i.uuid).push(this):sA.set(i.uuid,[this]),Q3e.set(e,this),this.pause()}mute(){!this.videoElement||(this.videoElement.muted=!0)}unMute(){!this.videoElement||(this.videoElement.muted=!1)}play(e){if(!this.videoElement)return;let t=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);e?(this.mute(),this.delay+=150):t?(this.mute(),window.setTimeout(()=>{this.unMute()},100)):this.unMute(),this.delayTimerId=window.setTimeout(()=>{if(!this.videoElement)return;let i=this.videoElement.play();i!==void 0&&i.then(r=>{}).catch(r=>{this.play()}),this.clearDelay()},this.delay),this.status="playing"}clearDelay(){this.delayTimerId&&(clearTimeout(this.delayTimerId),delete this.delayTimerId)}pause(){!this.videoElement||(this.videoElement.pause(),this.status="paused")}stop(){!this.videoElement||(this.videoElement.pause(),this.videoElement.currentTime=0,this.status="stopped",this.clearDelay())}seek(e){return new Promise(t=>{if(!this.videoElement)return t();let i=this.videoElement.duration;if(i>0){let r=e%i;this.videoElement.currentTime=r}this.videoElement.addEventListener("seeked",()=>t(),{once:!0})})}playByToggle(){this.data.toggle==="stop"?this.status==="playing"?this.stop():(this.stop(),this.play()):this.data.toggle==="pause"?this.status==="playing"?this.pause():this.play():(this.stop(),this.play())}dispose(){!this.videoElement||(this.stop(),this.videoElement.muted=!0)}},Q8e=class{constructor(e){this.data=e,this.isPauseVideoAction=!0}dispatch(){this.data.playVideo?this.pauseVideo(this.data.playVideo):this.data.object?this.pauseAllVideosFromObject(this.data.object):this.pauseAllVideos()}pauseVideo(e){let t=Q3e.get(e);!t||(this.data.delay>0?(this.disposeDelay(),this.timeoutId=window.setTimeout(()=>{t[this.data.interaction](),this.disposeDelay()},this.data.delay)):t[this.data.interaction]())}pauseAllVideosFromObject(e){let t=sA.get(e);!t?.length||(this.data.delay>0?(this.disposeDelay(),this.timeoutId=window.setTimeout(()=>{t.forEach(i=>i[this.data.interaction]()),this.disposeDelay()},this.data.delay)):t.forEach(i=>i[this.data.interaction]()))}pauseAllVideos(){let e=[...sA.values()];!e.length||(this.data.delay>0?(this.disposeDelay(),this.timeoutId=window.setTimeout(()=>{e.forEach(t=>{t.forEach(i=>{i[this.data.interaction]()})}),this.disposeDelay()},this.data.delay)):e.forEach(t=>{t.forEach(i=>{i[this.data.interaction]()})}))}disposeDelay(){clearTimeout(this.timeoutId),delete this.timeoutId}dispose(){clearTimeout(this.timeoutId),delete this.timeoutId}},J8e=class{constructor(e,t,i,r,n){if(this.data=t,this.shared=r,this.condition=n,t.interaction==="play")this.interaction=new O7(e,t,i);else{if(t.interaction!=="pause"&&t.interaction!=="stop")throw new Error("Missing property");this.interaction=new Q8e(t)}}dispatchBasic(){if(Nn(this.shared,this.condition)===!1)return!1;this.interaction instanceof O7?this.interaction.playByToggle():this.interaction.dispatch()}dispatchConditional(){if(Nn(this.shared,this.condition)===!1)return!1;this.interaction instanceof O7?this.interaction.play():this.interaction.dispatch()}dispose(){this.interaction.dispose()}};Zn(),_r(),Jo("Video",({id:e,data:t,object:i,shared:r,actionCondition:n})=>Jl(i)?null:new J8e(e,t,i,r,n)),In("video"),jr(),ae(),zB(),Pw();var L7=(()=>{let e,t,i,r,n=!1;function s(l){!e&&!Bye()&&(t?.sharedGameControlGlobals.createdObjects.length??0)>0&&(e=requestAnimationFrame(a)),l&&(t=l,r=l.requestRender,!n&&typeof document<"u"&&(document.addEventListener("visibilitychange",o),n=!0))}function a(l){if(!t||!r)return e=void 0,void(i=void 0);let h=i?l-i:0,u=t.sharedGameControlGlobals.createdObjects,d=t.sharedGameControlGlobals.nCreatedPerAction,c=u.length,p=0;for(;p<c;){let f=u[p];f.userData.createdTime===void 0&&(f.userData.createdTime=l),f.userData.lifetime===void 0&&f.userData.quantity===void 0||f.userData.lifetime&&l-f.userData.createdTime<f.userData.lifetime||f.userData.quantity&&d[f.userData.actionId]<=f.userData.quantity?(f.userData.velocity&&(f.position.addScaledVector(f.userData.velocity,h/1e3),f.updateMatrix(),f.userData.parentMatrix&&f.matrix.premultiply(f.userData.parentMatrix),r()),p++):(d[f.userData.actionId]>f.userData.quantity&&d[f.userData.actionId]--,u.splice(p,1),f.removeFromParent(),t.sharedGameControlGlobals.rapierWorld&&f.rigidBody?(t.sharedGameControlGlobals.colliderToEntity.delete(f.rigidBody.collider(0).handle),t.sharedGameControlGlobals.rapierWorld.removeRigidBody(f.rigidBody)):(f.bvhGeometry=void 0,t.sharedGameControlGlobals.entitiesWithTransformAnim=t.sharedGameControlGlobals.entitiesWithTransformAnim.filter(m=>m.bvhGeometry!==void 0)),c--,r())}e=p>0?requestAnimationFrame(a):void 0,i=p>0?l:void 0}function o(){Bye()?e&&(cancelAnimationFrame(e),e=void 0,i=void 0):s()}return{play:s,dispose:function(){e&&(cancelAnimationFrame(e),e=void 0),n&&typeof document<"u"&&(document.removeEventListener("visibilitychange",o),n=!1),t=void 0,r=void 0,i=void 0}}})();function Bye(){return!!document&&document.hidden}var Fye=new jt,eGe=new R,tGe=new R,iGe=class{constructor(e,t,i,r,n){this.data=e,this.page=t,this.controlsManager=i,this.shared=r,this.condition=n,this.intervalId=null,this.timeoutIdQueue=[],this.uniqueId=et.generateUUID(),this.dispatch=()=>{if(Nn(this.shared,this.condition)===!1)return!1;this.data.delay?this.timeoutIdQueue.push(window.setTimeout(this.dispatchInner,1e3*this.data.delay)):this.dispatchInner()},this.dispatchFromStart=()=>{if(Nn(this.shared,this.condition)===!1)return!1;this.timeoutIdQueue.push(window.setTimeout(this.dispatchInner,1e3*this.data.delay))},this.dispatchThrottled=function(a,o=0,l={}){return TA(a,o,{leading:l.leading!==!1,trailing:l.trailing!==!1,maxWait:o})}(this.dispatch,1e3/this.data.creationSpeed),this.dispatchStart=()=>{this.intervalId===null&&(this.intervalId=window.setInterval(this.dispatch,1e3/this.data.creationSpeed))},this.dispatchStop=()=>{this.intervalId!==null&&(window.clearInterval(this.intervalId),this.intervalId=null)},this.dispatchInner=()=>{this.timeoutIdQueue.shift();let a=new Zo(this.object);if(a.playModeVisible=!0,a.expand(),this.data.coordinateSystem!=="world"){let l=this.data.coordinateSystem,h=this.page.scene.find(l);h&&(h.updateMatrixWorldRigid(),a.userData.parentMatrix=h.matrixWorldRigid)}a.scale.copy(this.object.scale),a.position.fromArray(this.data.position.map(l=>typeof l=="number"?l:0)),a.rotation.fromArray(this.data.rotation.map(l=>typeof l=="number"?l:0)),a.updateMatrix(),a.userData.parentMatrix&&a.matrix.premultiply(a.userData.parentMatrix),this.page.add(a);let o=this.controlsManager.sharedGameControlGlobals;o.createdObjects.push(a),o.nCreatedPerAction[this.uniqueId]===void 0?o.nCreatedPerAction[this.uniqueId]=1:o.nCreatedPerAction[this.uniqueId]++,a.updateWorldMatrix(!0,!0),a.traverseObject(this.traverseObjectCB),L7.play(),this.controlsManager.requestRender()},this.traverseObjectCB=a=>{let o;if(a.updateMatrixWorldRigid(),this.controlsManager.sharedGameControlGlobals.rapierWorld){if(a instanceof Xf){if(!a.objectForSample)return a.object.dataPatched.physics.fusedBody===!0&&a.object.dataPatched.physics.rigidBody==="dynamic"||void 0;if(a.objectForSample.dataPatched.physics.fusedBody)return;o=a.object}else if(a instanceof Zo)o=a.object;else if(o=a,o.dataPatched.cloner?.hideBase)return!0}else{if(a instanceof Xf)return;o=a instanceof Zo?a.object:a}this.data.destroy==="Time"?a.userData.lifetime=1e3*this.data.lifetime:this.data.destroy==="Quantity"&&(a.userData.quantity=this.data.destroyAfterQuantity,a.userData.actionId=this.uniqueId);let l=new R().fromArray(this.data.velocity.map(u=>typeof u=="number"?u:0)),h=o.dataPatched;if(!(h.physics.enabled==="visibility"?!h.visible:!h.physics.enabled)&&(this.controlsManager.sharedGameControlGlobals.rapierWorld?(this.controlsManager.addRigidBody(a,o,{fromCreate:!0,dynamic:this.data.dynamic}),this.data.destroy==="Collision"&&(a.rigidBody?.collider(0).setActiveEvents(1),a.userData.hasCollisionDestroy=!0),a.matrixWorld.decompose(eGe,Fye,tGe),l.applyQuaternion(Fye),this.data.velocity.some(u=>u!==0)&&this.data.dynamic&&a.rigidBody?.setLinvel(l.divideScalar(this.controlsManager.pixelsPerMeter),!0)):("geometry"in a.object&&this.controlsManager.addBoundsTree(a),this.data.velocity.some(u=>u!==0)&&this.data.dynamic&&(a.userData.velocity=l)),o.dataPatched.physics?.fusedBody===!0))return!0};let s=this.page.scene.find(this.data.object);if(!s)throw new Error("Missing Property");if(this.object=s,this.data.coordinateSystem!=="world"&&!this.page.scene.find(this.data.coordinateSystem))throw new Error("Missing Property");L7.play(i)}dispose(){this.intervalId!==null&&(window.clearInterval(this.intervalId),this.intervalId=null),this.timeoutIdQueue.forEach(e=>window.clearTimeout(e)),this.timeoutIdQueue=[],this.dispatchThrottled.cancel(),this.page.remove(...this.controlsManager.sharedGameControlGlobals.createdObjects),this.controlsManager.sharedGameControlGlobals.createdObjects=[],L7.dispose()}},rGe=class{constructor(e,t,i,r,n){this.data=e,this.page=t,this.controlsManager=i,this.shared=r,this.condition=n,this.timeoutIdQueue=[],this.dispatchInner=()=>{this.objects.forEach(this.destroyCallback)},this.destroyCallback=s=>{this.timeoutIdQueue.shift();let a=this.page.scene.find(s);if(a===void 0)return;let o=this.controlsManager.sharedGameControlGlobals.rapierWorld,l=!o||a.dataPatched.physics?.fusedBody;if(a.cloner){for(let h of a.cloner.children)l?(h.playModeVisible=!1,a.dataPatched.physics?.rigidBody==="positioned"&&this.removeBody(h),h.bvhGeometry&&(h.bvhGeometry=void 0)):this.clone===void 0||this.clone===h?(h.playModeVisible=!1,this.removeBody(h)):h.playModeVisible===void 0&&(h.playModeVisible=!0);a.cloner.syncInstanceMatrices(),(l||this.clone===void 0||this.clone===!1)&&(a.visible=!1,this.removeBody(a),a.bvhGeometry&&(a.bvhGeometry=void 0))}else this.removeBody(a),a.bvhGeometry&&(a.bvhGeometry=void 0),a.visible=!1;this.controlsManager.sharedGameControlGlobals.entitiesWithTransformAnim=o===void 0?this.controlsManager.sharedGameControlGlobals.entitiesWithTransformAnim.filter(h=>h.bvhGeometry!==void 0):this.controlsManager.sharedGameControlGlobals.entitiesWithTransformAnim.filter(h=>h.rigidBody!==void 0),a.destroyedInAction=!0,this.controlsManager.requestRender()},this.objects=[...e.objects]}removeBody(e){let t=e.rigidBody;if(!t)return;let i=this.controlsManager.sharedGameControlGlobals;i.colliderToEntity.delete(t.collider(0).handle),i.kinematicBodyToEntity.delete(t.handle);let r=this.controlsManager;r.fixedBodiesToWatch=r.fixedBodiesToWatch.filter(([,n])=>n!==t),i.rapierWorld.removeRigidBody(t),e.rigidBody=void 0}dispatch(e){if(Nn(this.shared,this.condition)===!1)return!1;this.clone=e,this.data.delay?this.timeoutIdQueue.push(window.setTimeout(this.dispatchInner,1e3*this.data.delay)):this.dispatchInner()}dispatchFromStart(){if(Nn(this.shared,this.condition)===!1)return!1;this.timeoutIdQueue.push(window.setTimeout(this.dispatchInner,1e3*this.data.delay))}dispose(){this.timeoutIdQueue.forEach(e=>window.clearTimeout(e))}};_r(),Jo("Create",({data:e,page:t,eventManager:i,shared:r,actionCondition:n})=>new iGe(e,t,i.controlsManager,r,n)),Jo("Destroy",({data:e,page:t,eventManager:i,shared:r,actionCondition:n})=>new rGe(e,t,i.controlsManager,r,n)),In("create-destroy"),zt(),zt(),wl(),ae(),Oh(),Sl(),Zn();var Uye=new R;function IZ(e,t,i=!1){let r=[],n=s=>{let a=s.data;delete s.states,s.currentState=null,s.reversibleToState=null,s.currentTransitionEvent=null;for(let o of a.states){let l={...o.data};s.states||(s.states={}),s.states[o.id]=ny.patch(a,l)}kye(e.scene,s,null,t,a.events.find(o=>o.data.type==="Follow"||o.data.type==="LookAt")!==void 0),zye(e)};e.scene.traverse2D(n),e.traverseChildren(s=>{if(i&&(s.rigidBody?.setTranslation(s.position0,!0),s.rigidBody?.setRotation(s.rotation0,!0),s.rigidBody?.setLinvel(Uye,!0),s.rigidBody?.setAngvel(Uye,!0)),!nr.is(s))return;let a=s.uuid,o=s.data;if(delete s.states,s.uuid===d1)return;let l=!1;r.some(h=>e.scene.find(a)?.isDescendantOf(h))?l=!0:o.physics?.fusedBody===!0&&o.physics.rigidBody==="dynamic"&&r.push(a),s.data=o,s.currentState=null,s.reversibleToState=null,s.currentTransitionEvent=null,s.transitionState={settled:!0,state:null};for(let h of o.states){let u={...h.data};e.data.globalPhysics.usePhysics===!0&&o.physics&&(o.physics.rigidBody==="dynamic"||l)&&(h.data.position!==void 0&&delete u.position,h.data.rotation!==void 0&&delete u.rotation),s.states||(s.states={}),s.states[h.id]=Og.patch(o,u)}kye(e.scene,s,null,t,o.events.find(h=>h.data.type==="Follow"||h.data.type==="LookAt")!==void 0),$o(s)&&s.frame&&(s.frame.traverse(h=>n(h)),s.uiCanvas?.applySize())}),zye(e),e.frame&&(e.frame.traverse(s=>n(s)),e.uiCanvas?.applySize())}function zye(e){e.traverseEntity(t=>{for(let i of t.data.events){let r=[];switch(i.data.type){case"Follow":case"MouseHover":case"Scroll":case"MouseDown":case"MouseUp":case"MousePress":case"KeyUp":case"KeyDown":case"KeyPress":case"Collision":r.push(...i.data.actions);break;case"GameControl":for(let n of Object.values(i.data.gameActions))r.push(...n);break;case"DragDrop":r.push(...i.data.dragDropActions.drag,...i.data.dragDropActions.drop);break;case"Conditional":r.push(...i.data.inActions,...i.data.outActions)}for(let n of r)if(n.data.type==="Create"&&n.data.hideBase==="Yes"){let s=e.scene.find(n.data.object);s&&(s.visible=!1)}}})}function kye(e,t,i,r,n=!1){if(e.markShadowsDirty(),t instanceof zn&&!Zf(t)&&t.removeInteractionGeometry(r),Jl(t)?t.changeSelectedState(i,{shared:r},n):t.changeSelectedState(i,{scene:e,shared:r},n),t instanceof zn&&t.updateGeometryGroupsIfNeeded(),t instanceof Qn&&t.updateCameraState(t.dataPatched,{scene:e,shared:r}),!Jl(t)){if(t.cloner){let s=!1;for(let a of t.cloner.children)a.playModeVisible=void 0,a.transformOverride!==void 0&&(a.transformOverride=void 0,s=!0);s&&e.addPendingUpdateCloner(t),t.cloner.syncInstanceMatrices()}t.updateVisible()}}var nGe=class{constructor(e,t,i,r,n){this.data=e,this.page=t,this.eventManager=i,this.shared=r,this.condition=n,this.timeOutId=-1,this.scene=t.scene}dispatch(){if(Nn(this.shared,this.condition)===!1)return!1;this.data.target!==this.page.uuid&&(window.clearTimeout(this.timeOutId),this.timeOutId=window.setTimeout(()=>{this.play()},1e3*this.data.delay))}dispose(){window.clearTimeout(this.timeOutId)}play(){if(this.scene.children.every(t=>t.uuid!==this.data.target||t.data.uiScene))return;this.data.transition==="fade"&&this.data.duration>0&&this.eventManager.eventContext.renderer.renderFromSceneForSceneTransitionPass(this.scene,this.scene.activeCamera,1e3*this.data.duration),this.eventManager.deactivate(),this.eventManager.controlsManager.deactivate();let e=this.scene.activeCamera;this.scene.updatePage(this.data.target),this.scene.traverseVisibleEntity(t=>{t.type==="ParticleSystem"&&(t.sleep(),t.wakeUp(),t.data.autoPlay?t.start():t.stop())}),this.scene.activePage.switchToPlayCamera(),this.scene.activeCamera.copyViewPlaneSize(e),IZ(this.scene.activePage,this.shared),this.eventManager.activate(),this.eventManager.controlsManager.activate(this.eventManager)}};function sGe(e){return{easing:e.type,control1:qf(e.cubicControls?.control1,[0,0]),control2:qf(e.cubicControls?.control2,[1,1]),...e.springParameters}}function Tb(e,t){let i=[];for(let r of e??[]){let n=t(r.data);n!==void 0&&i.push({time:r.data.time,ease:sGe(r.data.easing),value:n})}return{keyframes:Jbe(i)}}function gc(e,t){if(e.keyframes.length===0)return;let{index0:i,index1:r,t:n}=Qbe(e.keyframes,t),s=e.read;if(s&&s.index0===i&&s.index1===r&&s.t===n)return;let a={index0:i,index1:r,from:e.keyframes[i].value,to:e.keyframes[r].value,t:n};return e.read=a,a}function aGe(e){e.read=void 0}function fI(e,t,i){return e+(t-e)*i}_r(),Jo("SceneTransition",({data:e,page:t,eventManager:i,shared:r,actionCondition:n})=>new nGe(e,t,i,r,n)),In("scene-transition"),zt(),ae(),zt(),zt(),ae(),Na(),Oh(),OB(),CK(),BB(),Sl(),Zn(),Ad(),oK(),sC(),zt(),jr(),zt(),ae(),Su();var{degToRad:mje,radToDeg:gje}=et;function fo(e,t,i,r,n,s){let a=i[e]!==void 0?i[e]:void 0,o=r[e];if(o==null)return;let l=a!=null?typeof a=="string"?Number(n.getVariable(a)??0):a:t[e],h=typeof o=="string"?Number(n.getVariable(o)??0):o;return l!==h?{update:u=>{let d=et.lerp(l,h,u);t[e]=s?Math.trunc(d):d},start:()=>{t[e]=l},end:()=>{t[e]=h}}:void 0}function NX(e,t,i,r,n,s){let a=i[e]?i[e]:void 0,o=r[e];if(!o)return;let l=t[e],h=[...a??l].map(d=>typeof d=="string"?Number(n.getVariable(d)??0):d),u=[...o].map(d=>typeof d=="string"?Number(n.getVariable(d)??0):d);return h.length!==u.length||yy(h,u)?void 0:{update:d=>{h.forEach((c,p)=>{let f=et.lerp(c,u[p],d);t[e][p]=s?Math.trunc(f):f})},start:()=>{Object.assign(t[e],h)},end:()=>{Object.assign(t[e],u)}}}function sB(e,t,i){return t.forEach((r,n)=>{e.setComponent(n,typeof r=="string"?Number(i.getVariable(r)??0):r)}),e}function Vye(e,t,i,r,n){let s=i[e]?i[e]:void 0,a=r[e];if(!a)return;let o=t[e],l=s?sB(new R,s,n):o.clone(),h=sB(new R,a,n);return l.equals(h)?void 0:{update:u=>{o.lerpVectors(l,h,u)},start:()=>{o.copy(l)},end:()=>{o.copy(h)}}}function Gye(e,t,i){return t.forEach((r,n)=>{e.setComponent(n,typeof r=="string"?Number(i.getVariable(r)??0):r)}),e}function mI(e,t,i,r,n){let s=i[e]?i[e]:void 0,a=r[e];if(!a)return;let o=t[e],l=!(o instanceof Z),h=o instanceof Z?o:new Z().fromArray(o),u=s?Gye(new Z,s,n):h.clone(),d=Gye(new Z,a,n);return u.equals(d)?void 0:{update:c=>{h.lerpVectors(u,d,c),l&&(t[e]=h.toArray())},start:()=>{h.copy(u),l&&(t[e]=h.toArray())},end:()=>{h.copy(d),l&&(t[e]=h.toArray())}}}function gI(e,t,i,r,n){let s=i[e]?i[e]:void 0,a=r[e];if(!a)return;let o=t[e],l=new kr(o.r,o.g,o.b,o.a),h=s?typeof s=="string"?n.getColor(s).clone():new kr(s.r,s.g,s.b,s.a):l.clone(),u=typeof a=="string"?n.getColor(a).clone():new kr(a.r,a.g,a.b,a.a);return h.equals(u)?void 0:{update:d=>{l.lerpColors(h,u,d);let c=et.lerp(h.a,u.a,d);l.a=c,t[e]={r:l.r,g:l.g,b:l.b,a:l.a}},start:()=>{l.copy(h)},end:()=>{l.copy(u)}}}function rg(e,t,i,r,n){return typeof t[e]=="number"?fo(e,t,i??{},r,n):Array.isArray(t[e])?NX(e,t,i??{},r,n):void 0}function oGe(e,t){if(e)for(let[i,r]of Object.entries(t)){let n=e[i];if(Array.isArray(n)&&Array.isArray(r)){let s=Math.min(n.length,r.length);for(let a=0;a<s;a++)n[a]=r[a]}else e[i]=r}}function vI(e,t,i,r){let n={};if(!t||!i)return n;for(let s of e){let a=t[s],o=i[s];if(typeof a=="number"&&typeof o=="number")n[s]=et.lerp(a,o,r);else if(Array.isArray(a)&&Array.isArray(o)){let l=Math.min(a.length,o.length);n[s]=Array.from({length:l},(h,u)=>et.lerp(a[u],o[u],r))}}return n}new R,new Dr;var jye=[["radial",RL],["linear",DL],["grid",NL],["toObject",IL],["randomnessObject",OL]];function J3e(e,t,i,r,n){let s=e.getValue(r);if(s!==void 0){if(r==="colors")return function(a,o,l,h="colors"){if(!a.hasValue(h)||!(h in l))return;let u=[],d=a.getValue(h),c=o?o[h]:d.map(f=>f.toArray()),p=l[h];for(let f=0;f<d.length;++f){let m=[...c[f]],g=[...p[f]];EA.isEqual(m,g)||u.push({update:v=>{d[f].fromArray(EA.lerp(m,g,v))},start:()=>{d[f].fromArray(m)},end:()=>{d[f].fromArray(g)}})}return u.length?u:void 0}(e,t,i,r);if(Array.isArray(s))return r==="steps"?function(a,o,l,h="steps"){if(!a.hasValue(h)||!(h in l))return;let u=[],d=a.getValue(h),c=o?o[h]:d,p=l[h];return yy(c,p)||u.push({update:f=>{let m=[...d];for(let g=0;g<d.length;++g){let v=c[g],y=p[g];m[g]=et.lerp(v,y,f)}a.setValue(h,m)},start:()=>{a.setValue(h,c)},end:()=>{a.setValue(h,p)}}),u.length?u:void 0}(e,t,i,r):void 0;if(typeof s=="number")return function(a,o,l,h,u){if(!a.hasValue(h)||!(h in l))return;let d=o?o[h]:a.getValue(h),c=l[h],p=typeof d=="string"?Number(u.getVariable(d)??0):d,f=typeof c=="string"?Number(u.getVariable(c)??0):c;return{update:m=>{a.setValue(h,et.lerp(p,f,m))},start:()=>{a.setValue(h,p)},end:()=>{a.setValue(h,f)}}}(e,t,i,r,n);if(typeof s!="boolean"){if(s instanceof Z)return function(a,o,l,h){if(!a.hasValue(h)||!(h in l))return;let u=a.getValue(h),d=o?new Z().fromArray(o[h]):u.clone(),c=new Z().fromArray(l[h]);return d.equals(c)?void 0:{update:p=>{u.lerpVectors(d,c,p)},start:()=>{u.copy(d)},end:()=>{u.copy(c)}}}(e,t,i,r);if(s instanceof R)return function(a,o,l,h,u){if(!a.hasValue(h)||!(h in l))return;let d=a.getValue(h),c=o?o[h]:void 0,p=l[h],f=c?sB(new R,c,u):d.clone(),m=sB(new R,p,u);return f.equals(m)?void 0:{update:g=>{d.lerpVectors(f,m,g)},start:()=>{d.copy(f)},end:()=>{d.copy(m)}}}(e,t,i,r,n);if(s instanceof kr)return function(a,o,l,h,u){if(!a.hasValue(h)||!(h in l))return;let d=o?o[h]:void 0,c=l[h],p=a.getValue(h),f=d?typeof d=="string"?u.color(d).clone():new lt().setRGB(d.r,d.g,d.b):p.clone(),m=typeof c=="string"?u.color(c).clone():new kr(c.r,c.g,c.b,c.a);if(f.equals(m))return;let g=p.clone();return{update:v=>{a.getValue(h)!==g&&a.setValue(h,g),g.lerpColors(f,m,v)},start:()=>{g.copy(f)},end:()=>{g.copy(m)}}}(e,t,i,r,n);if(s instanceof lt)return function(a,o,l,h,u){if(!a.hasValue(h)||!(h in l))return;let d=o?o[h]:void 0,c=l[h],p=a.getValue(h),f=d?typeof d=="string"?u.color(d).clone():new lt().setRGB(d.r,d.g,d.b):p.clone(),m=typeof c=="string"?u.color(c).clone():new lt().setRGB(c.r,c.g,c.b);if(f.equals(m))return;let g=p.clone();return{update:v=>{a.getValue(h)!==g&&a.setValue(h,g),g.lerpColors(f,m,v)},start:()=>{g.copy(f)},end:()=>{g.copy(m)}}}(e,t,i,r,n);if("isTexture"in s)return function(a,o,l,h="texture",u){if(!a.hasValue(h)||!(h in l))return;let d=T=>Number(typeof T=="string"?u?.getVariable(T)??0:T??0),c=a.getNode("rotation"),p=o?d(o[h]?.rotation):(c?.value??0)*et.RAD2DEG,f=d(l[h]?.rotation);if(c&&Math.abs(p-f)>1e-9)return{update:T=>{c.value=et.lerp(p,f,T)*et.DEG2RAD},start:()=>{c.value=p*et.DEG2RAD},end:()=>{c.value=f*et.DEG2RAD}};let m=function(T){let M=T.getNode("mat");if(typeof M?.updateMatrix=="function")return M;let E=T.getValue("mat");return typeof E?.updateMatrix=="function"?E:void 0}(a);if(!m)return;let g=o?o[h]:m,v=l[h],y=[...g.repeat],_=[...g.offset],b=[...v.repeat],x=[...v.offset],w=g.rotation??0,S=v.rotation??0;return Uc.isEqual(y,b)&&Uc.isEqual(_,x)&&w===S?void 0:{update:T=>{m.repeat=Uc.lerp(y,b,T),m.offset=Uc.lerp(_,x,T),m.rotation=et.lerp(w,S,T),m.updateMatrix()},start:()=>{m.repeat=[...y],m.offset=[..._],m.rotation=w,m.updateMatrix()},end:()=>{m.repeat=[...b],m.offset=[...x],m.rotation=S,m.updateMatrix()}}}(e,t,i,r,n)}}}function Wye(e,t,i,r){let n=[],s=t.layers?_u(t,r):e.transparent,a=_u(i,r);n.push(function(o,l,h){let u=l||h;return{update:d=>{o.setTransparent(d===1?h:u)}}}(e,s,a)),function(o,l,h){let u=o.ensureRainbowNoiseCompiled;if(typeof u=="function")for(let d of[...o.layers]){if(d.type!=="rainbow")continue;let c=l.layers?.data(d.uuid),p=h.layers.data(d.uuid);($f(c?.noiseStrength)||$f(p?.noiseStrength))&&u.call(o,d.uuid)}}(e,t,i);for(let o of e.layers){let l=t.layers?.data(o.uuid),h=i.layers.data(o.uuid);if(!h||o.type!=="light"&&(!(o.visible??1)||!(h.visible??1)))continue;let u=Cw[o.type]??[],d=o.getNames().filter(c=>!u.includes(c)&&!mB.some(p=>c.includes(p)));for(let c of d)try{let p=J3e(o,l,h,c,r);p&&(Array.isArray(p)?n.push(...p):n.push(p))}catch(p){console.error(`lerpMaterial: unexpected material layer for ${c}`,p)}}return n}function Hye(e,t,i,r,n,s){let a=J3e(t,i,r,e,s);!a||(Array.isArray(a)?a.forEach(o=>o.update(n)):a.update(n))}function qp(e,t,i){!e||(e[t]={...e[t],...i})}function lGe(e,t,i,r,n,s,a){let o=()=>{a.transform=!0,a.bounds=!0,a.boolean=!0,a.render=!0};switch(e.on){case"position":case"scale":{let l=gc(e.track,i);if(!l)return;let h=fI(l.from,l.to,l.t);return t[e.on][e.axis]=h,qp(s,e.on,{[e.axis]:h}),void o()}case"rotation":{let l=gc(e.track,i);if(!l)return;let h=fI(l.from,l.to,l.t);return t.rotation[e.axis]=h*et.DEG2RAD,qp(s,"rotation",{[e.axis]:h}),void o()}case"shapeSize":{let l=gc(e.track,i);if(!(l&&t instanceof zn))return;let h=fI(l.from,l.to,l.t);return t.userData.value={...t.userData.value,[e.axis]:h},qp(s,"shapeSize",{[e.axis]:h}),a.size=!0,a.bounds=!0,a.boolean=!0,void(a.render=!0)}case"opacity":{let l=gc(e.track,i);if(!l||!(t instanceof Es)||Array.isArray(t.material))return;let h=t.material.getLayersOfType("light")[0];if(h===void 0)return;let u=et.lerp(l.from,l.to,l.t),d=t.material,c=l.to>=1&&(l.t===1||l.from>=1);return d.setTransparent(!c||_u(d.data,r.shared),r.scene),Hye("alphaOverride",h,{alphaOverride:u},{alphaOverride:u+1},0,r.shared),s&&(s.opacity=u),void(a.render=!0)}case"material":{let l=gc(e.track,i);if(!l||Object.keys(l.from).length===0||Object.keys(l.to).length===0)return;let{layer:h}=e,u={};for(let d in h.data){if(!(d in l.from)||!(d in l.to))continue;let c=IX(l.from[d],l.to[d],l.t,n);if(c===void 0)continue;u[d]=c;let p=h.getValue(d);p!==void 0&&(d==="alpha"&&typeof p=="number"&&p>0&&t instanceof Es&&!Array.isArray(t.material)&&(t.material.transparent=!0),Hye(d,h,l.from,l.to,l.t,r.shared))}return qp(s,"material",{[h.uuid]:u}),void(a.render=!0)}case"light":{let l=gc(e.track,i);if(!l||!(t instanceof Rw||t instanceof hC||t instanceof Dw))return;let h=IX(l.from,l.to,l.t,n);return t[e.field]=h,qp(s,"light",{[e.field]:h}),void(a.render=!0)}case"camera":{let l=gc(e.track,i);if(!(l&&t instanceof Qn))return;let h=fI(l.from,l.to,l.t);return t[e.field]=h,void qp(s,"camera",{[e.field]:h})}case"cloner":{let l=gc(e.track,i);if(!l)return;let h=t.cloner?.parameters,u=function(d,c,p,f){if(!d)return{};let m=vI(["count"],c,p,f);m.count!==void 0&&(m.count=Math.trunc(m.count));for(let[g,v]of jye){if(!d[g])continue;let y=vI(v,c[g],p[g],f);Object.keys(y).length&&(m[g]=y)}return m}(h,l.from,l.to,l.t);return function(d,c){if(d){c.count!==void 0&&(d.count=c.count);for(let[p]of jye){let f=c[p];f&&oGe(d[p],f)}}}(h,u),qp(s,"cloner",u),a.cloner=!0,a.boolean=!0,void(a.render=!0)}case"pathExtrusion":{let l=gc(e.track,i);if(!l||!xB(t))return;let h=vI(zL,l.from,l.to,l.t),u=t.geometry.userData.parameters;return u.extrusion={...u.extrusion,...h},qp(s,"pathExtrusion",h),t.updateGeometryInteractions({extrusion:{...u.extrusion}},r.shared),a.bounds=!0,a.boolean=!0,void(a.render=!0)}case"pathSnapping":{let l=gc(e.track,i);if(!l)return;let h=t,u=vI(Sbe,l.from,l.to,l.t);return h.userData.pathSnapping={...h.userData.pathSnapping,...u},qp(s,"pathSnapping",u),h.updatePathSnapping(h.userData.pathSnapping),void(a.render=!0)}}}function IX(e,t,i,r){if(typeof e=="string"&&r&&(e=r.color(e)),typeof t=="string"&&r&&(t=r.color(t)),typeof e=="number")return et.lerp(e,t,i);if(Gr.is(e))return Gr.lerp(e,t,i);if(Ks.is(e))return Ks.lerp(e,t,i);if(Array.isArray(e))return(e.length>t.length?t:e).map((n,s)=>{if(Array.isArray(n)){let a=e[s].length>t[s].length?t[s].length:e[s].length;return(a===4?EA:a===3?jg:Uc).lerp(e[s],t[s],i)}return et.lerp(e[s],t[s],i)});if(typeof e=="object"&&e!==null){let n={};for(let s in e){let a=IX(e[s],t[s],i,r);a!==void 0&&(n[s]=a)}return n}}zt(),ae(),Su(),sC(),Ad(),jr(),jr(),Zn(),zt(),Oh(),Zn(),Na(),Oh(),oC(),Sl(),f1(),ae(),zt(),ae(),lC(),Zn(),jr(),Zn(),ae(),o0(),ae();var B7=new R,qye=new Dr;function hGe(e,t,i,r,n){let s=[];return e.data.visible&&s.push(...function(a,o,l,h,u){let d,c,p,f,m,g,v,y=[];if(Jl(a)?(d=mI("position",a,o,l,u),d&&y.push(d),p=fo("rotation",a,o,l,u),p&&y.push(p),f=mI("shear",a,o,l,u),f&&y.push(f)):(v={slide:o.pathSnapping?.slide??a.updatedPathSnapping?.slide??a.dataPatched.pathSnapping?.slide??0,offset:o.pathSnapping?.offset??a.updatedPathSnapping?.offset??a.dataPatched.pathSnapping?.offset??0},m=fo("slide",v,o.pathSnapping??a.updatedPathSnapping??a.dataPatched.pathSnapping,l.pathSnapping??a.dataPatched.pathSnapping,u),m&&y.push(m),g=fo("offset",v,o.pathSnapping??a.updatedPathSnapping??a.dataPatched.pathSnapping,l.pathSnapping??a.dataPatched.pathSnapping,u),g&&y.push(g),!m&&!g&&(d=Vye("position",a,o,l,u),d&&y.push(d),c=Vye("scale",a,o,l,u),c&&y.push(c),p=function(_,b,x,w,S){let T=b?.rotation?b.rotation.map(N=>(typeof N=="string"?Number(S.getVariable(N)??0):N)*et.DEG2RAD):void 0,M=x.rotation?.map(N=>(typeof N=="string"?Number(S.getVariable(N)??0):N)*et.DEG2RAD);if(!M)return;let E=T?new R().fromArray(T):new R().setFromEuler(_.rotation),A=new R().fromArray(M);if(E.equals(A))return;let P=B7.subVectors(A,E);if(w&&P.toArray().every(N=>Math.abs(N)<2*Math.PI)){let N=new jt().setFromEuler(qye.setFromVector3(E)),D=new jt().setFromEuler(qye.setFromVector3(A));return{update:O=>{(function(z,B,V,j){if(j===0)return V.copy(z);if(j===1)return V.copy(B);let K=z.w*B.w+z.x*B.x+z.y*B.y+z.z*B.z;if(K>=1)return V.copy(z);let $=1-K*K;if($<=Number.EPSILON){let we=1-j;return V.w=we*z.w+j*B.w,V.x=we*z.x+j*B.x,V.y=we*z.y+j*B.y,V.z=we*z.z+j*B.z,V.normalize(),V}let Q=Math.sqrt($),ce=Math.atan2(Q,K),pe=Math.sin((1-j)*ce)/Q,ye=Math.sin(j*ce)/Q;V.w=z.w*pe+B.w*ye,V.x=z.x*pe+B.x*ye,V.y=z.y*pe+B.y*ye,V.z=z.z*pe+B.z*ye})(N,D,_.quaternion,O)},start:()=>{_.rotation.setFromVector3(E)},end:()=>{_.rotation.setFromVector3(A)}}}return{update:N=>{B7.lerpVectors(E,A,N),_.rotation.setFromVector3(B7)},start:()=>{_.rotation.setFromVector3(E)},end:()=>{_.rotation.setFromVector3(A)}}}(a,o,l,h,u),p&&y.push(p),f=function(_,b,x){let w=b.shear,S=x.shear;if(!S)return;let T=_.shearMatrix,M=w??[T.elements[4],T.elements[8],T.elements[1],T.elements[9],T.elements[2],T.elements[6]],E=S;return M.every((A,P)=>A===E[P])?void 0:{update:A=>{M.forEach((P,N)=>{let D=et.lerp(P,E[N],A);T.elements[Dh.INDEX_MAP[N]]=D})},start:()=>{M.forEach((A,P)=>{T.elements[Dh.INDEX_MAP[P]]=A})},end:()=>{E.forEach((A,P)=>{T.elements[Dh.INDEX_MAP[P]]=A})}}}(a,o,l),f&&y.push(f))),d||c||p||f||m||g){let _=Jl(a)?()=>{a.updateWorldMatrix(!0,!1,!0),a.resetBBoxNeedsUpdate()}:()=>{a.updateMatrix(),a.hasNonUniformScale&&(a.updateMatrixWorld(),a.updateMatrixWorldRigid()),a.parent?.matrixWorldFusedFalse&&(a.matrixWorld.multiplyMatrices(a.parent.matrixWorldFusedFalse,a.matrix),a.matrixWorldNeedsUpdate=!1),yd(a)&&zc(a.parent)&&a.invalidateDownstreamBooleanData(!0),a.updatePathSnapping(Object.assign({},o.pathSnapping,v))};y.push({update:_,start:_,end:_})}return y}(e,t,i,n,r.shared)),Jl(e)?s.push(...function(a,o,l,h,u){let d,c,p,f,m,g,v,y,_,b,x,w,S,T,M,E=[];if("width"in a&&(d=fo("width",a,o,l,u),d&&E.push(d)),"height"in a&&(c=fo("height",a,o,l,u),c&&E.push(c)),a instanceof Va||a instanceof Hc){let A={...o.fill},P={...l.fill};A.enabled!==void 0&&A.enabled!==P.enabled&&(E.push(function(N){return{update:()=>{N instanceof Va&&(N.fill.enabled=!0)}}}(a)),A.enabled||Object.assign(A,{enabled:!0,color:{...A.color,a:0}}),P.enabled||Object.assign(P,{enabled:!0,color:{...P.color,a:0}})),p=gI("color",a.fill,A,P,u),p&&E.push(p)}if(a instanceof Va){let A={...o.stroke},P={...l.stroke};(A.enabled||P.enabled)&&(E.push(function(N){return{update:()=>{N instanceof Va&&(N.stroke.enabled=!0)}}}(a)),A.enabled||Object.assign(A,{enabled:!0,color:{...A.color,a:0}}),P.enabled||Object.assign(P,{enabled:!0,color:{...P.color,a:0}})),f=gI("color",a.stroke,A,P,u),f&&E.push(f),m=fo("thickness",a.stroke,A,P,u),m&&E.push(m)}if(a instanceof Va){let A={...o.dropShadow},P={...l.dropShadow};(A.enabled||P.enabled)&&(E.push(function(N){return{update:()=>{N instanceof Va&&(N.dropShadow.enabled=!0)}}}(a)),A.enabled||Object.assign(A,{enabled:!0,color:{...A.color,a:0}}),P.enabled||Object.assign(P,{enabled:!0,color:{...P.color,a:0}})),g=gI("color",a.dropShadow,A,P,u),g&&E.push(g),v=fo("blurRadius",a.dropShadow,A,P,u),v&&E.push(v),_=fo("spread",a.dropShadow,A,P,u),_&&E.push(_),y=mI("offset",a.dropShadow,A,P,u),y&&E.push(y)}if(a instanceof Va){let A={...o.innerShadow},P={...l.innerShadow};(A.enabled||P.enabled)&&(E.push(function(N){return{update:()=>{N instanceof Va&&(N.innerShadow.enabled=!0)}}}(a)),A.enabled||Object.assign(A,{enabled:!0,color:{...A.color,a:0}}),P.enabled||Object.assign(P,{enabled:!0,color:{...P.color,a:0}})),b=gI("color",a.innerShadow,A,P,u),b&&E.push(b),x=fo("blurRadius",a.innerShadow,A,P,u),x&&E.push(x),S=fo("spread",a.innerShadow,A,P,u),S&&E.push(S),w=mI("offset",a.innerShadow,A,P,u),w&&E.push(w)}if(a instanceof Va||a instanceof Hc){let A={...o.backgroundBlur},P={...l.backgroundBlur};(A.enabled||P.enabled)&&(E.push(function(N){return{update:()=>{N instanceof Va&&(N.backgroundBlur.enabled=!0)}}}(a)),A.enabled||Object.assign(A,{enabled:!0,radius:0}),P.enabled||Object.assign(P,{enabled:!0,radius:0})),T=fo("radius",a.backgroundBlur,A,P,u),T&&E.push(T)}if(a instanceof Va){let A={...o.layerBlur},P={...l.layerBlur};(A.enabled||P.enabled)&&(E.push(function(N){return{update:()=>{N instanceof Va&&(N.layerBlur.enabled=!0)}}}(a)),A.enabled||Object.assign(A,{enabled:!0,radius:0}),P.enabled||Object.assign(P,{enabled:!0,radius:0})),M=fo("radius",a.layerBlur,A,P,u),M&&E.push(M)}if(a instanceof Hc||a instanceof fC){let A=NX("cornerRadius",a,o,l,u);A&&E.push(A)}return E}(e,t,i,0,r.shared)):(e.data.visible&&s.push(...function(a,o,l,h){let u=[];if(!("cloner"in l)||!a.cloner)return u;let d=a.cloner,c="cloner"in o?o.cloner:{},p=l.cloner;QW.forEach(_=>{let b;b=_==="count"?fo("count",d.parameters,c,p,h.shared,!0):rg(_,d.parameters,c??{},p,h.shared),b&&u.push(b)});let f=function(_,b,x,w){if(_.parameters.type!=="radial")return;let S=b.radial,T=x.radial;if(!T)return;let M=_.parameters.radial,E=[];return RL.forEach(A=>{let P=rg(A,M,S??{},T,w);P&&E.push(P)}),E}(d,c,p,h.shared);f?.length&&u.push(...f);let m=function(_,b,x,w){if(_.parameters.type!=="linear")return;let S=b.linear,T=x.linear;if(!T)return;let M=[],E=_.parameters.linear;return DL.forEach(A=>{let P=rg(A,E,S??{},T,w);P&&M.push(P)}),M}(d,c,p,h.shared);m?.length&&u.push(...m);let g=function(_,b,x,w){if(_.parameters.type!=="grid")return;let S=b.grid,T=x.grid;if(!T)return;let M=[],E=_.parameters.grid;return NL.forEach(A=>{let P;P=A==="count"?NX(A,E,S??{},T,w,!0):rg(A,E,S??{},T,w),P&&M.push(P)}),M}(d,c,p,h.shared);g?.length&&u.push(...g);let v=function(_,b,x,w){if(_.parameters.type!=="toObject")return;let S=b.toObject,T=x.toObject;if(!T)return;let M=[],E=_.parameters.toObject;return IL.forEach(A=>{let P;P=A==="count"?fo(A,E,S??{},T,w,!0):rg(A,E,S??{},T,w),P&&M.push(P)}),M}(d,c,p,h.shared);v?.length&&u.push(...v);let y=function(_,b,x,w){if(!_.parameters.randomness)return;let S=b.randomnessObject,T=x.randomnessObject;if(!T)return;let M=[],E=_.parameters.randomnessObject;return OL.forEach(A=>{let P=rg(A,E,S??{},T,w);P&&M.push(P)}),M}(d,c,p,h.shared);return y?.length&&u.push(...y),u.length&&u.push({update:()=>{d.update(h)}}),u}(e,t,i,r)),e instanceof Es?(e instanceof zn&&e.data.visible&&s.push(...function(a,o,l,h){let u=[];if(!("geometry"in l)||Zf(a))return u;let d=a.geometry.userData.parameters,c="geometry"in o?o.geometry:{},p=l.geometry;if(a instanceof ow){let f=function(m,g,v,y){if(v.scaleBaked===void 0)return;let _=(g.scaleBaked??m.appliedGeometrySize??m.data.geometry.scaleBaked).map(w=>typeof w=="string"?Number(y.shared.getVariable(w)??0):w),b=v.scaleBaked.map(w=>typeof w=="string"?Number(y.shared.getVariable(w)??0):w);if(jg.isEqual(_,b))return;let x=[];return x.push({update:w=>{m.updateGeometryInteractions({scaleBaked:[et.lerp(_[0],b[0],w),et.lerp(_[1],b[1],w),et.lerp(_[2],b[2],w)]},y.shared),m.invalidateDownstreamBooleanData(),m.refreshAttachedClonersInteractions(y)},start:()=>{m.updateGeometryInteractions({scaleBaked:_},y.shared),m.invalidateDownstreamBooleanData(),m.refreshAttachedClonersInteractions(y)},end:()=>{m.updateGeometryInteractions({scaleBaked:b},y.shared),m.invalidateDownstreamBooleanData(),m.refreshAttachedClonersInteractions(y)}}),x}(a,c,p,h);f&&u.push(...f)}else{let f={},m=a.appliedGeometrySize;if(Object.assign(f,PW(d,zI),m?{width:m[0],height:m[1],depth:m[2]}:{},PW(c,zI)),zI.forEach(g=>{let v=rg(g,f,c,p,h.shared);v&&u.push(v)}),xB(a)){Object.assign(f,{extrusion:{...d.extrusion}});let g=function(v,y,_,b){if(!_.extrusion)return;let x=v.extrusion,w=y.extrusion??{},S=_.extrusion,T=[];return zL.forEach(M=>{let E=rg(M,x,w,S,b);E&&T.push(E)}),T}(f,c,p,h.shared);g&&u.push(...g)}u.length&&u.push({update:g=>{a.updateGeometryInteractions(f,h.shared),a.updateGeometryGroupsIfNeeded(),a.refreshAttachedClonersInteractions(h)},start:g=>{a.updateGeometryInteractions(f,h.shared),a.updateGeometryGroupsIfNeeded(),a.refreshAttachedClonersInteractions(h)},end:g=>{a.updateGeometryInteractions(f,h.shared),a.updateGeometryGroupsIfNeeded(),a.refreshAttachedClonersInteractions(h)}})}return u}(e,t,i,r)),e.data.visible&&!(e instanceof xl&&e.materialOverride)&&s.push(...function(a,o,l,h){let u=[];if(Array.isArray(a.material)){if(!("materials"in l)||!l.materials)return u;let d="materials"in o&&o.materials?o.materials:[],c=l.materials;a.material.forEach((p,f)=>{if(!c[f])return;let m=d[f]??{},g=c[f];typeof m=="string"||typeof g=="string"||u.push(...Wye(p,m,g,h))})}else{if(!("material"in l)||!l.material)return u;let d="material"in o&&o.material?o.material:{},c=l.material;if(typeof d=="string"||typeof c=="string")return u;u.push(...Wye(a.material,d,c,h))}return u}(e,t,i,r.shared))):l4.is(e)?e.data.visible&&s.push(...function(a,o,l,h){let u=[];if(l.intensity!==void 0){let d=fo("intensity",a,o,l,h);d&&u.push(d)}if(l.color!==void 0){let d=function(c,p,f,m,g){let v=f[c]?f[c]:void 0,y=m[c];if(!y)return;let _=p[c],b=v?typeof v=="string"?g.getColor(v).clone():new lt().setRGB(v.r,v.g,v.b):_.clone(),x=typeof y=="string"?g.getColor(y).clone():new lt().setRGB(y.r,y.g,y.b);if(b.equals(x))return;let w=_.clone();return{update:S=>{w.lerpColors(b,x,S),p[c]?.copy?.(w)},start:()=>{w.copy(b)},end:()=>{w.copy(x)}}}("color",a,o,l,h);d&&u.push(d)}return u}(e,t,i,r.shared)):e instanceof Qn&&s.push(...function(a,o,l,h){let u=[],d=a.cameraType==="OrthographicCamera"?o.orthographic?.zoom:o.perspective?.zoom,c=a.cameraType==="OrthographicCamera"?l.orthographic?.zoom:l.perspective?.zoom;if(c!==void 0){let p=d??a.zoom,f=c;p!==f&&u.push({update:m=>{a.zoom=et.lerp(p,f,m),a.updateProjectionMatrix()},start:()=>{a.zoom=p,a.updateProjectionMatrix()},end:()=>{a.zoom=f,a.updateProjectionMatrix()}})}if(l.targetOffset!==void 0){let p=fo("targetOffset",a,o,l,h);p&&u.push(p)}return u}(e,t,i,r.shared))),s.length?{update:a=>{s.forEach(o=>o.update(a))},start:a=>{s.forEach(o=>o.start?.(a))},end:a=>{s.forEach(o=>o.end?.(a))}}:void 0}var ePe={type:"beginState"};function tPe(e){if(e.easing===5){let{control1:t,control2:i}=e;return{easing:5,control1:t??nw.defaultData.control1,control2:i??nw.defaultData.control2}}if(e.easing===6){let{mass:t,stiffness:i,damping:r,velocity:n}=e;return{easing:6,mass:t??Ng.defaultData.mass,stiffness:i??Ng.defaultData.stiffness,damping:r??Ng.defaultData.damping,velocity:n??Ng.defaultData.velocity}}return{easing:e.easing}}function iPe(e){return{delay:e.delay,delayDirection:e.delayDirection??"start-end",direction:e.direction??"normal",repeat:e.repeat}}var rPe={type:"completeState",isfromEntity:!1};function aA(e,t){let i,r;if(typeof t=="string"?(i=t,r=e.states?.[i]):t===null&&(i=null,r=e.data),i!==void 0&&r!==void 0)return{id:i,data:r}}var uGe=["position","rotation","scale","shear"],OX=new Set,LX=class{constructor(e,t,i,r,n,s,a,o={},l=()=>OX){this.object=e,this.fromRef=t,this.toRef=i,this.data=r,this.sharedAssets=n,this.allowSlerp=s,this.page=a,this.hooks=o,this.inert=l,this.builtReversed=!1,this.startStateId=null,this.buildCallback=()=>{this.builtReversed=this.runner.isReversed,this.startStateId=Jl(this.object)?null:this.object.transitionState.state,this.callback=hGe(this.object,{},function(h,u){if(u.size===0)return h;let d={...h};for(let c of u)delete d[c];return d}(this.end.data,this.inert()),{scene:this.page.scene,shared:this.sharedAssets},this.allowSlerp)},this.onChange=h=>{this.builtReversed!==this.runner.isReversed&&this.buildCallback(),this.callback&&(this.callback.update(h),this.object.requestRender()),this.writeState(h)},this.runner=new H3e(function(h){return{duration:h.duration,ease:tPe(h),...iPe(h)}}(r),this.onChange,this.buildCallback),this.rebind()}rebind(){let{fromRef:e,toRef:t}=this;if(e===void 0){let r=aA(this.object,this.object.currentState===t?this.object.prevState:this.object.currentState);if(!r)throw new Error("Missing property");this.from=r}else{let r=aA(this.object,e);if(!r)throw new Error("Missing property");this.from=r}if(t===void 0)throw new Error("Missing property");let i=aA(this.object,t);if(!i)throw new Error("Missing property");this.to=i,this.buildCallback()}refresh(){this.buildCallback()}get endpointData(){return[this.from.data,this.to.data]}get targetStateId(){return this.builtReversed?this.from.id:this.to.id}get start(){return this.builtReversed?this.to:this.from}get end(){return this.builtReversed?this.from:this.to}writeState(e){if(e===0||Jl(this.object))return;let t=e===1,i=e>.5?this.targetStateId:this.startStateId,r=this.object.transitionState;r.settled===t&&r.state===i||(this.object.transitionState={settled:t,state:i},this.object.reversibleToState=this.end.id,this.object.prevState!==this.object.currentState&&(this.object.prevState=this.object.currentState),this.object.currentState=i,this.object.dispatchEvent({type:"transitionState",settled:t,state:i}),this.object.dispatchEvent({type:t?"completeState":"beginState",state:i}),this.object.traverseEntity(n=>{n!==this.object&&n instanceof Qn&&n.dispatchEvent(t?rPe:ePe)}),t?this.hooks.onComplete?.(i):this.hooks.onBegin?.(i))}};Oh();var BX=new Map,oA=new Map,du=class extends cs{constructor(e,t,i,r,n,s){super(),this.id=e,this.data=t,this.scene=i,this.sharedAssets=r,this.object=n,this.eventType=s,this.evaluators=[],this.elapsed=0,this.lastTime=null,this.direction=1,this._playing=!1,this._finished=!1,this.hasPlayedOnce=!1,this.pauseOnNextCycleEnd=!1,this.lastCycleIndex=0;try{let a=n1.findTimeline(this.scene.data.objects,this.data.timeline),o=a.duration;this.animatedObjectIds=Object.keys(a.objectTimelines),this.animatedObjectIds.forEach(l=>{let h=this.scene.find(l);if(!h)return;let u=a.objectTimelines[l];!u||this.evaluators.push(function(d,c,p,f,m){let g=function(v,y){let _=[];return Wg.groupKeyframes(y.keyframes).forEach(b=>{let x=b.path?.[0],w=b.path[1],S=()=>Tb(b.keyframes,T=>T.value);switch(x){case"position":case"rotation":case"scale":return void(w&&PA.includes(w)&&_.push({on:x,axis:w,track:S()}));case"shape size":return void(w&&PA.includes(w)&&"geometry"in v&&_.push({on:"shapeSize",axis:w,track:S()}));case"path extrusion":return void(xB(v)&&_.push({on:"pathExtrusion",track:Tb(b.keyframes,T=>T.value)}));case"path snapping":return void(v.data.pathSnapping&&_.push({on:"pathSnapping",track:Tb(b.keyframes,T=>T.value)}));case"material":return void(v.type==="Mesh"&&"material"in v&&function(T,M){let E=o4(T.material)?T.material:void 0,A=M.layerId;if(!E||!A)return[];let P=M.keyframes.some(V=>$f(V.data.value?.noiseStrength)),N=E.ensureRainbowNoiseCompiled,D=V=>{P&&typeof N=="function"&&N.call(E,V)},O=V=>"data"in V?[{on:"material",layer:V,track:Tb(M.keyframes,j=>j.value)}]:[];D(A);let z=E.getLayerByUuid(A);if(z)return O(z);let B=M.path[1];for(let V of E.getLayersOfType(B))D(V.uuid);return(E.getLayersOfType(B)??[]).flatMap(O)}(v,b).forEach(T=>_.push(T)));case"opacity":return void(v.type==="Mesh"&&"material"in v&&_.push({on:"opacity",track:S()}));case"cloner":return void _.push({on:"cloner",track:Tb(b.keyframes,T=>T.value)});case"camera":return void(v instanceof Qn&&_.push({on:"camera",field:"zoom",track:S()}));case"light":return void((v instanceof Rw||v instanceof hC||v instanceof Dw)&&_.push({on:"light",field:b.path[1],track:Tb(b.keyframes,T=>T.value)}))}}),_}(d,c);return{duration:p,evaluate(v,y){d.resetBBoxNeedsUpdate();let _={transform:!1,size:!1,cloner:!1,bounds:!1,boolean:!1,render:!1};for(let b of g)lGe(b,d,v,f,m,y,_);(function(b,x,w){if(x.size&&b instanceof zn){let{x:S,y:T,z:M}=b.userData.value;b.updateGeometryInteractions({width:S,height:T,depth:M},w.shared)}x.cloner&&b.cloner?.update(w),x.transform&&b.updateMatrix(),x.bounds&&b.resetBBoxNeedsUpdate(),x.boolean&&b instanceof zn&&b.invalidateDownstreamBooleanData(),x.render&&b.dispatchEvent({type:"requestRender"})})(d,_,f)},invalidate(){for(let v of g)aGe(v.track)}}}(h,{...u},o,{scene:i,shared:r},this.sharedAssets))}),this.schedule=new X6e(function(l,h){return{duration:h,delay:po(l.delay/1e3),delayDirection:l.delayDirection??"start-end",direction:l.direction??"normal",repeat:l.repeat}}(this.data,o))}catch{throw new Error("Missing property")}n&&(oA.has(n.uuid)?oA.get(n.uuid).push(this):oA.set(n.uuid,[this])),BX.set(e,this)}get playing(){return this._playing}get finished(){return this._finished}get paused(){return!this._playing}update(e){this.lastTime!==null&&(this.elapsed=Math.max(0,this.elapsed+(e-this.lastTime)*this.direction)),this.lastTime=e,this.applyAtElapsed()}applyAtElapsed(){if(this.direction===-1&&this.elapsed===0)return void this.pause();let e=this.schedule.resolve(this.elapsed);if(e){if(e.cycleIndex!==this.lastCycleIndex&&(this.lastCycleIndex=e.cycleIndex,this.pauseOnNextCycleEnd))return this.pauseOnNextCycleEnd=!1,void this.pause();for(let t of this.evaluators)t.evaluate(e.localTime)}else this.direction===1&&this.schedule.isFinished(this.elapsed)&&this.finish()}finish(){this.pause(),this._finished=!0,this.animatedObjectIds.forEach(e=>{let t=this.scene.find(e);t instanceof Qn&&t.dispatchEvent(rPe)})}startTicking(){this._playing=!0,this.lastTime=null;for(let e of this.evaluators)e.invalidate();zs.add(this)}play(){let e=this.eventType!==void 0&&GW(this.eventType)&&this.data.runMode==="Once"&&this.hasPlayedOnce&&this.paused&&this.elapsed>0&&!this._finished;if(this.eventType!==void 0&&GW(this.eventType)&&this.data.runMode==="Once"&&this.hasPlayedOnce&&!e||this.eventType===void 0&&this._finished)return!1;this.hasPlayedOnce=!0,this.animatedObjectIds.forEach(t=>{let i=this.scene.find(t);i instanceof Qn&&i.dispatchEvent(ePe)}),!e&&(this.elapsed===0||this._finished)&&(this.elapsed=0,this.lastCycleIndex=0,this._finished=!1),this.direction=1,this.startTicking()}pause(){this._playing=!1,this.lastTime=null,zs.remove(this)}rewind(){this.pause(),this.elapsed=0,this.lastCycleIndex=0}stop(){this.rewind(),this.applyAtElapsed(),this._finished=!1}pauseAndRewind(){this.rewind(),this.direction=1,this.pauseOnNextCycleEnd=!1,this._finished=!1}seek(e){let t=this.schedule.totalDuration;this.elapsed=e*(Number.isFinite(t)?t:this.schedule.effectiveCycleDuration);for(let i of this.evaluators)i.invalidate();this.applyAtElapsed()}toggle(e){let t=e??this.direction===-1;this._playing&&this.direction===(t?1:-1)?t&&(this.pauseOnNextCycleEnd=!1):(t?(this._finished&&(this.elapsed=0,this.lastCycleIndex=0,this._finished=!1),this.direction=1,this.pauseOnNextCycleEnd=!1):(this.direction=this.schedule.resolve(this.elapsed)?.isReverse?1:-1,this.pauseOnNextCycleEnd=!0),this.startTicking())}playFromCurrent(){this.toggle(!0)}reverseFromCurrent(){this.toggle(!1)}dispose(){this.pause()}},dGe=class{constructor(e){this.data=e}dispatch(){this.data.playTimeline?this.pauseTimeline(this.data.playTimeline):this.data.object?this.pauseAllTimelinesFromObject(this.data.object):this.pauseAllTimelines()}pauseTimeline(e){let t=this.getTimelineActions(e);!t.length||(this.data.delay>0?(this.disposeDelay(),this.timeoutId=window.setTimeout(()=>{t.forEach(i=>{i[this.data.interaction]()}),this.disposeDelay()},this.data.delay)):t.forEach(i=>{i[this.data.interaction]()}))}getTimelineActions(e){let t=BX.get(e);return t?[t]:[...BX.values()].filter(i=>i.data.timeline===e)}pauseAllTimelinesFromObject(e){let t=oA.get(e);!t?.length||(this.data.delay>0?(this.disposeDelay(),this.timeoutId=window.setTimeout(()=>{t.forEach(i=>i[this.data.interaction]()),this.disposeDelay()},this.data.delay)):t.forEach(i=>i[this.data.interaction]()))}pauseAllTimelines(){let e=[...oA.values()];!e.length||(this.data.delay>0?(this.disposeDelay(),this.timeoutId=window.setTimeout(()=>{e.forEach(t=>{t.forEach(i=>{i[this.data.interaction]()})}),this.disposeDelay()},this.data.delay)):e.forEach(t=>{t.forEach(i=>{i[this.data.interaction]()})}))}disposeDelay(){clearTimeout(this.timeoutId),delete this.timeoutId}dispose(){clearTimeout(this.timeoutId),delete this.timeoutId}},cGe=class{constructor(e,t,i,r,n,s,a){this.data=t,this.sharedAssets=r,this.actionCondition=a;let o="interaction"in t?t.interaction:"play";if(o==="play"||o===void 0)this.interaction=new du(e,t,i,r,n,s);else{if(o!=="pause"&&o!=="stop")throw new Error("Missing property");this.interaction=new dGe(t)}}get playing(){return this.interaction instanceof du&&this.interaction.playing}get finished(){return!(this.interaction instanceof du)||this.interaction.finished}get paused(){return!(this.interaction instanceof du)||this.interaction.paused}branchTaken(){return Nn(this.sharedAssets,this.actionCondition)}play(){return!!this.branchTaken()&&(this.interaction instanceof du?this.interaction.play():void this.interaction.dispatch())}get animatedObjectIds(){return this.interaction instanceof du?this.interaction.animatedObjectIds:[]}pauseAndRewind(){this.interaction instanceof du&&this.interaction.pauseAndRewind()}stop(){this.interaction instanceof du&&this.interaction.stop()}seek(e){!this.branchTaken()||this.interaction instanceof du&&this.interaction.seek(e)}toggle(e){!this.branchTaken()||(this.interaction instanceof du?this.interaction.toggle(e):this.interaction.dispatch())}playFromCurrent(){!this.branchTaken()||(this.interaction instanceof du?this.interaction.playFromCurrent():this.interaction.dispatch())}dispatchConditional(){this.playFromCurrent()}reverseFromCurrent(){!this.branchTaken()||this.interaction instanceof du&&this.interaction.reverseFromCurrent()}dispose(){this.interaction.dispose()}};function $ye(e){let t=e.tweens[0]?.data;return{delay:t?.delay??e.delay,delayDirection:t?.delayDirection??"start-once",direction:t?.direction??e.direction,repeat:t?.repeat??e.repeat}}_r(),Jo("TimelineAnimation",({id:e,data:t,page:i,shared:r,object:n,eventType:s,actionCondition:a})=>new cGe(e,t,i.scene,r,n,s,a)),In("timeline"),Zn(),zt(),ae(),Oh();var pGe={state:null,duration:0,delay:0,delayDirection:"start-once",direction:"normal",repeat:0,easing:0},fGe=class extends cs{constructor(e,t,i,r,n,s,a){if(super(),this.eventType=e,this.data=t,this.page=i,this.shared=r,this.condition=n,this.runModeOverride=s,this.tweens=[],this.hasPlayedOnce=!1,this.inert=OX,!t.object)throw new Error("Missing property");let o=this.page.scene.findFrom(t.object,a)??this.page.uiCanvas?.find(t.object)??this.page.scene.find2DInUIObjects(t.object);if(!o)throw new Error("Missing property");if(!o.states)throw new Error("Missing property");if(this.object=o,t.tweens.length<2)throw new Error("Missing property");this.init()}get playing(){return this.runner?.isPlaying===!0}get animating(){return this.runner?.isAnimating===!0}get claimTime(){return this.runner?.claimTime}get contested(){let e=this.object.previousAction;return e!==null&&e!==this&&e.animating}init(){this.initialCurrentState=aA(this.object,this.object.currentState).id,this.build()}shouldReinit(){return!!Nn(this.shared,this.condition)||!(this.animating&&!this.loopsForever)}get loopsForever(){return $ye(this.data).repeat===-1||this.data.tweens.some((e,t)=>t>0&&e.data.repeat===-1)}get runMode(){return this.runModeOverride!==void 0?this.runModeOverride:GW(this.eventType)?this.data.runMode:"Repeat"}get currentState(){return this.runMode==="Toggle"?this.initialCurrentState:this.object.currentState}get opensOnCurrent(){return this.data.tweens[0].data.state===void 0&&this.runMode!=="Toggle"}build(){let e=this.data.tweens,t=[];try{let i=e[0].data.state;i!==void 0&&t.push(new LX(this.object,i,i,pGe,this.shared,this.data.allowSlerp??!1,this.page,{},()=>this.inert));for(let r=1;r<e.length;r++){let n=e[r-1],s=e[r];t.push(new LX(this.object,n.data.state===void 0?this.currentState:n.data.state,s.data.state===void 0?this.currentState:s.data.state,s.data,this.shared,this.data.allowSlerp??!1,this.page,{},()=>this.inert))}}catch(i){return void(i instanceof Error&&console.error(i.message))}this.tweens=t,this.syncInert(),this.runner=new W3e({...iPe($ye(this.data)),runMode:this.runMode},t.map(i=>i.runner),{claim:i=>this.claimObject(i),assignCurrentState:()=>this.rebindTweens(),isOwner:()=>this.object.previousAction===this})}claimObject(e){if(this.object.previousAction===this)return!1;let t=this.object.previousAction;if(t?.animating===!0){if(e!==void 0&&t.claimTime!==void 0&&t.claimTime>e)return!1;t.pause()}return this.object.previousAction=this,!0}rebindTweens(){for(let e of this.tweens)try{e.rebind()}catch(t){t instanceof Error&&console.error(t.message)}this.syncInert(),this.object instanceof Qn&&this.object.wasMovedByUser&&(this.object.wasMovedByUser=!1)}syncInert(){let e=this.tweens.flatMap(t=>t.endpointData);if(this.opensOnCurrent&&e.length>0){let t=aA(this.object,this.object.currentState);t&&(e[0]=t.data)}this.inert=this.notMovedByOwner(function(t){if(t.length<2)return OX;let i=new Set,[r,...n]=t;for(let s of uGe){let a=r[s];a!==void 0&&n.every(o=>yy(o[s],a))&&i.add(s)}return i}(e));for(let t of this.tweens)t.refresh()}notMovedByOwner(e){let t=this.object.previousAction;if(e.size===0||t===null||t===this||!t.animating)return e;let i=t.leavesAlone;return new Set([...e].filter(r=>i.has(r)))}get leavesAlone(){return this.inert}update(e){this.runner?.update(e),this.runner?.isPlaying!==!0&&zs.remove(this)}branchTaken(){return Nn(this.shared,this.condition)}play(){if(!this.branchTaken()||this.runMode==="Once"&&this.hasPlayedOnce)return!1;this.hasPlayedOnce=!0,this.start()}start(){!this.runner||(this.runner.play(zs.time),this.runner.isPlaying&&zs.add(this))}pause(){this.runner?.stop(),zs.remove(this)}stop(){this.pause();let e=this.data.tweens[0].data.state===void 0?this.initialCurrentState:this.data.tweens[0].data.state;Jl(this.object)?this.object.changeSelectedState(e,{shared:this.shared}):this.object.changeSelectedState(e,{scene:this.page.scene,shared:this.shared}),this.object.currentState=e}seek(e){if(Nn(this.shared,this.condition)===!1)return!1;this.runner?.seek(e)}playDirected(e){if(Nn(this.shared,this.condition)===!1)return!1;!this.runner||(this.runner.playDirected(zs.time,e),this.runner.isPlaying&&zs.add(this))}playFromCurrent(){this.playDirected(!0)}reverseFromCurrent(){this.playDirected(!1)}dispose(){this.pause()}};function mGe(e){let t=this._clip.duration,i=this._clip.start??0,r=this.loop,n=this.time+e,s=this._loopCount,a=r===hL;if(e===0)return s===-1||!a||1&~s?n:t-(n-i);if(r===q7){s===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(n>=t)n=t;else{if(!(n<0)){this.time=n;break e}n=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=n,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(s===-1&&(e>=0?(s=0,this._setEndings(!0,this.repetitions===0,a)):this._setEndings(this.repetitions===0,!0,a)),n>=t||n<i){let o=Math.floor((n-i)/(t-i));n-=(t-i)*o,s+=Math.abs(o);let l=this.repetitions-s;if(l<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,a||(n=e>0?t:i,this.repetitions===1&&(n=t)),this.time=n,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(l===1){let h=e<0;this._setEndings(h,!h,a)}else this._setEndings(!1,!1,a);this._loopCount=s,this.time=n,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:o})}}else this.time=n;if(a&&!(1&~s))return t-(n-i)}return n}function nPe(e){let t=e?.tracks.filter(i=>i.ValueTypeName==="vector"||i.ValueTypeName==="quaternion").map(i=>i.times.length);if(t?.length){let i=function(r){if(!r||r.length===0)return;let n;for(let s of r)s==s&&(n===void 0||s>n)&&(n=s);return n}(t);return i&&i>2?i:2}return 2}zt(),ae(),zt(),ae(),ae(),jr();var Xye=!1,Lv=new WeakSet;function FX(e){return Array.isArray(e.identity)?e.identity[0]:e.uuid}function yI(e){return e.data.type==="Empty"&&Array.isArray(e.data.animations)?e.data.animations:[]}function gGe(e){return e===void 0||e===!0?-1:typeof e=="number"&&e>=1?Math.round(e)-1:0}function Yye(e,t){return typeof e=="number"&&isFinite(e)&&e>0?e:t}function Kye(e,t){let i=e.filter(a=>a.info.id===t);if(i.length)return i;let r=e.filter(a=>a.info.name===t);if(r.length)return r;let n=t.toLowerCase(),s=e.filter(a=>a.info.name.toLowerCase()===n);return s.length?s:e.filter(a=>a.info.name.toLowerCase().endsWith("_"+n))}function Zye(e){return`"${e.name}" has no imported animation clips \u2014 getAnimations() lists the objects that do.`}function Qye(e,t,i){if(!i)return`no clip "${e}" in the scene \u2014 getAnimations() lists them.`;let r=t.map(n=>`"${n.info.name}"`).join(", ");return`"${i.name}" has no clip "${e}" \u2014 its clips: ${r}.`}var vGe=class{constructor(e,t,i,r){this.scene=e,this.requestRender=t,this.updateDisplayProgress=i,this.animationInspectorState=r,this.clipIdToAction={},this.activeClip=null,this.clipDurations=new WeakMap,this.needsUpdate=!1,this.addClip=n=>{n.data.type==="Empty"&&Array.isArray(n.data.animations)&&n.data.animations.forEach((s,a)=>{let o=s[0]+"/"+FX(n);if(this.clipIdToAction[o])return;let l=NI.parse(function(u){if(!Obe(u))return JSON.parse(u[2]);let[d,c,,p]=u,f=([g,v])=>p.data.slice(g,g+v),m={name:c,duration:p.duration,uuid:d,tracks:p.tracks.map(g=>{let v={name:g.name,type:g.type,times:f(g.times),values:g.list?[...g.list]:f(g.values)};return g.interpolation!==void 0&&(v.interpolation=g.interpolation),v})};return p.blendMode!==void 0&&(m.blendMode=p.blendMode),p.userData!==void 0&&(m.userData=p.userData),m}(s));n.animations[a]=l,this.clipDurations.set(l,l.duration);let h=this.mixer.clipAction(l,n);Xye===!1&&(Object.getPrototypeOf(h)._updateTime=mGe,Xye=!0),h.clampWhenFinished=!0,this.clipIdToAction[o]=h})},this.mixer=new gW(e),this.scene.traverseEntity(this.addClip)}rebindClips(){this.mixer.stopAllAction(),this.mixer=new gW(this.scene),this.clipIdToAction={},this.activeClip=null,this.scene.traverseEntity(this.addClip)}deleteClip(e,t){let i=this.scene.find(t);if(!i)return;let r=i.animations.find(s=>s.uuid===e);if(!r)return;let n=this.clipIdToAction[e];!n||(n.stop(),this.mixer.uncacheClip(r),delete this.clipIdToAction[e],i.animations=i.animations.filter(s=>s.uuid!==e))}get isPlaying(){return Object.values(this.clipIdToAction).some(e=>e.isRunning())}playFromInspector(e){this.mixer.stopAllAction();let t=this.clipIdToAction[e];!t||(t.play(),this.activeClip=t.getClip(),this.scene.markShadowsDirty(),this.requestRender())}onExitPlayMode(){Object.values(this.clipIdToAction).forEach(e=>{e.repetitions=1/0,e.loop=lL,e.timeScale=1,Lv.delete(e)}),this.mixer.stopAllAction(),this.scene.markShadowsDirty(),this.requestRender()}play(e){let t=e.clipId+"/"+e.object,i=this.clipIdToAction[t];if(i)return i.repetitions=e.repeat>=0?e.repeat+1:1/0,i.loop=e.direction!=="pingpong"&&e.direction!=="pingpong-rewind"||e.repeat===0?lL:hL,i.play(),i.paused=!1,this.requestRender(),i}startClip(e,t,{start:i=0,end:r,fade:n=0}){Lv.delete(e),e.reset(),e.time=i;let s=e.getClip();s.start=i,s.duration=r??this.fullDuration(e),this.replaceOtherClips(e,t,n)}replaceOtherClips(e,t,i=0){Object.entries(this.clipIdToAction).forEach(([r,n])=>{n===e||r.split("/")[1]!==t||(Lv.delete(n),i>0?n.fadeOut(i):n.stop())}),i>0&&e.fadeIn(i)}resumeClip(e){return!!Lv.has(e)&&(Lv.delete(e),e.paused=!1,e.play(),this.requestRender(),!0)}holdClips(e,t){let i=!1;Object.entries(this.clipIdToAction).forEach(([r,n])=>{let[s,a]=r.split("/");if(t(s,a))if(e==="pause"){if(!n.isRunning())return;n.paused=!0,Lv.add(n)}else{if(!n.enabled||!n.isRunning()&&!n.paused)return;n.paused=!0,Lv.delete(n),n.time=n.getClip().start??0,n._loopCount=-1,i=!0}}),i&&(this.needsUpdate=!0,this.scene.markShadowsDirty(),this.requestRender())}animatedEntity(e){let t;return e.traverseEntity(i=>!!t||(yI(i).length?(t=i,!0):void 0)),t||e.traverseEntityAncestors(i=>{!t&&yI(i).length&&(t=i)}),t}clips(e){return this.ownedClips(e).map(t=>t.info)}playClip(e,t,i={}){let r=this.ownedClips(e);if(!r.length)return{ok:!1,warning:Zye(e)};let n=t===void 0?r[0]:Kye(r,t)[0];if(!n)return{ok:!1,warning:Qye(t,r,e)};let s=this.play({clipId:n.info.id,object:n.key,repeat:gGe(i.loop),direction:i.pingpong?"pingpong":"normal"});return s?(s.timeScale=Yye(i.speed,1),this.resumeClip(s)||this.startClip(s,n.key,{fade:Yye(i.fade,0)}),{ok:!0,clip:n.info}):{ok:!1,warning:`clip "${n.info.name}" has not loaded yet.`}}holdClipsOf(e,t,i){let r=this.ownedClips(t);if(t&&!r.length)return{ok:!1,warning:Zye(t)};if(i!==void 0){let s=Kye(r,i);if(!s.length)return{ok:!1,warning:Qye(i,r,t)};r=s}let n=new Set(r.map(s=>s.info.id+"/"+s.key));return this.holdClips(e,(s,a)=>n.has(s+"/"+a)),{ok:!0}}ownedClips(e){let t=[];if(e){let i=this.animatedEntity(e);i&&t.push(i)}else this.scene.traverseEntity(i=>{yI(i).length&&t.push(i)});return t.flatMap(i=>{let r=FX(i),n={id:i.uuid,name:i.name};return yI(i).map(([s,a])=>{let o=this.clipIdToAction[s+"/"+r];return{info:{id:s,name:a,duration:o?Math.round(1e3*this.fullDuration(o))/1e3:0,object:n},key:r,action:o}})})}fullDuration(e){let t=e.getClip();return this.clipDurations.get(t)??t.duration}resumeFromInspector(e){let t=this.clipIdToAction[e];!t||(t.play(),t.paused=!1,this.scene.markShadowsDirty(),this.requestRender())}pauseFromInspector(e){let t=this.clipIdToAction[e];!t||(t.paused=!0)}stop(){this.mixer.stopAllAction(),this.scene.markShadowsDirty(),this.requestRender()}update(e){if(this.needsUpdate)this.needsUpdate=!1;else if(this.isPlaying===!1||this.animationInspectorState?.isScrubbing)return;this.mixer.update(e/1e3),this.activeClip&&this.updateDisplayProgress(Math.round(this.mixer.time/this.activeClip.duration*(this.maxFrames-1)%(this.maxFrames-1))),this.requestRender()}get maxFrames(){return nPe(this.activeClip??void 0)}setProgressFromInspector(e,t){if(!this.clipIdToAction[t])return;this.activeClip!==this.clipIdToAction[t].getClip()&&this.playFromInspector(t);let i=this.clipIdToAction[t].paused;this.clipIdToAction[t].paused=!1,this.mixer.setTime(Math.min(e/(this.maxFrames-1),.9999)*this.activeClip.duration),this.scene.markShadowsDirty(),this.requestRender(),i&&(this.clipIdToAction[t].paused=!0)}},F7="imported animations only play while the scene runs (Play mode, the Preview tab, exports).";function yGe(e,t){let i=n=>`no object named "${n}".`,r=(n,s,a)=>{let o=e();if(!o)return{ok:!1,warning:F7};if(s===void 0)return o.holdClipsOf(n,void 0,a);let l=t(s);return l?o.holdClipsOf(n,l,a):{ok:!1,warning:i(s)}};return{getAnimations:n=>{let s=e();if(!s)return{clips:[],warning:F7};if(n===void 0)return{clips:s.clips()};let a=t(n);return a?{clips:s.clips(a)}:{clips:[],warning:i(n)}},playAnimation:(n,s,a)=>{let o=e();if(!o)return{warning:F7};let l=t(n);if(!l)return{warning:i(n)};let h=o.playClip(l,s,a);return{clip:h.clip,warning:h.warning}},pauseAnimation:(n,s)=>r("pause",n,s),stopAnimation:(n,s)=>r("stop",n,s)}}var fx=new Map;function sPe(e,t){if(t===void 0)return;let i=e.scene.find(t);return i?FX(i):t}var $p=class extends cs{constructor(e,t,i,r,n){super(),this.page=t,this.animationControls=i,this.shared=r,this.condition=n,this.startOnceDelay=0,this.toggleIsForward=!1;let s=sPe(t,e.object)??e.object;this.data={...e,object:s};let a=this.animationControls.clipIdToAction[e.clipId+"/"+s];if(this.duration=a?.getClip()?.duration??1,this.data.crop2){let l=nPe(a?.getClip());this.leftFrameTime=this.data.crop2[0]/(l-1)*this.duration,this.rightFrameTime=this.data.crop2[1]/(l-1)*this.duration}else{let l=a?.getClip()?.tracks[0]?.times.length;l&&l>1?(this.leftFrameTime=this.data.crop[0]/l*this.duration,this.rightFrameTime=this.data.crop[1]/l*this.duration):(this.leftFrameTime=0,this.rightFrameTime=this.duration)}this.startOnceDelay=e.delay;let o=fx.get(s);o||(o=new Set,fx.set(s,o)),o.add(this)}get playing(){return this.threeAnimAction?.isRunning()??!1}cancelPending(){window.clearTimeout(this.timeoutId),delete this.timeoutId}resume(){let e=this.animationControls.clipIdToAction[this.data.clipId+"/"+this.data.object];return!(!e||!this.animationControls.resumeClip(e)||(this.threeAnimAction=e,0))}play(e=!1){if(Nn(this.shared,this.condition)===!1)return!1;window.clearTimeout(this.timeoutId),this.timeoutId=window.setTimeout(()=>{this.resume()||(this.threeAnimAction=this.animationControls.play(this.data),this.threeAnimAction&&this.animationControls.startClip(this.threeAnimAction,this.data.object,{start:this.leftFrameTime,end:this.rightFrameTime,fade:e?.2:0}))},this.startOnceDelay)}pause(){this.threeAnimAction&&(this.threeAnimAction.paused=!0),this.cancelPending()}stop(){this.threeAnimAction?.fadeOut(.2)}seek(e){this.threeAnimAction=this.animationControls.play(this.data),this.threeAnimAction&&(this.threeAnimAction.paused=!0,this.threeAnimAction.time=et.clamp(this.threeAnimAction.time+1/60*e,this.leftFrameTime,this.rightFrameTime-16e-5),this.animationControls.needsUpdate=!0,this.animationControls.requestRender())}toggle(e,t=!1){if(Nn(this.shared,this.condition)===!1)return!1;this.toggleIsForward=e??!this.toggleIsForward,this.threeAnimAction&&(this.threeAnimAction._loopCount=0),this.playing||this.resume()?this.threeAnimAction&&(this.threeAnimAction.timeScale=this.toggleIsForward?1:-1,this.toggleIsForward?(this.threeAnimAction._clip.start=this.leftFrameTime,this.threeAnimAction._clip.duration=this.rightFrameTime):(this.threeAnimAction._clip.start=this.rightFrameTime,this.threeAnimAction._clip.duration=this.leftFrameTime)):this.timeoutId=window.setTimeout(()=>{if(this.threeAnimAction=this.animationControls.play(this.data),!this.threeAnimAction)return;let[i,r]=this.toggleIsForward?[this.leftFrameTime,this.rightFrameTime]:[this.rightFrameTime,this.leftFrameTime];this.threeAnimAction.time=i,this.threeAnimAction._clip.start=i,this.threeAnimAction._clip.duration=r,this.threeAnimAction.timeScale=this.toggleIsForward?1:-1,this.animationControls.replaceOtherClips(this.threeAnimAction,this.data.object,t?.2:0)},this.startOnceDelay)}playFromCurrent(){this.toggle(!0)}reverseFromCurrent(){this.toggle(!1)}dispose(){let e=this.animationControls.clipIdToAction[this.data.clipId+"/"+this.data.object]?.getClip();e&&(e.duration=this.duration),this.pause();let t=fx.get(this.data.object);t&&(t.delete(this),t.size===0&&fx.delete(this.data.object))}},_Ge=class{constructor(e,t,i){this.data=e,this.page=t,this.animationControls=i,this.objectId=sPe(t,e.object)}dispatch(){this.data.delay>0?(this.disposeDelay(),this.timeoutId=window.setTimeout(()=>{this.apply(),this.disposeDelay()},this.data.delay)):this.apply()}targetsClip(e,t){return!(this.objectId!==void 0&&t!==this.objectId||this.data.clipId&&e!==this.data.clipId)}apply(){(this.objectId!==void 0?[fx.get(this.objectId)]:[...fx.values()]).forEach(e=>{e?.forEach(t=>{this.targetsClip(t.data.clipId,t.data.object)&&t.cancelPending()})}),this.animationControls.holdClips(this.data.interaction,(e,t)=>this.targetsClip(e,t))}disposeDelay(){clearTimeout(this.timeoutId),delete this.timeoutId}dispose(){this.disposeDelay()}},bGe=class{constructor(e,t,i,r,n){KW.isPause(e)?this.interaction=new _Ge(e,t,i):this.interaction=new $p(e,t,i,r,n)}get data(){return this.interaction.data}get playing(){return this.interaction instanceof $p&&this.interaction.playing}play(e=!1){if(this.interaction instanceof $p)return this.interaction.play(e);this.interaction.dispatch()}pause(){this.interaction instanceof $p&&this.interaction.pause()}stop(){this.interaction instanceof $p&&this.interaction.stop()}seek(e){this.interaction instanceof $p&&this.interaction.seek(e)}toggle(e,t=!1){if(this.interaction instanceof $p)return this.interaction.toggle(e,t);this.interaction.dispatch()}playFromCurrent(){this.interaction instanceof $p?this.interaction.playFromCurrent():this.interaction.dispatch()}reverseFromCurrent(){this.interaction instanceof $p&&this.interaction.reverseFromCurrent()}dispose(){this.interaction.dispose()}},aPe=null;_r(),aPe=LX,Jo("Transition",({eventType:e,data:t,page:i,shared:r,actionCondition:n,runModeOverride:s,object:a})=>new fGe(e,t,i,r,n,s,a)),Jo("Animation",({data:e,page:t,eventManager:i,shared:r,actionCondition:n})=>new bGe(e,t,i.animationControls,r,n)),In("transitions"),jr();var Jye=(e,t)=>t.some(i=>i instanceof RegExp?i.test(e):i===e),xGe=class{constructor({url:e,context:t},i,r,n){if(this.controlsManager=i,this.shared=r,this.condition=n,!e)throw new Error("Missing property");this.url=e.startsWith("mailto:")?e:function(s,a){if(a={defaultProtocol:"http:",normalizeProtocol:!0,forceHttp:!1,forceHttps:!1,stripAuthentication:!0,stripHash:!1,stripTextFragment:!0,stripWWW:!0,removeQueryParameters:[/^utm_\w+/i],removeTrailingSlash:!0,removeSingleSlash:!0,removeDirectoryIndex:!1,sortQueryParameters:!0,...a},s=s.trim(),/^data:/i.test(s))return((u,{stripHash:d})=>{let c=/^data:(?<type>[^,]*?),(?<data>[^#]*?)(?:#(?<hash>.*))?$/.exec(u);if(!c)throw new Error(`Invalid URL: ${u}`);let{type:p,data:f,hash:m}=c.groups,g=p.split(";");m=d?"":m;let v=!1;g[g.length-1]==="base64"&&(g.pop(),v=!0);let y=(g.shift()||"").toLowerCase(),_=[...g.map(b=>{let[x,w=""]=b.split("=").map(S=>S.trim());return x==="charset"&&(w=w.toLowerCase(),w==="us-ascii")?"":`${x}${w?`=${w}`:""}`}).filter(Boolean)];return v&&_.push("base64"),(_.length>0||y&&y!=="text/plain")&&_.unshift(y),`data:${_.join(";")},${v?f.trim():f}${m?`#${m}`:""}`})(s,a);if(/^view-source:/i.test(s))throw new Error("`view-source:` is not supported as it is a non-standard protocol");let o=s.startsWith("//");!o&&/^\.*\//.test(s)||(s=s.replace(/^(?!(?:\w+:)?\/\/)|^\/\//,a.defaultProtocol));let l=new URL(s);if(a.forceHttp&&a.forceHttps)throw new Error("The `forceHttp` and `forceHttps` options cannot be used together");if(a.forceHttp&&l.protocol==="https:"&&(l.protocol="http:"),a.forceHttps&&l.protocol==="http:"&&(l.protocol="https:"),a.stripAuthentication&&(l.username="",l.password=""),a.stripHash?l.hash="":a.stripTextFragment&&(l.hash=l.hash.replace(/#?:~:text.*?$/i,"")),l.pathname){let u=/\b[a-z][a-z\d+\-.]{1,50}:\/\//g,d=0,c="";for(;;){let p=u.exec(l.pathname);if(!p)break;let f=p[0],m=p.index;c+=l.pathname.slice(d,m).replace(/\/{2,}/g,"/"),c+=f,d=m+f.length}c+=l.pathname.slice(d,l.pathname.length).replace(/\/{2,}/g,"/"),l.pathname=c}if(l.pathname)try{l.pathname=decodeURI(l.pathname)}catch{}if(a.removeDirectoryIndex===!0&&(a.removeDirectoryIndex=[/^index\.[a-z]+$/]),Array.isArray(a.removeDirectoryIndex)&&a.removeDirectoryIndex.length>0){let u=l.pathname.split("/"),d=u[u.length-1];Jye(d,a.removeDirectoryIndex)&&(u=u.slice(0,-1),l.pathname=u.slice(1).join("/")+"/")}if(l.hostname&&(l.hostname=l.hostname.replace(/\.$/,""),a.stripWWW&&/^www\.(?!www\.)[a-z\-\d]{1,63}\.[a-z.\-\d]{2,63}$/.test(l.hostname)&&(l.hostname=l.hostname.replace(/^www\./,""))),Array.isArray(a.removeQueryParameters))for(let u of[...l.searchParams.keys()])Jye(u,a.removeQueryParameters)&&l.searchParams.delete(u);if(a.removeQueryParameters===!0&&(l.search=""),a.sortQueryParameters){l.searchParams.sort();try{l.search=decodeURIComponent(l.search)}catch{}}a.removeTrailingSlash&&(l.pathname=l.pathname.replace(/\/$/,""));let h=s;return s=l.toString(),!a.removeSingleSlash&&l.pathname==="/"&&!h.endsWith("/")&&l.hash===""&&(s=s.replace(/\/$/,"")),(a.removeTrailingSlash||l.pathname==="/")&&l.hash===""&&a.removeSingleSlash&&(s=s.replace(/\/$/,"")),o&&!a.normalizeProtocol&&(s=s.replace(/^http:\/\//,"//")),a.stripProtocol&&(s=s.replace(/^(?:https?:)?\/\//,"")),s}(e,{removeTrailingSlash:!1,removeSingleSlash:!1,stripWWW:!1}),this.context=t??"tab"}dispatch(){if(Nn(this.shared,this.condition)===!1)return!1;l1?window.location.assign(this.url):(this.context==="tab"||B_e&&this.context==="none"?window.open(this.url,"_blank"):this.context==="window"?window.open(this.url,"_blank",`width=${window.innerWidth}, height=${window.innerHeight}`):window.open(this.url,"_parent"),this.controlsManager.orbitControls?.onPointerUp(vi[0]),vi.splice(0,vi.length))}},wGe=class{constructor(e,t,i,r,n){this.data=e,this.page=t,this.shared=i,this.eventManager=r,this.condition=n}dispatch(){if(Nn(this.shared,this.condition)===!1)return!1;clearTimeout(this.timeoutId),delete this.timeoutId,this.timeoutId=window.setTimeout(()=>{this.shared.reset(this.shared.data,!0),IZ(this.page,this.shared,!0),this.eventManager.reset(),this.eventManager.controlsManager.gameControl?.reset(!0),this.page.switchToPlayCamera(),this.eventManager.controlsManager.requestRender(),delete this.timeoutId},1e3*(this.data.delay??0))}dispose(){clearTimeout(this.timeoutId),delete this.timeoutId}};ae();var SGe={type:"beginState"},e1e={type:"completeState",isfromEntity:!1},t1e={type:"requestRender"},TGe=class extends cs{constructor(e,t,i,r){super(),this.data=e,this.page=t,this.shared=i,this.condition=r,this.toggleIsForward=!1,this.posStart=new R,this.posEnd=new R,this.qStart=new jt,this.qEnd=new jt,this.zoomStart=1,this.zoomEnd=1}init(){}get playing(){return this.runner?.isPlaying===!0}buildAnimation(e){if(!this.data.animate)return;let t=this.page.scene.find(this.data.targetCamera);if(!t||!t.visible)throw new ReferenceError("Target camera not founded or not visible");this.posStart.copy(this.page.activeCamera.position),this.qStart.copy(this.page.activeCamera.quaternion),this.zoomStart=this.page.activeCamera.zoom;let i={duration:this.data.duration,delay:0,delayDirection:"start-once",direction:"normal",repeat:0,ease:tPe(this.data)},r=n=>{let s=this.page.activeCamera;s.position.lerpVectors(this.posStart,this.posEnd,n),s.quaternion.slerpQuaternions(this.qStart,this.qEnd,n),s.zoom=this.zoomStart+(this.zoomEnd-this.zoomStart)*n,s.wasMovedBySwitchCameraAction=!0,s.updateMatrix(),s.updateMatrixWorld(),s.updateProjectionMatrix(),s.dispatchEvent(t1e),n===1&&s.dispatchEvent(e1e)};this.runner=new H3e(i,r,()=>{e?this.fromCamera&&(this.posEnd.copy(this.fromCamera.position),this.qEnd.copy(this.fromCamera.quaternion),this.zoomEnd=this.fromCamera.zoom,this.switchCamera(this.fromCamera.uuid)):(this.posEnd.copy(t.position),this.qEnd.copy(t.quaternion),this.zoomEnd=t.zoom,this.fromCamera=this.page.activeCamera,this.switchCamera(t.uuid)),this.page.activeCamera.dispatchEvent(SGe),r(0)})}get togglesBack(){return this.data.runMode==="Toggle"&&!this.toggleIsForward}update(e){this.runner?.update(e),this.runner?.isPlaying!==!0&&zs.remove(this)}start(){!this.runner||(this.runner.start(zs.time),zs.add(this))}switchCamera(e){let t=this.page.activeCamera,i=this.page.scene.find(e);if(!i||!i.visible)throw new ReferenceError("Target camera not founded or not visible");this.page.switchActiveCamera(i),t.dispatchEvent({type:"cameraChange",camera:i})}jumpToCamera(e){this.switchCamera(e),this.page.activeCamera.dispatchEvent(e1e),this.page.activeCamera.dispatchEvent(t1e)}play(){if(Nn(this.shared,this.condition)===!1)return!1;if(!this.playing&&this.page.activeCamera.uuid!==this.data.targetCamera)try{clearTimeout(this.timeoutId),this.timeoutId=window.setTimeout(()=>{delete this.timeoutId,this.data.animate?(this.buildAnimation(!1),this.start()):this.jumpToCamera(this.data.targetCamera)},1e3*this.data.delay)}catch{}}pause(){this.runner?.stop(),zs.remove(this),clearTimeout(this.timeoutId),delete this.timeoutId}toggle(e){if(Nn(this.shared,this.condition)===!1)return!1;if(window.clearTimeout(this.timeoutId),delete this.timeoutId,e!==this.toggleIsForward)try{this.playing?(this.runner?.stop(),this.toggleIsForward=e??!this.toggleIsForward,this.buildAnimation(this.togglesBack),this.start()):this.timeoutId=window.setTimeout(()=>{this.toggleIsForward=e??!this.toggleIsForward,this.data.animate?(this.runner?.stop(),this.buildAnimation(this.togglesBack),this.start()):this.toggleIsForward?(this.fromCamera=this.page.activeCamera,this.jumpToCamera(this.data.targetCamera)):this.fromCamera&&this.jumpToCamera(this.fromCamera.uuid)},1e3*this.data.delay)}catch{}}playFromCurrent(){this.toggle(!0)}reverseFromCurrent(){this.toggle(!1)}dispose(){this.pause(),this.toggleIsForward=!1}};aK();var MGe=class{constructor(e,t,i,r){this.data=e,this.page=t,this.shared=i,this.condition=r}dispatch(){if(Nn(this.shared,this.condition)===!1)return!1;(this.data.target==="single"?this.data.variableId?[this.data.variableId]:[]:Object.keys(this.shared.getVariables())).forEach(e=>{this.shared.getVariable(e);let t=this.shared.data.variables.data(e)?.value;t!==void 0&&this.shared.updateVariable(e,t),this.shared.enableLocalStorageForPersistentVariables&&localStorage.removeItem(ZH(e))})}dispose(){}};_r(),Jo("Link",({data:e,eventManager:t,shared:i,actionCondition:r})=>new xGe(e,t.controlsManager,i,r)),Jo("Reset",({data:e,page:t,shared:i,eventManager:r,actionCondition:n})=>new wGe(e,t,i,r,n)),Jo("SwitchCamera",({data:e,page:t,shared:i,actionCondition:r})=>new TGe(e,t,i,r)),Jo("ClearLocalStorage",({data:e,page:t,shared:i,actionCondition:r})=>new MGe(e,t,i,r)),In("misc-actions"),_r(),Sl(),Tu(),kB(),aK();var EGe=class{get sharedAssets(){return this.shared}constructor(e,t={},i=!0,{dedupeParametricGeometries:r=!1}={}){this.shared=new a4(e.shared,t,!0,i),this.shared.geometryCache.dedupeByValue=r,this.scene=new zg(e.scene,this.sharedAssets),this.shared.setEntityOpContext({scene:this.scene,shared:this.shared})}reset(e,t){this.scene.clearScene(),this.sharedAssets.reset(e.shared),this.scene.resetAfterClear(e.scene,this.sharedAssets)}resetPersonalCameraFromDocumentData(){for(let e of this.scene.children)e instanceof Dn&&!e.uiScene&&e.personalCamera.updateState(e.data.camera,{scene:this.scene,shared:this.shared})}dispose(){this.scene.dispose(),this.shared.dispose()}gc(){this.scene.releaseInstanceGroups(),this.shared.geometryCache.startGc(),this.shared.geometryCache2.startGc(),this.scene.traverseEntity(e=>{e instanceof zn&&e.markGeometryAsReachable(this.shared)}),this.shared.geometryCache.endGc(),this.shared.geometryCache2.endGc()}};kB(),Or();var mx,U7,z7="vertexOrder";function i1e(e){return U7||(U7=Promise.resolve().then(()=>(_Fe(),HSe)).then(({DRACOLoader:t})=>((mx=new t).setDecoderPath(e!==void 0?`${e}/`:"https://www.gstatic.com/draco/versioned/decoders/1.5.2/").preload(),mx.decoderPending))),U7}async function AGe(e){if(mx){let t,i={attributeIDs:{...mx.defaultAttributeIDs,[z7]:"GENERIC"},attributeTypes:{...mx.defaultAttributeTypes,[z7]:"Uint32Array"},useUniqueIDs:!1};try{t=await mx.decodeGeometry(new Int8Array(e).buffer,i)}catch(r){console.error(r)}if(t)return function(r){let n=r.attributes.find(u=>u.name===z7);if(!n)return r;let s=n.array,a=s.length,o=0;for(let u=0;u<a;u++)o=Math.max(o,s[u]+1);let l,h=r.attributes.filter(u=>u!==n).map(({name:u,itemSize:d,array:c})=>{let p=new Float32Array(o*d);for(let f=0;f<p.length;f++)p[f]=c[f%d];for(let f=0;f<a;f++){let m=s[f]*d,g=f*d;for(let v=0;v<d;v++)p[m+v]=c[g+v]}return{name:u,itemSize:d,array:p}});if(r.index){let u=r.index.array,d=new Uint32Array(u.length);for(let c=0;c<u.length;c++)d[c]=s[u[c]];l={array:d}}return{index:l,attributes:h}}({index:t.index?{array:t.index.array}:void 0,attributes:Object.entries(t.attributes).map(([r,n])=>({name:r,itemSize:n.itemSize,array:n.array}))})}return null}async function r1e(e){for(let t of e){let i=await AGe(t.geometry.data.draco);if(i){let r=t.geometry.data;i.index&&(r.index={array:i.index.array,itemSize:1,normalized:!1,type:"Uint32Array"});let n={};i.attributes.forEach(({name:s,array:a,itemSize:o})=>{n[s]={array:a,itemSize:o,type:"Float32Array",normalized:!1}}),r.attributes=n,r.draco=void 0}}}EB(),Ew(),aC(),lC(),HY(),o0(),RB(),kSe(),WSe(),Su(),Pd(),Tu(),Xxe(),f1(),oC(),Vxe(),VB();var CGe={bloom:()=>Promise.resolve().then(()=>(MFe(),TFe)),chromaticAberration:()=>Promise.resolve().then(()=>(CFe(),AFe)),vignette:()=>Promise.resolve().then(()=>(DFe(),RFe)),noise:()=>Promise.resolve().then(()=>(OFe(),IFe)),hueSaturation:()=>Promise.resolve().then(()=>(FFe(),BFe)),brightnessContrast:()=>Promise.resolve().then(()=>(kFe(),zFe)),depthOfField:()=>Promise.resolve().then(()=>(jFe(),GFe)),pixelation:()=>Promise.resolve().then(()=>(qFe(),HFe))},PGe={bloom:()=>Promise.resolve().then(()=>(iUe(),tUe)),depthOfField:()=>Promise.resolve().then(()=>(aUe(),sUe))};function oPe(e,t,i){return Promise.all(e.map(r=>t[r]?.().catch(n=>{console.warn(`[spline] Failed to load the ${r} postprocessing effect (${i}); the effect will be skipped.`,n)}))).then(()=>{})}function RGe(e){return oPe(e,CGe,"webgl")}function DGe(e){return oPe(e,PGe,"webgpu")}var _I=new WeakMap,n1e=new WeakMap;function s1e(e,t,i){let r=n=>{e.removeEventListener(t,r,!0),n.stopImmediatePropagation(),i(n)};return e.addEventListener(t,r,!0),()=>e.removeEventListener(t,r,!0)}jr();var NGe=_w(oUe(),1);function bI(e){return Array.isArray(e)||ArrayBuffer.isView(e)&&!(e instanceof DataView)}function IGe(e){return{id:e.uuid,name:e.name,type:e.object.data?.type??e.object.type,visible:e.playModeVisible!==!1,position:{x:e.position.x,y:e.position.y,z:e.position.z},rotation:{x:e.rotation.x*et.RAD2DEG,y:e.rotation.y*et.RAD2DEG,z:e.rotation.z*et.RAD2DEG},scale:{x:e.scale.x,y:e.scale.y,z:e.scale.z},spawned:!0}}function xI(e){return{id:e.uuid,name:e.name,type:e.type??"Object",visible:e.visible,position:{x:e.position.x,y:e.position.y,z:e.position.z},rotation:{x:e.rotation.x*et.RAD2DEG,y:e.rotation.y*et.RAD2DEG,z:e.rotation.z*et.RAD2DEG},scale:{x:e.scale.x,y:e.scale.y,z:e.scale.z}}}function lPe(e,t,i){let r=a=>e.findObjectById(a)??e.findObjectByName(a),n=new Map,s=a=>{let o=n.get(a);if(o)return o;for(let l of n.values())if(l.name===a)return l};return{setVariable:(a,o)=>a in e.getVariables()?(e.setVariable(a,o),{ok:!0}):{ok:!1,warning:`spline.setVariable: no variable named "${a}" in this scene.`},getVariable:a=>e.getVariable(a),getVariables:()=>e.getVariables(),getAllObjects:()=>e.getAllObjects().map(xI),findObject:a=>{let o=r(a);return o?xI(o):void 0},getGeometry:(a,o)=>{if(!i)return{warning:"spline.getGeometry: not available in this runtime integration."};let l=s(a),h=l?l.object:(()=>{let p=r(a);return p?i.findEntity(p.uuid):void 0})();if(!h)return{warning:`spline.getGeometry: no object named "${a}" (names/ids come from getAllObjects).`};let u,d=l??h;o.space==="world"&&(d.updateWorldMatrix?.(!0,!1),u=d.matrixWorld?.elements);let c=function(p,f){let m=p?.getAttribute("position");if(!m||!m.count)return null;let g=m.count,v=f??null,y=p.getIndex?.()??null,_=Math.floor((y?y.count:g)/3),b=1/0,x=1/0,w=1/0,S=-1/0,T=-1/0,M=-1/0,E=new Float32Array(3*g);for(let D=0;D<g;D++){let O=m.getX(D),z=m.getY(D),B=m.getZ(D);v&&([O,z,B]=JLe(v,O,z,B)),O<b&&(b=O),z<x&&(x=z),B<w&&(w=B),O>S&&(S=O),z>T&&(T=z),B>M&&(M=B),E[3*D]=O,E[3*D+1]=z,E[3*D+2]=B}let A={space:v?"world":"local",vertexCount:g,triangleCount:_,indexed:y!==null,bounds:{min:[b,x,w],max:[S,T,M],size:[S-b,T-x,M-w]},vertices:E};if(y){let D=new Uint32Array(y.count);for(let O=0;O<y.count;O++)D[O]=y.getX(O);A.indices=D}let P=p.getAttribute("normal");if(P&&P.count===g){let D=v?function(O){let z=O[0],B=O[4],V=O[8],j=O[1],K=O[5],$=O[9],Q=O[2],ce=O[6],pe=O[10],ye=z*(K*pe-$*ce)-B*(j*pe-$*Q)+V*(j*ce-K*Q);if(!isFinite(ye)||Math.abs(ye)<1e-12)return null;let we=1/ye,ne=[(K*pe-$*ce)*we,(V*ce-B*pe)*we,(B*$-V*K)*we,($*Q-j*pe)*we,(z*pe-V*Q)*we,(V*j-z*$)*we,(j*ce-K*Q)*we,(B*Q-z*ce)*we,(z*K-B*j)*we];return[ne[0],ne[3],ne[6],ne[1],ne[4],ne[7],ne[2],ne[5],ne[8]]}(v):void 0;if(!v||D){let O=new Float32Array(3*g);for(let z=0;z<g;z++){let B=P.getX(z),V=P.getY(z),j=P.getZ(z);if(D){let K=D[0]*B+D[1]*V+D[2]*j,$=D[3]*B+D[4]*V+D[5]*j,Q=D[6]*B+D[7]*V+D[8]*j,ce=Math.hypot(K,$,Q);ce>1e-12?(B=K/ce,V=$/ce,j=Q/ce):(B=K,V=$,j=Q)}O[3*z]=B,O[3*z+1]=V,O[3*z+2]=j}A.normals=O}}let N=p.getAttribute("uv");if(N&&N.count===g){let D=new Float32Array(2*g);for(let O=0;O<g;O++)D[2*O]=N.getX(O),D[2*O+1]=N.getY(O);A.uvs=D}return A}(h.geometry,u);return c?{data:{id:d.uuid,name:d.name,geometry:h.data?.geometry?.type,...c}}:{warning:`spline.getGeometry: "${d.name}" has no readable geometry \u2014 only meshes do (lights, cameras and groups have none; read a group's child meshes instead).`}},updateObject:(a,o)=>{let l=s(a);if(l){let{position:g,rotation:v,scale:y,visible:_}=o;return g&&(typeof g.x=="number"&&(l.position.x=g.x),typeof g.y=="number"&&(l.position.y=g.y),typeof g.z=="number"&&(l.position.z=g.z)),v&&(typeof v.x=="number"&&(l.rotation.x=v.x*et.DEG2RAD),typeof v.y=="number"&&(l.rotation.y=v.y*et.DEG2RAD),typeof v.z=="number"&&(l.rotation.z=v.z*et.DEG2RAD)),y&&(typeof y.x=="number"&&(l.scale.x=y.x),typeof y.y=="number"&&(l.scale.y=y.y),typeof y.z=="number"&&(l.scale.z=y.z)),typeof _=="boolean"&&(l.playModeVisible=_),l.updateMatrix(),e.requestRender(),!0}let h=r(a);if(!h)return!1;let{position:u,rotation:d,scale:c,visible:p,geometry:f,material:m}=o;if(f&&typeof f=="object"&&i){let g=i.findEntity(h.uuid);if(g){let{vertices:v,normals:y,uvs:_,indices:b,...x}=f;bI(v)&&i.shared.updateEntityGeometryVertices(g,{vertices:v,normals:bI(y)?y:void 0,uvs:bI(_)?_:void 0,indices:bI(b)?b:void 0}),Object.keys(x).length>0&&i.shared.updateEntityGeometryParams(g,x)}}if(m&&typeof m=="object"&&i){let g=i.findEntity(h.uuid);g&&i.shared.updateEntityMaterialParams(g,m)}return u&&(typeof u.x=="number"&&(h.position.x=u.x),typeof u.y=="number"&&(h.position.y=u.y),typeof u.z=="number"&&(h.position.z=u.z)),d&&(typeof d.x=="number"&&(h.rotation.x=d.x*et.DEG2RAD),typeof d.y=="number"&&(h.rotation.y=d.y*et.DEG2RAD),typeof d.z=="number"&&(h.rotation.z=d.z*et.DEG2RAD)),c&&(typeof c.x=="number"&&(h.scale.x=c.x),typeof c.y=="number"&&(h.scale.y=c.y),typeof c.z=="number"&&(h.scale.z=c.z)),typeof p=="boolean"&&(h.visible=p),e.requestRender(),!0},createObject:async(a,o)=>xI(await e.createObject(a,o)),createCustomMaterial:a=>e.createCustomMaterial(a),getTexture:(a,o)=>{if(!i)return null;let l=r(a),h=l?i.findEntity(l.uuid):void 0;if(!h)return null;let u=i.shared.getEntityTexture(h,o??{});return u?{texture:u.texture,width:u.width,height:u.height,layer:u.layerType}:null},setMaterial:(a,o)=>e.setMaterial(a,o),cloneObject:(a,o)=>xI(e.cloneObject(a,o)),removeObject:a=>e.removeObject(a),spawnObject:(a,o)=>{if(!i)return{warning:"spline.spawnObject: not available in this runtime integration."};let l=r(a),h=l?i.findEntity(l.uuid):void 0;if(!h)return{warning:`spline.spawnObject: no object named "${a}" to use as a template.`};if(n.size>=500)return{warning:"spline.spawnObject: spawn budget reached (500 live copies) \u2014 destroyObject old copies (or reuse them) instead of spawning more."};let u=i.shared.spawnRuntimeClone(h,o??{});return u?(n.set(u.uuid,u),e.requestRender(),{object:IGe(u)}):{warning:`spline.spawnObject: "${a}" cannot be spawned from.`}},destroyObject:a=>{let o=s(a);return!(!i||!o||(n.delete(o.uuid),i.shared.destroyRuntimeClone(o),e.requestRender(),0))},setInstanceTransforms:(a,o)=>{if(!i)return-1;let l=r(a),h=l?i.findEntity(l.uuid):void 0;if(!h)return-1;let u=i.shared.setEntityInstanceTransforms(h,o);return u>=0&&e.requestRender(),u},...yGe(()=>i?.getAnimationControls(),a=>{let o=r(a);return o?i?.findEntity(o.uuid):void 0}),emitEvent:(a,o,l)=>{let h=r(o);return h?(l?h.emitEventReverse(a):h.emitEvent(a),{ok:!0}):{ok:!1,warning:`spline.emitEvent: no object named "${o}".`}},requestRender:()=>e.requestRender(),addSplineEventListener:(a,o)=>{let l=h=>{o({target:{id:h.target?.id??"",name:h.target?.name??""}})};return e.addEventListener(a,l),()=>e.removeEventListener(a,l)},getCanvas:()=>t}}ae(),jr();var hPe=class{constructor(e,t,i){this.iframe=e,this.bridge=t,this.observer=i}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 s=document.createElement("iframe");s.setAttribute("sandbox","allow-scripts allow-forms allow-pointer-lock"),s.title="Spline HTML content";let a=s.style;a.position="absolute",a.border="0",a.background="transparent",a.pointerEvents="auto",a.colorScheme="normal";let o=()=>{a.left=`${t.offsetLeft}px`,a.top=`${t.offsetTop}px`,a.width=`${t.offsetWidth}px`,a.height=`${t.offsetHeight}px`};o();let l=new ResizeObserver(o);l.observe(t),l.observe(n),s.srcdoc=function(u){let d=`<script>${z_e}<\/script>`,c=/<head(\s[^>]*)?>/i.exec(u);if(c){let f=c.index+c[0].length;return u.slice(0,f)+d+u.slice(f)}let p=/<html(\s[^>]*)?>/i.exec(u);if(p){let f=p.index+p[0].length;return u.slice(0,f)+`<head>${d}</head>`+u.slice(f)}return d+u}(i),n.insertBefore(s,t.nextSibling);let h=new V_e(s,lPe(e,t,r),(u,d)=>{u==="warn"?console.warn(`[spline html] ${d}`):u==="error"&&console.error(`[spline html] ${d}`)});return h.attach(),new hPe(s,h,l)}dispose(){this.bridge.dispose(),this.observer.disconnect(),this.iframe.remove()}};jr();var HO="data-spline-html-content",OGe=`
|
|
13013
13013
|
[${HO}] { pointer-events: none; }
|
|
13014
13014
|
[${HO}] > * { pointer-events: auto; }
|
|
13015
13015
|
[${HO}] [data-spline-passthrough] { pointer-events: none; }
|
|
13016
|
-
`,uPe=class{constructor(e,t,i,r,n,s){this.container=e,this.host=t,this.observer=i,this.spline=r,this.previousSplineGlobal=n,this.removeLateLifecycleShim=s}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 s=document.createElement("div");s.setAttribute(HO,"");let a=s.style;a.position="absolute",a.overflow="hidden";let o=()=>{a.left=`${t.offsetLeft}px`,a.top=`${t.offsetTop}px`,a.width=`${t.offsetWidth}px`,a.height=`${t.offsetHeight}px`};o();let l=new ResizeObserver(o);l.observe(t),l.observe(n);let h=document.createElement("style");h.textContent=OGe,s.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")&&s.appendChild(y);for(;u.body.firstChild;)s.appendChild(u.body.firstChild);n.insertBefore(s,t.nextSibling);let c=new Map,p=new uY(lPe(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)}}),f=(y,_)=>{try{return Promise.resolve(p.execute(y,_))}catch(b){return Promise.reject(b)}},m={ready:Promise.resolve(),setVariable:(y,_)=>f("setVariable",[y,_]),setVariables:y=>f("setVariables",[y]),getVariable:y=>f("getVariable",[y]),getVariables:()=>f("getVariables",[]),getAllObjects:()=>f("getAllObjects",[]),findObjectByName:y=>f("findObjectByName",[y]),findObjectById:y=>f("findObjectById",[y]),getGeometry:(y,_)=>f("getGeometry",[y,_??{}]),updateObject:(y,_)=>f("updateObject",[y,_]),createObject:(y,_)=>f("createObject",[y,_??{}]),createCustomMaterial:y=>f("createCustomMaterial",[y]),getTexture:(y,_)=>f("getTexture",[y,_??{}]),setMaterial:(y,_)=>f("setMaterial",[y,_]),cloneObject:(y,_)=>f("cloneObject",[y,_??{}]),removeObject:y=>f("removeObject",[y]),spawnObject:(y,_)=>f("spawnObject",[y,_??{}]),destroyObject:y=>f("destroyObject",[y]),setInstanceTransforms:(y,_)=>f("setInstanceTransforms",[y,_??null]),getAnimations:y=>f("getAnimations",[y]),playAnimation:(y,_,b)=>f("playAnimation",[y,_,b]),pauseAnimation:(y,_)=>f("pauseAnimation",[y,_]),stopAnimation:(y,_)=>f("stopAnimation",[y,_]),emitEvent:(y,_)=>f("emitEvent",[y,_]),emitEventReverse:(y,_)=>f("emitEventReverse",[y,_]),requestRender:()=>f("requestRender",[]),addEventListener:(y,_)=>{if(typeof _!="function")return;let b=c.get(y);b||(b=new Set,c.set(y,b),f("listenEvent",[y])),b.add(_)},removeEventListener:(y,_)=>{let b=c.get(y);!b||(b.delete(_),b.size===0&&(c.delete(y),f("unlistenEvent",[y])))}},g=window.spline;window.spline=m;let v=function(){if(typeof document>"u"||document.readyState==="loading")return()=>{};let y=[],_=(x,w)=>{let S=new Set,T=x.addEventListener.bind(x),M=x.removeEventListener.bind(x);Object.defineProperty(x,"addEventListener",{configurable:!0,writable:!0,value:(E,A,P)=>{if(T(E,A,P),!w.includes(E)||A==null)return;let N={type:E,listener:A};S.add(N),queueMicrotask(()=>{!S.delete(N)||((D,O,z)=>{let B=new Event(z);try{typeof O=="function"?O.call(D,B):O.handleEvent?.(B)}catch(V){console.error(V)}})(x,N.listener,N.type)})}}),Object.defineProperty(x,"removeEventListener",{configurable:!0,writable:!0,value:(E,A,P)=>{M(E,A,P);for(let N of S)N.type===E&&N.listener===A&&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,s.appendChild(_)}return new uPe(s,p,l,m,g,v)}dispose(){this.removeLateLifecycleShim(),this.host.dispose(),this.observer.disconnect(),this.container.remove(),window.spline===this.spline&&(window.spline=this.previousSplineGlobal)}};function dPe(e){return typeof e=="object"&&e!==null&&e.isMaterial===!0}function a1e(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(!dPe(e.material))return{options:e};let t=e.material;if(t.isNodeMaterial===!0){let i=HH()?.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}}zt(),Or(),ae(),Gwe(),Su(),Or(),zt(),$4e(),em();var LGe=new Set(["name","parent","position","rotation","scale","visible","castShadow","receiveShadow","color","material"]),o1e="'Cube', 'Sphere', 'Plane', 'Rectangle', 'Ellipse', 'Triangle', 'Polygon', 'Star', 'Cone', 'Cylinder', 'Pyramid', 'Torus', 'TorusKnot', 'Dodecahedron', 'Icosahedron', 'Helix', 'Backdrop', 'Lathe', 'Text', 'CustomMesh', 'Group', 'PointLight', 'SpotLight', 'DirectionalLight'",BGe={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"},FGe={group:"Empty",empty:"Empty",pointlight:"PointLight",spotlight:"SpotLight",directionallight:"DirectionalLight"},UGe={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')."},zGe={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"},kGe={Empty:"Group",PointLight:"Point Light",SpotLight:"Spot Light",DirectionalLight:"Directional Light"};function XA(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 cPe(e){return typeof e=="number"?[e,e,e]:XA(e,[1,1,1])}function UX(e){let t=new kr(0,0,0,1);return t.setStyle(e),{r:t.r,g:t.g,b:t.b}}function l1e(e,t){let i=e.material??(e.color!==void 0?{color:e.color}:void 0);if(i===void 0)return Kn.defaultColorMaterial(h1e(Ja),"physical","layer1","layer2");if(typeof i=="string"){for(let[a,o]of Object.entries(t.shared.materials))if(a===i||o.name===i)return a;if(function(a){let o=a.trim().toLowerCase();return/^#([0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(o)||/^(rgb|hsl)a?\(/.test(o)||lt.NAMES[o]!==void 0}(i))return Kn.defaultColorMaterial(UX(i),"physical","layer1","layer2");throw new Error(`createObject: material '${i}' matches no shared material in this document (available: ${function(a){let o=Object.entries(a.shared.materials).map(([,l])=>`'${l.name}'`).filter(l=>l!=="'undefined'");return o.length?o.join(", "):"(none)"}(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(dPe(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?UX(i.color):h1e(Ja),n=Kn.defaultColorMaterial(r,"physical","layer1","layer2"),s=n.layers.find(a=>a.data.type==="light");if(s){let a={};i.roughness!==void 0&&(a.roughness=i.roughness),i.metalness!==void 0&&(a.metalness=i.metalness),i.reflectivity!==void 0&&(a.reflectivity=i.reflectivity),Object.assign(s.data,a)}if(i.alpha!==void 0){let a=n.layers.find(o=>o.data.type==="color");a&&Object.assign(a.data,{alpha:i.alpha})}return n}function h1e(e){return{r:(e>>16&255)/255,g:(e>>8&255)/255,b:(255&e)/255}}function VGe(e){let t=ff.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 wI(e){return Array.isArray(e)?e:!ArrayBuffer.isView(e)||e instanceof DataView?null:Array.from(e)}function GGe(e,t){return fxe({userData:{type:e,...GH[e].normalizeInputs({parameters:t})}})}function jGe(e,t,i){let{objectType:r,geometryType:n}=e,s=function(l){let h={};for(let[u,d]of Object.entries(l))!LGe.has(u)&&d!==void 0&&(h[u]=d);return h}(t),a={states:new Ct,events:new Ct};if(r==="Mesh"&&n){if(n==="NonParametricGeometry"){let{geometry:l,doubleSide:h}=function(u){let d=wI(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=wI(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 f=new At;f.setAttribute("position",new Et(d,3));let m=wI(u.normals),g=m!==null&&m.length===d.length;g&&f.setAttribute("normal",new Et(m,3));let v=wI(u.uvs);v&&v.length===2*c&&f.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 T=w.length/3,M=new Map,E=new Array(T);for(let D=0;D<T;D++){let O=`${Math.round(1e4*w[3*D])},${Math.round(1e4*w[3*D+1])},${Math.round(1e4*w[3*D+2])}`,z=M.get(O);z===void 0?(M.set(O,D),E[D]=D):E[D]=z}let A=new Map;for(let D=0;D+2<S.length;D+=3){let O=E[S[D]],z=E[S[D+1]],B=E[S[D+2]];for(let[V,j]of[[O,z],[z,B],[B,O]]){if(V===j)continue;let K=V<j?V+"_"+j:j+"_"+V;A.set(K,(A.get(K)??0)+1)}}let P=A.size>0;for(let D of A.values())if(D!==2){P=!1;break}if(!P)return{closed:!1,inverted:!1};let N=0;for(let D=0;D+2<S.length;D+=3){let O=3*S[D],z=3*S[D+1],B=3*S[D+2],V=w[O],j=w[O+1],K=w[O+2],$=w[z],Q=w[z+1],ce=w[z+2],pe=w[B],ye=w[B+1],we=w[B+2];N+=V*(Q*we-ce*ye)+j*(ce*pe-$*we)+K*($*ye-Q*pe)}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&&f.setIndex(p),g||f.computeVertexNormals(),{geometry:fxe({userData:{type:"NonParametricGeometry",parameters:{subdivisions:0}},data:f.toJSON().data}),doubleSide:y}}(s);Object.assign(a,xc.defaultData,{geometry:l,materials:[l1e(t,i)]}),h&&(a.side=2)}else Object.assign(a,xc.defaultData,{geometry:n==="TextGeometry"?VGe(s):GGe(n,s),material:l1e(t,i)});t.castShadow!==void 0&&(a.castShadow=t.castShadow),t.receiveShadow!==void 0&&(a.receiveShadow=t.receiveShadow)}else r==="Empty"?Object.assign(a,GL.defaultData):(Object.assign(a,jL.defaultData(r),s),t.color!==void 0&&(a.color=UX(t.color)));a.visible=t.visible??!0,a.position=XA(t.position,[0,0,0]),a.rotation=XA(t.rotation,[0,0,0]),a.scale=cPe(t.scale);let o=(n&&zGe[n])??kGe[r]??r;return a.name=t.name??pPe(o,i.scene.objects),a}function pPe(e,t){let i=new Set;if(t.traverse((n,s)=>{i.add(s.name??"")}),!i.has(e))return e;let r=2;for(;i.has(`${e} ${r}`);)r++;return`${e} ${r}`}function fPe(e,t){let i=et.generateUUID();if(e.data.type==="Component")return{data:{...Mf.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:E4e(r.animations,et.generateUUID,t)}),{...e,id:i,data:r,children:e.children.map(n=>fPe(n,t))}}function WGe(e){let t={};return function(i,r){return Sx(i,r,null)??i}(fPe(e,t),t)}function HGe(e){let t=Array.isArray(e)?e[0]:e,i=t.layers?.map(qGe)??[],r=t.layers?.find(n=>n.type==="light");return{layers:i,alpha:r?.node.alphaOverride?.value??1}}function qGe(e){return e.type==="texture"||e.type==="video"||e.type==="matcap"?{...e.data,updateTexture:t=>e.color.texture.image.updateSrc(t)}:{...e.data}}em(),Zn(),jY(),Su();var _M=new kr(0,0,0,1),$Ge={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:[]};zt(),zt();var XGe=new Z;function u1e(e){let t=new kr(0,0,0,1);try{t.setStyle(e)}catch(i){console.error(i)}return t}var mPe=class{constructor(e,{renderOnDemand:t,renderMode:i="auto",wasmPath:r,renderer:n,htmlContentMode:s="sandbox"}={}){if(this._rendererBackend="webgl",this._rendererAuto=!1,this._rendererConfigured=!1,this._startOrder=0,this._claimedOrder=0,this._viewportMode=1,this._viewportWidth=window.innerWidth,this._viewportHeight=window.innerHeight,this._proxyObjectCache=new Map,this._htmlContentMode="sandbox",this._variablesCache=new Map,this._isPaused=!1,this._renderRequested=!1,this._skipRender=!1,this.time=performance.now(),this.dt=0,this.currentTAAFrame=0,this.disposed=!1,this._requestRenderAutoMode=()=>{this._skipRender=!1},this.requestRender=()=>{this._renderRequested=!0},this.render=a=>{if(this.time=a,this._lastTime&&(this.dt=this.time-this._lastTime),this._lastTime=this.time,this._perfs?.start(),this._renderer)if(this._isPaused||!(this.renderMode==="manual"&&!this._renderRequested||this.renderMode==="auto"&&this._skipRender)){if(this._renderRequested=!1,this._skipRender=!0,this._controls&&(this._skipRender=this._controls.update(this.dt)??!1),this._eventManager&&(this._eventManager.handlers?.Start?.hasVideoAction||this._eventManager.handlers?.Basic?.hasVideoAction||this._eventManager.handlers?.Conditional?.hasVideoAction)&&(this._skipRender=!1),this._animationControls?.update(this.dt),this._skipRender?(this.currentTAAFrame++,this.currentTAAFrame<gxe?this._skipRender=!1:this.currentTAAFrame=0):this.currentTAAFrame=0,this._scene?.traverseVisibleEntity(o=>{o.type==="ParticleSystem"&&(o.update(this.dt),this._skipRender=!1),s1(o)&&(this._renderer?.isWebGPUSplineRenderer!==!0&&o.warnClassicFallbackOnce(),o.isSimulating&&(o.update(this.dt),this._skipRender=!1))}),this._scene&&this._scene.activeCamera!==this._camera&&(this._camera=this._scene.activeCamera),this._eventManager?.isEnabled&&(this._eventManager.handlers?.Follow?.onAnimationFrameDamping(),this._eventManager.handlers?.LookAt?.onAnimationFrameDamping(),this._eventManager.handlers?.DragDrop?.onAnimationFrameDamping()),this._scene&&this._camera){if(this._scene.pathConstraints.applyConstraints(this._scene),this._renderer.sceneTransitionTimeRemaining>0){this._renderer.sceneTransitionTimeRemaining-=this.dt;let o=Math.min(1,1-this._renderer.sceneTransitionTimeRemaining/this._renderer.sceneTransitionDuration);this._renderer.pipeline.sceneTransitionPass.uniforms.mixRatio.value=o,this._skipRender=!1}else this._renderer.pipeline.sceneTransitionFromTexture=null;this._renderer.renderSplineScene(this._scene,this._camera),this._renderer.lastFrameIncomplete===!0&&(this._skipRender=!1),this._renderer.skyAnimationActive===!0&&(this._skipRender=!1)}this.canvas.dispatchEvent(this._renderedEvent),this._perfs?.end()}else this._perfs?.end();else this._perfs?.end()},this._resize=a=>{if(this._renderer){if(this._viewportMode===1&&this._frameView&&(this._frameView.frameSize=XGe.set(this._viewportWidth,this._viewportHeight)),a){let o=this._viewportWidth,l=this._viewportHeight;this._renderer.setSize(o-1,l-1,!1),this._renderer.setSize(o,l,!1)}else this._renderer.setSize(this._viewportWidth,this._viewportHeight,!1);this._camera=this._scene?.activeCamera,this._scene?.updateViewPlaneSize(this._frameView?.frameSize?.x??this._viewportWidth,this._frameView?.frameSize?.y??this._viewportHeight,this._frameView?.enableResponsive??!1),this._camera&&(this._frameView?.setCamera(this._camera),this._frameView?.updateCamera(),this._camera.cameraType==="PerspectiveCamera"&&(this._camera.aspect=this._viewportWidth/this._viewportHeight),this._camera.updateProjectionMatrix()),this.eventManager&&(this.eventManager.eventContext.domRect=this.canvas.getBoundingClientRect()),this._requestRenderAutoMode()}},this._debouncedResize=TA(this._resize,10),this._onScroll=a=>{this.eventManager&&(this.eventManager.eventContext.domRect=this.canvas.getBoundingClientRect())},this.canvas=e,this._htmlContentMode=s,this.renderMode=t?"auto":i,r!==void 0&&(this._wasmPath=function(a){let o=a.length;for(;o>0&&"/".includes(a[o-1]);)o--;return a.slice(0,o)}(r)),this._rendererBackend=n??"webgl",n===void 0){let a=null;try{a=new URLSearchParams(window.location.search).get("renderer")}catch{}a==="webgpu"||a==="webgl"||a==="webgl2"?this._rendererBackend=a==="webgl2"?"webgl":a:(this._rendererAuto=!0,this._rendererBackend=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(()=>(lUe(),z2e)).then(({Perfs:a})=>{this._perfs=new a({x:10,y:10})}),function(a){a.addEventListener("pointerdown",Cee,!0),a.addEventListener("pointerdown",f3,!0),a.addEventListener("pointermove",f3,!0),a.addEventListener("pointerup",W1,!0),a.addEventListener("pointercancel",W1,!0),a.addEventListener("pointerleave",W1,!0),window.addEventListener("keydown",Pee,!0),window.addEventListener("keyup",Ree,!0)}(e)}async _ensureRenderer(){return this._renderer?this._renderer:(this._rendererInit||(this._rendererInit=this._initRenderer().then(e=>(this._rendererInit=void 0,e&&(this._renderer=e),e),e=>{throw this._rendererInit=void 0,e})),this._rendererInit)}async _initRenderer(){if(this.disposed)return null;let e=await this._createRenderer();return this.disposed?(this._disposeRenderer(e),null):e}_disposeRenderer(e){let t=function(r){let n=r.backend;if(n!==void 0)return n.isWebGLBackend===!0?n.gl??null:null;let s=r.getContext,a=typeof s=="function"?s.call(r):null;return a&&typeof a.getExtension=="function"?a:null}(e);if(t&&!function(r,n){return n1e.get(r)===n}(this.canvas,this))return void(function(r){return r.backend?.isWebGLBackend===!0}(e)||e.dispose());let i=t?function(r,n){let s=n.getExtension("WEBGL_lose_context");if(!s||n.isContextLost())return()=>{};let a=()=>{},o=new Promise(l=>{a=s1e(r,"webglcontextlost",h=>{h.preventDefault(),l(s)})});return _I.set(r,{gl:n,lost:o,stopListening:a}),()=>{n.isContextLost()||s.loseContext()}}(this.canvas,t):void 0;try{e.dispose()}finally{i?.()}}async _createRenderer(){if(function(e,t){n1e.set(e,t)}(this.canvas,this),await async function(e){let t=_I.get(e);if(t&&(t.restoring??(t.restoring=async function(i,r){if(!r.gl.isContextLost())return void r.stopListening();let n,s=()=>{},a=r.lost.then(l=>new Promise(h=>{s=s1e(i,"webglcontextrestored",()=>h()),l.restoreContext()})),o=new Promise(l=>{n=setTimeout(l,2e3)});await Promise.race([a,o]),clearTimeout(n),s(),r.stopListening()}(e,t).finally(()=>{t.restoring=void 0,!t.gl.isContextLost()&&_I.get(e)===t&&_I.delete(e)})),await t.restoring,t.gl.isContextLost()))throw new Error("[spline] The browser did not restore the WebGL context this canvas had before dispose(); the scene cannot render on it. Use a new canvas.")}(this.canvas),this._rendererBackend==="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(()=>(M9(),zO));t();let i=!0,r=!1;try{let s=new URLSearchParams(window.location.search),a=s.get("bundles");a==="rerecord"?i="rerecord":(a==="off"||a==="0"||a==="false"||a==="no")&&(i=!1),r=s.get("forcegl")==="1"}catch{}let n=await e({canvas:this.canvas,antialias:!1,alpha:!0,powerPreference:"high-performance",sceneBundles:!r&&i,forceWebGL:r,asyncCompilation:this._asyncShaderCompilation()});return n.onBackgroundWorkReady=()=>{this._skipRender=!1,this._renderRequested=!0},n.skyAnimationAllowed=!0,n}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(()=>(Q0e(),oX));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"})}}_asyncShaderCompilation(){let e=this._data?.scene.publish?.asyncShaderCompilation!==!1;try{let t=new URLSearchParams(window.location.search);if(t.get("forcegl")==="1")return!1;let i=t.get("asynccomp");i==="off"||i==="0"||i==="false"||i==="no"?e=!1:(i==="on"||i==="1"||i==="true"||i==="always")&&(e=!0)}catch{}return e}_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 s="The Spline Runtime only accepts .splinecode files that are generated from Spline export panel.";n.endsWith(".spline")?console.warn(s+" The .spline files are only meant to be used by the Editor."):n.endsWith(".splinecode")||console.warn(s)})(e),this.disposed=!1;let r=await(await fetch(e,i)).arrayBuffer();await this.start(r,{variables:t})}async start(e,t={}){if(this.disposed)return;let i,r=++this._startOrder,n=()=>this._claimedOrder>r;return i=this._start(e,t,n,()=>!n()&&(this._claimedOrder=r,this._claimedStart=i,!0)).then(()=>n()?this._claimedStart:void 0,s=>{if(!n())throw s;return this._claimedStart}),i}async _start(e,{interactive:t=!0,variables:i},r,n){zs.init();let s=await async function(m){let[g,v]=IM(MA.deserialize(new Uint8Array(m)));if((g.schema??0)!==135){let{updateDocumentSchema:y}=await Promise.resolve().then(()=>(_B(),ixe));y(g)}return v.result().data}(e);if(r())return;let a=function(m){let g=[];return m.scene.objects.traverse((v,y)=>{y.type==="Mesh"&&y.geometry.type==="NonParametricGeometry"&&y.geometry.data.draco!==void 0&&g.push(y)}),g}(s);s.version&&(0,NGe.default)(s.version,"2.0.122")>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(m){YSe=m}(this._wasmPath));let o=async function(){}();if(await Promise.all([o,a.length&&i1e(this._wasmPath),Ure(s)&&tBe(this._wasmPath),wBe(s)&&xBe(this._wasmPath),$Be(s)&&PBe(this._wasmPath),n1.physicsEnabled(s.scene.objects)&&GVe(this._wasmPath),zie(s)&&Fve(),lne(s)&&gFe(),uBe(s)&&hBe(),Pve(s)&&o.then(()=>gH()?.loadHanaUIRUNTIME()),LVe(s)&&s6e(this._wasmPath)].filter(Boolean)),r()||a.length&&(await r1e(a),r())||!n())return;this._data=s,this._eventManager?.deactivate(),this._controls?.deactivate(),this._scene?.dispose();let l=s.scene.publish.renderer;if(this._rendererAuto&&l==="webgl")this._rendererBackend="webgl";else if(this._rendererAuto&&l==="webgpu"){let m=this._rendererBackend==="webgpu"&&await navigator.gpu?.requestAdapter().catch(()=>null);if(r())return;if(!m)return void this._failWebGPURequired();this._rendererAuto=!1}let h=function(m){let g=new Set;return m.scene.objects.traverse((v,y)=>{if(y.type!=="Page")return;let _=y.postprocessing;if(_&&typeof _=="object"&&_.enabled===!0)for(let[b,x]of Object.entries(_))b!=="enabled"&&x&&typeof x=="object"&&x.enabled===!0&&g.add(b)}),[...g]}(s);if(this._rendererBackend==="webgpu")try{await Promise.all([Promise.resolve().then(()=>(M9(),zO)),DGe(h)]);let m=await this._ensureRenderer();if(r()||!m)return}catch(m){console.error("[spline] Failed to load the WebGPU material backend, using WebGL:",m),this._rendererBackend="webgl"}if(this._rendererBackend!=="webgpu"&&(await Promise.all([Promise.resolve().then(()=>(Q0e(),oX)),RGe(h)]),r()))return;(function(m){nC=m})(this._rendererBackend==="webgpu"?"webgpu":"webgl");let u=new EGe(s,{},!0,{dedupeParametricGeometries:!0});if(u.resetPersonalCameraFromDocumentData(),this._scene=u.scene,this._sharedAssetsManager=u.sharedAssets,this._camera=this._scene.activeCamera,window.location.search.includes("merge-geometries")){let{mergeStaticGeometries:m}=await Promise.resolve().then(()=>(bke(),ZCe));if(r())return;let g=performance.now();m(s,u.scene);let v=performance.now();console.log("Merged geometries in ",v-g," ms")}Ure(s)&&this._scene.traverse(m=>{zc(m)&&m.recomputeBoolean()}),this._sharedAssetsManager.setRequestRender(()=>{this._requestRenderAutoMode(),this._scene?.traverse(m=>{Lg(m)&&m.pendingMediaLoad&&m.update({scene:this._scene,shared:this._sharedAssetsManager})})}),this._scene?.traverse(m=>{m.type==="ParticleSystem"&&(m.wakeUp(),m.data.autoPlay?m.start():m.stop()),s1(m)&&m.setPlayMode(!0)});let d=Object.keys(s.shared.fonts).flatMap(m=>{let g=this._sharedAssetsManager.getFont(m);return g?[g.loadingPromise]:[]});if(Promise.all(d).then(()=>{this.disposed||(u.scene.markNeedsUpdateRendererDirty(),this._requestRenderAutoMode())}),zie(s)&&function(m){if(n1.physicsEnabled(m.scene.objects))return!0;let g=!1;return m.scene.objects.traverse((v,y)=>{if(y.events){if(Array.isArray(y.events)){for(let _ of y.events)if(_.data.disabled!==!0&&_.data.type==="GameControl"&&_.data.collisionEnabled){g=!0;break}}else for(let _ of Object.values(y.events))if(_.disabled!==!0&&_.type==="GameControl"&&_.collisionEnabled){g=!0;break}}}),g}(s)&&(await Promise.all(d),r()))return;if(Pve(s)){let m=[];if(this._scene.traverseEntity(g=>{($o(g)||g instanceof Dn)&&g.uiCanvas&&m.push(g.uiCanvas)}),await Promise.all(m.map(g=>g.promise)),r())return}this._scene.rewriteEventsBeforeGoToPlayMode(),IZ(this._scene.activePage,this._sharedAssetsManager);let c=await this._ensureRenderer();if(r()||!c)return;if(this._rendererConfigured||(this._rendererConfigured=!0,c.pipeline.enableUIOverlay(),c.pipeline.addEventListener("smaaloaded",this._requestRenderAutoMode)),c.hdTransmission=s.scene.publish.hdTransmission===!0,c.setPixelRatio(this._getPixelRatio(/Mobi|Android|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)?s.scene.publish.settings.web.pixelRatioMobile:s.scene.publish.settings.web.pixelRatioDesktop)),c.setAsyncCompilationPolicy?.(this._asyncShaderCompilation()),s.shared.images.SplineWatermark){let m=this._sharedAssetsManager.getImage("SplineWatermark");if(await m.loadPromise,r())return;let g=m.getTexture(1001);c.pipeline.setWatermark(g)}else c.pipeline.setWatermark(null);lne(s)&&this._scene.initializeSplatViewer(),s.scene.blueNoiseTextureData!==void 0&&c.pipeline.updateBlueNoiseTexture(s.scene.blueNoiseTextureData);let p=Object.values(s.frames)[0];if(this._frameView?this._frameView.setCamera(this._camera):(p.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=p.size[0],this._viewportHeight=p.size[1],this.canvas.style.width=`${this._viewportWidth}px`,this.canvas.style.height=`${this._viewportHeight}px`),c.setSize(this._viewportWidth,this._viewportHeight,!1),this._frameView=new tVe(c,this._camera,new Z(this._viewportWidth,this._viewportHeight)),this._frameView.enableResponsive=(p.allowResponsive??!1)&&p.preset==="fullscreen"),t){let m=new Oke(c,this.data.scene.publish,this._scene,()=>this._scene.activeCamera,this._sharedAssetsManager,this._requestRenderAutoMode,!0,p);this._scene.updateMatrixWorld(!0),this._controls=new $Ve(m),this._animationControls=new vGe(this._scene,this._requestRenderAutoMode),this._eventManager=new Yke(s.scene.publish,this._controls,this._animationControls,m,s.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),t&&(this._htmlContentOverlay?.dispose(),this._htmlContentOverlay=void 0);let f=s.scene.publish.htmlContent?.html;if(t&&f&&this._htmlContentMode!=="none"){let m={shared:this._sharedAssetsManager,findEntity:g=>this._scene?.getObjectByProperty("uuid",g)??this._scene?.getObjectByName(g),getAnimationControls:()=>this._animationControls};this._htmlContentOverlay=(this._htmlContentMode==="inline"?uPe.mount(this,this.canvas,f,m):hPe.mount(this,this.canvas,f,m))??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)){if(t==null)return void console.warn(`Variable ${e} was not updated: received ${t}. Pass a number, boolean or string.`);let r=t;if(typeof i.data.value=="number"){if(r=typeof t=="number"?t:typeof t=="boolean"?t===!0?1:0:parseFloat(t),!Number.isFinite(r))return void console.warn(`Variable ${e} is a number variable and ${JSON.stringify(t)} cannot be converted to a number. The variable was not updated.`)}else 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"&&Mo.isTextValue(e)?Mo.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===d1||this._scene.isInvisibleObjects(t)||t instanceof Dn)){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 p3e&&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=u1e(e);this._scene?.activePage.setBackgroundColor(t),this._requestRenderAutoMode()}dispose(){this.disposed=!0,this._claimedOrder=++this._startOrder,this._claimedStart=void 0,this._htmlContentOverlay?.dispose(),this._htmlContentOverlay=void 0,this._eventManager?.dispose(),this._scene?.dispose(),this._scene=void 0,this._camera=void 0,UE&&UE.disposeAll(),this._sharedAssetsManager?.setRequestRender(()=>{}),this._sharedAssetsManager?.dispose(),this._sharedAssetsManager=void 0,this._proxyObjectCache.forEach(e=>{G9.unsubscribe(e)}),this._proxyObjectCache.clear(),this._variablesCache.clear(),this._renderer?.pipeline.removeEventListener("smaaloaded",this._requestRenderAutoMode),this._renderer?.setAnimationLoop(null),this._renderer&&this._disposeRenderer(this._renderer),this._renderer=void 0,this._rendererConfigured=!1,this._debouncedResize.cancel(),this._resizeObserver&&(this._resizeObserver.disconnect(),this._resizeObserver=void 0),this._resizeObserverTimeout!==void 0&&(clearTimeout(this._resizeObserverTimeout),this._resizeObserverTimeout=void 0),this.canvas.style.width="",this.canvas.style.height="",this.canvas.removeAttribute("width"),this.canvas.removeAttribute("height"),this._frameView=void 0,this._controls?.deactivate(),this._controls=void 0,this._animationControls=void 0,this._eventManager?.eventContext.dispose(),this._eventManager=void 0,this._splatViewer=void 0,this._data=void 0,this._perfs=void 0,this.dt=0,this._lastTime=void 0,function(e){e.removeEventListener("pointerdown",Cee,!0),e.removeEventListener("pointerdown",f3,!0),e.removeEventListener("pointermove",f3,!0),e.removeEventListener("pointerup",W1,!0),e.removeEventListener("pointercancel",W1,!0),e.removeEventListener("pointerleave",W1,!0),window.removeEventListener("keydown",Pee,!0),window.removeEventListener("keyup",Ree,!0)}(this.canvas),document.removeEventListener("scroll",this._onScroll),zs.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 Dn&&(t=u.name)});let r=this._sharedAssetsManager,n={shared:r,scene:this._scene},s=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}},a="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??(a?HGe(a):void 0),parentUuid:e.parent instanceof Dn||e instanceof zg?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"?s(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=aPe;if(d===null)return Ta("transitions","obj.transition()"),{transition(b){return this},play(){return this},pause(){return this},reset(){return this},seek(b){return this}};let c,p,f=this,m=[],g=!1,v=()=>{p=new W3e({delay:0,delayDirection:"start-once",direction:"normal",repeat:0,runMode:"Repeat"},m.map(b=>b.runner))},y={update(b){p?.update(b),p?.isPlaying!==!0&&zs.remove(y)}},_={transition({from:b,to:x,duration:w,delay:S,...T}){let M=s(b);M===void 0&&(M=c);let E=s(x);return c=E,m.push(new d(e,M,E,{state:E,repeat:0,delay:S??0,delayDirection:"start-once",direction:"normal",duration:w??1e3,...T,...T.easing===6?Ng.defaultData:T.easing===5?nw.defaultData:{}},r,!1,i.activePage,{onBegin:()=>{(b&&M||b==="Base State"&&!M)&&(f.state=M??void 0)},onComplete:()=>{f.state=E??void 0}})),v(),this},play(){return p?(g=!0,p.play(zs.time),p.isPlaying&&zs.add(y),this):this},pause(){return p?.stop(),zs.remove(y),this},reset(){return this.pause(),g=!1,v(),p?.seek(0),this},seek(b){let x=m.reduce((w,S)=>w+S.runner.duration,0);return x>0&&p?.seek(b/1e3/x),this}};return _.transition(u),(u.autoPlay??!0)&&queueMicrotask(()=>{g||_.play()}),_},set color(u){let d=u1e(u);if(l4.is(e))return void(e.color=d);if(!(e.type==="Mesh"&&"material"in e&&e instanceof xl))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 f=Array.isArray(e.material)?e.material[0]:e.material,m=f.data.layers.find(g=>g.data.type==="color")?.id;if(m)f.updateByOp({type:0,path:["layers",m],props:{color:{...c}}},f.data,n);else{let g=f.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:et.generateUUID(),data:{...rs.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(f.data,{layers:w}),f.updateByOp({...b,path:["layers"]},f.data,n)}}},h=G9(l,(u,d)=>{let c=e[u],p=function(f){return f.split(".")}(u);p[0]==="material"&&a&&o===void 0&&function(f,m,g){let v=Array.isArray(g)?g[0]:g;if(f[0]==="layers"){let y=parseInt(f[1]),_=v.layers[y],b=f[2];_&&b&&function(x,w,S){let T=x[0];try{if(function(M,E){return!!$Ge[E]?.includes(M)}(T,S.type,x.slice(1)))if(T==="colors"){if(x.length<2)throw new Error("You cannot mutate the colors array, only its items");let M=parseInt(x[1]),E=S.getValue(T)?.[M];if(!E)throw new Error("Color index out of range");_M.setStyle(w),E.set(_M.r,_M.g,_M.b,_M.a)}else S.getValue(T)?.setStyle(w);else if(T==="texture"||T==="video"){let M=S.color;(function(E,A,P,N){let D=E[0];if(D==="repeat"||D==="offset"||D==="rotation"){let O=N.getNode("mat"),z=O&&typeof O.updateMatrix=="function"?O:N.getValue("mat");if(!z)return;if(D==="rotation")z.rotation=parseFloat(A);else{let B=E[1];if(B===void 0)A instanceof Array&&A.length===2&&Object.assign(z,{[D]:A});else{let V=z[D],j=parseInt(B)===0?[parseFloat(A),V[1]]:[V[0],parseFloat(A)];Object.assign(z,{[D]:j})}}z.updateMatrix()}else D==="wrapping"||D==="minFilter"||D==="magFilter"?D==="wrapping"?P.texture.wrap=A:P.texture[D]=A:D==="image"&&E[1]==="data"&&P.texture.image.updateSrc(A)})(x.slice(1),w,M,S)}else{let M=x[1],E=S.getValue(T);E?.isVector3&&M!==void 0||E?.isVector2&&M!==void 0?E.setComponent(parseInt(M),w):S.setValue(T,w)}}catch(M){console.error("Error setting material value",M)}}(f.slice(2),m,_)}else f[0]==="alpha"&&v.layers.forEach(y=>{y.type==="light"&&y.node.alphaOverride!==void 0&&(y.node.alphaOverride.value=m,m<1&&(v.transparent=!0))})}(p.slice(1),d,a),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){KL=t,wB?.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=MA.deserialize(i),n="data"in r&&r.data.draco!==void 0;n&&await i1e(this._wasmPath);let s=this._scene?.getObjectByProperty("uuid",e)??this._scene?.getObjectByName(e);if(!s)return void console.warn(`Object ${e} not found`);if(s.data.type!=="Mesh"||!(s instanceof xl))return void console.warn(`Object ${e} is not a mesh`);let a=s,o={...a.data,geometry:r};n&&await r1e([o]),a.updateByOp({type:0,path:[],props:{geometry:o.geometry}},o,{shared:this._sharedAssetsManager,scene:this._scene},!1);for(let l of a.data.states){let h={...l.data};a.states||(a.states={}),a.states[l.id]=Og.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=HH();if(t===void 0&&(this._rendererBackend==="webgpu"&&(await Promise.resolve().then(()=>(M9(),zO)),t=HH()),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 xl))throw new Error(`setMaterial: '${r}' is not a mesh \u2014 lights, groups, and cameras have no material.`);let s=typeof t=="function"?await this.createCustomMaterial(t):t;if(s4()!=="webgpu")throw new Error("setMaterial: custom three.js materials require the webgpu backend (the runtime default where WebGPU is available). This scene is running the classic WebGL pipeline \u2014 pass { renderer: 'webgpu' } or drop any ?renderer=webgl2 override.");let a=a1e({material:s});if(a.material===void 0)throw new Error("setMaterial: expected a three.js material instance or a (three) => material factory.");return n.setMaterialOverride(a.material,{scene:i,shared:this._sharedAssetsManager}),this._proxyObjectCache.delete(n.uuid),this._requestRenderAutoMode(),a.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 ${o1e}.`);let v=g.replace(/Geometry$/i,"").replace(/[\s_-]/g,"").toLowerCase(),y=FGe[v];if(y)return{objectType:y};let _=BGe[v];if(_)return{objectType:"Mesh",geometryType:_};let b=UGe[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 ${o1e}, e.g. createObject('Cube', { width: 200 }).`)}(e);typeof t.material=="function"&&(t={...t,material:await this.createCustomMaterial(t.material)});let s,a,{options:o,material:l}=a1e(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(s4()!=="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(!LY.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 Fve(),a=t.font??Ib,r.shared.fonts[a]===void 0){if(a!==Ib){let g=Object.keys(r.shared.fonts).join(", ");throw new Error(`createObject: font '${a}' is not in this document \u2014 available fonts: ${g||"(none)"}.`)}s={name:Ib,url:dbe}}}let h=this._resolveParentId(t.parent),u=jGe(n,o,r),d=et.generateUUID(),[c,p]=IM(r);s&&(c.shared.fonts[Ib]=s),c.scene.objects.insertAfter(h,null,[{id:d,data:u,children:[]}]);let f=p.result();if(s&&this._sharedAssetsManager.addFont(Ib,s),a!==void 0){let g=this._sharedAssetsManager.getFont(a);g&&await g.loadingPromise}this._applyDocumentTransaction(f);let m=i.find(d);return l!==void 0&&m.setMaterialOverride(l,{scene:i,shared:this._sharedAssetsManager}),this._requestRenderAutoMode(),this._createProxyObject(m)}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,s=n?this._findEntity(n):void 0;if(!s)throw new Error(`cloneObject: '${n}' \u2014 no object with that name or uuid in the scene.`);if(s instanceof Dn)throw new Error("cloneObject: pages cannot be cloned.");let a=r.scene.objects.get(s.uuid);if(!a)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,f,m){let g={...p.data};return f.position!==void 0&&(g.position=XA(f.position,[0,0,0])),f.rotation!==void 0&&(g.rotation=XA(f.rotation,[0,0,0])),f.scale!==void 0&&(g.scale=cPe(f.scale)),f.visible!==void 0&&(g.visible=f.visible),g.name=f.name??pPe(`${p.data.name??"Object"} Copy`,m),{...p,data:g}}(WGe(a),t,r.scene.objects),l=t.parent!==void 0?this._resolveParentId(t.parent):r.scene.objects.parent(s.uuid)??null,h=t.parent!==void 0?null:s.uuid,[u,d]=IM(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 Dn)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 s=[];n.traverseEntity(l=>{s.push(l.uuid)});let[a,o]=IM(i);a.scene.objects.delete(n.uuid),this._applyDocumentTransaction(o.result());for(let l of s){let h=this._proxyObjectCache.get(l);h&&(G9.unsubscribe(h),this._proxyObjectCache.delete(l))}return this._requestRenderAutoMode(),!0}};var uF=window,dF=uF.ShadowRoot&&(uF.ShadyCSS===void 0||uF.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,OZ=Symbol(),gPe=new WeakMap,mC=class{constructor(t,i,r){if(this._$cssResult$=!0,r!==OZ)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(dF&&t===void 0){let r=i!==void 0&&i.length===1;r&&(t=gPe.get(i)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),r&&gPe.set(i,t))}return t}toString(){return this.cssText}},vPe=e=>new mC(typeof e=="string"?e:e+"",void 0,OZ),LZ=(e,...t)=>{let i=e.length===1?e[0]:t.reduce((r,n,s)=>r+(a=>{if(a._$cssResult$===!0)return a.cssText;if(typeof a=="number")return a;throw Error("Value passed to 'css' function must be a 'css' function result: "+a+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(n)+e[s+1],e[0]);return new mC(i,e,OZ)},BZ=(e,t)=>{dF?e.adoptedStyleSheets=t.map(i=>i instanceof CSSStyleSheet?i:i.styleSheet):t.forEach(i=>{let r=document.createElement("style"),n=uF.litNonce;n!==void 0&&r.setAttribute("nonce",n),r.textContent=i.cssText,e.appendChild(r)})},cF=dF?e=>e:e=>e instanceof CSSStyleSheet?(t=>{let i="";for(let r of t.cssRules)i+=r.cssText;return vPe(i)})(e):e;var FZ,pF=window,yPe=pF.trustedTypes,YGe=yPe?yPe.emptyScript:"",_Pe=pF.reactiveElementPolyfillSupport,zZ={toAttribute(e,t){switch(t){case Boolean:e=e?YGe: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}},bPe=(e,t)=>t!==e&&(t==t||e==e),UZ={attribute:!0,type:String,converter:zZ,reflect:!1,hasChanged:bPe},kZ="finalized",im=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=UZ){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 s=this[t];this[i]=n,this.requestUpdate(t,s,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)||UZ}static finalize(){if(this.hasOwnProperty(kZ))return!1;this[kZ]=!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(cF(n))}else t!==void 0&&i.push(cF(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 BZ(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=UZ){var n;let s=this.constructor._$Ep(t,r);if(s!==void 0&&r.reflect===!0){let a=(((n=r.converter)===null||n===void 0?void 0:n.toAttribute)!==void 0?r.converter:zZ).toAttribute(i,r.type);this._$El=t,a==null?this.removeAttribute(s):this.setAttribute(s,a),this._$El=null}}_$AK(t,i){var r;let n=this.constructor,s=n._$Ev.get(t);if(s!==void 0&&this._$El!==s){let a=n.getPropertyOptions(s),o=typeof a.converter=="function"?{fromAttribute:a.converter}:((r=a.converter)===null||r===void 0?void 0:r.fromAttribute)!==void 0?a.converter:zZ;this._$El=s,this[s]=o.fromAttribute(i,a.type),this._$El=null}}requestUpdate(t,i,r){let n=!0;t!==void 0&&(((r=r||this.constructor.getPropertyOptions(t)).hasChanged||bPe)(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,s)=>this[s]=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 s;return(s=n.hostUpdate)===null||s===void 0?void 0:s.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){}};im[kZ]=!0,im.elementProperties=new Map,im.elementStyles=[],im.shadowRootOptions={mode:"open"},_Pe?.({ReactiveElement:im}),((FZ=pF.reactiveElementVersions)!==null&&FZ!==void 0?FZ:pF.reactiveElementVersions=[]).push("1.6.3");var VZ,fF=window,Vw=fF.trustedTypes,xPe=Vw?Vw.createPolicy("lit-html",{createHTML:e=>e}):void 0,jZ="$lit$",u0=`lit$${(Math.random()+"").slice(9)}$`,CPe="?"+u0,KGe=`<${CPe}>`,_1=document,vC=()=>_1.createComment(""),yC=e=>e===null||typeof e!="object"&&typeof e!="function",PPe=Array.isArray,ZGe=e=>PPe(e)||typeof e?.[Symbol.iterator]=="function",GZ=`[
|
|
13016
|
+
`,uPe=class{constructor(e,t,i,r,n,s){this.container=e,this.host=t,this.observer=i,this.spline=r,this.previousSplineGlobal=n,this.removeLateLifecycleShim=s}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 s=document.createElement("div");s.setAttribute(HO,"");let a=s.style;a.position="absolute",a.overflow="hidden";let o=()=>{a.left=`${t.offsetLeft}px`,a.top=`${t.offsetTop}px`,a.width=`${t.offsetWidth}px`,a.height=`${t.offsetHeight}px`};o();let l=new ResizeObserver(o);l.observe(t),l.observe(n);let h=document.createElement("style");h.textContent=OGe,s.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")&&s.appendChild(y);for(;u.body.firstChild;)s.appendChild(u.body.firstChild);n.insertBefore(s,t.nextSibling),s.addEventListener("wheel",y=>{y.ctrlKey&&!y.defaultPrevented&&!t.dispatchEvent(new WheelEvent("wheel",y))&&y.preventDefault()},{passive:!1});let c=new Map,p=new uY(lPe(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)}}),f=(y,_)=>{try{return Promise.resolve(p.execute(y,_))}catch(b){return Promise.reject(b)}},m={ready:Promise.resolve(),setVariable:(y,_)=>f("setVariable",[y,_]),setVariables:y=>f("setVariables",[y]),getVariable:y=>f("getVariable",[y]),getVariables:()=>f("getVariables",[]),getAllObjects:()=>f("getAllObjects",[]),findObjectByName:y=>f("findObjectByName",[y]),findObjectById:y=>f("findObjectById",[y]),getGeometry:(y,_)=>f("getGeometry",[y,_??{}]),updateObject:(y,_)=>f("updateObject",[y,_]),createObject:(y,_)=>f("createObject",[y,_??{}]),createCustomMaterial:y=>f("createCustomMaterial",[y]),getTexture:(y,_)=>f("getTexture",[y,_??{}]),setMaterial:(y,_)=>f("setMaterial",[y,_]),cloneObject:(y,_)=>f("cloneObject",[y,_??{}]),removeObject:y=>f("removeObject",[y]),spawnObject:(y,_)=>f("spawnObject",[y,_??{}]),destroyObject:y=>f("destroyObject",[y]),setInstanceTransforms:(y,_)=>f("setInstanceTransforms",[y,_??null]),getAnimations:y=>f("getAnimations",[y]),playAnimation:(y,_,b)=>f("playAnimation",[y,_,b]),pauseAnimation:(y,_)=>f("pauseAnimation",[y,_]),stopAnimation:(y,_)=>f("stopAnimation",[y,_]),emitEvent:(y,_)=>f("emitEvent",[y,_]),emitEventReverse:(y,_)=>f("emitEventReverse",[y,_]),requestRender:()=>f("requestRender",[]),addEventListener:(y,_)=>{if(typeof _!="function")return;let b=c.get(y);b||(b=new Set,c.set(y,b),f("listenEvent",[y])),b.add(_)},removeEventListener:(y,_)=>{let b=c.get(y);!b||(b.delete(_),b.size===0&&(c.delete(y),f("unlistenEvent",[y])))}},g=window.spline;window.spline=m;let v=function(){if(typeof document>"u"||document.readyState==="loading")return()=>{};let y=[],_=(x,w)=>{let S=new Set,T=x.addEventListener.bind(x),M=x.removeEventListener.bind(x);Object.defineProperty(x,"addEventListener",{configurable:!0,writable:!0,value:(E,A,P)=>{if(T(E,A,P),!w.includes(E)||A==null)return;let N={type:E,listener:A};S.add(N),queueMicrotask(()=>{!S.delete(N)||((D,O,z)=>{let B=new Event(z);try{typeof O=="function"?O.call(D,B):O.handleEvent?.(B)}catch(V){console.error(V)}})(x,N.listener,N.type)})}}),Object.defineProperty(x,"removeEventListener",{configurable:!0,writable:!0,value:(E,A,P)=>{M(E,A,P);for(let N of S)N.type===E&&N.listener===A&&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,s.appendChild(_)}return new uPe(s,p,l,m,g,v)}dispose(){this.removeLateLifecycleShim(),this.host.dispose(),this.observer.disconnect(),this.container.remove(),window.spline===this.spline&&(window.spline=this.previousSplineGlobal)}};function dPe(e){return typeof e=="object"&&e!==null&&e.isMaterial===!0}function a1e(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(!dPe(e.material))return{options:e};let t=e.material;if(t.isNodeMaterial===!0){let i=HH()?.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}}zt(),Or(),ae(),Gwe(),Su(),Or(),zt(),$4e(),em();var LGe=new Set(["name","parent","position","rotation","scale","visible","castShadow","receiveShadow","color","material"]),o1e="'Cube', 'Sphere', 'Plane', 'Rectangle', 'Ellipse', 'Triangle', 'Polygon', 'Star', 'Cone', 'Cylinder', 'Pyramid', 'Torus', 'TorusKnot', 'Dodecahedron', 'Icosahedron', 'Helix', 'Backdrop', 'Lathe', 'Text', 'CustomMesh', 'Group', 'PointLight', 'SpotLight', 'DirectionalLight'",BGe={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"},FGe={group:"Empty",empty:"Empty",pointlight:"PointLight",spotlight:"SpotLight",directionallight:"DirectionalLight"},UGe={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')."},zGe={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"},kGe={Empty:"Group",PointLight:"Point Light",SpotLight:"Spot Light",DirectionalLight:"Directional Light"};function XA(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 cPe(e){return typeof e=="number"?[e,e,e]:XA(e,[1,1,1])}function UX(e){let t=new kr(0,0,0,1);return t.setStyle(e),{r:t.r,g:t.g,b:t.b}}function l1e(e,t){let i=e.material??(e.color!==void 0?{color:e.color}:void 0);if(i===void 0)return Kn.defaultColorMaterial(h1e(Ja),"physical","layer1","layer2");if(typeof i=="string"){for(let[a,o]of Object.entries(t.shared.materials))if(a===i||o.name===i)return a;if(function(a){let o=a.trim().toLowerCase();return/^#([0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(o)||/^(rgb|hsl)a?\(/.test(o)||lt.NAMES[o]!==void 0}(i))return Kn.defaultColorMaterial(UX(i),"physical","layer1","layer2");throw new Error(`createObject: material '${i}' matches no shared material in this document (available: ${function(a){let o=Object.entries(a.shared.materials).map(([,l])=>`'${l.name}'`).filter(l=>l!=="'undefined'");return o.length?o.join(", "):"(none)"}(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(dPe(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?UX(i.color):h1e(Ja),n=Kn.defaultColorMaterial(r,"physical","layer1","layer2"),s=n.layers.find(a=>a.data.type==="light");if(s){let a={};i.roughness!==void 0&&(a.roughness=i.roughness),i.metalness!==void 0&&(a.metalness=i.metalness),i.reflectivity!==void 0&&(a.reflectivity=i.reflectivity),Object.assign(s.data,a)}if(i.alpha!==void 0){let a=n.layers.find(o=>o.data.type==="color");a&&Object.assign(a.data,{alpha:i.alpha})}return n}function h1e(e){return{r:(e>>16&255)/255,g:(e>>8&255)/255,b:(255&e)/255}}function VGe(e){let t=ff.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 wI(e){return Array.isArray(e)?e:!ArrayBuffer.isView(e)||e instanceof DataView?null:Array.from(e)}function GGe(e,t){return fxe({userData:{type:e,...GH[e].normalizeInputs({parameters:t})}})}function jGe(e,t,i){let{objectType:r,geometryType:n}=e,s=function(l){let h={};for(let[u,d]of Object.entries(l))!LGe.has(u)&&d!==void 0&&(h[u]=d);return h}(t),a={states:new Ct,events:new Ct};if(r==="Mesh"&&n){if(n==="NonParametricGeometry"){let{geometry:l,doubleSide:h}=function(u){let d=wI(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=wI(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 f=new At;f.setAttribute("position",new Et(d,3));let m=wI(u.normals),g=m!==null&&m.length===d.length;g&&f.setAttribute("normal",new Et(m,3));let v=wI(u.uvs);v&&v.length===2*c&&f.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 T=w.length/3,M=new Map,E=new Array(T);for(let D=0;D<T;D++){let O=`${Math.round(1e4*w[3*D])},${Math.round(1e4*w[3*D+1])},${Math.round(1e4*w[3*D+2])}`,z=M.get(O);z===void 0?(M.set(O,D),E[D]=D):E[D]=z}let A=new Map;for(let D=0;D+2<S.length;D+=3){let O=E[S[D]],z=E[S[D+1]],B=E[S[D+2]];for(let[V,j]of[[O,z],[z,B],[B,O]]){if(V===j)continue;let K=V<j?V+"_"+j:j+"_"+V;A.set(K,(A.get(K)??0)+1)}}let P=A.size>0;for(let D of A.values())if(D!==2){P=!1;break}if(!P)return{closed:!1,inverted:!1};let N=0;for(let D=0;D+2<S.length;D+=3){let O=3*S[D],z=3*S[D+1],B=3*S[D+2],V=w[O],j=w[O+1],K=w[O+2],$=w[z],Q=w[z+1],ce=w[z+2],pe=w[B],ye=w[B+1],we=w[B+2];N+=V*(Q*we-ce*ye)+j*(ce*pe-$*we)+K*($*ye-Q*pe)}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&&f.setIndex(p),g||f.computeVertexNormals(),{geometry:fxe({userData:{type:"NonParametricGeometry",parameters:{subdivisions:0}},data:f.toJSON().data}),doubleSide:y}}(s);Object.assign(a,xc.defaultData,{geometry:l,materials:[l1e(t,i)]}),h&&(a.side=2)}else Object.assign(a,xc.defaultData,{geometry:n==="TextGeometry"?VGe(s):GGe(n,s),material:l1e(t,i)});t.castShadow!==void 0&&(a.castShadow=t.castShadow),t.receiveShadow!==void 0&&(a.receiveShadow=t.receiveShadow)}else r==="Empty"?Object.assign(a,GL.defaultData):(Object.assign(a,jL.defaultData(r),s),t.color!==void 0&&(a.color=UX(t.color)));a.visible=t.visible??!0,a.position=XA(t.position,[0,0,0]),a.rotation=XA(t.rotation,[0,0,0]),a.scale=cPe(t.scale);let o=(n&&zGe[n])??kGe[r]??r;return a.name=t.name??pPe(o,i.scene.objects),a}function pPe(e,t){let i=new Set;if(t.traverse((n,s)=>{i.add(s.name??"")}),!i.has(e))return e;let r=2;for(;i.has(`${e} ${r}`);)r++;return`${e} ${r}`}function fPe(e,t){let i=et.generateUUID();if(e.data.type==="Component")return{data:{...Mf.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:E4e(r.animations,et.generateUUID,t)}),{...e,id:i,data:r,children:e.children.map(n=>fPe(n,t))}}function WGe(e){let t={};return function(i,r){return Sx(i,r,null)??i}(fPe(e,t),t)}function HGe(e){let t=Array.isArray(e)?e[0]:e,i=t.layers?.map(qGe)??[],r=t.layers?.find(n=>n.type==="light");return{layers:i,alpha:r?.node.alphaOverride?.value??1}}function qGe(e){return e.type==="texture"||e.type==="video"||e.type==="matcap"?{...e.data,updateTexture:t=>e.color.texture.image.updateSrc(t)}:{...e.data}}em(),Zn(),jY(),Su();var _M=new kr(0,0,0,1),$Ge={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:[]};zt(),zt();var XGe=new Z;function u1e(e){let t=new kr(0,0,0,1);try{t.setStyle(e)}catch(i){console.error(i)}return t}var mPe=class{constructor(e,{renderOnDemand:t,renderMode:i="auto",wasmPath:r,renderer:n,htmlContentMode:s="sandbox"}={}){if(this._rendererBackend="webgl",this._rendererAuto=!1,this._rendererConfigured=!1,this._startOrder=0,this._claimedOrder=0,this._viewportMode=1,this._viewportWidth=window.innerWidth,this._viewportHeight=window.innerHeight,this._proxyObjectCache=new Map,this._htmlContentMode="sandbox",this._variablesCache=new Map,this._isPaused=!1,this._renderRequested=!1,this._skipRender=!1,this.time=performance.now(),this.dt=0,this.currentTAAFrame=0,this.disposed=!1,this._requestRenderAutoMode=()=>{this._skipRender=!1},this.requestRender=()=>{this._renderRequested=!0},this.render=a=>{if(this.time=a,this._lastTime&&(this.dt=this.time-this._lastTime),this._lastTime=this.time,this._perfs?.start(),this._renderer)if(this._isPaused||!(this.renderMode==="manual"&&!this._renderRequested||this.renderMode==="auto"&&this._skipRender)){if(this._renderRequested=!1,this._skipRender=!0,this._controls&&(this._skipRender=this._controls.update(this.dt)??!1),this._eventManager&&(this._eventManager.handlers?.Start?.hasVideoAction||this._eventManager.handlers?.Basic?.hasVideoAction||this._eventManager.handlers?.Conditional?.hasVideoAction)&&(this._skipRender=!1),this._animationControls?.update(this.dt),this._skipRender?(this.currentTAAFrame++,this.currentTAAFrame<gxe?this._skipRender=!1:this.currentTAAFrame=0):this.currentTAAFrame=0,this._scene?.traverseVisibleEntity(o=>{o.type==="ParticleSystem"&&(o.update(this.dt),this._skipRender=!1),s1(o)&&(this._renderer?.isWebGPUSplineRenderer!==!0&&o.warnClassicFallbackOnce(),o.isSimulating&&(o.update(this.dt),this._skipRender=!1))}),this._scene&&this._scene.activeCamera!==this._camera&&(this._camera=this._scene.activeCamera),this._eventManager?.isEnabled&&(this._eventManager.handlers?.Follow?.onAnimationFrameDamping(),this._eventManager.handlers?.LookAt?.onAnimationFrameDamping(),this._eventManager.handlers?.DragDrop?.onAnimationFrameDamping()),this._scene&&this._camera){if(this._scene.pathConstraints.applyConstraints(this._scene),this._renderer.sceneTransitionTimeRemaining>0){this._renderer.sceneTransitionTimeRemaining-=this.dt;let o=Math.min(1,1-this._renderer.sceneTransitionTimeRemaining/this._renderer.sceneTransitionDuration);this._renderer.pipeline.sceneTransitionPass.uniforms.mixRatio.value=o,this._skipRender=!1}else this._renderer.pipeline.sceneTransitionFromTexture=null;this._renderer.renderSplineScene(this._scene,this._camera),this._renderer.lastFrameIncomplete===!0&&(this._skipRender=!1),this._renderer.skyAnimationActive===!0&&(this._skipRender=!1)}this.canvas.dispatchEvent(this._renderedEvent),this._perfs?.end()}else this._perfs?.end();else this._perfs?.end()},this._resize=a=>{if(this._renderer){if(this._viewportMode===1&&this._frameView&&(this._frameView.frameSize=XGe.set(this._viewportWidth,this._viewportHeight)),a){let o=this._viewportWidth,l=this._viewportHeight;this._renderer.setSize(o-1,l-1,!1),this._renderer.setSize(o,l,!1)}else this._renderer.setSize(this._viewportWidth,this._viewportHeight,!1);this._camera=this._scene?.activeCamera,this._scene?.updateViewPlaneSize(this._frameView?.frameSize?.x??this._viewportWidth,this._frameView?.frameSize?.y??this._viewportHeight,this._frameView?.enableResponsive??!1),this._camera&&(this._frameView?.setCamera(this._camera),this._frameView?.updateCamera(),this._camera.cameraType==="PerspectiveCamera"&&(this._camera.aspect=this._viewportWidth/this._viewportHeight),this._camera.updateProjectionMatrix()),this.eventManager&&(this.eventManager.eventContext.domRect=this.canvas.getBoundingClientRect()),this._requestRenderAutoMode()}},this._debouncedResize=TA(this._resize,10),this._onScroll=a=>{this.eventManager&&(this.eventManager.eventContext.domRect=this.canvas.getBoundingClientRect())},this.canvas=e,this._htmlContentMode=s,this.renderMode=t?"auto":i,r!==void 0&&(this._wasmPath=function(a){let o=a.length;for(;o>0&&"/".includes(a[o-1]);)o--;return a.slice(0,o)}(r)),this._rendererBackend=n??"webgl",n===void 0){let a=null;try{a=new URLSearchParams(window.location.search).get("renderer")}catch{}a==="webgpu"||a==="webgl"||a==="webgl2"?this._rendererBackend=a==="webgl2"?"webgl":a:(this._rendererAuto=!0,this._rendererBackend=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(()=>(lUe(),z2e)).then(({Perfs:a})=>{this._perfs=new a({x:10,y:10})}),function(a){a.addEventListener("pointerdown",Cee,!0),a.addEventListener("pointerdown",f3,!0),a.addEventListener("pointermove",f3,!0),a.addEventListener("pointerup",W1,!0),a.addEventListener("pointercancel",W1,!0),a.addEventListener("pointerleave",W1,!0),window.addEventListener("keydown",Pee,!0),window.addEventListener("keyup",Ree,!0)}(e)}async _ensureRenderer(){return this._renderer?this._renderer:(this._rendererInit||(this._rendererInit=this._initRenderer().then(e=>(this._rendererInit=void 0,e&&(this._renderer=e),e),e=>{throw this._rendererInit=void 0,e})),this._rendererInit)}async _initRenderer(){if(this.disposed)return null;let e=await this._createRenderer();return this.disposed?(this._disposeRenderer(e),null):e}_disposeRenderer(e){let t=function(r){let n=r.backend;if(n!==void 0)return n.isWebGLBackend===!0?n.gl??null:null;let s=r.getContext,a=typeof s=="function"?s.call(r):null;return a&&typeof a.getExtension=="function"?a:null}(e);if(t&&!function(r,n){return n1e.get(r)===n}(this.canvas,this))return void(function(r){return r.backend?.isWebGLBackend===!0}(e)||e.dispose());let i=t?function(r,n){let s=n.getExtension("WEBGL_lose_context");if(!s||n.isContextLost())return()=>{};let a=()=>{},o=new Promise(l=>{a=s1e(r,"webglcontextlost",h=>{h.preventDefault(),l(s)})});return _I.set(r,{gl:n,lost:o,stopListening:a}),()=>{n.isContextLost()||s.loseContext()}}(this.canvas,t):void 0;try{e.dispose()}finally{i?.()}}async _createRenderer(){if(function(e,t){n1e.set(e,t)}(this.canvas,this),await async function(e){let t=_I.get(e);if(t&&(t.restoring??(t.restoring=async function(i,r){if(!r.gl.isContextLost())return void r.stopListening();let n,s=()=>{},a=r.lost.then(l=>new Promise(h=>{s=s1e(i,"webglcontextrestored",()=>h()),l.restoreContext()})),o=new Promise(l=>{n=setTimeout(l,2e3)});await Promise.race([a,o]),clearTimeout(n),s(),r.stopListening()}(e,t).finally(()=>{t.restoring=void 0,!t.gl.isContextLost()&&_I.get(e)===t&&_I.delete(e)})),await t.restoring,t.gl.isContextLost()))throw new Error("[spline] The browser did not restore the WebGL context this canvas had before dispose(); the scene cannot render on it. Use a new canvas.")}(this.canvas),this._rendererBackend==="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(()=>(M9(),zO));t();let i=!0,r=!1;try{let s=new URLSearchParams(window.location.search),a=s.get("bundles");a==="rerecord"?i="rerecord":(a==="off"||a==="0"||a==="false"||a==="no")&&(i=!1),r=s.get("forcegl")==="1"}catch{}let n=await e({canvas:this.canvas,antialias:!1,alpha:!0,powerPreference:"high-performance",sceneBundles:!r&&i,forceWebGL:r,asyncCompilation:this._asyncShaderCompilation()});return n.onBackgroundWorkReady=()=>{this._skipRender=!1,this._renderRequested=!0},n.skyAnimationAllowed=!0,n}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(()=>(Q0e(),oX));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"})}}_asyncShaderCompilation(){let e=this._data?.scene.publish?.asyncShaderCompilation!==!1;try{let t=new URLSearchParams(window.location.search);if(t.get("forcegl")==="1")return!1;let i=t.get("asynccomp");i==="off"||i==="0"||i==="false"||i==="no"?e=!1:(i==="on"||i==="1"||i==="true"||i==="always")&&(e=!0)}catch{}return e}_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 s="The Spline Runtime only accepts .splinecode files that are generated from Spline export panel.";n.endsWith(".spline")?console.warn(s+" The .spline files are only meant to be used by the Editor."):n.endsWith(".splinecode")||console.warn(s)})(e),this.disposed=!1;let r=await(await fetch(e,i)).arrayBuffer();await this.start(r,{variables:t})}async start(e,t={}){if(this.disposed)return;let i,r=++this._startOrder,n=()=>this._claimedOrder>r;return i=this._start(e,t,n,()=>!n()&&(this._claimedOrder=r,this._claimedStart=i,!0)).then(()=>n()?this._claimedStart:void 0,s=>{if(!n())throw s;return this._claimedStart}),i}async _start(e,{interactive:t=!0,variables:i},r,n){zs.init();let s=await async function(m){let[g,v]=IM(MA.deserialize(new Uint8Array(m)));if((g.schema??0)!==135){let{updateDocumentSchema:y}=await Promise.resolve().then(()=>(_B(),ixe));y(g)}return v.result().data}(e);if(r())return;let a=function(m){let g=[];return m.scene.objects.traverse((v,y)=>{y.type==="Mesh"&&y.geometry.type==="NonParametricGeometry"&&y.geometry.data.draco!==void 0&&g.push(y)}),g}(s);s.version&&(0,NGe.default)(s.version,"2.0.123")>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(m){YSe=m}(this._wasmPath));let o=async function(){}();if(await Promise.all([o,a.length&&i1e(this._wasmPath),Ure(s)&&tBe(this._wasmPath),wBe(s)&&xBe(this._wasmPath),$Be(s)&&PBe(this._wasmPath),n1.physicsEnabled(s.scene.objects)&&GVe(this._wasmPath),zie(s)&&Fve(),lne(s)&&gFe(),uBe(s)&&hBe(),Pve(s)&&o.then(()=>gH()?.loadHanaUIRUNTIME()),LVe(s)&&s6e(this._wasmPath)].filter(Boolean)),r()||a.length&&(await r1e(a),r())||!n())return;this._data=s,this._eventManager?.deactivate(),this._controls?.deactivate(),this._scene?.dispose();let l=s.scene.publish.renderer;if(this._rendererAuto&&l==="webgl")this._rendererBackend="webgl";else if(this._rendererAuto&&l==="webgpu"){let m=this._rendererBackend==="webgpu"&&await navigator.gpu?.requestAdapter().catch(()=>null);if(r())return;if(!m)return void this._failWebGPURequired();this._rendererAuto=!1}let h=function(m){let g=new Set;return m.scene.objects.traverse((v,y)=>{if(y.type!=="Page")return;let _=y.postprocessing;if(_&&typeof _=="object"&&_.enabled===!0)for(let[b,x]of Object.entries(_))b!=="enabled"&&x&&typeof x=="object"&&x.enabled===!0&&g.add(b)}),[...g]}(s);if(this._rendererBackend==="webgpu")try{await Promise.all([Promise.resolve().then(()=>(M9(),zO)),DGe(h)]);let m=await this._ensureRenderer();if(r()||!m)return}catch(m){console.error("[spline] Failed to load the WebGPU material backend, using WebGL:",m),this._rendererBackend="webgl"}if(this._rendererBackend!=="webgpu"&&(await Promise.all([Promise.resolve().then(()=>(Q0e(),oX)),RGe(h)]),r()))return;(function(m){nC=m})(this._rendererBackend==="webgpu"?"webgpu":"webgl");let u=new EGe(s,{},!0,{dedupeParametricGeometries:!0});if(u.resetPersonalCameraFromDocumentData(),this._scene=u.scene,this._sharedAssetsManager=u.sharedAssets,this._camera=this._scene.activeCamera,window.location.search.includes("merge-geometries")){let{mergeStaticGeometries:m}=await Promise.resolve().then(()=>(bke(),ZCe));if(r())return;let g=performance.now();m(s,u.scene);let v=performance.now();console.log("Merged geometries in ",v-g," ms")}Ure(s)&&this._scene.traverse(m=>{zc(m)&&m.recomputeBoolean()}),this._sharedAssetsManager.setRequestRender(()=>{this._requestRenderAutoMode(),this._scene?.traverse(m=>{Lg(m)&&m.pendingMediaLoad&&m.update({scene:this._scene,shared:this._sharedAssetsManager})})}),this._scene?.traverse(m=>{m.type==="ParticleSystem"&&(m.wakeUp(),m.data.autoPlay?m.start():m.stop()),s1(m)&&m.setPlayMode(!0)});let d=Object.keys(s.shared.fonts).flatMap(m=>{let g=this._sharedAssetsManager.getFont(m);return g?[g.loadingPromise]:[]});if(Promise.all(d).then(()=>{this.disposed||(u.scene.markNeedsUpdateRendererDirty(),this._requestRenderAutoMode())}),zie(s)&&function(m){if(n1.physicsEnabled(m.scene.objects))return!0;let g=!1;return m.scene.objects.traverse((v,y)=>{if(y.events){if(Array.isArray(y.events)){for(let _ of y.events)if(_.data.disabled!==!0&&_.data.type==="GameControl"&&_.data.collisionEnabled){g=!0;break}}else for(let _ of Object.values(y.events))if(_.disabled!==!0&&_.type==="GameControl"&&_.collisionEnabled){g=!0;break}}}),g}(s)&&(await Promise.all(d),r()))return;if(Pve(s)){let m=[];if(this._scene.traverseEntity(g=>{($o(g)||g instanceof Dn)&&g.uiCanvas&&m.push(g.uiCanvas)}),await Promise.all(m.map(g=>g.promise)),r())return}this._scene.rewriteEventsBeforeGoToPlayMode(),IZ(this._scene.activePage,this._sharedAssetsManager);let c=await this._ensureRenderer();if(r()||!c)return;if(this._rendererConfigured||(this._rendererConfigured=!0,c.pipeline.enableUIOverlay(),c.pipeline.addEventListener("smaaloaded",this._requestRenderAutoMode)),c.hdTransmission=s.scene.publish.hdTransmission===!0,c.setPixelRatio(this._getPixelRatio(/Mobi|Android|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)?s.scene.publish.settings.web.pixelRatioMobile:s.scene.publish.settings.web.pixelRatioDesktop)),c.setAsyncCompilationPolicy?.(this._asyncShaderCompilation()),s.shared.images.SplineWatermark){let m=this._sharedAssetsManager.getImage("SplineWatermark");if(await m.loadPromise,r())return;let g=m.getTexture(1001);c.pipeline.setWatermark(g)}else c.pipeline.setWatermark(null);lne(s)&&this._scene.initializeSplatViewer(),s.scene.blueNoiseTextureData!==void 0&&c.pipeline.updateBlueNoiseTexture(s.scene.blueNoiseTextureData);let p=Object.values(s.frames)[0];if(this._frameView?this._frameView.setCamera(this._camera):(p.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=p.size[0],this._viewportHeight=p.size[1],this.canvas.style.width=`${this._viewportWidth}px`,this.canvas.style.height=`${this._viewportHeight}px`),c.setSize(this._viewportWidth,this._viewportHeight,!1),this._frameView=new tVe(c,this._camera,new Z(this._viewportWidth,this._viewportHeight)),this._frameView.enableResponsive=(p.allowResponsive??!1)&&p.preset==="fullscreen"),t){let m=new Oke(c,this.data.scene.publish,this._scene,()=>this._scene.activeCamera,this._sharedAssetsManager,this._requestRenderAutoMode,!0,p);this._scene.updateMatrixWorld(!0),this._controls=new $Ve(m),this._animationControls=new vGe(this._scene,this._requestRenderAutoMode),this._eventManager=new Yke(s.scene.publish,this._controls,this._animationControls,m,s.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),t&&(this._htmlContentOverlay?.dispose(),this._htmlContentOverlay=void 0);let f=s.scene.publish.htmlContent?.html;if(t&&f&&this._htmlContentMode!=="none"){let m={shared:this._sharedAssetsManager,findEntity:g=>this._scene?.getObjectByProperty("uuid",g)??this._scene?.getObjectByName(g),getAnimationControls:()=>this._animationControls};this._htmlContentOverlay=(this._htmlContentMode==="inline"?uPe.mount(this,this.canvas,f,m):hPe.mount(this,this.canvas,f,m))??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)){if(t==null)return void console.warn(`Variable ${e} was not updated: received ${t}. Pass a number, boolean or string.`);let r=t;if(typeof i.data.value=="number"){if(r=typeof t=="number"?t:typeof t=="boolean"?t===!0?1:0:parseFloat(t),!Number.isFinite(r))return void console.warn(`Variable ${e} is a number variable and ${JSON.stringify(t)} cannot be converted to a number. The variable was not updated.`)}else 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"&&Mo.isTextValue(e)?Mo.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===d1||this._scene.isInvisibleObjects(t)||t instanceof Dn)){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 p3e&&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=u1e(e);this._scene?.activePage.setBackgroundColor(t),this._requestRenderAutoMode()}dispose(){this.disposed=!0,this._claimedOrder=++this._startOrder,this._claimedStart=void 0,this._htmlContentOverlay?.dispose(),this._htmlContentOverlay=void 0,this._eventManager?.dispose(),this._scene?.dispose(),this._scene=void 0,this._camera=void 0,UE&&UE.disposeAll(),this._sharedAssetsManager?.setRequestRender(()=>{}),this._sharedAssetsManager?.dispose(),this._sharedAssetsManager=void 0,this._proxyObjectCache.forEach(e=>{G9.unsubscribe(e)}),this._proxyObjectCache.clear(),this._variablesCache.clear(),this._renderer?.pipeline.removeEventListener("smaaloaded",this._requestRenderAutoMode),this._renderer?.setAnimationLoop(null),this._renderer&&this._disposeRenderer(this._renderer),this._renderer=void 0,this._rendererConfigured=!1,this._debouncedResize.cancel(),this._resizeObserver&&(this._resizeObserver.disconnect(),this._resizeObserver=void 0),this._resizeObserverTimeout!==void 0&&(clearTimeout(this._resizeObserverTimeout),this._resizeObserverTimeout=void 0),this.canvas.style.width="",this.canvas.style.height="",this.canvas.removeAttribute("width"),this.canvas.removeAttribute("height"),this._frameView=void 0,this._controls?.deactivate(),this._controls=void 0,this._animationControls=void 0,this._eventManager?.eventContext.dispose(),this._eventManager=void 0,this._splatViewer=void 0,this._data=void 0,this._perfs=void 0,this.dt=0,this._lastTime=void 0,function(e){e.removeEventListener("pointerdown",Cee,!0),e.removeEventListener("pointerdown",f3,!0),e.removeEventListener("pointermove",f3,!0),e.removeEventListener("pointerup",W1,!0),e.removeEventListener("pointercancel",W1,!0),e.removeEventListener("pointerleave",W1,!0),window.removeEventListener("keydown",Pee,!0),window.removeEventListener("keyup",Ree,!0)}(this.canvas),document.removeEventListener("scroll",this._onScroll),zs.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 Dn&&(t=u.name)});let r=this._sharedAssetsManager,n={shared:r,scene:this._scene},s=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}},a="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??(a?HGe(a):void 0),parentUuid:e.parent instanceof Dn||e instanceof zg?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"?s(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=aPe;if(d===null)return Ta("transitions","obj.transition()"),{transition(b){return this},play(){return this},pause(){return this},reset(){return this},seek(b){return this}};let c,p,f=this,m=[],g=!1,v=()=>{p=new W3e({delay:0,delayDirection:"start-once",direction:"normal",repeat:0,runMode:"Repeat"},m.map(b=>b.runner))},y={update(b){p?.update(b),p?.isPlaying!==!0&&zs.remove(y)}},_={transition({from:b,to:x,duration:w,delay:S,...T}){let M=s(b);M===void 0&&(M=c);let E=s(x);return c=E,m.push(new d(e,M,E,{state:E,repeat:0,delay:S??0,delayDirection:"start-once",direction:"normal",duration:w??1e3,...T,...T.easing===6?Ng.defaultData:T.easing===5?nw.defaultData:{}},r,!1,i.activePage,{onBegin:()=>{(b&&M||b==="Base State"&&!M)&&(f.state=M??void 0)},onComplete:()=>{f.state=E??void 0}})),v(),this},play(){return p?(g=!0,p.play(zs.time),p.isPlaying&&zs.add(y),this):this},pause(){return p?.stop(),zs.remove(y),this},reset(){return this.pause(),g=!1,v(),p?.seek(0),this},seek(b){let x=m.reduce((w,S)=>w+S.runner.duration,0);return x>0&&p?.seek(b/1e3/x),this}};return _.transition(u),(u.autoPlay??!0)&&queueMicrotask(()=>{g||_.play()}),_},set color(u){let d=u1e(u);if(l4.is(e))return void(e.color=d);if(!(e.type==="Mesh"&&"material"in e&&e instanceof xl))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 f=Array.isArray(e.material)?e.material[0]:e.material,m=f.data.layers.find(g=>g.data.type==="color")?.id;if(m)f.updateByOp({type:0,path:["layers",m],props:{color:{...c}}},f.data,n);else{let g=f.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:et.generateUUID(),data:{...rs.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(f.data,{layers:w}),f.updateByOp({...b,path:["layers"]},f.data,n)}}},h=G9(l,(u,d)=>{let c=e[u],p=function(f){return f.split(".")}(u);p[0]==="material"&&a&&o===void 0&&function(f,m,g){let v=Array.isArray(g)?g[0]:g;if(f[0]==="layers"){let y=parseInt(f[1]),_=v.layers[y],b=f[2];_&&b&&function(x,w,S){let T=x[0];try{if(function(M,E){return!!$Ge[E]?.includes(M)}(T,S.type,x.slice(1)))if(T==="colors"){if(x.length<2)throw new Error("You cannot mutate the colors array, only its items");let M=parseInt(x[1]),E=S.getValue(T)?.[M];if(!E)throw new Error("Color index out of range");_M.setStyle(w),E.set(_M.r,_M.g,_M.b,_M.a)}else S.getValue(T)?.setStyle(w);else if(T==="texture"||T==="video"){let M=S.color;(function(E,A,P,N){let D=E[0];if(D==="repeat"||D==="offset"||D==="rotation"){let O=N.getNode("mat"),z=O&&typeof O.updateMatrix=="function"?O:N.getValue("mat");if(!z)return;if(D==="rotation")z.rotation=parseFloat(A);else{let B=E[1];if(B===void 0)A instanceof Array&&A.length===2&&Object.assign(z,{[D]:A});else{let V=z[D],j=parseInt(B)===0?[parseFloat(A),V[1]]:[V[0],parseFloat(A)];Object.assign(z,{[D]:j})}}z.updateMatrix()}else D==="wrapping"||D==="minFilter"||D==="magFilter"?D==="wrapping"?P.texture.wrap=A:P.texture[D]=A:D==="image"&&E[1]==="data"&&P.texture.image.updateSrc(A)})(x.slice(1),w,M,S)}else{let M=x[1],E=S.getValue(T);E?.isVector3&&M!==void 0||E?.isVector2&&M!==void 0?E.setComponent(parseInt(M),w):S.setValue(T,w)}}catch(M){console.error("Error setting material value",M)}}(f.slice(2),m,_)}else f[0]==="alpha"&&v.layers.forEach(y=>{y.type==="light"&&y.node.alphaOverride!==void 0&&(y.node.alphaOverride.value=m,m<1&&(v.transparent=!0))})}(p.slice(1),d,a),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){KL=t,wB?.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=MA.deserialize(i),n="data"in r&&r.data.draco!==void 0;n&&await i1e(this._wasmPath);let s=this._scene?.getObjectByProperty("uuid",e)??this._scene?.getObjectByName(e);if(!s)return void console.warn(`Object ${e} not found`);if(s.data.type!=="Mesh"||!(s instanceof xl))return void console.warn(`Object ${e} is not a mesh`);let a=s,o={...a.data,geometry:r};n&&await r1e([o]),a.updateByOp({type:0,path:[],props:{geometry:o.geometry}},o,{shared:this._sharedAssetsManager,scene:this._scene},!1);for(let l of a.data.states){let h={...l.data};a.states||(a.states={}),a.states[l.id]=Og.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=HH();if(t===void 0&&(this._rendererBackend==="webgpu"&&(await Promise.resolve().then(()=>(M9(),zO)),t=HH()),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 xl))throw new Error(`setMaterial: '${r}' is not a mesh \u2014 lights, groups, and cameras have no material.`);let s=typeof t=="function"?await this.createCustomMaterial(t):t;if(s4()!=="webgpu")throw new Error("setMaterial: custom three.js materials require the webgpu backend (the runtime default where WebGPU is available). This scene is running the classic WebGL pipeline \u2014 pass { renderer: 'webgpu' } or drop any ?renderer=webgl2 override.");let a=a1e({material:s});if(a.material===void 0)throw new Error("setMaterial: expected a three.js material instance or a (three) => material factory.");return n.setMaterialOverride(a.material,{scene:i,shared:this._sharedAssetsManager}),this._proxyObjectCache.delete(n.uuid),this._requestRenderAutoMode(),a.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 ${o1e}.`);let v=g.replace(/Geometry$/i,"").replace(/[\s_-]/g,"").toLowerCase(),y=FGe[v];if(y)return{objectType:y};let _=BGe[v];if(_)return{objectType:"Mesh",geometryType:_};let b=UGe[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 ${o1e}, e.g. createObject('Cube', { width: 200 }).`)}(e);typeof t.material=="function"&&(t={...t,material:await this.createCustomMaterial(t.material)});let s,a,{options:o,material:l}=a1e(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(s4()!=="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(!LY.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 Fve(),a=t.font??Ib,r.shared.fonts[a]===void 0){if(a!==Ib){let g=Object.keys(r.shared.fonts).join(", ");throw new Error(`createObject: font '${a}' is not in this document \u2014 available fonts: ${g||"(none)"}.`)}s={name:Ib,url:dbe}}}let h=this._resolveParentId(t.parent),u=jGe(n,o,r),d=et.generateUUID(),[c,p]=IM(r);s&&(c.shared.fonts[Ib]=s),c.scene.objects.insertAfter(h,null,[{id:d,data:u,children:[]}]);let f=p.result();if(s&&this._sharedAssetsManager.addFont(Ib,s),a!==void 0){let g=this._sharedAssetsManager.getFont(a);g&&await g.loadingPromise}this._applyDocumentTransaction(f);let m=i.find(d);return l!==void 0&&m.setMaterialOverride(l,{scene:i,shared:this._sharedAssetsManager}),this._requestRenderAutoMode(),this._createProxyObject(m)}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,s=n?this._findEntity(n):void 0;if(!s)throw new Error(`cloneObject: '${n}' \u2014 no object with that name or uuid in the scene.`);if(s instanceof Dn)throw new Error("cloneObject: pages cannot be cloned.");let a=r.scene.objects.get(s.uuid);if(!a)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,f,m){let g={...p.data};return f.position!==void 0&&(g.position=XA(f.position,[0,0,0])),f.rotation!==void 0&&(g.rotation=XA(f.rotation,[0,0,0])),f.scale!==void 0&&(g.scale=cPe(f.scale)),f.visible!==void 0&&(g.visible=f.visible),g.name=f.name??pPe(`${p.data.name??"Object"} Copy`,m),{...p,data:g}}(WGe(a),t,r.scene.objects),l=t.parent!==void 0?this._resolveParentId(t.parent):r.scene.objects.parent(s.uuid)??null,h=t.parent!==void 0?null:s.uuid,[u,d]=IM(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 Dn)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 s=[];n.traverseEntity(l=>{s.push(l.uuid)});let[a,o]=IM(i);a.scene.objects.delete(n.uuid),this._applyDocumentTransaction(o.result());for(let l of s){let h=this._proxyObjectCache.get(l);h&&(G9.unsubscribe(h),this._proxyObjectCache.delete(l))}return this._requestRenderAutoMode(),!0}};var uF=window,dF=uF.ShadowRoot&&(uF.ShadyCSS===void 0||uF.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,OZ=Symbol(),gPe=new WeakMap,mC=class{constructor(t,i,r){if(this._$cssResult$=!0,r!==OZ)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(dF&&t===void 0){let r=i!==void 0&&i.length===1;r&&(t=gPe.get(i)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),r&&gPe.set(i,t))}return t}toString(){return this.cssText}},vPe=e=>new mC(typeof e=="string"?e:e+"",void 0,OZ),LZ=(e,...t)=>{let i=e.length===1?e[0]:t.reduce((r,n,s)=>r+(a=>{if(a._$cssResult$===!0)return a.cssText;if(typeof a=="number")return a;throw Error("Value passed to 'css' function must be a 'css' function result: "+a+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(n)+e[s+1],e[0]);return new mC(i,e,OZ)},BZ=(e,t)=>{dF?e.adoptedStyleSheets=t.map(i=>i instanceof CSSStyleSheet?i:i.styleSheet):t.forEach(i=>{let r=document.createElement("style"),n=uF.litNonce;n!==void 0&&r.setAttribute("nonce",n),r.textContent=i.cssText,e.appendChild(r)})},cF=dF?e=>e:e=>e instanceof CSSStyleSheet?(t=>{let i="";for(let r of t.cssRules)i+=r.cssText;return vPe(i)})(e):e;var FZ,pF=window,yPe=pF.trustedTypes,YGe=yPe?yPe.emptyScript:"",_Pe=pF.reactiveElementPolyfillSupport,zZ={toAttribute(e,t){switch(t){case Boolean:e=e?YGe: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}},bPe=(e,t)=>t!==e&&(t==t||e==e),UZ={attribute:!0,type:String,converter:zZ,reflect:!1,hasChanged:bPe},kZ="finalized",im=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=UZ){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 s=this[t];this[i]=n,this.requestUpdate(t,s,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)||UZ}static finalize(){if(this.hasOwnProperty(kZ))return!1;this[kZ]=!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(cF(n))}else t!==void 0&&i.push(cF(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 BZ(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=UZ){var n;let s=this.constructor._$Ep(t,r);if(s!==void 0&&r.reflect===!0){let a=(((n=r.converter)===null||n===void 0?void 0:n.toAttribute)!==void 0?r.converter:zZ).toAttribute(i,r.type);this._$El=t,a==null?this.removeAttribute(s):this.setAttribute(s,a),this._$El=null}}_$AK(t,i){var r;let n=this.constructor,s=n._$Ev.get(t);if(s!==void 0&&this._$El!==s){let a=n.getPropertyOptions(s),o=typeof a.converter=="function"?{fromAttribute:a.converter}:((r=a.converter)===null||r===void 0?void 0:r.fromAttribute)!==void 0?a.converter:zZ;this._$El=s,this[s]=o.fromAttribute(i,a.type),this._$El=null}}requestUpdate(t,i,r){let n=!0;t!==void 0&&(((r=r||this.constructor.getPropertyOptions(t)).hasChanged||bPe)(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,s)=>this[s]=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 s;return(s=n.hostUpdate)===null||s===void 0?void 0:s.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){}};im[kZ]=!0,im.elementProperties=new Map,im.elementStyles=[],im.shadowRootOptions={mode:"open"},_Pe?.({ReactiveElement:im}),((FZ=pF.reactiveElementVersions)!==null&&FZ!==void 0?FZ:pF.reactiveElementVersions=[]).push("1.6.3");var VZ,fF=window,Vw=fF.trustedTypes,xPe=Vw?Vw.createPolicy("lit-html",{createHTML:e=>e}):void 0,jZ="$lit$",u0=`lit$${(Math.random()+"").slice(9)}$`,CPe="?"+u0,KGe=`<${CPe}>`,_1=document,vC=()=>_1.createComment(""),yC=e=>e===null||typeof e!="object"&&typeof e!="function",PPe=Array.isArray,ZGe=e=>PPe(e)||typeof e?.[Symbol.iterator]=="function",GZ=`[
|
|
13017
13017
|
\f\r]`,gC=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,wPe=/-->/g,SPe=/>/g,v1=RegExp(`>|${GZ}(?:([^\\s"'>=/]+)(${GZ}*=${GZ}*(?:[^
|
|
13018
13018
|
\f\r"'\`<>=]|("|')|))|$)`,"g"),TPe=/'/g,MPe=/"/g,RPe=/^(?:script|style|textarea|title)$/i,DPe=e=>(t,...i)=>({_$litType$:e,strings:t,values:i}),NPe=DPe(1),ant=DPe(2),b1=Symbol.for("lit-noChange"),io=Symbol.for("lit-nothing"),EPe=new WeakMap,y1=_1.createTreeWalker(_1,129,null,!1);function IPe(e,t){if(!Array.isArray(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return xPe!==void 0?xPe.createHTML(t):t}var QGe=(e,t)=>{let i=e.length-1,r=[],n,s=t===2?"<svg>":"",a=gC;for(let o=0;o<i;o++){let l=e[o],h,u,d=-1,c=0;for(;c<l.length&&(a.lastIndex=c,u=a.exec(l),u!==null);)c=a.lastIndex,a===gC?u[1]==="!--"?a=wPe:u[1]!==void 0?a=SPe:u[2]!==void 0?(RPe.test(u[2])&&(n=RegExp("</"+u[2],"g")),a=v1):u[3]!==void 0&&(a=v1):a===v1?u[0]===">"?(a=n??gC,d=-1):u[1]===void 0?d=-2:(d=a.lastIndex-u[2].length,h=u[1],a=u[3]===void 0?v1:u[3]==='"'?MPe:TPe):a===MPe||a===TPe?a=v1:a===wPe||a===SPe?a=gC:(a=v1,n=void 0);let p=a===v1&&e[o+1].startsWith("/>")?" ":"";s+=a===gC?l+KGe:d>=0?(r.push(h),l.slice(0,d)+jZ+l.slice(d)+u0+p):l+u0+(d===-2?(r.push(void 0),o):p)}return[IPe(e,s+(e[i]||"<?>")+(t===2?"</svg>":"")),r]},x1=class{constructor({strings:t,_$litType$:i},r){let n;this.parts=[];let s=0,a=0,o=t.length-1,l=this.parts,[h,u]=QGe(t,i);if(this.el=x1.createElement(h,r),y1.currentNode=this.el.content,i===2){let d=this.el.content,c=d.firstChild;c.remove(),d.append(...c.childNodes)}for(;(n=y1.nextNode())!==null&&l.length<o;){if(n.nodeType===1){if(n.hasAttributes()){let d=[];for(let c of n.getAttributeNames())if(c.endsWith(jZ)||c.startsWith(u0)){let p=u[a++];if(d.push(c),p!==void 0){let f=n.getAttribute(p.toLowerCase()+jZ).split(u0),m=/([.?@])?(.*)/.exec(p);l.push({type:1,index:s,name:m[2],strings:f,ctor:m[1]==="."?HZ:m[1]==="?"?qZ:m[1]==="@"?$Z:jw})}else l.push({type:6,index:s})}for(let c of d)n.removeAttribute(c)}if(RPe.test(n.tagName)){let d=n.textContent.split(u0),c=d.length-1;if(c>0){n.textContent=Vw?Vw.emptyScript:"";for(let p=0;p<c;p++)n.append(d[p],vC()),y1.nextNode(),l.push({type:2,index:++s});n.append(d[c],vC())}}}else if(n.nodeType===8)if(n.data===CPe)l.push({type:2,index:s});else{let d=-1;for(;(d=n.data.indexOf(u0,d+1))!==-1;)l.push({type:7,index:s}),d+=u0.length-1}s++}}static createElement(t,i){let r=_1.createElement("template");return r.innerHTML=t,r}};function Gw(e,t,i=e,r){var n,s,a,o;if(t===b1)return t;let l=r!==void 0?(n=i._$Co)===null||n===void 0?void 0:n[r]:i._$Cl,h=yC(t)?void 0:t._$litDirective$;return l?.constructor!==h&&((s=l?._$AO)===null||s===void 0||s.call(l,!1),h===void 0?l=void 0:(l=new h(e),l._$AT(e,i,r)),r!==void 0?((a=(o=i)._$Co)!==null&&a!==void 0?a:o._$Co=[])[r]=l:i._$Cl=l),l!==void 0&&(t=Gw(e,l._$AS(e,t.values),l,r)),t}var WZ=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,s=((i=t?.creationScope)!==null&&i!==void 0?i:_1).importNode(r,!0);y1.currentNode=s;let a=y1.nextNode(),o=0,l=0,h=n[0];for(;h!==void 0;){if(o===h.index){let u;h.type===2?u=new w1(a,a.nextSibling,this,t):h.type===1?u=new h.ctor(a,h.name,h.strings,this,t):h.type===6&&(u=new XZ(a,this,t)),this._$AV.push(u),h=n[++l]}o!==h?.index&&(a=y1.nextNode(),o++)}return y1.currentNode=_1,s}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++}},w1=class{constructor(t,i,r,n){var s;this.type=2,this._$AH=io,this._$AN=void 0,this._$AA=t,this._$AB=i,this._$AM=r,this.options=n,this._$Cp=(s=n?.isConnected)===null||s===void 0||s}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=Gw(this,t,i),yC(t)?t===io||t==null||t===""?(this._$AH!==io&&this._$AR(),this._$AH=io):t!==this._$AH&&t!==b1&&this._(t):t._$litType$!==void 0?this.g(t):t.nodeType!==void 0?this.$(t):ZGe(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!==io&&yC(this._$AH)?this._$AA.nextSibling.data=t:this.$(_1.createTextNode(t)),this._$AH=t}g(t){var i;let{values:r,_$litType$:n}=t,s=typeof n=="number"?this._$AC(t):(n.el===void 0&&(n.el=x1.createElement(IPe(n.h,n.h[0]),this.options)),n);if(((i=this._$AH)===null||i===void 0?void 0:i._$AD)===s)this._$AH.v(r);else{let a=new WZ(s,this),o=a.u(this.options);a.v(r),this.$(o),this._$AH=a}}_$AC(t){let i=EPe.get(t.strings);return i===void 0&&EPe.set(t.strings,i=new x1(t)),i}T(t){PPe(this._$AH)||(this._$AH=[],this._$AR());let i=this._$AH,r,n=0;for(let s of t)n===i.length?i.push(r=new w1(this.k(vC()),this.k(vC()),this,this.options)):r=i[n],r._$AI(s),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))}},jw=class{constructor(t,i,r,n,s){this.type=1,this._$AH=io,this._$AN=void 0,this.element=t,this.name=i,this._$AM=n,this.options=s,r.length>2||r[0]!==""||r[1]!==""?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=io}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(t,i=this,r,n){let s=this.strings,a=!1;if(s===void 0)t=Gw(this,t,i,0),a=!yC(t)||t!==this._$AH&&t!==b1,a&&(this._$AH=t);else{let o=t,l,h;for(t=s[0],l=0;l<s.length-1;l++)h=Gw(this,o[r+l],i,l),h===b1&&(h=this._$AH[l]),a||(a=!yC(h)||h!==this._$AH[l]),h===io?t=io:t!==io&&(t+=(h??"")+s[l+1]),this._$AH[l]=h}a&&!n&&this.j(t)}j(t){t===io?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}},HZ=class extends jw{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===io?void 0:t}},JGe=Vw?Vw.emptyScript:"",qZ=class extends jw{constructor(){super(...arguments),this.type=4}j(t){t&&t!==io?this.element.setAttribute(this.name,JGe):this.element.removeAttribute(this.name)}},$Z=class extends jw{constructor(t,i,r,n,s){super(t,i,r,n,s),this.type=5}_$AI(t,i=this){var r;if((t=(r=Gw(this,t,i,0))!==null&&r!==void 0?r:io)===b1)return;let n=this._$AH,s=t===io&&n!==io||t.capture!==n.capture||t.once!==n.once||t.passive!==n.passive,a=t!==io&&(n===io||s);s&&this.element.removeEventListener(this.name,this,n),a&&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)}},XZ=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){Gw(this,t)}};var APe=fF.litHtmlPolyfillSupport;APe?.(x1,w1),((VZ=fF.litHtmlVersions)!==null&&VZ!==void 0?VZ:fF.litHtmlVersions=[]).push("2.8.0");var _C=(e,t,i)=>{var r,n;let s=(r=i?.renderBefore)!==null&&r!==void 0?r:t,a=s._$litPart$;if(a===void 0){let o=(n=i?.renderBefore)!==null&&n!==void 0?n:null;s._$litPart$=a=new w1(t.insertBefore(vC(),o),o,void 0,i??{})}return a._$AI(e),a};var YZ,KZ;var d0=class extends im{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=_C(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 b1}};d0.finalized=!0,d0._$litElement$=!0,(YZ=globalThis.litElementHydrateSupport)===null||YZ===void 0||YZ.call(globalThis,{LitElement:d0});var OPe=globalThis.litElementPolyfillSupport;OPe?.({LitElement:d0});((KZ=globalThis.litElementVersions)!==null&&KZ!==void 0?KZ:globalThis.litElementVersions=[]).push("3.3.3");var LPe=e=>t=>typeof t=="function"?((i,r)=>(customElements.define(i,r),r))(e,t):((i,r)=>{let{kind:n,elements:s}=r;return{kind:n,elements:s,finisher(a){customElements.define(i,a)}}})(e,t);var eje=(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)}},tje=(e,t,i)=>{t.constructor.createProperty(i,e)};function Uh(e){return(t,i)=>i!==void 0?tje(e,t,i):eje(e,t)}var ZZ,Int=((ZZ=window.HTMLSlotElement)===null||ZZ===void 0?void 0:ZZ.prototype.assignedElements)!=null?(e,t)=>e.assignedElements(t):(e,t)=>e.assignedNodes(t).filter(i=>i.nodeType===Node.ELEMENT_NODE);var mF=window.IntersectionObserver!=null;var BPe=(e=32,t=2)=>{let i=e/2;return NPe` <style>
|
|
13019
13019
|
:host {
|