r(ve,Z))Y[j]=ve,Y[ie]=Z,j=ie;else break e}}return te}function r(Y,te){var Z=Y.sortIndex-te.sortIndex;return Z!==0?Z:Y.id-te.id}if(typeof performance=="object"&&typeof performance.now=="function"){var n=performance;s.unstable_now=function(){return n.now()}}else{var a=Date,o=a.now();s.unstable_now=function(){return a.now()-o}}var l=[],c=[],u=1,h=null,d=3,f=!1,m=!1,p=!1,_=typeof setTimeout=="function"?setTimeout:null,v=typeof clearTimeout=="function"?clearTimeout:null,x=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function S(Y){for(var te=t(c);te!==null;){if(te.callback===null)i(c);else if(te.startTime<=Y)i(c),te.sortIndex=te.expirationTime,e(l,te);else break;te=t(c)}}function b(Y){if(p=!1,S(Y),!m)if(t(l)!==null)m=!0,oe(y);else{var te=t(c);te!==null&&le(b,te.startTime-Y)}}function y(Y,te){m=!1,p&&(p=!1,v(A),A=-1),f=!0;var Z=d;try{for(S(te),h=t(l);h!==null&&(!(h.expirationTime>te)||Y&&!L());){var j=h.callback;if(typeof j=="function"){h.callback=null,d=h.priorityLevel;var G=j(h.expirationTime<=te);te=s.unstable_now(),typeof G=="function"?h.callback=G:h===t(l)&&i(l),S(te)}else i(l);h=t(l)}if(h!==null)var J=!0;else{var $=t(c);$!==null&&le(b,$.startTime-te),J=!1}return J}finally{h=null,d=Z,f=!1}}var I=!1,R=null,A=-1,P=5,w=-1;function L(){return!(s.unstable_now()-wY||125j?(Y.sortIndex=Z,e(c,Y),t(l)===null&&Y===t(c)&&(p?(v(A),A=-1):p=!0,le(b,Z-j))):(Y.sortIndex=G,e(l,Y),m||f||(m=!0,oe(y))),Y},s.unstable_shouldYield=L,s.unstable_wrapCallback=function(Y){var te=d;return function(){var Z=d;d=te;try{return Y.apply(this,arguments)}finally{d=Z}}}})(yF)),yF}var Gfe;function o1t(){return Gfe||(Gfe=1,TF.exports=a1t()),TF.exports}/**
034448: * @license React
034449: * react-reconciler.production.min.js
034450: *
034451: * Copyright (c) Facebook, Inc. and its affiliates.
034452: *
034453: * This source code is licensed under the MIT license found in the
034454: * LICENSE file in the root directory of this source tree.
034455: */var EF,zfe;function l1t(){return zfe||(zfe=1,EF=function(e){var t={},i=WO(),r=o1t(),n=Object.assign;function a(M){for(var D="https://reactjs.org/docs/error-decoder.html?invariant="+M,W=1;WIt||fe[et]!==Pe[It]){var ti=`
034459: `+fe[et].replace(" at new "," at ");return M.displayName&&ti.includes("")&&(ti=ti.replace("",M.displayName)),ti}while(1<=et&&0<=It);break}}}finally{Le=!1,Error.prepareStackTrace=W}return(M=M?M.displayName||M.name:"")?yi(M):""}var nr=Object.prototype.hasOwnProperty,Rs=[],ps=-1;function Fr(M){return{current:M}}function vi(M){0>ps||(M.current=Rs[ps],Rs[ps]=null,ps--)}function Or(M,D){ps++,Rs[ps]=M.current,M.current=D}var Yi={},Ds=Fr(Yi),sn=Fr(!1),qn=Yi;function ra(M,D){var W=M.type.contextTypes;if(!W)return Yi;var K=M.stateNode;if(K&&K.__reactInternalMemoizedUnmaskedChildContext===D)return K.__reactInternalMemoizedMaskedChildContext;var fe={},Pe;for(Pe in W)fe[Pe]=D[Pe];return K&&(M=M.stateNode,M.__reactInternalMemoizedUnmaskedChildContext=D,M.__reactInternalMemoizedMaskedChildContext=fe),fe}function Qr(M){return M=M.childContextTypes,M!=null}function Zn(){vi(sn),vi(Ds)}function Go(M,D,W){if(Ds.current!==Yi)throw Error(a(168));Or(Ds,D),Or(sn,W)}function _a(M,D,W){var K=M.stateNode;if(D=D.childContextTypes,typeof K.getChildContext!="function")return W;K=K.getChildContext();for(var fe in K)if(!(fe in D))throw Error(a(108,A(M)||"Unknown",fe));return n({},W,K)}function nl(M){return M=(M=M.stateNode)&&M.__reactInternalMemoizedMergedChildContext||Yi,qn=Ds.current,Or(Ds,M),Or(sn,sn.current),!0}function Kl(M,D,W){var K=M.stateNode;if(!K)throw Error(a(169));W?(M=_a(M,D,qn),K.__reactInternalMemoizedMergedChildContext=M,vi(sn),vi(Ds),Or(Ds,M)):vi(sn),Or(sn,W)}var ga=Math.clz32?Math.clz32:vh,lu=Math.log,xc=Math.LN2;function vh(M){return M>>>=0,M===0?32:31-(lu(M)/xc|0)|0}var Ql=64,ms=4194304;function Jl(M){switch(M&-M){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return M&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return M&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return M}}function Sc(M,D){var W=M.pendingLanes;if(W===0)return 0;var K=0,fe=M.suspendedLanes,Pe=M.pingedLanes,et=W&268435455;if(et!==0){var It=et&~fe;It!==0?K=Jl(It):(Pe&=et,Pe!==0&&(K=Jl(Pe)))}else et=W&~fe,et!==0?K=Jl(et):Pe!==0&&(K=Jl(Pe));if(K===0)return 0;if(D!==0&&D!==K&&(D&fe)===0&&(fe=K&-K,Pe=D&-D,fe>=Pe||fe===16&&(Pe&4194240)!==0))return D;if((K&4)!==0&&(K|=W&16),D=M.entangledLanes,D!==0)for(M=M.entanglements,D&=K;0W;W++)D.push(M);return D}function Wn(M,D,W){M.pendingLanes|=D,D!==536870912&&(M.suspendedLanes=0,M.pingedLanes=0),M=M.eventTimes,D=31-ga(D),M[D]=W}function gn(M,D){var W=M.pendingLanes&~D;M.pendingLanes=D,M.suspendedLanes=0,M.pingedLanes=0,M.expiredLanes&=D,M.mutableReadLanes&=D,M.entangledLanes&=D,D=M.entanglements;var K=M.eventTimes;for(M=M.expirationTimes;0>=et,fe-=et,rc=1<<32-ga(D)+fe|W<xn?(dl=vs,vs=null):dl=vs.sibling;var _n=zr(Ht,vs,Qt[xn],Ji);if(_n===null){vs===null&&(vs=dl);break}M&&vs&&_n.alternate===null&&D(Ht,vs),Mt=Pe(_n,Mt,xn),Ps===null?Ir=_n:Ps.sibling=_n,Ps=_n,vs=dl}if(xn===Qt.length)return W(Ht,vs),vn&&Gc(Ht,xn),Ir;if(vs===null){for(;xnxn?(dl=vs,vs=null):dl=vs.sibling;var mm=zr(Ht,vs,_n.value,Ji);if(mm===null){vs===null&&(vs=dl);break}M&&vs&&mm.alternate===null&&D(Ht,vs),Mt=Pe(mm,Mt,xn),Ps===null?Ir=mm:Ps.sibling=mm,Ps=mm,vs=dl}if(_n.done)return W(Ht,vs),vn&&Gc(Ht,xn),Ir;if(vs===null){for(;!_n.done;xn++,_n=Qt.next())_n=gs(Ht,_n.value,Ji),_n!==null&&(Mt=Pe(_n,Mt,xn),Ps===null?Ir=_n:Ps.sibling=_n,Ps=_n);return vn&&Gc(Ht,xn),Ir}for(vs=K(Ht,vs);!_n.done;xn++,_n=Qt.next())_n=Ls(vs,Ht,xn,_n.value,Ji),_n!==null&&(M&&_n.alternate!==null&&vs.delete(_n.key===null?xn:_n.key),Mt=Pe(_n,Mt,xn),Ps===null?Ir=_n:Ps.sibling=_n,Ps=_n);return M&&vs.forEach(function(mC){return D(Ht,mC)}),vn&&Gc(Ht,xn),Ir}function Gh(Ht,Mt,Qt,Ji){if(typeof Qt=="object"&&Qt!==null&&Qt.type===u&&Qt.key===null&&(Qt=Qt.props.children),typeof Qt=="object"&&Qt!==null){switch(Qt.$$typeof){case l:e:{for(var Ir=Qt.key,Ps=Mt;Ps!==null;){if(Ps.key===Ir){if(Ir=Qt.type,Ir===u){if(Ps.tag===7){W(Ht,Ps.sibling),Mt=fe(Ps,Qt.props.children),Mt.return=Ht,Ht=Mt;break e}}else if(Ps.elementType===Ir||typeof Ir=="object"&&Ir!==null&&Ir.$$typeof===S&&gu(Ir)===Ps.type){W(Ht,Ps.sibling),Mt=fe(Ps,Qt.props),Mt.ref=_u(Ht,Ps,Qt),Mt.return=Ht,Ht=Mt;break e}W(Ht,Ps);break}else D(Ht,Ps);Ps=Ps.sibling}Qt.type===u?(Mt=Wg(Qt.props.children,Ht.mode,Ji,Qt.key),Mt.return=Ht,Ht=Mt):(Ji=Dy(Qt.type,Qt.key,Qt.props,null,Ht.mode,Ji),Ji.ref=_u(Ht,Mt,Qt),Ji.return=Ht,Ht=Ji)}return et(Ht);case c:e:{for(Ps=Qt.key;Mt!==null;){if(Mt.key===Ps)if(Mt.tag===4&&Mt.stateNode.containerInfo===Qt.containerInfo&&Mt.stateNode.implementation===Qt.implementation){W(Ht,Mt.sibling),Mt=fe(Mt,Qt.children||[]),Mt.return=Ht,Ht=Mt;break e}else{W(Ht,Mt);break}else D(Ht,Mt);Mt=Mt.sibling}Mt=wy(Qt,Ht.mode,Ji),Mt.return=Ht,Ht=Mt}return et(Ht);case S:return Ps=Qt._init,Gh(Ht,Mt,Ps(Qt._payload),Ji)}if(ne(Qt))return sr(Ht,Mt,Qt,Ji);if(I(Qt))return Ic(Ht,Mt,Qt,Ji);Ec(Ht,Qt)}return typeof Qt=="string"&&Qt!==""||typeof Qt=="number"?(Qt=""+Qt,Mt!==null&&Mt.tag===6?(W(Ht,Mt.sibling),Mt=fe(Mt,Qt),Mt.return=Ht,Ht=Mt):(W(Ht,Mt),Mt=Oy(Qt,Ht.mode,Ji),Mt.return=Ht,Ht=Mt),et(Ht)):W(Ht,Mt)}return Gh}var nc=xf(!0),Sf=xf(!1),vu={},_o=Fr(vu),zc=Fr(vu),Wc=Fr(vu);function ol(M){if(M===vu)throw Error(a(174));return M}function wh(M,D){Or(Wc,D),Or(zc,M),Or(_o,vu),M=le(D),vi(_o),Or(_o,M)}function xu(){vi(_o),vi(zc),vi(Wc)}function bf(M){var D=ol(Wc.current),W=ol(_o.current);D=Y(W,M.type,D),W!==D&&(Or(zc,M),Or(_o,D))}function Id(M){zc.current===M&&(vi(_o),vi(zc))}var An=Fr(0);function Nh(M){for(var D=M;D!==null;){if(D.tag===13){var W=D.memoizedState;if(W!==null&&(W=W.dehydrated,W===null||Mi(W)||vr(W)))return D}else if(D.tag===19&&D.memoizedProps.revealOrder!==void 0){if((D.flags&128)!==0)return D}else if(D.child!==null){D.child.return=D,D=D.child;continue}if(D===M)break;for(;D.sibling===null;){if(D.return===null||D.return===M)return null;D=D.return}D.sibling.return=D.return,D=D.sibling}return null}var Ro=[];function Hc(){for(var M=0;MW?W:4,M(!0);var K=Io.transition;Io.transition={};try{M(!1),D()}finally{di=W,Io.transition=K}}function lp(){return Ns().memoizedState}function db(M,D,W){var K=$u(M);W={lane:K,action:W,hasEagerState:!1,eagerState:null,next:null},fb(M)?tx(D,W):(n_(M,D,W),W=nn(),M=Bl(M,K,W),M!==null&&a_(M,D,K))}function Ry(M,D,W){var K=$u(M),fe={lane:K,action:W,hasEagerState:!1,eagerState:null,next:null};if(fb(M))tx(D,fe);else{n_(M,D,fe);var Pe=M.alternate;if(M.lanes===0&&(Pe===null||Pe.lanes===0)&&(Pe=D.lastRenderedReducer,Pe!==null))try{var et=D.lastRenderedState,It=Pe(et,W);if(fe.hasEagerState=!0,fe.eagerState=It,to(It,et))return}catch{}finally{}W=nn(),M=Bl(M,K,W),M!==null&&a_(M,D,K)}}function fb(M){var D=M.alternate;return M===Pn||D!==null&&D===Pn}function tx(M,D){wl=Lh=!0;var W=M.pending;W===null?D.next=D:(D.next=W.next,W.next=D),M.pending=D}function n_(M,D,W){no!==null&&(M.mode&1)!==0&&(_s&2)===0?(M=D.interleaved,M===null?(W.next=W,Ho===null?Ho=[D]:Ho.push(D)):(W.next=M.next,M.next=W),D.interleaved=W):(M=D.pending,M===null?W.next=W:(W.next=M.next,M.next=W),D.pending=W)}function a_(M,D,W){if((W&4194240)!==0){var K=D.lanes;K&=M.pendingLanes,W|=K,D.lanes=W,ls(M,W)}}var am={readContext:mo,useCallback:ba,useContext:ba,useEffect:ba,useImperativeHandle:ba,useInsertionEffect:ba,useLayoutEffect:ba,useMemo:ba,useReducer:ba,useRef:ba,useState:ba,useDebugValue:ba,useDeferredValue:ba,useTransition:ba,useMutableSource:ba,useSyncExternalStore:ba,useId:ba,unstable_isNewReconciler:!1},ix={readContext:mo,useCallback:function(M,D){return bt().memoizedState=[M,D===void 0?null:D],M},useContext:mo,useEffect:Gt,useImperativeHandle:function(M,D,W){return W=W!=null?W.concat([M]):null,ki(4194308,4,ac.bind(null,D,M),W)},useLayoutEffect:function(M,D){return ki(4194308,4,M,D)},useInsertionEffect:function(M,D){return ki(4,2,M,D)},useMemo:function(M,D){var W=bt();return D=D===void 0?null:D,M=M(),W.memoizedState=[M,D],M},useReducer:function(M,D,W){var K=bt();return D=W!==void 0?W(D):D,K.memoizedState=K.baseState=D,M={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:M,lastRenderedState:D},K.queue=M,M=M.dispatch=db.bind(null,Pn,M),[K.memoizedState,M]},useRef:function(M){var D=bt();return M={current:M},D.memoizedState=M},useState:Yo,useDebugValue:s_,useDeferredValue:function(M){var D=Yo(M),W=D[0],K=D[1];return Gt(function(){var fe=Io.transition;Io.transition={};try{K(M)}finally{Io.transition=fe}},[M]),W},useTransition:function(){var M=Yo(!1),D=M[0];return M=Dg.bind(null,M[1]),bt().memoizedState=M,[D,M]},useMutableSource:function(){},useSyncExternalStore:function(M,D,W){var K=Pn,fe=bt();if(vn){if(W===void 0)throw Error(a(407));W=W()}else{if(W=D(),no===null)throw Error(a(349));(jc&30)!==0||Nl(K,D,W)}fe.memoizedState=W;var Pe={value:W,getSnapshot:D};return fe.queue=Pe,Gt($i.bind(null,K,Pe,M),[M]),K.flags|=2048,Wa(9,Ga.bind(null,K,Pe,W,D),void 0,null),W},useId:function(){var M=bt(),D=no.identifierPrefix;if(vn){var W=sc,K=rc;W=(K&~(1<<32-ga(K)-1)).toString(32)+W,D=":"+D+"R"+W,W=Xc++,0Cf&&(D.flags|=128,K=!0,Dd(fe,!1),D.lanes=4194304)}else{if(!K)if(M=Nh(Pe),M!==null){if(D.flags|=128,K=!0,M=M.updateQueue,M!==null&&(D.updateQueue=M,D.flags|=4),Dd(fe,!0),fe.tail===null&&fe.tailMode==="hidden"&&!Pe.alternate&&!vn)return so(D),null}else 2*Nn()-fe.renderingStartTime>Cf&&W!==1073741824&&(D.flags|=128,K=!0,Dd(fe,!1),D.lanes=4194304);fe.isBackwards?(Pe.sibling=D.child,D.child=Pe):(M=fe.last,M!==null?M.sibling=Pe:D.child=Pe,fe.last=Pe)}return fe.tail!==null?(D=fe.tail,fe.rendering=D,fe.tail=D.sibling,fe.renderingStartTime=Nn(),D.sibling=null,M=An.current,Or(An,K?M&1|2:M&1),D):(so(D),null);case 22:case 23:return Et(),K=D.memoizedState!==null,M!==null&&M.memoizedState!==null!==K&&(D.flags|=8192),K&&(D.mode&1)!==0?(Fl&1073741824)!==0&&(so(D),q&&D.subtreeFlags&6&&(D.flags|=8192)):so(D),null;case 24:return null;case 25:return null}throw Error(a(156,D.tag))}var ox=o.ReactCurrentOwner,qo=!1;function ja(M,D,W,K){D.child=M===null?Sf(D,null,W,K):nc(D,M.child,W,K)}function Kn(M,D,W,K,fe){W=W.render;var Pe=D.ref;return hu(D,fe),K=Ni(M,D,W,K,Pe,fe),W=ue(),M!==null&&!qo?(D.updateQueue=M.updateQueue,D.flags&=-2053,M.lanes&=~fe,Cc(M,D,fe)):(vn&&W&&yd(D),D.flags|=1,ja(M,D,K,fe),D.child)}function jn(M,D,W,K,fe){if(M===null){var Pe=W.type;return typeof Pe=="function"&&!My(Pe)&&Pe.defaultProps===void 0&&W.compare===null&&W.defaultProps===void 0?(D.tag=15,D.type=Pe,Od(M,D,Pe,K,fe)):(M=Dy(W.type,null,K,D,D.mode,fe),M.ref=D.ref,M.return=D,D.child=M)}if(Pe=M.child,(M.lanes&fe)===0){var et=Pe.memoizedProps;if(W=W.compare,W=W!==null?W:al,W(et,K)&&M.ref===D.ref)return Cc(M,D,fe)}return D.flags|=1,M=pm(Pe,K),M.ref=D.ref,M.return=D,D.child=M}function Od(M,D,W,K,fe){if(M!==null&&al(M.memoizedProps,K)&&M.ref===D.ref)if(qo=!1,(M.lanes&fe)!==0)(M.flags&131072)!==0&&(qo=!0);else return D.lanes=M.lanes,Cc(M,D,fe);return wd(M,D,W,K,fe)}function cl(M,D,W){var K=D.pendingProps,fe=K.children,Pe=M!==null?M.memoizedState:null;if(K.mode==="hidden")if((D.mode&1)===0)D.memoizedState={baseLanes:0,cachePool:null},Or(xp,Fl),Fl|=W;else if((W&1073741824)!==0)D.memoizedState={baseLanes:0,cachePool:null},K=Pe!==null?Pe.baseLanes:W,Or(xp,Fl),Fl|=K;else return M=Pe!==null?Pe.baseLanes|W:W,D.lanes=D.childLanes=1073741824,D.memoizedState={baseLanes:M,cachePool:null},D.updateQueue=null,Or(xp,Fl),Fl|=M,null;else Pe!==null?(K=Pe.baseLanes|W,D.memoizedState=null):K=W,Or(xp,Fl),Fl|=K;return ja(M,D,fe,W),D.child}function oc(M,D){var W=D.ref;(M===null&&W!==null||M!==null&&M.ref!==W)&&(D.flags|=512,D.flags|=2097152)}function wd(M,D,W,K,fe){var Pe=Qr(W)?qn:Ds.current;return Pe=ra(D,Pe),hu(D,fe),W=Ni(M,D,W,K,Pe,fe),K=ue(),M!==null&&!qo?(D.updateQueue=M.updateQueue,D.flags&=-2053,M.lanes&=~fe,Cc(M,D,fe)):(vn&&K&&yd(D),D.flags|=1,ja(M,D,W,fe),D.child)}function hp(M,D,W,K,fe){if(Qr(W)){var Pe=!0;nl(D)}else Pe=!1;if(hu(D,fe),D.stateNode===null)M!==null&&(M.alternate=null,D.alternate=null,D.flags|=2),mf(D,W,K),Td(D,W,K,fe),K=!0;else if(M===null){var et=D.stateNode,It=D.memoizedProps;et.props=It;var ti=et.context,Li=W.contextType;typeof Li=="object"&&Li!==null?Li=mo(Li):(Li=Qr(W)?qn:Ds.current,Li=ra(D,Li));var pr=W.getDerivedStateFromProps,gs=typeof pr=="function"||typeof et.getSnapshotBeforeUpdate=="function";gs||typeof et.UNSAFE_componentWillReceiveProps!="function"&&typeof et.componentWillReceiveProps!="function"||(It!==K||ti!==Li)&&_f(D,et,K,Li),jo=!1;var zr=D.memoizedState;et.state=zr,Ih(D,K,et,fe),ti=D.memoizedState,It!==K||zr!==ti||sn.current||jo?(typeof pr=="function"&&(Sd(D,W,pr,K),ti=D.memoizedState),(It=jo||bd(D,W,It,K,zr,ti,Li))?(gs||typeof et.UNSAFE_componentWillMount!="function"&&typeof et.componentWillMount!="function"||(typeof et.componentWillMount=="function"&&et.componentWillMount(),typeof et.UNSAFE_componentWillMount=="function"&&et.UNSAFE_componentWillMount()),typeof et.componentDidMount=="function"&&(D.flags|=4194308)):(typeof et.componentDidMount=="function"&&(D.flags|=4194308),D.memoizedProps=K,D.memoizedState=ti),et.props=K,et.state=ti,et.context=Li,K=It):(typeof et.componentDidMount=="function"&&(D.flags|=4194308),K=!1)}else{et=D.stateNode,xd(M,D),It=D.memoizedProps,Li=D.type===D.elementType?It:po(D.type,It),et.props=Li,gs=D.pendingProps,zr=et.context,ti=W.contextType,typeof ti=="object"&&ti!==null?ti=mo(ti):(ti=Qr(W)?qn:Ds.current,ti=ra(D,ti));var Ls=W.getDerivedStateFromProps;(pr=typeof Ls=="function"||typeof et.getSnapshotBeforeUpdate=="function")||typeof et.UNSAFE_componentWillReceiveProps!="function"&&typeof et.componentWillReceiveProps!="function"||(It!==gs||zr!==ti)&&_f(D,et,K,ti),jo=!1,zr=D.memoizedState,et.state=zr,Ih(D,K,et,fe);var sr=D.memoizedState;It!==gs||zr!==sr||sn.current||jo?(typeof Ls=="function"&&(Sd(D,W,Ls,K),sr=D.memoizedState),(Li=jo||bd(D,W,Li,K,zr,sr,ti)||!1)?(pr||typeof et.UNSAFE_componentWillUpdate!="function"&&typeof et.componentWillUpdate!="function"||(typeof et.componentWillUpdate=="function"&&et.componentWillUpdate(K,sr,ti),typeof et.UNSAFE_componentWillUpdate=="function"&&et.UNSAFE_componentWillUpdate(K,sr,ti)),typeof et.componentDidUpdate=="function"&&(D.flags|=4),typeof et.getSnapshotBeforeUpdate=="function"&&(D.flags|=1024)):(typeof et.componentDidUpdate!="function"||It===M.memoizedProps&&zr===M.memoizedState||(D.flags|=4),typeof et.getSnapshotBeforeUpdate!="function"||It===M.memoizedProps&&zr===M.memoizedState||(D.flags|=1024),D.memoizedProps=K,D.memoizedState=sr),et.props=K,et.state=sr,et.context=ti,K=Li):(typeof et.componentDidUpdate!="function"||It===M.memoizedProps&&zr===M.memoizedState||(D.flags|=4),typeof et.getSnapshotBeforeUpdate!="function"||It===M.memoizedProps&&zr===M.memoizedState||(D.flags|=1024),K=!1)}return Ll(M,D,W,K,Pe,fe)}function Ll(M,D,W,K,fe,Pe){oc(M,D);var et=(D.flags&128)!==0;if(!K&&!et)return fe&&Kl(D,W,!1),Cc(M,D,Pe);K=D.stateNode,ox.current=D;var It=et&&typeof W.getDerivedStateFromError!="function"?null:K.render();return D.flags|=1,M!==null&&et?(D.child=nc(D,M.child,null,Pe),D.child=nc(D,null,It,Pe)):ja(M,D,It,Pe),D.memoizedState=K.state,fe&&Kl(D,W,!0),D.child}function o_(M){var D=M.stateNode;D.pendingContext?Go(M,D.pendingContext,D.pendingContext!==D.context):D.context&&Go(M,D.context,!1),wh(M,D.containerInfo)}function lx(M,D,W,K,fe){return mu(),Oh(fe),D.flags|=256,ja(M,D,W,K),D.child}var l_={dehydrated:null,treeContext:null,retryLane:0};function dp(M){return{baseLanes:M,cachePool:null}}function cx(M,D,W){var K=D.pendingProps,fe=An.current,Pe=!1,et=(D.flags&128)!==0,It;if((It=et)||(It=M!==null&&M.memoizedState===null?!1:(fe&2)!==0),It?(Pe=!0,D.flags&=-129):(M===null||M.memoizedState!==null)&&(fe|=1),Or(An,fe&1),M===null)return yc(D),M=D.memoizedState,M!==null&&(M=M.dehydrated,M!==null)?((D.mode&1)===0?D.lanes=1:vr(M)?D.lanes=8:D.lanes=1073741824,null):(fe=K.children,M=K.fallback,Pe?(K=D.mode,Pe=D.child,fe={mode:"hidden",children:fe},(K&1)===0&&Pe!==null?(Pe.childLanes=0,Pe.pendingProps=fe):Pe=gb(fe,K,0,null),M=Wg(M,K,W,null),Pe.return=D,M.return=D,Pe.sibling=M,D.child=Pe,D.child.memoizedState=dp(W),D.memoizedState=l_,M):Hu(D,fe));if(fe=M.memoizedState,fe!==null){if(It=fe.dehydrated,It!==null){if(et)return D.flags&256?(D.flags&=-257,u_(M,D,W,Error(a(422)))):D.memoizedState!==null?(D.child=M.child,D.flags|=128,null):(Pe=K.fallback,fe=D.mode,K=gb({mode:"visible",children:K.children},fe,0,null),Pe=Wg(Pe,fe,W,null),Pe.flags|=2,K.return=D,Pe.return=D,K.sibling=Pe,D.child=K,(D.mode&1)!==0&&nc(D,M.child,null,W),D.child.memoizedState=dp(W),D.memoizedState=l_,Pe);if((D.mode&1)===0)D=u_(M,D,W,null);else if(vr(It))D=u_(M,D,W,Error(a(419)));else if(K=(W&M.childLanes)!==0,qo||K){if(K=no,K!==null){switch(W&-W){case 4:Pe=2;break;case 16:Pe=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:Pe=32;break;case 536870912:Pe=268435456;break;default:Pe=0}K=(Pe&(K.suspendedLanes|W))!==0?0:Pe,K!==0&&K!==fe.retryLane&&(fe.retryLane=K,Bl(M,K,-1))}Vr(),D=u_(M,D,W,Error(a(421)))}else Mi(It)?(D.flags|=128,D.child=M.child,D=Py.bind(null,M),Kr(It,D),D=null):(W=fe.treeContext,Oe&&(Oa=Va(It),ro=D,vn=!0,$o=null,pu=!1,W!==null&&(Xo[Co++]=rc,Xo[Co++]=sc,Xo[Co++]=Uc,rc=W.id,sc=W.overflow,Uc=D)),D=Hu(D,D.pendingProps.children),D.flags|=4096);return D}return Pe?(K=Bg(M,D,K.children,K.fallback,W),Pe=D.child,fe=M.child.memoizedState,Pe.memoizedState=fe===null?dp(W):{baseLanes:fe.baseLanes|W,cachePool:null},Pe.childLanes=M.childLanes&~W,D.memoizedState=l_,K):(W=c_(M,D,K.children,W),D.memoizedState=null,W)}return Pe?(K=Bg(M,D,K.children,K.fallback,W),Pe=D.child,fe=M.child.memoizedState,Pe.memoizedState=fe===null?dp(W):{baseLanes:fe.baseLanes|W,cachePool:null},Pe.childLanes=M.childLanes&~W,D.memoizedState=l_,K):(W=c_(M,D,K.children,W),D.memoizedState=null,W)}function Hu(M,D){return D=gb({mode:"visible",children:D},M.mode,0,null),D.return=M,M.child=D}function c_(M,D,W,K){var fe=M.child;return M=fe.sibling,W=pm(fe,{mode:"visible",children:W}),(D.mode&1)===0&&(W.lanes=K),W.return=D,W.sibling=null,M!==null&&(K=D.deletions,K===null?(D.deletions=[M],D.flags|=16):K.push(M)),D.child=W}function Bg(M,D,W,K,fe){var Pe=D.mode;M=M.child;var et=M.sibling,It={mode:"hidden",children:W};return(Pe&1)===0&&D.child!==M?(W=D.child,W.childLanes=0,W.pendingProps=It,D.deletions=null):(W=pm(M,It),W.subtreeFlags=M.subtreeFlags&14680064),et!==null?K=pm(et,K):(K=Wg(K,Pe,fe,null),K.flags|=2),K.return=D,W.return=D,W.sibling=K,D.child=W,K}function u_(M,D,W,K){return K!==null&&Oh(K),nc(D,M.child,null,W),M=Hu(D,D.pendingProps.children),M.flags|=2,D.memoizedState=null,M}function mb(M,D,W){M.lanes|=D;var K=M.alternate;K!==null&&(K.lanes|=D),Vc(M.return,D,W)}function Bh(M,D,W,K,fe){var Pe=M.memoizedState;Pe===null?M.memoizedState={isBackwards:D,rendering:null,renderingStartTime:0,last:K,tail:W,tailMode:fe}:(Pe.isBackwards=D,Pe.rendering=null,Pe.renderingStartTime=0,Pe.last=K,Pe.tail=W,Pe.tailMode=fe)}function fp(M,D,W){var K=D.pendingProps,fe=K.revealOrder,Pe=K.tail;if(ja(M,D,K.children,W),K=An.current,(K&2)!==0)K=K&1|2,D.flags|=128;else{if(M!==null&&(M.flags&128)!==0)e:for(M=D.child;M!==null;){if(M.tag===13)M.memoizedState!==null&&mb(M,W,D);else if(M.tag===19)mb(M,W,D);else if(M.child!==null){M.child.return=M,M=M.child;continue}if(M===D)break e;for(;M.sibling===null;){if(M.return===null||M.return===D)break e;M=M.return}M.sibling.return=M.return,M=M.sibling}K&=1}if(Or(An,K),(D.mode&1)===0)D.memoizedState=null;else switch(fe){case"forwards":for(W=D.child,fe=null;W!==null;)M=W.alternate,M!==null&&Nh(M)===null&&(fe=W),W=W.sibling;W=fe,W===null?(fe=D.child,D.child=null):(fe=W.sibling,W.sibling=null),Bh(D,!1,fe,W,Pe);break;case"backwards":for(W=null,fe=D.child,D.child=null;fe!==null;){if(M=fe.alternate,M!==null&&Nh(M)===null){D.child=fe;break}M=fe.sibling,fe.sibling=W,W=fe,fe=M}Bh(D,!0,W,null,Pe);break;case"together":Bh(D,!1,null,null,void 0);break;default:D.memoizedState=null}return D.child}function Cc(M,D,W){if(M!==null&&(D.dependencies=M.dependencies),kh|=D.lanes,(W&D.childLanes)===0)return null;if(M!==null&&D.child!==M.child)throw Error(a(153));if(D.child!==null){for(M=D.child,W=pm(M,M.pendingProps),D.child=W,W.return=D;M.sibling!==null;)M=M.sibling,W=W.sibling=pm(M,M.pendingProps),W.return=D;W.sibling=null}return D.child}function kg(M,D,W){switch(D.tag){case 3:o_(D),mu();break;case 5:bf(D);break;case 1:Qr(D.type)&&nl(D);break;case 4:wh(D,D.stateNode.containerInfo);break;case 10:kc(D,D.type._context,D.memoizedProps.value);break;case 13:var K=D.memoizedState;if(K!==null)return K.dehydrated!==null?(Or(An,An.current&1),D.flags|=128,null):(W&D.child.childLanes)!==0?cx(M,D,W):(Or(An,An.current&1),M=Cc(M,D,W),M!==null?M.sibling:null);Or(An,An.current&1);break;case 19:if(K=(W&D.childLanes)!==0,(M.flags&128)!==0){if(K)return fp(M,D,W);D.flags|=128}var fe=D.memoizedState;if(fe!==null&&(fe.rendering=null,fe.tail=null,fe.lastEffect=null),Or(An,An.current),K)break;return null;case 22:case 23:return D.lanes=0,cl(M,D,W)}return Cc(M,D,W)}function Vg(M,D){switch(Ed(D),D.tag){case 1:return Qr(D.type)&&Zn(),M=D.flags,M&65536?(D.flags=M&-65537|128,D):null;case 3:return xu(),vi(sn),vi(Ds),Hc(),M=D.flags,(M&65536)!==0&&(M&128)===0?(D.flags=M&-65537|128,D):null;case 5:return Id(D),null;case 13:if(vi(An),M=D.memoizedState,M!==null&&M.dehydrated!==null){if(D.alternate===null)throw Error(a(340));mu()}return M=D.flags,M&65536?(D.flags=M&-65537|128,D):null;case 19:return vi(An),null;case 4:return xu(),null;case 10:return Uu(D.type._context),null;case 22:case 23:return Et(),null;case 24:return null;default:return null}}var lc=!1,Zo=!1,pp=typeof WeakSet=="function"?WeakSet:Set,Gi=null;function Su(M,D){var W=M.ref;if(W!==null)if(typeof W=="function")try{W(null)}catch(K){ya(M,D,K)}else W.current=null}function Nd(M,D,W){try{W()}catch(K){ya(M,D,K)}}var ux=!1;function hx(M,D){for(te(M.containerInfo),Gi=D;Gi!==null;)if(M=Gi,D=M.child,(M.subtreeFlags&1028)!==0&&D!==null)D.return=M,Gi=D;else for(;Gi!==null;){M=Gi;try{var W=M.alternate;if((M.flags&1024)!==0)switch(M.tag){case 0:case 11:case 15:break;case 1:if(W!==null){var K=W.memoizedProps,fe=W.memoizedState,Pe=M.stateNode,et=Pe.getSnapshotBeforeUpdate(M.elementType===M.type?K:po(M.type,K),fe);Pe.__reactInternalSnapshotBeforeUpdate=et}break;case 3:q&&be(M.stateNode.containerInfo);break;case 5:case 6:case 4:case 17:break;default:throw Error(a(163))}}catch(It){ya(M,M.return,It)}if(D=M.sibling,D!==null){D.return=M.return,Gi=D;break}Gi=M.return}return W=ux,ux=!1,W}function Ld(M,D,W){var K=D.updateQueue;if(K=K!==null?K.lastEffect:null,K!==null){var fe=K=K.next;do{if((fe.tag&M)===M){var Pe=fe.destroy;fe.destroy=void 0,Pe!==void 0&&Nd(D,W,Pe)}fe=fe.next}while(fe!==K)}}function ul(M,D){if(D=D.updateQueue,D=D!==null?D.lastEffect:null,D!==null){var W=D=D.next;do{if((W.tag&M)===M){var K=W.create;W.destroy=K()}W=W.next}while(W!==D)}}function cc(M){var D=M.ref;if(D!==null){var W=M.stateNode;switch(M.tag){case 5:M=oe(W);break;default:M=W}typeof D=="function"?D(M):D.current=M}}function sa(M,D,W){if(Ol&&typeof Ol.onCommitFiberUnmount=="function")try{Ol.onCommitFiberUnmount(Fu,D)}catch{}switch(D.tag){case 0:case 11:case 14:case 15:if(M=D.updateQueue,M!==null&&(M=M.lastEffect,M!==null)){var K=M=M.next;do{var fe=K,Pe=fe.destroy;fe=fe.tag,Pe!==void 0&&((fe&2)!==0||(fe&4)!==0)&&Nd(D,W,Pe),K=K.next}while(K!==M)}break;case 1:if(Su(D,W),M=D.stateNode,typeof M.componentWillUnmount=="function")try{M.props=D.memoizedProps,M.state=D.memoizedState,M.componentWillUnmount()}catch(et){ya(D,W,et)}break;case 5:Su(D,W);break;case 4:q?px(M,D,W):pe&&pe&&(D=D.stateNode.containerInfo,W=ci(D),ce(D,W))}}function bu(M,D,W){for(var K=D;;)if(sa(M,K,W),K.child===null||q&&K.tag===4){if(K===D)break;for(;K.sibling===null;){if(K.return===null||K.return===D)return;K=K.return}K.sibling.return=K.return,K=K.sibling}else K.child.return=K,K=K.child}function dx(M){var D=M.alternate;D!==null&&(M.alternate=null,dx(D)),M.child=null,M.deletions=null,M.sibling=null,M.tag===5&&(D=M.stateNode,D!==null&<(D)),M.stateNode=null,M.return=null,M.dependencies=null,M.memoizedProps=null,M.memoizedState=null,M.pendingProps=null,M.stateNode=null,M.updateQueue=null}function fx(M){return M.tag===5||M.tag===3||M.tag===4}function Ug(M){e:for(;;){for(;M.sibling===null;){if(M.return===null||fx(M.return))return null;M=M.return}for(M.sibling.return=M.return,M=M.sibling;M.tag!==5&&M.tag!==6&&M.tag!==18;){if(M.flags&2||M.child===null||M.tag===4)continue e;M.child.return=M,M=M.child}if(!(M.flags&2))return M.stateNode}}function Gg(M){if(q){e:{for(var D=M.return;D!==null;){if(fx(D))break e;D=D.return}throw Error(a(160))}var W=D;switch(W.tag){case 5:D=W.stateNode,W.flags&32&&(mi(D),W.flags&=-33),W=Ug(M),lm(M,W,D);break;case 3:case 4:D=W.stateNode.containerInfo,W=Ug(M),zg(M,W,D);break;default:throw Error(a(161))}}}function zg(M,D,W){var K=M.tag;if(K===5||K===6)M=M.stateNode,D?ct(W,M,D):ai(W,M);else if(K!==4&&(M=M.child,M!==null))for(zg(M,D,W),M=M.sibling;M!==null;)zg(M,D,W),M=M.sibling}function lm(M,D,W){var K=M.tag;if(K===5||K===6)M=M.stateNode,D?he(W,M,D):Vt(W,M);else if(K!==4&&(M=M.child,M!==null))for(lm(M,D,W),M=M.sibling;M!==null;)lm(M,D,W),M=M.sibling}function px(M,D,W){for(var K=D,fe=!1,Pe,et;;){if(!fe){fe=K.return;e:for(;;){if(fe===null)throw Error(a(160));switch(Pe=fe.stateNode,fe.tag){case 5:et=!1;break e;case 3:Pe=Pe.containerInfo,et=!0;break e;case 4:Pe=Pe.containerInfo,et=!0;break e}fe=fe.return}fe=!0}if(K.tag===5||K.tag===6)bu(M,K,W),et?Nt(Pe,K.stateNode):Je(Pe,K.stateNode);else if(K.tag===18)et?pi(Pe,K.stateNode):Tt(Pe,K.stateNode);else if(K.tag===4){if(K.child!==null){Pe=K.stateNode.containerInfo,et=!0,K.child.return=K,K=K.child;continue}}else if(sa(M,K,W),K.child!==null){K.child.return=K,K=K.child;continue}if(K===D)break;for(;K.sibling===null;){if(K.return===null||K.return===D)return;K=K.return,K.tag===4&&(fe=!1)}K.sibling.return=K.return,K=K.sibling}}function yf(M,D){if(q){switch(D.tag){case 0:case 11:case 14:case 15:Ld(3,D,D.return),ul(3,D),Ld(5,D,D.return);return;case 1:return;case 5:var W=D.stateNode;if(W!=null){var K=D.memoizedProps;M=M!==null?M.memoizedProps:K;var fe=D.type,Pe=D.updateQueue;D.updateQueue=null,Pe!==null&&ri(W,Pe,fe,M,K,D)}return;case 6:if(D.stateNode===null)throw Error(a(162));W=D.memoizedProps,Ft(D.stateNode,M!==null?M.memoizedProps:W,W);return;case 3:Oe&&M!==null&&M.memoizedState.isDehydrated&&yt(D.stateNode.containerInfo);return;case 12:return;case 13:cm(D);return;case 19:cm(D);return;case 17:return}throw Error(a(163))}switch(D.tag){case 0:case 11:case 14:case 15:Ld(3,D,D.return),ul(3,D),Ld(5,D,D.return);return;case 12:return;case 13:cm(D);return;case 19:cm(D);return;case 3:Oe&&M!==null&&M.memoizedState.isDehydrated&&yt(D.stateNode.containerInfo);break;case 22:case 23:return}e:if(pe){switch(D.tag){case 1:case 5:case 6:break e;case 3:case 4:D=D.stateNode,ce(D.containerInfo,D.pendingChildren);break e}throw Error(a(163))}}function cm(M){var D=M.updateQueue;if(D!==null){M.updateQueue=null;var W=M.stateNode;W===null&&(W=M.stateNode=new pp),D.forEach(function(K){var fe=yu.bind(null,M,K);W.has(K)||(W.add(K),K.then(fe,fe))})}}function Ay(M,D){for(Gi=D;Gi!==null;){D=Gi;var W=D.deletions;if(W!==null)for(var K=0;K";case _p:return":has("+(Ef(M)||"")+")";case gp:return'[role="'+M.value+'"]';case um:return'"'+M.value+'"';case Fd:return'[data-testname="'+M.value+'"]';default:throw Error(a(365))}}function qc(M,D){var W=[];M=[M,0];for(var K=0;Kfe&&(fe=et),K&=~Pe}if(K=fe,K=Nn()-K,K=(120>K?120:480>K?480:1080>K?1080:1920>K?1920:3e3>K?3e3:4320>K?4320:1960*gx(K/1960))-K,10M?16:M,Vh===null)var K=!1;else{if(M=Vh,Vh=null,Tp=0,(_s&6)!==0)throw Error(a(331));var fe=_s;for(_s|=4,Gi=M.current;Gi!==null;){var Pe=Gi,et=Pe.child;if((Gi.flags&16)!==0){var It=Pe.deletions;if(It!==null){for(var ti=0;tiNn()-g_?wr(M,0):Sp|=W),Rc(M,D)}function _b(M,D){D===0&&((M.mode&1)===0?D=1:(D=ms,ms<<=1,(ms&130023424)===0&&(ms=4194304)));var W=nn();M=Rf(M,D),M!==null&&(Wn(M,D,W),Rc(M,W))}function Py(M){var D=M.memoizedState,W=0;D!==null&&(W=D.retryLane),_b(M,W)}function yu(M,D){var W=0;switch(M.tag){case 13:var K=M.stateNode,fe=M.memoizedState;fe!==null&&(W=fe.retryLane);break;case 19:K=M.stateNode;break;default:throw Error(a(314))}K!==null&&K.delete(D),_b(M,W)}var S_;S_=function(M,D,W){if(M!==null)if(M.memoizedProps!==D.pendingProps||sn.current)qo=!0;else{if((M.lanes&W)===0&&(D.flags&128)===0)return qo=!1,kg(M,D,W);qo=(M.flags&131072)!==0}else qo=!1,vn&&(D.flags&1048576)!==0&&gf(D,Mh,D.index);switch(D.lanes=0,D.tag){case 2:var K=D.type;M!==null&&(M.alternate=null,D.alternate=null,D.flags|=2),M=D.pendingProps;var fe=ra(D,Ds.current);hu(D,W),fe=Ni(null,D,K,M,fe,W);var Pe=ue();return D.flags|=1,typeof fe=="object"&&fe!==null&&typeof fe.render=="function"&&fe.$$typeof===void 0?(D.tag=1,D.memoizedState=null,D.updateQueue=null,Qr(K)?(Pe=!0,nl(D)):Pe=!1,D.memoizedState=fe.state!==null&&fe.state!==void 0?fe.state:null,du(D),fe.updater=Ah,D.stateNode=fe,fe._reactInternals=D,Td(D,K,M,W),D=Ll(null,D,K,!0,Pe,W)):(D.tag=0,vn&&Pe&&yd(D),ja(null,D,fe,W),D=D.child),D;case 16:K=D.elementType;e:{switch(M!==null&&(M.alternate=null,D.alternate=null,D.flags|=2),M=D.pendingProps,fe=K._init,K=fe(K._payload),D.type=K,fe=D.tag=a1(K),M=po(K,M),fe){case 0:D=wd(null,D,K,M,W);break e;case 1:D=hp(null,D,K,M,W);break e;case 11:D=Kn(null,D,K,M,W);break e;case 14:D=jn(null,D,K,po(K.type,M),W);break e}throw Error(a(306,K,""))}return D;case 0:return K=D.type,fe=D.pendingProps,fe=D.elementType===K?fe:po(K,fe),wd(M,D,K,fe,W);case 1:return K=D.type,fe=D.pendingProps,fe=D.elementType===K?fe:po(K,fe),hp(M,D,K,fe,W);case 3:e:{if(o_(D),M===null)throw Error(a(387));K=D.pendingProps,Pe=D.memoizedState,fe=Pe.element,xd(M,D),Ih(D,K,null,W);var et=D.memoizedState;if(K=et.element,Oe&&Pe.isDehydrated)if(Pe={element:K,isDehydrated:!1,cache:et.cache,transitions:et.transitions},D.updateQueue.baseState=Pe,D.memoizedState=Pe,D.flags&256){fe=Error(a(423)),D=lx(M,D,K,W,fe);break e}else if(K!==fe){fe=Error(a(424)),D=lx(M,D,K,W,fe);break e}else for(Oe&&(Oa=Ma(D.stateNode.containerInfo),ro=D,vn=!0,$o=null,pu=!1),W=Sf(D,null,K,W),D.child=W;W;)W.flags=W.flags&-3|4096,W=W.sibling;else{if(mu(),K===fe){D=Cc(M,D,W);break e}ja(M,D,K,W)}D=D.child}return D;case 5:return bf(D),M===null&&yc(D),K=D.type,fe=D.pendingProps,Pe=M!==null?M.memoizedProps:null,et=fe.children,re(K,fe)?et=null:Pe!==null&&re(K,Pe)&&(D.flags|=32),oc(M,D),ja(M,D,et,W),D.child;case 6:return M===null&&yc(D),null;case 13:return cx(M,D,W);case 4:return wh(D,D.stateNode.containerInfo),K=D.pendingProps,M===null?D.child=nc(D,null,K,W):ja(M,D,K,W),D.child;case 11:return K=D.type,fe=D.pendingProps,fe=D.elementType===K?fe:po(K,fe),Kn(M,D,K,fe,W);case 7:return ja(M,D,D.pendingProps,W),D.child;case 8:return ja(M,D,D.pendingProps.children,W),D.child;case 12:return ja(M,D,D.pendingProps.children,W),D.child;case 10:e:{if(K=D.type._context,fe=D.pendingProps,Pe=D.memoizedProps,et=fe.value,kc(D,K,et),Pe!==null)if(to(Pe.value,et)){if(Pe.children===fe.children&&!sn.current){D=Cc(M,D,W);break e}}else for(Pe=D.child,Pe!==null&&(Pe.return=D);Pe!==null;){var It=Pe.dependencies;if(It!==null){et=Pe.child;for(var ti=It.firstContext;ti!==null;){if(ti.context===K){if(Pe.tag===1){ti=ic(-1,W&-W),ti.tag=2;var Li=Pe.updateQueue;if(Li!==null){Li=Li.shared;var pr=Li.pending;pr===null?ti.next=ti:(ti.next=pr.next,pr.next=ti),Li.pending=ti}}Pe.lanes|=W,ti=Pe.alternate,ti!==null&&(ti.lanes|=W),Vc(Pe.return,W,D),It.lanes|=W;break}ti=ti.next}}else if(Pe.tag===10)et=Pe.type===D.type?null:Pe.child;else if(Pe.tag===18){if(et=Pe.return,et===null)throw Error(a(341));et.lanes|=W,It=et.alternate,It!==null&&(It.lanes|=W),Vc(et,W,D),et=Pe.sibling}else et=Pe.child;if(et!==null)et.return=Pe;else for(et=Pe;et!==null;){if(et===D){et=null;break}if(Pe=et.sibling,Pe!==null){Pe.return=et.return,et=Pe;break}et=et.return}Pe=et}ja(M,D,fe.children,W),D=D.child}return D;case 9:return fe=D.type,K=D.pendingProps.children,hu(D,W),fe=mo(fe),K=K(fe),D.flags|=1,ja(M,D,K,W),D.child;case 14:return K=D.type,fe=po(K,D.pendingProps),fe=po(K.type,fe),jn(M,D,K,fe,W);case 15:return Od(M,D,D.type,D.pendingProps,W);case 17:return K=D.type,fe=D.pendingProps,fe=D.elementType===K?fe:po(K,fe),M!==null&&(M.alternate=null,D.alternate=null,D.flags|=2),D.tag=1,Qr(K)?(M=!0,nl(D)):M=!1,hu(D,W),mf(D,K,fe),Td(D,K,fe,W),Ll(null,D,K,!0,M,W);case 19:return fp(M,D,W);case 22:return cl(M,D,W)}throw Error(a(156,D.tag))};function xx(M,D){return Hn(M,D)}function hP(M,D,W,K){this.tag=M,this.key=W,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=D,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=K,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Uh(M,D,W,K){return new hP(M,D,W,K)}function My(M){return M=M.prototype,!(!M||!M.isReactComponent)}function a1(M){if(typeof M=="function")return My(M)?1:0;if(M!=null){if(M=M.$$typeof,M===p)return 11;if(M===x)return 14}return 2}function pm(M,D){var W=M.alternate;return W===null?(W=Uh(M.tag,D,M.key,M.mode),W.elementType=M.elementType,W.type=M.type,W.stateNode=M.stateNode,W.alternate=M,M.alternate=W):(W.pendingProps=D,W.type=M.type,W.flags=0,W.subtreeFlags=0,W.deletions=null),W.flags=M.flags&14680064,W.childLanes=M.childLanes,W.lanes=M.lanes,W.child=M.child,W.memoizedProps=M.memoizedProps,W.memoizedState=M.memoizedState,W.updateQueue=M.updateQueue,D=M.dependencies,W.dependencies=D===null?null:{lanes:D.lanes,firstContext:D.firstContext},W.sibling=M.sibling,W.index=M.index,W.ref=M.ref,W}function Dy(M,D,W,K,fe,Pe){var et=2;if(K=M,typeof M=="function")My(M)&&(et=1);else if(typeof M=="string")et=5;else e:switch(M){case u:return Wg(W.children,fe,Pe,D);case h:et=8,fe|=8;break;case d:return M=Uh(12,W,D,fe|2),M.elementType=d,M.lanes=Pe,M;case _:return M=Uh(13,W,D,fe),M.elementType=_,M.lanes=Pe,M;case v:return M=Uh(19,W,D,fe),M.elementType=v,M.lanes=Pe,M;case b:return gb(W,fe,Pe,D);default:if(typeof M=="object"&&M!==null)switch(M.$$typeof){case f:et=10;break e;case m:et=9;break e;case p:et=11;break e;case x:et=14;break e;case S:et=16,K=null;break e}throw Error(a(130,M==null?M:typeof M,""))}return D=Uh(et,W,D,fe),D.elementType=M,D.type=K,D.lanes=Pe,D}function Wg(M,D,W,K){return M=Uh(7,M,K,D),M.lanes=W,M}function gb(M,D,W,K){return M=Uh(22,M,K,D),M.elementType=b,M.lanes=W,M.stateNode={},M}function Oy(M,D,W){return M=Uh(6,M,null,D),M.lanes=W,M}function wy(M,D,W){return D=Uh(4,M.children!==null?M.children:[],M.key,D),D.lanes=W,D.stateNode={containerInfo:M.containerInfo,pendingChildren:null,implementation:M.implementation},D}function Ny(M,D,W,K,fe){this.tag=D,this.containerInfo=M,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=Ie,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=si(0),this.expirationTimes=si(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=si(0),this.identifierPrefix=K,this.onRecoverableError=fe,Oe&&(this.mutableSourceEagerHydrationData=null)}function dP(M,D,W,K,fe,Pe,et,It,ti){return M=new Ny(M,D,W,It,ti),D===1?(D=1,Pe===!0&&(D|=8)):D=0,Pe=Uh(3,null,null,D),M.current=Pe,Pe.stateNode=M,Pe.memoizedState={element:K,isDehydrated:W,cache:null,transitions:null},du(Pe),M}function fP(M){if(!M)return Yi;M=M._reactInternals;e:{if(P(M)!==M||M.tag!==1)throw Error(a(170));var D=M;do{switch(D.tag){case 3:D=D.stateNode.context;break e;case 1:if(Qr(D.type)){D=D.stateNode.__reactInternalMemoizedMergedChildContext;break e}}D=D.return}while(D!==null);throw Error(a(171))}if(M.tag===1){var W=M.type;if(Qr(W))return _a(M,W,D)}return D}function pP(M){var D=M._reactInternals;if(D===void 0)throw typeof M.render=="function"?Error(a(188)):(M=Object.keys(M).join(","),Error(a(268,M)));return M=k(D),M===null?null:M.stateNode}function Ud(M,D){if(M=M.memoizedState,M!==null&&M.dehydrated!==null){var W=M.retryLane;M.retryLane=W!==0&&W=Li&&Pe>=gs&&fe<=pr&&et<=zr){M.splice(D,1);break}else if(K!==Li||W.width!==ti.width||zret){if(!(Pe!==gs||W.height!==ti.height||prfe)){Li>K&&(ti.width+=Li-K,ti.x=K),prPe&&(ti.height+=gs-Pe,ti.y=Pe),zrW&&(W=et)),et ")+`
034463:
034464: No matching component was found for:
034465: `)+M.join(" > ")}return null},t.getPublicRootInstance=function(M){if(M=M.current,!M.child)return null;switch(M.child.tag){case 5:return oe(M.child.stateNode);default:return M.child.stateNode}},t.injectIntoDevTools=function(M){if(M={bundleType:M.bundleType,version:M.version,rendererPackageName:M.rendererPackageName,rendererConfig:M.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:o.ReactCurrentDispatcher,findHostInstanceByFiber:Ly,findFiberByHostInstance:M.findFiberByHostInstance||mP,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.0.0-fc46dba67-20220329"},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u")M=!1;else{var D=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(D.isDisabled||!D.supportsFiber)M=!0;else{try{Fu=D.inject(M),Ol=D}catch{}M=!!D.checkDCE}}return M},t.isAlreadyRendering=function(){return!1},t.observeVisibleRects=function(M,D,W,K){if(!Ee)throw Error(a(363));M=Bd(M,D);var fe=Lt(M,W,K).disconnect;return{disconnect:function(){fe()}}},t.registerMutableSourceForHydration=function(M,D){var W=D._getVersion;W=W(D._source),M.mutableSourceEagerHydrationData==null?M.mutableSourceEagerHydrationData=[D,W]:M.mutableSourceEagerHydrationData.push(D,W)},t.runWithPriority=function(M,D){var W=di;try{return di=M,D()}finally{di=W}},t.shouldError=function(){return null},t.shouldSuspend=function(){return!1},t.updateContainer=function(M,D,W,K){var fe=D.current,Pe=nn(),et=$u(fe);return W=fP(W),D.context===null?D.context=W:D.pendingContext=W,D=ic(Pe,et),D.payload={element:M},K=K===void 0?null:K,K!==null&&(D.callback=K),bc(fe,D),M=Bl(fe,et,Pe),M!==null&&Ch(M,fe,et),et},t}),EF}var Wfe;function c1t(){return Wfe||(Wfe=1,bF.exports=l1t()),bF.exports}var u1t=c1t();const h1t=O5(u1t);var CF={exports:{}},RF={};/**
034466: * @license React
034467: * scheduler.production.min.js
034468: *
034469: * Copyright (c) Facebook, Inc. and its affiliates.
034470: *
034471: * This source code is licensed under the MIT license found in the
034472: * LICENSE file in the root directory of this source tree.
034473: */var Hfe;function d1t(){return Hfe||(Hfe=1,(function(s){function e(Y,te){var Z=Y.length;Y.push(te);e:for(;0>>1,G=Y[j];if(0>>1;jr(re,Z))ier(ve,re)?(Y[j]=ve,Y[ie]=Z,j=ie):(Y[j]=re,Y[$]=Z,j=$);else if(ier(ve,Z))Y[j]=ve,Y[ie]=Z,j=ie;else break e}}return te}function r(Y,te){var Z=Y.sortIndex-te.sortIndex;return Z!==0?Z:Y.id-te.id}if(typeof performance=="object"&&typeof performance.now=="function"){var n=performance;s.unstable_now=function(){return n.now()}}else{var a=Date,o=a.now();s.unstable_now=function(){return a.now()-o}}var l=[],c=[],u=1,h=null,d=3,f=!1,m=!1,p=!1,_=typeof setTimeout=="function"?setTimeout:null,v=typeof clearTimeout=="function"?clearTimeout:null,x=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function S(Y){for(var te=t(c);te!==null;){if(te.callback===null)i(c);else if(te.startTime<=Y)i(c),te.sortIndex=te.expirationTime,e(l,te);else break;te=t(c)}}function b(Y){if(p=!1,S(Y),!m)if(t(l)!==null)m=!0,oe(y);else{var te=t(c);te!==null&&le(b,te.startTime-Y)}}function y(Y,te){m=!1,p&&(p=!1,v(A),A=-1),f=!0;var Z=d;try{for(S(te),h=t(l);h!==null&&(!(h.expirationTime>te)||Y&&!L());){var j=h.callback;if(typeof j=="function"){h.callback=null,d=h.priorityLevel;var G=j(h.expirationTime<=te);te=s.unstable_now(),typeof G=="function"?h.callback=G:h===t(l)&&i(l),S(te)}else i(l);h=t(l)}if(h!==null)var J=!0;else{var $=t(c);$!==null&&le(b,$.startTime-te),J=!1}return J}finally{h=null,d=Z,f=!1}}var I=!1,R=null,A=-1,P=5,w=-1;function L(){return!(s.unstable_now()-wY||125j?(Y.sortIndex=Z,e(c,Y),t(l)===null&&Y===t(c)&&(p?(v(A),A=-1):p=!0,le(b,Z-j))):(Y.sortIndex=G,e(l,Y),m||f||(m=!0,oe(y))),Y},s.unstable_shouldYield=L,s.unstable_wrapCallback=function(Y){var te=d;return function(){var Z=d;d=te;try{return Y.apply(this,arguments)}finally{d=Z}}}})(RF)),RF}var jfe;function f1t(){return jfe||(jfe=1,CF.exports=d1t()),CF.exports}var Xfe=f1t();const M6={},p1t=s=>void Object.assign(M6,s);function m1t(s,e){function t(u,{args:h=[],attach:d,...f},m){let p=`${u[0].toUpperCase()}${u.slice(1)}`,_;if(u==="primitive"){if(f.object===void 0)throw new Error("R3F: Primitives without 'object' are invalid!");const v=f.object;_=AE(v,{type:u,root:m,attach:d,primitive:!0})}else{const v=M6[p];if(!v)throw new Error(`R3F: ${p} is not part of the THREE namespace! Did you forget to extend? See: https://docs.pmnd.rs/react-three-fiber/api/objects#using-3rd-party-objects-declaratively`);if(!Array.isArray(h))throw new Error("R3F: The args prop must be an array!");_=AE(new v(...h),{type:u,root:m,attach:d,memoizedProps:{args:h}})}return _.__r3f.attach===void 0&&(_.isBufferGeometry?_.__r3f.attach="geometry":_.isMaterial&&(_.__r3f.attach="material")),p!=="inject"&&PF(_,f),_}function i(u,h){let d=!1;if(h){var f,m;(f=h.__r3f)!=null&&f.attach?AF(u,h,h.__r3f.attach):h.isObject3D&&u.isObject3D&&(u.add(h),d=!0),d||(m=u.__r3f)==null||m.objects.push(h),h.__r3f||AE(h,{}),h.__r3f.parent=u,M5(h),PE(h)}}function r(u,h,d){let f=!1;if(h){var m,p;if((m=h.__r3f)!=null&&m.attach)AF(u,h,h.__r3f.attach);else if(h.isObject3D&&u.isObject3D){h.parent=u,h.dispatchEvent({type:"added"}),u.dispatchEvent({type:"childadded",child:h});const _=u.children.filter(x=>x!==h),v=_.indexOf(d);u.children=[..._.slice(0,v),h,..._.slice(v)],f=!0}f||(p=u.__r3f)==null||p.objects.push(h),h.__r3f||AE(h,{}),h.__r3f.parent=u,M5(h),PE(h)}}function n(u,h,d=!1){u&&[...u].forEach(f=>a(h,f,d))}function a(u,h,d){if(h){var f,m,p;if(h.__r3f&&(h.__r3f.parent=null),(f=u.__r3f)!=null&&f.objects&&(u.__r3f.objects=u.__r3f.objects.filter(b=>b!==h)),(m=h.__r3f)!=null&&m.attach)Kfe(u,h,h.__r3f.attach);else if(h.isObject3D&&u.isObject3D){var _;u.remove(h),(_=h.__r3f)!=null&&_.root&&T1t(XD(h),h)}const x=(p=h.__r3f)==null?void 0:p.primitive,S=!x&&(d===void 0?h.dispose!==null:d);if(!x){var v;n((v=h.__r3f)==null?void 0:v.objects,h,S),n(h.children,h,S)}if(delete h.__r3f,S&&h.dispose&&h.type!=="Scene"){const b=()=>{try{h.dispose()}catch{}};typeof IS_REACT_ACT_ENVIRONMENT>"u"?Xfe.unstable_scheduleCallback(Xfe.unstable_IdlePriority,b):b()}PE(u)}}function o(u,h,d,f){var m;const p=(m=u.__r3f)==null?void 0:m.parent;if(!p)return;const _=t(h,d,u.__r3f.root);if(u.children){for(const v of u.children)v.__r3f&&i(_,v);u.children=u.children.filter(v=>!v.__r3f)}u.__r3f.objects.forEach(v=>i(_,v)),u.__r3f.objects=[],u.__r3f.autoRemovedBeforeAppend||a(p,u),_.parent&&(_.__r3f.autoRemovedBeforeAppend=!0),i(p,_),_.raycast&&_.__r3f.eventCount&&XD(_).getState().internal.interaction.push(_),[f,f.alternate].forEach(v=>{v!==null&&(v.stateNode=_,v.ref&&(typeof v.ref=="function"?v.ref(_):v.ref.current=_))})}const l=()=>{};return{reconciler:h1t({createInstance:t,removeChild:a,appendChild:i,appendInitialChild:i,insertBefore:r,supportsMutation:!0,isPrimaryRenderer:!1,supportsPersistence:!1,supportsHydration:!1,noTimeout:-1,appendChildToContainer:(u,h)=>{if(!h)return;const d=u.getState().scene;d.__r3f&&(d.__r3f.root=u,i(d,h))},removeChildFromContainer:(u,h)=>{h&&a(u.getState().scene,h)},insertInContainerBefore:(u,h,d)=>{if(!h||!d)return;const f=u.getState().scene;f.__r3f&&r(f,h,d)},getRootHostContext:()=>null,getChildHostContext:u=>u,finalizeInitialChildren(u){var h;return!!((h=u==null?void 0:u.__r3f)!=null?h:{}).handlers},prepareUpdate(u,h,d,f){var m;if(((m=u==null?void 0:u.__r3f)!=null?m:{}).primitive&&f.object&&f.object!==u)return[!0];{const{args:_=[],children:v,...x}=f,{args:S=[],children:b,...y}=d;if(!Array.isArray(_))throw new Error("R3F: the args prop must be an array!");if(_.some((R,A)=>R!==S[A]))return[!0];const I=tNe(u,x,y,!0);return I.changes.length?[!1,I]:null}},commitUpdate(u,[h,d],f,m,p,_){h?o(u,f,p,_):PF(u,d)},commitMount(u,h,d,f){var m;const p=(m=u.__r3f)!=null?m:{};u.raycast&&p.handlers&&p.eventCount&&XD(u).getState().internal.interaction.push(u)},getPublicInstance:u=>u,prepareForCommit:()=>null,preparePortalMount:u=>AE(u.getState().scene),resetAfterCommit:()=>{},shouldSetTextContent:()=>!1,clearContainer:()=>!1,hideInstance(u){var h;const{attach:d,parent:f}=(h=u.__r3f)!=null?h:{};d&&f&&Kfe(f,u,d),u.isObject3D&&(u.visible=!1),PE(u)},unhideInstance(u,h){var d;const{attach:f,parent:m}=(d=u.__r3f)!=null?d:{};f&&m&&AF(m,u,f),(u.isObject3D&&h.visible==null||h.visible)&&(u.visible=!0),PE(u)},createTextInstance:l,hideTextInstance:l,unhideTextInstance:l,getCurrentEventPriority:()=>e?e():zE.DefaultEventPriority,beforeActiveInstanceBlur:()=>{},afterActiveInstanceBlur:()=>{},detachDeletedInstance:()=>{},now:typeof performance<"u"&&xo.fun(performance.now)?performance.now:xo.fun(Date.now)?Date.now:()=>0,scheduleTimeout:xo.fun(setTimeout)?setTimeout:void 0,cancelTimeout:xo.fun(clearTimeout)?clearTimeout:void 0}),applyProps:PF}}var $fe,Yfe;const IF=s=>"colorSpace"in s||"outputColorSpace"in s,qwe=()=>{var s;return(s=M6.ColorManagement)!=null?s:null},Zwe=s=>s&&s.isOrthographicCamera,_1t=s=>s&&s.hasOwnProperty("current"),uP=typeof window<"u"&&(($fe=window.document)!=null&&$fe.createElement||((Yfe=window.navigator)==null?void 0:Yfe.product)==="ReactNative")?Te.useLayoutEffect:Te.useEffect;function Kwe(s){const e=Te.useRef(s);return uP(()=>void(e.current=s),[s]),e}function g1t({set:s}){return uP(()=>(s(new Promise(()=>null)),()=>s(!1)),[s]),null}class Qwe extends Te.Component{constructor(...e){super(...e),this.state={error:!1}}componentDidCatch(e){this.props.set(e)}render(){return this.state.error?null:this.props.children}}Qwe.getDerivedStateFromError=()=>({error:!0});const Jwe="__default",qfe=new Map,v1t=s=>s&&!!s.memoized&&!!s.changes;function eNe(s){var e;const t=typeof window<"u"?(e=window.devicePixelRatio)!=null?e:2:1;return Array.isArray(s)?Math.min(Math.max(s[0],t),s[1]):s}const YC=s=>{var e;return(e=s.__r3f)==null?void 0:e.root.getState()};function XD(s){let e=s.__r3f.root;for(;e.getState().previousRoot;)e=e.getState().previousRoot;return e}const xo={obj:s=>s===Object(s)&&!xo.arr(s)&&typeof s!="function",fun:s=>typeof s=="function",str:s=>typeof s=="string",num:s=>typeof s=="number",boo:s=>typeof s=="boolean",und:s=>s===void 0,arr:s=>Array.isArray(s),equ(s,e,{arrays:t="shallow",objects:i="reference",strict:r=!0}={}){if(typeof s!=typeof e||!!s!=!!e)return!1;if(xo.str(s)||xo.num(s)||xo.boo(s))return s===e;const n=xo.obj(s);if(n&&i==="reference")return s===e;const a=xo.arr(s);if(a&&t==="reference")return s===e;if((a||n)&&s===e)return!0;let o;for(o in s)if(!(o in e))return!1;if(n&&t==="shallow"&&i==="shallow"){for(o in r?e:s)if(!xo.equ(s[o],e[o],{strict:r,objects:"reference"}))return!1}else for(o in r?e:s)if(s[o]!==e[o])return!1;if(xo.und(o)){if(a&&s.length===0&&e.length===0||n&&Object.keys(s).length===0&&Object.keys(e).length===0)return!0;if(s!==e)return!1}return!0}};function x1t(s){s.dispose&&s.type!=="Scene"&&s.dispose();for(const e in s)e.dispose==null||e.dispose(),delete s[e]}function AE(s,e){const t=s;return t.__r3f={type:"",root:null,previousAttach:null,memoizedProps:{},eventCount:0,handlers:{},objects:[],parent:null,...e},s}function P5(s,e){let t=s;if(e.includes("-")){const i=e.split("-"),r=i.pop();return t=i.reduce((n,a)=>n[a],s),{target:t,key:r}}else return{target:t,key:e}}const Zfe=/-\d+$/;function AF(s,e,t){if(xo.str(t)){if(Zfe.test(t)){const n=t.replace(Zfe,""),{target:a,key:o}=P5(s,n);Array.isArray(a[o])||(a[o]=[])}const{target:i,key:r}=P5(s,t);e.__r3f.previousAttach=i[r],i[r]=e}else e.__r3f.previousAttach=t(s,e)}function Kfe(s,e,t){var i,r;if(xo.str(t)){const{target:n,key:a}=P5(s,t),o=e.__r3f.previousAttach;o===void 0?delete n[a]:n[a]=o}else(i=e.__r3f)==null||i.previousAttach==null||i.previousAttach(s,e);(r=e.__r3f)==null||delete r.previousAttach}function tNe(s,{children:e,key:t,ref:i,...r},{children:n,key:a,ref:o,...l}={},c=!1){const u=s.__r3f,h=Object.entries(r),d=[];if(c){const m=Object.keys(l);for(let p=0;p{var _;if((_=s.__r3f)!=null&&_.primitive&&m==="object"||xo.equ(p,l[m]))return;if(/^on(Pointer|Click|DoubleClick|ContextMenu|Wheel)/.test(m))return d.push([m,p,!0,[]]);let v=[];m.includes("-")&&(v=m.split("-")),d.push([m,p,!1,v]);for(const x in r){const S=r[x];x.startsWith(`${m}-`)&&d.push([x,S,!1,x.split("-")])}});const f={...r};return u!=null&&u.memoizedProps&&u!=null&&u.memoizedProps.args&&(f.args=u.memoizedProps.args),u!=null&&u.memoizedProps&&u!=null&&u.memoizedProps.attach&&(f.attach=u.memoizedProps.attach),{memoized:f,changes:d}}function PF(s,e){var t;const i=s.__r3f,r=i==null?void 0:i.root,n=r==null||r.getState==null?void 0:r.getState(),{memoized:a,changes:o}=v1t(e)?e:tNe(s,e),l=i==null?void 0:i.eventCount;s.__r3f&&(s.__r3f.memoizedProps=a);for(let d=0;dS[b],s),!(x&&x.set))){const[S,...b]=_.reverse();v=b.reverse().reduce((y,I)=>y[I],s),f=S}if(m===Jwe+"remove")if(v.constructor){let S=qfe.get(v.constructor);S||(S=new v.constructor,qfe.set(v.constructor,S)),m=S[f]}else m=0;if(p&&i)m?i.handlers[f]=m:delete i.handlers[f],i.eventCount=Object.keys(i.handlers).length;else if(x&&x.set&&(x.copy||x instanceof BT)){if(Array.isArray(m))x.fromArray?x.fromArray(m):x.set(...m);else if(x.copy&&m&&m.constructor&&x.constructor===m.constructor)x.copy(m);else if(m!==void 0){var c;const S=(c=x)==null?void 0:c.isColor;!S&&x.setScalar?x.setScalar(m):x instanceof BT&&m instanceof BT?x.mask=m.mask:x.set(m),!qwe()&&n&&!n.linear&&S&&x.convertSRGBToLinear()}}else{var u;if(v[f]=m,(u=v[f])!=null&&u.isTexture&&v[f].format===od&&v[f].type===vg&&n){const S=v[f];IF(S)&&IF(n.gl)?S.colorSpace=n.gl.outputColorSpace:S.encoding=n.gl.outputEncoding}}PE(s)}if(i&&i.parent&&s.raycast&&l!==i.eventCount){const d=XD(s).getState().internal,f=d.interaction.indexOf(s);f>-1&&d.interaction.splice(f,1),i.eventCount&&d.interaction.push(s)}return!(o.length===1&&o[0][0]==="onUpdate")&&o.length&&(t=s.__r3f)!=null&&t.parent&&M5(s),s}function PE(s){var e,t;const i=(e=s.__r3f)==null||(t=e.root)==null||t.getState==null?void 0:t.getState();i&&i.internal.frames===0&&i.invalidate()}function M5(s){s.onUpdate==null||s.onUpdate(s)}function S1t(s,e){s.manual||(Zwe(s)?(s.left=e.width/-2,s.right=e.width/2,s.top=e.height/2,s.bottom=e.height/-2):s.aspect=e.width/e.height,s.updateProjectionMatrix(),s.updateMatrixWorld())}function fD(s){return(s.eventObject||s.object).uuid+"/"+s.index+s.instanceId}function b1t(){var s;const e=typeof self<"u"&&self||typeof window<"u"&&window;if(!e)return zE.DefaultEventPriority;switch((s=e.event)==null?void 0:s.type){case"click":case"contextmenu":case"dblclick":case"pointercancel":case"pointerdown":case"pointerup":return zE.DiscreteEventPriority;case"pointermove":case"pointerout":case"pointerover":case"pointerenter":case"pointerleave":case"wheel":return zE.ContinuousEventPriority;default:return zE.DefaultEventPriority}}function iNe(s,e,t,i){const r=t.get(e);r&&(t.delete(e),t.size===0&&(s.delete(i),r.target.releasePointerCapture(i)))}function T1t(s,e){const{internal:t}=s.getState();t.interaction=t.interaction.filter(i=>i!==e),t.initialHits=t.initialHits.filter(i=>i!==e),t.hovered.forEach((i,r)=>{(i.eventObject===e||i.object===e)&&t.hovered.delete(r)}),t.capturedMap.forEach((i,r)=>{iNe(t.capturedMap,e,i,r)})}function y1t(s){function e(l){const{internal:c}=s.getState(),u=l.offsetX-c.initialClick[0],h=l.offsetY-c.initialClick[1];return Math.round(Math.sqrt(u*u+h*h))}function t(l){return l.filter(c=>["Move","Over","Enter","Out","Leave"].some(u=>{var h;return(h=c.__r3f)==null?void 0:h.handlers["onPointer"+u]}))}function i(l,c){const u=s.getState(),h=new Set,d=[],f=c?c(u.internal.interaction):u.internal.interaction;for(let v=0;v{const S=YC(v.object),b=YC(x.object);return!S||!b?v.distance-x.distance:b.events.priority-S.events.priority||v.distance-x.distance}).filter(v=>{const x=fD(v);return h.has(x)?!1:(h.add(x),!0)});u.events.filter&&(p=u.events.filter(p,u));for(const v of p){let x=v.object;for(;x;){var _;(_=x.__r3f)!=null&&_.eventCount&&d.push({...v,eventObject:x}),x=x.parent}}if("pointerId"in l&&u.internal.capturedMap.has(l.pointerId))for(let v of u.internal.capturedMap.get(l.pointerId).values())h.has(fD(v.intersection))||d.push(v.intersection);return d}function r(l,c,u,h){const d=s.getState();if(l.length){const f={stopped:!1};for(const m of l){const p=YC(m.object)||d,{raycaster:_,pointer:v,camera:x,internal:S}=p,b=new Ke(v.x,v.y,0).unproject(x),y=w=>{var L,k;return(L=(k=S.capturedMap.get(w))==null?void 0:k.has(m.eventObject))!=null?L:!1},I=w=>{const L={intersection:m,target:c.target};S.capturedMap.has(w)?S.capturedMap.get(w).set(m.eventObject,L):S.capturedMap.set(w,new Map([[m.eventObject,L]])),c.target.setPointerCapture(w)},R=w=>{const L=S.capturedMap.get(w);L&&iNe(S.capturedMap,m.eventObject,L,w)};let A={};for(let w in c){let L=c[w];typeof L!="function"&&(A[w]=L)}let P={...m,...A,pointer:v,intersections:l,stopped:f.stopped,delta:u,unprojectedPoint:b,ray:_.ray,camera:x,stopPropagation(){const w="pointerId"in c&&S.capturedMap.get(c.pointerId);if((!w||w.has(m.eventObject))&&(P.stopped=f.stopped=!0,S.hovered.size&&Array.from(S.hovered.values()).find(L=>L.eventObject===m.eventObject))){const L=l.slice(0,l.indexOf(m));n([...L,m])}},target:{hasPointerCapture:y,setPointerCapture:I,releasePointerCapture:R},currentTarget:{hasPointerCapture:y,setPointerCapture:I,releasePointerCapture:R},nativeEvent:c};if(h(P),f.stopped===!0)break}}return l}function n(l){const{internal:c}=s.getState();for(const u of c.hovered.values())if(!l.length||!l.find(h=>h.object===u.object&&h.index===u.index&&h.instanceId===u.instanceId)){const d=u.eventObject.__r3f,f=d==null?void 0:d.handlers;if(c.hovered.delete(fD(u)),d!=null&&d.eventCount){const m={...u,intersections:l};f.onPointerOut==null||f.onPointerOut(m),f.onPointerLeave==null||f.onPointerLeave(m)}}}function a(l,c){for(let u=0;un([]);case"onLostPointerCapture":return c=>{const{internal:u}=s.getState();"pointerId"in c&&u.capturedMap.has(c.pointerId)&&requestAnimationFrame(()=>{u.capturedMap.has(c.pointerId)&&(u.capturedMap.delete(c.pointerId),n([]))})}}return function(u){const{onPointerMissed:h,internal:d}=s.getState();d.lastEvent.current=u;const f=l==="onPointerMove",m=l==="onClick"||l==="onContextMenu"||l==="onDoubleClick",_=i(u,f?t:void 0),v=m?e(u):0;l==="onPointerDown"&&(d.initialClick=[u.offsetX,u.offsetY],d.initialHits=_.map(S=>S.eventObject)),m&&!_.length&&v<=2&&(a(u,d.interaction),h&&h(u)),f&&n(_);function x(S){const b=S.eventObject,y=b.__r3f,I=y==null?void 0:y.handlers;if(y!=null&&y.eventCount)if(f){if(I.onPointerOver||I.onPointerEnter||I.onPointerOut||I.onPointerLeave){const R=fD(S),A=d.hovered.get(R);A?A.stopped&&S.stopPropagation():(d.hovered.set(R,S),I.onPointerOver==null||I.onPointerOver(S),I.onPointerEnter==null||I.onPointerEnter(S))}I.onPointerMove==null||I.onPointerMove(S)}else{const R=I[l];R?(!m||d.initialHits.includes(b))&&(a(u,d.interaction.filter(A=>!d.initialHits.includes(A))),R(S)):m&&d.initialHits.includes(b)&&a(u,d.interaction.filter(A=>!d.initialHits.includes(A)))}}r(_,u,v,x)}}return{handlePointer:o}}const rNe=s=>!!(s!=null&&s.render),sNe=Te.createContext(null),E1t=(s,e)=>{const t=n1t((o,l)=>{const c=new Ke,u=new Ke,h=new Ke;function d(v=l().camera,x=u,S=l().size){const{width:b,height:y,top:I,left:R}=S,A=b/y;x.isVector3?h.copy(x):h.set(...x);const P=v.getWorldPosition(c).distanceTo(h);if(Zwe(v))return{width:b/v.zoom,height:y/v.zoom,top:I,left:R,factor:1,distance:P,aspect:A};{const w=v.fov*Math.PI/180,L=2*Math.tan(w/2)*P,k=L*(b/y);return{width:k,height:L,top:I,left:R,factor:b/k,distance:P,aspect:A}}}let f;const m=v=>o(x=>({performance:{...x.performance,current:v}})),p=new hi;return{set:o,get:l,gl:null,camera:null,raycaster:null,events:{priority:1,enabled:!0,connected:!1},xr:null,scene:null,invalidate:(v=1)=>s(l(),v),advance:(v,x)=>e(v,x,l()),legacy:!1,linear:!1,flat:!1,controls:null,clock:new R6,pointer:p,mouse:p,frameloop:"always",onPointerMissed:void 0,performance:{current:1,min:.5,max:1,debounce:200,regress:()=>{const v=l();f&&clearTimeout(f),v.performance.current!==v.performance.min&&m(v.performance.min),f=setTimeout(()=>m(l().performance.max),v.performance.debounce)}},size:{width:0,height:0,top:0,left:0,updateStyle:!1},viewport:{initialDpr:0,dpr:0,width:0,height:0,top:0,left:0,aspect:0,distance:0,factor:0,getCurrentViewport:d},setEvents:v=>o(x=>({...x,events:{...x.events,...v}})),setSize:(v,x,S,b,y)=>{const I=l().camera,R={width:v,height:x,top:b||0,left:y||0,updateStyle:S};o(A=>({size:R,viewport:{...A.viewport,...d(I,u,R)}}))},setDpr:v=>o(x=>{const S=eNe(v);return{viewport:{...x.viewport,dpr:S,initialDpr:x.viewport.initialDpr||S}}}),setFrameloop:(v="always")=>{const x=l().clock;x.stop(),x.elapsedTime=0,v!=="never"&&(x.start(),x.elapsedTime=0),o(()=>({frameloop:v}))},previousRoot:void 0,internal:{active:!1,priority:0,frames:0,lastEvent:Te.createRef(),interaction:[],hovered:new Map,subscribers:[],initialClick:[0,0],initialHits:[],capturedMap:new Map,subscribe:(v,x,S)=>{const b=l().internal;return b.priority=b.priority+(x>0?1:0),b.subscribers.push({ref:v,priority:x,store:S}),b.subscribers=b.subscribers.sort((y,I)=>y.priority-I.priority),()=>{const y=l().internal;y!=null&&y.subscribers&&(y.priority=y.priority-(x>0?1:0),y.subscribers=y.subscribers.filter(I=>I.ref!==v))}}}}}),i=t.getState();let r=i.size,n=i.viewport.dpr,a=i.camera;return t.subscribe(()=>{const{camera:o,size:l,viewport:c,gl:u,set:h}=t.getState();if(l.width!==r.width||l.height!==r.height||c.dpr!==n){var d;r=l,n=c.dpr,S1t(o,l),u.setPixelRatio(c.dpr);const f=(d=l.updateStyle)!=null?d:typeof HTMLCanvasElement<"u"&&u.domElement instanceof HTMLCanvasElement;u.setSize(l.width,l.height,f)}o!==a&&(a=o,h(f=>({viewport:{...f.viewport,...f.viewport.getCurrentViewport(o)}})))}),t.subscribe(o=>s(o)),t};let pD,C1t=new Set,R1t=new Set,I1t=new Set;function MF(s,e){if(s.size)for(const{callback:t}of s.values())t(e)}function qC(s,e){switch(s){case"before":return MF(C1t,e);case"after":return MF(R1t,e);case"tail":return MF(I1t,e)}}let DF,OF;function wF(s,e,t){let i=e.clock.getDelta();for(e.frameloop==="never"&&typeof s=="number"&&(i=s-e.clock.elapsedTime,e.clock.oldTime=e.clock.elapsedTime,e.clock.elapsedTime=s),DF=e.internal.subscribers,pD=0;pD0)&&!((u=n.gl.xr)!=null&&u.isPresenting)&&(i+=wF(c,n))}if(t=!1,qC("after",c),i===0)return qC("tail",c),e=!1,cancelAnimationFrame(r)}function o(c,u=1){var h;if(!c)return s.forEach(d=>o(d.store.getState(),u));(h=c.gl.xr)!=null&&h.isPresenting||!c.internal.active||c.frameloop==="never"||(u>1?c.internal.frames=Math.min(60,c.internal.frames+u):t?c.internal.frames=2:c.internal.frames=1,e||(e=!0,requestAnimationFrame(a)))}function l(c,u=!0,h,d){if(u&&qC("before",c),h)wF(c,h,d);else for(const f of s.values())wF(c,f.store.getState());u&&qC("after",c)}return{loop:a,invalidate:o,advance:l}}function nNe(){const s=Te.useContext(sNe);if(!s)throw new Error("R3F: Hooks can only be used within the Canvas component!");return s}function n1(s=t=>t,e){return nNe()(s,e)}function D6(s,e=0){const t=nNe(),i=t.getState().internal.subscribe,r=Kwe(s);return uP(()=>i(r,e,t),[e,i,t]),null}const k0=new Map,{invalidate:Qfe,advance:Jfe}=A1t(k0),{reconciler:zO,applyProps:yE}=m1t(k0,b1t),EE={objects:"shallow",strict:!1},P1t=(s,e)=>{const t=typeof s=="function"?s(e):s;return rNe(t)?t:new twe({powerPreference:"high-performance",canvas:e,antialias:!0,alpha:!0,...s})};function M1t(s,e){const t=typeof HTMLCanvasElement<"u"&&s instanceof HTMLCanvasElement;if(e){const{width:i,height:r,top:n,left:a,updateStyle:o=t}=e;return{width:i,height:r,top:n,left:a,updateStyle:o}}else if(typeof HTMLCanvasElement<"u"&&s instanceof HTMLCanvasElement&&s.parentElement){const{width:i,height:r,top:n,left:a}=s.parentElement.getBoundingClientRect();return{width:i,height:r,top:n,left:a,updateStyle:t}}else if(typeof OffscreenCanvas<"u"&&s instanceof OffscreenCanvas)return{width:s.width,height:s.height,top:0,left:0,updateStyle:t};return{width:0,height:0,top:0,left:0}}function D1t(s){const e=k0.get(s),t=e==null?void 0:e.fiber,i=e==null?void 0:e.store;e&&console.warn("R3F.createRoot should only be called once!");const r=typeof reportError=="function"?reportError:console.error,n=i||E1t(Qfe,Jfe),a=t||zO.createContainer(n,zE.ConcurrentRoot,null,!1,null,"",r,null);e||k0.set(s,{fiber:a,store:n});let o,l=!1,c;return{configure(u={}){let{gl:h,size:d,scene:f,events:m,onCreated:p,shadows:_=!1,linear:v=!1,flat:x=!1,legacy:S=!1,orthographic:b=!1,frameloop:y="always",dpr:I=[1,2],performance:R,raycaster:A,camera:P,onPointerMissed:w}=u,L=n.getState(),k=L.gl;L.gl||L.set({gl:k=P1t(h,s)});let V=L.raycaster;V||L.set({raycaster:V=new $we});const{params:U,...ne}=A||{};if(xo.equ(ne,V,EE)||yE(V,{...ne}),xo.equ(U,V.params,EE)||yE(V,{params:{...V.params,...U}}),!L.camera||L.camera===c&&!xo.equ(c,P,EE)){c=P;const Z=P instanceof tP,j=Z?P:b?new fC(0,0,0,0,.1,1e3):new Dc(75,0,.1,1e3);Z||(j.position.z=5,P&&(yE(j,P),("aspect"in P||"left"in P||"right"in P||"bottom"in P||"top"in P)&&(j.manual=!0,j.updateProjectionMatrix())),!L.camera&&!(P!=null&&P.rotation)&&j.lookAt(0,0,0)),L.set({camera:j}),V.camera=j}if(!L.scene){let Z;f!=null&&f.isScene?Z=f:(Z=new l6,f&&yE(Z,f)),L.set({scene:AE(Z)})}if(!L.xr){var oe;const Z=(J,$)=>{const re=n.getState();re.frameloop!=="never"&&Jfe(J,!0,re,$)},j=()=>{const J=n.getState();J.gl.xr.enabled=J.gl.xr.isPresenting,J.gl.xr.setAnimationLoop(J.gl.xr.isPresenting?Z:null),J.gl.xr.isPresenting||Qfe(J)},G={connect(){const J=n.getState().gl;J.xr.addEventListener("sessionstart",j),J.xr.addEventListener("sessionend",j)},disconnect(){const J=n.getState().gl;J.xr.removeEventListener("sessionstart",j),J.xr.removeEventListener("sessionend",j)}};typeof((oe=k.xr)==null?void 0:oe.addEventListener)=="function"&&G.connect(),L.set({xr:G})}if(k.shadowMap){const Z=k.shadowMap.enabled,j=k.shadowMap.type;if(k.shadowMap.enabled=!!_,xo.boo(_))k.shadowMap.type=NR;else if(xo.str(_)){var le;const G={basic:NDe,percentage:NN,soft:NR,variance:Mm};k.shadowMap.type=(le=G[_])!=null?le:NR}else xo.obj(_)&&Object.assign(k.shadowMap,_);(Z!==k.shadowMap.enabled||j!==k.shadowMap.type)&&(k.shadowMap.needsUpdate=!0)}const Y=qwe();Y&&("enabled"in Y?Y.enabled=!S:"legacyMode"in Y&&(Y.legacyMode=S)),l||yE(k,{outputEncoding:v?3e3:3001,toneMapping:x?cg:z$}),L.legacy!==S&&L.set(()=>({legacy:S})),L.linear!==v&&L.set(()=>({linear:v})),L.flat!==x&&L.set(()=>({flat:x})),h&&!xo.fun(h)&&!rNe(h)&&!xo.equ(h,k,EE)&&yE(k,h),m&&!L.events.handlers&&L.set({events:m(n)});const te=M1t(s,d);return xo.equ(te,L.size,EE)||L.setSize(te.width,te.height,te.updateStyle,te.top,te.left),I&&L.viewport.dpr!==eNe(I)&&L.setDpr(I),L.frameloop!==y&&L.setFrameloop(y),L.onPointerMissed||L.set({onPointerMissed:w}),R&&!xo.equ(R,L.performance,EE)&&L.set(Z=>({performance:{...Z.performance,...R}})),o=p,l=!0,this},render(u){return l||this.configure(),zO.updateContainer(g.jsx(O1t,{store:n,children:u,onCreated:o,rootElement:s}),a,null,()=>{}),n},unmount(){aNe(s)}}}function O1t({store:s,children:e,onCreated:t,rootElement:i}){return uP(()=>{const r=s.getState();r.set(n=>({internal:{...n.internal,active:!0}})),t&&t(r),s.getState().events.connected||r.events.connect==null||r.events.connect(i)},[]),g.jsx(sNe.Provider,{value:s,children:e})}function aNe(s,e){const t=k0.get(s),i=t==null?void 0:t.fiber;if(i){const r=t==null?void 0:t.store.getState();r&&(r.internal.active=!1),zO.updateContainer(null,i,null,()=>{r&&setTimeout(()=>{try{var n,a,o,l;r.events.disconnect==null||r.events.disconnect(),(n=r.gl)==null||(a=n.renderLists)==null||a.dispose==null||a.dispose(),(o=r.gl)==null||o.forceContextLoss==null||o.forceContextLoss(),(l=r.gl)!=null&&l.xr&&r.xr.disconnect(),x1t(r),k0.delete(s)}catch{}},500)})}}zO.injectIntoDevTools({bundleType:0,rendererPackageName:"@react-three/fiber",version:Te.version});const NF={onClick:["click",!1],onContextMenu:["contextmenu",!1],onDoubleClick:["dblclick",!1],onWheel:["wheel",!0],onPointerDown:["pointerdown",!0],onPointerUp:["pointerup",!0],onPointerLeave:["pointerleave",!0],onPointerMove:["pointermove",!0],onPointerCancel:["pointercancel",!0],onLostPointerCapture:["lostpointercapture",!0]};function w1t(s){const{handlePointer:e}=y1t(s);return{priority:1,enabled:!0,compute(t,i,r){i.pointer.set(t.offsetX/i.size.width*2-1,-(t.offsetY/i.size.height)*2+1),i.raycaster.setFromCamera(i.pointer,i.camera)},connected:void 0,handlers:Object.keys(NF).reduce((t,i)=>({...t,[i]:e(i)}),{}),update:()=>{var t;const{events:i,internal:r}=s.getState();(t=r.lastEvent)!=null&&t.current&&i.handlers&&i.handlers.onPointerMove(r.lastEvent.current)},connect:t=>{var i;const{set:r,events:n}=s.getState();n.disconnect==null||n.disconnect(),r(a=>({events:{...a.events,connected:t}})),Object.entries((i=n.handlers)!=null?i:[]).forEach(([a,o])=>{const[l,c]=NF[a];t.addEventListener(l,o,{passive:c})})},disconnect:()=>{const{set:t,events:i}=s.getState();if(i.connected){var r;Object.entries((r=i.handlers)!=null?r:[]).forEach(([n,a])=>{if(i&&i.connected instanceof HTMLElement){const[o]=NF[n];i.connected.removeEventListener(o,a)}}),t(n=>({events:{...n.events,connected:void 0}}))}}}}function epe(s,e){let t;return(...i)=>{window.clearTimeout(t),t=window.setTimeout(()=>s(...i),e)}}function N1t({debounce:s,scroll:e,polyfill:t,offsetSize:i}={debounce:0,scroll:!1,offsetSize:!1}){const r=t||(typeof window>"u"?class{}:window.ResizeObserver);if(!r)throw new Error("This browser does not support ResizeObserver out of the box. See: https://github.com/react-spring/react-use-measure/#resize-observer-polyfills");const[n,a]=Te.useState({left:0,top:0,width:0,height:0,bottom:0,right:0,x:0,y:0}),o=Te.useRef({element:null,scrollContainers:null,resizeObserver:null,lastBounds:n,orientationHandler:null}),l=s?typeof s=="number"?s:s.scroll:null,c=s?typeof s=="number"?s:s.resize:null,u=Te.useRef(!1);Te.useEffect(()=>(u.current=!0,()=>void(u.current=!1)));const[h,d,f]=Te.useMemo(()=>{const v=()=>{if(!o.current.element)return;const{left:x,top:S,width:b,height:y,bottom:I,right:R,x:A,y:P}=o.current.element.getBoundingClientRect(),w={left:x,top:S,width:b,height:y,bottom:I,right:R,x:A,y:P};o.current.element instanceof HTMLElement&&i&&(w.height=o.current.element.offsetHeight,w.width=o.current.element.offsetWidth),Object.freeze(w),u.current&&!k1t(o.current.lastBounds,w)&&a(o.current.lastBounds=w)};return[v,c?epe(v,c):v,l?epe(v,l):v]},[a,i,l,c]);function m(){o.current.scrollContainers&&(o.current.scrollContainers.forEach(v=>v.removeEventListener("scroll",f,!0)),o.current.scrollContainers=null),o.current.resizeObserver&&(o.current.resizeObserver.disconnect(),o.current.resizeObserver=null),o.current.orientationHandler&&("orientation"in screen&&"removeEventListener"in screen.orientation?screen.orientation.removeEventListener("change",o.current.orientationHandler):"onorientationchange"in window&&window.removeEventListener("orientationchange",o.current.orientationHandler))}function p(){o.current.element&&(o.current.resizeObserver=new r(f),o.current.resizeObserver.observe(o.current.element),e&&o.current.scrollContainers&&o.current.scrollContainers.forEach(v=>v.addEventListener("scroll",f,{capture:!0,passive:!0})),o.current.orientationHandler=()=>{f()},"orientation"in screen&&"addEventListener"in screen.orientation?screen.orientation.addEventListener("change",o.current.orientationHandler):"onorientationchange"in window&&window.addEventListener("orientationchange",o.current.orientationHandler))}const _=v=>{!v||v===o.current.element||(m(),o.current.element=v,o.current.scrollContainers=oNe(v),p())};return F1t(f,!!e),L1t(d),Te.useEffect(()=>{m(),p()},[e,f,d]),Te.useEffect(()=>m,[]),[_,n,h]}function L1t(s){Te.useEffect(()=>{const e=s;return window.addEventListener("resize",e),()=>void window.removeEventListener("resize",e)},[s])}function F1t(s,e){Te.useEffect(()=>{if(e){const t=s;return window.addEventListener("scroll",t,{capture:!0,passive:!0}),()=>void window.removeEventListener("scroll",t,!0)}},[s,e])}function oNe(s){const e=[];if(!s||s===document.body)return e;const{overflow:t,overflowX:i,overflowY:r}=window.getComputedStyle(s);return[t,i,r].some(n=>n==="auto"||n==="scroll")&&e.push(s),[...e,...oNe(s.parentElement)]}const B1t=["x","y","top","bottom","left","right","width","height"],k1t=(s,e)=>B1t.every(t=>s[t]===e[t]);var V1t=Object.defineProperty,U1t=Object.defineProperties,G1t=Object.getOwnPropertyDescriptors,tpe=Object.getOwnPropertySymbols,z1t=Object.prototype.hasOwnProperty,W1t=Object.prototype.propertyIsEnumerable,ipe=(s,e,t)=>e in s?V1t(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,rpe=(s,e)=>{for(var t in e||(e={}))z1t.call(e,t)&&ipe(s,t,e[t]);if(tpe)for(var t of tpe(e))W1t.call(e,t)&&ipe(s,t,e[t]);return s},H1t=(s,e)=>U1t(s,G1t(e)),spe,npe;typeof window<"u"&&((spe=window.document)!=null&&spe.createElement||((npe=window.navigator)==null?void 0:npe.product)==="ReactNative")?Te.useLayoutEffect:Te.useEffect;function lNe(s,e,t){if(!s)return;if(t(s)===!0)return s;let i=s.child;for(;i;){const r=lNe(i,e,t);if(r)return r;i=i.sibling}}function cNe(s){try{return Object.defineProperties(s,{_currentRenderer:{get(){return null},set(){}},_currentRenderer2:{get(){return null},set(){}}})}catch{return s}}const ape=console.error;console.error=function(){const s=[...arguments].join("");if(s!=null&&s.startsWith("Warning:")&&s.includes("useContext")){console.error=ape;return}return ape.apply(this,arguments)};const O6=cNe(Te.createContext(null));class uNe extends Te.Component{render(){return Te.createElement(O6.Provider,{value:this._reactInternals},this.props.children)}}function j1t(){const s=Te.useContext(O6);if(s===null)throw new Error("its-fine: useFiber must be called within a !");const e=Te.useId();return Te.useMemo(()=>{for(const i of[s,s==null?void 0:s.alternate]){if(!i)continue;const r=lNe(i,!1,n=>{let a=n.memoizedState;for(;a;){if(a.memoizedState===e)return!0;a=a.next}});if(r)return r}},[s,e])}function X1t(){const s=j1t(),[e]=Te.useState(()=>new Map);e.clear();let t=s;for(;t;){if(t.type&&typeof t.type=="object"){const r=t.type._context===void 0&&t.type.Provider===t.type?t.type:t.type._context;r&&r!==O6&&!e.has(r)&&e.set(r,Te.useContext(cNe(r)))}t=t.return}return e}function $1t(){const s=X1t();return Te.useMemo(()=>Array.from(s.keys()).reduce((e,t)=>i=>Te.createElement(e,null,Te.createElement(t.Provider,H1t(rpe({},i),{value:s.get(t)}))),e=>Te.createElement(uNe,rpe({},e))),[s])}const Y1t=Te.forwardRef(function({children:e,fallback:t,resize:i,style:r,gl:n,events:a=w1t,eventSource:o,eventPrefix:l,shadows:c,linear:u,flat:h,legacy:d,orthographic:f,frameloop:m,dpr:p,performance:_,raycaster:v,camera:x,scene:S,onPointerMissed:b,onCreated:y,...I},R){Te.useMemo(()=>p1t(e1t),[]);const A=$1t(),[P,w]=N1t({scroll:!0,debounce:{scroll:50,resize:0},...i}),L=Te.useRef(null),k=Te.useRef(null);Te.useImperativeHandle(R,()=>L.current);const V=Kwe(b),[U,ne]=Te.useState(!1),[oe,le]=Te.useState(!1);if(U)throw U;if(oe)throw oe;const Y=Te.useRef(null);uP(()=>{const Z=L.current;w.width>0&&w.height>0&&Z&&(Y.current||(Y.current=D1t(Z)),Y.current.configure({gl:n,events:a,shadows:c,linear:u,flat:h,legacy:d,orthographic:f,frameloop:m,dpr:p,performance:_,raycaster:v,camera:x,scene:S,size:w,onPointerMissed:(...j)=>V.current==null?void 0:V.current(...j),onCreated:j=>{j.events.connect==null||j.events.connect(o?_1t(o)?o.current:o:k.current),l&&j.setEvents({compute:(G,J)=>{const $=G[l+"X"],re=G[l+"Y"];J.pointer.set($/J.size.width*2-1,-(re/J.size.height)*2+1),J.raycaster.setFromCamera(J.pointer,J.camera)}}),y==null||y(j)}}),Y.current.render(g.jsx(A,{children:g.jsx(Qwe,{set:le,children:g.jsx(Te.Suspense,{fallback:g.jsx(g1t,{set:ne}),children:e??null})})})))}),Te.useEffect(()=>{const Z=L.current;if(Z)return()=>aNe(Z)},[]);const te=o?"none":"auto";return g.jsx("div",{ref:k,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden",pointerEvents:te,...r},...I,children:g.jsx("div",{ref:P,style:{width:"100%",height:"100%"},children:g.jsx("canvas",{ref:L,style:{display:"block"},children:t})})})}),q1t=Te.forwardRef(function(e,t){return g.jsx(uNe,{children:g.jsx(Y1t,{...e,ref:t})})}),ope={type:"change"},LF={type:"start"},lpe={type:"end"},mD=new Ty,cpe=new pv,Z1t=Math.cos(70*BOe.DEG2RAD);class K1t extends Pg{constructor(e,t){super(),this.object=e,this.domElement=t,this.domElement.style.touchAction="none",this.enabled=!0,this.target=new Ke,this.cursor=new Ke,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minTargetRadius=0,this.maxTargetRadius=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.05,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.enablePan=!0,this.panSpeed=1,this.screenSpacePanning=!0,this.keyPanSpeed=7,this.zoomToCursor=!1,this.autoRotate=!1,this.autoRotateSpeed=2,this.keys={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"},this.mouseButtons={LEFT:Qb.ROTATE,MIDDLE:Qb.DOLLY,RIGHT:Qb.PAN},this.touches={ONE:Jb.ROTATE,TWO:Jb.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this._domElementKeyEvents=null,this.getPolarAngle=function(){return o.phi},this.getAzimuthalAngle=function(){return o.theta},this.getDistance=function(){return this.object.position.distanceTo(this.target)},this.listenToKeyEvents=function(De){De.addEventListener("keydown",Vt),this._domElementKeyEvents=De},this.stopListenToKeyEvents=function(){this._domElementKeyEvents.removeEventListener("keydown",Vt),this._domElementKeyEvents=null},this.saveState=function(){i.target0.copy(i.target),i.position0.copy(i.object.position),i.zoom0=i.object.zoom},this.reset=function(){i.target.copy(i.target0),i.object.position.copy(i.position0),i.object.zoom=i.zoom0,i.object.updateProjectionMatrix(),i.dispatchEvent(ope),i.update(),n=r.NONE},this.update=(function(){const De=new Ke,Ct=new Ou().setFromUnitVectors(e.up,new Ke(0,1,0)),ot=Ct.clone().invert(),we=new Ke,be=new Ou,nt=new Ke,ci=2*Math.PI;return function(ee=null){const ce=i.object.position;De.copy(ce).sub(i.target),De.applyQuaternion(Ct),o.setFromVector3(De),i.autoRotate&&n===r.NONE&&k(w(ee)),i.enableDamping?(o.theta+=l.theta*i.dampingFactor,o.phi+=l.phi*i.dampingFactor):(o.theta+=l.theta,o.phi+=l.phi);let dt=i.minAzimuthAngle,qt=i.maxAzimuthAngle;isFinite(dt)&&isFinite(qt)&&(dt<-Math.PI?dt+=ci:dt>Math.PI&&(dt-=ci),qt<-Math.PI?qt+=ci:qt>Math.PI&&(qt-=ci),dt<=qt?o.theta=Math.max(dt,Math.min(qt,o.theta)):o.theta=o.theta>(dt+qt)/2?Math.max(dt,o.theta):Math.min(qt,o.theta)),o.phi=Math.max(i.minPolarAngle,Math.min(i.maxPolarAngle,o.phi)),o.makeSafe(),i.enableDamping===!0?i.target.addScaledVector(u,i.dampingFactor):i.target.add(u),i.target.sub(i.cursor),i.target.clampLength(i.minTargetRadius,i.maxTargetRadius),i.target.add(i.cursor);let jt=!1;if(i.zoomToCursor&&I||i.object.isOrthographicCamera)o.radius=Z(o.radius);else{const ei=o.radius;o.radius=Z(o.radius*c),jt=ei!=o.radius}if(De.setFromSpherical(o),De.applyQuaternion(ot),ce.copy(i.target).add(De),i.object.lookAt(i.target),i.enableDamping===!0?(l.theta*=1-i.dampingFactor,l.phi*=1-i.dampingFactor,u.multiplyScalar(1-i.dampingFactor)):(l.set(0,0,0),u.set(0,0,0)),i.zoomToCursor&&I){let ei=null;if(i.object.isPerspectiveCamera){const _i=De.length();ei=Z(_i*c);const Mi=_i-ei;i.object.position.addScaledVector(b,Mi),i.object.updateMatrixWorld(),jt=!!Mi}else if(i.object.isOrthographicCamera){const _i=new Ke(y.x,y.y,0);_i.unproject(i.object);const Mi=i.object.zoom;i.object.zoom=Math.max(i.minZoom,Math.min(i.maxZoom,i.object.zoom/c)),i.object.updateProjectionMatrix(),jt=Mi!==i.object.zoom;const vr=new Ke(y.x,y.y,0);vr.unproject(i.object),i.object.position.sub(vr).add(_i),i.object.updateMatrixWorld(),ei=De.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),i.zoomToCursor=!1;ei!==null&&(this.screenSpacePanning?i.target.set(0,0,-1).transformDirection(i.object.matrix).multiplyScalar(ei).add(i.object.position):(mD.origin.copy(i.object.position),mD.direction.set(0,0,-1).transformDirection(i.object.matrix),Math.abs(i.object.up.dot(mD.direction))a||8*(1-be.dot(i.object.quaternion))>a||nt.distanceToSquared(i.target)>a?(i.dispatchEvent(ope),we.copy(i.object.position),be.copy(i.object.quaternion),nt.copy(i.target),!0):!1}})(),this.dispose=function(){i.domElement.removeEventListener("contextmenu",Wt),i.domElement.removeEventListener("pointerdown",at),i.domElement.removeEventListener("pointercancel",me),i.domElement.removeEventListener("wheel",it),i.domElement.removeEventListener("pointermove",Ee),i.domElement.removeEventListener("pointerup",me),i.domElement.getRootNode().removeEventListener("keydown",Dt,{capture:!0}),i._domElementKeyEvents!==null&&(i._domElementKeyEvents.removeEventListener("keydown",Vt),i._domElementKeyEvents=null)};const i=this,r={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6};let n=r.NONE;const a=1e-6,o=new A5,l=new A5;let c=1;const u=new Ke,h=new hi,d=new hi,f=new hi,m=new hi,p=new hi,_=new hi,v=new hi,x=new hi,S=new hi,b=new Ke,y=new hi;let I=!1;const R=[],A={};let P=!1;function w(De){return De!==null?2*Math.PI/60*i.autoRotateSpeed*De:2*Math.PI/60/60*i.autoRotateSpeed}function L(De){const Ct=Math.abs(De*.01);return Math.pow(.95,i.zoomSpeed*Ct)}function k(De){l.theta-=De}function V(De){l.phi-=De}const U=(function(){const De=new Ke;return function(ot,we){De.setFromMatrixColumn(we,0),De.multiplyScalar(-ot),u.add(De)}})(),ne=(function(){const De=new Ke;return function(ot,we){i.screenSpacePanning===!0?De.setFromMatrixColumn(we,1):(De.setFromMatrixColumn(we,0),De.crossVectors(i.object.up,De)),De.multiplyScalar(ot),u.add(De)}})(),oe=(function(){const De=new Ke;return function(ot,we){const be=i.domElement;if(i.object.isPerspectiveCamera){const nt=i.object.position;De.copy(nt).sub(i.target);let ci=De.length();ci*=Math.tan(i.object.fov/2*Math.PI/180),U(2*ot*ci/be.clientHeight,i.object.matrix),ne(2*we*ci/be.clientHeight,i.object.matrix)}else i.object.isOrthographicCamera?(U(ot*(i.object.right-i.object.left)/i.object.zoom/be.clientWidth,i.object.matrix),ne(we*(i.object.top-i.object.bottom)/i.object.zoom/be.clientHeight,i.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),i.enablePan=!1)}})();function le(De){i.object.isPerspectiveCamera||i.object.isOrthographicCamera?c/=De:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),i.enableZoom=!1)}function Y(De){i.object.isPerspectiveCamera||i.object.isOrthographicCamera?c*=De:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),i.enableZoom=!1)}function te(De,Ct){if(!i.zoomToCursor)return;I=!0;const ot=i.domElement.getBoundingClientRect(),we=De-ot.left,be=Ct-ot.top,nt=ot.width,ci=ot.height;y.x=we/nt*2-1,y.y=-(be/ci)*2+1,b.set(y.x,y.y,1).unproject(i.object).sub(i.object.position).normalize()}function Z(De){return Math.max(i.minDistance,Math.min(i.maxDistance,De))}function j(De){h.set(De.clientX,De.clientY)}function G(De){te(De.clientX,De.clientX),v.set(De.clientX,De.clientY)}function J(De){m.set(De.clientX,De.clientY)}function $(De){d.set(De.clientX,De.clientY),f.subVectors(d,h).multiplyScalar(i.rotateSpeed);const Ct=i.domElement;k(2*Math.PI*f.x/Ct.clientHeight),V(2*Math.PI*f.y/Ct.clientHeight),h.copy(d),i.update()}function re(De){x.set(De.clientX,De.clientY),S.subVectors(x,v),S.y>0?le(L(S.y)):S.y<0&&Y(L(S.y)),v.copy(x),i.update()}function ie(De){p.set(De.clientX,De.clientY),_.subVectors(p,m).multiplyScalar(i.panSpeed),oe(_.x,_.y),m.copy(p),i.update()}function ve(De){te(De.clientX,De.clientY),De.deltaY<0?Y(L(De.deltaY)):De.deltaY>0&&le(L(De.deltaY)),i.update()}function Re(De){let Ct=!1;switch(De.code){case i.keys.UP:De.ctrlKey||De.metaKey||De.shiftKey?V(2*Math.PI*i.rotateSpeed/i.domElement.clientHeight):oe(0,i.keyPanSpeed),Ct=!0;break;case i.keys.BOTTOM:De.ctrlKey||De.metaKey||De.shiftKey?V(-2*Math.PI*i.rotateSpeed/i.domElement.clientHeight):oe(0,-i.keyPanSpeed),Ct=!0;break;case i.keys.LEFT:De.ctrlKey||De.metaKey||De.shiftKey?k(2*Math.PI*i.rotateSpeed/i.domElement.clientHeight):oe(i.keyPanSpeed,0),Ct=!0;break;case i.keys.RIGHT:De.ctrlKey||De.metaKey||De.shiftKey?k(-2*Math.PI*i.rotateSpeed/i.domElement.clientHeight):oe(-i.keyPanSpeed,0),Ct=!0;break}Ct&&(De.preventDefault(),i.update())}function Ie(De){if(R.length===1)h.set(De.pageX,De.pageY);else{const Ct=Nt(De),ot=.5*(De.pageX+Ct.x),we=.5*(De.pageY+Ct.y);h.set(ot,we)}}function de(De){if(R.length===1)m.set(De.pageX,De.pageY);else{const Ct=Nt(De),ot=.5*(De.pageX+Ct.x),we=.5*(De.pageY+Ct.y);m.set(ot,we)}}function q(De){const Ct=Nt(De),ot=De.pageX-Ct.x,we=De.pageY-Ct.y,be=Math.sqrt(ot*ot+we*we);v.set(0,be)}function pe(De){i.enableZoom&&q(De),i.enablePan&&de(De)}function Oe(De){i.enableZoom&&q(De),i.enableRotate&&Ie(De)}function Me(De){if(R.length==1)d.set(De.pageX,De.pageY);else{const ot=Nt(De),we=.5*(De.pageX+ot.x),be=.5*(De.pageY+ot.y);d.set(we,be)}f.subVectors(d,h).multiplyScalar(i.rotateSpeed);const Ct=i.domElement;k(2*Math.PI*f.x/Ct.clientHeight),V(2*Math.PI*f.y/Ct.clientHeight),h.copy(d)}function Ve(De){if(R.length===1)p.set(De.pageX,De.pageY);else{const Ct=Nt(De),ot=.5*(De.pageX+Ct.x),we=.5*(De.pageY+Ct.y);p.set(ot,we)}_.subVectors(p,m).multiplyScalar(i.panSpeed),oe(_.x,_.y),m.copy(p)}function tt(De){const Ct=Nt(De),ot=De.pageX-Ct.x,we=De.pageY-Ct.y,be=Math.sqrt(ot*ot+we*we);x.set(0,be),S.set(0,Math.pow(x.y/v.y,i.zoomSpeed)),le(S.y),v.copy(x);const nt=(De.pageX+Ct.x)*.5,ci=(De.pageY+Ct.y)*.5;te(nt,ci)}function lt(De){i.enableZoom&&tt(De),i.enablePan&&Ve(De)}function Ne(De){i.enableZoom&&tt(De),i.enableRotate&&Me(De)}function at(De){i.enabled!==!1&&(R.length===0&&(i.domElement.setPointerCapture(De.pointerId),i.domElement.addEventListener("pointermove",Ee),i.domElement.addEventListener("pointerup",me)),!ct(De)&&(ri(De),De.pointerType==="touch"?ai(De):Xe(De)))}function Ee(De){i.enabled!==!1&&(De.pointerType==="touch"?Ft(De):Fe(De))}function me(De){switch(he(De),R.length){case 0:i.domElement.releasePointerCapture(De.pointerId),i.domElement.removeEventListener("pointermove",Ee),i.domElement.removeEventListener("pointerup",me),i.dispatchEvent(lpe),n=r.NONE;break;case 1:const Ct=R[0],ot=A[Ct];ai({pointerId:Ct,pageX:ot.x,pageY:ot.y});break}}function Xe(De){let Ct;switch(De.button){case 0:Ct=i.mouseButtons.LEFT;break;case 1:Ct=i.mouseButtons.MIDDLE;break;case 2:Ct=i.mouseButtons.RIGHT;break;default:Ct=-1}switch(Ct){case Qb.DOLLY:if(i.enableZoom===!1)return;G(De),n=r.DOLLY;break;case Qb.ROTATE:if(De.ctrlKey||De.metaKey||De.shiftKey){if(i.enablePan===!1)return;J(De),n=r.PAN}else{if(i.enableRotate===!1)return;j(De),n=r.ROTATE}break;case Qb.PAN:if(De.ctrlKey||De.metaKey||De.shiftKey){if(i.enableRotate===!1)return;j(De),n=r.ROTATE}else{if(i.enablePan===!1)return;J(De),n=r.PAN}break;default:n=r.NONE}n!==r.NONE&&i.dispatchEvent(LF)}function Fe(De){switch(n){case r.ROTATE:if(i.enableRotate===!1)return;$(De);break;case r.DOLLY:if(i.enableZoom===!1)return;re(De);break;case r.PAN:if(i.enablePan===!1)return;ie(De);break}}function it(De){i.enabled===!1||i.enableZoom===!1||n!==r.NONE||(De.preventDefault(),i.dispatchEvent(LF),ve(Ye(De)),i.dispatchEvent(lpe))}function Ye(De){const Ct=De.deltaMode,ot={clientX:De.clientX,clientY:De.clientY,deltaY:De.deltaY};switch(Ct){case 1:ot.deltaY*=16;break;case 2:ot.deltaY*=100;break}return De.ctrlKey&&!P&&(ot.deltaY*=10),ot}function Dt(De){De.key==="Control"&&(P=!0,i.domElement.getRootNode().addEventListener("keyup",Lt,{passive:!0,capture:!0}))}function Lt(De){De.key==="Control"&&(P=!1,i.domElement.getRootNode().removeEventListener("keyup",Lt,{passive:!0,capture:!0}))}function Vt(De){i.enabled===!1||i.enablePan===!1||Re(De)}function ai(De){switch(Je(De),R.length){case 1:switch(i.touches.ONE){case Jb.ROTATE:if(i.enableRotate===!1)return;Ie(De),n=r.TOUCH_ROTATE;break;case Jb.PAN:if(i.enablePan===!1)return;de(De),n=r.TOUCH_PAN;break;default:n=r.NONE}break;case 2:switch(i.touches.TWO){case Jb.DOLLY_PAN:if(i.enableZoom===!1&&i.enablePan===!1)return;pe(De),n=r.TOUCH_DOLLY_PAN;break;case Jb.DOLLY_ROTATE:if(i.enableZoom===!1&&i.enableRotate===!1)return;Oe(De),n=r.TOUCH_DOLLY_ROTATE;break;default:n=r.NONE}break;default:n=r.NONE}n!==r.NONE&&i.dispatchEvent(LF)}function Ft(De){switch(Je(De),n){case r.TOUCH_ROTATE:if(i.enableRotate===!1)return;Me(De),i.update();break;case r.TOUCH_PAN:if(i.enablePan===!1)return;Ve(De),i.update();break;case r.TOUCH_DOLLY_PAN:if(i.enableZoom===!1&&i.enablePan===!1)return;lt(De),i.update();break;case r.TOUCH_DOLLY_ROTATE:if(i.enableZoom===!1&&i.enableRotate===!1)return;Ne(De),i.update();break;default:n=r.NONE}}function Wt(De){i.enabled!==!1&&De.preventDefault()}function ri(De){R.push(De.pointerId)}function he(De){delete A[De.pointerId];for(let Ct=0;Ct1)?null:{x:(ZC.x*.5+.5)*WE.width,y:(-ZC.y*.5+.5)*WE.height}}function iLt({target:s=[0,0,0],minDistance:e=120,maxDistance:t=1600,enableDamping:i=!0,dampingFactor:r=.12,enabled:n=!0}){const{camera:a,gl:o}=n1(),l=Te.useRef(null);Te.useEffect(()=>{const u=new K1t(a,o.domElement);return u.enableDamping=i,u.dampingFactor=r,u.minDistance=e,u.maxDistance=t,u.target.set(s[0],s[1],s[2]),u.enabled=n,l.current=u,V0({controlsCount:1}),()=>{u.dispose(),l.current=null,V0({controlsCount:0})}},[a,o]);const c=s.join(",");return Te.useEffect(()=>{l.current&&l.current.target.set(s[0],s[1],s[2])},[c]),Te.useEffect(()=>{l.current&&(l.current.enabled=n)},[n]),D6(()=>{var u;(u=l.current)==null||u.update()}),null}const rLt="lf-vp-core-1.0.0",sLt="2026-07-22T00:00:00Z",_D={react:"18.3.1",reactDom:"18.3.1",three:"0.165.0",fiber:"@react-three/fiber 8.18.0"},iu=[0,-60,0],CE=780,iR={perspective:[iu[0]+509,iu[1]+297,iu[2]+509],front:[0,iu[1],CE],rear:[0,iu[1],-CE],lateral:[CE,iu[1],0],medial:[-CE,iu[1],0],top:[.01,CE,.01],bottom:[.01,-CE-120,.01],fit:[iu[0]+509,iu[1]+297,iu[2]+509],reset:[iu[0]+509,iu[1]+297,iu[2]+509]};function nLt(){return g.jsxs(g.Fragment,{children:[g.jsx("ambientLight",{intensity:.62,color:"#aeb8c6"}),g.jsx("hemisphereLight",{args:["#cdd7e6","#0a0e12",.55]}),g.jsx("directionalLight",{position:[300,500,300],intensity:1.15,color:"#ffffff"}),g.jsx("directionalLight",{position:[-300,220,-220],intensity:.5,color:"#9fb4d4"}),g.jsx("directionalLight",{position:[0,160,-420],intensity:.32,color:"#22d3ee"})]})}function aLt(){return g.jsxs("group",{position:[0,-60,0],children:[g.jsxs("mesh",{position:[0,90,0],children:[g.jsx("cylinderGeometry",{args:[52,64,220,24]}),g.jsx("meshBasicMaterial",{color:"#0e7490"})]}),g.jsxs("mesh",{position:[0,-70,0],children:[g.jsx("cylinderGeometry",{args:[13,13,180,16]}),g.jsx("meshBasicMaterial",{color:"#22d3ee"})]}),g.jsxs("mesh",{position:[0,-185,40],children:[g.jsx("boxGeometry",{args:[60,26,110]}),g.jsx("meshBasicMaterial",{color:"#155e75"})]})]})}class oLt extends Te.Component{constructor(e){super(e),this.state={error:null}}static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e){var t,i;V0({error:"Scene content failed: "+((e==null?void 0:e.message)||String(e))}),(i=(t=this.props).onError)==null||i.call(t)}render(){return this.state.error?null:this.props.children}}function lLt({ortho:s,viewPreset:e}){const{set:t,camera:i,size:r}=n1(),n=Te.useRef(new Ke(...iR.perspective)),a=Te.useRef(new Ke(...iu)),[o,l]=Te.useState(!0);return Te.useEffect(()=>{let c;s?(c=new fC(-360,360,360,-360,-3e3,5e3),c.zoom=.9):c=new Dc(42,1,1,5e3),c.position.set(...iR.perspective),c.lookAt(iu[0],iu[1],iu[2]),t({camera:c})},[s]),Te.useEffect(()=>{if(!(!i||!r.width||!r.height))if(i.isPerspectiveCamera){const c=r.width/r.height;Math.abs(i.aspect-c)>1e-4&&(i.aspect=c,i.updateProjectionMatrix())}else i.isOrthographicCamera&&i.updateProjectionMatrix()},[i,r.width,r.height]),Te.useEffect(()=>{n.current.set(...iR[e]||iR.perspective),l(!0)},[e]),D6(()=>{!i||!o||(i.position.lerp(n.current,.12),i.lookAt(a.current),i.position.distanceTo(n.current)<1.5&&l(!1))}),null}function cLt(){const{camera:s,gl:e,size:t}=n1();return D6(()=>{s&&t.width&&t.height&&V0({camera:s,gl:e,width:t.width,height:t.height,ready:!0,info:{calls:e.info.render.calls,triangles:e.info.render.triangles,geometries:e.info.memory.geometries,textures:e.info.memory.textures}})}),null}function uLt(){const s=n1();return Te.useEffect(()=>{const e=s.domElement,t=r=>{r.preventDefault(),V0({contextLost:!0,error:"WebGL context lost — recovering"})},i=()=>{V0({contextLost:!1,error:null})};return e.addEventListener("webglcontextlost",t),e.addEventListener("webglcontextrestored",i),()=>{e.removeEventListener("webglcontextlost",t),e.removeEventListener("webglcontextrestored",i)}},[s]),null}function hLt({viewPreset:s="perspective",ortho:e=!1,onBackgroundClick:t,children:i,onCoreFailure:r}){const[n,a]=Te.useState(!1);return g.jsxs(q1t,{shadows:!1,dpr:[1,2],gl:{antialias:!0,alpha:!1,powerPreference:"high-performance"},camera:{position:iR.perspective,fov:42,near:1,far:5e3},onCreated:({gl:o})=>o.setClearColor("#0b0f13"),onPointerMissed:()=>t==null?void 0:t(),style:{width:"100%",height:"100%",display:"block",touchAction:"none"},children:[g.jsx(lLt,{ortho:e,viewPreset:s}),g.jsx(cLt,{}),g.jsx(uLt,{}),g.jsx(nLt,{}),g.jsx("gridHelper",{args:[1600,32,"#22d3ee","#1a2530"],position:[0,-312,0]}),g.jsx("axesHelper",{args:[60],position:[-180,-310,-180]}),g.jsx(iLt,{target:iu,minDistance:120,maxDistance:1600}),n&&g.jsx(aLt,{}),g.jsx(Te.Suspense,{fallback:null,children:g.jsx(oLt,{onError:()=>{a(!0),r==null||r()},children:i})})]},"stable-viewport-core")}const hpe={cyan:"border-cyan-400/55 bg-[#0b0f13]/95 text-cyan-200",amber:"border-amber-400/55 bg-[#0b0f13]/95 text-amber-300",purple:"border-purple-400/55 bg-[#0b0f13]/95 text-purple-200",red:"border-red-400/55 bg-[#0b0f13]/95 text-red-300",slate:"border-white/15 bg-[#0b0f13]/95 text-slate-200"};function dLt(){const[,s]=Te.useState(0),e=Te.useRef(0);Te.useEffect(()=>{const i=()=>{s(r=>r+1&65535),e.current=requestAnimationFrame(i)};return e.current=requestAnimationFrame(i),()=>cancelAnimationFrame(e.current)},[]);const t=eLt();return g.jsx("div",{className:"pointer-events-none absolute inset-0 overflow-hidden",children:t.map(i=>{const r=tLt(i.position);if(!r)return null;const n=hpe[i.tone]||hpe.slate;return g.jsx("div",{className:"absolute -translate-x-1/2 -translate-y-1/2 whitespace-nowrap rounded-lg border px-2.5 py-1 text-xs shadow-lg",style:{left:r.x,top:r.y,...i.offset?{marginLeft:i.offset.x,marginTop:i.offset.y}:{}},children:g.jsxs("div",{className:n,children:[i.badge&&g.jsx("span",{className:"mr-1.5 inline-flex h-4 w-4 items-center justify-center rounded-full bg-cyan-400/20 text-[9px] font-bold text-cyan-300",children:i.badge}),g.jsx("span",{className:"font-semibold text-slate-100",children:i.title}),i.subtitle&&g.jsx("div",{className:"mt-0.5 text-[10px] font-normal opacity-90",children:i.subtitle})]})},i.id)})})}function fLt({label:s,value:e,ok:t}){return g.jsxs("div",{className:"flex items-center justify-between border-b border-white/5 py-1.5 text-xs",children:[g.jsx("span",{className:"text-slate-400",children:s}),g.jsx("span",{className:t===!1?"font-semibold text-amber-300":t===!0?"font-semibold text-emerald-300":"font-mono text-slate-200",children:e})]})}function pLt({open:s,onClose:e,onResetCamera:t,onDisableLayers:i,onReloadLayers:r}){const[,n]=Te.useState(0),a=Te.useRef(0);if(Te.useEffect(()=>{if(!s)return;const h=()=>{n(d=>d+1&65535),a.current=requestAnimationFrame(h)};return a.current=requestAnimationFrame(h),()=>cancelAnimationFrame(a.current)},[s]),!s)return null;const o=Q1t(),l=o.info||{},c=[["App build ID",rLt],["Build timestamp",sLt],["React",_D.react],["ReactDOM",_D.reactDom],["Three.js",_D.three],["React Three Fiber",_D.fiber],["Drei (core)","not imported"],["WebGL context",o.contextLost?"Lost — recovering":o.ready?"Active":"Initialising"],["Renderer",o.gl?o.gl.constructor.name:"—"],["Camera",o.camera?o.camera.constructor.name:"—"],["Canvas count","1 (locked)"],["Controls instances",o.controlsCount],["Draw calls",l.calls??"—"],["Triangles",l.triangles??"—"],["Geometry count",l.geometries??"—"],["Texture count",l.textures??"—"],["Procedural fallback","Loaded"],["Last viewport error",o.error||"—"],["Last context-loss event",o.contextLost?"recorded":"none"]],u=()=>{var d;const h=c.map(([f,m])=>`${f}: ${m}`).join(`
034474: `);(d=navigator.clipboard)==null||d.writeText(h).catch(()=>{})};return g.jsx("div",{className:"fixed inset-0 z-50 flex justify-end bg-black/40",onClick:e,children:g.jsxs("div",{className:"h-full w-[90vw] max-w-sm overflow-y-auto border-l border-white/10 bg-[#0d1318] p-4",onClick:h=>h.stopPropagation(),children:[g.jsxs("div",{className:"mb-3 flex items-center justify-between",children:[g.jsx("h3",{className:"text-sm font-semibold text-white",children:"Viewport Diagnostics"}),g.jsx("button",{onClick:e,className:"icon-btn !min-h-9 !min-w-9",children:"✕"})]}),g.jsx("div",{className:"panel mb-3 p-3",children:c.map(([h,d])=>g.jsx(fLt,{label:h,value:String(d),ok:h==="WebGL context"?o.contextLost?!1:o.ready:h==="Controls instances"?o.controlsCount===1:void 0},h))}),g.jsxs("div",{className:"flex flex-wrap gap-2",children:[g.jsx("button",{onClick:u,className:"btn-secondary !px-3",children:"Copy Diagnostics"}),g.jsx("button",{onClick:t,className:"btn-secondary !px-3",children:"Reset Camera"}),g.jsx("button",{onClick:i,className:"btn-secondary !px-3",children:"Disable Optional Layers"}),g.jsx("button",{onClick:r,className:"btn-secondary !px-3",children:"Reload Optional Layers"})]}),g.jsx("p",{className:"mt-3 text-[10px] text-slate-500",children:"StableViewportCore is locked. Optional feature failures disable only the failed layer — the procedural prosthetic stays visible."})]})})}const mLt=[{height:0,width:26,depth:24,name:"Bottom Boundary"},{height:50,width:30,depth:28,name:"Pylon Diameter"},{height:110,width:84,depth:72,name:"Socket Distal Station"},{height:180,width:92,depth:80,name:"Socket Mid Station"},{height:240,width:78,depth:68,name:"Socket Upper Station"},{height:300,width:62,depth:56,name:"Top Boundary"}];function zI(s){return!s||s.length===0?mLt.map(e=>({...e,fictional:!0,hasValue:!0})):[...s].sort((e,t)=>(e.height_from_origin_mm??e.height??0)-(t.height_from_origin_mm??t.height??0)).map(e=>{const t=e.total_width_mm||(e.max_medial_mm||0)+(e.max_lateral_mm||0),i=e.total_depth_mm||(e.max_anterior_mm||0)+(e.max_posterior_mm||0),r=!!(t&&t>0)&&!!(i&&i>0);return{height:e.height_from_origin_mm??e.height??0,width:r?t:t||60,depth:r?i:i||60,name:e.station_name||"",uuid:e.uuid,fictional:!1,hasValue:r}})}function hNe(s,e=48){const t=zI(s);if(t.length<2)return new yy(40,55,300,e);const i=[],r=[];for(const h of t)for(let d=0;d<=e;d++){const f=d/e*Math.PI*2;i.push(h.width/2*Math.cos(f),h.height,h.depth/2*Math.sin(f))}for(let h=0;h{if(!s)return null;try{return new v6(s,i)}catch{return null}},[s,i]);return r?g.jsx("lineSegments",{geometry:r,raycast:()=>null,children:g.jsx("lineBasicMaterial",{color:e,transparent:!0,opacity:t,depthWrite:!1})}):null}function hb(s){const e=Te.useRef([]);Te.useLayoutEffect(()=>{for(const i of e.current)upe(i);const t=[];for(const i of s)!i||!i.id||(J1t(i.id,i),t.push(i.id));e.current=t}),Te.useEffect(()=>()=>{for(const t of e.current)upe(t);e.current=[]},[])}const Ul={socket:"#3f474f",socketEdge:"#717a86",liner:"#717a86",adapter:"#9aa3ad",pylon:"#2a3038",clamp:"#c2cad2",ankle:"#8a929c",foot:"#3f474f",footEdge:"#7a8390",accent:"#22d3ee"};function _Lt(){const r=new PS,n=-48/2,a=48/2,o=0,l=100;r.moveTo(n+16,o),r.lineTo(a-16,o),r.absarc(a-16,o+16,16,-Math.PI/2,0,!1),r.lineTo(a,l-26),r.absarc(a-26,l-26,26,0,Math.PI/2,!1),r.lineTo(n+26,l),r.absarc(n+26,l-26,26,Math.PI/2,Math.PI,!1),r.lineTo(n,o+16),r.absarc(n+16,o+16,16,Math.PI,3*Math.PI/2,!1);const c=new nP(r,{depth:16,bevelEnabled:!0,bevelThickness:2.5,bevelSize:2.5,bevelSegments:2,curveSegments:16});return c.translate(0,0,-8),c.rotateX(Math.PI/2),c.computeVertexNormals(),c}function RE({color:s,metalness:e,roughness:t,selected:i,opacity:r,emissiveBoost:n=.28}){return g.jsx("meshStandardMaterial",{color:i?"#5a6470":s,metalness:e,roughness:t,transparent:r<1,opacity:r,emissive:i?Ul.accent:"#000000",emissiveIntensity:i?n:0})}function gLt({stations:s,selectedId:e,onSelect:t,opacity:i=1,onPaint:r}){const n=Te.useMemo(()=>hNe(s),[s]),a=Te.useMemo(()=>_Lt(),[]),l=-150-8,c=l-9,u=c-70,h=u-7,d=h-9,f=-267,m=R=>e===`part-${R}`,p=(R,A)=>P=>{if(r){P.stopPropagation(),r(P.point);return}P.stopPropagation(),t==null||t("part",R,{partId:R,label:A})},_=m("socket"),v=m("residual"),x=m("adapter"),S=m("pylon"),b=m("clamp"),y=m("ankle"),I=m("foot");return hb([{id:"asm-disclaimer",position:[0,224,0],title:"Generic visual measurement model",subtitle:"dimensions must be verified before CAD",tone:"amber"}]),g.jsxs("group",{children:[g.jsxs("group",{onClick:p("residual","Residual Limb / Liner"),children:[g.jsxs("mesh",{position:[0,172,0],children:[g.jsx("cylinderGeometry",{args:[25,34,52,32]}),g.jsx(RE,{color:Ul.liner,metalness:0,roughness:.92,selected:v,opacity:i})]}),g.jsxs("mesh",{position:[0,200,0],children:[g.jsx("sphereGeometry",{args:[26,24,20]}),g.jsx(RE,{color:Ul.liner,metalness:0,roughness:.92,selected:v,opacity:i})]})]}),g.jsxs("mesh",{geometry:n,onClick:p("socket","Socket"),onPointerDown:r?R=>{R.stopPropagation(),r(R.point)}:void 0,children:[g.jsx("meshStandardMaterial",{color:_?"#525c68":Ul.socket,metalness:.18,roughness:.62,transparent:i<1,opacity:i,emissive:_?Ul.accent:"#000000",emissiveIntensity:_?.22:0}),g.jsx(WI,{geometry:n,color:_?Ul.accent:Ul.socketEdge,opacity:i*.95})]}),g.jsxs("mesh",{position:[0,150,0],rotation:[Math.PI/2,0,0],onClick:p("socket","Socket"),raycast:()=>null,children:[g.jsx("torusGeometry",{args:[52,3.2,14,56]}),g.jsx("meshStandardMaterial",{color:_?Ul.accent:"#5b6470",metalness:.25,roughness:.5,transparent:i<1,opacity:i,emissive:_?Ul.accent:"#000000",emissiveIntensity:_?.3:0})]}),g.jsxs("mesh",{position:[0,l,0],onClick:p("adapter","Distal Socket Adapter"),children:[g.jsx("cylinderGeometry",{args:[24,28,16,32]}),g.jsx(RE,{color:Ul.adapter,metalness:.85,roughness:.4,selected:x,opacity:i})]}),g.jsxs("mesh",{position:[0,l,0],rotation:[Math.PI/2,0,0],raycast:()=>null,children:[g.jsx("torusGeometry",{args:[28,2,8,36]}),g.jsx("meshStandardMaterial",{color:Ul.accent,emissive:Ul.accent,emissiveIntensity:.3,transparent:i<1,opacity:i})]}),g.jsxs("mesh",{position:[0,(c+u)/2,0],onClick:p("pylon","Pylon"),children:[g.jsx("cylinderGeometry",{args:[13,13,70,28]}),g.jsx(RE,{color:Ul.pylon,metalness:.9,roughness:.22,selected:S,opacity:i,emissiveBoost:.3})]}),g.jsxs("mesh",{position:[0,h,0],onClick:p("clamp","Tube Clamp"),children:[g.jsx("cylinderGeometry",{args:[20,20,14,28]}),g.jsx(RE,{color:Ul.clamp,metalness:.9,roughness:.28,selected:b,opacity:i})]}),g.jsxs("mesh",{position:[19,h,0],rotation:[0,0,Math.PI/2],raycast:()=>null,children:[g.jsx("cylinderGeometry",{args:[4,4,10,12]}),g.jsx("meshStandardMaterial",{color:Ul.adapter,metalness:.85,roughness:.35,transparent:i<1,opacity:i})]}),g.jsxs("mesh",{position:[-19,h,0],rotation:[0,0,Math.PI/2],raycast:()=>null,children:[g.jsx("cylinderGeometry",{args:[4,4,10,12]}),g.jsx("meshStandardMaterial",{color:Ul.adapter,metalness:.85,roughness:.35,transparent:i<1,opacity:i})]}),g.jsxs("mesh",{position:[0,d,0],onClick:p("ankle","Ankle Adapter"),children:[g.jsx("cylinderGeometry",{args:[22,17,12,28]}),g.jsx(RE,{color:Ul.ankle,metalness:.85,roughness:.35,selected:y,opacity:i})]}),g.jsx("group",{position:[0,f,0],onClick:p("foot","Foot"),children:g.jsxs("mesh",{geometry:a,children:[g.jsx("meshStandardMaterial",{color:I?"#525c68":Ul.foot,metalness:.2,roughness:.6,transparent:i<1,opacity:i,emissive:I?Ul.accent:"#000000",emissiveIntensity:I?.22:0}),g.jsx(WI,{geometry:a,color:I?Ul.accent:Ul.footEdge,opacity:i*.95})]})})]})}function gD(s,e){const t=s==null?void 0:s.find(i=>i.dimension_key===e||i.dimension_name===e);return t==null?void 0:t.value_mm}function vLt({component:s,dimensions:e,selected:t=!1,onSelect:i,opacity:r=1,showPivot:n=!0,onPaint:a}){const{height:o,width:l,depth:c}=Te.useMemo(()=>({height:gD(e,"overall_height")||gD(e,"system_height_mm")||130,width:gD(e,"overall_max_width")||82,depth:gD(e,"overall_max_depth")||72}),[e]),u=Te.useMemo(()=>new ex(l,o,c),[l,o,c]),h=d=>{if(a){d.stopPropagation(),a(d.point);return}d.stopPropagation(),i==null||i("component",s)};return hb([{id:"cmp-pivot",position:[8,0,0],title:"Pivot",tone:"cyan"},{id:"cmp-proximal",position:[0,o/2+14,0],title:"Proximal",tone:"slate"},{id:"cmp-distal",position:[0,-o/2-14,0],title:"Distal",tone:"slate"},{id:"cmp-button",position:[0,o/2-5,c/2+8],title:"Button",tone:"amber"}]),g.jsxs("group",{children:[g.jsxs("mesh",{geometry:u,onClick:h,onPointerDown:a?d=>{d.stopPropagation(),a(d.point)}:void 0,children:[g.jsx("meshStandardMaterial",{color:t?"#3a4a5a":"#2a3038",metalness:.7,roughness:.35,transparent:r<1,opacity:r,emissive:t?"#22d3ee":"#000000",emissiveIntensity:t?.12:0}),g.jsx(WI,{geometry:u,color:t?"#22d3ee":"#4a5560",opacity:r*.8})]}),n&&g.jsx("group",{children:g.jsxs("mesh",{position:[0,0,0],children:[g.jsx("sphereGeometry",{args:[5,16,16]}),g.jsx("meshStandardMaterial",{color:"#22d3ee",emissive:"#22d3ee",emissiveIntensity:.6})]})}),g.jsxs("mesh",{position:[0,o/2+4,0],children:[g.jsx("cylinderGeometry",{args:[l/3.5,l/3.5,12,24]}),g.jsx("meshStandardMaterial",{color:"#3a4550",metalness:.85,roughness:.25})]}),g.jsxs("mesh",{position:[0,-o/2-4,0],children:[g.jsx("cylinderGeometry",{args:[l/4.5,l/4.5,12,24]}),g.jsx("meshStandardMaterial",{color:"#3a4550",metalness:.85,roughness:.25})]}),g.jsxs("mesh",{position:[0,o/2-5,c/2+1],children:[g.jsx("boxGeometry",{args:[10,6,3]}),g.jsx("meshStandardMaterial",{color:"#22d3ee",emissive:"#22d3ee",emissiveIntensity:.3})]})]})}function xLt({stations:s,selectedId:e,onSelect:t,visible:i=!0,highlightedIndex:r=-1}){var u,h;const n=zI(s),a=((u=n[0])==null?void 0:u.height)||0,o=((h=n[n.length-1])==null?void 0:h.height)||300,l=(a+o)/2,c=i?n.map((d,f)=>{const m=d.height-l,p=Math.max(d.width,d.depth)/2+4,_=e===`station-${f}`||r===f,v=String(f+1).padStart(2,"0"),x=d.fictional?`Ø ${d.width.toFixed(0)} × ${d.depth.toFixed(0)} mm · visual test data`:d.hasValue?`Ø ${d.width.toFixed(0)} × ${d.depth.toFixed(0)} mm`:"Measurement required";return{id:`ring-${f}`,position:[p+26,m,0],badge:v,title:d.name||`Station ${v}`,subtitle:x,tone:_?"cyan":"slate"}}):[];return hb(c),i?g.jsx("group",{children:n.map((d,f)=>{const m=d.height-l,p=Math.max(d.width,d.depth)/2+4,_=e===`station-${f}`||r===f;String(f+1).padStart(2,"0");const v=p+6,x=p+3;return g.jsxs("group",{position:[0,m,0],children:[g.jsxs("mesh",{rotation:[Math.PI/2,0,0],onClick:S=>{S.stopPropagation(),t==null||t("station",f,{...n[f],index:f})},children:[g.jsx("torusGeometry",{args:[p,_?2.6:1.8,12,80]}),g.jsx("meshStandardMaterial",{color:_?"#22d3ee":"#0e7490",emissive:_?"#22d3ee":"#0e7490",emissiveIntensity:_?1.5:.45,transparent:!0,opacity:_?.98:.8})]}),g.jsxs("mesh",{rotation:[Math.PI/2,0,0],raycast:()=>null,children:[g.jsx("cylinderGeometry",{args:[.7,.7,p*2,6]}),g.jsx("meshBasicMaterial",{color:_?"#22d3ee":"#0e7490",transparent:!0,opacity:_?.6:.35})]}),g.jsxs("mesh",{position:[x,0,0],onClick:S=>{S.stopPropagation(),t==null||t("station",f,{...n[f],index:f})},children:[g.jsx("sphereGeometry",{args:[_?5:4,18,18]}),g.jsx("meshStandardMaterial",{color:_?"#22d3ee":"#0b4a5a",emissive:_?"#22d3ee":"#0e7490",emissiveIntensity:_?1.2:.5})]}),g.jsxs("mesh",{position:[v+6,0,0],rotation:[0,0,Math.PI/2],raycast:()=>null,children:[g.jsx("cylinderGeometry",{args:[.5,.5,14,6]}),g.jsx("meshBasicMaterial",{color:_?"#22d3ee":"#3a4550",transparent:!0,opacity:.7})]})]},f)})}):null}const dNe="#f59e0b",fNe="#ef4444",SLt={"No contact":"#ef4444","Extra clearance":"#f97316","Raised scar":"#eab308","Pinch spot":"#a855f7","Painful area":"#eab308","Moving skin":"#a855f7","Skin fold":"#a855f7","Heat-sensitive area":"#ef4444","Mechanical keep-out":"#6b7280","Safe attachment zone":"#3b82f6",Custom:"#22d3ee"};function dpe({id:s,zone:e,color:t,y:i,selected:r,onSelect:n,label:a}){const o=e.width_mm||35,l=e.height_mm||35,c=e.depth_mm||35,u=Te.useMemo(()=>new ex(o,l,c),[o,l,c]);return hb([{id:s,position:[o/2+4,i+l/2,0],title:a||e.name,tone:t===dNe?"amber":t===fNe?"red":"purple"}]),g.jsx("group",{position:[0,i,0],children:g.jsxs("mesh",{geometry:u,onClick:h=>{h.stopPropagation(),n()},children:[g.jsx("meshStandardMaterial",{color:t,transparent:!0,opacity:r?.5:.26,emissive:r?t:"#000000",emissiveIntensity:r?.3:0,depthWrite:!1}),g.jsx(WI,{geometry:u,color:t,opacity:.9})]})})}function bLt({accessPoints:s=[],keepOutZones:e=[],sensitiveZones:t=[],showAccess:i=!0,showKeepOut:r=!0,showSensitive:n=!0,selectedId:a,onSelect:o}){return g.jsxs("group",{children:[i&&s.map((l,c)=>g.jsx(dpe,{id:`lbl-access-${c}`,zone:l,color:dNe,y:90-c*32,selected:a===`access-${c}`,onSelect:()=>o==null?void 0:o("access",c,l),label:l.name},`a-${c}`)),r&&e.map((l,c)=>g.jsx(dpe,{id:`lbl-keepout-${c}`,zone:l,color:fNe,y:40-c*32,selected:a===`keepout-${c}`,onSelect:()=>o==null?void 0:o("keepout",c,l),label:l.name},`k-${c}`)),n&&t.map((l,c)=>{const u=SLt[l.type]||"#22d3ee";return g.jsxs("mesh",{position:l.position||[0,0,0],onClick:h=>{h.stopPropagation(),o==null||o("sensitive",c,l)},children:[g.jsx("sphereGeometry",{args:[l.brushSize||15,16,16]}),g.jsx("meshStandardMaterial",{color:u,transparent:!0,opacity:a===`sensitive-${c}`?.6:.35,emissive:u,emissiveIntensity:.2,depthWrite:!1})]},`s-${c}`)})]})}function FF({start:s=[0,0,0],end:e=[0,1,0],color:t="#22d3ee",radius:i=.9,dashed:r=!1}){const{position:n,length:a,quaternion:o}=Te.useMemo(()=>{const l=new Ke(...s),c=new Ke(...e),u=new Ke().subVectors(c,l),h=u.length()||.001,d=new Ke().addVectors(l,c).multiplyScalar(.5),f=new Ou().setFromUnitVectors(new Ke(0,1,0),u.normalize());return{position:[d.x,d.y,d.z],length:h,quaternion:[f.x,f.y,f.z,f.w]}},[s,e]);return g.jsxs("mesh",{position:n,quaternion:o,raycast:()=>null,children:[g.jsx("cylinderGeometry",{args:[i,i,a,6]}),g.jsx("meshBasicMaterial",{color:t,transparent:!0,opacity:.9,depthWrite:!1})]})}function TLt({dimensions:s,stations:e,visible:t=!0}){const{labels:i,mid:r}=Te.useMemo(()=>{var m,p;const c=zI(e),u=((m=c[0])==null?void 0:m.height)||0,h=((p=c[c.length-1])==null?void 0:p.height)||300,d=(u+h)/2;return{labels:(s||[]).filter(_=>_.value_mm!=null&&_.category==="External envelope").slice(0,6),mid:d}},[s,e]),n=i.find(c=>c.dimension_key==="overall_height"),a=i.find(c=>c.dimension_key==="overall_max_width"),o=i.find(c=>c.dimension_key==="overall_max_depth"),l=[];return t&&(n&&l.push({id:"dim-h",position:[-100,r+130,0],title:"H "+n.value_mm.toFixed(0)+" mm",tone:"cyan"}),a&&l.push({id:"dim-w",position:[60,r+120,0],title:"W "+a.value_mm.toFixed(0)+" mm",tone:"cyan"}),o&&l.push({id:"dim-d",position:[0,r-120,55],title:"D "+o.value_mm.toFixed(0)+" mm",tone:"cyan"})),hb(l),!t||i.length===0?null:g.jsxs("group",{children:[n&&g.jsx("group",{position:[-100,r,0],children:g.jsx(FF,{start:[0,-120,0],end:[0,120,0],color:"#22d3ee",radius:.8})}),a&&g.jsx("group",{position:[0,r+120,0],children:g.jsx(FF,{start:[-50,0,0],end:[50,0,0],color:"#22d3ee",radius:.8})}),o&&g.jsx("group",{position:[0,r-120,0],children:g.jsx(FF,{start:[0,0,-45],end:[0,0,45],color:"#22d3ee",radius:.8})})]})}function yLt({stations:s,visible:e=!0,opacity:t=.3,clearance:i=6,thickness:r=3,conceptual:n=!0,selectedId:a,onSelect:o}){const{geometry:l,totalHeight:c}=Te.useMemo(()=>{const p=zI(s),_=p.map(y=>({...y,width:y.width+i*2,depth:y.depth+i*2})),v=p[0];_.unshift({height:((v==null?void 0:v.height)??0)-110,width:40+i*2,depth:36+i*2});const x=hNe(_),S=_[0].height,b=_[_.length-1].height;return{geometry:x,midHeight:(S+b)/2,totalHeight:b-S}},[s,i]),u=-c/2,h=c,d=Te.useMemo(()=>{const p=zI(s);return Math.max(...p.map(_=>Math.max(_.width,_.depth)/2+i),30)},[s,i]),f=a==="cover-preview";if(hb(e?[{id:"cover-warn",position:[0,u-14,0],title:"Conceptual cover preview — not manufacturing geometry",tone:"amber"}]:[]),!e)return null;const m=p=>{p.stopPropagation(),o==null||o("cover","preview",{partId:"cover-preview",label:"Conceptual Cover"})};return g.jsxs("group",{children:[g.jsxs("mesh",{geometry:l,onClick:m,children:[g.jsx("meshPhysicalMaterial",{color:f?"#22d3ee":"#28323d",transparent:!0,opacity:t,metalness:.06,roughness:.34,clearcoat:.35,clearcoatRoughness:.35,side:km,emissive:f?"#22d3ee":"#0a1018",emissiveIntensity:f?.12:.03,depthWrite:!1}),g.jsx(WI,{geometry:l,color:f?"#22d3ee":"#5a6675",opacity:t*1.6})]}),g.jsxs("mesh",{position:[0,0,d],raycast:()=>null,children:[g.jsx("cylinderGeometry",{args:[1.1,1.1,h,8]}),g.jsx("meshStandardMaterial",{color:"#22d3ee",emissive:"#22d3ee",emissiveIntensity:.6,transparent:!0,opacity:.85})]}),g.jsxs("mesh",{position:[0,0,-d],raycast:()=>null,children:[g.jsx("cylinderGeometry",{args:[1.1,1.1,h,8]}),g.jsx("meshStandardMaterial",{color:"#22d3ee",emissive:"#22d3ee",emissiveIntensity:.6,transparent:!0,opacity:.85})]})]})}function ELt({positions:s,visible:e=!0,selectedAngle:t,onSelect:i,envelopeOnly:r=!1}){const n=s&&s.length>0,{angles:a,maxAngle:o,maxRadius:l,arcGeom:c,markers:u}=Te.useMemo(()=>{const f=(s||[]).map(S=>S.angle_degrees??0).sort((S,b)=>S-b),m=Math.max(...f,90),p=Math.max(...(s||[]).map(S=>S.max_width_mm||S.front_most_mm||50),50)+10,_=[];for(let S=0;S<=m;S+=3){const b=S*Math.PI/180;_.push(new Ke(Math.sin(b)*p,-Math.cos(b)*p+20,0))}const v=new Us().setFromPoints(_),x=(s||[]).map((S,b)=>{const y=S.angle_degrees??0,I=y*Math.PI/180,R=(S.max_width_mm||50)+5;return{index:b,pos:[Math.sin(I)*R,-Math.cos(I)*R+20,0],deg:y,name:S.position_name||`${y}°`,p:S}});return{angles:f,maxAngle:m,maxRadius:p,arcGeom:v,markers:x}},[s]),h=40,d=[];if(e&&n){for(const f of u){const m=t===f.deg;d.push({id:`mv-${f.index}`,position:[f.pos[0],h+f.pos[1],f.pos[2]],title:f.name,tone:m?"cyan":"slate"})}r||d.push({id:"mv-summary",position:[0,h-l-10,0],title:`Movement envelope: ${a.length} positions recorded`,tone:"cyan"})}return hb(d),!e||!n?null:g.jsxs("group",{position:[0,h,0],children:[g.jsx("line",{geometry:c,raycast:()=>null,children:g.jsx("lineBasicMaterial",{color:"#22d3ee",transparent:!0,opacity:.6})}),u.map(f=>{const m=t===f.deg;return g.jsx("group",{position:f.pos,children:g.jsxs("mesh",{onClick:p=>{p.stopPropagation(),i==null||i("movement",f.index,f.p)},children:[g.jsx("sphereGeometry",{args:[m?6:4,16,16]}),g.jsx("meshStandardMaterial",{color:m?"#22d3ee":"#0e7490",emissive:m?"#22d3ee":"#0e7490",emissiveIntensity:m?.8:.4})]})},f.index)})]})}function CLt({visible:s=!0,position:e=[0,30,72],selectedId:t,onSelect:i}){const r=t==="logo-mark",n=a=>{a.stopPropagation(),i==null||i("logo","mark",{partId:"logo-mark",label:"SHiRE Logo"})};return hb(s?[{id:"logo-mark",position:e,title:"SHiRE",tone:"cyan"}]:[{id:"logo-warn",position:e,title:"⚠ SHiRE logo hidden — mandatory branding not shown",tone:"amber"}]),g.jsx("group",{position:e,children:g.jsxs("mesh",{onClick:n,children:[g.jsx("boxGeometry",{args:[52,18,4]}),g.jsx("meshBasicMaterial",{color:"#22d3ee",transparent:!0,opacity:r?.14:.06})]})})}class IE extends Te.Component{constructor(e){super(e),this.state={error:null}}static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e){console.warn("[SceneFeatureBoundary]",this.props.name,(e==null?void 0:e.message)||e)}render(){if(this.state.error){const e=this.props.warningPosition||[0,200,0];return g.jsxs("mesh",{position:e,raycast:()=>null,children:[g.jsx("sphereGeometry",{args:[7,14,14]}),g.jsx("meshBasicMaterial",{color:"#f59e0b",wireframe:!0,transparent:!0,opacity:.8})]})}return this.props.children}}function RLt({mode:s="limb",component:e,dimensions:t,stations:i,accessPoints:r,keepOutZones:n,movementPositions:a,sensitiveZones:o,selectedId:l,onSelect:c,highlightedStation:u=-1,selectedAngle:h,show:d={},transparency:f=1,coverClearance:m=6,coverThickness:p=3,logoPosition:_=[0,30,72],onPaint:v,paintColor:x,compatibility:S=!1}){const b=S?1:f,y=S?{...d,cover:!1,movement:!1,sensitive:!1,logo:!0}:d;return g.jsxs("group",{children:[s==="component"&&e?g.jsx(vLt,{component:e,dimensions:t,selected:l==="component",onSelect:c,opacity:b,onPaint:v}):g.jsx(gLt,{stations:i,selectedId:l,onSelect:c,opacity:b,onPaint:v}),g.jsx(IE,{name:"Measurement rings",children:g.jsx(xLt,{stations:i,selectedId:l,onSelect:c,visible:y.measurements,highlightedIndex:u})}),g.jsx(IE,{name:"Dimension labels",children:g.jsx(TLt,{dimensions:t,stations:i,visible:y.measurements})}),g.jsx(IE,{name:"Zones",children:g.jsx(bLt,{accessPoints:r,keepOutZones:n,sensitiveZones:o,showAccess:y.access,showKeepOut:y.keepOut,showSensitive:y.sensitive,selectedId:l,onSelect:c})}),g.jsx(IE,{name:"Movement envelope",warningPosition:[0,230,0],children:g.jsx(ELt,{positions:a,visible:y.movement,selectedAngle:h,onSelect:c})}),g.jsx(IE,{name:"Conceptual cover",warningPosition:[0,-200,0],children:g.jsx(yLt,{stations:i,visible:y.cover,opacity:.3*(S?1:f),clearance:m,thickness:p,conceptual:!0,selectedId:l,onSelect:c})}),g.jsx(IE,{name:"SHiRE logo",warningPosition:_,children:g.jsx(CLt,{visible:y.logo,position:_,selectedId:l,onSelect:c})})]})}function ILt({type:s,category:e}){return s==="customer"?g.jsx(Bm,{className:"h-4 w-4 text-slate-400"}):s==="limb"?g.jsx(Rv,{className:"h-4 w-4 text-cyan-400"}):s==="prosthesis"?g.jsx(Bm,{className:"h-4 w-4 text-cyan-400"}):s==="project"?g.jsx(Rv,{className:"h-4 w-4 text-violet-400"}):s==="session"?g.jsx(bD,{className:"h-4 w-4 text-emerald-400"}):s==="component"?g.jsx(Bm,{className:"h-4 w-4 text-slate-400"}):s==="sensitive"?g.jsx(bD,{className:"h-4 w-4 text-purple-400"}):s==="access"?g.jsx(W8,{className:"h-4 w-4 text-amber-400"}):s==="keepout"?g.jsx(W8,{className:"h-4 w-4 text-red-400"}):s==="cover"?g.jsx(z0,{className:"h-4 w-4 text-cyan-400"}):s==="logo"?g.jsx("span",{className:"text-[9px] font-bold tracking-wider text-cyan-300",children:"S"}):s==="assembly-group"?g.jsx(Rv,{className:"h-4 w-4 text-cyan-300"}):s==="part"?g.jsx(Bm,{className:"h-4 w-4 text-cyan-400"}):s==="stations-group"?g.jsx(bD,{className:"h-4 w-4 text-slate-400"}):g.jsx(Bm,{className:"h-4 w-4 text-slate-400"})}function pNe({node:s,depth:e,selectedId:t,onSelect:i,visibility:r,onToggleVisible:n,onAction:a}){var h,d;const[o,l]=Te.useState(e<2),c=t===`${s.type}-${s.uuid||s.id}`,u=r[s.uuid||s.id]!==!1;return g.jsxs("div",{children:[g.jsxs("div",{className:`group flex items-center gap-1 rounded-lg px-2 py-1.5 text-sm transition ${c?"bg-cyan-400/15 text-cyan-300":"text-slate-300 hover:bg-white/5"}`,style:{paddingLeft:e*16+8},onClick:()=>i(s),children:[((h=s.children)==null?void 0:h.length)>0?g.jsx("button",{onClick:f=>{f.stopPropagation(),l(!o)},className:"shrink-0 text-slate-500 hover:text-cyan-300",children:o?g.jsx(qO,{className:"h-3.5 w-3.5"}):g.jsx(kT,{className:"h-3.5 w-3.5"})}):g.jsx("span",{className:"w-3.5 shrink-0"}),g.jsx("span",{className:"shrink-0",children:g.jsx(ILt,{type:s.type,category:s.category})}),g.jsx("span",{className:"flex-1 truncate",children:s.label}),g.jsx("button",{onClick:f=>{f.stopPropagation(),n(s)},className:"shrink-0 opacity-0 transition group-hover:opacity-100",children:u?g.jsx(HS,{className:"h-3.5 w-3.5"}):g.jsx(Kpe,{className:"h-3.5 w-3.5 text-slate-600"})}),s.locked&&g.jsx(Fv,{className:"h-3 w-3 shrink-0 text-amber-400"}),g.jsx("button",{onClick:f=>{f.stopPropagation(),a(s)},className:"shrink-0 opacity-0 transition group-hover:opacity-100",children:g.jsx(AFe,{className:"h-3.5 w-3.5"})})]}),o&&((d=s.children)==null?void 0:d.map((f,m)=>g.jsx(pNe,{node:f,depth:e+1,selectedId:t,onSelect:i,visibility:r,onToggleVisible:n,onAction:a},m)))]})}function ALt({tree:s,selectedId:e,onSelect:t,visibility:i,onToggleVisible:r,onAction:n}){return g.jsxs("div",{className:"flex h-full flex-col",children:[g.jsx("div",{className:"border-b border-white/10 px-4 py-3",children:g.jsx("h2",{className:"text-xs font-semibold uppercase tracking-[0.14em] text-slate-400",children:"Project Tree"})}),g.jsx("div",{className:"flex-1 overflow-y-auto p-2",children:s.length===0?g.jsxs("p",{className:"px-3 py-8 text-center text-sm text-slate-500",children:["No projects loaded.",g.jsx("br",{}),"Select a customer to begin."]}):s.map((a,o)=>g.jsx(pNe,{node:a,depth:0,selectedId:e,onSelect:t,visibility:i||{},onToggleVisible:r||(()=>{}),onAction:n||(()=>{})},o))})]})}const PLt=[{id:"perspective",label:"Persp",title:"Perspective view"},{id:"ortho",label:"Ortho",title:"Orthographic view",toggle:!0},{id:"front",label:"Front",title:"Anterior view"},{id:"rear",label:"Rear",title:"Posterior view"},{id:"lateral",label:"Lat",title:"Lateral view"},{id:"medial",label:"Med",title:"Medial view"},{id:"top",label:"Top",title:"Superior view"},{id:"bottom",label:"Bot",title:"Inferior view"}],MLt=[{id:"measurements",icon:HS,label:"Measurements"},{id:"sensitive",icon:qp,label:"Sensitive"},{id:"keepOut",icon:nme,label:"Keep-out"},{id:"cover",icon:z0,label:"Cover"},{id:"movement",icon:Zp,label:"Movement"},{id:"logo",icon:QD,label:"SHiRE Logo"}];function DLt({viewPreset:s,onView:e,ortho:t,display:i,onToggle:r,transparency:n,onTransparency:a,onFit:o,onReset:l,onSection:c}){return g.jsxs("div",{className:"flex flex-wrap items-center gap-2 border-b border-white/10 bg-[#0d1318]/80 px-3 py-2 backdrop-blur",children:[g.jsx("div",{className:"flex items-center gap-1",children:PLt.map(u=>g.jsx("button",{onClick:()=>e(u.id),title:u.title,className:`rounded-lg px-2.5 py-1.5 text-xs font-medium transition ${u.toggle&&t||!u.toggle&&s===u.id?"bg-cyan-400/20 text-cyan-300 border border-cyan-400/40":"border border-white/10 text-slate-400 hover:text-cyan-300 hover:border-cyan-400/30"}`,children:u.label},u.id))}),g.jsx("div",{className:"h-6 w-px bg-white/10"}),g.jsx("button",{onClick:o,title:"Fit to view",className:"icon-btn !min-h-9 !min-w-9",children:g.jsx(b2e,{className:"h-4 w-4"})}),g.jsx("button",{onClick:l,title:"Reset view",className:"icon-btn !min-h-9 !min-w-9",children:g.jsx(Zp,{className:"h-4 w-4"})}),g.jsx("button",{onClick:c,title:"Section cut",className:"icon-btn !min-h-9 !min-w-9",children:g.jsx(X2e,{className:"h-4 w-4"})}),g.jsx("div",{className:"h-6 w-px bg-white/10"}),g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx("span",{className:"text-xs text-slate-500",children:"Transparency"}),g.jsx("input",{type:"range",min:.2,max:1,step:.05,value:n,onChange:u=>a(parseFloat(u.target.value)),className:"w-24 accent-cyan-400"})]}),g.jsx("div",{className:"h-6 w-px bg-white/10"}),g.jsx("div",{className:"flex flex-wrap items-center gap-1",children:MLt.map(u=>{const h=i[u.id],d=u.icon;return g.jsxs("button",{onClick:()=>r(u.id),title:u.label,className:`flex items-center gap-1.5 rounded-lg px-2.5 py-1.5 text-xs font-medium transition ${h?"bg-cyan-400/15 text-cyan-300 border border-cyan-400/30":"border border-white/10 text-slate-500 hover:text-slate-300"}`,children:[g.jsx(d,{className:"h-3.5 w-3.5"}),g.jsx("span",{className:"hidden lg:inline",children:u.label})]},u.id)})})]})}const OLt={residual:{name:"Residual Limb / Liner",category:"Liner",icon:ome},socket:{name:"Socket",category:"Socket",icon:Bm},adapter:{name:"Distal Socket Adapter",category:"Adapter",icon:ME},pylon:{name:"Pylon",category:"Pylon",icon:ME},clamp:{name:"Tube Clamp",category:"Tube clamp",icon:ME},ankle:{name:"Ankle Adapter",category:"Ankle",icon:ME},foot:{name:"Foot",category:"Foot",icon:YFe}};function ji({label:s,value:e,unit:t,placeholder:i="Not recorded"}){const r=e!=null&&e!==""&&!(typeof e=="string"&&e.trim()==="");return g.jsxs("div",{className:"flex items-baseline justify-between gap-3 border-b border-white/5 py-2",children:[g.jsx("span",{className:"shrink-0 text-sm text-slate-400",children:s}),g.jsx("span",{className:`text-right text-sm font-semibold ${r?"text-slate-100":"italic text-slate-500"}`,children:r?g.jsxs(g.Fragment,{children:[e,t?` ${t}`:""]}):i})]})}function oa({title:s,icon:e,children:t}){const i=e;return g.jsxs("div",{className:"mb-4",children:[g.jsxs("h3",{className:"mb-2 flex items-center gap-2 text-xs font-semibold uppercase tracking-[0.14em] text-slate-400",children:[i&&g.jsx(i,{className:"h-3.5 w-3.5"}),s]}),g.jsx("div",{className:"rounded-xl border border-white/10 bg-white/[0.02] p-3",children:t})]})}function fpe({sessions:s,projectUuids:e}){const t=(s||[]).filter(n=>e.includes(n.project_uuid));let i="No measurement session",r="bg-slate-400/15 text-slate-300";return t.length>0&&(t.some(n=>n.status==="Complete")?(i="Session complete",r="bg-emerald-400/15 text-emerald-300"):t.some(n=>n.status==="In progress")?(i="In progress",r="bg-amber-400/15 text-amber-300"):t.some(n=>n.status==="Review required")?(i="Review required",r="bg-amber-400/15 text-amber-300"):i=t[0].status||"Not started"),g.jsxs("span",{className:`inline-flex items-center gap-1 rounded-full px-2.5 py-0.5 text-xs font-semibold ${r}`,children:[g.jsx(ME,{className:"h-3 w-3"}),i]})}function wLt({selected:s,component:e,dimensions:t,stations:i,accessPoints:r,keepOutZones:n,movementPositions:a,missingInfo:o,context:l={},coverParams:c={},display:u={}}){var v,x;const{customers:h=[],limbs:d=[],prostheses:f=[],projects:m=[],components:p=[],sessions:_=[]}=l;if(!s)return g.jsxs("div",{className:"flex h-full flex-col",children:[g.jsx("div",{className:"border-b border-white/10 px-4 py-3",children:g.jsx("h2",{className:"text-xs font-semibold uppercase tracking-[0.14em] text-slate-400",children:"Context Controls"})}),g.jsx("div",{className:"flex flex-1 items-center justify-center p-8 text-center",children:g.jsxs("div",{children:[g.jsx(ZD,{className:"mx-auto mb-3 h-10 w-10 text-slate-600"}),g.jsx("p",{className:"text-sm text-slate-500",children:"Select an object in the project tree or 3D viewport to view its properties and controls."})]})})]});if(s.type==="part"){const S=s.partId||s.index,b=OLt[S]||{name:s.label||"Part",category:"Part",icon:Bm},y=b.icon;return g.jsxs("div",{className:"flex h-full flex-col",children:[g.jsx("div",{className:"border-b border-white/10 px-4 py-3",children:g.jsx("h2",{className:"text-xs font-semibold uppercase tracking-[0.14em] text-slate-400",children:"Assembly Part"})}),g.jsxs("div",{className:"flex-1 overflow-y-auto p-4",children:[g.jsxs("div",{className:"mb-4 flex items-center gap-2",children:[g.jsx(y,{className:"h-5 w-5 text-cyan-400"}),g.jsx("h3",{className:"text-lg font-semibold text-white",children:b.name})]}),g.jsxs(oa,{title:"Identification",children:[g.jsx(ji,{label:"Manufacturer",value:"Generic visual model"}),g.jsx(ji,{label:"Model",value:"Procedural below-knee assembly"}),g.jsx(ji,{label:"Variant",value:"Visual fallback"}),g.jsx(ji,{label:"Category",value:b.category}),g.jsx(ji,{label:"Verification",value:g.jsx(hr,{tone:"amber",children:"Not manufacturing geometry"})})]}),g.jsxs("div",{className:"rounded-xl border border-amber-400/30 bg-amber-400/10 p-3 text-xs text-amber-200",children:[g.jsx(kf,{className:"mr-1.5 inline h-3.5 w-3.5"}),"Workshop measurement required — link a physical component record to load verified dimensions. Dimensions must be verified before CAD."]})]})]})}if(s.type==="customer"){const S=s.data||{},b=d.filter(I=>I.customer_uuid===S.uuid),y=m.filter(I=>I.customer_uuid===S.uuid);return g.jsxs("div",{className:"flex h-full flex-col",children:[g.jsx("div",{className:"border-b border-white/10 px-4 py-3",children:g.jsx("h2",{className:"text-xs font-semibold uppercase tracking-[0.14em] text-slate-400",children:"Customer"})}),g.jsxs("div",{className:"flex-1 overflow-y-auto p-4",children:[g.jsxs("div",{className:"mb-4 flex items-center gap-2",children:[g.jsx(ome,{className:"h-5 w-5 text-cyan-400"}),g.jsx("h3",{className:"text-lg font-semibold text-white",children:S.full_name||S.preferred_name||S.customer_number})]}),g.jsxs(oa,{title:"Identification",children:[g.jsx(ji,{label:"Customer number",value:S.customer_number}),g.jsx(ji,{label:"Preferred name",value:S.preferred_name}),g.jsx(ji,{label:"Date of birth",value:S.date_of_birth}),g.jsx(ji,{label:"Pronouns",value:S.pronouns})]}),g.jsxs(oa,{title:"Contact",children:[g.jsx(ji,{label:"Email",value:S.email}),g.jsx(ji,{label:"Phone",value:S.phone}),g.jsx(ji,{label:"Preferred contact",value:S.preferred_contact_method})]}),g.jsxs(oa,{title:"Funding",children:[g.jsx(ji,{label:"Funding method",value:S.funding_method}),g.jsx(ji,{label:"Approval status",value:S.approval_status}),g.jsx(ji,{label:"NDIS number",value:S.ndis_number,placeholder:"Not applicable"})]}),g.jsx(oa,{title:"Limb profiles",icon:Rv,children:b.length===0?g.jsx("p",{className:"text-sm italic text-slate-500",children:"No limb profiles recorded"}):b.map(I=>g.jsxs("div",{className:"border-b border-white/5 py-2 text-sm",children:[g.jsx("span",{className:"font-semibold text-slate-100",children:I.profile_name||I.configuration}),g.jsxs("div",{className:"text-xs text-slate-400",children:[I.configuration," · ",I.interface_type||"Socket"]})]},I.uuid))}),g.jsx(oa,{title:"Projects",children:y.length===0?g.jsx("p",{className:"text-sm italic text-slate-500",children:"No cover projects recorded"}):y.map(I=>g.jsxs("div",{className:"flex items-center justify-between border-b border-white/5 py-2 text-sm",children:[g.jsx("span",{className:"text-slate-100",children:I.project_id}),g.jsx("span",{className:"text-xs text-slate-400",children:I.status})]},I.uuid))}),g.jsxs("div",{className:"flex items-center justify-between py-1",children:[g.jsx("span",{className:"text-sm text-slate-400",children:"Measurement status"}),g.jsx(fpe,{sessions:_,projectUuids:y.map(I=>I.uuid)})]})]})]})}if(s.type==="limb"){const S=s.data||{},b=h.find(A=>A.uuid===S.customer_uuid),I=f.filter(A=>A.limb_profile_uuid===S.uuid)[0],R=m.filter(A=>A.limb_profile_uuid===S.uuid);return g.jsxs("div",{className:"flex h-full flex-col",children:[g.jsx("div",{className:"border-b border-white/10 px-4 py-3",children:g.jsx("h2",{className:"text-xs font-semibold uppercase tracking-[0.14em] text-slate-400",children:"Limb Profile"})}),g.jsxs("div",{className:"flex-1 overflow-y-auto p-4",children:[g.jsxs("div",{className:"mb-4 flex items-center gap-2",children:[g.jsx(Rv,{className:"h-5 w-5 text-cyan-400"}),g.jsx("h3",{className:"text-lg font-semibold text-white",children:S.profile_name||S.configuration})]}),g.jsxs(oa,{title:"Limb configuration",children:[g.jsx(ji,{label:"Configuration",value:S.configuration}),g.jsx(ji,{label:"Side",value:S.side||(typeof S.configuration=="string"&&S.configuration.startsWith("Left")?"Left":(v=S.configuration)!=null&&v.startsWith("Right")?"Right":null)}),g.jsx(ji,{label:"Amputation level",value:S.amputation_level||(typeof S.configuration=="string"?S.configuration.replace(/^(Left|Right)\s+/,""):null)}),g.jsx(ji,{label:"Interface type",value:S.interface_type}),g.jsx(ji,{label:"Cover location",value:S.cover_location})]}),g.jsxs(oa,{title:"Prosthesis",children:[g.jsx(ji,{label:"Manufacturer",value:(I==null?void 0:I.manufacturer)||S.prosthesis_manufacturer}),g.jsx(ji,{label:"Model",value:(I==null?void 0:I.model)||S.prosthesis_model}),g.jsx(ji,{label:"Prosthetist / clinic",value:S.prosthetist_or_clinic}),g.jsx(ji,{label:"Fitting date",value:S.fitting_date||(I==null?void 0:I.fitting_date)})]}),g.jsxs(oa,{title:"Customer",children:[g.jsx(ji,{label:"Customer",value:(b==null?void 0:b.full_name)||(b==null?void 0:b.preferred_name)}),g.jsx(ji,{label:"Customer number",value:b==null?void 0:b.customer_number})]}),g.jsx(oa,{title:"Project",children:R.length===0?g.jsx("p",{className:"text-sm italic text-slate-500",children:"No cover project recorded"}):R.map(A=>g.jsxs("div",{className:"flex items-center justify-between border-b border-white/5 py-2 text-sm",children:[g.jsx("span",{className:"text-slate-100",children:A.project_id}),g.jsx("span",{className:"text-xs text-slate-400",children:A.status})]},A.uuid))}),g.jsxs("div",{className:"flex items-center justify-between py-1",children:[g.jsx("span",{className:"text-sm text-slate-400",children:"Measurement status"}),g.jsx(fpe,{sessions:_,projectUuids:R.map(A=>A.uuid)})]}),g.jsx("div",{className:"mt-3 rounded-xl border border-white/10 bg-white/[0.02] p-3 text-xs text-slate-400",children:"Visual model: generic until a verified component model is loaded. No measurements are invented."})]})]})}if(s.type==="prosthesis"){const S=s.data||{},b=h.find(A=>A.uuid===S.customer_uuid),y=d.find(A=>A.uuid===S.limb_profile_uuid),I=(S.component_uuids||[]).map(A=>p.find(P=>P.uuid===A)).filter(Boolean),R=m.find(A=>A.prosthesis_uuid===S.uuid)||m.find(A=>A.customer_uuid===S.customer_uuid&&A.limb_profile_uuid===S.limb_profile_uuid);return g.jsxs("div",{className:"flex h-full flex-col",children:[g.jsx("div",{className:"border-b border-white/10 px-4 py-3",children:g.jsx("h2",{className:"text-xs font-semibold uppercase tracking-[0.14em] text-slate-400",children:"Prosthesis"})}),g.jsxs("div",{className:"flex-1 overflow-y-auto p-4",children:[g.jsxs("div",{className:"mb-4 flex items-center gap-2",children:[g.jsx(Bm,{className:"h-5 w-5 text-cyan-400"}),g.jsx("h3",{className:"text-lg font-semibold text-white",children:S.name||`${S.manufacturer||""} ${S.model||""}`.trim()||"Prosthesis"})]}),g.jsxs(oa,{title:"Identification",children:[g.jsx(ji,{label:"Manufacturer",value:S.manufacturer}),g.jsx(ji,{label:"Model",value:S.model}),g.jsx(ji,{label:"Serial number",value:S.serial_number}),g.jsx(ji,{label:"Fitting date",value:S.fitting_date}),g.jsx(ji,{label:"Status",value:S.status})]}),g.jsxs(oa,{title:"Customer & limb",children:[g.jsx(ji,{label:"Customer",value:(b==null?void 0:b.full_name)||(b==null?void 0:b.preferred_name)}),g.jsx(ji,{label:"Customer number",value:b==null?void 0:b.customer_number}),g.jsx(ji,{label:"Limb profile",value:(y==null?void 0:y.profile_name)||(y==null?void 0:y.configuration)}),g.jsx(ji,{label:"Configuration",value:y==null?void 0:y.configuration})]}),g.jsx(oa,{title:"Components",icon:Bm,children:I.length===0?g.jsx("p",{className:"text-sm italic text-slate-500",children:"No components linked — workshop measurement required"}):I.map(A=>g.jsxs("div",{className:"flex items-center justify-between border-b border-white/5 py-2 text-sm",children:[g.jsxs("span",{className:"text-slate-100",children:[A.category,": ",A.manufacturer," ",A.model]}),g.jsx("span",{className:"text-xs text-slate-400",children:A.confidence})]},A.uuid))}),g.jsxs(oa,{title:"Project",children:[g.jsx(ji,{label:"Project ID",value:R==null?void 0:R.project_id}),g.jsx(ji,{label:"Status",value:R==null?void 0:R.status})]})]})]})}if(s.type==="station"){const S=s.data||{};return g.jsxs("div",{className:"flex h-full flex-col",children:[g.jsx("div",{className:"border-b border-white/10 px-4 py-3",children:g.jsx("h2",{className:"text-xs font-semibold uppercase tracking-[0.14em] text-slate-400",children:"Measurement Station"})}),g.jsxs("div",{className:"flex-1 overflow-y-auto p-4",children:[g.jsxs("div",{className:"mb-4 flex items-center gap-2",children:[g.jsx(Yp,{className:"h-5 w-5 text-cyan-400"}),g.jsx("h3",{className:"text-lg font-semibold text-white",children:S.name||S.station_name||`Station ${String((s.index??0)+1).padStart(2,"0")}`})]}),g.jsxs(oa,{title:"Dimensions",children:[g.jsx(ji,{label:"Height from origin",value:(x=S.height)!=null&&x.toFixed?S.height.toFixed(0):S.height_from_origin_mm,unit:"mm"}),g.jsx(ji,{label:"Total width",value:S.total_width_mm||S.width,unit:"mm",placeholder:"Measurement required"}),g.jsx(ji,{label:"Total depth",value:S.total_depth_mm||S.depth,unit:"mm",placeholder:"Measurement required"}),g.jsx(ji,{label:"Clearance",value:S.clearance_requirement_mm,unit:"mm"})]}),g.jsxs(oa,{title:"Source",children:[g.jsx(ji,{label:"Source",value:"Workshop measured"}),g.jsx(ji,{label:"Confidence",value:"High"}),g.jsx(ji,{label:"Verification",value:g.jsx(hr,{tone:"green",children:"Verified"})})]})]})]})}if(s.type==="component"){const S=e||s.data||{},b=t||[],y=I=>{var R;return(R=b.find(A=>A.dimension_key===I))==null?void 0:R.value_mm};return g.jsxs("div",{className:"flex h-full flex-col",children:[g.jsx("div",{className:"border-b border-white/10 px-4 py-3",children:g.jsx("h2",{className:"text-xs font-semibold uppercase tracking-[0.14em] text-slate-400",children:s.placeholder?"Component (not linked)":"Component"})}),g.jsxs("div",{className:"flex-1 overflow-y-auto p-4",children:[g.jsxs("div",{className:"mb-4 flex items-center gap-2",children:[g.jsx(Bm,{className:"h-5 w-5 text-cyan-400"}),g.jsx("h3",{className:"text-lg font-semibold text-white",children:[S.manufacturer,S.model].filter(Boolean).join(" ")||s.label||"Component"})]}),g.jsxs(oa,{title:"Identification",children:[g.jsx(ji,{label:"Manufacturer",value:S.manufacturer,placeholder:s.placeholder?"Workshop measurement required":"Not recorded"}),g.jsx(ji,{label:"Model",value:S.model,placeholder:s.placeholder?"Workshop measurement required":"Not recorded"}),g.jsx(ji,{label:"Variant",value:S.variant}),g.jsx(ji,{label:"Article number",value:S.article_number}),g.jsx(ji,{label:"Category",value:S.category||s.category}),g.jsx(ji,{label:"Confidence",value:S.confidence})]}),g.jsxs(oa,{title:"Manufacturer dimensions",children:[g.jsx(ji,{label:"System height",value:y("system_height_mm"),unit:"mm",placeholder:"Workshop measurement required"}),g.jsx(ji,{label:"Max width",value:y("overall_max_width"),unit:"mm",placeholder:"Workshop measurement required"}),g.jsx(ji,{label:"Max depth",value:y("overall_max_depth"),unit:"mm",placeholder:"Workshop measurement required"})]}),g.jsxs(oa,{title:"Zones",children:[g.jsx(ji,{label:"Access points",value:(r==null?void 0:r.length)||0}),g.jsx(ji,{label:"Keep-out zones",value:(n==null?void 0:n.length)||0}),g.jsx(ji,{label:"Movement positions",value:(a==null?void 0:a.length)||0})]}),(o==null?void 0:o.length)>0&&g.jsx(oa,{title:"Missing information",icon:kf,children:g.jsx("ul",{className:"space-y-1.5",children:o.map((I,R)=>g.jsxs("li",{className:"flex items-start gap-2 text-sm text-amber-300",children:[g.jsx(kf,{className:"mt-0.5 h-3.5 w-3.5 shrink-0"}),I]},R))})})]})]})}if(s.type==="cover"){const S=u.logo!==!1;return g.jsxs("div",{className:"flex h-full flex-col",children:[g.jsx("div",{className:"border-b border-white/10 px-4 py-3",children:g.jsx("h2",{className:"text-xs font-semibold uppercase tracking-[0.14em] text-slate-400",children:"Cover Shell"})}),g.jsxs("div",{className:"flex-1 overflow-y-auto p-4",children:[g.jsxs("div",{className:"mb-4 flex items-center gap-2",children:[g.jsx(z0,{className:"h-5 w-5 text-cyan-400"}),g.jsx("h3",{className:"text-lg font-semibold text-white",children:"Conceptual Cover"})]}),g.jsxs(oa,{title:"Geometry",children:[g.jsx(ji,{label:"Global clearance",value:c.clearance,unit:"mm"}),g.jsx(ji,{label:"Wall thickness",value:c.wallThickness,unit:"mm"}),g.jsx(ji,{label:"Panel style",value:c.shellType}),g.jsx(ji,{label:"Panel count",value:c.panelCount}),g.jsx(ji,{label:"Seam orientation",value:c.seamOrientation})]}),g.jsxs(oa,{title:"Features",children:[g.jsx(ji,{label:"Ventilation density",value:c.ventilationDensity,unit:"%"}),g.jsx(ji,{label:"Material",value:"Conceptual (PETG / ASA — not specified)"}),g.jsx(ji,{label:"Cover transparency",value:"Controlled by viewport transparency slider"})]}),g.jsxs(oa,{title:"Branding & CAD",children:[g.jsx(ji,{label:"SHiRE logo status",value:S?"Visible":"Hidden — mandatory branding not shown"}),g.jsx(ji,{label:"Logo size",value:c.logoSize,unit:"mm"}),g.jsx(ji,{label:"CAD status",value:g.jsx(hr,{tone:"amber",children:"Not ready — conceptual preview"})})]}),g.jsxs("div",{className:"rounded-xl border border-amber-400/30 bg-amber-400/10 p-3 text-xs text-amber-200",children:[g.jsx("strong",{children:"Conceptual preview"})," — not manufacturing geometry. Print Ready unavailable until CAD geometry is connected."]})]})]})}if(s.type==="access"||s.type==="keepout"){const S=s.data||{},b=s.type==="access";return g.jsxs("div",{className:"flex h-full flex-col",children:[g.jsx("div",{className:"border-b border-white/10 px-4 py-3",children:g.jsx("h2",{className:"text-xs font-semibold uppercase tracking-[0.14em] text-slate-400",children:b?"Access Zone":"Keep-Out Zone"})}),g.jsxs("div",{className:"flex-1 overflow-y-auto p-4",children:[g.jsxs("div",{className:"mb-4 flex items-center gap-2",children:[b?g.jsx(qp,{className:"h-5 w-5 text-amber-400"}):g.jsx(nme,{className:"h-5 w-5 text-red-400"}),g.jsx("h3",{className:"text-lg font-semibold text-white",children:S.name||"Zone"})]}),g.jsxs(oa,{title:"Dimensions",children:[g.jsx(ji,{label:"Width",value:S.width_mm,unit:"mm"}),g.jsx(ji,{label:"Height",value:S.height_mm,unit:"mm"}),g.jsx(ji,{label:"Depth",value:S.depth_mm,unit:"mm"}),g.jsx(ji,{label:"Clearance",value:S.required_clearance_mm||S.clearance_mm,unit:"mm"})]}),g.jsxs(oa,{title:"Details",children:[g.jsx(ji,{label:"Type",value:S.type}),g.jsx(ji,{label:"Position",value:S.position}),g.jsx(ji,{label:"Must remain accessible",value:S.must_remain_accessible?"Yes":"No"})]}),S.notes&&g.jsx(oa,{title:"Notes",children:g.jsx("p",{className:"text-sm text-slate-300",children:S.notes})})]})]})}if(s.type==="sensitive"){const S=s.data||{};return g.jsxs("div",{className:"flex h-full flex-col",children:[g.jsx("div",{className:"border-b border-white/10 px-4 py-3",children:g.jsx("h2",{className:"text-xs font-semibold uppercase tracking-[0.14em] text-slate-400",children:"Sensitive Zone"})}),g.jsxs("div",{className:"flex-1 overflow-y-auto p-4",children:[g.jsxs("div",{className:"mb-4 flex items-center gap-2",children:[g.jsx(qp,{className:"h-5 w-5 text-purple-400"}),g.jsx("h3",{className:"text-lg font-semibold text-white",children:S.label||S.type||"Sensitive Zone"})]}),g.jsxs(oa,{title:"Properties",children:[g.jsx(ji,{label:"Type",value:S.type}),g.jsx(ji,{label:"Sensitivity",value:S.sensitivity||"Medium"}),g.jsx(ji,{label:"Contact permission",value:S.contactPermission||"No contact"}),g.jsx(ji,{label:"Brush size",value:S.brushSize,unit:"mm"}),g.jsx(ji,{label:"Clearance depth",value:S.clearanceDepth,unit:"mm"})]}),S.notes&&g.jsx(oa,{title:"Notes",children:g.jsx("p",{className:"text-sm text-slate-300",children:S.notes})})]})]})}if(s.type==="logo"){const S=u.logo!==!1;return g.jsxs("div",{className:"flex h-full flex-col",children:[g.jsx("div",{className:"border-b border-white/10 px-4 py-3",children:g.jsx("h2",{className:"text-xs font-semibold uppercase tracking-[0.14em] text-slate-400",children:"SHiRE Branding"})}),g.jsxs("div",{className:"flex-1 overflow-y-auto p-4",children:[g.jsxs("div",{className:"mb-4 flex items-center gap-2",children:[g.jsx(zFe,{className:"h-5 w-5 text-cyan-400"}),g.jsx("h3",{className:"text-lg font-semibold text-white",children:"SHiRE Logo"})]}),g.jsxs(oa,{title:"Placement",children:[g.jsx(ji,{label:"Position",value:"Exterior front face"}),g.jsx(ji,{label:"Width",value:c.logoSize||40,unit:"mm"}),g.jsx(ji,{label:"Depth",value:c.logoDepth||1.5,unit:"mm"}),g.jsx(ji,{label:"Style",value:"Raised wordmark"}),g.jsx(ji,{label:"Mandatory",value:"Yes"})]}),g.jsxs(oa,{title:"Validation",children:[S?g.jsxs("div",{className:"flex items-center gap-2 text-sm text-emerald-300",children:[g.jsx(hg,{className:"h-4 w-4"})," Logo visible on approved surface"]}):g.jsxs("div",{className:"flex items-start gap-2 text-sm text-amber-300",children:[g.jsx(kf,{className:"mt-0.5 h-4 w-4 shrink-0"})," Mandatory logo is hidden — it must be visible before printing."]}),g.jsx("div",{className:"mt-2 text-xs text-slate-500",children:"Logo snaps away from seams, hinges, clips, vents, and sensitive zones."})]})]})]})}return null}function NLt({stations:s,selectedId:e,onSelect:t,onAdd:i,onDuplicate:r,onDelete:n,onSetSpacing:a,spacing:o=25}){const l=s||[];return g.jsxs("div",{className:"flex flex-col",children:[g.jsxs("div",{className:"flex items-center justify-between border-b border-white/10 px-4 py-2.5",children:[g.jsxs("h3",{className:"flex items-center gap-2 text-xs font-semibold uppercase tracking-[0.14em] text-slate-400",children:[g.jsx(Rv,{className:"h-3.5 w-3.5"})," Measurement Stations (",l.length,")"]}),g.jsxs("div",{className:"flex items-center gap-1.5",children:[g.jsxs("select",{value:o,onChange:c=>a==null?void 0:a(parseInt(c.target.value)),className:"rounded-lg border border-white/10 bg-black/20 px-2 py-1 text-xs text-slate-200",children:[g.jsx("option",{value:20,children:"20 mm"}),g.jsx("option",{value:25,children:"25 mm"}),g.jsx("option",{value:50,children:"50 mm"})]}),g.jsxs("button",{onClick:i,className:"btn-primary !px-2.5 !py-1.5 !text-xs",children:[g.jsx($f,{className:"h-3.5 w-3.5"}),"Add"]})]})]}),g.jsx("div",{className:"max-h-48 overflow-y-auto",children:g.jsxs("table",{className:"w-full text-sm",children:[g.jsx("thead",{className:"sticky top-0 bg-[#0d1318] text-xs text-slate-500",children:g.jsxs("tr",{children:[g.jsx("th",{className:"px-3 py-2 text-left font-medium",children:"Name"}),g.jsx("th",{className:"px-3 py-2 text-right font-medium",children:"Height"}),g.jsx("th",{className:"px-3 py-2 text-right font-medium",children:"Width"}),g.jsx("th",{className:"px-3 py-2 text-right font-medium",children:"Depth"}),g.jsx("th",{className:"px-3 py-2"})]})}),g.jsx("tbody",{children:l.map((c,u)=>{const h=`station-${u}`,d=e===h;return g.jsxs("tr",{onClick:()=>t==null?void 0:t("station",u,c),className:`cursor-pointer border-b border-white/5 transition ${d?"bg-cyan-400/15":"hover:bg-white/5"}`,children:[g.jsx("td",{className:"px-3 py-2 text-slate-200",children:c.station_name||c.name||`Station ${String(u+1).padStart(2,"0")}`}),g.jsx("td",{className:"px-3 py-2 text-right text-slate-300",children:(c.height_from_origin_mm??c.height??0).toFixed(0)}),g.jsx("td",{className:"px-3 py-2 text-right text-slate-300",children:(c.total_width_mm??c.width??0).toFixed(0)}),g.jsx("td",{className:"px-3 py-2 text-right text-slate-300",children:(c.total_depth_mm??c.depth??0).toFixed(0)}),g.jsx("td",{className:"px-2 py-2",children:g.jsxs("div",{className:"flex items-center gap-1",children:[g.jsx("button",{onClick:f=>{f.stopPropagation(),r==null||r(u)},className:"text-slate-500 hover:text-cyan-300",children:g.jsx(MS,{className:"h-3.5 w-3.5"})}),g.jsx("button",{onClick:f=>{f.stopPropagation(),n==null||n(u)},className:"text-slate-500 hover:text-red-400",children:g.jsx(eO,{className:"h-3.5 w-3.5"})})]})})]},u)})})]})})]})}const ppe=["Manufacturer Verified","Workshop Measurement","Verified 3D Scan","Customer Reported","Calculated","Estimated","Unknown"],mpe=["Unknown","Requested","Entered","Needs Verification","Verified Manufacturer Value","Verified Workshop Value","Verified Scan Value","Conflict Detected","Superseded","Not Applicable"];function KC({label:s,children:e}){return g.jsxs("div",{className:"border-b border-white/5 py-2.5",children:[g.jsx("label",{className:"mb-1.5 block text-[11px] font-semibold uppercase tracking-[0.1em] text-slate-500",children:s}),e]})}function LLt({selected:s,component:e,stationIndex:t,onSave:i,onMeasureAgain:r,onNotApplicable:n,previousValue:a,onAddPhoto:o}){const l=(s==null?void 0:s.data)||{},c=l.name||l.station_name||(t!=null?`Station ${String(t+1).padStart(2,"0")}`:"Measurement"),u=l.width??l.total_width_mm,h=l.depth??l.total_depth_mm;l.height??l.height_from_origin_mm;const[d,f]=Te.useState(""),[m,p]=Te.useState("mm"),[_,v]=Te.useState(ppe[1]),[x,S]=Te.useState(mpe[2]),[b,y]=Te.useState(95),[I,R]=Te.useState(""),A=a&&d?(Number(d)-a).toFixed(1):null,P=()=>i==null?void 0:i({selected:s,value:d,unit:m,source:_,verification:x,confidence:b,notes:I});return g.jsxs("div",{className:"flex h-full flex-col",children:[g.jsx("div",{className:"border-b border-white/10 px-4 py-3",children:g.jsxs("div",{className:"flex items-center justify-between",children:[g.jsxs("h2",{className:"flex items-center gap-2 text-sm font-bold uppercase tracking-[0.12em] text-cyan-300",children:[g.jsx(Yp,{className:"h-4 w-4"}),t!=null?`Measurement Station ${String(t+1).padStart(2,"0")}`:"Measurement"]}),g.jsxs("button",{className:"flex items-center gap-1 text-xs text-slate-400 hover:text-cyan-300",children:[c," ",g.jsx(qO,{className:"h-3.5 w-3.5"})]})]})}),g.jsxs("div",{className:"flex-1 overflow-y-auto p-4",children:[g.jsx("div",{className:"mb-1 text-xs font-semibold uppercase tracking-[0.1em] text-slate-500",children:"Measurement Name"}),g.jsx("p",{className:"mb-3 text-sm font-semibold text-white",children:c}),g.jsx(KC,{label:"Value",children:g.jsxs("div",{className:"flex gap-2",children:[g.jsx("input",{type:"number",value:d,onChange:w=>f(w.target.value),placeholder:"Measurement required — enter value",className:"workshop-input flex-1 !min-h-10"}),g.jsxs("select",{value:m,onChange:w=>p(w.target.value),className:"workshop-input w-20 !min-h-10",children:[g.jsx("option",{value:"mm",children:"mm"}),g.jsx("option",{value:"cm",children:"cm"}),g.jsx("option",{value:"degrees",children:"°"})]})]})}),u!=null&&g.jsxs("div",{className:"flex items-baseline justify-between py-2 text-sm",children:[g.jsx("span",{className:"text-slate-400",children:"Width × Depth"}),g.jsxs("span",{className:"font-semibold text-slate-100",children:[u.toFixed?u.toFixed(0):u," × ",h!=null&&h.toFixed?h.toFixed(0):h," mm"]})]}),g.jsx(KC,{label:"Source",children:g.jsx("select",{value:_,onChange:w=>v(w.target.value),className:"workshop-input !min-h-10",children:ppe.map(w=>g.jsx("option",{value:w,children:w},w))})}),g.jsx(KC,{label:"Verification",children:g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx("select",{value:x,onChange:w=>S(w.target.value),className:"workshop-input flex-1 !min-h-10",children:mpe.map(w=>g.jsx("option",{value:w,children:w},w))}),g.jsxs(hr,{tone:"green",children:[g.jsx(hg,{className:"mr-1 h-3 w-3"}),"Verified"]})]})}),g.jsx(KC,{label:"Confidence",children:g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx("input",{type:"range",min:0,max:100,value:b,onChange:w=>y(parseInt(w.target.value)),className:"flex-1 accent-cyan-400"}),g.jsxs("span",{className:"w-16 text-right text-sm font-semibold text-cyan-300",children:["High (",b,"%)"]})]})}),g.jsx(KC,{label:"Notes",children:g.jsx("textarea",{value:I,onChange:w=>R(w.target.value),placeholder:"Add notes…",className:"workshop-input min-h-16 !min-h-12"})}),a!=null&&g.jsxs("div",{className:"mt-3 flex items-center justify-between rounded-xl border border-white/10 bg-white/[0.02] px-3 py-2.5",children:[g.jsx("span",{className:"text-xs text-slate-500",children:"Previous value"}),g.jsxs("span",{className:"text-sm font-semibold text-slate-200",children:[a.toFixed?a.toFixed(1):a," mm",A&&Number(A)!==0&&g.jsxs("span",{className:`ml-2 inline-flex items-center text-xs ${Number(A)>0?"text-amber-300":"text-emerald-300"}`,children:[Number(A)>0?"+":"",A," mm ",g.jsx(Ype,{className:"ml-0.5 h-3 w-3"})]})]})]})]}),g.jsxs("div",{className:"border-t border-white/10 p-3",children:[g.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[g.jsxs("button",{className:"btn-secondary !min-h-10",onClick:r,children:[g.jsx(G2e,{className:"h-4 w-4"}),"Measure Again"]}),g.jsxs("button",{className:"btn-secondary !min-h-10",onClick:n,children:[g.jsx(rFe,{className:"h-4 w-4"}),"N/A"]})]}),g.jsxs("button",{className:"btn-primary mt-2 w-full",onClick:P,disabled:!d,children:[g.jsx(ZD,{className:"h-4 w-4"}),"Add Photo"]}),g.jsxs("button",{className:"btn-primary mt-2 w-full !min-h-12",onClick:P,disabled:!d,children:[g.jsx(YI,{className:"h-4 w-4"}),"Save & Continue"]})]})]})}function vD({icon:s,title:e,children:t,onEdit:i}){return g.jsxs("div",{className:"rounded-xl border border-white/10 bg-white/[0.02] p-3",children:[g.jsxs("div",{className:"mb-2 flex items-center justify-between",children:[g.jsxs("div",{className:"flex items-center gap-2 text-xs font-semibold uppercase tracking-[0.1em] text-slate-400",children:[g.jsx(s,{className:"h-3.5 w-3.5 text-cyan-400"}),e]}),g.jsx("button",{onClick:i,className:"text-slate-500 hover:text-cyan-300",children:g.jsx(rme,{className:"h-3.5 w-3.5"})})]}),t]})}function FLt({validationPercent:s=38,completedChecks:e=3,totalChecks:t=8}){const[i,r]=Te.useState("ASA"),[n,a]=Te.useState("Bambu Lab P1S"),[o,l]=Te.useState("AeroFlow");return g.jsxs("div",{className:"space-y-2.5 px-4 pb-4",children:[g.jsxs(vD,{icon:Rv,title:"Material",children:[g.jsxs("p",{className:"text-sm font-semibold text-slate-100",children:[i," ",g.jsx("span",{className:"text-xs font-normal text-slate-400",children:"(Preferred)"})]}),g.jsx("p",{className:"mt-1 text-[11px] leading-4 text-slate-500",children:"UV-stable · Impact resistant · Outdoor suitable"}),g.jsxs("select",{value:i,onChange:c=>r(c.target.value),className:"mt-2 w-full rounded-lg border border-white/10 bg-black/20 px-2 py-1.5 text-xs text-slate-200",children:[g.jsx("option",{value:"ASA",children:"ASA — final sun-exposed shells"}),g.jsx("option",{value:"PETG",children:"PETG — easier production"}),g.jsx("option",{value:"TPU",children:"TPU — flexible inserts"}),g.jsx("option",{value:"PLA",children:"PLA — prototypes only"})]})]}),g.jsxs(vD,{icon:w2e,title:"Printer",children:[g.jsx("p",{className:"text-sm font-semibold text-slate-100",children:n}),g.jsx("p",{className:"mt-1 text-[11px] leading-4 text-slate-500",children:"0.4 mm nozzle · Build volume compatible"}),g.jsxs("select",{value:n,onChange:c=>a(c.target.value),className:"mt-2 w-full rounded-lg border border-white/10 bg-black/20 px-2 py-1.5 text-xs text-slate-200",children:[g.jsx("option",{value:"Bambu Lab P1S",children:"Bambu Lab P1S"}),g.jsx("option",{value:"Creality K2 Plus",children:"Creality K2 Plus"}),g.jsx("option",{value:"Snapmaker U1",children:"Snapmaker U1"}),g.jsx("option",{value:"Custom printer",children:"Custom printer"})]})]}),g.jsxs(vD,{icon:Hv,title:"Validation Status",children:[g.jsxs("div",{className:"flex items-center justify-between text-sm",children:[g.jsx("span",{className:"font-semibold text-amber-300",children:"Preliminary"}),g.jsxs("span",{className:"text-xs text-slate-400",children:[s,"%"]})]}),g.jsx("div",{className:"mt-1.5 h-1.5 w-full overflow-hidden rounded-full bg-white/10",children:g.jsx("div",{className:"h-full rounded-full bg-amber-400 transition-all",style:{width:`${s}%`}})}),g.jsxs("p",{className:"mt-1.5 text-[11px] text-slate-500",children:[e," of ",t," checkpoints complete"]})]}),g.jsxs(vD,{icon:R2e,title:"Design Style",children:[g.jsx("p",{className:"text-sm font-semibold text-slate-100",children:o}),g.jsx("p",{className:"mt-1 text-[11px] leading-4 text-slate-500",children:"Matte finish · Vented accents"}),g.jsxs("select",{value:o,onChange:c=>l(c.target.value),className:"mt-2 w-full rounded-lg border border-white/10 bg-black/20 px-2 py-1.5 text-xs text-slate-200",children:[g.jsx("option",{value:"AeroFlow",children:"AeroFlow"}),g.jsx("option",{value:"Brutal Armour",children:"Brutal Armour"}),g.jsx("option",{value:"Biomechanical",children:"Biomechanical"}),g.jsx("option",{value:"Minimal",children:"Minimal"}),g.jsx("option",{value:"Geometric",children:"Geometric"})]})]})]})}function BLt({compact:s=!1,className:e=""}){return g.jsx("div",{className:`rounded-2xl border border-amber-400/40 bg-amber-400/[0.07] p-4 ${e}`,role:"note",children:g.jsxs("div",{className:"flex gap-3",children:[g.jsx(qp,{className:"mt-0.5 h-5 w-5 shrink-0 text-amber-300","aria-hidden":"true"}),g.jsxs("div",{children:[g.jsx("strong",{className:"text-sm font-semibold uppercase tracking-[0.16em] text-amber-300",children:"Safety Boundary"}),!s&&g.jsx("p",{className:"mt-1.5 text-xs leading-5 text-amber-100/80",children:Ame})]})]})})}function kLt({route:s="/",onLock:e}){return g.jsxs("header",{className:"flex h-12 shrink-0 items-center gap-3 border-b border-white/10 bg-[#0d1318] px-4",children:[g.jsxs(Ar,{to:"/",className:"flex items-center gap-2",children:[g.jsx("span",{className:"flex h-7 w-7 items-center justify-center rounded-lg bg-cyan-400/15 text-sm font-black tracking-tight text-cyan-300",children:"S"}),g.jsxs("div",{className:"leading-none",children:[g.jsx("span",{className:"block text-sm font-bold tracking-[0.12em] text-white",children:"SHiRE LimbForge"}),g.jsx("span",{className:"block text-[10px] font-medium uppercase tracking-[0.2em] text-cyan-400/80",children:"Workshop"})]})]}),g.jsx("div",{className:"mx-2 hidden h-6 w-px bg-white/10 sm:block"}),g.jsxs("div",{className:"hidden items-center gap-1.5 font-mono text-xs text-slate-400 sm:flex",children:[g.jsx("span",{className:"text-slate-600",children:"/"}),g.jsx("span",{className:"text-slate-300",children:s})]}),g.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[g.jsxs("div",{className:"relative hidden md:block",children:[g.jsx(jS,{className:"pointer-events-none absolute left-2.5 top-1/2 h-4 w-4 -translate-y-1/2 text-slate-500"}),g.jsx("input",{placeholder:"Search customers, projects…",className:"h-9 w-56 rounded-xl border border-white/10 bg-black/20 pl-8 pr-3 text-sm text-slate-200 placeholder:text-slate-600 focus:border-cyan-400/50 focus:outline-none"})]}),g.jsxs("button",{className:"icon-btn relative",title:"Notifications",children:[g.jsx(nFe,{className:"h-4 w-4"}),g.jsx("span",{className:"absolute right-1.5 top-1.5 h-1.5 w-1.5 rounded-full bg-cyan-400"})]}),g.jsx("button",{className:"icon-btn",title:"Help",children:g.jsx(vFe,{className:"h-4 w-4"})}),g.jsx("button",{onClick:e,className:"icon-btn",title:"Lock workshop",children:g.jsx(Fv,{className:"h-4 w-4"})}),g.jsx("div",{className:"flex h-9 w-9 items-center justify-center rounded-full bg-cyan-400/20 text-xs font-bold text-cyan-200",title:"Workshop owner",children:"AA"})]})]})}const VLt=[{id:"select",icon:E2e,label:"Select"},{id:"rotate",icon:r2e,label:"Rotate / Pan"},{id:"station",icon:Yp,label:"Add Measurement Station"},{id:"ring",icon:TFe,label:"Add Circumference Ring"},{id:"zone",icon:Bm,label:"Add Keep-Out / Access Zone"},{id:"inspect",icon:HS,label:"Inspect Object"},{id:"ruler",icon:k5,label:"Ruler"}];function ULt({activeTool:s,onTool:e}){return g.jsx("div",{className:"flex w-12 shrink-0 flex-col items-center gap-1 border-r border-white/10 bg-[#0d1318] py-3",children:VLt.map(t=>{const i=t.icon,r=s===t.id;return g.jsx("button",{onClick:()=>e==null?void 0:e(t.id),title:t.label,className:`flex h-10 w-10 items-center justify-center rounded-xl border transition ${r?"border-cyan-400/50 bg-cyan-400/15 text-cyan-300":"border-transparent text-slate-400 hover:border-white/10 hover:bg-white/5 hover:text-cyan-300"}`,children:g.jsx(i,{className:"h-5 w-5"})},t.id)})})}class GLt extends Te.Component{constructor(t){super(t);FP(this,"handleReset",()=>{this.setState({error:null,info:null}),this.props.onReset&&this.props.onReset()});FP(this,"handleReload",()=>{typeof window<"u"&&window.location.reload()});FP(this,"handleCompatibility",()=>{this.setState({error:null,info:null}),this.props.onCompatibility&&this.props.onCompatibility()});this.state={error:null,info:null}}static getDerivedStateFromError(t){return{error:t}}componentDidCatch(t,i){console.error("[ViewportErrorBoundary]",t,i),this.setState({info:i})}render(){const{error:t}=this.state,{children:i,fallback:r}=this.props;if(!t)return i;if(r)return r(t,this.handleReset,this.handleReload,this.handleCompatibility);const n=(t==null?void 0:t.message)||String(t),a=/WebGL|context|gl\.create|shader|gpu/i.test(n);return g.jsx("div",{className:"flex h-full w-full items-center justify-center bg-workshop p-6",children:g.jsxs("div",{className:"panel max-w-lg p-6 text-slate-200",children:[g.jsxs("div",{className:"mb-3 flex items-center gap-2 text-amber-300",children:[g.jsx("svg",{viewBox:"0 0 24 24",className:"h-6 w-6",fill:"none",stroke:"currentColor",strokeWidth:"2",children:g.jsx("path",{d:"M12 9v4M12 17h.01M10.3 3.86 1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.7 3.86a2 2 0 0 0-3.4 0Z",strokeLinecap:"round",strokeLinejoin:"round"})}),g.jsx("h2",{className:"text-lg font-semibold",children:"3D viewport could not start"})]}),g.jsx("p",{className:"mb-3 text-sm text-slate-400",children:a?"Your browser or device blocked WebGL initialisation. Try the controls below, or switch to a device with WebGL support.":"The 3D scene hit a runtime error. Your project data is safe — only the preview stopped rendering."}),g.jsx("div",{className:"mb-4 max-h-40 overflow-auto rounded-xl border border-white/10 bg-black/30 p-3 font-mono text-xs text-rose-300",children:n}),g.jsxs("div",{className:"flex flex-wrap gap-2",children:[g.jsx("button",{onClick:this.handleReset,className:"btn-primary",children:"Retry"}),g.jsx("button",{onClick:this.handleReload,className:"btn-secondary",children:"Reset Viewport"}),g.jsx("button",{onClick:this.handleCompatibility,className:"btn-secondary",children:"Switch to Compatibility Mode"})]}),g.jsx("p",{className:"mt-3 text-xs text-slate-500",children:"All workshop records — customers, limb profiles, prostheses, components and measurements — remain available in the non-3D pages."})]})})}}const BF={Circumference:"lateral",Width:"top",Depth:"top",Length:"front",Height:"front",General:"perspective","Knee component":"lateral","Lower leg":"lateral","Upper limb":"lateral",Osseointegration:"front"};function zLt({session:s,onGuidedView:e,onHighlightStation:t,onComplete:i,actor:r="Ray"}){const[n,a]=Te.useState([]),[o,l]=Te.useState(0),[c,u]=Te.useState(""),[h,d]=Te.useState("mm"),[f,m]=Te.useState("High"),[p,_]=Te.useState(""),[v,x]=Te.useState(!1),[S,b]=Te.useState("");Te.useEffect(()=>{s!=null&&s.workflow&&Jh.definitions(s.workflow).then(P=>{a(P.filter(w=>w.active!==!1)),l(0),u(""),_(""),b("")})},[s==null?void 0:s.uuid,s==null?void 0:s.workflow]);const y=n[o];if(Te.useEffect(()=>{if(y){const P=BF[y.category]||BF[y.workflow]||"perspective";e==null||e(P),t==null||t(o%5)}},[o,y]),!s)return g.jsxs("div",{className:"flex h-full flex-col items-center justify-center p-8 text-center",children:[g.jsx(ZD,{className:"mb-3 h-10 w-10 text-slate-600"}),g.jsx("p",{className:"text-sm text-slate-400",children:"No active measurement session."}),g.jsx("p",{className:"mt-1 text-xs text-slate-500",children:"Start a session from the Measurement Studio to begin guided 3D recording."})]});if(!y)return g.jsxs("div",{className:"flex h-full flex-col items-center justify-center p-8 text-center",children:[g.jsx(hg,{className:"mb-3 h-10 w-10 text-emerald-400"}),g.jsx("p",{className:"text-sm text-slate-300",children:"All measurements complete."})]});const I=async()=>{if(c){x(!0),b("");try{const P=await Jh.save(s,y,{value:Number(c),entered_unit:h,confidence:f,notes:p,photo_url:""},r);P.warning&&b(P.warning),u(""),_(""),o{x(!0);try{await Jh.skip(s,y,"Not applicable for this limb",r),ou(P.target.value),placeholder:"Enter measurement",className:"workshop-input flex-1"}),g.jsxs("select",{value:h,onChange:P=>d(P.target.value),className:"workshop-input w-20",children:[g.jsx("option",{value:"mm",children:"mm"}),g.jsx("option",{value:"cm",children:"cm"}),g.jsx("option",{value:"degrees",children:"°"})]})]})]}),g.jsxs("div",{children:[g.jsx("label",{className:"text-xs font-medium text-slate-400",children:"Confidence"}),g.jsxs("select",{value:f,onChange:P=>m(P.target.value),className:"workshop-input",children:[g.jsx("option",{value:"High",children:"High"}),g.jsx("option",{value:"Medium",children:"Medium"}),g.jsx("option",{value:"Low",children:"Low"})]})]}),g.jsxs("div",{children:[g.jsx("label",{className:"text-xs font-medium text-slate-400",children:"Notes"}),g.jsx("textarea",{value:p,onChange:P=>_(P.target.value),placeholder:"Optional notes...",className:"workshop-input min-h-16"})]}),S&&g.jsxs("div",{className:"flex items-start gap-2 rounded-lg border border-amber-400/30 bg-amber-400/10 px-3 py-2 text-xs text-amber-300",children:[g.jsx(kf,{className:"mt-0.5 h-3.5 w-3.5 shrink-0"}),S]})]})]}),g.jsxs("div",{className:"flex items-center gap-2 border-t border-white/10 p-3",children:[g.jsx("button",{onClick:()=>l(Math.max(0,o-1)),disabled:o===0,className:"btn-secondary !px-3",children:g.jsx(ZO,{className:"h-4 w-4"})}),g.jsxs("button",{onClick:R,disabled:v,className:"btn-secondary flex-1",children:[g.jsx(tBe,{className:"h-4 w-4"}),"Skip"]}),g.jsxs("button",{onClick:I,disabled:v||!c,className:"btn-primary flex-1",children:[g.jsx(YI,{className:"h-4 w-4"}),v?"Saving...":"Save & Next",g.jsx(kT,{className:"h-4 w-4"})]})]})]})}const _pe=[{type:"No contact",color:"#ef4444",label:"No contact"},{type:"Extra clearance",color:"#f97316",label:"Extra clearance"},{type:"Raised scar",color:"#eab308",label:"Raised scar"},{type:"Pinch spot",color:"#c026d3",label:"Pinch spot"},{type:"Painful area",color:"#eab308",label:"Painful area"},{type:"Moving skin",color:"#a855f7",label:"Moving skin"},{type:"Skin fold",color:"#a855f7",label:"Skin fold"},{type:"Heat-sensitive area",color:"#ef4444",label:"Heat sensitive"},{type:"Mechanical keep-out",color:"#6b7280",label:"Mechanical keep-out"},{type:"Safe attachment zone",color:"#3b82f6",label:"Safe attachment"},{type:"Custom",color:"#22d3ee",label:"Custom"}];function WLt({zones:s=[],onSettingsChange:e,onRemoveZone:t,onUndo:i,onRedo:r,canUndo:n,canRedo:a}){const[o,l]=Te.useState(_pe[0]),[c,u]=Te.useState(15),[h,d]=Te.useState(3),[f,m]=Te.useState(""),[p,_]=Te.useState("Medium"),[v,x]=Te.useState("No contact"),[S,b]=Te.useState("");return Te.useEffect(()=>{e==null||e({type:o.type,color:o.color,brushSize:c,clearanceDepth:h,label:f||o.label,sensitivity:p,contactPermission:v,notes:S})},[o,c,h,f,p,v,S]),g.jsxs("div",{className:"flex h-full flex-col",children:[g.jsxs("div",{className:"border-b border-white/10 px-4 py-3",children:[g.jsx("h2",{className:"text-xs font-semibold uppercase tracking-[0.14em] text-cyan-400",children:"Sensitive Zone Mapper"}),g.jsx("p",{className:"mt-1 text-xs text-slate-500",children:"Click on the 3D model to paint zones on the surface."})]}),g.jsxs("div",{className:"flex-1 overflow-y-auto p-4",children:[g.jsxs("div",{className:"mb-4",children:[g.jsx("h3",{className:"mb-2 text-xs font-semibold uppercase tracking-[0.14em] text-slate-400",children:"Zone Tools"}),g.jsx("div",{className:"grid grid-cols-2 gap-1.5",children:_pe.map(y=>g.jsxs("button",{onClick:()=>l(y),className:`flex items-center gap-2 rounded-lg border px-2.5 py-2 text-xs font-medium transition ${o.type===y.type?"border-cyan-400/40 bg-cyan-400/10 text-cyan-300":"border-white/10 text-slate-400 hover:text-slate-200"}`,children:[g.jsx("span",{className:"h-3 w-3 shrink-0 rounded-full",style:{backgroundColor:y.color}}),g.jsx("span",{className:"truncate",children:y.label})]},y.type))})]}),g.jsxs("div",{className:"mb-4 space-y-3",children:[g.jsxs("div",{children:[g.jsxs("label",{className:"mb-1 flex items-center justify-between text-xs font-medium text-slate-400",children:[g.jsxs("span",{className:"flex items-center gap-1",children:[g.jsx(cFe,{className:"h-3 w-3"}),"Brush size"]}),g.jsxs("span",{className:"text-slate-300",children:[c," mm"]})]}),g.jsx("input",{type:"range",min:5,max:40,value:c,onChange:y=>u(parseInt(y.target.value)),className:"w-full accent-cyan-400"})]}),g.jsxs("div",{children:[g.jsxs("label",{className:"mb-1 flex items-center justify-between text-xs font-medium text-slate-400",children:[g.jsx("span",{children:"Clearance depth"}),g.jsxs("span",{className:"text-slate-300",children:[h," mm"]})]}),g.jsx("input",{type:"range",min:0,max:15,value:h,onChange:y=>d(parseInt(y.target.value)),className:"w-full accent-cyan-400"})]}),g.jsxs("div",{children:[g.jsx("label",{className:"text-xs font-medium text-slate-400",children:"Zone label"}),g.jsx("input",{value:f,onChange:y=>m(y.target.value),placeholder:"Optional label",className:"workshop-input"})]}),g.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[g.jsxs("div",{children:[g.jsx("label",{className:"text-xs font-medium text-slate-400",children:"Sensitivity"}),g.jsxs("select",{value:p,onChange:y=>_(y.target.value),className:"workshop-input",children:[g.jsx("option",{children:"Low"}),g.jsx("option",{children:"Medium"}),g.jsx("option",{children:"High"}),g.jsx("option",{children:"Critical"})]})]}),g.jsxs("div",{children:[g.jsx("label",{className:"text-xs font-medium text-slate-400",children:"Contact"}),g.jsxs("select",{value:v,onChange:y=>x(y.target.value),className:"workshop-input",children:[g.jsx("option",{children:"No contact"}),g.jsx("option",{children:"Light contact"}),g.jsx("option",{children:"Full contact"})]})]})]}),g.jsxs("div",{children:[g.jsx("label",{className:"text-xs font-medium text-slate-400",children:"Notes"}),g.jsx("textarea",{value:S,onChange:y=>b(y.target.value),placeholder:"Zone notes...",className:"workshop-input min-h-12"})]})]}),g.jsxs("div",{className:"mb-4 flex items-center gap-1.5",children:[g.jsxs("button",{onClick:i,disabled:!n,className:"btn-secondary !px-3 !py-2 !text-xs",children:[g.jsx(uBe,{className:"h-3.5 w-3.5"}),"Undo"]}),g.jsxs("button",{onClick:r,disabled:!a,className:"btn-secondary !px-3 !py-2 !text-xs",children:[g.jsx(F2e,{className:"h-3.5 w-3.5"}),"Redo"]}),g.jsxs("button",{onClick:()=>s.forEach((y,I)=>t==null?void 0:t(0)),className:"btn-secondary !px-3 !py-2 !text-xs",children:[g.jsx(eO,{className:"h-3.5 w-3.5"}),"Clear"]})]}),g.jsxs("div",{children:[g.jsxs("h3",{className:"mb-2 text-xs font-semibold uppercase tracking-[0.14em] text-slate-400",children:["Painted Zones (",s.length,")"]}),g.jsxs("div",{className:"space-y-1.5",children:[s.map((y,I)=>g.jsxs("div",{className:"flex items-center gap-2 rounded-lg border border-white/10 bg-white/5 px-2.5 py-2 text-xs",children:[g.jsx("span",{className:"h-3 w-3 shrink-0 rounded-full",style:{backgroundColor:y.color}}),g.jsx("span",{className:"flex-1 truncate text-slate-300",children:y.label}),g.jsx("button",{onClick:()=>t==null?void 0:t(I),className:"text-slate-500 hover:text-red-400",children:g.jsx(eO,{className:"h-3.5 w-3.5"})})]},I)),s.length===0&&g.jsx("p",{className:"py-4 text-center text-xs text-slate-500",children:"No zones painted yet. Click on the 3D model to begin."})]})]})]})]})}const HLt=["Socket","Knee","Adapter","Rotation adapter","Pylon","Ankle","Foot","Osseointegration connector","Custom component"];function jLt({assembly:s=[],onAdd:e,onRemove:t,onUpdate:i,onReorder:r,components:n=[]}){const[a,o]=Te.useState(null),[l,c]=Te.useState(!1),u=d=>{e==null||e({component_label:d,position_in_assembly:s.length+1,offset_mm:"0",orientation:"Normal"}),c(!1)},h=a!=null?s[a]:null;return g.jsxs("div",{className:"flex h-full flex-col",children:[g.jsxs("div",{className:"border-b border-white/10 px-4 py-3",children:[g.jsx("h2",{className:"text-xs font-semibold uppercase tracking-[0.14em] text-cyan-400",children:"Prosthesis Mapper"}),g.jsx("p",{className:"mt-1 text-xs text-slate-500",children:"Assembly workspace — position components in a shared coordinate system."})]}),g.jsxs("div",{className:"flex-1 overflow-y-auto p-4",children:[g.jsxs("button",{onClick:()=>c(!l),className:"btn-primary mb-3 w-full",children:[g.jsx($f,{className:"h-4 w-4"}),"Add Component"]}),l&&g.jsx("div",{className:"mb-3 grid grid-cols-2 gap-1.5 rounded-xl border border-white/10 bg-white/5 p-2",children:HLt.map(d=>g.jsx("button",{onClick:()=>u(d),className:"rounded-lg border border-white/10 px-2.5 py-2 text-xs text-slate-300 hover:border-cyan-400/30 hover:text-cyan-300",children:d},d))}),g.jsxs("div",{className:"mb-4 space-y-1.5",children:[s.map((d,f)=>g.jsxs("div",{className:`flex items-center gap-2 rounded-lg border px-2.5 py-2 text-xs transition ${a===f?"border-cyan-400/40 bg-cyan-400/10":"border-white/10 hover:bg-white/5"}`,children:[g.jsx(JFe,{className:"h-3.5 w-3.5 shrink-0 text-slate-600"}),g.jsx("button",{onClick:()=>o(a===f?null:f),className:"flex-1 text-left text-slate-200",children:d.component_label||`Component ${f+1}`}),g.jsx("button",{onClick:()=>r==null?void 0:r(f,-1),className:"text-slate-500 hover:text-cyan-300",children:g.jsx(mFe,{className:"h-3.5 w-3.5"})}),g.jsx("button",{onClick:()=>r==null?void 0:r(f,1),className:"text-slate-500 hover:text-cyan-300",children:g.jsx(qO,{className:"h-3.5 w-3.5"})}),g.jsx("button",{onClick:()=>t==null?void 0:t(f),className:"text-slate-500 hover:text-red-400",children:g.jsx(eO,{className:"h-3.5 w-3.5"})})]},f)),s.length===0&&g.jsx("p",{className:"py-4 text-center text-xs text-slate-500",children:"No components in assembly. Add components to begin."})]}),h&&g.jsxs("div",{className:"space-y-3 rounded-xl border border-cyan-400/20 bg-cyan-400/5 p-3",children:[g.jsx("h3",{className:"text-xs font-semibold uppercase tracking-[0.14em] text-cyan-300",children:h.component_label}),g.jsxs("div",{children:[g.jsx("label",{className:"text-xs font-medium text-slate-400",children:"Vertical offset"}),g.jsx("input",{type:"number",value:h.offset_mm||0,onChange:d=>i==null?void 0:i(a,{offset_mm:d.target.value}),className:"workshop-input"})]}),g.jsxs("div",{children:[g.jsx("label",{className:"text-xs font-medium text-slate-400",children:"Rotation (degrees)"}),g.jsx("input",{type:"number",value:h.rotation_degrees||0,onChange:d=>i==null?void 0:i(a,{rotation_degrees:parseFloat(d.target.value)}),className:"workshop-input"})]}),g.jsxs("div",{children:[g.jsx("label",{className:"text-xs font-medium text-slate-400",children:"Visual scale (alignment only)"}),g.jsx("input",{type:"range",min:"0.5",max:"1.5",step:"0.05",defaultValue:1,className:"w-full accent-cyan-400"}),g.jsx("p",{className:"mt-1 text-[10px] text-amber-300",children:"⚠ Visual scaling does not overwrite verified physical dimensions."})]}),g.jsxs("div",{children:[g.jsx("label",{className:"text-xs font-medium text-slate-400",children:"Connection above"}),g.jsx("input",{value:h.connection_above||"",onChange:d=>i==null?void 0:i(a,{connection_above:d.target.value}),placeholder:"Component above",className:"workshop-input"})]}),g.jsxs("div",{children:[g.jsx("label",{className:"text-xs font-medium text-slate-400",children:"Connection below"}),g.jsx("input",{value:h.connection_below||"",onChange:d=>i==null?void 0:i(a,{connection_below:d.target.value}),placeholder:"Component below",className:"workshop-input"})]}),g.jsxs("div",{children:[g.jsx("label",{className:"text-xs font-medium text-slate-400",children:"Installed visible length (mm)"}),g.jsx("input",{type:"number",value:h.installed_visible_length_mm||"",onChange:d=>i==null?void 0:i(a,{installed_visible_length_mm:parseFloat(d.target.value)}),className:"workshop-input"})]}),g.jsxs("div",{className:"flex gap-1.5",children:[g.jsxs("button",{className:"btn-secondary flex-1 !text-xs",children:[g.jsx(HS,{className:"h-3.5 w-3.5"}),"Hide"]}),g.jsxs("button",{className:"btn-secondary flex-1 !text-xs",children:[g.jsx(Fv,{className:"h-3.5 w-3.5"}),"Lock"]})]})]})]})]})}function XLt({params:s,onParamChange:e,onExplodeView:t,exploded:i=!1}){const r=s||{},n=(a,o)=>e==null?void 0:e({...r,[a]:o});return g.jsxs("div",{className:"flex h-full flex-col",children:[g.jsxs("div",{className:"border-b border-white/10 px-4 py-3",children:[g.jsx("h2",{className:"text-xs font-semibold uppercase tracking-[0.14em] text-cyan-400",children:"Cover Build Workspace"}),g.jsx("p",{className:"mt-1 text-xs text-slate-500",children:"Design the cosmetic cover shell around the prosthesis."})]}),g.jsxs("div",{className:"flex-1 overflow-y-auto p-4",children:[g.jsxs("div",{className:"mb-3 flex items-start gap-2 rounded-xl border border-amber-400/30 bg-amber-400/10 p-3 text-xs text-amber-200",children:[g.jsx(kf,{className:"mt-0.5 h-3.5 w-3.5 shrink-0"}),g.jsxs("span",{children:[g.jsx("strong",{children:"Conceptual preview"})," — not manufacturing geometry. Print Ready unavailable until CAD geometry is connected."]})]}),g.jsxs("div",{className:"mb-4",children:[g.jsxs("h3",{className:"mb-2 flex items-center gap-1.5 text-xs font-semibold uppercase tracking-[0.14em] text-slate-400",children:[g.jsx(Rv,{className:"h-3.5 w-3.5"}),"Geometry"]}),g.jsxs("div",{className:"space-y-3 rounded-xl border border-white/10 bg-white/[0.02] p-3",children:[g.jsx(Wx,{label:"Global clearance",value:r.clearance??6,min:0,max:20,unit:"mm",onChange:a=>n("clearance",a)}),g.jsx(Wx,{label:"Sensitive-zone clearance",value:r.sensitiveClearance??10,min:0,max:25,unit:"mm",onChange:a=>n("sensitiveClearance",a)}),g.jsx(Wx,{label:"Wall thickness",value:r.wallThickness??3,min:1,max:8,unit:"mm",onChange:a=>n("wallThickness",a)}),g.jsx(Wx,{label:"Edge thickness",value:r.edgeThickness??2,min:.5,max:5,unit:"mm",onChange:a=>n("edgeThickness",a)})]})]}),g.jsxs("div",{className:"mb-4",children:[g.jsxs("h3",{className:"mb-2 flex items-center gap-1.5 text-xs font-semibold uppercase tracking-[0.14em] text-slate-400",children:[g.jsx(z0,{className:"h-3.5 w-3.5"}),"Shell Design"]}),g.jsxs("div",{className:"space-y-3 rounded-xl border border-white/10 bg-white/[0.02] p-3",children:[g.jsxs("div",{children:[g.jsx("label",{className:"text-xs font-medium text-slate-400",children:"Panel count"}),g.jsxs("select",{value:r.panelCount??2,onChange:a=>n("panelCount",parseInt(a.target.value)),className:"workshop-input",children:[g.jsx("option",{value:1,children:"1 (Single shell)"}),g.jsx("option",{value:2,children:"2 (Clam shell)"}),g.jsx("option",{value:3,children:"3 (Three-panel)"}),g.jsx("option",{value:4,children:"4 (Four-panel)"})]})]}),g.jsxs("div",{children:[g.jsx("label",{className:"text-xs font-medium text-slate-400",children:"Seam orientation"}),g.jsxs("select",{value:r.seamOrientation??"medial-lateral",onChange:a=>n("seamOrientation",a.target.value),className:"workshop-input",children:[g.jsx("option",{value:"medial-lateral",children:"Medial-lateral"}),g.jsx("option",{value:"anterior-posterior",children:"Anterior-posterior"}),g.jsx("option",{value:"spiral",children:"Spiral"})]})]}),g.jsxs("div",{children:[g.jsx("label",{className:"text-xs font-medium text-slate-400",children:"Shell type"}),g.jsxs("select",{value:r.shellType??"clam",onChange:a=>n("shellType",a.target.value),className:"workshop-input",children:[g.jsx("option",{value:"hinged",children:"Hinged shell"}),g.jsx("option",{value:"clam",children:"Clam shell"}),g.jsx("option",{value:"overlapping",children:"Overlapping wrap"})]})]}),g.jsxs("div",{children:[g.jsx("label",{className:"text-xs font-medium text-slate-400",children:"Opening direction"}),g.jsxs("select",{value:r.openingDirection??"medial",onChange:a=>n("openingDirection",a.target.value),className:"workshop-input",children:[g.jsx("option",{value:"medial",children:"Medial"}),g.jsx("option",{value:"lateral",children:"Lateral"}),g.jsx("option",{value:"anterior",children:"Anterior"}),g.jsx("option",{value:"posterior",children:"Posterior"})]})]}),g.jsxs("div",{children:[g.jsx("label",{className:"text-xs font-medium text-slate-400",children:"Attachment type"}),g.jsxs("select",{value:r.attachment??"clip",onChange:a=>n("attachment",a.target.value),className:"workshop-input",children:[g.jsx("option",{value:"clip",children:"Clip"}),g.jsx("option",{value:"magnetic",children:"Magnetic"}),g.jsx("option",{value:"straps",children:"Straps"}),g.jsx("option",{value:"friction",children:"Friction fit"})]})]}),g.jsx(Wx,{label:"Ventilation density",value:r.ventilationDensity??30,min:0,max:100,unit:"%",onChange:a=>n("ventilationDensity",a)}),g.jsx(Wx,{label:"Edge rounding",value:r.edgeRounding??50,min:0,max:100,unit:"%",onChange:a=>n("edgeRounding",a)})]})]}),g.jsxs("div",{className:"mb-4",children:[g.jsx("h3",{className:"mb-2 text-xs font-semibold uppercase tracking-[0.14em] text-slate-400",children:"SHiRE Logo"}),g.jsxs("div",{className:"space-y-3 rounded-xl border border-white/10 bg-white/[0.02] p-3",children:[g.jsx(Wx,{label:"Logo size",value:r.logoSize??40,min:15,max:80,unit:"mm",onChange:a=>n("logoSize",a)}),g.jsx(Wx,{label:"Logo depth",value:r.logoDepth??1.5,min:0,max:5,step:.5,unit:"mm",onChange:a=>n("logoDepth",a)}),g.jsxs("div",{children:[g.jsx("label",{className:"text-xs font-medium text-slate-400",children:"Logo placement"}),g.jsxs("select",{value:r.logoPlacement??"exterior",onChange:a=>n("logoPlacement",a.target.value),className:"workshop-input",children:[g.jsx("option",{value:"exterior",children:"Exterior surface"}),g.jsx("option",{value:"inlay",children:"Inlay"}),g.jsx("option",{value:"recessed",children:"Recessed"}),g.jsx("option",{value:"plate",children:"Logo plate"})]})]})]})]}),g.jsxs("button",{onClick:t,className:`btn-secondary w-full ${i?"border-cyan-400/40 text-cyan-300":""}`,children:[g.jsx(MFe,{className:"h-4 w-4"}),i?"Collapse exploded view":"Exploded view"]})]})]})}function Wx({label:s,value:e,min:t,max:i,step:r=1,unit:n,onChange:a}){return g.jsxs("div",{children:[g.jsxs("label",{className:"mb-1 flex items-center justify-between text-xs font-medium text-slate-400",children:[g.jsx("span",{children:s}),g.jsxs("span",{className:"text-slate-300",children:[e," ",n]})]}),g.jsx("input",{type:"range",min:t,max:i,step:r,value:e,onChange:o=>a(parseFloat(o.target.value)),className:"w-full accent-cyan-400"})]})}const $Lt={list:()=>Bt.database.list("LimbProfile"),byCustomer:s=>Bt.database.filter("LimbProfile",{customer_uuid:s})},YLt={list:()=>Bt.database.list("Prosthesis"),byCustomer:s=>Bt.database.filter("Prosthesis",{customer_uuid:s})},qLt=["Socket","Knee","Pylon","Ankle","Foot"],ZLt=[{to:"/dashboard",label:"Dashboard",icon:tme},{to:"/customers",label:"Customers",icon:V5},{to:"/new-cover",label:"New Cover",icon:KD},{to:"/projects",label:"Cover Projects",icon:KD},{to:"/components",label:"Component Library",icon:YO},{to:"/reports",label:"Reports",icon:Qpe},{to:"/migration-readiness",label:"Migration Readiness",icon:k5},{to:"/settings",label:"Settings",icon:sme}],KLt=[{id:"measure",label:"Measurement Studio",icon:Yp},{id:"assembly",label:"Prosthesis Mapper",icon:YO},{id:"sensitive",label:"Sensitive Zones",icon:bD},{id:"cover",label:"Cover Build",icon:t2e}];function QLt(){const[s,e]=Te.useState([]),[t,i]=Te.useState(!0),[r,n]=Te.useState([]),[a,o]=Te.useState([]),[l,c]=Te.useState([]),[u,h]=Te.useState([]),[d,f]=Te.useState([]),[m,p]=Te.useState([]),[_,v]=Te.useState(null),[x,S]=Te.useState(null),[b,y]=Te.useState("perspective"),[I,R]=Te.useState(!1),[A,P]=Te.useState(1),[w,L]=Te.useState(!1),[k,V]=Te.useState({measurements:!0,sensitive:!0,keepOut:!0,access:!0,cover:!0,movement:!0,logo:!0}),[U,ne]=Te.useState("measure"),[oe,le]=Te.useState("select"),[Y,te]=Te.useState(null),[Z,j]=Te.useState([]),[G,J]=Te.useState([]),[$,re]=Te.useState([]),[ie,ve]=Te.useState([]),[Re,Ie]=Te.useState([]),[de,q]=Te.useState([]),[pe,Oe]=Te.useState(null);Te.useEffect(()=>{if(pe||d.length===0)return;const Oi=new URLSearchParams(window.location.search).get("session"),lr=Oi?d.find(yt=>yt.uuid===Oi&&yt.status!=="Complete"):null,He=d.length===1&&d[0].status!=="Complete"?d[0]:null,ut=lr||He;ut&&(console.info("[SHiRE] Bound sole open measurement session to 3D workspace",ut.uuid),Oe(ut))},[d,pe]);const[Me,Ve]=Te.useState(-1),[tt,lt]=Te.useState(null),[Ne,at]=Te.useState([]),[Ee,me]=Te.useState([]),[Xe,Fe]=Te.useState([]),[it,Ye]=Te.useState({type:"No contact",color:"#ef4444",brushSize:15}),[Dt,Lt]=Te.useState([]),[Vt,ai]=Te.useState({clearance:6,wallThickness:3,sensitiveClearance:10,panelCount:2,shellType:"clam",seamOrientation:"medial-lateral",ventilationDensity:30,logoSize:40,logoDepth:1.5}),[Ft,Wt]=Te.useState(!1),[ri,he]=Te.useState(!1),[ct,Je]=Te.useState(!1),[Nt,mi]=Te.useState(!1),[De,Ct]=Te.useState(!1),[ot,we]=Te.useState(!1),be=Te.useRef(!0);Te.useEffect(()=>(be.current=!0,()=>{be.current=!1}),[]),Te.useEffect(()=>{be.current=!0,Promise.all([So.list(),$Lt.list(),YLt.list(),au.list(),Vp.list(),Jh.sessions().catch(()=>[])]).then(([Oi,lr,He,ut,yt,At])=>{if(!be.current)return;const Tt=(Oi||[]).filter(Le=>Le.record_state!=="archived"),pi=(lr||[]).filter(Le=>Le.record_state!=="archived"),Ai=(He||[]).filter(Le=>Le.record_state!=="archived"),Ui=(ut||[]).filter(Le=>Le.record_state!=="archived"),qi=(yt||[]).filter(Le=>Le.record_state!=="archived"&&Le.status!=="obsolete"),Bi=(At||[]).filter(Le=>Le.record_state!=="archived");n(Tt),o(pi),c(Ai),h(Ui),p(qi),f(Bi);const yi=Tt.map(Le=>({type:"customer",label:Le.full_name||Le.preferred_name||Le.customer_number,uuid:Le.uuid,data:Le,children:pi.filter(Jt=>Jt.customer_uuid===Le.uuid).map(Jt=>({type:"limb",label:Jt.profile_name||Jt.configuration,uuid:Jt.uuid,data:Jt,children:Ai.filter(nr=>nr.customer_uuid===Le.uuid&&nr.limb_profile_uuid===Jt.uuid).map(nr=>({type:"prosthesis",label:nr.name||`${nr.manufacturer||""} ${nr.model||""}`.trim()||"Prosthesis",uuid:nr.uuid,data:nr,children:nt(qi,nr)}))}))}));e(yi),i(!1)}).catch(()=>{be.current&&i(!1)})},[]);function nt(Oi,lr){const He=lr.component_uuids||[],ut=Oi.filter(At=>He.includes(At.uuid)),yt=[];for(const At of qLt){const Tt=ut.filter(pi=>pi.category===At);Tt.length>0?yt.push(...Tt.map(pi=>({type:"component",label:`${At}: ${pi.manufacturer} ${pi.model}`,uuid:pi.uuid,data:pi,category:At}))):yt.push({type:"component",label:At,uuid:`placeholder-${At}`,category:At,placeholder:!0})}return yt.push({type:"sensitive",label:"Sensitive Zones",uuid:"sensitive-group"}),yt.push({type:"access",label:"Access Zones",uuid:"access-group"}),yt.push({type:"cover",label:"Cover Panels",uuid:"cover-group"}),yt.push({type:"logo",label:"SHiRE Logo",uuid:"logo-group"}),yt}function ci(Oi){const He=(Oi&&Oi.length?Oi:[{station_name:"Bottom Boundary"},{station_name:"Pylon Diameter"},{station_name:"Socket Distal Station"},{station_name:"Socket Mid Station"},{station_name:"Socket Upper Station"},{station_name:"Top Boundary"}]).map((ut,yt)=>({type:"station",uuid:String(yt),index:yt,data:ut,label:`${String(yt+1).padStart(2,"0")} — ${ut.station_name||ut.name||`Station ${yt+1}`}`}));return{type:"assembly-group",label:"Visual Assembly (generic)",uuid:"assembly-group",children:[{type:"part",partId:"residual",label:"Residual Limb / Liner",uuid:"residual"},{type:"part",partId:"socket",label:"Socket",uuid:"socket"},{type:"part",partId:"adapter",label:"Distal Socket Adapter",uuid:"adapter"},{type:"part",partId:"pylon",label:"Pylon",uuid:"pylon"},{type:"part",partId:"clamp",label:"Tube Clamp",uuid:"clamp"},{type:"part",partId:"ankle",label:"Ankle Adapter",uuid:"ankle"},{type:"part",partId:"foot",label:"Foot",uuid:"foot"},{type:"cover",label:"Conceptual Cover",uuid:"preview"},{type:"logo",label:"SHiRE Logo (mandatory)",uuid:"mark"},{type:"stations-group",label:"Measurement Stations",uuid:"stations-group",children:He}]}}const mt=Te.useMemo(()=>[ci(G),...s],[s,G]),ee=Te.useCallback(async Oi=>{te(Oi);const[lr,He,ut,yt,At]=await Promise.all([ys.dimensions(Oi.uuid),ys.stations(Oi.uuid),ys.accessPoints(Oi.uuid),ys.keepOutZones(Oi.uuid),ys.movementPositions(Oi.uuid)]);if(be.current){j(lr||[]),J(He||[]),re(ut||[]),ve(yt||[]),Ie(At||[]);try{const Tt=await N0.completeness(Oi);be.current&&q(Tt.blocking||[])}catch{be.current&&q([])}}},[]);Te.useEffect(()=>{(_==null?void 0:_.type)==="component"&&_.data&&!_.placeholder&&(ee(_.data),Jh.sessions().then(Oi=>{if(!be.current)return;const lr=Oi.find(He=>He.component_uuid===_.data.uuid&&He.status!=="Complete");lr&&Oe(lr)}))},[x]);const ce=Oi=>{v(Oi),S(`${Oi.type}-${Oi.uuid||Oi.id}`),he(!1)},dt=(Oi,lr,He)=>{v({type:Oi,index:lr,data:He}),S(`${Oi}-${lr}`),Oi==="station"&&Ve(lr),Oi==="movement"&<(He==null?void 0:He.angle_degrees),Je(!0)},qt=Oi=>{if(Oi==="ortho"){R(!I);return}y(Oi)},jt=Oi=>V(lr=>({...lr,[Oi]:!lr[Oi]})),ei=Te.useCallback(Oi=>{if(U!=="sensitive")return;const lr={...it,position:[Oi.x,Oi.y,Oi.z]};me(He=>[...He,Ne]),at(He=>[...He,lr]),Fe([])},[U,it,Ne]),_i=()=>{Ee.length!==0&&(Fe(Oi=>[...Oi,Ne]),at(Ee[Ee.length-1]),me(Oi=>Oi.slice(0,-1)))},Mi=()=>{Xe.length!==0&&(me(Oi=>[...Oi,Ne]),at(Xe[Xe.length-1]),Fe(Oi=>Oi.slice(0,-1)))},vr=Oi=>{me(lr=>[...lr,Ne]),at(lr=>lr.filter((He,ut)=>ut!==Oi)),Fe([])},Kr=()=>{},$r=Y&&Y.category==="Knee"?"component":"limb",Hr=(_==null?void 0:_.type)==="station",Ma=()=>{var Oi;return U==="measure"?g.jsx(zLt,{session:pe,onGuidedView:y,onHighlightStation:Ve,onComplete:()=>ne(null)}):U==="sensitive"?g.jsx(WLt,{zones:Ne,onSettingsChange:Ye,onRemoveZone:vr,onUndo:_i,onRedo:Mi,canUndo:Ee.length>0,canRedo:Xe.length>0}):U==="assembly"?g.jsx(jLt,{assembly:Dt,onAdd:lr=>Lt(He=>[...He,lr]),onRemove:lr=>Lt(He=>He.filter((ut,yt)=>yt!==lr)),onUpdate:(lr,He)=>Lt(ut=>ut.map((yt,At)=>At===lr?{...yt,...He}:yt)),onReorder:(lr,He)=>Lt(ut=>{const yt=lr+He;if(yt<0||yt>=ut.length)return ut;const At=[...ut];return[At[lr],At[yt]]=[At[yt],At[lr]],At})}):U==="cover"?g.jsx(XLt,{params:Vt,onParamChange:ai,onExplodeView:()=>Wt(!Ft),exploded:Ft}):g.jsxs(g.Fragment,{children:[Hr?g.jsx(LLt,{selected:_,stationIndex:_.index,previousValue:(Oi=_.data)==null?void 0:Oi.prev,onSave:()=>Ve(-1),onMeasureAgain:()=>Ve(_.index),onNotApplicable:()=>v(null)}):g.jsx(wLt,{selected:_,component:Y,dimensions:Z,stations:G,accessPoints:$,keepOutZones:ie,movementPositions:Re,missingInfo:de,context:{customers:r,limbs:a,prostheses:l,projects:u,components:m,sessions:d},coverParams:Vt,display:k}),g.jsx("div",{className:"border-t border-white/10"}),g.jsx(FLt,{}),g.jsx("div",{className:"border-t border-white/10 px-4 pb-4",children:g.jsx(Ar,{to:"/measurements",className:"btn-secondary w-full !min-h-10",children:"View All Measurements"})})]})},Va=(pe==null?void 0:pe.status)==="Complete"?"Session Complete":pe?"Live Capture":"Missing Measurements";return g.jsxs("div",{className:"flex h-screen flex-col bg-workshop",children:[g.jsx(kLt,{route:"/customers/ACME-0421/measurements",onLock:Kr}),g.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[g.jsx("aside",{className:`fixed inset-y-0 left-0 z-40 w-72 border-r border-white/10 bg-[#0d1318] transition-transform lg:static lg:translate-x-0 ${ri?"translate-x-0":"-translate-x-full"}`,children:g.jsxs("div",{className:"flex h-full flex-col",children:[g.jsxs("div",{className:"flex items-center justify-between border-b border-white/10 px-4 py-3",children:[g.jsx("span",{className:"text-sm font-bold tracking-[0.16em] text-cyan-300",children:"SHiRE LimbForge"}),g.jsx("button",{onClick:()=>he(!1),className:"icon-btn lg:hidden",children:g.jsx(m0,{className:"h-4 w-4"})})]}),g.jsxs("nav",{className:"overflow-y-auto px-2 py-2",children:[KLt.map(Oi=>{const lr=Oi.icon,He=U===Oi.id;return g.jsxs("button",{onClick:()=>{ne(Oi.id),Je(!0)},className:`nav-link w-full ${He?"nav-link-active":""}`,children:[g.jsx(lr,{className:"h-5 w-5"}),Oi.label]},Oi.label)}),g.jsx("div",{className:"my-2 h-px bg-white/10"}),ZLt.map(Oi=>{const lr=Oi.icon;return g.jsxs(Ar,{to:Oi.to,className:"nav-link",children:[g.jsx(lr,{className:"h-5 w-5"}),Oi.label]},Oi.to)}),g.jsxs("button",{onClick:Kr,className:"nav-link w-full",children:[g.jsx(Fv,{className:"h-5 w-5"}),"Lock Workshop"]})]}),g.jsx("div",{className:"min-h-0 flex-1 border-t border-white/10",children:g.jsx(ALt,{tree:mt,selectedId:x,onSelect:ce})}),g.jsxs("div",{className:"flex items-center justify-between border-t border-white/10 px-4 py-2 text-[10px] text-slate-500",children:[g.jsx("span",{children:"v2.3.1"}),g.jsxs("span",{className:"flex items-center gap-1.5 text-emerald-400",children:[g.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-400"}),"All systems operational"]})]})]})}),ri&&g.jsx("div",{className:"fixed inset-0 z-30 bg-black/50 lg:hidden",onClick:()=>he(!1)}),g.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[g.jsxs("div",{className:"flex items-center gap-2 border-b border-white/10 bg-[#0d1318]/90 px-3 py-2 lg:hidden",children:[g.jsx("button",{onClick:()=>he(!0),className:"icon-btn",children:g.jsx(ime,{className:"h-4 w-4"})}),g.jsx("button",{onClick:()=>Je(!0),className:"btn-secondary !px-3",children:"Inspector"})]}),g.jsxs("div",{className:"shrink-0 px-4 py-3",children:[g.jsxs("div",{className:"flex items-center gap-3",children:[g.jsxs("div",{children:[g.jsx("h1",{className:"text-lg font-semibold text-white",children:"Measurement Studio"}),g.jsx("p",{className:"text-xs text-slate-500",children:"Guided 3D capture with live measurement markers and design-ready prosthetic mapping."})]}),g.jsxs("span",{className:"ml-auto inline-flex items-center gap-1.5 rounded-full border border-cyan-400/40 bg-cyan-400/10 px-3 py-1 text-xs font-semibold text-cyan-300",children:[g.jsx("span",{className:"h-1.5 w-1.5 animate-pulse rounded-full bg-cyan-400"}),Va]})]}),g.jsx("div",{className:"mt-3",children:g.jsx(BLt,{compact:!0})})]}),g.jsx(DLt,{viewPreset:b,onView:qt,ortho:I,display:k,onToggle:jt,transparency:A,onTransparency:P,onFit:()=>y("fit"),onReset:()=>y("reset"),onSection:()=>L(!w)}),g.jsxs("div",{className:"flex min-h-0 flex-1",children:[g.jsx(ULt,{activeTool:oe,onTool:le}),g.jsxs("div",{className:"relative min-w-0 flex-1",children:[g.jsx(GLt,{onReset:()=>{y("reset"),V(Oi=>({...Oi,measurements:!0})),Ct(!1)},onCompatibility:()=>Ct(!0),children:g.jsx(hLt,{viewPreset:b,ortho:I,onBackgroundClick:()=>{v(null),S(null),Ve(-1)},onCoreFailure:()=>we(!0),children:g.jsx(RLt,{mode:$r,component:Y,dimensions:Z,stations:G,accessPoints:$,keepOutZones:ie,movementPositions:Re,sensitiveZones:Ne,selectedId:x,onSelect:dt,highlightedStation:Me,selectedAngle:tt,show:k,transparency:A,coverClearance:Vt.clearance,coverThickness:Vt.wallThickness,onPaint:U==="sensitive"?ei:null,paintColor:it.color,compatibility:De})})}),g.jsx(dLt,{}),De&&g.jsxs("div",{className:"absolute right-4 top-4 z-20 flex items-center gap-2 rounded-lg border border-amber-400/40 bg-[#0b0f13]/95 px-3 py-1.5 text-xs text-amber-300",children:[g.jsx(qp,{className:"h-4 w-4"}),g.jsx("span",{children:"Compatibility Mode — transparency, movement & zones disabled"}),g.jsx("button",{onClick:()=>Ct(!1),className:"ml-1 rounded border border-amber-400/40 px-2 py-0.5 text-[11px] hover:bg-amber-400/10",children:"Exit"})]}),!Y&&g.jsx("div",{className:"pointer-events-none absolute left-1/2 top-6 -translate-x-1/2 rounded-xl border border-white/10 bg-[#0b0f13]/90 px-4 py-2 text-sm text-slate-400 backdrop-blur",children:"Select a component from the project tree to load its 3D model — a generic measurement model is shown meanwhile."}),U==="sensitive"&&g.jsxs("div",{className:"pointer-events-none absolute left-1/2 bottom-6 -translate-x-1/2 rounded-xl border border-purple-400/30 bg-[#0b0f13]/90 px-4 py-2 text-sm text-purple-300 backdrop-blur",children:[g.jsx(qp,{className:"mr-1.5 inline h-4 w-4"}),"Paint mode active — click on the 3D model to place zones"]}),w&&g.jsx("div",{className:"absolute left-4 top-4 rounded-lg border border-cyan-400/30 bg-[#0b0f13]/90 px-3 py-1.5 text-xs text-cyan-300",children:"Section cut active"})]})]}),Y&&G.length>0&&g.jsx("div",{className:"max-h-52 shrink-0 overflow-y-auto border-t border-white/10 bg-[#0d1318]/90 backdrop-blur",children:g.jsx(NLt,{stations:G,selectedId:x,onSelect:dt,onAdd:()=>{},onDuplicate:()=>{},onDelete:()=>{},onSetSpacing:()=>{}})})]}),g.jsx("aside",{className:`fixed inset-x-0 bottom-0 z-40 max-h-[75vh] overflow-hidden border-t border-white/10 bg-[#0d1318] transition-transform lg:static lg:max-h-none lg:w-80 lg:border-t-0 lg:border-l ${ct?"translate-y-0":"translate-y-full lg:translate-y-0"}`,children:g.jsxs("div",{className:"flex h-full flex-col",children:[g.jsxs("div",{className:"flex items-center justify-between border-b border-white/10 px-4 py-2 lg:hidden",children:[g.jsx("span",{className:"text-xs font-semibold text-slate-400",children:"INSPECTOR"}),g.jsx("button",{onClick:()=>Je(!1),className:"icon-btn",children:g.jsx(m0,{className:"h-4 w-4"})})]}),g.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto",children:Ma()})]})}),!ct&&g.jsx("button",{onClick:()=>Je(!0),className:"fixed bottom-4 right-4 z-30 rounded-full bg-cyan-400 px-4 py-3 text-sm font-semibold text-slate-950 shadow-lg lg:hidden",children:"Inspector"}),g.jsxs("button",{onClick:()=>we(!0),className:"fixed bottom-4 left-4 z-30 inline-flex items-center gap-1.5 rounded-full border border-white/10 bg-[#0d1318]/90 px-3 py-2 text-xs font-medium text-slate-300 shadow-lg hover:text-cyan-300",children:[g.jsx(k5,{className:"h-4 w-4"})," Diagnostics"]}),g.jsx(pLt,{open:ot,onClose:()=>we(!1),onResetCamera:()=>y("reset"),onDisableLayers:()=>V({measurements:!1,access:!1,keepOut:!1,sensitive:!1,movement:!1,cover:!1,logo:!1}),onReloadLayers:()=>V({measurements:!0,access:!0,keepOut:!0,sensitive:!0,movement:!0,cover:!0,logo:!0})})]})]})}function JLt(){return g.jsx(FLe,{client:BLe,children:g.jsxs(eLe,{basename:"/agents/limbforge",children:[g.jsx(h3e,{}),g.jsxs(j1e,{children:[g.jsx(Ea,{path:"/workshop-3d",element:g.jsx(QLt,{})}),g.jsxs(Ea,{element:g.jsx(A3e,{}),children:[g.jsx(Ea,{index:!0,element:g.jsx(I8,{to:"/dashboard",replace:!0})}),g.jsx(Ea,{path:"/dashboard",element:g.jsx(M3e,{})}),g.jsx(Ea,{path:"/customers",element:g.jsx(H3e,{})}),g.jsx(Ea,{path:"/customers/:uuid",element:g.jsx(Z3e,{})}),g.jsx(Ea,{path:"/projects",element:g.jsx(Q3e,{})}),g.jsx(Ea,{path:"/projects/:projectId",element:g.jsx(Z0t,{})}),g.jsx(Ea,{path:"/new-cover",element:g.jsx(iRt,{})}),g.jsx(Ea,{path:"/take-measurements",element:g.jsx(nIt,{})}),g.jsx(Ea,{path:"/measurements",element:g.jsx(nRt,{})}),g.jsx(Ea,{path:"/measurements/:uuid",element:g.jsx(vRt,{})}),g.jsx(Ea,{path:"/components",element:g.jsx(eCt,{})}),g.jsx(Ea,{path:"/components/:uuid/dimensions",element:g.jsx(FCt,{})}),g.jsx(Ea,{path:"/ossiguard",element:g.jsx(tde,{})}),g.jsx(Ea,{path:"/ossiguard-connectors",element:g.jsx(tde,{})}),g.jsx(Ea,{path:"/ossiguard-connectors/new",element:g.jsx(rde,{})}),g.jsx(Ea,{path:"/ossiguard-connectors/:connectorId/edit",element:g.jsx(rde,{})}),g.jsx(Ea,{path:"/ossiguard/:uuid",element:g.jsx(xRt,{})}),g.jsx(Ea,{path:"/design-forge",element:g.jsx(sde,{})}),g.jsx(Ea,{path:"/projects/:projectId/design-forge",element:g.jsx(sde,{})}),g.jsx(Ea,{path:"/validation",element:g.jsx(qRt,{})}),g.jsx(Ea,{path:"/manufacturing",element:g.jsx(QRt,{})}),g.jsx(Ea,{path:"/manufacturing/:jobId",element:g.jsx(eIt,{})}),g.jsx(Ea,{path:"/completed-covers",element:g.jsx(iIt,{})}),g.jsx(Ea,{path:"/completed-covers/:coverId",element:g.jsx(rIt,{})}),g.jsx(Ea,{path:"/settings",element:g.jsx(sIt,{})}),g.jsx(Ea,{path:"*",element:g.jsx(I8,{to:"/dashboard",replace:!0})})]})]}),g.jsx(c3e,{})]})})}KNe.createRoot(document.getElementById("root")).render(g.jsx(Rpe.StrictMode,{children:g.jsx(JLt,{})}));export{Kf as $,Cg as A,K0 as B,Rg as C,Qv as D,sot as E,lf as F,K5e as G,zRe as H,uf as I,qv as J,wot as K,_rt as L,ip as M,Kv as N,ma as O,jRe as P,cf as Q,$Je as R,Bv as S,mrt as T,tje as U,xy as V,Eg as W,AGe as X,WX as Y,rQe as Z,RCe as _,Yt as a,tm as a0,im as a1,rm as a2,Qf as a3,Jm as a4,e_ as a5,nf as a6,af as a7,Jf as a8,fh as a9,dd as aa,ef as ab,tf as ac,ph as ad,rf as ae,sf as af,Nu as ag,mh as ah,fd as ai,gy as aj,vy as ak,Qa as al,lA as am,Tj as an,Ej as ao,yj as ap,WGe as aq,bye as ar,jEe as as,ye as at,dc as au,la as av,_r as aw,DA as ax,YFt as b,HQe as c,XQe as d,A$ as e,trt as f,N as g,sp as h,ib as i,Zv as j,rb as k,Lu as l,YRe as m,np as n,yg as o,mA as p,ka as q,ap as r,pd as s,_y as t,VRe as u,op as v,iC as w,tb as x,tp as y,Zl as z};
==============================================================================
EVENT LISTENERS IN VIEWPORT FILE: /home/shire3d/ARMOR/agents/apps/limbforge/dist/shire-module/assets/shire-index-DUDAhpkx.js
==============================================================================
LISTENER CONTEXT 26-50
000026: */var _8;function XNe(){return _8||(_8=1,(function(s){function e(Y,te){var Z=Y.length;Y.push(te);e:for(;0>>1,G=Y[j];if(0>>1;jr(re,Z))ier(ve,re)?(Y[j]=ve,Y[ie]=Z,j=ie):(Y[j]=re,Y[$]=Z,j=$);else if(ier(ve,Z))Y[j]=ve,Y[ie]=Z,j=ie;else break e}}return te}function r(Y,te){var Z=Y.sortIndex-te.sortIndex;return Z!==0?Z:Y.id-te.id}if(typeof performance=="object"&&typeof performance.now=="function"){var n=performance;s.unstable_now=function(){return n.now()}}else{var a=Date,o=a.now();s.unstable_now=function(){return a.now()-o}}var l=[],c=[],u=1,h=null,d=3,f=!1,m=!1,p=!1,_=typeof setTimeout=="function"?setTimeout:null,v=typeof clearTimeout=="function"?clearTimeout:null,x=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function S(Y){for(var te=t(c);te!==null;){if(te.callback===null)i(c);else if(te.startTime<=Y)i(c),te.sortIndex=te.expirationTime,e(l,te);else break;te=t(c)}}function b(Y){if(p=!1,S(Y),!m)if(t(l)!==null)m=!0,oe(y);else{var te=t(c);te!==null&&le(b,te.startTime-Y)}}function y(Y,te){m=!1,p&&(p=!1,v(A),A=-1),f=!0;var Z=d;try{for(S(te),h=t(l);h!==null&&(!(h.expirationTime>te)||Y&&!L());){var j=h.callback;if(typeof j=="function"){h.callback=null,d=h.priorityLevel;var G=j(h.expirationTime<=te);te=s.unstable_now(),typeof G=="function"?h.callback=G:h===t(l)&&i(l),S(te)}else i(l);h=t(l)}if(h!==null)var J=!0;else{var $=t(c);$!==null&&le(b,$.startTime-te),J=!1}return J}finally{h=null,d=Z,f=!1}}var I=!1,R=null,A=-1,P=5,w=-1;function L(){return!(s.unstable_now()-wY||125j?(Y.sortIndex=Z,e(c,Y),t(l)===null&&Y===t(c)&&(p?(v(A),A=-1):p=!0,le(b,Z-j))):(Y.sortIndex=G,e(l,Y),m||f||(m=!0,oe(y))),Y},s.unstable_shouldYield=L,s.unstable_wrapCallback=function(Y){var te=d;return function(){var Z=d;d=te;try{return Y.apply(this,arguments)}finally{d=Z}}}})(L1)),L1}var g8;function $Ne(){return g8||(g8=1,N1.exports=XNe()),N1.exports}/**
000027: * @license React
000028: * react-dom.production.min.js
000029: *
000030: * Copyright (c) Facebook, Inc. and its affiliates.
000031: *
000032: * This source code is licensed under the MIT license found in the
000033: * LICENSE file in the root directory of this source tree.
000034: */var v8;function YNe(){if(v8)return Wd;v8=1;var s=WO(),e=$Ne();function t(T){for(var E="https://reactjs.org/docs/error-decoder.html?invariant="+T,B=1;B"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),l=Object.prototype.hasOwnProperty,c=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,u={},h={};function d(T){return l.call(h,T)?!0:l.call(u,T)?!1:c.test(T)?h[T]=!0:(u[T]=!0,!1)}function f(T,E,B,H){if(B!==null&&B.type===0)return!1;switch(typeof E){case"function":case"symbol":return!0;case"boolean":return H?!1:B!==null?!B.acceptsBooleans:(T=T.toLowerCase().slice(0,5),T!=="data-"&&T!=="aria-");default:return!1}}function m(T,E,B,H){if(E===null||typeof E>"u"||f(T,E,B,H))return!0;if(H)return!1;if(B!==null)switch(B.type){case 3:return!E;case 4:return E===!1;case 5:return isNaN(E);case 6:return isNaN(E)||1>E}return!1}function p(T,E,B,H,ae,_e,We){this.acceptsBooleans=E===2||E===3||E===4,this.attributeName=H,this.attributeNamespace=ae,this.mustUseProperty=B,this.propertyName=T,this.type=E,this.sanitizeURL=_e,this.removeEmptyString=We}var _={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(T){_[T]=new p(T,0,!1,T,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(T){var E=T[0];_[E]=new p(E,1,!1,T[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(T){_[T]=new p(T,2,!1,T.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(T){_[T]=new p(T,2,!1,T,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(T){_[T]=new p(T,3,!1,T.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(T){_[T]=new p(T,3,!0,T,null,!1,!1)}),["capture","download"].forEach(function(T){_[T]=new p(T,4,!1,T,null,!1,!1)}),["cols","rows","size","span"].forEach(function(T){_[T]=new p(T,6,!1,T,null,!1,!1)}),["rowSpan","start"].forEach(function(T){_[T]=new p(T,5,!1,T.toLowerCase(),null,!1,!1)});var v=/[\-:]([a-z])/g;function x(T){return T[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(T){var E=T.replace(v,x);_[E]=new p(E,1,!1,T,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(T){var E=T.replace(v,x);_[E]=new p(E,1,!1,T,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(T){var E=T.replace(v,x);_[E]=new p(E,1,!1,T,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(T){_[T]=new p(T,1,!1,T.toLowerCase(),null,!1,!1)}),_.xlinkHref=new p("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(T){_[T]=new p(T,1,!1,T.toLowerCase(),null,!0,!0)});function S(T,E,B,H){var ae=_.hasOwnProperty(E)?_[E]:null;(ae!==null?ae.type!==0:H||!(2st||ae[We]!==_e[st]){var xt=`
000038: `+ae[We].replace(" at new "," at ");return T.displayName&&xt.includes("")&&(xt=xt.replace("",T.displayName)),xt}while(1<=We&&0<=st);break}}}finally{J=!1,Error.prepareStackTrace=B}return(T=T?T.displayName||T.name:"")?G(T):""}function re(T){switch(T.tag){case 5:return G(T.type);case 16:return G("Lazy");case 13:return G("Suspense");case 19:return G("SuspenseList");case 0:case 2:case 15:return T=$(T.type,!1),T;case 11:return T=$(T.type.render,!1),T;case 1:return T=$(T.type,!0),T;default:return""}}function ie(T){if(T==null)return null;if(typeof T=="function")return T.displayName||T.name||null;if(typeof T=="string")return T;switch(T){case R:return"Fragment";case I:return"Portal";case P:return"Profiler";case A:return"StrictMode";case V:return"Suspense";case U:return"SuspenseList"}if(typeof T=="object")switch(T.$$typeof){case L:return(T.displayName||"Context")+".Consumer";case w:return(T._context.displayName||"Context")+".Provider";case k:var E=T.render;return T=T.displayName,T||(T=E.displayName||E.name||"",T=T!==""?"ForwardRef("+T+")":"ForwardRef"),T;case ne:return E=T.displayName||null,E!==null?E:ie(T.type)||"Memo";case oe:E=T._payload,T=T._init;try{return ie(T(E))}catch{}}return null}function ve(T){var E=T.type;switch(T.tag){case 24:return"Cache";case 9:return(E.displayName||"Context")+".Consumer";case 10:return(E._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return T=E.render,T=T.displayName||T.name||"",E.displayName||(T!==""?"ForwardRef("+T+")":"ForwardRef");case 7:return"Fragment";case 5:return E;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return ie(E);case 8:return E===A?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof E=="function")return E.displayName||E.name||null;if(typeof E=="string")return E}return null}function Re(T){switch(typeof T){case"boolean":case"number":case"string":case"undefined":return T;case"object":return T;default:return""}}function Ie(T){var E=T.type;return(T=T.nodeName)&&T.toLowerCase()==="input"&&(E==="checkbox"||E==="radio")}function de(T){var E=Ie(T)?"checked":"value",B=Object.getOwnPropertyDescriptor(T.constructor.prototype,E),H=""+T[E];if(!T.hasOwnProperty(E)&&typeof B<"u"&&typeof B.get=="function"&&typeof B.set=="function"){var ae=B.get,_e=B.set;return Object.defineProperty(T,E,{configurable:!0,get:function(){return ae.call(this)},set:function(We){H=""+We,_e.call(this,We)}}),Object.defineProperty(T,E,{enumerable:B.enumerable}),{getValue:function(){return H},setValue:function(We){H=""+We},stopTracking:function(){T._valueTracker=null,delete T[E]}}}}function q(T){T._valueTracker||(T._valueTracker=de(T))}function pe(T){if(!T)return!1;var E=T._valueTracker;if(!E)return!0;var B=E.getValue(),H="";return T&&(H=Ie(T)?T.checked?"true":"false":T.value),T=H,T!==B?(E.setValue(T),!0):!1}function Oe(T){if(T=T||(typeof document<"u"?document:void 0),typeof T>"u")return null;try{return T.activeElement||T.body}catch{return T.body}}function Me(T,E){var B=E.checked;return Z({},E,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:B??T._wrapperState.initialChecked})}function Ve(T,E){var B=E.defaultValue==null?"":E.defaultValue,H=E.checked!=null?E.checked:E.defaultChecked;B=Re(E.value!=null?E.value:B),T._wrapperState={initialChecked:H,initialValue:B,controlled:E.type==="checkbox"||E.type==="radio"?E.checked!=null:E.value!=null}}function tt(T,E){E=E.checked,E!=null&&S(T,"checked",E,!1)}function lt(T,E){tt(T,E);var B=Re(E.value),H=E.type;if(B!=null)H==="number"?(B===0&&T.value===""||T.value!=B)&&(T.value=""+B):T.value!==""+B&&(T.value=""+B);else if(H==="submit"||H==="reset"){T.removeAttribute("value");return}E.hasOwnProperty("value")?at(T,E.type,B):E.hasOwnProperty("defaultValue")&&at(T,E.type,Re(E.defaultValue)),E.checked==null&&E.defaultChecked!=null&&(T.defaultChecked=!!E.defaultChecked)}function Ne(T,E,B){if(E.hasOwnProperty("value")||E.hasOwnProperty("defaultValue")){var H=E.type;if(!(H!=="submit"&&H!=="reset"||E.value!==void 0&&E.value!==null))return;E=""+T._wrapperState.initialValue,B||E===T.value||(T.value=E),T.defaultValue=E}B=T.name,B!==""&&(T.name=""),T.defaultChecked=!!T._wrapperState.initialChecked,B!==""&&(T.name=B)}function at(T,E,B){(E!=="number"||Oe(T.ownerDocument)!==T)&&(B==null?T.defaultValue=""+T._wrapperState.initialValue:T.defaultValue!==""+B&&(T.defaultValue=""+B))}var Ee=Array.isArray;function me(T,E,B,H){if(T=T.options,E){E={};for(var ae=0;ae"+E.valueOf().toString()+"",E=Vt.firstChild;T.firstChild;)T.removeChild(T.firstChild);for(;E.firstChild;)T.appendChild(E.firstChild)}});function Ft(T,E){if(E){var B=T.firstChild;if(B&&B===T.lastChild&&B.nodeType===3){B.nodeValue=E;return}}T.textContent=E}var Wt={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},ri=["Webkit","ms","Moz","O"];Object.keys(Wt).forEach(function(T){ri.forEach(function(E){E=E+T.charAt(0).toUpperCase()+T.substring(1),Wt[E]=Wt[T]})});function he(T,E,B){return E==null||typeof E=="boolean"||E===""?"":B||typeof E!="number"||E===0||Wt.hasOwnProperty(T)&&Wt[T]?(""+E).trim():E+"px"}function ct(T,E){T=T.style;for(var B in E)if(E.hasOwnProperty(B)){var H=B.indexOf("--")===0,ae=he(B,E[B],H);B==="float"&&(B="cssFloat"),H?T.setProperty(B,ae):T[B]=ae}}var Je=Z({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Nt(T,E){if(E){if(Je[T]&&(E.children!=null||E.dangerouslySetInnerHTML!=null))throw Error(t(137,T));if(E.dangerouslySetInnerHTML!=null){if(E.children!=null)throw Error(t(60));if(typeof E.dangerouslySetInnerHTML!="object"||!("__html"in E.dangerouslySetInnerHTML))throw Error(t(61))}if(E.style!=null&&typeof E.style!="object")throw Error(t(62))}}function mi(T,E){if(T.indexOf("-")===-1)return typeof E.is=="string";switch(T){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var De=null;function Ct(T){return T=T.target||T.srcElement||window,T.correspondingUseElement&&(T=T.correspondingUseElement),T.nodeType===3?T.parentNode:T}var ot=null,we=null,be=null;function nt(T){if(T=Dd(T)){if(typeof ot!="function")throw Error(t(280));var E=T.stateNode;E&&(E=Fg(E),ot(T.stateNode,T.type,E))}}function ci(T){we?be?be.push(T):be=[T]:we=T}function mt(){if(we){var T=we,E=be;if(be=we=null,nt(T),E)for(T=0;T>>=0,T===0?32:31-(Ds(T)/sn|0)|0}var ra=64,Qr=4194304;function Zn(T){switch(T&-T){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return T&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return T&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return T}}function Go(T,E){var B=T.pendingLanes;if(B===0)return 0;var H=0,ae=T.suspendedLanes,_e=T.pingedLanes,We=B&268435455;if(We!==0){var st=We&~ae;st!==0?H=Zn(st):(_e&=We,_e!==0&&(H=Zn(_e)))}else We=B&~ae,We!==0?H=Zn(We):_e!==0&&(H=Zn(_e));if(H===0)return 0;if(E!==0&&E!==H&&(E&ae)===0&&(ae=H&-H,_e=E&-E,ae>=_e||ae===16&&(_e&4194240)!==0))return E;if((H&4)!==0&&(H|=B&16),E=T.entangledLanes,E!==0)for(T=T.entanglements,E&=H;0B;B++)E.push(T);return E}function xc(T,E,B){T.pendingLanes|=E,E!==536870912&&(T.suspendedLanes=0,T.pingedLanes=0),T=T.eventTimes,E=31-Yi(E),T[E]=B}function vh(T,E){var B=T.pendingLanes&~E;T.pendingLanes=E,T.suspendedLanes=0,T.pingedLanes=0,T.expiredLanes&=E,T.mutableReadLanes&=E,T.entangledLanes&=E,E=T.entanglements;var H=T.eventTimes;for(T=T.expirationTimes;0=Oa),$o=" ",Cd=!1;function Rd(T,E){switch(T){case"keyup":return Ed.indexOf(E.keyCode)!==-1;case"keydown":return E.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Dh(T){return T=T.detail,typeof T=="object"&&"data"in T?T.data:null}var yc=!1;function vf(T,E){switch(T){case"compositionend":return Dh(E);case"keypress":return E.which!==32?null:(Cd=!0,$o);case"textInput":return T=E.data,T===$o&&Cd?null:T;default:return null}}function Gu(T,E){if(yc)return T==="compositionend"||!ro&&Rd(T,E)?(T=Vu(),po=vd=al=null,yc=!1,T):null;switch(T){case"paste":return null;case"keypress":if(!(E.ctrlKey||E.altKey||E.metaKey)||E.ctrlKey&&E.altKey){if(E.char&&1=E)return{node:B,offset:E-T};T=H}e:{for(;B;){if(B.nextSibling){B=B.nextSibling;break e}B=B.parentNode}B=void 0}B=zu(B)}}function jc(T,E){return T&&E?T===E?!0:T&&T.nodeType===3?!1:E&&E.nodeType===3?jc(T,E.parentNode):"contains"in T?T.contains(E):T.compareDocumentPosition?!!(T.compareDocumentPosition(E)&16):!1:!1}function Pn(){for(var T=window,E=Oe();E instanceof T.HTMLIFrameElement;){try{var B=typeof E.contentWindow.location.href=="string"}catch{B=!1}if(B)T=E.contentWindow;else break;E=Oe(T.document)}return E}function xa(T){var E=T&&T.nodeName&&T.nodeName.toLowerCase();return E&&(E==="input"&&(T.type==="text"||T.type==="search"||T.type==="tel"||T.type==="url"||T.type==="password")||E==="textarea"||T.contentEditable==="true")}function Sa(T){var E=Pn(),B=T.focusedElem,H=T.selectionRange;if(E!==B&&B&&B.ownerDocument&&jc(B.ownerDocument.documentElement,B)){if(H!==null&&xa(B)){if(E=H.start,T=H.end,T===void 0&&(T=E),"selectionStart"in B)B.selectionStart=E,B.selectionEnd=Math.min(T,B.value.length);else if(T=(E=B.ownerDocument||document)&&E.defaultView||window,T.getSelection){T=T.getSelection();var ae=B.textContent.length,_e=Math.min(H.start,ae);H=H.end===void 0?_e:Math.min(H.end,ae),!T.extend&&_e>H&&(ae=H,H=_e,_e=ae),ae=Io(B,_e);var We=Io(B,H);ae&&We&&(T.rangeCount!==1||T.anchorNode!==ae.node||T.anchorOffset!==ae.offset||T.focusNode!==We.node||T.focusOffset!==We.offset)&&(E=E.createRange(),E.setStart(ae.node,ae.offset),T.removeAllRanges(),_e>H?(T.addRange(E),T.extend(We.node,We.offset)):(E.setEnd(We.node,We.offset),T.addRange(E)))}}for(E=[],T=B;T=T.parentNode;)T.nodeType===1&&E.push({element:T,left:T.scrollLeft,top:T.scrollTop});for(typeof B.focus=="function"&&B.focus(),B=0;B=document.documentMode,wl=null,Xc=null,Wu=null,ba=!1;function Fh(T,E,B){var H=B.window===B?B.document:B.nodeType===9?B:B.ownerDocument;ba||wl==null||wl!==Oe(H)||(H=wl,"selectionStart"in H&&xa(H)?H={start:H.selectionStart,end:H.selectionEnd}:(H=(H.ownerDocument&&H.ownerDocument.defaultView||window).getSelection(),H={anchorNode:H.anchorNode,anchorOffset:H.anchorOffset,focusNode:H.focusNode,focusOffset:H.focusOffset}),Wu&&Hc(Wu,H)||(Wu=H,H=Dg(Xc,"onSelect"),0qo||(T.current=ox[qo],ox[qo]=null,qo--)}function jn(T,E){qo++,ox[qo]=T.current,T.current=E}var Od={},cl=ja(Od),oc=ja(!1),wd=Od;function hp(T,E){var B=T.type.contextTypes;if(!B)return Od;var H=T.stateNode;if(H&&H.__reactInternalMemoizedUnmaskedChildContext===E)return H.__reactInternalMemoizedMaskedChildContext;var ae={},_e;for(_e in B)ae[_e]=E[_e];return H&&(T=T.stateNode,T.__reactInternalMemoizedUnmaskedChildContext=E,T.__reactInternalMemoizedMaskedChildContext=ae),ae}function Ll(T){return T=T.childContextTypes,T!=null}function o_(){Kn(oc),Kn(cl)}function lx(T,E,B){if(cl.current!==Od)throw Error(t(168));jn(cl,E),jn(oc,B)}function l_(T,E,B){var H=T.stateNode;if(E=E.childContextTypes,typeof H.getChildContext!="function")return B;H=H.getChildContext();for(var ae in H)if(!(ae in E))throw Error(t(108,ve(T)||"Unknown",ae));return Z({},B,H)}function dp(T){return T=(T=T.stateNode)&&T.__reactInternalMemoizedMergedChildContext||Od,wd=cl.current,jn(cl,T),jn(oc,oc.current),!0}function cx(T,E,B){var H=T.stateNode;if(!H)throw Error(t(169));B?(T=l_(T,E,wd),H.__reactInternalMemoizedMergedChildContext=T,Kn(oc),Kn(cl),jn(cl,T)):Kn(oc),jn(oc,B)}var Hu=null,c_=!1,Bg=!1;function u_(T){Hu===null?Hu=[T]:Hu.push(T)}function mb(T){c_=!0,u_(T)}function Bh(){if(!Bg&&Hu!==null){Bg=!0;var T=0,E=ms;try{var B=Hu;for(ms=1;T>=We,ae-=We,Gi=1<<32-Yi(E)+ae|B<us?(Qc=qr,qr=null):Qc=qr.sibling;var Xn=bi(Ut,qr,zt[us],Vi);if(Xn===null){qr===null&&(qr=Qc);break}T&&qr&&Xn.alternate===null&&E(Ut,qr),Rt=_e(Xn,Rt,us),Yr===null?Pr=Xn:Yr.sibling=Xn,Yr=Xn,qr=Qc}if(us===zt.length)return B(Ut,qr),sa&&Nd(Ut,us),Pr;if(qr===null){for(;usus?(Qc=qr,qr=null):Qc=qr.sibling;var Rx=bi(Ut,qr,Xn.value,Vi);if(Rx===null){qr===null&&(qr=Qc);break}T&&qr&&Rx.alternate===null&&E(Ut,qr),Rt=_e(Rx,Rt,us),Yr===null?Pr=Rx:Yr.sibling=Rx,Yr=Rx,qr=Qc}if(Xn.done)return B(Ut,qr),sa&&Nd(Ut,us),Pr;if(qr===null){for(;!Xn.done;us++,Xn=zt.next())Xn=Ii(Ut,Xn.value,Vi),Xn!==null&&(Rt=_e(Xn,Rt,us),Yr===null?Pr=Xn:Yr.sibling=Xn,Yr=Xn);return sa&&Nd(Ut,us),Pr}for(qr=H(Ut,qr);!Xn.done;us++,Xn=zt.next())Xn=cr(qr,Ut,us,Xn.value,Vi),Xn!==null&&(T&&Xn.alternate!==null&&qr.delete(Xn.key===null?us:Xn.key),Rt=_e(Xn,Rt,us),Yr===null?Pr=Xn:Yr.sibling=Xn,Yr=Xn);return T&&qr.forEach(function(kNe){return E(Ut,kNe)}),sa&&Nd(Ut,us),Pr}function kl(Ut,Rt,zt,Vi){if(typeof zt=="object"&&zt!==null&&zt.type===R&&zt.key===null&&(zt=zt.props.children),typeof zt=="object"&&zt!==null){switch(zt.$$typeof){case y:e:{for(var Pr=zt.key,Yr=Rt;Yr!==null;){if(Yr.key===Pr){if(Pr=zt.type,Pr===R){if(Yr.tag===7){B(Ut,Yr.sibling),Rt=ae(Yr,zt.props.children),Rt.return=Ut,Ut=Rt;break e}}else if(Yr.elementType===Pr||typeof Pr=="object"&&Pr!==null&&Pr.$$typeof===oe&&mx(Pr)===Yr.type){B(Ut,Yr.sibling),Rt=ae(Yr,zt.props),Rt.ref=h_(Ut,Yr,zt),Rt.return=Ut,Ut=Rt;break e}B(Ut,Yr);break}else E(Ut,Yr);Yr=Yr.sibling}zt.type===R?(Rt=yb(zt.props.children,Ut.mode,Vi,zt.key),Rt.return=Ut,Ut=Rt):(Vi=AP(zt.type,zt.key,zt.props,null,Ut.mode,Vi),Vi.ref=h_(Ut,Rt,zt),Vi.return=Ut,Ut=Vi)}return We(Ut);case I:e:{for(Yr=zt.key;Rt!==null;){if(Rt.key===Yr)if(Rt.tag===4&&Rt.stateNode.containerInfo===zt.containerInfo&&Rt.stateNode.implementation===zt.implementation){B(Ut,Rt.sibling),Rt=ae(Rt,zt.children||[]),Rt.return=Ut,Ut=Rt;break e}else{B(Ut,Rt);break}else E(Ut,Rt);Rt=Rt.sibling}Rt=C1(zt,Ut.mode,Vi),Rt.return=Ut,Ut=Rt}return We(Ut);case oe:return Yr=zt._init,kl(Ut,Rt,Yr(zt._payload),Vi)}if(Ee(zt))return xr(Ut,Rt,zt,Vi);if(te(zt))return Cr(Ut,Rt,zt,Vi);d_(Ut,zt)}return typeof zt=="string"&&zt!==""||typeof zt=="number"?(zt=""+zt,Rt!==null&&Rt.tag===6?(B(Ut,Rt.sibling),Rt=ae(Rt,zt),Rt.return=Ut,Ut=Rt):(B(Ut,Rt),Rt=E1(zt,Ut.mode,Vi),Rt.return=Ut,Ut=Rt),We(Ut)):B(Ut,Rt)}return kl}var mp=_x(!0),f_=_x(!1),_p=ja(null),gp=null,Fd=null,um=null;function vp(){um=Fd=gp=null}function p_(T){var E=_p.current;Kn(_p),T._currentValue=E}function m_(T,E,B){for(;T!==null;){var H=T.alternate;if((T.childLanes&E)!==E?(T.childLanes|=E,H!==null&&(H.childLanes|=E)):H!==null&&(H.childLanes&E)!==E&&(H.childLanes|=E),T===B)break;T=T.return}}function Ef(T,E){gp=T,um=Fd=null,T=T.dependencies,T!==null&&T.firstContext!==null&&((T.lanes&E)!==0&&(Ls=!0),T.firstContext=null)}function qc(T){var E=T._currentValue;if(um!==T)if(T={context:T,memoizedValue:E,next:null},Fd===null){if(gp===null)throw Error(t(308));Fd=T,gp.dependencies={lanes:0,firstContext:T}}else Fd=Fd.next=T;return E}var Bd=null;function gx(T){Bd===null?Bd=[T]:Bd.push(T)}function __(T,E,B,H){var ae=E.interleaved;return ae===null?(B.next=B,gx(E)):(B.next=ae.next,ae.next=B),E.interleaved=B,ju(T,H)}function ju(T,E){T.lanes|=E;var B=T.alternate;for(B!==null&&(B.lanes|=E),B=T,T=T.return;T!==null;)T.childLanes|=E,B=T.alternate,B!==null&&(B.childLanes|=E),B=T,T=T.return;return B.tag===3?B.stateNode:null}var Ln=!1;function _s(T){T.updateQueue={baseState:T.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function no(T,E){T=T.updateQueue,E.updateQueue===T&&(E.updateQueue={baseState:T.baseState,firstBaseUpdate:T.firstBaseUpdate,lastBaseUpdate:T.lastBaseUpdate,shared:T.shared,effects:T.effects})}function Fn(T,E){return{eventTime:T,lane:E,tag:0,payload:null,callback:null,next:null}}function Ta(T,E,B){var H=T.updateQueue;if(H===null)return null;if(H=H.shared,(Bn&2)!==0){var ae=H.pending;return ae===null?E.next=E:(E.next=ae.next,ae.next=E),H.pending=E,ju(T,B)}return ae=H.interleaved,ae===null?(E.next=E,gx(H)):(E.next=ae.next,ae.next=E),H.interleaved=E,ju(T,B)}function Fl(T,E,B){if(E=E.updateQueue,E!==null&&(E=E.shared,(B&4194240)!==0)){var H=E.lanes;H&=T.pendingLanes,B|=H,E.lanes=B,Ql(T,B)}}function xp(T,E){var B=T.updateQueue,H=T.alternate;if(H!==null&&(H=H.updateQueue,B===H)){var ae=null,_e=null;if(B=B.firstBaseUpdate,B!==null){do{var We={eventTime:B.eventTime,lane:B.lane,tag:B.tag,payload:B.payload,callback:B.callback,next:null};_e===null?ae=_e=We:_e=_e.next=We,B=B.next}while(B!==null);_e===null?ae=_e=E:_e=_e.next=E}else ae=_e=E;B={baseState:H.baseState,firstBaseUpdate:ae,lastBaseUpdate:_e,shared:H.shared,effects:H.effects},T.updateQueue=B;return}T=B.lastBaseUpdate,T===null?B.firstBaseUpdate=E:T.next=E,B.lastBaseUpdate=E}function Xa(T,E,B,H){var ae=T.updateQueue;Ln=!1;var _e=ae.firstBaseUpdate,We=ae.lastBaseUpdate,st=ae.shared.pending;if(st!==null){ae.shared.pending=null;var xt=st,Zt=xt.next;xt.next=null,We===null?_e=Zt:We.next=Zt,We=xt;var Ei=T.alternate;Ei!==null&&(Ei=Ei.updateQueue,st=Ei.lastBaseUpdate,st!==We&&(st===null?Ei.firstBaseUpdate=Zt:st.next=Zt,Ei.lastBaseUpdate=xt))}if(_e!==null){var Ii=ae.baseState;We=0,Ei=Zt=xt=null,st=_e;do{var bi=st.lane,cr=st.eventTime;if((H&bi)===bi){Ei!==null&&(Ei=Ei.next={eventTime:cr,lane:0,tag:st.tag,payload:st.payload,callback:st.callback,next:null});e:{var xr=T,Cr=st;switch(bi=E,cr=B,Cr.tag){case 1:if(xr=Cr.payload,typeof xr=="function"){Ii=xr.call(cr,Ii,bi);break e}Ii=xr;break e;case 3:xr.flags=xr.flags&-65537|128;case 0:if(xr=Cr.payload,bi=typeof xr=="function"?xr.call(cr,Ii,bi):xr,bi==null)break e;Ii=Z({},Ii,bi);break e;case 2:Ln=!0}}st.callback!==null&&st.lane!==0&&(T.flags|=64,bi=ae.effects,bi===null?ae.effects=[st]:bi.push(st))}else cr={eventTime:cr,lane:bi,tag:st.tag,payload:st.payload,callback:st.callback,next:null},Ei===null?(Zt=Ei=cr,xt=Ii):Ei=Ei.next=cr,We|=bi;if(st=st.next,st===null){if(st=ae.shared.pending,st===null)break;bi=st,st=bi.next,bi.next=null,ae.lastBaseUpdate=bi,ae.shared.pending=null}}while(!0);if(Ei===null&&(xt=Ii),ae.baseState=xt,ae.firstBaseUpdate=Zt,ae.lastBaseUpdate=Ei,E=ae.shared.interleaved,E!==null){ae=E;do We|=ae.lane,ae=ae.next;while(ae!==E)}else _e===null&&(ae.shared.lanes=0);xb|=We,T.lanes=We,T.memoizedState=Ii}}function hm(T,E,B){if(T=E.effects,E.effects=null,T!==null)for(E=0;EB?B:4,T(!0);var H=yp.transition;yp.transition={};try{T(!1),E()}finally{ms=B,yp.transition=H}}function pm(){return X().memoizedState}function Dy(T,E,B){var H=yx(T);if(B={lane:H,action:B,hasEagerState:!1,eagerState:null,next:null},gb(T))Oy(E,B);else if(B=__(T,E,B,H),B!==null){var ae=zh();vm(B,T,H,ae),wy(B,E,H)}}function Wg(T,E,B){var H=yx(T),ae={lane:H,action:B,hasEagerState:!1,eagerState:null,next:null};if(gb(T))Oy(E,ae);else{var _e=T.alternate;if(T.lanes===0&&(_e===null||_e.lanes===0)&&(_e=E.lastRenderedReducer,_e!==null))try{var We=E.lastRenderedState,st=_e(We,B);if(ae.hasEagerState=!0,ae.eagerState=st,Ro(st,We)){var xt=E.interleaved;xt===null?(ae.next=ae,gx(E)):(ae.next=xt.next,xt.next=ae),E.interleaved=ae;return}}catch{}finally{}B=__(T,E,ae,H),B!==null&&(ae=zh(),vm(B,T,H,ae),wy(B,E,H))}}function gb(T){var E=T.alternate;return T===Qn||E!==null&&E===Qn}function Oy(T,E){Bl=$u=!0;var B=T.pending;B===null?E.next=E:(E.next=B.next,B.next=E),T.pending=E}function wy(T,E,B){if((B&4194240)!==0){var H=E.lanes;H&=T.pendingLanes,B|=H,E.lanes=B,Ql(T,B)}}var Ny={readContext:qc,useCallback:hl,useContext:hl,useEffect:hl,useImperativeHandle:hl,useInsertionEffect:hl,useLayoutEffect:hl,useMemo:hl,useReducer:hl,useRef:hl,useState:hl,useDebugValue:hl,useDeferredValue:hl,useTransition:hl,useMutableSource:hl,useSyncExternalStore:hl,useId:hl,unstable_isNewReconciler:!1},dP={readContext:qc,useCallback:function(T,E){return ii().memoizedState=[T,E===void 0?null:E],T},useContext:qc,useEffect:ya,useImperativeHandle:function(T,E,B){return B=B!=null?B.concat([T]):null,mn(4194308,4,yu.bind(null,E,T),B)},useLayoutEffect:function(T,E){return mn(4194308,4,T,E)},useInsertionEffect:function(T,E){return mn(4,2,T,E)},useMemo:function(T,E){var B=ii();return E=E===void 0?null:E,T=T(),B.memoizedState=[T,E],T},useReducer:function(T,E,B){var H=ii();return E=B!==void 0?B(E):E,H.memoizedState=H.baseState=E,T={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:T,lastRenderedState:E},H.queue=T,T=T.dispatch=Dy.bind(null,Qn,T),[H.memoizedState,T]},useRef:function(T){var E=ii();return T={current:T},E.memoizedState=T},useState:jr,useDebugValue:xx,useDeferredValue:function(T){return ii().memoizedState=T},useTransition:function(){var T=jr(!1),E=T[0];return T=a1.bind(null,T[1]),ii().memoizedState=T,[E,T]},useMutableSource:function(){},useSyncExternalStore:function(T,E,B){var H=Qn,ae=ii();if(sa){if(B===void 0)throw Error(t(407));B=B()}else{if(B=E(),Kc===null)throw Error(t(349));(Vd&30)!==0||Vr(H,E,B)}ae.memoizedState=B;var _e={value:B,getSnapshot:E};return ae.queue=_e,ya(Tu.bind(null,H,_e,T),[T]),H.flags|=2048,$s(9,an.bind(null,H,_e,B,E),void 0,null),B},useId:function(){var T=ii(),E=Kc.identifierPrefix;if(sa){var B=Su,H=Gi;B=(H&~(1<<32-Yi(H)-1)).toString(32)+B,E=":"+E+"R"+B,B=Rf++,0<\/script>",T=T.removeChild(T.firstChild)):typeof H.is=="string"?T=We.createElement(B,{is:H.is}):(T=We.createElement(B),B==="select"&&(We=T,H.multiple?We.multiple=!0:H.size&&(We.size=H.size))):T=We.createElementNS(T,B),T[Po]=E,T[om]=H,F6(T,E,!1,!1),E.stateNode=T;e:{switch(We=mi(B,H),B){case"dialog":is("cancel",T),is("close",T),ae=H;break;case"iframe":case"object":case"embed":is("load",T),ae=H;break;case"video":case"audio":for(ae=0;aeky&&(E.flags|=128,H=!0,_C(_e,!1),E.lanes=4194304)}else{if(!H)if(T=Xu(We),T!==null){if(E.flags|=128,H=!0,B=T.updateQueue,B!==null&&(E.updateQueue=B,E.flags|=4),_C(_e,!0),_e.tail===null&&_e.tailMode==="hidden"&&!We.alternate&&!sa)return Yu(E),null}else 2*Bi()-_e.renderingStartTime>ky&&B!==1073741824&&(E.flags|=128,H=!0,_C(_e,!1),E.lanes=4194304);_e.isBackwards?(We.sibling=E.child,E.child=We):(B=_e.last,B!==null?B.sibling=We:E.child=We,_e.last=We)}return _e.tail!==null?(E=_e.tail,_e.rendering=E,_e.tail=E.sibling,_e.renderingStartTime=Bi(),E.sibling=null,B=na.current,jn(na,H?B&1|2:B&1),E):(Yu(E),null);case 22:case 23:return b1(),H=E.memoizedState!==null,T!==null&&T.memoizedState!==null!==H&&(E.flags|=8192),H&&(E.mode&1)!==0?(If&1073741824)!==0&&(Yu(E),E.subtreeFlags&6&&(E.flags|=8192)):Yu(E),null;case 24:return null;case 25:return null}throw Error(t(156,E.tag))}function vNe(T,E){switch(Ld(E),E.tag){case 1:return Ll(E.type)&&o_(),T=E.flags,T&65536?(E.flags=T&-65537|128,E):null;case 3:return Cf(),Kn(oc),Kn(cl),Vh(),T=E.flags,(T&65536)!==0&&(T&128)===0?(E.flags=T&-65537|128,E):null;case 5:return dm(E),null;case 13:if(Kn(na),T=E.memoizedState,T!==null&&T.dehydrated!==null){if(E.alternate===null)throw Error(t(340));yf()}return T=E.flags,T&65536?(E.flags=T&-65537|128,E):null;case 19:return Kn(na),null;case 4:return Cf(),null;case 10:return p_(E.type._context),null;case 22:case 23:return b1(),null;case 24:return null;default:return null}}var vP=!1,qu=!1,xNe=typeof WeakSet=="function"?WeakSet:Set,gr=null;function Fy(T,E){var B=T.ref;if(B!==null)if(typeof B=="function")try{B(null)}catch(H){fl(T,E,H)}else B.current=null}function c1(T,E,B){try{B()}catch(H){fl(T,E,H)}}var V6=!1;function SNe(T,E){if(am=zo,T=Pn(),xa(T)){if("selectionStart"in T)var B={start:T.selectionStart,end:T.selectionEnd};else e:{B=(B=T.ownerDocument)&&B.defaultView||window;var H=B.getSelection&&B.getSelection();if(H&&H.rangeCount!==0){B=H.anchorNode;var ae=H.anchorOffset,_e=H.focusNode;H=H.focusOffset;try{B.nodeType,_e.nodeType}catch{B=null;break e}var We=0,st=-1,xt=-1,Zt=0,Ei=0,Ii=T,bi=null;t:for(;;){for(var cr;Ii!==B||ae!==0&&Ii.nodeType!==3||(st=We+ae),Ii!==_e||H!==0&&Ii.nodeType!==3||(xt=We+H),Ii.nodeType===3&&(We+=Ii.nodeValue.length),(cr=Ii.firstChild)!==null;)bi=Ii,Ii=cr;for(;;){if(Ii===T)break t;if(bi===B&&++Zt===ae&&(st=We),bi===_e&&++Ei===H&&(xt=We),(cr=Ii.nextSibling)!==null)break;Ii=bi,bi=Ii.parentNode}Ii=cr}B=st===-1||xt===-1?null:{start:st,end:xt}}else B=null}B=B||{start:0,end:0}}else B=null;for(ix={focusedElem:T,selectionRange:B},zo=!1,gr=E;gr!==null;)if(E=gr,T=E.child,(E.subtreeFlags&1028)!==0&&T!==null)T.return=E,gr=T;else for(;gr!==null;){E=gr;try{var xr=E.alternate;if((E.flags&1024)!==0)switch(E.tag){case 0:case 11:case 15:break;case 1:if(xr!==null){var Cr=xr.memoizedProps,kl=xr.memoizedState,Ut=E.stateNode,Rt=Ut.getSnapshotBeforeUpdate(E.elementType===E.type?Cr:Ud(E.type,Cr),kl);Ut.__reactInternalSnapshotBeforeUpdate=Rt}break;case 3:var zt=E.stateNode.containerInfo;zt.nodeType===1?zt.textContent="":zt.nodeType===9&&zt.documentElement&&zt.removeChild(zt.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(t(163))}}catch(Vi){fl(E,E.return,Vi)}if(T=E.sibling,T!==null){T.return=E.return,gr=T;break}gr=E.return}return xr=V6,V6=!1,xr}function gC(T,E,B){var H=E.updateQueue;if(H=H!==null?H.lastEffect:null,H!==null){var ae=H=H.next;do{if((ae.tag&T)===T){var _e=ae.destroy;ae.destroy=void 0,_e!==void 0&&c1(E,B,_e)}ae=ae.next}while(ae!==H)}}function xP(T,E){if(E=E.updateQueue,E=E!==null?E.lastEffect:null,E!==null){var B=E=E.next;do{if((B.tag&T)===T){var H=B.create;B.destroy=H()}B=B.next}while(B!==E)}}function u1(T){var E=T.ref;if(E!==null){var B=T.stateNode;switch(T.tag){case 5:T=B;break;default:T=B}typeof E=="function"?E(T):E.current=T}}function U6(T){var E=T.alternate;E!==null&&(T.alternate=null,U6(E)),T.child=null,T.deletions=null,T.sibling=null,T.tag===5&&(E=T.stateNode,E!==null&&(delete E[Po],delete E[om],delete E[up],delete E[Ng],delete E[Lg])),T.stateNode=null,T.return=null,T.dependencies=null,T.memoizedProps=null,T.memoizedState=null,T.pendingProps=null,T.stateNode=null,T.updateQueue=null}function G6(T){return T.tag===5||T.tag===3||T.tag===4}function z6(T){e:for(;;){for(;T.sibling===null;){if(T.return===null||G6(T.return))return null;T=T.return}for(T.sibling.return=T.return,T=T.sibling;T.tag!==5&&T.tag!==6&&T.tag!==18;){if(T.flags&2||T.child===null||T.tag===4)continue e;T.child.return=T,T=T.child}if(!(T.flags&2))return T.stateNode}}function h1(T,E,B){var H=T.tag;if(H===5||H===6)T=T.stateNode,E?B.nodeType===8?B.parentNode.insertBefore(T,E):B.insertBefore(T,E):(B.nodeType===8?(E=B.parentNode,E.insertBefore(T,B)):(E=B,E.appendChild(T)),B=B._reactRootContainer,B!=null||E.onclick!==null||(E.onclick=a_));else if(H!==4&&(T=T.child,T!==null))for(h1(T,E,B),T=T.sibling;T!==null;)h1(T,E,B),T=T.sibling}function d1(T,E,B){var H=T.tag;if(H===5||H===6)T=T.stateNode,E?B.insertBefore(T,E):B.appendChild(T);else if(H!==4&&(T=T.child,T!==null))for(d1(T,E,B),T=T.sibling;T!==null;)d1(T,E,B),T=T.sibling}var Eu=null,_m=!1;function Sx(T,E,B){for(B=B.child;B!==null;)W6(T,E,B),B=B.sibling}function W6(T,E,B){if(vi&&typeof vi.onCommitFiberUnmount=="function")try{vi.onCommitFiberUnmount(Fr,B)}catch{}switch(B.tag){case 5:qu||Fy(B,E);case 6:var H=Eu,ae=_m;Eu=null,Sx(T,E,B),Eu=H,_m=ae,Eu!==null&&(_m?(T=Eu,B=B.stateNode,T.nodeType===8?T.parentNode.removeChild(B):T.removeChild(B)):Eu.removeChild(B.stateNode));break;case 18:Eu!==null&&(_m?(T=Eu,B=B.stateNode,T.nodeType===8?wg(T.parentNode,B):T.nodeType===1&&wg(T,B),ku(T)):wg(Eu,B.stateNode));break;case 4:H=Eu,ae=_m,Eu=B.stateNode.containerInfo,_m=!0,Sx(T,E,B),Eu=H,_m=ae;break;case 0:case 11:case 14:case 15:if(!qu&&(H=B.updateQueue,H!==null&&(H=H.lastEffect,H!==null))){ae=H=H.next;do{var _e=ae,We=_e.destroy;_e=_e.tag,We!==void 0&&((_e&2)!==0||(_e&4)!==0)&&c1(B,E,We),ae=ae.next}while(ae!==H)}Sx(T,E,B);break;case 1:if(!qu&&(Fy(B,E),H=B.stateNode,typeof H.componentWillUnmount=="function"))try{H.props=B.memoizedProps,H.state=B.memoizedState,H.componentWillUnmount()}catch(st){fl(B,E,st)}Sx(T,E,B);break;case 21:Sx(T,E,B);break;case 22:B.mode&1?(qu=(H=qu)||B.memoizedState!==null,Sx(T,E,B),qu=H):Sx(T,E,B);break;default:Sx(T,E,B)}}function H6(T){var E=T.updateQueue;if(E!==null){T.updateQueue=null;var B=T.stateNode;B===null&&(B=T.stateNode=new xNe),E.forEach(function(H){var ae=PNe.bind(null,T,H);B.has(H)||(B.add(H),H.then(ae,ae))})}}function gm(T,E){var B=E.deletions;if(B!==null)for(var H=0;Hae&&(ae=We),H&=~_e}if(H=ae,H=Bi()-H,H=(120>H?120:480>H?480:1080>H?1080:1920>H?1920:3e3>H?3e3:4320>H?4320:1960*TNe(H/1960))-H,10T?16:T,Tx===null)var H=!1;else{if(T=Tx,Tx=null,EP=0,(Bn&6)!==0)throw Error(t(331));var ae=Bn;for(Bn|=4,gr=T.current;gr!==null;){var _e=gr,We=_e.child;if((gr.flags&16)!==0){var st=_e.deletions;if(st!==null){for(var xt=0;xtBi()-m1?bb(T,0):p1|=B),zd(T,E)}function r8(T,E){E===0&&((T.mode&1)===0?E=1:(E=Qr,Qr<<=1,(Qr&130023424)===0&&(Qr=4194304)));var B=zh();T=ju(T,E),T!==null&&(xc(T,E,B),zd(T,B))}function ANe(T){var E=T.memoizedState,B=0;E!==null&&(B=E.retryLane),r8(T,B)}function PNe(T,E){var B=0;switch(T.tag){case 13:var H=T.stateNode,ae=T.memoizedState;ae!==null&&(B=ae.retryLane);break;case 19:H=T.stateNode;break;default:throw Error(t(314))}H!==null&&H.delete(E),r8(T,B)}var s8;s8=function(T,E,B){if(T!==null)if(T.memoizedProps!==E.pendingProps||oc.current)Ls=!0;else{if((T.lanes&B)===0&&(E.flags&128)===0)return Ls=!1,_Ne(T,E,B);Ls=(T.flags&131072)!==0}else Ls=!1,sa&&(E.flags&1048576)!==0&&ux(E,Vg,E.index);switch(E.lanes=0,E.tag){case 2:var H=E.type;gP(T,E),T=E.pendingProps;var ae=hp(E,cl.current);Ef(E,B),ae=x_(null,E,H,T,ae,B);var _e=vx();return E.flags|=1,typeof ae=="object"&&ae!==null&&typeof ae.render=="function"&&ae.$$typeof===void 0?(E.tag=1,E.memoizedState=null,E.updateQueue=null,Ll(H)?(_e=!0,dp(E)):_e=!1,E.memoizedState=ae.state!==null&&ae.state!==void 0?ae.state:null,_s(E),ae.updater=Ly,E.stateNode=ae,ae._reactInternals=E,W(E,H,T,B),E=Ps(null,E,H,!0,_e,B)):(E.tag=0,sa&&_e&&hx(E),sr(null,E,ae,B),E=E.child),E;case 16:H=E.elementType;e:{switch(gP(T,E),T=E.pendingProps,ae=H._init,H=ae(H._payload),E.type=H,ae=E.tag=DNe(H),T=Ud(H,T),ae){case 0:E=Ji(null,E,H,T,B);break e;case 1:E=Ir(null,E,H,T,B);break e;case 11:E=Ic(null,E,H,T,B);break e;case 14:E=Gh(null,E,H,Ud(H.type,T),B);break e}throw Error(t(306,H,""))}return E;case 0:return H=E.type,ae=E.pendingProps,ae=E.elementType===H?ae:Ud(H,ae),Ji(T,E,H,ae,B);case 1:return H=E.type,ae=E.pendingProps,ae=E.elementType===H?ae:Ud(H,ae),Ir(T,E,H,ae,B);case 3:e:{if(vs(E),T===null)throw Error(t(387));H=E.pendingProps,_e=E.memoizedState,ae=_e.element,no(T,E),Xa(E,H,null,B);var We=E.memoizedState;if(H=We.element,_e.isDehydrated)if(_e={element:H,isDehydrated:!1,cache:We.cache,pendingSuspenseBoundaries:We.pendingSuspenseBoundaries,transitions:We.transitions},E.updateQueue.baseState=_e,E.memoizedState=_e,E.flags&256){ae=K(Error(t(423)),E),E=xn(T,E,H,B,ae);break e}else if(H!==ae){ae=K(Error(t(424)),E),E=xn(T,E,H,B,ae);break e}else for(cc=Md(E.stateNode.containerInfo.firstChild),ul=E,sa=!0,bu=null,B=f_(E,null,H,B),E.child=B;B;)B.flags=B.flags&-3|4096,B=B.sibling;else{if(yf(),H===ae){E=Hg(T,E,B);break e}sr(T,E,H,B)}E=E.child}return E;case 5:return bp(E),T===null&&Gg(E),H=E.type,ae=E.pendingProps,_e=T!==null?T.memoizedProps:null,We=ae.children,rx(H,ae)?We=null:_e!==null&&rx(H,_e)&&(E.flags|=32),Qt(T,E),sr(T,E,We,B),E.child;case 6:return T===null&&Gg(E),null;case 13:return mm(T,E,B);case 4:return g_(E,E.stateNode.containerInfo),H=E.pendingProps,T===null?E.child=mp(E,null,H,B):sr(T,E,H,B),E.child;case 11:return H=E.type,ae=E.pendingProps,ae=E.elementType===H?ae:Ud(H,ae),Ic(T,E,H,ae,B);case 7:return sr(T,E,E.pendingProps,B),E.child;case 8:return sr(T,E,E.pendingProps.children,B),E.child;case 12:return sr(T,E,E.pendingProps.children,B),E.child;case 10:e:{if(H=E.type._context,ae=E.pendingProps,_e=E.memoizedProps,We=ae.value,jn(_p,H._currentValue),H._currentValue=We,_e!==null)if(Ro(_e.value,We)){if(_e.children===ae.children&&!oc.current){E=Hg(T,E,B);break e}}else for(_e=E.child,_e!==null&&(_e.return=E);_e!==null;){var st=_e.dependencies;if(st!==null){We=_e.child;for(var xt=st.firstContext;xt!==null;){if(xt.context===H){if(_e.tag===1){xt=Fn(-1,B&-B),xt.tag=2;var Zt=_e.updateQueue;if(Zt!==null){Zt=Zt.shared;var Ei=Zt.pending;Ei===null?xt.next=xt:(xt.next=Ei.next,Ei.next=xt),Zt.pending=xt}}_e.lanes|=B,xt=_e.alternate,xt!==null&&(xt.lanes|=B),m_(_e.return,B,E),st.lanes|=B;break}xt=xt.next}}else if(_e.tag===10)We=_e.type===E.type?null:_e.child;else if(_e.tag===18){if(We=_e.return,We===null)throw Error(t(341));We.lanes|=B,st=We.alternate,st!==null&&(st.lanes|=B),m_(We,B,E),We=_e.sibling}else We=_e.child;if(We!==null)We.return=_e;else for(We=_e;We!==null;){if(We===E){We=null;break}if(_e=We.sibling,_e!==null){_e.return=We.return,We=_e;break}We=We.return}_e=We}sr(T,E,ae.children,B),E=E.child}return E;case 9:return ae=E.type,H=E.pendingProps.children,Ef(E,B),ae=qc(ae),H=H(ae),E.flags|=1,sr(T,E,H,B),E.child;case 14:return H=E.type,ae=Ud(H,E.pendingProps),ae=Ud(H.type,ae),Gh(T,E,H,ae,B);case 15:return Ht(T,E,E.type,E.pendingProps,B);case 17:return H=E.type,ae=E.pendingProps,ae=E.elementType===H?ae:Ud(H,ae),gP(T,E),E.tag=1,Ll(H)?(T=!0,dp(E)):T=!1,Ef(E,B),M(E,H,ae),W(E,H,ae,B),Ps(null,E,H,!0,T,B);case 19:return L6(T,E,B);case 22:return Mt(T,E,B)}throw Error(t(156,E.tag))};function n8(T,E){return pi(T,E)}function MNe(T,E,B,H){this.tag=T,this.key=B,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=E,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=H,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Cp(T,E,B,H){return new MNe(T,E,B,H)}function y1(T){return T=T.prototype,!(!T||!T.isReactComponent)}function DNe(T){if(typeof T=="function")return y1(T)?1:0;if(T!=null){if(T=T.$$typeof,T===k)return 11;if(T===ne)return 14}return 2}function Cx(T,E){var B=T.alternate;return B===null?(B=Cp(T.tag,E,T.key,T.mode),B.elementType=T.elementType,B.type=T.type,B.stateNode=T.stateNode,B.alternate=T,T.alternate=B):(B.pendingProps=E,B.type=T.type,B.flags=0,B.subtreeFlags=0,B.deletions=null),B.flags=T.flags&14680064,B.childLanes=T.childLanes,B.lanes=T.lanes,B.child=T.child,B.memoizedProps=T.memoizedProps,B.memoizedState=T.memoizedState,B.updateQueue=T.updateQueue,E=T.dependencies,B.dependencies=E===null?null:{lanes:E.lanes,firstContext:E.firstContext},B.sibling=T.sibling,B.index=T.index,B.ref=T.ref,B}function AP(T,E,B,H,ae,_e){var We=2;if(H=T,typeof T=="function")y1(T)&&(We=1);else if(typeof T=="string")We=5;else e:switch(T){case R:return yb(B.children,ae,_e,E);case A:We=8,ae|=8;break;case P:return T=Cp(12,B,E,ae|2),T.elementType=P,T.lanes=_e,T;case V:return T=Cp(13,B,E,ae),T.elementType=V,T.lanes=_e,T;case U:return T=Cp(19,B,E,ae),T.elementType=U,T.lanes=_e,T;case le:return PP(B,ae,_e,E);default:if(typeof T=="object"&&T!==null)switch(T.$$typeof){case w:We=10;break e;case L:We=9;break e;case k:We=11;break e;case ne:We=14;break e;case oe:We=16,H=null;break e}throw Error(t(130,T==null?T:typeof T,""))}return E=Cp(We,B,E,ae),E.elementType=T,E.type=H,E.lanes=_e,E}function yb(T,E,B,H){return T=Cp(7,T,H,E),T.lanes=B,T}function PP(T,E,B,H){return T=Cp(22,T,H,E),T.elementType=le,T.lanes=B,T.stateNode={isHidden:!1},T}function E1(T,E,B){return T=Cp(6,T,null,E),T.lanes=B,T}function C1(T,E,B){return E=Cp(4,T.children!==null?T.children:[],T.key,E),E.lanes=B,E.stateNode={containerInfo:T.containerInfo,pendingChildren:null,implementation:T.implementation},E}function ONe(T,E,B,H,ae){this.tag=E,this.containerInfo=T,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=lu(0),this.expirationTimes=lu(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=lu(0),this.identifierPrefix=H,this.onRecoverableError=ae,this.mutableSourceEagerHydrationData=null}function R1(T,E,B,H,ae,_e,We,st,xt){return T=new ONe(T,E,B,st,xt),E===1?(E=1,_e===!0&&(E|=8)):E=0,_e=Cp(3,null,null,E),T.current=_e,_e.stateNode=T,_e.memoizedState={element:H,isDehydrated:B,cache:null,transitions:null,pendingSuspenseBoundaries:null},_s(_e),T}function wNe(T,E,B){var H=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(s)}catch(e){console.error(e)}}return s(),w1.exports=YNe(),w1.exports}var S8;function qNe(){if(S8)return kP;S8=1;var s=Ipe();return kP.createRoot=s.createRoot,kP.hydrateRoot=s.hydrateRoot,kP}var ZNe=qNe();const KNe=O5(ZNe);Ipe();/**
000042: * @remix-run/router v1.23.3
000043: *
000044: * Copyright (c) Remix Software Inc.
000045: *
000046: * This source code is licensed under the MIT license found in the
000047: * LICENSE.md file in the root directory of this source tree.
000048: *
000049: * @license MIT
000050: */function VR(){return VR=Object.assign?Object.assign.bind():function(s){for(var e=1;e"u")throw new Error(e)}function w5(s,e){if(!s){typeof console<"u"&&console.warn(e);try{throw new Error(e)}catch{}}}function JNe(){return Math.random().toString(36).substr(2,8)}function T8(s,e){return{usr:s.state,key:s.key,idx:e}}function kF(s,e,t,i){return t===void 0&&(t=null),VR({pathname:typeof s=="string"?s:s.pathname,search:"",hash:""},typeof e=="string"?U0(e):e,{state:t,key:e&&e.key||i||JNe()})}function $D(s){let{pathname:e="/",search:t="",hash:i=""}=s;return t&&t!=="?"&&(e+=t.charAt(0)==="?"?t:"?"+t),i&&i!=="#"&&(e+=i.charAt(0)==="#"?i:"#"+i),e}function U0(s){let e={};if(s){let t=s.indexOf("#");t>=0&&(e.hash=s.substr(t),s=s.substr(0,t));let i=s.indexOf("?");i>=0&&(e.search=s.substr(i),s=s.substr(0,i)),s&&(e.pathname=s)}return e}function e1e(s,e,t,i){i===void 0&&(i={});let{window:r=document.defaultView,v5Compat:n=!1}=i,a=r.history,o=cS.Pop,l=null,c=u();c==null&&(c=0,a.replaceState(VR({},a.state,{idx:c}),""));function u(){return(a.state||{idx:null}).idx}function h(){o=cS.Pop;let _=u(),v=_==null?null:_-c;c=_,l&&l({action:o,location:p.location,delta:v})}function d(_,v){o=cS.Push;let x=kF(p.location,_,v);c=u()+1;let S=T8(x,c),b=p.createHref(x);try{a.pushState(S,"",b)}catch(y){if(y instanceof DOMException&&y.name==="DataCloneError")throw y;r.location.assign(b)}n&&l&&l({action:o,location:p.location,delta:1})}function f(_,v){o=cS.Replace;let x=kF(p.location,_,v);c=u();let S=T8(x,c),b=p.createHref(x);a.replaceState(S,"",b),n&&l&&l({action:o,location:p.location,delta:0})}function m(_){let v=r.location.origin!=="null"?r.location.origin:r.location.href,x=typeof _=="string"?_:$D(_);return x=x.replace(/ $/,"%20"),il(v,"No window.location.(origin|href) available to create URL for href: "+x),new URL(x,v)}let p={get action(){return o},get location(){return s(r,a)},listen(_){if(l)throw new Error("A history only accepts one active listener");return r.addEventListener(b8,h),l=_,()=>{r.removeEventListener(b8,h),l=null}},createHref(_){return e(r,_)},createURL:m,encodeLocation(_){let v=m(_);return{pathname:v.pathname,search:v.search,hash:v.hash}},push:d,replace:f,go(_){return a.go(_)}};return p}var y8;(function(s){s.data="data",s.deferred="deferred",s.redirect="redirect",s.error="error"})(y8||(y8={}));function t1e(s,e,t){return t===void 0&&(t="/"),i1e(s,e,t)}function i1e(s,e,t,i){let r=typeof e=="string"?U0(e):e,n=f0(r.pathname||"/",t);if(n==null)return null;let a=Ape(s);r1e(a);let o=null,l=p1e(n);for(let c=0;o==null&&c{let l={relativePath:o===void 0?n.path||"":o,caseSensitive:n.caseSensitive===!0,childrenIndex:a,route:n};l.relativePath.startsWith("/")&&(il(l.relativePath.startsWith(i),'Absolute route path "'+l.relativePath+'" nested under path '+('"'+i+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),l.relativePath=l.relativePath.slice(i.length));let c=TS([i,l.relativePath]),u=t.concat(l);n.children&&n.children.length>0&&(il(n.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+c+'".')),Ape(n.children,e,u,c)),!(n.path==null&&!n.index)&&e.push({path:c,score:u1e(c,n.index),routesMeta:u})};return s.forEach((n,a)=>{var o;if(n.path===""||!((o=n.path)!=null&&o.includes("?")))r(n,a);else for(let l of Ppe(n.path))r(n,a,l)}),e}function Ppe(s){let e=s.split("/");if(e.length===0)return[];let[t,...i]=e,r=t.endsWith("?"),n=t.replace(/\?$/,"");if(i.length===0)return r?[n,""]:[n];let a=Ppe(i.join("/")),o=[];return o.push(...a.map(l=>l===""?n:[n,l].join("/"))),r&&o.push(...a),o.map(l=>s.startsWith("/")&&l===""?"/":l)}function r1e(s){s.sort((e,t)=>e.score!==t.score?t.score-e.score:h1e(e.routesMeta.map(i=>i.childrenIndex),t.routesMeta.map(i=>i.childrenIndex)))}const s1e=/^:[\w-]+$/,n1e=3,a1e=2,o1e=1,l1e=10,c1e=-2,E8=s=>s==="*";function u1e(s,e){let t=s.split("/"),i=t.length;return t.some(E8)&&(i+=c1e),e&&(i+=a1e),t.filter(r=>!E8(r)).reduce((r,n)=>r+(s1e.test(n)?n1e:n===""?o1e:l1e),i)}function h1e(s,e){return s.length===e.length&&s.slice(0,-1).every((i,r)=>i===e[r])?s[s.length-1]-e[e.length-1]:0}function d1e(s,e,t){let{routesMeta:i}=s,r={},n="/",a=[];for(let o=0;o{let{paramName:d,isOptional:f}=u;if(d==="*"){let p=o[h]||"";a=n.slice(0,n.length-p.length).replace(/(.)\/+$/,"$1")}const m=o[h];return f&&!m?c[d]=void 0:c[d]=(m||"").replace(/%2F/g,"/"),c},{}),pathname:n,pathnameBase:a,pattern:s}}function f1e(s,e,t){e===void 0&&(e=!1),t===void 0&&(t=!0),w5(s==="*"||!s.endsWith("*")||s.endsWith("/*"),'Route path "'+s+'" will be treated as if it were '+('"'+s.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+s.replace(/\*$/,"/*")+'".'));let i=[],r="^"+s.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(a,o,l)=>(i.push({paramName:o,isOptional:l!=null}),l?"/?([^\\/]+)?":"/([^\\/]+)"));return s.endsWith("*")?(i.push({paramName:"*"}),r+=s==="*"||s==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):t?r+="\\/*$":s!==""&&s!=="/"&&(r+="(?:(?=\\/|$))"),[new RegExp(r,e?void 0:"i"),i]}function p1e(s){try{return s.split("/").map(e=>decodeURIComponent(e).replace(/\//g,"%2F")).join("/")}catch(e){return w5(!1,'The URL path "'+s+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+e+").")),s}}function f0(s,e){if(e==="/")return s;if(!s.toLowerCase().startsWith(e.toLowerCase()))return null;let t=e.endsWith("/")?e.length-1:e.length,i=s.charAt(t);return i&&i!=="/"?null:s.slice(t)||"/"}const m1e=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,_1e=s=>m1e.test(s);function g1e(s,e){e===void 0&&(e="/");let{pathname:t,search:i="",hash:r=""}=typeof s=="string"?U0(s):s,n;if(t)if(_1e(t))n=t;else{if(t.includes("//")){let a=t;t=Mpe(t),w5(!1,"Pathnames cannot have embedded double slashes - normalizing "+(a+" -> "+t))}t.startsWith("/")?n=C8(t.substring(1),"/"):n=C8(t,e)}else n=e;return{pathname:n,search:S1e(i),hash:b1e(r)}}function C8(s,e){let t=e.replace(/\/+$/,"").split("/");return s.split("/").forEach(r=>{r===".."?t.length>1&&t.pop():r!=="."&&t.push(r)}),t.length>1?t.join("/"):"/"}function F1(s,e,t,i){return"Cannot include a '"+s+"' character in a manually specified "+("`to."+e+"` field ["+JSON.stringify(i)+"]. Please separate it out to the ")+("`to."+t+"` field. Alternatively you may provide the full path as ")+'a string in and the router will parse it for you.'}function v1e(s){return s.filter((e,t)=>t===0||e.route.path&&e.route.path.length>0)}function N5(s,e){let t=v1e(s);return e?t.map((i,r)=>r===t.length-1?i.pathname:i.pathnameBase):t.map(i=>i.pathnameBase)}function L5(s,e,t,i){i===void 0&&(i=!1);let r;typeof s=="string"?r=U0(s):(r=VR({},s),il(!r.pathname||!r.pathname.includes("?"),F1("?","pathname","search",r)),il(!r.pathname||!r.pathname.includes("#"),F1("#","pathname","hash",r)),il(!r.search||!r.search.includes("#"),F1("#","search","hash",r)));let n=s===""||r.pathname==="",a=n?"/":r.pathname,o;if(a==null)o=t;else{let h=e.length-1;if(!i&&a.startsWith("..")){let d=a.split("/");for(;d[0]==="..";)d.shift(),h-=1;r.pathname=d.join("/")}o=h>=0?e[h]:"/"}let l=g1e(r,o),c=a&&a!=="/"&&a.endsWith("/"),u=(n||a===".")&&t.endsWith("/");return!l.pathname.endsWith("/")&&(c||u)&&(l.pathname+="/"),l}const Mpe=s=>s.replace(/\/\/+/g,"/"),TS=s=>Mpe(s.join("/")),x1e=s=>s.replace(/\/+$/,"").replace(/^\/*/,"/"),S1e=s=>!s||s==="?"?"":s.startsWith("?")?s:"?"+s,b1e=s=>!s||s==="#"?"":s.startsWith("#")?s:"#"+s;function T1e(s){return s!=null&&typeof s.status=="number"&&typeof s.statusText=="string"&&typeof s.internal=="boolean"&&"data"in s}const Dpe=["post","put","patch","delete"];new Set(Dpe);const y1e=["get",...Dpe];new Set(y1e);/**
LISTENER CONTEXT 38-62
000038: `+ae[We].replace(" at new "," at ");return T.displayName&&xt.includes("")&&(xt=xt.replace("",T.displayName)),xt}while(1<=We&&0<=st);break}}}finally{J=!1,Error.prepareStackTrace=B}return(T=T?T.displayName||T.name:"")?G(T):""}function re(T){switch(T.tag){case 5:return G(T.type);case 16:return G("Lazy");case 13:return G("Suspense");case 19:return G("SuspenseList");case 0:case 2:case 15:return T=$(T.type,!1),T;case 11:return T=$(T.type.render,!1),T;case 1:return T=$(T.type,!0),T;default:return""}}function ie(T){if(T==null)return null;if(typeof T=="function")return T.displayName||T.name||null;if(typeof T=="string")return T;switch(T){case R:return"Fragment";case I:return"Portal";case P:return"Profiler";case A:return"StrictMode";case V:return"Suspense";case U:return"SuspenseList"}if(typeof T=="object")switch(T.$$typeof){case L:return(T.displayName||"Context")+".Consumer";case w:return(T._context.displayName||"Context")+".Provider";case k:var E=T.render;return T=T.displayName,T||(T=E.displayName||E.name||"",T=T!==""?"ForwardRef("+T+")":"ForwardRef"),T;case ne:return E=T.displayName||null,E!==null?E:ie(T.type)||"Memo";case oe:E=T._payload,T=T._init;try{return ie(T(E))}catch{}}return null}function ve(T){var E=T.type;switch(T.tag){case 24:return"Cache";case 9:return(E.displayName||"Context")+".Consumer";case 10:return(E._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return T=E.render,T=T.displayName||T.name||"",E.displayName||(T!==""?"ForwardRef("+T+")":"ForwardRef");case 7:return"Fragment";case 5:return E;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return ie(E);case 8:return E===A?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof E=="function")return E.displayName||E.name||null;if(typeof E=="string")return E}return null}function Re(T){switch(typeof T){case"boolean":case"number":case"string":case"undefined":return T;case"object":return T;default:return""}}function Ie(T){var E=T.type;return(T=T.nodeName)&&T.toLowerCase()==="input"&&(E==="checkbox"||E==="radio")}function de(T){var E=Ie(T)?"checked":"value",B=Object.getOwnPropertyDescriptor(T.constructor.prototype,E),H=""+T[E];if(!T.hasOwnProperty(E)&&typeof B<"u"&&typeof B.get=="function"&&typeof B.set=="function"){var ae=B.get,_e=B.set;return Object.defineProperty(T,E,{configurable:!0,get:function(){return ae.call(this)},set:function(We){H=""+We,_e.call(this,We)}}),Object.defineProperty(T,E,{enumerable:B.enumerable}),{getValue:function(){return H},setValue:function(We){H=""+We},stopTracking:function(){T._valueTracker=null,delete T[E]}}}}function q(T){T._valueTracker||(T._valueTracker=de(T))}function pe(T){if(!T)return!1;var E=T._valueTracker;if(!E)return!0;var B=E.getValue(),H="";return T&&(H=Ie(T)?T.checked?"true":"false":T.value),T=H,T!==B?(E.setValue(T),!0):!1}function Oe(T){if(T=T||(typeof document<"u"?document:void 0),typeof T>"u")return null;try{return T.activeElement||T.body}catch{return T.body}}function Me(T,E){var B=E.checked;return Z({},E,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:B??T._wrapperState.initialChecked})}function Ve(T,E){var B=E.defaultValue==null?"":E.defaultValue,H=E.checked!=null?E.checked:E.defaultChecked;B=Re(E.value!=null?E.value:B),T._wrapperState={initialChecked:H,initialValue:B,controlled:E.type==="checkbox"||E.type==="radio"?E.checked!=null:E.value!=null}}function tt(T,E){E=E.checked,E!=null&&S(T,"checked",E,!1)}function lt(T,E){tt(T,E);var B=Re(E.value),H=E.type;if(B!=null)H==="number"?(B===0&&T.value===""||T.value!=B)&&(T.value=""+B):T.value!==""+B&&(T.value=""+B);else if(H==="submit"||H==="reset"){T.removeAttribute("value");return}E.hasOwnProperty("value")?at(T,E.type,B):E.hasOwnProperty("defaultValue")&&at(T,E.type,Re(E.defaultValue)),E.checked==null&&E.defaultChecked!=null&&(T.defaultChecked=!!E.defaultChecked)}function Ne(T,E,B){if(E.hasOwnProperty("value")||E.hasOwnProperty("defaultValue")){var H=E.type;if(!(H!=="submit"&&H!=="reset"||E.value!==void 0&&E.value!==null))return;E=""+T._wrapperState.initialValue,B||E===T.value||(T.value=E),T.defaultValue=E}B=T.name,B!==""&&(T.name=""),T.defaultChecked=!!T._wrapperState.initialChecked,B!==""&&(T.name=B)}function at(T,E,B){(E!=="number"||Oe(T.ownerDocument)!==T)&&(B==null?T.defaultValue=""+T._wrapperState.initialValue:T.defaultValue!==""+B&&(T.defaultValue=""+B))}var Ee=Array.isArray;function me(T,E,B,H){if(T=T.options,E){E={};for(var ae=0;ae"+E.valueOf().toString()+"",E=Vt.firstChild;T.firstChild;)T.removeChild(T.firstChild);for(;E.firstChild;)T.appendChild(E.firstChild)}});function Ft(T,E){if(E){var B=T.firstChild;if(B&&B===T.lastChild&&B.nodeType===3){B.nodeValue=E;return}}T.textContent=E}var Wt={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},ri=["Webkit","ms","Moz","O"];Object.keys(Wt).forEach(function(T){ri.forEach(function(E){E=E+T.charAt(0).toUpperCase()+T.substring(1),Wt[E]=Wt[T]})});function he(T,E,B){return E==null||typeof E=="boolean"||E===""?"":B||typeof E!="number"||E===0||Wt.hasOwnProperty(T)&&Wt[T]?(""+E).trim():E+"px"}function ct(T,E){T=T.style;for(var B in E)if(E.hasOwnProperty(B)){var H=B.indexOf("--")===0,ae=he(B,E[B],H);B==="float"&&(B="cssFloat"),H?T.setProperty(B,ae):T[B]=ae}}var Je=Z({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Nt(T,E){if(E){if(Je[T]&&(E.children!=null||E.dangerouslySetInnerHTML!=null))throw Error(t(137,T));if(E.dangerouslySetInnerHTML!=null){if(E.children!=null)throw Error(t(60));if(typeof E.dangerouslySetInnerHTML!="object"||!("__html"in E.dangerouslySetInnerHTML))throw Error(t(61))}if(E.style!=null&&typeof E.style!="object")throw Error(t(62))}}function mi(T,E){if(T.indexOf("-")===-1)return typeof E.is=="string";switch(T){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var De=null;function Ct(T){return T=T.target||T.srcElement||window,T.correspondingUseElement&&(T=T.correspondingUseElement),T.nodeType===3?T.parentNode:T}var ot=null,we=null,be=null;function nt(T){if(T=Dd(T)){if(typeof ot!="function")throw Error(t(280));var E=T.stateNode;E&&(E=Fg(E),ot(T.stateNode,T.type,E))}}function ci(T){we?be?be.push(T):be=[T]:we=T}function mt(){if(we){var T=we,E=be;if(be=we=null,nt(T),E)for(T=0;T>>=0,T===0?32:31-(Ds(T)/sn|0)|0}var ra=64,Qr=4194304;function Zn(T){switch(T&-T){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return T&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return T&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return T}}function Go(T,E){var B=T.pendingLanes;if(B===0)return 0;var H=0,ae=T.suspendedLanes,_e=T.pingedLanes,We=B&268435455;if(We!==0){var st=We&~ae;st!==0?H=Zn(st):(_e&=We,_e!==0&&(H=Zn(_e)))}else We=B&~ae,We!==0?H=Zn(We):_e!==0&&(H=Zn(_e));if(H===0)return 0;if(E!==0&&E!==H&&(E&ae)===0&&(ae=H&-H,_e=E&-E,ae>=_e||ae===16&&(_e&4194240)!==0))return E;if((H&4)!==0&&(H|=B&16),E=T.entangledLanes,E!==0)for(T=T.entanglements,E&=H;0B;B++)E.push(T);return E}function xc(T,E,B){T.pendingLanes|=E,E!==536870912&&(T.suspendedLanes=0,T.pingedLanes=0),T=T.eventTimes,E=31-Yi(E),T[E]=B}function vh(T,E){var B=T.pendingLanes&~E;T.pendingLanes=E,T.suspendedLanes=0,T.pingedLanes=0,T.expiredLanes&=E,T.mutableReadLanes&=E,T.entangledLanes&=E,E=T.entanglements;var H=T.eventTimes;for(T=T.expirationTimes;0=Oa),$o=" ",Cd=!1;function Rd(T,E){switch(T){case"keyup":return Ed.indexOf(E.keyCode)!==-1;case"keydown":return E.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Dh(T){return T=T.detail,typeof T=="object"&&"data"in T?T.data:null}var yc=!1;function vf(T,E){switch(T){case"compositionend":return Dh(E);case"keypress":return E.which!==32?null:(Cd=!0,$o);case"textInput":return T=E.data,T===$o&&Cd?null:T;default:return null}}function Gu(T,E){if(yc)return T==="compositionend"||!ro&&Rd(T,E)?(T=Vu(),po=vd=al=null,yc=!1,T):null;switch(T){case"paste":return null;case"keypress":if(!(E.ctrlKey||E.altKey||E.metaKey)||E.ctrlKey&&E.altKey){if(E.char&&1=E)return{node:B,offset:E-T};T=H}e:{for(;B;){if(B.nextSibling){B=B.nextSibling;break e}B=B.parentNode}B=void 0}B=zu(B)}}function jc(T,E){return T&&E?T===E?!0:T&&T.nodeType===3?!1:E&&E.nodeType===3?jc(T,E.parentNode):"contains"in T?T.contains(E):T.compareDocumentPosition?!!(T.compareDocumentPosition(E)&16):!1:!1}function Pn(){for(var T=window,E=Oe();E instanceof T.HTMLIFrameElement;){try{var B=typeof E.contentWindow.location.href=="string"}catch{B=!1}if(B)T=E.contentWindow;else break;E=Oe(T.document)}return E}function xa(T){var E=T&&T.nodeName&&T.nodeName.toLowerCase();return E&&(E==="input"&&(T.type==="text"||T.type==="search"||T.type==="tel"||T.type==="url"||T.type==="password")||E==="textarea"||T.contentEditable==="true")}function Sa(T){var E=Pn(),B=T.focusedElem,H=T.selectionRange;if(E!==B&&B&&B.ownerDocument&&jc(B.ownerDocument.documentElement,B)){if(H!==null&&xa(B)){if(E=H.start,T=H.end,T===void 0&&(T=E),"selectionStart"in B)B.selectionStart=E,B.selectionEnd=Math.min(T,B.value.length);else if(T=(E=B.ownerDocument||document)&&E.defaultView||window,T.getSelection){T=T.getSelection();var ae=B.textContent.length,_e=Math.min(H.start,ae);H=H.end===void 0?_e:Math.min(H.end,ae),!T.extend&&_e>H&&(ae=H,H=_e,_e=ae),ae=Io(B,_e);var We=Io(B,H);ae&&We&&(T.rangeCount!==1||T.anchorNode!==ae.node||T.anchorOffset!==ae.offset||T.focusNode!==We.node||T.focusOffset!==We.offset)&&(E=E.createRange(),E.setStart(ae.node,ae.offset),T.removeAllRanges(),_e>H?(T.addRange(E),T.extend(We.node,We.offset)):(E.setEnd(We.node,We.offset),T.addRange(E)))}}for(E=[],T=B;T=T.parentNode;)T.nodeType===1&&E.push({element:T,left:T.scrollLeft,top:T.scrollTop});for(typeof B.focus=="function"&&B.focus(),B=0;B=document.documentMode,wl=null,Xc=null,Wu=null,ba=!1;function Fh(T,E,B){var H=B.window===B?B.document:B.nodeType===9?B:B.ownerDocument;ba||wl==null||wl!==Oe(H)||(H=wl,"selectionStart"in H&&xa(H)?H={start:H.selectionStart,end:H.selectionEnd}:(H=(H.ownerDocument&&H.ownerDocument.defaultView||window).getSelection(),H={anchorNode:H.anchorNode,anchorOffset:H.anchorOffset,focusNode:H.focusNode,focusOffset:H.focusOffset}),Wu&&Hc(Wu,H)||(Wu=H,H=Dg(Xc,"onSelect"),0qo||(T.current=ox[qo],ox[qo]=null,qo--)}function jn(T,E){qo++,ox[qo]=T.current,T.current=E}var Od={},cl=ja(Od),oc=ja(!1),wd=Od;function hp(T,E){var B=T.type.contextTypes;if(!B)return Od;var H=T.stateNode;if(H&&H.__reactInternalMemoizedUnmaskedChildContext===E)return H.__reactInternalMemoizedMaskedChildContext;var ae={},_e;for(_e in B)ae[_e]=E[_e];return H&&(T=T.stateNode,T.__reactInternalMemoizedUnmaskedChildContext=E,T.__reactInternalMemoizedMaskedChildContext=ae),ae}function Ll(T){return T=T.childContextTypes,T!=null}function o_(){Kn(oc),Kn(cl)}function lx(T,E,B){if(cl.current!==Od)throw Error(t(168));jn(cl,E),jn(oc,B)}function l_(T,E,B){var H=T.stateNode;if(E=E.childContextTypes,typeof H.getChildContext!="function")return B;H=H.getChildContext();for(var ae in H)if(!(ae in E))throw Error(t(108,ve(T)||"Unknown",ae));return Z({},B,H)}function dp(T){return T=(T=T.stateNode)&&T.__reactInternalMemoizedMergedChildContext||Od,wd=cl.current,jn(cl,T),jn(oc,oc.current),!0}function cx(T,E,B){var H=T.stateNode;if(!H)throw Error(t(169));B?(T=l_(T,E,wd),H.__reactInternalMemoizedMergedChildContext=T,Kn(oc),Kn(cl),jn(cl,T)):Kn(oc),jn(oc,B)}var Hu=null,c_=!1,Bg=!1;function u_(T){Hu===null?Hu=[T]:Hu.push(T)}function mb(T){c_=!0,u_(T)}function Bh(){if(!Bg&&Hu!==null){Bg=!0;var T=0,E=ms;try{var B=Hu;for(ms=1;T>=We,ae-=We,Gi=1<<32-Yi(E)+ae|B<us?(Qc=qr,qr=null):Qc=qr.sibling;var Xn=bi(Ut,qr,zt[us],Vi);if(Xn===null){qr===null&&(qr=Qc);break}T&&qr&&Xn.alternate===null&&E(Ut,qr),Rt=_e(Xn,Rt,us),Yr===null?Pr=Xn:Yr.sibling=Xn,Yr=Xn,qr=Qc}if(us===zt.length)return B(Ut,qr),sa&&Nd(Ut,us),Pr;if(qr===null){for(;usus?(Qc=qr,qr=null):Qc=qr.sibling;var Rx=bi(Ut,qr,Xn.value,Vi);if(Rx===null){qr===null&&(qr=Qc);break}T&&qr&&Rx.alternate===null&&E(Ut,qr),Rt=_e(Rx,Rt,us),Yr===null?Pr=Rx:Yr.sibling=Rx,Yr=Rx,qr=Qc}if(Xn.done)return B(Ut,qr),sa&&Nd(Ut,us),Pr;if(qr===null){for(;!Xn.done;us++,Xn=zt.next())Xn=Ii(Ut,Xn.value,Vi),Xn!==null&&(Rt=_e(Xn,Rt,us),Yr===null?Pr=Xn:Yr.sibling=Xn,Yr=Xn);return sa&&Nd(Ut,us),Pr}for(qr=H(Ut,qr);!Xn.done;us++,Xn=zt.next())Xn=cr(qr,Ut,us,Xn.value,Vi),Xn!==null&&(T&&Xn.alternate!==null&&qr.delete(Xn.key===null?us:Xn.key),Rt=_e(Xn,Rt,us),Yr===null?Pr=Xn:Yr.sibling=Xn,Yr=Xn);return T&&qr.forEach(function(kNe){return E(Ut,kNe)}),sa&&Nd(Ut,us),Pr}function kl(Ut,Rt,zt,Vi){if(typeof zt=="object"&&zt!==null&&zt.type===R&&zt.key===null&&(zt=zt.props.children),typeof zt=="object"&&zt!==null){switch(zt.$$typeof){case y:e:{for(var Pr=zt.key,Yr=Rt;Yr!==null;){if(Yr.key===Pr){if(Pr=zt.type,Pr===R){if(Yr.tag===7){B(Ut,Yr.sibling),Rt=ae(Yr,zt.props.children),Rt.return=Ut,Ut=Rt;break e}}else if(Yr.elementType===Pr||typeof Pr=="object"&&Pr!==null&&Pr.$$typeof===oe&&mx(Pr)===Yr.type){B(Ut,Yr.sibling),Rt=ae(Yr,zt.props),Rt.ref=h_(Ut,Yr,zt),Rt.return=Ut,Ut=Rt;break e}B(Ut,Yr);break}else E(Ut,Yr);Yr=Yr.sibling}zt.type===R?(Rt=yb(zt.props.children,Ut.mode,Vi,zt.key),Rt.return=Ut,Ut=Rt):(Vi=AP(zt.type,zt.key,zt.props,null,Ut.mode,Vi),Vi.ref=h_(Ut,Rt,zt),Vi.return=Ut,Ut=Vi)}return We(Ut);case I:e:{for(Yr=zt.key;Rt!==null;){if(Rt.key===Yr)if(Rt.tag===4&&Rt.stateNode.containerInfo===zt.containerInfo&&Rt.stateNode.implementation===zt.implementation){B(Ut,Rt.sibling),Rt=ae(Rt,zt.children||[]),Rt.return=Ut,Ut=Rt;break e}else{B(Ut,Rt);break}else E(Ut,Rt);Rt=Rt.sibling}Rt=C1(zt,Ut.mode,Vi),Rt.return=Ut,Ut=Rt}return We(Ut);case oe:return Yr=zt._init,kl(Ut,Rt,Yr(zt._payload),Vi)}if(Ee(zt))return xr(Ut,Rt,zt,Vi);if(te(zt))return Cr(Ut,Rt,zt,Vi);d_(Ut,zt)}return typeof zt=="string"&&zt!==""||typeof zt=="number"?(zt=""+zt,Rt!==null&&Rt.tag===6?(B(Ut,Rt.sibling),Rt=ae(Rt,zt),Rt.return=Ut,Ut=Rt):(B(Ut,Rt),Rt=E1(zt,Ut.mode,Vi),Rt.return=Ut,Ut=Rt),We(Ut)):B(Ut,Rt)}return kl}var mp=_x(!0),f_=_x(!1),_p=ja(null),gp=null,Fd=null,um=null;function vp(){um=Fd=gp=null}function p_(T){var E=_p.current;Kn(_p),T._currentValue=E}function m_(T,E,B){for(;T!==null;){var H=T.alternate;if((T.childLanes&E)!==E?(T.childLanes|=E,H!==null&&(H.childLanes|=E)):H!==null&&(H.childLanes&E)!==E&&(H.childLanes|=E),T===B)break;T=T.return}}function Ef(T,E){gp=T,um=Fd=null,T=T.dependencies,T!==null&&T.firstContext!==null&&((T.lanes&E)!==0&&(Ls=!0),T.firstContext=null)}function qc(T){var E=T._currentValue;if(um!==T)if(T={context:T,memoizedValue:E,next:null},Fd===null){if(gp===null)throw Error(t(308));Fd=T,gp.dependencies={lanes:0,firstContext:T}}else Fd=Fd.next=T;return E}var Bd=null;function gx(T){Bd===null?Bd=[T]:Bd.push(T)}function __(T,E,B,H){var ae=E.interleaved;return ae===null?(B.next=B,gx(E)):(B.next=ae.next,ae.next=B),E.interleaved=B,ju(T,H)}function ju(T,E){T.lanes|=E;var B=T.alternate;for(B!==null&&(B.lanes|=E),B=T,T=T.return;T!==null;)T.childLanes|=E,B=T.alternate,B!==null&&(B.childLanes|=E),B=T,T=T.return;return B.tag===3?B.stateNode:null}var Ln=!1;function _s(T){T.updateQueue={baseState:T.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function no(T,E){T=T.updateQueue,E.updateQueue===T&&(E.updateQueue={baseState:T.baseState,firstBaseUpdate:T.firstBaseUpdate,lastBaseUpdate:T.lastBaseUpdate,shared:T.shared,effects:T.effects})}function Fn(T,E){return{eventTime:T,lane:E,tag:0,payload:null,callback:null,next:null}}function Ta(T,E,B){var H=T.updateQueue;if(H===null)return null;if(H=H.shared,(Bn&2)!==0){var ae=H.pending;return ae===null?E.next=E:(E.next=ae.next,ae.next=E),H.pending=E,ju(T,B)}return ae=H.interleaved,ae===null?(E.next=E,gx(H)):(E.next=ae.next,ae.next=E),H.interleaved=E,ju(T,B)}function Fl(T,E,B){if(E=E.updateQueue,E!==null&&(E=E.shared,(B&4194240)!==0)){var H=E.lanes;H&=T.pendingLanes,B|=H,E.lanes=B,Ql(T,B)}}function xp(T,E){var B=T.updateQueue,H=T.alternate;if(H!==null&&(H=H.updateQueue,B===H)){var ae=null,_e=null;if(B=B.firstBaseUpdate,B!==null){do{var We={eventTime:B.eventTime,lane:B.lane,tag:B.tag,payload:B.payload,callback:B.callback,next:null};_e===null?ae=_e=We:_e=_e.next=We,B=B.next}while(B!==null);_e===null?ae=_e=E:_e=_e.next=E}else ae=_e=E;B={baseState:H.baseState,firstBaseUpdate:ae,lastBaseUpdate:_e,shared:H.shared,effects:H.effects},T.updateQueue=B;return}T=B.lastBaseUpdate,T===null?B.firstBaseUpdate=E:T.next=E,B.lastBaseUpdate=E}function Xa(T,E,B,H){var ae=T.updateQueue;Ln=!1;var _e=ae.firstBaseUpdate,We=ae.lastBaseUpdate,st=ae.shared.pending;if(st!==null){ae.shared.pending=null;var xt=st,Zt=xt.next;xt.next=null,We===null?_e=Zt:We.next=Zt,We=xt;var Ei=T.alternate;Ei!==null&&(Ei=Ei.updateQueue,st=Ei.lastBaseUpdate,st!==We&&(st===null?Ei.firstBaseUpdate=Zt:st.next=Zt,Ei.lastBaseUpdate=xt))}if(_e!==null){var Ii=ae.baseState;We=0,Ei=Zt=xt=null,st=_e;do{var bi=st.lane,cr=st.eventTime;if((H&bi)===bi){Ei!==null&&(Ei=Ei.next={eventTime:cr,lane:0,tag:st.tag,payload:st.payload,callback:st.callback,next:null});e:{var xr=T,Cr=st;switch(bi=E,cr=B,Cr.tag){case 1:if(xr=Cr.payload,typeof xr=="function"){Ii=xr.call(cr,Ii,bi);break e}Ii=xr;break e;case 3:xr.flags=xr.flags&-65537|128;case 0:if(xr=Cr.payload,bi=typeof xr=="function"?xr.call(cr,Ii,bi):xr,bi==null)break e;Ii=Z({},Ii,bi);break e;case 2:Ln=!0}}st.callback!==null&&st.lane!==0&&(T.flags|=64,bi=ae.effects,bi===null?ae.effects=[st]:bi.push(st))}else cr={eventTime:cr,lane:bi,tag:st.tag,payload:st.payload,callback:st.callback,next:null},Ei===null?(Zt=Ei=cr,xt=Ii):Ei=Ei.next=cr,We|=bi;if(st=st.next,st===null){if(st=ae.shared.pending,st===null)break;bi=st,st=bi.next,bi.next=null,ae.lastBaseUpdate=bi,ae.shared.pending=null}}while(!0);if(Ei===null&&(xt=Ii),ae.baseState=xt,ae.firstBaseUpdate=Zt,ae.lastBaseUpdate=Ei,E=ae.shared.interleaved,E!==null){ae=E;do We|=ae.lane,ae=ae.next;while(ae!==E)}else _e===null&&(ae.shared.lanes=0);xb|=We,T.lanes=We,T.memoizedState=Ii}}function hm(T,E,B){if(T=E.effects,E.effects=null,T!==null)for(E=0;EB?B:4,T(!0);var H=yp.transition;yp.transition={};try{T(!1),E()}finally{ms=B,yp.transition=H}}function pm(){return X().memoizedState}function Dy(T,E,B){var H=yx(T);if(B={lane:H,action:B,hasEagerState:!1,eagerState:null,next:null},gb(T))Oy(E,B);else if(B=__(T,E,B,H),B!==null){var ae=zh();vm(B,T,H,ae),wy(B,E,H)}}function Wg(T,E,B){var H=yx(T),ae={lane:H,action:B,hasEagerState:!1,eagerState:null,next:null};if(gb(T))Oy(E,ae);else{var _e=T.alternate;if(T.lanes===0&&(_e===null||_e.lanes===0)&&(_e=E.lastRenderedReducer,_e!==null))try{var We=E.lastRenderedState,st=_e(We,B);if(ae.hasEagerState=!0,ae.eagerState=st,Ro(st,We)){var xt=E.interleaved;xt===null?(ae.next=ae,gx(E)):(ae.next=xt.next,xt.next=ae),E.interleaved=ae;return}}catch{}finally{}B=__(T,E,ae,H),B!==null&&(ae=zh(),vm(B,T,H,ae),wy(B,E,H))}}function gb(T){var E=T.alternate;return T===Qn||E!==null&&E===Qn}function Oy(T,E){Bl=$u=!0;var B=T.pending;B===null?E.next=E:(E.next=B.next,B.next=E),T.pending=E}function wy(T,E,B){if((B&4194240)!==0){var H=E.lanes;H&=T.pendingLanes,B|=H,E.lanes=B,Ql(T,B)}}var Ny={readContext:qc,useCallback:hl,useContext:hl,useEffect:hl,useImperativeHandle:hl,useInsertionEffect:hl,useLayoutEffect:hl,useMemo:hl,useReducer:hl,useRef:hl,useState:hl,useDebugValue:hl,useDeferredValue:hl,useTransition:hl,useMutableSource:hl,useSyncExternalStore:hl,useId:hl,unstable_isNewReconciler:!1},dP={readContext:qc,useCallback:function(T,E){return ii().memoizedState=[T,E===void 0?null:E],T},useContext:qc,useEffect:ya,useImperativeHandle:function(T,E,B){return B=B!=null?B.concat([T]):null,mn(4194308,4,yu.bind(null,E,T),B)},useLayoutEffect:function(T,E){return mn(4194308,4,T,E)},useInsertionEffect:function(T,E){return mn(4,2,T,E)},useMemo:function(T,E){var B=ii();return E=E===void 0?null:E,T=T(),B.memoizedState=[T,E],T},useReducer:function(T,E,B){var H=ii();return E=B!==void 0?B(E):E,H.memoizedState=H.baseState=E,T={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:T,lastRenderedState:E},H.queue=T,T=T.dispatch=Dy.bind(null,Qn,T),[H.memoizedState,T]},useRef:function(T){var E=ii();return T={current:T},E.memoizedState=T},useState:jr,useDebugValue:xx,useDeferredValue:function(T){return ii().memoizedState=T},useTransition:function(){var T=jr(!1),E=T[0];return T=a1.bind(null,T[1]),ii().memoizedState=T,[E,T]},useMutableSource:function(){},useSyncExternalStore:function(T,E,B){var H=Qn,ae=ii();if(sa){if(B===void 0)throw Error(t(407));B=B()}else{if(B=E(),Kc===null)throw Error(t(349));(Vd&30)!==0||Vr(H,E,B)}ae.memoizedState=B;var _e={value:B,getSnapshot:E};return ae.queue=_e,ya(Tu.bind(null,H,_e,T),[T]),H.flags|=2048,$s(9,an.bind(null,H,_e,B,E),void 0,null),B},useId:function(){var T=ii(),E=Kc.identifierPrefix;if(sa){var B=Su,H=Gi;B=(H&~(1<<32-Yi(H)-1)).toString(32)+B,E=":"+E+"R"+B,B=Rf++,0<\/script>",T=T.removeChild(T.firstChild)):typeof H.is=="string"?T=We.createElement(B,{is:H.is}):(T=We.createElement(B),B==="select"&&(We=T,H.multiple?We.multiple=!0:H.size&&(We.size=H.size))):T=We.createElementNS(T,B),T[Po]=E,T[om]=H,F6(T,E,!1,!1),E.stateNode=T;e:{switch(We=mi(B,H),B){case"dialog":is("cancel",T),is("close",T),ae=H;break;case"iframe":case"object":case"embed":is("load",T),ae=H;break;case"video":case"audio":for(ae=0;aeky&&(E.flags|=128,H=!0,_C(_e,!1),E.lanes=4194304)}else{if(!H)if(T=Xu(We),T!==null){if(E.flags|=128,H=!0,B=T.updateQueue,B!==null&&(E.updateQueue=B,E.flags|=4),_C(_e,!0),_e.tail===null&&_e.tailMode==="hidden"&&!We.alternate&&!sa)return Yu(E),null}else 2*Bi()-_e.renderingStartTime>ky&&B!==1073741824&&(E.flags|=128,H=!0,_C(_e,!1),E.lanes=4194304);_e.isBackwards?(We.sibling=E.child,E.child=We):(B=_e.last,B!==null?B.sibling=We:E.child=We,_e.last=We)}return _e.tail!==null?(E=_e.tail,_e.rendering=E,_e.tail=E.sibling,_e.renderingStartTime=Bi(),E.sibling=null,B=na.current,jn(na,H?B&1|2:B&1),E):(Yu(E),null);case 22:case 23:return b1(),H=E.memoizedState!==null,T!==null&&T.memoizedState!==null!==H&&(E.flags|=8192),H&&(E.mode&1)!==0?(If&1073741824)!==0&&(Yu(E),E.subtreeFlags&6&&(E.flags|=8192)):Yu(E),null;case 24:return null;case 25:return null}throw Error(t(156,E.tag))}function vNe(T,E){switch(Ld(E),E.tag){case 1:return Ll(E.type)&&o_(),T=E.flags,T&65536?(E.flags=T&-65537|128,E):null;case 3:return Cf(),Kn(oc),Kn(cl),Vh(),T=E.flags,(T&65536)!==0&&(T&128)===0?(E.flags=T&-65537|128,E):null;case 5:return dm(E),null;case 13:if(Kn(na),T=E.memoizedState,T!==null&&T.dehydrated!==null){if(E.alternate===null)throw Error(t(340));yf()}return T=E.flags,T&65536?(E.flags=T&-65537|128,E):null;case 19:return Kn(na),null;case 4:return Cf(),null;case 10:return p_(E.type._context),null;case 22:case 23:return b1(),null;case 24:return null;default:return null}}var vP=!1,qu=!1,xNe=typeof WeakSet=="function"?WeakSet:Set,gr=null;function Fy(T,E){var B=T.ref;if(B!==null)if(typeof B=="function")try{B(null)}catch(H){fl(T,E,H)}else B.current=null}function c1(T,E,B){try{B()}catch(H){fl(T,E,H)}}var V6=!1;function SNe(T,E){if(am=zo,T=Pn(),xa(T)){if("selectionStart"in T)var B={start:T.selectionStart,end:T.selectionEnd};else e:{B=(B=T.ownerDocument)&&B.defaultView||window;var H=B.getSelection&&B.getSelection();if(H&&H.rangeCount!==0){B=H.anchorNode;var ae=H.anchorOffset,_e=H.focusNode;H=H.focusOffset;try{B.nodeType,_e.nodeType}catch{B=null;break e}var We=0,st=-1,xt=-1,Zt=0,Ei=0,Ii=T,bi=null;t:for(;;){for(var cr;Ii!==B||ae!==0&&Ii.nodeType!==3||(st=We+ae),Ii!==_e||H!==0&&Ii.nodeType!==3||(xt=We+H),Ii.nodeType===3&&(We+=Ii.nodeValue.length),(cr=Ii.firstChild)!==null;)bi=Ii,Ii=cr;for(;;){if(Ii===T)break t;if(bi===B&&++Zt===ae&&(st=We),bi===_e&&++Ei===H&&(xt=We),(cr=Ii.nextSibling)!==null)break;Ii=bi,bi=Ii.parentNode}Ii=cr}B=st===-1||xt===-1?null:{start:st,end:xt}}else B=null}B=B||{start:0,end:0}}else B=null;for(ix={focusedElem:T,selectionRange:B},zo=!1,gr=E;gr!==null;)if(E=gr,T=E.child,(E.subtreeFlags&1028)!==0&&T!==null)T.return=E,gr=T;else for(;gr!==null;){E=gr;try{var xr=E.alternate;if((E.flags&1024)!==0)switch(E.tag){case 0:case 11:case 15:break;case 1:if(xr!==null){var Cr=xr.memoizedProps,kl=xr.memoizedState,Ut=E.stateNode,Rt=Ut.getSnapshotBeforeUpdate(E.elementType===E.type?Cr:Ud(E.type,Cr),kl);Ut.__reactInternalSnapshotBeforeUpdate=Rt}break;case 3:var zt=E.stateNode.containerInfo;zt.nodeType===1?zt.textContent="":zt.nodeType===9&&zt.documentElement&&zt.removeChild(zt.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(t(163))}}catch(Vi){fl(E,E.return,Vi)}if(T=E.sibling,T!==null){T.return=E.return,gr=T;break}gr=E.return}return xr=V6,V6=!1,xr}function gC(T,E,B){var H=E.updateQueue;if(H=H!==null?H.lastEffect:null,H!==null){var ae=H=H.next;do{if((ae.tag&T)===T){var _e=ae.destroy;ae.destroy=void 0,_e!==void 0&&c1(E,B,_e)}ae=ae.next}while(ae!==H)}}function xP(T,E){if(E=E.updateQueue,E=E!==null?E.lastEffect:null,E!==null){var B=E=E.next;do{if((B.tag&T)===T){var H=B.create;B.destroy=H()}B=B.next}while(B!==E)}}function u1(T){var E=T.ref;if(E!==null){var B=T.stateNode;switch(T.tag){case 5:T=B;break;default:T=B}typeof E=="function"?E(T):E.current=T}}function U6(T){var E=T.alternate;E!==null&&(T.alternate=null,U6(E)),T.child=null,T.deletions=null,T.sibling=null,T.tag===5&&(E=T.stateNode,E!==null&&(delete E[Po],delete E[om],delete E[up],delete E[Ng],delete E[Lg])),T.stateNode=null,T.return=null,T.dependencies=null,T.memoizedProps=null,T.memoizedState=null,T.pendingProps=null,T.stateNode=null,T.updateQueue=null}function G6(T){return T.tag===5||T.tag===3||T.tag===4}function z6(T){e:for(;;){for(;T.sibling===null;){if(T.return===null||G6(T.return))return null;T=T.return}for(T.sibling.return=T.return,T=T.sibling;T.tag!==5&&T.tag!==6&&T.tag!==18;){if(T.flags&2||T.child===null||T.tag===4)continue e;T.child.return=T,T=T.child}if(!(T.flags&2))return T.stateNode}}function h1(T,E,B){var H=T.tag;if(H===5||H===6)T=T.stateNode,E?B.nodeType===8?B.parentNode.insertBefore(T,E):B.insertBefore(T,E):(B.nodeType===8?(E=B.parentNode,E.insertBefore(T,B)):(E=B,E.appendChild(T)),B=B._reactRootContainer,B!=null||E.onclick!==null||(E.onclick=a_));else if(H!==4&&(T=T.child,T!==null))for(h1(T,E,B),T=T.sibling;T!==null;)h1(T,E,B),T=T.sibling}function d1(T,E,B){var H=T.tag;if(H===5||H===6)T=T.stateNode,E?B.insertBefore(T,E):B.appendChild(T);else if(H!==4&&(T=T.child,T!==null))for(d1(T,E,B),T=T.sibling;T!==null;)d1(T,E,B),T=T.sibling}var Eu=null,_m=!1;function Sx(T,E,B){for(B=B.child;B!==null;)W6(T,E,B),B=B.sibling}function W6(T,E,B){if(vi&&typeof vi.onCommitFiberUnmount=="function")try{vi.onCommitFiberUnmount(Fr,B)}catch{}switch(B.tag){case 5:qu||Fy(B,E);case 6:var H=Eu,ae=_m;Eu=null,Sx(T,E,B),Eu=H,_m=ae,Eu!==null&&(_m?(T=Eu,B=B.stateNode,T.nodeType===8?T.parentNode.removeChild(B):T.removeChild(B)):Eu.removeChild(B.stateNode));break;case 18:Eu!==null&&(_m?(T=Eu,B=B.stateNode,T.nodeType===8?wg(T.parentNode,B):T.nodeType===1&&wg(T,B),ku(T)):wg(Eu,B.stateNode));break;case 4:H=Eu,ae=_m,Eu=B.stateNode.containerInfo,_m=!0,Sx(T,E,B),Eu=H,_m=ae;break;case 0:case 11:case 14:case 15:if(!qu&&(H=B.updateQueue,H!==null&&(H=H.lastEffect,H!==null))){ae=H=H.next;do{var _e=ae,We=_e.destroy;_e=_e.tag,We!==void 0&&((_e&2)!==0||(_e&4)!==0)&&c1(B,E,We),ae=ae.next}while(ae!==H)}Sx(T,E,B);break;case 1:if(!qu&&(Fy(B,E),H=B.stateNode,typeof H.componentWillUnmount=="function"))try{H.props=B.memoizedProps,H.state=B.memoizedState,H.componentWillUnmount()}catch(st){fl(B,E,st)}Sx(T,E,B);break;case 21:Sx(T,E,B);break;case 22:B.mode&1?(qu=(H=qu)||B.memoizedState!==null,Sx(T,E,B),qu=H):Sx(T,E,B);break;default:Sx(T,E,B)}}function H6(T){var E=T.updateQueue;if(E!==null){T.updateQueue=null;var B=T.stateNode;B===null&&(B=T.stateNode=new xNe),E.forEach(function(H){var ae=PNe.bind(null,T,H);B.has(H)||(B.add(H),H.then(ae,ae))})}}function gm(T,E){var B=E.deletions;if(B!==null)for(var H=0;Hae&&(ae=We),H&=~_e}if(H=ae,H=Bi()-H,H=(120>H?120:480>H?480:1080>H?1080:1920>H?1920:3e3>H?3e3:4320>H?4320:1960*TNe(H/1960))-H,10T?16:T,Tx===null)var H=!1;else{if(T=Tx,Tx=null,EP=0,(Bn&6)!==0)throw Error(t(331));var ae=Bn;for(Bn|=4,gr=T.current;gr!==null;){var _e=gr,We=_e.child;if((gr.flags&16)!==0){var st=_e.deletions;if(st!==null){for(var xt=0;xtBi()-m1?bb(T,0):p1|=B),zd(T,E)}function r8(T,E){E===0&&((T.mode&1)===0?E=1:(E=Qr,Qr<<=1,(Qr&130023424)===0&&(Qr=4194304)));var B=zh();T=ju(T,E),T!==null&&(xc(T,E,B),zd(T,B))}function ANe(T){var E=T.memoizedState,B=0;E!==null&&(B=E.retryLane),r8(T,B)}function PNe(T,E){var B=0;switch(T.tag){case 13:var H=T.stateNode,ae=T.memoizedState;ae!==null&&(B=ae.retryLane);break;case 19:H=T.stateNode;break;default:throw Error(t(314))}H!==null&&H.delete(E),r8(T,B)}var s8;s8=function(T,E,B){if(T!==null)if(T.memoizedProps!==E.pendingProps||oc.current)Ls=!0;else{if((T.lanes&B)===0&&(E.flags&128)===0)return Ls=!1,_Ne(T,E,B);Ls=(T.flags&131072)!==0}else Ls=!1,sa&&(E.flags&1048576)!==0&&ux(E,Vg,E.index);switch(E.lanes=0,E.tag){case 2:var H=E.type;gP(T,E),T=E.pendingProps;var ae=hp(E,cl.current);Ef(E,B),ae=x_(null,E,H,T,ae,B);var _e=vx();return E.flags|=1,typeof ae=="object"&&ae!==null&&typeof ae.render=="function"&&ae.$$typeof===void 0?(E.tag=1,E.memoizedState=null,E.updateQueue=null,Ll(H)?(_e=!0,dp(E)):_e=!1,E.memoizedState=ae.state!==null&&ae.state!==void 0?ae.state:null,_s(E),ae.updater=Ly,E.stateNode=ae,ae._reactInternals=E,W(E,H,T,B),E=Ps(null,E,H,!0,_e,B)):(E.tag=0,sa&&_e&&hx(E),sr(null,E,ae,B),E=E.child),E;case 16:H=E.elementType;e:{switch(gP(T,E),T=E.pendingProps,ae=H._init,H=ae(H._payload),E.type=H,ae=E.tag=DNe(H),T=Ud(H,T),ae){case 0:E=Ji(null,E,H,T,B);break e;case 1:E=Ir(null,E,H,T,B);break e;case 11:E=Ic(null,E,H,T,B);break e;case 14:E=Gh(null,E,H,Ud(H.type,T),B);break e}throw Error(t(306,H,""))}return E;case 0:return H=E.type,ae=E.pendingProps,ae=E.elementType===H?ae:Ud(H,ae),Ji(T,E,H,ae,B);case 1:return H=E.type,ae=E.pendingProps,ae=E.elementType===H?ae:Ud(H,ae),Ir(T,E,H,ae,B);case 3:e:{if(vs(E),T===null)throw Error(t(387));H=E.pendingProps,_e=E.memoizedState,ae=_e.element,no(T,E),Xa(E,H,null,B);var We=E.memoizedState;if(H=We.element,_e.isDehydrated)if(_e={element:H,isDehydrated:!1,cache:We.cache,pendingSuspenseBoundaries:We.pendingSuspenseBoundaries,transitions:We.transitions},E.updateQueue.baseState=_e,E.memoizedState=_e,E.flags&256){ae=K(Error(t(423)),E),E=xn(T,E,H,B,ae);break e}else if(H!==ae){ae=K(Error(t(424)),E),E=xn(T,E,H,B,ae);break e}else for(cc=Md(E.stateNode.containerInfo.firstChild),ul=E,sa=!0,bu=null,B=f_(E,null,H,B),E.child=B;B;)B.flags=B.flags&-3|4096,B=B.sibling;else{if(yf(),H===ae){E=Hg(T,E,B);break e}sr(T,E,H,B)}E=E.child}return E;case 5:return bp(E),T===null&&Gg(E),H=E.type,ae=E.pendingProps,_e=T!==null?T.memoizedProps:null,We=ae.children,rx(H,ae)?We=null:_e!==null&&rx(H,_e)&&(E.flags|=32),Qt(T,E),sr(T,E,We,B),E.child;case 6:return T===null&&Gg(E),null;case 13:return mm(T,E,B);case 4:return g_(E,E.stateNode.containerInfo),H=E.pendingProps,T===null?E.child=mp(E,null,H,B):sr(T,E,H,B),E.child;case 11:return H=E.type,ae=E.pendingProps,ae=E.elementType===H?ae:Ud(H,ae),Ic(T,E,H,ae,B);case 7:return sr(T,E,E.pendingProps,B),E.child;case 8:return sr(T,E,E.pendingProps.children,B),E.child;case 12:return sr(T,E,E.pendingProps.children,B),E.child;case 10:e:{if(H=E.type._context,ae=E.pendingProps,_e=E.memoizedProps,We=ae.value,jn(_p,H._currentValue),H._currentValue=We,_e!==null)if(Ro(_e.value,We)){if(_e.children===ae.children&&!oc.current){E=Hg(T,E,B);break e}}else for(_e=E.child,_e!==null&&(_e.return=E);_e!==null;){var st=_e.dependencies;if(st!==null){We=_e.child;for(var xt=st.firstContext;xt!==null;){if(xt.context===H){if(_e.tag===1){xt=Fn(-1,B&-B),xt.tag=2;var Zt=_e.updateQueue;if(Zt!==null){Zt=Zt.shared;var Ei=Zt.pending;Ei===null?xt.next=xt:(xt.next=Ei.next,Ei.next=xt),Zt.pending=xt}}_e.lanes|=B,xt=_e.alternate,xt!==null&&(xt.lanes|=B),m_(_e.return,B,E),st.lanes|=B;break}xt=xt.next}}else if(_e.tag===10)We=_e.type===E.type?null:_e.child;else if(_e.tag===18){if(We=_e.return,We===null)throw Error(t(341));We.lanes|=B,st=We.alternate,st!==null&&(st.lanes|=B),m_(We,B,E),We=_e.sibling}else We=_e.child;if(We!==null)We.return=_e;else for(We=_e;We!==null;){if(We===E){We=null;break}if(_e=We.sibling,_e!==null){_e.return=We.return,We=_e;break}We=We.return}_e=We}sr(T,E,ae.children,B),E=E.child}return E;case 9:return ae=E.type,H=E.pendingProps.children,Ef(E,B),ae=qc(ae),H=H(ae),E.flags|=1,sr(T,E,H,B),E.child;case 14:return H=E.type,ae=Ud(H,E.pendingProps),ae=Ud(H.type,ae),Gh(T,E,H,ae,B);case 15:return Ht(T,E,E.type,E.pendingProps,B);case 17:return H=E.type,ae=E.pendingProps,ae=E.elementType===H?ae:Ud(H,ae),gP(T,E),E.tag=1,Ll(H)?(T=!0,dp(E)):T=!1,Ef(E,B),M(E,H,ae),W(E,H,ae,B),Ps(null,E,H,!0,T,B);case 19:return L6(T,E,B);case 22:return Mt(T,E,B)}throw Error(t(156,E.tag))};function n8(T,E){return pi(T,E)}function MNe(T,E,B,H){this.tag=T,this.key=B,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=E,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=H,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Cp(T,E,B,H){return new MNe(T,E,B,H)}function y1(T){return T=T.prototype,!(!T||!T.isReactComponent)}function DNe(T){if(typeof T=="function")return y1(T)?1:0;if(T!=null){if(T=T.$$typeof,T===k)return 11;if(T===ne)return 14}return 2}function Cx(T,E){var B=T.alternate;return B===null?(B=Cp(T.tag,E,T.key,T.mode),B.elementType=T.elementType,B.type=T.type,B.stateNode=T.stateNode,B.alternate=T,T.alternate=B):(B.pendingProps=E,B.type=T.type,B.flags=0,B.subtreeFlags=0,B.deletions=null),B.flags=T.flags&14680064,B.childLanes=T.childLanes,B.lanes=T.lanes,B.child=T.child,B.memoizedProps=T.memoizedProps,B.memoizedState=T.memoizedState,B.updateQueue=T.updateQueue,E=T.dependencies,B.dependencies=E===null?null:{lanes:E.lanes,firstContext:E.firstContext},B.sibling=T.sibling,B.index=T.index,B.ref=T.ref,B}function AP(T,E,B,H,ae,_e){var We=2;if(H=T,typeof T=="function")y1(T)&&(We=1);else if(typeof T=="string")We=5;else e:switch(T){case R:return yb(B.children,ae,_e,E);case A:We=8,ae|=8;break;case P:return T=Cp(12,B,E,ae|2),T.elementType=P,T.lanes=_e,T;case V:return T=Cp(13,B,E,ae),T.elementType=V,T.lanes=_e,T;case U:return T=Cp(19,B,E,ae),T.elementType=U,T.lanes=_e,T;case le:return PP(B,ae,_e,E);default:if(typeof T=="object"&&T!==null)switch(T.$$typeof){case w:We=10;break e;case L:We=9;break e;case k:We=11;break e;case ne:We=14;break e;case oe:We=16,H=null;break e}throw Error(t(130,T==null?T:typeof T,""))}return E=Cp(We,B,E,ae),E.elementType=T,E.type=H,E.lanes=_e,E}function yb(T,E,B,H){return T=Cp(7,T,H,E),T.lanes=B,T}function PP(T,E,B,H){return T=Cp(22,T,H,E),T.elementType=le,T.lanes=B,T.stateNode={isHidden:!1},T}function E1(T,E,B){return T=Cp(6,T,null,E),T.lanes=B,T}function C1(T,E,B){return E=Cp(4,T.children!==null?T.children:[],T.key,E),E.lanes=B,E.stateNode={containerInfo:T.containerInfo,pendingChildren:null,implementation:T.implementation},E}function ONe(T,E,B,H,ae){this.tag=E,this.containerInfo=T,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=lu(0),this.expirationTimes=lu(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=lu(0),this.identifierPrefix=H,this.onRecoverableError=ae,this.mutableSourceEagerHydrationData=null}function R1(T,E,B,H,ae,_e,We,st,xt){return T=new ONe(T,E,B,st,xt),E===1?(E=1,_e===!0&&(E|=8)):E=0,_e=Cp(3,null,null,E),T.current=_e,_e.stateNode=T,_e.memoizedState={element:H,isDehydrated:B,cache:null,transitions:null,pendingSuspenseBoundaries:null},_s(_e),T}function wNe(T,E,B){var H=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(s)}catch(e){console.error(e)}}return s(),w1.exports=YNe(),w1.exports}var S8;function qNe(){if(S8)return kP;S8=1;var s=Ipe();return kP.createRoot=s.createRoot,kP.hydrateRoot=s.hydrateRoot,kP}var ZNe=qNe();const KNe=O5(ZNe);Ipe();/**
000042: * @remix-run/router v1.23.3
000043: *
000044: * Copyright (c) Remix Software Inc.
000045: *
000046: * This source code is licensed under the MIT license found in the
000047: * LICENSE.md file in the root directory of this source tree.
000048: *
000049: * @license MIT
000050: */function VR(){return VR=Object.assign?Object.assign.bind():function(s){for(var e=1;e"u")throw new Error(e)}function w5(s,e){if(!s){typeof console<"u"&&console.warn(e);try{throw new Error(e)}catch{}}}function JNe(){return Math.random().toString(36).substr(2,8)}function T8(s,e){return{usr:s.state,key:s.key,idx:e}}function kF(s,e,t,i){return t===void 0&&(t=null),VR({pathname:typeof s=="string"?s:s.pathname,search:"",hash:""},typeof e=="string"?U0(e):e,{state:t,key:e&&e.key||i||JNe()})}function $D(s){let{pathname:e="/",search:t="",hash:i=""}=s;return t&&t!=="?"&&(e+=t.charAt(0)==="?"?t:"?"+t),i&&i!=="#"&&(e+=i.charAt(0)==="#"?i:"#"+i),e}function U0(s){let e={};if(s){let t=s.indexOf("#");t>=0&&(e.hash=s.substr(t),s=s.substr(0,t));let i=s.indexOf("?");i>=0&&(e.search=s.substr(i),s=s.substr(0,i)),s&&(e.pathname=s)}return e}function e1e(s,e,t,i){i===void 0&&(i={});let{window:r=document.defaultView,v5Compat:n=!1}=i,a=r.history,o=cS.Pop,l=null,c=u();c==null&&(c=0,a.replaceState(VR({},a.state,{idx:c}),""));function u(){return(a.state||{idx:null}).idx}function h(){o=cS.Pop;let _=u(),v=_==null?null:_-c;c=_,l&&l({action:o,location:p.location,delta:v})}function d(_,v){o=cS.Push;let x=kF(p.location,_,v);c=u()+1;let S=T8(x,c),b=p.createHref(x);try{a.pushState(S,"",b)}catch(y){if(y instanceof DOMException&&y.name==="DataCloneError")throw y;r.location.assign(b)}n&&l&&l({action:o,location:p.location,delta:1})}function f(_,v){o=cS.Replace;let x=kF(p.location,_,v);c=u();let S=T8(x,c),b=p.createHref(x);a.replaceState(S,"",b),n&&l&&l({action:o,location:p.location,delta:0})}function m(_){let v=r.location.origin!=="null"?r.location.origin:r.location.href,x=typeof _=="string"?_:$D(_);return x=x.replace(/ $/,"%20"),il(v,"No window.location.(origin|href) available to create URL for href: "+x),new URL(x,v)}let p={get action(){return o},get location(){return s(r,a)},listen(_){if(l)throw new Error("A history only accepts one active listener");return r.addEventListener(b8,h),l=_,()=>{r.removeEventListener(b8,h),l=null}},createHref(_){return e(r,_)},createURL:m,encodeLocation(_){let v=m(_);return{pathname:v.pathname,search:v.search,hash:v.hash}},push:d,replace:f,go(_){return a.go(_)}};return p}var y8;(function(s){s.data="data",s.deferred="deferred",s.redirect="redirect",s.error="error"})(y8||(y8={}));function t1e(s,e,t){return t===void 0&&(t="/"),i1e(s,e,t)}function i1e(s,e,t,i){let r=typeof e=="string"?U0(e):e,n=f0(r.pathname||"/",t);if(n==null)return null;let a=Ape(s);r1e(a);let o=null,l=p1e(n);for(let c=0;o==null&&c{let l={relativePath:o===void 0?n.path||"":o,caseSensitive:n.caseSensitive===!0,childrenIndex:a,route:n};l.relativePath.startsWith("/")&&(il(l.relativePath.startsWith(i),'Absolute route path "'+l.relativePath+'" nested under path '+('"'+i+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),l.relativePath=l.relativePath.slice(i.length));let c=TS([i,l.relativePath]),u=t.concat(l);n.children&&n.children.length>0&&(il(n.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+c+'".')),Ape(n.children,e,u,c)),!(n.path==null&&!n.index)&&e.push({path:c,score:u1e(c,n.index),routesMeta:u})};return s.forEach((n,a)=>{var o;if(n.path===""||!((o=n.path)!=null&&o.includes("?")))r(n,a);else for(let l of Ppe(n.path))r(n,a,l)}),e}function Ppe(s){let e=s.split("/");if(e.length===0)return[];let[t,...i]=e,r=t.endsWith("?"),n=t.replace(/\?$/,"");if(i.length===0)return r?[n,""]:[n];let a=Ppe(i.join("/")),o=[];return o.push(...a.map(l=>l===""?n:[n,l].join("/"))),r&&o.push(...a),o.map(l=>s.startsWith("/")&&l===""?"/":l)}function r1e(s){s.sort((e,t)=>e.score!==t.score?t.score-e.score:h1e(e.routesMeta.map(i=>i.childrenIndex),t.routesMeta.map(i=>i.childrenIndex)))}const s1e=/^:[\w-]+$/,n1e=3,a1e=2,o1e=1,l1e=10,c1e=-2,E8=s=>s==="*";function u1e(s,e){let t=s.split("/"),i=t.length;return t.some(E8)&&(i+=c1e),e&&(i+=a1e),t.filter(r=>!E8(r)).reduce((r,n)=>r+(s1e.test(n)?n1e:n===""?o1e:l1e),i)}function h1e(s,e){return s.length===e.length&&s.slice(0,-1).every((i,r)=>i===e[r])?s[s.length-1]-e[e.length-1]:0}function d1e(s,e,t){let{routesMeta:i}=s,r={},n="/",a=[];for(let o=0;o{let{paramName:d,isOptional:f}=u;if(d==="*"){let p=o[h]||"";a=n.slice(0,n.length-p.length).replace(/(.)\/+$/,"$1")}const m=o[h];return f&&!m?c[d]=void 0:c[d]=(m||"").replace(/%2F/g,"/"),c},{}),pathname:n,pathnameBase:a,pattern:s}}function f1e(s,e,t){e===void 0&&(e=!1),t===void 0&&(t=!0),w5(s==="*"||!s.endsWith("*")||s.endsWith("/*"),'Route path "'+s+'" will be treated as if it were '+('"'+s.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+s.replace(/\*$/,"/*")+'".'));let i=[],r="^"+s.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(a,o,l)=>(i.push({paramName:o,isOptional:l!=null}),l?"/?([^\\/]+)?":"/([^\\/]+)"));return s.endsWith("*")?(i.push({paramName:"*"}),r+=s==="*"||s==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):t?r+="\\/*$":s!==""&&s!=="/"&&(r+="(?:(?=\\/|$))"),[new RegExp(r,e?void 0:"i"),i]}function p1e(s){try{return s.split("/").map(e=>decodeURIComponent(e).replace(/\//g,"%2F")).join("/")}catch(e){return w5(!1,'The URL path "'+s+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+e+").")),s}}function f0(s,e){if(e==="/")return s;if(!s.toLowerCase().startsWith(e.toLowerCase()))return null;let t=e.endsWith("/")?e.length-1:e.length,i=s.charAt(t);return i&&i!=="/"?null:s.slice(t)||"/"}const m1e=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,_1e=s=>m1e.test(s);function g1e(s,e){e===void 0&&(e="/");let{pathname:t,search:i="",hash:r=""}=typeof s=="string"?U0(s):s,n;if(t)if(_1e(t))n=t;else{if(t.includes("//")){let a=t;t=Mpe(t),w5(!1,"Pathnames cannot have embedded double slashes - normalizing "+(a+" -> "+t))}t.startsWith("/")?n=C8(t.substring(1),"/"):n=C8(t,e)}else n=e;return{pathname:n,search:S1e(i),hash:b1e(r)}}function C8(s,e){let t=e.replace(/\/+$/,"").split("/");return s.split("/").forEach(r=>{r===".."?t.length>1&&t.pop():r!=="."&&t.push(r)}),t.length>1?t.join("/"):"/"}function F1(s,e,t,i){return"Cannot include a '"+s+"' character in a manually specified "+("`to."+e+"` field ["+JSON.stringify(i)+"]. Please separate it out to the ")+("`to."+t+"` field. Alternatively you may provide the full path as ")+'a string in and the router will parse it for you.'}function v1e(s){return s.filter((e,t)=>t===0||e.route.path&&e.route.path.length>0)}function N5(s,e){let t=v1e(s);return e?t.map((i,r)=>r===t.length-1?i.pathname:i.pathnameBase):t.map(i=>i.pathnameBase)}function L5(s,e,t,i){i===void 0&&(i=!1);let r;typeof s=="string"?r=U0(s):(r=VR({},s),il(!r.pathname||!r.pathname.includes("?"),F1("?","pathname","search",r)),il(!r.pathname||!r.pathname.includes("#"),F1("#","pathname","hash",r)),il(!r.search||!r.search.includes("#"),F1("#","search","hash",r)));let n=s===""||r.pathname==="",a=n?"/":r.pathname,o;if(a==null)o=t;else{let h=e.length-1;if(!i&&a.startsWith("..")){let d=a.split("/");for(;d[0]==="..";)d.shift(),h-=1;r.pathname=d.join("/")}o=h>=0?e[h]:"/"}let l=g1e(r,o),c=a&&a!=="/"&&a.endsWith("/"),u=(n||a===".")&&t.endsWith("/");return!l.pathname.endsWith("/")&&(c||u)&&(l.pathname+="/"),l}const Mpe=s=>s.replace(/\/\/+/g,"/"),TS=s=>Mpe(s.join("/")),x1e=s=>s.replace(/\/+$/,"").replace(/^\/*/,"/"),S1e=s=>!s||s==="?"?"":s.startsWith("?")?s:"?"+s,b1e=s=>!s||s==="#"?"":s.startsWith("#")?s:"#"+s;function T1e(s){return s!=null&&typeof s.status=="number"&&typeof s.statusText=="string"&&typeof s.internal=="boolean"&&"data"in s}const Dpe=["post","put","patch","delete"];new Set(Dpe);const y1e=["get",...Dpe];new Set(y1e);/**
000051: * React Router v6.30.4
000052: *
000053: * Copyright (c) Remix Software Inc.
000054: *
000055: * This source code is licensed under the MIT license found in the
000056: * LICENSE.md file in the root directory of this source tree.
000057: *
000058: * @license MIT
000059: */function UR(){return UR=Object.assign?Object.assign.bind():function(s){for(var e=1;e{o.current=!0}),Te.useCallback(function(c,u){if(u===void 0&&(u={}),!o.current)return;if(typeof c=="number"){i.go(c);return}let h=L5(c,JSON.parse(a),n,u.relative==="path");s==null&&e!=="/"&&(h.pathname=h.pathname==="/"?e:TS([e,h.pathname])),(u.replace?i.replace:i.push)(h,u.state,u)},[e,i,a,n,s])}const I1e=Te.createContext(null);function A1e(s){let e=Te.useContext(xg).outlet;return e&&Te.createElement(I1e.Provider,{value:s},e)}function Wv(){let{matches:s}=Te.useContext(xg),e=s[s.length-1];return e?e.params:{}}function jO(s,e){let{relative:t}=e===void 0?{}:e,{future:i}=Te.useContext(zv),{matches:r}=Te.useContext(xg),{pathname:n}=zS(),a=JSON.stringify(N5(r,i.v7_relativeSplatPath));return Te.useMemo(()=>L5(s,JSON.parse(a),n,t==="path"),[s,a,n,t])}function P1e(s,e){return M1e(s,e)}function M1e(s,e,t,i){G0()||il(!1);let{navigator:r}=Te.useContext(zv),{matches:n}=Te.useContext(xg),a=n[n.length-1],o=a?a.params:{};a&&a.pathname;let l=a?a.pathnameBase:"/";a&&a.route;let c=zS(),u;if(e){var h;let _=typeof e=="string"?U0(e):e;l==="/"||(h=_.pathname)!=null&&h.startsWith(l)||il(!1),u=_}else u=c;let d=u.pathname||"/",f=d;if(l!=="/"){let _=l.replace(/^\//,"").split("/");f="/"+d.replace(/^\//,"").split("/").slice(_.length).join("/")}let m=t1e(s,{pathname:f}),p=L1e(m&&m.map(_=>Object.assign({},_,{params:Object.assign({},o,_.params),pathname:TS([l,r.encodeLocation?r.encodeLocation(_.pathname).pathname:_.pathname]),pathnameBase:_.pathnameBase==="/"?l:TS([l,r.encodeLocation?r.encodeLocation(_.pathnameBase).pathname:_.pathnameBase])})),n,t,i);return e&&p?Te.createElement($I.Provider,{value:{location:UR({pathname:"/",search:"",hash:"",state:null,key:"default"},u),navigationType:cS.Pop}},p):p}function D1e(){let s=V1e(),e=T1e(s)?s.status+" "+s.statusText:s instanceof Error?s.message:JSON.stringify(s),t=s instanceof Error?s.stack:null,r={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return Te.createElement(Te.Fragment,null,Te.createElement("h2",null,"Unexpected Application Error!"),Te.createElement("h3",{style:{fontStyle:"italic"}},e),t?Te.createElement("pre",{style:r},t):null,null)}const O1e=Te.createElement(D1e,null);class w1e extends Te.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:t.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){console.error("React Router caught the following error during render",e,t)}render(){return this.state.error!==void 0?Te.createElement(xg.Provider,{value:this.props.routeContext},Te.createElement(wpe.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function N1e(s){let{routeContext:e,match:t,children:i}=s,r=Te.useContext(HO);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),Te.createElement(xg.Provider,{value:e},i)}function L1e(s,e,t,i){var r;if(e===void 0&&(e=[]),t===void 0&&(t=null),i===void 0&&(i=null),s==null){var n;if(!t)return null;if(t.errors)s=t.matches;else if((n=i)!=null&&n.v7_partialHydration&&e.length===0&&!t.initialized&&t.matches.length>0)s=t.matches;else return null}let a=s,o=(r=t)==null?void 0:r.errors;if(o!=null){let u=a.findIndex(h=>h.route.id&&(o==null?void 0:o[h.route.id])!==void 0);u>=0||il(!1),a=a.slice(0,Math.min(a.length,u+1))}let l=!1,c=-1;if(t&&i&&i.v7_partialHydration)for(let u=0;u=0?a=a.slice(0,c+1):a=[a[0]];break}}}return a.reduceRight((u,h,d)=>{let f,m=!1,p=null,_=null;t&&(f=o&&h.route.id?o[h.route.id]:void 0,p=h.route.errorElement||O1e,l&&(c<0&&d===0?(G1e("route-fallback"),m=!0,_=null):c===d&&(m=!0,_=h.route.hydrateFallbackElement||null)));let v=e.concat(a.slice(0,d+1)),x=()=>{let S;return f?S=p:m?S=_:h.route.Component?S=Te.createElement(h.route.Component,null):h.route.element?S=h.route.element:S=u,Te.createElement(N1e,{match:h,routeContext:{outlet:u,matches:v,isDataRoute:t!=null},children:S})};return t&&(h.route.ErrorBoundary||h.route.errorElement||d===0)?Te.createElement(w1e,{location:t.location,revalidation:t.revalidation,component:p,error:f,children:x(),routeContext:{outlet:null,matches:v,isDataRoute:!0}}):x()},null)}var Lpe=(function(s){return s.UseBlocker="useBlocker",s.UseRevalidator="useRevalidator",s.UseNavigateStable="useNavigate",s})(Lpe||{}),Fpe=(function(s){return s.UseBlocker="useBlocker",s.UseLoaderData="useLoaderData",s.UseActionData="useActionData",s.UseRouteError="useRouteError",s.UseNavigation="useNavigation",s.UseRouteLoaderData="useRouteLoaderData",s.UseMatches="useMatches",s.UseRevalidator="useRevalidator",s.UseNavigateStable="useNavigate",s.UseRouteId="useRouteId",s})(Fpe||{});function F1e(s){let e=Te.useContext(HO);return e||il(!1),e}function B1e(s){let e=Te.useContext(Ope);return e||il(!1),e}function k1e(s){let e=Te.useContext(xg);return e||il(!1),e}function Bpe(s){let e=k1e(),t=e.matches[e.matches.length-1];return t.route.id||il(!1),t.route.id}function V1e(){var s;let e=Te.useContext(wpe),t=B1e(),i=Bpe();return e!==void 0?e:(s=t.errors)==null?void 0:s[i]}function U1e(){let{router:s}=F1e(Lpe.UseNavigateStable),e=Bpe(Fpe.UseNavigateStable),t=Te.useRef(!1);return Npe(()=>{t.current=!0}),Te.useCallback(function(r,n){n===void 0&&(n={}),t.current&&(typeof r=="number"?s.navigate(r):s.navigate(r,UR({fromRouteId:e},n)))},[s,e])}const R8={};function G1e(s,e,t){R8[s]||(R8[s]=!0)}function z1e(s,e){s==null||s.v7_startTransition,s==null||s.v7_relativeSplatPath}function I8(s){let{to:e,replace:t,state:i,relative:r}=s;G0()||il(!1);let{future:n,static:a}=Te.useContext(zv),{matches:o}=Te.useContext(xg),{pathname:l}=zS(),c=Qm(),u=L5(e,N5(o,n.v7_relativeSplatPath),l,r==="path"),h=JSON.stringify(u);return Te.useEffect(()=>c(JSON.parse(h),{replace:t,state:i,relative:r}),[c,h,r,t,i]),null}function W1e(s){return A1e(s.context)}function Ea(s){il(!1)}function H1e(s){let{basename:e="/",children:t=null,location:i,navigationType:r=cS.Pop,navigator:n,static:a=!1,future:o}=s;G0()&&il(!1);let l=e.replace(/^\/*/,"/"),c=Te.useMemo(()=>({basename:l,navigator:n,static:a,future:UR({v7_relativeSplatPath:!1},o)}),[l,o,n,a]);typeof i=="string"&&(i=U0(i));let{pathname:u="/",search:h="",hash:d="",state:f=null,key:m="default"}=i,p=Te.useMemo(()=>{let _=f0(u,l);return _==null?null:{location:{pathname:_,search:h,hash:d,state:f,key:m},navigationType:r}},[l,u,h,d,f,m,r]);return p==null?null:Te.createElement(zv.Provider,{value:c},Te.createElement($I.Provider,{children:t,value:p}))}function j1e(s){let{children:e,location:t}=s;return P1e(UF(e),t)}new Promise(()=>{});function UF(s,e){e===void 0&&(e=[]);let t=[];return Te.Children.forEach(s,(i,r)=>{if(!Te.isValidElement(i))return;let n=[...e,r];if(i.type===Te.Fragment){t.push.apply(t,UF(i.props.children,n));return}i.type!==Ea&&il(!1),!i.props.index||!i.props.children||il(!1);let a={id:i.props.id||n.join("-"),caseSensitive:i.props.caseSensitive,element:i.props.element,Component:i.props.Component,index:i.props.index,path:i.props.path,loader:i.props.loader,action:i.props.action,errorElement:i.props.errorElement,ErrorBoundary:i.props.ErrorBoundary,hasErrorBoundary:i.props.ErrorBoundary!=null||i.props.errorElement!=null,shouldRevalidate:i.props.shouldRevalidate,handle:i.props.handle,lazy:i.props.lazy};i.props.children&&(a.children=UF(i.props.children,n)),t.push(a)}),t}/**
000060: * React Router DOM v6.30.4
000061: *
000062: * Copyright (c) Remix Software Inc.
LISTENER CONTEXT 56-80
000056: * LICENSE.md file in the root directory of this source tree.
000057: *
000058: * @license MIT
000059: */function UR(){return UR=Object.assign?Object.assign.bind():function(s){for(var e=1;e{o.current=!0}),Te.useCallback(function(c,u){if(u===void 0&&(u={}),!o.current)return;if(typeof c=="number"){i.go(c);return}let h=L5(c,JSON.parse(a),n,u.relative==="path");s==null&&e!=="/"&&(h.pathname=h.pathname==="/"?e:TS([e,h.pathname])),(u.replace?i.replace:i.push)(h,u.state,u)},[e,i,a,n,s])}const I1e=Te.createContext(null);function A1e(s){let e=Te.useContext(xg).outlet;return e&&Te.createElement(I1e.Provider,{value:s},e)}function Wv(){let{matches:s}=Te.useContext(xg),e=s[s.length-1];return e?e.params:{}}function jO(s,e){let{relative:t}=e===void 0?{}:e,{future:i}=Te.useContext(zv),{matches:r}=Te.useContext(xg),{pathname:n}=zS(),a=JSON.stringify(N5(r,i.v7_relativeSplatPath));return Te.useMemo(()=>L5(s,JSON.parse(a),n,t==="path"),[s,a,n,t])}function P1e(s,e){return M1e(s,e)}function M1e(s,e,t,i){G0()||il(!1);let{navigator:r}=Te.useContext(zv),{matches:n}=Te.useContext(xg),a=n[n.length-1],o=a?a.params:{};a&&a.pathname;let l=a?a.pathnameBase:"/";a&&a.route;let c=zS(),u;if(e){var h;let _=typeof e=="string"?U0(e):e;l==="/"||(h=_.pathname)!=null&&h.startsWith(l)||il(!1),u=_}else u=c;let d=u.pathname||"/",f=d;if(l!=="/"){let _=l.replace(/^\//,"").split("/");f="/"+d.replace(/^\//,"").split("/").slice(_.length).join("/")}let m=t1e(s,{pathname:f}),p=L1e(m&&m.map(_=>Object.assign({},_,{params:Object.assign({},o,_.params),pathname:TS([l,r.encodeLocation?r.encodeLocation(_.pathname).pathname:_.pathname]),pathnameBase:_.pathnameBase==="/"?l:TS([l,r.encodeLocation?r.encodeLocation(_.pathnameBase).pathname:_.pathnameBase])})),n,t,i);return e&&p?Te.createElement($I.Provider,{value:{location:UR({pathname:"/",search:"",hash:"",state:null,key:"default"},u),navigationType:cS.Pop}},p):p}function D1e(){let s=V1e(),e=T1e(s)?s.status+" "+s.statusText:s instanceof Error?s.message:JSON.stringify(s),t=s instanceof Error?s.stack:null,r={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return Te.createElement(Te.Fragment,null,Te.createElement("h2",null,"Unexpected Application Error!"),Te.createElement("h3",{style:{fontStyle:"italic"}},e),t?Te.createElement("pre",{style:r},t):null,null)}const O1e=Te.createElement(D1e,null);class w1e extends Te.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:t.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){console.error("React Router caught the following error during render",e,t)}render(){return this.state.error!==void 0?Te.createElement(xg.Provider,{value:this.props.routeContext},Te.createElement(wpe.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function N1e(s){let{routeContext:e,match:t,children:i}=s,r=Te.useContext(HO);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),Te.createElement(xg.Provider,{value:e},i)}function L1e(s,e,t,i){var r;if(e===void 0&&(e=[]),t===void 0&&(t=null),i===void 0&&(i=null),s==null){var n;if(!t)return null;if(t.errors)s=t.matches;else if((n=i)!=null&&n.v7_partialHydration&&e.length===0&&!t.initialized&&t.matches.length>0)s=t.matches;else return null}let a=s,o=(r=t)==null?void 0:r.errors;if(o!=null){let u=a.findIndex(h=>h.route.id&&(o==null?void 0:o[h.route.id])!==void 0);u>=0||il(!1),a=a.slice(0,Math.min(a.length,u+1))}let l=!1,c=-1;if(t&&i&&i.v7_partialHydration)for(let u=0;u=0?a=a.slice(0,c+1):a=[a[0]];break}}}return a.reduceRight((u,h,d)=>{let f,m=!1,p=null,_=null;t&&(f=o&&h.route.id?o[h.route.id]:void 0,p=h.route.errorElement||O1e,l&&(c<0&&d===0?(G1e("route-fallback"),m=!0,_=null):c===d&&(m=!0,_=h.route.hydrateFallbackElement||null)));let v=e.concat(a.slice(0,d+1)),x=()=>{let S;return f?S=p:m?S=_:h.route.Component?S=Te.createElement(h.route.Component,null):h.route.element?S=h.route.element:S=u,Te.createElement(N1e,{match:h,routeContext:{outlet:u,matches:v,isDataRoute:t!=null},children:S})};return t&&(h.route.ErrorBoundary||h.route.errorElement||d===0)?Te.createElement(w1e,{location:t.location,revalidation:t.revalidation,component:p,error:f,children:x(),routeContext:{outlet:null,matches:v,isDataRoute:!0}}):x()},null)}var Lpe=(function(s){return s.UseBlocker="useBlocker",s.UseRevalidator="useRevalidator",s.UseNavigateStable="useNavigate",s})(Lpe||{}),Fpe=(function(s){return s.UseBlocker="useBlocker",s.UseLoaderData="useLoaderData",s.UseActionData="useActionData",s.UseRouteError="useRouteError",s.UseNavigation="useNavigation",s.UseRouteLoaderData="useRouteLoaderData",s.UseMatches="useMatches",s.UseRevalidator="useRevalidator",s.UseNavigateStable="useNavigate",s.UseRouteId="useRouteId",s})(Fpe||{});function F1e(s){let e=Te.useContext(HO);return e||il(!1),e}function B1e(s){let e=Te.useContext(Ope);return e||il(!1),e}function k1e(s){let e=Te.useContext(xg);return e||il(!1),e}function Bpe(s){let e=k1e(),t=e.matches[e.matches.length-1];return t.route.id||il(!1),t.route.id}function V1e(){var s;let e=Te.useContext(wpe),t=B1e(),i=Bpe();return e!==void 0?e:(s=t.errors)==null?void 0:s[i]}function U1e(){let{router:s}=F1e(Lpe.UseNavigateStable),e=Bpe(Fpe.UseNavigateStable),t=Te.useRef(!1);return Npe(()=>{t.current=!0}),Te.useCallback(function(r,n){n===void 0&&(n={}),t.current&&(typeof r=="number"?s.navigate(r):s.navigate(r,UR({fromRouteId:e},n)))},[s,e])}const R8={};function G1e(s,e,t){R8[s]||(R8[s]=!0)}function z1e(s,e){s==null||s.v7_startTransition,s==null||s.v7_relativeSplatPath}function I8(s){let{to:e,replace:t,state:i,relative:r}=s;G0()||il(!1);let{future:n,static:a}=Te.useContext(zv),{matches:o}=Te.useContext(xg),{pathname:l}=zS(),c=Qm(),u=L5(e,N5(o,n.v7_relativeSplatPath),l,r==="path"),h=JSON.stringify(u);return Te.useEffect(()=>c(JSON.parse(h),{replace:t,state:i,relative:r}),[c,h,r,t,i]),null}function W1e(s){return A1e(s.context)}function Ea(s){il(!1)}function H1e(s){let{basename:e="/",children:t=null,location:i,navigationType:r=cS.Pop,navigator:n,static:a=!1,future:o}=s;G0()&&il(!1);let l=e.replace(/^\/*/,"/"),c=Te.useMemo(()=>({basename:l,navigator:n,static:a,future:UR({v7_relativeSplatPath:!1},o)}),[l,o,n,a]);typeof i=="string"&&(i=U0(i));let{pathname:u="/",search:h="",hash:d="",state:f=null,key:m="default"}=i,p=Te.useMemo(()=>{let _=f0(u,l);return _==null?null:{location:{pathname:_,search:h,hash:d,state:f,key:m},navigationType:r}},[l,u,h,d,f,m,r]);return p==null?null:Te.createElement(zv.Provider,{value:c},Te.createElement($I.Provider,{children:t,value:p}))}function j1e(s){let{children:e,location:t}=s;return P1e(UF(e),t)}new Promise(()=>{});function UF(s,e){e===void 0&&(e=[]);let t=[];return Te.Children.forEach(s,(i,r)=>{if(!Te.isValidElement(i))return;let n=[...e,r];if(i.type===Te.Fragment){t.push.apply(t,UF(i.props.children,n));return}i.type!==Ea&&il(!1),!i.props.index||!i.props.children||il(!1);let a={id:i.props.id||n.join("-"),caseSensitive:i.props.caseSensitive,element:i.props.element,Component:i.props.Component,index:i.props.index,path:i.props.path,loader:i.props.loader,action:i.props.action,errorElement:i.props.errorElement,ErrorBoundary:i.props.ErrorBoundary,hasErrorBoundary:i.props.ErrorBoundary!=null||i.props.errorElement!=null,shouldRevalidate:i.props.shouldRevalidate,handle:i.props.handle,lazy:i.props.lazy};i.props.children&&(a.children=UF(i.props.children,n)),t.push(a)}),t}/**
000060: * React Router DOM v6.30.4
000061: *
000062: * Copyright (c) Remix Software Inc.
000063: *
000064: * This source code is licensed under the MIT license found in the
000065: * LICENSE.md file in the root directory of this source tree.
000066: *
000067: * @license MIT
000068: */function YD(){return YD=Object.assign?Object.assign.bind():function(s){for(var e=1;e{let i=s[t];return e.concat(Array.isArray(i)?i.map(r=>[t,r]):[[t,i]])},[]))}function Y1e(s,e){let t=GF(s);return e&&e.forEach((i,r)=>{t.has(r)||e.getAll(r).forEach(n=>{t.append(r,n)})}),t}const q1e=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],Z1e=["aria-current","caseSensitive","className","end","style","to","viewTransition","children"],K1e="6";try{window.__reactRouterVersion=K1e}catch{}const Q1e=Te.createContext({isTransitioning:!1}),J1e="startTransition",A8=jNe[J1e];function eLe(s){let{basename:e,children:t,future:i,window:r}=s,n=Te.useRef();n.current==null&&(n.current=QNe({window:r,v5Compat:!0}));let a=n.current,[o,l]=Te.useState({action:a.action,location:a.location}),{v7_startTransition:c}=i||{},u=Te.useCallback(h=>{c&&A8?A8(()=>l(h)):l(h)},[l,c]);return Te.useLayoutEffect(()=>a.listen(u),[a,u]),Te.useEffect(()=>z1e(i),[i]),Te.createElement(H1e,{basename:e,children:t,location:o.location,navigationType:o.action,navigator:a,future:i})}const tLe=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",iLe=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Ar=Te.forwardRef(function(e,t){let{onClick:i,relative:r,reloadDocument:n,replace:a,state:o,target:l,to:c,preventScrollReset:u,viewTransition:h}=e,d=kpe(e,q1e),{basename:f}=Te.useContext(zv),m,p=!1;if(typeof c=="string"&&iLe.test(c)&&(m=c,tLe))try{let S=new URL(window.location.href),b=c.startsWith("//")?new URL(S.protocol+c):new URL(c),y=f0(b.pathname,f);b.origin===S.origin&&y!=null?c=y+b.search+b.hash:p=!0}catch{}let _=E1e(c,{relative:r}),v=nLe(c,{replace:a,state:o,target:l,preventScrollReset:u,relative:r,viewTransition:h});function x(S){i&&i(S),S.defaultPrevented||v(S)}return Te.createElement("a",YD({},d,{href:m||_,onClick:p||n?i:x,ref:t,target:l}))}),rLe=Te.forwardRef(function(e,t){let{"aria-current":i="page",caseSensitive:r=!1,className:n="",end:a=!1,style:o,to:l,viewTransition:c,children:u}=e,h=kpe(e,Z1e),d=jO(l,{relative:h.relative}),f=zS(),m=Te.useContext(Ope),{navigator:p,basename:_}=Te.useContext(zv),v=m!=null&&oLe(d)&&c===!0,x=p.encodeLocation?p.encodeLocation(d).pathname:d.pathname,S=f.pathname,b=m&&m.navigation&&m.navigation.location?m.navigation.location.pathname:null;r||(S=S.toLowerCase(),b=b?b.toLowerCase():null,x=x.toLowerCase()),b&&_&&(b=f0(b,_)||b);const y=x!=="/"&&x.endsWith("/")?x.length-1:x.length;let I=S===x||!a&&S.startsWith(x)&&S.charAt(y)==="/",R=b!=null&&(b===x||!a&&b.startsWith(x)&&b.charAt(x.length)==="/"),A={isActive:I,isPending:R,isTransitioning:v},P=I?i:void 0,w;typeof n=="function"?w=n(A):w=[n,I?"active":null,R?"pending":null,v?"transitioning":null].filter(Boolean).join(" ");let L=typeof o=="function"?o(A):o;return Te.createElement(Ar,YD({},h,{"aria-current":P,className:w,ref:t,style:L,to:l,viewTransition:c}),typeof u=="function"?u(A):u)});var zF;(function(s){s.UseScrollRestoration="useScrollRestoration",s.UseSubmit="useSubmit",s.UseSubmitFetcher="useSubmitFetcher",s.UseFetcher="useFetcher",s.useViewTransitionState="useViewTransitionState"})(zF||(zF={}));var P8;(function(s){s.UseFetcher="useFetcher",s.UseFetchers="useFetchers",s.UseScrollRestoration="useScrollRestoration"})(P8||(P8={}));function sLe(s){let e=Te.useContext(HO);return e||il(!1),e}function nLe(s,e){let{target:t,replace:i,state:r,preventScrollReset:n,relative:a,viewTransition:o}=e===void 0?{}:e,l=Qm(),c=zS(),u=jO(s,{relative:a});return Te.useCallback(h=>{if($1e(h,t)){h.preventDefault();let d=i!==void 0?i:$D(c)===$D(u);l(s,{replace:d,state:r,preventScrollReset:n,relative:a,viewTransition:o})}},[c,l,u,i,r,t,s,n,a,o])}function aLe(s){let e=Te.useRef(GF(s)),t=Te.useRef(!1),i=zS(),r=Te.useMemo(()=>Y1e(i.search,t.current?null:e.current),[i.search]),n=Qm(),a=Te.useCallback((o,l)=>{const c=GF(typeof o=="function"?o(r):o);t.current=!0,n("?"+c,l)},[n,r]);return[r,a]}function oLe(s,e){e===void 0&&(e={});let t=Te.useContext(Q1e);t==null&&il(!1);let{basename:i}=sLe(zF.useViewTransitionState),r=jO(s,{relative:e.relative});if(!t.isTransitioning)return!1;let n=f0(t.currentLocation.pathname,i)||t.currentLocation.pathname,a=f0(t.nextLocation.pathname,i)||t.nextLocation.pathname;return VF(r.pathname,a)!=null||VF(r.pathname,n)!=null}var XO=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(s){return this.listeners.add(s),this.onSubscribe(),()=>{this.listeners.delete(s),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},lLe={setTimeout:(s,e)=>setTimeout(s,e),clearTimeout:s=>clearTimeout(s),setInterval:(s,e)=>setInterval(s,e),clearInterval:s=>clearInterval(s)},rS,D5,gpe,cLe=(gpe=class{constructor(){Sn(this,rS,lLe);Sn(this,D5,!1)}setTimeoutProvider(s){xs(this,rS,s)}setTimeout(s,e){return ui(this,rS).setTimeout(s,e)}clearTimeout(s){ui(this,rS).clearTimeout(s)}setInterval(s,e){return ui(this,rS).setInterval(s,e)}clearInterval(s){ui(this,rS).clearInterval(s)}},rS=new WeakMap,D5=new WeakMap,gpe),WF=new cLe;function uLe(s){setTimeout(s,0)}var $O=typeof window>"u"||"Deno"in globalThis;function Im(){}function hLe(s,e){return typeof s=="function"?s(e):s}function dLe(s){return typeof s=="number"&&s>=0&&s!==1/0}function fLe(s,e){return Math.max(s+(e||0)-Date.now(),0)}function HF(s,e){return typeof s=="function"?s(e):s}function pLe(s,e){return typeof s=="function"?s(e):s}function M8(s,e){const{type:t="all",exact:i,fetchStatus:r,predicate:n,queryKey:a,stale:o}=s;if(a){if(i){if(e.queryHash!==F5(a,e.options))return!1}else if(!zR(e.queryKey,a))return!1}if(t!=="all"){const l=e.isActive();if(t==="active"&&!l||t==="inactive"&&l)return!1}return!(typeof o=="boolean"&&e.isStale()!==o||r&&r!==e.state.fetchStatus||n&&!n(e))}function D8(s,e){const{exact:t,status:i,predicate:r,mutationKey:n}=s;if(n){if(!e.options.mutationKey)return!1;if(t){if(GR(e.options.mutationKey)!==GR(n))return!1}else if(!zR(e.options.mutationKey,n))return!1}return!(i&&e.state.status!==i||r&&!r(e))}function F5(s,e){return((e==null?void 0:e.queryKeyHashFn)||GR)(s)}function GR(s){return JSON.stringify(s,(e,t)=>jF(t)?Object.keys(t).sort().reduce((i,r)=>(i[r]=t[r],i),{}):t)}function zR(s,e){return s===e?!0:typeof s!=typeof e?!1:s&&e&&typeof s=="object"&&typeof e=="object"?Object.keys(e).every(t=>zR(s[t],e[t])):!1}var mLe=Object.prototype.hasOwnProperty;function Vpe(s,e,t=0){if(s===e)return s;if(t>500)return e;const i=O8(s)&&O8(e);if(!i&&!(jF(s)&&jF(e)))return e;const n=(i?s:Object.keys(s)).length,a=i?e:Object.keys(e),o=a.length,l=i?new Array(o):{};let c=0;for(let u=0;u{WF.setTimeout(e,s)})}function gLe(s,e,t){return typeof t.structuralSharing=="function"?t.structuralSharing(s,e):t.structuralSharing!==!1?Vpe(s,e):e}function vLe(s,e,t=0){const i=[...s,e];return t&&i.length>t?i.slice(1):i}function xLe(s,e,t=0){const i=[e,...s];return t&&i.length>t?i.slice(0,-1):i}var B5=Symbol();function Upe(s,e){return!s.queryFn&&(e!=null&&e.initialPromise)?()=>e.initialPromise:!s.queryFn||s.queryFn===B5?()=>Promise.reject(new Error(`Missing queryFn: '${s.queryHash}'`)):s.queryFn}function SLe(s,e,t){let i=!1,r;return Object.defineProperty(s,"signal",{enumerable:!0,get:()=>(r??(r=e()),i||(i=!0,r.aborted?t():r.addEventListener("abort",t,{once:!0})),r)}),s}var TT,sS,n0,vpe,bLe=(vpe=class extends XO{constructor(){super();Sn(this,TT);Sn(this,sS);Sn(this,n0);xs(this,n0,e=>{if(!$O&&window.addEventListener){const t=()=>e();return window.addEventListener("visibilitychange",t,!1),()=>{window.removeEventListener("visibilitychange",t)}}})}onSubscribe(){ui(this,sS)||this.setEventListener(ui(this,n0))}onUnsubscribe(){var e;this.hasListeners()||((e=ui(this,sS))==null||e.call(this),xs(this,sS,void 0))}setEventListener(e){var t;xs(this,n0,e),(t=ui(this,sS))==null||t.call(this),xs(this,sS,e(i=>{typeof i=="boolean"?this.setFocused(i):this.onFocus()}))}setFocused(e){ui(this,TT)!==e&&(xs(this,TT,e),this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){var e;return typeof ui(this,TT)=="boolean"?ui(this,TT):((e=globalThis.document)==null?void 0:e.visibilityState)!=="hidden"}},TT=new WeakMap,sS=new WeakMap,n0=new WeakMap,vpe),Gpe=new bLe;function TLe(){let s,e;const t=new Promise((r,n)=>{s=r,e=n});t.status="pending",t.catch(()=>{});function i(r){Object.assign(t,r),delete t.resolve,delete t.reject}return t.resolve=r=>{i({status:"fulfilled",value:r}),s(r)},t.reject=r=>{i({status:"rejected",reason:r}),e(r)},t}var yLe=uLe;function ELe(){let s=[],e=0,t=o=>{o()},i=o=>{o()},r=yLe;const n=o=>{e?s.push(o):r(()=>{t(o)})},a=()=>{const o=s;s=[],o.length&&r(()=>{i(()=>{o.forEach(l=>{t(l)})})})};return{batch:o=>{let l;e++;try{l=o()}finally{e--,e||a()}return l},batchCalls:o=>(...l)=>{n(()=>{o(...l)})},schedule:n,setNotifyFunction:o=>{t=o},setBatchNotifyFunction:o=>{i=o},setScheduler:o=>{r=o}}}var ed=ELe(),a0,nS,o0,xpe,CLe=(xpe=class extends XO{constructor(){super();Sn(this,a0,!0);Sn(this,nS);Sn(this,o0);xs(this,o0,e=>{if(!$O&&window.addEventListener){const t=()=>e(!0),i=()=>e(!1);return window.addEventListener("online",t,!1),window.addEventListener("offline",i,!1),()=>{window.removeEventListener("online",t),window.removeEventListener("offline",i)}}})}onSubscribe(){ui(this,nS)||this.setEventListener(ui(this,o0))}onUnsubscribe(){var e;this.hasListeners()||((e=ui(this,nS))==null||e.call(this),xs(this,nS,void 0))}setEventListener(e){var t;xs(this,o0,e),(t=ui(this,nS))==null||t.call(this),xs(this,nS,e(this.setOnline.bind(this)))}setOnline(e){ui(this,a0)!==e&&(xs(this,a0,e),this.listeners.forEach(i=>{i(e)}))}isOnline(){return ui(this,a0)}},a0=new WeakMap,nS=new WeakMap,o0=new WeakMap,xpe),qD=new CLe;function RLe(s){return Math.min(1e3*2**s,3e4)}function zpe(s){return(s??"online")==="online"?qD.isOnline():!0}var XF=class extends Error{constructor(s){super("CancelledError"),this.revert=s==null?void 0:s.revert,this.silent=s==null?void 0:s.silent}};function Wpe(s){let e=!1,t=0,i;const r=TLe(),n=()=>r.status!=="pending",a=p=>{var _;if(!n()){const v=new XF(p);d(v),(_=s.onCancel)==null||_.call(s,v)}},o=()=>{e=!0},l=()=>{e=!1},c=()=>Gpe.isFocused()&&(s.networkMode==="always"||qD.isOnline())&&s.canRun(),u=()=>zpe(s.networkMode)&&s.canRun(),h=p=>{n()||(i==null||i(),r.resolve(p))},d=p=>{n()||(i==null||i(),r.reject(p))},f=()=>new Promise(p=>{var _;i=v=>{(n()||c())&&p(v)},(_=s.onPause)==null||_.call(s)}).then(()=>{var p;i=void 0,n()||(p=s.onContinue)==null||p.call(s)}),m=()=>{if(n())return;let p;const _=t===0?s.initialPromise:void 0;try{p=_??s.fn()}catch(v){p=Promise.reject(v)}Promise.resolve(p).then(h).catch(v=>{var I;if(n())return;const x=s.retry??($O?0:3),S=s.retryDelay??RLe,b=typeof S=="function"?S(t,v):S,y=x===!0||typeof x=="number"&&tc()?void 0:f()).then(()=>{e?d(v):m()})})};return{promise:r,status:()=>r.status,cancel:a,continue:()=>(i==null||i(),r),cancelRetry:o,continueRetry:l,canStart:u,start:()=>(u()?m():f().then(m),r)}}var yT,Spe,Hpe=(Spe=class{constructor(){Sn(this,yT)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),dLe(this.gcTime)&&xs(this,yT,WF.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(s){this.gcTime=Math.max(this.gcTime||0,s??($O?1/0:300*1e3))}clearGcTimeout(){ui(this,yT)&&(WF.clearTimeout(ui(this,yT)),xs(this,yT,void 0))}},yT=new WeakMap,Spe),ET,l0,Np,CT,tu,HI,RT,Dm,nv,bpe,ILe=(bpe=class extends Hpe{constructor(e){super();Sn(this,Dm);Sn(this,ET);Sn(this,l0);Sn(this,Np);Sn(this,CT);Sn(this,tu);Sn(this,HI);Sn(this,RT);xs(this,RT,!1),xs(this,HI,e.defaultOptions),this.setOptions(e.options),this.observers=[],xs(this,CT,e.client),xs(this,Np,ui(this,CT).getQueryCache()),this.queryKey=e.queryKey,this.queryHash=e.queryHash,xs(this,ET,L8(this.options)),this.state=e.state??ui(this,ET),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var e;return(e=ui(this,tu))==null?void 0:e.promise}setOptions(e){if(this.options={...ui(this,HI),...e},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const t=L8(this.options);t.data!==void 0&&(this.setState(N8(t.data,t.dataUpdatedAt)),xs(this,ET,t))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&ui(this,Np).remove(this)}setData(e,t){const i=gLe(this.state.data,e,this.options);return Zu(this,Dm,nv).call(this,{data:i,type:"success",dataUpdatedAt:t==null?void 0:t.updatedAt,manual:t==null?void 0:t.manual}),i}setState(e,t){Zu(this,Dm,nv).call(this,{type:"setState",state:e,setStateOptions:t})}cancel(e){var i,r;const t=(i=ui(this,tu))==null?void 0:i.promise;return(r=ui(this,tu))==null||r.cancel(e),t?t.then(Im).catch(Im):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(ui(this,ET))}isActive(){return this.observers.some(e=>pLe(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===B5||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>HF(e.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e==="static"?!1:this.state.isInvalidated?!0:!fLe(this.state.dataUpdatedAt,e)}onFocus(){var t;const e=this.observers.find(i=>i.shouldFetchOnWindowFocus());e==null||e.refetch({cancelRefetch:!1}),(t=ui(this,tu))==null||t.continue()}onOnline(){var t;const e=this.observers.find(i=>i.shouldFetchOnReconnect());e==null||e.refetch({cancelRefetch:!1}),(t=ui(this,tu))==null||t.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),ui(this,Np).notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(ui(this,tu)&&(ui(this,RT)?ui(this,tu).cancel({revert:!0}):ui(this,tu).cancelRetry()),this.scheduleGc()),ui(this,Np).notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||Zu(this,Dm,nv).call(this,{type:"invalidate"})}async fetch(e,t){var l,c,u,h,d,f,m,p,_,v,x,S;if(this.state.fetchStatus!=="idle"&&((l=ui(this,tu))==null?void 0:l.status())!=="rejected"){if(this.state.data!==void 0&&(t!=null&&t.cancelRefetch))this.cancel({silent:!0});else if(ui(this,tu))return ui(this,tu).continueRetry(),ui(this,tu).promise}if(e&&this.setOptions(e),!this.options.queryFn){const b=this.observers.find(y=>y.options.queryFn);b&&this.setOptions(b.options)}const i=new AbortController,r=b=>{Object.defineProperty(b,"signal",{enumerable:!0,get:()=>(xs(this,RT,!0),i.signal)})},n=()=>{const b=Upe(this.options,t),I=(()=>{const R={client:ui(this,CT),queryKey:this.queryKey,meta:this.meta};return r(R),R})();return xs(this,RT,!1),this.options.persister?this.options.persister(b,I,this):b(I)},o=(()=>{const b={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:ui(this,CT),state:this.state,fetchFn:n};return r(b),b})();(c=this.options.behavior)==null||c.onFetch(o,this),xs(this,l0,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((u=o.fetchOptions)==null?void 0:u.meta))&&Zu(this,Dm,nv).call(this,{type:"fetch",meta:(h=o.fetchOptions)==null?void 0:h.meta}),xs(this,tu,Wpe({initialPromise:t==null?void 0:t.initialPromise,fn:o.fetchFn,onCancel:b=>{b instanceof XF&&b.revert&&this.setState({...ui(this,l0),fetchStatus:"idle"}),i.abort()},onFail:(b,y)=>{Zu(this,Dm,nv).call(this,{type:"failed",failureCount:b,error:y})},onPause:()=>{Zu(this,Dm,nv).call(this,{type:"pause"})},onContinue:()=>{Zu(this,Dm,nv).call(this,{type:"continue"})},retry:o.options.retry,retryDelay:o.options.retryDelay,networkMode:o.options.networkMode,canRun:()=>!0}));try{const b=await ui(this,tu).start();if(b===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(b),(f=(d=ui(this,Np).config).onSuccess)==null||f.call(d,b,this),(p=(m=ui(this,Np).config).onSettled)==null||p.call(m,b,this.state.error,this),b}catch(b){if(b instanceof XF){if(b.silent)return ui(this,tu).promise;if(b.revert){if(this.state.data===void 0)throw b;return this.state.data}}throw Zu(this,Dm,nv).call(this,{type:"error",error:b}),(v=(_=ui(this,Np).config).onError)==null||v.call(_,b,this),(S=(x=ui(this,Np).config).onSettled)==null||S.call(x,this.state.data,b,this),b}finally{this.scheduleGc()}}},ET=new WeakMap,l0=new WeakMap,Np=new WeakMap,CT=new WeakMap,tu=new WeakMap,HI=new WeakMap,RT=new WeakMap,Dm=new WeakSet,nv=function(e){const t=i=>{switch(e.type){case"failed":return{...i,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...i,fetchStatus:"paused"};case"continue":return{...i,fetchStatus:"fetching"};case"fetch":return{...i,...ALe(i.data,this.options),fetchMeta:e.meta??null};case"success":const r={...i,...N8(e.data,e.dataUpdatedAt),dataUpdateCount:i.dataUpdateCount+1,...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return xs(this,l0,e.manual?r:void 0),r;case"error":const n=e.error;return{...i,error:n,errorUpdateCount:i.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:i.fetchFailureCount+1,fetchFailureReason:n,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...i,isInvalidated:!0};case"setState":return{...i,...e.state}}};this.state=t(this.state),ed.batch(()=>{this.observers.forEach(i=>{i.onQueryUpdate()}),ui(this,Np).notify({query:this,type:"updated",action:e})})},bpe);function ALe(s,e){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:zpe(e.networkMode)?"fetching":"paused",...s===void 0&&{error:null,status:"pending"}}}function N8(s,e){return{data:s,dataUpdatedAt:e??Date.now(),error:null,isInvalidated:!1,status:"success"}}function L8(s){const e=typeof s.initialData=="function"?s.initialData():s.initialData,t=e!==void 0,i=t?typeof s.initialDataUpdatedAt=="function"?s.initialDataUpdatedAt():s.initialDataUpdatedAt:0;return{data:e,dataUpdateCount:0,dataUpdatedAt:t?i??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:t?"success":"pending",fetchStatus:"idle"}}function F8(s){return{onFetch:(e,t)=>{var u,h,d,f,m;const i=e.options,r=(d=(h=(u=e.fetchOptions)==null?void 0:u.meta)==null?void 0:h.fetchMore)==null?void 0:d.direction,n=((f=e.state.data)==null?void 0:f.pages)||[],a=((m=e.state.data)==null?void 0:m.pageParams)||[];let o={pages:[],pageParams:[]},l=0;const c=async()=>{let p=!1;const _=S=>{SLe(S,()=>e.signal,()=>p=!0)},v=Upe(e.options,e.fetchOptions),x=async(S,b,y)=>{if(p)return Promise.reject();if(b==null&&S.pages.length)return Promise.resolve(S);const R=(()=>{const L={client:e.client,queryKey:e.queryKey,pageParam:b,direction:y?"backward":"forward",meta:e.options.meta};return _(L),L})(),A=await v(R),{maxPages:P}=e.options,w=y?xLe:vLe;return{pages:w(S.pages,A,P),pageParams:w(S.pageParams,b,P)}};if(r&&n.length){const S=r==="backward",b=S?PLe:B8,y={pages:n,pageParams:a},I=b(i,y);o=await x(y,I,S)}else{const S=s??n.length;do{const b=l===0?a[0]??i.initialPageParam:B8(i,o);if(l>0&&b==null)break;o=await x(o,b),l++}while(l{var p,_;return(_=(p=e.options).persister)==null?void 0:_.call(p,c,{client:e.client,queryKey:e.queryKey,meta:e.options.meta,signal:e.signal},t)}:e.fetchFn=c}}}function B8(s,{pages:e,pageParams:t}){const i=e.length-1;return e.length>0?s.getNextPageParam(e[i],e,t[i],t):void 0}function PLe(s,{pages:e,pageParams:t}){var i;return e.length>0?(i=s.getPreviousPageParam)==null?void 0:i.call(s,e[0],e,t[0],t):void 0}var jI,L_,rh,IT,F_,Hx,Tpe,MLe=(Tpe=class extends Hpe{constructor(e){super();Sn(this,F_);Sn(this,jI);Sn(this,L_);Sn(this,rh);Sn(this,IT);xs(this,jI,e.client),this.mutationId=e.mutationId,xs(this,rh,e.mutationCache),xs(this,L_,[]),this.state=e.state||DLe(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){ui(this,L_).includes(e)||(ui(this,L_).push(e),this.clearGcTimeout(),ui(this,rh).notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){xs(this,L_,ui(this,L_).filter(t=>t!==e)),this.scheduleGc(),ui(this,rh).notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){ui(this,L_).length||(this.state.status==="pending"?this.scheduleGc():ui(this,rh).remove(this))}continue(){var e;return((e=ui(this,IT))==null?void 0:e.continue())??this.execute(this.state.variables)}async execute(e){var a,o,l,c,u,h,d,f,m,p,_,v,x,S,b,y,I,R;const t=()=>{Zu(this,F_,Hx).call(this,{type:"continue"})},i={client:ui(this,jI),meta:this.options.meta,mutationKey:this.options.mutationKey};xs(this,IT,Wpe({fn:()=>this.options.mutationFn?this.options.mutationFn(e,i):Promise.reject(new Error("No mutationFn found")),onFail:(A,P)=>{Zu(this,F_,Hx).call(this,{type:"failed",failureCount:A,error:P})},onPause:()=>{Zu(this,F_,Hx).call(this,{type:"pause"})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>ui(this,rh).canRun(this)}));const r=this.state.status==="pending",n=!ui(this,IT).canStart();try{if(r)t();else{Zu(this,F_,Hx).call(this,{type:"pending",variables:e,isPaused:n}),ui(this,rh).config.onMutate&&await ui(this,rh).config.onMutate(e,this,i);const P=await((o=(a=this.options).onMutate)==null?void 0:o.call(a,e,i));P!==this.state.context&&Zu(this,F_,Hx).call(this,{type:"pending",context:P,variables:e,isPaused:n})}const A=await ui(this,IT).start();return await((c=(l=ui(this,rh).config).onSuccess)==null?void 0:c.call(l,A,e,this.state.context,this,i)),await((h=(u=this.options).onSuccess)==null?void 0:h.call(u,A,e,this.state.context,i)),await((f=(d=ui(this,rh).config).onSettled)==null?void 0:f.call(d,A,null,this.state.variables,this.state.context,this,i)),await((p=(m=this.options).onSettled)==null?void 0:p.call(m,A,null,e,this.state.context,i)),Zu(this,F_,Hx).call(this,{type:"success",data:A}),A}catch(A){try{await((v=(_=ui(this,rh).config).onError)==null?void 0:v.call(_,A,e,this.state.context,this,i))}catch(P){Promise.reject(P)}try{await((S=(x=this.options).onError)==null?void 0:S.call(x,A,e,this.state.context,i))}catch(P){Promise.reject(P)}try{await((y=(b=ui(this,rh).config).onSettled)==null?void 0:y.call(b,void 0,A,this.state.variables,this.state.context,this,i))}catch(P){Promise.reject(P)}try{await((R=(I=this.options).onSettled)==null?void 0:R.call(I,void 0,A,e,this.state.context,i))}catch(P){Promise.reject(P)}throw Zu(this,F_,Hx).call(this,{type:"error",error:A}),A}finally{ui(this,rh).runNext(this)}}},jI=new WeakMap,L_=new WeakMap,rh=new WeakMap,IT=new WeakMap,F_=new WeakSet,Hx=function(e){const t=i=>{switch(e.type){case"failed":return{...i,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...i,isPaused:!0};case"continue":return{...i,isPaused:!1};case"pending":return{...i,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...i,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...i,data:void 0,error:e.error,failureCount:i.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}};this.state=t(this.state),ed.batch(()=>{ui(this,L_).forEach(i=>{i.onMutationUpdate(e)}),ui(this,rh).notify({mutation:this,type:"updated",action:e})})},Tpe);function DLe(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var mv,Om,XI,ype,OLe=(ype=class extends XO{constructor(e={}){super();Sn(this,mv);Sn(this,Om);Sn(this,XI);this.config=e,xs(this,mv,new Set),xs(this,Om,new Map),xs(this,XI,0)}build(e,t,i){const r=new MLe({client:e,mutationCache:this,mutationId:++BP(this,XI)._,options:e.defaultMutationOptions(t),state:i});return this.add(r),r}add(e){ui(this,mv).add(e);const t=VP(e);if(typeof t=="string"){const i=ui(this,Om).get(t);i?i.push(e):ui(this,Om).set(t,[e])}this.notify({type:"added",mutation:e})}remove(e){if(ui(this,mv).delete(e)){const t=VP(e);if(typeof t=="string"){const i=ui(this,Om).get(t);if(i)if(i.length>1){const r=i.indexOf(e);r!==-1&&i.splice(r,1)}else i[0]===e&&ui(this,Om).delete(t)}}this.notify({type:"removed",mutation:e})}canRun(e){const t=VP(e);if(typeof t=="string"){const i=ui(this,Om).get(t),r=i==null?void 0:i.find(n=>n.state.status==="pending");return!r||r===e}else return!0}runNext(e){var i;const t=VP(e);if(typeof t=="string"){const r=(i=ui(this,Om).get(t))==null?void 0:i.find(n=>n!==e&&n.state.isPaused);return(r==null?void 0:r.continue())??Promise.resolve()}else return Promise.resolve()}clear(){ed.batch(()=>{ui(this,mv).forEach(e=>{this.notify({type:"removed",mutation:e})}),ui(this,mv).clear(),ui(this,Om).clear()})}getAll(){return Array.from(ui(this,mv))}find(e){const t={exact:!0,...e};return this.getAll().find(i=>D8(t,i))}findAll(e={}){return this.getAll().filter(t=>D8(e,t))}notify(e){ed.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){const e=this.getAll().filter(t=>t.state.isPaused);return ed.batch(()=>Promise.all(e.map(t=>t.continue().catch(Im))))}},mv=new WeakMap,Om=new WeakMap,XI=new WeakMap,ype);function VP(s){var e;return(e=s.options.scope)==null?void 0:e.id}var B_,Epe,wLe=(Epe=class extends XO{constructor(e={}){super();Sn(this,B_);this.config=e,xs(this,B_,new Map)}build(e,t,i){const r=t.queryKey,n=t.queryHash??F5(r,t);let a=this.get(n);return a||(a=new ILe({client:e,queryKey:r,queryHash:n,options:e.defaultQueryOptions(t),state:i,defaultOptions:e.getQueryDefaults(r)}),this.add(a)),a}add(e){ui(this,B_).has(e.queryHash)||(ui(this,B_).set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const t=ui(this,B_).get(e.queryHash);t&&(e.destroy(),t===e&&ui(this,B_).delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){ed.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return ui(this,B_).get(e)}getAll(){return[...ui(this,B_).values()]}find(e){const t={exact:!0,...e};return this.getAll().find(i=>M8(t,i))}findAll(e={}){const t=this.getAll();return Object.keys(e).length>0?t.filter(i=>M8(e,i)):t}notify(e){ed.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){ed.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){ed.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},B_=new WeakMap,Epe),xl,aS,oS,c0,u0,lS,h0,d0,Cpe,NLe=(Cpe=class{constructor(s={}){Sn(this,xl);Sn(this,aS);Sn(this,oS);Sn(this,c0);Sn(this,u0);Sn(this,lS);Sn(this,h0);Sn(this,d0);xs(this,xl,s.queryCache||new wLe),xs(this,aS,s.mutationCache||new OLe),xs(this,oS,s.defaultOptions||{}),xs(this,c0,new Map),xs(this,u0,new Map),xs(this,lS,0)}mount(){BP(this,lS)._++,ui(this,lS)===1&&(xs(this,h0,Gpe.subscribe(async s=>{s&&(await this.resumePausedMutations(),ui(this,xl).onFocus())})),xs(this,d0,qD.subscribe(async s=>{s&&(await this.resumePausedMutations(),ui(this,xl).onOnline())})))}unmount(){var s,e;BP(this,lS)._--,ui(this,lS)===0&&((s=ui(this,h0))==null||s.call(this),xs(this,h0,void 0),(e=ui(this,d0))==null||e.call(this),xs(this,d0,void 0))}isFetching(s){return ui(this,xl).findAll({...s,fetchStatus:"fetching"}).length}isMutating(s){return ui(this,aS).findAll({...s,status:"pending"}).length}getQueryData(s){var t;const e=this.defaultQueryOptions({queryKey:s});return(t=ui(this,xl).get(e.queryHash))==null?void 0:t.state.data}ensureQueryData(s){const e=this.defaultQueryOptions(s),t=ui(this,xl).build(this,e),i=t.state.data;return i===void 0?this.fetchQuery(s):(s.revalidateIfStale&&t.isStaleByTime(HF(e.staleTime,t))&&this.prefetchQuery(e),Promise.resolve(i))}getQueriesData(s){return ui(this,xl).findAll(s).map(({queryKey:e,state:t})=>{const i=t.data;return[e,i]})}setQueryData(s,e,t){const i=this.defaultQueryOptions({queryKey:s}),r=ui(this,xl).get(i.queryHash),n=r==null?void 0:r.state.data,a=hLe(e,n);if(a!==void 0)return ui(this,xl).build(this,i).setData(a,{...t,manual:!0})}setQueriesData(s,e,t){return ed.batch(()=>ui(this,xl).findAll(s).map(({queryKey:i})=>[i,this.setQueryData(i,e,t)]))}getQueryState(s){var t;const e=this.defaultQueryOptions({queryKey:s});return(t=ui(this,xl).get(e.queryHash))==null?void 0:t.state}removeQueries(s){const e=ui(this,xl);ed.batch(()=>{e.findAll(s).forEach(t=>{e.remove(t)})})}resetQueries(s,e){const t=ui(this,xl);return ed.batch(()=>(t.findAll(s).forEach(i=>{i.reset()}),this.refetchQueries({type:"active",...s},e)))}cancelQueries(s,e={}){const t={revert:!0,...e},i=ed.batch(()=>ui(this,xl).findAll(s).map(r=>r.cancel(t)));return Promise.all(i).then(Im).catch(Im)}invalidateQueries(s,e={}){return ed.batch(()=>(ui(this,xl).findAll(s).forEach(t=>{t.invalidate()}),(s==null?void 0:s.refetchType)==="none"?Promise.resolve():this.refetchQueries({...s,type:(s==null?void 0:s.refetchType)??(s==null?void 0:s.type)??"active"},e)))}refetchQueries(s,e={}){const t={...e,cancelRefetch:e.cancelRefetch??!0},i=ed.batch(()=>ui(this,xl).findAll(s).filter(r=>!r.isDisabled()&&!r.isStatic()).map(r=>{let n=r.fetch(void 0,t);return t.throwOnError||(n=n.catch(Im)),r.state.fetchStatus==="paused"?Promise.resolve():n}));return Promise.all(i).then(Im)}fetchQuery(s){const e=this.defaultQueryOptions(s);e.retry===void 0&&(e.retry=!1);const t=ui(this,xl).build(this,e);return t.isStaleByTime(HF(e.staleTime,t))?t.fetch(e):Promise.resolve(t.state.data)}prefetchQuery(s){return this.fetchQuery(s).then(Im).catch(Im)}fetchInfiniteQuery(s){return s.behavior=F8(s.pages),this.fetchQuery(s)}prefetchInfiniteQuery(s){return this.fetchInfiniteQuery(s).then(Im).catch(Im)}ensureInfiniteQueryData(s){return s.behavior=F8(s.pages),this.ensureQueryData(s)}resumePausedMutations(){return qD.isOnline()?ui(this,aS).resumePausedMutations():Promise.resolve()}getQueryCache(){return ui(this,xl)}getMutationCache(){return ui(this,aS)}getDefaultOptions(){return ui(this,oS)}setDefaultOptions(s){xs(this,oS,s)}setQueryDefaults(s,e){ui(this,c0).set(GR(s),{queryKey:s,defaultOptions:e})}getQueryDefaults(s){const e=[...ui(this,c0).values()],t={};return e.forEach(i=>{zR(s,i.queryKey)&&Object.assign(t,i.defaultOptions)}),t}setMutationDefaults(s,e){ui(this,u0).set(GR(s),{mutationKey:s,defaultOptions:e})}getMutationDefaults(s){const e=[...ui(this,u0).values()],t={};return e.forEach(i=>{zR(s,i.mutationKey)&&Object.assign(t,i.defaultOptions)}),t}defaultQueryOptions(s){if(s._defaulted)return s;const e={...ui(this,oS).queries,...this.getQueryDefaults(s.queryKey),...s,_defaulted:!0};return e.queryHash||(e.queryHash=F5(e.queryKey,e)),e.refetchOnReconnect===void 0&&(e.refetchOnReconnect=e.networkMode!=="always"),e.throwOnError===void 0&&(e.throwOnError=!!e.suspense),!e.networkMode&&e.persister&&(e.networkMode="offlineFirst"),e.queryFn===B5&&(e.enabled=!1),e}defaultMutationOptions(s){return s!=null&&s._defaulted?s:{...ui(this,oS).mutations,...(s==null?void 0:s.mutationKey)&&this.getMutationDefaults(s.mutationKey),...s,_defaulted:!0}}clear(){ui(this,xl).clear(),ui(this,aS).clear()}},xl=new WeakMap,aS=new WeakMap,oS=new WeakMap,c0=new WeakMap,u0=new WeakMap,lS=new WeakMap,h0=new WeakMap,d0=new WeakMap,Cpe),LLe=Te.createContext(void 0),FLe=({client:s,children:e})=>(Te.useEffect(()=>(s.mount(),()=>{s.unmount()}),[s]),g.jsx(LLe.Provider,{value:s,children:e}));const BLe=new NLe({defaultOptions:{queries:{refetchOnWindowFocus:!1,retry:1}}}),kLe=20,VLe=1e6,Sv={ADD_TOAST:"ADD_TOAST",UPDATE_TOAST:"UPDATE_TOAST",DISMISS_TOAST:"DISMISS_TOAST",REMOVE_TOAST:"REMOVE_TOAST"};let B1=0;function ULe(){return B1=(B1+1)%Number.MAX_VALUE,B1.toString()}const k1=new Map,k8=s=>{if(k1.has(s))return;const e=setTimeout(()=>{k1.delete(s),rR({type:Sv.REMOVE_TOAST,toastId:s})},VLe);k1.set(s,e)},GLe=(s,e)=>{switch(e.type){case Sv.ADD_TOAST:return{...s,toasts:[e.toast,...s.toasts].slice(0,kLe)};case Sv.UPDATE_TOAST:return{...s,toasts:s.toasts.map(t=>t.id===e.toast.id?{...t,...e.toast}:t)};case Sv.DISMISS_TOAST:{const{toastId:t}=e;return t?k8(t):s.toasts.forEach(i=>{k8(i.id)}),{...s,toasts:s.toasts.map(i=>i.id===t||t===void 0?{...i,open:!1}:i)}}case Sv.REMOVE_TOAST:return e.toastId===void 0?{...s,toasts:[]}:{...s,toasts:s.toasts.filter(t=>t.id!==e.toastId)}}},xD=[];let SD={toasts:[]};function rR(s){SD=GLe(SD,s),xD.forEach(e=>{e(SD)})}function zLe({...s}){const e=ULe(),t=r=>rR({type:Sv.UPDATE_TOAST,toast:{...r,id:e}}),i=()=>rR({type:Sv.DISMISS_TOAST,toastId:e});return rR({type:Sv.ADD_TOAST,toast:{...s,id:e,open:!0,onOpenChange:r=>{r||i()}}}),{id:e,dismiss:i,update:t}}function WLe(){const[s,e]=Te.useState(SD);return Te.useEffect(()=>(xD.push(e),()=>{const t=xD.indexOf(e);t>-1&&xD.splice(t,1)}),[s]),{...s,toast:zLe,dismiss:t=>rR({type:Sv.DISMISS_TOAST,toastId:t})}}function jpe(s){var e,t,i="";if(typeof s=="string"||typeof s=="number")i+=s;else if(typeof s=="object")if(Array.isArray(s)){var r=s.length;for(e=0;etypeof s=="boolean"?`${s}`:s===0?"0":s,U8=Xpe,HLe=(s,e)=>t=>{var i;if((e==null?void 0:e.variants)==null)return U8(s,t==null?void 0:t.class,t==null?void 0:t.className);const{variants:r,defaultVariants:n}=e,a=Object.keys(r).map(c=>{const u=t==null?void 0:t[c],h=n==null?void 0:n[c];if(u===null)return null;const d=V8(u)||V8(h);return r[c][d]}),o=t&&Object.entries(t).reduce((c,u)=>{let[h,d]=u;return d===void 0||(c[h]=d),c},{}),l=e==null||(i=e.compoundVariants)===null||i===void 0?void 0:i.reduce((c,u)=>{let{class:h,className:d,...f}=u;return Object.entries(f).every(m=>{let[p,_]=m;return Array.isArray(_)?_.includes({...n,...o}[p]):{...n,...o}[p]===_})?[...c,h,d]:c},[]);return U8(s,a,l,t==null?void 0:t.class,t==null?void 0:t.className)};/**
000069: * @license lucide-react v0.475.0 - ISC
000070: *
000071: * This source code is licensed under the ISC license.
000072: * See the LICENSE file in the root directory of this source tree.
000073: */const jLe=s=>s.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),$pe=(...s)=>s.filter((e,t,i)=>!!e&&e.trim()!==""&&i.indexOf(e)===t).join(" ").trim();/**
000074: * @license lucide-react v0.475.0 - ISC
000075: *
000076: * This source code is licensed under the ISC license.
000077: * See the LICENSE file in the root directory of this source tree.
000078: */var XLe={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
000079: * @license lucide-react v0.475.0 - ISC
000080: *
LISTENER CONTEXT 535-559
000535: *
000536: * This source code is licensed under the ISC license.
000537: * See the LICENSE file in the root directory of this source tree.
000538: */const _Be=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]],V5=Fi("Users",_Be);/**
000539: * @license lucide-react v0.475.0 - ISC
000540: *
000541: * This source code is licensed under the ISC license.
000542: * See the LICENSE file in the root directory of this source tree.
000543: */const gBe=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],m0=Fi("X",gBe),vBe=(s,e)=>{const t=new Array(s.length+e.length);for(let i=0;i({classGroupId:s,validator:e}),lme=(s=new Map,e=null,t)=>({nextPart:s,validators:e,classGroupId:t}),tO="-",H8=[],SBe="arbitrary..",bBe=s=>{const e=yBe(s),{conflictingClassGroups:t,conflictingClassGroupModifiers:i}=s;return{getClassGroupId:a=>{if(a.startsWith("[")&&a.endsWith("]"))return TBe(a);const o=a.split(tO),l=o[0]===""&&o.length>1?1:0;return cme(o,l,e)},getConflictingClassGroupIds:(a,o)=>{if(o){const l=i[a],c=t[a];return l?c?vBe(c,l):l:c||H8}return t[a]||H8}}},cme=(s,e,t)=>{if(s.length-e===0)return t.classGroupId;const r=s[e],n=t.nextPart.get(r);if(n){const c=cme(s,e+1,n);if(c)return c}const a=t.validators;if(a===null)return;const o=e===0?s.join(tO):s.slice(e).join(tO),l=a.length;for(let c=0;cs.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const e=s.slice(1,-1),t=e.indexOf(":"),i=e.slice(0,t);return i?SBe+i:void 0})(),yBe=s=>{const{theme:e,classGroups:t}=s;return EBe(t,e)},EBe=(s,e)=>{const t=lme();for(const i in s){const r=s[i];U5(r,t,i,e)}return t},U5=(s,e,t,i)=>{const r=s.length;for(let n=0;n{if(typeof s=="string"){RBe(s,e,t);return}if(typeof s=="function"){IBe(s,e,t,i);return}ABe(s,e,t,i)},RBe=(s,e,t)=>{const i=s===""?e:ume(e,s);i.classGroupId=t},IBe=(s,e,t,i)=>{if(PBe(s)){U5(s(i),e,t,i);return}e.validators===null&&(e.validators=[]),e.validators.push(xBe(t,s))},ABe=(s,e,t,i)=>{const r=Object.entries(s),n=r.length;for(let a=0;a{let t=s;const i=e.split(tO),r=i.length;for(let n=0;n"isThemeGetter"in s&&s.isThemeGetter===!0,MBe=s=>{if(s<1)return{get:()=>{},set:()=>{}};let e=0,t=Object.create(null),i=Object.create(null);const r=(n,a)=>{t[n]=a,e++,e>s&&(e=0,i=t,t=Object.create(null))};return{get(n){let a=t[n];if(a!==void 0)return a;if((a=i[n])!==void 0)return r(n,a),a},set(n,a){n in t?t[n]=a:r(n,a)}}},qF="!",j8=":",DBe=[],X8=(s,e,t,i,r)=>({modifiers:s,hasImportantModifier:e,baseClassName:t,maybePostfixModifierPosition:i,isExternal:r}),OBe=s=>{const{prefix:e,experimentalParseClassName:t}=s;let i=r=>{const n=[];let a=0,o=0,l=0,c;const u=r.length;for(let p=0;pl?c-l:void 0;return X8(n,f,d,m)};if(e){const r=e+j8,n=i;i=a=>a.startsWith(r)?n(a.slice(r.length)):X8(DBe,!1,a,void 0,!0)}if(t){const r=i;i=n=>t({className:n,parseClassName:r})}return i},wBe=s=>{const e=new Map;return s.orderSensitiveModifiers.forEach((t,i)=>{e.set(t,1e6+i)}),t=>{const i=[];let r=[];for(let n=0;n0&&(r.sort(),i.push(...r),r=[]),i.push(a)):r.push(a)}return r.length>0&&(r.sort(),i.push(...r)),i}},NBe=s=>({cache:MBe(s.cacheSize),parseClassName:OBe(s),sortModifiers:wBe(s),...bBe(s)}),LBe=/\s+/,FBe=(s,e)=>{const{parseClassName:t,getClassGroupId:i,getConflictingClassGroupIds:r,sortModifiers:n}=e,a=[],o=s.trim().split(LBe);let l="";for(let c=o.length-1;c>=0;c-=1){const u=o[c],{isExternal:h,modifiers:d,hasImportantModifier:f,baseClassName:m,maybePostfixModifierPosition:p}=t(u);if(h){l=u+(l.length>0?" "+l:l);continue}let _=!!p,v=i(_?m.substring(0,p):m);if(!v){if(!_){l=u+(l.length>0?" "+l:l);continue}if(v=i(m),!v){l=u+(l.length>0?" "+l:l);continue}_=!1}const x=d.length===0?"":d.length===1?d[0]:n(d).join(":"),S=f?x+qF:x,b=S+v;if(a.indexOf(b)>-1)continue;a.push(b);const y=r(v,_);for(let I=0;I0?" "+l:l)}return l},BBe=(...s)=>{let e=0,t,i,r="";for(;e{if(typeof s=="string")return s;let e,t="";for(let i=0;i{let t,i,r,n;const a=l=>{const c=e.reduce((u,h)=>h(u),s());return t=NBe(c),i=t.cache.get,r=t.cache.set,n=o,o(l)},o=l=>{const c=i(l);if(c)return c;const u=FBe(l,t);return r(l,u),u};return n=a,(...l)=>n(BBe(...l))},VBe=[],Pc=s=>{const e=t=>t[s]||VBe;return e.isThemeGetter=!0,e},dme=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,fme=/^\((?:(\w[\w-]*):)?(.+)\)$/i,UBe=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,GBe=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,zBe=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,WBe=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,HBe=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,jBe=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Ix=s=>UBe.test(s),qs=s=>!!s&&!Number.isNaN(Number(s)),Ax=s=>!!s&&Number.isInteger(Number(s)),V1=s=>s.endsWith("%")&&qs(s.slice(0,-1)),Xg=s=>GBe.test(s),pme=()=>!0,XBe=s=>zBe.test(s)&&!WBe.test(s),G5=()=>!1,$Be=s=>HBe.test(s),YBe=s=>jBe.test(s),qBe=s=>!Sr(s)&&!Tr(s),ZBe=s=>XS(s,gme,G5),Sr=s=>dme.test(s),Eb=s=>XS(s,vme,XBe),$8=s=>XS(s,s3e,qs),KBe=s=>XS(s,Sme,pme),QBe=s=>XS(s,xme,G5),Y8=s=>XS(s,mme,G5),JBe=s=>XS(s,_me,YBe),UP=s=>XS(s,bme,$Be),Tr=s=>fme.test(s),yC=s=>oy(s,vme),e3e=s=>oy(s,xme),q8=s=>oy(s,mme),t3e=s=>oy(s,gme),i3e=s=>oy(s,_me),GP=s=>oy(s,bme,!0),r3e=s=>oy(s,Sme,!0),XS=(s,e,t)=>{const i=dme.exec(s);return i?i[1]?e(i[1]):t(i[2]):!1},oy=(s,e,t=!1)=>{const i=fme.exec(s);return i?i[1]?e(i[1]):t:!1},mme=s=>s==="position"||s==="percentage",_me=s=>s==="image"||s==="url",gme=s=>s==="length"||s==="size"||s==="bg-size",vme=s=>s==="length",s3e=s=>s==="number",xme=s=>s==="family-name",Sme=s=>s==="number"||s==="weight",bme=s=>s==="shadow",n3e=()=>{const s=Pc("color"),e=Pc("font"),t=Pc("text"),i=Pc("font-weight"),r=Pc("tracking"),n=Pc("leading"),a=Pc("breakpoint"),o=Pc("container"),l=Pc("spacing"),c=Pc("radius"),u=Pc("shadow"),h=Pc("inset-shadow"),d=Pc("text-shadow"),f=Pc("drop-shadow"),m=Pc("blur"),p=Pc("perspective"),_=Pc("aspect"),v=Pc("ease"),x=Pc("animate"),S=()=>["auto","avoid","all","avoid-page","page","left","right","column"],b=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],y=()=>[...b(),Tr,Sr],I=()=>["auto","hidden","clip","visible","scroll"],R=()=>["auto","contain","none"],A=()=>[Tr,Sr,l],P=()=>[Ix,"full","auto",...A()],w=()=>[Ax,"none","subgrid",Tr,Sr],L=()=>["auto",{span:["full",Ax,Tr,Sr]},Ax,Tr,Sr],k=()=>[Ax,"auto",Tr,Sr],V=()=>["auto","min","max","fr",Tr,Sr],U=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],ne=()=>["start","end","center","stretch","center-safe","end-safe"],oe=()=>["auto",...A()],le=()=>[Ix,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...A()],Y=()=>[Ix,"screen","full","dvw","lvw","svw","min","max","fit",...A()],te=()=>[Ix,"screen","full","lh","dvh","lvh","svh","min","max","fit",...A()],Z=()=>[s,Tr,Sr],j=()=>[...b(),q8,Y8,{position:[Tr,Sr]}],G=()=>["no-repeat",{repeat:["","x","y","space","round"]}],J=()=>["auto","cover","contain",t3e,ZBe,{size:[Tr,Sr]}],$=()=>[V1,yC,Eb],re=()=>["","none","full",c,Tr,Sr],ie=()=>["",qs,yC,Eb],ve=()=>["solid","dashed","dotted","double"],Re=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],Ie=()=>[qs,V1,q8,Y8],de=()=>["","none",m,Tr,Sr],q=()=>["none",qs,Tr,Sr],pe=()=>["none",qs,Tr,Sr],Oe=()=>[qs,Tr,Sr],Me=()=>[Ix,"full",...A()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Xg],breakpoint:[Xg],color:[pme],container:[Xg],"drop-shadow":[Xg],ease:["in","out","in-out"],font:[qBe],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Xg],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Xg],shadow:[Xg],spacing:["px",qs],text:[Xg],"text-shadow":[Xg],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Ix,Sr,Tr,_]}],container:["container"],columns:[{columns:[qs,Sr,Tr,o]}],"break-after":[{"break-after":S()}],"break-before":[{"break-before":S()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:y()}],overflow:[{overflow:I()}],"overflow-x":[{"overflow-x":I()}],"overflow-y":[{"overflow-y":I()}],overscroll:[{overscroll:R()}],"overscroll-x":[{"overscroll-x":R()}],"overscroll-y":[{"overscroll-y":R()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:P()}],"inset-x":[{"inset-x":P()}],"inset-y":[{"inset-y":P()}],start:[{"inset-s":P(),start:P()}],end:[{"inset-e":P(),end:P()}],"inset-bs":[{"inset-bs":P()}],"inset-be":[{"inset-be":P()}],top:[{top:P()}],right:[{right:P()}],bottom:[{bottom:P()}],left:[{left:P()}],visibility:["visible","invisible","collapse"],z:[{z:[Ax,"auto",Tr,Sr]}],basis:[{basis:[Ix,"full","auto",o,...A()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[qs,Ix,"auto","initial","none",Sr]}],grow:[{grow:["",qs,Tr,Sr]}],shrink:[{shrink:["",qs,Tr,Sr]}],order:[{order:[Ax,"first","last","none",Tr,Sr]}],"grid-cols":[{"grid-cols":w()}],"col-start-end":[{col:L()}],"col-start":[{"col-start":k()}],"col-end":[{"col-end":k()}],"grid-rows":[{"grid-rows":w()}],"row-start-end":[{row:L()}],"row-start":[{"row-start":k()}],"row-end":[{"row-end":k()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":V()}],"auto-rows":[{"auto-rows":V()}],gap:[{gap:A()}],"gap-x":[{"gap-x":A()}],"gap-y":[{"gap-y":A()}],"justify-content":[{justify:[...U(),"normal"]}],"justify-items":[{"justify-items":[...ne(),"normal"]}],"justify-self":[{"justify-self":["auto",...ne()]}],"align-content":[{content:["normal",...U()]}],"align-items":[{items:[...ne(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...ne(),{baseline:["","last"]}]}],"place-content":[{"place-content":U()}],"place-items":[{"place-items":[...ne(),"baseline"]}],"place-self":[{"place-self":["auto",...ne()]}],p:[{p:A()}],px:[{px:A()}],py:[{py:A()}],ps:[{ps:A()}],pe:[{pe:A()}],pbs:[{pbs:A()}],pbe:[{pbe:A()}],pt:[{pt:A()}],pr:[{pr:A()}],pb:[{pb:A()}],pl:[{pl:A()}],m:[{m:oe()}],mx:[{mx:oe()}],my:[{my:oe()}],ms:[{ms:oe()}],me:[{me:oe()}],mbs:[{mbs:oe()}],mbe:[{mbe:oe()}],mt:[{mt:oe()}],mr:[{mr:oe()}],mb:[{mb:oe()}],ml:[{ml:oe()}],"space-x":[{"space-x":A()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":A()}],"space-y-reverse":["space-y-reverse"],size:[{size:le()}],"inline-size":[{inline:["auto",...Y()]}],"min-inline-size":[{"min-inline":["auto",...Y()]}],"max-inline-size":[{"max-inline":["none",...Y()]}],"block-size":[{block:["auto",...te()]}],"min-block-size":[{"min-block":["auto",...te()]}],"max-block-size":[{"max-block":["none",...te()]}],w:[{w:[o,"screen",...le()]}],"min-w":[{"min-w":[o,"screen","none",...le()]}],"max-w":[{"max-w":[o,"screen","none","prose",{screen:[a]},...le()]}],h:[{h:["screen","lh",...le()]}],"min-h":[{"min-h":["screen","lh","none",...le()]}],"max-h":[{"max-h":["screen","lh",...le()]}],"font-size":[{text:["base",t,yC,Eb]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[i,r3e,KBe]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",V1,Sr]}],"font-family":[{font:[e3e,QBe,e]}],"font-features":[{"font-features":[Sr]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[r,Tr,Sr]}],"line-clamp":[{"line-clamp":[qs,"none",Tr,$8]}],leading:[{leading:[n,...A()]}],"list-image":[{"list-image":["none",Tr,Sr]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Tr,Sr]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:Z()}],"text-color":[{text:Z()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...ve(),"wavy"]}],"text-decoration-thickness":[{decoration:[qs,"from-font","auto",Tr,Eb]}],"text-decoration-color":[{decoration:Z()}],"underline-offset":[{"underline-offset":[qs,"auto",Tr,Sr]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:A()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Tr,Sr]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Tr,Sr]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:j()}],"bg-repeat":[{bg:G()}],"bg-size":[{bg:J()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Ax,Tr,Sr],radial:["",Tr,Sr],conic:[Ax,Tr,Sr]},i3e,JBe]}],"bg-color":[{bg:Z()}],"gradient-from-pos":[{from:$()}],"gradient-via-pos":[{via:$()}],"gradient-to-pos":[{to:$()}],"gradient-from":[{from:Z()}],"gradient-via":[{via:Z()}],"gradient-to":[{to:Z()}],rounded:[{rounded:re()}],"rounded-s":[{"rounded-s":re()}],"rounded-e":[{"rounded-e":re()}],"rounded-t":[{"rounded-t":re()}],"rounded-r":[{"rounded-r":re()}],"rounded-b":[{"rounded-b":re()}],"rounded-l":[{"rounded-l":re()}],"rounded-ss":[{"rounded-ss":re()}],"rounded-se":[{"rounded-se":re()}],"rounded-ee":[{"rounded-ee":re()}],"rounded-es":[{"rounded-es":re()}],"rounded-tl":[{"rounded-tl":re()}],"rounded-tr":[{"rounded-tr":re()}],"rounded-br":[{"rounded-br":re()}],"rounded-bl":[{"rounded-bl":re()}],"border-w":[{border:ie()}],"border-w-x":[{"border-x":ie()}],"border-w-y":[{"border-y":ie()}],"border-w-s":[{"border-s":ie()}],"border-w-e":[{"border-e":ie()}],"border-w-bs":[{"border-bs":ie()}],"border-w-be":[{"border-be":ie()}],"border-w-t":[{"border-t":ie()}],"border-w-r":[{"border-r":ie()}],"border-w-b":[{"border-b":ie()}],"border-w-l":[{"border-l":ie()}],"divide-x":[{"divide-x":ie()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":ie()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...ve(),"hidden","none"]}],"divide-style":[{divide:[...ve(),"hidden","none"]}],"border-color":[{border:Z()}],"border-color-x":[{"border-x":Z()}],"border-color-y":[{"border-y":Z()}],"border-color-s":[{"border-s":Z()}],"border-color-e":[{"border-e":Z()}],"border-color-bs":[{"border-bs":Z()}],"border-color-be":[{"border-be":Z()}],"border-color-t":[{"border-t":Z()}],"border-color-r":[{"border-r":Z()}],"border-color-b":[{"border-b":Z()}],"border-color-l":[{"border-l":Z()}],"divide-color":[{divide:Z()}],"outline-style":[{outline:[...ve(),"none","hidden"]}],"outline-offset":[{"outline-offset":[qs,Tr,Sr]}],"outline-w":[{outline:["",qs,yC,Eb]}],"outline-color":[{outline:Z()}],shadow:[{shadow:["","none",u,GP,UP]}],"shadow-color":[{shadow:Z()}],"inset-shadow":[{"inset-shadow":["none",h,GP,UP]}],"inset-shadow-color":[{"inset-shadow":Z()}],"ring-w":[{ring:ie()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:Z()}],"ring-offset-w":[{"ring-offset":[qs,Eb]}],"ring-offset-color":[{"ring-offset":Z()}],"inset-ring-w":[{"inset-ring":ie()}],"inset-ring-color":[{"inset-ring":Z()}],"text-shadow":[{"text-shadow":["none",d,GP,UP]}],"text-shadow-color":[{"text-shadow":Z()}],opacity:[{opacity:[qs,Tr,Sr]}],"mix-blend":[{"mix-blend":[...Re(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":Re()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[qs]}],"mask-image-linear-from-pos":[{"mask-linear-from":Ie()}],"mask-image-linear-to-pos":[{"mask-linear-to":Ie()}],"mask-image-linear-from-color":[{"mask-linear-from":Z()}],"mask-image-linear-to-color":[{"mask-linear-to":Z()}],"mask-image-t-from-pos":[{"mask-t-from":Ie()}],"mask-image-t-to-pos":[{"mask-t-to":Ie()}],"mask-image-t-from-color":[{"mask-t-from":Z()}],"mask-image-t-to-color":[{"mask-t-to":Z()}],"mask-image-r-from-pos":[{"mask-r-from":Ie()}],"mask-image-r-to-pos":[{"mask-r-to":Ie()}],"mask-image-r-from-color":[{"mask-r-from":Z()}],"mask-image-r-to-color":[{"mask-r-to":Z()}],"mask-image-b-from-pos":[{"mask-b-from":Ie()}],"mask-image-b-to-pos":[{"mask-b-to":Ie()}],"mask-image-b-from-color":[{"mask-b-from":Z()}],"mask-image-b-to-color":[{"mask-b-to":Z()}],"mask-image-l-from-pos":[{"mask-l-from":Ie()}],"mask-image-l-to-pos":[{"mask-l-to":Ie()}],"mask-image-l-from-color":[{"mask-l-from":Z()}],"mask-image-l-to-color":[{"mask-l-to":Z()}],"mask-image-x-from-pos":[{"mask-x-from":Ie()}],"mask-image-x-to-pos":[{"mask-x-to":Ie()}],"mask-image-x-from-color":[{"mask-x-from":Z()}],"mask-image-x-to-color":[{"mask-x-to":Z()}],"mask-image-y-from-pos":[{"mask-y-from":Ie()}],"mask-image-y-to-pos":[{"mask-y-to":Ie()}],"mask-image-y-from-color":[{"mask-y-from":Z()}],"mask-image-y-to-color":[{"mask-y-to":Z()}],"mask-image-radial":[{"mask-radial":[Tr,Sr]}],"mask-image-radial-from-pos":[{"mask-radial-from":Ie()}],"mask-image-radial-to-pos":[{"mask-radial-to":Ie()}],"mask-image-radial-from-color":[{"mask-radial-from":Z()}],"mask-image-radial-to-color":[{"mask-radial-to":Z()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":b()}],"mask-image-conic-pos":[{"mask-conic":[qs]}],"mask-image-conic-from-pos":[{"mask-conic-from":Ie()}],"mask-image-conic-to-pos":[{"mask-conic-to":Ie()}],"mask-image-conic-from-color":[{"mask-conic-from":Z()}],"mask-image-conic-to-color":[{"mask-conic-to":Z()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:j()}],"mask-repeat":[{mask:G()}],"mask-size":[{mask:J()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Tr,Sr]}],filter:[{filter:["","none",Tr,Sr]}],blur:[{blur:de()}],brightness:[{brightness:[qs,Tr,Sr]}],contrast:[{contrast:[qs,Tr,Sr]}],"drop-shadow":[{"drop-shadow":["","none",f,GP,UP]}],"drop-shadow-color":[{"drop-shadow":Z()}],grayscale:[{grayscale:["",qs,Tr,Sr]}],"hue-rotate":[{"hue-rotate":[qs,Tr,Sr]}],invert:[{invert:["",qs,Tr,Sr]}],saturate:[{saturate:[qs,Tr,Sr]}],sepia:[{sepia:["",qs,Tr,Sr]}],"backdrop-filter":[{"backdrop-filter":["","none",Tr,Sr]}],"backdrop-blur":[{"backdrop-blur":de()}],"backdrop-brightness":[{"backdrop-brightness":[qs,Tr,Sr]}],"backdrop-contrast":[{"backdrop-contrast":[qs,Tr,Sr]}],"backdrop-grayscale":[{"backdrop-grayscale":["",qs,Tr,Sr]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[qs,Tr,Sr]}],"backdrop-invert":[{"backdrop-invert":["",qs,Tr,Sr]}],"backdrop-opacity":[{"backdrop-opacity":[qs,Tr,Sr]}],"backdrop-saturate":[{"backdrop-saturate":[qs,Tr,Sr]}],"backdrop-sepia":[{"backdrop-sepia":["",qs,Tr,Sr]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":A()}],"border-spacing-x":[{"border-spacing-x":A()}],"border-spacing-y":[{"border-spacing-y":A()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Tr,Sr]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[qs,"initial",Tr,Sr]}],ease:[{ease:["linear","initial",v,Tr,Sr]}],delay:[{delay:[qs,Tr,Sr]}],animate:[{animate:["none",x,Tr,Sr]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[p,Tr,Sr]}],"perspective-origin":[{"perspective-origin":y()}],rotate:[{rotate:q()}],"rotate-x":[{"rotate-x":q()}],"rotate-y":[{"rotate-y":q()}],"rotate-z":[{"rotate-z":q()}],scale:[{scale:pe()}],"scale-x":[{"scale-x":pe()}],"scale-y":[{"scale-y":pe()}],"scale-z":[{"scale-z":pe()}],"scale-3d":["scale-3d"],skew:[{skew:Oe()}],"skew-x":[{"skew-x":Oe()}],"skew-y":[{"skew-y":Oe()}],transform:[{transform:[Tr,Sr,"","none","gpu","cpu"]}],"transform-origin":[{origin:y()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Me()}],"translate-x":[{"translate-x":Me()}],"translate-y":[{"translate-y":Me()}],"translate-z":[{"translate-z":Me()}],"translate-none":["translate-none"],accent:[{accent:Z()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:Z()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Tr,Sr]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":A()}],"scroll-mx":[{"scroll-mx":A()}],"scroll-my":[{"scroll-my":A()}],"scroll-ms":[{"scroll-ms":A()}],"scroll-me":[{"scroll-me":A()}],"scroll-mbs":[{"scroll-mbs":A()}],"scroll-mbe":[{"scroll-mbe":A()}],"scroll-mt":[{"scroll-mt":A()}],"scroll-mr":[{"scroll-mr":A()}],"scroll-mb":[{"scroll-mb":A()}],"scroll-ml":[{"scroll-ml":A()}],"scroll-p":[{"scroll-p":A()}],"scroll-px":[{"scroll-px":A()}],"scroll-py":[{"scroll-py":A()}],"scroll-ps":[{"scroll-ps":A()}],"scroll-pe":[{"scroll-pe":A()}],"scroll-pbs":[{"scroll-pbs":A()}],"scroll-pbe":[{"scroll-pbe":A()}],"scroll-pt":[{"scroll-pt":A()}],"scroll-pr":[{"scroll-pr":A()}],"scroll-pb":[{"scroll-pb":A()}],"scroll-pl":[{"scroll-pl":A()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Tr,Sr]}],fill:[{fill:["none",...Z()]}],"stroke-w":[{stroke:[qs,yC,Eb,$8]}],stroke:[{stroke:["none",...Z()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},a3e=kBe(n3e);function ly(...s){return a3e(Xpe(s))}const Tme=Te.forwardRef(({...s},e)=>g.jsx("div",{ref:e,className:"fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]",...s}));Tme.displayName="ToastProvider";const yme=Te.forwardRef(({...s},e)=>g.jsx("div",{ref:e,className:"fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]",...s}));yme.displayName="ToastViewport";const o3e=HLe("group pointer-events-auto relative flex w-full items-center justify-between space-x-4 overflow-hidden rounded-md border p-6 pr-8 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full",{variants:{variant:{default:"border bg-background text-foreground",destructive:"destructive group border-destructive bg-destructive text-destructive-foreground"}},defaultVariants:{variant:"default"}}),Eme=Te.forwardRef(({className:s,variant:e,...t},i)=>g.jsx("div",{ref:i,className:ly(o3e({variant:e}),s),...t}));Eme.displayName="Toast";const l3e=Te.forwardRef(({className:s,...e},t)=>g.jsx("div",{ref:t,className:ly("inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium ring-offset-background transition-colors hover:bg-secondary focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive",s),...e}));l3e.displayName="ToastAction";const Cme=Te.forwardRef(({className:s,...e},t)=>g.jsx("button",{ref:t,className:ly("absolute right-2 top-2 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-2 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",s),"toast-close":"",...e,children:g.jsx(m0,{className:"h-4 w-4"})}));Cme.displayName="ToastClose";const Rme=Te.forwardRef(({className:s,...e},t)=>g.jsx("div",{ref:t,className:ly("text-sm font-semibold",s),...e}));Rme.displayName="ToastTitle";const Ime=Te.forwardRef(({className:s,...e},t)=>g.jsx("div",{ref:t,className:ly("text-sm opacity-90",s),...e}));Ime.displayName="ToastDescription";function c3e(){const{toasts:s}=WLe();return g.jsxs(Tme,{children:[s.map(function({id:e,title:t,description:i,action:r,...n}){return g.jsxs(Eme,{...n,children:[g.jsxs("div",{className:"grid gap-1",children:[t&&g.jsx(Rme,{children:t}),i&&g.jsx(Ime,{children:i})]}),r,g.jsx(Cme,{})]},e)}),g.jsx(yme,{})]})}const u3e=s=>{const e=s.slice(1);try{return decodeURIComponent(e)}catch{return e}};function h3e(){const{pathname:s,hash:e}=zS(),t=C1e();return Te.useEffect(()=>{if(t!=="POP"){if(e){const i=u3e(e),r=window.setTimeout(()=>{var n;(n=document.getElementById(i))==null||n.scrollIntoView({behavior:"smooth"})},50);return()=>window.clearTimeout(r)}window.scrollTo({top:0,left:0,behavior:"instant"})}},[s,e,t]),null}const d3e=[["Workshop 3D","/",YF],["Dashboard","/dashboard",tme],["Intake Requests","/intake-requests",o2e],["Customers","/customers",V5],["Cover Projects","/projects",KD],["New Cover","/new-cover",qpe],["Measurement Studio","/take-measurements",Yp],["Component Library","/components",YO],["Ossiguard Connectors","/ossiguard-connectors",p0],["Design Forge","/design-forge",z0],["Validation","/validation",Hv],["Quotes","/quotes",JD],["Orders","/orders",ame],["Manufacturing","/manufacturing",LFe],["Completed Covers","/completed-covers",tFe],["Shipping","/shipping",lBe],["Reports","/reports",Qpe],["Migration Readiness","/migration-readiness",CFe],["Settings","/settings",sme],["Lock Workshop","#lock",m2e]],f3e="/api/v1";async function jx(s,e={}){const t=await fetch(`${f3e}${s}`,{cache:"no-store",...e,headers:{...e.body instanceof FormData?{}:{"Content-Type":"application/json"},...e.headers||{}}});let i=null;try{i=await t.json()}catch{i=null}if(!t.ok){const r=new Error((i==null?void 0:i.error)||`Local SHiRE request failed (${t.status})`);throw r.status=t.status,r.data=i,r}return i}function p3e(s){return{async list(e="-updated_date",t=500){const i=new URLSearchParams({sort:e,limit:String(t)});return(await jx(`/collections/${encodeURIComponent(s)}?${i}`)).records||[]},async filter(e={},t="-updated_date",i=500){return(await jx(`/collections/${encodeURIComponent(s)}/filter`,{method:"POST",body:JSON.stringify({query:e,sort:t,limit:i})})).records||[]},async get(e){return(await jx(`/collections/${encodeURIComponent(s)}/${encodeURIComponent(e)}`)).record},async create(e){return(await jx(`/collections/${encodeURIComponent(s)}`,{method:"POST",body:JSON.stringify(e||{})})).record},async update(e,t){return(await jx(`/collections/${encodeURIComponent(s)}/${encodeURIComponent(e)}`,{method:"PATCH",body:JSON.stringify(t||{})})).record},async delete(e){return await jx(`/collections/${encodeURIComponent(s)}/${encodeURIComponent(e)}`,{method:"DELETE"})},async bulkCreate(e){return(await jx(`/collections/${encodeURIComponent(s)}/bulk-create`,{method:"POST",body:JSON.stringify({records:e||[]})})).records||[]},async bulkUpdate(e){const t=[];for(const i of e||[]){const r=i.id||i.uuid;if(!r)throw new Error(`bulkUpdate record in ${s} has no id or uuid`);t.push(await this.update(r,i))}return t}}}const m3e=new Proxy({},{get(s,e){return p3e(String(e))}}),EC={id:"shire-local-owner",email:"",full_name:"Ray",role:"owner_admin",roles:["owner_admin","admin","builder"],local_only:!0};async function _3e({file:s,destination:e="Uploads"}){if(!(s instanceof Blob))throw new Error("A valid file is required.");const t=await jx("/files",{method:"POST",body:s,headers:{"Content-Type":s.type||"application/octet-stream","X-SHiRE-Filename":s.name||"upload.bin","X-SHiRE-Destination":e}});return{file_url:t.file.location,...t.file}}function zP(s){return async()=>{throw new Error(`${s} is not connected to a native SHiRE engine yet.`)}}const W_={entities:m3e,auth:{me:async()=>EC,isAuthenticated:()=>!0,logout:()=>{},redirectToLogin:()=>{},loginViaEmailPassword:async()=>EC,loginWithProvider:async()=>EC,register:async()=>EC,verifyOtp:async()=>({access_token:"shire-local-session"}),resendOtp:async()=>({ok:!0}),resetPassword:async()=>({ok:!0}),resetPasswordRequest:async()=>({ok:!0}),setToken:()=>{},updateMe:async s=>({...EC,...s||{}})},functions:{invoke:zP("Local server function")},integrations:{Core:{UploadFile:_3e,GenerateImage:zP("Native image generation"),InvokeLLM:zP("Native SHiRE reasoning"),createAdaptationPreview:zP("Native CoverCanvas adaptation preview")}}},Cb=s=>W_.entities[s],g3e={list:(s,e="-updated_date",t=500)=>Cb(s).list(e,t),filter:(s,e,t="-updated_date",i=500)=>Cb(s).filter(e,t,i),get:(s,e)=>Cb(s).get(e),create:(s,e)=>Cb(s).create(e),update:(s,e,t)=>Cb(s).update(e,t),archive:(s,e)=>Cb(s).update(e,{record_state:"archived"}),restore:(s,e)=>Cb(s).update(e,{record_state:"active"})},v3e={currentUser:()=>W_.auth.me(),isAuthenticated:()=>W_.auth.isAuthenticated(),lock:()=>W_.auth.logout("/login")},x3e={async upload(s,e){const{file_url:t}=await W_.integrations.Core.UploadFile({file:s});return{location:t,destination:e,checksum:null,verified:!1,storage:"Base44 development storage"}}},S3e={async invoke(){throw new Error("Not yet implemented")}},Bt={database:g3e,auth:v3e,files:x3e,functions:S3e},b3e=()=>{const s=globalThis.crypto;if(s&&typeof s.randomUUID=="function")return s.randomUUID();if(!s||typeof s.getRandomValues!="function")throw new Error("Secure identifier generation is unavailable in this browser.");const e=new Uint8Array(16);s.getRandomValues(e),e[6]=e[6]&15|64,e[8]=e[8]&63|128;const t=Array.from(e,i=>i.toString(16).padStart(2,"0")).join("");return[t.slice(0,8),t.slice(8,12),t.slice(12,16),t.slice(16,20),t.slice(20)].join("-")},Ka=s=>`${s}-${b3e()}`,ho=(s="Workshop Owner")=>({created_by_name:s,updated_by_name:s,revision:1,record_state:"active",migration_version:1}),T3e={currentUser:()=>Bt.auth.currentUser(),isAuthenticated:()=>Bt.auth.isAuthenticated(),lockWorkshop:()=>Bt.auth.lock()};function y3e({onNavigate:s}){return g.jsx("nav",{"aria-label":"Workshop navigation",className:"space-y-1 px-3 pb-6",children:d3e.map(([e,t,i])=>t==="#lock"?g.jsxs("button",{onClick:()=>T3e.lockWorkshop(),className:"nav-link w-full",children:[g.jsx(i,{}),g.jsx("span",{children:e})]},e):g.jsxs(rLe,{to:t,onClick:s,className:({isActive:r})=>`nav-link ${r&&t!=="/not-implemented"?"nav-link-active":""}`,children:[g.jsx(i,{}),g.jsx("span",{children:e})]},e))})}const E3e={async search(s){const e=(s||"").toLowerCase().trim();if(!e)return[];const[t,i,r,n,a,o,l]=await Promise.all([Bt.database.list("Customer"),Bt.database.list("CoverProject"),Bt.database.list("Quote"),Bt.database.list("Order"),Bt.database.list("CompletedCover"),Bt.database.list("Prosthesis"),Bt.database.list("Shipment")]),c=[],u=h=>String(h||"").toLowerCase().includes(e);return t.forEach(h=>{(u(h.full_name)||u(h.customer_number)||u(h.email)||u(h.phone))&&c.push({type:"Customer",label:h.full_name,sub:h.customer_number,to:`/customers/${h.uuid}`,icon:"users"})}),i.forEach(h=>{(u(h.project_id)||u(h.prosthesis_configuration)||u(h.data_label))&&c.push({type:"Cover Project",label:h.project_id,sub:`Rev ${h.revision}`,to:`/projects/${h.uuid}`,icon:"folder"})}),r.forEach(h=>{u(h.quote_number)&&c.push({type:"Quote",label:h.quote_number,sub:h.approval_status,to:`/projects/${h.project_uuid}`,icon:"receipt"})}),n.forEach(h=>{u(h.order_number)&&c.push({type:"Order",label:h.order_number,sub:h.production_status,to:`/orders/${h.uuid}`,icon:"cart"})}),a.forEach(h=>{(u(h.cover_reference)||u(h.design_name))&&c.push({type:"Completed Cover",label:h.cover_reference,sub:h.design_name,to:`/completed-covers/${h.uuid}`,icon:"shield"})}),o.forEach(h=>{(u(h.manufacturer)||u(h.model))&&c.push({type:"Prosthesis",label:`${h.manufacturer} ${h.model}`,sub:h.name,to:`/customers/${h.customer_uuid}`,icon:"box"})}),l.forEach(h=>{(u(h.tracking_number)||u(h.shipment_reference))&&c.push({type:"Shipment",label:h.shipment_reference,sub:h.tracking_number,to:`/orders/${h.order_uuid}`,icon:"truck"})}),c.slice(0,30)}};function C3e(){const[s,e]=Te.useState(""),[t,i]=Te.useState([]),[r,n]=Te.useState(!1),a=Qm();Te.useEffect(()=>{let l=!0;if(!s.trim()){i([]);return}const c=setTimeout(async()=>{const u=await E3e.search(s);l&&(i(u),n(!0))},250);return()=>{l=!1,clearTimeout(c)}},[s]);const o=l=>{n(!1),e(""),a(l.to)};return g.jsxs("div",{className:"relative px-3 pb-2",children:[g.jsxs("div",{className:"relative",children:[g.jsx(jS,{className:"absolute left-3 top-2.5 h-4 w-4 text-slate-500"}),g.jsx("input",{className:"workshop-input mt-0 !min-h-9 pl-10 pr-8 text-sm",placeholder:"Search workshop records…",value:s,onChange:l=>e(l.target.value),onFocus:()=>t.length&&n(!0)}),g.jsx("button",{className:"absolute right-2 top-1.5 icon-btn !min-h-6 !min-w-6","aria-label":"Clear search",onClick:()=>{e(""),i([]),n(!1)},children:s&&g.jsx(m0,{className:"h-3.5 w-3.5"})})]}),r&&t.length>0&&g.jsx("div",{className:"absolute z-50 mt-1 max-h-80 w-[calc(100%-1.5rem)] overflow-y-auto rounded-xl border border-shire-border bg-shire-panel shadow-2xl",children:t.map((l,c)=>g.jsxs("button",{onClick:()=>o(l),className:"flex w-full items-center justify-between gap-2 border-b border-white/5 px-3 py-2 text-left text-sm hover:bg-shire-purple/10",children:[g.jsxs("span",{children:[g.jsx("span",{className:"font-medium text-violet-300",children:l.label}),g.jsx("span",{className:"ml-2 text-xs text-slate-500",children:l.sub})]}),g.jsx("span",{className:"text-xs text-slate-500",children:l.type})]},c))}),r&&s.trim()&&t.length===0&&g.jsx("div",{className:"absolute z-50 mt-1 w-[calc(100%-1.5rem)] rounded-xl border border-shire-border bg-shire-panel px-3 py-2 text-sm text-slate-500",children:"No matching records."})]})}function R3e({open:s,onClose:e}){return g.jsxs(g.Fragment,{children:[g.jsx("button",{"aria-label":"Close navigation",onClick:e,className:`fixed inset-0 z-30 bg-black/70 lg:hidden ${s?"block":"hidden"}`}),g.jsxs("aside",{className:`fixed inset-y-0 left-0 z-40 flex h-full min-h-0 w-72 flex-col overflow-hidden border-r border-white/10 bg-[#10151a] transition-transform lg:translate-x-0 ${s?"translate-x-0":"-translate-x-full"}`,children:[g.jsxs("div",{className:"flex h-24 shrink-0 items-center justify-between px-6",children:[g.jsxs("div",{children:[g.jsx("p",{className:"text-2xl font-black tracking-[0.12em] text-white",children:"SHiRE"}),g.jsx("p",{className:"text-xs uppercase tracking-[0.18em] text-violet-400",children:"LimbForge Workshop"})]}),g.jsx("button",{onClick:e,className:"touch-btn lg:hidden","aria-label":"Close navigation",children:g.jsx(m0,{})})]}),g.jsxs("div",{className:"mx-4 mb-4 shrink-0 rounded-xl border border-violet-400/20 bg-violet-400/5 px-4 py-3",children:[g.jsx("p",{className:"text-xs font-semibold text-violet-300",children:"WORKSHOP OWNER MODE"}),g.jsx("p",{className:"mt-1 text-xs text-slate-500",children:"Private authorised access"})]}),g.jsxs("div",{id:"limbforge-sidebar-scroll",className:"min-h-0 flex-1 overflow-x-hidden overflow-y-auto overscroll-contain",children:[g.jsx(C3e,{}),g.jsx(y3e,{onNavigate:e})]})]})]})}const I3e={theme:"dark",contrast:!1,reducedMotion:!1,largeTouch:!1},ZF={get:()=>({...I3e,...JSON.parse(localStorage.getItem("limbforge-settings")||"{}")}),save(s){localStorage.setItem("limbforge-settings",JSON.stringify(s)),document.documentElement.classList.toggle("dark",s.theme==="dark"),document.documentElement.classList.toggle("light",s.theme==="light"),document.documentElement.classList.toggle("high-contrast",s.contrast),document.documentElement.classList.toggle("reduce-motion",s.reducedMotion),document.documentElement.classList.toggle("large-touch",s.largeTouch)},apply(){this.save(this.get())}};function A3e(){const[s,e]=Te.useState(!1);return Te.useEffect(()=>{ZF.apply()},[]),g.jsxs("div",{className:"flex h-full min-h-0 w-full overflow-hidden bg-workshop",children:[g.jsx(R3e,{open:s,onClose:()=>e(!1)}),g.jsxs("div",{className:"flex h-full min-h-0 min-w-0 flex-1 flex-col lg:ml-72",children:[g.jsxs("header",{className:"z-20 flex h-16 shrink-0 items-center border-b border-white/10 bg-[#0b0f13]/90 px-4 backdrop-blur lg:hidden",children:[g.jsx("button",{className:"touch-btn",onClick:()=>e(!0),"aria-label":"Open workshop navigation",children:g.jsx(ime,{})}),g.jsx("span",{className:"ml-3 font-semibold text-white",children:"SHiRE LimbForge"})]}),g.jsx("main",{id:"limbforge-workspace-scroll",className:"min-h-0 min-w-0 flex-1 overflow-x-hidden overflow-y-auto overscroll-contain p-4 pb-24 sm:p-6 sm:pb-24 lg:p-8 lg:pb-24",children:g.jsx(W1e,{})})]})]})}function vc({eyebrow:s,title:e,description:t,action:i}){return g.jsxs("header",{className:"mb-6 flex flex-col gap-4 sm:flex-row sm:items-end sm:justify-between",children:[g.jsxs("div",{children:[g.jsx("p",{className:"mb-2 text-xs font-semibold uppercase tracking-[0.22em] text-violet-400",children:s}),g.jsx("h1",{className:"text-3xl font-semibold tracking-tight text-white sm:text-4xl",children:e}),t&&g.jsx("p",{className:"mt-2 max-w-3xl text-sm leading-6 text-slate-400",children:t})]}),i]})}const Ame="Non-load-bearing cosmetic prosthetic cover only. It is not part of the prosthesis, must not support body weight, alter alignment, obstruct safety systems or replace any component. Manual review is required before printing.";function _0({compact:s=!1}){return g.jsx("div",{role:"note",className:"rounded-2xl border border-amber-400/30 bg-amber-400/10 p-4 text-amber-100",children:g.jsxs("div",{className:"flex gap-3",children:[g.jsx(qp,{className:"mt-0.5 h-5 w-5 shrink-0","aria-hidden":"true"}),g.jsxs("div",{children:[g.jsx("strong",{className:"text-amber-300",children:"Workshop safety boundary"}),!s&&g.jsx("p",{className:"mt-1 text-sm leading-6 text-amber-50/80",children:Ame})]})]})})}function dh({label:s="Loading workshop records"}){return g.jsxs("div",{className:"flex min-h-48 items-center justify-center gap-3 text-slate-400",role:"status",children:[g.jsx(f2e,{className:"h-5 w-5 animate-spin"}),g.jsx("span",{children:s})]})}function WP({label:s,value:e,to:t,detail:i}){return g.jsxs(Ar,{to:t,className:"panel group block p-5 transition hover:-translate-y-0.5 hover:border-violet-400/30 focus-visible:ring-2 focus-visible:ring-violet-400",children:[g.jsxs("div",{className:"flex items-start justify-between",children:[g.jsx("p",{className:"text-sm leading-5 text-slate-400",children:s}),g.jsx(Ype,{className:"h-4 w-4 text-slate-600 transition group-hover:text-violet-400"})]}),g.jsx("p",{className:"mt-4 text-3xl font-semibold tabular-nums text-white",children:e}),i&&g.jsx("p",{className:"mt-2 text-xs text-slate-500",children:i})]})}const P3e={async summary(){const[s,e,t]=await Promise.all([Bt.database.list("CoverProject"),Bt.database.list("MeasurementSession"),Bt.database.list("Customer")]),i=n=>s.filter(a=>a.record_state==="active"&&a.status===n).length,r=s.reduce((n,a)=>({...n,[a.customer_uuid]:(n[a.customer_uuid]||0)+1}),{});return{projects:s,customers:t,active:s.filter(n=>n.record_state==="active"&&n.status!=="Complete").length,measurements:e.filter(n=>n.status!=="Complete").length,clarification:i("Awaiting customer clarification"),selection:i("Designs awaiting selection"),review:i("Awaiting workshop review"),completed:s.filter(n=>n.status==="Complete").slice(0,5),returning:Object.values(r).filter(n=>n>1).length}}};function M3e(){const[s,e]=Te.useState(null);if(Te.useEffect(()=>{P3e.summary().then(e)},[]),!s)return g.jsx(dh,{});const t=[["Active cover projects",s.active,"/projects?active=true"],["Measurements awaiting completion",s.measurements,"/measurements?status=open"],["Awaiting customer clarification",s.clarification,"/projects?status=Awaiting+customer+clarification"],["Designs awaiting selection",s.selection,"/projects?status=Designs+awaiting+selection"],["Awaiting workshop review",s.review,"/projects?status=Awaiting+workshop+review"],["Quotes awaiting acceptance",0,"/not-implemented?feature=Quotes"],["Orders awaiting payment",0,"/not-implemented?feature=Orders"],["NDIS / plan approval",0,"/not-implemented?feature=Orders"],["Covers awaiting print",0,"/not-implemented?feature=Manufacturing"],["Currently printing",0,"/not-implemented?feature=Manufacturing"],["Awaiting final inspection",0,"/not-implemented?feature=Manufacturing"],["Ready to ship",0,"/not-implemented?feature=Shipping"],["Recently completed",s.completed.length,"/projects?status=Complete"],["Returning customers",s.returning,"/customers?returning=true"]];return g.jsxs(g.Fragment,{children:[g.jsx(vc,{eyebrow:"Private Prosthetic Cover Design and Production Studio",title:"Workshop Dashboard",description:"Live workshop records. Production areas not yet built show zero and are explicitly marked on opening."}),g.jsx(_0,{}),g.jsx("div",{className:"mt-6 grid gap-4 sm:grid-cols-2 xl:grid-cols-4",children:t.map(i=>g.jsx(WP,{label:i[0],value:i[1],to:i[2]},i[0]))}),g.jsxs("div",{className:"mt-6 grid gap-4 md:grid-cols-3",children:[g.jsx(WP,{label:"SHiREVault connection",value:"Unavailable",detail:"Base44 cannot mount the private network drive",to:"/migration-readiness"}),g.jsx(WP,{label:"Last verified export",value:"None",detail:"Not yet implemented — Stage 4",to:"/migration-readiness"}),g.jsx(WP,{label:"Last verified backup",value:"None",detail:"Not claimed while Base44-hosted",to:"/migration-readiness"})]})]})}function hr({children:s,tone:e="cyan"}){const t={cyan:"border-violet-400/30 bg-violet-400/10 text-violet-300",amber:"border-amber-400/30 bg-amber-400/10 text-amber-300",green:"border-emerald-400/30 bg-emerald-400/10 text-emerald-300",red:"border-red-400/30 bg-red-400/10 text-red-300",slate:"border-slate-600 bg-slate-800 text-slate-300"};return g.jsx("span",{className:`inline-flex rounded-full border px-2.5 py-1 text-xs font-semibold ${t[e]}`,children:s})}const W0={customerCounts:async s=>{const[e,t,i,r]=await Promise.all([Bt.database.filter("LimbProfile",{customer_uuid:s}),Bt.database.filter("CoverProject",{customer_uuid:s}),Bt.database.filter("Order",{customer_uuid:s}),Bt.database.filter("CompletedCover",{customer_uuid:s})]);return{limbs:e.length,projects:t.length,orders:i.length,covers:r.length}},isFictional:s=>{const e=s&&s.data_origin;return e==="Fictional Test Data"||e==="Fictional"},hideFictional:s=>(s||[]).filter(e=>!W0.isFictional(e))};function $S({record:s,showAll:e=!1}){return s?W0.isFictional(s)?g.jsx(hr,{tone:"red",children:"FICTIONAL TEST DATA"}):e&&s.data_origin&&s.data_origin!=="Workshop Created"?g.jsx(hr,{tone:"slate",children:s.data_origin}):s.data_origin==="Public Intake"?g.jsx(hr,{tone:"green",children:"Public Intake"}):null:null}function D3e({customer:s,counts:e,onToggle:t}){const i=s.record_state==="archived",r=((e==null?void 0:e.projects)||0)>0||((e==null?void 0:e.covers)||0)>0;return g.jsxs(Ar,{to:`/customers/${s.uuid}`,className:"panel block p-5 transition hover:border-shire-purple/40",children:[g.jsxs("div",{className:"flex items-start justify-between gap-3",children:[g.jsxs("div",{children:[g.jsx("p",{className:"text-xs font-semibold text-violet-400",children:s.customer_number}),g.jsx("h2",{className:"mt-1 text-lg font-semibold text-white",children:s.full_name}),s.preferred_name&&s.preferred_name!==s.full_name&&g.jsxs("p",{className:"text-xs text-slate-500",children:["Prefers ",s.preferred_name]})]}),g.jsxs("div",{className:"flex flex-col items-end gap-1",children:[g.jsx(hr,{tone:i?"slate":"green",children:i?"Archived":"Active"}),r&&g.jsx(hr,{tone:"cyan",children:"Returning"}),g.jsx($S,{record:s})]})]}),g.jsxs("dl",{className:"mt-4 grid grid-cols-2 gap-x-4 gap-y-1 text-sm text-slate-400",children:[g.jsx("dt",{className:"text-slate-500",children:"Email"}),g.jsx("dd",{className:"truncate",children:s.email||"—"}),g.jsx("dt",{className:"text-slate-500",children:"Phone"}),g.jsx("dd",{children:s.phone||"—"}),g.jsx("dt",{className:"text-slate-500",children:"Funding"}),g.jsx("dd",{children:s.funding_method||"—"}),g.jsx("dt",{className:"text-slate-500",children:"Location"}),g.jsx("dd",{className:"truncate",children:s.address||"—"})]}),g.jsx("div",{className:"mt-4 flex flex-wrap gap-2 text-xs",children:[["Limb profiles",e==null?void 0:e.limbs],["Projects",e==null?void 0:e.projects],["Orders",e==null?void 0:e.orders],["Covers",e==null?void 0:e.covers]].map(([n,a])=>g.jsxs("span",{className:"rounded-md border border-white/10 bg-white/5 px-2 py-1 text-slate-300",children:[n,": ",g.jsx("span",{className:"font-semibold text-violet-300",children:a||0})]},n))}),g.jsxs("div",{className:"mt-4 flex items-center gap-2",children:[g.jsxs("span",{className:"btn-primary flex-1 text-center text-sm",children:[g.jsx(Jpe,{}),"Open Customer"]}),t&&g.jsx("button",{onClick:n=>{n.preventDefault(),t(s)},className:"icon-btn","aria-label":i?"Restore customer":"Archive customer",children:i?g.jsx(Zp,{}):g.jsx(WS,{})})]})]})}function Z8({field:s,value:e,onChange:t}){const[i,r,n,a]=s,o={id:i,value:e||"",onChange:l=>t(i,l.target.value),className:"workshop-input",required:a===!0};return g.jsxs("label",{className:"block text-sm text-slate-300",htmlFor:i,children:[r,a===!0&&g.jsx("span",{className:"text-violet-400",children:" *"}),n==="select"?g.jsxs("select",{...o,children:[g.jsx("option",{value:"",children:"Select…"}),a.map(l=>g.jsx("option",{children:l},l))]}):g.jsx("input",{...o,type:n})]})}const O3e=[["full_name","Full name","text",!0],["preferred_name","Preferred name","text"],["date_of_birth","Date of birth","date"],["email","Email","email"],["phone","Phone","tel"],["address","Address","text"],["shipping_address","Shipping address","text"],["preferred_contact_method","Preferred contact method","select",["Email","Phone","SMS"]],["emergency_contact","Emergency contact","text"],["pronouns","Pronouns","text"]],w3e=[["funding_method","Funding method","select",["Private payer","Self-managed NDIS","Plan-managed NDIS","NDIA-managed","Quote-only"]],["ndis_number","NDIS number","text"],["plan_dates","Plan dates","text"],["plan_manager_name","Plan manager name","text"],["plan_manager_email","Plan manager email","email"],["plan_manager_phone","Plan manager phone","tel"],["billing_contact","Billing contact","text"],["purchase_order_number","Purchase-order number","text"],["approval_status","Approval status","select",["Not requested","Quote requested","Evidence requested","Submitted","Awaiting approval","Approved","Partially approved","Declined","Customer paying privately"]]];function Pme({initial:s={},onSave:e,onCancel:t}){const[i,r]=Te.useState(s),[n,a]=Te.useState(!1),o=(c,u)=>r({...i,[c]:u}),l=async c=>{c.preventDefault(),a(!0),await e(i),a(!1)};return g.jsxs("form",{onSubmit:l,className:"space-y-6",children:[g.jsxs("section",{children:[g.jsx("h2",{className:"section-title",children:"Identity & contact"}),g.jsx("div",{className:"grid gap-4 md:grid-cols-2",children:O3e.map(c=>g.jsx(Z8,{field:c,value:i[c[0]],onChange:o},c[0]))})]}),g.jsxs("section",{children:[g.jsx("h2",{className:"section-title",children:"Funding & invoicing"}),g.jsx("div",{className:"grid gap-4 md:grid-cols-2",children:w3e.map(c=>g.jsx(Z8,{field:c,value:i[c[0]],onChange:o},c[0]))})]}),g.jsxs("label",{className:"block text-sm text-slate-300",children:["Internal notes",g.jsx("textarea",{className:"workshop-input min-h-24",value:i.internal_notes||"",onChange:c=>o("internal_notes",c.target.value)})]}),g.jsxs("div",{className:"flex justify-end gap-3",children:[g.jsx("button",{type:"button",onClick:t,className:"btn-secondary",children:"Cancel"}),g.jsx("button",{disabled:n,className:"btn-primary",children:n?"Saving…":"Save customer"})]})]})}function KO({value:s,onChange:e,label:t="Hide Fictional Test Data"}){return g.jsxs("label",{className:"choice-card !min-h-9 cursor-pointer",children:[g.jsx("input",{type:"checkbox",checked:s,onChange:i=>e(i.target.checked)}),g.jsx("span",{className:"text-xs text-slate-300",children:t})]})}const mr={list:()=>Bt.database.list("AuditEvent"),record:(s,e,t,i,r="Workshop Owner",n="")=>Bt.database.create("AuditEvent",{uuid:Ka("audit"),event_type:s,record_type:e,record_uuid:t,actor_name:r,summary:i,details:n,migration_version:1})},So={list:()=>Bt.database.list("Customer"),get:async s=>(await Bt.database.filter("Customer",{uuid:s},"-updated_date",1))[0],history:async s=>({limbs:await Bt.database.filter("LimbProfile",{customer_uuid:s}),prostheses:await Bt.database.filter("Prosthesis",{customer_uuid:s}),projects:await Bt.database.filter("CoverProject",{customer_uuid:s})}),async create(s,e){const t=await Bt.database.create("Customer",{...s,uuid:Ka("cust"),customer_number:`SLC-${Date.now().toString().slice(-6)}`,data_label:s.data_label||"WORKSHOP RECORD",...ho(e)});return await mr.record("customer_created","Customer",t.uuid,`Created customer ${t.customer_number}`,e),t},async update(s,e,t,i){const{id:r,created_date:n,updated_date:a,created_by_id:o,...l}=t,c=await Bt.database.update("Customer",s,{...l,updated_by_name:i});return await mr.record("customer_edited","Customer",e,"Customer details updated",i),c},archive:async(s,e)=>(await Bt.database.archive("Customer",s.id),mr.record("customer_archived","Customer",s.uuid,"Customer archived",e)),restore:async(s,e)=>(await Bt.database.restore("Customer",s.id),mr.record("customer_restored","Customer",s.uuid,"Customer restored",e)),async createLimb(s,e){const t=await Bt.database.create("LimbProfile",{...s,uuid:Ka("limb"),...ho(e)});return await mr.record("limb_profile_created","LimbProfile",t.uuid,`Created ${t.profile_name}`,e),t},async createProsthesis(s,e){const t=await Bt.database.create("Prosthesis",{...s,uuid:Ka("pros"),status:"active",...ho(e)});return await mr.record("prosthesis_created","Prosthesis",t.uuid,`Created ${t.name}`,e),t}},Mme="none",z5="dual_cone",W5="legacy_abutment",N3e=[z5,W5],L3e=s=>N3e.includes(s),F3e=(s={})=>s.interface_type?s.interface_type==="Osseointegration":s.osseointegration===!0,K8=s=>s===z5?"OI — Dual Cone":s===W5?"OI — Legacy abutment":"Conventional prosthesis",B3e=(s={})=>F3e(s)?L3e(s.oi_type)?{ok:!0,osseointegration:!0,oiType:s.oi_type}:{ok:!1,osseointegration:!0,oiType:"",error:"Choose either Dual Cone or Legacy / older-style abutment before continuing."}:{ok:!0,osseointegration:!1,oiType:Mme},H5=(s={})=>{const e=B3e(s);if(!e.ok)throw new Error(e.error);return{...s,osseointegration:e.osseointegration,oi_type:e.osseointegration?e.oiType:Mme}},k3e=(s,e)=>{const t=s.interface_type||(e==null?void 0:e.interface_type)||"",i=s.limb_region||(e==null?void 0:e.limb_region)||"",r=s.amputation_level||(e==null?void 0:e.amputation_level)||(e==null?void 0:e.configuration)||"";return t==="Osseointegration"?"Osseointegration":i==="Upper limb"||/elbow|wrist|shoulder/i.test(r)?"Upper limb":/above-knee|knee disarticulation|hip disarticulation/i.test(r)?"Knee component":"Lower leg"},au={list:()=>Bt.database.list("CoverProject"),get:async s=>(await Bt.database.filter("CoverProject",{uuid:s},"-updated_date",1))[0],filter:s=>Bt.database.filter("CoverProject",s),async create(s,e){var c,u;s=H5(s);const{id:t,created_date:i,updated_date:r,created_by_id:n,...a}=s,o=Ka("proj"),l=await Bt.database.create("CoverProject",{...a,uuid:o,project_id:`SLC-${new Date().getFullYear()}-${Date.now().toString().slice(-5)}`,revision:1,storage_destination:`/SHiREVault/SHiRELimbs/Projects/${o}`,safety_boundary_accepted:!0,component_verification_status:s.components_pending?"Unknown - add and verify before manufacturing":s.component_verification_status||"Selected - verification required",manufacturing_release_blocked:s.components_pending===!0,manufacturing_release_reason:s.components_pending?"Receiving prosthetic components and approved external attachment regions are not yet verified.":"",...ho(e),revision:s.revision||1});if((c=s.measurement_method)!=null&&c.includes("Manual")||(u=s.measurement_method)!=null&&u.includes("Combination")){const h=(await Bt.database.filter("LimbProfile",{uuid:s.limb_profile_uuid},"-updated_date",1))[0],d=k3e(s,h);await Bt.database.create("MeasurementSession",{uuid:Ka("session"),project_uuid:o,customer_uuid:s.customer_uuid,limb_profile_uuid:s.limb_profile_uuid,workflow:d,status:"Not started",measured_by:e,measured_date:new Date().toISOString().slice(0,10),progress_percent:0,...ho(e)})}return await mr.record("project_created","CoverProject",o,`Created cover project ${l.project_id}`,e,s.components_pending?"Non-load-bearing cosmetic cover only. Component details remain unverified and manufacturing release is blocked.":"Non-load-bearing cosmetic prosthetic cover only. Manual review required."),l},duplicate:async(s,e)=>au.create({...s,id:void 0,project_id:void 0,revision:s.revision+1,status:"Awaiting measurements",reason_for_cover:`Revision of ${s.project_id}`},e),archive:async(s,e="Ray")=>(await Bt.database.archive("CoverProject",s.id),mr.record("project_archived","CoverProject",s.uuid,`Archived ${s.project_id}`,e)),restore:async(s,e="Ray")=>(await Bt.database.restore("CoverProject",s.id),mr.record("project_restored","CoverProject",s.uuid,`Restored ${s.project_id}`,e))},WR={list:()=>Bt.database.list("Quote"),forProject:s=>Bt.database.filter("Quote",{project_uuid:s}),forCustomer:s=>Bt.database.filter("Quote",{customer_uuid:s}),get:async s=>(await Bt.database.filter("Quote",{uuid:s},"-updated_date",1))[0],async create(s,e){const t=await Bt.database.create("Quote",{...s,uuid:Ka("quote"),quote_number:`Q-${Date.now().toString().slice(-6)}`,approval_status:s.approval_status||"Draft",data_origin:s.data_origin||"Workshop Created",...ho(e)});return await mr.record("quote_created","Quote",t.uuid,`Created quote ${t.quote_number}`,e),t},async update(s,e,t,i){const{id:r,created_date:n,updated_date:a,created_by_id:o,...l}=t,c=await Bt.database.update("Quote",s,{...l,updated_by_name:i});return await mr.record("quote_updated","Quote",e,"Quote updated",i),c},async approve(s,e,t){return await Bt.database.update("Quote",s,{approval_status:"Approved",updated_by_name:t}),mr.record("quote_approved","Quote",e,"Quote approved",t)},async send(s,e,t){return await Bt.database.update("Quote",s,{approval_status:"Sent",sent_date:new Date().toISOString().slice(0,10),updated_by_name:t}),mr.record("quote_sent","Quote",e,"Quote sent to customer",t)},archive:async(s,e)=>(await Bt.database.archive("Quote",s.id),mr.record("quote_archived","Quote",s.uuid,"Quote archived",e)),restore:async(s,e)=>(await Bt.database.restore("Quote",s.id),mr.record("quote_restored","Quote",s.uuid,"Quote restored",e))},DS={list:()=>Bt.database.list("Order"),forProject:s=>Bt.database.filter("Order",{project_uuid:s}),forCustomer:s=>Bt.database.filter("Order",{customer_uuid:s}),get:async s=>(await Bt.database.filter("Order",{uuid:s},"-updated_date",1))[0],async create(s,e){const t=await Bt.database.create("Order",{...s,uuid:Ka("order"),order_number:`ORD-${Date.now().toString().slice(-6)}`,order_date:s.order_date||new Date().toISOString().slice(0,10),production_status:s.production_status||"Awaiting measurements",shipping_status:s.shipping_status||"Not started",payment_status:s.payment_status||"Unpaid",funding_approval_status:s.funding_approval_status||"Not requested",invoice_status:s.invoice_status||"Not issued",deposit:s.deposit||0,balance:s.balance||s.quote_amount||0,data_origin:s.data_origin||"Workshop Created",...ho(e)});return await mr.record("order_created","Order",t.uuid,`Created order ${t.order_number}`,e),t},async createFromQuote(s,e,t){return DS.create({project_uuid:e.uuid,customer_uuid:e.customer_uuid,quote_uuid:s.uuid,cover_revision:e.revision,funding_type:s.funding_type,quote_amount:s.amount,balance:s.amount},t)},async update(s,e,t,i){const{id:r,created_date:n,updated_date:a,created_by_id:o,...l}=t,c=await Bt.database.update("Order",s,{...l,updated_by_name:i});return await mr.record("order_updated","Order",e,"Order updated",i),c},async setStatus(s,e,t,i){return await Bt.database.update("Order",s,{production_status:t,updated_by_name:i}),mr.record("order_status_changed","Order",e,`Production status → ${t}`,i)},async recordPayment(s,e,t,i){const r=(await Bt.database.filter("Order",{uuid:e},"-updated_date",1))[0],n=(r.deposit||0)+Number(t),a=r.quote_amount||0,o=Math.max(0,a-n),l=o<=0?"Paid":n>0?"Deposit paid":"Unpaid";return await Bt.database.update("Order",s,{deposit:n,balance:o,payment_status:l,updated_by_name:i}),mr.record("payment_recorded","Order",e,`Payment of ${t} recorded`,i)},async cancel(s,e,t,i){return await Bt.database.update("Order",s,{production_status:"Awaiting measurements",cancel_reason:t,record_state:"archived",updated_by_name:i}),mr.record("order_cancelled","Order",e,`Order cancelled: ${t}`,i)},archive:async(s,e)=>(await Bt.database.archive("Order",s.id),mr.record("order_archived","Order",s.uuid,"Order archived",e)),restore:async(s,e)=>(await Bt.database.restore("Order",s.id),mr.record("order_restored","Order",s.uuid,"Order restored",e)),prepareQuote:(s,e)=>WR.create({project_uuid:s.uuid,customer_uuid:s.customer_uuid,amount:0,funding_type:"Quote-only"},e)},j5=["Minimal","Elegant Anatomical","Gothic","Biomechanical","Cybernetic","Industrial","Skeletal","Organic","Geometric","Futuristic","Steampunk","Floral","Child Friendly","Sports Inspired","Custom"],Dme=["Subtle","Moderate","Aggressive","Custom"],V3e=["symmetric","left asymmetric","right asymmetric","mirror accents","independent medial lateral"],Ome=["smooth shell","segmented shell","ribbed shell","panelled shell","vent-accent shell","skeletal accent shell","geometric accent shell","organic flowing accent shell"],wme=["none","segmented shell","ribbed shell","panelled shell","vent-accent shell","skeletal accent shell","geometric accent shell","organic flowing accent shell"],Nme=["none","smooth","segmented","flowing anatomical","gothic panel","biomechanical","geometric","ribbed","skeletal","organic vein","industrial vent","hexagonal","diamond","floral linework","star pattern","custom reference"],Lme=["clean modern","technical","gothic","elegant","bold","minimal"],X5=["front","front-lateral","outer-lateral","rear-lateral","rear","upper calf","mid calf","lower calf"],Fme=["front","front-lateral","outer-lateral","rear-lateral","rear"],H_=["black","graphite","purple","green","red","silver","white","custom"],Bme=["matte","satin","gloss concept"],kme=["small","medium","large"],Vme=["small","medium","large"];function iO(s){return{design_category:"Minimal",design_intensity:"Subtle",primary_style:"smooth shell",accent_style:"none",accent_density:"subtle",symmetry:"symmetric",detail_panel_layering:!1,detail_raised_ribs:!1,detail_recessed_channels:!1,detail_engraving_concept:!1,detail_raised_ornament:!1,main_colour:"black",accent_colour:"purple",logo_colour:"silver",text_colour:"silver",finish:"matte",custom_text_enabled:!1,custom_text:"",text_style:"clean modern",text_placement:"outer-lateral",text_orientation:"horizontal",text_size:"medium",text_raised:!0,text_depth:"shallow",logo_placement:"outer-lateral",logo_size:"medium",logo_orientation_validated:!0,pattern_style:"none",pattern_scale:"medium",pattern_density:"moderate",pattern_rotation_degrees:0,pattern_placement_region:"outer-lateral",pattern_raised:!0,vent_concept:"",surface_notes:"",inspiration_notes:"",reference_image_urls:[],concept_status:"Draft",approved_for_quote:!1}}function Q8(s,e,t){const i=[];return s.logo_placement||i.push({level:"blocked",text:"SHiRE logo placement not set — mandatory branding missing"}),s.logo_orientation_validated===!1&&i.push({level:"blocked",text:"SHiRE logo orientation is MIRRORED — must be corrected before approval"}),s.logo_size||i.push({level:"warning",text:"Logo size not set"}),e&&e.cover_boundaries&&s.logo_placement==="rear"&&i.push({level:"warning",text:"Logo on rear face — verify it does not cross a seam or cover boundary"}),t&&(s.logo_placement==="outer-lateral"||s.logo_placement==="front-lateral")&&((t.medial_offset_mm||0)>=0?"lateral":"medial")==="lateral"&&i.push({level:"warning",text:"Logo on lateral face — verify it does not overlap the Ossiguard connector body"}),e&&e.sensitive_area_summary&&s.logo_placement==="front"&&i.push({level:"warning",text:"Logo on front face — verify it does not overlap a sensitive zone"}),i}function U3e(s,e,t){const i=[];if(!s.custom_text_enabled)return i;const r=(s.custom_text||"").trim();return r||i.push({level:"warning",text:"Custom text enabled but no text entered"}),r.length>40?i.push({level:"blocked",text:"Custom text too long (max 40 characters)"}):r.length>24&&i.push({level:"warning",text:"Custom text is long — visual quality may reduce"}),r.length>0&&r.length<2&&i.push({level:"warning",text:"Custom text is very short — may not be legible"}),s.text_placement||i.push({level:"warning",text:"Custom text placement not set"}),s.text_placement&&s.logo_placement&&s.text_placement===s.logo_placement&&i.push({level:"warning",text:"Custom text overlaps SHiRE logo placement region"}),t&&(s.text_placement==="outer-lateral"||s.text_placement==="front-lateral")&&i.push({level:"warning",text:"Verify custom text does not intersect Ossiguard access or fastener clearance"}),e&&e.sensitive_area_summary&&s.custom_text_enabled&&i.push({level:"warning",text:"Verify custom text does not overlap sensitive zones described in the project brief"}),s.symmetry==="mirror accents"&&s.text_placement&&i.push({level:"warning",text:"Mirror-accent symmetry does not mirror readable text or logos — text remains single-sided"}),i}function G3e(s,e,t){const i=[];if(!t)return i;const r=(t.medial_offset_mm||0)>=0?"lateral":"medial";return s.pattern_style&&s.pattern_style!=="none"&&s.pattern_placement_region==="outer-lateral"&&r==="lateral"&&i.push({level:"warning",text:"Exterior pattern on connector side — verify it does not obstruct Ossiguard insertion/removal path"}),s.detail_access_door_styling&&r==="lateral"&&i.push({level:"warning",text:"Access-door styling near connector — verify fastener access and release path remain unobstructed"}),t.panel_opening_required&&s.pattern_style&&s.pattern_style!=="none"&&i.push({level:"warning",text:"Panel opening required for Ossiguard — verify pattern does not block the opening"}),i}const ua={list:()=>Bt.database.list("DesignConfiguration"),forProject:s=>Bt.database.filter("DesignConfiguration",{project_uuid:s},"-version"),getConcepts:s=>Bt.database.filter("DesignConfiguration",{project_uuid:s},"-version"),getCurrent:async s=>(await Bt.database.filter("DesignConfiguration",{project_uuid:s,is_current:!0},"-version",1))[0]||null,get:async s=>(await Bt.database.filter("DesignConfiguration",{uuid:s},"-updated_date",1))[0],async create(s,e){const t=await Bt.database.filter("DesignConfiguration",{project_uuid:s.project_uuid}),i=(t.length?Math.max(...t.map(n=>n.version||0)):0)+1,r=await Bt.database.create("DesignConfiguration",{...s,uuid:Ka("design"),version:i,is_current:!0,validation_status:s.validation_status||"Warning",validation_issues:s.validation_issues||[],...ho(e)});for(const n of t)n.id!==r.id&&n.is_current&&await Bt.database.update("DesignConfiguration",n.id,{is_current:!1,updated_by_name:e});return await mr.record("design_created","DesignConfiguration",r.uuid,`Design revision v${i} created`,e),r},async update(s,e,t,i){const{id:r,created_date:n,updated_date:a,created_by_id:o,...l}=t,c=ua.validate({...l}),u=await Bt.database.update("DesignConfiguration",s,{...l,validation_status:c.status,validation_issues:c.issues,updated_by_name:i});return await mr.record("design_updated","DesignConfiguration",e,"Design configuration updated",i),u},async saveRevision(s,e,t){const i=await Bt.database.filter("DesignConfiguration",{project_uuid:s}),r=(i.length?Math.max(...i.map(o=>o.version||0)):0)+1,n=ua.validate(e),a=await Bt.database.create("DesignConfiguration",{...e,uuid:Ka("design"),project_uuid:s,version:r,is_current:!0,validation_status:n.status,validation_issues:n.issues,...ho(t)});for(const o of i)o.id!==a.id&&o.is_current&&await Bt.database.update("DesignConfiguration",o.id,{is_current:!1,updated_by_name:t});return await mr.record("design_revision_saved","DesignConfiguration",a.uuid,`Design revision v${r} saved`,t),a},async duplicate(s,e){const t=await ua.getCurrent(s);if(!t)return null;const{id:i,uuid:r,created_date:n,updated_date:a,created_by_id:o,version:l,is_current:c,...u}=t;return ua.saveRevision(s,u,e)},async restore(s,e){const t=await ua.get(s);if(!t)return null;const i=await Bt.database.filter("DesignConfiguration",{project_uuid:t.project_uuid});for(const r of i)await Bt.database.update("DesignConfiguration",r.id,{is_current:r.uuid===s,updated_by_name:e});return await mr.record("design_restored","DesignConfiguration",s,`Design revision v${t.version} restored as current`,e),ua.get(s)},async approveForQuote(s,e){const t=await ua.get(s);if(!t)return null;const i=ua.validate(t);if(i.status==="Blocked")return{error:"Cannot approve — blocking validation failures remain",validation:i};const r=await Bt.database.update("DesignConfiguration",t.id,{approved_for_quote:!0,concept_status:"Approved for Quote",approved_design_uuid:s,updated_by_name:e});return await mr.record("design_approved","DesignConfiguration",s,"Design approved for quote (not CAD/print ready)",e),r},async copyToProject(s,e,t){const i=await ua.getCurrent(s);if(!i)return null;const{id:r,uuid:n,created_date:a,updated_date:o,created_by_id:l,version:c,is_current:u,project_uuid:h,...d}=i;return ua.saveRevision(e,d,t)},async setConceptStatus(s,e,t){const i=await ua.get(s);if(!i)return null;const r=await Bt.database.update("DesignConfiguration",i.id,{concept_status:e,updated_by_name:t});return await mr.record("concept_status","DesignConfiguration",s,`Concept status set to ${e}`,t),r},async recordFeedback(s,e,t){const i=await ua.get(s);if(!i)return null;const r=await Bt.database.update("DesignConfiguration",i.id,{customer_feedback:e,updated_by_name:t});return await mr.record("concept_feedback","DesignConfiguration",s,"Customer feedback recorded",t),r},async createConcept(s,e,t){const i=await Bt.database.filter("DesignConfiguration",{project_uuid:s}),r=(i.length?Math.max(...i.map(a=>a.version||0)):0)+1,n=await Bt.database.create("DesignConfiguration",{...e,uuid:Ka("design"),project_uuid:s,version:r,is_current:!1,concept_status:e.concept_status||"Draft",validation_status:"Warning",validation_issues:[],...ho(t)});return await mr.record("concept_created","DesignConfiguration",n.uuid,`Concept "${e.concept_name||"Untitled"}" created`,t),n},validate(s,e,t){const i=[];if(!s)return{status:"Blocked",issues:["No design configuration saved"]};s.main_colour||i.push({level:"warning",text:"Main cover colour not set"}),s.accent_colour||i.push({level:"warning",text:"Accent colour not set"}),i.push(...Q8(s,e,t)),i.push(...U3e(s,e,t)),i.push(...G3e(s,e,t));const r=i.some(o=>o.level==="blocked"),n=i.some(o=>o.level==="warning");return{status:r?"Blocked":n?"Warning":"Pass",issues:i.map(o=>o.text),issueObjects:i}},logoValidation(s,e,t){const i=Q8(s,e,t),r=i.some(n=>n.text.toLowerCase().includes("mirrored"));return{present:!!s.logo_placement,readable:!!s.logo_size,orientationCorrect:s.logo_orientation_validated!==!1,notMirrored:!r,exteriorFacing:!0,sizeAcceptable:!!s.logo_size,issues:i,level:i.some(n=>n.level==="blocked")?"blocked":i.some(n=>n.level==="warning")?"warning":"pass"}},status:()=>({implemented:!0,label:"Design Forge active",boundary:"Design elements are conceptual preview only — not manufacturing-ready CAD geometry."})},td={list:()=>Bt.database.list("CompletedCover"),forCustomer:s=>Bt.database.filter("CompletedCover",{customer_uuid:s}),forProject:s=>Bt.database.filter("CompletedCover",{project_uuid:s}),get:async s=>(await Bt.database.filter("CompletedCover",{uuid:s},"-updated_date",1))[0],async create(s,e){const t=await Bt.database.create("CompletedCover",{...s,uuid:Ka("cover"),cover_reference:`SHC-${Date.now().toString().slice(-6)}`,data_origin:s.data_origin||"Workshop Created",reorder_status:"Not reordered",...ho(e)});return await mr.record("cover_completed","CompletedCover",t.uuid,`Completed cover ${t.cover_reference}`,e),t},async update(s,e,t,i){const{id:r,created_date:n,updated_date:a,created_by_id:o,...l}=t;return await Bt.database.update("CompletedCover",s,{...l,updated_by_name:i})},async reorder(s,e){const t=await DS.create({project_uuid:s.project_uuid,customer_uuid:s.customer_uuid,cover_revision:s.revision||1,funding_type:"Private payer",quote_amount:0,balance:0,production_status:"Ready for CAD"},e);return await td.update(s.id,s.uuid,{reorder_status:"Reordered"},e),await mr.record("cover_reorder","CompletedCover",s.uuid,`Reorder placed as ${t.order_number}`,e),{order:t,cover:s}},async newDesignFromFit(s,e,t){const{id:i,created_date:r,updated_date:n,created_by_id:a,...o}=e,l=await Bt.database.create("CoverProject",{...o,uuid:Ka("proj"),project_id:`${e.project_id}-R${(e.revision||1)+1}`,revision:(e.revision||1)+1,status:"Ready for design",reason_for_cover:`New design using fit from ${s.cover_reference}`,data_origin:"Workshop Created",...ho(t)});await mr.record("project_revision_created","CoverProject",l.uuid,`New revision ${l.project_id} from ${s.cover_reference}`,t);try{await ua.copyToProject(e.uuid,l.uuid,t)}catch{}return l},async replace(s,e){const t=await DS.create({project_uuid:s.project_uuid,customer_uuid:s.customer_uuid,cover_revision:s.revision||1,funding_type:"Private payer",quote_amount:0,balance:0,production_status:"Ready for CAD"},e);return await td.update(s.id,s.uuid,{reorder_status:"Replacement in progress"},e),await mr.record("cover_replacement","CompletedCover",s.uuid,`Replacement order ${t.order_number}`,e),t},async reportFitIssue(s,e,t){return await td.update(s.id,s.uuid,{fit_review_result:"Refit required",notes:(s.notes?s.notes+`
000544: `:"")+"Fit issue: "+e},t),mr.record("fit_issue_reported","CompletedCover",s.uuid,`Fit issue reported: ${e}`,t)},archive:async(s,e)=>(await Bt.database.archive("CompletedCover",s.id),mr.record("cover_archived","CompletedCover",s.uuid,"Cover archived",e)),restore:async(s,e)=>(await Bt.database.restore("CompletedCover",s.id),mr.record("cover_restored","CompletedCover",s.uuid,"Cover restored",e))},z3e=["All","New customers","Returning customers","Active projects","Awaiting measurements","Awaiting quote","Current orders","Completed customers","Archived"],W3e=["Recent activity","Name (A–Z)","Customer number"];function H3e(){const[s,e]=Te.useState([]),[t,i]=Te.useState([]),[r,n]=Te.useState([]),[a,o]=Te.useState([]),[l,c]=Te.useState([]),[u,h]=Te.useState(""),[d,f]=Te.useState("All"),[m,p]=Te.useState("Recent activity"),[_,v]=Te.useState(!0),[x,S]=Te.useState(!1),b=()=>{Promise.all([So.list(),Bt.database.list("LimbProfile"),au.list(),DS.list(),td.list()]).then(([P,w,L,k,V])=>{e(P),i(w),n(L),o(k),c(V)})};Te.useEffect(()=>{b()},[]);const y=Te.useMemo(()=>{const P={};return s.forEach(w=>{P[w.uuid]={limbs:t.filter(L=>L.customer_uuid===w.uuid).length,projects:r.filter(L=>L.customer_uuid===w.uuid).length,orders:a.filter(L=>L.customer_uuid===w.uuid).length,covers:l.filter(L=>L.customer_uuid===w.uuid).length}}),P},[s,t,r,a,l]),I=Te.useMemo(()=>{let P=_?W0.hideFictional(s):s;if(d==="Archived"?P=P.filter(w=>w.record_state==="archived"):d==="New customers"?P=P.filter(w=>{var L,k;return(((L=y[w.uuid])==null?void 0:L.projects)||0)===0&&(((k=y[w.uuid])==null?void 0:k.covers)||0)===0}):d==="Returning customers"?P=P.filter(w=>{var L,k;return(((L=y[w.uuid])==null?void 0:L.projects)||0)>0||(((k=y[w.uuid])==null?void 0:k.covers)||0)>0}):d==="Active projects"?P=P.filter(w=>r.some(L=>L.customer_uuid===w.uuid&&L.status!=="Complete"&&L.record_state!=="archived")):d==="Awaiting measurements"?P=P.filter(w=>r.some(L=>L.customer_uuid===w.uuid&&L.status==="Awaiting measurements")):d==="Awaiting quote"?P=P.filter(w=>r.some(L=>L.customer_uuid===w.uuid&&(L.status==="Awaiting workshop review"||L.status==="Ready for design"))):d==="Current orders"?P=P.filter(w=>a.some(L=>L.customer_uuid===w.uuid&&L.production_status!=="Complete"&&!L.cancel_reason)):d==="Completed customers"&&(P=P.filter(w=>{var L;return(((L=y[w.uuid])==null?void 0:L.covers)||0)>0})),u.trim()){const w=u.toLowerCase();P=P.filter(L=>[L.full_name,L.preferred_name,L.email,L.phone,L.customer_number].join(" ").toLowerCase().includes(w))}return P=[...P].sort((w,L)=>m==="Name (A–Z)"?(w.full_name||"").localeCompare(L.full_name||""):m==="Customer number"?(w.customer_number||"").localeCompare(L.customer_number||""):(L.updated_date||"").localeCompare(w.updated_date||"")),P},[s,d,_,u,m,y,r,a]),R=async P=>{await So.create(P,"Ray"),S(!1),b()},A=async P=>{P.record_state==="archived"?await So.restore(P,"Ray"):await So.archive(P,"Ray"),b()};return g.jsxs(g.Fragment,{children:[g.jsx(vc,{eyebrow:"Returning-customer records",title:"Customers",description:"Search and inspect every customer with their full project, measurement, order and cover history.",action:g.jsxs("button",{onClick:()=>S(!0),className:"btn-primary",children:[g.jsx($f,{}),"New customer"]})}),x&&g.jsx("div",{className:"panel mb-6 p-6",children:g.jsx(Pme,{onSave:R,onCancel:()=>S(!1)})}),g.jsxs("div",{className:"mb-5 flex flex-wrap items-center gap-2",children:[g.jsxs("label",{className:"relative block",children:[g.jsx(jS,{className:"absolute left-3 top-3 h-4 w-4 text-slate-500"}),g.jsx("input",{className:"workshop-input mt-0 pl-10",placeholder:"Search name, email, phone or customer number",value:u,onChange:P=>h(P.target.value)})]}),g.jsx("select",{className:"workshop-input mt-0 max-w-xs",value:d,onChange:P=>f(P.target.value),children:z3e.map(P=>g.jsx("option",{children:P},P))}),g.jsx("select",{className:"workshop-input mt-0 max-w-xs",value:m,onChange:P=>p(P.target.value),children:W3e.map(P=>g.jsx("option",{children:P},P))}),g.jsx(KO,{value:_,onChange:v})]}),g.jsx("div",{className:"grid gap-4 md:grid-cols-2 xl:grid-cols-3",children:I.map(P=>g.jsx(D3e,{customer:P,counts:y[P.uuid],onToggle:A},P.uuid))}),I.length===0&&g.jsx("p",{className:"mt-8 text-center text-sm text-slate-500",children:"No customers match the current filter."})]})}function cy({items:s}){return g.jsx("nav",{"aria-label":"Breadcrumb",className:"mb-4 flex flex-wrap items-center gap-1 text-sm text-slate-500",children:s.map((e,t)=>{const i=t===s.length-1;return g.jsxs("span",{className:"flex items-center gap-1",children:[e.to&&!i?g.jsx(Ar,{to:e.to,className:"text-slate-400 hover:text-violet-300",children:e.label}):g.jsx("span",{className:i?"font-medium text-violet-300":"",children:e.label}),!i&&g.jsx(kT,{className:"h-3.5 w-3.5 text-slate-600"})]},t)})})}const J8={1:"sm:grid-cols-1",2:"sm:grid-cols-2",3:"sm:grid-cols-3"};function La({rows:s,columns:e=2}){return g.jsx("dl",{className:`grid gap-x-6 gap-y-3 ${J8[e]||J8[2]}`,children:s.filter(([,t])=>t!=null&&t!=="").map(([t,i],r)=>g.jsxs("div",{className:"flex flex-col gap-0.5",children:[g.jsx("dt",{className:"text-xs uppercase tracking-wide text-slate-500",children:t}),g.jsx("dd",{className:"text-sm text-slate-200 break-words",children:typeof i=="boolean"?i?"Yes":"No":i})]},r))})}const j3e=[{value:z5,title:"Dual Cone system",description:"Exploded mechanical system with multiple external components. Requires full hardware clearance, access and component awareness.",image:"/agents/limbforge/measurement-guides/oi-dual-cone-reference.svg",alt:"Exploded technical reference for a Dual Cone osseointegration system."},{value:W5,title:"Legacy / older-style abutment system",description:"Simpler abutment-through-skin system. Requires an open no-contact zone with direct cleaning and inspection access.",image:"/agents/limbforge/measurement-guides/oi-legacy-abutment-reference.svg",alt:"Technical reference for a simpler legacy abutment passing through the skin."}];function $5({value:s="",onChange:e,compact:t=!1}){return g.jsxs("section",{"data-shire-feature":"SHIRE_OI_TYPES_STAGE1B",className:`rounded-2xl border border-amber-400/25 bg-amber-400/5 ${t?"p-3":"p-4 sm:p-5"}`,children:[g.jsxs("div",{className:"flex items-start gap-3",children:[g.jsx(qp,{className:"mt-0.5 h-5 w-5 shrink-0 text-amber-300"}),g.jsxs("div",{children:[g.jsx("p",{className:"text-sm font-semibold text-white",children:"Which osseointegration system is involved?"}),g.jsx("p",{className:"mt-1 text-xs leading-5 text-slate-400",children:"This is required because the safety clearances and measurement instructions differ between systems."})]})]}),g.jsx("div",{className:"mt-4 grid gap-3 md:grid-cols-2",children:j3e.map(i=>{const r=s===i.value;return g.jsxs("button",{type:"button","aria-pressed":r,onClick:()=>e==null?void 0:e(i.value),className:`overflow-hidden rounded-2xl border text-left transition ${r?"border-cyan-300 bg-cyan-400/10 shadow-[0_0_0_2px_rgba(103,232,249,0.16)]":"border-white/10 bg-[#09111c] hover:border-cyan-400/40"}`,children:[g.jsxs("div",{className:"relative aspect-[16/9] border-b border-white/10 bg-[#050b12]",children:[g.jsx("img",{src:i.image,alt:i.alt,draggable:"false",className:"h-full w-full object-contain"}),r&&g.jsx("span",{className:"absolute right-3 top-3 rounded-full bg-cyan-300 p-1 text-slate-950",children:g.jsx(hg,{className:"h-4 w-4"})})]}),g.jsxs("div",{className:"p-4",children:[g.jsx("p",{className:"font-semibold text-white",children:i.title}),g.jsx("p",{className:"mt-1 text-xs leading-5 text-slate-400",children:i.description})]})]},i.value)})}),!s&&g.jsx("p",{role:"alert",className:"mt-3 text-xs font-medium text-amber-300",children:"Select an OI system type to continue."})]})}const X3e=["Left below-knee","Right below-knee","Left above-knee","Right above-knee","Left below-elbow","Right below-elbow","Left above-elbow","Right above-elbow","Knee disarticulation","Hip disarticulation","Wrist disarticulation","Shoulder disarticulation","Bilateral configuration","Custom configuration"];function $3e({customerUuid:s,onSave:e,onCancel:t}){const[i,r]=Te.useState({customer_uuid:s,configuration:"Right below-knee",interface_type:"Socket",osseointegration:!1,oi_type:"none",data_label:"WORKSHOP RECORD"}),[n,a]=Te.useState(""),o=(u,h)=>{a(""),r(d=>({...d,[u]:h}))},l=(u,h)=>g.jsxs("label",{className:"text-sm text-slate-300",children:[h,g.jsx("input",{className:"workshop-input",value:i[u]||"",onChange:d=>o(u,d.target.value)})]}),c=u=>{u.preventDefault();try{e(H5(i))}catch(h){a((h==null?void 0:h.message)||"Check the interface details.")}};return g.jsxs("form",{onSubmit:c,className:"grid gap-4 md:grid-cols-2",children:[l("profile_name","Profile name"),g.jsxs("label",{className:"text-sm text-slate-300",children:["Configuration",g.jsx("select",{className:"workshop-input",value:i.configuration,onChange:u=>o("configuration",u.target.value),children:X3e.map(u=>g.jsx("option",{children:u},u))})]}),g.jsxs("label",{className:"text-sm text-slate-300 md:col-span-2",children:["Prosthesis interface",g.jsxs("select",{className:"workshop-input",value:i.interface_type,onChange:u=>{const h=u.target.value;a(""),r(d=>({...d,interface_type:h,osseointegration:h==="Osseointegration",oi_type:h==="Osseointegration"?["dual_cone","legacy_abutment"].includes(d.oi_type)?d.oi_type:"":"none"}))},children:[g.jsx("option",{children:"Socket"}),g.jsx("option",{children:"Osseointegration"}),g.jsx("option",{children:"Other"})]})]}),i.interface_type==="Osseointegration"&&g.jsx("div",{className:"md:col-span-2",children:g.jsx($5,{value:i.oi_type,onChange:u=>o("oi_type",u)})}),l("prosthesis_manufacturer","Prosthesis manufacturer"),l("prosthesis_model","Prosthesis model"),l("prosthetist_or_clinic","Prosthetist or clinic"),l("important_notes","Important notes"),n&&g.jsx("div",{role:"alert",className:"rounded-xl border border-red-400/30 bg-red-400/10 p-3 text-sm text-red-200 md:col-span-2",children:n}),g.jsxs("div",{className:"flex gap-2 md:col-span-2",children:[g.jsx("button",{className:"btn-primary",children:"Save limb profile"}),g.jsx("button",{type:"button",onClick:t,className:"btn-secondary",children:"Cancel"})]})]})}function Y3e({customerUuid:s,limbs:e,onSave:t,onCancel:i}){var o;const[r,n]=Te.useState({customer_uuid:s,limb_profile_uuid:((o=e[0])==null?void 0:o.uuid)||"",data_label:"WORKSHOP RECORD"}),a=(l,c)=>g.jsxs("label",{className:"text-sm text-slate-300",children:[c,g.jsx("input",{className:"workshop-input",value:r[l]||"",onChange:u=>n({...r,[l]:u.target.value})})]});return g.jsxs("form",{className:"grid gap-4 md:grid-cols-2",onSubmit:l=>{l.preventDefault(),t(r)},children:[g.jsxs("label",{className:"text-sm text-slate-300",children:["Limb profile",g.jsx("select",{className:"workshop-input",value:r.limb_profile_uuid,onChange:l=>n({...r,limb_profile_uuid:l.target.value}),children:e.map(l=>g.jsx("option",{value:l.uuid,children:l.profile_name},l.uuid))})]}),a("name","Prosthesis name"),a("configuration","Configuration"),a("manufacturer","Manufacturer"),a("model","Model"),a("serial_number","Serial number (optional)"),a("notes","Notes"),g.jsxs("div",{className:"flex gap-2 md:col-span-2",children:[g.jsx("button",{className:"btn-primary",children:"Save prosthesis"}),g.jsx("button",{type:"button",className:"btn-secondary",onClick:i,children:"Cancel"})]})]})}const q3e=[["overview","Overview"],["limbs","Limb Profiles"],["prostheses","Prostheses & Components"],["measurements","Measurements"],["projects","Projects"],["quotes","Quotes"],["orders","Orders"],["covers","Completed Covers"],["history","History"]];function Z3e(){var A,P;const{uuid:s}=Wv(),[e,t]=Te.useState(null),[i,r]=Te.useState("overview"),[n,a]=Te.useState(""),[o,l]=Te.useState(!1),c=async()=>{const w=await So.get(s);if(!w){t({notFound:!0});return}const L=await So.history(s),[k,V,U,ne,oe]=await Promise.all([Bt.database.filter("MeasurementSession",{customer_uuid:s}),WR.forCustomer(s),DS.forCustomer(s),td.forCustomer(s),mr.list()]),le=new Set([s,...L.projects.map(te=>te.uuid),...V.map(te=>te.uuid),...U.map(te=>te.uuid),...ne.map(te=>te.uuid),...k.map(te=>te.uuid)]),Y=(oe||[]).filter(te=>le.has(te.record_uuid)).sort((te,Z)=>(Z.created_date||"").localeCompare(te.created_date||""));t({customer:w,history:L,sessions:k,quotes:V,orders:U,covers:ne,audits:Y})};if(Te.useEffect(()=>{c()},[s]),!e)return g.jsx(dh,{});if(e.notFound)return g.jsxs("div",{className:"panel mx-auto mt-10 max-w-lg p-8 text-center",children:[g.jsx("h1",{className:"text-xl font-semibold text-white",children:"Customer not found"}),g.jsx(Ar,{className:"btn-secondary mt-4",to:"/customers",children:"Back to customers"})]});const{customer:u,history:h,sessions:d,quotes:f,orders:m,covers:p,audits:_}=e,v=w=>async()=>{l(!0);try{await w(),await c()}finally{l(!1)}},x=async w=>{await So.update(u.id,u.uuid,w,"Ray"),a(""),c()},S=async w=>{await So.createLimb({...w,customer_uuid:s,data_label:"WORKSHOP RECORD"},"Ray"),a(""),c()},b=async w=>{await So.createProsthesis(w,"Ray"),a(""),c()},y=h.projects[0],I=v(()=>y?WR.create({project_uuid:y.uuid,customer_uuid:s,amount:0,funding_type:"Quote-only"},"Ray"):null),R=h.projects.length>0||p.length>0;return g.jsxs(g.Fragment,{children:[g.jsx(cy,{items:[{label:"Customers",to:"/customers"},{label:u.full_name}]}),g.jsx(vc,{eyebrow:`${u.customer_number} · ${u.data_label}`,title:u.full_name,description:`${u.funding_method||"Funding not selected"} · ${u.approval_status||"Approval not requested"}`,action:g.jsxs("div",{className:"flex flex-wrap gap-2",children:[g.jsxs("button",{className:"btn-secondary",onClick:()=>a("edit"),children:[g.jsx(sBe,{}),"Edit Customer"]}),g.jsxs(Ar,{className:"btn-primary",to:"/new-cover",children:[g.jsx(qpe,{}),"Start New Cover"]}),g.jsx("button",{className:"btn-secondary",onClick:()=>a("limb"),children:"Add Limb Profile"}),g.jsx("button",{className:"btn-secondary",onClick:()=>a("prosthesis"),children:"Add Prosthesis"}),g.jsxs(Ar,{className:"btn-secondary",to:"/measurements",children:[g.jsx(Yp,{}),"Request Measurements"]}),g.jsxs("button",{disabled:o||!y,onClick:I,className:"btn-secondary",children:[g.jsx(JD,{}),"Prepare Quote"]})]})}),g.jsxs("div",{className:"mb-5 flex flex-wrap items-center gap-2",children:[g.jsx(hr,{tone:u.record_state==="archived"?"slate":"green",children:u.record_state==="archived"?"Archived":"Active"}),R&&g.jsx(hr,{tone:"cyan",children:"Returning customer"}),g.jsx($S,{record:u,showAll:!0})]}),n==="edit"&&g.jsx("div",{className:"panel mb-5 p-6",children:g.jsx(Pme,{initial:u,onSave:x,onCancel:()=>a("")})}),n==="limb"&&g.jsx("div",{className:"panel mb-5 p-6",children:g.jsx($3e,{customerUuid:s,onSave:S,onCancel:()=>a("")})}),n==="prosthesis"&&g.jsx("div",{className:"panel mb-5 p-6",children:g.jsx(Y3e,{customerUuid:s,limbs:h.limbs,onSave:b,onCancel:()=>a("")})}),g.jsx("div",{className:"mb-4 flex flex-wrap gap-1.5",children:q3e.map(([w,L])=>g.jsx("button",{onClick:()=>r(w),className:`rounded-lg px-3 py-1.5 text-sm font-medium transition ${i===w?"bg-shire-purple text-white":"border border-shire-border text-slate-400 hover:text-shire-purple-bright"}`,children:L},w))}),i==="overview"&&g.jsxs("div",{className:"grid gap-5 lg:grid-cols-2",children:[g.jsxs("section",{className:"panel p-5",children:[g.jsx("h2",{className:"section-title",children:"Customer Overview"}),g.jsx(La,{rows:[["Customer number",u.customer_number],["Full name",u.full_name],["Preferred name",u.preferred_name],["Date of birth",u.date_of_birth],["Email",u.email],["Phone",u.phone],["Pronouns",u.pronouns],["Billing address",u.address],["Shipping address",u.shipping_address],["Preferred contact",u.preferred_contact_method],["Emergency contact",u.emergency_contact]]})]}),g.jsxs("section",{className:"panel p-5",children:[g.jsx("h2",{className:"section-title",children:"Funding"}),g.jsx(La,{rows:[["Funding method",u.funding_method],["NDIS number",u.ndis_number],["Plan dates",u.plan_dates],["Plan manager",u.plan_manager_name],["Plan manager email",u.plan_manager_email],["Plan manager phone",u.plan_manager_phone],["Billing contact",u.billing_contact],["Purchase order",u.purchase_order_number],["Invoice notes",u.invoice_notes],["Approval status",u.approval_status]]})]}),g.jsxs("section",{className:"panel p-5",children:[g.jsx("h2",{className:"section-title",children:"Record"}),g.jsx(La,{rows:[["Created date",(A=u.created_date)==null?void 0:A.slice(0,10)],["Last activity",(P=u.updated_date)==null?void 0:P.slice(0,10)],["Internal notes",u.internal_notes],["Data origin",u.data_origin],["Returning customer",R?"Yes":"No"]]}),u.record_state==="archived"?g.jsxs("button",{disabled:o,onClick:v(()=>So.restore(u,"Ray")),className:"btn-secondary mt-4",children:[g.jsx(Zp,{}),"Restore customer"]}):g.jsxs("button",{disabled:o,onClick:v(()=>So.archive(u,"Ray")),className:"btn-secondary mt-4",children:[g.jsx(WS,{}),"Archive customer"]})]})]}),i==="limbs"&&g.jsxs("section",{className:"panel p-5",children:[g.jsxs("h2",{className:"section-title",children:["Limb Profiles (",h.limbs.length,")"]}),h.limbs.length?g.jsx("div",{className:"space-y-2",children:h.limbs.map(w=>g.jsxs("div",{className:"rounded-lg border border-white/10 p-3",children:[g.jsxs("div",{className:"flex items-center justify-between",children:[g.jsx("span",{className:"font-medium text-white",children:w.profile_name}),g.jsx(hr,{tone:"cyan",children:w.configuration})]}),g.jsxs("dl",{className:"mt-2 grid grid-cols-2 gap-x-4 gap-y-1 text-sm text-slate-400",children:[g.jsx("dt",{className:"text-slate-500",children:"Interface"}),g.jsx("dd",{children:w.interface_type}),g.jsx("dt",{className:"text-slate-500",children:"Manufacturer / model"}),g.jsxs("dd",{children:[w.prosthesis_manufacturer," ",w.prosthesis_model]}),g.jsx("dt",{className:"text-slate-500",children:"Fitting date"}),g.jsx("dd",{children:w.fitting_date}),g.jsx("dt",{className:"text-slate-500",children:"Related covers"}),g.jsx("dd",{children:h.projects.filter(L=>L.limb_profile_uuid===w.uuid).length})]})]},w.uuid))}):g.jsx("p",{className:"text-sm text-slate-500",children:"No limb profiles recorded."})]}),i==="prostheses"&&g.jsxs("section",{className:"panel p-5",children:[g.jsxs("h2",{className:"section-title",children:["Prostheses (",h.prostheses.length,")"]}),h.prostheses.length?g.jsx("div",{className:"space-y-2",children:h.prostheses.map(w=>g.jsxs("div",{className:"rounded-lg border border-white/10 p-3",children:[g.jsxs("div",{className:"flex items-center justify-between",children:[g.jsx("span",{className:"font-medium text-white",children:w.name}),g.jsx(hr,{tone:w.status==="active"?"green":"slate",children:w.status})]}),g.jsxs("dl",{className:"mt-2 grid grid-cols-2 gap-x-4 gap-y-1 text-sm text-slate-400",children:[g.jsx("dt",{className:"text-slate-500",children:"Manufacturer / model"}),g.jsxs("dd",{children:[w.manufacturer," ",w.model]}),g.jsx("dt",{className:"text-slate-500",children:"Serial"}),g.jsx("dd",{children:w.serial_number}),g.jsx("dt",{className:"text-slate-500",children:"Configuration"}),g.jsx("dd",{children:w.configuration}),g.jsx("dt",{className:"text-slate-500",children:"Fitting date"}),g.jsx("dd",{children:w.fitting_date})]})]},w.uuid))}):g.jsx("p",{className:"text-sm text-slate-500",children:"No prostheses recorded."})]}),i==="measurements"&&g.jsxs("section",{className:"panel p-5",children:[g.jsxs("h2",{className:"section-title",children:["Measurement Sessions (",d.length,")"]}),d.length?g.jsx("div",{className:"space-y-2",children:d.map(w=>g.jsxs(Ar,{to:`/measurements/${w.uuid}`,className:"flex items-center justify-between rounded-lg border border-white/10 px-3 py-2 text-sm hover:border-shire-purple/40",children:[g.jsxs("div",{children:[g.jsx("span",{className:"font-medium text-violet-300",children:w.workflow}),g.jsxs("span",{className:"ml-2 text-xs text-slate-500",children:[w.measured_date," · ",w.measured_by]})]}),g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx(hr,{tone:w.status==="Complete"?"green":"amber",children:w.status}),g.jsxs("span",{className:"text-xs text-slate-500",children:[w.progress_percent||0,"%"]})]})]},w.uuid))}):g.jsx("p",{className:"text-sm text-slate-500",children:"No measurement sessions recorded."})]}),i==="projects"&&g.jsxs("section",{className:"panel p-5",children:[g.jsxs("h2",{className:"section-title",children:["Cover Projects (",h.projects.length,")"]}),h.projects.length?g.jsx("div",{className:"space-y-2",children:h.projects.map(w=>g.jsxs(Ar,{to:`/projects/${w.uuid}`,className:"flex items-center justify-between rounded-lg border border-white/10 px-3 py-2 text-sm hover:border-shire-purple/40",children:[g.jsxs("div",{children:[g.jsx("span",{className:"font-medium text-violet-300",children:w.project_id}),g.jsxs("span",{className:"ml-2 text-xs text-slate-500",children:["Rev ",w.revision]})]}),g.jsx(hr,{tone:w.status==="Complete"?"green":"amber",children:w.status})]},w.uuid))}):g.jsx("p",{className:"text-sm text-slate-500",children:"No cover projects yet."})]}),i==="quotes"&&g.jsxs("section",{className:"panel p-5",children:[g.jsxs("h2",{className:"section-title",children:["Quotes (",f.length,")"]}),f.length?g.jsx("div",{className:"space-y-2",children:f.map(w=>g.jsxs("div",{className:"flex items-center justify-between rounded-lg border border-white/10 px-3 py-2 text-sm",children:[g.jsxs("div",{children:[g.jsx("span",{className:"font-medium text-violet-300",children:w.quote_number}),g.jsx("span",{className:"ml-2 text-xs text-slate-500",children:w.sent_date})]}),g.jsx(hr,{tone:w.approval_status==="Approved"?"green":"amber",children:w.approval_status})]},w.uuid))}):g.jsx("p",{className:"text-sm text-slate-500",children:"No quotes yet."})]}),i==="orders"&&g.jsxs("section",{className:"panel p-5",children:[g.jsxs("h2",{className:"section-title",children:["Orders (",m.length,")"]}),m.length?g.jsx("div",{className:"space-y-2",children:m.map(w=>g.jsxs(Ar,{to:`/orders/${w.uuid}`,className:"flex items-center justify-between rounded-lg border border-white/10 px-3 py-2 text-sm hover:border-shire-purple/40",children:[g.jsxs("div",{children:[g.jsx("span",{className:"font-medium text-violet-300",children:w.order_number}),g.jsx("span",{className:"ml-2 text-xs text-slate-500",children:w.order_date})]}),g.jsx(hr,{tone:w.production_status==="Complete"?"green":"amber",children:w.production_status})]},w.uuid))}):g.jsx("p",{className:"text-sm text-slate-500",children:"No orders yet."})]}),i==="covers"&&g.jsxs("section",{className:"panel p-5",children:[g.jsxs("h2",{className:"section-title",children:["Completed Covers (",p.length,")"]}),p.length?g.jsx("div",{className:"space-y-2",children:p.map(w=>g.jsxs(Ar,{to:`/completed-covers/${w.uuid}`,className:"flex items-center justify-between rounded-lg border border-white/10 px-3 py-2 text-sm hover:border-shire-purple/40",children:[g.jsxs("div",{children:[g.jsx("span",{className:"font-medium text-violet-300",children:w.cover_reference}),g.jsx("span",{className:"ml-2 text-xs text-slate-500",children:w.design_name})]}),g.jsx(hr,{tone:w.inspection_result==="Passed"?"green":"amber",children:w.inspection_result||"Pending"})]},w.uuid))}):g.jsx("p",{className:"text-sm text-slate-500",children:"No completed covers yet."})]}),i==="history"&&g.jsxs("section",{className:"panel p-5",children:[g.jsxs("h2",{className:"section-title",children:[g.jsx(ME,{className:"inline h-4 w-4"})," Audit Timeline"]}),_.length?g.jsx("ol",{className:"space-y-2 text-sm text-slate-400",children:_.map(w=>{var L;return g.jsxs("li",{className:"border-l-2 border-shire-purple/30 pl-3",children:[g.jsx("span",{className:"text-slate-200",children:w.summary}),g.jsxs("span",{className:"ml-2 text-xs text-slate-600",children:[w.actor_name," · ",(L=w.created_date)==null?void 0:L.slice(0,10)]})]},w.uuid)})}):g.jsx("p",{className:"text-sm text-slate-500",children:"No audit events recorded."})]})]})}function K3e({project:s,customer:e,onToggle:t}){var r;const i=s.record_state==="archived";return g.jsxs(Ar,{to:`/projects/${s.uuid}`,className:"panel block p-5 transition hover:border-shire-purple/40",children:[g.jsxs("div",{className:"flex items-start justify-between gap-3",children:[g.jsxs("div",{children:[g.jsxs("p",{className:"text-xs font-semibold text-violet-400",children:[s.project_id," · REV ",s.revision]}),g.jsx("h2",{className:"mt-1 font-semibold text-white",children:(e==null?void 0:e.full_name)||"Unknown customer"}),(e==null?void 0:e.customer_number)&&g.jsx("p",{className:"text-xs text-slate-500",children:e.customer_number})]}),g.jsxs("div",{className:"flex flex-col items-end gap-1",children:[g.jsx(hr,{tone:s.status==="Complete"?"green":i?"slate":"amber",children:i?"Archived":s.status}),g.jsx($S,{record:s})]})]}),g.jsx("p",{className:"mt-3 text-sm text-slate-400",children:s.prosthesis_configuration||"Configuration not set"}),s.reason_for_cover&&g.jsx("p",{className:"mt-2 line-clamp-2 text-xs text-slate-500",children:s.reason_for_cover}),g.jsxs("dl",{className:"mt-3 grid grid-cols-2 gap-x-4 gap-y-1 text-xs text-slate-500",children:[g.jsx("dt",{children:"Due"}),g.jsx("dd",{className:"text-slate-400",children:s.due_date||"not set"}),g.jsx("dt",{children:"Last activity"}),g.jsx("dd",{className:"text-slate-400",children:(r=s.updated_date)==null?void 0:r.slice(0,10)})]}),g.jsxs("div",{className:"mt-4 flex items-center gap-2",children:[g.jsxs("span",{className:"btn-primary flex-1 text-center text-sm",children:[g.jsx(Jpe,{}),"Open Project"]}),t&&g.jsx("button",{onClick:n=>{n.preventDefault(),t(s)},className:"icon-btn","aria-label":i?"Restore project":"Archive project",children:i?g.jsx(Zp,{}):g.jsx(WS,{})})]})]})}function Q3e(){const[s]=aLe(),[e,t]=Te.useState([]),[i,r]=Te.useState([]),[n,a]=Te.useState(""),[o,l]=Te.useState(!0),[c,u]=Te.useState("All"),h=()=>{Promise.all([au.list(),So.list()]).then(([_,v])=>{t(_),r(v)})};Te.useEffect(()=>{h()},[]);const d=_=>i.find(v=>v.uuid===_),f=Te.useMemo(()=>["All",...new Set((e||[]).map(_=>_.status).filter(Boolean))],[e]),m=Te.useMemo(()=>{let _=o?W0.hideFictional(e):e;if(c!=="All"&&(_=_.filter(v=>v.status===c)),s.get("status")&&(_=_.filter(v=>v.status===s.get("status"))),s.get("active")==="true"&&(_=_.filter(v=>v.record_state!=="archived"&&v.status!=="Complete")),s.get("project")&&(_=_.filter(v=>v.uuid===s.get("project"))),n.trim()){const v=n.toLowerCase();_=_.filter(x=>{var S;return(x.project_id||"").toLowerCase().includes(v)||(((S=d(x.customer_uuid))==null?void 0:S.full_name)||"").toLowerCase().includes(v)||(x.prosthesis_configuration||"").toLowerCase().includes(v)})}return _},[e,o,c,n,s,i]),p=async _=>{_.record_state==="archived"?await au.restore(_):await au.archive(_),h()};return g.jsxs(g.Fragment,{children:[g.jsx(vc,{eyebrow:"Cover project register",title:"Cover Projects",description:"Every project keeps a stable portable identifier, revision and logical SHiREVault destination. Click any project to open the Designer workspace."}),g.jsxs("div",{className:"mb-5 flex flex-wrap items-center gap-2",children:[g.jsxs("label",{className:"relative block",children:[g.jsx(jS,{className:"absolute left-3 top-3 h-4 w-4 text-slate-500"}),g.jsx("input",{className:"workshop-input mt-0 pl-10",placeholder:"Search project reference or customer",value:n,onChange:_=>a(_.target.value)})]}),g.jsx("select",{className:"workshop-input mt-0 max-w-xs",value:c,onChange:_=>u(_.target.value),children:f.map(_=>g.jsx("option",{children:_},_))}),g.jsx(KO,{value:o,onChange:l})]}),g.jsx("div",{className:"grid gap-4 md:grid-cols-2 xl:grid-cols-3",children:m.map(_=>g.jsx(K3e,{project:_,customer:d(_.customer_uuid),onToggle:p},_.uuid))}),m.length===0&&g.jsx("p",{className:"mt-8 text-center text-sm text-slate-500",children:"No projects match the current filter."})]})}var eY={},tY;function J3e(){if(tY)return eY;tY=1;function s(){typeof Symbol<"u"&&!Symbol.metadata&&Object.defineProperty(Symbol,"metadata",{configurable:!0,writable:!0,value:Symbol("Symbol.metadata")})}return s(),eY}J3e();class Yd{constructor(){this.hoverCursor="",this.actions=[],this.isRecursive=!1,this.disposeWhenUnowned=!0}static get HasTriggers(){for(const e in Yd.Triggers)if(Object.prototype.hasOwnProperty.call(Yd.Triggers,e))return!0;return!1}static get HasPickTriggers(){for(const e in Yd.Triggers)if(Object.prototype.hasOwnProperty.call(Yd.Triggers,e)){const t=parseInt(e);if(t>=1&&t<=7)return!0}return!1}static HasSpecificTrigger(e){for(const t in Yd.Triggers)if(Object.prototype.hasOwnProperty.call(Yd.Triggers,t)&&parseInt(t)===e)return!0;return!1}}Yd.Triggers={};const eke=typeof WeakRef<"u";class Ume{constructor(e,t=!1,i,r){this.initialize(e,t,i,r)}initialize(e,t=!1,i,r){return this.mask=e,this.skipNextObservers=t,this.target=i,this.currentTarget=r,this}}class tke{constructor(e,t,i=null){this.callback=e,this.mask=t,this.scope=i,this._willBeUnregistered=!1,this.unregisterOnNextCall=!1,this._remove=null}remove(e=!1){this._remove&&this._remove(e)}}class Ge{static FromPromise(e,t){const i=new Ge;return e.then(r=>{i.notifyObservers(r)}).catch(r=>{if(t)t.notifyObservers(r);else throw r}),i}get observers(){return this._observers}constructor(e,t=!1){this.notifyIfTriggered=t,this._observers=new Array,this._numObserversMarkedAsDeleted=0,this._hasNotified=!1,this._eventState=new Ume(0),e&&(this._onObserverAdded=e)}add(e,t=-1,i=!1,r=null,n=!1){if(!e)return null;const a=new tke(e,t,r);a.unregisterOnNextCall=n,i?this._observers.unshift(a):this._observers.push(a),this._onObserverAdded&&this._onObserverAdded(a),this._hasNotified&&this.notifyIfTriggered&&this._lastNotifiedValue!==void 0&&this.notifyObserver(a,this._lastNotifiedValue);const o=eke?new WeakRef(this):{deref:()=>this};return a._remove=(l=!1)=>{const c=o.deref();c&&(l?c.remove(a):c._remove(a))},a}addOnce(e){return this.add(e,void 0,void 0,void 0,!0)}remove(e){return e?(e._remove=null,this._observers.indexOf(e)!==-1?(this._deferUnregister(e),!0):!1):!1}removeCallback(e,t){for(let i=0;i{this._remove(e)},0))}_remove(e,t=!0){if(!e)return!1;const i=this._observers.indexOf(e);return i!==-1?(t&&this._numObserversMarkedAsDeleted--,this._observers.splice(i,1),!0):!1}makeObserverTopPriority(e){this._remove(e,!1),this._observers.unshift(e)}makeObserverBottomPriority(e){this._remove(e,!1),this._observers.push(e)}notifyObservers(e,t=-1,i,r,n){if(this.notifyIfTriggered&&(this._hasNotified=!0,this._lastNotifiedValue=e),!this._observers.length)return!0;const a=this._eventState;a.mask=t,a.target=i,a.currentTarget=r,a.skipNextObservers=!1,a.lastReturnValue=e,a.userInfo=n;for(const o of this._observers)if(!o._willBeUnregistered&&(o.mask&t&&(o.unregisterOnNextCall&&this._deferUnregister(o),o.scope?a.lastReturnValue=o.callback.apply(o.scope,[e,a]):a.lastReturnValue=o.callback(e,a)),a.skipNextObservers))return!1;return!0}notifyObserver(e,t,i=-1){if(this.notifyIfTriggered&&(this._hasNotified=!0,this._lastNotifiedValue=t),e._willBeUnregistered)return;const r=this._eventState;r.mask=i,r.skipNextObservers=!1,e.unregisterOnNextCall&&this._deferUnregister(e),e.callback(t,r)}hasObservers(){return this._observers.length-this._numObserversMarkedAsDeleted>0}clear(){for(;this._observers.length;){const e=this._observers.pop();e&&(e._remove=null)}this._onObserverAdded=null,this._numObserversMarkedAsDeleted=0,this.cleanLastNotifiedState()}cleanLastNotifiedState(){this._hasNotified=!1,this._lastNotifiedValue=void 0}clone(){const e=new Ge;return e._observers=this._observers.slice(0),e}hasSpecificMask(e=-1){for(const t of this._observers)if(t.mask&e||t.mask===e)return!0;return!1}}const sR=1/2.2,TD=2.2,Lo=(1+Math.sqrt(5))/2;let rr=.001;function Hf(s,e){const t=[];for(let i=0;i{const n=r.previous;if(!n)return;const a=r.next;a?(n.next=a,a.previous=n):(n.next=void 0,s[e]=n),r.next=void 0,r.previous=void 0}}const rke=["push","splice","pop","shift","unshift"];function Gme(s,e){const t=rke.map(i=>ike(s,i,e));return()=>{for(const i of t)i==null||i()}}class zl{static SetMatrixPrecision(e){if(zl.MatrixTrackPrecisionChange=!1,e&&!zl.MatrixUse64Bits&&zl.MatrixTrackedMatrices)for(let t=0;tt+i}function ni(s,e){return s===e?s:Math.random()*(e-s)+s}function Qa(s,e,t){return s+(e-s)*t}function nke(s,e,t){let i=QO(e-s,360);return i>180&&(i-=360),s+i*_r(t)}function ake(s,e,t){let i;return s!=e?i=_r((t-s)/(e-s)):i=0,i}function zme(s,e,t,i,r){const n=r*r,a=r*n,o=2*a-3*n+1,l=-2*a+3*n,c=a-2*n+r,u=a-n;return s*o+t*l+e*c+i*u}function oke(s,e,t,i,r){const n=r*r;return(n-r)*6*s+(3*n-4*r+1)*e+(-n+r)*6*t+(3*n-2*r)*i}function _r(s,e=0,t=1){return Math.min(t,Math.max(e,s))}function iT(s){return s-=Math.PI*2*Math.floor((s+Math.PI)/(Math.PI*2)),s}function wm(s){const e=s.toString(16);return s<=15?("0"+e).toUpperCase():e.toUpperCase()}function VT(s){if(Math.log2)return Math.floor(Math.log2(s));if(s<0)return NaN;if(s===0)return-1/0;let e=0;if(s<1){for(;s<1;)e++,s=s*2;e=-e}else if(s>1)for(;s>1;)e++,s=Math.floor(s/2);return e}function QO(s,e){return s-Math.floor(s/e)*e}function lke(s,e,t){return(s-e)/(t-e)}function cke(s,e,t){return s*(t-e)+e}function Wme(s,e){let t=QO(e-s,360);return t>180&&(t-=360),t}function uke(s,e){const t=QO(s,e*2);return e-Math.abs(t-e)}function hke(s,e,t){let i=_r(t);return i=-2*i*i*i+3*i*i,e*i+s*(1-i)}function Hme(s,e,t){let i;return Math.abs(e-s)<=t?i=e:i=s+Math.sign(e-s)*t,i}function dke(s,e,t){const i=Wme(s,e);let r;return-tparseInt(s.toString().replace(/\W/g,""));let vt=class js{constructor(e=0,t=0){this.x=e,this.y=t}toString(){return`{X: ${this.x} Y: ${this.y}}`}getClassName(){return"Vector2"}getHashCode(){const e=nd(this.x),t=nd(this.y);let i=e;return i=i*397^t,i}toArray(e,t=0){return e[t]=this.x,e[t+1]=this.y,this}fromArray(e,t=0){return js.FromArrayToRef(e,t,this),this}asArray(){return[this.x,this.y]}copyFrom(e){return this.x=e.x,this.y=e.y,this}copyFromFloats(e,t){return this.x=e,this.y=t,this}set(e,t){return this.copyFromFloats(e,t)}setAll(e){return this.copyFromFloats(e,e)}add(e){return new js(this.x+e.x,this.y+e.y)}addToRef(e,t){return t.x=this.x+e.x,t.y=this.y+e.y,t}addInPlace(e){return this.x+=e.x,this.y+=e.y,this}addInPlaceFromFloats(e,t){return this.x+=e,this.y+=t,this}addVector3(e){return new js(this.x+e.x,this.y+e.y)}subtract(e){return new js(this.x-e.x,this.y-e.y)}subtractToRef(e,t){return t.x=this.x-e.x,t.y=this.y-e.y,t}subtractInPlace(e){return this.x-=e.x,this.y-=e.y,this}multiplyInPlace(e){return this.x*=e.x,this.y*=e.y,this}multiply(e){return new js(this.x*e.x,this.y*e.y)}multiplyToRef(e,t){return t.x=this.x*e.x,t.y=this.y*e.y,t}multiplyByFloats(e,t){return new js(this.x*e,this.y*t)}divide(e){return new js(this.x/e.x,this.y/e.y)}divideToRef(e,t){return t.x=this.x/e.x,t.y=this.y/e.y,t}divideInPlace(e){return this.x=this.x/e.x,this.y=this.y/e.y,this}minimizeInPlace(e){return this.minimizeInPlaceFromFloats(e.x,e.y)}maximizeInPlace(e){return this.maximizeInPlaceFromFloats(e.x,e.y)}minimizeInPlaceFromFloats(e,t){return this.x=Math.min(e,this.x),this.y=Math.min(t,this.y),this}maximizeInPlaceFromFloats(e,t){return this.x=Math.max(e,this.x),this.y=Math.max(t,this.y),this}subtractFromFloats(e,t){return new js(this.x-e,this.y-t)}subtractFromFloatsToRef(e,t,i){return i.x=this.x-e,i.y=this.y-t,i}negate(){return new js(-this.x,-this.y)}negateInPlace(){return this.x*=-1,this.y*=-1,this}negateToRef(e){return e.x=-this.x,e.y=-this.y,e}scaleInPlace(e){return this.x*=e,this.y*=e,this}scale(e){return new js(this.x*e,this.y*e)}scaleToRef(e,t){return t.x=this.x*e,t.y=this.y*e,t}scaleAndAddToRef(e,t){return t.x+=this.x*e,t.y+=this.y*e,t}equals(e){return e&&this.x===e.x&&this.y===e.y}equalsWithEpsilon(e,t=rr){return e&&fs(this.x,e.x,t)&&fs(this.y,e.y,t)}equalsToFloats(e,t){return this.x===e&&this.y===t}floor(){return new js(Math.floor(this.x),Math.floor(this.y))}floorToRef(e){return e.x=Math.floor(this.x),e.y=Math.floor(this.y),e}fract(){return new js(this.x-Math.floor(this.x),this.y-Math.floor(this.y))}fractToRef(e){return e.x=this.x-Math.floor(this.x),e.y=this.y-Math.floor(this.y),e}rotate(e){return this.rotateToRef(e,new js)}rotateToRef(e,t){const i=Math.cos(e),r=Math.sin(e);return t.x=i*this.x-r*this.y,t.y=r*this.x+i*this.y,t}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}lengthSquared(){return this.x*this.x+this.y*this.y}normalize(){return this.normalizeFromLength(this.length())}normalizeFromLength(e){return e===0||e===1?this:this.scaleInPlace(1/e)}normalizeToNew(){const e=new js;return this.normalizeToRef(e),e}normalizeToRef(e){const t=this.length();return t===0&&(e.x=this.x,e.y=this.y),this.scaleToRef(1/t,e)}clone(){return new js(this.x,this.y)}dot(e){return this.x*e.x+this.y*e.y}static Zero(){return new js(0,0)}static One(){return new js(1,1)}static Random(e=0,t=1){return new js(ni(e,t),ni(e,t))}static RandomToRef(e=0,t=1,i){return i.copyFromFloats(ni(e,t),ni(e,t))}static get ZeroReadOnly(){return js._ZeroReadOnly}static FromArray(e,t=0){return new js(e[t],e[t+1])}static FromArrayToRef(e,t,i){return i.x=e[t],i.y=e[t+1],i}static FromFloatsToRef(e,t,i){return i.copyFromFloats(e,t),i}static CatmullRom(e,t,i,r,n){const a=n*n,o=n*a,l=.5*(2*t.x+(-e.x+i.x)*n+(2*e.x-5*t.x+4*i.x-r.x)*a+(-e.x+3*t.x-3*i.x+r.x)*o),c=.5*(2*t.y+(-e.y+i.y)*n+(2*e.y-5*t.y+4*i.y-r.y)*a+(-e.y+3*t.y-3*i.y+r.y)*o);return new js(l,c)}static ClampToRef(e,t,i,r){return r.x=_r(e.x,t.x,i.x),r.y=_r(e.y,t.y,i.y),r}static Clamp(e,t,i){const r=_r(e.x,t.x,i.x),n=_r(e.y,t.y,i.y);return new js(r,n)}static Hermite(e,t,i,r,n){const a=n*n,o=n*a,l=2*o-3*a+1,c=-2*o+3*a,u=o-2*a+n,h=o-a,d=e.x*l+i.x*c+t.x*u+r.x*h,f=e.y*l+i.y*c+t.y*u+r.y*h;return new js(d,f)}static Hermite1stDerivative(e,t,i,r,n){return this.Hermite1stDerivativeToRef(e,t,i,r,n,new js)}static Hermite1stDerivativeToRef(e,t,i,r,n,a){const o=n*n;return a.x=(o-n)*6*e.x+(3*o-4*n+1)*t.x+(-o+n)*6*i.x+(3*o-2*n)*r.x,a.y=(o-n)*6*e.y+(3*o-4*n+1)*t.y+(-o+n)*6*i.y+(3*o-2*n)*r.y,a}static Lerp(e,t,i){return js.LerpToRef(e,t,i,new js)}static LerpToRef(e,t,i,r){return r.x=e.x+(t.x-e.x)*i,r.y=e.y+(t.y-e.y)*i,r}static Dot(e,t){return e.x*t.x+e.y*t.y}static Normalize(e){return js.NormalizeToRef(e,new js)}static NormalizeToRef(e,t){return e.normalizeToRef(t),t}static Minimize(e,t){const i=e.xt.x?e.x:t.x,r=e.y>t.y?e.y:t.y;return new js(i,r)}static Transform(e,t){return js.TransformToRef(e,t,new js)}static TransformToRef(e,t,i){const r=t.m,n=e.x*r[0]+e.y*r[4]+r[12],a=e.x*r[1]+e.y*r[5]+r[13];return i.x=n,i.y=a,i}static PointInTriangle(e,t,i,r){const n=.5*(-i.y*r.x+t.y*(-i.x+r.x)+t.x*(i.y-r.y)+i.x*r.y),a=n<0?-1:1,o=(t.y*r.x-t.x*r.y+(r.y-t.y)*e.x+(t.x-r.x)*e.y)*a,l=(t.x*i.y-t.y*i.x+(t.y-i.y)*e.x+(i.x-t.x)*e.y)*a;return o>0&&l>0&&o+l<2*n*a}static Distance(e,t){return Math.sqrt(js.DistanceSquared(e,t))}static DistanceSquared(e,t){const i=e.x-t.x,r=e.y-t.y;return i*i+r*r}static Center(e,t){return js.CenterToRef(e,t,new js)}static CenterToRef(e,t,i){return i.copyFromFloats((e.x+t.x)/2,(e.y+t.y)/2)}static DistanceOfPointFromSegment(e,t,i){const r=js.DistanceSquared(t,i);if(r===0)return js.Distance(e,t);const n=i.subtract(t),a=Math.max(0,Math.min(1,js.Dot(e.subtract(t),n)/r)),o=t.add(n.multiplyByFloats(a,a));return js.Distance(e,o)}};vt._V8PerformanceHack=new vt(.5,.5);vt._ZeroReadOnly=vt.Zero();let O=class xi{get x(){return this._x}set x(e){this._x=e,this._isDirty=!0}get y(){return this._y}set y(e){this._y=e,this._isDirty=!0}get z(){return this._z}set z(e){this._z=e,this._isDirty=!0}constructor(e=0,t=0,i=0){this._isDirty=!0,this._x=e,this._y=t,this._z=i}toString(){return`{X: ${this._x} Y: ${this._y} Z: ${this._z}}`}getClassName(){return"Vector3"}getHashCode(){const e=nd(this._x),t=nd(this._y),i=nd(this._z);let r=e;return r=r*397^t,r=r*397^i,r}asArray(){return[this._x,this._y,this._z]}toArray(e,t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,this}fromArray(e,t=0){return xi.FromArrayToRef(e,t,this),this}toQuaternion(){return gt.RotationYawPitchRoll(this._y,this._x,this._z)}addInPlace(e){return this._x+=e._x,this._y+=e._y,this._z+=e._z,this._isDirty=!0,this}addInPlaceFromFloats(e,t,i){return this._x+=e,this._y+=t,this._z+=i,this._isDirty=!0,this}add(e){return new xi(this._x+e._x,this._y+e._y,this._z+e._z)}addToRef(e,t){return t._x=this._x+e._x,t._y=this._y+e._y,t._z=this._z+e._z,t._isDirty=!0,t}subtractInPlace(e){return this._x-=e._x,this._y-=e._y,this._z-=e._z,this._isDirty=!0,this}subtract(e){return new xi(this._x-e._x,this._y-e._y,this._z-e._z)}subtractToRef(e,t){return this.subtractFromFloatsToRef(e._x,e._y,e._z,t)}subtractFromFloats(e,t,i){return new xi(this._x-e,this._y-t,this._z-i)}subtractFromFloatsToRef(e,t,i,r){return r._x=this._x-e,r._y=this._y-t,r._z=this._z-i,r._isDirty=!0,r}negate(){return new xi(-this._x,-this._y,-this._z)}negateInPlace(){return this._x*=-1,this._y*=-1,this._z*=-1,this._isDirty=!0,this}negateToRef(e){return e._x=this._x*-1,e._y=this._y*-1,e._z=this._z*-1,e._isDirty=!0,e}scaleInPlace(e){return this._x*=e,this._y*=e,this._z*=e,this._isDirty=!0,this}scale(e){return new xi(this._x*e,this._y*e,this._z*e)}scaleToRef(e,t){return t._x=this._x*e,t._y=this._y*e,t._z=this._z*e,t._isDirty=!0,t}getNormalToRef(e){const t=this.length();let i=Math.acos(this._y/t);const r=Math.atan2(this._z,this._x);i>Math.PI/2?i-=Math.PI/2:i+=Math.PI/2;const n=t*Math.sin(i)*Math.cos(r),a=t*Math.cos(i),o=t*Math.sin(i)*Math.sin(r);return e.set(n,a,o),e}applyRotationQuaternionToRef(e,t){const i=this._x,r=this._y,n=this._z,a=e._x,o=e._y,l=e._z,c=e._w,u=2*(o*n-l*r),h=2*(l*i-a*n),d=2*(a*r-o*i);return t._x=i+c*u+o*d-l*h,t._y=r+c*h+l*u-a*d,t._z=n+c*d+a*h-o*u,t._isDirty=!0,t}applyRotationQuaternionInPlace(e){return this.applyRotationQuaternionToRef(e,this)}applyRotationQuaternion(e){return this.applyRotationQuaternionToRef(e,new xi)}scaleAndAddToRef(e,t){return t._x+=this._x*e,t._y+=this._y*e,t._z+=this._z*e,t._isDirty=!0,t}projectOnPlane(e,t){return this.projectOnPlaneToRef(e,t,new xi)}projectOnPlaneToRef(e,t,i){const r=e.normal,n=e.d,a=Ci.Vector3[0];this.subtractToRef(t,a),a.normalize();const o=xi.Dot(a,r);if(Math.abs(o)<1e-10)i.setAll(1/0);else{const l=-(xi.Dot(t,r)+n)/o,c=a.scaleInPlace(l);t.addToRef(c,i)}return i}equals(e){return e&&this._x===e._x&&this._y===e._y&&this._z===e._z}equalsWithEpsilon(e,t=rr){return e&&fs(this._x,e._x,t)&&fs(this._y,e._y,t)&&fs(this._z,e._z,t)}equalsToFloats(e,t,i){return this._x===e&&this._y===t&&this._z===i}multiplyInPlace(e){return this._x*=e._x,this._y*=e._y,this._z*=e._z,this._isDirty=!0,this}multiply(e){return this.multiplyByFloats(e._x,e._y,e._z)}multiplyToRef(e,t){return t._x=this._x*e._x,t._y=this._y*e._y,t._z=this._z*e._z,t._isDirty=!0,t}multiplyByFloats(e,t,i){return new xi(this._x*e,this._y*t,this._z*i)}divide(e){return new xi(this._x/e._x,this._y/e._y,this._z/e._z)}divideToRef(e,t){return t._x=this._x/e._x,t._y=this._y/e._y,t._z=this._z/e._z,t._isDirty=!0,t}divideInPlace(e){return this._x=this._x/e._x,this._y=this._y/e._y,this._z=this._z/e._z,this._isDirty=!0,this}minimizeInPlace(e){return this.minimizeInPlaceFromFloats(e._x,e._y,e._z)}maximizeInPlace(e){return this.maximizeInPlaceFromFloats(e._x,e._y,e._z)}minimizeInPlaceFromFloats(e,t,i){return ethis._x&&(this.x=e),t>this._y&&(this.y=t),i>this._z&&(this.z=i),this}isNonUniformWithinEpsilon(e){const t=Math.abs(this._x),i=Math.abs(this._y);if(!fs(t,i,e))return!0;const r=Math.abs(this._z);return!fs(t,r,e)||!fs(i,r,e)}get isNonUniform(){const e=Math.abs(this._x),t=Math.abs(this._y);if(e!==t)return!0;const i=Math.abs(this._z);return e!==i}floorToRef(e){return e._x=Math.floor(this._x),e._y=Math.floor(this._y),e._z=Math.floor(this._z),e._isDirty=!0,e}floor(){return new xi(Math.floor(this._x),Math.floor(this._y),Math.floor(this._z))}fractToRef(e){return e._x=this._x-Math.floor(this._x),e._y=this._y-Math.floor(this._y),e._z=this._z-Math.floor(this._z),e._isDirty=!0,e}fract(){return new xi(this._x-Math.floor(this._x),this._y-Math.floor(this._y),this._z-Math.floor(this._z))}length(){return Math.sqrt(this.lengthSquared())}lengthSquared(){return this._x*this._x+this._y*this._y+this._z*this._z}get hasAZeroComponent(){return this._x*this._y*this._z===0}normalize(){return this.normalizeFromLength(this.length())}reorderInPlace(e){if(e=e.toLowerCase(),e==="xyz")return this;const t=Ci.Vector3[0].copyFrom(this);return this.x=t[e[0]],this.y=t[e[1]],this.z=t[e[2]],this}rotateByQuaternionToRef(e,t){return e.toRotationMatrix(Ci.Matrix[0]),xi.TransformCoordinatesToRef(this,Ci.Matrix[0],t),t}rotateByQuaternionAroundPointToRef(e,t,i){return this.subtractToRef(t,Ci.Vector3[0]),Ci.Vector3[0].rotateByQuaternionToRef(e,Ci.Vector3[0]),t.addToRef(Ci.Vector3[0],i),i}cross(e){return xi.CrossToRef(this,e,new xi)}normalizeFromLength(e){return e===0||e===1?this:this.scaleInPlace(1/e)}normalizeToNew(){return this.normalizeToRef(new xi)}normalizeToRef(e){const t=this.length();return t===0||t===1?(e._x=this._x,e._y=this._y,e._z=this._z,e._isDirty=!0,e):this.scaleToRef(1/t,e)}clone(){return new xi(this._x,this._y,this._z)}copyFrom(e){return this.copyFromFloats(e._x,e._y,e._z)}copyFromFloats(e,t,i){return this._x=e,this._y=t,this._z=i,this._isDirty=!0,this}set(e,t,i){return this.copyFromFloats(e,t,i)}setAll(e){return this._x=this._y=this._z=e,this._isDirty=!0,this}static GetClipFactor(e,t,i,r){const n=xi.Dot(e,i),a=xi.Dot(t,i);return(n-r)/(n-a)}static GetAngleBetweenVectors(e,t,i){const r=e.normalizeToRef(Ci.Vector3[1]),n=t.normalizeToRef(Ci.Vector3[2]);let a=xi.Dot(r,n);a=_r(a,-1,1);const o=Math.acos(a),l=Ci.Vector3[3];return xi.CrossToRef(r,n,l),xi.Dot(l,i)>0?isNaN(o)?0:o:isNaN(o)?-Math.PI:-Math.acos(a)}static GetAngleBetweenVectorsOnPlane(e,t,i){Ci.Vector3[0].copyFrom(e);const r=Ci.Vector3[0];Ci.Vector3[1].copyFrom(t);const n=Ci.Vector3[1];Ci.Vector3[2].copyFrom(i);const a=Ci.Vector3[2],o=Ci.Vector3[3],l=Ci.Vector3[4];r.normalize(),n.normalize(),a.normalize(),xi.CrossToRef(a,r,o),xi.CrossToRef(o,a,l);const c=Math.atan2(xi.Dot(n,o),xi.Dot(n,l));return iT(c)}static PitchYawRollToMoveBetweenPointsToRef(e,t,i){const r=Ae.Vector3[0];return t.subtractToRef(e,r),i._y=Math.atan2(r.x,r.z)||0,i._x=Math.atan2(Math.sqrt(r.x**2+r.z**2),r.y)||0,i._z=0,i._isDirty=!0,i}static PitchYawRollToMoveBetweenPoints(e,t){const i=xi.Zero();return xi.PitchYawRollToMoveBetweenPointsToRef(e,t,i)}static SlerpToRef(e,t,i,r){i=_r(i,0,1);const n=Ci.Vector3[0],a=Ci.Vector3[1];n.copyFrom(e);const o=n.length();n.normalizeFromLength(o),a.copyFrom(t);const l=a.length();a.normalizeFromLength(l);const c=xi.Dot(n,a);let u,h;if(c<1-rr){const d=Math.acos(c),f=1/Math.sin(d);u=Math.sin((1-i)*d)*f,h=Math.sin(i*d)*f}else u=1-i,h=i;return n.scaleInPlace(u),a.scaleInPlace(h),r.copyFrom(n).addInPlace(a),r.scaleInPlace(Qa(o,l,i)),r}static SmoothToRef(e,t,i,r,n){return xi.SlerpToRef(e,t,r===0?1:i/r,n),n}static FromArray(e,t=0){return new xi(e[t],e[t+1],e[t+2])}static FromFloatArray(e,t){return xi.FromArray(e,t)}static FromArrayToRef(e,t,i){return i._x=e[t],i._y=e[t+1],i._z=e[t+2],i._isDirty=!0,i}static FromFloatArrayToRef(e,t,i){return xi.FromArrayToRef(e,t,i)}static FromFloatsToRef(e,t,i,r){return r.copyFromFloats(e,t,i),r}static Zero(){return new xi(0,0,0)}static One(){return new xi(1,1,1)}static Up(){return new xi(0,1,0)}static get UpReadOnly(){return xi._UpReadOnly}static get DownReadOnly(){return xi._DownReadOnly}static get RightReadOnly(){return xi._RightReadOnly}static get LeftReadOnly(){return xi._LeftReadOnly}static get LeftHandedForwardReadOnly(){return xi._LeftHandedForwardReadOnly}static get RightHandedForwardReadOnly(){return xi._RightHandedForwardReadOnly}static get LeftHandedBackwardReadOnly(){return xi._LeftHandedBackwardReadOnly}static get RightHandedBackwardReadOnly(){return xi._RightHandedBackwardReadOnly}static get ZeroReadOnly(){return xi._ZeroReadOnly}static get OneReadOnly(){return xi._OneReadOnly}static Down(){return new xi(0,-1,0)}static Forward(e=!1){return new xi(0,0,e?-1:1)}static Backward(e=!1){return new xi(0,0,e?1:-1)}static Right(){return new xi(1,0,0)}static Left(){return new xi(-1,0,0)}static Random(e=0,t=1){return new xi(ni(e,t),ni(e,t),ni(e,t))}static RandomToRef(e=0,t=1,i){return i.copyFromFloats(ni(e,t),ni(e,t),ni(e,t))}static TransformCoordinates(e,t){const i=xi.Zero();return xi.TransformCoordinatesToRef(e,t,i),i}static TransformCoordinatesToRef(e,t,i){return xi.TransformCoordinatesFromFloatsToRef(e._x,e._y,e._z,t,i),i}static TransformCoordinatesFromFloatsToRef(e,t,i,r,n){const a=r.m,o=e*a[0]+t*a[4]+i*a[8]+a[12],l=e*a[1]+t*a[5]+i*a[9]+a[13],c=e*a[2]+t*a[6]+i*a[10]+a[14],u=1/(e*a[3]+t*a[7]+i*a[11]+a[15]);return n._x=o*u,n._y=l*u,n._z=c*u,n._isDirty=!0,n}static TransformNormal(e,t){const i=xi.Zero();return xi.TransformNormalToRef(e,t,i),i}static TransformNormalToRef(e,t,i){return this.TransformNormalFromFloatsToRef(e._x,e._y,e._z,t,i),i}static TransformNormalFromFloatsToRef(e,t,i,r,n){const a=r.m;return n._x=e*a[0]+t*a[4]+i*a[8],n._y=e*a[1]+t*a[5]+i*a[9],n._z=e*a[2]+t*a[6]+i*a[10],n._isDirty=!0,n}static CatmullRom(e,t,i,r,n){const a=n*n,o=n*a,l=.5*(2*t._x+(-e._x+i._x)*n+(2*e._x-5*t._x+4*i._x-r._x)*a+(-e._x+3*t._x-3*i._x+r._x)*o),c=.5*(2*t._y+(-e._y+i._y)*n+(2*e._y-5*t._y+4*i._y-r._y)*a+(-e._y+3*t._y-3*i._y+r._y)*o),u=.5*(2*t._z+(-e._z+i._z)*n+(2*e._z-5*t._z+4*i._z-r._z)*a+(-e._z+3*t._z-3*i._z+r._z)*o);return new xi(l,c,u)}static Clamp(e,t,i){const r=new xi;return xi.ClampToRef(e,t,i,r),r}static ClampToRef(e,t,i,r){let n=e._x;n=n>i._x?i._x:n,n=ni._y?i._y:a,a=ai._z?i._z:o,o=o0&&w<0?(k.copyFrom(a),V=t,U=i):w>0&&L<0?(k.copyFrom(l),V=i,U=r):(k.copyFrom(o).scaleInPlace(-1),V=r,U=t);const ne=Ci.Vector3[9],oe=Ci.Vector3[4];if(V.subtractToRef(x,I),U.subtractToRef(x,ne),xi.CrossToRef(I,ne,oe),!(xi.Dot(oe,c)<0))return n.copyFrom(x),Math.abs(p*_);const Y=Ci.Vector3[5];xi.CrossToRef(k,oe,Y),Y.normalize();const te=Ci.Vector3[9];te.copyFrom(V).subtractInPlace(x);const Z=te.length();if(Zthis._x&&(this.x=e.x),e.y>this._y&&(this.y=e.y),e.z>this._z&&(this.z=e.z),e.w>this._w&&(this.w=e.w),this}minimizeInPlaceFromFloats(e,t,i,r){return this.x=Math.min(e,this._x),this.y=Math.min(t,this._y),this.z=Math.min(i,this._z),this.w=Math.min(r,this._w),this}maximizeInPlaceFromFloats(e,t,i,r){return this.x=Math.max(e,this._x),this.y=Math.max(t,this._y),this.z=Math.max(i,this._z),this.w=Math.max(r,this._w),this}floorToRef(e){return e.x=Math.floor(this._x),e.y=Math.floor(this._y),e.z=Math.floor(this._z),e.w=Math.floor(this._w),e}floor(){return new Tn(Math.floor(this._x),Math.floor(this._y),Math.floor(this._z),Math.floor(this._w))}fractToRef(e){return e.x=this._x-Math.floor(this._x),e.y=this._y-Math.floor(this._y),e.z=this._z-Math.floor(this._z),e.w=this._w-Math.floor(this._w),e}fract(){return new Tn(this._x-Math.floor(this._x),this._y-Math.floor(this._y),this._z-Math.floor(this._z),this._w-Math.floor(this._w))}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}lengthSquared(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}normalize(){return this.normalizeFromLength(this.length())}normalizeFromLength(e){return e===0||e===1?this:this.scaleInPlace(1/e)}normalizeToNew(){return this.normalizeToRef(new Tn)}normalizeToRef(e){const t=this.length();return t===0||t===1?(e.x=this._x,e.y=this._y,e.z=this._z,e.w=this._w,e):this.scaleToRef(1/t,e)}toVector3(){return new O(this._x,this._y,this._z)}clone(){return new Tn(this._x,this._y,this._z,this._w)}copyFrom(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w,this}copyFromFloats(e,t,i,r){return this.x=e,this.y=t,this.z=i,this.w=r,this}set(e,t,i,r){return this.copyFromFloats(e,t,i,r)}setAll(e){return this.x=this.y=this.z=this.w=e,this}dot(e){return this._x*e.x+this._y*e.y+this._z*e.z+this._w*e.w}static FromArray(e,t){return t||(t=0),new Tn(e[t],e[t+1],e[t+2],e[t+3])}static FromArrayToRef(e,t,i){return i.x=e[t],i.y=e[t+1],i.z=e[t+2],i.w=e[t+3],i}static FromFloatArrayToRef(e,t,i){return Tn.FromArrayToRef(e,t,i),i}static FromFloatsToRef(e,t,i,r,n){return n.x=e,n.y=t,n.z=i,n.w=r,n}static Zero(){return new Tn(0,0,0,0)}static One(){return new Tn(1,1,1,1)}static Random(e=0,t=1){return new Tn(ni(e,t),ni(e,t),ni(e,t),ni(e,t))}static RandomToRef(e=0,t=1,i){return i.x=ni(e,t),i.y=ni(e,t),i.z=ni(e,t),i.w=ni(e,t),i}static Clamp(e,t,i){return Tn.ClampToRef(e,t,i,new Tn)}static ClampToRef(e,t,i,r){return r.x=_r(e.x,t.x,i.x),r.y=_r(e.y,t.y,i.y),r.z=_r(e.z,t.z,i.z),r.w=_r(e.w,t.w,i.w),r}static CheckExtends(e,t,i){t.minimizeInPlace(e),i.maximizeInPlace(e)}static get ZeroReadOnly(){return Tn._ZeroReadOnly}static Normalize(e){return Tn.NormalizeToRef(e,new Tn)}static NormalizeToRef(e,t){return e.normalizeToRef(t),t}static Minimize(e,t){const i=new Tn;return i.copyFrom(e),i.minimizeInPlace(t),i}static Maximize(e,t){const i=new Tn;return i.copyFrom(e),i.maximizeInPlace(t),i}static Distance(e,t){return Math.sqrt(Tn.DistanceSquared(e,t))}static DistanceSquared(e,t){const i=e.x-t.x,r=e.y-t.y,n=e.z-t.z,a=e.w-t.w;return i*i+r*r+n*n+a*a}static Center(e,t){return Tn.CenterToRef(e,t,new Tn)}static CenterToRef(e,t,i){return i.x=(e.x+t.x)/2,i.y=(e.y+t.y)/2,i.z=(e.z+t.z)/2,i.w=(e.w+t.w)/2,i}static TransformCoordinates(e,t){return Tn.TransformCoordinatesToRef(e,t,new Tn)}static TransformCoordinatesToRef(e,t,i){return Tn.TransformCoordinatesFromFloatsToRef(e._x,e._y,e._z,t,i),i}static TransformCoordinatesFromFloatsToRef(e,t,i,r,n){const a=r.m,o=e*a[0]+t*a[4]+i*a[8]+a[12],l=e*a[1]+t*a[5]+i*a[9]+a[13],c=e*a[2]+t*a[6]+i*a[10]+a[14],u=e*a[3]+t*a[7]+i*a[11]+a[15];return n.x=o,n.y=l,n.z=c,n.w=u,n}static TransformNormal(e,t){return Tn.TransformNormalToRef(e,t,new Tn)}static TransformNormalToRef(e,t,i){const r=t.m,n=e.x*r[0]+e.y*r[4]+e.z*r[8],a=e.x*r[1]+e.y*r[5]+e.z*r[9],o=e.x*r[2]+e.y*r[6]+e.z*r[10];return i.x=n,i.y=a,i.z=o,i.w=e.w,i}static TransformNormalFromFloatsToRef(e,t,i,r,n,a){const o=n.m;return a.x=e*o[0]+t*o[4]+i*o[8],a.y=e*o[1]+t*o[5]+i*o[9],a.z=e*o[2]+t*o[6]+i*o[10],a.w=r,a}static FromVector3(e,t=0){return new Tn(e._x,e._y,e._z,t)}static Dot(e,t){return e.x*t.x+e.y*t.y+e.z*t.z+e.w*t.w}};Hi._V8PerformanceHack=new Hi(.5,.5,.5,.5);Hi._ZeroReadOnly=Hi.Zero();let gt=class Xr{get x(){return this._x}set x(e){this._x=e,this._isDirty=!0}get y(){return this._y}set y(e){this._y=e,this._isDirty=!0}get z(){return this._z}set z(e){this._z=e,this._isDirty=!0}get w(){return this._w}set w(e){this._w=e,this._isDirty=!0}constructor(e=0,t=0,i=0,r=1){this._isDirty=!0,this._x=e,this._y=t,this._z=i,this._w=r}toString(){return`{X: ${this._x} Y: ${this._y} Z: ${this._z} W: ${this._w}}`}getClassName(){return"Quaternion"}getHashCode(){const e=nd(this._x),t=nd(this._y),i=nd(this._z),r=nd(this._w);let n=e;return n=n*397^t,n=n*397^i,n=n*397^r,n}asArray(){return[this._x,this._y,this._z,this._w]}toArray(e,t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,this}fromArray(e,t=0){return Xr.FromArrayToRef(e,t,this)}equals(e){return e&&this._x===e._x&&this._y===e._y&&this._z===e._z&&this._w===e._w}equalsWithEpsilon(e,t=rr){return e&&fs(this._x,e._x,t)&&fs(this._y,e._y,t)&&fs(this._z,e._z,t)&&fs(this._w,e._w,t)}isApprox(e,t=rr){return e&&(fs(this._x,e._x,t)&&fs(this._y,e._y,t)&&fs(this._z,e._z,t)&&fs(this._w,e._w,t)||fs(this._x,-e._x,t)&&fs(this._y,-e._y,t)&&fs(this._z,-e._z,t)&&fs(this._w,-e._w,t))}clone(){return new Xr(this._x,this._y,this._z,this._w)}copyFrom(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._w=e._w,this._isDirty=!0,this}copyFromFloats(e,t,i,r){return this._x=e,this._y=t,this._z=i,this._w=r,this._isDirty=!0,this}set(e,t,i,r){return this.copyFromFloats(e,t,i,r)}setAll(e){return this.copyFromFloats(e,e,e,e)}add(e){return new Xr(this._x+e._x,this._y+e._y,this._z+e._z,this._w+e._w)}addInPlace(e){return this._x+=e._x,this._y+=e._y,this._z+=e._z,this._w+=e._w,this._isDirty=!0,this}addToRef(e,t){return t._x=this._x+e._x,t._y=this._y+e._y,t._z=this._z+e._z,t._w=this._w+e._w,t._isDirty=!0,t}addInPlaceFromFloats(e,t,i,r){return this._x+=e,this._y+=t,this._z+=i,this._w+=r,this._isDirty=!0,this}subtractToRef(e,t){return t._x=this._x-e._x,t._y=this._y-e._y,t._z=this._z-e._z,t._w=this._w-e._w,t._isDirty=!0,t}subtractFromFloats(e,t,i,r){return this.subtractFromFloatsToRef(e,t,i,r,new Xr)}subtractFromFloatsToRef(e,t,i,r,n){return n._x=this._x-e,n._y=this._y-t,n._z=this._z-i,n._w=this._w-r,n._isDirty=!0,n}subtract(e){return new Xr(this._x-e._x,this._y-e._y,this._z-e._z,this._w-e._w)}subtractInPlace(e){return this._x-=e._x,this._y-=e._y,this._z-=e._z,this._w-=e._w,this._isDirty=!0,this}scale(e){return new Xr(this._x*e,this._y*e,this._z*e,this._w*e)}scaleToRef(e,t){return t._x=this._x*e,t._y=this._y*e,t._z=this._z*e,t._w=this._w*e,t._isDirty=!0,t}scaleInPlace(e){return this._x*=e,this._y*=e,this._z*=e,this._w*=e,this._isDirty=!0,this}scaleAndAddToRef(e,t){return t._x+=this._x*e,t._y+=this._y*e,t._z+=this._z*e,t._w+=this._w*e,t._isDirty=!0,t}multiply(e){const t=new Xr(0,0,0,1);return this.multiplyToRef(e,t),t}multiplyToRef(e,t){const i=this._x*e._w+this._y*e._z-this._z*e._y+this._w*e._x,r=-this._x*e._z+this._y*e._w+this._z*e._x+this._w*e._y,n=this._x*e._y-this._y*e._x+this._z*e._w+this._w*e._z,a=-this._x*e._x-this._y*e._y-this._z*e._z+this._w*e._w;return t.copyFromFloats(i,r,n,a),t}multiplyInPlace(e){return this.multiplyToRef(e,this)}multiplyByFloats(e,t,i,r){return this._x*=e,this._y*=t,this._z*=i,this._w*=r,this._isDirty=!0,this}divide(e){throw new ReferenceError("Can not divide a quaternion")}divideToRef(e,t){throw new ReferenceError("Can not divide a quaternion")}divideInPlace(e){throw new ReferenceError("Can not divide a quaternion")}minimizeInPlace(){throw new ReferenceError("Can not minimize a quaternion")}minimizeInPlaceFromFloats(){throw new ReferenceError("Can not minimize a quaternion")}maximizeInPlace(){throw new ReferenceError("Can not maximize a quaternion")}maximizeInPlaceFromFloats(){throw new ReferenceError("Can not maximize a quaternion")}negate(){return this.negateToRef(new Xr)}negateInPlace(){return this._x=-this._x,this._y=-this._y,this._z=-this._z,this._w=-this._w,this._isDirty=!0,this}negateToRef(e){return e._x=-this._x,e._y=-this._y,e._z=-this._z,e._w=-this._w,e._isDirty=!0,e}equalsToFloats(e,t,i,r){return this._x===e&&this._y===t&&this._z===i&&this._w===r}floorToRef(e){throw new ReferenceError("Can not floor a quaternion")}floor(){throw new ReferenceError("Can not floor a quaternion")}fractToRef(e){throw new ReferenceError("Can not fract a quaternion")}fract(){throw new ReferenceError("Can not fract a quaternion")}conjugateToRef(e){return e.copyFromFloats(-this._x,-this._y,-this._z,this._w),e}conjugateInPlace(){return this._x*=-1,this._y*=-1,this._z*=-1,this._isDirty=!0,this}conjugate(){return new Xr(-this._x,-this._y,-this._z,this._w)}invert(){const e=this.conjugate(),t=this.lengthSquared();return t==0||t==1||e.scaleInPlace(1/t),e}invertInPlace(){this.conjugateInPlace();const e=this.lengthSquared();return e==0||e==1?this:(this.scaleInPlace(1/e),this)}lengthSquared(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this.lengthSquared())}normalize(){return this.normalizeFromLength(this.length())}normalizeFromLength(e){return e===0||e===1?this:this.scaleInPlace(1/e)}normalizeToNew(){const e=new Xr(0,0,0,1);return this.normalizeToRef(e),e}normalizeToRef(e){const t=this.length();return t===0||t===1?e.copyFromFloats(this._x,this._y,this._z,this._w):this.scaleToRef(1/t,e)}toEulerAngles(){const e=O.Zero();return this.toEulerAnglesToRef(e),e}toEulerAnglesToRef(e){const t=this._z,i=this._x,r=this._y,n=this._w,a=r*t-i*n,o=.4999999;if(a<-o)e._y=2*Math.atan2(r,n),e._x=Math.PI/2,e._z=0,e._isDirty=!0;else if(a>o)e._y=2*Math.atan2(r,n),e._x=-Math.PI/2,e._z=0,e._isDirty=!0;else{const l=n*n,c=t*t,u=i*i,h=r*r;e._z=Math.atan2(2*(i*r+t*n),-c-u+h+l),e._x=Math.asin(-2*a),e._y=Math.atan2(2*(t*i+r*n),c-u-h+l),e._isDirty=!0}return e}toAlphaBetaGammaToRef(e){const t=this._z,i=this._x,r=this._y,n=this._w,a=Math.sqrt(i*i+r*r),o=Math.sqrt(t*t+n*n),l=2*Math.atan2(a,o),c=2*Math.atan2(t,n),u=2*Math.atan2(r,i),h=(c+u)/2,d=(c-u)/2;return e.set(d,l,h),e}toRotationMatrix(e){return Ce.FromQuaternionToRef(this,e),e}fromRotationMatrix(e){return Xr.FromRotationMatrixToRef(e,this),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}toAxisAngle(){const e=O.Zero(),t=this.toAxisAngleToRef(e);return{axis:e,angle:t}}toAxisAngleToRef(e){let t;const i=Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z),r=this._w;return i>0?(t=2*Math.atan2(i,r),e.set(this._x/i,this._y/i,this._z/i)):(t=0,e.set(1,0,0)),t}static FromRotationMatrix(e){const t=new Xr;return Xr.FromRotationMatrixToRef(e,t),t}static FromRotationMatrixToRef(e,t){const i=e.m,r=i[0],n=i[4],a=i[8],o=i[1],l=i[5],c=i[9],u=i[2],h=i[6],d=i[10],f=r+l+d;let m;return f>0?(m=.5/Math.sqrt(f+1),t._w=.25/m,t._x=(h-c)*m,t._y=(a-u)*m,t._z=(o-n)*m,t._isDirty=!0):r>l&&r>d?(m=2*Math.sqrt(1+r-l-d),t._w=(h-c)/m,t._x=.25*m,t._y=(n+o)/m,t._z=(a+u)/m,t._isDirty=!0):l>d?(m=2*Math.sqrt(1+l-r-d),t._w=(a-u)/m,t._x=(n+o)/m,t._y=.25*m,t._z=(c+h)/m,t._isDirty=!0):(m=2*Math.sqrt(1+d-r-l),t._w=(o-n)/m,t._x=(a+u)/m,t._y=(c+h)/m,t._z=.25*m,t._isDirty=!0),t}static Dot(e,t){return e._x*t._x+e._y*t._y+e._z*t._z+e._w*t._w}static AreClose(e,t,i=.1){const r=Xr.Dot(e,t);return 1-r*r<=i}static SmoothToRef(e,t,i,r,n){let a=r===0?1:i/r;return a=_r(a,0,1),Xr.SlerpToRef(e,t,a,n),n}static Zero(){return new Xr(0,0,0,0)}static Inverse(e){return new Xr(-e._x,-e._y,-e._z,e._w)}static InverseToRef(e,t){return t.set(-e._x,-e._y,-e._z,e._w),t}static Identity(){return new Xr(0,0,0,1)}static IsIdentity(e){return e&&e._x===0&&e._y===0&&e._z===0&&e._w===1}static RotationAxis(e,t){return Xr.RotationAxisToRef(e,t,new Xr)}static RotationAxisToRef(e,t,i){i._w=Math.cos(t/2);const r=Math.sin(t/2)/e.length();return i._x=e._x*r,i._y=e._y*r,i._z=e._z*r,i._isDirty=!0,i}static FromArray(e,t){return t||(t=0),new Xr(e[t],e[t+1],e[t+2],e[t+3])}static FromArrayToRef(e,t,i){return i._x=e[t],i._y=e[t+1],i._z=e[t+2],i._w=e[t+3],i._isDirty=!0,i}static FromFloatsToRef(e,t,i,r,n){return n.copyFromFloats(e,t,i,r),n}static FromEulerAngles(e,t,i){const r=new Xr;return Xr.RotationYawPitchRollToRef(t,e,i,r),r}static FromEulerAnglesToRef(e,t,i,r){return Xr.RotationYawPitchRollToRef(t,e,i,r),r}static FromEulerVector(e){const t=new Xr;return Xr.RotationYawPitchRollToRef(e._y,e._x,e._z,t),t}static FromEulerVectorToRef(e,t){return Xr.RotationYawPitchRollToRef(e._y,e._x,e._z,t),t}static FromUnitVectorsToRef(e,t,i,r=rr){const n=O.Dot(e,t)+1;return nMath.abs(e.z)?i.set(-e.y,e.x,0,0):i.set(0,-e.z,e.y,0):(O.CrossToRef(e,t,Ae.Vector3[0]),i.set(Ae.Vector3[0].x,Ae.Vector3[0].y,Ae.Vector3[0].z,n)),i.normalize()}static RotationYawPitchRoll(e,t,i){const r=new Xr;return Xr.RotationYawPitchRollToRef(e,t,i,r),r}static RotationYawPitchRollToRef(e,t,i,r){const n=i*.5,a=t*.5,o=e*.5,l=Math.sin(n),c=Math.cos(n),u=Math.sin(a),h=Math.cos(a),d=Math.sin(o),f=Math.cos(o);return r._x=f*u*c+d*h*l,r._y=d*h*c-f*u*l,r._z=f*h*l-d*u*c,r._w=f*h*c+d*u*l,r._isDirty=!0,r}static RotationAlphaBetaGamma(e,t,i){const r=new Xr;return Xr.RotationAlphaBetaGammaToRef(e,t,i,r),r}static RotationAlphaBetaGammaToRef(e,t,i,r){const n=(i+e)*.5,a=(i-e)*.5,o=t*.5;return r._x=Math.cos(a)*Math.sin(o),r._y=Math.sin(a)*Math.sin(o),r._z=Math.sin(n)*Math.cos(o),r._w=Math.cos(n)*Math.cos(o),r._isDirty=!0,r}static RotationQuaternionFromAxis(e,t,i){const r=new Xr(0,0,0,0);return Xr.RotationQuaternionFromAxisToRef(e,t,i,r),r}static RotationQuaternionFromAxisToRef(e,t,i,r){const n=Ci.Matrix[0];return e=e.normalizeToRef(Ci.Vector3[0]),t=t.normalizeToRef(Ci.Vector3[1]),i=i.normalizeToRef(Ci.Vector3[2]),Ce.FromXYZAxesToRef(e,t,i,n),Xr.FromRotationMatrixToRef(n,r),r}static FromLookDirectionLH(e,t){const i=new Xr;return Xr.FromLookDirectionLHToRef(e,t,i),i}static FromLookDirectionLHToRef(e,t,i){const r=Ci.Matrix[0];return Ce.LookDirectionLHToRef(e,t,r),Xr.FromRotationMatrixToRef(r,i),i}static FromLookDirectionRH(e,t){const i=new Xr;return Xr.FromLookDirectionRHToRef(e,t,i),i}static FromLookDirectionRHToRef(e,t,i){const r=Ci.Matrix[0];return Ce.LookDirectionRHToRef(e,t,r),Xr.FromRotationMatrixToRef(r,i)}static Slerp(e,t,i){const r=Xr.Identity();return Xr.SlerpToRef(e,t,i,r),r}static SlerpToRef(e,t,i,r){let n,a,o=e._x*t._x+e._y*t._y+e._z*t._z+e._w*t._w,l=!1;if(o<0&&(l=!0,o=-o),o>.999999)a=1-i,n=l?-i:i;else{const c=Math.acos(o),u=1/Math.sin(c);a=Math.sin((1-i)*c)*u,n=l?-Math.sin(i*c)*u:Math.sin(i*c)*u}return r._x=a*e._x+n*t._x,r._y=a*e._y+n*t._y,r._z=a*e._z+n*t._z,r._w=a*e._w+n*t._w,r._isDirty=!0,r}static Hermite(e,t,i,r,n){const a=n*n,o=n*a,l=2*o-3*a+1,c=-2*o+3*a,u=o-2*a+n,h=o-a,d=e._x*l+i._x*c+t._x*u+r._x*h,f=e._y*l+i._y*c+t._y*u+r._y*h,m=e._z*l+i._z*c+t._z*u+r._z*h,p=e._w*l+i._w*c+t._w*u+r._w*h;return new Xr(d,f,m,p)}static Hermite1stDerivative(e,t,i,r,n){const a=new Xr;return this.Hermite1stDerivativeToRef(e,t,i,r,n,a),a}static Hermite1stDerivativeToRef(e,t,i,r,n,a){const o=n*n;return a._x=(o-n)*6*e._x+(3*o-4*n+1)*t._x+(-o+n)*6*i._x+(3*o-2*n)*r._x,a._y=(o-n)*6*e._y+(3*o-4*n+1)*t._y+(-o+n)*6*i._y+(3*o-2*n)*r._y,a._z=(o-n)*6*e._z+(3*o-4*n+1)*t._z+(-o+n)*6*i._z+(3*o-2*n)*r._z,a._w=(o-n)*6*e._w+(3*o-4*n+1)*t._w+(-o+n)*6*i._w+(3*o-2*n)*r._w,a._isDirty=!0,a}static Normalize(e){const t=Xr.Zero();return Xr.NormalizeToRef(e,t),t}static NormalizeToRef(e,t){return e.normalizeToRef(t),t}static Clamp(e,t,i){const r=new Xr;return Xr.ClampToRef(e,t,i,r),r}static ClampToRef(e,t,i,r){return r.copyFromFloats(_r(e.x,t.x,i.x),_r(e.y,t.y,i.y),_r(e.z,t.z,i.z),_r(e.w,t.w,i.w))}static Random(e=0,t=1){return new Xr(ni(e,t),ni(e,t),ni(e,t),ni(e,t))}static RandomToRef(e=0,t=1,i){return i.copyFromFloats(ni(e,t),ni(e,t),ni(e,t),ni(e,t))}static Minimize(){throw new ReferenceError("Quaternion.Minimize does not make sense")}static Maximize(){throw new ReferenceError("Quaternion.Maximize does not make sense")}static Distance(e,t){return Math.sqrt(Xr.DistanceSquared(e,t))}static DistanceSquared(e,t){const i=e.x-t.x,r=e.y-t.y,n=e.z-t.z,a=e.w-t.w;return i*i+r*r+n*n+a*a}static Center(e,t){return Xr.CenterToRef(e,t,Xr.Zero())}static CenterToRef(e,t,i){return i.copyFromFloats((e.x+t.x)/2,(e.y+t.y)/2,(e.z+t.z)/2,(e.w+t.w)/2)}};gt._V8PerformanceHack=new gt(.5,.5,.5,.5);class Ce{static get Use64Bits(){return zl.MatrixUse64Bits}get m(){return this._m}markAsUpdated(){this.updateFlag=Y5._UpdateFlagSeed++,this._isIdentity=!1,this._isIdentity3x2=!1,this._isIdentityDirty=!0,this._isIdentity3x2Dirty=!0}_updateIdentityStatus(e,t=!1,i=!1,r=!0){this._isIdentity=e,this._isIdentity3x2=e||i,this._isIdentityDirty=this._isIdentity?!1:t,this._isIdentity3x2Dirty=this._isIdentity3x2?!1:r}constructor(){this._isIdentity=!1,this._isIdentityDirty=!0,this._isIdentity3x2=!0,this._isIdentity3x2Dirty=!0,this.updateFlag=-1,zl.MatrixTrackPrecisionChange&&zl.MatrixTrackedMatrices.push(this),this._m=new zl.MatrixCurrentType(16),this.markAsUpdated()}isIdentity(){if(this._isIdentityDirty){this._isIdentityDirty=!1;const e=this._m;this._isIdentity=e[0]===1&&e[1]===0&&e[2]===0&&e[3]===0&&e[4]===0&&e[5]===1&&e[6]===0&&e[7]===0&&e[8]===0&&e[9]===0&&e[10]===1&&e[11]===0&&e[12]===0&&e[13]===0&&e[14]===0&&e[15]===1}return this._isIdentity}isIdentityAs3x2(){return this._isIdentity3x2Dirty&&(this._isIdentity3x2Dirty=!1,this._m[0]!==1||this._m[5]!==1||this._m[15]!==1?this._isIdentity3x2=!1:this._m[1]!==0||this._m[2]!==0||this._m[3]!==0||this._m[4]!==0||this._m[6]!==0||this._m[7]!==0||this._m[8]!==0||this._m[9]!==0||this._m[10]!==0||this._m[11]!==0||this._m[12]!==0||this._m[13]!==0||this._m[14]!==0?this._isIdentity3x2=!1:this._isIdentity3x2=!0),this._isIdentity3x2}determinant(){if(this._isIdentity===!0)return 1;const e=this._m,t=e[0],i=e[1],r=e[2],n=e[3],a=e[4],o=e[5],l=e[6],c=e[7],u=e[8],h=e[9],d=e[10],f=e[11],m=e[12],p=e[13],_=e[14],v=e[15],x=d*v-_*f,S=h*v-p*f,b=h*_-p*d,y=u*v-m*f,I=u*_-d*m,R=u*p-m*h,A=+(o*x-l*S+c*b),P=-(a*x-l*y+c*I),w=+(a*S-o*y+c*R),L=-(a*b-o*I+l*R);return t*A+i*P+r*w+n*L}toString(){return`{${this.m[0]}, ${this.m[1]}, ${this.m[2]}, ${this.m[3]}
000545: ${this.m[4]}, ${this.m[5]}, ${this.m[6]}, ${this.m[7]}
000546: ${this.m[8]}, ${this.m[9]}, ${this.m[10]}, ${this.m[11]}
000547: ${this.m[12]}, ${this.m[13]}, ${this.m[14]}, ${this.m[15]}}`}toArray(e=null,t=0){if(!e)return this._m;const i=this._m;for(let r=0;r<16;r++)e[t+r]=i[r];return this}asArray(){return this._m}fromArray(e,t=0){return Ce.FromArrayToRef(e,t,this)}copyFromFloats(...e){return Ce.FromArrayToRef(e,0,this)}set(...e){const t=this._m;for(let i=0;i<16;i++)t[i]=e[i];return this.markAsUpdated(),this}setAll(e){const t=this._m;for(let i=0;i<16;i++)t[i]=e;return this.markAsUpdated(),this}invert(){return this.invertToRef(this),this}reset(){return Ce.FromValuesToRef(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,this),this._updateIdentityStatus(!1),this}add(e){const t=new Ce;return this.addToRef(e,t),t}addToRef(e,t){const i=this._m,r=t._m,n=e.m;for(let a=0;a<16;a++)r[a]=i[a]+n[a];return t.markAsUpdated(),t}addToSelf(e){const t=this._m,i=e.m;return t[0]+=i[0],t[1]+=i[1],t[2]+=i[2],t[3]+=i[3],t[4]+=i[4],t[5]+=i[5],t[6]+=i[6],t[7]+=i[7],t[8]+=i[8],t[9]+=i[9],t[10]+=i[10],t[11]+=i[11],t[12]+=i[12],t[13]+=i[13],t[14]+=i[14],t[15]+=i[15],this.markAsUpdated(),this}addInPlace(e){const t=this._m,i=e.m;for(let r=0;r<16;r++)t[r]+=i[r];return this.markAsUpdated(),this}addInPlaceFromFloats(...e){const t=this._m;for(let i=0;i<16;i++)t[i]+=e[i];return this.markAsUpdated(),this}subtract(e){const t=this._m,i=e.m;for(let r=0;r<16;r++)t[r]-=i[r];return this.markAsUpdated(),this}subtractToRef(e,t){const i=this._m,r=e.m,n=t._m;for(let a=0;a<16;a++)n[a]=i[a]-r[a];return t.markAsUpdated(),t}subtractInPlace(e){const t=this._m,i=e.m;for(let r=0;r<16;r++)t[r]-=i[r];return this.markAsUpdated(),this}subtractFromFloats(...e){return this.subtractFromFloatsToRef(...e,new Ce)}subtractFromFloatsToRef(...e){const t=e.pop(),i=this._m,r=t._m,n=e;for(let a=0;a<16;a++)r[a]=i[a]-n[a];return t.markAsUpdated(),t}invertToRef(e){return this._isIdentity===!0?(Ce.IdentityToRef(e),e):($me(this,e.asArray())?e.markAsUpdated():e.copyFrom(this),e)}addAtIndex(e,t){return this._m[e]+=t,this.markAsUpdated(),this}multiplyAtIndex(e,t){return this._m[e]*=t,this.markAsUpdated(),this}setTranslationFromFloats(e,t,i){return this._m[12]=e,this._m[13]=t,this._m[14]=i,this.markAsUpdated(),this}addTranslationFromFloats(e,t,i){return this._m[12]+=e,this._m[13]+=t,this._m[14]+=i,this.markAsUpdated(),this}setTranslation(e){return this.setTranslationFromFloats(e._x,e._y,e._z)}getTranslation(){return new O(this._m[12],this._m[13],this._m[14])}getTranslationToRef(e){return e.x=this._m[12],e.y=this._m[13],e.z=this._m[14],e}removeRotationAndScaling(){const e=this.m;return Ce.FromValuesToRef(1,0,0,0,0,1,0,0,0,0,1,0,e[12],e[13],e[14],e[15],this),this._updateIdentityStatus(e[12]===0&&e[13]===0&&e[14]===0&&e[15]===1),this}copyFrom(e){e.copyToArray(this._m);const t=e;return this.updateFlag=t.updateFlag,this._updateIdentityStatus(t._isIdentity,t._isIdentityDirty,t._isIdentity3x2,t._isIdentity3x2Dirty),this}copyToArray(e,t=0){return _ke(this,e,t),this}multiply(e){const t=new Ce;return this.multiplyToRef(e,t),t}multiplyInPlace(e){const t=this._m,i=e.m;for(let r=0;r<16;r++)t[r]*=i[r];return this.markAsUpdated(),this}multiplyByFloats(...e){const t=this._m;for(let i=0;i<16;i++)t[i]*=e[i];return this.markAsUpdated(),this}multiplyByFloatsToRef(...e){const t=e.pop(),i=this._m,r=t._m,n=e;for(let a=0;a<16;a++)r[a]=i[a]*n[a];return t.markAsUpdated(),t}multiplyToRef(e,t){return this._isIdentity?(t.copyFrom(e),t):e._isIdentity?(t.copyFrom(this),t):(this.multiplyToArray(e,t._m,0),t.markAsUpdated(),t)}multiplyToArray(e,t,i){return Xme(this,e,t,i),this}divide(e){return this.divideToRef(e,new Ce)}divideToRef(e,t){const i=this._m,r=e.m,n=t._m;for(let a=0;a<16;a++)n[a]=i[a]/r[a];return t.markAsUpdated(),t}divideInPlace(e){const t=this._m,i=e.m;for(let r=0;r<16;r++)t[r]/=i[r];return this.markAsUpdated(),this}minimizeInPlace(e){const t=this._m,i=e.m;for(let r=0;r<16;r++)t[r]=Math.min(t[r],i[r]);return this.markAsUpdated(),this}minimizeInPlaceFromFloats(...e){const t=this._m;for(let i=0;i<16;i++)t[i]=Math.min(t[i],e[i]);return this.markAsUpdated(),this}maximizeInPlace(e){const t=this._m,i=e.m;for(let r=0;r<16;r++)t[r]=Math.min(t[r],i[r]);return this.markAsUpdated(),this}maximizeInPlaceFromFloats(...e){const t=this._m;for(let i=0;i<16;i++)t[i]=Math.min(t[i],e[i]);return this.markAsUpdated(),this}negate(){return this.negateToRef(new Ce)}negateInPlace(){const e=this._m;for(let t=0;t<16;t++)e[t]=-e[t];return this.markAsUpdated(),this}negateToRef(e){const t=this._m,i=e._m;for(let r=0;r<16;r++)i[r]=-t[r];return e.markAsUpdated(),e}equals(e){const t=e;if(!t)return!1;if((this._isIdentity||t._isIdentity)&&!this._isIdentityDirty&&!t._isIdentityDirty)return this._isIdentity&&t._isIdentity;const i=this.m,r=t.m;return i[0]===r[0]&&i[1]===r[1]&&i[2]===r[2]&&i[3]===r[3]&&i[4]===r[4]&&i[5]===r[5]&&i[6]===r[6]&&i[7]===r[7]&&i[8]===r[8]&&i[9]===r[9]&&i[10]===r[10]&&i[11]===r[11]&&i[12]===r[12]&&i[13]===r[13]&&i[14]===r[14]&&i[15]===r[15]}equalsWithEpsilon(e,t=0){const i=this._m,r=e.m;for(let n=0;n<16;n++)if(!fs(i[n],r[n],t))return!1;return!0}equalsToFloats(...e){const t=this._m;for(let i=0;i<16;i++)if(t[i]!=e[i])return!1;return!0}floor(){return this.floorToRef(new Ce)}floorToRef(e){const t=this._m,i=e._m;for(let r=0;r<16;r++)i[r]=Math.floor(t[r]);return e.markAsUpdated(),e}fract(){return this.fractToRef(new Ce)}fractToRef(e){const t=this._m,i=e._m;for(let r=0;r<16;r++)i[r]=t[r]-Math.floor(t[r]);return e.markAsUpdated(),e}clone(){const e=new Ce;return e.copyFrom(this),e}getClassName(){return"Matrix"}getHashCode(){let e=nd(this._m[0]);for(let t=1;t<16;t++)e=e*397^nd(this._m[t]);return e}decomposeToTransformNode(e){return e.rotationQuaternion=e.rotationQuaternion||new gt,this.decompose(e.scaling,e.rotationQuaternion,e.position)}decompose(e,t,i,r,n=!0){if(this._isIdentity)return i&&i.setAll(0),e&&e.setAll(1),t&&t.copyFromFloats(0,0,0,1),!0;const a=this._m;if(i&&i.copyFromFloats(a[12],a[13],a[14]),e=e||Ci.Vector3[0],e.x=Math.sqrt(a[0]*a[0]+a[1]*a[1]+a[2]*a[2]),e.y=Math.sqrt(a[4]*a[4]+a[5]*a[5]+a[6]*a[6]),e.z=Math.sqrt(a[8]*a[8]+a[9]*a[9]+a[10]*a[10]),r){const o=(n?r.absoluteScaling.x:r.scaling.x)<0?-1:1,l=(n?r.absoluteScaling.y:r.scaling.y)<0?-1:1,c=(n?r.absoluteScaling.z:r.scaling.z)<0?-1:1;e.x*=o,e.y*=l,e.z*=c}else this.determinant()<=0&&(e.y*=-1);if(e._x===0||e._y===0||e._z===0)return t&&t.copyFromFloats(0,0,0,1),!1;if(t){const o=1/e._x,l=1/e._y,c=1/e._z;Ce.FromValuesToRef(a[0]*o,a[1]*o,a[2]*o,0,a[4]*l,a[5]*l,a[6]*l,0,a[8]*c,a[9]*c,a[10]*c,0,0,0,0,1,Ci.Matrix[0]),gt.FromRotationMatrixToRef(Ci.Matrix[0],t)}return!0}getRow(e){if(e<0||e>3)return null;const t=e*4;return new Hi(this._m[t+0],this._m[t+1],this._m[t+2],this._m[t+3])}getRowToRef(e,t){if(e>=0&&e<=3){const i=e*4;t.x=this._m[i+0],t.y=this._m[i+1],t.z=this._m[i+2],t.w=this._m[i+3]}return t}setRow(e,t){return this.setRowFromFloats(e,t.x,t.y,t.z,t.w)}transpose(){const e=new Ce;return Ce.TransposeToRef(this,e),e}transposeToRef(e){return Ce.TransposeToRef(this,e),e}setRowFromFloats(e,t,i,r,n){if(e<0||e>3)return this;const a=e*4;return this._m[a+0]=t,this._m[a+1]=i,this._m[a+2]=r,this._m[a+3]=n,this.markAsUpdated(),this}scale(e){const t=new Ce;return this.scaleToRef(e,t),t}scaleToRef(e,t){for(let i=0;i<16;i++)t._m[i]=this._m[i]*e;return t.markAsUpdated(),t}scaleAndAddToRef(e,t){for(let i=0;i<16;i++)t._m[i]+=this._m[i]*e;return t.markAsUpdated(),t}scaleInPlace(e){const t=this._m;for(let i=0;i<16;i++)t[i]*=e;return this.markAsUpdated(),this}toNormalMatrix(e){const t=Ci.Matrix[0];this.invertToRef(t),t.transposeToRef(e);const i=e._m;return Ce.FromValuesToRef(i[0],i[1],i[2],0,i[4],i[5],i[6],0,i[8],i[9],i[10],0,0,0,0,1,e),e}getRotationMatrix(){const e=new Ce;return this.getRotationMatrixToRef(e),e}getRotationMatrixToRef(e){const t=Ci.Vector3[0];if(!this.decompose(t))return Ce.IdentityToRef(e),e;const i=this._m,r=1/t._x,n=1/t._y,a=1/t._z;return Ce.FromValuesToRef(i[0]*r,i[1]*r,i[2]*r,0,i[4]*n,i[5]*n,i[6]*n,0,i[8]*a,i[9]*a,i[10]*a,0,0,0,0,1,e),e}toggleModelMatrixHandInPlace(){const e=this._m;return e[2]*=-1,e[6]*=-1,e[8]*=-1,e[9]*=-1,e[14]*=-1,this.markAsUpdated(),this}toggleProjectionMatrixHandInPlace(){const e=this._m;return e[8]*=-1,e[9]*=-1,e[10]*=-1,e[11]*=-1,this.markAsUpdated(),this}static FromArray(e,t=0){const i=new Ce;return Ce.FromArrayToRef(e,t,i),i}static FromArrayToRef(e,t,i){for(let r=0;r<16;r++)i._m[r]=e[r+t];return i.markAsUpdated(),i}static FromFloat32ArrayToRefScaled(e,t,i,r){return r._m[0]=e[0+t]*i,r._m[1]=e[1+t]*i,r._m[2]=e[2+t]*i,r._m[3]=e[3+t]*i,r._m[4]=e[4+t]*i,r._m[5]=e[5+t]*i,r._m[6]=e[6+t]*i,r._m[7]=e[7+t]*i,r._m[8]=e[8+t]*i,r._m[9]=e[9+t]*i,r._m[10]=e[10+t]*i,r._m[11]=e[11+t]*i,r._m[12]=e[12+t]*i,r._m[13]=e[13+t]*i,r._m[14]=e[14+t]*i,r._m[15]=e[15+t]*i,r.markAsUpdated(),r}static get IdentityReadOnly(){return Ce._IdentityReadOnly}static FromValuesToRef(e,t,i,r,n,a,o,l,c,u,h,d,f,m,p,_,v){const x=v._m;x[0]=e,x[1]=t,x[2]=i,x[3]=r,x[4]=n,x[5]=a,x[6]=o,x[7]=l,x[8]=c,x[9]=u,x[10]=h,x[11]=d,x[12]=f,x[13]=m,x[14]=p,x[15]=_,v.markAsUpdated()}static FromValues(e,t,i,r,n,a,o,l,c,u,h,d,f,m,p,_){const v=new Ce,x=v._m;return x[0]=e,x[1]=t,x[2]=i,x[3]=r,x[4]=n,x[5]=a,x[6]=o,x[7]=l,x[8]=c,x[9]=u,x[10]=h,x[11]=d,x[12]=f,x[13]=m,x[14]=p,x[15]=_,v.markAsUpdated(),v}static Compose(e,t,i){const r=new Ce;return Ce.ComposeToRef(e,t,i,r),r}static ComposeToRef(e,t,i,r){const n=r._m,a=t._x,o=t._y,l=t._z,c=t._w,u=a+a,h=o+o,d=l+l,f=a*u,m=a*h,p=a*d,_=o*h,v=o*d,x=l*d,S=c*u,b=c*h,y=c*d,I=e._x,R=e._y,A=e._z;return n[0]=(1-(_+x))*I,n[1]=(m+y)*I,n[2]=(p-b)*I,n[3]=0,n[4]=(m-y)*R,n[5]=(1-(f+x))*R,n[6]=(v+S)*R,n[7]=0,n[8]=(p+b)*A,n[9]=(v-S)*A,n[10]=(1-(f+_))*A,n[11]=0,n[12]=i._x,n[13]=i._y,n[14]=i._z,n[15]=1,r.markAsUpdated(),r}static Identity(){const e=Ce.FromValues(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return e._updateIdentityStatus(!0),e}static IdentityToRef(e){return Ce.FromValuesToRef(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1,e),e._updateIdentityStatus(!0),e}static Zero(){const e=Ce.FromValues(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);return e._updateIdentityStatus(!1),e}static RotationX(e){const t=new Ce;return Ce.RotationXToRef(e,t),t}static Invert(e){const t=new Ce;return e.invertToRef(t),t}static RotationXToRef(e,t){const i=Math.sin(e),r=Math.cos(e);return Ce.FromValuesToRef(1,0,0,0,0,r,i,0,0,-i,r,0,0,0,0,1,t),t._updateIdentityStatus(r===1&&i===0),t}static RotationY(e){const t=new Ce;return Ce.RotationYToRef(e,t),t}static RotationYToRef(e,t){const i=Math.sin(e),r=Math.cos(e);return Ce.FromValuesToRef(r,0,-i,0,0,1,0,0,i,0,r,0,0,0,0,1,t),t._updateIdentityStatus(r===1&&i===0),t}static RotationZ(e){const t=new Ce;return Ce.RotationZToRef(e,t),t}static RotationZToRef(e,t){const i=Math.sin(e),r=Math.cos(e);return Ce.FromValuesToRef(r,i,0,0,-i,r,0,0,0,0,1,0,0,0,0,1,t),t._updateIdentityStatus(r===1&&i===0),t}static RotationAxis(e,t){const i=new Ce;return Ce.RotationAxisToRef(e,t,i),i}static RotationAxisToRef(e,t,i){const r=Math.sin(-t),n=Math.cos(-t),a=1-n;e=e.normalizeToRef(Ci.Vector3[0]);const o=i._m;return o[0]=e._x*e._x*a+n,o[1]=e._x*e._y*a-e._z*r,o[2]=e._x*e._z*a+e._y*r,o[3]=0,o[4]=e._y*e._x*a+e._z*r,o[5]=e._y*e._y*a+n,o[6]=e._y*e._z*a-e._x*r,o[7]=0,o[8]=e._z*e._x*a-e._y*r,o[9]=e._z*e._y*a+e._x*r,o[10]=e._z*e._z*a+n,o[11]=0,o[12]=0,o[13]=0,o[14]=0,o[15]=1,i.markAsUpdated(),i}static RotationAlignToRef(e,t,i,r=!1){const n=O.Dot(t,e),a=i._m;if(n<-1+rr)a[0]=-1,a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=r?1:-1,a[6]=0,a[7]=0,a[8]=0,a[9]=0,a[10]=r?-1:1,a[11]=0;else{const o=O.Cross(t,e),l=1/(1+n);a[0]=o._x*o._x*l+n,a[1]=o._y*o._x*l-o._z,a[2]=o._z*o._x*l+o._y,a[3]=0,a[4]=o._x*o._y*l+o._z,a[5]=o._y*o._y*l+n,a[6]=o._z*o._y*l-o._x,a[7]=0,a[8]=o._x*o._z*l-o._y,a[9]=o._y*o._z*l+o._x,a[10]=o._z*o._z*l+n,a[11]=0}return a[12]=0,a[13]=0,a[14]=0,a[15]=1,i.markAsUpdated(),i}static RotationYawPitchRoll(e,t,i){const r=new Ce;return Ce.RotationYawPitchRollToRef(e,t,i,r),r}static RotationYawPitchRollToRef(e,t,i,r){return gt.RotationYawPitchRollToRef(e,t,i,Ci.Quaternion[0]),Ci.Quaternion[0].toRotationMatrix(r),r}static Scaling(e,t,i){const r=new Ce;return Ce.ScalingToRef(e,t,i,r),r}static ScalingToRef(e,t,i,r){return Ce.FromValuesToRef(e,0,0,0,0,t,0,0,0,0,i,0,0,0,0,1,r),r._updateIdentityStatus(e===1&&t===1&&i===1),r}static Translation(e,t,i){const r=new Ce;return Ce.TranslationToRef(e,t,i,r),r}static TranslationToRef(e,t,i,r){return Ce.FromValuesToRef(1,0,0,0,0,1,0,0,0,0,1,0,e,t,i,1,r),r._updateIdentityStatus(e===0&&t===0&&i===0),r}static Lerp(e,t,i){const r=new Ce;return Ce.LerpToRef(e,t,i,r),r}static LerpToRef(e,t,i,r){const n=r._m,a=e.m,o=t.m;for(let l=0;l<16;l++)n[l]=a[l]*(1-i)+o[l]*i;return r.markAsUpdated(),r}static DecomposeLerp(e,t,i){const r=new Ce;return Ce.DecomposeLerpToRef(e,t,i,r),r}static DecomposeLerpToRef(e,t,i,r){const n=Ci.Vector3[0],a=Ci.Quaternion[0],o=Ci.Vector3[1];e.decompose(n,a,o);const l=Ci.Vector3[2],c=Ci.Quaternion[1],u=Ci.Vector3[3];t.decompose(l,c,u);const h=Ci.Vector3[4];O.LerpToRef(n,l,i,h);const d=Ci.Quaternion[2];gt.SlerpToRef(a,c,i,d);const f=Ci.Vector3[5];return O.LerpToRef(o,u,i,f),Ce.ComposeToRef(h,d,f,r),r}static LookAtLH(e,t,i){const r=new Ce;return Ce.LookAtLHToRef(e,t,i,r),r}static LookAtLHToRef(e,t,i,r){const n=Ci.Vector3[0],a=Ci.Vector3[1],o=Ci.Vector3[2];t.subtractToRef(e,o),o.normalize(),O.CrossToRef(i,o,n);const l=n.lengthSquared();l===0?n.x=1:n.normalizeFromLength(Math.sqrt(l)),O.CrossToRef(o,n,a),a.normalize();const c=-O.Dot(n,e),u=-O.Dot(a,e),h=-O.Dot(o,e);return Ce.FromValuesToRef(n._x,a._x,o._x,0,n._y,a._y,o._y,0,n._z,a._z,o._z,0,c,u,h,1,r),r}static LookAtRH(e,t,i){const r=new Ce;return Ce.LookAtRHToRef(e,t,i,r),r}static LookAtRHToRef(e,t,i,r){const n=Ci.Vector3[0],a=Ci.Vector3[1],o=Ci.Vector3[2];e.subtractToRef(t,o),o.normalize(),O.CrossToRef(i,o,n);const l=n.lengthSquared();l===0?n.x=1:n.normalizeFromLength(Math.sqrt(l)),O.CrossToRef(o,n,a),a.normalize();const c=-O.Dot(n,e),u=-O.Dot(a,e),h=-O.Dot(o,e);return Ce.FromValuesToRef(n._x,a._x,o._x,0,n._y,a._y,o._y,0,n._z,a._z,o._z,0,c,u,h,1,r),r}static LookDirectionLH(e,t){const i=new Ce;return Ce.LookDirectionLHToRef(e,t,i),i}static LookDirectionLHToRef(e,t,i){const r=Ci.Vector3[0];r.copyFrom(e),r.scaleInPlace(-1);const n=Ci.Vector3[1];return O.CrossToRef(t,r,n),Ce.FromValuesToRef(n._x,n._y,n._z,0,t._x,t._y,t._z,0,r._x,r._y,r._z,0,0,0,0,1,i),i}static LookDirectionRH(e,t){const i=new Ce;return Ce.LookDirectionRHToRef(e,t,i),i}static LookDirectionRHToRef(e,t,i){const r=Ci.Vector3[2];return O.CrossToRef(t,e,r),Ce.FromValuesToRef(r._x,r._y,r._z,0,t._x,t._y,t._z,0,e._x,e._y,e._z,0,0,0,0,1,i),i}static OrthoLH(e,t,i,r,n){const a=new Ce;return Ce.OrthoLHToRef(e,t,i,r,a,n),a}static OrthoLHToRef(e,t,i,r,n,a){const o=i,l=r,c=2/e,u=2/t,h=2/(l-o),d=-(l+o)/(l-o);return Ce.FromValuesToRef(c,0,0,0,0,u,0,0,0,0,h,0,0,0,d,1,n),a&&n.multiplyToRef(Rb,n),n._updateIdentityStatus(c===1&&u===1&&h===1&&d===0),n}static OrthoOffCenterLH(e,t,i,r,n,a,o){const l=new Ce;return Ce.OrthoOffCenterLHToRef(e,t,i,r,n,a,l,o),l}static OrthoOffCenterLHToRef(e,t,i,r,n,a,o,l){const c=n,u=a,h=2/(t-e),d=2/(r-i),f=2/(u-c),m=-(u+c)/(u-c),p=(e+t)/(e-t),_=(r+i)/(i-r);return Ce.FromValuesToRef(h,0,0,0,0,d,0,0,0,0,f,0,p,_,m,1,o),l&&o.multiplyToRef(Rb,o),o.markAsUpdated(),o}static ObliqueOffCenterLHToRef(e,t,i,r,n,a,o,l,c,u,h){const d=-o*Math.cos(l),f=-o*Math.sin(l);return Ce.TranslationToRef(0,0,-c,Ci.Matrix[1]),Ce.FromValuesToRef(1,0,0,0,0,1,0,0,d,f,1,0,0,0,0,1,Ci.Matrix[0]),Ci.Matrix[1].multiplyToRef(Ci.Matrix[0],Ci.Matrix[0]),Ce.TranslationToRef(0,0,c,Ci.Matrix[1]),Ci.Matrix[0].multiplyToRef(Ci.Matrix[1],Ci.Matrix[0]),Ce.OrthoOffCenterLHToRef(e,t,i,r,n,a,u,h),Ci.Matrix[0].multiplyToRef(u,u),u}static OrthoOffCenterRH(e,t,i,r,n,a,o){const l=new Ce;return Ce.OrthoOffCenterRHToRef(e,t,i,r,n,a,l,o),l}static OrthoOffCenterRHToRef(e,t,i,r,n,a,o,l){return Ce.OrthoOffCenterLHToRef(e,t,i,r,n,a,o,l),o._m[10]*=-1,o}static ObliqueOffCenterRHToRef(e,t,i,r,n,a,o,l,c,u,h){const d=o*Math.cos(l),f=o*Math.sin(l);return Ce.TranslationToRef(0,0,c,Ci.Matrix[1]),Ce.FromValuesToRef(1,0,0,0,0,1,0,0,d,f,1,0,0,0,0,1,Ci.Matrix[0]),Ci.Matrix[1].multiplyToRef(Ci.Matrix[0],Ci.Matrix[0]),Ce.TranslationToRef(0,0,-c,Ci.Matrix[1]),Ci.Matrix[0].multiplyToRef(Ci.Matrix[1],Ci.Matrix[0]),Ce.OrthoOffCenterRHToRef(e,t,i,r,n,a,u,h),Ci.Matrix[0].multiplyToRef(u,u),u}static PerspectiveLH(e,t,i,r,n,a=0){const o=new Ce,l=i,c=r,u=2*l/e,h=2*l/t,d=(c+l)/(c-l),f=-2*c*l/(c-l),m=Math.tan(a);return Ce.FromValuesToRef(u,0,0,0,0,h,0,m,0,0,d,1,0,0,f,0,o),n&&o.multiplyToRef(Rb,o),o._updateIdentityStatus(!1),o}static PerspectiveFovLH(e,t,i,r,n,a=0,o=!1){const l=new Ce;return Ce.PerspectiveFovLHToRef(e,t,i,r,l,!0,n,a,o),l}static PerspectiveFovLHToRef(e,t,i,r,n,a=!0,o,l=0,c=!1){const u=i,h=r,d=1/Math.tan(e*.5),f=a?d/t:d,m=a?d:d*t,p=c&&u===0?-1:h!==0?(h+u)/(h-u):1,_=c&&u===0?2*h:h!==0?-2*h*u/(h-u):-2*u,v=Math.tan(l);return Ce.FromValuesToRef(f,0,0,0,0,m,0,v,0,0,p,1,0,0,_,0,n),o&&n.multiplyToRef(Rb,n),n._updateIdentityStatus(!1),n}static PerspectiveFovReverseLHToRef(e,t,i,r,n,a=!0,o,l=0){const c=1/Math.tan(e*.5),u=a?c/t:c,h=a?c:c*t,d=Math.tan(l);return Ce.FromValuesToRef(u,0,0,0,0,h,0,d,0,0,-i,1,0,0,1,0,n),o&&n.multiplyToRef(Rb,n),n._updateIdentityStatus(!1),n}static PerspectiveFovRH(e,t,i,r,n,a=0,o=!1){const l=new Ce;return Ce.PerspectiveFovRHToRef(e,t,i,r,l,!0,n,a,o),l}static PerspectiveFovRHToRef(e,t,i,r,n,a=!0,o,l=0,c=!1){const u=i,h=r,d=1/Math.tan(e*.5),f=a?d/t:d,m=a?d:d*t,p=c&&u===0?1:h!==0?-(h+u)/(h-u):-1,_=c&&u===0?2*h:h!==0?-2*h*u/(h-u):-2*u,v=Math.tan(l);return Ce.FromValuesToRef(f,0,0,0,0,m,0,v,0,0,p,-1,0,0,_,0,n),o&&n.multiplyToRef(Rb,n),n._updateIdentityStatus(!1),n}static PerspectiveFovReverseRHToRef(e,t,i,r,n,a=!0,o,l=0){const c=1/Math.tan(e*.5),u=a?c/t:c,h=a?c:c*t,d=Math.tan(l);return Ce.FromValuesToRef(u,0,0,0,0,h,0,d,0,0,-i,-1,0,0,-1,0,n),o&&n.multiplyToRef(Rb,n),n._updateIdentityStatus(!1),n}static GetFinalMatrix(e,t,i,r,n,a){const o=e.width,l=e.height,c=e.x,u=e.y,h=Ce.FromValues(o/2,0,0,0,0,-l/2,0,0,0,0,a-n,0,c+o/2,l/2+u,n,1),d=new Ce;return t.multiplyToRef(i,d),d.multiplyToRef(r,d),d.multiplyToRef(h,d)}static GetAsMatrix2x2(e){const t=e.m,i=[t[0],t[1],t[4],t[5]];return zl.MatrixUse64Bits?i:new Float32Array(i)}static GetAsMatrix3x3(e){const t=e.m,i=[t[0],t[1],t[2],t[4],t[5],t[6],t[8],t[9],t[10]];return zl.MatrixUse64Bits?i:new Float32Array(i)}static Transpose(e){const t=new Ce;return Ce.TransposeToRef(e,t),t}static TransposeToRef(e,t){const i=e.m,r=i[0],n=i[4],a=i[8],o=i[12],l=i[1],c=i[5],u=i[9],h=i[13],d=i[2],f=i[6],m=i[10],p=i[14],_=i[3],v=i[7],x=i[11],S=i[15],b=t._m;return b[0]=r,b[1]=n,b[2]=a,b[3]=o,b[4]=l,b[5]=c,b[6]=u,b[7]=h,b[8]=d,b[9]=f,b[10]=m,b[11]=p,b[12]=_,b[13]=v,b[14]=x,b[15]=S,t.markAsUpdated(),t._updateIdentityStatus(e._isIdentity,e._isIdentityDirty),t}static Reflection(e){const t=new Ce;return Ce.ReflectionToRef(e,t),t}static ReflectionToRef(e,t){e.normalize();const i=e.normal.x,r=e.normal.y,n=e.normal.z,a=-2*i,o=-2*r,l=-2*n;return Ce.FromValuesToRef(a*i+1,o*i,l*i,0,a*r,o*r+1,l*r,0,a*n,o*n,l*n+1,0,a*e.d,o*e.d,l*e.d,1,t),t}static FromXYZAxesToRef(e,t,i,r){return Ce.FromValuesToRef(e._x,e._y,e._z,0,t._x,t._y,t._z,0,i._x,i._y,i._z,0,0,0,0,1,r),r}static FromQuaternionToRef(e,t){const i=e._x*e._x,r=e._y*e._y,n=e._z*e._z,a=e._x*e._y,o=e._z*e._w,l=e._z*e._x,c=e._y*e._w,u=e._y*e._z,h=e._x*e._w;return t._m[0]=1-2*(r+n),t._m[1]=2*(a+o),t._m[2]=2*(l-c),t._m[3]=0,t._m[4]=2*(a-o),t._m[5]=1-2*(n+i),t._m[6]=2*(u+h),t._m[7]=0,t._m[8]=2*(l+c),t._m[9]=2*(u-h),t._m[10]=1-2*(r+i),t._m[11]=0,t._m[12]=0,t._m[13]=0,t._m[14]=0,t._m[15]=1,t.markAsUpdated(),t}}Ce._IdentityReadOnly=Ce.Identity();class Ci{}Ci.Vector3=YS(11,O.Zero);Ci.Matrix=YS(2,Ce.Identity);Ci.Quaternion=YS(3,gt.Zero);class Ae{}Ae.Vector2=YS(3,vt.Zero);Ae.Vector3=YS(13,O.Zero);Ae.Vector4=YS(3,Hi.Zero);Ae.Quaternion=YS(3,gt.Zero);Ae.Matrix=YS(8,Ce.Identity);const Rb=Ce.FromValues(1,0,0,0,0,1,0,0,0,0,.5,0,0,0,.5,1);function HE(s){return Math.pow(s,TD)}function jE(s){return s<=.04045?.0773993808*s:Math.pow(.947867299*(s+.055),2.4)}function XE(s){return Math.pow(s,sR)}function $E(s){return s<=.0031308?12.92*s:1.055*Math.pow(s,.41666)-.055}class rt{constructor(e=0,t=0,i=0){this.r=e,this.g=t,this.b=i}toString(){return"{R: "+this.r+" G:"+this.g+" B:"+this.b+"}"}getClassName(){return"Color3"}getHashCode(){let e=this.r*255|0;return e=e*397^(this.g*255|0),e=e*397^(this.b*255|0),e}toArray(e,t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,this}fromArray(e,t=0){return rt.FromArrayToRef(e,t,this),this}toColor4(e=1){return new $t(this.r,this.g,this.b,e)}asArray(){return[this.r,this.g,this.b]}toLuminance(){return this.r*.3+this.g*.59+this.b*.11}multiply(e){return new rt(this.r*e.r,this.g*e.g,this.b*e.b)}multiplyToRef(e,t){return t.r=this.r*e.r,t.g=this.g*e.g,t.b=this.b*e.b,t}multiplyInPlace(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyByFloats(e,t,i){return new rt(this.r*e,this.g*t,this.b*i)}divide(e){throw new ReferenceError("Can not divide a color")}divideToRef(e,t){throw new ReferenceError("Can not divide a color")}divideInPlace(e){throw new ReferenceError("Can not divide a color")}minimizeInPlace(e){return this.minimizeInPlaceFromFloats(e.r,e.g,e.b)}maximizeInPlace(e){return this.maximizeInPlaceFromFloats(e.r,e.g,e.b)}minimizeInPlaceFromFloats(e,t,i){return this.r=Math.min(e,this.r),this.g=Math.min(t,this.g),this.b=Math.min(i,this.b),this}maximizeInPlaceFromFloats(e,t,i){return this.r=Math.max(e,this.r),this.g=Math.max(t,this.g),this.b=Math.max(i,this.b),this}floorToRef(e){throw new ReferenceError("Can not floor a color")}floor(){throw new ReferenceError("Can not floor a color")}fractToRef(e){throw new ReferenceError("Can not fract a color")}fract(){throw new ReferenceError("Can not fract a color")}equals(e){return e&&this.r===e.r&&this.g===e.g&&this.b===e.b}equalsFloats(e,t,i){return this.equalsToFloats(e,t,i)}equalsToFloats(e,t,i){return this.r===e&&this.g===t&&this.b===i}equalsWithEpsilon(e,t=rr){return fs(this.r,e.r,t)&&fs(this.g,e.g,t)&&fs(this.b,e.b,t)}negate(){throw new ReferenceError("Can not negate a color")}negateInPlace(){throw new ReferenceError("Can not negate a color")}negateToRef(e){throw new ReferenceError("Can not negate a color")}scale(e){return new rt(this.r*e,this.g*e,this.b*e)}scaleInPlace(e){return this.r*=e,this.g*=e,this.b*=e,this}scaleToRef(e,t){return t.r=this.r*e,t.g=this.g*e,t.b=this.b*e,t}scaleAndAddToRef(e,t){return t.r+=this.r*e,t.g+=this.g*e,t.b+=this.b*e,t}clampToRef(e=0,t=1,i){return i.r=_r(this.r,e,t),i.g=_r(this.g,e,t),i.b=_r(this.b,e,t),i}add(e){return new rt(this.r+e.r,this.g+e.g,this.b+e.b)}addInPlace(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addInPlaceFromFloats(e,t,i){return this.r+=e,this.g+=t,this.b+=i,this}addToRef(e,t){return t.r=this.r+e.r,t.g=this.g+e.g,t.b=this.b+e.b,t}subtract(e){return new rt(this.r-e.r,this.g-e.g,this.b-e.b)}subtractToRef(e,t){return t.r=this.r-e.r,t.g=this.g-e.g,t.b=this.b-e.b,t}subtractInPlace(e){return this.r-=e.r,this.g-=e.g,this.b-=e.b,this}subtractFromFloats(e,t,i){return new rt(this.r-e,this.g-t,this.b-i)}subtractFromFloatsToRef(e,t,i,r){return r.r=this.r-e,r.g=this.g-t,r.b=this.b-i,r}clone(){return new rt(this.r,this.g,this.b)}copyFrom(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copyFromFloats(e,t,i){return this.r=e,this.g=t,this.b=i,this}set(e,t,i){return this.copyFromFloats(e,t,i)}setAll(e){return this.r=this.g=this.b=e,this}toHexString(){const e=Math.round(this.r*255),t=Math.round(this.g*255),i=Math.round(this.b*255);return"#"+wm(e)+wm(t)+wm(i)}fromHexString(e){return e.substring(0,1)!=="#"||e.length!==7?this:(this.r=parseInt(e.substring(1,3),16)/255,this.g=parseInt(e.substring(3,5),16)/255,this.b=parseInt(e.substring(5,7),16)/255,this)}toHSV(){return this.toHSVToRef(new rt)}toHSVToRef(e){const t=this.r,i=this.g,r=this.b,n=Math.max(t,i,r),a=Math.min(t,i,r);let o=0,l=0;const c=n,u=n-a;return n!==0&&(l=u/n),n!=a&&(n==t?(o=(i-r)/u,i=0&&a<=1?(l=n,c=o):a>=1&&a<=2?(l=o,c=n):a>=2&&a<=3?(c=n,u=o):a>=3&&a<=4?(c=o,u=n):a>=4&&a<=5?(l=o,u=n):a>=5&&a<=6&&(l=n,u=o);const h=i-n;return r.r=l+h,r.g=c+h,r.b=u+h,r}static FromHSV(e,t,i){const r=new rt(0,0,0);return rt.HSVtoRGBToRef(e,t,i,r),r}static FromHexString(e){return new rt(0,0,0).fromHexString(e)}static FromArray(e,t=0){return new rt(e[t],e[t+1],e[t+2])}static FromArrayToRef(e,t=0,i){i.r=e[t],i.g=e[t+1],i.b=e[t+2]}static FromInts(e,t,i){return new rt(e/255,t/255,i/255)}static Lerp(e,t,i){const r=new rt(0,0,0);return rt.LerpToRef(e,t,i,r),r}static LerpToRef(e,t,i,r){r.r=e.r+(t.r-e.r)*i,r.g=e.g+(t.g-e.g)*i,r.b=e.b+(t.b-e.b)*i}static Hermite(e,t,i,r,n){const a=n*n,o=n*a,l=2*o-3*a+1,c=-2*o+3*a,u=o-2*a+n,h=o-a,d=e.r*l+i.r*c+t.r*u+r.r*h,f=e.g*l+i.g*c+t.g*u+r.g*h,m=e.b*l+i.b*c+t.b*u+r.b*h;return new rt(d,f,m)}static Hermite1stDerivative(e,t,i,r,n){const a=rt.Black();return this.Hermite1stDerivativeToRef(e,t,i,r,n,a),a}static Hermite1stDerivativeToRef(e,t,i,r,n,a){const o=n*n;a.r=(o-n)*6*e.r+(3*o-4*n+1)*t.r+(-o+n)*6*i.r+(3*o-2*n)*r.r,a.g=(o-n)*6*e.g+(3*o-4*n+1)*t.g+(-o+n)*6*i.g+(3*o-2*n)*r.g,a.b=(o-n)*6*e.b+(3*o-4*n+1)*t.b+(-o+n)*6*i.b+(3*o-2*n)*r.b}static Red(){return new rt(1,0,0)}static Green(){return new rt(0,1,0)}static Blue(){return new rt(0,0,1)}static Black(){return new rt(0,0,0)}static get BlackReadOnly(){return rt._BlackReadOnly}static White(){return new rt(1,1,1)}static Purple(){return new rt(.5,0,.5)}static Magenta(){return new rt(1,0,1)}static Yellow(){return new rt(1,1,0)}static Gray(){return new rt(.5,.5,.5)}static Teal(){return new rt(0,1,1)}static Random(){return new rt(Math.random(),Math.random(),Math.random())}}rt._V8PerformanceHack=new rt(.5,.5,.5);rt._BlackReadOnly=rt.Black();class $t{constructor(e=0,t=0,i=0,r=1){this.r=e,this.g=t,this.b=i,this.a=r}asArray(){return[this.r,this.g,this.b,this.a]}toArray(e,t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e[t+3]=this.a,this}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this.a=e[t+3],this}equals(e){return e&&this.r===e.r&&this.g===e.g&&this.b===e.b&&this.a===e.a}add(e){return new $t(this.r+e.r,this.g+e.g,this.b+e.b,this.a+e.a)}addToRef(e,t){return t.r=this.r+e.r,t.g=this.g+e.g,t.b=this.b+e.b,t.a=this.a+e.a,t}addInPlace(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this.a+=e.a,this}addInPlaceFromFloats(e,t,i,r){return this.r+=e,this.g+=t,this.b+=i,this.a+=r,this}subtract(e){return new $t(this.r-e.r,this.g-e.g,this.b-e.b,this.a-e.a)}subtractToRef(e,t){return t.r=this.r-e.r,t.g=this.g-e.g,t.b=this.b-e.b,t.a=this.a-e.a,t}subtractInPlace(e){return this.r-=e.r,this.g-=e.g,this.b-=e.b,this.a-=e.a,this}subtractFromFloats(e,t,i,r){return new $t(this.r-e,this.g-t,this.b-i,this.a-r)}subtractFromFloatsToRef(e,t,i,r,n){return n.r=this.r-e,n.g=this.g-t,n.b=this.b-i,n.a=this.a-r,n}scale(e){return new $t(this.r*e,this.g*e,this.b*e,this.a*e)}scaleInPlace(e){return this.r*=e,this.g*=e,this.b*=e,this.a*=e,this}scaleToRef(e,t){return t.r=this.r*e,t.g=this.g*e,t.b=this.b*e,t.a=this.a*e,t}scaleAndAddToRef(e,t){return t.r+=this.r*e,t.g+=this.g*e,t.b+=this.b*e,t.a+=this.a*e,t}clampToRef(e=0,t=1,i){return i.r=_r(this.r,e,t),i.g=_r(this.g,e,t),i.b=_r(this.b,e,t),i.a=_r(this.a,e,t),i}multiply(e){return new $t(this.r*e.r,this.g*e.g,this.b*e.b,this.a*e.a)}multiplyToRef(e,t){return t.r=this.r*e.r,t.g=this.g*e.g,t.b=this.b*e.b,t.a=this.a*e.a,t}multiplyInPlace(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this.a*=e.a,this}multiplyByFloats(e,t,i,r){return new $t(this.r*e,this.g*t,this.b*i,this.a*r)}divide(e){throw new ReferenceError("Can not divide a color")}divideToRef(e,t){throw new ReferenceError("Can not divide a color")}divideInPlace(e){throw new ReferenceError("Can not divide a color")}minimizeInPlace(e){return this.r=Math.min(this.r,e.r),this.g=Math.min(this.g,e.g),this.b=Math.min(this.b,e.b),this.a=Math.min(this.a,e.a),this}maximizeInPlace(e){return this.r=Math.max(this.r,e.r),this.g=Math.max(this.g,e.g),this.b=Math.max(this.b,e.b),this.a=Math.max(this.a,e.a),this}minimizeInPlaceFromFloats(e,t,i,r){return this.r=Math.min(e,this.r),this.g=Math.min(t,this.g),this.b=Math.min(i,this.b),this.a=Math.min(r,this.a),this}maximizeInPlaceFromFloats(e,t,i,r){return this.r=Math.max(e,this.r),this.g=Math.max(t,this.g),this.b=Math.max(i,this.b),this.a=Math.max(r,this.a),this}floorToRef(e){throw new ReferenceError("Can not floor a color")}floor(){throw new ReferenceError("Can not floor a color")}fractToRef(e){throw new ReferenceError("Can not fract a color")}fract(){throw new ReferenceError("Can not fract a color")}negate(){throw new ReferenceError("Can not negate a color")}negateInPlace(){throw new ReferenceError("Can not negate a color")}negateToRef(e){throw new ReferenceError("Can not negate a color")}equalsWithEpsilon(e,t=rr){return fs(this.r,e.r,t)&&fs(this.g,e.g,t)&&fs(this.b,e.b,t)&&fs(this.a,e.a,t)}equalsToFloats(e,t,i,r){return this.r===e&&this.g===t&&this.b===i&&this.a===r}toString(){return"{R: "+this.r+" G:"+this.g+" B:"+this.b+" A:"+this.a+"}"}getClassName(){return"Color4"}getHashCode(){let e=this.r*255|0;return e=e*397^(this.g*255|0),e=e*397^(this.b*255|0),e=e*397^(this.a*255|0),e}clone(){return new $t().copyFrom(this)}copyFrom(e){return this.r=e.r,this.g=e.g,this.b=e.b,this.a=e.a,this}copyFromFloats(e,t,i,r){return this.r=e,this.g=t,this.b=i,this.a=r,this}set(e,t,i,r){return this.copyFromFloats(e,t,i,r)}setAll(e){return this.r=this.g=this.b=this.a=e,this}toHexString(e=!1){const t=Math.round(this.r*255),i=Math.round(this.g*255),r=Math.round(this.b*255);if(e)return"#"+wm(t)+wm(i)+wm(r);const n=Math.round(this.a*255);return"#"+wm(t)+wm(i)+wm(r)+wm(n)}fromHexString(e){return e.substring(0,1)!=="#"||e.length!==9&&e.length!==7?this:(this.r=parseInt(e.substring(1,3),16)/255,this.g=parseInt(e.substring(3,5),16)/255,this.b=parseInt(e.substring(5,7),16)/255,e.length===9&&(this.a=parseInt(e.substring(7,9),16)/255),this)}toLinearSpace(e=!1){const t=new $t;return this.toLinearSpaceToRef(t,e),t}toLinearSpaceToRef(e,t=!1){return t?(e.r=jE(this.r),e.g=jE(this.g),e.b=jE(this.b)):(e.r=HE(this.r),e.g=HE(this.g),e.b=HE(this.b)),e.a=this.a,this}toGammaSpace(e=!1){const t=new $t;return this.toGammaSpaceToRef(t,e),t}toGammaSpaceToRef(e,t=!1){return t?(e.r=$E(this.r),e.g=$E(this.g),e.b=$E(this.b)):(e.r=XE(this.r),e.g=XE(this.g),e.b=XE(this.b)),e.a=this.a,this}static FromHexString(e){return e.substring(0,1)!=="#"||e.length!==9&&e.length!==7?new $t(0,0,0,0):new $t(0,0,0,1).fromHexString(e)}static Lerp(e,t,i){return $t.LerpToRef(e,t,i,new $t)}static LerpToRef(e,t,i,r){return r.r=e.r+(t.r-e.r)*i,r.g=e.g+(t.g-e.g)*i,r.b=e.b+(t.b-e.b)*i,r.a=e.a+(t.a-e.a)*i,r}static Hermite(e,t,i,r,n){const a=n*n,o=n*a,l=2*o-3*a+1,c=-2*o+3*a,u=o-2*a+n,h=o-a,d=e.r*l+i.r*c+t.r*u+r.r*h,f=e.g*l+i.g*c+t.g*u+r.g*h,m=e.b*l+i.b*c+t.b*u+r.b*h,p=e.a*l+i.a*c+t.a*u+r.a*h;return new $t(d,f,m,p)}static Hermite1stDerivative(e,t,i,r,n){const a=new $t;return this.Hermite1stDerivativeToRef(e,t,i,r,n,a),a}static Hermite1stDerivativeToRef(e,t,i,r,n,a){const o=n*n;a.r=(o-n)*6*e.r+(3*o-4*n+1)*t.r+(-o+n)*6*i.r+(3*o-2*n)*r.r,a.g=(o-n)*6*e.g+(3*o-4*n+1)*t.g+(-o+n)*6*i.g+(3*o-2*n)*r.g,a.b=(o-n)*6*e.b+(3*o-4*n+1)*t.b+(-o+n)*6*i.b+(3*o-2*n)*r.b,a.a=(o-n)*6*e.a+(3*o-4*n+1)*t.a+(-o+n)*6*i.a+(3*o-2*n)*r.a}static FromColor3(e,t=1){return new $t(e.r,e.g,e.b,t)}static FromArray(e,t=0){return new $t(e[t],e[t+1],e[t+2],e[t+3])}static FromArrayToRef(e,t=0,i){i.r=e[t],i.g=e[t+1],i.b=e[t+2],i.a=e[t+3]}static FromInts(e,t,i,r){return new $t(e/255,t/255,i/255,r/255)}static CheckColors4(e,t){if(e.length===t*3){const i=[];for(let r=0;rnew $t(0,0,0,0));class In{constructor(e,t){this.triggerOptions=e,this.onBeforeExecuteObservable=new Ge,e.parameter?(this.trigger=e.trigger,this._triggerParameter=e.parameter):e.trigger?this.trigger=e.trigger:this.trigger=e,this._nextActiveAction=this,this._condition=t}_prepare(){}getTriggerParameter(){return this._triggerParameter}setTriggerParameter(e){this._triggerParameter=e}_evaluateConditionForCurrentFrame(){const e=this._condition;if(!e)return!0;const t=this._actionManager.getScene().getRenderId();return e._evaluationId!==t&&(e._evaluationId=t,e._currentResult=e.isValid()),e._currentResult}_executeCurrent(e){this._evaluateConditionForCurrentFrame()&&(this.onBeforeExecuteObservable.notifyObservers(this),this._nextActiveAction.execute(e),this.skipToNextActiveAction())}execute(e){}skipToNextActiveAction(){this._nextActiveAction._child?(this._nextActiveAction._child._actionManager||(this._nextActiveAction._child._actionManager=this._actionManager),this._nextActiveAction=this._nextActiveAction._child):this._nextActiveAction=this}then(e){return this._child=e,e._actionManager=this._actionManager,e._prepare(),e}_getProperty(e){return this._actionManager._getProperty(e)}_getEffectiveTarget(e,t){return this._actionManager._getEffectiveTarget(e,t)}serialize(e){return null}_serialize(e,t){const i={type:1,children:[],name:e.name,properties:e.properties||[]};if(this._child&&this._child.serialize(i),this._condition){const r=this._condition.serialize();return r.children.push(i),t&&t.children.push(r),r}return t&&t.children.push(i),i}}In._SerializeValueAsString=s=>typeof s=="number"?s.toString():typeof s=="boolean"?s?"true":"false":s instanceof vt?s.x+", "+s.y:s instanceof O?s.x+", "+s.y+", "+s.z:s instanceof rt?s.r+", "+s.g+", "+s.b:s instanceof $t?s.r+", "+s.g+", "+s.b+", "+s.a:s;In._GetTargetProperty=s=>({name:"target",targetType:s._isMesh?"MeshProperties":s._isLight?"LightProperties":s._isCamera?"CameraProperties":s._isMaterial?"MaterialProperties":"SceneProperties",value:s._isScene?"Scene":s.name});let iY=!1;function qme(){iY||(iY=!0,Se("BABYLON.Action",In))}qme();class ca{constructor(e,t,i,r,n,a){this.source=e,this.pointerX=t,this.pointerY=i,this.meshUnderPointer=r,this.sourceEvent=n,this.additionalData=a}static CreateNew(e,t,i){const r=e.getScene();return new ca(e,r.pointerX,r.pointerY,r.meshUnderPointer||e,t,i)}static CreateNewFromSprite(e,t,i,r){return new ca(e,t.pointerX,t.pointerY,t.meshUnderPointer,i,r)}static CreateNewFromScene(e,t){return new ca(null,e.pointerX,e.pointerY,e.meshUnderPointer,t)}static CreateNewFromPrimitive(e,t,i,r){return new ca(e,t.x,t.y,null,i,r)}}class jR{constructor(e){this._actionManager=e}isValid(){return!0}_getProperty(e){return this._actionManager._getProperty(e)}_getEffectiveTarget(e,t){return this._actionManager._getEffectiveTarget(e,t)}serialize(){}_serialize(e){return{type:2,children:[],name:e.name,properties:e.properties}}}class Sl extends jR{static get IsEqual(){return Sl._IsEqual}static get IsDifferent(){return Sl._IsDifferent}static get IsGreater(){return Sl._IsGreater}static get IsLesser(){return Sl._IsLesser}constructor(e,t,i,r,n=Sl.IsEqual){super(e),this.propertyPath=i,this.value=r,this.operator=n,this._target=t,this._effectiveTarget=this._getEffectiveTarget(t,this.propertyPath),this._property=this._getProperty(this.propertyPath)}isValid(){switch(this.operator){case Sl.IsGreater:return this._effectiveTarget[this._property]>this.value;case Sl.IsLesser:return this._effectiveTarget[this._property]r<10?"0"+r:""+r,i=new Date;return"["+t(i.getHours())+":"+t(i.getMinutes())+":"+t(i.getSeconds())+"]: "+e}static _LogDisabled(e,t){}static _LogEnabled(e=1,t,i){const r=Array.isArray(t)?t[0]:t;if(i!==void 0&&!ye._CheckLimit(r,i))return;const n=ye._FormatMessage(r),a=this._Levels[e],o=Array.isArray(t)?t.slice(1):[];a.logFunc&&a.logFunc("BJS - "+n,...o);const l=`${n}
`;ye._AddLogEntry(l),ye._GenerateLimitMessage(r,e)}static get LogCache(){return ye._LogCache}static ClearLogCache(){ye._LogCache="",ye._LogLimitOutputs={},ye.errorsCount=0}static set LogLevels(e){ye.Log=ye._LogDisabled,ye.Warn=ye._LogDisabled,ye.Error=ye._LogDisabled;const t=[ye.MessageLogLevel,ye.WarningLogLevel,ye.ErrorLogLevel];for(const i of t)if((e&i)===i){const r=this._Levels[i];ye[r.name]=ye._LogEnabled.bind(ye,i)}}}ye.NoneLogLevel=0;ye.MessageLogLevel=1;ye.WarningLogLevel=2;ye.ErrorLogLevel=4;ye.AllLogLevel=7;ye.MessageLimitReached="Too many %TYPE%s (%LIMIT%), no more %TYPE%s will be reported for this message.";ye._LogCache="";ye._LogLimitOutputs={};ye._Levels=[{},{color:"white",logFunc:console.log,name:"Log"},{color:"orange",logFunc:console.warn,name:"Warn"},{},{color:"red",logFunc:console.error,name:"Error"}];ye.errorsCount=0;ye.Log=ye._LogEnabled.bind(ye,ye.MessageLogLevel);ye.Warn=ye._LogEnabled.bind(ye,ye.WarningLogLevel);ye.Error=ye._LogEnabled.bind(ye,ye.ErrorLogLevel);class xke extends In{constructor(e,t,i,r){super(e,r),this.propertyPath=i,this._target=this._effectiveTarget=t}_prepare(){this._effectiveTarget=this._getEffectiveTarget(this._effectiveTarget,this.propertyPath),this._property=this._getProperty(this.propertyPath)}execute(){this._effectiveTarget[this._property]=!this._effectiveTarget[this._property]}serialize(e){return super._serialize({name:"SwitchBooleanAction",properties:[In._GetTargetProperty(this._target),{name:"propertyPath",value:this.propertyPath}]},e)}}class Ske extends In{constructor(e,t,i,r){super(e,r),this.value=i,this._target=t}execute(){this._target.state=this.value}serialize(e){return super._serialize({name:"SetStateAction",properties:[In._GetTargetProperty(this._target),{name:"value",value:this.value}]},e)}}class bke extends In{constructor(e,t,i,r,n){super(e,n),this.propertyPath=i,this.value=r,this._target=this._effectiveTarget=t}_prepare(){this._effectiveTarget=this._getEffectiveTarget(this._effectiveTarget,this.propertyPath),this._property=this._getProperty(this.propertyPath)}execute(){this._effectiveTarget[this._property]=this.value,this._target.markAsDirty&&this._target.markAsDirty(this._property)}serialize(e){return super._serialize({name:"SetValueAction",properties:[In._GetTargetProperty(this._target),{name:"propertyPath",value:this.propertyPath},{name:"value",value:In._SerializeValueAsString(this.value)}]},e)}}class Tke extends In{constructor(e,t,i,r,n){super(e,n),this.propertyPath=i,this.value=r,this._target=this._effectiveTarget=t}_prepare(){this._effectiveTarget=this._getEffectiveTarget(this._effectiveTarget,this.propertyPath),this._property=this._getProperty(this.propertyPath),typeof this._effectiveTarget[this._property]!="number"&&ye.Warn("Warning: IncrementValueAction can only be used with number values")}execute(){this._effectiveTarget[this._property]+=this.value,this._target.markAsDirty&&this._target.markAsDirty(this._property)}serialize(e){return super._serialize({name:"IncrementValueAction",properties:[In._GetTargetProperty(this._target),{name:"propertyPath",value:this.propertyPath},{name:"value",value:In._SerializeValueAsString(this.value)}]},e)}}class yke extends In{constructor(e,t,i,r,n,a){super(e,a),this.from=i,this.to=r,this.loop=n,this._target=t}_prepare(){}execute(){this._actionManager.getScene().beginAnimation(this._target,this.from,this.to,this.loop)}serialize(e){return super._serialize({name:"PlayAnimationAction",properties:[In._GetTargetProperty(this._target),{name:"from",value:String(this.from)},{name:"to",value:String(this.to)},{name:"loop",value:In._SerializeValueAsString(this.loop)||!1}]},e)}}class Eke extends In{constructor(e,t,i){super(e,i),this._target=t}_prepare(){}execute(){this._actionManager.getScene().stopAnimation(this._target)}serialize(e){return super._serialize({name:"StopAnimationAction",properties:[In._GetTargetProperty(this._target)]},e)}}class Kme extends In{constructor(e=0,t){super(e,t)}execute(){}serialize(e){return super._serialize({name:"DoNothingAction",properties:[]},e)}}class Cke extends In{constructor(e,t,i,r=!0){super(e,i),this.children=t,this.enableChildrenConditions=r}_prepare(){for(let e=0;e!s||s.getClassName&&s.getClassName()==="Mesh"?null:s.getClassName&&(s.getClassName()==="SubMesh"||s.getClassName()==="PhysicsBody")?s.clone(e):s.clone?s.clone():Array.isArray(s)?s.slice():t&&typeof s=="object"?{...s}:null;function Ike(s){const e=[];do{const t=Object.getOwnPropertyNames(s);for(const i of t)e.indexOf(i)===-1&&e.push(i)}while(s=Object.getPrototypeOf(s));return e}class $l{static DeepCopy(e,t,i,r,n=!1){const a=Ike(e);for(const o of a){if(o[0]==="_"&&(!r||r.indexOf(o)===-1)||o.endsWith("Observable")||i&&i.indexOf(o)!==-1)continue;const l=e[o],c=typeof l;if(c!=="function")try{if(c==="object")if(l instanceof Uint8Array)t[o]=Uint8Array.from(l);else if(l instanceof Array){if(t[o]=[],l.length>0)if(typeof l[0]=="object")for(let u=0;u-1&&this._scene.actionManagers.splice(e,1);const t=this._scene.meshes.filter(i=>i.actionManager===this);for(const i of t)i.actionManager=null}getScene(){return this._scene}hasSpecificTriggers(e){for(let t=0;t-1)return!0}return!1}hasSpecificTriggers2(e,t){for(let i=0;i=Ws.OnPickTrigger&&t.trigger<=Ws.OnPointerOutTrigger&&t._evaluateConditionForCurrentFrame())return!0}return!1}get hasPickTriggers(){for(let e=0;e=Ws.OnPickTrigger&&t.trigger<=Ws.OnPickUpTrigger&&t._evaluateConditionForCurrentFrame())return!0}return!1}registerAction(e){return e.trigger===Ws.OnEveryFrameTrigger&&this.getScene().actionManager!==this?(ye.Warn("OnEveryFrameTrigger can only be used with scene.actionManager"),null):(this.actions.push(e),this.getScene()._registeredActions++,Ws.Triggers[e.trigger]?Ws.Triggers[e.trigger]++:Ws.Triggers[e.trigger]=1,e._actionManager=this,e._prepare(),e)}unregisterAction(e){const t=this.actions.indexOf(e);return t!==-1?(this.actions.splice(t,1),Ws.Triggers[e.trigger]-=1,Ws.Triggers[e.trigger]===0&&delete Ws.Triggers[e.trigger],e._actionManager=null,this.getScene()._registeredActions--,!0):!1}processTrigger(e,t){for(let i=0;i{const u=ia("BABYLON."+l);return u&&new u(...c)},a=(l,c,u,h)=>{if(h===null){const p=parseFloat(c);return c==="true"||c==="false"?c==="true":isNaN(p)?c:p}const d=h.split("."),f=c.split(",");for(let p=0;p{if(l.detached)return;const f=[];let m=null,p=null;const _=l.combine&&l.combine.length>0;if(l.type===2?f.push(r):f.push(c),_){const x=[];for(let S=0;S0){const h=u.properties[0].value,d=u.properties[0].targetType===null?h:i.getMeshByName(h);d._meshId&&(d.mesh=i.getMeshById(d._meshId)),c={trigger:Ws[u.name],parameter:d}}else c=Ws[u.name];for(let h=0;h=0;f--){var m={};for(var p in i)m[p]=p==="access"?{}:i[p];for(var p in i.access)m.access[p]=i.access[p];m.addInitializer=function(v){if(d)throw new TypeError("Cannot add initializers after decoration has completed");n.push(a(v||null))};var _=(0,t[f])(o==="accessor"?{get:u.get,set:u.set}:u[l],m);if(o==="accessor"){if(_===void 0)continue;if(_===null||typeof _!="object")throw new TypeError("Object expected");(h=a(_.get))&&(u.get=h),(h=a(_.set))&&(u.set=h),(h=a(_.init))&&r.unshift(h)}else(h=a(_))&&(o==="field"?r.unshift(h):u[l]=h)}c&&Object.defineProperty(c,i.name,u),d=!0}function C(s,e,t){for(var i=arguments.length>2,r=0;r{if(!i.metadata)return;const r=String(i.name),n=e_e(i.metadata);n[r]||(n[r]={type:s,sourceName:e})}}function Lke(s,e=null){return(t,i)=>{const r=e||"_"+String(i.name);return{init(n){return(n!==void 0||!(r in this))&&(this[r]=n),n},get(){return this[r]},set(n){var a;typeof((a=this[r])==null?void 0:a.equals)=="function"&&this[r].equals(n)||this[r]!==n&&(this[r]=n,this[s]())}}}}function ht(s,e=null){return Lke(s,e)}function se(s){return Kp(0,s)}function Ur(s){return Kp(1,s)}function Gn(s){return Kp(2,s)}function CC(s){return Kp(3,s)}function Z5(s){return Kp(4,s)}function Rl(s){return Kp(5,s)}function qI(s){return Kp(6,s)}function Fke(s){return Kp(7,s)}function K5(s){return Kp(8,s)}function Bke(s){return Kp(10,s)}function QF(s){return Kp(12,s)}function kke(s){return Kp(11,s)}function t_e(s,e,t){const i=String(e.name);let r=null;const n=function(...a){if(r===null){r=s,typeof _native<"u"&&_native[i]&&(r=t(_native[i],s));const o=this&&(e.static?this:Object.getPrototypeOf(this));(o==null?void 0:o[i])===n&&(o[i]=r)}return r.apply(this,a)};return n}function bv(s,e){return t_e(s,e,t=>t)}bv.filter=function(s){return(e,t)=>t_e(e,t,(i,r)=>function(...n){return s(...n)?i(...n):r.apply(this,n)})};function tr(s,e=null){return(t,i)=>{const r=e||"_"+String(i.name);return{get(){var n;return(n=this[r])==null?void 0:n.value},set(n){var a,o;typeof((o=(a=this[r])==null?void 0:a.value)==null?void 0:o.equals)=="function"&&this[r].value.equals(n)||this[r].value!==n&&(this[r].value=n,this[s]())}}}}class rT{static Eval(e,t){return e.match(/\([^()]*\)/g)?e=e.replace(/\([^()]*\)/g,i=>(i=i.slice(1,i.length-1),rT._HandleParenthesisContent(i,t))):e=rT._HandleParenthesisContent(e,t),e==="true"?!0:e==="false"?!1:rT.Eval(e,t)}static _HandleParenthesisContent(e,t){t=t||(n=>n==="true");let i;const r=e.split("||");for(const n in r)if(Object.prototype.hasOwnProperty.call(r,n)){let a=rT._SimplifyNegation(r[n].trim());const o=a.split("&&");if(o.length>1)for(let l=0;l(t=t.replace(/[\s]/g,()=>""),t.length%2?"!":"")),e=e.trim(),e==="!true"?e="false":e==="!false"&&(e="true"),e}}class rs{static EnableFor(e){e._tags=e._tags||{},e.hasTags=()=>rs.HasTags(e),e.addTags=t=>rs.AddTagsTo(e,t),e.removeTags=t=>rs.RemoveTagsFrom(e,t),e.matchesTagsQuery=t=>rs.MatchesQuery(e,t)}static DisableFor(e){delete e._tags,delete e.hasTags,delete e.addTags,delete e.removeTags,delete e.matchesTagsQuery}static HasTags(e){if(!e._tags)return!1;const t=e._tags;for(const i in t)if(Object.prototype.hasOwnProperty.call(t,i))return!0;return!1}static GetTags(e,t=!0){if(!e._tags)return null;if(t){const i=[];for(const r in e._tags)Object.prototype.hasOwnProperty.call(e._tags,r)&&e._tags[r]===!0&&i.push(r);return i.join(" ")}else return e._tags}static AddTagsTo(e,t){if(!t||typeof t!="string")return;const i=t.split(" ");for(const r of i)rs._AddTagTo(e,r)}static _AddTagTo(e,t){t=t.trim(),!(t===""||t==="true"||t==="false")&&(t.match(/[\s]/)||t.match(/^([!]|([|]|[&]){2})/)||(rs.EnableFor(e),e._tags[t]=!0))}static RemoveTagsFrom(e,t){if(!rs.HasTags(e))return;const i=t.split(" ");for(const r in i)rs._RemoveTagFrom(e,i[r])}static _RemoveTagFrom(e,t){delete e._tags[t]}static MatchesQuery(e,t){return t===void 0?!0:t===""?rs.HasTags(e):rT.Eval(t,i=>rs.HasTags(e)&&e._tags[i])}}const hY=function(s,e,t,i={}){const r=s();rs&&rs.HasTags(e)&&rs.AddTagsTo(r,rs.GetTags(e,!0));const n=KF(r),a={};for(const o in n){const l=n[o],c=e[o],u=l.type;if(c!=null&&(o!=="uniqueId"||li.AllowLoadingUniqueId))switch(u){case 0:case 6:case 9:case 11:typeof c.slice=="function"?r[o]=c.slice():r[o]=c;break;case 1:i.cloneTexturesOnlyOnce&&a[c.uniqueId]?r[o]=a[c.uniqueId]:(r[o]=t||c.isRenderTarget?c:c.clone(),a[c.uniqueId]=r[o]);break;case 2:case 3:case 4:case 5:case 7:case 8:case 10:case 12:case 13:r[o]=t?c:c.clone();break}}return r};class li{static AppendSerializedAnimations(e,t){if(e.animations){t.animations=[];for(let i=0;i{throw Wi("ImageProcessingConfiguration")};li._FresnelParametersParser=s=>{throw Wi("FresnelParameters")};li._ColorCurvesParser=s=>{throw Wi("ColorCurves")};li._TextureParser=(s,e,t)=>{throw Wi("Texture")};class Vke{constructor(){this._doNotSerialize=!1,this._isDisposed=!1,this._sceneRootNodesIndex=-1,this._isEnabled=!0,this._isParentEnabled=!0,this._isReady=!0,this._onEnabledStateChangedObservable=new Ge,this._onClonedObservable=new Ge,this._inheritVisibility=!1,this._isVisible=!0}}let rn=(()=>{var s;let e,t=[],i=[],r,n=[],a=[],o,l=[],c=[],u,h=[],d=[],f,m=[],p=[];return s=class{static AddNodeConstructor(v,x){this._NodeConstructors[v]=x}static Construct(v,x,S,b){const y=this._NodeConstructors[v];return y?y(x,S,b):null}set accessibilityTag(v){this._accessibilityTag=v,this.onAccessibilityTagChangedObservable.notifyObservers(v)}get accessibilityTag(){return this._accessibilityTag}get doNotSerialize(){return this._nodeDataStorage._doNotSerialize?!0:this._parentNode?this._parentNode.doNotSerialize:!1}set doNotSerialize(v){this._nodeDataStorage._doNotSerialize=v}isDisposed(){return this._nodeDataStorage._isDisposed}set parent(v){if(this._parentNode===v)return;const x=this._parentNode;if(this._parentNode&&this._parentNode._children!==void 0&&this._parentNode._children!==null){const S=this._parentNode._children.indexOf(this);S!==-1&&this._parentNode._children.splice(S,1),!v&&!this._nodeDataStorage._isDisposed&&this._addToSceneRootNodes()}this._parentNode=v,this._isDirty=!0,this._parentNode&&((this._parentNode._children===void 0||this._parentNode._children===null)&&(this._parentNode._children=new Array),this._parentNode._children.push(this),x||this._removeFromSceneRootNodes()),this._syncParentEnabledState()}get parent(){return this._parentNode}get inheritVisibility(){return this._nodeDataStorage._inheritVisibility}set inheritVisibility(v){this._nodeDataStorage._inheritVisibility=v}get isVisible(){return this.inheritVisibility&&this._parentNode&&!this._parentNode.isVisible?!1:this._nodeDataStorage._isVisible}set isVisible(v){this._nodeDataStorage._isVisible=v}_serializeAsParent(v){v.parentId=this.uniqueId}_addToSceneRootNodes(){this._nodeDataStorage._sceneRootNodesIndex===-1&&(this._nodeDataStorage._sceneRootNodesIndex=this._scene.rootNodes.length,this._scene.rootNodes.push(this))}_removeFromSceneRootNodes(){if(this._nodeDataStorage._sceneRootNodesIndex!==-1){const v=this._scene.rootNodes,x=v.length-1;v[this._nodeDataStorage._sceneRootNodesIndex]=v[x],v[this._nodeDataStorage._sceneRootNodesIndex]._nodeDataStorage._sceneRootNodesIndex=this._nodeDataStorage._sceneRootNodesIndex,this._scene.rootNodes.pop(),this._nodeDataStorage._sceneRootNodesIndex=-1}}get animationPropertiesOverride(){return this._animationPropertiesOverride?this._animationPropertiesOverride:this._scene.animationPropertiesOverride}set animationPropertiesOverride(v){this._animationPropertiesOverride=v}getClassName(){return"Node"}set onDispose(v){this._onDisposeObserver&&this.onDisposeObservable.remove(this._onDisposeObserver),this._onDisposeObserver=this.onDisposeObservable.add(v)}get onEnabledStateChangedObservable(){return this._nodeDataStorage._onEnabledStateChangedObservable}get onClonedObservable(){return this._nodeDataStorage._onClonedObservable}constructor(v,x=null,S=!0){this._isDirty=!1,this._nodeDataStorage=new Vke,this.name=C(this,t,void 0),this.id=(C(this,i),C(this,n,void 0)),this.uniqueId=(C(this,a),C(this,l,void 0)),this.state=(C(this,c),C(this,h,"")),this.metadata=(C(this,d),C(this,m,null)),this._internalMetadata=C(this,p),this.reservedDataStore=null,this._accessibilityTag=null,this.onAccessibilityTagChangedObservable=new Ge,this._parentContainer=null,this.animations=[],this._ranges={},this.onReady=null,this._currentRenderId=-1,this._parentUpdateId=-1,this._childUpdateId=-1,this._waitingParentId=null,this._waitingParentInstanceIndex=null,this._waitingParsedUniqueId=null,this._cache={},this._parentNode=null,this._children=null,this._worldMatrix=Ce.Identity(),this._worldMatrixDeterminant=0,this._worldMatrixDeterminantIsDirty=!0,this._animationPropertiesOverride=null,this._isNode=!0,this.onDisposeObservable=new Ge,this._onDisposeObserver=null,this._behaviors=new Array,this.name=v,this.id=v,this._scene=x||Kt.LastCreatedScene,this.uniqueId=this._scene.getUniqueId(),this._initCache(),S&&this._addToSceneRootNodes()}getScene(){return this._scene}getEngine(){return this._scene.getEngine()}addBehavior(v,x=!1){return this._behaviors.indexOf(v)!==-1?this:(v.init(),this._scene.isLoading&&!x?this._scene.onDataLoadedObservable.addOnce(()=>{this._behaviors.includes(v)&&v.attach(this)}):v.attach(this),this._behaviors.push(v),this)}removeBehavior(v){const x=this._behaviors.indexOf(v);return x===-1?this:(this._behaviors.splice(x,1),v.detach(),this)}get behaviors(){return this._behaviors}getBehaviorByName(v){for(const x of this._behaviors)if(x.name===v)return x;return null}getWorldMatrix(){return this._currentRenderId!==this._scene.getRenderId()&&this.computeWorldMatrix(),this._worldMatrix}_getWorldMatrixDeterminant(){return this._worldMatrixDeterminantIsDirty&&(this._worldMatrixDeterminantIsDirty=!1,this._worldMatrixDeterminant=this._worldMatrix.determinant()),this._worldMatrixDeterminant}get worldMatrixFromCache(){return this._worldMatrix}_initCache(){this._cache={}}updateCache(v){!v&&this.isSynchronized()||this._updateCache()}_getActionManagerForTrigger(v,x=!0){return this.parent?this.parent._getActionManagerForTrigger(v,!1):null}_updateCache(v){}_isSynchronized(){return!0}_markSyncedWithParent(){this._parentNode&&(this._parentUpdateId=this._parentNode._childUpdateId)}isSynchronizedWithParent(){return this._parentNode?this._parentNode._isDirty||this._parentUpdateId!==this._parentNode._childUpdateId?!1:this._parentNode.isSynchronized():!0}isSynchronized(){return this._parentNode&&!this.isSynchronizedWithParent()?!1:this._isSynchronized()}isReady(v=!1){return this._nodeDataStorage._isReady}markAsDirty(v){return this._currentRenderId=Number.MAX_VALUE,this._isDirty=!0,this}isEnabled(v=!0){return v===!1?this._nodeDataStorage._isEnabled:this._nodeDataStorage._isEnabled?this._nodeDataStorage._isParentEnabled:!1}_syncParentEnabledState(){if(this._nodeDataStorage._isParentEnabled=this._parentNode?this._parentNode.isEnabled():!0,this._children)for(const v of this._children)v._syncParentEnabledState()}setEnabled(v){this._nodeDataStorage._isEnabled!==v&&(this._nodeDataStorage._isEnabled=v,this._syncParentEnabledState(),this._nodeDataStorage._onEnabledStateChangedObservable.notifyObservers(v))}isDescendantOf(v){return this.parent?this.parent===v?!0:this.parent.isDescendantOf(v):!1}_getDescendants(v,x=!1,S){if(this._children)for(let b=0;b(!x||x(b))&&b.cullingStrategy!==void 0),S}getChildren(v,x=!0){return this.getDescendants(x,v)}_setReady(v){if(v!==this._nodeDataStorage._isReady){if(!v){this._nodeDataStorage._isReady=!1;return}this.onReady&&this.onReady(this),this._nodeDataStorage._isReady=!0}}getAnimationByName(v){for(let x=0;xnew s(v,this.getScene()),this);if(x&&(b.parent=x),!S){const y=this.getDescendants(!0);for(let I=0;I{const _=typeof Symbol=="function"&&Symbol.metadata?Object.create(null):void 0;e=[se()],r=[se()],o=[se()],u=[se()],f=[se()],F(null,null,e,{kind:"field",name:"name",static:!1,private:!1,access:{has:v=>"name"in v,get:v=>v.name,set:(v,x)=>{v.name=x}},metadata:_},t,i),F(null,null,r,{kind:"field",name:"id",static:!1,private:!1,access:{has:v=>"id"in v,get:v=>v.id,set:(v,x)=>{v.id=x}},metadata:_},n,a),F(null,null,o,{kind:"field",name:"uniqueId",static:!1,private:!1,access:{has:v=>"uniqueId"in v,get:v=>v.uniqueId,set:(v,x)=>{v.uniqueId=x}},metadata:_},l,c),F(null,null,u,{kind:"field",name:"state",static:!1,private:!1,access:{has:v=>"state"in v,get:v=>v.state,set:(v,x)=>{v.state=x}},metadata:_},h,d),F(null,null,f,{kind:"field",name:"metadata",static:!1,private:!1,access:{has:v=>"metadata"in v,get:v=>v.metadata,set:(v,x)=>{v.metadata=x}},metadata:_},m,p),_&&Object.defineProperty(s,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:_})})(),s._AnimationRangeFactory=(_,v,x)=>{throw Wi("AnimationRange")},s._NodeConstructors={},s})();class Lf{constructor(e,t){this.width=e,this.height=t}toString(){return`{W: ${this.width}, H: ${this.height}}`}getClassName(){return"Size"}getHashCode(){let e=this.width|0;return e=e*397^(this.height|0),e}copyFrom(e){this.width=e.width,this.height=e.height}copyFromFloats(e,t){return this.width=e,this.height=t,this}set(e,t){return this.copyFromFloats(e,t)}multiplyByFloats(e,t){return new Lf(this.width*e,this.height*t)}clone(){return new Lf(this.width,this.height)}equals(e){return e?this.width===e.width&&this.height===e.height:!1}get surface(){return this.width*this.height}static Zero(){return new Lf(0,0)}add(e){return new Lf(this.width+e.width,this.height+e.height)}subtract(e){return new Lf(this.width-e.width,this.height-e.height)}scale(e){return new Lf(this.width*e,this.height*e)}static Lerp(e,t,i){const r=e.width+(t.width-e.width)*i,n=e.height+(t.height-e.height)*i;return new Lf(r,n)}}function Uke(){return typeof _native<"u"&&_native.XMLHttpRequest?new _native.XMLHttpRequest:new XMLHttpRequest}class cn{constructor(){this._xhr=Uke(),this._requestURL=""}static get IsCustomRequestAvailable(){return Object.keys(cn.CustomRequestHeaders).length>0||cn.CustomRequestModifiers.length>0}static _CleanUrl(e){return e=e.replace("file:http:","http:"),e=e.replace("file:https:","https:"),e}static _ShouldSkipRequestModifications(e){return cn.SkipRequestModificationForBabylonCDN&&(e.includes("preview.babylonjs.com")||e.includes("cdn.babylonjs.com"))}static _CollectCustomizations(e,t={}){const i={...t};if(cn._ShouldSkipRequestModifications(e))return{url:e,headers:i};for(const n in cn.CustomRequestHeaders){const a=cn.CustomRequestHeaders[n];a&&(i[n]=a)}const r={setRequestHeader:(n,a)=>{i[n]=a}};for(const n of cn.CustomRequestModifiers){if(cn._ShouldSkipRequestModifications(e))break;const a=n(r,e);typeof a=="string"&&(e=a)}return{url:e,headers:i}}static async FetchAsync(e,t={}){const i=t.method??"GET";if(typeof fetch<"u"){const{url:r,headers:n}=cn._CollectCustomizations(cn._CleanUrl(e),t.headers??{});return await fetch(r,{method:i,headers:n,body:t.body??void 0})}return await new Promise((r,n)=>{const a=new cn;a.responseType="arraybuffer",a.addEventListener("readystatechange",()=>{if(a.readyState===4)if(a.status>=200&&a.status<300){const o=typeof Headers<"u"?new Headers:void 0,l=a.getResponseHeader("Content-Type");l&&o&&o.set("Content-Type",l),r(typeof Response<"u"?new Response(a.response,{status:a.status,statusText:a.statusText,headers:o}):{ok:!0,status:a.status,statusText:a.statusText,headers:{get:c=>a.getResponseHeader(c)},arrayBuffer:async()=>await Promise.resolve(a.response)})}else n(new Error(`HTTP ${a.status} loading '${a.requestURL}': ${a.statusText}`))}),a.open(i,e,t.headers),a.send(t.body??null)})}get requestURL(){return this._requestURL}get onprogress(){return this._xhr.onprogress}set onprogress(e){this._xhr.onprogress=e}get readyState(){return this._xhr.readyState}get status(){return this._xhr.status}get statusText(){return this._xhr.statusText}get response(){return this._xhr.response}get responseURL(){return this._xhr.responseURL}get responseText(){return this._xhr.responseText}get responseType(){return this._xhr.responseType}set responseType(e){this._xhr.responseType=e}get timeout(){return this._xhr.timeout}set timeout(e){this._xhr.timeout=e}addEventListener(e,t,i){this._xhr.addEventListener(e,t,i)}removeEventListener(e,t,i){this._xhr.removeEventListener(e,t,i)}abort(){this._xhr.abort()}send(e){this._xhr.send(e)}open(e,t,i){const{url:r,headers:n}=cn._CollectCustomizations(t,i);this._requestURL=cn._CleanUrl(r),this._xhr.open(e,this._requestURL,!0);for(const a in n)this._xhr.setRequestHeader(a,n[a])}setRequestHeader(e,t){this._xhr.setRequestHeader(e,t)}getResponseHeader(e){return this._xhr.getResponseHeader(e)}}cn.CustomRequestHeaders={};cn.CustomRequestModifiers=new Array;cn.SkipRequestModificationForBabylonCDN=!0;const i_e=Object.freeze(new gt(0,0,0,0)),r_e=Object.freeze(O.Zero()),s_e=Object.freeze(vt.Zero()),n_e=Object.freeze(Lf.Zero()),a_e=Object.freeze(rt.Black()),o_e=Object.freeze(new $t(0,0,0,0)),ym={key:0,repeatCount:0,loopMode:2};class _t{static _PrepareAnimation(e,t,i,r,n,a,o,l){let c;if(!isNaN(parseFloat(n))&&isFinite(n)?c=_t.ANIMATIONTYPE_FLOAT:n instanceof gt?c=_t.ANIMATIONTYPE_QUATERNION:n instanceof O?c=_t.ANIMATIONTYPE_VECTOR3:n instanceof vt?c=_t.ANIMATIONTYPE_VECTOR2:n instanceof rt?c=_t.ANIMATIONTYPE_COLOR3:n instanceof $t?c=_t.ANIMATIONTYPE_COLOR4:n instanceof Lf&&(c=_t.ANIMATIONTYPE_SIZE),c==null)return null;const u=new _t(e,t,i,c,o),h=[{frame:0,value:n},{frame:r,value:a}];return u.setKeys(h),l!==void 0&&u.setEasingFunction(l),u}get runtimeAnimations(){return this._runtimeAnimations}get hasRunningRuntimeAnimations(){for(const e of this._runtimeAnimations)if(!e.isStopped())return!0;return!1}constructor(e,t,i,r,n,a){this.name=e,this.targetProperty=t,this.framePerSecond=i,this.dataType=r,this.loopMode=n,this.enableBlending=a,this._easingFunction=null,this._runtimeAnimations=new Array,this._events=new Array,this.blendingSpeed=.01,this._ranges={},this._coreAnimation=null,this.targetPropertyPath=t.split("."),this.dataType=r,this.loopMode=n===void 0?_t.ANIMATIONLOOPMODE_CYCLE:n,this.uniqueId=_t._UniqueIdGenerator++}toString(e){let t="Name: "+this.name+", property: "+this.targetProperty;if(t+=", datatype: "+["Float","Vector3","Quaternion","Matrix","Color3","Vector2"][this.dataType],t+=", nKeys: "+(this._keys?this._keys.length:"none"),t+=", nRanges: "+(this._ranges?Object.keys(this._ranges).length:"none"),e){t+=", Ranges: {";let i=!0;for(const r in this._ranges)i||(t+=", "),i=!1,t+=r;t+="}"}return t}addEvent(e){this._events.push(e),this._events.sort((t,i)=>t.frame-i.frame)}removeEvents(e){for(let t=0;t=0;a--)this._keys[a].frame>=r&&this._keys[a].frame<=n&&this._keys.splice(a,1)}this._ranges[e]=null}}getRange(e){return this._ranges[e]}getKeys(){return this._keys}getHighestFrame(){let e=0;for(let t=0,i=this._keys.length;t0)return t.highLimitValue.clone?t.highLimitValue.clone():t.highLimitValue;const r=this._keys;let n;if(this._coreAnimation)n=this._coreAnimation._key;else{const m=r.length;for(n=t.key;n>=0&&e=r[n+1].frame;)++n;if(t.key=n,n<0)return i?void 0:this._getKeyValue(r[0].value);if(n+1>m-1)return i?void 0:this._getKeyValue(r[m-1].value);this._key=n}const a=r[n],o=r[n+1];if(i&&(e===a.frame||e===o.frame))return;const l=this._getKeyValue(a.value),c=this._getKeyValue(o.value);if(a.interpolation===1)return o.frame>e?l:c;const u=a.outTangent!==void 0&&o.inTangent!==void 0,h=o.frame-a.frame;let d=(e-a.frame)/h;const f=a.easingFunction||this.getEasingFunction();switch(f&&(d=f.ease(d)),this.dataType){case _t.ANIMATIONTYPE_FLOAT:{const m=u?this.floatInterpolateFunctionWithTangents(l,a.outTangent*h,c,o.inTangent*h,d):this.floatInterpolateFunction(l,c,d);switch(t.loopMode){case _t.ANIMATIONLOOPMODE_CYCLE:case _t.ANIMATIONLOOPMODE_CONSTANT:case _t.ANIMATIONLOOPMODE_YOYO:return m;case _t.ANIMATIONLOOPMODE_RELATIVE:case _t.ANIMATIONLOOPMODE_RELATIVE_FROM_CURRENT:return(t.offsetValue??0)*t.repeatCount+m}break}case _t.ANIMATIONTYPE_QUATERNION:{const m=u?this.quaternionInterpolateFunctionWithTangents(l,a.outTangent.scale(h),c,o.inTangent.scale(h),d):this.quaternionInterpolateFunction(l,c,d);switch(t.loopMode){case _t.ANIMATIONLOOPMODE_CYCLE:case _t.ANIMATIONLOOPMODE_CONSTANT:case _t.ANIMATIONLOOPMODE_YOYO:return m;case _t.ANIMATIONLOOPMODE_RELATIVE:case _t.ANIMATIONLOOPMODE_RELATIVE_FROM_CURRENT:return m.addInPlace((t.offsetValue||i_e).scale(t.repeatCount))}return m}case _t.ANIMATIONTYPE_VECTOR3:{const m=u?this.vector3InterpolateFunctionWithTangents(l,a.outTangent.scale(h),c,o.inTangent.scale(h),d):this.vector3InterpolateFunction(l,c,d);switch(t.loopMode){case _t.ANIMATIONLOOPMODE_CYCLE:case _t.ANIMATIONLOOPMODE_CONSTANT:case _t.ANIMATIONLOOPMODE_YOYO:return m;case _t.ANIMATIONLOOPMODE_RELATIVE:case _t.ANIMATIONLOOPMODE_RELATIVE_FROM_CURRENT:return m.add((t.offsetValue||r_e).scale(t.repeatCount))}break}case _t.ANIMATIONTYPE_VECTOR2:{const m=u?this.vector2InterpolateFunctionWithTangents(l,a.outTangent.scale(h),c,o.inTangent.scale(h),d):this.vector2InterpolateFunction(l,c,d);switch(t.loopMode){case _t.ANIMATIONLOOPMODE_CYCLE:case _t.ANIMATIONLOOPMODE_CONSTANT:case _t.ANIMATIONLOOPMODE_YOYO:return m;case _t.ANIMATIONLOOPMODE_RELATIVE:case _t.ANIMATIONLOOPMODE_RELATIVE_FROM_CURRENT:return m.add((t.offsetValue||s_e).scale(t.repeatCount))}break}case _t.ANIMATIONTYPE_SIZE:{switch(t.loopMode){case _t.ANIMATIONLOOPMODE_CYCLE:case _t.ANIMATIONLOOPMODE_CONSTANT:case _t.ANIMATIONLOOPMODE_YOYO:return this.sizeInterpolateFunction(l,c,d);case _t.ANIMATIONLOOPMODE_RELATIVE:case _t.ANIMATIONLOOPMODE_RELATIVE_FROM_CURRENT:return this.sizeInterpolateFunction(l,c,d).add((t.offsetValue||n_e).scale(t.repeatCount))}break}case _t.ANIMATIONTYPE_COLOR3:{const m=u?this.color3InterpolateFunctionWithTangents(l,a.outTangent.scale(h),c,o.inTangent.scale(h),d):this.color3InterpolateFunction(l,c,d);switch(t.loopMode){case _t.ANIMATIONLOOPMODE_CYCLE:case _t.ANIMATIONLOOPMODE_CONSTANT:case _t.ANIMATIONLOOPMODE_YOYO:return m;case _t.ANIMATIONLOOPMODE_RELATIVE:case _t.ANIMATIONLOOPMODE_RELATIVE_FROM_CURRENT:return m.add((t.offsetValue||a_e).scale(t.repeatCount))}break}case _t.ANIMATIONTYPE_COLOR4:{const m=u?this.color4InterpolateFunctionWithTangents(l,a.outTangent.scale(h),c,o.inTangent.scale(h),d):this.color4InterpolateFunction(l,c,d);switch(t.loopMode){case _t.ANIMATIONLOOPMODE_CYCLE:case _t.ANIMATIONLOOPMODE_CONSTANT:case _t.ANIMATIONLOOPMODE_YOYO:return m;case _t.ANIMATIONLOOPMODE_RELATIVE:case _t.ANIMATIONLOOPMODE_RELATIVE_FROM_CURRENT:return m.add((t.offsetValue||o_e).scale(t.repeatCount))}break}case _t.ANIMATIONTYPE_MATRIX:{switch(t.loopMode){case _t.ANIMATIONLOOPMODE_CYCLE:case _t.ANIMATIONLOOPMODE_CONSTANT:case _t.ANIMATIONLOOPMODE_YOYO:return _t.AllowMatricesInterpolation?this.matrixInterpolateFunction(l,c,d,t.workValue):l;case _t.ANIMATIONLOOPMODE_RELATIVE:case _t.ANIMATIONLOOPMODE_RELATIVE_FROM_CURRENT:return l}break}}return 0}matrixInterpolateFunction(e,t,i,r){return _t.AllowMatrixDecomposeForInterpolation?r?(Ce.DecomposeLerpToRef(e,t,i,r),r):Ce.DecomposeLerp(e,t,i):r?(Ce.LerpToRef(e,t,i,r),r):Ce.Lerp(e,t,i)}clone(e=!1){const t=new _t(this.name,this.targetPropertyPath.join("."),this.framePerSecond,this.dataType,this.loopMode);if(t.enableBlending=this.enableBlending,t.blendingSpeed=this.blendingSpeed,this._keys&&t.setKeys(this._keys,!1,e),this._ranges){t._ranges={};for(const i in this._ranges){const r=this._ranges[i];r&&(t._ranges[i]=r.clone())}}return t}setKeys(e,t=!1,i=!1){if(t)this._keys=e;else if(this._keys=e.slice(0),i)for(let r=0;r=0?n.referenceFrame:0;let c=0;const u=o[0];let h=o.length-1;const d=o[h],f={referenceValue:u.value,referencePosition:Ae.Vector3[0],referenceQuaternion:Ae.Quaternion[0],referenceScaling:Ae.Vector3[1],keyPosition:Ae.Vector3[2],keyQuaternion:Ae.Quaternion[1],keyScaling:Ae.Vector3[3]};let m=u.frame,p=d.frame;if(n.range){const S=a.getRange(n.range);S&&(m=S.from,p=S.to)}else m=n.fromFrame??m,p=n.toFrame??p;m!==u.frame&&(c=a.createKeyForFrame(m)),p!==d.frame&&(h=a.createKeyForFrame(p));const _=a.getKeys();if(_.length===1){const S=a._getKeyValue(_[0]);f.referenceValue=S.clone?S.clone():S}else if(l<=u.frame){const S=a._getKeyValue(u.value);f.referenceValue=S.clone?S.clone():S}else if(l>=d.frame){const S=a._getKeyValue(d.value);f.referenceValue=S.clone?S.clone():S}else{ym.key=0;const S=a._interpolate(l,ym);f.referenceValue=S.clone?S.clone():S}a.dataType===_t.ANIMATIONTYPE_QUATERNION?f.referenceValue.normalize().conjugateInPlace():a.dataType===_t.ANIMATIONTYPE_MATRIX&&(f.referenceValue.decompose(f.referenceScaling,f.referenceQuaternion,f.referencePosition),f.referenceQuaternion.normalize().conjugateInPlace());let v=Number.MAX_VALUE;const x=n.clipKeys?[]:null;for(let S=c;S<=h;S++){let b=_[S];if((x||n.cloneOriginalAnimation)&&(b={frame:b.frame,value:b.value.clone?b.value.clone():b.value,inTangent:b.inTangent,outTangent:b.outTangent,interpolation:b.interpolation,lockedTangent:b.lockedTangent,easingFunction:b.easingFunction},x&&(v===Number.MAX_VALUE&&(v=b.frame),b.frame-=v,x.push(b))),!(S&&a.dataType!==_t.ANIMATIONTYPE_FLOAT&&b.value===u.value))switch(a.dataType){case _t.ANIMATIONTYPE_MATRIX:b.value.decompose(f.keyScaling,f.keyQuaternion,f.keyPosition),f.keyPosition.subtractInPlace(f.referencePosition),f.keyScaling.divideInPlace(f.referenceScaling),f.referenceQuaternion.multiplyToRef(f.keyQuaternion,f.keyQuaternion),Ce.ComposeToRef(f.keyScaling,f.keyQuaternion,f.keyPosition,b.value);break;case _t.ANIMATIONTYPE_QUATERNION:f.referenceValue.multiplyToRef(b.value,b.value);break;case _t.ANIMATIONTYPE_VECTOR2:case _t.ANIMATIONTYPE_VECTOR3:case _t.ANIMATIONTYPE_COLOR3:case _t.ANIMATIONTYPE_COLOR4:b.value.subtractToRef(f.referenceValue,b.value);break;case _t.ANIMATIONTYPE_SIZE:b.value.width-=f.referenceValue.width,b.value.height-=f.referenceValue.height;break;default:b.value-=f.referenceValue}}return x&&a.setKeys(x,!0),a}function JF(s,e,t,i){const r=new _t(s+"Animation",s,t,e,_t.ANIMATIONLOOPMODE_CONSTANT);return r.setEasingFunction(i),r}function Gke(s,e,t,i,r,n,a,o,l,c,u){const h=_t._PrepareAnimation(s,t,i,r,n,a,o,l);return!h||(e.getScene&&(u=e.getScene()),!u)?null:u.beginDirectAnimation(e,[h],0,r,h.loopMode!==_t.ANIMATIONLOOPMODE_CONSTANT,1,c)}function zke(s,e,t,i,r,n,a,o,l,c,u){const h=_t._PrepareAnimation(s,i,r,n,a,o,l,c);return h?e.getScene().beginDirectHierarchyAnimation(e,t,[h],0,n,h.loopMode===1,1,u):null}function Wke(s,e,t,i,r,n,a,o,l,c){const u=_t._PrepareAnimation(s,t,i,r,n,a,o,l);return u?(e.animations.push(u),e.getScene().beginAnimation(e,0,r,u.loopMode===1,1,c)):null}function Hke(s,e,t,i,r,n,a,o=null,l=!0,c){if(a<=0)return t[s]=e,o&&o(),null;const u=r*(a/1e3);return n.setKeys(c??[{frame:0,value:t[s].clone?t[s].clone():t[s]},{frame:u,value:e}]),t.animations||(t.animations=[]),t.animations.push(n),i.beginAnimation(t,0,u,!1,1,o??void 0,void 0,l)}function jke(s,e){li.AppendSerializedAnimations(s,e)}function UT(s){const e=new _t(s.name,s.property,s.framePerSecond,s.dataType,s.loopBehavior),t=s.dataType,i=[];let r,n;for(s.enableBlending&&(e.enableBlending=s.enableBlending),s.blendingSpeed&&(e.blendingSpeed=s.blendingSpeed),n=0;n=2&&(o=a.values[1]),a.values.length>=3&&(l=a.values[2]),a.values.length>=4&&(c=a.values[3]);break;case _t.ANIMATIONTYPE_QUATERNION:if(r=gt.FromArray(a.values),a.values.length>=8){const h=gt.FromArray(a.values.slice(4,8));h.equals(gt.Zero())||(o=h)}if(a.values.length>=12){const h=gt.FromArray(a.values.slice(8,12));h.equals(gt.Zero())||(l=h)}a.values.length>=13&&(c=a.values[12]);break;case _t.ANIMATIONTYPE_MATRIX:r=Ce.FromArray(a.values),a.values.length>=17&&(c=a.values[16]);break;case _t.ANIMATIONTYPE_COLOR3:r=rt.FromArray(a.values),a.values[3]&&(o=rt.FromArray(a.values[3])),a.values[4]&&(l=rt.FromArray(a.values[4])),a.values[5]&&(c=a.values[5]);break;case _t.ANIMATIONTYPE_COLOR4:r=$t.FromArray(a.values),a.values[4]&&(o=$t.FromArray(a.values[4])),a.values[5]&&(l=$t.FromArray(a.values[5])),a.values[6]&&(c=$t.FromArray(a.values[6]));break;case _t.ANIMATIONTYPE_VECTOR3:default:r=O.FromArray(a.values),a.values[3]&&(o=O.FromArray(a.values[3])),a.values[4]&&(l=O.FromArray(a.values[4])),a.values[5]&&(c=a.values[5]);break}const u={};u.frame=a.frame,u.value=r,o!=null&&(u.inTangent=o),l!=null&&(u.outTangent=l),c!=null&&(u.interpolation=c),i.push(u)}if(e.setKeys(i),s.ranges)for(n=0;n{const r=new cn;r.addEventListener("readystatechange",()=>{if(r.readyState==4)if(r.status==200){let n=JSON.parse(r.responseText);if(n.animations&&(n=n.animations),n.length){const a=[];for(const o of n)a.push(UT(o));t(a)}else{const a=UT(n);s&&(a.name=s),t(a)}}else i("Unable to load the animation")}),r.open("GET",e),r.send()})}async function l_e(s){const e=(this==null?void 0:this.SnippetUrl)??_t.SnippetUrl;return await new Promise((t,i)=>{const r=new cn;r.addEventListener("readystatechange",()=>{if(r.readyState==4)if(r.status==200){const n=JSON.parse(JSON.parse(r.responseText).jsonPayload);if(n.animations){const a=JSON.parse(n.animations),o=[];for(const l of a.animations){const c=UT(l);c.snippetId=s,o.push(c)}t(o)}else{const a=JSON.parse(n.animation),o=UT(a);o.snippetId=s,t(o)}}else i("Unable to load the snippet "+s)}),r.open("GET",e+"/"+s.replace(/#/g,"/")),r.send()})}const $ke=l_e;let dY=!1;function Yke(){dY||(dY=!0,_t.Parse=UT,_t.ParseFromFileAsync=Xke,_t.ParseFromSnippetAsync=l_e,_t.CreateFromSnippetAsync=$ke,_t.CreateAnimation=JF,_t.CreateAndStartAnimation=Gke,_t.CreateAndStartHierarchyAnimation=zke,_t.CreateMergeAndStartAnimation=Wke,_t.MakeAnimationAdditive=Q5,_t.TransitionTo=Hke,_t.AppendSerializedAnimations=jke,Se("BABYLON.Animation",_t),rn._AnimationRangeFactory=(s,e,t)=>new v0(s,e,t))}class qke extends In{constructor(e,t,i,r,n=1e3,a,o,l){super(e,a),this.duration=1e3,this.onInterpolationDoneObservable=new Ge,this.propertyPath=i,this.value=r,this.duration=n,this.stopOtherAnimations=o,this.onInterpolationDone=l,this._target=this._effectiveTarget=t}_prepare(){this._effectiveTarget=this._getEffectiveTarget(this._effectiveTarget,this.propertyPath),this._property=this._getProperty(this.propertyPath)}execute(){const e=this._actionManager.getScene(),t=[{frame:0,value:this._effectiveTarget[this._property]},{frame:100,value:this.value}];let i;if(typeof this.value=="number")i=_t.ANIMATIONTYPE_FLOAT;else if(this.value instanceof rt)i=_t.ANIMATIONTYPE_COLOR3;else if(this.value instanceof O)i=_t.ANIMATIONTYPE_VECTOR3;else if(this.value instanceof Ce)i=_t.ANIMATIONTYPE_MATRIX;else if(this.value instanceof gt)i=_t.ANIMATIONTYPE_QUATERNION;else{ye.Warn("InterpolateValueAction: Unsupported type ("+typeof this.value+")");return}const r=new _t("InterpolateValueAction",this._property,100*(1e3/this.duration),i,_t.ANIMATIONLOOPMODE_CONSTANT);r.setKeys(t),this.stopOtherAnimations&&e.stopAnimation(this._effectiveTarget);const n=()=>{this.onInterpolationDoneObservable.notifyObservers(this),this.onInterpolationDone&&this.onInterpolationDone()};e.beginDirectAnimation(this._effectiveTarget,[r],0,100,!1,1,n)}serialize(e){return super._serialize({name:"InterpolateValueAction",properties:[In._GetTargetProperty(this._target),{name:"propertyPath",value:this.propertyPath},{name:"value",value:In._SerializeValueAsString(this.value)},{name:"duration",value:In._SerializeValueAsString(this.duration)},{name:"stopOtherAnimations",value:In._SerializeValueAsString(this.stopOtherAnimations)||!1}]},e)}}let fY=!1;function Zke(){fY||(fY=!0,Se("BABYLON.InterpolateValueAction",qke))}Zke();class Kke{get currentFrame(){return this._currentFrame}get weight(){return this._weight}get currentValue(){return this._currentValue}get targetPath(){return this._targetPath}get target(){return this._currentActiveTarget}get isAdditive(){return this._host&&this._host.isAdditive}constructor(e,t,i,r){if(this._events=new Array,this._currentFrame=0,this._originalValue=new Array,this._originalBlendValue=null,this._offsetsCache={},this._highLimitsCache={},this._stopped=!1,this._blendingFactor=0,this._currentValue=null,this._currentActiveTarget=null,this._directTarget=null,this._targetPath="",this._weight=1,this._absoluteFrameOffset=0,this._previousElapsedTime=0,this._yoyoDirection=1,this._previousAbsoluteFrame=0,this._targetIsArray=!1,this._coreRuntimeAnimation=null,this._animation=t,this._target=e,this._scene=i,this._host=r,this._activeTargets=[],t._runtimeAnimations.push(this),this._animationState={key:0,repeatCount:0,loopMode:this._getCorrectLoopMode()},this._animation.dataType===_t.ANIMATIONTYPE_MATRIX&&(this._animationState.workValue=Ce.Zero()),this._keys=this._animation.getKeys(),this._minFrame=this._keys[0].frame,this._maxFrame=this._keys[this._keys.length-1].frame,this._minFrame!==0){const a={frame:0,value:this._keys[0].value};this._keys.splice(0,0,a)}if(this._target instanceof Array){let a=0;for(const o of this._target)this._preparePath(o,a),this._getOriginalValues(a),a++;this._targetIsArray=!0}else this._preparePath(this._target),this._getOriginalValues(),this._targetIsArray=!1,this._directTarget=this._activeTargets[0];const n=t.getEvents();if(n&&n.length>0)for(const a of n)this._events.push(a._clone());this._enableBlending=e&&e.animationPropertiesOverride?e.animationPropertiesOverride.enableBlending:this._animation.enableBlending}_preparePath(e,t=0){const i=this._animation.targetPropertyPath;if(i.length>1){let r=e;for(let n=0;n-1&&this._animation.runtimeAnimations.splice(e,1)}setValue(e,t){if(this._targetIsArray){for(let i=0;ii[i.length-1].frame&&(e=i[i.length-1].frame);const r=this._events;if(r.length)for(let a=0;athis._maxFrame)&&(t=this._minFrame),(ithis._maxFrame)&&(i=this._maxFrame),d=i-t;let m,p=e*(o.framePerSecond*n)/1e3+this._absoluteFrameOffset,_=0,v=!1;const x=r&&this._animationState.loopMode===_t.ANIMATIONLOOPMODE_YOYO;if(x){const S=(p-t)/d,b=Math.sin(S*Math.PI);p=Math.abs(b)*d+t;const I=b>=0?1:-1;this._yoyoDirection!==I&&(v=!0),this._yoyoDirection=I}if(this._previousElapsedTime=e,this._previousAbsoluteFrame=p,!r&&i>=t&&(p>=d&&n>0||p<=0&&n<0))c=!1,_=o.evaluate(i);else if(!r&&t>=i&&(p<=d&&n<0||p>=0&&n>0))c=!1,_=o.evaluate(t);else if(this._animationState.loopMode!==_t.ANIMATIONLOOPMODE_CYCLE){const S=i.toString()+t.toString();if(!this._offsetsCache[S]){this._animationState.repeatCount=0,this._animationState.loopMode=_t.ANIMATIONLOOPMODE_CYCLE;const b=o._interpolate(t,this._animationState),y=o._interpolate(i,this._animationState);switch(this._animationState.loopMode=this._getCorrectLoopMode(),o.dataType){case _t.ANIMATIONTYPE_FLOAT:this._offsetsCache[S]=y-b;break;case _t.ANIMATIONTYPE_QUATERNION:this._offsetsCache[S]=y.subtract(b);break;case _t.ANIMATIONTYPE_VECTOR3:this._offsetsCache[S]=y.subtract(b);break;case _t.ANIMATIONTYPE_VECTOR2:this._offsetsCache[S]=y.subtract(b);break;case _t.ANIMATIONTYPE_SIZE:this._offsetsCache[S]=y.subtract(b);break;case _t.ANIMATIONTYPE_COLOR3:this._offsetsCache[S]=y.subtract(b);break}this._highLimitsCache[S]=y}_=this._highLimitsCache[S],m=this._offsetsCache[S]}if(m===void 0)switch(o.dataType){case _t.ANIMATIONTYPE_FLOAT:m=0;break;case _t.ANIMATIONTYPE_QUATERNION:m=i_e;break;case _t.ANIMATIONTYPE_VECTOR3:m=r_e;break;case _t.ANIMATIONTYPE_VECTOR2:m=s_e;break;case _t.ANIMATIONTYPE_SIZE:m=n_e;break;case _t.ANIMATIONTYPE_COLOR3:m=a_e;break;case _t.ANIMATIONTYPE_COLOR4:m=o_e;break}if(this._host&&this._host.syncRoot){const S=this._host.syncRoot,b=(S.masterFrame-S.fromFrame)/(S.toFrame-S.fromFrame);u=t+d*b}else p>0&&t>i||p<0&&t0&&this.currentFrame>u||n<0&&this.currentFrame0?0:o.getKeys().length-1}this._currentFrame=u,this._animationState.repeatCount=d===0?0:p/d>>0,this._animationState.highLimitValue=_,this._animationState.offsetValue=m}const f=o._interpolate(u,this._animationState);if(this.setValue(f,a),h.length){for(let m=0;m=0&&u>=h[m].frame&&h[m].frame>=t||d<0&&u<=h[m].frame&&h[m].frame<=t){const p=h[m];p.isDone||(p.onlyOnce&&(h.splice(m,1),m--),p.isDone=!0,p.action(u))}}return c||(this._stopped=!0),c}}function yl(){return typeof window<"u"}function cT(){return typeof navigator<"u"}function AT(){return typeof document<"u"}function J5(s){let e="",t=s.firstChild;for(;t;)t.nodeType===3&&(e+=t.textContent),t=t.nextSibling;return e}class ko{static get Now(){return yl()&&window.performance&&window.performance.now?window.performance.now():Date.now()}}class XR{get syncRoot(){return this._syncRoot}get masterFrame(){return this._runtimeAnimations.length===0?0:this._runtimeAnimations[0].currentFrame}get weight(){return this._weight}set weight(e){if(e===-1){this._weight=-1;return}this._weight=Math.min(Math.max(e,0),1)}get speedRatio(){return this._speedRatio}set speedRatio(e){for(let t=0;t-1&&(this._scene._activeAnimatables.splice(t,1),this._scene._activeAnimatables.push(this))}return this}getAnimations(){return this._runtimeAnimations}appendAnimations(e,t){for(let i=0;i{this.onAnimationLoopObservable.notifyObservers(this),this.onAnimationLoop&&this.onAnimationLoop()},this._runtimeAnimations.push(n)}}getAnimationByTargetProperty(e){const t=this._runtimeAnimations;for(let i=0;i-1){const a=this._runtimeAnimations;for(let o=a.length-1;o>=0;o--){const l=a[o];e&&l.animation.name!=e||t&&!t(l.target)||(l.dispose(),a.splice(o,1))}a.length==0&&(i||this._scene._activeAnimatables.splice(n,1),r||this._raiseOnAnimationEnd())}}else{const n=this._scene._activeAnimatables.indexOf(this);if(n>-1){i||this._scene._activeAnimatables.splice(n,1);const a=this._runtimeAnimations;for(let o=0;o{this.onAnimationEndObservable.add(()=>{e(this)},void 0,void 0,this,!0)})}_animate(e){if(this._paused)return this.animationStarted=!1,this._pausedDelay===null&&(this._pausedDelay=e),!0;if(this._localDelayOffset===null?(this._localDelayOffset=e,this._pausedDelay=null):this._pausedDelay!==null&&(this._localDelayOffset+=e-this._pausedDelay,this._pausedDelay=null),this._manualJumpDelay!==null&&(this._localDelayOffset+=this.speedRatio<0?-this._manualJumpDelay:this._manualJumpDelay,this._manualJumpDelay=null,this._frameToSyncFromJump=null),this._goToFrame=null,!XR.ProcessPausedAnimatables&&this._weight===0&&this._previousWeight===0)return!0;this._previousWeight=this._weight;let t=!1;const i=this._runtimeAnimations;let r;for(r=0;r0?l:-l,r),f.scaleAndAddToRef(l,t)}r.normalize()}for(let h=0;h0)r.copyFrom(i);else if(s.animations.length===1){if(gt.SlerpToRef(i,t.currentValue,Math.min(1,s.totalWeight),r),s.totalAdditiveWeight===0)return r}else if(s.animations.length>1){let n=1,a,o;if(s.totalWeight<1){const c=1-s.totalWeight;a=[],o=[],a.push(i),o.push(c)}else{if(s.animations.length===2&&(gt.SlerpToRef(s.animations[0].currentValue,s.animations[1].currentValue,s.animations[1].weight/s.totalWeight,e),s.totalAdditiveWeight===0))return e;a=[],o=[],n=s.totalWeight}for(let c=0;c=l&&x.frame<=c&&(n?(b=x.value.clone(),m?(S=b.getTranslation(),b.setTranslation(S.scaleInPlace(p))):_&&a?(S=b.getTranslation(),b.setTranslation(S.multiplyInPlace(a))):b=x.value):b=x.value,v.push({frame:x.frame+r,value:b}));return this.animations[0].createRange(i,l+r,c+r),!0}),s&&(s.prototype._animate=function(t){if(!this.animationsEnabled)return;const i=ko.Now;if(!this._animationTimeLast){if(this._pendingData.length>0)return;this._animationTimeLast=i}this.deltaTime=t!==void 0?t:this.useConstantAnimationDeltaTime?16:(i-this._animationTimeLast)*this.animationTimeScale,this._animationTimeLast=i;const r=this._activeAnimatables;if(r.length===0)return;this._animationTime+=this.deltaTime;const n=this._animationTime;for(let a=0;at.playOrder-i.playOrder)},s.prototype.beginWeightedAnimation=function(t,i,r,n=1,a,o=1,l,c,u,h,d=!1){const f=this.beginAnimation(t,i,r,a,o,l,c,!1,u,h,d);return f.weight=n,f},s.prototype.beginAnimation=function(t,i,r,n,a=1,o,l,c=!0,u,h,d=!1){if(a<0){const m=i;i=r,r=m,a=-a}i>r&&(a=-a),c&&this.stopAnimation(t,void 0,u),l||(l=new XR(this,t,i,r,n,a,o,void 0,h,d));const f=u?u(t):!0;if(t.animations&&f&&l.appendAnimations(t,t.animations),t.getAnimatables){const m=t.getAnimatables();for(let p=0;pn&&(o=-o),new XR(this,t,r,n,a,o,l,i,c,u)},s.prototype.beginDirectHierarchyAnimation=function(t,i,r,n,a,o,l,c,u,h=!1){const d=t.getDescendants(i),f=[];f.push(this.beginDirectAnimation(t,r,n,a,o,l,c,u,h));for(const m of d)f.push(this.beginDirectAnimation(m,r,n,a,o,l,c,u,h));return f},s.prototype.getAnimatableByTarget=function(t){for(let i=0;ir.status!==0||n>=e||i.indexOf("file:")!==-1?-1:Math.pow(2,n)*t}}class OS extends Error{}OS._setPrototypeOf=Object.setPrototypeOf||((s,e)=>(s.__proto__=e,s));const uy={MeshInvalidPositionsError:0,UnsupportedTextureError:1e3,SceneLoaderError:3e3,LoadFileError:4e3,RequestFileError:4001,ReadFileError:4002};class jv extends OS{constructor(e,t,i){super(e),this.errorCode=t,this.innerError=i,this.name="RuntimeError",OS._setPrototypeOf(this,jv.prototype)}}class sO extends OS{constructor(e="Operation aborted"){super(e),this.name="AbortError",OS._setPrototypeOf(this,sO.prototype)}}function rVe(s){const e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";let t="",i,r,n,a,o,l,c,u=0;for(;u>2,o=(i&3)<<4|r>>4,l=(r&15)<<2|n>>6,c=n&63,isNaN(r)?l=c=64:isNaN(n)&&(c=64),t+=e.charAt(a)+e.charAt(o)+e.charAt(l)+e.charAt(c);return t}function sVe(s){const e=c_e(s),t=e.length,i=new Uint8Array(new ArrayBuffer(t));for(let r=0;r{const e=ArrayBuffer.isView(s)?new Uint8Array(s.buffer,s.byteOffset,s.byteLength):new Uint8Array(s);return typeof e.toBase64=="function"?e.toBase64():rVe(e)},c_e=s=>atob(s),ED=s=>typeof Uint8Array.fromBase64=="function"?Uint8Array.fromBase64(s).buffer:sVe(s),uT={};function u_e(s,e,t=""){return t+(e?e+`
000548: `:"")+s}function h_e(s,e,t,i,r,n,a){const o=a||uT.loadFile;if(!o)throw Wi("FileTools");return o(s,e,t,i,r,n)}function d_e(s,e,t,i){if(s){e?s.IS_NDC_HALF_ZRANGE="":delete s.IS_NDC_HALF_ZRANGE,t?s.USE_REVERSE_DEPTHBUFFER="":delete s.USE_REVERSE_DEPTHBUFFER,i?s.USE_EXACT_SRGB_CONVERSIONS="":delete s.USE_EXACT_SRGB_CONVERSIONS;return}else{let r="";return e&&(r+="#define IS_NDC_HALF_ZRANGE"),t&&(r&&(r+=`
000549: `),r+="#define USE_REVERSE_DEPTHBUFFER"),i&&(r&&(r+=`
000550: `),r+="#define USE_EXACT_SRGB_CONVERSIONS"),r}}function e2(s,e,t=!1,i){switch(s){case 3:{const n=new Int8Array(e);return i&&n.set(new Int8Array(i)),n}case 0:{const n=new Uint8Array(e);return i&&n.set(new Uint8Array(i)),n}case 4:{const n=typeof e!="number"?new Int16Array(e):new Int16Array(t?e/2:e);return i&&n.set(new Int16Array(i)),n}case 5:case 8:case 9:case 10:case 2:{const n=typeof e!="number"?new Uint16Array(e):new Uint16Array(t?e/2:e);return i&&n.set(new Uint16Array(i)),n}case 6:{const n=typeof e!="number"?new Int32Array(e):new Int32Array(t?e/4:e);return i&&n.set(new Int32Array(i)),n}case 7:case 11:case 12:case 13:case 14:case 15:{const n=typeof e!="number"?new Uint32Array(e):new Uint32Array(t?e/4:e);return i&&n.set(new Uint32Array(i)),n}case 1:{const n=typeof e!="number"?new Float32Array(e):new Float32Array(t?e/4:e);return i&&n.set(new Float32Array(i)),n}}const r=new Uint8Array(e);return i&&r.set(new Uint8Array(i)),r}const nVe="attribute",aVe="varying";class ZI{constructor(){this.children=[]}isValid(e){return!0}process(e,t,i){var n,a,o,l,c,u;let r="";if(this.line){let h=this.line;const d=t.processor;if(d){d.lineProcessor&&(h=d.lineProcessor(h,t.isFragment,t.processingContext));const f=((n=t.processor)==null?void 0:n.attributeKeywordName)??nVe,m=t.isFragment&&((a=t.processor)!=null&&a.varyingFragmentKeywordName)?(o=t.processor)==null?void 0:o.varyingFragmentKeywordName:!t.isFragment&&((l=t.processor)!=null&&l.varyingVertexKeywordName)?(c=t.processor)==null?void 0:c.varyingVertexKeywordName:aVe;!t.isFragment&&d.attributeProcessor&&this.line.startsWith(f)?h=d.attributeProcessor(this.line,e,t.processingContext):d.varyingProcessor&&((u=d.varyingCheck)!=null&&u.call(d,this.line,t.isFragment)||!d.varyingCheck&&this.line.startsWith(m))?h=d.varyingProcessor(this.line,t.isFragment,e,t.processingContext):d.uniformProcessor&&d.uniformRegexp&&d.uniformRegexp.test(this.line)?t.lookForClosingBracketForUniformBuffer||(h=d.uniformProcessor(this.line,t.isFragment,e,t.processingContext)):d.uniformBufferProcessor&&d.uniformBufferRegexp&&d.uniformBufferRegexp.test(this.line)?t.lookForClosingBracketForUniformBuffer||(h=d.uniformBufferProcessor(this.line,t.isFragment,t.processingContext),t.lookForClosingBracketForUniformBuffer=!0):d.textureProcessor&&d.textureRegexp&&d.textureRegexp.test(this.line)?h=d.textureProcessor(this.line,t.isFragment,e,t.processingContext):(d.uniformProcessor||d.uniformBufferProcessor)&&this.line.startsWith("uniform")&&!t.lookForClosingBracketForUniformBuffer&&(/uniform\s+(?:(?:highp)?|(?:lowp)?)\s*(\S+)\s+(\S+)\s*;/.test(this.line)?d.uniformProcessor&&(h=d.uniformProcessor(this.line,t.isFragment,e,t.processingContext)):d.uniformBufferProcessor&&(h=d.uniformBufferProcessor(this.line,t.isFragment,t.processingContext),t.lookForClosingBracketForUniformBuffer=!0)),t.lookForClosingBracketForUniformBuffer&&this.line.indexOf("}")!==-1&&(t.lookForClosingBracketForUniformBuffer=!1,d.endOfUniformBufferProcessor&&(h=d.endOfUniformBufferProcessor(this.line,t.isFragment,t.processingContext)))}r+=h+`
000551: `}for(const h of this.children)r+=h.process(e,t,i);return this.additionalDefineKey&&(e[this.additionalDefineKey]=this.additionalDefineValue||"true",i[this.additionalDefineKey]=e[this.additionalDefineKey]),r}}class oVe{constructor(){this._lines=[]}get currentLine(){return this._lines[this.lineIndex]}get canRead(){return this.lineIndex1&&this._lines.push(i);else{const n=t.split(";");for(let a=0;a{u=u.trim(),u!==""&&(i.push(u),u="")},a=h=>{rqa._Stack[r],l=()=>r===-1?"!!INVALID EXPRESSION!!":qa._Stack[r--];let c=0,u="";for(;c1){for(n();r!==-1&&qa._OperatorPriority[o()]>=qa._OperatorPriority[d];)i.push(l());a(d),c++}else u+=h;c++}for(n();r!==-1;)o()==="("?l():i.push(l());return qa._InfixToPostfixCache.size>=qa.InfixToPostfixCacheLimitSize&&qa.ClearCache(),qa._InfixToPostfixCache.set(e,{result:i,accessTime:Date.now()}),i}static ClearCache(){const e=Array.from(qa._InfixToPostfixCache.entries()).sort((t,i)=>t[1].accessTime-i[1].accessTime);for(let t=0;t":t=i>r;break;case"<":t=i=":t=i>=r;break;case"==":t=i===r;break;case"!=":t=i!==r;break}return t}}const dVe=/defined\s*?\((.+?)\)/g,G1=/defined\s*?\[(.+?)\]/g,fVe=/#include\s?<(.+)>(\((.*)\))*(\[(.*)\])*/g,pVe=/__decl__/,mY=/light\{X\}.(\w*)/g,_Y=/\{X\}/g,HP=[],mVe=/(#ifdef)|(#else)|(#elif)|(#endif)|(#ifndef)|(#if)/;function ej(s){s.processor&&s.processor.initializeShaders&&s.processor.initializeShaders(s.processingContext)}function $R(s,e,t,i){var r;(r=e.processor)!=null&&r.preProcessShaderCode&&(s=e.processor.preProcessShaderCode(s,e.isFragment)),YR(s,e,n=>{e.processCodeAfterIncludes&&(n=e.processCodeAfterIncludes(e.isFragment?"fragment":"vertex",n,e.defines));const a=xVe(n,e,i);t(a,n)})}function _Ve(s,e,t,i){var r;(r=e.processor)!=null&&r.preProcessShaderCode&&(s=e.processor.preProcessShaderCode(s,e.isFragment)),YR(s,e,n=>{e.processCodeAfterIncludes&&(n=e.processCodeAfterIncludes(e.isFragment?"fragment":"vertex",n,e.defines));const a=SVe(n,e,i);t(a,n)})}function tj(s,e,t){return!t.processor||!t.processor.finalizeShaders?{vertexCode:s,fragmentCode:e}:t.processor.finalizeShaders(s,e,t.processingContext)}function gVe(s,e){var i;if((i=e.processor)!=null&&i.noPrecision)return s;const t=e.shouldUseHighPrecisionShader;return s.indexOf("precision highp float")===-1?t?s=`precision highp float;
000552: `+s:s=`precision mediump float;
000553: `+s:t||(s=s.replace("precision highp float","precision mediump float")),s}function z1(s){const t=/defined\((.+)\)/.exec(s);if(t&&t.length)return new nO(t[1].trim(),s[0]==="!");const i=["==","!=",">=","<=","<",">"];let r="",n=0;for(r of i)if(n=s.indexOf(r),n>-1)break;if(n===-1)return new nO(s);const a=s.substring(0,n).trim(),o=s.substring(n+r.length).trim();return new hVe(a,r,o)}function vVe(s){s=s.replace(dVe,"defined[$1]");const e=qa.infixToPostfix(s),t=[];for(const r of e)if(r!=="||"&&r!=="&&")t.push(r);else if(t.length>=2){let n=t[t.length-1],a=t[t.length-2];t.length-=2;const o=r=="&&"?new uVe:new cVe;typeof n=="string"&&(n=n.replace(G1,"defined($1)")),typeof a=="string"&&(a=a.replace(G1,"defined($1)")),o.leftOperand=typeof a=="string"?z1(a):a,o.rightOperand=typeof n=="string"?z1(n):n,t.push(o)}let i=t[t.length-1];return typeof i=="string"&&(i=i.replace(G1,"defined($1)")),typeof i=="string"?z1(i):i}function CD(s,e){const t=new lVe,i=s.substring(0,e);let r=s.substring(e);return r=r.substring(0,(r.indexOf("//")+1||r.length+1)-1).trim(),i==="#ifdef"?t.testExpression=new nO(r):i==="#ifndef"?t.testExpression=new nO(r,!0):t.testExpression=vVe(r),t}function W1(s,e,t,i){let r;for(;t2(s,t);){r=s.currentLine;const n=r.substring(0,5).toLowerCase();if(n==="#else"){const a=new ZI;e.children.push(a),t2(s,a);return}else if(n==="#elif"){const a=CD(r,5);e.children.push(a),t=a}}}function t2(s,e,t){for(;s.canRead;){s.lineIndex++;const i=s.currentLine;if(i.indexOf("#")>=0){const n=mVe.exec(i);if(n&&n.length){switch(n[0]){case"#ifdef":{const o=new U1;e.children.push(o);const l=CD(i,6);o.children.push(l),W1(s,o,l);break}case"#else":case"#elif":return!0;case"#endif":return!1;case"#ifndef":{const o=new U1;e.children.push(o);const l=CD(i,7);o.children.push(l),W1(s,o,l);break}case"#if":{const o=new U1,l=CD(i,3);e.children.push(o),o.children.push(l),W1(s,o,l);break}}continue}}const r=new ZI;if(r.line=i,e.children.push(r),i[0]==="#"&&i[1]==="d"){const n=i.replace(";","").split(" ");r.additionalDefineKey=n[1],n.length===3&&(r.additionalDefineValue=n[2])}}return!1}function f_e(s,e,t,i){const r=new ZI,n=new oVe;return n.lineIndex=-1,n.lines=s.split(`
000554: `),t2(n,r),r.process(e,t,i)}function p_e(s,e){var r;const t=s.defines,i={};for(const n of t){const o=n.replace("#define","").replace(";","").trim().split(" ");i[o[0]]=o.length>1?o[1]:""}return((r=s.processor)==null?void 0:r.shaderLanguage)===0&&(i.GL_ES="true"),i.__VERSION__=s.version,i[s.platformName]="true",d_e(i,e==null?void 0:e.isNDCHalfZRange,e==null?void 0:e.useReverseDepthBuffer,e==null?void 0:e.useExactSrgbConversions),i}function xVe(s,e,t){let i=gVe(s,e);if(!e.processor||e.processor.shaderLanguage===0&&i.indexOf("#version 3")!==-1&&(i=i.replace("#version 300 es",""),!e.processor.parseGLES3))return i;const r=e.defines,n=p_e(e,t);e.processor.preProcessor&&(i=e.processor.preProcessor(i,r,n,e.isFragment,e.processingContext));const a={};return i=f_e(i,n,e,a),e.processor.postProcessor&&(i=e.processor.postProcessor(i,r,e.isFragment,e.processingContext,t?{drawBuffersExtensionDisabled:!t.getCaps().drawBuffersExtension}:{},n,a)),t!=null&&t._features.needShaderCodeInlining&&(i=t.inlineShaderCode(i)),i}function SVe(s,e,t){var o,l;let i=s;const r=e.defines,n=p_e(e,t);(o=e.processor)!=null&&o.preProcessor&&(i=e.processor.preProcessor(i,r,n,e.isFragment,e.processingContext));const a={};return i=f_e(i,n,e,a),(l=e.processor)!=null&&l.postProcessor&&(i=e.processor.postProcessor(i,r,e.isFragment,e.processingContext,t?{drawBuffersExtensionDisabled:!t.getCaps().drawBuffersExtension}:{},n,a)),t._features.needShaderCodeInlining&&(i=t.inlineShaderCode(i)),i}function YR(s,e,t){HP.length=0;let i;for(;(i=fVe.exec(s))!==null;)HP.push(i);let r=[s],n=!1;for(const o of HP){let l=o[1];if(l.indexOf("__decl__")!==-1&&(l=l.replace(pVe,""),e.supportsUniformBuffers&&(l=l.replace("Vertex","Ubo").replace("Fragment","Ubo")),l=l+"Declaration"),e.includesShadersStore[l]){let c=e.includesShadersStore[l];if(o[2]){const h=o[3].split(",");for(let d=0;dx+"{X}")),c+=p.replace(_Y,_.toString())+`
000555: `}else e.supportsUniformBuffers||(c=c.replace(mY,(d,f)=>f+"{X}")),c=c.replace(_Y,h)}const u=[];for(const h of r){const d=h.split(o[0]);for(let f=0;f=0||c.indexOf("#include <")>=0}else{const c=e.shadersRepository+"ShadersInclude/"+l+".fx";m_e.loadFile(c,u=>{e.includesShadersStore[l]=u,YR(r.join(""),e,t)});return}}HP.length=0;const a=r.join("");n?YR(a.toString(),e,t):t(a)}const m_e={loadFile:(s,e,t,i,r,n)=>{throw Wi("FileTools")}};let jP=[];class No{static SetImmediate(e){jP.length===0&&setTimeout(()=>{const t=jP;jP=[];for(const i of t)i()},1),jP.push(e)}}function gY(s,e,t){try{if(s())return e(),!0}catch(i){return t==null||t(i),!0}return!1}const $m=(s,e,t,i=16,r=3e4,n=!0,a)=>{if(n&&gY(s,e,t))return null;const o=setInterval(()=>{gY(s,e,t)?clearInterval(o):(r-=i,r<0&&(clearInterval(o),t==null||t(new Error("Operation timed out after maximum retries. "+(a||"")),!0)))},i);return()=>clearInterval(o)};let XP=null;function __e(){if(XP)return XP;const s=new ArrayBuffer(4),e=new Float32Array(s),t=new Uint32Array(s),i=new Uint32Array(512),r=new Uint32Array(512);for(let l=0;l<256;++l){const c=l-127;c<-24?(i[l]=0,i[l|256]=32768,r[l]=24,r[l|256]=24):c<-14?(i[l]=1024>>-c-14,i[l|256]=1024>>-c-14|32768,r[l]=-c-1,r[l|256]=-c-1):c<=15?(i[l]=c+15<<10,i[l|256]=c+15<<10|32768,r[l]=13,r[l|256]=13):c<128?(i[l]=31744,i[l|256]=64512,r[l]=24,r[l|256]=24):(i[l]=31744,i[l|256]=64512,r[l]=13,r[l|256]=13)}const n=new Uint32Array(2048),a=new Uint32Array(64),o=new Uint32Array(64);for(let l=1;l<1024;++l){let c=l<<13,u=0;for(;(c&8388608)===0;)c<<=1,u-=8388608;c&=-8388609,u+=947912704,n[l]=c|u}for(let l=1024;l<2048;++l)n[l]=939524096+(l-1024<<13);for(let l=1;l<31;++l)a[l]=l<<23;a[31]=1199570944,a[32]=2147483648;for(let l=33;l<63;++l)a[l]=2147483648+(l-32<<23);a[63]=3347054592;for(let l=1;l<64;++l)l!==32&&(o[l]=1024);return XP={floatView:e,uint32View:t,baseTable:i,shiftTable:r,mantissaTable:n,exponentTable:a,offsetTable:o},XP}const vY=65504;function la(s){const e=__e();e.floatView[0]=s;const t=e.uint32View[0],i=t>>23&511;return e.baseTable[i]+((t&8388607)>>e.shiftTable[i])}function dc(s){const e=__e();return e.uint32View[0]=e.mantissaTable[e.offsetTable[s>>10]+(s&1023)]+e.exponentTable[s>>10],e.floatView[0]}function bVe(s,e,t,i){switch(e){case 5120:{let r=s.getInt8(t);return i&&(r=Math.max(r/127,-1)),r}case 5121:{let r=s.getUint8(t);return i&&(r=r/255),r}case 5122:{let r=s.getInt16(t,!0);return i&&(r=Math.max(r/32767,-1)),r}case 5123:{let r=s.getUint16(t,!0);return i&&(r=r/65535),r}case 5131:return dc(s.getUint16(t,!0));case 5124:return s.getInt32(t,!0);case 5125:return s.getUint32(t,!0);case 5126:return s.getFloat32(t,!0);default:throw new Error(`Invalid component type ${e}`)}}function TVe(s,e,t,i,r){switch(e){case 5120:{i&&(r=Math.round(r*127)),s.setInt8(t,r);break}case 5121:{i&&(r=Math.round(r*255)),s.setUint8(t,r);break}case 5122:{i&&(r=Math.round(r*32767)),s.setInt16(t,r,!0);break}case 5123:{i&&(r=Math.round(r*65535)),s.setUint16(t,r,!0);break}case 5131:{s.setUint16(t,la(r),!0);break}case 5124:{s.setInt32(t,r,!0);break}case 5125:{s.setUint32(t,r,!0);break}case 5126:{s.setFloat32(t,r,!0);break}default:throw new Error(`Invalid component type ${e}`)}}function j_(s){switch(s){case 5120:case 5121:return 1;case 5122:case 5123:case 5131:return 2;case 5124:case 5125:case 5126:return 4;default:throw new Error(`Invalid type '${s}'`)}}function yVe(s){switch(s){case 5120:return Int8Array;case 5121:return Uint8Array;case 5122:return Int16Array;case 5123:return Uint16Array;case 5131:return Uint16Array;case 5124:return Int32Array;case 5125:return Uint32Array;case 5126:return Float32Array;default:throw new Error(`Invalid component type '${s}'`)}}function KI(s,e,t,i,r,n,a,o){const l=new Array(i),c=new Array(i);if(s instanceof Array){let u=e/4;const h=t/4;for(let d=0;d{for(let f=0;fs.length)throw new Error("Last accessed index is out of bounds.");if(p{for(let b=0;bu.byteLength)throw new Error("Last accessed byte is out of bounds.");const f=e*o;if(r{for(let d=0;d(s=s.replace(/#/gm,"%23"),s),Za={DefaultRetryStrategy:iVe.ExponentialBackoff(),BaseUrl:"",CorsBehavior:"anonymous",PreprocessUrl:s=>s,ScriptBaseUrl:"",ScriptPreprocessUrl:s=>s,CleanUrl:RVe},rj=(s,e)=>{if(!(s&&s.indexOf("data:")===0)&&Za.CorsBehavior)if(typeof Za.CorsBehavior=="string"||Za.CorsBehavior instanceof String)e.crossOrigin=Za.CorsBehavior;else{const t=Za.CorsBehavior(s);t&&(e.crossOrigin=t)}},qR=(s,e,t,i,r="",n,a=Kt.LastCreatedEngine)=>{if(typeof HTMLImageElement>"u"&&!(a!=null&&a._features.forceBitmapOverHTMLImageElement))return t("LoadImage is only supported in web or BabylonNative environments."),null;let o,l=!1;if(s instanceof ArrayBuffer||ArrayBuffer.isView(s))if(typeof Blob<"u"&&typeof URL<"u"){let y;s instanceof ArrayBuffer?y=s:y=v_e(s),o=URL.createObjectURL(new Blob([y],{type:r})),l=!0}else o=`data:${r};base64,`+YE(s);else s instanceof Blob?(o=URL.createObjectURL(s),l=!0):(o=Za.CleanUrl(s),o=Za.PreprocessUrl(o));const c=y=>{if(t){const I=o||s.toString();t(`Error while trying to load image: ${I.indexOf("http")===0||I.length<=128?I:I.slice(0,128)+"..."}`,y)}};if(a!=null&&a._features.forceBitmapOverHTMLImageElement)return yS(o,y=>{a.createImageBitmap(new Blob([y],{type:r}),{premultiplyAlpha:"none",colorSpaceConversion:"none",...n}).then(I=>{e(I),l&&URL.revokeObjectURL(o)}).catch(I=>{t&&t("Error while trying to load image: "+s,I)})},void 0,i||void 0,!0,(y,I)=>{c(I)}),null;const u=new Image;rj(o,u);const h=[],d=()=>{for(const y of h)y.target.addEventListener(y.name,y.handler)},f=()=>{for(const y of h)y.target.removeEventListener(y.name,y.handler);h.length=0},m=()=>{f(),e(u),l&&u.src&&URL.revokeObjectURL(u.src)},p=y=>{f(),c(y),l&&u.src&&URL.revokeObjectURL(u.src)},_=y=>{if(y.blockedURI!==u.src||y.disposition==="report")return;f();const I=new Error(`CSP violation of policy ${y.effectiveDirective} ${y.blockedURI}. Current policy is ${y.originalPolicy}`);Kt.UseFallbackTexture=!1,c(I),l&&u.src&&URL.revokeObjectURL(u.src),u.src=""};h.push({target:u,name:"load",handler:m}),h.push({target:u,name:"error",handler:p}),h.push({target:document,name:"securitypolicyviolation",handler:_}),d();const v=o.substring(0,5)==="blob:",x=o.substring(0,5)==="data:",S=()=>{v||x||!cn.IsCustomRequestAvailable?u.src=o:yS(o,(y,I,R)=>{const A=!r&&R?R:r,P=new Blob([y],{type:A}),w=URL.createObjectURL(P);l=!0,u.src=w},void 0,i||void 0,!0,(y,I)=>{c(I)})},b=()=>{i&&i.loadImage(o,u)};if(!v&&!x&&i&&i.enableTexturesOffline)i.open(b,S);else{if(o.indexOf("file:")!==-1){const y=decodeURIComponent(o.substring(5).toLowerCase());if(aR.FilesToLoad[y]&&typeof URL<"u"){try{let I;try{I=URL.createObjectURL(aR.FilesToLoad[y])}catch{I=URL.createObjectURL(aR.FilesToLoad[y])}u.src=I,l=!0}catch{u.src=""}return u}}S()}return u},ZR=(s,e,t,i,r)=>{const n=new FileReader,a={onCompleteObservable:new Ge,abort:()=>n.abort()};return n.onloadend=()=>a.onCompleteObservable.notifyObservers(a),r&&(n.onerror=()=>{r(new ij(`Unable to read ${s.name}`,s))}),n.onload=o=>{e(o.target.result)},t&&(n.onprogress=t),i?n.readAsArrayBuffer(s):n.readAsText(s),a},yS=(s,e,t,i,r,n,a)=>{if(s.name)return ZR(s,e,t,r,n?u=>{n(void 0,u)}:void 0);const o=s;if(o.indexOf("file:")!==-1){let u=decodeURIComponent(o.substring(5).toLowerCase());u.indexOf("./")===0&&(u=u.substring(2));const h=aR.FilesToLoad[u];if(h)return ZR(h,e,t,r,n?d=>n(void 0,new aO(d.message,d.file)):void 0)}const{match:l,type:c}=IVe(o);if(l){const u={onCompleteObservable:new Ge,abort:()=>()=>{}};try{const h=r?KR(o):b_e(o);e(h,void 0,c)}catch(h){n?n(void 0,h):ye.Error(h.message||"Failed to parse the Data URL")}return No.SetImmediate(()=>{u.onCompleteObservable.notifyObservers(u)}),u}return sj(o,(u,h)=>{e(u,h==null?void 0:h.responseURL,h==null?void 0:h.getResponseHeader("content-type"))},t,i,r,n?u=>{n(u.request,new aO(u.message,u.request))}:void 0,a)},sj=(s,e,t,i,r,n,a)=>{var h;i!==null&&(i??(i=(h=Kt.LastCreatedScene)==null?void 0:h.offlineProvider)),s=Za.CleanUrl(s),s=Za.PreprocessUrl(s);const o=Za.BaseUrl+s;let l=!1;const c={onCompleteObservable:new Ge,abort:()=>l=!0},u=()=>{let d=new cn,f=null,m;const p=()=>{d&&(t&&d.removeEventListener("progress",t),m&&d.removeEventListener("readystatechange",m),d.removeEventListener("loadend",_))};let _=()=>{p(),c.onCompleteObservable.notifyObservers(c),c.onCompleteObservable.clear(),t=void 0,m=null,_=null,n=void 0,a=void 0,e=void 0};c.abort=()=>{l=!0,_&&_(),d&&d.readyState!==(XMLHttpRequest.DONE||4)&&d.abort(),f!==null&&(clearTimeout(f),f=null),d=null};const v=S=>{const b=S.message||"Unknown error";n&&d?n(new oO(b,d)):ye.Error(b)},x=S=>{if(d){if(d.open("GET",o),a)try{a(d)}catch(b){v(b);return}r&&(d.responseType="arraybuffer"),t&&d.addEventListener("progress",t),_&&d.addEventListener("loadend",_),m=()=>{if(!(l||!d)&&d.readyState===(XMLHttpRequest.DONE||4)){if(m&&d.removeEventListener("readystatechange",m),d.status>=200&&d.status<300||d.status===0&&(!yl()||S_e())){const I=r?d.response:d.responseText;if(I!==null){try{e&&e(I,d)}catch(R){v(R)}return}}const b=Za.DefaultRetryStrategy;if(b){const I=b(o,d,S);if(I!==-1){p(),d=new cn,f=setTimeout(()=>x(S+1),I);return}}const y=new oO("Error status: "+d.status+" "+d.statusText+" - Unable to load "+o,d);n&&n(y)}},d.addEventListener("readystatechange",m),d.send()}};x(0)};if(i&&i.enableSceneOffline&&!s.startsWith("blob:")){const d=m=>{m&&m.status>400?n&&n(m):u()},f=()=>{i&&i.loadFile(Za.BaseUrl+s,m=>{!l&&e&&e(m),c.onCompleteObservable.notifyObservers(c)},t?m=>{!l&&t&&t(m)}:void 0,d,r)};i.open(f,d)}else u();return c},S_e=()=>typeof location<"u"&&location.protocol==="file:",nj=s=>x_e.test(s),IVe=s=>{const e=x_e.exec(s);return e===null||e.length===0?{match:!1,type:""}:{match:!0,type:e[0].replace("data:","").replace(";base64,","")}};function KR(s){return ED(s.split(",")[1])}const b_e=s=>c_e(s.split(",")[1]);let RC;const AVe=(s,e,t,i,r,n,a,o,l,c)=>{RC={DecodeBase64UrlToBinary:s,DecodeBase64UrlToString:e,DefaultRetryStrategy:t.DefaultRetryStrategy,BaseUrl:t.BaseUrl,CorsBehavior:t.CorsBehavior,PreprocessUrl:t.PreprocessUrl,IsBase64DataUrl:i,IsFileURL:r,LoadFile:n,LoadImage:a,ReadFile:o,RequestFile:l,SetCorsBehavior:c},Object.defineProperty(RC,"DefaultRetryStrategy",{get:function(){return t.DefaultRetryStrategy},set:function(u){t.DefaultRetryStrategy=u}}),Object.defineProperty(RC,"BaseUrl",{get:function(){return t.BaseUrl},set:function(u){t.BaseUrl=u}}),Object.defineProperty(RC,"PreprocessUrl",{get:function(){return t.PreprocessUrl},set:function(u){t.PreprocessUrl=u}}),Object.defineProperty(RC,"CorsBehavior",{get:function(){return t.CorsBehavior},set:function(u){t.CorsBehavior=u}})};let xY=!1;function T_e(){xY||(xY=!0,AVe(KR,b_e,Za,nj,S_e,yS,qR,ZR,sj,rj),uT.loadFile=yS,uT.loadImage=qR,m_e.loadFile=yS)}class oR{static Instantiate(e){if(this.RegisteredExternalClasses&&this.RegisteredExternalClasses[e])return this.RegisteredExternalClasses[e];const t=ia(e);if(t)return t;ye.Warn(e+" not found, you may have missed an import.");const i=e.split(".");let r=typeof window<"u"?window:typeof globalThis<"u"?globalThis:this;for(let n=0,a=i.length;n{const e=Math.random()*16|0;return(s==="x"?e:e&3|8).toString(16)})}function uS(s){let e=1;do e*=2;while(es-t?t:e}function E_e(s){return s--,s|=s>>1,s|=s>>2,s|=s>>4,s|=s>>8,s|=s>>16,s++,s}function aj(s){return s=s|s>>1,s=s|s>>2,s=s|s>>4,s=s|s>>8,s=s|s>>16,s-(s>>1)}function ud(s,e,t=2){let i;switch(t){case 1:i=aj(s);break;case 2:i=y_e(s);break;case 3:default:i=E_e(s);break}return Math.min(i,e)}var ir;class Yt{static get BaseUrl(){return Za.BaseUrl}static set BaseUrl(e){Za.BaseUrl=e}static get CleanUrl(){return Za.CleanUrl}static set CleanUrl(e){Za.CleanUrl=e}static IsAbsoluteUrl(e){return e.indexOf("//")===0?!0:e.indexOf("://")===-1||e.indexOf(".")===-1||e.indexOf("/")===-1||e.indexOf(":")>e.indexOf("/")?!1:e.indexOf("://"){yS(e,n=>{i(n)},void 0,void 0,t,(n,a)=>{r(a)})})}static GetAssetUrl(e){if(!e)return"";if(ir.AssetBaseUrl&&e.startsWith(ir._DefaultAssetsUrl)){const t=ir.AssetBaseUrl.endsWith("/")?ir.AssetBaseUrl.slice(0,-1):ir.AssetBaseUrl;return e.replace(ir._DefaultAssetsUrl,t)}return e}static GetBabylonScriptURL(e,t){if(!e)return"";if(e.startsWith(ir._DefaultCdnUrl)){if(ir.ScriptBaseUrl){const i=ir.ScriptBaseUrl.endsWith("/")?ir.ScriptBaseUrl.slice(0,-1):ir.ScriptBaseUrl;e=e.replace(ir._DefaultCdnUrl,i)}else if(ir._CdnVersion){const i=`${ir._DefaultCdnUrl}/v${ir._CdnVersion}`;e.startsWith(i)||(e=e.replace(ir._DefaultCdnUrl,i))}}return e=ir.ScriptPreprocessUrl(e),t&&!ir.IsAbsoluteUrl(e)&&(e=ir.GetAbsoluteUrl(e)),e}static LoadBabylonScript(e,t,i,r){e=ir.GetBabylonScriptURL(e),ir.LoadScript(e,t,i)}static async LoadBabylonScriptAsync(e){return e=ir.GetBabylonScriptURL(e),await ir.LoadScriptAsync(e)}static _LoadScriptNative(e,t,i){_native&&ir.LoadFile(e,r=>{try{Function(r).apply(null),t&&t()}catch(n){i&&i("LoadScript Error",n)}},void 0,void 0,!1,(r,n)=>{i&&i("LoadScript Error",n)})}static _LoadScriptWeb(e,t,i,r,n=!1){if(typeof importScripts=="function"){try{importScripts(e),t&&t()}catch(l){i==null||i(`Unable to load script '${e}' in worker`,l)}return}else if(!yl()){i==null||i(`Cannot load script '${e}' outside of a window or a worker`);return}const a=document.getElementsByTagName("head")[0],o=document.createElement("script");n?(o.setAttribute("type","module"),o.innerText=e):(o.setAttribute("type","text/javascript"),o.setAttribute("src",e)),r&&(o.id=r),o.onload=()=>{t&&t()},o.onerror=l=>{i&&i(`Unable to load script '${e}'`,l)},a.appendChild(o)}static async LoadScriptAsync(e,t){return await new Promise((i,r)=>{this.LoadScript(e,()=>{i()},(n,a)=>{r(a||new Error(n))},t)})}static ReadFileAsDataURL(e,t,i){const r=new FileReader,n={onCompleteObservable:new Ge,abort:()=>r.abort()};return r.onloadend=()=>{n.onCompleteObservable.notifyObservers(n)},r.onload=a=>{t(a.target.result)},r.onprogress=i,r.readAsDataURL(e),n}static ReadFile(e,t,i,r,n){return ZR(e,t,i,r,n)}static FileAsURL(e){const t=new Blob([e]);return window.URL.createObjectURL(t)}static Format(e,t=2){return e.toFixed(t)}static DeepCopy(e,t,i,r){$l.DeepCopy(e,t,i,r)}static IsEmpty(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!1;return!0}static RegisterTopRootEvents(e,t){for(let i=0;i{const l=atob(this.toDataURL(a,o).split(",")[1]),c=l.length,u=new Uint8Array(c);for(let h=0;ht(n)):e.toBlob(function(n){t(n)},i,r)}static DownloadBlob(e,t){if("download"in document.createElement("a")){if(!t){const i=new Date;t="screenshot_"+((i.getFullYear()+"-"+(i.getMonth()+1)).slice(2)+"-"+i.getDate()+"_"+i.getHours()+"-"+("0"+i.getMinutes()).slice(-2))+".png"}ir.Download(e,t)}else if(e&&typeof URL<"u"){const i=URL.createObjectURL(e),r=window.open("");if(!r)return;const n=r.document.createElement("img");n.onload=function(){URL.revokeObjectURL(i)},n.src=i,r.document.body.appendChild(n)}}static EncodeScreenshotCanvasData(e,t,i="image/png",r,n){if(typeof r=="string"||!t)this.ToBlob(e,function(a){a&&ir.DownloadBlob(a,r),t&&t("")},i,n);else if(t){if(ir._IsOffScreenCanvas(e)){e.convertToBlob({type:i,quality:n}).then(o=>{const l=new FileReader;l.readAsDataURL(o),l.onloadend=()=>{const c=l.result;t(c)}});return}const a=e.toDataURL(i,n);t(a)}}static Download(e,t){if(typeof URL>"u")return;const i=window.URL.createObjectURL(e),r=document.createElement("a");document.body.appendChild(r),r.style.display="none",r.href=i,r.download=t,r.addEventListener("click",()=>{r.parentElement&&r.parentElement.removeChild(r)}),r.click(),window.URL.revokeObjectURL(i)}static BackCompatCameraNoPreventDefault(e){return typeof e[0]=="boolean"?e[0]:typeof e[1]=="boolean"?e[1]:!1}static CreateScreenshot(e,t,i,r,n="image/png",a=!1,o){throw Wi("ScreenshotTools")}static async CreateScreenshotAsync(e,t,i,r="image/png",n){throw Wi("ScreenshotTools")}static CreateScreenshotUsingRenderTarget(e,t,i,r,n="image/png",a=1,o=!1,l,c=!1,u=!1,h=!0,d,f){throw Wi("ScreenshotTools")}static async CreateScreenshotUsingRenderTargetAsync(e,t,i,r="image/png",n=1,a=!1,o,l=!1,c=!1,u=!0,h,d){throw Wi("ScreenshotTools")}static RandomId(){return Xv()}static IsBase64(e){return nj(e)}static DecodeBase64(e){return KR(e)}static get errorsCount(){return ye.errorsCount}static Log(e){ye.Log(e)}static Warn(e){ye.Warn(e)}static Error(e){ye.Error(e)}static get LogCache(){return ye.LogCache}static ClearLogCache(){ye.ClearLogCache()}static set LogLevels(e){ye.LogLevels=e}static set PerformanceLogLevel(e){var t;if((e&ir.PerformanceUserMarkLogLevel)===ir.PerformanceUserMarkLogLevel){_native!=null&&_native.enablePerformanceLogging?(_native.enablePerformanceLogging(1),ir.StartPerformanceCounter=ir._StartMarkNative,ir.EndPerformanceCounter=ir._EndMarkNative):(ir.StartPerformanceCounter=ir._StartUserMark,ir.EndPerformanceCounter=ir._EndUserMark);return}if((e&ir.PerformanceConsoleLogLevel)===ir.PerformanceConsoleLogLevel){_native!=null&&_native.enablePerformanceLogging?(_native.enablePerformanceLogging(2),ir.StartPerformanceCounter=ir._StartMarkNative,ir.EndPerformanceCounter=ir._EndMarkNative):(ir.StartPerformanceCounter=ir._StartPerformanceConsole,ir.EndPerformanceCounter=ir._EndPerformanceConsole);return}ir.StartPerformanceCounter=ir._StartPerformanceCounterDisabled,ir.EndPerformanceCounter=ir._EndPerformanceCounterDisabled,(t=_native==null?void 0:_native.disablePerformanceLogging)==null||t.call(_native)}static _StartPerformanceCounterDisabled(e,t){}static _EndPerformanceCounterDisabled(e,t){}static _StartUserMark(e,t=!0){if(!ir._Performance){if(!yl())return;ir._Performance=window.performance}!t||!ir._Performance.mark||ir._Performance.mark(e+"-Begin")}static _EndUserMark(e,t=!0){!t||!ir._Performance.mark||(ir._Performance.mark(e+"-End"),ir._Performance.measure(e,e+"-Begin",e+"-End"))}static _StartPerformanceConsole(e,t=!0){t&&(ir._StartUserMark(e,t),console.time&&console.time(e))}static _EndPerformanceConsole(e,t=!0){t&&(ir._EndUserMark(e,t),console.timeEnd(e))}static _StartMarkNative(e,t=!0){if(t&&(_native!=null&&_native.startPerformanceCounter))if(ir._NativePerformanceCounterHandles.has(e))ir.Warn(`Performance counter with name ${e} is already started.`);else{const i=_native.startPerformanceCounter(e);ir._NativePerformanceCounterHandles.set(e,i)}}static _EndMarkNative(e,t=!0){if(t&&(_native!=null&&_native.endPerformanceCounter)){const i=ir._NativePerformanceCounterHandles.get(e);i?(_native.endPerformanceCounter(i),ir._NativePerformanceCounterHandles.delete(e)):ir.Warn(`Performance counter with name ${e} was not started.`)}}static get Now(){return ko.Now}static GetClassName(e,t=!1){let i=null;return!t&&e.getClassName?i=e.getClassName():(e instanceof Object&&(i=(t?e:Object.getPrototypeOf(e)).constructor.__bjsclassName__),i||(i=typeof e)),i}static First(e,t){for(const i of e)if(t(i))return i;return null}static getFullClassName(e,t=!1){let i=null,r=null;if(!t&&e.getClassName)i=e.getClassName();else{if(e instanceof Object){const n=t?e:Object.getPrototypeOf(e);i=n.constructor.__bjsclassName__,r=n.constructor.__bjsmoduleName__}i||(i=typeof e)}return i?(r!=null?r+".":"")+i:null}static async DelayAsync(e){await new Promise(t=>{setTimeout(()=>{t()},e)})}static IsSafari(){return cT()?/^((?!chrome|android).)*safari/i.test(navigator.userAgent):!1}}ir=Yt;Yt.AssetBaseUrl="";Yt.UseCustomRequestHeaders=!1;Yt.CustomRequestHeaders=cn.CustomRequestHeaders;Yt.GetDOMTextContent=J5;Yt._DefaultCdnUrl="https://cdn.babylonjs.com";Yt._CdnVersion="9.17.1";Yt._DefaultAssetsUrl="https://assets.babylonjs.com/core";Yt.LoadScript=typeof _native>"u"?ir._LoadScriptWeb:ir._LoadScriptNative;Yt.GetAbsoluteUrl=typeof document=="object"?s=>{const e=document.createElement("a");return e.href=s,e.href}:typeof URL=="function"&&typeof location=="object"?s=>new URL(s,location.origin).href:()=>{throw new Error("Unable to get absolute URL. Override BABYLON.Tools.GetAbsoluteUrl to a custom implementation for the current context.")};Yt.NoneLogLevel=ye.NoneLogLevel;Yt.MessageLogLevel=ye.MessageLogLevel;Yt.WarningLogLevel=ye.WarningLogLevel;Yt.ErrorLogLevel=ye.ErrorLogLevel;Yt.AllLogLevel=ye.AllLogLevel;Yt.IsWindowObjectExist=yl;Yt.PerformanceNoneLogLevel=0;Yt.PerformanceUserMarkLogLevel=1;Yt.PerformanceConsoleLogLevel=2;Yt._NativePerformanceCounterHandles=new Map;Yt.StartPerformanceCounter=ir._StartPerformanceCounterDisabled;Yt.EndPerformanceCounter=ir._EndPerformanceCounterDisabled;class Lp{constructor(e,t,i,r=0){this.iterations=e,this.index=r-1,this._done=!1,this._fn=t,this._successCallback=i}executeNext(){this._done||(this.index+1{n&&n()?o.breakLoop():setTimeout(()=>{for(let l=0;l=e)break;if(i(c),n&&n()){o.breakLoop();break}}o.executeNext()},a)},r)}}let SY=!1;function PVe(){SY||(SY=!0,Yt.Mix=i2,Yt.IsExponentOfTwo=uS,Kt.FallbackTexture="data:image/jpg;base64,/9j/4AAQSkZJRgABAQEAYABgAAD/4QBmRXhpZgAATU0AKgAAAAgABAEaAAUAAAABAAAAPgEbAAUAAAABAAAARgEoAAMAAAABAAIAAAExAAIAAAAQAAAATgAAAAAAAABgAAAAAQAAAGAAAAABcGFpbnQubmV0IDQuMC41AP/bAEMABAIDAwMCBAMDAwQEBAQFCQYFBQUFCwgIBgkNCw0NDQsMDA4QFBEODxMPDAwSGBITFRYXFxcOERkbGRYaFBYXFv/bAEMBBAQEBQUFCgYGChYPDA8WFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFv/AABEIAQABAAMBIgACEQEDEQH/xAAfAAABBQEBAQEBAQAAAAAAAAAAAQIDBAUGBwgJCgv/xAC1EAACAQMDAgQDBQUEBAAAAX0BAgMABBEFEiExQQYTUWEHInEUMoGRoQgjQrHBFVLR8CQzYnKCCQoWFxgZGiUmJygpKjQ1Njc4OTpDREVGR0hJSlNUVVZXWFlaY2RlZmdoaWpzdHV2d3h5eoOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3uLm6wsPExcbHyMnK0tPU1dbX2Nna4eLj5OXm5+jp6vHy8/T19vf4+fr/xAAfAQADAQEBAQEBAQEBAAAAAAAAAQIDBAUGBwgJCgv/xAC1EQACAQIEBAMEBwUEBAABAncAAQIDEQQFITEGEkFRB2FxEyIygQgUQpGhscEJIzNS8BVictEKFiQ04SXxFxgZGiYnKCkqNTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqCg4SFhoeIiYqSk5SVlpeYmZqio6Slpqeoqaqys7S1tre4ubrCw8TFxsfIycrS09TV1tfY2dri4+Tl5ufo6ery8/T19vf4+fr/2gAMAwEAAhEDEQA/APH6KKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FCiiigD6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++gooooA+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gUKKKKAPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76CiiigD5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BQooooA+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/voKKKKAPl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FCiiigD6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++gooooA+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gUKKKKAPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76CiiigD5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BQooooA+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/voKKKKAPl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FCiiigD6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++gooooA+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gUKKKKAPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76P//Z")}class Ja{constructor(e){this.length=0,this.data=new Array(e),this._id=Ja._GlobalId++}push(e){this.data[this.length++]=e,this.length>this.data.length&&(this.data.length*=2)}forEach(e){for(let t=0;tthis.data.length&&(this.data.length=(this.length+e.length)*2);for(let t=0;t=this.length?-1:t}contains(e){return this.indexOf(e)!==-1}}Ja._GlobalId=0;class $x extends Ja{constructor(){super(...arguments),this._duplicateId=0}push(e){super.push(e),e.__smartArrayFlags||(e.__smartArrayFlags={}),e.__smartArrayFlags[this._id]=this._duplicateId}pushNoDuplicate(e){return e.__smartArrayFlags&&e.__smartArrayFlags[this._id]===this._duplicateId?!1:(this.push(e),!0)}reset(){super.reset(),this._duplicateId++}concatWithNoDuplicate(e){if(e.length!==0){this.length+e.length>this.data.length&&(this.data.length=(this.length+e.length)*2);for(let t=0;tthis.add(t,i))}get(e){const t=this._data[e];if(t!==void 0)return t}getOrAddWithFactory(e,t){let i=this.get(e);return i!==void 0||(i=t(e),i&&this.add(e,i)),i}getOrAdd(e,t){const i=this.get(e);return i!==void 0?i:(this.add(e,t),t)}contains(e){return this._data[e]!==void 0}add(e,t){return this._data[e]!==void 0?!1:(this._data[e]=t,++this._count,!0)}set(e,t){return this._data[e]===void 0?!1:(this._data[e]=t,!0)}getAndRemove(e){const t=this.get(e);return t!==void 0?(delete this._data[e],--this._count,t):null}remove(e){return this.contains(e)?(delete this._data[e],--this._count,!0):!1}clear(){this._data={},this._count=0}get count(){return this._count}forEach(e){for(const t in this._data){const i=this._data[t];e(t,i)}}first(e){for(const t in this._data){const i=this._data[t],r=e(t,i);if(r)return r}return null}}function C_e(s){s.push("vCameraColorCurveNeutral","vCameraColorCurvePositive","vCameraColorCurveNegative")}let lO=(()=>{var s;let e,t=[],i=[],r,n=[],a=[],o,l=[],c=[],u,h=[],d=[],f,m=[],p=[],_,v=[],x=[],S,b=[],y=[],I,R=[],A=[],P,w=[],L=[],k,V=[],U=[],ne,oe=[],le=[],Y,te=[],Z=[];return s=class{constructor(){this._dirty=!0,this._tempColor=new $t(0,0,0,0),this._globalCurve=new $t(0,0,0,0),this._highlightsCurve=new $t(0,0,0,0),this._midtonesCurve=new $t(0,0,0,0),this._shadowsCurve=new $t(0,0,0,0),this._positiveCurve=new $t(0,0,0,0),this._negativeCurve=new $t(0,0,0,0),this._globalHue=C(this,t,30),this._globalDensity=(C(this,i),C(this,n,0)),this._globalSaturation=(C(this,a),C(this,l,0)),this._globalExposure=(C(this,c),C(this,h,0)),this._highlightsHue=(C(this,d),C(this,m,30)),this._highlightsDensity=(C(this,p),C(this,v,0)),this._highlightsSaturation=(C(this,x),C(this,b,0)),this._highlightsExposure=(C(this,y),C(this,R,0)),this._midtonesHue=(C(this,A),C(this,w,30)),this._midtonesDensity=(C(this,L),C(this,V,0)),this._midtonesSaturation=(C(this,U),C(this,oe,0)),this._midtonesExposure=(C(this,le),C(this,te,0)),this._shadowsHue=(C(this,Z),30),this._shadowsDensity=0,this._shadowsSaturation=0,this._shadowsExposure=0}get globalHue(){return this._globalHue}set globalHue(G){this._globalHue=G,this._dirty=!0}get globalDensity(){return this._globalDensity}set globalDensity(G){this._globalDensity=G,this._dirty=!0}get globalSaturation(){return this._globalSaturation}set globalSaturation(G){this._globalSaturation=G,this._dirty=!0}get globalExposure(){return this._globalExposure}set globalExposure(G){this._globalExposure=G,this._dirty=!0}get highlightsHue(){return this._highlightsHue}set highlightsHue(G){this._highlightsHue=G,this._dirty=!0}get highlightsDensity(){return this._highlightsDensity}set highlightsDensity(G){this._highlightsDensity=G,this._dirty=!0}get highlightsSaturation(){return this._highlightsSaturation}set highlightsSaturation(G){this._highlightsSaturation=G,this._dirty=!0}get highlightsExposure(){return this._highlightsExposure}set highlightsExposure(G){this._highlightsExposure=G,this._dirty=!0}get midtonesHue(){return this._midtonesHue}set midtonesHue(G){this._midtonesHue=G,this._dirty=!0}get midtonesDensity(){return this._midtonesDensity}set midtonesDensity(G){this._midtonesDensity=G,this._dirty=!0}get midtonesSaturation(){return this._midtonesSaturation}set midtonesSaturation(G){this._midtonesSaturation=G,this._dirty=!0}get midtonesExposure(){return this._midtonesExposure}set midtonesExposure(G){this._midtonesExposure=G,this._dirty=!0}get shadowsHue(){return this._shadowsHue}set shadowsHue(G){this._shadowsHue=G,this._dirty=!0}get shadowsDensity(){return this._shadowsDensity}set shadowsDensity(G){this._shadowsDensity=G,this._dirty=!0}get shadowsSaturation(){return this._shadowsSaturation}set shadowsSaturation(G){this._shadowsSaturation=G,this._dirty=!0}get shadowsExposure(){return this._shadowsExposure}set shadowsExposure(G){this._shadowsExposure=G,this._dirty=!0}getClassName(){return"ColorCurves"}_getColorGradingDataToRef(G,J,$,re,ie){G!=null&&(G=s._Clamp(G,0,360),J=s._Clamp(J,-100,100),$=s._Clamp($,-100,100),re=s._Clamp(re,-100,100),J=s._ApplyColorGradingSliderNonlinear(J),J*=.5,re=s._ApplyColorGradingSliderNonlinear(re),J<0&&(J*=-1,G=(G+180)%360),s._FromHSBToRef(G,J,50+.25*re,ie),ie.scaleToRef(2,ie),ie.a=1+.01*$)}static _ApplyColorGradingSliderNonlinear(G){G/=100;let J=Math.abs(G);return J=Math.pow(J,2),G<0&&(J*=-1),J*=100,J}static _FromHSBToRef(G,J,$,re){let ie=s._Clamp(G,0,360);const ve=s._Clamp(J/100,0,1),Re=s._Clamp($/100,0,1);if(ve===0)re.r=Re,re.g=Re,re.b=Re;else{ie/=60;const Ie=Math.floor(ie),de=ie-Ie,q=Re*(1-ve),pe=Re*(1-ve*de),Oe=Re*(1-ve*(1-de));switch(Ie){case 0:re.r=Re,re.g=Oe,re.b=q;break;case 1:re.r=pe,re.g=Re,re.b=q;break;case 2:re.r=q,re.g=Re,re.b=Oe;break;case 3:re.r=q,re.g=pe,re.b=Re;break;case 4:re.r=Oe,re.g=q,re.b=Re;break;default:re.r=Re,re.g=q,re.b=pe;break}}re.a=1}static _Clamp(G,J,$){return Math.min(Math.max(G,J),$)}clone(){return li.Clone(()=>new s,this)}serialize(){return li.Serialize(this)}_bind(G,J="vCameraColorCurvePositive",$="vCameraColorCurveNeutral",re="vCameraColorCurveNegative"){this._dirty&&(this._dirty=!1,this._getColorGradingDataToRef(this._globalHue,this._globalDensity,this._globalSaturation,this._globalExposure,this._globalCurve),this._getColorGradingDataToRef(this._highlightsHue,this._highlightsDensity,this._highlightsSaturation,this._highlightsExposure,this._tempColor),this._tempColor.multiplyToRef(this._globalCurve,this._highlightsCurve),this._getColorGradingDataToRef(this._midtonesHue,this._midtonesDensity,this._midtonesSaturation,this._midtonesExposure,this._tempColor),this._tempColor.multiplyToRef(this._globalCurve,this._midtonesCurve),this._getColorGradingDataToRef(this._shadowsHue,this._shadowsDensity,this._shadowsSaturation,this._shadowsExposure,this._tempColor),this._tempColor.multiplyToRef(this._globalCurve,this._shadowsCurve),this._highlightsCurve.subtractToRef(this._midtonesCurve,this._positiveCurve),this._midtonesCurve.subtractToRef(this._shadowsCurve,this._negativeCurve)),G&&(G.setFloat4(J,this._positiveCurve.r,this._positiveCurve.g,this._positiveCurve.b,this._positiveCurve.a),G.setFloat4($,this._midtonesCurve.r,this._midtonesCurve.g,this._midtonesCurve.b,this._midtonesCurve.a),G.setFloat4(re,this._negativeCurve.r,this._negativeCurve.g,this._negativeCurve.b,this._negativeCurve.a))}},(()=>{const j=typeof Symbol=="function"&&Symbol.metadata?Object.create(null):void 0;e=[se()],r=[se()],o=[se()],u=[se()],f=[se()],_=[se()],S=[se()],I=[se()],P=[se()],k=[se()],ne=[se()],Y=[se()],F(null,null,e,{kind:"field",name:"_globalHue",static:!1,private:!1,access:{has:G=>"_globalHue"in G,get:G=>G._globalHue,set:(G,J)=>{G._globalHue=J}},metadata:j},t,i),F(null,null,r,{kind:"field",name:"_globalDensity",static:!1,private:!1,access:{has:G=>"_globalDensity"in G,get:G=>G._globalDensity,set:(G,J)=>{G._globalDensity=J}},metadata:j},n,a),F(null,null,o,{kind:"field",name:"_globalSaturation",static:!1,private:!1,access:{has:G=>"_globalSaturation"in G,get:G=>G._globalSaturation,set:(G,J)=>{G._globalSaturation=J}},metadata:j},l,c),F(null,null,u,{kind:"field",name:"_globalExposure",static:!1,private:!1,access:{has:G=>"_globalExposure"in G,get:G=>G._globalExposure,set:(G,J)=>{G._globalExposure=J}},metadata:j},h,d),F(null,null,f,{kind:"field",name:"_highlightsHue",static:!1,private:!1,access:{has:G=>"_highlightsHue"in G,get:G=>G._highlightsHue,set:(G,J)=>{G._highlightsHue=J}},metadata:j},m,p),F(null,null,_,{kind:"field",name:"_highlightsDensity",static:!1,private:!1,access:{has:G=>"_highlightsDensity"in G,get:G=>G._highlightsDensity,set:(G,J)=>{G._highlightsDensity=J}},metadata:j},v,x),F(null,null,S,{kind:"field",name:"_highlightsSaturation",static:!1,private:!1,access:{has:G=>"_highlightsSaturation"in G,get:G=>G._highlightsSaturation,set:(G,J)=>{G._highlightsSaturation=J}},metadata:j},b,y),F(null,null,I,{kind:"field",name:"_highlightsExposure",static:!1,private:!1,access:{has:G=>"_highlightsExposure"in G,get:G=>G._highlightsExposure,set:(G,J)=>{G._highlightsExposure=J}},metadata:j},R,A),F(null,null,P,{kind:"field",name:"_midtonesHue",static:!1,private:!1,access:{has:G=>"_midtonesHue"in G,get:G=>G._midtonesHue,set:(G,J)=>{G._midtonesHue=J}},metadata:j},w,L),F(null,null,k,{kind:"field",name:"_midtonesDensity",static:!1,private:!1,access:{has:G=>"_midtonesDensity"in G,get:G=>G._midtonesDensity,set:(G,J)=>{G._midtonesDensity=J}},metadata:j},V,U),F(null,null,ne,{kind:"field",name:"_midtonesSaturation",static:!1,private:!1,access:{has:G=>"_midtonesSaturation"in G,get:G=>G._midtonesSaturation,set:(G,J)=>{G._midtonesSaturation=J}},metadata:j},oe,le),F(null,null,Y,{kind:"field",name:"_midtonesExposure",static:!1,private:!1,access:{has:G=>"_midtonesExposure"in G,get:G=>G._midtonesExposure,set:(G,J)=>{G._midtonesExposure=J}},metadata:j},te,Z),j&&Object.defineProperty(s,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:j})})(),s.PrepareUniforms=C_e,s})(),bY=!1;function TY(s){return li.Parse(()=>new lO,s,null,null)}function R_e(s,e,t="vCameraColorCurvePositive",i="vCameraColorCurveNeutral",r="vCameraColorCurveNegative"){s._bind(e,t,i,r)}function MVe(){bY||(bY=!0,lO.Bind=R_e,lO.Parse=TY,li._ColorCurvesParser=TY)}function I_e(s,e){e.EXPOSURE&&s.push("exposureLinear"),e.CONTRAST&&s.push("contrast"),e.COLORGRADING&&s.push("colorTransformSettings"),(e.VIGNETTE||e.DITHER)&&s.push("vInverseScreenSize"),e.VIGNETTE&&(s.push("vignetteSettings1"),s.push("vignetteSettings2")),e.COLORCURVES&&C_e(s),e.DITHER&&s.push("ditherIntensity")}function A_e(s,e){e.COLORGRADING&&s.push("txColorTransform")}let ta=(()=>{var s;let e,t=[],i=[],r,n=[],a=[],o,l=[],c=[],u,h=[],d=[],f,m=[],p=[],_,v=[],x=[],S,b=[],y=[],I,R=[],A=[],P,w=[],L=[],k,V=[],U=[],ne,oe=[],le=[],Y,te=[],Z=[],j,G=[],J=[],$,re=[],ie=[],ve,Re=[],Ie=[],de,q=[],pe=[],Oe,Me=[],Ve=[],tt,lt=[],Ne=[],at,Ee=[],me=[],Xe,Fe=[],it=[],Ye,Dt=[],Lt=[],Vt,ai=[],Ft=[],Wt,ri=[],he=[],ct,Je=[],Nt=[],mi,De=[],Ct=[];return s=class{constructor(){this.colorCurves=C(this,t,new lO),this._colorCurvesEnabled=(C(this,i),C(this,n,!1)),this._colorGradingTexture=(C(this,a),C(this,l,void 0)),this._colorGradingEnabled=(C(this,c),C(this,h,!1)),this._colorGradingWithGreenDepth=(C(this,d),C(this,m,!0)),this._colorGradingBGR=(C(this,p),C(this,v,!0)),this._exposure=(C(this,x),C(this,b,1)),this._toneMappingEnabled=(C(this,y),C(this,R,!1)),this._toneMappingType=(C(this,A),C(this,w,s.TONEMAPPING_STANDARD)),this._contrast=(C(this,L),C(this,V,1)),this.vignetteStretch=(C(this,U),C(this,oe,0)),this.vignetteCenterX=(C(this,le),C(this,te,0)),this.vignetteCenterY=(C(this,Z),C(this,G,0)),this.vignetteWeight=(C(this,J),C(this,re,1.5)),this.vignetteColor=(C(this,ie),C(this,Re,new $t(0,0,0,0))),this.vignetteCameraFov=(C(this,Ie),C(this,q,.5)),this._vignetteBlendMode=(C(this,pe),C(this,Me,s.VIGNETTEMODE_MULTIPLY)),this._vignetteEnabled=(C(this,Ve),C(this,lt,!1)),this._ditheringEnabled=(C(this,Ne),C(this,Ee,!1)),this._ditheringIntensity=(C(this,me),C(this,Fe,1/255)),this._skipFinalColorClamp=(C(this,it),C(this,Dt,!1)),this._applyByPostProcess=(C(this,Lt),C(this,ai,!1)),this._isEnabled=(C(this,Ft),C(this,ri,!0)),this.outputTextureWidth=(C(this,he),C(this,Je,0)),this.outputTextureHeight=(C(this,Nt),C(this,De,0)),this.onUpdateParameters=(C(this,Ct),new Ge)}get colorCurvesEnabled(){return this._colorCurvesEnabled}set colorCurvesEnabled(we){this._colorCurvesEnabled!==we&&(this._colorCurvesEnabled=we,this._updateParameters())}get colorGradingTexture(){return this._colorGradingTexture}set colorGradingTexture(we){this._colorGradingTexture!==we&&(this._colorGradingTexture=we,this._updateParameters())}get colorGradingEnabled(){return this._colorGradingEnabled}set colorGradingEnabled(we){this._colorGradingEnabled!==we&&(this._colorGradingEnabled=we,this._updateParameters())}get colorGradingWithGreenDepth(){return this._colorGradingWithGreenDepth}set colorGradingWithGreenDepth(we){this._colorGradingWithGreenDepth!==we&&(this._colorGradingWithGreenDepth=we,this._updateParameters())}get colorGradingBGR(){return this._colorGradingBGR}set colorGradingBGR(we){this._colorGradingBGR!==we&&(this._colorGradingBGR=we,this._updateParameters())}get exposure(){return this._exposure}set exposure(we){this._exposure!==we&&(this._exposure=we,this._updateParameters())}get toneMappingEnabled(){return this._toneMappingEnabled}set toneMappingEnabled(we){this._toneMappingEnabled!==we&&(this._toneMappingEnabled=we,this._updateParameters())}get toneMappingType(){return this._toneMappingType}set toneMappingType(we){this._toneMappingType!==we&&(this._toneMappingType=we,this._updateParameters())}get contrast(){return this._contrast}set contrast(we){this._contrast!==we&&(this._contrast=we,this._updateParameters())}get vignetteCentreY(){return this.vignetteCenterY}set vignetteCentreY(we){this.vignetteCenterY=we}get vignetteCentreX(){return this.vignetteCenterX}set vignetteCentreX(we){this.vignetteCenterX=we}get vignetteBlendMode(){return this._vignetteBlendMode}set vignetteBlendMode(we){this._vignetteBlendMode!==we&&(this._vignetteBlendMode=we,this._updateParameters())}get vignetteEnabled(){return this._vignetteEnabled}set vignetteEnabled(we){this._vignetteEnabled!==we&&(this._vignetteEnabled=we,this._updateParameters())}get ditheringEnabled(){return this._ditheringEnabled}set ditheringEnabled(we){this._ditheringEnabled!==we&&(this._ditheringEnabled=we,this._updateParameters())}get ditheringIntensity(){return this._ditheringIntensity}set ditheringIntensity(we){this._ditheringIntensity!==we&&(this._ditheringIntensity=we,this._updateParameters())}get skipFinalColorClamp(){return this._skipFinalColorClamp}set skipFinalColorClamp(we){this._skipFinalColorClamp!==we&&(this._skipFinalColorClamp=we,this._updateParameters())}get applyByPostProcess(){return this._applyByPostProcess}set applyByPostProcess(we){this._applyByPostProcess!==we&&(this._applyByPostProcess=we,this._updateParameters())}get isEnabled(){return this._isEnabled}set isEnabled(we){this._isEnabled!==we&&(this._isEnabled=we,this._updateParameters())}_updateParameters(){this.onUpdateParameters.notifyObservers(this)}getClassName(){return"ImageProcessingConfiguration"}prepareDefines(we,be=!1){if(be!==this.applyByPostProcess||!this._isEnabled){we.VIGNETTE=!1,we.TONEMAPPING=0,we.CONTRAST=!1,we.EXPOSURE=!1,we.COLORCURVES=!1,we.COLORGRADING=!1,we.COLORGRADING3D=!1,we.DITHER=!1,we.IMAGEPROCESSING=!1,we.SKIPFINALCOLORCLAMP=this.skipFinalColorClamp,we.IMAGEPROCESSINGPOSTPROCESS=this.applyByPostProcess&&this._isEnabled;return}if(we.VIGNETTE=this.vignetteEnabled,we.VIGNETTEBLENDMODEMULTIPLY=this.vignetteBlendMode===s._VIGNETTEMODE_MULTIPLY,we.VIGNETTEBLENDMODEOPAQUE=!we.VIGNETTEBLENDMODEMULTIPLY,!this._toneMappingEnabled)we.TONEMAPPING=0;else switch(this._toneMappingType){case s.TONEMAPPING_KHR_PBR_NEUTRAL:we.TONEMAPPING=3;break;case s.TONEMAPPING_ACES:we.TONEMAPPING=2;break;default:we.TONEMAPPING=1;break}we.CONTRAST=this.contrast!==1,we.EXPOSURE=this.exposure!==1,we.COLORCURVES=this.colorCurvesEnabled&&!!this.colorCurves,we.COLORGRADING=this.colorGradingEnabled&&!!this.colorGradingTexture,we.COLORGRADING?we.COLORGRADING3D=this.colorGradingTexture.is3D:we.COLORGRADING3D=!1,we.SAMPLER3DGREENDEPTH=this.colorGradingWithGreenDepth,we.SAMPLER3DBGRMAP=this.colorGradingBGR,we.DITHER=this._ditheringEnabled,we.IMAGEPROCESSINGPOSTPROCESS=this.applyByPostProcess,we.SKIPFINALCOLORCLAMP=this.skipFinalColorClamp,we.IMAGEPROCESSING=we.VIGNETTE||!!we.TONEMAPPING||we.CONTRAST||we.EXPOSURE||we.COLORCURVES||we.COLORGRADING||we.DITHER}isReady(){return!this.colorGradingEnabled||!this.colorGradingTexture||this.colorGradingTexture.isReady()}bind(we,be){if(this._colorCurvesEnabled&&this.colorCurves&&R_e(this.colorCurves,we),this._vignetteEnabled||this._ditheringEnabled){const nt=1/(this.outputTextureWidth||we.getEngine().getRenderWidth()),ci=1/(this.outputTextureHeight||we.getEngine().getRenderHeight());if(we.setFloat2("vInverseScreenSize",nt,ci),this._ditheringEnabled&&we.setFloat("ditherIntensity",.5*this._ditheringIntensity),this._vignetteEnabled){const mt=be??ci/nt;let ee=Math.tan(this.vignetteCameraFov*.5),ce=ee*mt;const dt=Math.sqrt(ce*ee);ce=i2(ce,dt,this.vignetteStretch),ee=i2(ee,dt,this.vignetteStretch),we.setFloat4("vignetteSettings1",ce,ee,-ce*this.vignetteCenterX,-ee*this.vignetteCenterY);const qt=-2*this.vignetteWeight;we.setFloat4("vignetteSettings2",this.vignetteColor.r,this.vignetteColor.g,this.vignetteColor.b,qt)}}if(we.setFloat("exposureLinear",this.exposure),we.setFloat("contrast",this.contrast),this.colorGradingTexture){we.setTexture("txColorTransform",this.colorGradingTexture);const nt=this.colorGradingTexture.getSize().height;we.setFloat4("colorTransformSettings",(nt-1)/nt,.5/nt,nt,this.colorGradingTexture.level)}}clone(){return li.Clone(()=>new s,this)}serialize(){return li.Serialize(this)}static get VIGNETTEMODE_MULTIPLY(){return this._VIGNETTEMODE_MULTIPLY}static get VIGNETTEMODE_OPAQUE(){return this._VIGNETTEMODE_OPAQUE}},(()=>{const ot=typeof Symbol=="function"&&Symbol.metadata?Object.create(null):void 0;e=[Fke()],r=[se()],o=[Ur("colorGradingTexture")],u=[se()],f=[se()],_=[se()],S=[se()],I=[se()],P=[se()],k=[se()],ne=[se()],Y=[se()],j=[se()],$=[se()],ve=[K5()],de=[se()],Oe=[se()],tt=[se()],at=[se()],Xe=[se()],Ye=[se()],Vt=[se()],Wt=[se()],ct=[se()],mi=[se()],F(null,null,e,{kind:"field",name:"colorCurves",static:!1,private:!1,access:{has:we=>"colorCurves"in we,get:we=>we.colorCurves,set:(we,be)=>{we.colorCurves=be}},metadata:ot},t,i),F(null,null,r,{kind:"field",name:"_colorCurvesEnabled",static:!1,private:!1,access:{has:we=>"_colorCurvesEnabled"in we,get:we=>we._colorCurvesEnabled,set:(we,be)=>{we._colorCurvesEnabled=be}},metadata:ot},n,a),F(null,null,o,{kind:"field",name:"_colorGradingTexture",static:!1,private:!1,access:{has:we=>"_colorGradingTexture"in we,get:we=>we._colorGradingTexture,set:(we,be)=>{we._colorGradingTexture=be}},metadata:ot},l,c),F(null,null,u,{kind:"field",name:"_colorGradingEnabled",static:!1,private:!1,access:{has:we=>"_colorGradingEnabled"in we,get:we=>we._colorGradingEnabled,set:(we,be)=>{we._colorGradingEnabled=be}},metadata:ot},h,d),F(null,null,f,{kind:"field",name:"_colorGradingWithGreenDepth",static:!1,private:!1,access:{has:we=>"_colorGradingWithGreenDepth"in we,get:we=>we._colorGradingWithGreenDepth,set:(we,be)=>{we._colorGradingWithGreenDepth=be}},metadata:ot},m,p),F(null,null,_,{kind:"field",name:"_colorGradingBGR",static:!1,private:!1,access:{has:we=>"_colorGradingBGR"in we,get:we=>we._colorGradingBGR,set:(we,be)=>{we._colorGradingBGR=be}},metadata:ot},v,x),F(null,null,S,{kind:"field",name:"_exposure",static:!1,private:!1,access:{has:we=>"_exposure"in we,get:we=>we._exposure,set:(we,be)=>{we._exposure=be}},metadata:ot},b,y),F(null,null,I,{kind:"field",name:"_toneMappingEnabled",static:!1,private:!1,access:{has:we=>"_toneMappingEnabled"in we,get:we=>we._toneMappingEnabled,set:(we,be)=>{we._toneMappingEnabled=be}},metadata:ot},R,A),F(null,null,P,{kind:"field",name:"_toneMappingType",static:!1,private:!1,access:{has:we=>"_toneMappingType"in we,get:we=>we._toneMappingType,set:(we,be)=>{we._toneMappingType=be}},metadata:ot},w,L),F(null,null,k,{kind:"field",name:"_contrast",static:!1,private:!1,access:{has:we=>"_contrast"in we,get:we=>we._contrast,set:(we,be)=>{we._contrast=be}},metadata:ot},V,U),F(null,null,ne,{kind:"field",name:"vignetteStretch",static:!1,private:!1,access:{has:we=>"vignetteStretch"in we,get:we=>we.vignetteStretch,set:(we,be)=>{we.vignetteStretch=be}},metadata:ot},oe,le),F(null,null,Y,{kind:"field",name:"vignetteCenterX",static:!1,private:!1,access:{has:we=>"vignetteCenterX"in we,get:we=>we.vignetteCenterX,set:(we,be)=>{we.vignetteCenterX=be}},metadata:ot},te,Z),F(null,null,j,{kind:"field",name:"vignetteCenterY",static:!1,private:!1,access:{has:we=>"vignetteCenterY"in we,get:we=>we.vignetteCenterY,set:(we,be)=>{we.vignetteCenterY=be}},metadata:ot},G,J),F(null,null,$,{kind:"field",name:"vignetteWeight",static:!1,private:!1,access:{has:we=>"vignetteWeight"in we,get:we=>we.vignetteWeight,set:(we,be)=>{we.vignetteWeight=be}},metadata:ot},re,ie),F(null,null,ve,{kind:"field",name:"vignetteColor",static:!1,private:!1,access:{has:we=>"vignetteColor"in we,get:we=>we.vignetteColor,set:(we,be)=>{we.vignetteColor=be}},metadata:ot},Re,Ie),F(null,null,de,{kind:"field",name:"vignetteCameraFov",static:!1,private:!1,access:{has:we=>"vignetteCameraFov"in we,get:we=>we.vignetteCameraFov,set:(we,be)=>{we.vignetteCameraFov=be}},metadata:ot},q,pe),F(null,null,Oe,{kind:"field",name:"_vignetteBlendMode",static:!1,private:!1,access:{has:we=>"_vignetteBlendMode"in we,get:we=>we._vignetteBlendMode,set:(we,be)=>{we._vignetteBlendMode=be}},metadata:ot},Me,Ve),F(null,null,tt,{kind:"field",name:"_vignetteEnabled",static:!1,private:!1,access:{has:we=>"_vignetteEnabled"in we,get:we=>we._vignetteEnabled,set:(we,be)=>{we._vignetteEnabled=be}},metadata:ot},lt,Ne),F(null,null,at,{kind:"field",name:"_ditheringEnabled",static:!1,private:!1,access:{has:we=>"_ditheringEnabled"in we,get:we=>we._ditheringEnabled,set:(we,be)=>{we._ditheringEnabled=be}},metadata:ot},Ee,me),F(null,null,Xe,{kind:"field",name:"_ditheringIntensity",static:!1,private:!1,access:{has:we=>"_ditheringIntensity"in we,get:we=>we._ditheringIntensity,set:(we,be)=>{we._ditheringIntensity=be}},metadata:ot},Fe,it),F(null,null,Ye,{kind:"field",name:"_skipFinalColorClamp",static:!1,private:!1,access:{has:we=>"_skipFinalColorClamp"in we,get:we=>we._skipFinalColorClamp,set:(we,be)=>{we._skipFinalColorClamp=be}},metadata:ot},Dt,Lt),F(null,null,Vt,{kind:"field",name:"_applyByPostProcess",static:!1,private:!1,access:{has:we=>"_applyByPostProcess"in we,get:we=>we._applyByPostProcess,set:(we,be)=>{we._applyByPostProcess=be}},metadata:ot},ai,Ft),F(null,null,Wt,{kind:"field",name:"_isEnabled",static:!1,private:!1,access:{has:we=>"_isEnabled"in we,get:we=>we._isEnabled,set:(we,be)=>{we._isEnabled=be}},metadata:ot},ri,he),F(null,null,ct,{kind:"field",name:"outputTextureWidth",static:!1,private:!1,access:{has:we=>"outputTextureWidth"in we,get:we=>we.outputTextureWidth,set:(we,be)=>{we.outputTextureWidth=be}},metadata:ot},Je,Nt),F(null,null,mi,{kind:"field",name:"outputTextureHeight",static:!1,private:!1,access:{has:we=>"outputTextureHeight"in we,get:we=>we.outputTextureHeight,set:(we,be)=>{we.outputTextureHeight=be}},metadata:ot},De,Ct),ot&&Object.defineProperty(s,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:ot})})(),s.TONEMAPPING_STANDARD=0,s.TONEMAPPING_ACES=1,s.TONEMAPPING_KHR_PBR_NEUTRAL=2,s.PrepareUniforms=I_e,s.PrepareSamplers=A_e,s._VIGNETTEMODE_MULTIPLY=0,s._VIGNETTEMODE_OPAQUE=1,s})(),yY=!1;function EY(s){const e=li.Parse(()=>new ta,s,null,null);return s.vignetteCentreX!==void 0&&(e.vignetteCenterX=s.vignetteCentreX),s.vignetteCentreY!==void 0&&(e.vignetteCenterY=s.vignetteCentreY),e}function qS(){yY||(yY=!0,ta.Parse=EY,li._ImageProcessingConfigurationParser=EY,Se("BABYLON.ImageProcessingConfiguration",ta))}class Ti{constructor(e,t,i=!1,r,n=!1,a){this._uniformNames=[],this._valueCache={},this._engine=e,this._noUBO=!e.supportsUniformBuffers||n,this._dynamic=i,this._name=r??"no-name",this._data=t||[],this._uniformLocations={},this._uniformSizes={},this._uniformArraySizes={},this._uniformLocationPointer=0,this._needSync=!1,this._trackUBOsInFrame=!1,(a===void 0&&this._engine._features.trackUbosInFrame||a===!0)&&(this._buffers=[],this._bufferIndex=-1,this._bufferUpdatedLastFrame=!1,this._createBufferOnWrite=!1,this._currentFrameId=0,this._trackUBOsInFrame=!0),this._noUBO?(this.updateMatrix3x3=this._updateMatrix3x3ForEffect,this.updateMatrix2x2=this._updateMatrix2x2ForEffect,this.updateFloat=this._updateFloatForEffect,this.updateFloat2=this._updateFloat2ForEffect,this.updateFloat3=this._updateFloat3ForEffect,this.updateFloat4=this._updateFloat4ForEffect,this.updateFloatArray=this._updateFloatArrayForEffect,this.updateArray=this._updateArrayForEffect,this.updateIntArray=this._updateIntArrayForEffect,this.updateUIntArray=this._updateUIntArrayForEffect,this.updateMatrix=this._updateMatrixForEffect,this.updateMatrices=this._updateMatricesForEffect,this.updateVector3=this._updateVector3ForEffect,this.updateVector4=this._updateVector4ForEffect,this.updateColor3=this._updateColor3ForEffect,this.updateColor4=this._updateColor4ForEffect,this.updateDirectColor4=this._updateDirectColor4ForEffect,this.updateInt=this._updateIntForEffect,this.updateInt2=this._updateInt2ForEffect,this.updateInt3=this._updateInt3ForEffect,this.updateInt4=this._updateInt4ForEffect,this.updateUInt=this._updateUIntForEffect,this.updateUInt2=this._updateUInt2ForEffect,this.updateUInt3=this._updateUInt3ForEffect,this.updateUInt4=this._updateUInt4ForEffect):(this._engine._uniformBuffers.push(this),this.updateMatrix3x3=this._updateMatrix3x3ForUniform,this.updateMatrix2x2=this._updateMatrix2x2ForUniform,this.updateFloat=this._updateFloatForUniform,this.updateFloat2=this._updateFloat2ForUniform,this.updateFloat3=this._updateFloat3ForUniform,this.updateFloat4=this._updateFloat4ForUniform,this.updateFloatArray=this._updateFloatArrayForUniform,this.updateArray=this._updateArrayForUniform,this.updateIntArray=this._updateIntArrayForUniform,this.updateUIntArray=this._updateUIntArrayForUniform,this.updateMatrix=this._updateMatrixForUniform,this.updateMatrices=this._updateMatricesForUniform,this.updateVector3=this._updateVector3ForUniform,this.updateVector4=this._updateVector4ForUniform,this.updateColor3=this._updateColor3ForUniform,this.updateColor4=this._updateColor4ForUniform,this.updateDirectColor4=this._updateDirectColor4ForUniform,this.updateInt=this._updateIntForUniform,this.updateInt2=this._updateInt2ForUniform,this.updateInt3=this._updateInt3ForUniform,this.updateInt4=this._updateInt4ForUniform,this.updateUInt=this._updateUIntForUniform,this.updateUInt2=this._updateUInt2ForUniform,this.updateUInt3=this._updateUInt3ForUniform,this.updateUInt4=this._updateUInt4ForUniform)}get useUbo(){return!this._noUBO}get isSync(){return!this._needSync}isDynamic(){return this._dynamic}getData(){return this._bufferData}getBuffer(){return this._buffer}getUniformNames(){return this._uniformNames}_fillAlignment(e){let t;if(e<=2?t=e:t=4,this._uniformLocationPointer%t!==0){const i=this._uniformLocationPointer;this._uniformLocationPointer+=t-this._uniformLocationPointer%t;const r=this._uniformLocationPointer-i;for(let n=0;n0&&typeof t=="number"&&(this._uniformArraySizes[e]={strideSize:t,arraySize:i}),this._uniformLocations[e]!==void 0||(this._uniformNames.push(e),this._noUBO))return;let r;if(i>0){if(t instanceof Array)throw"addUniform should not be use with Array in UBO: "+e;if(this._fillAlignment(4),t==16)t=t*i;else{const a=(4-t)*i;t=t*i+a}r=[];for(let n=0;n1&&this._buffers[this._bufferIndex][1])if(this._buffersEqual(this._bufferData,this._buffers[this._bufferIndex][1])){this._needSync=!1,this._createBufferOnWrite=this._trackUBOsInFrame;return}else this._copyBuffer(this._bufferData,this._buffers[this._bufferIndex][1]);this._bufferUpdatedLastFrame=!0,this._engine.updateUniformBuffer(this._buffer,this._bufferData),this._needSync=!1,this._createBufferOnWrite=this._trackUBOsInFrame}}_createNewBuffer(){this._bufferIndex+10?(this._buffers.length===1?this._needSync=!this._bufferUpdatedLastFrame:this._needSync=this._bufferIndex!==0,this._bufferIndex=0,this._buffer=this._buffers[this._bufferIndex][0]):this._bufferIndex=-1)}updateUniform(e,t,i){this._checkNewFrame();let r=this._uniformLocations[e];if(r===void 0){if(this._buffer){ye.Error("Cannot add an uniform after UBO has been created. uniformName="+e);return}this.addUniform(e,i),r=this._uniformLocations[e]}if(this._buffer||this.create(),this._dynamic)for(let n=0;n1&&this._buffers[t][1]&&this._bufferData.set(this._buffers[t][1]),this._valueCache={},this._currentFrameId=this._engine.frameId,!0;return!1}has(e){return this._uniformLocations[e]!==void 0}dispose(){if(this._noUBO)return;const e=this._engine._uniformBuffers,t=e.indexOf(this);if(t!==-1&&(e[t]=e[e.length-1],e.pop()),this._trackUBOsInFrame&&this._buffers)for(let i=0;i{r[i[f]]=d}),this._uniforms=r;let h;for(h=0;h{a[d]=f});for(const d of c.getAttributes(this,o))l.push(d)}dispose(){this._uniforms={},this._isDisposed=!0}_cacheMatrix(e,t){const i=this._valueCache[e],r=t.updateFlag;return i!==void 0&&i===r?!1:(this._valueCache[e]=r,!0)}_cacheFloat2(e,t,i){let r=this._valueCache[e];if(!r||r.length!==2)return r=[t,i],this._valueCache[e]=r,!0;let n=!1;return r[0]!==t&&(r[0]=t,n=!0),r[1]!==i&&(r[1]=i,n=!0),n}_cacheFloat3(e,t,i,r){let n=this._valueCache[e];if(!n||n.length!==3)return n=[t,i,r],this._valueCache[e]=n,!0;let a=!1;return n[0]!==t&&(n[0]=t,a=!0),n[1]!==i&&(n[1]=i,a=!0),n[2]!==r&&(n[2]=r,a=!0),a}_cacheFloat4(e,t,i,r,n){let a=this._valueCache[e];if(!a||a.length!==4)return a=[t,i,r,n],this._valueCache[e]=a,!0;let o=!1;return a[0]!==t&&(a[0]=t,o=!0),a[1]!==i&&(a[1]=i,o=!0),a[2]!==r&&(a[2]=r,o=!0),a[3]!==n&&(a[3]=n,o=!0),o}setInt(e,t){const i=this._valueCache[e];i!==void 0&&i===t||this.engine.setInt(this._uniforms[e],t)&&(this._valueCache[e]=t)}setInt2(e,t,i){this._cacheFloat2(e,t,i)&&(this.engine.setInt2(this._uniforms[e],t,i)||(this._valueCache[e]=null))}setInt3(e,t,i,r){this._cacheFloat3(e,t,i,r)&&(this.engine.setInt3(this._uniforms[e],t,i,r)||(this._valueCache[e]=null))}setInt4(e,t,i,r,n){this._cacheFloat4(e,t,i,r,n)&&(this.engine.setInt4(this._uniforms[e],t,i,r,n)||(this._valueCache[e]=null))}setIntArray(e,t){this._valueCache[e]=null,this.engine.setIntArray(this._uniforms[e],t)}setIntArray2(e,t){this._valueCache[e]=null,this.engine.setIntArray2(this._uniforms[e],t)}setIntArray3(e,t){this._valueCache[e]=null,this.engine.setIntArray3(this._uniforms[e],t)}setIntArray4(e,t){this._valueCache[e]=null,this.engine.setIntArray4(this._uniforms[e],t)}setUInt(e,t){const i=this._valueCache[e];i!==void 0&&i===t||this.engine.setUInt(this._uniforms[e],t)&&(this._valueCache[e]=t)}setUInt2(e,t,i){this._cacheFloat2(e,t,i)&&(this.engine.setUInt2(this._uniforms[e],t,i)||(this._valueCache[e]=null))}setUInt3(e,t,i,r){this._cacheFloat3(e,t,i,r)&&(this.engine.setUInt3(this._uniforms[e],t,i,r)||(this._valueCache[e]=null))}setUInt4(e,t,i,r,n){this._cacheFloat4(e,t,i,r,n)&&(this.engine.setUInt4(this._uniforms[e],t,i,r,n)||(this._valueCache[e]=null))}setUIntArray(e,t){this._valueCache[e]=null,this.engine.setUIntArray(this._uniforms[e],t)}setUIntArray2(e,t){this._valueCache[e]=null,this.engine.setUIntArray2(this._uniforms[e],t)}setUIntArray3(e,t){this._valueCache[e]=null,this.engine.setUIntArray3(this._uniforms[e],t)}setUIntArray4(e,t){this._valueCache[e]=null,this.engine.setUIntArray4(this._uniforms[e],t)}setArray(e,t){this._valueCache[e]=null,this.engine.setArray(this._uniforms[e],t)}setArray2(e,t){this._valueCache[e]=null,this.engine.setArray2(this._uniforms[e],t)}setArray3(e,t){this._valueCache[e]=null,this.engine.setArray3(this._uniforms[e],t)}setArray4(e,t){this._valueCache[e]=null,this.engine.setArray4(this._uniforms[e],t)}setMatrices(e,t){t&&(this._valueCache[e]=null,this.engine.setMatrices(this._uniforms[e],t))}setMatrix(e,t){this._cacheMatrix(e,t)&&(this.engine.setMatrices(this._uniforms[e],t.asArray())||(this._valueCache[e]=null))}setMatrix3x3(e,t){this._valueCache[e]=null,this.engine.setMatrix3x3(this._uniforms[e],t)}setMatrix2x2(e,t){this._valueCache[e]=null,this.engine.setMatrix2x2(this._uniforms[e],t)}setFloat(e,t){const i=this._valueCache[e];i!==void 0&&i===t||this.engine.setFloat(this._uniforms[e],t)&&(this._valueCache[e]=t)}setVector2(e,t){this._cacheFloat2(e,t.x,t.y)&&(this.engine.setFloat2(this._uniforms[e],t.x,t.y)||(this._valueCache[e]=null))}setFloat2(e,t,i){this._cacheFloat2(e,t,i)&&(this.engine.setFloat2(this._uniforms[e],t,i)||(this._valueCache[e]=null))}setVector3(e,t){this._cacheFloat3(e,t.x,t.y,t.z)&&(this.engine.setFloat3(this._uniforms[e],t.x,t.y,t.z)||(this._valueCache[e]=null))}setFloat3(e,t,i,r){this._cacheFloat3(e,t,i,r)&&(this.engine.setFloat3(this._uniforms[e],t,i,r)||(this._valueCache[e]=null))}setVector4(e,t){this._cacheFloat4(e,t.x,t.y,t.z,t.w)&&(this.engine.setFloat4(this._uniforms[e],t.x,t.y,t.z,t.w)||(this._valueCache[e]=null))}setQuaternion(e,t){this._cacheFloat4(e,t.x,t.y,t.z,t.w)&&(this.engine.setFloat4(this._uniforms[e],t.x,t.y,t.z,t.w)||(this._valueCache[e]=null))}setFloat4(e,t,i,r,n){this._cacheFloat4(e,t,i,r,n)&&(this.engine.setFloat4(this._uniforms[e],t,i,r,n)||(this._valueCache[e]=null))}setColor3(e,t){this._cacheFloat3(e,t.r,t.g,t.b)&&(this.engine.setFloat3(this._uniforms[e],t.r,t.g,t.b)||(this._valueCache[e]=null))}setColor4(e,t,i){this._cacheFloat4(e,t.r,t.g,t.b,i)&&(this.engine.setFloat4(this._uniforms[e],t.r,t.g,t.b,i)||(this._valueCache[e]=null))}setDirectColor4(e,t){this._cacheFloat4(e,t.r,t.g,t.b,t.a)&&(this.engine.setFloat4(this._uniforms[e],t.r,t.g,t.b,t.a)||(this._valueCache[e]=null))}_getVertexShaderCode(){return this.vertexShader?this.engine._getShaderSource(this.vertexShader):null}_getFragmentShaderCode(){return this.fragmentShader?this.engine._getShaderSource(this.fragmentShader):null}}const s2=new WeakMap,OVe={_webGLVersion:2,cachedPipelines:{}};function qd(s){let e=s2.get(s);if(!e){if(!s)return OVe;e={_webGLVersion:s.TEXTURE_BINDING_3D?2:1,_context:s,parallelShaderCompile:s.getExtension("KHR_parallel_shader_compile")||void 0,cachedPipelines:{}},s2.set(s,e)}return e}function H1(s){s2.delete(s)}function P_e(s,e,t,i,r,n){const a=qd(i);n||(n=a._createShaderProgramInjection??oj);const o=n2(e,"vertex",i,a._contextWasLost),l=n2(t,"fragment",i,a._contextWasLost);return n(s,o,l,i,r,a.validateShaderPrograms)}function M_e(s,e,t,i,r,n=null,a){const o=qd(r);a||(a=o._createShaderProgramInjection??oj);const l=o._webGLVersion>1?`#version 300 es
000556: #define WEBGL2
000557: `:"",c=CY(e,"vertex",i,l,r,o._contextWasLost),u=CY(t,"fragment",i,l,r,o._contextWasLost);return a(s,c,u,r,n,o.validateShaderPrograms)}function wVe(s,e){const t=new DVe,i=qd(s);return i.parallelShaderCompile&&!i.disableParallelShaderCompile&&(t.isParallelCompiled=!0),t.context=i._context,t}function oj(s,e,t,i,r=null,n){const a=i.createProgram();if(s.program=a,!a)throw new Error("Unable to create program");return i.attachShader(a,e),i.attachShader(a,t),i.linkProgram(a),s.context=i,s.vertexShader=e,s.fragmentShader=t,s.isParallelCompiled||lj(s,i,n),a}function NVe(s,e,t){const i=s;if(i._isDisposed)return!1;const r=qd(e);return r&&r.parallelShaderCompile&&r.parallelShaderCompile.COMPLETION_STATUS_KHR&&i.program&&e.getProgramParameter(i.program,r.parallelShaderCompile.COMPLETION_STATUS_KHR)?(lj(i,e,t),!0):!1}function lj(s,e,t){const i=s.context,r=s.vertexShader,n=s.fragmentShader,a=s.program;if(!i.getProgramParameter(a,i.LINK_STATUS)){if(!e.getShaderParameter(r,e.COMPILE_STATUS)){const c=e.getShaderInfoLog(r);if(c)throw s.vertexCompilationError=c,new Error("VERTEX SHADER "+c)}if(!e.getShaderParameter(n,e.COMPILE_STATUS)){const c=e.getShaderInfoLog(n);if(c)throw s.fragmentCompilationError=c,new Error("FRAGMENT SHADER "+c)}const l=i.getProgramInfoLog(a);if(l)throw s.programLinkError=l,new Error(l)}if(t&&(i.validateProgram(a),!i.getProgramParameter(a,i.VALIDATE_STATUS))){const c=i.getProgramInfoLog(a);if(c)throw s.programValidationError=c,new Error(c)}i.deleteShader(r),i.deleteShader(n),s.vertexShader=void 0,s.fragmentShader=void 0,s.onCompiled&&(s.onCompiled(),s.onCompiled=void 0)}function LVe(s,e,t,i,r,n,a,o,l,c="",u,h,d){const f=qd(s.context);h||(h=f.createRawShaderProgramInjection??P_e),d||(d=f.createShaderProgramInjection??M_e);const m=s;i?m.program=h(m,e,t,m.context,l):m.program=d(m,e,t,o,m.context,l),m.program.__SPECTOR_rebuildProgram=a,u()}function CY(s,e,t,i,r,n){return n2(u_e(s,t,i),e,r,n)}function n2(s,e,t,i){const r=t.createShader(e==="vertex"?t.VERTEX_SHADER:t.FRAGMENT_SHADER);if(!r){let n=t.NO_ERROR,a;for(;(a=t.getError())!==t.NO_ERROR;)n=a;throw new Error(`Something went wrong while creating a gl ${e} shader object. gl error=${n}, gl isContextLost=${t.isContextLost()}, _contextWasLost=${i}`)}return t.shaderSource(r,s),t.compileShader(r),r}function FVe(s,e){e.useProgram(s)}function BVe(s,e){const t=s;if(!t.isParallelCompiled){e(s);return}const i=t.onCompiled;t.onCompiled=()=>{i==null||i(),e(s)}}function kVe(s,e){return qd(e).cachedPipelines[s]}function cj(s){const e=s._name,t=s.context;if(e&&t){const i=qd(t),r=i.cachedPipelines[e];r==null||r.dispose(),delete i.cachedPipelines[e]}}function VVe(s,e,t,i,r,n,a){let o,l;const c=yl()?n==null?void 0:n.getHostDocument():null;typeof e=="string"?o=e:typeof e.vertexSource=="string"?o="source:"+e.vertexSource:typeof e.vertexElement=="string"?o=(c==null?void 0:c.getElementById(e.vertexElement))||e.vertexElement:o=e.vertex||e,typeof e=="string"?l=e:typeof e.fragmentSource=="string"?l="source:"+e.fragmentSource:typeof e.fragmentElement=="string"?l=(c==null?void 0:c.getElementById(e.fragmentElement))||e.fragmentElement:l=e.fragment||e;const u=[void 0,void 0],h=()=>{if(u[0]&&u[1]){const[d,f]=u;ej(s),$R(d,s,(m,p)=>{a&&(a._vertexSourceCodeBeforeMigration=p),t&&(m=t("vertex",m)),s.isFragment=!0,$R(f,s,(_,v)=>{a&&(a._fragmentSourceCodeBeforeMigration=v),t&&(_=t("fragment",_));const x=tj(m,_,s);s=null;const S=UVe(x.vertexCode,x.fragmentCode,e,r);i==null||i(S.vertexSourceCode,S.fragmentSourceCode)},n)},n)}};RY(o,"Vertex","",d=>{a&&(a._rawVertexSourceCode=d),u[0]=d,h()},r),RY(l,"Fragment","Pixel",d=>{a&&(a._rawFragmentSourceCode=d),u[1]=d,h()},r)}function RY(s,e,t,i,r,n){if(typeof HTMLElement<"u"&&s instanceof HTMLElement){const l=J5(s);i(l);return}if(s.substring(0,7)==="source:"){i(s.substring(7));return}if(s.substring(0,7)==="base64:"){const l=window.atob(s.substring(7));i(l);return}const a=N.GetShadersStore(r);if(a[s+e+"Shader"]){i(a[s+e+"Shader"]);return}if(t&&a[s+t+"Shader"]){i(a[s+t+"Shader"]);return}let o;if(s[0]==="."||s[0]==="/"||s.indexOf("http")>-1?o=s:o=N.GetShadersRepository(r)+s,n=n||h_e,!n)throw new Error("loadFileInjection is not defined");n(o+"."+e.toLowerCase()+".fx",i)}function UVe(s,e,t,i){if(t){const r=t.vertexElement||t.vertex||t.spectorName||t,n=t.fragmentElement||t.fragment||t.spectorName||t;return{vertexSourceCode:(i===1?"//":"")+"#define SHADER_NAME vertex:"+r+`
000558: `+s,fragmentSourceCode:(i===1?"//":"")+"#define SHADER_NAME fragment:"+n+`
000559: `+e}}else return{vertexSourceCode:s,fragmentSourceCode:e}}const GVe=(s,e,t,i)=>{try{const r=s.context?qd(s.context):null;r&&(r.disableParallelShaderCompile=s.disableParallelCompilation);const n=s.existingPipelineContext||e(s.shaderProcessingContext);return n._name=s.name,s.name&&r&&(r.cachedPipelines[s.name]=n),t(n,s.vertex,s.fragment,!!s.createAsRaw,"","",s.rebuildRebind,s.defines,s.transformFeedbackVaryings,"",()=>{i(n,()=>{var a;(a=s.onRenderingStateCompiled)==null||a.call(s,n)})}),n}catch(r){throw ye.Error("Error compiling effect"),r}};class Xs{static get ShadersRepository(){return N.ShadersRepository}static set ShadersRepository(e){N.ShadersRepository=e}get isDisposed(){return this._isDisposed}get onBindObservable(){return this._onBindObservable||(this._onBindObservable=new Ge),this._onBindObservable}get shaderLanguage(){return this._shaderLanguage}constructor(e,t,i,r=null,n,a=null,o=null,l=null,c=null,u,h="",d=0,f){this.defines="",this.onCompiled=null,this.onError=null,this.onBind=null,this.uniqueId=0,this.onCompileObservable=new Ge,this.onErrorObservable=new Ge,this._onBindObservable=null,this._isDisposed=!1,this._refCount=1,this._bonesComputationForcedToCPU=!1,this._uniformBuffersNames={},this._multiTarget=!1,this._samplers={},this._isReady=!1,this._compilationError="",this._allFallbacksProcessed=!1,this._uniforms={},this._key="",this._fallbacks=null,this._vertexSourceCodeOverride="",this._fragmentSourceCodeOverride="",this._transformFeedbackVaryings=null,this._disableParallelShaderCompilation=!1,this._pipelineContext=null,this._vertexSourceCode="",this._fragmentSourceCode="",this._vertexSourceCodeBeforeMigration="",this._fragmentSourceCodeBeforeMigration="",this._rawVertexSourceCode="",this._rawFragmentSourceCode="",this._processCodeAfterIncludes=void 0,this._processFinalCode=null,this._onReleaseEffectsObserver=null,this.name=e,this._key=h;const m=this._key.replace(/\r/g,"").replace(/\n/g,"|");let p;if(t.attributes){const _=t;if(this._engine=i,this._attributesNames=_.attributes,this._uniformsNames=_.uniformsNames.concat(_.samplers),this._samplerList=_.samplers.slice(),this.defines=_.defines,this.onError=_.onError,this.onCompiled=_.onCompiled,this._fallbacks=_.fallbacks,this._indexParameters=_.indexParameters,this._transformFeedbackVaryings=_.transformFeedbackVaryings||null,this._multiTarget=!!_.multiTarget,this._shaderLanguage=_.shaderLanguage??0,this._disableParallelShaderCompilation=!!_.disableParallelShaderCompilation,_.uniformBuffersNames){this._uniformBuffersNamesList=_.uniformBuffersNames.slice();for(let v=0;v<_.uniformBuffersNames.length;v++)this._uniformBuffersNames[_.uniformBuffersNames[v]]=v}this._processFinalCode=_.processFinalCode??null,this._processCodeAfterIncludes=_.processCodeAfterIncludes??void 0,f=_.extraInitializationsAsync,p=_.existingPipelineContext}else this._engine=n,this.defines=a??"",this._uniformsNames=i.concat(r),this._samplerList=r?r.slice():[],this._attributesNames=t,this._uniformBuffersNamesList=[],this._shaderLanguage=d,this.onError=c,this.onCompiled=l,this._indexParameters=u,this._fallbacks=o;this._engine.shaderPlatformName==="WEBGL2"&&(p=kVe(m,this._engine._gl)??p),this._attributeLocationByName={},this.uniqueId=Xs._UniqueIdSeed++,p?(this._pipelineContext=p,this._pipelineContext.setEngine(this._engine),this._onRenderingStateCompiled(this._pipelineContext),this._pipelineContext.program&&(this._pipelineContext.program.__SPECTOR_rebuildProgram=this._rebuildProgram.bind(this))):this._processShaderCodeAsync(null,!1,null,f).catch(_=>{const v=(_==null?void 0:_.message)??String(_),x=new Error(`Effect async shader preparation failed for "${String(this.name)}": ${v}`);_&&typeof _.stack=="string"&&(x.stack=`${x.message}
LISTENER CONTEXT 543-567
000543: */const gBe=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],m0=Fi("X",gBe),vBe=(s,e)=>{const t=new Array(s.length+e.length);for(let i=0;i({classGroupId:s,validator:e}),lme=(s=new Map,e=null,t)=>({nextPart:s,validators:e,classGroupId:t}),tO="-",H8=[],SBe="arbitrary..",bBe=s=>{const e=yBe(s),{conflictingClassGroups:t,conflictingClassGroupModifiers:i}=s;return{getClassGroupId:a=>{if(a.startsWith("[")&&a.endsWith("]"))return TBe(a);const o=a.split(tO),l=o[0]===""&&o.length>1?1:0;return cme(o,l,e)},getConflictingClassGroupIds:(a,o)=>{if(o){const l=i[a],c=t[a];return l?c?vBe(c,l):l:c||H8}return t[a]||H8}}},cme=(s,e,t)=>{if(s.length-e===0)return t.classGroupId;const r=s[e],n=t.nextPart.get(r);if(n){const c=cme(s,e+1,n);if(c)return c}const a=t.validators;if(a===null)return;const o=e===0?s.join(tO):s.slice(e).join(tO),l=a.length;for(let c=0;cs.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const e=s.slice(1,-1),t=e.indexOf(":"),i=e.slice(0,t);return i?SBe+i:void 0})(),yBe=s=>{const{theme:e,classGroups:t}=s;return EBe(t,e)},EBe=(s,e)=>{const t=lme();for(const i in s){const r=s[i];U5(r,t,i,e)}return t},U5=(s,e,t,i)=>{const r=s.length;for(let n=0;n{if(typeof s=="string"){RBe(s,e,t);return}if(typeof s=="function"){IBe(s,e,t,i);return}ABe(s,e,t,i)},RBe=(s,e,t)=>{const i=s===""?e:ume(e,s);i.classGroupId=t},IBe=(s,e,t,i)=>{if(PBe(s)){U5(s(i),e,t,i);return}e.validators===null&&(e.validators=[]),e.validators.push(xBe(t,s))},ABe=(s,e,t,i)=>{const r=Object.entries(s),n=r.length;for(let a=0;a{let t=s;const i=e.split(tO),r=i.length;for(let n=0;n"isThemeGetter"in s&&s.isThemeGetter===!0,MBe=s=>{if(s<1)return{get:()=>{},set:()=>{}};let e=0,t=Object.create(null),i=Object.create(null);const r=(n,a)=>{t[n]=a,e++,e>s&&(e=0,i=t,t=Object.create(null))};return{get(n){let a=t[n];if(a!==void 0)return a;if((a=i[n])!==void 0)return r(n,a),a},set(n,a){n in t?t[n]=a:r(n,a)}}},qF="!",j8=":",DBe=[],X8=(s,e,t,i,r)=>({modifiers:s,hasImportantModifier:e,baseClassName:t,maybePostfixModifierPosition:i,isExternal:r}),OBe=s=>{const{prefix:e,experimentalParseClassName:t}=s;let i=r=>{const n=[];let a=0,o=0,l=0,c;const u=r.length;for(let p=0;pl?c-l:void 0;return X8(n,f,d,m)};if(e){const r=e+j8,n=i;i=a=>a.startsWith(r)?n(a.slice(r.length)):X8(DBe,!1,a,void 0,!0)}if(t){const r=i;i=n=>t({className:n,parseClassName:r})}return i},wBe=s=>{const e=new Map;return s.orderSensitiveModifiers.forEach((t,i)=>{e.set(t,1e6+i)}),t=>{const i=[];let r=[];for(let n=0;n0&&(r.sort(),i.push(...r),r=[]),i.push(a)):r.push(a)}return r.length>0&&(r.sort(),i.push(...r)),i}},NBe=s=>({cache:MBe(s.cacheSize),parseClassName:OBe(s),sortModifiers:wBe(s),...bBe(s)}),LBe=/\s+/,FBe=(s,e)=>{const{parseClassName:t,getClassGroupId:i,getConflictingClassGroupIds:r,sortModifiers:n}=e,a=[],o=s.trim().split(LBe);let l="";for(let c=o.length-1;c>=0;c-=1){const u=o[c],{isExternal:h,modifiers:d,hasImportantModifier:f,baseClassName:m,maybePostfixModifierPosition:p}=t(u);if(h){l=u+(l.length>0?" "+l:l);continue}let _=!!p,v=i(_?m.substring(0,p):m);if(!v){if(!_){l=u+(l.length>0?" "+l:l);continue}if(v=i(m),!v){l=u+(l.length>0?" "+l:l);continue}_=!1}const x=d.length===0?"":d.length===1?d[0]:n(d).join(":"),S=f?x+qF:x,b=S+v;if(a.indexOf(b)>-1)continue;a.push(b);const y=r(v,_);for(let I=0;I0?" "+l:l)}return l},BBe=(...s)=>{let e=0,t,i,r="";for(;e{if(typeof s=="string")return s;let e,t="";for(let i=0;i{let t,i,r,n;const a=l=>{const c=e.reduce((u,h)=>h(u),s());return t=NBe(c),i=t.cache.get,r=t.cache.set,n=o,o(l)},o=l=>{const c=i(l);if(c)return c;const u=FBe(l,t);return r(l,u),u};return n=a,(...l)=>n(BBe(...l))},VBe=[],Pc=s=>{const e=t=>t[s]||VBe;return e.isThemeGetter=!0,e},dme=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,fme=/^\((?:(\w[\w-]*):)?(.+)\)$/i,UBe=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,GBe=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,zBe=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,WBe=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,HBe=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,jBe=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Ix=s=>UBe.test(s),qs=s=>!!s&&!Number.isNaN(Number(s)),Ax=s=>!!s&&Number.isInteger(Number(s)),V1=s=>s.endsWith("%")&&qs(s.slice(0,-1)),Xg=s=>GBe.test(s),pme=()=>!0,XBe=s=>zBe.test(s)&&!WBe.test(s),G5=()=>!1,$Be=s=>HBe.test(s),YBe=s=>jBe.test(s),qBe=s=>!Sr(s)&&!Tr(s),ZBe=s=>XS(s,gme,G5),Sr=s=>dme.test(s),Eb=s=>XS(s,vme,XBe),$8=s=>XS(s,s3e,qs),KBe=s=>XS(s,Sme,pme),QBe=s=>XS(s,xme,G5),Y8=s=>XS(s,mme,G5),JBe=s=>XS(s,_me,YBe),UP=s=>XS(s,bme,$Be),Tr=s=>fme.test(s),yC=s=>oy(s,vme),e3e=s=>oy(s,xme),q8=s=>oy(s,mme),t3e=s=>oy(s,gme),i3e=s=>oy(s,_me),GP=s=>oy(s,bme,!0),r3e=s=>oy(s,Sme,!0),XS=(s,e,t)=>{const i=dme.exec(s);return i?i[1]?e(i[1]):t(i[2]):!1},oy=(s,e,t=!1)=>{const i=fme.exec(s);return i?i[1]?e(i[1]):t:!1},mme=s=>s==="position"||s==="percentage",_me=s=>s==="image"||s==="url",gme=s=>s==="length"||s==="size"||s==="bg-size",vme=s=>s==="length",s3e=s=>s==="number",xme=s=>s==="family-name",Sme=s=>s==="number"||s==="weight",bme=s=>s==="shadow",n3e=()=>{const s=Pc("color"),e=Pc("font"),t=Pc("text"),i=Pc("font-weight"),r=Pc("tracking"),n=Pc("leading"),a=Pc("breakpoint"),o=Pc("container"),l=Pc("spacing"),c=Pc("radius"),u=Pc("shadow"),h=Pc("inset-shadow"),d=Pc("text-shadow"),f=Pc("drop-shadow"),m=Pc("blur"),p=Pc("perspective"),_=Pc("aspect"),v=Pc("ease"),x=Pc("animate"),S=()=>["auto","avoid","all","avoid-page","page","left","right","column"],b=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],y=()=>[...b(),Tr,Sr],I=()=>["auto","hidden","clip","visible","scroll"],R=()=>["auto","contain","none"],A=()=>[Tr,Sr,l],P=()=>[Ix,"full","auto",...A()],w=()=>[Ax,"none","subgrid",Tr,Sr],L=()=>["auto",{span:["full",Ax,Tr,Sr]},Ax,Tr,Sr],k=()=>[Ax,"auto",Tr,Sr],V=()=>["auto","min","max","fr",Tr,Sr],U=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],ne=()=>["start","end","center","stretch","center-safe","end-safe"],oe=()=>["auto",...A()],le=()=>[Ix,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...A()],Y=()=>[Ix,"screen","full","dvw","lvw","svw","min","max","fit",...A()],te=()=>[Ix,"screen","full","lh","dvh","lvh","svh","min","max","fit",...A()],Z=()=>[s,Tr,Sr],j=()=>[...b(),q8,Y8,{position:[Tr,Sr]}],G=()=>["no-repeat",{repeat:["","x","y","space","round"]}],J=()=>["auto","cover","contain",t3e,ZBe,{size:[Tr,Sr]}],$=()=>[V1,yC,Eb],re=()=>["","none","full",c,Tr,Sr],ie=()=>["",qs,yC,Eb],ve=()=>["solid","dashed","dotted","double"],Re=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],Ie=()=>[qs,V1,q8,Y8],de=()=>["","none",m,Tr,Sr],q=()=>["none",qs,Tr,Sr],pe=()=>["none",qs,Tr,Sr],Oe=()=>[qs,Tr,Sr],Me=()=>[Ix,"full",...A()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Xg],breakpoint:[Xg],color:[pme],container:[Xg],"drop-shadow":[Xg],ease:["in","out","in-out"],font:[qBe],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Xg],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Xg],shadow:[Xg],spacing:["px",qs],text:[Xg],"text-shadow":[Xg],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Ix,Sr,Tr,_]}],container:["container"],columns:[{columns:[qs,Sr,Tr,o]}],"break-after":[{"break-after":S()}],"break-before":[{"break-before":S()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:y()}],overflow:[{overflow:I()}],"overflow-x":[{"overflow-x":I()}],"overflow-y":[{"overflow-y":I()}],overscroll:[{overscroll:R()}],"overscroll-x":[{"overscroll-x":R()}],"overscroll-y":[{"overscroll-y":R()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:P()}],"inset-x":[{"inset-x":P()}],"inset-y":[{"inset-y":P()}],start:[{"inset-s":P(),start:P()}],end:[{"inset-e":P(),end:P()}],"inset-bs":[{"inset-bs":P()}],"inset-be":[{"inset-be":P()}],top:[{top:P()}],right:[{right:P()}],bottom:[{bottom:P()}],left:[{left:P()}],visibility:["visible","invisible","collapse"],z:[{z:[Ax,"auto",Tr,Sr]}],basis:[{basis:[Ix,"full","auto",o,...A()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[qs,Ix,"auto","initial","none",Sr]}],grow:[{grow:["",qs,Tr,Sr]}],shrink:[{shrink:["",qs,Tr,Sr]}],order:[{order:[Ax,"first","last","none",Tr,Sr]}],"grid-cols":[{"grid-cols":w()}],"col-start-end":[{col:L()}],"col-start":[{"col-start":k()}],"col-end":[{"col-end":k()}],"grid-rows":[{"grid-rows":w()}],"row-start-end":[{row:L()}],"row-start":[{"row-start":k()}],"row-end":[{"row-end":k()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":V()}],"auto-rows":[{"auto-rows":V()}],gap:[{gap:A()}],"gap-x":[{"gap-x":A()}],"gap-y":[{"gap-y":A()}],"justify-content":[{justify:[...U(),"normal"]}],"justify-items":[{"justify-items":[...ne(),"normal"]}],"justify-self":[{"justify-self":["auto",...ne()]}],"align-content":[{content:["normal",...U()]}],"align-items":[{items:[...ne(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...ne(),{baseline:["","last"]}]}],"place-content":[{"place-content":U()}],"place-items":[{"place-items":[...ne(),"baseline"]}],"place-self":[{"place-self":["auto",...ne()]}],p:[{p:A()}],px:[{px:A()}],py:[{py:A()}],ps:[{ps:A()}],pe:[{pe:A()}],pbs:[{pbs:A()}],pbe:[{pbe:A()}],pt:[{pt:A()}],pr:[{pr:A()}],pb:[{pb:A()}],pl:[{pl:A()}],m:[{m:oe()}],mx:[{mx:oe()}],my:[{my:oe()}],ms:[{ms:oe()}],me:[{me:oe()}],mbs:[{mbs:oe()}],mbe:[{mbe:oe()}],mt:[{mt:oe()}],mr:[{mr:oe()}],mb:[{mb:oe()}],ml:[{ml:oe()}],"space-x":[{"space-x":A()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":A()}],"space-y-reverse":["space-y-reverse"],size:[{size:le()}],"inline-size":[{inline:["auto",...Y()]}],"min-inline-size":[{"min-inline":["auto",...Y()]}],"max-inline-size":[{"max-inline":["none",...Y()]}],"block-size":[{block:["auto",...te()]}],"min-block-size":[{"min-block":["auto",...te()]}],"max-block-size":[{"max-block":["none",...te()]}],w:[{w:[o,"screen",...le()]}],"min-w":[{"min-w":[o,"screen","none",...le()]}],"max-w":[{"max-w":[o,"screen","none","prose",{screen:[a]},...le()]}],h:[{h:["screen","lh",...le()]}],"min-h":[{"min-h":["screen","lh","none",...le()]}],"max-h":[{"max-h":["screen","lh",...le()]}],"font-size":[{text:["base",t,yC,Eb]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[i,r3e,KBe]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",V1,Sr]}],"font-family":[{font:[e3e,QBe,e]}],"font-features":[{"font-features":[Sr]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[r,Tr,Sr]}],"line-clamp":[{"line-clamp":[qs,"none",Tr,$8]}],leading:[{leading:[n,...A()]}],"list-image":[{"list-image":["none",Tr,Sr]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Tr,Sr]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:Z()}],"text-color":[{text:Z()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...ve(),"wavy"]}],"text-decoration-thickness":[{decoration:[qs,"from-font","auto",Tr,Eb]}],"text-decoration-color":[{decoration:Z()}],"underline-offset":[{"underline-offset":[qs,"auto",Tr,Sr]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:A()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Tr,Sr]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Tr,Sr]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:j()}],"bg-repeat":[{bg:G()}],"bg-size":[{bg:J()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Ax,Tr,Sr],radial:["",Tr,Sr],conic:[Ax,Tr,Sr]},i3e,JBe]}],"bg-color":[{bg:Z()}],"gradient-from-pos":[{from:$()}],"gradient-via-pos":[{via:$()}],"gradient-to-pos":[{to:$()}],"gradient-from":[{from:Z()}],"gradient-via":[{via:Z()}],"gradient-to":[{to:Z()}],rounded:[{rounded:re()}],"rounded-s":[{"rounded-s":re()}],"rounded-e":[{"rounded-e":re()}],"rounded-t":[{"rounded-t":re()}],"rounded-r":[{"rounded-r":re()}],"rounded-b":[{"rounded-b":re()}],"rounded-l":[{"rounded-l":re()}],"rounded-ss":[{"rounded-ss":re()}],"rounded-se":[{"rounded-se":re()}],"rounded-ee":[{"rounded-ee":re()}],"rounded-es":[{"rounded-es":re()}],"rounded-tl":[{"rounded-tl":re()}],"rounded-tr":[{"rounded-tr":re()}],"rounded-br":[{"rounded-br":re()}],"rounded-bl":[{"rounded-bl":re()}],"border-w":[{border:ie()}],"border-w-x":[{"border-x":ie()}],"border-w-y":[{"border-y":ie()}],"border-w-s":[{"border-s":ie()}],"border-w-e":[{"border-e":ie()}],"border-w-bs":[{"border-bs":ie()}],"border-w-be":[{"border-be":ie()}],"border-w-t":[{"border-t":ie()}],"border-w-r":[{"border-r":ie()}],"border-w-b":[{"border-b":ie()}],"border-w-l":[{"border-l":ie()}],"divide-x":[{"divide-x":ie()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":ie()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...ve(),"hidden","none"]}],"divide-style":[{divide:[...ve(),"hidden","none"]}],"border-color":[{border:Z()}],"border-color-x":[{"border-x":Z()}],"border-color-y":[{"border-y":Z()}],"border-color-s":[{"border-s":Z()}],"border-color-e":[{"border-e":Z()}],"border-color-bs":[{"border-bs":Z()}],"border-color-be":[{"border-be":Z()}],"border-color-t":[{"border-t":Z()}],"border-color-r":[{"border-r":Z()}],"border-color-b":[{"border-b":Z()}],"border-color-l":[{"border-l":Z()}],"divide-color":[{divide:Z()}],"outline-style":[{outline:[...ve(),"none","hidden"]}],"outline-offset":[{"outline-offset":[qs,Tr,Sr]}],"outline-w":[{outline:["",qs,yC,Eb]}],"outline-color":[{outline:Z()}],shadow:[{shadow:["","none",u,GP,UP]}],"shadow-color":[{shadow:Z()}],"inset-shadow":[{"inset-shadow":["none",h,GP,UP]}],"inset-shadow-color":[{"inset-shadow":Z()}],"ring-w":[{ring:ie()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:Z()}],"ring-offset-w":[{"ring-offset":[qs,Eb]}],"ring-offset-color":[{"ring-offset":Z()}],"inset-ring-w":[{"inset-ring":ie()}],"inset-ring-color":[{"inset-ring":Z()}],"text-shadow":[{"text-shadow":["none",d,GP,UP]}],"text-shadow-color":[{"text-shadow":Z()}],opacity:[{opacity:[qs,Tr,Sr]}],"mix-blend":[{"mix-blend":[...Re(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":Re()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[qs]}],"mask-image-linear-from-pos":[{"mask-linear-from":Ie()}],"mask-image-linear-to-pos":[{"mask-linear-to":Ie()}],"mask-image-linear-from-color":[{"mask-linear-from":Z()}],"mask-image-linear-to-color":[{"mask-linear-to":Z()}],"mask-image-t-from-pos":[{"mask-t-from":Ie()}],"mask-image-t-to-pos":[{"mask-t-to":Ie()}],"mask-image-t-from-color":[{"mask-t-from":Z()}],"mask-image-t-to-color":[{"mask-t-to":Z()}],"mask-image-r-from-pos":[{"mask-r-from":Ie()}],"mask-image-r-to-pos":[{"mask-r-to":Ie()}],"mask-image-r-from-color":[{"mask-r-from":Z()}],"mask-image-r-to-color":[{"mask-r-to":Z()}],"mask-image-b-from-pos":[{"mask-b-from":Ie()}],"mask-image-b-to-pos":[{"mask-b-to":Ie()}],"mask-image-b-from-color":[{"mask-b-from":Z()}],"mask-image-b-to-color":[{"mask-b-to":Z()}],"mask-image-l-from-pos":[{"mask-l-from":Ie()}],"mask-image-l-to-pos":[{"mask-l-to":Ie()}],"mask-image-l-from-color":[{"mask-l-from":Z()}],"mask-image-l-to-color":[{"mask-l-to":Z()}],"mask-image-x-from-pos":[{"mask-x-from":Ie()}],"mask-image-x-to-pos":[{"mask-x-to":Ie()}],"mask-image-x-from-color":[{"mask-x-from":Z()}],"mask-image-x-to-color":[{"mask-x-to":Z()}],"mask-image-y-from-pos":[{"mask-y-from":Ie()}],"mask-image-y-to-pos":[{"mask-y-to":Ie()}],"mask-image-y-from-color":[{"mask-y-from":Z()}],"mask-image-y-to-color":[{"mask-y-to":Z()}],"mask-image-radial":[{"mask-radial":[Tr,Sr]}],"mask-image-radial-from-pos":[{"mask-radial-from":Ie()}],"mask-image-radial-to-pos":[{"mask-radial-to":Ie()}],"mask-image-radial-from-color":[{"mask-radial-from":Z()}],"mask-image-radial-to-color":[{"mask-radial-to":Z()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":b()}],"mask-image-conic-pos":[{"mask-conic":[qs]}],"mask-image-conic-from-pos":[{"mask-conic-from":Ie()}],"mask-image-conic-to-pos":[{"mask-conic-to":Ie()}],"mask-image-conic-from-color":[{"mask-conic-from":Z()}],"mask-image-conic-to-color":[{"mask-conic-to":Z()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:j()}],"mask-repeat":[{mask:G()}],"mask-size":[{mask:J()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Tr,Sr]}],filter:[{filter:["","none",Tr,Sr]}],blur:[{blur:de()}],brightness:[{brightness:[qs,Tr,Sr]}],contrast:[{contrast:[qs,Tr,Sr]}],"drop-shadow":[{"drop-shadow":["","none",f,GP,UP]}],"drop-shadow-color":[{"drop-shadow":Z()}],grayscale:[{grayscale:["",qs,Tr,Sr]}],"hue-rotate":[{"hue-rotate":[qs,Tr,Sr]}],invert:[{invert:["",qs,Tr,Sr]}],saturate:[{saturate:[qs,Tr,Sr]}],sepia:[{sepia:["",qs,Tr,Sr]}],"backdrop-filter":[{"backdrop-filter":["","none",Tr,Sr]}],"backdrop-blur":[{"backdrop-blur":de()}],"backdrop-brightness":[{"backdrop-brightness":[qs,Tr,Sr]}],"backdrop-contrast":[{"backdrop-contrast":[qs,Tr,Sr]}],"backdrop-grayscale":[{"backdrop-grayscale":["",qs,Tr,Sr]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[qs,Tr,Sr]}],"backdrop-invert":[{"backdrop-invert":["",qs,Tr,Sr]}],"backdrop-opacity":[{"backdrop-opacity":[qs,Tr,Sr]}],"backdrop-saturate":[{"backdrop-saturate":[qs,Tr,Sr]}],"backdrop-sepia":[{"backdrop-sepia":["",qs,Tr,Sr]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":A()}],"border-spacing-x":[{"border-spacing-x":A()}],"border-spacing-y":[{"border-spacing-y":A()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Tr,Sr]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[qs,"initial",Tr,Sr]}],ease:[{ease:["linear","initial",v,Tr,Sr]}],delay:[{delay:[qs,Tr,Sr]}],animate:[{animate:["none",x,Tr,Sr]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[p,Tr,Sr]}],"perspective-origin":[{"perspective-origin":y()}],rotate:[{rotate:q()}],"rotate-x":[{"rotate-x":q()}],"rotate-y":[{"rotate-y":q()}],"rotate-z":[{"rotate-z":q()}],scale:[{scale:pe()}],"scale-x":[{"scale-x":pe()}],"scale-y":[{"scale-y":pe()}],"scale-z":[{"scale-z":pe()}],"scale-3d":["scale-3d"],skew:[{skew:Oe()}],"skew-x":[{"skew-x":Oe()}],"skew-y":[{"skew-y":Oe()}],transform:[{transform:[Tr,Sr,"","none","gpu","cpu"]}],"transform-origin":[{origin:y()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Me()}],"translate-x":[{"translate-x":Me()}],"translate-y":[{"translate-y":Me()}],"translate-z":[{"translate-z":Me()}],"translate-none":["translate-none"],accent:[{accent:Z()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:Z()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Tr,Sr]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":A()}],"scroll-mx":[{"scroll-mx":A()}],"scroll-my":[{"scroll-my":A()}],"scroll-ms":[{"scroll-ms":A()}],"scroll-me":[{"scroll-me":A()}],"scroll-mbs":[{"scroll-mbs":A()}],"scroll-mbe":[{"scroll-mbe":A()}],"scroll-mt":[{"scroll-mt":A()}],"scroll-mr":[{"scroll-mr":A()}],"scroll-mb":[{"scroll-mb":A()}],"scroll-ml":[{"scroll-ml":A()}],"scroll-p":[{"scroll-p":A()}],"scroll-px":[{"scroll-px":A()}],"scroll-py":[{"scroll-py":A()}],"scroll-ps":[{"scroll-ps":A()}],"scroll-pe":[{"scroll-pe":A()}],"scroll-pbs":[{"scroll-pbs":A()}],"scroll-pbe":[{"scroll-pbe":A()}],"scroll-pt":[{"scroll-pt":A()}],"scroll-pr":[{"scroll-pr":A()}],"scroll-pb":[{"scroll-pb":A()}],"scroll-pl":[{"scroll-pl":A()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Tr,Sr]}],fill:[{fill:["none",...Z()]}],"stroke-w":[{stroke:[qs,yC,Eb,$8]}],stroke:[{stroke:["none",...Z()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},a3e=kBe(n3e);function ly(...s){return a3e(Xpe(s))}const Tme=Te.forwardRef(({...s},e)=>g.jsx("div",{ref:e,className:"fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]",...s}));Tme.displayName="ToastProvider";const yme=Te.forwardRef(({...s},e)=>g.jsx("div",{ref:e,className:"fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]",...s}));yme.displayName="ToastViewport";const o3e=HLe("group pointer-events-auto relative flex w-full items-center justify-between space-x-4 overflow-hidden rounded-md border p-6 pr-8 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full",{variants:{variant:{default:"border bg-background text-foreground",destructive:"destructive group border-destructive bg-destructive text-destructive-foreground"}},defaultVariants:{variant:"default"}}),Eme=Te.forwardRef(({className:s,variant:e,...t},i)=>g.jsx("div",{ref:i,className:ly(o3e({variant:e}),s),...t}));Eme.displayName="Toast";const l3e=Te.forwardRef(({className:s,...e},t)=>g.jsx("div",{ref:t,className:ly("inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium ring-offset-background transition-colors hover:bg-secondary focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive",s),...e}));l3e.displayName="ToastAction";const Cme=Te.forwardRef(({className:s,...e},t)=>g.jsx("button",{ref:t,className:ly("absolute right-2 top-2 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-2 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",s),"toast-close":"",...e,children:g.jsx(m0,{className:"h-4 w-4"})}));Cme.displayName="ToastClose";const Rme=Te.forwardRef(({className:s,...e},t)=>g.jsx("div",{ref:t,className:ly("text-sm font-semibold",s),...e}));Rme.displayName="ToastTitle";const Ime=Te.forwardRef(({className:s,...e},t)=>g.jsx("div",{ref:t,className:ly("text-sm opacity-90",s),...e}));Ime.displayName="ToastDescription";function c3e(){const{toasts:s}=WLe();return g.jsxs(Tme,{children:[s.map(function({id:e,title:t,description:i,action:r,...n}){return g.jsxs(Eme,{...n,children:[g.jsxs("div",{className:"grid gap-1",children:[t&&g.jsx(Rme,{children:t}),i&&g.jsx(Ime,{children:i})]}),r,g.jsx(Cme,{})]},e)}),g.jsx(yme,{})]})}const u3e=s=>{const e=s.slice(1);try{return decodeURIComponent(e)}catch{return e}};function h3e(){const{pathname:s,hash:e}=zS(),t=C1e();return Te.useEffect(()=>{if(t!=="POP"){if(e){const i=u3e(e),r=window.setTimeout(()=>{var n;(n=document.getElementById(i))==null||n.scrollIntoView({behavior:"smooth"})},50);return()=>window.clearTimeout(r)}window.scrollTo({top:0,left:0,behavior:"instant"})}},[s,e,t]),null}const d3e=[["Workshop 3D","/",YF],["Dashboard","/dashboard",tme],["Intake Requests","/intake-requests",o2e],["Customers","/customers",V5],["Cover Projects","/projects",KD],["New Cover","/new-cover",qpe],["Measurement Studio","/take-measurements",Yp],["Component Library","/components",YO],["Ossiguard Connectors","/ossiguard-connectors",p0],["Design Forge","/design-forge",z0],["Validation","/validation",Hv],["Quotes","/quotes",JD],["Orders","/orders",ame],["Manufacturing","/manufacturing",LFe],["Completed Covers","/completed-covers",tFe],["Shipping","/shipping",lBe],["Reports","/reports",Qpe],["Migration Readiness","/migration-readiness",CFe],["Settings","/settings",sme],["Lock Workshop","#lock",m2e]],f3e="/api/v1";async function jx(s,e={}){const t=await fetch(`${f3e}${s}`,{cache:"no-store",...e,headers:{...e.body instanceof FormData?{}:{"Content-Type":"application/json"},...e.headers||{}}});let i=null;try{i=await t.json()}catch{i=null}if(!t.ok){const r=new Error((i==null?void 0:i.error)||`Local SHiRE request failed (${t.status})`);throw r.status=t.status,r.data=i,r}return i}function p3e(s){return{async list(e="-updated_date",t=500){const i=new URLSearchParams({sort:e,limit:String(t)});return(await jx(`/collections/${encodeURIComponent(s)}?${i}`)).records||[]},async filter(e={},t="-updated_date",i=500){return(await jx(`/collections/${encodeURIComponent(s)}/filter`,{method:"POST",body:JSON.stringify({query:e,sort:t,limit:i})})).records||[]},async get(e){return(await jx(`/collections/${encodeURIComponent(s)}/${encodeURIComponent(e)}`)).record},async create(e){return(await jx(`/collections/${encodeURIComponent(s)}`,{method:"POST",body:JSON.stringify(e||{})})).record},async update(e,t){return(await jx(`/collections/${encodeURIComponent(s)}/${encodeURIComponent(e)}`,{method:"PATCH",body:JSON.stringify(t||{})})).record},async delete(e){return await jx(`/collections/${encodeURIComponent(s)}/${encodeURIComponent(e)}`,{method:"DELETE"})},async bulkCreate(e){return(await jx(`/collections/${encodeURIComponent(s)}/bulk-create`,{method:"POST",body:JSON.stringify({records:e||[]})})).records||[]},async bulkUpdate(e){const t=[];for(const i of e||[]){const r=i.id||i.uuid;if(!r)throw new Error(`bulkUpdate record in ${s} has no id or uuid`);t.push(await this.update(r,i))}return t}}}const m3e=new Proxy({},{get(s,e){return p3e(String(e))}}),EC={id:"shire-local-owner",email:"",full_name:"Ray",role:"owner_admin",roles:["owner_admin","admin","builder"],local_only:!0};async function _3e({file:s,destination:e="Uploads"}){if(!(s instanceof Blob))throw new Error("A valid file is required.");const t=await jx("/files",{method:"POST",body:s,headers:{"Content-Type":s.type||"application/octet-stream","X-SHiRE-Filename":s.name||"upload.bin","X-SHiRE-Destination":e}});return{file_url:t.file.location,...t.file}}function zP(s){return async()=>{throw new Error(`${s} is not connected to a native SHiRE engine yet.`)}}const W_={entities:m3e,auth:{me:async()=>EC,isAuthenticated:()=>!0,logout:()=>{},redirectToLogin:()=>{},loginViaEmailPassword:async()=>EC,loginWithProvider:async()=>EC,register:async()=>EC,verifyOtp:async()=>({access_token:"shire-local-session"}),resendOtp:async()=>({ok:!0}),resetPassword:async()=>({ok:!0}),resetPasswordRequest:async()=>({ok:!0}),setToken:()=>{},updateMe:async s=>({...EC,...s||{}})},functions:{invoke:zP("Local server function")},integrations:{Core:{UploadFile:_3e,GenerateImage:zP("Native image generation"),InvokeLLM:zP("Native SHiRE reasoning"),createAdaptationPreview:zP("Native CoverCanvas adaptation preview")}}},Cb=s=>W_.entities[s],g3e={list:(s,e="-updated_date",t=500)=>Cb(s).list(e,t),filter:(s,e,t="-updated_date",i=500)=>Cb(s).filter(e,t,i),get:(s,e)=>Cb(s).get(e),create:(s,e)=>Cb(s).create(e),update:(s,e,t)=>Cb(s).update(e,t),archive:(s,e)=>Cb(s).update(e,{record_state:"archived"}),restore:(s,e)=>Cb(s).update(e,{record_state:"active"})},v3e={currentUser:()=>W_.auth.me(),isAuthenticated:()=>W_.auth.isAuthenticated(),lock:()=>W_.auth.logout("/login")},x3e={async upload(s,e){const{file_url:t}=await W_.integrations.Core.UploadFile({file:s});return{location:t,destination:e,checksum:null,verified:!1,storage:"Base44 development storage"}}},S3e={async invoke(){throw new Error("Not yet implemented")}},Bt={database:g3e,auth:v3e,files:x3e,functions:S3e},b3e=()=>{const s=globalThis.crypto;if(s&&typeof s.randomUUID=="function")return s.randomUUID();if(!s||typeof s.getRandomValues!="function")throw new Error("Secure identifier generation is unavailable in this browser.");const e=new Uint8Array(16);s.getRandomValues(e),e[6]=e[6]&15|64,e[8]=e[8]&63|128;const t=Array.from(e,i=>i.toString(16).padStart(2,"0")).join("");return[t.slice(0,8),t.slice(8,12),t.slice(12,16),t.slice(16,20),t.slice(20)].join("-")},Ka=s=>`${s}-${b3e()}`,ho=(s="Workshop Owner")=>({created_by_name:s,updated_by_name:s,revision:1,record_state:"active",migration_version:1}),T3e={currentUser:()=>Bt.auth.currentUser(),isAuthenticated:()=>Bt.auth.isAuthenticated(),lockWorkshop:()=>Bt.auth.lock()};function y3e({onNavigate:s}){return g.jsx("nav",{"aria-label":"Workshop navigation",className:"space-y-1 px-3 pb-6",children:d3e.map(([e,t,i])=>t==="#lock"?g.jsxs("button",{onClick:()=>T3e.lockWorkshop(),className:"nav-link w-full",children:[g.jsx(i,{}),g.jsx("span",{children:e})]},e):g.jsxs(rLe,{to:t,onClick:s,className:({isActive:r})=>`nav-link ${r&&t!=="/not-implemented"?"nav-link-active":""}`,children:[g.jsx(i,{}),g.jsx("span",{children:e})]},e))})}const E3e={async search(s){const e=(s||"").toLowerCase().trim();if(!e)return[];const[t,i,r,n,a,o,l]=await Promise.all([Bt.database.list("Customer"),Bt.database.list("CoverProject"),Bt.database.list("Quote"),Bt.database.list("Order"),Bt.database.list("CompletedCover"),Bt.database.list("Prosthesis"),Bt.database.list("Shipment")]),c=[],u=h=>String(h||"").toLowerCase().includes(e);return t.forEach(h=>{(u(h.full_name)||u(h.customer_number)||u(h.email)||u(h.phone))&&c.push({type:"Customer",label:h.full_name,sub:h.customer_number,to:`/customers/${h.uuid}`,icon:"users"})}),i.forEach(h=>{(u(h.project_id)||u(h.prosthesis_configuration)||u(h.data_label))&&c.push({type:"Cover Project",label:h.project_id,sub:`Rev ${h.revision}`,to:`/projects/${h.uuid}`,icon:"folder"})}),r.forEach(h=>{u(h.quote_number)&&c.push({type:"Quote",label:h.quote_number,sub:h.approval_status,to:`/projects/${h.project_uuid}`,icon:"receipt"})}),n.forEach(h=>{u(h.order_number)&&c.push({type:"Order",label:h.order_number,sub:h.production_status,to:`/orders/${h.uuid}`,icon:"cart"})}),a.forEach(h=>{(u(h.cover_reference)||u(h.design_name))&&c.push({type:"Completed Cover",label:h.cover_reference,sub:h.design_name,to:`/completed-covers/${h.uuid}`,icon:"shield"})}),o.forEach(h=>{(u(h.manufacturer)||u(h.model))&&c.push({type:"Prosthesis",label:`${h.manufacturer} ${h.model}`,sub:h.name,to:`/customers/${h.customer_uuid}`,icon:"box"})}),l.forEach(h=>{(u(h.tracking_number)||u(h.shipment_reference))&&c.push({type:"Shipment",label:h.shipment_reference,sub:h.tracking_number,to:`/orders/${h.order_uuid}`,icon:"truck"})}),c.slice(0,30)}};function C3e(){const[s,e]=Te.useState(""),[t,i]=Te.useState([]),[r,n]=Te.useState(!1),a=Qm();Te.useEffect(()=>{let l=!0;if(!s.trim()){i([]);return}const c=setTimeout(async()=>{const u=await E3e.search(s);l&&(i(u),n(!0))},250);return()=>{l=!1,clearTimeout(c)}},[s]);const o=l=>{n(!1),e(""),a(l.to)};return g.jsxs("div",{className:"relative px-3 pb-2",children:[g.jsxs("div",{className:"relative",children:[g.jsx(jS,{className:"absolute left-3 top-2.5 h-4 w-4 text-slate-500"}),g.jsx("input",{className:"workshop-input mt-0 !min-h-9 pl-10 pr-8 text-sm",placeholder:"Search workshop records…",value:s,onChange:l=>e(l.target.value),onFocus:()=>t.length&&n(!0)}),g.jsx("button",{className:"absolute right-2 top-1.5 icon-btn !min-h-6 !min-w-6","aria-label":"Clear search",onClick:()=>{e(""),i([]),n(!1)},children:s&&g.jsx(m0,{className:"h-3.5 w-3.5"})})]}),r&&t.length>0&&g.jsx("div",{className:"absolute z-50 mt-1 max-h-80 w-[calc(100%-1.5rem)] overflow-y-auto rounded-xl border border-shire-border bg-shire-panel shadow-2xl",children:t.map((l,c)=>g.jsxs("button",{onClick:()=>o(l),className:"flex w-full items-center justify-between gap-2 border-b border-white/5 px-3 py-2 text-left text-sm hover:bg-shire-purple/10",children:[g.jsxs("span",{children:[g.jsx("span",{className:"font-medium text-violet-300",children:l.label}),g.jsx("span",{className:"ml-2 text-xs text-slate-500",children:l.sub})]}),g.jsx("span",{className:"text-xs text-slate-500",children:l.type})]},c))}),r&&s.trim()&&t.length===0&&g.jsx("div",{className:"absolute z-50 mt-1 w-[calc(100%-1.5rem)] rounded-xl border border-shire-border bg-shire-panel px-3 py-2 text-sm text-slate-500",children:"No matching records."})]})}function R3e({open:s,onClose:e}){return g.jsxs(g.Fragment,{children:[g.jsx("button",{"aria-label":"Close navigation",onClick:e,className:`fixed inset-0 z-30 bg-black/70 lg:hidden ${s?"block":"hidden"}`}),g.jsxs("aside",{className:`fixed inset-y-0 left-0 z-40 flex h-full min-h-0 w-72 flex-col overflow-hidden border-r border-white/10 bg-[#10151a] transition-transform lg:translate-x-0 ${s?"translate-x-0":"-translate-x-full"}`,children:[g.jsxs("div",{className:"flex h-24 shrink-0 items-center justify-between px-6",children:[g.jsxs("div",{children:[g.jsx("p",{className:"text-2xl font-black tracking-[0.12em] text-white",children:"SHiRE"}),g.jsx("p",{className:"text-xs uppercase tracking-[0.18em] text-violet-400",children:"LimbForge Workshop"})]}),g.jsx("button",{onClick:e,className:"touch-btn lg:hidden","aria-label":"Close navigation",children:g.jsx(m0,{})})]}),g.jsxs("div",{className:"mx-4 mb-4 shrink-0 rounded-xl border border-violet-400/20 bg-violet-400/5 px-4 py-3",children:[g.jsx("p",{className:"text-xs font-semibold text-violet-300",children:"WORKSHOP OWNER MODE"}),g.jsx("p",{className:"mt-1 text-xs text-slate-500",children:"Private authorised access"})]}),g.jsxs("div",{id:"limbforge-sidebar-scroll",className:"min-h-0 flex-1 overflow-x-hidden overflow-y-auto overscroll-contain",children:[g.jsx(C3e,{}),g.jsx(y3e,{onNavigate:e})]})]})]})}const I3e={theme:"dark",contrast:!1,reducedMotion:!1,largeTouch:!1},ZF={get:()=>({...I3e,...JSON.parse(localStorage.getItem("limbforge-settings")||"{}")}),save(s){localStorage.setItem("limbforge-settings",JSON.stringify(s)),document.documentElement.classList.toggle("dark",s.theme==="dark"),document.documentElement.classList.toggle("light",s.theme==="light"),document.documentElement.classList.toggle("high-contrast",s.contrast),document.documentElement.classList.toggle("reduce-motion",s.reducedMotion),document.documentElement.classList.toggle("large-touch",s.largeTouch)},apply(){this.save(this.get())}};function A3e(){const[s,e]=Te.useState(!1);return Te.useEffect(()=>{ZF.apply()},[]),g.jsxs("div",{className:"flex h-full min-h-0 w-full overflow-hidden bg-workshop",children:[g.jsx(R3e,{open:s,onClose:()=>e(!1)}),g.jsxs("div",{className:"flex h-full min-h-0 min-w-0 flex-1 flex-col lg:ml-72",children:[g.jsxs("header",{className:"z-20 flex h-16 shrink-0 items-center border-b border-white/10 bg-[#0b0f13]/90 px-4 backdrop-blur lg:hidden",children:[g.jsx("button",{className:"touch-btn",onClick:()=>e(!0),"aria-label":"Open workshop navigation",children:g.jsx(ime,{})}),g.jsx("span",{className:"ml-3 font-semibold text-white",children:"SHiRE LimbForge"})]}),g.jsx("main",{id:"limbforge-workspace-scroll",className:"min-h-0 min-w-0 flex-1 overflow-x-hidden overflow-y-auto overscroll-contain p-4 pb-24 sm:p-6 sm:pb-24 lg:p-8 lg:pb-24",children:g.jsx(W1e,{})})]})]})}function vc({eyebrow:s,title:e,description:t,action:i}){return g.jsxs("header",{className:"mb-6 flex flex-col gap-4 sm:flex-row sm:items-end sm:justify-between",children:[g.jsxs("div",{children:[g.jsx("p",{className:"mb-2 text-xs font-semibold uppercase tracking-[0.22em] text-violet-400",children:s}),g.jsx("h1",{className:"text-3xl font-semibold tracking-tight text-white sm:text-4xl",children:e}),t&&g.jsx("p",{className:"mt-2 max-w-3xl text-sm leading-6 text-slate-400",children:t})]}),i]})}const Ame="Non-load-bearing cosmetic prosthetic cover only. It is not part of the prosthesis, must not support body weight, alter alignment, obstruct safety systems or replace any component. Manual review is required before printing.";function _0({compact:s=!1}){return g.jsx("div",{role:"note",className:"rounded-2xl border border-amber-400/30 bg-amber-400/10 p-4 text-amber-100",children:g.jsxs("div",{className:"flex gap-3",children:[g.jsx(qp,{className:"mt-0.5 h-5 w-5 shrink-0","aria-hidden":"true"}),g.jsxs("div",{children:[g.jsx("strong",{className:"text-amber-300",children:"Workshop safety boundary"}),!s&&g.jsx("p",{className:"mt-1 text-sm leading-6 text-amber-50/80",children:Ame})]})]})})}function dh({label:s="Loading workshop records"}){return g.jsxs("div",{className:"flex min-h-48 items-center justify-center gap-3 text-slate-400",role:"status",children:[g.jsx(f2e,{className:"h-5 w-5 animate-spin"}),g.jsx("span",{children:s})]})}function WP({label:s,value:e,to:t,detail:i}){return g.jsxs(Ar,{to:t,className:"panel group block p-5 transition hover:-translate-y-0.5 hover:border-violet-400/30 focus-visible:ring-2 focus-visible:ring-violet-400",children:[g.jsxs("div",{className:"flex items-start justify-between",children:[g.jsx("p",{className:"text-sm leading-5 text-slate-400",children:s}),g.jsx(Ype,{className:"h-4 w-4 text-slate-600 transition group-hover:text-violet-400"})]}),g.jsx("p",{className:"mt-4 text-3xl font-semibold tabular-nums text-white",children:e}),i&&g.jsx("p",{className:"mt-2 text-xs text-slate-500",children:i})]})}const P3e={async summary(){const[s,e,t]=await Promise.all([Bt.database.list("CoverProject"),Bt.database.list("MeasurementSession"),Bt.database.list("Customer")]),i=n=>s.filter(a=>a.record_state==="active"&&a.status===n).length,r=s.reduce((n,a)=>({...n,[a.customer_uuid]:(n[a.customer_uuid]||0)+1}),{});return{projects:s,customers:t,active:s.filter(n=>n.record_state==="active"&&n.status!=="Complete").length,measurements:e.filter(n=>n.status!=="Complete").length,clarification:i("Awaiting customer clarification"),selection:i("Designs awaiting selection"),review:i("Awaiting workshop review"),completed:s.filter(n=>n.status==="Complete").slice(0,5),returning:Object.values(r).filter(n=>n>1).length}}};function M3e(){const[s,e]=Te.useState(null);if(Te.useEffect(()=>{P3e.summary().then(e)},[]),!s)return g.jsx(dh,{});const t=[["Active cover projects",s.active,"/projects?active=true"],["Measurements awaiting completion",s.measurements,"/measurements?status=open"],["Awaiting customer clarification",s.clarification,"/projects?status=Awaiting+customer+clarification"],["Designs awaiting selection",s.selection,"/projects?status=Designs+awaiting+selection"],["Awaiting workshop review",s.review,"/projects?status=Awaiting+workshop+review"],["Quotes awaiting acceptance",0,"/not-implemented?feature=Quotes"],["Orders awaiting payment",0,"/not-implemented?feature=Orders"],["NDIS / plan approval",0,"/not-implemented?feature=Orders"],["Covers awaiting print",0,"/not-implemented?feature=Manufacturing"],["Currently printing",0,"/not-implemented?feature=Manufacturing"],["Awaiting final inspection",0,"/not-implemented?feature=Manufacturing"],["Ready to ship",0,"/not-implemented?feature=Shipping"],["Recently completed",s.completed.length,"/projects?status=Complete"],["Returning customers",s.returning,"/customers?returning=true"]];return g.jsxs(g.Fragment,{children:[g.jsx(vc,{eyebrow:"Private Prosthetic Cover Design and Production Studio",title:"Workshop Dashboard",description:"Live workshop records. Production areas not yet built show zero and are explicitly marked on opening."}),g.jsx(_0,{}),g.jsx("div",{className:"mt-6 grid gap-4 sm:grid-cols-2 xl:grid-cols-4",children:t.map(i=>g.jsx(WP,{label:i[0],value:i[1],to:i[2]},i[0]))}),g.jsxs("div",{className:"mt-6 grid gap-4 md:grid-cols-3",children:[g.jsx(WP,{label:"SHiREVault connection",value:"Unavailable",detail:"Base44 cannot mount the private network drive",to:"/migration-readiness"}),g.jsx(WP,{label:"Last verified export",value:"None",detail:"Not yet implemented — Stage 4",to:"/migration-readiness"}),g.jsx(WP,{label:"Last verified backup",value:"None",detail:"Not claimed while Base44-hosted",to:"/migration-readiness"})]})]})}function hr({children:s,tone:e="cyan"}){const t={cyan:"border-violet-400/30 bg-violet-400/10 text-violet-300",amber:"border-amber-400/30 bg-amber-400/10 text-amber-300",green:"border-emerald-400/30 bg-emerald-400/10 text-emerald-300",red:"border-red-400/30 bg-red-400/10 text-red-300",slate:"border-slate-600 bg-slate-800 text-slate-300"};return g.jsx("span",{className:`inline-flex rounded-full border px-2.5 py-1 text-xs font-semibold ${t[e]}`,children:s})}const W0={customerCounts:async s=>{const[e,t,i,r]=await Promise.all([Bt.database.filter("LimbProfile",{customer_uuid:s}),Bt.database.filter("CoverProject",{customer_uuid:s}),Bt.database.filter("Order",{customer_uuid:s}),Bt.database.filter("CompletedCover",{customer_uuid:s})]);return{limbs:e.length,projects:t.length,orders:i.length,covers:r.length}},isFictional:s=>{const e=s&&s.data_origin;return e==="Fictional Test Data"||e==="Fictional"},hideFictional:s=>(s||[]).filter(e=>!W0.isFictional(e))};function $S({record:s,showAll:e=!1}){return s?W0.isFictional(s)?g.jsx(hr,{tone:"red",children:"FICTIONAL TEST DATA"}):e&&s.data_origin&&s.data_origin!=="Workshop Created"?g.jsx(hr,{tone:"slate",children:s.data_origin}):s.data_origin==="Public Intake"?g.jsx(hr,{tone:"green",children:"Public Intake"}):null:null}function D3e({customer:s,counts:e,onToggle:t}){const i=s.record_state==="archived",r=((e==null?void 0:e.projects)||0)>0||((e==null?void 0:e.covers)||0)>0;return g.jsxs(Ar,{to:`/customers/${s.uuid}`,className:"panel block p-5 transition hover:border-shire-purple/40",children:[g.jsxs("div",{className:"flex items-start justify-between gap-3",children:[g.jsxs("div",{children:[g.jsx("p",{className:"text-xs font-semibold text-violet-400",children:s.customer_number}),g.jsx("h2",{className:"mt-1 text-lg font-semibold text-white",children:s.full_name}),s.preferred_name&&s.preferred_name!==s.full_name&&g.jsxs("p",{className:"text-xs text-slate-500",children:["Prefers ",s.preferred_name]})]}),g.jsxs("div",{className:"flex flex-col items-end gap-1",children:[g.jsx(hr,{tone:i?"slate":"green",children:i?"Archived":"Active"}),r&&g.jsx(hr,{tone:"cyan",children:"Returning"}),g.jsx($S,{record:s})]})]}),g.jsxs("dl",{className:"mt-4 grid grid-cols-2 gap-x-4 gap-y-1 text-sm text-slate-400",children:[g.jsx("dt",{className:"text-slate-500",children:"Email"}),g.jsx("dd",{className:"truncate",children:s.email||"—"}),g.jsx("dt",{className:"text-slate-500",children:"Phone"}),g.jsx("dd",{children:s.phone||"—"}),g.jsx("dt",{className:"text-slate-500",children:"Funding"}),g.jsx("dd",{children:s.funding_method||"—"}),g.jsx("dt",{className:"text-slate-500",children:"Location"}),g.jsx("dd",{className:"truncate",children:s.address||"—"})]}),g.jsx("div",{className:"mt-4 flex flex-wrap gap-2 text-xs",children:[["Limb profiles",e==null?void 0:e.limbs],["Projects",e==null?void 0:e.projects],["Orders",e==null?void 0:e.orders],["Covers",e==null?void 0:e.covers]].map(([n,a])=>g.jsxs("span",{className:"rounded-md border border-white/10 bg-white/5 px-2 py-1 text-slate-300",children:[n,": ",g.jsx("span",{className:"font-semibold text-violet-300",children:a||0})]},n))}),g.jsxs("div",{className:"mt-4 flex items-center gap-2",children:[g.jsxs("span",{className:"btn-primary flex-1 text-center text-sm",children:[g.jsx(Jpe,{}),"Open Customer"]}),t&&g.jsx("button",{onClick:n=>{n.preventDefault(),t(s)},className:"icon-btn","aria-label":i?"Restore customer":"Archive customer",children:i?g.jsx(Zp,{}):g.jsx(WS,{})})]})]})}function Z8({field:s,value:e,onChange:t}){const[i,r,n,a]=s,o={id:i,value:e||"",onChange:l=>t(i,l.target.value),className:"workshop-input",required:a===!0};return g.jsxs("label",{className:"block text-sm text-slate-300",htmlFor:i,children:[r,a===!0&&g.jsx("span",{className:"text-violet-400",children:" *"}),n==="select"?g.jsxs("select",{...o,children:[g.jsx("option",{value:"",children:"Select…"}),a.map(l=>g.jsx("option",{children:l},l))]}):g.jsx("input",{...o,type:n})]})}const O3e=[["full_name","Full name","text",!0],["preferred_name","Preferred name","text"],["date_of_birth","Date of birth","date"],["email","Email","email"],["phone","Phone","tel"],["address","Address","text"],["shipping_address","Shipping address","text"],["preferred_contact_method","Preferred contact method","select",["Email","Phone","SMS"]],["emergency_contact","Emergency contact","text"],["pronouns","Pronouns","text"]],w3e=[["funding_method","Funding method","select",["Private payer","Self-managed NDIS","Plan-managed NDIS","NDIA-managed","Quote-only"]],["ndis_number","NDIS number","text"],["plan_dates","Plan dates","text"],["plan_manager_name","Plan manager name","text"],["plan_manager_email","Plan manager email","email"],["plan_manager_phone","Plan manager phone","tel"],["billing_contact","Billing contact","text"],["purchase_order_number","Purchase-order number","text"],["approval_status","Approval status","select",["Not requested","Quote requested","Evidence requested","Submitted","Awaiting approval","Approved","Partially approved","Declined","Customer paying privately"]]];function Pme({initial:s={},onSave:e,onCancel:t}){const[i,r]=Te.useState(s),[n,a]=Te.useState(!1),o=(c,u)=>r({...i,[c]:u}),l=async c=>{c.preventDefault(),a(!0),await e(i),a(!1)};return g.jsxs("form",{onSubmit:l,className:"space-y-6",children:[g.jsxs("section",{children:[g.jsx("h2",{className:"section-title",children:"Identity & contact"}),g.jsx("div",{className:"grid gap-4 md:grid-cols-2",children:O3e.map(c=>g.jsx(Z8,{field:c,value:i[c[0]],onChange:o},c[0]))})]}),g.jsxs("section",{children:[g.jsx("h2",{className:"section-title",children:"Funding & invoicing"}),g.jsx("div",{className:"grid gap-4 md:grid-cols-2",children:w3e.map(c=>g.jsx(Z8,{field:c,value:i[c[0]],onChange:o},c[0]))})]}),g.jsxs("label",{className:"block text-sm text-slate-300",children:["Internal notes",g.jsx("textarea",{className:"workshop-input min-h-24",value:i.internal_notes||"",onChange:c=>o("internal_notes",c.target.value)})]}),g.jsxs("div",{className:"flex justify-end gap-3",children:[g.jsx("button",{type:"button",onClick:t,className:"btn-secondary",children:"Cancel"}),g.jsx("button",{disabled:n,className:"btn-primary",children:n?"Saving…":"Save customer"})]})]})}function KO({value:s,onChange:e,label:t="Hide Fictional Test Data"}){return g.jsxs("label",{className:"choice-card !min-h-9 cursor-pointer",children:[g.jsx("input",{type:"checkbox",checked:s,onChange:i=>e(i.target.checked)}),g.jsx("span",{className:"text-xs text-slate-300",children:t})]})}const mr={list:()=>Bt.database.list("AuditEvent"),record:(s,e,t,i,r="Workshop Owner",n="")=>Bt.database.create("AuditEvent",{uuid:Ka("audit"),event_type:s,record_type:e,record_uuid:t,actor_name:r,summary:i,details:n,migration_version:1})},So={list:()=>Bt.database.list("Customer"),get:async s=>(await Bt.database.filter("Customer",{uuid:s},"-updated_date",1))[0],history:async s=>({limbs:await Bt.database.filter("LimbProfile",{customer_uuid:s}),prostheses:await Bt.database.filter("Prosthesis",{customer_uuid:s}),projects:await Bt.database.filter("CoverProject",{customer_uuid:s})}),async create(s,e){const t=await Bt.database.create("Customer",{...s,uuid:Ka("cust"),customer_number:`SLC-${Date.now().toString().slice(-6)}`,data_label:s.data_label||"WORKSHOP RECORD",...ho(e)});return await mr.record("customer_created","Customer",t.uuid,`Created customer ${t.customer_number}`,e),t},async update(s,e,t,i){const{id:r,created_date:n,updated_date:a,created_by_id:o,...l}=t,c=await Bt.database.update("Customer",s,{...l,updated_by_name:i});return await mr.record("customer_edited","Customer",e,"Customer details updated",i),c},archive:async(s,e)=>(await Bt.database.archive("Customer",s.id),mr.record("customer_archived","Customer",s.uuid,"Customer archived",e)),restore:async(s,e)=>(await Bt.database.restore("Customer",s.id),mr.record("customer_restored","Customer",s.uuid,"Customer restored",e)),async createLimb(s,e){const t=await Bt.database.create("LimbProfile",{...s,uuid:Ka("limb"),...ho(e)});return await mr.record("limb_profile_created","LimbProfile",t.uuid,`Created ${t.profile_name}`,e),t},async createProsthesis(s,e){const t=await Bt.database.create("Prosthesis",{...s,uuid:Ka("pros"),status:"active",...ho(e)});return await mr.record("prosthesis_created","Prosthesis",t.uuid,`Created ${t.name}`,e),t}},Mme="none",z5="dual_cone",W5="legacy_abutment",N3e=[z5,W5],L3e=s=>N3e.includes(s),F3e=(s={})=>s.interface_type?s.interface_type==="Osseointegration":s.osseointegration===!0,K8=s=>s===z5?"OI — Dual Cone":s===W5?"OI — Legacy abutment":"Conventional prosthesis",B3e=(s={})=>F3e(s)?L3e(s.oi_type)?{ok:!0,osseointegration:!0,oiType:s.oi_type}:{ok:!1,osseointegration:!0,oiType:"",error:"Choose either Dual Cone or Legacy / older-style abutment before continuing."}:{ok:!0,osseointegration:!1,oiType:Mme},H5=(s={})=>{const e=B3e(s);if(!e.ok)throw new Error(e.error);return{...s,osseointegration:e.osseointegration,oi_type:e.osseointegration?e.oiType:Mme}},k3e=(s,e)=>{const t=s.interface_type||(e==null?void 0:e.interface_type)||"",i=s.limb_region||(e==null?void 0:e.limb_region)||"",r=s.amputation_level||(e==null?void 0:e.amputation_level)||(e==null?void 0:e.configuration)||"";return t==="Osseointegration"?"Osseointegration":i==="Upper limb"||/elbow|wrist|shoulder/i.test(r)?"Upper limb":/above-knee|knee disarticulation|hip disarticulation/i.test(r)?"Knee component":"Lower leg"},au={list:()=>Bt.database.list("CoverProject"),get:async s=>(await Bt.database.filter("CoverProject",{uuid:s},"-updated_date",1))[0],filter:s=>Bt.database.filter("CoverProject",s),async create(s,e){var c,u;s=H5(s);const{id:t,created_date:i,updated_date:r,created_by_id:n,...a}=s,o=Ka("proj"),l=await Bt.database.create("CoverProject",{...a,uuid:o,project_id:`SLC-${new Date().getFullYear()}-${Date.now().toString().slice(-5)}`,revision:1,storage_destination:`/SHiREVault/SHiRELimbs/Projects/${o}`,safety_boundary_accepted:!0,component_verification_status:s.components_pending?"Unknown - add and verify before manufacturing":s.component_verification_status||"Selected - verification required",manufacturing_release_blocked:s.components_pending===!0,manufacturing_release_reason:s.components_pending?"Receiving prosthetic components and approved external attachment regions are not yet verified.":"",...ho(e),revision:s.revision||1});if((c=s.measurement_method)!=null&&c.includes("Manual")||(u=s.measurement_method)!=null&&u.includes("Combination")){const h=(await Bt.database.filter("LimbProfile",{uuid:s.limb_profile_uuid},"-updated_date",1))[0],d=k3e(s,h);await Bt.database.create("MeasurementSession",{uuid:Ka("session"),project_uuid:o,customer_uuid:s.customer_uuid,limb_profile_uuid:s.limb_profile_uuid,workflow:d,status:"Not started",measured_by:e,measured_date:new Date().toISOString().slice(0,10),progress_percent:0,...ho(e)})}return await mr.record("project_created","CoverProject",o,`Created cover project ${l.project_id}`,e,s.components_pending?"Non-load-bearing cosmetic cover only. Component details remain unverified and manufacturing release is blocked.":"Non-load-bearing cosmetic prosthetic cover only. Manual review required."),l},duplicate:async(s,e)=>au.create({...s,id:void 0,project_id:void 0,revision:s.revision+1,status:"Awaiting measurements",reason_for_cover:`Revision of ${s.project_id}`},e),archive:async(s,e="Ray")=>(await Bt.database.archive("CoverProject",s.id),mr.record("project_archived","CoverProject",s.uuid,`Archived ${s.project_id}`,e)),restore:async(s,e="Ray")=>(await Bt.database.restore("CoverProject",s.id),mr.record("project_restored","CoverProject",s.uuid,`Restored ${s.project_id}`,e))},WR={list:()=>Bt.database.list("Quote"),forProject:s=>Bt.database.filter("Quote",{project_uuid:s}),forCustomer:s=>Bt.database.filter("Quote",{customer_uuid:s}),get:async s=>(await Bt.database.filter("Quote",{uuid:s},"-updated_date",1))[0],async create(s,e){const t=await Bt.database.create("Quote",{...s,uuid:Ka("quote"),quote_number:`Q-${Date.now().toString().slice(-6)}`,approval_status:s.approval_status||"Draft",data_origin:s.data_origin||"Workshop Created",...ho(e)});return await mr.record("quote_created","Quote",t.uuid,`Created quote ${t.quote_number}`,e),t},async update(s,e,t,i){const{id:r,created_date:n,updated_date:a,created_by_id:o,...l}=t,c=await Bt.database.update("Quote",s,{...l,updated_by_name:i});return await mr.record("quote_updated","Quote",e,"Quote updated",i),c},async approve(s,e,t){return await Bt.database.update("Quote",s,{approval_status:"Approved",updated_by_name:t}),mr.record("quote_approved","Quote",e,"Quote approved",t)},async send(s,e,t){return await Bt.database.update("Quote",s,{approval_status:"Sent",sent_date:new Date().toISOString().slice(0,10),updated_by_name:t}),mr.record("quote_sent","Quote",e,"Quote sent to customer",t)},archive:async(s,e)=>(await Bt.database.archive("Quote",s.id),mr.record("quote_archived","Quote",s.uuid,"Quote archived",e)),restore:async(s,e)=>(await Bt.database.restore("Quote",s.id),mr.record("quote_restored","Quote",s.uuid,"Quote restored",e))},DS={list:()=>Bt.database.list("Order"),forProject:s=>Bt.database.filter("Order",{project_uuid:s}),forCustomer:s=>Bt.database.filter("Order",{customer_uuid:s}),get:async s=>(await Bt.database.filter("Order",{uuid:s},"-updated_date",1))[0],async create(s,e){const t=await Bt.database.create("Order",{...s,uuid:Ka("order"),order_number:`ORD-${Date.now().toString().slice(-6)}`,order_date:s.order_date||new Date().toISOString().slice(0,10),production_status:s.production_status||"Awaiting measurements",shipping_status:s.shipping_status||"Not started",payment_status:s.payment_status||"Unpaid",funding_approval_status:s.funding_approval_status||"Not requested",invoice_status:s.invoice_status||"Not issued",deposit:s.deposit||0,balance:s.balance||s.quote_amount||0,data_origin:s.data_origin||"Workshop Created",...ho(e)});return await mr.record("order_created","Order",t.uuid,`Created order ${t.order_number}`,e),t},async createFromQuote(s,e,t){return DS.create({project_uuid:e.uuid,customer_uuid:e.customer_uuid,quote_uuid:s.uuid,cover_revision:e.revision,funding_type:s.funding_type,quote_amount:s.amount,balance:s.amount},t)},async update(s,e,t,i){const{id:r,created_date:n,updated_date:a,created_by_id:o,...l}=t,c=await Bt.database.update("Order",s,{...l,updated_by_name:i});return await mr.record("order_updated","Order",e,"Order updated",i),c},async setStatus(s,e,t,i){return await Bt.database.update("Order",s,{production_status:t,updated_by_name:i}),mr.record("order_status_changed","Order",e,`Production status → ${t}`,i)},async recordPayment(s,e,t,i){const r=(await Bt.database.filter("Order",{uuid:e},"-updated_date",1))[0],n=(r.deposit||0)+Number(t),a=r.quote_amount||0,o=Math.max(0,a-n),l=o<=0?"Paid":n>0?"Deposit paid":"Unpaid";return await Bt.database.update("Order",s,{deposit:n,balance:o,payment_status:l,updated_by_name:i}),mr.record("payment_recorded","Order",e,`Payment of ${t} recorded`,i)},async cancel(s,e,t,i){return await Bt.database.update("Order",s,{production_status:"Awaiting measurements",cancel_reason:t,record_state:"archived",updated_by_name:i}),mr.record("order_cancelled","Order",e,`Order cancelled: ${t}`,i)},archive:async(s,e)=>(await Bt.database.archive("Order",s.id),mr.record("order_archived","Order",s.uuid,"Order archived",e)),restore:async(s,e)=>(await Bt.database.restore("Order",s.id),mr.record("order_restored","Order",s.uuid,"Order restored",e)),prepareQuote:(s,e)=>WR.create({project_uuid:s.uuid,customer_uuid:s.customer_uuid,amount:0,funding_type:"Quote-only"},e)},j5=["Minimal","Elegant Anatomical","Gothic","Biomechanical","Cybernetic","Industrial","Skeletal","Organic","Geometric","Futuristic","Steampunk","Floral","Child Friendly","Sports Inspired","Custom"],Dme=["Subtle","Moderate","Aggressive","Custom"],V3e=["symmetric","left asymmetric","right asymmetric","mirror accents","independent medial lateral"],Ome=["smooth shell","segmented shell","ribbed shell","panelled shell","vent-accent shell","skeletal accent shell","geometric accent shell","organic flowing accent shell"],wme=["none","segmented shell","ribbed shell","panelled shell","vent-accent shell","skeletal accent shell","geometric accent shell","organic flowing accent shell"],Nme=["none","smooth","segmented","flowing anatomical","gothic panel","biomechanical","geometric","ribbed","skeletal","organic vein","industrial vent","hexagonal","diamond","floral linework","star pattern","custom reference"],Lme=["clean modern","technical","gothic","elegant","bold","minimal"],X5=["front","front-lateral","outer-lateral","rear-lateral","rear","upper calf","mid calf","lower calf"],Fme=["front","front-lateral","outer-lateral","rear-lateral","rear"],H_=["black","graphite","purple","green","red","silver","white","custom"],Bme=["matte","satin","gloss concept"],kme=["small","medium","large"],Vme=["small","medium","large"];function iO(s){return{design_category:"Minimal",design_intensity:"Subtle",primary_style:"smooth shell",accent_style:"none",accent_density:"subtle",symmetry:"symmetric",detail_panel_layering:!1,detail_raised_ribs:!1,detail_recessed_channels:!1,detail_engraving_concept:!1,detail_raised_ornament:!1,main_colour:"black",accent_colour:"purple",logo_colour:"silver",text_colour:"silver",finish:"matte",custom_text_enabled:!1,custom_text:"",text_style:"clean modern",text_placement:"outer-lateral",text_orientation:"horizontal",text_size:"medium",text_raised:!0,text_depth:"shallow",logo_placement:"outer-lateral",logo_size:"medium",logo_orientation_validated:!0,pattern_style:"none",pattern_scale:"medium",pattern_density:"moderate",pattern_rotation_degrees:0,pattern_placement_region:"outer-lateral",pattern_raised:!0,vent_concept:"",surface_notes:"",inspiration_notes:"",reference_image_urls:[],concept_status:"Draft",approved_for_quote:!1}}function Q8(s,e,t){const i=[];return s.logo_placement||i.push({level:"blocked",text:"SHiRE logo placement not set — mandatory branding missing"}),s.logo_orientation_validated===!1&&i.push({level:"blocked",text:"SHiRE logo orientation is MIRRORED — must be corrected before approval"}),s.logo_size||i.push({level:"warning",text:"Logo size not set"}),e&&e.cover_boundaries&&s.logo_placement==="rear"&&i.push({level:"warning",text:"Logo on rear face — verify it does not cross a seam or cover boundary"}),t&&(s.logo_placement==="outer-lateral"||s.logo_placement==="front-lateral")&&((t.medial_offset_mm||0)>=0?"lateral":"medial")==="lateral"&&i.push({level:"warning",text:"Logo on lateral face — verify it does not overlap the Ossiguard connector body"}),e&&e.sensitive_area_summary&&s.logo_placement==="front"&&i.push({level:"warning",text:"Logo on front face — verify it does not overlap a sensitive zone"}),i}function U3e(s,e,t){const i=[];if(!s.custom_text_enabled)return i;const r=(s.custom_text||"").trim();return r||i.push({level:"warning",text:"Custom text enabled but no text entered"}),r.length>40?i.push({level:"blocked",text:"Custom text too long (max 40 characters)"}):r.length>24&&i.push({level:"warning",text:"Custom text is long — visual quality may reduce"}),r.length>0&&r.length<2&&i.push({level:"warning",text:"Custom text is very short — may not be legible"}),s.text_placement||i.push({level:"warning",text:"Custom text placement not set"}),s.text_placement&&s.logo_placement&&s.text_placement===s.logo_placement&&i.push({level:"warning",text:"Custom text overlaps SHiRE logo placement region"}),t&&(s.text_placement==="outer-lateral"||s.text_placement==="front-lateral")&&i.push({level:"warning",text:"Verify custom text does not intersect Ossiguard access or fastener clearance"}),e&&e.sensitive_area_summary&&s.custom_text_enabled&&i.push({level:"warning",text:"Verify custom text does not overlap sensitive zones described in the project brief"}),s.symmetry==="mirror accents"&&s.text_placement&&i.push({level:"warning",text:"Mirror-accent symmetry does not mirror readable text or logos — text remains single-sided"}),i}function G3e(s,e,t){const i=[];if(!t)return i;const r=(t.medial_offset_mm||0)>=0?"lateral":"medial";return s.pattern_style&&s.pattern_style!=="none"&&s.pattern_placement_region==="outer-lateral"&&r==="lateral"&&i.push({level:"warning",text:"Exterior pattern on connector side — verify it does not obstruct Ossiguard insertion/removal path"}),s.detail_access_door_styling&&r==="lateral"&&i.push({level:"warning",text:"Access-door styling near connector — verify fastener access and release path remain unobstructed"}),t.panel_opening_required&&s.pattern_style&&s.pattern_style!=="none"&&i.push({level:"warning",text:"Panel opening required for Ossiguard — verify pattern does not block the opening"}),i}const ua={list:()=>Bt.database.list("DesignConfiguration"),forProject:s=>Bt.database.filter("DesignConfiguration",{project_uuid:s},"-version"),getConcepts:s=>Bt.database.filter("DesignConfiguration",{project_uuid:s},"-version"),getCurrent:async s=>(await Bt.database.filter("DesignConfiguration",{project_uuid:s,is_current:!0},"-version",1))[0]||null,get:async s=>(await Bt.database.filter("DesignConfiguration",{uuid:s},"-updated_date",1))[0],async create(s,e){const t=await Bt.database.filter("DesignConfiguration",{project_uuid:s.project_uuid}),i=(t.length?Math.max(...t.map(n=>n.version||0)):0)+1,r=await Bt.database.create("DesignConfiguration",{...s,uuid:Ka("design"),version:i,is_current:!0,validation_status:s.validation_status||"Warning",validation_issues:s.validation_issues||[],...ho(e)});for(const n of t)n.id!==r.id&&n.is_current&&await Bt.database.update("DesignConfiguration",n.id,{is_current:!1,updated_by_name:e});return await mr.record("design_created","DesignConfiguration",r.uuid,`Design revision v${i} created`,e),r},async update(s,e,t,i){const{id:r,created_date:n,updated_date:a,created_by_id:o,...l}=t,c=ua.validate({...l}),u=await Bt.database.update("DesignConfiguration",s,{...l,validation_status:c.status,validation_issues:c.issues,updated_by_name:i});return await mr.record("design_updated","DesignConfiguration",e,"Design configuration updated",i),u},async saveRevision(s,e,t){const i=await Bt.database.filter("DesignConfiguration",{project_uuid:s}),r=(i.length?Math.max(...i.map(o=>o.version||0)):0)+1,n=ua.validate(e),a=await Bt.database.create("DesignConfiguration",{...e,uuid:Ka("design"),project_uuid:s,version:r,is_current:!0,validation_status:n.status,validation_issues:n.issues,...ho(t)});for(const o of i)o.id!==a.id&&o.is_current&&await Bt.database.update("DesignConfiguration",o.id,{is_current:!1,updated_by_name:t});return await mr.record("design_revision_saved","DesignConfiguration",a.uuid,`Design revision v${r} saved`,t),a},async duplicate(s,e){const t=await ua.getCurrent(s);if(!t)return null;const{id:i,uuid:r,created_date:n,updated_date:a,created_by_id:o,version:l,is_current:c,...u}=t;return ua.saveRevision(s,u,e)},async restore(s,e){const t=await ua.get(s);if(!t)return null;const i=await Bt.database.filter("DesignConfiguration",{project_uuid:t.project_uuid});for(const r of i)await Bt.database.update("DesignConfiguration",r.id,{is_current:r.uuid===s,updated_by_name:e});return await mr.record("design_restored","DesignConfiguration",s,`Design revision v${t.version} restored as current`,e),ua.get(s)},async approveForQuote(s,e){const t=await ua.get(s);if(!t)return null;const i=ua.validate(t);if(i.status==="Blocked")return{error:"Cannot approve — blocking validation failures remain",validation:i};const r=await Bt.database.update("DesignConfiguration",t.id,{approved_for_quote:!0,concept_status:"Approved for Quote",approved_design_uuid:s,updated_by_name:e});return await mr.record("design_approved","DesignConfiguration",s,"Design approved for quote (not CAD/print ready)",e),r},async copyToProject(s,e,t){const i=await ua.getCurrent(s);if(!i)return null;const{id:r,uuid:n,created_date:a,updated_date:o,created_by_id:l,version:c,is_current:u,project_uuid:h,...d}=i;return ua.saveRevision(e,d,t)},async setConceptStatus(s,e,t){const i=await ua.get(s);if(!i)return null;const r=await Bt.database.update("DesignConfiguration",i.id,{concept_status:e,updated_by_name:t});return await mr.record("concept_status","DesignConfiguration",s,`Concept status set to ${e}`,t),r},async recordFeedback(s,e,t){const i=await ua.get(s);if(!i)return null;const r=await Bt.database.update("DesignConfiguration",i.id,{customer_feedback:e,updated_by_name:t});return await mr.record("concept_feedback","DesignConfiguration",s,"Customer feedback recorded",t),r},async createConcept(s,e,t){const i=await Bt.database.filter("DesignConfiguration",{project_uuid:s}),r=(i.length?Math.max(...i.map(a=>a.version||0)):0)+1,n=await Bt.database.create("DesignConfiguration",{...e,uuid:Ka("design"),project_uuid:s,version:r,is_current:!1,concept_status:e.concept_status||"Draft",validation_status:"Warning",validation_issues:[],...ho(t)});return await mr.record("concept_created","DesignConfiguration",n.uuid,`Concept "${e.concept_name||"Untitled"}" created`,t),n},validate(s,e,t){const i=[];if(!s)return{status:"Blocked",issues:["No design configuration saved"]};s.main_colour||i.push({level:"warning",text:"Main cover colour not set"}),s.accent_colour||i.push({level:"warning",text:"Accent colour not set"}),i.push(...Q8(s,e,t)),i.push(...U3e(s,e,t)),i.push(...G3e(s,e,t));const r=i.some(o=>o.level==="blocked"),n=i.some(o=>o.level==="warning");return{status:r?"Blocked":n?"Warning":"Pass",issues:i.map(o=>o.text),issueObjects:i}},logoValidation(s,e,t){const i=Q8(s,e,t),r=i.some(n=>n.text.toLowerCase().includes("mirrored"));return{present:!!s.logo_placement,readable:!!s.logo_size,orientationCorrect:s.logo_orientation_validated!==!1,notMirrored:!r,exteriorFacing:!0,sizeAcceptable:!!s.logo_size,issues:i,level:i.some(n=>n.level==="blocked")?"blocked":i.some(n=>n.level==="warning")?"warning":"pass"}},status:()=>({implemented:!0,label:"Design Forge active",boundary:"Design elements are conceptual preview only — not manufacturing-ready CAD geometry."})},td={list:()=>Bt.database.list("CompletedCover"),forCustomer:s=>Bt.database.filter("CompletedCover",{customer_uuid:s}),forProject:s=>Bt.database.filter("CompletedCover",{project_uuid:s}),get:async s=>(await Bt.database.filter("CompletedCover",{uuid:s},"-updated_date",1))[0],async create(s,e){const t=await Bt.database.create("CompletedCover",{...s,uuid:Ka("cover"),cover_reference:`SHC-${Date.now().toString().slice(-6)}`,data_origin:s.data_origin||"Workshop Created",reorder_status:"Not reordered",...ho(e)});return await mr.record("cover_completed","CompletedCover",t.uuid,`Completed cover ${t.cover_reference}`,e),t},async update(s,e,t,i){const{id:r,created_date:n,updated_date:a,created_by_id:o,...l}=t;return await Bt.database.update("CompletedCover",s,{...l,updated_by_name:i})},async reorder(s,e){const t=await DS.create({project_uuid:s.project_uuid,customer_uuid:s.customer_uuid,cover_revision:s.revision||1,funding_type:"Private payer",quote_amount:0,balance:0,production_status:"Ready for CAD"},e);return await td.update(s.id,s.uuid,{reorder_status:"Reordered"},e),await mr.record("cover_reorder","CompletedCover",s.uuid,`Reorder placed as ${t.order_number}`,e),{order:t,cover:s}},async newDesignFromFit(s,e,t){const{id:i,created_date:r,updated_date:n,created_by_id:a,...o}=e,l=await Bt.database.create("CoverProject",{...o,uuid:Ka("proj"),project_id:`${e.project_id}-R${(e.revision||1)+1}`,revision:(e.revision||1)+1,status:"Ready for design",reason_for_cover:`New design using fit from ${s.cover_reference}`,data_origin:"Workshop Created",...ho(t)});await mr.record("project_revision_created","CoverProject",l.uuid,`New revision ${l.project_id} from ${s.cover_reference}`,t);try{await ua.copyToProject(e.uuid,l.uuid,t)}catch{}return l},async replace(s,e){const t=await DS.create({project_uuid:s.project_uuid,customer_uuid:s.customer_uuid,cover_revision:s.revision||1,funding_type:"Private payer",quote_amount:0,balance:0,production_status:"Ready for CAD"},e);return await td.update(s.id,s.uuid,{reorder_status:"Replacement in progress"},e),await mr.record("cover_replacement","CompletedCover",s.uuid,`Replacement order ${t.order_number}`,e),t},async reportFitIssue(s,e,t){return await td.update(s.id,s.uuid,{fit_review_result:"Refit required",notes:(s.notes?s.notes+`
000544: `:"")+"Fit issue: "+e},t),mr.record("fit_issue_reported","CompletedCover",s.uuid,`Fit issue reported: ${e}`,t)},archive:async(s,e)=>(await Bt.database.archive("CompletedCover",s.id),mr.record("cover_archived","CompletedCover",s.uuid,"Cover archived",e)),restore:async(s,e)=>(await Bt.database.restore("CompletedCover",s.id),mr.record("cover_restored","CompletedCover",s.uuid,"Cover restored",e))},z3e=["All","New customers","Returning customers","Active projects","Awaiting measurements","Awaiting quote","Current orders","Completed customers","Archived"],W3e=["Recent activity","Name (A–Z)","Customer number"];function H3e(){const[s,e]=Te.useState([]),[t,i]=Te.useState([]),[r,n]=Te.useState([]),[a,o]=Te.useState([]),[l,c]=Te.useState([]),[u,h]=Te.useState(""),[d,f]=Te.useState("All"),[m,p]=Te.useState("Recent activity"),[_,v]=Te.useState(!0),[x,S]=Te.useState(!1),b=()=>{Promise.all([So.list(),Bt.database.list("LimbProfile"),au.list(),DS.list(),td.list()]).then(([P,w,L,k,V])=>{e(P),i(w),n(L),o(k),c(V)})};Te.useEffect(()=>{b()},[]);const y=Te.useMemo(()=>{const P={};return s.forEach(w=>{P[w.uuid]={limbs:t.filter(L=>L.customer_uuid===w.uuid).length,projects:r.filter(L=>L.customer_uuid===w.uuid).length,orders:a.filter(L=>L.customer_uuid===w.uuid).length,covers:l.filter(L=>L.customer_uuid===w.uuid).length}}),P},[s,t,r,a,l]),I=Te.useMemo(()=>{let P=_?W0.hideFictional(s):s;if(d==="Archived"?P=P.filter(w=>w.record_state==="archived"):d==="New customers"?P=P.filter(w=>{var L,k;return(((L=y[w.uuid])==null?void 0:L.projects)||0)===0&&(((k=y[w.uuid])==null?void 0:k.covers)||0)===0}):d==="Returning customers"?P=P.filter(w=>{var L,k;return(((L=y[w.uuid])==null?void 0:L.projects)||0)>0||(((k=y[w.uuid])==null?void 0:k.covers)||0)>0}):d==="Active projects"?P=P.filter(w=>r.some(L=>L.customer_uuid===w.uuid&&L.status!=="Complete"&&L.record_state!=="archived")):d==="Awaiting measurements"?P=P.filter(w=>r.some(L=>L.customer_uuid===w.uuid&&L.status==="Awaiting measurements")):d==="Awaiting quote"?P=P.filter(w=>r.some(L=>L.customer_uuid===w.uuid&&(L.status==="Awaiting workshop review"||L.status==="Ready for design"))):d==="Current orders"?P=P.filter(w=>a.some(L=>L.customer_uuid===w.uuid&&L.production_status!=="Complete"&&!L.cancel_reason)):d==="Completed customers"&&(P=P.filter(w=>{var L;return(((L=y[w.uuid])==null?void 0:L.covers)||0)>0})),u.trim()){const w=u.toLowerCase();P=P.filter(L=>[L.full_name,L.preferred_name,L.email,L.phone,L.customer_number].join(" ").toLowerCase().includes(w))}return P=[...P].sort((w,L)=>m==="Name (A–Z)"?(w.full_name||"").localeCompare(L.full_name||""):m==="Customer number"?(w.customer_number||"").localeCompare(L.customer_number||""):(L.updated_date||"").localeCompare(w.updated_date||"")),P},[s,d,_,u,m,y,r,a]),R=async P=>{await So.create(P,"Ray"),S(!1),b()},A=async P=>{P.record_state==="archived"?await So.restore(P,"Ray"):await So.archive(P,"Ray"),b()};return g.jsxs(g.Fragment,{children:[g.jsx(vc,{eyebrow:"Returning-customer records",title:"Customers",description:"Search and inspect every customer with their full project, measurement, order and cover history.",action:g.jsxs("button",{onClick:()=>S(!0),className:"btn-primary",children:[g.jsx($f,{}),"New customer"]})}),x&&g.jsx("div",{className:"panel mb-6 p-6",children:g.jsx(Pme,{onSave:R,onCancel:()=>S(!1)})}),g.jsxs("div",{className:"mb-5 flex flex-wrap items-center gap-2",children:[g.jsxs("label",{className:"relative block",children:[g.jsx(jS,{className:"absolute left-3 top-3 h-4 w-4 text-slate-500"}),g.jsx("input",{className:"workshop-input mt-0 pl-10",placeholder:"Search name, email, phone or customer number",value:u,onChange:P=>h(P.target.value)})]}),g.jsx("select",{className:"workshop-input mt-0 max-w-xs",value:d,onChange:P=>f(P.target.value),children:z3e.map(P=>g.jsx("option",{children:P},P))}),g.jsx("select",{className:"workshop-input mt-0 max-w-xs",value:m,onChange:P=>p(P.target.value),children:W3e.map(P=>g.jsx("option",{children:P},P))}),g.jsx(KO,{value:_,onChange:v})]}),g.jsx("div",{className:"grid gap-4 md:grid-cols-2 xl:grid-cols-3",children:I.map(P=>g.jsx(D3e,{customer:P,counts:y[P.uuid],onToggle:A},P.uuid))}),I.length===0&&g.jsx("p",{className:"mt-8 text-center text-sm text-slate-500",children:"No customers match the current filter."})]})}function cy({items:s}){return g.jsx("nav",{"aria-label":"Breadcrumb",className:"mb-4 flex flex-wrap items-center gap-1 text-sm text-slate-500",children:s.map((e,t)=>{const i=t===s.length-1;return g.jsxs("span",{className:"flex items-center gap-1",children:[e.to&&!i?g.jsx(Ar,{to:e.to,className:"text-slate-400 hover:text-violet-300",children:e.label}):g.jsx("span",{className:i?"font-medium text-violet-300":"",children:e.label}),!i&&g.jsx(kT,{className:"h-3.5 w-3.5 text-slate-600"})]},t)})})}const J8={1:"sm:grid-cols-1",2:"sm:grid-cols-2",3:"sm:grid-cols-3"};function La({rows:s,columns:e=2}){return g.jsx("dl",{className:`grid gap-x-6 gap-y-3 ${J8[e]||J8[2]}`,children:s.filter(([,t])=>t!=null&&t!=="").map(([t,i],r)=>g.jsxs("div",{className:"flex flex-col gap-0.5",children:[g.jsx("dt",{className:"text-xs uppercase tracking-wide text-slate-500",children:t}),g.jsx("dd",{className:"text-sm text-slate-200 break-words",children:typeof i=="boolean"?i?"Yes":"No":i})]},r))})}const j3e=[{value:z5,title:"Dual Cone system",description:"Exploded mechanical system with multiple external components. Requires full hardware clearance, access and component awareness.",image:"/agents/limbforge/measurement-guides/oi-dual-cone-reference.svg",alt:"Exploded technical reference for a Dual Cone osseointegration system."},{value:W5,title:"Legacy / older-style abutment system",description:"Simpler abutment-through-skin system. Requires an open no-contact zone with direct cleaning and inspection access.",image:"/agents/limbforge/measurement-guides/oi-legacy-abutment-reference.svg",alt:"Technical reference for a simpler legacy abutment passing through the skin."}];function $5({value:s="",onChange:e,compact:t=!1}){return g.jsxs("section",{"data-shire-feature":"SHIRE_OI_TYPES_STAGE1B",className:`rounded-2xl border border-amber-400/25 bg-amber-400/5 ${t?"p-3":"p-4 sm:p-5"}`,children:[g.jsxs("div",{className:"flex items-start gap-3",children:[g.jsx(qp,{className:"mt-0.5 h-5 w-5 shrink-0 text-amber-300"}),g.jsxs("div",{children:[g.jsx("p",{className:"text-sm font-semibold text-white",children:"Which osseointegration system is involved?"}),g.jsx("p",{className:"mt-1 text-xs leading-5 text-slate-400",children:"This is required because the safety clearances and measurement instructions differ between systems."})]})]}),g.jsx("div",{className:"mt-4 grid gap-3 md:grid-cols-2",children:j3e.map(i=>{const r=s===i.value;return g.jsxs("button",{type:"button","aria-pressed":r,onClick:()=>e==null?void 0:e(i.value),className:`overflow-hidden rounded-2xl border text-left transition ${r?"border-cyan-300 bg-cyan-400/10 shadow-[0_0_0_2px_rgba(103,232,249,0.16)]":"border-white/10 bg-[#09111c] hover:border-cyan-400/40"}`,children:[g.jsxs("div",{className:"relative aspect-[16/9] border-b border-white/10 bg-[#050b12]",children:[g.jsx("img",{src:i.image,alt:i.alt,draggable:"false",className:"h-full w-full object-contain"}),r&&g.jsx("span",{className:"absolute right-3 top-3 rounded-full bg-cyan-300 p-1 text-slate-950",children:g.jsx(hg,{className:"h-4 w-4"})})]}),g.jsxs("div",{className:"p-4",children:[g.jsx("p",{className:"font-semibold text-white",children:i.title}),g.jsx("p",{className:"mt-1 text-xs leading-5 text-slate-400",children:i.description})]})]},i.value)})}),!s&&g.jsx("p",{role:"alert",className:"mt-3 text-xs font-medium text-amber-300",children:"Select an OI system type to continue."})]})}const X3e=["Left below-knee","Right below-knee","Left above-knee","Right above-knee","Left below-elbow","Right below-elbow","Left above-elbow","Right above-elbow","Knee disarticulation","Hip disarticulation","Wrist disarticulation","Shoulder disarticulation","Bilateral configuration","Custom configuration"];function $3e({customerUuid:s,onSave:e,onCancel:t}){const[i,r]=Te.useState({customer_uuid:s,configuration:"Right below-knee",interface_type:"Socket",osseointegration:!1,oi_type:"none",data_label:"WORKSHOP RECORD"}),[n,a]=Te.useState(""),o=(u,h)=>{a(""),r(d=>({...d,[u]:h}))},l=(u,h)=>g.jsxs("label",{className:"text-sm text-slate-300",children:[h,g.jsx("input",{className:"workshop-input",value:i[u]||"",onChange:d=>o(u,d.target.value)})]}),c=u=>{u.preventDefault();try{e(H5(i))}catch(h){a((h==null?void 0:h.message)||"Check the interface details.")}};return g.jsxs("form",{onSubmit:c,className:"grid gap-4 md:grid-cols-2",children:[l("profile_name","Profile name"),g.jsxs("label",{className:"text-sm text-slate-300",children:["Configuration",g.jsx("select",{className:"workshop-input",value:i.configuration,onChange:u=>o("configuration",u.target.value),children:X3e.map(u=>g.jsx("option",{children:u},u))})]}),g.jsxs("label",{className:"text-sm text-slate-300 md:col-span-2",children:["Prosthesis interface",g.jsxs("select",{className:"workshop-input",value:i.interface_type,onChange:u=>{const h=u.target.value;a(""),r(d=>({...d,interface_type:h,osseointegration:h==="Osseointegration",oi_type:h==="Osseointegration"?["dual_cone","legacy_abutment"].includes(d.oi_type)?d.oi_type:"":"none"}))},children:[g.jsx("option",{children:"Socket"}),g.jsx("option",{children:"Osseointegration"}),g.jsx("option",{children:"Other"})]})]}),i.interface_type==="Osseointegration"&&g.jsx("div",{className:"md:col-span-2",children:g.jsx($5,{value:i.oi_type,onChange:u=>o("oi_type",u)})}),l("prosthesis_manufacturer","Prosthesis manufacturer"),l("prosthesis_model","Prosthesis model"),l("prosthetist_or_clinic","Prosthetist or clinic"),l("important_notes","Important notes"),n&&g.jsx("div",{role:"alert",className:"rounded-xl border border-red-400/30 bg-red-400/10 p-3 text-sm text-red-200 md:col-span-2",children:n}),g.jsxs("div",{className:"flex gap-2 md:col-span-2",children:[g.jsx("button",{className:"btn-primary",children:"Save limb profile"}),g.jsx("button",{type:"button",onClick:t,className:"btn-secondary",children:"Cancel"})]})]})}function Y3e({customerUuid:s,limbs:e,onSave:t,onCancel:i}){var o;const[r,n]=Te.useState({customer_uuid:s,limb_profile_uuid:((o=e[0])==null?void 0:o.uuid)||"",data_label:"WORKSHOP RECORD"}),a=(l,c)=>g.jsxs("label",{className:"text-sm text-slate-300",children:[c,g.jsx("input",{className:"workshop-input",value:r[l]||"",onChange:u=>n({...r,[l]:u.target.value})})]});return g.jsxs("form",{className:"grid gap-4 md:grid-cols-2",onSubmit:l=>{l.preventDefault(),t(r)},children:[g.jsxs("label",{className:"text-sm text-slate-300",children:["Limb profile",g.jsx("select",{className:"workshop-input",value:r.limb_profile_uuid,onChange:l=>n({...r,limb_profile_uuid:l.target.value}),children:e.map(l=>g.jsx("option",{value:l.uuid,children:l.profile_name},l.uuid))})]}),a("name","Prosthesis name"),a("configuration","Configuration"),a("manufacturer","Manufacturer"),a("model","Model"),a("serial_number","Serial number (optional)"),a("notes","Notes"),g.jsxs("div",{className:"flex gap-2 md:col-span-2",children:[g.jsx("button",{className:"btn-primary",children:"Save prosthesis"}),g.jsx("button",{type:"button",className:"btn-secondary",onClick:i,children:"Cancel"})]})]})}const q3e=[["overview","Overview"],["limbs","Limb Profiles"],["prostheses","Prostheses & Components"],["measurements","Measurements"],["projects","Projects"],["quotes","Quotes"],["orders","Orders"],["covers","Completed Covers"],["history","History"]];function Z3e(){var A,P;const{uuid:s}=Wv(),[e,t]=Te.useState(null),[i,r]=Te.useState("overview"),[n,a]=Te.useState(""),[o,l]=Te.useState(!1),c=async()=>{const w=await So.get(s);if(!w){t({notFound:!0});return}const L=await So.history(s),[k,V,U,ne,oe]=await Promise.all([Bt.database.filter("MeasurementSession",{customer_uuid:s}),WR.forCustomer(s),DS.forCustomer(s),td.forCustomer(s),mr.list()]),le=new Set([s,...L.projects.map(te=>te.uuid),...V.map(te=>te.uuid),...U.map(te=>te.uuid),...ne.map(te=>te.uuid),...k.map(te=>te.uuid)]),Y=(oe||[]).filter(te=>le.has(te.record_uuid)).sort((te,Z)=>(Z.created_date||"").localeCompare(te.created_date||""));t({customer:w,history:L,sessions:k,quotes:V,orders:U,covers:ne,audits:Y})};if(Te.useEffect(()=>{c()},[s]),!e)return g.jsx(dh,{});if(e.notFound)return g.jsxs("div",{className:"panel mx-auto mt-10 max-w-lg p-8 text-center",children:[g.jsx("h1",{className:"text-xl font-semibold text-white",children:"Customer not found"}),g.jsx(Ar,{className:"btn-secondary mt-4",to:"/customers",children:"Back to customers"})]});const{customer:u,history:h,sessions:d,quotes:f,orders:m,covers:p,audits:_}=e,v=w=>async()=>{l(!0);try{await w(),await c()}finally{l(!1)}},x=async w=>{await So.update(u.id,u.uuid,w,"Ray"),a(""),c()},S=async w=>{await So.createLimb({...w,customer_uuid:s,data_label:"WORKSHOP RECORD"},"Ray"),a(""),c()},b=async w=>{await So.createProsthesis(w,"Ray"),a(""),c()},y=h.projects[0],I=v(()=>y?WR.create({project_uuid:y.uuid,customer_uuid:s,amount:0,funding_type:"Quote-only"},"Ray"):null),R=h.projects.length>0||p.length>0;return g.jsxs(g.Fragment,{children:[g.jsx(cy,{items:[{label:"Customers",to:"/customers"},{label:u.full_name}]}),g.jsx(vc,{eyebrow:`${u.customer_number} · ${u.data_label}`,title:u.full_name,description:`${u.funding_method||"Funding not selected"} · ${u.approval_status||"Approval not requested"}`,action:g.jsxs("div",{className:"flex flex-wrap gap-2",children:[g.jsxs("button",{className:"btn-secondary",onClick:()=>a("edit"),children:[g.jsx(sBe,{}),"Edit Customer"]}),g.jsxs(Ar,{className:"btn-primary",to:"/new-cover",children:[g.jsx(qpe,{}),"Start New Cover"]}),g.jsx("button",{className:"btn-secondary",onClick:()=>a("limb"),children:"Add Limb Profile"}),g.jsx("button",{className:"btn-secondary",onClick:()=>a("prosthesis"),children:"Add Prosthesis"}),g.jsxs(Ar,{className:"btn-secondary",to:"/measurements",children:[g.jsx(Yp,{}),"Request Measurements"]}),g.jsxs("button",{disabled:o||!y,onClick:I,className:"btn-secondary",children:[g.jsx(JD,{}),"Prepare Quote"]})]})}),g.jsxs("div",{className:"mb-5 flex flex-wrap items-center gap-2",children:[g.jsx(hr,{tone:u.record_state==="archived"?"slate":"green",children:u.record_state==="archived"?"Archived":"Active"}),R&&g.jsx(hr,{tone:"cyan",children:"Returning customer"}),g.jsx($S,{record:u,showAll:!0})]}),n==="edit"&&g.jsx("div",{className:"panel mb-5 p-6",children:g.jsx(Pme,{initial:u,onSave:x,onCancel:()=>a("")})}),n==="limb"&&g.jsx("div",{className:"panel mb-5 p-6",children:g.jsx($3e,{customerUuid:s,onSave:S,onCancel:()=>a("")})}),n==="prosthesis"&&g.jsx("div",{className:"panel mb-5 p-6",children:g.jsx(Y3e,{customerUuid:s,limbs:h.limbs,onSave:b,onCancel:()=>a("")})}),g.jsx("div",{className:"mb-4 flex flex-wrap gap-1.5",children:q3e.map(([w,L])=>g.jsx("button",{onClick:()=>r(w),className:`rounded-lg px-3 py-1.5 text-sm font-medium transition ${i===w?"bg-shire-purple text-white":"border border-shire-border text-slate-400 hover:text-shire-purple-bright"}`,children:L},w))}),i==="overview"&&g.jsxs("div",{className:"grid gap-5 lg:grid-cols-2",children:[g.jsxs("section",{className:"panel p-5",children:[g.jsx("h2",{className:"section-title",children:"Customer Overview"}),g.jsx(La,{rows:[["Customer number",u.customer_number],["Full name",u.full_name],["Preferred name",u.preferred_name],["Date of birth",u.date_of_birth],["Email",u.email],["Phone",u.phone],["Pronouns",u.pronouns],["Billing address",u.address],["Shipping address",u.shipping_address],["Preferred contact",u.preferred_contact_method],["Emergency contact",u.emergency_contact]]})]}),g.jsxs("section",{className:"panel p-5",children:[g.jsx("h2",{className:"section-title",children:"Funding"}),g.jsx(La,{rows:[["Funding method",u.funding_method],["NDIS number",u.ndis_number],["Plan dates",u.plan_dates],["Plan manager",u.plan_manager_name],["Plan manager email",u.plan_manager_email],["Plan manager phone",u.plan_manager_phone],["Billing contact",u.billing_contact],["Purchase order",u.purchase_order_number],["Invoice notes",u.invoice_notes],["Approval status",u.approval_status]]})]}),g.jsxs("section",{className:"panel p-5",children:[g.jsx("h2",{className:"section-title",children:"Record"}),g.jsx(La,{rows:[["Created date",(A=u.created_date)==null?void 0:A.slice(0,10)],["Last activity",(P=u.updated_date)==null?void 0:P.slice(0,10)],["Internal notes",u.internal_notes],["Data origin",u.data_origin],["Returning customer",R?"Yes":"No"]]}),u.record_state==="archived"?g.jsxs("button",{disabled:o,onClick:v(()=>So.restore(u,"Ray")),className:"btn-secondary mt-4",children:[g.jsx(Zp,{}),"Restore customer"]}):g.jsxs("button",{disabled:o,onClick:v(()=>So.archive(u,"Ray")),className:"btn-secondary mt-4",children:[g.jsx(WS,{}),"Archive customer"]})]})]}),i==="limbs"&&g.jsxs("section",{className:"panel p-5",children:[g.jsxs("h2",{className:"section-title",children:["Limb Profiles (",h.limbs.length,")"]}),h.limbs.length?g.jsx("div",{className:"space-y-2",children:h.limbs.map(w=>g.jsxs("div",{className:"rounded-lg border border-white/10 p-3",children:[g.jsxs("div",{className:"flex items-center justify-between",children:[g.jsx("span",{className:"font-medium text-white",children:w.profile_name}),g.jsx(hr,{tone:"cyan",children:w.configuration})]}),g.jsxs("dl",{className:"mt-2 grid grid-cols-2 gap-x-4 gap-y-1 text-sm text-slate-400",children:[g.jsx("dt",{className:"text-slate-500",children:"Interface"}),g.jsx("dd",{children:w.interface_type}),g.jsx("dt",{className:"text-slate-500",children:"Manufacturer / model"}),g.jsxs("dd",{children:[w.prosthesis_manufacturer," ",w.prosthesis_model]}),g.jsx("dt",{className:"text-slate-500",children:"Fitting date"}),g.jsx("dd",{children:w.fitting_date}),g.jsx("dt",{className:"text-slate-500",children:"Related covers"}),g.jsx("dd",{children:h.projects.filter(L=>L.limb_profile_uuid===w.uuid).length})]})]},w.uuid))}):g.jsx("p",{className:"text-sm text-slate-500",children:"No limb profiles recorded."})]}),i==="prostheses"&&g.jsxs("section",{className:"panel p-5",children:[g.jsxs("h2",{className:"section-title",children:["Prostheses (",h.prostheses.length,")"]}),h.prostheses.length?g.jsx("div",{className:"space-y-2",children:h.prostheses.map(w=>g.jsxs("div",{className:"rounded-lg border border-white/10 p-3",children:[g.jsxs("div",{className:"flex items-center justify-between",children:[g.jsx("span",{className:"font-medium text-white",children:w.name}),g.jsx(hr,{tone:w.status==="active"?"green":"slate",children:w.status})]}),g.jsxs("dl",{className:"mt-2 grid grid-cols-2 gap-x-4 gap-y-1 text-sm text-slate-400",children:[g.jsx("dt",{className:"text-slate-500",children:"Manufacturer / model"}),g.jsxs("dd",{children:[w.manufacturer," ",w.model]}),g.jsx("dt",{className:"text-slate-500",children:"Serial"}),g.jsx("dd",{children:w.serial_number}),g.jsx("dt",{className:"text-slate-500",children:"Configuration"}),g.jsx("dd",{children:w.configuration}),g.jsx("dt",{className:"text-slate-500",children:"Fitting date"}),g.jsx("dd",{children:w.fitting_date})]})]},w.uuid))}):g.jsx("p",{className:"text-sm text-slate-500",children:"No prostheses recorded."})]}),i==="measurements"&&g.jsxs("section",{className:"panel p-5",children:[g.jsxs("h2",{className:"section-title",children:["Measurement Sessions (",d.length,")"]}),d.length?g.jsx("div",{className:"space-y-2",children:d.map(w=>g.jsxs(Ar,{to:`/measurements/${w.uuid}`,className:"flex items-center justify-between rounded-lg border border-white/10 px-3 py-2 text-sm hover:border-shire-purple/40",children:[g.jsxs("div",{children:[g.jsx("span",{className:"font-medium text-violet-300",children:w.workflow}),g.jsxs("span",{className:"ml-2 text-xs text-slate-500",children:[w.measured_date," · ",w.measured_by]})]}),g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx(hr,{tone:w.status==="Complete"?"green":"amber",children:w.status}),g.jsxs("span",{className:"text-xs text-slate-500",children:[w.progress_percent||0,"%"]})]})]},w.uuid))}):g.jsx("p",{className:"text-sm text-slate-500",children:"No measurement sessions recorded."})]}),i==="projects"&&g.jsxs("section",{className:"panel p-5",children:[g.jsxs("h2",{className:"section-title",children:["Cover Projects (",h.projects.length,")"]}),h.projects.length?g.jsx("div",{className:"space-y-2",children:h.projects.map(w=>g.jsxs(Ar,{to:`/projects/${w.uuid}`,className:"flex items-center justify-between rounded-lg border border-white/10 px-3 py-2 text-sm hover:border-shire-purple/40",children:[g.jsxs("div",{children:[g.jsx("span",{className:"font-medium text-violet-300",children:w.project_id}),g.jsxs("span",{className:"ml-2 text-xs text-slate-500",children:["Rev ",w.revision]})]}),g.jsx(hr,{tone:w.status==="Complete"?"green":"amber",children:w.status})]},w.uuid))}):g.jsx("p",{className:"text-sm text-slate-500",children:"No cover projects yet."})]}),i==="quotes"&&g.jsxs("section",{className:"panel p-5",children:[g.jsxs("h2",{className:"section-title",children:["Quotes (",f.length,")"]}),f.length?g.jsx("div",{className:"space-y-2",children:f.map(w=>g.jsxs("div",{className:"flex items-center justify-between rounded-lg border border-white/10 px-3 py-2 text-sm",children:[g.jsxs("div",{children:[g.jsx("span",{className:"font-medium text-violet-300",children:w.quote_number}),g.jsx("span",{className:"ml-2 text-xs text-slate-500",children:w.sent_date})]}),g.jsx(hr,{tone:w.approval_status==="Approved"?"green":"amber",children:w.approval_status})]},w.uuid))}):g.jsx("p",{className:"text-sm text-slate-500",children:"No quotes yet."})]}),i==="orders"&&g.jsxs("section",{className:"panel p-5",children:[g.jsxs("h2",{className:"section-title",children:["Orders (",m.length,")"]}),m.length?g.jsx("div",{className:"space-y-2",children:m.map(w=>g.jsxs(Ar,{to:`/orders/${w.uuid}`,className:"flex items-center justify-between rounded-lg border border-white/10 px-3 py-2 text-sm hover:border-shire-purple/40",children:[g.jsxs("div",{children:[g.jsx("span",{className:"font-medium text-violet-300",children:w.order_number}),g.jsx("span",{className:"ml-2 text-xs text-slate-500",children:w.order_date})]}),g.jsx(hr,{tone:w.production_status==="Complete"?"green":"amber",children:w.production_status})]},w.uuid))}):g.jsx("p",{className:"text-sm text-slate-500",children:"No orders yet."})]}),i==="covers"&&g.jsxs("section",{className:"panel p-5",children:[g.jsxs("h2",{className:"section-title",children:["Completed Covers (",p.length,")"]}),p.length?g.jsx("div",{className:"space-y-2",children:p.map(w=>g.jsxs(Ar,{to:`/completed-covers/${w.uuid}`,className:"flex items-center justify-between rounded-lg border border-white/10 px-3 py-2 text-sm hover:border-shire-purple/40",children:[g.jsxs("div",{children:[g.jsx("span",{className:"font-medium text-violet-300",children:w.cover_reference}),g.jsx("span",{className:"ml-2 text-xs text-slate-500",children:w.design_name})]}),g.jsx(hr,{tone:w.inspection_result==="Passed"?"green":"amber",children:w.inspection_result||"Pending"})]},w.uuid))}):g.jsx("p",{className:"text-sm text-slate-500",children:"No completed covers yet."})]}),i==="history"&&g.jsxs("section",{className:"panel p-5",children:[g.jsxs("h2",{className:"section-title",children:[g.jsx(ME,{className:"inline h-4 w-4"})," Audit Timeline"]}),_.length?g.jsx("ol",{className:"space-y-2 text-sm text-slate-400",children:_.map(w=>{var L;return g.jsxs("li",{className:"border-l-2 border-shire-purple/30 pl-3",children:[g.jsx("span",{className:"text-slate-200",children:w.summary}),g.jsxs("span",{className:"ml-2 text-xs text-slate-600",children:[w.actor_name," · ",(L=w.created_date)==null?void 0:L.slice(0,10)]})]},w.uuid)})}):g.jsx("p",{className:"text-sm text-slate-500",children:"No audit events recorded."})]})]})}function K3e({project:s,customer:e,onToggle:t}){var r;const i=s.record_state==="archived";return g.jsxs(Ar,{to:`/projects/${s.uuid}`,className:"panel block p-5 transition hover:border-shire-purple/40",children:[g.jsxs("div",{className:"flex items-start justify-between gap-3",children:[g.jsxs("div",{children:[g.jsxs("p",{className:"text-xs font-semibold text-violet-400",children:[s.project_id," · REV ",s.revision]}),g.jsx("h2",{className:"mt-1 font-semibold text-white",children:(e==null?void 0:e.full_name)||"Unknown customer"}),(e==null?void 0:e.customer_number)&&g.jsx("p",{className:"text-xs text-slate-500",children:e.customer_number})]}),g.jsxs("div",{className:"flex flex-col items-end gap-1",children:[g.jsx(hr,{tone:s.status==="Complete"?"green":i?"slate":"amber",children:i?"Archived":s.status}),g.jsx($S,{record:s})]})]}),g.jsx("p",{className:"mt-3 text-sm text-slate-400",children:s.prosthesis_configuration||"Configuration not set"}),s.reason_for_cover&&g.jsx("p",{className:"mt-2 line-clamp-2 text-xs text-slate-500",children:s.reason_for_cover}),g.jsxs("dl",{className:"mt-3 grid grid-cols-2 gap-x-4 gap-y-1 text-xs text-slate-500",children:[g.jsx("dt",{children:"Due"}),g.jsx("dd",{className:"text-slate-400",children:s.due_date||"not set"}),g.jsx("dt",{children:"Last activity"}),g.jsx("dd",{className:"text-slate-400",children:(r=s.updated_date)==null?void 0:r.slice(0,10)})]}),g.jsxs("div",{className:"mt-4 flex items-center gap-2",children:[g.jsxs("span",{className:"btn-primary flex-1 text-center text-sm",children:[g.jsx(Jpe,{}),"Open Project"]}),t&&g.jsx("button",{onClick:n=>{n.preventDefault(),t(s)},className:"icon-btn","aria-label":i?"Restore project":"Archive project",children:i?g.jsx(Zp,{}):g.jsx(WS,{})})]})]})}function Q3e(){const[s]=aLe(),[e,t]=Te.useState([]),[i,r]=Te.useState([]),[n,a]=Te.useState(""),[o,l]=Te.useState(!0),[c,u]=Te.useState("All"),h=()=>{Promise.all([au.list(),So.list()]).then(([_,v])=>{t(_),r(v)})};Te.useEffect(()=>{h()},[]);const d=_=>i.find(v=>v.uuid===_),f=Te.useMemo(()=>["All",...new Set((e||[]).map(_=>_.status).filter(Boolean))],[e]),m=Te.useMemo(()=>{let _=o?W0.hideFictional(e):e;if(c!=="All"&&(_=_.filter(v=>v.status===c)),s.get("status")&&(_=_.filter(v=>v.status===s.get("status"))),s.get("active")==="true"&&(_=_.filter(v=>v.record_state!=="archived"&&v.status!=="Complete")),s.get("project")&&(_=_.filter(v=>v.uuid===s.get("project"))),n.trim()){const v=n.toLowerCase();_=_.filter(x=>{var S;return(x.project_id||"").toLowerCase().includes(v)||(((S=d(x.customer_uuid))==null?void 0:S.full_name)||"").toLowerCase().includes(v)||(x.prosthesis_configuration||"").toLowerCase().includes(v)})}return _},[e,o,c,n,s,i]),p=async _=>{_.record_state==="archived"?await au.restore(_):await au.archive(_),h()};return g.jsxs(g.Fragment,{children:[g.jsx(vc,{eyebrow:"Cover project register",title:"Cover Projects",description:"Every project keeps a stable portable identifier, revision and logical SHiREVault destination. Click any project to open the Designer workspace."}),g.jsxs("div",{className:"mb-5 flex flex-wrap items-center gap-2",children:[g.jsxs("label",{className:"relative block",children:[g.jsx(jS,{className:"absolute left-3 top-3 h-4 w-4 text-slate-500"}),g.jsx("input",{className:"workshop-input mt-0 pl-10",placeholder:"Search project reference or customer",value:n,onChange:_=>a(_.target.value)})]}),g.jsx("select",{className:"workshop-input mt-0 max-w-xs",value:c,onChange:_=>u(_.target.value),children:f.map(_=>g.jsx("option",{children:_},_))}),g.jsx(KO,{value:o,onChange:l})]}),g.jsx("div",{className:"grid gap-4 md:grid-cols-2 xl:grid-cols-3",children:m.map(_=>g.jsx(K3e,{project:_,customer:d(_.customer_uuid),onToggle:p},_.uuid))}),m.length===0&&g.jsx("p",{className:"mt-8 text-center text-sm text-slate-500",children:"No projects match the current filter."})]})}var eY={},tY;function J3e(){if(tY)return eY;tY=1;function s(){typeof Symbol<"u"&&!Symbol.metadata&&Object.defineProperty(Symbol,"metadata",{configurable:!0,writable:!0,value:Symbol("Symbol.metadata")})}return s(),eY}J3e();class Yd{constructor(){this.hoverCursor="",this.actions=[],this.isRecursive=!1,this.disposeWhenUnowned=!0}static get HasTriggers(){for(const e in Yd.Triggers)if(Object.prototype.hasOwnProperty.call(Yd.Triggers,e))return!0;return!1}static get HasPickTriggers(){for(const e in Yd.Triggers)if(Object.prototype.hasOwnProperty.call(Yd.Triggers,e)){const t=parseInt(e);if(t>=1&&t<=7)return!0}return!1}static HasSpecificTrigger(e){for(const t in Yd.Triggers)if(Object.prototype.hasOwnProperty.call(Yd.Triggers,t)&&parseInt(t)===e)return!0;return!1}}Yd.Triggers={};const eke=typeof WeakRef<"u";class Ume{constructor(e,t=!1,i,r){this.initialize(e,t,i,r)}initialize(e,t=!1,i,r){return this.mask=e,this.skipNextObservers=t,this.target=i,this.currentTarget=r,this}}class tke{constructor(e,t,i=null){this.callback=e,this.mask=t,this.scope=i,this._willBeUnregistered=!1,this.unregisterOnNextCall=!1,this._remove=null}remove(e=!1){this._remove&&this._remove(e)}}class Ge{static FromPromise(e,t){const i=new Ge;return e.then(r=>{i.notifyObservers(r)}).catch(r=>{if(t)t.notifyObservers(r);else throw r}),i}get observers(){return this._observers}constructor(e,t=!1){this.notifyIfTriggered=t,this._observers=new Array,this._numObserversMarkedAsDeleted=0,this._hasNotified=!1,this._eventState=new Ume(0),e&&(this._onObserverAdded=e)}add(e,t=-1,i=!1,r=null,n=!1){if(!e)return null;const a=new tke(e,t,r);a.unregisterOnNextCall=n,i?this._observers.unshift(a):this._observers.push(a),this._onObserverAdded&&this._onObserverAdded(a),this._hasNotified&&this.notifyIfTriggered&&this._lastNotifiedValue!==void 0&&this.notifyObserver(a,this._lastNotifiedValue);const o=eke?new WeakRef(this):{deref:()=>this};return a._remove=(l=!1)=>{const c=o.deref();c&&(l?c.remove(a):c._remove(a))},a}addOnce(e){return this.add(e,void 0,void 0,void 0,!0)}remove(e){return e?(e._remove=null,this._observers.indexOf(e)!==-1?(this._deferUnregister(e),!0):!1):!1}removeCallback(e,t){for(let i=0;i{this._remove(e)},0))}_remove(e,t=!0){if(!e)return!1;const i=this._observers.indexOf(e);return i!==-1?(t&&this._numObserversMarkedAsDeleted--,this._observers.splice(i,1),!0):!1}makeObserverTopPriority(e){this._remove(e,!1),this._observers.unshift(e)}makeObserverBottomPriority(e){this._remove(e,!1),this._observers.push(e)}notifyObservers(e,t=-1,i,r,n){if(this.notifyIfTriggered&&(this._hasNotified=!0,this._lastNotifiedValue=e),!this._observers.length)return!0;const a=this._eventState;a.mask=t,a.target=i,a.currentTarget=r,a.skipNextObservers=!1,a.lastReturnValue=e,a.userInfo=n;for(const o of this._observers)if(!o._willBeUnregistered&&(o.mask&t&&(o.unregisterOnNextCall&&this._deferUnregister(o),o.scope?a.lastReturnValue=o.callback.apply(o.scope,[e,a]):a.lastReturnValue=o.callback(e,a)),a.skipNextObservers))return!1;return!0}notifyObserver(e,t,i=-1){if(this.notifyIfTriggered&&(this._hasNotified=!0,this._lastNotifiedValue=t),e._willBeUnregistered)return;const r=this._eventState;r.mask=i,r.skipNextObservers=!1,e.unregisterOnNextCall&&this._deferUnregister(e),e.callback(t,r)}hasObservers(){return this._observers.length-this._numObserversMarkedAsDeleted>0}clear(){for(;this._observers.length;){const e=this._observers.pop();e&&(e._remove=null)}this._onObserverAdded=null,this._numObserversMarkedAsDeleted=0,this.cleanLastNotifiedState()}cleanLastNotifiedState(){this._hasNotified=!1,this._lastNotifiedValue=void 0}clone(){const e=new Ge;return e._observers=this._observers.slice(0),e}hasSpecificMask(e=-1){for(const t of this._observers)if(t.mask&e||t.mask===e)return!0;return!1}}const sR=1/2.2,TD=2.2,Lo=(1+Math.sqrt(5))/2;let rr=.001;function Hf(s,e){const t=[];for(let i=0;i{const n=r.previous;if(!n)return;const a=r.next;a?(n.next=a,a.previous=n):(n.next=void 0,s[e]=n),r.next=void 0,r.previous=void 0}}const rke=["push","splice","pop","shift","unshift"];function Gme(s,e){const t=rke.map(i=>ike(s,i,e));return()=>{for(const i of t)i==null||i()}}class zl{static SetMatrixPrecision(e){if(zl.MatrixTrackPrecisionChange=!1,e&&!zl.MatrixUse64Bits&&zl.MatrixTrackedMatrices)for(let t=0;tt+i}function ni(s,e){return s===e?s:Math.random()*(e-s)+s}function Qa(s,e,t){return s+(e-s)*t}function nke(s,e,t){let i=QO(e-s,360);return i>180&&(i-=360),s+i*_r(t)}function ake(s,e,t){let i;return s!=e?i=_r((t-s)/(e-s)):i=0,i}function zme(s,e,t,i,r){const n=r*r,a=r*n,o=2*a-3*n+1,l=-2*a+3*n,c=a-2*n+r,u=a-n;return s*o+t*l+e*c+i*u}function oke(s,e,t,i,r){const n=r*r;return(n-r)*6*s+(3*n-4*r+1)*e+(-n+r)*6*t+(3*n-2*r)*i}function _r(s,e=0,t=1){return Math.min(t,Math.max(e,s))}function iT(s){return s-=Math.PI*2*Math.floor((s+Math.PI)/(Math.PI*2)),s}function wm(s){const e=s.toString(16);return s<=15?("0"+e).toUpperCase():e.toUpperCase()}function VT(s){if(Math.log2)return Math.floor(Math.log2(s));if(s<0)return NaN;if(s===0)return-1/0;let e=0;if(s<1){for(;s<1;)e++,s=s*2;e=-e}else if(s>1)for(;s>1;)e++,s=Math.floor(s/2);return e}function QO(s,e){return s-Math.floor(s/e)*e}function lke(s,e,t){return(s-e)/(t-e)}function cke(s,e,t){return s*(t-e)+e}function Wme(s,e){let t=QO(e-s,360);return t>180&&(t-=360),t}function uke(s,e){const t=QO(s,e*2);return e-Math.abs(t-e)}function hke(s,e,t){let i=_r(t);return i=-2*i*i*i+3*i*i,e*i+s*(1-i)}function Hme(s,e,t){let i;return Math.abs(e-s)<=t?i=e:i=s+Math.sign(e-s)*t,i}function dke(s,e,t){const i=Wme(s,e);let r;return-tparseInt(s.toString().replace(/\W/g,""));let vt=class js{constructor(e=0,t=0){this.x=e,this.y=t}toString(){return`{X: ${this.x} Y: ${this.y}}`}getClassName(){return"Vector2"}getHashCode(){const e=nd(this.x),t=nd(this.y);let i=e;return i=i*397^t,i}toArray(e,t=0){return e[t]=this.x,e[t+1]=this.y,this}fromArray(e,t=0){return js.FromArrayToRef(e,t,this),this}asArray(){return[this.x,this.y]}copyFrom(e){return this.x=e.x,this.y=e.y,this}copyFromFloats(e,t){return this.x=e,this.y=t,this}set(e,t){return this.copyFromFloats(e,t)}setAll(e){return this.copyFromFloats(e,e)}add(e){return new js(this.x+e.x,this.y+e.y)}addToRef(e,t){return t.x=this.x+e.x,t.y=this.y+e.y,t}addInPlace(e){return this.x+=e.x,this.y+=e.y,this}addInPlaceFromFloats(e,t){return this.x+=e,this.y+=t,this}addVector3(e){return new js(this.x+e.x,this.y+e.y)}subtract(e){return new js(this.x-e.x,this.y-e.y)}subtractToRef(e,t){return t.x=this.x-e.x,t.y=this.y-e.y,t}subtractInPlace(e){return this.x-=e.x,this.y-=e.y,this}multiplyInPlace(e){return this.x*=e.x,this.y*=e.y,this}multiply(e){return new js(this.x*e.x,this.y*e.y)}multiplyToRef(e,t){return t.x=this.x*e.x,t.y=this.y*e.y,t}multiplyByFloats(e,t){return new js(this.x*e,this.y*t)}divide(e){return new js(this.x/e.x,this.y/e.y)}divideToRef(e,t){return t.x=this.x/e.x,t.y=this.y/e.y,t}divideInPlace(e){return this.x=this.x/e.x,this.y=this.y/e.y,this}minimizeInPlace(e){return this.minimizeInPlaceFromFloats(e.x,e.y)}maximizeInPlace(e){return this.maximizeInPlaceFromFloats(e.x,e.y)}minimizeInPlaceFromFloats(e,t){return this.x=Math.min(e,this.x),this.y=Math.min(t,this.y),this}maximizeInPlaceFromFloats(e,t){return this.x=Math.max(e,this.x),this.y=Math.max(t,this.y),this}subtractFromFloats(e,t){return new js(this.x-e,this.y-t)}subtractFromFloatsToRef(e,t,i){return i.x=this.x-e,i.y=this.y-t,i}negate(){return new js(-this.x,-this.y)}negateInPlace(){return this.x*=-1,this.y*=-1,this}negateToRef(e){return e.x=-this.x,e.y=-this.y,e}scaleInPlace(e){return this.x*=e,this.y*=e,this}scale(e){return new js(this.x*e,this.y*e)}scaleToRef(e,t){return t.x=this.x*e,t.y=this.y*e,t}scaleAndAddToRef(e,t){return t.x+=this.x*e,t.y+=this.y*e,t}equals(e){return e&&this.x===e.x&&this.y===e.y}equalsWithEpsilon(e,t=rr){return e&&fs(this.x,e.x,t)&&fs(this.y,e.y,t)}equalsToFloats(e,t){return this.x===e&&this.y===t}floor(){return new js(Math.floor(this.x),Math.floor(this.y))}floorToRef(e){return e.x=Math.floor(this.x),e.y=Math.floor(this.y),e}fract(){return new js(this.x-Math.floor(this.x),this.y-Math.floor(this.y))}fractToRef(e){return e.x=this.x-Math.floor(this.x),e.y=this.y-Math.floor(this.y),e}rotate(e){return this.rotateToRef(e,new js)}rotateToRef(e,t){const i=Math.cos(e),r=Math.sin(e);return t.x=i*this.x-r*this.y,t.y=r*this.x+i*this.y,t}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}lengthSquared(){return this.x*this.x+this.y*this.y}normalize(){return this.normalizeFromLength(this.length())}normalizeFromLength(e){return e===0||e===1?this:this.scaleInPlace(1/e)}normalizeToNew(){const e=new js;return this.normalizeToRef(e),e}normalizeToRef(e){const t=this.length();return t===0&&(e.x=this.x,e.y=this.y),this.scaleToRef(1/t,e)}clone(){return new js(this.x,this.y)}dot(e){return this.x*e.x+this.y*e.y}static Zero(){return new js(0,0)}static One(){return new js(1,1)}static Random(e=0,t=1){return new js(ni(e,t),ni(e,t))}static RandomToRef(e=0,t=1,i){return i.copyFromFloats(ni(e,t),ni(e,t))}static get ZeroReadOnly(){return js._ZeroReadOnly}static FromArray(e,t=0){return new js(e[t],e[t+1])}static FromArrayToRef(e,t,i){return i.x=e[t],i.y=e[t+1],i}static FromFloatsToRef(e,t,i){return i.copyFromFloats(e,t),i}static CatmullRom(e,t,i,r,n){const a=n*n,o=n*a,l=.5*(2*t.x+(-e.x+i.x)*n+(2*e.x-5*t.x+4*i.x-r.x)*a+(-e.x+3*t.x-3*i.x+r.x)*o),c=.5*(2*t.y+(-e.y+i.y)*n+(2*e.y-5*t.y+4*i.y-r.y)*a+(-e.y+3*t.y-3*i.y+r.y)*o);return new js(l,c)}static ClampToRef(e,t,i,r){return r.x=_r(e.x,t.x,i.x),r.y=_r(e.y,t.y,i.y),r}static Clamp(e,t,i){const r=_r(e.x,t.x,i.x),n=_r(e.y,t.y,i.y);return new js(r,n)}static Hermite(e,t,i,r,n){const a=n*n,o=n*a,l=2*o-3*a+1,c=-2*o+3*a,u=o-2*a+n,h=o-a,d=e.x*l+i.x*c+t.x*u+r.x*h,f=e.y*l+i.y*c+t.y*u+r.y*h;return new js(d,f)}static Hermite1stDerivative(e,t,i,r,n){return this.Hermite1stDerivativeToRef(e,t,i,r,n,new js)}static Hermite1stDerivativeToRef(e,t,i,r,n,a){const o=n*n;return a.x=(o-n)*6*e.x+(3*o-4*n+1)*t.x+(-o+n)*6*i.x+(3*o-2*n)*r.x,a.y=(o-n)*6*e.y+(3*o-4*n+1)*t.y+(-o+n)*6*i.y+(3*o-2*n)*r.y,a}static Lerp(e,t,i){return js.LerpToRef(e,t,i,new js)}static LerpToRef(e,t,i,r){return r.x=e.x+(t.x-e.x)*i,r.y=e.y+(t.y-e.y)*i,r}static Dot(e,t){return e.x*t.x+e.y*t.y}static Normalize(e){return js.NormalizeToRef(e,new js)}static NormalizeToRef(e,t){return e.normalizeToRef(t),t}static Minimize(e,t){const i=e.xt.x?e.x:t.x,r=e.y>t.y?e.y:t.y;return new js(i,r)}static Transform(e,t){return js.TransformToRef(e,t,new js)}static TransformToRef(e,t,i){const r=t.m,n=e.x*r[0]+e.y*r[4]+r[12],a=e.x*r[1]+e.y*r[5]+r[13];return i.x=n,i.y=a,i}static PointInTriangle(e,t,i,r){const n=.5*(-i.y*r.x+t.y*(-i.x+r.x)+t.x*(i.y-r.y)+i.x*r.y),a=n<0?-1:1,o=(t.y*r.x-t.x*r.y+(r.y-t.y)*e.x+(t.x-r.x)*e.y)*a,l=(t.x*i.y-t.y*i.x+(t.y-i.y)*e.x+(i.x-t.x)*e.y)*a;return o>0&&l>0&&o+l<2*n*a}static Distance(e,t){return Math.sqrt(js.DistanceSquared(e,t))}static DistanceSquared(e,t){const i=e.x-t.x,r=e.y-t.y;return i*i+r*r}static Center(e,t){return js.CenterToRef(e,t,new js)}static CenterToRef(e,t,i){return i.copyFromFloats((e.x+t.x)/2,(e.y+t.y)/2)}static DistanceOfPointFromSegment(e,t,i){const r=js.DistanceSquared(t,i);if(r===0)return js.Distance(e,t);const n=i.subtract(t),a=Math.max(0,Math.min(1,js.Dot(e.subtract(t),n)/r)),o=t.add(n.multiplyByFloats(a,a));return js.Distance(e,o)}};vt._V8PerformanceHack=new vt(.5,.5);vt._ZeroReadOnly=vt.Zero();let O=class xi{get x(){return this._x}set x(e){this._x=e,this._isDirty=!0}get y(){return this._y}set y(e){this._y=e,this._isDirty=!0}get z(){return this._z}set z(e){this._z=e,this._isDirty=!0}constructor(e=0,t=0,i=0){this._isDirty=!0,this._x=e,this._y=t,this._z=i}toString(){return`{X: ${this._x} Y: ${this._y} Z: ${this._z}}`}getClassName(){return"Vector3"}getHashCode(){const e=nd(this._x),t=nd(this._y),i=nd(this._z);let r=e;return r=r*397^t,r=r*397^i,r}asArray(){return[this._x,this._y,this._z]}toArray(e,t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,this}fromArray(e,t=0){return xi.FromArrayToRef(e,t,this),this}toQuaternion(){return gt.RotationYawPitchRoll(this._y,this._x,this._z)}addInPlace(e){return this._x+=e._x,this._y+=e._y,this._z+=e._z,this._isDirty=!0,this}addInPlaceFromFloats(e,t,i){return this._x+=e,this._y+=t,this._z+=i,this._isDirty=!0,this}add(e){return new xi(this._x+e._x,this._y+e._y,this._z+e._z)}addToRef(e,t){return t._x=this._x+e._x,t._y=this._y+e._y,t._z=this._z+e._z,t._isDirty=!0,t}subtractInPlace(e){return this._x-=e._x,this._y-=e._y,this._z-=e._z,this._isDirty=!0,this}subtract(e){return new xi(this._x-e._x,this._y-e._y,this._z-e._z)}subtractToRef(e,t){return this.subtractFromFloatsToRef(e._x,e._y,e._z,t)}subtractFromFloats(e,t,i){return new xi(this._x-e,this._y-t,this._z-i)}subtractFromFloatsToRef(e,t,i,r){return r._x=this._x-e,r._y=this._y-t,r._z=this._z-i,r._isDirty=!0,r}negate(){return new xi(-this._x,-this._y,-this._z)}negateInPlace(){return this._x*=-1,this._y*=-1,this._z*=-1,this._isDirty=!0,this}negateToRef(e){return e._x=this._x*-1,e._y=this._y*-1,e._z=this._z*-1,e._isDirty=!0,e}scaleInPlace(e){return this._x*=e,this._y*=e,this._z*=e,this._isDirty=!0,this}scale(e){return new xi(this._x*e,this._y*e,this._z*e)}scaleToRef(e,t){return t._x=this._x*e,t._y=this._y*e,t._z=this._z*e,t._isDirty=!0,t}getNormalToRef(e){const t=this.length();let i=Math.acos(this._y/t);const r=Math.atan2(this._z,this._x);i>Math.PI/2?i-=Math.PI/2:i+=Math.PI/2;const n=t*Math.sin(i)*Math.cos(r),a=t*Math.cos(i),o=t*Math.sin(i)*Math.sin(r);return e.set(n,a,o),e}applyRotationQuaternionToRef(e,t){const i=this._x,r=this._y,n=this._z,a=e._x,o=e._y,l=e._z,c=e._w,u=2*(o*n-l*r),h=2*(l*i-a*n),d=2*(a*r-o*i);return t._x=i+c*u+o*d-l*h,t._y=r+c*h+l*u-a*d,t._z=n+c*d+a*h-o*u,t._isDirty=!0,t}applyRotationQuaternionInPlace(e){return this.applyRotationQuaternionToRef(e,this)}applyRotationQuaternion(e){return this.applyRotationQuaternionToRef(e,new xi)}scaleAndAddToRef(e,t){return t._x+=this._x*e,t._y+=this._y*e,t._z+=this._z*e,t._isDirty=!0,t}projectOnPlane(e,t){return this.projectOnPlaneToRef(e,t,new xi)}projectOnPlaneToRef(e,t,i){const r=e.normal,n=e.d,a=Ci.Vector3[0];this.subtractToRef(t,a),a.normalize();const o=xi.Dot(a,r);if(Math.abs(o)<1e-10)i.setAll(1/0);else{const l=-(xi.Dot(t,r)+n)/o,c=a.scaleInPlace(l);t.addToRef(c,i)}return i}equals(e){return e&&this._x===e._x&&this._y===e._y&&this._z===e._z}equalsWithEpsilon(e,t=rr){return e&&fs(this._x,e._x,t)&&fs(this._y,e._y,t)&&fs(this._z,e._z,t)}equalsToFloats(e,t,i){return this._x===e&&this._y===t&&this._z===i}multiplyInPlace(e){return this._x*=e._x,this._y*=e._y,this._z*=e._z,this._isDirty=!0,this}multiply(e){return this.multiplyByFloats(e._x,e._y,e._z)}multiplyToRef(e,t){return t._x=this._x*e._x,t._y=this._y*e._y,t._z=this._z*e._z,t._isDirty=!0,t}multiplyByFloats(e,t,i){return new xi(this._x*e,this._y*t,this._z*i)}divide(e){return new xi(this._x/e._x,this._y/e._y,this._z/e._z)}divideToRef(e,t){return t._x=this._x/e._x,t._y=this._y/e._y,t._z=this._z/e._z,t._isDirty=!0,t}divideInPlace(e){return this._x=this._x/e._x,this._y=this._y/e._y,this._z=this._z/e._z,this._isDirty=!0,this}minimizeInPlace(e){return this.minimizeInPlaceFromFloats(e._x,e._y,e._z)}maximizeInPlace(e){return this.maximizeInPlaceFromFloats(e._x,e._y,e._z)}minimizeInPlaceFromFloats(e,t,i){return ethis._x&&(this.x=e),t>this._y&&(this.y=t),i>this._z&&(this.z=i),this}isNonUniformWithinEpsilon(e){const t=Math.abs(this._x),i=Math.abs(this._y);if(!fs(t,i,e))return!0;const r=Math.abs(this._z);return!fs(t,r,e)||!fs(i,r,e)}get isNonUniform(){const e=Math.abs(this._x),t=Math.abs(this._y);if(e!==t)return!0;const i=Math.abs(this._z);return e!==i}floorToRef(e){return e._x=Math.floor(this._x),e._y=Math.floor(this._y),e._z=Math.floor(this._z),e._isDirty=!0,e}floor(){return new xi(Math.floor(this._x),Math.floor(this._y),Math.floor(this._z))}fractToRef(e){return e._x=this._x-Math.floor(this._x),e._y=this._y-Math.floor(this._y),e._z=this._z-Math.floor(this._z),e._isDirty=!0,e}fract(){return new xi(this._x-Math.floor(this._x),this._y-Math.floor(this._y),this._z-Math.floor(this._z))}length(){return Math.sqrt(this.lengthSquared())}lengthSquared(){return this._x*this._x+this._y*this._y+this._z*this._z}get hasAZeroComponent(){return this._x*this._y*this._z===0}normalize(){return this.normalizeFromLength(this.length())}reorderInPlace(e){if(e=e.toLowerCase(),e==="xyz")return this;const t=Ci.Vector3[0].copyFrom(this);return this.x=t[e[0]],this.y=t[e[1]],this.z=t[e[2]],this}rotateByQuaternionToRef(e,t){return e.toRotationMatrix(Ci.Matrix[0]),xi.TransformCoordinatesToRef(this,Ci.Matrix[0],t),t}rotateByQuaternionAroundPointToRef(e,t,i){return this.subtractToRef(t,Ci.Vector3[0]),Ci.Vector3[0].rotateByQuaternionToRef(e,Ci.Vector3[0]),t.addToRef(Ci.Vector3[0],i),i}cross(e){return xi.CrossToRef(this,e,new xi)}normalizeFromLength(e){return e===0||e===1?this:this.scaleInPlace(1/e)}normalizeToNew(){return this.normalizeToRef(new xi)}normalizeToRef(e){const t=this.length();return t===0||t===1?(e._x=this._x,e._y=this._y,e._z=this._z,e._isDirty=!0,e):this.scaleToRef(1/t,e)}clone(){return new xi(this._x,this._y,this._z)}copyFrom(e){return this.copyFromFloats(e._x,e._y,e._z)}copyFromFloats(e,t,i){return this._x=e,this._y=t,this._z=i,this._isDirty=!0,this}set(e,t,i){return this.copyFromFloats(e,t,i)}setAll(e){return this._x=this._y=this._z=e,this._isDirty=!0,this}static GetClipFactor(e,t,i,r){const n=xi.Dot(e,i),a=xi.Dot(t,i);return(n-r)/(n-a)}static GetAngleBetweenVectors(e,t,i){const r=e.normalizeToRef(Ci.Vector3[1]),n=t.normalizeToRef(Ci.Vector3[2]);let a=xi.Dot(r,n);a=_r(a,-1,1);const o=Math.acos(a),l=Ci.Vector3[3];return xi.CrossToRef(r,n,l),xi.Dot(l,i)>0?isNaN(o)?0:o:isNaN(o)?-Math.PI:-Math.acos(a)}static GetAngleBetweenVectorsOnPlane(e,t,i){Ci.Vector3[0].copyFrom(e);const r=Ci.Vector3[0];Ci.Vector3[1].copyFrom(t);const n=Ci.Vector3[1];Ci.Vector3[2].copyFrom(i);const a=Ci.Vector3[2],o=Ci.Vector3[3],l=Ci.Vector3[4];r.normalize(),n.normalize(),a.normalize(),xi.CrossToRef(a,r,o),xi.CrossToRef(o,a,l);const c=Math.atan2(xi.Dot(n,o),xi.Dot(n,l));return iT(c)}static PitchYawRollToMoveBetweenPointsToRef(e,t,i){const r=Ae.Vector3[0];return t.subtractToRef(e,r),i._y=Math.atan2(r.x,r.z)||0,i._x=Math.atan2(Math.sqrt(r.x**2+r.z**2),r.y)||0,i._z=0,i._isDirty=!0,i}static PitchYawRollToMoveBetweenPoints(e,t){const i=xi.Zero();return xi.PitchYawRollToMoveBetweenPointsToRef(e,t,i)}static SlerpToRef(e,t,i,r){i=_r(i,0,1);const n=Ci.Vector3[0],a=Ci.Vector3[1];n.copyFrom(e);const o=n.length();n.normalizeFromLength(o),a.copyFrom(t);const l=a.length();a.normalizeFromLength(l);const c=xi.Dot(n,a);let u,h;if(c<1-rr){const d=Math.acos(c),f=1/Math.sin(d);u=Math.sin((1-i)*d)*f,h=Math.sin(i*d)*f}else u=1-i,h=i;return n.scaleInPlace(u),a.scaleInPlace(h),r.copyFrom(n).addInPlace(a),r.scaleInPlace(Qa(o,l,i)),r}static SmoothToRef(e,t,i,r,n){return xi.SlerpToRef(e,t,r===0?1:i/r,n),n}static FromArray(e,t=0){return new xi(e[t],e[t+1],e[t+2])}static FromFloatArray(e,t){return xi.FromArray(e,t)}static FromArrayToRef(e,t,i){return i._x=e[t],i._y=e[t+1],i._z=e[t+2],i._isDirty=!0,i}static FromFloatArrayToRef(e,t,i){return xi.FromArrayToRef(e,t,i)}static FromFloatsToRef(e,t,i,r){return r.copyFromFloats(e,t,i),r}static Zero(){return new xi(0,0,0)}static One(){return new xi(1,1,1)}static Up(){return new xi(0,1,0)}static get UpReadOnly(){return xi._UpReadOnly}static get DownReadOnly(){return xi._DownReadOnly}static get RightReadOnly(){return xi._RightReadOnly}static get LeftReadOnly(){return xi._LeftReadOnly}static get LeftHandedForwardReadOnly(){return xi._LeftHandedForwardReadOnly}static get RightHandedForwardReadOnly(){return xi._RightHandedForwardReadOnly}static get LeftHandedBackwardReadOnly(){return xi._LeftHandedBackwardReadOnly}static get RightHandedBackwardReadOnly(){return xi._RightHandedBackwardReadOnly}static get ZeroReadOnly(){return xi._ZeroReadOnly}static get OneReadOnly(){return xi._OneReadOnly}static Down(){return new xi(0,-1,0)}static Forward(e=!1){return new xi(0,0,e?-1:1)}static Backward(e=!1){return new xi(0,0,e?1:-1)}static Right(){return new xi(1,0,0)}static Left(){return new xi(-1,0,0)}static Random(e=0,t=1){return new xi(ni(e,t),ni(e,t),ni(e,t))}static RandomToRef(e=0,t=1,i){return i.copyFromFloats(ni(e,t),ni(e,t),ni(e,t))}static TransformCoordinates(e,t){const i=xi.Zero();return xi.TransformCoordinatesToRef(e,t,i),i}static TransformCoordinatesToRef(e,t,i){return xi.TransformCoordinatesFromFloatsToRef(e._x,e._y,e._z,t,i),i}static TransformCoordinatesFromFloatsToRef(e,t,i,r,n){const a=r.m,o=e*a[0]+t*a[4]+i*a[8]+a[12],l=e*a[1]+t*a[5]+i*a[9]+a[13],c=e*a[2]+t*a[6]+i*a[10]+a[14],u=1/(e*a[3]+t*a[7]+i*a[11]+a[15]);return n._x=o*u,n._y=l*u,n._z=c*u,n._isDirty=!0,n}static TransformNormal(e,t){const i=xi.Zero();return xi.TransformNormalToRef(e,t,i),i}static TransformNormalToRef(e,t,i){return this.TransformNormalFromFloatsToRef(e._x,e._y,e._z,t,i),i}static TransformNormalFromFloatsToRef(e,t,i,r,n){const a=r.m;return n._x=e*a[0]+t*a[4]+i*a[8],n._y=e*a[1]+t*a[5]+i*a[9],n._z=e*a[2]+t*a[6]+i*a[10],n._isDirty=!0,n}static CatmullRom(e,t,i,r,n){const a=n*n,o=n*a,l=.5*(2*t._x+(-e._x+i._x)*n+(2*e._x-5*t._x+4*i._x-r._x)*a+(-e._x+3*t._x-3*i._x+r._x)*o),c=.5*(2*t._y+(-e._y+i._y)*n+(2*e._y-5*t._y+4*i._y-r._y)*a+(-e._y+3*t._y-3*i._y+r._y)*o),u=.5*(2*t._z+(-e._z+i._z)*n+(2*e._z-5*t._z+4*i._z-r._z)*a+(-e._z+3*t._z-3*i._z+r._z)*o);return new xi(l,c,u)}static Clamp(e,t,i){const r=new xi;return xi.ClampToRef(e,t,i,r),r}static ClampToRef(e,t,i,r){let n=e._x;n=n>i._x?i._x:n,n=ni._y?i._y:a,a=ai._z?i._z:o,o=o0&&w<0?(k.copyFrom(a),V=t,U=i):w>0&&L<0?(k.copyFrom(l),V=i,U=r):(k.copyFrom(o).scaleInPlace(-1),V=r,U=t);const ne=Ci.Vector3[9],oe=Ci.Vector3[4];if(V.subtractToRef(x,I),U.subtractToRef(x,ne),xi.CrossToRef(I,ne,oe),!(xi.Dot(oe,c)<0))return n.copyFrom(x),Math.abs(p*_);const Y=Ci.Vector3[5];xi.CrossToRef(k,oe,Y),Y.normalize();const te=Ci.Vector3[9];te.copyFrom(V).subtractInPlace(x);const Z=te.length();if(Zthis._x&&(this.x=e.x),e.y>this._y&&(this.y=e.y),e.z>this._z&&(this.z=e.z),e.w>this._w&&(this.w=e.w),this}minimizeInPlaceFromFloats(e,t,i,r){return this.x=Math.min(e,this._x),this.y=Math.min(t,this._y),this.z=Math.min(i,this._z),this.w=Math.min(r,this._w),this}maximizeInPlaceFromFloats(e,t,i,r){return this.x=Math.max(e,this._x),this.y=Math.max(t,this._y),this.z=Math.max(i,this._z),this.w=Math.max(r,this._w),this}floorToRef(e){return e.x=Math.floor(this._x),e.y=Math.floor(this._y),e.z=Math.floor(this._z),e.w=Math.floor(this._w),e}floor(){return new Tn(Math.floor(this._x),Math.floor(this._y),Math.floor(this._z),Math.floor(this._w))}fractToRef(e){return e.x=this._x-Math.floor(this._x),e.y=this._y-Math.floor(this._y),e.z=this._z-Math.floor(this._z),e.w=this._w-Math.floor(this._w),e}fract(){return new Tn(this._x-Math.floor(this._x),this._y-Math.floor(this._y),this._z-Math.floor(this._z),this._w-Math.floor(this._w))}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}lengthSquared(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}normalize(){return this.normalizeFromLength(this.length())}normalizeFromLength(e){return e===0||e===1?this:this.scaleInPlace(1/e)}normalizeToNew(){return this.normalizeToRef(new Tn)}normalizeToRef(e){const t=this.length();return t===0||t===1?(e.x=this._x,e.y=this._y,e.z=this._z,e.w=this._w,e):this.scaleToRef(1/t,e)}toVector3(){return new O(this._x,this._y,this._z)}clone(){return new Tn(this._x,this._y,this._z,this._w)}copyFrom(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w,this}copyFromFloats(e,t,i,r){return this.x=e,this.y=t,this.z=i,this.w=r,this}set(e,t,i,r){return this.copyFromFloats(e,t,i,r)}setAll(e){return this.x=this.y=this.z=this.w=e,this}dot(e){return this._x*e.x+this._y*e.y+this._z*e.z+this._w*e.w}static FromArray(e,t){return t||(t=0),new Tn(e[t],e[t+1],e[t+2],e[t+3])}static FromArrayToRef(e,t,i){return i.x=e[t],i.y=e[t+1],i.z=e[t+2],i.w=e[t+3],i}static FromFloatArrayToRef(e,t,i){return Tn.FromArrayToRef(e,t,i),i}static FromFloatsToRef(e,t,i,r,n){return n.x=e,n.y=t,n.z=i,n.w=r,n}static Zero(){return new Tn(0,0,0,0)}static One(){return new Tn(1,1,1,1)}static Random(e=0,t=1){return new Tn(ni(e,t),ni(e,t),ni(e,t),ni(e,t))}static RandomToRef(e=0,t=1,i){return i.x=ni(e,t),i.y=ni(e,t),i.z=ni(e,t),i.w=ni(e,t),i}static Clamp(e,t,i){return Tn.ClampToRef(e,t,i,new Tn)}static ClampToRef(e,t,i,r){return r.x=_r(e.x,t.x,i.x),r.y=_r(e.y,t.y,i.y),r.z=_r(e.z,t.z,i.z),r.w=_r(e.w,t.w,i.w),r}static CheckExtends(e,t,i){t.minimizeInPlace(e),i.maximizeInPlace(e)}static get ZeroReadOnly(){return Tn._ZeroReadOnly}static Normalize(e){return Tn.NormalizeToRef(e,new Tn)}static NormalizeToRef(e,t){return e.normalizeToRef(t),t}static Minimize(e,t){const i=new Tn;return i.copyFrom(e),i.minimizeInPlace(t),i}static Maximize(e,t){const i=new Tn;return i.copyFrom(e),i.maximizeInPlace(t),i}static Distance(e,t){return Math.sqrt(Tn.DistanceSquared(e,t))}static DistanceSquared(e,t){const i=e.x-t.x,r=e.y-t.y,n=e.z-t.z,a=e.w-t.w;return i*i+r*r+n*n+a*a}static Center(e,t){return Tn.CenterToRef(e,t,new Tn)}static CenterToRef(e,t,i){return i.x=(e.x+t.x)/2,i.y=(e.y+t.y)/2,i.z=(e.z+t.z)/2,i.w=(e.w+t.w)/2,i}static TransformCoordinates(e,t){return Tn.TransformCoordinatesToRef(e,t,new Tn)}static TransformCoordinatesToRef(e,t,i){return Tn.TransformCoordinatesFromFloatsToRef(e._x,e._y,e._z,t,i),i}static TransformCoordinatesFromFloatsToRef(e,t,i,r,n){const a=r.m,o=e*a[0]+t*a[4]+i*a[8]+a[12],l=e*a[1]+t*a[5]+i*a[9]+a[13],c=e*a[2]+t*a[6]+i*a[10]+a[14],u=e*a[3]+t*a[7]+i*a[11]+a[15];return n.x=o,n.y=l,n.z=c,n.w=u,n}static TransformNormal(e,t){return Tn.TransformNormalToRef(e,t,new Tn)}static TransformNormalToRef(e,t,i){const r=t.m,n=e.x*r[0]+e.y*r[4]+e.z*r[8],a=e.x*r[1]+e.y*r[5]+e.z*r[9],o=e.x*r[2]+e.y*r[6]+e.z*r[10];return i.x=n,i.y=a,i.z=o,i.w=e.w,i}static TransformNormalFromFloatsToRef(e,t,i,r,n,a){const o=n.m;return a.x=e*o[0]+t*o[4]+i*o[8],a.y=e*o[1]+t*o[5]+i*o[9],a.z=e*o[2]+t*o[6]+i*o[10],a.w=r,a}static FromVector3(e,t=0){return new Tn(e._x,e._y,e._z,t)}static Dot(e,t){return e.x*t.x+e.y*t.y+e.z*t.z+e.w*t.w}};Hi._V8PerformanceHack=new Hi(.5,.5,.5,.5);Hi._ZeroReadOnly=Hi.Zero();let gt=class Xr{get x(){return this._x}set x(e){this._x=e,this._isDirty=!0}get y(){return this._y}set y(e){this._y=e,this._isDirty=!0}get z(){return this._z}set z(e){this._z=e,this._isDirty=!0}get w(){return this._w}set w(e){this._w=e,this._isDirty=!0}constructor(e=0,t=0,i=0,r=1){this._isDirty=!0,this._x=e,this._y=t,this._z=i,this._w=r}toString(){return`{X: ${this._x} Y: ${this._y} Z: ${this._z} W: ${this._w}}`}getClassName(){return"Quaternion"}getHashCode(){const e=nd(this._x),t=nd(this._y),i=nd(this._z),r=nd(this._w);let n=e;return n=n*397^t,n=n*397^i,n=n*397^r,n}asArray(){return[this._x,this._y,this._z,this._w]}toArray(e,t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,this}fromArray(e,t=0){return Xr.FromArrayToRef(e,t,this)}equals(e){return e&&this._x===e._x&&this._y===e._y&&this._z===e._z&&this._w===e._w}equalsWithEpsilon(e,t=rr){return e&&fs(this._x,e._x,t)&&fs(this._y,e._y,t)&&fs(this._z,e._z,t)&&fs(this._w,e._w,t)}isApprox(e,t=rr){return e&&(fs(this._x,e._x,t)&&fs(this._y,e._y,t)&&fs(this._z,e._z,t)&&fs(this._w,e._w,t)||fs(this._x,-e._x,t)&&fs(this._y,-e._y,t)&&fs(this._z,-e._z,t)&&fs(this._w,-e._w,t))}clone(){return new Xr(this._x,this._y,this._z,this._w)}copyFrom(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._w=e._w,this._isDirty=!0,this}copyFromFloats(e,t,i,r){return this._x=e,this._y=t,this._z=i,this._w=r,this._isDirty=!0,this}set(e,t,i,r){return this.copyFromFloats(e,t,i,r)}setAll(e){return this.copyFromFloats(e,e,e,e)}add(e){return new Xr(this._x+e._x,this._y+e._y,this._z+e._z,this._w+e._w)}addInPlace(e){return this._x+=e._x,this._y+=e._y,this._z+=e._z,this._w+=e._w,this._isDirty=!0,this}addToRef(e,t){return t._x=this._x+e._x,t._y=this._y+e._y,t._z=this._z+e._z,t._w=this._w+e._w,t._isDirty=!0,t}addInPlaceFromFloats(e,t,i,r){return this._x+=e,this._y+=t,this._z+=i,this._w+=r,this._isDirty=!0,this}subtractToRef(e,t){return t._x=this._x-e._x,t._y=this._y-e._y,t._z=this._z-e._z,t._w=this._w-e._w,t._isDirty=!0,t}subtractFromFloats(e,t,i,r){return this.subtractFromFloatsToRef(e,t,i,r,new Xr)}subtractFromFloatsToRef(e,t,i,r,n){return n._x=this._x-e,n._y=this._y-t,n._z=this._z-i,n._w=this._w-r,n._isDirty=!0,n}subtract(e){return new Xr(this._x-e._x,this._y-e._y,this._z-e._z,this._w-e._w)}subtractInPlace(e){return this._x-=e._x,this._y-=e._y,this._z-=e._z,this._w-=e._w,this._isDirty=!0,this}scale(e){return new Xr(this._x*e,this._y*e,this._z*e,this._w*e)}scaleToRef(e,t){return t._x=this._x*e,t._y=this._y*e,t._z=this._z*e,t._w=this._w*e,t._isDirty=!0,t}scaleInPlace(e){return this._x*=e,this._y*=e,this._z*=e,this._w*=e,this._isDirty=!0,this}scaleAndAddToRef(e,t){return t._x+=this._x*e,t._y+=this._y*e,t._z+=this._z*e,t._w+=this._w*e,t._isDirty=!0,t}multiply(e){const t=new Xr(0,0,0,1);return this.multiplyToRef(e,t),t}multiplyToRef(e,t){const i=this._x*e._w+this._y*e._z-this._z*e._y+this._w*e._x,r=-this._x*e._z+this._y*e._w+this._z*e._x+this._w*e._y,n=this._x*e._y-this._y*e._x+this._z*e._w+this._w*e._z,a=-this._x*e._x-this._y*e._y-this._z*e._z+this._w*e._w;return t.copyFromFloats(i,r,n,a),t}multiplyInPlace(e){return this.multiplyToRef(e,this)}multiplyByFloats(e,t,i,r){return this._x*=e,this._y*=t,this._z*=i,this._w*=r,this._isDirty=!0,this}divide(e){throw new ReferenceError("Can not divide a quaternion")}divideToRef(e,t){throw new ReferenceError("Can not divide a quaternion")}divideInPlace(e){throw new ReferenceError("Can not divide a quaternion")}minimizeInPlace(){throw new ReferenceError("Can not minimize a quaternion")}minimizeInPlaceFromFloats(){throw new ReferenceError("Can not minimize a quaternion")}maximizeInPlace(){throw new ReferenceError("Can not maximize a quaternion")}maximizeInPlaceFromFloats(){throw new ReferenceError("Can not maximize a quaternion")}negate(){return this.negateToRef(new Xr)}negateInPlace(){return this._x=-this._x,this._y=-this._y,this._z=-this._z,this._w=-this._w,this._isDirty=!0,this}negateToRef(e){return e._x=-this._x,e._y=-this._y,e._z=-this._z,e._w=-this._w,e._isDirty=!0,e}equalsToFloats(e,t,i,r){return this._x===e&&this._y===t&&this._z===i&&this._w===r}floorToRef(e){throw new ReferenceError("Can not floor a quaternion")}floor(){throw new ReferenceError("Can not floor a quaternion")}fractToRef(e){throw new ReferenceError("Can not fract a quaternion")}fract(){throw new ReferenceError("Can not fract a quaternion")}conjugateToRef(e){return e.copyFromFloats(-this._x,-this._y,-this._z,this._w),e}conjugateInPlace(){return this._x*=-1,this._y*=-1,this._z*=-1,this._isDirty=!0,this}conjugate(){return new Xr(-this._x,-this._y,-this._z,this._w)}invert(){const e=this.conjugate(),t=this.lengthSquared();return t==0||t==1||e.scaleInPlace(1/t),e}invertInPlace(){this.conjugateInPlace();const e=this.lengthSquared();return e==0||e==1?this:(this.scaleInPlace(1/e),this)}lengthSquared(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this.lengthSquared())}normalize(){return this.normalizeFromLength(this.length())}normalizeFromLength(e){return e===0||e===1?this:this.scaleInPlace(1/e)}normalizeToNew(){const e=new Xr(0,0,0,1);return this.normalizeToRef(e),e}normalizeToRef(e){const t=this.length();return t===0||t===1?e.copyFromFloats(this._x,this._y,this._z,this._w):this.scaleToRef(1/t,e)}toEulerAngles(){const e=O.Zero();return this.toEulerAnglesToRef(e),e}toEulerAnglesToRef(e){const t=this._z,i=this._x,r=this._y,n=this._w,a=r*t-i*n,o=.4999999;if(a<-o)e._y=2*Math.atan2(r,n),e._x=Math.PI/2,e._z=0,e._isDirty=!0;else if(a>o)e._y=2*Math.atan2(r,n),e._x=-Math.PI/2,e._z=0,e._isDirty=!0;else{const l=n*n,c=t*t,u=i*i,h=r*r;e._z=Math.atan2(2*(i*r+t*n),-c-u+h+l),e._x=Math.asin(-2*a),e._y=Math.atan2(2*(t*i+r*n),c-u-h+l),e._isDirty=!0}return e}toAlphaBetaGammaToRef(e){const t=this._z,i=this._x,r=this._y,n=this._w,a=Math.sqrt(i*i+r*r),o=Math.sqrt(t*t+n*n),l=2*Math.atan2(a,o),c=2*Math.atan2(t,n),u=2*Math.atan2(r,i),h=(c+u)/2,d=(c-u)/2;return e.set(d,l,h),e}toRotationMatrix(e){return Ce.FromQuaternionToRef(this,e),e}fromRotationMatrix(e){return Xr.FromRotationMatrixToRef(e,this),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}toAxisAngle(){const e=O.Zero(),t=this.toAxisAngleToRef(e);return{axis:e,angle:t}}toAxisAngleToRef(e){let t;const i=Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z),r=this._w;return i>0?(t=2*Math.atan2(i,r),e.set(this._x/i,this._y/i,this._z/i)):(t=0,e.set(1,0,0)),t}static FromRotationMatrix(e){const t=new Xr;return Xr.FromRotationMatrixToRef(e,t),t}static FromRotationMatrixToRef(e,t){const i=e.m,r=i[0],n=i[4],a=i[8],o=i[1],l=i[5],c=i[9],u=i[2],h=i[6],d=i[10],f=r+l+d;let m;return f>0?(m=.5/Math.sqrt(f+1),t._w=.25/m,t._x=(h-c)*m,t._y=(a-u)*m,t._z=(o-n)*m,t._isDirty=!0):r>l&&r>d?(m=2*Math.sqrt(1+r-l-d),t._w=(h-c)/m,t._x=.25*m,t._y=(n+o)/m,t._z=(a+u)/m,t._isDirty=!0):l>d?(m=2*Math.sqrt(1+l-r-d),t._w=(a-u)/m,t._x=(n+o)/m,t._y=.25*m,t._z=(c+h)/m,t._isDirty=!0):(m=2*Math.sqrt(1+d-r-l),t._w=(o-n)/m,t._x=(a+u)/m,t._y=(c+h)/m,t._z=.25*m,t._isDirty=!0),t}static Dot(e,t){return e._x*t._x+e._y*t._y+e._z*t._z+e._w*t._w}static AreClose(e,t,i=.1){const r=Xr.Dot(e,t);return 1-r*r<=i}static SmoothToRef(e,t,i,r,n){let a=r===0?1:i/r;return a=_r(a,0,1),Xr.SlerpToRef(e,t,a,n),n}static Zero(){return new Xr(0,0,0,0)}static Inverse(e){return new Xr(-e._x,-e._y,-e._z,e._w)}static InverseToRef(e,t){return t.set(-e._x,-e._y,-e._z,e._w),t}static Identity(){return new Xr(0,0,0,1)}static IsIdentity(e){return e&&e._x===0&&e._y===0&&e._z===0&&e._w===1}static RotationAxis(e,t){return Xr.RotationAxisToRef(e,t,new Xr)}static RotationAxisToRef(e,t,i){i._w=Math.cos(t/2);const r=Math.sin(t/2)/e.length();return i._x=e._x*r,i._y=e._y*r,i._z=e._z*r,i._isDirty=!0,i}static FromArray(e,t){return t||(t=0),new Xr(e[t],e[t+1],e[t+2],e[t+3])}static FromArrayToRef(e,t,i){return i._x=e[t],i._y=e[t+1],i._z=e[t+2],i._w=e[t+3],i._isDirty=!0,i}static FromFloatsToRef(e,t,i,r,n){return n.copyFromFloats(e,t,i,r),n}static FromEulerAngles(e,t,i){const r=new Xr;return Xr.RotationYawPitchRollToRef(t,e,i,r),r}static FromEulerAnglesToRef(e,t,i,r){return Xr.RotationYawPitchRollToRef(t,e,i,r),r}static FromEulerVector(e){const t=new Xr;return Xr.RotationYawPitchRollToRef(e._y,e._x,e._z,t),t}static FromEulerVectorToRef(e,t){return Xr.RotationYawPitchRollToRef(e._y,e._x,e._z,t),t}static FromUnitVectorsToRef(e,t,i,r=rr){const n=O.Dot(e,t)+1;return nMath.abs(e.z)?i.set(-e.y,e.x,0,0):i.set(0,-e.z,e.y,0):(O.CrossToRef(e,t,Ae.Vector3[0]),i.set(Ae.Vector3[0].x,Ae.Vector3[0].y,Ae.Vector3[0].z,n)),i.normalize()}static RotationYawPitchRoll(e,t,i){const r=new Xr;return Xr.RotationYawPitchRollToRef(e,t,i,r),r}static RotationYawPitchRollToRef(e,t,i,r){const n=i*.5,a=t*.5,o=e*.5,l=Math.sin(n),c=Math.cos(n),u=Math.sin(a),h=Math.cos(a),d=Math.sin(o),f=Math.cos(o);return r._x=f*u*c+d*h*l,r._y=d*h*c-f*u*l,r._z=f*h*l-d*u*c,r._w=f*h*c+d*u*l,r._isDirty=!0,r}static RotationAlphaBetaGamma(e,t,i){const r=new Xr;return Xr.RotationAlphaBetaGammaToRef(e,t,i,r),r}static RotationAlphaBetaGammaToRef(e,t,i,r){const n=(i+e)*.5,a=(i-e)*.5,o=t*.5;return r._x=Math.cos(a)*Math.sin(o),r._y=Math.sin(a)*Math.sin(o),r._z=Math.sin(n)*Math.cos(o),r._w=Math.cos(n)*Math.cos(o),r._isDirty=!0,r}static RotationQuaternionFromAxis(e,t,i){const r=new Xr(0,0,0,0);return Xr.RotationQuaternionFromAxisToRef(e,t,i,r),r}static RotationQuaternionFromAxisToRef(e,t,i,r){const n=Ci.Matrix[0];return e=e.normalizeToRef(Ci.Vector3[0]),t=t.normalizeToRef(Ci.Vector3[1]),i=i.normalizeToRef(Ci.Vector3[2]),Ce.FromXYZAxesToRef(e,t,i,n),Xr.FromRotationMatrixToRef(n,r),r}static FromLookDirectionLH(e,t){const i=new Xr;return Xr.FromLookDirectionLHToRef(e,t,i),i}static FromLookDirectionLHToRef(e,t,i){const r=Ci.Matrix[0];return Ce.LookDirectionLHToRef(e,t,r),Xr.FromRotationMatrixToRef(r,i),i}static FromLookDirectionRH(e,t){const i=new Xr;return Xr.FromLookDirectionRHToRef(e,t,i),i}static FromLookDirectionRHToRef(e,t,i){const r=Ci.Matrix[0];return Ce.LookDirectionRHToRef(e,t,r),Xr.FromRotationMatrixToRef(r,i)}static Slerp(e,t,i){const r=Xr.Identity();return Xr.SlerpToRef(e,t,i,r),r}static SlerpToRef(e,t,i,r){let n,a,o=e._x*t._x+e._y*t._y+e._z*t._z+e._w*t._w,l=!1;if(o<0&&(l=!0,o=-o),o>.999999)a=1-i,n=l?-i:i;else{const c=Math.acos(o),u=1/Math.sin(c);a=Math.sin((1-i)*c)*u,n=l?-Math.sin(i*c)*u:Math.sin(i*c)*u}return r._x=a*e._x+n*t._x,r._y=a*e._y+n*t._y,r._z=a*e._z+n*t._z,r._w=a*e._w+n*t._w,r._isDirty=!0,r}static Hermite(e,t,i,r,n){const a=n*n,o=n*a,l=2*o-3*a+1,c=-2*o+3*a,u=o-2*a+n,h=o-a,d=e._x*l+i._x*c+t._x*u+r._x*h,f=e._y*l+i._y*c+t._y*u+r._y*h,m=e._z*l+i._z*c+t._z*u+r._z*h,p=e._w*l+i._w*c+t._w*u+r._w*h;return new Xr(d,f,m,p)}static Hermite1stDerivative(e,t,i,r,n){const a=new Xr;return this.Hermite1stDerivativeToRef(e,t,i,r,n,a),a}static Hermite1stDerivativeToRef(e,t,i,r,n,a){const o=n*n;return a._x=(o-n)*6*e._x+(3*o-4*n+1)*t._x+(-o+n)*6*i._x+(3*o-2*n)*r._x,a._y=(o-n)*6*e._y+(3*o-4*n+1)*t._y+(-o+n)*6*i._y+(3*o-2*n)*r._y,a._z=(o-n)*6*e._z+(3*o-4*n+1)*t._z+(-o+n)*6*i._z+(3*o-2*n)*r._z,a._w=(o-n)*6*e._w+(3*o-4*n+1)*t._w+(-o+n)*6*i._w+(3*o-2*n)*r._w,a._isDirty=!0,a}static Normalize(e){const t=Xr.Zero();return Xr.NormalizeToRef(e,t),t}static NormalizeToRef(e,t){return e.normalizeToRef(t),t}static Clamp(e,t,i){const r=new Xr;return Xr.ClampToRef(e,t,i,r),r}static ClampToRef(e,t,i,r){return r.copyFromFloats(_r(e.x,t.x,i.x),_r(e.y,t.y,i.y),_r(e.z,t.z,i.z),_r(e.w,t.w,i.w))}static Random(e=0,t=1){return new Xr(ni(e,t),ni(e,t),ni(e,t),ni(e,t))}static RandomToRef(e=0,t=1,i){return i.copyFromFloats(ni(e,t),ni(e,t),ni(e,t),ni(e,t))}static Minimize(){throw new ReferenceError("Quaternion.Minimize does not make sense")}static Maximize(){throw new ReferenceError("Quaternion.Maximize does not make sense")}static Distance(e,t){return Math.sqrt(Xr.DistanceSquared(e,t))}static DistanceSquared(e,t){const i=e.x-t.x,r=e.y-t.y,n=e.z-t.z,a=e.w-t.w;return i*i+r*r+n*n+a*a}static Center(e,t){return Xr.CenterToRef(e,t,Xr.Zero())}static CenterToRef(e,t,i){return i.copyFromFloats((e.x+t.x)/2,(e.y+t.y)/2,(e.z+t.z)/2,(e.w+t.w)/2)}};gt._V8PerformanceHack=new gt(.5,.5,.5,.5);class Ce{static get Use64Bits(){return zl.MatrixUse64Bits}get m(){return this._m}markAsUpdated(){this.updateFlag=Y5._UpdateFlagSeed++,this._isIdentity=!1,this._isIdentity3x2=!1,this._isIdentityDirty=!0,this._isIdentity3x2Dirty=!0}_updateIdentityStatus(e,t=!1,i=!1,r=!0){this._isIdentity=e,this._isIdentity3x2=e||i,this._isIdentityDirty=this._isIdentity?!1:t,this._isIdentity3x2Dirty=this._isIdentity3x2?!1:r}constructor(){this._isIdentity=!1,this._isIdentityDirty=!0,this._isIdentity3x2=!0,this._isIdentity3x2Dirty=!0,this.updateFlag=-1,zl.MatrixTrackPrecisionChange&&zl.MatrixTrackedMatrices.push(this),this._m=new zl.MatrixCurrentType(16),this.markAsUpdated()}isIdentity(){if(this._isIdentityDirty){this._isIdentityDirty=!1;const e=this._m;this._isIdentity=e[0]===1&&e[1]===0&&e[2]===0&&e[3]===0&&e[4]===0&&e[5]===1&&e[6]===0&&e[7]===0&&e[8]===0&&e[9]===0&&e[10]===1&&e[11]===0&&e[12]===0&&e[13]===0&&e[14]===0&&e[15]===1}return this._isIdentity}isIdentityAs3x2(){return this._isIdentity3x2Dirty&&(this._isIdentity3x2Dirty=!1,this._m[0]!==1||this._m[5]!==1||this._m[15]!==1?this._isIdentity3x2=!1:this._m[1]!==0||this._m[2]!==0||this._m[3]!==0||this._m[4]!==0||this._m[6]!==0||this._m[7]!==0||this._m[8]!==0||this._m[9]!==0||this._m[10]!==0||this._m[11]!==0||this._m[12]!==0||this._m[13]!==0||this._m[14]!==0?this._isIdentity3x2=!1:this._isIdentity3x2=!0),this._isIdentity3x2}determinant(){if(this._isIdentity===!0)return 1;const e=this._m,t=e[0],i=e[1],r=e[2],n=e[3],a=e[4],o=e[5],l=e[6],c=e[7],u=e[8],h=e[9],d=e[10],f=e[11],m=e[12],p=e[13],_=e[14],v=e[15],x=d*v-_*f,S=h*v-p*f,b=h*_-p*d,y=u*v-m*f,I=u*_-d*m,R=u*p-m*h,A=+(o*x-l*S+c*b),P=-(a*x-l*y+c*I),w=+(a*S-o*y+c*R),L=-(a*b-o*I+l*R);return t*A+i*P+r*w+n*L}toString(){return`{${this.m[0]}, ${this.m[1]}, ${this.m[2]}, ${this.m[3]}
000545: ${this.m[4]}, ${this.m[5]}, ${this.m[6]}, ${this.m[7]}
000546: ${this.m[8]}, ${this.m[9]}, ${this.m[10]}, ${this.m[11]}
000547: ${this.m[12]}, ${this.m[13]}, ${this.m[14]}, ${this.m[15]}}`}toArray(e=null,t=0){if(!e)return this._m;const i=this._m;for(let r=0;r<16;r++)e[t+r]=i[r];return this}asArray(){return this._m}fromArray(e,t=0){return Ce.FromArrayToRef(e,t,this)}copyFromFloats(...e){return Ce.FromArrayToRef(e,0,this)}set(...e){const t=this._m;for(let i=0;i<16;i++)t[i]=e[i];return this.markAsUpdated(),this}setAll(e){const t=this._m;for(let i=0;i<16;i++)t[i]=e;return this.markAsUpdated(),this}invert(){return this.invertToRef(this),this}reset(){return Ce.FromValuesToRef(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,this),this._updateIdentityStatus(!1),this}add(e){const t=new Ce;return this.addToRef(e,t),t}addToRef(e,t){const i=this._m,r=t._m,n=e.m;for(let a=0;a<16;a++)r[a]=i[a]+n[a];return t.markAsUpdated(),t}addToSelf(e){const t=this._m,i=e.m;return t[0]+=i[0],t[1]+=i[1],t[2]+=i[2],t[3]+=i[3],t[4]+=i[4],t[5]+=i[5],t[6]+=i[6],t[7]+=i[7],t[8]+=i[8],t[9]+=i[9],t[10]+=i[10],t[11]+=i[11],t[12]+=i[12],t[13]+=i[13],t[14]+=i[14],t[15]+=i[15],this.markAsUpdated(),this}addInPlace(e){const t=this._m,i=e.m;for(let r=0;r<16;r++)t[r]+=i[r];return this.markAsUpdated(),this}addInPlaceFromFloats(...e){const t=this._m;for(let i=0;i<16;i++)t[i]+=e[i];return this.markAsUpdated(),this}subtract(e){const t=this._m,i=e.m;for(let r=0;r<16;r++)t[r]-=i[r];return this.markAsUpdated(),this}subtractToRef(e,t){const i=this._m,r=e.m,n=t._m;for(let a=0;a<16;a++)n[a]=i[a]-r[a];return t.markAsUpdated(),t}subtractInPlace(e){const t=this._m,i=e.m;for(let r=0;r<16;r++)t[r]-=i[r];return this.markAsUpdated(),this}subtractFromFloats(...e){return this.subtractFromFloatsToRef(...e,new Ce)}subtractFromFloatsToRef(...e){const t=e.pop(),i=this._m,r=t._m,n=e;for(let a=0;a<16;a++)r[a]=i[a]-n[a];return t.markAsUpdated(),t}invertToRef(e){return this._isIdentity===!0?(Ce.IdentityToRef(e),e):($me(this,e.asArray())?e.markAsUpdated():e.copyFrom(this),e)}addAtIndex(e,t){return this._m[e]+=t,this.markAsUpdated(),this}multiplyAtIndex(e,t){return this._m[e]*=t,this.markAsUpdated(),this}setTranslationFromFloats(e,t,i){return this._m[12]=e,this._m[13]=t,this._m[14]=i,this.markAsUpdated(),this}addTranslationFromFloats(e,t,i){return this._m[12]+=e,this._m[13]+=t,this._m[14]+=i,this.markAsUpdated(),this}setTranslation(e){return this.setTranslationFromFloats(e._x,e._y,e._z)}getTranslation(){return new O(this._m[12],this._m[13],this._m[14])}getTranslationToRef(e){return e.x=this._m[12],e.y=this._m[13],e.z=this._m[14],e}removeRotationAndScaling(){const e=this.m;return Ce.FromValuesToRef(1,0,0,0,0,1,0,0,0,0,1,0,e[12],e[13],e[14],e[15],this),this._updateIdentityStatus(e[12]===0&&e[13]===0&&e[14]===0&&e[15]===1),this}copyFrom(e){e.copyToArray(this._m);const t=e;return this.updateFlag=t.updateFlag,this._updateIdentityStatus(t._isIdentity,t._isIdentityDirty,t._isIdentity3x2,t._isIdentity3x2Dirty),this}copyToArray(e,t=0){return _ke(this,e,t),this}multiply(e){const t=new Ce;return this.multiplyToRef(e,t),t}multiplyInPlace(e){const t=this._m,i=e.m;for(let r=0;r<16;r++)t[r]*=i[r];return this.markAsUpdated(),this}multiplyByFloats(...e){const t=this._m;for(let i=0;i<16;i++)t[i]*=e[i];return this.markAsUpdated(),this}multiplyByFloatsToRef(...e){const t=e.pop(),i=this._m,r=t._m,n=e;for(let a=0;a<16;a++)r[a]=i[a]*n[a];return t.markAsUpdated(),t}multiplyToRef(e,t){return this._isIdentity?(t.copyFrom(e),t):e._isIdentity?(t.copyFrom(this),t):(this.multiplyToArray(e,t._m,0),t.markAsUpdated(),t)}multiplyToArray(e,t,i){return Xme(this,e,t,i),this}divide(e){return this.divideToRef(e,new Ce)}divideToRef(e,t){const i=this._m,r=e.m,n=t._m;for(let a=0;a<16;a++)n[a]=i[a]/r[a];return t.markAsUpdated(),t}divideInPlace(e){const t=this._m,i=e.m;for(let r=0;r<16;r++)t[r]/=i[r];return this.markAsUpdated(),this}minimizeInPlace(e){const t=this._m,i=e.m;for(let r=0;r<16;r++)t[r]=Math.min(t[r],i[r]);return this.markAsUpdated(),this}minimizeInPlaceFromFloats(...e){const t=this._m;for(let i=0;i<16;i++)t[i]=Math.min(t[i],e[i]);return this.markAsUpdated(),this}maximizeInPlace(e){const t=this._m,i=e.m;for(let r=0;r<16;r++)t[r]=Math.min(t[r],i[r]);return this.markAsUpdated(),this}maximizeInPlaceFromFloats(...e){const t=this._m;for(let i=0;i<16;i++)t[i]=Math.min(t[i],e[i]);return this.markAsUpdated(),this}negate(){return this.negateToRef(new Ce)}negateInPlace(){const e=this._m;for(let t=0;t<16;t++)e[t]=-e[t];return this.markAsUpdated(),this}negateToRef(e){const t=this._m,i=e._m;for(let r=0;r<16;r++)i[r]=-t[r];return e.markAsUpdated(),e}equals(e){const t=e;if(!t)return!1;if((this._isIdentity||t._isIdentity)&&!this._isIdentityDirty&&!t._isIdentityDirty)return this._isIdentity&&t._isIdentity;const i=this.m,r=t.m;return i[0]===r[0]&&i[1]===r[1]&&i[2]===r[2]&&i[3]===r[3]&&i[4]===r[4]&&i[5]===r[5]&&i[6]===r[6]&&i[7]===r[7]&&i[8]===r[8]&&i[9]===r[9]&&i[10]===r[10]&&i[11]===r[11]&&i[12]===r[12]&&i[13]===r[13]&&i[14]===r[14]&&i[15]===r[15]}equalsWithEpsilon(e,t=0){const i=this._m,r=e.m;for(let n=0;n<16;n++)if(!fs(i[n],r[n],t))return!1;return!0}equalsToFloats(...e){const t=this._m;for(let i=0;i<16;i++)if(t[i]!=e[i])return!1;return!0}floor(){return this.floorToRef(new Ce)}floorToRef(e){const t=this._m,i=e._m;for(let r=0;r<16;r++)i[r]=Math.floor(t[r]);return e.markAsUpdated(),e}fract(){return this.fractToRef(new Ce)}fractToRef(e){const t=this._m,i=e._m;for(let r=0;r<16;r++)i[r]=t[r]-Math.floor(t[r]);return e.markAsUpdated(),e}clone(){const e=new Ce;return e.copyFrom(this),e}getClassName(){return"Matrix"}getHashCode(){let e=nd(this._m[0]);for(let t=1;t<16;t++)e=e*397^nd(this._m[t]);return e}decomposeToTransformNode(e){return e.rotationQuaternion=e.rotationQuaternion||new gt,this.decompose(e.scaling,e.rotationQuaternion,e.position)}decompose(e,t,i,r,n=!0){if(this._isIdentity)return i&&i.setAll(0),e&&e.setAll(1),t&&t.copyFromFloats(0,0,0,1),!0;const a=this._m;if(i&&i.copyFromFloats(a[12],a[13],a[14]),e=e||Ci.Vector3[0],e.x=Math.sqrt(a[0]*a[0]+a[1]*a[1]+a[2]*a[2]),e.y=Math.sqrt(a[4]*a[4]+a[5]*a[5]+a[6]*a[6]),e.z=Math.sqrt(a[8]*a[8]+a[9]*a[9]+a[10]*a[10]),r){const o=(n?r.absoluteScaling.x:r.scaling.x)<0?-1:1,l=(n?r.absoluteScaling.y:r.scaling.y)<0?-1:1,c=(n?r.absoluteScaling.z:r.scaling.z)<0?-1:1;e.x*=o,e.y*=l,e.z*=c}else this.determinant()<=0&&(e.y*=-1);if(e._x===0||e._y===0||e._z===0)return t&&t.copyFromFloats(0,0,0,1),!1;if(t){const o=1/e._x,l=1/e._y,c=1/e._z;Ce.FromValuesToRef(a[0]*o,a[1]*o,a[2]*o,0,a[4]*l,a[5]*l,a[6]*l,0,a[8]*c,a[9]*c,a[10]*c,0,0,0,0,1,Ci.Matrix[0]),gt.FromRotationMatrixToRef(Ci.Matrix[0],t)}return!0}getRow(e){if(e<0||e>3)return null;const t=e*4;return new Hi(this._m[t+0],this._m[t+1],this._m[t+2],this._m[t+3])}getRowToRef(e,t){if(e>=0&&e<=3){const i=e*4;t.x=this._m[i+0],t.y=this._m[i+1],t.z=this._m[i+2],t.w=this._m[i+3]}return t}setRow(e,t){return this.setRowFromFloats(e,t.x,t.y,t.z,t.w)}transpose(){const e=new Ce;return Ce.TransposeToRef(this,e),e}transposeToRef(e){return Ce.TransposeToRef(this,e),e}setRowFromFloats(e,t,i,r,n){if(e<0||e>3)return this;const a=e*4;return this._m[a+0]=t,this._m[a+1]=i,this._m[a+2]=r,this._m[a+3]=n,this.markAsUpdated(),this}scale(e){const t=new Ce;return this.scaleToRef(e,t),t}scaleToRef(e,t){for(let i=0;i<16;i++)t._m[i]=this._m[i]*e;return t.markAsUpdated(),t}scaleAndAddToRef(e,t){for(let i=0;i<16;i++)t._m[i]+=this._m[i]*e;return t.markAsUpdated(),t}scaleInPlace(e){const t=this._m;for(let i=0;i<16;i++)t[i]*=e;return this.markAsUpdated(),this}toNormalMatrix(e){const t=Ci.Matrix[0];this.invertToRef(t),t.transposeToRef(e);const i=e._m;return Ce.FromValuesToRef(i[0],i[1],i[2],0,i[4],i[5],i[6],0,i[8],i[9],i[10],0,0,0,0,1,e),e}getRotationMatrix(){const e=new Ce;return this.getRotationMatrixToRef(e),e}getRotationMatrixToRef(e){const t=Ci.Vector3[0];if(!this.decompose(t))return Ce.IdentityToRef(e),e;const i=this._m,r=1/t._x,n=1/t._y,a=1/t._z;return Ce.FromValuesToRef(i[0]*r,i[1]*r,i[2]*r,0,i[4]*n,i[5]*n,i[6]*n,0,i[8]*a,i[9]*a,i[10]*a,0,0,0,0,1,e),e}toggleModelMatrixHandInPlace(){const e=this._m;return e[2]*=-1,e[6]*=-1,e[8]*=-1,e[9]*=-1,e[14]*=-1,this.markAsUpdated(),this}toggleProjectionMatrixHandInPlace(){const e=this._m;return e[8]*=-1,e[9]*=-1,e[10]*=-1,e[11]*=-1,this.markAsUpdated(),this}static FromArray(e,t=0){const i=new Ce;return Ce.FromArrayToRef(e,t,i),i}static FromArrayToRef(e,t,i){for(let r=0;r<16;r++)i._m[r]=e[r+t];return i.markAsUpdated(),i}static FromFloat32ArrayToRefScaled(e,t,i,r){return r._m[0]=e[0+t]*i,r._m[1]=e[1+t]*i,r._m[2]=e[2+t]*i,r._m[3]=e[3+t]*i,r._m[4]=e[4+t]*i,r._m[5]=e[5+t]*i,r._m[6]=e[6+t]*i,r._m[7]=e[7+t]*i,r._m[8]=e[8+t]*i,r._m[9]=e[9+t]*i,r._m[10]=e[10+t]*i,r._m[11]=e[11+t]*i,r._m[12]=e[12+t]*i,r._m[13]=e[13+t]*i,r._m[14]=e[14+t]*i,r._m[15]=e[15+t]*i,r.markAsUpdated(),r}static get IdentityReadOnly(){return Ce._IdentityReadOnly}static FromValuesToRef(e,t,i,r,n,a,o,l,c,u,h,d,f,m,p,_,v){const x=v._m;x[0]=e,x[1]=t,x[2]=i,x[3]=r,x[4]=n,x[5]=a,x[6]=o,x[7]=l,x[8]=c,x[9]=u,x[10]=h,x[11]=d,x[12]=f,x[13]=m,x[14]=p,x[15]=_,v.markAsUpdated()}static FromValues(e,t,i,r,n,a,o,l,c,u,h,d,f,m,p,_){const v=new Ce,x=v._m;return x[0]=e,x[1]=t,x[2]=i,x[3]=r,x[4]=n,x[5]=a,x[6]=o,x[7]=l,x[8]=c,x[9]=u,x[10]=h,x[11]=d,x[12]=f,x[13]=m,x[14]=p,x[15]=_,v.markAsUpdated(),v}static Compose(e,t,i){const r=new Ce;return Ce.ComposeToRef(e,t,i,r),r}static ComposeToRef(e,t,i,r){const n=r._m,a=t._x,o=t._y,l=t._z,c=t._w,u=a+a,h=o+o,d=l+l,f=a*u,m=a*h,p=a*d,_=o*h,v=o*d,x=l*d,S=c*u,b=c*h,y=c*d,I=e._x,R=e._y,A=e._z;return n[0]=(1-(_+x))*I,n[1]=(m+y)*I,n[2]=(p-b)*I,n[3]=0,n[4]=(m-y)*R,n[5]=(1-(f+x))*R,n[6]=(v+S)*R,n[7]=0,n[8]=(p+b)*A,n[9]=(v-S)*A,n[10]=(1-(f+_))*A,n[11]=0,n[12]=i._x,n[13]=i._y,n[14]=i._z,n[15]=1,r.markAsUpdated(),r}static Identity(){const e=Ce.FromValues(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return e._updateIdentityStatus(!0),e}static IdentityToRef(e){return Ce.FromValuesToRef(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1,e),e._updateIdentityStatus(!0),e}static Zero(){const e=Ce.FromValues(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);return e._updateIdentityStatus(!1),e}static RotationX(e){const t=new Ce;return Ce.RotationXToRef(e,t),t}static Invert(e){const t=new Ce;return e.invertToRef(t),t}static RotationXToRef(e,t){const i=Math.sin(e),r=Math.cos(e);return Ce.FromValuesToRef(1,0,0,0,0,r,i,0,0,-i,r,0,0,0,0,1,t),t._updateIdentityStatus(r===1&&i===0),t}static RotationY(e){const t=new Ce;return Ce.RotationYToRef(e,t),t}static RotationYToRef(e,t){const i=Math.sin(e),r=Math.cos(e);return Ce.FromValuesToRef(r,0,-i,0,0,1,0,0,i,0,r,0,0,0,0,1,t),t._updateIdentityStatus(r===1&&i===0),t}static RotationZ(e){const t=new Ce;return Ce.RotationZToRef(e,t),t}static RotationZToRef(e,t){const i=Math.sin(e),r=Math.cos(e);return Ce.FromValuesToRef(r,i,0,0,-i,r,0,0,0,0,1,0,0,0,0,1,t),t._updateIdentityStatus(r===1&&i===0),t}static RotationAxis(e,t){const i=new Ce;return Ce.RotationAxisToRef(e,t,i),i}static RotationAxisToRef(e,t,i){const r=Math.sin(-t),n=Math.cos(-t),a=1-n;e=e.normalizeToRef(Ci.Vector3[0]);const o=i._m;return o[0]=e._x*e._x*a+n,o[1]=e._x*e._y*a-e._z*r,o[2]=e._x*e._z*a+e._y*r,o[3]=0,o[4]=e._y*e._x*a+e._z*r,o[5]=e._y*e._y*a+n,o[6]=e._y*e._z*a-e._x*r,o[7]=0,o[8]=e._z*e._x*a-e._y*r,o[9]=e._z*e._y*a+e._x*r,o[10]=e._z*e._z*a+n,o[11]=0,o[12]=0,o[13]=0,o[14]=0,o[15]=1,i.markAsUpdated(),i}static RotationAlignToRef(e,t,i,r=!1){const n=O.Dot(t,e),a=i._m;if(n<-1+rr)a[0]=-1,a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=r?1:-1,a[6]=0,a[7]=0,a[8]=0,a[9]=0,a[10]=r?-1:1,a[11]=0;else{const o=O.Cross(t,e),l=1/(1+n);a[0]=o._x*o._x*l+n,a[1]=o._y*o._x*l-o._z,a[2]=o._z*o._x*l+o._y,a[3]=0,a[4]=o._x*o._y*l+o._z,a[5]=o._y*o._y*l+n,a[6]=o._z*o._y*l-o._x,a[7]=0,a[8]=o._x*o._z*l-o._y,a[9]=o._y*o._z*l+o._x,a[10]=o._z*o._z*l+n,a[11]=0}return a[12]=0,a[13]=0,a[14]=0,a[15]=1,i.markAsUpdated(),i}static RotationYawPitchRoll(e,t,i){const r=new Ce;return Ce.RotationYawPitchRollToRef(e,t,i,r),r}static RotationYawPitchRollToRef(e,t,i,r){return gt.RotationYawPitchRollToRef(e,t,i,Ci.Quaternion[0]),Ci.Quaternion[0].toRotationMatrix(r),r}static Scaling(e,t,i){const r=new Ce;return Ce.ScalingToRef(e,t,i,r),r}static ScalingToRef(e,t,i,r){return Ce.FromValuesToRef(e,0,0,0,0,t,0,0,0,0,i,0,0,0,0,1,r),r._updateIdentityStatus(e===1&&t===1&&i===1),r}static Translation(e,t,i){const r=new Ce;return Ce.TranslationToRef(e,t,i,r),r}static TranslationToRef(e,t,i,r){return Ce.FromValuesToRef(1,0,0,0,0,1,0,0,0,0,1,0,e,t,i,1,r),r._updateIdentityStatus(e===0&&t===0&&i===0),r}static Lerp(e,t,i){const r=new Ce;return Ce.LerpToRef(e,t,i,r),r}static LerpToRef(e,t,i,r){const n=r._m,a=e.m,o=t.m;for(let l=0;l<16;l++)n[l]=a[l]*(1-i)+o[l]*i;return r.markAsUpdated(),r}static DecomposeLerp(e,t,i){const r=new Ce;return Ce.DecomposeLerpToRef(e,t,i,r),r}static DecomposeLerpToRef(e,t,i,r){const n=Ci.Vector3[0],a=Ci.Quaternion[0],o=Ci.Vector3[1];e.decompose(n,a,o);const l=Ci.Vector3[2],c=Ci.Quaternion[1],u=Ci.Vector3[3];t.decompose(l,c,u);const h=Ci.Vector3[4];O.LerpToRef(n,l,i,h);const d=Ci.Quaternion[2];gt.SlerpToRef(a,c,i,d);const f=Ci.Vector3[5];return O.LerpToRef(o,u,i,f),Ce.ComposeToRef(h,d,f,r),r}static LookAtLH(e,t,i){const r=new Ce;return Ce.LookAtLHToRef(e,t,i,r),r}static LookAtLHToRef(e,t,i,r){const n=Ci.Vector3[0],a=Ci.Vector3[1],o=Ci.Vector3[2];t.subtractToRef(e,o),o.normalize(),O.CrossToRef(i,o,n);const l=n.lengthSquared();l===0?n.x=1:n.normalizeFromLength(Math.sqrt(l)),O.CrossToRef(o,n,a),a.normalize();const c=-O.Dot(n,e),u=-O.Dot(a,e),h=-O.Dot(o,e);return Ce.FromValuesToRef(n._x,a._x,o._x,0,n._y,a._y,o._y,0,n._z,a._z,o._z,0,c,u,h,1,r),r}static LookAtRH(e,t,i){const r=new Ce;return Ce.LookAtRHToRef(e,t,i,r),r}static LookAtRHToRef(e,t,i,r){const n=Ci.Vector3[0],a=Ci.Vector3[1],o=Ci.Vector3[2];e.subtractToRef(t,o),o.normalize(),O.CrossToRef(i,o,n);const l=n.lengthSquared();l===0?n.x=1:n.normalizeFromLength(Math.sqrt(l)),O.CrossToRef(o,n,a),a.normalize();const c=-O.Dot(n,e),u=-O.Dot(a,e),h=-O.Dot(o,e);return Ce.FromValuesToRef(n._x,a._x,o._x,0,n._y,a._y,o._y,0,n._z,a._z,o._z,0,c,u,h,1,r),r}static LookDirectionLH(e,t){const i=new Ce;return Ce.LookDirectionLHToRef(e,t,i),i}static LookDirectionLHToRef(e,t,i){const r=Ci.Vector3[0];r.copyFrom(e),r.scaleInPlace(-1);const n=Ci.Vector3[1];return O.CrossToRef(t,r,n),Ce.FromValuesToRef(n._x,n._y,n._z,0,t._x,t._y,t._z,0,r._x,r._y,r._z,0,0,0,0,1,i),i}static LookDirectionRH(e,t){const i=new Ce;return Ce.LookDirectionRHToRef(e,t,i),i}static LookDirectionRHToRef(e,t,i){const r=Ci.Vector3[2];return O.CrossToRef(t,e,r),Ce.FromValuesToRef(r._x,r._y,r._z,0,t._x,t._y,t._z,0,e._x,e._y,e._z,0,0,0,0,1,i),i}static OrthoLH(e,t,i,r,n){const a=new Ce;return Ce.OrthoLHToRef(e,t,i,r,a,n),a}static OrthoLHToRef(e,t,i,r,n,a){const o=i,l=r,c=2/e,u=2/t,h=2/(l-o),d=-(l+o)/(l-o);return Ce.FromValuesToRef(c,0,0,0,0,u,0,0,0,0,h,0,0,0,d,1,n),a&&n.multiplyToRef(Rb,n),n._updateIdentityStatus(c===1&&u===1&&h===1&&d===0),n}static OrthoOffCenterLH(e,t,i,r,n,a,o){const l=new Ce;return Ce.OrthoOffCenterLHToRef(e,t,i,r,n,a,l,o),l}static OrthoOffCenterLHToRef(e,t,i,r,n,a,o,l){const c=n,u=a,h=2/(t-e),d=2/(r-i),f=2/(u-c),m=-(u+c)/(u-c),p=(e+t)/(e-t),_=(r+i)/(i-r);return Ce.FromValuesToRef(h,0,0,0,0,d,0,0,0,0,f,0,p,_,m,1,o),l&&o.multiplyToRef(Rb,o),o.markAsUpdated(),o}static ObliqueOffCenterLHToRef(e,t,i,r,n,a,o,l,c,u,h){const d=-o*Math.cos(l),f=-o*Math.sin(l);return Ce.TranslationToRef(0,0,-c,Ci.Matrix[1]),Ce.FromValuesToRef(1,0,0,0,0,1,0,0,d,f,1,0,0,0,0,1,Ci.Matrix[0]),Ci.Matrix[1].multiplyToRef(Ci.Matrix[0],Ci.Matrix[0]),Ce.TranslationToRef(0,0,c,Ci.Matrix[1]),Ci.Matrix[0].multiplyToRef(Ci.Matrix[1],Ci.Matrix[0]),Ce.OrthoOffCenterLHToRef(e,t,i,r,n,a,u,h),Ci.Matrix[0].multiplyToRef(u,u),u}static OrthoOffCenterRH(e,t,i,r,n,a,o){const l=new Ce;return Ce.OrthoOffCenterRHToRef(e,t,i,r,n,a,l,o),l}static OrthoOffCenterRHToRef(e,t,i,r,n,a,o,l){return Ce.OrthoOffCenterLHToRef(e,t,i,r,n,a,o,l),o._m[10]*=-1,o}static ObliqueOffCenterRHToRef(e,t,i,r,n,a,o,l,c,u,h){const d=o*Math.cos(l),f=o*Math.sin(l);return Ce.TranslationToRef(0,0,c,Ci.Matrix[1]),Ce.FromValuesToRef(1,0,0,0,0,1,0,0,d,f,1,0,0,0,0,1,Ci.Matrix[0]),Ci.Matrix[1].multiplyToRef(Ci.Matrix[0],Ci.Matrix[0]),Ce.TranslationToRef(0,0,-c,Ci.Matrix[1]),Ci.Matrix[0].multiplyToRef(Ci.Matrix[1],Ci.Matrix[0]),Ce.OrthoOffCenterRHToRef(e,t,i,r,n,a,u,h),Ci.Matrix[0].multiplyToRef(u,u),u}static PerspectiveLH(e,t,i,r,n,a=0){const o=new Ce,l=i,c=r,u=2*l/e,h=2*l/t,d=(c+l)/(c-l),f=-2*c*l/(c-l),m=Math.tan(a);return Ce.FromValuesToRef(u,0,0,0,0,h,0,m,0,0,d,1,0,0,f,0,o),n&&o.multiplyToRef(Rb,o),o._updateIdentityStatus(!1),o}static PerspectiveFovLH(e,t,i,r,n,a=0,o=!1){const l=new Ce;return Ce.PerspectiveFovLHToRef(e,t,i,r,l,!0,n,a,o),l}static PerspectiveFovLHToRef(e,t,i,r,n,a=!0,o,l=0,c=!1){const u=i,h=r,d=1/Math.tan(e*.5),f=a?d/t:d,m=a?d:d*t,p=c&&u===0?-1:h!==0?(h+u)/(h-u):1,_=c&&u===0?2*h:h!==0?-2*h*u/(h-u):-2*u,v=Math.tan(l);return Ce.FromValuesToRef(f,0,0,0,0,m,0,v,0,0,p,1,0,0,_,0,n),o&&n.multiplyToRef(Rb,n),n._updateIdentityStatus(!1),n}static PerspectiveFovReverseLHToRef(e,t,i,r,n,a=!0,o,l=0){const c=1/Math.tan(e*.5),u=a?c/t:c,h=a?c:c*t,d=Math.tan(l);return Ce.FromValuesToRef(u,0,0,0,0,h,0,d,0,0,-i,1,0,0,1,0,n),o&&n.multiplyToRef(Rb,n),n._updateIdentityStatus(!1),n}static PerspectiveFovRH(e,t,i,r,n,a=0,o=!1){const l=new Ce;return Ce.PerspectiveFovRHToRef(e,t,i,r,l,!0,n,a,o),l}static PerspectiveFovRHToRef(e,t,i,r,n,a=!0,o,l=0,c=!1){const u=i,h=r,d=1/Math.tan(e*.5),f=a?d/t:d,m=a?d:d*t,p=c&&u===0?1:h!==0?-(h+u)/(h-u):-1,_=c&&u===0?2*h:h!==0?-2*h*u/(h-u):-2*u,v=Math.tan(l);return Ce.FromValuesToRef(f,0,0,0,0,m,0,v,0,0,p,-1,0,0,_,0,n),o&&n.multiplyToRef(Rb,n),n._updateIdentityStatus(!1),n}static PerspectiveFovReverseRHToRef(e,t,i,r,n,a=!0,o,l=0){const c=1/Math.tan(e*.5),u=a?c/t:c,h=a?c:c*t,d=Math.tan(l);return Ce.FromValuesToRef(u,0,0,0,0,h,0,d,0,0,-i,-1,0,0,-1,0,n),o&&n.multiplyToRef(Rb,n),n._updateIdentityStatus(!1),n}static GetFinalMatrix(e,t,i,r,n,a){const o=e.width,l=e.height,c=e.x,u=e.y,h=Ce.FromValues(o/2,0,0,0,0,-l/2,0,0,0,0,a-n,0,c+o/2,l/2+u,n,1),d=new Ce;return t.multiplyToRef(i,d),d.multiplyToRef(r,d),d.multiplyToRef(h,d)}static GetAsMatrix2x2(e){const t=e.m,i=[t[0],t[1],t[4],t[5]];return zl.MatrixUse64Bits?i:new Float32Array(i)}static GetAsMatrix3x3(e){const t=e.m,i=[t[0],t[1],t[2],t[4],t[5],t[6],t[8],t[9],t[10]];return zl.MatrixUse64Bits?i:new Float32Array(i)}static Transpose(e){const t=new Ce;return Ce.TransposeToRef(e,t),t}static TransposeToRef(e,t){const i=e.m,r=i[0],n=i[4],a=i[8],o=i[12],l=i[1],c=i[5],u=i[9],h=i[13],d=i[2],f=i[6],m=i[10],p=i[14],_=i[3],v=i[7],x=i[11],S=i[15],b=t._m;return b[0]=r,b[1]=n,b[2]=a,b[3]=o,b[4]=l,b[5]=c,b[6]=u,b[7]=h,b[8]=d,b[9]=f,b[10]=m,b[11]=p,b[12]=_,b[13]=v,b[14]=x,b[15]=S,t.markAsUpdated(),t._updateIdentityStatus(e._isIdentity,e._isIdentityDirty),t}static Reflection(e){const t=new Ce;return Ce.ReflectionToRef(e,t),t}static ReflectionToRef(e,t){e.normalize();const i=e.normal.x,r=e.normal.y,n=e.normal.z,a=-2*i,o=-2*r,l=-2*n;return Ce.FromValuesToRef(a*i+1,o*i,l*i,0,a*r,o*r+1,l*r,0,a*n,o*n,l*n+1,0,a*e.d,o*e.d,l*e.d,1,t),t}static FromXYZAxesToRef(e,t,i,r){return Ce.FromValuesToRef(e._x,e._y,e._z,0,t._x,t._y,t._z,0,i._x,i._y,i._z,0,0,0,0,1,r),r}static FromQuaternionToRef(e,t){const i=e._x*e._x,r=e._y*e._y,n=e._z*e._z,a=e._x*e._y,o=e._z*e._w,l=e._z*e._x,c=e._y*e._w,u=e._y*e._z,h=e._x*e._w;return t._m[0]=1-2*(r+n),t._m[1]=2*(a+o),t._m[2]=2*(l-c),t._m[3]=0,t._m[4]=2*(a-o),t._m[5]=1-2*(n+i),t._m[6]=2*(u+h),t._m[7]=0,t._m[8]=2*(l+c),t._m[9]=2*(u-h),t._m[10]=1-2*(r+i),t._m[11]=0,t._m[12]=0,t._m[13]=0,t._m[14]=0,t._m[15]=1,t.markAsUpdated(),t}}Ce._IdentityReadOnly=Ce.Identity();class Ci{}Ci.Vector3=YS(11,O.Zero);Ci.Matrix=YS(2,Ce.Identity);Ci.Quaternion=YS(3,gt.Zero);class Ae{}Ae.Vector2=YS(3,vt.Zero);Ae.Vector3=YS(13,O.Zero);Ae.Vector4=YS(3,Hi.Zero);Ae.Quaternion=YS(3,gt.Zero);Ae.Matrix=YS(8,Ce.Identity);const Rb=Ce.FromValues(1,0,0,0,0,1,0,0,0,0,.5,0,0,0,.5,1);function HE(s){return Math.pow(s,TD)}function jE(s){return s<=.04045?.0773993808*s:Math.pow(.947867299*(s+.055),2.4)}function XE(s){return Math.pow(s,sR)}function $E(s){return s<=.0031308?12.92*s:1.055*Math.pow(s,.41666)-.055}class rt{constructor(e=0,t=0,i=0){this.r=e,this.g=t,this.b=i}toString(){return"{R: "+this.r+" G:"+this.g+" B:"+this.b+"}"}getClassName(){return"Color3"}getHashCode(){let e=this.r*255|0;return e=e*397^(this.g*255|0),e=e*397^(this.b*255|0),e}toArray(e,t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,this}fromArray(e,t=0){return rt.FromArrayToRef(e,t,this),this}toColor4(e=1){return new $t(this.r,this.g,this.b,e)}asArray(){return[this.r,this.g,this.b]}toLuminance(){return this.r*.3+this.g*.59+this.b*.11}multiply(e){return new rt(this.r*e.r,this.g*e.g,this.b*e.b)}multiplyToRef(e,t){return t.r=this.r*e.r,t.g=this.g*e.g,t.b=this.b*e.b,t}multiplyInPlace(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyByFloats(e,t,i){return new rt(this.r*e,this.g*t,this.b*i)}divide(e){throw new ReferenceError("Can not divide a color")}divideToRef(e,t){throw new ReferenceError("Can not divide a color")}divideInPlace(e){throw new ReferenceError("Can not divide a color")}minimizeInPlace(e){return this.minimizeInPlaceFromFloats(e.r,e.g,e.b)}maximizeInPlace(e){return this.maximizeInPlaceFromFloats(e.r,e.g,e.b)}minimizeInPlaceFromFloats(e,t,i){return this.r=Math.min(e,this.r),this.g=Math.min(t,this.g),this.b=Math.min(i,this.b),this}maximizeInPlaceFromFloats(e,t,i){return this.r=Math.max(e,this.r),this.g=Math.max(t,this.g),this.b=Math.max(i,this.b),this}floorToRef(e){throw new ReferenceError("Can not floor a color")}floor(){throw new ReferenceError("Can not floor a color")}fractToRef(e){throw new ReferenceError("Can not fract a color")}fract(){throw new ReferenceError("Can not fract a color")}equals(e){return e&&this.r===e.r&&this.g===e.g&&this.b===e.b}equalsFloats(e,t,i){return this.equalsToFloats(e,t,i)}equalsToFloats(e,t,i){return this.r===e&&this.g===t&&this.b===i}equalsWithEpsilon(e,t=rr){return fs(this.r,e.r,t)&&fs(this.g,e.g,t)&&fs(this.b,e.b,t)}negate(){throw new ReferenceError("Can not negate a color")}negateInPlace(){throw new ReferenceError("Can not negate a color")}negateToRef(e){throw new ReferenceError("Can not negate a color")}scale(e){return new rt(this.r*e,this.g*e,this.b*e)}scaleInPlace(e){return this.r*=e,this.g*=e,this.b*=e,this}scaleToRef(e,t){return t.r=this.r*e,t.g=this.g*e,t.b=this.b*e,t}scaleAndAddToRef(e,t){return t.r+=this.r*e,t.g+=this.g*e,t.b+=this.b*e,t}clampToRef(e=0,t=1,i){return i.r=_r(this.r,e,t),i.g=_r(this.g,e,t),i.b=_r(this.b,e,t),i}add(e){return new rt(this.r+e.r,this.g+e.g,this.b+e.b)}addInPlace(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addInPlaceFromFloats(e,t,i){return this.r+=e,this.g+=t,this.b+=i,this}addToRef(e,t){return t.r=this.r+e.r,t.g=this.g+e.g,t.b=this.b+e.b,t}subtract(e){return new rt(this.r-e.r,this.g-e.g,this.b-e.b)}subtractToRef(e,t){return t.r=this.r-e.r,t.g=this.g-e.g,t.b=this.b-e.b,t}subtractInPlace(e){return this.r-=e.r,this.g-=e.g,this.b-=e.b,this}subtractFromFloats(e,t,i){return new rt(this.r-e,this.g-t,this.b-i)}subtractFromFloatsToRef(e,t,i,r){return r.r=this.r-e,r.g=this.g-t,r.b=this.b-i,r}clone(){return new rt(this.r,this.g,this.b)}copyFrom(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copyFromFloats(e,t,i){return this.r=e,this.g=t,this.b=i,this}set(e,t,i){return this.copyFromFloats(e,t,i)}setAll(e){return this.r=this.g=this.b=e,this}toHexString(){const e=Math.round(this.r*255),t=Math.round(this.g*255),i=Math.round(this.b*255);return"#"+wm(e)+wm(t)+wm(i)}fromHexString(e){return e.substring(0,1)!=="#"||e.length!==7?this:(this.r=parseInt(e.substring(1,3),16)/255,this.g=parseInt(e.substring(3,5),16)/255,this.b=parseInt(e.substring(5,7),16)/255,this)}toHSV(){return this.toHSVToRef(new rt)}toHSVToRef(e){const t=this.r,i=this.g,r=this.b,n=Math.max(t,i,r),a=Math.min(t,i,r);let o=0,l=0;const c=n,u=n-a;return n!==0&&(l=u/n),n!=a&&(n==t?(o=(i-r)/u,i=0&&a<=1?(l=n,c=o):a>=1&&a<=2?(l=o,c=n):a>=2&&a<=3?(c=n,u=o):a>=3&&a<=4?(c=o,u=n):a>=4&&a<=5?(l=o,u=n):a>=5&&a<=6&&(l=n,u=o);const h=i-n;return r.r=l+h,r.g=c+h,r.b=u+h,r}static FromHSV(e,t,i){const r=new rt(0,0,0);return rt.HSVtoRGBToRef(e,t,i,r),r}static FromHexString(e){return new rt(0,0,0).fromHexString(e)}static FromArray(e,t=0){return new rt(e[t],e[t+1],e[t+2])}static FromArrayToRef(e,t=0,i){i.r=e[t],i.g=e[t+1],i.b=e[t+2]}static FromInts(e,t,i){return new rt(e/255,t/255,i/255)}static Lerp(e,t,i){const r=new rt(0,0,0);return rt.LerpToRef(e,t,i,r),r}static LerpToRef(e,t,i,r){r.r=e.r+(t.r-e.r)*i,r.g=e.g+(t.g-e.g)*i,r.b=e.b+(t.b-e.b)*i}static Hermite(e,t,i,r,n){const a=n*n,o=n*a,l=2*o-3*a+1,c=-2*o+3*a,u=o-2*a+n,h=o-a,d=e.r*l+i.r*c+t.r*u+r.r*h,f=e.g*l+i.g*c+t.g*u+r.g*h,m=e.b*l+i.b*c+t.b*u+r.b*h;return new rt(d,f,m)}static Hermite1stDerivative(e,t,i,r,n){const a=rt.Black();return this.Hermite1stDerivativeToRef(e,t,i,r,n,a),a}static Hermite1stDerivativeToRef(e,t,i,r,n,a){const o=n*n;a.r=(o-n)*6*e.r+(3*o-4*n+1)*t.r+(-o+n)*6*i.r+(3*o-2*n)*r.r,a.g=(o-n)*6*e.g+(3*o-4*n+1)*t.g+(-o+n)*6*i.g+(3*o-2*n)*r.g,a.b=(o-n)*6*e.b+(3*o-4*n+1)*t.b+(-o+n)*6*i.b+(3*o-2*n)*r.b}static Red(){return new rt(1,0,0)}static Green(){return new rt(0,1,0)}static Blue(){return new rt(0,0,1)}static Black(){return new rt(0,0,0)}static get BlackReadOnly(){return rt._BlackReadOnly}static White(){return new rt(1,1,1)}static Purple(){return new rt(.5,0,.5)}static Magenta(){return new rt(1,0,1)}static Yellow(){return new rt(1,1,0)}static Gray(){return new rt(.5,.5,.5)}static Teal(){return new rt(0,1,1)}static Random(){return new rt(Math.random(),Math.random(),Math.random())}}rt._V8PerformanceHack=new rt(.5,.5,.5);rt._BlackReadOnly=rt.Black();class $t{constructor(e=0,t=0,i=0,r=1){this.r=e,this.g=t,this.b=i,this.a=r}asArray(){return[this.r,this.g,this.b,this.a]}toArray(e,t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e[t+3]=this.a,this}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this.a=e[t+3],this}equals(e){return e&&this.r===e.r&&this.g===e.g&&this.b===e.b&&this.a===e.a}add(e){return new $t(this.r+e.r,this.g+e.g,this.b+e.b,this.a+e.a)}addToRef(e,t){return t.r=this.r+e.r,t.g=this.g+e.g,t.b=this.b+e.b,t.a=this.a+e.a,t}addInPlace(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this.a+=e.a,this}addInPlaceFromFloats(e,t,i,r){return this.r+=e,this.g+=t,this.b+=i,this.a+=r,this}subtract(e){return new $t(this.r-e.r,this.g-e.g,this.b-e.b,this.a-e.a)}subtractToRef(e,t){return t.r=this.r-e.r,t.g=this.g-e.g,t.b=this.b-e.b,t.a=this.a-e.a,t}subtractInPlace(e){return this.r-=e.r,this.g-=e.g,this.b-=e.b,this.a-=e.a,this}subtractFromFloats(e,t,i,r){return new $t(this.r-e,this.g-t,this.b-i,this.a-r)}subtractFromFloatsToRef(e,t,i,r,n){return n.r=this.r-e,n.g=this.g-t,n.b=this.b-i,n.a=this.a-r,n}scale(e){return new $t(this.r*e,this.g*e,this.b*e,this.a*e)}scaleInPlace(e){return this.r*=e,this.g*=e,this.b*=e,this.a*=e,this}scaleToRef(e,t){return t.r=this.r*e,t.g=this.g*e,t.b=this.b*e,t.a=this.a*e,t}scaleAndAddToRef(e,t){return t.r+=this.r*e,t.g+=this.g*e,t.b+=this.b*e,t.a+=this.a*e,t}clampToRef(e=0,t=1,i){return i.r=_r(this.r,e,t),i.g=_r(this.g,e,t),i.b=_r(this.b,e,t),i.a=_r(this.a,e,t),i}multiply(e){return new $t(this.r*e.r,this.g*e.g,this.b*e.b,this.a*e.a)}multiplyToRef(e,t){return t.r=this.r*e.r,t.g=this.g*e.g,t.b=this.b*e.b,t.a=this.a*e.a,t}multiplyInPlace(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this.a*=e.a,this}multiplyByFloats(e,t,i,r){return new $t(this.r*e,this.g*t,this.b*i,this.a*r)}divide(e){throw new ReferenceError("Can not divide a color")}divideToRef(e,t){throw new ReferenceError("Can not divide a color")}divideInPlace(e){throw new ReferenceError("Can not divide a color")}minimizeInPlace(e){return this.r=Math.min(this.r,e.r),this.g=Math.min(this.g,e.g),this.b=Math.min(this.b,e.b),this.a=Math.min(this.a,e.a),this}maximizeInPlace(e){return this.r=Math.max(this.r,e.r),this.g=Math.max(this.g,e.g),this.b=Math.max(this.b,e.b),this.a=Math.max(this.a,e.a),this}minimizeInPlaceFromFloats(e,t,i,r){return this.r=Math.min(e,this.r),this.g=Math.min(t,this.g),this.b=Math.min(i,this.b),this.a=Math.min(r,this.a),this}maximizeInPlaceFromFloats(e,t,i,r){return this.r=Math.max(e,this.r),this.g=Math.max(t,this.g),this.b=Math.max(i,this.b),this.a=Math.max(r,this.a),this}floorToRef(e){throw new ReferenceError("Can not floor a color")}floor(){throw new ReferenceError("Can not floor a color")}fractToRef(e){throw new ReferenceError("Can not fract a color")}fract(){throw new ReferenceError("Can not fract a color")}negate(){throw new ReferenceError("Can not negate a color")}negateInPlace(){throw new ReferenceError("Can not negate a color")}negateToRef(e){throw new ReferenceError("Can not negate a color")}equalsWithEpsilon(e,t=rr){return fs(this.r,e.r,t)&&fs(this.g,e.g,t)&&fs(this.b,e.b,t)&&fs(this.a,e.a,t)}equalsToFloats(e,t,i,r){return this.r===e&&this.g===t&&this.b===i&&this.a===r}toString(){return"{R: "+this.r+" G:"+this.g+" B:"+this.b+" A:"+this.a+"}"}getClassName(){return"Color4"}getHashCode(){let e=this.r*255|0;return e=e*397^(this.g*255|0),e=e*397^(this.b*255|0),e=e*397^(this.a*255|0),e}clone(){return new $t().copyFrom(this)}copyFrom(e){return this.r=e.r,this.g=e.g,this.b=e.b,this.a=e.a,this}copyFromFloats(e,t,i,r){return this.r=e,this.g=t,this.b=i,this.a=r,this}set(e,t,i,r){return this.copyFromFloats(e,t,i,r)}setAll(e){return this.r=this.g=this.b=this.a=e,this}toHexString(e=!1){const t=Math.round(this.r*255),i=Math.round(this.g*255),r=Math.round(this.b*255);if(e)return"#"+wm(t)+wm(i)+wm(r);const n=Math.round(this.a*255);return"#"+wm(t)+wm(i)+wm(r)+wm(n)}fromHexString(e){return e.substring(0,1)!=="#"||e.length!==9&&e.length!==7?this:(this.r=parseInt(e.substring(1,3),16)/255,this.g=parseInt(e.substring(3,5),16)/255,this.b=parseInt(e.substring(5,7),16)/255,e.length===9&&(this.a=parseInt(e.substring(7,9),16)/255),this)}toLinearSpace(e=!1){const t=new $t;return this.toLinearSpaceToRef(t,e),t}toLinearSpaceToRef(e,t=!1){return t?(e.r=jE(this.r),e.g=jE(this.g),e.b=jE(this.b)):(e.r=HE(this.r),e.g=HE(this.g),e.b=HE(this.b)),e.a=this.a,this}toGammaSpace(e=!1){const t=new $t;return this.toGammaSpaceToRef(t,e),t}toGammaSpaceToRef(e,t=!1){return t?(e.r=$E(this.r),e.g=$E(this.g),e.b=$E(this.b)):(e.r=XE(this.r),e.g=XE(this.g),e.b=XE(this.b)),e.a=this.a,this}static FromHexString(e){return e.substring(0,1)!=="#"||e.length!==9&&e.length!==7?new $t(0,0,0,0):new $t(0,0,0,1).fromHexString(e)}static Lerp(e,t,i){return $t.LerpToRef(e,t,i,new $t)}static LerpToRef(e,t,i,r){return r.r=e.r+(t.r-e.r)*i,r.g=e.g+(t.g-e.g)*i,r.b=e.b+(t.b-e.b)*i,r.a=e.a+(t.a-e.a)*i,r}static Hermite(e,t,i,r,n){const a=n*n,o=n*a,l=2*o-3*a+1,c=-2*o+3*a,u=o-2*a+n,h=o-a,d=e.r*l+i.r*c+t.r*u+r.r*h,f=e.g*l+i.g*c+t.g*u+r.g*h,m=e.b*l+i.b*c+t.b*u+r.b*h,p=e.a*l+i.a*c+t.a*u+r.a*h;return new $t(d,f,m,p)}static Hermite1stDerivative(e,t,i,r,n){const a=new $t;return this.Hermite1stDerivativeToRef(e,t,i,r,n,a),a}static Hermite1stDerivativeToRef(e,t,i,r,n,a){const o=n*n;a.r=(o-n)*6*e.r+(3*o-4*n+1)*t.r+(-o+n)*6*i.r+(3*o-2*n)*r.r,a.g=(o-n)*6*e.g+(3*o-4*n+1)*t.g+(-o+n)*6*i.g+(3*o-2*n)*r.g,a.b=(o-n)*6*e.b+(3*o-4*n+1)*t.b+(-o+n)*6*i.b+(3*o-2*n)*r.b,a.a=(o-n)*6*e.a+(3*o-4*n+1)*t.a+(-o+n)*6*i.a+(3*o-2*n)*r.a}static FromColor3(e,t=1){return new $t(e.r,e.g,e.b,t)}static FromArray(e,t=0){return new $t(e[t],e[t+1],e[t+2],e[t+3])}static FromArrayToRef(e,t=0,i){i.r=e[t],i.g=e[t+1],i.b=e[t+2],i.a=e[t+3]}static FromInts(e,t,i,r){return new $t(e/255,t/255,i/255,r/255)}static CheckColors4(e,t){if(e.length===t*3){const i=[];for(let r=0;rnew $t(0,0,0,0));class In{constructor(e,t){this.triggerOptions=e,this.onBeforeExecuteObservable=new Ge,e.parameter?(this.trigger=e.trigger,this._triggerParameter=e.parameter):e.trigger?this.trigger=e.trigger:this.trigger=e,this._nextActiveAction=this,this._condition=t}_prepare(){}getTriggerParameter(){return this._triggerParameter}setTriggerParameter(e){this._triggerParameter=e}_evaluateConditionForCurrentFrame(){const e=this._condition;if(!e)return!0;const t=this._actionManager.getScene().getRenderId();return e._evaluationId!==t&&(e._evaluationId=t,e._currentResult=e.isValid()),e._currentResult}_executeCurrent(e){this._evaluateConditionForCurrentFrame()&&(this.onBeforeExecuteObservable.notifyObservers(this),this._nextActiveAction.execute(e),this.skipToNextActiveAction())}execute(e){}skipToNextActiveAction(){this._nextActiveAction._child?(this._nextActiveAction._child._actionManager||(this._nextActiveAction._child._actionManager=this._actionManager),this._nextActiveAction=this._nextActiveAction._child):this._nextActiveAction=this}then(e){return this._child=e,e._actionManager=this._actionManager,e._prepare(),e}_getProperty(e){return this._actionManager._getProperty(e)}_getEffectiveTarget(e,t){return this._actionManager._getEffectiveTarget(e,t)}serialize(e){return null}_serialize(e,t){const i={type:1,children:[],name:e.name,properties:e.properties||[]};if(this._child&&this._child.serialize(i),this._condition){const r=this._condition.serialize();return r.children.push(i),t&&t.children.push(r),r}return t&&t.children.push(i),i}}In._SerializeValueAsString=s=>typeof s=="number"?s.toString():typeof s=="boolean"?s?"true":"false":s instanceof vt?s.x+", "+s.y:s instanceof O?s.x+", "+s.y+", "+s.z:s instanceof rt?s.r+", "+s.g+", "+s.b:s instanceof $t?s.r+", "+s.g+", "+s.b+", "+s.a:s;In._GetTargetProperty=s=>({name:"target",targetType:s._isMesh?"MeshProperties":s._isLight?"LightProperties":s._isCamera?"CameraProperties":s._isMaterial?"MaterialProperties":"SceneProperties",value:s._isScene?"Scene":s.name});let iY=!1;function qme(){iY||(iY=!0,Se("BABYLON.Action",In))}qme();class ca{constructor(e,t,i,r,n,a){this.source=e,this.pointerX=t,this.pointerY=i,this.meshUnderPointer=r,this.sourceEvent=n,this.additionalData=a}static CreateNew(e,t,i){const r=e.getScene();return new ca(e,r.pointerX,r.pointerY,r.meshUnderPointer||e,t,i)}static CreateNewFromSprite(e,t,i,r){return new ca(e,t.pointerX,t.pointerY,t.meshUnderPointer,i,r)}static CreateNewFromScene(e,t){return new ca(null,e.pointerX,e.pointerY,e.meshUnderPointer,t)}static CreateNewFromPrimitive(e,t,i,r){return new ca(e,t.x,t.y,null,i,r)}}class jR{constructor(e){this._actionManager=e}isValid(){return!0}_getProperty(e){return this._actionManager._getProperty(e)}_getEffectiveTarget(e,t){return this._actionManager._getEffectiveTarget(e,t)}serialize(){}_serialize(e){return{type:2,children:[],name:e.name,properties:e.properties}}}class Sl extends jR{static get IsEqual(){return Sl._IsEqual}static get IsDifferent(){return Sl._IsDifferent}static get IsGreater(){return Sl._IsGreater}static get IsLesser(){return Sl._IsLesser}constructor(e,t,i,r,n=Sl.IsEqual){super(e),this.propertyPath=i,this.value=r,this.operator=n,this._target=t,this._effectiveTarget=this._getEffectiveTarget(t,this.propertyPath),this._property=this._getProperty(this.propertyPath)}isValid(){switch(this.operator){case Sl.IsGreater:return this._effectiveTarget[this._property]>this.value;case Sl.IsLesser:return this._effectiveTarget[this._property]r<10?"0"+r:""+r,i=new Date;return"["+t(i.getHours())+":"+t(i.getMinutes())+":"+t(i.getSeconds())+"]: "+e}static _LogDisabled(e,t){}static _LogEnabled(e=1,t,i){const r=Array.isArray(t)?t[0]:t;if(i!==void 0&&!ye._CheckLimit(r,i))return;const n=ye._FormatMessage(r),a=this._Levels[e],o=Array.isArray(t)?t.slice(1):[];a.logFunc&&a.logFunc("BJS - "+n,...o);const l=`${n}
`;ye._AddLogEntry(l),ye._GenerateLimitMessage(r,e)}static get LogCache(){return ye._LogCache}static ClearLogCache(){ye._LogCache="",ye._LogLimitOutputs={},ye.errorsCount=0}static set LogLevels(e){ye.Log=ye._LogDisabled,ye.Warn=ye._LogDisabled,ye.Error=ye._LogDisabled;const t=[ye.MessageLogLevel,ye.WarningLogLevel,ye.ErrorLogLevel];for(const i of t)if((e&i)===i){const r=this._Levels[i];ye[r.name]=ye._LogEnabled.bind(ye,i)}}}ye.NoneLogLevel=0;ye.MessageLogLevel=1;ye.WarningLogLevel=2;ye.ErrorLogLevel=4;ye.AllLogLevel=7;ye.MessageLimitReached="Too many %TYPE%s (%LIMIT%), no more %TYPE%s will be reported for this message.";ye._LogCache="";ye._LogLimitOutputs={};ye._Levels=[{},{color:"white",logFunc:console.log,name:"Log"},{color:"orange",logFunc:console.warn,name:"Warn"},{},{color:"red",logFunc:console.error,name:"Error"}];ye.errorsCount=0;ye.Log=ye._LogEnabled.bind(ye,ye.MessageLogLevel);ye.Warn=ye._LogEnabled.bind(ye,ye.WarningLogLevel);ye.Error=ye._LogEnabled.bind(ye,ye.ErrorLogLevel);class xke extends In{constructor(e,t,i,r){super(e,r),this.propertyPath=i,this._target=this._effectiveTarget=t}_prepare(){this._effectiveTarget=this._getEffectiveTarget(this._effectiveTarget,this.propertyPath),this._property=this._getProperty(this.propertyPath)}execute(){this._effectiveTarget[this._property]=!this._effectiveTarget[this._property]}serialize(e){return super._serialize({name:"SwitchBooleanAction",properties:[In._GetTargetProperty(this._target),{name:"propertyPath",value:this.propertyPath}]},e)}}class Ske extends In{constructor(e,t,i,r){super(e,r),this.value=i,this._target=t}execute(){this._target.state=this.value}serialize(e){return super._serialize({name:"SetStateAction",properties:[In._GetTargetProperty(this._target),{name:"value",value:this.value}]},e)}}class bke extends In{constructor(e,t,i,r,n){super(e,n),this.propertyPath=i,this.value=r,this._target=this._effectiveTarget=t}_prepare(){this._effectiveTarget=this._getEffectiveTarget(this._effectiveTarget,this.propertyPath),this._property=this._getProperty(this.propertyPath)}execute(){this._effectiveTarget[this._property]=this.value,this._target.markAsDirty&&this._target.markAsDirty(this._property)}serialize(e){return super._serialize({name:"SetValueAction",properties:[In._GetTargetProperty(this._target),{name:"propertyPath",value:this.propertyPath},{name:"value",value:In._SerializeValueAsString(this.value)}]},e)}}class Tke extends In{constructor(e,t,i,r,n){super(e,n),this.propertyPath=i,this.value=r,this._target=this._effectiveTarget=t}_prepare(){this._effectiveTarget=this._getEffectiveTarget(this._effectiveTarget,this.propertyPath),this._property=this._getProperty(this.propertyPath),typeof this._effectiveTarget[this._property]!="number"&&ye.Warn("Warning: IncrementValueAction can only be used with number values")}execute(){this._effectiveTarget[this._property]+=this.value,this._target.markAsDirty&&this._target.markAsDirty(this._property)}serialize(e){return super._serialize({name:"IncrementValueAction",properties:[In._GetTargetProperty(this._target),{name:"propertyPath",value:this.propertyPath},{name:"value",value:In._SerializeValueAsString(this.value)}]},e)}}class yke extends In{constructor(e,t,i,r,n,a){super(e,a),this.from=i,this.to=r,this.loop=n,this._target=t}_prepare(){}execute(){this._actionManager.getScene().beginAnimation(this._target,this.from,this.to,this.loop)}serialize(e){return super._serialize({name:"PlayAnimationAction",properties:[In._GetTargetProperty(this._target),{name:"from",value:String(this.from)},{name:"to",value:String(this.to)},{name:"loop",value:In._SerializeValueAsString(this.loop)||!1}]},e)}}class Eke extends In{constructor(e,t,i){super(e,i),this._target=t}_prepare(){}execute(){this._actionManager.getScene().stopAnimation(this._target)}serialize(e){return super._serialize({name:"StopAnimationAction",properties:[In._GetTargetProperty(this._target)]},e)}}class Kme extends In{constructor(e=0,t){super(e,t)}execute(){}serialize(e){return super._serialize({name:"DoNothingAction",properties:[]},e)}}class Cke extends In{constructor(e,t,i,r=!0){super(e,i),this.children=t,this.enableChildrenConditions=r}_prepare(){for(let e=0;e!s||s.getClassName&&s.getClassName()==="Mesh"?null:s.getClassName&&(s.getClassName()==="SubMesh"||s.getClassName()==="PhysicsBody")?s.clone(e):s.clone?s.clone():Array.isArray(s)?s.slice():t&&typeof s=="object"?{...s}:null;function Ike(s){const e=[];do{const t=Object.getOwnPropertyNames(s);for(const i of t)e.indexOf(i)===-1&&e.push(i)}while(s=Object.getPrototypeOf(s));return e}class $l{static DeepCopy(e,t,i,r,n=!1){const a=Ike(e);for(const o of a){if(o[0]==="_"&&(!r||r.indexOf(o)===-1)||o.endsWith("Observable")||i&&i.indexOf(o)!==-1)continue;const l=e[o],c=typeof l;if(c!=="function")try{if(c==="object")if(l instanceof Uint8Array)t[o]=Uint8Array.from(l);else if(l instanceof Array){if(t[o]=[],l.length>0)if(typeof l[0]=="object")for(let u=0;u-1&&this._scene.actionManagers.splice(e,1);const t=this._scene.meshes.filter(i=>i.actionManager===this);for(const i of t)i.actionManager=null}getScene(){return this._scene}hasSpecificTriggers(e){for(let t=0;t-1)return!0}return!1}hasSpecificTriggers2(e,t){for(let i=0;i=Ws.OnPickTrigger&&t.trigger<=Ws.OnPointerOutTrigger&&t._evaluateConditionForCurrentFrame())return!0}return!1}get hasPickTriggers(){for(let e=0;e=Ws.OnPickTrigger&&t.trigger<=Ws.OnPickUpTrigger&&t._evaluateConditionForCurrentFrame())return!0}return!1}registerAction(e){return e.trigger===Ws.OnEveryFrameTrigger&&this.getScene().actionManager!==this?(ye.Warn("OnEveryFrameTrigger can only be used with scene.actionManager"),null):(this.actions.push(e),this.getScene()._registeredActions++,Ws.Triggers[e.trigger]?Ws.Triggers[e.trigger]++:Ws.Triggers[e.trigger]=1,e._actionManager=this,e._prepare(),e)}unregisterAction(e){const t=this.actions.indexOf(e);return t!==-1?(this.actions.splice(t,1),Ws.Triggers[e.trigger]-=1,Ws.Triggers[e.trigger]===0&&delete Ws.Triggers[e.trigger],e._actionManager=null,this.getScene()._registeredActions--,!0):!1}processTrigger(e,t){for(let i=0;i{const u=ia("BABYLON."+l);return u&&new u(...c)},a=(l,c,u,h)=>{if(h===null){const p=parseFloat(c);return c==="true"||c==="false"?c==="true":isNaN(p)?c:p}const d=h.split("."),f=c.split(",");for(let p=0;p{if(l.detached)return;const f=[];let m=null,p=null;const _=l.combine&&l.combine.length>0;if(l.type===2?f.push(r):f.push(c),_){const x=[];for(let S=0;S0){const h=u.properties[0].value,d=u.properties[0].targetType===null?h:i.getMeshByName(h);d._meshId&&(d.mesh=i.getMeshById(d._meshId)),c={trigger:Ws[u.name],parameter:d}}else c=Ws[u.name];for(let h=0;h=0;f--){var m={};for(var p in i)m[p]=p==="access"?{}:i[p];for(var p in i.access)m.access[p]=i.access[p];m.addInitializer=function(v){if(d)throw new TypeError("Cannot add initializers after decoration has completed");n.push(a(v||null))};var _=(0,t[f])(o==="accessor"?{get:u.get,set:u.set}:u[l],m);if(o==="accessor"){if(_===void 0)continue;if(_===null||typeof _!="object")throw new TypeError("Object expected");(h=a(_.get))&&(u.get=h),(h=a(_.set))&&(u.set=h),(h=a(_.init))&&r.unshift(h)}else(h=a(_))&&(o==="field"?r.unshift(h):u[l]=h)}c&&Object.defineProperty(c,i.name,u),d=!0}function C(s,e,t){for(var i=arguments.length>2,r=0;r{if(!i.metadata)return;const r=String(i.name),n=e_e(i.metadata);n[r]||(n[r]={type:s,sourceName:e})}}function Lke(s,e=null){return(t,i)=>{const r=e||"_"+String(i.name);return{init(n){return(n!==void 0||!(r in this))&&(this[r]=n),n},get(){return this[r]},set(n){var a;typeof((a=this[r])==null?void 0:a.equals)=="function"&&this[r].equals(n)||this[r]!==n&&(this[r]=n,this[s]())}}}}function ht(s,e=null){return Lke(s,e)}function se(s){return Kp(0,s)}function Ur(s){return Kp(1,s)}function Gn(s){return Kp(2,s)}function CC(s){return Kp(3,s)}function Z5(s){return Kp(4,s)}function Rl(s){return Kp(5,s)}function qI(s){return Kp(6,s)}function Fke(s){return Kp(7,s)}function K5(s){return Kp(8,s)}function Bke(s){return Kp(10,s)}function QF(s){return Kp(12,s)}function kke(s){return Kp(11,s)}function t_e(s,e,t){const i=String(e.name);let r=null;const n=function(...a){if(r===null){r=s,typeof _native<"u"&&_native[i]&&(r=t(_native[i],s));const o=this&&(e.static?this:Object.getPrototypeOf(this));(o==null?void 0:o[i])===n&&(o[i]=r)}return r.apply(this,a)};return n}function bv(s,e){return t_e(s,e,t=>t)}bv.filter=function(s){return(e,t)=>t_e(e,t,(i,r)=>function(...n){return s(...n)?i(...n):r.apply(this,n)})};function tr(s,e=null){return(t,i)=>{const r=e||"_"+String(i.name);return{get(){var n;return(n=this[r])==null?void 0:n.value},set(n){var a,o;typeof((o=(a=this[r])==null?void 0:a.value)==null?void 0:o.equals)=="function"&&this[r].value.equals(n)||this[r].value!==n&&(this[r].value=n,this[s]())}}}}class rT{static Eval(e,t){return e.match(/\([^()]*\)/g)?e=e.replace(/\([^()]*\)/g,i=>(i=i.slice(1,i.length-1),rT._HandleParenthesisContent(i,t))):e=rT._HandleParenthesisContent(e,t),e==="true"?!0:e==="false"?!1:rT.Eval(e,t)}static _HandleParenthesisContent(e,t){t=t||(n=>n==="true");let i;const r=e.split("||");for(const n in r)if(Object.prototype.hasOwnProperty.call(r,n)){let a=rT._SimplifyNegation(r[n].trim());const o=a.split("&&");if(o.length>1)for(let l=0;l(t=t.replace(/[\s]/g,()=>""),t.length%2?"!":"")),e=e.trim(),e==="!true"?e="false":e==="!false"&&(e="true"),e}}class rs{static EnableFor(e){e._tags=e._tags||{},e.hasTags=()=>rs.HasTags(e),e.addTags=t=>rs.AddTagsTo(e,t),e.removeTags=t=>rs.RemoveTagsFrom(e,t),e.matchesTagsQuery=t=>rs.MatchesQuery(e,t)}static DisableFor(e){delete e._tags,delete e.hasTags,delete e.addTags,delete e.removeTags,delete e.matchesTagsQuery}static HasTags(e){if(!e._tags)return!1;const t=e._tags;for(const i in t)if(Object.prototype.hasOwnProperty.call(t,i))return!0;return!1}static GetTags(e,t=!0){if(!e._tags)return null;if(t){const i=[];for(const r in e._tags)Object.prototype.hasOwnProperty.call(e._tags,r)&&e._tags[r]===!0&&i.push(r);return i.join(" ")}else return e._tags}static AddTagsTo(e,t){if(!t||typeof t!="string")return;const i=t.split(" ");for(const r of i)rs._AddTagTo(e,r)}static _AddTagTo(e,t){t=t.trim(),!(t===""||t==="true"||t==="false")&&(t.match(/[\s]/)||t.match(/^([!]|([|]|[&]){2})/)||(rs.EnableFor(e),e._tags[t]=!0))}static RemoveTagsFrom(e,t){if(!rs.HasTags(e))return;const i=t.split(" ");for(const r in i)rs._RemoveTagFrom(e,i[r])}static _RemoveTagFrom(e,t){delete e._tags[t]}static MatchesQuery(e,t){return t===void 0?!0:t===""?rs.HasTags(e):rT.Eval(t,i=>rs.HasTags(e)&&e._tags[i])}}const hY=function(s,e,t,i={}){const r=s();rs&&rs.HasTags(e)&&rs.AddTagsTo(r,rs.GetTags(e,!0));const n=KF(r),a={};for(const o in n){const l=n[o],c=e[o],u=l.type;if(c!=null&&(o!=="uniqueId"||li.AllowLoadingUniqueId))switch(u){case 0:case 6:case 9:case 11:typeof c.slice=="function"?r[o]=c.slice():r[o]=c;break;case 1:i.cloneTexturesOnlyOnce&&a[c.uniqueId]?r[o]=a[c.uniqueId]:(r[o]=t||c.isRenderTarget?c:c.clone(),a[c.uniqueId]=r[o]);break;case 2:case 3:case 4:case 5:case 7:case 8:case 10:case 12:case 13:r[o]=t?c:c.clone();break}}return r};class li{static AppendSerializedAnimations(e,t){if(e.animations){t.animations=[];for(let i=0;i{throw Wi("ImageProcessingConfiguration")};li._FresnelParametersParser=s=>{throw Wi("FresnelParameters")};li._ColorCurvesParser=s=>{throw Wi("ColorCurves")};li._TextureParser=(s,e,t)=>{throw Wi("Texture")};class Vke{constructor(){this._doNotSerialize=!1,this._isDisposed=!1,this._sceneRootNodesIndex=-1,this._isEnabled=!0,this._isParentEnabled=!0,this._isReady=!0,this._onEnabledStateChangedObservable=new Ge,this._onClonedObservable=new Ge,this._inheritVisibility=!1,this._isVisible=!0}}let rn=(()=>{var s;let e,t=[],i=[],r,n=[],a=[],o,l=[],c=[],u,h=[],d=[],f,m=[],p=[];return s=class{static AddNodeConstructor(v,x){this._NodeConstructors[v]=x}static Construct(v,x,S,b){const y=this._NodeConstructors[v];return y?y(x,S,b):null}set accessibilityTag(v){this._accessibilityTag=v,this.onAccessibilityTagChangedObservable.notifyObservers(v)}get accessibilityTag(){return this._accessibilityTag}get doNotSerialize(){return this._nodeDataStorage._doNotSerialize?!0:this._parentNode?this._parentNode.doNotSerialize:!1}set doNotSerialize(v){this._nodeDataStorage._doNotSerialize=v}isDisposed(){return this._nodeDataStorage._isDisposed}set parent(v){if(this._parentNode===v)return;const x=this._parentNode;if(this._parentNode&&this._parentNode._children!==void 0&&this._parentNode._children!==null){const S=this._parentNode._children.indexOf(this);S!==-1&&this._parentNode._children.splice(S,1),!v&&!this._nodeDataStorage._isDisposed&&this._addToSceneRootNodes()}this._parentNode=v,this._isDirty=!0,this._parentNode&&((this._parentNode._children===void 0||this._parentNode._children===null)&&(this._parentNode._children=new Array),this._parentNode._children.push(this),x||this._removeFromSceneRootNodes()),this._syncParentEnabledState()}get parent(){return this._parentNode}get inheritVisibility(){return this._nodeDataStorage._inheritVisibility}set inheritVisibility(v){this._nodeDataStorage._inheritVisibility=v}get isVisible(){return this.inheritVisibility&&this._parentNode&&!this._parentNode.isVisible?!1:this._nodeDataStorage._isVisible}set isVisible(v){this._nodeDataStorage._isVisible=v}_serializeAsParent(v){v.parentId=this.uniqueId}_addToSceneRootNodes(){this._nodeDataStorage._sceneRootNodesIndex===-1&&(this._nodeDataStorage._sceneRootNodesIndex=this._scene.rootNodes.length,this._scene.rootNodes.push(this))}_removeFromSceneRootNodes(){if(this._nodeDataStorage._sceneRootNodesIndex!==-1){const v=this._scene.rootNodes,x=v.length-1;v[this._nodeDataStorage._sceneRootNodesIndex]=v[x],v[this._nodeDataStorage._sceneRootNodesIndex]._nodeDataStorage._sceneRootNodesIndex=this._nodeDataStorage._sceneRootNodesIndex,this._scene.rootNodes.pop(),this._nodeDataStorage._sceneRootNodesIndex=-1}}get animationPropertiesOverride(){return this._animationPropertiesOverride?this._animationPropertiesOverride:this._scene.animationPropertiesOverride}set animationPropertiesOverride(v){this._animationPropertiesOverride=v}getClassName(){return"Node"}set onDispose(v){this._onDisposeObserver&&this.onDisposeObservable.remove(this._onDisposeObserver),this._onDisposeObserver=this.onDisposeObservable.add(v)}get onEnabledStateChangedObservable(){return this._nodeDataStorage._onEnabledStateChangedObservable}get onClonedObservable(){return this._nodeDataStorage._onClonedObservable}constructor(v,x=null,S=!0){this._isDirty=!1,this._nodeDataStorage=new Vke,this.name=C(this,t,void 0),this.id=(C(this,i),C(this,n,void 0)),this.uniqueId=(C(this,a),C(this,l,void 0)),this.state=(C(this,c),C(this,h,"")),this.metadata=(C(this,d),C(this,m,null)),this._internalMetadata=C(this,p),this.reservedDataStore=null,this._accessibilityTag=null,this.onAccessibilityTagChangedObservable=new Ge,this._parentContainer=null,this.animations=[],this._ranges={},this.onReady=null,this._currentRenderId=-1,this._parentUpdateId=-1,this._childUpdateId=-1,this._waitingParentId=null,this._waitingParentInstanceIndex=null,this._waitingParsedUniqueId=null,this._cache={},this._parentNode=null,this._children=null,this._worldMatrix=Ce.Identity(),this._worldMatrixDeterminant=0,this._worldMatrixDeterminantIsDirty=!0,this._animationPropertiesOverride=null,this._isNode=!0,this.onDisposeObservable=new Ge,this._onDisposeObserver=null,this._behaviors=new Array,this.name=v,this.id=v,this._scene=x||Kt.LastCreatedScene,this.uniqueId=this._scene.getUniqueId(),this._initCache(),S&&this._addToSceneRootNodes()}getScene(){return this._scene}getEngine(){return this._scene.getEngine()}addBehavior(v,x=!1){return this._behaviors.indexOf(v)!==-1?this:(v.init(),this._scene.isLoading&&!x?this._scene.onDataLoadedObservable.addOnce(()=>{this._behaviors.includes(v)&&v.attach(this)}):v.attach(this),this._behaviors.push(v),this)}removeBehavior(v){const x=this._behaviors.indexOf(v);return x===-1?this:(this._behaviors.splice(x,1),v.detach(),this)}get behaviors(){return this._behaviors}getBehaviorByName(v){for(const x of this._behaviors)if(x.name===v)return x;return null}getWorldMatrix(){return this._currentRenderId!==this._scene.getRenderId()&&this.computeWorldMatrix(),this._worldMatrix}_getWorldMatrixDeterminant(){return this._worldMatrixDeterminantIsDirty&&(this._worldMatrixDeterminantIsDirty=!1,this._worldMatrixDeterminant=this._worldMatrix.determinant()),this._worldMatrixDeterminant}get worldMatrixFromCache(){return this._worldMatrix}_initCache(){this._cache={}}updateCache(v){!v&&this.isSynchronized()||this._updateCache()}_getActionManagerForTrigger(v,x=!0){return this.parent?this.parent._getActionManagerForTrigger(v,!1):null}_updateCache(v){}_isSynchronized(){return!0}_markSyncedWithParent(){this._parentNode&&(this._parentUpdateId=this._parentNode._childUpdateId)}isSynchronizedWithParent(){return this._parentNode?this._parentNode._isDirty||this._parentUpdateId!==this._parentNode._childUpdateId?!1:this._parentNode.isSynchronized():!0}isSynchronized(){return this._parentNode&&!this.isSynchronizedWithParent()?!1:this._isSynchronized()}isReady(v=!1){return this._nodeDataStorage._isReady}markAsDirty(v){return this._currentRenderId=Number.MAX_VALUE,this._isDirty=!0,this}isEnabled(v=!0){return v===!1?this._nodeDataStorage._isEnabled:this._nodeDataStorage._isEnabled?this._nodeDataStorage._isParentEnabled:!1}_syncParentEnabledState(){if(this._nodeDataStorage._isParentEnabled=this._parentNode?this._parentNode.isEnabled():!0,this._children)for(const v of this._children)v._syncParentEnabledState()}setEnabled(v){this._nodeDataStorage._isEnabled!==v&&(this._nodeDataStorage._isEnabled=v,this._syncParentEnabledState(),this._nodeDataStorage._onEnabledStateChangedObservable.notifyObservers(v))}isDescendantOf(v){return this.parent?this.parent===v?!0:this.parent.isDescendantOf(v):!1}_getDescendants(v,x=!1,S){if(this._children)for(let b=0;b(!x||x(b))&&b.cullingStrategy!==void 0),S}getChildren(v,x=!0){return this.getDescendants(x,v)}_setReady(v){if(v!==this._nodeDataStorage._isReady){if(!v){this._nodeDataStorage._isReady=!1;return}this.onReady&&this.onReady(this),this._nodeDataStorage._isReady=!0}}getAnimationByName(v){for(let x=0;xnew s(v,this.getScene()),this);if(x&&(b.parent=x),!S){const y=this.getDescendants(!0);for(let I=0;I{const _=typeof Symbol=="function"&&Symbol.metadata?Object.create(null):void 0;e=[se()],r=[se()],o=[se()],u=[se()],f=[se()],F(null,null,e,{kind:"field",name:"name",static:!1,private:!1,access:{has:v=>"name"in v,get:v=>v.name,set:(v,x)=>{v.name=x}},metadata:_},t,i),F(null,null,r,{kind:"field",name:"id",static:!1,private:!1,access:{has:v=>"id"in v,get:v=>v.id,set:(v,x)=>{v.id=x}},metadata:_},n,a),F(null,null,o,{kind:"field",name:"uniqueId",static:!1,private:!1,access:{has:v=>"uniqueId"in v,get:v=>v.uniqueId,set:(v,x)=>{v.uniqueId=x}},metadata:_},l,c),F(null,null,u,{kind:"field",name:"state",static:!1,private:!1,access:{has:v=>"state"in v,get:v=>v.state,set:(v,x)=>{v.state=x}},metadata:_},h,d),F(null,null,f,{kind:"field",name:"metadata",static:!1,private:!1,access:{has:v=>"metadata"in v,get:v=>v.metadata,set:(v,x)=>{v.metadata=x}},metadata:_},m,p),_&&Object.defineProperty(s,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:_})})(),s._AnimationRangeFactory=(_,v,x)=>{throw Wi("AnimationRange")},s._NodeConstructors={},s})();class Lf{constructor(e,t){this.width=e,this.height=t}toString(){return`{W: ${this.width}, H: ${this.height}}`}getClassName(){return"Size"}getHashCode(){let e=this.width|0;return e=e*397^(this.height|0),e}copyFrom(e){this.width=e.width,this.height=e.height}copyFromFloats(e,t){return this.width=e,this.height=t,this}set(e,t){return this.copyFromFloats(e,t)}multiplyByFloats(e,t){return new Lf(this.width*e,this.height*t)}clone(){return new Lf(this.width,this.height)}equals(e){return e?this.width===e.width&&this.height===e.height:!1}get surface(){return this.width*this.height}static Zero(){return new Lf(0,0)}add(e){return new Lf(this.width+e.width,this.height+e.height)}subtract(e){return new Lf(this.width-e.width,this.height-e.height)}scale(e){return new Lf(this.width*e,this.height*e)}static Lerp(e,t,i){const r=e.width+(t.width-e.width)*i,n=e.height+(t.height-e.height)*i;return new Lf(r,n)}}function Uke(){return typeof _native<"u"&&_native.XMLHttpRequest?new _native.XMLHttpRequest:new XMLHttpRequest}class cn{constructor(){this._xhr=Uke(),this._requestURL=""}static get IsCustomRequestAvailable(){return Object.keys(cn.CustomRequestHeaders).length>0||cn.CustomRequestModifiers.length>0}static _CleanUrl(e){return e=e.replace("file:http:","http:"),e=e.replace("file:https:","https:"),e}static _ShouldSkipRequestModifications(e){return cn.SkipRequestModificationForBabylonCDN&&(e.includes("preview.babylonjs.com")||e.includes("cdn.babylonjs.com"))}static _CollectCustomizations(e,t={}){const i={...t};if(cn._ShouldSkipRequestModifications(e))return{url:e,headers:i};for(const n in cn.CustomRequestHeaders){const a=cn.CustomRequestHeaders[n];a&&(i[n]=a)}const r={setRequestHeader:(n,a)=>{i[n]=a}};for(const n of cn.CustomRequestModifiers){if(cn._ShouldSkipRequestModifications(e))break;const a=n(r,e);typeof a=="string"&&(e=a)}return{url:e,headers:i}}static async FetchAsync(e,t={}){const i=t.method??"GET";if(typeof fetch<"u"){const{url:r,headers:n}=cn._CollectCustomizations(cn._CleanUrl(e),t.headers??{});return await fetch(r,{method:i,headers:n,body:t.body??void 0})}return await new Promise((r,n)=>{const a=new cn;a.responseType="arraybuffer",a.addEventListener("readystatechange",()=>{if(a.readyState===4)if(a.status>=200&&a.status<300){const o=typeof Headers<"u"?new Headers:void 0,l=a.getResponseHeader("Content-Type");l&&o&&o.set("Content-Type",l),r(typeof Response<"u"?new Response(a.response,{status:a.status,statusText:a.statusText,headers:o}):{ok:!0,status:a.status,statusText:a.statusText,headers:{get:c=>a.getResponseHeader(c)},arrayBuffer:async()=>await Promise.resolve(a.response)})}else n(new Error(`HTTP ${a.status} loading '${a.requestURL}': ${a.statusText}`))}),a.open(i,e,t.headers),a.send(t.body??null)})}get requestURL(){return this._requestURL}get onprogress(){return this._xhr.onprogress}set onprogress(e){this._xhr.onprogress=e}get readyState(){return this._xhr.readyState}get status(){return this._xhr.status}get statusText(){return this._xhr.statusText}get response(){return this._xhr.response}get responseURL(){return this._xhr.responseURL}get responseText(){return this._xhr.responseText}get responseType(){return this._xhr.responseType}set responseType(e){this._xhr.responseType=e}get timeout(){return this._xhr.timeout}set timeout(e){this._xhr.timeout=e}addEventListener(e,t,i){this._xhr.addEventListener(e,t,i)}removeEventListener(e,t,i){this._xhr.removeEventListener(e,t,i)}abort(){this._xhr.abort()}send(e){this._xhr.send(e)}open(e,t,i){const{url:r,headers:n}=cn._CollectCustomizations(t,i);this._requestURL=cn._CleanUrl(r),this._xhr.open(e,this._requestURL,!0);for(const a in n)this._xhr.setRequestHeader(a,n[a])}setRequestHeader(e,t){this._xhr.setRequestHeader(e,t)}getResponseHeader(e){return this._xhr.getResponseHeader(e)}}cn.CustomRequestHeaders={};cn.CustomRequestModifiers=new Array;cn.SkipRequestModificationForBabylonCDN=!0;const i_e=Object.freeze(new gt(0,0,0,0)),r_e=Object.freeze(O.Zero()),s_e=Object.freeze(vt.Zero()),n_e=Object.freeze(Lf.Zero()),a_e=Object.freeze(rt.Black()),o_e=Object.freeze(new $t(0,0,0,0)),ym={key:0,repeatCount:0,loopMode:2};class _t{static _PrepareAnimation(e,t,i,r,n,a,o,l){let c;if(!isNaN(parseFloat(n))&&isFinite(n)?c=_t.ANIMATIONTYPE_FLOAT:n instanceof gt?c=_t.ANIMATIONTYPE_QUATERNION:n instanceof O?c=_t.ANIMATIONTYPE_VECTOR3:n instanceof vt?c=_t.ANIMATIONTYPE_VECTOR2:n instanceof rt?c=_t.ANIMATIONTYPE_COLOR3:n instanceof $t?c=_t.ANIMATIONTYPE_COLOR4:n instanceof Lf&&(c=_t.ANIMATIONTYPE_SIZE),c==null)return null;const u=new _t(e,t,i,c,o),h=[{frame:0,value:n},{frame:r,value:a}];return u.setKeys(h),l!==void 0&&u.setEasingFunction(l),u}get runtimeAnimations(){return this._runtimeAnimations}get hasRunningRuntimeAnimations(){for(const e of this._runtimeAnimations)if(!e.isStopped())return!0;return!1}constructor(e,t,i,r,n,a){this.name=e,this.targetProperty=t,this.framePerSecond=i,this.dataType=r,this.loopMode=n,this.enableBlending=a,this._easingFunction=null,this._runtimeAnimations=new Array,this._events=new Array,this.blendingSpeed=.01,this._ranges={},this._coreAnimation=null,this.targetPropertyPath=t.split("."),this.dataType=r,this.loopMode=n===void 0?_t.ANIMATIONLOOPMODE_CYCLE:n,this.uniqueId=_t._UniqueIdGenerator++}toString(e){let t="Name: "+this.name+", property: "+this.targetProperty;if(t+=", datatype: "+["Float","Vector3","Quaternion","Matrix","Color3","Vector2"][this.dataType],t+=", nKeys: "+(this._keys?this._keys.length:"none"),t+=", nRanges: "+(this._ranges?Object.keys(this._ranges).length:"none"),e){t+=", Ranges: {";let i=!0;for(const r in this._ranges)i||(t+=", "),i=!1,t+=r;t+="}"}return t}addEvent(e){this._events.push(e),this._events.sort((t,i)=>t.frame-i.frame)}removeEvents(e){for(let t=0;t=0;a--)this._keys[a].frame>=r&&this._keys[a].frame<=n&&this._keys.splice(a,1)}this._ranges[e]=null}}getRange(e){return this._ranges[e]}getKeys(){return this._keys}getHighestFrame(){let e=0;for(let t=0,i=this._keys.length;t0)return t.highLimitValue.clone?t.highLimitValue.clone():t.highLimitValue;const r=this._keys;let n;if(this._coreAnimation)n=this._coreAnimation._key;else{const m=r.length;for(n=t.key;n>=0&&e=r[n+1].frame;)++n;if(t.key=n,n<0)return i?void 0:this._getKeyValue(r[0].value);if(n+1>m-1)return i?void 0:this._getKeyValue(r[m-1].value);this._key=n}const a=r[n],o=r[n+1];if(i&&(e===a.frame||e===o.frame))return;const l=this._getKeyValue(a.value),c=this._getKeyValue(o.value);if(a.interpolation===1)return o.frame>e?l:c;const u=a.outTangent!==void 0&&o.inTangent!==void 0,h=o.frame-a.frame;let d=(e-a.frame)/h;const f=a.easingFunction||this.getEasingFunction();switch(f&&(d=f.ease(d)),this.dataType){case _t.ANIMATIONTYPE_FLOAT:{const m=u?this.floatInterpolateFunctionWithTangents(l,a.outTangent*h,c,o.inTangent*h,d):this.floatInterpolateFunction(l,c,d);switch(t.loopMode){case _t.ANIMATIONLOOPMODE_CYCLE:case _t.ANIMATIONLOOPMODE_CONSTANT:case _t.ANIMATIONLOOPMODE_YOYO:return m;case _t.ANIMATIONLOOPMODE_RELATIVE:case _t.ANIMATIONLOOPMODE_RELATIVE_FROM_CURRENT:return(t.offsetValue??0)*t.repeatCount+m}break}case _t.ANIMATIONTYPE_QUATERNION:{const m=u?this.quaternionInterpolateFunctionWithTangents(l,a.outTangent.scale(h),c,o.inTangent.scale(h),d):this.quaternionInterpolateFunction(l,c,d);switch(t.loopMode){case _t.ANIMATIONLOOPMODE_CYCLE:case _t.ANIMATIONLOOPMODE_CONSTANT:case _t.ANIMATIONLOOPMODE_YOYO:return m;case _t.ANIMATIONLOOPMODE_RELATIVE:case _t.ANIMATIONLOOPMODE_RELATIVE_FROM_CURRENT:return m.addInPlace((t.offsetValue||i_e).scale(t.repeatCount))}return m}case _t.ANIMATIONTYPE_VECTOR3:{const m=u?this.vector3InterpolateFunctionWithTangents(l,a.outTangent.scale(h),c,o.inTangent.scale(h),d):this.vector3InterpolateFunction(l,c,d);switch(t.loopMode){case _t.ANIMATIONLOOPMODE_CYCLE:case _t.ANIMATIONLOOPMODE_CONSTANT:case _t.ANIMATIONLOOPMODE_YOYO:return m;case _t.ANIMATIONLOOPMODE_RELATIVE:case _t.ANIMATIONLOOPMODE_RELATIVE_FROM_CURRENT:return m.add((t.offsetValue||r_e).scale(t.repeatCount))}break}case _t.ANIMATIONTYPE_VECTOR2:{const m=u?this.vector2InterpolateFunctionWithTangents(l,a.outTangent.scale(h),c,o.inTangent.scale(h),d):this.vector2InterpolateFunction(l,c,d);switch(t.loopMode){case _t.ANIMATIONLOOPMODE_CYCLE:case _t.ANIMATIONLOOPMODE_CONSTANT:case _t.ANIMATIONLOOPMODE_YOYO:return m;case _t.ANIMATIONLOOPMODE_RELATIVE:case _t.ANIMATIONLOOPMODE_RELATIVE_FROM_CURRENT:return m.add((t.offsetValue||s_e).scale(t.repeatCount))}break}case _t.ANIMATIONTYPE_SIZE:{switch(t.loopMode){case _t.ANIMATIONLOOPMODE_CYCLE:case _t.ANIMATIONLOOPMODE_CONSTANT:case _t.ANIMATIONLOOPMODE_YOYO:return this.sizeInterpolateFunction(l,c,d);case _t.ANIMATIONLOOPMODE_RELATIVE:case _t.ANIMATIONLOOPMODE_RELATIVE_FROM_CURRENT:return this.sizeInterpolateFunction(l,c,d).add((t.offsetValue||n_e).scale(t.repeatCount))}break}case _t.ANIMATIONTYPE_COLOR3:{const m=u?this.color3InterpolateFunctionWithTangents(l,a.outTangent.scale(h),c,o.inTangent.scale(h),d):this.color3InterpolateFunction(l,c,d);switch(t.loopMode){case _t.ANIMATIONLOOPMODE_CYCLE:case _t.ANIMATIONLOOPMODE_CONSTANT:case _t.ANIMATIONLOOPMODE_YOYO:return m;case _t.ANIMATIONLOOPMODE_RELATIVE:case _t.ANIMATIONLOOPMODE_RELATIVE_FROM_CURRENT:return m.add((t.offsetValue||a_e).scale(t.repeatCount))}break}case _t.ANIMATIONTYPE_COLOR4:{const m=u?this.color4InterpolateFunctionWithTangents(l,a.outTangent.scale(h),c,o.inTangent.scale(h),d):this.color4InterpolateFunction(l,c,d);switch(t.loopMode){case _t.ANIMATIONLOOPMODE_CYCLE:case _t.ANIMATIONLOOPMODE_CONSTANT:case _t.ANIMATIONLOOPMODE_YOYO:return m;case _t.ANIMATIONLOOPMODE_RELATIVE:case _t.ANIMATIONLOOPMODE_RELATIVE_FROM_CURRENT:return m.add((t.offsetValue||o_e).scale(t.repeatCount))}break}case _t.ANIMATIONTYPE_MATRIX:{switch(t.loopMode){case _t.ANIMATIONLOOPMODE_CYCLE:case _t.ANIMATIONLOOPMODE_CONSTANT:case _t.ANIMATIONLOOPMODE_YOYO:return _t.AllowMatricesInterpolation?this.matrixInterpolateFunction(l,c,d,t.workValue):l;case _t.ANIMATIONLOOPMODE_RELATIVE:case _t.ANIMATIONLOOPMODE_RELATIVE_FROM_CURRENT:return l}break}}return 0}matrixInterpolateFunction(e,t,i,r){return _t.AllowMatrixDecomposeForInterpolation?r?(Ce.DecomposeLerpToRef(e,t,i,r),r):Ce.DecomposeLerp(e,t,i):r?(Ce.LerpToRef(e,t,i,r),r):Ce.Lerp(e,t,i)}clone(e=!1){const t=new _t(this.name,this.targetPropertyPath.join("."),this.framePerSecond,this.dataType,this.loopMode);if(t.enableBlending=this.enableBlending,t.blendingSpeed=this.blendingSpeed,this._keys&&t.setKeys(this._keys,!1,e),this._ranges){t._ranges={};for(const i in this._ranges){const r=this._ranges[i];r&&(t._ranges[i]=r.clone())}}return t}setKeys(e,t=!1,i=!1){if(t)this._keys=e;else if(this._keys=e.slice(0),i)for(let r=0;r=0?n.referenceFrame:0;let c=0;const u=o[0];let h=o.length-1;const d=o[h],f={referenceValue:u.value,referencePosition:Ae.Vector3[0],referenceQuaternion:Ae.Quaternion[0],referenceScaling:Ae.Vector3[1],keyPosition:Ae.Vector3[2],keyQuaternion:Ae.Quaternion[1],keyScaling:Ae.Vector3[3]};let m=u.frame,p=d.frame;if(n.range){const S=a.getRange(n.range);S&&(m=S.from,p=S.to)}else m=n.fromFrame??m,p=n.toFrame??p;m!==u.frame&&(c=a.createKeyForFrame(m)),p!==d.frame&&(h=a.createKeyForFrame(p));const _=a.getKeys();if(_.length===1){const S=a._getKeyValue(_[0]);f.referenceValue=S.clone?S.clone():S}else if(l<=u.frame){const S=a._getKeyValue(u.value);f.referenceValue=S.clone?S.clone():S}else if(l>=d.frame){const S=a._getKeyValue(d.value);f.referenceValue=S.clone?S.clone():S}else{ym.key=0;const S=a._interpolate(l,ym);f.referenceValue=S.clone?S.clone():S}a.dataType===_t.ANIMATIONTYPE_QUATERNION?f.referenceValue.normalize().conjugateInPlace():a.dataType===_t.ANIMATIONTYPE_MATRIX&&(f.referenceValue.decompose(f.referenceScaling,f.referenceQuaternion,f.referencePosition),f.referenceQuaternion.normalize().conjugateInPlace());let v=Number.MAX_VALUE;const x=n.clipKeys?[]:null;for(let S=c;S<=h;S++){let b=_[S];if((x||n.cloneOriginalAnimation)&&(b={frame:b.frame,value:b.value.clone?b.value.clone():b.value,inTangent:b.inTangent,outTangent:b.outTangent,interpolation:b.interpolation,lockedTangent:b.lockedTangent,easingFunction:b.easingFunction},x&&(v===Number.MAX_VALUE&&(v=b.frame),b.frame-=v,x.push(b))),!(S&&a.dataType!==_t.ANIMATIONTYPE_FLOAT&&b.value===u.value))switch(a.dataType){case _t.ANIMATIONTYPE_MATRIX:b.value.decompose(f.keyScaling,f.keyQuaternion,f.keyPosition),f.keyPosition.subtractInPlace(f.referencePosition),f.keyScaling.divideInPlace(f.referenceScaling),f.referenceQuaternion.multiplyToRef(f.keyQuaternion,f.keyQuaternion),Ce.ComposeToRef(f.keyScaling,f.keyQuaternion,f.keyPosition,b.value);break;case _t.ANIMATIONTYPE_QUATERNION:f.referenceValue.multiplyToRef(b.value,b.value);break;case _t.ANIMATIONTYPE_VECTOR2:case _t.ANIMATIONTYPE_VECTOR3:case _t.ANIMATIONTYPE_COLOR3:case _t.ANIMATIONTYPE_COLOR4:b.value.subtractToRef(f.referenceValue,b.value);break;case _t.ANIMATIONTYPE_SIZE:b.value.width-=f.referenceValue.width,b.value.height-=f.referenceValue.height;break;default:b.value-=f.referenceValue}}return x&&a.setKeys(x,!0),a}function JF(s,e,t,i){const r=new _t(s+"Animation",s,t,e,_t.ANIMATIONLOOPMODE_CONSTANT);return r.setEasingFunction(i),r}function Gke(s,e,t,i,r,n,a,o,l,c,u){const h=_t._PrepareAnimation(s,t,i,r,n,a,o,l);return!h||(e.getScene&&(u=e.getScene()),!u)?null:u.beginDirectAnimation(e,[h],0,r,h.loopMode!==_t.ANIMATIONLOOPMODE_CONSTANT,1,c)}function zke(s,e,t,i,r,n,a,o,l,c,u){const h=_t._PrepareAnimation(s,i,r,n,a,o,l,c);return h?e.getScene().beginDirectHierarchyAnimation(e,t,[h],0,n,h.loopMode===1,1,u):null}function Wke(s,e,t,i,r,n,a,o,l,c){const u=_t._PrepareAnimation(s,t,i,r,n,a,o,l);return u?(e.animations.push(u),e.getScene().beginAnimation(e,0,r,u.loopMode===1,1,c)):null}function Hke(s,e,t,i,r,n,a,o=null,l=!0,c){if(a<=0)return t[s]=e,o&&o(),null;const u=r*(a/1e3);return n.setKeys(c??[{frame:0,value:t[s].clone?t[s].clone():t[s]},{frame:u,value:e}]),t.animations||(t.animations=[]),t.animations.push(n),i.beginAnimation(t,0,u,!1,1,o??void 0,void 0,l)}function jke(s,e){li.AppendSerializedAnimations(s,e)}function UT(s){const e=new _t(s.name,s.property,s.framePerSecond,s.dataType,s.loopBehavior),t=s.dataType,i=[];let r,n;for(s.enableBlending&&(e.enableBlending=s.enableBlending),s.blendingSpeed&&(e.blendingSpeed=s.blendingSpeed),n=0;n=2&&(o=a.values[1]),a.values.length>=3&&(l=a.values[2]),a.values.length>=4&&(c=a.values[3]);break;case _t.ANIMATIONTYPE_QUATERNION:if(r=gt.FromArray(a.values),a.values.length>=8){const h=gt.FromArray(a.values.slice(4,8));h.equals(gt.Zero())||(o=h)}if(a.values.length>=12){const h=gt.FromArray(a.values.slice(8,12));h.equals(gt.Zero())||(l=h)}a.values.length>=13&&(c=a.values[12]);break;case _t.ANIMATIONTYPE_MATRIX:r=Ce.FromArray(a.values),a.values.length>=17&&(c=a.values[16]);break;case _t.ANIMATIONTYPE_COLOR3:r=rt.FromArray(a.values),a.values[3]&&(o=rt.FromArray(a.values[3])),a.values[4]&&(l=rt.FromArray(a.values[4])),a.values[5]&&(c=a.values[5]);break;case _t.ANIMATIONTYPE_COLOR4:r=$t.FromArray(a.values),a.values[4]&&(o=$t.FromArray(a.values[4])),a.values[5]&&(l=$t.FromArray(a.values[5])),a.values[6]&&(c=$t.FromArray(a.values[6]));break;case _t.ANIMATIONTYPE_VECTOR3:default:r=O.FromArray(a.values),a.values[3]&&(o=O.FromArray(a.values[3])),a.values[4]&&(l=O.FromArray(a.values[4])),a.values[5]&&(c=a.values[5]);break}const u={};u.frame=a.frame,u.value=r,o!=null&&(u.inTangent=o),l!=null&&(u.outTangent=l),c!=null&&(u.interpolation=c),i.push(u)}if(e.setKeys(i),s.ranges)for(n=0;n{const r=new cn;r.addEventListener("readystatechange",()=>{if(r.readyState==4)if(r.status==200){let n=JSON.parse(r.responseText);if(n.animations&&(n=n.animations),n.length){const a=[];for(const o of n)a.push(UT(o));t(a)}else{const a=UT(n);s&&(a.name=s),t(a)}}else i("Unable to load the animation")}),r.open("GET",e),r.send()})}async function l_e(s){const e=(this==null?void 0:this.SnippetUrl)??_t.SnippetUrl;return await new Promise((t,i)=>{const r=new cn;r.addEventListener("readystatechange",()=>{if(r.readyState==4)if(r.status==200){const n=JSON.parse(JSON.parse(r.responseText).jsonPayload);if(n.animations){const a=JSON.parse(n.animations),o=[];for(const l of a.animations){const c=UT(l);c.snippetId=s,o.push(c)}t(o)}else{const a=JSON.parse(n.animation),o=UT(a);o.snippetId=s,t(o)}}else i("Unable to load the snippet "+s)}),r.open("GET",e+"/"+s.replace(/#/g,"/")),r.send()})}const $ke=l_e;let dY=!1;function Yke(){dY||(dY=!0,_t.Parse=UT,_t.ParseFromFileAsync=Xke,_t.ParseFromSnippetAsync=l_e,_t.CreateFromSnippetAsync=$ke,_t.CreateAnimation=JF,_t.CreateAndStartAnimation=Gke,_t.CreateAndStartHierarchyAnimation=zke,_t.CreateMergeAndStartAnimation=Wke,_t.MakeAnimationAdditive=Q5,_t.TransitionTo=Hke,_t.AppendSerializedAnimations=jke,Se("BABYLON.Animation",_t),rn._AnimationRangeFactory=(s,e,t)=>new v0(s,e,t))}class qke extends In{constructor(e,t,i,r,n=1e3,a,o,l){super(e,a),this.duration=1e3,this.onInterpolationDoneObservable=new Ge,this.propertyPath=i,this.value=r,this.duration=n,this.stopOtherAnimations=o,this.onInterpolationDone=l,this._target=this._effectiveTarget=t}_prepare(){this._effectiveTarget=this._getEffectiveTarget(this._effectiveTarget,this.propertyPath),this._property=this._getProperty(this.propertyPath)}execute(){const e=this._actionManager.getScene(),t=[{frame:0,value:this._effectiveTarget[this._property]},{frame:100,value:this.value}];let i;if(typeof this.value=="number")i=_t.ANIMATIONTYPE_FLOAT;else if(this.value instanceof rt)i=_t.ANIMATIONTYPE_COLOR3;else if(this.value instanceof O)i=_t.ANIMATIONTYPE_VECTOR3;else if(this.value instanceof Ce)i=_t.ANIMATIONTYPE_MATRIX;else if(this.value instanceof gt)i=_t.ANIMATIONTYPE_QUATERNION;else{ye.Warn("InterpolateValueAction: Unsupported type ("+typeof this.value+")");return}const r=new _t("InterpolateValueAction",this._property,100*(1e3/this.duration),i,_t.ANIMATIONLOOPMODE_CONSTANT);r.setKeys(t),this.stopOtherAnimations&&e.stopAnimation(this._effectiveTarget);const n=()=>{this.onInterpolationDoneObservable.notifyObservers(this),this.onInterpolationDone&&this.onInterpolationDone()};e.beginDirectAnimation(this._effectiveTarget,[r],0,100,!1,1,n)}serialize(e){return super._serialize({name:"InterpolateValueAction",properties:[In._GetTargetProperty(this._target),{name:"propertyPath",value:this.propertyPath},{name:"value",value:In._SerializeValueAsString(this.value)},{name:"duration",value:In._SerializeValueAsString(this.duration)},{name:"stopOtherAnimations",value:In._SerializeValueAsString(this.stopOtherAnimations)||!1}]},e)}}let fY=!1;function Zke(){fY||(fY=!0,Se("BABYLON.InterpolateValueAction",qke))}Zke();class Kke{get currentFrame(){return this._currentFrame}get weight(){return this._weight}get currentValue(){return this._currentValue}get targetPath(){return this._targetPath}get target(){return this._currentActiveTarget}get isAdditive(){return this._host&&this._host.isAdditive}constructor(e,t,i,r){if(this._events=new Array,this._currentFrame=0,this._originalValue=new Array,this._originalBlendValue=null,this._offsetsCache={},this._highLimitsCache={},this._stopped=!1,this._blendingFactor=0,this._currentValue=null,this._currentActiveTarget=null,this._directTarget=null,this._targetPath="",this._weight=1,this._absoluteFrameOffset=0,this._previousElapsedTime=0,this._yoyoDirection=1,this._previousAbsoluteFrame=0,this._targetIsArray=!1,this._coreRuntimeAnimation=null,this._animation=t,this._target=e,this._scene=i,this._host=r,this._activeTargets=[],t._runtimeAnimations.push(this),this._animationState={key:0,repeatCount:0,loopMode:this._getCorrectLoopMode()},this._animation.dataType===_t.ANIMATIONTYPE_MATRIX&&(this._animationState.workValue=Ce.Zero()),this._keys=this._animation.getKeys(),this._minFrame=this._keys[0].frame,this._maxFrame=this._keys[this._keys.length-1].frame,this._minFrame!==0){const a={frame:0,value:this._keys[0].value};this._keys.splice(0,0,a)}if(this._target instanceof Array){let a=0;for(const o of this._target)this._preparePath(o,a),this._getOriginalValues(a),a++;this._targetIsArray=!0}else this._preparePath(this._target),this._getOriginalValues(),this._targetIsArray=!1,this._directTarget=this._activeTargets[0];const n=t.getEvents();if(n&&n.length>0)for(const a of n)this._events.push(a._clone());this._enableBlending=e&&e.animationPropertiesOverride?e.animationPropertiesOverride.enableBlending:this._animation.enableBlending}_preparePath(e,t=0){const i=this._animation.targetPropertyPath;if(i.length>1){let r=e;for(let n=0;n-1&&this._animation.runtimeAnimations.splice(e,1)}setValue(e,t){if(this._targetIsArray){for(let i=0;ii[i.length-1].frame&&(e=i[i.length-1].frame);const r=this._events;if(r.length)for(let a=0;athis._maxFrame)&&(t=this._minFrame),(ithis._maxFrame)&&(i=this._maxFrame),d=i-t;let m,p=e*(o.framePerSecond*n)/1e3+this._absoluteFrameOffset,_=0,v=!1;const x=r&&this._animationState.loopMode===_t.ANIMATIONLOOPMODE_YOYO;if(x){const S=(p-t)/d,b=Math.sin(S*Math.PI);p=Math.abs(b)*d+t;const I=b>=0?1:-1;this._yoyoDirection!==I&&(v=!0),this._yoyoDirection=I}if(this._previousElapsedTime=e,this._previousAbsoluteFrame=p,!r&&i>=t&&(p>=d&&n>0||p<=0&&n<0))c=!1,_=o.evaluate(i);else if(!r&&t>=i&&(p<=d&&n<0||p>=0&&n>0))c=!1,_=o.evaluate(t);else if(this._animationState.loopMode!==_t.ANIMATIONLOOPMODE_CYCLE){const S=i.toString()+t.toString();if(!this._offsetsCache[S]){this._animationState.repeatCount=0,this._animationState.loopMode=_t.ANIMATIONLOOPMODE_CYCLE;const b=o._interpolate(t,this._animationState),y=o._interpolate(i,this._animationState);switch(this._animationState.loopMode=this._getCorrectLoopMode(),o.dataType){case _t.ANIMATIONTYPE_FLOAT:this._offsetsCache[S]=y-b;break;case _t.ANIMATIONTYPE_QUATERNION:this._offsetsCache[S]=y.subtract(b);break;case _t.ANIMATIONTYPE_VECTOR3:this._offsetsCache[S]=y.subtract(b);break;case _t.ANIMATIONTYPE_VECTOR2:this._offsetsCache[S]=y.subtract(b);break;case _t.ANIMATIONTYPE_SIZE:this._offsetsCache[S]=y.subtract(b);break;case _t.ANIMATIONTYPE_COLOR3:this._offsetsCache[S]=y.subtract(b);break}this._highLimitsCache[S]=y}_=this._highLimitsCache[S],m=this._offsetsCache[S]}if(m===void 0)switch(o.dataType){case _t.ANIMATIONTYPE_FLOAT:m=0;break;case _t.ANIMATIONTYPE_QUATERNION:m=i_e;break;case _t.ANIMATIONTYPE_VECTOR3:m=r_e;break;case _t.ANIMATIONTYPE_VECTOR2:m=s_e;break;case _t.ANIMATIONTYPE_SIZE:m=n_e;break;case _t.ANIMATIONTYPE_COLOR3:m=a_e;break;case _t.ANIMATIONTYPE_COLOR4:m=o_e;break}if(this._host&&this._host.syncRoot){const S=this._host.syncRoot,b=(S.masterFrame-S.fromFrame)/(S.toFrame-S.fromFrame);u=t+d*b}else p>0&&t>i||p<0&&t0&&this.currentFrame>u||n<0&&this.currentFrame0?0:o.getKeys().length-1}this._currentFrame=u,this._animationState.repeatCount=d===0?0:p/d>>0,this._animationState.highLimitValue=_,this._animationState.offsetValue=m}const f=o._interpolate(u,this._animationState);if(this.setValue(f,a),h.length){for(let m=0;m=0&&u>=h[m].frame&&h[m].frame>=t||d<0&&u<=h[m].frame&&h[m].frame<=t){const p=h[m];p.isDone||(p.onlyOnce&&(h.splice(m,1),m--),p.isDone=!0,p.action(u))}}return c||(this._stopped=!0),c}}function yl(){return typeof window<"u"}function cT(){return typeof navigator<"u"}function AT(){return typeof document<"u"}function J5(s){let e="",t=s.firstChild;for(;t;)t.nodeType===3&&(e+=t.textContent),t=t.nextSibling;return e}class ko{static get Now(){return yl()&&window.performance&&window.performance.now?window.performance.now():Date.now()}}class XR{get syncRoot(){return this._syncRoot}get masterFrame(){return this._runtimeAnimations.length===0?0:this._runtimeAnimations[0].currentFrame}get weight(){return this._weight}set weight(e){if(e===-1){this._weight=-1;return}this._weight=Math.min(Math.max(e,0),1)}get speedRatio(){return this._speedRatio}set speedRatio(e){for(let t=0;t-1&&(this._scene._activeAnimatables.splice(t,1),this._scene._activeAnimatables.push(this))}return this}getAnimations(){return this._runtimeAnimations}appendAnimations(e,t){for(let i=0;i