From 2ee36789b2bdbda09e59f2de9a8e8e70339ad489 Mon Sep 17 00:00:00 2001 From: Daniel Date: Sat, 7 Mar 2026 01:34:55 +0100 Subject: [PATCH] Stream auf 60 FPS + 8 Mbps Bitrate angehoben - getDisplayMedia: frameRate ideal 60, 1920x1080 - WebRTC Sender: maxFramerate 60, maxBitrate 8 Mbps pro Viewer-PC Co-Authored-By: Claude Opus 4.6 --- .../{index-BW2laH1p.js => index-C3FFX5uU.js} | 62 +++++++++---------- web/dist/index.html | 2 +- web/src/plugins/streaming/StreamingTab.tsx | 14 ++++- 3 files changed, 45 insertions(+), 33 deletions(-) rename web/dist/assets/{index-BW2laH1p.js => index-C3FFX5uU.js} (95%) diff --git a/web/dist/assets/index-BW2laH1p.js b/web/dist/assets/index-C3FFX5uU.js similarity index 95% rename from web/dist/assets/index-BW2laH1p.js rename to web/dist/assets/index-C3FFX5uU.js index 90b764b..745a923 100644 --- a/web/dist/assets/index-BW2laH1p.js +++ b/web/dist/assets/index-C3FFX5uU.js @@ -22,7 +22,7 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var F5;function EF(){if(F5)return Jn;F5=1;var i=Symbol.for("react.transitional.element"),e=Symbol.for("react.portal"),t=Symbol.for("react.fragment"),n=Symbol.for("react.strict_mode"),r=Symbol.for("react.profiler"),s=Symbol.for("react.consumer"),a=Symbol.for("react.context"),l=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),h=Symbol.for("react.memo"),g=Symbol.for("react.lazy"),v=Symbol.for("react.activity"),x=Symbol.iterator;function S(le){return le===null||typeof le!="object"?null:(le=x&&le[x]||le["@@iterator"],typeof le=="function"?le:null)}var w={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},R=Object.assign,C={};function E(le,we,We){this.props=le,this.context=we,this.refs=C,this.updater=We||w}E.prototype.isReactComponent={},E.prototype.setState=function(le,we){if(typeof le!="object"&&typeof le!="function"&&le!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,le,we,"setState")},E.prototype.forceUpdate=function(le){this.updater.enqueueForceUpdate(this,le,"forceUpdate")};function B(){}B.prototype=E.prototype;function L(le,we,We){this.props=le,this.context=we,this.refs=C,this.updater=We||w}var O=L.prototype=new B;O.constructor=L,R(O,E.prototype),O.isPureReactComponent=!0;var z=Array.isArray;function G(){}var k={H:null,A:null,T:null,S:null},H=Object.prototype.hasOwnProperty;function F(le,we,We){var Te=We.ref;return{$$typeof:i,type:le,key:we,ref:Te!==void 0?Te:null,props:We}}function V(le,we){return F(le.type,we,le.props)}function X(le){return typeof le=="object"&&le!==null&&le.$$typeof===i}function J(le){var we={"=":"=0",":":"=2"};return"$"+le.replace(/[=:]/g,function(We){return we[We]})}var te=/\/+/g;function se(le,we){return typeof le=="object"&&le!==null&&le.key!=null?J(""+le.key):we.toString(36)}function ne(le){switch(le.status){case"fulfilled":return le.value;case"rejected":throw le.reason;default:switch(typeof le.status=="string"?le.then(G,G):(le.status="pending",le.then(function(we){le.status==="pending"&&(le.status="fulfilled",le.value=we)},function(we){le.status==="pending"&&(le.status="rejected",le.reason=we)})),le.status){case"fulfilled":return le.value;case"rejected":throw le.reason}}throw le}function Z(le,we,We,Te,ze){var _e=typeof le;(_e==="undefined"||_e==="boolean")&&(le=null);var De=!1;if(le===null)De=!0;else switch(_e){case"bigint":case"string":case"number":De=!0;break;case"object":switch(le.$$typeof){case i:case e:De=!0;break;case g:return De=le._init,Z(De(le._payload),we,We,Te,ze)}}if(De)return ze=ze(le),De=Te===""?"."+se(le,0):Te,z(ze)?(We="",De!=null&&(We=De.replace(te,"$&/")+"/"),Z(ze,we,We,"",function(Tt){return Tt})):ze!=null&&(X(ze)&&(ze=V(ze,We+(ze.key==null||le&&le.key===ze.key?"":(""+ze.key).replace(te,"$&/")+"/")+De)),we.push(ze)),1;De=0;var dt=Te===""?".":Te+":";if(z(le))for(var vt=0;vtSe||(o.current=be[Se],be[Se]=null,Se--)}function We(o,c){Se++,be[Se]=o.current,o.current=c}var Te=le(null),ze=le(null),_e=le(null),De=le(null);function dt(o,c){switch(We(_e,c),We(ze,o),We(Te,null),c.nodeType){case 9:case 11:o=(o=c.documentElement)&&(o=o.namespaceURI)?i5(o):0;break;default:if(o=c.tagName,c=c.namespaceURI)c=i5(c),o=r5(c,o);else switch(o){case"svg":o=1;break;case"math":o=2;break;default:o=0}}we(Te),We(Te,o)}function vt(){we(Te),we(ze),we(_e)}function Tt(o){o.memoizedState!==null&&We(De,o);var c=Te.current,m=r5(c,o.type);c!==m&&(We(ze,o),We(Te,m))}function Ge(o){ze.current===o&&(we(Te),we(ze)),De.current===o&&(we(De),Vp._currentValue=he)}var Be,ke;function oe(o){if(Be===void 0)try{throw Error()}catch(m){var c=m.stack.trim().match(/\n( *(at )?)/);Be=c&&c[1]||"",ke=-1Se||(o.current=be[Se],be[Se]=null,Se--)}function We(o,c){Se++,be[Se]=o.current,o.current=c}var Te=le(null),ze=le(null),_e=le(null),De=le(null);function pt(o,c){switch(We(_e,c),We(ze,o),We(Te,null),c.nodeType){case 9:case 11:o=(o=c.documentElement)&&(o=o.namespaceURI)?i5(o):0;break;default:if(o=c.tagName,c=c.namespaceURI)c=i5(c),o=r5(c,o);else switch(o){case"svg":o=1;break;case"math":o=2;break;default:o=0}}we(Te),We(Te,o)}function _t(){we(Te),we(ze),we(_e)}function wt(o){o.memoizedState!==null&&We(De,o);var c=Te.current,m=r5(c,o.type);c!==m&&(We(ze,o),We(Te,m))}function Ge(o){ze.current===o&&(we(Te),we(ze)),De.current===o&&(we(De),Vp._currentValue=he)}var Be,ke;function oe(o){if(Be===void 0)try{throw Error()}catch(m){var c=m.stack.trim().match(/\n( *(at )?)/);Be=c&&c[1]||"",ke=-1)":-1D||xe[b]!==Je[D]){var ht=` -`+xe[b].replace(" at new "," at ");return o.displayName&&ht.includes("")&&(ht=ht.replace("",o.displayName)),ht}while(1<=b&&0<=D);break}}}finally{Mt=!1,Error.prepareStackTrace=m}return(m=o?o.displayName||o.name:"")?oe(m):""}function Dt(o,c){switch(o.tag){case 26:case 27:case 5:return oe(o.type);case 16:return oe("Lazy");case 13:return o.child!==c&&c!==null?oe("Suspense Fallback"):oe("Suspense");case 19:return oe("SuspenseList");case 0:case 15:return lt(o.type,!1);case 11:return lt(o.type.render,!1);case 1:return lt(o.type,!0);case 31:return oe("Activity");default:return""}}function wt(o){try{var c="",m=null;do c+=Dt(o,m),m=o,o=o.return;while(o);return c}catch(b){return` +`);for(D=b=0;bD||xe[b]!==Je[D]){var ft=` +`+xe[b].replace(" at new "," at ");return o.displayName&&ft.includes("")&&(ft=ft.replace("",o.displayName)),ft}while(1<=b&&0<=D);break}}}finally{Mt=!1,Error.prepareStackTrace=m}return(m=o?o.displayName||o.name:"")?oe(m):""}function Dt(o,c){switch(o.tag){case 26:case 27:case 5:return oe(o.type);case 16:return oe("Lazy");case 13:return o.child!==c&&c!==null?oe("Suspense Fallback"):oe("Suspense");case 19:return oe("SuspenseList");case 0:case 15:return lt(o.type,!1);case 11:return lt(o.type.render,!1);case 1:return lt(o.type,!0);case 31:return oe("Activity");default:return""}}function ut(o){try{var c="",m=null;do c+=Dt(o,m),m=o,o=o.return;while(o);return c}catch(b){return` Error generating stack: `+b.message+` -`+b.stack}}var tn=Object.prototype.hasOwnProperty,bt=i.unstable_scheduleCallback,fe=i.unstable_cancelCallback,Y=i.unstable_shouldYield,Ce=i.unstable_requestPaint,$e=i.unstable_now,it=i.unstable_getCurrentPriorityLevel,tt=i.unstable_ImmediatePriority,Vt=i.unstable_UserBlockingPriority,Bt=i.unstable_NormalPriority,Wt=i.unstable_LowPriority,ln=i.unstable_IdlePriority,St=i.log,Kt=i.unstable_setDisableYieldValue,rn=null,Ht=null;function Ft(o){if(typeof St=="function"&&Kt(o),Ht&&typeof Ht.setStrictMode=="function")try{Ht.setStrictMode(rn,o)}catch{}}var Gt=Math.clz32?Math.clz32:me,In=Math.log,Mi=Math.LN2;function me(o){return o>>>=0,o===0?32:31-(In(o)/Mi|0)|0}var jt=256,rt=262144,_t=4194304;function $t(o){var c=o&42;if(c!==0)return c;switch(o&-o){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:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return o&261888;case 262144:case 524288:case 1048576:case 2097152:return o&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return o&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return o}}function kt(o,c,m){var b=o.pendingLanes;if(b===0)return 0;var D=0,P=o.suspendedLanes,$=o.pingedLanes;o=o.warmLanes;var re=b&134217727;return re!==0?(b=re&~P,b!==0?D=$t(b):($&=re,$!==0?D=$t($):m||(m=re&~o,m!==0&&(D=$t(m))))):(re=b&~P,re!==0?D=$t(re):$!==0?D=$t($):m||(m=b&~o,m!==0&&(D=$t(m)))),D===0?0:c!==0&&c!==D&&(c&P)===0&&(P=D&-D,m=c&-c,P>=m||P===32&&(m&4194048)!==0)?c:D}function xn(o,c){return(o.pendingLanes&~(o.suspendedLanes&~o.pingedLanes)&c)===0}function qi(o,c){switch(o){case 1:case 2:case 4:case 8:case 64:return c+250;case 16:case 32: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 c+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function rr(){var o=_t;return _t<<=1,(_t&62914560)===0&&(_t=4194304),o}function pn(o){for(var c=[],m=0;31>m;m++)c.push(o);return c}function $i(o,c){o.pendingLanes|=c,c!==268435456&&(o.suspendedLanes=0,o.pingedLanes=0,o.warmLanes=0)}function Jr(o,c,m,b,D,P){var $=o.pendingLanes;o.pendingLanes=m,o.suspendedLanes=0,o.pingedLanes=0,o.warmLanes=0,o.expiredLanes&=m,o.entangledLanes&=m,o.errorRecoveryDisabledLanes&=m,o.shellSuspendCounter=0;var re=o.entanglements,xe=o.expirationTimes,Je=o.hiddenUpdates;for(m=$&~m;0"u")return null;try{return o.activeElement||o.body}catch{return o.body}}var ve=/[\n"\\]/g;function ot(o){return o.replace(ve,function(c){return"\\"+c.charCodeAt(0).toString(16)+" "})}function Rt(o,c,m,b,D,P,$,re){o.name="",$!=null&&typeof $!="function"&&typeof $!="symbol"&&typeof $!="boolean"?o.type=$:o.removeAttribute("type"),c!=null?$==="number"?(c===0&&o.value===""||o.value!=c)&&(o.value=""+Ln(c)):o.value!==""+Ln(c)&&(o.value=""+Ln(c)):$!=="submit"&&$!=="reset"||o.removeAttribute("value"),c!=null?cn(o,$,Ln(c)):m!=null?cn(o,$,Ln(m)):b!=null&&o.removeAttribute("value"),D==null&&P!=null&&(o.defaultChecked=!!P),D!=null&&(o.checked=D&&typeof D!="function"&&typeof D!="symbol"),re!=null&&typeof re!="function"&&typeof re!="symbol"&&typeof re!="boolean"?o.name=""+Ln(re):o.removeAttribute("name")}function Zt(o,c,m,b,D,P,$,re){if(P!=null&&typeof P!="function"&&typeof P!="symbol"&&typeof P!="boolean"&&(o.type=P),c!=null||m!=null){if(!(P!=="submit"&&P!=="reset"||c!=null)){hi(o);return}m=m!=null?""+Ln(m):"",c=c!=null?""+Ln(c):m,re||c===o.value||(o.value=c),o.defaultValue=c}b=b??D,b=typeof b!="function"&&typeof b!="symbol"&&!!b,o.checked=re?o.checked:!!b,o.defaultChecked=!!b,$!=null&&typeof $!="function"&&typeof $!="symbol"&&typeof $!="boolean"&&(o.name=$),hi(o)}function cn(o,c,m){c==="number"&&fa(o.ownerDocument)===o||o.defaultValue===""+m||(o.defaultValue=""+m)}function Yn(o,c,m,b){if(o=o.options,c){c={};for(var D=0;D"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),TA=!1;if(il)try{var tf={};Object.defineProperty(tf,"passive",{get:function(){TA=!0}}),window.addEventListener("test",tf,tf),window.removeEventListener("test",tf,tf)}catch{TA=!1}var Lo=null,nf=null,wA=null;function np(){if(wA)return wA;var o,c=nf,m=c.length,b,D="value"in Lo?Lo.value:Lo.textContent,P=D.length;for(o=0;o=of),Ou=" ",m1=!1;function RA(o,c){switch(o){case"keyup":return xx.indexOf(c.keyCode)!==-1;case"keydown":return c.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function op(o){return o=o.detail,typeof o=="object"&&"data"in o?o.data:null}var Qc=!1;function g1(o,c){switch(o){case"compositionend":return op(c);case"keypress":return c.which!==32?null:(m1=!0,Ou);case"textInput":return o=c.data,o===Ou&&m1?null:o;default:return null}}function bx(o,c){if(Qc)return o==="compositionend"||!Bu&&RA(o,c)?(o=np(),wA=nf=Lo=null,Qc=!1,o):null;switch(o){case"paste":return null;case"keypress":if(!(c.ctrlKey||c.altKey||c.metaKey)||c.ctrlKey&&c.altKey){if(c.char&&1=c)return{node:m,offset:c-o};o=b}e:{for(;m;){if(m.nextSibling){m=m.nextSibling;break e}m=m.parentNode}m=void 0}m=PA(m)}}function zu(o,c){return o&&c?o===c?!0:o&&o.nodeType===3?!1:c&&c.nodeType===3?zu(o,c.parentNode):"contains"in o?o.contains(c):o.compareDocumentPosition?!!(o.compareDocumentPosition(c)&16):!1:!1}function Ol(o){o=o!=null&&o.ownerDocument!=null&&o.ownerDocument.defaultView!=null?o.ownerDocument.defaultView:window;for(var c=fa(o.document);c instanceof o.HTMLIFrameElement;){try{var m=typeof c.contentWindow.location.href=="string"}catch{m=!1}if(m)o=c.contentWindow;else break;c=fa(o.document)}return c}function Il(o){var c=o&&o.nodeName&&o.nodeName.toLowerCase();return c&&(c==="input"&&(o.type==="text"||o.type==="search"||o.type==="tel"||o.type==="url"||o.type==="password")||c==="textarea"||o.contentEditable==="true")}var wx=il&&"documentMode"in document&&11>=document.documentMode,Gu=null,fp=null,qu=null,Ap=!1;function S1(o,c,m){var b=m.window===m?m.document:m.nodeType===9?m:m.ownerDocument;Ap||Gu==null||Gu!==fa(b)||(b=Gu,"selectionStart"in b&&Il(b)?b={start:b.selectionStart,end:b.selectionEnd}:(b=(b.ownerDocument&&b.ownerDocument.defaultView||window).getSelection(),b={anchorNode:b.anchorNode,anchorOffset:b.anchorOffset,focusNode:b.focusNode,focusOffset:b.focusOffset}),qu&&Ss(qu,b)||(qu=b,b=r2(fp,"onSelect"),0>=$,D-=$,Na=1<<32-Gt(c)+D|m<oi?(bi=hn,hn=null):bi=hn.sibling;var Pi=et(Ve,hn,Ke[oi],gt);if(Pi===null){hn===null&&(hn=bi);break}o&&hn&&Pi.alternate===null&&c(Ve,hn),Pe=P(Pi,Pe,oi),Di===null?Sn=Pi:Di.sibling=Pi,Di=Pi,hn=bi}if(oi===Ke.length)return m(Ve,hn),mi&&Oo(Ve,oi),Sn;if(hn===null){for(;oioi?(bi=hn,hn=null):bi=hn.sibling;var dh=et(Ve,hn,Pi.value,gt);if(dh===null){hn===null&&(hn=bi);break}o&&hn&&dh.alternate===null&&c(Ve,hn),Pe=P(dh,Pe,oi),Di===null?Sn=dh:Di.sibling=dh,Di=dh,hn=bi}if(Pi.done)return m(Ve,hn),mi&&Oo(Ve,oi),Sn;if(hn===null){for(;!Pi.done;oi++,Pi=Ke.next())Pi=xt(Ve,Pi.value,gt),Pi!==null&&(Pe=P(Pi,Pe,oi),Di===null?Sn=Pi:Di.sibling=Pi,Di=Pi);return mi&&Oo(Ve,oi),Sn}for(hn=b(hn);!Pi.done;oi++,Pi=Ke.next())Pi=nt(hn,Ve,oi,Pi.value,gt),Pi!==null&&(o&&Pi.alternate!==null&&hn.delete(Pi.key===null?oi:Pi.key),Pe=P(Pi,Pe,oi),Di===null?Sn=Pi:Di.sibling=Pi,Di=Pi);return o&&hn.forEach(function(bF){return c(Ve,bF)}),mi&&Oo(Ve,oi),Sn}function er(Ve,Pe,Ke,gt){if(typeof Ke=="object"&&Ke!==null&&Ke.type===R&&Ke.key===null&&(Ke=Ke.props.children),typeof Ke=="object"&&Ke!==null){switch(Ke.$$typeof){case S:e:{for(var Sn=Ke.key;Pe!==null;){if(Pe.key===Sn){if(Sn=Ke.type,Sn===R){if(Pe.tag===7){m(Ve,Pe.sibling),gt=D(Pe,Ke.props.children),gt.return=Ve,Ve=gt;break e}}else if(Pe.elementType===Sn||typeof Sn=="object"&&Sn!==null&&Sn.$$typeof===H&&f(Sn)===Pe.type){m(Ve,Pe.sibling),gt=D(Pe,Ke.props),U(gt,Ke),gt.return=Ve,Ve=gt;break e}m(Ve,Pe);break}else c(Ve,Pe);Pe=Pe.sibling}Ke.type===R?(gt=$u(Ke.props.children,Ve.mode,gt,Ke.key),gt.return=Ve,Ve=gt):(gt=IA(Ke.type,Ke.key,Ke.props,null,Ve.mode,gt),U(gt,Ke),gt.return=Ve,Ve=gt)}return $(Ve);case w:e:{for(Sn=Ke.key;Pe!==null;){if(Pe.key===Sn)if(Pe.tag===4&&Pe.stateNode.containerInfo===Ke.containerInfo&&Pe.stateNode.implementation===Ke.implementation){m(Ve,Pe.sibling),gt=D(Pe,Ke.children||[]),gt.return=Ve,Ve=gt;break e}else{m(Ve,Pe);break}else c(Ve,Pe);Pe=Pe.sibling}gt=Bo(Ke,Ve.mode,gt),gt.return=Ve,Ve=gt}return $(Ve);case H:return Ke=f(Ke),er(Ve,Pe,Ke,gt)}if(ne(Ke))return on(Ve,Pe,Ke,gt);if(J(Ke)){if(Sn=J(Ke),typeof Sn!="function")throw Error(n(150));return Ke=Sn.call(Ke),Dn(Ve,Pe,Ke,gt)}if(typeof Ke.then=="function")return er(Ve,Pe,N(Ke),gt);if(Ke.$$typeof===L)return er(Ve,Pe,HA(Ve,Ke),gt);I(Ve,Ke)}return typeof Ke=="string"&&Ke!==""||typeof Ke=="number"||typeof Ke=="bigint"?(Ke=""+Ke,Pe!==null&&Pe.tag===6?(m(Ve,Pe.sibling),gt=D(Pe,Ke),gt.return=Ve,Ve=gt):(m(Ve,Pe),gt=vp(Ke,Ve.mode,gt),gt.return=Ve,Ve=gt),$(Ve)):m(Ve,Pe)}return function(Ve,Pe,Ke,gt){try{M=0;var Sn=er(Ve,Pe,Ke,gt);return T=null,Sn}catch(hn){if(hn===hl||hn===uo)throw hn;var Di=Ys(29,hn,null,Ve.mode);return Di.lanes=gt,Di.return=Ve,Di}finally{}}}var ie=q(!0),de=q(!1),Ae=!1;function pe(o){o.updateQueue={baseState:o.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Me(o,c){o=o.updateQueue,c.updateQueue===o&&(c.updateQueue={baseState:o.baseState,firstBaseUpdate:o.firstBaseUpdate,lastBaseUpdate:o.lastBaseUpdate,shared:o.shared,callbacks:null})}function Le(o){return{lane:o,tag:0,payload:null,callback:null,next:null}}function Ye(o,c,m){var b=o.updateQueue;if(b===null)return null;if(b=b.shared,(Oi&2)!==0){var D=b.pending;return D===null?c.next=c:(c.next=D.next,D.next=c),b.pending=c,c=OA(o),M1(o,null,m),c}return BA(o,b,c,m),OA(o)}function qe(o,c,m){if(c=c.updateQueue,c!==null&&(c=c.shared,(m&4194048)!==0)){var b=c.lanes;b&=o.pendingLanes,m|=b,c.lanes=m,pt(o,m)}}function Fe(o,c){var m=o.updateQueue,b=o.alternate;if(b!==null&&(b=b.updateQueue,m===b)){var D=null,P=null;if(m=m.firstBaseUpdate,m!==null){do{var $={lane:m.lane,tag:m.tag,payload:m.payload,callback:null,next:null};P===null?D=P=$:P=P.next=$,m=m.next}while(m!==null);P===null?D=P=c:P=P.next=c}else D=P=c;m={baseState:b.baseState,firstBaseUpdate:D,lastBaseUpdate:P,shared:b.shared,callbacks:b.callbacks},o.updateQueue=m;return}o=m.lastBaseUpdate,o===null?m.firstBaseUpdate=c:o.next=c,m.lastBaseUpdate=c}var Ee=!1;function Pt(){if(Ee){var o=fr;if(o!==null)throw o}}function nn(o,c,m,b){Ee=!1;var D=o.updateQueue;Ae=!1;var P=D.firstBaseUpdate,$=D.lastBaseUpdate,re=D.shared.pending;if(re!==null){D.shared.pending=null;var xe=re,Je=xe.next;xe.next=null,$===null?P=Je:$.next=Je,$=xe;var ht=o.alternate;ht!==null&&(ht=ht.updateQueue,re=ht.lastBaseUpdate,re!==$&&(re===null?ht.firstBaseUpdate=Je:re.next=Je,ht.lastBaseUpdate=xe))}if(P!==null){var xt=D.baseState;$=0,ht=Je=xe=null,re=P;do{var et=re.lane&-536870913,nt=et!==re.lane;if(nt?(xi&et)===et:(b&et)===et){et!==0&&et===eh&&(Ee=!0),ht!==null&&(ht=ht.next={lane:0,tag:re.tag,payload:re.payload,callback:null,next:null});e:{var on=o,Dn=re;et=c;var er=m;switch(Dn.tag){case 1:if(on=Dn.payload,typeof on=="function"){xt=on.call(er,xt,et);break e}xt=on;break e;case 3:on.flags=on.flags&-65537|128;case 0:if(on=Dn.payload,et=typeof on=="function"?on.call(er,xt,et):on,et==null)break e;xt=v({},xt,et);break e;case 2:Ae=!0}}et=re.callback,et!==null&&(o.flags|=64,nt&&(o.flags|=8192),nt=D.callbacks,nt===null?D.callbacks=[et]:nt.push(et))}else nt={lane:et,tag:re.tag,payload:re.payload,callback:re.callback,next:null},ht===null?(Je=ht=nt,xe=xt):ht=ht.next=nt,$|=et;if(re=re.next,re===null){if(re=D.shared.pending,re===null)break;nt=re,re=nt.next,nt.next=null,D.lastBaseUpdate=nt,D.shared.pending=null}}while(!0);ht===null&&(xe=xt),D.baseState=xe,D.firstBaseUpdate=Je,D.lastBaseUpdate=ht,P===null&&(D.shared.lanes=0),rh|=$,o.lanes=$,o.memoizedState=xt}}function Jt(o,c){if(typeof o!="function")throw Error(n(191,o));o.call(c)}function Un(o,c){var m=o.callbacks;if(m!==null)for(o.callbacks=null,o=0;oP?P:8;var $=Z.T,re={};Z.T=re,jx(o,!1,c,m);try{var xe=D(),Je=Z.S;if(Je!==null&&Je(re,xe),xe!==null&&typeof xe=="object"&&typeof xe.then=="function"){var ht=N1(xe,b);Mp(o,c,ht,Ao(o))}else Mp(o,c,b,Ao(o))}catch(xt){Mp(o,c,{then:function(){},status:"rejected",reason:xt},Ao())}finally{ue.p=P,$!==null&&re.types!==null&&($.types=re.types),Z.T=$}}function gI(){}function Vx(o,c,m,b){if(o.tag!==5)throw Error(n(476));var D=R4(o).queue;C4(o,D,c,he,m===null?gI:function(){return N4(o),m(b)})}function R4(o){var c=o.memoizedState;if(c!==null)return c;c={memoizedState:he,baseState:he,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:nc,lastRenderedState:he},next:null};var m={};return c.next={memoizedState:m,baseState:m,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:nc,lastRenderedState:m},next:null},o.memoizedState=c,o=o.alternate,o!==null&&(o.memoizedState=c),c}function N4(o){var c=R4(o);c.next===null&&(c=o.alternate.memoizedState),Mp(o,c.next.queue,{},Ao())}function Hx(){return As(Vp)}function D4(){return jr().memoizedState}function P4(){return jr().memoizedState}function vI(o){for(var c=o.return;c!==null;){switch(c.tag){case 24:case 3:var m=Ao();o=Le(m);var b=Ye(c,o,m);b!==null&&(Ia(b,c,m),qe(b,c,m)),c={cache:Ur()},o.payload=c;return}c=c.return}}function _I(o,c,m){var b=Ao();m={lane:b,revertLane:0,gesture:null,action:m,hasEagerState:!1,eagerState:null,next:null},k1(o)?U4(c,m):(m=gp(o,c,m,b),m!==null&&(Ia(m,o,b),B4(m,c,b)))}function L4(o,c,m){var b=Ao();Mp(o,c,m,b)}function Mp(o,c,m,b){var D={lane:b,revertLane:0,gesture:null,action:m,hasEagerState:!1,eagerState:null,next:null};if(k1(o))U4(c,D);else{var P=o.alternate;if(o.lanes===0&&(P===null||P.lanes===0)&&(P=c.lastRenderedReducer,P!==null))try{var $=c.lastRenderedState,re=P($,m);if(D.hasEagerState=!0,D.eagerState=re,Aa(re,$))return BA(o,c,D,0),or===null&&UA(),!1}catch{}finally{}if(m=gp(o,c,D,b),m!==null)return Ia(m,o,b),B4(m,c,b),!0}return!1}function jx(o,c,m,b){if(b={lane:2,revertLane:Sb(),gesture:null,action:b,hasEagerState:!1,eagerState:null,next:null},k1(o)){if(c)throw Error(n(479))}else c=gp(o,m,b,2),c!==null&&Ia(c,o,2)}function k1(o){var c=o.alternate;return o===ri||c!==null&&c===ri}function U4(o,c){jA=P1=!0;var m=o.pending;m===null?c.next=c:(c.next=m.next,m.next=c),o.pending=c}function B4(o,c,m){if((m&4194048)!==0){var b=c.lanes;b&=o.pendingLanes,m|=b,c.lanes=m,pt(o,m)}}var Ep={readContext:As,use:B1,useCallback:Br,useContext:Br,useEffect:Br,useImperativeHandle:Br,useLayoutEffect:Br,useInsertionEffect:Br,useMemo:Br,useReducer:Br,useRef:Br,useState:Br,useDebugValue:Br,useDeferredValue:Br,useTransition:Br,useSyncExternalStore:Br,useId:Br,useHostTransitionStatus:Br,useFormState:Br,useActionState:Br,useOptimistic:Br,useMemoCache:Br,useCacheRefresh:Br};Ep.useEffectEvent=Br;var O4={readContext:As,use:B1,useCallback:function(o,c){return ma().memoizedState=[o,c===void 0?null:c],o},useContext:As,useEffect:_4,useImperativeHandle:function(o,c,m){m=m!=null?m.concat([o]):null,I1(4194308,4,S4.bind(null,c,o),m)},useLayoutEffect:function(o,c){return I1(4194308,4,o,c)},useInsertionEffect:function(o,c){I1(4,2,o,c)},useMemo:function(o,c){var m=ma();c=c===void 0?null:c;var b=o();if(mf){Ft(!0);try{o()}finally{Ft(!1)}}return m.memoizedState=[b,c],b},useReducer:function(o,c,m){var b=ma();if(m!==void 0){var D=m(c);if(mf){Ft(!0);try{m(c)}finally{Ft(!1)}}}else D=c;return b.memoizedState=b.baseState=D,o={pending:null,lanes:0,dispatch:null,lastRenderedReducer:o,lastRenderedState:D},b.queue=o,o=o.dispatch=_I.bind(null,ri,o),[b.memoizedState,o]},useRef:function(o){var c=ma();return o={current:o},c.memoizedState=o},useState:function(o){o=Fx(o);var c=o.queue,m=L4.bind(null,ri,c);return c.dispatch=m,[o.memoizedState,m]},useDebugValue:Gx,useDeferredValue:function(o,c){var m=ma();return qx(m,o,c)},useTransition:function(){var o=Fx(!1);return o=C4.bind(null,ri,o.queue,!0,!1),ma().memoizedState=o,[!1,o]},useSyncExternalStore:function(o,c,m){var b=ri,D=ma();if(mi){if(m===void 0)throw Error(n(407));m=m()}else{if(m=c(),or===null)throw Error(n(349));(xi&127)!==0||i4(b,c,m)}D.memoizedState=m;var P={value:m,getSnapshot:c};return D.queue=P,_4(s4.bind(null,b,P,o),[o]),b.flags|=2048,$A(9,{destroy:void 0},r4.bind(null,b,P,m,c),null),m},useId:function(){var o=ma(),c=or.identifierPrefix;if(mi){var m=Da,b=Na;m=(b&~(1<<32-Gt(b)-1)).toString(32)+m,c="_"+c+"R_"+m,m=L1++,0<\/script>",P=P.removeChild(P.firstChild);break;case"select":P=typeof b.is=="string"?$.createElement("select",{is:b.is}):$.createElement("select"),b.multiple?P.multiple=!0:b.size&&(P.size=b.size);break;default:P=typeof b.is=="string"?$.createElement(D,{is:b.is}):$.createElement(D)}}P[Xn]=c,P[un]=b;e:for($=c.child;$!==null;){if($.tag===5||$.tag===6)P.appendChild($.stateNode);else if($.tag!==4&&$.tag!==27&&$.child!==null){$.child.return=$,$=$.child;continue}if($===c)break e;for(;$.sibling===null;){if($.return===null||$.return===c)break e;$=$.return}$.sibling.return=$.return,$=$.sibling}c.stateNode=P;e:switch(Us(P,D,b),D){case"button":case"input":case"select":case"textarea":b=!!b.autoFocus;break e;case"img":b=!0;break e;default:b=!1}b&&rc(c)}}return Ar(c),sb(c,c.type,o===null?null:o.memoizedProps,c.pendingProps,m),null;case 6:if(o&&c.stateNode!=null)o.memoizedProps!==b&&rc(c);else{if(typeof b!="string"&&c.stateNode===null)throw Error(n(166));if(o=_e.current,ar(c)){if(o=c.stateNode,m=c.memoizedProps,b=null,D=fs,D!==null)switch(D.tag){case 27:case 5:b=D.memoizedProps}o[Xn]=c,o=!!(o.nodeValue===m||b!==null&&b.suppressHydrationWarning===!0||t5(o.nodeValue,m)),o||zl(c,!0)}else o=s2(o).createTextNode(b),o[Xn]=c,c.stateNode=o}return Ar(c),null;case 31:if(m=c.memoizedState,o===null||o.memoizedState!==null){if(b=ar(c),m!==null){if(o===null){if(!b)throw Error(n(318));if(o=c.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(n(557));o[Xn]=c}else Yu(),(c.flags&128)===0&&(c.memoizedState=null),c.flags|=4;Ar(c),o=!1}else m=Sp(),o!==null&&o.memoizedState!==null&&(o.memoizedState.hydrationErrors=m),o=!0;if(!o)return c.flags&256?(co(c),c):(co(c),null);if((c.flags&128)!==0)throw Error(n(558))}return Ar(c),null;case 13:if(b=c.memoizedState,o===null||o.memoizedState!==null&&o.memoizedState.dehydrated!==null){if(D=ar(c),b!==null&&b.dehydrated!==null){if(o===null){if(!D)throw Error(n(318));if(D=c.memoizedState,D=D!==null?D.dehydrated:null,!D)throw Error(n(317));D[Xn]=c}else Yu(),(c.flags&128)===0&&(c.memoizedState=null),c.flags|=4;Ar(c),D=!1}else D=Sp(),o!==null&&o.memoizedState!==null&&(o.memoizedState.hydrationErrors=D),D=!0;if(!D)return c.flags&256?(co(c),c):(co(c),null)}return co(c),(c.flags&128)!==0?(c.lanes=m,c):(m=b!==null,o=o!==null&&o.memoizedState!==null,m&&(b=c.child,D=null,b.alternate!==null&&b.alternate.memoizedState!==null&&b.alternate.memoizedState.cachePool!==null&&(D=b.alternate.memoizedState.cachePool.pool),P=null,b.memoizedState!==null&&b.memoizedState.cachePool!==null&&(P=b.memoizedState.cachePool.pool),P!==D&&(b.flags|=2048)),m!==o&&m&&(c.child.flags|=8192),H1(c,c.updateQueue),Ar(c),null);case 4:return vt(),o===null&&Eb(c.stateNode.containerInfo),Ar(c),null;case 10:return Io(c.type),Ar(c),null;case 19:if(we(Hr),b=c.memoizedState,b===null)return Ar(c),null;if(D=(c.flags&128)!==0,P=b.rendering,P===null)if(D)Rp(b,!1);else{if(Or!==0||o!==null&&(o.flags&128)!==0)for(o=c.child;o!==null;){if(P=D1(o),P!==null){for(c.flags|=128,Rp(b,!1),o=P.updateQueue,c.updateQueue=o,H1(c,o),c.subtreeFlags=0,o=m,m=c.child;m!==null;)E1(m,o),m=m.sibling;return We(Hr,Hr.current&1|2),mi&&Oo(c,b.treeForkCount),c.child}o=o.sibling}b.tail!==null&&$e()>Y1&&(c.flags|=128,D=!0,Rp(b,!1),c.lanes=4194304)}else{if(!D)if(o=D1(P),o!==null){if(c.flags|=128,D=!0,o=o.updateQueue,c.updateQueue=o,H1(c,o),Rp(b,!0),b.tail===null&&b.tailMode==="hidden"&&!P.alternate&&!mi)return Ar(c),null}else 2*$e()-b.renderingStartTime>Y1&&m!==536870912&&(c.flags|=128,D=!0,Rp(b,!1),c.lanes=4194304);b.isBackwards?(P.sibling=c.child,c.child=P):(o=b.last,o!==null?o.sibling=P:c.child=P,b.last=P)}return b.tail!==null?(o=b.tail,b.rendering=o,b.tail=o.sibling,b.renderingStartTime=$e(),o.sibling=null,m=Hr.current,We(Hr,D?m&1|2:m&1),mi&&Oo(c,b.treeForkCount),o):(Ar(c),null);case 22:case 23:return co(c),Lt(),b=c.memoizedState!==null,o!==null?o.memoizedState!==null!==b&&(c.flags|=8192):b&&(c.flags|=8192),b?(m&536870912)!==0&&(c.flags&128)===0&&(Ar(c),c.subtreeFlags&6&&(c.flags|=8192)):Ar(c),m=c.updateQueue,m!==null&&H1(c,m.retryQueue),m=null,o!==null&&o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(m=o.memoizedState.cachePool.pool),b=null,c.memoizedState!==null&&c.memoizedState.cachePool!==null&&(b=c.memoizedState.cachePool.pool),b!==m&&(c.flags|=2048),o!==null&&we(Nt),null;case 24:return m=null,o!==null&&(m=o.memoizedState.cache),c.memoizedState.cache!==m&&(c.flags|=2048),Io(Xt),Ar(c),null;case 25:return null;case 30:return null}throw Error(n(156,c.tag))}function TI(o,c){switch(_p(c),c.tag){case 1:return o=c.flags,o&65536?(c.flags=o&-65537|128,c):null;case 3:return Io(Xt),vt(),o=c.flags,(o&65536)!==0&&(o&128)===0?(c.flags=o&-65537|128,c):null;case 26:case 27:case 5:return Ge(c),null;case 31:if(c.memoizedState!==null){if(co(c),c.alternate===null)throw Error(n(340));Yu()}return o=c.flags,o&65536?(c.flags=o&-65537|128,c):null;case 13:if(co(c),o=c.memoizedState,o!==null&&o.dehydrated!==null){if(c.alternate===null)throw Error(n(340));Yu()}return o=c.flags,o&65536?(c.flags=o&-65537|128,c):null;case 19:return we(Hr),null;case 4:return vt(),null;case 10:return Io(c.type),null;case 22:case 23:return co(c),Lt(),o!==null&&we(Nt),o=c.flags,o&65536?(c.flags=o&-65537|128,c):null;case 24:return Io(Xt),null;case 25:return null;default:return null}}function a8(o,c){switch(_p(c),c.tag){case 3:Io(Xt),vt();break;case 26:case 27:case 5:Ge(c);break;case 4:vt();break;case 31:c.memoizedState!==null&&co(c);break;case 13:co(c);break;case 19:we(Hr);break;case 10:Io(c.type);break;case 22:case 23:co(c),Lt(),o!==null&&we(Nt);break;case 24:Io(Xt)}}function Np(o,c){try{var m=c.updateQueue,b=m!==null?m.lastEffect:null;if(b!==null){var D=b.next;m=D;do{if((m.tag&o)===o){b=void 0;var P=m.create,$=m.inst;b=P(),$.destroy=b}m=m.next}while(m!==D)}}catch(re){Yi(c,c.return,re)}}function nh(o,c,m){try{var b=c.updateQueue,D=b!==null?b.lastEffect:null;if(D!==null){var P=D.next;b=P;do{if((b.tag&o)===o){var $=b.inst,re=$.destroy;if(re!==void 0){$.destroy=void 0,D=c;var xe=m,Je=re;try{Je()}catch(ht){Yi(D,xe,ht)}}}b=b.next}while(b!==P)}}catch(ht){Yi(c,c.return,ht)}}function o8(o){var c=o.updateQueue;if(c!==null){var m=o.stateNode;try{Un(c,m)}catch(b){Yi(o,o.return,b)}}}function l8(o,c,m){m.props=gf(o.type,o.memoizedProps),m.state=o.memoizedState;try{m.componentWillUnmount()}catch(b){Yi(o,c,b)}}function Dp(o,c){try{var m=o.ref;if(m!==null){switch(o.tag){case 26:case 27:case 5:var b=o.stateNode;break;case 30:b=o.stateNode;break;default:b=o.stateNode}typeof m=="function"?o.refCleanup=m(b):m.current=b}}catch(D){Yi(o,c,D)}}function ql(o,c){var m=o.ref,b=o.refCleanup;if(m!==null)if(typeof b=="function")try{b()}catch(D){Yi(o,c,D)}finally{o.refCleanup=null,o=o.alternate,o!=null&&(o.refCleanup=null)}else if(typeof m=="function")try{m(null)}catch(D){Yi(o,c,D)}else m.current=null}function u8(o){var c=o.type,m=o.memoizedProps,b=o.stateNode;try{e:switch(c){case"button":case"input":case"select":case"textarea":m.autoFocus&&b.focus();break e;case"img":m.src?b.src=m.src:m.srcSet&&(b.srcset=m.srcSet)}}catch(D){Yi(o,o.return,D)}}function ab(o,c,m){try{var b=o.stateNode;WI(b,o.type,m,c),b[un]=c}catch(D){Yi(o,o.return,D)}}function c8(o){return o.tag===5||o.tag===3||o.tag===26||o.tag===27&&uh(o.type)||o.tag===4}function ob(o){e:for(;;){for(;o.sibling===null;){if(o.return===null||c8(o.return))return null;o=o.return}for(o.sibling.return=o.return,o=o.sibling;o.tag!==5&&o.tag!==6&&o.tag!==18;){if(o.tag===27&&uh(o.type)||o.flags&2||o.child===null||o.tag===4)continue e;o.child.return=o,o=o.child}if(!(o.flags&2))return o.stateNode}}function lb(o,c,m){var b=o.tag;if(b===5||b===6)o=o.stateNode,c?(m.nodeType===9?m.body:m.nodeName==="HTML"?m.ownerDocument.body:m).insertBefore(o,c):(c=m.nodeType===9?m.body:m.nodeName==="HTML"?m.ownerDocument.body:m,c.appendChild(o),m=m._reactRootContainer,m!=null||c.onclick!==null||(c.onclick=Po));else if(b!==4&&(b===27&&uh(o.type)&&(m=o.stateNode,c=null),o=o.child,o!==null))for(lb(o,c,m),o=o.sibling;o!==null;)lb(o,c,m),o=o.sibling}function j1(o,c,m){var b=o.tag;if(b===5||b===6)o=o.stateNode,c?m.insertBefore(o,c):m.appendChild(o);else if(b!==4&&(b===27&&uh(o.type)&&(m=o.stateNode),o=o.child,o!==null))for(j1(o,c,m),o=o.sibling;o!==null;)j1(o,c,m),o=o.sibling}function h8(o){var c=o.stateNode,m=o.memoizedProps;try{for(var b=o.type,D=c.attributes;D.length;)c.removeAttributeNode(D[0]);Us(c,b,m),c[Xn]=o,c[un]=m}catch(P){Yi(o,o.return,P)}}var sc=!1,ns=!1,ub=!1,f8=typeof WeakSet=="function"?WeakSet:Set,Ms=null;function wI(o,c){if(o=o.containerInfo,Nb=f2,o=Ol(o),Il(o)){if("selectionStart"in o)var m={start:o.selectionStart,end:o.selectionEnd};else e:{m=(m=o.ownerDocument)&&m.defaultView||window;var b=m.getSelection&&m.getSelection();if(b&&b.rangeCount!==0){m=b.anchorNode;var D=b.anchorOffset,P=b.focusNode;b=b.focusOffset;try{m.nodeType,P.nodeType}catch{m=null;break e}var $=0,re=-1,xe=-1,Je=0,ht=0,xt=o,et=null;t:for(;;){for(var nt;xt!==m||D!==0&&xt.nodeType!==3||(re=$+D),xt!==P||b!==0&&xt.nodeType!==3||(xe=$+b),xt.nodeType===3&&($+=xt.nodeValue.length),(nt=xt.firstChild)!==null;)et=xt,xt=nt;for(;;){if(xt===o)break t;if(et===m&&++Je===D&&(re=$),et===P&&++ht===b&&(xe=$),(nt=xt.nextSibling)!==null)break;xt=et,et=xt.parentNode}xt=nt}m=re===-1||xe===-1?null:{start:re,end:xe}}else m=null}m=m||{start:0,end:0}}else m=null;for(Db={focusedElem:o,selectionRange:m},f2=!1,Ms=c;Ms!==null;)if(c=Ms,o=c.child,(c.subtreeFlags&1028)!==0&&o!==null)o.return=c,Ms=o;else for(;Ms!==null;){switch(c=Ms,P=c.alternate,o=c.flags,c.tag){case 0:if((o&4)!==0&&(o=c.updateQueue,o=o!==null?o.events:null,o!==null))for(m=0;m title"))),Us(P,b,m),P[Xn]=o,Oe(P),b=P;break e;case"link":var $=v5("link","href",D).get(b+(m.href||""));if($){for(var re=0;re<$.length;re++)if(P=$[re],P.getAttribute("href")===(m.href==null||m.href===""?null:m.href)&&P.getAttribute("rel")===(m.rel==null?null:m.rel)&&P.getAttribute("title")===(m.title==null?null:m.title)&&P.getAttribute("crossorigin")===(m.crossOrigin==null?null:m.crossOrigin)){$.splice(re,1);break t}}P=D.createElement(b),Us(P,b,m),D.head.appendChild(P);break;case"meta":if($=v5("meta","content",D).get(b+(m.content||""))){for(re=0;re<$.length;re++)if(P=$[re],P.getAttribute("content")===(m.content==null?null:""+m.content)&&P.getAttribute("name")===(m.name==null?null:m.name)&&P.getAttribute("property")===(m.property==null?null:m.property)&&P.getAttribute("http-equiv")===(m.httpEquiv==null?null:m.httpEquiv)&&P.getAttribute("charset")===(m.charSet==null?null:m.charSet)){$.splice(re,1);break t}}P=D.createElement(b),Us(P,b,m),D.head.appendChild(P);break;default:throw Error(n(468,b))}P[Xn]=o,Oe(P),b=P}o.stateNode=b}else _5(D,o.type,o.stateNode);else o.stateNode=g5(D,b,o.memoizedProps);else P!==b?(P===null?m.stateNode!==null&&(m=m.stateNode,m.parentNode.removeChild(m)):P.count--,b===null?_5(D,o.type,o.stateNode):g5(D,b,o.memoizedProps)):b===null&&o.stateNode!==null&&ab(o,o.memoizedProps,m.memoizedProps)}break;case 27:Ua(c,o),Ba(o),b&512&&(ns||m===null||ql(m,m.return)),m!==null&&b&4&&ab(o,o.memoizedProps,m.memoizedProps);break;case 5:if(Ua(c,o),Ba(o),b&512&&(ns||m===null||ql(m,m.return)),o.flags&32){D=o.stateNode;try{pi(D,"")}catch(on){Yi(o,o.return,on)}}b&4&&o.stateNode!=null&&(D=o.memoizedProps,ab(o,D,m!==null?m.memoizedProps:D)),b&1024&&(ub=!0);break;case 6:if(Ua(c,o),Ba(o),b&4){if(o.stateNode===null)throw Error(n(162));b=o.memoizedProps,m=o.stateNode;try{m.nodeValue=b}catch(on){Yi(o,o.return,on)}}break;case 3:if(l2=null,D=dl,dl=a2(c.containerInfo),Ua(c,o),dl=D,Ba(o),b&4&&m!==null&&m.memoizedState.isDehydrated)try{sd(c.containerInfo)}catch(on){Yi(o,o.return,on)}ub&&(ub=!1,_8(o));break;case 4:b=dl,dl=a2(o.stateNode.containerInfo),Ua(c,o),Ba(o),dl=b;break;case 12:Ua(c,o),Ba(o);break;case 31:Ua(c,o),Ba(o),b&4&&(b=o.updateQueue,b!==null&&(o.updateQueue=null,W1(o,b)));break;case 13:Ua(c,o),Ba(o),o.child.flags&8192&&o.memoizedState!==null!=(m!==null&&m.memoizedState!==null)&&(X1=$e()),b&4&&(b=o.updateQueue,b!==null&&(o.updateQueue=null,W1(o,b)));break;case 22:D=o.memoizedState!==null;var xe=m!==null&&m.memoizedState!==null,Je=sc,ht=ns;if(sc=Je||D,ns=ht||xe,Ua(c,o),ns=ht,sc=Je,Ba(o),b&8192)e:for(c=o.stateNode,c._visibility=D?c._visibility&-2:c._visibility|1,D&&(m===null||xe||sc||ns||vf(o)),m=null,c=o;;){if(c.tag===5||c.tag===26){if(m===null){xe=m=c;try{if(P=xe.stateNode,D)$=P.style,typeof $.setProperty=="function"?$.setProperty("display","none","important"):$.display="none";else{re=xe.stateNode;var xt=xe.memoizedProps.style,et=xt!=null&&xt.hasOwnProperty("display")?xt.display:null;re.style.display=et==null||typeof et=="boolean"?"":(""+et).trim()}}catch(on){Yi(xe,xe.return,on)}}}else if(c.tag===6){if(m===null){xe=c;try{xe.stateNode.nodeValue=D?"":xe.memoizedProps}catch(on){Yi(xe,xe.return,on)}}}else if(c.tag===18){if(m===null){xe=c;try{var nt=xe.stateNode;D?l5(nt,!0):l5(xe.stateNode,!1)}catch(on){Yi(xe,xe.return,on)}}}else if((c.tag!==22&&c.tag!==23||c.memoizedState===null||c===o)&&c.child!==null){c.child.return=c,c=c.child;continue}if(c===o)break e;for(;c.sibling===null;){if(c.return===null||c.return===o)break e;m===c&&(m=null),c=c.return}m===c&&(m=null),c.sibling.return=c.return,c=c.sibling}b&4&&(b=o.updateQueue,b!==null&&(m=b.retryQueue,m!==null&&(b.retryQueue=null,W1(o,m))));break;case 19:Ua(c,o),Ba(o),b&4&&(b=o.updateQueue,b!==null&&(o.updateQueue=null,W1(o,b)));break;case 30:break;case 21:break;default:Ua(c,o),Ba(o)}}function Ba(o){var c=o.flags;if(c&2){try{for(var m,b=o.return;b!==null;){if(c8(b)){m=b;break}b=b.return}if(m==null)throw Error(n(160));switch(m.tag){case 27:var D=m.stateNode,P=ob(o);j1(o,P,D);break;case 5:var $=m.stateNode;m.flags&32&&(pi($,""),m.flags&=-33);var re=ob(o);j1(o,re,$);break;case 3:case 4:var xe=m.stateNode.containerInfo,Je=ob(o);lb(o,Je,xe);break;default:throw Error(n(161))}}catch(ht){Yi(o,o.return,ht)}o.flags&=-3}c&4096&&(o.flags&=-4097)}function _8(o){if(o.subtreeFlags&1024)for(o=o.child;o!==null;){var c=o;_8(c),c.tag===5&&c.flags&1024&&c.stateNode.reset(),o=o.sibling}}function oc(o,c){if(c.subtreeFlags&8772)for(c=c.child;c!==null;)A8(o,c.alternate,c),c=c.sibling}function vf(o){for(o=o.child;o!==null;){var c=o;switch(c.tag){case 0:case 11:case 14:case 15:nh(4,c,c.return),vf(c);break;case 1:ql(c,c.return);var m=c.stateNode;typeof m.componentWillUnmount=="function"&&l8(c,c.return,m),vf(c);break;case 27:zp(c.stateNode);case 26:case 5:ql(c,c.return),vf(c);break;case 22:c.memoizedState===null&&vf(c);break;case 30:vf(c);break;default:vf(c)}o=o.sibling}}function lc(o,c,m){for(m=m&&(c.subtreeFlags&8772)!==0,c=c.child;c!==null;){var b=c.alternate,D=o,P=c,$=P.flags;switch(P.tag){case 0:case 11:case 15:lc(D,P,m),Np(4,P);break;case 1:if(lc(D,P,m),b=P,D=b.stateNode,typeof D.componentDidMount=="function")try{D.componentDidMount()}catch(Je){Yi(b,b.return,Je)}if(b=P,D=b.updateQueue,D!==null){var re=b.stateNode;try{var xe=D.shared.hiddenCallbacks;if(xe!==null)for(D.shared.hiddenCallbacks=null,D=0;Der&&($=er,er=Dn,Dn=$);var Ve=LA(re,Dn),Pe=LA(re,er);if(Ve&&Pe&&(nt.rangeCount!==1||nt.anchorNode!==Ve.node||nt.anchorOffset!==Ve.offset||nt.focusNode!==Pe.node||nt.focusOffset!==Pe.offset)){var Ke=xt.createRange();Ke.setStart(Ve.node,Ve.offset),nt.removeAllRanges(),Dn>er?(nt.addRange(Ke),nt.extend(Pe.node,Pe.offset)):(Ke.setEnd(Pe.node,Pe.offset),nt.addRange(Ke))}}}}for(xt=[],nt=re;nt=nt.parentNode;)nt.nodeType===1&&xt.push({element:nt,left:nt.scrollLeft,top:nt.scrollTop});for(typeof re.focus=="function"&&re.focus(),re=0;rem?32:m,Z.T=null,m=mb,mb=null;var P=ah,$=cc;if(ds=0,ZA=ah=null,cc=0,(Oi&6)!==0)throw Error(n(331));var re=Oi;if(Oi|=4,S8(P.current),y8(P,P.current,$,m),Oi=re,Ip(0,!1),Ht&&typeof Ht.onPostCommitFiberRoot=="function")try{Ht.onPostCommitFiberRoot(rn,P)}catch{}return!0}finally{ue.p=D,Z.T=b,G8(o,c)}}function V8(o,c,m){c=Ca(m,c),c=Yx(o.stateNode,c,2),o=Ye(o,c,2),o!==null&&($i(o,2),Vl(o))}function Yi(o,c,m){if(o.tag===3)V8(o,o,m);else for(;c!==null;){if(c.tag===3){V8(c,o,m);break}else if(c.tag===1){var b=c.stateNode;if(typeof c.type.getDerivedStateFromError=="function"||typeof b.componentDidCatch=="function"&&(sh===null||!sh.has(b))){o=Ca(m,o),m=H4(2),b=Ye(c,m,2),b!==null&&(j4(m,b,c,o),$i(b,2),Vl(b));break}}c=c.return}}function yb(o,c,m){var b=o.pingCache;if(b===null){b=o.pingCache=new CI;var D=new Set;b.set(c,D)}else D=b.get(c),D===void 0&&(D=new Set,b.set(c,D));D.has(m)||(fb=!0,D.add(m),o=LI.bind(null,o,c,m),c.then(o,o))}function LI(o,c,m){var b=o.pingCache;b!==null&&b.delete(c),o.pingedLanes|=o.suspendedLanes&m,o.warmLanes&=~m,or===o&&(xi&m)===m&&(Or===4||Or===3&&(xi&62914560)===xi&&300>$e()-X1?(Oi&2)===0&&JA(o,0):Ab|=m,KA===xi&&(KA=0)),Vl(o)}function H8(o,c){c===0&&(c=rr()),o=ju(o,c),o!==null&&($i(o,c),Vl(o))}function UI(o){var c=o.memoizedState,m=0;c!==null&&(m=c.retryLane),H8(o,m)}function BI(o,c){var m=0;switch(o.tag){case 31:case 13:var b=o.stateNode,D=o.memoizedState;D!==null&&(m=D.retryLane);break;case 19:b=o.stateNode;break;case 22:b=o.stateNode._retryCache;break;default:throw Error(n(314))}b!==null&&b.delete(c),H8(o,m)}function OI(o,c){return bt(o,c)}var t2=null,td=null,xb=!1,n2=!1,bb=!1,lh=0;function Vl(o){o!==td&&o.next===null&&(td===null?t2=td=o:td=td.next=o),n2=!0,xb||(xb=!0,FI())}function Ip(o,c){if(!bb&&n2){bb=!0;do for(var m=!1,b=t2;b!==null;){if(o!==0){var D=b.pendingLanes;if(D===0)var P=0;else{var $=b.suspendedLanes,re=b.pingedLanes;P=(1<<31-Gt(42|o)+1)-1,P&=D&~($&~re),P=P&201326741?P&201326741|1:P?P|2:0}P!==0&&(m=!0,X8(b,P))}else P=xi,P=kt(b,b===or?P:0,b.cancelPendingCommit!==null||b.timeoutHandle!==-1),(P&3)===0||xn(b,P)||(m=!0,X8(b,P));b=b.next}while(m);bb=!1}}function II(){j8()}function j8(){n2=xb=!1;var o=0;lh!==0&&XI()&&(o=lh);for(var c=$e(),m=null,b=t2;b!==null;){var D=b.next,P=W8(b,c);P===0?(b.next=null,m===null?t2=D:m.next=D,D===null&&(td=m)):(m=b,(o!==0||(P&3)!==0)&&(n2=!0)),b=D}ds!==0&&ds!==5||Ip(o),lh!==0&&(lh=0)}function W8(o,c){for(var m=o.suspendedLanes,b=o.pingedLanes,D=o.expirationTimes,P=o.pendingLanes&-62914561;0re)break;var ht=xe.transferSize,xt=xe.initiatorType;ht&&n5(xt)&&(xe=xe.responseEnd,$+=ht*(xe"u"?null:document;function d5(o,c,m){var b=nd;if(b&&typeof c=="string"&&c){var D=ot(c);D='link[rel="'+o+'"][href="'+D+'"]',typeof m=="string"&&(D+='[crossorigin="'+m+'"]'),A5.has(D)||(A5.add(D),o={rel:o,crossOrigin:m,href:c},b.querySelector(D)===null&&(c=b.createElement("link"),Us(c,"link",o),Oe(c),b.head.appendChild(c)))}}function iF(o){hc.D(o),d5("dns-prefetch",o,null)}function rF(o,c){hc.C(o,c),d5("preconnect",o,c)}function sF(o,c,m){hc.L(o,c,m);var b=nd;if(b&&o&&c){var D='link[rel="preload"][as="'+ot(c)+'"]';c==="image"&&m&&m.imageSrcSet?(D+='[imagesrcset="'+ot(m.imageSrcSet)+'"]',typeof m.imageSizes=="string"&&(D+='[imagesizes="'+ot(m.imageSizes)+'"]')):D+='[href="'+ot(o)+'"]';var P=D;switch(c){case"style":P=id(o);break;case"script":P=rd(o)}Go.has(P)||(o=v({rel:"preload",href:c==="image"&&m&&m.imageSrcSet?void 0:o,as:c},m),Go.set(P,o),b.querySelector(D)!==null||c==="style"&&b.querySelector(Gp(P))||c==="script"&&b.querySelector(qp(P))||(c=b.createElement("link"),Us(c,"link",o),Oe(c),b.head.appendChild(c)))}}function aF(o,c){hc.m(o,c);var m=nd;if(m&&o){var b=c&&typeof c.as=="string"?c.as:"script",D='link[rel="modulepreload"][as="'+ot(b)+'"][href="'+ot(o)+'"]',P=D;switch(b){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":P=rd(o)}if(!Go.has(P)&&(o=v({rel:"modulepreload",href:o},c),Go.set(P,o),m.querySelector(D)===null)){switch(b){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(m.querySelector(qp(P)))return}b=m.createElement("link"),Us(b,"link",o),Oe(b),m.head.appendChild(b)}}}function oF(o,c,m){hc.S(o,c,m);var b=nd;if(b&&o){var D=Xe(b).hoistableStyles,P=id(o);c=c||"default";var $=D.get(P);if(!$){var re={loading:0,preload:null};if($=b.querySelector(Gp(P)))re.loading=5;else{o=v({rel:"stylesheet",href:o,"data-precedence":c},m),(m=Go.get(P))&&Fb(o,m);var xe=$=b.createElement("link");Oe(xe),Us(xe,"link",o),xe._p=new Promise(function(Je,ht){xe.onload=Je,xe.onerror=ht}),xe.addEventListener("load",function(){re.loading|=1}),xe.addEventListener("error",function(){re.loading|=2}),re.loading|=4,o2($,c,b)}$={type:"stylesheet",instance:$,count:1,state:re},D.set(P,$)}}}function lF(o,c){hc.X(o,c);var m=nd;if(m&&o){var b=Xe(m).hoistableScripts,D=rd(o),P=b.get(D);P||(P=m.querySelector(qp(D)),P||(o=v({src:o,async:!0},c),(c=Go.get(D))&&kb(o,c),P=m.createElement("script"),Oe(P),Us(P,"link",o),m.head.appendChild(P)),P={type:"script",instance:P,count:1,state:null},b.set(D,P))}}function uF(o,c){hc.M(o,c);var m=nd;if(m&&o){var b=Xe(m).hoistableScripts,D=rd(o),P=b.get(D);P||(P=m.querySelector(qp(D)),P||(o=v({src:o,async:!0,type:"module"},c),(c=Go.get(D))&&kb(o,c),P=m.createElement("script"),Oe(P),Us(P,"link",o),m.head.appendChild(P)),P={type:"script",instance:P,count:1,state:null},b.set(D,P))}}function p5(o,c,m,b){var D=(D=_e.current)?a2(D):null;if(!D)throw Error(n(446));switch(o){case"meta":case"title":return null;case"style":return typeof m.precedence=="string"&&typeof m.href=="string"?(c=id(m.href),m=Xe(D).hoistableStyles,b=m.get(c),b||(b={type:"style",instance:null,count:0,state:null},m.set(c,b)),b):{type:"void",instance:null,count:0,state:null};case"link":if(m.rel==="stylesheet"&&typeof m.href=="string"&&typeof m.precedence=="string"){o=id(m.href);var P=Xe(D).hoistableStyles,$=P.get(o);if($||(D=D.ownerDocument||D,$={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},P.set(o,$),(P=D.querySelector(Gp(o)))&&!P._p&&($.instance=P,$.state.loading=5),Go.has(o)||(m={rel:"preload",as:"style",href:m.href,crossOrigin:m.crossOrigin,integrity:m.integrity,media:m.media,hrefLang:m.hrefLang,referrerPolicy:m.referrerPolicy},Go.set(o,m),P||cF(D,o,m,$.state))),c&&b===null)throw Error(n(528,""));return $}if(c&&b!==null)throw Error(n(529,""));return null;case"script":return c=m.async,m=m.src,typeof m=="string"&&c&&typeof c!="function"&&typeof c!="symbol"?(c=rd(m),m=Xe(D).hoistableScripts,b=m.get(c),b||(b={type:"script",instance:null,count:0,state:null},m.set(c,b)),b):{type:"void",instance:null,count:0,state:null};default:throw Error(n(444,o))}}function id(o){return'href="'+ot(o)+'"'}function Gp(o){return'link[rel="stylesheet"]['+o+"]"}function m5(o){return v({},o,{"data-precedence":o.precedence,precedence:null})}function cF(o,c,m,b){o.querySelector('link[rel="preload"][as="style"]['+c+"]")?b.loading=1:(c=o.createElement("link"),b.preload=c,c.addEventListener("load",function(){return b.loading|=1}),c.addEventListener("error",function(){return b.loading|=2}),Us(c,"link",m),Oe(c),o.head.appendChild(c))}function rd(o){return'[src="'+ot(o)+'"]'}function qp(o){return"script[async]"+o}function g5(o,c,m){if(c.count++,c.instance===null)switch(c.type){case"style":var b=o.querySelector('style[data-href~="'+ot(m.href)+'"]');if(b)return c.instance=b,Oe(b),b;var D=v({},m,{"data-href":m.href,"data-precedence":m.precedence,href:null,precedence:null});return b=(o.ownerDocument||o).createElement("style"),Oe(b),Us(b,"style",D),o2(b,m.precedence,o),c.instance=b;case"stylesheet":D=id(m.href);var P=o.querySelector(Gp(D));if(P)return c.state.loading|=4,c.instance=P,Oe(P),P;b=m5(m),(D=Go.get(D))&&Fb(b,D),P=(o.ownerDocument||o).createElement("link"),Oe(P);var $=P;return $._p=new Promise(function(re,xe){$.onload=re,$.onerror=xe}),Us(P,"link",b),c.state.loading|=4,o2(P,m.precedence,o),c.instance=P;case"script":return P=rd(m.src),(D=o.querySelector(qp(P)))?(c.instance=D,Oe(D),D):(b=m,(D=Go.get(P))&&(b=v({},m),kb(b,D)),o=o.ownerDocument||o,D=o.createElement("script"),Oe(D),Us(D,"link",b),o.head.appendChild(D),c.instance=D);case"void":return null;default:throw Error(n(443,c.type))}else c.type==="stylesheet"&&(c.state.loading&4)===0&&(b=c.instance,c.state.loading|=4,o2(b,m.precedence,o));return c.instance}function o2(o,c,m){for(var b=m.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),D=b.length?b[b.length-1]:null,P=D,$=0;$ title"):null)}function hF(o,c,m){if(m===1||c.itemProp!=null)return!1;switch(o){case"meta":case"title":return!0;case"style":if(typeof c.precedence!="string"||typeof c.href!="string"||c.href==="")break;return!0;case"link":if(typeof c.rel!="string"||typeof c.href!="string"||c.href===""||c.onLoad||c.onError)break;switch(c.rel){case"stylesheet":return o=c.disabled,typeof c.precedence=="string"&&o==null;default:return!0}case"script":if(c.async&&typeof c.async!="function"&&typeof c.async!="symbol"&&!c.onLoad&&!c.onError&&c.src&&typeof c.src=="string")return!0}return!1}function y5(o){return!(o.type==="stylesheet"&&(o.state.loading&3)===0)}function fF(o,c,m,b){if(m.type==="stylesheet"&&(typeof b.media!="string"||matchMedia(b.media).matches!==!1)&&(m.state.loading&4)===0){if(m.instance===null){var D=id(b.href),P=c.querySelector(Gp(D));if(P){c=P._p,c!==null&&typeof c=="object"&&typeof c.then=="function"&&(o.count++,o=u2.bind(o),c.then(o,o)),m.state.loading|=4,m.instance=P,Oe(P);return}P=c.ownerDocument||c,b=m5(b),(D=Go.get(D))&&Fb(b,D),P=P.createElement("link"),Oe(P);var $=P;$._p=new Promise(function(re,xe){$.onload=re,$.onerror=xe}),Us(P,"link",b),m.instance=P}o.stylesheets===null&&(o.stylesheets=new Map),o.stylesheets.set(m,c),(c=m.state.preload)&&(m.state.loading&3)===0&&(o.count++,m=u2.bind(o),c.addEventListener("load",m),c.addEventListener("error",m))}}var zb=0;function AF(o,c){return o.stylesheets&&o.count===0&&h2(o,o.stylesheets),0zb?50:800)+c);return o.unsuspend=m,function(){o.unsuspend=null,clearTimeout(b),clearTimeout(D)}}:null}function u2(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)h2(this,this.stylesheets);else if(this.unsuspend){var o=this.unsuspend;this.unsuspend=null,o()}}}var c2=null;function h2(o,c){o.stylesheets=null,o.unsuspend!==null&&(o.count++,c2=new Map,c.forEach(dF,o),c2=null,u2.call(o))}function dF(o,c){if(!(c.state.loading&4)){var m=c2.get(o);if(m)var b=m.get(null);else{m=new Map,c2.set(o,m);for(var D=o.querySelectorAll("link[data-precedence],style[data-precedence]"),P=0;P"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(i)}catch(e){console.error(e)}}return i(),Xb.exports=NF(),Xb.exports}var PF=DF(),Ie=vw();const LF=b7(Ie);/** +`+b.stack}}var en=Object.prototype.hasOwnProperty,St=i.unstable_scheduleCallback,fe=i.unstable_cancelCallback,Y=i.unstable_shouldYield,Ce=i.unstable_requestPaint,$e=i.unstable_now,it=i.unstable_getCurrentPriorityLevel,tt=i.unstable_ImmediatePriority,Vt=i.unstable_UserBlockingPriority,Bt=i.unstable_NormalPriority,Wt=i.unstable_LowPriority,ln=i.unstable_IdlePriority,Tt=i.log,Kt=i.unstable_setDisableYieldValue,rn=null,Ht=null;function Ft(o){if(typeof Tt=="function"&&Kt(o),Ht&&typeof Ht.setStrictMode=="function")try{Ht.setStrictMode(rn,o)}catch{}}var Gt=Math.clz32?Math.clz32:me,In=Math.log,Mi=Math.LN2;function me(o){return o>>>=0,o===0?32:31-(In(o)/Mi|0)|0}var jt=256,rt=262144,yt=4194304;function $t(o){var c=o&42;if(c!==0)return c;switch(o&-o){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:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return o&261888;case 262144:case 524288:case 1048576:case 2097152:return o&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return o&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return o}}function kt(o,c,m){var b=o.pendingLanes;if(b===0)return 0;var D=0,P=o.suspendedLanes,$=o.pingedLanes;o=o.warmLanes;var re=b&134217727;return re!==0?(b=re&~P,b!==0?D=$t(b):($&=re,$!==0?D=$t($):m||(m=re&~o,m!==0&&(D=$t(m))))):(re=b&~P,re!==0?D=$t(re):$!==0?D=$t($):m||(m=b&~o,m!==0&&(D=$t(m)))),D===0?0:c!==0&&c!==D&&(c&P)===0&&(P=D&-D,m=c&-c,P>=m||P===32&&(m&4194048)!==0)?c:D}function xn(o,c){return(o.pendingLanes&~(o.suspendedLanes&~o.pingedLanes)&c)===0}function qi(o,c){switch(o){case 1:case 2:case 4:case 8:case 64:return c+250;case 16:case 32: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 c+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function rr(){var o=yt;return yt<<=1,(yt&62914560)===0&&(yt=4194304),o}function pn(o){for(var c=[],m=0;31>m;m++)c.push(o);return c}function $i(o,c){o.pendingLanes|=c,c!==268435456&&(o.suspendedLanes=0,o.pingedLanes=0,o.warmLanes=0)}function Jr(o,c,m,b,D,P){var $=o.pendingLanes;o.pendingLanes=m,o.suspendedLanes=0,o.pingedLanes=0,o.warmLanes=0,o.expiredLanes&=m,o.entangledLanes&=m,o.errorRecoveryDisabledLanes&=m,o.shellSuspendCounter=0;var re=o.entanglements,xe=o.expirationTimes,Je=o.hiddenUpdates;for(m=$&~m;0"u")return null;try{return o.activeElement||o.body}catch{return o.body}}var ve=/[\n"\\]/g;function ot(o){return o.replace(ve,function(c){return"\\"+c.charCodeAt(0).toString(16)+" "})}function Rt(o,c,m,b,D,P,$,re){o.name="",$!=null&&typeof $!="function"&&typeof $!="symbol"&&typeof $!="boolean"?o.type=$:o.removeAttribute("type"),c!=null?$==="number"?(c===0&&o.value===""||o.value!=c)&&(o.value=""+Ln(c)):o.value!==""+Ln(c)&&(o.value=""+Ln(c)):$!=="submit"&&$!=="reset"||o.removeAttribute("value"),c!=null?cn(o,$,Ln(c)):m!=null?cn(o,$,Ln(m)):b!=null&&o.removeAttribute("value"),D==null&&P!=null&&(o.defaultChecked=!!P),D!=null&&(o.checked=D&&typeof D!="function"&&typeof D!="symbol"),re!=null&&typeof re!="function"&&typeof re!="symbol"&&typeof re!="boolean"?o.name=""+Ln(re):o.removeAttribute("name")}function Zt(o,c,m,b,D,P,$,re){if(P!=null&&typeof P!="function"&&typeof P!="symbol"&&typeof P!="boolean"&&(o.type=P),c!=null||m!=null){if(!(P!=="submit"&&P!=="reset"||c!=null)){hi(o);return}m=m!=null?""+Ln(m):"",c=c!=null?""+Ln(c):m,re||c===o.value||(o.value=c),o.defaultValue=c}b=b??D,b=typeof b!="function"&&typeof b!="symbol"&&!!b,o.checked=re?o.checked:!!b,o.defaultChecked=!!b,$!=null&&typeof $!="function"&&typeof $!="symbol"&&typeof $!="boolean"&&(o.name=$),hi(o)}function cn(o,c,m){c==="number"&&fa(o.ownerDocument)===o||o.defaultValue===""+m||(o.defaultValue=""+m)}function Yn(o,c,m,b){if(o=o.options,c){c={};for(var D=0;D"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),TA=!1;if(il)try{var tf={};Object.defineProperty(tf,"passive",{get:function(){TA=!0}}),window.addEventListener("test",tf,tf),window.removeEventListener("test",tf,tf)}catch{TA=!1}var Lo=null,nf=null,wA=null;function np(){if(wA)return wA;var o,c=nf,m=c.length,b,D="value"in Lo?Lo.value:Lo.textContent,P=D.length;for(o=0;o=of),Ou=" ",m1=!1;function RA(o,c){switch(o){case"keyup":return xx.indexOf(c.keyCode)!==-1;case"keydown":return c.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function op(o){return o=o.detail,typeof o=="object"&&"data"in o?o.data:null}var Qc=!1;function g1(o,c){switch(o){case"compositionend":return op(c);case"keypress":return c.which!==32?null:(m1=!0,Ou);case"textInput":return o=c.data,o===Ou&&m1?null:o;default:return null}}function bx(o,c){if(Qc)return o==="compositionend"||!Bu&&RA(o,c)?(o=np(),wA=nf=Lo=null,Qc=!1,o):null;switch(o){case"paste":return null;case"keypress":if(!(c.ctrlKey||c.altKey||c.metaKey)||c.ctrlKey&&c.altKey){if(c.char&&1=c)return{node:m,offset:c-o};o=b}e:{for(;m;){if(m.nextSibling){m=m.nextSibling;break e}m=m.parentNode}m=void 0}m=PA(m)}}function zu(o,c){return o&&c?o===c?!0:o&&o.nodeType===3?!1:c&&c.nodeType===3?zu(o,c.parentNode):"contains"in o?o.contains(c):o.compareDocumentPosition?!!(o.compareDocumentPosition(c)&16):!1:!1}function Ol(o){o=o!=null&&o.ownerDocument!=null&&o.ownerDocument.defaultView!=null?o.ownerDocument.defaultView:window;for(var c=fa(o.document);c instanceof o.HTMLIFrameElement;){try{var m=typeof c.contentWindow.location.href=="string"}catch{m=!1}if(m)o=c.contentWindow;else break;c=fa(o.document)}return c}function Il(o){var c=o&&o.nodeName&&o.nodeName.toLowerCase();return c&&(c==="input"&&(o.type==="text"||o.type==="search"||o.type==="tel"||o.type==="url"||o.type==="password")||c==="textarea"||o.contentEditable==="true")}var wx=il&&"documentMode"in document&&11>=document.documentMode,Gu=null,fp=null,qu=null,Ap=!1;function S1(o,c,m){var b=m.window===m?m.document:m.nodeType===9?m:m.ownerDocument;Ap||Gu==null||Gu!==fa(b)||(b=Gu,"selectionStart"in b&&Il(b)?b={start:b.selectionStart,end:b.selectionEnd}:(b=(b.ownerDocument&&b.ownerDocument.defaultView||window).getSelection(),b={anchorNode:b.anchorNode,anchorOffset:b.anchorOffset,focusNode:b.focusNode,focusOffset:b.focusOffset}),qu&&Ss(qu,b)||(qu=b,b=r2(fp,"onSelect"),0>=$,D-=$,Na=1<<32-Gt(c)+D|m<oi?(bi=hn,hn=null):bi=hn.sibling;var Pi=et(Ve,hn,Ke[oi],vt);if(Pi===null){hn===null&&(hn=bi);break}o&&hn&&Pi.alternate===null&&c(Ve,hn),Pe=P(Pi,Pe,oi),Di===null?Sn=Pi:Di.sibling=Pi,Di=Pi,hn=bi}if(oi===Ke.length)return m(Ve,hn),mi&&Oo(Ve,oi),Sn;if(hn===null){for(;oioi?(bi=hn,hn=null):bi=hn.sibling;var dh=et(Ve,hn,Pi.value,vt);if(dh===null){hn===null&&(hn=bi);break}o&&hn&&dh.alternate===null&&c(Ve,hn),Pe=P(dh,Pe,oi),Di===null?Sn=dh:Di.sibling=dh,Di=dh,hn=bi}if(Pi.done)return m(Ve,hn),mi&&Oo(Ve,oi),Sn;if(hn===null){for(;!Pi.done;oi++,Pi=Ke.next())Pi=bt(Ve,Pi.value,vt),Pi!==null&&(Pe=P(Pi,Pe,oi),Di===null?Sn=Pi:Di.sibling=Pi,Di=Pi);return mi&&Oo(Ve,oi),Sn}for(hn=b(hn);!Pi.done;oi++,Pi=Ke.next())Pi=nt(hn,Ve,oi,Pi.value,vt),Pi!==null&&(o&&Pi.alternate!==null&&hn.delete(Pi.key===null?oi:Pi.key),Pe=P(Pi,Pe,oi),Di===null?Sn=Pi:Di.sibling=Pi,Di=Pi);return o&&hn.forEach(function(bF){return c(Ve,bF)}),mi&&Oo(Ve,oi),Sn}function er(Ve,Pe,Ke,vt){if(typeof Ke=="object"&&Ke!==null&&Ke.type===R&&Ke.key===null&&(Ke=Ke.props.children),typeof Ke=="object"&&Ke!==null){switch(Ke.$$typeof){case S:e:{for(var Sn=Ke.key;Pe!==null;){if(Pe.key===Sn){if(Sn=Ke.type,Sn===R){if(Pe.tag===7){m(Ve,Pe.sibling),vt=D(Pe,Ke.props.children),vt.return=Ve,Ve=vt;break e}}else if(Pe.elementType===Sn||typeof Sn=="object"&&Sn!==null&&Sn.$$typeof===H&&f(Sn)===Pe.type){m(Ve,Pe.sibling),vt=D(Pe,Ke.props),U(vt,Ke),vt.return=Ve,Ve=vt;break e}m(Ve,Pe);break}else c(Ve,Pe);Pe=Pe.sibling}Ke.type===R?(vt=$u(Ke.props.children,Ve.mode,vt,Ke.key),vt.return=Ve,Ve=vt):(vt=IA(Ke.type,Ke.key,Ke.props,null,Ve.mode,vt),U(vt,Ke),vt.return=Ve,Ve=vt)}return $(Ve);case w:e:{for(Sn=Ke.key;Pe!==null;){if(Pe.key===Sn)if(Pe.tag===4&&Pe.stateNode.containerInfo===Ke.containerInfo&&Pe.stateNode.implementation===Ke.implementation){m(Ve,Pe.sibling),vt=D(Pe,Ke.children||[]),vt.return=Ve,Ve=vt;break e}else{m(Ve,Pe);break}else c(Ve,Pe);Pe=Pe.sibling}vt=Bo(Ke,Ve.mode,vt),vt.return=Ve,Ve=vt}return $(Ve);case H:return Ke=f(Ke),er(Ve,Pe,Ke,vt)}if(ne(Ke))return on(Ve,Pe,Ke,vt);if(J(Ke)){if(Sn=J(Ke),typeof Sn!="function")throw Error(n(150));return Ke=Sn.call(Ke),Dn(Ve,Pe,Ke,vt)}if(typeof Ke.then=="function")return er(Ve,Pe,N(Ke),vt);if(Ke.$$typeof===L)return er(Ve,Pe,HA(Ve,Ke),vt);I(Ve,Ke)}return typeof Ke=="string"&&Ke!==""||typeof Ke=="number"||typeof Ke=="bigint"?(Ke=""+Ke,Pe!==null&&Pe.tag===6?(m(Ve,Pe.sibling),vt=D(Pe,Ke),vt.return=Ve,Ve=vt):(m(Ve,Pe),vt=vp(Ke,Ve.mode,vt),vt.return=Ve,Ve=vt),$(Ve)):m(Ve,Pe)}return function(Ve,Pe,Ke,vt){try{M=0;var Sn=er(Ve,Pe,Ke,vt);return T=null,Sn}catch(hn){if(hn===hl||hn===uo)throw hn;var Di=Ys(29,hn,null,Ve.mode);return Di.lanes=vt,Di.return=Ve,Di}finally{}}}var ie=q(!0),de=q(!1),Ae=!1;function pe(o){o.updateQueue={baseState:o.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Me(o,c){o=o.updateQueue,c.updateQueue===o&&(c.updateQueue={baseState:o.baseState,firstBaseUpdate:o.firstBaseUpdate,lastBaseUpdate:o.lastBaseUpdate,shared:o.shared,callbacks:null})}function Le(o){return{lane:o,tag:0,payload:null,callback:null,next:null}}function Ye(o,c,m){var b=o.updateQueue;if(b===null)return null;if(b=b.shared,(Oi&2)!==0){var D=b.pending;return D===null?c.next=c:(c.next=D.next,D.next=c),b.pending=c,c=OA(o),M1(o,null,m),c}return BA(o,b,c,m),OA(o)}function qe(o,c,m){if(c=c.updateQueue,c!==null&&(c=c.shared,(m&4194048)!==0)){var b=c.lanes;b&=o.pendingLanes,m|=b,c.lanes=m,mt(o,m)}}function Fe(o,c){var m=o.updateQueue,b=o.alternate;if(b!==null&&(b=b.updateQueue,m===b)){var D=null,P=null;if(m=m.firstBaseUpdate,m!==null){do{var $={lane:m.lane,tag:m.tag,payload:m.payload,callback:null,next:null};P===null?D=P=$:P=P.next=$,m=m.next}while(m!==null);P===null?D=P=c:P=P.next=c}else D=P=c;m={baseState:b.baseState,firstBaseUpdate:D,lastBaseUpdate:P,shared:b.shared,callbacks:b.callbacks},o.updateQueue=m;return}o=m.lastBaseUpdate,o===null?m.firstBaseUpdate=c:o.next=c,m.lastBaseUpdate=c}var Ee=!1;function Pt(){if(Ee){var o=fr;if(o!==null)throw o}}function nn(o,c,m,b){Ee=!1;var D=o.updateQueue;Ae=!1;var P=D.firstBaseUpdate,$=D.lastBaseUpdate,re=D.shared.pending;if(re!==null){D.shared.pending=null;var xe=re,Je=xe.next;xe.next=null,$===null?P=Je:$.next=Je,$=xe;var ft=o.alternate;ft!==null&&(ft=ft.updateQueue,re=ft.lastBaseUpdate,re!==$&&(re===null?ft.firstBaseUpdate=Je:re.next=Je,ft.lastBaseUpdate=xe))}if(P!==null){var bt=D.baseState;$=0,ft=Je=xe=null,re=P;do{var et=re.lane&-536870913,nt=et!==re.lane;if(nt?(xi&et)===et:(b&et)===et){et!==0&&et===eh&&(Ee=!0),ft!==null&&(ft=ft.next={lane:0,tag:re.tag,payload:re.payload,callback:null,next:null});e:{var on=o,Dn=re;et=c;var er=m;switch(Dn.tag){case 1:if(on=Dn.payload,typeof on=="function"){bt=on.call(er,bt,et);break e}bt=on;break e;case 3:on.flags=on.flags&-65537|128;case 0:if(on=Dn.payload,et=typeof on=="function"?on.call(er,bt,et):on,et==null)break e;bt=v({},bt,et);break e;case 2:Ae=!0}}et=re.callback,et!==null&&(o.flags|=64,nt&&(o.flags|=8192),nt=D.callbacks,nt===null?D.callbacks=[et]:nt.push(et))}else nt={lane:et,tag:re.tag,payload:re.payload,callback:re.callback,next:null},ft===null?(Je=ft=nt,xe=bt):ft=ft.next=nt,$|=et;if(re=re.next,re===null){if(re=D.shared.pending,re===null)break;nt=re,re=nt.next,nt.next=null,D.lastBaseUpdate=nt,D.shared.pending=null}}while(!0);ft===null&&(xe=bt),D.baseState=xe,D.firstBaseUpdate=Je,D.lastBaseUpdate=ft,P===null&&(D.shared.lanes=0),rh|=$,o.lanes=$,o.memoizedState=bt}}function Jt(o,c){if(typeof o!="function")throw Error(n(191,o));o.call(c)}function Un(o,c){var m=o.callbacks;if(m!==null)for(o.callbacks=null,o=0;oP?P:8;var $=Z.T,re={};Z.T=re,jx(o,!1,c,m);try{var xe=D(),Je=Z.S;if(Je!==null&&Je(re,xe),xe!==null&&typeof xe=="object"&&typeof xe.then=="function"){var ft=N1(xe,b);Mp(o,c,ft,Ao(o))}else Mp(o,c,b,Ao(o))}catch(bt){Mp(o,c,{then:function(){},status:"rejected",reason:bt},Ao())}finally{ue.p=P,$!==null&&re.types!==null&&($.types=re.types),Z.T=$}}function gI(){}function Vx(o,c,m,b){if(o.tag!==5)throw Error(n(476));var D=R4(o).queue;C4(o,D,c,he,m===null?gI:function(){return N4(o),m(b)})}function R4(o){var c=o.memoizedState;if(c!==null)return c;c={memoizedState:he,baseState:he,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:nc,lastRenderedState:he},next:null};var m={};return c.next={memoizedState:m,baseState:m,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:nc,lastRenderedState:m},next:null},o.memoizedState=c,o=o.alternate,o!==null&&(o.memoizedState=c),c}function N4(o){var c=R4(o);c.next===null&&(c=o.alternate.memoizedState),Mp(o,c.next.queue,{},Ao())}function Hx(){return As(Vp)}function D4(){return jr().memoizedState}function P4(){return jr().memoizedState}function vI(o){for(var c=o.return;c!==null;){switch(c.tag){case 24:case 3:var m=Ao();o=Le(m);var b=Ye(c,o,m);b!==null&&(Ia(b,c,m),qe(b,c,m)),c={cache:Ur()},o.payload=c;return}c=c.return}}function _I(o,c,m){var b=Ao();m={lane:b,revertLane:0,gesture:null,action:m,hasEagerState:!1,eagerState:null,next:null},k1(o)?U4(c,m):(m=gp(o,c,m,b),m!==null&&(Ia(m,o,b),B4(m,c,b)))}function L4(o,c,m){var b=Ao();Mp(o,c,m,b)}function Mp(o,c,m,b){var D={lane:b,revertLane:0,gesture:null,action:m,hasEagerState:!1,eagerState:null,next:null};if(k1(o))U4(c,D);else{var P=o.alternate;if(o.lanes===0&&(P===null||P.lanes===0)&&(P=c.lastRenderedReducer,P!==null))try{var $=c.lastRenderedState,re=P($,m);if(D.hasEagerState=!0,D.eagerState=re,Aa(re,$))return BA(o,c,D,0),or===null&&UA(),!1}catch{}finally{}if(m=gp(o,c,D,b),m!==null)return Ia(m,o,b),B4(m,c,b),!0}return!1}function jx(o,c,m,b){if(b={lane:2,revertLane:Sb(),gesture:null,action:b,hasEagerState:!1,eagerState:null,next:null},k1(o)){if(c)throw Error(n(479))}else c=gp(o,m,b,2),c!==null&&Ia(c,o,2)}function k1(o){var c=o.alternate;return o===ri||c!==null&&c===ri}function U4(o,c){jA=P1=!0;var m=o.pending;m===null?c.next=c:(c.next=m.next,m.next=c),o.pending=c}function B4(o,c,m){if((m&4194048)!==0){var b=c.lanes;b&=o.pendingLanes,m|=b,c.lanes=m,mt(o,m)}}var Ep={readContext:As,use:B1,useCallback:Br,useContext:Br,useEffect:Br,useImperativeHandle:Br,useLayoutEffect:Br,useInsertionEffect:Br,useMemo:Br,useReducer:Br,useRef:Br,useState:Br,useDebugValue:Br,useDeferredValue:Br,useTransition:Br,useSyncExternalStore:Br,useId:Br,useHostTransitionStatus:Br,useFormState:Br,useActionState:Br,useOptimistic:Br,useMemoCache:Br,useCacheRefresh:Br};Ep.useEffectEvent=Br;var O4={readContext:As,use:B1,useCallback:function(o,c){return ma().memoizedState=[o,c===void 0?null:c],o},useContext:As,useEffect:_4,useImperativeHandle:function(o,c,m){m=m!=null?m.concat([o]):null,I1(4194308,4,S4.bind(null,c,o),m)},useLayoutEffect:function(o,c){return I1(4194308,4,o,c)},useInsertionEffect:function(o,c){I1(4,2,o,c)},useMemo:function(o,c){var m=ma();c=c===void 0?null:c;var b=o();if(mf){Ft(!0);try{o()}finally{Ft(!1)}}return m.memoizedState=[b,c],b},useReducer:function(o,c,m){var b=ma();if(m!==void 0){var D=m(c);if(mf){Ft(!0);try{m(c)}finally{Ft(!1)}}}else D=c;return b.memoizedState=b.baseState=D,o={pending:null,lanes:0,dispatch:null,lastRenderedReducer:o,lastRenderedState:D},b.queue=o,o=o.dispatch=_I.bind(null,ri,o),[b.memoizedState,o]},useRef:function(o){var c=ma();return o={current:o},c.memoizedState=o},useState:function(o){o=Fx(o);var c=o.queue,m=L4.bind(null,ri,c);return c.dispatch=m,[o.memoizedState,m]},useDebugValue:Gx,useDeferredValue:function(o,c){var m=ma();return qx(m,o,c)},useTransition:function(){var o=Fx(!1);return o=C4.bind(null,ri,o.queue,!0,!1),ma().memoizedState=o,[!1,o]},useSyncExternalStore:function(o,c,m){var b=ri,D=ma();if(mi){if(m===void 0)throw Error(n(407));m=m()}else{if(m=c(),or===null)throw Error(n(349));(xi&127)!==0||i4(b,c,m)}D.memoizedState=m;var P={value:m,getSnapshot:c};return D.queue=P,_4(s4.bind(null,b,P,o),[o]),b.flags|=2048,$A(9,{destroy:void 0},r4.bind(null,b,P,m,c),null),m},useId:function(){var o=ma(),c=or.identifierPrefix;if(mi){var m=Da,b=Na;m=(b&~(1<<32-Gt(b)-1)).toString(32)+m,c="_"+c+"R_"+m,m=L1++,0<\/script>",P=P.removeChild(P.firstChild);break;case"select":P=typeof b.is=="string"?$.createElement("select",{is:b.is}):$.createElement("select"),b.multiple?P.multiple=!0:b.size&&(P.size=b.size);break;default:P=typeof b.is=="string"?$.createElement(D,{is:b.is}):$.createElement(D)}}P[Xn]=c,P[un]=b;e:for($=c.child;$!==null;){if($.tag===5||$.tag===6)P.appendChild($.stateNode);else if($.tag!==4&&$.tag!==27&&$.child!==null){$.child.return=$,$=$.child;continue}if($===c)break e;for(;$.sibling===null;){if($.return===null||$.return===c)break e;$=$.return}$.sibling.return=$.return,$=$.sibling}c.stateNode=P;e:switch(Us(P,D,b),D){case"button":case"input":case"select":case"textarea":b=!!b.autoFocus;break e;case"img":b=!0;break e;default:b=!1}b&&rc(c)}}return Ar(c),sb(c,c.type,o===null?null:o.memoizedProps,c.pendingProps,m),null;case 6:if(o&&c.stateNode!=null)o.memoizedProps!==b&&rc(c);else{if(typeof b!="string"&&c.stateNode===null)throw Error(n(166));if(o=_e.current,ar(c)){if(o=c.stateNode,m=c.memoizedProps,b=null,D=fs,D!==null)switch(D.tag){case 27:case 5:b=D.memoizedProps}o[Xn]=c,o=!!(o.nodeValue===m||b!==null&&b.suppressHydrationWarning===!0||t5(o.nodeValue,m)),o||zl(c,!0)}else o=s2(o).createTextNode(b),o[Xn]=c,c.stateNode=o}return Ar(c),null;case 31:if(m=c.memoizedState,o===null||o.memoizedState!==null){if(b=ar(c),m!==null){if(o===null){if(!b)throw Error(n(318));if(o=c.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(n(557));o[Xn]=c}else Yu(),(c.flags&128)===0&&(c.memoizedState=null),c.flags|=4;Ar(c),o=!1}else m=Sp(),o!==null&&o.memoizedState!==null&&(o.memoizedState.hydrationErrors=m),o=!0;if(!o)return c.flags&256?(co(c),c):(co(c),null);if((c.flags&128)!==0)throw Error(n(558))}return Ar(c),null;case 13:if(b=c.memoizedState,o===null||o.memoizedState!==null&&o.memoizedState.dehydrated!==null){if(D=ar(c),b!==null&&b.dehydrated!==null){if(o===null){if(!D)throw Error(n(318));if(D=c.memoizedState,D=D!==null?D.dehydrated:null,!D)throw Error(n(317));D[Xn]=c}else Yu(),(c.flags&128)===0&&(c.memoizedState=null),c.flags|=4;Ar(c),D=!1}else D=Sp(),o!==null&&o.memoizedState!==null&&(o.memoizedState.hydrationErrors=D),D=!0;if(!D)return c.flags&256?(co(c),c):(co(c),null)}return co(c),(c.flags&128)!==0?(c.lanes=m,c):(m=b!==null,o=o!==null&&o.memoizedState!==null,m&&(b=c.child,D=null,b.alternate!==null&&b.alternate.memoizedState!==null&&b.alternate.memoizedState.cachePool!==null&&(D=b.alternate.memoizedState.cachePool.pool),P=null,b.memoizedState!==null&&b.memoizedState.cachePool!==null&&(P=b.memoizedState.cachePool.pool),P!==D&&(b.flags|=2048)),m!==o&&m&&(c.child.flags|=8192),H1(c,c.updateQueue),Ar(c),null);case 4:return _t(),o===null&&Eb(c.stateNode.containerInfo),Ar(c),null;case 10:return Io(c.type),Ar(c),null;case 19:if(we(Hr),b=c.memoizedState,b===null)return Ar(c),null;if(D=(c.flags&128)!==0,P=b.rendering,P===null)if(D)Rp(b,!1);else{if(Or!==0||o!==null&&(o.flags&128)!==0)for(o=c.child;o!==null;){if(P=D1(o),P!==null){for(c.flags|=128,Rp(b,!1),o=P.updateQueue,c.updateQueue=o,H1(c,o),c.subtreeFlags=0,o=m,m=c.child;m!==null;)E1(m,o),m=m.sibling;return We(Hr,Hr.current&1|2),mi&&Oo(c,b.treeForkCount),c.child}o=o.sibling}b.tail!==null&&$e()>Y1&&(c.flags|=128,D=!0,Rp(b,!1),c.lanes=4194304)}else{if(!D)if(o=D1(P),o!==null){if(c.flags|=128,D=!0,o=o.updateQueue,c.updateQueue=o,H1(c,o),Rp(b,!0),b.tail===null&&b.tailMode==="hidden"&&!P.alternate&&!mi)return Ar(c),null}else 2*$e()-b.renderingStartTime>Y1&&m!==536870912&&(c.flags|=128,D=!0,Rp(b,!1),c.lanes=4194304);b.isBackwards?(P.sibling=c.child,c.child=P):(o=b.last,o!==null?o.sibling=P:c.child=P,b.last=P)}return b.tail!==null?(o=b.tail,b.rendering=o,b.tail=o.sibling,b.renderingStartTime=$e(),o.sibling=null,m=Hr.current,We(Hr,D?m&1|2:m&1),mi&&Oo(c,b.treeForkCount),o):(Ar(c),null);case 22:case 23:return co(c),Lt(),b=c.memoizedState!==null,o!==null?o.memoizedState!==null!==b&&(c.flags|=8192):b&&(c.flags|=8192),b?(m&536870912)!==0&&(c.flags&128)===0&&(Ar(c),c.subtreeFlags&6&&(c.flags|=8192)):Ar(c),m=c.updateQueue,m!==null&&H1(c,m.retryQueue),m=null,o!==null&&o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(m=o.memoizedState.cachePool.pool),b=null,c.memoizedState!==null&&c.memoizedState.cachePool!==null&&(b=c.memoizedState.cachePool.pool),b!==m&&(c.flags|=2048),o!==null&&we(Nt),null;case 24:return m=null,o!==null&&(m=o.memoizedState.cache),c.memoizedState.cache!==m&&(c.flags|=2048),Io(Xt),Ar(c),null;case 25:return null;case 30:return null}throw Error(n(156,c.tag))}function TI(o,c){switch(_p(c),c.tag){case 1:return o=c.flags,o&65536?(c.flags=o&-65537|128,c):null;case 3:return Io(Xt),_t(),o=c.flags,(o&65536)!==0&&(o&128)===0?(c.flags=o&-65537|128,c):null;case 26:case 27:case 5:return Ge(c),null;case 31:if(c.memoizedState!==null){if(co(c),c.alternate===null)throw Error(n(340));Yu()}return o=c.flags,o&65536?(c.flags=o&-65537|128,c):null;case 13:if(co(c),o=c.memoizedState,o!==null&&o.dehydrated!==null){if(c.alternate===null)throw Error(n(340));Yu()}return o=c.flags,o&65536?(c.flags=o&-65537|128,c):null;case 19:return we(Hr),null;case 4:return _t(),null;case 10:return Io(c.type),null;case 22:case 23:return co(c),Lt(),o!==null&&we(Nt),o=c.flags,o&65536?(c.flags=o&-65537|128,c):null;case 24:return Io(Xt),null;case 25:return null;default:return null}}function a8(o,c){switch(_p(c),c.tag){case 3:Io(Xt),_t();break;case 26:case 27:case 5:Ge(c);break;case 4:_t();break;case 31:c.memoizedState!==null&&co(c);break;case 13:co(c);break;case 19:we(Hr);break;case 10:Io(c.type);break;case 22:case 23:co(c),Lt(),o!==null&&we(Nt);break;case 24:Io(Xt)}}function Np(o,c){try{var m=c.updateQueue,b=m!==null?m.lastEffect:null;if(b!==null){var D=b.next;m=D;do{if((m.tag&o)===o){b=void 0;var P=m.create,$=m.inst;b=P(),$.destroy=b}m=m.next}while(m!==D)}}catch(re){Yi(c,c.return,re)}}function nh(o,c,m){try{var b=c.updateQueue,D=b!==null?b.lastEffect:null;if(D!==null){var P=D.next;b=P;do{if((b.tag&o)===o){var $=b.inst,re=$.destroy;if(re!==void 0){$.destroy=void 0,D=c;var xe=m,Je=re;try{Je()}catch(ft){Yi(D,xe,ft)}}}b=b.next}while(b!==P)}}catch(ft){Yi(c,c.return,ft)}}function o8(o){var c=o.updateQueue;if(c!==null){var m=o.stateNode;try{Un(c,m)}catch(b){Yi(o,o.return,b)}}}function l8(o,c,m){m.props=gf(o.type,o.memoizedProps),m.state=o.memoizedState;try{m.componentWillUnmount()}catch(b){Yi(o,c,b)}}function Dp(o,c){try{var m=o.ref;if(m!==null){switch(o.tag){case 26:case 27:case 5:var b=o.stateNode;break;case 30:b=o.stateNode;break;default:b=o.stateNode}typeof m=="function"?o.refCleanup=m(b):m.current=b}}catch(D){Yi(o,c,D)}}function ql(o,c){var m=o.ref,b=o.refCleanup;if(m!==null)if(typeof b=="function")try{b()}catch(D){Yi(o,c,D)}finally{o.refCleanup=null,o=o.alternate,o!=null&&(o.refCleanup=null)}else if(typeof m=="function")try{m(null)}catch(D){Yi(o,c,D)}else m.current=null}function u8(o){var c=o.type,m=o.memoizedProps,b=o.stateNode;try{e:switch(c){case"button":case"input":case"select":case"textarea":m.autoFocus&&b.focus();break e;case"img":m.src?b.src=m.src:m.srcSet&&(b.srcset=m.srcSet)}}catch(D){Yi(o,o.return,D)}}function ab(o,c,m){try{var b=o.stateNode;WI(b,o.type,m,c),b[un]=c}catch(D){Yi(o,o.return,D)}}function c8(o){return o.tag===5||o.tag===3||o.tag===26||o.tag===27&&uh(o.type)||o.tag===4}function ob(o){e:for(;;){for(;o.sibling===null;){if(o.return===null||c8(o.return))return null;o=o.return}for(o.sibling.return=o.return,o=o.sibling;o.tag!==5&&o.tag!==6&&o.tag!==18;){if(o.tag===27&&uh(o.type)||o.flags&2||o.child===null||o.tag===4)continue e;o.child.return=o,o=o.child}if(!(o.flags&2))return o.stateNode}}function lb(o,c,m){var b=o.tag;if(b===5||b===6)o=o.stateNode,c?(m.nodeType===9?m.body:m.nodeName==="HTML"?m.ownerDocument.body:m).insertBefore(o,c):(c=m.nodeType===9?m.body:m.nodeName==="HTML"?m.ownerDocument.body:m,c.appendChild(o),m=m._reactRootContainer,m!=null||c.onclick!==null||(c.onclick=Po));else if(b!==4&&(b===27&&uh(o.type)&&(m=o.stateNode,c=null),o=o.child,o!==null))for(lb(o,c,m),o=o.sibling;o!==null;)lb(o,c,m),o=o.sibling}function j1(o,c,m){var b=o.tag;if(b===5||b===6)o=o.stateNode,c?m.insertBefore(o,c):m.appendChild(o);else if(b!==4&&(b===27&&uh(o.type)&&(m=o.stateNode),o=o.child,o!==null))for(j1(o,c,m),o=o.sibling;o!==null;)j1(o,c,m),o=o.sibling}function h8(o){var c=o.stateNode,m=o.memoizedProps;try{for(var b=o.type,D=c.attributes;D.length;)c.removeAttributeNode(D[0]);Us(c,b,m),c[Xn]=o,c[un]=m}catch(P){Yi(o,o.return,P)}}var sc=!1,ns=!1,ub=!1,f8=typeof WeakSet=="function"?WeakSet:Set,Ms=null;function wI(o,c){if(o=o.containerInfo,Nb=f2,o=Ol(o),Il(o)){if("selectionStart"in o)var m={start:o.selectionStart,end:o.selectionEnd};else e:{m=(m=o.ownerDocument)&&m.defaultView||window;var b=m.getSelection&&m.getSelection();if(b&&b.rangeCount!==0){m=b.anchorNode;var D=b.anchorOffset,P=b.focusNode;b=b.focusOffset;try{m.nodeType,P.nodeType}catch{m=null;break e}var $=0,re=-1,xe=-1,Je=0,ft=0,bt=o,et=null;t:for(;;){for(var nt;bt!==m||D!==0&&bt.nodeType!==3||(re=$+D),bt!==P||b!==0&&bt.nodeType!==3||(xe=$+b),bt.nodeType===3&&($+=bt.nodeValue.length),(nt=bt.firstChild)!==null;)et=bt,bt=nt;for(;;){if(bt===o)break t;if(et===m&&++Je===D&&(re=$),et===P&&++ft===b&&(xe=$),(nt=bt.nextSibling)!==null)break;bt=et,et=bt.parentNode}bt=nt}m=re===-1||xe===-1?null:{start:re,end:xe}}else m=null}m=m||{start:0,end:0}}else m=null;for(Db={focusedElem:o,selectionRange:m},f2=!1,Ms=c;Ms!==null;)if(c=Ms,o=c.child,(c.subtreeFlags&1028)!==0&&o!==null)o.return=c,Ms=o;else for(;Ms!==null;){switch(c=Ms,P=c.alternate,o=c.flags,c.tag){case 0:if((o&4)!==0&&(o=c.updateQueue,o=o!==null?o.events:null,o!==null))for(m=0;m title"))),Us(P,b,m),P[Xn]=o,Oe(P),b=P;break e;case"link":var $=v5("link","href",D).get(b+(m.href||""));if($){for(var re=0;re<$.length;re++)if(P=$[re],P.getAttribute("href")===(m.href==null||m.href===""?null:m.href)&&P.getAttribute("rel")===(m.rel==null?null:m.rel)&&P.getAttribute("title")===(m.title==null?null:m.title)&&P.getAttribute("crossorigin")===(m.crossOrigin==null?null:m.crossOrigin)){$.splice(re,1);break t}}P=D.createElement(b),Us(P,b,m),D.head.appendChild(P);break;case"meta":if($=v5("meta","content",D).get(b+(m.content||""))){for(re=0;re<$.length;re++)if(P=$[re],P.getAttribute("content")===(m.content==null?null:""+m.content)&&P.getAttribute("name")===(m.name==null?null:m.name)&&P.getAttribute("property")===(m.property==null?null:m.property)&&P.getAttribute("http-equiv")===(m.httpEquiv==null?null:m.httpEquiv)&&P.getAttribute("charset")===(m.charSet==null?null:m.charSet)){$.splice(re,1);break t}}P=D.createElement(b),Us(P,b,m),D.head.appendChild(P);break;default:throw Error(n(468,b))}P[Xn]=o,Oe(P),b=P}o.stateNode=b}else _5(D,o.type,o.stateNode);else o.stateNode=g5(D,b,o.memoizedProps);else P!==b?(P===null?m.stateNode!==null&&(m=m.stateNode,m.parentNode.removeChild(m)):P.count--,b===null?_5(D,o.type,o.stateNode):g5(D,b,o.memoizedProps)):b===null&&o.stateNode!==null&&ab(o,o.memoizedProps,m.memoizedProps)}break;case 27:Ua(c,o),Ba(o),b&512&&(ns||m===null||ql(m,m.return)),m!==null&&b&4&&ab(o,o.memoizedProps,m.memoizedProps);break;case 5:if(Ua(c,o),Ba(o),b&512&&(ns||m===null||ql(m,m.return)),o.flags&32){D=o.stateNode;try{pi(D,"")}catch(on){Yi(o,o.return,on)}}b&4&&o.stateNode!=null&&(D=o.memoizedProps,ab(o,D,m!==null?m.memoizedProps:D)),b&1024&&(ub=!0);break;case 6:if(Ua(c,o),Ba(o),b&4){if(o.stateNode===null)throw Error(n(162));b=o.memoizedProps,m=o.stateNode;try{m.nodeValue=b}catch(on){Yi(o,o.return,on)}}break;case 3:if(l2=null,D=dl,dl=a2(c.containerInfo),Ua(c,o),dl=D,Ba(o),b&4&&m!==null&&m.memoizedState.isDehydrated)try{sd(c.containerInfo)}catch(on){Yi(o,o.return,on)}ub&&(ub=!1,_8(o));break;case 4:b=dl,dl=a2(o.stateNode.containerInfo),Ua(c,o),Ba(o),dl=b;break;case 12:Ua(c,o),Ba(o);break;case 31:Ua(c,o),Ba(o),b&4&&(b=o.updateQueue,b!==null&&(o.updateQueue=null,W1(o,b)));break;case 13:Ua(c,o),Ba(o),o.child.flags&8192&&o.memoizedState!==null!=(m!==null&&m.memoizedState!==null)&&(X1=$e()),b&4&&(b=o.updateQueue,b!==null&&(o.updateQueue=null,W1(o,b)));break;case 22:D=o.memoizedState!==null;var xe=m!==null&&m.memoizedState!==null,Je=sc,ft=ns;if(sc=Je||D,ns=ft||xe,Ua(c,o),ns=ft,sc=Je,Ba(o),b&8192)e:for(c=o.stateNode,c._visibility=D?c._visibility&-2:c._visibility|1,D&&(m===null||xe||sc||ns||vf(o)),m=null,c=o;;){if(c.tag===5||c.tag===26){if(m===null){xe=m=c;try{if(P=xe.stateNode,D)$=P.style,typeof $.setProperty=="function"?$.setProperty("display","none","important"):$.display="none";else{re=xe.stateNode;var bt=xe.memoizedProps.style,et=bt!=null&&bt.hasOwnProperty("display")?bt.display:null;re.style.display=et==null||typeof et=="boolean"?"":(""+et).trim()}}catch(on){Yi(xe,xe.return,on)}}}else if(c.tag===6){if(m===null){xe=c;try{xe.stateNode.nodeValue=D?"":xe.memoizedProps}catch(on){Yi(xe,xe.return,on)}}}else if(c.tag===18){if(m===null){xe=c;try{var nt=xe.stateNode;D?l5(nt,!0):l5(xe.stateNode,!1)}catch(on){Yi(xe,xe.return,on)}}}else if((c.tag!==22&&c.tag!==23||c.memoizedState===null||c===o)&&c.child!==null){c.child.return=c,c=c.child;continue}if(c===o)break e;for(;c.sibling===null;){if(c.return===null||c.return===o)break e;m===c&&(m=null),c=c.return}m===c&&(m=null),c.sibling.return=c.return,c=c.sibling}b&4&&(b=o.updateQueue,b!==null&&(m=b.retryQueue,m!==null&&(b.retryQueue=null,W1(o,m))));break;case 19:Ua(c,o),Ba(o),b&4&&(b=o.updateQueue,b!==null&&(o.updateQueue=null,W1(o,b)));break;case 30:break;case 21:break;default:Ua(c,o),Ba(o)}}function Ba(o){var c=o.flags;if(c&2){try{for(var m,b=o.return;b!==null;){if(c8(b)){m=b;break}b=b.return}if(m==null)throw Error(n(160));switch(m.tag){case 27:var D=m.stateNode,P=ob(o);j1(o,P,D);break;case 5:var $=m.stateNode;m.flags&32&&(pi($,""),m.flags&=-33);var re=ob(o);j1(o,re,$);break;case 3:case 4:var xe=m.stateNode.containerInfo,Je=ob(o);lb(o,Je,xe);break;default:throw Error(n(161))}}catch(ft){Yi(o,o.return,ft)}o.flags&=-3}c&4096&&(o.flags&=-4097)}function _8(o){if(o.subtreeFlags&1024)for(o=o.child;o!==null;){var c=o;_8(c),c.tag===5&&c.flags&1024&&c.stateNode.reset(),o=o.sibling}}function oc(o,c){if(c.subtreeFlags&8772)for(c=c.child;c!==null;)A8(o,c.alternate,c),c=c.sibling}function vf(o){for(o=o.child;o!==null;){var c=o;switch(c.tag){case 0:case 11:case 14:case 15:nh(4,c,c.return),vf(c);break;case 1:ql(c,c.return);var m=c.stateNode;typeof m.componentWillUnmount=="function"&&l8(c,c.return,m),vf(c);break;case 27:zp(c.stateNode);case 26:case 5:ql(c,c.return),vf(c);break;case 22:c.memoizedState===null&&vf(c);break;case 30:vf(c);break;default:vf(c)}o=o.sibling}}function lc(o,c,m){for(m=m&&(c.subtreeFlags&8772)!==0,c=c.child;c!==null;){var b=c.alternate,D=o,P=c,$=P.flags;switch(P.tag){case 0:case 11:case 15:lc(D,P,m),Np(4,P);break;case 1:if(lc(D,P,m),b=P,D=b.stateNode,typeof D.componentDidMount=="function")try{D.componentDidMount()}catch(Je){Yi(b,b.return,Je)}if(b=P,D=b.updateQueue,D!==null){var re=b.stateNode;try{var xe=D.shared.hiddenCallbacks;if(xe!==null)for(D.shared.hiddenCallbacks=null,D=0;Der&&($=er,er=Dn,Dn=$);var Ve=LA(re,Dn),Pe=LA(re,er);if(Ve&&Pe&&(nt.rangeCount!==1||nt.anchorNode!==Ve.node||nt.anchorOffset!==Ve.offset||nt.focusNode!==Pe.node||nt.focusOffset!==Pe.offset)){var Ke=bt.createRange();Ke.setStart(Ve.node,Ve.offset),nt.removeAllRanges(),Dn>er?(nt.addRange(Ke),nt.extend(Pe.node,Pe.offset)):(Ke.setEnd(Pe.node,Pe.offset),nt.addRange(Ke))}}}}for(bt=[],nt=re;nt=nt.parentNode;)nt.nodeType===1&&bt.push({element:nt,left:nt.scrollLeft,top:nt.scrollTop});for(typeof re.focus=="function"&&re.focus(),re=0;rem?32:m,Z.T=null,m=mb,mb=null;var P=ah,$=cc;if(ds=0,ZA=ah=null,cc=0,(Oi&6)!==0)throw Error(n(331));var re=Oi;if(Oi|=4,S8(P.current),y8(P,P.current,$,m),Oi=re,Ip(0,!1),Ht&&typeof Ht.onPostCommitFiberRoot=="function")try{Ht.onPostCommitFiberRoot(rn,P)}catch{}return!0}finally{ue.p=D,Z.T=b,G8(o,c)}}function V8(o,c,m){c=Ca(m,c),c=Yx(o.stateNode,c,2),o=Ye(o,c,2),o!==null&&($i(o,2),Vl(o))}function Yi(o,c,m){if(o.tag===3)V8(o,o,m);else for(;c!==null;){if(c.tag===3){V8(c,o,m);break}else if(c.tag===1){var b=c.stateNode;if(typeof c.type.getDerivedStateFromError=="function"||typeof b.componentDidCatch=="function"&&(sh===null||!sh.has(b))){o=Ca(m,o),m=H4(2),b=Ye(c,m,2),b!==null&&(j4(m,b,c,o),$i(b,2),Vl(b));break}}c=c.return}}function yb(o,c,m){var b=o.pingCache;if(b===null){b=o.pingCache=new CI;var D=new Set;b.set(c,D)}else D=b.get(c),D===void 0&&(D=new Set,b.set(c,D));D.has(m)||(fb=!0,D.add(m),o=LI.bind(null,o,c,m),c.then(o,o))}function LI(o,c,m){var b=o.pingCache;b!==null&&b.delete(c),o.pingedLanes|=o.suspendedLanes&m,o.warmLanes&=~m,or===o&&(xi&m)===m&&(Or===4||Or===3&&(xi&62914560)===xi&&300>$e()-X1?(Oi&2)===0&&JA(o,0):Ab|=m,KA===xi&&(KA=0)),Vl(o)}function H8(o,c){c===0&&(c=rr()),o=ju(o,c),o!==null&&($i(o,c),Vl(o))}function UI(o){var c=o.memoizedState,m=0;c!==null&&(m=c.retryLane),H8(o,m)}function BI(o,c){var m=0;switch(o.tag){case 31:case 13:var b=o.stateNode,D=o.memoizedState;D!==null&&(m=D.retryLane);break;case 19:b=o.stateNode;break;case 22:b=o.stateNode._retryCache;break;default:throw Error(n(314))}b!==null&&b.delete(c),H8(o,m)}function OI(o,c){return St(o,c)}var t2=null,td=null,xb=!1,n2=!1,bb=!1,lh=0;function Vl(o){o!==td&&o.next===null&&(td===null?t2=td=o:td=td.next=o),n2=!0,xb||(xb=!0,FI())}function Ip(o,c){if(!bb&&n2){bb=!0;do for(var m=!1,b=t2;b!==null;){if(o!==0){var D=b.pendingLanes;if(D===0)var P=0;else{var $=b.suspendedLanes,re=b.pingedLanes;P=(1<<31-Gt(42|o)+1)-1,P&=D&~($&~re),P=P&201326741?P&201326741|1:P?P|2:0}P!==0&&(m=!0,X8(b,P))}else P=xi,P=kt(b,b===or?P:0,b.cancelPendingCommit!==null||b.timeoutHandle!==-1),(P&3)===0||xn(b,P)||(m=!0,X8(b,P));b=b.next}while(m);bb=!1}}function II(){j8()}function j8(){n2=xb=!1;var o=0;lh!==0&&XI()&&(o=lh);for(var c=$e(),m=null,b=t2;b!==null;){var D=b.next,P=W8(b,c);P===0?(b.next=null,m===null?t2=D:m.next=D,D===null&&(td=m)):(m=b,(o!==0||(P&3)!==0)&&(n2=!0)),b=D}ds!==0&&ds!==5||Ip(o),lh!==0&&(lh=0)}function W8(o,c){for(var m=o.suspendedLanes,b=o.pingedLanes,D=o.expirationTimes,P=o.pendingLanes&-62914561;0re)break;var ft=xe.transferSize,bt=xe.initiatorType;ft&&n5(bt)&&(xe=xe.responseEnd,$+=ft*(xe"u"?null:document;function d5(o,c,m){var b=nd;if(b&&typeof c=="string"&&c){var D=ot(c);D='link[rel="'+o+'"][href="'+D+'"]',typeof m=="string"&&(D+='[crossorigin="'+m+'"]'),A5.has(D)||(A5.add(D),o={rel:o,crossOrigin:m,href:c},b.querySelector(D)===null&&(c=b.createElement("link"),Us(c,"link",o),Oe(c),b.head.appendChild(c)))}}function iF(o){hc.D(o),d5("dns-prefetch",o,null)}function rF(o,c){hc.C(o,c),d5("preconnect",o,c)}function sF(o,c,m){hc.L(o,c,m);var b=nd;if(b&&o&&c){var D='link[rel="preload"][as="'+ot(c)+'"]';c==="image"&&m&&m.imageSrcSet?(D+='[imagesrcset="'+ot(m.imageSrcSet)+'"]',typeof m.imageSizes=="string"&&(D+='[imagesizes="'+ot(m.imageSizes)+'"]')):D+='[href="'+ot(o)+'"]';var P=D;switch(c){case"style":P=id(o);break;case"script":P=rd(o)}Go.has(P)||(o=v({rel:"preload",href:c==="image"&&m&&m.imageSrcSet?void 0:o,as:c},m),Go.set(P,o),b.querySelector(D)!==null||c==="style"&&b.querySelector(Gp(P))||c==="script"&&b.querySelector(qp(P))||(c=b.createElement("link"),Us(c,"link",o),Oe(c),b.head.appendChild(c)))}}function aF(o,c){hc.m(o,c);var m=nd;if(m&&o){var b=c&&typeof c.as=="string"?c.as:"script",D='link[rel="modulepreload"][as="'+ot(b)+'"][href="'+ot(o)+'"]',P=D;switch(b){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":P=rd(o)}if(!Go.has(P)&&(o=v({rel:"modulepreload",href:o},c),Go.set(P,o),m.querySelector(D)===null)){switch(b){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(m.querySelector(qp(P)))return}b=m.createElement("link"),Us(b,"link",o),Oe(b),m.head.appendChild(b)}}}function oF(o,c,m){hc.S(o,c,m);var b=nd;if(b&&o){var D=Xe(b).hoistableStyles,P=id(o);c=c||"default";var $=D.get(P);if(!$){var re={loading:0,preload:null};if($=b.querySelector(Gp(P)))re.loading=5;else{o=v({rel:"stylesheet",href:o,"data-precedence":c},m),(m=Go.get(P))&&Fb(o,m);var xe=$=b.createElement("link");Oe(xe),Us(xe,"link",o),xe._p=new Promise(function(Je,ft){xe.onload=Je,xe.onerror=ft}),xe.addEventListener("load",function(){re.loading|=1}),xe.addEventListener("error",function(){re.loading|=2}),re.loading|=4,o2($,c,b)}$={type:"stylesheet",instance:$,count:1,state:re},D.set(P,$)}}}function lF(o,c){hc.X(o,c);var m=nd;if(m&&o){var b=Xe(m).hoistableScripts,D=rd(o),P=b.get(D);P||(P=m.querySelector(qp(D)),P||(o=v({src:o,async:!0},c),(c=Go.get(D))&&kb(o,c),P=m.createElement("script"),Oe(P),Us(P,"link",o),m.head.appendChild(P)),P={type:"script",instance:P,count:1,state:null},b.set(D,P))}}function uF(o,c){hc.M(o,c);var m=nd;if(m&&o){var b=Xe(m).hoistableScripts,D=rd(o),P=b.get(D);P||(P=m.querySelector(qp(D)),P||(o=v({src:o,async:!0,type:"module"},c),(c=Go.get(D))&&kb(o,c),P=m.createElement("script"),Oe(P),Us(P,"link",o),m.head.appendChild(P)),P={type:"script",instance:P,count:1,state:null},b.set(D,P))}}function p5(o,c,m,b){var D=(D=_e.current)?a2(D):null;if(!D)throw Error(n(446));switch(o){case"meta":case"title":return null;case"style":return typeof m.precedence=="string"&&typeof m.href=="string"?(c=id(m.href),m=Xe(D).hoistableStyles,b=m.get(c),b||(b={type:"style",instance:null,count:0,state:null},m.set(c,b)),b):{type:"void",instance:null,count:0,state:null};case"link":if(m.rel==="stylesheet"&&typeof m.href=="string"&&typeof m.precedence=="string"){o=id(m.href);var P=Xe(D).hoistableStyles,$=P.get(o);if($||(D=D.ownerDocument||D,$={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},P.set(o,$),(P=D.querySelector(Gp(o)))&&!P._p&&($.instance=P,$.state.loading=5),Go.has(o)||(m={rel:"preload",as:"style",href:m.href,crossOrigin:m.crossOrigin,integrity:m.integrity,media:m.media,hrefLang:m.hrefLang,referrerPolicy:m.referrerPolicy},Go.set(o,m),P||cF(D,o,m,$.state))),c&&b===null)throw Error(n(528,""));return $}if(c&&b!==null)throw Error(n(529,""));return null;case"script":return c=m.async,m=m.src,typeof m=="string"&&c&&typeof c!="function"&&typeof c!="symbol"?(c=rd(m),m=Xe(D).hoistableScripts,b=m.get(c),b||(b={type:"script",instance:null,count:0,state:null},m.set(c,b)),b):{type:"void",instance:null,count:0,state:null};default:throw Error(n(444,o))}}function id(o){return'href="'+ot(o)+'"'}function Gp(o){return'link[rel="stylesheet"]['+o+"]"}function m5(o){return v({},o,{"data-precedence":o.precedence,precedence:null})}function cF(o,c,m,b){o.querySelector('link[rel="preload"][as="style"]['+c+"]")?b.loading=1:(c=o.createElement("link"),b.preload=c,c.addEventListener("load",function(){return b.loading|=1}),c.addEventListener("error",function(){return b.loading|=2}),Us(c,"link",m),Oe(c),o.head.appendChild(c))}function rd(o){return'[src="'+ot(o)+'"]'}function qp(o){return"script[async]"+o}function g5(o,c,m){if(c.count++,c.instance===null)switch(c.type){case"style":var b=o.querySelector('style[data-href~="'+ot(m.href)+'"]');if(b)return c.instance=b,Oe(b),b;var D=v({},m,{"data-href":m.href,"data-precedence":m.precedence,href:null,precedence:null});return b=(o.ownerDocument||o).createElement("style"),Oe(b),Us(b,"style",D),o2(b,m.precedence,o),c.instance=b;case"stylesheet":D=id(m.href);var P=o.querySelector(Gp(D));if(P)return c.state.loading|=4,c.instance=P,Oe(P),P;b=m5(m),(D=Go.get(D))&&Fb(b,D),P=(o.ownerDocument||o).createElement("link"),Oe(P);var $=P;return $._p=new Promise(function(re,xe){$.onload=re,$.onerror=xe}),Us(P,"link",b),c.state.loading|=4,o2(P,m.precedence,o),c.instance=P;case"script":return P=rd(m.src),(D=o.querySelector(qp(P)))?(c.instance=D,Oe(D),D):(b=m,(D=Go.get(P))&&(b=v({},m),kb(b,D)),o=o.ownerDocument||o,D=o.createElement("script"),Oe(D),Us(D,"link",b),o.head.appendChild(D),c.instance=D);case"void":return null;default:throw Error(n(443,c.type))}else c.type==="stylesheet"&&(c.state.loading&4)===0&&(b=c.instance,c.state.loading|=4,o2(b,m.precedence,o));return c.instance}function o2(o,c,m){for(var b=m.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),D=b.length?b[b.length-1]:null,P=D,$=0;$ title"):null)}function hF(o,c,m){if(m===1||c.itemProp!=null)return!1;switch(o){case"meta":case"title":return!0;case"style":if(typeof c.precedence!="string"||typeof c.href!="string"||c.href==="")break;return!0;case"link":if(typeof c.rel!="string"||typeof c.href!="string"||c.href===""||c.onLoad||c.onError)break;switch(c.rel){case"stylesheet":return o=c.disabled,typeof c.precedence=="string"&&o==null;default:return!0}case"script":if(c.async&&typeof c.async!="function"&&typeof c.async!="symbol"&&!c.onLoad&&!c.onError&&c.src&&typeof c.src=="string")return!0}return!1}function y5(o){return!(o.type==="stylesheet"&&(o.state.loading&3)===0)}function fF(o,c,m,b){if(m.type==="stylesheet"&&(typeof b.media!="string"||matchMedia(b.media).matches!==!1)&&(m.state.loading&4)===0){if(m.instance===null){var D=id(b.href),P=c.querySelector(Gp(D));if(P){c=P._p,c!==null&&typeof c=="object"&&typeof c.then=="function"&&(o.count++,o=u2.bind(o),c.then(o,o)),m.state.loading|=4,m.instance=P,Oe(P);return}P=c.ownerDocument||c,b=m5(b),(D=Go.get(D))&&Fb(b,D),P=P.createElement("link"),Oe(P);var $=P;$._p=new Promise(function(re,xe){$.onload=re,$.onerror=xe}),Us(P,"link",b),m.instance=P}o.stylesheets===null&&(o.stylesheets=new Map),o.stylesheets.set(m,c),(c=m.state.preload)&&(m.state.loading&3)===0&&(o.count++,m=u2.bind(o),c.addEventListener("load",m),c.addEventListener("error",m))}}var zb=0;function AF(o,c){return o.stylesheets&&o.count===0&&h2(o,o.stylesheets),0zb?50:800)+c);return o.unsuspend=m,function(){o.unsuspend=null,clearTimeout(b),clearTimeout(D)}}:null}function u2(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)h2(this,this.stylesheets);else if(this.unsuspend){var o=this.unsuspend;this.unsuspend=null,o()}}}var c2=null;function h2(o,c){o.stylesheets=null,o.unsuspend!==null&&(o.count++,c2=new Map,c.forEach(dF,o),c2=null,u2.call(o))}function dF(o,c){if(!(c.state.loading&4)){var m=c2.get(o);if(m)var b=m.get(null);else{m=new Map,c2.set(o,m);for(var D=o.querySelectorAll("link[data-precedence],style[data-precedence]"),P=0;P"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(i)}catch(e){console.error(e)}}return i(),Xb.exports=NF(),Xb.exports}var PF=DF(),Ie=vw();const LF=b7(Ie);/** * @license * Copyright 2010-2024 Three.js Authors * SPDX-License-Identifier: MIT - */const V0="172",Xo={ROTATE:0,DOLLY:1,PAN:2},Gd={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},S7=0,qS=1,T7=2,UF=0,_w=1,BF=2,xo=3,Nl=0,hr=1,as=2,Qa=0,Ka=1,a0=2,o0=3,l0=4,yw=5,Eo=100,xw=101,bw=102,w7=103,M7=104,Sw=200,Tw=201,ww=202,Mw=203,qm=204,Vm=205,Ew=206,Cw=207,Rw=208,Nw=209,Dw=210,OF=211,IF=212,FF=213,kF=214,Hm=0,jm=1,Wm=2,kh=3,$m=4,Xm=5,Ym=6,Qm=7,Lg=0,E7=1,C7=2,Za=0,R7=1,N7=2,D7=3,P7=4,zF=5,L7=6,U7=7,Pw=300,Qo=301,Ko=302,zh=303,Gh=304,sA=306,aA=1e3,eu=1001,oA=1002,mr=1003,s_=1004,tu=1005,gs=1006,Jd=1007,Va=1008,GF=1008,aa=1009,Qf=1010,Kf=1011,wl=1012,Ns=1013,Rr=1014,$r=1015,Gs=1016,Ay=1017,dy=1018,Au=1020,py=35902,Lw=1021,Ug=1022,ks=1023,Uw=1024,Bw=1025,au=1026,du=1027,Bg=1028,H0=1029,lA=1030,j0=1031,qF=1032,W0=1033,Zf=33776,Bh=33777,Oh=33778,Ih=33779,Km=35840,Zm=35841,Jm=35842,eg=35843,tg=36196,u0=37492,c0=37496,h0=37808,f0=37809,A0=37810,d0=37811,p0=37812,m0=37813,g0=37814,v0=37815,_0=37816,y0=37817,x0=37818,b0=37819,S0=37820,T0=37821,Jf=36492,VS=36494,HS=36495,Ow=36283,ng=36284,ig=36285,rg=36286,VF=0,HF=1,H5=2,jF=3200,WF=3201,Dc=0,B7=1,Co="",_n="srgb",Ro="srgb-linear",a_="linear",Vi="srgb",$F=0,Uf=7680,XF=7681,YF=7682,QF=7683,KF=34055,ZF=34056,JF=5386,ek=512,tk=513,nk=514,ik=515,rk=516,sk=517,ak=518,jS=519,Iw=512,my=513,Fw=514,gy=515,kw=516,zw=517,Gw=518,qw=519,o_=35044,qd=35048,j5="300 es",Ha=2e3,pu=2001;class zc{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){if(this._listeners===void 0)return!1;const n=this._listeners;return n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){if(this._listeners===void 0)return;const r=this._listeners[e];if(r!==void 0){const s=r.indexOf(t);s!==-1&&r.splice(s,1)}}dispatchEvent(e){if(this._listeners===void 0)return;const n=this._listeners[e.type];if(n!==void 0){e.target=this;const r=n.slice(0);for(let s=0,a=r.length;s>8&255]+Js[i>>16&255]+Js[i>>24&255]+"-"+Js[e&255]+Js[e>>8&255]+"-"+Js[e>>16&15|64]+Js[e>>24&255]+"-"+Js[t&63|128]+Js[t>>8&255]+"-"+Js[t>>16&255]+Js[t>>24&255]+Js[n&255]+Js[n>>8&255]+Js[n>>16&255]+Js[n>>24&255]).toLowerCase()}function ni(i,e,t){return Math.max(e,Math.min(t,i))}function Vw(i,e){return(i%e+e)%e}function ok(i,e,t,n,r){return n+(i-e)*(r-n)/(t-e)}function lk(i,e,t){return i!==e?(t-i)/(e-i):0}function Cm(i,e,t){return(1-t)*i+t*e}function uk(i,e,t,n){return Cm(i,e,1-Math.exp(-t*n))}function ck(i,e=1){return e-Math.abs(Vw(i,e*2)-e)}function hk(i,e,t){return i<=e?0:i>=t?1:(i=(i-e)/(t-e),i*i*(3-2*i))}function fk(i,e,t){return i<=e?0:i>=t?1:(i=(i-e)/(t-e),i*i*i*(i*(i*6-15)+10))}function Ak(i,e){return i+Math.floor(Math.random()*(e-i+1))}function dk(i,e){return i+Math.random()*(e-i)}function pk(i){return i*(.5-Math.random())}function mk(i){i!==void 0&&(W5=i);let e=W5+=1831565813;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}function gk(i){return i*Em}function vk(i){return i*w0}function _k(i){return(i&i-1)===0&&i!==0}function yk(i){return Math.pow(2,Math.ceil(Math.log(i)/Math.LN2))}function xk(i){return Math.pow(2,Math.floor(Math.log(i)/Math.LN2))}function bk(i,e,t,n,r){const s=Math.cos,a=Math.sin,l=s(t/2),u=a(t/2),h=s((e+n)/2),g=a((e+n)/2),v=s((e-n)/2),x=a((e-n)/2),S=s((n-e)/2),w=a((n-e)/2);switch(r){case"XYX":i.set(l*g,u*v,u*x,l*h);break;case"YZY":i.set(u*x,l*g,u*v,l*h);break;case"ZXZ":i.set(u*v,u*x,l*g,l*h);break;case"XZX":i.set(l*g,u*w,u*S,l*h);break;case"YXY":i.set(u*S,l*g,u*w,l*h);break;case"ZYZ":i.set(u*w,u*S,l*g,l*h);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}}function Ta(i,e){switch(e.constructor){case Float32Array:return i;case Uint32Array:return i/4294967295;case Uint16Array:return i/65535;case Uint8Array:return i/255;case Int32Array:return Math.max(i/2147483647,-1);case Int16Array:return Math.max(i/32767,-1);case Int8Array:return Math.max(i/127,-1);default:throw new Error("Invalid component type.")}}function si(i,e){switch(e.constructor){case Float32Array:return i;case Uint32Array:return Math.round(i*4294967295);case Uint16Array:return Math.round(i*65535);case Uint8Array:return Math.round(i*255);case Int32Array:return Math.round(i*2147483647);case Int16Array:return Math.round(i*32767);case Int8Array:return Math.round(i*127);default:throw new Error("Invalid component type.")}}const M0={DEG2RAD:Em,RAD2DEG:w0,generateUUID:ou,clamp:ni,euclideanModulo:Vw,mapLinear:ok,inverseLerp:lk,lerp:Cm,damp:uk,pingpong:ck,smoothstep:hk,smootherstep:fk,randInt:Ak,randFloat:dk,randFloatSpread:pk,seededRandom:mk,degToRad:gk,radToDeg:vk,isPowerOfTwo:_k,ceilPowerOfTwo:yk,floorPowerOfTwo:xk,setQuaternionFromProperEuler:bk,normalize:si,denormalize:Ta};class At{constructor(e=0,t=0){At.prototype.isVector2=!0,this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const t=this.x,n=this.y,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6],this.y=r[1]*t+r[4]*n+r[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=ni(this.x,e.x,t.x),this.y=ni(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=ni(this.x,e,t),this.y=ni(this.y,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(ni(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(ni(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y;return t*t+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){const n=Math.cos(t),r=Math.sin(t),s=this.x-e.x,a=this.y-e.y;return this.x=s*n-a*r+e.x,this.y=s*r+a*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class Vn{constructor(e,t,n,r,s,a,l,u,h){Vn.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,n,r,s,a,l,u,h)}set(e,t,n,r,s,a,l,u,h){const g=this.elements;return g[0]=e,g[1]=r,g[2]=l,g[3]=t,g[4]=s,g[5]=u,g[6]=n,g[7]=a,g[8]=h,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,r=t.elements,s=this.elements,a=n[0],l=n[3],u=n[6],h=n[1],g=n[4],v=n[7],x=n[2],S=n[5],w=n[8],R=r[0],C=r[3],E=r[6],B=r[1],L=r[4],O=r[7],z=r[2],G=r[5],k=r[8];return s[0]=a*R+l*B+u*z,s[3]=a*C+l*L+u*G,s[6]=a*E+l*O+u*k,s[1]=h*R+g*B+v*z,s[4]=h*C+g*L+v*G,s[7]=h*E+g*O+v*k,s[2]=x*R+S*B+w*z,s[5]=x*C+S*L+w*G,s[8]=x*E+S*O+w*k,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[1],r=e[2],s=e[3],a=e[4],l=e[5],u=e[6],h=e[7],g=e[8];return t*a*g-t*l*h-n*s*g+n*l*u+r*s*h-r*a*u}invert(){const e=this.elements,t=e[0],n=e[1],r=e[2],s=e[3],a=e[4],l=e[5],u=e[6],h=e[7],g=e[8],v=g*a-l*h,x=l*u-g*s,S=h*s-a*u,w=t*v+n*x+r*S;if(w===0)return this.set(0,0,0,0,0,0,0,0,0);const R=1/w;return e[0]=v*R,e[1]=(r*h-g*n)*R,e[2]=(l*n-r*a)*R,e[3]=x*R,e[4]=(g*t-r*u)*R,e[5]=(r*s-l*t)*R,e[6]=S*R,e[7]=(n*u-h*t)*R,e[8]=(a*t-n*s)*R,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,n,r,s,a,l){const u=Math.cos(s),h=Math.sin(s);return this.set(n*u,n*h,-n*(u*a+h*l)+a+e,-r*h,r*u,-r*(-h*a+u*l)+l+t,0,0,1),this}scale(e,t){return this.premultiply(Jb.makeScale(e,t)),this}rotate(e){return this.premultiply(Jb.makeRotation(-e)),this}translate(e,t){return this.premultiply(Jb.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,n,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){const t=this.elements,n=e.elements;for(let r=0;r<9;r++)if(t[r]!==n[r])return!1;return!0}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}clone(){return new this.constructor().fromArray(this.elements)}}const Jb=new Vn;function O7(i){for(let e=i.length-1;e>=0;--e)if(i[e]>=65535)return!0;return!1}function sg(i){return document.createElementNS("http://www.w3.org/1999/xhtml",i)}function I7(){const i=sg("canvas");return i.style.display="block",i}const $5={};function kf(i){i in $5||($5[i]=!0,console.warn(i))}function Sk(i,e,t){return new Promise(function(n,r){function s(){switch(i.clientWaitSync(e,i.SYNC_FLUSH_COMMANDS_BIT,0)){case i.WAIT_FAILED:r();break;case i.TIMEOUT_EXPIRED:setTimeout(s,t);break;default:n()}}setTimeout(s,t)})}function Tk(i){const e=i.elements;e[2]=.5*e[2]+.5*e[3],e[6]=.5*e[6]+.5*e[7],e[10]=.5*e[10]+.5*e[11],e[14]=.5*e[14]+.5*e[15]}function wk(i){const e=i.elements;e[11]===-1?(e[10]=-e[10]-1,e[14]=-e[14]):(e[10]=-e[10],e[14]=-e[14]+1)}const X5=new Vn().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),Y5=new Vn().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function Mk(){const i={enabled:!0,workingColorSpace:Ro,spaces:{},convert:function(r,s,a){return this.enabled===!1||s===a||!s||!a||(this.spaces[s].transfer===Vi&&(r.r=Mc(r.r),r.g=Mc(r.g),r.b=Mc(r.b)),this.spaces[s].primaries!==this.spaces[a].primaries&&(r.applyMatrix3(this.spaces[s].toXYZ),r.applyMatrix3(this.spaces[a].fromXYZ)),this.spaces[a].transfer===Vi&&(r.r=e0(r.r),r.g=e0(r.g),r.b=e0(r.b))),r},fromWorkingColorSpace:function(r,s){return this.convert(r,this.workingColorSpace,s)},toWorkingColorSpace:function(r,s){return this.convert(r,s,this.workingColorSpace)},getPrimaries:function(r){return this.spaces[r].primaries},getTransfer:function(r){return r===Co?a_:this.spaces[r].transfer},getLuminanceCoefficients:function(r,s=this.workingColorSpace){return r.fromArray(this.spaces[s].luminanceCoefficients)},define:function(r){Object.assign(this.spaces,r)},_getMatrix:function(r,s,a){return r.copy(this.spaces[s].toXYZ).multiply(this.spaces[a].fromXYZ)},_getDrawingBufferColorSpace:function(r){return this.spaces[r].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(r=this.workingColorSpace){return this.spaces[r].workingColorSpaceConfig.unpackColorSpace}},e=[.64,.33,.3,.6,.15,.06],t=[.2126,.7152,.0722],n=[.3127,.329];return i.define({[Ro]:{primaries:e,whitePoint:n,transfer:a_,toXYZ:X5,fromXYZ:Y5,luminanceCoefficients:t,workingColorSpaceConfig:{unpackColorSpace:_n},outputColorSpaceConfig:{drawingBufferColorSpace:_n}},[_n]:{primaries:e,whitePoint:n,transfer:Vi,toXYZ:X5,fromXYZ:Y5,luminanceCoefficients:t,outputColorSpaceConfig:{drawingBufferColorSpace:_n}}}),i}const ai=Mk();function Mc(i){return i<.04045?i*.0773993808:Math.pow(i*.9478672986+.0521327014,2.4)}function e0(i){return i<.0031308?i*12.92:1.055*Math.pow(i,.41666)-.055}let ad;class Ek{static getDataURL(e){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let t;if(e instanceof HTMLCanvasElement)t=e;else{ad===void 0&&(ad=sg("canvas")),ad.width=e.width,ad.height=e.height;const n=ad.getContext("2d");e instanceof ImageData?n.putImageData(e,0,0):n.drawImage(e,0,0,e.width,e.height),t=ad}return t.width>2048||t.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",e),t.toDataURL("image/jpeg",.6)):t.toDataURL("image/png")}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){const t=sg("canvas");t.width=e.width,t.height=e.height;const n=t.getContext("2d");n.drawImage(e,0,0,e.width,e.height);const r=n.getImageData(0,0,e.width,e.height),s=r.data;for(let a=0;a0&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==Pw)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case aA:e.x=e.x-Math.floor(e.x);break;case eu:e.x=e.x<0?0:1;break;case oA:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case aA:e.y=e.y-Math.floor(e.y);break;case eu:e.y=e.y<0?0:1;break;case oA:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){e===!0&&this.pmremVersion++}}vs.DEFAULT_IMAGE=null;vs.DEFAULT_MAPPING=Pw;vs.DEFAULT_ANISOTROPY=1;class Pn{constructor(e=0,t=0,n=0,r=1){Pn.prototype.isVector4=!0,this.x=e,this.y=t,this.z=n,this.w=r}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,n,r){return this.x=e,this.y=t,this.z=n,this.w=r,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const t=this.x,n=this.y,r=this.z,s=this.w,a=e.elements;return this.x=a[0]*t+a[4]*n+a[8]*r+a[12]*s,this.y=a[1]*t+a[5]*n+a[9]*r+a[13]*s,this.z=a[2]*t+a[6]*n+a[10]*r+a[14]*s,this.w=a[3]*t+a[7]*n+a[11]*r+a[15]*s,this}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,n,r,s;const u=e.elements,h=u[0],g=u[4],v=u[8],x=u[1],S=u[5],w=u[9],R=u[2],C=u[6],E=u[10];if(Math.abs(g-x)<.01&&Math.abs(v-R)<.01&&Math.abs(w-C)<.01){if(Math.abs(g+x)<.1&&Math.abs(v+R)<.1&&Math.abs(w+C)<.1&&Math.abs(h+S+E-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const L=(h+1)/2,O=(S+1)/2,z=(E+1)/2,G=(g+x)/4,k=(v+R)/4,H=(w+C)/4;return L>O&&L>z?L<.01?(n=0,r=.707106781,s=.707106781):(n=Math.sqrt(L),r=G/n,s=k/n):O>z?O<.01?(n=.707106781,r=0,s=.707106781):(r=Math.sqrt(O),n=G/r,s=H/r):z<.01?(n=.707106781,r=.707106781,s=0):(s=Math.sqrt(z),n=k/s,r=H/s),this.set(n,r,s,t),this}let B=Math.sqrt((C-w)*(C-w)+(v-R)*(v-R)+(x-g)*(x-g));return Math.abs(B)<.001&&(B=1),this.x=(C-w)/B,this.y=(v-R)/B,this.z=(x-g)/B,this.w=Math.acos((h+S+E-1)/2),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this.w=t[15],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=ni(this.x,e.x,t.x),this.y=ni(this.y,e.y,t.y),this.z=ni(this.z,e.z,t.z),this.w=ni(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=ni(this.x,e,t),this.y=ni(this.y,e,t),this.z=ni(this.z,e,t),this.w=ni(this.w,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(ni(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this.w=e.w+(t.w-e.w)*n,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class Wh extends zc{constructor(e=1,t=1,n={}){super(),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=1,this.scissor=new Pn(0,0,e,t),this.scissorTest=!1,this.viewport=new Pn(0,0,e,t);const r={width:e,height:t,depth:1};n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:gs,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1},n);const s=new vs(r,n.mapping,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.colorSpace);s.flipY=!1,s.generateMipmaps=n.generateMipmaps,s.internalFormat=n.internalFormat,this.textures=[];const a=n.count;for(let l=0;l=0?1:-1,L=1-E*E;if(L>Number.EPSILON){const z=Math.sqrt(L),G=Math.atan2(z,E*B);C=Math.sin(C*G)/z,l=Math.sin(l*G)/z}const O=l*B;if(u=u*C+x*O,h=h*C+S*O,g=g*C+w*O,v=v*C+R*O,C===1-l){const z=1/Math.sqrt(u*u+h*h+g*g+v*v);u*=z,h*=z,g*=z,v*=z}}e[t]=u,e[t+1]=h,e[t+2]=g,e[t+3]=v}static multiplyQuaternionsFlat(e,t,n,r,s,a){const l=n[r],u=n[r+1],h=n[r+2],g=n[r+3],v=s[a],x=s[a+1],S=s[a+2],w=s[a+3];return e[t]=l*w+g*v+u*S-h*x,e[t+1]=u*w+g*x+h*v-l*S,e[t+2]=h*w+g*S+l*x-u*v,e[t+3]=g*w-l*v-u*x-h*S,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,n,r){return this._x=e,this._y=t,this._z=n,this._w=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){const n=e._x,r=e._y,s=e._z,a=e._order,l=Math.cos,u=Math.sin,h=l(n/2),g=l(r/2),v=l(s/2),x=u(n/2),S=u(r/2),w=u(s/2);switch(a){case"XYZ":this._x=x*g*v+h*S*w,this._y=h*S*v-x*g*w,this._z=h*g*w+x*S*v,this._w=h*g*v-x*S*w;break;case"YXZ":this._x=x*g*v+h*S*w,this._y=h*S*v-x*g*w,this._z=h*g*w-x*S*v,this._w=h*g*v+x*S*w;break;case"ZXY":this._x=x*g*v-h*S*w,this._y=h*S*v+x*g*w,this._z=h*g*w+x*S*v,this._w=h*g*v-x*S*w;break;case"ZYX":this._x=x*g*v-h*S*w,this._y=h*S*v+x*g*w,this._z=h*g*w-x*S*v,this._w=h*g*v+x*S*w;break;case"YZX":this._x=x*g*v+h*S*w,this._y=h*S*v+x*g*w,this._z=h*g*w-x*S*v,this._w=h*g*v-x*S*w;break;case"XZY":this._x=x*g*v-h*S*w,this._y=h*S*v-x*g*w,this._z=h*g*w+x*S*v,this._w=h*g*v+x*S*w;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+a)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const n=t/2,r=Math.sin(n);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,n=t[0],r=t[4],s=t[8],a=t[1],l=t[5],u=t[9],h=t[2],g=t[6],v=t[10],x=n+l+v;if(x>0){const S=.5/Math.sqrt(x+1);this._w=.25/S,this._x=(g-u)*S,this._y=(s-h)*S,this._z=(a-r)*S}else if(n>l&&n>v){const S=2*Math.sqrt(1+n-l-v);this._w=(g-u)/S,this._x=.25*S,this._y=(r+a)/S,this._z=(s+h)/S}else if(l>v){const S=2*Math.sqrt(1+l-n-v);this._w=(s-h)/S,this._x=(r+a)/S,this._y=.25*S,this._z=(u+g)/S}else{const S=2*Math.sqrt(1+v-n-l);this._w=(a-r)/S,this._x=(s+h)/S,this._y=(u+g)/S,this._z=.25*S}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return nMath.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=n),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(ni(this.dot(e),-1,1)))}rotateTowards(e,t){const n=this.angleTo(e);if(n===0)return this;const r=Math.min(1,t/n);return this.slerp(e,r),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const n=e._x,r=e._y,s=e._z,a=e._w,l=t._x,u=t._y,h=t._z,g=t._w;return this._x=n*g+a*l+r*h-s*u,this._y=r*g+a*u+s*l-n*h,this._z=s*g+a*h+n*u-r*l,this._w=a*g-n*l-r*u-s*h,this._onChangeCallback(),this}slerp(e,t){if(t===0)return this;if(t===1)return this.copy(e);const n=this._x,r=this._y,s=this._z,a=this._w;let l=a*e._w+n*e._x+r*e._y+s*e._z;if(l<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,l=-l):this.copy(e),l>=1)return this._w=a,this._x=n,this._y=r,this._z=s,this;const u=1-l*l;if(u<=Number.EPSILON){const S=1-t;return this._w=S*a+t*this._w,this._x=S*n+t*this._x,this._y=S*r+t*this._y,this._z=S*s+t*this._z,this.normalize(),this}const h=Math.sqrt(u),g=Math.atan2(h,l),v=Math.sin((1-t)*g)/h,x=Math.sin(t*g)/h;return this._w=a*v+this._w*x,this._x=n*v+this._x*x,this._y=r*v+this._y*x,this._z=s*v+this._z*x,this._onChangeCallback(),this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){const e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),n=Math.random(),r=Math.sqrt(1-n),s=Math.sqrt(n);return this.set(r*Math.sin(e),r*Math.cos(e),s*Math.sin(t),s*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class ce{constructor(e=0,t=0,n=0){ce.prototype.isVector3=!0,this.x=e,this.y=t,this.z=n}set(e,t,n){return n===void 0&&(n=this.z),this.x=e,this.y=t,this.z=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(Q5.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(Q5.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,n=this.y,r=this.z,s=e.elements;return this.x=s[0]*t+s[3]*n+s[6]*r,this.y=s[1]*t+s[4]*n+s[7]*r,this.z=s[2]*t+s[5]*n+s[8]*r,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,n=this.y,r=this.z,s=e.elements,a=1/(s[3]*t+s[7]*n+s[11]*r+s[15]);return this.x=(s[0]*t+s[4]*n+s[8]*r+s[12])*a,this.y=(s[1]*t+s[5]*n+s[9]*r+s[13])*a,this.z=(s[2]*t+s[6]*n+s[10]*r+s[14])*a,this}applyQuaternion(e){const t=this.x,n=this.y,r=this.z,s=e.x,a=e.y,l=e.z,u=e.w,h=2*(a*r-l*n),g=2*(l*t-s*r),v=2*(s*n-a*t);return this.x=t+u*h+a*v-l*g,this.y=n+u*g+l*h-s*v,this.z=r+u*v+s*g-a*h,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const t=this.x,n=this.y,r=this.z,s=e.elements;return this.x=s[0]*t+s[4]*n+s[8]*r,this.y=s[1]*t+s[5]*n+s[9]*r,this.z=s[2]*t+s[6]*n+s[10]*r,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=ni(this.x,e.x,t.x),this.y=ni(this.y,e.y,t.y),this.z=ni(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=ni(this.x,e,t),this.y=ni(this.y,e,t),this.z=ni(this.z,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(ni(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const n=e.x,r=e.y,s=e.z,a=t.x,l=t.y,u=t.z;return this.x=r*u-s*l,this.y=s*a-n*u,this.z=n*l-r*a,this}projectOnVector(e){const t=e.lengthSq();if(t===0)return this.set(0,0,0);const n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return t3.copy(this).projectOnVector(e),this.sub(t3)}reflect(e){return this.sub(t3.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(ni(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y,r=this.z-e.z;return t*t+n*n+r*r}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,n){const r=Math.sin(t)*e;return this.x=r*Math.sin(n),this.y=Math.cos(t)*e,this.z=r*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),r=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=r,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=Math.random()*Math.PI*2,t=Math.random()*2-1,n=Math.sqrt(1-t*t);return this.x=n*Math.cos(e),this.y=t,this.z=n*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const t3=new ce,Q5=new mu;class Gc{constructor(e=new ce(1/0,1/0,1/0),t=new ce(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,n=e.length;t=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,ml),ml.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(Yp),y2.subVectors(this.max,Yp),od.subVectors(e.a,Yp),ld.subVectors(e.b,Yp),ud.subVectors(e.c,Yp),ph.subVectors(ld,od),mh.subVectors(ud,ld),yf.subVectors(od,ud);let t=[0,-ph.z,ph.y,0,-mh.z,mh.y,0,-yf.z,yf.y,ph.z,0,-ph.x,mh.z,0,-mh.x,yf.z,0,-yf.x,-ph.y,ph.x,0,-mh.y,mh.x,0,-yf.y,yf.x,0];return!n3(t,od,ld,ud,y2)||(t=[1,0,0,0,1,0,0,0,1],!n3(t,od,ld,ud,y2))?!1:(x2.crossVectors(ph,mh),t=[x2.x,x2.y,x2.z],n3(t,od,ld,ud,y2))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,ml).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(ml).length()*.5),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(fc[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),fc[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),fc[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),fc[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),fc[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),fc[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),fc[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),fc[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(fc),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}const fc=[new ce,new ce,new ce,new ce,new ce,new ce,new ce,new ce],ml=new ce,_2=new Gc,od=new ce,ld=new ce,ud=new ce,ph=new ce,mh=new ce,yf=new ce,Yp=new ce,y2=new ce,x2=new ce,xf=new ce;function n3(i,e,t,n,r){for(let s=0,a=i.length-3;s<=a;s+=3){xf.fromArray(i,s);const l=r.x*Math.abs(xf.x)+r.y*Math.abs(xf.y)+r.z*Math.abs(xf.z),u=e.dot(xf),h=t.dot(xf),g=n.dot(xf);if(Math.max(-Math.max(u,h,g),Math.min(u,h,g))>l)return!1}return!0}const Dk=new Gc,Qp=new ce,i3=new ce;class dA{constructor(e=new ce,t=-1){this.isSphere=!0,this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){const n=this.center;t!==void 0?n.copy(t):Dk.setFromPoints(e).getCenter(n);let r=0;for(let s=0,a=e.length;sthis.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;Qp.subVectors(e,this.center);const t=Qp.lengthSq();if(t>this.radius*this.radius){const n=Math.sqrt(t),r=(n-this.radius)*.5;this.center.addScaledVector(Qp,r/n),this.radius+=r}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(i3.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(Qp.copy(e.center).add(i3)),this.expandByPoint(Qp.copy(e.center).sub(i3))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}}const Ac=new ce,r3=new ce,b2=new ce,gh=new ce,s3=new ce,S2=new ce,a3=new ce;class Og{constructor(e=new ce,t=new ce(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,Ac)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);const n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,n)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const t=Ac.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(Ac.copy(this.origin).addScaledVector(this.direction,t),Ac.distanceToSquared(e))}distanceSqToSegment(e,t,n,r){r3.copy(e).add(t).multiplyScalar(.5),b2.copy(t).sub(e).normalize(),gh.copy(this.origin).sub(r3);const s=e.distanceTo(t)*.5,a=-this.direction.dot(b2),l=gh.dot(this.direction),u=-gh.dot(b2),h=gh.lengthSq(),g=Math.abs(1-a*a);let v,x,S,w;if(g>0)if(v=a*u-l,x=a*l-u,w=s*g,v>=0)if(x>=-w)if(x<=w){const R=1/g;v*=R,x*=R,S=v*(v+a*x+2*l)+x*(a*v+x+2*u)+h}else x=s,v=Math.max(0,-(a*x+l)),S=-v*v+x*(x+2*u)+h;else x=-s,v=Math.max(0,-(a*x+l)),S=-v*v+x*(x+2*u)+h;else x<=-w?(v=Math.max(0,-(-a*s+l)),x=v>0?-s:Math.min(Math.max(-s,-u),s),S=-v*v+x*(x+2*u)+h):x<=w?(v=0,x=Math.min(Math.max(-s,-u),s),S=x*(x+2*u)+h):(v=Math.max(0,-(a*s+l)),x=v>0?s:Math.min(Math.max(-s,-u),s),S=-v*v+x*(x+2*u)+h);else x=a>0?-s:s,v=Math.max(0,-(a*x+l)),S=-v*v+x*(x+2*u)+h;return n&&n.copy(this.origin).addScaledVector(this.direction,v),r&&r.copy(r3).addScaledVector(b2,x),S}intersectSphere(e,t){Ac.subVectors(e.center,this.origin);const n=Ac.dot(this.direction),r=Ac.dot(Ac)-n*n,s=e.radius*e.radius;if(r>s)return null;const a=Math.sqrt(s-r),l=n-a,u=n+a;return u<0?null:l<0?this.at(u,t):this.at(l,t)}intersectsSphere(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;const n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){const n=this.distanceToPlane(e);return n===null?null:this.at(n,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let n,r,s,a,l,u;const h=1/this.direction.x,g=1/this.direction.y,v=1/this.direction.z,x=this.origin;return h>=0?(n=(e.min.x-x.x)*h,r=(e.max.x-x.x)*h):(n=(e.max.x-x.x)*h,r=(e.min.x-x.x)*h),g>=0?(s=(e.min.y-x.y)*g,a=(e.max.y-x.y)*g):(s=(e.max.y-x.y)*g,a=(e.min.y-x.y)*g),n>a||s>r||((s>n||isNaN(n))&&(n=s),(a=0?(l=(e.min.z-x.z)*v,u=(e.max.z-x.z)*v):(l=(e.max.z-x.z)*v,u=(e.min.z-x.z)*v),n>u||l>r)||((l>n||n!==n)&&(n=l),(u=0?n:r,t)}intersectsBox(e){return this.intersectBox(e,Ac)!==null}intersectTriangle(e,t,n,r,s){s3.subVectors(t,e),S2.subVectors(n,e),a3.crossVectors(s3,S2);let a=this.direction.dot(a3),l;if(a>0){if(r)return null;l=1}else if(a<0)l=-1,a=-a;else return null;gh.subVectors(this.origin,e);const u=l*this.direction.dot(S2.crossVectors(gh,S2));if(u<0)return null;const h=l*this.direction.dot(s3.cross(gh));if(h<0||u+h>a)return null;const g=-l*gh.dot(a3);return g<0?null:this.at(g/a,s)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class kn{constructor(e,t,n,r,s,a,l,u,h,g,v,x,S,w,R,C){kn.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,t,n,r,s,a,l,u,h,g,v,x,S,w,R,C)}set(e,t,n,r,s,a,l,u,h,g,v,x,S,w,R,C){const E=this.elements;return E[0]=e,E[4]=t,E[8]=n,E[12]=r,E[1]=s,E[5]=a,E[9]=l,E[13]=u,E[2]=h,E[6]=g,E[10]=v,E[14]=x,E[3]=S,E[7]=w,E[11]=R,E[15]=C,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new kn().fromArray(this.elements)}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this}copyPosition(e){const t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this}setFromMatrix3(e){const t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,n){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this}makeBasis(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this}extractRotation(e){const t=this.elements,n=e.elements,r=1/cd.setFromMatrixColumn(e,0).length(),s=1/cd.setFromMatrixColumn(e,1).length(),a=1/cd.setFromMatrixColumn(e,2).length();return t[0]=n[0]*r,t[1]=n[1]*r,t[2]=n[2]*r,t[3]=0,t[4]=n[4]*s,t[5]=n[5]*s,t[6]=n[6]*s,t[7]=0,t[8]=n[8]*a,t[9]=n[9]*a,t[10]=n[10]*a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){const t=this.elements,n=e.x,r=e.y,s=e.z,a=Math.cos(n),l=Math.sin(n),u=Math.cos(r),h=Math.sin(r),g=Math.cos(s),v=Math.sin(s);if(e.order==="XYZ"){const x=a*g,S=a*v,w=l*g,R=l*v;t[0]=u*g,t[4]=-u*v,t[8]=h,t[1]=S+w*h,t[5]=x-R*h,t[9]=-l*u,t[2]=R-x*h,t[6]=w+S*h,t[10]=a*u}else if(e.order==="YXZ"){const x=u*g,S=u*v,w=h*g,R=h*v;t[0]=x+R*l,t[4]=w*l-S,t[8]=a*h,t[1]=a*v,t[5]=a*g,t[9]=-l,t[2]=S*l-w,t[6]=R+x*l,t[10]=a*u}else if(e.order==="ZXY"){const x=u*g,S=u*v,w=h*g,R=h*v;t[0]=x-R*l,t[4]=-a*v,t[8]=w+S*l,t[1]=S+w*l,t[5]=a*g,t[9]=R-x*l,t[2]=-a*h,t[6]=l,t[10]=a*u}else if(e.order==="ZYX"){const x=a*g,S=a*v,w=l*g,R=l*v;t[0]=u*g,t[4]=w*h-S,t[8]=x*h+R,t[1]=u*v,t[5]=R*h+x,t[9]=S*h-w,t[2]=-h,t[6]=l*u,t[10]=a*u}else if(e.order==="YZX"){const x=a*u,S=a*h,w=l*u,R=l*h;t[0]=u*g,t[4]=R-x*v,t[8]=w*v+S,t[1]=v,t[5]=a*g,t[9]=-l*g,t[2]=-h*g,t[6]=S*v+w,t[10]=x-R*v}else if(e.order==="XZY"){const x=a*u,S=a*h,w=l*u,R=l*h;t[0]=u*g,t[4]=-v,t[8]=h*g,t[1]=x*v+R,t[5]=a*g,t[9]=S*v-w,t[2]=w*v-S,t[6]=l*g,t[10]=R*v+x}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(Pk,e,Lk)}lookAt(e,t,n){const r=this.elements;return po.subVectors(e,t),po.lengthSq()===0&&(po.z=1),po.normalize(),vh.crossVectors(n,po),vh.lengthSq()===0&&(Math.abs(n.z)===1?po.x+=1e-4:po.z+=1e-4,po.normalize(),vh.crossVectors(n,po)),vh.normalize(),T2.crossVectors(po,vh),r[0]=vh.x,r[4]=T2.x,r[8]=po.x,r[1]=vh.y,r[5]=T2.y,r[9]=po.y,r[2]=vh.z,r[6]=T2.z,r[10]=po.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,r=t.elements,s=this.elements,a=n[0],l=n[4],u=n[8],h=n[12],g=n[1],v=n[5],x=n[9],S=n[13],w=n[2],R=n[6],C=n[10],E=n[14],B=n[3],L=n[7],O=n[11],z=n[15],G=r[0],k=r[4],H=r[8],F=r[12],V=r[1],X=r[5],J=r[9],te=r[13],se=r[2],ne=r[6],Z=r[10],ue=r[14],he=r[3],be=r[7],Se=r[11],le=r[15];return s[0]=a*G+l*V+u*se+h*he,s[4]=a*k+l*X+u*ne+h*be,s[8]=a*H+l*J+u*Z+h*Se,s[12]=a*F+l*te+u*ue+h*le,s[1]=g*G+v*V+x*se+S*he,s[5]=g*k+v*X+x*ne+S*be,s[9]=g*H+v*J+x*Z+S*Se,s[13]=g*F+v*te+x*ue+S*le,s[2]=w*G+R*V+C*se+E*he,s[6]=w*k+R*X+C*ne+E*be,s[10]=w*H+R*J+C*Z+E*Se,s[14]=w*F+R*te+C*ue+E*le,s[3]=B*G+L*V+O*se+z*he,s[7]=B*k+L*X+O*ne+z*be,s[11]=B*H+L*J+O*Z+z*Se,s[15]=B*F+L*te+O*ue+z*le,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[4],r=e[8],s=e[12],a=e[1],l=e[5],u=e[9],h=e[13],g=e[2],v=e[6],x=e[10],S=e[14],w=e[3],R=e[7],C=e[11],E=e[15];return w*(+s*u*v-r*h*v-s*l*x+n*h*x+r*l*S-n*u*S)+R*(+t*u*S-t*h*x+s*a*x-r*a*S+r*h*g-s*u*g)+C*(+t*h*v-t*l*S-s*a*v+n*a*S+s*l*g-n*h*g)+E*(-r*l*g-t*u*v+t*l*x+r*a*v-n*a*x+n*u*g)}transpose(){const e=this.elements;let t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,n){const r=this.elements;return e.isVector3?(r[12]=e.x,r[13]=e.y,r[14]=e.z):(r[12]=e,r[13]=t,r[14]=n),this}invert(){const e=this.elements,t=e[0],n=e[1],r=e[2],s=e[3],a=e[4],l=e[5],u=e[6],h=e[7],g=e[8],v=e[9],x=e[10],S=e[11],w=e[12],R=e[13],C=e[14],E=e[15],B=v*C*h-R*x*h+R*u*S-l*C*S-v*u*E+l*x*E,L=w*x*h-g*C*h-w*u*S+a*C*S+g*u*E-a*x*E,O=g*R*h-w*v*h+w*l*S-a*R*S-g*l*E+a*v*E,z=w*v*u-g*R*u-w*l*x+a*R*x+g*l*C-a*v*C,G=t*B+n*L+r*O+s*z;if(G===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const k=1/G;return e[0]=B*k,e[1]=(R*x*s-v*C*s-R*r*S+n*C*S+v*r*E-n*x*E)*k,e[2]=(l*C*s-R*u*s+R*r*h-n*C*h-l*r*E+n*u*E)*k,e[3]=(v*u*s-l*x*s-v*r*h+n*x*h+l*r*S-n*u*S)*k,e[4]=L*k,e[5]=(g*C*s-w*x*s+w*r*S-t*C*S-g*r*E+t*x*E)*k,e[6]=(w*u*s-a*C*s-w*r*h+t*C*h+a*r*E-t*u*E)*k,e[7]=(a*x*s-g*u*s+g*r*h-t*x*h-a*r*S+t*u*S)*k,e[8]=O*k,e[9]=(w*v*s-g*R*s-w*n*S+t*R*S+g*n*E-t*v*E)*k,e[10]=(a*R*s-w*l*s+w*n*h-t*R*h-a*n*E+t*l*E)*k,e[11]=(g*l*s-a*v*s-g*n*h+t*v*h+a*n*S-t*l*S)*k,e[12]=z*k,e[13]=(g*R*r-w*v*r+w*n*x-t*R*x-g*n*C+t*v*C)*k,e[14]=(w*l*r-a*R*r-w*n*u+t*R*u+a*n*C-t*l*C)*k,e[15]=(a*v*r-g*l*r+g*n*u-t*v*u-a*n*x+t*l*x)*k,this}scale(e){const t=this.elements,n=e.x,r=e.y,s=e.z;return t[0]*=n,t[4]*=r,t[8]*=s,t[1]*=n,t[5]*=r,t[9]*=s,t[2]*=n,t[6]*=r,t[10]*=s,t[3]*=n,t[7]*=r,t[11]*=s,this}getMaxScaleOnAxis(){const e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],r=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,r))}makeTranslation(e,t,n){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const n=Math.cos(t),r=Math.sin(t),s=1-n,a=e.x,l=e.y,u=e.z,h=s*a,g=s*l;return this.set(h*a+n,h*l-r*u,h*u+r*l,0,h*l+r*u,g*l+n,g*u-r*a,0,h*u-r*l,g*u+r*a,s*u*u+n,0,0,0,0,1),this}makeScale(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this}makeShear(e,t,n,r,s,a){return this.set(1,n,s,0,e,1,a,0,t,r,1,0,0,0,0,1),this}compose(e,t,n){const r=this.elements,s=t._x,a=t._y,l=t._z,u=t._w,h=s+s,g=a+a,v=l+l,x=s*h,S=s*g,w=s*v,R=a*g,C=a*v,E=l*v,B=u*h,L=u*g,O=u*v,z=n.x,G=n.y,k=n.z;return r[0]=(1-(R+E))*z,r[1]=(S+O)*z,r[2]=(w-L)*z,r[3]=0,r[4]=(S-O)*G,r[5]=(1-(x+E))*G,r[6]=(C+B)*G,r[7]=0,r[8]=(w+L)*k,r[9]=(C-B)*k,r[10]=(1-(x+R))*k,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,this}decompose(e,t,n){const r=this.elements;let s=cd.set(r[0],r[1],r[2]).length();const a=cd.set(r[4],r[5],r[6]).length(),l=cd.set(r[8],r[9],r[10]).length();this.determinant()<0&&(s=-s),e.x=r[12],e.y=r[13],e.z=r[14],gl.copy(this);const h=1/s,g=1/a,v=1/l;return gl.elements[0]*=h,gl.elements[1]*=h,gl.elements[2]*=h,gl.elements[4]*=g,gl.elements[5]*=g,gl.elements[6]*=g,gl.elements[8]*=v,gl.elements[9]*=v,gl.elements[10]*=v,t.setFromRotationMatrix(gl),n.x=s,n.y=a,n.z=l,this}makePerspective(e,t,n,r,s,a,l=Ha){const u=this.elements,h=2*s/(t-e),g=2*s/(n-r),v=(t+e)/(t-e),x=(n+r)/(n-r);let S,w;if(l===Ha)S=-(a+s)/(a-s),w=-2*a*s/(a-s);else if(l===pu)S=-a/(a-s),w=-a*s/(a-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+l);return u[0]=h,u[4]=0,u[8]=v,u[12]=0,u[1]=0,u[5]=g,u[9]=x,u[13]=0,u[2]=0,u[6]=0,u[10]=S,u[14]=w,u[3]=0,u[7]=0,u[11]=-1,u[15]=0,this}makeOrthographic(e,t,n,r,s,a,l=Ha){const u=this.elements,h=1/(t-e),g=1/(n-r),v=1/(a-s),x=(t+e)*h,S=(n+r)*g;let w,R;if(l===Ha)w=(a+s)*v,R=-2*v;else if(l===pu)w=s*v,R=-1*v;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+l);return u[0]=2*h,u[4]=0,u[8]=0,u[12]=-x,u[1]=0,u[5]=2*g,u[9]=0,u[13]=-S,u[2]=0,u[6]=0,u[10]=R,u[14]=-w,u[3]=0,u[7]=0,u[11]=0,u[15]=1,this}equals(e){const t=this.elements,n=e.elements;for(let r=0;r<16;r++)if(t[r]!==n[r])return!1;return!0}fromArray(e,t=0){for(let n=0;n<16;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}}const cd=new ce,gl=new kn,Pk=new ce(0,0,0),Lk=new ce(1,1,1),vh=new ce,T2=new ce,po=new ce,K5=new kn,Z5=new mu;class la{constructor(e=0,t=0,n=0,r=la.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=n,this._order=r}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,n,r=this._order){return this._x=e,this._y=t,this._z=n,this._order=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,n=!0){const r=e.elements,s=r[0],a=r[4],l=r[8],u=r[1],h=r[5],g=r[9],v=r[2],x=r[6],S=r[10];switch(t){case"XYZ":this._y=Math.asin(ni(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-g,S),this._z=Math.atan2(-a,s)):(this._x=Math.atan2(x,h),this._z=0);break;case"YXZ":this._x=Math.asin(-ni(g,-1,1)),Math.abs(g)<.9999999?(this._y=Math.atan2(l,S),this._z=Math.atan2(u,h)):(this._y=Math.atan2(-v,s),this._z=0);break;case"ZXY":this._x=Math.asin(ni(x,-1,1)),Math.abs(x)<.9999999?(this._y=Math.atan2(-v,S),this._z=Math.atan2(-a,h)):(this._y=0,this._z=Math.atan2(u,s));break;case"ZYX":this._y=Math.asin(-ni(v,-1,1)),Math.abs(v)<.9999999?(this._x=Math.atan2(x,S),this._z=Math.atan2(u,s)):(this._x=0,this._z=Math.atan2(-a,h));break;case"YZX":this._z=Math.asin(ni(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(-g,h),this._y=Math.atan2(-v,s)):(this._x=0,this._y=Math.atan2(l,S));break;case"XZY":this._z=Math.asin(-ni(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(x,h),this._y=Math.atan2(l,s)):(this._x=Math.atan2(-g,S),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,n===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,n){return K5.makeRotationFromQuaternion(e),this.setFromRotationMatrix(K5,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return Z5.setFromEuler(this),this.setFromQuaternion(Z5,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}la.DEFAULT_ORDER="XYZ";class jw{constructor(){this.mask=1}set(e){this.mask=(1<>>0}enable(e){this.mask|=1<1){for(let t=0;t1){for(let n=0;n0&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),r.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(r.matrixAutoUpdate=!1),this.isInstancedMesh&&(r.type="InstancedMesh",r.count=this.count,r.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(r.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(r.type="BatchedMesh",r.perObjectFrustumCulled=this.perObjectFrustumCulled,r.sortObjects=this.sortObjects,r.drawRanges=this._drawRanges,r.reservedRanges=this._reservedRanges,r.visibility=this._visibility,r.active=this._active,r.bounds=this._bounds.map(l=>({boxInitialized:l.boxInitialized,boxMin:l.box.min.toArray(),boxMax:l.box.max.toArray(),sphereInitialized:l.sphereInitialized,sphereRadius:l.sphere.radius,sphereCenter:l.sphere.center.toArray()})),r.maxInstanceCount=this._maxInstanceCount,r.maxVertexCount=this._maxVertexCount,r.maxIndexCount=this._maxIndexCount,r.geometryInitialized=this._geometryInitialized,r.geometryCount=this._geometryCount,r.matricesTexture=this._matricesTexture.toJSON(e),this._colorsTexture!==null&&(r.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(r.boundingSphere={center:r.boundingSphere.center.toArray(),radius:r.boundingSphere.radius}),this.boundingBox!==null&&(r.boundingBox={min:r.boundingBox.min.toArray(),max:r.boundingBox.max.toArray()}));function s(l,u){return l[u.uuid]===void 0&&(l[u.uuid]=u.toJSON(e)),u.uuid}if(this.isScene)this.background&&(this.background.isColor?r.background=this.background.toJSON():this.background.isTexture&&(r.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(r.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){r.geometry=s(e.geometries,this.geometry);const l=this.geometry.parameters;if(l!==void 0&&l.shapes!==void 0){const u=l.shapes;if(Array.isArray(u))for(let h=0,g=u.length;h0){r.children=[];for(let l=0;l0){r.animations=[];for(let l=0;l0&&(n.geometries=l),u.length>0&&(n.materials=u),h.length>0&&(n.textures=h),g.length>0&&(n.images=g),v.length>0&&(n.shapes=v),x.length>0&&(n.skeletons=x),S.length>0&&(n.animations=S),w.length>0&&(n.nodes=w)}return n.object=r,n;function a(l){const u=[];for(const h in l){const g=l[h];delete g.metadata,u.push(g)}return u}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let n=0;n0?r.multiplyScalar(1/Math.sqrt(s)):r.set(0,0,0)}static getBarycoord(e,t,n,r,s){vl.subVectors(r,t),pc.subVectors(n,t),l3.subVectors(e,t);const a=vl.dot(vl),l=vl.dot(pc),u=vl.dot(l3),h=pc.dot(pc),g=pc.dot(l3),v=a*h-l*l;if(v===0)return s.set(0,0,0),null;const x=1/v,S=(h*u-l*g)*x,w=(a*g-l*u)*x;return s.set(1-S-w,w,S)}static containsPoint(e,t,n,r){return this.getBarycoord(e,t,n,r,mc)===null?!1:mc.x>=0&&mc.y>=0&&mc.x+mc.y<=1}static getInterpolation(e,t,n,r,s,a,l,u){return this.getBarycoord(e,t,n,r,mc)===null?(u.x=0,u.y=0,"z"in u&&(u.z=0),"w"in u&&(u.w=0),null):(u.setScalar(0),u.addScaledVector(s,mc.x),u.addScaledVector(a,mc.y),u.addScaledVector(l,mc.z),u)}static getInterpolatedAttribute(e,t,n,r,s,a){return f3.setScalar(0),A3.setScalar(0),d3.setScalar(0),f3.fromBufferAttribute(e,t),A3.fromBufferAttribute(e,n),d3.fromBufferAttribute(e,r),a.setScalar(0),a.addScaledVector(f3,s.x),a.addScaledVector(A3,s.y),a.addScaledVector(d3,s.z),a}static isFrontFacing(e,t,n,r){return vl.subVectors(n,t),pc.subVectors(e,t),vl.cross(pc).dot(r)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,r){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[r]),this}setFromAttributeAndIndices(e,t,n,r){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,r),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return vl.subVectors(this.c,this.b),pc.subVectors(this.a,this.b),vl.cross(pc).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return Sl.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return Sl.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,n,r,s){return Sl.getInterpolation(e,this.a,this.b,this.c,t,n,r,s)}containsPoint(e){return Sl.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return Sl.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const n=this.a,r=this.b,s=this.c;let a,l;Ad.subVectors(r,n),dd.subVectors(s,n),u3.subVectors(e,n);const u=Ad.dot(u3),h=dd.dot(u3);if(u<=0&&h<=0)return t.copy(n);c3.subVectors(e,r);const g=Ad.dot(c3),v=dd.dot(c3);if(g>=0&&v<=g)return t.copy(r);const x=u*v-g*h;if(x<=0&&u>=0&&g<=0)return a=u/(u-g),t.copy(n).addScaledVector(Ad,a);h3.subVectors(e,s);const S=Ad.dot(h3),w=dd.dot(h3);if(w>=0&&S<=w)return t.copy(s);const R=S*h-u*w;if(R<=0&&h>=0&&w<=0)return l=h/(h-w),t.copy(n).addScaledVector(dd,l);const C=g*w-S*v;if(C<=0&&v-g>=0&&S-w>=0)return rC.subVectors(s,r),l=(v-g)/(v-g+(S-w)),t.copy(r).addScaledVector(rC,l);const E=1/(C+R+x);return a=R*E,l=x*E,t.copy(n).addScaledVector(Ad,a).addScaledVector(dd,l)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}const k7={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},_h={h:0,s:0,l:0},M2={h:0,s:0,l:0};function p3(i,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?i+(e-i)*6*t:t<1/2?e:t<2/3?i+(e-i)*6*(2/3-t):i}let sn=class{constructor(e,t,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,n)}set(e,t,n){if(t===void 0&&n===void 0){const r=e;r&&r.isColor?this.copy(r):typeof r=="number"?this.setHex(r):typeof r=="string"&&this.setStyle(r)}else this.setRGB(e,t,n);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=_n){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,ai.toWorkingColorSpace(this,t),this}setRGB(e,t,n,r=ai.workingColorSpace){return this.r=e,this.g=t,this.b=n,ai.toWorkingColorSpace(this,r),this}setHSL(e,t,n,r=ai.workingColorSpace){if(e=Vw(e,1),t=ni(t,0,1),n=ni(n,0,1),t===0)this.r=this.g=this.b=n;else{const s=n<=.5?n*(1+t):n+t-n*t,a=2*n-s;this.r=p3(a,s,e+1/3),this.g=p3(a,s,e),this.b=p3(a,s,e-1/3)}return ai.toWorkingColorSpace(this,r),this}setStyle(e,t=_n){function n(s){s!==void 0&&parseFloat(s)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let r;if(r=/^(\w+)\(([^\)]*)\)/.exec(e)){let s;const a=r[1],l=r[2];switch(a){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(l))return n(s[4]),this.setRGB(Math.min(255,parseInt(s[1],10))/255,Math.min(255,parseInt(s[2],10))/255,Math.min(255,parseInt(s[3],10))/255,t);if(s=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(l))return n(s[4]),this.setRGB(Math.min(100,parseInt(s[1],10))/100,Math.min(100,parseInt(s[2],10))/100,Math.min(100,parseInt(s[3],10))/100,t);break;case"hsl":case"hsla":if(s=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(l))return n(s[4]),this.setHSL(parseFloat(s[1])/360,parseFloat(s[2])/100,parseFloat(s[3])/100,t);break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(r=/^\#([A-Fa-f\d]+)$/.exec(e)){const s=r[1],a=s.length;if(a===3)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,t);if(a===6)return this.setHex(parseInt(s,16),t);console.warn("THREE.Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=_n){const n=k7[e.toLowerCase()];return n!==void 0?this.setHex(n,t):console.warn("THREE.Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=Mc(e.r),this.g=Mc(e.g),this.b=Mc(e.b),this}copyLinearToSRGB(e){return this.r=e0(e.r),this.g=e0(e.g),this.b=e0(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=_n){return ai.fromWorkingColorSpace(ea.copy(this),e),Math.round(ni(ea.r*255,0,255))*65536+Math.round(ni(ea.g*255,0,255))*256+Math.round(ni(ea.b*255,0,255))}getHexString(e=_n){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=ai.workingColorSpace){ai.fromWorkingColorSpace(ea.copy(this),t);const n=ea.r,r=ea.g,s=ea.b,a=Math.max(n,r,s),l=Math.min(n,r,s);let u,h;const g=(l+a)/2;if(l===a)u=0,h=0;else{const v=a-l;switch(h=g<=.5?v/(a+l):v/(2-a-l),a){case n:u=(r-s)/v+(r0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const t in e){const n=e[t];if(n===void 0){console.warn(`THREE.Material: parameter '${t}' has value of undefined.`);continue}const r=this[t];if(r===void 0){console.warn(`THREE.Material: '${t}' is not a property of THREE.${this.type}.`);continue}r&&r.isColor?r.set(n):r&&r.isVector3&&n&&n.isVector3?r.copy(n):this[t]=n}}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});const n={metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};n.uuid=this.uuid,n.type=this.type,this.name!==""&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),this.roughness!==void 0&&(n.roughness=this.roughness),this.metalness!==void 0&&(n.metalness=this.metalness),this.sheen!==void 0&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(n.shininess=this.shininess),this.clearcoat!==void 0&&(n.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.dispersion!==void 0&&(n.dispersion=this.dispersion),this.iridescence!==void 0&&(n.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(n.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(n.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(n.combine=this.combine)),this.envMapRotation!==void 0&&(n.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(n.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(n.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(n.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(n.size=this.size),this.shadowSide!==null&&(n.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==Ka&&(n.blending=this.blending),this.side!==Nl&&(n.side=this.side),this.vertexColors===!0&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),this.transparent===!0&&(n.transparent=!0),this.blendSrc!==qm&&(n.blendSrc=this.blendSrc),this.blendDst!==Vm&&(n.blendDst=this.blendDst),this.blendEquation!==Eo&&(n.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(n.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(n.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(n.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(n.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(n.blendAlpha=this.blendAlpha),this.depthFunc!==kh&&(n.depthFunc=this.depthFunc),this.depthTest===!1&&(n.depthTest=this.depthTest),this.depthWrite===!1&&(n.depthWrite=this.depthWrite),this.colorWrite===!1&&(n.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(n.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==jS&&(n.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(n.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==Uf&&(n.stencilFail=this.stencilFail),this.stencilZFail!==Uf&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==Uf&&(n.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(n.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(n.rotation=this.rotation),this.polygonOffset===!0&&(n.polygonOffset=!0),this.polygonOffsetFactor!==0&&(n.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(n.linewidth=this.linewidth),this.dashSize!==void 0&&(n.dashSize=this.dashSize),this.gapSize!==void 0&&(n.gapSize=this.gapSize),this.scale!==void 0&&(n.scale=this.scale),this.dithering===!0&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),this.alphaHash===!0&&(n.alphaHash=!0),this.alphaToCoverage===!0&&(n.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(n.premultipliedAlpha=!0),this.forceSinglePass===!0&&(n.forceSinglePass=!0),this.wireframe===!0&&(n.wireframe=!0),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(n.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(n.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(n.flatShading=!0),this.visible===!1&&(n.visible=!1),this.toneMapped===!1&&(n.toneMapped=!1),this.fog===!1&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData);function r(s){const a=[];for(const l in s){const u=s[l];delete u.metadata,a.push(u)}return a}if(t){const s=r(e.textures),a=r(e.images);s.length>0&&(n.textures=s),a.length>0&&(n.images=a)}return n}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const t=e.clippingPlanes;let n=null;if(t!==null){const r=t.length;n=new Array(r);for(let s=0;s!==r;++s)n[s]=t[s].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}onBuild(){console.warn("Material: onBuild() has been removed.")}}class pA extends ua{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new sn(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new la,this.combine=Lg,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}const bc=kk();function kk(){const i=new ArrayBuffer(4),e=new Float32Array(i),t=new Uint32Array(i),n=new Uint32Array(512),r=new Uint32Array(512);for(let u=0;u<256;++u){const h=u-127;h<-27?(n[u]=0,n[u|256]=32768,r[u]=24,r[u|256]=24):h<-14?(n[u]=1024>>-h-14,n[u|256]=1024>>-h-14|32768,r[u]=-h-1,r[u|256]=-h-1):h<=15?(n[u]=h+15<<10,n[u|256]=h+15<<10|32768,r[u]=13,r[u|256]=13):h<128?(n[u]=31744,n[u|256]=64512,r[u]=24,r[u|256]=24):(n[u]=31744,n[u|256]=64512,r[u]=13,r[u|256]=13)}const s=new Uint32Array(2048),a=new Uint32Array(64),l=new Uint32Array(64);for(let u=1;u<1024;++u){let h=u<<13,g=0;for(;(h&8388608)===0;)h<<=1,g-=8388608;h&=-8388609,g+=947912704,s[u]=h|g}for(let u=1024;u<2048;++u)s[u]=939524096+(u-1024<<13);for(let u=1;u<31;++u)a[u]=u<<23;a[31]=1199570944,a[32]=2147483648;for(let u=33;u<63;++u)a[u]=2147483648+(u-32<<23);a[63]=3347054592;for(let u=1;u<64;++u)u!==32&&(l[u]=1024);return{floatView:e,uint32View:t,baseTable:n,shiftTable:r,mantissaTable:s,exponentTable:a,offsetTable:l}}function mo(i){Math.abs(i)>65504&&console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."),i=ni(i,-65504,65504),bc.floatView[0]=i;const e=bc.uint32View[0],t=e>>23&511;return bc.baseTable[t]+((e&8388607)>>bc.shiftTable[t])}function E2(i){const e=i>>10;return bc.uint32View[0]=bc.mantissaTable[bc.offsetTable[e]+(i&1023)]+bc.exponentTable[e],bc.floatView[0]}const is=new ce,C2=new At;class wr{constructor(e,t,n=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=n,this.usage=o_,this.updateRanges=[],this.gpuType=$r,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,n){e*=this.itemSize,n*=t.itemSize;for(let r=0,s=this.itemSize;rt.count&&console.warn("THREE.BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),t.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Gc);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new ce(-1/0,-1/0,-1/0),new ce(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let n=0,r=t.length;n0&&(e.userData=this.userData),this.parameters!==void 0){const u=this.parameters;for(const h in u)u[h]!==void 0&&(e[h]=u[h]);return e}e.data={attributes:{}};const t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});const n=this.attributes;for(const u in n){const h=n[u];e.data.attributes[u]=h.toJSON(e.data)}const r={};let s=!1;for(const u in this.morphAttributes){const h=this.morphAttributes[u],g=[];for(let v=0,x=h.length;v0&&(r[u]=g,s=!0)}s&&(e.data.morphAttributes=r,e.data.morphTargetsRelative=this.morphTargetsRelative);const a=this.groups;a.length>0&&(e.data.groups=JSON.parse(JSON.stringify(a)));const l=this.boundingSphere;return l!==null&&(e.data.boundingSphere={center:l.center.toArray(),radius:l.radius}),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const t={};this.name=e.name;const n=e.index;n!==null&&this.setIndex(n.clone(t));const r=e.attributes;for(const h in r){const g=r[h];this.setAttribute(h,g.clone(t))}const s=e.morphAttributes;for(const h in s){const g=[],v=s[h];for(let x=0,S=v.length;x0){const r=t[n[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=r.length;s(e.far-e.near)**2))&&(sC.copy(s).invert(),bf.copy(e.ray).applyMatrix4(sC),!(n.boundingBox!==null&&bf.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(e,t,bf)))}_computeIntersections(e,t,n){let r;const s=this.geometry,a=this.material,l=s.index,u=s.attributes.position,h=s.attributes.uv,g=s.attributes.uv1,v=s.attributes.normal,x=s.groups,S=s.drawRange;if(l!==null)if(Array.isArray(a))for(let w=0,R=x.length;wt.far?null:{distance:h,point:U2.clone(),object:i}}function B2(i,e,t,n,r,s,a,l,u,h){i.getVertexPosition(l,N2),i.getVertexPosition(u,D2),i.getVertexPosition(h,P2);const g=Gk(i,e,t,n,N2,D2,P2,oC);if(g){const v=new ce;Sl.getBarycoord(oC,N2,D2,P2,v),r&&(g.uv=Sl.getInterpolatedAttribute(r,l,u,h,v,new At)),s&&(g.uv1=Sl.getInterpolatedAttribute(s,l,u,h,v,new At)),a&&(g.normal=Sl.getInterpolatedAttribute(a,l,u,h,v,new ce),g.normal.dot(n.direction)>0&&g.normal.multiplyScalar(-1));const x={a:l,b:u,c:h,normal:new ce,materialIndex:0};Sl.getNormal(N2,D2,P2,x.normal),g.face=x,g.barycoord=v}return g}class $h extends Ki{constructor(e=1,t=1,n=1,r=1,s=1,a=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:r,heightSegments:s,depthSegments:a};const l=this;r=Math.floor(r),s=Math.floor(s),a=Math.floor(a);const u=[],h=[],g=[],v=[];let x=0,S=0;w("z","y","x",-1,-1,n,t,e,a,s,0),w("z","y","x",1,-1,n,t,-e,a,s,1),w("x","z","y",1,1,e,n,t,r,a,2),w("x","z","y",1,-1,e,n,-t,r,a,3),w("x","y","z",1,-1,e,t,n,r,s,4),w("x","y","z",-1,-1,e,t,-n,r,s,5),this.setIndex(u),this.setAttribute("position",new wi(h,3)),this.setAttribute("normal",new wi(g,3)),this.setAttribute("uv",new wi(v,2));function w(R,C,E,B,L,O,z,G,k,H,F){const V=O/k,X=z/H,J=O/2,te=z/2,se=G/2,ne=k+1,Z=H+1;let ue=0,he=0;const be=new ce;for(let Se=0;Se0?1:-1,g.push(be.x,be.y,be.z),v.push(we/k),v.push(1-Se/H),ue+=1}}for(let Se=0;Se>8&255]+Js[i>>16&255]+Js[i>>24&255]+"-"+Js[e&255]+Js[e>>8&255]+"-"+Js[e>>16&15|64]+Js[e>>24&255]+"-"+Js[t&63|128]+Js[t>>8&255]+"-"+Js[t>>16&255]+Js[t>>24&255]+Js[n&255]+Js[n>>8&255]+Js[n>>16&255]+Js[n>>24&255]).toLowerCase()}function ni(i,e,t){return Math.max(e,Math.min(t,i))}function Vw(i,e){return(i%e+e)%e}function ok(i,e,t,n,r){return n+(i-e)*(r-n)/(t-e)}function lk(i,e,t){return i!==e?(t-i)/(e-i):0}function Cm(i,e,t){return(1-t)*i+t*e}function uk(i,e,t,n){return Cm(i,e,1-Math.exp(-t*n))}function ck(i,e=1){return e-Math.abs(Vw(i,e*2)-e)}function hk(i,e,t){return i<=e?0:i>=t?1:(i=(i-e)/(t-e),i*i*(3-2*i))}function fk(i,e,t){return i<=e?0:i>=t?1:(i=(i-e)/(t-e),i*i*i*(i*(i*6-15)+10))}function Ak(i,e){return i+Math.floor(Math.random()*(e-i+1))}function dk(i,e){return i+Math.random()*(e-i)}function pk(i){return i*(.5-Math.random())}function mk(i){i!==void 0&&(W5=i);let e=W5+=1831565813;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}function gk(i){return i*Em}function vk(i){return i*w0}function _k(i){return(i&i-1)===0&&i!==0}function yk(i){return Math.pow(2,Math.ceil(Math.log(i)/Math.LN2))}function xk(i){return Math.pow(2,Math.floor(Math.log(i)/Math.LN2))}function bk(i,e,t,n,r){const s=Math.cos,a=Math.sin,l=s(t/2),u=a(t/2),h=s((e+n)/2),g=a((e+n)/2),v=s((e-n)/2),x=a((e-n)/2),S=s((n-e)/2),w=a((n-e)/2);switch(r){case"XYX":i.set(l*g,u*v,u*x,l*h);break;case"YZY":i.set(u*x,l*g,u*v,l*h);break;case"ZXZ":i.set(u*v,u*x,l*g,l*h);break;case"XZX":i.set(l*g,u*w,u*S,l*h);break;case"YXY":i.set(u*S,l*g,u*w,l*h);break;case"ZYZ":i.set(u*w,u*S,l*g,l*h);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}}function Ta(i,e){switch(e.constructor){case Float32Array:return i;case Uint32Array:return i/4294967295;case Uint16Array:return i/65535;case Uint8Array:return i/255;case Int32Array:return Math.max(i/2147483647,-1);case Int16Array:return Math.max(i/32767,-1);case Int8Array:return Math.max(i/127,-1);default:throw new Error("Invalid component type.")}}function si(i,e){switch(e.constructor){case Float32Array:return i;case Uint32Array:return Math.round(i*4294967295);case Uint16Array:return Math.round(i*65535);case Uint8Array:return Math.round(i*255);case Int32Array:return Math.round(i*2147483647);case Int16Array:return Math.round(i*32767);case Int8Array:return Math.round(i*127);default:throw new Error("Invalid component type.")}}const M0={DEG2RAD:Em,RAD2DEG:w0,generateUUID:ou,clamp:ni,euclideanModulo:Vw,mapLinear:ok,inverseLerp:lk,lerp:Cm,damp:uk,pingpong:ck,smoothstep:hk,smootherstep:fk,randInt:Ak,randFloat:dk,randFloatSpread:pk,seededRandom:mk,degToRad:gk,radToDeg:vk,isPowerOfTwo:_k,ceilPowerOfTwo:yk,floorPowerOfTwo:xk,setQuaternionFromProperEuler:bk,normalize:si,denormalize:Ta};class dt{constructor(e=0,t=0){dt.prototype.isVector2=!0,this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const t=this.x,n=this.y,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6],this.y=r[1]*t+r[4]*n+r[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=ni(this.x,e.x,t.x),this.y=ni(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=ni(this.x,e,t),this.y=ni(this.y,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(ni(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(ni(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y;return t*t+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){const n=Math.cos(t),r=Math.sin(t),s=this.x-e.x,a=this.y-e.y;return this.x=s*n-a*r+e.x,this.y=s*r+a*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class Vn{constructor(e,t,n,r,s,a,l,u,h){Vn.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,n,r,s,a,l,u,h)}set(e,t,n,r,s,a,l,u,h){const g=this.elements;return g[0]=e,g[1]=r,g[2]=l,g[3]=t,g[4]=s,g[5]=u,g[6]=n,g[7]=a,g[8]=h,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,r=t.elements,s=this.elements,a=n[0],l=n[3],u=n[6],h=n[1],g=n[4],v=n[7],x=n[2],S=n[5],w=n[8],R=r[0],C=r[3],E=r[6],B=r[1],L=r[4],O=r[7],z=r[2],G=r[5],k=r[8];return s[0]=a*R+l*B+u*z,s[3]=a*C+l*L+u*G,s[6]=a*E+l*O+u*k,s[1]=h*R+g*B+v*z,s[4]=h*C+g*L+v*G,s[7]=h*E+g*O+v*k,s[2]=x*R+S*B+w*z,s[5]=x*C+S*L+w*G,s[8]=x*E+S*O+w*k,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[1],r=e[2],s=e[3],a=e[4],l=e[5],u=e[6],h=e[7],g=e[8];return t*a*g-t*l*h-n*s*g+n*l*u+r*s*h-r*a*u}invert(){const e=this.elements,t=e[0],n=e[1],r=e[2],s=e[3],a=e[4],l=e[5],u=e[6],h=e[7],g=e[8],v=g*a-l*h,x=l*u-g*s,S=h*s-a*u,w=t*v+n*x+r*S;if(w===0)return this.set(0,0,0,0,0,0,0,0,0);const R=1/w;return e[0]=v*R,e[1]=(r*h-g*n)*R,e[2]=(l*n-r*a)*R,e[3]=x*R,e[4]=(g*t-r*u)*R,e[5]=(r*s-l*t)*R,e[6]=S*R,e[7]=(n*u-h*t)*R,e[8]=(a*t-n*s)*R,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,n,r,s,a,l){const u=Math.cos(s),h=Math.sin(s);return this.set(n*u,n*h,-n*(u*a+h*l)+a+e,-r*h,r*u,-r*(-h*a+u*l)+l+t,0,0,1),this}scale(e,t){return this.premultiply(Jb.makeScale(e,t)),this}rotate(e){return this.premultiply(Jb.makeRotation(-e)),this}translate(e,t){return this.premultiply(Jb.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,n,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){const t=this.elements,n=e.elements;for(let r=0;r<9;r++)if(t[r]!==n[r])return!1;return!0}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}clone(){return new this.constructor().fromArray(this.elements)}}const Jb=new Vn;function O7(i){for(let e=i.length-1;e>=0;--e)if(i[e]>=65535)return!0;return!1}function sg(i){return document.createElementNS("http://www.w3.org/1999/xhtml",i)}function I7(){const i=sg("canvas");return i.style.display="block",i}const $5={};function kf(i){i in $5||($5[i]=!0,console.warn(i))}function Sk(i,e,t){return new Promise(function(n,r){function s(){switch(i.clientWaitSync(e,i.SYNC_FLUSH_COMMANDS_BIT,0)){case i.WAIT_FAILED:r();break;case i.TIMEOUT_EXPIRED:setTimeout(s,t);break;default:n()}}setTimeout(s,t)})}function Tk(i){const e=i.elements;e[2]=.5*e[2]+.5*e[3],e[6]=.5*e[6]+.5*e[7],e[10]=.5*e[10]+.5*e[11],e[14]=.5*e[14]+.5*e[15]}function wk(i){const e=i.elements;e[11]===-1?(e[10]=-e[10]-1,e[14]=-e[14]):(e[10]=-e[10],e[14]=-e[14]+1)}const X5=new Vn().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),Y5=new Vn().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function Mk(){const i={enabled:!0,workingColorSpace:Ro,spaces:{},convert:function(r,s,a){return this.enabled===!1||s===a||!s||!a||(this.spaces[s].transfer===Vi&&(r.r=Mc(r.r),r.g=Mc(r.g),r.b=Mc(r.b)),this.spaces[s].primaries!==this.spaces[a].primaries&&(r.applyMatrix3(this.spaces[s].toXYZ),r.applyMatrix3(this.spaces[a].fromXYZ)),this.spaces[a].transfer===Vi&&(r.r=e0(r.r),r.g=e0(r.g),r.b=e0(r.b))),r},fromWorkingColorSpace:function(r,s){return this.convert(r,this.workingColorSpace,s)},toWorkingColorSpace:function(r,s){return this.convert(r,s,this.workingColorSpace)},getPrimaries:function(r){return this.spaces[r].primaries},getTransfer:function(r){return r===Co?a_:this.spaces[r].transfer},getLuminanceCoefficients:function(r,s=this.workingColorSpace){return r.fromArray(this.spaces[s].luminanceCoefficients)},define:function(r){Object.assign(this.spaces,r)},_getMatrix:function(r,s,a){return r.copy(this.spaces[s].toXYZ).multiply(this.spaces[a].fromXYZ)},_getDrawingBufferColorSpace:function(r){return this.spaces[r].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(r=this.workingColorSpace){return this.spaces[r].workingColorSpaceConfig.unpackColorSpace}},e=[.64,.33,.3,.6,.15,.06],t=[.2126,.7152,.0722],n=[.3127,.329];return i.define({[Ro]:{primaries:e,whitePoint:n,transfer:a_,toXYZ:X5,fromXYZ:Y5,luminanceCoefficients:t,workingColorSpaceConfig:{unpackColorSpace:_n},outputColorSpaceConfig:{drawingBufferColorSpace:_n}},[_n]:{primaries:e,whitePoint:n,transfer:Vi,toXYZ:X5,fromXYZ:Y5,luminanceCoefficients:t,outputColorSpaceConfig:{drawingBufferColorSpace:_n}}}),i}const ai=Mk();function Mc(i){return i<.04045?i*.0773993808:Math.pow(i*.9478672986+.0521327014,2.4)}function e0(i){return i<.0031308?i*12.92:1.055*Math.pow(i,.41666)-.055}let ad;class Ek{static getDataURL(e){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let t;if(e instanceof HTMLCanvasElement)t=e;else{ad===void 0&&(ad=sg("canvas")),ad.width=e.width,ad.height=e.height;const n=ad.getContext("2d");e instanceof ImageData?n.putImageData(e,0,0):n.drawImage(e,0,0,e.width,e.height),t=ad}return t.width>2048||t.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",e),t.toDataURL("image/jpeg",.6)):t.toDataURL("image/png")}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){const t=sg("canvas");t.width=e.width,t.height=e.height;const n=t.getContext("2d");n.drawImage(e,0,0,e.width,e.height);const r=n.getImageData(0,0,e.width,e.height),s=r.data;for(let a=0;a0&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==Pw)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case aA:e.x=e.x-Math.floor(e.x);break;case eu:e.x=e.x<0?0:1;break;case oA:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case aA:e.y=e.y-Math.floor(e.y);break;case eu:e.y=e.y<0?0:1;break;case oA:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){e===!0&&this.pmremVersion++}}vs.DEFAULT_IMAGE=null;vs.DEFAULT_MAPPING=Pw;vs.DEFAULT_ANISOTROPY=1;class Pn{constructor(e=0,t=0,n=0,r=1){Pn.prototype.isVector4=!0,this.x=e,this.y=t,this.z=n,this.w=r}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,n,r){return this.x=e,this.y=t,this.z=n,this.w=r,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const t=this.x,n=this.y,r=this.z,s=this.w,a=e.elements;return this.x=a[0]*t+a[4]*n+a[8]*r+a[12]*s,this.y=a[1]*t+a[5]*n+a[9]*r+a[13]*s,this.z=a[2]*t+a[6]*n+a[10]*r+a[14]*s,this.w=a[3]*t+a[7]*n+a[11]*r+a[15]*s,this}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,n,r,s;const u=e.elements,h=u[0],g=u[4],v=u[8],x=u[1],S=u[5],w=u[9],R=u[2],C=u[6],E=u[10];if(Math.abs(g-x)<.01&&Math.abs(v-R)<.01&&Math.abs(w-C)<.01){if(Math.abs(g+x)<.1&&Math.abs(v+R)<.1&&Math.abs(w+C)<.1&&Math.abs(h+S+E-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const L=(h+1)/2,O=(S+1)/2,z=(E+1)/2,G=(g+x)/4,k=(v+R)/4,H=(w+C)/4;return L>O&&L>z?L<.01?(n=0,r=.707106781,s=.707106781):(n=Math.sqrt(L),r=G/n,s=k/n):O>z?O<.01?(n=.707106781,r=0,s=.707106781):(r=Math.sqrt(O),n=G/r,s=H/r):z<.01?(n=.707106781,r=.707106781,s=0):(s=Math.sqrt(z),n=k/s,r=H/s),this.set(n,r,s,t),this}let B=Math.sqrt((C-w)*(C-w)+(v-R)*(v-R)+(x-g)*(x-g));return Math.abs(B)<.001&&(B=1),this.x=(C-w)/B,this.y=(v-R)/B,this.z=(x-g)/B,this.w=Math.acos((h+S+E-1)/2),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this.w=t[15],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=ni(this.x,e.x,t.x),this.y=ni(this.y,e.y,t.y),this.z=ni(this.z,e.z,t.z),this.w=ni(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=ni(this.x,e,t),this.y=ni(this.y,e,t),this.z=ni(this.z,e,t),this.w=ni(this.w,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(ni(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this.w=e.w+(t.w-e.w)*n,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class Wh extends zc{constructor(e=1,t=1,n={}){super(),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=1,this.scissor=new Pn(0,0,e,t),this.scissorTest=!1,this.viewport=new Pn(0,0,e,t);const r={width:e,height:t,depth:1};n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:gs,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1},n);const s=new vs(r,n.mapping,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.colorSpace);s.flipY=!1,s.generateMipmaps=n.generateMipmaps,s.internalFormat=n.internalFormat,this.textures=[];const a=n.count;for(let l=0;l=0?1:-1,L=1-E*E;if(L>Number.EPSILON){const z=Math.sqrt(L),G=Math.atan2(z,E*B);C=Math.sin(C*G)/z,l=Math.sin(l*G)/z}const O=l*B;if(u=u*C+x*O,h=h*C+S*O,g=g*C+w*O,v=v*C+R*O,C===1-l){const z=1/Math.sqrt(u*u+h*h+g*g+v*v);u*=z,h*=z,g*=z,v*=z}}e[t]=u,e[t+1]=h,e[t+2]=g,e[t+3]=v}static multiplyQuaternionsFlat(e,t,n,r,s,a){const l=n[r],u=n[r+1],h=n[r+2],g=n[r+3],v=s[a],x=s[a+1],S=s[a+2],w=s[a+3];return e[t]=l*w+g*v+u*S-h*x,e[t+1]=u*w+g*x+h*v-l*S,e[t+2]=h*w+g*S+l*x-u*v,e[t+3]=g*w-l*v-u*x-h*S,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,n,r){return this._x=e,this._y=t,this._z=n,this._w=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){const n=e._x,r=e._y,s=e._z,a=e._order,l=Math.cos,u=Math.sin,h=l(n/2),g=l(r/2),v=l(s/2),x=u(n/2),S=u(r/2),w=u(s/2);switch(a){case"XYZ":this._x=x*g*v+h*S*w,this._y=h*S*v-x*g*w,this._z=h*g*w+x*S*v,this._w=h*g*v-x*S*w;break;case"YXZ":this._x=x*g*v+h*S*w,this._y=h*S*v-x*g*w,this._z=h*g*w-x*S*v,this._w=h*g*v+x*S*w;break;case"ZXY":this._x=x*g*v-h*S*w,this._y=h*S*v+x*g*w,this._z=h*g*w+x*S*v,this._w=h*g*v-x*S*w;break;case"ZYX":this._x=x*g*v-h*S*w,this._y=h*S*v+x*g*w,this._z=h*g*w-x*S*v,this._w=h*g*v+x*S*w;break;case"YZX":this._x=x*g*v+h*S*w,this._y=h*S*v+x*g*w,this._z=h*g*w-x*S*v,this._w=h*g*v-x*S*w;break;case"XZY":this._x=x*g*v-h*S*w,this._y=h*S*v-x*g*w,this._z=h*g*w+x*S*v,this._w=h*g*v+x*S*w;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+a)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const n=t/2,r=Math.sin(n);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,n=t[0],r=t[4],s=t[8],a=t[1],l=t[5],u=t[9],h=t[2],g=t[6],v=t[10],x=n+l+v;if(x>0){const S=.5/Math.sqrt(x+1);this._w=.25/S,this._x=(g-u)*S,this._y=(s-h)*S,this._z=(a-r)*S}else if(n>l&&n>v){const S=2*Math.sqrt(1+n-l-v);this._w=(g-u)/S,this._x=.25*S,this._y=(r+a)/S,this._z=(s+h)/S}else if(l>v){const S=2*Math.sqrt(1+l-n-v);this._w=(s-h)/S,this._x=(r+a)/S,this._y=.25*S,this._z=(u+g)/S}else{const S=2*Math.sqrt(1+v-n-l);this._w=(a-r)/S,this._x=(s+h)/S,this._y=(u+g)/S,this._z=.25*S}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return nMath.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=n),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(ni(this.dot(e),-1,1)))}rotateTowards(e,t){const n=this.angleTo(e);if(n===0)return this;const r=Math.min(1,t/n);return this.slerp(e,r),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const n=e._x,r=e._y,s=e._z,a=e._w,l=t._x,u=t._y,h=t._z,g=t._w;return this._x=n*g+a*l+r*h-s*u,this._y=r*g+a*u+s*l-n*h,this._z=s*g+a*h+n*u-r*l,this._w=a*g-n*l-r*u-s*h,this._onChangeCallback(),this}slerp(e,t){if(t===0)return this;if(t===1)return this.copy(e);const n=this._x,r=this._y,s=this._z,a=this._w;let l=a*e._w+n*e._x+r*e._y+s*e._z;if(l<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,l=-l):this.copy(e),l>=1)return this._w=a,this._x=n,this._y=r,this._z=s,this;const u=1-l*l;if(u<=Number.EPSILON){const S=1-t;return this._w=S*a+t*this._w,this._x=S*n+t*this._x,this._y=S*r+t*this._y,this._z=S*s+t*this._z,this.normalize(),this}const h=Math.sqrt(u),g=Math.atan2(h,l),v=Math.sin((1-t)*g)/h,x=Math.sin(t*g)/h;return this._w=a*v+this._w*x,this._x=n*v+this._x*x,this._y=r*v+this._y*x,this._z=s*v+this._z*x,this._onChangeCallback(),this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){const e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),n=Math.random(),r=Math.sqrt(1-n),s=Math.sqrt(n);return this.set(r*Math.sin(e),r*Math.cos(e),s*Math.sin(t),s*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class ce{constructor(e=0,t=0,n=0){ce.prototype.isVector3=!0,this.x=e,this.y=t,this.z=n}set(e,t,n){return n===void 0&&(n=this.z),this.x=e,this.y=t,this.z=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(Q5.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(Q5.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,n=this.y,r=this.z,s=e.elements;return this.x=s[0]*t+s[3]*n+s[6]*r,this.y=s[1]*t+s[4]*n+s[7]*r,this.z=s[2]*t+s[5]*n+s[8]*r,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,n=this.y,r=this.z,s=e.elements,a=1/(s[3]*t+s[7]*n+s[11]*r+s[15]);return this.x=(s[0]*t+s[4]*n+s[8]*r+s[12])*a,this.y=(s[1]*t+s[5]*n+s[9]*r+s[13])*a,this.z=(s[2]*t+s[6]*n+s[10]*r+s[14])*a,this}applyQuaternion(e){const t=this.x,n=this.y,r=this.z,s=e.x,a=e.y,l=e.z,u=e.w,h=2*(a*r-l*n),g=2*(l*t-s*r),v=2*(s*n-a*t);return this.x=t+u*h+a*v-l*g,this.y=n+u*g+l*h-s*v,this.z=r+u*v+s*g-a*h,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const t=this.x,n=this.y,r=this.z,s=e.elements;return this.x=s[0]*t+s[4]*n+s[8]*r,this.y=s[1]*t+s[5]*n+s[9]*r,this.z=s[2]*t+s[6]*n+s[10]*r,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=ni(this.x,e.x,t.x),this.y=ni(this.y,e.y,t.y),this.z=ni(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=ni(this.x,e,t),this.y=ni(this.y,e,t),this.z=ni(this.z,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(ni(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const n=e.x,r=e.y,s=e.z,a=t.x,l=t.y,u=t.z;return this.x=r*u-s*l,this.y=s*a-n*u,this.z=n*l-r*a,this}projectOnVector(e){const t=e.lengthSq();if(t===0)return this.set(0,0,0);const n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return t3.copy(this).projectOnVector(e),this.sub(t3)}reflect(e){return this.sub(t3.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(ni(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y,r=this.z-e.z;return t*t+n*n+r*r}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,n){const r=Math.sin(t)*e;return this.x=r*Math.sin(n),this.y=Math.cos(t)*e,this.z=r*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),r=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=r,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=Math.random()*Math.PI*2,t=Math.random()*2-1,n=Math.sqrt(1-t*t);return this.x=n*Math.cos(e),this.y=t,this.z=n*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const t3=new ce,Q5=new mu;class Gc{constructor(e=new ce(1/0,1/0,1/0),t=new ce(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,n=e.length;t=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,ml),ml.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(Yp),y2.subVectors(this.max,Yp),od.subVectors(e.a,Yp),ld.subVectors(e.b,Yp),ud.subVectors(e.c,Yp),ph.subVectors(ld,od),mh.subVectors(ud,ld),yf.subVectors(od,ud);let t=[0,-ph.z,ph.y,0,-mh.z,mh.y,0,-yf.z,yf.y,ph.z,0,-ph.x,mh.z,0,-mh.x,yf.z,0,-yf.x,-ph.y,ph.x,0,-mh.y,mh.x,0,-yf.y,yf.x,0];return!n3(t,od,ld,ud,y2)||(t=[1,0,0,0,1,0,0,0,1],!n3(t,od,ld,ud,y2))?!1:(x2.crossVectors(ph,mh),t=[x2.x,x2.y,x2.z],n3(t,od,ld,ud,y2))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,ml).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(ml).length()*.5),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(fc[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),fc[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),fc[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),fc[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),fc[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),fc[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),fc[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),fc[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(fc),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}const fc=[new ce,new ce,new ce,new ce,new ce,new ce,new ce,new ce],ml=new ce,_2=new Gc,od=new ce,ld=new ce,ud=new ce,ph=new ce,mh=new ce,yf=new ce,Yp=new ce,y2=new ce,x2=new ce,xf=new ce;function n3(i,e,t,n,r){for(let s=0,a=i.length-3;s<=a;s+=3){xf.fromArray(i,s);const l=r.x*Math.abs(xf.x)+r.y*Math.abs(xf.y)+r.z*Math.abs(xf.z),u=e.dot(xf),h=t.dot(xf),g=n.dot(xf);if(Math.max(-Math.max(u,h,g),Math.min(u,h,g))>l)return!1}return!0}const Dk=new Gc,Qp=new ce,i3=new ce;class dA{constructor(e=new ce,t=-1){this.isSphere=!0,this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){const n=this.center;t!==void 0?n.copy(t):Dk.setFromPoints(e).getCenter(n);let r=0;for(let s=0,a=e.length;sthis.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;Qp.subVectors(e,this.center);const t=Qp.lengthSq();if(t>this.radius*this.radius){const n=Math.sqrt(t),r=(n-this.radius)*.5;this.center.addScaledVector(Qp,r/n),this.radius+=r}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(i3.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(Qp.copy(e.center).add(i3)),this.expandByPoint(Qp.copy(e.center).sub(i3))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}}const Ac=new ce,r3=new ce,b2=new ce,gh=new ce,s3=new ce,S2=new ce,a3=new ce;class Og{constructor(e=new ce,t=new ce(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,Ac)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);const n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,n)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const t=Ac.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(Ac.copy(this.origin).addScaledVector(this.direction,t),Ac.distanceToSquared(e))}distanceSqToSegment(e,t,n,r){r3.copy(e).add(t).multiplyScalar(.5),b2.copy(t).sub(e).normalize(),gh.copy(this.origin).sub(r3);const s=e.distanceTo(t)*.5,a=-this.direction.dot(b2),l=gh.dot(this.direction),u=-gh.dot(b2),h=gh.lengthSq(),g=Math.abs(1-a*a);let v,x,S,w;if(g>0)if(v=a*u-l,x=a*l-u,w=s*g,v>=0)if(x>=-w)if(x<=w){const R=1/g;v*=R,x*=R,S=v*(v+a*x+2*l)+x*(a*v+x+2*u)+h}else x=s,v=Math.max(0,-(a*x+l)),S=-v*v+x*(x+2*u)+h;else x=-s,v=Math.max(0,-(a*x+l)),S=-v*v+x*(x+2*u)+h;else x<=-w?(v=Math.max(0,-(-a*s+l)),x=v>0?-s:Math.min(Math.max(-s,-u),s),S=-v*v+x*(x+2*u)+h):x<=w?(v=0,x=Math.min(Math.max(-s,-u),s),S=x*(x+2*u)+h):(v=Math.max(0,-(a*s+l)),x=v>0?s:Math.min(Math.max(-s,-u),s),S=-v*v+x*(x+2*u)+h);else x=a>0?-s:s,v=Math.max(0,-(a*x+l)),S=-v*v+x*(x+2*u)+h;return n&&n.copy(this.origin).addScaledVector(this.direction,v),r&&r.copy(r3).addScaledVector(b2,x),S}intersectSphere(e,t){Ac.subVectors(e.center,this.origin);const n=Ac.dot(this.direction),r=Ac.dot(Ac)-n*n,s=e.radius*e.radius;if(r>s)return null;const a=Math.sqrt(s-r),l=n-a,u=n+a;return u<0?null:l<0?this.at(u,t):this.at(l,t)}intersectsSphere(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;const n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){const n=this.distanceToPlane(e);return n===null?null:this.at(n,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let n,r,s,a,l,u;const h=1/this.direction.x,g=1/this.direction.y,v=1/this.direction.z,x=this.origin;return h>=0?(n=(e.min.x-x.x)*h,r=(e.max.x-x.x)*h):(n=(e.max.x-x.x)*h,r=(e.min.x-x.x)*h),g>=0?(s=(e.min.y-x.y)*g,a=(e.max.y-x.y)*g):(s=(e.max.y-x.y)*g,a=(e.min.y-x.y)*g),n>a||s>r||((s>n||isNaN(n))&&(n=s),(a=0?(l=(e.min.z-x.z)*v,u=(e.max.z-x.z)*v):(l=(e.max.z-x.z)*v,u=(e.min.z-x.z)*v),n>u||l>r)||((l>n||n!==n)&&(n=l),(u=0?n:r,t)}intersectsBox(e){return this.intersectBox(e,Ac)!==null}intersectTriangle(e,t,n,r,s){s3.subVectors(t,e),S2.subVectors(n,e),a3.crossVectors(s3,S2);let a=this.direction.dot(a3),l;if(a>0){if(r)return null;l=1}else if(a<0)l=-1,a=-a;else return null;gh.subVectors(this.origin,e);const u=l*this.direction.dot(S2.crossVectors(gh,S2));if(u<0)return null;const h=l*this.direction.dot(s3.cross(gh));if(h<0||u+h>a)return null;const g=-l*gh.dot(a3);return g<0?null:this.at(g/a,s)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class kn{constructor(e,t,n,r,s,a,l,u,h,g,v,x,S,w,R,C){kn.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,t,n,r,s,a,l,u,h,g,v,x,S,w,R,C)}set(e,t,n,r,s,a,l,u,h,g,v,x,S,w,R,C){const E=this.elements;return E[0]=e,E[4]=t,E[8]=n,E[12]=r,E[1]=s,E[5]=a,E[9]=l,E[13]=u,E[2]=h,E[6]=g,E[10]=v,E[14]=x,E[3]=S,E[7]=w,E[11]=R,E[15]=C,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new kn().fromArray(this.elements)}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this}copyPosition(e){const t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this}setFromMatrix3(e){const t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,n){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this}makeBasis(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this}extractRotation(e){const t=this.elements,n=e.elements,r=1/cd.setFromMatrixColumn(e,0).length(),s=1/cd.setFromMatrixColumn(e,1).length(),a=1/cd.setFromMatrixColumn(e,2).length();return t[0]=n[0]*r,t[1]=n[1]*r,t[2]=n[2]*r,t[3]=0,t[4]=n[4]*s,t[5]=n[5]*s,t[6]=n[6]*s,t[7]=0,t[8]=n[8]*a,t[9]=n[9]*a,t[10]=n[10]*a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){const t=this.elements,n=e.x,r=e.y,s=e.z,a=Math.cos(n),l=Math.sin(n),u=Math.cos(r),h=Math.sin(r),g=Math.cos(s),v=Math.sin(s);if(e.order==="XYZ"){const x=a*g,S=a*v,w=l*g,R=l*v;t[0]=u*g,t[4]=-u*v,t[8]=h,t[1]=S+w*h,t[5]=x-R*h,t[9]=-l*u,t[2]=R-x*h,t[6]=w+S*h,t[10]=a*u}else if(e.order==="YXZ"){const x=u*g,S=u*v,w=h*g,R=h*v;t[0]=x+R*l,t[4]=w*l-S,t[8]=a*h,t[1]=a*v,t[5]=a*g,t[9]=-l,t[2]=S*l-w,t[6]=R+x*l,t[10]=a*u}else if(e.order==="ZXY"){const x=u*g,S=u*v,w=h*g,R=h*v;t[0]=x-R*l,t[4]=-a*v,t[8]=w+S*l,t[1]=S+w*l,t[5]=a*g,t[9]=R-x*l,t[2]=-a*h,t[6]=l,t[10]=a*u}else if(e.order==="ZYX"){const x=a*g,S=a*v,w=l*g,R=l*v;t[0]=u*g,t[4]=w*h-S,t[8]=x*h+R,t[1]=u*v,t[5]=R*h+x,t[9]=S*h-w,t[2]=-h,t[6]=l*u,t[10]=a*u}else if(e.order==="YZX"){const x=a*u,S=a*h,w=l*u,R=l*h;t[0]=u*g,t[4]=R-x*v,t[8]=w*v+S,t[1]=v,t[5]=a*g,t[9]=-l*g,t[2]=-h*g,t[6]=S*v+w,t[10]=x-R*v}else if(e.order==="XZY"){const x=a*u,S=a*h,w=l*u,R=l*h;t[0]=u*g,t[4]=-v,t[8]=h*g,t[1]=x*v+R,t[5]=a*g,t[9]=S*v-w,t[2]=w*v-S,t[6]=l*g,t[10]=R*v+x}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(Pk,e,Lk)}lookAt(e,t,n){const r=this.elements;return po.subVectors(e,t),po.lengthSq()===0&&(po.z=1),po.normalize(),vh.crossVectors(n,po),vh.lengthSq()===0&&(Math.abs(n.z)===1?po.x+=1e-4:po.z+=1e-4,po.normalize(),vh.crossVectors(n,po)),vh.normalize(),T2.crossVectors(po,vh),r[0]=vh.x,r[4]=T2.x,r[8]=po.x,r[1]=vh.y,r[5]=T2.y,r[9]=po.y,r[2]=vh.z,r[6]=T2.z,r[10]=po.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,r=t.elements,s=this.elements,a=n[0],l=n[4],u=n[8],h=n[12],g=n[1],v=n[5],x=n[9],S=n[13],w=n[2],R=n[6],C=n[10],E=n[14],B=n[3],L=n[7],O=n[11],z=n[15],G=r[0],k=r[4],H=r[8],F=r[12],V=r[1],X=r[5],J=r[9],te=r[13],se=r[2],ne=r[6],Z=r[10],ue=r[14],he=r[3],be=r[7],Se=r[11],le=r[15];return s[0]=a*G+l*V+u*se+h*he,s[4]=a*k+l*X+u*ne+h*be,s[8]=a*H+l*J+u*Z+h*Se,s[12]=a*F+l*te+u*ue+h*le,s[1]=g*G+v*V+x*se+S*he,s[5]=g*k+v*X+x*ne+S*be,s[9]=g*H+v*J+x*Z+S*Se,s[13]=g*F+v*te+x*ue+S*le,s[2]=w*G+R*V+C*se+E*he,s[6]=w*k+R*X+C*ne+E*be,s[10]=w*H+R*J+C*Z+E*Se,s[14]=w*F+R*te+C*ue+E*le,s[3]=B*G+L*V+O*se+z*he,s[7]=B*k+L*X+O*ne+z*be,s[11]=B*H+L*J+O*Z+z*Se,s[15]=B*F+L*te+O*ue+z*le,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[4],r=e[8],s=e[12],a=e[1],l=e[5],u=e[9],h=e[13],g=e[2],v=e[6],x=e[10],S=e[14],w=e[3],R=e[7],C=e[11],E=e[15];return w*(+s*u*v-r*h*v-s*l*x+n*h*x+r*l*S-n*u*S)+R*(+t*u*S-t*h*x+s*a*x-r*a*S+r*h*g-s*u*g)+C*(+t*h*v-t*l*S-s*a*v+n*a*S+s*l*g-n*h*g)+E*(-r*l*g-t*u*v+t*l*x+r*a*v-n*a*x+n*u*g)}transpose(){const e=this.elements;let t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,n){const r=this.elements;return e.isVector3?(r[12]=e.x,r[13]=e.y,r[14]=e.z):(r[12]=e,r[13]=t,r[14]=n),this}invert(){const e=this.elements,t=e[0],n=e[1],r=e[2],s=e[3],a=e[4],l=e[5],u=e[6],h=e[7],g=e[8],v=e[9],x=e[10],S=e[11],w=e[12],R=e[13],C=e[14],E=e[15],B=v*C*h-R*x*h+R*u*S-l*C*S-v*u*E+l*x*E,L=w*x*h-g*C*h-w*u*S+a*C*S+g*u*E-a*x*E,O=g*R*h-w*v*h+w*l*S-a*R*S-g*l*E+a*v*E,z=w*v*u-g*R*u-w*l*x+a*R*x+g*l*C-a*v*C,G=t*B+n*L+r*O+s*z;if(G===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const k=1/G;return e[0]=B*k,e[1]=(R*x*s-v*C*s-R*r*S+n*C*S+v*r*E-n*x*E)*k,e[2]=(l*C*s-R*u*s+R*r*h-n*C*h-l*r*E+n*u*E)*k,e[3]=(v*u*s-l*x*s-v*r*h+n*x*h+l*r*S-n*u*S)*k,e[4]=L*k,e[5]=(g*C*s-w*x*s+w*r*S-t*C*S-g*r*E+t*x*E)*k,e[6]=(w*u*s-a*C*s-w*r*h+t*C*h+a*r*E-t*u*E)*k,e[7]=(a*x*s-g*u*s+g*r*h-t*x*h-a*r*S+t*u*S)*k,e[8]=O*k,e[9]=(w*v*s-g*R*s-w*n*S+t*R*S+g*n*E-t*v*E)*k,e[10]=(a*R*s-w*l*s+w*n*h-t*R*h-a*n*E+t*l*E)*k,e[11]=(g*l*s-a*v*s-g*n*h+t*v*h+a*n*S-t*l*S)*k,e[12]=z*k,e[13]=(g*R*r-w*v*r+w*n*x-t*R*x-g*n*C+t*v*C)*k,e[14]=(w*l*r-a*R*r-w*n*u+t*R*u+a*n*C-t*l*C)*k,e[15]=(a*v*r-g*l*r+g*n*u-t*v*u-a*n*x+t*l*x)*k,this}scale(e){const t=this.elements,n=e.x,r=e.y,s=e.z;return t[0]*=n,t[4]*=r,t[8]*=s,t[1]*=n,t[5]*=r,t[9]*=s,t[2]*=n,t[6]*=r,t[10]*=s,t[3]*=n,t[7]*=r,t[11]*=s,this}getMaxScaleOnAxis(){const e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],r=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,r))}makeTranslation(e,t,n){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const n=Math.cos(t),r=Math.sin(t),s=1-n,a=e.x,l=e.y,u=e.z,h=s*a,g=s*l;return this.set(h*a+n,h*l-r*u,h*u+r*l,0,h*l+r*u,g*l+n,g*u-r*a,0,h*u-r*l,g*u+r*a,s*u*u+n,0,0,0,0,1),this}makeScale(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this}makeShear(e,t,n,r,s,a){return this.set(1,n,s,0,e,1,a,0,t,r,1,0,0,0,0,1),this}compose(e,t,n){const r=this.elements,s=t._x,a=t._y,l=t._z,u=t._w,h=s+s,g=a+a,v=l+l,x=s*h,S=s*g,w=s*v,R=a*g,C=a*v,E=l*v,B=u*h,L=u*g,O=u*v,z=n.x,G=n.y,k=n.z;return r[0]=(1-(R+E))*z,r[1]=(S+O)*z,r[2]=(w-L)*z,r[3]=0,r[4]=(S-O)*G,r[5]=(1-(x+E))*G,r[6]=(C+B)*G,r[7]=0,r[8]=(w+L)*k,r[9]=(C-B)*k,r[10]=(1-(x+R))*k,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,this}decompose(e,t,n){const r=this.elements;let s=cd.set(r[0],r[1],r[2]).length();const a=cd.set(r[4],r[5],r[6]).length(),l=cd.set(r[8],r[9],r[10]).length();this.determinant()<0&&(s=-s),e.x=r[12],e.y=r[13],e.z=r[14],gl.copy(this);const h=1/s,g=1/a,v=1/l;return gl.elements[0]*=h,gl.elements[1]*=h,gl.elements[2]*=h,gl.elements[4]*=g,gl.elements[5]*=g,gl.elements[6]*=g,gl.elements[8]*=v,gl.elements[9]*=v,gl.elements[10]*=v,t.setFromRotationMatrix(gl),n.x=s,n.y=a,n.z=l,this}makePerspective(e,t,n,r,s,a,l=Ha){const u=this.elements,h=2*s/(t-e),g=2*s/(n-r),v=(t+e)/(t-e),x=(n+r)/(n-r);let S,w;if(l===Ha)S=-(a+s)/(a-s),w=-2*a*s/(a-s);else if(l===pu)S=-a/(a-s),w=-a*s/(a-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+l);return u[0]=h,u[4]=0,u[8]=v,u[12]=0,u[1]=0,u[5]=g,u[9]=x,u[13]=0,u[2]=0,u[6]=0,u[10]=S,u[14]=w,u[3]=0,u[7]=0,u[11]=-1,u[15]=0,this}makeOrthographic(e,t,n,r,s,a,l=Ha){const u=this.elements,h=1/(t-e),g=1/(n-r),v=1/(a-s),x=(t+e)*h,S=(n+r)*g;let w,R;if(l===Ha)w=(a+s)*v,R=-2*v;else if(l===pu)w=s*v,R=-1*v;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+l);return u[0]=2*h,u[4]=0,u[8]=0,u[12]=-x,u[1]=0,u[5]=2*g,u[9]=0,u[13]=-S,u[2]=0,u[6]=0,u[10]=R,u[14]=-w,u[3]=0,u[7]=0,u[11]=0,u[15]=1,this}equals(e){const t=this.elements,n=e.elements;for(let r=0;r<16;r++)if(t[r]!==n[r])return!1;return!0}fromArray(e,t=0){for(let n=0;n<16;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}}const cd=new ce,gl=new kn,Pk=new ce(0,0,0),Lk=new ce(1,1,1),vh=new ce,T2=new ce,po=new ce,K5=new kn,Z5=new mu;class la{constructor(e=0,t=0,n=0,r=la.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=n,this._order=r}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,n,r=this._order){return this._x=e,this._y=t,this._z=n,this._order=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,n=!0){const r=e.elements,s=r[0],a=r[4],l=r[8],u=r[1],h=r[5],g=r[9],v=r[2],x=r[6],S=r[10];switch(t){case"XYZ":this._y=Math.asin(ni(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-g,S),this._z=Math.atan2(-a,s)):(this._x=Math.atan2(x,h),this._z=0);break;case"YXZ":this._x=Math.asin(-ni(g,-1,1)),Math.abs(g)<.9999999?(this._y=Math.atan2(l,S),this._z=Math.atan2(u,h)):(this._y=Math.atan2(-v,s),this._z=0);break;case"ZXY":this._x=Math.asin(ni(x,-1,1)),Math.abs(x)<.9999999?(this._y=Math.atan2(-v,S),this._z=Math.atan2(-a,h)):(this._y=0,this._z=Math.atan2(u,s));break;case"ZYX":this._y=Math.asin(-ni(v,-1,1)),Math.abs(v)<.9999999?(this._x=Math.atan2(x,S),this._z=Math.atan2(u,s)):(this._x=0,this._z=Math.atan2(-a,h));break;case"YZX":this._z=Math.asin(ni(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(-g,h),this._y=Math.atan2(-v,s)):(this._x=0,this._y=Math.atan2(l,S));break;case"XZY":this._z=Math.asin(-ni(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(x,h),this._y=Math.atan2(l,s)):(this._x=Math.atan2(-g,S),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,n===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,n){return K5.makeRotationFromQuaternion(e),this.setFromRotationMatrix(K5,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return Z5.setFromEuler(this),this.setFromQuaternion(Z5,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}la.DEFAULT_ORDER="XYZ";class jw{constructor(){this.mask=1}set(e){this.mask=(1<>>0}enable(e){this.mask|=1<1){for(let t=0;t1){for(let n=0;n0&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),r.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(r.matrixAutoUpdate=!1),this.isInstancedMesh&&(r.type="InstancedMesh",r.count=this.count,r.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(r.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(r.type="BatchedMesh",r.perObjectFrustumCulled=this.perObjectFrustumCulled,r.sortObjects=this.sortObjects,r.drawRanges=this._drawRanges,r.reservedRanges=this._reservedRanges,r.visibility=this._visibility,r.active=this._active,r.bounds=this._bounds.map(l=>({boxInitialized:l.boxInitialized,boxMin:l.box.min.toArray(),boxMax:l.box.max.toArray(),sphereInitialized:l.sphereInitialized,sphereRadius:l.sphere.radius,sphereCenter:l.sphere.center.toArray()})),r.maxInstanceCount=this._maxInstanceCount,r.maxVertexCount=this._maxVertexCount,r.maxIndexCount=this._maxIndexCount,r.geometryInitialized=this._geometryInitialized,r.geometryCount=this._geometryCount,r.matricesTexture=this._matricesTexture.toJSON(e),this._colorsTexture!==null&&(r.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(r.boundingSphere={center:r.boundingSphere.center.toArray(),radius:r.boundingSphere.radius}),this.boundingBox!==null&&(r.boundingBox={min:r.boundingBox.min.toArray(),max:r.boundingBox.max.toArray()}));function s(l,u){return l[u.uuid]===void 0&&(l[u.uuid]=u.toJSON(e)),u.uuid}if(this.isScene)this.background&&(this.background.isColor?r.background=this.background.toJSON():this.background.isTexture&&(r.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(r.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){r.geometry=s(e.geometries,this.geometry);const l=this.geometry.parameters;if(l!==void 0&&l.shapes!==void 0){const u=l.shapes;if(Array.isArray(u))for(let h=0,g=u.length;h0){r.children=[];for(let l=0;l0){r.animations=[];for(let l=0;l0&&(n.geometries=l),u.length>0&&(n.materials=u),h.length>0&&(n.textures=h),g.length>0&&(n.images=g),v.length>0&&(n.shapes=v),x.length>0&&(n.skeletons=x),S.length>0&&(n.animations=S),w.length>0&&(n.nodes=w)}return n.object=r,n;function a(l){const u=[];for(const h in l){const g=l[h];delete g.metadata,u.push(g)}return u}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let n=0;n0?r.multiplyScalar(1/Math.sqrt(s)):r.set(0,0,0)}static getBarycoord(e,t,n,r,s){vl.subVectors(r,t),pc.subVectors(n,t),l3.subVectors(e,t);const a=vl.dot(vl),l=vl.dot(pc),u=vl.dot(l3),h=pc.dot(pc),g=pc.dot(l3),v=a*h-l*l;if(v===0)return s.set(0,0,0),null;const x=1/v,S=(h*u-l*g)*x,w=(a*g-l*u)*x;return s.set(1-S-w,w,S)}static containsPoint(e,t,n,r){return this.getBarycoord(e,t,n,r,mc)===null?!1:mc.x>=0&&mc.y>=0&&mc.x+mc.y<=1}static getInterpolation(e,t,n,r,s,a,l,u){return this.getBarycoord(e,t,n,r,mc)===null?(u.x=0,u.y=0,"z"in u&&(u.z=0),"w"in u&&(u.w=0),null):(u.setScalar(0),u.addScaledVector(s,mc.x),u.addScaledVector(a,mc.y),u.addScaledVector(l,mc.z),u)}static getInterpolatedAttribute(e,t,n,r,s,a){return f3.setScalar(0),A3.setScalar(0),d3.setScalar(0),f3.fromBufferAttribute(e,t),A3.fromBufferAttribute(e,n),d3.fromBufferAttribute(e,r),a.setScalar(0),a.addScaledVector(f3,s.x),a.addScaledVector(A3,s.y),a.addScaledVector(d3,s.z),a}static isFrontFacing(e,t,n,r){return vl.subVectors(n,t),pc.subVectors(e,t),vl.cross(pc).dot(r)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,r){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[r]),this}setFromAttributeAndIndices(e,t,n,r){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,r),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return vl.subVectors(this.c,this.b),pc.subVectors(this.a,this.b),vl.cross(pc).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return Sl.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return Sl.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,n,r,s){return Sl.getInterpolation(e,this.a,this.b,this.c,t,n,r,s)}containsPoint(e){return Sl.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return Sl.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const n=this.a,r=this.b,s=this.c;let a,l;Ad.subVectors(r,n),dd.subVectors(s,n),u3.subVectors(e,n);const u=Ad.dot(u3),h=dd.dot(u3);if(u<=0&&h<=0)return t.copy(n);c3.subVectors(e,r);const g=Ad.dot(c3),v=dd.dot(c3);if(g>=0&&v<=g)return t.copy(r);const x=u*v-g*h;if(x<=0&&u>=0&&g<=0)return a=u/(u-g),t.copy(n).addScaledVector(Ad,a);h3.subVectors(e,s);const S=Ad.dot(h3),w=dd.dot(h3);if(w>=0&&S<=w)return t.copy(s);const R=S*h-u*w;if(R<=0&&h>=0&&w<=0)return l=h/(h-w),t.copy(n).addScaledVector(dd,l);const C=g*w-S*v;if(C<=0&&v-g>=0&&S-w>=0)return rC.subVectors(s,r),l=(v-g)/(v-g+(S-w)),t.copy(r).addScaledVector(rC,l);const E=1/(C+R+x);return a=R*E,l=x*E,t.copy(n).addScaledVector(Ad,a).addScaledVector(dd,l)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}const k7={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},_h={h:0,s:0,l:0},M2={h:0,s:0,l:0};function p3(i,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?i+(e-i)*6*t:t<1/2?e:t<2/3?i+(e-i)*6*(2/3-t):i}let sn=class{constructor(e,t,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,n)}set(e,t,n){if(t===void 0&&n===void 0){const r=e;r&&r.isColor?this.copy(r):typeof r=="number"?this.setHex(r):typeof r=="string"&&this.setStyle(r)}else this.setRGB(e,t,n);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=_n){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,ai.toWorkingColorSpace(this,t),this}setRGB(e,t,n,r=ai.workingColorSpace){return this.r=e,this.g=t,this.b=n,ai.toWorkingColorSpace(this,r),this}setHSL(e,t,n,r=ai.workingColorSpace){if(e=Vw(e,1),t=ni(t,0,1),n=ni(n,0,1),t===0)this.r=this.g=this.b=n;else{const s=n<=.5?n*(1+t):n+t-n*t,a=2*n-s;this.r=p3(a,s,e+1/3),this.g=p3(a,s,e),this.b=p3(a,s,e-1/3)}return ai.toWorkingColorSpace(this,r),this}setStyle(e,t=_n){function n(s){s!==void 0&&parseFloat(s)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let r;if(r=/^(\w+)\(([^\)]*)\)/.exec(e)){let s;const a=r[1],l=r[2];switch(a){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(l))return n(s[4]),this.setRGB(Math.min(255,parseInt(s[1],10))/255,Math.min(255,parseInt(s[2],10))/255,Math.min(255,parseInt(s[3],10))/255,t);if(s=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(l))return n(s[4]),this.setRGB(Math.min(100,parseInt(s[1],10))/100,Math.min(100,parseInt(s[2],10))/100,Math.min(100,parseInt(s[3],10))/100,t);break;case"hsl":case"hsla":if(s=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(l))return n(s[4]),this.setHSL(parseFloat(s[1])/360,parseFloat(s[2])/100,parseFloat(s[3])/100,t);break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(r=/^\#([A-Fa-f\d]+)$/.exec(e)){const s=r[1],a=s.length;if(a===3)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,t);if(a===6)return this.setHex(parseInt(s,16),t);console.warn("THREE.Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=_n){const n=k7[e.toLowerCase()];return n!==void 0?this.setHex(n,t):console.warn("THREE.Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=Mc(e.r),this.g=Mc(e.g),this.b=Mc(e.b),this}copyLinearToSRGB(e){return this.r=e0(e.r),this.g=e0(e.g),this.b=e0(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=_n){return ai.fromWorkingColorSpace(ea.copy(this),e),Math.round(ni(ea.r*255,0,255))*65536+Math.round(ni(ea.g*255,0,255))*256+Math.round(ni(ea.b*255,0,255))}getHexString(e=_n){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=ai.workingColorSpace){ai.fromWorkingColorSpace(ea.copy(this),t);const n=ea.r,r=ea.g,s=ea.b,a=Math.max(n,r,s),l=Math.min(n,r,s);let u,h;const g=(l+a)/2;if(l===a)u=0,h=0;else{const v=a-l;switch(h=g<=.5?v/(a+l):v/(2-a-l),a){case n:u=(r-s)/v+(r0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const t in e){const n=e[t];if(n===void 0){console.warn(`THREE.Material: parameter '${t}' has value of undefined.`);continue}const r=this[t];if(r===void 0){console.warn(`THREE.Material: '${t}' is not a property of THREE.${this.type}.`);continue}r&&r.isColor?r.set(n):r&&r.isVector3&&n&&n.isVector3?r.copy(n):this[t]=n}}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});const n={metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};n.uuid=this.uuid,n.type=this.type,this.name!==""&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),this.roughness!==void 0&&(n.roughness=this.roughness),this.metalness!==void 0&&(n.metalness=this.metalness),this.sheen!==void 0&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(n.shininess=this.shininess),this.clearcoat!==void 0&&(n.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.dispersion!==void 0&&(n.dispersion=this.dispersion),this.iridescence!==void 0&&(n.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(n.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(n.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(n.combine=this.combine)),this.envMapRotation!==void 0&&(n.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(n.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(n.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(n.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(n.size=this.size),this.shadowSide!==null&&(n.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==Ka&&(n.blending=this.blending),this.side!==Nl&&(n.side=this.side),this.vertexColors===!0&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),this.transparent===!0&&(n.transparent=!0),this.blendSrc!==qm&&(n.blendSrc=this.blendSrc),this.blendDst!==Vm&&(n.blendDst=this.blendDst),this.blendEquation!==Eo&&(n.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(n.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(n.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(n.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(n.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(n.blendAlpha=this.blendAlpha),this.depthFunc!==kh&&(n.depthFunc=this.depthFunc),this.depthTest===!1&&(n.depthTest=this.depthTest),this.depthWrite===!1&&(n.depthWrite=this.depthWrite),this.colorWrite===!1&&(n.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(n.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==jS&&(n.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(n.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==Uf&&(n.stencilFail=this.stencilFail),this.stencilZFail!==Uf&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==Uf&&(n.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(n.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(n.rotation=this.rotation),this.polygonOffset===!0&&(n.polygonOffset=!0),this.polygonOffsetFactor!==0&&(n.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(n.linewidth=this.linewidth),this.dashSize!==void 0&&(n.dashSize=this.dashSize),this.gapSize!==void 0&&(n.gapSize=this.gapSize),this.scale!==void 0&&(n.scale=this.scale),this.dithering===!0&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),this.alphaHash===!0&&(n.alphaHash=!0),this.alphaToCoverage===!0&&(n.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(n.premultipliedAlpha=!0),this.forceSinglePass===!0&&(n.forceSinglePass=!0),this.wireframe===!0&&(n.wireframe=!0),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(n.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(n.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(n.flatShading=!0),this.visible===!1&&(n.visible=!1),this.toneMapped===!1&&(n.toneMapped=!1),this.fog===!1&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData);function r(s){const a=[];for(const l in s){const u=s[l];delete u.metadata,a.push(u)}return a}if(t){const s=r(e.textures),a=r(e.images);s.length>0&&(n.textures=s),a.length>0&&(n.images=a)}return n}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const t=e.clippingPlanes;let n=null;if(t!==null){const r=t.length;n=new Array(r);for(let s=0;s!==r;++s)n[s]=t[s].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}onBuild(){console.warn("Material: onBuild() has been removed.")}}class pA extends ua{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new sn(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new la,this.combine=Lg,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}const bc=kk();function kk(){const i=new ArrayBuffer(4),e=new Float32Array(i),t=new Uint32Array(i),n=new Uint32Array(512),r=new Uint32Array(512);for(let u=0;u<256;++u){const h=u-127;h<-27?(n[u]=0,n[u|256]=32768,r[u]=24,r[u|256]=24):h<-14?(n[u]=1024>>-h-14,n[u|256]=1024>>-h-14|32768,r[u]=-h-1,r[u|256]=-h-1):h<=15?(n[u]=h+15<<10,n[u|256]=h+15<<10|32768,r[u]=13,r[u|256]=13):h<128?(n[u]=31744,n[u|256]=64512,r[u]=24,r[u|256]=24):(n[u]=31744,n[u|256]=64512,r[u]=13,r[u|256]=13)}const s=new Uint32Array(2048),a=new Uint32Array(64),l=new Uint32Array(64);for(let u=1;u<1024;++u){let h=u<<13,g=0;for(;(h&8388608)===0;)h<<=1,g-=8388608;h&=-8388609,g+=947912704,s[u]=h|g}for(let u=1024;u<2048;++u)s[u]=939524096+(u-1024<<13);for(let u=1;u<31;++u)a[u]=u<<23;a[31]=1199570944,a[32]=2147483648;for(let u=33;u<63;++u)a[u]=2147483648+(u-32<<23);a[63]=3347054592;for(let u=1;u<64;++u)u!==32&&(l[u]=1024);return{floatView:e,uint32View:t,baseTable:n,shiftTable:r,mantissaTable:s,exponentTable:a,offsetTable:l}}function mo(i){Math.abs(i)>65504&&console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."),i=ni(i,-65504,65504),bc.floatView[0]=i;const e=bc.uint32View[0],t=e>>23&511;return bc.baseTable[t]+((e&8388607)>>bc.shiftTable[t])}function E2(i){const e=i>>10;return bc.uint32View[0]=bc.mantissaTable[bc.offsetTable[e]+(i&1023)]+bc.exponentTable[e],bc.floatView[0]}const is=new ce,C2=new dt;class wr{constructor(e,t,n=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=n,this.usage=o_,this.updateRanges=[],this.gpuType=$r,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,n){e*=this.itemSize,n*=t.itemSize;for(let r=0,s=this.itemSize;rt.count&&console.warn("THREE.BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),t.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Gc);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new ce(-1/0,-1/0,-1/0),new ce(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let n=0,r=t.length;n0&&(e.userData=this.userData),this.parameters!==void 0){const u=this.parameters;for(const h in u)u[h]!==void 0&&(e[h]=u[h]);return e}e.data={attributes:{}};const t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});const n=this.attributes;for(const u in n){const h=n[u];e.data.attributes[u]=h.toJSON(e.data)}const r={};let s=!1;for(const u in this.morphAttributes){const h=this.morphAttributes[u],g=[];for(let v=0,x=h.length;v0&&(r[u]=g,s=!0)}s&&(e.data.morphAttributes=r,e.data.morphTargetsRelative=this.morphTargetsRelative);const a=this.groups;a.length>0&&(e.data.groups=JSON.parse(JSON.stringify(a)));const l=this.boundingSphere;return l!==null&&(e.data.boundingSphere={center:l.center.toArray(),radius:l.radius}),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const t={};this.name=e.name;const n=e.index;n!==null&&this.setIndex(n.clone(t));const r=e.attributes;for(const h in r){const g=r[h];this.setAttribute(h,g.clone(t))}const s=e.morphAttributes;for(const h in s){const g=[],v=s[h];for(let x=0,S=v.length;x0){const r=t[n[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=r.length;s(e.far-e.near)**2))&&(sC.copy(s).invert(),bf.copy(e.ray).applyMatrix4(sC),!(n.boundingBox!==null&&bf.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(e,t,bf)))}_computeIntersections(e,t,n){let r;const s=this.geometry,a=this.material,l=s.index,u=s.attributes.position,h=s.attributes.uv,g=s.attributes.uv1,v=s.attributes.normal,x=s.groups,S=s.drawRange;if(l!==null)if(Array.isArray(a))for(let w=0,R=x.length;wt.far?null:{distance:h,point:U2.clone(),object:i}}function B2(i,e,t,n,r,s,a,l,u,h){i.getVertexPosition(l,N2),i.getVertexPosition(u,D2),i.getVertexPosition(h,P2);const g=Gk(i,e,t,n,N2,D2,P2,oC);if(g){const v=new ce;Sl.getBarycoord(oC,N2,D2,P2,v),r&&(g.uv=Sl.getInterpolatedAttribute(r,l,u,h,v,new dt)),s&&(g.uv1=Sl.getInterpolatedAttribute(s,l,u,h,v,new dt)),a&&(g.normal=Sl.getInterpolatedAttribute(a,l,u,h,v,new ce),g.normal.dot(n.direction)>0&&g.normal.multiplyScalar(-1));const x={a:l,b:u,c:h,normal:new ce,materialIndex:0};Sl.getNormal(N2,D2,P2,x.normal),g.face=x,g.barycoord=v}return g}class $h extends Ki{constructor(e=1,t=1,n=1,r=1,s=1,a=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:r,heightSegments:s,depthSegments:a};const l=this;r=Math.floor(r),s=Math.floor(s),a=Math.floor(a);const u=[],h=[],g=[],v=[];let x=0,S=0;w("z","y","x",-1,-1,n,t,e,a,s,0),w("z","y","x",1,-1,n,t,-e,a,s,1),w("x","z","y",1,1,e,n,t,r,a,2),w("x","z","y",1,-1,e,n,-t,r,a,3),w("x","y","z",1,-1,e,t,n,r,s,4),w("x","y","z",-1,-1,e,t,-n,r,s,5),this.setIndex(u),this.setAttribute("position",new wi(h,3)),this.setAttribute("normal",new wi(g,3)),this.setAttribute("uv",new wi(v,2));function w(R,C,E,B,L,O,z,G,k,H,F){const V=O/k,X=z/H,J=O/2,te=z/2,se=G/2,ne=k+1,Z=H+1;let ue=0,he=0;const be=new ce;for(let Se=0;Se0?1:-1,g.push(be.x,be.y,be.z),v.push(we/k),v.push(1-Se/H),ue+=1}}for(let Se=0;Se0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;const n={};for(const r in this.extensions)this.extensions[r]===!0&&(n[r]=!0);return Object.keys(n).length>0&&(t.extensions=n),t}}class _y extends vr{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new kn,this.projectionMatrix=new kn,this.projectionMatrixInverse=new kn,this.coordinateSystem=Ha}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}}const yh=new ce,lC=new At,uC=new At;class ya extends _y{constructor(e=50,t=1,n=.1,r=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=n,this.far=r,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){const t=.5*this.getFilmHeight()/e;this.fov=w0*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(Em*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return w0*2*Math.atan(Math.tan(Em*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(e,t,n){yh.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(yh.x,yh.y).multiplyScalar(-e/yh.z),yh.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(yh.x,yh.y).multiplyScalar(-e/yh.z)}getViewSize(e,t){return this.getViewBounds(e,lC,uC),t.subVectors(uC,lC)}setViewOffset(e,t,n,r,s,a){this.aspect=e/t,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=r,this.view.width=s,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let t=e*Math.tan(Em*.5*this.fov)/this.zoom,n=2*t,r=this.aspect*n,s=-.5*r;const a=this.view;if(this.view!==null&&this.view.enabled){const u=a.fullWidth,h=a.fullHeight;s+=a.offsetX*r/u,t-=a.offsetY*n/h,r*=a.width/u,n*=a.height/h}const l=this.filmOffset;l!==0&&(s+=e*l/this.getFilmWidth()),this.projectionMatrix.makePerspective(s,s+r,t,t-n,e,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,this.view!==null&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}const md=-90,gd=1;class q7 extends vr{constructor(e,t,n){super(),this.type="CubeCamera",this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;const r=new ya(md,gd,e,t);r.layers=this.layers,this.add(r);const s=new ya(md,gd,e,t);s.layers=this.layers,this.add(s);const a=new ya(md,gd,e,t);a.layers=this.layers,this.add(a);const l=new ya(md,gd,e,t);l.layers=this.layers,this.add(l);const u=new ya(md,gd,e,t);u.layers=this.layers,this.add(u);const h=new ya(md,gd,e,t);h.layers=this.layers,this.add(h)}updateCoordinateSystem(){const e=this.coordinateSystem,t=this.children.concat(),[n,r,s,a,l,u]=t;for(const h of t)this.remove(h);if(e===Ha)n.up.set(0,1,0),n.lookAt(1,0,0),r.up.set(0,1,0),r.lookAt(-1,0,0),s.up.set(0,0,-1),s.lookAt(0,1,0),a.up.set(0,0,1),a.lookAt(0,-1,0),l.up.set(0,1,0),l.lookAt(0,0,1),u.up.set(0,1,0),u.lookAt(0,0,-1);else if(e===pu)n.up.set(0,-1,0),n.lookAt(-1,0,0),r.up.set(0,-1,0),r.lookAt(1,0,0),s.up.set(0,0,1),s.lookAt(0,1,0),a.up.set(0,0,-1),a.lookAt(0,-1,0),l.up.set(0,-1,0),l.lookAt(0,0,1),u.up.set(0,-1,0),u.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(const h of t)this.add(h),h.updateMatrixWorld()}update(e,t){this.parent===null&&this.updateMatrixWorld();const{renderTarget:n,activeMipmapLevel:r}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());const[s,a,l,u,h,g]=this.children,v=e.getRenderTarget(),x=e.getActiveCubeFace(),S=e.getActiveMipmapLevel(),w=e.xr.enabled;e.xr.enabled=!1;const R=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,e.setRenderTarget(n,0,r),e.render(t,s),e.setRenderTarget(n,1,r),e.render(t,a),e.setRenderTarget(n,2,r),e.render(t,l),e.setRenderTarget(n,3,r),e.render(t,u),e.setRenderTarget(n,4,r),e.render(t,h),n.texture.generateMipmaps=R,e.setRenderTarget(n,5,r),e.render(t,g),e.setRenderTarget(v,x,S),e.xr.enabled=w,n.texture.needsPMREMUpdate=!0}}class yy extends vs{constructor(e,t,n,r,s,a,l,u,h,g){e=e!==void 0?e:[],t=t!==void 0?t:Qo,super(e,t,n,r,s,a,l,u,h,g),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class V7 extends qh{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;const n={width:e,height:e,depth:1},r=[n,n,n,n,n,n];this.texture=new yy(r,t.mapping,t.wrapS,t.wrapT,t.magFilter,t.minFilter,t.format,t.type,t.anisotropy,t.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=t.generateMipmaps!==void 0?t.generateMipmaps:!1,this.texture.minFilter=t.minFilter!==void 0?t.minFilter:gs}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;const n={uniforms:{tEquirect:{value:null}},vertexShader:` +}`;class Ja extends ua{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=Vk,this.fragmentShader=Hk,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={clipCullDistance:!1,multiDraw:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,e!==void 0&&this.setValues(e)}copy(e){return super.copy(e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=E0(e.uniforms),this.uniformsGroups=qk(e.uniformsGroups),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.fog=e.fog,this.lights=e.lights,this.clipping=e.clipping,this.extensions=Object.assign({},e.extensions),this.glslVersion=e.glslVersion,this}toJSON(e){const t=super.toJSON(e);t.glslVersion=this.glslVersion,t.uniforms={};for(const r in this.uniforms){const a=this.uniforms[r].value;a&&a.isTexture?t.uniforms[r]={type:"t",value:a.toJSON(e).uuid}:a&&a.isColor?t.uniforms[r]={type:"c",value:a.getHex()}:a&&a.isVector2?t.uniforms[r]={type:"v2",value:a.toArray()}:a&&a.isVector3?t.uniforms[r]={type:"v3",value:a.toArray()}:a&&a.isVector4?t.uniforms[r]={type:"v4",value:a.toArray()}:a&&a.isMatrix3?t.uniforms[r]={type:"m3",value:a.toArray()}:a&&a.isMatrix4?t.uniforms[r]={type:"m4",value:a.toArray()}:t.uniforms[r]={value:a}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;const n={};for(const r in this.extensions)this.extensions[r]===!0&&(n[r]=!0);return Object.keys(n).length>0&&(t.extensions=n),t}}class _y extends vr{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new kn,this.projectionMatrix=new kn,this.projectionMatrixInverse=new kn,this.coordinateSystem=Ha}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}}const yh=new ce,lC=new dt,uC=new dt;class ya extends _y{constructor(e=50,t=1,n=.1,r=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=n,this.far=r,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){const t=.5*this.getFilmHeight()/e;this.fov=w0*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(Em*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return w0*2*Math.atan(Math.tan(Em*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(e,t,n){yh.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(yh.x,yh.y).multiplyScalar(-e/yh.z),yh.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(yh.x,yh.y).multiplyScalar(-e/yh.z)}getViewSize(e,t){return this.getViewBounds(e,lC,uC),t.subVectors(uC,lC)}setViewOffset(e,t,n,r,s,a){this.aspect=e/t,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=r,this.view.width=s,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let t=e*Math.tan(Em*.5*this.fov)/this.zoom,n=2*t,r=this.aspect*n,s=-.5*r;const a=this.view;if(this.view!==null&&this.view.enabled){const u=a.fullWidth,h=a.fullHeight;s+=a.offsetX*r/u,t-=a.offsetY*n/h,r*=a.width/u,n*=a.height/h}const l=this.filmOffset;l!==0&&(s+=e*l/this.getFilmWidth()),this.projectionMatrix.makePerspective(s,s+r,t,t-n,e,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,this.view!==null&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}const md=-90,gd=1;class q7 extends vr{constructor(e,t,n){super(),this.type="CubeCamera",this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;const r=new ya(md,gd,e,t);r.layers=this.layers,this.add(r);const s=new ya(md,gd,e,t);s.layers=this.layers,this.add(s);const a=new ya(md,gd,e,t);a.layers=this.layers,this.add(a);const l=new ya(md,gd,e,t);l.layers=this.layers,this.add(l);const u=new ya(md,gd,e,t);u.layers=this.layers,this.add(u);const h=new ya(md,gd,e,t);h.layers=this.layers,this.add(h)}updateCoordinateSystem(){const e=this.coordinateSystem,t=this.children.concat(),[n,r,s,a,l,u]=t;for(const h of t)this.remove(h);if(e===Ha)n.up.set(0,1,0),n.lookAt(1,0,0),r.up.set(0,1,0),r.lookAt(-1,0,0),s.up.set(0,0,-1),s.lookAt(0,1,0),a.up.set(0,0,1),a.lookAt(0,-1,0),l.up.set(0,1,0),l.lookAt(0,0,1),u.up.set(0,1,0),u.lookAt(0,0,-1);else if(e===pu)n.up.set(0,-1,0),n.lookAt(-1,0,0),r.up.set(0,-1,0),r.lookAt(1,0,0),s.up.set(0,0,1),s.lookAt(0,1,0),a.up.set(0,0,-1),a.lookAt(0,-1,0),l.up.set(0,-1,0),l.lookAt(0,0,1),u.up.set(0,-1,0),u.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(const h of t)this.add(h),h.updateMatrixWorld()}update(e,t){this.parent===null&&this.updateMatrixWorld();const{renderTarget:n,activeMipmapLevel:r}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());const[s,a,l,u,h,g]=this.children,v=e.getRenderTarget(),x=e.getActiveCubeFace(),S=e.getActiveMipmapLevel(),w=e.xr.enabled;e.xr.enabled=!1;const R=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,e.setRenderTarget(n,0,r),e.render(t,s),e.setRenderTarget(n,1,r),e.render(t,a),e.setRenderTarget(n,2,r),e.render(t,l),e.setRenderTarget(n,3,r),e.render(t,u),e.setRenderTarget(n,4,r),e.render(t,h),n.texture.generateMipmaps=R,e.setRenderTarget(n,5,r),e.render(t,g),e.setRenderTarget(v,x,S),e.xr.enabled=w,n.texture.needsPMREMUpdate=!0}}class yy extends vs{constructor(e,t,n,r,s,a,l,u,h,g){e=e!==void 0?e:[],t=t!==void 0?t:Qo,super(e,t,n,r,s,a,l,u,h,g),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class V7 extends qh{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;const n={width:e,height:e,depth:1},r=[n,n,n,n,n,n];this.texture=new yy(r,t.mapping,t.wrapS,t.wrapT,t.magFilter,t.minFilter,t.format,t.type,t.anisotropy,t.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=t.generateMipmaps!==void 0?t.generateMipmaps:!1,this.texture.minFilter=t.minFilter!==void 0?t.minFilter:gs}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;const n={uniforms:{tEquirect:{value:null}},vertexShader:` varying vec3 vWorldDirection; @@ -89,7 +89,7 @@ Error generating stack: `+b.message+` gl_FragColor = texture2D( tEquirect, sampleUV ); } - `},r=new $h(5,5,5),s=new Ja({name:"CubemapFromEquirect",uniforms:E0(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:hr,blending:Qa});s.uniforms.tEquirect.value=t;const a=new zi(r,s),l=t.minFilter;return t.minFilter===Va&&(t.minFilter=gs),new q7(1,10,this).update(e,a),t.minFilter=l,a.geometry.dispose(),a.material.dispose(),this}clear(e,t,n,r){const s=e.getRenderTarget();for(let a=0;a<6;a++)e.setRenderTarget(this,a),e.clear(t,n,r);e.setRenderTarget(s)}}class Xw extends vr{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new la,this.environmentIntensity=1,this.environmentRotation=new la,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,this.backgroundRotation.copy(e.backgroundRotation),this.environmentIntensity=e.environmentIntensity,this.environmentRotation.copy(e.environmentRotation),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.object.backgroundIntensity=this.backgroundIntensity),t.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(t.object.environmentIntensity=this.environmentIntensity),t.object.environmentRotation=this.environmentRotation.toArray(),t}}class Yw{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=o_,this.updateRanges=[],this.version=0,this.uuid=ou()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,n){e*=this.stride,n*=t.stride;for(let r=0,s=this.stride;r1?null:t.copy(e.start).addScaledVector(n,s)}intersectsLine(e){const t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){const n=t||Xk.getNormalMatrix(e),r=this.coplanarPoint(v3).applyMatrix4(e),s=this.normal.applyMatrix3(n).normalize();return this.constant=-r.dot(s),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}}const Sf=new dA,O2=new ce;class Fg{constructor(e=new Yl,t=new Yl,n=new Yl,r=new Yl,s=new Yl,a=new Yl){this.planes=[e,t,n,r,s,a]}set(e,t,n,r,s,a){const l=this.planes;return l[0].copy(e),l[1].copy(t),l[2].copy(n),l[3].copy(r),l[4].copy(s),l[5].copy(a),this}copy(e){const t=this.planes;for(let n=0;n<6;n++)t[n].copy(e.planes[n]);return this}setFromProjectionMatrix(e,t=Ha){const n=this.planes,r=e.elements,s=r[0],a=r[1],l=r[2],u=r[3],h=r[4],g=r[5],v=r[6],x=r[7],S=r[8],w=r[9],R=r[10],C=r[11],E=r[12],B=r[13],L=r[14],O=r[15];if(n[0].setComponents(u-s,x-h,C-S,O-E).normalize(),n[1].setComponents(u+s,x+h,C+S,O+E).normalize(),n[2].setComponents(u+a,x+g,C+w,O+B).normalize(),n[3].setComponents(u-a,x-g,C-w,O-B).normalize(),n[4].setComponents(u-l,x-v,C-R,O-L).normalize(),t===Ha)n[5].setComponents(u+l,x+v,C+R,O+L).normalize();else if(t===pu)n[5].setComponents(l,v,R,L).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),Sf.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),Sf.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(Sf)}intersectsSprite(e){return Sf.center.set(0,0,0),Sf.radius=.7071067811865476,Sf.applyMatrix4(e.matrixWorld),this.intersectsSphere(Sf)}intersectsSphere(e){const t=this.planes,n=e.center,r=-e.radius;for(let s=0;s<6;s++)if(t[s].distanceToPoint(n)0?e.max.x:e.min.x,O2.y=r.normal.y>0?e.max.y:e.min.y,O2.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(O2)<0)return!1}return!0}containsPoint(e){const t=this.planes;for(let n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}class $0 extends ua{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new sn(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}}const l_=new ce,u_=new ce,cC=new kn,Jp=new Og,I2=new dA,_3=new ce,hC=new ce;class xy extends vr{constructor(e=new Ki,t=new $0){super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,n=[0];for(let r=1,s=t.count;r0){const r=t[n[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=r.length;sn)return;_3.applyMatrix4(i.matrixWorld);const u=e.ray.origin.distanceTo(_3);if(!(ue.far))return{distance:u,point:hC.clone().applyMatrix4(i.matrixWorld),index:r,face:null,faceIndex:null,barycoord:null,object:i}}const fC=new ce,AC=new ce;class H7 extends xy{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,n=[];for(let r=0,s=t.count;r0){const r=t[n[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=r.length;sr.far)return;s.push({distance:h,distanceToRay:Math.sqrt(l),point:u,index:e,face:null,faceIndex:null,barycoord:null,object:a})}}let ja=class extends vr{constructor(){super(),this.isGroup=!0,this.type="Group"}};class j7 extends vs{constructor(e,t){super({width:e,height:t}),this.isFramebufferTexture=!0,this.magFilter=mr,this.minFilter=mr,this.generateMipmaps=!1,this.needsUpdate=!0}}class qc extends vs{constructor(e,t,n,r,s,a,l,u,h,g=au){if(g!==au&&g!==du)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");n===void 0&&g===au&&(n=Rr),n===void 0&&g===du&&(n=Au),super(null,r,s,a,l,u,g,n,h),this.isDepthTexture=!0,this.image={width:e,height:t},this.magFilter=l!==void 0?l:mr,this.minFilter=u!==void 0?u:mr,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.compareFunction=e.compareFunction,this}toJSON(e){const t=super.toJSON(e);return this.compareFunction!==null&&(t.compareFunction=this.compareFunction),t}}class Pl{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(e,t){const n=this.getUtoTmapping(e);return this.getPoint(n,t)}getPoints(e=5){const t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return t}getSpacedPoints(e=5){const t=[];for(let n=0;n<=e;n++)t.push(this.getPointAt(n/e));return t}getLength(){const e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const t=[];let n,r=this.getPoint(0),s=0;t.push(0);for(let a=1;a<=e;a++)n=this.getPoint(a/e),s+=n.distanceTo(r),t.push(s),r=n;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t){const n=this.getLengths();let r=0;const s=n.length;let a;t?a=t:a=e*n[s-1];let l=0,u=s-1,h;for(;l<=u;)if(r=Math.floor(l+(u-l)/2),h=n[r]-a,h<0)l=r+1;else if(h>0)u=r-1;else{u=r;break}if(r=u,n[r]===a)return r/(s-1);const g=n[r],x=n[r+1]-g,S=(a-g)/x;return(r+S)/(s-1)}getTangent(e,t){let r=e-1e-4,s=e+1e-4;r<0&&(r=0),s>1&&(s=1);const a=this.getPoint(r),l=this.getPoint(s),u=t||(a.isVector2?new At:new ce);return u.copy(l).sub(a).normalize(),u}getTangentAt(e,t){const n=this.getUtoTmapping(e);return this.getTangent(n,t)}computeFrenetFrames(e,t){const n=new ce,r=[],s=[],a=[],l=new ce,u=new kn;for(let S=0;S<=e;S++){const w=S/e;r[S]=this.getTangentAt(w,new ce)}s[0]=new ce,a[0]=new ce;let h=Number.MAX_VALUE;const g=Math.abs(r[0].x),v=Math.abs(r[0].y),x=Math.abs(r[0].z);g<=h&&(h=g,n.set(1,0,0)),v<=h&&(h=v,n.set(0,1,0)),x<=h&&n.set(0,0,1),l.crossVectors(r[0],n).normalize(),s[0].crossVectors(r[0],l),a[0].crossVectors(r[0],s[0]);for(let S=1;S<=e;S++){if(s[S]=s[S-1].clone(),a[S]=a[S-1].clone(),l.crossVectors(r[S-1],r[S]),l.length()>Number.EPSILON){l.normalize();const w=Math.acos(ni(r[S-1].dot(r[S]),-1,1));s[S].applyMatrix4(u.makeRotationAxis(l,w))}a[S].crossVectors(r[S],s[S])}if(t===!0){let S=Math.acos(ni(s[0].dot(s[e]),-1,1));S/=e,r[0].dot(l.crossVectors(s[0],s[e]))>0&&(S=-S);for(let w=1;w<=e;w++)s[w].applyMatrix4(u.makeRotationAxis(r[w],S*w)),a[w].crossVectors(r[w],s[w])}return{tangents:r,normals:s,binormals:a}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){const e={metadata:{version:4.6,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}class Kw extends Pl{constructor(e=0,t=0,n=1,r=1,s=0,a=Math.PI*2,l=!1,u=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=n,this.yRadius=r,this.aStartAngle=s,this.aEndAngle=a,this.aClockwise=l,this.aRotation=u}getPoint(e,t=new At){const n=t,r=Math.PI*2;let s=this.aEndAngle-this.aStartAngle;const a=Math.abs(s)r;)s-=r;s0?0:(Math.floor(Math.abs(l)/s)+1)*s:u===0&&l===s-1&&(l=s-2,u=1);let h,g;this.closed||l>0?h=r[(l-1)%s]:(G2.subVectors(r[0],r[1]).add(r[0]),h=G2);const v=r[l%s],x=r[(l+1)%s];if(this.closed||l+2r.length-2?r.length-1:a+1],v=r[a>r.length-3?r.length-1:a+2];return n.set(mC(l,u.x,h.x,g.x,v.x),mC(l,u.y,h.y,g.y,v.y)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t=n){const a=r[s]-n,l=this.curves[s],u=l.getLength(),h=u===0?0:1-a/u;return l.getPointAt(h,t)}s++}return null}getLength(){const e=this.getCurveLengths();return e[e.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const e=[];let t=0;for(let n=0,r=this.curves.length;n1&&!t[t.length-1].equals(t[0])&&t.push(t[0]),t}copy(e){super.copy(e),this.curves=[];for(let t=0,n=e.curves.length;t0){const v=h.getPoint(0);v.equals(this.currentPoint)||this.lineTo(v.x,v.y)}this.curves.push(h);const g=h.getPoint(1);return this.currentPoint.copy(g),this}copy(e){return super.copy(e),this.currentPoint.copy(e.currentPoint),this}toJSON(){const e=super.toJSON();return e.currentPoint=this.currentPoint.toArray(),e}fromJSON(e){return super.fromJSON(e),this.currentPoint.fromArray(e.currentPoint),this}};class by extends Ki{constructor(e=1,t=32,n=0,r=Math.PI*2){super(),this.type="CircleGeometry",this.parameters={radius:e,segments:t,thetaStart:n,thetaLength:r},t=Math.max(3,t);const s=[],a=[],l=[],u=[],h=new ce,g=new At;a.push(0,0,0),l.push(0,0,1),u.push(.5,.5);for(let v=0,x=3;v<=t;v++,x+=3){const S=n+v/t*r;h.x=e*Math.cos(S),h.y=e*Math.sin(S),a.push(h.x,h.y,h.z),l.push(0,0,1),g.x=(a[x]/e+1)/2,g.y=(a[x+1]/e+1)/2,u.push(g.x,g.y)}for(let v=1;v<=t;v++)s.push(v,v+1,0);this.setIndex(s),this.setAttribute("position",new wi(a,3)),this.setAttribute("normal",new wi(l,3)),this.setAttribute("uv",new wi(u,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new by(e.radius,e.segments,e.thetaStart,e.thetaLength)}}class Jw extends Ki{constructor(e=1,t=1,n=1,r=32,s=1,a=!1,l=0,u=Math.PI*2){super(),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:n,radialSegments:r,heightSegments:s,openEnded:a,thetaStart:l,thetaLength:u};const h=this;r=Math.floor(r),s=Math.floor(s);const g=[],v=[],x=[],S=[];let w=0;const R=[],C=n/2;let E=0;B(),a===!1&&(e>0&&L(!0),t>0&&L(!1)),this.setIndex(g),this.setAttribute("position",new wi(v,3)),this.setAttribute("normal",new wi(x,3)),this.setAttribute("uv",new wi(S,2));function B(){const O=new ce,z=new ce;let G=0;const k=(t-e)/n;for(let H=0;H<=s;H++){const F=[],V=H/s,X=V*(t-e)+e;for(let J=0;J<=r;J++){const te=J/r,se=te*u+l,ne=Math.sin(se),Z=Math.cos(se);z.x=X*ne,z.y=-V*n+C,z.z=X*Z,v.push(z.x,z.y,z.z),O.set(ne,k,Z).normalize(),x.push(O.x,O.y,O.z),S.push(te,1-V),F.push(w++)}R.push(F)}for(let H=0;H0||F!==0)&&(g.push(V,X,te),G+=3),(t>0||F!==s-1)&&(g.push(X,J,te),G+=3)}h.addGroup(E,G,0),E+=G}function L(O){const z=w,G=new At,k=new ce;let H=0;const F=O===!0?e:t,V=O===!0?1:-1;for(let J=1;J<=r;J++)v.push(0,C*V,0),x.push(0,V,0),S.push(.5,.5),w++;const X=w;for(let J=0;J<=r;J++){const se=J/r*u+l,ne=Math.cos(se),Z=Math.sin(se);k.x=F*Z,k.y=C*V,k.z=F*ne,v.push(k.x,k.y,k.z),x.push(0,V,0),G.x=ne*.5+.5,G.y=Z*.5*V+.5,S.push(G.x,G.y),w++}for(let J=0;J80*t){l=h=i[0],u=g=i[1];for(let w=t;wh&&(h=v),x>g&&(g=x);S=Math.max(h-l,g-u),S=S!==0?32767/S:0}return ag(s,a,t,l,u,S,0),a}};function Z7(i,e,t,n,r){let s,a;if(r===Sz(i,e,t,n)>0)for(s=e;s=e;s-=n)a=gC(s,i[s],i[s+1],a);return a&&Sy(a,a.next)&&(lg(a),a=a.next),a}function uA(i,e){if(!i)return i;e||(e=i);let t=i,n;do if(n=!1,!t.steiner&&(Sy(t,t.next)||Nr(t.prev,t,t.next)===0)){if(lg(t),t=e=t.prev,t===t.next)break;n=!0}else t=t.next;while(n||t!==e);return e}function ag(i,e,t,n,r,s,a){if(!i)return;!a&&s&&gz(i,n,r,s);let l=i,u,h;for(;i.prev!==i.next;){if(u=i.prev,h=i.next,s?uz(i,n,r,s):lz(i)){e.push(u.i/t|0),e.push(i.i/t|0),e.push(h.i/t|0),lg(i),i=h.next,l=h.next;continue}if(i=h,i===l){a?a===1?(i=cz(uA(i),e,t),ag(i,e,t,n,r,s,2)):a===2&&hz(i,e,t,n,r,s):ag(uA(i),e,t,n,r,s,1);break}}}function lz(i){const e=i.prev,t=i,n=i.next;if(Nr(e,t,n)>=0)return!1;const r=e.x,s=t.x,a=n.x,l=e.y,u=t.y,h=n.y,g=rs?r>a?r:a:s>a?s:a,S=l>u?l>h?l:h:u>h?u:h;let w=n.next;for(;w!==e;){if(w.x>=g&&w.x<=x&&w.y>=v&&w.y<=S&&Vd(r,l,s,u,a,h,w.x,w.y)&&Nr(w.prev,w,w.next)>=0)return!1;w=w.next}return!0}function uz(i,e,t,n){const r=i.prev,s=i,a=i.next;if(Nr(r,s,a)>=0)return!1;const l=r.x,u=s.x,h=a.x,g=r.y,v=s.y,x=a.y,S=lu?l>h?l:h:u>h?u:h,C=g>v?g>x?g:x:v>x?v:x,E=XS(S,w,e,t,n),B=XS(R,C,e,t,n);let L=i.prevZ,O=i.nextZ;for(;L&&L.z>=E&&O&&O.z<=B;){if(L.x>=S&&L.x<=R&&L.y>=w&&L.y<=C&&L!==r&&L!==a&&Vd(l,g,u,v,h,x,L.x,L.y)&&Nr(L.prev,L,L.next)>=0||(L=L.prevZ,O.x>=S&&O.x<=R&&O.y>=w&&O.y<=C&&O!==r&&O!==a&&Vd(l,g,u,v,h,x,O.x,O.y)&&Nr(O.prev,O,O.next)>=0))return!1;O=O.nextZ}for(;L&&L.z>=E;){if(L.x>=S&&L.x<=R&&L.y>=w&&L.y<=C&&L!==r&&L!==a&&Vd(l,g,u,v,h,x,L.x,L.y)&&Nr(L.prev,L,L.next)>=0)return!1;L=L.prevZ}for(;O&&O.z<=B;){if(O.x>=S&&O.x<=R&&O.y>=w&&O.y<=C&&O!==r&&O!==a&&Vd(l,g,u,v,h,x,O.x,O.y)&&Nr(O.prev,O,O.next)>=0)return!1;O=O.nextZ}return!0}function cz(i,e,t){let n=i;do{const r=n.prev,s=n.next.next;!Sy(r,s)&&J7(r,n,n.next,s)&&og(r,s)&&og(s,r)&&(e.push(r.i/t|0),e.push(n.i/t|0),e.push(s.i/t|0),lg(n),lg(n.next),n=i=s),n=n.next}while(n!==i);return uA(n)}function hz(i,e,t,n,r,s){let a=i;do{let l=a.next.next;for(;l!==a.prev;){if(a.i!==l.i&&yz(a,l)){let u=eD(a,l);a=uA(a,a.next),u=uA(u,u.next),ag(a,e,t,n,r,s,0),ag(u,e,t,n,r,s,0);return}l=l.next}a=a.next}while(a!==i)}function fz(i,e,t,n){const r=[];let s,a,l,u,h;for(s=0,a=e.length;s=t.next.y&&t.next.y!==t.y){const x=t.x+(a-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(x<=s&&x>n&&(n=x,r=t.x=t.x&&t.x>=u&&s!==t.x&&Vd(ar.x||t.x===r.x&&mz(r,t)))&&(r=t,g=v)),t=t.next;while(t!==l);return r}function mz(i,e){return Nr(i.prev,i,e.prev)<0&&Nr(e.next,i,i.next)<0}function gz(i,e,t,n){let r=i;do r.z===0&&(r.z=XS(r.x,r.y,e,t,n)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next;while(r!==i);r.prevZ.nextZ=null,r.prevZ=null,vz(r)}function vz(i){let e,t,n,r,s,a,l,u,h=1;do{for(t=i,i=null,s=null,a=0;t;){for(a++,n=t,l=0,e=0;e0||u>0&&n;)l!==0&&(u===0||!n||t.z<=n.z)?(r=t,t=t.nextZ,l--):(r=n,n=n.nextZ,u--),s?s.nextZ=r:i=r,r.prevZ=s,s=r;t=n}s.nextZ=null,h*=2}while(a>1);return i}function XS(i,e,t,n,r){return i=(i-t)*r|0,e=(e-n)*r|0,i=(i|i<<8)&16711935,i=(i|i<<4)&252645135,i=(i|i<<2)&858993459,i=(i|i<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,i|e<<1}function _z(i){let e=i,t=i;do(e.x=(i-a)*(s-l)&&(i-a)*(n-l)>=(t-a)*(e-l)&&(t-a)*(s-l)>=(r-a)*(n-l)}function yz(i,e){return i.next.i!==e.i&&i.prev.i!==e.i&&!xz(i,e)&&(og(i,e)&&og(e,i)&&bz(i,e)&&(Nr(i.prev,i,e.prev)||Nr(i,e.prev,e))||Sy(i,e)&&Nr(i.prev,i,i.next)>0&&Nr(e.prev,e,e.next)>0)}function Nr(i,e,t){return(e.y-i.y)*(t.x-e.x)-(e.x-i.x)*(t.y-e.y)}function Sy(i,e){return i.x===e.x&&i.y===e.y}function J7(i,e,t,n){const r=V2(Nr(i,e,t)),s=V2(Nr(i,e,n)),a=V2(Nr(t,n,i)),l=V2(Nr(t,n,e));return!!(r!==s&&a!==l||r===0&&q2(i,t,e)||s===0&&q2(i,n,e)||a===0&&q2(t,i,n)||l===0&&q2(t,e,n))}function q2(i,e,t){return e.x<=Math.max(i.x,t.x)&&e.x>=Math.min(i.x,t.x)&&e.y<=Math.max(i.y,t.y)&&e.y>=Math.min(i.y,t.y)}function V2(i){return i>0?1:i<0?-1:0}function xz(i,e){let t=i;do{if(t.i!==i.i&&t.next.i!==i.i&&t.i!==e.i&&t.next.i!==e.i&&J7(t,t.next,i,e))return!0;t=t.next}while(t!==i);return!1}function og(i,e){return Nr(i.prev,i,i.next)<0?Nr(i,e,i.next)>=0&&Nr(i,i.prev,e)>=0:Nr(i,e,i.prev)<0||Nr(i,i.next,e)<0}function bz(i,e){let t=i,n=!1;const r=(i.x+e.x)/2,s=(i.y+e.y)/2;do t.y>s!=t.next.y>s&&t.next.y!==t.y&&r<(t.next.x-t.x)*(s-t.y)/(t.next.y-t.y)+t.x&&(n=!n),t=t.next;while(t!==i);return n}function eD(i,e){const t=new YS(i.i,i.x,i.y),n=new YS(e.i,e.x,e.y),r=i.next,s=e.prev;return i.next=e,e.prev=i,t.next=r,r.prev=t,n.next=t,t.prev=n,s.next=n,n.prev=s,n}function gC(i,e,t,n){const r=new YS(i,e,t);return n?(r.next=n.next,r.prev=n,n.next.prev=r,n.next=r):(r.prev=r,r.next=r),r}function lg(i){i.next.prev=i.prev,i.prev.next=i.next,i.prevZ&&(i.prevZ.nextZ=i.nextZ),i.nextZ&&(i.nextZ.prevZ=i.prevZ)}function YS(i,e,t){this.i=i,this.x=e,this.y=t,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function Sz(i,e,t,n){let r=0;for(let s=e,a=t-n;s2&&i[e-1].equals(i[0])&&i.pop()}function _C(i,e){for(let t=0;tNumber.EPSILON){const $e=Math.sqrt(Y),it=Math.sqrt(bt*bt+fe*fe),tt=ke.x-tn/$e,Vt=ke.y+wt/$e,Bt=oe.x-fe/it,Wt=oe.y+bt/it,ln=((Bt-tt)*fe-(Wt-Vt)*bt)/(wt*fe-tn*bt);Mt=tt+wt*ln-Be.x,lt=Vt+tn*ln-Be.y;const St=Mt*Mt+lt*lt;if(St<=2)return new At(Mt,lt);Dt=Math.sqrt(St/2)}else{let $e=!1;wt>Number.EPSILON?bt>Number.EPSILON&&($e=!0):wt<-Number.EPSILON?bt<-Number.EPSILON&&($e=!0):Math.sign(tn)===Math.sign(fe)&&($e=!0),$e?(Mt=-tn,lt=wt,Dt=Math.sqrt(Y)):(Mt=wt,lt=tn,Dt=Math.sqrt(Y/2))}return new At(Mt/Dt,lt/Dt)}const be=[];for(let Be=0,ke=se.length,oe=ke-1,Mt=Be+1;Be=0;Be--){const ke=Be/C,oe=S*Math.cos(ke*Math.PI/2),Mt=w*Math.sin(ke*Math.PI/2)+R;for(let lt=0,Dt=se.length;lt=0;){const Mt=oe;let lt=oe-1;lt<0&&(lt=Be.length-1);for(let Dt=0,wt=g+C*2;Dt0)&&S.push(L,O,G),(E!==n-1||u0!=e>0&&this.version++,this._anisotropy=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get iridescence(){return this._iridescence}set iridescence(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=e}get dispersion(){return this._dispersion}set dispersion(e){this._dispersion>0!=e>0&&this.version++,this._dispersion=e}get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=e.anisotropy,this.anisotropyRotation=e.anisotropyRotation,this.anisotropyMap=e.anisotropyMap,this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.dispersion=e.dispersion,this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=[...e.iridescenceThicknessRange],this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}}class nD extends ua{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new sn(16777215),this.specular=new sn(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new sn(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Dc,this.normalScale=new At(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new la,this.combine=Lg,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class Rz extends ua{constructor(e){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new sn(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new sn(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Dc,this.normalScale=new At(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.gradientMap=e.gradientMap,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}class Nz extends ua{constructor(e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Dc,this.normalScale=new At(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(e),this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this}}class Vc extends ua{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new sn(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new sn(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Dc,this.normalScale=new At(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new la,this.combine=Lg,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class Dz extends ua{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=jF,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}}class Pz extends ua{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}class Lz extends ua{constructor(e){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new sn(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Dc,this.normalScale=new At(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={MATCAP:""},this.color.copy(e.color),this.matcap=e.matcap,this.map=e.map,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.flatShading=e.flatShading,this.fog=e.fog,this}}class Uz extends $0{constructor(e){super(),this.isLineDashedMaterial=!0,this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(e)}copy(e){return super.copy(e),this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this}}const xC={enabled:!1,files:{},add:function(i,e){this.enabled!==!1&&(this.files[i]=e)},get:function(i){if(this.enabled!==!1)return this.files[i]},remove:function(i){delete this.files[i]},clear:function(){this.files={}}};class Bz{constructor(e,t,n){const r=this;let s=!1,a=0,l=0,u;const h=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=n,this.itemStart=function(g){l++,s===!1&&r.onStart!==void 0&&r.onStart(g,a,l),s=!0},this.itemEnd=function(g){a++,r.onProgress!==void 0&&r.onProgress(g,a,l),a===l&&(s=!1,r.onLoad!==void 0&&r.onLoad())},this.itemError=function(g){r.onError!==void 0&&r.onError(g)},this.resolveURL=function(g){return u?u(g):g},this.setURLModifier=function(g){return u=g,this},this.addHandler=function(g,v){return h.push(g,v),this},this.removeHandler=function(g){const v=h.indexOf(g);return v!==-1&&h.splice(v,2),this},this.getHandler=function(g){for(let v=0,x=h.length;vNumber.EPSILON){if(V<0&&(k=B[G],F=-F,H=B[z],V=-V),E.yH.y)continue;if(E.y===k.y){if(E.x===k.x)return!0}else{const X=V*(E.x-k.x)-F*(E.y-k.y);if(X===0)return!0;if(X<0)continue;O=!O}}else{if(E.y!==k.y)continue;if(H.x<=E.x&&E.x<=k.x||k.x<=E.x&&E.x<=H.x)return!0}}return O}const r=t0.isClockWise,s=this.subPaths;if(s.length===0)return[];let a,l,u;const h=[];if(s.length===1)return l=s[0],u=new Gv,u.curves=l.curves,h.push(u),h;let g=!r(s[0].getPoints());g=e?!g:g;const v=[],x=[];let S=[],w=0,R;x[w]=void 0,S[w]=[];for(let E=0,B=s.length;E1){let E=!1,B=0;for(let L=0,O=x.length;L0&&E===!1&&(S=v)}let C;for(let E=0,B=x.length;E0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.object.backgroundIntensity=this.backgroundIntensity),t.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(t.object.environmentIntensity=this.environmentIntensity),t.object.environmentRotation=this.environmentRotation.toArray(),t}}class Yw{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=o_,this.updateRanges=[],this.version=0,this.uuid=ou()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,n){e*=this.stride,n*=t.stride;for(let r=0,s=this.stride;r1?null:t.copy(e.start).addScaledVector(n,s)}intersectsLine(e){const t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){const n=t||Xk.getNormalMatrix(e),r=this.coplanarPoint(v3).applyMatrix4(e),s=this.normal.applyMatrix3(n).normalize();return this.constant=-r.dot(s),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}}const Sf=new dA,O2=new ce;class Fg{constructor(e=new Yl,t=new Yl,n=new Yl,r=new Yl,s=new Yl,a=new Yl){this.planes=[e,t,n,r,s,a]}set(e,t,n,r,s,a){const l=this.planes;return l[0].copy(e),l[1].copy(t),l[2].copy(n),l[3].copy(r),l[4].copy(s),l[5].copy(a),this}copy(e){const t=this.planes;for(let n=0;n<6;n++)t[n].copy(e.planes[n]);return this}setFromProjectionMatrix(e,t=Ha){const n=this.planes,r=e.elements,s=r[0],a=r[1],l=r[2],u=r[3],h=r[4],g=r[5],v=r[6],x=r[7],S=r[8],w=r[9],R=r[10],C=r[11],E=r[12],B=r[13],L=r[14],O=r[15];if(n[0].setComponents(u-s,x-h,C-S,O-E).normalize(),n[1].setComponents(u+s,x+h,C+S,O+E).normalize(),n[2].setComponents(u+a,x+g,C+w,O+B).normalize(),n[3].setComponents(u-a,x-g,C-w,O-B).normalize(),n[4].setComponents(u-l,x-v,C-R,O-L).normalize(),t===Ha)n[5].setComponents(u+l,x+v,C+R,O+L).normalize();else if(t===pu)n[5].setComponents(l,v,R,L).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),Sf.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),Sf.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(Sf)}intersectsSprite(e){return Sf.center.set(0,0,0),Sf.radius=.7071067811865476,Sf.applyMatrix4(e.matrixWorld),this.intersectsSphere(Sf)}intersectsSphere(e){const t=this.planes,n=e.center,r=-e.radius;for(let s=0;s<6;s++)if(t[s].distanceToPoint(n)0?e.max.x:e.min.x,O2.y=r.normal.y>0?e.max.y:e.min.y,O2.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(O2)<0)return!1}return!0}containsPoint(e){const t=this.planes;for(let n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}class $0 extends ua{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new sn(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}}const l_=new ce,u_=new ce,cC=new kn,Jp=new Og,I2=new dA,_3=new ce,hC=new ce;class xy extends vr{constructor(e=new Ki,t=new $0){super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,n=[0];for(let r=1,s=t.count;r0){const r=t[n[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=r.length;sn)return;_3.applyMatrix4(i.matrixWorld);const u=e.ray.origin.distanceTo(_3);if(!(ue.far))return{distance:u,point:hC.clone().applyMatrix4(i.matrixWorld),index:r,face:null,faceIndex:null,barycoord:null,object:i}}const fC=new ce,AC=new ce;class H7 extends xy{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,n=[];for(let r=0,s=t.count;r0){const r=t[n[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=r.length;sr.far)return;s.push({distance:h,distanceToRay:Math.sqrt(l),point:u,index:e,face:null,faceIndex:null,barycoord:null,object:a})}}let ja=class extends vr{constructor(){super(),this.isGroup=!0,this.type="Group"}};class j7 extends vs{constructor(e,t){super({width:e,height:t}),this.isFramebufferTexture=!0,this.magFilter=mr,this.minFilter=mr,this.generateMipmaps=!1,this.needsUpdate=!0}}class qc extends vs{constructor(e,t,n,r,s,a,l,u,h,g=au){if(g!==au&&g!==du)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");n===void 0&&g===au&&(n=Rr),n===void 0&&g===du&&(n=Au),super(null,r,s,a,l,u,g,n,h),this.isDepthTexture=!0,this.image={width:e,height:t},this.magFilter=l!==void 0?l:mr,this.minFilter=u!==void 0?u:mr,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.compareFunction=e.compareFunction,this}toJSON(e){const t=super.toJSON(e);return this.compareFunction!==null&&(t.compareFunction=this.compareFunction),t}}class Pl{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(e,t){const n=this.getUtoTmapping(e);return this.getPoint(n,t)}getPoints(e=5){const t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return t}getSpacedPoints(e=5){const t=[];for(let n=0;n<=e;n++)t.push(this.getPointAt(n/e));return t}getLength(){const e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const t=[];let n,r=this.getPoint(0),s=0;t.push(0);for(let a=1;a<=e;a++)n=this.getPoint(a/e),s+=n.distanceTo(r),t.push(s),r=n;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t){const n=this.getLengths();let r=0;const s=n.length;let a;t?a=t:a=e*n[s-1];let l=0,u=s-1,h;for(;l<=u;)if(r=Math.floor(l+(u-l)/2),h=n[r]-a,h<0)l=r+1;else if(h>0)u=r-1;else{u=r;break}if(r=u,n[r]===a)return r/(s-1);const g=n[r],x=n[r+1]-g,S=(a-g)/x;return(r+S)/(s-1)}getTangent(e,t){let r=e-1e-4,s=e+1e-4;r<0&&(r=0),s>1&&(s=1);const a=this.getPoint(r),l=this.getPoint(s),u=t||(a.isVector2?new dt:new ce);return u.copy(l).sub(a).normalize(),u}getTangentAt(e,t){const n=this.getUtoTmapping(e);return this.getTangent(n,t)}computeFrenetFrames(e,t){const n=new ce,r=[],s=[],a=[],l=new ce,u=new kn;for(let S=0;S<=e;S++){const w=S/e;r[S]=this.getTangentAt(w,new ce)}s[0]=new ce,a[0]=new ce;let h=Number.MAX_VALUE;const g=Math.abs(r[0].x),v=Math.abs(r[0].y),x=Math.abs(r[0].z);g<=h&&(h=g,n.set(1,0,0)),v<=h&&(h=v,n.set(0,1,0)),x<=h&&n.set(0,0,1),l.crossVectors(r[0],n).normalize(),s[0].crossVectors(r[0],l),a[0].crossVectors(r[0],s[0]);for(let S=1;S<=e;S++){if(s[S]=s[S-1].clone(),a[S]=a[S-1].clone(),l.crossVectors(r[S-1],r[S]),l.length()>Number.EPSILON){l.normalize();const w=Math.acos(ni(r[S-1].dot(r[S]),-1,1));s[S].applyMatrix4(u.makeRotationAxis(l,w))}a[S].crossVectors(r[S],s[S])}if(t===!0){let S=Math.acos(ni(s[0].dot(s[e]),-1,1));S/=e,r[0].dot(l.crossVectors(s[0],s[e]))>0&&(S=-S);for(let w=1;w<=e;w++)s[w].applyMatrix4(u.makeRotationAxis(r[w],S*w)),a[w].crossVectors(r[w],s[w])}return{tangents:r,normals:s,binormals:a}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){const e={metadata:{version:4.6,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}class Kw extends Pl{constructor(e=0,t=0,n=1,r=1,s=0,a=Math.PI*2,l=!1,u=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=n,this.yRadius=r,this.aStartAngle=s,this.aEndAngle=a,this.aClockwise=l,this.aRotation=u}getPoint(e,t=new dt){const n=t,r=Math.PI*2;let s=this.aEndAngle-this.aStartAngle;const a=Math.abs(s)r;)s-=r;s0?0:(Math.floor(Math.abs(l)/s)+1)*s:u===0&&l===s-1&&(l=s-2,u=1);let h,g;this.closed||l>0?h=r[(l-1)%s]:(G2.subVectors(r[0],r[1]).add(r[0]),h=G2);const v=r[l%s],x=r[(l+1)%s];if(this.closed||l+2r.length-2?r.length-1:a+1],v=r[a>r.length-3?r.length-1:a+2];return n.set(mC(l,u.x,h.x,g.x,v.x),mC(l,u.y,h.y,g.y,v.y)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t=n){const a=r[s]-n,l=this.curves[s],u=l.getLength(),h=u===0?0:1-a/u;return l.getPointAt(h,t)}s++}return null}getLength(){const e=this.getCurveLengths();return e[e.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const e=[];let t=0;for(let n=0,r=this.curves.length;n1&&!t[t.length-1].equals(t[0])&&t.push(t[0]),t}copy(e){super.copy(e),this.curves=[];for(let t=0,n=e.curves.length;t0){const v=h.getPoint(0);v.equals(this.currentPoint)||this.lineTo(v.x,v.y)}this.curves.push(h);const g=h.getPoint(1);return this.currentPoint.copy(g),this}copy(e){return super.copy(e),this.currentPoint.copy(e.currentPoint),this}toJSON(){const e=super.toJSON();return e.currentPoint=this.currentPoint.toArray(),e}fromJSON(e){return super.fromJSON(e),this.currentPoint.fromArray(e.currentPoint),this}};class by extends Ki{constructor(e=1,t=32,n=0,r=Math.PI*2){super(),this.type="CircleGeometry",this.parameters={radius:e,segments:t,thetaStart:n,thetaLength:r},t=Math.max(3,t);const s=[],a=[],l=[],u=[],h=new ce,g=new dt;a.push(0,0,0),l.push(0,0,1),u.push(.5,.5);for(let v=0,x=3;v<=t;v++,x+=3){const S=n+v/t*r;h.x=e*Math.cos(S),h.y=e*Math.sin(S),a.push(h.x,h.y,h.z),l.push(0,0,1),g.x=(a[x]/e+1)/2,g.y=(a[x+1]/e+1)/2,u.push(g.x,g.y)}for(let v=1;v<=t;v++)s.push(v,v+1,0);this.setIndex(s),this.setAttribute("position",new wi(a,3)),this.setAttribute("normal",new wi(l,3)),this.setAttribute("uv",new wi(u,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new by(e.radius,e.segments,e.thetaStart,e.thetaLength)}}class Jw extends Ki{constructor(e=1,t=1,n=1,r=32,s=1,a=!1,l=0,u=Math.PI*2){super(),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:n,radialSegments:r,heightSegments:s,openEnded:a,thetaStart:l,thetaLength:u};const h=this;r=Math.floor(r),s=Math.floor(s);const g=[],v=[],x=[],S=[];let w=0;const R=[],C=n/2;let E=0;B(),a===!1&&(e>0&&L(!0),t>0&&L(!1)),this.setIndex(g),this.setAttribute("position",new wi(v,3)),this.setAttribute("normal",new wi(x,3)),this.setAttribute("uv",new wi(S,2));function B(){const O=new ce,z=new ce;let G=0;const k=(t-e)/n;for(let H=0;H<=s;H++){const F=[],V=H/s,X=V*(t-e)+e;for(let J=0;J<=r;J++){const te=J/r,se=te*u+l,ne=Math.sin(se),Z=Math.cos(se);z.x=X*ne,z.y=-V*n+C,z.z=X*Z,v.push(z.x,z.y,z.z),O.set(ne,k,Z).normalize(),x.push(O.x,O.y,O.z),S.push(te,1-V),F.push(w++)}R.push(F)}for(let H=0;H0||F!==0)&&(g.push(V,X,te),G+=3),(t>0||F!==s-1)&&(g.push(X,J,te),G+=3)}h.addGroup(E,G,0),E+=G}function L(O){const z=w,G=new dt,k=new ce;let H=0;const F=O===!0?e:t,V=O===!0?1:-1;for(let J=1;J<=r;J++)v.push(0,C*V,0),x.push(0,V,0),S.push(.5,.5),w++;const X=w;for(let J=0;J<=r;J++){const se=J/r*u+l,ne=Math.cos(se),Z=Math.sin(se);k.x=F*Z,k.y=C*V,k.z=F*ne,v.push(k.x,k.y,k.z),x.push(0,V,0),G.x=ne*.5+.5,G.y=Z*.5*V+.5,S.push(G.x,G.y),w++}for(let J=0;J80*t){l=h=i[0],u=g=i[1];for(let w=t;wh&&(h=v),x>g&&(g=x);S=Math.max(h-l,g-u),S=S!==0?32767/S:0}return ag(s,a,t,l,u,S,0),a}};function Z7(i,e,t,n,r){let s,a;if(r===Sz(i,e,t,n)>0)for(s=e;s=e;s-=n)a=gC(s,i[s],i[s+1],a);return a&&Sy(a,a.next)&&(lg(a),a=a.next),a}function uA(i,e){if(!i)return i;e||(e=i);let t=i,n;do if(n=!1,!t.steiner&&(Sy(t,t.next)||Nr(t.prev,t,t.next)===0)){if(lg(t),t=e=t.prev,t===t.next)break;n=!0}else t=t.next;while(n||t!==e);return e}function ag(i,e,t,n,r,s,a){if(!i)return;!a&&s&&gz(i,n,r,s);let l=i,u,h;for(;i.prev!==i.next;){if(u=i.prev,h=i.next,s?uz(i,n,r,s):lz(i)){e.push(u.i/t|0),e.push(i.i/t|0),e.push(h.i/t|0),lg(i),i=h.next,l=h.next;continue}if(i=h,i===l){a?a===1?(i=cz(uA(i),e,t),ag(i,e,t,n,r,s,2)):a===2&&hz(i,e,t,n,r,s):ag(uA(i),e,t,n,r,s,1);break}}}function lz(i){const e=i.prev,t=i,n=i.next;if(Nr(e,t,n)>=0)return!1;const r=e.x,s=t.x,a=n.x,l=e.y,u=t.y,h=n.y,g=rs?r>a?r:a:s>a?s:a,S=l>u?l>h?l:h:u>h?u:h;let w=n.next;for(;w!==e;){if(w.x>=g&&w.x<=x&&w.y>=v&&w.y<=S&&Vd(r,l,s,u,a,h,w.x,w.y)&&Nr(w.prev,w,w.next)>=0)return!1;w=w.next}return!0}function uz(i,e,t,n){const r=i.prev,s=i,a=i.next;if(Nr(r,s,a)>=0)return!1;const l=r.x,u=s.x,h=a.x,g=r.y,v=s.y,x=a.y,S=lu?l>h?l:h:u>h?u:h,C=g>v?g>x?g:x:v>x?v:x,E=XS(S,w,e,t,n),B=XS(R,C,e,t,n);let L=i.prevZ,O=i.nextZ;for(;L&&L.z>=E&&O&&O.z<=B;){if(L.x>=S&&L.x<=R&&L.y>=w&&L.y<=C&&L!==r&&L!==a&&Vd(l,g,u,v,h,x,L.x,L.y)&&Nr(L.prev,L,L.next)>=0||(L=L.prevZ,O.x>=S&&O.x<=R&&O.y>=w&&O.y<=C&&O!==r&&O!==a&&Vd(l,g,u,v,h,x,O.x,O.y)&&Nr(O.prev,O,O.next)>=0))return!1;O=O.nextZ}for(;L&&L.z>=E;){if(L.x>=S&&L.x<=R&&L.y>=w&&L.y<=C&&L!==r&&L!==a&&Vd(l,g,u,v,h,x,L.x,L.y)&&Nr(L.prev,L,L.next)>=0)return!1;L=L.prevZ}for(;O&&O.z<=B;){if(O.x>=S&&O.x<=R&&O.y>=w&&O.y<=C&&O!==r&&O!==a&&Vd(l,g,u,v,h,x,O.x,O.y)&&Nr(O.prev,O,O.next)>=0)return!1;O=O.nextZ}return!0}function cz(i,e,t){let n=i;do{const r=n.prev,s=n.next.next;!Sy(r,s)&&J7(r,n,n.next,s)&&og(r,s)&&og(s,r)&&(e.push(r.i/t|0),e.push(n.i/t|0),e.push(s.i/t|0),lg(n),lg(n.next),n=i=s),n=n.next}while(n!==i);return uA(n)}function hz(i,e,t,n,r,s){let a=i;do{let l=a.next.next;for(;l!==a.prev;){if(a.i!==l.i&&yz(a,l)){let u=eD(a,l);a=uA(a,a.next),u=uA(u,u.next),ag(a,e,t,n,r,s,0),ag(u,e,t,n,r,s,0);return}l=l.next}a=a.next}while(a!==i)}function fz(i,e,t,n){const r=[];let s,a,l,u,h;for(s=0,a=e.length;s=t.next.y&&t.next.y!==t.y){const x=t.x+(a-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(x<=s&&x>n&&(n=x,r=t.x=t.x&&t.x>=u&&s!==t.x&&Vd(ar.x||t.x===r.x&&mz(r,t)))&&(r=t,g=v)),t=t.next;while(t!==l);return r}function mz(i,e){return Nr(i.prev,i,e.prev)<0&&Nr(e.next,i,i.next)<0}function gz(i,e,t,n){let r=i;do r.z===0&&(r.z=XS(r.x,r.y,e,t,n)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next;while(r!==i);r.prevZ.nextZ=null,r.prevZ=null,vz(r)}function vz(i){let e,t,n,r,s,a,l,u,h=1;do{for(t=i,i=null,s=null,a=0;t;){for(a++,n=t,l=0,e=0;e0||u>0&&n;)l!==0&&(u===0||!n||t.z<=n.z)?(r=t,t=t.nextZ,l--):(r=n,n=n.nextZ,u--),s?s.nextZ=r:i=r,r.prevZ=s,s=r;t=n}s.nextZ=null,h*=2}while(a>1);return i}function XS(i,e,t,n,r){return i=(i-t)*r|0,e=(e-n)*r|0,i=(i|i<<8)&16711935,i=(i|i<<4)&252645135,i=(i|i<<2)&858993459,i=(i|i<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,i|e<<1}function _z(i){let e=i,t=i;do(e.x=(i-a)*(s-l)&&(i-a)*(n-l)>=(t-a)*(e-l)&&(t-a)*(s-l)>=(r-a)*(n-l)}function yz(i,e){return i.next.i!==e.i&&i.prev.i!==e.i&&!xz(i,e)&&(og(i,e)&&og(e,i)&&bz(i,e)&&(Nr(i.prev,i,e.prev)||Nr(i,e.prev,e))||Sy(i,e)&&Nr(i.prev,i,i.next)>0&&Nr(e.prev,e,e.next)>0)}function Nr(i,e,t){return(e.y-i.y)*(t.x-e.x)-(e.x-i.x)*(t.y-e.y)}function Sy(i,e){return i.x===e.x&&i.y===e.y}function J7(i,e,t,n){const r=V2(Nr(i,e,t)),s=V2(Nr(i,e,n)),a=V2(Nr(t,n,i)),l=V2(Nr(t,n,e));return!!(r!==s&&a!==l||r===0&&q2(i,t,e)||s===0&&q2(i,n,e)||a===0&&q2(t,i,n)||l===0&&q2(t,e,n))}function q2(i,e,t){return e.x<=Math.max(i.x,t.x)&&e.x>=Math.min(i.x,t.x)&&e.y<=Math.max(i.y,t.y)&&e.y>=Math.min(i.y,t.y)}function V2(i){return i>0?1:i<0?-1:0}function xz(i,e){let t=i;do{if(t.i!==i.i&&t.next.i!==i.i&&t.i!==e.i&&t.next.i!==e.i&&J7(t,t.next,i,e))return!0;t=t.next}while(t!==i);return!1}function og(i,e){return Nr(i.prev,i,i.next)<0?Nr(i,e,i.next)>=0&&Nr(i,i.prev,e)>=0:Nr(i,e,i.prev)<0||Nr(i,i.next,e)<0}function bz(i,e){let t=i,n=!1;const r=(i.x+e.x)/2,s=(i.y+e.y)/2;do t.y>s!=t.next.y>s&&t.next.y!==t.y&&r<(t.next.x-t.x)*(s-t.y)/(t.next.y-t.y)+t.x&&(n=!n),t=t.next;while(t!==i);return n}function eD(i,e){const t=new YS(i.i,i.x,i.y),n=new YS(e.i,e.x,e.y),r=i.next,s=e.prev;return i.next=e,e.prev=i,t.next=r,r.prev=t,n.next=t,t.prev=n,s.next=n,n.prev=s,n}function gC(i,e,t,n){const r=new YS(i,e,t);return n?(r.next=n.next,r.prev=n,n.next.prev=r,n.next=r):(r.prev=r,r.next=r),r}function lg(i){i.next.prev=i.prev,i.prev.next=i.next,i.prevZ&&(i.prevZ.nextZ=i.nextZ),i.nextZ&&(i.nextZ.prevZ=i.prevZ)}function YS(i,e,t){this.i=i,this.x=e,this.y=t,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function Sz(i,e,t,n){let r=0;for(let s=e,a=t-n;s2&&i[e-1].equals(i[0])&&i.pop()}function _C(i,e){for(let t=0;tNumber.EPSILON){const $e=Math.sqrt(Y),it=Math.sqrt(St*St+fe*fe),tt=ke.x-en/$e,Vt=ke.y+ut/$e,Bt=oe.x-fe/it,Wt=oe.y+St/it,ln=((Bt-tt)*fe-(Wt-Vt)*St)/(ut*fe-en*St);Mt=tt+ut*ln-Be.x,lt=Vt+en*ln-Be.y;const Tt=Mt*Mt+lt*lt;if(Tt<=2)return new dt(Mt,lt);Dt=Math.sqrt(Tt/2)}else{let $e=!1;ut>Number.EPSILON?St>Number.EPSILON&&($e=!0):ut<-Number.EPSILON?St<-Number.EPSILON&&($e=!0):Math.sign(en)===Math.sign(fe)&&($e=!0),$e?(Mt=-en,lt=ut,Dt=Math.sqrt(Y)):(Mt=ut,lt=en,Dt=Math.sqrt(Y/2))}return new dt(Mt/Dt,lt/Dt)}const be=[];for(let Be=0,ke=se.length,oe=ke-1,Mt=Be+1;Be=0;Be--){const ke=Be/C,oe=S*Math.cos(ke*Math.PI/2),Mt=w*Math.sin(ke*Math.PI/2)+R;for(let lt=0,Dt=se.length;lt=0;){const Mt=oe;let lt=oe-1;lt<0&&(lt=Be.length-1);for(let Dt=0,ut=g+C*2;Dt0)&&S.push(L,O,G),(E!==n-1||u0!=e>0&&this.version++,this._anisotropy=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get iridescence(){return this._iridescence}set iridescence(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=e}get dispersion(){return this._dispersion}set dispersion(e){this._dispersion>0!=e>0&&this.version++,this._dispersion=e}get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=e.anisotropy,this.anisotropyRotation=e.anisotropyRotation,this.anisotropyMap=e.anisotropyMap,this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.dispersion=e.dispersion,this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=[...e.iridescenceThicknessRange],this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}}class nD extends ua{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new sn(16777215),this.specular=new sn(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new sn(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Dc,this.normalScale=new dt(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new la,this.combine=Lg,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class Rz extends ua{constructor(e){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new sn(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new sn(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Dc,this.normalScale=new dt(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.gradientMap=e.gradientMap,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}class Nz extends ua{constructor(e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Dc,this.normalScale=new dt(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(e),this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this}}class Vc extends ua{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new sn(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new sn(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Dc,this.normalScale=new dt(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new la,this.combine=Lg,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class Dz extends ua{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=jF,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}}class Pz extends ua{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}class Lz extends ua{constructor(e){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new sn(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Dc,this.normalScale=new dt(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={MATCAP:""},this.color.copy(e.color),this.matcap=e.matcap,this.map=e.map,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.flatShading=e.flatShading,this.fog=e.fog,this}}class Uz extends $0{constructor(e){super(),this.isLineDashedMaterial=!0,this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(e)}copy(e){return super.copy(e),this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this}}const xC={enabled:!1,files:{},add:function(i,e){this.enabled!==!1&&(this.files[i]=e)},get:function(i){if(this.enabled!==!1)return this.files[i]},remove:function(i){delete this.files[i]},clear:function(){this.files={}}};class Bz{constructor(e,t,n){const r=this;let s=!1,a=0,l=0,u;const h=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=n,this.itemStart=function(g){l++,s===!1&&r.onStart!==void 0&&r.onStart(g,a,l),s=!0},this.itemEnd=function(g){a++,r.onProgress!==void 0&&r.onProgress(g,a,l),a===l&&(s=!1,r.onLoad!==void 0&&r.onLoad())},this.itemError=function(g){r.onError!==void 0&&r.onError(g)},this.resolveURL=function(g){return u?u(g):g},this.setURLModifier=function(g){return u=g,this},this.addHandler=function(g,v){return h.push(g,v),this},this.removeHandler=function(g){const v=h.indexOf(g);return v!==-1&&h.splice(v,2),this},this.getHandler=function(g){for(let v=0,x=h.length;vNumber.EPSILON){if(V<0&&(k=B[G],F=-F,H=B[z],V=-V),E.yH.y)continue;if(E.y===k.y){if(E.x===k.x)return!0}else{const X=V*(E.x-k.x)-F*(E.y-k.y);if(X===0)return!0;if(X<0)continue;O=!O}}else{if(E.y!==k.y)continue;if(H.x<=E.x&&E.x<=k.x||k.x<=E.x&&E.x<=H.x)return!0}}return O}const r=t0.isClockWise,s=this.subPaths;if(s.length===0)return[];let a,l,u;const h=[];if(s.length===1)return l=s[0],u=new Gv,u.curves=l.curves,h.push(u),h;let g=!r(s[0].getPoints());g=e?!g:g;const v=[],x=[];let S=[],w=0,R;x[w]=void 0,S[w]=[];for(let E=0,B=s.length;E1){let E=!1,B=0;for(let L=0,O=x.length;L0&&E===!1&&(S=v)}let C;for(let E=0,B=x.length;E #include #include -}`,Zn={alphahash_fragment:Jz,alphahash_pars_fragment:eG,alphamap_fragment:tG,alphamap_pars_fragment:nG,alphatest_fragment:iG,alphatest_pars_fragment:rG,aomap_fragment:sG,aomap_pars_fragment:aG,batching_pars_vertex:oG,batching_vertex:lG,begin_vertex:uG,beginnormal_vertex:cG,bsdfs:hG,iridescence_fragment:fG,bumpmap_pars_fragment:AG,clipping_planes_fragment:dG,clipping_planes_pars_fragment:pG,clipping_planes_pars_vertex:mG,clipping_planes_vertex:gG,color_fragment:vG,color_pars_fragment:_G,color_pars_vertex:yG,color_vertex:xG,common:bG,cube_uv_reflection_fragment:SG,defaultnormal_vertex:TG,displacementmap_pars_vertex:wG,displacementmap_vertex:MG,emissivemap_fragment:EG,emissivemap_pars_fragment:CG,colorspace_fragment:RG,colorspace_pars_fragment:NG,envmap_fragment:DG,envmap_common_pars_fragment:PG,envmap_pars_fragment:LG,envmap_pars_vertex:UG,envmap_physical_pars_fragment:jG,envmap_vertex:BG,fog_vertex:OG,fog_pars_vertex:IG,fog_fragment:FG,fog_pars_fragment:kG,gradientmap_pars_fragment:zG,lightmap_pars_fragment:GG,lights_lambert_fragment:qG,lights_lambert_pars_fragment:VG,lights_pars_begin:HG,lights_toon_fragment:WG,lights_toon_pars_fragment:$G,lights_phong_fragment:XG,lights_phong_pars_fragment:YG,lights_physical_fragment:QG,lights_physical_pars_fragment:KG,lights_fragment_begin:ZG,lights_fragment_maps:JG,lights_fragment_end:eq,logdepthbuf_fragment:tq,logdepthbuf_pars_fragment:nq,logdepthbuf_pars_vertex:iq,logdepthbuf_vertex:rq,map_fragment:sq,map_pars_fragment:aq,map_particle_fragment:oq,map_particle_pars_fragment:lq,metalnessmap_fragment:uq,metalnessmap_pars_fragment:cq,morphinstance_vertex:hq,morphcolor_vertex:fq,morphnormal_vertex:Aq,morphtarget_pars_vertex:dq,morphtarget_vertex:pq,normal_fragment_begin:mq,normal_fragment_maps:gq,normal_pars_fragment:vq,normal_pars_vertex:_q,normal_vertex:yq,normalmap_pars_fragment:xq,clearcoat_normal_fragment_begin:bq,clearcoat_normal_fragment_maps:Sq,clearcoat_pars_fragment:Tq,iridescence_pars_fragment:wq,opaque_fragment:Mq,packing:Eq,premultiplied_alpha_fragment:Cq,project_vertex:Rq,dithering_fragment:Nq,dithering_pars_fragment:Dq,roughnessmap_fragment:Pq,roughnessmap_pars_fragment:Lq,shadowmap_pars_fragment:Uq,shadowmap_pars_vertex:Bq,shadowmap_vertex:Oq,shadowmask_pars_fragment:Iq,skinbase_vertex:Fq,skinning_pars_vertex:kq,skinning_vertex:zq,skinnormal_vertex:Gq,specularmap_fragment:qq,specularmap_pars_fragment:Vq,tonemapping_fragment:Hq,tonemapping_pars_fragment:jq,transmission_fragment:Wq,transmission_pars_fragment:$q,uv_pars_fragment:Xq,uv_pars_vertex:Yq,uv_vertex:Qq,worldpos_vertex:Kq,background_vert:Zq,background_frag:Jq,backgroundCube_vert:eV,backgroundCube_frag:tV,cube_vert:nV,cube_frag:iV,depth_vert:rV,depth_frag:sV,distanceRGBA_vert:aV,distanceRGBA_frag:oV,equirect_vert:lV,equirect_frag:uV,linedashed_vert:cV,linedashed_frag:hV,meshbasic_vert:fV,meshbasic_frag:AV,meshlambert_vert:dV,meshlambert_frag:pV,meshmatcap_vert:mV,meshmatcap_frag:gV,meshnormal_vert:vV,meshnormal_frag:_V,meshphong_vert:yV,meshphong_frag:xV,meshphysical_vert:bV,meshphysical_frag:SV,meshtoon_vert:TV,meshtoon_frag:wV,points_vert:MV,points_frag:EV,shadow_vert:CV,shadow_frag:RV,sprite_vert:NV,sprite_frag:DV},Yt={common:{diffuse:{value:new sn(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Vn},alphaMap:{value:null},alphaMapTransform:{value:new Vn},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Vn}},envmap:{envMap:{value:null},envMapRotation:{value:new Vn},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new Vn}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Vn}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Vn},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Vn},normalScale:{value:new At(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Vn},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new Vn}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new Vn}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new Vn}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new sn(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new sn(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new Vn},alphaTest:{value:0},uvTransform:{value:new Vn}},sprite:{diffuse:{value:new sn(16777215)},opacity:{value:1},center:{value:new At(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new Vn},alphaMap:{value:null},alphaMapTransform:{value:new Vn},alphaTest:{value:0}}},Ga={basic:{uniforms:_a([Yt.common,Yt.specularmap,Yt.envmap,Yt.aomap,Yt.lightmap,Yt.fog]),vertexShader:Zn.meshbasic_vert,fragmentShader:Zn.meshbasic_frag},lambert:{uniforms:_a([Yt.common,Yt.specularmap,Yt.envmap,Yt.aomap,Yt.lightmap,Yt.emissivemap,Yt.bumpmap,Yt.normalmap,Yt.displacementmap,Yt.fog,Yt.lights,{emissive:{value:new sn(0)}}]),vertexShader:Zn.meshlambert_vert,fragmentShader:Zn.meshlambert_frag},phong:{uniforms:_a([Yt.common,Yt.specularmap,Yt.envmap,Yt.aomap,Yt.lightmap,Yt.emissivemap,Yt.bumpmap,Yt.normalmap,Yt.displacementmap,Yt.fog,Yt.lights,{emissive:{value:new sn(0)},specular:{value:new sn(1118481)},shininess:{value:30}}]),vertexShader:Zn.meshphong_vert,fragmentShader:Zn.meshphong_frag},standard:{uniforms:_a([Yt.common,Yt.envmap,Yt.aomap,Yt.lightmap,Yt.emissivemap,Yt.bumpmap,Yt.normalmap,Yt.displacementmap,Yt.roughnessmap,Yt.metalnessmap,Yt.fog,Yt.lights,{emissive:{value:new sn(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Zn.meshphysical_vert,fragmentShader:Zn.meshphysical_frag},toon:{uniforms:_a([Yt.common,Yt.aomap,Yt.lightmap,Yt.emissivemap,Yt.bumpmap,Yt.normalmap,Yt.displacementmap,Yt.gradientmap,Yt.fog,Yt.lights,{emissive:{value:new sn(0)}}]),vertexShader:Zn.meshtoon_vert,fragmentShader:Zn.meshtoon_frag},matcap:{uniforms:_a([Yt.common,Yt.bumpmap,Yt.normalmap,Yt.displacementmap,Yt.fog,{matcap:{value:null}}]),vertexShader:Zn.meshmatcap_vert,fragmentShader:Zn.meshmatcap_frag},points:{uniforms:_a([Yt.points,Yt.fog]),vertexShader:Zn.points_vert,fragmentShader:Zn.points_frag},dashed:{uniforms:_a([Yt.common,Yt.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Zn.linedashed_vert,fragmentShader:Zn.linedashed_frag},depth:{uniforms:_a([Yt.common,Yt.displacementmap]),vertexShader:Zn.depth_vert,fragmentShader:Zn.depth_frag},normal:{uniforms:_a([Yt.common,Yt.bumpmap,Yt.normalmap,Yt.displacementmap,{opacity:{value:1}}]),vertexShader:Zn.meshnormal_vert,fragmentShader:Zn.meshnormal_frag},sprite:{uniforms:_a([Yt.sprite,Yt.fog]),vertexShader:Zn.sprite_vert,fragmentShader:Zn.sprite_frag},background:{uniforms:{uvTransform:{value:new Vn},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:Zn.background_vert,fragmentShader:Zn.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new Vn}},vertexShader:Zn.backgroundCube_vert,fragmentShader:Zn.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Zn.cube_vert,fragmentShader:Zn.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Zn.equirect_vert,fragmentShader:Zn.equirect_frag},distanceRGBA:{uniforms:_a([Yt.common,Yt.displacementmap,{referencePosition:{value:new ce},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Zn.distanceRGBA_vert,fragmentShader:Zn.distanceRGBA_frag},shadow:{uniforms:_a([Yt.lights,Yt.fog,{color:{value:new sn(0)},opacity:{value:1}}]),vertexShader:Zn.shadow_vert,fragmentShader:Zn.shadow_frag}};Ga.physical={uniforms:_a([Ga.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new Vn},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new Vn},clearcoatNormalScale:{value:new At(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new Vn},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new Vn},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new Vn},sheen:{value:0},sheenColor:{value:new sn(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new Vn},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new Vn},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new Vn},transmissionSamplerSize:{value:new At},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new Vn},attenuationDistance:{value:0},attenuationColor:{value:new sn(0)},specularColor:{value:new sn(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new Vn},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new Vn},anisotropyVector:{value:new At},anisotropyMap:{value:null},anisotropyMapTransform:{value:new Vn}}]),vertexShader:Zn.meshphysical_vert,fragmentShader:Zn.meshphysical_frag};const j2={r:0,b:0,g:0},Tf=new la,PV=new kn;function LV(i,e,t,n,r,s,a){const l=new sn(0);let u=s===!0?0:1,h,g,v=null,x=0,S=null;function w(L){let O=L.isScene===!0?L.background:null;return O&&O.isTexture&&(O=(L.backgroundBlurriness>0?t:e).get(O)),O}function R(L){let O=!1;const z=w(L);z===null?E(l,u):z&&z.isColor&&(E(z,1),O=!0);const G=i.xr.getEnvironmentBlendMode();G==="additive"?n.buffers.color.setClear(0,0,0,1,a):G==="alpha-blend"&&n.buffers.color.setClear(0,0,0,0,a),(i.autoClear||O)&&(n.buffers.depth.setTest(!0),n.buffers.depth.setMask(!0),n.buffers.color.setMask(!0),i.clear(i.autoClearColor,i.autoClearDepth,i.autoClearStencil))}function C(L,O){const z=w(O);z&&(z.isCubeTexture||z.mapping===sA)?(g===void 0&&(g=new zi(new $h(1,1,1),new Ja({name:"BackgroundCubeMaterial",uniforms:E0(Ga.backgroundCube.uniforms),vertexShader:Ga.backgroundCube.vertexShader,fragmentShader:Ga.backgroundCube.fragmentShader,side:hr,depthTest:!1,depthWrite:!1,fog:!1})),g.geometry.deleteAttribute("normal"),g.geometry.deleteAttribute("uv"),g.onBeforeRender=function(G,k,H){this.matrixWorld.copyPosition(H.matrixWorld)},Object.defineProperty(g.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),r.update(g)),Tf.copy(O.backgroundRotation),Tf.x*=-1,Tf.y*=-1,Tf.z*=-1,z.isCubeTexture&&z.isRenderTargetTexture===!1&&(Tf.y*=-1,Tf.z*=-1),g.material.uniforms.envMap.value=z,g.material.uniforms.flipEnvMap.value=z.isCubeTexture&&z.isRenderTargetTexture===!1?-1:1,g.material.uniforms.backgroundBlurriness.value=O.backgroundBlurriness,g.material.uniforms.backgroundIntensity.value=O.backgroundIntensity,g.material.uniforms.backgroundRotation.value.setFromMatrix4(PV.makeRotationFromEuler(Tf)),g.material.toneMapped=ai.getTransfer(z.colorSpace)!==Vi,(v!==z||x!==z.version||S!==i.toneMapping)&&(g.material.needsUpdate=!0,v=z,x=z.version,S=i.toneMapping),g.layers.enableAll(),L.unshift(g,g.geometry,g.material,0,0,null)):z&&z.isTexture&&(h===void 0&&(h=new zi(new Ty(2,2),new Ja({name:"BackgroundMaterial",uniforms:E0(Ga.background.uniforms),vertexShader:Ga.background.vertexShader,fragmentShader:Ga.background.fragmentShader,side:Nl,depthTest:!1,depthWrite:!1,fog:!1})),h.geometry.deleteAttribute("normal"),Object.defineProperty(h.material,"map",{get:function(){return this.uniforms.t2D.value}}),r.update(h)),h.material.uniforms.t2D.value=z,h.material.uniforms.backgroundIntensity.value=O.backgroundIntensity,h.material.toneMapped=ai.getTransfer(z.colorSpace)!==Vi,z.matrixAutoUpdate===!0&&z.updateMatrix(),h.material.uniforms.uvTransform.value.copy(z.matrix),(v!==z||x!==z.version||S!==i.toneMapping)&&(h.material.needsUpdate=!0,v=z,x=z.version,S=i.toneMapping),h.layers.enableAll(),L.unshift(h,h.geometry,h.material,0,0,null))}function E(L,O){L.getRGB(j2,G7(i)),n.buffers.color.setClear(j2.r,j2.g,j2.b,O,a)}function B(){g!==void 0&&(g.geometry.dispose(),g.material.dispose()),h!==void 0&&(h.geometry.dispose(),h.material.dispose())}return{getClearColor:function(){return l},setClearColor:function(L,O=1){l.set(L),u=O,E(l,u)},getClearAlpha:function(){return u},setClearAlpha:function(L){u=L,E(l,u)},render:R,addToRenderList:C,dispose:B}}function UV(i,e){const t=i.getParameter(i.MAX_VERTEX_ATTRIBS),n={},r=x(null);let s=r,a=!1;function l(V,X,J,te,se){let ne=!1;const Z=v(te,J,X);s!==Z&&(s=Z,h(s.object)),ne=S(V,te,J,se),ne&&w(V,te,J,se),se!==null&&e.update(se,i.ELEMENT_ARRAY_BUFFER),(ne||a)&&(a=!1,O(V,X,J,te),se!==null&&i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,e.get(se).buffer))}function u(){return i.createVertexArray()}function h(V){return i.bindVertexArray(V)}function g(V){return i.deleteVertexArray(V)}function v(V,X,J){const te=J.wireframe===!0;let se=n[V.id];se===void 0&&(se={},n[V.id]=se);let ne=se[X.id];ne===void 0&&(ne={},se[X.id]=ne);let Z=ne[te];return Z===void 0&&(Z=x(u()),ne[te]=Z),Z}function x(V){const X=[],J=[],te=[];for(let se=0;se=0){const Se=se[he];let le=ne[he];if(le===void 0&&(he==="instanceMatrix"&&V.instanceMatrix&&(le=V.instanceMatrix),he==="instanceColor"&&V.instanceColor&&(le=V.instanceColor)),Se===void 0||Se.attribute!==le||le&&Se.data!==le.data)return!0;Z++}return s.attributesNum!==Z||s.index!==te}function w(V,X,J,te){const se={},ne=X.attributes;let Z=0;const ue=J.getAttributes();for(const he in ue)if(ue[he].location>=0){let Se=ne[he];Se===void 0&&(he==="instanceMatrix"&&V.instanceMatrix&&(Se=V.instanceMatrix),he==="instanceColor"&&V.instanceColor&&(Se=V.instanceColor));const le={};le.attribute=Se,Se&&Se.data&&(le.data=Se.data),se[he]=le,Z++}s.attributes=se,s.attributesNum=Z,s.index=te}function R(){const V=s.newAttributes;for(let X=0,J=V.length;X=0){let be=se[ue];if(be===void 0&&(ue==="instanceMatrix"&&V.instanceMatrix&&(be=V.instanceMatrix),ue==="instanceColor"&&V.instanceColor&&(be=V.instanceColor)),be!==void 0){const Se=be.normalized,le=be.itemSize,we=e.get(be);if(we===void 0)continue;const We=we.buffer,Te=we.type,ze=we.bytesPerElement,_e=Te===i.INT||Te===i.UNSIGNED_INT||be.gpuType===Ns;if(be.isInterleavedBufferAttribute){const De=be.data,dt=De.stride,vt=be.offset;if(De.isInstancedInterleavedBuffer){for(let Tt=0;Tt0&&i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.HIGH_FLOAT).precision>0)return"highp";k="mediump"}return k==="mediump"&&i.getShaderPrecisionFormat(i.VERTEX_SHADER,i.MEDIUM_FLOAT).precision>0&&i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let h=t.precision!==void 0?t.precision:"highp";const g=u(h);g!==h&&(console.warn("THREE.WebGLRenderer:",h,"not supported, using",g,"instead."),h=g);const v=t.logarithmicDepthBuffer===!0,x=t.reverseDepthBuffer===!0&&e.has("EXT_clip_control"),S=i.getParameter(i.MAX_TEXTURE_IMAGE_UNITS),w=i.getParameter(i.MAX_VERTEX_TEXTURE_IMAGE_UNITS),R=i.getParameter(i.MAX_TEXTURE_SIZE),C=i.getParameter(i.MAX_CUBE_MAP_TEXTURE_SIZE),E=i.getParameter(i.MAX_VERTEX_ATTRIBS),B=i.getParameter(i.MAX_VERTEX_UNIFORM_VECTORS),L=i.getParameter(i.MAX_VARYING_VECTORS),O=i.getParameter(i.MAX_FRAGMENT_UNIFORM_VECTORS),z=w>0,G=i.getParameter(i.MAX_SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:s,getMaxPrecision:u,textureFormatReadable:a,textureTypeReadable:l,precision:h,logarithmicDepthBuffer:v,reverseDepthBuffer:x,maxTextures:S,maxVertexTextures:w,maxTextureSize:R,maxCubemapSize:C,maxAttributes:E,maxVertexUniforms:B,maxVaryings:L,maxFragmentUniforms:O,vertexTextures:z,maxSamples:G}}function IV(i){const e=this;let t=null,n=0,r=!1,s=!1;const a=new Yl,l=new Vn,u={value:null,needsUpdate:!1};this.uniform=u,this.numPlanes=0,this.numIntersection=0,this.init=function(v,x){const S=v.length!==0||x||n!==0||r;return r=x,n=v.length,S},this.beginShadows=function(){s=!0,g(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(v,x){t=g(v,x,0)},this.setState=function(v,x,S){const w=v.clippingPlanes,R=v.clipIntersection,C=v.clipShadows,E=i.get(v);if(!r||w===null||w.length===0||s&&!C)s?g(null):h();else{const B=s?0:n,L=B*4;let O=E.clippingState||null;u.value=O,O=g(w,x,L,S);for(let z=0;z!==L;++z)O[z]=t[z];E.clippingState=O,this.numIntersection=R?this.numPlanes:0,this.numPlanes+=B}};function h(){u.value!==t&&(u.value=t,u.needsUpdate=n>0),e.numPlanes=n,e.numIntersection=0}function g(v,x,S,w){const R=v!==null?v.length:0;let C=null;if(R!==0){if(C=u.value,w!==!0||C===null){const E=S+R*4,B=x.matrixWorldInverse;l.getNormalMatrix(B),(C===null||C.length0){const h=new V7(u.height);return h.fromEquirectangularTexture(i,a),e.set(a,h),a.addEventListener("dispose",r),t(h.texture,a.mapping)}else return null}}return a}function r(a){const l=a.target;l.removeEventListener("dispose",r);const u=e.get(l);u!==void 0&&(e.delete(l),u.dispose())}function s(){e=new WeakMap}return{get:n,dispose:s}}const Hd=4,DC=[.125,.215,.35,.446,.526,.582],zf=20,w3=new kg,PC=new sn;let M3=null,E3=0,C3=0,R3=!1;const Bf=(1+Math.sqrt(5))/2,vd=1/Bf,LC=[new ce(-Bf,vd,0),new ce(Bf,vd,0),new ce(-vd,0,Bf),new ce(vd,0,Bf),new ce(0,Bf,-vd),new ce(0,Bf,vd),new ce(-1,1,-1),new ce(1,1,-1),new ce(-1,1,1),new ce(1,1,1)];let UC=class{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(e,t=0,n=.1,r=100){M3=this._renderer.getRenderTarget(),E3=this._renderer.getActiveCubeFace(),C3=this._renderer.getActiveMipmapLevel(),R3=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(256);const s=this._allocateTargets();return s.depthBuffer=!0,this._sceneToCubeUV(e,n,r,s),t>0&&this._blur(s,0,0,t),this._applyPMREM(s),this._cleanup(s),s}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=IC(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=OC(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose()}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e2?L:0,L,L),g.setRenderTarget(r),R&&g.render(w,l),g.render(e,l)}w.geometry.dispose(),w.material.dispose(),g.toneMapping=x,g.autoClear=v,e.background=C}_textureToCubeUV(e,t){const n=this._renderer,r=e.mapping===Qo||e.mapping===Ko;r?(this._cubemapMaterial===null&&(this._cubemapMaterial=IC()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=OC());const s=r?this._cubemapMaterial:this._equirectMaterial,a=new zi(this._lodPlanes[0],s),l=s.uniforms;l.envMap.value=e;const u=this._cubeSize;W2(t,0,0,3*u,2*u),n.setRenderTarget(t),n.render(a,w3)}_applyPMREM(e){const t=this._renderer,n=t.autoClear;t.autoClear=!1;const r=this._lodPlanes.length;for(let s=1;szf&&console.warn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${C} samples when the maximum is set to ${zf}`);const E=[];let B=0;for(let k=0;kL-Hd?r-L+Hd:0),G=4*(this._cubeSize-O);W2(t,z,G,3*O,2*O),u.setRenderTarget(t),u.render(v,w3)}};function kV(i){const e=[],t=[],n=[];let r=i;const s=i-Hd+1+DC.length;for(let a=0;ai-Hd?u=DC[a-i+Hd-1]:a===0&&(u=0),n.push(u);const h=1/(l-2),g=-h,v=1+h,x=[g,g,v,g,v,v,g,g,v,v,g,v],S=6,w=6,R=3,C=2,E=1,B=new Float32Array(R*w*S),L=new Float32Array(C*w*S),O=new Float32Array(E*w*S);for(let G=0;G2?0:-1,F=[k,H,0,k+2/3,H,0,k+2/3,H+1,0,k,H,0,k+2/3,H+1,0,k,H+1,0];B.set(F,R*w*G),L.set(x,C*w*G);const V=[G,G,G,G,G,G];O.set(V,E*w*G)}const z=new Ki;z.setAttribute("position",new wr(B,R)),z.setAttribute("uv",new wr(L,C)),z.setAttribute("faceIndex",new wr(O,E)),e.push(z),r>Hd&&r--}return{lodPlanes:e,sizeLods:t,sigmas:n}}function BC(i,e,t){const n=new qh(i,e,t);return n.texture.mapping=sA,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function W2(i,e,t,n,r){i.viewport.set(e,t,n,r),i.scissor.set(e,t,n,r)}function zV(i,e,t){const n=new Float32Array(zf),r=new ce(0,1,0);return new Ja({name:"SphericalGaussianBlur",defines:{n:zf,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${i}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:n},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:r}},vertexShader:aM(),fragmentShader:` +}`,Zn={alphahash_fragment:Jz,alphahash_pars_fragment:eG,alphamap_fragment:tG,alphamap_pars_fragment:nG,alphatest_fragment:iG,alphatest_pars_fragment:rG,aomap_fragment:sG,aomap_pars_fragment:aG,batching_pars_vertex:oG,batching_vertex:lG,begin_vertex:uG,beginnormal_vertex:cG,bsdfs:hG,iridescence_fragment:fG,bumpmap_pars_fragment:AG,clipping_planes_fragment:dG,clipping_planes_pars_fragment:pG,clipping_planes_pars_vertex:mG,clipping_planes_vertex:gG,color_fragment:vG,color_pars_fragment:_G,color_pars_vertex:yG,color_vertex:xG,common:bG,cube_uv_reflection_fragment:SG,defaultnormal_vertex:TG,displacementmap_pars_vertex:wG,displacementmap_vertex:MG,emissivemap_fragment:EG,emissivemap_pars_fragment:CG,colorspace_fragment:RG,colorspace_pars_fragment:NG,envmap_fragment:DG,envmap_common_pars_fragment:PG,envmap_pars_fragment:LG,envmap_pars_vertex:UG,envmap_physical_pars_fragment:jG,envmap_vertex:BG,fog_vertex:OG,fog_pars_vertex:IG,fog_fragment:FG,fog_pars_fragment:kG,gradientmap_pars_fragment:zG,lightmap_pars_fragment:GG,lights_lambert_fragment:qG,lights_lambert_pars_fragment:VG,lights_pars_begin:HG,lights_toon_fragment:WG,lights_toon_pars_fragment:$G,lights_phong_fragment:XG,lights_phong_pars_fragment:YG,lights_physical_fragment:QG,lights_physical_pars_fragment:KG,lights_fragment_begin:ZG,lights_fragment_maps:JG,lights_fragment_end:eq,logdepthbuf_fragment:tq,logdepthbuf_pars_fragment:nq,logdepthbuf_pars_vertex:iq,logdepthbuf_vertex:rq,map_fragment:sq,map_pars_fragment:aq,map_particle_fragment:oq,map_particle_pars_fragment:lq,metalnessmap_fragment:uq,metalnessmap_pars_fragment:cq,morphinstance_vertex:hq,morphcolor_vertex:fq,morphnormal_vertex:Aq,morphtarget_pars_vertex:dq,morphtarget_vertex:pq,normal_fragment_begin:mq,normal_fragment_maps:gq,normal_pars_fragment:vq,normal_pars_vertex:_q,normal_vertex:yq,normalmap_pars_fragment:xq,clearcoat_normal_fragment_begin:bq,clearcoat_normal_fragment_maps:Sq,clearcoat_pars_fragment:Tq,iridescence_pars_fragment:wq,opaque_fragment:Mq,packing:Eq,premultiplied_alpha_fragment:Cq,project_vertex:Rq,dithering_fragment:Nq,dithering_pars_fragment:Dq,roughnessmap_fragment:Pq,roughnessmap_pars_fragment:Lq,shadowmap_pars_fragment:Uq,shadowmap_pars_vertex:Bq,shadowmap_vertex:Oq,shadowmask_pars_fragment:Iq,skinbase_vertex:Fq,skinning_pars_vertex:kq,skinning_vertex:zq,skinnormal_vertex:Gq,specularmap_fragment:qq,specularmap_pars_fragment:Vq,tonemapping_fragment:Hq,tonemapping_pars_fragment:jq,transmission_fragment:Wq,transmission_pars_fragment:$q,uv_pars_fragment:Xq,uv_pars_vertex:Yq,uv_vertex:Qq,worldpos_vertex:Kq,background_vert:Zq,background_frag:Jq,backgroundCube_vert:eV,backgroundCube_frag:tV,cube_vert:nV,cube_frag:iV,depth_vert:rV,depth_frag:sV,distanceRGBA_vert:aV,distanceRGBA_frag:oV,equirect_vert:lV,equirect_frag:uV,linedashed_vert:cV,linedashed_frag:hV,meshbasic_vert:fV,meshbasic_frag:AV,meshlambert_vert:dV,meshlambert_frag:pV,meshmatcap_vert:mV,meshmatcap_frag:gV,meshnormal_vert:vV,meshnormal_frag:_V,meshphong_vert:yV,meshphong_frag:xV,meshphysical_vert:bV,meshphysical_frag:SV,meshtoon_vert:TV,meshtoon_frag:wV,points_vert:MV,points_frag:EV,shadow_vert:CV,shadow_frag:RV,sprite_vert:NV,sprite_frag:DV},Yt={common:{diffuse:{value:new sn(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Vn},alphaMap:{value:null},alphaMapTransform:{value:new Vn},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Vn}},envmap:{envMap:{value:null},envMapRotation:{value:new Vn},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new Vn}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Vn}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Vn},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Vn},normalScale:{value:new dt(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Vn},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new Vn}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new Vn}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new Vn}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new sn(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new sn(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new Vn},alphaTest:{value:0},uvTransform:{value:new Vn}},sprite:{diffuse:{value:new sn(16777215)},opacity:{value:1},center:{value:new dt(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new Vn},alphaMap:{value:null},alphaMapTransform:{value:new Vn},alphaTest:{value:0}}},Ga={basic:{uniforms:_a([Yt.common,Yt.specularmap,Yt.envmap,Yt.aomap,Yt.lightmap,Yt.fog]),vertexShader:Zn.meshbasic_vert,fragmentShader:Zn.meshbasic_frag},lambert:{uniforms:_a([Yt.common,Yt.specularmap,Yt.envmap,Yt.aomap,Yt.lightmap,Yt.emissivemap,Yt.bumpmap,Yt.normalmap,Yt.displacementmap,Yt.fog,Yt.lights,{emissive:{value:new sn(0)}}]),vertexShader:Zn.meshlambert_vert,fragmentShader:Zn.meshlambert_frag},phong:{uniforms:_a([Yt.common,Yt.specularmap,Yt.envmap,Yt.aomap,Yt.lightmap,Yt.emissivemap,Yt.bumpmap,Yt.normalmap,Yt.displacementmap,Yt.fog,Yt.lights,{emissive:{value:new sn(0)},specular:{value:new sn(1118481)},shininess:{value:30}}]),vertexShader:Zn.meshphong_vert,fragmentShader:Zn.meshphong_frag},standard:{uniforms:_a([Yt.common,Yt.envmap,Yt.aomap,Yt.lightmap,Yt.emissivemap,Yt.bumpmap,Yt.normalmap,Yt.displacementmap,Yt.roughnessmap,Yt.metalnessmap,Yt.fog,Yt.lights,{emissive:{value:new sn(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Zn.meshphysical_vert,fragmentShader:Zn.meshphysical_frag},toon:{uniforms:_a([Yt.common,Yt.aomap,Yt.lightmap,Yt.emissivemap,Yt.bumpmap,Yt.normalmap,Yt.displacementmap,Yt.gradientmap,Yt.fog,Yt.lights,{emissive:{value:new sn(0)}}]),vertexShader:Zn.meshtoon_vert,fragmentShader:Zn.meshtoon_frag},matcap:{uniforms:_a([Yt.common,Yt.bumpmap,Yt.normalmap,Yt.displacementmap,Yt.fog,{matcap:{value:null}}]),vertexShader:Zn.meshmatcap_vert,fragmentShader:Zn.meshmatcap_frag},points:{uniforms:_a([Yt.points,Yt.fog]),vertexShader:Zn.points_vert,fragmentShader:Zn.points_frag},dashed:{uniforms:_a([Yt.common,Yt.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Zn.linedashed_vert,fragmentShader:Zn.linedashed_frag},depth:{uniforms:_a([Yt.common,Yt.displacementmap]),vertexShader:Zn.depth_vert,fragmentShader:Zn.depth_frag},normal:{uniforms:_a([Yt.common,Yt.bumpmap,Yt.normalmap,Yt.displacementmap,{opacity:{value:1}}]),vertexShader:Zn.meshnormal_vert,fragmentShader:Zn.meshnormal_frag},sprite:{uniforms:_a([Yt.sprite,Yt.fog]),vertexShader:Zn.sprite_vert,fragmentShader:Zn.sprite_frag},background:{uniforms:{uvTransform:{value:new Vn},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:Zn.background_vert,fragmentShader:Zn.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new Vn}},vertexShader:Zn.backgroundCube_vert,fragmentShader:Zn.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Zn.cube_vert,fragmentShader:Zn.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Zn.equirect_vert,fragmentShader:Zn.equirect_frag},distanceRGBA:{uniforms:_a([Yt.common,Yt.displacementmap,{referencePosition:{value:new ce},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Zn.distanceRGBA_vert,fragmentShader:Zn.distanceRGBA_frag},shadow:{uniforms:_a([Yt.lights,Yt.fog,{color:{value:new sn(0)},opacity:{value:1}}]),vertexShader:Zn.shadow_vert,fragmentShader:Zn.shadow_frag}};Ga.physical={uniforms:_a([Ga.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new Vn},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new Vn},clearcoatNormalScale:{value:new dt(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new Vn},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new Vn},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new Vn},sheen:{value:0},sheenColor:{value:new sn(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new Vn},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new Vn},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new Vn},transmissionSamplerSize:{value:new dt},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new Vn},attenuationDistance:{value:0},attenuationColor:{value:new sn(0)},specularColor:{value:new sn(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new Vn},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new Vn},anisotropyVector:{value:new dt},anisotropyMap:{value:null},anisotropyMapTransform:{value:new Vn}}]),vertexShader:Zn.meshphysical_vert,fragmentShader:Zn.meshphysical_frag};const j2={r:0,b:0,g:0},Tf=new la,PV=new kn;function LV(i,e,t,n,r,s,a){const l=new sn(0);let u=s===!0?0:1,h,g,v=null,x=0,S=null;function w(L){let O=L.isScene===!0?L.background:null;return O&&O.isTexture&&(O=(L.backgroundBlurriness>0?t:e).get(O)),O}function R(L){let O=!1;const z=w(L);z===null?E(l,u):z&&z.isColor&&(E(z,1),O=!0);const G=i.xr.getEnvironmentBlendMode();G==="additive"?n.buffers.color.setClear(0,0,0,1,a):G==="alpha-blend"&&n.buffers.color.setClear(0,0,0,0,a),(i.autoClear||O)&&(n.buffers.depth.setTest(!0),n.buffers.depth.setMask(!0),n.buffers.color.setMask(!0),i.clear(i.autoClearColor,i.autoClearDepth,i.autoClearStencil))}function C(L,O){const z=w(O);z&&(z.isCubeTexture||z.mapping===sA)?(g===void 0&&(g=new zi(new $h(1,1,1),new Ja({name:"BackgroundCubeMaterial",uniforms:E0(Ga.backgroundCube.uniforms),vertexShader:Ga.backgroundCube.vertexShader,fragmentShader:Ga.backgroundCube.fragmentShader,side:hr,depthTest:!1,depthWrite:!1,fog:!1})),g.geometry.deleteAttribute("normal"),g.geometry.deleteAttribute("uv"),g.onBeforeRender=function(G,k,H){this.matrixWorld.copyPosition(H.matrixWorld)},Object.defineProperty(g.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),r.update(g)),Tf.copy(O.backgroundRotation),Tf.x*=-1,Tf.y*=-1,Tf.z*=-1,z.isCubeTexture&&z.isRenderTargetTexture===!1&&(Tf.y*=-1,Tf.z*=-1),g.material.uniforms.envMap.value=z,g.material.uniforms.flipEnvMap.value=z.isCubeTexture&&z.isRenderTargetTexture===!1?-1:1,g.material.uniforms.backgroundBlurriness.value=O.backgroundBlurriness,g.material.uniforms.backgroundIntensity.value=O.backgroundIntensity,g.material.uniforms.backgroundRotation.value.setFromMatrix4(PV.makeRotationFromEuler(Tf)),g.material.toneMapped=ai.getTransfer(z.colorSpace)!==Vi,(v!==z||x!==z.version||S!==i.toneMapping)&&(g.material.needsUpdate=!0,v=z,x=z.version,S=i.toneMapping),g.layers.enableAll(),L.unshift(g,g.geometry,g.material,0,0,null)):z&&z.isTexture&&(h===void 0&&(h=new zi(new Ty(2,2),new Ja({name:"BackgroundMaterial",uniforms:E0(Ga.background.uniforms),vertexShader:Ga.background.vertexShader,fragmentShader:Ga.background.fragmentShader,side:Nl,depthTest:!1,depthWrite:!1,fog:!1})),h.geometry.deleteAttribute("normal"),Object.defineProperty(h.material,"map",{get:function(){return this.uniforms.t2D.value}}),r.update(h)),h.material.uniforms.t2D.value=z,h.material.uniforms.backgroundIntensity.value=O.backgroundIntensity,h.material.toneMapped=ai.getTransfer(z.colorSpace)!==Vi,z.matrixAutoUpdate===!0&&z.updateMatrix(),h.material.uniforms.uvTransform.value.copy(z.matrix),(v!==z||x!==z.version||S!==i.toneMapping)&&(h.material.needsUpdate=!0,v=z,x=z.version,S=i.toneMapping),h.layers.enableAll(),L.unshift(h,h.geometry,h.material,0,0,null))}function E(L,O){L.getRGB(j2,G7(i)),n.buffers.color.setClear(j2.r,j2.g,j2.b,O,a)}function B(){g!==void 0&&(g.geometry.dispose(),g.material.dispose()),h!==void 0&&(h.geometry.dispose(),h.material.dispose())}return{getClearColor:function(){return l},setClearColor:function(L,O=1){l.set(L),u=O,E(l,u)},getClearAlpha:function(){return u},setClearAlpha:function(L){u=L,E(l,u)},render:R,addToRenderList:C,dispose:B}}function UV(i,e){const t=i.getParameter(i.MAX_VERTEX_ATTRIBS),n={},r=x(null);let s=r,a=!1;function l(V,X,J,te,se){let ne=!1;const Z=v(te,J,X);s!==Z&&(s=Z,h(s.object)),ne=S(V,te,J,se),ne&&w(V,te,J,se),se!==null&&e.update(se,i.ELEMENT_ARRAY_BUFFER),(ne||a)&&(a=!1,O(V,X,J,te),se!==null&&i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,e.get(se).buffer))}function u(){return i.createVertexArray()}function h(V){return i.bindVertexArray(V)}function g(V){return i.deleteVertexArray(V)}function v(V,X,J){const te=J.wireframe===!0;let se=n[V.id];se===void 0&&(se={},n[V.id]=se);let ne=se[X.id];ne===void 0&&(ne={},se[X.id]=ne);let Z=ne[te];return Z===void 0&&(Z=x(u()),ne[te]=Z),Z}function x(V){const X=[],J=[],te=[];for(let se=0;se=0){const Se=se[he];let le=ne[he];if(le===void 0&&(he==="instanceMatrix"&&V.instanceMatrix&&(le=V.instanceMatrix),he==="instanceColor"&&V.instanceColor&&(le=V.instanceColor)),Se===void 0||Se.attribute!==le||le&&Se.data!==le.data)return!0;Z++}return s.attributesNum!==Z||s.index!==te}function w(V,X,J,te){const se={},ne=X.attributes;let Z=0;const ue=J.getAttributes();for(const he in ue)if(ue[he].location>=0){let Se=ne[he];Se===void 0&&(he==="instanceMatrix"&&V.instanceMatrix&&(Se=V.instanceMatrix),he==="instanceColor"&&V.instanceColor&&(Se=V.instanceColor));const le={};le.attribute=Se,Se&&Se.data&&(le.data=Se.data),se[he]=le,Z++}s.attributes=se,s.attributesNum=Z,s.index=te}function R(){const V=s.newAttributes;for(let X=0,J=V.length;X=0){let be=se[ue];if(be===void 0&&(ue==="instanceMatrix"&&V.instanceMatrix&&(be=V.instanceMatrix),ue==="instanceColor"&&V.instanceColor&&(be=V.instanceColor)),be!==void 0){const Se=be.normalized,le=be.itemSize,we=e.get(be);if(we===void 0)continue;const We=we.buffer,Te=we.type,ze=we.bytesPerElement,_e=Te===i.INT||Te===i.UNSIGNED_INT||be.gpuType===Ns;if(be.isInterleavedBufferAttribute){const De=be.data,pt=De.stride,_t=be.offset;if(De.isInstancedInterleavedBuffer){for(let wt=0;wt0&&i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.HIGH_FLOAT).precision>0)return"highp";k="mediump"}return k==="mediump"&&i.getShaderPrecisionFormat(i.VERTEX_SHADER,i.MEDIUM_FLOAT).precision>0&&i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let h=t.precision!==void 0?t.precision:"highp";const g=u(h);g!==h&&(console.warn("THREE.WebGLRenderer:",h,"not supported, using",g,"instead."),h=g);const v=t.logarithmicDepthBuffer===!0,x=t.reverseDepthBuffer===!0&&e.has("EXT_clip_control"),S=i.getParameter(i.MAX_TEXTURE_IMAGE_UNITS),w=i.getParameter(i.MAX_VERTEX_TEXTURE_IMAGE_UNITS),R=i.getParameter(i.MAX_TEXTURE_SIZE),C=i.getParameter(i.MAX_CUBE_MAP_TEXTURE_SIZE),E=i.getParameter(i.MAX_VERTEX_ATTRIBS),B=i.getParameter(i.MAX_VERTEX_UNIFORM_VECTORS),L=i.getParameter(i.MAX_VARYING_VECTORS),O=i.getParameter(i.MAX_FRAGMENT_UNIFORM_VECTORS),z=w>0,G=i.getParameter(i.MAX_SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:s,getMaxPrecision:u,textureFormatReadable:a,textureTypeReadable:l,precision:h,logarithmicDepthBuffer:v,reverseDepthBuffer:x,maxTextures:S,maxVertexTextures:w,maxTextureSize:R,maxCubemapSize:C,maxAttributes:E,maxVertexUniforms:B,maxVaryings:L,maxFragmentUniforms:O,vertexTextures:z,maxSamples:G}}function IV(i){const e=this;let t=null,n=0,r=!1,s=!1;const a=new Yl,l=new Vn,u={value:null,needsUpdate:!1};this.uniform=u,this.numPlanes=0,this.numIntersection=0,this.init=function(v,x){const S=v.length!==0||x||n!==0||r;return r=x,n=v.length,S},this.beginShadows=function(){s=!0,g(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(v,x){t=g(v,x,0)},this.setState=function(v,x,S){const w=v.clippingPlanes,R=v.clipIntersection,C=v.clipShadows,E=i.get(v);if(!r||w===null||w.length===0||s&&!C)s?g(null):h();else{const B=s?0:n,L=B*4;let O=E.clippingState||null;u.value=O,O=g(w,x,L,S);for(let z=0;z!==L;++z)O[z]=t[z];E.clippingState=O,this.numIntersection=R?this.numPlanes:0,this.numPlanes+=B}};function h(){u.value!==t&&(u.value=t,u.needsUpdate=n>0),e.numPlanes=n,e.numIntersection=0}function g(v,x,S,w){const R=v!==null?v.length:0;let C=null;if(R!==0){if(C=u.value,w!==!0||C===null){const E=S+R*4,B=x.matrixWorldInverse;l.getNormalMatrix(B),(C===null||C.length0){const h=new V7(u.height);return h.fromEquirectangularTexture(i,a),e.set(a,h),a.addEventListener("dispose",r),t(h.texture,a.mapping)}else return null}}return a}function r(a){const l=a.target;l.removeEventListener("dispose",r);const u=e.get(l);u!==void 0&&(e.delete(l),u.dispose())}function s(){e=new WeakMap}return{get:n,dispose:s}}const Hd=4,DC=[.125,.215,.35,.446,.526,.582],zf=20,w3=new kg,PC=new sn;let M3=null,E3=0,C3=0,R3=!1;const Bf=(1+Math.sqrt(5))/2,vd=1/Bf,LC=[new ce(-Bf,vd,0),new ce(Bf,vd,0),new ce(-vd,0,Bf),new ce(vd,0,Bf),new ce(0,Bf,-vd),new ce(0,Bf,vd),new ce(-1,1,-1),new ce(1,1,-1),new ce(-1,1,1),new ce(1,1,1)];let UC=class{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(e,t=0,n=.1,r=100){M3=this._renderer.getRenderTarget(),E3=this._renderer.getActiveCubeFace(),C3=this._renderer.getActiveMipmapLevel(),R3=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(256);const s=this._allocateTargets();return s.depthBuffer=!0,this._sceneToCubeUV(e,n,r,s),t>0&&this._blur(s,0,0,t),this._applyPMREM(s),this._cleanup(s),s}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=IC(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=OC(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose()}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e2?L:0,L,L),g.setRenderTarget(r),R&&g.render(w,l),g.render(e,l)}w.geometry.dispose(),w.material.dispose(),g.toneMapping=x,g.autoClear=v,e.background=C}_textureToCubeUV(e,t){const n=this._renderer,r=e.mapping===Qo||e.mapping===Ko;r?(this._cubemapMaterial===null&&(this._cubemapMaterial=IC()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=OC());const s=r?this._cubemapMaterial:this._equirectMaterial,a=new zi(this._lodPlanes[0],s),l=s.uniforms;l.envMap.value=e;const u=this._cubeSize;W2(t,0,0,3*u,2*u),n.setRenderTarget(t),n.render(a,w3)}_applyPMREM(e){const t=this._renderer,n=t.autoClear;t.autoClear=!1;const r=this._lodPlanes.length;for(let s=1;szf&&console.warn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${C} samples when the maximum is set to ${zf}`);const E=[];let B=0;for(let k=0;kL-Hd?r-L+Hd:0),G=4*(this._cubeSize-O);W2(t,z,G,3*O,2*O),u.setRenderTarget(t),u.render(v,w3)}};function kV(i){const e=[],t=[],n=[];let r=i;const s=i-Hd+1+DC.length;for(let a=0;ai-Hd?u=DC[a-i+Hd-1]:a===0&&(u=0),n.push(u);const h=1/(l-2),g=-h,v=1+h,x=[g,g,v,g,v,v,g,g,v,v,g,v],S=6,w=6,R=3,C=2,E=1,B=new Float32Array(R*w*S),L=new Float32Array(C*w*S),O=new Float32Array(E*w*S);for(let G=0;G2?0:-1,F=[k,H,0,k+2/3,H,0,k+2/3,H+1,0,k,H,0,k+2/3,H+1,0,k,H+1,0];B.set(F,R*w*G),L.set(x,C*w*G);const V=[G,G,G,G,G,G];O.set(V,E*w*G)}const z=new Ki;z.setAttribute("position",new wr(B,R)),z.setAttribute("uv",new wr(L,C)),z.setAttribute("faceIndex",new wr(O,E)),e.push(z),r>Hd&&r--}return{lodPlanes:e,sizeLods:t,sigmas:n}}function BC(i,e,t){const n=new qh(i,e,t);return n.texture.mapping=sA,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function W2(i,e,t,n,r){i.viewport.set(e,t,n,r),i.scissor.set(e,t,n,r)}function zV(i,e,t){const n=new Float32Array(zf),r=new ce(0,1,0);return new Ja({name:"SphericalGaussianBlur",defines:{n:zf,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${i}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:n},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:r}},vertexShader:aM(),fragmentShader:` precision mediump float; precision mediump int; @@ -3769,7 +3769,7 @@ void main() { gl_Position = vec4( position, 1.0 ); } - `}function GV(i){let e=new WeakMap,t=null;function n(l){if(l&&l.isTexture){const u=l.mapping,h=u===zh||u===Gh,g=u===Qo||u===Ko;if(h||g){let v=e.get(l);const x=v!==void 0?v.texture.pmremVersion:0;if(l.isRenderTargetTexture&&l.pmremVersion!==x)return t===null&&(t=new UC(i)),v=h?t.fromEquirectangular(l,v):t.fromCubemap(l,v),v.texture.pmremVersion=l.pmremVersion,e.set(l,v),v.texture;if(v!==void 0)return v.texture;{const S=l.image;return h&&S&&S.height>0||g&&S&&r(S)?(t===null&&(t=new UC(i)),v=h?t.fromEquirectangular(l):t.fromCubemap(l),v.texture.pmremVersion=l.pmremVersion,e.set(l,v),l.addEventListener("dispose",s),v.texture):null}}}return l}function r(l){let u=0;const h=6;for(let g=0;ge.maxTextureSize&&(G=Math.ceil(z/e.maxTextureSize),z=e.maxTextureSize);const k=new Float32Array(z*G*4*v),H=new Hw(k,z,G,v);H.type=$r,H.needsUpdate=!0;const F=O*4;for(let X=0;X0)return i;const r=e*t;let s=kC[r];if(s===void 0&&(s=new Float32Array(r),kC[r]=s),e!==0){n.toArray(s,0);for(let a=1,l=0;a!==e;++a)l+=t,i[a].toArray(s,l)}return s}function _s(i,e){if(i.length!==e.length)return!1;for(let t=0,n=i.length;t0||g&&S&&r(S)?(t===null&&(t=new UC(i)),v=h?t.fromEquirectangular(l):t.fromCubemap(l),v.texture.pmremVersion=l.pmremVersion,e.set(l,v),l.addEventListener("dispose",s),v.texture):null}}}return l}function r(l){let u=0;const h=6;for(let g=0;ge.maxTextureSize&&(G=Math.ceil(z/e.maxTextureSize),z=e.maxTextureSize);const k=new Float32Array(z*G*4*v),H=new Hw(k,z,G,v);H.type=$r,H.needsUpdate=!0;const F=O*4;for(let X=0;X0)return i;const r=e*t;let s=kC[r];if(s===void 0&&(s=new Float32Array(r),kC[r]=s),e!==0){n.toArray(s,0);for(let a=1,l=0;a!==e;++a)l+=t,i[a].toArray(s,l)}return s}function _s(i,e){if(i.length!==e.length)return!1;for(let t=0,n=i.length;t":" "} ${l}: ${t[a]}`)}return n.join(` `)}const WC=new Vn;function GH(i){ai._getMatrix(WC,ai.workingColorSpace,i);const e=`mat3( ${WC.elements.map(t=>t.toFixed(4))} )`;switch(ai.getTransfer(i)){case a_:return[e,"LinearTransferOETF"];case Vi:return[e,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space: ",i),[e,"LinearTransferOETF"]}}function $C(i,e,t){const n=i.getShaderParameter(e,i.COMPILE_STATUS),r=i.getShaderInfoLog(e).trim();if(n&&r==="")return"";const s=/ERROR: 0:(\d+)/.exec(r);if(s){const a=parseInt(s[1]);return t.toUpperCase()+` @@ -3820,7 +3820,7 @@ Material Type: `+X.type+` Program Info Log: `+J+` `+ue+` -`+he)}else J!==""?console.warn("THREE.WebGLProgram: Program Info Log:",J):(te===""||se==="")&&(Z=!1);Z&&(X.diagnostics={runnable:ne,programLog:J,vertexShader:{log:te,prefix:C},fragmentShader:{log:se,prefix:E}})}r.deleteShader(z),r.deleteShader(G),H=new qv(r,R),F=$H(r,R)}let H;this.getUniforms=function(){return H===void 0&&k(this),H};let F;this.getAttributes=function(){return F===void 0&&k(this),F};let V=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return V===!1&&(V=r.getProgramParameter(R,FH)),V},this.destroy=function(){n.releaseStatesOfProgram(this),r.deleteProgram(R),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=kH++,this.cacheKey=e,this.usedTimes=1,this.program=R,this.vertexShader=z,this.fragmentShader=G,this}let sj=0;class aj{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const t=e.vertexShader,n=e.fragmentShader,r=this._getShaderStage(t),s=this._getShaderStage(n),a=this._getShaderCacheForMaterial(e);return a.has(r)===!1&&(a.add(r),r.usedTimes++),a.has(s)===!1&&(a.add(s),s.usedTimes++),this}remove(e){const t=this.materialCache.get(e);for(const n of t)n.usedTimes--,n.usedTimes===0&&this.shaderCache.delete(n.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const t=this.materialCache;let n=t.get(e);return n===void 0&&(n=new Set,t.set(e,n)),n}_getShaderStage(e){const t=this.shaderCache;let n=t.get(e);return n===void 0&&(n=new oj(e),t.set(e,n)),n}}class oj{constructor(e){this.id=sj++,this.code=e,this.usedTimes=0}}function lj(i,e,t,n,r,s,a){const l=new jw,u=new aj,h=new Set,g=[],v=r.logarithmicDepthBuffer,x=r.vertexTextures;let S=r.precision;const w={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function R(F){return h.add(F),F===0?"uv":`uv${F}`}function C(F,V,X,J,te){const se=J.fog,ne=te.geometry,Z=F.isMeshStandardMaterial?J.environment:null,ue=(F.isMeshStandardMaterial?t:e).get(F.envMap||Z),he=ue&&ue.mapping===sA?ue.image.height:null,be=w[F.type];F.precision!==null&&(S=r.getMaxPrecision(F.precision),S!==F.precision&&console.warn("THREE.WebGLProgram.getParameters:",F.precision,"not supported, using",S,"instead."));const Se=ne.morphAttributes.position||ne.morphAttributes.normal||ne.morphAttributes.color,le=Se!==void 0?Se.length:0;let we=0;ne.morphAttributes.position!==void 0&&(we=1),ne.morphAttributes.normal!==void 0&&(we=2),ne.morphAttributes.color!==void 0&&(we=3);let We,Te,ze,_e;if(be){const pn=Ga[be];We=pn.vertexShader,Te=pn.fragmentShader}else We=F.vertexShader,Te=F.fragmentShader,u.update(F),ze=u.getVertexShaderID(F),_e=u.getFragmentShaderID(F);const De=i.getRenderTarget(),dt=i.state.buffers.depth.getReversed(),vt=te.isInstancedMesh===!0,Tt=te.isBatchedMesh===!0,Ge=!!F.map,Be=!!F.matcap,ke=!!ue,oe=!!F.aoMap,Mt=!!F.lightMap,lt=!!F.bumpMap,Dt=!!F.normalMap,wt=!!F.displacementMap,tn=!!F.emissiveMap,bt=!!F.metalnessMap,fe=!!F.roughnessMap,Y=F.anisotropy>0,Ce=F.clearcoat>0,$e=F.dispersion>0,it=F.iridescence>0,tt=F.sheen>0,Vt=F.transmission>0,Bt=Y&&!!F.anisotropyMap,Wt=Ce&&!!F.clearcoatMap,ln=Ce&&!!F.clearcoatNormalMap,St=Ce&&!!F.clearcoatRoughnessMap,Kt=it&&!!F.iridescenceMap,rn=it&&!!F.iridescenceThicknessMap,Ht=tt&&!!F.sheenColorMap,Ft=tt&&!!F.sheenRoughnessMap,Gt=!!F.specularMap,In=!!F.specularColorMap,Mi=!!F.specularIntensityMap,me=Vt&&!!F.transmissionMap,jt=Vt&&!!F.thicknessMap,rt=!!F.gradientMap,_t=!!F.alphaMap,$t=F.alphaTest>0,kt=!!F.alphaHash,xn=!!F.extensions;let qi=Za;F.toneMapped&&(De===null||De.isXRRenderTarget===!0)&&(qi=i.toneMapping);const rr={shaderID:be,shaderType:F.type,shaderName:F.name,vertexShader:We,fragmentShader:Te,defines:F.defines,customVertexShaderID:ze,customFragmentShaderID:_e,isRawShaderMaterial:F.isRawShaderMaterial===!0,glslVersion:F.glslVersion,precision:S,batching:Tt,batchingColor:Tt&&te._colorsTexture!==null,instancing:vt,instancingColor:vt&&te.instanceColor!==null,instancingMorph:vt&&te.morphTexture!==null,supportsVertexTextures:x,outputColorSpace:De===null?i.outputColorSpace:De.isXRRenderTarget===!0?De.texture.colorSpace:Ro,alphaToCoverage:!!F.alphaToCoverage,map:Ge,matcap:Be,envMap:ke,envMapMode:ke&&ue.mapping,envMapCubeUVHeight:he,aoMap:oe,lightMap:Mt,bumpMap:lt,normalMap:Dt,displacementMap:x&&wt,emissiveMap:tn,normalMapObjectSpace:Dt&&F.normalMapType===B7,normalMapTangentSpace:Dt&&F.normalMapType===Dc,metalnessMap:bt,roughnessMap:fe,anisotropy:Y,anisotropyMap:Bt,clearcoat:Ce,clearcoatMap:Wt,clearcoatNormalMap:ln,clearcoatRoughnessMap:St,dispersion:$e,iridescence:it,iridescenceMap:Kt,iridescenceThicknessMap:rn,sheen:tt,sheenColorMap:Ht,sheenRoughnessMap:Ft,specularMap:Gt,specularColorMap:In,specularIntensityMap:Mi,transmission:Vt,transmissionMap:me,thicknessMap:jt,gradientMap:rt,opaque:F.transparent===!1&&F.blending===Ka&&F.alphaToCoverage===!1,alphaMap:_t,alphaTest:$t,alphaHash:kt,combine:F.combine,mapUv:Ge&&R(F.map.channel),aoMapUv:oe&&R(F.aoMap.channel),lightMapUv:Mt&&R(F.lightMap.channel),bumpMapUv:lt&&R(F.bumpMap.channel),normalMapUv:Dt&&R(F.normalMap.channel),displacementMapUv:wt&&R(F.displacementMap.channel),emissiveMapUv:tn&&R(F.emissiveMap.channel),metalnessMapUv:bt&&R(F.metalnessMap.channel),roughnessMapUv:fe&&R(F.roughnessMap.channel),anisotropyMapUv:Bt&&R(F.anisotropyMap.channel),clearcoatMapUv:Wt&&R(F.clearcoatMap.channel),clearcoatNormalMapUv:ln&&R(F.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:St&&R(F.clearcoatRoughnessMap.channel),iridescenceMapUv:Kt&&R(F.iridescenceMap.channel),iridescenceThicknessMapUv:rn&&R(F.iridescenceThicknessMap.channel),sheenColorMapUv:Ht&&R(F.sheenColorMap.channel),sheenRoughnessMapUv:Ft&&R(F.sheenRoughnessMap.channel),specularMapUv:Gt&&R(F.specularMap.channel),specularColorMapUv:In&&R(F.specularColorMap.channel),specularIntensityMapUv:Mi&&R(F.specularIntensityMap.channel),transmissionMapUv:me&&R(F.transmissionMap.channel),thicknessMapUv:jt&&R(F.thicknessMap.channel),alphaMapUv:_t&&R(F.alphaMap.channel),vertexTangents:!!ne.attributes.tangent&&(Dt||Y),vertexColors:F.vertexColors,vertexAlphas:F.vertexColors===!0&&!!ne.attributes.color&&ne.attributes.color.itemSize===4,pointsUvs:te.isPoints===!0&&!!ne.attributes.uv&&(Ge||_t),fog:!!se,useFog:F.fog===!0,fogExp2:!!se&&se.isFogExp2,flatShading:F.flatShading===!0,sizeAttenuation:F.sizeAttenuation===!0,logarithmicDepthBuffer:v,reverseDepthBuffer:dt,skinning:te.isSkinnedMesh===!0,morphTargets:ne.morphAttributes.position!==void 0,morphNormals:ne.morphAttributes.normal!==void 0,morphColors:ne.morphAttributes.color!==void 0,morphTargetsCount:le,morphTextureStride:we,numDirLights:V.directional.length,numPointLights:V.point.length,numSpotLights:V.spot.length,numSpotLightMaps:V.spotLightMap.length,numRectAreaLights:V.rectArea.length,numHemiLights:V.hemi.length,numDirLightShadows:V.directionalShadowMap.length,numPointLightShadows:V.pointShadowMap.length,numSpotLightShadows:V.spotShadowMap.length,numSpotLightShadowsWithMaps:V.numSpotLightShadowsWithMaps,numLightProbes:V.numLightProbes,numClippingPlanes:a.numPlanes,numClipIntersection:a.numIntersection,dithering:F.dithering,shadowMapEnabled:i.shadowMap.enabled&&X.length>0,shadowMapType:i.shadowMap.type,toneMapping:qi,decodeVideoTexture:Ge&&F.map.isVideoTexture===!0&&ai.getTransfer(F.map.colorSpace)===Vi,decodeVideoTextureEmissive:tn&&F.emissiveMap.isVideoTexture===!0&&ai.getTransfer(F.emissiveMap.colorSpace)===Vi,premultipliedAlpha:F.premultipliedAlpha,doubleSided:F.side===as,flipSided:F.side===hr,useDepthPacking:F.depthPacking>=0,depthPacking:F.depthPacking||0,index0AttributeName:F.index0AttributeName,extensionClipCullDistance:xn&&F.extensions.clipCullDistance===!0&&n.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(xn&&F.extensions.multiDraw===!0||Tt)&&n.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:n.has("KHR_parallel_shader_compile"),customProgramCacheKey:F.customProgramCacheKey()};return rr.vertexUv1s=h.has(1),rr.vertexUv2s=h.has(2),rr.vertexUv3s=h.has(3),h.clear(),rr}function E(F){const V=[];if(F.shaderID?V.push(F.shaderID):(V.push(F.customVertexShaderID),V.push(F.customFragmentShaderID)),F.defines!==void 0)for(const X in F.defines)V.push(X),V.push(F.defines[X]);return F.isRawShaderMaterial===!1&&(B(V,F),L(V,F),V.push(i.outputColorSpace)),V.push(F.customProgramCacheKey),V.join()}function B(F,V){F.push(V.precision),F.push(V.outputColorSpace),F.push(V.envMapMode),F.push(V.envMapCubeUVHeight),F.push(V.mapUv),F.push(V.alphaMapUv),F.push(V.lightMapUv),F.push(V.aoMapUv),F.push(V.bumpMapUv),F.push(V.normalMapUv),F.push(V.displacementMapUv),F.push(V.emissiveMapUv),F.push(V.metalnessMapUv),F.push(V.roughnessMapUv),F.push(V.anisotropyMapUv),F.push(V.clearcoatMapUv),F.push(V.clearcoatNormalMapUv),F.push(V.clearcoatRoughnessMapUv),F.push(V.iridescenceMapUv),F.push(V.iridescenceThicknessMapUv),F.push(V.sheenColorMapUv),F.push(V.sheenRoughnessMapUv),F.push(V.specularMapUv),F.push(V.specularColorMapUv),F.push(V.specularIntensityMapUv),F.push(V.transmissionMapUv),F.push(V.thicknessMapUv),F.push(V.combine),F.push(V.fogExp2),F.push(V.sizeAttenuation),F.push(V.morphTargetsCount),F.push(V.morphAttributeCount),F.push(V.numDirLights),F.push(V.numPointLights),F.push(V.numSpotLights),F.push(V.numSpotLightMaps),F.push(V.numHemiLights),F.push(V.numRectAreaLights),F.push(V.numDirLightShadows),F.push(V.numPointLightShadows),F.push(V.numSpotLightShadows),F.push(V.numSpotLightShadowsWithMaps),F.push(V.numLightProbes),F.push(V.shadowMapType),F.push(V.toneMapping),F.push(V.numClippingPlanes),F.push(V.numClipIntersection),F.push(V.depthPacking)}function L(F,V){l.disableAll(),V.supportsVertexTextures&&l.enable(0),V.instancing&&l.enable(1),V.instancingColor&&l.enable(2),V.instancingMorph&&l.enable(3),V.matcap&&l.enable(4),V.envMap&&l.enable(5),V.normalMapObjectSpace&&l.enable(6),V.normalMapTangentSpace&&l.enable(7),V.clearcoat&&l.enable(8),V.iridescence&&l.enable(9),V.alphaTest&&l.enable(10),V.vertexColors&&l.enable(11),V.vertexAlphas&&l.enable(12),V.vertexUv1s&&l.enable(13),V.vertexUv2s&&l.enable(14),V.vertexUv3s&&l.enable(15),V.vertexTangents&&l.enable(16),V.anisotropy&&l.enable(17),V.alphaHash&&l.enable(18),V.batching&&l.enable(19),V.dispersion&&l.enable(20),V.batchingColor&&l.enable(21),F.push(l.mask),l.disableAll(),V.fog&&l.enable(0),V.useFog&&l.enable(1),V.flatShading&&l.enable(2),V.logarithmicDepthBuffer&&l.enable(3),V.reverseDepthBuffer&&l.enable(4),V.skinning&&l.enable(5),V.morphTargets&&l.enable(6),V.morphNormals&&l.enable(7),V.morphColors&&l.enable(8),V.premultipliedAlpha&&l.enable(9),V.shadowMapEnabled&&l.enable(10),V.doubleSided&&l.enable(11),V.flipSided&&l.enable(12),V.useDepthPacking&&l.enable(13),V.dithering&&l.enable(14),V.transmission&&l.enable(15),V.sheen&&l.enable(16),V.opaque&&l.enable(17),V.pointsUvs&&l.enable(18),V.decodeVideoTexture&&l.enable(19),V.decodeVideoTextureEmissive&&l.enable(20),V.alphaToCoverage&&l.enable(21),F.push(l.mask)}function O(F){const V=w[F.type];let X;if(V){const J=Ga[V];X=vy.clone(J.uniforms)}else X=F.uniforms;return X}function z(F,V){let X;for(let J=0,te=g.length;J0?n.push(E):S.transparent===!0?r.push(E):t.push(E)}function u(v,x,S,w,R,C){const E=a(v,x,S,w,R,C);S.transmission>0?n.unshift(E):S.transparent===!0?r.unshift(E):t.unshift(E)}function h(v,x){t.length>1&&t.sort(v||cj),n.length>1&&n.sort(x||ZC),r.length>1&&r.sort(x||ZC)}function g(){for(let v=e,x=i.length;v=s.length?(a=new JC,s.push(a)):a=s[r],a}function t(){i=new WeakMap}return{get:e,dispose:t}}function fj(){const i={};return{get:function(e){if(i[e.id]!==void 0)return i[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new ce,color:new sn};break;case"SpotLight":t={position:new ce,direction:new ce,color:new sn,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new ce,color:new sn,distance:0,decay:0};break;case"HemisphereLight":t={direction:new ce,skyColor:new sn,groundColor:new sn};break;case"RectAreaLight":t={color:new sn,position:new ce,halfWidth:new ce,halfHeight:new ce};break}return i[e.id]=t,t}}}function Aj(){const i={};return{get:function(e){if(i[e.id]!==void 0)return i[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new At};break;case"SpotLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new At};break;case"PointLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new At,shadowCameraNear:1,shadowCameraFar:1e3};break}return i[e.id]=t,t}}}let dj=0;function pj(i,e){return(e.castShadow?2:0)-(i.castShadow?2:0)+(e.map?1:0)-(i.map?1:0)}function mj(i){const e=new fj,t=Aj(),n={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let h=0;h<9;h++)n.probe.push(new ce);const r=new ce,s=new kn,a=new kn;function l(h){let g=0,v=0,x=0;for(let F=0;F<9;F++)n.probe[F].set(0,0,0);let S=0,w=0,R=0,C=0,E=0,B=0,L=0,O=0,z=0,G=0,k=0;h.sort(pj);for(let F=0,V=h.length;F0&&(i.has("OES_texture_float_linear")===!0?(n.rectAreaLTC1=Yt.LTC_FLOAT_1,n.rectAreaLTC2=Yt.LTC_FLOAT_2):(n.rectAreaLTC1=Yt.LTC_HALF_1,n.rectAreaLTC2=Yt.LTC_HALF_2)),n.ambient[0]=g,n.ambient[1]=v,n.ambient[2]=x;const H=n.hash;(H.directionalLength!==S||H.pointLength!==w||H.spotLength!==R||H.rectAreaLength!==C||H.hemiLength!==E||H.numDirectionalShadows!==B||H.numPointShadows!==L||H.numSpotShadows!==O||H.numSpotMaps!==z||H.numLightProbes!==k)&&(n.directional.length=S,n.spot.length=R,n.rectArea.length=C,n.point.length=w,n.hemi.length=E,n.directionalShadow.length=B,n.directionalShadowMap.length=B,n.pointShadow.length=L,n.pointShadowMap.length=L,n.spotShadow.length=O,n.spotShadowMap.length=O,n.directionalShadowMatrix.length=B,n.pointShadowMatrix.length=L,n.spotLightMatrix.length=O+z-G,n.spotLightMap.length=z,n.numSpotLightShadowsWithMaps=G,n.numLightProbes=k,H.directionalLength=S,H.pointLength=w,H.spotLength=R,H.rectAreaLength=C,H.hemiLength=E,H.numDirectionalShadows=B,H.numPointShadows=L,H.numSpotShadows=O,H.numSpotMaps=z,H.numLightProbes=k,n.version=dj++)}function u(h,g){let v=0,x=0,S=0,w=0,R=0;const C=g.matrixWorldInverse;for(let E=0,B=h.length;E=a.length?(l=new e6(i),a.push(l)):l=a[s],l}function n(){e=new WeakMap}return{get:t,dispose:n}}const vj=`void main() { +`+he)}else J!==""?console.warn("THREE.WebGLProgram: Program Info Log:",J):(te===""||se==="")&&(Z=!1);Z&&(X.diagnostics={runnable:ne,programLog:J,vertexShader:{log:te,prefix:C},fragmentShader:{log:se,prefix:E}})}r.deleteShader(z),r.deleteShader(G),H=new qv(r,R),F=$H(r,R)}let H;this.getUniforms=function(){return H===void 0&&k(this),H};let F;this.getAttributes=function(){return F===void 0&&k(this),F};let V=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return V===!1&&(V=r.getProgramParameter(R,FH)),V},this.destroy=function(){n.releaseStatesOfProgram(this),r.deleteProgram(R),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=kH++,this.cacheKey=e,this.usedTimes=1,this.program=R,this.vertexShader=z,this.fragmentShader=G,this}let sj=0;class aj{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const t=e.vertexShader,n=e.fragmentShader,r=this._getShaderStage(t),s=this._getShaderStage(n),a=this._getShaderCacheForMaterial(e);return a.has(r)===!1&&(a.add(r),r.usedTimes++),a.has(s)===!1&&(a.add(s),s.usedTimes++),this}remove(e){const t=this.materialCache.get(e);for(const n of t)n.usedTimes--,n.usedTimes===0&&this.shaderCache.delete(n.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const t=this.materialCache;let n=t.get(e);return n===void 0&&(n=new Set,t.set(e,n)),n}_getShaderStage(e){const t=this.shaderCache;let n=t.get(e);return n===void 0&&(n=new oj(e),t.set(e,n)),n}}class oj{constructor(e){this.id=sj++,this.code=e,this.usedTimes=0}}function lj(i,e,t,n,r,s,a){const l=new jw,u=new aj,h=new Set,g=[],v=r.logarithmicDepthBuffer,x=r.vertexTextures;let S=r.precision;const w={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function R(F){return h.add(F),F===0?"uv":`uv${F}`}function C(F,V,X,J,te){const se=J.fog,ne=te.geometry,Z=F.isMeshStandardMaterial?J.environment:null,ue=(F.isMeshStandardMaterial?t:e).get(F.envMap||Z),he=ue&&ue.mapping===sA?ue.image.height:null,be=w[F.type];F.precision!==null&&(S=r.getMaxPrecision(F.precision),S!==F.precision&&console.warn("THREE.WebGLProgram.getParameters:",F.precision,"not supported, using",S,"instead."));const Se=ne.morphAttributes.position||ne.morphAttributes.normal||ne.morphAttributes.color,le=Se!==void 0?Se.length:0;let we=0;ne.morphAttributes.position!==void 0&&(we=1),ne.morphAttributes.normal!==void 0&&(we=2),ne.morphAttributes.color!==void 0&&(we=3);let We,Te,ze,_e;if(be){const pn=Ga[be];We=pn.vertexShader,Te=pn.fragmentShader}else We=F.vertexShader,Te=F.fragmentShader,u.update(F),ze=u.getVertexShaderID(F),_e=u.getFragmentShaderID(F);const De=i.getRenderTarget(),pt=i.state.buffers.depth.getReversed(),_t=te.isInstancedMesh===!0,wt=te.isBatchedMesh===!0,Ge=!!F.map,Be=!!F.matcap,ke=!!ue,oe=!!F.aoMap,Mt=!!F.lightMap,lt=!!F.bumpMap,Dt=!!F.normalMap,ut=!!F.displacementMap,en=!!F.emissiveMap,St=!!F.metalnessMap,fe=!!F.roughnessMap,Y=F.anisotropy>0,Ce=F.clearcoat>0,$e=F.dispersion>0,it=F.iridescence>0,tt=F.sheen>0,Vt=F.transmission>0,Bt=Y&&!!F.anisotropyMap,Wt=Ce&&!!F.clearcoatMap,ln=Ce&&!!F.clearcoatNormalMap,Tt=Ce&&!!F.clearcoatRoughnessMap,Kt=it&&!!F.iridescenceMap,rn=it&&!!F.iridescenceThicknessMap,Ht=tt&&!!F.sheenColorMap,Ft=tt&&!!F.sheenRoughnessMap,Gt=!!F.specularMap,In=!!F.specularColorMap,Mi=!!F.specularIntensityMap,me=Vt&&!!F.transmissionMap,jt=Vt&&!!F.thicknessMap,rt=!!F.gradientMap,yt=!!F.alphaMap,$t=F.alphaTest>0,kt=!!F.alphaHash,xn=!!F.extensions;let qi=Za;F.toneMapped&&(De===null||De.isXRRenderTarget===!0)&&(qi=i.toneMapping);const rr={shaderID:be,shaderType:F.type,shaderName:F.name,vertexShader:We,fragmentShader:Te,defines:F.defines,customVertexShaderID:ze,customFragmentShaderID:_e,isRawShaderMaterial:F.isRawShaderMaterial===!0,glslVersion:F.glslVersion,precision:S,batching:wt,batchingColor:wt&&te._colorsTexture!==null,instancing:_t,instancingColor:_t&&te.instanceColor!==null,instancingMorph:_t&&te.morphTexture!==null,supportsVertexTextures:x,outputColorSpace:De===null?i.outputColorSpace:De.isXRRenderTarget===!0?De.texture.colorSpace:Ro,alphaToCoverage:!!F.alphaToCoverage,map:Ge,matcap:Be,envMap:ke,envMapMode:ke&&ue.mapping,envMapCubeUVHeight:he,aoMap:oe,lightMap:Mt,bumpMap:lt,normalMap:Dt,displacementMap:x&&ut,emissiveMap:en,normalMapObjectSpace:Dt&&F.normalMapType===B7,normalMapTangentSpace:Dt&&F.normalMapType===Dc,metalnessMap:St,roughnessMap:fe,anisotropy:Y,anisotropyMap:Bt,clearcoat:Ce,clearcoatMap:Wt,clearcoatNormalMap:ln,clearcoatRoughnessMap:Tt,dispersion:$e,iridescence:it,iridescenceMap:Kt,iridescenceThicknessMap:rn,sheen:tt,sheenColorMap:Ht,sheenRoughnessMap:Ft,specularMap:Gt,specularColorMap:In,specularIntensityMap:Mi,transmission:Vt,transmissionMap:me,thicknessMap:jt,gradientMap:rt,opaque:F.transparent===!1&&F.blending===Ka&&F.alphaToCoverage===!1,alphaMap:yt,alphaTest:$t,alphaHash:kt,combine:F.combine,mapUv:Ge&&R(F.map.channel),aoMapUv:oe&&R(F.aoMap.channel),lightMapUv:Mt&&R(F.lightMap.channel),bumpMapUv:lt&&R(F.bumpMap.channel),normalMapUv:Dt&&R(F.normalMap.channel),displacementMapUv:ut&&R(F.displacementMap.channel),emissiveMapUv:en&&R(F.emissiveMap.channel),metalnessMapUv:St&&R(F.metalnessMap.channel),roughnessMapUv:fe&&R(F.roughnessMap.channel),anisotropyMapUv:Bt&&R(F.anisotropyMap.channel),clearcoatMapUv:Wt&&R(F.clearcoatMap.channel),clearcoatNormalMapUv:ln&&R(F.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:Tt&&R(F.clearcoatRoughnessMap.channel),iridescenceMapUv:Kt&&R(F.iridescenceMap.channel),iridescenceThicknessMapUv:rn&&R(F.iridescenceThicknessMap.channel),sheenColorMapUv:Ht&&R(F.sheenColorMap.channel),sheenRoughnessMapUv:Ft&&R(F.sheenRoughnessMap.channel),specularMapUv:Gt&&R(F.specularMap.channel),specularColorMapUv:In&&R(F.specularColorMap.channel),specularIntensityMapUv:Mi&&R(F.specularIntensityMap.channel),transmissionMapUv:me&&R(F.transmissionMap.channel),thicknessMapUv:jt&&R(F.thicknessMap.channel),alphaMapUv:yt&&R(F.alphaMap.channel),vertexTangents:!!ne.attributes.tangent&&(Dt||Y),vertexColors:F.vertexColors,vertexAlphas:F.vertexColors===!0&&!!ne.attributes.color&&ne.attributes.color.itemSize===4,pointsUvs:te.isPoints===!0&&!!ne.attributes.uv&&(Ge||yt),fog:!!se,useFog:F.fog===!0,fogExp2:!!se&&se.isFogExp2,flatShading:F.flatShading===!0,sizeAttenuation:F.sizeAttenuation===!0,logarithmicDepthBuffer:v,reverseDepthBuffer:pt,skinning:te.isSkinnedMesh===!0,morphTargets:ne.morphAttributes.position!==void 0,morphNormals:ne.morphAttributes.normal!==void 0,morphColors:ne.morphAttributes.color!==void 0,morphTargetsCount:le,morphTextureStride:we,numDirLights:V.directional.length,numPointLights:V.point.length,numSpotLights:V.spot.length,numSpotLightMaps:V.spotLightMap.length,numRectAreaLights:V.rectArea.length,numHemiLights:V.hemi.length,numDirLightShadows:V.directionalShadowMap.length,numPointLightShadows:V.pointShadowMap.length,numSpotLightShadows:V.spotShadowMap.length,numSpotLightShadowsWithMaps:V.numSpotLightShadowsWithMaps,numLightProbes:V.numLightProbes,numClippingPlanes:a.numPlanes,numClipIntersection:a.numIntersection,dithering:F.dithering,shadowMapEnabled:i.shadowMap.enabled&&X.length>0,shadowMapType:i.shadowMap.type,toneMapping:qi,decodeVideoTexture:Ge&&F.map.isVideoTexture===!0&&ai.getTransfer(F.map.colorSpace)===Vi,decodeVideoTextureEmissive:en&&F.emissiveMap.isVideoTexture===!0&&ai.getTransfer(F.emissiveMap.colorSpace)===Vi,premultipliedAlpha:F.premultipliedAlpha,doubleSided:F.side===as,flipSided:F.side===hr,useDepthPacking:F.depthPacking>=0,depthPacking:F.depthPacking||0,index0AttributeName:F.index0AttributeName,extensionClipCullDistance:xn&&F.extensions.clipCullDistance===!0&&n.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(xn&&F.extensions.multiDraw===!0||wt)&&n.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:n.has("KHR_parallel_shader_compile"),customProgramCacheKey:F.customProgramCacheKey()};return rr.vertexUv1s=h.has(1),rr.vertexUv2s=h.has(2),rr.vertexUv3s=h.has(3),h.clear(),rr}function E(F){const V=[];if(F.shaderID?V.push(F.shaderID):(V.push(F.customVertexShaderID),V.push(F.customFragmentShaderID)),F.defines!==void 0)for(const X in F.defines)V.push(X),V.push(F.defines[X]);return F.isRawShaderMaterial===!1&&(B(V,F),L(V,F),V.push(i.outputColorSpace)),V.push(F.customProgramCacheKey),V.join()}function B(F,V){F.push(V.precision),F.push(V.outputColorSpace),F.push(V.envMapMode),F.push(V.envMapCubeUVHeight),F.push(V.mapUv),F.push(V.alphaMapUv),F.push(V.lightMapUv),F.push(V.aoMapUv),F.push(V.bumpMapUv),F.push(V.normalMapUv),F.push(V.displacementMapUv),F.push(V.emissiveMapUv),F.push(V.metalnessMapUv),F.push(V.roughnessMapUv),F.push(V.anisotropyMapUv),F.push(V.clearcoatMapUv),F.push(V.clearcoatNormalMapUv),F.push(V.clearcoatRoughnessMapUv),F.push(V.iridescenceMapUv),F.push(V.iridescenceThicknessMapUv),F.push(V.sheenColorMapUv),F.push(V.sheenRoughnessMapUv),F.push(V.specularMapUv),F.push(V.specularColorMapUv),F.push(V.specularIntensityMapUv),F.push(V.transmissionMapUv),F.push(V.thicknessMapUv),F.push(V.combine),F.push(V.fogExp2),F.push(V.sizeAttenuation),F.push(V.morphTargetsCount),F.push(V.morphAttributeCount),F.push(V.numDirLights),F.push(V.numPointLights),F.push(V.numSpotLights),F.push(V.numSpotLightMaps),F.push(V.numHemiLights),F.push(V.numRectAreaLights),F.push(V.numDirLightShadows),F.push(V.numPointLightShadows),F.push(V.numSpotLightShadows),F.push(V.numSpotLightShadowsWithMaps),F.push(V.numLightProbes),F.push(V.shadowMapType),F.push(V.toneMapping),F.push(V.numClippingPlanes),F.push(V.numClipIntersection),F.push(V.depthPacking)}function L(F,V){l.disableAll(),V.supportsVertexTextures&&l.enable(0),V.instancing&&l.enable(1),V.instancingColor&&l.enable(2),V.instancingMorph&&l.enable(3),V.matcap&&l.enable(4),V.envMap&&l.enable(5),V.normalMapObjectSpace&&l.enable(6),V.normalMapTangentSpace&&l.enable(7),V.clearcoat&&l.enable(8),V.iridescence&&l.enable(9),V.alphaTest&&l.enable(10),V.vertexColors&&l.enable(11),V.vertexAlphas&&l.enable(12),V.vertexUv1s&&l.enable(13),V.vertexUv2s&&l.enable(14),V.vertexUv3s&&l.enable(15),V.vertexTangents&&l.enable(16),V.anisotropy&&l.enable(17),V.alphaHash&&l.enable(18),V.batching&&l.enable(19),V.dispersion&&l.enable(20),V.batchingColor&&l.enable(21),F.push(l.mask),l.disableAll(),V.fog&&l.enable(0),V.useFog&&l.enable(1),V.flatShading&&l.enable(2),V.logarithmicDepthBuffer&&l.enable(3),V.reverseDepthBuffer&&l.enable(4),V.skinning&&l.enable(5),V.morphTargets&&l.enable(6),V.morphNormals&&l.enable(7),V.morphColors&&l.enable(8),V.premultipliedAlpha&&l.enable(9),V.shadowMapEnabled&&l.enable(10),V.doubleSided&&l.enable(11),V.flipSided&&l.enable(12),V.useDepthPacking&&l.enable(13),V.dithering&&l.enable(14),V.transmission&&l.enable(15),V.sheen&&l.enable(16),V.opaque&&l.enable(17),V.pointsUvs&&l.enable(18),V.decodeVideoTexture&&l.enable(19),V.decodeVideoTextureEmissive&&l.enable(20),V.alphaToCoverage&&l.enable(21),F.push(l.mask)}function O(F){const V=w[F.type];let X;if(V){const J=Ga[V];X=vy.clone(J.uniforms)}else X=F.uniforms;return X}function z(F,V){let X;for(let J=0,te=g.length;J0?n.push(E):S.transparent===!0?r.push(E):t.push(E)}function u(v,x,S,w,R,C){const E=a(v,x,S,w,R,C);S.transmission>0?n.unshift(E):S.transparent===!0?r.unshift(E):t.unshift(E)}function h(v,x){t.length>1&&t.sort(v||cj),n.length>1&&n.sort(x||ZC),r.length>1&&r.sort(x||ZC)}function g(){for(let v=e,x=i.length;v=s.length?(a=new JC,s.push(a)):a=s[r],a}function t(){i=new WeakMap}return{get:e,dispose:t}}function fj(){const i={};return{get:function(e){if(i[e.id]!==void 0)return i[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new ce,color:new sn};break;case"SpotLight":t={position:new ce,direction:new ce,color:new sn,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new ce,color:new sn,distance:0,decay:0};break;case"HemisphereLight":t={direction:new ce,skyColor:new sn,groundColor:new sn};break;case"RectAreaLight":t={color:new sn,position:new ce,halfWidth:new ce,halfHeight:new ce};break}return i[e.id]=t,t}}}function Aj(){const i={};return{get:function(e){if(i[e.id]!==void 0)return i[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new dt};break;case"SpotLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new dt};break;case"PointLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new dt,shadowCameraNear:1,shadowCameraFar:1e3};break}return i[e.id]=t,t}}}let dj=0;function pj(i,e){return(e.castShadow?2:0)-(i.castShadow?2:0)+(e.map?1:0)-(i.map?1:0)}function mj(i){const e=new fj,t=Aj(),n={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let h=0;h<9;h++)n.probe.push(new ce);const r=new ce,s=new kn,a=new kn;function l(h){let g=0,v=0,x=0;for(let F=0;F<9;F++)n.probe[F].set(0,0,0);let S=0,w=0,R=0,C=0,E=0,B=0,L=0,O=0,z=0,G=0,k=0;h.sort(pj);for(let F=0,V=h.length;F0&&(i.has("OES_texture_float_linear")===!0?(n.rectAreaLTC1=Yt.LTC_FLOAT_1,n.rectAreaLTC2=Yt.LTC_FLOAT_2):(n.rectAreaLTC1=Yt.LTC_HALF_1,n.rectAreaLTC2=Yt.LTC_HALF_2)),n.ambient[0]=g,n.ambient[1]=v,n.ambient[2]=x;const H=n.hash;(H.directionalLength!==S||H.pointLength!==w||H.spotLength!==R||H.rectAreaLength!==C||H.hemiLength!==E||H.numDirectionalShadows!==B||H.numPointShadows!==L||H.numSpotShadows!==O||H.numSpotMaps!==z||H.numLightProbes!==k)&&(n.directional.length=S,n.spot.length=R,n.rectArea.length=C,n.point.length=w,n.hemi.length=E,n.directionalShadow.length=B,n.directionalShadowMap.length=B,n.pointShadow.length=L,n.pointShadowMap.length=L,n.spotShadow.length=O,n.spotShadowMap.length=O,n.directionalShadowMatrix.length=B,n.pointShadowMatrix.length=L,n.spotLightMatrix.length=O+z-G,n.spotLightMap.length=z,n.numSpotLightShadowsWithMaps=G,n.numLightProbes=k,H.directionalLength=S,H.pointLength=w,H.spotLength=R,H.rectAreaLength=C,H.hemiLength=E,H.numDirectionalShadows=B,H.numPointShadows=L,H.numSpotShadows=O,H.numSpotMaps=z,H.numLightProbes=k,n.version=dj++)}function u(h,g){let v=0,x=0,S=0,w=0,R=0;const C=g.matrixWorldInverse;for(let E=0,B=h.length;E=a.length?(l=new e6(i),a.push(l)):l=a[s],l}function n(){e=new WeakMap}return{get:t,dispose:n}}const vj=`void main() { gl_Position = vec4( position, 1.0 ); }`,_j=`uniform sampler2D shadow_pass; uniform vec2 resolution; @@ -3848,7 +3848,7 @@ void main() { squared_mean = squared_mean / samples; float std_dev = sqrt( squared_mean - mean * mean ); gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) ); -}`;function yj(i,e,t){let n=new Fg;const r=new At,s=new At,a=new Pn,l=new Dz({depthPacking:WF}),u=new Pz,h={},g=t.maxTextureSize,v={[Nl]:hr,[hr]:Nl,[as]:as},x=new Ja({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new At},radius:{value:4}},vertexShader:vj,fragmentShader:_j}),S=x.clone();S.defines.HORIZONTAL_PASS=1;const w=new Ki;w.setAttribute("position",new wr(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const R=new zi(w,x),C=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=_w;let E=this.type;this.render=function(G,k,H){if(C.enabled===!1||C.autoUpdate===!1&&C.needsUpdate===!1||G.length===0)return;const F=i.getRenderTarget(),V=i.getActiveCubeFace(),X=i.getActiveMipmapLevel(),J=i.state;J.setBlending(Qa),J.buffers.color.setClear(1,1,1,1),J.buffers.depth.setTest(!0),J.setScissorTest(!1);const te=E!==xo&&this.type===xo,se=E===xo&&this.type!==xo;for(let ne=0,Z=G.length;neg||r.y>g)&&(r.x>g&&(s.x=Math.floor(g/be.x),r.x=s.x*be.x,he.mapSize.x=s.x),r.y>g&&(s.y=Math.floor(g/be.y),r.y=s.y*be.y,he.mapSize.y=s.y)),he.map===null||te===!0||se===!0){const le=this.type!==xo?{minFilter:mr,magFilter:mr}:{};he.map!==null&&he.map.dispose(),he.map=new qh(r.x,r.y,le),he.map.texture.name=ue.name+".shadowMap",he.camera.updateProjectionMatrix()}i.setRenderTarget(he.map),i.clear();const Se=he.getViewportCount();for(let le=0;le0||k.map&&k.alphaTest>0){const J=V.uuid,te=k.uuid;let se=h[J];se===void 0&&(se={},h[J]=se);let ne=se[te];ne===void 0&&(ne=V.clone(),se[te]=ne,k.addEventListener("dispose",z)),V=ne}if(V.visible=k.visible,V.wireframe=k.wireframe,F===xo?V.side=k.shadowSide!==null?k.shadowSide:k.side:V.side=k.shadowSide!==null?k.shadowSide:v[k.side],V.alphaMap=k.alphaMap,V.alphaTest=k.alphaTest,V.map=k.map,V.clipShadows=k.clipShadows,V.clippingPlanes=k.clippingPlanes,V.clipIntersection=k.clipIntersection,V.displacementMap=k.displacementMap,V.displacementScale=k.displacementScale,V.displacementBias=k.displacementBias,V.wireframeLinewidth=k.wireframeLinewidth,V.linewidth=k.linewidth,H.isPointLight===!0&&V.isMeshDistanceMaterial===!0){const J=i.properties.get(V);J.light=H}return V}function O(G,k,H,F,V){if(G.visible===!1)return;if(G.layers.test(k.layers)&&(G.isMesh||G.isLine||G.isPoints)&&(G.castShadow||G.receiveShadow&&V===xo)&&(!G.frustumCulled||n.intersectsObject(G))){G.modelViewMatrix.multiplyMatrices(H.matrixWorldInverse,G.matrixWorld);const te=e.update(G),se=G.material;if(Array.isArray(se)){const ne=te.groups;for(let Z=0,ue=ne.length;Z=1):he.indexOf("OpenGL ES")!==-1&&(ue=parseFloat(/^OpenGL ES (\d)/.exec(he)[1]),Z=ue>=2);let be=null,Se={};const le=i.getParameter(i.SCISSOR_BOX),we=i.getParameter(i.VIEWPORT),We=new Pn().fromArray(le),Te=new Pn().fromArray(we);function ze(me,jt,rt,_t){const $t=new Uint8Array(4),kt=i.createTexture();i.bindTexture(me,kt),i.texParameteri(me,i.TEXTURE_MIN_FILTER,i.NEAREST),i.texParameteri(me,i.TEXTURE_MAG_FILTER,i.NEAREST);for(let xn=0;xn"u"?!1:/OculusBrowser/g.test(navigator.userAgent),h=new At,g=new WeakMap;let v;const x=new WeakMap;let S=!1;try{S=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function w(fe,Y){return S?new OffscreenCanvas(fe,Y):sg("canvas")}function R(fe,Y,Ce){let $e=1;const it=bt(fe);if((it.width>Ce||it.height>Ce)&&($e=Ce/Math.max(it.width,it.height)),$e<1)if(typeof HTMLImageElement<"u"&&fe instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&fe instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&fe instanceof ImageBitmap||typeof VideoFrame<"u"&&fe instanceof VideoFrame){const tt=Math.floor($e*it.width),Vt=Math.floor($e*it.height);v===void 0&&(v=w(tt,Vt));const Bt=Y?w(tt,Vt):v;return Bt.width=tt,Bt.height=Vt,Bt.getContext("2d").drawImage(fe,0,0,tt,Vt),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+it.width+"x"+it.height+") to ("+tt+"x"+Vt+")."),Bt}else return"data"in fe&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+it.width+"x"+it.height+")."),fe;return fe}function C(fe){return fe.generateMipmaps}function E(fe){i.generateMipmap(fe)}function B(fe){return fe.isWebGLCubeRenderTarget?i.TEXTURE_CUBE_MAP:fe.isWebGL3DRenderTarget?i.TEXTURE_3D:fe.isWebGLArrayRenderTarget||fe.isCompressedArrayTexture?i.TEXTURE_2D_ARRAY:i.TEXTURE_2D}function L(fe,Y,Ce,$e,it=!1){if(fe!==null){if(i[fe]!==void 0)return i[fe];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+fe+"'")}let tt=Y;if(Y===i.RED&&(Ce===i.FLOAT&&(tt=i.R32F),Ce===i.HALF_FLOAT&&(tt=i.R16F),Ce===i.UNSIGNED_BYTE&&(tt=i.R8)),Y===i.RED_INTEGER&&(Ce===i.UNSIGNED_BYTE&&(tt=i.R8UI),Ce===i.UNSIGNED_SHORT&&(tt=i.R16UI),Ce===i.UNSIGNED_INT&&(tt=i.R32UI),Ce===i.BYTE&&(tt=i.R8I),Ce===i.SHORT&&(tt=i.R16I),Ce===i.INT&&(tt=i.R32I)),Y===i.RG&&(Ce===i.FLOAT&&(tt=i.RG32F),Ce===i.HALF_FLOAT&&(tt=i.RG16F),Ce===i.UNSIGNED_BYTE&&(tt=i.RG8)),Y===i.RG_INTEGER&&(Ce===i.UNSIGNED_BYTE&&(tt=i.RG8UI),Ce===i.UNSIGNED_SHORT&&(tt=i.RG16UI),Ce===i.UNSIGNED_INT&&(tt=i.RG32UI),Ce===i.BYTE&&(tt=i.RG8I),Ce===i.SHORT&&(tt=i.RG16I),Ce===i.INT&&(tt=i.RG32I)),Y===i.RGB_INTEGER&&(Ce===i.UNSIGNED_BYTE&&(tt=i.RGB8UI),Ce===i.UNSIGNED_SHORT&&(tt=i.RGB16UI),Ce===i.UNSIGNED_INT&&(tt=i.RGB32UI),Ce===i.BYTE&&(tt=i.RGB8I),Ce===i.SHORT&&(tt=i.RGB16I),Ce===i.INT&&(tt=i.RGB32I)),Y===i.RGBA_INTEGER&&(Ce===i.UNSIGNED_BYTE&&(tt=i.RGBA8UI),Ce===i.UNSIGNED_SHORT&&(tt=i.RGBA16UI),Ce===i.UNSIGNED_INT&&(tt=i.RGBA32UI),Ce===i.BYTE&&(tt=i.RGBA8I),Ce===i.SHORT&&(tt=i.RGBA16I),Ce===i.INT&&(tt=i.RGBA32I)),Y===i.RGB&&Ce===i.UNSIGNED_INT_5_9_9_9_REV&&(tt=i.RGB9_E5),Y===i.RGBA){const Vt=it?a_:ai.getTransfer($e);Ce===i.FLOAT&&(tt=i.RGBA32F),Ce===i.HALF_FLOAT&&(tt=i.RGBA16F),Ce===i.UNSIGNED_BYTE&&(tt=Vt===Vi?i.SRGB8_ALPHA8:i.RGBA8),Ce===i.UNSIGNED_SHORT_4_4_4_4&&(tt=i.RGBA4),Ce===i.UNSIGNED_SHORT_5_5_5_1&&(tt=i.RGB5_A1)}return(tt===i.R16F||tt===i.R32F||tt===i.RG16F||tt===i.RG32F||tt===i.RGBA16F||tt===i.RGBA32F)&&e.get("EXT_color_buffer_float"),tt}function O(fe,Y){let Ce;return fe?Y===null||Y===Rr||Y===Au?Ce=i.DEPTH24_STENCIL8:Y===$r?Ce=i.DEPTH32F_STENCIL8:Y===wl&&(Ce=i.DEPTH24_STENCIL8,console.warn("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):Y===null||Y===Rr||Y===Au?Ce=i.DEPTH_COMPONENT24:Y===$r?Ce=i.DEPTH_COMPONENT32F:Y===wl&&(Ce=i.DEPTH_COMPONENT16),Ce}function z(fe,Y){return C(fe)===!0||fe.isFramebufferTexture&&fe.minFilter!==mr&&fe.minFilter!==gs?Math.log2(Math.max(Y.width,Y.height))+1:fe.mipmaps!==void 0&&fe.mipmaps.length>0?fe.mipmaps.length:fe.isCompressedTexture&&Array.isArray(fe.image)?Y.mipmaps.length:1}function G(fe){const Y=fe.target;Y.removeEventListener("dispose",G),H(Y),Y.isVideoTexture&&g.delete(Y)}function k(fe){const Y=fe.target;Y.removeEventListener("dispose",k),V(Y)}function H(fe){const Y=n.get(fe);if(Y.__webglInit===void 0)return;const Ce=fe.source,$e=x.get(Ce);if($e){const it=$e[Y.__cacheKey];it.usedTimes--,it.usedTimes===0&&F(fe),Object.keys($e).length===0&&x.delete(Ce)}n.remove(fe)}function F(fe){const Y=n.get(fe);i.deleteTexture(Y.__webglTexture);const Ce=fe.source,$e=x.get(Ce);delete $e[Y.__cacheKey],a.memory.textures--}function V(fe){const Y=n.get(fe);if(fe.depthTexture&&(fe.depthTexture.dispose(),n.remove(fe.depthTexture)),fe.isWebGLCubeRenderTarget)for(let $e=0;$e<6;$e++){if(Array.isArray(Y.__webglFramebuffer[$e]))for(let it=0;it=r.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+fe+" texture units while this GPU supports only "+r.maxTextures),X+=1,fe}function se(fe){const Y=[];return Y.push(fe.wrapS),Y.push(fe.wrapT),Y.push(fe.wrapR||0),Y.push(fe.magFilter),Y.push(fe.minFilter),Y.push(fe.anisotropy),Y.push(fe.internalFormat),Y.push(fe.format),Y.push(fe.type),Y.push(fe.generateMipmaps),Y.push(fe.premultiplyAlpha),Y.push(fe.flipY),Y.push(fe.unpackAlignment),Y.push(fe.colorSpace),Y.join()}function ne(fe,Y){const Ce=n.get(fe);if(fe.isVideoTexture&&wt(fe),fe.isRenderTargetTexture===!1&&fe.version>0&&Ce.__version!==fe.version){const $e=fe.image;if($e===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if($e.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{Te(Ce,fe,Y);return}}t.bindTexture(i.TEXTURE_2D,Ce.__webglTexture,i.TEXTURE0+Y)}function Z(fe,Y){const Ce=n.get(fe);if(fe.version>0&&Ce.__version!==fe.version){Te(Ce,fe,Y);return}t.bindTexture(i.TEXTURE_2D_ARRAY,Ce.__webglTexture,i.TEXTURE0+Y)}function ue(fe,Y){const Ce=n.get(fe);if(fe.version>0&&Ce.__version!==fe.version){Te(Ce,fe,Y);return}t.bindTexture(i.TEXTURE_3D,Ce.__webglTexture,i.TEXTURE0+Y)}function he(fe,Y){const Ce=n.get(fe);if(fe.version>0&&Ce.__version!==fe.version){ze(Ce,fe,Y);return}t.bindTexture(i.TEXTURE_CUBE_MAP,Ce.__webglTexture,i.TEXTURE0+Y)}const be={[aA]:i.REPEAT,[eu]:i.CLAMP_TO_EDGE,[oA]:i.MIRRORED_REPEAT},Se={[mr]:i.NEAREST,[s_]:i.NEAREST_MIPMAP_NEAREST,[tu]:i.NEAREST_MIPMAP_LINEAR,[gs]:i.LINEAR,[Jd]:i.LINEAR_MIPMAP_NEAREST,[Va]:i.LINEAR_MIPMAP_LINEAR},le={[Iw]:i.NEVER,[qw]:i.ALWAYS,[my]:i.LESS,[gy]:i.LEQUAL,[Fw]:i.EQUAL,[Gw]:i.GEQUAL,[kw]:i.GREATER,[zw]:i.NOTEQUAL};function we(fe,Y){if(Y.type===$r&&e.has("OES_texture_float_linear")===!1&&(Y.magFilter===gs||Y.magFilter===Jd||Y.magFilter===tu||Y.magFilter===Va||Y.minFilter===gs||Y.minFilter===Jd||Y.minFilter===tu||Y.minFilter===Va)&&console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),i.texParameteri(fe,i.TEXTURE_WRAP_S,be[Y.wrapS]),i.texParameteri(fe,i.TEXTURE_WRAP_T,be[Y.wrapT]),(fe===i.TEXTURE_3D||fe===i.TEXTURE_2D_ARRAY)&&i.texParameteri(fe,i.TEXTURE_WRAP_R,be[Y.wrapR]),i.texParameteri(fe,i.TEXTURE_MAG_FILTER,Se[Y.magFilter]),i.texParameteri(fe,i.TEXTURE_MIN_FILTER,Se[Y.minFilter]),Y.compareFunction&&(i.texParameteri(fe,i.TEXTURE_COMPARE_MODE,i.COMPARE_REF_TO_TEXTURE),i.texParameteri(fe,i.TEXTURE_COMPARE_FUNC,le[Y.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(Y.magFilter===mr||Y.minFilter!==tu&&Y.minFilter!==Va||Y.type===$r&&e.has("OES_texture_float_linear")===!1)return;if(Y.anisotropy>1||n.get(Y).__currentAnisotropy){const Ce=e.get("EXT_texture_filter_anisotropic");i.texParameterf(fe,Ce.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(Y.anisotropy,r.getMaxAnisotropy())),n.get(Y).__currentAnisotropy=Y.anisotropy}}}function We(fe,Y){let Ce=!1;fe.__webglInit===void 0&&(fe.__webglInit=!0,Y.addEventListener("dispose",G));const $e=Y.source;let it=x.get($e);it===void 0&&(it={},x.set($e,it));const tt=se(Y);if(tt!==fe.__cacheKey){it[tt]===void 0&&(it[tt]={texture:i.createTexture(),usedTimes:0},a.memory.textures++,Ce=!0),it[tt].usedTimes++;const Vt=it[fe.__cacheKey];Vt!==void 0&&(it[fe.__cacheKey].usedTimes--,Vt.usedTimes===0&&F(Y)),fe.__cacheKey=tt,fe.__webglTexture=it[tt].texture}return Ce}function Te(fe,Y,Ce){let $e=i.TEXTURE_2D;(Y.isDataArrayTexture||Y.isCompressedArrayTexture)&&($e=i.TEXTURE_2D_ARRAY),Y.isData3DTexture&&($e=i.TEXTURE_3D);const it=We(fe,Y),tt=Y.source;t.bindTexture($e,fe.__webglTexture,i.TEXTURE0+Ce);const Vt=n.get(tt);if(tt.version!==Vt.__version||it===!0){t.activeTexture(i.TEXTURE0+Ce);const Bt=ai.getPrimaries(ai.workingColorSpace),Wt=Y.colorSpace===Co?null:ai.getPrimaries(Y.colorSpace),ln=Y.colorSpace===Co||Bt===Wt?i.NONE:i.BROWSER_DEFAULT_WEBGL;i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,Y.flipY),i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,Y.premultiplyAlpha),i.pixelStorei(i.UNPACK_ALIGNMENT,Y.unpackAlignment),i.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL,ln);let St=R(Y.image,!1,r.maxTextureSize);St=tn(Y,St);const Kt=s.convert(Y.format,Y.colorSpace),rn=s.convert(Y.type);let Ht=L(Y.internalFormat,Kt,rn,Y.colorSpace,Y.isVideoTexture);we($e,Y);let Ft;const Gt=Y.mipmaps,In=Y.isVideoTexture!==!0,Mi=Vt.__version===void 0||it===!0,me=tt.dataReady,jt=z(Y,St);if(Y.isDepthTexture)Ht=O(Y.format===du,Y.type),Mi&&(In?t.texStorage2D(i.TEXTURE_2D,1,Ht,St.width,St.height):t.texImage2D(i.TEXTURE_2D,0,Ht,St.width,St.height,0,Kt,rn,null));else if(Y.isDataTexture)if(Gt.length>0){In&&Mi&&t.texStorage2D(i.TEXTURE_2D,jt,Ht,Gt[0].width,Gt[0].height);for(let rt=0,_t=Gt.length;rt<_t;rt++)Ft=Gt[rt],In?me&&t.texSubImage2D(i.TEXTURE_2D,rt,0,0,Ft.width,Ft.height,Kt,rn,Ft.data):t.texImage2D(i.TEXTURE_2D,rt,Ht,Ft.width,Ft.height,0,Kt,rn,Ft.data);Y.generateMipmaps=!1}else In?(Mi&&t.texStorage2D(i.TEXTURE_2D,jt,Ht,St.width,St.height),me&&t.texSubImage2D(i.TEXTURE_2D,0,0,0,St.width,St.height,Kt,rn,St.data)):t.texImage2D(i.TEXTURE_2D,0,Ht,St.width,St.height,0,Kt,rn,St.data);else if(Y.isCompressedTexture)if(Y.isCompressedArrayTexture){In&&Mi&&t.texStorage3D(i.TEXTURE_2D_ARRAY,jt,Ht,Gt[0].width,Gt[0].height,St.depth);for(let rt=0,_t=Gt.length;rt<_t;rt++)if(Ft=Gt[rt],Y.format!==ks)if(Kt!==null)if(In){if(me)if(Y.layerUpdates.size>0){const $t=NC(Ft.width,Ft.height,Y.format,Y.type);for(const kt of Y.layerUpdates){const xn=Ft.data.subarray(kt*$t/Ft.data.BYTES_PER_ELEMENT,(kt+1)*$t/Ft.data.BYTES_PER_ELEMENT);t.compressedTexSubImage3D(i.TEXTURE_2D_ARRAY,rt,0,0,kt,Ft.width,Ft.height,1,Kt,xn)}Y.clearLayerUpdates()}else t.compressedTexSubImage3D(i.TEXTURE_2D_ARRAY,rt,0,0,0,Ft.width,Ft.height,St.depth,Kt,Ft.data)}else t.compressedTexImage3D(i.TEXTURE_2D_ARRAY,rt,Ht,Ft.width,Ft.height,St.depth,0,Ft.data,0,0);else console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else In?me&&t.texSubImage3D(i.TEXTURE_2D_ARRAY,rt,0,0,0,Ft.width,Ft.height,St.depth,Kt,rn,Ft.data):t.texImage3D(i.TEXTURE_2D_ARRAY,rt,Ht,Ft.width,Ft.height,St.depth,0,Kt,rn,Ft.data)}else{In&&Mi&&t.texStorage2D(i.TEXTURE_2D,jt,Ht,Gt[0].width,Gt[0].height);for(let rt=0,_t=Gt.length;rt<_t;rt++)Ft=Gt[rt],Y.format!==ks?Kt!==null?In?me&&t.compressedTexSubImage2D(i.TEXTURE_2D,rt,0,0,Ft.width,Ft.height,Kt,Ft.data):t.compressedTexImage2D(i.TEXTURE_2D,rt,Ht,Ft.width,Ft.height,0,Ft.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):In?me&&t.texSubImage2D(i.TEXTURE_2D,rt,0,0,Ft.width,Ft.height,Kt,rn,Ft.data):t.texImage2D(i.TEXTURE_2D,rt,Ht,Ft.width,Ft.height,0,Kt,rn,Ft.data)}else if(Y.isDataArrayTexture)if(In){if(Mi&&t.texStorage3D(i.TEXTURE_2D_ARRAY,jt,Ht,St.width,St.height,St.depth),me)if(Y.layerUpdates.size>0){const rt=NC(St.width,St.height,Y.format,Y.type);for(const _t of Y.layerUpdates){const $t=St.data.subarray(_t*rt/St.data.BYTES_PER_ELEMENT,(_t+1)*rt/St.data.BYTES_PER_ELEMENT);t.texSubImage3D(i.TEXTURE_2D_ARRAY,0,0,0,_t,St.width,St.height,1,Kt,rn,$t)}Y.clearLayerUpdates()}else t.texSubImage3D(i.TEXTURE_2D_ARRAY,0,0,0,0,St.width,St.height,St.depth,Kt,rn,St.data)}else t.texImage3D(i.TEXTURE_2D_ARRAY,0,Ht,St.width,St.height,St.depth,0,Kt,rn,St.data);else if(Y.isData3DTexture)In?(Mi&&t.texStorage3D(i.TEXTURE_3D,jt,Ht,St.width,St.height,St.depth),me&&t.texSubImage3D(i.TEXTURE_3D,0,0,0,0,St.width,St.height,St.depth,Kt,rn,St.data)):t.texImage3D(i.TEXTURE_3D,0,Ht,St.width,St.height,St.depth,0,Kt,rn,St.data);else if(Y.isFramebufferTexture){if(Mi)if(In)t.texStorage2D(i.TEXTURE_2D,jt,Ht,St.width,St.height);else{let rt=St.width,_t=St.height;for(let $t=0;$t>=1,_t>>=1}}else if(Gt.length>0){if(In&&Mi){const rt=bt(Gt[0]);t.texStorage2D(i.TEXTURE_2D,jt,Ht,rt.width,rt.height)}for(let rt=0,_t=Gt.length;rt<_t;rt++)Ft=Gt[rt],In?me&&t.texSubImage2D(i.TEXTURE_2D,rt,0,0,Kt,rn,Ft):t.texImage2D(i.TEXTURE_2D,rt,Ht,Kt,rn,Ft);Y.generateMipmaps=!1}else if(In){if(Mi){const rt=bt(St);t.texStorage2D(i.TEXTURE_2D,jt,Ht,rt.width,rt.height)}me&&t.texSubImage2D(i.TEXTURE_2D,0,0,0,Kt,rn,St)}else t.texImage2D(i.TEXTURE_2D,0,Ht,Kt,rn,St);C(Y)&&E($e),Vt.__version=tt.version,Y.onUpdate&&Y.onUpdate(Y)}fe.__version=Y.version}function ze(fe,Y,Ce){if(Y.image.length!==6)return;const $e=We(fe,Y),it=Y.source;t.bindTexture(i.TEXTURE_CUBE_MAP,fe.__webglTexture,i.TEXTURE0+Ce);const tt=n.get(it);if(it.version!==tt.__version||$e===!0){t.activeTexture(i.TEXTURE0+Ce);const Vt=ai.getPrimaries(ai.workingColorSpace),Bt=Y.colorSpace===Co?null:ai.getPrimaries(Y.colorSpace),Wt=Y.colorSpace===Co||Vt===Bt?i.NONE:i.BROWSER_DEFAULT_WEBGL;i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,Y.flipY),i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,Y.premultiplyAlpha),i.pixelStorei(i.UNPACK_ALIGNMENT,Y.unpackAlignment),i.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL,Wt);const ln=Y.isCompressedTexture||Y.image[0].isCompressedTexture,St=Y.image[0]&&Y.image[0].isDataTexture,Kt=[];for(let _t=0;_t<6;_t++)!ln&&!St?Kt[_t]=R(Y.image[_t],!0,r.maxCubemapSize):Kt[_t]=St?Y.image[_t].image:Y.image[_t],Kt[_t]=tn(Y,Kt[_t]);const rn=Kt[0],Ht=s.convert(Y.format,Y.colorSpace),Ft=s.convert(Y.type),Gt=L(Y.internalFormat,Ht,Ft,Y.colorSpace),In=Y.isVideoTexture!==!0,Mi=tt.__version===void 0||$e===!0,me=it.dataReady;let jt=z(Y,rn);we(i.TEXTURE_CUBE_MAP,Y);let rt;if(ln){In&&Mi&&t.texStorage2D(i.TEXTURE_CUBE_MAP,jt,Gt,rn.width,rn.height);for(let _t=0;_t<6;_t++){rt=Kt[_t].mipmaps;for(let $t=0;$t0&&jt++;const _t=bt(Kt[0]);t.texStorage2D(i.TEXTURE_CUBE_MAP,jt,Gt,_t.width,_t.height)}for(let _t=0;_t<6;_t++)if(St){In?me&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+_t,0,0,0,Kt[_t].width,Kt[_t].height,Ht,Ft,Kt[_t].data):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+_t,0,Gt,Kt[_t].width,Kt[_t].height,0,Ht,Ft,Kt[_t].data);for(let $t=0;$t>tt),rn=Math.max(1,Y.height>>tt);it===i.TEXTURE_3D||it===i.TEXTURE_2D_ARRAY?t.texImage3D(it,tt,Wt,Kt,rn,Y.depth,0,Vt,Bt,null):t.texImage2D(it,tt,Wt,Kt,rn,0,Vt,Bt,null)}t.bindFramebuffer(i.FRAMEBUFFER,fe),Dt(Y)?l.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,$e,it,St.__webglTexture,0,lt(Y)):(it===i.TEXTURE_2D||it>=i.TEXTURE_CUBE_MAP_POSITIVE_X&&it<=i.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&i.framebufferTexture2D(i.FRAMEBUFFER,$e,it,St.__webglTexture,tt),t.bindFramebuffer(i.FRAMEBUFFER,null)}function De(fe,Y,Ce){if(i.bindRenderbuffer(i.RENDERBUFFER,fe),Y.depthBuffer){const $e=Y.depthTexture,it=$e&&$e.isDepthTexture?$e.type:null,tt=O(Y.stencilBuffer,it),Vt=Y.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,Bt=lt(Y);Dt(Y)?l.renderbufferStorageMultisampleEXT(i.RENDERBUFFER,Bt,tt,Y.width,Y.height):Ce?i.renderbufferStorageMultisample(i.RENDERBUFFER,Bt,tt,Y.width,Y.height):i.renderbufferStorage(i.RENDERBUFFER,tt,Y.width,Y.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,Vt,i.RENDERBUFFER,fe)}else{const $e=Y.textures;for(let it=0;it<$e.length;it++){const tt=$e[it],Vt=s.convert(tt.format,tt.colorSpace),Bt=s.convert(tt.type),Wt=L(tt.internalFormat,Vt,Bt,tt.colorSpace),ln=lt(Y);Ce&&Dt(Y)===!1?i.renderbufferStorageMultisample(i.RENDERBUFFER,ln,Wt,Y.width,Y.height):Dt(Y)?l.renderbufferStorageMultisampleEXT(i.RENDERBUFFER,ln,Wt,Y.width,Y.height):i.renderbufferStorage(i.RENDERBUFFER,Wt,Y.width,Y.height)}}i.bindRenderbuffer(i.RENDERBUFFER,null)}function dt(fe,Y){if(Y&&Y.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(t.bindFramebuffer(i.FRAMEBUFFER,fe),!(Y.depthTexture&&Y.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");const $e=n.get(Y.depthTexture);$e.__renderTarget=Y,(!$e.__webglTexture||Y.depthTexture.image.width!==Y.width||Y.depthTexture.image.height!==Y.height)&&(Y.depthTexture.image.width=Y.width,Y.depthTexture.image.height=Y.height,Y.depthTexture.needsUpdate=!0),ne(Y.depthTexture,0);const it=$e.__webglTexture,tt=lt(Y);if(Y.depthTexture.format===au)Dt(Y)?l.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,i.DEPTH_ATTACHMENT,i.TEXTURE_2D,it,0,tt):i.framebufferTexture2D(i.FRAMEBUFFER,i.DEPTH_ATTACHMENT,i.TEXTURE_2D,it,0);else if(Y.depthTexture.format===du)Dt(Y)?l.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,i.DEPTH_STENCIL_ATTACHMENT,i.TEXTURE_2D,it,0,tt):i.framebufferTexture2D(i.FRAMEBUFFER,i.DEPTH_STENCIL_ATTACHMENT,i.TEXTURE_2D,it,0);else throw new Error("Unknown depthTexture format")}function vt(fe){const Y=n.get(fe),Ce=fe.isWebGLCubeRenderTarget===!0;if(Y.__boundDepthTexture!==fe.depthTexture){const $e=fe.depthTexture;if(Y.__depthDisposeCallback&&Y.__depthDisposeCallback(),$e){const it=()=>{delete Y.__boundDepthTexture,delete Y.__depthDisposeCallback,$e.removeEventListener("dispose",it)};$e.addEventListener("dispose",it),Y.__depthDisposeCallback=it}Y.__boundDepthTexture=$e}if(fe.depthTexture&&!Y.__autoAllocateDepthBuffer){if(Ce)throw new Error("target.depthTexture not supported in Cube render targets");dt(Y.__webglFramebuffer,fe)}else if(Ce){Y.__webglDepthbuffer=[];for(let $e=0;$e<6;$e++)if(t.bindFramebuffer(i.FRAMEBUFFER,Y.__webglFramebuffer[$e]),Y.__webglDepthbuffer[$e]===void 0)Y.__webglDepthbuffer[$e]=i.createRenderbuffer(),De(Y.__webglDepthbuffer[$e],fe,!1);else{const it=fe.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,tt=Y.__webglDepthbuffer[$e];i.bindRenderbuffer(i.RENDERBUFFER,tt),i.framebufferRenderbuffer(i.FRAMEBUFFER,it,i.RENDERBUFFER,tt)}}else if(t.bindFramebuffer(i.FRAMEBUFFER,Y.__webglFramebuffer),Y.__webglDepthbuffer===void 0)Y.__webglDepthbuffer=i.createRenderbuffer(),De(Y.__webglDepthbuffer,fe,!1);else{const $e=fe.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,it=Y.__webglDepthbuffer;i.bindRenderbuffer(i.RENDERBUFFER,it),i.framebufferRenderbuffer(i.FRAMEBUFFER,$e,i.RENDERBUFFER,it)}t.bindFramebuffer(i.FRAMEBUFFER,null)}function Tt(fe,Y,Ce){const $e=n.get(fe);Y!==void 0&&_e($e.__webglFramebuffer,fe,fe.texture,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,0),Ce!==void 0&&vt(fe)}function Ge(fe){const Y=fe.texture,Ce=n.get(fe),$e=n.get(Y);fe.addEventListener("dispose",k);const it=fe.textures,tt=fe.isWebGLCubeRenderTarget===!0,Vt=it.length>1;if(Vt||($e.__webglTexture===void 0&&($e.__webglTexture=i.createTexture()),$e.__version=Y.version,a.memory.textures++),tt){Ce.__webglFramebuffer=[];for(let Bt=0;Bt<6;Bt++)if(Y.mipmaps&&Y.mipmaps.length>0){Ce.__webglFramebuffer[Bt]=[];for(let Wt=0;Wt0){Ce.__webglFramebuffer=[];for(let Bt=0;Bt0&&Dt(fe)===!1){Ce.__webglMultisampledFramebuffer=i.createFramebuffer(),Ce.__webglColorRenderbuffer=[],t.bindFramebuffer(i.FRAMEBUFFER,Ce.__webglMultisampledFramebuffer);for(let Bt=0;Bt0)for(let Wt=0;Wt0)for(let Wt=0;Wt0){if(Dt(fe)===!1){const Y=fe.textures,Ce=fe.width,$e=fe.height;let it=i.COLOR_BUFFER_BIT;const tt=fe.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,Vt=n.get(fe),Bt=Y.length>1;if(Bt)for(let Wt=0;Wt0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&Y.__useRenderToTexture!==!1}function wt(fe){const Y=a.render.frame;g.get(fe)!==Y&&(g.set(fe,Y),fe.update())}function tn(fe,Y){const Ce=fe.colorSpace,$e=fe.format,it=fe.type;return fe.isCompressedTexture===!0||fe.isVideoTexture===!0||Ce!==Ro&&Ce!==Co&&(ai.getTransfer(Ce)===Vi?($e!==ks||it!==aa)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",Ce)),Y}function bt(fe){return typeof HTMLImageElement<"u"&&fe instanceof HTMLImageElement?(h.width=fe.naturalWidth||fe.width,h.height=fe.naturalHeight||fe.height):typeof VideoFrame<"u"&&fe instanceof VideoFrame?(h.width=fe.displayWidth,h.height=fe.displayHeight):(h.width=fe.width,h.height=fe.height),h}this.allocateTextureUnit=te,this.resetTextureUnits=J,this.setTexture2D=ne,this.setTexture2DArray=Z,this.setTexture3D=ue,this.setTextureCube=he,this.rebindTextures=Tt,this.setupRenderTarget=Ge,this.updateRenderTargetMipmap=Be,this.updateMultisampleRenderTarget=Mt,this.setupDepthRenderbuffer=vt,this.setupFrameBufferTexture=_e,this.useMultisampledRTT=Dt}function Tj(i,e){function t(n,r=Co){let s;const a=ai.getTransfer(r);if(n===aa)return i.UNSIGNED_BYTE;if(n===Ay)return i.UNSIGNED_SHORT_4_4_4_4;if(n===dy)return i.UNSIGNED_SHORT_5_5_5_1;if(n===py)return i.UNSIGNED_INT_5_9_9_9_REV;if(n===Qf)return i.BYTE;if(n===Kf)return i.SHORT;if(n===wl)return i.UNSIGNED_SHORT;if(n===Ns)return i.INT;if(n===Rr)return i.UNSIGNED_INT;if(n===$r)return i.FLOAT;if(n===Gs)return i.HALF_FLOAT;if(n===Lw)return i.ALPHA;if(n===Ug)return i.RGB;if(n===ks)return i.RGBA;if(n===Uw)return i.LUMINANCE;if(n===Bw)return i.LUMINANCE_ALPHA;if(n===au)return i.DEPTH_COMPONENT;if(n===du)return i.DEPTH_STENCIL;if(n===Bg)return i.RED;if(n===H0)return i.RED_INTEGER;if(n===lA)return i.RG;if(n===j0)return i.RG_INTEGER;if(n===W0)return i.RGBA_INTEGER;if(n===Zf||n===Bh||n===Oh||n===Ih)if(a===Vi)if(s=e.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(n===Zf)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===Bh)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===Oh)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===Ih)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=e.get("WEBGL_compressed_texture_s3tc"),s!==null){if(n===Zf)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===Bh)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===Oh)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===Ih)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(n===Km||n===Zm||n===Jm||n===eg)if(s=e.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(n===Km)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===Zm)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===Jm)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===eg)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(n===tg||n===u0||n===c0)if(s=e.get("WEBGL_compressed_texture_etc"),s!==null){if(n===tg||n===u0)return a===Vi?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(n===c0)return a===Vi?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(n===h0||n===f0||n===A0||n===d0||n===p0||n===m0||n===g0||n===v0||n===_0||n===y0||n===x0||n===b0||n===S0||n===T0)if(s=e.get("WEBGL_compressed_texture_astc"),s!==null){if(n===h0)return a===Vi?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===f0)return a===Vi?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===A0)return a===Vi?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===d0)return a===Vi?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===p0)return a===Vi?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===m0)return a===Vi?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===g0)return a===Vi?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===v0)return a===Vi?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===_0)return a===Vi?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===y0)return a===Vi?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===x0)return a===Vi?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===b0)return a===Vi?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===S0)return a===Vi?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===T0)return a===Vi?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(n===Jf||n===VS||n===HS)if(s=e.get("EXT_texture_compression_bptc"),s!==null){if(n===Jf)return a===Vi?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(n===VS)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===HS)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(n===Ow||n===ng||n===ig||n===rg)if(s=e.get("EXT_texture_compression_rgtc"),s!==null){if(n===Jf)return s.COMPRESSED_RED_RGTC1_EXT;if(n===ng)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===ig)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===rg)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return n===Au?i.UNSIGNED_INT_24_8:i[n]!==void 0?i[n]:null}return{convert:t}}const wj={type:"move"};class D3{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new ja,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new ja,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new ce,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new ce),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new ja,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new ce,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new ce),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){const t=this._hand;if(t)for(const n of e.hand.values())this._getHandJoint(t,n)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,n){let r=null,s=null,a=null;const l=this._targetRay,u=this._grip,h=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(h&&e.hand){a=!0;for(const R of e.hand.values()){const C=t.getJointPose(R,n),E=this._getHandJoint(h,R);C!==null&&(E.matrix.fromArray(C.transform.matrix),E.matrix.decompose(E.position,E.rotation,E.scale),E.matrixWorldNeedsUpdate=!0,E.jointRadius=C.radius),E.visible=C!==null}const g=h.joints["index-finger-tip"],v=h.joints["thumb-tip"],x=g.position.distanceTo(v.position),S=.02,w=.005;h.inputState.pinching&&x>S+w?(h.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!h.inputState.pinching&&x<=S-w&&(h.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else u!==null&&e.gripSpace&&(s=t.getPose(e.gripSpace,n),s!==null&&(u.matrix.fromArray(s.transform.matrix),u.matrix.decompose(u.position,u.rotation,u.scale),u.matrixWorldNeedsUpdate=!0,s.linearVelocity?(u.hasLinearVelocity=!0,u.linearVelocity.copy(s.linearVelocity)):u.hasLinearVelocity=!1,s.angularVelocity?(u.hasAngularVelocity=!0,u.angularVelocity.copy(s.angularVelocity)):u.hasAngularVelocity=!1));l!==null&&(r=t.getPose(e.targetRaySpace,n),r===null&&s!==null&&(r=s),r!==null&&(l.matrix.fromArray(r.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),l.matrixWorldNeedsUpdate=!0,r.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(r.linearVelocity)):l.hasLinearVelocity=!1,r.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(r.angularVelocity)):l.hasAngularVelocity=!1,this.dispatchEvent(wj)))}return l!==null&&(l.visible=r!==null),u!==null&&(u.visible=s!==null),h!==null&&(h.visible=a!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const n=new ja;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}}const Mj=` +}`;function yj(i,e,t){let n=new Fg;const r=new dt,s=new dt,a=new Pn,l=new Dz({depthPacking:WF}),u=new Pz,h={},g=t.maxTextureSize,v={[Nl]:hr,[hr]:Nl,[as]:as},x=new Ja({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new dt},radius:{value:4}},vertexShader:vj,fragmentShader:_j}),S=x.clone();S.defines.HORIZONTAL_PASS=1;const w=new Ki;w.setAttribute("position",new wr(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const R=new zi(w,x),C=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=_w;let E=this.type;this.render=function(G,k,H){if(C.enabled===!1||C.autoUpdate===!1&&C.needsUpdate===!1||G.length===0)return;const F=i.getRenderTarget(),V=i.getActiveCubeFace(),X=i.getActiveMipmapLevel(),J=i.state;J.setBlending(Qa),J.buffers.color.setClear(1,1,1,1),J.buffers.depth.setTest(!0),J.setScissorTest(!1);const te=E!==xo&&this.type===xo,se=E===xo&&this.type!==xo;for(let ne=0,Z=G.length;neg||r.y>g)&&(r.x>g&&(s.x=Math.floor(g/be.x),r.x=s.x*be.x,he.mapSize.x=s.x),r.y>g&&(s.y=Math.floor(g/be.y),r.y=s.y*be.y,he.mapSize.y=s.y)),he.map===null||te===!0||se===!0){const le=this.type!==xo?{minFilter:mr,magFilter:mr}:{};he.map!==null&&he.map.dispose(),he.map=new qh(r.x,r.y,le),he.map.texture.name=ue.name+".shadowMap",he.camera.updateProjectionMatrix()}i.setRenderTarget(he.map),i.clear();const Se=he.getViewportCount();for(let le=0;le0||k.map&&k.alphaTest>0){const J=V.uuid,te=k.uuid;let se=h[J];se===void 0&&(se={},h[J]=se);let ne=se[te];ne===void 0&&(ne=V.clone(),se[te]=ne,k.addEventListener("dispose",z)),V=ne}if(V.visible=k.visible,V.wireframe=k.wireframe,F===xo?V.side=k.shadowSide!==null?k.shadowSide:k.side:V.side=k.shadowSide!==null?k.shadowSide:v[k.side],V.alphaMap=k.alphaMap,V.alphaTest=k.alphaTest,V.map=k.map,V.clipShadows=k.clipShadows,V.clippingPlanes=k.clippingPlanes,V.clipIntersection=k.clipIntersection,V.displacementMap=k.displacementMap,V.displacementScale=k.displacementScale,V.displacementBias=k.displacementBias,V.wireframeLinewidth=k.wireframeLinewidth,V.linewidth=k.linewidth,H.isPointLight===!0&&V.isMeshDistanceMaterial===!0){const J=i.properties.get(V);J.light=H}return V}function O(G,k,H,F,V){if(G.visible===!1)return;if(G.layers.test(k.layers)&&(G.isMesh||G.isLine||G.isPoints)&&(G.castShadow||G.receiveShadow&&V===xo)&&(!G.frustumCulled||n.intersectsObject(G))){G.modelViewMatrix.multiplyMatrices(H.matrixWorldInverse,G.matrixWorld);const te=e.update(G),se=G.material;if(Array.isArray(se)){const ne=te.groups;for(let Z=0,ue=ne.length;Z=1):he.indexOf("OpenGL ES")!==-1&&(ue=parseFloat(/^OpenGL ES (\d)/.exec(he)[1]),Z=ue>=2);let be=null,Se={};const le=i.getParameter(i.SCISSOR_BOX),we=i.getParameter(i.VIEWPORT),We=new Pn().fromArray(le),Te=new Pn().fromArray(we);function ze(me,jt,rt,yt){const $t=new Uint8Array(4),kt=i.createTexture();i.bindTexture(me,kt),i.texParameteri(me,i.TEXTURE_MIN_FILTER,i.NEAREST),i.texParameteri(me,i.TEXTURE_MAG_FILTER,i.NEAREST);for(let xn=0;xn"u"?!1:/OculusBrowser/g.test(navigator.userAgent),h=new dt,g=new WeakMap;let v;const x=new WeakMap;let S=!1;try{S=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function w(fe,Y){return S?new OffscreenCanvas(fe,Y):sg("canvas")}function R(fe,Y,Ce){let $e=1;const it=St(fe);if((it.width>Ce||it.height>Ce)&&($e=Ce/Math.max(it.width,it.height)),$e<1)if(typeof HTMLImageElement<"u"&&fe instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&fe instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&fe instanceof ImageBitmap||typeof VideoFrame<"u"&&fe instanceof VideoFrame){const tt=Math.floor($e*it.width),Vt=Math.floor($e*it.height);v===void 0&&(v=w(tt,Vt));const Bt=Y?w(tt,Vt):v;return Bt.width=tt,Bt.height=Vt,Bt.getContext("2d").drawImage(fe,0,0,tt,Vt),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+it.width+"x"+it.height+") to ("+tt+"x"+Vt+")."),Bt}else return"data"in fe&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+it.width+"x"+it.height+")."),fe;return fe}function C(fe){return fe.generateMipmaps}function E(fe){i.generateMipmap(fe)}function B(fe){return fe.isWebGLCubeRenderTarget?i.TEXTURE_CUBE_MAP:fe.isWebGL3DRenderTarget?i.TEXTURE_3D:fe.isWebGLArrayRenderTarget||fe.isCompressedArrayTexture?i.TEXTURE_2D_ARRAY:i.TEXTURE_2D}function L(fe,Y,Ce,$e,it=!1){if(fe!==null){if(i[fe]!==void 0)return i[fe];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+fe+"'")}let tt=Y;if(Y===i.RED&&(Ce===i.FLOAT&&(tt=i.R32F),Ce===i.HALF_FLOAT&&(tt=i.R16F),Ce===i.UNSIGNED_BYTE&&(tt=i.R8)),Y===i.RED_INTEGER&&(Ce===i.UNSIGNED_BYTE&&(tt=i.R8UI),Ce===i.UNSIGNED_SHORT&&(tt=i.R16UI),Ce===i.UNSIGNED_INT&&(tt=i.R32UI),Ce===i.BYTE&&(tt=i.R8I),Ce===i.SHORT&&(tt=i.R16I),Ce===i.INT&&(tt=i.R32I)),Y===i.RG&&(Ce===i.FLOAT&&(tt=i.RG32F),Ce===i.HALF_FLOAT&&(tt=i.RG16F),Ce===i.UNSIGNED_BYTE&&(tt=i.RG8)),Y===i.RG_INTEGER&&(Ce===i.UNSIGNED_BYTE&&(tt=i.RG8UI),Ce===i.UNSIGNED_SHORT&&(tt=i.RG16UI),Ce===i.UNSIGNED_INT&&(tt=i.RG32UI),Ce===i.BYTE&&(tt=i.RG8I),Ce===i.SHORT&&(tt=i.RG16I),Ce===i.INT&&(tt=i.RG32I)),Y===i.RGB_INTEGER&&(Ce===i.UNSIGNED_BYTE&&(tt=i.RGB8UI),Ce===i.UNSIGNED_SHORT&&(tt=i.RGB16UI),Ce===i.UNSIGNED_INT&&(tt=i.RGB32UI),Ce===i.BYTE&&(tt=i.RGB8I),Ce===i.SHORT&&(tt=i.RGB16I),Ce===i.INT&&(tt=i.RGB32I)),Y===i.RGBA_INTEGER&&(Ce===i.UNSIGNED_BYTE&&(tt=i.RGBA8UI),Ce===i.UNSIGNED_SHORT&&(tt=i.RGBA16UI),Ce===i.UNSIGNED_INT&&(tt=i.RGBA32UI),Ce===i.BYTE&&(tt=i.RGBA8I),Ce===i.SHORT&&(tt=i.RGBA16I),Ce===i.INT&&(tt=i.RGBA32I)),Y===i.RGB&&Ce===i.UNSIGNED_INT_5_9_9_9_REV&&(tt=i.RGB9_E5),Y===i.RGBA){const Vt=it?a_:ai.getTransfer($e);Ce===i.FLOAT&&(tt=i.RGBA32F),Ce===i.HALF_FLOAT&&(tt=i.RGBA16F),Ce===i.UNSIGNED_BYTE&&(tt=Vt===Vi?i.SRGB8_ALPHA8:i.RGBA8),Ce===i.UNSIGNED_SHORT_4_4_4_4&&(tt=i.RGBA4),Ce===i.UNSIGNED_SHORT_5_5_5_1&&(tt=i.RGB5_A1)}return(tt===i.R16F||tt===i.R32F||tt===i.RG16F||tt===i.RG32F||tt===i.RGBA16F||tt===i.RGBA32F)&&e.get("EXT_color_buffer_float"),tt}function O(fe,Y){let Ce;return fe?Y===null||Y===Rr||Y===Au?Ce=i.DEPTH24_STENCIL8:Y===$r?Ce=i.DEPTH32F_STENCIL8:Y===wl&&(Ce=i.DEPTH24_STENCIL8,console.warn("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):Y===null||Y===Rr||Y===Au?Ce=i.DEPTH_COMPONENT24:Y===$r?Ce=i.DEPTH_COMPONENT32F:Y===wl&&(Ce=i.DEPTH_COMPONENT16),Ce}function z(fe,Y){return C(fe)===!0||fe.isFramebufferTexture&&fe.minFilter!==mr&&fe.minFilter!==gs?Math.log2(Math.max(Y.width,Y.height))+1:fe.mipmaps!==void 0&&fe.mipmaps.length>0?fe.mipmaps.length:fe.isCompressedTexture&&Array.isArray(fe.image)?Y.mipmaps.length:1}function G(fe){const Y=fe.target;Y.removeEventListener("dispose",G),H(Y),Y.isVideoTexture&&g.delete(Y)}function k(fe){const Y=fe.target;Y.removeEventListener("dispose",k),V(Y)}function H(fe){const Y=n.get(fe);if(Y.__webglInit===void 0)return;const Ce=fe.source,$e=x.get(Ce);if($e){const it=$e[Y.__cacheKey];it.usedTimes--,it.usedTimes===0&&F(fe),Object.keys($e).length===0&&x.delete(Ce)}n.remove(fe)}function F(fe){const Y=n.get(fe);i.deleteTexture(Y.__webglTexture);const Ce=fe.source,$e=x.get(Ce);delete $e[Y.__cacheKey],a.memory.textures--}function V(fe){const Y=n.get(fe);if(fe.depthTexture&&(fe.depthTexture.dispose(),n.remove(fe.depthTexture)),fe.isWebGLCubeRenderTarget)for(let $e=0;$e<6;$e++){if(Array.isArray(Y.__webglFramebuffer[$e]))for(let it=0;it=r.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+fe+" texture units while this GPU supports only "+r.maxTextures),X+=1,fe}function se(fe){const Y=[];return Y.push(fe.wrapS),Y.push(fe.wrapT),Y.push(fe.wrapR||0),Y.push(fe.magFilter),Y.push(fe.minFilter),Y.push(fe.anisotropy),Y.push(fe.internalFormat),Y.push(fe.format),Y.push(fe.type),Y.push(fe.generateMipmaps),Y.push(fe.premultiplyAlpha),Y.push(fe.flipY),Y.push(fe.unpackAlignment),Y.push(fe.colorSpace),Y.join()}function ne(fe,Y){const Ce=n.get(fe);if(fe.isVideoTexture&&ut(fe),fe.isRenderTargetTexture===!1&&fe.version>0&&Ce.__version!==fe.version){const $e=fe.image;if($e===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if($e.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{Te(Ce,fe,Y);return}}t.bindTexture(i.TEXTURE_2D,Ce.__webglTexture,i.TEXTURE0+Y)}function Z(fe,Y){const Ce=n.get(fe);if(fe.version>0&&Ce.__version!==fe.version){Te(Ce,fe,Y);return}t.bindTexture(i.TEXTURE_2D_ARRAY,Ce.__webglTexture,i.TEXTURE0+Y)}function ue(fe,Y){const Ce=n.get(fe);if(fe.version>0&&Ce.__version!==fe.version){Te(Ce,fe,Y);return}t.bindTexture(i.TEXTURE_3D,Ce.__webglTexture,i.TEXTURE0+Y)}function he(fe,Y){const Ce=n.get(fe);if(fe.version>0&&Ce.__version!==fe.version){ze(Ce,fe,Y);return}t.bindTexture(i.TEXTURE_CUBE_MAP,Ce.__webglTexture,i.TEXTURE0+Y)}const be={[aA]:i.REPEAT,[eu]:i.CLAMP_TO_EDGE,[oA]:i.MIRRORED_REPEAT},Se={[mr]:i.NEAREST,[s_]:i.NEAREST_MIPMAP_NEAREST,[tu]:i.NEAREST_MIPMAP_LINEAR,[gs]:i.LINEAR,[Jd]:i.LINEAR_MIPMAP_NEAREST,[Va]:i.LINEAR_MIPMAP_LINEAR},le={[Iw]:i.NEVER,[qw]:i.ALWAYS,[my]:i.LESS,[gy]:i.LEQUAL,[Fw]:i.EQUAL,[Gw]:i.GEQUAL,[kw]:i.GREATER,[zw]:i.NOTEQUAL};function we(fe,Y){if(Y.type===$r&&e.has("OES_texture_float_linear")===!1&&(Y.magFilter===gs||Y.magFilter===Jd||Y.magFilter===tu||Y.magFilter===Va||Y.minFilter===gs||Y.minFilter===Jd||Y.minFilter===tu||Y.minFilter===Va)&&console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),i.texParameteri(fe,i.TEXTURE_WRAP_S,be[Y.wrapS]),i.texParameteri(fe,i.TEXTURE_WRAP_T,be[Y.wrapT]),(fe===i.TEXTURE_3D||fe===i.TEXTURE_2D_ARRAY)&&i.texParameteri(fe,i.TEXTURE_WRAP_R,be[Y.wrapR]),i.texParameteri(fe,i.TEXTURE_MAG_FILTER,Se[Y.magFilter]),i.texParameteri(fe,i.TEXTURE_MIN_FILTER,Se[Y.minFilter]),Y.compareFunction&&(i.texParameteri(fe,i.TEXTURE_COMPARE_MODE,i.COMPARE_REF_TO_TEXTURE),i.texParameteri(fe,i.TEXTURE_COMPARE_FUNC,le[Y.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(Y.magFilter===mr||Y.minFilter!==tu&&Y.minFilter!==Va||Y.type===$r&&e.has("OES_texture_float_linear")===!1)return;if(Y.anisotropy>1||n.get(Y).__currentAnisotropy){const Ce=e.get("EXT_texture_filter_anisotropic");i.texParameterf(fe,Ce.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(Y.anisotropy,r.getMaxAnisotropy())),n.get(Y).__currentAnisotropy=Y.anisotropy}}}function We(fe,Y){let Ce=!1;fe.__webglInit===void 0&&(fe.__webglInit=!0,Y.addEventListener("dispose",G));const $e=Y.source;let it=x.get($e);it===void 0&&(it={},x.set($e,it));const tt=se(Y);if(tt!==fe.__cacheKey){it[tt]===void 0&&(it[tt]={texture:i.createTexture(),usedTimes:0},a.memory.textures++,Ce=!0),it[tt].usedTimes++;const Vt=it[fe.__cacheKey];Vt!==void 0&&(it[fe.__cacheKey].usedTimes--,Vt.usedTimes===0&&F(Y)),fe.__cacheKey=tt,fe.__webglTexture=it[tt].texture}return Ce}function Te(fe,Y,Ce){let $e=i.TEXTURE_2D;(Y.isDataArrayTexture||Y.isCompressedArrayTexture)&&($e=i.TEXTURE_2D_ARRAY),Y.isData3DTexture&&($e=i.TEXTURE_3D);const it=We(fe,Y),tt=Y.source;t.bindTexture($e,fe.__webglTexture,i.TEXTURE0+Ce);const Vt=n.get(tt);if(tt.version!==Vt.__version||it===!0){t.activeTexture(i.TEXTURE0+Ce);const Bt=ai.getPrimaries(ai.workingColorSpace),Wt=Y.colorSpace===Co?null:ai.getPrimaries(Y.colorSpace),ln=Y.colorSpace===Co||Bt===Wt?i.NONE:i.BROWSER_DEFAULT_WEBGL;i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,Y.flipY),i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,Y.premultiplyAlpha),i.pixelStorei(i.UNPACK_ALIGNMENT,Y.unpackAlignment),i.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL,ln);let Tt=R(Y.image,!1,r.maxTextureSize);Tt=en(Y,Tt);const Kt=s.convert(Y.format,Y.colorSpace),rn=s.convert(Y.type);let Ht=L(Y.internalFormat,Kt,rn,Y.colorSpace,Y.isVideoTexture);we($e,Y);let Ft;const Gt=Y.mipmaps,In=Y.isVideoTexture!==!0,Mi=Vt.__version===void 0||it===!0,me=tt.dataReady,jt=z(Y,Tt);if(Y.isDepthTexture)Ht=O(Y.format===du,Y.type),Mi&&(In?t.texStorage2D(i.TEXTURE_2D,1,Ht,Tt.width,Tt.height):t.texImage2D(i.TEXTURE_2D,0,Ht,Tt.width,Tt.height,0,Kt,rn,null));else if(Y.isDataTexture)if(Gt.length>0){In&&Mi&&t.texStorage2D(i.TEXTURE_2D,jt,Ht,Gt[0].width,Gt[0].height);for(let rt=0,yt=Gt.length;rt0){const $t=NC(Ft.width,Ft.height,Y.format,Y.type);for(const kt of Y.layerUpdates){const xn=Ft.data.subarray(kt*$t/Ft.data.BYTES_PER_ELEMENT,(kt+1)*$t/Ft.data.BYTES_PER_ELEMENT);t.compressedTexSubImage3D(i.TEXTURE_2D_ARRAY,rt,0,0,kt,Ft.width,Ft.height,1,Kt,xn)}Y.clearLayerUpdates()}else t.compressedTexSubImage3D(i.TEXTURE_2D_ARRAY,rt,0,0,0,Ft.width,Ft.height,Tt.depth,Kt,Ft.data)}else t.compressedTexImage3D(i.TEXTURE_2D_ARRAY,rt,Ht,Ft.width,Ft.height,Tt.depth,0,Ft.data,0,0);else console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else In?me&&t.texSubImage3D(i.TEXTURE_2D_ARRAY,rt,0,0,0,Ft.width,Ft.height,Tt.depth,Kt,rn,Ft.data):t.texImage3D(i.TEXTURE_2D_ARRAY,rt,Ht,Ft.width,Ft.height,Tt.depth,0,Kt,rn,Ft.data)}else{In&&Mi&&t.texStorage2D(i.TEXTURE_2D,jt,Ht,Gt[0].width,Gt[0].height);for(let rt=0,yt=Gt.length;rt0){const rt=NC(Tt.width,Tt.height,Y.format,Y.type);for(const yt of Y.layerUpdates){const $t=Tt.data.subarray(yt*rt/Tt.data.BYTES_PER_ELEMENT,(yt+1)*rt/Tt.data.BYTES_PER_ELEMENT);t.texSubImage3D(i.TEXTURE_2D_ARRAY,0,0,0,yt,Tt.width,Tt.height,1,Kt,rn,$t)}Y.clearLayerUpdates()}else t.texSubImage3D(i.TEXTURE_2D_ARRAY,0,0,0,0,Tt.width,Tt.height,Tt.depth,Kt,rn,Tt.data)}else t.texImage3D(i.TEXTURE_2D_ARRAY,0,Ht,Tt.width,Tt.height,Tt.depth,0,Kt,rn,Tt.data);else if(Y.isData3DTexture)In?(Mi&&t.texStorage3D(i.TEXTURE_3D,jt,Ht,Tt.width,Tt.height,Tt.depth),me&&t.texSubImage3D(i.TEXTURE_3D,0,0,0,0,Tt.width,Tt.height,Tt.depth,Kt,rn,Tt.data)):t.texImage3D(i.TEXTURE_3D,0,Ht,Tt.width,Tt.height,Tt.depth,0,Kt,rn,Tt.data);else if(Y.isFramebufferTexture){if(Mi)if(In)t.texStorage2D(i.TEXTURE_2D,jt,Ht,Tt.width,Tt.height);else{let rt=Tt.width,yt=Tt.height;for(let $t=0;$t>=1,yt>>=1}}else if(Gt.length>0){if(In&&Mi){const rt=St(Gt[0]);t.texStorage2D(i.TEXTURE_2D,jt,Ht,rt.width,rt.height)}for(let rt=0,yt=Gt.length;rt0&&jt++;const yt=St(Kt[0]);t.texStorage2D(i.TEXTURE_CUBE_MAP,jt,Gt,yt.width,yt.height)}for(let yt=0;yt<6;yt++)if(Tt){In?me&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+yt,0,0,0,Kt[yt].width,Kt[yt].height,Ht,Ft,Kt[yt].data):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+yt,0,Gt,Kt[yt].width,Kt[yt].height,0,Ht,Ft,Kt[yt].data);for(let $t=0;$t>tt),rn=Math.max(1,Y.height>>tt);it===i.TEXTURE_3D||it===i.TEXTURE_2D_ARRAY?t.texImage3D(it,tt,Wt,Kt,rn,Y.depth,0,Vt,Bt,null):t.texImage2D(it,tt,Wt,Kt,rn,0,Vt,Bt,null)}t.bindFramebuffer(i.FRAMEBUFFER,fe),Dt(Y)?l.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,$e,it,Tt.__webglTexture,0,lt(Y)):(it===i.TEXTURE_2D||it>=i.TEXTURE_CUBE_MAP_POSITIVE_X&&it<=i.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&i.framebufferTexture2D(i.FRAMEBUFFER,$e,it,Tt.__webglTexture,tt),t.bindFramebuffer(i.FRAMEBUFFER,null)}function De(fe,Y,Ce){if(i.bindRenderbuffer(i.RENDERBUFFER,fe),Y.depthBuffer){const $e=Y.depthTexture,it=$e&&$e.isDepthTexture?$e.type:null,tt=O(Y.stencilBuffer,it),Vt=Y.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,Bt=lt(Y);Dt(Y)?l.renderbufferStorageMultisampleEXT(i.RENDERBUFFER,Bt,tt,Y.width,Y.height):Ce?i.renderbufferStorageMultisample(i.RENDERBUFFER,Bt,tt,Y.width,Y.height):i.renderbufferStorage(i.RENDERBUFFER,tt,Y.width,Y.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,Vt,i.RENDERBUFFER,fe)}else{const $e=Y.textures;for(let it=0;it<$e.length;it++){const tt=$e[it],Vt=s.convert(tt.format,tt.colorSpace),Bt=s.convert(tt.type),Wt=L(tt.internalFormat,Vt,Bt,tt.colorSpace),ln=lt(Y);Ce&&Dt(Y)===!1?i.renderbufferStorageMultisample(i.RENDERBUFFER,ln,Wt,Y.width,Y.height):Dt(Y)?l.renderbufferStorageMultisampleEXT(i.RENDERBUFFER,ln,Wt,Y.width,Y.height):i.renderbufferStorage(i.RENDERBUFFER,Wt,Y.width,Y.height)}}i.bindRenderbuffer(i.RENDERBUFFER,null)}function pt(fe,Y){if(Y&&Y.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(t.bindFramebuffer(i.FRAMEBUFFER,fe),!(Y.depthTexture&&Y.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");const $e=n.get(Y.depthTexture);$e.__renderTarget=Y,(!$e.__webglTexture||Y.depthTexture.image.width!==Y.width||Y.depthTexture.image.height!==Y.height)&&(Y.depthTexture.image.width=Y.width,Y.depthTexture.image.height=Y.height,Y.depthTexture.needsUpdate=!0),ne(Y.depthTexture,0);const it=$e.__webglTexture,tt=lt(Y);if(Y.depthTexture.format===au)Dt(Y)?l.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,i.DEPTH_ATTACHMENT,i.TEXTURE_2D,it,0,tt):i.framebufferTexture2D(i.FRAMEBUFFER,i.DEPTH_ATTACHMENT,i.TEXTURE_2D,it,0);else if(Y.depthTexture.format===du)Dt(Y)?l.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,i.DEPTH_STENCIL_ATTACHMENT,i.TEXTURE_2D,it,0,tt):i.framebufferTexture2D(i.FRAMEBUFFER,i.DEPTH_STENCIL_ATTACHMENT,i.TEXTURE_2D,it,0);else throw new Error("Unknown depthTexture format")}function _t(fe){const Y=n.get(fe),Ce=fe.isWebGLCubeRenderTarget===!0;if(Y.__boundDepthTexture!==fe.depthTexture){const $e=fe.depthTexture;if(Y.__depthDisposeCallback&&Y.__depthDisposeCallback(),$e){const it=()=>{delete Y.__boundDepthTexture,delete Y.__depthDisposeCallback,$e.removeEventListener("dispose",it)};$e.addEventListener("dispose",it),Y.__depthDisposeCallback=it}Y.__boundDepthTexture=$e}if(fe.depthTexture&&!Y.__autoAllocateDepthBuffer){if(Ce)throw new Error("target.depthTexture not supported in Cube render targets");pt(Y.__webglFramebuffer,fe)}else if(Ce){Y.__webglDepthbuffer=[];for(let $e=0;$e<6;$e++)if(t.bindFramebuffer(i.FRAMEBUFFER,Y.__webglFramebuffer[$e]),Y.__webglDepthbuffer[$e]===void 0)Y.__webglDepthbuffer[$e]=i.createRenderbuffer(),De(Y.__webglDepthbuffer[$e],fe,!1);else{const it=fe.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,tt=Y.__webglDepthbuffer[$e];i.bindRenderbuffer(i.RENDERBUFFER,tt),i.framebufferRenderbuffer(i.FRAMEBUFFER,it,i.RENDERBUFFER,tt)}}else if(t.bindFramebuffer(i.FRAMEBUFFER,Y.__webglFramebuffer),Y.__webglDepthbuffer===void 0)Y.__webglDepthbuffer=i.createRenderbuffer(),De(Y.__webglDepthbuffer,fe,!1);else{const $e=fe.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,it=Y.__webglDepthbuffer;i.bindRenderbuffer(i.RENDERBUFFER,it),i.framebufferRenderbuffer(i.FRAMEBUFFER,$e,i.RENDERBUFFER,it)}t.bindFramebuffer(i.FRAMEBUFFER,null)}function wt(fe,Y,Ce){const $e=n.get(fe);Y!==void 0&&_e($e.__webglFramebuffer,fe,fe.texture,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,0),Ce!==void 0&&_t(fe)}function Ge(fe){const Y=fe.texture,Ce=n.get(fe),$e=n.get(Y);fe.addEventListener("dispose",k);const it=fe.textures,tt=fe.isWebGLCubeRenderTarget===!0,Vt=it.length>1;if(Vt||($e.__webglTexture===void 0&&($e.__webglTexture=i.createTexture()),$e.__version=Y.version,a.memory.textures++),tt){Ce.__webglFramebuffer=[];for(let Bt=0;Bt<6;Bt++)if(Y.mipmaps&&Y.mipmaps.length>0){Ce.__webglFramebuffer[Bt]=[];for(let Wt=0;Wt0){Ce.__webglFramebuffer=[];for(let Bt=0;Bt0&&Dt(fe)===!1){Ce.__webglMultisampledFramebuffer=i.createFramebuffer(),Ce.__webglColorRenderbuffer=[],t.bindFramebuffer(i.FRAMEBUFFER,Ce.__webglMultisampledFramebuffer);for(let Bt=0;Bt0)for(let Wt=0;Wt0)for(let Wt=0;Wt0){if(Dt(fe)===!1){const Y=fe.textures,Ce=fe.width,$e=fe.height;let it=i.COLOR_BUFFER_BIT;const tt=fe.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,Vt=n.get(fe),Bt=Y.length>1;if(Bt)for(let Wt=0;Wt0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&Y.__useRenderToTexture!==!1}function ut(fe){const Y=a.render.frame;g.get(fe)!==Y&&(g.set(fe,Y),fe.update())}function en(fe,Y){const Ce=fe.colorSpace,$e=fe.format,it=fe.type;return fe.isCompressedTexture===!0||fe.isVideoTexture===!0||Ce!==Ro&&Ce!==Co&&(ai.getTransfer(Ce)===Vi?($e!==ks||it!==aa)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",Ce)),Y}function St(fe){return typeof HTMLImageElement<"u"&&fe instanceof HTMLImageElement?(h.width=fe.naturalWidth||fe.width,h.height=fe.naturalHeight||fe.height):typeof VideoFrame<"u"&&fe instanceof VideoFrame?(h.width=fe.displayWidth,h.height=fe.displayHeight):(h.width=fe.width,h.height=fe.height),h}this.allocateTextureUnit=te,this.resetTextureUnits=J,this.setTexture2D=ne,this.setTexture2DArray=Z,this.setTexture3D=ue,this.setTextureCube=he,this.rebindTextures=wt,this.setupRenderTarget=Ge,this.updateRenderTargetMipmap=Be,this.updateMultisampleRenderTarget=Mt,this.setupDepthRenderbuffer=_t,this.setupFrameBufferTexture=_e,this.useMultisampledRTT=Dt}function Tj(i,e){function t(n,r=Co){let s;const a=ai.getTransfer(r);if(n===aa)return i.UNSIGNED_BYTE;if(n===Ay)return i.UNSIGNED_SHORT_4_4_4_4;if(n===dy)return i.UNSIGNED_SHORT_5_5_5_1;if(n===py)return i.UNSIGNED_INT_5_9_9_9_REV;if(n===Qf)return i.BYTE;if(n===Kf)return i.SHORT;if(n===wl)return i.UNSIGNED_SHORT;if(n===Ns)return i.INT;if(n===Rr)return i.UNSIGNED_INT;if(n===$r)return i.FLOAT;if(n===Gs)return i.HALF_FLOAT;if(n===Lw)return i.ALPHA;if(n===Ug)return i.RGB;if(n===ks)return i.RGBA;if(n===Uw)return i.LUMINANCE;if(n===Bw)return i.LUMINANCE_ALPHA;if(n===au)return i.DEPTH_COMPONENT;if(n===du)return i.DEPTH_STENCIL;if(n===Bg)return i.RED;if(n===H0)return i.RED_INTEGER;if(n===lA)return i.RG;if(n===j0)return i.RG_INTEGER;if(n===W0)return i.RGBA_INTEGER;if(n===Zf||n===Bh||n===Oh||n===Ih)if(a===Vi)if(s=e.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(n===Zf)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===Bh)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===Oh)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===Ih)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=e.get("WEBGL_compressed_texture_s3tc"),s!==null){if(n===Zf)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===Bh)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===Oh)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===Ih)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(n===Km||n===Zm||n===Jm||n===eg)if(s=e.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(n===Km)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===Zm)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===Jm)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===eg)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(n===tg||n===u0||n===c0)if(s=e.get("WEBGL_compressed_texture_etc"),s!==null){if(n===tg||n===u0)return a===Vi?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(n===c0)return a===Vi?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(n===h0||n===f0||n===A0||n===d0||n===p0||n===m0||n===g0||n===v0||n===_0||n===y0||n===x0||n===b0||n===S0||n===T0)if(s=e.get("WEBGL_compressed_texture_astc"),s!==null){if(n===h0)return a===Vi?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===f0)return a===Vi?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===A0)return a===Vi?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===d0)return a===Vi?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===p0)return a===Vi?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===m0)return a===Vi?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===g0)return a===Vi?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===v0)return a===Vi?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===_0)return a===Vi?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===y0)return a===Vi?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===x0)return a===Vi?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===b0)return a===Vi?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===S0)return a===Vi?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===T0)return a===Vi?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(n===Jf||n===VS||n===HS)if(s=e.get("EXT_texture_compression_bptc"),s!==null){if(n===Jf)return a===Vi?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(n===VS)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===HS)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(n===Ow||n===ng||n===ig||n===rg)if(s=e.get("EXT_texture_compression_rgtc"),s!==null){if(n===Jf)return s.COMPRESSED_RED_RGTC1_EXT;if(n===ng)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===ig)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===rg)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return n===Au?i.UNSIGNED_INT_24_8:i[n]!==void 0?i[n]:null}return{convert:t}}const wj={type:"move"};class D3{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new ja,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new ja,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new ce,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new ce),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new ja,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new ce,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new ce),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){const t=this._hand;if(t)for(const n of e.hand.values())this._getHandJoint(t,n)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,n){let r=null,s=null,a=null;const l=this._targetRay,u=this._grip,h=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(h&&e.hand){a=!0;for(const R of e.hand.values()){const C=t.getJointPose(R,n),E=this._getHandJoint(h,R);C!==null&&(E.matrix.fromArray(C.transform.matrix),E.matrix.decompose(E.position,E.rotation,E.scale),E.matrixWorldNeedsUpdate=!0,E.jointRadius=C.radius),E.visible=C!==null}const g=h.joints["index-finger-tip"],v=h.joints["thumb-tip"],x=g.position.distanceTo(v.position),S=.02,w=.005;h.inputState.pinching&&x>S+w?(h.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!h.inputState.pinching&&x<=S-w&&(h.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else u!==null&&e.gripSpace&&(s=t.getPose(e.gripSpace,n),s!==null&&(u.matrix.fromArray(s.transform.matrix),u.matrix.decompose(u.position,u.rotation,u.scale),u.matrixWorldNeedsUpdate=!0,s.linearVelocity?(u.hasLinearVelocity=!0,u.linearVelocity.copy(s.linearVelocity)):u.hasLinearVelocity=!1,s.angularVelocity?(u.hasAngularVelocity=!0,u.angularVelocity.copy(s.angularVelocity)):u.hasAngularVelocity=!1));l!==null&&(r=t.getPose(e.targetRaySpace,n),r===null&&s!==null&&(r=s),r!==null&&(l.matrix.fromArray(r.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),l.matrixWorldNeedsUpdate=!0,r.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(r.linearVelocity)):l.hasLinearVelocity=!1,r.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(r.angularVelocity)):l.hasAngularVelocity=!1,this.dispatchEvent(wj)))}return l!==null&&(l.visible=r!==null),u!==null&&(u.visible=s!==null),h!==null&&(h.visible=a!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const n=new ja;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}}const Mj=` void main() { gl_Position = vec4( position, 1.0 ); @@ -3872,23 +3872,23 @@ void main() { } -}`;class Cj{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t,n){if(this.texture===null){const r=new vs,s=e.properties.get(r);s.__webglTexture=t.texture,(t.depthNear!==n.depthNear||t.depthFar!==n.depthFar)&&(this.depthNear=t.depthNear,this.depthFar=t.depthFar),this.texture=r}}getMesh(e){if(this.texture!==null&&this.mesh===null){const t=e.cameras[0].viewport,n=new Ja({vertexShader:Mj,fragmentShader:Ej,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new zi(new Ty(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class Rj extends zc{constructor(e,t){super();const n=this;let r=null,s=1,a=null,l="local-floor",u=1,h=null,g=null,v=null,x=null,S=null,w=null;const R=new Cj,C=t.getContextAttributes();let E=null,B=null;const L=[],O=[],z=new At;let G=null;const k=new ya;k.viewport=new Pn;const H=new ya;H.viewport=new Pn;const F=[k,H],V=new $z;let X=null,J=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(Te){let ze=L[Te];return ze===void 0&&(ze=new D3,L[Te]=ze),ze.getTargetRaySpace()},this.getControllerGrip=function(Te){let ze=L[Te];return ze===void 0&&(ze=new D3,L[Te]=ze),ze.getGripSpace()},this.getHand=function(Te){let ze=L[Te];return ze===void 0&&(ze=new D3,L[Te]=ze),ze.getHandSpace()};function te(Te){const ze=O.indexOf(Te.inputSource);if(ze===-1)return;const _e=L[ze];_e!==void 0&&(_e.update(Te.inputSource,Te.frame,h||a),_e.dispatchEvent({type:Te.type,data:Te.inputSource}))}function se(){r.removeEventListener("select",te),r.removeEventListener("selectstart",te),r.removeEventListener("selectend",te),r.removeEventListener("squeeze",te),r.removeEventListener("squeezestart",te),r.removeEventListener("squeezeend",te),r.removeEventListener("end",se),r.removeEventListener("inputsourceschange",ne);for(let Te=0;Te=0&&(O[De]=null,L[De].disconnect(_e))}for(let ze=0;ze=O.length){O.push(_e),De=vt;break}else if(O[vt]===null){O[vt]=_e,De=vt;break}if(De===-1)break}const dt=L[De];dt&&dt.connect(_e)}}const Z=new ce,ue=new ce;function he(Te,ze,_e){Z.setFromMatrixPosition(ze.matrixWorld),ue.setFromMatrixPosition(_e.matrixWorld);const De=Z.distanceTo(ue),dt=ze.projectionMatrix.elements,vt=_e.projectionMatrix.elements,Tt=dt[14]/(dt[10]-1),Ge=dt[14]/(dt[10]+1),Be=(dt[9]+1)/dt[5],ke=(dt[9]-1)/dt[5],oe=(dt[8]-1)/dt[0],Mt=(vt[8]+1)/vt[0],lt=Tt*oe,Dt=Tt*Mt,wt=De/(-oe+Mt),tn=wt*-oe;if(ze.matrixWorld.decompose(Te.position,Te.quaternion,Te.scale),Te.translateX(tn),Te.translateZ(wt),Te.matrixWorld.compose(Te.position,Te.quaternion,Te.scale),Te.matrixWorldInverse.copy(Te.matrixWorld).invert(),dt[10]===-1)Te.projectionMatrix.copy(ze.projectionMatrix),Te.projectionMatrixInverse.copy(ze.projectionMatrixInverse);else{const bt=Tt+wt,fe=Ge+wt,Y=lt-tn,Ce=Dt+(De-tn),$e=Be*Ge/fe*bt,it=ke*Ge/fe*bt;Te.projectionMatrix.makePerspective(Y,Ce,$e,it,bt,fe),Te.projectionMatrixInverse.copy(Te.projectionMatrix).invert()}}function be(Te,ze){ze===null?Te.matrixWorld.copy(Te.matrix):Te.matrixWorld.multiplyMatrices(ze.matrixWorld,Te.matrix),Te.matrixWorldInverse.copy(Te.matrixWorld).invert()}this.updateCamera=function(Te){if(r===null)return;let ze=Te.near,_e=Te.far;R.texture!==null&&(R.depthNear>0&&(ze=R.depthNear),R.depthFar>0&&(_e=R.depthFar)),V.near=H.near=k.near=ze,V.far=H.far=k.far=_e,(X!==V.near||J!==V.far)&&(r.updateRenderState({depthNear:V.near,depthFar:V.far}),X=V.near,J=V.far),k.layers.mask=Te.layers.mask|2,H.layers.mask=Te.layers.mask|4,V.layers.mask=k.layers.mask|H.layers.mask;const De=Te.parent,dt=V.cameras;be(V,De);for(let vt=0;vt0&&(C.alphaTest.value=E.alphaTest);const B=e.get(E),L=B.envMap,O=B.envMapRotation;L&&(C.envMap.value=L,wf.copy(O),wf.x*=-1,wf.y*=-1,wf.z*=-1,L.isCubeTexture&&L.isRenderTargetTexture===!1&&(wf.y*=-1,wf.z*=-1),C.envMapRotation.value.setFromMatrix4(Nj.makeRotationFromEuler(wf)),C.flipEnvMap.value=L.isCubeTexture&&L.isRenderTargetTexture===!1?-1:1,C.reflectivity.value=E.reflectivity,C.ior.value=E.ior,C.refractionRatio.value=E.refractionRatio),E.lightMap&&(C.lightMap.value=E.lightMap,C.lightMapIntensity.value=E.lightMapIntensity,t(E.lightMap,C.lightMapTransform)),E.aoMap&&(C.aoMap.value=E.aoMap,C.aoMapIntensity.value=E.aoMapIntensity,t(E.aoMap,C.aoMapTransform))}function a(C,E){C.diffuse.value.copy(E.color),C.opacity.value=E.opacity,E.map&&(C.map.value=E.map,t(E.map,C.mapTransform))}function l(C,E){C.dashSize.value=E.dashSize,C.totalSize.value=E.dashSize+E.gapSize,C.scale.value=E.scale}function u(C,E,B,L){C.diffuse.value.copy(E.color),C.opacity.value=E.opacity,C.size.value=E.size*B,C.scale.value=L*.5,E.map&&(C.map.value=E.map,t(E.map,C.uvTransform)),E.alphaMap&&(C.alphaMap.value=E.alphaMap,t(E.alphaMap,C.alphaMapTransform)),E.alphaTest>0&&(C.alphaTest.value=E.alphaTest)}function h(C,E){C.diffuse.value.copy(E.color),C.opacity.value=E.opacity,C.rotation.value=E.rotation,E.map&&(C.map.value=E.map,t(E.map,C.mapTransform)),E.alphaMap&&(C.alphaMap.value=E.alphaMap,t(E.alphaMap,C.alphaMapTransform)),E.alphaTest>0&&(C.alphaTest.value=E.alphaTest)}function g(C,E){C.specular.value.copy(E.specular),C.shininess.value=Math.max(E.shininess,1e-4)}function v(C,E){E.gradientMap&&(C.gradientMap.value=E.gradientMap)}function x(C,E){C.metalness.value=E.metalness,E.metalnessMap&&(C.metalnessMap.value=E.metalnessMap,t(E.metalnessMap,C.metalnessMapTransform)),C.roughness.value=E.roughness,E.roughnessMap&&(C.roughnessMap.value=E.roughnessMap,t(E.roughnessMap,C.roughnessMapTransform)),E.envMap&&(C.envMapIntensity.value=E.envMapIntensity)}function S(C,E,B){C.ior.value=E.ior,E.sheen>0&&(C.sheenColor.value.copy(E.sheenColor).multiplyScalar(E.sheen),C.sheenRoughness.value=E.sheenRoughness,E.sheenColorMap&&(C.sheenColorMap.value=E.sheenColorMap,t(E.sheenColorMap,C.sheenColorMapTransform)),E.sheenRoughnessMap&&(C.sheenRoughnessMap.value=E.sheenRoughnessMap,t(E.sheenRoughnessMap,C.sheenRoughnessMapTransform))),E.clearcoat>0&&(C.clearcoat.value=E.clearcoat,C.clearcoatRoughness.value=E.clearcoatRoughness,E.clearcoatMap&&(C.clearcoatMap.value=E.clearcoatMap,t(E.clearcoatMap,C.clearcoatMapTransform)),E.clearcoatRoughnessMap&&(C.clearcoatRoughnessMap.value=E.clearcoatRoughnessMap,t(E.clearcoatRoughnessMap,C.clearcoatRoughnessMapTransform)),E.clearcoatNormalMap&&(C.clearcoatNormalMap.value=E.clearcoatNormalMap,t(E.clearcoatNormalMap,C.clearcoatNormalMapTransform),C.clearcoatNormalScale.value.copy(E.clearcoatNormalScale),E.side===hr&&C.clearcoatNormalScale.value.negate())),E.dispersion>0&&(C.dispersion.value=E.dispersion),E.iridescence>0&&(C.iridescence.value=E.iridescence,C.iridescenceIOR.value=E.iridescenceIOR,C.iridescenceThicknessMinimum.value=E.iridescenceThicknessRange[0],C.iridescenceThicknessMaximum.value=E.iridescenceThicknessRange[1],E.iridescenceMap&&(C.iridescenceMap.value=E.iridescenceMap,t(E.iridescenceMap,C.iridescenceMapTransform)),E.iridescenceThicknessMap&&(C.iridescenceThicknessMap.value=E.iridescenceThicknessMap,t(E.iridescenceThicknessMap,C.iridescenceThicknessMapTransform))),E.transmission>0&&(C.transmission.value=E.transmission,C.transmissionSamplerMap.value=B.texture,C.transmissionSamplerSize.value.set(B.width,B.height),E.transmissionMap&&(C.transmissionMap.value=E.transmissionMap,t(E.transmissionMap,C.transmissionMapTransform)),C.thickness.value=E.thickness,E.thicknessMap&&(C.thicknessMap.value=E.thicknessMap,t(E.thicknessMap,C.thicknessMapTransform)),C.attenuationDistance.value=E.attenuationDistance,C.attenuationColor.value.copy(E.attenuationColor)),E.anisotropy>0&&(C.anisotropyVector.value.set(E.anisotropy*Math.cos(E.anisotropyRotation),E.anisotropy*Math.sin(E.anisotropyRotation)),E.anisotropyMap&&(C.anisotropyMap.value=E.anisotropyMap,t(E.anisotropyMap,C.anisotropyMapTransform))),C.specularIntensity.value=E.specularIntensity,C.specularColor.value.copy(E.specularColor),E.specularColorMap&&(C.specularColorMap.value=E.specularColorMap,t(E.specularColorMap,C.specularColorMapTransform)),E.specularIntensityMap&&(C.specularIntensityMap.value=E.specularIntensityMap,t(E.specularIntensityMap,C.specularIntensityMapTransform))}function w(C,E){E.matcap&&(C.matcap.value=E.matcap)}function R(C,E){const B=e.get(E).light;C.referencePosition.value.setFromMatrixPosition(B.matrixWorld),C.nearDistance.value=B.shadow.camera.near,C.farDistance.value=B.shadow.camera.far}return{refreshFogUniforms:n,refreshMaterialUniforms:r}}function Pj(i,e,t,n){let r={},s={},a=[];const l=i.getParameter(i.MAX_UNIFORM_BUFFER_BINDINGS);function u(B,L){const O=L.program;n.uniformBlockBinding(B,O)}function h(B,L){let O=r[B.id];O===void 0&&(w(B),O=g(B),r[B.id]=O,B.addEventListener("dispose",C));const z=L.program;n.updateUBOMapping(B,z);const G=e.render.frame;s[B.id]!==G&&(x(B),s[B.id]=G)}function g(B){const L=v();B.__bindingPointIndex=L;const O=i.createBuffer(),z=B.__size,G=B.usage;return i.bindBuffer(i.UNIFORM_BUFFER,O),i.bufferData(i.UNIFORM_BUFFER,z,G),i.bindBuffer(i.UNIFORM_BUFFER,null),i.bindBufferBase(i.UNIFORM_BUFFER,L,O),O}function v(){for(let B=0;B0&&(O+=z-G),B.__size=O,B.__cache={},this}function R(B){const L={boundary:0,storage:0};return typeof B=="number"||typeof B=="boolean"?(L.boundary=4,L.storage=4):B.isVector2?(L.boundary=8,L.storage=8):B.isVector3||B.isColor?(L.boundary=16,L.storage=12):B.isVector4?(L.boundary=16,L.storage=16):B.isMatrix3?(L.boundary=48,L.storage=48):B.isMatrix4?(L.boundary=64,L.storage=64):B.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",B),L}function C(B){const L=B.target;L.removeEventListener("dispose",C);const O=a.indexOf(L.__bindingPointIndex);a.splice(O,1),i.deleteBuffer(r[L.id]),delete r[L.id],delete s[L.id]}function E(){for(const B in r)i.deleteBuffer(r[B]);a=[],r={},s={}}return{bind:u,update:h,dispose:E}}class Lj{constructor(e={}){const{canvas:t=I7(),context:n=null,depth:r=!0,stencil:s=!1,alpha:a=!1,antialias:l=!1,premultipliedAlpha:u=!0,preserveDrawingBuffer:h=!1,powerPreference:g="default",failIfMajorPerformanceCaveat:v=!1,reverseDepthBuffer:x=!1}=e;this.isWebGLRenderer=!0;let S;if(n!==null){if(typeof WebGLRenderingContext<"u"&&n instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");S=n.getContextAttributes().alpha}else S=a;const w=new Uint32Array(4),R=new Int32Array(4);let C=null,E=null;const B=[],L=[];this.domElement=t,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this._outputColorSpace=_n,this.toneMapping=Za,this.toneMappingExposure=1;const O=this;let z=!1,G=0,k=0,H=null,F=-1,V=null;const X=new Pn,J=new Pn;let te=null;const se=new sn(0);let ne=0,Z=t.width,ue=t.height,he=1,be=null,Se=null;const le=new Pn(0,0,Z,ue),we=new Pn(0,0,Z,ue);let We=!1;const Te=new Fg;let ze=!1,_e=!1;this.transmissionResolutionScale=1;const De=new kn,dt=new kn,vt=new ce,Tt=new Pn,Ge={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let Be=!1;function ke(){return H===null?he:1}let oe=n;function Mt(ae,Ue){return t.getContext(ae,Ue)}try{const ae={alpha:!0,depth:r,stencil:s,antialias:l,premultipliedAlpha:u,preserveDrawingBuffer:h,powerPreference:g,failIfMajorPerformanceCaveat:v};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${V0}`),t.addEventListener("webglcontextlost",_t,!1),t.addEventListener("webglcontextrestored",$t,!1),t.addEventListener("webglcontextcreationerror",kt,!1),oe===null){const Ue="webgl2";if(oe=Mt(Ue,ae),oe===null)throw Mt(Ue)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(ae){throw console.error("THREE.WebGLRenderer: "+ae.message),ae}let lt,Dt,wt,tn,bt,fe,Y,Ce,$e,it,tt,Vt,Bt,Wt,ln,St,Kt,rn,Ht,Ft,Gt,In,Mi,me;function jt(){lt=new qV(oe),lt.init(),In=new Tj(oe,lt),Dt=new OV(oe,lt,e,In),wt=new bj(oe,lt),Dt.reverseDepthBuffer&&x&&wt.buffers.depth.setReversed(!0),tn=new jV(oe),bt=new uj,fe=new Sj(oe,lt,wt,bt,Dt,In,tn),Y=new FV(O),Ce=new GV(O),$e=new Zz(oe),Mi=new UV(oe,$e),it=new VV(oe,$e,tn,Mi),tt=new $V(oe,it,$e,tn),Ht=new WV(oe,Dt,fe),St=new IV(bt),Vt=new lj(O,Y,Ce,lt,Dt,Mi,St),Bt=new Dj(O,bt),Wt=new hj,ln=new gj(lt),rn=new LV(O,Y,Ce,wt,tt,S,u),Kt=new yj(O,tt,Dt),me=new Pj(oe,tn,Dt,wt),Ft=new BV(oe,lt,tn),Gt=new HV(oe,lt,tn),tn.programs=Vt.programs,O.capabilities=Dt,O.extensions=lt,O.properties=bt,O.renderLists=Wt,O.shadowMap=Kt,O.state=wt,O.info=tn}jt();const rt=new Rj(O,oe);this.xr=rt,this.getContext=function(){return oe},this.getContextAttributes=function(){return oe.getContextAttributes()},this.forceContextLoss=function(){const ae=lt.get("WEBGL_lose_context");ae&&ae.loseContext()},this.forceContextRestore=function(){const ae=lt.get("WEBGL_lose_context");ae&&ae.restoreContext()},this.getPixelRatio=function(){return he},this.setPixelRatio=function(ae){ae!==void 0&&(he=ae,this.setSize(Z,ue,!1))},this.getSize=function(ae){return ae.set(Z,ue)},this.setSize=function(ae,Ue,Qe=!0){if(rt.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}Z=ae,ue=Ue,t.width=Math.floor(ae*he),t.height=Math.floor(Ue*he),Qe===!0&&(t.style.width=ae+"px",t.style.height=Ue+"px"),this.setViewport(0,0,ae,Ue)},this.getDrawingBufferSize=function(ae){return ae.set(Z*he,ue*he).floor()},this.setDrawingBufferSize=function(ae,Ue,Qe){Z=ae,ue=Ue,he=Qe,t.width=Math.floor(ae*Qe),t.height=Math.floor(Ue*Qe),this.setViewport(0,0,ae,Ue)},this.getCurrentViewport=function(ae){return ae.copy(X)},this.getViewport=function(ae){return ae.copy(le)},this.setViewport=function(ae,Ue,Qe,Xe){ae.isVector4?le.set(ae.x,ae.y,ae.z,ae.w):le.set(ae,Ue,Qe,Xe),wt.viewport(X.copy(le).multiplyScalar(he).round())},this.getScissor=function(ae){return ae.copy(we)},this.setScissor=function(ae,Ue,Qe,Xe){ae.isVector4?we.set(ae.x,ae.y,ae.z,ae.w):we.set(ae,Ue,Qe,Xe),wt.scissor(J.copy(we).multiplyScalar(he).round())},this.getScissorTest=function(){return We},this.setScissorTest=function(ae){wt.setScissorTest(We=ae)},this.setOpaqueSort=function(ae){be=ae},this.setTransparentSort=function(ae){Se=ae},this.getClearColor=function(ae){return ae.copy(rn.getClearColor())},this.setClearColor=function(){rn.setClearColor.apply(rn,arguments)},this.getClearAlpha=function(){return rn.getClearAlpha()},this.setClearAlpha=function(){rn.setClearAlpha.apply(rn,arguments)},this.clear=function(ae=!0,Ue=!0,Qe=!0){let Xe=0;if(ae){let Oe=!1;if(H!==null){const Ot=H.texture.format;Oe=Ot===W0||Ot===j0||Ot===H0}if(Oe){const Ot=H.texture.type,qt=Ot===aa||Ot===Rr||Ot===wl||Ot===Au||Ot===Ay||Ot===dy,ft=rn.getClearColor(),K=rn.getClearAlpha(),Ut=ft.r,bn=ft.g,fn=ft.b;qt?(w[0]=Ut,w[1]=bn,w[2]=fn,w[3]=K,oe.clearBufferuiv(oe.COLOR,0,w)):(R[0]=Ut,R[1]=bn,R[2]=fn,R[3]=K,oe.clearBufferiv(oe.COLOR,0,R))}else Xe|=oe.COLOR_BUFFER_BIT}Ue&&(Xe|=oe.DEPTH_BUFFER_BIT),Qe&&(Xe|=oe.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),oe.clear(Xe)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){t.removeEventListener("webglcontextlost",_t,!1),t.removeEventListener("webglcontextrestored",$t,!1),t.removeEventListener("webglcontextcreationerror",kt,!1),rn.dispose(),Wt.dispose(),ln.dispose(),bt.dispose(),Y.dispose(),Ce.dispose(),tt.dispose(),Mi.dispose(),me.dispose(),Vt.dispose(),rt.dispose(),rt.removeEventListener("sessionstart",Ze),rt.removeEventListener("sessionend",pt),It.stop()};function _t(ae){ae.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),z=!0}function $t(){console.log("THREE.WebGLRenderer: Context Restored."),z=!1;const ae=tn.autoReset,Ue=Kt.enabled,Qe=Kt.autoUpdate,Xe=Kt.needsUpdate,Oe=Kt.type;jt(),tn.autoReset=ae,Kt.enabled=Ue,Kt.autoUpdate=Qe,Kt.needsUpdate=Xe,Kt.type=Oe}function kt(ae){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",ae.statusMessage)}function xn(ae){const Ue=ae.target;Ue.removeEventListener("dispose",xn),qi(Ue)}function qi(ae){rr(ae),bt.remove(ae)}function rr(ae){const Ue=bt.get(ae).programs;Ue!==void 0&&(Ue.forEach(function(Qe){Vt.releaseProgram(Qe)}),ae.isShaderMaterial&&Vt.releaseShaderCache(ae))}this.renderBufferDirect=function(ae,Ue,Qe,Xe,Oe,Ot){Ue===null&&(Ue=Ge);const qt=Oe.isMesh&&Oe.matrixWorld.determinant()<0,ft=Hs(ae,Ue,Qe,Xe,Oe);wt.setMaterial(Xe,qt);let K=Qe.index,Ut=1;if(Xe.wireframe===!0){if(K=it.getWireframeAttribute(Qe),K===void 0)return;Ut=2}const bn=Qe.drawRange,fn=Qe.attributes.position;let ui=bn.start*Ut,ci=(bn.start+bn.count)*Ut;Ot!==null&&(ui=Math.max(ui,Ot.start*Ut),ci=Math.min(ci,(Ot.start+Ot.count)*Ut)),K!==null?(ui=Math.max(ui,0),ci=Math.min(ci,K.count)):fn!=null&&(ui=Math.max(ui,0),ci=Math.min(ci,fn.count));const _i=ci-ui;if(_i<0||_i===1/0)return;Mi.setup(Oe,Xe,ft,Qe,K);let Q,Ln=Ft;if(K!==null&&(Q=$e.get(K),Ln=Gt,Ln.setIndex(Q)),Oe.isMesh)Xe.wireframe===!0?(wt.setLineWidth(Xe.wireframeLinewidth*ke()),Ln.setMode(oe.LINES)):Ln.setMode(oe.TRIANGLES);else if(Oe.isLine){let mn=Xe.linewidth;mn===void 0&&(mn=1),wt.setLineWidth(mn*ke()),Oe.isLineSegments?Ln.setMode(oe.LINES):Oe.isLineLoop?Ln.setMode(oe.LINE_LOOP):Ln.setMode(oe.LINE_STRIP)}else Oe.isPoints?Ln.setMode(oe.POINTS):Oe.isSprite&&Ln.setMode(oe.TRIANGLES);if(Oe.isBatchedMesh)if(Oe._multiDrawInstances!==null)Ln.renderMultiDrawInstances(Oe._multiDrawStarts,Oe._multiDrawCounts,Oe._multiDrawCount,Oe._multiDrawInstances);else if(lt.get("WEBGL_multi_draw"))Ln.renderMultiDraw(Oe._multiDrawStarts,Oe._multiDrawCounts,Oe._multiDrawCount);else{const mn=Oe._multiDrawStarts,yr=Oe._multiDrawCounts,hi=Oe._multiDrawCount,bs=K?$e.get(K).bytesPerElement:1,fa=bt.get(Xe).currentProgram.getUniforms();for(let ve=0;ve{function Ot(){if(Xe.forEach(function(qt){bt.get(qt).currentProgram.isReady()&&Xe.delete(qt)}),Xe.size===0){Oe(ae);return}setTimeout(Ot,10)}lt.get("KHR_parallel_shader_compile")!==null?Ot():setTimeout(Ot,10)})};let $i=null;function Jr(ae){$i&&$i(ae)}function Ze(){It.stop()}function pt(){It.start()}const It=new oD;It.setAnimationLoop(Jr),typeof self<"u"&&It.setContext(self),this.setAnimationLoop=function(ae){$i=ae,rt.setAnimationLoop(ae),ae===null?It.stop():It.start()},rt.addEventListener("sessionstart",Ze),rt.addEventListener("sessionend",pt),this.render=function(ae,Ue){if(Ue!==void 0&&Ue.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(z===!0)return;if(ae.matrixWorldAutoUpdate===!0&&ae.updateMatrixWorld(),Ue.parent===null&&Ue.matrixWorldAutoUpdate===!0&&Ue.updateMatrixWorld(),rt.enabled===!0&&rt.isPresenting===!0&&(rt.cameraAutoUpdate===!0&&rt.updateCamera(Ue),Ue=rt.getCamera()),ae.isScene===!0&&ae.onBeforeRender(O,ae,Ue,H),E=ln.get(ae,L.length),E.init(Ue),L.push(E),dt.multiplyMatrices(Ue.projectionMatrix,Ue.matrixWorldInverse),Te.setFromProjectionMatrix(dt),_e=this.localClippingEnabled,ze=St.init(this.clippingPlanes,_e),C=Wt.get(ae,B.length),C.init(),B.push(C),rt.enabled===!0&&rt.isPresenting===!0){const Ot=O.xr.getDepthSensingMesh();Ot!==null&&at(Ot,Ue,-1/0,O.sortObjects)}at(ae,Ue,0,O.sortObjects),C.finish(),O.sortObjects===!0&&C.sort(be,Se),Be=rt.enabled===!1||rt.isPresenting===!1||rt.hasDepthSensing()===!1,Be&&rn.addToRenderList(C,ae),this.info.render.frame++,ze===!0&&St.beginShadows();const Qe=E.state.shadowsArray;Kt.render(Qe,ae,Ue),ze===!0&&St.endShadows(),this.info.autoReset===!0&&this.info.reset();const Xe=C.opaque,Oe=C.transmissive;if(E.setupLights(),Ue.isArrayCamera){const Ot=Ue.cameras;if(Oe.length>0)for(let qt=0,ft=Ot.length;qt0&&ee(Xe,Oe,ae,Ue),Be&&rn.render(ae),d(C,ae,Ue);H!==null&&k===0&&(fe.updateMultisampleRenderTarget(H),fe.updateRenderTargetMipmap(H)),ae.isScene===!0&&ae.onAfterRender(O,ae,Ue),Mi.resetDefaultState(),F=-1,V=null,L.pop(),L.length>0?(E=L[L.length-1],ze===!0&&St.setGlobalState(O.clippingPlanes,E.state.camera)):E=null,B.pop(),B.length>0?C=B[B.length-1]:C=null};function at(ae,Ue,Qe,Xe){if(ae.visible===!1)return;if(ae.layers.test(Ue.layers)){if(ae.isGroup)Qe=ae.renderOrder;else if(ae.isLOD)ae.autoUpdate===!0&&ae.update(Ue);else if(ae.isLight)E.pushLight(ae),ae.castShadow&&E.pushShadow(ae);else if(ae.isSprite){if(!ae.frustumCulled||Te.intersectsSprite(ae)){Xe&&Tt.setFromMatrixPosition(ae.matrixWorld).applyMatrix4(dt);const qt=tt.update(ae),ft=ae.material;ft.visible&&C.push(ae,qt,ft,Qe,Tt.z,null)}}else if((ae.isMesh||ae.isLine||ae.isPoints)&&(!ae.frustumCulled||Te.intersectsObject(ae))){const qt=tt.update(ae),ft=ae.material;if(Xe&&(ae.boundingSphere!==void 0?(ae.boundingSphere===null&&ae.computeBoundingSphere(),Tt.copy(ae.boundingSphere.center)):(qt.boundingSphere===null&&qt.computeBoundingSphere(),Tt.copy(qt.boundingSphere.center)),Tt.applyMatrix4(ae.matrixWorld).applyMatrix4(dt)),Array.isArray(ft)){const K=qt.groups;for(let Ut=0,bn=K.length;Ut0&&$n(Oe,Ue,Qe),Ot.length>0&&$n(Ot,Ue,Qe),qt.length>0&&$n(qt,Ue,Qe),wt.buffers.depth.setTest(!0),wt.buffers.depth.setMask(!0),wt.buffers.color.setMask(!0),wt.setPolygonOffset(!1)}function ee(ae,Ue,Qe,Xe){if((Qe.isScene===!0?Qe.overrideMaterial:null)!==null)return;E.state.transmissionRenderTarget[Xe.id]===void 0&&(E.state.transmissionRenderTarget[Xe.id]=new qh(1,1,{generateMipmaps:!0,type:lt.has("EXT_color_buffer_half_float")||lt.has("EXT_color_buffer_float")?Gs:aa,minFilter:Va,samples:4,stencilBuffer:s,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:ai.workingColorSpace}));const Ot=E.state.transmissionRenderTarget[Xe.id],qt=Xe.viewport||X;Ot.setSize(qt.z*O.transmissionResolutionScale,qt.w*O.transmissionResolutionScale);const ft=O.getRenderTarget();O.setRenderTarget(Ot),O.getClearColor(se),ne=O.getClearAlpha(),ne<1&&O.setClearColor(16777215,.5),O.clear(),Be&&rn.render(Qe);const K=O.toneMapping;O.toneMapping=Za;const Ut=Xe.viewport;if(Xe.viewport!==void 0&&(Xe.viewport=void 0),E.setupLightsView(Xe),ze===!0&&St.setGlobalState(O.clippingPlanes,Xe),$n(ae,Qe,Xe),fe.updateMultisampleRenderTarget(Ot),fe.updateRenderTargetMipmap(Ot),lt.has("WEBGL_multisampled_render_to_texture")===!1){let bn=!1;for(let fn=0,ui=Ue.length;fn0),fn=!!Qe.morphAttributes.position,ui=!!Qe.morphAttributes.normal,ci=!!Qe.morphAttributes.color;let _i=Za;Xe.toneMapped&&(H===null||H.isXRRenderTarget===!0)&&(_i=O.toneMapping);const Q=Qe.morphAttributes.position||Qe.morphAttributes.normal||Qe.morphAttributes.color,Ln=Q!==void 0?Q.length:0,mn=bt.get(Xe),yr=E.state.lights;if(ze===!0&&(_e===!0||ae!==V)){const Yn=ae===V&&Xe.id===F;St.setState(Xe,ae,Yn)}let hi=!1;Xe.version===mn.__version?(mn.needsLights&&mn.lightsStateVersion!==yr.state.version||mn.outputColorSpace!==ft||Oe.isBatchedMesh&&mn.batching===!1||!Oe.isBatchedMesh&&mn.batching===!0||Oe.isBatchedMesh&&mn.batchingColor===!0&&Oe.colorTexture===null||Oe.isBatchedMesh&&mn.batchingColor===!1&&Oe.colorTexture!==null||Oe.isInstancedMesh&&mn.instancing===!1||!Oe.isInstancedMesh&&mn.instancing===!0||Oe.isSkinnedMesh&&mn.skinning===!1||!Oe.isSkinnedMesh&&mn.skinning===!0||Oe.isInstancedMesh&&mn.instancingColor===!0&&Oe.instanceColor===null||Oe.isInstancedMesh&&mn.instancingColor===!1&&Oe.instanceColor!==null||Oe.isInstancedMesh&&mn.instancingMorph===!0&&Oe.morphTexture===null||Oe.isInstancedMesh&&mn.instancingMorph===!1&&Oe.morphTexture!==null||mn.envMap!==K||Xe.fog===!0&&mn.fog!==Ot||mn.numClippingPlanes!==void 0&&(mn.numClippingPlanes!==St.numPlanes||mn.numIntersection!==St.numIntersection)||mn.vertexAlphas!==Ut||mn.vertexTangents!==bn||mn.morphTargets!==fn||mn.morphNormals!==ui||mn.morphColors!==ci||mn.toneMapping!==_i||mn.morphTargetsCount!==Ln)&&(hi=!0):(hi=!0,mn.__version=Xe.version);let bs=mn.currentProgram;hi===!0&&(bs=Xn(Xe,Ue,Oe));let fa=!1,ve=!1,ot=!1;const Rt=bs.getUniforms(),Zt=mn.uniforms;if(wt.useProgram(bs.program)&&(fa=!0,ve=!0,ot=!0),Xe.id!==F&&(F=Xe.id,ve=!0),fa||V!==ae){wt.buffers.depth.getReversed()?(De.copy(ae.projectionMatrix),Tk(De),wk(De),Rt.setValue(oe,"projectionMatrix",De)):Rt.setValue(oe,"projectionMatrix",ae.projectionMatrix),Rt.setValue(oe,"viewMatrix",ae.matrixWorldInverse);const yi=Rt.map.cameraPosition;yi!==void 0&&yi.setValue(oe,vt.setFromMatrixPosition(ae.matrixWorld)),Dt.logarithmicDepthBuffer&&Rt.setValue(oe,"logDepthBufFC",2/(Math.log(ae.far+1)/Math.LN2)),(Xe.isMeshPhongMaterial||Xe.isMeshToonMaterial||Xe.isMeshLambertMaterial||Xe.isMeshBasicMaterial||Xe.isMeshStandardMaterial||Xe.isShaderMaterial)&&Rt.setValue(oe,"isOrthographic",ae.isOrthographicCamera===!0),V!==ae&&(V=ae,ve=!0,ot=!0)}if(Oe.isSkinnedMesh){Rt.setOptional(oe,Oe,"bindMatrix"),Rt.setOptional(oe,Oe,"bindMatrixInverse");const Yn=Oe.skeleton;Yn&&(Yn.boneTexture===null&&Yn.computeBoneTexture(),Rt.setValue(oe,"boneTexture",Yn.boneTexture,fe))}Oe.isBatchedMesh&&(Rt.setOptional(oe,Oe,"batchingTexture"),Rt.setValue(oe,"batchingTexture",Oe._matricesTexture,fe),Rt.setOptional(oe,Oe,"batchingIdTexture"),Rt.setValue(oe,"batchingIdTexture",Oe._indirectTexture,fe),Rt.setOptional(oe,Oe,"batchingColorTexture"),Oe._colorsTexture!==null&&Rt.setValue(oe,"batchingColorTexture",Oe._colorsTexture,fe));const cn=Qe.morphAttributes;if((cn.position!==void 0||cn.normal!==void 0||cn.color!==void 0)&&Ht.update(Oe,Qe,bs),(ve||mn.receiveShadow!==Oe.receiveShadow)&&(mn.receiveShadow=Oe.receiveShadow,Rt.setValue(oe,"receiveShadow",Oe.receiveShadow)),Xe.isMeshGouraudMaterial&&Xe.envMap!==null&&(Zt.envMap.value=K,Zt.flipEnvMap.value=K.isCubeTexture&&K.isRenderTargetTexture===!1?-1:1),Xe.isMeshStandardMaterial&&Xe.envMap===null&&Ue.environment!==null&&(Zt.envMapIntensity.value=Ue.environmentIntensity),ve&&(Rt.setValue(oe,"toneMappingExposure",O.toneMappingExposure),mn.needsLights&&li(Zt,ot),Ot&&Xe.fog===!0&&Bt.refreshFogUniforms(Zt,Ot),Bt.refreshMaterialUniforms(Zt,Xe,he,ue,E.state.transmissionRenderTarget[ae.id]),qv.upload(oe,un(mn),Zt,fe)),Xe.isShaderMaterial&&Xe.uniformsNeedUpdate===!0&&(qv.upload(oe,un(mn),Zt,fe),Xe.uniformsNeedUpdate=!1),Xe.isSpriteMaterial&&Rt.setValue(oe,"center",Oe.center),Rt.setValue(oe,"modelViewMatrix",Oe.modelViewMatrix),Rt.setValue(oe,"normalMatrix",Oe.normalMatrix),Rt.setValue(oe,"modelMatrix",Oe.matrixWorld),Xe.isShaderMaterial||Xe.isRawShaderMaterial){const Yn=Xe.uniformsGroups;for(let yi=0,js=Yn.length;yi0&&fe.useMultisampledRTT(ae)===!1?Oe=bt.get(ae).__webglMultisampledFramebuffer:Array.isArray(bn)?Oe=bn[Qe]:Oe=bn,X.copy(ae.viewport),J.copy(ae.scissor),te=ae.scissorTest}else X.copy(le).multiplyScalar(he).floor(),J.copy(we).multiplyScalar(he).floor(),te=We;if(Qe!==0&&(Oe=cs),wt.bindFramebuffer(oe.FRAMEBUFFER,Oe)&&Xe&&wt.drawBuffers(ae,Oe),wt.viewport(X),wt.scissor(J),wt.setScissorTest(te),Ot){const K=bt.get(ae.texture);oe.framebufferTexture2D(oe.FRAMEBUFFER,oe.COLOR_ATTACHMENT0,oe.TEXTURE_CUBE_MAP_POSITIVE_X+Ue,K.__webglTexture,Qe)}else if(qt){const K=bt.get(ae.texture),Ut=Ue;oe.framebufferTextureLayer(oe.FRAMEBUFFER,oe.COLOR_ATTACHMENT0,K.__webglTexture,Qe,Ut)}else if(ae!==null&&Qe!==0){const K=bt.get(ae.texture);oe.framebufferTexture2D(oe.FRAMEBUFFER,oe.COLOR_ATTACHMENT0,oe.TEXTURE_2D,K.__webglTexture,Qe)}F=-1},this.readRenderTargetPixels=function(ae,Ue,Qe,Xe,Oe,Ot,qt){if(!(ae&&ae.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let ft=bt.get(ae).__webglFramebuffer;if(ae.isWebGLCubeRenderTarget&&qt!==void 0&&(ft=ft[qt]),ft){wt.bindFramebuffer(oe.FRAMEBUFFER,ft);try{const K=ae.texture,Ut=K.format,bn=K.type;if(!Dt.textureFormatReadable(Ut)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!Dt.textureTypeReadable(bn)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}Ue>=0&&Ue<=ae.width-Xe&&Qe>=0&&Qe<=ae.height-Oe&&oe.readPixels(Ue,Qe,Xe,Oe,In.convert(Ut),In.convert(bn),Ot)}finally{const K=H!==null?bt.get(H).__webglFramebuffer:null;wt.bindFramebuffer(oe.FRAMEBUFFER,K)}}},this.readRenderTargetPixelsAsync=async function(ae,Ue,Qe,Xe,Oe,Ot,qt){if(!(ae&&ae.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let ft=bt.get(ae).__webglFramebuffer;if(ae.isWebGLCubeRenderTarget&&qt!==void 0&&(ft=ft[qt]),ft){const K=ae.texture,Ut=K.format,bn=K.type;if(!Dt.textureFormatReadable(Ut))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!Dt.textureTypeReadable(bn))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");if(Ue>=0&&Ue<=ae.width-Xe&&Qe>=0&&Qe<=ae.height-Oe){wt.bindFramebuffer(oe.FRAMEBUFFER,ft);const fn=oe.createBuffer();oe.bindBuffer(oe.PIXEL_PACK_BUFFER,fn),oe.bufferData(oe.PIXEL_PACK_BUFFER,Ot.byteLength,oe.STREAM_READ),oe.readPixels(Ue,Qe,Xe,Oe,In.convert(Ut),In.convert(bn),0);const ui=H!==null?bt.get(H).__webglFramebuffer:null;wt.bindFramebuffer(oe.FRAMEBUFFER,ui);const ci=oe.fenceSync(oe.SYNC_GPU_COMMANDS_COMPLETE,0);return oe.flush(),await Sk(oe,ci,4),oe.bindBuffer(oe.PIXEL_PACK_BUFFER,fn),oe.getBufferSubData(oe.PIXEL_PACK_BUFFER,0,Ot),oe.deleteBuffer(fn),oe.deleteSync(ci),Ot}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")}},this.copyFramebufferToTexture=function(ae,Ue=null,Qe=0){ae.isTexture!==!0&&(kf("WebGLRenderer: copyFramebufferToTexture function signature has changed."),Ue=arguments[0]||null,ae=arguments[1]);const Xe=Math.pow(2,-Qe),Oe=Math.floor(ae.image.width*Xe),Ot=Math.floor(ae.image.height*Xe),qt=Ue!==null?Ue.x:0,ft=Ue!==null?Ue.y:0;fe.setTexture2D(ae,0),oe.copyTexSubImage2D(oe.TEXTURE_2D,Qe,0,0,qt,ft,Oe,Ot),wt.unbindTexture()};const Ma=oe.createFramebuffer(),Ul=oe.createFramebuffer();this.copyTextureToTexture=function(ae,Ue,Qe=null,Xe=null,Oe=0,Ot=null){ae.isTexture!==!0&&(kf("WebGLRenderer: copyTextureToTexture function signature has changed."),Xe=arguments[0]||null,ae=arguments[1],Ue=arguments[2],Ot=arguments[3]||0,Qe=null),Ot===null&&(Oe!==0?(kf("WebGLRenderer: copyTextureToTexture function signature has changed to support src and dst mipmap levels."),Ot=Oe,Oe=0):Ot=0);let qt,ft,K,Ut,bn,fn,ui,ci,_i;const Q=ae.isCompressedTexture?ae.mipmaps[Ot]:ae.image;if(Qe!==null)qt=Qe.max.x-Qe.min.x,ft=Qe.max.y-Qe.min.y,K=Qe.isBox3?Qe.max.z-Qe.min.z:1,Ut=Qe.min.x,bn=Qe.min.y,fn=Qe.isBox3?Qe.min.z:0;else{const cn=Math.pow(2,-Oe);qt=Math.floor(Q.width*cn),ft=Math.floor(Q.height*cn),ae.isDataArrayTexture?K=Q.depth:ae.isData3DTexture?K=Math.floor(Q.depth*cn):K=1,Ut=0,bn=0,fn=0}Xe!==null?(ui=Xe.x,ci=Xe.y,_i=Xe.z):(ui=0,ci=0,_i=0);const Ln=In.convert(Ue.format),mn=In.convert(Ue.type);let yr;Ue.isData3DTexture?(fe.setTexture3D(Ue,0),yr=oe.TEXTURE_3D):Ue.isDataArrayTexture||Ue.isCompressedArrayTexture?(fe.setTexture2DArray(Ue,0),yr=oe.TEXTURE_2D_ARRAY):(fe.setTexture2D(Ue,0),yr=oe.TEXTURE_2D),oe.pixelStorei(oe.UNPACK_FLIP_Y_WEBGL,Ue.flipY),oe.pixelStorei(oe.UNPACK_PREMULTIPLY_ALPHA_WEBGL,Ue.premultiplyAlpha),oe.pixelStorei(oe.UNPACK_ALIGNMENT,Ue.unpackAlignment);const hi=oe.getParameter(oe.UNPACK_ROW_LENGTH),bs=oe.getParameter(oe.UNPACK_IMAGE_HEIGHT),fa=oe.getParameter(oe.UNPACK_SKIP_PIXELS),ve=oe.getParameter(oe.UNPACK_SKIP_ROWS),ot=oe.getParameter(oe.UNPACK_SKIP_IMAGES);oe.pixelStorei(oe.UNPACK_ROW_LENGTH,Q.width),oe.pixelStorei(oe.UNPACK_IMAGE_HEIGHT,Q.height),oe.pixelStorei(oe.UNPACK_SKIP_PIXELS,Ut),oe.pixelStorei(oe.UNPACK_SKIP_ROWS,bn),oe.pixelStorei(oe.UNPACK_SKIP_IMAGES,fn);const Rt=ae.isDataArrayTexture||ae.isData3DTexture,Zt=Ue.isDataArrayTexture||Ue.isData3DTexture;if(ae.isDepthTexture){const cn=bt.get(ae),Yn=bt.get(Ue),yi=bt.get(cn.__renderTarget),js=bt.get(Yn.__renderTarget);wt.bindFramebuffer(oe.READ_FRAMEBUFFER,yi.__webglFramebuffer),wt.bindFramebuffer(oe.DRAW_FRAMEBUFFER,js.__webglFramebuffer);for(let pi=0;pi=-1&&_d.z<=1&&w.layers.test(C.layers)===!0,B=w.element;B.style.display=E===!0?"":"none",E===!0&&(w.onBeforeRender(t,R,C),B.style.transform="translate("+-100*w.center.x+"%,"+-100*w.center.y+"%)translate("+(_d.x*s+s)+"px,"+(-_d.y*a+a)+"px)",B.parentNode!==u&&u.appendChild(B),w.onAfterRender(t,R,C));const L={distanceToCameraSquared:v(C,w)};l.objects.set(w,L)}for(let E=0,B=w.children.length;E=e||k<0||v&&H>=s}function E(){var G=P3();if(C(G))return B(G);l=setTimeout(E,R(G))}function B(G){return l=void 0,x&&n?S(G):(n=r=void 0,a)}function L(){l!==void 0&&clearTimeout(l),h=0,n=u=r=l=void 0}function O(){return l===void 0?a:B(P3())}function z(){var G=P3(),k=C(G);if(n=arguments,r=this,u=G,k){if(l===void 0)return w(u);if(v)return clearTimeout(l),l=setTimeout(E,e),S(u)}return l===void 0&&(l=setTimeout(E,e)),a}return z.cancel=L,z.flush=O,z}function l6(i,e){(e==null||e>i.length)&&(e=i.length);for(var t=0,n=Array(e);t=0&&(O[De]=null,L[De].disconnect(_e))}for(let ze=0;ze=O.length){O.push(_e),De=_t;break}else if(O[_t]===null){O[_t]=_e,De=_t;break}if(De===-1)break}const pt=L[De];pt&&pt.connect(_e)}}const Z=new ce,ue=new ce;function he(Te,ze,_e){Z.setFromMatrixPosition(ze.matrixWorld),ue.setFromMatrixPosition(_e.matrixWorld);const De=Z.distanceTo(ue),pt=ze.projectionMatrix.elements,_t=_e.projectionMatrix.elements,wt=pt[14]/(pt[10]-1),Ge=pt[14]/(pt[10]+1),Be=(pt[9]+1)/pt[5],ke=(pt[9]-1)/pt[5],oe=(pt[8]-1)/pt[0],Mt=(_t[8]+1)/_t[0],lt=wt*oe,Dt=wt*Mt,ut=De/(-oe+Mt),en=ut*-oe;if(ze.matrixWorld.decompose(Te.position,Te.quaternion,Te.scale),Te.translateX(en),Te.translateZ(ut),Te.matrixWorld.compose(Te.position,Te.quaternion,Te.scale),Te.matrixWorldInverse.copy(Te.matrixWorld).invert(),pt[10]===-1)Te.projectionMatrix.copy(ze.projectionMatrix),Te.projectionMatrixInverse.copy(ze.projectionMatrixInverse);else{const St=wt+ut,fe=Ge+ut,Y=lt-en,Ce=Dt+(De-en),$e=Be*Ge/fe*St,it=ke*Ge/fe*St;Te.projectionMatrix.makePerspective(Y,Ce,$e,it,St,fe),Te.projectionMatrixInverse.copy(Te.projectionMatrix).invert()}}function be(Te,ze){ze===null?Te.matrixWorld.copy(Te.matrix):Te.matrixWorld.multiplyMatrices(ze.matrixWorld,Te.matrix),Te.matrixWorldInverse.copy(Te.matrixWorld).invert()}this.updateCamera=function(Te){if(r===null)return;let ze=Te.near,_e=Te.far;R.texture!==null&&(R.depthNear>0&&(ze=R.depthNear),R.depthFar>0&&(_e=R.depthFar)),V.near=H.near=k.near=ze,V.far=H.far=k.far=_e,(X!==V.near||J!==V.far)&&(r.updateRenderState({depthNear:V.near,depthFar:V.far}),X=V.near,J=V.far),k.layers.mask=Te.layers.mask|2,H.layers.mask=Te.layers.mask|4,V.layers.mask=k.layers.mask|H.layers.mask;const De=Te.parent,pt=V.cameras;be(V,De);for(let _t=0;_t0&&(C.alphaTest.value=E.alphaTest);const B=e.get(E),L=B.envMap,O=B.envMapRotation;L&&(C.envMap.value=L,wf.copy(O),wf.x*=-1,wf.y*=-1,wf.z*=-1,L.isCubeTexture&&L.isRenderTargetTexture===!1&&(wf.y*=-1,wf.z*=-1),C.envMapRotation.value.setFromMatrix4(Nj.makeRotationFromEuler(wf)),C.flipEnvMap.value=L.isCubeTexture&&L.isRenderTargetTexture===!1?-1:1,C.reflectivity.value=E.reflectivity,C.ior.value=E.ior,C.refractionRatio.value=E.refractionRatio),E.lightMap&&(C.lightMap.value=E.lightMap,C.lightMapIntensity.value=E.lightMapIntensity,t(E.lightMap,C.lightMapTransform)),E.aoMap&&(C.aoMap.value=E.aoMap,C.aoMapIntensity.value=E.aoMapIntensity,t(E.aoMap,C.aoMapTransform))}function a(C,E){C.diffuse.value.copy(E.color),C.opacity.value=E.opacity,E.map&&(C.map.value=E.map,t(E.map,C.mapTransform))}function l(C,E){C.dashSize.value=E.dashSize,C.totalSize.value=E.dashSize+E.gapSize,C.scale.value=E.scale}function u(C,E,B,L){C.diffuse.value.copy(E.color),C.opacity.value=E.opacity,C.size.value=E.size*B,C.scale.value=L*.5,E.map&&(C.map.value=E.map,t(E.map,C.uvTransform)),E.alphaMap&&(C.alphaMap.value=E.alphaMap,t(E.alphaMap,C.alphaMapTransform)),E.alphaTest>0&&(C.alphaTest.value=E.alphaTest)}function h(C,E){C.diffuse.value.copy(E.color),C.opacity.value=E.opacity,C.rotation.value=E.rotation,E.map&&(C.map.value=E.map,t(E.map,C.mapTransform)),E.alphaMap&&(C.alphaMap.value=E.alphaMap,t(E.alphaMap,C.alphaMapTransform)),E.alphaTest>0&&(C.alphaTest.value=E.alphaTest)}function g(C,E){C.specular.value.copy(E.specular),C.shininess.value=Math.max(E.shininess,1e-4)}function v(C,E){E.gradientMap&&(C.gradientMap.value=E.gradientMap)}function x(C,E){C.metalness.value=E.metalness,E.metalnessMap&&(C.metalnessMap.value=E.metalnessMap,t(E.metalnessMap,C.metalnessMapTransform)),C.roughness.value=E.roughness,E.roughnessMap&&(C.roughnessMap.value=E.roughnessMap,t(E.roughnessMap,C.roughnessMapTransform)),E.envMap&&(C.envMapIntensity.value=E.envMapIntensity)}function S(C,E,B){C.ior.value=E.ior,E.sheen>0&&(C.sheenColor.value.copy(E.sheenColor).multiplyScalar(E.sheen),C.sheenRoughness.value=E.sheenRoughness,E.sheenColorMap&&(C.sheenColorMap.value=E.sheenColorMap,t(E.sheenColorMap,C.sheenColorMapTransform)),E.sheenRoughnessMap&&(C.sheenRoughnessMap.value=E.sheenRoughnessMap,t(E.sheenRoughnessMap,C.sheenRoughnessMapTransform))),E.clearcoat>0&&(C.clearcoat.value=E.clearcoat,C.clearcoatRoughness.value=E.clearcoatRoughness,E.clearcoatMap&&(C.clearcoatMap.value=E.clearcoatMap,t(E.clearcoatMap,C.clearcoatMapTransform)),E.clearcoatRoughnessMap&&(C.clearcoatRoughnessMap.value=E.clearcoatRoughnessMap,t(E.clearcoatRoughnessMap,C.clearcoatRoughnessMapTransform)),E.clearcoatNormalMap&&(C.clearcoatNormalMap.value=E.clearcoatNormalMap,t(E.clearcoatNormalMap,C.clearcoatNormalMapTransform),C.clearcoatNormalScale.value.copy(E.clearcoatNormalScale),E.side===hr&&C.clearcoatNormalScale.value.negate())),E.dispersion>0&&(C.dispersion.value=E.dispersion),E.iridescence>0&&(C.iridescence.value=E.iridescence,C.iridescenceIOR.value=E.iridescenceIOR,C.iridescenceThicknessMinimum.value=E.iridescenceThicknessRange[0],C.iridescenceThicknessMaximum.value=E.iridescenceThicknessRange[1],E.iridescenceMap&&(C.iridescenceMap.value=E.iridescenceMap,t(E.iridescenceMap,C.iridescenceMapTransform)),E.iridescenceThicknessMap&&(C.iridescenceThicknessMap.value=E.iridescenceThicknessMap,t(E.iridescenceThicknessMap,C.iridescenceThicknessMapTransform))),E.transmission>0&&(C.transmission.value=E.transmission,C.transmissionSamplerMap.value=B.texture,C.transmissionSamplerSize.value.set(B.width,B.height),E.transmissionMap&&(C.transmissionMap.value=E.transmissionMap,t(E.transmissionMap,C.transmissionMapTransform)),C.thickness.value=E.thickness,E.thicknessMap&&(C.thicknessMap.value=E.thicknessMap,t(E.thicknessMap,C.thicknessMapTransform)),C.attenuationDistance.value=E.attenuationDistance,C.attenuationColor.value.copy(E.attenuationColor)),E.anisotropy>0&&(C.anisotropyVector.value.set(E.anisotropy*Math.cos(E.anisotropyRotation),E.anisotropy*Math.sin(E.anisotropyRotation)),E.anisotropyMap&&(C.anisotropyMap.value=E.anisotropyMap,t(E.anisotropyMap,C.anisotropyMapTransform))),C.specularIntensity.value=E.specularIntensity,C.specularColor.value.copy(E.specularColor),E.specularColorMap&&(C.specularColorMap.value=E.specularColorMap,t(E.specularColorMap,C.specularColorMapTransform)),E.specularIntensityMap&&(C.specularIntensityMap.value=E.specularIntensityMap,t(E.specularIntensityMap,C.specularIntensityMapTransform))}function w(C,E){E.matcap&&(C.matcap.value=E.matcap)}function R(C,E){const B=e.get(E).light;C.referencePosition.value.setFromMatrixPosition(B.matrixWorld),C.nearDistance.value=B.shadow.camera.near,C.farDistance.value=B.shadow.camera.far}return{refreshFogUniforms:n,refreshMaterialUniforms:r}}function Pj(i,e,t,n){let r={},s={},a=[];const l=i.getParameter(i.MAX_UNIFORM_BUFFER_BINDINGS);function u(B,L){const O=L.program;n.uniformBlockBinding(B,O)}function h(B,L){let O=r[B.id];O===void 0&&(w(B),O=g(B),r[B.id]=O,B.addEventListener("dispose",C));const z=L.program;n.updateUBOMapping(B,z);const G=e.render.frame;s[B.id]!==G&&(x(B),s[B.id]=G)}function g(B){const L=v();B.__bindingPointIndex=L;const O=i.createBuffer(),z=B.__size,G=B.usage;return i.bindBuffer(i.UNIFORM_BUFFER,O),i.bufferData(i.UNIFORM_BUFFER,z,G),i.bindBuffer(i.UNIFORM_BUFFER,null),i.bindBufferBase(i.UNIFORM_BUFFER,L,O),O}function v(){for(let B=0;B0&&(O+=z-G),B.__size=O,B.__cache={},this}function R(B){const L={boundary:0,storage:0};return typeof B=="number"||typeof B=="boolean"?(L.boundary=4,L.storage=4):B.isVector2?(L.boundary=8,L.storage=8):B.isVector3||B.isColor?(L.boundary=16,L.storage=12):B.isVector4?(L.boundary=16,L.storage=16):B.isMatrix3?(L.boundary=48,L.storage=48):B.isMatrix4?(L.boundary=64,L.storage=64):B.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",B),L}function C(B){const L=B.target;L.removeEventListener("dispose",C);const O=a.indexOf(L.__bindingPointIndex);a.splice(O,1),i.deleteBuffer(r[L.id]),delete r[L.id],delete s[L.id]}function E(){for(const B in r)i.deleteBuffer(r[B]);a=[],r={},s={}}return{bind:u,update:h,dispose:E}}class Lj{constructor(e={}){const{canvas:t=I7(),context:n=null,depth:r=!0,stencil:s=!1,alpha:a=!1,antialias:l=!1,premultipliedAlpha:u=!0,preserveDrawingBuffer:h=!1,powerPreference:g="default",failIfMajorPerformanceCaveat:v=!1,reverseDepthBuffer:x=!1}=e;this.isWebGLRenderer=!0;let S;if(n!==null){if(typeof WebGLRenderingContext<"u"&&n instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");S=n.getContextAttributes().alpha}else S=a;const w=new Uint32Array(4),R=new Int32Array(4);let C=null,E=null;const B=[],L=[];this.domElement=t,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this._outputColorSpace=_n,this.toneMapping=Za,this.toneMappingExposure=1;const O=this;let z=!1,G=0,k=0,H=null,F=-1,V=null;const X=new Pn,J=new Pn;let te=null;const se=new sn(0);let ne=0,Z=t.width,ue=t.height,he=1,be=null,Se=null;const le=new Pn(0,0,Z,ue),we=new Pn(0,0,Z,ue);let We=!1;const Te=new Fg;let ze=!1,_e=!1;this.transmissionResolutionScale=1;const De=new kn,pt=new kn,_t=new ce,wt=new Pn,Ge={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let Be=!1;function ke(){return H===null?he:1}let oe=n;function Mt(ae,Ue){return t.getContext(ae,Ue)}try{const ae={alpha:!0,depth:r,stencil:s,antialias:l,premultipliedAlpha:u,preserveDrawingBuffer:h,powerPreference:g,failIfMajorPerformanceCaveat:v};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${V0}`),t.addEventListener("webglcontextlost",yt,!1),t.addEventListener("webglcontextrestored",$t,!1),t.addEventListener("webglcontextcreationerror",kt,!1),oe===null){const Ue="webgl2";if(oe=Mt(Ue,ae),oe===null)throw Mt(Ue)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(ae){throw console.error("THREE.WebGLRenderer: "+ae.message),ae}let lt,Dt,ut,en,St,fe,Y,Ce,$e,it,tt,Vt,Bt,Wt,ln,Tt,Kt,rn,Ht,Ft,Gt,In,Mi,me;function jt(){lt=new qV(oe),lt.init(),In=new Tj(oe,lt),Dt=new OV(oe,lt,e,In),ut=new bj(oe,lt),Dt.reverseDepthBuffer&&x&&ut.buffers.depth.setReversed(!0),en=new jV(oe),St=new uj,fe=new Sj(oe,lt,ut,St,Dt,In,en),Y=new FV(O),Ce=new GV(O),$e=new Zz(oe),Mi=new UV(oe,$e),it=new VV(oe,$e,en,Mi),tt=new $V(oe,it,$e,en),Ht=new WV(oe,Dt,fe),Tt=new IV(St),Vt=new lj(O,Y,Ce,lt,Dt,Mi,Tt),Bt=new Dj(O,St),Wt=new hj,ln=new gj(lt),rn=new LV(O,Y,Ce,ut,tt,S,u),Kt=new yj(O,tt,Dt),me=new Pj(oe,en,Dt,ut),Ft=new BV(oe,lt,en),Gt=new HV(oe,lt,en),en.programs=Vt.programs,O.capabilities=Dt,O.extensions=lt,O.properties=St,O.renderLists=Wt,O.shadowMap=Kt,O.state=ut,O.info=en}jt();const rt=new Rj(O,oe);this.xr=rt,this.getContext=function(){return oe},this.getContextAttributes=function(){return oe.getContextAttributes()},this.forceContextLoss=function(){const ae=lt.get("WEBGL_lose_context");ae&&ae.loseContext()},this.forceContextRestore=function(){const ae=lt.get("WEBGL_lose_context");ae&&ae.restoreContext()},this.getPixelRatio=function(){return he},this.setPixelRatio=function(ae){ae!==void 0&&(he=ae,this.setSize(Z,ue,!1))},this.getSize=function(ae){return ae.set(Z,ue)},this.setSize=function(ae,Ue,Qe=!0){if(rt.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}Z=ae,ue=Ue,t.width=Math.floor(ae*he),t.height=Math.floor(Ue*he),Qe===!0&&(t.style.width=ae+"px",t.style.height=Ue+"px"),this.setViewport(0,0,ae,Ue)},this.getDrawingBufferSize=function(ae){return ae.set(Z*he,ue*he).floor()},this.setDrawingBufferSize=function(ae,Ue,Qe){Z=ae,ue=Ue,he=Qe,t.width=Math.floor(ae*Qe),t.height=Math.floor(Ue*Qe),this.setViewport(0,0,ae,Ue)},this.getCurrentViewport=function(ae){return ae.copy(X)},this.getViewport=function(ae){return ae.copy(le)},this.setViewport=function(ae,Ue,Qe,Xe){ae.isVector4?le.set(ae.x,ae.y,ae.z,ae.w):le.set(ae,Ue,Qe,Xe),ut.viewport(X.copy(le).multiplyScalar(he).round())},this.getScissor=function(ae){return ae.copy(we)},this.setScissor=function(ae,Ue,Qe,Xe){ae.isVector4?we.set(ae.x,ae.y,ae.z,ae.w):we.set(ae,Ue,Qe,Xe),ut.scissor(J.copy(we).multiplyScalar(he).round())},this.getScissorTest=function(){return We},this.setScissorTest=function(ae){ut.setScissorTest(We=ae)},this.setOpaqueSort=function(ae){be=ae},this.setTransparentSort=function(ae){Se=ae},this.getClearColor=function(ae){return ae.copy(rn.getClearColor())},this.setClearColor=function(){rn.setClearColor.apply(rn,arguments)},this.getClearAlpha=function(){return rn.getClearAlpha()},this.setClearAlpha=function(){rn.setClearAlpha.apply(rn,arguments)},this.clear=function(ae=!0,Ue=!0,Qe=!0){let Xe=0;if(ae){let Oe=!1;if(H!==null){const Ot=H.texture.format;Oe=Ot===W0||Ot===j0||Ot===H0}if(Oe){const Ot=H.texture.type,qt=Ot===aa||Ot===Rr||Ot===wl||Ot===Au||Ot===Ay||Ot===dy,At=rn.getClearColor(),K=rn.getClearAlpha(),Ut=At.r,bn=At.g,fn=At.b;qt?(w[0]=Ut,w[1]=bn,w[2]=fn,w[3]=K,oe.clearBufferuiv(oe.COLOR,0,w)):(R[0]=Ut,R[1]=bn,R[2]=fn,R[3]=K,oe.clearBufferiv(oe.COLOR,0,R))}else Xe|=oe.COLOR_BUFFER_BIT}Ue&&(Xe|=oe.DEPTH_BUFFER_BIT),Qe&&(Xe|=oe.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),oe.clear(Xe)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){t.removeEventListener("webglcontextlost",yt,!1),t.removeEventListener("webglcontextrestored",$t,!1),t.removeEventListener("webglcontextcreationerror",kt,!1),rn.dispose(),Wt.dispose(),ln.dispose(),St.dispose(),Y.dispose(),Ce.dispose(),tt.dispose(),Mi.dispose(),me.dispose(),Vt.dispose(),rt.dispose(),rt.removeEventListener("sessionstart",Ze),rt.removeEventListener("sessionend",mt),It.stop()};function yt(ae){ae.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),z=!0}function $t(){console.log("THREE.WebGLRenderer: Context Restored."),z=!1;const ae=en.autoReset,Ue=Kt.enabled,Qe=Kt.autoUpdate,Xe=Kt.needsUpdate,Oe=Kt.type;jt(),en.autoReset=ae,Kt.enabled=Ue,Kt.autoUpdate=Qe,Kt.needsUpdate=Xe,Kt.type=Oe}function kt(ae){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",ae.statusMessage)}function xn(ae){const Ue=ae.target;Ue.removeEventListener("dispose",xn),qi(Ue)}function qi(ae){rr(ae),St.remove(ae)}function rr(ae){const Ue=St.get(ae).programs;Ue!==void 0&&(Ue.forEach(function(Qe){Vt.releaseProgram(Qe)}),ae.isShaderMaterial&&Vt.releaseShaderCache(ae))}this.renderBufferDirect=function(ae,Ue,Qe,Xe,Oe,Ot){Ue===null&&(Ue=Ge);const qt=Oe.isMesh&&Oe.matrixWorld.determinant()<0,At=Hs(ae,Ue,Qe,Xe,Oe);ut.setMaterial(Xe,qt);let K=Qe.index,Ut=1;if(Xe.wireframe===!0){if(K=it.getWireframeAttribute(Qe),K===void 0)return;Ut=2}const bn=Qe.drawRange,fn=Qe.attributes.position;let ui=bn.start*Ut,ci=(bn.start+bn.count)*Ut;Ot!==null&&(ui=Math.max(ui,Ot.start*Ut),ci=Math.min(ci,(Ot.start+Ot.count)*Ut)),K!==null?(ui=Math.max(ui,0),ci=Math.min(ci,K.count)):fn!=null&&(ui=Math.max(ui,0),ci=Math.min(ci,fn.count));const _i=ci-ui;if(_i<0||_i===1/0)return;Mi.setup(Oe,Xe,At,Qe,K);let Q,Ln=Ft;if(K!==null&&(Q=$e.get(K),Ln=Gt,Ln.setIndex(Q)),Oe.isMesh)Xe.wireframe===!0?(ut.setLineWidth(Xe.wireframeLinewidth*ke()),Ln.setMode(oe.LINES)):Ln.setMode(oe.TRIANGLES);else if(Oe.isLine){let mn=Xe.linewidth;mn===void 0&&(mn=1),ut.setLineWidth(mn*ke()),Oe.isLineSegments?Ln.setMode(oe.LINES):Oe.isLineLoop?Ln.setMode(oe.LINE_LOOP):Ln.setMode(oe.LINE_STRIP)}else Oe.isPoints?Ln.setMode(oe.POINTS):Oe.isSprite&&Ln.setMode(oe.TRIANGLES);if(Oe.isBatchedMesh)if(Oe._multiDrawInstances!==null)Ln.renderMultiDrawInstances(Oe._multiDrawStarts,Oe._multiDrawCounts,Oe._multiDrawCount,Oe._multiDrawInstances);else if(lt.get("WEBGL_multi_draw"))Ln.renderMultiDraw(Oe._multiDrawStarts,Oe._multiDrawCounts,Oe._multiDrawCount);else{const mn=Oe._multiDrawStarts,yr=Oe._multiDrawCounts,hi=Oe._multiDrawCount,bs=K?$e.get(K).bytesPerElement:1,fa=St.get(Xe).currentProgram.getUniforms();for(let ve=0;ve{function Ot(){if(Xe.forEach(function(qt){St.get(qt).currentProgram.isReady()&&Xe.delete(qt)}),Xe.size===0){Oe(ae);return}setTimeout(Ot,10)}lt.get("KHR_parallel_shader_compile")!==null?Ot():setTimeout(Ot,10)})};let $i=null;function Jr(ae){$i&&$i(ae)}function Ze(){It.stop()}function mt(){It.start()}const It=new oD;It.setAnimationLoop(Jr),typeof self<"u"&&It.setContext(self),this.setAnimationLoop=function(ae){$i=ae,rt.setAnimationLoop(ae),ae===null?It.stop():It.start()},rt.addEventListener("sessionstart",Ze),rt.addEventListener("sessionend",mt),this.render=function(ae,Ue){if(Ue!==void 0&&Ue.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(z===!0)return;if(ae.matrixWorldAutoUpdate===!0&&ae.updateMatrixWorld(),Ue.parent===null&&Ue.matrixWorldAutoUpdate===!0&&Ue.updateMatrixWorld(),rt.enabled===!0&&rt.isPresenting===!0&&(rt.cameraAutoUpdate===!0&&rt.updateCamera(Ue),Ue=rt.getCamera()),ae.isScene===!0&&ae.onBeforeRender(O,ae,Ue,H),E=ln.get(ae,L.length),E.init(Ue),L.push(E),pt.multiplyMatrices(Ue.projectionMatrix,Ue.matrixWorldInverse),Te.setFromProjectionMatrix(pt),_e=this.localClippingEnabled,ze=Tt.init(this.clippingPlanes,_e),C=Wt.get(ae,B.length),C.init(),B.push(C),rt.enabled===!0&&rt.isPresenting===!0){const Ot=O.xr.getDepthSensingMesh();Ot!==null&&at(Ot,Ue,-1/0,O.sortObjects)}at(ae,Ue,0,O.sortObjects),C.finish(),O.sortObjects===!0&&C.sort(be,Se),Be=rt.enabled===!1||rt.isPresenting===!1||rt.hasDepthSensing()===!1,Be&&rn.addToRenderList(C,ae),this.info.render.frame++,ze===!0&&Tt.beginShadows();const Qe=E.state.shadowsArray;Kt.render(Qe,ae,Ue),ze===!0&&Tt.endShadows(),this.info.autoReset===!0&&this.info.reset();const Xe=C.opaque,Oe=C.transmissive;if(E.setupLights(),Ue.isArrayCamera){const Ot=Ue.cameras;if(Oe.length>0)for(let qt=0,At=Ot.length;qt0&&ee(Xe,Oe,ae,Ue),Be&&rn.render(ae),d(C,ae,Ue);H!==null&&k===0&&(fe.updateMultisampleRenderTarget(H),fe.updateRenderTargetMipmap(H)),ae.isScene===!0&&ae.onAfterRender(O,ae,Ue),Mi.resetDefaultState(),F=-1,V=null,L.pop(),L.length>0?(E=L[L.length-1],ze===!0&&Tt.setGlobalState(O.clippingPlanes,E.state.camera)):E=null,B.pop(),B.length>0?C=B[B.length-1]:C=null};function at(ae,Ue,Qe,Xe){if(ae.visible===!1)return;if(ae.layers.test(Ue.layers)){if(ae.isGroup)Qe=ae.renderOrder;else if(ae.isLOD)ae.autoUpdate===!0&&ae.update(Ue);else if(ae.isLight)E.pushLight(ae),ae.castShadow&&E.pushShadow(ae);else if(ae.isSprite){if(!ae.frustumCulled||Te.intersectsSprite(ae)){Xe&&wt.setFromMatrixPosition(ae.matrixWorld).applyMatrix4(pt);const qt=tt.update(ae),At=ae.material;At.visible&&C.push(ae,qt,At,Qe,wt.z,null)}}else if((ae.isMesh||ae.isLine||ae.isPoints)&&(!ae.frustumCulled||Te.intersectsObject(ae))){const qt=tt.update(ae),At=ae.material;if(Xe&&(ae.boundingSphere!==void 0?(ae.boundingSphere===null&&ae.computeBoundingSphere(),wt.copy(ae.boundingSphere.center)):(qt.boundingSphere===null&&qt.computeBoundingSphere(),wt.copy(qt.boundingSphere.center)),wt.applyMatrix4(ae.matrixWorld).applyMatrix4(pt)),Array.isArray(At)){const K=qt.groups;for(let Ut=0,bn=K.length;Ut0&&$n(Oe,Ue,Qe),Ot.length>0&&$n(Ot,Ue,Qe),qt.length>0&&$n(qt,Ue,Qe),ut.buffers.depth.setTest(!0),ut.buffers.depth.setMask(!0),ut.buffers.color.setMask(!0),ut.setPolygonOffset(!1)}function ee(ae,Ue,Qe,Xe){if((Qe.isScene===!0?Qe.overrideMaterial:null)!==null)return;E.state.transmissionRenderTarget[Xe.id]===void 0&&(E.state.transmissionRenderTarget[Xe.id]=new qh(1,1,{generateMipmaps:!0,type:lt.has("EXT_color_buffer_half_float")||lt.has("EXT_color_buffer_float")?Gs:aa,minFilter:Va,samples:4,stencilBuffer:s,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:ai.workingColorSpace}));const Ot=E.state.transmissionRenderTarget[Xe.id],qt=Xe.viewport||X;Ot.setSize(qt.z*O.transmissionResolutionScale,qt.w*O.transmissionResolutionScale);const At=O.getRenderTarget();O.setRenderTarget(Ot),O.getClearColor(se),ne=O.getClearAlpha(),ne<1&&O.setClearColor(16777215,.5),O.clear(),Be&&rn.render(Qe);const K=O.toneMapping;O.toneMapping=Za;const Ut=Xe.viewport;if(Xe.viewport!==void 0&&(Xe.viewport=void 0),E.setupLightsView(Xe),ze===!0&&Tt.setGlobalState(O.clippingPlanes,Xe),$n(ae,Qe,Xe),fe.updateMultisampleRenderTarget(Ot),fe.updateRenderTargetMipmap(Ot),lt.has("WEBGL_multisampled_render_to_texture")===!1){let bn=!1;for(let fn=0,ui=Ue.length;fn0),fn=!!Qe.morphAttributes.position,ui=!!Qe.morphAttributes.normal,ci=!!Qe.morphAttributes.color;let _i=Za;Xe.toneMapped&&(H===null||H.isXRRenderTarget===!0)&&(_i=O.toneMapping);const Q=Qe.morphAttributes.position||Qe.morphAttributes.normal||Qe.morphAttributes.color,Ln=Q!==void 0?Q.length:0,mn=St.get(Xe),yr=E.state.lights;if(ze===!0&&(_e===!0||ae!==V)){const Yn=ae===V&&Xe.id===F;Tt.setState(Xe,ae,Yn)}let hi=!1;Xe.version===mn.__version?(mn.needsLights&&mn.lightsStateVersion!==yr.state.version||mn.outputColorSpace!==At||Oe.isBatchedMesh&&mn.batching===!1||!Oe.isBatchedMesh&&mn.batching===!0||Oe.isBatchedMesh&&mn.batchingColor===!0&&Oe.colorTexture===null||Oe.isBatchedMesh&&mn.batchingColor===!1&&Oe.colorTexture!==null||Oe.isInstancedMesh&&mn.instancing===!1||!Oe.isInstancedMesh&&mn.instancing===!0||Oe.isSkinnedMesh&&mn.skinning===!1||!Oe.isSkinnedMesh&&mn.skinning===!0||Oe.isInstancedMesh&&mn.instancingColor===!0&&Oe.instanceColor===null||Oe.isInstancedMesh&&mn.instancingColor===!1&&Oe.instanceColor!==null||Oe.isInstancedMesh&&mn.instancingMorph===!0&&Oe.morphTexture===null||Oe.isInstancedMesh&&mn.instancingMorph===!1&&Oe.morphTexture!==null||mn.envMap!==K||Xe.fog===!0&&mn.fog!==Ot||mn.numClippingPlanes!==void 0&&(mn.numClippingPlanes!==Tt.numPlanes||mn.numIntersection!==Tt.numIntersection)||mn.vertexAlphas!==Ut||mn.vertexTangents!==bn||mn.morphTargets!==fn||mn.morphNormals!==ui||mn.morphColors!==ci||mn.toneMapping!==_i||mn.morphTargetsCount!==Ln)&&(hi=!0):(hi=!0,mn.__version=Xe.version);let bs=mn.currentProgram;hi===!0&&(bs=Xn(Xe,Ue,Oe));let fa=!1,ve=!1,ot=!1;const Rt=bs.getUniforms(),Zt=mn.uniforms;if(ut.useProgram(bs.program)&&(fa=!0,ve=!0,ot=!0),Xe.id!==F&&(F=Xe.id,ve=!0),fa||V!==ae){ut.buffers.depth.getReversed()?(De.copy(ae.projectionMatrix),Tk(De),wk(De),Rt.setValue(oe,"projectionMatrix",De)):Rt.setValue(oe,"projectionMatrix",ae.projectionMatrix),Rt.setValue(oe,"viewMatrix",ae.matrixWorldInverse);const yi=Rt.map.cameraPosition;yi!==void 0&&yi.setValue(oe,_t.setFromMatrixPosition(ae.matrixWorld)),Dt.logarithmicDepthBuffer&&Rt.setValue(oe,"logDepthBufFC",2/(Math.log(ae.far+1)/Math.LN2)),(Xe.isMeshPhongMaterial||Xe.isMeshToonMaterial||Xe.isMeshLambertMaterial||Xe.isMeshBasicMaterial||Xe.isMeshStandardMaterial||Xe.isShaderMaterial)&&Rt.setValue(oe,"isOrthographic",ae.isOrthographicCamera===!0),V!==ae&&(V=ae,ve=!0,ot=!0)}if(Oe.isSkinnedMesh){Rt.setOptional(oe,Oe,"bindMatrix"),Rt.setOptional(oe,Oe,"bindMatrixInverse");const Yn=Oe.skeleton;Yn&&(Yn.boneTexture===null&&Yn.computeBoneTexture(),Rt.setValue(oe,"boneTexture",Yn.boneTexture,fe))}Oe.isBatchedMesh&&(Rt.setOptional(oe,Oe,"batchingTexture"),Rt.setValue(oe,"batchingTexture",Oe._matricesTexture,fe),Rt.setOptional(oe,Oe,"batchingIdTexture"),Rt.setValue(oe,"batchingIdTexture",Oe._indirectTexture,fe),Rt.setOptional(oe,Oe,"batchingColorTexture"),Oe._colorsTexture!==null&&Rt.setValue(oe,"batchingColorTexture",Oe._colorsTexture,fe));const cn=Qe.morphAttributes;if((cn.position!==void 0||cn.normal!==void 0||cn.color!==void 0)&&Ht.update(Oe,Qe,bs),(ve||mn.receiveShadow!==Oe.receiveShadow)&&(mn.receiveShadow=Oe.receiveShadow,Rt.setValue(oe,"receiveShadow",Oe.receiveShadow)),Xe.isMeshGouraudMaterial&&Xe.envMap!==null&&(Zt.envMap.value=K,Zt.flipEnvMap.value=K.isCubeTexture&&K.isRenderTargetTexture===!1?-1:1),Xe.isMeshStandardMaterial&&Xe.envMap===null&&Ue.environment!==null&&(Zt.envMapIntensity.value=Ue.environmentIntensity),ve&&(Rt.setValue(oe,"toneMappingExposure",O.toneMappingExposure),mn.needsLights&&li(Zt,ot),Ot&&Xe.fog===!0&&Bt.refreshFogUniforms(Zt,Ot),Bt.refreshMaterialUniforms(Zt,Xe,he,ue,E.state.transmissionRenderTarget[ae.id]),qv.upload(oe,un(mn),Zt,fe)),Xe.isShaderMaterial&&Xe.uniformsNeedUpdate===!0&&(qv.upload(oe,un(mn),Zt,fe),Xe.uniformsNeedUpdate=!1),Xe.isSpriteMaterial&&Rt.setValue(oe,"center",Oe.center),Rt.setValue(oe,"modelViewMatrix",Oe.modelViewMatrix),Rt.setValue(oe,"normalMatrix",Oe.normalMatrix),Rt.setValue(oe,"modelMatrix",Oe.matrixWorld),Xe.isShaderMaterial||Xe.isRawShaderMaterial){const Yn=Xe.uniformsGroups;for(let yi=0,js=Yn.length;yi0&&fe.useMultisampledRTT(ae)===!1?Oe=St.get(ae).__webglMultisampledFramebuffer:Array.isArray(bn)?Oe=bn[Qe]:Oe=bn,X.copy(ae.viewport),J.copy(ae.scissor),te=ae.scissorTest}else X.copy(le).multiplyScalar(he).floor(),J.copy(we).multiplyScalar(he).floor(),te=We;if(Qe!==0&&(Oe=cs),ut.bindFramebuffer(oe.FRAMEBUFFER,Oe)&&Xe&&ut.drawBuffers(ae,Oe),ut.viewport(X),ut.scissor(J),ut.setScissorTest(te),Ot){const K=St.get(ae.texture);oe.framebufferTexture2D(oe.FRAMEBUFFER,oe.COLOR_ATTACHMENT0,oe.TEXTURE_CUBE_MAP_POSITIVE_X+Ue,K.__webglTexture,Qe)}else if(qt){const K=St.get(ae.texture),Ut=Ue;oe.framebufferTextureLayer(oe.FRAMEBUFFER,oe.COLOR_ATTACHMENT0,K.__webglTexture,Qe,Ut)}else if(ae!==null&&Qe!==0){const K=St.get(ae.texture);oe.framebufferTexture2D(oe.FRAMEBUFFER,oe.COLOR_ATTACHMENT0,oe.TEXTURE_2D,K.__webglTexture,Qe)}F=-1},this.readRenderTargetPixels=function(ae,Ue,Qe,Xe,Oe,Ot,qt){if(!(ae&&ae.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let At=St.get(ae).__webglFramebuffer;if(ae.isWebGLCubeRenderTarget&&qt!==void 0&&(At=At[qt]),At){ut.bindFramebuffer(oe.FRAMEBUFFER,At);try{const K=ae.texture,Ut=K.format,bn=K.type;if(!Dt.textureFormatReadable(Ut)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!Dt.textureTypeReadable(bn)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}Ue>=0&&Ue<=ae.width-Xe&&Qe>=0&&Qe<=ae.height-Oe&&oe.readPixels(Ue,Qe,Xe,Oe,In.convert(Ut),In.convert(bn),Ot)}finally{const K=H!==null?St.get(H).__webglFramebuffer:null;ut.bindFramebuffer(oe.FRAMEBUFFER,K)}}},this.readRenderTargetPixelsAsync=async function(ae,Ue,Qe,Xe,Oe,Ot,qt){if(!(ae&&ae.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let At=St.get(ae).__webglFramebuffer;if(ae.isWebGLCubeRenderTarget&&qt!==void 0&&(At=At[qt]),At){const K=ae.texture,Ut=K.format,bn=K.type;if(!Dt.textureFormatReadable(Ut))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!Dt.textureTypeReadable(bn))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");if(Ue>=0&&Ue<=ae.width-Xe&&Qe>=0&&Qe<=ae.height-Oe){ut.bindFramebuffer(oe.FRAMEBUFFER,At);const fn=oe.createBuffer();oe.bindBuffer(oe.PIXEL_PACK_BUFFER,fn),oe.bufferData(oe.PIXEL_PACK_BUFFER,Ot.byteLength,oe.STREAM_READ),oe.readPixels(Ue,Qe,Xe,Oe,In.convert(Ut),In.convert(bn),0);const ui=H!==null?St.get(H).__webglFramebuffer:null;ut.bindFramebuffer(oe.FRAMEBUFFER,ui);const ci=oe.fenceSync(oe.SYNC_GPU_COMMANDS_COMPLETE,0);return oe.flush(),await Sk(oe,ci,4),oe.bindBuffer(oe.PIXEL_PACK_BUFFER,fn),oe.getBufferSubData(oe.PIXEL_PACK_BUFFER,0,Ot),oe.deleteBuffer(fn),oe.deleteSync(ci),Ot}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")}},this.copyFramebufferToTexture=function(ae,Ue=null,Qe=0){ae.isTexture!==!0&&(kf("WebGLRenderer: copyFramebufferToTexture function signature has changed."),Ue=arguments[0]||null,ae=arguments[1]);const Xe=Math.pow(2,-Qe),Oe=Math.floor(ae.image.width*Xe),Ot=Math.floor(ae.image.height*Xe),qt=Ue!==null?Ue.x:0,At=Ue!==null?Ue.y:0;fe.setTexture2D(ae,0),oe.copyTexSubImage2D(oe.TEXTURE_2D,Qe,0,0,qt,At,Oe,Ot),ut.unbindTexture()};const Ma=oe.createFramebuffer(),Ul=oe.createFramebuffer();this.copyTextureToTexture=function(ae,Ue,Qe=null,Xe=null,Oe=0,Ot=null){ae.isTexture!==!0&&(kf("WebGLRenderer: copyTextureToTexture function signature has changed."),Xe=arguments[0]||null,ae=arguments[1],Ue=arguments[2],Ot=arguments[3]||0,Qe=null),Ot===null&&(Oe!==0?(kf("WebGLRenderer: copyTextureToTexture function signature has changed to support src and dst mipmap levels."),Ot=Oe,Oe=0):Ot=0);let qt,At,K,Ut,bn,fn,ui,ci,_i;const Q=ae.isCompressedTexture?ae.mipmaps[Ot]:ae.image;if(Qe!==null)qt=Qe.max.x-Qe.min.x,At=Qe.max.y-Qe.min.y,K=Qe.isBox3?Qe.max.z-Qe.min.z:1,Ut=Qe.min.x,bn=Qe.min.y,fn=Qe.isBox3?Qe.min.z:0;else{const cn=Math.pow(2,-Oe);qt=Math.floor(Q.width*cn),At=Math.floor(Q.height*cn),ae.isDataArrayTexture?K=Q.depth:ae.isData3DTexture?K=Math.floor(Q.depth*cn):K=1,Ut=0,bn=0,fn=0}Xe!==null?(ui=Xe.x,ci=Xe.y,_i=Xe.z):(ui=0,ci=0,_i=0);const Ln=In.convert(Ue.format),mn=In.convert(Ue.type);let yr;Ue.isData3DTexture?(fe.setTexture3D(Ue,0),yr=oe.TEXTURE_3D):Ue.isDataArrayTexture||Ue.isCompressedArrayTexture?(fe.setTexture2DArray(Ue,0),yr=oe.TEXTURE_2D_ARRAY):(fe.setTexture2D(Ue,0),yr=oe.TEXTURE_2D),oe.pixelStorei(oe.UNPACK_FLIP_Y_WEBGL,Ue.flipY),oe.pixelStorei(oe.UNPACK_PREMULTIPLY_ALPHA_WEBGL,Ue.premultiplyAlpha),oe.pixelStorei(oe.UNPACK_ALIGNMENT,Ue.unpackAlignment);const hi=oe.getParameter(oe.UNPACK_ROW_LENGTH),bs=oe.getParameter(oe.UNPACK_IMAGE_HEIGHT),fa=oe.getParameter(oe.UNPACK_SKIP_PIXELS),ve=oe.getParameter(oe.UNPACK_SKIP_ROWS),ot=oe.getParameter(oe.UNPACK_SKIP_IMAGES);oe.pixelStorei(oe.UNPACK_ROW_LENGTH,Q.width),oe.pixelStorei(oe.UNPACK_IMAGE_HEIGHT,Q.height),oe.pixelStorei(oe.UNPACK_SKIP_PIXELS,Ut),oe.pixelStorei(oe.UNPACK_SKIP_ROWS,bn),oe.pixelStorei(oe.UNPACK_SKIP_IMAGES,fn);const Rt=ae.isDataArrayTexture||ae.isData3DTexture,Zt=Ue.isDataArrayTexture||Ue.isData3DTexture;if(ae.isDepthTexture){const cn=St.get(ae),Yn=St.get(Ue),yi=St.get(cn.__renderTarget),js=St.get(Yn.__renderTarget);ut.bindFramebuffer(oe.READ_FRAMEBUFFER,yi.__webglFramebuffer),ut.bindFramebuffer(oe.DRAW_FRAMEBUFFER,js.__webglFramebuffer);for(let pi=0;pi=-1&&_d.z<=1&&w.layers.test(C.layers)===!0,B=w.element;B.style.display=E===!0?"":"none",E===!0&&(w.onBeforeRender(t,R,C),B.style.transform="translate("+-100*w.center.x+"%,"+-100*w.center.y+"%)translate("+(_d.x*s+s)+"px,"+(-_d.y*a+a)+"px)",B.parentNode!==u&&u.appendChild(B),w.onAfterRender(t,R,C));const L={distanceToCameraSquared:v(C,w)};l.objects.set(w,L)}for(let E=0,B=w.children.length;E=e||k<0||v&&H>=s}function E(){var G=P3();if(C(G))return B(G);l=setTimeout(E,R(G))}function B(G){return l=void 0,x&&n?S(G):(n=r=void 0,a)}function L(){l!==void 0&&clearTimeout(l),h=0,n=u=r=l=void 0}function O(){return l===void 0?a:B(P3())}function z(){var G=P3(),k=C(G);if(n=arguments,r=this,u=G,k){if(l===void 0)return w(u);if(v)return clearTimeout(l),l=setTimeout(E,e),S(u)}return l===void 0&&(l=setTimeout(E,e)),a}return z.cancel=L,z.flush=O,z}function l6(i,e){(e==null||e>i.length)&&(e=i.length);for(var t=0,n=Array(e);t1e4?1e4:i,{In:function(e){return Math.pow(e,i)},Out:function(e){return 1-Math.pow(1-e,i)},InOut:function(e){return e<.5?Math.pow(e*2,i)/2:(1-Math.pow(2-e*2,i))/2+.5}}}}),ym=function(){return performance.now()},My=(function(){function i(){this._tweens={},this._tweensAddedDuringUpdate={}}return i.prototype.getAll=function(){var e=this;return Object.keys(this._tweens).map(function(t){return e._tweens[t]})},i.prototype.removeAll=function(){this._tweens={}},i.prototype.add=function(e){this._tweens[e.getId()]=e,this._tweensAddedDuringUpdate[e.getId()]=e},i.prototype.remove=function(e){delete this._tweens[e.getId()],delete this._tweensAddedDuringUpdate[e.getId()]},i.prototype.update=function(e,t){e===void 0&&(e=ym()),t===void 0&&(t=!1);var n=Object.keys(this._tweens);if(n.length===0)return!1;for(;n.length>0;){this._tweensAddedDuringUpdate={};for(var r=0;r1?s(i[t],i[t-1],t-n):s(i[r],i[r+1>t?t:r+1],n-r)},Utils:{Linear:function(i,e,t){return(e-i)*t+i}}},dD=(function(){function i(){}return i.nextId=function(){return i._nextId++},i._nextId=0,i})(),eT=new My,ca=(function(){function i(e,t){t===void 0&&(t=eT),this._object=e,this._group=t,this._isPaused=!1,this._pauseStart=0,this._valuesStart={},this._valuesEnd={},this._valuesStartRepeat={},this._duration=1e3,this._isDynamic=!1,this._initialRepeat=0,this._repeat=0,this._yoyo=!1,this._isPlaying=!1,this._reversed=!1,this._delayTime=0,this._startTime=0,this._easingFunction=os.Linear.None,this._interpolationFunction=JS.Linear,this._chainedTweens=[],this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._id=dD.nextId(),this._isChainStopped=!1,this._propertiesAreSetUp=!1,this._goToEnd=!1}return i.prototype.getId=function(){return this._id},i.prototype.isPlaying=function(){return this._isPlaying},i.prototype.isPaused=function(){return this._isPaused},i.prototype.getDuration=function(){return this._duration},i.prototype.to=function(e,t){if(t===void 0&&(t=1e3),this._isPlaying)throw new Error("Can not call Tween.to() while Tween is already started or paused. Stop the Tween first.");return this._valuesEnd=e,this._propertiesAreSetUp=!1,this._duration=t<0?0:t,this},i.prototype.duration=function(e){return e===void 0&&(e=1e3),this._duration=e<0?0:e,this},i.prototype.dynamic=function(e){return e===void 0&&(e=!1),this._isDynamic=e,this},i.prototype.start=function(e,t){if(e===void 0&&(e=ym()),t===void 0&&(t=!1),this._isPlaying)return this;if(this._group&&this._group.add(this),this._repeat=this._initialRepeat,this._reversed){this._reversed=!1;for(var n in this._valuesStartRepeat)this._swapEndStartRepeatValues(n),this._valuesStart[n]=this._valuesStartRepeat[n]}if(this._isPlaying=!0,this._isPaused=!1,this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._isChainStopped=!1,this._startTime=e,this._startTime+=this._delayTime,!this._propertiesAreSetUp||t){if(this._propertiesAreSetUp=!0,!this._isDynamic){var r={};for(var s in this._valuesEnd)r[s]=this._valuesEnd[s];this._valuesEnd=r}this._setupProperties(this._object,this._valuesStart,this._valuesEnd,this._valuesStartRepeat,t)}return this},i.prototype.startFromCurrentValues=function(e){return this.start(e,!0)},i.prototype._setupProperties=function(e,t,n,r,s){for(var a in n){var l=e[a],u=Array.isArray(l),h=u?"array":typeof l,g=!u&&Array.isArray(n[a]);if(!(h==="undefined"||h==="function")){if(g){var v=n[a];if(v.length===0)continue;for(var x=[l],S=0,w=v.length;S"u"||s)&&(t[a]=l),u||(t[a]*=1),g?r[a]=n[a].slice().reverse():r[a]=t[a]||0}}},i.prototype.stop=function(){return this._isChainStopped||(this._isChainStopped=!0,this.stopChainedTweens()),this._isPlaying?(this._group&&this._group.remove(this),this._isPlaying=!1,this._isPaused=!1,this._onStopCallback&&this._onStopCallback(this._object),this):this},i.prototype.end=function(){return this._goToEnd=!0,this.update(1/0),this},i.prototype.pause=function(e){return e===void 0&&(e=ym()),this._isPaused||!this._isPlaying?this:(this._isPaused=!0,this._pauseStart=e,this._group&&this._group.remove(this),this)},i.prototype.resume=function(e){return e===void 0&&(e=ym()),!this._isPaused||!this._isPlaying?this:(this._isPaused=!1,this._startTime+=e-this._pauseStart,this._pauseStart=0,this._group&&this._group.add(this),this)},i.prototype.stopChainedTweens=function(){for(var e=0,t=this._chainedTweens.length;ea)return!1;t&&this.start(e,!0)}if(this._goToEnd=!1,eh)return 1;var C=Math.trunc(l/u),E=l-C*u,B=Math.min(E/n._duration,1);return B===0&&l===n._duration?1:B},v=g(),x=this._easingFunction(v);if(this._updateProperties(this._object,this._valuesStart,this._valuesEnd,x),this._onUpdateCallback&&this._onUpdateCallback(this._object,v),this._duration===0||l>=this._duration)if(this._repeat>0){var S=Math.min(Math.trunc((l-this._duration)/u)+1,this._repeat);isFinite(this._repeat)&&(this._repeat-=S);for(s in this._valuesStartRepeat)!this._yoyo&&typeof this._valuesEnd[s]=="string"&&(this._valuesStartRepeat[s]=this._valuesStartRepeat[s]+parseFloat(this._valuesEnd[s])),this._yoyo&&this._swapEndStartRepeatValues(s),this._valuesStart[s]=this._valuesStartRepeat[s];return this._yoyo&&(this._reversed=!this._reversed),this._startTime+=u*S,this._onRepeatCallback&&this._onRepeatCallback(this._object),this._onEveryStartCallbackFired=!1,!0}else{this._onCompleteCallback&&this._onCompleteCallback(this._object);for(var w=0,R=this._chainedTweens.length;w=(w=(u+v)/2))?u=w:v=w,(z=t>=(R=(h+x)/2))?h=R:x=R,(G=n>=(C=(g+S)/2))?g=C:S=C,s=a,!(a=a[k=G<<2|z<<1|O]))return s[k]=l,i;if(E=+i._x.call(null,a.data),B=+i._y.call(null,a.data),L=+i._z.call(null,a.data),e===E&&t===B&&n===L)return l.next=a,s?s[k]=l:i._root=l,i;do s=s?s[k]=new Array(8):i._root=new Array(8),(O=e>=(w=(u+v)/2))?u=w:v=w,(z=t>=(R=(h+x)/2))?h=R:x=R,(G=n>=(C=(g+S)/2))?g=C:S=C;while((k=G<<2|z<<1|O)===(H=(L>=C)<<2|(B>=R)<<1|E>=w));return s[H]=a,s[k]=l,i}function gW(i){Array.isArray(i)||(i=Array.from(i));const e=i.length,t=new Float64Array(e),n=new Float64Array(e),r=new Float64Array(e);let s=1/0,a=1/0,l=1/0,u=-1/0,h=-1/0,g=-1/0;for(let v=0,x,S,w,R;vu&&(u=S),wh&&(h=w),Rg&&(g=R));if(s>u||a>h||l>g)return this;this.cover(s,a,l).cover(u,h,g);for(let v=0;vi||i>=a||r>e||e>=l||s>t||t>=u;)switch(x=(tw||(h=L.y0)>R||(g=L.z0)>C||(v=L.x1)=k)<<2|(e>=G)<<1|i>=z)&&(L=E[E.length-1],E[E.length-1]=E[E.length-1-O],E[E.length-1-O]=L)}else{var H=i-+this._x.call(null,B.data),F=e-+this._y.call(null,B.data),V=t-+this._z.call(null,B.data),X=H*H+F*F+V*V;if(XMath.sqrt((i-n)**2+(e-r)**2+(t-s)**2);function SW(i,e,t,n){const r=[],s=i-n,a=e-n,l=t-n,u=i+n,h=e+n,g=t+n;return this.visit((v,x,S,w,R,C,E)=>{if(!v.length)do{const B=v.data;bW(i,e,t,this._x(B),this._y(B),this._z(B))<=n&&r.push(B)}while(v=v.next);return x>u||S>h||w>g||R=(R=(a+h)/2))?a=R:h=R,(L=S>=(C=(l+g)/2))?l=C:g=C,(O=w>=(E=(u+v)/2))?u=E:v=E,e=t,!(t=t[z=O<<2|L<<1|B]))return this;if(!t.length)break;(e[z+1&7]||e[z+2&7]||e[z+3&7]||e[z+4&7]||e[z+5&7]||e[z+6&7]||e[z+7&7])&&(n=e,G=z)}for(;t.data!==i;)if(r=t,!(t=t.next))return this;return(s=t.next)&&delete t.next,r?(s?r.next=s:delete r.next,this):e?(s?e[z]=s:delete e[z],(t=e[0]||e[1]||e[2]||e[3]||e[4]||e[5]||e[6]||e[7])&&t===(e[7]||e[6]||e[5]||e[4]||e[3]||e[2]||e[1]||e[0])&&!t.length&&(n?n[G]=t:this._root=t),this):(this._root=s,this)}function wW(i){for(var e=0,t=i.length;ee?1:i>=e?0:NaN}function OW(i,e){return i==null||e==null?NaN:ei?1:e>=i?0:NaN}function gD(i){let e,t,n;i.length!==2?(e=Vv,t=(l,u)=>Vv(i(l),u),n=(l,u)=>i(l)-u):(e=i===Vv||i===OW?i:IW,t=i,n=i);function r(l,u,h=0,g=l.length){if(h>>1;t(l[v],u)<0?h=v+1:g=v}while(h>>1;t(l[v],u)<=0?h=v+1:g=v}while(hh&&n(l[v-1],u)>-n(l[v],u)?v-1:v}return{left:r,center:a,right:s}}function IW(){return 0}function FW(i){return i===null?NaN:+i}const kW=gD(Vv),vD=kW.right;gD(FW).center;function A_(i,e){let t,n;if(e===void 0)for(const r of i)r!=null&&(t===void 0?r>=r&&(t=n=r):(t>r&&(t=r),n=s&&(t=n=s):(t>s&&(t=s),n0){for(a=e[--t];t>0&&(n=a,r=e[--t],a=n+r,s=r-(a-n),!s););t>0&&(s<0&&e[t-1]<0||s>0&&e[t-1]>0)&&(r=s*2,n=a+r,r==n-a&&(a=n))}return a}}const zW=Math.sqrt(50),GW=Math.sqrt(10),qW=Math.sqrt(2);function d_(i,e,t){const n=(e-i)/Math.max(0,t),r=Math.floor(Math.log10(n)),s=n/Math.pow(10,r),a=s>=zW?10:s>=GW?5:s>=qW?2:1;let l,u,h;return r<0?(h=Math.pow(10,-r)/a,l=Math.round(i*h),u=Math.round(e*h),l/he&&--u,h=-h):(h=Math.pow(10,r)*a,l=Math.round(i/h),u=Math.round(e/h),l*he&&--u),u0))return[];if(i===e)return[i];const n=e=r))return[];const l=s-r+1,u=new Array(l);if(n)if(a<0)for(let h=0;h=n)&&(t=n);return t}function WW(i,e){let t=0,n=0;if(e===void 0)for(let r of i)r!=null&&(r=+r)>=r&&(++t,n+=r);else{let r=-1;for(let s of i)(s=e(s,++r,i))!=null&&(s=+s)>=s&&(++t,n+=s)}if(t)return n/t}function*$W(i){for(const e of i)yield*e}function ug(i){return Array.from($W(i))}function jd(i,e,t){i=+i,e=+e,t=(r=arguments.length)<2?(e=i,i=0,1):r<3?1:+t;for(var n=-1,r=Math.max(0,Math.ceil((e-i)/t))|0,s=new Array(r);++n>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):t===8?X2(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):t===4?X2(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|e&240,((e&15)<<4|e&15)/255):null):(e=QW.exec(i))?new Wa(e[1],e[2],e[3],1):(e=KW.exec(i))?new Wa(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=ZW.exec(i))?X2(e[1],e[2],e[3],e[4]):(e=JW.exec(i))?X2(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=e$.exec(i))?m6(e[1],e[2]/100,e[3]/100,1):(e=t$.exec(i))?m6(e[1],e[2]/100,e[3]/100,e[4]):c6.hasOwnProperty(i)?A6(c6[i]):i==="transparent"?new Wa(NaN,NaN,NaN,0):null}function A6(i){return new Wa(i>>16&255,i>>8&255,i&255,1)}function X2(i,e,t,n){return n<=0&&(i=e=t=NaN),new Wa(i,e,t,n)}function r$(i){return i instanceof zg||(i=cA(i)),i?(i=i.rgb(),new Wa(i.r,i.g,i.b,i.opacity)):new Wa}function nT(i,e,t,n){return arguments.length===1?r$(i):new Wa(i,e,t,n??1)}function Wa(i,e,t,n){this.r=+i,this.g=+e,this.b=+t,this.opacity=+n}lM(Wa,nT,yD(zg,{brighter(i){return i=i==null?p_:Math.pow(p_,i),new Wa(this.r*i,this.g*i,this.b*i,this.opacity)},darker(i){return i=i==null?cg:Math.pow(cg,i),new Wa(this.r*i,this.g*i,this.b*i,this.opacity)},rgb(){return this},clamp(){return new Wa(eA(this.r),eA(this.g),eA(this.b),m_(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:d6,formatHex:d6,formatHex8:s$,formatRgb:p6,toString:p6}));function d6(){return`#${Wf(this.r)}${Wf(this.g)}${Wf(this.b)}`}function s$(){return`#${Wf(this.r)}${Wf(this.g)}${Wf(this.b)}${Wf((isNaN(this.opacity)?1:this.opacity)*255)}`}function p6(){const i=m_(this.opacity);return`${i===1?"rgb(":"rgba("}${eA(this.r)}, ${eA(this.g)}, ${eA(this.b)}${i===1?")":`, ${i})`}`}function m_(i){return isNaN(i)?1:Math.max(0,Math.min(1,i))}function eA(i){return Math.max(0,Math.min(255,Math.round(i)||0))}function Wf(i){return i=eA(i),(i<16?"0":"")+i.toString(16)}function m6(i,e,t,n){return n<=0?i=e=t=NaN:t<=0||t>=1?i=e=NaN:e<=0&&(i=NaN),new Tl(i,e,t,n)}function xD(i){if(i instanceof Tl)return new Tl(i.h,i.s,i.l,i.opacity);if(i instanceof zg||(i=cA(i)),!i)return new Tl;if(i instanceof Tl)return i;i=i.rgb();var e=i.r/255,t=i.g/255,n=i.b/255,r=Math.min(e,t,n),s=Math.max(e,t,n),a=NaN,l=s-r,u=(s+r)/2;return l?(e===s?a=(t-n)/l+(t0&&u<1?0:a,new Tl(a,l,u,i.opacity)}function a$(i,e,t,n){return arguments.length===1?xD(i):new Tl(i,e,t,n??1)}function Tl(i,e,t,n){this.h=+i,this.s=+e,this.l=+t,this.opacity=+n}lM(Tl,a$,yD(zg,{brighter(i){return i=i==null?p_:Math.pow(p_,i),new Tl(this.h,this.s,this.l*i,this.opacity)},darker(i){return i=i==null?cg:Math.pow(cg,i),new Tl(this.h,this.s,this.l*i,this.opacity)},rgb(){var i=this.h%360+(this.h<0)*360,e=isNaN(i)||isNaN(this.s)?0:this.s,t=this.l,n=t+(t<.5?t:1-t)*e,r=2*t-n;return new Wa(L3(i>=240?i-240:i+120,r,n),L3(i,r,n),L3(i<120?i+240:i-120,r,n),this.opacity)},clamp(){return new Tl(g6(this.h),Y2(this.s),Y2(this.l),m_(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const i=m_(this.opacity);return`${i===1?"hsl(":"hsla("}${g6(this.h)}, ${Y2(this.s)*100}%, ${Y2(this.l)*100}%${i===1?")":`, ${i})`}`}}));function g6(i){return i=(i||0)%360,i<0?i+360:i}function Y2(i){return Math.max(0,Math.min(1,i||0))}function L3(i,e,t){return(i<60?e+(t-e)*i/60:i<180?t:i<240?e+(t-e)*(240-i)/60:e)*255}const uM=i=>()=>i;function o$(i,e){return function(t){return i+t*e}}function l$(i,e,t){return i=Math.pow(i,t),e=Math.pow(e,t)-i,t=1/t,function(n){return Math.pow(i+n*e,t)}}function u$(i){return(i=+i)==1?bD:function(e,t){return t-e?l$(e,t,i):uM(isNaN(e)?t:e)}}function bD(i,e){var t=e-i;return t?o$(i,t):uM(isNaN(i)?e:i)}const v6=(function i(e){var t=u$(e);function n(r,s){var a=t((r=nT(r)).r,(s=nT(s)).r),l=t(r.g,s.g),u=t(r.b,s.b),h=bD(r.opacity,s.opacity);return function(g){return r.r=a(g),r.g=l(g),r.b=u(g),r.opacity=h(g),r+""}}return n.gamma=i,n})(1);function SD(i,e){e||(e=[]);var t=i?Math.min(e.length,i.length):0,n=e.slice(),r;return function(s){for(r=0;rt&&(s=e.slice(t,s),l[a]?l[a]+=s:l[++a]=s),(n=n[0])===(r=r[0])?l[a]?l[a]+=r:l[++a]=r:(l[++a]=null,u.push({i:a,x:fg(n,r)})),t=U3.lastIndex;return te&&(t=i,i=e,e=t),function(n){return Math.max(i,Math.min(e,n))}}function y$(i,e,t){var n=i[0],r=i[1],s=e[0],a=e[1];return r2?x$:y$,u=h=null,v}function v(x){return x==null||isNaN(x=+x)?s:(u||(u=l(i.map(n),e,t)))(n(a(x)))}return v.invert=function(x){return a(r((h||(h=l(e,i.map(n),fg)))(x)))},v.domain=function(x){return arguments.length?(i=Array.from(x,v$),g()):i.slice()},v.range=function(x){return arguments.length?(e=Array.from(x),g()):e.slice()},v.rangeRound=function(x){return e=Array.from(x),t=m$,g()},v.clamp=function(x){return arguments.length?(a=x?!0:Wd,g()):a!==Wd},v.interpolate=function(x){return arguments.length?(t=x,g()):t},v.unknown=function(x){return arguments.length?(s=x,v):s},function(x,S){return n=x,r=S,g()}}function T$(){return S$()(Wd,Wd)}function w$(i){return Math.abs(i=Math.round(i))>=1e21?i.toLocaleString("en").replace(/,/g,""):i.toString(10)}function g_(i,e){if(!isFinite(i)||i===0)return null;var t=(i=e?i.toExponential(e-1):i.toExponential()).indexOf("e"),n=i.slice(0,t);return[n.length>1?n[0]+n.slice(2):n,+i.slice(t+1)]}function C0(i){return i=g_(Math.abs(i)),i?i[1]:NaN}function M$(i,e){return function(t,n){for(var r=t.length,s=[],a=0,l=i[0],u=0;r>0&&l>0&&(u+l+1>n&&(l=Math.max(1,n-u)),s.push(t.substring(r-=l,r+l)),!((u+=l+1)>n));)l=i[a=(a+1)%i.length];return s.reverse().join(e)}}function E$(i){return function(e){return e.replace(/[0-9]/g,function(t){return i[+t]})}}var C$=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function v_(i){if(!(e=C$.exec(i)))throw new Error("invalid format: "+i);var e;return new hM({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]})}v_.prototype=hM.prototype;function hM(i){this.fill=i.fill===void 0?" ":i.fill+"",this.align=i.align===void 0?">":i.align+"",this.sign=i.sign===void 0?"-":i.sign+"",this.symbol=i.symbol===void 0?"":i.symbol+"",this.zero=!!i.zero,this.width=i.width===void 0?void 0:+i.width,this.comma=!!i.comma,this.precision=i.precision===void 0?void 0:+i.precision,this.trim=!!i.trim,this.type=i.type===void 0?"":i.type+""}hM.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function R$(i){e:for(var e=i.length,t=1,n=-1,r;t0&&(n=0);break}return n>0?i.slice(0,n)+i.slice(r+1):i}var __;function N$(i,e){var t=g_(i,e);if(!t)return __=void 0,i.toPrecision(e);var n=t[0],r=t[1],s=r-(__=Math.max(-8,Math.min(8,Math.floor(r/3)))*3)+1,a=n.length;return s===a?n:s>a?n+new Array(s-a+1).join("0"):s>0?n.slice(0,s)+"."+n.slice(s):"0."+new Array(1-s).join("0")+g_(i,Math.max(0,e+s-1))[0]}function y6(i,e){var t=g_(i,e);if(!t)return i+"";var n=t[0],r=t[1];return r<0?"0."+new Array(-r).join("0")+n:n.length>r+1?n.slice(0,r+1)+"."+n.slice(r+1):n+new Array(r-n.length+2).join("0")}const x6={"%":(i,e)=>(i*100).toFixed(e),b:i=>Math.round(i).toString(2),c:i=>i+"",d:w$,e:(i,e)=>i.toExponential(e),f:(i,e)=>i.toFixed(e),g:(i,e)=>i.toPrecision(e),o:i=>Math.round(i).toString(8),p:(i,e)=>y6(i*100,e),r:y6,s:N$,X:i=>Math.round(i).toString(16).toUpperCase(),x:i=>Math.round(i).toString(16)};function b6(i){return i}var S6=Array.prototype.map,T6=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function D$(i){var e=i.grouping===void 0||i.thousands===void 0?b6:M$(S6.call(i.grouping,Number),i.thousands+""),t=i.currency===void 0?"":i.currency[0]+"",n=i.currency===void 0?"":i.currency[1]+"",r=i.decimal===void 0?".":i.decimal+"",s=i.numerals===void 0?b6:E$(S6.call(i.numerals,String)),a=i.percent===void 0?"%":i.percent+"",l=i.minus===void 0?"−":i.minus+"",u=i.nan===void 0?"NaN":i.nan+"";function h(v,x){v=v_(v);var S=v.fill,w=v.align,R=v.sign,C=v.symbol,E=v.zero,B=v.width,L=v.comma,O=v.precision,z=v.trim,G=v.type;G==="n"?(L=!0,G="g"):x6[G]||(O===void 0&&(O=12),z=!0,G="g"),(E||S==="0"&&w==="=")&&(E=!0,S="0",w="=");var k=(x&&x.prefix!==void 0?x.prefix:"")+(C==="$"?t:C==="#"&&/[boxX]/.test(G)?"0"+G.toLowerCase():""),H=(C==="$"?n:/[%p]/.test(G)?a:"")+(x&&x.suffix!==void 0?x.suffix:""),F=x6[G],V=/[defgprs%]/.test(G);O=O===void 0?6:/[gprs]/.test(G)?Math.max(1,Math.min(21,O)):Math.max(0,Math.min(20,O));function X(J){var te=k,se=H,ne,Z,ue;if(G==="c")se=F(J)+se,J="";else{J=+J;var he=J<0||1/J<0;if(J=isNaN(J)?u:F(Math.abs(J),O),z&&(J=R$(J)),he&&+J==0&&R!=="+"&&(he=!1),te=(he?R==="("?R:l:R==="-"||R==="("?"":R)+te,se=(G==="s"&&!isNaN(J)&&__!==void 0?T6[8+__/3]:"")+se+(he&&R==="("?")":""),V){for(ne=-1,Z=J.length;++neue||ue>57){se=(ue===46?r+J.slice(ne+1):J.slice(ne))+se,J=J.slice(0,ne);break}}}L&&!E&&(J=e(J,1/0));var be=te.length+J.length+se.length,Se=be>1)+te+J+se+Se.slice(be);break;default:J=Se+te+J+se;break}return s(J)}return X.toString=function(){return v+""},X}function g(v,x){var S=Math.max(-8,Math.min(8,Math.floor(C0(x)/3)))*3,w=Math.pow(10,-S),R=h((v=v_(v),v.type="f",v),{suffix:T6[8+S/3]});return function(C){return R(w*C)}}return{format:h,formatPrefix:g}}var Q2,MD,ED;P$({thousands:",",grouping:[3],currency:["$",""]});function P$(i){return Q2=D$(i),MD=Q2.format,ED=Q2.formatPrefix,Q2}function L$(i){return Math.max(0,-C0(Math.abs(i)))}function U$(i,e){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(C0(e)/3)))*3-C0(Math.abs(i)))}function B$(i,e){return i=Math.abs(i),e=Math.abs(e)-i,Math.max(0,C0(e)-C0(i))+1}function O$(i,e,t,n){var r=HW(i,e,t),s;switch(n=v_(n??",f"),n.type){case"s":{var a=Math.max(Math.abs(i),Math.abs(e));return n.precision==null&&!isNaN(s=U$(r,a))&&(n.precision=s),ED(n,a)}case"":case"e":case"g":case"p":case"r":{n.precision==null&&!isNaN(s=B$(r,Math.max(Math.abs(i),Math.abs(e))))&&(n.precision=s-(n.type==="e"));break}case"f":case"%":{n.precision==null&&!isNaN(s=L$(r))&&(n.precision=s-(n.type==="%")*2);break}}return MD(n)}function CD(i){var e=i.domain;return i.ticks=function(t){var n=e();return VW(n[0],n[n.length-1],t??10)},i.tickFormat=function(t,n){var r=e();return O$(r[0],r[r.length-1],t??10,n)},i.nice=function(t){t==null&&(t=10);var n=e(),r=0,s=n.length-1,a=n[r],l=n[s],u,h,g=10;for(l0;){if(h=tT(a,l,t),h===u)return n[r]=a,n[s]=l,e(n);if(h>0)a=Math.floor(a/h)*h,l=Math.ceil(l/h)*h;else if(h<0)a=Math.ceil(a*h)/h,l=Math.floor(l*h)/h;else break;u=h}return i},i}function Pc(){var i=T$();return i.copy=function(){return b$(i,Pc())},_D.apply(i,arguments),CD(i)}function RD(){var i=0,e=1,t=1,n=[.5],r=[0,1],s;function a(u){return u!=null&&u<=u?r[vD(n,u,0,t)]:s}function l(){var u=-1;for(n=new Array(t);++u=t?[n[t-1],e]:[n[h-1],n[h]]},a.unknown=function(u){return arguments.length&&(s=u),a},a.thresholds=function(){return n.slice()},a.copy=function(){return RD().domain([i,e]).range(r).unknown(s)},_D.apply(CD(a),arguments)}var di=1e-6,y_=1e-12,Ni=Math.PI,$a=Ni/2,x_=Ni/4,No=Ni*2,kr=180/Ni,Hn=Ni/180,ir=Math.abs,fM=Math.atan,Zo=Math.atan2,ei=Math.cos,K2=Math.ceil,I$=Math.exp,sT=Math.hypot,F$=Math.log,zn=Math.sin,k$=Math.sign||function(i){return i>0?1:i<0?-1:0},Lc=Math.sqrt,z$=Math.tan;function G$(i){return i>1?0:i<-1?Ni:Math.acos(i)}function Uc(i){return i>1?$a:i<-1?-$a:Math.asin(i)}function w6(i){return(i=zn(i/2))*i}function ra(){}function b_(i,e){i&&E6.hasOwnProperty(i.type)&&E6[i.type](i,e)}var M6={Feature:function(i,e){b_(i.geometry,e)},FeatureCollection:function(i,e){for(var t=i.features,n=-1,r=t.length;++n=0?1:-1,r=n*t,s=ei(e),a=zn(e),l=uT*a,u=lT*s+l*ei(r),h=l*n*zn(r);S_.add(Zo(h,u)),oT=i,lT=s,uT=a}function T_(i){return[Zo(i[1],i[0]),Uc(i[2])]}function hA(i){var e=i[0],t=i[1],n=ei(t);return[n*ei(e),n*zn(e),zn(t)]}function Z2(i,e){return i[0]*e[0]+i[1]*e[1]+i[2]*e[2]}function R0(i,e){return[i[1]*e[2]-i[2]*e[1],i[2]*e[0]-i[0]*e[2],i[0]*e[1]-i[1]*e[0]]}function B3(i,e){i[0]+=e[0],i[1]+=e[1],i[2]+=e[2]}function J2(i,e){return[i[0]*e,i[1]*e,i[2]*e]}function w_(i){var e=Lc(i[0]*i[0]+i[1]*i[1]+i[2]*i[2]);i[0]/=e,i[1]/=e,i[2]/=e}var Cr,qa,Ir,wo,Of,LD,UD,i0,Dm,Ch,Oc,_c={point:cT,lineStart:N6,lineEnd:D6,polygonStart:function(){_c.point=OD,_c.lineStart=j$,_c.lineEnd=W$,Dm=new Ec,Bc.polygonStart()},polygonEnd:function(){Bc.polygonEnd(),_c.point=cT,_c.lineStart=N6,_c.lineEnd=D6,S_<0?(Cr=-(Ir=180),qa=-(wo=90)):Dm>di?wo=90:Dm<-di&&(qa=-90),Oc[0]=Cr,Oc[1]=Ir},sphere:function(){Cr=-(Ir=180),qa=-(wo=90)}};function cT(i,e){Ch.push(Oc=[Cr=i,Ir=i]),ewo&&(wo=e)}function BD(i,e){var t=hA([i*Hn,e*Hn]);if(i0){var n=R0(i0,t),r=[n[1],-n[0],0],s=R0(r,n);w_(s),s=T_(s);var a=i-Of,l=a>0?1:-1,u=s[0]*kr*l,h,g=ir(a)>180;g^(l*Ofwo&&(wo=h)):(u=(u+360)%360-180,g^(l*Ofwo&&(wo=e))),g?ibo(Cr,Ir)&&(Ir=i):bo(i,Ir)>bo(Cr,Ir)&&(Cr=i):Ir>=Cr?(iIr&&(Ir=i)):i>Of?bo(Cr,i)>bo(Cr,Ir)&&(Ir=i):bo(i,Ir)>bo(Cr,Ir)&&(Cr=i)}else Ch.push(Oc=[Cr=i,Ir=i]);ewo&&(wo=e),i0=t,Of=i}function N6(){_c.point=BD}function D6(){Oc[0]=Cr,Oc[1]=Ir,_c.point=cT,i0=null}function OD(i,e){if(i0){var t=i-Of;Dm.add(ir(t)>180?t+(t>0?360:-360):t)}else LD=i,UD=e;Bc.point(i,e),BD(i,e)}function j$(){Bc.lineStart()}function W$(){OD(LD,UD),Bc.lineEnd(),ir(Dm)>di&&(Cr=-(Ir=180)),Oc[0]=Cr,Oc[1]=Ir,i0=null}function bo(i,e){return(e-=i)<0?e+360:e}function $$(i,e){return i[0]-e[0]}function P6(i,e){return i[0]<=i[1]?i[0]<=e&&e<=i[1]:ebo(n[0],n[1])&&(n[1]=r[1]),bo(r[0],n[1])>bo(n[0],n[1])&&(n[0]=r[0])):s.push(n=r);for(a=-1/0,t=s.length-1,e=0,n=s[t];e<=t;n=r,++e)r=s[e],(l=bo(n[1],r[0]))>a&&(a=l,Cr=r[0],Ir=n[1])}return Ch=Oc=null,Cr===1/0||qa===1/0?[[NaN,NaN],[NaN,NaN]]:[[Cr,qa],[Ir,wo]]}var xm,M_,E_,C_,R_,N_,D_,P_,hT,fT,AT,FD,kD,xa,ba,Sa,Ml={sphere:ra,point:AM,lineStart:L6,lineEnd:U6,polygonStart:function(){Ml.lineStart=Q$,Ml.lineEnd=K$},polygonEnd:function(){Ml.lineStart=L6,Ml.lineEnd=U6}};function AM(i,e){i*=Hn,e*=Hn;var t=ei(e);Gg(t*ei(i),t*zn(i),zn(e))}function Gg(i,e,t){++xm,E_+=(i-E_)/xm,C_+=(e-C_)/xm,R_+=(t-R_)/xm}function L6(){Ml.point=X$}function X$(i,e){i*=Hn,e*=Hn;var t=ei(e);xa=t*ei(i),ba=t*zn(i),Sa=zn(e),Ml.point=Y$,Gg(xa,ba,Sa)}function Y$(i,e){i*=Hn,e*=Hn;var t=ei(e),n=t*ei(i),r=t*zn(i),s=zn(e),a=Zo(Lc((a=ba*s-Sa*r)*a+(a=Sa*n-xa*s)*a+(a=xa*r-ba*n)*a),xa*n+ba*r+Sa*s);M_+=a,N_+=a*(xa+(xa=n)),D_+=a*(ba+(ba=r)),P_+=a*(Sa+(Sa=s)),Gg(xa,ba,Sa)}function U6(){Ml.point=AM}function Q$(){Ml.point=Z$}function K$(){zD(FD,kD),Ml.point=AM}function Z$(i,e){FD=i,kD=e,i*=Hn,e*=Hn,Ml.point=zD;var t=ei(e);xa=t*ei(i),ba=t*zn(i),Sa=zn(e),Gg(xa,ba,Sa)}function zD(i,e){i*=Hn,e*=Hn;var t=ei(e),n=t*ei(i),r=t*zn(i),s=zn(e),a=ba*s-Sa*r,l=Sa*n-xa*s,u=xa*r-ba*n,h=sT(a,l,u),g=Uc(h),v=h&&-g/h;hT.add(v*a),fT.add(v*l),AT.add(v*u),M_+=g,N_+=g*(xa+(xa=n)),D_+=g*(ba+(ba=r)),P_+=g*(Sa+(Sa=s)),Gg(xa,ba,Sa)}function B6(i){xm=M_=E_=C_=R_=N_=D_=P_=0,hT=new Ec,fT=new Ec,AT=new Ec,Ey(i,Ml);var e=+hT,t=+fT,n=+AT,r=sT(e,t,n);return rNi&&(i-=Math.round(i/No)*No),[i,e]}pT.invert=pT;function GD(i,e,t){return(i%=No)?e||t?dT(I6(i),F6(e,t)):I6(i):e||t?F6(e,t):pT}function O6(i){return function(e,t){return e+=i,ir(e)>Ni&&(e-=Math.round(e/No)*No),[e,t]}}function I6(i){var e=O6(i);return e.invert=O6(-i),e}function F6(i,e){var t=ei(i),n=zn(i),r=ei(e),s=zn(e);function a(l,u){var h=ei(u),g=ei(l)*h,v=zn(l)*h,x=zn(u),S=x*t+g*n;return[Zo(v*r-S*s,g*t-x*n),Uc(S*r+v*s)]}return a.invert=function(l,u){var h=ei(u),g=ei(l)*h,v=zn(l)*h,x=zn(u),S=x*r-v*s;return[Zo(v*r+x*s,g*t+S*n),Uc(S*t-g*n)]},a}function J$(i){i=GD(i[0]*Hn,i[1]*Hn,i.length>2?i[2]*Hn:0);function e(t){return t=i(t[0]*Hn,t[1]*Hn),t[0]*=kr,t[1]*=kr,t}return e.invert=function(t){return t=i.invert(t[0]*Hn,t[1]*Hn),t[0]*=kr,t[1]*=kr,t},e}function eX(i,e,t,n,r,s){if(t){var a=ei(e),l=zn(e),u=n*t;r==null?(r=e+n*No,s=e-u/2):(r=k6(a,r),s=k6(a,s),(n>0?rs)&&(r+=n*No));for(var h,g=r;n>0?g>s:g1&&i.push(i.pop().concat(i.shift()))},result:function(){var t=i;return i=[],e=null,t}}}function Hv(i,e){return ir(i[0]-e[0])=0;--l)r.point((v=g[l])[0],v[1]);else n(x.x,x.p.x,-1,r);x=x.p}x=x.o,g=x.z,S=!S}while(!x.v);r.lineEnd()}}}function z6(i){if(e=i.length){for(var e,t=0,n=i[0],r;++t=0?1:-1,V=F*H,X=V>Ni,J=C*G;if(u.add(Zo(J*F*zn(V),E*k+J*ei(V))),a+=X?H+F*No:H,X^w>=t^O>=t){var te=R0(hA(S),hA(L));w_(te);var se=R0(s,te);w_(se);var ne=(X^H>=0?-1:1)*Uc(se[2]);(n>ne||n===ne&&(te[0]||te[1]))&&(l+=X^H>=0?1:-1)}}return(a<-di||a0){for(u||(r.polygonStart(),u=!0),r.lineStart(),G=0;G1&&O&2&&z.push(z.pop().concat(z.shift())),g.push(z.filter(tX))}}return x}}function tX(i){return i.length>1}function nX(i,e){return((i=i.x)[0]<0?i[1]-$a-di:$a-i[1])-((e=e.x)[0]<0?e[1]-$a-di:$a-e[1])}const G6=jD(function(){return!0},iX,sX,[-Ni,-$a]);function iX(i){var e=NaN,t=NaN,n=NaN,r;return{lineStart:function(){i.lineStart(),r=1},point:function(s,a){var l=s>0?Ni:-Ni,u=ir(s-e);ir(u-Ni)0?$a:-$a),i.point(n,t),i.lineEnd(),i.lineStart(),i.point(l,t),i.point(s,t),r=0):n!==l&&u>=Ni&&(ir(e-n)di?fM((zn(e)*(s=ei(n))*zn(t)-zn(n)*(r=ei(e))*zn(i))/(r*s*a)):(e+n)/2}function sX(i,e,t,n){var r;if(i==null)r=t*$a,n.point(-Ni,r),n.point(0,r),n.point(Ni,r),n.point(Ni,0),n.point(Ni,-r),n.point(0,-r),n.point(-Ni,-r),n.point(-Ni,0),n.point(-Ni,r);else if(ir(i[0]-e[0])>di){var s=i[0]0,r=ir(e)>di;function s(g,v,x,S){eX(S,i,t,x,g,v)}function a(g,v){return ei(g)*ei(v)>e}function l(g){var v,x,S,w,R;return{lineStart:function(){w=S=!1,R=1},point:function(C,E){var B=[C,E],L,O=a(C,E),z=n?O?0:h(C,E):O?h(C+(C<0?Ni:-Ni),E):0;if(!v&&(w=S=O)&&g.lineStart(),O!==S&&(L=u(v,B),(!L||Hv(v,L)||Hv(B,L))&&(B[2]=1)),O!==S)R=0,O?(g.lineStart(),L=u(B,v),g.point(L[0],L[1])):(L=u(v,B),g.point(L[0],L[1],2),g.lineEnd()),v=L;else if(r&&v&&n^O){var G;!(z&x)&&(G=u(B,v,!0))&&(R=0,n?(g.lineStart(),g.point(G[0][0],G[0][1]),g.point(G[1][0],G[1][1]),g.lineEnd()):(g.point(G[1][0],G[1][1]),g.lineEnd(),g.lineStart(),g.point(G[0][0],G[0][1],3)))}O&&(!v||!Hv(v,B))&&g.point(B[0],B[1]),v=B,S=O,x=z},lineEnd:function(){S&&g.lineEnd(),v=null},clean:function(){return R|(w&&S)<<1}}}function u(g,v,x){var S=hA(g),w=hA(v),R=[1,0,0],C=R0(S,w),E=Z2(C,C),B=C[0],L=E-B*B;if(!L)return!x&&g;var O=e*E/L,z=-e*B/L,G=R0(R,C),k=J2(R,O),H=J2(C,z);B3(k,H);var F=G,V=Z2(k,F),X=Z2(F,F),J=V*V-X*(Z2(k,k)-1);if(!(J<0)){var te=Lc(J),se=J2(F,(-V-te)/X);if(B3(se,k),se=T_(se),!x)return se;var ne=g[0],Z=v[0],ue=g[1],he=v[1],be;Z0^se[1]<(ir(se[0]-ne)Ni^(ne<=se[0]&&se[0]<=Z)){var We=J2(F,(-V+te)/X);return B3(We,k),[se,T_(We)]}}}function h(g,v){var x=n?i:Ni-i,S=0;return g<-x?S|=1:g>x&&(S|=2),v<-x?S|=4:v>x&&(S|=8),S}return jD(a,l,s,n?[0,-i]:[-Ni,i-Ni])}function oX(i,e,t,n,r,s){var a=i[0],l=i[1],u=e[0],h=e[1],g=0,v=1,x=u-a,S=h-l,w;if(w=t-a,!(!x&&w>0)){if(w/=x,x<0){if(w0){if(w>v)return;w>g&&(g=w)}if(w=r-a,!(!x&&w<0)){if(w/=x,x<0){if(w>v)return;w>g&&(g=w)}else if(x>0){if(w0)){if(w/=S,S<0){if(w0){if(w>v)return;w>g&&(g=w)}if(w=s-l,!(!S&&w<0)){if(w/=S,S<0){if(w>v)return;w>g&&(g=w)}else if(S>0){if(w0&&(i[0]=a+g*x,i[1]=l+g*S),v<1&&(e[0]=a+v*x,e[1]=l+v*S),!0}}}}}var bm=1e9,tv=-bm;function lX(i,e,t,n){function r(h,g){return i<=h&&h<=t&&e<=g&&g<=n}function s(h,g,v,x){var S=0,w=0;if(h==null||(S=a(h,v))!==(w=a(g,v))||u(h,g)<0^v>0)do x.point(S===0||S===3?i:t,S>1?n:e);while((S=(S+v+4)%4)!==w);else x.point(g[0],g[1])}function a(h,g){return ir(h[0]-i)0?0:3:ir(h[0]-t)0?2:1:ir(h[1]-e)0?1:0:g>0?3:2}function l(h,g){return u(h.x,g.x)}function u(h,g){var v=a(h,1),x=a(g,1);return v!==x?v-x:v===0?g[1]-h[1]:v===1?h[0]-g[0]:v===2?h[1]-g[1]:g[0]-h[0]}return function(h){var g=h,v=qD(),x,S,w,R,C,E,B,L,O,z,G,k={point:H,lineStart:J,lineEnd:te,polygonStart:V,polygonEnd:X};function H(ne,Z){r(ne,Z)&&g.point(ne,Z)}function F(){for(var ne=0,Z=0,ue=S.length;Zn&&(Te-we)*(n-We)>(ze-We)*(i-we)&&++ne:ze<=n&&(Te-we)*(n-We)<(ze-We)*(i-we)&&--ne;return ne}function V(){g=v,x=[],S=[],G=!0}function X(){var ne=F(),Z=G&&ne,ue=(x=ug(x)).length;(Z||ue)&&(h.polygonStart(),Z&&(h.lineStart(),s(null,null,1,h),h.lineEnd()),ue&&VD(x,l,ne,s,h),h.polygonEnd()),g=h,x=S=w=null}function J(){k.point=se,S&&S.push(w=[]),z=!0,O=!1,B=L=NaN}function te(){x&&(se(R,C),E&&O&&v.rejoin(),x.push(v.result())),k.point=H,O&&g.lineEnd()}function se(ne,Z){var ue=r(ne,Z);if(S&&w.push([ne,Z]),z)R=ne,C=Z,E=ue,z=!1,ue&&(g.lineStart(),g.point(ne,Z));else if(ue&&O)g.point(ne,Z);else{var he=[B=Math.max(tv,Math.min(bm,B)),L=Math.max(tv,Math.min(bm,L))],be=[ne=Math.max(tv,Math.min(bm,ne)),Z=Math.max(tv,Math.min(bm,Z))];oX(he,be,i,e,t,n)?(O||(g.lineStart(),g.point(he[0],he[1])),g.point(be[0],be[1]),ue||g.lineEnd(),G=!1):ue&&(g.lineStart(),g.point(ne,Z),G=!1)}B=ne,L=Z,O=ue}return k}}var mT,gT,jv,Wv,N0={sphere:ra,point:ra,lineStart:uX,lineEnd:ra,polygonStart:ra,polygonEnd:ra};function uX(){N0.point=hX,N0.lineEnd=cX}function cX(){N0.point=N0.lineEnd=ra}function hX(i,e){i*=Hn,e*=Hn,gT=i,jv=zn(e),Wv=ei(e),N0.point=fX}function fX(i,e){i*=Hn,e*=Hn;var t=zn(e),n=ei(e),r=ir(i-gT),s=ei(r),a=zn(r),l=n*a,u=Wv*t-jv*n*s,h=jv*t+Wv*n*s;mT.add(Zo(Lc(l*l+u*u),h)),gT=i,jv=t,Wv=n}function AX(i){return mT=new Ec,Ey(i,N0),+mT}var vT=[null,null],dX={type:"LineString",coordinates:vT};function Vh(i,e){return vT[0]=i,vT[1]=e,AX(dX)}var q6={Feature:function(i,e){return L_(i.geometry,e)},FeatureCollection:function(i,e){for(var t=i.features,n=-1,r=t.length;++n0&&(r=Vh(i[s],i[s-1]),r>0&&t<=r&&n<=r&&(t+n-r)*(1-Math.pow((t-n)/r,2))di}).map(x)).concat(jd(K2(s/h)*h,r,h).filter(function(L){return ir(L%v)>di}).map(S))}return E.lines=function(){return B().map(function(L){return{type:"LineString",coordinates:L}})},E.outline=function(){return{type:"Polygon",coordinates:[w(n).concat(R(a).slice(1),w(t).reverse().slice(1),R(l).reverse().slice(1))]}},E.extent=function(L){return arguments.length?E.extentMajor(L).extentMinor(L):E.extentMinor()},E.extentMajor=function(L){return arguments.length?(n=+L[0][0],t=+L[1][0],l=+L[0][1],a=+L[1][1],n>t&&(L=n,n=t,t=L),l>a&&(L=l,l=a,a=L),E.precision(C)):[[n,l],[t,a]]},E.extentMinor=function(L){return arguments.length?(e=+L[0][0],i=+L[1][0],s=+L[0][1],r=+L[1][1],e>i&&(L=e,e=i,i=L),s>r&&(L=s,s=r,r=L),E.precision(C)):[[e,s],[i,r]]},E.step=function(L){return arguments.length?E.stepMajor(L).stepMinor(L):E.stepMinor()},E.stepMajor=function(L){return arguments.length?(g=+L[0],v=+L[1],E):[g,v]},E.stepMinor=function(L){return arguments.length?(u=+L[0],h=+L[1],E):[u,h]},E.precision=function(L){return arguments.length?(C=+L,x=$6(s,r,90),S=X6(e,i,C),w=$6(l,a,90),R=X6(n,t,C),E):C},E.extentMajor([[-180,-90+di],[180,90-di]]).extentMinor([[-180,-80-di],[180,80+di]])}function vX(){return gX()()}function dM(i,e){var t=i[0]*Hn,n=i[1]*Hn,r=e[0]*Hn,s=e[1]*Hn,a=ei(n),l=zn(n),u=ei(s),h=zn(s),g=a*ei(t),v=a*zn(t),x=u*ei(r),S=u*zn(r),w=2*Uc(Lc(w6(s-n)+a*u*w6(r-t))),R=zn(w),C=w?function(E){var B=zn(E*=w)/R,L=zn(w-E)/R,O=L*g+B*x,z=L*v+B*S,G=L*l+B*h;return[Zo(z,O)*kr,Zo(G,Lc(O*O+z*z))*kr]}:function(){return[t*kr,n*kr]};return C.distance=w,C}const Y6=i=>i;var D0=1/0,U_=D0,Ag=-D0,B_=Ag,Q6={point:_X,lineStart:ra,lineEnd:ra,polygonStart:ra,polygonEnd:ra,result:function(){var i=[[D0,U_],[Ag,B_]];return Ag=B_=-(U_=D0=1/0),i}};function _X(i,e){iAg&&(Ag=i),eB_&&(B_=e)}function pM(i){return function(e){var t=new _T;for(var n in i)t[n]=i[n];return t.stream=e,t}}function _T(){}_T.prototype={constructor:_T,point:function(i,e){this.stream.point(i,e)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};function mM(i,e,t){var n=i.clipExtent&&i.clipExtent();return i.scale(150).translate([0,0]),n!=null&&i.clipExtent(null),Ey(t,i.stream(Q6)),e(Q6.result()),n!=null&&i.clipExtent(n),i}function $D(i,e,t){return mM(i,function(n){var r=e[1][0]-e[0][0],s=e[1][1]-e[0][1],a=Math.min(r/(n[1][0]-n[0][0]),s/(n[1][1]-n[0][1])),l=+e[0][0]+(r-a*(n[1][0]+n[0][0]))/2,u=+e[0][1]+(s-a*(n[1][1]+n[0][1]))/2;i.scale(150*a).translate([l,u])},t)}function yX(i,e,t){return $D(i,[[0,0],e],t)}function xX(i,e,t){return mM(i,function(n){var r=+e,s=r/(n[1][0]-n[0][0]),a=(r-s*(n[1][0]+n[0][0]))/2,l=-s*n[0][1];i.scale(150*s).translate([a,l])},t)}function bX(i,e,t){return mM(i,function(n){var r=+e,s=r/(n[1][1]-n[0][1]),a=-s*n[0][0],l=(r-s*(n[1][1]+n[0][1]))/2;i.scale(150*s).translate([a,l])},t)}var K6=16,SX=ei(30*Hn);function Z6(i,e){return+e?wX(i,e):TX(i)}function TX(i){return pM({point:function(e,t){e=i(e,t),this.stream.point(e[0],e[1])}})}function wX(i,e){function t(n,r,s,a,l,u,h,g,v,x,S,w,R,C){var E=h-n,B=g-r,L=E*E+B*B;if(L>4*e&&R--){var O=a+x,z=l+S,G=u+w,k=Lc(O*O+z*z+G*G),H=Uc(G/=k),F=ir(ir(G)-1)e||ir((E*te+B*se)/L-.5)>.3||a*x+l*S+u*w2?ne[2]%360*Hn:0,te()):[l*kr,u*kr,h*kr]},X.angle=function(ne){return arguments.length?(v=ne%360*Hn,te()):v*kr},X.reflectX=function(ne){return arguments.length?(x=ne?-1:1,te()):x<0},X.reflectY=function(ne){return arguments.length?(S=ne?-1:1,te()):S<0},X.precision=function(ne){return arguments.length?(G=Z6(k,z=ne*ne),se()):Lc(z)},X.fitExtent=function(ne,Z){return $D(X,ne,Z)},X.fitSize=function(ne,Z){return yX(X,ne,Z)},X.fitWidth=function(ne,Z){return xX(X,ne,Z)},X.fitHeight=function(ne,Z){return bX(X,ne,Z)};function te(){var ne=J6(t,0,0,x,S,v).apply(null,e(s,a)),Z=J6(t,n-ne[0],r-ne[1],x,S,v);return g=GD(l,u,h),k=dT(e,Z),H=dT(g,k),G=Z6(k,z),se()}function se(){return F=V=null,X}return function(){return e=i.apply(this,arguments),X.invert=e.invert&&J,te()}}function DX(i){return function(e,t){var n=Lc(e*e+t*t),r=i(n),s=zn(r),a=ei(r);return[Zo(e*s,n*a),Uc(n&&t*s/n)]}}function gM(i,e){return[i,F$(z$(($a+e)/2))]}gM.invert=function(i,e){return[i,2*fM(I$(e))-$a]};function XD(i,e){var t=ei(e),n=1+ei(i)*t;return[t*zn(i)/n,zn(e)/n]}XD.invert=DX(function(i){return 2*fM(i)});function PX(){return RX(XD).scale(250).clipAngle(142)}function yT(i,e){(e==null||e>i.length)&&(e=i.length);for(var t=0,n=Array(e);t1&&arguments[1]!==void 0?arguments[1]:0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,r=Pc().domain([1,0]).range([t,n]).clamp(!0),s=Pc().domain([I3(t),I3(n)]).range([1,0]).clamp(!0),a=function(v){return s(I3(r(v)))},l=e.array,u=0,h=l.length;u2&&arguments[2]!==void 0?arguments[2]:0,r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,s=arguments.length>4?arguments[4]:void 0,a=arguments.length>5?arguments[5]:void 0,l=[],u=Math.pow(2,e),h=360/u,g=180/u,v=s===void 0?u-1:s,x=a===void 0?u-1:a,S=n,w=Math.min(u-1,v);S<=w;S++)for(var R=r,C=Math.min(u-1,x);R<=C;R++){var E=R,B=g;if(t){E=R===0?R:tR(R/u)*u;var L=R+1===u?R+1:tR((R+1)/u)*u;B=(L-E)*180/u}var O=-180+(S+.5)*h,z=90-(E*180/u+B/2),G=B;l.push({x:S,y:R,lng:O,lat:z,latLen:G})}return l},QX=6,KX=7,ZX=3,JX=90,Ql=new WeakMap,Nh=new WeakMap,F3=new WeakMap,nv=new WeakMap,Vo=new WeakMap,I_=new WeakMap,r0=new WeakMap,Ef=new WeakMap,iv=new WeakSet,eY=(function(i){function e(t){var n,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=r.tileUrl,a=r.minLevel,l=a===void 0?0:a,u=r.maxLevel,h=u===void 0?17:u,g=r.mercatorProjection,v=g===void 0?!0:g;return IX(this,e),n=OX(this,e),FX(n,iv),xh(n,Ql,void 0),xh(n,Nh,void 0),xh(n,F3,void 0),xh(n,nv,void 0),xh(n,Vo,{}),xh(n,I_,void 0),xh(n,r0,void 0),xh(n,Ef,void 0),yd(n,"minLevel",void 0),yd(n,"maxLevel",void 0),yd(n,"thresholds",KD(new Array(30)).map(function(x,S){return 8/Math.pow(2,S)})),yd(n,"curvatureResolution",5),yd(n,"tileMargin",0),yd(n,"clearTiles",function(){Object.values(fi(Vo,n)).forEach(function(x){x.forEach(function(S){S.obj&&(n.remove(S.obj),eR(S.obj),delete S.obj)})}),bh(Vo,n,{})}),bh(Ql,n,t),n.tileUrl=s,bh(Nh,n,v),n.minLevel=l,n.maxLevel=h,n.level=0,n.add(bh(Ef,n,new zi(new Eu(fi(Ql,n)*.99,180,90),new pA({color:0})))),fi(Ef,n).visible=!1,fi(Ef,n).material.polygonOffset=!0,fi(Ef,n).material.polygonOffsetUnits=3,fi(Ef,n).material.polygonOffsetFactor=1,n}return GX(e,i),zX(e,[{key:"tileUrl",get:function(){return fi(F3,this)},set:function(n){bh(F3,this,n),this.updatePov(fi(r0,this))}},{key:"level",get:function(){return fi(nv,this)},set:function(n){var r,s=this;fi(Vo,this)[n]||Pm(iv,this,tY).call(this,n);var a=fi(nv,this);if(bh(nv,this,n),!(n===a||a===void 0)){if(fi(Ef,this).visible=n>0,fi(Vo,this)[n].forEach(function(u){return u.obj&&(u.obj.material.depthWrite=!0)}),an)for(var l=n+1;l<=a;l++)fi(Vo,this)[l]&&fi(Vo,this)[l].forEach(function(u){u.obj&&(s.remove(u.obj),eR(u.obj),delete u.obj)});Pm(iv,this,iR).call(this)}}},{key:"updatePov",value:function(n){var r=this;if(!(!n||!(n instanceof _y))){bh(r0,this,n);var s;if(bh(I_,this,function(g){if(!g.hullPnts){var v=360/Math.pow(2,r.level),x=g.lng,S=g.lat,w=g.latLen,R=x-v/2,C=x+v/2,E=S-w/2,B=S+w/2;g.hullPnts=[[S,x],[E,R],[B,R],[E,C],[B,C]].map(function(L){var O=$v(L,2),z=O[0],G=O[1];return nP(z,G,fi(Ql,r))}).map(function(L){var O=L.x,z=L.y,G=L.z;return new ce(O,z,G)})}return s||(s=new Fg,n.updateMatrix(),n.updateMatrixWorld(),s.setFromProjectionMatrix(new kn().multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse))),g.hullPnts.some(function(L){return s.containsPoint(L.clone().applyMatrix4(r.matrixWorld))})}),this.tileUrl){var a=n.position.clone(),l=a.distanceTo(this.getWorldPosition(new ce)),u=(l-fi(Ql,this))/fi(Ql,this),h=this.thresholds.findIndex(function(g){return g&&g<=u});this.level=Math.min(this.maxLevel,Math.max(this.minLevel,h<0?this.thresholds.length:h)),Pm(iv,this,iR).call(this)}}}}])})(ja);function tY(i){var e=this;if(i>KX){fi(Vo,this)[i]=[];return}var t=fi(Vo,this)[i]=bT(i,fi(Nh,this));t.forEach(function(n){return n.centroid=nP(n.lat,n.lng,fi(Ql,e))}),t.octree=mD().x(function(n){return n.centroid.x}).y(function(n){return n.centroid.y}).z(function(n){return n.centroid.z}).addAll(t)}function iR(){var i=this;if(!(!this.tileUrl||this.level===void 0||!fi(Vo,this).hasOwnProperty(this.level))&&!(!fi(I_,this)&&this.level>QX)){var e=fi(Vo,this)[this.level];if(fi(r0,this)){var t=this.worldToLocal(fi(r0,this).position.clone());if(e.octree){var n,r=this.worldToLocal(fi(r0,this).position.clone()),s=(r.length()-fi(Ql,this))*ZX;e=(n=e.octree).findAllWithinRadius.apply(n,KD(r).concat([s]))}else{var a=XX(t),l=(a.r/fi(Ql,this)-1)*JX,u=l/Math.cos(Mf(a.lat)),h=[a.lng-u,a.lng+u],g=[a.lat+l,a.lat-l],v=nR(this.level,fi(Nh,this),h[0],g[0]),x=$v(v,2),S=x[0],w=x[1],R=nR(this.level,fi(Nh,this),h[1],g[1]),C=$v(R,2),E=C[0],B=C[1];!e.record&&(e.record={});var L=e.record;if(!L.hasOwnProperty("".concat(Math.round((S+E)/2),"_").concat(Math.round((w+B)/2))))e=bT(this.level,fi(Nh,this),S,w,E,B).map(function(H){var F="".concat(H.x,"_").concat(H.y);return L.hasOwnProperty(F)?L[F]:(L[F]=H,e.push(H),H)});else{for(var O=[],z=S;z<=E;z++)for(var G=w;G<=B;G++){var k="".concat(z,"_").concat(G);L.hasOwnProperty(k)||(L[k]=bT(this.level,fi(Nh,this),z,G,z,G)[0],e.push(L[k])),O.push(L[k])}e=O}}}e.filter(function(H){return!H.obj}).filter(fi(I_,this)||function(){return!0}).forEach(function(H){var F=H.x,V=H.y,X=H.lng,J=H.lat,te=H.latLen,se=360/Math.pow(2,i.level);if(!H.obj){var ne=se*(1-i.tileMargin),Z=te*(1-i.tileMargin),ue=Mf(X),he=Mf(-J),be=new zi(new Eu(fi(Ql,i),Math.ceil(ne/i.curvatureResolution),Math.ceil(Z/i.curvatureResolution),Mf(90-ne/2)+ue,Mf(ne),Mf(90-Z/2)+he,Mf(Z)),new Vc);if(fi(Nh,i)){var Se=[J+te/2,J-te/2].map(function(Te){return .5-Te/180}),le=$v(Se,2),we=le[0],We=le[1];YX(be.geometry.attributes.uv,we,We)}H.obj=be}H.loading||(H.loading=!0,new iM().load(i.tileUrl(F,V,i.level),function(Te){var ze=H.obj;ze&&(Te.colorSpace=_n,ze.material.map=Te,ze.material.color=null,ze.material.needsUpdate=!0,i.add(ze)),H.loading=!1}))})}}function nY(i,e,t=2){const n=e&&e.length,r=n?e[0]*t:i.length;let s=rP(i,0,r,t,!0);const a=[];if(!s||s.next===s.prev)return a;let l,u,h;if(n&&(s=oY(i,e,s,t)),i.length>80*t){l=i[0],u=i[1];let g=l,v=u;for(let x=t;xg&&(g=S),w>v&&(v=w)}h=Math.max(g-l,v-u),h=h!==0?32767/h:0}return dg(s,a,t,l,u,h,0),a}function rP(i,e,t,n,r){let s;if(r===vY(i,e,t,n)>0)for(let a=e;a=e;a-=n)s=rR(a/n|0,i[a],i[a+1],s);return s&&P0(s,s.next)&&(mg(s),s=s.next),s}function fA(i,e){if(!i)return i;e||(e=i);let t=i,n;do if(n=!1,!t.steiner&&(P0(t,t.next)||Dr(t.prev,t,t.next)===0)){if(mg(t),t=e=t.prev,t===t.next)break;n=!0}else t=t.next;while(n||t!==e);return e}function dg(i,e,t,n,r,s,a){if(!i)return;!a&&s&&fY(i,n,r,s);let l=i;for(;i.prev!==i.next;){const u=i.prev,h=i.next;if(s?rY(i,n,r,s):iY(i)){e.push(u.i,i.i,h.i),mg(i),i=h.next,l=h.next;continue}if(i=h,i===l){a?a===1?(i=sY(fA(i),e),dg(i,e,t,n,r,s,2)):a===2&&aY(i,e,t,n,r,s):dg(fA(i),e,t,n,r,s,1);break}}}function iY(i){const e=i.prev,t=i,n=i.next;if(Dr(e,t,n)>=0)return!1;const r=e.x,s=t.x,a=n.x,l=e.y,u=t.y,h=n.y,g=Math.min(r,s,a),v=Math.min(l,u,h),x=Math.max(r,s,a),S=Math.max(l,u,h);let w=n.next;for(;w!==e;){if(w.x>=g&&w.x<=x&&w.y>=v&&w.y<=S&&Sm(r,l,s,u,a,h,w.x,w.y)&&Dr(w.prev,w,w.next)>=0)return!1;w=w.next}return!0}function rY(i,e,t,n){const r=i.prev,s=i,a=i.next;if(Dr(r,s,a)>=0)return!1;const l=r.x,u=s.x,h=a.x,g=r.y,v=s.y,x=a.y,S=Math.min(l,u,h),w=Math.min(g,v,x),R=Math.max(l,u,h),C=Math.max(g,v,x),E=ST(S,w,e,t,n),B=ST(R,C,e,t,n);let L=i.prevZ,O=i.nextZ;for(;L&&L.z>=E&&O&&O.z<=B;){if(L.x>=S&&L.x<=R&&L.y>=w&&L.y<=C&&L!==r&&L!==a&&Sm(l,g,u,v,h,x,L.x,L.y)&&Dr(L.prev,L,L.next)>=0||(L=L.prevZ,O.x>=S&&O.x<=R&&O.y>=w&&O.y<=C&&O!==r&&O!==a&&Sm(l,g,u,v,h,x,O.x,O.y)&&Dr(O.prev,O,O.next)>=0))return!1;O=O.nextZ}for(;L&&L.z>=E;){if(L.x>=S&&L.x<=R&&L.y>=w&&L.y<=C&&L!==r&&L!==a&&Sm(l,g,u,v,h,x,L.x,L.y)&&Dr(L.prev,L,L.next)>=0)return!1;L=L.prevZ}for(;O&&O.z<=B;){if(O.x>=S&&O.x<=R&&O.y>=w&&O.y<=C&&O!==r&&O!==a&&Sm(l,g,u,v,h,x,O.x,O.y)&&Dr(O.prev,O,O.next)>=0)return!1;O=O.nextZ}return!0}function sY(i,e){let t=i;do{const n=t.prev,r=t.next.next;!P0(n,r)&&aP(n,t,t.next,r)&&pg(n,r)&&pg(r,n)&&(e.push(n.i,t.i,r.i),mg(t),mg(t.next),t=i=r),t=t.next}while(t!==i);return fA(t)}function aY(i,e,t,n,r,s){let a=i;do{let l=a.next.next;for(;l!==a.prev;){if(a.i!==l.i&&pY(a,l)){let u=oP(a,l);a=fA(a,a.next),u=fA(u,u.next),dg(a,e,t,n,r,s,0),dg(u,e,t,n,r,s,0);return}l=l.next}a=a.next}while(a!==i)}function oY(i,e,t,n){const r=[];for(let s=0,a=e.length;s=t.next.y&&t.next.y!==t.y){const v=t.x+(r-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(v<=n&&v>s&&(s=v,a=t.x=t.x&&t.x>=u&&n!==t.x&&sP(ra.x||t.x===a.x&&hY(a,t)))&&(a=t,g=v)}t=t.next}while(t!==l);return a}function hY(i,e){return Dr(i.prev,i,e.prev)<0&&Dr(e.next,i,i.next)<0}function fY(i,e,t,n){let r=i;do r.z===0&&(r.z=ST(r.x,r.y,e,t,n)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next;while(r!==i);r.prevZ.nextZ=null,r.prevZ=null,AY(r)}function AY(i){let e,t=1;do{let n=i,r;i=null;let s=null;for(e=0;n;){e++;let a=n,l=0;for(let h=0;h0||u>0&&a;)l!==0&&(u===0||!a||n.z<=a.z)?(r=n,n=n.nextZ,l--):(r=a,a=a.nextZ,u--),s?s.nextZ=r:i=r,r.prevZ=s,s=r;n=a}s.nextZ=null,t*=2}while(e>1);return i}function ST(i,e,t,n,r){return i=(i-t)*r|0,e=(e-n)*r|0,i=(i|i<<8)&16711935,i=(i|i<<4)&252645135,i=(i|i<<2)&858993459,i=(i|i<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,i|e<<1}function dY(i){let e=i,t=i;do(e.x=(i-a)*(s-l)&&(i-a)*(n-l)>=(t-a)*(e-l)&&(t-a)*(s-l)>=(r-a)*(n-l)}function Sm(i,e,t,n,r,s,a,l){return!(i===a&&e===l)&&sP(i,e,t,n,r,s,a,l)}function pY(i,e){return i.next.i!==e.i&&i.prev.i!==e.i&&!mY(i,e)&&(pg(i,e)&&pg(e,i)&&gY(i,e)&&(Dr(i.prev,i,e.prev)||Dr(i,e.prev,e))||P0(i,e)&&Dr(i.prev,i,i.next)>0&&Dr(e.prev,e,e.next)>0)}function Dr(i,e,t){return(e.y-i.y)*(t.x-e.x)-(e.x-i.x)*(t.y-e.y)}function P0(i,e){return i.x===e.x&&i.y===e.y}function aP(i,e,t,n){const r=sv(Dr(i,e,t)),s=sv(Dr(i,e,n)),a=sv(Dr(t,n,i)),l=sv(Dr(t,n,e));return!!(r!==s&&a!==l||r===0&&rv(i,t,e)||s===0&&rv(i,n,e)||a===0&&rv(t,i,n)||l===0&&rv(t,e,n))}function rv(i,e,t){return e.x<=Math.max(i.x,t.x)&&e.x>=Math.min(i.x,t.x)&&e.y<=Math.max(i.y,t.y)&&e.y>=Math.min(i.y,t.y)}function sv(i){return i>0?1:i<0?-1:0}function mY(i,e){let t=i;do{if(t.i!==i.i&&t.next.i!==i.i&&t.i!==e.i&&t.next.i!==e.i&&aP(t,t.next,i,e))return!0;t=t.next}while(t!==i);return!1}function pg(i,e){return Dr(i.prev,i,i.next)<0?Dr(i,e,i.next)>=0&&Dr(i,i.prev,e)>=0:Dr(i,e,i.prev)<0||Dr(i,i.next,e)<0}function gY(i,e){let t=i,n=!1;const r=(i.x+e.x)/2,s=(i.y+e.y)/2;do t.y>s!=t.next.y>s&&t.next.y!==t.y&&r<(t.next.x-t.x)*(s-t.y)/(t.next.y-t.y)+t.x&&(n=!n),t=t.next;while(t!==i);return n}function oP(i,e){const t=TT(i.i,i.x,i.y),n=TT(e.i,e.x,e.y),r=i.next,s=e.prev;return i.next=e,e.prev=i,t.next=r,r.prev=t,n.next=t,t.prev=n,s.next=n,n.prev=s,n}function rR(i,e,t,n){const r=TT(i,e,t);return n?(r.next=n.next,r.prev=n,n.next.prev=r,n.next=r):(r.prev=r,r.next=r),r}function mg(i){i.next.prev=i.prev,i.prev.next=i.next,i.prevZ&&(i.prevZ.nextZ=i.nextZ),i.nextZ&&(i.nextZ.prevZ=i.prevZ)}function TT(i,e,t){return{i,x:e,y:t,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function vY(i,e,t,n){let r=0;for(let s=e,a=t-n;si.length)&&(e=i.length);for(var t=0,n=Array(e);t=i.length?{done:!0}:{done:!1,value:i[n++]}},e:function(u){throw u},f:r}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var s,a=!0,l=!1;return{s:function(){t=t.call(i)},n:function(){var u=t.next();return a=u.done,u},e:function(u){l=!0,s=u},f:function(){try{a||t.return==null||t.return()}finally{if(l)throw s}}}}function k_(i){return k_=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},k_(i)}function MY(i,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");i.prototype=Object.create(e&&e.prototype,{constructor:{value:i,writable:!0,configurable:!0}}),Object.defineProperty(i,"prototype",{writable:!1}),e&&MT(i,e)}function lP(){try{var i=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(lP=function(){return!!i})()}function EY(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function CY(i,e){var t=i==null?null:typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(t!=null){var n,r,s,a,l=[],u=!0,h=!1;try{if(s=(t=t.call(i)).next,e===0){if(Object(t)!==t)return;u=!1}else for(;!(u=(n=s.call(t)).done)&&(l.push(n.value),l.length!==e);u=!0);}catch(g){h=!0,r=g}finally{try{if(!u&&t.return!=null&&(a=t.return(),Object(a)!==a))return}finally{if(h)throw r}}return l}}function RY(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function NY(){throw new TypeError(`Invalid attempt to spread non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function DY(i,e){if(e&&(typeof e=="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return xY(i)}function MT(i,e){return MT=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},MT(i,e)}function nm(i,e){return _Y(i)||CY(i,e)||vM(i,e)||RY()}function PY(i){return yY(i)||EY(i)||vM(i)||NY()}function vM(i,e){if(i){if(typeof i=="string")return wT(i,e);var t={}.toString.call(i).slice(8,-1);return t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set"?Array.from(i):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?wT(i,e):void 0}}var sR=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,n=[],r=null;return e.forEach(function(s){if(r){var a=Vh(s,r)*180/Math.PI;if(a>t)for(var l=dM(r,s),u=r.length>2||s.length>2?fg(r[2]||0,s[2]||0):null,h=u?function(x){return[].concat(PY(l(x)),[u(x)])}:l,g=1/Math.ceil(a/t),v=g;v<1;)n.push(h(v)),v+=g}n.push(r=s)}),n},ET=typeof window<"u"&&window.THREE?window.THREE:{BufferGeometry:Ki,Float32BufferAttribute:wi},LY=new ET.BufferGeometry().setAttribute?"setAttribute":"addAttribute",uP=(function(i){function e(t){var n,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:5;SY(this,e),n=bY(this,e),n.type="GeoJsonGeometry",n.parameters={geoJson:t,radius:r,resolution:s};var a=({Point:g,MultiPoint:v,LineString:x,MultiLineString:S,Polygon:w,MultiPolygon:R}[t.type]||function(){return[]})(t.coordinates,r),l=[],u=[],h=0;a.forEach(function(C){var E=l.length;im({indices:l,vertices:u},C),n.addGroup(E,l.length-E,h++)}),l.length&&n.setIndex(l),u.length&&n[LY]("position",new ET.Float32BufferAttribute(u,3));function g(C,E){var B=k3(C[1],C[0],E+(C[2]||0)),L=[];return[{vertices:B,indices:L}]}function v(C,E){var B={vertices:[],indices:[]};return C.map(function(L){return g(L,E)}).forEach(function(L){var O=nm(L,1),z=O[0];im(B,z)}),[B]}function x(C,E){for(var B=sR(C,s).map(function(H){var F=nm(H,3),V=F[0],X=F[1],J=F[2],te=J===void 0?0:J;return k3(X,V,E+te)}),L=F_([B]),O=L.vertices,z=Math.round(O.length/3),G=[],k=1;k2&&arguments[2]!==void 0?arguments[2]:0,n=(90-i)*Math.PI/180,r=(90-e)*Math.PI/180;return[t*Math.sin(n)*Math.cos(r),t*Math.cos(n),t*Math.sin(n)*Math.sin(r)]}function UY(i,e,t=!0){if(!e||!e.isReady)throw new Error("BufferGeometryUtils: Initialized MikkTSpace library required.");if(!i.hasAttribute("position")||!i.hasAttribute("normal")||!i.hasAttribute("uv"))throw new Error('BufferGeometryUtils: Tangents require "position", "normal", and "uv" attributes.');function n(a){if(a.normalized||a.isInterleavedBufferAttribute){const l=new Float32Array(a.count*a.itemSize);for(let u=0,h=0;u2&&(l[h++]=a.getZ(u));return l}return a.array instanceof Float32Array?a.array:new Float32Array(a.array)}const r=i.index?i.toNonIndexed():i,s=e.generateTangents(n(r.attributes.position),n(r.attributes.normal),n(r.attributes.uv));if(t)for(let a=3;a=2&&a.setY(l,i.getY(l)),n>=3&&a.setZ(l,i.getZ(l)),n>=4&&a.setW(l,i.getW(l));return a}function FY(i){const e=i.attributes,t=i.morphTargets,n=new Map;for(const r in e){const s=e[r];s.isInterleavedBufferAttribute&&(n.has(s)||n.set(s,z_(s)),e[r]=n.get(s))}for(const r in t){const s=t[r];s.isInterleavedBufferAttribute&&(n.has(s)||n.set(s,z_(s)),t[r]=n.get(s))}}function kY(i){let e=0;for(const n in i.attributes){const r=i.getAttribute(n);e+=r.count*r.itemSize*r.array.BYTES_PER_ELEMENT}const t=i.getIndex();return e+=t?t.count*t.itemSize*t.array.BYTES_PER_ELEMENT:0,e}function zY(i,e=1e-4){e=Math.max(e,Number.EPSILON);const t={},n=i.getIndex(),r=i.getAttribute("position"),s=n?n.count:r.count;let a=0;const l=Object.keys(i.attributes),u={},h={},g=[],v=["getX","getY","getZ","getW"],x=["setX","setY","setZ","setW"];for(let B=0,L=l.length;B{const F=new k.array.constructor(k.count*k.itemSize);h[O][H]=new k.constructor(F,k.itemSize,k.normalized)}))}const S=e*.5,w=Math.log10(1/e),R=Math.pow(10,w),C=S*R;for(let B=0;Ba.materialIndex!==l.materialIndex?a.materialIndex-l.materialIndex:a.start-l.start),i.getIndex()===null){const a=i.getAttribute("position"),l=[];for(let u=0;ut&&u.add(X)}u.normalize(),w.setXYZ(E+z,u.x,u.y,u.z)}}return g.setAttribute("normal",w),g}const _M=Object.freeze(Object.defineProperty({__proto__:null,computeMikkTSpaceTangents:UY,computeMorphedAttributes:qY,deepCloneAttribute:OY,deinterleaveAttribute:z_,deinterleaveGeometry:FY,estimateBytesUsed:kY,interleaveAttributes:IY,mergeAttributes:CT,mergeGeometries:BY,mergeGroups:VY,mergeVertices:zY,toCreasedNormals:HY,toTrianglesDrawMode:GY},Symbol.toStringTag,{value:"Module"}));var Ct=(function(i){return typeof i=="function"?i:typeof i=="string"?function(e){return e[i]}:function(e){return i}});function G_(i){"@babel/helpers - typeof";return G_=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},G_(i)}var jY=/^\s+/,WY=/\s+$/;function yn(i,e){if(i=i||"",e=e||{},i instanceof yn)return i;if(!(this instanceof yn))return new yn(i,e);var t=$Y(i);this._originalInput=i,this._r=t.r,this._g=t.g,this._b=t.b,this._a=t.a,this._roundA=Math.round(100*this._a)/100,this._format=e.format||t.format,this._gradientType=e.gradientType,this._r<1&&(this._r=Math.round(this._r)),this._g<1&&(this._g=Math.round(this._g)),this._b<1&&(this._b=Math.round(this._b)),this._ok=t.ok}yn.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var e=this.toRgb();return(e.r*299+e.g*587+e.b*114)/1e3},getLuminance:function(){var e=this.toRgb(),t,n,r,s,a,l;return t=e.r/255,n=e.g/255,r=e.b/255,t<=.03928?s=t/12.92:s=Math.pow((t+.055)/1.055,2.4),n<=.03928?a=n/12.92:a=Math.pow((n+.055)/1.055,2.4),r<=.03928?l=r/12.92:l=Math.pow((r+.055)/1.055,2.4),.2126*s+.7152*a+.0722*l},setAlpha:function(e){return this._a=cP(e),this._roundA=Math.round(100*this._a)/100,this},toHsv:function(){var e=lR(this._r,this._g,this._b);return{h:e.h*360,s:e.s,v:e.v,a:this._a}},toHsvString:function(){var e=lR(this._r,this._g,this._b),t=Math.round(e.h*360),n=Math.round(e.s*100),r=Math.round(e.v*100);return this._a==1?"hsv("+t+", "+n+"%, "+r+"%)":"hsva("+t+", "+n+"%, "+r+"%, "+this._roundA+")"},toHsl:function(){var e=oR(this._r,this._g,this._b);return{h:e.h*360,s:e.s,l:e.l,a:this._a}},toHslString:function(){var e=oR(this._r,this._g,this._b),t=Math.round(e.h*360),n=Math.round(e.s*100),r=Math.round(e.l*100);return this._a==1?"hsl("+t+", "+n+"%, "+r+"%)":"hsla("+t+", "+n+"%, "+r+"%, "+this._roundA+")"},toHex:function(e){return uR(this._r,this._g,this._b,e)},toHexString:function(e){return"#"+this.toHex(e)},toHex8:function(e){return KY(this._r,this._g,this._b,this._a,e)},toHex8String:function(e){return"#"+this.toHex8(e)},toRgb:function(){return{r:Math.round(this._r),g:Math.round(this._g),b:Math.round(this._b),a:this._a}},toRgbString:function(){return this._a==1?"rgb("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+")":"rgba("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:Math.round(Sr(this._r,255)*100)+"%",g:Math.round(Sr(this._g,255)*100)+"%",b:Math.round(Sr(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function(){return this._a==1?"rgb("+Math.round(Sr(this._r,255)*100)+"%, "+Math.round(Sr(this._g,255)*100)+"%, "+Math.round(Sr(this._b,255)*100)+"%)":"rgba("+Math.round(Sr(this._r,255)*100)+"%, "+Math.round(Sr(this._g,255)*100)+"%, "+Math.round(Sr(this._b,255)*100)+"%, "+this._roundA+")"},toName:function(){return this._a===0?"transparent":this._a<1?!1:uQ[uR(this._r,this._g,this._b,!0)]||!1},toFilter:function(e){var t="#"+cR(this._r,this._g,this._b,this._a),n=t,r=this._gradientType?"GradientType = 1, ":"";if(e){var s=yn(e);n="#"+cR(s._r,s._g,s._b,s._a)}return"progid:DXImageTransform.Microsoft.gradient("+r+"startColorstr="+t+",endColorstr="+n+")"},toString:function(e){var t=!!e;e=e||this._format;var n=!1,r=this._a<1&&this._a>=0,s=!t&&r&&(e==="hex"||e==="hex6"||e==="hex3"||e==="hex4"||e==="hex8"||e==="name");return s?e==="name"&&this._a===0?this.toName():this.toRgbString():(e==="rgb"&&(n=this.toRgbString()),e==="prgb"&&(n=this.toPercentageRgbString()),(e==="hex"||e==="hex6")&&(n=this.toHexString()),e==="hex3"&&(n=this.toHexString(!0)),e==="hex4"&&(n=this.toHex8String(!0)),e==="hex8"&&(n=this.toHex8String()),e==="name"&&(n=this.toName()),e==="hsl"&&(n=this.toHslString()),e==="hsv"&&(n=this.toHsvString()),n||this.toHexString())},clone:function(){return yn(this.toString())},_applyModification:function(e,t){var n=e.apply(null,[this].concat([].slice.call(t)));return this._r=n._r,this._g=n._g,this._b=n._b,this.setAlpha(n._a),this},lighten:function(){return this._applyModification(tQ,arguments)},brighten:function(){return this._applyModification(nQ,arguments)},darken:function(){return this._applyModification(iQ,arguments)},desaturate:function(){return this._applyModification(ZY,arguments)},saturate:function(){return this._applyModification(JY,arguments)},greyscale:function(){return this._applyModification(eQ,arguments)},spin:function(){return this._applyModification(rQ,arguments)},_applyCombination:function(e,t){return e.apply(null,[this].concat([].slice.call(t)))},analogous:function(){return this._applyCombination(oQ,arguments)},complement:function(){return this._applyCombination(sQ,arguments)},monochromatic:function(){return this._applyCombination(lQ,arguments)},splitcomplement:function(){return this._applyCombination(aQ,arguments)},triad:function(){return this._applyCombination(hR,[3])},tetrad:function(){return this._applyCombination(hR,[4])}};yn.fromRatio=function(i,e){if(G_(i)=="object"){var t={};for(var n in i)i.hasOwnProperty(n)&&(n==="a"?t[n]=i[n]:t[n]=Tm(i[n]));i=t}return yn(i,e)};function $Y(i){var e={r:0,g:0,b:0},t=1,n=null,r=null,s=null,a=!1,l=!1;return typeof i=="string"&&(i=AQ(i)),G_(i)=="object"&&(gc(i.r)&&gc(i.g)&&gc(i.b)?(e=XY(i.r,i.g,i.b),a=!0,l=String(i.r).substr(-1)==="%"?"prgb":"rgb"):gc(i.h)&&gc(i.s)&&gc(i.v)?(n=Tm(i.s),r=Tm(i.v),e=QY(i.h,n,r),a=!0,l="hsv"):gc(i.h)&&gc(i.s)&&gc(i.l)&&(n=Tm(i.s),s=Tm(i.l),e=YY(i.h,n,s),a=!0,l="hsl"),i.hasOwnProperty("a")&&(t=i.a)),t=cP(t),{ok:a,format:i.format||l,r:Math.min(255,Math.max(e.r,0)),g:Math.min(255,Math.max(e.g,0)),b:Math.min(255,Math.max(e.b,0)),a:t}}function XY(i,e,t){return{r:Sr(i,255)*255,g:Sr(e,255)*255,b:Sr(t,255)*255}}function oR(i,e,t){i=Sr(i,255),e=Sr(e,255),t=Sr(t,255);var n=Math.max(i,e,t),r=Math.min(i,e,t),s,a,l=(n+r)/2;if(n==r)s=a=0;else{var u=n-r;switch(a=l>.5?u/(2-n-r):u/(n+r),n){case i:s=(e-t)/u+(e1&&(v-=1),v<1/6?h+(g-h)*6*v:v<1/2?g:v<2/3?h+(g-h)*(2/3-v)*6:h}if(e===0)n=r=s=t;else{var l=t<.5?t*(1+e):t+e-t*e,u=2*t-l;n=a(u,l,i+1/3),r=a(u,l,i),s=a(u,l,i-1/3)}return{r:n*255,g:r*255,b:s*255}}function lR(i,e,t){i=Sr(i,255),e=Sr(e,255),t=Sr(t,255);var n=Math.max(i,e,t),r=Math.min(i,e,t),s,a,l=n,u=n-r;if(a=n===0?0:u/n,n==r)s=0;else{switch(n){case i:s=(e-t)/u+(e>1)+720)%360;--e;)n.h=(n.h+r)%360,s.push(yn(n));return s}function lQ(i,e){e=e||6;for(var t=yn(i).toHsv(),n=t.h,r=t.s,s=t.v,a=[],l=1/e;e--;)a.push(yn({h:n,s:r,v:s})),s=(s+l)%1;return a}yn.mix=function(i,e,t){t=t===0?0:t||50;var n=yn(i).toRgb(),r=yn(e).toRgb(),s=t/100,a={r:(r.r-n.r)*s+n.r,g:(r.g-n.g)*s+n.g,b:(r.b-n.b)*s+n.b,a:(r.a-n.a)*s+n.a};return yn(a)};yn.readability=function(i,e){var t=yn(i),n=yn(e);return(Math.max(t.getLuminance(),n.getLuminance())+.05)/(Math.min(t.getLuminance(),n.getLuminance())+.05)};yn.isReadable=function(i,e,t){var n=yn.readability(i,e),r,s;switch(s=!1,r=dQ(t),r.level+r.size){case"AAsmall":case"AAAlarge":s=n>=4.5;break;case"AAlarge":s=n>=3;break;case"AAAsmall":s=n>=7;break}return s};yn.mostReadable=function(i,e,t){var n=null,r=0,s,a,l,u;t=t||{},a=t.includeFallbackColors,l=t.level,u=t.size;for(var h=0;hr&&(r=s,n=yn(e[h]));return yn.isReadable(i,n,{level:l,size:u})||!a?n:(t.includeFallbackColors=!1,yn.mostReadable(i,["#fff","#000"],t))};var RT=yn.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},uQ=yn.hexNames=cQ(RT);function cQ(i){var e={};for(var t in i)i.hasOwnProperty(t)&&(e[i[t]]=t);return e}function cP(i){return i=parseFloat(i),(isNaN(i)||i<0||i>1)&&(i=1),i}function Sr(i,e){hQ(i)&&(i="100%");var t=fQ(i);return i=Math.min(e,Math.max(0,parseFloat(i))),t&&(i=parseInt(i*e,10)/100),Math.abs(i-e)<1e-6?1:i%e/parseFloat(e)}function Cy(i){return Math.min(1,Math.max(0,i))}function _o(i){return parseInt(i,16)}function hQ(i){return typeof i=="string"&&i.indexOf(".")!=-1&&parseFloat(i)===1}function fQ(i){return typeof i=="string"&&i.indexOf("%")!=-1}function El(i){return i.length==1?"0"+i:""+i}function Tm(i){return i<=1&&(i=i*100+"%"),i}function hP(i){return Math.round(parseFloat(i)*255).toString(16)}function fR(i){return _o(i)/255}var bl=(function(){var i="[-\\+]?\\d+%?",e="[-\\+]?\\d*\\.\\d+%?",t="(?:"+e+")|(?:"+i+")",n="[\\s|\\(]+("+t+")[,|\\s]+("+t+")[,|\\s]+("+t+")\\s*\\)?",r="[\\s|\\(]+("+t+")[,|\\s]+("+t+")[,|\\s]+("+t+")[,|\\s]+("+t+")\\s*\\)?";return{CSS_UNIT:new RegExp(t),rgb:new RegExp("rgb"+n),rgba:new RegExp("rgba"+r),hsl:new RegExp("hsl"+n),hsla:new RegExp("hsla"+r),hsv:new RegExp("hsv"+n),hsva:new RegExp("hsva"+r),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}})();function gc(i){return!!bl.CSS_UNIT.exec(i)}function AQ(i){i=i.replace(jY,"").replace(WY,"").toLowerCase();var e=!1;if(RT[i])i=RT[i],e=!0;else if(i=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var t;return(t=bl.rgb.exec(i))?{r:t[1],g:t[2],b:t[3]}:(t=bl.rgba.exec(i))?{r:t[1],g:t[2],b:t[3],a:t[4]}:(t=bl.hsl.exec(i))?{h:t[1],s:t[2],l:t[3]}:(t=bl.hsla.exec(i))?{h:t[1],s:t[2],l:t[3],a:t[4]}:(t=bl.hsv.exec(i))?{h:t[1],s:t[2],v:t[3]}:(t=bl.hsva.exec(i))?{h:t[1],s:t[2],v:t[3],a:t[4]}:(t=bl.hex8.exec(i))?{r:_o(t[1]),g:_o(t[2]),b:_o(t[3]),a:fR(t[4]),format:e?"name":"hex8"}:(t=bl.hex6.exec(i))?{r:_o(t[1]),g:_o(t[2]),b:_o(t[3]),format:e?"name":"hex"}:(t=bl.hex4.exec(i))?{r:_o(t[1]+""+t[1]),g:_o(t[2]+""+t[2]),b:_o(t[3]+""+t[3]),a:fR(t[4]+""+t[4]),format:e?"name":"hex8"}:(t=bl.hex3.exec(i))?{r:_o(t[1]+""+t[1]),g:_o(t[2]+""+t[2]),b:_o(t[3]+""+t[3]),format:e?"name":"hex"}:!1}function dQ(i){var e,t;return i=i||{level:"AA",size:"small"},e=(i.level||"AA").toUpperCase(),t=(i.size||"small").toLowerCase(),e!=="AA"&&e!=="AAA"&&(e="AA"),t!=="small"&&t!=="large"&&(t="small"),{level:e,size:t}}function NT(i,e){(e==null||e>i.length)&&(e=i.length);for(var t=0,n=Array(e);t0&&arguments[0]!==void 0?arguments[0]:[],t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,n=[],r=null;return e.forEach(function(s){if(r){var a=Vh(s,r)*180/Math.PI;if(a>t)for(var l=dM(r,s),u=r.length>2||s.length>2?fg(r[2]||0,s[2]||0):null,h=u?function(x){return[].concat(PY(l(x)),[u(x)])}:l,g=1/Math.ceil(a/t),v=g;v<1;)n.push(h(v)),v+=g}n.push(r=s)}),n},ET=typeof window<"u"&&window.THREE?window.THREE:{BufferGeometry:Ki,Float32BufferAttribute:wi},LY=new ET.BufferGeometry().setAttribute?"setAttribute":"addAttribute",uP=(function(i){function e(t){var n,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:5;SY(this,e),n=bY(this,e),n.type="GeoJsonGeometry",n.parameters={geoJson:t,radius:r,resolution:s};var a=({Point:g,MultiPoint:v,LineString:x,MultiLineString:S,Polygon:w,MultiPolygon:R}[t.type]||function(){return[]})(t.coordinates,r),l=[],u=[],h=0;a.forEach(function(C){var E=l.length;im({indices:l,vertices:u},C),n.addGroup(E,l.length-E,h++)}),l.length&&n.setIndex(l),u.length&&n[LY]("position",new ET.Float32BufferAttribute(u,3));function g(C,E){var B=k3(C[1],C[0],E+(C[2]||0)),L=[];return[{vertices:B,indices:L}]}function v(C,E){var B={vertices:[],indices:[]};return C.map(function(L){return g(L,E)}).forEach(function(L){var O=nm(L,1),z=O[0];im(B,z)}),[B]}function x(C,E){for(var B=sR(C,s).map(function(H){var F=nm(H,3),V=F[0],X=F[1],J=F[2],te=J===void 0?0:J;return k3(X,V,E+te)}),L=F_([B]),O=L.vertices,z=Math.round(O.length/3),G=[],k=1;k2&&arguments[2]!==void 0?arguments[2]:0,n=(90-i)*Math.PI/180,r=(90-e)*Math.PI/180;return[t*Math.sin(n)*Math.cos(r),t*Math.cos(n),t*Math.sin(n)*Math.sin(r)]}function UY(i,e,t=!0){if(!e||!e.isReady)throw new Error("BufferGeometryUtils: Initialized MikkTSpace library required.");if(!i.hasAttribute("position")||!i.hasAttribute("normal")||!i.hasAttribute("uv"))throw new Error('BufferGeometryUtils: Tangents require "position", "normal", and "uv" attributes.');function n(a){if(a.normalized||a.isInterleavedBufferAttribute){const l=new Float32Array(a.count*a.itemSize);for(let u=0,h=0;u2&&(l[h++]=a.getZ(u));return l}return a.array instanceof Float32Array?a.array:new Float32Array(a.array)}const r=i.index?i.toNonIndexed():i,s=e.generateTangents(n(r.attributes.position),n(r.attributes.normal),n(r.attributes.uv));if(t)for(let a=3;a=2&&a.setY(l,i.getY(l)),n>=3&&a.setZ(l,i.getZ(l)),n>=4&&a.setW(l,i.getW(l));return a}function FY(i){const e=i.attributes,t=i.morphTargets,n=new Map;for(const r in e){const s=e[r];s.isInterleavedBufferAttribute&&(n.has(s)||n.set(s,z_(s)),e[r]=n.get(s))}for(const r in t){const s=t[r];s.isInterleavedBufferAttribute&&(n.has(s)||n.set(s,z_(s)),t[r]=n.get(s))}}function kY(i){let e=0;for(const n in i.attributes){const r=i.getAttribute(n);e+=r.count*r.itemSize*r.array.BYTES_PER_ELEMENT}const t=i.getIndex();return e+=t?t.count*t.itemSize*t.array.BYTES_PER_ELEMENT:0,e}function zY(i,e=1e-4){e=Math.max(e,Number.EPSILON);const t={},n=i.getIndex(),r=i.getAttribute("position"),s=n?n.count:r.count;let a=0;const l=Object.keys(i.attributes),u={},h={},g=[],v=["getX","getY","getZ","getW"],x=["setX","setY","setZ","setW"];for(let B=0,L=l.length;B{const F=new k.array.constructor(k.count*k.itemSize);h[O][H]=new k.constructor(F,k.itemSize,k.normalized)}))}const S=e*.5,w=Math.log10(1/e),R=Math.pow(10,w),C=S*R;for(let B=0;Ba.materialIndex!==l.materialIndex?a.materialIndex-l.materialIndex:a.start-l.start),i.getIndex()===null){const a=i.getAttribute("position"),l=[];for(let u=0;ut&&u.add(X)}u.normalize(),w.setXYZ(E+z,u.x,u.y,u.z)}}return g.setAttribute("normal",w),g}const _M=Object.freeze(Object.defineProperty({__proto__:null,computeMikkTSpaceTangents:UY,computeMorphedAttributes:qY,deepCloneAttribute:OY,deinterleaveAttribute:z_,deinterleaveGeometry:FY,estimateBytesUsed:kY,interleaveAttributes:IY,mergeAttributes:CT,mergeGeometries:BY,mergeGroups:VY,mergeVertices:zY,toCreasedNormals:HY,toTrianglesDrawMode:GY},Symbol.toStringTag,{value:"Module"}));var Ct=(function(i){return typeof i=="function"?i:typeof i=="string"?function(e){return e[i]}:function(e){return i}});function G_(i){"@babel/helpers - typeof";return G_=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},G_(i)}var jY=/^\s+/,WY=/\s+$/;function yn(i,e){if(i=i||"",e=e||{},i instanceof yn)return i;if(!(this instanceof yn))return new yn(i,e);var t=$Y(i);this._originalInput=i,this._r=t.r,this._g=t.g,this._b=t.b,this._a=t.a,this._roundA=Math.round(100*this._a)/100,this._format=e.format||t.format,this._gradientType=e.gradientType,this._r<1&&(this._r=Math.round(this._r)),this._g<1&&(this._g=Math.round(this._g)),this._b<1&&(this._b=Math.round(this._b)),this._ok=t.ok}yn.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var e=this.toRgb();return(e.r*299+e.g*587+e.b*114)/1e3},getLuminance:function(){var e=this.toRgb(),t,n,r,s,a,l;return t=e.r/255,n=e.g/255,r=e.b/255,t<=.03928?s=t/12.92:s=Math.pow((t+.055)/1.055,2.4),n<=.03928?a=n/12.92:a=Math.pow((n+.055)/1.055,2.4),r<=.03928?l=r/12.92:l=Math.pow((r+.055)/1.055,2.4),.2126*s+.7152*a+.0722*l},setAlpha:function(e){return this._a=cP(e),this._roundA=Math.round(100*this._a)/100,this},toHsv:function(){var e=lR(this._r,this._g,this._b);return{h:e.h*360,s:e.s,v:e.v,a:this._a}},toHsvString:function(){var e=lR(this._r,this._g,this._b),t=Math.round(e.h*360),n=Math.round(e.s*100),r=Math.round(e.v*100);return this._a==1?"hsv("+t+", "+n+"%, "+r+"%)":"hsva("+t+", "+n+"%, "+r+"%, "+this._roundA+")"},toHsl:function(){var e=oR(this._r,this._g,this._b);return{h:e.h*360,s:e.s,l:e.l,a:this._a}},toHslString:function(){var e=oR(this._r,this._g,this._b),t=Math.round(e.h*360),n=Math.round(e.s*100),r=Math.round(e.l*100);return this._a==1?"hsl("+t+", "+n+"%, "+r+"%)":"hsla("+t+", "+n+"%, "+r+"%, "+this._roundA+")"},toHex:function(e){return uR(this._r,this._g,this._b,e)},toHexString:function(e){return"#"+this.toHex(e)},toHex8:function(e){return KY(this._r,this._g,this._b,this._a,e)},toHex8String:function(e){return"#"+this.toHex8(e)},toRgb:function(){return{r:Math.round(this._r),g:Math.round(this._g),b:Math.round(this._b),a:this._a}},toRgbString:function(){return this._a==1?"rgb("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+")":"rgba("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:Math.round(Sr(this._r,255)*100)+"%",g:Math.round(Sr(this._g,255)*100)+"%",b:Math.round(Sr(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function(){return this._a==1?"rgb("+Math.round(Sr(this._r,255)*100)+"%, "+Math.round(Sr(this._g,255)*100)+"%, "+Math.round(Sr(this._b,255)*100)+"%)":"rgba("+Math.round(Sr(this._r,255)*100)+"%, "+Math.round(Sr(this._g,255)*100)+"%, "+Math.round(Sr(this._b,255)*100)+"%, "+this._roundA+")"},toName:function(){return this._a===0?"transparent":this._a<1?!1:uQ[uR(this._r,this._g,this._b,!0)]||!1},toFilter:function(e){var t="#"+cR(this._r,this._g,this._b,this._a),n=t,r=this._gradientType?"GradientType = 1, ":"";if(e){var s=yn(e);n="#"+cR(s._r,s._g,s._b,s._a)}return"progid:DXImageTransform.Microsoft.gradient("+r+"startColorstr="+t+",endColorstr="+n+")"},toString:function(e){var t=!!e;e=e||this._format;var n=!1,r=this._a<1&&this._a>=0,s=!t&&r&&(e==="hex"||e==="hex6"||e==="hex3"||e==="hex4"||e==="hex8"||e==="name");return s?e==="name"&&this._a===0?this.toName():this.toRgbString():(e==="rgb"&&(n=this.toRgbString()),e==="prgb"&&(n=this.toPercentageRgbString()),(e==="hex"||e==="hex6")&&(n=this.toHexString()),e==="hex3"&&(n=this.toHexString(!0)),e==="hex4"&&(n=this.toHex8String(!0)),e==="hex8"&&(n=this.toHex8String()),e==="name"&&(n=this.toName()),e==="hsl"&&(n=this.toHslString()),e==="hsv"&&(n=this.toHsvString()),n||this.toHexString())},clone:function(){return yn(this.toString())},_applyModification:function(e,t){var n=e.apply(null,[this].concat([].slice.call(t)));return this._r=n._r,this._g=n._g,this._b=n._b,this.setAlpha(n._a),this},lighten:function(){return this._applyModification(tQ,arguments)},brighten:function(){return this._applyModification(nQ,arguments)},darken:function(){return this._applyModification(iQ,arguments)},desaturate:function(){return this._applyModification(ZY,arguments)},saturate:function(){return this._applyModification(JY,arguments)},greyscale:function(){return this._applyModification(eQ,arguments)},spin:function(){return this._applyModification(rQ,arguments)},_applyCombination:function(e,t){return e.apply(null,[this].concat([].slice.call(t)))},analogous:function(){return this._applyCombination(oQ,arguments)},complement:function(){return this._applyCombination(sQ,arguments)},monochromatic:function(){return this._applyCombination(lQ,arguments)},splitcomplement:function(){return this._applyCombination(aQ,arguments)},triad:function(){return this._applyCombination(hR,[3])},tetrad:function(){return this._applyCombination(hR,[4])}};yn.fromRatio=function(i,e){if(G_(i)=="object"){var t={};for(var n in i)i.hasOwnProperty(n)&&(n==="a"?t[n]=i[n]:t[n]=Tm(i[n]));i=t}return yn(i,e)};function $Y(i){var e={r:0,g:0,b:0},t=1,n=null,r=null,s=null,a=!1,l=!1;return typeof i=="string"&&(i=AQ(i)),G_(i)=="object"&&(gc(i.r)&&gc(i.g)&&gc(i.b)?(e=XY(i.r,i.g,i.b),a=!0,l=String(i.r).substr(-1)==="%"?"prgb":"rgb"):gc(i.h)&&gc(i.s)&&gc(i.v)?(n=Tm(i.s),r=Tm(i.v),e=QY(i.h,n,r),a=!0,l="hsv"):gc(i.h)&&gc(i.s)&&gc(i.l)&&(n=Tm(i.s),s=Tm(i.l),e=YY(i.h,n,s),a=!0,l="hsl"),i.hasOwnProperty("a")&&(t=i.a)),t=cP(t),{ok:a,format:i.format||l,r:Math.min(255,Math.max(e.r,0)),g:Math.min(255,Math.max(e.g,0)),b:Math.min(255,Math.max(e.b,0)),a:t}}function XY(i,e,t){return{r:Sr(i,255)*255,g:Sr(e,255)*255,b:Sr(t,255)*255}}function oR(i,e,t){i=Sr(i,255),e=Sr(e,255),t=Sr(t,255);var n=Math.max(i,e,t),r=Math.min(i,e,t),s,a,l=(n+r)/2;if(n==r)s=a=0;else{var u=n-r;switch(a=l>.5?u/(2-n-r):u/(n+r),n){case i:s=(e-t)/u+(e1&&(v-=1),v<1/6?h+(g-h)*6*v:v<1/2?g:v<2/3?h+(g-h)*(2/3-v)*6:h}if(e===0)n=r=s=t;else{var l=t<.5?t*(1+e):t+e-t*e,u=2*t-l;n=a(u,l,i+1/3),r=a(u,l,i),s=a(u,l,i-1/3)}return{r:n*255,g:r*255,b:s*255}}function lR(i,e,t){i=Sr(i,255),e=Sr(e,255),t=Sr(t,255);var n=Math.max(i,e,t),r=Math.min(i,e,t),s,a,l=n,u=n-r;if(a=n===0?0:u/n,n==r)s=0;else{switch(n){case i:s=(e-t)/u+(e>1)+720)%360;--e;)n.h=(n.h+r)%360,s.push(yn(n));return s}function lQ(i,e){e=e||6;for(var t=yn(i).toHsv(),n=t.h,r=t.s,s=t.v,a=[],l=1/e;e--;)a.push(yn({h:n,s:r,v:s})),s=(s+l)%1;return a}yn.mix=function(i,e,t){t=t===0?0:t||50;var n=yn(i).toRgb(),r=yn(e).toRgb(),s=t/100,a={r:(r.r-n.r)*s+n.r,g:(r.g-n.g)*s+n.g,b:(r.b-n.b)*s+n.b,a:(r.a-n.a)*s+n.a};return yn(a)};yn.readability=function(i,e){var t=yn(i),n=yn(e);return(Math.max(t.getLuminance(),n.getLuminance())+.05)/(Math.min(t.getLuminance(),n.getLuminance())+.05)};yn.isReadable=function(i,e,t){var n=yn.readability(i,e),r,s;switch(s=!1,r=dQ(t),r.level+r.size){case"AAsmall":case"AAAlarge":s=n>=4.5;break;case"AAlarge":s=n>=3;break;case"AAAsmall":s=n>=7;break}return s};yn.mostReadable=function(i,e,t){var n=null,r=0,s,a,l,u;t=t||{},a=t.includeFallbackColors,l=t.level,u=t.size;for(var h=0;hr&&(r=s,n=yn(e[h]));return yn.isReadable(i,n,{level:l,size:u})||!a?n:(t.includeFallbackColors=!1,yn.mostReadable(i,["#fff","#000"],t))};var RT=yn.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},uQ=yn.hexNames=cQ(RT);function cQ(i){var e={};for(var t in i)i.hasOwnProperty(t)&&(e[i[t]]=t);return e}function cP(i){return i=parseFloat(i),(isNaN(i)||i<0||i>1)&&(i=1),i}function Sr(i,e){hQ(i)&&(i="100%");var t=fQ(i);return i=Math.min(e,Math.max(0,parseFloat(i))),t&&(i=parseInt(i*e,10)/100),Math.abs(i-e)<1e-6?1:i%e/parseFloat(e)}function Cy(i){return Math.min(1,Math.max(0,i))}function _o(i){return parseInt(i,16)}function hQ(i){return typeof i=="string"&&i.indexOf(".")!=-1&&parseFloat(i)===1}function fQ(i){return typeof i=="string"&&i.indexOf("%")!=-1}function El(i){return i.length==1?"0"+i:""+i}function Tm(i){return i<=1&&(i=i*100+"%"),i}function hP(i){return Math.round(parseFloat(i)*255).toString(16)}function fR(i){return _o(i)/255}var bl=(function(){var i="[-\\+]?\\d+%?",e="[-\\+]?\\d*\\.\\d+%?",t="(?:"+e+")|(?:"+i+")",n="[\\s|\\(]+("+t+")[,|\\s]+("+t+")[,|\\s]+("+t+")\\s*\\)?",r="[\\s|\\(]+("+t+")[,|\\s]+("+t+")[,|\\s]+("+t+")[,|\\s]+("+t+")\\s*\\)?";return{CSS_UNIT:new RegExp(t),rgb:new RegExp("rgb"+n),rgba:new RegExp("rgba"+r),hsl:new RegExp("hsl"+n),hsla:new RegExp("hsla"+r),hsv:new RegExp("hsv"+n),hsva:new RegExp("hsva"+r),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}})();function gc(i){return!!bl.CSS_UNIT.exec(i)}function AQ(i){i=i.replace(jY,"").replace(WY,"").toLowerCase();var e=!1;if(RT[i])i=RT[i],e=!0;else if(i=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var t;return(t=bl.rgb.exec(i))?{r:t[1],g:t[2],b:t[3]}:(t=bl.rgba.exec(i))?{r:t[1],g:t[2],b:t[3],a:t[4]}:(t=bl.hsl.exec(i))?{h:t[1],s:t[2],l:t[3]}:(t=bl.hsla.exec(i))?{h:t[1],s:t[2],l:t[3],a:t[4]}:(t=bl.hsv.exec(i))?{h:t[1],s:t[2],v:t[3]}:(t=bl.hsva.exec(i))?{h:t[1],s:t[2],v:t[3],a:t[4]}:(t=bl.hex8.exec(i))?{r:_o(t[1]),g:_o(t[2]),b:_o(t[3]),a:fR(t[4]),format:e?"name":"hex8"}:(t=bl.hex6.exec(i))?{r:_o(t[1]),g:_o(t[2]),b:_o(t[3]),format:e?"name":"hex"}:(t=bl.hex4.exec(i))?{r:_o(t[1]+""+t[1]),g:_o(t[2]+""+t[2]),b:_o(t[3]+""+t[3]),a:fR(t[4]+""+t[4]),format:e?"name":"hex8"}:(t=bl.hex3.exec(i))?{r:_o(t[1]+""+t[1]),g:_o(t[2]+""+t[2]),b:_o(t[3]+""+t[3]),format:e?"name":"hex"}:!1}function dQ(i){var e,t;return i=i||{level:"AA",size:"small"},e=(i.level||"AA").toUpperCase(),t=(i.size||"small").toLowerCase(),e!=="AA"&&e!=="AAA"&&(e="AA"),t!=="small"&&t!=="large"&&(t="small"),{level:e,size:t}}function NT(i,e){(e==null||e>i.length)&&(e=i.length);for(var t=0,n=Array(e);t=this._minInterval)if(isNaN(this._maxInterval))this.update(this._frameDeltaTime*this._timeScale,!0),this._lastTimeUpdated=this._now;else for(this._interval=Math.min(this._frameDeltaTime,this._maxInterval);this._now>=this._lastTimeUpdated+this._interval;)this.update(this._interval*this._timeScale,this._now<=this._lastTimeUpdated+2*this._maxInterval),this._lastTimeUpdated+=this._interval;this._isRunning&&this.animateOnce()},l.prototype.update=function(u,h){h===void 0&&(h=!0),this._currentTick++,this._currentTime+=u,this._tickDeltaTime=u,this._onTick.dispatch(this.currentTimeSeconds,this.tickDeltaTimeSeconds,this.currentTick),h&&this._onTickOncePerFrame.dispatch(this.currentTimeSeconds,this.tickDeltaTimeSeconds,this.currentTick)},l.prototype.getTimer=function(){return Date.now()},l})();Object.defineProperty(n,"__esModule",{value:!0}),n.default=a},function(t,n,r){(function(s,a){t.exports=a()})(this,function(){return(function(s){function a(u){if(l[u])return l[u].exports;var h=l[u]={exports:{},id:u,loaded:!1};return s[u].call(h.exports,h,h.exports,a),h.loaded=!0,h.exports}var l={};return a.m=s,a.c=l,a.p="",a(0)})([function(s,a){var l=(function(){function u(){this.functions=[]}return u.prototype.add=function(h){return this.functions.indexOf(h)===-1&&(this.functions.push(h),!0)},u.prototype.remove=function(h){var g=this.functions.indexOf(h);return g>-1&&(this.functions.splice(g,1),!0)},u.prototype.removeAll=function(){return this.functions.length>0&&(this.functions.length=0,!0)},u.prototype.dispatch=function(){for(var h=[],g=0;gh==g>-h?(s=h,h=e[++v]):(s=g,g=n[++x]);let S=0;if(vh==g>-h?(a=h+s,l=s-(a-h),h=e[++v]):(a=g+s,l=s-(a-g),g=n[++x]),s=a,l!==0&&(r[S++]=l);vh==g>-h?(a=s+h,u=a-s,l=s-(a-u)+(h-u),h=e[++v]):(a=s+g,u=a-s,l=s-(a-u)+(g-u),g=n[++x]),s=a,l!==0&&(r[S++]=l);for(;v=se||-te>=se||(v=i-F,l=i-(F+v)+(v-r),v=t-V,h=t-(V+v)+(v-r),v=e-X,u=e-(X+v)+(v-s),v=n-J,g=n-(J+v)+(v-s),l===0&&u===0&&h===0&&g===0)||(se=IQ*a+LQ*Math.abs(te),te+=F*g+J*l-(X*h+V*u),te>=se||-te>=se))return te;O=l*J,x=na*l,S=x-(x-l),w=l-S,x=na*J,R=x-(x-J),C=J-R,z=w*C-(O-S*R-w*R-S*C),G=u*V,x=na*u,S=x-(x-u),w=u-S,x=na*V,R=x-(x-V),C=V-R,k=w*C-(G-S*R-w*R-S*C),E=z-k,v=z-E,va[0]=z-(E+v)+(v-k),B=O+E,v=B-O,L=O-(B-v)+(E-v),E=L-G,v=L-E,va[1]=L-(E+v)+(v-G),H=B+E,v=H-B,va[2]=B-(H-v)+(E-v),va[3]=H;const ne=V3(4,Td,4,va,dR);O=F*g,x=na*F,S=x-(x-F),w=F-S,x=na*g,R=x-(x-g),C=g-R,z=w*C-(O-S*R-w*R-S*C),G=X*h,x=na*X,S=x-(x-X),w=X-S,x=na*h,R=x-(x-h),C=h-R,k=w*C-(G-S*R-w*R-S*C),E=z-k,v=z-E,va[0]=z-(E+v)+(v-k),B=O+E,v=B-O,L=O-(B-v)+(E-v),E=L-G,v=L-E,va[1]=L-(E+v)+(v-G),H=B+E,v=H-B,va[2]=B-(H-v)+(E-v),va[3]=H;const Z=V3(ne,dR,4,va,pR);O=l*g,x=na*l,S=x-(x-l),w=l-S,x=na*g,R=x-(x-g),C=g-R,z=w*C-(O-S*R-w*R-S*C),G=u*h,x=na*u,S=x-(x-u),w=u-S,x=na*h,R=x-(x-h),C=h-R,k=w*C-(G-S*R-w*R-S*C),E=z-k,v=z-E,va[0]=z-(E+v)+(v-k),B=O+E,v=B-O,L=O-(B-v)+(E-v),E=L-G,v=L-E,va[1]=L-(E+v)+(v-G),H=B+E,v=H-B,va[2]=B-(H-v)+(E-v),va[3]=H;const ue=V3(Z,pR,4,va,mR);return mR[ue-1]}function wm(i,e,t,n,r,s){const a=(e-s)*(t-r),l=(i-r)*(n-s),u=a-l,h=Math.abs(a+l);return Math.abs(u)>=BQ*h?u:-FQ(i,e,t,n,r,s,h)}const gR=Math.pow(2,-52),ov=new Uint32Array(512);class gg{static from(e,t=VQ,n=HQ){const r=e.length,s=new Float64Array(r*2);for(let a=0;a>1;if(t>0&&typeof e[0]!="number")throw new Error("Expected coords to contain numbers.");this.coords=e;const n=Math.max(2*t-5,0);this._triangles=new Uint32Array(n*3),this._halfedges=new Int32Array(n*3),this._hashSize=Math.ceil(Math.sqrt(t)),this._hullPrev=new Uint32Array(t),this._hullNext=new Uint32Array(t),this._hullTri=new Uint32Array(t),this._hullHash=new Int32Array(this._hashSize),this._ids=new Uint32Array(t),this._dists=new Float64Array(t),this.update()}update(){const{coords:e,_hullPrev:t,_hullNext:n,_hullTri:r,_hullHash:s}=this,a=e.length>>1;let l=1/0,u=1/0,h=-1/0,g=-1/0;for(let F=0;Fh&&(h=V),X>g&&(g=X),this._ids[F]=F}const v=(l+h)/2,x=(u+g)/2;let S,w,R;for(let F=0,V=1/0;F0&&(w=F,V=X)}let B=e[2*w],L=e[2*w+1],O=1/0;for(let F=0;FJ&&(F[V++]=te,J=se)}this.hull=F.subarray(0,V),this.triangles=new Uint32Array(0),this.halfedges=new Uint32Array(0);return}if(wm(C,E,B,L,z,G)<0){const F=w,V=B,X=L;w=R,B=z,L=G,R=F,z=V,G=X}const k=qQ(C,E,B,L,z,G);this._cx=k.x,this._cy=k.y;for(let F=0;F0&&Math.abs(te-V)<=gR&&Math.abs(se-X)<=gR||(V=te,X=se,J===S||J===w||J===R))continue;let ne=0;for(let Se=0,le=this._hashKey(te,se);Se=0;)if(Z=ue,Z===ne){Z=-1;break}if(Z===-1)continue;let he=this._addTriangle(Z,J,n[Z],-1,-1,r[Z]);r[J]=this._legalize(he+2),r[Z]=he,H++;let be=n[Z];for(;ue=n[be],wm(te,se,e[2*be],e[2*be+1],e[2*ue],e[2*ue+1])<0;)he=this._addTriangle(be,J,ue,r[J],-1,r[be]),r[J]=this._legalize(he+2),n[be]=be,H--,be=ue;if(Z===ne)for(;ue=t[Z],wm(te,se,e[2*ue],e[2*ue+1],e[2*Z],e[2*Z+1])<0;)he=this._addTriangle(ue,J,Z,-1,r[Z],r[ue]),this._legalize(he+2),r[ue]=he,n[Z]=Z,H--,Z=ue;this._hullStart=t[J]=Z,n[Z]=t[be]=J,n[J]=be,s[this._hashKey(te,se)]=J,s[this._hashKey(e[2*Z],e[2*Z+1])]=Z}this.hull=new Uint32Array(H);for(let F=0,V=this._hullStart;F0?3-t:1+t)/4}function H3(i,e,t,n){const r=i-t,s=e-n;return r*r+s*s}function zQ(i,e,t,n,r,s,a,l){const u=i-a,h=e-l,g=t-a,v=n-l,x=r-a,S=s-l,w=u*u+h*h,R=g*g+v*v,C=x*x+S*S;return u*(v*C-R*S)-h*(g*C-R*x)+w*(g*S-v*x)<0}function GQ(i,e,t,n,r,s){const a=t-i,l=n-e,u=r-i,h=s-e,g=a*a+l*l,v=u*u+h*h,x=.5/(a*h-l*u),S=(h*g-l*v)*x,w=(a*v-u*g)*x;return S*S+w*w}function qQ(i,e,t,n,r,s){const a=t-i,l=n-e,u=r-i,h=s-e,g=a*a+l*l,v=u*u+h*h,x=.5/(a*h-l*u),S=i+(h*g-l*v)*x,w=e+(a*v-u*g)*x;return{x:S,y:w}}function $d(i,e,t,n){if(n-t<=20)for(let r=t+1;r<=n;r++){const s=i[r],a=e[s];let l=r-1;for(;l>=t&&e[i[l]]>a;)i[l+1]=i[l--];i[l+1]=s}else{const r=t+n>>1;let s=t+1,a=n;sm(i,r,s),e[i[t]]>e[i[n]]&&sm(i,t,n),e[i[s]]>e[i[n]]&&sm(i,s,n),e[i[t]]>e[i[s]]&&sm(i,t,s);const l=i[s],u=e[l];for(;;){do s++;while(e[i[s]]u);if(a=a-t?($d(i,e,s,n),$d(i,e,t,a-1)):($d(i,e,t,a-1),$d(i,e,s,n))}}function sm(i,e,t){const n=i[e];i[e]=i[t],i[t]=n}function VQ(i){return i[0]}function HQ(i){return i[1]}function jQ(i,e){var t,n,r=0,s,a,l,u,h,g,v,x=i[0],S=i[1],w=e.length;for(t=0;t=0||a<=0&&u>=0)return 0}else if(h>=0&&l<=0||h<=0&&l>=0){if(s=wm(a,u,l,h,0,0),s===0)return 0;(s>0&&h>0&&l<=0||s<0&&h<=0&&l>0)&&r++}g=v,l=h,a=u}}return r%2!==0}function WQ(i){if(!i)throw new Error("coord is required");if(!Array.isArray(i)){if(i.type==="Feature"&&i.geometry!==null&&i.geometry.type==="Point")return[...i.geometry.coordinates];if(i.type==="Point")return[...i.coordinates]}if(Array.isArray(i)&&i.length>=2&&!Array.isArray(i[0])&&!Array.isArray(i[1]))return[...i];throw new Error("coord must be GeoJSON Point or an Array of numbers")}function $Q(i){return i.type==="Feature"?i.geometry:i}function XQ(i,e,t={}){if(!i)throw new Error("point is required");if(!e)throw new Error("polygon is required");const n=WQ(i),r=$Q(e),s=r.type,a=e.bbox;let l=r.coordinates;if(a&&YQ(n,a)===!1)return!1;s==="Polygon"&&(l=[l]);let u=!1;for(var h=0;h=i[0]&&e[3]>=i[1]}var QQ=XQ;const vR=1e-6;class $f{constructor(){this._x0=this._y0=this._x1=this._y1=null,this._=""}moveTo(e,t){this._+=`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")}lineTo(e,t){this._+=`L${this._x1=+e},${this._y1=+t}`}arc(e,t,n){e=+e,t=+t,n=+n;const r=e+n,s=t;if(n<0)throw new Error("negative radius");this._x1===null?this._+=`M${r},${s}`:(Math.abs(this._x1-r)>vR||Math.abs(this._y1-s)>vR)&&(this._+="L"+r+","+s),n&&(this._+=`A${n},${n},0,1,1,${e-n},${t}A${n},${n},0,1,1,${this._x1=r},${this._y1=s}`)}rect(e,t,n,r){this._+=`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}h${+n}v${+r}h${-n}Z`}value(){return this._||null}}class DT{constructor(){this._=[]}moveTo(e,t){this._.push([e,t])}closePath(){this._.push(this._[0].slice())}lineTo(e,t){this._.push([e,t])}value(){return this._.length?this._:null}}class KQ{constructor(e,[t,n,r,s]=[0,0,960,500]){if(!((r=+r)>=(t=+t))||!((s=+s)>=(n=+n)))throw new Error("invalid bounds");this.delaunay=e,this._circumcenters=new Float64Array(e.points.length*2),this.vectors=new Float64Array(e.points.length*2),this.xmax=r,this.xmin=t,this.ymax=s,this.ymin=n,this._init()}update(){return this.delaunay.update(),this._init(),this}_init(){const{delaunay:{points:e,hull:t,triangles:n},vectors:r}=this;let s,a;const l=this.circumcenters=this._circumcenters.subarray(0,n.length/3*2);for(let R=0,C=0,E=n.length,B,L;R1;)s-=2;for(let a=2;a0){if(t>=this.ymax)return null;(a=(this.ymax-t)/r)0){if(e>=this.xmax)return null;(a=(this.xmax-e)/n)this.xmax?2:0)|(tthis.ymax?8:0)}_simplify(e){if(e&&e.length>4){for(let t=0;t1e-10)return!1}return!0}function nK(i,e,t){return[i+Math.sin(i+e)*t,e+Math.cos(i-e)*t]}class yM{static from(e,t=JQ,n=eK,r){return new yM("length"in e?iK(e,t,n,r):Float64Array.from(rK(e,t,n,r)))}constructor(e){this._delaunator=new gg(e),this.inedges=new Int32Array(e.length/2),this._hullIndex=new Int32Array(e.length/2),this.points=this._delaunator.coords,this._init()}update(){return this._delaunator.update(),this._init(),this}_init(){const e=this._delaunator,t=this.points;if(e.hull&&e.hull.length>2&&tK(e)){this.collinear=Int32Array.from({length:t.length/2},(x,S)=>S).sort((x,S)=>t[2*x]-t[2*S]||t[2*x+1]-t[2*S+1]);const u=this.collinear[0],h=this.collinear[this.collinear.length-1],g=[t[2*u],t[2*u+1],t[2*h],t[2*h+1]],v=1e-8*Math.hypot(g[3]-g[1],g[2]-g[0]);for(let x=0,S=t.length/2;x0&&(this.triangles=new Int32Array(3).fill(-1),this.halfedges=new Int32Array(3).fill(-1),this.triangles[0]=r[0],a[r[0]]=1,r.length===2&&(a[r[1]]=0,this.triangles[1]=r[1],this.triangles[2]=r[1]))}voronoi(e){return new KQ(this,e)}*neighbors(e){const{inedges:t,hull:n,_hullIndex:r,halfedges:s,triangles:a,collinear:l}=this;if(l){const v=l.indexOf(e);v>0&&(yield l[v-1]),v=0&&s!==n&&s!==r;)n=s;return s}_step(e,t,n){const{inedges:r,hull:s,_hullIndex:a,halfedges:l,triangles:u,points:h}=this;if(r[e]===-1||!h.length)return(e+1)%(h.length>>1);let g=e,v=wd(t-h[e*2],2)+wd(n-h[e*2+1],2);const x=r[e];let S=x;do{let w=u[S];const R=wd(t-h[w*2],2)+wd(n-h[w*2+1],2);if(R0?1:i<0?-1:0},dP=Math.sqrt;function uK(i){return i>1?_R:i<-1?-_R:Math.asin(i)}function pP(i,e){return i[0]*e[0]+i[1]*e[1]+i[2]*e[2]}function So(i,e){return[i[1]*e[2]-i[2]*e[1],i[2]*e[0]-i[0]*e[2],i[0]*e[1]-i[1]*e[0]]}function q_(i,e){return[i[0]+e[0],i[1]+e[1],i[2]+e[2]]}function V_(i){var e=dP(i[0]*i[0]+i[1]*i[1]+i[2]*i[2]);return[i[0]/e,i[1]/e,i[2]/e]}function bM(i){return[sK(i[1],i[0])*yR,uK(aK(-1,oK(1,i[2])))*yR]}function uu(i){const e=i[0]*xR,t=i[1]*xR,n=bR(t);return[n*bR(e),n*SR(e),SR(t)]}function SM(i){return i=i.map(e=>uu(e)),pP(i[0],So(i[2],i[1]))}function cK(i){const e=fK(i),t=dK(e),n=AK(t,i),r=mK(t,i.length),s=hK(r,i),a=pK(t,i),{polygons:l,centers:u}=gK(a,t,i),h=vK(l),g=yK(t,i),v=_K(n,t);return{delaunay:e,edges:n,triangles:t,centers:u,neighbors:r,polygons:l,mesh:h,hull:g,urquhart:v,find:s}}function hK(i,e){function t(n,r){let s=n[0]-r[0],a=n[1]-r[1],l=n[2]-r[2];return s*s+a*a+l*l}return function(r,s,a){a===void 0&&(a=0);let l,u,h=a;const g=uu([r,s]);do l=a,a=null,u=t(g,uu(e[l])),i[l].forEach(v=>{let x=t(g,uu(e[v]));if(x1e32?r.push(v):S>s&&(s=S)}const a=1e6*dP(s);r.forEach(v=>i[v]=[a,0]),i.push([0,a]),i.push([-a,0]),i.push([0,-a]);const l=yM.from(i);l.projection=n;const{triangles:u,halfedges:h,inedges:g}=l;for(let v=0,x=h.length;vi.length-3-1&&(u[v]=e);return l}function AK(i,e){const t=new Set;return e.length===2?[[0,1]]:(i.forEach(n=>{if(n[0]!==n[1]&&!(SM(n.map(r=>e[r]))<0))for(let r=0,s;r<3;r++)s=(r+1)%3,t.add(A_([n[r],n[s]]).join("-"))}),Array.from(t,n=>n.split("-").map(Number)))}function dK(i){const{triangles:e}=i;if(!e)return[];const t=[];for(let n=0,r=e.length/3;n{const n=t.map(s=>e[s]).map(uu),r=q_(q_(So(n[1],n[0]),So(n[2],n[1])),So(n[0],n[2]));return bM(V_(r))})}function mK(i,e){const t=[];return i.forEach(n=>{for(let r=0;r<3;r++){const s=n[r],a=n[(r+1)%3];t[s]=t[s]||[],t[s].push(a)}}),i.length===0&&(e===2?(t[0]=[1],t[1]=[0]):e===1&&(t[0]=[])),t}function gK(i,e,t){const n=[],r=i.slice();if(e.length===0){if(t.length<2)return{polygons:n,centers:r};if(t.length===2){const l=uu(t[0]),u=uu(t[1]),h=V_(q_(l,u)),g=V_(So(l,u)),v=So(h,g),x=[h,So(h,v),So(So(h,v),v),So(So(So(h,v),v),v)].map(bM).map(a);return n.push(x),n.push(x.slice().reverse()),{polygons:n,centers:r}}}e.forEach((l,u)=>{for(let h=0;h<3;h++){const g=l[h],v=l[(h+1)%3],x=l[(h+2)%3];n[g]=n[g]||[],n[g].push([v,x,u,[g,v,x]])}});const s=n.map(l=>{const u=[l[0][2]];let h=l[0][1];for(let g=1;g2)return u;if(u.length==2){const g=TR(t[l[0][3][0]],t[l[0][3][1]],r[u[0]]),v=TR(t[l[0][3][2]],t[l[0][3][0]],r[u[0]]),x=a(g),S=a(v);return[u[0],S,u[1],x]}});function a(l){let u=-1;return r.slice(e.length,1/0).forEach((h,g)=>{h[0]===l[0]&&h[1]===l[1]&&(u=g+e.length)}),u<0&&(u=r.length,r.push(l)),u}return{polygons:s,centers:r}}function TR(i,e,t){i=uu(i),e=uu(e),t=uu(t);const n=lK(pP(So(e,i),t));return bM(V_(q_(i,e)).map(r=>n*r))}function vK(i){const e=[];return i.forEach(t=>{if(!t)return;let n=t[t.length-1];for(let r of t)r>n&&e.push([n,r]),n=r}),e}function _K(i,e){return function(t){const n=new Map,r=new Map;return i.forEach((s,a)=>{const l=s.join("-");n.set(l,t[a]),r.set(l,!0)}),e.forEach(s=>{let a=0,l=-1;for(let u=0;u<3;u++){let h=A_([s[u],s[(u+1)%3]]).join("-");n.get(h)>a&&(a=n.get(h),l=h)}r.set(l,!1)}),i.map(s=>r.get(s.join("-")))}}function yK(i,e){const t=new Set,n=[];i.map(l=>{if(!(SM(l.map(u=>e[u>e.length?0:u]))>1e-12))for(let u=0;u<3;u++){let h=[l[u],l[(u+1)%3]],g=`${h[0]}-${h[1]}`;t.has(g)?t.delete(g):t.add(`${h[1]}-${h[0]}`)}});const r=new Map;let s;if(t.forEach(l=>{l=l.split("-").map(Number),r.set(l[0],l[1]),s=l[0]}),s===void 0)return n;let a=s;do{n.push(a);let l=r.get(a);r.set(a,-1),a=l}while(a>-1&&a!==s);return n}function xK(i){const e=function(t){if(e.delaunay=null,e._data=t,typeof e._data=="object"&&e._data.type==="FeatureCollection"&&(e._data=e._data.features),typeof e._data=="object"){const n=e._data.map(r=>[e._vx(r),e._vy(r),r]).filter(r=>isFinite(r[0]+r[1]));e.points=n.map(r=>[r[0],r[1]]),e.valid=n.map(r=>r[2]),e.delaunay=cK(e.points)}return e};return e._vx=function(t){if(typeof t=="object"&&"type"in t)return B6(t)[0];if(0 in t)return t[0]},e._vy=function(t){if(typeof t=="object"&&"type"in t)return B6(t)[1];if(1 in t)return t[1]},e.x=function(t){return t?(e._vx=t,e):e._vx},e.y=function(t){return t?(e._vy=t,e):e._vy},e.polygons=function(t){if(t!==void 0&&e(t),!e.delaunay)return!1;const n={type:"FeatureCollection",features:[]};return e.valid.length===0||(e.delaunay.polygons.forEach((r,s)=>n.features.push({type:"Feature",geometry:r?{type:"Polygon",coordinates:[[...r,r[0]].map(a=>e.delaunay.centers[a])]}:null,properties:{site:e.valid[s],sitecoordinates:e.points[s],neighbours:e.delaunay.neighbors[s]}})),e.valid.length===1&&n.features.push({type:"Feature",geometry:{type:"Sphere"},properties:{site:e.valid[0],sitecoordinates:e.points[0],neighbours:[]}})),n},e.triangles=function(t){return t!==void 0&&e(t),e.delaunay?{type:"FeatureCollection",features:e.delaunay.triangles.map((n,r)=>(n=n.map(s=>e.points[s]),n.center=e.delaunay.centers[r],n)).filter(n=>SM(n)>0).map(n=>({type:"Feature",properties:{circumcenter:n.center},geometry:{type:"Polygon",coordinates:[[...n,n[0]]]}}))}:!1},e.links=function(t){if(t!==void 0&&e(t),!e.delaunay)return!1;const n=e.delaunay.edges.map(s=>Vh(e.points[s[0]],e.points[s[1]])),r=e.delaunay.urquhart(n);return{type:"FeatureCollection",features:e.delaunay.edges.map((s,a)=>({type:"Feature",properties:{source:e.valid[s[0]],target:e.valid[s[1]],length:n[a],urquhart:!!r[a]},geometry:{type:"LineString",coordinates:[e.points[s[0]],e.points[s[1]]]}}))}},e.mesh=function(t){return t!==void 0&&e(t),e.delaunay?{type:"MultiLineString",coordinates:e.delaunay.edges.map(n=>[e.points[n[0]],e.points[n[1]]])}:!1},e.cellMesh=function(t){if(t!==void 0&&e(t),!e.delaunay)return!1;const{centers:n,polygons:r}=e.delaunay,s=[];for(const a of r)if(a)for(let l=a.length,u=a[l-1],h=a[0],g=0;gu&&s.push([n[u],n[h]]);return{type:"MultiLineString",coordinates:s}},e._found=void 0,e.find=function(t,n,r){if(e._found=e.delaunay.find(t,n,e._found),!r||Vh([t,n],e.points[e._found])r[s]),r[n[0]]]]}},i?e(i):e}function PT(i,e){(e==null||e>i.length)&&(e=i.length);for(var t=0,n=Array(e);t1&&arguments[1]!==void 0?arguments[1]:{},t=e.resolution,n=t===void 0?1/0:t,r=BK(i,n),s=ug(r),a=OK(i,n),l=[].concat(j3(s),j3(a)),u={type:"Polygon",coordinates:i},h=ID(u),g=Kl(h,2),v=Kl(g[0],2),x=v[0],S=v[1],w=Kl(g[1],2),R=w[0],C=w[1],E=x>R||C>=89||S<=-89,B=[];if(E){var L=xK(l).triangles(),O=new Map(l.map(function(ue,he){var be=Kl(ue,2),Se=be[0],le=be[1];return["".concat(Se,"-").concat(le),he]}));L.features.forEach(function(ue){var he,be=ue.geometry.coordinates[0].slice(0,3).reverse(),Se=[];if(be.forEach(function(we){var We=Kl(we,2),Te=We[0],ze=We[1],_e="".concat(Te,"-").concat(ze);O.has(_e)&&Se.push(O.get(_e))}),Se.length===3){if(Se.some(function(we){return wee)for(var l=dM(r,s),u=1/Math.ceil(a/e),h=u;h<1;)n.push(l(h)),h+=u}n.push(r=s)}),n})}function OK(i,e){var t={type:"Polygon",coordinates:i},n=ID(t),r=Kl(n,2),s=Kl(r[0],2),a=s[0],l=s[1],u=Kl(r[1],2),h=u[0],g=u[1];if(Math.min(Math.abs(h-a),Math.abs(g-l))h||g>=89||l<=-89;return IK(e,{minLng:a,maxLng:h,minLat:l,maxLat:g}).filter(function(x){return UT(x,t,v)})}function IK(i){for(var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},t=e.minLng,n=e.maxLng,r=e.minLat,s=e.maxLat,a=Math.round(Math.pow(360/i,2)/Math.PI),l=(1+Math.sqrt(5))/2,u=function(E){return E/l*360%360-180},h=function(E){return Math.acos(2*E/a-1)/Math.PI*180-90},g=function(E){return a*(Math.cos((E+90)*Math.PI/180)+1)/2},v=[s!==void 0?Math.ceil(g(s)):0,r!==void 0?Math.floor(g(r)):a-1],x=t===void 0&&n===void 0?function(){return!0}:t===void 0?function(C){return C<=n}:n===void 0?function(C){return C>=t}:n>=t?function(C){return C>=t&&C<=n}:function(C){return C>=t||C<=n},S=[],w=v[0];w<=v[1];w++){var R=u(w);x(R)&&S.push([R,h(w)])}return S}function UT(i,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return t?mX(e,i):QQ(i,e)}var Yv=window.THREE?window.THREE:{BufferGeometry:Ki,Float32BufferAttribute:wi},wR=new Yv.BufferGeometry().setAttribute?"setAttribute":"addAttribute",TM=(function(i){function e(t,n,r,s,a,l,u){var h;MK(this,e),h=wK(this,e),h.type="ConicPolygonGeometry",h.parameters={polygonGeoJson:t,bottomHeight:n,topHeight:r,closedBottom:s,closedTop:a,includeSides:l,curvatureResolution:u},n=n||0,r=r||1,s=s!==void 0?s:!0,a=a!==void 0?a:!0,l=l!==void 0?l:!0,u=u||5;var g=UK(t,{resolution:u}),v=g.contour,x=g.triangles,S=ug(x.uvs),w=[],R=[],C=[],E=0,B=function(k){var H=Math.round(w.length/3),F=C.length;w=w.concat(k.vertices),R=R.concat(k.uvs),C=C.concat(H?k.indices.map(function(V){return V+H}):k.indices),h.addGroup(F,C.length-F,E++)};l&&B(O()),s&&B(z(n,!1)),a&&B(z(r,!0)),h.setIndex(C),h[wR]("position",new Yv.Float32BufferAttribute(w,3)),h[wR]("uv",new Yv.Float32BufferAttribute(R,2)),h.computeVertexNormals();function L(G,k){var H=typeof k=="function"?k:function(){return k},F=G.map(function(V){return V.map(function(X){var J=Kl(X,2),te=J[0],se=J[1];return FK(se,te,H(te,se))})});return F_(F)}function O(){for(var G=L(v,n),k=G.vertices,H=G.holes,F=L(v,r),V=F.vertices,X=ug([V,k]),J=Math.round(V.length/3),te=new Set(H),se=0,ne=[],Z=0;Z=0;Se--)for(var le=0;le1&&arguments[1]!==void 0?arguments[1]:!0;return{indices:k?x.indices:x.indices.slice().reverse(),vertices:L([x.points],G).vertices,uvs:S}}return h}return CK(e,i),EK(e)})(Yv.BufferGeometry);function FK(i,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,n=(90-i)*Math.PI/180,r=(90-e)*Math.PI/180;return[t*Math.sin(n)*Math.cos(r),t*Math.cos(n),t*Math.sin(n)*Math.sin(r)]}function BT(i,e){(e==null||e>i.length)&&(e=i.length);for(var t=0,n=Array(e);t0&&arguments[0]!==void 0?arguments[0]:[],e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1,r=(e instanceof Array?e.length?e:[void 0]:[e]).map(function(l){return{keyAccessor:l,isProp:!(l instanceof Function)}}),s=i.reduce(function(l,u){var h=l,g=u;return r.forEach(function(v,x){var S=v.keyAccessor,w=v.isProp,R;if(w){var C=g,E=C[S],B=jK(C,[S].map(QK));R=E,g=B}else R=S(g,x);x+11&&arguments[1]!==void 0?arguments[1]:1;h===r.length?Object.keys(u).forEach(function(g){return u[g]=t(u[g])}):Object.values(u).forEach(function(g){return l(g,h+1)})})(s);var a=s;return n&&(a=[],(function l(u){var h=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];h.length===r.length?a.push({keys:h,vals:u}):Object.entries(u).forEach(function(g){var v=$K(g,2),x=v[0],S=v[1];return l(S,[].concat(XK(h),[x]))})})(s),e instanceof Array&&e.length===0&&a.length===1&&(a[0].keys=[])),a}),Si=(function(i){i=i||{};var e=typeof i<"u"?i:{},t={},n;for(n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);var r="";function s(Ze){return e.locateFile?e.locateFile(Ze,r):r+Ze}var a;typeof document<"u"&&document.currentScript&&(r=document.currentScript.src),r.indexOf("blob:")!==0?r=r.substr(0,r.lastIndexOf("/")+1):r="",a=function(pt,It,at){var d=new XMLHttpRequest;d.open("GET",pt,!0),d.responseType="arraybuffer",d.onload=function(){if(d.status==200||d.status==0&&d.response){It(d.response);return}var $n=Gt(pt);if($n){It($n.buffer);return}at()},d.onerror=at,d.send(null)};var l=e.print||console.log.bind(console),u=e.printErr||console.warn.bind(console);for(n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);t=null,e.arguments&&e.arguments;var h=0,g=function(Ze){h=Ze},v=function(){return h},x=8;function S(Ze,pt,It,at){switch(It=It||"i8",It.charAt(It.length-1)==="*"&&(It="i32"),It){case"i1":J[Ze>>0]=pt;break;case"i8":J[Ze>>0]=pt;break;case"i16":se[Ze>>1]=pt;break;case"i32":ne[Ze>>2]=pt;break;case"i64":it=[pt>>>0,($e=pt,+ke($e)>=1?$e>0?(lt(+Mt($e/4294967296),4294967295)|0)>>>0:~~+oe(($e-+(~~$e>>>0))/4294967296)>>>0:0)],ne[Ze>>2]=it[0],ne[Ze+4>>2]=it[1];break;case"float":Z[Ze>>2]=pt;break;case"double":ue[Ze>>3]=pt;break;default:Jr("invalid type for setValue: "+It)}}function w(Ze,pt,It){switch(pt=pt||"i8",pt.charAt(pt.length-1)==="*"&&(pt="i32"),pt){case"i1":return J[Ze>>0];case"i8":return J[Ze>>0];case"i16":return se[Ze>>1];case"i32":return ne[Ze>>2];case"i64":return ne[Ze>>2];case"float":return Z[Ze>>2];case"double":return ue[Ze>>3];default:Jr("invalid type for getValue: "+pt)}return null}var R=!1;function C(Ze,pt){Ze||Jr("Assertion failed: "+pt)}function E(Ze){var pt=e["_"+Ze];return C(pt,"Cannot call unknown function "+Ze+", make sure it is exported"),pt}function B(Ze,pt,It,at,d){var ee={string:function(Fn){var cs=0;if(Fn!=null&&Fn!==0){var Ma=(Fn.length<<2)+1;cs=rt(Ma),H(Fn,cs,Ma)}return cs},array:function(Fn){var cs=rt(Fn.length);return F(Fn,cs),cs}};function $n(Fn){return pt==="string"?G(Fn):pt==="boolean"?!!Fn:Fn}var Gn=E(Ze),Xn=[],un=0;if(at)for(var qn=0;qn=at);)++d;if(d-pt>16&&Ze.subarray&&O)return O.decode(Ze.subarray(pt,d));for(var ee="";pt>10,56320|un&1023)}}return ee}function G(Ze,pt){return Ze?z(te,Ze,pt):""}function k(Ze,pt,It,at){if(!(at>0))return 0;for(var d=It,ee=It+at-1,$n=0;$n=55296&&Gn<=57343){var Xn=Ze.charCodeAt(++$n);Gn=65536+((Gn&1023)<<10)|Xn&1023}if(Gn<=127){if(It>=ee)break;pt[It++]=Gn}else if(Gn<=2047){if(It+1>=ee)break;pt[It++]=192|Gn>>6,pt[It++]=128|Gn&63}else if(Gn<=65535){if(It+2>=ee)break;pt[It++]=224|Gn>>12,pt[It++]=128|Gn>>6&63,pt[It++]=128|Gn&63}else{if(It+3>=ee)break;pt[It++]=240|Gn>>18,pt[It++]=128|Gn>>12&63,pt[It++]=128|Gn>>6&63,pt[It++]=128|Gn&63}}return pt[It]=0,It-d}function H(Ze,pt,It){return k(Ze,te,pt,It)}typeof TextDecoder<"u"&&new TextDecoder("utf-16le");function F(Ze,pt){J.set(Ze,pt)}function V(Ze,pt){return Ze%pt>0&&(Ze+=pt-Ze%pt),Ze}var X,J,te,se,ne,Z,ue;function he(Ze){X=Ze,e.HEAP8=J=new Int8Array(Ze),e.HEAP16=se=new Int16Array(Ze),e.HEAP32=ne=new Int32Array(Ze),e.HEAPU8=te=new Uint8Array(Ze),e.HEAPU16=new Uint16Array(Ze),e.HEAPU32=new Uint32Array(Ze),e.HEAPF32=Z=new Float32Array(Ze),e.HEAPF64=ue=new Float64Array(Ze)}var be=5271536,Se=28624,le=e.TOTAL_MEMORY||33554432;e.buffer?X=e.buffer:X=new ArrayBuffer(le),le=X.byteLength,he(X),ne[Se>>2]=be;function we(Ze){for(;Ze.length>0;){var pt=Ze.shift();if(typeof pt=="function"){pt();continue}var It=pt.func;typeof It=="number"?pt.arg===void 0?e.dynCall_v(It):e.dynCall_vi(It,pt.arg):It(pt.arg===void 0?null:pt.arg)}}var We=[],Te=[],ze=[],_e=[];function De(){if(e.preRun)for(typeof e.preRun=="function"&&(e.preRun=[e.preRun]);e.preRun.length;)Ge(e.preRun.shift());we(We)}function dt(){we(Te)}function vt(){we(ze)}function Tt(){if(e.postRun)for(typeof e.postRun=="function"&&(e.postRun=[e.postRun]);e.postRun.length;)Be(e.postRun.shift());we(_e)}function Ge(Ze){We.unshift(Ze)}function Be(Ze){_e.unshift(Ze)}var ke=Math.abs,oe=Math.ceil,Mt=Math.floor,lt=Math.min,Dt=0,wt=null;function tn(Ze){Dt++,e.monitorRunDependencies&&e.monitorRunDependencies(Dt)}function bt(Ze){if(Dt--,e.monitorRunDependencies&&e.monitorRunDependencies(Dt),Dt==0&&wt){var pt=wt;wt=null,pt()}}e.preloadedImages={},e.preloadedAudios={};var fe=null,Y="data:application/octet-stream;base64,";function Ce(Ze){return String.prototype.startsWith?Ze.startsWith(Y):Ze.indexOf(Y)===0}var $e,it;fe="data:application/octet-stream;base64,AAAAAAAAAAAAAAAAAQAAAAIAAAADAAAABAAAAAUAAAAGAAAAAQAAAAQAAAADAAAABgAAAAUAAAACAAAAAAAAAAIAAAADAAAAAQAAAAQAAAAGAAAAAAAAAAUAAAADAAAABgAAAAQAAAAFAAAAAAAAAAEAAAACAAAABAAAAAUAAAAGAAAAAAAAAAIAAAADAAAAAQAAAAUAAAACAAAAAAAAAAEAAAADAAAABgAAAAQAAAAGAAAAAAAAAAUAAAACAAAAAQAAAAQAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAEAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAIAAAADAAAAAAAAAAAAAAACAAAAAAAAAAEAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAABAAAAAYAAAAAAAAABQAAAAAAAAAAAAAABAAAAAUAAAAAAAAAAAAAAAAAAAACAAAAAAAAAAYAAAAAAAAABgAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAgAAAAMAAAAEAAAABQAAAAYAAAABAAAAAgAAAAMAAAAEAAAABQAAAAYAAAAAAAAAAgAAAAMAAAAEAAAABQAAAAYAAAAAAAAAAQAAAAMAAAAEAAAABQAAAAYAAAAAAAAAAQAAAAIAAAAEAAAABQAAAAYAAAAAAAAAAQAAAAIAAAADAAAABQAAAAYAAAAAAAAAAQAAAAIAAAADAAAABAAAAAYAAAAAAAAAAQAAAAIAAAADAAAABAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAwAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAgAAAAIAAAAAAAAAAAAAAAYAAAAAAAAAAwAAAAIAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAFAAAABAAAAAAAAAABAAAAAAAAAAAAAAAFAAAABQAAAAAAAAAAAAAAAAAAAAYAAAAAAAAABAAAAAAAAAAGAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAFAAAAAgAAAAQAAAADAAAACAAAAAEAAAAHAAAABgAAAAkAAAAAAAAAAwAAAAIAAAACAAAABgAAAAoAAAALAAAAAAAAAAEAAAAFAAAAAwAAAA0AAAABAAAABwAAAAQAAAAMAAAAAAAAAAQAAAB/AAAADwAAAAgAAAADAAAAAAAAAAwAAAAFAAAAAgAAABIAAAAKAAAACAAAAAAAAAAQAAAABgAAAA4AAAALAAAAEQAAAAEAAAAJAAAAAgAAAAcAAAAVAAAACQAAABMAAAADAAAADQAAAAEAAAAIAAAABQAAABYAAAAQAAAABAAAAAAAAAAPAAAACQAAABMAAAAOAAAAFAAAAAEAAAAHAAAABgAAAAoAAAALAAAAGAAAABcAAAAFAAAAAgAAABIAAAALAAAAEQAAABcAAAAZAAAAAgAAAAYAAAAKAAAADAAAABwAAAANAAAAGgAAAAQAAAAPAAAAAwAAAA0AAAAaAAAAFQAAAB0AAAADAAAADAAAAAcAAAAOAAAAfwAAABEAAAAbAAAACQAAABQAAAAGAAAADwAAABYAAAAcAAAAHwAAAAQAAAAIAAAADAAAABAAAAASAAAAIQAAAB4AAAAIAAAABQAAABYAAAARAAAACwAAAA4AAAAGAAAAIwAAABkAAAAbAAAAEgAAABgAAAAeAAAAIAAAAAUAAAAKAAAAEAAAABMAAAAiAAAAFAAAACQAAAAHAAAAFQAAAAkAAAAUAAAADgAAABMAAAAJAAAAKAAAABsAAAAkAAAAFQAAACYAAAATAAAAIgAAAA0AAAAdAAAABwAAABYAAAAQAAAAKQAAACEAAAAPAAAACAAAAB8AAAAXAAAAGAAAAAsAAAAKAAAAJwAAACUAAAAZAAAAGAAAAH8AAAAgAAAAJQAAAAoAAAAXAAAAEgAAABkAAAAXAAAAEQAAAAsAAAAtAAAAJwAAACMAAAAaAAAAKgAAAB0AAAArAAAADAAAABwAAAANAAAAGwAAACgAAAAjAAAALgAAAA4AAAAUAAAAEQAAABwAAAAfAAAAKgAAACwAAAAMAAAADwAAABoAAAAdAAAAKwAAACYAAAAvAAAADQAAABoAAAAVAAAAHgAAACAAAAAwAAAAMgAAABAAAAASAAAAIQAAAB8AAAApAAAALAAAADUAAAAPAAAAFgAAABwAAAAgAAAAHgAAABgAAAASAAAANAAAADIAAAAlAAAAIQAAAB4AAAAxAAAAMAAAABYAAAAQAAAAKQAAACIAAAATAAAAJgAAABUAAAA2AAAAJAAAADMAAAAjAAAALgAAAC0AAAA4AAAAEQAAABsAAAAZAAAAJAAAABQAAAAiAAAAEwAAADcAAAAoAAAANgAAACUAAAAnAAAANAAAADkAAAAYAAAAFwAAACAAAAAmAAAAfwAAACIAAAAzAAAAHQAAAC8AAAAVAAAAJwAAACUAAAAZAAAAFwAAADsAAAA5AAAALQAAACgAAAAbAAAAJAAAABQAAAA8AAAALgAAADcAAAApAAAAMQAAADUAAAA9AAAAFgAAACEAAAAfAAAAKgAAADoAAAArAAAAPgAAABwAAAAsAAAAGgAAACsAAAA+AAAALwAAAEAAAAAaAAAAKgAAAB0AAAAsAAAANQAAADoAAABBAAAAHAAAAB8AAAAqAAAALQAAACcAAAAjAAAAGQAAAD8AAAA7AAAAOAAAAC4AAAA8AAAAOAAAAEQAAAAbAAAAKAAAACMAAAAvAAAAJgAAACsAAAAdAAAARQAAADMAAABAAAAAMAAAADEAAAAeAAAAIQAAAEMAAABCAAAAMgAAADEAAAB/AAAAPQAAAEIAAAAhAAAAMAAAACkAAAAyAAAAMAAAACAAAAAeAAAARgAAAEMAAAA0AAAAMwAAAEUAAAA2AAAARwAAACYAAAAvAAAAIgAAADQAAAA5AAAARgAAAEoAAAAgAAAAJQAAADIAAAA1AAAAPQAAAEEAAABLAAAAHwAAACkAAAAsAAAANgAAAEcAAAA3AAAASQAAACIAAAAzAAAAJAAAADcAAAAoAAAANgAAACQAAABIAAAAPAAAAEkAAAA4AAAARAAAAD8AAABNAAAAIwAAAC4AAAAtAAAAOQAAADsAAABKAAAATgAAACUAAAAnAAAANAAAADoAAAB/AAAAPgAAAEwAAAAsAAAAQQAAACoAAAA7AAAAPwAAAE4AAABPAAAAJwAAAC0AAAA5AAAAPAAAAEgAAABEAAAAUAAAACgAAAA3AAAALgAAAD0AAAA1AAAAMQAAACkAAABRAAAASwAAAEIAAAA+AAAAKwAAADoAAAAqAAAAUgAAAEAAAABMAAAAPwAAAH8AAAA4AAAALQAAAE8AAAA7AAAATQAAAEAAAAAvAAAAPgAAACsAAABUAAAARQAAAFIAAABBAAAAOgAAADUAAAAsAAAAVgAAAEwAAABLAAAAQgAAAEMAAABRAAAAVQAAADEAAAAwAAAAPQAAAEMAAABCAAAAMgAAADAAAABXAAAAVQAAAEYAAABEAAAAOAAAADwAAAAuAAAAWgAAAE0AAABQAAAARQAAADMAAABAAAAALwAAAFkAAABHAAAAVAAAAEYAAABDAAAANAAAADIAAABTAAAAVwAAAEoAAABHAAAAWQAAAEkAAABbAAAAMwAAAEUAAAA2AAAASAAAAH8AAABJAAAANwAAAFAAAAA8AAAAWAAAAEkAAABbAAAASAAAAFgAAAA2AAAARwAAADcAAABKAAAATgAAAFMAAABcAAAANAAAADkAAABGAAAASwAAAEEAAAA9AAAANQAAAF4AAABWAAAAUQAAAEwAAABWAAAAUgAAAGAAAAA6AAAAQQAAAD4AAABNAAAAPwAAAEQAAAA4AAAAXQAAAE8AAABaAAAATgAAAEoAAAA7AAAAOQAAAF8AAABcAAAATwAAAE8AAABOAAAAPwAAADsAAABdAAAAXwAAAE0AAABQAAAARAAAAEgAAAA8AAAAYwAAAFoAAABYAAAAUQAAAFUAAABeAAAAZQAAAD0AAABCAAAASwAAAFIAAABgAAAAVAAAAGIAAAA+AAAATAAAAEAAAABTAAAAfwAAAEoAAABGAAAAZAAAAFcAAABcAAAAVAAAAEUAAABSAAAAQAAAAGEAAABZAAAAYgAAAFUAAABXAAAAZQAAAGYAAABCAAAAQwAAAFEAAABWAAAATAAAAEsAAABBAAAAaAAAAGAAAABeAAAAVwAAAFMAAABmAAAAZAAAAEMAAABGAAAAVQAAAFgAAABIAAAAWwAAAEkAAABjAAAAUAAAAGkAAABZAAAAYQAAAFsAAABnAAAARQAAAFQAAABHAAAAWgAAAE0AAABQAAAARAAAAGoAAABdAAAAYwAAAFsAAABJAAAAWQAAAEcAAABpAAAAWAAAAGcAAABcAAAAUwAAAE4AAABKAAAAbAAAAGQAAABfAAAAXQAAAE8AAABaAAAATQAAAG0AAABfAAAAagAAAF4AAABWAAAAUQAAAEsAAABrAAAAaAAAAGUAAABfAAAAXAAAAE8AAABOAAAAbQAAAGwAAABdAAAAYAAAAGgAAABiAAAAbgAAAEwAAABWAAAAUgAAAGEAAAB/AAAAYgAAAFQAAABnAAAAWQAAAG8AAABiAAAAbgAAAGEAAABvAAAAUgAAAGAAAABUAAAAYwAAAFAAAABpAAAAWAAAAGoAAABaAAAAcQAAAGQAAABmAAAAUwAAAFcAAABsAAAAcgAAAFwAAABlAAAAZgAAAGsAAABwAAAAUQAAAFUAAABeAAAAZgAAAGUAAABXAAAAVQAAAHIAAABwAAAAZAAAAGcAAABbAAAAYQAAAFkAAAB0AAAAaQAAAG8AAABoAAAAawAAAG4AAABzAAAAVgAAAF4AAABgAAAAaQAAAFgAAABnAAAAWwAAAHEAAABjAAAAdAAAAGoAAABdAAAAYwAAAFoAAAB1AAAAbQAAAHEAAABrAAAAfwAAAGUAAABeAAAAcwAAAGgAAABwAAAAbAAAAGQAAABfAAAAXAAAAHYAAAByAAAAbQAAAG0AAABsAAAAXQAAAF8AAAB1AAAAdgAAAGoAAABuAAAAYgAAAGgAAABgAAAAdwAAAG8AAABzAAAAbwAAAGEAAABuAAAAYgAAAHQAAABnAAAAdwAAAHAAAABrAAAAZgAAAGUAAAB4AAAAcwAAAHIAAABxAAAAYwAAAHQAAABpAAAAdQAAAGoAAAB5AAAAcgAAAHAAAABkAAAAZgAAAHYAAAB4AAAAbAAAAHMAAABuAAAAawAAAGgAAAB4AAAAdwAAAHAAAAB0AAAAZwAAAHcAAABvAAAAcQAAAGkAAAB5AAAAdQAAAH8AAABtAAAAdgAAAHEAAAB5AAAAagAAAHYAAAB4AAAAbAAAAHIAAAB1AAAAeQAAAG0AAAB3AAAAbwAAAHMAAABuAAAAeQAAAHQAAAB4AAAAeAAAAHMAAAByAAAAcAAAAHkAAAB3AAAAdgAAAHkAAAB0AAAAeAAAAHcAAAB1AAAAcQAAAHYAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAABAAAABQAAAAEAAAAAAAAAAAAAAAEAAAAAAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAACAAAABQAAAAEAAAAAAAAA/////wEAAAAAAAAAAwAAAAQAAAACAAAAAAAAAAAAAAABAAAAAAAAAAEAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAMAAAAFAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAFAAAAAQAAAAAAAAAAAAAAAQAAAAMAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAEAAAADAAAAAAAAAAAAAAABAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAADAAAABQAAAAEAAAAAAAAAAAAAAAEAAAAAAAAAAQAAAAAAAAABAAAAAAAAAP////8DAAAAAAAAAAUAAAACAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAEAAAABQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAMAAAAAAAAAAwAAAAAAAAAAAAAAAAAAAAMAAAAFAAAABQAAAAAAAAAAAAAAAwAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAAAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAFAAAABQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAQAAAAAAAAABAAAAAAAAAAMAAAADAAAAAwAAAAAAAAADAAAAAAAAAAAAAAD/////AwAAAAAAAAAFAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAAAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAADAAAAAAAAAAAAAAAAAAAAAwAAAAMAAAAAAAAAAAAAAAEAAAAAAAAAAQAAAAAAAAABAAAAAAAAAAAAAAABAAAAAwAAAAAAAAAAAAAAAQAAAAAAAAADAAAAAwAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAMAAAAAAAAAAwAAAAAAAAAAAAAAAQAAAAMAAAAAAAAAAAAAAAEAAAAAAAAAAwAAAAMAAAADAAAAAwAAAAAAAAADAAAAAAAAAAAAAAADAAAAAAAAAAMAAAAAAAAAAwAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAAAAAAAAwAAAAAAAAAAAAAAAAAAAAMAAAADAAAAAAAAAP////8DAAAAAAAAAAUAAAACAAAAAAAAAAAAAAADAAAAAAAAAAAAAAADAAAAAwAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAwAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAUAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAFAAAABQAAAAAAAAAAAAAAAwAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAwAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAwAAAAMAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAAAAAADAAAAAAAAAAAAAAADAAAAAwAAAAMAAAAAAAAAAwAAAAAAAAAAAAAA/////wMAAAAAAAAABQAAAAIAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAwAAAAAAAAADAAAAAAAAAAAAAAAAAAAAAwAAAAMAAAAAAAAAAAAAAAMAAAAAAAAAAwAAAAAAAAADAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAADAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAADAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAwAAAAAAAAAAAAAA/////wMAAAAAAAAABQAAAAIAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAMAAAADAAAAAAAAAAAAAAADAAAAAwAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAwAAAAMAAAADAAAAAwAAAAAAAAADAAAAAAAAAAMAAAADAAAAAwAAAAMAAAAAAAAAAwAAAAAAAAD/////AwAAAAAAAAAFAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAAAAAADAAAAAAAAAAMAAAADAAAAAwAAAAAAAAADAAAAAAAAAAAAAAADAAAAAAAAAAAAAAAAAAAAAwAAAAMAAAAAAAAAAwAAAAAAAAAAAAAAAwAAAAMAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAAAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAADAAAAAAAAAAAAAAD/////AwAAAAAAAAAFAAAAAgAAAAAAAAAAAAAAAwAAAAMAAAADAAAAAAAAAAAAAAADAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAAAAAAAAwAAAAAAAAAAAAAAAAAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAFAAAAAAAAAAAAAAADAAAAAwAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAADAAAAAQAAAAAAAAABAAAAAAAAAAAAAAABAAAAAwAAAAEAAAAAAAAAAQAAAAAAAAAAAAAAAwAAAAAAAAADAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAAAAAAAAwAAAAAAAAADAAAAAAAAAP////8DAAAAAAAAAAUAAAACAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAwAAAAMAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAADAAAAAAAAAAAAAAADAAAAAwAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAUAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAwAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAFAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAFAAAABQAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAwAAAAAAAAAAAAAA/////wMAAAAAAAAABQAAAAIAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAwAAAAAAAAAFAAAAAAAAAAAAAAAFAAAABQAAAAAAAAAAAAAAAAAAAAEAAAADAAAAAQAAAAAAAAABAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAwAAAAAAAAADAAAAAwAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAADAAAAAQAAAAAAAAABAAAAAAAAAAMAAAADAAAAAwAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAEAAAAAAAAAAwAAAAUAAAABAAAAAAAAAP////8DAAAAAAAAAAUAAAACAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAFAAAABQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAABAAAAAUAAAABAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAIAAAAFAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAEAAAADAAAAAQAAAAAAAAABAAAAAAAAAAUAAAAAAAAAAAAAAAUAAAAFAAAAAAAAAAAAAAD/////AQAAAAAAAAADAAAABAAAAAIAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAUAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAFAAAAAAAAAAAAAAAFAAAABQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAQAAAAUAAAABAAAAAAAAAAAAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAAAAAAAAAAAAAEAAAD//////////wEAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAADAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAsAAAACAAAAAAAAAAAAAAABAAAAAgAAAAYAAAAEAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAYAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAcAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAACAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAYAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAKAAAAAgAAAAAAAAAAAAAAAQAAAAEAAAAFAAAABgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAALAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAABAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAABwAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAsAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACgAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAACAAAAAAAAAAAAAAABAAAAAwAAAAcAAAAGAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAABwAAAAEAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAGAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAADgAAAAIAAAAAAAAAAAAAAAEAAAAAAAAACQAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACgAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAMAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAABwAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAsAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAKAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADQAAAAIAAAAAAAAAAAAAAAEAAAAEAAAACAAAAAoAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAALAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAACQAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAGAAAAAgAAAAAAAAAAAAAAAQAAAAsAAAAPAAAACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAkAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAOAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAEAAAAAAAAAAQAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAIAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAABQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAAAAgAAAAAAAAAAAAAAAQAAAAwAAAAQAAAADAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAoAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAJAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAPAAAAAAAAAAEAAAABAAAAAAAAAAAAAAAAAAAADwAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAADQAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAACAAAAAAAAAAAAAAABAAAACgAAABMAAAAIAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAkAAAABAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAEQAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEQAAAAAAAAABAAAAAQAAAAAAAAAAAAAAAAAAAA8AAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAQAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAACQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAANAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAAAIAAAAAAAAAAAAAAAEAAAANAAAAEQAAAA0AAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAARAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAAEwAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAATAAAAAAAAAAEAAAABAAAAAAAAAAAAAAAAAAAAEQAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAA0AAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAARAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAkAAAACAAAAAAAAAAAAAAABAAAADgAAABIAAAAPAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAADwAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABIAAAAAAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAASAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAEwAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAABEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAATAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEgAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAABIAAAABAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAATAAAAAgAAAAAAAAAAAAAAAQAAAP//////////EwAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAATAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAAEgAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAASAAAAAAAAABgAAAAAAAAAIQAAAAAAAAAeAAAAAAAAACAAAAADAAAAMQAAAAEAAAAwAAAAAwAAADIAAAADAAAACAAAAAAAAAAFAAAABQAAAAoAAAAFAAAAFgAAAAAAAAAQAAAAAAAAABIAAAAAAAAAKQAAAAEAAAAhAAAAAAAAAB4AAAAAAAAABAAAAAAAAAAAAAAABQAAAAIAAAAFAAAADwAAAAEAAAAIAAAAAAAAAAUAAAAFAAAAHwAAAAEAAAAWAAAAAAAAABAAAAAAAAAAAgAAAAAAAAAGAAAAAAAAAA4AAAAAAAAACgAAAAAAAAALAAAAAAAAABEAAAADAAAAGAAAAAEAAAAXAAAAAwAAABkAAAADAAAAAAAAAAAAAAABAAAABQAAAAkAAAAFAAAABQAAAAAAAAACAAAAAAAAAAYAAAAAAAAAEgAAAAEAAAAKAAAAAAAAAAsAAAAAAAAABAAAAAEAAAADAAAABQAAAAcAAAAFAAAACAAAAAEAAAAAAAAAAAAAAAEAAAAFAAAAEAAAAAEAAAAFAAAAAAAAAAIAAAAAAAAABwAAAAAAAAAVAAAAAAAAACYAAAAAAAAACQAAAAAAAAATAAAAAAAAACIAAAADAAAADgAAAAEAAAAUAAAAAwAAACQAAAADAAAAAwAAAAAAAAANAAAABQAAAB0AAAAFAAAAAQAAAAAAAAAHAAAAAAAAABUAAAAAAAAABgAAAAEAAAAJAAAAAAAAABMAAAAAAAAABAAAAAIAAAAMAAAABQAAABoAAAAFAAAAAAAAAAEAAAADAAAAAAAAAA0AAAAFAAAAAgAAAAEAAAABAAAAAAAAAAcAAAAAAAAAGgAAAAAAAAAqAAAAAAAAADoAAAAAAAAAHQAAAAAAAAArAAAAAAAAAD4AAAADAAAAJgAAAAEAAAAvAAAAAwAAAEAAAAADAAAADAAAAAAAAAAcAAAABQAAACwAAAAFAAAADQAAAAAAAAAaAAAAAAAAACoAAAAAAAAAFQAAAAEAAAAdAAAAAAAAACsAAAAAAAAABAAAAAMAAAAPAAAABQAAAB8AAAAFAAAAAwAAAAEAAAAMAAAAAAAAABwAAAAFAAAABwAAAAEAAAANAAAAAAAAABoAAAAAAAAAHwAAAAAAAAApAAAAAAAAADEAAAAAAAAALAAAAAAAAAA1AAAAAAAAAD0AAAADAAAAOgAAAAEAAABBAAAAAwAAAEsAAAADAAAADwAAAAAAAAAWAAAABQAAACEAAAAFAAAAHAAAAAAAAAAfAAAAAAAAACkAAAAAAAAAKgAAAAEAAAAsAAAAAAAAADUAAAAAAAAABAAAAAQAAAAIAAAABQAAABAAAAAFAAAADAAAAAEAAAAPAAAAAAAAABYAAAAFAAAAGgAAAAEAAAAcAAAAAAAAAB8AAAAAAAAAMgAAAAAAAAAwAAAAAAAAADEAAAADAAAAIAAAAAAAAAAeAAAAAwAAACEAAAADAAAAGAAAAAMAAAASAAAAAwAAABAAAAADAAAARgAAAAAAAABDAAAAAAAAAEIAAAADAAAANAAAAAMAAAAyAAAAAAAAADAAAAAAAAAAJQAAAAMAAAAgAAAAAAAAAB4AAAADAAAAUwAAAAAAAABXAAAAAwAAAFUAAAADAAAASgAAAAMAAABGAAAAAAAAAEMAAAAAAAAAOQAAAAEAAAA0AAAAAwAAADIAAAAAAAAAGQAAAAAAAAAXAAAAAAAAABgAAAADAAAAEQAAAAAAAAALAAAAAwAAAAoAAAADAAAADgAAAAMAAAAGAAAAAwAAAAIAAAADAAAALQAAAAAAAAAnAAAAAAAAACUAAAADAAAAIwAAAAMAAAAZAAAAAAAAABcAAAAAAAAAGwAAAAMAAAARAAAAAAAAAAsAAAADAAAAPwAAAAAAAAA7AAAAAwAAADkAAAADAAAAOAAAAAMAAAAtAAAAAAAAACcAAAAAAAAALgAAAAMAAAAjAAAAAwAAABkAAAAAAAAAJAAAAAAAAAAUAAAAAAAAAA4AAAADAAAAIgAAAAAAAAATAAAAAwAAAAkAAAADAAAAJgAAAAMAAAAVAAAAAwAAAAcAAAADAAAANwAAAAAAAAAoAAAAAAAAABsAAAADAAAANgAAAAMAAAAkAAAAAAAAABQAAAAAAAAAMwAAAAMAAAAiAAAAAAAAABMAAAADAAAASAAAAAAAAAA8AAAAAwAAAC4AAAADAAAASQAAAAMAAAA3AAAAAAAAACgAAAAAAAAARwAAAAMAAAA2AAAAAwAAACQAAAAAAAAAQAAAAAAAAAAvAAAAAAAAACYAAAADAAAAPgAAAAAAAAArAAAAAwAAAB0AAAADAAAAOgAAAAMAAAAqAAAAAwAAABoAAAADAAAAVAAAAAAAAABFAAAAAAAAADMAAAADAAAAUgAAAAMAAABAAAAAAAAAAC8AAAAAAAAATAAAAAMAAAA+AAAAAAAAACsAAAADAAAAYQAAAAAAAABZAAAAAwAAAEcAAAADAAAAYgAAAAMAAABUAAAAAAAAAEUAAAAAAAAAYAAAAAMAAABSAAAAAwAAAEAAAAAAAAAASwAAAAAAAABBAAAAAAAAADoAAAADAAAAPQAAAAAAAAA1AAAAAwAAACwAAAADAAAAMQAAAAMAAAApAAAAAwAAAB8AAAADAAAAXgAAAAAAAABWAAAAAAAAAEwAAAADAAAAUQAAAAMAAABLAAAAAAAAAEEAAAAAAAAAQgAAAAMAAAA9AAAAAAAAADUAAAADAAAAawAAAAAAAABoAAAAAwAAAGAAAAADAAAAZQAAAAMAAABeAAAAAAAAAFYAAAAAAAAAVQAAAAMAAABRAAAAAwAAAEsAAAAAAAAAOQAAAAAAAAA7AAAAAAAAAD8AAAADAAAASgAAAAAAAABOAAAAAwAAAE8AAAADAAAAUwAAAAMAAABcAAAAAwAAAF8AAAADAAAAJQAAAAAAAAAnAAAAAwAAAC0AAAADAAAANAAAAAAAAAA5AAAAAAAAADsAAAAAAAAARgAAAAMAAABKAAAAAAAAAE4AAAADAAAAGAAAAAAAAAAXAAAAAwAAABkAAAADAAAAIAAAAAMAAAAlAAAAAAAAACcAAAADAAAAMgAAAAMAAAA0AAAAAAAAADkAAAAAAAAALgAAAAAAAAA8AAAAAAAAAEgAAAADAAAAOAAAAAAAAABEAAAAAwAAAFAAAAADAAAAPwAAAAMAAABNAAAAAwAAAFoAAAADAAAAGwAAAAAAAAAoAAAAAwAAADcAAAADAAAAIwAAAAAAAAAuAAAAAAAAADwAAAAAAAAALQAAAAMAAAA4AAAAAAAAAEQAAAADAAAADgAAAAAAAAAUAAAAAwAAACQAAAADAAAAEQAAAAMAAAAbAAAAAAAAACgAAAADAAAAGQAAAAMAAAAjAAAAAAAAAC4AAAAAAAAARwAAAAAAAABZAAAAAAAAAGEAAAADAAAASQAAAAAAAABbAAAAAwAAAGcAAAADAAAASAAAAAMAAABYAAAAAwAAAGkAAAADAAAAMwAAAAAAAABFAAAAAwAAAFQAAAADAAAANgAAAAAAAABHAAAAAAAAAFkAAAAAAAAANwAAAAMAAABJAAAAAAAAAFsAAAADAAAAJgAAAAAAAAAvAAAAAwAAAEAAAAADAAAAIgAAAAMAAAAzAAAAAAAAAEUAAAADAAAAJAAAAAMAAAA2AAAAAAAAAEcAAAAAAAAAYAAAAAAAAABoAAAAAAAAAGsAAAADAAAAYgAAAAAAAABuAAAAAwAAAHMAAAADAAAAYQAAAAMAAABvAAAAAwAAAHcAAAADAAAATAAAAAAAAABWAAAAAwAAAF4AAAADAAAAUgAAAAAAAABgAAAAAAAAAGgAAAAAAAAAVAAAAAMAAABiAAAAAAAAAG4AAAADAAAAOgAAAAAAAABBAAAAAwAAAEsAAAADAAAAPgAAAAMAAABMAAAAAAAAAFYAAAADAAAAQAAAAAMAAABSAAAAAAAAAGAAAAAAAAAAVQAAAAAAAABXAAAAAAAAAFMAAAADAAAAZQAAAAAAAABmAAAAAwAAAGQAAAADAAAAawAAAAMAAABwAAAAAwAAAHIAAAADAAAAQgAAAAAAAABDAAAAAwAAAEYAAAADAAAAUQAAAAAAAABVAAAAAAAAAFcAAAAAAAAAXgAAAAMAAABlAAAAAAAAAGYAAAADAAAAMQAAAAAAAAAwAAAAAwAAADIAAAADAAAAPQAAAAMAAABCAAAAAAAAAEMAAAADAAAASwAAAAMAAABRAAAAAAAAAFUAAAAAAAAAXwAAAAAAAABcAAAAAAAAAFMAAAAAAAAATwAAAAAAAABOAAAAAAAAAEoAAAADAAAAPwAAAAEAAAA7AAAAAwAAADkAAAADAAAAbQAAAAAAAABsAAAAAAAAAGQAAAAFAAAAXQAAAAEAAABfAAAAAAAAAFwAAAAAAAAATQAAAAEAAABPAAAAAAAAAE4AAAAAAAAAdQAAAAQAAAB2AAAABQAAAHIAAAAFAAAAagAAAAEAAABtAAAAAAAAAGwAAAAAAAAAWgAAAAEAAABdAAAAAQAAAF8AAAAAAAAAWgAAAAAAAABNAAAAAAAAAD8AAAAAAAAAUAAAAAAAAABEAAAAAAAAADgAAAADAAAASAAAAAEAAAA8AAAAAwAAAC4AAAADAAAAagAAAAAAAABdAAAAAAAAAE8AAAAFAAAAYwAAAAEAAABaAAAAAAAAAE0AAAAAAAAAWAAAAAEAAABQAAAAAAAAAEQAAAAAAAAAdQAAAAMAAABtAAAABQAAAF8AAAAFAAAAcQAAAAEAAABqAAAAAAAAAF0AAAAAAAAAaQAAAAEAAABjAAAAAQAAAFoAAAAAAAAAaQAAAAAAAABYAAAAAAAAAEgAAAAAAAAAZwAAAAAAAABbAAAAAAAAAEkAAAADAAAAYQAAAAEAAABZAAAAAwAAAEcAAAADAAAAcQAAAAAAAABjAAAAAAAAAFAAAAAFAAAAdAAAAAEAAABpAAAAAAAAAFgAAAAAAAAAbwAAAAEAAABnAAAAAAAAAFsAAAAAAAAAdQAAAAIAAABqAAAABQAAAFoAAAAFAAAAeQAAAAEAAABxAAAAAAAAAGMAAAAAAAAAdwAAAAEAAAB0AAAAAQAAAGkAAAAAAAAAdwAAAAAAAABvAAAAAAAAAGEAAAAAAAAAcwAAAAAAAABuAAAAAAAAAGIAAAADAAAAawAAAAEAAABoAAAAAwAAAGAAAAADAAAAeQAAAAAAAAB0AAAAAAAAAGcAAAAFAAAAeAAAAAEAAAB3AAAAAAAAAG8AAAAAAAAAcAAAAAEAAABzAAAAAAAAAG4AAAAAAAAAdQAAAAEAAABxAAAABQAAAGkAAAAFAAAAdgAAAAEAAAB5AAAAAAAAAHQAAAAAAAAAcgAAAAEAAAB4AAAAAQAAAHcAAAAAAAAAcgAAAAAAAABwAAAAAAAAAGsAAAAAAAAAZAAAAAAAAABmAAAAAAAAAGUAAAADAAAAUwAAAAEAAABXAAAAAwAAAFUAAAADAAAAdgAAAAAAAAB4AAAAAAAAAHMAAAAFAAAAbAAAAAEAAAByAAAAAAAAAHAAAAAAAAAAXAAAAAEAAABkAAAAAAAAAGYAAAAAAAAAdQAAAAAAAAB5AAAABQAAAHcAAAAFAAAAbQAAAAEAAAB2AAAAAAAAAHgAAAAAAAAAXwAAAAEAAABsAAAAAQAAAHIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAEAAAAAAAAAAAAAAAEAAAABAAAAAQAAAAAAAAAAAAAAAQAAAAAAAAABAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAGAAAAAgAAAAUAAAABAAAABAAAAAAAAAAAAAAABQAAAAMAAAABAAAABgAAAAQAAAACAAAAAAAAAH6iBfbytuk/Gq6akm/58z/Xrm0Liez0P5doSdOpSwRAWs602ULg8D/dT7Rcbo/1v1N1RQHFNOM/g9Snx7HW3L8HWsP8Q3jfP6VwOLosutk/9rjk1YQcxj+gnmKMsNn6P/HDeuPFY+M/YHwDjqKhB0Ci19/fCVrbP4UxKkDWOP6/pvljWa09tL9wi7wrQXjnv/Z6yLImkM2/3yTlOzY14D+m+WNZrT20PzwKVQnrQwNA9nrIsiaQzT/g40rFrRQFwPa45NWEHMa/kbslHEZq97/xw3rjxWPjv4cLC2SMBci/otff3wla27+rKF5oIAv0P1N1RQHFNOO/iDJPGyWHBUAHWsP8Q3jfvwQf/by16gXAfqIF9vK26b8XrO0Vh0r+v9eubQuJ7PS/BxLrA0ZZ479azrTZQuDwv1MK1EuItPw/yscgV9Z6FkAwHBR2WjQMQJNRzXsQ5vY/GlUHVJYKF0DONuFv2lMNQNCGZ28QJfk/0WUwoIL36D8ggDOMQuATQNqMOeAy/wZAWFYOYM+M2z/LWC4uH3oSQDE+LyTsMgRAkJzhRGWFGEDd4soovCQQQKqk0DJMEP8/rGmNdwOLBUAW2X/9xCbjP4hu3dcqJhNAzuYItRvdB0CgzW3zJW/sPxotm/Y2TxRAQAk9XmdDDEC1Kx9MKgT3P1M+NctcghZAFVqcLlb0C0Bgzd3sB2b2P77mZDPUWhZAFROHJpUGCEDAfma5CxXtPz1DWq/zYxRAmhYY5824F0DOuQKWSbAOQNCMqrvu3fs/L6DR22K2wT9nAAxPBU8RQGiN6mW43AFAZhu25b633D8c1YgmzowSQNM25BRKWARArGS08/lNxD+LFssHwmMRQLC5aNcxBgJABL9HT0WRF0CjCmJmOGEOQHsuaVzMP/s/TWJCaGGwBUCeu1PAPLzjP9nqN9DZOBNAKE4JcydbCkCGtbd1qjPzP8dgm9U8jhVAtPeKTkVwDkCeCLss5l37P401XMPLmBdAFd29VMVQDUBg0yA55h75Pz6odcYLCRdApBM4rBrkAkDyAVWgQxbRP4XDMnK20hFAymLlF7EmzD8GUgo9XBHlP3lbK7T9COc/k+OhPthhy7+YGEpnrOvCPzBFhLs15u4/epbqB6H4uz9IuuLF5svev6lzLKY31es/CaQ0envF5z8ZY0xlUADXv7zaz7HYEuI/CfbK1sn16T8uAQfWwxLWPzKn/YuFN94/5KdbC1AFu793fyCSnlfvPzK2y4doAMY/NRg5t1/X6b/shq4QJaHDP5yNIAKPOeI/vpn7BSE30r/X4YQrO6nrv78Ziv/Thto/DqJ1Y6+y5z9l51NaxFrlv8QlA65HOLS/86dxiEc96z+Hj0+LFjneP6LzBZ8LTc2/DaJ1Y6+y579l51NaxFrlP8QlA65HOLQ/8qdxiEc967+Jj0+LFjnev6LzBZ8LTc0/1qdbC1AFuz93fyCSnlfvvzK2y4doAMa/NRg5t1/X6T/vhq4QJaHDv5yNIAKPOeK/wJn7BSE30j/W4YQrO6nrP78Ziv/Thtq/CaQ0envF578XY0xlUADXP7zaz7HYEuK/CvbK1sn16b8rAQfWwxLWvzKn/YuFN96/zWLlF7EmzL8GUgo9XBHlv3lbK7T9COe/kOOhPthhyz+cGEpnrOvCvzBFhLs15u6/c5bqB6H4u79IuuLF5sveP6lzLKY31eu/AQAAAP////8HAAAA/////zEAAAD/////VwEAAP////9hCQAA/////6dBAAD/////kcsBAP/////3kAwA/////8H2VwAAAAAAAAAAAAAAAAACAAAA/////w4AAAD/////YgAAAP////+uAgAA/////8ISAAD/////ToMAAP////8ilwMA/////+4hGQD/////gu2vAAAAAAAAAAAAAAAAAAAAAAACAAAA//////////8BAAAAAwAAAP//////////////////////////////////////////////////////////////////////////AQAAAAAAAAACAAAA////////////////AwAAAP//////////////////////////////////////////////////////////////////////////AQAAAAAAAAACAAAA////////////////AwAAAP//////////////////////////////////////////////////////////////////////////AQAAAAAAAAACAAAA////////////////AwAAAP//////////////////////////////////////////////////////////AgAAAP//////////AQAAAAAAAAD/////////////////////AwAAAP////////////////////////////////////////////////////8DAAAA/////////////////////wAAAAD/////////////////////AQAAAP///////////////wIAAAD///////////////////////////////8DAAAA/////////////////////wAAAAD///////////////8CAAAAAQAAAP////////////////////////////////////////////////////8DAAAA/////////////////////wAAAAD///////////////8CAAAAAQAAAP////////////////////////////////////////////////////8DAAAA/////////////////////wAAAAD///////////////8CAAAAAQAAAP////////////////////////////////////////////////////8DAAAA/////////////////////wAAAAD///////////////8CAAAAAQAAAP////////////////////////////////////////////////////8BAAAAAgAAAP///////////////wAAAAD/////////////////////AwAAAP////////////////////////////////////////////////////8BAAAAAgAAAP///////////////wAAAAD/////////////////////AwAAAP////////////////////////////////////////////////////8BAAAAAgAAAP///////////////wAAAAD/////////////////////AwAAAP////////////////////////////////////////////////////8BAAAAAgAAAP///////////////wAAAAD/////////////////////AwAAAP///////////////////////////////wIAAAD///////////////8BAAAA/////////////////////wAAAAD/////////////////////AwAAAP////////////////////////////////////////////////////8DAAAA/////////////////////wAAAAABAAAA//////////8CAAAA//////////////////////////////////////////////////////////8DAAAA////////////////AgAAAAAAAAABAAAA//////////////////////////////////////////////////////////////////////////8DAAAA////////////////AgAAAAAAAAABAAAA//////////////////////////////////////////////////////////////////////////8DAAAA////////////////AgAAAAAAAAABAAAA//////////////////////////////////////////////////////////////////////////8DAAAAAQAAAP//////////AgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAACAAAAAAAAAAIAAAABAAAAAQAAAAIAAAACAAAAAAAAAAUAAAAFAAAAAAAAAAIAAAACAAAAAwAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAAAAAAAAgAAAAEAAAACAAAAAgAAAAIAAAAAAAAABQAAAAYAAAAAAAAAAgAAAAIAAAADAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAgAAAAAAAAACAAAAAQAAAAMAAAACAAAAAgAAAAAAAAAFAAAABwAAAAAAAAACAAAAAgAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAACAAAAAAAAAAIAAAABAAAABAAAAAIAAAACAAAAAAAAAAUAAAAIAAAAAAAAAAIAAAACAAAAAwAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAIAAAAAAAAAAgAAAAEAAAAAAAAAAgAAAAIAAAAAAAAABQAAAAkAAAAAAAAAAgAAAAIAAAADAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAKAAAAAgAAAAIAAAAAAAAAAwAAAA4AAAACAAAAAAAAAAIAAAADAAAAAAAAAAAAAAACAAAAAgAAAAMAAAAGAAAAAAAAAAAAAAAAAAAAAAAAAAsAAAACAAAAAgAAAAAAAAADAAAACgAAAAIAAAAAAAAAAgAAAAMAAAABAAAAAAAAAAIAAAACAAAAAwAAAAcAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAIAAAACAAAAAAAAAAMAAAALAAAAAgAAAAAAAAACAAAAAwAAAAIAAAAAAAAAAgAAAAIAAAADAAAACAAAAAAAAAAAAAAAAAAAAAAAAAANAAAAAgAAAAIAAAAAAAAAAwAAAAwAAAACAAAAAAAAAAIAAAADAAAAAwAAAAAAAAACAAAAAgAAAAMAAAAJAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAACAAAAAgAAAAAAAAADAAAADQAAAAIAAAAAAAAAAgAAAAMAAAAEAAAAAAAAAAIAAAACAAAAAwAAAAoAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAIAAAACAAAAAAAAAAMAAAAGAAAAAgAAAAAAAAACAAAAAwAAAA8AAAAAAAAAAgAAAAIAAAADAAAACwAAAAAAAAAAAAAAAAAAAAAAAAAGAAAAAgAAAAIAAAAAAAAAAwAAAAcAAAACAAAAAAAAAAIAAAADAAAAEAAAAAAAAAACAAAAAgAAAAMAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAcAAAACAAAAAgAAAAAAAAADAAAACAAAAAIAAAAAAAAAAgAAAAMAAAARAAAAAAAAAAIAAAACAAAAAwAAAA0AAAAAAAAAAAAAAAAAAAAAAAAACAAAAAIAAAACAAAAAAAAAAMAAAAJAAAAAgAAAAAAAAACAAAAAwAAABIAAAAAAAAAAgAAAAIAAAADAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAJAAAAAgAAAAIAAAAAAAAAAwAAAAUAAAACAAAAAAAAAAIAAAADAAAAEwAAAAAAAAACAAAAAgAAAAMAAAAPAAAAAAAAAAAAAAAAAAAAAAAAABAAAAACAAAAAAAAAAIAAAABAAAAEwAAAAIAAAACAAAAAAAAAAUAAAAKAAAAAAAAAAIAAAACAAAAAwAAABAAAAAAAAAAAAAAAAAAAAAAAAAAEQAAAAIAAAAAAAAAAgAAAAEAAAAPAAAAAgAAAAIAAAAAAAAABQAAAAsAAAAAAAAAAgAAAAIAAAADAAAAEQAAAAAAAAAAAAAAAAAAAAAAAAASAAAAAgAAAAAAAAACAAAAAQAAABAAAAACAAAAAgAAAAAAAAAFAAAADAAAAAAAAAACAAAAAgAAAAMAAAASAAAAAAAAAAAAAAAAAAAAAAAAABMAAAACAAAAAAAAAAIAAAABAAAAEQAAAAIAAAACAAAAAAAAAAUAAAANAAAAAAAAAAIAAAACAAAAAwAAABMAAAAAAAAAAAAAAAAAAAAAAAAADwAAAAIAAAAAAAAAAgAAAAEAAAASAAAAAgAAAAIAAAAAAAAABQAAAA4AAAAAAAAAAgAAAAIAAAADAAAAAgAAAAEAAAAAAAAAAQAAAAIAAAAAAAAAAAAAAAIAAAABAAAAAAAAAAEAAAACAAAAAQAAAAAAAAACAAAAAAAAAAUAAAAEAAAAAAAAAAEAAAAFAAAAAAAAAAAAAAAFAAAABAAAAAAAAAABAAAABQAAAAQAAAAAAAAABQAAAAAAAAACAAAAAQAAAAAAAAABAAAAAgAAAAAAAAAAAAAAAgAAAAEAAAAAAAAAAQAAAAIAAAABAAAAAAAAAAIAAAACAAAAAAAAAAEAAAAAAAAAAAAAAAUAAAAEAAAAAAAAAAEAAAAFAAAAAAAAAAAAAAAFAAAABAAAAAAAAAABAAAABQAAAAQAAAAAAAAABQAAAAUAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAABAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAEAAAAAAAAAAAEAAAAAAQAAAAAAAAAAAQAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAABAAAAAAAAAAAAAQAAAAAAAAAAAAA6B6FaUp9QQTPXMuL4myJBraiDfBwx9UBYJseitzTIQOL5if9jqZtAnXX+Z+ycb0C3pucbhRBCQG8wJBYqpRRAlWbDCzCY5z/eFWBUEve6P/+qo4Q50Y4/D9YM3iCcYT8fcA2QJSA0P4ADxu0qAAc/BNcGolVJ2j5d9FACqwquPh9z7MthtI9CSUSYJke/YUJQ/64OyjU0Qpi0+HCmFQdCm3GfIVdh2kHsJ11kAyauQYC3UDFJOoFBSJsFV1OwU0FK5fcxX4AmQWhy/zZIt/lACqaCPsBjzUDbdUNIScugQMYQlVJ4MXNANiuq8GTvRUDxTXnulxEZQFZ8QX5kpuw/qmG/JwYFlEAluh3Q6DB+QKn4vyNq0GZAKOXekas+UUB8xabXXhI6QG63C2pLtSNAdDBtyNfLDUDyOcu67ID2P0rCMvRXAeE/Ki2TSVyzyT9Dk+8Sz2uzP5J+w5ARWp0/NQAoOiMuhj9YnP+RyMJwPxgW7TvQVFk/KgsLYF0kQz9g5dAC6IwzQcgHPVvDex1B1XjppodHBkHJq3OMM9fwQNvcmJ7wddlAInGPpQs/w0BRobq5EBmtQJZ2ai7n+ZVAtv2G5E+bgECG+gIfKBlpQK5f8jdI91JAL39sL/WpPEB8rGxhDqklQK6yUf43XhBAxL9y/tK8+D86XyZpgrHiPwAAAAD/////AAAAAAAAAAAAAAAAAAAAAAAAAAD/////////////////////////////////////AAAAAP////8AAAAAAAAAAAAAAAABAAAAAAAAAAAAAAD/////AAAAAAAAAAABAAAAAQAAAAAAAAAAAAAA/////wAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAP////8FAAAABQAAAAAAAAAAAAAAAAAAAAAAAAD/////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/////////////////////////////////////wAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP////////////////////////////////////8AAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAFAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/////////////////////////////////////AAAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAQAAAAEAAAABAAAAAAAAAAEAAAAAAAAABQAAAAEAAAABAAAAAAAAAAAAAAABAAAAAQAAAAAAAAABAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAQAAAAAAAQABAAABAQAAAAAAAQAAAAEAAAABAAEAAAAAAAAAAAAAAAAAAAAAquJYWJZl+D9jaeZNtj/zPwwdI9KqaeO/qGefXwdHdz+q4lhYlmX4P+OrlPMN3PI/DB0j0qpp47+7SQLV4VIEQKriWFiWZfg/r2kma3tz8T82eQmLqNIGwMRIWXMqSvo/fcCszPux9j+jara6ozTwP6hnn18HR3c/MSoKLequ8r+SabgA2nj0P7jBLbDOHO8/1Ym/ICfH4T+6lxjvlFXHv73m373LRPU/0vXyDVxo7T+ToKRHJXMAQF/33578aPE/pAyy64tD9T8+U/hCvyruPwxv8Y7YYwLAuXYr8NAiCEB4+LDK0Sn0P1Qeuy4j+eo/OMx50n7K7L+TrGB/nyf8v5ehC2fbYPM/aXMKexiT6z8mFRIMjg/zP7yUVwGGBNw/E6opHERf8z/z0wR2g9DqPw4pBpcOhvu/NbA29uWAA8DMaTExyXzyP02biiQ+Ruk/S8jz2/FKBEB1pzZnpbb9P7pQU4wLfPI//7ZcQXeG6D9CqEQvAYoIwDB2VB6sSgRAVyv8H5We8T+EHWF8XNPmPzB2wT8Nrrg/SEi+cX+w4L8of+GtdSDxP1sjk5AdouU/6ZjOVru13r8K0obqI6bxvwVbdNXyhfA/w5GG024n5z+rwmtMzP8BwLw9pSX49QXABe/2uQxP8D+b6wCzCvXkP7uGT87fK+Q/pz/JWw4coj+qoBf2J0nwP/yE3PUo0+I/vFJeHcaC+D96luSIqvntP/bf8sHUYu8/gZNN41mL4z9bhOqVOF4FwO6lmAh1hQhAbCVxbdhk7z+1C8NdDcfiPwG36x/0OQBAx0WJ76c2+D9nlSHXANfuP2HlfZ3gqOE/EwnVlVPg9r96+oHzEH//v5bXzdT1Auw/DM3GwLsA4D9p/8uoKcr+v+U9x5DQVAPAehjSdghb7D9sc1IetODgP8MVwwB1pu6/azPk6OGe978W8t/TUc3rP+0QMvYfP+A/RsG/QpSE8D+l3uwScxzgPwQaifgujuw/k1Vti1I43z8MAwLnSh0GQH5nYnwwZgJAiGUzWC5s6j8WyyI/BbLgPw4iUapGeQJAB3W+imnp/j9BLWR4ssrpP2t+gG5Pstk/cpBsfm6DCMCOpU9dOZsFQEv8nFypHeo/ehJ6i+6S2D9jqlGEmarLv7STC5TRiOa/bC+x8WZD6D9H3yUkWpDZP8gZvmCMuQLAreY19/eRBsCoPOc8UzzpP6KI/QV+y9g/t/MoboyWzT+Hv5q3Zu3Mvy2xROCT4uY/9gQitMMg1T9abAqhWMDkv1oLTavoUfG/PMUJP9CD5j+fHRX3t6fSPz7W2gk6bvs/WRnuHwqN9D8YFturGCTmP1EZczv0b9I/5t4exabB5D/1ESLh5fTEP9X2z6SYweQ/6lv3I2zT0D9zkRGNUNMAQKoSvc4EIfs/Xggt8wQI5T+mJHHg/w/SP4lhT/9t8vQ/DrZ/DbwH7D+XlhbYZrjkP34LIpFt6c4/lwfp8fLX9L+j96CTTf76v3WdNhEv9uM/d8c3o4lV0D/vFdCHVcsFwAHeDq0F1QhApbYqcZiN5D9KoilqByXLPwX0/diA0vq/0fo0GxnxAMBbaTkvlCzjP/RrFrWXrMs/UYTrky7jA0DB9f4FiZYAQEGAk/3QzeE/r/TeqE8t0D/OqjlsnPbvvz8RKU8JOfW/smSEbK/O4T8MzuyPm3DDP/rFtctq9gZAfb1EVEaSA0Dts5dVInnhP18SFMc79MM/7y34cw6LAMDFrRJsZO0DwC2KLvLSYuA/hx5wcUHewz+49SnK/4ruPyeS0PX9a+E/ZxaaLvvZ3z8WPu5T2QS8Pygo4RIvMqa/BJ0Kqsd0279cKW4ay8jdP3b05bmZ364/10/qtdxk2r+Bcz6CDMvpv54qOw+Amdw/qLV71pW7sT/YKc80nIPUP8OfIaBJ77G/LyTuD1un2z+diYu8efWzP1wU7ACkfwjAZroyPL1yBkAmv3lKJJbbPysKSE4W+p0/dIgqY79TA8ATLTOQ3tsGwJ2zweD/Xdg/XO/jXeFUaL8VW2qLFKfov1cA9Aa6XfK/tIa7YGgI2T+f3hu/sxqPv2nXdPpf3Pc/jkw8Jbda8j+tT/z8tGPVP1yBHpJd35k/KYvYOy1s8j/yz+kCQjPrP9+agH7x59g/PZfJ9aBhpr/rDKzvYBb+PwtkiaGCt/c/vb1mVr+f1T/JIHwHc8Govw7aeF6+9vG/Xv7kD6fp979isYioQYHVP7AIQZuSFrG/3z1AdUTnAUDN3XY9O7f9P0AdQ9ljYNQ/dJANJPTOrb8kLECUiiPlP4yF7UgmStA/9xGmXxCG1T9qZzix4W2zv2SGJRJVrPe/Fh9a2M/B/b8IexzFCoPSP9y1QFD2bLe/Q86cWLJe/b+mOOfYm78BwOTjkPAGE9E/8aPCUKu/ub9pPZyLCiUGwBA7Mev/BQlALOmrlRi+0j+AMJ/dKULBv7iLtL6a6QRAEMDV/yajAUDa62dE3crJP1P70RgBUbq/38hVnR6esT/s1tG10Z/Ov/zLwalHPss/dTS9NKTXx78nMcRzCIEHQAabxDsAmQRA0tyLK3gSyT+Aui7nOhDGv5Gs58z3WgHATN3forJuBMCAui7nOhDGP9Lciyt4Esm/WAJyHQ4c7z8UP5HFIs3iP3U0vTSk18c//MvBqUc+y7+cvv8HLg/Kvy1I/mHsI+K/U/vRGAFRuj/a62dE3crJv8p+WV8KlQjAuQ/nOP43B0CAMJ/dKULBPyzpq5UYvtK/ZoU+VoLh4L9etLlRUfvtv/GjwlCrv7k/5OOQ8AYT0b9DfT9FhufXPwUX8hJp+4u/3LVAUPZstz8IexzFCoPSv9+L609E5fQ/q9Fz7X2J7T9qZzix4W2zP/cRpl8QhtW/vtNilqGX+j8MOy7QJoL0P3SQDST0zq0/QB1D2WNg1L8IIjSvGNkDwGB8Jou2GAfAsAhBm5IWsT9isYioQYHVvyS9D3zb6uy/gnwRa7uM9L/JIHwHc8GoP729Zla/n9W/CsAHJZwmAEDEW6OYT1r6Pz2XyfWgYaY/35qAfvHn2L83Tdy4lS30vxf2/gZ0jPq/XIEekl3fmb+tT/z8tGPVvybPr2zJ1/+/K7mJ0ypVAsCf3hu/sxqPPwCGu2BoCNm/5oITrpZn+r+UDUyDP+n/v1zv413hVGg/nbPB4P9d2L9MlmkxNvgCQMtZlKE85v8/KwpIThb6nb8mv3lKJJbbv8+SZsTvOOc/pQCIIOYw0j+diYu8efWzvy8k7g9bp9u/kxYDa+pKtD9XlYvA8HnVv6i1e9aVu7G/nio7D4CZ3L/WR6rNh5EGwCkgQweBkghAdvTluZnfrr9cKW4ay8jdvxbjhr1f1QVAR5C0MzivAkAWPu5T2QS8v2cWmi772d+/cKj4lzLJCEBx2QJfYrMFQIcecHFB3sO/LYou8tJi4L+jr7lhO38BwIcI0Nb7xgTAXxIUxzv0w7/ts5dVInnhv0T+l8DZLfE/MP3FoFvS5D8MzuyPm3DDv7JkhGyvzuG/tzhzRIRc0b9Ovv3/0z7mv6/03qhPLdC/m4CT/dDN4b9dwjU5VCQBQBBJX1ntCv0/9GsWtZesy79baTkvlCzjv1mjYgEz++S/oW6KnOQW8b9KoilqByXLv6W2KnGYjeS/SmaKz3Vx9z+BZB5yxGHwP3fHN6OJVdC/dZ02ES/2478PuaBjLrXaP4/JU81pPaO/fgsikW3pzr+XlhbYZrjkv4tSn7YDbP0/f2LnFKlF9z+mJHHg/w/Sv14ILfMECOW/mfg4qYhR/b+OP+RQDCACwOpb9yNs09C/1fbPpJjB5L9pN2WOVZ3wv3hHy9nxIve/URlzO/Rv0r8YFturGCTmv1d1/KKR8QPA8gsy9qzSB8CfHRX3t6fSvzzFCT/Qg+a/EYStnrzV9r/2QJqI7Lb9v/YEIrTDINW/LbFE4JPi5r/7kQEs5fEDQHunnf4GeQBAooj9BX7L2L+oPOc8Uzzpv+ydYY2SSAfAL4HK6CRTB0BH3yUkWpDZv2wvsfFmQ+i/Ik0Yzruh6T8fM3LoGoDUP3oSeovukti/S/ycXKkd6r9rEv+7UWcHQCRIQe/GfwNAa36Abk+y2b9BLWR4ssrpv9KT87qa0bM/FTyktw823L8WyyI/BbLgv4hlM1gubOq/DizMp9Ki6r8b5ckdjVrzv5NVbYtSON+/BBqJ+C6O7L/dUBFqgyXYv00Wh18r7+q/7RAy9h8/4L8W8t/TUc3rv4RM5DKx3wDAfvWIj94aBcBsc1IetODgv3oY0nYIW+y/oGcTFF54AUDkJqS/FKX6PwzNxsC7AOC/ltfN1PUC7L+5Wrz/zHnzP6688w2rNOc/YeV9neCo4b9nlSHXANfuvw9RsxKjY/s/1V8GteXE8j+1C8NdDcfiv2wlcW3YZO+/IOywaA7Q8b9bFP+4Tg36v4GTTeNZi+O/9t/ywdRi77+tRc3yFR7eP2bkcHXJkLO//ITc9SjT4r+qoBf2J0nwv2YHKoswwfm/iQcLspCjAcCb6wCzCvXkvwXv9rkMT/C/YkuwYAMXBMApCNUai9kIwMORhtNuJ+e/BVt01fKF8L+ZqWEfvIjsP6h693QZYNk/WyOTkB2i5b8of+GtdSDxvwpaaulDSwVADMQAX+lOAECEHWF8XNPmv1cr/B+VnvG/XyFG6opcCMD/mtR32/UEQP+2XEF3hui/ulBTjAt88r/imfCfRP+yP9zbvtc8XeO/TZuKJD5G6b/MaTExyXzyvxiTQeElXOO/rbJRQVGN9L/z0wR2g9DqvxOqKRxEX/O/FDGCEei99j9x8zV4VYTmP2lzCnsYk+u/l6ELZ9tg878pRXacaDT/v3k6GZRqoQXAVB67LiP56r94+LDK0Sn0vwO6pZ9b7wFAvK0nKVcc9j8+U/hCvyruv6QMsuuLQ/W/FPhKFYv46j8MyxaDTOW/v9L18g1caO2/vebfvctE9b/7GD8ZrF3xv3gx1AR9bQDAuMEtsM4c77+SabgA2nj0v5xKFIwxsATArKNSBaKsB0Cjara6ozTwv33ArMz7sfa/dF2U0FcWCcDxL357DJX/P69pJmt7c/G/quJYWJZl+L/YntVJlnrSP4sRLzXM+fe/46uU8w3c8r+q4lhYlmX4v85lu5+QRwRAsI0H/WU8479jaeZNtj/zv6riWFiWZfi/sI0H/WU847/OZbufkEcEQHAoPUBrnss/9exKzDtFtT88wM8kax+gP9OqeKeAYog/MW0ItiZvcj+ph+smvt5bP2lCaV5dEUU/StaUmQDaLz+kK9y22BMYP0O3whZuMwI/IIbgZGWE6z7UkjYaEM3UPuezxwa9cr8+LybxRMnFpz6E1N8DbPiRPsYjySMvK3s+//////8fAAj//////zMQCP////9/MiAI/////28yMAj/////YzJACP///z9iMlAI////N2IyYAj///8zYjJwCP//vzNiMoAI//+rM2IykAj/f6szYjKgCP8PqzNiMrAI/wOrM2IywAi/A6szYjLQCJ8DqzNiMuAImQOrM2Iy8Aj//////z8PCP//////Kx8I/////38pLwj/////Pyk/CP////85KU8I////PzgpXwj///8POClvCP///w44KX8I//8fDjgpjwj//w8OOCmfCP9/DQ44Ka8I/w8NDjgpvwj/DQ0OOCnPCP8MDQ44Kd8IxwwNDjgp7wjEDA0OOCn/CAcAAAAHAAAAAQAAAAIAAAAEAAAAAwAAAAAAAAAAAAAABwAAAAMAAAABAAAAAgAAAAUAAAAEAAAAAAAAAAAAAAAEAAAABAAAAAAAAAACAAAAAQAAAAMAAAAOAAAABgAAAAsAAAACAAAABwAAAAEAAAAYAAAABQAAAAoAAAABAAAABgAAAAAAAAAmAAAABwAAAAwAAAADAAAACAAAAAIAAAAxAAAACQAAAA4AAAAAAAAABQAAAAQAAAA6AAAACAAAAA0AAAAEAAAACQAAAAMAAAA/AAAACwAAAAYAAAAPAAAACgAAABAAAABIAAAADAAAAAcAAAAQAAAACwAAABEAAABTAAAACgAAAAUAAAATAAAADgAAAA8AAABhAAAADQAAAAgAAAARAAAADAAAABIAAABrAAAADgAAAAkAAAASAAAADQAAABMAAAB1AAAADwAAABMAAAARAAAAEgAAABAAAAAGAAAAAgAAAAMAAAAFAAAABAAAAAAAAAAAAAAAAAAAAAYAAAACAAAAAwAAAAEAAAAFAAAABAAAAAAAAAAAAAAABwAAAAUAAAADAAAABAAAAAEAAAAAAAAAAgAAAAAAAAACAAAAAwAAAAEAAAAFAAAABAAAAAYAAAAAAAAAAAAAABgtRFT7Ifk/GC1EVPsh+b8YLURU+yEJQBgtRFT7IQnAYWxnb3MuYwBoM05laWdoYm9yUm90YXRpb25zAGNvb3JkaWprLmMAX3VwQXA3Q2hlY2tlZABfdXBBcDdyQ2hlY2tlZABkaXJlY3RlZEVkZ2UuYwBkaXJlY3RlZEVkZ2VUb0JvdW5kYXJ5AGFkamFjZW50RmFjZURpclt0bXBGaWprLmZhY2VdW2ZpamsuZmFjZV0gPT0gS0kAZmFjZWlqay5jAF9mYWNlSWprUGVudFRvQ2VsbEJvdW5kYXJ5AGFkamFjZW50RmFjZURpcltjZW50ZXJJSksuZmFjZV1bZmFjZTJdID09IEtJAF9mYWNlSWprVG9DZWxsQm91bmRhcnkAaDNJbmRleC5jAGNvbXBhY3RDZWxscwBsYXRMbmdUb0NlbGwAY2VsbFRvQ2hpbGRQb3MAdmFsaWRhdGVDaGlsZFBvcwBsYXRMbmcuYwBjZWxsQXJlYVJhZHMyAHBvbHlnb24tPm5leHQgPT0gTlVMTABsaW5rZWRHZW8uYwBhZGROZXdMaW5rZWRQb2x5Z29uAG5leHQgIT0gTlVMTABsb29wICE9IE5VTEwAYWRkTmV3TGlua2VkTG9vcABwb2x5Z29uLT5maXJzdCA9PSBOVUxMAGFkZExpbmtlZExvb3AAY29vcmQgIT0gTlVMTABhZGRMaW5rZWRDb29yZABsb29wLT5maXJzdCA9PSBOVUxMAGlubmVyTG9vcHMgIT0gTlVMTABub3JtYWxpemVNdWx0aVBvbHlnb24AYmJveGVzICE9IE5VTEwAY2FuZGlkYXRlcyAhPSBOVUxMAGZpbmRQb2x5Z29uRm9ySG9sZQBjYW5kaWRhdGVCQm94ZXMgIT0gTlVMTAByZXZEaXIgIT0gSU5WQUxJRF9ESUdJVABsb2NhbGlqLmMAY2VsbFRvTG9jYWxJamsAYmFzZUNlbGwgIT0gb3JpZ2luQmFzZUNlbGwAIShvcmlnaW5PblBlbnQgJiYgaW5kZXhPblBlbnQpAGJhc2VDZWxsID09IG9yaWdpbkJhc2VDZWxsAGJhc2VDZWxsICE9IElOVkFMSURfQkFTRV9DRUxMAGxvY2FsSWprVG9DZWxsACFfaXNCYXNlQ2VsbFBlbnRhZ29uKGJhc2VDZWxsKQBiYXNlQ2VsbFJvdGF0aW9ucyA+PSAwAGdyaWRQYXRoQ2VsbHMAcG9seWZpbGwuYwBpdGVyU3RlcFBvbHlnb25Db21wYWN0ADAAdmVydGV4LmMAdmVydGV4Um90YXRpb25zAGNlbGxUb1ZlcnRleABncmFwaC0+YnVja2V0cyAhPSBOVUxMAHZlcnRleEdyYXBoLmMAaW5pdFZlcnRleEdyYXBoAG5vZGUgIT0gTlVMTABhZGRWZXJ0ZXhOb2Rl";var tt=28640;function Vt(Ze,pt,It,at){Jr("Assertion failed: "+G(Ze)+", at: "+[pt?G(pt):"unknown filename",It,at?G(at):"unknown function"])}function Bt(){return J.length}function Wt(Ze,pt,It){te.set(te.subarray(pt,pt+It),Ze)}function ln(Ze){return e.___errno_location&&(ne[e.___errno_location()>>2]=Ze),Ze}function St(Ze){Jr("OOM")}function Kt(Ze){try{var pt=new ArrayBuffer(Ze);return pt.byteLength!=Ze?void 0:(new Int8Array(pt).set(J),jt(pt),he(pt),1)}catch{}}function rn(Ze){var pt=Bt(),It=16777216,at=2147483648-It;if(Ze>at)return!1;for(var d=16777216,ee=Math.max(pt,d);ee>4,d=(Gn&15)<<4|Xn>>2,ee=(Xn&3)<<6|un,It=It+String.fromCharCode(at),Xn!==64&&(It=It+String.fromCharCode(d)),un!==64&&(It=It+String.fromCharCode(ee));while(qn13780509?(f=Hu(15,f)|0,f|0):(p=((A|0)<0)<<31>>31,y=fr(A|0,p|0,3,0)|0,_=K()|0,p=Xt(A|0,p|0,1,0)|0,p=fr(y|0,_|0,p|0,K()|0)|0,p=Xt(p|0,K()|0,1,0)|0,A=K()|0,d[f>>2]=p,d[f+4>>2]=A,f=0,f|0)}function ve(A,f,p,_){return A=A|0,f=f|0,p=p|0,_=_|0,ot(A,f,p,_,0)|0}function ot(A,f,p,_,y){A=A|0,f=f|0,p=p|0,_=_|0,y=y|0;var T=0,M=0,N=0,U=0,I=0;if(U=Q,Q=Q+16|0,M=U,!(Rt(A,f,p,_,y)|0))return _=0,Q=U,_|0;do if((p|0)>=0){if((p|0)>13780509){if(T=Hu(15,M)|0,T|0)break;N=M,M=d[N>>2]|0,N=d[N+4>>2]|0}else T=((p|0)<0)<<31>>31,I=fr(p|0,T|0,3,0)|0,N=K()|0,T=Xt(p|0,T|0,1,0)|0,T=fr(I|0,N|0,T|0,K()|0)|0,T=Xt(T|0,K()|0,1,0)|0,N=K()|0,d[M>>2]=T,d[M+4>>2]=N,M=T;if(uo(_|0,0,M<<3|0)|0,y|0){uo(y|0,0,M<<2|0)|0,T=Zt(A,f,p,_,y,M,N,0)|0;break}T=Ks(M,4)|0,T?(I=Zt(A,f,p,_,T,M,N,0)|0,An(T),T=I):T=13}else T=2;while(!1);return I=T,Q=U,I|0}function Rt(A,f,p,_,y){A=A|0,f=f|0,p=p|0,_=_|0,y=y|0;var T=0,M=0,N=0,U=0,I=0,q=0,ie=0,de=0,Ae=0,pe=0,Me=0;if(Me=Q,Q=Q+16|0,Ae=Me,pe=Me+8|0,de=Ae,d[de>>2]=A,d[de+4>>2]=f,(p|0)<0)return pe=2,Q=Me,pe|0;if(T=_,d[T>>2]=A,d[T+4>>2]=f,T=(y|0)!=0,T&&(d[y>>2]=0),Ci(A,f)|0)return pe=9,Q=Me,pe|0;d[pe>>2]=0;e:do if((p|0)>=1)if(T)for(q=1,I=0,ie=0,de=1,T=A;;){if(!(I|ie)){if(T=cn(T,f,4,pe,Ae)|0,T|0)break e;if(f=Ae,T=d[f>>2]|0,f=d[f+4>>2]|0,Ci(T,f)|0){T=9;break e}}if(T=cn(T,f,d[26800+(ie<<2)>>2]|0,pe,Ae)|0,T|0)break e;if(f=Ae,T=d[f>>2]|0,f=d[f+4>>2]|0,A=_+(q<<3)|0,d[A>>2]=T,d[A+4>>2]=f,d[y+(q<<2)>>2]=de,A=I+1|0,M=(A|0)==(de|0),N=ie+1|0,U=(N|0)==6,Ci(T,f)|0){T=9;break e}if(de=de+(U&M&1)|0,(de|0)>(p|0)){T=0;break}else q=q+1|0,I=M?0:A,ie=M?U?0:N:ie}else for(q=1,I=0,ie=0,de=1,T=A;;){if(!(I|ie)){if(T=cn(T,f,4,pe,Ae)|0,T|0)break e;if(f=Ae,T=d[f>>2]|0,f=d[f+4>>2]|0,Ci(T,f)|0){T=9;break e}}if(T=cn(T,f,d[26800+(ie<<2)>>2]|0,pe,Ae)|0,T|0)break e;if(f=Ae,T=d[f>>2]|0,f=d[f+4>>2]|0,A=_+(q<<3)|0,d[A>>2]=T,d[A+4>>2]=f,A=I+1|0,M=(A|0)==(de|0),N=ie+1|0,U=(N|0)==6,Ci(T,f)|0){T=9;break e}if(de=de+(U&M&1)|0,(de|0)>(p|0)){T=0;break}else q=q+1|0,I=M?0:A,ie=M?U?0:N:ie}else T=0;while(!1);return pe=T,Q=Me,pe|0}function Zt(A,f,p,_,y,T,M,N){A=A|0,f=f|0,p=p|0,_=_|0,y=y|0,T=T|0,M=M|0,N=N|0;var U=0,I=0,q=0,ie=0,de=0,Ae=0,pe=0,Me=0,Le=0,Ye=0;if(Me=Q,Q=Q+16|0,Ae=Me+8|0,pe=Me,U=ec(A|0,f|0,T|0,M|0)|0,q=K()|0,ie=_+(U<<3)|0,Le=ie,Ye=d[Le>>2]|0,Le=d[Le+4>>2]|0,I=(Ye|0)==(A|0)&(Le|0)==(f|0),!((Ye|0)==0&(Le|0)==0|I))do U=Xt(U|0,q|0,1,0)|0,U=th(U|0,K()|0,T|0,M|0)|0,q=K()|0,ie=_+(U<<3)|0,Ye=ie,Le=d[Ye>>2]|0,Ye=d[Ye+4>>2]|0,I=(Le|0)==(A|0)&(Ye|0)==(f|0);while(!((Le|0)==0&(Ye|0)==0|I));if(U=y+(U<<2)|0,I&&(d[U>>2]|0)<=(N|0)||(Ye=ie,d[Ye>>2]=A,d[Ye+4>>2]=f,d[U>>2]=N,(N|0)>=(p|0)))return Ye=0,Q=Me,Ye|0;switch(I=N+1|0,d[Ae>>2]=0,U=cn(A,f,2,Ae,pe)|0,U|0){case 9:{de=9;break}case 0:{U=pe,U=Zt(d[U>>2]|0,d[U+4>>2]|0,p,_,y,T,M,I)|0,U||(de=9);break}}e:do if((de|0)==9){switch(d[Ae>>2]=0,U=cn(A,f,3,Ae,pe)|0,U|0){case 9:break;case 0:{if(U=pe,U=Zt(d[U>>2]|0,d[U+4>>2]|0,p,_,y,T,M,I)|0,U|0)break e;break}default:break e}switch(d[Ae>>2]=0,U=cn(A,f,1,Ae,pe)|0,U|0){case 9:break;case 0:{if(U=pe,U=Zt(d[U>>2]|0,d[U+4>>2]|0,p,_,y,T,M,I)|0,U|0)break e;break}default:break e}switch(d[Ae>>2]=0,U=cn(A,f,5,Ae,pe)|0,U|0){case 9:break;case 0:{if(U=pe,U=Zt(d[U>>2]|0,d[U+4>>2]|0,p,_,y,T,M,I)|0,U|0)break e;break}default:break e}switch(d[Ae>>2]=0,U=cn(A,f,4,Ae,pe)|0,U|0){case 9:break;case 0:{if(U=pe,U=Zt(d[U>>2]|0,d[U+4>>2]|0,p,_,y,T,M,I)|0,U|0)break e;break}default:break e}switch(d[Ae>>2]=0,U=cn(A,f,6,Ae,pe)|0,U|0){case 9:break;case 0:{if(U=pe,U=Zt(d[U>>2]|0,d[U+4>>2]|0,p,_,y,T,M,I)|0,U|0)break e;break}default:break e}return Ye=0,Q=Me,Ye|0}while(!1);return Ye=U,Q=Me,Ye|0}function cn(A,f,p,_,y){A=A|0,f=f|0,p=p|0,_=_|0,y=y|0;var T=0,M=0,N=0,U=0,I=0,q=0,ie=0,de=0,Ae=0,pe=0;if(p>>>0>6)return y=1,y|0;if(ie=(d[_>>2]|0)%6|0,d[_>>2]=ie,(ie|0)>0){T=0;do p=Uu(p)|0,T=T+1|0;while((T|0)<(d[_>>2]|0))}if(ie=yt(A|0,f|0,45)|0,K()|0,q=ie&127,q>>>0>121)return y=5,y|0;U=$s(A,f)|0,T=yt(A|0,f|0,52)|0,K()|0,T=T&15;e:do if(!T)I=8;else{for(;;){if(M=(15-T|0)*3|0,N=yt(A|0,f|0,M|0)|0,K()|0,N=N&7,(N|0)==7){f=5;break}if(pe=(Ss(T)|0)==0,T=T+-1|0,de=Nt(7,0,M|0)|0,f=f&~(K()|0),Ae=Nt(d[(pe?432:16)+(N*28|0)+(p<<2)>>2]|0,0,M|0)|0,M=K()|0,p=d[(pe?640:224)+(N*28|0)+(p<<2)>>2]|0,A=Ae|A&~de,f=M|f,!p){p=0;break e}if(!T){I=8;break e}}return f|0}while(!1);(I|0)==8&&(pe=d[848+(q*28|0)+(p<<2)>>2]|0,Ae=Nt(pe|0,0,45)|0,A=Ae|A,f=K()|0|f&-1040385,p=d[4272+(q*28|0)+(p<<2)>>2]|0,(pe&127|0)==127&&(pe=Nt(d[848+(q*28|0)+20>>2]|0,0,45)|0,f=K()|0|f&-1040385,p=d[4272+(q*28|0)+20>>2]|0,A=ku(pe|A,f)|0,f=K()|0,d[_>>2]=(d[_>>2]|0)+1)),N=yt(A|0,f|0,45)|0,K()|0,N=N&127;e:do if(Bi(N)|0){t:do if(($s(A,f)|0)==1){if((q|0)!=(N|0))if(Ru(N,d[7696+(q*28|0)>>2]|0)|0){A=hp(A,f)|0,M=1,f=K()|0;break}else Ut(27795,26864,533,26872);switch(U|0){case 3:{A=ku(A,f)|0,f=K()|0,d[_>>2]=(d[_>>2]|0)+1,M=0;break t}case 5:{A=hp(A,f)|0,f=K()|0,d[_>>2]=(d[_>>2]|0)+5,M=0;break t}case 0:return pe=9,pe|0;default:return pe=1,pe|0}}else M=0;while(!1);if((p|0)>0){T=0;do A=cp(A,f)|0,f=K()|0,T=T+1|0;while((T|0)!=(p|0))}if((q|0)!=(N|0)){if(!(Wc(N)|0)){if((M|0)!=0|($s(A,f)|0)!=5)break;d[_>>2]=(d[_>>2]|0)+1;break}switch(ie&127){case 8:case 118:break e}($s(A,f)|0)!=3&&(d[_>>2]=(d[_>>2]|0)+1)}}else if((p|0)>0){T=0;do A=ku(A,f)|0,f=K()|0,T=T+1|0;while((T|0)!=(p|0))}while(!1);return d[_>>2]=((d[_>>2]|0)+p|0)%6|0,pe=y,d[pe>>2]=A,d[pe+4>>2]=f,pe=0,pe|0}function Yn(A,f,p,_){return A=A|0,f=f|0,p=p|0,_=_|0,yi(A,f,p,_)|0?(uo(_|0,0,p*48|0)|0,_=js(A,f,p,_)|0,_|0):(_=0,_|0)}function yi(A,f,p,_){A=A|0,f=f|0,p=p|0,_=_|0;var y=0,T=0,M=0,N=0,U=0,I=0,q=0,ie=0,de=0,Ae=0,pe=0;if(pe=Q,Q=Q+16|0,de=pe,Ae=pe+8|0,ie=de,d[ie>>2]=A,d[ie+4>>2]=f,(p|0)<0)return Ae=2,Q=pe,Ae|0;if(!p)return Ae=_,d[Ae>>2]=A,d[Ae+4>>2]=f,Ae=0,Q=pe,Ae|0;d[Ae>>2]=0;e:do if(Ci(A,f)|0)A=9;else{y=0,ie=A;do{if(A=cn(ie,f,4,Ae,de)|0,A|0)break e;if(f=de,ie=d[f>>2]|0,f=d[f+4>>2]|0,y=y+1|0,Ci(ie,f)|0){A=9;break e}}while((y|0)<(p|0));q=_,d[q>>2]=ie,d[q+4>>2]=f,q=p+-1|0,I=0,A=1;do{if(y=26800+(I<<2)|0,(I|0)==5)for(M=d[y>>2]|0,T=0,y=A;;){if(A=de,A=cn(d[A>>2]|0,d[A+4>>2]|0,M,Ae,de)|0,A|0)break e;if((T|0)!=(q|0))if(U=de,N=d[U>>2]|0,U=d[U+4>>2]|0,A=_+(y<<3)|0,d[A>>2]=N,d[A+4>>2]=U,!(Ci(N,U)|0))A=y+1|0;else{A=9;break e}else A=y;if(T=T+1|0,(T|0)>=(p|0))break;y=A}else for(M=de,U=d[y>>2]|0,N=0,y=A,T=d[M>>2]|0,M=d[M+4>>2]|0;;){if(A=cn(T,M,U,Ae,de)|0,A|0)break e;if(M=de,T=d[M>>2]|0,M=d[M+4>>2]|0,A=_+(y<<3)|0,d[A>>2]=T,d[A+4>>2]=M,A=y+1|0,Ci(T,M)|0){A=9;break e}if(N=N+1|0,(N|0)>=(p|0))break;y=A}I=I+1|0}while(I>>>0<6);A=de,A=(ie|0)==(d[A>>2]|0)&&(f|0)==(d[A+4>>2]|0)?0:9}while(!1);return Ae=A,Q=pe,Ae|0}function js(A,f,p,_){A=A|0,f=f|0,p=p|0,_=_|0;var y=0,T=0,M=0,N=0,U=0,I=0,q=0,ie=0,de=0;if(ie=Q,Q=Q+16|0,M=ie,!p)return d[_>>2]=A,d[_+4>>2]=f,_=0,Q=ie,_|0;do if((p|0)>=0){if((p|0)>13780509){if(y=Hu(15,M)|0,y|0)break;T=M,y=d[T>>2]|0,T=d[T+4>>2]|0}else y=((p|0)<0)<<31>>31,q=fr(p|0,y|0,3,0)|0,T=K()|0,y=Xt(p|0,y|0,1,0)|0,y=fr(q|0,T|0,y|0,K()|0)|0,y=Xt(y|0,K()|0,1,0)|0,T=K()|0,q=M,d[q>>2]=y,d[q+4>>2]=T;if(I=Ks(y,8)|0,!I)y=13;else{if(q=Ks(y,4)|0,!q){An(I),y=13;break}if(y=Zt(A,f,p,I,q,y,T,0)|0,y|0){An(I),An(q);break}if(f=d[M>>2]|0,M=d[M+4>>2]|0,(M|0)>0|(M|0)==0&f>>>0>0){y=0,N=0,U=0;do A=I+(N<<3)|0,T=d[A>>2]|0,A=d[A+4>>2]|0,!((T|0)==0&(A|0)==0)&&(d[q+(N<<2)>>2]|0)==(p|0)&&(de=_+(y<<3)|0,d[de>>2]=T,d[de+4>>2]=A,y=y+1|0),N=Xt(N|0,U|0,1,0)|0,U=K()|0;while((U|0)<(M|0)|(U|0)==(M|0)&N>>>0>>0)}An(I),An(q),y=0}}else y=2;while(!1);return de=y,Q=ie,de|0}function pi(A,f,p,_){A=A|0,f=f|0,p=p|0,_=_|0;var y=0,T=0,M=0,N=0,U=0,I=0;for(N=Q,Q=Q+16|0,T=N,M=N+8|0,y=(Ci(A,f)|0)==0,y=y?1:2;;){if(d[M>>2]=0,I=(cn(A,f,y,M,T)|0)==0,U=T,I&((d[U>>2]|0)==(p|0)?(d[U+4>>2]|0)==(_|0):0)){A=4;break}if(y=y+1|0,y>>>0>=7){y=7,A=4;break}}return(A|0)==4?(Q=N,y|0):0}function Pr(A,f,p,_){A=A|0,f=f|0,p=p|0,_=_|0;var y=0,T=0,M=0,N=0,U=0,I=0;if(N=Q,Q=Q+48|0,y=N+16|0,T=N+8|0,M=N,p=Ra(p)|0,p|0)return M=p,Q=N,M|0;if(I=A,U=d[I+4>>2]|0,p=T,d[p>>2]=d[I>>2],d[p+4>>2]=U,pa(T,y),p=sf(y,f,M)|0,!p){if(f=d[T>>2]|0,T=d[A+8>>2]|0,(T|0)>0){y=d[A+12>>2]|0,p=0;do f=(d[y+(p<<3)>>2]|0)+f|0,p=p+1|0;while((p|0)<(T|0))}p=M,y=d[p>>2]|0,p=d[p+4>>2]|0,T=((f|0)<0)<<31>>31,(p|0)<(T|0)|(p|0)==(T|0)&y>>>0>>0?(p=M,d[p>>2]=f,d[p+4>>2]=T,p=T):f=y,U=Xt(f|0,p|0,12,0)|0,I=K()|0,p=M,d[p>>2]=U,d[p+4>>2]=I,p=_,d[p>>2]=U,d[p+4>>2]=I,p=0}return I=p,Q=N,I|0}function Ei(A,f,p,_,y,T,M){A=A|0,f=f|0,p=p|0,_=_|0,y=y|0,T=T|0,M=M|0;var N=0,U=0,I=0,q=0,ie=0,de=0,Ae=0,pe=0,Me=0,Le=0,Ye=0,qe=0,Fe=0,Ee=0,Pt=0,nn=0,Jt=0,Un=0,En=0,Qn=0,Tn=0,an=0,Lt=0,vn=0,ii=0,wn=0,Ri=0,ws=0,Al=0;if(ii=Q,Q=Q+64|0,Tn=ii+48|0,an=ii+32|0,Lt=ii+24|0,Pt=ii+8|0,nn=ii,U=d[A>>2]|0,(U|0)<=0)return vn=0,Q=ii,vn|0;for(Jt=A+4|0,Un=Tn+8|0,En=an+8|0,Qn=Pt+8|0,N=0,Fe=0;;){I=d[Jt>>2]|0,qe=I+(Fe<<4)|0,d[Tn>>2]=d[qe>>2],d[Tn+4>>2]=d[qe+4>>2],d[Tn+8>>2]=d[qe+8>>2],d[Tn+12>>2]=d[qe+12>>2],(Fe|0)==(U+-1|0)?(d[an>>2]=d[I>>2],d[an+4>>2]=d[I+4>>2],d[an+8>>2]=d[I+8>>2],d[an+12>>2]=d[I+12>>2]):(qe=I+(Fe+1<<4)|0,d[an>>2]=d[qe>>2],d[an+4>>2]=d[qe+4>>2],d[an+8>>2]=d[qe+8>>2],d[an+12>>2]=d[qe+12>>2]),U=a1(Tn,an,_,Lt)|0;e:do if(U)I=0,N=U;else if(U=Lt,I=d[U>>2]|0,U=d[U+4>>2]|0,(U|0)>0|(U|0)==0&I>>>0>0){Ye=0,qe=0;t:for(;;){if(Ri=1/(+(I>>>0)+4294967296*+(U|0)),Al=+ee[Tn>>3],U=Ur(I|0,U|0,Ye|0,qe|0)|0,ws=+(U>>>0)+4294967296*+(K()|0),wn=+(Ye>>>0)+4294967296*+(qe|0),ee[Pt>>3]=Ri*(Al*ws)+Ri*(+ee[an>>3]*wn),ee[Qn>>3]=Ri*(+ee[Un>>3]*ws)+Ri*(+ee[En>>3]*wn),U=PA(Pt,_,nn)|0,U|0){N=U;break}Le=nn,Me=d[Le>>2]|0,Le=d[Le+4>>2]|0,de=ec(Me|0,Le|0,f|0,p|0)|0,q=K()|0,U=M+(de<<3)|0,ie=U,I=d[ie>>2]|0,ie=d[ie+4>>2]|0;n:do if((I|0)==0&(ie|0)==0)Ee=U,vn=16;else for(Ae=0,pe=0;;){if((Ae|0)>(p|0)|(Ae|0)==(p|0)&pe>>>0>f>>>0){N=1;break t}if((I|0)==(Me|0)&(ie|0)==(Le|0))break n;if(U=Xt(de|0,q|0,1,0)|0,de=th(U|0,K()|0,f|0,p|0)|0,q=K()|0,pe=Xt(pe|0,Ae|0,1,0)|0,Ae=K()|0,U=M+(de<<3)|0,ie=U,I=d[ie>>2]|0,ie=d[ie+4>>2]|0,(I|0)==0&(ie|0)==0){Ee=U,vn=16;break}}while(!1);if((vn|0)==16&&(vn=0,!((Me|0)==0&(Le|0)==0))&&(pe=Ee,d[pe>>2]=Me,d[pe+4>>2]=Le,pe=T+(d[y>>2]<<3)|0,d[pe>>2]=Me,d[pe+4>>2]=Le,pe=y,pe=Xt(d[pe>>2]|0,d[pe+4>>2]|0,1,0)|0,Me=K()|0,Le=y,d[Le>>2]=pe,d[Le+4>>2]=Me),Ye=Xt(Ye|0,qe|0,1,0)|0,qe=K()|0,U=Lt,I=d[U>>2]|0,U=d[U+4>>2]|0,!((U|0)>(qe|0)|(U|0)==(qe|0)&I>>>0>Ye>>>0)){I=1;break e}}I=0}else I=1;while(!1);if(Fe=Fe+1|0,!I){vn=21;break}if(U=d[A>>2]|0,(Fe|0)>=(U|0)){N=0,vn=21;break}}return(vn|0)==21?(Q=ii,N|0):0}function Zh(A,f,p,_){A=A|0,f=f|0,p=p|0,_=_|0;var y=0,T=0,M=0,N=0,U=0,I=0,q=0,ie=0,de=0,Ae=0,pe=0,Me=0,Le=0,Ye=0,qe=0,Fe=0,Ee=0,Pt=0,nn=0,Jt=0,Un=0,En=0,Qn=0,Tn=0,an=0,Lt=0,vn=0,ii=0,wn=0,Ri=0,ws=0;if(ws=Q,Q=Q+112|0,vn=ws+80|0,U=ws+72|0,ii=ws,wn=ws+56|0,y=Ra(p)|0,y|0)return Ri=y,Q=ws,Ri|0;if(I=A+8|0,Ri=Fo((d[I>>2]<<5)+32|0)|0,!Ri)return Ri=13,Q=ws,Ri|0;if(Na(A,Ri),y=Ra(p)|0,!y){if(an=A,Lt=d[an+4>>2]|0,y=U,d[y>>2]=d[an>>2],d[y+4>>2]=Lt,pa(U,vn),y=sf(vn,f,ii)|0,y)an=0,Lt=0;else{if(y=d[U>>2]|0,T=d[I>>2]|0,(T|0)>0){M=d[A+12>>2]|0,p=0;do y=(d[M+(p<<3)>>2]|0)+y|0,p=p+1|0;while((p|0)!=(T|0));p=y}else p=y;y=ii,T=d[y>>2]|0,y=d[y+4>>2]|0,M=((p|0)<0)<<31>>31,(y|0)<(M|0)|(y|0)==(M|0)&T>>>0

>>0?(y=ii,d[y>>2]=p,d[y+4>>2]=M,y=M):p=T,an=Xt(p|0,y|0,12,0)|0,Lt=K()|0,y=ii,d[y>>2]=an,d[y+4>>2]=Lt,y=0}if(!y){if(p=Ks(an,8)|0,!p)return An(Ri),Ri=13,Q=ws,Ri|0;if(N=Ks(an,8)|0,!N)return An(Ri),An(p),Ri=13,Q=ws,Ri|0;Qn=vn,d[Qn>>2]=0,d[Qn+4>>2]=0,Qn=A,Tn=d[Qn+4>>2]|0,y=U,d[y>>2]=d[Qn>>2],d[y+4>>2]=Tn,y=Ei(U,an,Lt,f,vn,p,N)|0;e:do if(y)An(p),An(N),An(Ri);else{t:do if((d[I>>2]|0)>0){for(M=A+12|0,T=0;y=Ei((d[M>>2]|0)+(T<<3)|0,an,Lt,f,vn,p,N)|0,T=T+1|0,!(y|0);)if((T|0)>=(d[I>>2]|0))break t;An(p),An(N),An(Ri);break e}while(!1);(Lt|0)>0|(Lt|0)==0&an>>>0>0&&uo(N|0,0,an<<3|0)|0,Tn=vn,Qn=d[Tn+4>>2]|0;t:do if((Qn|0)>0|(Qn|0)==0&(d[Tn>>2]|0)>>>0>0){Jt=p,Un=N,En=p,Qn=N,Tn=p,y=p,Ee=p,Pt=N,nn=N,p=N;n:for(;;){for(Le=0,Ye=0,qe=0,Fe=0,T=0,M=0;;){N=ii,U=N+56|0;do d[N>>2]=0,N=N+4|0;while((N|0)<(U|0));if(f=Jt+(Le<<3)|0,I=d[f>>2]|0,f=d[f+4>>2]|0,Rt(I,f,1,ii,0)|0){N=ii,U=N+56|0;do d[N>>2]=0,N=N+4|0;while((N|0)<(U|0));N=Ks(7,4)|0,N|0&&(Zt(I,f,1,ii,N,7,0,0)|0,An(N))}for(Me=0;;){pe=ii+(Me<<3)|0,Ae=d[pe>>2]|0,pe=d[pe+4>>2]|0;i:do if((Ae|0)==0&(pe|0)==0)N=T,U=M;else{if(q=ec(Ae|0,pe|0,an|0,Lt|0)|0,I=K()|0,N=_+(q<<3)|0,f=N,U=d[f>>2]|0,f=d[f+4>>2]|0,!((U|0)==0&(f|0)==0)){ie=0,de=0;do{if((ie|0)>(Lt|0)|(ie|0)==(Lt|0)&de>>>0>an>>>0)break n;if((U|0)==(Ae|0)&(f|0)==(pe|0)){N=T,U=M;break i}N=Xt(q|0,I|0,1,0)|0,q=th(N|0,K()|0,an|0,Lt|0)|0,I=K()|0,de=Xt(de|0,ie|0,1,0)|0,ie=K()|0,N=_+(q<<3)|0,f=N,U=d[f>>2]|0,f=d[f+4>>2]|0}while(!((U|0)==0&(f|0)==0))}if((Ae|0)==0&(pe|0)==0){N=T,U=M;break}Ol(Ae,pe,wn)|0,Da(A,Ri,wn)|0&&(de=Xt(T|0,M|0,1,0)|0,M=K()|0,ie=N,d[ie>>2]=Ae,d[ie+4>>2]=pe,T=Un+(T<<3)|0,d[T>>2]=Ae,d[T+4>>2]=pe,T=de),N=T,U=M}while(!1);if(Me=Me+1|0,Me>>>0>=7)break;T=N,M=U}if(Le=Xt(Le|0,Ye|0,1,0)|0,Ye=K()|0,qe=Xt(qe|0,Fe|0,1,0)|0,Fe=K()|0,M=vn,T=d[M>>2]|0,M=d[M+4>>2]|0,(Fe|0)<(M|0)|(Fe|0)==(M|0)&qe>>>0>>0)T=N,M=U;else break}if((M|0)>0|(M|0)==0&T>>>0>0){T=0,M=0;do Fe=Jt+(T<<3)|0,d[Fe>>2]=0,d[Fe+4>>2]=0,T=Xt(T|0,M|0,1,0)|0,M=K()|0,Fe=vn,qe=d[Fe+4>>2]|0;while((M|0)<(qe|0)|((M|0)==(qe|0)?T>>>0<(d[Fe>>2]|0)>>>0:0))}if(Fe=vn,d[Fe>>2]=N,d[Fe+4>>2]=U,(U|0)>0|(U|0)==0&N>>>0>0)Me=p,Le=nn,Ye=Tn,qe=Pt,Fe=Un,p=Ee,nn=y,Pt=En,Ee=Me,y=Le,Tn=Qn,Qn=Ye,En=qe,Un=Jt,Jt=Fe;else break t}An(En),An(Qn),An(Ri),y=1;break e}else y=N;while(!1);An(Ri),An(p),An(y),y=0}while(!1);return Ri=y,Q=ws,Ri|0}}return An(Ri),Ri=y,Q=ws,Ri|0}function Bl(A,f,p){A=A|0,f=f|0,p=p|0;var _=0,y=0,T=0,M=0,N=0,U=0,I=0,q=0;if(q=Q,Q=Q+176|0,U=q,(f|0)<1)return Io(p,0,0),I=0,Q=q,I|0;for(N=A,N=yt(d[N>>2]|0,d[N+4>>2]|0,52)|0,K()|0,Io(p,(f|0)>6?f:6,N&15),N=0;_=A+(N<<3)|0,_=Il(d[_>>2]|0,d[_+4>>2]|0,U)|0,!(_|0);){if(_=d[U>>2]|0,(_|0)>0){M=0;do T=U+8+(M<<4)|0,M=M+1|0,_=U+8+(((M|0)%(_|0)|0)<<4)|0,y=Zu(p,_,T)|0,y?Ku(p,y)|0:VA(p,T,_)|0,_=d[U>>2]|0;while((M|0)<(_|0))}if(N=N+1|0,(N|0)>=(f|0)){_=0,I=13;break}}return(I|0)==13?(Q=q,_|0):(GA(p),I=_,Q=q,I|0)}function nl(A,f,p){A=A|0,f=f|0,p=p|0;var _=0,y=0,T=0,M=0;if(T=Q,Q=Q+32|0,_=T,y=T+16|0,A=Bl(A,f,y)|0,A|0)return p=A,Q=T,p|0;if(d[p>>2]=0,d[p+4>>2]=0,d[p+8>>2]=0,A=qA(y)|0,A|0)do{f=M1(p)|0;do OA(f,A)|0,M=A+16|0,d[_>>2]=d[M>>2],d[_+4>>2]=d[M+4>>2],d[_+8>>2]=d[M+8>>2],d[_+12>>2]=d[M+12>>2],Ku(y,A)|0,A=As(y,_)|0;while((A|0)!=0);A=qA(y)|0}while((A|0)!=0);return GA(y),A=Rx(p)|0,A?(Wu(p),M=A,Q=T,M|0):(M=0,Q=T,M|0)}function Bi(A){return A=A|0,A>>>0>121?(A=0,A|0):(A=d[7696+(A*28|0)+16>>2]|0,A|0)}function Wc(A){return A=A|0,(A|0)==4|(A|0)==117|0}function Po(A){return A=A|0,d[11120+((d[A>>2]|0)*216|0)+((d[A+4>>2]|0)*72|0)+((d[A+8>>2]|0)*24|0)+(d[A+12>>2]<<3)>>2]|0}function ep(A){return A=A|0,d[11120+((d[A>>2]|0)*216|0)+((d[A+4>>2]|0)*72|0)+((d[A+8>>2]|0)*24|0)+(d[A+12>>2]<<3)+4>>2]|0}function tp(A,f){A=A|0,f=f|0,A=7696+(A*28|0)|0,d[f>>2]=d[A>>2],d[f+4>>2]=d[A+4>>2],d[f+8>>2]=d[A+8>>2],d[f+12>>2]=d[A+12>>2]}function $c(A,f){A=A|0,f=f|0;var p=0,_=0;if(f>>>0>20)return f=-1,f|0;do if((d[11120+(f*216|0)>>2]|0)!=(A|0))if((d[11120+(f*216|0)+8>>2]|0)!=(A|0))if((d[11120+(f*216|0)+16>>2]|0)!=(A|0))if((d[11120+(f*216|0)+24>>2]|0)!=(A|0))if((d[11120+(f*216|0)+32>>2]|0)!=(A|0))if((d[11120+(f*216|0)+40>>2]|0)!=(A|0))if((d[11120+(f*216|0)+48>>2]|0)!=(A|0))if((d[11120+(f*216|0)+56>>2]|0)!=(A|0))if((d[11120+(f*216|0)+64>>2]|0)!=(A|0))if((d[11120+(f*216|0)+72>>2]|0)!=(A|0))if((d[11120+(f*216|0)+80>>2]|0)!=(A|0))if((d[11120+(f*216|0)+88>>2]|0)!=(A|0))if((d[11120+(f*216|0)+96>>2]|0)!=(A|0))if((d[11120+(f*216|0)+104>>2]|0)!=(A|0))if((d[11120+(f*216|0)+112>>2]|0)!=(A|0))if((d[11120+(f*216|0)+120>>2]|0)!=(A|0))if((d[11120+(f*216|0)+128>>2]|0)!=(A|0))if((d[11120+(f*216|0)+136>>2]|0)==(A|0))A=2,p=1,_=2;else{if((d[11120+(f*216|0)+144>>2]|0)==(A|0)){A=0,p=2,_=0;break}if((d[11120+(f*216|0)+152>>2]|0)==(A|0)){A=0,p=2,_=1;break}if((d[11120+(f*216|0)+160>>2]|0)==(A|0)){A=0,p=2,_=2;break}if((d[11120+(f*216|0)+168>>2]|0)==(A|0)){A=1,p=2,_=0;break}if((d[11120+(f*216|0)+176>>2]|0)==(A|0)){A=1,p=2,_=1;break}if((d[11120+(f*216|0)+184>>2]|0)==(A|0)){A=1,p=2,_=2;break}if((d[11120+(f*216|0)+192>>2]|0)==(A|0)){A=2,p=2,_=0;break}if((d[11120+(f*216|0)+200>>2]|0)==(A|0)){A=2,p=2,_=1;break}if((d[11120+(f*216|0)+208>>2]|0)==(A|0)){A=2,p=2,_=2;break}else A=-1;return A|0}else A=2,p=1,_=1;else A=2,p=1,_=0;else A=1,p=1,_=2;else A=1,p=1,_=1;else A=1,p=1,_=0;else A=0,p=1,_=2;else A=0,p=1,_=1;else A=0,p=1,_=0;else A=2,p=0,_=2;else A=2,p=0,_=1;else A=2,p=0,_=0;else A=1,p=0,_=2;else A=1,p=0,_=1;else A=1,p=0,_=0;else A=0,p=0,_=2;else A=0,p=0,_=1;else A=0,p=0,_=0;while(!1);return f=d[11120+(f*216|0)+(p*72|0)+(A*24|0)+(_<<3)+4>>2]|0,f|0}function Ru(A,f){return A=A|0,f=f|0,(d[7696+(A*28|0)+20>>2]|0)==(f|0)?(f=1,f|0):(f=(d[7696+(A*28|0)+24>>2]|0)==(f|0),f|0)}function SA(A,f){return A=A|0,f=f|0,d[848+(A*28|0)+(f<<2)>>2]|0}function Jh(A,f){return A=A|0,f=f|0,(d[848+(A*28|0)>>2]|0)==(f|0)?(f=0,f|0):(d[848+(A*28|0)+4>>2]|0)==(f|0)?(f=1,f|0):(d[848+(A*28|0)+8>>2]|0)==(f|0)?(f=2,f|0):(d[848+(A*28|0)+12>>2]|0)==(f|0)?(f=3,f|0):(d[848+(A*28|0)+16>>2]|0)==(f|0)?(f=4,f|0):(d[848+(A*28|0)+20>>2]|0)==(f|0)?(f=5,f|0):((d[848+(A*28|0)+24>>2]|0)==(f|0)?6:7)|0}function s1(){return 122}function ef(A){A=A|0;var f=0,p=0,_=0;f=0;do Nt(f|0,0,45)|0,_=K()|0|134225919,p=A+(f<<3)|0,d[p>>2]=-1,d[p+4>>2]=_,f=f+1|0;while((f|0)!=122);return 0}function il(A){A=A|0;var f=0,p=0,_=0;return _=+ee[A+16>>3],p=+ee[A+24>>3],f=_-p,+(_>3]<+ee[A+24>>3]|0}function tf(A){return A=A|0,+(+ee[A>>3]-+ee[A+8>>3])}function Lo(A,f){A=A|0,f=f|0;var p=0,_=0,y=0;return p=+ee[f>>3],!(p>=+ee[A+8>>3])||!(p<=+ee[A>>3])?(f=0,f|0):(_=+ee[A+16>>3],p=+ee[A+24>>3],y=+ee[f+8>>3],f=y>=p,A=y<=_&1,_>3]<+ee[f+8>>3]||+ee[A+8>>3]>+ee[f>>3]?(_=0,_|0):(T=+ee[A+16>>3],p=A+24|0,q=+ee[p>>3],M=T>3],y=f+24|0,U=+ee[y>>3],N=I>3],f)||(q=+Xs(+ee[p>>3],A),q>+Xs(+ee[_>>3],f))?(N=0,N|0):(N=1,N|0))}function wA(A,f,p,_){A=A|0,f=f|0,p=p|0,_=_|0;var y=0,T=0,M=0,N=0,U=0;T=+ee[A+16>>3],U=+ee[A+24>>3],A=T>3],M=+ee[f+24>>3],y=N>2]=A?y|f?1:2:0,d[_>>2]=y?A?1:f?2:1:0}function np(A,f){A=A|0,f=f|0;var p=0,_=0,y=0,T=0,M=0,N=0,U=0,I=0,q=0;return+ee[A>>3]<+ee[f>>3]||+ee[A+8>>3]>+ee[f+8>>3]?(_=0,_|0):(_=A+16|0,U=+ee[_>>3],T=+ee[A+24>>3],M=U>3],y=f+24|0,I=+ee[y>>3],N=q>3],f)?(q=+Xs(+ee[_>>3],A),N=q>=+Xs(+ee[p>>3],f),N|0):(N=0,N|0))}function rf(A,f){A=A|0,f=f|0;var p=0,_=0,y=0,T=0,M=0,N=0;y=Q,Q=Q+176|0,_=y,d[_>>2]=4,N=+ee[f>>3],ee[_+8>>3]=N,T=+ee[f+16>>3],ee[_+16>>3]=T,ee[_+24>>3]=N,N=+ee[f+24>>3],ee[_+32>>3]=N,M=+ee[f+8>>3],ee[_+40>>3]=M,ee[_+48>>3]=N,ee[_+56>>3]=M,ee[_+64>>3]=T,f=_+72|0,p=f+96|0;do d[f>>2]=0,f=f+4|0;while((f|0)<(p|0));Gl(A|0,_|0,168)|0,Q=y}function sf(A,f,p){A=A|0,f=f|0,p=p|0;var _=0,y=0,T=0,M=0,N=0,U=0,I=0,q=0,ie=0,de=0,Ae=0,pe=0,Me=0,Le=0;pe=Q,Q=Q+288|0,q=pe+264|0,ie=pe+96|0,I=pe,N=I,U=N+96|0;do d[N>>2]=0,N=N+4|0;while((N|0)<(U|0));return f=qu(f,I)|0,f|0?(Ae=f,Q=pe,Ae|0):(U=I,I=d[U>>2]|0,U=d[U+4>>2]|0,Ol(I,U,q)|0,Il(I,U,ie)|0,M=+Zc(q,ie+8|0),ee[q>>3]=+ee[A>>3],U=q+8|0,ee[U>>3]=+ee[A+16>>3],ee[ie>>3]=+ee[A+8>>3],I=ie+8|0,ee[I>>3]=+ee[A+24>>3],y=+Zc(q,ie),Le=+ee[U>>3]-+ee[I>>3],T=+un(+Le),Me=+ee[q>>3]-+ee[ie>>3],_=+un(+Me),!(Le==0|Me==0)&&(Le=+Af(+T,+_),Le=+Qe(+(y*y/+df(+(Le/+df(+T,+_)),3)/(M*(M*2.59807621135)*.8))),ee[$n>>3]=Le,de=~~Le>>>0,Ae=+un(Le)>=1?Le>0?~~+Oe(+Xn(Le/4294967296),4294967295)>>>0:~~+Qe((Le-+(~~Le>>>0))/4294967296)>>>0:0,(d[$n+4>>2]&2146435072|0)!=2146435072)?(ie=(de|0)==0&(Ae|0)==0,f=p,d[f>>2]=ie?1:de,d[f+4>>2]=ie?0:Ae,f=0):f=1,Ae=f,Q=pe,Ae|0)}function a1(A,f,p,_){A=A|0,f=f|0,p=p|0,_=_|0;var y=0,T=0,M=0,N=0,U=0,I=0,q=0;I=Q,Q=Q+288|0,M=I+264|0,N=I+96|0,U=I,y=U,T=y+96|0;do d[y>>2]=0,y=y+4|0;while((y|0)<(T|0));return p=qu(p,U)|0,p|0?(_=p,Q=I,_|0):(p=U,y=d[p>>2]|0,p=d[p+4>>2]|0,Ol(y,p,M)|0,Il(y,p,N)|0,q=+Zc(M,N+8|0),q=+Qe(+(+Zc(A,f)/(q*2))),ee[$n>>3]=q,p=~~q>>>0,y=+un(q)>=1?q>0?~~+Oe(+Xn(q/4294967296),4294967295)>>>0:~~+Qe((q-+(~~q>>>0))/4294967296)>>>0:0,(d[$n+4>>2]&2146435072|0)==2146435072?(_=1,Q=I,_|0):(U=(p|0)==0&(y|0)==0,d[_>>2]=U?1:p,d[_+4>>2]=U?0:y,_=0,Q=I,_|0))}function Ws(A,f){A=A|0,f=+f;var p=0,_=0,y=0,T=0,M=0,N=0,U=0,I=0,q=0;T=A+16|0,M=+ee[T>>3],p=A+24|0,y=+ee[p>>3],_=M-y,_=M>3],N=A+8|0,U=+ee[N>>3],q=I-U,_=(_*f-_)*.5,f=(q*f-q)*.5,I=I+f,ee[A>>3]=I>1.5707963267948966?1.5707963267948966:I,f=U-f,ee[N>>3]=f<-1.5707963267948966?-1.5707963267948966:f,f=M+_,f=f>3.141592653589793?f+-6.283185307179586:f,ee[T>>3]=f<-3.141592653589793?f+6.283185307179586:f,f=y-_,f=f>3.141592653589793?f+-6.283185307179586:f,ee[p>>3]=f<-3.141592653589793?f+6.283185307179586:f}function Nu(A,f,p,_){A=A|0,f=f|0,p=p|0,_=_|0,d[A>>2]=f,d[A+4>>2]=p,d[A+8>>2]=_}function MA(A,f){A=A|0,f=f|0;var p=0,_=0,y=0,T=0,M=0,N=0,U=0,I=0,q=0,ie=0,de=0;ie=f+8|0,d[ie>>2]=0,U=+ee[A>>3],M=+un(+U),I=+ee[A+8>>3],N=+un(+I)*1.1547005383792515,M=M+N*.5,p=~~M,A=~~N,M=M-+(p|0),N=N-+(A|0);do if(M<.5)if(M<.3333333333333333)if(d[f>>2]=p,N<(M+1)*.5){d[f+4>>2]=A;break}else{A=A+1|0,d[f+4>>2]=A;break}else if(de=1-M,A=(!(N>2]=A,de<=N&N>2]=p;break}else{d[f>>2]=p;break}else{if(!(M<.6666666666666666))if(p=p+1|0,d[f>>2]=p,N>2]=A;break}else{A=A+1|0,d[f+4>>2]=A;break}if(N<1-M){if(d[f+4>>2]=A,M*2+-1>2]=p;break}}else A=A+1|0,d[f+4>>2]=A;p=p+1|0,d[f>>2]=p}while(!1);do if(U<0)if(A&1){q=(A+1|0)/2|0,q=Ur(p|0,((p|0)<0)<<31>>31|0,q|0,((q|0)<0)<<31>>31|0)|0,p=~~(+(p|0)-((+(q>>>0)+4294967296*+(K()|0))*2+1)),d[f>>2]=p;break}else{q=(A|0)/2|0,q=Ur(p|0,((p|0)<0)<<31>>31|0,q|0,((q|0)<0)<<31>>31|0)|0,p=~~(+(p|0)-(+(q>>>0)+4294967296*+(K()|0))*2),d[f>>2]=p;break}while(!1);q=f+4|0,I<0&&(p=p-((A<<1|1|0)/2|0)|0,d[f>>2]=p,A=0-A|0,d[q>>2]=A),_=A-p|0,(p|0)<0?(y=0-p|0,d[q>>2]=_,d[ie>>2]=y,d[f>>2]=0,A=_,p=0):y=0,(A|0)<0&&(p=p-A|0,d[f>>2]=p,y=y-A|0,d[ie>>2]=y,d[q>>2]=0,A=0),T=p-y|0,_=A-y|0,(y|0)<0&&(d[f>>2]=T,d[q>>2]=_,d[ie>>2]=0,A=_,p=T,y=0),_=(A|0)<(p|0)?A:p,_=(y|0)<(_|0)?y:_,!((_|0)<=0)&&(d[f>>2]=p-_,d[q>>2]=A-_,d[ie>>2]=y-_)}function Lr(A){A=A|0;var f=0,p=0,_=0,y=0,T=0,M=0;f=d[A>>2]|0,M=A+4|0,p=d[M>>2]|0,(f|0)<0&&(p=p-f|0,d[M>>2]=p,T=A+8|0,d[T>>2]=(d[T>>2]|0)-f,d[A>>2]=0,f=0),(p|0)<0?(f=f-p|0,d[A>>2]=f,T=A+8|0,y=(d[T>>2]|0)-p|0,d[T>>2]=y,d[M>>2]=0,p=0):(y=A+8|0,T=y,y=d[y>>2]|0),(y|0)<0&&(f=f-y|0,d[A>>2]=f,p=p-y|0,d[M>>2]=p,d[T>>2]=0,y=0),_=(p|0)<(f|0)?p:f,_=(y|0)<(_|0)?y:_,!((_|0)<=0)&&(d[A>>2]=f-_,d[M>>2]=p-_,d[T>>2]=y-_)}function Du(A,f){A=A|0,f=f|0;var p=0,_=0;_=d[A+8>>2]|0,p=+((d[A+4>>2]|0)-_|0),ee[f>>3]=+((d[A>>2]|0)-_|0)-p*.5,ee[f+8>>3]=p*.8660254037844386}function hs(A,f,p){A=A|0,f=f|0,p=p|0,d[p>>2]=(d[f>>2]|0)+(d[A>>2]|0),d[p+4>>2]=(d[f+4>>2]|0)+(d[A+4>>2]|0),d[p+8>>2]=(d[f+8>>2]|0)+(d[A+8>>2]|0)}function af(A,f,p){A=A|0,f=f|0,p=p|0,d[p>>2]=(d[A>>2]|0)-(d[f>>2]|0),d[p+4>>2]=(d[A+4>>2]|0)-(d[f+4>>2]|0),d[p+8>>2]=(d[A+8>>2]|0)-(d[f+8>>2]|0)}function Xc(A,f){A=A|0,f=f|0;var p=0,_=0;p=Xe(d[A>>2]|0,f)|0,d[A>>2]=p,p=A+4|0,_=Xe(d[p>>2]|0,f)|0,d[p>>2]=_,A=A+8|0,f=Xe(d[A>>2]|0,f)|0,d[A>>2]=f}function Pu(A){A=A|0;var f=0,p=0,_=0,y=0,T=0,M=0,N=0;M=d[A>>2]|0,N=(M|0)<0,_=(d[A+4>>2]|0)-(N?M:0)|0,T=(_|0)<0,y=(T?0-_|0:0)+((d[A+8>>2]|0)-(N?M:0))|0,p=(y|0)<0,A=p?0:y,f=(T?0:_)-(p?y:0)|0,y=(N?0:M)-(T?_:0)-(p?y:0)|0,p=(f|0)<(y|0)?f:y,p=(A|0)<(p|0)?A:p,_=(p|0)>0,A=A-(_?p:0)|0,f=f-(_?p:0)|0;e:do switch(y-(_?p:0)|0){case 0:switch(f|0){case 0:return N=(A|0)==0?0:(A|0)==1?1:7,N|0;case 1:return N=(A|0)==0?2:(A|0)==1?3:7,N|0;default:break e}case 1:switch(f|0){case 0:return N=(A|0)==0?4:(A|0)==1?5:7,N|0;case 1:{if(!A)A=6;else break e;return A|0}default:break e}}while(!1);return N=7,N|0}function o1(A){A=A|0;var f=0,p=0,_=0,y=0,T=0,M=0,N=0,U=0,I=0;if(U=A+8|0,M=d[U>>2]|0,N=(d[A>>2]|0)-M|0,I=A+4|0,M=(d[I>>2]|0)-M|0,N>>>0>715827881|M>>>0>715827881){if(_=(N|0)>0,y=2147483647-N|0,T=-2147483648-N|0,(_?(y|0)<(N|0):(T|0)>(N|0))||(p=N<<1,_?(2147483647-p|0)<(N|0):(-2147483648-p|0)>(N|0))||((M|0)>0?(2147483647-M|0)<(M|0):(-2147483648-M|0)>(M|0))||(f=N*3|0,p=M<<1,(_?(y|0)<(p|0):(T|0)>(p|0))||((N|0)>-1?(f|-2147483648|0)>=(M|0):(f^-2147483648|0)<(M|0))))return I=1,I|0}else p=M<<1,f=N*3|0;return _=cl(+(f-M|0)*.14285714285714285)|0,d[A>>2]=_,y=cl(+(p+N|0)*.14285714285714285)|0,d[I>>2]=y,d[U>>2]=0,p=(y|0)<(_|0),f=p?_:y,p=p?y:_,(p|0)<0&&(((p|0)==-2147483648||((f|0)>0?(2147483647-f|0)<(p|0):(-2147483648-f|0)>(p|0)))&&Ut(27795,26892,354,26903),((f|0)>-1?(f|-2147483648|0)>=(p|0):(f^-2147483648|0)<(p|0))&&Ut(27795,26892,354,26903)),f=y-_|0,(_|0)<0?(p=0-_|0,d[I>>2]=f,d[U>>2]=p,d[A>>2]=0,_=0):(f=y,p=0),(f|0)<0&&(_=_-f|0,d[A>>2]=_,p=p-f|0,d[U>>2]=p,d[I>>2]=0,f=0),T=_-p|0,y=f-p|0,(p|0)<0?(d[A>>2]=T,d[I>>2]=y,d[U>>2]=0,f=y,y=T,p=0):y=_,_=(f|0)<(y|0)?f:y,_=(p|0)<(_|0)?p:_,(_|0)<=0?(I=0,I|0):(d[A>>2]=y-_,d[I>>2]=f-_,d[U>>2]=p-_,I=0,I|0)}function cx(A){A=A|0;var f=0,p=0,_=0,y=0,T=0,M=0,N=0,U=0;if(M=A+8|0,y=d[M>>2]|0,T=(d[A>>2]|0)-y|0,N=A+4|0,y=(d[N>>2]|0)-y|0,T>>>0>715827881|y>>>0>715827881){if(p=(T|0)>0,(p?(2147483647-T|0)<(T|0):(-2147483648-T|0)>(T|0))||(f=T<<1,_=(y|0)>0,_?(2147483647-y|0)<(y|0):(-2147483648-y|0)>(y|0)))return N=1,N|0;if(U=y<<1,(_?(2147483647-U|0)<(y|0):(-2147483648-U|0)>(y|0))||(p?(2147483647-f|0)<(y|0):(-2147483648-f|0)>(y|0))||(p=y*3|0,(y|0)>-1?(p|-2147483648|0)>=(T|0):(p^-2147483648|0)<(T|0)))return U=1,U|0}else p=y*3|0,f=T<<1;return _=cl(+(f+y|0)*.14285714285714285)|0,d[A>>2]=_,y=cl(+(p-T|0)*.14285714285714285)|0,d[N>>2]=y,d[M>>2]=0,p=(y|0)<(_|0),f=p?_:y,p=p?y:_,(p|0)<0&&(((p|0)==-2147483648||((f|0)>0?(2147483647-f|0)<(p|0):(-2147483648-f|0)>(p|0)))&&Ut(27795,26892,402,26917),((f|0)>-1?(f|-2147483648|0)>=(p|0):(f^-2147483648|0)<(p|0))&&Ut(27795,26892,402,26917)),f=y-_|0,(_|0)<0?(p=0-_|0,d[N>>2]=f,d[M>>2]=p,d[A>>2]=0,_=0):(f=y,p=0),(f|0)<0&&(_=_-f|0,d[A>>2]=_,p=p-f|0,d[M>>2]=p,d[N>>2]=0,f=0),T=_-p|0,y=f-p|0,(p|0)<0?(d[A>>2]=T,d[N>>2]=y,d[M>>2]=0,f=y,y=T,p=0):y=_,_=(f|0)<(y|0)?f:y,_=(p|0)<(_|0)?p:_,(_|0)<=0?(U=0,U|0):(d[A>>2]=y-_,d[N>>2]=f-_,d[M>>2]=p-_,U=0,U|0)}function hx(A){A=A|0;var f=0,p=0,_=0,y=0,T=0,M=0,N=0;M=A+8|0,p=d[M>>2]|0,f=(d[A>>2]|0)-p|0,N=A+4|0,p=(d[N>>2]|0)-p|0,_=cl(+((f*3|0)-p|0)*.14285714285714285)|0,d[A>>2]=_,f=cl(+((p<<1)+f|0)*.14285714285714285)|0,d[N>>2]=f,d[M>>2]=0,p=f-_|0,(_|0)<0?(T=0-_|0,d[N>>2]=p,d[M>>2]=T,d[A>>2]=0,f=p,_=0,p=T):p=0,(f|0)<0&&(_=_-f|0,d[A>>2]=_,p=p-f|0,d[M>>2]=p,d[N>>2]=0,f=0),T=_-p|0,y=f-p|0,(p|0)<0?(d[A>>2]=T,d[N>>2]=y,d[M>>2]=0,f=y,y=T,p=0):y=_,_=(f|0)<(y|0)?f:y,_=(p|0)<(_|0)?p:_,!((_|0)<=0)&&(d[A>>2]=y-_,d[N>>2]=f-_,d[M>>2]=p-_)}function l1(A){A=A|0;var f=0,p=0,_=0,y=0,T=0,M=0,N=0;M=A+8|0,p=d[M>>2]|0,f=(d[A>>2]|0)-p|0,N=A+4|0,p=(d[N>>2]|0)-p|0,_=cl(+((f<<1)+p|0)*.14285714285714285)|0,d[A>>2]=_,f=cl(+((p*3|0)-f|0)*.14285714285714285)|0,d[N>>2]=f,d[M>>2]=0,p=f-_|0,(_|0)<0?(T=0-_|0,d[N>>2]=p,d[M>>2]=T,d[A>>2]=0,f=p,_=0,p=T):p=0,(f|0)<0&&(_=_-f|0,d[A>>2]=_,p=p-f|0,d[M>>2]=p,d[N>>2]=0,f=0),T=_-p|0,y=f-p|0,(p|0)<0?(d[A>>2]=T,d[N>>2]=y,d[M>>2]=0,f=y,y=T,p=0):y=_,_=(f|0)<(y|0)?f:y,_=(p|0)<(_|0)?p:_,!((_|0)<=0)&&(d[A>>2]=y-_,d[N>>2]=f-_,d[M>>2]=p-_)}function Yc(A){A=A|0;var f=0,p=0,_=0,y=0,T=0,M=0,N=0;f=d[A>>2]|0,M=A+4|0,p=d[M>>2]|0,N=A+8|0,_=d[N>>2]|0,y=p+(f*3|0)|0,d[A>>2]=y,p=_+(p*3|0)|0,d[M>>2]=p,f=(_*3|0)+f|0,d[N>>2]=f,_=p-y|0,(y|0)<0?(f=f-y|0,d[M>>2]=_,d[N>>2]=f,d[A>>2]=0,p=_,_=0):_=y,(p|0)<0&&(_=_-p|0,d[A>>2]=_,f=f-p|0,d[N>>2]=f,d[M>>2]=0,p=0),T=_-f|0,y=p-f|0,(f|0)<0?(d[A>>2]=T,d[M>>2]=y,d[N>>2]=0,_=T,f=0):y=p,p=(y|0)<(_|0)?y:_,p=(f|0)<(p|0)?f:p,!((p|0)<=0)&&(d[A>>2]=_-p,d[M>>2]=y-p,d[N>>2]=f-p)}function Lu(A){A=A|0;var f=0,p=0,_=0,y=0,T=0,M=0,N=0;y=d[A>>2]|0,M=A+4|0,f=d[M>>2]|0,N=A+8|0,p=d[N>>2]|0,_=(f*3|0)+y|0,y=p+(y*3|0)|0,d[A>>2]=y,d[M>>2]=_,f=(p*3|0)+f|0,d[N>>2]=f,p=_-y|0,(y|0)<0?(f=f-y|0,d[M>>2]=p,d[N>>2]=f,d[A>>2]=0,y=0):p=_,(p|0)<0&&(y=y-p|0,d[A>>2]=y,f=f-p|0,d[N>>2]=f,d[M>>2]=0,p=0),T=y-f|0,_=p-f|0,(f|0)<0?(d[A>>2]=T,d[M>>2]=_,d[N>>2]=0,y=T,f=0):_=p,p=(_|0)<(y|0)?_:y,p=(f|0)<(p|0)?f:p,!((p|0)<=0)&&(d[A>>2]=y-p,d[M>>2]=_-p,d[N>>2]=f-p)}function u1(A,f){A=A|0,f=f|0;var p=0,_=0,y=0,T=0,M=0,N=0;(f+-1|0)>>>0>=6||(y=(d[15440+(f*12|0)>>2]|0)+(d[A>>2]|0)|0,d[A>>2]=y,N=A+4|0,_=(d[15440+(f*12|0)+4>>2]|0)+(d[N>>2]|0)|0,d[N>>2]=_,M=A+8|0,f=(d[15440+(f*12|0)+8>>2]|0)+(d[M>>2]|0)|0,d[M>>2]=f,p=_-y|0,(y|0)<0?(f=f-y|0,d[N>>2]=p,d[M>>2]=f,d[A>>2]=0,_=0):(p=_,_=y),(p|0)<0&&(_=_-p|0,d[A>>2]=_,f=f-p|0,d[M>>2]=f,d[N>>2]=0,p=0),T=_-f|0,y=p-f|0,(f|0)<0?(d[A>>2]=T,d[N>>2]=y,d[M>>2]=0,_=T,f=0):y=p,p=(y|0)<(_|0)?y:_,p=(f|0)<(p|0)?f:p,!((p|0)<=0)&&(d[A>>2]=_-p,d[N>>2]=y-p,d[M>>2]=f-p))}function c1(A){A=A|0;var f=0,p=0,_=0,y=0,T=0,M=0,N=0;y=d[A>>2]|0,M=A+4|0,f=d[M>>2]|0,N=A+8|0,p=d[N>>2]|0,_=f+y|0,y=p+y|0,d[A>>2]=y,d[M>>2]=_,f=p+f|0,d[N>>2]=f,p=_-y|0,(y|0)<0?(f=f-y|0,d[M>>2]=p,d[N>>2]=f,d[A>>2]=0,_=0):(p=_,_=y),(p|0)<0&&(_=_-p|0,d[A>>2]=_,f=f-p|0,d[N>>2]=f,d[M>>2]=0,p=0),T=_-f|0,y=p-f|0,(f|0)<0?(d[A>>2]=T,d[M>>2]=y,d[N>>2]=0,_=T,f=0):y=p,p=(y|0)<(_|0)?y:_,p=(f|0)<(p|0)?f:p,!((p|0)<=0)&&(d[A>>2]=_-p,d[M>>2]=y-p,d[N>>2]=f-p)}function EA(A){A=A|0;var f=0,p=0,_=0,y=0,T=0,M=0,N=0;f=d[A>>2]|0,M=A+4|0,_=d[M>>2]|0,N=A+8|0,p=d[N>>2]|0,y=_+f|0,d[A>>2]=y,_=p+_|0,d[M>>2]=_,f=p+f|0,d[N>>2]=f,p=_-y|0,(y|0)<0?(f=f-y|0,d[M>>2]=p,d[N>>2]=f,d[A>>2]=0,_=0):(p=_,_=y),(p|0)<0&&(_=_-p|0,d[A>>2]=_,f=f-p|0,d[N>>2]=f,d[M>>2]=0,p=0),T=_-f|0,y=p-f|0,(f|0)<0?(d[A>>2]=T,d[M>>2]=y,d[N>>2]=0,_=T,f=0):y=p,p=(y|0)<(_|0)?y:_,p=(f|0)<(p|0)?f:p,!((p|0)<=0)&&(d[A>>2]=_-p,d[M>>2]=y-p,d[N>>2]=f-p)}function Uu(A){switch(A=A|0,A|0){case 1:{A=5;break}case 5:{A=4;break}case 4:{A=6;break}case 6:{A=2;break}case 2:{A=3;break}case 3:{A=1;break}}return A|0}function rl(A){switch(A=A|0,A|0){case 1:{A=3;break}case 3:{A=2;break}case 2:{A=6;break}case 6:{A=4;break}case 4:{A=5;break}case 5:{A=1;break}}return A|0}function h1(A){A=A|0;var f=0,p=0,_=0,y=0,T=0,M=0,N=0;f=d[A>>2]|0,M=A+4|0,p=d[M>>2]|0,N=A+8|0,_=d[N>>2]|0,y=p+(f<<1)|0,d[A>>2]=y,p=_+(p<<1)|0,d[M>>2]=p,f=(_<<1)+f|0,d[N>>2]=f,_=p-y|0,(y|0)<0?(f=f-y|0,d[M>>2]=_,d[N>>2]=f,d[A>>2]=0,p=_,_=0):_=y,(p|0)<0&&(_=_-p|0,d[A>>2]=_,f=f-p|0,d[N>>2]=f,d[M>>2]=0,p=0),T=_-f|0,y=p-f|0,(f|0)<0?(d[A>>2]=T,d[M>>2]=y,d[N>>2]=0,_=T,f=0):y=p,p=(y|0)<(_|0)?y:_,p=(f|0)<(p|0)?f:p,!((p|0)<=0)&&(d[A>>2]=_-p,d[M>>2]=y-p,d[N>>2]=f-p)}function f1(A){A=A|0;var f=0,p=0,_=0,y=0,T=0,M=0,N=0;y=d[A>>2]|0,M=A+4|0,f=d[M>>2]|0,N=A+8|0,p=d[N>>2]|0,_=(f<<1)+y|0,y=p+(y<<1)|0,d[A>>2]=y,d[M>>2]=_,f=(p<<1)+f|0,d[N>>2]=f,p=_-y|0,(y|0)<0?(f=f-y|0,d[M>>2]=p,d[N>>2]=f,d[A>>2]=0,y=0):p=_,(p|0)<0&&(y=y-p|0,d[A>>2]=y,f=f-p|0,d[N>>2]=f,d[M>>2]=0,p=0),T=y-f|0,_=p-f|0,(f|0)<0?(d[A>>2]=T,d[M>>2]=_,d[N>>2]=0,y=T,f=0):_=p,p=(_|0)<(y|0)?_:y,p=(f|0)<(p|0)?f:p,!((p|0)<=0)&&(d[A>>2]=y-p,d[M>>2]=_-p,d[N>>2]=f-p)}function ip(A,f){A=A|0,f=f|0;var p=0,_=0,y=0,T=0,M=0,N=0;return M=(d[A>>2]|0)-(d[f>>2]|0)|0,N=(M|0)<0,_=(d[A+4>>2]|0)-(d[f+4>>2]|0)-(N?M:0)|0,T=(_|0)<0,y=(N?0-M|0:0)+(d[A+8>>2]|0)-(d[f+8>>2]|0)+(T?0-_|0:0)|0,A=(y|0)<0,f=A?0:y,p=(T?0:_)-(A?y:0)|0,y=(N?0:M)-(T?_:0)-(A?y:0)|0,A=(p|0)<(y|0)?p:y,A=(f|0)<(A|0)?f:A,_=(A|0)>0,f=f-(_?A:0)|0,p=p-(_?A:0)|0,A=y-(_?A:0)|0,A=(A|0)>-1?A:0-A|0,p=(p|0)>-1?p:0-p|0,f=(f|0)>-1?f:0-f|0,f=(p|0)>(f|0)?p:f,((A|0)>(f|0)?A:f)|0}function fx(A,f){A=A|0,f=f|0;var p=0;p=d[A+8>>2]|0,d[f>>2]=(d[A>>2]|0)-p,d[f+4>>2]=(d[A+4>>2]|0)-p}function rp(A,f){A=A|0,f=f|0;var p=0,_=0,y=0,T=0,M=0,N=0;return _=d[A>>2]|0,d[f>>2]=_,y=d[A+4>>2]|0,M=f+4|0,d[M>>2]=y,N=f+8|0,d[N>>2]=0,p=(y|0)<(_|0),A=p?_:y,p=p?y:_,(p|0)<0&&((p|0)==-2147483648||((A|0)>0?(2147483647-A|0)<(p|0):(-2147483648-A|0)>(p|0))||((A|0)>-1?(A|-2147483648|0)>=(p|0):(A^-2147483648|0)<(p|0)))?(f=1,f|0):(A=y-_|0,(_|0)<0?(p=0-_|0,d[M>>2]=A,d[N>>2]=p,d[f>>2]=0,_=0):(A=y,p=0),(A|0)<0&&(_=_-A|0,d[f>>2]=_,p=p-A|0,d[N>>2]=p,d[M>>2]=0,A=0),T=_-p|0,y=A-p|0,(p|0)<0?(d[f>>2]=T,d[M>>2]=y,d[N>>2]=0,A=y,y=T,p=0):y=_,_=(A|0)<(y|0)?A:y,_=(p|0)<(_|0)?p:_,(_|0)<=0?(f=0,f|0):(d[f>>2]=y-_,d[M>>2]=A-_,d[N>>2]=p-_,f=0,f|0))}function A1(A){A=A|0;var f=0,p=0,_=0,y=0;f=A+8|0,y=d[f>>2]|0,p=y-(d[A>>2]|0)|0,d[A>>2]=p,_=A+4|0,A=(d[_>>2]|0)-y|0,d[_>>2]=A,d[f>>2]=0-(A+p)}function Ax(A){A=A|0;var f=0,p=0,_=0,y=0,T=0,M=0,N=0;p=d[A>>2]|0,f=0-p|0,d[A>>2]=f,M=A+8|0,d[M>>2]=0,N=A+4|0,_=d[N>>2]|0,y=_+p|0,(p|0)>0?(d[N>>2]=y,d[M>>2]=p,d[A>>2]=0,f=0,_=y):p=0,(_|0)<0?(T=f-_|0,d[A>>2]=T,p=p-_|0,d[M>>2]=p,d[N>>2]=0,y=T-p|0,f=0-p|0,(p|0)<0?(d[A>>2]=y,d[N>>2]=f,d[M>>2]=0,_=f,p=0):(_=0,y=T)):y=f,f=(_|0)<(y|0)?_:y,f=(p|0)<(f|0)?p:f,!((f|0)<=0)&&(d[A>>2]=y-f,d[N>>2]=_-f,d[M>>2]=p-f)}function dx(A,f,p,_,y){A=A|0,f=f|0,p=p|0,_=_|0,y=y|0;var T=0,M=0,N=0,U=0,I=0,q=0,ie=0;if(ie=Q,Q=Q+64|0,q=ie,N=ie+56|0,!(!0&(f&2013265920|0)==134217728&(!0&(_&2013265920|0)==134217728)))return y=5,Q=ie,y|0;if((A|0)==(p|0)&(f|0)==(_|0))return d[y>>2]=0,y=0,Q=ie,y|0;if(M=yt(A|0,f|0,52)|0,K()|0,M=M&15,I=yt(p|0,_|0,52)|0,K()|0,(M|0)!=(I&15|0))return y=12,Q=ie,y|0;if(T=M+-1|0,M>>>0>1){Fu(A,f,T,q)|0,Fu(p,_,T,N)|0,I=q,U=d[I>>2]|0,I=d[I+4>>2]|0;e:do if((U|0)==(d[N>>2]|0)&&(I|0)==(d[N+4>>2]|0)){M=(M^15)*3|0,T=yt(A|0,f|0,M|0)|0,K()|0,T=T&7,M=yt(p|0,_|0,M|0)|0,K()|0,M=M&7;do if((T|0)==0|(M|0)==0)d[y>>2]=1,T=0;else if((T|0)==7)T=5;else{if((T|0)==1|(M|0)==1&&Ci(U,I)|0){T=5;break}if((d[15536+(T<<2)>>2]|0)!=(M|0)&&(d[15568+(T<<2)>>2]|0)!=(M|0))break e;d[y>>2]=1,T=0}while(!1);return y=T,Q=ie,y|0}while(!1)}T=q,M=T+56|0;do d[T>>2]=0,T=T+4|0;while((T|0)<(M|0));return ve(A,f,1,q)|0,f=q,!((d[f>>2]|0)==(p|0)&&(d[f+4>>2]|0)==(_|0))&&(f=q+8|0,!((d[f>>2]|0)==(p|0)&&(d[f+4>>2]|0)==(_|0)))&&(f=q+16|0,!((d[f>>2]|0)==(p|0)&&(d[f+4>>2]|0)==(_|0)))&&(f=q+24|0,!((d[f>>2]|0)==(p|0)&&(d[f+4>>2]|0)==(_|0)))&&(f=q+32|0,!((d[f>>2]|0)==(p|0)&&(d[f+4>>2]|0)==(_|0)))&&(f=q+40|0,!((d[f>>2]|0)==(p|0)&&(d[f+4>>2]|0)==(_|0)))?(T=q+48|0,T=((d[T>>2]|0)==(p|0)?(d[T+4>>2]|0)==(_|0):0)&1):T=1,d[y>>2]=T,y=0,Q=ie,y|0}function d1(A,f,p,_,y){return A=A|0,f=f|0,p=p|0,_=_|0,y=y|0,p=pi(A,f,p,_)|0,(p|0)==7?(y=11,y|0):(_=Nt(p|0,0,56)|0,f=f&-2130706433|(K()|0)|268435456,d[y>>2]=A|_,d[y+4>>2]=f,y=0,y|0)}function px(A,f,p){return A=A|0,f=f|0,p=p|0,!0&(f&2013265920|0)==268435456?(d[p>>2]=A,d[p+4>>2]=f&-2130706433|134217728,p=0,p|0):(p=6,p|0)}function mx(A,f,p){A=A|0,f=f|0,p=p|0;var _=0,y=0,T=0;return y=Q,Q=Q+16|0,_=y,d[_>>2]=0,!0&(f&2013265920|0)==268435456?(T=yt(A|0,f|0,56)|0,K()|0,_=cn(A,f&-2130706433|134217728,T&7,_,p)|0,Q=y,_|0):(_=6,Q=y,_|0)}function p1(A,f){A=A|0,f=f|0;var p=0;switch(p=yt(A|0,f|0,56)|0,K()|0,p&7){case 0:case 7:return p=0,p|0}return p=f&-2130706433|134217728,!(!0&(f&2013265920|0)==268435456)||!0&(f&117440512|0)==16777216&(Ci(A,p)|0)!=0?(p=0,p|0):(p=NA(A,p)|0,p|0)}function gx(A,f,p){A=A|0,f=f|0,p=p|0;var _=0,y=0,T=0,M=0;return y=Q,Q=Q+16|0,_=y,!0&(f&2013265920|0)==268435456?(T=f&-2130706433|134217728,M=p,d[M>>2]=A,d[M+4>>2]=T,d[_>>2]=0,f=yt(A|0,f|0,56)|0,K()|0,_=cn(A,T,f&7,_,p+8|0)|0,Q=y,_|0):(_=6,Q=y,_|0)}function vx(A,f,p){A=A|0,f=f|0,p=p|0;var _=0,y=0;return y=(Ci(A,f)|0)==0,f=f&-2130706433,_=p,d[_>>2]=y?A:0,d[_+4>>2]=y?f|285212672:0,_=p+8|0,d[_>>2]=A,d[_+4>>2]=f|301989888,_=p+16|0,d[_>>2]=A,d[_+4>>2]=f|318767104,_=p+24|0,d[_>>2]=A,d[_+4>>2]=f|335544320,_=p+32|0,d[_>>2]=A,d[_+4>>2]=f|352321536,p=p+40|0,d[p>>2]=A,d[p+4>>2]=f|369098752,0}function CA(A,f,p){A=A|0,f=f|0,p=p|0;var _=0,y=0,T=0,M=0;return M=Q,Q=Q+16|0,y=M,T=f&-2130706433|134217728,!0&(f&2013265920|0)==268435456?(_=yt(A|0,f|0,56)|0,K()|0,_=Sp(A,T,_&7)|0,(_|0)==-1?(d[p>>2]=0,T=6,Q=M,T|0):(zu(A,T,y)|0&&Ut(27795,26932,282,26947),f=yt(A|0,f|0,52)|0,K()|0,f=f&15,Ci(A,T)|0?sp(y,f,_,2,p):RA(y,f,_,2,p),T=0,Q=M,T|0)):(T=6,Q=M,T|0)}function _x(A,f,p){A=A|0,f=f|0,p=p|0;var _=0,y=0;_=Q,Q=Q+16|0,y=_,yx(A,f,p,y),MA(y,p+4|0),Q=_}function yx(A,f,p,_){A=A|0,f=f|0,p=p|0,_=_|0;var y=0,T=0,M=0,N=0,U=0;if(N=Q,Q=Q+16|0,U=N,xx(A,p,U),T=+Ma(+(1-+ee[U>>3]*.5)),T<1e-16){d[_>>2]=0,d[_+4>>2]=0,d[_+8>>2]=0,d[_+12>>2]=0,Q=N;return}if(U=d[p>>2]|0,y=+ee[15920+(U*24|0)>>3],y=+Kc(y-+Kc(+Ex(15600+(U<<4)|0,A))),Ss(f)|0?M=+Kc(y+-.3334731722518321):M=y,y=+cs(+T)*2.618033988749896,(f|0)>0){A=0;do y=y*2.6457513110645907,A=A+1|0;while((A|0)!=(f|0))}T=+li(+M)*y,ee[_>>3]=T,M=+Fn(+M)*y,ee[_+8>>3]=M,Q=N}function xx(A,f,p){A=A|0,f=f|0,p=p|0;var _=0,y=0,T=0;if(T=Q,Q=Q+32|0,y=T,Yu(A,y),d[f>>2]=0,ee[p>>3]=5,_=+ar(16400,y),_<+ee[p>>3]&&(d[f>>2]=0,ee[p>>3]=_),_=+ar(16424,y),_<+ee[p>>3]&&(d[f>>2]=1,ee[p>>3]=_),_=+ar(16448,y),_<+ee[p>>3]&&(d[f>>2]=2,ee[p>>3]=_),_=+ar(16472,y),_<+ee[p>>3]&&(d[f>>2]=3,ee[p>>3]=_),_=+ar(16496,y),_<+ee[p>>3]&&(d[f>>2]=4,ee[p>>3]=_),_=+ar(16520,y),_<+ee[p>>3]&&(d[f>>2]=5,ee[p>>3]=_),_=+ar(16544,y),_<+ee[p>>3]&&(d[f>>2]=6,ee[p>>3]=_),_=+ar(16568,y),_<+ee[p>>3]&&(d[f>>2]=7,ee[p>>3]=_),_=+ar(16592,y),_<+ee[p>>3]&&(d[f>>2]=8,ee[p>>3]=_),_=+ar(16616,y),_<+ee[p>>3]&&(d[f>>2]=9,ee[p>>3]=_),_=+ar(16640,y),_<+ee[p>>3]&&(d[f>>2]=10,ee[p>>3]=_),_=+ar(16664,y),_<+ee[p>>3]&&(d[f>>2]=11,ee[p>>3]=_),_=+ar(16688,y),_<+ee[p>>3]&&(d[f>>2]=12,ee[p>>3]=_),_=+ar(16712,y),_<+ee[p>>3]&&(d[f>>2]=13,ee[p>>3]=_),_=+ar(16736,y),_<+ee[p>>3]&&(d[f>>2]=14,ee[p>>3]=_),_=+ar(16760,y),_<+ee[p>>3]&&(d[f>>2]=15,ee[p>>3]=_),_=+ar(16784,y),_<+ee[p>>3]&&(d[f>>2]=16,ee[p>>3]=_),_=+ar(16808,y),_<+ee[p>>3]&&(d[f>>2]=17,ee[p>>3]=_),_=+ar(16832,y),_<+ee[p>>3]&&(d[f>>2]=18,ee[p>>3]=_),_=+ar(16856,y),!(_<+ee[p>>3])){Q=T;return}d[f>>2]=19,ee[p>>3]=_,Q=T}function Bu(A,f,p,_,y){A=A|0,f=f|0,p=p|0,_=_|0,y=y|0;var T=0,M=0,N=0;if(T=+zl(A),T<1e-16){f=15600+(f<<4)|0,d[y>>2]=d[f>>2],d[y+4>>2]=d[f+4>>2],d[y+8>>2]=d[f+8>>2],d[y+12>>2]=d[f+12>>2];return}if(M=+Ue(+ +ee[A+8>>3],+ +ee[A>>3]),(p|0)>0){A=0;do T=T*.37796447300922725,A=A+1|0;while((A|0)!=(p|0))}N=T*.3333333333333333,_?(p=(Ss(p)|0)==0,T=+ae(+((p?N:N*.37796447300922725)*.381966011250105))):(T=+ae(+(T*.381966011250105)),Ss(p)|0&&(M=+Kc(M+.3334731722518321))),Cx(15600+(f<<4)|0,+Kc(+ee[15920+(f*24|0)>>3]-M),T,y)}function of(A,f,p){A=A|0,f=f|0,p=p|0;var _=0,y=0;_=Q,Q=Q+16|0,y=_,Du(A+4|0,y),Bu(y,d[A>>2]|0,f,0,p),Q=_}function sp(A,f,p,_,y){A=A|0,f=f|0,p=p|0,_=_|0,y=y|0;var T=0,M=0,N=0,U=0,I=0,q=0,ie=0,de=0,Ae=0,pe=0,Me=0,Le=0,Ye=0,qe=0,Fe=0,Ee=0,Pt=0,nn=0,Jt=0,Un=0,En=0,Qn=0,Tn=0,an=0,Lt=0,vn=0,ii=0,wn=0;if(vn=Q,Q=Q+272|0,T=vn+256|0,qe=vn+240|0,Tn=vn,an=vn+224|0,Lt=vn+208|0,Fe=vn+176|0,Ee=vn+160|0,Pt=vn+192|0,nn=vn+144|0,Jt=vn+128|0,Un=vn+112|0,En=vn+96|0,Qn=vn+80|0,d[T>>2]=f,d[qe>>2]=d[A>>2],d[qe+4>>2]=d[A+4>>2],d[qe+8>>2]=d[A+8>>2],d[qe+12>>2]=d[A+12>>2],ap(qe,T,Tn),d[y>>2]=0,qe=_+p+((_|0)==5&1)|0,(qe|0)<=(p|0)){Q=vn;return}U=d[T>>2]|0,I=an+4|0,q=Fe+4|0,ie=p+5|0,de=16880+(U<<2)|0,Ae=16960+(U<<2)|0,pe=Jt+8|0,Me=Un+8|0,Le=En+8|0,Ye=Lt+4|0,N=p;e:for(;;){M=Tn+(((N|0)%5|0)<<4)|0,d[Lt>>2]=d[M>>2],d[Lt+4>>2]=d[M+4>>2],d[Lt+8>>2]=d[M+8>>2],d[Lt+12>>2]=d[M+12>>2];do;while((Ou(Lt,U,0,1)|0)==2);if((N|0)>(p|0)&(Ss(f)|0)!=0){if(d[Fe>>2]=d[Lt>>2],d[Fe+4>>2]=d[Lt+4>>2],d[Fe+8>>2]=d[Lt+8>>2],d[Fe+12>>2]=d[Lt+12>>2],Du(I,Ee),_=d[Fe>>2]|0,T=d[17040+(_*80|0)+(d[an>>2]<<2)>>2]|0,d[Fe>>2]=d[18640+(_*80|0)+(T*20|0)>>2],M=d[18640+(_*80|0)+(T*20|0)+16>>2]|0,(M|0)>0){A=0;do c1(q),A=A+1|0;while((A|0)<(M|0))}switch(M=18640+(_*80|0)+(T*20|0)+4|0,d[Pt>>2]=d[M>>2],d[Pt+4>>2]=d[M+4>>2],d[Pt+8>>2]=d[M+8>>2],Xc(Pt,(d[de>>2]|0)*3|0),hs(q,Pt,q),Lr(q),Du(q,nn),ii=+(d[Ae>>2]|0),ee[Jt>>3]=ii*3,ee[pe>>3]=0,wn=ii*-1.5,ee[Un>>3]=wn,ee[Me>>3]=ii*2.598076211353316,ee[En>>3]=wn,ee[Le>>3]=ii*-2.598076211353316,d[17040+((d[Fe>>2]|0)*80|0)+(d[Lt>>2]<<2)>>2]|0){case 1:{A=Un,_=Jt;break}case 3:{A=En,_=Un;break}case 2:{A=Jt,_=En;break}default:{A=12;break e}}xp(Ee,nn,_,A,Qn),Bu(Qn,d[Fe>>2]|0,U,1,y+8+(d[y>>2]<<4)|0),d[y>>2]=(d[y>>2]|0)+1}if((N|0)<(ie|0)&&(Du(Ye,Fe),Bu(Fe,d[Lt>>2]|0,U,1,y+8+(d[y>>2]<<4)|0),d[y>>2]=(d[y>>2]|0)+1),d[an>>2]=d[Lt>>2],d[an+4>>2]=d[Lt+4>>2],d[an+8>>2]=d[Lt+8>>2],d[an+12>>2]=d[Lt+12>>2],N=N+1|0,(N|0)>=(qe|0)){A=3;break}}if((A|0)==3){Q=vn;return}else(A|0)==12&&Ut(26970,27017,572,27027)}function ap(A,f,p){A=A|0,f=f|0,p=p|0;var _=0,y=0,T=0,M=0,N=0,U=0;U=Q,Q=Q+128|0,_=U+64|0,y=U,T=_,M=20240,N=T+60|0;do d[T>>2]=d[M>>2],T=T+4|0,M=M+4|0;while((T|0)<(N|0));T=y,M=20304,N=T+60|0;do d[T>>2]=d[M>>2],T=T+4|0,M=M+4|0;while((T|0)<(N|0));N=(Ss(d[f>>2]|0)|0)==0,_=N?_:y,y=A+4|0,h1(y),f1(y),Ss(d[f>>2]|0)|0&&(Lu(y),d[f>>2]=(d[f>>2]|0)+1),d[p>>2]=d[A>>2],f=p+4|0,hs(y,_,f),Lr(f),d[p+16>>2]=d[A>>2],f=p+20|0,hs(y,_+12|0,f),Lr(f),d[p+32>>2]=d[A>>2],f=p+36|0,hs(y,_+24|0,f),Lr(f),d[p+48>>2]=d[A>>2],f=p+52|0,hs(y,_+36|0,f),Lr(f),d[p+64>>2]=d[A>>2],p=p+68|0,hs(y,_+48|0,p),Lr(p),Q=U}function Ou(A,f,p,_){A=A|0,f=f|0,p=p|0,_=_|0;var y=0,T=0,M=0,N=0,U=0,I=0,q=0,ie=0,de=0,Ae=0,pe=0;if(pe=Q,Q=Q+32|0,de=pe+12|0,N=pe,Ae=A+4|0,ie=d[16960+(f<<2)>>2]|0,q=(_|0)!=0,ie=q?ie*3|0:ie,y=d[Ae>>2]|0,I=A+8|0,M=d[I>>2]|0,q){if(T=A+12|0,_=d[T>>2]|0,y=M+y+_|0,(y|0)==(ie|0))return Ae=1,Q=pe,Ae|0;U=T}else U=A+12|0,_=d[U>>2]|0,y=M+y+_|0;if((y|0)<=(ie|0))return Ae=0,Q=pe,Ae|0;do if((_|0)>0){if(_=d[A>>2]|0,(M|0)>0){T=18640+(_*80|0)+60|0,_=A;break}_=18640+(_*80|0)+40|0,p?(Nu(de,ie,0,0),af(Ae,de,N),EA(N),hs(N,de,Ae),T=_,_=A):(T=_,_=A)}else T=18640+((d[A>>2]|0)*80|0)+20|0,_=A;while(!1);if(d[_>>2]=d[T>>2],y=T+16|0,(d[y>>2]|0)>0){_=0;do c1(Ae),_=_+1|0;while((_|0)<(d[y>>2]|0))}return A=T+4|0,d[de>>2]=d[A>>2],d[de+4>>2]=d[A+4>>2],d[de+8>>2]=d[A+8>>2],f=d[16880+(f<<2)>>2]|0,Xc(de,q?f*3|0:f),hs(Ae,de,Ae),Lr(Ae),q?_=((d[I>>2]|0)+(d[Ae>>2]|0)+(d[U>>2]|0)|0)==(ie|0)?1:2:_=2,Ae=_,Q=pe,Ae|0}function m1(A,f){A=A|0,f=f|0;var p=0;do p=Ou(A,f,0,1)|0;while((p|0)==2);return p|0}function RA(A,f,p,_,y){A=A|0,f=f|0,p=p|0,_=_|0,y=y|0;var T=0,M=0,N=0,U=0,I=0,q=0,ie=0,de=0,Ae=0,pe=0,Me=0,Le=0,Ye=0,qe=0,Fe=0,Ee=0,Pt=0,nn=0,Jt=0,Un=0,En=0,Qn=0,Tn=0;if(En=Q,Q=Q+240|0,T=En+224|0,Pt=En+208|0,nn=En,Jt=En+192|0,Un=En+176|0,Le=En+160|0,Ye=En+144|0,qe=En+128|0,Fe=En+112|0,Ee=En+96|0,d[T>>2]=f,d[Pt>>2]=d[A>>2],d[Pt+4>>2]=d[A+4>>2],d[Pt+8>>2]=d[A+8>>2],d[Pt+12>>2]=d[A+12>>2],op(Pt,T,nn),d[y>>2]=0,Me=_+p+((_|0)==6&1)|0,(Me|0)<=(p|0)){Q=En;return}U=d[T>>2]|0,I=p+6|0,q=16960+(U<<2)|0,ie=Ye+8|0,de=qe+8|0,Ae=Fe+8|0,pe=Jt+4|0,M=0,N=p,_=-1;e:for(;;){if(T=(N|0)%6|0,A=nn+(T<<4)|0,d[Jt>>2]=d[A>>2],d[Jt+4>>2]=d[A+4>>2],d[Jt+8>>2]=d[A+8>>2],d[Jt+12>>2]=d[A+12>>2],A=M,M=Ou(Jt,U,0,1)|0,(N|0)>(p|0)&(Ss(f)|0)!=0&&(A|0)!=1&&(d[Jt>>2]|0)!=(_|0)){switch(Du(nn+(((T+5|0)%6|0)<<4)+4|0,Un),Du(nn+(T<<4)+4|0,Le),Qn=+(d[q>>2]|0),ee[Ye>>3]=Qn*3,ee[ie>>3]=0,Tn=Qn*-1.5,ee[qe>>3]=Tn,ee[de>>3]=Qn*2.598076211353316,ee[Fe>>3]=Tn,ee[Ae>>3]=Qn*-2.598076211353316,T=d[Pt>>2]|0,d[17040+(T*80|0)+(((_|0)==(T|0)?d[Jt>>2]|0:_)<<2)>>2]|0){case 1:{A=qe,_=Ye;break}case 3:{A=Fe,_=qe;break}case 2:{A=Ye,_=Fe;break}default:{A=8;break e}}xp(Un,Le,_,A,Ee),!(bp(Un,Ee)|0)&&!(bp(Le,Ee)|0)&&(Bu(Ee,d[Pt>>2]|0,U,1,y+8+(d[y>>2]<<4)|0),d[y>>2]=(d[y>>2]|0)+1)}if((N|0)<(I|0)&&(Du(pe,Un),Bu(Un,d[Jt>>2]|0,U,1,y+8+(d[y>>2]<<4)|0),d[y>>2]=(d[y>>2]|0)+1),N=N+1|0,(N|0)>=(Me|0)){A=3;break}else _=d[Jt>>2]|0}if((A|0)==3){Q=En;return}else(A|0)==8&&Ut(27054,27017,737,27099)}function op(A,f,p){A=A|0,f=f|0,p=p|0;var _=0,y=0,T=0,M=0,N=0,U=0;U=Q,Q=Q+160|0,_=U+80|0,y=U,T=_,M=20368,N=T+72|0;do d[T>>2]=d[M>>2],T=T+4|0,M=M+4|0;while((T|0)<(N|0));T=y,M=20448,N=T+72|0;do d[T>>2]=d[M>>2],T=T+4|0,M=M+4|0;while((T|0)<(N|0));N=(Ss(d[f>>2]|0)|0)==0,_=N?_:y,y=A+4|0,h1(y),f1(y),Ss(d[f>>2]|0)|0&&(Lu(y),d[f>>2]=(d[f>>2]|0)+1),d[p>>2]=d[A>>2],f=p+4|0,hs(y,_,f),Lr(f),d[p+16>>2]=d[A>>2],f=p+20|0,hs(y,_+12|0,f),Lr(f),d[p+32>>2]=d[A>>2],f=p+36|0,hs(y,_+24|0,f),Lr(f),d[p+48>>2]=d[A>>2],f=p+52|0,hs(y,_+36|0,f),Lr(f),d[p+64>>2]=d[A>>2],f=p+68|0,hs(y,_+48|0,f),Lr(f),d[p+80>>2]=d[A>>2],p=p+84|0,hs(y,_+60|0,p),Lr(p),Q=U}function Qc(A,f){return A=A|0,f=f|0,f=yt(A|0,f|0,52)|0,K()|0,f&15|0}function g1(A,f){return A=A|0,f=f|0,f=yt(A|0,f|0,45)|0,K()|0,f&127|0}function bx(A,f,p,_){return A=A|0,f=f|0,p=p|0,_=_|0,(p+-1|0)>>>0>14?(_=4,_|0):(p=yt(A|0,f|0,(15-p|0)*3|0)|0,K()|0,d[_>>2]=p&7,_=0,_|0)}function Sx(A,f,p,_){A=A|0,f=f|0,p=p|0,_=_|0;var y=0,T=0,M=0,N=0,U=0,I=0;if(A>>>0>15)return _=4,_|0;if(f>>>0>121)return _=17,_|0;M=Nt(A|0,0,52)|0,y=K()|0,N=Nt(f|0,0,45)|0,y=y|(K()|0)|134225919;e:do if((A|0)>=1){for(N=1,M=(at[20528+f>>0]|0)!=0,T=-1;;){if(f=d[p+(N+-1<<2)>>2]|0,f>>>0>6){y=18,f=10;break}if(!((f|0)==0|M^1))if((f|0)==1){y=19,f=10;break}else M=0;if(I=(15-N|0)*3|0,U=Nt(7,0,I|0)|0,y=y&~(K()|0),f=Nt(f|0,((f|0)<0)<<31>>31|0,I|0)|0,T=f|T&~U,y=K()|0|y,(N|0)<(A|0))N=N+1|0;else break e}if((f|0)==10)return y|0}else T=-1;while(!1);return I=_,d[I>>2]=T,d[I+4>>2]=y,I=0,I|0}function NA(A,f){A=A|0,f=f|0;var p=0,_=0,y=0,T=0,M=0;return!(!0&(f&-16777216|0)==134217728)||(_=yt(A|0,f|0,52)|0,K()|0,_=_&15,p=yt(A|0,f|0,45)|0,K()|0,p=p&127,p>>>0>121)?(A=0,A|0):(M=(_^15)*3|0,y=yt(A|0,f|0,M|0)|0,M=Nt(y|0,K()|0,M|0)|0,y=K()|0,T=Ur(-1227133514,-1171,M|0,y|0)|0,!((M&613566756&T|0)==0&(y&4681&(K()|0)|0)==0)||(M=(_*3|0)+19|0,T=Nt(~A|0,~f|0,M|0)|0,M=yt(T|0,K()|0,M|0)|0,!((_|0)==15|(M|0)==0&(K()|0)==0))?(M=0,M|0):!(at[20528+p>>0]|0)||(f=f&8191,(A|0)==0&(f|0)==0)?(M=1,M|0):(M=ff(A|0,f|0)|0,K()|0,((63-M|0)%3|0|0)!=0|0))}function v1(A,f){A=A|0,f=f|0;var p=0,_=0,y=0,T=0,M=0;return!0&(f&-16777216|0)==134217728&&(_=yt(A|0,f|0,52)|0,K()|0,_=_&15,p=yt(A|0,f|0,45)|0,K()|0,p=p&127,p>>>0<=121)&&(M=(_^15)*3|0,y=yt(A|0,f|0,M|0)|0,M=Nt(y|0,K()|0,M|0)|0,y=K()|0,T=Ur(-1227133514,-1171,M|0,y|0)|0,(M&613566756&T|0)==0&(y&4681&(K()|0)|0)==0)&&(M=(_*3|0)+19|0,T=Nt(~A|0,~f|0,M|0)|0,M=yt(T|0,K()|0,M|0)|0,(_|0)==15|(M|0)==0&(K()|0)==0)&&(!(at[20528+p>>0]|0)||(p=f&8191,(A|0)==0&(p|0)==0)||(M=ff(A|0,p|0)|0,K()|0,(63-M|0)%3|0|0))||p1(A,f)|0?(M=1,M|0):(M=(ul(A,f)|0)!=0&1,M|0)}function Iu(A,f,p,_){A=A|0,f=f|0,p=p|0,_=_|0;var y=0,T=0,M=0,N=0;if(y=Nt(f|0,0,52)|0,T=K()|0,p=Nt(p|0,0,45)|0,p=T|(K()|0)|134225919,(f|0)<1){T=-1,_=p,f=A,d[f>>2]=T,A=A+4|0,d[A>>2]=_;return}for(T=1,y=-1;M=(15-T|0)*3|0,N=Nt(7,0,M|0)|0,p=p&~(K()|0),M=Nt(_|0,0,M|0)|0,y=y&~N|M,p=p|(K()|0),(T|0)!=(f|0);)T=T+1|0;N=A,M=N,d[M>>2]=y,N=N+4|0,d[N>>2]=p}function Fu(A,f,p,_){A=A|0,f=f|0,p=p|0,_=_|0;var y=0,T=0;if(T=yt(A|0,f|0,52)|0,K()|0,T=T&15,p>>>0>15)return _=4,_|0;if((T|0)<(p|0))return _=12,_|0;if((T|0)==(p|0))return d[_>>2]=A,d[_+4>>2]=f,_=0,_|0;if(y=Nt(p|0,0,52)|0,y=y|A,A=K()|0|f&-15728641,(T|0)>(p|0))do f=Nt(7,0,(14-p|0)*3|0)|0,p=p+1|0,y=f|y,A=K()|0|A;while((p|0)<(T|0));return d[_>>2]=y,d[_+4>>2]=A,_=0,_|0}function lf(A,f,p,_){A=A|0,f=f|0,p=p|0,_=_|0;var y=0,T=0,M=0;if(T=yt(A|0,f|0,52)|0,K()|0,T=T&15,!((p|0)<16&(T|0)<=(p|0)))return _=4,_|0;y=p-T|0,p=yt(A|0,f|0,45)|0,K()|0;e:do if(!(Bi(p&127)|0))p=Bo(7,0,y,((y|0)<0)<<31>>31)|0,y=K()|0;else{t:do if(T|0){for(p=1;M=Nt(7,0,(15-p|0)*3|0)|0,!!((M&A|0)==0&((K()|0)&f|0)==0);)if(p>>>0>>0)p=p+1|0;else break t;p=Bo(7,0,y,((y|0)<0)<<31>>31)|0,y=K()|0;break e}while(!1);p=Bo(7,0,y,((y|0)<0)<<31>>31)|0,p=fr(p|0,K()|0,5,0)|0,p=Xt(p|0,K()|0,-5,-1)|0,p=ko(p|0,K()|0,6,0)|0,p=Xt(p|0,K()|0,1,0)|0,y=K()|0}while(!1);return M=_,d[M>>2]=p,d[M+4>>2]=y,M=0,M|0}function Ci(A,f){A=A|0,f=f|0;var p=0,_=0,y=0;if(y=yt(A|0,f|0,45)|0,K()|0,!(Bi(y&127)|0))return y=0,y|0;y=yt(A|0,f|0,52)|0,K()|0,y=y&15;e:do if(!y)p=0;else for(_=1;;){if(p=yt(A|0,f|0,(15-_|0)*3|0)|0,K()|0,p=p&7,p|0)break e;if(_>>>0>>0)_=_+1|0;else{p=0;break}}while(!1);return y=(p|0)==0&1,y|0}function _1(A,f,p,_){A=A|0,f=f|0,p=p|0,_=_|0;var y=0,T=0,M=0,N=0;if(M=Q,Q=Q+16|0,T=M,sl(T,A,f,p),f=T,A=d[f>>2]|0,f=d[f+4>>2]|0,(A|0)==0&(f|0)==0)return Q=M,0;y=0,p=0;do N=_+(y<<3)|0,d[N>>2]=A,d[N+4>>2]=f,y=Xt(y|0,p|0,1,0)|0,p=K()|0,uf(T),N=T,A=d[N>>2]|0,f=d[N+4>>2]|0;while(!((A|0)==0&(f|0)==0));return Q=M,0}function lp(A,f,p,_){return A=A|0,f=f|0,p=p|0,_=_|0,(_|0)<(p|0)?(p=f,_=A,ft(p|0),_|0):(p=Nt(-1,-1,((_-p|0)*3|0)+3|0)|0,_=Nt(~p|0,~(K()|0)|0,(15-_|0)*3|0)|0,p=~(K()|0)&f,_=~_&A,ft(p|0),_|0)}function DA(A,f,p,_){A=A|0,f=f|0,p=p|0,_=_|0;var y=0;return y=yt(A|0,f|0,52)|0,K()|0,y=y&15,(p|0)<16&(y|0)<=(p|0)?((y|0)<(p|0)&&(y=Nt(-1,-1,((p+-1-y|0)*3|0)+3|0)|0,y=Nt(~y|0,~(K()|0)|0,(15-p|0)*3|0)|0,f=~(K()|0)&f,A=~y&A),y=Nt(p|0,0,52)|0,p=f&-15728641|(K()|0),d[_>>2]=A|y,d[_+4>>2]=p,_=0,_|0):(_=4,_|0)}function up(A,f,p,_){A=A|0,f=f|0,p=p|0,_=_|0;var y=0,T=0,M=0,N=0,U=0,I=0,q=0,ie=0,de=0,Ae=0,pe=0,Me=0,Le=0,Ye=0,qe=0,Fe=0,Ee=0,Pt=0,nn=0,Jt=0,Un=0,En=0,Qn=0,Tn=0,an=0,Lt=0;if((p|0)==0&(_|0)==0)return Lt=0,Lt|0;if(y=A,T=d[y>>2]|0,y=d[y+4>>2]|0,!0&(y&15728640|0)==0){if(!((_|0)>0|(_|0)==0&p>>>0>0)||(Lt=f,d[Lt>>2]=T,d[Lt+4>>2]=y,(p|0)==1&(_|0)==0))return Lt=0,Lt|0;y=1,T=0;do Tn=A+(y<<3)|0,an=d[Tn+4>>2]|0,Lt=f+(y<<3)|0,d[Lt>>2]=d[Tn>>2],d[Lt+4>>2]=an,y=Xt(y|0,T|0,1,0)|0,T=K()|0;while((T|0)<(_|0)|(T|0)==(_|0)&y>>>0

>>0);return y=0,y|0}if(Qn=p<<3,an=Fo(Qn)|0,!an)return Lt=13,Lt|0;if(Gl(an|0,A|0,Qn|0)|0,Tn=Ks(p,8)|0,!Tn)return An(an),Lt=13,Lt|0;e:for(;;){y=an,I=d[y>>2]|0,y=d[y+4>>2]|0,Un=yt(I|0,y|0,52)|0,K()|0,Un=Un&15,En=Un+-1|0,Jt=(Un|0)!=0,nn=(_|0)>0|(_|0)==0&p>>>0>0;t:do if(Jt&nn){if(qe=Nt(En|0,0,52)|0,Fe=K()|0,En>>>0>15){if(!((I|0)==0&(y|0)==0)){Lt=16;break e}for(T=0,A=0;;){if(T=Xt(T|0,A|0,1,0)|0,A=K()|0,!((A|0)<(_|0)|(A|0)==(_|0)&T>>>0

>>0))break t;if(M=an+(T<<3)|0,Pt=d[M>>2]|0,M=d[M+4>>2]|0,!((Pt|0)==0&(M|0)==0)){y=M,Lt=16;break e}}}for(N=I,A=y,T=0,M=0;;){if(!((N|0)==0&(A|0)==0)){if(!(!0&(A&117440512|0)==0)){Lt=21;break e}if(q=yt(N|0,A|0,52)|0,K()|0,q=q&15,(q|0)<(En|0)){y=12,Lt=27;break e}if((q|0)!=(En|0)&&(N=N|qe,A=A&-15728641|Fe,q>>>0>=Un>>>0)){U=En;do Pt=Nt(7,0,(14-U|0)*3|0)|0,U=U+1|0,N=Pt|N,A=K()|0|A;while(U>>>0>>0)}if(de=ec(N|0,A|0,p|0,_|0)|0,Ae=K()|0,U=Tn+(de<<3)|0,q=U,ie=d[q>>2]|0,q=d[q+4>>2]|0,!((ie|0)==0&(q|0)==0)){Le=0,Ye=0;do{if((Le|0)>(_|0)|(Le|0)==(_|0)&Ye>>>0>p>>>0){Lt=31;break e}if((ie|0)==(N|0)&(q&-117440513|0)==(A|0)){pe=yt(ie|0,q|0,56)|0,K()|0,pe=pe&7,Me=pe+1|0,Pt=yt(ie|0,q|0,45)|0,K()|0;n:do if(!(Bi(Pt&127)|0))q=7;else{if(ie=yt(ie|0,q|0,52)|0,K()|0,ie=ie&15,!ie){q=6;break}for(q=1;;){if(Pt=Nt(7,0,(15-q|0)*3|0)|0,!((Pt&N|0)==0&((K()|0)&A|0)==0)){q=7;break n}if(q>>>0>>0)q=q+1|0;else{q=6;break}}}while(!1);if((pe+2|0)>>>0>q>>>0){Lt=41;break e}Pt=Nt(Me|0,0,56)|0,A=K()|0|A&-117440513,Ee=U,d[Ee>>2]=0,d[Ee+4>>2]=0,N=Pt|N}else de=Xt(de|0,Ae|0,1,0)|0,de=th(de|0,K()|0,p|0,_|0)|0,Ae=K()|0;Ye=Xt(Ye|0,Le|0,1,0)|0,Le=K()|0,U=Tn+(de<<3)|0,q=U,ie=d[q>>2]|0,q=d[q+4>>2]|0}while(!((ie|0)==0&(q|0)==0))}Pt=U,d[Pt>>2]=N,d[Pt+4>>2]=A}if(T=Xt(T|0,M|0,1,0)|0,M=K()|0,!((M|0)<(_|0)|(M|0)==(_|0)&T>>>0

>>0))break t;A=an+(T<<3)|0,N=d[A>>2]|0,A=d[A+4>>2]|0}}while(!1);if(Pt=Xt(p|0,_|0,5,0)|0,Ee=K()|0,Ee>>>0<0|(Ee|0)==0&Pt>>>0<11){Lt=85;break}if(Pt=ko(p|0,_|0,6,0)|0,K()|0,Pt=Ks(Pt,8)|0,!Pt){Lt=48;break}do if(nn){for(Me=0,A=0,pe=0,Le=0;;){if(q=Tn+(Me<<3)|0,M=q,T=d[M>>2]|0,M=d[M+4>>2]|0,(T|0)==0&(M|0)==0)Ee=pe;else{ie=yt(T|0,M|0,56)|0,K()|0,ie=ie&7,N=ie+1|0,de=M&-117440513,Ee=yt(T|0,M|0,45)|0,K()|0;t:do if(Bi(Ee&127)|0){if(Ae=yt(T|0,M|0,52)|0,K()|0,Ae=Ae&15,Ae|0)for(U=1;;){if(Ee=Nt(7,0,(15-U|0)*3|0)|0,!((T&Ee|0)==0&(de&(K()|0)|0)==0))break t;if(U>>>0>>0)U=U+1|0;else break}M=Nt(N|0,0,56)|0,T=M|T,M=K()|0|de,N=q,d[N>>2]=T,d[N+4>>2]=M,N=ie+2|0}while(!1);(N|0)==7?(Ee=Pt+(A<<3)|0,d[Ee>>2]=T,d[Ee+4>>2]=M&-117440513,A=Xt(A|0,pe|0,1,0)|0,Ee=K()|0):Ee=pe}if(Me=Xt(Me|0,Le|0,1,0)|0,Le=K()|0,(Le|0)<(_|0)|(Le|0)==(_|0)&Me>>>0

>>0)pe=Ee;else break}if(nn){if(Ye=En>>>0>15,qe=Nt(En|0,0,52)|0,Fe=K()|0,!Jt){for(T=0,U=0,N=0,M=0;(I|0)==0&(y|0)==0||(En=f+(T<<3)|0,d[En>>2]=I,d[En+4>>2]=y,T=Xt(T|0,U|0,1,0)|0,U=K()|0),N=Xt(N|0,M|0,1,0)|0,M=K()|0,!!((M|0)<(_|0)|(M|0)==(_|0)&N>>>0

>>0);)y=an+(N<<3)|0,I=d[y>>2]|0,y=d[y+4>>2]|0;y=Ee;break}for(T=0,U=0,M=0,N=0;;){do if(!((I|0)==0&(y|0)==0)){if(Ae=yt(I|0,y|0,52)|0,K()|0,Ae=Ae&15,Ye|(Ae|0)<(En|0)){Lt=80;break e}if((Ae|0)!=(En|0)){if(q=I|qe,ie=y&-15728641|Fe,Ae>>>0>=Un>>>0){de=En;do Jt=Nt(7,0,(14-de|0)*3|0)|0,de=de+1|0,q=Jt|q,ie=K()|0|ie;while(de>>>0>>0)}}else q=I,ie=y;pe=ec(q|0,ie|0,p|0,_|0)|0,de=0,Ae=0,Le=K()|0;do{if((de|0)>(_|0)|(de|0)==(_|0)&Ae>>>0>p>>>0){Lt=81;break e}if(Jt=Tn+(pe<<3)|0,Me=d[Jt+4>>2]|0,(Me&-117440513|0)==(ie|0)&&(d[Jt>>2]|0)==(q|0)){Lt=65;break}Jt=Xt(pe|0,Le|0,1,0)|0,pe=th(Jt|0,K()|0,p|0,_|0)|0,Le=K()|0,Ae=Xt(Ae|0,de|0,1,0)|0,de=K()|0,Jt=Tn+(pe<<3)|0}while(!((d[Jt>>2]|0)==(q|0)&&(d[Jt+4>>2]|0)==(ie|0)));if((Lt|0)==65&&(Lt=0,!0&(Me&117440512|0)==100663296))break;Jt=f+(T<<3)|0,d[Jt>>2]=I,d[Jt+4>>2]=y,T=Xt(T|0,U|0,1,0)|0,U=K()|0}while(!1);if(M=Xt(M|0,N|0,1,0)|0,N=K()|0,!((N|0)<(_|0)|(N|0)==(_|0)&M>>>0

>>0))break;y=an+(M<<3)|0,I=d[y>>2]|0,y=d[y+4>>2]|0}y=Ee}else T=0,y=Ee}else T=0,A=0,y=0;while(!1);if(uo(Tn|0,0,Qn|0)|0,Gl(an|0,Pt|0,A<<3|0)|0,An(Pt),(A|0)==0&(y|0)==0){Lt=89;break}else f=f+(T<<3)|0,_=y,p=A}if((Lt|0)==16)!0&(y&117440512|0)==0?(y=4,Lt=27):Lt=21;else if((Lt|0)==31)Ut(27795,27122,620,27132);else{if((Lt|0)==41)return An(an),An(Tn),Lt=10,Lt|0;if((Lt|0)==48)return An(an),An(Tn),Lt=13,Lt|0;(Lt|0)==80?Ut(27795,27122,711,27132):(Lt|0)==81?Ut(27795,27122,723,27132):(Lt|0)==85&&(Gl(f|0,an|0,p<<3|0)|0,Lt=89)}return(Lt|0)==21?(An(an),An(Tn),Lt=5,Lt|0):(Lt|0)==27?(An(an),An(Tn),Lt=y,Lt|0):(Lt|0)==89?(An(an),An(Tn),Lt=0,Lt|0):0}function y1(A,f,p,_,y,T,M){A=A|0,f=f|0,p=p|0,_=_|0,y=y|0,T=T|0,M=M|0;var N=0,U=0,I=0,q=0,ie=0,de=0,Ae=0,pe=0,Me=0;if(Me=Q,Q=Q+16|0,pe=Me,!((p|0)>0|(p|0)==0&f>>>0>0))return pe=0,Q=Me,pe|0;if((M|0)>=16)return pe=12,Q=Me,pe|0;de=0,Ae=0,ie=0,N=0;e:for(;;){if(I=A+(de<<3)|0,U=d[I>>2]|0,I=d[I+4>>2]|0,q=yt(U|0,I|0,52)|0,K()|0,(q&15|0)>(M|0)){N=12,U=11;break}if(sl(pe,U,I,M),q=pe,I=d[q>>2]|0,q=d[q+4>>2]|0,(I|0)==0&(q|0)==0)U=ie;else{U=ie;do{if(!((N|0)<(T|0)|(N|0)==(T|0)&U>>>0>>0)){U=10;break e}ie=_+(U<<3)|0,d[ie>>2]=I,d[ie+4>>2]=q,U=Xt(U|0,N|0,1,0)|0,N=K()|0,uf(pe),ie=pe,I=d[ie>>2]|0,q=d[ie+4>>2]|0}while(!((I|0)==0&(q|0)==0))}if(de=Xt(de|0,Ae|0,1,0)|0,Ae=K()|0,(Ae|0)<(p|0)|(Ae|0)==(p|0)&de>>>0>>0)ie=U;else{N=0,U=11;break}}return(U|0)==10?(pe=14,Q=Me,pe|0):(U|0)==11?(Q=Me,N|0):0}function x1(A,f,p,_,y){A=A|0,f=f|0,p=p|0,_=_|0,y=y|0;var T=0,M=0,N=0,U=0,I=0,q=0,ie=0,de=0;de=Q,Q=Q+16|0,ie=de;e:do if((p|0)>0|(p|0)==0&f>>>0>0){for(I=0,M=0,T=0,q=0;;){if(U=A+(I<<3)|0,N=d[U>>2]|0,U=d[U+4>>2]|0,!((N|0)==0&(U|0)==0)&&(U=(lf(N,U,_,ie)|0)==0,N=ie,M=Xt(d[N>>2]|0,d[N+4>>2]|0,M|0,T|0)|0,T=K()|0,!U)){T=12;break}if(I=Xt(I|0,q|0,1,0)|0,q=K()|0,!((q|0)<(p|0)|(q|0)==(p|0)&I>>>0>>0))break e}return Q=de,T|0}else M=0,T=0;while(!1);return d[y>>2]=M,d[y+4>>2]=T,y=0,Q=de,y|0}function b1(A,f){return A=A|0,f=f|0,f=yt(A|0,f|0,52)|0,K()|0,f&1|0}function $s(A,f){A=A|0,f=f|0;var p=0,_=0,y=0;if(y=yt(A|0,f|0,52)|0,K()|0,y=y&15,!y)return y=0,y|0;for(_=1;;){if(p=yt(A|0,f|0,(15-_|0)*3|0)|0,K()|0,p=p&7,p|0){_=5;break}if(_>>>0>>0)_=_+1|0;else{p=0,_=5;break}}return(_|0)==5?p|0:0}function cp(A,f){A=A|0,f=f|0;var p=0,_=0,y=0,T=0,M=0,N=0,U=0;if(U=yt(A|0,f|0,52)|0,K()|0,U=U&15,!U)return N=f,U=A,ft(N|0),U|0;for(N=1,p=0;;){T=(15-N|0)*3|0,_=Nt(7,0,T|0)|0,y=K()|0,M=yt(A|0,f|0,T|0)|0,K()|0,T=Nt(Uu(M&7)|0,0,T|0)|0,M=K()|0,A=T|A&~_,f=M|f&~y;e:do if(!p)if((T&_|0)==0&(M&y|0)==0)p=0;else if(_=yt(A|0,f|0,52)|0,K()|0,_=_&15,!_)p=1;else{p=1;t:for(;;){switch(M=yt(A|0,f|0,(15-p|0)*3|0)|0,K()|0,M&7){case 1:break t;case 0:break;default:{p=1;break e}}if(p>>>0<_>>>0)p=p+1|0;else{p=1;break e}}for(p=1;;)if(M=(15-p|0)*3|0,y=yt(A|0,f|0,M|0)|0,K()|0,T=Nt(7,0,M|0)|0,f=f&~(K()|0),M=Nt(Uu(y&7)|0,0,M|0)|0,A=A&~T|M,f=f|(K()|0),p>>>0<_>>>0)p=p+1|0;else{p=1;break}}while(!1);if(N>>>0>>0)N=N+1|0;else break}return ft(f|0),A|0}function ku(A,f){A=A|0,f=f|0;var p=0,_=0,y=0,T=0,M=0;if(_=yt(A|0,f|0,52)|0,K()|0,_=_&15,!_)return p=f,_=A,ft(p|0),_|0;for(p=1;T=(15-p|0)*3|0,M=yt(A|0,f|0,T|0)|0,K()|0,y=Nt(7,0,T|0)|0,f=f&~(K()|0),T=Nt(Uu(M&7)|0,0,T|0)|0,A=T|A&~y,f=K()|0|f,p>>>0<_>>>0;)p=p+1|0;return ft(f|0),A|0}function Tx(A,f){A=A|0,f=f|0;var p=0,_=0,y=0,T=0,M=0,N=0,U=0;if(U=yt(A|0,f|0,52)|0,K()|0,U=U&15,!U)return N=f,U=A,ft(N|0),U|0;for(N=1,p=0;;){T=(15-N|0)*3|0,_=Nt(7,0,T|0)|0,y=K()|0,M=yt(A|0,f|0,T|0)|0,K()|0,T=Nt(rl(M&7)|0,0,T|0)|0,M=K()|0,A=T|A&~_,f=M|f&~y;e:do if(!p)if((T&_|0)==0&(M&y|0)==0)p=0;else if(_=yt(A|0,f|0,52)|0,K()|0,_=_&15,!_)p=1;else{p=1;t:for(;;){switch(M=yt(A|0,f|0,(15-p|0)*3|0)|0,K()|0,M&7){case 1:break t;case 0:break;default:{p=1;break e}}if(p>>>0<_>>>0)p=p+1|0;else{p=1;break e}}for(p=1;;)if(y=(15-p|0)*3|0,T=Nt(7,0,y|0)|0,M=f&~(K()|0),f=yt(A|0,f|0,y|0)|0,K()|0,f=Nt(rl(f&7)|0,0,y|0)|0,A=A&~T|f,f=M|(K()|0),p>>>0<_>>>0)p=p+1|0;else{p=1;break}}while(!1);if(N>>>0>>0)N=N+1|0;else break}return ft(f|0),A|0}function hp(A,f){A=A|0,f=f|0;var p=0,_=0,y=0,T=0,M=0;if(_=yt(A|0,f|0,52)|0,K()|0,_=_&15,!_)return p=f,_=A,ft(p|0),_|0;for(p=1;M=(15-p|0)*3|0,T=Nt(7,0,M|0)|0,y=f&~(K()|0),f=yt(A|0,f|0,M|0)|0,K()|0,f=Nt(rl(f&7)|0,0,M|0)|0,A=f|A&~T,f=K()|0|y,p>>>0<_>>>0;)p=p+1|0;return ft(f|0),A|0}function Aa(A,f){A=A|0,f=f|0;var p=0,_=0,y=0,T=0,M=0,N=0,U=0,I=0,q=0;if(U=Q,Q=Q+64|0,N=U+40|0,_=U+24|0,y=U+12|0,T=U,Nt(f|0,0,52)|0,p=K()|0|134225919,!f)return(d[A+4>>2]|0)>2||(d[A+8>>2]|0)>2||(d[A+12>>2]|0)>2?(M=0,N=0,ft(M|0),Q=U,N|0):(Nt(Po(A)|0,0,45)|0,M=K()|0|p,N=-1,ft(M|0),Q=U,N|0);if(d[N>>2]=d[A>>2],d[N+4>>2]=d[A+4>>2],d[N+8>>2]=d[A+8>>2],d[N+12>>2]=d[A+12>>2],M=N+4|0,(f|0)>0)for(A=-1;d[_>>2]=d[M>>2],d[_+4>>2]=d[M+4>>2],d[_+8>>2]=d[M+8>>2],f&1?(hx(M),d[y>>2]=d[M>>2],d[y+4>>2]=d[M+4>>2],d[y+8>>2]=d[M+8>>2],Yc(y)):(l1(M),d[y>>2]=d[M>>2],d[y+4>>2]=d[M+4>>2],d[y+8>>2]=d[M+8>>2],Lu(y)),af(_,y,T),Lr(T),q=(15-f|0)*3|0,I=Nt(7,0,q|0)|0,p=p&~(K()|0),q=Nt(Pu(T)|0,0,q|0)|0,A=q|A&~I,p=K()|0|p,(f|0)>1;)f=f+-1|0;else A=-1;e:do if((d[M>>2]|0)<=2&&(d[N+8>>2]|0)<=2&&(d[N+12>>2]|0)<=2){if(_=Po(N)|0,f=Nt(_|0,0,45)|0,f=f|A,A=K()|0|p&-1040385,T=ep(N)|0,!(Bi(_)|0)){if((T|0)<=0)break;for(y=0;;){if(_=yt(f|0,A|0,52)|0,K()|0,_=_&15,_)for(p=1;q=(15-p|0)*3|0,N=yt(f|0,A|0,q|0)|0,K()|0,I=Nt(7,0,q|0)|0,A=A&~(K()|0),q=Nt(Uu(N&7)|0,0,q|0)|0,f=f&~I|q,A=A|(K()|0),p>>>0<_>>>0;)p=p+1|0;if(y=y+1|0,(y|0)==(T|0))break e}}y=yt(f|0,A|0,52)|0,K()|0,y=y&15;t:do if(y){p=1;n:for(;;){switch(q=yt(f|0,A|0,(15-p|0)*3|0)|0,K()|0,q&7){case 1:break n;case 0:break;default:break t}if(p>>>0>>0)p=p+1|0;else break t}if(Ru(_,d[N>>2]|0)|0)for(p=1;N=(15-p|0)*3|0,I=Nt(7,0,N|0)|0,q=A&~(K()|0),A=yt(f|0,A|0,N|0)|0,K()|0,A=Nt(rl(A&7)|0,0,N|0)|0,f=f&~I|A,A=q|(K()|0),p>>>0>>0;)p=p+1|0;else for(p=1;q=(15-p|0)*3|0,N=yt(f|0,A|0,q|0)|0,K()|0,I=Nt(7,0,q|0)|0,A=A&~(K()|0),q=Nt(Uu(N&7)|0,0,q|0)|0,f=f&~I|q,A=A|(K()|0),p>>>0>>0;)p=p+1|0}while(!1);if((T|0)>0){p=0;do f=cp(f,A)|0,A=K()|0,p=p+1|0;while((p|0)!=(T|0))}}else f=0,A=0;while(!1);return I=A,q=f,ft(I|0),Q=U,q|0}function Ss(A){return A=A|0,(A|0)%2|0|0}function PA(A,f,p){A=A|0,f=f|0,p=p|0;var _=0,y=0;return y=Q,Q=Q+16|0,_=y,f>>>0>15?(_=4,Q=y,_|0):(d[A+4>>2]&2146435072|0)==2146435072||(d[A+8+4>>2]&2146435072|0)==2146435072?(_=3,Q=y,_|0):(_x(A,f,_),f=Aa(_,f)|0,_=K()|0,d[p>>2]=f,d[p+4>>2]=_,(f|0)==0&(_|0)==0&&Ut(27795,27122,1050,27145),_=0,Q=y,_|0)}function LA(A,f,p){A=A|0,f=f|0,p=p|0;var _=0,y=0,T=0,M=0;if(y=p+4|0,T=yt(A|0,f|0,52)|0,K()|0,T=T&15,M=yt(A|0,f|0,45)|0,K()|0,_=(T|0)==0,Bi(M&127)|0){if(_)return M=1,M|0;_=1}else{if(_)return M=0,M|0;(d[y>>2]|0)==0&&(d[p+8>>2]|0)==0?_=(d[p+12>>2]|0)!=0&1:_=1}for(p=1;p&1?Yc(y):Lu(y),M=yt(A|0,f|0,(15-p|0)*3|0)|0,K()|0,u1(y,M&7),p>>>0>>0;)p=p+1|0;return _|0}function zu(A,f,p){A=A|0,f=f|0,p=p|0;var _=0,y=0,T=0,M=0,N=0,U=0,I=0,q=0;if(q=Q,Q=Q+16|0,U=q,I=yt(A|0,f|0,45)|0,K()|0,I=I&127,I>>>0>121)return d[p>>2]=0,d[p+4>>2]=0,d[p+8>>2]=0,d[p+12>>2]=0,I=5,Q=q,I|0;e:do if((Bi(I)|0)!=0&&(T=yt(A|0,f|0,52)|0,K()|0,T=T&15,(T|0)!=0)){_=1;t:for(;;){switch(N=yt(A|0,f|0,(15-_|0)*3|0)|0,K()|0,N&7){case 5:break t;case 0:break;default:{_=f;break e}}if(_>>>0>>0)_=_+1|0;else{_=f;break e}}for(y=1,_=f;f=(15-y|0)*3|0,M=Nt(7,0,f|0)|0,N=_&~(K()|0),_=yt(A|0,_|0,f|0)|0,K()|0,_=Nt(rl(_&7)|0,0,f|0)|0,A=A&~M|_,_=N|(K()|0),y>>>0>>0;)y=y+1|0}else _=f;while(!1);if(N=7696+(I*28|0)|0,d[p>>2]=d[N>>2],d[p+4>>2]=d[N+4>>2],d[p+8>>2]=d[N+8>>2],d[p+12>>2]=d[N+12>>2],!(LA(A,_,p)|0))return I=0,Q=q,I|0;if(M=p+4|0,d[U>>2]=d[M>>2],d[U+4>>2]=d[M+4>>2],d[U+8>>2]=d[M+8>>2],T=yt(A|0,_|0,52)|0,K()|0,N=T&15,T&1?(Lu(M),T=N+1|0):T=N,!(Bi(I)|0))_=0;else{e:do if(!N)_=0;else for(f=1;;){if(y=yt(A|0,_|0,(15-f|0)*3|0)|0,K()|0,y=y&7,y|0){_=y;break e}if(f>>>0>>0)f=f+1|0;else{_=0;break}}while(!1);_=(_|0)==4&1}if(!(Ou(p,T,_,0)|0))(T|0)!=(N|0)&&(d[M>>2]=d[U>>2],d[M+4>>2]=d[U+4>>2],d[M+8>>2]=d[U+8>>2]);else{if(Bi(I)|0)do;while((Ou(p,T,0,0)|0)!=0);(T|0)!=(N|0)&&l1(M)}return I=0,Q=q,I|0}function Ol(A,f,p){A=A|0,f=f|0,p=p|0;var _=0,y=0,T=0;return T=Q,Q=Q+16|0,_=T,y=zu(A,f,_)|0,y|0?(Q=T,y|0):(y=yt(A|0,f|0,52)|0,K()|0,of(_,y&15,p),y=0,Q=T,y|0)}function Il(A,f,p){A=A|0,f=f|0,p=p|0;var _=0,y=0,T=0,M=0,N=0;if(M=Q,Q=Q+16|0,T=M,_=zu(A,f,T)|0,_|0)return T=_,Q=M,T|0;_=yt(A|0,f|0,45)|0,K()|0,_=(Bi(_&127)|0)==0,y=yt(A|0,f|0,52)|0,K()|0,y=y&15;e:do if(!_){if(y|0)for(_=1;;){if(N=Nt(7,0,(15-_|0)*3|0)|0,!((N&A|0)==0&((K()|0)&f|0)==0))break e;if(_>>>0>>0)_=_+1|0;else break}return sp(T,y,0,5,p),N=0,Q=M,N|0}while(!1);return RA(T,y,0,6,p),N=0,Q=M,N|0}function wx(A,f,p){A=A|0,f=f|0,p=p|0;var _=0,y=0,T=0;if(y=yt(A|0,f|0,45)|0,K()|0,!(Bi(y&127)|0))return y=2,d[p>>2]=y,0;if(y=yt(A|0,f|0,52)|0,K()|0,y=y&15,!y)return y=5,d[p>>2]=y,0;for(_=1;;){if(T=Nt(7,0,(15-_|0)*3|0)|0,!((T&A|0)==0&((K()|0)&f|0)==0)){_=2,A=6;break}if(_>>>0>>0)_=_+1|0;else{_=5,A=6;break}}return(A|0)==6&&(d[p>>2]=_),0}function Gu(A,f,p){A=A|0,f=f|0,p=p|0;var _=0,y=0,T=0,M=0,N=0,U=0,I=0,q=0,ie=0;ie=Q,Q=Q+128|0,I=ie+112|0,T=ie+96|0,q=ie,y=yt(A|0,f|0,52)|0,K()|0,N=y&15,d[I>>2]=N,M=yt(A|0,f|0,45)|0,K()|0,M=M&127;e:do if(Bi(M)|0){if(N|0)for(_=1;;){if(U=Nt(7,0,(15-_|0)*3|0)|0,!((U&A|0)==0&((K()|0)&f|0)==0)){y=0;break e}if(_>>>0>>0)_=_+1|0;else break}if(y&1)y=1;else return U=Nt(N+1|0,0,52)|0,q=K()|0|f&-15728641,I=Nt(7,0,(14-N|0)*3|0)|0,q=Gu((U|A)&~I,q&~(K()|0),p)|0,Q=ie,q|0}else y=0;while(!1);if(_=zu(A,f,T)|0,!_){y?(ap(T,I,q),U=5):(op(T,I,q),U=6);e:do if(Bi(M)|0)if(!N)A=5;else for(_=1;;){if(M=Nt(7,0,(15-_|0)*3|0)|0,!((M&A|0)==0&((K()|0)&f|0)==0)){A=2;break e}if(_>>>0>>0)_=_+1|0;else{A=5;break}}else A=2;while(!1);uo(p|0,-1,A<<2|0)|0;e:do if(y)for(T=0;;){if(M=q+(T<<4)|0,m1(M,d[I>>2]|0)|0,M=d[M>>2]|0,N=d[p>>2]|0,(N|0)==-1|(N|0)==(M|0))_=p;else{y=0;do{if(y=y+1|0,y>>>0>=A>>>0){_=1;break e}_=p+(y<<2)|0,N=d[_>>2]|0}while(!((N|0)==-1|(N|0)==(M|0)))}if(d[_>>2]=M,T=T+1|0,T>>>0>=U>>>0){_=0;break}}else for(T=0;;){if(M=q+(T<<4)|0,Ou(M,d[I>>2]|0,0,1)|0,M=d[M>>2]|0,N=d[p>>2]|0,(N|0)==-1|(N|0)==(M|0))_=p;else{y=0;do{if(y=y+1|0,y>>>0>=A>>>0){_=1;break e}_=p+(y<<2)|0,N=d[_>>2]|0}while(!((N|0)==-1|(N|0)==(M|0)))}if(d[_>>2]=M,T=T+1|0,T>>>0>=U>>>0){_=0;break}}while(!1)}return q=_,Q=ie,q|0}function fp(){return 12}function qu(A,f){A=A|0,f=f|0;var p=0,_=0,y=0,T=0,M=0,N=0,U=0;if(A>>>0>15)return N=4,N|0;if(Nt(A|0,0,52)|0,N=K()|0|134225919,!A){p=0,_=0;do Bi(_)|0&&(Nt(_|0,0,45)|0,M=N|(K()|0),A=f+(p<<3)|0,d[A>>2]=-1,d[A+4>>2]=M,p=p+1|0),_=_+1|0;while((_|0)!=122);return p=0,p|0}p=0,M=0;do{if(Bi(M)|0){for(Nt(M|0,0,45)|0,_=1,y=-1,T=N|(K()|0);U=Nt(7,0,(15-_|0)*3|0)|0,y=y&~U,T=T&~(K()|0),(_|0)!=(A|0);)_=_+1|0;U=f+(p<<3)|0,d[U>>2]=y,d[U+4>>2]=T,p=p+1|0}M=M+1|0}while((M|0)!=122);return p=0,p|0}function Ap(A,f,p,_){A=A|0,f=f|0,p=p|0,_=_|0;var y=0,T=0,M=0,N=0,U=0,I=0,q=0,ie=0,de=0,Ae=0,pe=0,Me=0,Le=0,Ye=0,qe=0;if(qe=Q,Q=Q+16|0,Le=qe,Ye=yt(A|0,f|0,52)|0,K()|0,Ye=Ye&15,p>>>0>15)return Ye=4,Q=qe,Ye|0;if((Ye|0)<(p|0))return Ye=12,Q=qe,Ye|0;if((Ye|0)!=(p|0))if(T=Nt(p|0,0,52)|0,T=T|A,N=K()|0|f&-15728641,(Ye|0)>(p|0)){U=p;do Me=Nt(7,0,(14-U|0)*3|0)|0,U=U+1|0,T=Me|T,N=K()|0|N;while((U|0)<(Ye|0));Me=T}else Me=T;else Me=A,N=f;pe=yt(Me|0,N|0,45)|0,K()|0;e:do if(Bi(pe&127)|0){if(U=yt(Me|0,N|0,52)|0,K()|0,U=U&15,U|0)for(T=1;;){if(pe=Nt(7,0,(15-T|0)*3|0)|0,!((pe&Me|0)==0&((K()|0)&N|0)==0)){I=33;break e}if(T>>>0>>0)T=T+1|0;else break}if(pe=_,d[pe>>2]=0,d[pe+4>>2]=0,(Ye|0)>(p|0)){for(pe=f&-15728641,Ae=Ye;;){if(de=Ae,Ae=Ae+-1|0,Ae>>>0>15|(Ye|0)<(Ae|0)){I=19;break}if((Ye|0)!=(Ae|0))if(T=Nt(Ae|0,0,52)|0,T=T|A,U=K()|0|pe,(Ye|0)<(de|0))ie=T;else{I=Ae;do ie=Nt(7,0,(14-I|0)*3|0)|0,I=I+1|0,T=ie|T,U=K()|0|U;while((I|0)<(Ye|0));ie=T}else ie=A,U=f;if(q=yt(ie|0,U|0,45)|0,K()|0,!(Bi(q&127)|0))T=0;else{q=yt(ie|0,U|0,52)|0,K()|0,q=q&15;t:do if(!q)T=0;else for(I=1;;){if(T=yt(ie|0,U|0,(15-I|0)*3|0)|0,K()|0,T=T&7,T|0)break t;if(I>>>0>>0)I=I+1|0;else{T=0;break}}while(!1);T=(T|0)==0&1}if(U=yt(A|0,f|0,(15-de|0)*3|0)|0,K()|0,U=U&7,(U|0)==7){y=5,I=42;break}if(T=(T|0)!=0,(U|0)==1&T){y=5,I=42;break}if(ie=U+(((U|0)!=0&T)<<31>>31)|0,ie|0&&(I=Ye-de|0,I=Bo(7,0,I,((I|0)<0)<<31>>31)|0,q=K()|0,T?(T=fr(I|0,q|0,5,0)|0,T=Xt(T|0,K()|0,-5,-1)|0,T=ko(T|0,K()|0,6,0)|0,T=Xt(T|0,K()|0,1,0)|0,U=K()|0):(T=I,U=q),de=ie+-1|0,de=fr(I|0,q|0,de|0,((de|0)<0)<<31>>31|0)|0,de=Xt(T|0,U|0,de|0,K()|0)|0,ie=K()|0,q=_,q=Xt(de|0,ie|0,d[q>>2]|0,d[q+4>>2]|0)|0,ie=K()|0,de=_,d[de>>2]=q,d[de+4>>2]=ie),(Ae|0)<=(p|0)){I=37;break}}if((I|0)==19)Ut(27795,27122,1367,27158);else if((I|0)==37){M=_,y=d[M+4>>2]|0,M=d[M>>2]|0;break}else if((I|0)==42)return Q=qe,y|0}else y=0,M=0}else I=33;while(!1);e:do if((I|0)==33)if(pe=_,d[pe>>2]=0,d[pe+4>>2]=0,(Ye|0)>(p|0)){for(T=Ye;;){if(y=yt(A|0,f|0,(15-T|0)*3|0)|0,K()|0,y=y&7,(y|0)==7){y=5;break}if(M=Ye-T|0,M=Bo(7,0,M,((M|0)<0)<<31>>31)|0,y=fr(M|0,K()|0,y|0,0)|0,M=K()|0,pe=_,M=Xt(d[pe>>2]|0,d[pe+4>>2]|0,y|0,M|0)|0,y=K()|0,pe=_,d[pe>>2]=M,d[pe+4>>2]=y,T=T+-1|0,(T|0)<=(p|0))break e}return Q=qe,y|0}else y=0,M=0;while(!1);return lf(Me,N,Ye,Le)|0&&Ut(27795,27122,1327,27173),Ye=Le,Le=d[Ye+4>>2]|0,((y|0)>-1|(y|0)==-1&M>>>0>4294967295)&((Le|0)>(y|0)|((Le|0)==(y|0)?(d[Ye>>2]|0)>>>0>M>>>0:0))?(Ye=0,Q=qe,Ye|0):(Ut(27795,27122,1407,27158),0)}function S1(A,f,p,_,y,T){A=A|0,f=f|0,p=p|0,_=_|0,y=y|0,T=T|0;var M=0,N=0,U=0,I=0,q=0,ie=0,de=0,Ae=0,pe=0,Me=0;if(ie=Q,Q=Q+16|0,M=ie,y>>>0>15)return T=4,Q=ie,T|0;if(N=yt(p|0,_|0,52)|0,K()|0,N=N&15,(N|0)>(y|0))return T=12,Q=ie,T|0;if(lf(p,_,y,M)|0&&Ut(27795,27122,1327,27173),q=M,I=d[q+4>>2]|0,!(((f|0)>-1|(f|0)==-1&A>>>0>4294967295)&((I|0)>(f|0)|((I|0)==(f|0)?(d[q>>2]|0)>>>0>A>>>0:0))))return T=2,Q=ie,T|0;q=y-N|0,y=Nt(y|0,0,52)|0,U=K()|0|_&-15728641,I=T,d[I>>2]=y|p,d[I+4>>2]=U,I=yt(p|0,_|0,45)|0,K()|0;e:do if(Bi(I&127)|0){if(N|0)for(M=1;;){if(I=Nt(7,0,(15-M|0)*3|0)|0,!((I&p|0)==0&((K()|0)&_|0)==0))break e;if(M>>>0>>0)M=M+1|0;else break}if((q|0)<1)return T=0,Q=ie,T|0;for(I=N^15,_=-1,U=1,M=1;;){N=q-U|0,N=Bo(7,0,N,((N|0)<0)<<31>>31)|0,p=K()|0;do if(M)if(M=fr(N|0,p|0,5,0)|0,M=Xt(M|0,K()|0,-5,-1)|0,M=ko(M|0,K()|0,6,0)|0,y=K()|0,(f|0)>(y|0)|(f|0)==(y|0)&A>>>0>M>>>0){f=Xt(A|0,f|0,-1,-1)|0,f=Ur(f|0,K()|0,M|0,y|0)|0,M=K()|0,de=T,pe=d[de>>2]|0,de=d[de+4>>2]|0,Me=(I+_|0)*3|0,Ae=Nt(7,0,Me|0)|0,de=de&~(K()|0),_=ko(f|0,M|0,N|0,p|0)|0,A=K()|0,y=Xt(_|0,A|0,2,0)|0,Me=Nt(y|0,K()|0,Me|0)|0,de=K()|0|de,y=T,d[y>>2]=Me|pe&~Ae,d[y+4>>2]=de,A=fr(_|0,A|0,N|0,p|0)|0,A=Ur(f|0,M|0,A|0,K()|0)|0,M=0,f=K()|0;break}else{Me=T,Ae=d[Me>>2]|0,Me=d[Me+4>>2]|0,pe=Nt(7,0,(I+_|0)*3|0)|0,Me=Me&~(K()|0),M=T,d[M>>2]=Ae&~pe,d[M+4>>2]=Me,M=1;break}else Ae=T,y=d[Ae>>2]|0,Ae=d[Ae+4>>2]|0,_=(I+_|0)*3|0,de=Nt(7,0,_|0)|0,Ae=Ae&~(K()|0),Me=ko(A|0,f|0,N|0,p|0)|0,M=K()|0,_=Nt(Me|0,M|0,_|0)|0,Ae=K()|0|Ae,pe=T,d[pe>>2]=_|y&~de,d[pe+4>>2]=Ae,M=fr(Me|0,M|0,N|0,p|0)|0,A=Ur(A|0,f|0,M|0,K()|0)|0,M=0,f=K()|0;while(!1);if((q|0)>(U|0))_=~U,U=U+1|0;else{f=0;break}}return Q=ie,f|0}while(!1);if((q|0)<1)return Me=0,Q=ie,Me|0;for(y=N^15,M=1;;)if(pe=q-M|0,pe=Bo(7,0,pe,((pe|0)<0)<<31>>31)|0,Me=K()|0,U=T,p=d[U>>2]|0,U=d[U+4>>2]|0,N=(y-M|0)*3|0,_=Nt(7,0,N|0)|0,U=U&~(K()|0),de=ko(A|0,f|0,pe|0,Me|0)|0,Ae=K()|0,N=Nt(de|0,Ae|0,N|0)|0,U=K()|0|U,I=T,d[I>>2]=N|p&~_,d[I+4>>2]=U,Me=fr(de|0,Ae|0,pe|0,Me|0)|0,A=Ur(A|0,f|0,Me|0,K()|0)|0,f=K()|0,(q|0)<=(M|0)){f=0;break}else M=M+1|0;return Q=ie,f|0}function sl(A,f,p,_){A=A|0,f=f|0,p=p|0,_=_|0;var y=0,T=0,M=0;y=yt(f|0,p|0,52)|0,K()|0,y=y&15,(f|0)==0&(p|0)==0|((_|0)>15|(y|0)>(_|0))?(T=-1,f=-1,p=0,y=0):(f=lp(f,p,y+1|0,_)|0,M=(K()|0)&-15728641,p=Nt(_|0,0,52)|0,p=f|p,M=M|(K()|0),f=(Ci(p,M)|0)==0,T=y,f=f?-1:_,y=M),M=A,d[M>>2]=p,d[M+4>>2]=y,d[A+8>>2]=T,d[A+12>>2]=f}function Vu(A,f,p,_){A=A|0,f=f|0,p=p|0,_=_|0;var y=0,T=0;if(y=yt(A|0,f|0,52)|0,K()|0,y=y&15,T=_+8|0,d[T>>2]=y,(A|0)==0&(f|0)==0|((p|0)>15|(y|0)>(p|0))){p=_,d[p>>2]=0,d[p+4>>2]=0,d[T>>2]=-1,d[_+12>>2]=-1;return}if(A=lp(A,f,y+1|0,p)|0,T=(K()|0)&-15728641,y=Nt(p|0,0,52)|0,y=A|y,T=T|(K()|0),A=_,d[A>>2]=y,d[A+4>>2]=T,A=_+12|0,Ci(y,T)|0){d[A>>2]=p;return}else{d[A>>2]=-1;return}}function uf(A){A=A|0;var f=0,p=0,_=0,y=0,T=0,M=0,N=0,U=0,I=0;if(p=A,f=d[p>>2]|0,p=d[p+4>>2]|0,!((f|0)==0&(p|0)==0)&&(_=yt(f|0,p|0,52)|0,K()|0,_=_&15,N=Nt(1,0,(_^15)*3|0)|0,f=Xt(N|0,K()|0,f|0,p|0)|0,p=K()|0,N=A,d[N>>2]=f,d[N+4>>2]=p,N=A+8|0,M=d[N>>2]|0,!((_|0)<(M|0)))){for(U=A+12|0,T=_;;){if((T|0)==(M|0)){_=5;break}if(I=(T|0)==(d[U>>2]|0),y=(15-T|0)*3|0,_=yt(f|0,p|0,y|0)|0,K()|0,_=_&7,I&((_|0)==1&!0)){_=7;break}if(!((_|0)==7&!0)){_=10;break}if(I=Nt(1,0,y|0)|0,f=Xt(f|0,p|0,I|0,K()|0)|0,p=K()|0,I=A,d[I>>2]=f,d[I+4>>2]=p,(T|0)>(M|0))T=T+-1|0;else{_=10;break}}if((_|0)==5){I=A,d[I>>2]=0,d[I+4>>2]=0,d[N>>2]=-1,d[U>>2]=-1;return}else if((_|0)==7){M=Nt(1,0,y|0)|0,M=Xt(f|0,p|0,M|0,K()|0)|0,N=K()|0,I=A,d[I>>2]=M,d[I+4>>2]=N,d[U>>2]=T+-1;return}else if((_|0)==10)return}}function Kc(A){A=+A;var f=0;return f=A<0?A+6.283185307179586:A,+(A>=6.283185307179586?f+-6.283185307179586:f)}function Ea(A,f){return A=A|0,f=f|0,+un(+(+ee[A>>3]-+ee[f>>3]))<17453292519943298e-27?(f=+un(+(+ee[A+8>>3]-+ee[f+8>>3]))<17453292519943298e-27,f|0):(f=0,f|0)}function Xs(A,f){switch(A=+A,f=f|0,f|0){case 1:{A=A<0?A+6.283185307179586:A;break}case 2:{A=A>0?A+-6.283185307179586:A;break}}return+A}function T1(A,f){A=A|0,f=f|0;var p=0,_=0,y=0,T=0;return y=+ee[f>>3],_=+ee[A>>3],T=+Fn(+((y-_)*.5)),p=+Fn(+((+ee[f+8>>3]-+ee[A+8>>3])*.5)),p=T*T+p*(+li(+y)*+li(+_)*p),+(+Ue(+ +qn(+p),+ +qn(+(1-p)))*2)}function Zc(A,f){A=A|0,f=f|0;var p=0,_=0,y=0,T=0;return y=+ee[f>>3],_=+ee[A>>3],T=+Fn(+((y-_)*.5)),p=+Fn(+((+ee[f+8>>3]-+ee[A+8>>3])*.5)),p=T*T+p*(+li(+y)*+li(+_)*p),+(+Ue(+ +qn(+p),+ +qn(+(1-p)))*2*6371.007180918475)}function Mx(A,f){A=A|0,f=f|0;var p=0,_=0,y=0,T=0;return y=+ee[f>>3],_=+ee[A>>3],T=+Fn(+((y-_)*.5)),p=+Fn(+((+ee[f+8>>3]-+ee[A+8>>3])*.5)),p=T*T+p*(+li(+y)*+li(+_)*p),+(+Ue(+ +qn(+p),+ +qn(+(1-p)))*2*6371.007180918475*1e3)}function Ex(A,f){A=A|0,f=f|0;var p=0,_=0,y=0,T=0,M=0;return T=+ee[f>>3],_=+li(+T),y=+ee[f+8>>3]-+ee[A+8>>3],M=_*+Fn(+y),p=+ee[A>>3],+ +Ue(+M,+(+Fn(+T)*+li(+p)-+li(+y)*(_*+Fn(+p))))}function Cx(A,f,p,_){A=A|0,f=+f,p=+p,_=_|0;var y=0,T=0,M=0,N=0;if(p<1e-16){d[_>>2]=d[A>>2],d[_+4>>2]=d[A+4>>2],d[_+8>>2]=d[A+8>>2],d[_+12>>2]=d[A+12>>2];return}T=f<0?f+6.283185307179586:f,T=f>=6.283185307179586?T+-6.283185307179586:T;do if(T<1e-16)f=+ee[A>>3]+p,ee[_>>3]=f,y=_;else{if(y=+un(+(T+-3.141592653589793))<1e-16,f=+ee[A>>3],y){f=f-p,ee[_>>3]=f,y=_;break}if(M=+li(+p),p=+Fn(+p),f=M*+Fn(+f)+ +li(+T)*(p*+li(+f)),f=f>1?1:f,f=+Ul(+(f<-1?-1:f)),ee[_>>3]=f,+un(+(f+-1.5707963267948966))<1e-16){ee[_>>3]=1.5707963267948966,ee[_+8>>3]=0;return}if(+un(+(f+1.5707963267948966))<1e-16){ee[_>>3]=-1.5707963267948966,ee[_+8>>3]=0;return}if(N=1/+li(+f),T=p*+Fn(+T)*N,p=+ee[A>>3],f=N*((M-+Fn(+f)*+Fn(+p))/+li(+p)),M=T>1?1:T,f=f>1?1:f,f=+ee[A+8>>3]+ +Ue(+(M<-1?-1:M),+(f<-1?-1:f)),f>3.141592653589793)do f=f+-6.283185307179586;while(f>3.141592653589793);if(f<-3.141592653589793)do f=f+6.283185307179586;while(f<-3.141592653589793);ee[_+8>>3]=f;return}while(!1);if(+un(+(f+-1.5707963267948966))<1e-16){ee[y>>3]=1.5707963267948966,ee[_+8>>3]=0;return}if(+un(+(f+1.5707963267948966))<1e-16){ee[y>>3]=-1.5707963267948966,ee[_+8>>3]=0;return}if(f=+ee[A+8>>3],f>3.141592653589793)do f=f+-6.283185307179586;while(f>3.141592653589793);if(f<-3.141592653589793)do f=f+6.283185307179586;while(f<-3.141592653589793);ee[_+8>>3]=f}function dp(A,f){return A=A|0,f=f|0,A>>>0>15?(f=4,f|0):(ee[f>>3]=+ee[20656+(A<<3)>>3],f=0,f|0)}function w1(A,f){return A=A|0,f=f|0,A>>>0>15?(f=4,f|0):(ee[f>>3]=+ee[20784+(A<<3)>>3],f=0,f|0)}function pp(A,f){return A=A|0,f=f|0,A>>>0>15?(f=4,f|0):(ee[f>>3]=+ee[20912+(A<<3)>>3],f=0,f|0)}function oo(A,f){return A=A|0,f=f|0,A>>>0>15?(f=4,f|0):(ee[f>>3]=+ee[21040+(A<<3)>>3],f=0,f|0)}function Hu(A,f){A=A|0,f=f|0;var p=0;return A>>>0>15?(f=4,f|0):(p=Bo(7,0,A,((A|0)<0)<<31>>31)|0,p=fr(p|0,K()|0,120,0)|0,A=K()|0,d[f>>2]=p|2,d[f+4>>2]=A,f=0,f|0)}function da(A,f,p){A=A|0,f=f|0,p=p|0;var _=0,y=0,T=0,M=0,N=0,U=0,I=0,q=0,ie=0,de=0;return de=+ee[f>>3],q=+ee[A>>3],U=+Fn(+((de-q)*.5)),T=+ee[f+8>>3],I=+ee[A+8>>3],M=+Fn(+((T-I)*.5)),N=+li(+q),ie=+li(+de),M=U*U+M*(ie*N*M),M=+Ue(+ +qn(+M),+ +qn(+(1-M)))*2,U=+ee[p>>3],de=+Fn(+((U-de)*.5)),_=+ee[p+8>>3],T=+Fn(+((_-T)*.5)),y=+li(+U),T=de*de+T*(ie*y*T),T=+Ue(+ +qn(+T),+ +qn(+(1-T)))*2,U=+Fn(+((q-U)*.5)),_=+Fn(+((I-_)*.5)),_=U*U+_*(N*y*_),_=+Ue(+ +qn(+_),+ +qn(+(1-_)))*2,y=(M+T+_)*.5,+(+ae(+ +qn(+(+cs(+(y*.5))*+cs(+((y-M)*.5))*+cs(+((y-T)*.5))*+cs(+((y-_)*.5)))))*4)}function Fl(A,f,p){A=A|0,f=f|0,p=p|0;var _=0,y=0,T=0,M=0,N=0;if(N=Q,Q=Q+192|0,T=N+168|0,M=N,y=Ol(A,f,T)|0,y|0)return p=y,Q=N,p|0;if(Il(A,f,M)|0&&Ut(27795,27190,415,27199),f=d[M>>2]|0,(f|0)>0){if(_=+da(M+8|0,M+8+(((f|0)!=1&1)<<4)|0,T)+0,(f|0)!=1){A=1;do y=A,A=A+1|0,_=_+ +da(M+8+(y<<4)|0,M+8+(((A|0)%(f|0)|0)<<4)|0,T);while((A|0)<(f|0))}}else _=0;return ee[p>>3]=_,p=0,Q=N,p|0}function mp(A,f,p){return A=A|0,f=f|0,p=p|0,A=Fl(A,f,p)|0,A|0||(ee[p>>3]=+ee[p>>3]*6371.007180918475*6371.007180918475),A|0}function UA(A,f,p){return A=A|0,f=f|0,p=p|0,A=Fl(A,f,p)|0,A|0||(ee[p>>3]=+ee[p>>3]*6371.007180918475*6371.007180918475*1e3*1e3),A|0}function BA(A,f,p){A=A|0,f=f|0,p=p|0;var _=0,y=0,T=0,M=0,N=0,U=0,I=0,q=0;if(N=Q,Q=Q+176|0,M=N,A=CA(A,f,M)|0,A|0)return M=A,Q=N,M|0;if(ee[p>>3]=0,A=d[M>>2]|0,(A|0)<=1)return M=0,Q=N,M|0;f=A+-1|0,A=0,_=+ee[M+8>>3],y=+ee[M+16>>3],T=0;do A=A+1|0,I=_,_=+ee[M+8+(A<<4)>>3],q=+Fn(+((_-I)*.5)),U=y,y=+ee[M+8+(A<<4)+8>>3],U=+Fn(+((y-U)*.5)),U=q*q+U*(+li(+_)*+li(+I)*U),T=T+ +Ue(+ +qn(+U),+ +qn(+(1-U)))*2;while((A|0)<(f|0));return ee[p>>3]=T,M=0,Q=N,M|0}function gp(A,f,p){A=A|0,f=f|0,p=p|0;var _=0,y=0,T=0,M=0,N=0,U=0,I=0,q=0;if(N=Q,Q=Q+176|0,M=N,A=CA(A,f,M)|0,A|0)return M=A,T=+ee[p>>3],T=T*6371.007180918475,ee[p>>3]=T,Q=N,M|0;if(ee[p>>3]=0,A=d[M>>2]|0,(A|0)<=1)return M=0,T=0,T=T*6371.007180918475,ee[p>>3]=T,Q=N,M|0;f=A+-1|0,A=0,_=+ee[M+8>>3],y=+ee[M+16>>3],T=0;do A=A+1|0,I=_,_=+ee[M+8+(A<<4)>>3],q=+Fn(+((_-I)*.5)),U=y,y=+ee[M+8+(A<<4)+8>>3],U=+Fn(+((y-U)*.5)),U=q*q+U*(+li(+I)*+li(+_)*U),T=T+ +Ue(+ +qn(+U),+ +qn(+(1-U)))*2;while((A|0)!=(f|0));return ee[p>>3]=T,M=0,q=T,q=q*6371.007180918475,ee[p>>3]=q,Q=N,M|0}function ju(A,f,p){A=A|0,f=f|0,p=p|0;var _=0,y=0,T=0,M=0,N=0,U=0,I=0,q=0;if(N=Q,Q=Q+176|0,M=N,A=CA(A,f,M)|0,A|0)return M=A,T=+ee[p>>3],T=T*6371.007180918475,T=T*1e3,ee[p>>3]=T,Q=N,M|0;if(ee[p>>3]=0,A=d[M>>2]|0,(A|0)<=1)return M=0,T=0,T=T*6371.007180918475,T=T*1e3,ee[p>>3]=T,Q=N,M|0;f=A+-1|0,A=0,_=+ee[M+8>>3],y=+ee[M+16>>3],T=0;do A=A+1|0,I=_,_=+ee[M+8+(A<<4)>>3],q=+Fn(+((_-I)*.5)),U=y,y=+ee[M+8+(A<<4)+8>>3],U=+Fn(+((y-U)*.5)),U=q*q+U*(+li(+I)*+li(+_)*U),T=T+ +Ue(+ +qn(+U),+ +qn(+(1-U)))*2;while((A|0)!=(f|0));return ee[p>>3]=T,M=0,q=T,q=q*6371.007180918475,q=q*1e3,ee[p>>3]=q,Q=N,M|0}function M1(A){A=A|0;var f=0,p=0,_=0;return f=Ks(1,12)|0,f||Ut(27280,27235,49,27293),p=A+4|0,_=d[p>>2]|0,_|0?(_=_+8|0,d[_>>2]=f,d[p>>2]=f,f|0):(d[A>>2]|0&&Ut(27310,27235,61,27333),_=A,d[_>>2]=f,d[p>>2]=f,f|0)}function OA(A,f){A=A|0,f=f|0;var p=0,_=0;return _=Fo(24)|0,_||Ut(27347,27235,78,27361),d[_>>2]=d[f>>2],d[_+4>>2]=d[f+4>>2],d[_+8>>2]=d[f+8>>2],d[_+12>>2]=d[f+12>>2],d[_+16>>2]=0,f=A+4|0,p=d[f>>2]|0,p|0?(d[p+16>>2]=_,d[f>>2]=_,_|0):(d[A>>2]|0&&Ut(27376,27235,82,27361),d[A>>2]=_,d[f>>2]=_,_|0)}function Wu(A){A=A|0;var f=0,p=0,_=0,y=0;if(A)for(_=1;;){if(f=d[A>>2]|0,f|0)do{if(p=d[f>>2]|0,p|0)do y=p,p=d[p+16>>2]|0,An(y);while((p|0)!=0);y=f,f=d[f+8>>2]|0,An(y)}while((f|0)!=0);if(f=A,A=d[A+8>>2]|0,_||An(f),A)_=0;else break}}function Rx(A){A=A|0;var f=0,p=0,_=0,y=0,T=0,M=0,N=0,U=0,I=0,q=0,ie=0,de=0,Ae=0,pe=0,Me=0,Le=0,Ye=0,qe=0,Fe=0,Ee=0,Pt=0,nn=0,Jt=0,Un=0,En=0,Qn=0,Tn=0,an=0,Lt=0,vn=0,ii=0,wn=0;if(y=A+8|0,d[y>>2]|0)return wn=1,wn|0;if(_=d[A>>2]|0,!_)return wn=0,wn|0;f=_,p=0;do p=p+1|0,f=d[f+8>>2]|0;while((f|0)!=0);if(p>>>0<2)return wn=0,wn|0;vn=Fo(p<<2)|0,vn||Ut(27396,27235,317,27415),Lt=Fo(p<<5)|0,Lt||Ut(27437,27235,321,27415),d[A>>2]=0,nn=A+4|0,d[nn>>2]=0,d[y>>2]=0,p=0,an=0,Pt=0,ie=0;e:for(;;){if(q=d[_>>2]|0,q){T=0,M=q;do{if(U=+ee[M+8>>3],f=M,M=d[M+16>>2]|0,I=(M|0)==0,y=I?q:M,N=+ee[y+8>>3],+un(+(U-N))>3.141592653589793){wn=14;break}T=T+(N-U)*(+ee[f>>3]+ +ee[y>>3])}while(!I);if((wn|0)==14){wn=0,T=0,f=q;do Ee=+ee[f+8>>3],Tn=f+16|0,Qn=d[Tn>>2]|0,Qn=(Qn|0)==0?q:Qn,Fe=+ee[Qn+8>>3],T=T+(+ee[f>>3]+ +ee[Qn>>3])*((Fe<0?Fe+6.283185307179586:Fe)-(Ee<0?Ee+6.283185307179586:Ee)),f=d[((f|0)==0?_:Tn)>>2]|0;while((f|0)!=0)}T>0?(d[vn+(an<<2)>>2]=_,an=an+1|0,y=Pt,f=ie):wn=19}else wn=19;if((wn|0)==19){wn=0;do if(p){if(f=p+8|0,d[f>>2]|0){wn=21;break e}if(p=Ks(1,12)|0,!p){wn=23;break e}d[f>>2]=p,y=p+4|0,M=p,f=ie}else if(ie){y=nn,M=ie+8|0,f=_,p=A;break}else if(d[A>>2]|0){wn=27;break e}else{y=nn,M=A,f=_,p=A;break}while(!1);if(d[M>>2]=_,d[y>>2]=_,M=Lt+(Pt<<5)|0,I=d[_>>2]|0,I){for(q=Lt+(Pt<<5)+8|0,ee[q>>3]=17976931348623157e292,ie=Lt+(Pt<<5)+24|0,ee[ie>>3]=17976931348623157e292,ee[M>>3]=-17976931348623157e292,de=Lt+(Pt<<5)+16|0,ee[de>>3]=-17976931348623157e292,Ye=17976931348623157e292,qe=-17976931348623157e292,y=0,Ae=I,U=17976931348623157e292,Me=17976931348623157e292,Le=-17976931348623157e292,N=-17976931348623157e292;T=+ee[Ae>>3],Ee=+ee[Ae+8>>3],Ae=d[Ae+16>>2]|0,pe=(Ae|0)==0,Fe=+ee[(pe?I:Ae)+8>>3],T>3]=T,U=T),Ee>3]=Ee,Me=Ee),T>Le?ee[M>>3]=T:T=Le,Ee>N&&(ee[de>>3]=Ee,N=Ee),Ye=Ee>0&Eeqe?Ee:qe,y=y|+un(+(Ee-Fe))>3.141592653589793,!pe;)Le=T;y&&(ee[de>>3]=qe,ee[ie>>3]=Ye)}else d[M>>2]=0,d[M+4>>2]=0,d[M+8>>2]=0,d[M+12>>2]=0,d[M+16>>2]=0,d[M+20>>2]=0,d[M+24>>2]=0,d[M+28>>2]=0;y=Pt+1|0}if(Tn=_+8|0,_=d[Tn>>2]|0,d[Tn>>2]=0,_)Pt=y,ie=f;else{wn=45;break}}if((wn|0)==21)Ut(27213,27235,35,27247);else if((wn|0)==23)Ut(27267,27235,37,27247);else if((wn|0)==27)Ut(27310,27235,61,27333);else if((wn|0)==45){e:do if((an|0)>0){for(Tn=(y|0)==0,En=y<<2,Qn=(A|0)==0,Un=0,f=0;;){if(Jt=d[vn+(Un<<2)>>2]|0,Tn)wn=73;else{if(Pt=Fo(En)|0,!Pt){wn=50;break}if(nn=Fo(En)|0,!nn){wn=52;break}t:do if(Qn)p=0;else{for(y=0,p=0,M=A;_=Lt+(y<<5)|0,Ys(d[M>>2]|0,_,d[Jt>>2]|0)|0?(d[Pt+(p<<2)>>2]=M,d[nn+(p<<2)>>2]=_,pe=p+1|0):pe=p,M=d[M+8>>2]|0,M;)y=y+1|0,p=pe;if((pe|0)>0)if(_=d[Pt>>2]|0,(pe|0)==1)p=_;else for(de=0,Ae=-1,p=_,ie=_;;){for(I=d[ie>>2]|0,_=0,M=0;y=d[d[Pt+(M<<2)>>2]>>2]|0,(y|0)==(I|0)?q=_:q=_+((Ys(y,d[nn+(M<<2)>>2]|0,d[I>>2]|0)|0)&1)|0,M=M+1|0,(M|0)!=(pe|0);)_=q;if(y=(q|0)>(Ae|0),p=y?ie:p,_=de+1|0,(_|0)==(pe|0))break t;de=_,Ae=y?q:Ae,ie=d[Pt+(_<<2)>>2]|0}else p=0}while(!1);if(An(Pt),An(nn),p){if(y=p+4|0,_=d[y>>2]|0,_)p=_+8|0;else if(d[p>>2]|0){wn=70;break}d[p>>2]=Jt,d[y>>2]=Jt}else wn=73}if((wn|0)==73){if(wn=0,f=d[Jt>>2]|0,f|0)do nn=f,f=d[f+16>>2]|0,An(nn);while((f|0)!=0);An(Jt),f=1}if(Un=Un+1|0,(Un|0)>=(an|0)){ii=f;break e}}(wn|0)==50?Ut(27452,27235,249,27471):(wn|0)==52?Ut(27490,27235,252,27471):(wn|0)==70&&Ut(27310,27235,61,27333)}else ii=0;while(!1);return An(vn),An(Lt),wn=ii,wn|0}return 0}function Ys(A,f,p){A=A|0,f=f|0,p=p|0;var _=0,y=0,T=0,M=0,N=0,U=0,I=0,q=0;if(!(Lo(f,p)|0)||(f=TA(f)|0,_=+ee[p>>3],y=+ee[p+8>>3],y=f&y<0?y+6.283185307179586:y,A=d[A>>2]|0,!A))return A=0,A|0;if(f){f=0,I=y,p=A;e:for(;;){for(;M=+ee[p>>3],y=+ee[p+8>>3],p=p+16|0,q=d[p>>2]|0,q=(q|0)==0?A:q,T=+ee[q>>3],N=+ee[q+8>>3],M>T?(U=M,M=N):(U=T,T=M,M=y,y=N),_=_==T|_==U?_+2220446049250313e-31:_,!!(_U);)if(p=d[p>>2]|0,!p){p=22;break e}if(N=M<0?M+6.283185307179586:M,M=y<0?y+6.283185307179586:y,I=N==I|M==I?I+-2220446049250313e-31:I,U=N+(M-N)*((_-T)/(U-T)),(U<0?U+6.283185307179586:U)>I&&(f=f^1),p=d[p>>2]|0,!p){p=22;break}}if((p|0)==22)return f|0}else{f=0,I=y,p=A;e:for(;;){for(;M=+ee[p>>3],y=+ee[p+8>>3],p=p+16|0,q=d[p>>2]|0,q=(q|0)==0?A:q,T=+ee[q>>3],N=+ee[q+8>>3],M>T?(U=M,M=N):(U=T,T=M,M=y,y=N),_=_==T|_==U?_+2220446049250313e-31:_,!!(_U);)if(p=d[p>>2]|0,!p){p=22;break e}if(I=M==I|y==I?I+-2220446049250313e-31:I,M+(y-M)*((_-T)/(U-T))>I&&(f=f^1),p=d[p>>2]|0,!p){p=22;break}}if((p|0)==22)return f|0}return 0}function lo(A,f,p,_,y){A=A|0,f=f|0,p=p|0,_=_|0,y=y|0;var T=0,M=0,N=0,U=0,I=0,q=0,ie=0,de=0,Ae=0,pe=0,Me=0,Le=0,Ye=0,qe=0;if(qe=Q,Q=Q+32|0,Ye=qe+16|0,Le=qe,T=yt(A|0,f|0,52)|0,K()|0,T=T&15,Ae=yt(p|0,_|0,52)|0,K()|0,(T|0)!=(Ae&15|0))return Ye=12,Q=qe,Ye|0;if(I=yt(A|0,f|0,45)|0,K()|0,I=I&127,q=yt(p|0,_|0,45)|0,K()|0,q=q&127,I>>>0>121|q>>>0>121)return Ye=5,Q=qe,Ye|0;if(Ae=(I|0)!=(q|0),Ae){if(N=Jh(I,q)|0,(N|0)==7)return Ye=1,Q=qe,Ye|0;U=Jh(q,I)|0,(U|0)==7?Ut(27514,27538,161,27548):(pe=N,M=U)}else pe=0,M=0;ie=Bi(I)|0,de=Bi(q)|0,d[Ye>>2]=0,d[Ye+4>>2]=0,d[Ye+8>>2]=0,d[Ye+12>>2]=0;do if(pe){if(q=d[4272+(I*28|0)+(pe<<2)>>2]|0,N=(q|0)>0,de)if(N){I=0,U=p,N=_;do U=Tx(U,N)|0,N=K()|0,M=rl(M)|0,(M|0)==1&&(M=rl(1)|0),I=I+1|0;while((I|0)!=(q|0));q=M,I=U,U=N}else q=M,I=p,U=_;else if(N){I=0,U=p,N=_;do U=hp(U,N)|0,N=K()|0,M=rl(M)|0,I=I+1|0;while((I|0)!=(q|0));q=M,I=U,U=N}else q=M,I=p,U=_;if(LA(I,U,Ye)|0,Ae||Ut(27563,27538,191,27548),N=(ie|0)!=0,M=(de|0)!=0,N&M&&Ut(27590,27538,192,27548),N){if(M=$s(A,f)|0,(M|0)==7){T=5;break}if(at[22e3+(M*7|0)+pe>>0]|0){T=1;break}U=d[21168+(M*28|0)+(pe<<2)>>2]|0,I=U}else if(M){if(M=$s(I,U)|0,(M|0)==7){T=5;break}if(at[22e3+(M*7|0)+q>>0]|0){T=1;break}I=0,U=d[21168+(q*28|0)+(M<<2)>>2]|0}else I=0,U=0;if((I|U|0)<0)T=5;else{if((U|0)>0){N=Ye+4|0,M=0;do EA(N),M=M+1|0;while((M|0)!=(U|0))}if(d[Le>>2]=0,d[Le+4>>2]=0,d[Le+8>>2]=0,u1(Le,pe),T|0)for(;Ss(T)|0?Yc(Le):Lu(Le),(T|0)>1;)T=T+-1|0;if((I|0)>0){T=0;do EA(Le),T=T+1|0;while((T|0)!=(I|0))}Me=Ye+4|0,hs(Me,Le,Me),Lr(Me),Me=51}}else if(LA(p,_,Ye)|0,(ie|0)!=0&(de|0)!=0)if((q|0)!=(I|0)&&Ut(27621,27538,261,27548),M=$s(A,f)|0,T=$s(p,_)|0,(M|0)==7|(T|0)==7)T=5;else if(at[22e3+(M*7|0)+T>>0]|0)T=1;else if(M=d[21168+(M*28|0)+(T<<2)>>2]|0,(M|0)>0){N=Ye+4|0,T=0;do EA(N),T=T+1|0;while((T|0)!=(M|0));Me=51}else Me=51;else Me=51;while(!1);return(Me|0)==51&&(T=Ye+4|0,d[y>>2]=d[T>>2],d[y+4>>2]=d[T+4>>2],d[y+8>>2]=d[T+8>>2],T=0),Ye=T,Q=qe,Ye|0}function Uo(A,f,p,_){A=A|0,f=f|0,p=p|0,_=_|0;var y=0,T=0,M=0,N=0,U=0,I=0,q=0,ie=0,de=0,Ae=0,pe=0,Me=0,Le=0,Ye=0,qe=0,Fe=0;if(Me=Q,Q=Q+48|0,I=Me+36|0,M=Me+24|0,N=Me+12|0,U=Me,y=yt(A|0,f|0,52)|0,K()|0,y=y&15,de=yt(A|0,f|0,45)|0,K()|0,de=de&127,de>>>0>121)return _=5,Q=Me,_|0;if(q=Bi(de)|0,Nt(y|0,0,52)|0,Le=K()|0|134225919,T=_,d[T>>2]=-1,d[T+4>>2]=Le,!y)return y=Pu(p)|0,(y|0)==7||(y=SA(de,y)|0,(y|0)==127)?(Le=1,Q=Me,Le|0):(Ae=Nt(y|0,0,45)|0,pe=K()|0,de=_,pe=d[de+4>>2]&-1040385|pe,Le=_,d[Le>>2]=d[de>>2]|Ae,d[Le+4>>2]=pe,Le=0,Q=Me,Le|0);for(d[I>>2]=d[p>>2],d[I+4>>2]=d[p+4>>2],d[I+8>>2]=d[p+8>>2],p=y;;){if(T=p,p=p+-1|0,d[M>>2]=d[I>>2],d[M+4>>2]=d[I+4>>2],d[M+8>>2]=d[I+8>>2],Ss(T)|0){if(y=o1(I)|0,y|0){p=13;break}d[N>>2]=d[I>>2],d[N+4>>2]=d[I+4>>2],d[N+8>>2]=d[I+8>>2],Yc(N)}else{if(y=cx(I)|0,y|0){p=13;break}d[N>>2]=d[I>>2],d[N+4>>2]=d[I+4>>2],d[N+8>>2]=d[I+8>>2],Lu(N)}if(af(M,N,U),Lr(U),y=_,qe=d[y>>2]|0,y=d[y+4>>2]|0,Fe=(15-T|0)*3|0,Ye=Nt(7,0,Fe|0)|0,y=y&~(K()|0),Fe=Nt(Pu(U)|0,0,Fe|0)|0,y=K()|0|y,Le=_,d[Le>>2]=Fe|qe&~Ye,d[Le+4>>2]=y,(T|0)<=1){p=14;break}}e:do if((p|0)!=13&&(p|0)==14)if((d[I>>2]|0)<=1&&(d[I+4>>2]|0)<=1&&(d[I+8>>2]|0)<=1){p=Pu(I)|0,y=SA(de,p)|0,(y|0)==127?U=0:U=Bi(y)|0;t:do if(p){if(q){if(y=$s(A,f)|0,(y|0)==7){y=5;break e}if(T=d[21376+(y*28|0)+(p<<2)>>2]|0,(T|0)>0){y=p,p=0;do y=Uu(y)|0,p=p+1|0;while((p|0)!=(T|0))}else y=p;if((y|0)==1){y=9;break e}p=SA(de,y)|0,(p|0)==127&&Ut(27648,27538,411,27678),Bi(p)|0?Ut(27693,27538,412,27678):(pe=p,Ae=T,ie=y)}else pe=y,Ae=0,ie=p;if(N=d[4272+(de*28|0)+(ie<<2)>>2]|0,(N|0)<=-1&&Ut(27724,27538,419,27678),!U){if((Ae|0)<0){y=5;break e}if(Ae|0){T=_,y=0,p=d[T>>2]|0,T=d[T+4>>2]|0;do p=ku(p,T)|0,T=K()|0,Fe=_,d[Fe>>2]=p,d[Fe+4>>2]=T,y=y+1|0;while((y|0)<(Ae|0))}if((N|0)<=0){y=pe,p=58;break}for(T=_,y=0,p=d[T>>2]|0,T=d[T+4>>2]|0;;)if(p=ku(p,T)|0,T=K()|0,Fe=_,d[Fe>>2]=p,d[Fe+4>>2]=T,y=y+1|0,(y|0)==(N|0)){y=pe,p=58;break t}}if(M=Jh(pe,de)|0,(M|0)==7&&Ut(27514,27538,428,27678),y=_,p=d[y>>2]|0,y=d[y+4>>2]|0,(N|0)>0){T=0;do p=ku(p,y)|0,y=K()|0,Fe=_,d[Fe>>2]=p,d[Fe+4>>2]=y,T=T+1|0;while((T|0)!=(N|0))}if(y=$s(p,y)|0,(y|0)==7&&Ut(27795,27538,440,27678),p=Wc(pe)|0,p=d[(p?21792:21584)+(M*28|0)+(y<<2)>>2]|0,(p|0)<0&&Ut(27795,27538,454,27678),!p)y=pe,p=58;else{M=_,y=0,T=d[M>>2]|0,M=d[M+4>>2]|0;do T=cp(T,M)|0,M=K()|0,Fe=_,d[Fe>>2]=T,d[Fe+4>>2]=M,y=y+1|0;while((y|0)<(p|0));y=pe,p=58}}else if((q|0)!=0&(U|0)!=0){if(p=$s(A,f)|0,T=_,T=$s(d[T>>2]|0,d[T+4>>2]|0)|0,(p|0)==7|(T|0)==7){y=5;break e}if(T=d[21376+(p*28|0)+(T<<2)>>2]|0,(T|0)<0){y=5;break e}if(!T)p=59;else{N=_,p=0,M=d[N>>2]|0,N=d[N+4>>2]|0;do M=ku(M,N)|0,N=K()|0,Fe=_,d[Fe>>2]=M,d[Fe+4>>2]=N,p=p+1|0;while((p|0)<(T|0));p=58}}else p=58;while(!1);if((p|0)==58&&U&&(p=59),(p|0)==59&&(Fe=_,($s(d[Fe>>2]|0,d[Fe+4>>2]|0)|0)==1)){y=9;break}Fe=_,Ye=d[Fe>>2]|0,Fe=d[Fe+4>>2]&-1040385,qe=Nt(y|0,0,45)|0,Fe=Fe|(K()|0),y=_,d[y>>2]=Ye|qe,d[y+4>>2]=Fe,y=0}else y=1;while(!1);return Fe=y,Q=Me,Fe|0}function E1(A,f,p,_,y,T){A=A|0,f=f|0,p=p|0,_=_|0,y=y|0,T=T|0;var M=0,N=0;return N=Q,Q=Q+16|0,M=N,y?A=15:(A=lo(A,f,p,_,M)|0,A||(fx(M,T),A=0)),Q=N,A|0}function IA(A,f,p,_,y){A=A|0,f=f|0,p=p|0,_=_|0,y=y|0;var T=0,M=0;return M=Q,Q=Q+16|0,T=M,_?p=15:(p=rp(p,T)|0,p||(p=Uo(A,f,T,y)|0)),Q=M,p|0}function $u(A,f,p,_,y){A=A|0,f=f|0,p=p|0,_=_|0,y=y|0;var T=0,M=0,N=0,U=0;return U=Q,Q=Q+32|0,M=U+12|0,N=U,T=lo(A,f,A,f,M)|0,T|0?(N=T,Q=U,N|0):(A=lo(A,f,p,_,N)|0,A|0?(N=A,Q=U,N|0):(M=ip(M,N)|0,N=y,d[N>>2]=M,d[N+4>>2]=((M|0)<0)<<31>>31,N=0,Q=U,N|0))}function vp(A,f,p,_,y){A=A|0,f=f|0,p=p|0,_=_|0,y=y|0;var T=0,M=0,N=0,U=0;return U=Q,Q=Q+32|0,M=U+12|0,N=U,T=lo(A,f,A,f,M)|0,!T&&(T=lo(A,f,p,_,N)|0,!T)?(_=ip(M,N)|0,_=Xt(_|0,((_|0)<0)<<31>>31|0,1,0)|0,M=K()|0,N=y,d[N>>2]=_,d[N+4>>2]=M,N=0,Q=U,N|0):(N=T,Q=U,N|0)}function C1(A,f,p,_,y){A=A|0,f=f|0,p=p|0,_=_|0,y=y|0;var T=0,M=0,N=0,U=0,I=0,q=0,ie=0,de=0,Ae=0,pe=0,Me=0,Le=0,Ye=0,qe=0,Fe=0,Ee=0,Pt=0,nn=0,Jt=0,Un=0;if(Jt=Q,Q=Q+48|0,Pt=Jt+24|0,M=Jt+12|0,nn=Jt,T=lo(A,f,A,f,Pt)|0,!T&&(T=lo(A,f,p,_,M)|0,!T)){Fe=ip(Pt,M)|0,Ee=((Fe|0)<0)<<31>>31,d[Pt>>2]=0,d[Pt+4>>2]=0,d[Pt+8>>2]=0,d[M>>2]=0,d[M+4>>2]=0,d[M+8>>2]=0,lo(A,f,A,f,Pt)|0&&Ut(27795,27538,692,27747),lo(A,f,p,_,M)|0&&Ut(27795,27538,697,27747),A1(Pt),A1(M),q=(Fe|0)==0?0:1/+(Fe|0),p=d[Pt>>2]|0,Me=q*+((d[M>>2]|0)-p|0),Le=Pt+4|0,_=d[Le>>2]|0,Ye=q*+((d[M+4>>2]|0)-_|0),qe=Pt+8|0,T=d[qe>>2]|0,q=q*+((d[M+8>>2]|0)-T|0),d[nn>>2]=p,ie=nn+4|0,d[ie>>2]=_,de=nn+8|0,d[de>>2]=T;e:do if((Fe|0)<0)T=0;else for(Ae=0,pe=0;;){U=+(pe>>>0)+4294967296*+(Ae|0),Un=Me*U+ +(p|0),N=Ye*U+ +(_|0),U=q*U+ +(T|0),p=~~+hl(+Un),M=~~+hl(+N),T=~~+hl(+U),Un=+un(+(+(p|0)-Un)),N=+un(+(+(M|0)-N)),U=+un(+(+(T|0)-U));do if(Un>N&Un>U)p=0-(M+T)|0,_=M;else if(I=0-p|0,N>U){_=I-T|0;break}else{_=M,T=I-M|0;break}while(!1);if(d[nn>>2]=p,d[ie>>2]=_,d[de>>2]=T,Ax(nn),T=Uo(A,f,nn,y+(pe<<3)|0)|0,T|0)break e;if(!((Ae|0)<(Ee|0)|(Ae|0)==(Ee|0)&pe>>>0>>0)){T=0;break e}p=Xt(pe|0,Ae|0,1,0)|0,_=K()|0,Ae=_,pe=p,p=d[Pt>>2]|0,_=d[Le>>2]|0,T=d[qe>>2]|0}while(!1);return nn=T,Q=Jt,nn|0}return nn=T,Q=Jt,nn|0}function Bo(A,f,p,_){A=A|0,f=f|0,p=p|0,_=_|0;var y=0,T=0,M=0;if((p|0)==0&(_|0)==0)return y=0,T=1,ft(y|0),T|0;T=A,y=f,A=1,f=0;do M=(p&1|0)==0&!0,A=fr((M?1:T)|0,(M?0:y)|0,A|0,f|0)|0,f=K()|0,p=N1(p|0,_|0,1)|0,_=K()|0,T=fr(T|0,y|0,T|0,y|0)|0,y=K()|0;while(!((p|0)==0&(_|0)==0));return ft(f|0),A|0}function FA(A,f,p,_){A=A|0,f=f|0,p=p|0,_=_|0;var y=0,T=0,M=0,N=0,U=0,I=0,q=0;N=Q,Q=Q+16|0,T=N,M=yt(A|0,f|0,52)|0,K()|0,M=M&15;do if(M){if(y=Ol(A,f,T)|0,!y){I=+ee[T>>3],U=1/+li(+I),q=+ee[25968+(M<<3)>>3],ee[p>>3]=I+q,ee[p+8>>3]=I-q,I=+ee[T+8>>3],U=q*U,ee[p+16>>3]=U+I,ee[p+24>>3]=I-U;break}return M=y,Q=N,M|0}else{if(y=yt(A|0,f|0,45)|0,K()|0,y=y&127,y>>>0>121)return M=5,Q=N,M|0;T=22064+(y<<5)|0,d[p>>2]=d[T>>2],d[p+4>>2]=d[T+4>>2],d[p+8>>2]=d[T+8>>2],d[p+12>>2]=d[T+12>>2],d[p+16>>2]=d[T+16>>2],d[p+20>>2]=d[T+20>>2],d[p+24>>2]=d[T+24>>2],d[p+28>>2]=d[T+28>>2];break}while(!1);return Ws(p,_?1.4:1.1),_=26096+(M<<3)|0,(d[_>>2]|0)==(A|0)&&(d[_+4>>2]|0)==(f|0)&&(ee[p>>3]=1.5707963267948966),M=26224+(M<<3)|0,(d[M>>2]|0)==(A|0)&&(d[M+4>>2]|0)==(f|0)&&(ee[p+8>>3]=-1.5707963267948966),+ee[p>>3]!=1.5707963267948966&&+ee[p+8>>3]!=-1.5707963267948966?(M=0,Q=N,M|0):(ee[p+16>>3]=3.141592653589793,ee[p+24>>3]=-3.141592653589793,M=0,Q=N,M|0)}function Ca(A,f,p,_){A=A|0,f=f|0,p=p|0,_=_|0;var y=0,T=0,M=0,N=0,U=0,I=0,q=0;I=Q,Q=Q+48|0,M=I+32|0,T=I+40|0,N=I,Iu(M,0,0,0),U=d[M>>2]|0,M=d[M+4>>2]|0;do if(p>>>0<=15){if(y=Ra(_)|0,y|0){_=N,d[_>>2]=0,d[_+4>>2]=0,d[N+8>>2]=y,d[N+12>>2]=-1,_=N+16|0,U=N+29|0,d[_>>2]=0,d[_+4>>2]=0,d[_+8>>2]=0,at[_+12>>0]=0,at[U>>0]=at[T>>0]|0,at[U+1>>0]=at[T+1>>0]|0,at[U+2>>0]=at[T+2>>0]|0;break}if(y=Ks((d[f+8>>2]|0)+1|0,32)|0,y){Na(f,y),q=N,d[q>>2]=U,d[q+4>>2]=M,d[N+8>>2]=0,d[N+12>>2]=p,d[N+16>>2]=_,d[N+20>>2]=f,d[N+24>>2]=y,at[N+28>>0]=0,U=N+29|0,at[U>>0]=at[T>>0]|0,at[U+1>>0]=at[T+1>>0]|0,at[U+2>>0]=at[T+2>>0]|0;break}else{_=N,d[_>>2]=0,d[_+4>>2]=0,d[N+8>>2]=13,d[N+12>>2]=-1,_=N+16|0,U=N+29|0,d[_>>2]=0,d[_+4>>2]=0,d[_+8>>2]=0,at[_+12>>0]=0,at[U>>0]=at[T>>0]|0,at[U+1>>0]=at[T+1>>0]|0,at[U+2>>0]=at[T+2>>0]|0;break}}else U=N,d[U>>2]=0,d[U+4>>2]=0,d[N+8>>2]=4,d[N+12>>2]=-1,U=N+16|0,q=N+29|0,d[U>>2]=0,d[U+4>>2]=0,d[U+8>>2]=0,at[U+12>>0]=0,at[q>>0]=at[T>>0]|0,at[q+1>>0]=at[T+1>>0]|0,at[q+2>>0]=at[T+2>>0]|0;while(!1);al(N),d[A>>2]=d[N>>2],d[A+4>>2]=d[N+4>>2],d[A+8>>2]=d[N+8>>2],d[A+12>>2]=d[N+12>>2],d[A+16>>2]=d[N+16>>2],d[A+20>>2]=d[N+20>>2],d[A+24>>2]=d[N+24>>2],d[A+28>>2]=d[N+28>>2],Q=I}function al(A){A=A|0;var f=0,p=0,_=0,y=0,T=0,M=0,N=0,U=0,I=0,q=0,ie=0,de=0,Ae=0,pe=0,Me=0,Le=0,Ye=0,qe=0,Fe=0,Ee=0;if(Ee=Q,Q=Q+336|0,Ae=Ee+168|0,pe=Ee,_=A,p=d[_>>2]|0,_=d[_+4>>2]|0,(p|0)==0&(_|0)==0){Q=Ee;return}if(f=A+28|0,at[f>>0]|0?(p=Xu(p,_)|0,_=K()|0):at[f>>0]=1,Fe=A+20|0,!(d[d[Fe>>2]>>2]|0)){f=A+24|0,p=d[f>>2]|0,p|0&&An(p),qe=A,d[qe>>2]=0,d[qe+4>>2]=0,d[A+8>>2]=0,d[Fe>>2]=0,d[A+12>>2]=-1,d[A+16>>2]=0,d[f>>2]=0,Q=Ee;return}qe=A+16|0,f=d[qe>>2]|0,y=f&15;e:do if((p|0)==0&(_|0)==0)Ye=A+24|0;else{Me=A+12|0,ie=(y|0)==3,q=f&255,U=(y|1|0)==3,de=A+24|0,I=(y+-1|0)>>>0<3,M=(y|2|0)==3,N=pe+8|0;t:for(;;){if(T=yt(p|0,_|0,52)|0,K()|0,T=T&15,(T|0)==(d[Me>>2]|0)){switch(q&15){case 0:case 2:case 3:{if(y=Ol(p,_,Ae)|0,y|0){Le=15;break t}if(Da(d[Fe>>2]|0,d[de>>2]|0,Ae)|0){Le=19;break t}break}}if(U&&(y=d[(d[Fe>>2]|0)+4>>2]|0,d[Ae>>2]=d[y>>2],d[Ae+4>>2]=d[y+4>>2],d[Ae+8>>2]=d[y+8>>2],d[Ae+12>>2]=d[y+12>>2],Lo(26832,Ae)|0)){if(PA(d[(d[Fe>>2]|0)+4>>2]|0,T,pe)|0){Le=25;break}if(y=pe,(d[y>>2]|0)==(p|0)&&(d[y+4>>2]|0)==(_|0)){Le=29;break}}if(I){if(y=Il(p,_,Ae)|0,y|0){Le=32;break}if(FA(p,_,pe,0)|0){Le=36;break}if(M&&Oo(d[Fe>>2]|0,d[de>>2]|0,Ae,pe)|0){Le=42;break}if(U&&zA(d[Fe>>2]|0,d[de>>2]|0,Ae,pe)|0){Le=42;break}}if(ie){if(f=FA(p,_,Ae,1)|0,y=d[de>>2]|0,f|0){Le=45;break}if(nf(y,Ae)|0){if(rf(pe,Ae),np(Ae,d[de>>2]|0)|0){Le=53;break}if(Da(d[Fe>>2]|0,d[de>>2]|0,N)|0){Le=53;break}if(zA(d[Fe>>2]|0,d[de>>2]|0,pe,Ae)|0){Le=53;break}}}}do if((T|0)<(d[Me>>2]|0)){if(f=FA(p,_,Ae,1)|0,y=d[de>>2]|0,f|0){Le=58;break t}if(!(nf(y,Ae)|0)){Le=73;break}if(np(d[de>>2]|0,Ae)|0&&(rf(pe,Ae),Oo(d[Fe>>2]|0,d[de>>2]|0,pe,Ae)|0)){Le=65;break t}if(p=DA(p,_,T+1|0,pe)|0,p|0){Le=67;break t}_=pe,p=d[_>>2]|0,_=d[_+4>>2]|0}else Le=73;while(!1);if((Le|0)==73&&(Le=0,p=Xu(p,_)|0,_=K()|0),(p|0)==0&(_|0)==0){Ye=de;break e}}switch(Le|0){case 15:{f=d[de>>2]|0,f|0&&An(f),Le=A,d[Le>>2]=0,d[Le+4>>2]=0,d[Fe>>2]=0,d[Me>>2]=-1,d[qe>>2]=0,d[de>>2]=0,d[A+8>>2]=y,Le=20;break}case 19:{d[A>>2]=p,d[A+4>>2]=_,Le=20;break}case 25:{Ut(27795,27761,470,27772);break}case 29:{d[A>>2]=p,d[A+4>>2]=_,Q=Ee;return}case 32:{f=d[de>>2]|0,f|0&&An(f),Ye=A,d[Ye>>2]=0,d[Ye+4>>2]=0,d[Fe>>2]=0,d[Me>>2]=-1,d[qe>>2]=0,d[de>>2]=0,d[A+8>>2]=y,Q=Ee;return}case 36:{Ut(27795,27761,493,27772);break}case 42:{d[A>>2]=p,d[A+4>>2]=_,Q=Ee;return}case 45:{y|0&&An(y),Le=A,d[Le>>2]=0,d[Le+4>>2]=0,d[Fe>>2]=0,d[Me>>2]=-1,d[qe>>2]=0,d[de>>2]=0,d[A+8>>2]=f,Le=55;break}case 53:{d[A>>2]=p,d[A+4>>2]=_,Le=55;break}case 58:{y|0&&An(y),Le=A,d[Le>>2]=0,d[Le+4>>2]=0,d[Fe>>2]=0,d[Me>>2]=-1,d[qe>>2]=0,d[de>>2]=0,d[A+8>>2]=f,Le=71;break}case 65:{d[A>>2]=p,d[A+4>>2]=_,Le=71;break}case 67:{f=d[de>>2]|0,f|0&&An(f),Ye=A,d[Ye>>2]=0,d[Ye+4>>2]=0,d[Fe>>2]=0,d[Me>>2]=-1,d[qe>>2]=0,d[de>>2]=0,d[A+8>>2]=p,Q=Ee;return}}if((Le|0)==20){Q=Ee;return}else if((Le|0)==55){Q=Ee;return}else if((Le|0)==71){Q=Ee;return}}while(!1);f=d[Ye>>2]|0,f|0&&An(f),Le=A,d[Le>>2]=0,d[Le+4>>2]=0,d[A+8>>2]=0,d[Fe>>2]=0,d[A+12>>2]=-1,d[qe>>2]=0,d[Ye>>2]=0,Q=Ee}function Xu(A,f){A=A|0,f=f|0;var p=0,_=0,y=0,T=0,M=0,N=0,U=0,I=0,q=0,ie=0;ie=Q,Q=Q+16|0,q=ie,_=yt(A|0,f|0,52)|0,K()|0,_=_&15,p=yt(A|0,f|0,45)|0,K()|0;do if(_){for(;p=Nt(_+4095|0,0,52)|0,y=K()|0|f&-15728641,T=(15-_|0)*3|0,M=Nt(7,0,T|0)|0,N=K()|0,p=p|A|M,y=y|N,U=yt(A|0,f|0,T|0)|0,K()|0,U=U&7,_=_+-1|0,!(U>>>0<6);)if(_)f=y,A=p;else{I=4;break}if((I|0)==4){p=yt(p|0,y|0,45)|0,K()|0;break}return q=(U|0)==0&(Ci(p,y)|0)!=0,q=Nt((q?2:1)+U|0,0,T|0)|0,I=K()|0|f&~N,q=q|A&~M,ft(I|0),Q=ie,q|0}while(!1);return p=p&127,p>>>0>120?(I=0,q=0,ft(I|0),Q=ie,q|0):(Iu(q,0,p+1|0,0),I=d[q+4>>2]|0,q=d[q>>2]|0,ft(I|0),Q=ie,q|0)}function kA(A,f,p,_,y,T){A=A|0,f=f|0,p=p|0,_=_|0,y=y|0,T=T|0;var M=0,N=0,U=0,I=0,q=0,ie=0,de=0,Ae=0,pe=0,Me=0,Le=0;Le=Q,Q=Q+160|0,ie=Le+80|0,N=Le+64|0,de=Le+112|0,Me=Le,Ca(ie,A,f,p),I=ie,sl(N,d[I>>2]|0,d[I+4>>2]|0,f),I=N,U=d[I>>2]|0,I=d[I+4>>2]|0,M=d[ie+8>>2]|0,Ae=de+4|0,d[Ae>>2]=d[ie>>2],d[Ae+4>>2]=d[ie+4>>2],d[Ae+8>>2]=d[ie+8>>2],d[Ae+12>>2]=d[ie+12>>2],d[Ae+16>>2]=d[ie+16>>2],d[Ae+20>>2]=d[ie+20>>2],d[Ae+24>>2]=d[ie+24>>2],d[Ae+28>>2]=d[ie+28>>2],Ae=Me,d[Ae>>2]=U,d[Ae+4>>2]=I,Ae=Me+8|0,d[Ae>>2]=M,A=Me+12|0,f=de,p=A+36|0;do d[A>>2]=d[f>>2],A=A+4|0,f=f+4|0;while((A|0)<(p|0));if(de=Me+48|0,d[de>>2]=d[N>>2],d[de+4>>2]=d[N+4>>2],d[de+8>>2]=d[N+8>>2],d[de+12>>2]=d[N+12>>2],(U|0)==0&(I|0)==0)return Me=M,Q=Le,Me|0;p=Me+16|0,q=Me+24|0,ie=Me+28|0,M=0,N=0,f=U,A=I;do{if(!((M|0)<(y|0)|(M|0)==(y|0)&N>>>0<_>>>0)){pe=4;break}if(I=N,N=Xt(N|0,M|0,1,0)|0,M=K()|0,I=T+(I<<3)|0,d[I>>2]=f,d[I+4>>2]=A,uf(de),A=de,f=d[A>>2]|0,A=d[A+4>>2]|0,(f|0)==0&(A|0)==0){if(al(p),f=p,A=d[f>>2]|0,f=d[f+4>>2]|0,(A|0)==0&(f|0)==0){pe=10;break}Vu(A,f,d[ie>>2]|0,de),A=de,f=d[A>>2]|0,A=d[A+4>>2]|0}I=Me,d[I>>2]=f,d[I+4>>2]=A}while(!((f|0)==0&(A|0)==0));return(pe|0)==4?(A=Me+40|0,f=d[A>>2]|0,f|0&&An(f),pe=Me+16|0,d[pe>>2]=0,d[pe+4>>2]=0,d[q>>2]=0,d[Me+36>>2]=0,d[ie>>2]=-1,d[Me+32>>2]=0,d[A>>2]=0,Vu(0,0,0,de),d[Me>>2]=0,d[Me+4>>2]=0,d[Ae>>2]=0,Me=14,Q=Le,Me|0):((pe|0)==10&&(d[Me>>2]=0,d[Me+4>>2]=0,d[Ae>>2]=d[q>>2]),Me=d[Ae>>2]|0,Q=Le,Me|0)}function cf(A,f,p,_){A=A|0,f=f|0,p=p|0,_=_|0;var y=0,T=0,M=0,N=0,U=0,I=0,q=0,ie=0,de=0,Ae=0;if(ie=Q,Q=Q+48|0,U=ie+32|0,N=ie+40|0,I=ie,!(d[A>>2]|0))return q=_,d[q>>2]=0,d[q+4>>2]=0,q=0,Q=ie,q|0;Iu(U,0,0,0),M=U,y=d[M>>2]|0,M=d[M+4>>2]|0;do if(f>>>0>15)q=I,d[q>>2]=0,d[q+4>>2]=0,d[I+8>>2]=4,d[I+12>>2]=-1,q=I+16|0,p=I+29|0,d[q>>2]=0,d[q+4>>2]=0,d[q+8>>2]=0,at[q+12>>0]=0,at[p>>0]=at[N>>0]|0,at[p+1>>0]=at[N+1>>0]|0,at[p+2>>0]=at[N+2>>0]|0,p=4,q=9;else{if(p=Ra(p)|0,p|0){U=I,d[U>>2]=0,d[U+4>>2]=0,d[I+8>>2]=p,d[I+12>>2]=-1,U=I+16|0,q=I+29|0,d[U>>2]=0,d[U+4>>2]=0,d[U+8>>2]=0,at[U+12>>0]=0,at[q>>0]=at[N>>0]|0,at[q+1>>0]=at[N+1>>0]|0,at[q+2>>0]=at[N+2>>0]|0,q=9;break}if(p=Ks((d[A+8>>2]|0)+1|0,32)|0,!p){q=I,d[q>>2]=0,d[q+4>>2]=0,d[I+8>>2]=13,d[I+12>>2]=-1,q=I+16|0,p=I+29|0,d[q>>2]=0,d[q+4>>2]=0,d[q+8>>2]=0,at[q+12>>0]=0,at[p>>0]=at[N>>0]|0,at[p+1>>0]=at[N+1>>0]|0,at[p+2>>0]=at[N+2>>0]|0,p=13,q=9;break}Na(A,p),Ae=I,d[Ae>>2]=y,d[Ae+4>>2]=M,M=I+8|0,d[M>>2]=0,d[I+12>>2]=f,d[I+20>>2]=A,d[I+24>>2]=p,at[I+28>>0]=0,y=I+29|0,at[y>>0]=at[N>>0]|0,at[y+1>>0]=at[N+1>>0]|0,at[y+2>>0]=at[N+2>>0]|0,d[I+16>>2]=3,de=+tf(p),de=de*+il(p),T=+un(+ +ee[p>>3]),T=de/+li(+ +df(+T,+ +un(+ +ee[p+8>>3])))*6371.007180918475*6371.007180918475,y=I+12|0,p=d[y>>2]|0;e:do if((p|0)>0)do{if(dp(p+-1|0,U)|0,!(T/+ee[U>>3]>10))break e;Ae=d[y>>2]|0,p=Ae+-1|0,d[y>>2]=p}while((Ae|0)>1);while(!1);if(al(I),y=_,d[y>>2]=0,d[y+4>>2]=0,y=I,p=d[y>>2]|0,y=d[y+4>>2]|0,!((p|0)==0&(y|0)==0))do lf(p,y,f,U)|0,N=U,A=_,N=Xt(d[A>>2]|0,d[A+4>>2]|0,d[N>>2]|0,d[N+4>>2]|0)|0,A=K()|0,Ae=_,d[Ae>>2]=N,d[Ae+4>>2]=A,al(I),Ae=I,p=d[Ae>>2]|0,y=d[Ae+4>>2]|0;while(!((p|0)==0&(y|0)==0));p=d[M>>2]|0}while(!1);return Ae=p,Q=ie,Ae|0}function Ts(A,f,p){A=A|0,f=f|0,p=p|0;var _=0,y=0,T=0,M=0,N=0,U=0,I=0,q=0,ie=0,de=0;if(!(Lo(f,p)|0)||(f=TA(f)|0,_=+ee[p>>3],y=+ee[p+8>>3],y=f&y<0?y+6.283185307179586:y,de=d[A>>2]|0,(de|0)<=0))return de=0,de|0;if(ie=d[A+4>>2]|0,f){f=0,q=y,p=-1,A=0;e:for(;;){for(I=A;M=+ee[ie+(I<<4)>>3],y=+ee[ie+(I<<4)+8>>3],A=(p+2|0)%(de|0)|0,T=+ee[ie+(A<<4)>>3],N=+ee[ie+(A<<4)+8>>3],M>T?(U=M,M=N):(U=T,T=M,M=y,y=N),_=_==T|_==U?_+2220446049250313e-31:_,!!(_U);)if(p=I+1|0,(p|0)>=(de|0)){p=22;break e}else A=I,I=p,p=A;if(N=M<0?M+6.283185307179586:M,M=y<0?y+6.283185307179586:y,q=N==q|M==q?q+-2220446049250313e-31:q,U=N+(M-N)*((_-T)/(U-T)),(U<0?U+6.283185307179586:U)>q&&(f=f^1),A=I+1|0,(A|0)>=(de|0)){p=22;break}else p=I}if((p|0)==22)return f|0}else{f=0,q=y,p=-1,A=0;e:for(;;){for(I=A;M=+ee[ie+(I<<4)>>3],y=+ee[ie+(I<<4)+8>>3],A=(p+2|0)%(de|0)|0,T=+ee[ie+(A<<4)>>3],N=+ee[ie+(A<<4)+8>>3],M>T?(U=M,M=N):(U=T,T=M,M=y,y=N),_=_==T|_==U?_+2220446049250313e-31:_,!!(_U);)if(p=I+1|0,(p|0)>=(de|0)){p=22;break e}else A=I,I=p,p=A;if(q=M==q|y==q?q+-2220446049250313e-31:q,M+(y-M)*((_-T)/(U-T))>q&&(f=f^1),A=I+1|0,(A|0)>=(de|0)){p=22;break}else p=I}if((p|0)==22)return f|0}return 0}function pa(A,f){A=A|0,f=f|0;var p=0,_=0,y=0,T=0,M=0,N=0,U=0,I=0,q=0,ie=0,de=0,Ae=0,pe=0,Me=0,Le=0,Ye=0,qe=0;if(pe=d[A>>2]|0,!pe){d[f>>2]=0,d[f+4>>2]=0,d[f+8>>2]=0,d[f+12>>2]=0,d[f+16>>2]=0,d[f+20>>2]=0,d[f+24>>2]=0,d[f+28>>2]=0;return}if(Me=f+8|0,ee[Me>>3]=17976931348623157e292,Le=f+24|0,ee[Le>>3]=17976931348623157e292,ee[f>>3]=-17976931348623157e292,Ye=f+16|0,ee[Ye>>3]=-17976931348623157e292,!((pe|0)<=0)){for(de=d[A+4>>2]|0,I=17976931348623157e292,q=-17976931348623157e292,ie=0,A=-1,T=17976931348623157e292,M=17976931348623157e292,U=-17976931348623157e292,_=-17976931348623157e292,Ae=0;p=+ee[de+(Ae<<4)>>3],N=+ee[de+(Ae<<4)+8>>3],A=A+2|0,y=+ee[de+(((A|0)==(pe|0)?0:A)<<4)+8>>3],p>3]=p,T=p),N>3]=N,M=N),p>U?ee[f>>3]=p:p=U,N>_&&(ee[Ye>>3]=N,_=N),I=N>0&Nq?N:q,ie=ie|+un(+(N-y))>3.141592653589793,A=Ae+1|0,(A|0)!=(pe|0);)qe=Ae,U=p,Ae=A,A=qe;ie&&(ee[Ye>>3]=q,ee[Le>>3]=I)}}function Ra(A){return A=A|0,(A>>>0<4?0:15)|0}function Na(A,f){A=A|0,f=f|0;var p=0,_=0,y=0,T=0,M=0,N=0,U=0,I=0,q=0,ie=0,de=0,Ae=0,pe=0,Me=0,Le=0,Ye=0,qe=0,Fe=0,Ee=0,Pt=0,nn=0,Jt=0;if(pe=d[A>>2]|0,pe){if(Me=f+8|0,ee[Me>>3]=17976931348623157e292,Le=f+24|0,ee[Le>>3]=17976931348623157e292,ee[f>>3]=-17976931348623157e292,Ye=f+16|0,ee[Ye>>3]=-17976931348623157e292,(pe|0)>0){for(y=d[A+4>>2]|0,de=17976931348623157e292,Ae=-17976931348623157e292,_=0,p=-1,U=17976931348623157e292,I=17976931348623157e292,ie=-17976931348623157e292,M=-17976931348623157e292,qe=0;T=+ee[y+(qe<<4)>>3],q=+ee[y+(qe<<4)+8>>3],nn=p+2|0,N=+ee[y+(((nn|0)==(pe|0)?0:nn)<<4)+8>>3],T>3]=T,U=T),q>3]=q,I=q),T>ie?ee[f>>3]=T:T=ie,q>M&&(ee[Ye>>3]=q,M=q),de=q>0&qAe?q:Ae,_=_|+un(+(q-N))>3.141592653589793,p=qe+1|0,(p|0)!=(pe|0);)nn=qe,ie=T,qe=p,p=nn;_&&(ee[Ye>>3]=Ae,ee[Le>>3]=de)}}else d[f>>2]=0,d[f+4>>2]=0,d[f+8>>2]=0,d[f+12>>2]=0,d[f+16>>2]=0,d[f+20>>2]=0,d[f+24>>2]=0,d[f+28>>2]=0;if(nn=A+8|0,p=d[nn>>2]|0,!((p|0)<=0)){Pt=A+12|0,Ee=0;do if(y=d[Pt>>2]|0,_=Ee,Ee=Ee+1|0,Le=f+(Ee<<5)|0,Ye=d[y+(_<<3)>>2]|0,Ye){if(qe=f+(Ee<<5)+8|0,ee[qe>>3]=17976931348623157e292,A=f+(Ee<<5)+24|0,ee[A>>3]=17976931348623157e292,ee[Le>>3]=-17976931348623157e292,Fe=f+(Ee<<5)+16|0,ee[Fe>>3]=-17976931348623157e292,(Ye|0)>0){for(pe=d[y+(_<<3)+4>>2]|0,de=17976931348623157e292,Ae=-17976931348623157e292,y=0,_=-1,Me=0,U=17976931348623157e292,I=17976931348623157e292,q=-17976931348623157e292,M=-17976931348623157e292;T=+ee[pe+(Me<<4)>>3],ie=+ee[pe+(Me<<4)+8>>3],_=_+2|0,N=+ee[pe+(((_|0)==(Ye|0)?0:_)<<4)+8>>3],T>3]=T,U=T),ie>3]=ie,I=ie),T>q?ee[Le>>3]=T:T=q,ie>M&&(ee[Fe>>3]=ie,M=ie),de=ie>0&ieAe?ie:Ae,y=y|+un(+(ie-N))>3.141592653589793,_=Me+1|0,(_|0)!=(Ye|0);)Jt=Me,Me=_,q=T,_=Jt;y&&(ee[Fe>>3]=Ae,ee[A>>3]=de)}}else d[Le>>2]=0,d[Le+4>>2]=0,d[Le+8>>2]=0,d[Le+12>>2]=0,d[Le+16>>2]=0,d[Le+20>>2]=0,d[Le+24>>2]=0,d[Le+28>>2]=0,p=d[nn>>2]|0;while((Ee|0)<(p|0))}}function Da(A,f,p){A=A|0,f=f|0,p=p|0;var _=0,y=0,T=0;if(!(Ts(A,f,p)|0))return y=0,y|0;if(y=A+8|0,(d[y>>2]|0)<=0)return y=1,y|0;for(_=A+12|0,A=0;;){if(T=A,A=A+1|0,Ts((d[_>>2]|0)+(T<<3)|0,f+(A<<5)|0,p)|0){A=0,_=6;break}if((A|0)>=(d[y>>2]|0)){A=1,_=6;break}}return(_|0)==6?A|0:0}function Oo(A,f,p,_){A=A|0,f=f|0,p=p|0,_=_|0;var y=0,T=0,M=0,N=0,U=0,I=0,q=0;if(I=Q,Q=Q+16|0,N=I,M=p+8|0,!(Ts(A,f,M)|0))return U=0,Q=I,U|0;U=A+8|0;e:do if((d[U>>2]|0)>0){for(T=A+12|0,y=0;;){if(q=y,y=y+1|0,Ts((d[T>>2]|0)+(q<<3)|0,f+(y<<5)|0,M)|0){y=0;break}if((y|0)>=(d[U>>2]|0))break e}return Q=I,y|0}while(!1);if(hf(A,f,p,_)|0)return q=0,Q=I,q|0;d[N>>2]=d[p>>2],d[N+4>>2]=M,y=d[U>>2]|0;e:do if((y|0)>0)for(A=A+12|0,M=0,T=y;;){if(y=d[A>>2]|0,(d[y+(M<<3)>>2]|0)>0){if(Ts(N,_,d[y+(M<<3)+4>>2]|0)|0){y=0;break e}if(y=M+1|0,hf((d[A>>2]|0)+(M<<3)|0,f+(y<<5)|0,p,_)|0){y=0;break e}T=d[U>>2]|0}else y=M+1|0;if((y|0)<(T|0))M=y;else{y=1;break}}else y=1;while(!1);return q=y,Q=I,q|0}function hf(A,f,p,_){A=A|0,f=f|0,p=p|0,_=_|0;var y=0,T=0,M=0,N=0,U=0,I=0,q=0,ie=0,de=0,Ae=0,pe=0,Me=0,Le=0,Ye=0,qe=0,Fe=0,Ee=0,Pt=0,nn=0,Jt=0,Un=0;if(nn=Q,Q=Q+176|0,qe=nn+172|0,y=nn+168|0,Fe=nn,!(nf(f,_)|0))return A=0,Q=nn,A|0;if(wA(f,_,qe,y),Gl(Fe|0,p|0,168)|0,(d[p>>2]|0)>0){f=0;do Jt=Fe+8+(f<<4)+8|0,Ye=+Xs(+ee[Jt>>3],d[y>>2]|0),ee[Jt>>3]=Ye,f=f+1|0;while((f|0)<(d[p>>2]|0))}Me=+ee[_>>3],Le=+ee[_+8>>3],Ye=+Xs(+ee[_+16>>3],d[y>>2]|0),Ae=+Xs(+ee[_+24>>3],d[y>>2]|0);e:do if((d[A>>2]|0)>0){if(_=A+4|0,y=d[Fe>>2]|0,(y|0)<=0){for(f=0;;)if(f=f+1|0,(f|0)>=(d[A>>2]|0)){f=0;break e}}for(p=0;;){if(f=d[_>>2]|0,de=+ee[f+(p<<4)>>3],pe=+Xs(+ee[f+(p<<4)+8>>3],d[qe>>2]|0),f=d[_>>2]|0,p=p+1|0,Jt=(p|0)%(d[A>>2]|0)|0,T=+ee[f+(Jt<<4)>>3],M=+Xs(+ee[f+(Jt<<4)+8>>3],d[qe>>2]|0),!(de>=Me)|!(T>=Me)&&!(de<=Le)|!(T<=Le)&&!(pe<=Ae)|!(M<=Ae)&&!(pe>=Ye)|!(M>=Ye)){ie=T-de,I=M-pe,f=0;do if(Un=f,f=f+1|0,Jt=(f|0)==(y|0)?0:f,T=+ee[Fe+8+(Un<<4)+8>>3],M=+ee[Fe+8+(Jt<<4)+8>>3]-T,N=+ee[Fe+8+(Un<<4)>>3],U=+ee[Fe+8+(Jt<<4)>>3]-N,q=ie*M-I*U,q!=0&&(Ee=pe-T,Pt=de-N,U=(Ee*U-M*Pt)/q,!(U<0|U>1))&&(q=(ie*Ee-I*Pt)/q,q>=0&q<=1)){f=1;break e}while((f|0)<(y|0))}if((p|0)>=(d[A>>2]|0)){f=0;break}}}else f=0;while(!1);return Un=f,Q=nn,Un|0}function zA(A,f,p,_){A=A|0,f=f|0,p=p|0,_=_|0;var y=0,T=0,M=0;if(hf(A,f,p,_)|0)return T=1,T|0;if(T=A+8|0,(d[T>>2]|0)<=0)return T=0,T|0;for(y=A+12|0,A=0;;){if(M=A,A=A+1|0,hf((d[y>>2]|0)+(M<<3)|0,f+(A<<5)|0,p,_)|0){A=1,y=6;break}if((A|0)>=(d[T>>2]|0)){A=0,y=6;break}}return(y|0)==6?A|0:0}function _p(){return 8}function R1(){return 16}function fs(){return 168}function sr(){return 8}function mi(){return 16}function kl(){return 12}function Pa(){return 8}function yp(A){return A=A|0,+(+((d[A>>2]|0)>>>0)+4294967296*+(d[A+4>>2]|0))}function zl(A){A=A|0;var f=0,p=0;return p=+ee[A>>3],f=+ee[A+8>>3],+ +qn(+(p*p+f*f))}function xp(A,f,p,_,y){A=A|0,f=f|0,p=p|0,_=_|0,y=y|0;var T=0,M=0,N=0,U=0,I=0,q=0,ie=0,de=0;I=+ee[A>>3],U=+ee[f>>3]-I,N=+ee[A+8>>3],M=+ee[f+8>>3]-N,ie=+ee[p>>3],T=+ee[_>>3]-ie,de=+ee[p+8>>3],q=+ee[_+8>>3]-de,T=(T*(N-de)-(I-ie)*q)/(U*q-M*T),ee[y>>3]=I+U*T,ee[y+8>>3]=N+M*T}function bp(A,f){return A=A|0,f=f|0,+un(+(+ee[A>>3]-+ee[f>>3]))<11920928955078125e-23?(f=+un(+(+ee[A+8>>3]-+ee[f+8>>3]))<11920928955078125e-23,f|0):(f=0,f|0)}function ar(A,f){A=A|0,f=f|0;var p=0,_=0,y=0;return y=+ee[A>>3]-+ee[f>>3],_=+ee[A+8>>3]-+ee[f+8>>3],p=+ee[A+16>>3]-+ee[f+16>>3],+(y*y+_*_+p*p)}function Yu(A,f){A=A|0,f=f|0;var p=0,_=0,y=0;p=+ee[A>>3],_=+li(+p),p=+Fn(+p),ee[f+16>>3]=p,p=+ee[A+8>>3],y=_*+li(+p),ee[f>>3]=y,p=_*+Fn(+p),ee[f+8>>3]=p}function Sp(A,f,p){A=A|0,f=f|0,p=p|0;var _=0,y=0,T=0;if(T=Q,Q=Q+16|0,y=T,_=Ci(A,f)|0,(p+-1|0)>>>0>5||(_=(_|0)!=0,(p|0)==1&_))return y=-1,Q=T,y|0;do if(ol(A,f,y)|0)_=-1;else if(_){_=((d[26352+(p<<2)>>2]|0)+5-(d[y>>2]|0)|0)%5|0;break}else{_=((d[26384+(p<<2)>>2]|0)+6-(d[y>>2]|0)|0)%6|0;break}while(!1);return y=_,Q=T,y|0}function ol(A,f,p){A=A|0,f=f|0,p=p|0;var _=0,y=0,T=0,M=0,N=0,U=0,I=0,q=0;if(q=Q,Q=Q+32|0,N=q+16|0,U=q,_=zu(A,f,N)|0,_|0)return p=_,Q=q,p|0;T=g1(A,f)|0,I=$s(A,f)|0,tp(T,U),_=$c(T,d[N>>2]|0)|0;do if(Bi(T)|0){do switch(T|0){case 4:{y=0;break}case 14:{y=1;break}case 24:{y=2;break}case 38:{y=3;break}case 49:{y=4;break}case 58:{y=5;break}case 63:{y=6;break}case 72:{y=7;break}case 83:{y=8;break}case 97:{y=9;break}case 107:{y=10;break}case 117:{y=11;break}default:Ut(27795,27797,75,27806)}while(!1);if(M=d[26416+(y*24|0)+8>>2]|0,f=d[26416+(y*24|0)+16>>2]|0,A=d[N>>2]|0,(A|0)!=(d[U>>2]|0)&&(U=Wc(T)|0,A=d[N>>2]|0,U|(A|0)==(f|0)&&(_=(_+1|0)%6|0)),(I|0)==3&(A|0)==(f|0)){_=(_+5|0)%6|0;break}(I|0)==5&(A|0)==(M|0)&&(_=(_+1|0)%6|0)}while(!1);return d[p>>2]=_,p=0,Q=q,p|0}function Qs(A,f,p,_){A=A|0,f=f|0,p=p|0,_=_|0;var y=0,T=0,M=0,N=0,U=0,I=0,q=0,ie=0,de=0,Ae=0,pe=0,Me=0,Le=0,Ye=0,qe=0,Fe=0;if(Fe=Q,Q=Q+32|0,qe=Fe+24|0,Le=Fe+20|0,pe=Fe+8|0,Ae=Fe+16|0,de=Fe,U=(Ci(A,f)|0)==0,U=U?6:5,q=yt(A|0,f|0,52)|0,K()|0,q=q&15,U>>>0<=p>>>0)return _=2,Q=Fe,_|0;ie=(q|0)==0,!ie&&(Me=Nt(7,0,(q^15)*3|0)|0,(Me&A|0)==0&((K()|0)&f|0)==0)?y=p:T=4;e:do if((T|0)==4){if(y=(Ci(A,f)|0)!=0,((y?4:5)|0)<(p|0)||ol(A,f,qe)|0||(T=(d[qe>>2]|0)+p|0,y?y=26704+(((T|0)%5|0)<<2)|0:y=26736+(((T|0)%6|0)<<2)|0,Me=d[y>>2]|0,(Me|0)==7))return _=1,Q=Fe,_|0;d[Le>>2]=0,y=cn(A,f,Me,Le,pe)|0;do if(!y){if(N=pe,I=d[N>>2]|0,N=d[N+4>>2]|0,M=N>>>0>>0|(N|0)==(f|0)&I>>>0>>0,T=M?I:A,M=M?N:f,!ie&&(ie=Nt(7,0,(q^15)*3|0)|0,(I&ie|0)==0&(N&(K()|0)|0)==0))y=p;else{if(N=(p+-1+U|0)%(U|0)|0,y=Ci(A,f)|0,(N|0)<0&&Ut(27795,27797,248,27822),U=(y|0)!=0,((U?4:5)|0)<(N|0)&&Ut(27795,27797,248,27822),ol(A,f,qe)|0&&Ut(27795,27797,248,27822),y=(d[qe>>2]|0)+N|0,U?y=26704+(((y|0)%5|0)<<2)|0:y=26736+(((y|0)%6|0)<<2)|0,N=d[y>>2]|0,(N|0)==7&&Ut(27795,27797,248,27822),d[Ae>>2]=0,y=cn(A,f,N,Ae,de)|0,y|0)break;I=de,U=d[I>>2]|0,I=d[I+4>>2]|0;do if(I>>>0>>0|(I|0)==(M|0)&U>>>0>>0){if(Ci(U,I)|0?T=pi(U,I,A,f)|0:T=d[26800+((((d[Ae>>2]|0)+(d[26768+(N<<2)>>2]|0)|0)%6|0)<<2)>>2]|0,y=Ci(U,I)|0,(T+-1|0)>>>0>5){y=-1,T=U,M=I;break}if(y=(y|0)!=0,(T|0)==1&y){y=-1,T=U,M=I;break}do if(ol(U,I,qe)|0)y=-1;else if(y){y=((d[26352+(T<<2)>>2]|0)+5-(d[qe>>2]|0)|0)%5|0;break}else{y=((d[26384+(T<<2)>>2]|0)+6-(d[qe>>2]|0)|0)%6|0;break}while(!1);T=U,M=I}else y=p;while(!1);N=pe,I=d[N>>2]|0,N=d[N+4>>2]|0}if((T|0)==(I|0)&(M|0)==(N|0)){if(U=(Ci(I,N)|0)!=0,U?A=pi(I,N,A,f)|0:A=d[26800+((((d[Le>>2]|0)+(d[26768+(Me<<2)>>2]|0)|0)%6|0)<<2)>>2]|0,y=Ci(I,N)|0,(A+-1|0)>>>0<=5&&(Ye=(y|0)!=0,!((A|0)==1&Ye)))do if(ol(I,N,qe)|0)y=-1;else if(Ye){y=((d[26352+(A<<2)>>2]|0)+5-(d[qe>>2]|0)|0)%5|0;break}else{y=((d[26384+(A<<2)>>2]|0)+6-(d[qe>>2]|0)|0)%6|0;break}while(!1);else y=-1;y=y+1|0,y=(y|0)==6|U&(y|0)==5?0:y}f=M,A=T;break e}while(!1);return _=y,Q=Fe,_|0}while(!1);return Ye=Nt(y|0,0,56)|0,qe=K()|0|f&-2130706433|536870912,d[_>>2]=Ye|A,d[_+4>>2]=qe,_=0,Q=Fe,_|0}function Qu(A,f,p){A=A|0,f=f|0,p=p|0;var _=0,y=0,T=0;return T=(Ci(A,f)|0)==0,_=Qs(A,f,0,p)|0,y=(_|0)==0,T?!y||(_=Qs(A,f,1,p+8|0)|0,_|0)||(_=Qs(A,f,2,p+16|0)|0,_|0)||(_=Qs(A,f,3,p+24|0)|0,_|0)||(_=Qs(A,f,4,p+32|0)|0,_)?(T=_,T|0):Qs(A,f,5,p+40|0)|0:!y||(_=Qs(A,f,1,p+8|0)|0,_|0)||(_=Qs(A,f,2,p+16|0)|0,_|0)||(_=Qs(A,f,3,p+24|0)|0,_|0)||(_=Qs(A,f,4,p+32|0)|0,_|0)?(T=_,T|0):(T=p+40|0,d[T>>2]=0,d[T+4>>2]=0,T=0,T|0)}function ll(A,f,p){A=A|0,f=f|0,p=p|0;var _=0,y=0,T=0,M=0,N=0,U=0;return U=Q,Q=Q+192|0,y=U,T=U+168|0,M=yt(A|0,f|0,56)|0,K()|0,M=M&7,N=f&-2130706433|134217728,_=zu(A,N,T)|0,_|0?(N=_,Q=U,N|0):(f=yt(A|0,f|0,52)|0,K()|0,f=f&15,Ci(A,N)|0?sp(T,f,M,1,y):RA(T,f,M,1,y),N=y+8|0,d[p>>2]=d[N>>2],d[p+4>>2]=d[N+4>>2],d[p+8>>2]=d[N+8>>2],d[p+12>>2]=d[N+12>>2],N=0,Q=U,N|0)}function ul(A,f){A=A|0,f=f|0;var p=0,_=0,y=0,T=0;return y=Q,Q=Q+16|0,p=y,!(!0&(f&2013265920|0)==536870912)||(_=f&-2130706433|134217728,!(NA(A,_)|0))?(_=0,Q=y,_|0):(T=yt(A|0,f|0,56)|0,K()|0,T=(Qs(A,_,T&7,p)|0)==0,_=p,_=T&((d[_>>2]|0)==(A|0)?(d[_+4>>2]|0)==(f|0):0)&1,Q=y,_|0)}function Io(A,f,p){A=A|0,f=f|0,p=p|0;var _=0;(f|0)>0?(_=Ks(f,4)|0,d[A>>2]=_,_||Ut(27835,27858,40,27872)):d[A>>2]=0,d[A+4>>2]=f,d[A+8>>2]=0,d[A+12>>2]=p}function GA(A){A=A|0;var f=0,p=0,_=0,y=0,T=0,M=0,N=0;y=A+4|0,T=A+12|0,M=A+8|0;e:for(;;){for(p=d[y>>2]|0,f=0;;){if((f|0)>=(p|0))break e;if(_=d[A>>2]|0,N=d[_+(f<<2)>>2]|0,!N)f=f+1|0;else break}f=_+(~~(+un(+(+Hs(10,+ +(15-(d[T>>2]|0)|0))*(+ee[N>>3]+ +ee[N+8>>3])))%+(p|0))>>>0<<2)|0,p=d[f>>2]|0;t:do if(p|0){if(_=N+32|0,(p|0)==(N|0))d[f>>2]=d[_>>2];else{if(p=p+32|0,f=d[p>>2]|0,!f)break;for(;(f|0)!=(N|0);)if(p=f+32|0,f=d[p>>2]|0,!f)break t;d[p>>2]=d[_>>2]}An(N),d[M>>2]=(d[M>>2]|0)+-1}while(!1)}An(d[A>>2]|0)}function qA(A){A=A|0;var f=0,p=0,_=0;for(_=d[A+4>>2]|0,p=0;;){if((p|0)>=(_|0)){f=0,p=4;break}if(f=d[(d[A>>2]|0)+(p<<2)>>2]|0,!f)p=p+1|0;else{p=4;break}}return(p|0)==4?f|0:0}function Ku(A,f){A=A|0,f=f|0;var p=0,_=0,y=0,T=0;if(p=~~(+un(+(+Hs(10,+ +(15-(d[A+12>>2]|0)|0))*(+ee[f>>3]+ +ee[f+8>>3])))%+(d[A+4>>2]|0))>>>0,p=(d[A>>2]|0)+(p<<2)|0,_=d[p>>2]|0,!_)return T=1,T|0;T=f+32|0;do if((_|0)!=(f|0)){if(p=d[_+32>>2]|0,!p)return T=1,T|0;for(y=p;;){if((y|0)==(f|0)){y=8;break}if(p=d[y+32>>2]|0,p)_=y,y=p;else{p=1,y=10;break}}if((y|0)==8){d[_+32>>2]=d[T>>2];break}else if((y|0)==10)return p|0}else d[p>>2]=d[T>>2];while(!1);return An(f),T=A+8|0,d[T>>2]=(d[T>>2]|0)+-1,T=0,T|0}function VA(A,f,p){A=A|0,f=f|0,p=p|0;var _=0,y=0,T=0,M=0;T=Fo(40)|0,T||Ut(27888,27858,98,27901),d[T>>2]=d[f>>2],d[T+4>>2]=d[f+4>>2],d[T+8>>2]=d[f+8>>2],d[T+12>>2]=d[f+12>>2],y=T+16|0,d[y>>2]=d[p>>2],d[y+4>>2]=d[p+4>>2],d[y+8>>2]=d[p+8>>2],d[y+12>>2]=d[p+12>>2],d[T+32>>2]=0,y=~~(+un(+(+Hs(10,+ +(15-(d[A+12>>2]|0)|0))*(+ee[f>>3]+ +ee[f+8>>3])))%+(d[A+4>>2]|0))>>>0,y=(d[A>>2]|0)+(y<<2)|0,_=d[y>>2]|0;do if(!_)d[y>>2]=T;else{for(;!(Ea(_,f)|0&&Ea(_+16|0,p)|0);)if(y=d[_+32>>2]|0,_=(y|0)==0?_:y,!(d[_+32>>2]|0)){M=10;break}if((M|0)==10){d[_+32>>2]=T;break}return An(T),M=_,M|0}while(!1);return M=A+8|0,d[M>>2]=(d[M>>2]|0)+1,M=T,M|0}function Zu(A,f,p){A=A|0,f=f|0,p=p|0;var _=0,y=0;if(y=~~(+un(+(+Hs(10,+ +(15-(d[A+12>>2]|0)|0))*(+ee[f>>3]+ +ee[f+8>>3])))%+(d[A+4>>2]|0))>>>0,y=d[(d[A>>2]|0)+(y<<2)>>2]|0,!y)return p=0,p|0;if(!p){for(A=y;;){if(Ea(A,f)|0){_=10;break}if(A=d[A+32>>2]|0,!A){A=0,_=10;break}}if((_|0)==10)return A|0}for(A=y;;){if(Ea(A,f)|0&&Ea(A+16|0,p)|0){_=10;break}if(A=d[A+32>>2]|0,!A){A=0,_=10;break}}return(_|0)==10?A|0:0}function As(A,f){A=A|0,f=f|0;var p=0;if(p=~~(+un(+(+Hs(10,+ +(15-(d[A+12>>2]|0)|0))*(+ee[f>>3]+ +ee[f+8>>3])))%+(d[A+4>>2]|0))>>>0,A=d[(d[A>>2]|0)+(p<<2)>>2]|0,!A)return p=0,p|0;for(;;){if(Ea(A,f)|0){f=5;break}if(A=d[A+32>>2]|0,!A){A=0,f=5;break}}return(f|0)==5?A|0:0}function HA(){return 27920}function cl(A){return A=+A,~~+pf(+A)|0}function Fo(A){A=A|0;var f=0,p=0,_=0,y=0,T=0,M=0,N=0,U=0,I=0,q=0,ie=0,de=0,Ae=0,pe=0,Me=0,Le=0,Ye=0,qe=0,Fe=0,Ee=0,Pt=0;Pt=Q,Q=Q+16|0,de=Pt;do if(A>>>0<245){if(I=A>>>0<11?16:A+11&-8,A=I>>>3,ie=d[6981]|0,p=ie>>>A,p&3|0)return f=(p&1^1)+A|0,A=27964+(f<<1<<2)|0,p=A+8|0,_=d[p>>2]|0,y=_+8|0,T=d[y>>2]|0,(T|0)==(A|0)?d[6981]=ie&~(1<>2]=A,d[p>>2]=T),Ee=f<<3,d[_+4>>2]=Ee|3,Ee=_+Ee+4|0,d[Ee>>2]=d[Ee>>2]|1,Ee=y,Q=Pt,Ee|0;if(q=d[6983]|0,I>>>0>q>>>0){if(p|0)return f=2<>>12&16,f=f>>>N,p=f>>>5&8,f=f>>>p,T=f>>>2&4,f=f>>>T,A=f>>>1&2,f=f>>>A,_=f>>>1&1,_=(p|N|T|A|_)+(f>>>_)|0,f=27964+(_<<1<<2)|0,A=f+8|0,T=d[A>>2]|0,N=T+8|0,p=d[N>>2]|0,(p|0)==(f|0)?(A=ie&~(1<<_),d[6981]=A):(d[p+12>>2]=f,d[A>>2]=p,A=ie),Ee=_<<3,M=Ee-I|0,d[T+4>>2]=I|3,y=T+I|0,d[y+4>>2]=M|1,d[T+Ee>>2]=M,q|0&&(_=d[6986]|0,f=q>>>3,p=27964+(f<<1<<2)|0,f=1<>2]|0):(d[6981]=A|f,f=p,A=p+8|0),d[A>>2]=_,d[f+12>>2]=_,d[_+8>>2]=f,d[_+12>>2]=p),d[6983]=M,d[6986]=y,Ee=N,Q=Pt,Ee|0;if(T=d[6982]|0,T){for(p=(T&0-T)+-1|0,y=p>>>12&16,p=p>>>y,_=p>>>5&8,p=p>>>_,M=p>>>2&4,p=p>>>M,N=p>>>1&2,p=p>>>N,U=p>>>1&1,U=d[28228+((_|y|M|N|U)+(p>>>U)<<2)>>2]|0,p=U,N=U,U=(d[U+4>>2]&-8)-I|0;A=d[p+16>>2]|0,!(!A&&(A=d[p+20>>2]|0,!A));)M=(d[A+4>>2]&-8)-I|0,y=M>>>0>>0,p=A,N=y?A:N,U=y?M:U;if(M=N+I|0,M>>>0>N>>>0){y=d[N+24>>2]|0,f=d[N+12>>2]|0;do if((f|0)==(N|0)){if(A=N+20|0,f=d[A>>2]|0,!f&&(A=N+16|0,f=d[A>>2]|0,!f)){p=0;break}for(;;)if(_=f+20|0,p=d[_>>2]|0,p)f=p,A=_;else if(_=f+16|0,p=d[_>>2]|0,p)f=p,A=_;else break;d[A>>2]=0,p=f}else p=d[N+8>>2]|0,d[p+12>>2]=f,d[f+8>>2]=p,p=f;while(!1);do if(y|0){if(f=d[N+28>>2]|0,A=28228+(f<<2)|0,(N|0)==(d[A>>2]|0)){if(d[A>>2]=p,!p){d[6982]=T&~(1<>2]|0)==(N|0)?Ee:y+20|0)>>2]=p,!p)break;d[p+24>>2]=y,f=d[N+16>>2]|0,f|0&&(d[p+16>>2]=f,d[f+24>>2]=p),f=d[N+20>>2]|0,f|0&&(d[p+20>>2]=f,d[f+24>>2]=p)}while(!1);return U>>>0<16?(Ee=U+I|0,d[N+4>>2]=Ee|3,Ee=N+Ee+4|0,d[Ee>>2]=d[Ee>>2]|1):(d[N+4>>2]=I|3,d[M+4>>2]=U|1,d[M+U>>2]=U,q|0&&(_=d[6986]|0,f=q>>>3,p=27964+(f<<1<<2)|0,f=1<>2]|0):(d[6981]=f|ie,f=p,A=p+8|0),d[A>>2]=_,d[f+12>>2]=_,d[_+8>>2]=f,d[_+12>>2]=p),d[6983]=U,d[6986]=M),Ee=N+8|0,Q=Pt,Ee|0}else ie=I}else ie=I}else ie=I}else if(A>>>0<=4294967231)if(A=A+11|0,I=A&-8,_=d[6982]|0,_){y=0-I|0,A=A>>>8,A?I>>>0>16777215?U=31:(ie=(A+1048320|0)>>>16&8,Me=A<>>16&4,Me=Me<>>16&2,U=14-(N|ie|U)+(Me<>>15)|0,U=I>>>(U+7|0)&1|U<<1):U=0,p=d[28228+(U<<2)>>2]|0;e:do if(!p)p=0,A=0,Me=61;else for(A=0,N=I<<((U|0)==31?0:25-(U>>>1)|0),T=0;;){if(M=(d[p+4>>2]&-8)-I|0,M>>>0>>0)if(M)A=p,y=M;else{A=p,y=0,Me=65;break e}if(Me=d[p+20>>2]|0,p=d[p+16+(N>>>31<<2)>>2]|0,T=(Me|0)==0|(Me|0)==(p|0)?T:Me,p)N=N<<1;else{p=T,Me=61;break}}while(!1);if((Me|0)==61){if((p|0)==0&(A|0)==0){if(A=2<>>12&16,ie=ie>>>M,T=ie>>>5&8,ie=ie>>>T,N=ie>>>2&4,ie=ie>>>N,U=ie>>>1&2,ie=ie>>>U,p=ie>>>1&1,A=0,p=d[28228+((T|M|N|U|p)+(ie>>>p)<<2)>>2]|0}p?Me=65:(N=A,M=y)}if((Me|0)==65)for(T=p;;)if(ie=(d[T+4>>2]&-8)-I|0,p=ie>>>0>>0,y=p?ie:y,A=p?T:A,p=d[T+16>>2]|0,p||(p=d[T+20>>2]|0),p)T=p;else{N=A,M=y;break}if((N|0)!=0&&M>>>0<((d[6983]|0)-I|0)>>>0&&(q=N+I|0,q>>>0>N>>>0)){T=d[N+24>>2]|0,f=d[N+12>>2]|0;do if((f|0)==(N|0)){if(A=N+20|0,f=d[A>>2]|0,!f&&(A=N+16|0,f=d[A>>2]|0,!f)){f=0;break}for(;;)if(y=f+20|0,p=d[y>>2]|0,p)f=p,A=y;else if(y=f+16|0,p=d[y>>2]|0,p)f=p,A=y;else break;d[A>>2]=0}else Ee=d[N+8>>2]|0,d[Ee+12>>2]=f,d[f+8>>2]=Ee;while(!1);do if(T){if(A=d[N+28>>2]|0,p=28228+(A<<2)|0,(N|0)==(d[p>>2]|0)){if(d[p>>2]=f,!f){_=_&~(1<>2]|0)==(N|0)?Ee:T+20|0)>>2]=f,!f)break;d[f+24>>2]=T,A=d[N+16>>2]|0,A|0&&(d[f+16>>2]=A,d[A+24>>2]=f),A=d[N+20>>2]|0,A&&(d[f+20>>2]=A,d[A+24>>2]=f)}while(!1);e:do if(M>>>0<16)Ee=M+I|0,d[N+4>>2]=Ee|3,Ee=N+Ee+4|0,d[Ee>>2]=d[Ee>>2]|1;else{if(d[N+4>>2]=I|3,d[q+4>>2]=M|1,d[q+M>>2]=M,f=M>>>3,M>>>0<256){p=27964+(f<<1<<2)|0,A=d[6981]|0,f=1<>2]|0):(d[6981]=A|f,f=p,A=p+8|0),d[A>>2]=q,d[f+12>>2]=q,d[q+8>>2]=f,d[q+12>>2]=p;break}if(f=M>>>8,f?M>>>0>16777215?p=31:(Fe=(f+1048320|0)>>>16&8,Ee=f<>>16&4,Ee=Ee<>>16&2,p=14-(qe|Fe|p)+(Ee<

>>15)|0,p=M>>>(p+7|0)&1|p<<1):p=0,f=28228+(p<<2)|0,d[q+28>>2]=p,A=q+16|0,d[A+4>>2]=0,d[A>>2]=0,A=1<>2]=q,d[q+24>>2]=f,d[q+12>>2]=q,d[q+8>>2]=q;break}f=d[f>>2]|0;t:do if((d[f+4>>2]&-8|0)!=(M|0)){for(_=M<<((p|0)==31?0:25-(p>>>1)|0);p=f+16+(_>>>31<<2)|0,A=d[p>>2]|0,!!A;)if((d[A+4>>2]&-8|0)==(M|0)){f=A;break t}else _=_<<1,f=A;d[p>>2]=q,d[q+24>>2]=f,d[q+12>>2]=q,d[q+8>>2]=q;break e}while(!1);Fe=f+8|0,Ee=d[Fe>>2]|0,d[Ee+12>>2]=q,d[Fe>>2]=q,d[q+8>>2]=Ee,d[q+12>>2]=f,d[q+24>>2]=0}while(!1);return Ee=N+8|0,Q=Pt,Ee|0}else ie=I}else ie=I;else ie=-1;while(!1);if(p=d[6983]|0,p>>>0>=ie>>>0)return f=p-ie|0,A=d[6986]|0,f>>>0>15?(Ee=A+ie|0,d[6986]=Ee,d[6983]=f,d[Ee+4>>2]=f|1,d[A+p>>2]=f,d[A+4>>2]=ie|3):(d[6983]=0,d[6986]=0,d[A+4>>2]=p|3,Ee=A+p+4|0,d[Ee>>2]=d[Ee>>2]|1),Ee=A+8|0,Q=Pt,Ee|0;if(M=d[6984]|0,M>>>0>ie>>>0)return qe=M-ie|0,d[6984]=qe,Ee=d[6987]|0,Fe=Ee+ie|0,d[6987]=Fe,d[Fe+4>>2]=qe|1,d[Ee+4>>2]=ie|3,Ee=Ee+8|0,Q=Pt,Ee|0;if(d[7099]|0?A=d[7101]|0:(d[7101]=4096,d[7100]=4096,d[7102]=-1,d[7103]=-1,d[7104]=0,d[7092]=0,d[7099]=de&-16^1431655768,A=4096),N=ie+48|0,U=ie+47|0,T=A+U|0,y=0-A|0,I=T&y,I>>>0<=ie>>>0||(A=d[7091]|0,A|0&&(q=d[7089]|0,de=q+I|0,de>>>0<=q>>>0|de>>>0>A>>>0)))return Ee=0,Q=Pt,Ee|0;e:do if(d[7092]&4)f=0,Me=143;else{p=d[6987]|0;t:do if(p){for(_=28372;de=d[_>>2]|0,!(de>>>0<=p>>>0&&(de+(d[_+4>>2]|0)|0)>>>0>p>>>0);)if(A=d[_+8>>2]|0,A)_=A;else{Me=128;break t}if(f=T-M&y,f>>>0<2147483647)if(A=fl(f|0)|0,(A|0)==((d[_>>2]|0)+(d[_+4>>2]|0)|0)){if((A|0)!=-1){M=f,T=A,Me=145;break e}}else _=A,Me=136;else f=0}else Me=128;while(!1);do if((Me|0)==128)if(p=fl(0)|0,(p|0)!=-1&&(f=p,Ae=d[7100]|0,pe=Ae+-1|0,f=((pe&f|0)==0?0:(pe+f&0-Ae)-f|0)+I|0,Ae=d[7089]|0,pe=f+Ae|0,f>>>0>ie>>>0&f>>>0<2147483647)){if(de=d[7091]|0,de|0&&pe>>>0<=Ae>>>0|pe>>>0>de>>>0){f=0;break}if(A=fl(f|0)|0,(A|0)==(p|0)){M=f,T=p,Me=145;break e}else _=A,Me=136}else f=0;while(!1);do if((Me|0)==136){if(p=0-f|0,!(N>>>0>f>>>0&(f>>>0<2147483647&(_|0)!=-1)))if((_|0)==-1){f=0;break}else{M=f,T=_,Me=145;break e}if(A=d[7101]|0,A=U-f+A&0-A,A>>>0>=2147483647){M=f,T=_,Me=145;break e}if((fl(A|0)|0)==-1){fl(p|0)|0,f=0;break}else{M=A+f|0,T=_,Me=145;break e}}while(!1);d[7092]=d[7092]|4,Me=143}while(!1);if((Me|0)==143&&I>>>0<2147483647&&(qe=fl(I|0)|0,pe=fl(0)|0,Le=pe-qe|0,Ye=Le>>>0>(ie+40|0)>>>0,!((qe|0)==-1|Ye^1|qe>>>0>>0&((qe|0)!=-1&(pe|0)!=-1)^1))&&(M=Ye?Le:f,T=qe,Me=145),(Me|0)==145){f=(d[7089]|0)+M|0,d[7089]=f,f>>>0>(d[7090]|0)>>>0&&(d[7090]=f),U=d[6987]|0;e:do if(U){for(f=28372;;){if(A=d[f>>2]|0,p=d[f+4>>2]|0,(T|0)==(A+p|0)){Me=154;break}if(_=d[f+8>>2]|0,_)f=_;else break}if((Me|0)==154&&(Fe=f+4|0,(d[f+12>>2]&8|0)==0)&&T>>>0>U>>>0&A>>>0<=U>>>0){d[Fe>>2]=p+M,Ee=(d[6984]|0)+M|0,qe=U+8|0,qe=(qe&7|0)==0?0:0-qe&7,Fe=U+qe|0,qe=Ee-qe|0,d[6987]=Fe,d[6984]=qe,d[Fe+4>>2]=qe|1,d[U+Ee+4>>2]=40,d[6988]=d[7103];break}for(T>>>0<(d[6985]|0)>>>0&&(d[6985]=T),p=T+M|0,f=28372;;){if((d[f>>2]|0)==(p|0)){Me=162;break}if(A=d[f+8>>2]|0,A)f=A;else break}if((Me|0)==162&&(d[f+12>>2]&8|0)==0){d[f>>2]=T,q=f+4|0,d[q>>2]=(d[q>>2]|0)+M,q=T+8|0,q=T+((q&7|0)==0?0:0-q&7)|0,f=p+8|0,f=p+((f&7|0)==0?0:0-f&7)|0,I=q+ie|0,N=f-q-ie|0,d[q+4>>2]=ie|3;t:do if((U|0)==(f|0))Ee=(d[6984]|0)+N|0,d[6984]=Ee,d[6987]=I,d[I+4>>2]=Ee|1;else{if((d[6986]|0)==(f|0)){Ee=(d[6983]|0)+N|0,d[6983]=Ee,d[6986]=I,d[I+4>>2]=Ee|1,d[I+Ee>>2]=Ee;break}if(A=d[f+4>>2]|0,(A&3|0)==1){M=A&-8,_=A>>>3;n:do if(A>>>0<256)if(A=d[f+8>>2]|0,p=d[f+12>>2]|0,(p|0)==(A|0)){d[6981]=d[6981]&~(1<<_);break}else{d[A+12>>2]=p,d[p+8>>2]=A;break}else{T=d[f+24>>2]|0,A=d[f+12>>2]|0;do if((A|0)==(f|0)){if(p=f+16|0,_=p+4|0,A=d[_>>2]|0,A)p=_;else if(A=d[p>>2]|0,!A){A=0;break}for(;;)if(y=A+20|0,_=d[y>>2]|0,_)A=_,p=y;else if(y=A+16|0,_=d[y>>2]|0,_)A=_,p=y;else break;d[p>>2]=0}else Ee=d[f+8>>2]|0,d[Ee+12>>2]=A,d[A+8>>2]=Ee;while(!1);if(!T)break;p=d[f+28>>2]|0,_=28228+(p<<2)|0;do if((d[_>>2]|0)!=(f|0)){if(Ee=T+16|0,d[((d[Ee>>2]|0)==(f|0)?Ee:T+20|0)>>2]=A,!A)break n}else{if(d[_>>2]=A,A|0)break;d[6982]=d[6982]&~(1<>2]=T,p=f+16|0,_=d[p>>2]|0,_|0&&(d[A+16>>2]=_,d[_+24>>2]=A),p=d[p+4>>2]|0,!p)break;d[A+20>>2]=p,d[p+24>>2]=A}while(!1);f=f+M|0,y=M+N|0}else y=N;if(f=f+4|0,d[f>>2]=d[f>>2]&-2,d[I+4>>2]=y|1,d[I+y>>2]=y,f=y>>>3,y>>>0<256){p=27964+(f<<1<<2)|0,A=d[6981]|0,f=1<>2]|0):(d[6981]=A|f,f=p,A=p+8|0),d[A>>2]=I,d[f+12>>2]=I,d[I+8>>2]=f,d[I+12>>2]=p;break}f=y>>>8;do if(!f)_=0;else{if(y>>>0>16777215){_=31;break}Fe=(f+1048320|0)>>>16&8,Ee=f<>>16&4,Ee=Ee<>>16&2,_=14-(qe|Fe|_)+(Ee<<_>>>15)|0,_=y>>>(_+7|0)&1|_<<1}while(!1);if(f=28228+(_<<2)|0,d[I+28>>2]=_,A=I+16|0,d[A+4>>2]=0,d[A>>2]=0,A=d[6982]|0,p=1<<_,!(A&p)){d[6982]=A|p,d[f>>2]=I,d[I+24>>2]=f,d[I+12>>2]=I,d[I+8>>2]=I;break}f=d[f>>2]|0;n:do if((d[f+4>>2]&-8|0)!=(y|0)){for(_=y<<((_|0)==31?0:25-(_>>>1)|0);p=f+16+(_>>>31<<2)|0,A=d[p>>2]|0,!!A;)if((d[A+4>>2]&-8|0)==(y|0)){f=A;break n}else _=_<<1,f=A;d[p>>2]=I,d[I+24>>2]=f,d[I+12>>2]=I,d[I+8>>2]=I;break t}while(!1);Fe=f+8|0,Ee=d[Fe>>2]|0,d[Ee+12>>2]=I,d[Fe>>2]=I,d[I+8>>2]=Ee,d[I+12>>2]=f,d[I+24>>2]=0}while(!1);return Ee=q+8|0,Q=Pt,Ee|0}for(f=28372;A=d[f>>2]|0,!(A>>>0<=U>>>0&&(Ee=A+(d[f+4>>2]|0)|0,Ee>>>0>U>>>0));)f=d[f+8>>2]|0;y=Ee+-47|0,A=y+8|0,A=y+((A&7|0)==0?0:0-A&7)|0,y=U+16|0,A=A>>>0>>0?U:A,f=A+8|0,p=M+-40|0,qe=T+8|0,qe=(qe&7|0)==0?0:0-qe&7,Fe=T+qe|0,qe=p-qe|0,d[6987]=Fe,d[6984]=qe,d[Fe+4>>2]=qe|1,d[T+p+4>>2]=40,d[6988]=d[7103],p=A+4|0,d[p>>2]=27,d[f>>2]=d[7093],d[f+4>>2]=d[7094],d[f+8>>2]=d[7095],d[f+12>>2]=d[7096],d[7093]=T,d[7094]=M,d[7096]=0,d[7095]=f,f=A+24|0;do Fe=f,f=f+4|0,d[f>>2]=7;while((Fe+8|0)>>>0>>0);if((A|0)!=(U|0)){if(T=A-U|0,d[p>>2]=d[p>>2]&-2,d[U+4>>2]=T|1,d[A>>2]=T,f=T>>>3,T>>>0<256){p=27964+(f<<1<<2)|0,A=d[6981]|0,f=1<>2]|0):(d[6981]=A|f,f=p,A=p+8|0),d[A>>2]=U,d[f+12>>2]=U,d[U+8>>2]=f,d[U+12>>2]=p;break}if(f=T>>>8,f?T>>>0>16777215?_=31:(Fe=(f+1048320|0)>>>16&8,Ee=f<>>16&4,Ee=Ee<>>16&2,_=14-(qe|Fe|_)+(Ee<<_>>>15)|0,_=T>>>(_+7|0)&1|_<<1):_=0,p=28228+(_<<2)|0,d[U+28>>2]=_,d[U+20>>2]=0,d[y>>2]=0,f=d[6982]|0,A=1<<_,!(f&A)){d[6982]=f|A,d[p>>2]=U,d[U+24>>2]=p,d[U+12>>2]=U,d[U+8>>2]=U;break}f=d[p>>2]|0;t:do if((d[f+4>>2]&-8|0)!=(T|0)){for(_=T<<((_|0)==31?0:25-(_>>>1)|0);p=f+16+(_>>>31<<2)|0,A=d[p>>2]|0,!!A;)if((d[A+4>>2]&-8|0)==(T|0)){f=A;break t}else _=_<<1,f=A;d[p>>2]=U,d[U+24>>2]=f,d[U+12>>2]=U,d[U+8>>2]=U;break e}while(!1);Fe=f+8|0,Ee=d[Fe>>2]|0,d[Ee+12>>2]=U,d[Fe>>2]=U,d[U+8>>2]=Ee,d[U+12>>2]=f,d[U+24>>2]=0}}else Ee=d[6985]|0,(Ee|0)==0|T>>>0>>0&&(d[6985]=T),d[7093]=T,d[7094]=M,d[7096]=0,d[6990]=d[7099],d[6989]=-1,d[6994]=27964,d[6993]=27964,d[6996]=27972,d[6995]=27972,d[6998]=27980,d[6997]=27980,d[7e3]=27988,d[6999]=27988,d[7002]=27996,d[7001]=27996,d[7004]=28004,d[7003]=28004,d[7006]=28012,d[7005]=28012,d[7008]=28020,d[7007]=28020,d[7010]=28028,d[7009]=28028,d[7012]=28036,d[7011]=28036,d[7014]=28044,d[7013]=28044,d[7016]=28052,d[7015]=28052,d[7018]=28060,d[7017]=28060,d[7020]=28068,d[7019]=28068,d[7022]=28076,d[7021]=28076,d[7024]=28084,d[7023]=28084,d[7026]=28092,d[7025]=28092,d[7028]=28100,d[7027]=28100,d[7030]=28108,d[7029]=28108,d[7032]=28116,d[7031]=28116,d[7034]=28124,d[7033]=28124,d[7036]=28132,d[7035]=28132,d[7038]=28140,d[7037]=28140,d[7040]=28148,d[7039]=28148,d[7042]=28156,d[7041]=28156,d[7044]=28164,d[7043]=28164,d[7046]=28172,d[7045]=28172,d[7048]=28180,d[7047]=28180,d[7050]=28188,d[7049]=28188,d[7052]=28196,d[7051]=28196,d[7054]=28204,d[7053]=28204,d[7056]=28212,d[7055]=28212,Ee=M+-40|0,qe=T+8|0,qe=(qe&7|0)==0?0:0-qe&7,Fe=T+qe|0,qe=Ee-qe|0,d[6987]=Fe,d[6984]=qe,d[Fe+4>>2]=qe|1,d[T+Ee+4>>2]=40,d[6988]=d[7103];while(!1);if(f=d[6984]|0,f>>>0>ie>>>0)return qe=f-ie|0,d[6984]=qe,Ee=d[6987]|0,Fe=Ee+ie|0,d[6987]=Fe,d[Fe+4>>2]=qe|1,d[Ee+4>>2]=ie|3,Ee=Ee+8|0,Q=Pt,Ee|0}return Ee=HA()|0,d[Ee>>2]=12,Ee=0,Q=Pt,Ee|0}function An(A){A=A|0;var f=0,p=0,_=0,y=0,T=0,M=0,N=0,U=0;if(A){p=A+-8|0,y=d[6985]|0,A=d[A+-4>>2]|0,f=A&-8,U=p+f|0;do if(A&1)N=p,M=p;else{if(_=d[p>>2]|0,!(A&3)||(M=p+(0-_)|0,T=_+f|0,M>>>0>>0))return;if((d[6986]|0)==(M|0)){if(A=U+4|0,f=d[A>>2]|0,(f&3|0)!=3){N=M,f=T;break}d[6983]=T,d[A>>2]=f&-2,d[M+4>>2]=T|1,d[M+T>>2]=T;return}if(p=_>>>3,_>>>0<256)if(A=d[M+8>>2]|0,f=d[M+12>>2]|0,(f|0)==(A|0)){d[6981]=d[6981]&~(1<>2]=f,d[f+8>>2]=A,N=M,f=T;break}y=d[M+24>>2]|0,A=d[M+12>>2]|0;do if((A|0)==(M|0)){if(f=M+16|0,p=f+4|0,A=d[p>>2]|0,A)f=p;else if(A=d[f>>2]|0,!A){A=0;break}for(;;)if(_=A+20|0,p=d[_>>2]|0,p)A=p,f=_;else if(_=A+16|0,p=d[_>>2]|0,p)A=p,f=_;else break;d[f>>2]=0}else N=d[M+8>>2]|0,d[N+12>>2]=A,d[A+8>>2]=N;while(!1);if(y){if(f=d[M+28>>2]|0,p=28228+(f<<2)|0,(d[p>>2]|0)==(M|0)){if(d[p>>2]=A,!A){d[6982]=d[6982]&~(1<>2]|0)==(M|0)?N:y+20|0)>>2]=A,!A){N=M,f=T;break}d[A+24>>2]=y,f=M+16|0,p=d[f>>2]|0,p|0&&(d[A+16>>2]=p,d[p+24>>2]=A),f=d[f+4>>2]|0,f?(d[A+20>>2]=f,d[f+24>>2]=A,N=M,f=T):(N=M,f=T)}else N=M,f=T}while(!1);if(!(M>>>0>=U>>>0)&&(A=U+4|0,_=d[A>>2]|0,!!(_&1))){if(_&2)d[A>>2]=_&-2,d[N+4>>2]=f|1,d[M+f>>2]=f,y=f;else{if((d[6987]|0)==(U|0)){if(U=(d[6984]|0)+f|0,d[6984]=U,d[6987]=N,d[N+4>>2]=U|1,(N|0)!=(d[6986]|0))return;d[6986]=0,d[6983]=0;return}if((d[6986]|0)==(U|0)){U=(d[6983]|0)+f|0,d[6983]=U,d[6986]=M,d[N+4>>2]=U|1,d[M+U>>2]=U;return}y=(_&-8)+f|0,p=_>>>3;do if(_>>>0<256)if(f=d[U+8>>2]|0,A=d[U+12>>2]|0,(A|0)==(f|0)){d[6981]=d[6981]&~(1<>2]=A,d[A+8>>2]=f;break}else{T=d[U+24>>2]|0,A=d[U+12>>2]|0;do if((A|0)==(U|0)){if(f=U+16|0,p=f+4|0,A=d[p>>2]|0,A)f=p;else if(A=d[f>>2]|0,!A){p=0;break}for(;;)if(_=A+20|0,p=d[_>>2]|0,p)A=p,f=_;else if(_=A+16|0,p=d[_>>2]|0,p)A=p,f=_;else break;d[f>>2]=0,p=A}else p=d[U+8>>2]|0,d[p+12>>2]=A,d[A+8>>2]=p,p=A;while(!1);if(T|0){if(A=d[U+28>>2]|0,f=28228+(A<<2)|0,(d[f>>2]|0)==(U|0)){if(d[f>>2]=p,!p){d[6982]=d[6982]&~(1<>2]|0)==(U|0)?_:T+20|0)>>2]=p,!p)break;d[p+24>>2]=T,A=U+16|0,f=d[A>>2]|0,f|0&&(d[p+16>>2]=f,d[f+24>>2]=p),A=d[A+4>>2]|0,A|0&&(d[p+20>>2]=A,d[A+24>>2]=p)}}while(!1);if(d[N+4>>2]=y|1,d[M+y>>2]=y,(N|0)==(d[6986]|0)){d[6983]=y;return}}if(A=y>>>3,y>>>0<256){p=27964+(A<<1<<2)|0,f=d[6981]|0,A=1<>2]|0):(d[6981]=f|A,A=p,f=p+8|0),d[f>>2]=N,d[A+12>>2]=N,d[N+8>>2]=A,d[N+12>>2]=p;return}A=y>>>8,A?y>>>0>16777215?_=31:(M=(A+1048320|0)>>>16&8,U=A<>>16&4,U=U<>>16&2,_=14-(T|M|_)+(U<<_>>>15)|0,_=y>>>(_+7|0)&1|_<<1):_=0,A=28228+(_<<2)|0,d[N+28>>2]=_,d[N+20>>2]=0,d[N+16>>2]=0,f=d[6982]|0,p=1<<_;e:do if(!(f&p))d[6982]=f|p,d[A>>2]=N,d[N+24>>2]=A,d[N+12>>2]=N,d[N+8>>2]=N;else{A=d[A>>2]|0;t:do if((d[A+4>>2]&-8|0)!=(y|0)){for(_=y<<((_|0)==31?0:25-(_>>>1)|0);p=A+16+(_>>>31<<2)|0,f=d[p>>2]|0,!!f;)if((d[f+4>>2]&-8|0)==(y|0)){A=f;break t}else _=_<<1,A=f;d[p>>2]=N,d[N+24>>2]=A,d[N+12>>2]=N,d[N+8>>2]=N;break e}while(!1);M=A+8|0,U=d[M>>2]|0,d[U+12>>2]=N,d[M>>2]=N,d[N+8>>2]=U,d[N+12>>2]=A,d[N+24>>2]=0}while(!1);if(U=(d[6989]|0)+-1|0,d[6989]=U,!(U|0)){for(A=28380;A=d[A>>2]|0,A;)A=A+8|0;d[6989]=-1}}}}function Ks(A,f){A=A|0,f=f|0;var p=0;return A?(p=Xe(f,A)|0,(f|A)>>>0>65535&&(p=((p>>>0)/(A>>>0)|0|0)==(f|0)?p:-1)):p=0,A=Fo(p)|0,!A||!(d[A+-4>>2]&3)||uo(A|0,0,p|0)|0,A|0}function Xt(A,f,p,_){return A=A|0,f=f|0,p=p|0,_=_|0,p=A+p>>>0,ft(f+_+(p>>>0>>0|0)>>>0|0),p|0|0}function Ur(A,f,p,_){return A=A|0,f=f|0,p=p|0,_=_|0,_=f-_-(p>>>0>A>>>0|0)>>>0,ft(_|0),A-p>>>0|0|0}function Jc(A){return A=A|0,(A?31-(qt(A^A-1)|0)|0:32)|0}function Ju(A,f,p,_,y){A=A|0,f=f|0,p=p|0,_=_|0,y=y|0;var T=0,M=0,N=0,U=0,I=0,q=0,ie=0,de=0,Ae=0,pe=0;if(q=A,U=f,I=U,M=p,de=_,N=de,!I)return T=(y|0)!=0,N?T?(d[y>>2]=A|0,d[y+4>>2]=f&0,de=0,y=0,ft(de|0),y|0):(de=0,y=0,ft(de|0),y|0):(T&&(d[y>>2]=(q>>>0)%(M>>>0),d[y+4>>2]=0),de=0,y=(q>>>0)/(M>>>0)>>>0,ft(de|0),y|0);T=(N|0)==0;do if(M){if(!T){if(T=(qt(N|0)|0)-(qt(I|0)|0)|0,T>>>0<=31){ie=T+1|0,N=31-T|0,f=T-31>>31,M=ie,A=q>>>(ie>>>0)&f|I<>>(ie>>>0)&f,T=0,N=q<>2]=A|0,d[y+4>>2]=U|f&0,de=0,y=0,ft(de|0),y|0):(de=0,y=0,ft(de|0),y|0)}if(T=M-1|0,T&M|0){N=(qt(M|0)|0)+33-(qt(I|0)|0)|0,pe=64-N|0,ie=32-N|0,U=ie>>31,Ae=N-32|0,f=Ae>>31,M=N,A=ie-1>>31&I>>>(Ae>>>0)|(I<>>(N>>>0))&f,f=f&I>>>(N>>>0),T=q<>>(Ae>>>0))&U|q<>31;break}return y|0&&(d[y>>2]=T&q,d[y+4>>2]=0),(M|0)==1?(Ae=U|f&0,pe=A|0|0,ft(Ae|0),pe|0):(pe=Jc(M|0)|0,Ae=I>>>(pe>>>0)|0,pe=I<<32-pe|q>>>(pe>>>0)|0,ft(Ae|0),pe|0)}else{if(T)return y|0&&(d[y>>2]=(I>>>0)%(M>>>0),d[y+4>>2]=0),Ae=0,pe=(I>>>0)/(M>>>0)>>>0,ft(Ae|0),pe|0;if(!q)return y|0&&(d[y>>2]=0,d[y+4>>2]=(I>>>0)%(N>>>0)),Ae=0,pe=(I>>>0)/(N>>>0)>>>0,ft(Ae|0),pe|0;if(T=N-1|0,!(T&N))return y|0&&(d[y>>2]=A|0,d[y+4>>2]=T&I|f&0),Ae=0,pe=I>>>((Jc(N|0)|0)>>>0),ft(Ae|0),pe|0;if(T=(qt(N|0)|0)-(qt(I|0)|0)|0,T>>>0<=30){f=T+1|0,N=31-T|0,M=f,A=I<>>(f>>>0),f=I>>>(f>>>0),T=0,N=q<>2]=A|0,d[y+4>>2]=U|f&0,Ae=0,pe=0,ft(Ae|0),pe|0):(Ae=0,pe=0,ft(Ae|0),pe|0)}while(!1);if(!M)I=N,U=0,N=0;else{ie=p|0|0,q=de|_&0,I=Xt(ie|0,q|0,-1,-1)|0,p=K()|0,U=N,N=0;do _=U,U=T>>>31|U<<1,T=N|T<<1,_=A<<1|_>>>31|0,de=A>>>31|f<<1|0,Ur(I|0,p|0,_|0,de|0)|0,pe=K()|0,Ae=pe>>31|((pe|0)<0?-1:0)<<1,N=Ae&1,A=Ur(_|0,de|0,Ae&ie|0,(((pe|0)<0?-1:0)>>31|((pe|0)<0?-1:0)<<1)&q|0)|0,f=K()|0,M=M-1|0;while((M|0)!=0);I=U,U=0}return M=0,y|0&&(d[y>>2]=A,d[y+4>>2]=f),Ae=(T|0)>>>31|(I|M)<<1|(M<<1|T>>>31)&0|U,pe=(T<<1|0)&-2|N,ft(Ae|0),pe|0}function ko(A,f,p,_){A=A|0,f=f|0,p=p|0,_=_|0;var y=0,T=0,M=0,N=0,U=0,I=0;return I=f>>31|((f|0)<0?-1:0)<<1,U=((f|0)<0?-1:0)>>31|((f|0)<0?-1:0)<<1,T=_>>31|((_|0)<0?-1:0)<<1,y=((_|0)<0?-1:0)>>31|((_|0)<0?-1:0)<<1,N=Ur(I^A|0,U^f|0,I|0,U|0)|0,M=K()|0,A=T^I,f=y^U,Ur((Ju(N,M,Ur(T^p|0,y^_|0,T|0,y|0)|0,K()|0,0)|0)^A|0,(K()|0)^f|0,A|0,f|0)|0}function eh(A,f){A=A|0,f=f|0;var p=0,_=0,y=0,T=0;return T=A&65535,y=f&65535,p=Xe(y,T)|0,_=A>>>16,A=(p>>>16)+(Xe(y,_)|0)|0,y=f>>>16,f=Xe(y,T)|0,ft((A>>>16)+(Xe(y,_)|0)+(((A&65535)+f|0)>>>16)|0),A+f<<16|p&65535|0|0}function fr(A,f,p,_){A=A|0,f=f|0,p=p|0,_=_|0;var y=0,T=0;return y=A,T=p,p=eh(y,T)|0,A=K()|0,ft((Xe(f,T)|0)+(Xe(_,y)|0)+A|A&0|0),p|0|0|0}function th(A,f,p,_){A=A|0,f=f|0,p=p|0,_=_|0;var y=0,T=0,M=0,N=0,U=0,I=0;return y=Q,Q=Q+16|0,N=y|0,M=f>>31|((f|0)<0?-1:0)<<1,T=((f|0)<0?-1:0)>>31|((f|0)<0?-1:0)<<1,I=_>>31|((_|0)<0?-1:0)<<1,U=((_|0)<0?-1:0)>>31|((_|0)<0?-1:0)<<1,A=Ur(M^A|0,T^f|0,M|0,T|0)|0,f=K()|0,Ju(A,f,Ur(I^p|0,U^_|0,I|0,U|0)|0,K()|0,N)|0,_=Ur(d[N>>2]^M|0,d[N+4>>2]^T|0,M|0,T|0)|0,p=K()|0,Q=y,ft(p|0),_|0}function ec(A,f,p,_){A=A|0,f=f|0,p=p|0,_=_|0;var y=0,T=0;return T=Q,Q=Q+16|0,y=T|0,Ju(A,f,p,_,y)|0,Q=T,ft(d[y+4>>2]|0),d[y>>2]|0|0}function N1(A,f,p){return A=A|0,f=f|0,p=p|0,(p|0)<32?(ft(f>>p|0),A>>>p|(f&(1<>p-32|0)}function yt(A,f,p){return A=A|0,f=f|0,p=p|0,(p|0)<32?(ft(f>>>p|0),A>>>p|(f&(1<>>p-32|0)}function Nt(A,f,p){return A=A|0,f=f|0,p=p|0,(p|0)<32?(ft(f<>>32-p|0),A<=0?+Xn(A+.5):+Qe(A-.5)}function Gl(A,f,p){A=A|0,f=f|0,p=p|0;var _=0,y=0,T=0;if((p|0)>=8192)return ui(A|0,f|0,p|0)|0,A|0;if(T=A|0,y=A+p|0,(A&3)==(f&3)){for(;A&3;){if(!p)return T|0;at[A>>0]=at[f>>0]|0,A=A+1|0,f=f+1|0,p=p-1|0}for(p=y&-4|0,_=p-64|0;(A|0)<=(_|0);)d[A>>2]=d[f>>2],d[A+4>>2]=d[f+4>>2],d[A+8>>2]=d[f+8>>2],d[A+12>>2]=d[f+12>>2],d[A+16>>2]=d[f+16>>2],d[A+20>>2]=d[f+20>>2],d[A+24>>2]=d[f+24>>2],d[A+28>>2]=d[f+28>>2],d[A+32>>2]=d[f+32>>2],d[A+36>>2]=d[f+36>>2],d[A+40>>2]=d[f+40>>2],d[A+44>>2]=d[f+44>>2],d[A+48>>2]=d[f+48>>2],d[A+52>>2]=d[f+52>>2],d[A+56>>2]=d[f+56>>2],d[A+60>>2]=d[f+60>>2],A=A+64|0,f=f+64|0;for(;(A|0)<(p|0);)d[A>>2]=d[f>>2],A=A+4|0,f=f+4|0}else for(p=y-4|0;(A|0)<(p|0);)at[A>>0]=at[f>>0]|0,at[A+1>>0]=at[f+1>>0]|0,at[A+2>>0]=at[f+2>>0]|0,at[A+3>>0]=at[f+3>>0]|0,A=A+4|0,f=f+4|0;for(;(A|0)<(y|0);)at[A>>0]=at[f>>0]|0,A=A+1|0,f=f+1|0;return T|0}function uo(A,f,p){A=A|0,f=f|0,p=p|0;var _=0,y=0,T=0,M=0;if(T=A+p|0,f=f&255,(p|0)>=67){for(;A&3;)at[A>>0]=f,A=A+1|0;for(_=T&-4|0,M=f|f<<8|f<<16|f<<24,y=_-64|0;(A|0)<=(y|0);)d[A>>2]=M,d[A+4>>2]=M,d[A+8>>2]=M,d[A+12>>2]=M,d[A+16>>2]=M,d[A+20>>2]=M,d[A+24>>2]=M,d[A+28>>2]=M,d[A+32>>2]=M,d[A+36>>2]=M,d[A+40>>2]=M,d[A+44>>2]=M,d[A+48>>2]=M,d[A+52>>2]=M,d[A+56>>2]=M,d[A+60>>2]=M,A=A+64|0;for(;(A|0)<(_|0);)d[A>>2]=M,A=A+4|0}for(;(A|0)<(T|0);)at[A>>0]=f,A=A+1|0;return T-p|0}function pf(A){return A=+A,A>=0?+Xn(A+.5):+Qe(A-.5)}function fl(A){A=A|0;var f=0,p=0,_=0;return _=fn()|0,p=d[Gn>>2]|0,f=p+A|0,(A|0)>0&(f|0)<(p|0)|(f|0)<0?(_i(f|0)|0,bn(12),-1):(f|0)>(_|0)&&!(ci(f|0)|0)?(bn(12),-1):(d[Gn>>2]=f,p|0)}return{___divdi3:ko,___muldi3:fr,___remdi3:th,___uremdi3:ec,_areNeighborCells:dx,_bitshift64Ashr:N1,_bitshift64Lshr:yt,_bitshift64Shl:Nt,_calloc:Ks,_cellAreaKm2:mp,_cellAreaM2:UA,_cellAreaRads2:Fl,_cellToBoundary:Il,_cellToCenterChild:DA,_cellToChildPos:Ap,_cellToChildren:_1,_cellToChildrenSize:lf,_cellToLatLng:Ol,_cellToLocalIj:E1,_cellToParent:Fu,_cellToVertex:Qs,_cellToVertexes:Qu,_cellsToDirectedEdge:d1,_cellsToLinkedMultiPolygon:nl,_childPosToCell:S1,_compactCells:up,_constructCell:Sx,_destroyLinkedMultiPolygon:Wu,_directedEdgeToBoundary:CA,_directedEdgeToCells:gx,_edgeLengthKm:gp,_edgeLengthM:ju,_edgeLengthRads:BA,_emscripten_replace_memory:Ln,_free:An,_getBaseCellNumber:g1,_getDirectedEdgeDestination:mx,_getDirectedEdgeOrigin:px,_getHexagonAreaAvgKm2:dp,_getHexagonAreaAvgM2:w1,_getHexagonEdgeLengthAvgKm:pp,_getHexagonEdgeLengthAvgM:oo,_getIcosahedronFaces:Gu,_getIndexDigit:bx,_getNumCells:Hu,_getPentagons:qu,_getRes0Cells:ef,_getResolution:Qc,_greatCircleDistanceKm:Zc,_greatCircleDistanceM:Mx,_greatCircleDistanceRads:T1,_gridDisk:ve,_gridDiskDistances:ot,_gridDistance:$u,_gridPathCells:C1,_gridPathCellsSize:vp,_gridRing:Yn,_gridRingUnsafe:yi,_i64Add:Xt,_i64Subtract:Ur,_isPentagon:Ci,_isResClassIII:b1,_isValidCell:NA,_isValidDirectedEdge:p1,_isValidIndex:v1,_isValidVertex:ul,_latLngToCell:PA,_llvm_ctlz_i64:ff,_llvm_maxnum_f64:Af,_llvm_minnum_f64:df,_llvm_round_f64:hl,_localIjToCell:IA,_malloc:Fo,_maxFaceCount:wx,_maxGridDiskSize:fa,_maxPolygonToCellsSize:Pr,_maxPolygonToCellsSizeExperimental:cf,_memcpy:Gl,_memset:uo,_originToDirectedEdges:vx,_pentagonCount:fp,_polygonToCells:Zh,_polygonToCellsExperimental:kA,_readInt64AsDoubleFromPointer:yp,_res0CellCount:s1,_round:pf,_sbrk:fl,_sizeOfCellBoundary:fs,_sizeOfCoordIJ:Pa,_sizeOfGeoLoop:sr,_sizeOfGeoPolygon:mi,_sizeOfH3Index:_p,_sizeOfLatLng:R1,_sizeOfLinkedGeoPolygon:kl,_uncompactCells:y1,_uncompactCellsSize:x1,_vertexToLatLng:ll,establishStackSpace:bs,stackAlloc:mn,stackRestore:hi,stackSave:yr}})(In,Mi,X);e.___divdi3=me.___divdi3,e.___muldi3=me.___muldi3,e.___remdi3=me.___remdi3,e.___uremdi3=me.___uremdi3,e._areNeighborCells=me._areNeighborCells,e._bitshift64Ashr=me._bitshift64Ashr,e._bitshift64Lshr=me._bitshift64Lshr,e._bitshift64Shl=me._bitshift64Shl,e._calloc=me._calloc,e._cellAreaKm2=me._cellAreaKm2,e._cellAreaM2=me._cellAreaM2,e._cellAreaRads2=me._cellAreaRads2,e._cellToBoundary=me._cellToBoundary,e._cellToCenterChild=me._cellToCenterChild,e._cellToChildPos=me._cellToChildPos,e._cellToChildren=me._cellToChildren,e._cellToChildrenSize=me._cellToChildrenSize,e._cellToLatLng=me._cellToLatLng,e._cellToLocalIj=me._cellToLocalIj,e._cellToParent=me._cellToParent,e._cellToVertex=me._cellToVertex,e._cellToVertexes=me._cellToVertexes,e._cellsToDirectedEdge=me._cellsToDirectedEdge,e._cellsToLinkedMultiPolygon=me._cellsToLinkedMultiPolygon,e._childPosToCell=me._childPosToCell,e._compactCells=me._compactCells,e._constructCell=me._constructCell,e._destroyLinkedMultiPolygon=me._destroyLinkedMultiPolygon,e._directedEdgeToBoundary=me._directedEdgeToBoundary,e._directedEdgeToCells=me._directedEdgeToCells,e._edgeLengthKm=me._edgeLengthKm,e._edgeLengthM=me._edgeLengthM,e._edgeLengthRads=me._edgeLengthRads;var jt=e._emscripten_replace_memory=me._emscripten_replace_memory;e._free=me._free,e._getBaseCellNumber=me._getBaseCellNumber,e._getDirectedEdgeDestination=me._getDirectedEdgeDestination,e._getDirectedEdgeOrigin=me._getDirectedEdgeOrigin,e._getHexagonAreaAvgKm2=me._getHexagonAreaAvgKm2,e._getHexagonAreaAvgM2=me._getHexagonAreaAvgM2,e._getHexagonEdgeLengthAvgKm=me._getHexagonEdgeLengthAvgKm,e._getHexagonEdgeLengthAvgM=me._getHexagonEdgeLengthAvgM,e._getIcosahedronFaces=me._getIcosahedronFaces,e._getIndexDigit=me._getIndexDigit,e._getNumCells=me._getNumCells,e._getPentagons=me._getPentagons,e._getRes0Cells=me._getRes0Cells,e._getResolution=me._getResolution,e._greatCircleDistanceKm=me._greatCircleDistanceKm,e._greatCircleDistanceM=me._greatCircleDistanceM,e._greatCircleDistanceRads=me._greatCircleDistanceRads,e._gridDisk=me._gridDisk,e._gridDiskDistances=me._gridDiskDistances,e._gridDistance=me._gridDistance,e._gridPathCells=me._gridPathCells,e._gridPathCellsSize=me._gridPathCellsSize,e._gridRing=me._gridRing,e._gridRingUnsafe=me._gridRingUnsafe,e._i64Add=me._i64Add,e._i64Subtract=me._i64Subtract,e._isPentagon=me._isPentagon,e._isResClassIII=me._isResClassIII,e._isValidCell=me._isValidCell,e._isValidDirectedEdge=me._isValidDirectedEdge,e._isValidIndex=me._isValidIndex,e._isValidVertex=me._isValidVertex,e._latLngToCell=me._latLngToCell,e._llvm_ctlz_i64=me._llvm_ctlz_i64,e._llvm_maxnum_f64=me._llvm_maxnum_f64,e._llvm_minnum_f64=me._llvm_minnum_f64,e._llvm_round_f64=me._llvm_round_f64,e._localIjToCell=me._localIjToCell,e._malloc=me._malloc,e._maxFaceCount=me._maxFaceCount,e._maxGridDiskSize=me._maxGridDiskSize,e._maxPolygonToCellsSize=me._maxPolygonToCellsSize,e._maxPolygonToCellsSizeExperimental=me._maxPolygonToCellsSizeExperimental,e._memcpy=me._memcpy,e._memset=me._memset,e._originToDirectedEdges=me._originToDirectedEdges,e._pentagonCount=me._pentagonCount,e._polygonToCells=me._polygonToCells,e._polygonToCellsExperimental=me._polygonToCellsExperimental,e._readInt64AsDoubleFromPointer=me._readInt64AsDoubleFromPointer,e._res0CellCount=me._res0CellCount,e._round=me._round,e._sbrk=me._sbrk,e._sizeOfCellBoundary=me._sizeOfCellBoundary,e._sizeOfCoordIJ=me._sizeOfCoordIJ,e._sizeOfGeoLoop=me._sizeOfGeoLoop,e._sizeOfGeoPolygon=me._sizeOfGeoPolygon,e._sizeOfH3Index=me._sizeOfH3Index,e._sizeOfLatLng=me._sizeOfLatLng,e._sizeOfLinkedGeoPolygon=me._sizeOfLinkedGeoPolygon,e._uncompactCells=me._uncompactCells,e._uncompactCellsSize=me._uncompactCellsSize,e._vertexToLatLng=me._vertexToLatLng,e.establishStackSpace=me.establishStackSpace;var rt=e.stackAlloc=me.stackAlloc,_t=e.stackRestore=me.stackRestore,$t=e.stackSave=me.stackSave;if(e.asm=me,e.cwrap=L,e.setValue=S,e.getValue=w,fe){Ce(fe)||(fe=s(fe));{tn();var kt=function(Ze){Ze.byteLength&&(Ze=new Uint8Array(Ze)),te.set(Ze,x),e.memoryInitializerRequest&&delete e.memoryInitializerRequest.response,bt()},xn=function(){a(fe,kt,function(){throw"could not load memory initializer "+fe})},qi=Gt(fe);if(qi)kt(qi.buffer);else if(e.memoryInitializerRequest){var rr=function(){var Ze=e.memoryInitializerRequest,pt=Ze.response;if(Ze.status!==200&&Ze.status!==0){var It=Gt(e.memoryInitializerRequestURL);if(It)pt=It.buffer;else{console.warn("a problem seems to have happened with Module.memoryInitializerRequest, status: "+Ze.status+", retrying "+fe),xn();return}}kt(pt)};e.memoryInitializerRequest.response?setTimeout(rr,0):e.memoryInitializerRequest.addEventListener("load",rr)}else xn()}}var pn;wt=function Ze(){pn||$i(),pn||(wt=Ze)};function $i(Ze){if(Dt>0||(De(),Dt>0))return;function pt(){pn||(pn=!0,!R&&(dt(),vt(),e.onRuntimeInitialized&&e.onRuntimeInitialized(),Tt()))}e.setStatus?(e.setStatus("Running..."),setTimeout(function(){setTimeout(function(){e.setStatus("")},1),pt()},1)):pt()}e.run=$i;function Jr(Ze){throw e.onAbort&&e.onAbort(Ze),Ze+="",l(Ze),u(Ze),R=!0,"abort("+Ze+"). Build with -s ASSERTIONS=1 for more info."}if(e.abort=Jr,e.preInit)for(typeof e.preInit=="function"&&(e.preInit=[e.preInit]);e.preInit.length>0;)e.preInit.pop()();return $i(),i})(typeof Si=="object"?Si:{}),Nn="number",Cn=Nn,Md=Nn,Bn=Nn,On=Nn,Cs=Nn,en=Nn,ZK=[["sizeOfH3Index",Nn],["sizeOfLatLng",Nn],["sizeOfCellBoundary",Nn],["sizeOfGeoLoop",Nn],["sizeOfGeoPolygon",Nn],["sizeOfLinkedGeoPolygon",Nn],["sizeOfCoordIJ",Nn],["readInt64AsDoubleFromPointer",Nn],["isValidCell",Md,[Bn,On]],["isValidIndex",Md,[Bn,On]],["latLngToCell",Cn,[Nn,Nn,Cs,en]],["cellToLatLng",Cn,[Bn,On,en]],["cellToBoundary",Cn,[Bn,On,en]],["maxGridDiskSize",Cn,[Nn,en]],["gridDisk",Cn,[Bn,On,Nn,en]],["gridDiskDistances",Cn,[Bn,On,Nn,en,en]],["gridRing",Cn,[Bn,On,Nn,en]],["gridRingUnsafe",Cn,[Bn,On,Nn,en]],["maxPolygonToCellsSize",Cn,[en,Cs,Nn,en]],["polygonToCells",Cn,[en,Cs,Nn,en]],["maxPolygonToCellsSizeExperimental",Cn,[en,Cs,Nn,en]],["polygonToCellsExperimental",Cn,[en,Cs,Nn,Nn,Nn,en]],["cellsToLinkedMultiPolygon",Cn,[en,Nn,en]],["destroyLinkedMultiPolygon",null,[en]],["compactCells",Cn,[en,en,Nn,Nn]],["uncompactCells",Cn,[en,Nn,Nn,en,Nn,Cs]],["uncompactCellsSize",Cn,[en,Nn,Nn,Cs,en]],["isPentagon",Md,[Bn,On]],["isResClassIII",Md,[Bn,On]],["getBaseCellNumber",Nn,[Bn,On]],["getResolution",Nn,[Bn,On]],["getIndexDigit",Nn,[Bn,On,Nn]],["constructCell",Cn,[Nn,Nn,en,en]],["maxFaceCount",Cn,[Bn,On,en]],["getIcosahedronFaces",Cn,[Bn,On,en]],["cellToParent",Cn,[Bn,On,Cs,en]],["cellToChildren",Cn,[Bn,On,Cs,en]],["cellToCenterChild",Cn,[Bn,On,Cs,en]],["cellToChildrenSize",Cn,[Bn,On,Cs,en]],["cellToChildPos",Cn,[Bn,On,Cs,en]],["childPosToCell",Cn,[Nn,Nn,Bn,On,Cs,en]],["areNeighborCells",Cn,[Bn,On,Bn,On,en]],["cellsToDirectedEdge",Cn,[Bn,On,Bn,On,en]],["getDirectedEdgeOrigin",Cn,[Bn,On,en]],["getDirectedEdgeDestination",Cn,[Bn,On,en]],["isValidDirectedEdge",Md,[Bn,On]],["directedEdgeToCells",Cn,[Bn,On,en]],["originToDirectedEdges",Cn,[Bn,On,en]],["directedEdgeToBoundary",Cn,[Bn,On,en]],["gridDistance",Cn,[Bn,On,Bn,On,en]],["gridPathCells",Cn,[Bn,On,Bn,On,en]],["gridPathCellsSize",Cn,[Bn,On,Bn,On,en]],["cellToLocalIj",Cn,[Bn,On,Bn,On,Nn,en]],["localIjToCell",Cn,[Bn,On,en,Nn,en]],["getHexagonAreaAvgM2",Cn,[Cs,en]],["getHexagonAreaAvgKm2",Cn,[Cs,en]],["getHexagonEdgeLengthAvgM",Cn,[Cs,en]],["getHexagonEdgeLengthAvgKm",Cn,[Cs,en]],["greatCircleDistanceM",Nn,[en,en]],["greatCircleDistanceKm",Nn,[en,en]],["greatCircleDistanceRads",Nn,[en,en]],["cellAreaM2",Cn,[Bn,On,en]],["cellAreaKm2",Cn,[Bn,On,en]],["cellAreaRads2",Cn,[Bn,On,en]],["edgeLengthM",Cn,[Bn,On,en]],["edgeLengthKm",Cn,[Bn,On,en]],["edgeLengthRads",Cn,[Bn,On,en]],["getNumCells",Cn,[Cs,en]],["getRes0Cells",Cn,[en]],["res0CellCount",Nn],["getPentagons",Cn,[Nn,en]],["pentagonCount",Nn],["cellToVertex",Cn,[Bn,On,Nn,en]],["cellToVertexes",Cn,[Bn,On,en]],["vertexToLatLng",Cn,[Bn,On,en]],["isValidVertex",Md,[Bn,On]]],JK=0,eZ=1,tZ=2,nZ=3,_P=4,iZ=5,rZ=6,sZ=7,aZ=8,oZ=9,lZ=10,uZ=11,cZ=12,hZ=13,fZ=14,AZ=15,dZ=16,pZ=17,mZ=18,gZ=19,Kr={};Kr[JK]="Success";Kr[eZ]="The operation failed but a more specific error is not available";Kr[tZ]="Argument was outside of acceptable range";Kr[nZ]="Latitude or longitude arguments were outside of acceptable range";Kr[_P]="Resolution argument was outside of acceptable range";Kr[iZ]="Cell argument was not valid";Kr[rZ]="Directed edge argument was not valid";Kr[sZ]="Undirected edge argument was not valid";Kr[aZ]="Vertex argument was not valid";Kr[oZ]="Pentagon distortion was encountered";Kr[lZ]="Duplicate input";Kr[uZ]="Cell arguments were not neighbors";Kr[cZ]="Cell arguments had incompatible resolutions";Kr[hZ]="Memory allocation failed";Kr[fZ]="Bounds of provided memory were insufficient";Kr[AZ]="Mode or flags argument was not valid";Kr[dZ]="Index argument was not valid";Kr[pZ]="Base cell number was outside of acceptable range";Kr[mZ]="Child indexing digits invalid";Kr[gZ]="Child indexing digits refer to a deleted subsequence";var vZ=1e3,yP=1001,xP=1002,Ry={};Ry[vZ]="Unknown unit";Ry[yP]="Array length out of bounds";Ry[xP]="Got unexpected null value for H3 index";var _Z="Unknown error";function bP(i,e,t){var n=t&&"value"in t,r=new Error((i[e]||_Z)+" (code: "+e+(n?", value: "+t.value:"")+")");return r.code=e,r}function SP(i,e){var t=arguments.length===2?{value:e}:{};return bP(Kr,i,t)}function TP(i,e){var t=arguments.length===2?{value:e}:{};return bP(Ry,i,t)}function vg(i){if(i!==0)throw SP(i)}var eo={};ZK.forEach(function(e){eo[e[0]]=Si.cwrap.apply(Si,e)});var Xd=16,_g=4,U0=8,yZ=8,j_=eo.sizeOfH3Index(),wM=eo.sizeOfLatLng(),xZ=eo.sizeOfCellBoundary(),bZ=eo.sizeOfGeoPolygon(),Lm=eo.sizeOfGeoLoop();eo.sizeOfLinkedGeoPolygon();eo.sizeOfCoordIJ();function SZ(i){if(typeof i!="number"||i<0||i>15||Math.floor(i)!==i)throw SP(_P,i);return i}function TZ(i){if(!i)throw TP(xP);return i}var wZ=Math.pow(2,32)-1;function MZ(i){if(i>wZ)throw TP(yP,i);return i}var EZ=/[^0-9a-fA-F]/;function wP(i){if(Array.isArray(i)&&i.length===2&&Number.isInteger(i[0])&&Number.isInteger(i[1]))return i;if(typeof i!="string"||EZ.test(i))return[0,0];var e=parseInt(i.substring(0,i.length-8),Xd),t=parseInt(i.substring(i.length-8),Xd);return[t,e]}function MR(i){if(i>=0)return i.toString(Xd);i=i&2147483647;var e=MP(8,i.toString(Xd)),t=(parseInt(e[0],Xd)+8).toString(Xd);return e=t+e.substring(1),e}function CZ(i,e){return MR(e)+MP(8,MR(i))}function MP(i,e){for(var t=i-e.length,n="",r=0;r0){l=Si._calloc(t,Lm);for(var u=0;u0){for(var a=Si.getValue(i+n,"i32"),l=0;l0&&arguments[0]!==void 0?arguments[0]:[],e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1,r=(e instanceof Array?e.length?e:[void 0]:[e]).map(function(l){return{keyAccessor:l,isProp:!(l instanceof Function)}}),s=i.reduce(function(l,u){var h=l,g=u;return r.forEach(function(v,x){var S=v.keyAccessor,w=v.isProp,R;if(w){var C=g,E=C[S],B=jK(C,[S].map(QK));R=E,g=B}else R=S(g,x);x+11&&arguments[1]!==void 0?arguments[1]:1;h===r.length?Object.keys(u).forEach(function(g){return u[g]=t(u[g])}):Object.values(u).forEach(function(g){return l(g,h+1)})})(s);var a=s;return n&&(a=[],(function l(u){var h=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];h.length===r.length?a.push({keys:h,vals:u}):Object.entries(u).forEach(function(g){var v=$K(g,2),x=v[0],S=v[1];return l(S,[].concat(XK(h),[x]))})})(s),e instanceof Array&&e.length===0&&a.length===1&&(a[0].keys=[])),a}),Si=(function(i){i=i||{};var e=typeof i<"u"?i:{},t={},n;for(n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);var r="";function s(Ze){return e.locateFile?e.locateFile(Ze,r):r+Ze}var a;typeof document<"u"&&document.currentScript&&(r=document.currentScript.src),r.indexOf("blob:")!==0?r=r.substr(0,r.lastIndexOf("/")+1):r="",a=function(mt,It,at){var d=new XMLHttpRequest;d.open("GET",mt,!0),d.responseType="arraybuffer",d.onload=function(){if(d.status==200||d.status==0&&d.response){It(d.response);return}var $n=Gt(mt);if($n){It($n.buffer);return}at()},d.onerror=at,d.send(null)};var l=e.print||console.log.bind(console),u=e.printErr||console.warn.bind(console);for(n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);t=null,e.arguments&&e.arguments;var h=0,g=function(Ze){h=Ze},v=function(){return h},x=8;function S(Ze,mt,It,at){switch(It=It||"i8",It.charAt(It.length-1)==="*"&&(It="i32"),It){case"i1":J[Ze>>0]=mt;break;case"i8":J[Ze>>0]=mt;break;case"i16":se[Ze>>1]=mt;break;case"i32":ne[Ze>>2]=mt;break;case"i64":it=[mt>>>0,($e=mt,+ke($e)>=1?$e>0?(lt(+Mt($e/4294967296),4294967295)|0)>>>0:~~+oe(($e-+(~~$e>>>0))/4294967296)>>>0:0)],ne[Ze>>2]=it[0],ne[Ze+4>>2]=it[1];break;case"float":Z[Ze>>2]=mt;break;case"double":ue[Ze>>3]=mt;break;default:Jr("invalid type for setValue: "+It)}}function w(Ze,mt,It){switch(mt=mt||"i8",mt.charAt(mt.length-1)==="*"&&(mt="i32"),mt){case"i1":return J[Ze>>0];case"i8":return J[Ze>>0];case"i16":return se[Ze>>1];case"i32":return ne[Ze>>2];case"i64":return ne[Ze>>2];case"float":return Z[Ze>>2];case"double":return ue[Ze>>3];default:Jr("invalid type for getValue: "+mt)}return null}var R=!1;function C(Ze,mt){Ze||Jr("Assertion failed: "+mt)}function E(Ze){var mt=e["_"+Ze];return C(mt,"Cannot call unknown function "+Ze+", make sure it is exported"),mt}function B(Ze,mt,It,at,d){var ee={string:function(Fn){var cs=0;if(Fn!=null&&Fn!==0){var Ma=(Fn.length<<2)+1;cs=rt(Ma),H(Fn,cs,Ma)}return cs},array:function(Fn){var cs=rt(Fn.length);return F(Fn,cs),cs}};function $n(Fn){return mt==="string"?G(Fn):mt==="boolean"?!!Fn:Fn}var Gn=E(Ze),Xn=[],un=0;if(at)for(var qn=0;qn=at);)++d;if(d-mt>16&&Ze.subarray&&O)return O.decode(Ze.subarray(mt,d));for(var ee="";mt>10,56320|un&1023)}}return ee}function G(Ze,mt){return Ze?z(te,Ze,mt):""}function k(Ze,mt,It,at){if(!(at>0))return 0;for(var d=It,ee=It+at-1,$n=0;$n=55296&&Gn<=57343){var Xn=Ze.charCodeAt(++$n);Gn=65536+((Gn&1023)<<10)|Xn&1023}if(Gn<=127){if(It>=ee)break;mt[It++]=Gn}else if(Gn<=2047){if(It+1>=ee)break;mt[It++]=192|Gn>>6,mt[It++]=128|Gn&63}else if(Gn<=65535){if(It+2>=ee)break;mt[It++]=224|Gn>>12,mt[It++]=128|Gn>>6&63,mt[It++]=128|Gn&63}else{if(It+3>=ee)break;mt[It++]=240|Gn>>18,mt[It++]=128|Gn>>12&63,mt[It++]=128|Gn>>6&63,mt[It++]=128|Gn&63}}return mt[It]=0,It-d}function H(Ze,mt,It){return k(Ze,te,mt,It)}typeof TextDecoder<"u"&&new TextDecoder("utf-16le");function F(Ze,mt){J.set(Ze,mt)}function V(Ze,mt){return Ze%mt>0&&(Ze+=mt-Ze%mt),Ze}var X,J,te,se,ne,Z,ue;function he(Ze){X=Ze,e.HEAP8=J=new Int8Array(Ze),e.HEAP16=se=new Int16Array(Ze),e.HEAP32=ne=new Int32Array(Ze),e.HEAPU8=te=new Uint8Array(Ze),e.HEAPU16=new Uint16Array(Ze),e.HEAPU32=new Uint32Array(Ze),e.HEAPF32=Z=new Float32Array(Ze),e.HEAPF64=ue=new Float64Array(Ze)}var be=5271536,Se=28624,le=e.TOTAL_MEMORY||33554432;e.buffer?X=e.buffer:X=new ArrayBuffer(le),le=X.byteLength,he(X),ne[Se>>2]=be;function we(Ze){for(;Ze.length>0;){var mt=Ze.shift();if(typeof mt=="function"){mt();continue}var It=mt.func;typeof It=="number"?mt.arg===void 0?e.dynCall_v(It):e.dynCall_vi(It,mt.arg):It(mt.arg===void 0?null:mt.arg)}}var We=[],Te=[],ze=[],_e=[];function De(){if(e.preRun)for(typeof e.preRun=="function"&&(e.preRun=[e.preRun]);e.preRun.length;)Ge(e.preRun.shift());we(We)}function pt(){we(Te)}function _t(){we(ze)}function wt(){if(e.postRun)for(typeof e.postRun=="function"&&(e.postRun=[e.postRun]);e.postRun.length;)Be(e.postRun.shift());we(_e)}function Ge(Ze){We.unshift(Ze)}function Be(Ze){_e.unshift(Ze)}var ke=Math.abs,oe=Math.ceil,Mt=Math.floor,lt=Math.min,Dt=0,ut=null;function en(Ze){Dt++,e.monitorRunDependencies&&e.monitorRunDependencies(Dt)}function St(Ze){if(Dt--,e.monitorRunDependencies&&e.monitorRunDependencies(Dt),Dt==0&&ut){var mt=ut;ut=null,mt()}}e.preloadedImages={},e.preloadedAudios={};var fe=null,Y="data:application/octet-stream;base64,";function Ce(Ze){return String.prototype.startsWith?Ze.startsWith(Y):Ze.indexOf(Y)===0}var $e,it;fe="data:application/octet-stream;base64,AAAAAAAAAAAAAAAAAQAAAAIAAAADAAAABAAAAAUAAAAGAAAAAQAAAAQAAAADAAAABgAAAAUAAAACAAAAAAAAAAIAAAADAAAAAQAAAAQAAAAGAAAAAAAAAAUAAAADAAAABgAAAAQAAAAFAAAAAAAAAAEAAAACAAAABAAAAAUAAAAGAAAAAAAAAAIAAAADAAAAAQAAAAUAAAACAAAAAAAAAAEAAAADAAAABgAAAAQAAAAGAAAAAAAAAAUAAAACAAAAAQAAAAQAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAEAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAIAAAADAAAAAAAAAAAAAAACAAAAAAAAAAEAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAABAAAAAYAAAAAAAAABQAAAAAAAAAAAAAABAAAAAUAAAAAAAAAAAAAAAAAAAACAAAAAAAAAAYAAAAAAAAABgAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAgAAAAMAAAAEAAAABQAAAAYAAAABAAAAAgAAAAMAAAAEAAAABQAAAAYAAAAAAAAAAgAAAAMAAAAEAAAABQAAAAYAAAAAAAAAAQAAAAMAAAAEAAAABQAAAAYAAAAAAAAAAQAAAAIAAAAEAAAABQAAAAYAAAAAAAAAAQAAAAIAAAADAAAABQAAAAYAAAAAAAAAAQAAAAIAAAADAAAABAAAAAYAAAAAAAAAAQAAAAIAAAADAAAABAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAwAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAgAAAAIAAAAAAAAAAAAAAAYAAAAAAAAAAwAAAAIAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAFAAAABAAAAAAAAAABAAAAAAAAAAAAAAAFAAAABQAAAAAAAAAAAAAAAAAAAAYAAAAAAAAABAAAAAAAAAAGAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAFAAAAAgAAAAQAAAADAAAACAAAAAEAAAAHAAAABgAAAAkAAAAAAAAAAwAAAAIAAAACAAAABgAAAAoAAAALAAAAAAAAAAEAAAAFAAAAAwAAAA0AAAABAAAABwAAAAQAAAAMAAAAAAAAAAQAAAB/AAAADwAAAAgAAAADAAAAAAAAAAwAAAAFAAAAAgAAABIAAAAKAAAACAAAAAAAAAAQAAAABgAAAA4AAAALAAAAEQAAAAEAAAAJAAAAAgAAAAcAAAAVAAAACQAAABMAAAADAAAADQAAAAEAAAAIAAAABQAAABYAAAAQAAAABAAAAAAAAAAPAAAACQAAABMAAAAOAAAAFAAAAAEAAAAHAAAABgAAAAoAAAALAAAAGAAAABcAAAAFAAAAAgAAABIAAAALAAAAEQAAABcAAAAZAAAAAgAAAAYAAAAKAAAADAAAABwAAAANAAAAGgAAAAQAAAAPAAAAAwAAAA0AAAAaAAAAFQAAAB0AAAADAAAADAAAAAcAAAAOAAAAfwAAABEAAAAbAAAACQAAABQAAAAGAAAADwAAABYAAAAcAAAAHwAAAAQAAAAIAAAADAAAABAAAAASAAAAIQAAAB4AAAAIAAAABQAAABYAAAARAAAACwAAAA4AAAAGAAAAIwAAABkAAAAbAAAAEgAAABgAAAAeAAAAIAAAAAUAAAAKAAAAEAAAABMAAAAiAAAAFAAAACQAAAAHAAAAFQAAAAkAAAAUAAAADgAAABMAAAAJAAAAKAAAABsAAAAkAAAAFQAAACYAAAATAAAAIgAAAA0AAAAdAAAABwAAABYAAAAQAAAAKQAAACEAAAAPAAAACAAAAB8AAAAXAAAAGAAAAAsAAAAKAAAAJwAAACUAAAAZAAAAGAAAAH8AAAAgAAAAJQAAAAoAAAAXAAAAEgAAABkAAAAXAAAAEQAAAAsAAAAtAAAAJwAAACMAAAAaAAAAKgAAAB0AAAArAAAADAAAABwAAAANAAAAGwAAACgAAAAjAAAALgAAAA4AAAAUAAAAEQAAABwAAAAfAAAAKgAAACwAAAAMAAAADwAAABoAAAAdAAAAKwAAACYAAAAvAAAADQAAABoAAAAVAAAAHgAAACAAAAAwAAAAMgAAABAAAAASAAAAIQAAAB8AAAApAAAALAAAADUAAAAPAAAAFgAAABwAAAAgAAAAHgAAABgAAAASAAAANAAAADIAAAAlAAAAIQAAAB4AAAAxAAAAMAAAABYAAAAQAAAAKQAAACIAAAATAAAAJgAAABUAAAA2AAAAJAAAADMAAAAjAAAALgAAAC0AAAA4AAAAEQAAABsAAAAZAAAAJAAAABQAAAAiAAAAEwAAADcAAAAoAAAANgAAACUAAAAnAAAANAAAADkAAAAYAAAAFwAAACAAAAAmAAAAfwAAACIAAAAzAAAAHQAAAC8AAAAVAAAAJwAAACUAAAAZAAAAFwAAADsAAAA5AAAALQAAACgAAAAbAAAAJAAAABQAAAA8AAAALgAAADcAAAApAAAAMQAAADUAAAA9AAAAFgAAACEAAAAfAAAAKgAAADoAAAArAAAAPgAAABwAAAAsAAAAGgAAACsAAAA+AAAALwAAAEAAAAAaAAAAKgAAAB0AAAAsAAAANQAAADoAAABBAAAAHAAAAB8AAAAqAAAALQAAACcAAAAjAAAAGQAAAD8AAAA7AAAAOAAAAC4AAAA8AAAAOAAAAEQAAAAbAAAAKAAAACMAAAAvAAAAJgAAACsAAAAdAAAARQAAADMAAABAAAAAMAAAADEAAAAeAAAAIQAAAEMAAABCAAAAMgAAADEAAAB/AAAAPQAAAEIAAAAhAAAAMAAAACkAAAAyAAAAMAAAACAAAAAeAAAARgAAAEMAAAA0AAAAMwAAAEUAAAA2AAAARwAAACYAAAAvAAAAIgAAADQAAAA5AAAARgAAAEoAAAAgAAAAJQAAADIAAAA1AAAAPQAAAEEAAABLAAAAHwAAACkAAAAsAAAANgAAAEcAAAA3AAAASQAAACIAAAAzAAAAJAAAADcAAAAoAAAANgAAACQAAABIAAAAPAAAAEkAAAA4AAAARAAAAD8AAABNAAAAIwAAAC4AAAAtAAAAOQAAADsAAABKAAAATgAAACUAAAAnAAAANAAAADoAAAB/AAAAPgAAAEwAAAAsAAAAQQAAACoAAAA7AAAAPwAAAE4AAABPAAAAJwAAAC0AAAA5AAAAPAAAAEgAAABEAAAAUAAAACgAAAA3AAAALgAAAD0AAAA1AAAAMQAAACkAAABRAAAASwAAAEIAAAA+AAAAKwAAADoAAAAqAAAAUgAAAEAAAABMAAAAPwAAAH8AAAA4AAAALQAAAE8AAAA7AAAATQAAAEAAAAAvAAAAPgAAACsAAABUAAAARQAAAFIAAABBAAAAOgAAADUAAAAsAAAAVgAAAEwAAABLAAAAQgAAAEMAAABRAAAAVQAAADEAAAAwAAAAPQAAAEMAAABCAAAAMgAAADAAAABXAAAAVQAAAEYAAABEAAAAOAAAADwAAAAuAAAAWgAAAE0AAABQAAAARQAAADMAAABAAAAALwAAAFkAAABHAAAAVAAAAEYAAABDAAAANAAAADIAAABTAAAAVwAAAEoAAABHAAAAWQAAAEkAAABbAAAAMwAAAEUAAAA2AAAASAAAAH8AAABJAAAANwAAAFAAAAA8AAAAWAAAAEkAAABbAAAASAAAAFgAAAA2AAAARwAAADcAAABKAAAATgAAAFMAAABcAAAANAAAADkAAABGAAAASwAAAEEAAAA9AAAANQAAAF4AAABWAAAAUQAAAEwAAABWAAAAUgAAAGAAAAA6AAAAQQAAAD4AAABNAAAAPwAAAEQAAAA4AAAAXQAAAE8AAABaAAAATgAAAEoAAAA7AAAAOQAAAF8AAABcAAAATwAAAE8AAABOAAAAPwAAADsAAABdAAAAXwAAAE0AAABQAAAARAAAAEgAAAA8AAAAYwAAAFoAAABYAAAAUQAAAFUAAABeAAAAZQAAAD0AAABCAAAASwAAAFIAAABgAAAAVAAAAGIAAAA+AAAATAAAAEAAAABTAAAAfwAAAEoAAABGAAAAZAAAAFcAAABcAAAAVAAAAEUAAABSAAAAQAAAAGEAAABZAAAAYgAAAFUAAABXAAAAZQAAAGYAAABCAAAAQwAAAFEAAABWAAAATAAAAEsAAABBAAAAaAAAAGAAAABeAAAAVwAAAFMAAABmAAAAZAAAAEMAAABGAAAAVQAAAFgAAABIAAAAWwAAAEkAAABjAAAAUAAAAGkAAABZAAAAYQAAAFsAAABnAAAARQAAAFQAAABHAAAAWgAAAE0AAABQAAAARAAAAGoAAABdAAAAYwAAAFsAAABJAAAAWQAAAEcAAABpAAAAWAAAAGcAAABcAAAAUwAAAE4AAABKAAAAbAAAAGQAAABfAAAAXQAAAE8AAABaAAAATQAAAG0AAABfAAAAagAAAF4AAABWAAAAUQAAAEsAAABrAAAAaAAAAGUAAABfAAAAXAAAAE8AAABOAAAAbQAAAGwAAABdAAAAYAAAAGgAAABiAAAAbgAAAEwAAABWAAAAUgAAAGEAAAB/AAAAYgAAAFQAAABnAAAAWQAAAG8AAABiAAAAbgAAAGEAAABvAAAAUgAAAGAAAABUAAAAYwAAAFAAAABpAAAAWAAAAGoAAABaAAAAcQAAAGQAAABmAAAAUwAAAFcAAABsAAAAcgAAAFwAAABlAAAAZgAAAGsAAABwAAAAUQAAAFUAAABeAAAAZgAAAGUAAABXAAAAVQAAAHIAAABwAAAAZAAAAGcAAABbAAAAYQAAAFkAAAB0AAAAaQAAAG8AAABoAAAAawAAAG4AAABzAAAAVgAAAF4AAABgAAAAaQAAAFgAAABnAAAAWwAAAHEAAABjAAAAdAAAAGoAAABdAAAAYwAAAFoAAAB1AAAAbQAAAHEAAABrAAAAfwAAAGUAAABeAAAAcwAAAGgAAABwAAAAbAAAAGQAAABfAAAAXAAAAHYAAAByAAAAbQAAAG0AAABsAAAAXQAAAF8AAAB1AAAAdgAAAGoAAABuAAAAYgAAAGgAAABgAAAAdwAAAG8AAABzAAAAbwAAAGEAAABuAAAAYgAAAHQAAABnAAAAdwAAAHAAAABrAAAAZgAAAGUAAAB4AAAAcwAAAHIAAABxAAAAYwAAAHQAAABpAAAAdQAAAGoAAAB5AAAAcgAAAHAAAABkAAAAZgAAAHYAAAB4AAAAbAAAAHMAAABuAAAAawAAAGgAAAB4AAAAdwAAAHAAAAB0AAAAZwAAAHcAAABvAAAAcQAAAGkAAAB5AAAAdQAAAH8AAABtAAAAdgAAAHEAAAB5AAAAagAAAHYAAAB4AAAAbAAAAHIAAAB1AAAAeQAAAG0AAAB3AAAAbwAAAHMAAABuAAAAeQAAAHQAAAB4AAAAeAAAAHMAAAByAAAAcAAAAHkAAAB3AAAAdgAAAHkAAAB0AAAAeAAAAHcAAAB1AAAAcQAAAHYAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAABAAAABQAAAAEAAAAAAAAAAAAAAAEAAAAAAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAACAAAABQAAAAEAAAAAAAAA/////wEAAAAAAAAAAwAAAAQAAAACAAAAAAAAAAAAAAABAAAAAAAAAAEAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAMAAAAFAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAFAAAAAQAAAAAAAAAAAAAAAQAAAAMAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAEAAAADAAAAAAAAAAAAAAABAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAADAAAABQAAAAEAAAAAAAAAAAAAAAEAAAAAAAAAAQAAAAAAAAABAAAAAAAAAP////8DAAAAAAAAAAUAAAACAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAEAAAABQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAMAAAAAAAAAAwAAAAAAAAAAAAAAAAAAAAMAAAAFAAAABQAAAAAAAAAAAAAAAwAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAAAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAFAAAABQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAQAAAAAAAAABAAAAAAAAAAMAAAADAAAAAwAAAAAAAAADAAAAAAAAAAAAAAD/////AwAAAAAAAAAFAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAAAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAADAAAAAAAAAAAAAAAAAAAAAwAAAAMAAAAAAAAAAAAAAAEAAAAAAAAAAQAAAAAAAAABAAAAAAAAAAAAAAABAAAAAwAAAAAAAAAAAAAAAQAAAAAAAAADAAAAAwAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAMAAAAAAAAAAwAAAAAAAAAAAAAAAQAAAAMAAAAAAAAAAAAAAAEAAAAAAAAAAwAAAAMAAAADAAAAAwAAAAAAAAADAAAAAAAAAAAAAAADAAAAAAAAAAMAAAAAAAAAAwAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAAAAAAAAwAAAAAAAAAAAAAAAAAAAAMAAAADAAAAAAAAAP////8DAAAAAAAAAAUAAAACAAAAAAAAAAAAAAADAAAAAAAAAAAAAAADAAAAAwAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAwAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAUAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAFAAAABQAAAAAAAAAAAAAAAwAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAwAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAwAAAAMAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAAAAAADAAAAAAAAAAAAAAADAAAAAwAAAAMAAAAAAAAAAwAAAAAAAAAAAAAA/////wMAAAAAAAAABQAAAAIAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAwAAAAAAAAADAAAAAAAAAAAAAAAAAAAAAwAAAAMAAAAAAAAAAAAAAAMAAAAAAAAAAwAAAAAAAAADAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAADAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAADAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAwAAAAAAAAAAAAAA/////wMAAAAAAAAABQAAAAIAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAMAAAADAAAAAAAAAAAAAAADAAAAAwAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAwAAAAMAAAADAAAAAwAAAAAAAAADAAAAAAAAAAMAAAADAAAAAwAAAAMAAAAAAAAAAwAAAAAAAAD/////AwAAAAAAAAAFAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAAAAAADAAAAAAAAAAMAAAADAAAAAwAAAAAAAAADAAAAAAAAAAAAAAADAAAAAAAAAAAAAAAAAAAAAwAAAAMAAAAAAAAAAwAAAAAAAAAAAAAAAwAAAAMAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAAAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAADAAAAAAAAAAAAAAD/////AwAAAAAAAAAFAAAAAgAAAAAAAAAAAAAAAwAAAAMAAAADAAAAAAAAAAAAAAADAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAAAAAAAAwAAAAAAAAAAAAAAAAAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAFAAAAAAAAAAAAAAADAAAAAwAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAADAAAAAQAAAAAAAAABAAAAAAAAAAAAAAABAAAAAwAAAAEAAAAAAAAAAQAAAAAAAAAAAAAAAwAAAAAAAAADAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAAAAAAAAwAAAAAAAAADAAAAAAAAAP////8DAAAAAAAAAAUAAAACAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAwAAAAMAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAADAAAAAAAAAAAAAAADAAAAAwAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAUAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAwAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAFAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAFAAAABQAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAwAAAAAAAAAAAAAA/////wMAAAAAAAAABQAAAAIAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAwAAAAAAAAAFAAAAAAAAAAAAAAAFAAAABQAAAAAAAAAAAAAAAAAAAAEAAAADAAAAAQAAAAAAAAABAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAwAAAAAAAAADAAAAAwAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAADAAAAAQAAAAAAAAABAAAAAAAAAAMAAAADAAAAAwAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAEAAAAAAAAAAwAAAAUAAAABAAAAAAAAAP////8DAAAAAAAAAAUAAAACAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAFAAAABQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAABAAAAAUAAAABAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAIAAAAFAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAEAAAADAAAAAQAAAAAAAAABAAAAAAAAAAUAAAAAAAAAAAAAAAUAAAAFAAAAAAAAAAAAAAD/////AQAAAAAAAAADAAAABAAAAAIAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAUAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAFAAAAAAAAAAAAAAAFAAAABQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAQAAAAUAAAABAAAAAAAAAAAAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAAAAAAAAAAAAAEAAAD//////////wEAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAADAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAsAAAACAAAAAAAAAAAAAAABAAAAAgAAAAYAAAAEAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAYAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAcAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAACAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAYAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAKAAAAAgAAAAAAAAAAAAAAAQAAAAEAAAAFAAAABgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAALAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAABAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAABwAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAsAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACgAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAACAAAAAAAAAAAAAAABAAAAAwAAAAcAAAAGAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAABwAAAAEAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAGAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAADgAAAAIAAAAAAAAAAAAAAAEAAAAAAAAACQAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACgAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAMAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAABwAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAsAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAKAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADQAAAAIAAAAAAAAAAAAAAAEAAAAEAAAACAAAAAoAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAALAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAACQAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAGAAAAAgAAAAAAAAAAAAAAAQAAAAsAAAAPAAAACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAkAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAOAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAEAAAAAAAAAAQAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAIAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAABQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAAAAgAAAAAAAAAAAAAAAQAAAAwAAAAQAAAADAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAoAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAJAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAPAAAAAAAAAAEAAAABAAAAAAAAAAAAAAAAAAAADwAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAADQAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAACAAAAAAAAAAAAAAABAAAACgAAABMAAAAIAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAkAAAABAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAEQAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEQAAAAAAAAABAAAAAQAAAAAAAAAAAAAAAAAAAA8AAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAQAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAACQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAANAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAAAIAAAAAAAAAAAAAAAEAAAANAAAAEQAAAA0AAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAARAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAAEwAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAATAAAAAAAAAAEAAAABAAAAAAAAAAAAAAAAAAAAEQAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAA0AAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAARAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAkAAAACAAAAAAAAAAAAAAABAAAADgAAABIAAAAPAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAADwAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABIAAAAAAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAASAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAEwAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAABEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAATAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEgAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAABIAAAABAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAATAAAAAgAAAAAAAAAAAAAAAQAAAP//////////EwAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAATAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAAEgAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAASAAAAAAAAABgAAAAAAAAAIQAAAAAAAAAeAAAAAAAAACAAAAADAAAAMQAAAAEAAAAwAAAAAwAAADIAAAADAAAACAAAAAAAAAAFAAAABQAAAAoAAAAFAAAAFgAAAAAAAAAQAAAAAAAAABIAAAAAAAAAKQAAAAEAAAAhAAAAAAAAAB4AAAAAAAAABAAAAAAAAAAAAAAABQAAAAIAAAAFAAAADwAAAAEAAAAIAAAAAAAAAAUAAAAFAAAAHwAAAAEAAAAWAAAAAAAAABAAAAAAAAAAAgAAAAAAAAAGAAAAAAAAAA4AAAAAAAAACgAAAAAAAAALAAAAAAAAABEAAAADAAAAGAAAAAEAAAAXAAAAAwAAABkAAAADAAAAAAAAAAAAAAABAAAABQAAAAkAAAAFAAAABQAAAAAAAAACAAAAAAAAAAYAAAAAAAAAEgAAAAEAAAAKAAAAAAAAAAsAAAAAAAAABAAAAAEAAAADAAAABQAAAAcAAAAFAAAACAAAAAEAAAAAAAAAAAAAAAEAAAAFAAAAEAAAAAEAAAAFAAAAAAAAAAIAAAAAAAAABwAAAAAAAAAVAAAAAAAAACYAAAAAAAAACQAAAAAAAAATAAAAAAAAACIAAAADAAAADgAAAAEAAAAUAAAAAwAAACQAAAADAAAAAwAAAAAAAAANAAAABQAAAB0AAAAFAAAAAQAAAAAAAAAHAAAAAAAAABUAAAAAAAAABgAAAAEAAAAJAAAAAAAAABMAAAAAAAAABAAAAAIAAAAMAAAABQAAABoAAAAFAAAAAAAAAAEAAAADAAAAAAAAAA0AAAAFAAAAAgAAAAEAAAABAAAAAAAAAAcAAAAAAAAAGgAAAAAAAAAqAAAAAAAAADoAAAAAAAAAHQAAAAAAAAArAAAAAAAAAD4AAAADAAAAJgAAAAEAAAAvAAAAAwAAAEAAAAADAAAADAAAAAAAAAAcAAAABQAAACwAAAAFAAAADQAAAAAAAAAaAAAAAAAAACoAAAAAAAAAFQAAAAEAAAAdAAAAAAAAACsAAAAAAAAABAAAAAMAAAAPAAAABQAAAB8AAAAFAAAAAwAAAAEAAAAMAAAAAAAAABwAAAAFAAAABwAAAAEAAAANAAAAAAAAABoAAAAAAAAAHwAAAAAAAAApAAAAAAAAADEAAAAAAAAALAAAAAAAAAA1AAAAAAAAAD0AAAADAAAAOgAAAAEAAABBAAAAAwAAAEsAAAADAAAADwAAAAAAAAAWAAAABQAAACEAAAAFAAAAHAAAAAAAAAAfAAAAAAAAACkAAAAAAAAAKgAAAAEAAAAsAAAAAAAAADUAAAAAAAAABAAAAAQAAAAIAAAABQAAABAAAAAFAAAADAAAAAEAAAAPAAAAAAAAABYAAAAFAAAAGgAAAAEAAAAcAAAAAAAAAB8AAAAAAAAAMgAAAAAAAAAwAAAAAAAAADEAAAADAAAAIAAAAAAAAAAeAAAAAwAAACEAAAADAAAAGAAAAAMAAAASAAAAAwAAABAAAAADAAAARgAAAAAAAABDAAAAAAAAAEIAAAADAAAANAAAAAMAAAAyAAAAAAAAADAAAAAAAAAAJQAAAAMAAAAgAAAAAAAAAB4AAAADAAAAUwAAAAAAAABXAAAAAwAAAFUAAAADAAAASgAAAAMAAABGAAAAAAAAAEMAAAAAAAAAOQAAAAEAAAA0AAAAAwAAADIAAAAAAAAAGQAAAAAAAAAXAAAAAAAAABgAAAADAAAAEQAAAAAAAAALAAAAAwAAAAoAAAADAAAADgAAAAMAAAAGAAAAAwAAAAIAAAADAAAALQAAAAAAAAAnAAAAAAAAACUAAAADAAAAIwAAAAMAAAAZAAAAAAAAABcAAAAAAAAAGwAAAAMAAAARAAAAAAAAAAsAAAADAAAAPwAAAAAAAAA7AAAAAwAAADkAAAADAAAAOAAAAAMAAAAtAAAAAAAAACcAAAAAAAAALgAAAAMAAAAjAAAAAwAAABkAAAAAAAAAJAAAAAAAAAAUAAAAAAAAAA4AAAADAAAAIgAAAAAAAAATAAAAAwAAAAkAAAADAAAAJgAAAAMAAAAVAAAAAwAAAAcAAAADAAAANwAAAAAAAAAoAAAAAAAAABsAAAADAAAANgAAAAMAAAAkAAAAAAAAABQAAAAAAAAAMwAAAAMAAAAiAAAAAAAAABMAAAADAAAASAAAAAAAAAA8AAAAAwAAAC4AAAADAAAASQAAAAMAAAA3AAAAAAAAACgAAAAAAAAARwAAAAMAAAA2AAAAAwAAACQAAAAAAAAAQAAAAAAAAAAvAAAAAAAAACYAAAADAAAAPgAAAAAAAAArAAAAAwAAAB0AAAADAAAAOgAAAAMAAAAqAAAAAwAAABoAAAADAAAAVAAAAAAAAABFAAAAAAAAADMAAAADAAAAUgAAAAMAAABAAAAAAAAAAC8AAAAAAAAATAAAAAMAAAA+AAAAAAAAACsAAAADAAAAYQAAAAAAAABZAAAAAwAAAEcAAAADAAAAYgAAAAMAAABUAAAAAAAAAEUAAAAAAAAAYAAAAAMAAABSAAAAAwAAAEAAAAAAAAAASwAAAAAAAABBAAAAAAAAADoAAAADAAAAPQAAAAAAAAA1AAAAAwAAACwAAAADAAAAMQAAAAMAAAApAAAAAwAAAB8AAAADAAAAXgAAAAAAAABWAAAAAAAAAEwAAAADAAAAUQAAAAMAAABLAAAAAAAAAEEAAAAAAAAAQgAAAAMAAAA9AAAAAAAAADUAAAADAAAAawAAAAAAAABoAAAAAwAAAGAAAAADAAAAZQAAAAMAAABeAAAAAAAAAFYAAAAAAAAAVQAAAAMAAABRAAAAAwAAAEsAAAAAAAAAOQAAAAAAAAA7AAAAAAAAAD8AAAADAAAASgAAAAAAAABOAAAAAwAAAE8AAAADAAAAUwAAAAMAAABcAAAAAwAAAF8AAAADAAAAJQAAAAAAAAAnAAAAAwAAAC0AAAADAAAANAAAAAAAAAA5AAAAAAAAADsAAAAAAAAARgAAAAMAAABKAAAAAAAAAE4AAAADAAAAGAAAAAAAAAAXAAAAAwAAABkAAAADAAAAIAAAAAMAAAAlAAAAAAAAACcAAAADAAAAMgAAAAMAAAA0AAAAAAAAADkAAAAAAAAALgAAAAAAAAA8AAAAAAAAAEgAAAADAAAAOAAAAAAAAABEAAAAAwAAAFAAAAADAAAAPwAAAAMAAABNAAAAAwAAAFoAAAADAAAAGwAAAAAAAAAoAAAAAwAAADcAAAADAAAAIwAAAAAAAAAuAAAAAAAAADwAAAAAAAAALQAAAAMAAAA4AAAAAAAAAEQAAAADAAAADgAAAAAAAAAUAAAAAwAAACQAAAADAAAAEQAAAAMAAAAbAAAAAAAAACgAAAADAAAAGQAAAAMAAAAjAAAAAAAAAC4AAAAAAAAARwAAAAAAAABZAAAAAAAAAGEAAAADAAAASQAAAAAAAABbAAAAAwAAAGcAAAADAAAASAAAAAMAAABYAAAAAwAAAGkAAAADAAAAMwAAAAAAAABFAAAAAwAAAFQAAAADAAAANgAAAAAAAABHAAAAAAAAAFkAAAAAAAAANwAAAAMAAABJAAAAAAAAAFsAAAADAAAAJgAAAAAAAAAvAAAAAwAAAEAAAAADAAAAIgAAAAMAAAAzAAAAAAAAAEUAAAADAAAAJAAAAAMAAAA2AAAAAAAAAEcAAAAAAAAAYAAAAAAAAABoAAAAAAAAAGsAAAADAAAAYgAAAAAAAABuAAAAAwAAAHMAAAADAAAAYQAAAAMAAABvAAAAAwAAAHcAAAADAAAATAAAAAAAAABWAAAAAwAAAF4AAAADAAAAUgAAAAAAAABgAAAAAAAAAGgAAAAAAAAAVAAAAAMAAABiAAAAAAAAAG4AAAADAAAAOgAAAAAAAABBAAAAAwAAAEsAAAADAAAAPgAAAAMAAABMAAAAAAAAAFYAAAADAAAAQAAAAAMAAABSAAAAAAAAAGAAAAAAAAAAVQAAAAAAAABXAAAAAAAAAFMAAAADAAAAZQAAAAAAAABmAAAAAwAAAGQAAAADAAAAawAAAAMAAABwAAAAAwAAAHIAAAADAAAAQgAAAAAAAABDAAAAAwAAAEYAAAADAAAAUQAAAAAAAABVAAAAAAAAAFcAAAAAAAAAXgAAAAMAAABlAAAAAAAAAGYAAAADAAAAMQAAAAAAAAAwAAAAAwAAADIAAAADAAAAPQAAAAMAAABCAAAAAAAAAEMAAAADAAAASwAAAAMAAABRAAAAAAAAAFUAAAAAAAAAXwAAAAAAAABcAAAAAAAAAFMAAAAAAAAATwAAAAAAAABOAAAAAAAAAEoAAAADAAAAPwAAAAEAAAA7AAAAAwAAADkAAAADAAAAbQAAAAAAAABsAAAAAAAAAGQAAAAFAAAAXQAAAAEAAABfAAAAAAAAAFwAAAAAAAAATQAAAAEAAABPAAAAAAAAAE4AAAAAAAAAdQAAAAQAAAB2AAAABQAAAHIAAAAFAAAAagAAAAEAAABtAAAAAAAAAGwAAAAAAAAAWgAAAAEAAABdAAAAAQAAAF8AAAAAAAAAWgAAAAAAAABNAAAAAAAAAD8AAAAAAAAAUAAAAAAAAABEAAAAAAAAADgAAAADAAAASAAAAAEAAAA8AAAAAwAAAC4AAAADAAAAagAAAAAAAABdAAAAAAAAAE8AAAAFAAAAYwAAAAEAAABaAAAAAAAAAE0AAAAAAAAAWAAAAAEAAABQAAAAAAAAAEQAAAAAAAAAdQAAAAMAAABtAAAABQAAAF8AAAAFAAAAcQAAAAEAAABqAAAAAAAAAF0AAAAAAAAAaQAAAAEAAABjAAAAAQAAAFoAAAAAAAAAaQAAAAAAAABYAAAAAAAAAEgAAAAAAAAAZwAAAAAAAABbAAAAAAAAAEkAAAADAAAAYQAAAAEAAABZAAAAAwAAAEcAAAADAAAAcQAAAAAAAABjAAAAAAAAAFAAAAAFAAAAdAAAAAEAAABpAAAAAAAAAFgAAAAAAAAAbwAAAAEAAABnAAAAAAAAAFsAAAAAAAAAdQAAAAIAAABqAAAABQAAAFoAAAAFAAAAeQAAAAEAAABxAAAAAAAAAGMAAAAAAAAAdwAAAAEAAAB0AAAAAQAAAGkAAAAAAAAAdwAAAAAAAABvAAAAAAAAAGEAAAAAAAAAcwAAAAAAAABuAAAAAAAAAGIAAAADAAAAawAAAAEAAABoAAAAAwAAAGAAAAADAAAAeQAAAAAAAAB0AAAAAAAAAGcAAAAFAAAAeAAAAAEAAAB3AAAAAAAAAG8AAAAAAAAAcAAAAAEAAABzAAAAAAAAAG4AAAAAAAAAdQAAAAEAAABxAAAABQAAAGkAAAAFAAAAdgAAAAEAAAB5AAAAAAAAAHQAAAAAAAAAcgAAAAEAAAB4AAAAAQAAAHcAAAAAAAAAcgAAAAAAAABwAAAAAAAAAGsAAAAAAAAAZAAAAAAAAABmAAAAAAAAAGUAAAADAAAAUwAAAAEAAABXAAAAAwAAAFUAAAADAAAAdgAAAAAAAAB4AAAAAAAAAHMAAAAFAAAAbAAAAAEAAAByAAAAAAAAAHAAAAAAAAAAXAAAAAEAAABkAAAAAAAAAGYAAAAAAAAAdQAAAAAAAAB5AAAABQAAAHcAAAAFAAAAbQAAAAEAAAB2AAAAAAAAAHgAAAAAAAAAXwAAAAEAAABsAAAAAQAAAHIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAEAAAAAAAAAAAAAAAEAAAABAAAAAQAAAAAAAAAAAAAAAQAAAAAAAAABAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAGAAAAAgAAAAUAAAABAAAABAAAAAAAAAAAAAAABQAAAAMAAAABAAAABgAAAAQAAAACAAAAAAAAAH6iBfbytuk/Gq6akm/58z/Xrm0Liez0P5doSdOpSwRAWs602ULg8D/dT7Rcbo/1v1N1RQHFNOM/g9Snx7HW3L8HWsP8Q3jfP6VwOLosutk/9rjk1YQcxj+gnmKMsNn6P/HDeuPFY+M/YHwDjqKhB0Ci19/fCVrbP4UxKkDWOP6/pvljWa09tL9wi7wrQXjnv/Z6yLImkM2/3yTlOzY14D+m+WNZrT20PzwKVQnrQwNA9nrIsiaQzT/g40rFrRQFwPa45NWEHMa/kbslHEZq97/xw3rjxWPjv4cLC2SMBci/otff3wla27+rKF5oIAv0P1N1RQHFNOO/iDJPGyWHBUAHWsP8Q3jfvwQf/by16gXAfqIF9vK26b8XrO0Vh0r+v9eubQuJ7PS/BxLrA0ZZ479azrTZQuDwv1MK1EuItPw/yscgV9Z6FkAwHBR2WjQMQJNRzXsQ5vY/GlUHVJYKF0DONuFv2lMNQNCGZ28QJfk/0WUwoIL36D8ggDOMQuATQNqMOeAy/wZAWFYOYM+M2z/LWC4uH3oSQDE+LyTsMgRAkJzhRGWFGEDd4soovCQQQKqk0DJMEP8/rGmNdwOLBUAW2X/9xCbjP4hu3dcqJhNAzuYItRvdB0CgzW3zJW/sPxotm/Y2TxRAQAk9XmdDDEC1Kx9MKgT3P1M+NctcghZAFVqcLlb0C0Bgzd3sB2b2P77mZDPUWhZAFROHJpUGCEDAfma5CxXtPz1DWq/zYxRAmhYY5824F0DOuQKWSbAOQNCMqrvu3fs/L6DR22K2wT9nAAxPBU8RQGiN6mW43AFAZhu25b633D8c1YgmzowSQNM25BRKWARArGS08/lNxD+LFssHwmMRQLC5aNcxBgJABL9HT0WRF0CjCmJmOGEOQHsuaVzMP/s/TWJCaGGwBUCeu1PAPLzjP9nqN9DZOBNAKE4JcydbCkCGtbd1qjPzP8dgm9U8jhVAtPeKTkVwDkCeCLss5l37P401XMPLmBdAFd29VMVQDUBg0yA55h75Pz6odcYLCRdApBM4rBrkAkDyAVWgQxbRP4XDMnK20hFAymLlF7EmzD8GUgo9XBHlP3lbK7T9COc/k+OhPthhy7+YGEpnrOvCPzBFhLs15u4/epbqB6H4uz9IuuLF5svev6lzLKY31es/CaQ0envF5z8ZY0xlUADXv7zaz7HYEuI/CfbK1sn16T8uAQfWwxLWPzKn/YuFN94/5KdbC1AFu793fyCSnlfvPzK2y4doAMY/NRg5t1/X6b/shq4QJaHDP5yNIAKPOeI/vpn7BSE30r/X4YQrO6nrv78Ziv/Thto/DqJ1Y6+y5z9l51NaxFrlv8QlA65HOLS/86dxiEc96z+Hj0+LFjneP6LzBZ8LTc2/DaJ1Y6+y579l51NaxFrlP8QlA65HOLQ/8qdxiEc967+Jj0+LFjnev6LzBZ8LTc0/1qdbC1AFuz93fyCSnlfvvzK2y4doAMa/NRg5t1/X6T/vhq4QJaHDv5yNIAKPOeK/wJn7BSE30j/W4YQrO6nrP78Ziv/Thtq/CaQ0envF578XY0xlUADXP7zaz7HYEuK/CvbK1sn16b8rAQfWwxLWvzKn/YuFN96/zWLlF7EmzL8GUgo9XBHlv3lbK7T9COe/kOOhPthhyz+cGEpnrOvCvzBFhLs15u6/c5bqB6H4u79IuuLF5sveP6lzLKY31eu/AQAAAP////8HAAAA/////zEAAAD/////VwEAAP////9hCQAA/////6dBAAD/////kcsBAP/////3kAwA/////8H2VwAAAAAAAAAAAAAAAAACAAAA/////w4AAAD/////YgAAAP////+uAgAA/////8ISAAD/////ToMAAP////8ilwMA/////+4hGQD/////gu2vAAAAAAAAAAAAAAAAAAAAAAACAAAA//////////8BAAAAAwAAAP//////////////////////////////////////////////////////////////////////////AQAAAAAAAAACAAAA////////////////AwAAAP//////////////////////////////////////////////////////////////////////////AQAAAAAAAAACAAAA////////////////AwAAAP//////////////////////////////////////////////////////////////////////////AQAAAAAAAAACAAAA////////////////AwAAAP//////////////////////////////////////////////////////////AgAAAP//////////AQAAAAAAAAD/////////////////////AwAAAP////////////////////////////////////////////////////8DAAAA/////////////////////wAAAAD/////////////////////AQAAAP///////////////wIAAAD///////////////////////////////8DAAAA/////////////////////wAAAAD///////////////8CAAAAAQAAAP////////////////////////////////////////////////////8DAAAA/////////////////////wAAAAD///////////////8CAAAAAQAAAP////////////////////////////////////////////////////8DAAAA/////////////////////wAAAAD///////////////8CAAAAAQAAAP////////////////////////////////////////////////////8DAAAA/////////////////////wAAAAD///////////////8CAAAAAQAAAP////////////////////////////////////////////////////8BAAAAAgAAAP///////////////wAAAAD/////////////////////AwAAAP////////////////////////////////////////////////////8BAAAAAgAAAP///////////////wAAAAD/////////////////////AwAAAP////////////////////////////////////////////////////8BAAAAAgAAAP///////////////wAAAAD/////////////////////AwAAAP////////////////////////////////////////////////////8BAAAAAgAAAP///////////////wAAAAD/////////////////////AwAAAP///////////////////////////////wIAAAD///////////////8BAAAA/////////////////////wAAAAD/////////////////////AwAAAP////////////////////////////////////////////////////8DAAAA/////////////////////wAAAAABAAAA//////////8CAAAA//////////////////////////////////////////////////////////8DAAAA////////////////AgAAAAAAAAABAAAA//////////////////////////////////////////////////////////////////////////8DAAAA////////////////AgAAAAAAAAABAAAA//////////////////////////////////////////////////////////////////////////8DAAAA////////////////AgAAAAAAAAABAAAA//////////////////////////////////////////////////////////////////////////8DAAAAAQAAAP//////////AgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAACAAAAAAAAAAIAAAABAAAAAQAAAAIAAAACAAAAAAAAAAUAAAAFAAAAAAAAAAIAAAACAAAAAwAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAAAAAAAAgAAAAEAAAACAAAAAgAAAAIAAAAAAAAABQAAAAYAAAAAAAAAAgAAAAIAAAADAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAgAAAAAAAAACAAAAAQAAAAMAAAACAAAAAgAAAAAAAAAFAAAABwAAAAAAAAACAAAAAgAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAACAAAAAAAAAAIAAAABAAAABAAAAAIAAAACAAAAAAAAAAUAAAAIAAAAAAAAAAIAAAACAAAAAwAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAIAAAAAAAAAAgAAAAEAAAAAAAAAAgAAAAIAAAAAAAAABQAAAAkAAAAAAAAAAgAAAAIAAAADAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAKAAAAAgAAAAIAAAAAAAAAAwAAAA4AAAACAAAAAAAAAAIAAAADAAAAAAAAAAAAAAACAAAAAgAAAAMAAAAGAAAAAAAAAAAAAAAAAAAAAAAAAAsAAAACAAAAAgAAAAAAAAADAAAACgAAAAIAAAAAAAAAAgAAAAMAAAABAAAAAAAAAAIAAAACAAAAAwAAAAcAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAIAAAACAAAAAAAAAAMAAAALAAAAAgAAAAAAAAACAAAAAwAAAAIAAAAAAAAAAgAAAAIAAAADAAAACAAAAAAAAAAAAAAAAAAAAAAAAAANAAAAAgAAAAIAAAAAAAAAAwAAAAwAAAACAAAAAAAAAAIAAAADAAAAAwAAAAAAAAACAAAAAgAAAAMAAAAJAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAACAAAAAgAAAAAAAAADAAAADQAAAAIAAAAAAAAAAgAAAAMAAAAEAAAAAAAAAAIAAAACAAAAAwAAAAoAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAIAAAACAAAAAAAAAAMAAAAGAAAAAgAAAAAAAAACAAAAAwAAAA8AAAAAAAAAAgAAAAIAAAADAAAACwAAAAAAAAAAAAAAAAAAAAAAAAAGAAAAAgAAAAIAAAAAAAAAAwAAAAcAAAACAAAAAAAAAAIAAAADAAAAEAAAAAAAAAACAAAAAgAAAAMAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAcAAAACAAAAAgAAAAAAAAADAAAACAAAAAIAAAAAAAAAAgAAAAMAAAARAAAAAAAAAAIAAAACAAAAAwAAAA0AAAAAAAAAAAAAAAAAAAAAAAAACAAAAAIAAAACAAAAAAAAAAMAAAAJAAAAAgAAAAAAAAACAAAAAwAAABIAAAAAAAAAAgAAAAIAAAADAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAJAAAAAgAAAAIAAAAAAAAAAwAAAAUAAAACAAAAAAAAAAIAAAADAAAAEwAAAAAAAAACAAAAAgAAAAMAAAAPAAAAAAAAAAAAAAAAAAAAAAAAABAAAAACAAAAAAAAAAIAAAABAAAAEwAAAAIAAAACAAAAAAAAAAUAAAAKAAAAAAAAAAIAAAACAAAAAwAAABAAAAAAAAAAAAAAAAAAAAAAAAAAEQAAAAIAAAAAAAAAAgAAAAEAAAAPAAAAAgAAAAIAAAAAAAAABQAAAAsAAAAAAAAAAgAAAAIAAAADAAAAEQAAAAAAAAAAAAAAAAAAAAAAAAASAAAAAgAAAAAAAAACAAAAAQAAABAAAAACAAAAAgAAAAAAAAAFAAAADAAAAAAAAAACAAAAAgAAAAMAAAASAAAAAAAAAAAAAAAAAAAAAAAAABMAAAACAAAAAAAAAAIAAAABAAAAEQAAAAIAAAACAAAAAAAAAAUAAAANAAAAAAAAAAIAAAACAAAAAwAAABMAAAAAAAAAAAAAAAAAAAAAAAAADwAAAAIAAAAAAAAAAgAAAAEAAAASAAAAAgAAAAIAAAAAAAAABQAAAA4AAAAAAAAAAgAAAAIAAAADAAAAAgAAAAEAAAAAAAAAAQAAAAIAAAAAAAAAAAAAAAIAAAABAAAAAAAAAAEAAAACAAAAAQAAAAAAAAACAAAAAAAAAAUAAAAEAAAAAAAAAAEAAAAFAAAAAAAAAAAAAAAFAAAABAAAAAAAAAABAAAABQAAAAQAAAAAAAAABQAAAAAAAAACAAAAAQAAAAAAAAABAAAAAgAAAAAAAAAAAAAAAgAAAAEAAAAAAAAAAQAAAAIAAAABAAAAAAAAAAIAAAACAAAAAAAAAAEAAAAAAAAAAAAAAAUAAAAEAAAAAAAAAAEAAAAFAAAAAAAAAAAAAAAFAAAABAAAAAAAAAABAAAABQAAAAQAAAAAAAAABQAAAAUAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAABAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAEAAAAAAAAAAAEAAAAAAQAAAAAAAAAAAQAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAABAAAAAAAAAAAAAQAAAAAAAAAAAAA6B6FaUp9QQTPXMuL4myJBraiDfBwx9UBYJseitzTIQOL5if9jqZtAnXX+Z+ycb0C3pucbhRBCQG8wJBYqpRRAlWbDCzCY5z/eFWBUEve6P/+qo4Q50Y4/D9YM3iCcYT8fcA2QJSA0P4ADxu0qAAc/BNcGolVJ2j5d9FACqwquPh9z7MthtI9CSUSYJke/YUJQ/64OyjU0Qpi0+HCmFQdCm3GfIVdh2kHsJ11kAyauQYC3UDFJOoFBSJsFV1OwU0FK5fcxX4AmQWhy/zZIt/lACqaCPsBjzUDbdUNIScugQMYQlVJ4MXNANiuq8GTvRUDxTXnulxEZQFZ8QX5kpuw/qmG/JwYFlEAluh3Q6DB+QKn4vyNq0GZAKOXekas+UUB8xabXXhI6QG63C2pLtSNAdDBtyNfLDUDyOcu67ID2P0rCMvRXAeE/Ki2TSVyzyT9Dk+8Sz2uzP5J+w5ARWp0/NQAoOiMuhj9YnP+RyMJwPxgW7TvQVFk/KgsLYF0kQz9g5dAC6IwzQcgHPVvDex1B1XjppodHBkHJq3OMM9fwQNvcmJ7wddlAInGPpQs/w0BRobq5EBmtQJZ2ai7n+ZVAtv2G5E+bgECG+gIfKBlpQK5f8jdI91JAL39sL/WpPEB8rGxhDqklQK6yUf43XhBAxL9y/tK8+D86XyZpgrHiPwAAAAD/////AAAAAAAAAAAAAAAAAAAAAAAAAAD/////////////////////////////////////AAAAAP////8AAAAAAAAAAAAAAAABAAAAAAAAAAAAAAD/////AAAAAAAAAAABAAAAAQAAAAAAAAAAAAAA/////wAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAP////8FAAAABQAAAAAAAAAAAAAAAAAAAAAAAAD/////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/////////////////////////////////////wAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP////////////////////////////////////8AAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAFAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/////////////////////////////////////AAAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAQAAAAEAAAABAAAAAAAAAAEAAAAAAAAABQAAAAEAAAABAAAAAAAAAAAAAAABAAAAAQAAAAAAAAABAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAQAAAAAAAQABAAABAQAAAAAAAQAAAAEAAAABAAEAAAAAAAAAAAAAAAAAAAAAquJYWJZl+D9jaeZNtj/zPwwdI9KqaeO/qGefXwdHdz+q4lhYlmX4P+OrlPMN3PI/DB0j0qpp47+7SQLV4VIEQKriWFiWZfg/r2kma3tz8T82eQmLqNIGwMRIWXMqSvo/fcCszPux9j+jara6ozTwP6hnn18HR3c/MSoKLequ8r+SabgA2nj0P7jBLbDOHO8/1Ym/ICfH4T+6lxjvlFXHv73m373LRPU/0vXyDVxo7T+ToKRHJXMAQF/33578aPE/pAyy64tD9T8+U/hCvyruPwxv8Y7YYwLAuXYr8NAiCEB4+LDK0Sn0P1Qeuy4j+eo/OMx50n7K7L+TrGB/nyf8v5ehC2fbYPM/aXMKexiT6z8mFRIMjg/zP7yUVwGGBNw/E6opHERf8z/z0wR2g9DqPw4pBpcOhvu/NbA29uWAA8DMaTExyXzyP02biiQ+Ruk/S8jz2/FKBEB1pzZnpbb9P7pQU4wLfPI//7ZcQXeG6D9CqEQvAYoIwDB2VB6sSgRAVyv8H5We8T+EHWF8XNPmPzB2wT8Nrrg/SEi+cX+w4L8of+GtdSDxP1sjk5AdouU/6ZjOVru13r8K0obqI6bxvwVbdNXyhfA/w5GG024n5z+rwmtMzP8BwLw9pSX49QXABe/2uQxP8D+b6wCzCvXkP7uGT87fK+Q/pz/JWw4coj+qoBf2J0nwP/yE3PUo0+I/vFJeHcaC+D96luSIqvntP/bf8sHUYu8/gZNN41mL4z9bhOqVOF4FwO6lmAh1hQhAbCVxbdhk7z+1C8NdDcfiPwG36x/0OQBAx0WJ76c2+D9nlSHXANfuP2HlfZ3gqOE/EwnVlVPg9r96+oHzEH//v5bXzdT1Auw/DM3GwLsA4D9p/8uoKcr+v+U9x5DQVAPAehjSdghb7D9sc1IetODgP8MVwwB1pu6/azPk6OGe978W8t/TUc3rP+0QMvYfP+A/RsG/QpSE8D+l3uwScxzgPwQaifgujuw/k1Vti1I43z8MAwLnSh0GQH5nYnwwZgJAiGUzWC5s6j8WyyI/BbLgPw4iUapGeQJAB3W+imnp/j9BLWR4ssrpP2t+gG5Pstk/cpBsfm6DCMCOpU9dOZsFQEv8nFypHeo/ehJ6i+6S2D9jqlGEmarLv7STC5TRiOa/bC+x8WZD6D9H3yUkWpDZP8gZvmCMuQLAreY19/eRBsCoPOc8UzzpP6KI/QV+y9g/t/MoboyWzT+Hv5q3Zu3Mvy2xROCT4uY/9gQitMMg1T9abAqhWMDkv1oLTavoUfG/PMUJP9CD5j+fHRX3t6fSPz7W2gk6bvs/WRnuHwqN9D8YFturGCTmP1EZczv0b9I/5t4exabB5D/1ESLh5fTEP9X2z6SYweQ/6lv3I2zT0D9zkRGNUNMAQKoSvc4EIfs/Xggt8wQI5T+mJHHg/w/SP4lhT/9t8vQ/DrZ/DbwH7D+XlhbYZrjkP34LIpFt6c4/lwfp8fLX9L+j96CTTf76v3WdNhEv9uM/d8c3o4lV0D/vFdCHVcsFwAHeDq0F1QhApbYqcZiN5D9KoilqByXLPwX0/diA0vq/0fo0GxnxAMBbaTkvlCzjP/RrFrWXrMs/UYTrky7jA0DB9f4FiZYAQEGAk/3QzeE/r/TeqE8t0D/OqjlsnPbvvz8RKU8JOfW/smSEbK/O4T8MzuyPm3DDP/rFtctq9gZAfb1EVEaSA0Dts5dVInnhP18SFMc79MM/7y34cw6LAMDFrRJsZO0DwC2KLvLSYuA/hx5wcUHewz+49SnK/4ruPyeS0PX9a+E/ZxaaLvvZ3z8WPu5T2QS8Pygo4RIvMqa/BJ0Kqsd0279cKW4ay8jdP3b05bmZ364/10/qtdxk2r+Bcz6CDMvpv54qOw+Amdw/qLV71pW7sT/YKc80nIPUP8OfIaBJ77G/LyTuD1un2z+diYu8efWzP1wU7ACkfwjAZroyPL1yBkAmv3lKJJbbPysKSE4W+p0/dIgqY79TA8ATLTOQ3tsGwJ2zweD/Xdg/XO/jXeFUaL8VW2qLFKfov1cA9Aa6XfK/tIa7YGgI2T+f3hu/sxqPv2nXdPpf3Pc/jkw8Jbda8j+tT/z8tGPVP1yBHpJd35k/KYvYOy1s8j/yz+kCQjPrP9+agH7x59g/PZfJ9aBhpr/rDKzvYBb+PwtkiaGCt/c/vb1mVr+f1T/JIHwHc8Govw7aeF6+9vG/Xv7kD6fp979isYioQYHVP7AIQZuSFrG/3z1AdUTnAUDN3XY9O7f9P0AdQ9ljYNQ/dJANJPTOrb8kLECUiiPlP4yF7UgmStA/9xGmXxCG1T9qZzix4W2zv2SGJRJVrPe/Fh9a2M/B/b8IexzFCoPSP9y1QFD2bLe/Q86cWLJe/b+mOOfYm78BwOTjkPAGE9E/8aPCUKu/ub9pPZyLCiUGwBA7Mev/BQlALOmrlRi+0j+AMJ/dKULBv7iLtL6a6QRAEMDV/yajAUDa62dE3crJP1P70RgBUbq/38hVnR6esT/s1tG10Z/Ov/zLwalHPss/dTS9NKTXx78nMcRzCIEHQAabxDsAmQRA0tyLK3gSyT+Aui7nOhDGv5Gs58z3WgHATN3forJuBMCAui7nOhDGP9Lciyt4Esm/WAJyHQ4c7z8UP5HFIs3iP3U0vTSk18c//MvBqUc+y7+cvv8HLg/Kvy1I/mHsI+K/U/vRGAFRuj/a62dE3crJv8p+WV8KlQjAuQ/nOP43B0CAMJ/dKULBPyzpq5UYvtK/ZoU+VoLh4L9etLlRUfvtv/GjwlCrv7k/5OOQ8AYT0b9DfT9FhufXPwUX8hJp+4u/3LVAUPZstz8IexzFCoPSv9+L609E5fQ/q9Fz7X2J7T9qZzix4W2zP/cRpl8QhtW/vtNilqGX+j8MOy7QJoL0P3SQDST0zq0/QB1D2WNg1L8IIjSvGNkDwGB8Jou2GAfAsAhBm5IWsT9isYioQYHVvyS9D3zb6uy/gnwRa7uM9L/JIHwHc8GoP729Zla/n9W/CsAHJZwmAEDEW6OYT1r6Pz2XyfWgYaY/35qAfvHn2L83Tdy4lS30vxf2/gZ0jPq/XIEekl3fmb+tT/z8tGPVvybPr2zJ1/+/K7mJ0ypVAsCf3hu/sxqPPwCGu2BoCNm/5oITrpZn+r+UDUyDP+n/v1zv413hVGg/nbPB4P9d2L9MlmkxNvgCQMtZlKE85v8/KwpIThb6nb8mv3lKJJbbv8+SZsTvOOc/pQCIIOYw0j+diYu8efWzvy8k7g9bp9u/kxYDa+pKtD9XlYvA8HnVv6i1e9aVu7G/nio7D4CZ3L/WR6rNh5EGwCkgQweBkghAdvTluZnfrr9cKW4ay8jdvxbjhr1f1QVAR5C0MzivAkAWPu5T2QS8v2cWmi772d+/cKj4lzLJCEBx2QJfYrMFQIcecHFB3sO/LYou8tJi4L+jr7lhO38BwIcI0Nb7xgTAXxIUxzv0w7/ts5dVInnhv0T+l8DZLfE/MP3FoFvS5D8MzuyPm3DDv7JkhGyvzuG/tzhzRIRc0b9Ovv3/0z7mv6/03qhPLdC/m4CT/dDN4b9dwjU5VCQBQBBJX1ntCv0/9GsWtZesy79baTkvlCzjv1mjYgEz++S/oW6KnOQW8b9KoilqByXLv6W2KnGYjeS/SmaKz3Vx9z+BZB5yxGHwP3fHN6OJVdC/dZ02ES/2478PuaBjLrXaP4/JU81pPaO/fgsikW3pzr+XlhbYZrjkv4tSn7YDbP0/f2LnFKlF9z+mJHHg/w/Sv14ILfMECOW/mfg4qYhR/b+OP+RQDCACwOpb9yNs09C/1fbPpJjB5L9pN2WOVZ3wv3hHy9nxIve/URlzO/Rv0r8YFturGCTmv1d1/KKR8QPA8gsy9qzSB8CfHRX3t6fSvzzFCT/Qg+a/EYStnrzV9r/2QJqI7Lb9v/YEIrTDINW/LbFE4JPi5r/7kQEs5fEDQHunnf4GeQBAooj9BX7L2L+oPOc8Uzzpv+ydYY2SSAfAL4HK6CRTB0BH3yUkWpDZv2wvsfFmQ+i/Ik0Yzruh6T8fM3LoGoDUP3oSeovukti/S/ycXKkd6r9rEv+7UWcHQCRIQe/GfwNAa36Abk+y2b9BLWR4ssrpv9KT87qa0bM/FTyktw823L8WyyI/BbLgv4hlM1gubOq/DizMp9Ki6r8b5ckdjVrzv5NVbYtSON+/BBqJ+C6O7L/dUBFqgyXYv00Wh18r7+q/7RAy9h8/4L8W8t/TUc3rv4RM5DKx3wDAfvWIj94aBcBsc1IetODgv3oY0nYIW+y/oGcTFF54AUDkJqS/FKX6PwzNxsC7AOC/ltfN1PUC7L+5Wrz/zHnzP6688w2rNOc/YeV9neCo4b9nlSHXANfuvw9RsxKjY/s/1V8GteXE8j+1C8NdDcfiv2wlcW3YZO+/IOywaA7Q8b9bFP+4Tg36v4GTTeNZi+O/9t/ywdRi77+tRc3yFR7eP2bkcHXJkLO//ITc9SjT4r+qoBf2J0nwv2YHKoswwfm/iQcLspCjAcCb6wCzCvXkvwXv9rkMT/C/YkuwYAMXBMApCNUai9kIwMORhtNuJ+e/BVt01fKF8L+ZqWEfvIjsP6h693QZYNk/WyOTkB2i5b8of+GtdSDxvwpaaulDSwVADMQAX+lOAECEHWF8XNPmv1cr/B+VnvG/XyFG6opcCMD/mtR32/UEQP+2XEF3hui/ulBTjAt88r/imfCfRP+yP9zbvtc8XeO/TZuKJD5G6b/MaTExyXzyvxiTQeElXOO/rbJRQVGN9L/z0wR2g9DqvxOqKRxEX/O/FDGCEei99j9x8zV4VYTmP2lzCnsYk+u/l6ELZ9tg878pRXacaDT/v3k6GZRqoQXAVB67LiP56r94+LDK0Sn0vwO6pZ9b7wFAvK0nKVcc9j8+U/hCvyruv6QMsuuLQ/W/FPhKFYv46j8MyxaDTOW/v9L18g1caO2/vebfvctE9b/7GD8ZrF3xv3gx1AR9bQDAuMEtsM4c77+SabgA2nj0v5xKFIwxsATArKNSBaKsB0Cjara6ozTwv33ArMz7sfa/dF2U0FcWCcDxL357DJX/P69pJmt7c/G/quJYWJZl+L/YntVJlnrSP4sRLzXM+fe/46uU8w3c8r+q4lhYlmX4v85lu5+QRwRAsI0H/WU8479jaeZNtj/zv6riWFiWZfi/sI0H/WU847/OZbufkEcEQHAoPUBrnss/9exKzDtFtT88wM8kax+gP9OqeKeAYog/MW0ItiZvcj+ph+smvt5bP2lCaV5dEUU/StaUmQDaLz+kK9y22BMYP0O3whZuMwI/IIbgZGWE6z7UkjYaEM3UPuezxwa9cr8+LybxRMnFpz6E1N8DbPiRPsYjySMvK3s+//////8fAAj//////zMQCP////9/MiAI/////28yMAj/////YzJACP///z9iMlAI////N2IyYAj///8zYjJwCP//vzNiMoAI//+rM2IykAj/f6szYjKgCP8PqzNiMrAI/wOrM2IywAi/A6szYjLQCJ8DqzNiMuAImQOrM2Iy8Aj//////z8PCP//////Kx8I/////38pLwj/////Pyk/CP////85KU8I////PzgpXwj///8POClvCP///w44KX8I//8fDjgpjwj//w8OOCmfCP9/DQ44Ka8I/w8NDjgpvwj/DQ0OOCnPCP8MDQ44Kd8IxwwNDjgp7wjEDA0OOCn/CAcAAAAHAAAAAQAAAAIAAAAEAAAAAwAAAAAAAAAAAAAABwAAAAMAAAABAAAAAgAAAAUAAAAEAAAAAAAAAAAAAAAEAAAABAAAAAAAAAACAAAAAQAAAAMAAAAOAAAABgAAAAsAAAACAAAABwAAAAEAAAAYAAAABQAAAAoAAAABAAAABgAAAAAAAAAmAAAABwAAAAwAAAADAAAACAAAAAIAAAAxAAAACQAAAA4AAAAAAAAABQAAAAQAAAA6AAAACAAAAA0AAAAEAAAACQAAAAMAAAA/AAAACwAAAAYAAAAPAAAACgAAABAAAABIAAAADAAAAAcAAAAQAAAACwAAABEAAABTAAAACgAAAAUAAAATAAAADgAAAA8AAABhAAAADQAAAAgAAAARAAAADAAAABIAAABrAAAADgAAAAkAAAASAAAADQAAABMAAAB1AAAADwAAABMAAAARAAAAEgAAABAAAAAGAAAAAgAAAAMAAAAFAAAABAAAAAAAAAAAAAAAAAAAAAYAAAACAAAAAwAAAAEAAAAFAAAABAAAAAAAAAAAAAAABwAAAAUAAAADAAAABAAAAAEAAAAAAAAAAgAAAAAAAAACAAAAAwAAAAEAAAAFAAAABAAAAAYAAAAAAAAAAAAAABgtRFT7Ifk/GC1EVPsh+b8YLURU+yEJQBgtRFT7IQnAYWxnb3MuYwBoM05laWdoYm9yUm90YXRpb25zAGNvb3JkaWprLmMAX3VwQXA3Q2hlY2tlZABfdXBBcDdyQ2hlY2tlZABkaXJlY3RlZEVkZ2UuYwBkaXJlY3RlZEVkZ2VUb0JvdW5kYXJ5AGFkamFjZW50RmFjZURpclt0bXBGaWprLmZhY2VdW2ZpamsuZmFjZV0gPT0gS0kAZmFjZWlqay5jAF9mYWNlSWprUGVudFRvQ2VsbEJvdW5kYXJ5AGFkamFjZW50RmFjZURpcltjZW50ZXJJSksuZmFjZV1bZmFjZTJdID09IEtJAF9mYWNlSWprVG9DZWxsQm91bmRhcnkAaDNJbmRleC5jAGNvbXBhY3RDZWxscwBsYXRMbmdUb0NlbGwAY2VsbFRvQ2hpbGRQb3MAdmFsaWRhdGVDaGlsZFBvcwBsYXRMbmcuYwBjZWxsQXJlYVJhZHMyAHBvbHlnb24tPm5leHQgPT0gTlVMTABsaW5rZWRHZW8uYwBhZGROZXdMaW5rZWRQb2x5Z29uAG5leHQgIT0gTlVMTABsb29wICE9IE5VTEwAYWRkTmV3TGlua2VkTG9vcABwb2x5Z29uLT5maXJzdCA9PSBOVUxMAGFkZExpbmtlZExvb3AAY29vcmQgIT0gTlVMTABhZGRMaW5rZWRDb29yZABsb29wLT5maXJzdCA9PSBOVUxMAGlubmVyTG9vcHMgIT0gTlVMTABub3JtYWxpemVNdWx0aVBvbHlnb24AYmJveGVzICE9IE5VTEwAY2FuZGlkYXRlcyAhPSBOVUxMAGZpbmRQb2x5Z29uRm9ySG9sZQBjYW5kaWRhdGVCQm94ZXMgIT0gTlVMTAByZXZEaXIgIT0gSU5WQUxJRF9ESUdJVABsb2NhbGlqLmMAY2VsbFRvTG9jYWxJamsAYmFzZUNlbGwgIT0gb3JpZ2luQmFzZUNlbGwAIShvcmlnaW5PblBlbnQgJiYgaW5kZXhPblBlbnQpAGJhc2VDZWxsID09IG9yaWdpbkJhc2VDZWxsAGJhc2VDZWxsICE9IElOVkFMSURfQkFTRV9DRUxMAGxvY2FsSWprVG9DZWxsACFfaXNCYXNlQ2VsbFBlbnRhZ29uKGJhc2VDZWxsKQBiYXNlQ2VsbFJvdGF0aW9ucyA+PSAwAGdyaWRQYXRoQ2VsbHMAcG9seWZpbGwuYwBpdGVyU3RlcFBvbHlnb25Db21wYWN0ADAAdmVydGV4LmMAdmVydGV4Um90YXRpb25zAGNlbGxUb1ZlcnRleABncmFwaC0+YnVja2V0cyAhPSBOVUxMAHZlcnRleEdyYXBoLmMAaW5pdFZlcnRleEdyYXBoAG5vZGUgIT0gTlVMTABhZGRWZXJ0ZXhOb2Rl";var tt=28640;function Vt(Ze,mt,It,at){Jr("Assertion failed: "+G(Ze)+", at: "+[mt?G(mt):"unknown filename",It,at?G(at):"unknown function"])}function Bt(){return J.length}function Wt(Ze,mt,It){te.set(te.subarray(mt,mt+It),Ze)}function ln(Ze){return e.___errno_location&&(ne[e.___errno_location()>>2]=Ze),Ze}function Tt(Ze){Jr("OOM")}function Kt(Ze){try{var mt=new ArrayBuffer(Ze);return mt.byteLength!=Ze?void 0:(new Int8Array(mt).set(J),jt(mt),he(mt),1)}catch{}}function rn(Ze){var mt=Bt(),It=16777216,at=2147483648-It;if(Ze>at)return!1;for(var d=16777216,ee=Math.max(mt,d);ee>4,d=(Gn&15)<<4|Xn>>2,ee=(Xn&3)<<6|un,It=It+String.fromCharCode(at),Xn!==64&&(It=It+String.fromCharCode(d)),un!==64&&(It=It+String.fromCharCode(ee));while(qn13780509?(f=Hu(15,f)|0,f|0):(p=((A|0)<0)<<31>>31,y=fr(A|0,p|0,3,0)|0,_=K()|0,p=Xt(A|0,p|0,1,0)|0,p=fr(y|0,_|0,p|0,K()|0)|0,p=Xt(p|0,K()|0,1,0)|0,A=K()|0,d[f>>2]=p,d[f+4>>2]=A,f=0,f|0)}function ve(A,f,p,_){return A=A|0,f=f|0,p=p|0,_=_|0,ot(A,f,p,_,0)|0}function ot(A,f,p,_,y){A=A|0,f=f|0,p=p|0,_=_|0,y=y|0;var T=0,M=0,N=0,U=0,I=0;if(U=Q,Q=Q+16|0,M=U,!(Rt(A,f,p,_,y)|0))return _=0,Q=U,_|0;do if((p|0)>=0){if((p|0)>13780509){if(T=Hu(15,M)|0,T|0)break;N=M,M=d[N>>2]|0,N=d[N+4>>2]|0}else T=((p|0)<0)<<31>>31,I=fr(p|0,T|0,3,0)|0,N=K()|0,T=Xt(p|0,T|0,1,0)|0,T=fr(I|0,N|0,T|0,K()|0)|0,T=Xt(T|0,K()|0,1,0)|0,N=K()|0,d[M>>2]=T,d[M+4>>2]=N,M=T;if(uo(_|0,0,M<<3|0)|0,y|0){uo(y|0,0,M<<2|0)|0,T=Zt(A,f,p,_,y,M,N,0)|0;break}T=Ks(M,4)|0,T?(I=Zt(A,f,p,_,T,M,N,0)|0,An(T),T=I):T=13}else T=2;while(!1);return I=T,Q=U,I|0}function Rt(A,f,p,_,y){A=A|0,f=f|0,p=p|0,_=_|0,y=y|0;var T=0,M=0,N=0,U=0,I=0,q=0,ie=0,de=0,Ae=0,pe=0,Me=0;if(Me=Q,Q=Q+16|0,Ae=Me,pe=Me+8|0,de=Ae,d[de>>2]=A,d[de+4>>2]=f,(p|0)<0)return pe=2,Q=Me,pe|0;if(T=_,d[T>>2]=A,d[T+4>>2]=f,T=(y|0)!=0,T&&(d[y>>2]=0),Ci(A,f)|0)return pe=9,Q=Me,pe|0;d[pe>>2]=0;e:do if((p|0)>=1)if(T)for(q=1,I=0,ie=0,de=1,T=A;;){if(!(I|ie)){if(T=cn(T,f,4,pe,Ae)|0,T|0)break e;if(f=Ae,T=d[f>>2]|0,f=d[f+4>>2]|0,Ci(T,f)|0){T=9;break e}}if(T=cn(T,f,d[26800+(ie<<2)>>2]|0,pe,Ae)|0,T|0)break e;if(f=Ae,T=d[f>>2]|0,f=d[f+4>>2]|0,A=_+(q<<3)|0,d[A>>2]=T,d[A+4>>2]=f,d[y+(q<<2)>>2]=de,A=I+1|0,M=(A|0)==(de|0),N=ie+1|0,U=(N|0)==6,Ci(T,f)|0){T=9;break e}if(de=de+(U&M&1)|0,(de|0)>(p|0)){T=0;break}else q=q+1|0,I=M?0:A,ie=M?U?0:N:ie}else for(q=1,I=0,ie=0,de=1,T=A;;){if(!(I|ie)){if(T=cn(T,f,4,pe,Ae)|0,T|0)break e;if(f=Ae,T=d[f>>2]|0,f=d[f+4>>2]|0,Ci(T,f)|0){T=9;break e}}if(T=cn(T,f,d[26800+(ie<<2)>>2]|0,pe,Ae)|0,T|0)break e;if(f=Ae,T=d[f>>2]|0,f=d[f+4>>2]|0,A=_+(q<<3)|0,d[A>>2]=T,d[A+4>>2]=f,A=I+1|0,M=(A|0)==(de|0),N=ie+1|0,U=(N|0)==6,Ci(T,f)|0){T=9;break e}if(de=de+(U&M&1)|0,(de|0)>(p|0)){T=0;break}else q=q+1|0,I=M?0:A,ie=M?U?0:N:ie}else T=0;while(!1);return pe=T,Q=Me,pe|0}function Zt(A,f,p,_,y,T,M,N){A=A|0,f=f|0,p=p|0,_=_|0,y=y|0,T=T|0,M=M|0,N=N|0;var U=0,I=0,q=0,ie=0,de=0,Ae=0,pe=0,Me=0,Le=0,Ye=0;if(Me=Q,Q=Q+16|0,Ae=Me+8|0,pe=Me,U=ec(A|0,f|0,T|0,M|0)|0,q=K()|0,ie=_+(U<<3)|0,Le=ie,Ye=d[Le>>2]|0,Le=d[Le+4>>2]|0,I=(Ye|0)==(A|0)&(Le|0)==(f|0),!((Ye|0)==0&(Le|0)==0|I))do U=Xt(U|0,q|0,1,0)|0,U=th(U|0,K()|0,T|0,M|0)|0,q=K()|0,ie=_+(U<<3)|0,Ye=ie,Le=d[Ye>>2]|0,Ye=d[Ye+4>>2]|0,I=(Le|0)==(A|0)&(Ye|0)==(f|0);while(!((Le|0)==0&(Ye|0)==0|I));if(U=y+(U<<2)|0,I&&(d[U>>2]|0)<=(N|0)||(Ye=ie,d[Ye>>2]=A,d[Ye+4>>2]=f,d[U>>2]=N,(N|0)>=(p|0)))return Ye=0,Q=Me,Ye|0;switch(I=N+1|0,d[Ae>>2]=0,U=cn(A,f,2,Ae,pe)|0,U|0){case 9:{de=9;break}case 0:{U=pe,U=Zt(d[U>>2]|0,d[U+4>>2]|0,p,_,y,T,M,I)|0,U||(de=9);break}}e:do if((de|0)==9){switch(d[Ae>>2]=0,U=cn(A,f,3,Ae,pe)|0,U|0){case 9:break;case 0:{if(U=pe,U=Zt(d[U>>2]|0,d[U+4>>2]|0,p,_,y,T,M,I)|0,U|0)break e;break}default:break e}switch(d[Ae>>2]=0,U=cn(A,f,1,Ae,pe)|0,U|0){case 9:break;case 0:{if(U=pe,U=Zt(d[U>>2]|0,d[U+4>>2]|0,p,_,y,T,M,I)|0,U|0)break e;break}default:break e}switch(d[Ae>>2]=0,U=cn(A,f,5,Ae,pe)|0,U|0){case 9:break;case 0:{if(U=pe,U=Zt(d[U>>2]|0,d[U+4>>2]|0,p,_,y,T,M,I)|0,U|0)break e;break}default:break e}switch(d[Ae>>2]=0,U=cn(A,f,4,Ae,pe)|0,U|0){case 9:break;case 0:{if(U=pe,U=Zt(d[U>>2]|0,d[U+4>>2]|0,p,_,y,T,M,I)|0,U|0)break e;break}default:break e}switch(d[Ae>>2]=0,U=cn(A,f,6,Ae,pe)|0,U|0){case 9:break;case 0:{if(U=pe,U=Zt(d[U>>2]|0,d[U+4>>2]|0,p,_,y,T,M,I)|0,U|0)break e;break}default:break e}return Ye=0,Q=Me,Ye|0}while(!1);return Ye=U,Q=Me,Ye|0}function cn(A,f,p,_,y){A=A|0,f=f|0,p=p|0,_=_|0,y=y|0;var T=0,M=0,N=0,U=0,I=0,q=0,ie=0,de=0,Ae=0,pe=0;if(p>>>0>6)return y=1,y|0;if(ie=(d[_>>2]|0)%6|0,d[_>>2]=ie,(ie|0)>0){T=0;do p=Uu(p)|0,T=T+1|0;while((T|0)<(d[_>>2]|0))}if(ie=xt(A|0,f|0,45)|0,K()|0,q=ie&127,q>>>0>121)return y=5,y|0;U=$s(A,f)|0,T=xt(A|0,f|0,52)|0,K()|0,T=T&15;e:do if(!T)I=8;else{for(;;){if(M=(15-T|0)*3|0,N=xt(A|0,f|0,M|0)|0,K()|0,N=N&7,(N|0)==7){f=5;break}if(pe=(Ss(T)|0)==0,T=T+-1|0,de=Nt(7,0,M|0)|0,f=f&~(K()|0),Ae=Nt(d[(pe?432:16)+(N*28|0)+(p<<2)>>2]|0,0,M|0)|0,M=K()|0,p=d[(pe?640:224)+(N*28|0)+(p<<2)>>2]|0,A=Ae|A&~de,f=M|f,!p){p=0;break e}if(!T){I=8;break e}}return f|0}while(!1);(I|0)==8&&(pe=d[848+(q*28|0)+(p<<2)>>2]|0,Ae=Nt(pe|0,0,45)|0,A=Ae|A,f=K()|0|f&-1040385,p=d[4272+(q*28|0)+(p<<2)>>2]|0,(pe&127|0)==127&&(pe=Nt(d[848+(q*28|0)+20>>2]|0,0,45)|0,f=K()|0|f&-1040385,p=d[4272+(q*28|0)+20>>2]|0,A=ku(pe|A,f)|0,f=K()|0,d[_>>2]=(d[_>>2]|0)+1)),N=xt(A|0,f|0,45)|0,K()|0,N=N&127;e:do if(Bi(N)|0){t:do if(($s(A,f)|0)==1){if((q|0)!=(N|0))if(Ru(N,d[7696+(q*28|0)>>2]|0)|0){A=hp(A,f)|0,M=1,f=K()|0;break}else Ut(27795,26864,533,26872);switch(U|0){case 3:{A=ku(A,f)|0,f=K()|0,d[_>>2]=(d[_>>2]|0)+1,M=0;break t}case 5:{A=hp(A,f)|0,f=K()|0,d[_>>2]=(d[_>>2]|0)+5,M=0;break t}case 0:return pe=9,pe|0;default:return pe=1,pe|0}}else M=0;while(!1);if((p|0)>0){T=0;do A=cp(A,f)|0,f=K()|0,T=T+1|0;while((T|0)!=(p|0))}if((q|0)!=(N|0)){if(!(Wc(N)|0)){if((M|0)!=0|($s(A,f)|0)!=5)break;d[_>>2]=(d[_>>2]|0)+1;break}switch(ie&127){case 8:case 118:break e}($s(A,f)|0)!=3&&(d[_>>2]=(d[_>>2]|0)+1)}}else if((p|0)>0){T=0;do A=ku(A,f)|0,f=K()|0,T=T+1|0;while((T|0)!=(p|0))}while(!1);return d[_>>2]=((d[_>>2]|0)+p|0)%6|0,pe=y,d[pe>>2]=A,d[pe+4>>2]=f,pe=0,pe|0}function Yn(A,f,p,_){return A=A|0,f=f|0,p=p|0,_=_|0,yi(A,f,p,_)|0?(uo(_|0,0,p*48|0)|0,_=js(A,f,p,_)|0,_|0):(_=0,_|0)}function yi(A,f,p,_){A=A|0,f=f|0,p=p|0,_=_|0;var y=0,T=0,M=0,N=0,U=0,I=0,q=0,ie=0,de=0,Ae=0,pe=0;if(pe=Q,Q=Q+16|0,de=pe,Ae=pe+8|0,ie=de,d[ie>>2]=A,d[ie+4>>2]=f,(p|0)<0)return Ae=2,Q=pe,Ae|0;if(!p)return Ae=_,d[Ae>>2]=A,d[Ae+4>>2]=f,Ae=0,Q=pe,Ae|0;d[Ae>>2]=0;e:do if(Ci(A,f)|0)A=9;else{y=0,ie=A;do{if(A=cn(ie,f,4,Ae,de)|0,A|0)break e;if(f=de,ie=d[f>>2]|0,f=d[f+4>>2]|0,y=y+1|0,Ci(ie,f)|0){A=9;break e}}while((y|0)<(p|0));q=_,d[q>>2]=ie,d[q+4>>2]=f,q=p+-1|0,I=0,A=1;do{if(y=26800+(I<<2)|0,(I|0)==5)for(M=d[y>>2]|0,T=0,y=A;;){if(A=de,A=cn(d[A>>2]|0,d[A+4>>2]|0,M,Ae,de)|0,A|0)break e;if((T|0)!=(q|0))if(U=de,N=d[U>>2]|0,U=d[U+4>>2]|0,A=_+(y<<3)|0,d[A>>2]=N,d[A+4>>2]=U,!(Ci(N,U)|0))A=y+1|0;else{A=9;break e}else A=y;if(T=T+1|0,(T|0)>=(p|0))break;y=A}else for(M=de,U=d[y>>2]|0,N=0,y=A,T=d[M>>2]|0,M=d[M+4>>2]|0;;){if(A=cn(T,M,U,Ae,de)|0,A|0)break e;if(M=de,T=d[M>>2]|0,M=d[M+4>>2]|0,A=_+(y<<3)|0,d[A>>2]=T,d[A+4>>2]=M,A=y+1|0,Ci(T,M)|0){A=9;break e}if(N=N+1|0,(N|0)>=(p|0))break;y=A}I=I+1|0}while(I>>>0<6);A=de,A=(ie|0)==(d[A>>2]|0)&&(f|0)==(d[A+4>>2]|0)?0:9}while(!1);return Ae=A,Q=pe,Ae|0}function js(A,f,p,_){A=A|0,f=f|0,p=p|0,_=_|0;var y=0,T=0,M=0,N=0,U=0,I=0,q=0,ie=0,de=0;if(ie=Q,Q=Q+16|0,M=ie,!p)return d[_>>2]=A,d[_+4>>2]=f,_=0,Q=ie,_|0;do if((p|0)>=0){if((p|0)>13780509){if(y=Hu(15,M)|0,y|0)break;T=M,y=d[T>>2]|0,T=d[T+4>>2]|0}else y=((p|0)<0)<<31>>31,q=fr(p|0,y|0,3,0)|0,T=K()|0,y=Xt(p|0,y|0,1,0)|0,y=fr(q|0,T|0,y|0,K()|0)|0,y=Xt(y|0,K()|0,1,0)|0,T=K()|0,q=M,d[q>>2]=y,d[q+4>>2]=T;if(I=Ks(y,8)|0,!I)y=13;else{if(q=Ks(y,4)|0,!q){An(I),y=13;break}if(y=Zt(A,f,p,I,q,y,T,0)|0,y|0){An(I),An(q);break}if(f=d[M>>2]|0,M=d[M+4>>2]|0,(M|0)>0|(M|0)==0&f>>>0>0){y=0,N=0,U=0;do A=I+(N<<3)|0,T=d[A>>2]|0,A=d[A+4>>2]|0,!((T|0)==0&(A|0)==0)&&(d[q+(N<<2)>>2]|0)==(p|0)&&(de=_+(y<<3)|0,d[de>>2]=T,d[de+4>>2]=A,y=y+1|0),N=Xt(N|0,U|0,1,0)|0,U=K()|0;while((U|0)<(M|0)|(U|0)==(M|0)&N>>>0>>0)}An(I),An(q),y=0}}else y=2;while(!1);return de=y,Q=ie,de|0}function pi(A,f,p,_){A=A|0,f=f|0,p=p|0,_=_|0;var y=0,T=0,M=0,N=0,U=0,I=0;for(N=Q,Q=Q+16|0,T=N,M=N+8|0,y=(Ci(A,f)|0)==0,y=y?1:2;;){if(d[M>>2]=0,I=(cn(A,f,y,M,T)|0)==0,U=T,I&((d[U>>2]|0)==(p|0)?(d[U+4>>2]|0)==(_|0):0)){A=4;break}if(y=y+1|0,y>>>0>=7){y=7,A=4;break}}return(A|0)==4?(Q=N,y|0):0}function Pr(A,f,p,_){A=A|0,f=f|0,p=p|0,_=_|0;var y=0,T=0,M=0,N=0,U=0,I=0;if(N=Q,Q=Q+48|0,y=N+16|0,T=N+8|0,M=N,p=Ra(p)|0,p|0)return M=p,Q=N,M|0;if(I=A,U=d[I+4>>2]|0,p=T,d[p>>2]=d[I>>2],d[p+4>>2]=U,pa(T,y),p=sf(y,f,M)|0,!p){if(f=d[T>>2]|0,T=d[A+8>>2]|0,(T|0)>0){y=d[A+12>>2]|0,p=0;do f=(d[y+(p<<3)>>2]|0)+f|0,p=p+1|0;while((p|0)<(T|0))}p=M,y=d[p>>2]|0,p=d[p+4>>2]|0,T=((f|0)<0)<<31>>31,(p|0)<(T|0)|(p|0)==(T|0)&y>>>0>>0?(p=M,d[p>>2]=f,d[p+4>>2]=T,p=T):f=y,U=Xt(f|0,p|0,12,0)|0,I=K()|0,p=M,d[p>>2]=U,d[p+4>>2]=I,p=_,d[p>>2]=U,d[p+4>>2]=I,p=0}return I=p,Q=N,I|0}function Ei(A,f,p,_,y,T,M){A=A|0,f=f|0,p=p|0,_=_|0,y=y|0,T=T|0,M=M|0;var N=0,U=0,I=0,q=0,ie=0,de=0,Ae=0,pe=0,Me=0,Le=0,Ye=0,qe=0,Fe=0,Ee=0,Pt=0,nn=0,Jt=0,Un=0,En=0,Qn=0,Tn=0,an=0,Lt=0,vn=0,ii=0,wn=0,Ri=0,ws=0,Al=0;if(ii=Q,Q=Q+64|0,Tn=ii+48|0,an=ii+32|0,Lt=ii+24|0,Pt=ii+8|0,nn=ii,U=d[A>>2]|0,(U|0)<=0)return vn=0,Q=ii,vn|0;for(Jt=A+4|0,Un=Tn+8|0,En=an+8|0,Qn=Pt+8|0,N=0,Fe=0;;){I=d[Jt>>2]|0,qe=I+(Fe<<4)|0,d[Tn>>2]=d[qe>>2],d[Tn+4>>2]=d[qe+4>>2],d[Tn+8>>2]=d[qe+8>>2],d[Tn+12>>2]=d[qe+12>>2],(Fe|0)==(U+-1|0)?(d[an>>2]=d[I>>2],d[an+4>>2]=d[I+4>>2],d[an+8>>2]=d[I+8>>2],d[an+12>>2]=d[I+12>>2]):(qe=I+(Fe+1<<4)|0,d[an>>2]=d[qe>>2],d[an+4>>2]=d[qe+4>>2],d[an+8>>2]=d[qe+8>>2],d[an+12>>2]=d[qe+12>>2]),U=a1(Tn,an,_,Lt)|0;e:do if(U)I=0,N=U;else if(U=Lt,I=d[U>>2]|0,U=d[U+4>>2]|0,(U|0)>0|(U|0)==0&I>>>0>0){Ye=0,qe=0;t:for(;;){if(Ri=1/(+(I>>>0)+4294967296*+(U|0)),Al=+ee[Tn>>3],U=Ur(I|0,U|0,Ye|0,qe|0)|0,ws=+(U>>>0)+4294967296*+(K()|0),wn=+(Ye>>>0)+4294967296*+(qe|0),ee[Pt>>3]=Ri*(Al*ws)+Ri*(+ee[an>>3]*wn),ee[Qn>>3]=Ri*(+ee[Un>>3]*ws)+Ri*(+ee[En>>3]*wn),U=PA(Pt,_,nn)|0,U|0){N=U;break}Le=nn,Me=d[Le>>2]|0,Le=d[Le+4>>2]|0,de=ec(Me|0,Le|0,f|0,p|0)|0,q=K()|0,U=M+(de<<3)|0,ie=U,I=d[ie>>2]|0,ie=d[ie+4>>2]|0;n:do if((I|0)==0&(ie|0)==0)Ee=U,vn=16;else for(Ae=0,pe=0;;){if((Ae|0)>(p|0)|(Ae|0)==(p|0)&pe>>>0>f>>>0){N=1;break t}if((I|0)==(Me|0)&(ie|0)==(Le|0))break n;if(U=Xt(de|0,q|0,1,0)|0,de=th(U|0,K()|0,f|0,p|0)|0,q=K()|0,pe=Xt(pe|0,Ae|0,1,0)|0,Ae=K()|0,U=M+(de<<3)|0,ie=U,I=d[ie>>2]|0,ie=d[ie+4>>2]|0,(I|0)==0&(ie|0)==0){Ee=U,vn=16;break}}while(!1);if((vn|0)==16&&(vn=0,!((Me|0)==0&(Le|0)==0))&&(pe=Ee,d[pe>>2]=Me,d[pe+4>>2]=Le,pe=T+(d[y>>2]<<3)|0,d[pe>>2]=Me,d[pe+4>>2]=Le,pe=y,pe=Xt(d[pe>>2]|0,d[pe+4>>2]|0,1,0)|0,Me=K()|0,Le=y,d[Le>>2]=pe,d[Le+4>>2]=Me),Ye=Xt(Ye|0,qe|0,1,0)|0,qe=K()|0,U=Lt,I=d[U>>2]|0,U=d[U+4>>2]|0,!((U|0)>(qe|0)|(U|0)==(qe|0)&I>>>0>Ye>>>0)){I=1;break e}}I=0}else I=1;while(!1);if(Fe=Fe+1|0,!I){vn=21;break}if(U=d[A>>2]|0,(Fe|0)>=(U|0)){N=0,vn=21;break}}return(vn|0)==21?(Q=ii,N|0):0}function Zh(A,f,p,_){A=A|0,f=f|0,p=p|0,_=_|0;var y=0,T=0,M=0,N=0,U=0,I=0,q=0,ie=0,de=0,Ae=0,pe=0,Me=0,Le=0,Ye=0,qe=0,Fe=0,Ee=0,Pt=0,nn=0,Jt=0,Un=0,En=0,Qn=0,Tn=0,an=0,Lt=0,vn=0,ii=0,wn=0,Ri=0,ws=0;if(ws=Q,Q=Q+112|0,vn=ws+80|0,U=ws+72|0,ii=ws,wn=ws+56|0,y=Ra(p)|0,y|0)return Ri=y,Q=ws,Ri|0;if(I=A+8|0,Ri=Fo((d[I>>2]<<5)+32|0)|0,!Ri)return Ri=13,Q=ws,Ri|0;if(Na(A,Ri),y=Ra(p)|0,!y){if(an=A,Lt=d[an+4>>2]|0,y=U,d[y>>2]=d[an>>2],d[y+4>>2]=Lt,pa(U,vn),y=sf(vn,f,ii)|0,y)an=0,Lt=0;else{if(y=d[U>>2]|0,T=d[I>>2]|0,(T|0)>0){M=d[A+12>>2]|0,p=0;do y=(d[M+(p<<3)>>2]|0)+y|0,p=p+1|0;while((p|0)!=(T|0));p=y}else p=y;y=ii,T=d[y>>2]|0,y=d[y+4>>2]|0,M=((p|0)<0)<<31>>31,(y|0)<(M|0)|(y|0)==(M|0)&T>>>0

>>0?(y=ii,d[y>>2]=p,d[y+4>>2]=M,y=M):p=T,an=Xt(p|0,y|0,12,0)|0,Lt=K()|0,y=ii,d[y>>2]=an,d[y+4>>2]=Lt,y=0}if(!y){if(p=Ks(an,8)|0,!p)return An(Ri),Ri=13,Q=ws,Ri|0;if(N=Ks(an,8)|0,!N)return An(Ri),An(p),Ri=13,Q=ws,Ri|0;Qn=vn,d[Qn>>2]=0,d[Qn+4>>2]=0,Qn=A,Tn=d[Qn+4>>2]|0,y=U,d[y>>2]=d[Qn>>2],d[y+4>>2]=Tn,y=Ei(U,an,Lt,f,vn,p,N)|0;e:do if(y)An(p),An(N),An(Ri);else{t:do if((d[I>>2]|0)>0){for(M=A+12|0,T=0;y=Ei((d[M>>2]|0)+(T<<3)|0,an,Lt,f,vn,p,N)|0,T=T+1|0,!(y|0);)if((T|0)>=(d[I>>2]|0))break t;An(p),An(N),An(Ri);break e}while(!1);(Lt|0)>0|(Lt|0)==0&an>>>0>0&&uo(N|0,0,an<<3|0)|0,Tn=vn,Qn=d[Tn+4>>2]|0;t:do if((Qn|0)>0|(Qn|0)==0&(d[Tn>>2]|0)>>>0>0){Jt=p,Un=N,En=p,Qn=N,Tn=p,y=p,Ee=p,Pt=N,nn=N,p=N;n:for(;;){for(Le=0,Ye=0,qe=0,Fe=0,T=0,M=0;;){N=ii,U=N+56|0;do d[N>>2]=0,N=N+4|0;while((N|0)<(U|0));if(f=Jt+(Le<<3)|0,I=d[f>>2]|0,f=d[f+4>>2]|0,Rt(I,f,1,ii,0)|0){N=ii,U=N+56|0;do d[N>>2]=0,N=N+4|0;while((N|0)<(U|0));N=Ks(7,4)|0,N|0&&(Zt(I,f,1,ii,N,7,0,0)|0,An(N))}for(Me=0;;){pe=ii+(Me<<3)|0,Ae=d[pe>>2]|0,pe=d[pe+4>>2]|0;i:do if((Ae|0)==0&(pe|0)==0)N=T,U=M;else{if(q=ec(Ae|0,pe|0,an|0,Lt|0)|0,I=K()|0,N=_+(q<<3)|0,f=N,U=d[f>>2]|0,f=d[f+4>>2]|0,!((U|0)==0&(f|0)==0)){ie=0,de=0;do{if((ie|0)>(Lt|0)|(ie|0)==(Lt|0)&de>>>0>an>>>0)break n;if((U|0)==(Ae|0)&(f|0)==(pe|0)){N=T,U=M;break i}N=Xt(q|0,I|0,1,0)|0,q=th(N|0,K()|0,an|0,Lt|0)|0,I=K()|0,de=Xt(de|0,ie|0,1,0)|0,ie=K()|0,N=_+(q<<3)|0,f=N,U=d[f>>2]|0,f=d[f+4>>2]|0}while(!((U|0)==0&(f|0)==0))}if((Ae|0)==0&(pe|0)==0){N=T,U=M;break}Ol(Ae,pe,wn)|0,Da(A,Ri,wn)|0&&(de=Xt(T|0,M|0,1,0)|0,M=K()|0,ie=N,d[ie>>2]=Ae,d[ie+4>>2]=pe,T=Un+(T<<3)|0,d[T>>2]=Ae,d[T+4>>2]=pe,T=de),N=T,U=M}while(!1);if(Me=Me+1|0,Me>>>0>=7)break;T=N,M=U}if(Le=Xt(Le|0,Ye|0,1,0)|0,Ye=K()|0,qe=Xt(qe|0,Fe|0,1,0)|0,Fe=K()|0,M=vn,T=d[M>>2]|0,M=d[M+4>>2]|0,(Fe|0)<(M|0)|(Fe|0)==(M|0)&qe>>>0>>0)T=N,M=U;else break}if((M|0)>0|(M|0)==0&T>>>0>0){T=0,M=0;do Fe=Jt+(T<<3)|0,d[Fe>>2]=0,d[Fe+4>>2]=0,T=Xt(T|0,M|0,1,0)|0,M=K()|0,Fe=vn,qe=d[Fe+4>>2]|0;while((M|0)<(qe|0)|((M|0)==(qe|0)?T>>>0<(d[Fe>>2]|0)>>>0:0))}if(Fe=vn,d[Fe>>2]=N,d[Fe+4>>2]=U,(U|0)>0|(U|0)==0&N>>>0>0)Me=p,Le=nn,Ye=Tn,qe=Pt,Fe=Un,p=Ee,nn=y,Pt=En,Ee=Me,y=Le,Tn=Qn,Qn=Ye,En=qe,Un=Jt,Jt=Fe;else break t}An(En),An(Qn),An(Ri),y=1;break e}else y=N;while(!1);An(Ri),An(p),An(y),y=0}while(!1);return Ri=y,Q=ws,Ri|0}}return An(Ri),Ri=y,Q=ws,Ri|0}function Bl(A,f,p){A=A|0,f=f|0,p=p|0;var _=0,y=0,T=0,M=0,N=0,U=0,I=0,q=0;if(q=Q,Q=Q+176|0,U=q,(f|0)<1)return Io(p,0,0),I=0,Q=q,I|0;for(N=A,N=xt(d[N>>2]|0,d[N+4>>2]|0,52)|0,K()|0,Io(p,(f|0)>6?f:6,N&15),N=0;_=A+(N<<3)|0,_=Il(d[_>>2]|0,d[_+4>>2]|0,U)|0,!(_|0);){if(_=d[U>>2]|0,(_|0)>0){M=0;do T=U+8+(M<<4)|0,M=M+1|0,_=U+8+(((M|0)%(_|0)|0)<<4)|0,y=Zu(p,_,T)|0,y?Ku(p,y)|0:VA(p,T,_)|0,_=d[U>>2]|0;while((M|0)<(_|0))}if(N=N+1|0,(N|0)>=(f|0)){_=0,I=13;break}}return(I|0)==13?(Q=q,_|0):(GA(p),I=_,Q=q,I|0)}function nl(A,f,p){A=A|0,f=f|0,p=p|0;var _=0,y=0,T=0,M=0;if(T=Q,Q=Q+32|0,_=T,y=T+16|0,A=Bl(A,f,y)|0,A|0)return p=A,Q=T,p|0;if(d[p>>2]=0,d[p+4>>2]=0,d[p+8>>2]=0,A=qA(y)|0,A|0)do{f=M1(p)|0;do OA(f,A)|0,M=A+16|0,d[_>>2]=d[M>>2],d[_+4>>2]=d[M+4>>2],d[_+8>>2]=d[M+8>>2],d[_+12>>2]=d[M+12>>2],Ku(y,A)|0,A=As(y,_)|0;while((A|0)!=0);A=qA(y)|0}while((A|0)!=0);return GA(y),A=Rx(p)|0,A?(Wu(p),M=A,Q=T,M|0):(M=0,Q=T,M|0)}function Bi(A){return A=A|0,A>>>0>121?(A=0,A|0):(A=d[7696+(A*28|0)+16>>2]|0,A|0)}function Wc(A){return A=A|0,(A|0)==4|(A|0)==117|0}function Po(A){return A=A|0,d[11120+((d[A>>2]|0)*216|0)+((d[A+4>>2]|0)*72|0)+((d[A+8>>2]|0)*24|0)+(d[A+12>>2]<<3)>>2]|0}function ep(A){return A=A|0,d[11120+((d[A>>2]|0)*216|0)+((d[A+4>>2]|0)*72|0)+((d[A+8>>2]|0)*24|0)+(d[A+12>>2]<<3)+4>>2]|0}function tp(A,f){A=A|0,f=f|0,A=7696+(A*28|0)|0,d[f>>2]=d[A>>2],d[f+4>>2]=d[A+4>>2],d[f+8>>2]=d[A+8>>2],d[f+12>>2]=d[A+12>>2]}function $c(A,f){A=A|0,f=f|0;var p=0,_=0;if(f>>>0>20)return f=-1,f|0;do if((d[11120+(f*216|0)>>2]|0)!=(A|0))if((d[11120+(f*216|0)+8>>2]|0)!=(A|0))if((d[11120+(f*216|0)+16>>2]|0)!=(A|0))if((d[11120+(f*216|0)+24>>2]|0)!=(A|0))if((d[11120+(f*216|0)+32>>2]|0)!=(A|0))if((d[11120+(f*216|0)+40>>2]|0)!=(A|0))if((d[11120+(f*216|0)+48>>2]|0)!=(A|0))if((d[11120+(f*216|0)+56>>2]|0)!=(A|0))if((d[11120+(f*216|0)+64>>2]|0)!=(A|0))if((d[11120+(f*216|0)+72>>2]|0)!=(A|0))if((d[11120+(f*216|0)+80>>2]|0)!=(A|0))if((d[11120+(f*216|0)+88>>2]|0)!=(A|0))if((d[11120+(f*216|0)+96>>2]|0)!=(A|0))if((d[11120+(f*216|0)+104>>2]|0)!=(A|0))if((d[11120+(f*216|0)+112>>2]|0)!=(A|0))if((d[11120+(f*216|0)+120>>2]|0)!=(A|0))if((d[11120+(f*216|0)+128>>2]|0)!=(A|0))if((d[11120+(f*216|0)+136>>2]|0)==(A|0))A=2,p=1,_=2;else{if((d[11120+(f*216|0)+144>>2]|0)==(A|0)){A=0,p=2,_=0;break}if((d[11120+(f*216|0)+152>>2]|0)==(A|0)){A=0,p=2,_=1;break}if((d[11120+(f*216|0)+160>>2]|0)==(A|0)){A=0,p=2,_=2;break}if((d[11120+(f*216|0)+168>>2]|0)==(A|0)){A=1,p=2,_=0;break}if((d[11120+(f*216|0)+176>>2]|0)==(A|0)){A=1,p=2,_=1;break}if((d[11120+(f*216|0)+184>>2]|0)==(A|0)){A=1,p=2,_=2;break}if((d[11120+(f*216|0)+192>>2]|0)==(A|0)){A=2,p=2,_=0;break}if((d[11120+(f*216|0)+200>>2]|0)==(A|0)){A=2,p=2,_=1;break}if((d[11120+(f*216|0)+208>>2]|0)==(A|0)){A=2,p=2,_=2;break}else A=-1;return A|0}else A=2,p=1,_=1;else A=2,p=1,_=0;else A=1,p=1,_=2;else A=1,p=1,_=1;else A=1,p=1,_=0;else A=0,p=1,_=2;else A=0,p=1,_=1;else A=0,p=1,_=0;else A=2,p=0,_=2;else A=2,p=0,_=1;else A=2,p=0,_=0;else A=1,p=0,_=2;else A=1,p=0,_=1;else A=1,p=0,_=0;else A=0,p=0,_=2;else A=0,p=0,_=1;else A=0,p=0,_=0;while(!1);return f=d[11120+(f*216|0)+(p*72|0)+(A*24|0)+(_<<3)+4>>2]|0,f|0}function Ru(A,f){return A=A|0,f=f|0,(d[7696+(A*28|0)+20>>2]|0)==(f|0)?(f=1,f|0):(f=(d[7696+(A*28|0)+24>>2]|0)==(f|0),f|0)}function SA(A,f){return A=A|0,f=f|0,d[848+(A*28|0)+(f<<2)>>2]|0}function Jh(A,f){return A=A|0,f=f|0,(d[848+(A*28|0)>>2]|0)==(f|0)?(f=0,f|0):(d[848+(A*28|0)+4>>2]|0)==(f|0)?(f=1,f|0):(d[848+(A*28|0)+8>>2]|0)==(f|0)?(f=2,f|0):(d[848+(A*28|0)+12>>2]|0)==(f|0)?(f=3,f|0):(d[848+(A*28|0)+16>>2]|0)==(f|0)?(f=4,f|0):(d[848+(A*28|0)+20>>2]|0)==(f|0)?(f=5,f|0):((d[848+(A*28|0)+24>>2]|0)==(f|0)?6:7)|0}function s1(){return 122}function ef(A){A=A|0;var f=0,p=0,_=0;f=0;do Nt(f|0,0,45)|0,_=K()|0|134225919,p=A+(f<<3)|0,d[p>>2]=-1,d[p+4>>2]=_,f=f+1|0;while((f|0)!=122);return 0}function il(A){A=A|0;var f=0,p=0,_=0;return _=+ee[A+16>>3],p=+ee[A+24>>3],f=_-p,+(_>3]<+ee[A+24>>3]|0}function tf(A){return A=A|0,+(+ee[A>>3]-+ee[A+8>>3])}function Lo(A,f){A=A|0,f=f|0;var p=0,_=0,y=0;return p=+ee[f>>3],!(p>=+ee[A+8>>3])||!(p<=+ee[A>>3])?(f=0,f|0):(_=+ee[A+16>>3],p=+ee[A+24>>3],y=+ee[f+8>>3],f=y>=p,A=y<=_&1,_>3]<+ee[f+8>>3]||+ee[A+8>>3]>+ee[f>>3]?(_=0,_|0):(T=+ee[A+16>>3],p=A+24|0,q=+ee[p>>3],M=T>3],y=f+24|0,U=+ee[y>>3],N=I>3],f)||(q=+Xs(+ee[p>>3],A),q>+Xs(+ee[_>>3],f))?(N=0,N|0):(N=1,N|0))}function wA(A,f,p,_){A=A|0,f=f|0,p=p|0,_=_|0;var y=0,T=0,M=0,N=0,U=0;T=+ee[A+16>>3],U=+ee[A+24>>3],A=T>3],M=+ee[f+24>>3],y=N>2]=A?y|f?1:2:0,d[_>>2]=y?A?1:f?2:1:0}function np(A,f){A=A|0,f=f|0;var p=0,_=0,y=0,T=0,M=0,N=0,U=0,I=0,q=0;return+ee[A>>3]<+ee[f>>3]||+ee[A+8>>3]>+ee[f+8>>3]?(_=0,_|0):(_=A+16|0,U=+ee[_>>3],T=+ee[A+24>>3],M=U>3],y=f+24|0,I=+ee[y>>3],N=q>3],f)?(q=+Xs(+ee[_>>3],A),N=q>=+Xs(+ee[p>>3],f),N|0):(N=0,N|0))}function rf(A,f){A=A|0,f=f|0;var p=0,_=0,y=0,T=0,M=0,N=0;y=Q,Q=Q+176|0,_=y,d[_>>2]=4,N=+ee[f>>3],ee[_+8>>3]=N,T=+ee[f+16>>3],ee[_+16>>3]=T,ee[_+24>>3]=N,N=+ee[f+24>>3],ee[_+32>>3]=N,M=+ee[f+8>>3],ee[_+40>>3]=M,ee[_+48>>3]=N,ee[_+56>>3]=M,ee[_+64>>3]=T,f=_+72|0,p=f+96|0;do d[f>>2]=0,f=f+4|0;while((f|0)<(p|0));Gl(A|0,_|0,168)|0,Q=y}function sf(A,f,p){A=A|0,f=f|0,p=p|0;var _=0,y=0,T=0,M=0,N=0,U=0,I=0,q=0,ie=0,de=0,Ae=0,pe=0,Me=0,Le=0;pe=Q,Q=Q+288|0,q=pe+264|0,ie=pe+96|0,I=pe,N=I,U=N+96|0;do d[N>>2]=0,N=N+4|0;while((N|0)<(U|0));return f=qu(f,I)|0,f|0?(Ae=f,Q=pe,Ae|0):(U=I,I=d[U>>2]|0,U=d[U+4>>2]|0,Ol(I,U,q)|0,Il(I,U,ie)|0,M=+Zc(q,ie+8|0),ee[q>>3]=+ee[A>>3],U=q+8|0,ee[U>>3]=+ee[A+16>>3],ee[ie>>3]=+ee[A+8>>3],I=ie+8|0,ee[I>>3]=+ee[A+24>>3],y=+Zc(q,ie),Le=+ee[U>>3]-+ee[I>>3],T=+un(+Le),Me=+ee[q>>3]-+ee[ie>>3],_=+un(+Me),!(Le==0|Me==0)&&(Le=+Af(+T,+_),Le=+Qe(+(y*y/+df(+(Le/+df(+T,+_)),3)/(M*(M*2.59807621135)*.8))),ee[$n>>3]=Le,de=~~Le>>>0,Ae=+un(Le)>=1?Le>0?~~+Oe(+Xn(Le/4294967296),4294967295)>>>0:~~+Qe((Le-+(~~Le>>>0))/4294967296)>>>0:0,(d[$n+4>>2]&2146435072|0)!=2146435072)?(ie=(de|0)==0&(Ae|0)==0,f=p,d[f>>2]=ie?1:de,d[f+4>>2]=ie?0:Ae,f=0):f=1,Ae=f,Q=pe,Ae|0)}function a1(A,f,p,_){A=A|0,f=f|0,p=p|0,_=_|0;var y=0,T=0,M=0,N=0,U=0,I=0,q=0;I=Q,Q=Q+288|0,M=I+264|0,N=I+96|0,U=I,y=U,T=y+96|0;do d[y>>2]=0,y=y+4|0;while((y|0)<(T|0));return p=qu(p,U)|0,p|0?(_=p,Q=I,_|0):(p=U,y=d[p>>2]|0,p=d[p+4>>2]|0,Ol(y,p,M)|0,Il(y,p,N)|0,q=+Zc(M,N+8|0),q=+Qe(+(+Zc(A,f)/(q*2))),ee[$n>>3]=q,p=~~q>>>0,y=+un(q)>=1?q>0?~~+Oe(+Xn(q/4294967296),4294967295)>>>0:~~+Qe((q-+(~~q>>>0))/4294967296)>>>0:0,(d[$n+4>>2]&2146435072|0)==2146435072?(_=1,Q=I,_|0):(U=(p|0)==0&(y|0)==0,d[_>>2]=U?1:p,d[_+4>>2]=U?0:y,_=0,Q=I,_|0))}function Ws(A,f){A=A|0,f=+f;var p=0,_=0,y=0,T=0,M=0,N=0,U=0,I=0,q=0;T=A+16|0,M=+ee[T>>3],p=A+24|0,y=+ee[p>>3],_=M-y,_=M>3],N=A+8|0,U=+ee[N>>3],q=I-U,_=(_*f-_)*.5,f=(q*f-q)*.5,I=I+f,ee[A>>3]=I>1.5707963267948966?1.5707963267948966:I,f=U-f,ee[N>>3]=f<-1.5707963267948966?-1.5707963267948966:f,f=M+_,f=f>3.141592653589793?f+-6.283185307179586:f,ee[T>>3]=f<-3.141592653589793?f+6.283185307179586:f,f=y-_,f=f>3.141592653589793?f+-6.283185307179586:f,ee[p>>3]=f<-3.141592653589793?f+6.283185307179586:f}function Nu(A,f,p,_){A=A|0,f=f|0,p=p|0,_=_|0,d[A>>2]=f,d[A+4>>2]=p,d[A+8>>2]=_}function MA(A,f){A=A|0,f=f|0;var p=0,_=0,y=0,T=0,M=0,N=0,U=0,I=0,q=0,ie=0,de=0;ie=f+8|0,d[ie>>2]=0,U=+ee[A>>3],M=+un(+U),I=+ee[A+8>>3],N=+un(+I)*1.1547005383792515,M=M+N*.5,p=~~M,A=~~N,M=M-+(p|0),N=N-+(A|0);do if(M<.5)if(M<.3333333333333333)if(d[f>>2]=p,N<(M+1)*.5){d[f+4>>2]=A;break}else{A=A+1|0,d[f+4>>2]=A;break}else if(de=1-M,A=(!(N>2]=A,de<=N&N>2]=p;break}else{d[f>>2]=p;break}else{if(!(M<.6666666666666666))if(p=p+1|0,d[f>>2]=p,N>2]=A;break}else{A=A+1|0,d[f+4>>2]=A;break}if(N<1-M){if(d[f+4>>2]=A,M*2+-1>2]=p;break}}else A=A+1|0,d[f+4>>2]=A;p=p+1|0,d[f>>2]=p}while(!1);do if(U<0)if(A&1){q=(A+1|0)/2|0,q=Ur(p|0,((p|0)<0)<<31>>31|0,q|0,((q|0)<0)<<31>>31|0)|0,p=~~(+(p|0)-((+(q>>>0)+4294967296*+(K()|0))*2+1)),d[f>>2]=p;break}else{q=(A|0)/2|0,q=Ur(p|0,((p|0)<0)<<31>>31|0,q|0,((q|0)<0)<<31>>31|0)|0,p=~~(+(p|0)-(+(q>>>0)+4294967296*+(K()|0))*2),d[f>>2]=p;break}while(!1);q=f+4|0,I<0&&(p=p-((A<<1|1|0)/2|0)|0,d[f>>2]=p,A=0-A|0,d[q>>2]=A),_=A-p|0,(p|0)<0?(y=0-p|0,d[q>>2]=_,d[ie>>2]=y,d[f>>2]=0,A=_,p=0):y=0,(A|0)<0&&(p=p-A|0,d[f>>2]=p,y=y-A|0,d[ie>>2]=y,d[q>>2]=0,A=0),T=p-y|0,_=A-y|0,(y|0)<0&&(d[f>>2]=T,d[q>>2]=_,d[ie>>2]=0,A=_,p=T,y=0),_=(A|0)<(p|0)?A:p,_=(y|0)<(_|0)?y:_,!((_|0)<=0)&&(d[f>>2]=p-_,d[q>>2]=A-_,d[ie>>2]=y-_)}function Lr(A){A=A|0;var f=0,p=0,_=0,y=0,T=0,M=0;f=d[A>>2]|0,M=A+4|0,p=d[M>>2]|0,(f|0)<0&&(p=p-f|0,d[M>>2]=p,T=A+8|0,d[T>>2]=(d[T>>2]|0)-f,d[A>>2]=0,f=0),(p|0)<0?(f=f-p|0,d[A>>2]=f,T=A+8|0,y=(d[T>>2]|0)-p|0,d[T>>2]=y,d[M>>2]=0,p=0):(y=A+8|0,T=y,y=d[y>>2]|0),(y|0)<0&&(f=f-y|0,d[A>>2]=f,p=p-y|0,d[M>>2]=p,d[T>>2]=0,y=0),_=(p|0)<(f|0)?p:f,_=(y|0)<(_|0)?y:_,!((_|0)<=0)&&(d[A>>2]=f-_,d[M>>2]=p-_,d[T>>2]=y-_)}function Du(A,f){A=A|0,f=f|0;var p=0,_=0;_=d[A+8>>2]|0,p=+((d[A+4>>2]|0)-_|0),ee[f>>3]=+((d[A>>2]|0)-_|0)-p*.5,ee[f+8>>3]=p*.8660254037844386}function hs(A,f,p){A=A|0,f=f|0,p=p|0,d[p>>2]=(d[f>>2]|0)+(d[A>>2]|0),d[p+4>>2]=(d[f+4>>2]|0)+(d[A+4>>2]|0),d[p+8>>2]=(d[f+8>>2]|0)+(d[A+8>>2]|0)}function af(A,f,p){A=A|0,f=f|0,p=p|0,d[p>>2]=(d[A>>2]|0)-(d[f>>2]|0),d[p+4>>2]=(d[A+4>>2]|0)-(d[f+4>>2]|0),d[p+8>>2]=(d[A+8>>2]|0)-(d[f+8>>2]|0)}function Xc(A,f){A=A|0,f=f|0;var p=0,_=0;p=Xe(d[A>>2]|0,f)|0,d[A>>2]=p,p=A+4|0,_=Xe(d[p>>2]|0,f)|0,d[p>>2]=_,A=A+8|0,f=Xe(d[A>>2]|0,f)|0,d[A>>2]=f}function Pu(A){A=A|0;var f=0,p=0,_=0,y=0,T=0,M=0,N=0;M=d[A>>2]|0,N=(M|0)<0,_=(d[A+4>>2]|0)-(N?M:0)|0,T=(_|0)<0,y=(T?0-_|0:0)+((d[A+8>>2]|0)-(N?M:0))|0,p=(y|0)<0,A=p?0:y,f=(T?0:_)-(p?y:0)|0,y=(N?0:M)-(T?_:0)-(p?y:0)|0,p=(f|0)<(y|0)?f:y,p=(A|0)<(p|0)?A:p,_=(p|0)>0,A=A-(_?p:0)|0,f=f-(_?p:0)|0;e:do switch(y-(_?p:0)|0){case 0:switch(f|0){case 0:return N=(A|0)==0?0:(A|0)==1?1:7,N|0;case 1:return N=(A|0)==0?2:(A|0)==1?3:7,N|0;default:break e}case 1:switch(f|0){case 0:return N=(A|0)==0?4:(A|0)==1?5:7,N|0;case 1:{if(!A)A=6;else break e;return A|0}default:break e}}while(!1);return N=7,N|0}function o1(A){A=A|0;var f=0,p=0,_=0,y=0,T=0,M=0,N=0,U=0,I=0;if(U=A+8|0,M=d[U>>2]|0,N=(d[A>>2]|0)-M|0,I=A+4|0,M=(d[I>>2]|0)-M|0,N>>>0>715827881|M>>>0>715827881){if(_=(N|0)>0,y=2147483647-N|0,T=-2147483648-N|0,(_?(y|0)<(N|0):(T|0)>(N|0))||(p=N<<1,_?(2147483647-p|0)<(N|0):(-2147483648-p|0)>(N|0))||((M|0)>0?(2147483647-M|0)<(M|0):(-2147483648-M|0)>(M|0))||(f=N*3|0,p=M<<1,(_?(y|0)<(p|0):(T|0)>(p|0))||((N|0)>-1?(f|-2147483648|0)>=(M|0):(f^-2147483648|0)<(M|0))))return I=1,I|0}else p=M<<1,f=N*3|0;return _=cl(+(f-M|0)*.14285714285714285)|0,d[A>>2]=_,y=cl(+(p+N|0)*.14285714285714285)|0,d[I>>2]=y,d[U>>2]=0,p=(y|0)<(_|0),f=p?_:y,p=p?y:_,(p|0)<0&&(((p|0)==-2147483648||((f|0)>0?(2147483647-f|0)<(p|0):(-2147483648-f|0)>(p|0)))&&Ut(27795,26892,354,26903),((f|0)>-1?(f|-2147483648|0)>=(p|0):(f^-2147483648|0)<(p|0))&&Ut(27795,26892,354,26903)),f=y-_|0,(_|0)<0?(p=0-_|0,d[I>>2]=f,d[U>>2]=p,d[A>>2]=0,_=0):(f=y,p=0),(f|0)<0&&(_=_-f|0,d[A>>2]=_,p=p-f|0,d[U>>2]=p,d[I>>2]=0,f=0),T=_-p|0,y=f-p|0,(p|0)<0?(d[A>>2]=T,d[I>>2]=y,d[U>>2]=0,f=y,y=T,p=0):y=_,_=(f|0)<(y|0)?f:y,_=(p|0)<(_|0)?p:_,(_|0)<=0?(I=0,I|0):(d[A>>2]=y-_,d[I>>2]=f-_,d[U>>2]=p-_,I=0,I|0)}function cx(A){A=A|0;var f=0,p=0,_=0,y=0,T=0,M=0,N=0,U=0;if(M=A+8|0,y=d[M>>2]|0,T=(d[A>>2]|0)-y|0,N=A+4|0,y=(d[N>>2]|0)-y|0,T>>>0>715827881|y>>>0>715827881){if(p=(T|0)>0,(p?(2147483647-T|0)<(T|0):(-2147483648-T|0)>(T|0))||(f=T<<1,_=(y|0)>0,_?(2147483647-y|0)<(y|0):(-2147483648-y|0)>(y|0)))return N=1,N|0;if(U=y<<1,(_?(2147483647-U|0)<(y|0):(-2147483648-U|0)>(y|0))||(p?(2147483647-f|0)<(y|0):(-2147483648-f|0)>(y|0))||(p=y*3|0,(y|0)>-1?(p|-2147483648|0)>=(T|0):(p^-2147483648|0)<(T|0)))return U=1,U|0}else p=y*3|0,f=T<<1;return _=cl(+(f+y|0)*.14285714285714285)|0,d[A>>2]=_,y=cl(+(p-T|0)*.14285714285714285)|0,d[N>>2]=y,d[M>>2]=0,p=(y|0)<(_|0),f=p?_:y,p=p?y:_,(p|0)<0&&(((p|0)==-2147483648||((f|0)>0?(2147483647-f|0)<(p|0):(-2147483648-f|0)>(p|0)))&&Ut(27795,26892,402,26917),((f|0)>-1?(f|-2147483648|0)>=(p|0):(f^-2147483648|0)<(p|0))&&Ut(27795,26892,402,26917)),f=y-_|0,(_|0)<0?(p=0-_|0,d[N>>2]=f,d[M>>2]=p,d[A>>2]=0,_=0):(f=y,p=0),(f|0)<0&&(_=_-f|0,d[A>>2]=_,p=p-f|0,d[M>>2]=p,d[N>>2]=0,f=0),T=_-p|0,y=f-p|0,(p|0)<0?(d[A>>2]=T,d[N>>2]=y,d[M>>2]=0,f=y,y=T,p=0):y=_,_=(f|0)<(y|0)?f:y,_=(p|0)<(_|0)?p:_,(_|0)<=0?(U=0,U|0):(d[A>>2]=y-_,d[N>>2]=f-_,d[M>>2]=p-_,U=0,U|0)}function hx(A){A=A|0;var f=0,p=0,_=0,y=0,T=0,M=0,N=0;M=A+8|0,p=d[M>>2]|0,f=(d[A>>2]|0)-p|0,N=A+4|0,p=(d[N>>2]|0)-p|0,_=cl(+((f*3|0)-p|0)*.14285714285714285)|0,d[A>>2]=_,f=cl(+((p<<1)+f|0)*.14285714285714285)|0,d[N>>2]=f,d[M>>2]=0,p=f-_|0,(_|0)<0?(T=0-_|0,d[N>>2]=p,d[M>>2]=T,d[A>>2]=0,f=p,_=0,p=T):p=0,(f|0)<0&&(_=_-f|0,d[A>>2]=_,p=p-f|0,d[M>>2]=p,d[N>>2]=0,f=0),T=_-p|0,y=f-p|0,(p|0)<0?(d[A>>2]=T,d[N>>2]=y,d[M>>2]=0,f=y,y=T,p=0):y=_,_=(f|0)<(y|0)?f:y,_=(p|0)<(_|0)?p:_,!((_|0)<=0)&&(d[A>>2]=y-_,d[N>>2]=f-_,d[M>>2]=p-_)}function l1(A){A=A|0;var f=0,p=0,_=0,y=0,T=0,M=0,N=0;M=A+8|0,p=d[M>>2]|0,f=(d[A>>2]|0)-p|0,N=A+4|0,p=(d[N>>2]|0)-p|0,_=cl(+((f<<1)+p|0)*.14285714285714285)|0,d[A>>2]=_,f=cl(+((p*3|0)-f|0)*.14285714285714285)|0,d[N>>2]=f,d[M>>2]=0,p=f-_|0,(_|0)<0?(T=0-_|0,d[N>>2]=p,d[M>>2]=T,d[A>>2]=0,f=p,_=0,p=T):p=0,(f|0)<0&&(_=_-f|0,d[A>>2]=_,p=p-f|0,d[M>>2]=p,d[N>>2]=0,f=0),T=_-p|0,y=f-p|0,(p|0)<0?(d[A>>2]=T,d[N>>2]=y,d[M>>2]=0,f=y,y=T,p=0):y=_,_=(f|0)<(y|0)?f:y,_=(p|0)<(_|0)?p:_,!((_|0)<=0)&&(d[A>>2]=y-_,d[N>>2]=f-_,d[M>>2]=p-_)}function Yc(A){A=A|0;var f=0,p=0,_=0,y=0,T=0,M=0,N=0;f=d[A>>2]|0,M=A+4|0,p=d[M>>2]|0,N=A+8|0,_=d[N>>2]|0,y=p+(f*3|0)|0,d[A>>2]=y,p=_+(p*3|0)|0,d[M>>2]=p,f=(_*3|0)+f|0,d[N>>2]=f,_=p-y|0,(y|0)<0?(f=f-y|0,d[M>>2]=_,d[N>>2]=f,d[A>>2]=0,p=_,_=0):_=y,(p|0)<0&&(_=_-p|0,d[A>>2]=_,f=f-p|0,d[N>>2]=f,d[M>>2]=0,p=0),T=_-f|0,y=p-f|0,(f|0)<0?(d[A>>2]=T,d[M>>2]=y,d[N>>2]=0,_=T,f=0):y=p,p=(y|0)<(_|0)?y:_,p=(f|0)<(p|0)?f:p,!((p|0)<=0)&&(d[A>>2]=_-p,d[M>>2]=y-p,d[N>>2]=f-p)}function Lu(A){A=A|0;var f=0,p=0,_=0,y=0,T=0,M=0,N=0;y=d[A>>2]|0,M=A+4|0,f=d[M>>2]|0,N=A+8|0,p=d[N>>2]|0,_=(f*3|0)+y|0,y=p+(y*3|0)|0,d[A>>2]=y,d[M>>2]=_,f=(p*3|0)+f|0,d[N>>2]=f,p=_-y|0,(y|0)<0?(f=f-y|0,d[M>>2]=p,d[N>>2]=f,d[A>>2]=0,y=0):p=_,(p|0)<0&&(y=y-p|0,d[A>>2]=y,f=f-p|0,d[N>>2]=f,d[M>>2]=0,p=0),T=y-f|0,_=p-f|0,(f|0)<0?(d[A>>2]=T,d[M>>2]=_,d[N>>2]=0,y=T,f=0):_=p,p=(_|0)<(y|0)?_:y,p=(f|0)<(p|0)?f:p,!((p|0)<=0)&&(d[A>>2]=y-p,d[M>>2]=_-p,d[N>>2]=f-p)}function u1(A,f){A=A|0,f=f|0;var p=0,_=0,y=0,T=0,M=0,N=0;(f+-1|0)>>>0>=6||(y=(d[15440+(f*12|0)>>2]|0)+(d[A>>2]|0)|0,d[A>>2]=y,N=A+4|0,_=(d[15440+(f*12|0)+4>>2]|0)+(d[N>>2]|0)|0,d[N>>2]=_,M=A+8|0,f=(d[15440+(f*12|0)+8>>2]|0)+(d[M>>2]|0)|0,d[M>>2]=f,p=_-y|0,(y|0)<0?(f=f-y|0,d[N>>2]=p,d[M>>2]=f,d[A>>2]=0,_=0):(p=_,_=y),(p|0)<0&&(_=_-p|0,d[A>>2]=_,f=f-p|0,d[M>>2]=f,d[N>>2]=0,p=0),T=_-f|0,y=p-f|0,(f|0)<0?(d[A>>2]=T,d[N>>2]=y,d[M>>2]=0,_=T,f=0):y=p,p=(y|0)<(_|0)?y:_,p=(f|0)<(p|0)?f:p,!((p|0)<=0)&&(d[A>>2]=_-p,d[N>>2]=y-p,d[M>>2]=f-p))}function c1(A){A=A|0;var f=0,p=0,_=0,y=0,T=0,M=0,N=0;y=d[A>>2]|0,M=A+4|0,f=d[M>>2]|0,N=A+8|0,p=d[N>>2]|0,_=f+y|0,y=p+y|0,d[A>>2]=y,d[M>>2]=_,f=p+f|0,d[N>>2]=f,p=_-y|0,(y|0)<0?(f=f-y|0,d[M>>2]=p,d[N>>2]=f,d[A>>2]=0,_=0):(p=_,_=y),(p|0)<0&&(_=_-p|0,d[A>>2]=_,f=f-p|0,d[N>>2]=f,d[M>>2]=0,p=0),T=_-f|0,y=p-f|0,(f|0)<0?(d[A>>2]=T,d[M>>2]=y,d[N>>2]=0,_=T,f=0):y=p,p=(y|0)<(_|0)?y:_,p=(f|0)<(p|0)?f:p,!((p|0)<=0)&&(d[A>>2]=_-p,d[M>>2]=y-p,d[N>>2]=f-p)}function EA(A){A=A|0;var f=0,p=0,_=0,y=0,T=0,M=0,N=0;f=d[A>>2]|0,M=A+4|0,_=d[M>>2]|0,N=A+8|0,p=d[N>>2]|0,y=_+f|0,d[A>>2]=y,_=p+_|0,d[M>>2]=_,f=p+f|0,d[N>>2]=f,p=_-y|0,(y|0)<0?(f=f-y|0,d[M>>2]=p,d[N>>2]=f,d[A>>2]=0,_=0):(p=_,_=y),(p|0)<0&&(_=_-p|0,d[A>>2]=_,f=f-p|0,d[N>>2]=f,d[M>>2]=0,p=0),T=_-f|0,y=p-f|0,(f|0)<0?(d[A>>2]=T,d[M>>2]=y,d[N>>2]=0,_=T,f=0):y=p,p=(y|0)<(_|0)?y:_,p=(f|0)<(p|0)?f:p,!((p|0)<=0)&&(d[A>>2]=_-p,d[M>>2]=y-p,d[N>>2]=f-p)}function Uu(A){switch(A=A|0,A|0){case 1:{A=5;break}case 5:{A=4;break}case 4:{A=6;break}case 6:{A=2;break}case 2:{A=3;break}case 3:{A=1;break}}return A|0}function rl(A){switch(A=A|0,A|0){case 1:{A=3;break}case 3:{A=2;break}case 2:{A=6;break}case 6:{A=4;break}case 4:{A=5;break}case 5:{A=1;break}}return A|0}function h1(A){A=A|0;var f=0,p=0,_=0,y=0,T=0,M=0,N=0;f=d[A>>2]|0,M=A+4|0,p=d[M>>2]|0,N=A+8|0,_=d[N>>2]|0,y=p+(f<<1)|0,d[A>>2]=y,p=_+(p<<1)|0,d[M>>2]=p,f=(_<<1)+f|0,d[N>>2]=f,_=p-y|0,(y|0)<0?(f=f-y|0,d[M>>2]=_,d[N>>2]=f,d[A>>2]=0,p=_,_=0):_=y,(p|0)<0&&(_=_-p|0,d[A>>2]=_,f=f-p|0,d[N>>2]=f,d[M>>2]=0,p=0),T=_-f|0,y=p-f|0,(f|0)<0?(d[A>>2]=T,d[M>>2]=y,d[N>>2]=0,_=T,f=0):y=p,p=(y|0)<(_|0)?y:_,p=(f|0)<(p|0)?f:p,!((p|0)<=0)&&(d[A>>2]=_-p,d[M>>2]=y-p,d[N>>2]=f-p)}function f1(A){A=A|0;var f=0,p=0,_=0,y=0,T=0,M=0,N=0;y=d[A>>2]|0,M=A+4|0,f=d[M>>2]|0,N=A+8|0,p=d[N>>2]|0,_=(f<<1)+y|0,y=p+(y<<1)|0,d[A>>2]=y,d[M>>2]=_,f=(p<<1)+f|0,d[N>>2]=f,p=_-y|0,(y|0)<0?(f=f-y|0,d[M>>2]=p,d[N>>2]=f,d[A>>2]=0,y=0):p=_,(p|0)<0&&(y=y-p|0,d[A>>2]=y,f=f-p|0,d[N>>2]=f,d[M>>2]=0,p=0),T=y-f|0,_=p-f|0,(f|0)<0?(d[A>>2]=T,d[M>>2]=_,d[N>>2]=0,y=T,f=0):_=p,p=(_|0)<(y|0)?_:y,p=(f|0)<(p|0)?f:p,!((p|0)<=0)&&(d[A>>2]=y-p,d[M>>2]=_-p,d[N>>2]=f-p)}function ip(A,f){A=A|0,f=f|0;var p=0,_=0,y=0,T=0,M=0,N=0;return M=(d[A>>2]|0)-(d[f>>2]|0)|0,N=(M|0)<0,_=(d[A+4>>2]|0)-(d[f+4>>2]|0)-(N?M:0)|0,T=(_|0)<0,y=(N?0-M|0:0)+(d[A+8>>2]|0)-(d[f+8>>2]|0)+(T?0-_|0:0)|0,A=(y|0)<0,f=A?0:y,p=(T?0:_)-(A?y:0)|0,y=(N?0:M)-(T?_:0)-(A?y:0)|0,A=(p|0)<(y|0)?p:y,A=(f|0)<(A|0)?f:A,_=(A|0)>0,f=f-(_?A:0)|0,p=p-(_?A:0)|0,A=y-(_?A:0)|0,A=(A|0)>-1?A:0-A|0,p=(p|0)>-1?p:0-p|0,f=(f|0)>-1?f:0-f|0,f=(p|0)>(f|0)?p:f,((A|0)>(f|0)?A:f)|0}function fx(A,f){A=A|0,f=f|0;var p=0;p=d[A+8>>2]|0,d[f>>2]=(d[A>>2]|0)-p,d[f+4>>2]=(d[A+4>>2]|0)-p}function rp(A,f){A=A|0,f=f|0;var p=0,_=0,y=0,T=0,M=0,N=0;return _=d[A>>2]|0,d[f>>2]=_,y=d[A+4>>2]|0,M=f+4|0,d[M>>2]=y,N=f+8|0,d[N>>2]=0,p=(y|0)<(_|0),A=p?_:y,p=p?y:_,(p|0)<0&&((p|0)==-2147483648||((A|0)>0?(2147483647-A|0)<(p|0):(-2147483648-A|0)>(p|0))||((A|0)>-1?(A|-2147483648|0)>=(p|0):(A^-2147483648|0)<(p|0)))?(f=1,f|0):(A=y-_|0,(_|0)<0?(p=0-_|0,d[M>>2]=A,d[N>>2]=p,d[f>>2]=0,_=0):(A=y,p=0),(A|0)<0&&(_=_-A|0,d[f>>2]=_,p=p-A|0,d[N>>2]=p,d[M>>2]=0,A=0),T=_-p|0,y=A-p|0,(p|0)<0?(d[f>>2]=T,d[M>>2]=y,d[N>>2]=0,A=y,y=T,p=0):y=_,_=(A|0)<(y|0)?A:y,_=(p|0)<(_|0)?p:_,(_|0)<=0?(f=0,f|0):(d[f>>2]=y-_,d[M>>2]=A-_,d[N>>2]=p-_,f=0,f|0))}function A1(A){A=A|0;var f=0,p=0,_=0,y=0;f=A+8|0,y=d[f>>2]|0,p=y-(d[A>>2]|0)|0,d[A>>2]=p,_=A+4|0,A=(d[_>>2]|0)-y|0,d[_>>2]=A,d[f>>2]=0-(A+p)}function Ax(A){A=A|0;var f=0,p=0,_=0,y=0,T=0,M=0,N=0;p=d[A>>2]|0,f=0-p|0,d[A>>2]=f,M=A+8|0,d[M>>2]=0,N=A+4|0,_=d[N>>2]|0,y=_+p|0,(p|0)>0?(d[N>>2]=y,d[M>>2]=p,d[A>>2]=0,f=0,_=y):p=0,(_|0)<0?(T=f-_|0,d[A>>2]=T,p=p-_|0,d[M>>2]=p,d[N>>2]=0,y=T-p|0,f=0-p|0,(p|0)<0?(d[A>>2]=y,d[N>>2]=f,d[M>>2]=0,_=f,p=0):(_=0,y=T)):y=f,f=(_|0)<(y|0)?_:y,f=(p|0)<(f|0)?p:f,!((f|0)<=0)&&(d[A>>2]=y-f,d[N>>2]=_-f,d[M>>2]=p-f)}function dx(A,f,p,_,y){A=A|0,f=f|0,p=p|0,_=_|0,y=y|0;var T=0,M=0,N=0,U=0,I=0,q=0,ie=0;if(ie=Q,Q=Q+64|0,q=ie,N=ie+56|0,!(!0&(f&2013265920|0)==134217728&(!0&(_&2013265920|0)==134217728)))return y=5,Q=ie,y|0;if((A|0)==(p|0)&(f|0)==(_|0))return d[y>>2]=0,y=0,Q=ie,y|0;if(M=xt(A|0,f|0,52)|0,K()|0,M=M&15,I=xt(p|0,_|0,52)|0,K()|0,(M|0)!=(I&15|0))return y=12,Q=ie,y|0;if(T=M+-1|0,M>>>0>1){Fu(A,f,T,q)|0,Fu(p,_,T,N)|0,I=q,U=d[I>>2]|0,I=d[I+4>>2]|0;e:do if((U|0)==(d[N>>2]|0)&&(I|0)==(d[N+4>>2]|0)){M=(M^15)*3|0,T=xt(A|0,f|0,M|0)|0,K()|0,T=T&7,M=xt(p|0,_|0,M|0)|0,K()|0,M=M&7;do if((T|0)==0|(M|0)==0)d[y>>2]=1,T=0;else if((T|0)==7)T=5;else{if((T|0)==1|(M|0)==1&&Ci(U,I)|0){T=5;break}if((d[15536+(T<<2)>>2]|0)!=(M|0)&&(d[15568+(T<<2)>>2]|0)!=(M|0))break e;d[y>>2]=1,T=0}while(!1);return y=T,Q=ie,y|0}while(!1)}T=q,M=T+56|0;do d[T>>2]=0,T=T+4|0;while((T|0)<(M|0));return ve(A,f,1,q)|0,f=q,!((d[f>>2]|0)==(p|0)&&(d[f+4>>2]|0)==(_|0))&&(f=q+8|0,!((d[f>>2]|0)==(p|0)&&(d[f+4>>2]|0)==(_|0)))&&(f=q+16|0,!((d[f>>2]|0)==(p|0)&&(d[f+4>>2]|0)==(_|0)))&&(f=q+24|0,!((d[f>>2]|0)==(p|0)&&(d[f+4>>2]|0)==(_|0)))&&(f=q+32|0,!((d[f>>2]|0)==(p|0)&&(d[f+4>>2]|0)==(_|0)))&&(f=q+40|0,!((d[f>>2]|0)==(p|0)&&(d[f+4>>2]|0)==(_|0)))?(T=q+48|0,T=((d[T>>2]|0)==(p|0)?(d[T+4>>2]|0)==(_|0):0)&1):T=1,d[y>>2]=T,y=0,Q=ie,y|0}function d1(A,f,p,_,y){return A=A|0,f=f|0,p=p|0,_=_|0,y=y|0,p=pi(A,f,p,_)|0,(p|0)==7?(y=11,y|0):(_=Nt(p|0,0,56)|0,f=f&-2130706433|(K()|0)|268435456,d[y>>2]=A|_,d[y+4>>2]=f,y=0,y|0)}function px(A,f,p){return A=A|0,f=f|0,p=p|0,!0&(f&2013265920|0)==268435456?(d[p>>2]=A,d[p+4>>2]=f&-2130706433|134217728,p=0,p|0):(p=6,p|0)}function mx(A,f,p){A=A|0,f=f|0,p=p|0;var _=0,y=0,T=0;return y=Q,Q=Q+16|0,_=y,d[_>>2]=0,!0&(f&2013265920|0)==268435456?(T=xt(A|0,f|0,56)|0,K()|0,_=cn(A,f&-2130706433|134217728,T&7,_,p)|0,Q=y,_|0):(_=6,Q=y,_|0)}function p1(A,f){A=A|0,f=f|0;var p=0;switch(p=xt(A|0,f|0,56)|0,K()|0,p&7){case 0:case 7:return p=0,p|0}return p=f&-2130706433|134217728,!(!0&(f&2013265920|0)==268435456)||!0&(f&117440512|0)==16777216&(Ci(A,p)|0)!=0?(p=0,p|0):(p=NA(A,p)|0,p|0)}function gx(A,f,p){A=A|0,f=f|0,p=p|0;var _=0,y=0,T=0,M=0;return y=Q,Q=Q+16|0,_=y,!0&(f&2013265920|0)==268435456?(T=f&-2130706433|134217728,M=p,d[M>>2]=A,d[M+4>>2]=T,d[_>>2]=0,f=xt(A|0,f|0,56)|0,K()|0,_=cn(A,T,f&7,_,p+8|0)|0,Q=y,_|0):(_=6,Q=y,_|0)}function vx(A,f,p){A=A|0,f=f|0,p=p|0;var _=0,y=0;return y=(Ci(A,f)|0)==0,f=f&-2130706433,_=p,d[_>>2]=y?A:0,d[_+4>>2]=y?f|285212672:0,_=p+8|0,d[_>>2]=A,d[_+4>>2]=f|301989888,_=p+16|0,d[_>>2]=A,d[_+4>>2]=f|318767104,_=p+24|0,d[_>>2]=A,d[_+4>>2]=f|335544320,_=p+32|0,d[_>>2]=A,d[_+4>>2]=f|352321536,p=p+40|0,d[p>>2]=A,d[p+4>>2]=f|369098752,0}function CA(A,f,p){A=A|0,f=f|0,p=p|0;var _=0,y=0,T=0,M=0;return M=Q,Q=Q+16|0,y=M,T=f&-2130706433|134217728,!0&(f&2013265920|0)==268435456?(_=xt(A|0,f|0,56)|0,K()|0,_=Sp(A,T,_&7)|0,(_|0)==-1?(d[p>>2]=0,T=6,Q=M,T|0):(zu(A,T,y)|0&&Ut(27795,26932,282,26947),f=xt(A|0,f|0,52)|0,K()|0,f=f&15,Ci(A,T)|0?sp(y,f,_,2,p):RA(y,f,_,2,p),T=0,Q=M,T|0)):(T=6,Q=M,T|0)}function _x(A,f,p){A=A|0,f=f|0,p=p|0;var _=0,y=0;_=Q,Q=Q+16|0,y=_,yx(A,f,p,y),MA(y,p+4|0),Q=_}function yx(A,f,p,_){A=A|0,f=f|0,p=p|0,_=_|0;var y=0,T=0,M=0,N=0,U=0;if(N=Q,Q=Q+16|0,U=N,xx(A,p,U),T=+Ma(+(1-+ee[U>>3]*.5)),T<1e-16){d[_>>2]=0,d[_+4>>2]=0,d[_+8>>2]=0,d[_+12>>2]=0,Q=N;return}if(U=d[p>>2]|0,y=+ee[15920+(U*24|0)>>3],y=+Kc(y-+Kc(+Ex(15600+(U<<4)|0,A))),Ss(f)|0?M=+Kc(y+-.3334731722518321):M=y,y=+cs(+T)*2.618033988749896,(f|0)>0){A=0;do y=y*2.6457513110645907,A=A+1|0;while((A|0)!=(f|0))}T=+li(+M)*y,ee[_>>3]=T,M=+Fn(+M)*y,ee[_+8>>3]=M,Q=N}function xx(A,f,p){A=A|0,f=f|0,p=p|0;var _=0,y=0,T=0;if(T=Q,Q=Q+32|0,y=T,Yu(A,y),d[f>>2]=0,ee[p>>3]=5,_=+ar(16400,y),_<+ee[p>>3]&&(d[f>>2]=0,ee[p>>3]=_),_=+ar(16424,y),_<+ee[p>>3]&&(d[f>>2]=1,ee[p>>3]=_),_=+ar(16448,y),_<+ee[p>>3]&&(d[f>>2]=2,ee[p>>3]=_),_=+ar(16472,y),_<+ee[p>>3]&&(d[f>>2]=3,ee[p>>3]=_),_=+ar(16496,y),_<+ee[p>>3]&&(d[f>>2]=4,ee[p>>3]=_),_=+ar(16520,y),_<+ee[p>>3]&&(d[f>>2]=5,ee[p>>3]=_),_=+ar(16544,y),_<+ee[p>>3]&&(d[f>>2]=6,ee[p>>3]=_),_=+ar(16568,y),_<+ee[p>>3]&&(d[f>>2]=7,ee[p>>3]=_),_=+ar(16592,y),_<+ee[p>>3]&&(d[f>>2]=8,ee[p>>3]=_),_=+ar(16616,y),_<+ee[p>>3]&&(d[f>>2]=9,ee[p>>3]=_),_=+ar(16640,y),_<+ee[p>>3]&&(d[f>>2]=10,ee[p>>3]=_),_=+ar(16664,y),_<+ee[p>>3]&&(d[f>>2]=11,ee[p>>3]=_),_=+ar(16688,y),_<+ee[p>>3]&&(d[f>>2]=12,ee[p>>3]=_),_=+ar(16712,y),_<+ee[p>>3]&&(d[f>>2]=13,ee[p>>3]=_),_=+ar(16736,y),_<+ee[p>>3]&&(d[f>>2]=14,ee[p>>3]=_),_=+ar(16760,y),_<+ee[p>>3]&&(d[f>>2]=15,ee[p>>3]=_),_=+ar(16784,y),_<+ee[p>>3]&&(d[f>>2]=16,ee[p>>3]=_),_=+ar(16808,y),_<+ee[p>>3]&&(d[f>>2]=17,ee[p>>3]=_),_=+ar(16832,y),_<+ee[p>>3]&&(d[f>>2]=18,ee[p>>3]=_),_=+ar(16856,y),!(_<+ee[p>>3])){Q=T;return}d[f>>2]=19,ee[p>>3]=_,Q=T}function Bu(A,f,p,_,y){A=A|0,f=f|0,p=p|0,_=_|0,y=y|0;var T=0,M=0,N=0;if(T=+zl(A),T<1e-16){f=15600+(f<<4)|0,d[y>>2]=d[f>>2],d[y+4>>2]=d[f+4>>2],d[y+8>>2]=d[f+8>>2],d[y+12>>2]=d[f+12>>2];return}if(M=+Ue(+ +ee[A+8>>3],+ +ee[A>>3]),(p|0)>0){A=0;do T=T*.37796447300922725,A=A+1|0;while((A|0)!=(p|0))}N=T*.3333333333333333,_?(p=(Ss(p)|0)==0,T=+ae(+((p?N:N*.37796447300922725)*.381966011250105))):(T=+ae(+(T*.381966011250105)),Ss(p)|0&&(M=+Kc(M+.3334731722518321))),Cx(15600+(f<<4)|0,+Kc(+ee[15920+(f*24|0)>>3]-M),T,y)}function of(A,f,p){A=A|0,f=f|0,p=p|0;var _=0,y=0;_=Q,Q=Q+16|0,y=_,Du(A+4|0,y),Bu(y,d[A>>2]|0,f,0,p),Q=_}function sp(A,f,p,_,y){A=A|0,f=f|0,p=p|0,_=_|0,y=y|0;var T=0,M=0,N=0,U=0,I=0,q=0,ie=0,de=0,Ae=0,pe=0,Me=0,Le=0,Ye=0,qe=0,Fe=0,Ee=0,Pt=0,nn=0,Jt=0,Un=0,En=0,Qn=0,Tn=0,an=0,Lt=0,vn=0,ii=0,wn=0;if(vn=Q,Q=Q+272|0,T=vn+256|0,qe=vn+240|0,Tn=vn,an=vn+224|0,Lt=vn+208|0,Fe=vn+176|0,Ee=vn+160|0,Pt=vn+192|0,nn=vn+144|0,Jt=vn+128|0,Un=vn+112|0,En=vn+96|0,Qn=vn+80|0,d[T>>2]=f,d[qe>>2]=d[A>>2],d[qe+4>>2]=d[A+4>>2],d[qe+8>>2]=d[A+8>>2],d[qe+12>>2]=d[A+12>>2],ap(qe,T,Tn),d[y>>2]=0,qe=_+p+((_|0)==5&1)|0,(qe|0)<=(p|0)){Q=vn;return}U=d[T>>2]|0,I=an+4|0,q=Fe+4|0,ie=p+5|0,de=16880+(U<<2)|0,Ae=16960+(U<<2)|0,pe=Jt+8|0,Me=Un+8|0,Le=En+8|0,Ye=Lt+4|0,N=p;e:for(;;){M=Tn+(((N|0)%5|0)<<4)|0,d[Lt>>2]=d[M>>2],d[Lt+4>>2]=d[M+4>>2],d[Lt+8>>2]=d[M+8>>2],d[Lt+12>>2]=d[M+12>>2];do;while((Ou(Lt,U,0,1)|0)==2);if((N|0)>(p|0)&(Ss(f)|0)!=0){if(d[Fe>>2]=d[Lt>>2],d[Fe+4>>2]=d[Lt+4>>2],d[Fe+8>>2]=d[Lt+8>>2],d[Fe+12>>2]=d[Lt+12>>2],Du(I,Ee),_=d[Fe>>2]|0,T=d[17040+(_*80|0)+(d[an>>2]<<2)>>2]|0,d[Fe>>2]=d[18640+(_*80|0)+(T*20|0)>>2],M=d[18640+(_*80|0)+(T*20|0)+16>>2]|0,(M|0)>0){A=0;do c1(q),A=A+1|0;while((A|0)<(M|0))}switch(M=18640+(_*80|0)+(T*20|0)+4|0,d[Pt>>2]=d[M>>2],d[Pt+4>>2]=d[M+4>>2],d[Pt+8>>2]=d[M+8>>2],Xc(Pt,(d[de>>2]|0)*3|0),hs(q,Pt,q),Lr(q),Du(q,nn),ii=+(d[Ae>>2]|0),ee[Jt>>3]=ii*3,ee[pe>>3]=0,wn=ii*-1.5,ee[Un>>3]=wn,ee[Me>>3]=ii*2.598076211353316,ee[En>>3]=wn,ee[Le>>3]=ii*-2.598076211353316,d[17040+((d[Fe>>2]|0)*80|0)+(d[Lt>>2]<<2)>>2]|0){case 1:{A=Un,_=Jt;break}case 3:{A=En,_=Un;break}case 2:{A=Jt,_=En;break}default:{A=12;break e}}xp(Ee,nn,_,A,Qn),Bu(Qn,d[Fe>>2]|0,U,1,y+8+(d[y>>2]<<4)|0),d[y>>2]=(d[y>>2]|0)+1}if((N|0)<(ie|0)&&(Du(Ye,Fe),Bu(Fe,d[Lt>>2]|0,U,1,y+8+(d[y>>2]<<4)|0),d[y>>2]=(d[y>>2]|0)+1),d[an>>2]=d[Lt>>2],d[an+4>>2]=d[Lt+4>>2],d[an+8>>2]=d[Lt+8>>2],d[an+12>>2]=d[Lt+12>>2],N=N+1|0,(N|0)>=(qe|0)){A=3;break}}if((A|0)==3){Q=vn;return}else(A|0)==12&&Ut(26970,27017,572,27027)}function ap(A,f,p){A=A|0,f=f|0,p=p|0;var _=0,y=0,T=0,M=0,N=0,U=0;U=Q,Q=Q+128|0,_=U+64|0,y=U,T=_,M=20240,N=T+60|0;do d[T>>2]=d[M>>2],T=T+4|0,M=M+4|0;while((T|0)<(N|0));T=y,M=20304,N=T+60|0;do d[T>>2]=d[M>>2],T=T+4|0,M=M+4|0;while((T|0)<(N|0));N=(Ss(d[f>>2]|0)|0)==0,_=N?_:y,y=A+4|0,h1(y),f1(y),Ss(d[f>>2]|0)|0&&(Lu(y),d[f>>2]=(d[f>>2]|0)+1),d[p>>2]=d[A>>2],f=p+4|0,hs(y,_,f),Lr(f),d[p+16>>2]=d[A>>2],f=p+20|0,hs(y,_+12|0,f),Lr(f),d[p+32>>2]=d[A>>2],f=p+36|0,hs(y,_+24|0,f),Lr(f),d[p+48>>2]=d[A>>2],f=p+52|0,hs(y,_+36|0,f),Lr(f),d[p+64>>2]=d[A>>2],p=p+68|0,hs(y,_+48|0,p),Lr(p),Q=U}function Ou(A,f,p,_){A=A|0,f=f|0,p=p|0,_=_|0;var y=0,T=0,M=0,N=0,U=0,I=0,q=0,ie=0,de=0,Ae=0,pe=0;if(pe=Q,Q=Q+32|0,de=pe+12|0,N=pe,Ae=A+4|0,ie=d[16960+(f<<2)>>2]|0,q=(_|0)!=0,ie=q?ie*3|0:ie,y=d[Ae>>2]|0,I=A+8|0,M=d[I>>2]|0,q){if(T=A+12|0,_=d[T>>2]|0,y=M+y+_|0,(y|0)==(ie|0))return Ae=1,Q=pe,Ae|0;U=T}else U=A+12|0,_=d[U>>2]|0,y=M+y+_|0;if((y|0)<=(ie|0))return Ae=0,Q=pe,Ae|0;do if((_|0)>0){if(_=d[A>>2]|0,(M|0)>0){T=18640+(_*80|0)+60|0,_=A;break}_=18640+(_*80|0)+40|0,p?(Nu(de,ie,0,0),af(Ae,de,N),EA(N),hs(N,de,Ae),T=_,_=A):(T=_,_=A)}else T=18640+((d[A>>2]|0)*80|0)+20|0,_=A;while(!1);if(d[_>>2]=d[T>>2],y=T+16|0,(d[y>>2]|0)>0){_=0;do c1(Ae),_=_+1|0;while((_|0)<(d[y>>2]|0))}return A=T+4|0,d[de>>2]=d[A>>2],d[de+4>>2]=d[A+4>>2],d[de+8>>2]=d[A+8>>2],f=d[16880+(f<<2)>>2]|0,Xc(de,q?f*3|0:f),hs(Ae,de,Ae),Lr(Ae),q?_=((d[I>>2]|0)+(d[Ae>>2]|0)+(d[U>>2]|0)|0)==(ie|0)?1:2:_=2,Ae=_,Q=pe,Ae|0}function m1(A,f){A=A|0,f=f|0;var p=0;do p=Ou(A,f,0,1)|0;while((p|0)==2);return p|0}function RA(A,f,p,_,y){A=A|0,f=f|0,p=p|0,_=_|0,y=y|0;var T=0,M=0,N=0,U=0,I=0,q=0,ie=0,de=0,Ae=0,pe=0,Me=0,Le=0,Ye=0,qe=0,Fe=0,Ee=0,Pt=0,nn=0,Jt=0,Un=0,En=0,Qn=0,Tn=0;if(En=Q,Q=Q+240|0,T=En+224|0,Pt=En+208|0,nn=En,Jt=En+192|0,Un=En+176|0,Le=En+160|0,Ye=En+144|0,qe=En+128|0,Fe=En+112|0,Ee=En+96|0,d[T>>2]=f,d[Pt>>2]=d[A>>2],d[Pt+4>>2]=d[A+4>>2],d[Pt+8>>2]=d[A+8>>2],d[Pt+12>>2]=d[A+12>>2],op(Pt,T,nn),d[y>>2]=0,Me=_+p+((_|0)==6&1)|0,(Me|0)<=(p|0)){Q=En;return}U=d[T>>2]|0,I=p+6|0,q=16960+(U<<2)|0,ie=Ye+8|0,de=qe+8|0,Ae=Fe+8|0,pe=Jt+4|0,M=0,N=p,_=-1;e:for(;;){if(T=(N|0)%6|0,A=nn+(T<<4)|0,d[Jt>>2]=d[A>>2],d[Jt+4>>2]=d[A+4>>2],d[Jt+8>>2]=d[A+8>>2],d[Jt+12>>2]=d[A+12>>2],A=M,M=Ou(Jt,U,0,1)|0,(N|0)>(p|0)&(Ss(f)|0)!=0&&(A|0)!=1&&(d[Jt>>2]|0)!=(_|0)){switch(Du(nn+(((T+5|0)%6|0)<<4)+4|0,Un),Du(nn+(T<<4)+4|0,Le),Qn=+(d[q>>2]|0),ee[Ye>>3]=Qn*3,ee[ie>>3]=0,Tn=Qn*-1.5,ee[qe>>3]=Tn,ee[de>>3]=Qn*2.598076211353316,ee[Fe>>3]=Tn,ee[Ae>>3]=Qn*-2.598076211353316,T=d[Pt>>2]|0,d[17040+(T*80|0)+(((_|0)==(T|0)?d[Jt>>2]|0:_)<<2)>>2]|0){case 1:{A=qe,_=Ye;break}case 3:{A=Fe,_=qe;break}case 2:{A=Ye,_=Fe;break}default:{A=8;break e}}xp(Un,Le,_,A,Ee),!(bp(Un,Ee)|0)&&!(bp(Le,Ee)|0)&&(Bu(Ee,d[Pt>>2]|0,U,1,y+8+(d[y>>2]<<4)|0),d[y>>2]=(d[y>>2]|0)+1)}if((N|0)<(I|0)&&(Du(pe,Un),Bu(Un,d[Jt>>2]|0,U,1,y+8+(d[y>>2]<<4)|0),d[y>>2]=(d[y>>2]|0)+1),N=N+1|0,(N|0)>=(Me|0)){A=3;break}else _=d[Jt>>2]|0}if((A|0)==3){Q=En;return}else(A|0)==8&&Ut(27054,27017,737,27099)}function op(A,f,p){A=A|0,f=f|0,p=p|0;var _=0,y=0,T=0,M=0,N=0,U=0;U=Q,Q=Q+160|0,_=U+80|0,y=U,T=_,M=20368,N=T+72|0;do d[T>>2]=d[M>>2],T=T+4|0,M=M+4|0;while((T|0)<(N|0));T=y,M=20448,N=T+72|0;do d[T>>2]=d[M>>2],T=T+4|0,M=M+4|0;while((T|0)<(N|0));N=(Ss(d[f>>2]|0)|0)==0,_=N?_:y,y=A+4|0,h1(y),f1(y),Ss(d[f>>2]|0)|0&&(Lu(y),d[f>>2]=(d[f>>2]|0)+1),d[p>>2]=d[A>>2],f=p+4|0,hs(y,_,f),Lr(f),d[p+16>>2]=d[A>>2],f=p+20|0,hs(y,_+12|0,f),Lr(f),d[p+32>>2]=d[A>>2],f=p+36|0,hs(y,_+24|0,f),Lr(f),d[p+48>>2]=d[A>>2],f=p+52|0,hs(y,_+36|0,f),Lr(f),d[p+64>>2]=d[A>>2],f=p+68|0,hs(y,_+48|0,f),Lr(f),d[p+80>>2]=d[A>>2],p=p+84|0,hs(y,_+60|0,p),Lr(p),Q=U}function Qc(A,f){return A=A|0,f=f|0,f=xt(A|0,f|0,52)|0,K()|0,f&15|0}function g1(A,f){return A=A|0,f=f|0,f=xt(A|0,f|0,45)|0,K()|0,f&127|0}function bx(A,f,p,_){return A=A|0,f=f|0,p=p|0,_=_|0,(p+-1|0)>>>0>14?(_=4,_|0):(p=xt(A|0,f|0,(15-p|0)*3|0)|0,K()|0,d[_>>2]=p&7,_=0,_|0)}function Sx(A,f,p,_){A=A|0,f=f|0,p=p|0,_=_|0;var y=0,T=0,M=0,N=0,U=0,I=0;if(A>>>0>15)return _=4,_|0;if(f>>>0>121)return _=17,_|0;M=Nt(A|0,0,52)|0,y=K()|0,N=Nt(f|0,0,45)|0,y=y|(K()|0)|134225919;e:do if((A|0)>=1){for(N=1,M=(at[20528+f>>0]|0)!=0,T=-1;;){if(f=d[p+(N+-1<<2)>>2]|0,f>>>0>6){y=18,f=10;break}if(!((f|0)==0|M^1))if((f|0)==1){y=19,f=10;break}else M=0;if(I=(15-N|0)*3|0,U=Nt(7,0,I|0)|0,y=y&~(K()|0),f=Nt(f|0,((f|0)<0)<<31>>31|0,I|0)|0,T=f|T&~U,y=K()|0|y,(N|0)<(A|0))N=N+1|0;else break e}if((f|0)==10)return y|0}else T=-1;while(!1);return I=_,d[I>>2]=T,d[I+4>>2]=y,I=0,I|0}function NA(A,f){A=A|0,f=f|0;var p=0,_=0,y=0,T=0,M=0;return!(!0&(f&-16777216|0)==134217728)||(_=xt(A|0,f|0,52)|0,K()|0,_=_&15,p=xt(A|0,f|0,45)|0,K()|0,p=p&127,p>>>0>121)?(A=0,A|0):(M=(_^15)*3|0,y=xt(A|0,f|0,M|0)|0,M=Nt(y|0,K()|0,M|0)|0,y=K()|0,T=Ur(-1227133514,-1171,M|0,y|0)|0,!((M&613566756&T|0)==0&(y&4681&(K()|0)|0)==0)||(M=(_*3|0)+19|0,T=Nt(~A|0,~f|0,M|0)|0,M=xt(T|0,K()|0,M|0)|0,!((_|0)==15|(M|0)==0&(K()|0)==0))?(M=0,M|0):!(at[20528+p>>0]|0)||(f=f&8191,(A|0)==0&(f|0)==0)?(M=1,M|0):(M=ff(A|0,f|0)|0,K()|0,((63-M|0)%3|0|0)!=0|0))}function v1(A,f){A=A|0,f=f|0;var p=0,_=0,y=0,T=0,M=0;return!0&(f&-16777216|0)==134217728&&(_=xt(A|0,f|0,52)|0,K()|0,_=_&15,p=xt(A|0,f|0,45)|0,K()|0,p=p&127,p>>>0<=121)&&(M=(_^15)*3|0,y=xt(A|0,f|0,M|0)|0,M=Nt(y|0,K()|0,M|0)|0,y=K()|0,T=Ur(-1227133514,-1171,M|0,y|0)|0,(M&613566756&T|0)==0&(y&4681&(K()|0)|0)==0)&&(M=(_*3|0)+19|0,T=Nt(~A|0,~f|0,M|0)|0,M=xt(T|0,K()|0,M|0)|0,(_|0)==15|(M|0)==0&(K()|0)==0)&&(!(at[20528+p>>0]|0)||(p=f&8191,(A|0)==0&(p|0)==0)||(M=ff(A|0,p|0)|0,K()|0,(63-M|0)%3|0|0))||p1(A,f)|0?(M=1,M|0):(M=(ul(A,f)|0)!=0&1,M|0)}function Iu(A,f,p,_){A=A|0,f=f|0,p=p|0,_=_|0;var y=0,T=0,M=0,N=0;if(y=Nt(f|0,0,52)|0,T=K()|0,p=Nt(p|0,0,45)|0,p=T|(K()|0)|134225919,(f|0)<1){T=-1,_=p,f=A,d[f>>2]=T,A=A+4|0,d[A>>2]=_;return}for(T=1,y=-1;M=(15-T|0)*3|0,N=Nt(7,0,M|0)|0,p=p&~(K()|0),M=Nt(_|0,0,M|0)|0,y=y&~N|M,p=p|(K()|0),(T|0)!=(f|0);)T=T+1|0;N=A,M=N,d[M>>2]=y,N=N+4|0,d[N>>2]=p}function Fu(A,f,p,_){A=A|0,f=f|0,p=p|0,_=_|0;var y=0,T=0;if(T=xt(A|0,f|0,52)|0,K()|0,T=T&15,p>>>0>15)return _=4,_|0;if((T|0)<(p|0))return _=12,_|0;if((T|0)==(p|0))return d[_>>2]=A,d[_+4>>2]=f,_=0,_|0;if(y=Nt(p|0,0,52)|0,y=y|A,A=K()|0|f&-15728641,(T|0)>(p|0))do f=Nt(7,0,(14-p|0)*3|0)|0,p=p+1|0,y=f|y,A=K()|0|A;while((p|0)<(T|0));return d[_>>2]=y,d[_+4>>2]=A,_=0,_|0}function lf(A,f,p,_){A=A|0,f=f|0,p=p|0,_=_|0;var y=0,T=0,M=0;if(T=xt(A|0,f|0,52)|0,K()|0,T=T&15,!((p|0)<16&(T|0)<=(p|0)))return _=4,_|0;y=p-T|0,p=xt(A|0,f|0,45)|0,K()|0;e:do if(!(Bi(p&127)|0))p=Bo(7,0,y,((y|0)<0)<<31>>31)|0,y=K()|0;else{t:do if(T|0){for(p=1;M=Nt(7,0,(15-p|0)*3|0)|0,!!((M&A|0)==0&((K()|0)&f|0)==0);)if(p>>>0>>0)p=p+1|0;else break t;p=Bo(7,0,y,((y|0)<0)<<31>>31)|0,y=K()|0;break e}while(!1);p=Bo(7,0,y,((y|0)<0)<<31>>31)|0,p=fr(p|0,K()|0,5,0)|0,p=Xt(p|0,K()|0,-5,-1)|0,p=ko(p|0,K()|0,6,0)|0,p=Xt(p|0,K()|0,1,0)|0,y=K()|0}while(!1);return M=_,d[M>>2]=p,d[M+4>>2]=y,M=0,M|0}function Ci(A,f){A=A|0,f=f|0;var p=0,_=0,y=0;if(y=xt(A|0,f|0,45)|0,K()|0,!(Bi(y&127)|0))return y=0,y|0;y=xt(A|0,f|0,52)|0,K()|0,y=y&15;e:do if(!y)p=0;else for(_=1;;){if(p=xt(A|0,f|0,(15-_|0)*3|0)|0,K()|0,p=p&7,p|0)break e;if(_>>>0>>0)_=_+1|0;else{p=0;break}}while(!1);return y=(p|0)==0&1,y|0}function _1(A,f,p,_){A=A|0,f=f|0,p=p|0,_=_|0;var y=0,T=0,M=0,N=0;if(M=Q,Q=Q+16|0,T=M,sl(T,A,f,p),f=T,A=d[f>>2]|0,f=d[f+4>>2]|0,(A|0)==0&(f|0)==0)return Q=M,0;y=0,p=0;do N=_+(y<<3)|0,d[N>>2]=A,d[N+4>>2]=f,y=Xt(y|0,p|0,1,0)|0,p=K()|0,uf(T),N=T,A=d[N>>2]|0,f=d[N+4>>2]|0;while(!((A|0)==0&(f|0)==0));return Q=M,0}function lp(A,f,p,_){return A=A|0,f=f|0,p=p|0,_=_|0,(_|0)<(p|0)?(p=f,_=A,At(p|0),_|0):(p=Nt(-1,-1,((_-p|0)*3|0)+3|0)|0,_=Nt(~p|0,~(K()|0)|0,(15-_|0)*3|0)|0,p=~(K()|0)&f,_=~_&A,At(p|0),_|0)}function DA(A,f,p,_){A=A|0,f=f|0,p=p|0,_=_|0;var y=0;return y=xt(A|0,f|0,52)|0,K()|0,y=y&15,(p|0)<16&(y|0)<=(p|0)?((y|0)<(p|0)&&(y=Nt(-1,-1,((p+-1-y|0)*3|0)+3|0)|0,y=Nt(~y|0,~(K()|0)|0,(15-p|0)*3|0)|0,f=~(K()|0)&f,A=~y&A),y=Nt(p|0,0,52)|0,p=f&-15728641|(K()|0),d[_>>2]=A|y,d[_+4>>2]=p,_=0,_|0):(_=4,_|0)}function up(A,f,p,_){A=A|0,f=f|0,p=p|0,_=_|0;var y=0,T=0,M=0,N=0,U=0,I=0,q=0,ie=0,de=0,Ae=0,pe=0,Me=0,Le=0,Ye=0,qe=0,Fe=0,Ee=0,Pt=0,nn=0,Jt=0,Un=0,En=0,Qn=0,Tn=0,an=0,Lt=0;if((p|0)==0&(_|0)==0)return Lt=0,Lt|0;if(y=A,T=d[y>>2]|0,y=d[y+4>>2]|0,!0&(y&15728640|0)==0){if(!((_|0)>0|(_|0)==0&p>>>0>0)||(Lt=f,d[Lt>>2]=T,d[Lt+4>>2]=y,(p|0)==1&(_|0)==0))return Lt=0,Lt|0;y=1,T=0;do Tn=A+(y<<3)|0,an=d[Tn+4>>2]|0,Lt=f+(y<<3)|0,d[Lt>>2]=d[Tn>>2],d[Lt+4>>2]=an,y=Xt(y|0,T|0,1,0)|0,T=K()|0;while((T|0)<(_|0)|(T|0)==(_|0)&y>>>0

>>0);return y=0,y|0}if(Qn=p<<3,an=Fo(Qn)|0,!an)return Lt=13,Lt|0;if(Gl(an|0,A|0,Qn|0)|0,Tn=Ks(p,8)|0,!Tn)return An(an),Lt=13,Lt|0;e:for(;;){y=an,I=d[y>>2]|0,y=d[y+4>>2]|0,Un=xt(I|0,y|0,52)|0,K()|0,Un=Un&15,En=Un+-1|0,Jt=(Un|0)!=0,nn=(_|0)>0|(_|0)==0&p>>>0>0;t:do if(Jt&nn){if(qe=Nt(En|0,0,52)|0,Fe=K()|0,En>>>0>15){if(!((I|0)==0&(y|0)==0)){Lt=16;break e}for(T=0,A=0;;){if(T=Xt(T|0,A|0,1,0)|0,A=K()|0,!((A|0)<(_|0)|(A|0)==(_|0)&T>>>0

>>0))break t;if(M=an+(T<<3)|0,Pt=d[M>>2]|0,M=d[M+4>>2]|0,!((Pt|0)==0&(M|0)==0)){y=M,Lt=16;break e}}}for(N=I,A=y,T=0,M=0;;){if(!((N|0)==0&(A|0)==0)){if(!(!0&(A&117440512|0)==0)){Lt=21;break e}if(q=xt(N|0,A|0,52)|0,K()|0,q=q&15,(q|0)<(En|0)){y=12,Lt=27;break e}if((q|0)!=(En|0)&&(N=N|qe,A=A&-15728641|Fe,q>>>0>=Un>>>0)){U=En;do Pt=Nt(7,0,(14-U|0)*3|0)|0,U=U+1|0,N=Pt|N,A=K()|0|A;while(U>>>0>>0)}if(de=ec(N|0,A|0,p|0,_|0)|0,Ae=K()|0,U=Tn+(de<<3)|0,q=U,ie=d[q>>2]|0,q=d[q+4>>2]|0,!((ie|0)==0&(q|0)==0)){Le=0,Ye=0;do{if((Le|0)>(_|0)|(Le|0)==(_|0)&Ye>>>0>p>>>0){Lt=31;break e}if((ie|0)==(N|0)&(q&-117440513|0)==(A|0)){pe=xt(ie|0,q|0,56)|0,K()|0,pe=pe&7,Me=pe+1|0,Pt=xt(ie|0,q|0,45)|0,K()|0;n:do if(!(Bi(Pt&127)|0))q=7;else{if(ie=xt(ie|0,q|0,52)|0,K()|0,ie=ie&15,!ie){q=6;break}for(q=1;;){if(Pt=Nt(7,0,(15-q|0)*3|0)|0,!((Pt&N|0)==0&((K()|0)&A|0)==0)){q=7;break n}if(q>>>0>>0)q=q+1|0;else{q=6;break}}}while(!1);if((pe+2|0)>>>0>q>>>0){Lt=41;break e}Pt=Nt(Me|0,0,56)|0,A=K()|0|A&-117440513,Ee=U,d[Ee>>2]=0,d[Ee+4>>2]=0,N=Pt|N}else de=Xt(de|0,Ae|0,1,0)|0,de=th(de|0,K()|0,p|0,_|0)|0,Ae=K()|0;Ye=Xt(Ye|0,Le|0,1,0)|0,Le=K()|0,U=Tn+(de<<3)|0,q=U,ie=d[q>>2]|0,q=d[q+4>>2]|0}while(!((ie|0)==0&(q|0)==0))}Pt=U,d[Pt>>2]=N,d[Pt+4>>2]=A}if(T=Xt(T|0,M|0,1,0)|0,M=K()|0,!((M|0)<(_|0)|(M|0)==(_|0)&T>>>0

>>0))break t;A=an+(T<<3)|0,N=d[A>>2]|0,A=d[A+4>>2]|0}}while(!1);if(Pt=Xt(p|0,_|0,5,0)|0,Ee=K()|0,Ee>>>0<0|(Ee|0)==0&Pt>>>0<11){Lt=85;break}if(Pt=ko(p|0,_|0,6,0)|0,K()|0,Pt=Ks(Pt,8)|0,!Pt){Lt=48;break}do if(nn){for(Me=0,A=0,pe=0,Le=0;;){if(q=Tn+(Me<<3)|0,M=q,T=d[M>>2]|0,M=d[M+4>>2]|0,(T|0)==0&(M|0)==0)Ee=pe;else{ie=xt(T|0,M|0,56)|0,K()|0,ie=ie&7,N=ie+1|0,de=M&-117440513,Ee=xt(T|0,M|0,45)|0,K()|0;t:do if(Bi(Ee&127)|0){if(Ae=xt(T|0,M|0,52)|0,K()|0,Ae=Ae&15,Ae|0)for(U=1;;){if(Ee=Nt(7,0,(15-U|0)*3|0)|0,!((T&Ee|0)==0&(de&(K()|0)|0)==0))break t;if(U>>>0>>0)U=U+1|0;else break}M=Nt(N|0,0,56)|0,T=M|T,M=K()|0|de,N=q,d[N>>2]=T,d[N+4>>2]=M,N=ie+2|0}while(!1);(N|0)==7?(Ee=Pt+(A<<3)|0,d[Ee>>2]=T,d[Ee+4>>2]=M&-117440513,A=Xt(A|0,pe|0,1,0)|0,Ee=K()|0):Ee=pe}if(Me=Xt(Me|0,Le|0,1,0)|0,Le=K()|0,(Le|0)<(_|0)|(Le|0)==(_|0)&Me>>>0

>>0)pe=Ee;else break}if(nn){if(Ye=En>>>0>15,qe=Nt(En|0,0,52)|0,Fe=K()|0,!Jt){for(T=0,U=0,N=0,M=0;(I|0)==0&(y|0)==0||(En=f+(T<<3)|0,d[En>>2]=I,d[En+4>>2]=y,T=Xt(T|0,U|0,1,0)|0,U=K()|0),N=Xt(N|0,M|0,1,0)|0,M=K()|0,!!((M|0)<(_|0)|(M|0)==(_|0)&N>>>0

>>0);)y=an+(N<<3)|0,I=d[y>>2]|0,y=d[y+4>>2]|0;y=Ee;break}for(T=0,U=0,M=0,N=0;;){do if(!((I|0)==0&(y|0)==0)){if(Ae=xt(I|0,y|0,52)|0,K()|0,Ae=Ae&15,Ye|(Ae|0)<(En|0)){Lt=80;break e}if((Ae|0)!=(En|0)){if(q=I|qe,ie=y&-15728641|Fe,Ae>>>0>=Un>>>0){de=En;do Jt=Nt(7,0,(14-de|0)*3|0)|0,de=de+1|0,q=Jt|q,ie=K()|0|ie;while(de>>>0>>0)}}else q=I,ie=y;pe=ec(q|0,ie|0,p|0,_|0)|0,de=0,Ae=0,Le=K()|0;do{if((de|0)>(_|0)|(de|0)==(_|0)&Ae>>>0>p>>>0){Lt=81;break e}if(Jt=Tn+(pe<<3)|0,Me=d[Jt+4>>2]|0,(Me&-117440513|0)==(ie|0)&&(d[Jt>>2]|0)==(q|0)){Lt=65;break}Jt=Xt(pe|0,Le|0,1,0)|0,pe=th(Jt|0,K()|0,p|0,_|0)|0,Le=K()|0,Ae=Xt(Ae|0,de|0,1,0)|0,de=K()|0,Jt=Tn+(pe<<3)|0}while(!((d[Jt>>2]|0)==(q|0)&&(d[Jt+4>>2]|0)==(ie|0)));if((Lt|0)==65&&(Lt=0,!0&(Me&117440512|0)==100663296))break;Jt=f+(T<<3)|0,d[Jt>>2]=I,d[Jt+4>>2]=y,T=Xt(T|0,U|0,1,0)|0,U=K()|0}while(!1);if(M=Xt(M|0,N|0,1,0)|0,N=K()|0,!((N|0)<(_|0)|(N|0)==(_|0)&M>>>0

>>0))break;y=an+(M<<3)|0,I=d[y>>2]|0,y=d[y+4>>2]|0}y=Ee}else T=0,y=Ee}else T=0,A=0,y=0;while(!1);if(uo(Tn|0,0,Qn|0)|0,Gl(an|0,Pt|0,A<<3|0)|0,An(Pt),(A|0)==0&(y|0)==0){Lt=89;break}else f=f+(T<<3)|0,_=y,p=A}if((Lt|0)==16)!0&(y&117440512|0)==0?(y=4,Lt=27):Lt=21;else if((Lt|0)==31)Ut(27795,27122,620,27132);else{if((Lt|0)==41)return An(an),An(Tn),Lt=10,Lt|0;if((Lt|0)==48)return An(an),An(Tn),Lt=13,Lt|0;(Lt|0)==80?Ut(27795,27122,711,27132):(Lt|0)==81?Ut(27795,27122,723,27132):(Lt|0)==85&&(Gl(f|0,an|0,p<<3|0)|0,Lt=89)}return(Lt|0)==21?(An(an),An(Tn),Lt=5,Lt|0):(Lt|0)==27?(An(an),An(Tn),Lt=y,Lt|0):(Lt|0)==89?(An(an),An(Tn),Lt=0,Lt|0):0}function y1(A,f,p,_,y,T,M){A=A|0,f=f|0,p=p|0,_=_|0,y=y|0,T=T|0,M=M|0;var N=0,U=0,I=0,q=0,ie=0,de=0,Ae=0,pe=0,Me=0;if(Me=Q,Q=Q+16|0,pe=Me,!((p|0)>0|(p|0)==0&f>>>0>0))return pe=0,Q=Me,pe|0;if((M|0)>=16)return pe=12,Q=Me,pe|0;de=0,Ae=0,ie=0,N=0;e:for(;;){if(I=A+(de<<3)|0,U=d[I>>2]|0,I=d[I+4>>2]|0,q=xt(U|0,I|0,52)|0,K()|0,(q&15|0)>(M|0)){N=12,U=11;break}if(sl(pe,U,I,M),q=pe,I=d[q>>2]|0,q=d[q+4>>2]|0,(I|0)==0&(q|0)==0)U=ie;else{U=ie;do{if(!((N|0)<(T|0)|(N|0)==(T|0)&U>>>0>>0)){U=10;break e}ie=_+(U<<3)|0,d[ie>>2]=I,d[ie+4>>2]=q,U=Xt(U|0,N|0,1,0)|0,N=K()|0,uf(pe),ie=pe,I=d[ie>>2]|0,q=d[ie+4>>2]|0}while(!((I|0)==0&(q|0)==0))}if(de=Xt(de|0,Ae|0,1,0)|0,Ae=K()|0,(Ae|0)<(p|0)|(Ae|0)==(p|0)&de>>>0>>0)ie=U;else{N=0,U=11;break}}return(U|0)==10?(pe=14,Q=Me,pe|0):(U|0)==11?(Q=Me,N|0):0}function x1(A,f,p,_,y){A=A|0,f=f|0,p=p|0,_=_|0,y=y|0;var T=0,M=0,N=0,U=0,I=0,q=0,ie=0,de=0;de=Q,Q=Q+16|0,ie=de;e:do if((p|0)>0|(p|0)==0&f>>>0>0){for(I=0,M=0,T=0,q=0;;){if(U=A+(I<<3)|0,N=d[U>>2]|0,U=d[U+4>>2]|0,!((N|0)==0&(U|0)==0)&&(U=(lf(N,U,_,ie)|0)==0,N=ie,M=Xt(d[N>>2]|0,d[N+4>>2]|0,M|0,T|0)|0,T=K()|0,!U)){T=12;break}if(I=Xt(I|0,q|0,1,0)|0,q=K()|0,!((q|0)<(p|0)|(q|0)==(p|0)&I>>>0>>0))break e}return Q=de,T|0}else M=0,T=0;while(!1);return d[y>>2]=M,d[y+4>>2]=T,y=0,Q=de,y|0}function b1(A,f){return A=A|0,f=f|0,f=xt(A|0,f|0,52)|0,K()|0,f&1|0}function $s(A,f){A=A|0,f=f|0;var p=0,_=0,y=0;if(y=xt(A|0,f|0,52)|0,K()|0,y=y&15,!y)return y=0,y|0;for(_=1;;){if(p=xt(A|0,f|0,(15-_|0)*3|0)|0,K()|0,p=p&7,p|0){_=5;break}if(_>>>0>>0)_=_+1|0;else{p=0,_=5;break}}return(_|0)==5?p|0:0}function cp(A,f){A=A|0,f=f|0;var p=0,_=0,y=0,T=0,M=0,N=0,U=0;if(U=xt(A|0,f|0,52)|0,K()|0,U=U&15,!U)return N=f,U=A,At(N|0),U|0;for(N=1,p=0;;){T=(15-N|0)*3|0,_=Nt(7,0,T|0)|0,y=K()|0,M=xt(A|0,f|0,T|0)|0,K()|0,T=Nt(Uu(M&7)|0,0,T|0)|0,M=K()|0,A=T|A&~_,f=M|f&~y;e:do if(!p)if((T&_|0)==0&(M&y|0)==0)p=0;else if(_=xt(A|0,f|0,52)|0,K()|0,_=_&15,!_)p=1;else{p=1;t:for(;;){switch(M=xt(A|0,f|0,(15-p|0)*3|0)|0,K()|0,M&7){case 1:break t;case 0:break;default:{p=1;break e}}if(p>>>0<_>>>0)p=p+1|0;else{p=1;break e}}for(p=1;;)if(M=(15-p|0)*3|0,y=xt(A|0,f|0,M|0)|0,K()|0,T=Nt(7,0,M|0)|0,f=f&~(K()|0),M=Nt(Uu(y&7)|0,0,M|0)|0,A=A&~T|M,f=f|(K()|0),p>>>0<_>>>0)p=p+1|0;else{p=1;break}}while(!1);if(N>>>0>>0)N=N+1|0;else break}return At(f|0),A|0}function ku(A,f){A=A|0,f=f|0;var p=0,_=0,y=0,T=0,M=0;if(_=xt(A|0,f|0,52)|0,K()|0,_=_&15,!_)return p=f,_=A,At(p|0),_|0;for(p=1;T=(15-p|0)*3|0,M=xt(A|0,f|0,T|0)|0,K()|0,y=Nt(7,0,T|0)|0,f=f&~(K()|0),T=Nt(Uu(M&7)|0,0,T|0)|0,A=T|A&~y,f=K()|0|f,p>>>0<_>>>0;)p=p+1|0;return At(f|0),A|0}function Tx(A,f){A=A|0,f=f|0;var p=0,_=0,y=0,T=0,M=0,N=0,U=0;if(U=xt(A|0,f|0,52)|0,K()|0,U=U&15,!U)return N=f,U=A,At(N|0),U|0;for(N=1,p=0;;){T=(15-N|0)*3|0,_=Nt(7,0,T|0)|0,y=K()|0,M=xt(A|0,f|0,T|0)|0,K()|0,T=Nt(rl(M&7)|0,0,T|0)|0,M=K()|0,A=T|A&~_,f=M|f&~y;e:do if(!p)if((T&_|0)==0&(M&y|0)==0)p=0;else if(_=xt(A|0,f|0,52)|0,K()|0,_=_&15,!_)p=1;else{p=1;t:for(;;){switch(M=xt(A|0,f|0,(15-p|0)*3|0)|0,K()|0,M&7){case 1:break t;case 0:break;default:{p=1;break e}}if(p>>>0<_>>>0)p=p+1|0;else{p=1;break e}}for(p=1;;)if(y=(15-p|0)*3|0,T=Nt(7,0,y|0)|0,M=f&~(K()|0),f=xt(A|0,f|0,y|0)|0,K()|0,f=Nt(rl(f&7)|0,0,y|0)|0,A=A&~T|f,f=M|(K()|0),p>>>0<_>>>0)p=p+1|0;else{p=1;break}}while(!1);if(N>>>0>>0)N=N+1|0;else break}return At(f|0),A|0}function hp(A,f){A=A|0,f=f|0;var p=0,_=0,y=0,T=0,M=0;if(_=xt(A|0,f|0,52)|0,K()|0,_=_&15,!_)return p=f,_=A,At(p|0),_|0;for(p=1;M=(15-p|0)*3|0,T=Nt(7,0,M|0)|0,y=f&~(K()|0),f=xt(A|0,f|0,M|0)|0,K()|0,f=Nt(rl(f&7)|0,0,M|0)|0,A=f|A&~T,f=K()|0|y,p>>>0<_>>>0;)p=p+1|0;return At(f|0),A|0}function Aa(A,f){A=A|0,f=f|0;var p=0,_=0,y=0,T=0,M=0,N=0,U=0,I=0,q=0;if(U=Q,Q=Q+64|0,N=U+40|0,_=U+24|0,y=U+12|0,T=U,Nt(f|0,0,52)|0,p=K()|0|134225919,!f)return(d[A+4>>2]|0)>2||(d[A+8>>2]|0)>2||(d[A+12>>2]|0)>2?(M=0,N=0,At(M|0),Q=U,N|0):(Nt(Po(A)|0,0,45)|0,M=K()|0|p,N=-1,At(M|0),Q=U,N|0);if(d[N>>2]=d[A>>2],d[N+4>>2]=d[A+4>>2],d[N+8>>2]=d[A+8>>2],d[N+12>>2]=d[A+12>>2],M=N+4|0,(f|0)>0)for(A=-1;d[_>>2]=d[M>>2],d[_+4>>2]=d[M+4>>2],d[_+8>>2]=d[M+8>>2],f&1?(hx(M),d[y>>2]=d[M>>2],d[y+4>>2]=d[M+4>>2],d[y+8>>2]=d[M+8>>2],Yc(y)):(l1(M),d[y>>2]=d[M>>2],d[y+4>>2]=d[M+4>>2],d[y+8>>2]=d[M+8>>2],Lu(y)),af(_,y,T),Lr(T),q=(15-f|0)*3|0,I=Nt(7,0,q|0)|0,p=p&~(K()|0),q=Nt(Pu(T)|0,0,q|0)|0,A=q|A&~I,p=K()|0|p,(f|0)>1;)f=f+-1|0;else A=-1;e:do if((d[M>>2]|0)<=2&&(d[N+8>>2]|0)<=2&&(d[N+12>>2]|0)<=2){if(_=Po(N)|0,f=Nt(_|0,0,45)|0,f=f|A,A=K()|0|p&-1040385,T=ep(N)|0,!(Bi(_)|0)){if((T|0)<=0)break;for(y=0;;){if(_=xt(f|0,A|0,52)|0,K()|0,_=_&15,_)for(p=1;q=(15-p|0)*3|0,N=xt(f|0,A|0,q|0)|0,K()|0,I=Nt(7,0,q|0)|0,A=A&~(K()|0),q=Nt(Uu(N&7)|0,0,q|0)|0,f=f&~I|q,A=A|(K()|0),p>>>0<_>>>0;)p=p+1|0;if(y=y+1|0,(y|0)==(T|0))break e}}y=xt(f|0,A|0,52)|0,K()|0,y=y&15;t:do if(y){p=1;n:for(;;){switch(q=xt(f|0,A|0,(15-p|0)*3|0)|0,K()|0,q&7){case 1:break n;case 0:break;default:break t}if(p>>>0>>0)p=p+1|0;else break t}if(Ru(_,d[N>>2]|0)|0)for(p=1;N=(15-p|0)*3|0,I=Nt(7,0,N|0)|0,q=A&~(K()|0),A=xt(f|0,A|0,N|0)|0,K()|0,A=Nt(rl(A&7)|0,0,N|0)|0,f=f&~I|A,A=q|(K()|0),p>>>0>>0;)p=p+1|0;else for(p=1;q=(15-p|0)*3|0,N=xt(f|0,A|0,q|0)|0,K()|0,I=Nt(7,0,q|0)|0,A=A&~(K()|0),q=Nt(Uu(N&7)|0,0,q|0)|0,f=f&~I|q,A=A|(K()|0),p>>>0>>0;)p=p+1|0}while(!1);if((T|0)>0){p=0;do f=cp(f,A)|0,A=K()|0,p=p+1|0;while((p|0)!=(T|0))}}else f=0,A=0;while(!1);return I=A,q=f,At(I|0),Q=U,q|0}function Ss(A){return A=A|0,(A|0)%2|0|0}function PA(A,f,p){A=A|0,f=f|0,p=p|0;var _=0,y=0;return y=Q,Q=Q+16|0,_=y,f>>>0>15?(_=4,Q=y,_|0):(d[A+4>>2]&2146435072|0)==2146435072||(d[A+8+4>>2]&2146435072|0)==2146435072?(_=3,Q=y,_|0):(_x(A,f,_),f=Aa(_,f)|0,_=K()|0,d[p>>2]=f,d[p+4>>2]=_,(f|0)==0&(_|0)==0&&Ut(27795,27122,1050,27145),_=0,Q=y,_|0)}function LA(A,f,p){A=A|0,f=f|0,p=p|0;var _=0,y=0,T=0,M=0;if(y=p+4|0,T=xt(A|0,f|0,52)|0,K()|0,T=T&15,M=xt(A|0,f|0,45)|0,K()|0,_=(T|0)==0,Bi(M&127)|0){if(_)return M=1,M|0;_=1}else{if(_)return M=0,M|0;(d[y>>2]|0)==0&&(d[p+8>>2]|0)==0?_=(d[p+12>>2]|0)!=0&1:_=1}for(p=1;p&1?Yc(y):Lu(y),M=xt(A|0,f|0,(15-p|0)*3|0)|0,K()|0,u1(y,M&7),p>>>0>>0;)p=p+1|0;return _|0}function zu(A,f,p){A=A|0,f=f|0,p=p|0;var _=0,y=0,T=0,M=0,N=0,U=0,I=0,q=0;if(q=Q,Q=Q+16|0,U=q,I=xt(A|0,f|0,45)|0,K()|0,I=I&127,I>>>0>121)return d[p>>2]=0,d[p+4>>2]=0,d[p+8>>2]=0,d[p+12>>2]=0,I=5,Q=q,I|0;e:do if((Bi(I)|0)!=0&&(T=xt(A|0,f|0,52)|0,K()|0,T=T&15,(T|0)!=0)){_=1;t:for(;;){switch(N=xt(A|0,f|0,(15-_|0)*3|0)|0,K()|0,N&7){case 5:break t;case 0:break;default:{_=f;break e}}if(_>>>0>>0)_=_+1|0;else{_=f;break e}}for(y=1,_=f;f=(15-y|0)*3|0,M=Nt(7,0,f|0)|0,N=_&~(K()|0),_=xt(A|0,_|0,f|0)|0,K()|0,_=Nt(rl(_&7)|0,0,f|0)|0,A=A&~M|_,_=N|(K()|0),y>>>0>>0;)y=y+1|0}else _=f;while(!1);if(N=7696+(I*28|0)|0,d[p>>2]=d[N>>2],d[p+4>>2]=d[N+4>>2],d[p+8>>2]=d[N+8>>2],d[p+12>>2]=d[N+12>>2],!(LA(A,_,p)|0))return I=0,Q=q,I|0;if(M=p+4|0,d[U>>2]=d[M>>2],d[U+4>>2]=d[M+4>>2],d[U+8>>2]=d[M+8>>2],T=xt(A|0,_|0,52)|0,K()|0,N=T&15,T&1?(Lu(M),T=N+1|0):T=N,!(Bi(I)|0))_=0;else{e:do if(!N)_=0;else for(f=1;;){if(y=xt(A|0,_|0,(15-f|0)*3|0)|0,K()|0,y=y&7,y|0){_=y;break e}if(f>>>0>>0)f=f+1|0;else{_=0;break}}while(!1);_=(_|0)==4&1}if(!(Ou(p,T,_,0)|0))(T|0)!=(N|0)&&(d[M>>2]=d[U>>2],d[M+4>>2]=d[U+4>>2],d[M+8>>2]=d[U+8>>2]);else{if(Bi(I)|0)do;while((Ou(p,T,0,0)|0)!=0);(T|0)!=(N|0)&&l1(M)}return I=0,Q=q,I|0}function Ol(A,f,p){A=A|0,f=f|0,p=p|0;var _=0,y=0,T=0;return T=Q,Q=Q+16|0,_=T,y=zu(A,f,_)|0,y|0?(Q=T,y|0):(y=xt(A|0,f|0,52)|0,K()|0,of(_,y&15,p),y=0,Q=T,y|0)}function Il(A,f,p){A=A|0,f=f|0,p=p|0;var _=0,y=0,T=0,M=0,N=0;if(M=Q,Q=Q+16|0,T=M,_=zu(A,f,T)|0,_|0)return T=_,Q=M,T|0;_=xt(A|0,f|0,45)|0,K()|0,_=(Bi(_&127)|0)==0,y=xt(A|0,f|0,52)|0,K()|0,y=y&15;e:do if(!_){if(y|0)for(_=1;;){if(N=Nt(7,0,(15-_|0)*3|0)|0,!((N&A|0)==0&((K()|0)&f|0)==0))break e;if(_>>>0>>0)_=_+1|0;else break}return sp(T,y,0,5,p),N=0,Q=M,N|0}while(!1);return RA(T,y,0,6,p),N=0,Q=M,N|0}function wx(A,f,p){A=A|0,f=f|0,p=p|0;var _=0,y=0,T=0;if(y=xt(A|0,f|0,45)|0,K()|0,!(Bi(y&127)|0))return y=2,d[p>>2]=y,0;if(y=xt(A|0,f|0,52)|0,K()|0,y=y&15,!y)return y=5,d[p>>2]=y,0;for(_=1;;){if(T=Nt(7,0,(15-_|0)*3|0)|0,!((T&A|0)==0&((K()|0)&f|0)==0)){_=2,A=6;break}if(_>>>0>>0)_=_+1|0;else{_=5,A=6;break}}return(A|0)==6&&(d[p>>2]=_),0}function Gu(A,f,p){A=A|0,f=f|0,p=p|0;var _=0,y=0,T=0,M=0,N=0,U=0,I=0,q=0,ie=0;ie=Q,Q=Q+128|0,I=ie+112|0,T=ie+96|0,q=ie,y=xt(A|0,f|0,52)|0,K()|0,N=y&15,d[I>>2]=N,M=xt(A|0,f|0,45)|0,K()|0,M=M&127;e:do if(Bi(M)|0){if(N|0)for(_=1;;){if(U=Nt(7,0,(15-_|0)*3|0)|0,!((U&A|0)==0&((K()|0)&f|0)==0)){y=0;break e}if(_>>>0>>0)_=_+1|0;else break}if(y&1)y=1;else return U=Nt(N+1|0,0,52)|0,q=K()|0|f&-15728641,I=Nt(7,0,(14-N|0)*3|0)|0,q=Gu((U|A)&~I,q&~(K()|0),p)|0,Q=ie,q|0}else y=0;while(!1);if(_=zu(A,f,T)|0,!_){y?(ap(T,I,q),U=5):(op(T,I,q),U=6);e:do if(Bi(M)|0)if(!N)A=5;else for(_=1;;){if(M=Nt(7,0,(15-_|0)*3|0)|0,!((M&A|0)==0&((K()|0)&f|0)==0)){A=2;break e}if(_>>>0>>0)_=_+1|0;else{A=5;break}}else A=2;while(!1);uo(p|0,-1,A<<2|0)|0;e:do if(y)for(T=0;;){if(M=q+(T<<4)|0,m1(M,d[I>>2]|0)|0,M=d[M>>2]|0,N=d[p>>2]|0,(N|0)==-1|(N|0)==(M|0))_=p;else{y=0;do{if(y=y+1|0,y>>>0>=A>>>0){_=1;break e}_=p+(y<<2)|0,N=d[_>>2]|0}while(!((N|0)==-1|(N|0)==(M|0)))}if(d[_>>2]=M,T=T+1|0,T>>>0>=U>>>0){_=0;break}}else for(T=0;;){if(M=q+(T<<4)|0,Ou(M,d[I>>2]|0,0,1)|0,M=d[M>>2]|0,N=d[p>>2]|0,(N|0)==-1|(N|0)==(M|0))_=p;else{y=0;do{if(y=y+1|0,y>>>0>=A>>>0){_=1;break e}_=p+(y<<2)|0,N=d[_>>2]|0}while(!((N|0)==-1|(N|0)==(M|0)))}if(d[_>>2]=M,T=T+1|0,T>>>0>=U>>>0){_=0;break}}while(!1)}return q=_,Q=ie,q|0}function fp(){return 12}function qu(A,f){A=A|0,f=f|0;var p=0,_=0,y=0,T=0,M=0,N=0,U=0;if(A>>>0>15)return N=4,N|0;if(Nt(A|0,0,52)|0,N=K()|0|134225919,!A){p=0,_=0;do Bi(_)|0&&(Nt(_|0,0,45)|0,M=N|(K()|0),A=f+(p<<3)|0,d[A>>2]=-1,d[A+4>>2]=M,p=p+1|0),_=_+1|0;while((_|0)!=122);return p=0,p|0}p=0,M=0;do{if(Bi(M)|0){for(Nt(M|0,0,45)|0,_=1,y=-1,T=N|(K()|0);U=Nt(7,0,(15-_|0)*3|0)|0,y=y&~U,T=T&~(K()|0),(_|0)!=(A|0);)_=_+1|0;U=f+(p<<3)|0,d[U>>2]=y,d[U+4>>2]=T,p=p+1|0}M=M+1|0}while((M|0)!=122);return p=0,p|0}function Ap(A,f,p,_){A=A|0,f=f|0,p=p|0,_=_|0;var y=0,T=0,M=0,N=0,U=0,I=0,q=0,ie=0,de=0,Ae=0,pe=0,Me=0,Le=0,Ye=0,qe=0;if(qe=Q,Q=Q+16|0,Le=qe,Ye=xt(A|0,f|0,52)|0,K()|0,Ye=Ye&15,p>>>0>15)return Ye=4,Q=qe,Ye|0;if((Ye|0)<(p|0))return Ye=12,Q=qe,Ye|0;if((Ye|0)!=(p|0))if(T=Nt(p|0,0,52)|0,T=T|A,N=K()|0|f&-15728641,(Ye|0)>(p|0)){U=p;do Me=Nt(7,0,(14-U|0)*3|0)|0,U=U+1|0,T=Me|T,N=K()|0|N;while((U|0)<(Ye|0));Me=T}else Me=T;else Me=A,N=f;pe=xt(Me|0,N|0,45)|0,K()|0;e:do if(Bi(pe&127)|0){if(U=xt(Me|0,N|0,52)|0,K()|0,U=U&15,U|0)for(T=1;;){if(pe=Nt(7,0,(15-T|0)*3|0)|0,!((pe&Me|0)==0&((K()|0)&N|0)==0)){I=33;break e}if(T>>>0>>0)T=T+1|0;else break}if(pe=_,d[pe>>2]=0,d[pe+4>>2]=0,(Ye|0)>(p|0)){for(pe=f&-15728641,Ae=Ye;;){if(de=Ae,Ae=Ae+-1|0,Ae>>>0>15|(Ye|0)<(Ae|0)){I=19;break}if((Ye|0)!=(Ae|0))if(T=Nt(Ae|0,0,52)|0,T=T|A,U=K()|0|pe,(Ye|0)<(de|0))ie=T;else{I=Ae;do ie=Nt(7,0,(14-I|0)*3|0)|0,I=I+1|0,T=ie|T,U=K()|0|U;while((I|0)<(Ye|0));ie=T}else ie=A,U=f;if(q=xt(ie|0,U|0,45)|0,K()|0,!(Bi(q&127)|0))T=0;else{q=xt(ie|0,U|0,52)|0,K()|0,q=q&15;t:do if(!q)T=0;else for(I=1;;){if(T=xt(ie|0,U|0,(15-I|0)*3|0)|0,K()|0,T=T&7,T|0)break t;if(I>>>0>>0)I=I+1|0;else{T=0;break}}while(!1);T=(T|0)==0&1}if(U=xt(A|0,f|0,(15-de|0)*3|0)|0,K()|0,U=U&7,(U|0)==7){y=5,I=42;break}if(T=(T|0)!=0,(U|0)==1&T){y=5,I=42;break}if(ie=U+(((U|0)!=0&T)<<31>>31)|0,ie|0&&(I=Ye-de|0,I=Bo(7,0,I,((I|0)<0)<<31>>31)|0,q=K()|0,T?(T=fr(I|0,q|0,5,0)|0,T=Xt(T|0,K()|0,-5,-1)|0,T=ko(T|0,K()|0,6,0)|0,T=Xt(T|0,K()|0,1,0)|0,U=K()|0):(T=I,U=q),de=ie+-1|0,de=fr(I|0,q|0,de|0,((de|0)<0)<<31>>31|0)|0,de=Xt(T|0,U|0,de|0,K()|0)|0,ie=K()|0,q=_,q=Xt(de|0,ie|0,d[q>>2]|0,d[q+4>>2]|0)|0,ie=K()|0,de=_,d[de>>2]=q,d[de+4>>2]=ie),(Ae|0)<=(p|0)){I=37;break}}if((I|0)==19)Ut(27795,27122,1367,27158);else if((I|0)==37){M=_,y=d[M+4>>2]|0,M=d[M>>2]|0;break}else if((I|0)==42)return Q=qe,y|0}else y=0,M=0}else I=33;while(!1);e:do if((I|0)==33)if(pe=_,d[pe>>2]=0,d[pe+4>>2]=0,(Ye|0)>(p|0)){for(T=Ye;;){if(y=xt(A|0,f|0,(15-T|0)*3|0)|0,K()|0,y=y&7,(y|0)==7){y=5;break}if(M=Ye-T|0,M=Bo(7,0,M,((M|0)<0)<<31>>31)|0,y=fr(M|0,K()|0,y|0,0)|0,M=K()|0,pe=_,M=Xt(d[pe>>2]|0,d[pe+4>>2]|0,y|0,M|0)|0,y=K()|0,pe=_,d[pe>>2]=M,d[pe+4>>2]=y,T=T+-1|0,(T|0)<=(p|0))break e}return Q=qe,y|0}else y=0,M=0;while(!1);return lf(Me,N,Ye,Le)|0&&Ut(27795,27122,1327,27173),Ye=Le,Le=d[Ye+4>>2]|0,((y|0)>-1|(y|0)==-1&M>>>0>4294967295)&((Le|0)>(y|0)|((Le|0)==(y|0)?(d[Ye>>2]|0)>>>0>M>>>0:0))?(Ye=0,Q=qe,Ye|0):(Ut(27795,27122,1407,27158),0)}function S1(A,f,p,_,y,T){A=A|0,f=f|0,p=p|0,_=_|0,y=y|0,T=T|0;var M=0,N=0,U=0,I=0,q=0,ie=0,de=0,Ae=0,pe=0,Me=0;if(ie=Q,Q=Q+16|0,M=ie,y>>>0>15)return T=4,Q=ie,T|0;if(N=xt(p|0,_|0,52)|0,K()|0,N=N&15,(N|0)>(y|0))return T=12,Q=ie,T|0;if(lf(p,_,y,M)|0&&Ut(27795,27122,1327,27173),q=M,I=d[q+4>>2]|0,!(((f|0)>-1|(f|0)==-1&A>>>0>4294967295)&((I|0)>(f|0)|((I|0)==(f|0)?(d[q>>2]|0)>>>0>A>>>0:0))))return T=2,Q=ie,T|0;q=y-N|0,y=Nt(y|0,0,52)|0,U=K()|0|_&-15728641,I=T,d[I>>2]=y|p,d[I+4>>2]=U,I=xt(p|0,_|0,45)|0,K()|0;e:do if(Bi(I&127)|0){if(N|0)for(M=1;;){if(I=Nt(7,0,(15-M|0)*3|0)|0,!((I&p|0)==0&((K()|0)&_|0)==0))break e;if(M>>>0>>0)M=M+1|0;else break}if((q|0)<1)return T=0,Q=ie,T|0;for(I=N^15,_=-1,U=1,M=1;;){N=q-U|0,N=Bo(7,0,N,((N|0)<0)<<31>>31)|0,p=K()|0;do if(M)if(M=fr(N|0,p|0,5,0)|0,M=Xt(M|0,K()|0,-5,-1)|0,M=ko(M|0,K()|0,6,0)|0,y=K()|0,(f|0)>(y|0)|(f|0)==(y|0)&A>>>0>M>>>0){f=Xt(A|0,f|0,-1,-1)|0,f=Ur(f|0,K()|0,M|0,y|0)|0,M=K()|0,de=T,pe=d[de>>2]|0,de=d[de+4>>2]|0,Me=(I+_|0)*3|0,Ae=Nt(7,0,Me|0)|0,de=de&~(K()|0),_=ko(f|0,M|0,N|0,p|0)|0,A=K()|0,y=Xt(_|0,A|0,2,0)|0,Me=Nt(y|0,K()|0,Me|0)|0,de=K()|0|de,y=T,d[y>>2]=Me|pe&~Ae,d[y+4>>2]=de,A=fr(_|0,A|0,N|0,p|0)|0,A=Ur(f|0,M|0,A|0,K()|0)|0,M=0,f=K()|0;break}else{Me=T,Ae=d[Me>>2]|0,Me=d[Me+4>>2]|0,pe=Nt(7,0,(I+_|0)*3|0)|0,Me=Me&~(K()|0),M=T,d[M>>2]=Ae&~pe,d[M+4>>2]=Me,M=1;break}else Ae=T,y=d[Ae>>2]|0,Ae=d[Ae+4>>2]|0,_=(I+_|0)*3|0,de=Nt(7,0,_|0)|0,Ae=Ae&~(K()|0),Me=ko(A|0,f|0,N|0,p|0)|0,M=K()|0,_=Nt(Me|0,M|0,_|0)|0,Ae=K()|0|Ae,pe=T,d[pe>>2]=_|y&~de,d[pe+4>>2]=Ae,M=fr(Me|0,M|0,N|0,p|0)|0,A=Ur(A|0,f|0,M|0,K()|0)|0,M=0,f=K()|0;while(!1);if((q|0)>(U|0))_=~U,U=U+1|0;else{f=0;break}}return Q=ie,f|0}while(!1);if((q|0)<1)return Me=0,Q=ie,Me|0;for(y=N^15,M=1;;)if(pe=q-M|0,pe=Bo(7,0,pe,((pe|0)<0)<<31>>31)|0,Me=K()|0,U=T,p=d[U>>2]|0,U=d[U+4>>2]|0,N=(y-M|0)*3|0,_=Nt(7,0,N|0)|0,U=U&~(K()|0),de=ko(A|0,f|0,pe|0,Me|0)|0,Ae=K()|0,N=Nt(de|0,Ae|0,N|0)|0,U=K()|0|U,I=T,d[I>>2]=N|p&~_,d[I+4>>2]=U,Me=fr(de|0,Ae|0,pe|0,Me|0)|0,A=Ur(A|0,f|0,Me|0,K()|0)|0,f=K()|0,(q|0)<=(M|0)){f=0;break}else M=M+1|0;return Q=ie,f|0}function sl(A,f,p,_){A=A|0,f=f|0,p=p|0,_=_|0;var y=0,T=0,M=0;y=xt(f|0,p|0,52)|0,K()|0,y=y&15,(f|0)==0&(p|0)==0|((_|0)>15|(y|0)>(_|0))?(T=-1,f=-1,p=0,y=0):(f=lp(f,p,y+1|0,_)|0,M=(K()|0)&-15728641,p=Nt(_|0,0,52)|0,p=f|p,M=M|(K()|0),f=(Ci(p,M)|0)==0,T=y,f=f?-1:_,y=M),M=A,d[M>>2]=p,d[M+4>>2]=y,d[A+8>>2]=T,d[A+12>>2]=f}function Vu(A,f,p,_){A=A|0,f=f|0,p=p|0,_=_|0;var y=0,T=0;if(y=xt(A|0,f|0,52)|0,K()|0,y=y&15,T=_+8|0,d[T>>2]=y,(A|0)==0&(f|0)==0|((p|0)>15|(y|0)>(p|0))){p=_,d[p>>2]=0,d[p+4>>2]=0,d[T>>2]=-1,d[_+12>>2]=-1;return}if(A=lp(A,f,y+1|0,p)|0,T=(K()|0)&-15728641,y=Nt(p|0,0,52)|0,y=A|y,T=T|(K()|0),A=_,d[A>>2]=y,d[A+4>>2]=T,A=_+12|0,Ci(y,T)|0){d[A>>2]=p;return}else{d[A>>2]=-1;return}}function uf(A){A=A|0;var f=0,p=0,_=0,y=0,T=0,M=0,N=0,U=0,I=0;if(p=A,f=d[p>>2]|0,p=d[p+4>>2]|0,!((f|0)==0&(p|0)==0)&&(_=xt(f|0,p|0,52)|0,K()|0,_=_&15,N=Nt(1,0,(_^15)*3|0)|0,f=Xt(N|0,K()|0,f|0,p|0)|0,p=K()|0,N=A,d[N>>2]=f,d[N+4>>2]=p,N=A+8|0,M=d[N>>2]|0,!((_|0)<(M|0)))){for(U=A+12|0,T=_;;){if((T|0)==(M|0)){_=5;break}if(I=(T|0)==(d[U>>2]|0),y=(15-T|0)*3|0,_=xt(f|0,p|0,y|0)|0,K()|0,_=_&7,I&((_|0)==1&!0)){_=7;break}if(!((_|0)==7&!0)){_=10;break}if(I=Nt(1,0,y|0)|0,f=Xt(f|0,p|0,I|0,K()|0)|0,p=K()|0,I=A,d[I>>2]=f,d[I+4>>2]=p,(T|0)>(M|0))T=T+-1|0;else{_=10;break}}if((_|0)==5){I=A,d[I>>2]=0,d[I+4>>2]=0,d[N>>2]=-1,d[U>>2]=-1;return}else if((_|0)==7){M=Nt(1,0,y|0)|0,M=Xt(f|0,p|0,M|0,K()|0)|0,N=K()|0,I=A,d[I>>2]=M,d[I+4>>2]=N,d[U>>2]=T+-1;return}else if((_|0)==10)return}}function Kc(A){A=+A;var f=0;return f=A<0?A+6.283185307179586:A,+(A>=6.283185307179586?f+-6.283185307179586:f)}function Ea(A,f){return A=A|0,f=f|0,+un(+(+ee[A>>3]-+ee[f>>3]))<17453292519943298e-27?(f=+un(+(+ee[A+8>>3]-+ee[f+8>>3]))<17453292519943298e-27,f|0):(f=0,f|0)}function Xs(A,f){switch(A=+A,f=f|0,f|0){case 1:{A=A<0?A+6.283185307179586:A;break}case 2:{A=A>0?A+-6.283185307179586:A;break}}return+A}function T1(A,f){A=A|0,f=f|0;var p=0,_=0,y=0,T=0;return y=+ee[f>>3],_=+ee[A>>3],T=+Fn(+((y-_)*.5)),p=+Fn(+((+ee[f+8>>3]-+ee[A+8>>3])*.5)),p=T*T+p*(+li(+y)*+li(+_)*p),+(+Ue(+ +qn(+p),+ +qn(+(1-p)))*2)}function Zc(A,f){A=A|0,f=f|0;var p=0,_=0,y=0,T=0;return y=+ee[f>>3],_=+ee[A>>3],T=+Fn(+((y-_)*.5)),p=+Fn(+((+ee[f+8>>3]-+ee[A+8>>3])*.5)),p=T*T+p*(+li(+y)*+li(+_)*p),+(+Ue(+ +qn(+p),+ +qn(+(1-p)))*2*6371.007180918475)}function Mx(A,f){A=A|0,f=f|0;var p=0,_=0,y=0,T=0;return y=+ee[f>>3],_=+ee[A>>3],T=+Fn(+((y-_)*.5)),p=+Fn(+((+ee[f+8>>3]-+ee[A+8>>3])*.5)),p=T*T+p*(+li(+y)*+li(+_)*p),+(+Ue(+ +qn(+p),+ +qn(+(1-p)))*2*6371.007180918475*1e3)}function Ex(A,f){A=A|0,f=f|0;var p=0,_=0,y=0,T=0,M=0;return T=+ee[f>>3],_=+li(+T),y=+ee[f+8>>3]-+ee[A+8>>3],M=_*+Fn(+y),p=+ee[A>>3],+ +Ue(+M,+(+Fn(+T)*+li(+p)-+li(+y)*(_*+Fn(+p))))}function Cx(A,f,p,_){A=A|0,f=+f,p=+p,_=_|0;var y=0,T=0,M=0,N=0;if(p<1e-16){d[_>>2]=d[A>>2],d[_+4>>2]=d[A+4>>2],d[_+8>>2]=d[A+8>>2],d[_+12>>2]=d[A+12>>2];return}T=f<0?f+6.283185307179586:f,T=f>=6.283185307179586?T+-6.283185307179586:T;do if(T<1e-16)f=+ee[A>>3]+p,ee[_>>3]=f,y=_;else{if(y=+un(+(T+-3.141592653589793))<1e-16,f=+ee[A>>3],y){f=f-p,ee[_>>3]=f,y=_;break}if(M=+li(+p),p=+Fn(+p),f=M*+Fn(+f)+ +li(+T)*(p*+li(+f)),f=f>1?1:f,f=+Ul(+(f<-1?-1:f)),ee[_>>3]=f,+un(+(f+-1.5707963267948966))<1e-16){ee[_>>3]=1.5707963267948966,ee[_+8>>3]=0;return}if(+un(+(f+1.5707963267948966))<1e-16){ee[_>>3]=-1.5707963267948966,ee[_+8>>3]=0;return}if(N=1/+li(+f),T=p*+Fn(+T)*N,p=+ee[A>>3],f=N*((M-+Fn(+f)*+Fn(+p))/+li(+p)),M=T>1?1:T,f=f>1?1:f,f=+ee[A+8>>3]+ +Ue(+(M<-1?-1:M),+(f<-1?-1:f)),f>3.141592653589793)do f=f+-6.283185307179586;while(f>3.141592653589793);if(f<-3.141592653589793)do f=f+6.283185307179586;while(f<-3.141592653589793);ee[_+8>>3]=f;return}while(!1);if(+un(+(f+-1.5707963267948966))<1e-16){ee[y>>3]=1.5707963267948966,ee[_+8>>3]=0;return}if(+un(+(f+1.5707963267948966))<1e-16){ee[y>>3]=-1.5707963267948966,ee[_+8>>3]=0;return}if(f=+ee[A+8>>3],f>3.141592653589793)do f=f+-6.283185307179586;while(f>3.141592653589793);if(f<-3.141592653589793)do f=f+6.283185307179586;while(f<-3.141592653589793);ee[_+8>>3]=f}function dp(A,f){return A=A|0,f=f|0,A>>>0>15?(f=4,f|0):(ee[f>>3]=+ee[20656+(A<<3)>>3],f=0,f|0)}function w1(A,f){return A=A|0,f=f|0,A>>>0>15?(f=4,f|0):(ee[f>>3]=+ee[20784+(A<<3)>>3],f=0,f|0)}function pp(A,f){return A=A|0,f=f|0,A>>>0>15?(f=4,f|0):(ee[f>>3]=+ee[20912+(A<<3)>>3],f=0,f|0)}function oo(A,f){return A=A|0,f=f|0,A>>>0>15?(f=4,f|0):(ee[f>>3]=+ee[21040+(A<<3)>>3],f=0,f|0)}function Hu(A,f){A=A|0,f=f|0;var p=0;return A>>>0>15?(f=4,f|0):(p=Bo(7,0,A,((A|0)<0)<<31>>31)|0,p=fr(p|0,K()|0,120,0)|0,A=K()|0,d[f>>2]=p|2,d[f+4>>2]=A,f=0,f|0)}function da(A,f,p){A=A|0,f=f|0,p=p|0;var _=0,y=0,T=0,M=0,N=0,U=0,I=0,q=0,ie=0,de=0;return de=+ee[f>>3],q=+ee[A>>3],U=+Fn(+((de-q)*.5)),T=+ee[f+8>>3],I=+ee[A+8>>3],M=+Fn(+((T-I)*.5)),N=+li(+q),ie=+li(+de),M=U*U+M*(ie*N*M),M=+Ue(+ +qn(+M),+ +qn(+(1-M)))*2,U=+ee[p>>3],de=+Fn(+((U-de)*.5)),_=+ee[p+8>>3],T=+Fn(+((_-T)*.5)),y=+li(+U),T=de*de+T*(ie*y*T),T=+Ue(+ +qn(+T),+ +qn(+(1-T)))*2,U=+Fn(+((q-U)*.5)),_=+Fn(+((I-_)*.5)),_=U*U+_*(N*y*_),_=+Ue(+ +qn(+_),+ +qn(+(1-_)))*2,y=(M+T+_)*.5,+(+ae(+ +qn(+(+cs(+(y*.5))*+cs(+((y-M)*.5))*+cs(+((y-T)*.5))*+cs(+((y-_)*.5)))))*4)}function Fl(A,f,p){A=A|0,f=f|0,p=p|0;var _=0,y=0,T=0,M=0,N=0;if(N=Q,Q=Q+192|0,T=N+168|0,M=N,y=Ol(A,f,T)|0,y|0)return p=y,Q=N,p|0;if(Il(A,f,M)|0&&Ut(27795,27190,415,27199),f=d[M>>2]|0,(f|0)>0){if(_=+da(M+8|0,M+8+(((f|0)!=1&1)<<4)|0,T)+0,(f|0)!=1){A=1;do y=A,A=A+1|0,_=_+ +da(M+8+(y<<4)|0,M+8+(((A|0)%(f|0)|0)<<4)|0,T);while((A|0)<(f|0))}}else _=0;return ee[p>>3]=_,p=0,Q=N,p|0}function mp(A,f,p){return A=A|0,f=f|0,p=p|0,A=Fl(A,f,p)|0,A|0||(ee[p>>3]=+ee[p>>3]*6371.007180918475*6371.007180918475),A|0}function UA(A,f,p){return A=A|0,f=f|0,p=p|0,A=Fl(A,f,p)|0,A|0||(ee[p>>3]=+ee[p>>3]*6371.007180918475*6371.007180918475*1e3*1e3),A|0}function BA(A,f,p){A=A|0,f=f|0,p=p|0;var _=0,y=0,T=0,M=0,N=0,U=0,I=0,q=0;if(N=Q,Q=Q+176|0,M=N,A=CA(A,f,M)|0,A|0)return M=A,Q=N,M|0;if(ee[p>>3]=0,A=d[M>>2]|0,(A|0)<=1)return M=0,Q=N,M|0;f=A+-1|0,A=0,_=+ee[M+8>>3],y=+ee[M+16>>3],T=0;do A=A+1|0,I=_,_=+ee[M+8+(A<<4)>>3],q=+Fn(+((_-I)*.5)),U=y,y=+ee[M+8+(A<<4)+8>>3],U=+Fn(+((y-U)*.5)),U=q*q+U*(+li(+_)*+li(+I)*U),T=T+ +Ue(+ +qn(+U),+ +qn(+(1-U)))*2;while((A|0)<(f|0));return ee[p>>3]=T,M=0,Q=N,M|0}function gp(A,f,p){A=A|0,f=f|0,p=p|0;var _=0,y=0,T=0,M=0,N=0,U=0,I=0,q=0;if(N=Q,Q=Q+176|0,M=N,A=CA(A,f,M)|0,A|0)return M=A,T=+ee[p>>3],T=T*6371.007180918475,ee[p>>3]=T,Q=N,M|0;if(ee[p>>3]=0,A=d[M>>2]|0,(A|0)<=1)return M=0,T=0,T=T*6371.007180918475,ee[p>>3]=T,Q=N,M|0;f=A+-1|0,A=0,_=+ee[M+8>>3],y=+ee[M+16>>3],T=0;do A=A+1|0,I=_,_=+ee[M+8+(A<<4)>>3],q=+Fn(+((_-I)*.5)),U=y,y=+ee[M+8+(A<<4)+8>>3],U=+Fn(+((y-U)*.5)),U=q*q+U*(+li(+I)*+li(+_)*U),T=T+ +Ue(+ +qn(+U),+ +qn(+(1-U)))*2;while((A|0)!=(f|0));return ee[p>>3]=T,M=0,q=T,q=q*6371.007180918475,ee[p>>3]=q,Q=N,M|0}function ju(A,f,p){A=A|0,f=f|0,p=p|0;var _=0,y=0,T=0,M=0,N=0,U=0,I=0,q=0;if(N=Q,Q=Q+176|0,M=N,A=CA(A,f,M)|0,A|0)return M=A,T=+ee[p>>3],T=T*6371.007180918475,T=T*1e3,ee[p>>3]=T,Q=N,M|0;if(ee[p>>3]=0,A=d[M>>2]|0,(A|0)<=1)return M=0,T=0,T=T*6371.007180918475,T=T*1e3,ee[p>>3]=T,Q=N,M|0;f=A+-1|0,A=0,_=+ee[M+8>>3],y=+ee[M+16>>3],T=0;do A=A+1|0,I=_,_=+ee[M+8+(A<<4)>>3],q=+Fn(+((_-I)*.5)),U=y,y=+ee[M+8+(A<<4)+8>>3],U=+Fn(+((y-U)*.5)),U=q*q+U*(+li(+I)*+li(+_)*U),T=T+ +Ue(+ +qn(+U),+ +qn(+(1-U)))*2;while((A|0)!=(f|0));return ee[p>>3]=T,M=0,q=T,q=q*6371.007180918475,q=q*1e3,ee[p>>3]=q,Q=N,M|0}function M1(A){A=A|0;var f=0,p=0,_=0;return f=Ks(1,12)|0,f||Ut(27280,27235,49,27293),p=A+4|0,_=d[p>>2]|0,_|0?(_=_+8|0,d[_>>2]=f,d[p>>2]=f,f|0):(d[A>>2]|0&&Ut(27310,27235,61,27333),_=A,d[_>>2]=f,d[p>>2]=f,f|0)}function OA(A,f){A=A|0,f=f|0;var p=0,_=0;return _=Fo(24)|0,_||Ut(27347,27235,78,27361),d[_>>2]=d[f>>2],d[_+4>>2]=d[f+4>>2],d[_+8>>2]=d[f+8>>2],d[_+12>>2]=d[f+12>>2],d[_+16>>2]=0,f=A+4|0,p=d[f>>2]|0,p|0?(d[p+16>>2]=_,d[f>>2]=_,_|0):(d[A>>2]|0&&Ut(27376,27235,82,27361),d[A>>2]=_,d[f>>2]=_,_|0)}function Wu(A){A=A|0;var f=0,p=0,_=0,y=0;if(A)for(_=1;;){if(f=d[A>>2]|0,f|0)do{if(p=d[f>>2]|0,p|0)do y=p,p=d[p+16>>2]|0,An(y);while((p|0)!=0);y=f,f=d[f+8>>2]|0,An(y)}while((f|0)!=0);if(f=A,A=d[A+8>>2]|0,_||An(f),A)_=0;else break}}function Rx(A){A=A|0;var f=0,p=0,_=0,y=0,T=0,M=0,N=0,U=0,I=0,q=0,ie=0,de=0,Ae=0,pe=0,Me=0,Le=0,Ye=0,qe=0,Fe=0,Ee=0,Pt=0,nn=0,Jt=0,Un=0,En=0,Qn=0,Tn=0,an=0,Lt=0,vn=0,ii=0,wn=0;if(y=A+8|0,d[y>>2]|0)return wn=1,wn|0;if(_=d[A>>2]|0,!_)return wn=0,wn|0;f=_,p=0;do p=p+1|0,f=d[f+8>>2]|0;while((f|0)!=0);if(p>>>0<2)return wn=0,wn|0;vn=Fo(p<<2)|0,vn||Ut(27396,27235,317,27415),Lt=Fo(p<<5)|0,Lt||Ut(27437,27235,321,27415),d[A>>2]=0,nn=A+4|0,d[nn>>2]=0,d[y>>2]=0,p=0,an=0,Pt=0,ie=0;e:for(;;){if(q=d[_>>2]|0,q){T=0,M=q;do{if(U=+ee[M+8>>3],f=M,M=d[M+16>>2]|0,I=(M|0)==0,y=I?q:M,N=+ee[y+8>>3],+un(+(U-N))>3.141592653589793){wn=14;break}T=T+(N-U)*(+ee[f>>3]+ +ee[y>>3])}while(!I);if((wn|0)==14){wn=0,T=0,f=q;do Ee=+ee[f+8>>3],Tn=f+16|0,Qn=d[Tn>>2]|0,Qn=(Qn|0)==0?q:Qn,Fe=+ee[Qn+8>>3],T=T+(+ee[f>>3]+ +ee[Qn>>3])*((Fe<0?Fe+6.283185307179586:Fe)-(Ee<0?Ee+6.283185307179586:Ee)),f=d[((f|0)==0?_:Tn)>>2]|0;while((f|0)!=0)}T>0?(d[vn+(an<<2)>>2]=_,an=an+1|0,y=Pt,f=ie):wn=19}else wn=19;if((wn|0)==19){wn=0;do if(p){if(f=p+8|0,d[f>>2]|0){wn=21;break e}if(p=Ks(1,12)|0,!p){wn=23;break e}d[f>>2]=p,y=p+4|0,M=p,f=ie}else if(ie){y=nn,M=ie+8|0,f=_,p=A;break}else if(d[A>>2]|0){wn=27;break e}else{y=nn,M=A,f=_,p=A;break}while(!1);if(d[M>>2]=_,d[y>>2]=_,M=Lt+(Pt<<5)|0,I=d[_>>2]|0,I){for(q=Lt+(Pt<<5)+8|0,ee[q>>3]=17976931348623157e292,ie=Lt+(Pt<<5)+24|0,ee[ie>>3]=17976931348623157e292,ee[M>>3]=-17976931348623157e292,de=Lt+(Pt<<5)+16|0,ee[de>>3]=-17976931348623157e292,Ye=17976931348623157e292,qe=-17976931348623157e292,y=0,Ae=I,U=17976931348623157e292,Me=17976931348623157e292,Le=-17976931348623157e292,N=-17976931348623157e292;T=+ee[Ae>>3],Ee=+ee[Ae+8>>3],Ae=d[Ae+16>>2]|0,pe=(Ae|0)==0,Fe=+ee[(pe?I:Ae)+8>>3],T>3]=T,U=T),Ee>3]=Ee,Me=Ee),T>Le?ee[M>>3]=T:T=Le,Ee>N&&(ee[de>>3]=Ee,N=Ee),Ye=Ee>0&Eeqe?Ee:qe,y=y|+un(+(Ee-Fe))>3.141592653589793,!pe;)Le=T;y&&(ee[de>>3]=qe,ee[ie>>3]=Ye)}else d[M>>2]=0,d[M+4>>2]=0,d[M+8>>2]=0,d[M+12>>2]=0,d[M+16>>2]=0,d[M+20>>2]=0,d[M+24>>2]=0,d[M+28>>2]=0;y=Pt+1|0}if(Tn=_+8|0,_=d[Tn>>2]|0,d[Tn>>2]=0,_)Pt=y,ie=f;else{wn=45;break}}if((wn|0)==21)Ut(27213,27235,35,27247);else if((wn|0)==23)Ut(27267,27235,37,27247);else if((wn|0)==27)Ut(27310,27235,61,27333);else if((wn|0)==45){e:do if((an|0)>0){for(Tn=(y|0)==0,En=y<<2,Qn=(A|0)==0,Un=0,f=0;;){if(Jt=d[vn+(Un<<2)>>2]|0,Tn)wn=73;else{if(Pt=Fo(En)|0,!Pt){wn=50;break}if(nn=Fo(En)|0,!nn){wn=52;break}t:do if(Qn)p=0;else{for(y=0,p=0,M=A;_=Lt+(y<<5)|0,Ys(d[M>>2]|0,_,d[Jt>>2]|0)|0?(d[Pt+(p<<2)>>2]=M,d[nn+(p<<2)>>2]=_,pe=p+1|0):pe=p,M=d[M+8>>2]|0,M;)y=y+1|0,p=pe;if((pe|0)>0)if(_=d[Pt>>2]|0,(pe|0)==1)p=_;else for(de=0,Ae=-1,p=_,ie=_;;){for(I=d[ie>>2]|0,_=0,M=0;y=d[d[Pt+(M<<2)>>2]>>2]|0,(y|0)==(I|0)?q=_:q=_+((Ys(y,d[nn+(M<<2)>>2]|0,d[I>>2]|0)|0)&1)|0,M=M+1|0,(M|0)!=(pe|0);)_=q;if(y=(q|0)>(Ae|0),p=y?ie:p,_=de+1|0,(_|0)==(pe|0))break t;de=_,Ae=y?q:Ae,ie=d[Pt+(_<<2)>>2]|0}else p=0}while(!1);if(An(Pt),An(nn),p){if(y=p+4|0,_=d[y>>2]|0,_)p=_+8|0;else if(d[p>>2]|0){wn=70;break}d[p>>2]=Jt,d[y>>2]=Jt}else wn=73}if((wn|0)==73){if(wn=0,f=d[Jt>>2]|0,f|0)do nn=f,f=d[f+16>>2]|0,An(nn);while((f|0)!=0);An(Jt),f=1}if(Un=Un+1|0,(Un|0)>=(an|0)){ii=f;break e}}(wn|0)==50?Ut(27452,27235,249,27471):(wn|0)==52?Ut(27490,27235,252,27471):(wn|0)==70&&Ut(27310,27235,61,27333)}else ii=0;while(!1);return An(vn),An(Lt),wn=ii,wn|0}return 0}function Ys(A,f,p){A=A|0,f=f|0,p=p|0;var _=0,y=0,T=0,M=0,N=0,U=0,I=0,q=0;if(!(Lo(f,p)|0)||(f=TA(f)|0,_=+ee[p>>3],y=+ee[p+8>>3],y=f&y<0?y+6.283185307179586:y,A=d[A>>2]|0,!A))return A=0,A|0;if(f){f=0,I=y,p=A;e:for(;;){for(;M=+ee[p>>3],y=+ee[p+8>>3],p=p+16|0,q=d[p>>2]|0,q=(q|0)==0?A:q,T=+ee[q>>3],N=+ee[q+8>>3],M>T?(U=M,M=N):(U=T,T=M,M=y,y=N),_=_==T|_==U?_+2220446049250313e-31:_,!!(_U);)if(p=d[p>>2]|0,!p){p=22;break e}if(N=M<0?M+6.283185307179586:M,M=y<0?y+6.283185307179586:y,I=N==I|M==I?I+-2220446049250313e-31:I,U=N+(M-N)*((_-T)/(U-T)),(U<0?U+6.283185307179586:U)>I&&(f=f^1),p=d[p>>2]|0,!p){p=22;break}}if((p|0)==22)return f|0}else{f=0,I=y,p=A;e:for(;;){for(;M=+ee[p>>3],y=+ee[p+8>>3],p=p+16|0,q=d[p>>2]|0,q=(q|0)==0?A:q,T=+ee[q>>3],N=+ee[q+8>>3],M>T?(U=M,M=N):(U=T,T=M,M=y,y=N),_=_==T|_==U?_+2220446049250313e-31:_,!!(_U);)if(p=d[p>>2]|0,!p){p=22;break e}if(I=M==I|y==I?I+-2220446049250313e-31:I,M+(y-M)*((_-T)/(U-T))>I&&(f=f^1),p=d[p>>2]|0,!p){p=22;break}}if((p|0)==22)return f|0}return 0}function lo(A,f,p,_,y){A=A|0,f=f|0,p=p|0,_=_|0,y=y|0;var T=0,M=0,N=0,U=0,I=0,q=0,ie=0,de=0,Ae=0,pe=0,Me=0,Le=0,Ye=0,qe=0;if(qe=Q,Q=Q+32|0,Ye=qe+16|0,Le=qe,T=xt(A|0,f|0,52)|0,K()|0,T=T&15,Ae=xt(p|0,_|0,52)|0,K()|0,(T|0)!=(Ae&15|0))return Ye=12,Q=qe,Ye|0;if(I=xt(A|0,f|0,45)|0,K()|0,I=I&127,q=xt(p|0,_|0,45)|0,K()|0,q=q&127,I>>>0>121|q>>>0>121)return Ye=5,Q=qe,Ye|0;if(Ae=(I|0)!=(q|0),Ae){if(N=Jh(I,q)|0,(N|0)==7)return Ye=1,Q=qe,Ye|0;U=Jh(q,I)|0,(U|0)==7?Ut(27514,27538,161,27548):(pe=N,M=U)}else pe=0,M=0;ie=Bi(I)|0,de=Bi(q)|0,d[Ye>>2]=0,d[Ye+4>>2]=0,d[Ye+8>>2]=0,d[Ye+12>>2]=0;do if(pe){if(q=d[4272+(I*28|0)+(pe<<2)>>2]|0,N=(q|0)>0,de)if(N){I=0,U=p,N=_;do U=Tx(U,N)|0,N=K()|0,M=rl(M)|0,(M|0)==1&&(M=rl(1)|0),I=I+1|0;while((I|0)!=(q|0));q=M,I=U,U=N}else q=M,I=p,U=_;else if(N){I=0,U=p,N=_;do U=hp(U,N)|0,N=K()|0,M=rl(M)|0,I=I+1|0;while((I|0)!=(q|0));q=M,I=U,U=N}else q=M,I=p,U=_;if(LA(I,U,Ye)|0,Ae||Ut(27563,27538,191,27548),N=(ie|0)!=0,M=(de|0)!=0,N&M&&Ut(27590,27538,192,27548),N){if(M=$s(A,f)|0,(M|0)==7){T=5;break}if(at[22e3+(M*7|0)+pe>>0]|0){T=1;break}U=d[21168+(M*28|0)+(pe<<2)>>2]|0,I=U}else if(M){if(M=$s(I,U)|0,(M|0)==7){T=5;break}if(at[22e3+(M*7|0)+q>>0]|0){T=1;break}I=0,U=d[21168+(q*28|0)+(M<<2)>>2]|0}else I=0,U=0;if((I|U|0)<0)T=5;else{if((U|0)>0){N=Ye+4|0,M=0;do EA(N),M=M+1|0;while((M|0)!=(U|0))}if(d[Le>>2]=0,d[Le+4>>2]=0,d[Le+8>>2]=0,u1(Le,pe),T|0)for(;Ss(T)|0?Yc(Le):Lu(Le),(T|0)>1;)T=T+-1|0;if((I|0)>0){T=0;do EA(Le),T=T+1|0;while((T|0)!=(I|0))}Me=Ye+4|0,hs(Me,Le,Me),Lr(Me),Me=51}}else if(LA(p,_,Ye)|0,(ie|0)!=0&(de|0)!=0)if((q|0)!=(I|0)&&Ut(27621,27538,261,27548),M=$s(A,f)|0,T=$s(p,_)|0,(M|0)==7|(T|0)==7)T=5;else if(at[22e3+(M*7|0)+T>>0]|0)T=1;else if(M=d[21168+(M*28|0)+(T<<2)>>2]|0,(M|0)>0){N=Ye+4|0,T=0;do EA(N),T=T+1|0;while((T|0)!=(M|0));Me=51}else Me=51;else Me=51;while(!1);return(Me|0)==51&&(T=Ye+4|0,d[y>>2]=d[T>>2],d[y+4>>2]=d[T+4>>2],d[y+8>>2]=d[T+8>>2],T=0),Ye=T,Q=qe,Ye|0}function Uo(A,f,p,_){A=A|0,f=f|0,p=p|0,_=_|0;var y=0,T=0,M=0,N=0,U=0,I=0,q=0,ie=0,de=0,Ae=0,pe=0,Me=0,Le=0,Ye=0,qe=0,Fe=0;if(Me=Q,Q=Q+48|0,I=Me+36|0,M=Me+24|0,N=Me+12|0,U=Me,y=xt(A|0,f|0,52)|0,K()|0,y=y&15,de=xt(A|0,f|0,45)|0,K()|0,de=de&127,de>>>0>121)return _=5,Q=Me,_|0;if(q=Bi(de)|0,Nt(y|0,0,52)|0,Le=K()|0|134225919,T=_,d[T>>2]=-1,d[T+4>>2]=Le,!y)return y=Pu(p)|0,(y|0)==7||(y=SA(de,y)|0,(y|0)==127)?(Le=1,Q=Me,Le|0):(Ae=Nt(y|0,0,45)|0,pe=K()|0,de=_,pe=d[de+4>>2]&-1040385|pe,Le=_,d[Le>>2]=d[de>>2]|Ae,d[Le+4>>2]=pe,Le=0,Q=Me,Le|0);for(d[I>>2]=d[p>>2],d[I+4>>2]=d[p+4>>2],d[I+8>>2]=d[p+8>>2],p=y;;){if(T=p,p=p+-1|0,d[M>>2]=d[I>>2],d[M+4>>2]=d[I+4>>2],d[M+8>>2]=d[I+8>>2],Ss(T)|0){if(y=o1(I)|0,y|0){p=13;break}d[N>>2]=d[I>>2],d[N+4>>2]=d[I+4>>2],d[N+8>>2]=d[I+8>>2],Yc(N)}else{if(y=cx(I)|0,y|0){p=13;break}d[N>>2]=d[I>>2],d[N+4>>2]=d[I+4>>2],d[N+8>>2]=d[I+8>>2],Lu(N)}if(af(M,N,U),Lr(U),y=_,qe=d[y>>2]|0,y=d[y+4>>2]|0,Fe=(15-T|0)*3|0,Ye=Nt(7,0,Fe|0)|0,y=y&~(K()|0),Fe=Nt(Pu(U)|0,0,Fe|0)|0,y=K()|0|y,Le=_,d[Le>>2]=Fe|qe&~Ye,d[Le+4>>2]=y,(T|0)<=1){p=14;break}}e:do if((p|0)!=13&&(p|0)==14)if((d[I>>2]|0)<=1&&(d[I+4>>2]|0)<=1&&(d[I+8>>2]|0)<=1){p=Pu(I)|0,y=SA(de,p)|0,(y|0)==127?U=0:U=Bi(y)|0;t:do if(p){if(q){if(y=$s(A,f)|0,(y|0)==7){y=5;break e}if(T=d[21376+(y*28|0)+(p<<2)>>2]|0,(T|0)>0){y=p,p=0;do y=Uu(y)|0,p=p+1|0;while((p|0)!=(T|0))}else y=p;if((y|0)==1){y=9;break e}p=SA(de,y)|0,(p|0)==127&&Ut(27648,27538,411,27678),Bi(p)|0?Ut(27693,27538,412,27678):(pe=p,Ae=T,ie=y)}else pe=y,Ae=0,ie=p;if(N=d[4272+(de*28|0)+(ie<<2)>>2]|0,(N|0)<=-1&&Ut(27724,27538,419,27678),!U){if((Ae|0)<0){y=5;break e}if(Ae|0){T=_,y=0,p=d[T>>2]|0,T=d[T+4>>2]|0;do p=ku(p,T)|0,T=K()|0,Fe=_,d[Fe>>2]=p,d[Fe+4>>2]=T,y=y+1|0;while((y|0)<(Ae|0))}if((N|0)<=0){y=pe,p=58;break}for(T=_,y=0,p=d[T>>2]|0,T=d[T+4>>2]|0;;)if(p=ku(p,T)|0,T=K()|0,Fe=_,d[Fe>>2]=p,d[Fe+4>>2]=T,y=y+1|0,(y|0)==(N|0)){y=pe,p=58;break t}}if(M=Jh(pe,de)|0,(M|0)==7&&Ut(27514,27538,428,27678),y=_,p=d[y>>2]|0,y=d[y+4>>2]|0,(N|0)>0){T=0;do p=ku(p,y)|0,y=K()|0,Fe=_,d[Fe>>2]=p,d[Fe+4>>2]=y,T=T+1|0;while((T|0)!=(N|0))}if(y=$s(p,y)|0,(y|0)==7&&Ut(27795,27538,440,27678),p=Wc(pe)|0,p=d[(p?21792:21584)+(M*28|0)+(y<<2)>>2]|0,(p|0)<0&&Ut(27795,27538,454,27678),!p)y=pe,p=58;else{M=_,y=0,T=d[M>>2]|0,M=d[M+4>>2]|0;do T=cp(T,M)|0,M=K()|0,Fe=_,d[Fe>>2]=T,d[Fe+4>>2]=M,y=y+1|0;while((y|0)<(p|0));y=pe,p=58}}else if((q|0)!=0&(U|0)!=0){if(p=$s(A,f)|0,T=_,T=$s(d[T>>2]|0,d[T+4>>2]|0)|0,(p|0)==7|(T|0)==7){y=5;break e}if(T=d[21376+(p*28|0)+(T<<2)>>2]|0,(T|0)<0){y=5;break e}if(!T)p=59;else{N=_,p=0,M=d[N>>2]|0,N=d[N+4>>2]|0;do M=ku(M,N)|0,N=K()|0,Fe=_,d[Fe>>2]=M,d[Fe+4>>2]=N,p=p+1|0;while((p|0)<(T|0));p=58}}else p=58;while(!1);if((p|0)==58&&U&&(p=59),(p|0)==59&&(Fe=_,($s(d[Fe>>2]|0,d[Fe+4>>2]|0)|0)==1)){y=9;break}Fe=_,Ye=d[Fe>>2]|0,Fe=d[Fe+4>>2]&-1040385,qe=Nt(y|0,0,45)|0,Fe=Fe|(K()|0),y=_,d[y>>2]=Ye|qe,d[y+4>>2]=Fe,y=0}else y=1;while(!1);return Fe=y,Q=Me,Fe|0}function E1(A,f,p,_,y,T){A=A|0,f=f|0,p=p|0,_=_|0,y=y|0,T=T|0;var M=0,N=0;return N=Q,Q=Q+16|0,M=N,y?A=15:(A=lo(A,f,p,_,M)|0,A||(fx(M,T),A=0)),Q=N,A|0}function IA(A,f,p,_,y){A=A|0,f=f|0,p=p|0,_=_|0,y=y|0;var T=0,M=0;return M=Q,Q=Q+16|0,T=M,_?p=15:(p=rp(p,T)|0,p||(p=Uo(A,f,T,y)|0)),Q=M,p|0}function $u(A,f,p,_,y){A=A|0,f=f|0,p=p|0,_=_|0,y=y|0;var T=0,M=0,N=0,U=0;return U=Q,Q=Q+32|0,M=U+12|0,N=U,T=lo(A,f,A,f,M)|0,T|0?(N=T,Q=U,N|0):(A=lo(A,f,p,_,N)|0,A|0?(N=A,Q=U,N|0):(M=ip(M,N)|0,N=y,d[N>>2]=M,d[N+4>>2]=((M|0)<0)<<31>>31,N=0,Q=U,N|0))}function vp(A,f,p,_,y){A=A|0,f=f|0,p=p|0,_=_|0,y=y|0;var T=0,M=0,N=0,U=0;return U=Q,Q=Q+32|0,M=U+12|0,N=U,T=lo(A,f,A,f,M)|0,!T&&(T=lo(A,f,p,_,N)|0,!T)?(_=ip(M,N)|0,_=Xt(_|0,((_|0)<0)<<31>>31|0,1,0)|0,M=K()|0,N=y,d[N>>2]=_,d[N+4>>2]=M,N=0,Q=U,N|0):(N=T,Q=U,N|0)}function C1(A,f,p,_,y){A=A|0,f=f|0,p=p|0,_=_|0,y=y|0;var T=0,M=0,N=0,U=0,I=0,q=0,ie=0,de=0,Ae=0,pe=0,Me=0,Le=0,Ye=0,qe=0,Fe=0,Ee=0,Pt=0,nn=0,Jt=0,Un=0;if(Jt=Q,Q=Q+48|0,Pt=Jt+24|0,M=Jt+12|0,nn=Jt,T=lo(A,f,A,f,Pt)|0,!T&&(T=lo(A,f,p,_,M)|0,!T)){Fe=ip(Pt,M)|0,Ee=((Fe|0)<0)<<31>>31,d[Pt>>2]=0,d[Pt+4>>2]=0,d[Pt+8>>2]=0,d[M>>2]=0,d[M+4>>2]=0,d[M+8>>2]=0,lo(A,f,A,f,Pt)|0&&Ut(27795,27538,692,27747),lo(A,f,p,_,M)|0&&Ut(27795,27538,697,27747),A1(Pt),A1(M),q=(Fe|0)==0?0:1/+(Fe|0),p=d[Pt>>2]|0,Me=q*+((d[M>>2]|0)-p|0),Le=Pt+4|0,_=d[Le>>2]|0,Ye=q*+((d[M+4>>2]|0)-_|0),qe=Pt+8|0,T=d[qe>>2]|0,q=q*+((d[M+8>>2]|0)-T|0),d[nn>>2]=p,ie=nn+4|0,d[ie>>2]=_,de=nn+8|0,d[de>>2]=T;e:do if((Fe|0)<0)T=0;else for(Ae=0,pe=0;;){U=+(pe>>>0)+4294967296*+(Ae|0),Un=Me*U+ +(p|0),N=Ye*U+ +(_|0),U=q*U+ +(T|0),p=~~+hl(+Un),M=~~+hl(+N),T=~~+hl(+U),Un=+un(+(+(p|0)-Un)),N=+un(+(+(M|0)-N)),U=+un(+(+(T|0)-U));do if(Un>N&Un>U)p=0-(M+T)|0,_=M;else if(I=0-p|0,N>U){_=I-T|0;break}else{_=M,T=I-M|0;break}while(!1);if(d[nn>>2]=p,d[ie>>2]=_,d[de>>2]=T,Ax(nn),T=Uo(A,f,nn,y+(pe<<3)|0)|0,T|0)break e;if(!((Ae|0)<(Ee|0)|(Ae|0)==(Ee|0)&pe>>>0>>0)){T=0;break e}p=Xt(pe|0,Ae|0,1,0)|0,_=K()|0,Ae=_,pe=p,p=d[Pt>>2]|0,_=d[Le>>2]|0,T=d[qe>>2]|0}while(!1);return nn=T,Q=Jt,nn|0}return nn=T,Q=Jt,nn|0}function Bo(A,f,p,_){A=A|0,f=f|0,p=p|0,_=_|0;var y=0,T=0,M=0;if((p|0)==0&(_|0)==0)return y=0,T=1,At(y|0),T|0;T=A,y=f,A=1,f=0;do M=(p&1|0)==0&!0,A=fr((M?1:T)|0,(M?0:y)|0,A|0,f|0)|0,f=K()|0,p=N1(p|0,_|0,1)|0,_=K()|0,T=fr(T|0,y|0,T|0,y|0)|0,y=K()|0;while(!((p|0)==0&(_|0)==0));return At(f|0),A|0}function FA(A,f,p,_){A=A|0,f=f|0,p=p|0,_=_|0;var y=0,T=0,M=0,N=0,U=0,I=0,q=0;N=Q,Q=Q+16|0,T=N,M=xt(A|0,f|0,52)|0,K()|0,M=M&15;do if(M){if(y=Ol(A,f,T)|0,!y){I=+ee[T>>3],U=1/+li(+I),q=+ee[25968+(M<<3)>>3],ee[p>>3]=I+q,ee[p+8>>3]=I-q,I=+ee[T+8>>3],U=q*U,ee[p+16>>3]=U+I,ee[p+24>>3]=I-U;break}return M=y,Q=N,M|0}else{if(y=xt(A|0,f|0,45)|0,K()|0,y=y&127,y>>>0>121)return M=5,Q=N,M|0;T=22064+(y<<5)|0,d[p>>2]=d[T>>2],d[p+4>>2]=d[T+4>>2],d[p+8>>2]=d[T+8>>2],d[p+12>>2]=d[T+12>>2],d[p+16>>2]=d[T+16>>2],d[p+20>>2]=d[T+20>>2],d[p+24>>2]=d[T+24>>2],d[p+28>>2]=d[T+28>>2];break}while(!1);return Ws(p,_?1.4:1.1),_=26096+(M<<3)|0,(d[_>>2]|0)==(A|0)&&(d[_+4>>2]|0)==(f|0)&&(ee[p>>3]=1.5707963267948966),M=26224+(M<<3)|0,(d[M>>2]|0)==(A|0)&&(d[M+4>>2]|0)==(f|0)&&(ee[p+8>>3]=-1.5707963267948966),+ee[p>>3]!=1.5707963267948966&&+ee[p+8>>3]!=-1.5707963267948966?(M=0,Q=N,M|0):(ee[p+16>>3]=3.141592653589793,ee[p+24>>3]=-3.141592653589793,M=0,Q=N,M|0)}function Ca(A,f,p,_){A=A|0,f=f|0,p=p|0,_=_|0;var y=0,T=0,M=0,N=0,U=0,I=0,q=0;I=Q,Q=Q+48|0,M=I+32|0,T=I+40|0,N=I,Iu(M,0,0,0),U=d[M>>2]|0,M=d[M+4>>2]|0;do if(p>>>0<=15){if(y=Ra(_)|0,y|0){_=N,d[_>>2]=0,d[_+4>>2]=0,d[N+8>>2]=y,d[N+12>>2]=-1,_=N+16|0,U=N+29|0,d[_>>2]=0,d[_+4>>2]=0,d[_+8>>2]=0,at[_+12>>0]=0,at[U>>0]=at[T>>0]|0,at[U+1>>0]=at[T+1>>0]|0,at[U+2>>0]=at[T+2>>0]|0;break}if(y=Ks((d[f+8>>2]|0)+1|0,32)|0,y){Na(f,y),q=N,d[q>>2]=U,d[q+4>>2]=M,d[N+8>>2]=0,d[N+12>>2]=p,d[N+16>>2]=_,d[N+20>>2]=f,d[N+24>>2]=y,at[N+28>>0]=0,U=N+29|0,at[U>>0]=at[T>>0]|0,at[U+1>>0]=at[T+1>>0]|0,at[U+2>>0]=at[T+2>>0]|0;break}else{_=N,d[_>>2]=0,d[_+4>>2]=0,d[N+8>>2]=13,d[N+12>>2]=-1,_=N+16|0,U=N+29|0,d[_>>2]=0,d[_+4>>2]=0,d[_+8>>2]=0,at[_+12>>0]=0,at[U>>0]=at[T>>0]|0,at[U+1>>0]=at[T+1>>0]|0,at[U+2>>0]=at[T+2>>0]|0;break}}else U=N,d[U>>2]=0,d[U+4>>2]=0,d[N+8>>2]=4,d[N+12>>2]=-1,U=N+16|0,q=N+29|0,d[U>>2]=0,d[U+4>>2]=0,d[U+8>>2]=0,at[U+12>>0]=0,at[q>>0]=at[T>>0]|0,at[q+1>>0]=at[T+1>>0]|0,at[q+2>>0]=at[T+2>>0]|0;while(!1);al(N),d[A>>2]=d[N>>2],d[A+4>>2]=d[N+4>>2],d[A+8>>2]=d[N+8>>2],d[A+12>>2]=d[N+12>>2],d[A+16>>2]=d[N+16>>2],d[A+20>>2]=d[N+20>>2],d[A+24>>2]=d[N+24>>2],d[A+28>>2]=d[N+28>>2],Q=I}function al(A){A=A|0;var f=0,p=0,_=0,y=0,T=0,M=0,N=0,U=0,I=0,q=0,ie=0,de=0,Ae=0,pe=0,Me=0,Le=0,Ye=0,qe=0,Fe=0,Ee=0;if(Ee=Q,Q=Q+336|0,Ae=Ee+168|0,pe=Ee,_=A,p=d[_>>2]|0,_=d[_+4>>2]|0,(p|0)==0&(_|0)==0){Q=Ee;return}if(f=A+28|0,at[f>>0]|0?(p=Xu(p,_)|0,_=K()|0):at[f>>0]=1,Fe=A+20|0,!(d[d[Fe>>2]>>2]|0)){f=A+24|0,p=d[f>>2]|0,p|0&&An(p),qe=A,d[qe>>2]=0,d[qe+4>>2]=0,d[A+8>>2]=0,d[Fe>>2]=0,d[A+12>>2]=-1,d[A+16>>2]=0,d[f>>2]=0,Q=Ee;return}qe=A+16|0,f=d[qe>>2]|0,y=f&15;e:do if((p|0)==0&(_|0)==0)Ye=A+24|0;else{Me=A+12|0,ie=(y|0)==3,q=f&255,U=(y|1|0)==3,de=A+24|0,I=(y+-1|0)>>>0<3,M=(y|2|0)==3,N=pe+8|0;t:for(;;){if(T=xt(p|0,_|0,52)|0,K()|0,T=T&15,(T|0)==(d[Me>>2]|0)){switch(q&15){case 0:case 2:case 3:{if(y=Ol(p,_,Ae)|0,y|0){Le=15;break t}if(Da(d[Fe>>2]|0,d[de>>2]|0,Ae)|0){Le=19;break t}break}}if(U&&(y=d[(d[Fe>>2]|0)+4>>2]|0,d[Ae>>2]=d[y>>2],d[Ae+4>>2]=d[y+4>>2],d[Ae+8>>2]=d[y+8>>2],d[Ae+12>>2]=d[y+12>>2],Lo(26832,Ae)|0)){if(PA(d[(d[Fe>>2]|0)+4>>2]|0,T,pe)|0){Le=25;break}if(y=pe,(d[y>>2]|0)==(p|0)&&(d[y+4>>2]|0)==(_|0)){Le=29;break}}if(I){if(y=Il(p,_,Ae)|0,y|0){Le=32;break}if(FA(p,_,pe,0)|0){Le=36;break}if(M&&Oo(d[Fe>>2]|0,d[de>>2]|0,Ae,pe)|0){Le=42;break}if(U&&zA(d[Fe>>2]|0,d[de>>2]|0,Ae,pe)|0){Le=42;break}}if(ie){if(f=FA(p,_,Ae,1)|0,y=d[de>>2]|0,f|0){Le=45;break}if(nf(y,Ae)|0){if(rf(pe,Ae),np(Ae,d[de>>2]|0)|0){Le=53;break}if(Da(d[Fe>>2]|0,d[de>>2]|0,N)|0){Le=53;break}if(zA(d[Fe>>2]|0,d[de>>2]|0,pe,Ae)|0){Le=53;break}}}}do if((T|0)<(d[Me>>2]|0)){if(f=FA(p,_,Ae,1)|0,y=d[de>>2]|0,f|0){Le=58;break t}if(!(nf(y,Ae)|0)){Le=73;break}if(np(d[de>>2]|0,Ae)|0&&(rf(pe,Ae),Oo(d[Fe>>2]|0,d[de>>2]|0,pe,Ae)|0)){Le=65;break t}if(p=DA(p,_,T+1|0,pe)|0,p|0){Le=67;break t}_=pe,p=d[_>>2]|0,_=d[_+4>>2]|0}else Le=73;while(!1);if((Le|0)==73&&(Le=0,p=Xu(p,_)|0,_=K()|0),(p|0)==0&(_|0)==0){Ye=de;break e}}switch(Le|0){case 15:{f=d[de>>2]|0,f|0&&An(f),Le=A,d[Le>>2]=0,d[Le+4>>2]=0,d[Fe>>2]=0,d[Me>>2]=-1,d[qe>>2]=0,d[de>>2]=0,d[A+8>>2]=y,Le=20;break}case 19:{d[A>>2]=p,d[A+4>>2]=_,Le=20;break}case 25:{Ut(27795,27761,470,27772);break}case 29:{d[A>>2]=p,d[A+4>>2]=_,Q=Ee;return}case 32:{f=d[de>>2]|0,f|0&&An(f),Ye=A,d[Ye>>2]=0,d[Ye+4>>2]=0,d[Fe>>2]=0,d[Me>>2]=-1,d[qe>>2]=0,d[de>>2]=0,d[A+8>>2]=y,Q=Ee;return}case 36:{Ut(27795,27761,493,27772);break}case 42:{d[A>>2]=p,d[A+4>>2]=_,Q=Ee;return}case 45:{y|0&&An(y),Le=A,d[Le>>2]=0,d[Le+4>>2]=0,d[Fe>>2]=0,d[Me>>2]=-1,d[qe>>2]=0,d[de>>2]=0,d[A+8>>2]=f,Le=55;break}case 53:{d[A>>2]=p,d[A+4>>2]=_,Le=55;break}case 58:{y|0&&An(y),Le=A,d[Le>>2]=0,d[Le+4>>2]=0,d[Fe>>2]=0,d[Me>>2]=-1,d[qe>>2]=0,d[de>>2]=0,d[A+8>>2]=f,Le=71;break}case 65:{d[A>>2]=p,d[A+4>>2]=_,Le=71;break}case 67:{f=d[de>>2]|0,f|0&&An(f),Ye=A,d[Ye>>2]=0,d[Ye+4>>2]=0,d[Fe>>2]=0,d[Me>>2]=-1,d[qe>>2]=0,d[de>>2]=0,d[A+8>>2]=p,Q=Ee;return}}if((Le|0)==20){Q=Ee;return}else if((Le|0)==55){Q=Ee;return}else if((Le|0)==71){Q=Ee;return}}while(!1);f=d[Ye>>2]|0,f|0&&An(f),Le=A,d[Le>>2]=0,d[Le+4>>2]=0,d[A+8>>2]=0,d[Fe>>2]=0,d[A+12>>2]=-1,d[qe>>2]=0,d[Ye>>2]=0,Q=Ee}function Xu(A,f){A=A|0,f=f|0;var p=0,_=0,y=0,T=0,M=0,N=0,U=0,I=0,q=0,ie=0;ie=Q,Q=Q+16|0,q=ie,_=xt(A|0,f|0,52)|0,K()|0,_=_&15,p=xt(A|0,f|0,45)|0,K()|0;do if(_){for(;p=Nt(_+4095|0,0,52)|0,y=K()|0|f&-15728641,T=(15-_|0)*3|0,M=Nt(7,0,T|0)|0,N=K()|0,p=p|A|M,y=y|N,U=xt(A|0,f|0,T|0)|0,K()|0,U=U&7,_=_+-1|0,!(U>>>0<6);)if(_)f=y,A=p;else{I=4;break}if((I|0)==4){p=xt(p|0,y|0,45)|0,K()|0;break}return q=(U|0)==0&(Ci(p,y)|0)!=0,q=Nt((q?2:1)+U|0,0,T|0)|0,I=K()|0|f&~N,q=q|A&~M,At(I|0),Q=ie,q|0}while(!1);return p=p&127,p>>>0>120?(I=0,q=0,At(I|0),Q=ie,q|0):(Iu(q,0,p+1|0,0),I=d[q+4>>2]|0,q=d[q>>2]|0,At(I|0),Q=ie,q|0)}function kA(A,f,p,_,y,T){A=A|0,f=f|0,p=p|0,_=_|0,y=y|0,T=T|0;var M=0,N=0,U=0,I=0,q=0,ie=0,de=0,Ae=0,pe=0,Me=0,Le=0;Le=Q,Q=Q+160|0,ie=Le+80|0,N=Le+64|0,de=Le+112|0,Me=Le,Ca(ie,A,f,p),I=ie,sl(N,d[I>>2]|0,d[I+4>>2]|0,f),I=N,U=d[I>>2]|0,I=d[I+4>>2]|0,M=d[ie+8>>2]|0,Ae=de+4|0,d[Ae>>2]=d[ie>>2],d[Ae+4>>2]=d[ie+4>>2],d[Ae+8>>2]=d[ie+8>>2],d[Ae+12>>2]=d[ie+12>>2],d[Ae+16>>2]=d[ie+16>>2],d[Ae+20>>2]=d[ie+20>>2],d[Ae+24>>2]=d[ie+24>>2],d[Ae+28>>2]=d[ie+28>>2],Ae=Me,d[Ae>>2]=U,d[Ae+4>>2]=I,Ae=Me+8|0,d[Ae>>2]=M,A=Me+12|0,f=de,p=A+36|0;do d[A>>2]=d[f>>2],A=A+4|0,f=f+4|0;while((A|0)<(p|0));if(de=Me+48|0,d[de>>2]=d[N>>2],d[de+4>>2]=d[N+4>>2],d[de+8>>2]=d[N+8>>2],d[de+12>>2]=d[N+12>>2],(U|0)==0&(I|0)==0)return Me=M,Q=Le,Me|0;p=Me+16|0,q=Me+24|0,ie=Me+28|0,M=0,N=0,f=U,A=I;do{if(!((M|0)<(y|0)|(M|0)==(y|0)&N>>>0<_>>>0)){pe=4;break}if(I=N,N=Xt(N|0,M|0,1,0)|0,M=K()|0,I=T+(I<<3)|0,d[I>>2]=f,d[I+4>>2]=A,uf(de),A=de,f=d[A>>2]|0,A=d[A+4>>2]|0,(f|0)==0&(A|0)==0){if(al(p),f=p,A=d[f>>2]|0,f=d[f+4>>2]|0,(A|0)==0&(f|0)==0){pe=10;break}Vu(A,f,d[ie>>2]|0,de),A=de,f=d[A>>2]|0,A=d[A+4>>2]|0}I=Me,d[I>>2]=f,d[I+4>>2]=A}while(!((f|0)==0&(A|0)==0));return(pe|0)==4?(A=Me+40|0,f=d[A>>2]|0,f|0&&An(f),pe=Me+16|0,d[pe>>2]=0,d[pe+4>>2]=0,d[q>>2]=0,d[Me+36>>2]=0,d[ie>>2]=-1,d[Me+32>>2]=0,d[A>>2]=0,Vu(0,0,0,de),d[Me>>2]=0,d[Me+4>>2]=0,d[Ae>>2]=0,Me=14,Q=Le,Me|0):((pe|0)==10&&(d[Me>>2]=0,d[Me+4>>2]=0,d[Ae>>2]=d[q>>2]),Me=d[Ae>>2]|0,Q=Le,Me|0)}function cf(A,f,p,_){A=A|0,f=f|0,p=p|0,_=_|0;var y=0,T=0,M=0,N=0,U=0,I=0,q=0,ie=0,de=0,Ae=0;if(ie=Q,Q=Q+48|0,U=ie+32|0,N=ie+40|0,I=ie,!(d[A>>2]|0))return q=_,d[q>>2]=0,d[q+4>>2]=0,q=0,Q=ie,q|0;Iu(U,0,0,0),M=U,y=d[M>>2]|0,M=d[M+4>>2]|0;do if(f>>>0>15)q=I,d[q>>2]=0,d[q+4>>2]=0,d[I+8>>2]=4,d[I+12>>2]=-1,q=I+16|0,p=I+29|0,d[q>>2]=0,d[q+4>>2]=0,d[q+8>>2]=0,at[q+12>>0]=0,at[p>>0]=at[N>>0]|0,at[p+1>>0]=at[N+1>>0]|0,at[p+2>>0]=at[N+2>>0]|0,p=4,q=9;else{if(p=Ra(p)|0,p|0){U=I,d[U>>2]=0,d[U+4>>2]=0,d[I+8>>2]=p,d[I+12>>2]=-1,U=I+16|0,q=I+29|0,d[U>>2]=0,d[U+4>>2]=0,d[U+8>>2]=0,at[U+12>>0]=0,at[q>>0]=at[N>>0]|0,at[q+1>>0]=at[N+1>>0]|0,at[q+2>>0]=at[N+2>>0]|0,q=9;break}if(p=Ks((d[A+8>>2]|0)+1|0,32)|0,!p){q=I,d[q>>2]=0,d[q+4>>2]=0,d[I+8>>2]=13,d[I+12>>2]=-1,q=I+16|0,p=I+29|0,d[q>>2]=0,d[q+4>>2]=0,d[q+8>>2]=0,at[q+12>>0]=0,at[p>>0]=at[N>>0]|0,at[p+1>>0]=at[N+1>>0]|0,at[p+2>>0]=at[N+2>>0]|0,p=13,q=9;break}Na(A,p),Ae=I,d[Ae>>2]=y,d[Ae+4>>2]=M,M=I+8|0,d[M>>2]=0,d[I+12>>2]=f,d[I+20>>2]=A,d[I+24>>2]=p,at[I+28>>0]=0,y=I+29|0,at[y>>0]=at[N>>0]|0,at[y+1>>0]=at[N+1>>0]|0,at[y+2>>0]=at[N+2>>0]|0,d[I+16>>2]=3,de=+tf(p),de=de*+il(p),T=+un(+ +ee[p>>3]),T=de/+li(+ +df(+T,+ +un(+ +ee[p+8>>3])))*6371.007180918475*6371.007180918475,y=I+12|0,p=d[y>>2]|0;e:do if((p|0)>0)do{if(dp(p+-1|0,U)|0,!(T/+ee[U>>3]>10))break e;Ae=d[y>>2]|0,p=Ae+-1|0,d[y>>2]=p}while((Ae|0)>1);while(!1);if(al(I),y=_,d[y>>2]=0,d[y+4>>2]=0,y=I,p=d[y>>2]|0,y=d[y+4>>2]|0,!((p|0)==0&(y|0)==0))do lf(p,y,f,U)|0,N=U,A=_,N=Xt(d[A>>2]|0,d[A+4>>2]|0,d[N>>2]|0,d[N+4>>2]|0)|0,A=K()|0,Ae=_,d[Ae>>2]=N,d[Ae+4>>2]=A,al(I),Ae=I,p=d[Ae>>2]|0,y=d[Ae+4>>2]|0;while(!((p|0)==0&(y|0)==0));p=d[M>>2]|0}while(!1);return Ae=p,Q=ie,Ae|0}function Ts(A,f,p){A=A|0,f=f|0,p=p|0;var _=0,y=0,T=0,M=0,N=0,U=0,I=0,q=0,ie=0,de=0;if(!(Lo(f,p)|0)||(f=TA(f)|0,_=+ee[p>>3],y=+ee[p+8>>3],y=f&y<0?y+6.283185307179586:y,de=d[A>>2]|0,(de|0)<=0))return de=0,de|0;if(ie=d[A+4>>2]|0,f){f=0,q=y,p=-1,A=0;e:for(;;){for(I=A;M=+ee[ie+(I<<4)>>3],y=+ee[ie+(I<<4)+8>>3],A=(p+2|0)%(de|0)|0,T=+ee[ie+(A<<4)>>3],N=+ee[ie+(A<<4)+8>>3],M>T?(U=M,M=N):(U=T,T=M,M=y,y=N),_=_==T|_==U?_+2220446049250313e-31:_,!!(_U);)if(p=I+1|0,(p|0)>=(de|0)){p=22;break e}else A=I,I=p,p=A;if(N=M<0?M+6.283185307179586:M,M=y<0?y+6.283185307179586:y,q=N==q|M==q?q+-2220446049250313e-31:q,U=N+(M-N)*((_-T)/(U-T)),(U<0?U+6.283185307179586:U)>q&&(f=f^1),A=I+1|0,(A|0)>=(de|0)){p=22;break}else p=I}if((p|0)==22)return f|0}else{f=0,q=y,p=-1,A=0;e:for(;;){for(I=A;M=+ee[ie+(I<<4)>>3],y=+ee[ie+(I<<4)+8>>3],A=(p+2|0)%(de|0)|0,T=+ee[ie+(A<<4)>>3],N=+ee[ie+(A<<4)+8>>3],M>T?(U=M,M=N):(U=T,T=M,M=y,y=N),_=_==T|_==U?_+2220446049250313e-31:_,!!(_U);)if(p=I+1|0,(p|0)>=(de|0)){p=22;break e}else A=I,I=p,p=A;if(q=M==q|y==q?q+-2220446049250313e-31:q,M+(y-M)*((_-T)/(U-T))>q&&(f=f^1),A=I+1|0,(A|0)>=(de|0)){p=22;break}else p=I}if((p|0)==22)return f|0}return 0}function pa(A,f){A=A|0,f=f|0;var p=0,_=0,y=0,T=0,M=0,N=0,U=0,I=0,q=0,ie=0,de=0,Ae=0,pe=0,Me=0,Le=0,Ye=0,qe=0;if(pe=d[A>>2]|0,!pe){d[f>>2]=0,d[f+4>>2]=0,d[f+8>>2]=0,d[f+12>>2]=0,d[f+16>>2]=0,d[f+20>>2]=0,d[f+24>>2]=0,d[f+28>>2]=0;return}if(Me=f+8|0,ee[Me>>3]=17976931348623157e292,Le=f+24|0,ee[Le>>3]=17976931348623157e292,ee[f>>3]=-17976931348623157e292,Ye=f+16|0,ee[Ye>>3]=-17976931348623157e292,!((pe|0)<=0)){for(de=d[A+4>>2]|0,I=17976931348623157e292,q=-17976931348623157e292,ie=0,A=-1,T=17976931348623157e292,M=17976931348623157e292,U=-17976931348623157e292,_=-17976931348623157e292,Ae=0;p=+ee[de+(Ae<<4)>>3],N=+ee[de+(Ae<<4)+8>>3],A=A+2|0,y=+ee[de+(((A|0)==(pe|0)?0:A)<<4)+8>>3],p>3]=p,T=p),N>3]=N,M=N),p>U?ee[f>>3]=p:p=U,N>_&&(ee[Ye>>3]=N,_=N),I=N>0&Nq?N:q,ie=ie|+un(+(N-y))>3.141592653589793,A=Ae+1|0,(A|0)!=(pe|0);)qe=Ae,U=p,Ae=A,A=qe;ie&&(ee[Ye>>3]=q,ee[Le>>3]=I)}}function Ra(A){return A=A|0,(A>>>0<4?0:15)|0}function Na(A,f){A=A|0,f=f|0;var p=0,_=0,y=0,T=0,M=0,N=0,U=0,I=0,q=0,ie=0,de=0,Ae=0,pe=0,Me=0,Le=0,Ye=0,qe=0,Fe=0,Ee=0,Pt=0,nn=0,Jt=0;if(pe=d[A>>2]|0,pe){if(Me=f+8|0,ee[Me>>3]=17976931348623157e292,Le=f+24|0,ee[Le>>3]=17976931348623157e292,ee[f>>3]=-17976931348623157e292,Ye=f+16|0,ee[Ye>>3]=-17976931348623157e292,(pe|0)>0){for(y=d[A+4>>2]|0,de=17976931348623157e292,Ae=-17976931348623157e292,_=0,p=-1,U=17976931348623157e292,I=17976931348623157e292,ie=-17976931348623157e292,M=-17976931348623157e292,qe=0;T=+ee[y+(qe<<4)>>3],q=+ee[y+(qe<<4)+8>>3],nn=p+2|0,N=+ee[y+(((nn|0)==(pe|0)?0:nn)<<4)+8>>3],T>3]=T,U=T),q>3]=q,I=q),T>ie?ee[f>>3]=T:T=ie,q>M&&(ee[Ye>>3]=q,M=q),de=q>0&qAe?q:Ae,_=_|+un(+(q-N))>3.141592653589793,p=qe+1|0,(p|0)!=(pe|0);)nn=qe,ie=T,qe=p,p=nn;_&&(ee[Ye>>3]=Ae,ee[Le>>3]=de)}}else d[f>>2]=0,d[f+4>>2]=0,d[f+8>>2]=0,d[f+12>>2]=0,d[f+16>>2]=0,d[f+20>>2]=0,d[f+24>>2]=0,d[f+28>>2]=0;if(nn=A+8|0,p=d[nn>>2]|0,!((p|0)<=0)){Pt=A+12|0,Ee=0;do if(y=d[Pt>>2]|0,_=Ee,Ee=Ee+1|0,Le=f+(Ee<<5)|0,Ye=d[y+(_<<3)>>2]|0,Ye){if(qe=f+(Ee<<5)+8|0,ee[qe>>3]=17976931348623157e292,A=f+(Ee<<5)+24|0,ee[A>>3]=17976931348623157e292,ee[Le>>3]=-17976931348623157e292,Fe=f+(Ee<<5)+16|0,ee[Fe>>3]=-17976931348623157e292,(Ye|0)>0){for(pe=d[y+(_<<3)+4>>2]|0,de=17976931348623157e292,Ae=-17976931348623157e292,y=0,_=-1,Me=0,U=17976931348623157e292,I=17976931348623157e292,q=-17976931348623157e292,M=-17976931348623157e292;T=+ee[pe+(Me<<4)>>3],ie=+ee[pe+(Me<<4)+8>>3],_=_+2|0,N=+ee[pe+(((_|0)==(Ye|0)?0:_)<<4)+8>>3],T>3]=T,U=T),ie>3]=ie,I=ie),T>q?ee[Le>>3]=T:T=q,ie>M&&(ee[Fe>>3]=ie,M=ie),de=ie>0&ieAe?ie:Ae,y=y|+un(+(ie-N))>3.141592653589793,_=Me+1|0,(_|0)!=(Ye|0);)Jt=Me,Me=_,q=T,_=Jt;y&&(ee[Fe>>3]=Ae,ee[A>>3]=de)}}else d[Le>>2]=0,d[Le+4>>2]=0,d[Le+8>>2]=0,d[Le+12>>2]=0,d[Le+16>>2]=0,d[Le+20>>2]=0,d[Le+24>>2]=0,d[Le+28>>2]=0,p=d[nn>>2]|0;while((Ee|0)<(p|0))}}function Da(A,f,p){A=A|0,f=f|0,p=p|0;var _=0,y=0,T=0;if(!(Ts(A,f,p)|0))return y=0,y|0;if(y=A+8|0,(d[y>>2]|0)<=0)return y=1,y|0;for(_=A+12|0,A=0;;){if(T=A,A=A+1|0,Ts((d[_>>2]|0)+(T<<3)|0,f+(A<<5)|0,p)|0){A=0,_=6;break}if((A|0)>=(d[y>>2]|0)){A=1,_=6;break}}return(_|0)==6?A|0:0}function Oo(A,f,p,_){A=A|0,f=f|0,p=p|0,_=_|0;var y=0,T=0,M=0,N=0,U=0,I=0,q=0;if(I=Q,Q=Q+16|0,N=I,M=p+8|0,!(Ts(A,f,M)|0))return U=0,Q=I,U|0;U=A+8|0;e:do if((d[U>>2]|0)>0){for(T=A+12|0,y=0;;){if(q=y,y=y+1|0,Ts((d[T>>2]|0)+(q<<3)|0,f+(y<<5)|0,M)|0){y=0;break}if((y|0)>=(d[U>>2]|0))break e}return Q=I,y|0}while(!1);if(hf(A,f,p,_)|0)return q=0,Q=I,q|0;d[N>>2]=d[p>>2],d[N+4>>2]=M,y=d[U>>2]|0;e:do if((y|0)>0)for(A=A+12|0,M=0,T=y;;){if(y=d[A>>2]|0,(d[y+(M<<3)>>2]|0)>0){if(Ts(N,_,d[y+(M<<3)+4>>2]|0)|0){y=0;break e}if(y=M+1|0,hf((d[A>>2]|0)+(M<<3)|0,f+(y<<5)|0,p,_)|0){y=0;break e}T=d[U>>2]|0}else y=M+1|0;if((y|0)<(T|0))M=y;else{y=1;break}}else y=1;while(!1);return q=y,Q=I,q|0}function hf(A,f,p,_){A=A|0,f=f|0,p=p|0,_=_|0;var y=0,T=0,M=0,N=0,U=0,I=0,q=0,ie=0,de=0,Ae=0,pe=0,Me=0,Le=0,Ye=0,qe=0,Fe=0,Ee=0,Pt=0,nn=0,Jt=0,Un=0;if(nn=Q,Q=Q+176|0,qe=nn+172|0,y=nn+168|0,Fe=nn,!(nf(f,_)|0))return A=0,Q=nn,A|0;if(wA(f,_,qe,y),Gl(Fe|0,p|0,168)|0,(d[p>>2]|0)>0){f=0;do Jt=Fe+8+(f<<4)+8|0,Ye=+Xs(+ee[Jt>>3],d[y>>2]|0),ee[Jt>>3]=Ye,f=f+1|0;while((f|0)<(d[p>>2]|0))}Me=+ee[_>>3],Le=+ee[_+8>>3],Ye=+Xs(+ee[_+16>>3],d[y>>2]|0),Ae=+Xs(+ee[_+24>>3],d[y>>2]|0);e:do if((d[A>>2]|0)>0){if(_=A+4|0,y=d[Fe>>2]|0,(y|0)<=0){for(f=0;;)if(f=f+1|0,(f|0)>=(d[A>>2]|0)){f=0;break e}}for(p=0;;){if(f=d[_>>2]|0,de=+ee[f+(p<<4)>>3],pe=+Xs(+ee[f+(p<<4)+8>>3],d[qe>>2]|0),f=d[_>>2]|0,p=p+1|0,Jt=(p|0)%(d[A>>2]|0)|0,T=+ee[f+(Jt<<4)>>3],M=+Xs(+ee[f+(Jt<<4)+8>>3],d[qe>>2]|0),!(de>=Me)|!(T>=Me)&&!(de<=Le)|!(T<=Le)&&!(pe<=Ae)|!(M<=Ae)&&!(pe>=Ye)|!(M>=Ye)){ie=T-de,I=M-pe,f=0;do if(Un=f,f=f+1|0,Jt=(f|0)==(y|0)?0:f,T=+ee[Fe+8+(Un<<4)+8>>3],M=+ee[Fe+8+(Jt<<4)+8>>3]-T,N=+ee[Fe+8+(Un<<4)>>3],U=+ee[Fe+8+(Jt<<4)>>3]-N,q=ie*M-I*U,q!=0&&(Ee=pe-T,Pt=de-N,U=(Ee*U-M*Pt)/q,!(U<0|U>1))&&(q=(ie*Ee-I*Pt)/q,q>=0&q<=1)){f=1;break e}while((f|0)<(y|0))}if((p|0)>=(d[A>>2]|0)){f=0;break}}}else f=0;while(!1);return Un=f,Q=nn,Un|0}function zA(A,f,p,_){A=A|0,f=f|0,p=p|0,_=_|0;var y=0,T=0,M=0;if(hf(A,f,p,_)|0)return T=1,T|0;if(T=A+8|0,(d[T>>2]|0)<=0)return T=0,T|0;for(y=A+12|0,A=0;;){if(M=A,A=A+1|0,hf((d[y>>2]|0)+(M<<3)|0,f+(A<<5)|0,p,_)|0){A=1,y=6;break}if((A|0)>=(d[T>>2]|0)){A=0,y=6;break}}return(y|0)==6?A|0:0}function _p(){return 8}function R1(){return 16}function fs(){return 168}function sr(){return 8}function mi(){return 16}function kl(){return 12}function Pa(){return 8}function yp(A){return A=A|0,+(+((d[A>>2]|0)>>>0)+4294967296*+(d[A+4>>2]|0))}function zl(A){A=A|0;var f=0,p=0;return p=+ee[A>>3],f=+ee[A+8>>3],+ +qn(+(p*p+f*f))}function xp(A,f,p,_,y){A=A|0,f=f|0,p=p|0,_=_|0,y=y|0;var T=0,M=0,N=0,U=0,I=0,q=0,ie=0,de=0;I=+ee[A>>3],U=+ee[f>>3]-I,N=+ee[A+8>>3],M=+ee[f+8>>3]-N,ie=+ee[p>>3],T=+ee[_>>3]-ie,de=+ee[p+8>>3],q=+ee[_+8>>3]-de,T=(T*(N-de)-(I-ie)*q)/(U*q-M*T),ee[y>>3]=I+U*T,ee[y+8>>3]=N+M*T}function bp(A,f){return A=A|0,f=f|0,+un(+(+ee[A>>3]-+ee[f>>3]))<11920928955078125e-23?(f=+un(+(+ee[A+8>>3]-+ee[f+8>>3]))<11920928955078125e-23,f|0):(f=0,f|0)}function ar(A,f){A=A|0,f=f|0;var p=0,_=0,y=0;return y=+ee[A>>3]-+ee[f>>3],_=+ee[A+8>>3]-+ee[f+8>>3],p=+ee[A+16>>3]-+ee[f+16>>3],+(y*y+_*_+p*p)}function Yu(A,f){A=A|0,f=f|0;var p=0,_=0,y=0;p=+ee[A>>3],_=+li(+p),p=+Fn(+p),ee[f+16>>3]=p,p=+ee[A+8>>3],y=_*+li(+p),ee[f>>3]=y,p=_*+Fn(+p),ee[f+8>>3]=p}function Sp(A,f,p){A=A|0,f=f|0,p=p|0;var _=0,y=0,T=0;if(T=Q,Q=Q+16|0,y=T,_=Ci(A,f)|0,(p+-1|0)>>>0>5||(_=(_|0)!=0,(p|0)==1&_))return y=-1,Q=T,y|0;do if(ol(A,f,y)|0)_=-1;else if(_){_=((d[26352+(p<<2)>>2]|0)+5-(d[y>>2]|0)|0)%5|0;break}else{_=((d[26384+(p<<2)>>2]|0)+6-(d[y>>2]|0)|0)%6|0;break}while(!1);return y=_,Q=T,y|0}function ol(A,f,p){A=A|0,f=f|0,p=p|0;var _=0,y=0,T=0,M=0,N=0,U=0,I=0,q=0;if(q=Q,Q=Q+32|0,N=q+16|0,U=q,_=zu(A,f,N)|0,_|0)return p=_,Q=q,p|0;T=g1(A,f)|0,I=$s(A,f)|0,tp(T,U),_=$c(T,d[N>>2]|0)|0;do if(Bi(T)|0){do switch(T|0){case 4:{y=0;break}case 14:{y=1;break}case 24:{y=2;break}case 38:{y=3;break}case 49:{y=4;break}case 58:{y=5;break}case 63:{y=6;break}case 72:{y=7;break}case 83:{y=8;break}case 97:{y=9;break}case 107:{y=10;break}case 117:{y=11;break}default:Ut(27795,27797,75,27806)}while(!1);if(M=d[26416+(y*24|0)+8>>2]|0,f=d[26416+(y*24|0)+16>>2]|0,A=d[N>>2]|0,(A|0)!=(d[U>>2]|0)&&(U=Wc(T)|0,A=d[N>>2]|0,U|(A|0)==(f|0)&&(_=(_+1|0)%6|0)),(I|0)==3&(A|0)==(f|0)){_=(_+5|0)%6|0;break}(I|0)==5&(A|0)==(M|0)&&(_=(_+1|0)%6|0)}while(!1);return d[p>>2]=_,p=0,Q=q,p|0}function Qs(A,f,p,_){A=A|0,f=f|0,p=p|0,_=_|0;var y=0,T=0,M=0,N=0,U=0,I=0,q=0,ie=0,de=0,Ae=0,pe=0,Me=0,Le=0,Ye=0,qe=0,Fe=0;if(Fe=Q,Q=Q+32|0,qe=Fe+24|0,Le=Fe+20|0,pe=Fe+8|0,Ae=Fe+16|0,de=Fe,U=(Ci(A,f)|0)==0,U=U?6:5,q=xt(A|0,f|0,52)|0,K()|0,q=q&15,U>>>0<=p>>>0)return _=2,Q=Fe,_|0;ie=(q|0)==0,!ie&&(Me=Nt(7,0,(q^15)*3|0)|0,(Me&A|0)==0&((K()|0)&f|0)==0)?y=p:T=4;e:do if((T|0)==4){if(y=(Ci(A,f)|0)!=0,((y?4:5)|0)<(p|0)||ol(A,f,qe)|0||(T=(d[qe>>2]|0)+p|0,y?y=26704+(((T|0)%5|0)<<2)|0:y=26736+(((T|0)%6|0)<<2)|0,Me=d[y>>2]|0,(Me|0)==7))return _=1,Q=Fe,_|0;d[Le>>2]=0,y=cn(A,f,Me,Le,pe)|0;do if(!y){if(N=pe,I=d[N>>2]|0,N=d[N+4>>2]|0,M=N>>>0>>0|(N|0)==(f|0)&I>>>0>>0,T=M?I:A,M=M?N:f,!ie&&(ie=Nt(7,0,(q^15)*3|0)|0,(I&ie|0)==0&(N&(K()|0)|0)==0))y=p;else{if(N=(p+-1+U|0)%(U|0)|0,y=Ci(A,f)|0,(N|0)<0&&Ut(27795,27797,248,27822),U=(y|0)!=0,((U?4:5)|0)<(N|0)&&Ut(27795,27797,248,27822),ol(A,f,qe)|0&&Ut(27795,27797,248,27822),y=(d[qe>>2]|0)+N|0,U?y=26704+(((y|0)%5|0)<<2)|0:y=26736+(((y|0)%6|0)<<2)|0,N=d[y>>2]|0,(N|0)==7&&Ut(27795,27797,248,27822),d[Ae>>2]=0,y=cn(A,f,N,Ae,de)|0,y|0)break;I=de,U=d[I>>2]|0,I=d[I+4>>2]|0;do if(I>>>0>>0|(I|0)==(M|0)&U>>>0>>0){if(Ci(U,I)|0?T=pi(U,I,A,f)|0:T=d[26800+((((d[Ae>>2]|0)+(d[26768+(N<<2)>>2]|0)|0)%6|0)<<2)>>2]|0,y=Ci(U,I)|0,(T+-1|0)>>>0>5){y=-1,T=U,M=I;break}if(y=(y|0)!=0,(T|0)==1&y){y=-1,T=U,M=I;break}do if(ol(U,I,qe)|0)y=-1;else if(y){y=((d[26352+(T<<2)>>2]|0)+5-(d[qe>>2]|0)|0)%5|0;break}else{y=((d[26384+(T<<2)>>2]|0)+6-(d[qe>>2]|0)|0)%6|0;break}while(!1);T=U,M=I}else y=p;while(!1);N=pe,I=d[N>>2]|0,N=d[N+4>>2]|0}if((T|0)==(I|0)&(M|0)==(N|0)){if(U=(Ci(I,N)|0)!=0,U?A=pi(I,N,A,f)|0:A=d[26800+((((d[Le>>2]|0)+(d[26768+(Me<<2)>>2]|0)|0)%6|0)<<2)>>2]|0,y=Ci(I,N)|0,(A+-1|0)>>>0<=5&&(Ye=(y|0)!=0,!((A|0)==1&Ye)))do if(ol(I,N,qe)|0)y=-1;else if(Ye){y=((d[26352+(A<<2)>>2]|0)+5-(d[qe>>2]|0)|0)%5|0;break}else{y=((d[26384+(A<<2)>>2]|0)+6-(d[qe>>2]|0)|0)%6|0;break}while(!1);else y=-1;y=y+1|0,y=(y|0)==6|U&(y|0)==5?0:y}f=M,A=T;break e}while(!1);return _=y,Q=Fe,_|0}while(!1);return Ye=Nt(y|0,0,56)|0,qe=K()|0|f&-2130706433|536870912,d[_>>2]=Ye|A,d[_+4>>2]=qe,_=0,Q=Fe,_|0}function Qu(A,f,p){A=A|0,f=f|0,p=p|0;var _=0,y=0,T=0;return T=(Ci(A,f)|0)==0,_=Qs(A,f,0,p)|0,y=(_|0)==0,T?!y||(_=Qs(A,f,1,p+8|0)|0,_|0)||(_=Qs(A,f,2,p+16|0)|0,_|0)||(_=Qs(A,f,3,p+24|0)|0,_|0)||(_=Qs(A,f,4,p+32|0)|0,_)?(T=_,T|0):Qs(A,f,5,p+40|0)|0:!y||(_=Qs(A,f,1,p+8|0)|0,_|0)||(_=Qs(A,f,2,p+16|0)|0,_|0)||(_=Qs(A,f,3,p+24|0)|0,_|0)||(_=Qs(A,f,4,p+32|0)|0,_|0)?(T=_,T|0):(T=p+40|0,d[T>>2]=0,d[T+4>>2]=0,T=0,T|0)}function ll(A,f,p){A=A|0,f=f|0,p=p|0;var _=0,y=0,T=0,M=0,N=0,U=0;return U=Q,Q=Q+192|0,y=U,T=U+168|0,M=xt(A|0,f|0,56)|0,K()|0,M=M&7,N=f&-2130706433|134217728,_=zu(A,N,T)|0,_|0?(N=_,Q=U,N|0):(f=xt(A|0,f|0,52)|0,K()|0,f=f&15,Ci(A,N)|0?sp(T,f,M,1,y):RA(T,f,M,1,y),N=y+8|0,d[p>>2]=d[N>>2],d[p+4>>2]=d[N+4>>2],d[p+8>>2]=d[N+8>>2],d[p+12>>2]=d[N+12>>2],N=0,Q=U,N|0)}function ul(A,f){A=A|0,f=f|0;var p=0,_=0,y=0,T=0;return y=Q,Q=Q+16|0,p=y,!(!0&(f&2013265920|0)==536870912)||(_=f&-2130706433|134217728,!(NA(A,_)|0))?(_=0,Q=y,_|0):(T=xt(A|0,f|0,56)|0,K()|0,T=(Qs(A,_,T&7,p)|0)==0,_=p,_=T&((d[_>>2]|0)==(A|0)?(d[_+4>>2]|0)==(f|0):0)&1,Q=y,_|0)}function Io(A,f,p){A=A|0,f=f|0,p=p|0;var _=0;(f|0)>0?(_=Ks(f,4)|0,d[A>>2]=_,_||Ut(27835,27858,40,27872)):d[A>>2]=0,d[A+4>>2]=f,d[A+8>>2]=0,d[A+12>>2]=p}function GA(A){A=A|0;var f=0,p=0,_=0,y=0,T=0,M=0,N=0;y=A+4|0,T=A+12|0,M=A+8|0;e:for(;;){for(p=d[y>>2]|0,f=0;;){if((f|0)>=(p|0))break e;if(_=d[A>>2]|0,N=d[_+(f<<2)>>2]|0,!N)f=f+1|0;else break}f=_+(~~(+un(+(+Hs(10,+ +(15-(d[T>>2]|0)|0))*(+ee[N>>3]+ +ee[N+8>>3])))%+(p|0))>>>0<<2)|0,p=d[f>>2]|0;t:do if(p|0){if(_=N+32|0,(p|0)==(N|0))d[f>>2]=d[_>>2];else{if(p=p+32|0,f=d[p>>2]|0,!f)break;for(;(f|0)!=(N|0);)if(p=f+32|0,f=d[p>>2]|0,!f)break t;d[p>>2]=d[_>>2]}An(N),d[M>>2]=(d[M>>2]|0)+-1}while(!1)}An(d[A>>2]|0)}function qA(A){A=A|0;var f=0,p=0,_=0;for(_=d[A+4>>2]|0,p=0;;){if((p|0)>=(_|0)){f=0,p=4;break}if(f=d[(d[A>>2]|0)+(p<<2)>>2]|0,!f)p=p+1|0;else{p=4;break}}return(p|0)==4?f|0:0}function Ku(A,f){A=A|0,f=f|0;var p=0,_=0,y=0,T=0;if(p=~~(+un(+(+Hs(10,+ +(15-(d[A+12>>2]|0)|0))*(+ee[f>>3]+ +ee[f+8>>3])))%+(d[A+4>>2]|0))>>>0,p=(d[A>>2]|0)+(p<<2)|0,_=d[p>>2]|0,!_)return T=1,T|0;T=f+32|0;do if((_|0)!=(f|0)){if(p=d[_+32>>2]|0,!p)return T=1,T|0;for(y=p;;){if((y|0)==(f|0)){y=8;break}if(p=d[y+32>>2]|0,p)_=y,y=p;else{p=1,y=10;break}}if((y|0)==8){d[_+32>>2]=d[T>>2];break}else if((y|0)==10)return p|0}else d[p>>2]=d[T>>2];while(!1);return An(f),T=A+8|0,d[T>>2]=(d[T>>2]|0)+-1,T=0,T|0}function VA(A,f,p){A=A|0,f=f|0,p=p|0;var _=0,y=0,T=0,M=0;T=Fo(40)|0,T||Ut(27888,27858,98,27901),d[T>>2]=d[f>>2],d[T+4>>2]=d[f+4>>2],d[T+8>>2]=d[f+8>>2],d[T+12>>2]=d[f+12>>2],y=T+16|0,d[y>>2]=d[p>>2],d[y+4>>2]=d[p+4>>2],d[y+8>>2]=d[p+8>>2],d[y+12>>2]=d[p+12>>2],d[T+32>>2]=0,y=~~(+un(+(+Hs(10,+ +(15-(d[A+12>>2]|0)|0))*(+ee[f>>3]+ +ee[f+8>>3])))%+(d[A+4>>2]|0))>>>0,y=(d[A>>2]|0)+(y<<2)|0,_=d[y>>2]|0;do if(!_)d[y>>2]=T;else{for(;!(Ea(_,f)|0&&Ea(_+16|0,p)|0);)if(y=d[_+32>>2]|0,_=(y|0)==0?_:y,!(d[_+32>>2]|0)){M=10;break}if((M|0)==10){d[_+32>>2]=T;break}return An(T),M=_,M|0}while(!1);return M=A+8|0,d[M>>2]=(d[M>>2]|0)+1,M=T,M|0}function Zu(A,f,p){A=A|0,f=f|0,p=p|0;var _=0,y=0;if(y=~~(+un(+(+Hs(10,+ +(15-(d[A+12>>2]|0)|0))*(+ee[f>>3]+ +ee[f+8>>3])))%+(d[A+4>>2]|0))>>>0,y=d[(d[A>>2]|0)+(y<<2)>>2]|0,!y)return p=0,p|0;if(!p){for(A=y;;){if(Ea(A,f)|0){_=10;break}if(A=d[A+32>>2]|0,!A){A=0,_=10;break}}if((_|0)==10)return A|0}for(A=y;;){if(Ea(A,f)|0&&Ea(A+16|0,p)|0){_=10;break}if(A=d[A+32>>2]|0,!A){A=0,_=10;break}}return(_|0)==10?A|0:0}function As(A,f){A=A|0,f=f|0;var p=0;if(p=~~(+un(+(+Hs(10,+ +(15-(d[A+12>>2]|0)|0))*(+ee[f>>3]+ +ee[f+8>>3])))%+(d[A+4>>2]|0))>>>0,A=d[(d[A>>2]|0)+(p<<2)>>2]|0,!A)return p=0,p|0;for(;;){if(Ea(A,f)|0){f=5;break}if(A=d[A+32>>2]|0,!A){A=0,f=5;break}}return(f|0)==5?A|0:0}function HA(){return 27920}function cl(A){return A=+A,~~+pf(+A)|0}function Fo(A){A=A|0;var f=0,p=0,_=0,y=0,T=0,M=0,N=0,U=0,I=0,q=0,ie=0,de=0,Ae=0,pe=0,Me=0,Le=0,Ye=0,qe=0,Fe=0,Ee=0,Pt=0;Pt=Q,Q=Q+16|0,de=Pt;do if(A>>>0<245){if(I=A>>>0<11?16:A+11&-8,A=I>>>3,ie=d[6981]|0,p=ie>>>A,p&3|0)return f=(p&1^1)+A|0,A=27964+(f<<1<<2)|0,p=A+8|0,_=d[p>>2]|0,y=_+8|0,T=d[y>>2]|0,(T|0)==(A|0)?d[6981]=ie&~(1<>2]=A,d[p>>2]=T),Ee=f<<3,d[_+4>>2]=Ee|3,Ee=_+Ee+4|0,d[Ee>>2]=d[Ee>>2]|1,Ee=y,Q=Pt,Ee|0;if(q=d[6983]|0,I>>>0>q>>>0){if(p|0)return f=2<>>12&16,f=f>>>N,p=f>>>5&8,f=f>>>p,T=f>>>2&4,f=f>>>T,A=f>>>1&2,f=f>>>A,_=f>>>1&1,_=(p|N|T|A|_)+(f>>>_)|0,f=27964+(_<<1<<2)|0,A=f+8|0,T=d[A>>2]|0,N=T+8|0,p=d[N>>2]|0,(p|0)==(f|0)?(A=ie&~(1<<_),d[6981]=A):(d[p+12>>2]=f,d[A>>2]=p,A=ie),Ee=_<<3,M=Ee-I|0,d[T+4>>2]=I|3,y=T+I|0,d[y+4>>2]=M|1,d[T+Ee>>2]=M,q|0&&(_=d[6986]|0,f=q>>>3,p=27964+(f<<1<<2)|0,f=1<>2]|0):(d[6981]=A|f,f=p,A=p+8|0),d[A>>2]=_,d[f+12>>2]=_,d[_+8>>2]=f,d[_+12>>2]=p),d[6983]=M,d[6986]=y,Ee=N,Q=Pt,Ee|0;if(T=d[6982]|0,T){for(p=(T&0-T)+-1|0,y=p>>>12&16,p=p>>>y,_=p>>>5&8,p=p>>>_,M=p>>>2&4,p=p>>>M,N=p>>>1&2,p=p>>>N,U=p>>>1&1,U=d[28228+((_|y|M|N|U)+(p>>>U)<<2)>>2]|0,p=U,N=U,U=(d[U+4>>2]&-8)-I|0;A=d[p+16>>2]|0,!(!A&&(A=d[p+20>>2]|0,!A));)M=(d[A+4>>2]&-8)-I|0,y=M>>>0>>0,p=A,N=y?A:N,U=y?M:U;if(M=N+I|0,M>>>0>N>>>0){y=d[N+24>>2]|0,f=d[N+12>>2]|0;do if((f|0)==(N|0)){if(A=N+20|0,f=d[A>>2]|0,!f&&(A=N+16|0,f=d[A>>2]|0,!f)){p=0;break}for(;;)if(_=f+20|0,p=d[_>>2]|0,p)f=p,A=_;else if(_=f+16|0,p=d[_>>2]|0,p)f=p,A=_;else break;d[A>>2]=0,p=f}else p=d[N+8>>2]|0,d[p+12>>2]=f,d[f+8>>2]=p,p=f;while(!1);do if(y|0){if(f=d[N+28>>2]|0,A=28228+(f<<2)|0,(N|0)==(d[A>>2]|0)){if(d[A>>2]=p,!p){d[6982]=T&~(1<>2]|0)==(N|0)?Ee:y+20|0)>>2]=p,!p)break;d[p+24>>2]=y,f=d[N+16>>2]|0,f|0&&(d[p+16>>2]=f,d[f+24>>2]=p),f=d[N+20>>2]|0,f|0&&(d[p+20>>2]=f,d[f+24>>2]=p)}while(!1);return U>>>0<16?(Ee=U+I|0,d[N+4>>2]=Ee|3,Ee=N+Ee+4|0,d[Ee>>2]=d[Ee>>2]|1):(d[N+4>>2]=I|3,d[M+4>>2]=U|1,d[M+U>>2]=U,q|0&&(_=d[6986]|0,f=q>>>3,p=27964+(f<<1<<2)|0,f=1<>2]|0):(d[6981]=f|ie,f=p,A=p+8|0),d[A>>2]=_,d[f+12>>2]=_,d[_+8>>2]=f,d[_+12>>2]=p),d[6983]=U,d[6986]=M),Ee=N+8|0,Q=Pt,Ee|0}else ie=I}else ie=I}else ie=I}else if(A>>>0<=4294967231)if(A=A+11|0,I=A&-8,_=d[6982]|0,_){y=0-I|0,A=A>>>8,A?I>>>0>16777215?U=31:(ie=(A+1048320|0)>>>16&8,Me=A<>>16&4,Me=Me<>>16&2,U=14-(N|ie|U)+(Me<>>15)|0,U=I>>>(U+7|0)&1|U<<1):U=0,p=d[28228+(U<<2)>>2]|0;e:do if(!p)p=0,A=0,Me=61;else for(A=0,N=I<<((U|0)==31?0:25-(U>>>1)|0),T=0;;){if(M=(d[p+4>>2]&-8)-I|0,M>>>0>>0)if(M)A=p,y=M;else{A=p,y=0,Me=65;break e}if(Me=d[p+20>>2]|0,p=d[p+16+(N>>>31<<2)>>2]|0,T=(Me|0)==0|(Me|0)==(p|0)?T:Me,p)N=N<<1;else{p=T,Me=61;break}}while(!1);if((Me|0)==61){if((p|0)==0&(A|0)==0){if(A=2<>>12&16,ie=ie>>>M,T=ie>>>5&8,ie=ie>>>T,N=ie>>>2&4,ie=ie>>>N,U=ie>>>1&2,ie=ie>>>U,p=ie>>>1&1,A=0,p=d[28228+((T|M|N|U|p)+(ie>>>p)<<2)>>2]|0}p?Me=65:(N=A,M=y)}if((Me|0)==65)for(T=p;;)if(ie=(d[T+4>>2]&-8)-I|0,p=ie>>>0>>0,y=p?ie:y,A=p?T:A,p=d[T+16>>2]|0,p||(p=d[T+20>>2]|0),p)T=p;else{N=A,M=y;break}if((N|0)!=0&&M>>>0<((d[6983]|0)-I|0)>>>0&&(q=N+I|0,q>>>0>N>>>0)){T=d[N+24>>2]|0,f=d[N+12>>2]|0;do if((f|0)==(N|0)){if(A=N+20|0,f=d[A>>2]|0,!f&&(A=N+16|0,f=d[A>>2]|0,!f)){f=0;break}for(;;)if(y=f+20|0,p=d[y>>2]|0,p)f=p,A=y;else if(y=f+16|0,p=d[y>>2]|0,p)f=p,A=y;else break;d[A>>2]=0}else Ee=d[N+8>>2]|0,d[Ee+12>>2]=f,d[f+8>>2]=Ee;while(!1);do if(T){if(A=d[N+28>>2]|0,p=28228+(A<<2)|0,(N|0)==(d[p>>2]|0)){if(d[p>>2]=f,!f){_=_&~(1<>2]|0)==(N|0)?Ee:T+20|0)>>2]=f,!f)break;d[f+24>>2]=T,A=d[N+16>>2]|0,A|0&&(d[f+16>>2]=A,d[A+24>>2]=f),A=d[N+20>>2]|0,A&&(d[f+20>>2]=A,d[A+24>>2]=f)}while(!1);e:do if(M>>>0<16)Ee=M+I|0,d[N+4>>2]=Ee|3,Ee=N+Ee+4|0,d[Ee>>2]=d[Ee>>2]|1;else{if(d[N+4>>2]=I|3,d[q+4>>2]=M|1,d[q+M>>2]=M,f=M>>>3,M>>>0<256){p=27964+(f<<1<<2)|0,A=d[6981]|0,f=1<>2]|0):(d[6981]=A|f,f=p,A=p+8|0),d[A>>2]=q,d[f+12>>2]=q,d[q+8>>2]=f,d[q+12>>2]=p;break}if(f=M>>>8,f?M>>>0>16777215?p=31:(Fe=(f+1048320|0)>>>16&8,Ee=f<>>16&4,Ee=Ee<>>16&2,p=14-(qe|Fe|p)+(Ee<

>>15)|0,p=M>>>(p+7|0)&1|p<<1):p=0,f=28228+(p<<2)|0,d[q+28>>2]=p,A=q+16|0,d[A+4>>2]=0,d[A>>2]=0,A=1<>2]=q,d[q+24>>2]=f,d[q+12>>2]=q,d[q+8>>2]=q;break}f=d[f>>2]|0;t:do if((d[f+4>>2]&-8|0)!=(M|0)){for(_=M<<((p|0)==31?0:25-(p>>>1)|0);p=f+16+(_>>>31<<2)|0,A=d[p>>2]|0,!!A;)if((d[A+4>>2]&-8|0)==(M|0)){f=A;break t}else _=_<<1,f=A;d[p>>2]=q,d[q+24>>2]=f,d[q+12>>2]=q,d[q+8>>2]=q;break e}while(!1);Fe=f+8|0,Ee=d[Fe>>2]|0,d[Ee+12>>2]=q,d[Fe>>2]=q,d[q+8>>2]=Ee,d[q+12>>2]=f,d[q+24>>2]=0}while(!1);return Ee=N+8|0,Q=Pt,Ee|0}else ie=I}else ie=I;else ie=-1;while(!1);if(p=d[6983]|0,p>>>0>=ie>>>0)return f=p-ie|0,A=d[6986]|0,f>>>0>15?(Ee=A+ie|0,d[6986]=Ee,d[6983]=f,d[Ee+4>>2]=f|1,d[A+p>>2]=f,d[A+4>>2]=ie|3):(d[6983]=0,d[6986]=0,d[A+4>>2]=p|3,Ee=A+p+4|0,d[Ee>>2]=d[Ee>>2]|1),Ee=A+8|0,Q=Pt,Ee|0;if(M=d[6984]|0,M>>>0>ie>>>0)return qe=M-ie|0,d[6984]=qe,Ee=d[6987]|0,Fe=Ee+ie|0,d[6987]=Fe,d[Fe+4>>2]=qe|1,d[Ee+4>>2]=ie|3,Ee=Ee+8|0,Q=Pt,Ee|0;if(d[7099]|0?A=d[7101]|0:(d[7101]=4096,d[7100]=4096,d[7102]=-1,d[7103]=-1,d[7104]=0,d[7092]=0,d[7099]=de&-16^1431655768,A=4096),N=ie+48|0,U=ie+47|0,T=A+U|0,y=0-A|0,I=T&y,I>>>0<=ie>>>0||(A=d[7091]|0,A|0&&(q=d[7089]|0,de=q+I|0,de>>>0<=q>>>0|de>>>0>A>>>0)))return Ee=0,Q=Pt,Ee|0;e:do if(d[7092]&4)f=0,Me=143;else{p=d[6987]|0;t:do if(p){for(_=28372;de=d[_>>2]|0,!(de>>>0<=p>>>0&&(de+(d[_+4>>2]|0)|0)>>>0>p>>>0);)if(A=d[_+8>>2]|0,A)_=A;else{Me=128;break t}if(f=T-M&y,f>>>0<2147483647)if(A=fl(f|0)|0,(A|0)==((d[_>>2]|0)+(d[_+4>>2]|0)|0)){if((A|0)!=-1){M=f,T=A,Me=145;break e}}else _=A,Me=136;else f=0}else Me=128;while(!1);do if((Me|0)==128)if(p=fl(0)|0,(p|0)!=-1&&(f=p,Ae=d[7100]|0,pe=Ae+-1|0,f=((pe&f|0)==0?0:(pe+f&0-Ae)-f|0)+I|0,Ae=d[7089]|0,pe=f+Ae|0,f>>>0>ie>>>0&f>>>0<2147483647)){if(de=d[7091]|0,de|0&&pe>>>0<=Ae>>>0|pe>>>0>de>>>0){f=0;break}if(A=fl(f|0)|0,(A|0)==(p|0)){M=f,T=p,Me=145;break e}else _=A,Me=136}else f=0;while(!1);do if((Me|0)==136){if(p=0-f|0,!(N>>>0>f>>>0&(f>>>0<2147483647&(_|0)!=-1)))if((_|0)==-1){f=0;break}else{M=f,T=_,Me=145;break e}if(A=d[7101]|0,A=U-f+A&0-A,A>>>0>=2147483647){M=f,T=_,Me=145;break e}if((fl(A|0)|0)==-1){fl(p|0)|0,f=0;break}else{M=A+f|0,T=_,Me=145;break e}}while(!1);d[7092]=d[7092]|4,Me=143}while(!1);if((Me|0)==143&&I>>>0<2147483647&&(qe=fl(I|0)|0,pe=fl(0)|0,Le=pe-qe|0,Ye=Le>>>0>(ie+40|0)>>>0,!((qe|0)==-1|Ye^1|qe>>>0>>0&((qe|0)!=-1&(pe|0)!=-1)^1))&&(M=Ye?Le:f,T=qe,Me=145),(Me|0)==145){f=(d[7089]|0)+M|0,d[7089]=f,f>>>0>(d[7090]|0)>>>0&&(d[7090]=f),U=d[6987]|0;e:do if(U){for(f=28372;;){if(A=d[f>>2]|0,p=d[f+4>>2]|0,(T|0)==(A+p|0)){Me=154;break}if(_=d[f+8>>2]|0,_)f=_;else break}if((Me|0)==154&&(Fe=f+4|0,(d[f+12>>2]&8|0)==0)&&T>>>0>U>>>0&A>>>0<=U>>>0){d[Fe>>2]=p+M,Ee=(d[6984]|0)+M|0,qe=U+8|0,qe=(qe&7|0)==0?0:0-qe&7,Fe=U+qe|0,qe=Ee-qe|0,d[6987]=Fe,d[6984]=qe,d[Fe+4>>2]=qe|1,d[U+Ee+4>>2]=40,d[6988]=d[7103];break}for(T>>>0<(d[6985]|0)>>>0&&(d[6985]=T),p=T+M|0,f=28372;;){if((d[f>>2]|0)==(p|0)){Me=162;break}if(A=d[f+8>>2]|0,A)f=A;else break}if((Me|0)==162&&(d[f+12>>2]&8|0)==0){d[f>>2]=T,q=f+4|0,d[q>>2]=(d[q>>2]|0)+M,q=T+8|0,q=T+((q&7|0)==0?0:0-q&7)|0,f=p+8|0,f=p+((f&7|0)==0?0:0-f&7)|0,I=q+ie|0,N=f-q-ie|0,d[q+4>>2]=ie|3;t:do if((U|0)==(f|0))Ee=(d[6984]|0)+N|0,d[6984]=Ee,d[6987]=I,d[I+4>>2]=Ee|1;else{if((d[6986]|0)==(f|0)){Ee=(d[6983]|0)+N|0,d[6983]=Ee,d[6986]=I,d[I+4>>2]=Ee|1,d[I+Ee>>2]=Ee;break}if(A=d[f+4>>2]|0,(A&3|0)==1){M=A&-8,_=A>>>3;n:do if(A>>>0<256)if(A=d[f+8>>2]|0,p=d[f+12>>2]|0,(p|0)==(A|0)){d[6981]=d[6981]&~(1<<_);break}else{d[A+12>>2]=p,d[p+8>>2]=A;break}else{T=d[f+24>>2]|0,A=d[f+12>>2]|0;do if((A|0)==(f|0)){if(p=f+16|0,_=p+4|0,A=d[_>>2]|0,A)p=_;else if(A=d[p>>2]|0,!A){A=0;break}for(;;)if(y=A+20|0,_=d[y>>2]|0,_)A=_,p=y;else if(y=A+16|0,_=d[y>>2]|0,_)A=_,p=y;else break;d[p>>2]=0}else Ee=d[f+8>>2]|0,d[Ee+12>>2]=A,d[A+8>>2]=Ee;while(!1);if(!T)break;p=d[f+28>>2]|0,_=28228+(p<<2)|0;do if((d[_>>2]|0)!=(f|0)){if(Ee=T+16|0,d[((d[Ee>>2]|0)==(f|0)?Ee:T+20|0)>>2]=A,!A)break n}else{if(d[_>>2]=A,A|0)break;d[6982]=d[6982]&~(1<>2]=T,p=f+16|0,_=d[p>>2]|0,_|0&&(d[A+16>>2]=_,d[_+24>>2]=A),p=d[p+4>>2]|0,!p)break;d[A+20>>2]=p,d[p+24>>2]=A}while(!1);f=f+M|0,y=M+N|0}else y=N;if(f=f+4|0,d[f>>2]=d[f>>2]&-2,d[I+4>>2]=y|1,d[I+y>>2]=y,f=y>>>3,y>>>0<256){p=27964+(f<<1<<2)|0,A=d[6981]|0,f=1<>2]|0):(d[6981]=A|f,f=p,A=p+8|0),d[A>>2]=I,d[f+12>>2]=I,d[I+8>>2]=f,d[I+12>>2]=p;break}f=y>>>8;do if(!f)_=0;else{if(y>>>0>16777215){_=31;break}Fe=(f+1048320|0)>>>16&8,Ee=f<>>16&4,Ee=Ee<>>16&2,_=14-(qe|Fe|_)+(Ee<<_>>>15)|0,_=y>>>(_+7|0)&1|_<<1}while(!1);if(f=28228+(_<<2)|0,d[I+28>>2]=_,A=I+16|0,d[A+4>>2]=0,d[A>>2]=0,A=d[6982]|0,p=1<<_,!(A&p)){d[6982]=A|p,d[f>>2]=I,d[I+24>>2]=f,d[I+12>>2]=I,d[I+8>>2]=I;break}f=d[f>>2]|0;n:do if((d[f+4>>2]&-8|0)!=(y|0)){for(_=y<<((_|0)==31?0:25-(_>>>1)|0);p=f+16+(_>>>31<<2)|0,A=d[p>>2]|0,!!A;)if((d[A+4>>2]&-8|0)==(y|0)){f=A;break n}else _=_<<1,f=A;d[p>>2]=I,d[I+24>>2]=f,d[I+12>>2]=I,d[I+8>>2]=I;break t}while(!1);Fe=f+8|0,Ee=d[Fe>>2]|0,d[Ee+12>>2]=I,d[Fe>>2]=I,d[I+8>>2]=Ee,d[I+12>>2]=f,d[I+24>>2]=0}while(!1);return Ee=q+8|0,Q=Pt,Ee|0}for(f=28372;A=d[f>>2]|0,!(A>>>0<=U>>>0&&(Ee=A+(d[f+4>>2]|0)|0,Ee>>>0>U>>>0));)f=d[f+8>>2]|0;y=Ee+-47|0,A=y+8|0,A=y+((A&7|0)==0?0:0-A&7)|0,y=U+16|0,A=A>>>0>>0?U:A,f=A+8|0,p=M+-40|0,qe=T+8|0,qe=(qe&7|0)==0?0:0-qe&7,Fe=T+qe|0,qe=p-qe|0,d[6987]=Fe,d[6984]=qe,d[Fe+4>>2]=qe|1,d[T+p+4>>2]=40,d[6988]=d[7103],p=A+4|0,d[p>>2]=27,d[f>>2]=d[7093],d[f+4>>2]=d[7094],d[f+8>>2]=d[7095],d[f+12>>2]=d[7096],d[7093]=T,d[7094]=M,d[7096]=0,d[7095]=f,f=A+24|0;do Fe=f,f=f+4|0,d[f>>2]=7;while((Fe+8|0)>>>0>>0);if((A|0)!=(U|0)){if(T=A-U|0,d[p>>2]=d[p>>2]&-2,d[U+4>>2]=T|1,d[A>>2]=T,f=T>>>3,T>>>0<256){p=27964+(f<<1<<2)|0,A=d[6981]|0,f=1<>2]|0):(d[6981]=A|f,f=p,A=p+8|0),d[A>>2]=U,d[f+12>>2]=U,d[U+8>>2]=f,d[U+12>>2]=p;break}if(f=T>>>8,f?T>>>0>16777215?_=31:(Fe=(f+1048320|0)>>>16&8,Ee=f<>>16&4,Ee=Ee<>>16&2,_=14-(qe|Fe|_)+(Ee<<_>>>15)|0,_=T>>>(_+7|0)&1|_<<1):_=0,p=28228+(_<<2)|0,d[U+28>>2]=_,d[U+20>>2]=0,d[y>>2]=0,f=d[6982]|0,A=1<<_,!(f&A)){d[6982]=f|A,d[p>>2]=U,d[U+24>>2]=p,d[U+12>>2]=U,d[U+8>>2]=U;break}f=d[p>>2]|0;t:do if((d[f+4>>2]&-8|0)!=(T|0)){for(_=T<<((_|0)==31?0:25-(_>>>1)|0);p=f+16+(_>>>31<<2)|0,A=d[p>>2]|0,!!A;)if((d[A+4>>2]&-8|0)==(T|0)){f=A;break t}else _=_<<1,f=A;d[p>>2]=U,d[U+24>>2]=f,d[U+12>>2]=U,d[U+8>>2]=U;break e}while(!1);Fe=f+8|0,Ee=d[Fe>>2]|0,d[Ee+12>>2]=U,d[Fe>>2]=U,d[U+8>>2]=Ee,d[U+12>>2]=f,d[U+24>>2]=0}}else Ee=d[6985]|0,(Ee|0)==0|T>>>0>>0&&(d[6985]=T),d[7093]=T,d[7094]=M,d[7096]=0,d[6990]=d[7099],d[6989]=-1,d[6994]=27964,d[6993]=27964,d[6996]=27972,d[6995]=27972,d[6998]=27980,d[6997]=27980,d[7e3]=27988,d[6999]=27988,d[7002]=27996,d[7001]=27996,d[7004]=28004,d[7003]=28004,d[7006]=28012,d[7005]=28012,d[7008]=28020,d[7007]=28020,d[7010]=28028,d[7009]=28028,d[7012]=28036,d[7011]=28036,d[7014]=28044,d[7013]=28044,d[7016]=28052,d[7015]=28052,d[7018]=28060,d[7017]=28060,d[7020]=28068,d[7019]=28068,d[7022]=28076,d[7021]=28076,d[7024]=28084,d[7023]=28084,d[7026]=28092,d[7025]=28092,d[7028]=28100,d[7027]=28100,d[7030]=28108,d[7029]=28108,d[7032]=28116,d[7031]=28116,d[7034]=28124,d[7033]=28124,d[7036]=28132,d[7035]=28132,d[7038]=28140,d[7037]=28140,d[7040]=28148,d[7039]=28148,d[7042]=28156,d[7041]=28156,d[7044]=28164,d[7043]=28164,d[7046]=28172,d[7045]=28172,d[7048]=28180,d[7047]=28180,d[7050]=28188,d[7049]=28188,d[7052]=28196,d[7051]=28196,d[7054]=28204,d[7053]=28204,d[7056]=28212,d[7055]=28212,Ee=M+-40|0,qe=T+8|0,qe=(qe&7|0)==0?0:0-qe&7,Fe=T+qe|0,qe=Ee-qe|0,d[6987]=Fe,d[6984]=qe,d[Fe+4>>2]=qe|1,d[T+Ee+4>>2]=40,d[6988]=d[7103];while(!1);if(f=d[6984]|0,f>>>0>ie>>>0)return qe=f-ie|0,d[6984]=qe,Ee=d[6987]|0,Fe=Ee+ie|0,d[6987]=Fe,d[Fe+4>>2]=qe|1,d[Ee+4>>2]=ie|3,Ee=Ee+8|0,Q=Pt,Ee|0}return Ee=HA()|0,d[Ee>>2]=12,Ee=0,Q=Pt,Ee|0}function An(A){A=A|0;var f=0,p=0,_=0,y=0,T=0,M=0,N=0,U=0;if(A){p=A+-8|0,y=d[6985]|0,A=d[A+-4>>2]|0,f=A&-8,U=p+f|0;do if(A&1)N=p,M=p;else{if(_=d[p>>2]|0,!(A&3)||(M=p+(0-_)|0,T=_+f|0,M>>>0>>0))return;if((d[6986]|0)==(M|0)){if(A=U+4|0,f=d[A>>2]|0,(f&3|0)!=3){N=M,f=T;break}d[6983]=T,d[A>>2]=f&-2,d[M+4>>2]=T|1,d[M+T>>2]=T;return}if(p=_>>>3,_>>>0<256)if(A=d[M+8>>2]|0,f=d[M+12>>2]|0,(f|0)==(A|0)){d[6981]=d[6981]&~(1<>2]=f,d[f+8>>2]=A,N=M,f=T;break}y=d[M+24>>2]|0,A=d[M+12>>2]|0;do if((A|0)==(M|0)){if(f=M+16|0,p=f+4|0,A=d[p>>2]|0,A)f=p;else if(A=d[f>>2]|0,!A){A=0;break}for(;;)if(_=A+20|0,p=d[_>>2]|0,p)A=p,f=_;else if(_=A+16|0,p=d[_>>2]|0,p)A=p,f=_;else break;d[f>>2]=0}else N=d[M+8>>2]|0,d[N+12>>2]=A,d[A+8>>2]=N;while(!1);if(y){if(f=d[M+28>>2]|0,p=28228+(f<<2)|0,(d[p>>2]|0)==(M|0)){if(d[p>>2]=A,!A){d[6982]=d[6982]&~(1<>2]|0)==(M|0)?N:y+20|0)>>2]=A,!A){N=M,f=T;break}d[A+24>>2]=y,f=M+16|0,p=d[f>>2]|0,p|0&&(d[A+16>>2]=p,d[p+24>>2]=A),f=d[f+4>>2]|0,f?(d[A+20>>2]=f,d[f+24>>2]=A,N=M,f=T):(N=M,f=T)}else N=M,f=T}while(!1);if(!(M>>>0>=U>>>0)&&(A=U+4|0,_=d[A>>2]|0,!!(_&1))){if(_&2)d[A>>2]=_&-2,d[N+4>>2]=f|1,d[M+f>>2]=f,y=f;else{if((d[6987]|0)==(U|0)){if(U=(d[6984]|0)+f|0,d[6984]=U,d[6987]=N,d[N+4>>2]=U|1,(N|0)!=(d[6986]|0))return;d[6986]=0,d[6983]=0;return}if((d[6986]|0)==(U|0)){U=(d[6983]|0)+f|0,d[6983]=U,d[6986]=M,d[N+4>>2]=U|1,d[M+U>>2]=U;return}y=(_&-8)+f|0,p=_>>>3;do if(_>>>0<256)if(f=d[U+8>>2]|0,A=d[U+12>>2]|0,(A|0)==(f|0)){d[6981]=d[6981]&~(1<>2]=A,d[A+8>>2]=f;break}else{T=d[U+24>>2]|0,A=d[U+12>>2]|0;do if((A|0)==(U|0)){if(f=U+16|0,p=f+4|0,A=d[p>>2]|0,A)f=p;else if(A=d[f>>2]|0,!A){p=0;break}for(;;)if(_=A+20|0,p=d[_>>2]|0,p)A=p,f=_;else if(_=A+16|0,p=d[_>>2]|0,p)A=p,f=_;else break;d[f>>2]=0,p=A}else p=d[U+8>>2]|0,d[p+12>>2]=A,d[A+8>>2]=p,p=A;while(!1);if(T|0){if(A=d[U+28>>2]|0,f=28228+(A<<2)|0,(d[f>>2]|0)==(U|0)){if(d[f>>2]=p,!p){d[6982]=d[6982]&~(1<>2]|0)==(U|0)?_:T+20|0)>>2]=p,!p)break;d[p+24>>2]=T,A=U+16|0,f=d[A>>2]|0,f|0&&(d[p+16>>2]=f,d[f+24>>2]=p),A=d[A+4>>2]|0,A|0&&(d[p+20>>2]=A,d[A+24>>2]=p)}}while(!1);if(d[N+4>>2]=y|1,d[M+y>>2]=y,(N|0)==(d[6986]|0)){d[6983]=y;return}}if(A=y>>>3,y>>>0<256){p=27964+(A<<1<<2)|0,f=d[6981]|0,A=1<>2]|0):(d[6981]=f|A,A=p,f=p+8|0),d[f>>2]=N,d[A+12>>2]=N,d[N+8>>2]=A,d[N+12>>2]=p;return}A=y>>>8,A?y>>>0>16777215?_=31:(M=(A+1048320|0)>>>16&8,U=A<>>16&4,U=U<>>16&2,_=14-(T|M|_)+(U<<_>>>15)|0,_=y>>>(_+7|0)&1|_<<1):_=0,A=28228+(_<<2)|0,d[N+28>>2]=_,d[N+20>>2]=0,d[N+16>>2]=0,f=d[6982]|0,p=1<<_;e:do if(!(f&p))d[6982]=f|p,d[A>>2]=N,d[N+24>>2]=A,d[N+12>>2]=N,d[N+8>>2]=N;else{A=d[A>>2]|0;t:do if((d[A+4>>2]&-8|0)!=(y|0)){for(_=y<<((_|0)==31?0:25-(_>>>1)|0);p=A+16+(_>>>31<<2)|0,f=d[p>>2]|0,!!f;)if((d[f+4>>2]&-8|0)==(y|0)){A=f;break t}else _=_<<1,A=f;d[p>>2]=N,d[N+24>>2]=A,d[N+12>>2]=N,d[N+8>>2]=N;break e}while(!1);M=A+8|0,U=d[M>>2]|0,d[U+12>>2]=N,d[M>>2]=N,d[N+8>>2]=U,d[N+12>>2]=A,d[N+24>>2]=0}while(!1);if(U=(d[6989]|0)+-1|0,d[6989]=U,!(U|0)){for(A=28380;A=d[A>>2]|0,A;)A=A+8|0;d[6989]=-1}}}}function Ks(A,f){A=A|0,f=f|0;var p=0;return A?(p=Xe(f,A)|0,(f|A)>>>0>65535&&(p=((p>>>0)/(A>>>0)|0|0)==(f|0)?p:-1)):p=0,A=Fo(p)|0,!A||!(d[A+-4>>2]&3)||uo(A|0,0,p|0)|0,A|0}function Xt(A,f,p,_){return A=A|0,f=f|0,p=p|0,_=_|0,p=A+p>>>0,At(f+_+(p>>>0>>0|0)>>>0|0),p|0|0}function Ur(A,f,p,_){return A=A|0,f=f|0,p=p|0,_=_|0,_=f-_-(p>>>0>A>>>0|0)>>>0,At(_|0),A-p>>>0|0|0}function Jc(A){return A=A|0,(A?31-(qt(A^A-1)|0)|0:32)|0}function Ju(A,f,p,_,y){A=A|0,f=f|0,p=p|0,_=_|0,y=y|0;var T=0,M=0,N=0,U=0,I=0,q=0,ie=0,de=0,Ae=0,pe=0;if(q=A,U=f,I=U,M=p,de=_,N=de,!I)return T=(y|0)!=0,N?T?(d[y>>2]=A|0,d[y+4>>2]=f&0,de=0,y=0,At(de|0),y|0):(de=0,y=0,At(de|0),y|0):(T&&(d[y>>2]=(q>>>0)%(M>>>0),d[y+4>>2]=0),de=0,y=(q>>>0)/(M>>>0)>>>0,At(de|0),y|0);T=(N|0)==0;do if(M){if(!T){if(T=(qt(N|0)|0)-(qt(I|0)|0)|0,T>>>0<=31){ie=T+1|0,N=31-T|0,f=T-31>>31,M=ie,A=q>>>(ie>>>0)&f|I<>>(ie>>>0)&f,T=0,N=q<>2]=A|0,d[y+4>>2]=U|f&0,de=0,y=0,At(de|0),y|0):(de=0,y=0,At(de|0),y|0)}if(T=M-1|0,T&M|0){N=(qt(M|0)|0)+33-(qt(I|0)|0)|0,pe=64-N|0,ie=32-N|0,U=ie>>31,Ae=N-32|0,f=Ae>>31,M=N,A=ie-1>>31&I>>>(Ae>>>0)|(I<>>(N>>>0))&f,f=f&I>>>(N>>>0),T=q<>>(Ae>>>0))&U|q<>31;break}return y|0&&(d[y>>2]=T&q,d[y+4>>2]=0),(M|0)==1?(Ae=U|f&0,pe=A|0|0,At(Ae|0),pe|0):(pe=Jc(M|0)|0,Ae=I>>>(pe>>>0)|0,pe=I<<32-pe|q>>>(pe>>>0)|0,At(Ae|0),pe|0)}else{if(T)return y|0&&(d[y>>2]=(I>>>0)%(M>>>0),d[y+4>>2]=0),Ae=0,pe=(I>>>0)/(M>>>0)>>>0,At(Ae|0),pe|0;if(!q)return y|0&&(d[y>>2]=0,d[y+4>>2]=(I>>>0)%(N>>>0)),Ae=0,pe=(I>>>0)/(N>>>0)>>>0,At(Ae|0),pe|0;if(T=N-1|0,!(T&N))return y|0&&(d[y>>2]=A|0,d[y+4>>2]=T&I|f&0),Ae=0,pe=I>>>((Jc(N|0)|0)>>>0),At(Ae|0),pe|0;if(T=(qt(N|0)|0)-(qt(I|0)|0)|0,T>>>0<=30){f=T+1|0,N=31-T|0,M=f,A=I<>>(f>>>0),f=I>>>(f>>>0),T=0,N=q<>2]=A|0,d[y+4>>2]=U|f&0,Ae=0,pe=0,At(Ae|0),pe|0):(Ae=0,pe=0,At(Ae|0),pe|0)}while(!1);if(!M)I=N,U=0,N=0;else{ie=p|0|0,q=de|_&0,I=Xt(ie|0,q|0,-1,-1)|0,p=K()|0,U=N,N=0;do _=U,U=T>>>31|U<<1,T=N|T<<1,_=A<<1|_>>>31|0,de=A>>>31|f<<1|0,Ur(I|0,p|0,_|0,de|0)|0,pe=K()|0,Ae=pe>>31|((pe|0)<0?-1:0)<<1,N=Ae&1,A=Ur(_|0,de|0,Ae&ie|0,(((pe|0)<0?-1:0)>>31|((pe|0)<0?-1:0)<<1)&q|0)|0,f=K()|0,M=M-1|0;while((M|0)!=0);I=U,U=0}return M=0,y|0&&(d[y>>2]=A,d[y+4>>2]=f),Ae=(T|0)>>>31|(I|M)<<1|(M<<1|T>>>31)&0|U,pe=(T<<1|0)&-2|N,At(Ae|0),pe|0}function ko(A,f,p,_){A=A|0,f=f|0,p=p|0,_=_|0;var y=0,T=0,M=0,N=0,U=0,I=0;return I=f>>31|((f|0)<0?-1:0)<<1,U=((f|0)<0?-1:0)>>31|((f|0)<0?-1:0)<<1,T=_>>31|((_|0)<0?-1:0)<<1,y=((_|0)<0?-1:0)>>31|((_|0)<0?-1:0)<<1,N=Ur(I^A|0,U^f|0,I|0,U|0)|0,M=K()|0,A=T^I,f=y^U,Ur((Ju(N,M,Ur(T^p|0,y^_|0,T|0,y|0)|0,K()|0,0)|0)^A|0,(K()|0)^f|0,A|0,f|0)|0}function eh(A,f){A=A|0,f=f|0;var p=0,_=0,y=0,T=0;return T=A&65535,y=f&65535,p=Xe(y,T)|0,_=A>>>16,A=(p>>>16)+(Xe(y,_)|0)|0,y=f>>>16,f=Xe(y,T)|0,At((A>>>16)+(Xe(y,_)|0)+(((A&65535)+f|0)>>>16)|0),A+f<<16|p&65535|0|0}function fr(A,f,p,_){A=A|0,f=f|0,p=p|0,_=_|0;var y=0,T=0;return y=A,T=p,p=eh(y,T)|0,A=K()|0,At((Xe(f,T)|0)+(Xe(_,y)|0)+A|A&0|0),p|0|0|0}function th(A,f,p,_){A=A|0,f=f|0,p=p|0,_=_|0;var y=0,T=0,M=0,N=0,U=0,I=0;return y=Q,Q=Q+16|0,N=y|0,M=f>>31|((f|0)<0?-1:0)<<1,T=((f|0)<0?-1:0)>>31|((f|0)<0?-1:0)<<1,I=_>>31|((_|0)<0?-1:0)<<1,U=((_|0)<0?-1:0)>>31|((_|0)<0?-1:0)<<1,A=Ur(M^A|0,T^f|0,M|0,T|0)|0,f=K()|0,Ju(A,f,Ur(I^p|0,U^_|0,I|0,U|0)|0,K()|0,N)|0,_=Ur(d[N>>2]^M|0,d[N+4>>2]^T|0,M|0,T|0)|0,p=K()|0,Q=y,At(p|0),_|0}function ec(A,f,p,_){A=A|0,f=f|0,p=p|0,_=_|0;var y=0,T=0;return T=Q,Q=Q+16|0,y=T|0,Ju(A,f,p,_,y)|0,Q=T,At(d[y+4>>2]|0),d[y>>2]|0|0}function N1(A,f,p){return A=A|0,f=f|0,p=p|0,(p|0)<32?(At(f>>p|0),A>>>p|(f&(1<>p-32|0)}function xt(A,f,p){return A=A|0,f=f|0,p=p|0,(p|0)<32?(At(f>>>p|0),A>>>p|(f&(1<>>p-32|0)}function Nt(A,f,p){return A=A|0,f=f|0,p=p|0,(p|0)<32?(At(f<>>32-p|0),A<=0?+Xn(A+.5):+Qe(A-.5)}function Gl(A,f,p){A=A|0,f=f|0,p=p|0;var _=0,y=0,T=0;if((p|0)>=8192)return ui(A|0,f|0,p|0)|0,A|0;if(T=A|0,y=A+p|0,(A&3)==(f&3)){for(;A&3;){if(!p)return T|0;at[A>>0]=at[f>>0]|0,A=A+1|0,f=f+1|0,p=p-1|0}for(p=y&-4|0,_=p-64|0;(A|0)<=(_|0);)d[A>>2]=d[f>>2],d[A+4>>2]=d[f+4>>2],d[A+8>>2]=d[f+8>>2],d[A+12>>2]=d[f+12>>2],d[A+16>>2]=d[f+16>>2],d[A+20>>2]=d[f+20>>2],d[A+24>>2]=d[f+24>>2],d[A+28>>2]=d[f+28>>2],d[A+32>>2]=d[f+32>>2],d[A+36>>2]=d[f+36>>2],d[A+40>>2]=d[f+40>>2],d[A+44>>2]=d[f+44>>2],d[A+48>>2]=d[f+48>>2],d[A+52>>2]=d[f+52>>2],d[A+56>>2]=d[f+56>>2],d[A+60>>2]=d[f+60>>2],A=A+64|0,f=f+64|0;for(;(A|0)<(p|0);)d[A>>2]=d[f>>2],A=A+4|0,f=f+4|0}else for(p=y-4|0;(A|0)<(p|0);)at[A>>0]=at[f>>0]|0,at[A+1>>0]=at[f+1>>0]|0,at[A+2>>0]=at[f+2>>0]|0,at[A+3>>0]=at[f+3>>0]|0,A=A+4|0,f=f+4|0;for(;(A|0)<(y|0);)at[A>>0]=at[f>>0]|0,A=A+1|0,f=f+1|0;return T|0}function uo(A,f,p){A=A|0,f=f|0,p=p|0;var _=0,y=0,T=0,M=0;if(T=A+p|0,f=f&255,(p|0)>=67){for(;A&3;)at[A>>0]=f,A=A+1|0;for(_=T&-4|0,M=f|f<<8|f<<16|f<<24,y=_-64|0;(A|0)<=(y|0);)d[A>>2]=M,d[A+4>>2]=M,d[A+8>>2]=M,d[A+12>>2]=M,d[A+16>>2]=M,d[A+20>>2]=M,d[A+24>>2]=M,d[A+28>>2]=M,d[A+32>>2]=M,d[A+36>>2]=M,d[A+40>>2]=M,d[A+44>>2]=M,d[A+48>>2]=M,d[A+52>>2]=M,d[A+56>>2]=M,d[A+60>>2]=M,A=A+64|0;for(;(A|0)<(_|0);)d[A>>2]=M,A=A+4|0}for(;(A|0)<(T|0);)at[A>>0]=f,A=A+1|0;return T-p|0}function pf(A){return A=+A,A>=0?+Xn(A+.5):+Qe(A-.5)}function fl(A){A=A|0;var f=0,p=0,_=0;return _=fn()|0,p=d[Gn>>2]|0,f=p+A|0,(A|0)>0&(f|0)<(p|0)|(f|0)<0?(_i(f|0)|0,bn(12),-1):(f|0)>(_|0)&&!(ci(f|0)|0)?(bn(12),-1):(d[Gn>>2]=f,p|0)}return{___divdi3:ko,___muldi3:fr,___remdi3:th,___uremdi3:ec,_areNeighborCells:dx,_bitshift64Ashr:N1,_bitshift64Lshr:xt,_bitshift64Shl:Nt,_calloc:Ks,_cellAreaKm2:mp,_cellAreaM2:UA,_cellAreaRads2:Fl,_cellToBoundary:Il,_cellToCenterChild:DA,_cellToChildPos:Ap,_cellToChildren:_1,_cellToChildrenSize:lf,_cellToLatLng:Ol,_cellToLocalIj:E1,_cellToParent:Fu,_cellToVertex:Qs,_cellToVertexes:Qu,_cellsToDirectedEdge:d1,_cellsToLinkedMultiPolygon:nl,_childPosToCell:S1,_compactCells:up,_constructCell:Sx,_destroyLinkedMultiPolygon:Wu,_directedEdgeToBoundary:CA,_directedEdgeToCells:gx,_edgeLengthKm:gp,_edgeLengthM:ju,_edgeLengthRads:BA,_emscripten_replace_memory:Ln,_free:An,_getBaseCellNumber:g1,_getDirectedEdgeDestination:mx,_getDirectedEdgeOrigin:px,_getHexagonAreaAvgKm2:dp,_getHexagonAreaAvgM2:w1,_getHexagonEdgeLengthAvgKm:pp,_getHexagonEdgeLengthAvgM:oo,_getIcosahedronFaces:Gu,_getIndexDigit:bx,_getNumCells:Hu,_getPentagons:qu,_getRes0Cells:ef,_getResolution:Qc,_greatCircleDistanceKm:Zc,_greatCircleDistanceM:Mx,_greatCircleDistanceRads:T1,_gridDisk:ve,_gridDiskDistances:ot,_gridDistance:$u,_gridPathCells:C1,_gridPathCellsSize:vp,_gridRing:Yn,_gridRingUnsafe:yi,_i64Add:Xt,_i64Subtract:Ur,_isPentagon:Ci,_isResClassIII:b1,_isValidCell:NA,_isValidDirectedEdge:p1,_isValidIndex:v1,_isValidVertex:ul,_latLngToCell:PA,_llvm_ctlz_i64:ff,_llvm_maxnum_f64:Af,_llvm_minnum_f64:df,_llvm_round_f64:hl,_localIjToCell:IA,_malloc:Fo,_maxFaceCount:wx,_maxGridDiskSize:fa,_maxPolygonToCellsSize:Pr,_maxPolygonToCellsSizeExperimental:cf,_memcpy:Gl,_memset:uo,_originToDirectedEdges:vx,_pentagonCount:fp,_polygonToCells:Zh,_polygonToCellsExperimental:kA,_readInt64AsDoubleFromPointer:yp,_res0CellCount:s1,_round:pf,_sbrk:fl,_sizeOfCellBoundary:fs,_sizeOfCoordIJ:Pa,_sizeOfGeoLoop:sr,_sizeOfGeoPolygon:mi,_sizeOfH3Index:_p,_sizeOfLatLng:R1,_sizeOfLinkedGeoPolygon:kl,_uncompactCells:y1,_uncompactCellsSize:x1,_vertexToLatLng:ll,establishStackSpace:bs,stackAlloc:mn,stackRestore:hi,stackSave:yr}})(In,Mi,X);e.___divdi3=me.___divdi3,e.___muldi3=me.___muldi3,e.___remdi3=me.___remdi3,e.___uremdi3=me.___uremdi3,e._areNeighborCells=me._areNeighborCells,e._bitshift64Ashr=me._bitshift64Ashr,e._bitshift64Lshr=me._bitshift64Lshr,e._bitshift64Shl=me._bitshift64Shl,e._calloc=me._calloc,e._cellAreaKm2=me._cellAreaKm2,e._cellAreaM2=me._cellAreaM2,e._cellAreaRads2=me._cellAreaRads2,e._cellToBoundary=me._cellToBoundary,e._cellToCenterChild=me._cellToCenterChild,e._cellToChildPos=me._cellToChildPos,e._cellToChildren=me._cellToChildren,e._cellToChildrenSize=me._cellToChildrenSize,e._cellToLatLng=me._cellToLatLng,e._cellToLocalIj=me._cellToLocalIj,e._cellToParent=me._cellToParent,e._cellToVertex=me._cellToVertex,e._cellToVertexes=me._cellToVertexes,e._cellsToDirectedEdge=me._cellsToDirectedEdge,e._cellsToLinkedMultiPolygon=me._cellsToLinkedMultiPolygon,e._childPosToCell=me._childPosToCell,e._compactCells=me._compactCells,e._constructCell=me._constructCell,e._destroyLinkedMultiPolygon=me._destroyLinkedMultiPolygon,e._directedEdgeToBoundary=me._directedEdgeToBoundary,e._directedEdgeToCells=me._directedEdgeToCells,e._edgeLengthKm=me._edgeLengthKm,e._edgeLengthM=me._edgeLengthM,e._edgeLengthRads=me._edgeLengthRads;var jt=e._emscripten_replace_memory=me._emscripten_replace_memory;e._free=me._free,e._getBaseCellNumber=me._getBaseCellNumber,e._getDirectedEdgeDestination=me._getDirectedEdgeDestination,e._getDirectedEdgeOrigin=me._getDirectedEdgeOrigin,e._getHexagonAreaAvgKm2=me._getHexagonAreaAvgKm2,e._getHexagonAreaAvgM2=me._getHexagonAreaAvgM2,e._getHexagonEdgeLengthAvgKm=me._getHexagonEdgeLengthAvgKm,e._getHexagonEdgeLengthAvgM=me._getHexagonEdgeLengthAvgM,e._getIcosahedronFaces=me._getIcosahedronFaces,e._getIndexDigit=me._getIndexDigit,e._getNumCells=me._getNumCells,e._getPentagons=me._getPentagons,e._getRes0Cells=me._getRes0Cells,e._getResolution=me._getResolution,e._greatCircleDistanceKm=me._greatCircleDistanceKm,e._greatCircleDistanceM=me._greatCircleDistanceM,e._greatCircleDistanceRads=me._greatCircleDistanceRads,e._gridDisk=me._gridDisk,e._gridDiskDistances=me._gridDiskDistances,e._gridDistance=me._gridDistance,e._gridPathCells=me._gridPathCells,e._gridPathCellsSize=me._gridPathCellsSize,e._gridRing=me._gridRing,e._gridRingUnsafe=me._gridRingUnsafe,e._i64Add=me._i64Add,e._i64Subtract=me._i64Subtract,e._isPentagon=me._isPentagon,e._isResClassIII=me._isResClassIII,e._isValidCell=me._isValidCell,e._isValidDirectedEdge=me._isValidDirectedEdge,e._isValidIndex=me._isValidIndex,e._isValidVertex=me._isValidVertex,e._latLngToCell=me._latLngToCell,e._llvm_ctlz_i64=me._llvm_ctlz_i64,e._llvm_maxnum_f64=me._llvm_maxnum_f64,e._llvm_minnum_f64=me._llvm_minnum_f64,e._llvm_round_f64=me._llvm_round_f64,e._localIjToCell=me._localIjToCell,e._malloc=me._malloc,e._maxFaceCount=me._maxFaceCount,e._maxGridDiskSize=me._maxGridDiskSize,e._maxPolygonToCellsSize=me._maxPolygonToCellsSize,e._maxPolygonToCellsSizeExperimental=me._maxPolygonToCellsSizeExperimental,e._memcpy=me._memcpy,e._memset=me._memset,e._originToDirectedEdges=me._originToDirectedEdges,e._pentagonCount=me._pentagonCount,e._polygonToCells=me._polygonToCells,e._polygonToCellsExperimental=me._polygonToCellsExperimental,e._readInt64AsDoubleFromPointer=me._readInt64AsDoubleFromPointer,e._res0CellCount=me._res0CellCount,e._round=me._round,e._sbrk=me._sbrk,e._sizeOfCellBoundary=me._sizeOfCellBoundary,e._sizeOfCoordIJ=me._sizeOfCoordIJ,e._sizeOfGeoLoop=me._sizeOfGeoLoop,e._sizeOfGeoPolygon=me._sizeOfGeoPolygon,e._sizeOfH3Index=me._sizeOfH3Index,e._sizeOfLatLng=me._sizeOfLatLng,e._sizeOfLinkedGeoPolygon=me._sizeOfLinkedGeoPolygon,e._uncompactCells=me._uncompactCells,e._uncompactCellsSize=me._uncompactCellsSize,e._vertexToLatLng=me._vertexToLatLng,e.establishStackSpace=me.establishStackSpace;var rt=e.stackAlloc=me.stackAlloc,yt=e.stackRestore=me.stackRestore,$t=e.stackSave=me.stackSave;if(e.asm=me,e.cwrap=L,e.setValue=S,e.getValue=w,fe){Ce(fe)||(fe=s(fe));{en();var kt=function(Ze){Ze.byteLength&&(Ze=new Uint8Array(Ze)),te.set(Ze,x),e.memoryInitializerRequest&&delete e.memoryInitializerRequest.response,St()},xn=function(){a(fe,kt,function(){throw"could not load memory initializer "+fe})},qi=Gt(fe);if(qi)kt(qi.buffer);else if(e.memoryInitializerRequest){var rr=function(){var Ze=e.memoryInitializerRequest,mt=Ze.response;if(Ze.status!==200&&Ze.status!==0){var It=Gt(e.memoryInitializerRequestURL);if(It)mt=It.buffer;else{console.warn("a problem seems to have happened with Module.memoryInitializerRequest, status: "+Ze.status+", retrying "+fe),xn();return}}kt(mt)};e.memoryInitializerRequest.response?setTimeout(rr,0):e.memoryInitializerRequest.addEventListener("load",rr)}else xn()}}var pn;ut=function Ze(){pn||$i(),pn||(ut=Ze)};function $i(Ze){if(Dt>0||(De(),Dt>0))return;function mt(){pn||(pn=!0,!R&&(pt(),_t(),e.onRuntimeInitialized&&e.onRuntimeInitialized(),wt()))}e.setStatus?(e.setStatus("Running..."),setTimeout(function(){setTimeout(function(){e.setStatus("")},1),mt()},1)):mt()}e.run=$i;function Jr(Ze){throw e.onAbort&&e.onAbort(Ze),Ze+="",l(Ze),u(Ze),R=!0,"abort("+Ze+"). Build with -s ASSERTIONS=1 for more info."}if(e.abort=Jr,e.preInit)for(typeof e.preInit=="function"&&(e.preInit=[e.preInit]);e.preInit.length>0;)e.preInit.pop()();return $i(),i})(typeof Si=="object"?Si:{}),Nn="number",Cn=Nn,Md=Nn,Bn=Nn,On=Nn,Cs=Nn,tn=Nn,ZK=[["sizeOfH3Index",Nn],["sizeOfLatLng",Nn],["sizeOfCellBoundary",Nn],["sizeOfGeoLoop",Nn],["sizeOfGeoPolygon",Nn],["sizeOfLinkedGeoPolygon",Nn],["sizeOfCoordIJ",Nn],["readInt64AsDoubleFromPointer",Nn],["isValidCell",Md,[Bn,On]],["isValidIndex",Md,[Bn,On]],["latLngToCell",Cn,[Nn,Nn,Cs,tn]],["cellToLatLng",Cn,[Bn,On,tn]],["cellToBoundary",Cn,[Bn,On,tn]],["maxGridDiskSize",Cn,[Nn,tn]],["gridDisk",Cn,[Bn,On,Nn,tn]],["gridDiskDistances",Cn,[Bn,On,Nn,tn,tn]],["gridRing",Cn,[Bn,On,Nn,tn]],["gridRingUnsafe",Cn,[Bn,On,Nn,tn]],["maxPolygonToCellsSize",Cn,[tn,Cs,Nn,tn]],["polygonToCells",Cn,[tn,Cs,Nn,tn]],["maxPolygonToCellsSizeExperimental",Cn,[tn,Cs,Nn,tn]],["polygonToCellsExperimental",Cn,[tn,Cs,Nn,Nn,Nn,tn]],["cellsToLinkedMultiPolygon",Cn,[tn,Nn,tn]],["destroyLinkedMultiPolygon",null,[tn]],["compactCells",Cn,[tn,tn,Nn,Nn]],["uncompactCells",Cn,[tn,Nn,Nn,tn,Nn,Cs]],["uncompactCellsSize",Cn,[tn,Nn,Nn,Cs,tn]],["isPentagon",Md,[Bn,On]],["isResClassIII",Md,[Bn,On]],["getBaseCellNumber",Nn,[Bn,On]],["getResolution",Nn,[Bn,On]],["getIndexDigit",Nn,[Bn,On,Nn]],["constructCell",Cn,[Nn,Nn,tn,tn]],["maxFaceCount",Cn,[Bn,On,tn]],["getIcosahedronFaces",Cn,[Bn,On,tn]],["cellToParent",Cn,[Bn,On,Cs,tn]],["cellToChildren",Cn,[Bn,On,Cs,tn]],["cellToCenterChild",Cn,[Bn,On,Cs,tn]],["cellToChildrenSize",Cn,[Bn,On,Cs,tn]],["cellToChildPos",Cn,[Bn,On,Cs,tn]],["childPosToCell",Cn,[Nn,Nn,Bn,On,Cs,tn]],["areNeighborCells",Cn,[Bn,On,Bn,On,tn]],["cellsToDirectedEdge",Cn,[Bn,On,Bn,On,tn]],["getDirectedEdgeOrigin",Cn,[Bn,On,tn]],["getDirectedEdgeDestination",Cn,[Bn,On,tn]],["isValidDirectedEdge",Md,[Bn,On]],["directedEdgeToCells",Cn,[Bn,On,tn]],["originToDirectedEdges",Cn,[Bn,On,tn]],["directedEdgeToBoundary",Cn,[Bn,On,tn]],["gridDistance",Cn,[Bn,On,Bn,On,tn]],["gridPathCells",Cn,[Bn,On,Bn,On,tn]],["gridPathCellsSize",Cn,[Bn,On,Bn,On,tn]],["cellToLocalIj",Cn,[Bn,On,Bn,On,Nn,tn]],["localIjToCell",Cn,[Bn,On,tn,Nn,tn]],["getHexagonAreaAvgM2",Cn,[Cs,tn]],["getHexagonAreaAvgKm2",Cn,[Cs,tn]],["getHexagonEdgeLengthAvgM",Cn,[Cs,tn]],["getHexagonEdgeLengthAvgKm",Cn,[Cs,tn]],["greatCircleDistanceM",Nn,[tn,tn]],["greatCircleDistanceKm",Nn,[tn,tn]],["greatCircleDistanceRads",Nn,[tn,tn]],["cellAreaM2",Cn,[Bn,On,tn]],["cellAreaKm2",Cn,[Bn,On,tn]],["cellAreaRads2",Cn,[Bn,On,tn]],["edgeLengthM",Cn,[Bn,On,tn]],["edgeLengthKm",Cn,[Bn,On,tn]],["edgeLengthRads",Cn,[Bn,On,tn]],["getNumCells",Cn,[Cs,tn]],["getRes0Cells",Cn,[tn]],["res0CellCount",Nn],["getPentagons",Cn,[Nn,tn]],["pentagonCount",Nn],["cellToVertex",Cn,[Bn,On,Nn,tn]],["cellToVertexes",Cn,[Bn,On,tn]],["vertexToLatLng",Cn,[Bn,On,tn]],["isValidVertex",Md,[Bn,On]]],JK=0,eZ=1,tZ=2,nZ=3,_P=4,iZ=5,rZ=6,sZ=7,aZ=8,oZ=9,lZ=10,uZ=11,cZ=12,hZ=13,fZ=14,AZ=15,dZ=16,pZ=17,mZ=18,gZ=19,Kr={};Kr[JK]="Success";Kr[eZ]="The operation failed but a more specific error is not available";Kr[tZ]="Argument was outside of acceptable range";Kr[nZ]="Latitude or longitude arguments were outside of acceptable range";Kr[_P]="Resolution argument was outside of acceptable range";Kr[iZ]="Cell argument was not valid";Kr[rZ]="Directed edge argument was not valid";Kr[sZ]="Undirected edge argument was not valid";Kr[aZ]="Vertex argument was not valid";Kr[oZ]="Pentagon distortion was encountered";Kr[lZ]="Duplicate input";Kr[uZ]="Cell arguments were not neighbors";Kr[cZ]="Cell arguments had incompatible resolutions";Kr[hZ]="Memory allocation failed";Kr[fZ]="Bounds of provided memory were insufficient";Kr[AZ]="Mode or flags argument was not valid";Kr[dZ]="Index argument was not valid";Kr[pZ]="Base cell number was outside of acceptable range";Kr[mZ]="Child indexing digits invalid";Kr[gZ]="Child indexing digits refer to a deleted subsequence";var vZ=1e3,yP=1001,xP=1002,Ry={};Ry[vZ]="Unknown unit";Ry[yP]="Array length out of bounds";Ry[xP]="Got unexpected null value for H3 index";var _Z="Unknown error";function bP(i,e,t){var n=t&&"value"in t,r=new Error((i[e]||_Z)+" (code: "+e+(n?", value: "+t.value:"")+")");return r.code=e,r}function SP(i,e){var t=arguments.length===2?{value:e}:{};return bP(Kr,i,t)}function TP(i,e){var t=arguments.length===2?{value:e}:{};return bP(Ry,i,t)}function vg(i){if(i!==0)throw SP(i)}var eo={};ZK.forEach(function(e){eo[e[0]]=Si.cwrap.apply(Si,e)});var Xd=16,_g=4,U0=8,yZ=8,j_=eo.sizeOfH3Index(),wM=eo.sizeOfLatLng(),xZ=eo.sizeOfCellBoundary(),bZ=eo.sizeOfGeoPolygon(),Lm=eo.sizeOfGeoLoop();eo.sizeOfLinkedGeoPolygon();eo.sizeOfCoordIJ();function SZ(i){if(typeof i!="number"||i<0||i>15||Math.floor(i)!==i)throw SP(_P,i);return i}function TZ(i){if(!i)throw TP(xP);return i}var wZ=Math.pow(2,32)-1;function MZ(i){if(i>wZ)throw TP(yP,i);return i}var EZ=/[^0-9a-fA-F]/;function wP(i){if(Array.isArray(i)&&i.length===2&&Number.isInteger(i[0])&&Number.isInteger(i[1]))return i;if(typeof i!="string"||EZ.test(i))return[0,0];var e=parseInt(i.substring(0,i.length-8),Xd),t=parseInt(i.substring(i.length-8),Xd);return[t,e]}function MR(i){if(i>=0)return i.toString(Xd);i=i&2147483647;var e=MP(8,i.toString(Xd)),t=(parseInt(e[0],Xd)+8).toString(Xd);return e=t+e.substring(1),e}function CZ(i,e){return MR(e)+MP(8,MR(i))}function MP(i,e){for(var t=i-e.length,n="",r=0;r0){l=Si._calloc(t,Lm);for(var u=0;u0){for(var a=Si.getValue(i+n,"i32"),l=0;l0){const{width:a,height:l}=e.context;t.bufferWidth=a,t.bufferHeight=l}this.renderObjects.set(e,t)}return t}getAttributesData(e){const t={};for(const n in e){const r=e[n];t[n]={version:r.version}}return t}containsNode(e){const t=e.material;for(const n in t)if(t[n]&&t[n].isNode)return!0;return e.renderer.nodes.modelViewMatrix!==null||e.renderer.nodes.modelNormalViewMatrix!==null}getMaterialData(e){const t={};for(const n of this.refreshUniforms){const r=e[n];r!=null&&(typeof r=="object"&&r.clone!==void 0?r.isTexture===!0?t[n]={id:r.id,version:r.version}:t[n]=r.clone():t[n]=r)}return t}equals(e){const{object:t,material:n,geometry:r}=e,s=this.getRenderObjectData(e);if(s.worldMatrix.equals(t.matrixWorld)!==!0)return s.worldMatrix.copy(t.matrixWorld),!1;const a=s.material;for(const R in a){const C=a[R],E=n[R];if(C.equals!==void 0){if(C.equals(E)===!1)return C.copy(E),!1}else if(E.isTexture===!0){if(C.id!==E.id||C.version!==E.version)return C.id=E.id,C.version=E.version,!1}else if(C!==E)return a[R]=E,!1}if(a.transmission>0){const{width:R,height:C}=e.context;if(s.bufferWidth!==R||s.bufferHeight!==C)return s.bufferWidth=R,s.bufferHeight=C,!1}const l=s.geometry,u=r.attributes,h=l.attributes,g=Object.keys(h),v=Object.keys(u);if(g.length!==v.length)return s.geometry.attributes=this.getAttributesData(u),!1;for(const R of g){const C=h[R],E=u[R];if(E===void 0)return delete h[R],!1;if(C.version!==E.version)return C.version=E.version,!1}const x=r.index,S=l.indexVersion,w=x?x.version:null;if(S!==w)return l.indexVersion=w,!1;if(l.drawRange.start!==r.drawRange.start||l.drawRange.count!==r.drawRange.count)return l.drawRange.start=r.drawRange.start,l.drawRange.count=r.drawRange.count,!1;if(s.morphTargetInfluences){let R=!1;for(let C=0;C>>16,2246822507),t^=Math.imul(n^n>>>13,3266489909),n=Math.imul(n^n>>>16,2246822507),n^=Math.imul(t^t>>>13,3266489909),4294967296*(2097151&n)+(t>>>0)}const DP=i=>yg(i),Ny=i=>yg(i),MM=(...i)=>yg(i);function PP(i,e=!1){const t=[];i.isNode===!0&&(t.push(i.id),i=i.getSelf());for(const{property:n,childNode:r}of $_(i))t.push(t,yg(n.slice(0,-4)),r.getCacheKey(e));return yg(t)}function*$_(i,e=!1){for(const t in i){if(t.startsWith("_")===!0)continue;const n=i[t];if(Array.isArray(n)===!0)for(let r=0;re.charCodeAt(0)).buffer}const OT={VERTEX:"vertex",FRAGMENT:"fragment"},jn={NONE:"none",FRAME:"frame",RENDER:"render",OBJECT:"object"},qZ={BOOLEAN:"bool",INTEGER:"int",FLOAT:"float",VECTOR2:"vec2",VECTOR3:"vec3",VECTOR4:"vec4",MATRIX2:"mat2",MATRIX3:"mat3",MATRIX4:"mat4"},sa={READ_ONLY:"readOnly",WRITE_ONLY:"writeOnly",READ_WRITE:"readWrite"},zP=["fragment","vertex"],IT=["setup","analyze","generate"],FT=[...zP,"compute"],gA=["x","y","z","w"];let VZ=0;class Mn extends zc{static get type(){return"Node"}constructor(e=null){super(),this.nodeType=e,this.updateType=jn.NONE,this.updateBeforeType=jn.NONE,this.updateAfterType=jn.NONE,this.uuid=M0.generateUUID(),this.version=0,this.global=!1,this.isNode=!0,this._cacheKey=null,this._cacheKeyVersion=0,Object.defineProperty(this,"id",{value:VZ++})}set needsUpdate(e){e===!0&&this.version++}get type(){return this.constructor.type}onUpdate(e,t){return this.updateType=t,this.update=e.bind(this.getSelf()),this}onFrameUpdate(e){return this.onUpdate(e,jn.FRAME)}onRenderUpdate(e){return this.onUpdate(e,jn.RENDER)}onObjectUpdate(e){return this.onUpdate(e,jn.OBJECT)}onReference(e){return this.updateReference=e.bind(this.getSelf()),this}getSelf(){return this.self||this}updateReference(){return this}isGlobal(){return this.global}*getChildren(){for(const{childNode:e}of $_(this))yield e}dispose(){this.dispatchEvent({type:"dispose"})}traverse(e){e(this);for(const t of this.getChildren())t.traverse(e)}getCacheKey(e=!1){return e=e||this.version!==this._cacheKeyVersion,(e===!0||this._cacheKey===null)&&(this._cacheKey=MM(PP(this,e),this.customCacheKey()),this._cacheKeyVersion=this.version),this._cacheKey}customCacheKey(){return 0}getScope(){return this}getHash(){return this.uuid}getUpdateType(){return this.updateType}getUpdateBeforeType(){return this.updateBeforeType}getUpdateAfterType(){return this.updateAfterType}getElementType(e){const t=this.getNodeType(e);return e.getElementType(t)}getNodeType(e){const t=e.getNodeProperties(this);return t.outputNode?t.outputNode.getNodeType(e):this.nodeType}getShared(e){const t=this.getHash(e);return e.getNodeFromHash(t)||this}setup(e){const t=e.getNodeProperties(this);let n=0;for(const r of this.getChildren())t["node"+n++]=r;return t.outputNode||null}analyze(e){if(e.increaseUsage(this)===1){const n=e.getNodeProperties(this);for(const r of Object.values(n))r&&r.isNode===!0&&r.build(e)}}generate(e,t){const{outputNode:n}=e.getNodeProperties(this);if(n&&n.isNode===!0)return n.build(e,t)}updateBefore(){console.warn("Abstract function.")}updateAfter(){console.warn("Abstract function.")}update(){console.warn("Abstract function.")}build(e,t=null){const n=this.getShared(e);if(this!==n)return n.build(e,t);e.addNode(this),e.addChain(this);let r=null;const s=e.getBuildStage();if(s==="setup"){this.updateReference(e);const a=e.getNodeProperties(this);if(a.initialized!==!0){a.initialized=!0;const l=this.setup(e),u=l&&l.isNode===!0;for(const h of Object.values(a))h&&h.isNode===!0&&h.build(e);u&&l.build(e),a.outputNode=l}}else if(s==="analyze")this.analyze(e);else if(s==="generate")if(this.generate.length===1){const l=this.getNodeType(e),u=e.getDataFromNode(this);r=u.snippet,r===void 0?(r=this.generate(e)||"",u.snippet=r):u.flowCodes!==void 0&&e.context.nodeBlock!==void 0&&e.addFlowCodeHierarchy(this,e.context.nodeBlock),r=e.format(r,l,t)}else r=this.generate(e,t)||"";return e.removeChain(this),e.addSequentialNode(this),r}getSerializeChildren(){return $_(this)}serialize(e){const t=this.getSerializeChildren(),n={};for(const{property:r,index:s,childNode:a}of t)s!==void 0?(n[r]===void 0&&(n[r]=Number.isInteger(s)?[]:{}),n[r][s]=a.toJSON(e.meta).uuid):n[r]=a.toJSON(e.meta).uuid;Object.keys(n).length>0&&(e.inputNodes=n)}deserialize(e){if(e.inputNodes!==void 0){const t=e.meta.nodes;for(const n in e.inputNodes)if(Array.isArray(e.inputNodes[n])){const r=[];for(const s of e.inputNodes[n])r.push(t[s]);this[n]=r}else if(typeof e.inputNodes[n]=="object"){const r={};for(const s in e.inputNodes[n]){const a=e.inputNodes[n][s];r[s]=t[a]}this[n]=r}else{const r=e.inputNodes[n];this[n]=t[r]}}}toJSON(e){const{uuid:t,type:n}=this,r=e===void 0||typeof e=="string";r&&(e={textures:{},images:{},nodes:{}});let s=e.nodes[t];s===void 0&&(s={uuid:t,type:n,meta:e,metadata:{version:4.6,type:"Node",generator:"Node.toJSON"}},r!==!0&&(e.nodes[s.uuid]=s),this.serialize(s),delete s.meta);function a(l){const u=[];for(const h in l){const g=l[h];delete g.metadata,u.push(g)}return u}if(r){const l=a(e.textures),u=a(e.images),h=a(e.nodes);l.length>0&&(s.textures=l),u.length>0&&(s.images=u),h.length>0&&(s.nodes=h)}return s}}class vA extends Mn{static get type(){return"ArrayElementNode"}constructor(e,t){super(),this.node=e,this.indexNode=t,this.isArrayElementNode=!0}getNodeType(e){return this.node.getElementType(e)}generate(e){const t=this.node.build(e),n=this.indexNode.build(e,"uint");return`${t}[ ${n} ]`}}class GP extends Mn{static get type(){return"ConvertNode"}constructor(e,t){super(),this.node=e,this.convertTo=t}getNodeType(e){const t=this.node.getNodeType(e);let n=null;for(const r of this.convertTo.split("|"))(n===null||e.getTypeLength(t)===e.getTypeLength(r))&&(n=r);return n}serialize(e){super.serialize(e),e.convertTo=this.convertTo}deserialize(e){super.deserialize(e),this.convertTo=e.convertTo}generate(e,t){const n=this.node,r=this.getNodeType(e),s=n.build(e,r);return e.format(s,r,t)}}class Zr extends Mn{static get type(){return"TempNode"}constructor(e=null){super(e),this.isTempNode=!0}hasDependencies(e){return e.getDataFromNode(this).usageCount>1}build(e,t){if(e.getBuildStage()==="generate"){const r=e.getVectorType(this.getNodeType(e,t)),s=e.getDataFromNode(this);if(s.propertyName!==void 0)return e.format(s.propertyName,r,t);if(r!=="void"&&t!=="void"&&this.hasDependencies(e)){const a=super.build(e,r),l=e.getVarFromNode(this,null,r),u=e.getPropertyName(l);return e.addLineFlowCode(`${u} = ${a}`,this),s.snippet=a,s.propertyName=u,e.format(s.propertyName,r,t)}}return super.build(e,t)}}class HZ extends Zr{static get type(){return"JoinNode"}constructor(e=[],t=null){super(t),this.nodes=e}getNodeType(e){return this.nodeType!==null?e.getVectorType(this.nodeType):e.getTypeFromLength(this.nodes.reduce((t,n)=>t+e.getTypeLength(n.getNodeType(e)),0))}generate(e,t){const n=this.getNodeType(e),r=this.nodes,s=e.getComponentType(n),a=[];for(const u of r){let h=u.build(e);const g=e.getComponentType(u.getNodeType(e));g!==s&&(h=e.format(h,g,s)),a.push(h)}const l=`${e.getType(n)}( ${a.join(", ")} )`;return e.format(l,n,t)}}const jZ=gA.join("");class kT extends Mn{static get type(){return"SplitNode"}constructor(e,t="x"){super(),this.node=e,this.components=t,this.isSplitNode=!0}getVectorLength(){let e=this.components.length;for(const t of this.components)e=Math.max(gA.indexOf(t)+1,e);return e}getComponentType(e){return e.getComponentType(this.node.getNodeType(e))}getNodeType(e){return e.getTypeFromLength(this.components.length,this.getComponentType(e))}generate(e,t){const n=this.node,r=e.getTypeLength(n.getNodeType(e));let s=null;if(r>1){let a=null;this.getVectorLength()>=r&&(a=e.getTypeFromLength(this.getVectorLength(),this.getComponentType(e)));const u=n.build(e,a);this.components.length===r&&this.components===jZ.slice(0,this.components.length)?s=e.format(u,a,t):s=e.format(`${u}.${this.components}`,this.getNodeType(e),t)}else s=n.build(e,t);return s}serialize(e){super.serialize(e),e.components=this.components}deserialize(e){super.deserialize(e),this.components=e.components}}class WZ extends Zr{static get type(){return"SetNode"}constructor(e,t,n){super(),this.sourceNode=e,this.components=t,this.targetNode=n}getNodeType(e){return this.sourceNode.getNodeType(e)}generate(e){const{sourceNode:t,components:n,targetNode:r}=this,s=this.getNodeType(e),a=e.getComponentType(r.getNodeType(e)),l=e.getTypeFromLength(n.length,a),u=r.build(e,l),h=t.build(e,s),g=e.getTypeLength(s),v=[];for(let x=0;xi.replace(/r|s/g,"x").replace(/g|t/g,"y").replace(/b|p/g,"z").replace(/a|q/g,"w"),NR=i=>qP(i).split("").sort().join(""),VP={setup(i,e){const t=e.shift();return i(Vg(t),...e)},get(i,e,t){if(typeof e=="string"&&i[e]===void 0){if(i.isStackNode!==!0&&e==="assign")return(...n)=>(B0.assign(t,...n),t);if(Yd.has(e)){const n=Yd.get(e);return i.isStackNode?(...r)=>t.add(n(...r)):(...r)=>n(t,...r)}else{if(e==="self")return i;if(e.endsWith("Assign")&&Yd.has(e.slice(0,e.length-6))){const n=Yd.get(e.slice(0,e.length-6));return i.isStackNode?(...r)=>t.assign(r[0],n(...r)):(...r)=>t.assign(n(t,...r))}else{if(/^[xyzwrgbastpq]{1,4}$/.test(e)===!0)return e=qP(e),mt(new kT(t,e));if(/^set[XYZWRGBASTPQ]{1,4}$/.test(e)===!0)return e=NR(e.slice(3).toLowerCase()),n=>mt(new WZ(i,e,n));if(/^flip[XYZWRGBASTPQ]{1,4}$/.test(e)===!0)return e=NR(e.slice(4).toLowerCase()),()=>mt(new $Z(mt(i),e));if(e==="width"||e==="height"||e==="depth")return e==="width"?e="x":e==="height"?e="y":e==="depth"&&(e="z"),mt(new kT(i,e));if(/^\d+$/.test(e)===!0)return mt(new vA(t,new Ll(Number(e),"uint")))}}}return Reflect.get(i,e,t)},set(i,e,t,n){return typeof e=="string"&&i[e]===void 0&&(/^[xyzwrgbastpq]{1,4}$/.test(e)===!0||e==="width"||e==="height"||e==="depth"||/^\d+$/.test(e)===!0)?(n[e].assign(t),!0):Reflect.set(i,e,t,n)}},W3=new WeakMap,DR=new WeakMap,XZ=function(i,e=null){const t=Uh(i);if(t==="node"){let n=W3.get(i);return n===void 0&&(n=new Proxy(i,VP),W3.set(i,n),W3.set(n,n)),n}else{if(e===null&&(t==="float"||t==="boolean")||t&&t!=="shader"&&t!=="string")return mt(zT(i,e));if(t==="shader")return je(i)}return i},YZ=function(i,e=null){for(const t in i)i[t]=mt(i[t],e);return i},QZ=function(i,e=null){const t=i.length;for(let n=0;nmt(n!==null?Object.assign(s,n):s);return e===null?(...s)=>r(new i(...tA(s))):t!==null?(t=mt(t),(...s)=>r(new i(e,...tA(s),t))):(...s)=>r(new i(e,...tA(s)))},ZZ=function(i,...e){return mt(new i(...tA(e)))};class JZ extends Mn{constructor(e,t){super(),this.shaderNode=e,this.inputNodes=t}getNodeType(e){return this.shaderNode.nodeType||this.getOutputNode(e).getNodeType(e)}call(e){const{shaderNode:t,inputNodes:n}=this,r=e.getNodeProperties(t);if(r.onceOutput)return r.onceOutput;let s=null;if(t.layout){let a=DR.get(e.constructor);a===void 0&&(a=new WeakMap,DR.set(e.constructor,a));let l=a.get(t);l===void 0&&(l=mt(e.buildFunctionNode(t)),a.set(t,l)),e.currentFunctionNode!==null&&e.currentFunctionNode.includes.push(l),s=mt(l.call(n))}else{const a=t.jsFunc,l=n!==null?a(n,e):a(e);s=mt(l)}return t.once&&(r.onceOutput=s),s}getOutputNode(e){const t=e.getNodeProperties(this);return t.outputNode===null&&(t.outputNode=this.setupOutput(e)),t.outputNode}setup(e){return this.getOutputNode(e)}setupOutput(e){return e.addStack(),e.stack.outputNode=this.call(e),e.removeStack()}generate(e,t){return this.getOutputNode(e).build(e,t)}}class eJ extends Mn{constructor(e,t){super(t),this.jsFunc=e,this.layout=null,this.global=!0,this.once=!1}setLayout(e){return this.layout=e,this}call(e=null){return Vg(e),mt(new JZ(this,e))}setup(){return this.call()}}const tJ=[!1,!0],nJ=[0,1,2,3],iJ=[-1,-2],HP=[.5,1.5,1/3,1e-6,1e6,Math.PI,Math.PI*2,1/Math.PI,2/Math.PI,1/(Math.PI*2),Math.PI/2],CM=new Map;for(const i of tJ)CM.set(i,new Ll(i));const RM=new Map;for(const i of nJ)RM.set(i,new Ll(i,"uint"));const NM=new Map([...RM].map(i=>new Ll(i.value,"int")));for(const i of iJ)NM.set(i,new Ll(i,"int"));const Dy=new Map([...NM].map(i=>new Ll(i.value)));for(const i of HP)Dy.set(i,new Ll(i));for(const i of HP)Dy.set(-i,new Ll(-i));const Py={bool:CM,uint:RM,ints:NM,float:Dy},PR=new Map([...CM,...Dy]),zT=(i,e)=>PR.has(i)?PR.get(i):i.isNode===!0?i:new Ll(i,e),rJ=i=>{try{return i.getNodeType()}catch{return}},ls=function(i,e=null){return(...t)=>{if((t.length===0||!["bool","float","int","uint"].includes(i)&&t.every(r=>typeof r!="object"))&&(t=[OP(i,...t)]),t.length===1&&e!==null&&e.has(t[0]))return mt(e.get(t[0]));if(t.length===1){const r=zT(t[0],i);return rJ(r)===i?mt(r):mt(new GP(r,i))}const n=t.map(r=>zT(r));return mt(new HZ(n,i))}},xg=i=>typeof i=="object"&&i!==null?i.value:i,jP=i=>i!=null?i.nodeType||i.convertTo||(typeof i=="string"?i:null):null;function Um(i,e){return new Proxy(new eJ(i,e),VP)}const mt=(i,e=null)=>XZ(i,e),Vg=(i,e=null)=>new YZ(i,e),tA=(i,e=null)=>new QZ(i,e),ct=(...i)=>new KZ(...i),zt=(...i)=>new ZZ(...i),je=(i,e)=>{const t=new Um(i,e),n=(...r)=>{let s;return Vg(r),r[0]&&r[0].isNode?s=[...r]:s=r[0],t.call(s)};return n.shaderNode=t,n.setLayout=r=>(t.setLayout(r),n),n.once=()=>(t.once=!0,n),n},sJ=(...i)=>(console.warn("TSL.ShaderNode: tslFn() has been renamed to Fn()."),je(...i));ut("toGlobal",i=>(i.global=!0,i));const bg=i=>{B0=i},DM=()=>B0,ti=(...i)=>B0.If(...i);function WP(i){return B0&&B0.add(i),i}ut("append",WP);const $P=new ls("color"),ge=new ls("float",Py.float),ye=new ls("int",Py.ints),Qt=new ls("uint",Py.uint),Ic=new ls("bool",Py.bool),Et=new ls("vec2"),ms=new ls("ivec2"),XP=new ls("uvec2"),YP=new ls("bvec2"),Ne=new ls("vec3"),QP=new ls("ivec3"),Y0=new ls("uvec3"),PM=new ls("bvec3"),dn=new ls("vec4"),KP=new ls("ivec4"),ZP=new ls("uvec4"),JP=new ls("bvec4"),Ly=new ls("mat2"),ha=new ls("mat3"),nA=new ls("mat4"),aJ=(i="")=>mt(new Ll(i,"string")),oJ=i=>mt(new Ll(i,"ArrayBuffer"));ut("toColor",$P);ut("toFloat",ge);ut("toInt",ye);ut("toUint",Qt);ut("toBool",Ic);ut("toVec2",Et);ut("toIVec2",ms);ut("toUVec2",XP);ut("toBVec2",YP);ut("toVec3",Ne);ut("toIVec3",QP);ut("toUVec3",Y0);ut("toBVec3",PM);ut("toVec4",dn);ut("toIVec4",KP);ut("toUVec4",ZP);ut("toBVec4",JP);ut("toMat2",Ly);ut("toMat3",ha);ut("toMat4",nA);const eL=ct(vA),tL=(i,e)=>mt(new GP(mt(i),e)),lJ=(i,e)=>mt(new kT(mt(i),e));ut("element",eL);ut("convert",tL);class nL extends Mn{static get type(){return"UniformGroupNode"}constructor(e,t=!1,n=1){super("string"),this.name=e,this.shared=t,this.order=n,this.isUniformGroup=!0}serialize(e){super.serialize(e),e.name=this.name,e.version=this.version,e.shared=this.shared}deserialize(e){super.deserialize(e),this.name=e.name,this.version=e.version,this.shared=e.shared}}const iL=i=>new nL(i),LM=(i,e=0)=>new nL(i,!0,e),rL=LM("frame"),Rn=LM("render"),UM=iL("object");class Hg extends EM{static get type(){return"UniformNode"}constructor(e,t=null){super(e,t),this.isUniformNode=!0,this.name="",this.groupNode=UM}label(e){return this.name=e,this}setGroup(e){return this.groupNode=e,this}getGroup(){return this.groupNode}getUniformHash(e){return this.getHash(e)}onUpdate(e,t){const n=this.getSelf();return e=e.bind(n),super.onUpdate(r=>{const s=e(r,n);s!==void 0&&(this.value=s)},t)}generate(e,t){const n=this.getNodeType(e),r=this.getUniformHash(e);let s=e.getNodeFromHash(r);s===void 0&&(e.setHashNode(this,r),s=this);const a=s.getInputType(e),l=e.getUniformFromNode(s,a,e.shaderStage,this.name||e.context.label),u=e.getPropertyName(l);return e.context.label!==void 0&&delete e.context.label,e.format(u,n,t)}}const gn=(i,e)=>{const t=jP(e||i),n=i&&i.isNode===!0?i.node&&i.node.value||i.value:i;return mt(new Hg(n,t))};class Gi extends Mn{static get type(){return"PropertyNode"}constructor(e,t=null,n=!1){super(e),this.name=t,this.varying=n,this.isPropertyNode=!0}getHash(e){return this.name||super.getHash(e)}isGlobal(){return!0}generate(e){let t;return this.varying===!0?(t=e.getVaryingFromNode(this,this.name),t.needsInterpolation=!0):t=e.getVarFromNode(this,this.name),e.getPropertyName(t)}}const sL=(i,e)=>mt(new Gi(i,e)),Sg=(i,e)=>mt(new Gi(i,e,!0)),Ui=zt(Gi,"vec4","DiffuseColor"),GT=zt(Gi,"vec3","EmissiveColor"),Zl=zt(Gi,"float","Roughness"),Tg=zt(Gi,"float","Metalness"),X_=zt(Gi,"float","Clearcoat"),wg=zt(Gi,"float","ClearcoatRoughness"),Xf=zt(Gi,"vec3","Sheen"),Uy=zt(Gi,"float","SheenRoughness"),By=zt(Gi,"float","Iridescence"),BM=zt(Gi,"float","IridescenceIOR"),OM=zt(Gi,"float","IridescenceThickness"),Y_=zt(Gi,"float","AlphaT"),Rh=zt(Gi,"float","Anisotropy"),Bm=zt(Gi,"vec3","AnisotropyT"),iA=zt(Gi,"vec3","AnisotropyB"),ka=zt(Gi,"color","SpecularColor"),Mg=zt(Gi,"float","SpecularF90"),Q_=zt(Gi,"float","Shininess"),Eg=zt(Gi,"vec4","Output"),Qv=zt(Gi,"float","dashSize"),qT=zt(Gi,"float","gapSize"),uJ=zt(Gi,"float","pointWidth"),Om=zt(Gi,"float","IOR"),K_=zt(Gi,"float","Transmission"),IM=zt(Gi,"float","Thickness"),FM=zt(Gi,"float","AttenuationDistance"),kM=zt(Gi,"color","AttenuationColor"),zM=zt(Gi,"float","Dispersion");class cJ extends Zr{static get type(){return"AssignNode"}constructor(e,t){super(),this.targetNode=e,this.sourceNode=t}hasDependencies(){return!1}getNodeType(e,t){return t!=="void"?this.targetNode.getNodeType(e):"void"}needsSplitAssign(e){const{targetNode:t}=this;if(e.isAvailable("swizzleAssign")===!1&&t.isSplitNode&&t.components.length>1){const n=e.getTypeLength(t.node.getNodeType(e));return gA.join("").slice(0,n)!==t.components}return!1}generate(e,t){const{targetNode:n,sourceNode:r}=this,s=this.needsSplitAssign(e),a=n.getNodeType(e),l=n.context({assign:!0}).build(e),u=r.build(e,a),h=r.getNodeType(e),g=e.getDataFromNode(this);let v;if(g.initialized===!0)t!=="void"&&(v=l);else if(s){const x=e.getVarFromNode(this,null,a),S=e.getPropertyName(x);e.addLineFlowCode(`${S} = ${u}`,this);const w=n.node.context({assign:!0}).build(e);for(let R=0;R{const g=h.type,v=g==="pointer";let x;return v?x="&"+u.build(e):x=u.build(e,g),x};if(Array.isArray(s))for(let u=0;u(e=e.length>1||e[0]&&e[0].isNode===!0?tA(e):Vg(e[0]),mt(new hJ(mt(i),e)));ut("call",oL);class Mr extends Zr{static get type(){return"OperatorNode"}constructor(e,t,n,...r){if(super(),r.length>0){let s=new Mr(e,t,n);for(let a=0;a>"||n==="<<")return e.getIntegerType(a);if(n==="!"||n==="=="||n==="&&"||n==="||"||n==="^^")return"bool";if(n==="<"||n===">"||n==="<="||n===">="){const u=t?e.getTypeLength(t):Math.max(e.getTypeLength(a),e.getTypeLength(l));return u>1?`bvec${u}`:"bool"}else return a==="float"&&e.isMatrix(l)?l:e.isMatrix(a)&&e.isVector(l)?e.getVectorFromMatrix(a):e.isVector(a)&&e.isMatrix(l)?e.getVectorFromMatrix(l):e.getTypeLength(l)>e.getTypeLength(a)?l:a}generate(e,t){const n=this.op,r=this.aNode,s=this.bNode,a=this.getNodeType(e,t);let l=null,u=null;a!=="void"?(l=r.getNodeType(e),u=typeof s<"u"?s.getNodeType(e):null,n==="<"||n===">"||n==="<="||n===">="||n==="=="?e.isVector(l)?u=l:l!==u&&(l=u="float"):n===">>"||n==="<<"?(l=a,u=e.changeComponentType(u,"uint")):e.isMatrix(l)&&e.isVector(u)?u=e.getVectorFromMatrix(l):e.isVector(l)&&e.isMatrix(u)?l=e.getVectorFromMatrix(u):l=u=a):l=u=a;const h=r.build(e,l),g=typeof s<"u"?s.build(e,u):null,v=e.getTypeLength(t),x=e.getFunctionOperator(n);if(t!=="void")return n==="<"&&v>1?e.useComparisonMethod?e.format(`${e.getMethod("lessThan",t)}( ${h}, ${g} )`,a,t):e.format(`( ${h} < ${g} )`,a,t):n==="<="&&v>1?e.useComparisonMethod?e.format(`${e.getMethod("lessThanEqual",t)}( ${h}, ${g} )`,a,t):e.format(`( ${h} <= ${g} )`,a,t):n===">"&&v>1?e.useComparisonMethod?e.format(`${e.getMethod("greaterThan",t)}( ${h}, ${g} )`,a,t):e.format(`( ${h} > ${g} )`,a,t):n===">="&&v>1?e.useComparisonMethod?e.format(`${e.getMethod("greaterThanEqual",t)}( ${h}, ${g} )`,a,t):e.format(`( ${h} >= ${g} )`,a,t):n==="!"||n==="~"?e.format(`(${n}${h})`,l,t):x?e.format(`${x}( ${h}, ${g} )`,a,t):e.format(`( ${h} ${n} ${g} )`,a,t);if(l!=="void")return x?e.format(`${x}( ${h}, ${g} )`,a,t):e.format(`${h} ${n} ${g}`,a,t)}serialize(e){super.serialize(e),e.op=this.op}deserialize(e){super.deserialize(e),this.op=e.op}}const Qr=ct(Mr,"+"),Ti=ct(Mr,"-"),Wn=ct(Mr,"*"),Dl=ct(Mr,"/"),GM=ct(Mr,"%"),lL=ct(Mr,"=="),uL=ct(Mr,"!="),cL=ct(Mr,"<"),qM=ct(Mr,">"),hL=ct(Mr,"<="),fL=ct(Mr,">="),AL=ct(Mr,"&&"),dL=ct(Mr,"||"),pL=ct(Mr,"!"),mL=ct(Mr,"^^"),gL=ct(Mr,"&"),vL=ct(Mr,"~"),_L=ct(Mr,"|"),yL=ct(Mr,"^"),xL=ct(Mr,"<<"),bL=ct(Mr,">>");ut("add",Qr);ut("sub",Ti);ut("mul",Wn);ut("div",Dl);ut("modInt",GM);ut("equal",lL);ut("notEqual",uL);ut("lessThan",cL);ut("greaterThan",qM);ut("lessThanEqual",hL);ut("greaterThanEqual",fL);ut("and",AL);ut("or",dL);ut("not",pL);ut("xor",mL);ut("bitAnd",gL);ut("bitNot",vL);ut("bitOr",_L);ut("bitXor",yL);ut("shiftLeft",xL);ut("shiftRight",bL);const SL=(...i)=>(console.warn("TSL.OperatorNode: .remainder() has been renamed to .modInt()."),GM(...i));ut("remainder",SL);class He extends Zr{static get type(){return"MathNode"}constructor(e,t,n=null,r=null){super(),this.method=e,this.aNode=t,this.bNode=n,this.cNode=r}getInputType(e){const t=this.aNode.getNodeType(e),n=this.bNode?this.bNode.getNodeType(e):null,r=this.cNode?this.cNode.getNodeType(e):null,s=e.isMatrix(t)?0:e.getTypeLength(t),a=e.isMatrix(n)?0:e.getTypeLength(n),l=e.isMatrix(r)?0:e.getTypeLength(r);return s>a&&s>l?t:a>l?n:l>s?r:t}getNodeType(e){const t=this.method;return t===He.LENGTH||t===He.DISTANCE||t===He.DOT?"float":t===He.CROSS?"vec3":t===He.ALL?"bool":t===He.EQUALS?e.changeComponentType(this.aNode.getNodeType(e),"bool"):t===He.MOD?this.aNode.getNodeType(e):this.getInputType(e)}generate(e,t){let n=this.method;const r=this.getNodeType(e),s=this.getInputType(e),a=this.aNode,l=this.bNode,u=this.cNode,h=e.renderer.coordinateSystem;if(n===He.TRANSFORM_DIRECTION){let g=a,v=l;e.isMatrix(g.getNodeType(e))?v=dn(Ne(v),0):g=dn(Ne(g),0);const x=Wn(g,v).xyz;return Fc(x).build(e,t)}else{if(n===He.NEGATE)return e.format("( - "+a.build(e,s)+" )",r,t);if(n===He.ONE_MINUS)return Ti(1,a).build(e,t);if(n===He.RECIPROCAL)return Dl(1,a).build(e,t);if(n===He.DIFFERENCE)return ur(Ti(a,l)).build(e,t);{const g=[];return n===He.CROSS||n===He.MOD?g.push(a.build(e,r),l.build(e,r)):h===Ha&&n===He.STEP?g.push(a.build(e,e.getTypeLength(a.getNodeType(e))===1?"float":s),l.build(e,s)):h===Ha&&(n===He.MIN||n===He.MAX)||n===He.MOD?g.push(a.build(e,s),l.build(e,e.getTypeLength(l.getNodeType(e))===1?"float":s)):n===He.REFRACT?g.push(a.build(e,s),l.build(e,s),u.build(e,"float")):n===He.MIX?g.push(a.build(e,s),l.build(e,s),u.build(e,e.getTypeLength(u.getNodeType(e))===1?"float":s)):(h===pu&&n===He.ATAN&&l!==null&&(n="atan2"),g.push(a.build(e,s)),l!==null&&g.push(l.build(e,s)),u!==null&&g.push(u.build(e,s))),e.format(`${e.getMethod(n,r)}( ${g.join(", ")} )`,r,t)}}}serialize(e){super.serialize(e),e.method=this.method}deserialize(e){super.deserialize(e),this.method=e.method}}He.ALL="all";He.ANY="any";He.RADIANS="radians";He.DEGREES="degrees";He.EXP="exp";He.EXP2="exp2";He.LOG="log";He.LOG2="log2";He.SQRT="sqrt";He.INVERSE_SQRT="inversesqrt";He.FLOOR="floor";He.CEIL="ceil";He.NORMALIZE="normalize";He.FRACT="fract";He.SIN="sin";He.COS="cos";He.TAN="tan";He.ASIN="asin";He.ACOS="acos";He.ATAN="atan";He.ABS="abs";He.SIGN="sign";He.LENGTH="length";He.NEGATE="negate";He.ONE_MINUS="oneMinus";He.DFDX="dFdx";He.DFDY="dFdy";He.ROUND="round";He.RECIPROCAL="reciprocal";He.TRUNC="trunc";He.FWIDTH="fwidth";He.TRANSPOSE="transpose";He.BITCAST="bitcast";He.EQUALS="equals";He.MIN="min";He.MAX="max";He.MOD="mod";He.STEP="step";He.REFLECT="reflect";He.DISTANCE="distance";He.DIFFERENCE="difference";He.DOT="dot";He.CROSS="cross";He.POW="pow";He.TRANSFORM_DIRECTION="transformDirection";He.MIX="mix";He.CLAMP="clamp";He.REFRACT="refract";He.SMOOTHSTEP="smoothstep";He.FACEFORWARD="faceforward";const TL=ge(1e-6),fJ=ge(1e6),Z_=ge(Math.PI),AJ=ge(Math.PI*2),VM=ct(He,He.ALL),wL=ct(He,He.ANY),ML=ct(He,He.RADIANS),EL=ct(He,He.DEGREES),HM=ct(He,He.EXP),O0=ct(He,He.EXP2),Oy=ct(He,He.LOG),cu=ct(He,He.LOG2),Cu=ct(He,He.SQRT),jM=ct(He,He.INVERSE_SQRT),hu=ct(He,He.FLOOR),Iy=ct(He,He.CEIL),Fc=ct(He,He.NORMALIZE),Hc=ct(He,He.FRACT),Mo=ct(He,He.SIN),yc=ct(He,He.COS),CL=ct(He,He.TAN),RL=ct(He,He.ASIN),NL=ct(He,He.ACOS),WM=ct(He,He.ATAN),ur=ct(He,He.ABS),Cg=ct(He,He.SIGN),Rc=ct(He,He.LENGTH),DL=ct(He,He.NEGATE),PL=ct(He,He.ONE_MINUS),$M=ct(He,He.DFDX),XM=ct(He,He.DFDY),LL=ct(He,He.ROUND),UL=ct(He,He.RECIPROCAL),YM=ct(He,He.TRUNC),BL=ct(He,He.FWIDTH),OL=ct(He,He.TRANSPOSE),dJ=ct(He,He.BITCAST),IL=ct(He,He.EQUALS),to=ct(He,He.MIN),qr=ct(He,He.MAX),QM=ct(He,He.MOD),Fy=ct(He,He.STEP),FL=ct(He,He.REFLECT),kL=ct(He,He.DISTANCE),zL=ct(He,He.DIFFERENCE),Xh=ct(He,He.DOT),ky=ct(He,He.CROSS),Cl=ct(He,He.POW),KM=ct(He,He.POW,2),GL=ct(He,He.POW,3),qL=ct(He,He.POW,4),VL=ct(He,He.TRANSFORM_DIRECTION),HL=i=>Wn(Cg(i),Cl(ur(i),1/3)),jL=i=>Xh(i,i),Fi=ct(He,He.MIX),vu=(i,e=0,t=1)=>mt(new He(He.CLAMP,mt(i),mt(e),mt(t))),WL=i=>vu(i),ZM=ct(He,He.REFRACT),kc=ct(He,He.SMOOTHSTEP),JM=ct(He,He.FACEFORWARD),$L=je(([i])=>{const n=43758.5453,r=Xh(i.xy,Et(12.9898,78.233)),s=QM(r,Z_);return Hc(Mo(s).mul(n))}),XL=(i,e,t)=>Fi(e,t,i),YL=(i,e,t)=>kc(e,t,i),QL=(i,e)=>(console.warn('THREE.TSL: "atan2" is overloaded. Use "atan" instead.'),WM(i,e)),pJ=JM,mJ=jM;ut("all",VM);ut("any",wL);ut("equals",IL);ut("radians",ML);ut("degrees",EL);ut("exp",HM);ut("exp2",O0);ut("log",Oy);ut("log2",cu);ut("sqrt",Cu);ut("inverseSqrt",jM);ut("floor",hu);ut("ceil",Iy);ut("normalize",Fc);ut("fract",Hc);ut("sin",Mo);ut("cos",yc);ut("tan",CL);ut("asin",RL);ut("acos",NL);ut("atan",WM);ut("abs",ur);ut("sign",Cg);ut("length",Rc);ut("lengthSq",jL);ut("negate",DL);ut("oneMinus",PL);ut("dFdx",$M);ut("dFdy",XM);ut("round",LL);ut("reciprocal",UL);ut("trunc",YM);ut("fwidth",BL);ut("atan2",QL);ut("min",to);ut("max",qr);ut("mod",QM);ut("step",Fy);ut("reflect",FL);ut("distance",kL);ut("dot",Xh);ut("cross",ky);ut("pow",Cl);ut("pow2",KM);ut("pow3",GL);ut("pow4",qL);ut("transformDirection",VL);ut("mix",XL);ut("clamp",vu);ut("refract",ZM);ut("smoothstep",YL);ut("faceForward",JM);ut("difference",zL);ut("saturate",WL);ut("cbrt",HL);ut("transpose",OL);ut("rand",$L);class gJ extends Mn{static get type(){return"ConditionalNode"}constructor(e,t,n=null){super(),this.condNode=e,this.ifNode=t,this.elseNode=n}getNodeType(e){const{ifNode:t,elseNode:n}=e.getNodeProperties(this);if(t===void 0)return this.setup(e),this.getNodeType(e);const r=t.getNodeType(e);if(n!==null){const s=n.getNodeType(e);if(e.getTypeLength(s)>e.getTypeLength(r))return s}return r}setup(e){const t=this.condNode.cache(),n=this.ifNode.cache(),r=this.elseNode?this.elseNode.cache():null,s=e.context.nodeBlock;e.getDataFromNode(n).parentNodeBlock=s,r!==null&&(e.getDataFromNode(r).parentNodeBlock=s);const a=e.getNodeProperties(this);a.condNode=t,a.ifNode=n.context({nodeBlock:n}),a.elseNode=r?r.context({nodeBlock:r}):null}generate(e,t){const n=this.getNodeType(e),r=e.getDataFromNode(this);if(r.nodeProperty!==void 0)return r.nodeProperty;const{condNode:s,ifNode:a,elseNode:l}=e.getNodeProperties(this),u=t!=="void",h=u?sL(n).build(e):"";r.nodeProperty=h;const g=s.build(e,"bool");e.addFlowCode(` + */const kZ=["alphaMap","alphaTest","anisotropy","anisotropyMap","anisotropyRotation","aoMap","attenuationColor","attenuationDistance","bumpMap","clearcoat","clearcoatMap","clearcoatNormalMap","clearcoatNormalScale","clearcoatRoughness","color","dispersion","displacementMap","emissive","emissiveMap","envMap","gradientMap","ior","iridescence","iridescenceIOR","iridescenceMap","iridescenceThicknessMap","lightMap","map","matcap","metalness","metalnessMap","normalMap","normalScale","opacity","roughness","roughnessMap","sheen","sheenColor","sheenColorMap","sheenRoughnessMap","shininess","specular","specularColor","specularColorMap","specularIntensity","specularIntensityMap","specularMap","thickness","transmission","transmissionMap"];class zZ{constructor(e){this.renderObjects=new WeakMap,this.hasNode=this.containsNode(e),this.hasAnimation=e.object.isSkinnedMesh===!0,this.refreshUniforms=kZ,this.renderId=0}firstInitialization(e){return this.renderObjects.has(e)===!1?(this.getRenderObjectData(e),!0):!1}getRenderObjectData(e){let t=this.renderObjects.get(e);if(t===void 0){const{geometry:n,material:r,object:s}=e;if(t={material:this.getMaterialData(r),geometry:{attributes:this.getAttributesData(n.attributes),indexVersion:n.index?n.index.version:null,drawRange:{start:n.drawRange.start,count:n.drawRange.count}},worldMatrix:s.matrixWorld.clone()},s.center&&(t.center=s.center.clone()),s.morphTargetInfluences&&(t.morphTargetInfluences=s.morphTargetInfluences.slice()),e.bundle!==null&&(t.version=e.bundle.version),t.material.transmission>0){const{width:a,height:l}=e.context;t.bufferWidth=a,t.bufferHeight=l}this.renderObjects.set(e,t)}return t}getAttributesData(e){const t={};for(const n in e){const r=e[n];t[n]={version:r.version}}return t}containsNode(e){const t=e.material;for(const n in t)if(t[n]&&t[n].isNode)return!0;return e.renderer.nodes.modelViewMatrix!==null||e.renderer.nodes.modelNormalViewMatrix!==null}getMaterialData(e){const t={};for(const n of this.refreshUniforms){const r=e[n];r!=null&&(typeof r=="object"&&r.clone!==void 0?r.isTexture===!0?t[n]={id:r.id,version:r.version}:t[n]=r.clone():t[n]=r)}return t}equals(e){const{object:t,material:n,geometry:r}=e,s=this.getRenderObjectData(e);if(s.worldMatrix.equals(t.matrixWorld)!==!0)return s.worldMatrix.copy(t.matrixWorld),!1;const a=s.material;for(const R in a){const C=a[R],E=n[R];if(C.equals!==void 0){if(C.equals(E)===!1)return C.copy(E),!1}else if(E.isTexture===!0){if(C.id!==E.id||C.version!==E.version)return C.id=E.id,C.version=E.version,!1}else if(C!==E)return a[R]=E,!1}if(a.transmission>0){const{width:R,height:C}=e.context;if(s.bufferWidth!==R||s.bufferHeight!==C)return s.bufferWidth=R,s.bufferHeight=C,!1}const l=s.geometry,u=r.attributes,h=l.attributes,g=Object.keys(h),v=Object.keys(u);if(g.length!==v.length)return s.geometry.attributes=this.getAttributesData(u),!1;for(const R of g){const C=h[R],E=u[R];if(E===void 0)return delete h[R],!1;if(C.version!==E.version)return C.version=E.version,!1}const x=r.index,S=l.indexVersion,w=x?x.version:null;if(S!==w)return l.indexVersion=w,!1;if(l.drawRange.start!==r.drawRange.start||l.drawRange.count!==r.drawRange.count)return l.drawRange.start=r.drawRange.start,l.drawRange.count=r.drawRange.count,!1;if(s.morphTargetInfluences){let R=!1;for(let C=0;C>>16,2246822507),t^=Math.imul(n^n>>>13,3266489909),n=Math.imul(n^n>>>16,2246822507),n^=Math.imul(t^t>>>13,3266489909),4294967296*(2097151&n)+(t>>>0)}const DP=i=>yg(i),Ny=i=>yg(i),MM=(...i)=>yg(i);function PP(i,e=!1){const t=[];i.isNode===!0&&(t.push(i.id),i=i.getSelf());for(const{property:n,childNode:r}of $_(i))t.push(t,yg(n.slice(0,-4)),r.getCacheKey(e));return yg(t)}function*$_(i,e=!1){for(const t in i){if(t.startsWith("_")===!0)continue;const n=i[t];if(Array.isArray(n)===!0)for(let r=0;re.charCodeAt(0)).buffer}const OT={VERTEX:"vertex",FRAGMENT:"fragment"},jn={NONE:"none",FRAME:"frame",RENDER:"render",OBJECT:"object"},qZ={BOOLEAN:"bool",INTEGER:"int",FLOAT:"float",VECTOR2:"vec2",VECTOR3:"vec3",VECTOR4:"vec4",MATRIX2:"mat2",MATRIX3:"mat3",MATRIX4:"mat4"},sa={READ_ONLY:"readOnly",WRITE_ONLY:"writeOnly",READ_WRITE:"readWrite"},zP=["fragment","vertex"],IT=["setup","analyze","generate"],FT=[...zP,"compute"],gA=["x","y","z","w"];let VZ=0;class Mn extends zc{static get type(){return"Node"}constructor(e=null){super(),this.nodeType=e,this.updateType=jn.NONE,this.updateBeforeType=jn.NONE,this.updateAfterType=jn.NONE,this.uuid=M0.generateUUID(),this.version=0,this.global=!1,this.isNode=!0,this._cacheKey=null,this._cacheKeyVersion=0,Object.defineProperty(this,"id",{value:VZ++})}set needsUpdate(e){e===!0&&this.version++}get type(){return this.constructor.type}onUpdate(e,t){return this.updateType=t,this.update=e.bind(this.getSelf()),this}onFrameUpdate(e){return this.onUpdate(e,jn.FRAME)}onRenderUpdate(e){return this.onUpdate(e,jn.RENDER)}onObjectUpdate(e){return this.onUpdate(e,jn.OBJECT)}onReference(e){return this.updateReference=e.bind(this.getSelf()),this}getSelf(){return this.self||this}updateReference(){return this}isGlobal(){return this.global}*getChildren(){for(const{childNode:e}of $_(this))yield e}dispose(){this.dispatchEvent({type:"dispose"})}traverse(e){e(this);for(const t of this.getChildren())t.traverse(e)}getCacheKey(e=!1){return e=e||this.version!==this._cacheKeyVersion,(e===!0||this._cacheKey===null)&&(this._cacheKey=MM(PP(this,e),this.customCacheKey()),this._cacheKeyVersion=this.version),this._cacheKey}customCacheKey(){return 0}getScope(){return this}getHash(){return this.uuid}getUpdateType(){return this.updateType}getUpdateBeforeType(){return this.updateBeforeType}getUpdateAfterType(){return this.updateAfterType}getElementType(e){const t=this.getNodeType(e);return e.getElementType(t)}getNodeType(e){const t=e.getNodeProperties(this);return t.outputNode?t.outputNode.getNodeType(e):this.nodeType}getShared(e){const t=this.getHash(e);return e.getNodeFromHash(t)||this}setup(e){const t=e.getNodeProperties(this);let n=0;for(const r of this.getChildren())t["node"+n++]=r;return t.outputNode||null}analyze(e){if(e.increaseUsage(this)===1){const n=e.getNodeProperties(this);for(const r of Object.values(n))r&&r.isNode===!0&&r.build(e)}}generate(e,t){const{outputNode:n}=e.getNodeProperties(this);if(n&&n.isNode===!0)return n.build(e,t)}updateBefore(){console.warn("Abstract function.")}updateAfter(){console.warn("Abstract function.")}update(){console.warn("Abstract function.")}build(e,t=null){const n=this.getShared(e);if(this!==n)return n.build(e,t);e.addNode(this),e.addChain(this);let r=null;const s=e.getBuildStage();if(s==="setup"){this.updateReference(e);const a=e.getNodeProperties(this);if(a.initialized!==!0){a.initialized=!0;const l=this.setup(e),u=l&&l.isNode===!0;for(const h of Object.values(a))h&&h.isNode===!0&&h.build(e);u&&l.build(e),a.outputNode=l}}else if(s==="analyze")this.analyze(e);else if(s==="generate")if(this.generate.length===1){const l=this.getNodeType(e),u=e.getDataFromNode(this);r=u.snippet,r===void 0?(r=this.generate(e)||"",u.snippet=r):u.flowCodes!==void 0&&e.context.nodeBlock!==void 0&&e.addFlowCodeHierarchy(this,e.context.nodeBlock),r=e.format(r,l,t)}else r=this.generate(e,t)||"";return e.removeChain(this),e.addSequentialNode(this),r}getSerializeChildren(){return $_(this)}serialize(e){const t=this.getSerializeChildren(),n={};for(const{property:r,index:s,childNode:a}of t)s!==void 0?(n[r]===void 0&&(n[r]=Number.isInteger(s)?[]:{}),n[r][s]=a.toJSON(e.meta).uuid):n[r]=a.toJSON(e.meta).uuid;Object.keys(n).length>0&&(e.inputNodes=n)}deserialize(e){if(e.inputNodes!==void 0){const t=e.meta.nodes;for(const n in e.inputNodes)if(Array.isArray(e.inputNodes[n])){const r=[];for(const s of e.inputNodes[n])r.push(t[s]);this[n]=r}else if(typeof e.inputNodes[n]=="object"){const r={};for(const s in e.inputNodes[n]){const a=e.inputNodes[n][s];r[s]=t[a]}this[n]=r}else{const r=e.inputNodes[n];this[n]=t[r]}}}toJSON(e){const{uuid:t,type:n}=this,r=e===void 0||typeof e=="string";r&&(e={textures:{},images:{},nodes:{}});let s=e.nodes[t];s===void 0&&(s={uuid:t,type:n,meta:e,metadata:{version:4.6,type:"Node",generator:"Node.toJSON"}},r!==!0&&(e.nodes[s.uuid]=s),this.serialize(s),delete s.meta);function a(l){const u=[];for(const h in l){const g=l[h];delete g.metadata,u.push(g)}return u}if(r){const l=a(e.textures),u=a(e.images),h=a(e.nodes);l.length>0&&(s.textures=l),u.length>0&&(s.images=u),h.length>0&&(s.nodes=h)}return s}}class vA extends Mn{static get type(){return"ArrayElementNode"}constructor(e,t){super(),this.node=e,this.indexNode=t,this.isArrayElementNode=!0}getNodeType(e){return this.node.getElementType(e)}generate(e){const t=this.node.build(e),n=this.indexNode.build(e,"uint");return`${t}[ ${n} ]`}}class GP extends Mn{static get type(){return"ConvertNode"}constructor(e,t){super(),this.node=e,this.convertTo=t}getNodeType(e){const t=this.node.getNodeType(e);let n=null;for(const r of this.convertTo.split("|"))(n===null||e.getTypeLength(t)===e.getTypeLength(r))&&(n=r);return n}serialize(e){super.serialize(e),e.convertTo=this.convertTo}deserialize(e){super.deserialize(e),this.convertTo=e.convertTo}generate(e,t){const n=this.node,r=this.getNodeType(e),s=n.build(e,r);return e.format(s,r,t)}}class Zr extends Mn{static get type(){return"TempNode"}constructor(e=null){super(e),this.isTempNode=!0}hasDependencies(e){return e.getDataFromNode(this).usageCount>1}build(e,t){if(e.getBuildStage()==="generate"){const r=e.getVectorType(this.getNodeType(e,t)),s=e.getDataFromNode(this);if(s.propertyName!==void 0)return e.format(s.propertyName,r,t);if(r!=="void"&&t!=="void"&&this.hasDependencies(e)){const a=super.build(e,r),l=e.getVarFromNode(this,null,r),u=e.getPropertyName(l);return e.addLineFlowCode(`${u} = ${a}`,this),s.snippet=a,s.propertyName=u,e.format(s.propertyName,r,t)}}return super.build(e,t)}}class HZ extends Zr{static get type(){return"JoinNode"}constructor(e=[],t=null){super(t),this.nodes=e}getNodeType(e){return this.nodeType!==null?e.getVectorType(this.nodeType):e.getTypeFromLength(this.nodes.reduce((t,n)=>t+e.getTypeLength(n.getNodeType(e)),0))}generate(e,t){const n=this.getNodeType(e),r=this.nodes,s=e.getComponentType(n),a=[];for(const u of r){let h=u.build(e);const g=e.getComponentType(u.getNodeType(e));g!==s&&(h=e.format(h,g,s)),a.push(h)}const l=`${e.getType(n)}( ${a.join(", ")} )`;return e.format(l,n,t)}}const jZ=gA.join("");class kT extends Mn{static get type(){return"SplitNode"}constructor(e,t="x"){super(),this.node=e,this.components=t,this.isSplitNode=!0}getVectorLength(){let e=this.components.length;for(const t of this.components)e=Math.max(gA.indexOf(t)+1,e);return e}getComponentType(e){return e.getComponentType(this.node.getNodeType(e))}getNodeType(e){return e.getTypeFromLength(this.components.length,this.getComponentType(e))}generate(e,t){const n=this.node,r=e.getTypeLength(n.getNodeType(e));let s=null;if(r>1){let a=null;this.getVectorLength()>=r&&(a=e.getTypeFromLength(this.getVectorLength(),this.getComponentType(e)));const u=n.build(e,a);this.components.length===r&&this.components===jZ.slice(0,this.components.length)?s=e.format(u,a,t):s=e.format(`${u}.${this.components}`,this.getNodeType(e),t)}else s=n.build(e,t);return s}serialize(e){super.serialize(e),e.components=this.components}deserialize(e){super.deserialize(e),this.components=e.components}}class WZ extends Zr{static get type(){return"SetNode"}constructor(e,t,n){super(),this.sourceNode=e,this.components=t,this.targetNode=n}getNodeType(e){return this.sourceNode.getNodeType(e)}generate(e){const{sourceNode:t,components:n,targetNode:r}=this,s=this.getNodeType(e),a=e.getComponentType(r.getNodeType(e)),l=e.getTypeFromLength(n.length,a),u=r.build(e,l),h=t.build(e,s),g=e.getTypeLength(s),v=[];for(let x=0;xi.replace(/r|s/g,"x").replace(/g|t/g,"y").replace(/b|p/g,"z").replace(/a|q/g,"w"),NR=i=>qP(i).split("").sort().join(""),VP={setup(i,e){const t=e.shift();return i(Vg(t),...e)},get(i,e,t){if(typeof e=="string"&&i[e]===void 0){if(i.isStackNode!==!0&&e==="assign")return(...n)=>(B0.assign(t,...n),t);if(Yd.has(e)){const n=Yd.get(e);return i.isStackNode?(...r)=>t.add(n(...r)):(...r)=>n(t,...r)}else{if(e==="self")return i;if(e.endsWith("Assign")&&Yd.has(e.slice(0,e.length-6))){const n=Yd.get(e.slice(0,e.length-6));return i.isStackNode?(...r)=>t.assign(r[0],n(...r)):(...r)=>t.assign(n(t,...r))}else{if(/^[xyzwrgbastpq]{1,4}$/.test(e)===!0)return e=qP(e),gt(new kT(t,e));if(/^set[XYZWRGBASTPQ]{1,4}$/.test(e)===!0)return e=NR(e.slice(3).toLowerCase()),n=>gt(new WZ(i,e,n));if(/^flip[XYZWRGBASTPQ]{1,4}$/.test(e)===!0)return e=NR(e.slice(4).toLowerCase()),()=>gt(new $Z(gt(i),e));if(e==="width"||e==="height"||e==="depth")return e==="width"?e="x":e==="height"?e="y":e==="depth"&&(e="z"),gt(new kT(i,e));if(/^\d+$/.test(e)===!0)return gt(new vA(t,new Ll(Number(e),"uint")))}}}return Reflect.get(i,e,t)},set(i,e,t,n){return typeof e=="string"&&i[e]===void 0&&(/^[xyzwrgbastpq]{1,4}$/.test(e)===!0||e==="width"||e==="height"||e==="depth"||/^\d+$/.test(e)===!0)?(n[e].assign(t),!0):Reflect.set(i,e,t,n)}},W3=new WeakMap,DR=new WeakMap,XZ=function(i,e=null){const t=Uh(i);if(t==="node"){let n=W3.get(i);return n===void 0&&(n=new Proxy(i,VP),W3.set(i,n),W3.set(n,n)),n}else{if(e===null&&(t==="float"||t==="boolean")||t&&t!=="shader"&&t!=="string")return gt(zT(i,e));if(t==="shader")return je(i)}return i},YZ=function(i,e=null){for(const t in i)i[t]=gt(i[t],e);return i},QZ=function(i,e=null){const t=i.length;for(let n=0;ngt(n!==null?Object.assign(s,n):s);return e===null?(...s)=>r(new i(...tA(s))):t!==null?(t=gt(t),(...s)=>r(new i(e,...tA(s),t))):(...s)=>r(new i(e,...tA(s)))},ZZ=function(i,...e){return gt(new i(...tA(e)))};class JZ extends Mn{constructor(e,t){super(),this.shaderNode=e,this.inputNodes=t}getNodeType(e){return this.shaderNode.nodeType||this.getOutputNode(e).getNodeType(e)}call(e){const{shaderNode:t,inputNodes:n}=this,r=e.getNodeProperties(t);if(r.onceOutput)return r.onceOutput;let s=null;if(t.layout){let a=DR.get(e.constructor);a===void 0&&(a=new WeakMap,DR.set(e.constructor,a));let l=a.get(t);l===void 0&&(l=gt(e.buildFunctionNode(t)),a.set(t,l)),e.currentFunctionNode!==null&&e.currentFunctionNode.includes.push(l),s=gt(l.call(n))}else{const a=t.jsFunc,l=n!==null?a(n,e):a(e);s=gt(l)}return t.once&&(r.onceOutput=s),s}getOutputNode(e){const t=e.getNodeProperties(this);return t.outputNode===null&&(t.outputNode=this.setupOutput(e)),t.outputNode}setup(e){return this.getOutputNode(e)}setupOutput(e){return e.addStack(),e.stack.outputNode=this.call(e),e.removeStack()}generate(e,t){return this.getOutputNode(e).build(e,t)}}class eJ extends Mn{constructor(e,t){super(t),this.jsFunc=e,this.layout=null,this.global=!0,this.once=!1}setLayout(e){return this.layout=e,this}call(e=null){return Vg(e),gt(new JZ(this,e))}setup(){return this.call()}}const tJ=[!1,!0],nJ=[0,1,2,3],iJ=[-1,-2],HP=[.5,1.5,1/3,1e-6,1e6,Math.PI,Math.PI*2,1/Math.PI,2/Math.PI,1/(Math.PI*2),Math.PI/2],CM=new Map;for(const i of tJ)CM.set(i,new Ll(i));const RM=new Map;for(const i of nJ)RM.set(i,new Ll(i,"uint"));const NM=new Map([...RM].map(i=>new Ll(i.value,"int")));for(const i of iJ)NM.set(i,new Ll(i,"int"));const Dy=new Map([...NM].map(i=>new Ll(i.value)));for(const i of HP)Dy.set(i,new Ll(i));for(const i of HP)Dy.set(-i,new Ll(-i));const Py={bool:CM,uint:RM,ints:NM,float:Dy},PR=new Map([...CM,...Dy]),zT=(i,e)=>PR.has(i)?PR.get(i):i.isNode===!0?i:new Ll(i,e),rJ=i=>{try{return i.getNodeType()}catch{return}},ls=function(i,e=null){return(...t)=>{if((t.length===0||!["bool","float","int","uint"].includes(i)&&t.every(r=>typeof r!="object"))&&(t=[OP(i,...t)]),t.length===1&&e!==null&&e.has(t[0]))return gt(e.get(t[0]));if(t.length===1){const r=zT(t[0],i);return rJ(r)===i?gt(r):gt(new GP(r,i))}const n=t.map(r=>zT(r));return gt(new HZ(n,i))}},xg=i=>typeof i=="object"&&i!==null?i.value:i,jP=i=>i!=null?i.nodeType||i.convertTo||(typeof i=="string"?i:null):null;function Um(i,e){return new Proxy(new eJ(i,e),VP)}const gt=(i,e=null)=>XZ(i,e),Vg=(i,e=null)=>new YZ(i,e),tA=(i,e=null)=>new QZ(i,e),ht=(...i)=>new KZ(...i),zt=(...i)=>new ZZ(...i),je=(i,e)=>{const t=new Um(i,e),n=(...r)=>{let s;return Vg(r),r[0]&&r[0].isNode?s=[...r]:s=r[0],t.call(s)};return n.shaderNode=t,n.setLayout=r=>(t.setLayout(r),n),n.once=()=>(t.once=!0,n),n},sJ=(...i)=>(console.warn("TSL.ShaderNode: tslFn() has been renamed to Fn()."),je(...i));ct("toGlobal",i=>(i.global=!0,i));const bg=i=>{B0=i},DM=()=>B0,ti=(...i)=>B0.If(...i);function WP(i){return B0&&B0.add(i),i}ct("append",WP);const $P=new ls("color"),ge=new ls("float",Py.float),ye=new ls("int",Py.ints),Qt=new ls("uint",Py.uint),Ic=new ls("bool",Py.bool),Et=new ls("vec2"),ms=new ls("ivec2"),XP=new ls("uvec2"),YP=new ls("bvec2"),Ne=new ls("vec3"),QP=new ls("ivec3"),Y0=new ls("uvec3"),PM=new ls("bvec3"),dn=new ls("vec4"),KP=new ls("ivec4"),ZP=new ls("uvec4"),JP=new ls("bvec4"),Ly=new ls("mat2"),ha=new ls("mat3"),nA=new ls("mat4"),aJ=(i="")=>gt(new Ll(i,"string")),oJ=i=>gt(new Ll(i,"ArrayBuffer"));ct("toColor",$P);ct("toFloat",ge);ct("toInt",ye);ct("toUint",Qt);ct("toBool",Ic);ct("toVec2",Et);ct("toIVec2",ms);ct("toUVec2",XP);ct("toBVec2",YP);ct("toVec3",Ne);ct("toIVec3",QP);ct("toUVec3",Y0);ct("toBVec3",PM);ct("toVec4",dn);ct("toIVec4",KP);ct("toUVec4",ZP);ct("toBVec4",JP);ct("toMat2",Ly);ct("toMat3",ha);ct("toMat4",nA);const eL=ht(vA),tL=(i,e)=>gt(new GP(gt(i),e)),lJ=(i,e)=>gt(new kT(gt(i),e));ct("element",eL);ct("convert",tL);class nL extends Mn{static get type(){return"UniformGroupNode"}constructor(e,t=!1,n=1){super("string"),this.name=e,this.shared=t,this.order=n,this.isUniformGroup=!0}serialize(e){super.serialize(e),e.name=this.name,e.version=this.version,e.shared=this.shared}deserialize(e){super.deserialize(e),this.name=e.name,this.version=e.version,this.shared=e.shared}}const iL=i=>new nL(i),LM=(i,e=0)=>new nL(i,!0,e),rL=LM("frame"),Rn=LM("render"),UM=iL("object");class Hg extends EM{static get type(){return"UniformNode"}constructor(e,t=null){super(e,t),this.isUniformNode=!0,this.name="",this.groupNode=UM}label(e){return this.name=e,this}setGroup(e){return this.groupNode=e,this}getGroup(){return this.groupNode}getUniformHash(e){return this.getHash(e)}onUpdate(e,t){const n=this.getSelf();return e=e.bind(n),super.onUpdate(r=>{const s=e(r,n);s!==void 0&&(this.value=s)},t)}generate(e,t){const n=this.getNodeType(e),r=this.getUniformHash(e);let s=e.getNodeFromHash(r);s===void 0&&(e.setHashNode(this,r),s=this);const a=s.getInputType(e),l=e.getUniformFromNode(s,a,e.shaderStage,this.name||e.context.label),u=e.getPropertyName(l);return e.context.label!==void 0&&delete e.context.label,e.format(u,n,t)}}const gn=(i,e)=>{const t=jP(e||i),n=i&&i.isNode===!0?i.node&&i.node.value||i.value:i;return gt(new Hg(n,t))};class Gi extends Mn{static get type(){return"PropertyNode"}constructor(e,t=null,n=!1){super(e),this.name=t,this.varying=n,this.isPropertyNode=!0}getHash(e){return this.name||super.getHash(e)}isGlobal(){return!0}generate(e){let t;return this.varying===!0?(t=e.getVaryingFromNode(this,this.name),t.needsInterpolation=!0):t=e.getVarFromNode(this,this.name),e.getPropertyName(t)}}const sL=(i,e)=>gt(new Gi(i,e)),Sg=(i,e)=>gt(new Gi(i,e,!0)),Ui=zt(Gi,"vec4","DiffuseColor"),GT=zt(Gi,"vec3","EmissiveColor"),Zl=zt(Gi,"float","Roughness"),Tg=zt(Gi,"float","Metalness"),X_=zt(Gi,"float","Clearcoat"),wg=zt(Gi,"float","ClearcoatRoughness"),Xf=zt(Gi,"vec3","Sheen"),Uy=zt(Gi,"float","SheenRoughness"),By=zt(Gi,"float","Iridescence"),BM=zt(Gi,"float","IridescenceIOR"),OM=zt(Gi,"float","IridescenceThickness"),Y_=zt(Gi,"float","AlphaT"),Rh=zt(Gi,"float","Anisotropy"),Bm=zt(Gi,"vec3","AnisotropyT"),iA=zt(Gi,"vec3","AnisotropyB"),ka=zt(Gi,"color","SpecularColor"),Mg=zt(Gi,"float","SpecularF90"),Q_=zt(Gi,"float","Shininess"),Eg=zt(Gi,"vec4","Output"),Qv=zt(Gi,"float","dashSize"),qT=zt(Gi,"float","gapSize"),uJ=zt(Gi,"float","pointWidth"),Om=zt(Gi,"float","IOR"),K_=zt(Gi,"float","Transmission"),IM=zt(Gi,"float","Thickness"),FM=zt(Gi,"float","AttenuationDistance"),kM=zt(Gi,"color","AttenuationColor"),zM=zt(Gi,"float","Dispersion");class cJ extends Zr{static get type(){return"AssignNode"}constructor(e,t){super(),this.targetNode=e,this.sourceNode=t}hasDependencies(){return!1}getNodeType(e,t){return t!=="void"?this.targetNode.getNodeType(e):"void"}needsSplitAssign(e){const{targetNode:t}=this;if(e.isAvailable("swizzleAssign")===!1&&t.isSplitNode&&t.components.length>1){const n=e.getTypeLength(t.node.getNodeType(e));return gA.join("").slice(0,n)!==t.components}return!1}generate(e,t){const{targetNode:n,sourceNode:r}=this,s=this.needsSplitAssign(e),a=n.getNodeType(e),l=n.context({assign:!0}).build(e),u=r.build(e,a),h=r.getNodeType(e),g=e.getDataFromNode(this);let v;if(g.initialized===!0)t!=="void"&&(v=l);else if(s){const x=e.getVarFromNode(this,null,a),S=e.getPropertyName(x);e.addLineFlowCode(`${S} = ${u}`,this);const w=n.node.context({assign:!0}).build(e);for(let R=0;R{const g=h.type,v=g==="pointer";let x;return v?x="&"+u.build(e):x=u.build(e,g),x};if(Array.isArray(s))for(let u=0;u(e=e.length>1||e[0]&&e[0].isNode===!0?tA(e):Vg(e[0]),gt(new hJ(gt(i),e)));ct("call",oL);class Mr extends Zr{static get type(){return"OperatorNode"}constructor(e,t,n,...r){if(super(),r.length>0){let s=new Mr(e,t,n);for(let a=0;a>"||n==="<<")return e.getIntegerType(a);if(n==="!"||n==="=="||n==="&&"||n==="||"||n==="^^")return"bool";if(n==="<"||n===">"||n==="<="||n===">="){const u=t?e.getTypeLength(t):Math.max(e.getTypeLength(a),e.getTypeLength(l));return u>1?`bvec${u}`:"bool"}else return a==="float"&&e.isMatrix(l)?l:e.isMatrix(a)&&e.isVector(l)?e.getVectorFromMatrix(a):e.isVector(a)&&e.isMatrix(l)?e.getVectorFromMatrix(l):e.getTypeLength(l)>e.getTypeLength(a)?l:a}generate(e,t){const n=this.op,r=this.aNode,s=this.bNode,a=this.getNodeType(e,t);let l=null,u=null;a!=="void"?(l=r.getNodeType(e),u=typeof s<"u"?s.getNodeType(e):null,n==="<"||n===">"||n==="<="||n===">="||n==="=="?e.isVector(l)?u=l:l!==u&&(l=u="float"):n===">>"||n==="<<"?(l=a,u=e.changeComponentType(u,"uint")):e.isMatrix(l)&&e.isVector(u)?u=e.getVectorFromMatrix(l):e.isVector(l)&&e.isMatrix(u)?l=e.getVectorFromMatrix(u):l=u=a):l=u=a;const h=r.build(e,l),g=typeof s<"u"?s.build(e,u):null,v=e.getTypeLength(t),x=e.getFunctionOperator(n);if(t!=="void")return n==="<"&&v>1?e.useComparisonMethod?e.format(`${e.getMethod("lessThan",t)}( ${h}, ${g} )`,a,t):e.format(`( ${h} < ${g} )`,a,t):n==="<="&&v>1?e.useComparisonMethod?e.format(`${e.getMethod("lessThanEqual",t)}( ${h}, ${g} )`,a,t):e.format(`( ${h} <= ${g} )`,a,t):n===">"&&v>1?e.useComparisonMethod?e.format(`${e.getMethod("greaterThan",t)}( ${h}, ${g} )`,a,t):e.format(`( ${h} > ${g} )`,a,t):n===">="&&v>1?e.useComparisonMethod?e.format(`${e.getMethod("greaterThanEqual",t)}( ${h}, ${g} )`,a,t):e.format(`( ${h} >= ${g} )`,a,t):n==="!"||n==="~"?e.format(`(${n}${h})`,l,t):x?e.format(`${x}( ${h}, ${g} )`,a,t):e.format(`( ${h} ${n} ${g} )`,a,t);if(l!=="void")return x?e.format(`${x}( ${h}, ${g} )`,a,t):e.format(`${h} ${n} ${g}`,a,t)}serialize(e){super.serialize(e),e.op=this.op}deserialize(e){super.deserialize(e),this.op=e.op}}const Qr=ht(Mr,"+"),Ti=ht(Mr,"-"),Wn=ht(Mr,"*"),Dl=ht(Mr,"/"),GM=ht(Mr,"%"),lL=ht(Mr,"=="),uL=ht(Mr,"!="),cL=ht(Mr,"<"),qM=ht(Mr,">"),hL=ht(Mr,"<="),fL=ht(Mr,">="),AL=ht(Mr,"&&"),dL=ht(Mr,"||"),pL=ht(Mr,"!"),mL=ht(Mr,"^^"),gL=ht(Mr,"&"),vL=ht(Mr,"~"),_L=ht(Mr,"|"),yL=ht(Mr,"^"),xL=ht(Mr,"<<"),bL=ht(Mr,">>");ct("add",Qr);ct("sub",Ti);ct("mul",Wn);ct("div",Dl);ct("modInt",GM);ct("equal",lL);ct("notEqual",uL);ct("lessThan",cL);ct("greaterThan",qM);ct("lessThanEqual",hL);ct("greaterThanEqual",fL);ct("and",AL);ct("or",dL);ct("not",pL);ct("xor",mL);ct("bitAnd",gL);ct("bitNot",vL);ct("bitOr",_L);ct("bitXor",yL);ct("shiftLeft",xL);ct("shiftRight",bL);const SL=(...i)=>(console.warn("TSL.OperatorNode: .remainder() has been renamed to .modInt()."),GM(...i));ct("remainder",SL);class He extends Zr{static get type(){return"MathNode"}constructor(e,t,n=null,r=null){super(),this.method=e,this.aNode=t,this.bNode=n,this.cNode=r}getInputType(e){const t=this.aNode.getNodeType(e),n=this.bNode?this.bNode.getNodeType(e):null,r=this.cNode?this.cNode.getNodeType(e):null,s=e.isMatrix(t)?0:e.getTypeLength(t),a=e.isMatrix(n)?0:e.getTypeLength(n),l=e.isMatrix(r)?0:e.getTypeLength(r);return s>a&&s>l?t:a>l?n:l>s?r:t}getNodeType(e){const t=this.method;return t===He.LENGTH||t===He.DISTANCE||t===He.DOT?"float":t===He.CROSS?"vec3":t===He.ALL?"bool":t===He.EQUALS?e.changeComponentType(this.aNode.getNodeType(e),"bool"):t===He.MOD?this.aNode.getNodeType(e):this.getInputType(e)}generate(e,t){let n=this.method;const r=this.getNodeType(e),s=this.getInputType(e),a=this.aNode,l=this.bNode,u=this.cNode,h=e.renderer.coordinateSystem;if(n===He.TRANSFORM_DIRECTION){let g=a,v=l;e.isMatrix(g.getNodeType(e))?v=dn(Ne(v),0):g=dn(Ne(g),0);const x=Wn(g,v).xyz;return Fc(x).build(e,t)}else{if(n===He.NEGATE)return e.format("( - "+a.build(e,s)+" )",r,t);if(n===He.ONE_MINUS)return Ti(1,a).build(e,t);if(n===He.RECIPROCAL)return Dl(1,a).build(e,t);if(n===He.DIFFERENCE)return ur(Ti(a,l)).build(e,t);{const g=[];return n===He.CROSS||n===He.MOD?g.push(a.build(e,r),l.build(e,r)):h===Ha&&n===He.STEP?g.push(a.build(e,e.getTypeLength(a.getNodeType(e))===1?"float":s),l.build(e,s)):h===Ha&&(n===He.MIN||n===He.MAX)||n===He.MOD?g.push(a.build(e,s),l.build(e,e.getTypeLength(l.getNodeType(e))===1?"float":s)):n===He.REFRACT?g.push(a.build(e,s),l.build(e,s),u.build(e,"float")):n===He.MIX?g.push(a.build(e,s),l.build(e,s),u.build(e,e.getTypeLength(u.getNodeType(e))===1?"float":s)):(h===pu&&n===He.ATAN&&l!==null&&(n="atan2"),g.push(a.build(e,s)),l!==null&&g.push(l.build(e,s)),u!==null&&g.push(u.build(e,s))),e.format(`${e.getMethod(n,r)}( ${g.join(", ")} )`,r,t)}}}serialize(e){super.serialize(e),e.method=this.method}deserialize(e){super.deserialize(e),this.method=e.method}}He.ALL="all";He.ANY="any";He.RADIANS="radians";He.DEGREES="degrees";He.EXP="exp";He.EXP2="exp2";He.LOG="log";He.LOG2="log2";He.SQRT="sqrt";He.INVERSE_SQRT="inversesqrt";He.FLOOR="floor";He.CEIL="ceil";He.NORMALIZE="normalize";He.FRACT="fract";He.SIN="sin";He.COS="cos";He.TAN="tan";He.ASIN="asin";He.ACOS="acos";He.ATAN="atan";He.ABS="abs";He.SIGN="sign";He.LENGTH="length";He.NEGATE="negate";He.ONE_MINUS="oneMinus";He.DFDX="dFdx";He.DFDY="dFdy";He.ROUND="round";He.RECIPROCAL="reciprocal";He.TRUNC="trunc";He.FWIDTH="fwidth";He.TRANSPOSE="transpose";He.BITCAST="bitcast";He.EQUALS="equals";He.MIN="min";He.MAX="max";He.MOD="mod";He.STEP="step";He.REFLECT="reflect";He.DISTANCE="distance";He.DIFFERENCE="difference";He.DOT="dot";He.CROSS="cross";He.POW="pow";He.TRANSFORM_DIRECTION="transformDirection";He.MIX="mix";He.CLAMP="clamp";He.REFRACT="refract";He.SMOOTHSTEP="smoothstep";He.FACEFORWARD="faceforward";const TL=ge(1e-6),fJ=ge(1e6),Z_=ge(Math.PI),AJ=ge(Math.PI*2),VM=ht(He,He.ALL),wL=ht(He,He.ANY),ML=ht(He,He.RADIANS),EL=ht(He,He.DEGREES),HM=ht(He,He.EXP),O0=ht(He,He.EXP2),Oy=ht(He,He.LOG),cu=ht(He,He.LOG2),Cu=ht(He,He.SQRT),jM=ht(He,He.INVERSE_SQRT),hu=ht(He,He.FLOOR),Iy=ht(He,He.CEIL),Fc=ht(He,He.NORMALIZE),Hc=ht(He,He.FRACT),Mo=ht(He,He.SIN),yc=ht(He,He.COS),CL=ht(He,He.TAN),RL=ht(He,He.ASIN),NL=ht(He,He.ACOS),WM=ht(He,He.ATAN),ur=ht(He,He.ABS),Cg=ht(He,He.SIGN),Rc=ht(He,He.LENGTH),DL=ht(He,He.NEGATE),PL=ht(He,He.ONE_MINUS),$M=ht(He,He.DFDX),XM=ht(He,He.DFDY),LL=ht(He,He.ROUND),UL=ht(He,He.RECIPROCAL),YM=ht(He,He.TRUNC),BL=ht(He,He.FWIDTH),OL=ht(He,He.TRANSPOSE),dJ=ht(He,He.BITCAST),IL=ht(He,He.EQUALS),to=ht(He,He.MIN),qr=ht(He,He.MAX),QM=ht(He,He.MOD),Fy=ht(He,He.STEP),FL=ht(He,He.REFLECT),kL=ht(He,He.DISTANCE),zL=ht(He,He.DIFFERENCE),Xh=ht(He,He.DOT),ky=ht(He,He.CROSS),Cl=ht(He,He.POW),KM=ht(He,He.POW,2),GL=ht(He,He.POW,3),qL=ht(He,He.POW,4),VL=ht(He,He.TRANSFORM_DIRECTION),HL=i=>Wn(Cg(i),Cl(ur(i),1/3)),jL=i=>Xh(i,i),Fi=ht(He,He.MIX),vu=(i,e=0,t=1)=>gt(new He(He.CLAMP,gt(i),gt(e),gt(t))),WL=i=>vu(i),ZM=ht(He,He.REFRACT),kc=ht(He,He.SMOOTHSTEP),JM=ht(He,He.FACEFORWARD),$L=je(([i])=>{const n=43758.5453,r=Xh(i.xy,Et(12.9898,78.233)),s=QM(r,Z_);return Hc(Mo(s).mul(n))}),XL=(i,e,t)=>Fi(e,t,i),YL=(i,e,t)=>kc(e,t,i),QL=(i,e)=>(console.warn('THREE.TSL: "atan2" is overloaded. Use "atan" instead.'),WM(i,e)),pJ=JM,mJ=jM;ct("all",VM);ct("any",wL);ct("equals",IL);ct("radians",ML);ct("degrees",EL);ct("exp",HM);ct("exp2",O0);ct("log",Oy);ct("log2",cu);ct("sqrt",Cu);ct("inverseSqrt",jM);ct("floor",hu);ct("ceil",Iy);ct("normalize",Fc);ct("fract",Hc);ct("sin",Mo);ct("cos",yc);ct("tan",CL);ct("asin",RL);ct("acos",NL);ct("atan",WM);ct("abs",ur);ct("sign",Cg);ct("length",Rc);ct("lengthSq",jL);ct("negate",DL);ct("oneMinus",PL);ct("dFdx",$M);ct("dFdy",XM);ct("round",LL);ct("reciprocal",UL);ct("trunc",YM);ct("fwidth",BL);ct("atan2",QL);ct("min",to);ct("max",qr);ct("mod",QM);ct("step",Fy);ct("reflect",FL);ct("distance",kL);ct("dot",Xh);ct("cross",ky);ct("pow",Cl);ct("pow2",KM);ct("pow3",GL);ct("pow4",qL);ct("transformDirection",VL);ct("mix",XL);ct("clamp",vu);ct("refract",ZM);ct("smoothstep",YL);ct("faceForward",JM);ct("difference",zL);ct("saturate",WL);ct("cbrt",HL);ct("transpose",OL);ct("rand",$L);class gJ extends Mn{static get type(){return"ConditionalNode"}constructor(e,t,n=null){super(),this.condNode=e,this.ifNode=t,this.elseNode=n}getNodeType(e){const{ifNode:t,elseNode:n}=e.getNodeProperties(this);if(t===void 0)return this.setup(e),this.getNodeType(e);const r=t.getNodeType(e);if(n!==null){const s=n.getNodeType(e);if(e.getTypeLength(s)>e.getTypeLength(r))return s}return r}setup(e){const t=this.condNode.cache(),n=this.ifNode.cache(),r=this.elseNode?this.elseNode.cache():null,s=e.context.nodeBlock;e.getDataFromNode(n).parentNodeBlock=s,r!==null&&(e.getDataFromNode(r).parentNodeBlock=s);const a=e.getNodeProperties(this);a.condNode=t,a.ifNode=n.context({nodeBlock:n}),a.elseNode=r?r.context({nodeBlock:r}):null}generate(e,t){const n=this.getNodeType(e),r=e.getDataFromNode(this);if(r.nodeProperty!==void 0)return r.nodeProperty;const{condNode:s,ifNode:a,elseNode:l}=e.getNodeProperties(this),u=t!=="void",h=u?sL(n).build(e):"";r.nodeProperty=h;const g=s.build(e,"bool");e.addFlowCode(` ${e.tab}if ( ${g} ) { `).addFlowTab();let v=a.build(e,n);if(v&&(u?v=h+" = "+v+";":v="return "+v+";"),e.removeFlowTab().addFlowCode(e.tab+" "+v+` @@ -3901,21 +3901,21 @@ ${e.tab}if ( ${g} ) { `)}else e.addFlowCode(` -`);return e.format(h,n,t)}}const zs=ct(gJ);ut("select",zs);const KL=(...i)=>(console.warn("TSL.ConditionalNode: cond() has been renamed to select()."),zs(...i));ut("cond",KL);class ZL extends Mn{static get type(){return"ContextNode"}constructor(e,t={}){super(),this.isContextNode=!0,this.node=e,this.value=t}getScope(){return this.node.getScope()}getNodeType(e){return this.node.getNodeType(e)}analyze(e){this.node.build(e)}setup(e){const t=e.getContext();e.setContext({...e.context,...this.value});const n=this.node.build(e);return e.setContext(t),n}generate(e,t){const n=e.getContext();e.setContext({...e.context,...this.value});const r=this.node.build(e,t);return e.setContext(n),r}}const zy=ct(ZL),JL=(i,e)=>zy(i,{label:e});ut("context",zy);ut("label",JL);class Kv extends Mn{static get type(){return"VarNode"}constructor(e,t=null){super(),this.node=e,this.name=t,this.global=!0,this.isVarNode=!0}getHash(e){return this.name||super.getHash(e)}getNodeType(e){return this.node.getNodeType(e)}generate(e){const{node:t,name:n}=this,r=e.getVarFromNode(this,n,e.getVectorType(this.getNodeType(e))),s=e.getPropertyName(r),a=t.build(e,r.type);return e.addLineFlowCode(`${s} = ${a}`,this),s}}const e9=ct(Kv);ut("toVar",(...i)=>e9(...i).append());const t9=i=>(console.warn('TSL: "temp" is deprecated. Use ".toVar()" instead.'),e9(i));ut("temp",t9);class vJ extends Mn{static get type(){return"VaryingNode"}constructor(e,t=null){super(),this.node=e,this.name=t,this.isVaryingNode=!0}isGlobal(){return!0}getHash(e){return this.name||super.getHash(e)}getNodeType(e){return this.node.getNodeType(e)}setupVarying(e){const t=e.getNodeProperties(this);let n=t.varying;if(n===void 0){const r=this.name,s=this.getNodeType(e);t.varying=n=e.getVaryingFromNode(this,r,s),t.node=this.node}return n.needsInterpolation||(n.needsInterpolation=e.shaderStage==="fragment"),n}setup(e){this.setupVarying(e)}analyze(e){return this.setupVarying(e),this.node.analyze(e)}generate(e){const t=e.getNodeProperties(this),n=this.setupVarying(e),r=e.shaderStage==="fragment"&&t.reassignPosition===!0&&e.context.needsPositionReassign;if(t.propertyName===void 0||r){const s=this.getNodeType(e),a=e.getPropertyName(n,OT.VERTEX);e.flowNodeFromShaderStage(OT.VERTEX,this.node,s,a),t.propertyName=a,r?t.reassignPosition=!1:t.reassignPosition===void 0&&e.context.isPositionNodeInput&&(t.reassignPosition=!0)}return e.getPropertyName(n)}}const ro=ct(vJ),n9=i=>ro(i);ut("varying",ro);ut("vertexStage",n9);const i9=je(([i])=>{const e=i.mul(.9478672986).add(.0521327014).pow(2.4),t=i.mul(.0773993808),n=i.lessThanEqual(.04045);return Fi(e,t,n)}).setLayout({name:"sRGBTransferEOTF",type:"vec3",inputs:[{name:"color",type:"vec3"}]}),r9=je(([i])=>{const e=i.pow(.41666).mul(1.055).sub(.055),t=i.mul(12.92),n=i.lessThanEqual(.0031308);return Fi(e,t,n)}).setLayout({name:"sRGBTransferOETF",type:"vec3",inputs:[{name:"color",type:"vec3"}]}),jg="WorkingColorSpace",eE="OutputColorSpace";class Wg extends Zr{static get type(){return"ColorSpaceNode"}constructor(e,t,n){super("vec4"),this.colorNode=e,this.source=t,this.target=n}resolveColorSpace(e,t){return t===jg?ai.workingColorSpace:t===eE?e.context.outputColorSpace||e.renderer.outputColorSpace:t}setup(e){const{colorNode:t}=this,n=this.resolveColorSpace(e,this.source),r=this.resolveColorSpace(e,this.target);let s=t;return ai.enabled===!1||n===r||!n||!r||(ai.getTransfer(n)===Vi&&(s=dn(i9(s.rgb),s.a)),ai.getPrimaries(n)!==ai.getPrimaries(r)&&(s=dn(ha(ai._getMatrix(new Vn,n,r)).mul(s.rgb),s.a)),ai.getTransfer(r)===Vi&&(s=dn(r9(s.rgb),s.a))),s}}const s9=i=>mt(new Wg(mt(i),jg,eE)),a9=i=>mt(new Wg(mt(i),eE,jg)),o9=(i,e)=>mt(new Wg(mt(i),jg,e)),tE=(i,e)=>mt(new Wg(mt(i),e,jg)),_J=(i,e,t)=>mt(new Wg(mt(i),e,t));ut("toOutputColorSpace",s9);ut("toWorkingColorSpace",a9);ut("workingToColorSpace",o9);ut("colorSpaceToWorking",tE);let yJ=class extends vA{static get type(){return"ReferenceElementNode"}constructor(e,t){super(e,t),this.referenceNode=e,this.isReferenceElementNode=!0}getNodeType(){return this.referenceNode.uniformType}generate(e){const t=super.generate(e),n=this.referenceNode.getNodeType(),r=this.getNodeType();return e.format(t,n,r)}};class l9 extends Mn{static get type(){return"ReferenceBaseNode"}constructor(e,t,n=null,r=null){super(),this.property=e,this.uniformType=t,this.object=n,this.count=r,this.properties=e.split("."),this.reference=n,this.node=null,this.group=null,this.updateType=jn.OBJECT}setGroup(e){return this.group=e,this}element(e){return mt(new yJ(this,mt(e)))}setNodeType(e){const t=gn(null,e).getSelf();this.group!==null&&t.setGroup(this.group),this.node=t}getNodeType(e){return this.node===null&&(this.updateReference(e),this.updateValue()),this.node.getNodeType(e)}getValueFromReference(e=this.reference){const{properties:t}=this;let n=e[t[0]];for(let r=1;rmt(new l9(i,e,t));class bJ extends l9{static get type(){return"RendererReferenceNode"}constructor(e,t,n=null){super(e,t,n),this.renderer=n,this.setGroup(Rn)}updateReference(e){return this.reference=this.renderer!==null?this.renderer:e.renderer,this.reference}}const u9=(i,e,t=null)=>mt(new bJ(i,e,t));class SJ extends Zr{static get type(){return"ToneMappingNode"}constructor(e,t=h9,n=null){super("vec3"),this.toneMapping=e,this.exposureNode=t,this.colorNode=n}customCacheKey(){return MM(this.toneMapping)}setup(e){const t=this.colorNode||e.context.color,n=this.toneMapping;if(n===Za)return t;let r=null;const s=e.renderer.library.getToneMappingFunction(n);return s!==null?r=dn(s(t.rgb,this.exposureNode),t.a):(console.error("ToneMappingNode: Unsupported Tone Mapping configuration.",n),r=t),r}}const c9=(i,e,t)=>mt(new SJ(i,mt(e),mt(t))),h9=u9("toneMappingExposure","float");ut("toneMapping",(i,e,t)=>c9(e,t,i));class TJ extends EM{static get type(){return"BufferAttributeNode"}constructor(e,t=null,n=0,r=0){super(e,t),this.isBufferNode=!0,this.bufferType=t,this.bufferStride=n,this.bufferOffset=r,this.usage=o_,this.instanced=!1,this.attribute=null,this.global=!0,e&&e.isBufferAttribute===!0&&(this.attribute=e,this.usage=e.usage,this.instanced=e.isInstancedBufferAttribute)}getHash(e){if(this.bufferStride===0&&this.bufferOffset===0){let t=e.globalCache.getData(this.value);return t===void 0&&(t={node:this},e.globalCache.setData(this.value,t)),t.node.uuid}return this.uuid}getNodeType(e){return this.bufferType===null&&(this.bufferType=e.getTypeFromAttribute(this.attribute)),this.bufferType}setup(e){if(this.attribute!==null)return;const t=this.getNodeType(e),n=this.value,r=e.getTypeLength(t),s=this.bufferStride||r,a=this.bufferOffset,l=n.isInterleavedBuffer===!0?n:new Yw(n,s),u=new nu(l,r,a);l.setUsage(this.usage),this.attribute=u,this.attribute.isInstancedBufferAttribute=this.instanced}generate(e){const t=this.getNodeType(e),n=e.getBufferAttributeFromNode(this,t),r=e.getPropertyName(n);let s=null;return e.shaderStage==="vertex"||e.shaderStage==="compute"?(this.name=r,s=r):s=ro(this).build(e,t),s}getInputType(){return"bufferAttribute"}setUsage(e){return this.usage=e,this.attribute&&this.attribute.isBufferAttribute===!0&&(this.attribute.usage=e),this}setInstanced(e){return this.instanced=e,this}}const $g=(i,e=null,t=0,n=0)=>mt(new TJ(i,e,t,n)),f9=(i,e=null,t=0,n=0)=>$g(i,e,t,n).setUsage(qd),J_=(i,e=null,t=0,n=0)=>$g(i,e,t,n).setInstanced(!0),VT=(i,e=null,t=0,n=0)=>f9(i,e,t,n).setInstanced(!0);ut("toAttribute",i=>$g(i.value));class wJ extends Mn{static get type(){return"ComputeNode"}constructor(e,t,n=[64]){super("void"),this.isComputeNode=!0,this.computeNode=e,this.count=t,this.workgroupSize=n,this.dispatchCount=0,this.version=1,this.name="",this.updateBeforeType=jn.OBJECT,this.onInitFunction=null,this.updateDispatchCount()}dispose(){this.dispatchEvent({type:"dispose"})}label(e){return this.name=e,this}updateDispatchCount(){const{count:e,workgroupSize:t}=this;let n=t[0];for(let r=1;rmt(new wJ(mt(i),e,t));ut("compute",A9);class MJ extends Mn{static get type(){return"CacheNode"}constructor(e,t=!0){super(),this.node=e,this.parent=t,this.isCacheNode=!0}getNodeType(e){const t=e.getCache(),n=e.getCacheFromNode(this,this.parent);e.setCache(n);const r=this.node.getNodeType(e);return e.setCache(t),r}build(e,...t){const n=e.getCache(),r=e.getCacheFromNode(this,this.parent);e.setCache(r);const s=this.node.build(e,...t);return e.setCache(n),s}}const Im=(i,e)=>mt(new MJ(mt(i),e));ut("cache",Im);class EJ extends Mn{static get type(){return"BypassNode"}constructor(e,t){super(),this.isBypassNode=!0,this.outputNode=e,this.callNode=t}getNodeType(e){return this.outputNode.getNodeType(e)}generate(e){const t=this.callNode.build(e,"void");return t!==""&&e.addLineFlowCode(t,this),this.outputNode.build(e)}}const d9=ct(EJ);ut("bypass",d9);class p9 extends Mn{static get type(){return"RemapNode"}constructor(e,t,n,r=ge(0),s=ge(1)){super(),this.node=e,this.inLowNode=t,this.inHighNode=n,this.outLowNode=r,this.outHighNode=s,this.doClamp=!0}setup(){const{node:e,inLowNode:t,inHighNode:n,outLowNode:r,outHighNode:s,doClamp:a}=this;let l=e.sub(t).div(n.sub(t));return a===!0&&(l=l.clamp()),l.mul(s.sub(r)).add(r)}}const m9=ct(p9,null,null,{doClamp:!1}),g9=ct(p9);ut("remap",m9);ut("remapClamp",g9);class Zv extends Mn{static get type(){return"ExpressionNode"}constructor(e="",t="void"){super(t),this.snippet=e}generate(e,t){const n=this.getNodeType(e),r=this.snippet;if(n==="void")e.addLineFlowCode(r,this);else return e.format(`( ${r} )`,n,t)}}const Hh=ct(Zv),v9=i=>(i?zs(i,Hh("discard")):Hh("discard")).append(),CJ=()=>Hh("return").append();ut("discard",v9);class RJ extends Zr{static get type(){return"RenderOutputNode"}constructor(e,t,n){super("vec4"),this.colorNode=e,this.toneMapping=t,this.outputColorSpace=n,this.isRenderOutputNode=!0}setup({context:e}){let t=this.colorNode||e.color;const n=(this.toneMapping!==null?this.toneMapping:e.toneMapping)||Za,r=(this.outputColorSpace!==null?this.outputColorSpace:e.outputColorSpace)||Co;return n!==Za&&(t=t.toneMapping(n)),r!==Co&&r!==ai.workingColorSpace&&(t=t.workingToColorSpace(r)),t}}const _9=(i,e=null,t=null)=>mt(new RJ(mt(i),e,t));ut("renderOutput",_9);function NJ(i){console.warn("THREE.TSLBase: AddNodeElement has been removed in favor of tree-shaking. Trying add",i)}class y9 extends Mn{static get type(){return"AttributeNode"}constructor(e,t=null){super(t),this.global=!0,this._attributeName=e}getHash(e){return this.getAttributeName(e)}getNodeType(e){let t=this.nodeType;if(t===null){const n=this.getAttributeName(e);if(e.hasGeometryAttribute(n)){const r=e.geometry.getAttribute(n);t=e.getTypeFromAttribute(r)}else t="float"}return t}setAttributeName(e){return this._attributeName=e,this}getAttributeName(){return this._attributeName}generate(e){const t=this.getAttributeName(e),n=this.getNodeType(e);if(e.hasGeometryAttribute(t)===!0){const s=e.geometry.getAttribute(t),a=e.getTypeFromAttribute(s),l=e.getAttribute(t,a);return e.shaderStage==="vertex"?e.format(l.name,a,n):ro(this).build(e,n)}else return console.warn(`AttributeNode: Vertex attribute "${t}" not found on geometry.`),e.generateConst(n)}serialize(e){super.serialize(e),e.global=this.global,e._attributeName=this._attributeName}deserialize(e){super.deserialize(e),this.global=e.global,this._attributeName=e._attributeName}}const _u=(i,e)=>mt(new y9(i,e)),Er=(i=0)=>_u("uv"+(i>0?i:""),"vec2");class DJ extends Mn{static get type(){return"TextureSizeNode"}constructor(e,t=null){super("uvec2"),this.isTextureSizeNode=!0,this.textureNode=e,this.levelNode=t}generate(e,t){const n=this.textureNode.build(e,"property"),r=this.levelNode===null?"0":this.levelNode.build(e,"int");return e.format(`${e.getMethod("textureDimensions")}( ${n}, ${r} )`,this.getNodeType(e),t)}}const Fh=ct(DJ);class PJ extends Hg{static get type(){return"MaxMipLevelNode"}constructor(e){super(0),this._textureNode=e,this.updateType=jn.FRAME}get textureNode(){return this._textureNode}get texture(){return this._textureNode.value}update(){const e=this.texture,t=e.images,n=t&&t.length>0?t[0]&&t[0].image||t[0]:e.image;if(n&&n.width!==void 0){const{width:r,height:s}=n;this.value=Math.log2(Math.max(r,s))}}}const x9=ct(PJ);class yu extends Hg{static get type(){return"TextureNode"}constructor(e,t=null,n=null,r=null){super(e),this.isTextureNode=!0,this.uvNode=t,this.levelNode=n,this.biasNode=r,this.compareNode=null,this.depthNode=null,this.gradNode=null,this.sampler=!0,this.updateMatrix=!1,this.updateType=jn.NONE,this.referenceNode=null,this._value=e,this._matrixUniform=null,this.setUpdateMatrix(t===null)}set value(e){this.referenceNode?this.referenceNode.value=e:this._value=e}get value(){return this.referenceNode?this.referenceNode.value:this._value}getUniformHash(){return this.value.uuid}getNodeType(){return this.value.isDepthTexture===!0?"float":this.value.type===Rr?"uvec4":this.value.type===Ns?"ivec4":"vec4"}getInputType(){return"texture"}getDefaultUV(){return Er(this.value.channel)}updateReference(){return this.value}getTransformedUV(e){return this._matrixUniform===null&&(this._matrixUniform=gn(this.value.matrix)),this._matrixUniform.mul(Ne(e,1)).xy}setUpdateMatrix(e){return this.updateMatrix=e,this.updateType=e?jn.RENDER:jn.NONE,this}setupUV(e,t){const n=this.value;return e.isFlipY()&&(n.image instanceof ImageBitmap&&n.flipY===!0||n.isRenderTargetTexture===!0||n.isFramebufferTexture===!0||n.isDepthTexture===!0)&&(this.sampler?t=t.flipY():t=t.setY(ye(Fh(this,this.levelNode).y).sub(t.y).sub(1))),t}setup(e){const t=e.getNodeProperties(this);t.referenceNode=this.referenceNode;const n=this.value;if(!n||n.isTexture!==!0)throw new Error("THREE.TSL: `texture( value )` function expects a valid instance of THREE.Texture().");let r=this.uvNode;(r===null||e.context.forceUVContext===!0)&&e.context.getUV&&(r=e.context.getUV(this)),r||(r=this.getDefaultUV()),this.updateMatrix===!0&&(r=this.getTransformedUV(r)),r=this.setupUV(e,r);let s=this.levelNode;s===null&&e.context.getTextureLevel&&(s=e.context.getTextureLevel(this)),t.uvNode=r,t.levelNode=s,t.biasNode=this.biasNode,t.compareNode=this.compareNode,t.gradNode=this.gradNode,t.depthNode=this.depthNode}generateUV(e,t){return t.build(e,this.sampler===!0?"vec2":"ivec2")}generateSnippet(e,t,n,r,s,a,l,u){const h=this.value;let g;return r?g=e.generateTextureLevel(h,t,n,r,a):s?g=e.generateTextureBias(h,t,n,s,a):u?g=e.generateTextureGrad(h,t,n,u,a):l?g=e.generateTextureCompare(h,t,n,l,a):this.sampler===!1?g=e.generateTextureLoad(h,t,n,a):g=e.generateTexture(h,t,n,a),g}generate(e,t){const n=this.value,r=e.getNodeProperties(this),s=super.generate(e,"property");if(t==="sampler")return s+"_sampler";if(e.isReference(t))return s;{const a=e.getDataFromNode(this);let l=a.propertyName;if(l===void 0){const{uvNode:g,levelNode:v,biasNode:x,compareNode:S,depthNode:w,gradNode:R}=r,C=this.generateUV(e,g),E=v?v.build(e,"float"):null,B=x?x.build(e,"float"):null,L=w?w.build(e,"int"):null,O=S?S.build(e,"float"):null,z=R?[R[0].build(e,"vec2"),R[1].build(e,"vec2")]:null,G=e.getVarFromNode(this);l=e.getPropertyName(G);const k=this.generateSnippet(e,s,C,E,B,L,O,z);e.addLineFlowCode(`${l} = ${k}`,this),a.snippet=k,a.propertyName=l}let u=l;const h=this.getNodeType(e);return e.needsToWorkingColorSpace(n)&&(u=tE(Hh(u,h),n.colorSpace).setup(e).build(e,h)),e.format(u,h,t)}}setSampler(e){return this.sampler=e,this}getSampler(){return this.sampler}uv(e){return console.warn("THREE.TextureNode: .uv() has been renamed. Use .sample() instead."),this.sample(e)}sample(e){const t=this.clone();return t.uvNode=mt(e),t.referenceNode=this.getSelf(),mt(t)}blur(e){const t=this.clone();return t.biasNode=mt(e).mul(x9(t)),t.referenceNode=this.getSelf(),mt(t)}level(e){const t=this.clone();return t.levelNode=mt(e),t.referenceNode=this.getSelf(),mt(t)}size(e){return Fh(this,e)}bias(e){const t=this.clone();return t.biasNode=mt(e),t.referenceNode=this.getSelf(),mt(t)}compare(e){const t=this.clone();return t.compareNode=mt(e),t.referenceNode=this.getSelf(),mt(t)}grad(e,t){const n=this.clone();return n.gradNode=[mt(e),mt(t)],n.referenceNode=this.getSelf(),mt(n)}depth(e){const t=this.clone();return t.depthNode=mt(e),t.referenceNode=this.getSelf(),mt(t)}serialize(e){super.serialize(e),e.value=this.value.toJSON(e.meta).uuid,e.sampler=this.sampler,e.updateMatrix=this.updateMatrix,e.updateType=this.updateType}deserialize(e){super.deserialize(e),this.value=e.meta.textures[e.value],this.sampler=e.sampler,this.updateMatrix=e.updateMatrix,this.updateType=e.updateType}update(){const e=this.value,t=this._matrixUniform;t!==null&&(t.value=e.matrix),e.matrixAutoUpdate===!0&&e.updateMatrix()}clone(){const e=new this.constructor(this.value,this.uvNode,this.levelNode,this.biasNode);return e.sampler=this.sampler,e}}const Ai=ct(yu),Fr=(...i)=>Ai(...i).setSampler(!1),LJ=i=>(i.isNode===!0?i:Ai(i)).convert("sampler"),Dh=gn("float").label("cameraNear").setGroup(Rn).onRenderUpdate(({camera:i})=>i.near),Ph=gn("float").label("cameraFar").setGroup(Rn).onRenderUpdate(({camera:i})=>i.far),_A=gn("mat4").label("cameraProjectionMatrix").setGroup(Rn).onRenderUpdate(({camera:i})=>i.projectionMatrix),UJ=gn("mat4").label("cameraProjectionMatrixInverse").setGroup(Rn).onRenderUpdate(({camera:i})=>i.projectionMatrixInverse),so=gn("mat4").label("cameraViewMatrix").setGroup(Rn).onRenderUpdate(({camera:i})=>i.matrixWorldInverse),BJ=gn("mat4").label("cameraWorldMatrix").setGroup(Rn).onRenderUpdate(({camera:i})=>i.matrixWorld),OJ=gn("mat3").label("cameraNormalMatrix").setGroup(Rn).onRenderUpdate(({camera:i})=>i.normalMatrix),b9=gn(new ce).label("cameraPosition").setGroup(Rn).onRenderUpdate(({camera:i},e)=>e.value.setFromMatrixPosition(i.matrixWorld));class Li extends Mn{static get type(){return"Object3DNode"}constructor(e,t=null){super(),this.scope=e,this.object3d=t,this.updateType=jn.OBJECT,this._uniformNode=new Hg(null)}getNodeType(){const e=this.scope;if(e===Li.WORLD_MATRIX)return"mat4";if(e===Li.POSITION||e===Li.VIEW_POSITION||e===Li.DIRECTION||e===Li.SCALE)return"vec3"}update(e){const t=this.object3d,n=this._uniformNode,r=this.scope;if(r===Li.WORLD_MATRIX)n.value=t.matrixWorld;else if(r===Li.POSITION)n.value=n.value||new ce,n.value.setFromMatrixPosition(t.matrixWorld);else if(r===Li.SCALE)n.value=n.value||new ce,n.value.setFromMatrixScale(t.matrixWorld);else if(r===Li.DIRECTION)n.value=n.value||new ce,t.getWorldDirection(n.value);else if(r===Li.VIEW_POSITION){const s=e.camera;n.value=n.value||new ce,n.value.setFromMatrixPosition(t.matrixWorld),n.value.applyMatrix4(s.matrixWorldInverse)}}generate(e){const t=this.scope;return t===Li.WORLD_MATRIX?this._uniformNode.nodeType="mat4":(t===Li.POSITION||t===Li.VIEW_POSITION||t===Li.DIRECTION||t===Li.SCALE)&&(this._uniformNode.nodeType="vec3"),this._uniformNode.build(e)}serialize(e){super.serialize(e),e.scope=this.scope}deserialize(e){super.deserialize(e),this.scope=e.scope}}Li.WORLD_MATRIX="worldMatrix";Li.POSITION="position";Li.SCALE="scale";Li.VIEW_POSITION="viewPosition";Li.DIRECTION="direction";const IJ=ct(Li,Li.DIRECTION),FJ=ct(Li,Li.WORLD_MATRIX),S9=ct(Li,Li.POSITION),kJ=ct(Li,Li.SCALE),zJ=ct(Li,Li.VIEW_POSITION);class xu extends Li{static get type(){return"ModelNode"}constructor(e){super(e)}update(e){this.object3d=e.object,super.update(e)}}const GJ=zt(xu,xu.DIRECTION),$o=zt(xu,xu.WORLD_MATRIX),qJ=zt(xu,xu.POSITION),VJ=zt(xu,xu.SCALE),HJ=zt(xu,xu.VIEW_POSITION),T9=gn(new Vn).onObjectUpdate(({object:i},e)=>e.value.getNormalMatrix(i.matrixWorld)),jJ=gn(new kn).onObjectUpdate(({object:i},e)=>e.value.copy(i.matrixWorld).invert()),Q0=je(i=>i.renderer.nodes.modelViewMatrix||w9).once()().toVar("modelViewMatrix"),w9=so.mul($o),WJ=je(i=>(i.context.isHighPrecisionModelViewMatrix=!0,gn("mat4").onObjectUpdate(({object:e,camera:t})=>e.modelViewMatrix.multiplyMatrices(t.matrixWorldInverse,e.matrixWorld)))).once()().toVar("highpModelViewMatrix"),$J=je(i=>{const e=i.context.isHighPrecisionModelViewMatrix;return gn("mat3").onObjectUpdate(({object:t,camera:n})=>(e!==!0&&t.modelViewMatrix.multiplyMatrices(n.matrixWorldInverse,t.matrixWorld),t.normalMatrix.getNormalMatrix(t.modelViewMatrix)))}).once()().toVar("highpModelNormalViewMatrix"),Gy=_u("position","vec3"),Gr=Gy.varying("positionLocal"),ey=Gy.varying("positionPrevious"),Nc=$o.mul(Gr).xyz.varying("v_positionWorld").context({needsPositionReassign:!0}),nE=Gr.transformDirection($o).varying("v_positionWorldDirection").normalize().toVar("positionWorldDirection").context({needsPositionReassign:!0}),Xr=je(i=>i.context.setupPositionView(),"vec3").once()().varying("v_positionView").context({needsPositionReassign:!0}),dr=Xr.negate().varying("v_positionViewDirection").normalize().toVar("positionViewDirection");class XJ extends Mn{static get type(){return"FrontFacingNode"}constructor(){super("bool"),this.isFrontFacingNode=!0}generate(e){const{renderer:t,material:n}=e;return t.coordinateSystem===Ha&&n.side===hr?"false":e.getFrontFacing()}}const M9=zt(XJ),Xg=ge(M9).mul(2).sub(1),qy=_u("normal","vec3"),no=je(i=>i.geometry.hasAttribute("normal")===!1?(console.warn('TSL.NormalNode: Vertex attribute "normal" not found on geometry.'),Ne(0,1,0)):qy,"vec3").once()().toVar("normalLocal"),E9=Xr.dFdx().cross(Xr.dFdy()).normalize().toVar("normalFlat"),Jo=je(i=>{let e;return i.material.flatShading===!0?e=E9:e=ro(iE(no),"v_normalView").normalize(),e},"vec3").once()().toVar("normalView"),Vy=ro(Jo.transformDirection(so),"v_normalWorld").normalize().toVar("normalWorld"),zr=je(i=>i.context.setupNormal(),"vec3").once()().mul(Xg).toVar("transformedNormalView"),Hy=zr.transformDirection(so).toVar("transformedNormalWorld"),Qd=je(i=>i.context.setupClearcoatNormal(),"vec3").once()().mul(Xg).toVar("transformedClearcoatNormalView"),C9=je(([i,e=$o])=>{const t=ha(e),n=i.div(Ne(t[0].dot(t[0]),t[1].dot(t[1]),t[2].dot(t[2])));return t.mul(n).xyz}),iE=je(([i],e)=>{const t=e.renderer.nodes.modelNormalViewMatrix;if(t!==null)return t.transformDirection(i);const n=T9.mul(i);return so.transformDirection(n)}),R9=gn(0).onReference(({material:i})=>i).onRenderUpdate(({material:i})=>i.refractionRatio),N9=dr.negate().reflect(zr),D9=dr.negate().refract(zr,R9),P9=N9.transformDirection(so).toVar("reflectVector"),L9=D9.transformDirection(so).toVar("reflectVector");class YJ extends yu{static get type(){return"CubeTextureNode"}constructor(e,t=null,n=null,r=null){super(e,t,n,r),this.isCubeTextureNode=!0}getInputType(){return"cubeTexture"}getDefaultUV(){const e=this.value;return e.mapping===Qo?P9:e.mapping===Ko?L9:(console.error('THREE.CubeTextureNode: Mapping "%s" not supported.',e.mapping),Ne(0,0,0))}setUpdateMatrix(){}setupUV(e,t){const n=this.value;return e.renderer.coordinateSystem===pu||!n.isRenderTargetTexture?Ne(t.x.negate(),t.yz):t}generateUV(e,t){return t.build(e,"vec3")}}const I0=ct(YJ);class rE extends Hg{static get type(){return"BufferNode"}constructor(e,t,n=0){super(e,t),this.isBufferNode=!0,this.bufferType=t,this.bufferCount=n}getElementType(e){return this.getNodeType(e)}getInputType(){return"buffer"}}const Yg=(i,e,t)=>mt(new rE(i,e,t));class QJ extends vA{static get type(){return"UniformArrayElementNode"}constructor(e,t){super(e,t),this.isArrayBufferElementNode=!0}generate(e){const t=super.generate(e),n=this.getNodeType(),r=this.node.getPaddedType();return e.format(t,r,n)}}class U9 extends rE{static get type(){return"UniformArrayNode"}constructor(e,t=null){super(null),this.array=e,this.elementType=t===null?Uh(e[0]):t,this.paddedType=this.getPaddedType(),this.updateType=jn.RENDER,this.isArrayBufferNode=!0}getNodeType(){return this.paddedType}getElementType(){return this.elementType}getPaddedType(){const e=this.elementType;let t="vec4";return e==="mat2"?t="mat2":/mat/.test(e)===!0?t="mat4":e.charAt(0)==="i"?t="ivec4":e.charAt(0)==="u"&&(t="uvec4"),t}update(){const{array:e,value:t}=this,n=this.elementType;if(n==="float"||n==="int"||n==="uint")for(let r=0;rmt(new U9(i,e)),KJ=(i,e)=>(console.warn("TSL.UniformArrayNode: uniforms() has been renamed to uniformArray()."),mt(new U9(i,e)));class ZJ extends vA{static get type(){return"ReferenceElementNode"}constructor(e,t){super(e,t),this.referenceNode=e,this.isReferenceElementNode=!0}getNodeType(){return this.referenceNode.uniformType}generate(e){const t=super.generate(e),n=this.referenceNode.getNodeType(),r=this.getNodeType();return e.format(t,n,r)}}class jy extends Mn{static get type(){return"ReferenceNode"}constructor(e,t,n=null,r=null){super(),this.property=e,this.uniformType=t,this.object=n,this.count=r,this.properties=e.split("."),this.reference=n,this.node=null,this.group=null,this.name=null,this.updateType=jn.OBJECT}element(e){return mt(new ZJ(this,mt(e)))}setGroup(e){return this.group=e,this}label(e){return this.name=e,this}setNodeType(e){let t=null;this.count!==null?t=Yg(null,e,this.count):Array.isArray(this.getValueFromReference())?t=Sc(null,e):e==="texture"?t=Ai(null):e==="cubeTexture"?t=I0(null):t=gn(null,e),this.group!==null&&t.setGroup(this.group),this.name!==null&&t.label(this.name),this.node=t.getSelf()}getNodeType(e){return this.node===null&&(this.updateReference(e),this.updateValue()),this.node.getNodeType(e)}getValueFromReference(e=this.reference){const{properties:t}=this;let n=e[t[0]];for(let r=1;rmt(new jy(i,e,t)),HT=(i,e,t,n)=>mt(new jy(i,e,n,t));class JJ extends jy{static get type(){return"MaterialReferenceNode"}constructor(e,t,n=null){super(e,t,n),this.material=n,this.isMaterialReferenceNode=!0}updateReference(e){return this.reference=this.material!==null?this.material:e.material,this.reference}}const Tc=(i,e,t=null)=>mt(new JJ(i,e,t)),Wy=je(i=>(i.geometry.hasAttribute("tangent")===!1&&i.geometry.computeTangents(),_u("tangent","vec4")))(),Qg=Wy.xyz.toVar("tangentLocal"),Kg=Q0.mul(dn(Qg,0)).xyz.varying("v_tangentView").normalize().toVar("tangentView"),B9=Kg.transformDirection(so).varying("v_tangentWorld").normalize().toVar("tangentWorld"),sE=Kg.toVar("transformedTangentView"),eee=sE.transformDirection(so).normalize().toVar("transformedTangentWorld"),Zg=i=>i.mul(Wy.w).xyz,tee=ro(Zg(qy.cross(Wy)),"v_bitangentGeometry").normalize().toVar("bitangentGeometry"),nee=ro(Zg(no.cross(Qg)),"v_bitangentLocal").normalize().toVar("bitangentLocal"),O9=ro(Zg(Jo.cross(Kg)),"v_bitangentView").normalize().toVar("bitangentView"),iee=ro(Zg(Vy.cross(B9)),"v_bitangentWorld").normalize().toVar("bitangentWorld"),I9=Zg(zr.cross(sE)).normalize().toVar("transformedBitangentView"),ree=I9.transformDirection(so).normalize().toVar("transformedBitangentWorld"),Yf=ha(Kg,O9,Jo),F9=dr.mul(Yf),see=(i,e)=>i.sub(F9.mul(e)),k9=(()=>{let i=iA.cross(dr);return i=i.cross(iA).normalize(),i=Fi(i,zr,Rh.mul(Zl.oneMinus()).oneMinus().pow2().pow2()).normalize(),i})(),aee=je(i=>{const{eye_pos:e,surf_norm:t,mapN:n,uv:r}=i,s=e.dFdx(),a=e.dFdy(),l=r.dFdx(),u=r.dFdy(),h=t,g=a.cross(h),v=h.cross(s),x=g.mul(l.x).add(v.mul(u.x)),S=g.mul(l.y).add(v.mul(u.y)),w=x.dot(x).max(S.dot(S)),R=Xg.mul(w.inverseSqrt());return Qr(x.mul(n.x,R),S.mul(n.y,R),h.mul(n.z)).normalize()});class oee extends Zr{static get type(){return"NormalMapNode"}constructor(e,t=null){super("vec3"),this.node=e,this.scaleNode=t,this.normalMapType=Dc}setup(e){const{normalMapType:t,scaleNode:n}=this;let r=this.node.mul(2).sub(1);n!==null&&(r=Ne(r.xy.mul(n),r.z));let s=null;return t===B7?s=iE(r):t===Dc&&(e.hasGeometryAttribute("tangent")===!0?s=Yf.mul(r).normalize():s=aee({eye_pos:Xr,surf_norm:Jo,mapN:r,uv:Er()})),s}}const jT=ct(oee),lee=je(({textureNode:i,bumpScale:e})=>{const t=r=>i.cache().context({getUV:s=>r(s.uvNode||Er()),forceUVContext:!0}),n=ge(t(r=>r));return Et(ge(t(r=>r.add(r.dFdx()))).sub(n),ge(t(r=>r.add(r.dFdy()))).sub(n)).mul(e)}),uee=je(i=>{const{surf_pos:e,surf_norm:t,dHdxy:n}=i,r=e.dFdx().normalize(),s=e.dFdy().normalize(),a=t,l=s.cross(a),u=a.cross(r),h=r.dot(l).mul(Xg),g=h.sign().mul(n.x.mul(l).add(n.y.mul(u)));return h.abs().mul(t).sub(g).normalize()});class cee extends Zr{static get type(){return"BumpMapNode"}constructor(e,t=null){super("vec3"),this.textureNode=e,this.scaleNode=t}setup(){const e=this.scaleNode!==null?this.scaleNode:1,t=lee({textureNode:this.textureNode,bumpScale:e});return uee({surf_pos:Xr,surf_norm:Jo,dHdxy:t})}}const z9=ct(cee),LR=new Map;class st extends Mn{static get type(){return"MaterialNode"}constructor(e){super(),this.scope=e}getCache(e,t){let n=LR.get(e);return n===void 0&&(n=Tc(e,t),LR.set(e,n)),n}getFloat(e){return this.getCache(e,"float")}getColor(e){return this.getCache(e,"color")}getTexture(e){return this.getCache(e==="map"?"map":e+"Map","texture")}setup(e){const t=e.context.material,n=this.scope;let r=null;if(n===st.COLOR){const s=t.color!==void 0?this.getColor(n):Ne();t.map&&t.map.isTexture===!0?r=s.mul(this.getTexture("map")):r=s}else if(n===st.OPACITY){const s=this.getFloat(n);t.alphaMap&&t.alphaMap.isTexture===!0?r=s.mul(this.getTexture("alpha")):r=s}else if(n===st.SPECULAR_STRENGTH)t.specularMap&&t.specularMap.isTexture===!0?r=this.getTexture("specular").r:r=ge(1);else if(n===st.SPECULAR_INTENSITY){const s=this.getFloat(n);t.specularIntensityMap&&t.specularIntensityMap.isTexture===!0?r=s.mul(this.getTexture(n).a):r=s}else if(n===st.SPECULAR_COLOR){const s=this.getColor(n);t.specularColorMap&&t.specularColorMap.isTexture===!0?r=s.mul(this.getTexture(n).rgb):r=s}else if(n===st.ROUGHNESS){const s=this.getFloat(n);t.roughnessMap&&t.roughnessMap.isTexture===!0?r=s.mul(this.getTexture(n).g):r=s}else if(n===st.METALNESS){const s=this.getFloat(n);t.metalnessMap&&t.metalnessMap.isTexture===!0?r=s.mul(this.getTexture(n).b):r=s}else if(n===st.EMISSIVE){const s=this.getFloat("emissiveIntensity"),a=this.getColor(n).mul(s);t.emissiveMap&&t.emissiveMap.isTexture===!0?r=a.mul(this.getTexture(n)):r=a}else if(n===st.NORMAL)t.normalMap?(r=jT(this.getTexture("normal"),this.getCache("normalScale","vec2")),r.normalMapType=t.normalMapType):t.bumpMap?r=z9(this.getTexture("bump").r,this.getFloat("bumpScale")):r=Jo;else if(n===st.CLEARCOAT){const s=this.getFloat(n);t.clearcoatMap&&t.clearcoatMap.isTexture===!0?r=s.mul(this.getTexture(n).r):r=s}else if(n===st.CLEARCOAT_ROUGHNESS){const s=this.getFloat(n);t.clearcoatRoughnessMap&&t.clearcoatRoughnessMap.isTexture===!0?r=s.mul(this.getTexture(n).r):r=s}else if(n===st.CLEARCOAT_NORMAL)t.clearcoatNormalMap?r=jT(this.getTexture(n),this.getCache(n+"Scale","vec2")):r=Jo;else if(n===st.SHEEN){const s=this.getColor("sheenColor").mul(this.getFloat("sheen"));t.sheenColorMap&&t.sheenColorMap.isTexture===!0?r=s.mul(this.getTexture("sheenColor").rgb):r=s}else if(n===st.SHEEN_ROUGHNESS){const s=this.getFloat(n);t.sheenRoughnessMap&&t.sheenRoughnessMap.isTexture===!0?r=s.mul(this.getTexture(n).a):r=s,r=r.clamp(.07,1)}else if(n===st.ANISOTROPY)if(t.anisotropyMap&&t.anisotropyMap.isTexture===!0){const s=this.getTexture(n);r=Ly(kd.x,kd.y,kd.y.negate(),kd.x).mul(s.rg.mul(2).sub(Et(1)).normalize().mul(s.b))}else r=kd;else if(n===st.IRIDESCENCE_THICKNESS){const s=ji("1","float",t.iridescenceThicknessRange);if(t.iridescenceThicknessMap){const a=ji("0","float",t.iridescenceThicknessRange);r=s.sub(a).mul(this.getTexture(n).g).add(a)}else r=s}else if(n===st.TRANSMISSION){const s=this.getFloat(n);t.transmissionMap?r=s.mul(this.getTexture(n).r):r=s}else if(n===st.THICKNESS){const s=this.getFloat(n);t.thicknessMap?r=s.mul(this.getTexture(n).g):r=s}else if(n===st.IOR)r=this.getFloat(n);else if(n===st.LIGHT_MAP)r=this.getTexture(n).rgb.mul(this.getFloat("lightMapIntensity"));else if(n===st.AO)r=this.getTexture(n).r.sub(1).mul(this.getFloat("aoMapIntensity")).add(1);else{const s=this.getNodeType(e);r=this.getCache(n,s)}return r}}st.ALPHA_TEST="alphaTest";st.COLOR="color";st.OPACITY="opacity";st.SHININESS="shininess";st.SPECULAR="specular";st.SPECULAR_STRENGTH="specularStrength";st.SPECULAR_INTENSITY="specularIntensity";st.SPECULAR_COLOR="specularColor";st.REFLECTIVITY="reflectivity";st.ROUGHNESS="roughness";st.METALNESS="metalness";st.NORMAL="normal";st.CLEARCOAT="clearcoat";st.CLEARCOAT_ROUGHNESS="clearcoatRoughness";st.CLEARCOAT_NORMAL="clearcoatNormal";st.EMISSIVE="emissive";st.ROTATION="rotation";st.SHEEN="sheen";st.SHEEN_ROUGHNESS="sheenRoughness";st.ANISOTROPY="anisotropy";st.IRIDESCENCE="iridescence";st.IRIDESCENCE_IOR="iridescenceIOR";st.IRIDESCENCE_THICKNESS="iridescenceThickness";st.IOR="ior";st.TRANSMISSION="transmission";st.THICKNESS="thickness";st.ATTENUATION_DISTANCE="attenuationDistance";st.ATTENUATION_COLOR="attenuationColor";st.LINE_SCALE="scale";st.LINE_DASH_SIZE="dashSize";st.LINE_GAP_SIZE="gapSize";st.LINE_WIDTH="linewidth";st.LINE_DASH_OFFSET="dashOffset";st.POINT_WIDTH="pointWidth";st.DISPERSION="dispersion";st.LIGHT_MAP="light";st.AO="ao";const G9=zt(st,st.ALPHA_TEST),q9=zt(st,st.COLOR),V9=zt(st,st.SHININESS),H9=zt(st,st.EMISSIVE),aE=zt(st,st.OPACITY),j9=zt(st,st.SPECULAR),WT=zt(st,st.SPECULAR_INTENSITY),W9=zt(st,st.SPECULAR_COLOR),Fm=zt(st,st.SPECULAR_STRENGTH),Jv=zt(st,st.REFLECTIVITY),$9=zt(st,st.ROUGHNESS),X9=zt(st,st.METALNESS),Y9=zt(st,st.NORMAL).context({getUV:null}),Q9=zt(st,st.CLEARCOAT),K9=zt(st,st.CLEARCOAT_ROUGHNESS),Z9=zt(st,st.CLEARCOAT_NORMAL).context({getUV:null}),J9=zt(st,st.ROTATION),eU=zt(st,st.SHEEN),tU=zt(st,st.SHEEN_ROUGHNESS),nU=zt(st,st.ANISOTROPY),iU=zt(st,st.IRIDESCENCE),rU=zt(st,st.IRIDESCENCE_IOR),sU=zt(st,st.IRIDESCENCE_THICKNESS),aU=zt(st,st.TRANSMISSION),oU=zt(st,st.THICKNESS),lU=zt(st,st.IOR),uU=zt(st,st.ATTENUATION_DISTANCE),cU=zt(st,st.ATTENUATION_COLOR),hU=zt(st,st.LINE_SCALE),fU=zt(st,st.LINE_DASH_SIZE),AU=zt(st,st.LINE_GAP_SIZE),hee=zt(st,st.LINE_WIDTH),dU=zt(st,st.LINE_DASH_OFFSET),fee=zt(st,st.POINT_WIDTH),pU=zt(st,st.DISPERSION),oE=zt(st,st.LIGHT_MAP),mU=zt(st,st.AO),kd=gn(new At).onReference(function(i){return i.material}).onRenderUpdate(function({material:i}){this.value.set(i.anisotropy*Math.cos(i.anisotropyRotation),i.anisotropy*Math.sin(i.anisotropyRotation))}),lE=je(i=>i.context.setupModelViewProjection(),"vec4").once()().varying("v_modelViewProjection");class pr extends Mn{static get type(){return"IndexNode"}constructor(e){super("uint"),this.scope=e,this.isIndexNode=!0}generate(e){const t=this.getNodeType(e),n=this.scope;let r;if(n===pr.VERTEX)r=e.getVertexIndex();else if(n===pr.INSTANCE)r=e.getInstanceIndex();else if(n===pr.DRAW)r=e.getDrawIndex();else if(n===pr.INVOCATION_LOCAL)r=e.getInvocationLocalIndex();else if(n===pr.INVOCATION_SUBGROUP)r=e.getInvocationSubgroupIndex();else if(n===pr.SUBGROUP)r=e.getSubgroupIndex();else throw new Error("THREE.IndexNode: Unknown scope: "+n);let s;return e.shaderStage==="vertex"||e.shaderStage==="compute"?s=r:s=ro(this).build(e,t),s}}pr.VERTEX="vertex";pr.INSTANCE="instance";pr.SUBGROUP="subgroup";pr.INVOCATION_LOCAL="invocationLocal";pr.INVOCATION_SUBGROUP="invocationSubgroup";pr.DRAW="draw";const gU=zt(pr,pr.VERTEX),Jg=zt(pr,pr.INSTANCE),Aee=zt(pr,pr.SUBGROUP),dee=zt(pr,pr.INVOCATION_SUBGROUP),pee=zt(pr,pr.INVOCATION_LOCAL),vU=zt(pr,pr.DRAW);class _U extends Mn{static get type(){return"InstanceNode"}constructor(e,t,n){super("void"),this.count=e,this.instanceMatrix=t,this.instanceColor=n,this.instanceMatrixNode=null,this.instanceColorNode=null,this.updateType=jn.FRAME,this.buffer=null,this.bufferColor=null}setup(e){const{count:t,instanceMatrix:n,instanceColor:r}=this;let{instanceMatrixNode:s,instanceColorNode:a}=this;if(s===null){if(t<=1e3)s=Yg(n.array,"mat4",Math.max(t,1)).element(Jg);else{const u=new h_(n.array,16,1);this.buffer=u;const h=n.usage===qd?VT:J_,g=[h(u,"vec4",16,0),h(u,"vec4",16,4),h(u,"vec4",16,8),h(u,"vec4",16,12)];s=nA(...g)}this.instanceMatrixNode=s}if(r&&a===null){const u=new Ig(r.array,3),h=r.usage===qd?VT:J_;this.bufferColor=u,a=Ne(h(u,"vec3",3,0)),this.instanceColorNode=a}const l=s.mul(Gr).xyz;if(Gr.assign(l),e.hasGeometryAttribute("normal")){const u=C9(no,s);no.assign(u)}this.instanceColorNode!==null&&Sg("vec3","vInstanceColor").assign(this.instanceColorNode)}update(){this.instanceMatrix.usage!==qd&&this.buffer!==null&&this.instanceMatrix.version!==this.buffer.version&&(this.buffer.version=this.instanceMatrix.version),this.instanceColor&&this.instanceColor.usage!==qd&&this.bufferColor!==null&&this.instanceColor.version!==this.bufferColor.version&&(this.bufferColor.version=this.instanceColor.version)}}const mee=ct(_U);class gee extends _U{static get type(){return"InstancedMeshNode"}constructor(e){const{count:t,instanceMatrix:n,instanceColor:r}=e;super(t,n,r),this.instancedMesh=e}}const yU=ct(gee);class vee extends Mn{static get type(){return"BatchNode"}constructor(e){super("void"),this.batchMesh=e,this.batchingIdNode=null}setup(e){this.batchingIdNode===null&&(e.getDrawIndex()===null?this.batchingIdNode=Jg:this.batchingIdNode=vU);const n=je(([w])=>{const R=Fh(Fr(this.batchMesh._indirectTexture),0),C=ye(w).modInt(ye(R)),E=ye(w).div(ye(R));return Fr(this.batchMesh._indirectTexture,ms(C,E)).x}).setLayout({name:"getIndirectIndex",type:"uint",inputs:[{name:"id",type:"int"}]})(ye(this.batchingIdNode)),r=this.batchMesh._matricesTexture,s=Fh(Fr(r),0),a=ge(n).mul(4).toInt().toVar(),l=a.modInt(s),u=a.div(ye(s)),h=nA(Fr(r,ms(l,u)),Fr(r,ms(l.add(1),u)),Fr(r,ms(l.add(2),u)),Fr(r,ms(l.add(3),u))),g=this.batchMesh._colorsTexture;if(g!==null){const R=je(([C])=>{const E=Fh(Fr(g),0).x,B=C,L=B.modInt(E),O=B.div(E);return Fr(g,ms(L,O)).rgb}).setLayout({name:"getBatchingColor",type:"vec3",inputs:[{name:"id",type:"int"}]})(n);Sg("vec3","vBatchColor").assign(R)}const v=ha(h);Gr.assign(h.mul(Gr));const x=no.div(Ne(v[0].dot(v[0]),v[1].dot(v[1]),v[2].dot(v[2]))),S=v.mul(x).xyz;no.assign(S),e.hasGeometryAttribute("tangent")&&Qg.mulAssign(v)}}const xU=ct(vee),UR=new WeakMap;class bU extends Mn{static get type(){return"SkinningNode"}constructor(e,t=!1){super("void"),this.skinnedMesh=e,this.useReference=t,this.updateType=jn.OBJECT,this.skinIndexNode=_u("skinIndex","uvec4"),this.skinWeightNode=_u("skinWeight","vec4");let n,r,s;t?(n=ji("bindMatrix","mat4"),r=ji("bindMatrixInverse","mat4"),s=HT("skeleton.boneMatrices","mat4",e.skeleton.bones.length)):(n=gn(e.bindMatrix,"mat4"),r=gn(e.bindMatrixInverse,"mat4"),s=Yg(e.skeleton.boneMatrices,"mat4",e.skeleton.bones.length)),this.bindMatrixNode=n,this.bindMatrixInverseNode=r,this.boneMatricesNode=s,this.previousBoneMatricesNode=null}getSkinnedPosition(e=this.boneMatricesNode,t=Gr){const{skinIndexNode:n,skinWeightNode:r,bindMatrixNode:s,bindMatrixInverseNode:a}=this,l=e.element(n.x),u=e.element(n.y),h=e.element(n.z),g=e.element(n.w),v=s.mul(t),x=Qr(l.mul(r.x).mul(v),u.mul(r.y).mul(v),h.mul(r.z).mul(v),g.mul(r.w).mul(v));return a.mul(x).xyz}getSkinnedNormal(e=this.boneMatricesNode,t=no){const{skinIndexNode:n,skinWeightNode:r,bindMatrixNode:s,bindMatrixInverseNode:a}=this,l=e.element(n.x),u=e.element(n.y),h=e.element(n.z),g=e.element(n.w);let v=Qr(r.x.mul(l),r.y.mul(u),r.z.mul(h),r.w.mul(g));return v=a.mul(v).mul(s),v.transformDirection(t).xyz}getPreviousSkinnedPosition(e){const t=e.object;return this.previousBoneMatricesNode===null&&(t.skeleton.previousBoneMatrices=new Float32Array(t.skeleton.boneMatrices),this.previousBoneMatricesNode=HT("skeleton.previousBoneMatrices","mat4",t.skeleton.bones.length)),this.getSkinnedPosition(this.previousBoneMatricesNode,ey)}needsPreviousBoneMatrices(e){const t=e.renderer.getMRT();return t&&t.has("velocity")||IP(e.object).useVelocity===!0}setup(e){this.needsPreviousBoneMatrices(e)&&ey.assign(this.getPreviousSkinnedPosition(e));const t=this.getSkinnedPosition();if(Gr.assign(t),e.hasGeometryAttribute("normal")){const n=this.getSkinnedNormal();no.assign(n),e.hasGeometryAttribute("tangent")&&Qg.assign(n)}}generate(e,t){if(t!=="void")return Gr.build(e,t)}update(e){const n=(this.useReference?e.object:this.skinnedMesh).skeleton;UR.get(n)!==e.frameId&&(UR.set(n,e.frameId),this.previousBoneMatricesNode!==null&&n.previousBoneMatrices.set(n.boneMatrices),n.update())}}const _ee=i=>mt(new bU(i)),SU=i=>mt(new bU(i,!0));class yee extends Mn{static get type(){return"LoopNode"}constructor(e=[]){super(),this.params=e}getVarName(e){return String.fromCharCode(105+e)}getProperties(e){const t=e.getNodeProperties(this);if(t.stackNode!==void 0)return t;const n={};for(let s=0,a=this.params.length-1;sNumber(v)?w=">=":w="<"));const C={start:g,end:v},E=C.start,B=C.end;let L="",O="",z="";R||(S==="int"||S==="uint"?w.includes("<")?R="++":R="--":w.includes("<")?R="+= 1.":R="-= 1."),L+=e.getVar(S,x)+" = "+E,O+=x+" "+w+" "+B,z+=x+" "+R;const G=`for ( ${L}; ${O}; ${z} )`;e.addFlowCode((l===0?` +`);return e.format(h,n,t)}}const zs=ht(gJ);ct("select",zs);const KL=(...i)=>(console.warn("TSL.ConditionalNode: cond() has been renamed to select()."),zs(...i));ct("cond",KL);class ZL extends Mn{static get type(){return"ContextNode"}constructor(e,t={}){super(),this.isContextNode=!0,this.node=e,this.value=t}getScope(){return this.node.getScope()}getNodeType(e){return this.node.getNodeType(e)}analyze(e){this.node.build(e)}setup(e){const t=e.getContext();e.setContext({...e.context,...this.value});const n=this.node.build(e);return e.setContext(t),n}generate(e,t){const n=e.getContext();e.setContext({...e.context,...this.value});const r=this.node.build(e,t);return e.setContext(n),r}}const zy=ht(ZL),JL=(i,e)=>zy(i,{label:e});ct("context",zy);ct("label",JL);class Kv extends Mn{static get type(){return"VarNode"}constructor(e,t=null){super(),this.node=e,this.name=t,this.global=!0,this.isVarNode=!0}getHash(e){return this.name||super.getHash(e)}getNodeType(e){return this.node.getNodeType(e)}generate(e){const{node:t,name:n}=this,r=e.getVarFromNode(this,n,e.getVectorType(this.getNodeType(e))),s=e.getPropertyName(r),a=t.build(e,r.type);return e.addLineFlowCode(`${s} = ${a}`,this),s}}const e9=ht(Kv);ct("toVar",(...i)=>e9(...i).append());const t9=i=>(console.warn('TSL: "temp" is deprecated. Use ".toVar()" instead.'),e9(i));ct("temp",t9);class vJ extends Mn{static get type(){return"VaryingNode"}constructor(e,t=null){super(),this.node=e,this.name=t,this.isVaryingNode=!0}isGlobal(){return!0}getHash(e){return this.name||super.getHash(e)}getNodeType(e){return this.node.getNodeType(e)}setupVarying(e){const t=e.getNodeProperties(this);let n=t.varying;if(n===void 0){const r=this.name,s=this.getNodeType(e);t.varying=n=e.getVaryingFromNode(this,r,s),t.node=this.node}return n.needsInterpolation||(n.needsInterpolation=e.shaderStage==="fragment"),n}setup(e){this.setupVarying(e)}analyze(e){return this.setupVarying(e),this.node.analyze(e)}generate(e){const t=e.getNodeProperties(this),n=this.setupVarying(e),r=e.shaderStage==="fragment"&&t.reassignPosition===!0&&e.context.needsPositionReassign;if(t.propertyName===void 0||r){const s=this.getNodeType(e),a=e.getPropertyName(n,OT.VERTEX);e.flowNodeFromShaderStage(OT.VERTEX,this.node,s,a),t.propertyName=a,r?t.reassignPosition=!1:t.reassignPosition===void 0&&e.context.isPositionNodeInput&&(t.reassignPosition=!0)}return e.getPropertyName(n)}}const ro=ht(vJ),n9=i=>ro(i);ct("varying",ro);ct("vertexStage",n9);const i9=je(([i])=>{const e=i.mul(.9478672986).add(.0521327014).pow(2.4),t=i.mul(.0773993808),n=i.lessThanEqual(.04045);return Fi(e,t,n)}).setLayout({name:"sRGBTransferEOTF",type:"vec3",inputs:[{name:"color",type:"vec3"}]}),r9=je(([i])=>{const e=i.pow(.41666).mul(1.055).sub(.055),t=i.mul(12.92),n=i.lessThanEqual(.0031308);return Fi(e,t,n)}).setLayout({name:"sRGBTransferOETF",type:"vec3",inputs:[{name:"color",type:"vec3"}]}),jg="WorkingColorSpace",eE="OutputColorSpace";class Wg extends Zr{static get type(){return"ColorSpaceNode"}constructor(e,t,n){super("vec4"),this.colorNode=e,this.source=t,this.target=n}resolveColorSpace(e,t){return t===jg?ai.workingColorSpace:t===eE?e.context.outputColorSpace||e.renderer.outputColorSpace:t}setup(e){const{colorNode:t}=this,n=this.resolveColorSpace(e,this.source),r=this.resolveColorSpace(e,this.target);let s=t;return ai.enabled===!1||n===r||!n||!r||(ai.getTransfer(n)===Vi&&(s=dn(i9(s.rgb),s.a)),ai.getPrimaries(n)!==ai.getPrimaries(r)&&(s=dn(ha(ai._getMatrix(new Vn,n,r)).mul(s.rgb),s.a)),ai.getTransfer(r)===Vi&&(s=dn(r9(s.rgb),s.a))),s}}const s9=i=>gt(new Wg(gt(i),jg,eE)),a9=i=>gt(new Wg(gt(i),eE,jg)),o9=(i,e)=>gt(new Wg(gt(i),jg,e)),tE=(i,e)=>gt(new Wg(gt(i),e,jg)),_J=(i,e,t)=>gt(new Wg(gt(i),e,t));ct("toOutputColorSpace",s9);ct("toWorkingColorSpace",a9);ct("workingToColorSpace",o9);ct("colorSpaceToWorking",tE);let yJ=class extends vA{static get type(){return"ReferenceElementNode"}constructor(e,t){super(e,t),this.referenceNode=e,this.isReferenceElementNode=!0}getNodeType(){return this.referenceNode.uniformType}generate(e){const t=super.generate(e),n=this.referenceNode.getNodeType(),r=this.getNodeType();return e.format(t,n,r)}};class l9 extends Mn{static get type(){return"ReferenceBaseNode"}constructor(e,t,n=null,r=null){super(),this.property=e,this.uniformType=t,this.object=n,this.count=r,this.properties=e.split("."),this.reference=n,this.node=null,this.group=null,this.updateType=jn.OBJECT}setGroup(e){return this.group=e,this}element(e){return gt(new yJ(this,gt(e)))}setNodeType(e){const t=gn(null,e).getSelf();this.group!==null&&t.setGroup(this.group),this.node=t}getNodeType(e){return this.node===null&&(this.updateReference(e),this.updateValue()),this.node.getNodeType(e)}getValueFromReference(e=this.reference){const{properties:t}=this;let n=e[t[0]];for(let r=1;rgt(new l9(i,e,t));class bJ extends l9{static get type(){return"RendererReferenceNode"}constructor(e,t,n=null){super(e,t,n),this.renderer=n,this.setGroup(Rn)}updateReference(e){return this.reference=this.renderer!==null?this.renderer:e.renderer,this.reference}}const u9=(i,e,t=null)=>gt(new bJ(i,e,t));class SJ extends Zr{static get type(){return"ToneMappingNode"}constructor(e,t=h9,n=null){super("vec3"),this.toneMapping=e,this.exposureNode=t,this.colorNode=n}customCacheKey(){return MM(this.toneMapping)}setup(e){const t=this.colorNode||e.context.color,n=this.toneMapping;if(n===Za)return t;let r=null;const s=e.renderer.library.getToneMappingFunction(n);return s!==null?r=dn(s(t.rgb,this.exposureNode),t.a):(console.error("ToneMappingNode: Unsupported Tone Mapping configuration.",n),r=t),r}}const c9=(i,e,t)=>gt(new SJ(i,gt(e),gt(t))),h9=u9("toneMappingExposure","float");ct("toneMapping",(i,e,t)=>c9(e,t,i));class TJ extends EM{static get type(){return"BufferAttributeNode"}constructor(e,t=null,n=0,r=0){super(e,t),this.isBufferNode=!0,this.bufferType=t,this.bufferStride=n,this.bufferOffset=r,this.usage=o_,this.instanced=!1,this.attribute=null,this.global=!0,e&&e.isBufferAttribute===!0&&(this.attribute=e,this.usage=e.usage,this.instanced=e.isInstancedBufferAttribute)}getHash(e){if(this.bufferStride===0&&this.bufferOffset===0){let t=e.globalCache.getData(this.value);return t===void 0&&(t={node:this},e.globalCache.setData(this.value,t)),t.node.uuid}return this.uuid}getNodeType(e){return this.bufferType===null&&(this.bufferType=e.getTypeFromAttribute(this.attribute)),this.bufferType}setup(e){if(this.attribute!==null)return;const t=this.getNodeType(e),n=this.value,r=e.getTypeLength(t),s=this.bufferStride||r,a=this.bufferOffset,l=n.isInterleavedBuffer===!0?n:new Yw(n,s),u=new nu(l,r,a);l.setUsage(this.usage),this.attribute=u,this.attribute.isInstancedBufferAttribute=this.instanced}generate(e){const t=this.getNodeType(e),n=e.getBufferAttributeFromNode(this,t),r=e.getPropertyName(n);let s=null;return e.shaderStage==="vertex"||e.shaderStage==="compute"?(this.name=r,s=r):s=ro(this).build(e,t),s}getInputType(){return"bufferAttribute"}setUsage(e){return this.usage=e,this.attribute&&this.attribute.isBufferAttribute===!0&&(this.attribute.usage=e),this}setInstanced(e){return this.instanced=e,this}}const $g=(i,e=null,t=0,n=0)=>gt(new TJ(i,e,t,n)),f9=(i,e=null,t=0,n=0)=>$g(i,e,t,n).setUsage(qd),J_=(i,e=null,t=0,n=0)=>$g(i,e,t,n).setInstanced(!0),VT=(i,e=null,t=0,n=0)=>f9(i,e,t,n).setInstanced(!0);ct("toAttribute",i=>$g(i.value));class wJ extends Mn{static get type(){return"ComputeNode"}constructor(e,t,n=[64]){super("void"),this.isComputeNode=!0,this.computeNode=e,this.count=t,this.workgroupSize=n,this.dispatchCount=0,this.version=1,this.name="",this.updateBeforeType=jn.OBJECT,this.onInitFunction=null,this.updateDispatchCount()}dispose(){this.dispatchEvent({type:"dispose"})}label(e){return this.name=e,this}updateDispatchCount(){const{count:e,workgroupSize:t}=this;let n=t[0];for(let r=1;rgt(new wJ(gt(i),e,t));ct("compute",A9);class MJ extends Mn{static get type(){return"CacheNode"}constructor(e,t=!0){super(),this.node=e,this.parent=t,this.isCacheNode=!0}getNodeType(e){const t=e.getCache(),n=e.getCacheFromNode(this,this.parent);e.setCache(n);const r=this.node.getNodeType(e);return e.setCache(t),r}build(e,...t){const n=e.getCache(),r=e.getCacheFromNode(this,this.parent);e.setCache(r);const s=this.node.build(e,...t);return e.setCache(n),s}}const Im=(i,e)=>gt(new MJ(gt(i),e));ct("cache",Im);class EJ extends Mn{static get type(){return"BypassNode"}constructor(e,t){super(),this.isBypassNode=!0,this.outputNode=e,this.callNode=t}getNodeType(e){return this.outputNode.getNodeType(e)}generate(e){const t=this.callNode.build(e,"void");return t!==""&&e.addLineFlowCode(t,this),this.outputNode.build(e)}}const d9=ht(EJ);ct("bypass",d9);class p9 extends Mn{static get type(){return"RemapNode"}constructor(e,t,n,r=ge(0),s=ge(1)){super(),this.node=e,this.inLowNode=t,this.inHighNode=n,this.outLowNode=r,this.outHighNode=s,this.doClamp=!0}setup(){const{node:e,inLowNode:t,inHighNode:n,outLowNode:r,outHighNode:s,doClamp:a}=this;let l=e.sub(t).div(n.sub(t));return a===!0&&(l=l.clamp()),l.mul(s.sub(r)).add(r)}}const m9=ht(p9,null,null,{doClamp:!1}),g9=ht(p9);ct("remap",m9);ct("remapClamp",g9);class Zv extends Mn{static get type(){return"ExpressionNode"}constructor(e="",t="void"){super(t),this.snippet=e}generate(e,t){const n=this.getNodeType(e),r=this.snippet;if(n==="void")e.addLineFlowCode(r,this);else return e.format(`( ${r} )`,n,t)}}const Hh=ht(Zv),v9=i=>(i?zs(i,Hh("discard")):Hh("discard")).append(),CJ=()=>Hh("return").append();ct("discard",v9);class RJ extends Zr{static get type(){return"RenderOutputNode"}constructor(e,t,n){super("vec4"),this.colorNode=e,this.toneMapping=t,this.outputColorSpace=n,this.isRenderOutputNode=!0}setup({context:e}){let t=this.colorNode||e.color;const n=(this.toneMapping!==null?this.toneMapping:e.toneMapping)||Za,r=(this.outputColorSpace!==null?this.outputColorSpace:e.outputColorSpace)||Co;return n!==Za&&(t=t.toneMapping(n)),r!==Co&&r!==ai.workingColorSpace&&(t=t.workingToColorSpace(r)),t}}const _9=(i,e=null,t=null)=>gt(new RJ(gt(i),e,t));ct("renderOutput",_9);function NJ(i){console.warn("THREE.TSLBase: AddNodeElement has been removed in favor of tree-shaking. Trying add",i)}class y9 extends Mn{static get type(){return"AttributeNode"}constructor(e,t=null){super(t),this.global=!0,this._attributeName=e}getHash(e){return this.getAttributeName(e)}getNodeType(e){let t=this.nodeType;if(t===null){const n=this.getAttributeName(e);if(e.hasGeometryAttribute(n)){const r=e.geometry.getAttribute(n);t=e.getTypeFromAttribute(r)}else t="float"}return t}setAttributeName(e){return this._attributeName=e,this}getAttributeName(){return this._attributeName}generate(e){const t=this.getAttributeName(e),n=this.getNodeType(e);if(e.hasGeometryAttribute(t)===!0){const s=e.geometry.getAttribute(t),a=e.getTypeFromAttribute(s),l=e.getAttribute(t,a);return e.shaderStage==="vertex"?e.format(l.name,a,n):ro(this).build(e,n)}else return console.warn(`AttributeNode: Vertex attribute "${t}" not found on geometry.`),e.generateConst(n)}serialize(e){super.serialize(e),e.global=this.global,e._attributeName=this._attributeName}deserialize(e){super.deserialize(e),this.global=e.global,this._attributeName=e._attributeName}}const _u=(i,e)=>gt(new y9(i,e)),Er=(i=0)=>_u("uv"+(i>0?i:""),"vec2");class DJ extends Mn{static get type(){return"TextureSizeNode"}constructor(e,t=null){super("uvec2"),this.isTextureSizeNode=!0,this.textureNode=e,this.levelNode=t}generate(e,t){const n=this.textureNode.build(e,"property"),r=this.levelNode===null?"0":this.levelNode.build(e,"int");return e.format(`${e.getMethod("textureDimensions")}( ${n}, ${r} )`,this.getNodeType(e),t)}}const Fh=ht(DJ);class PJ extends Hg{static get type(){return"MaxMipLevelNode"}constructor(e){super(0),this._textureNode=e,this.updateType=jn.FRAME}get textureNode(){return this._textureNode}get texture(){return this._textureNode.value}update(){const e=this.texture,t=e.images,n=t&&t.length>0?t[0]&&t[0].image||t[0]:e.image;if(n&&n.width!==void 0){const{width:r,height:s}=n;this.value=Math.log2(Math.max(r,s))}}}const x9=ht(PJ);class yu extends Hg{static get type(){return"TextureNode"}constructor(e,t=null,n=null,r=null){super(e),this.isTextureNode=!0,this.uvNode=t,this.levelNode=n,this.biasNode=r,this.compareNode=null,this.depthNode=null,this.gradNode=null,this.sampler=!0,this.updateMatrix=!1,this.updateType=jn.NONE,this.referenceNode=null,this._value=e,this._matrixUniform=null,this.setUpdateMatrix(t===null)}set value(e){this.referenceNode?this.referenceNode.value=e:this._value=e}get value(){return this.referenceNode?this.referenceNode.value:this._value}getUniformHash(){return this.value.uuid}getNodeType(){return this.value.isDepthTexture===!0?"float":this.value.type===Rr?"uvec4":this.value.type===Ns?"ivec4":"vec4"}getInputType(){return"texture"}getDefaultUV(){return Er(this.value.channel)}updateReference(){return this.value}getTransformedUV(e){return this._matrixUniform===null&&(this._matrixUniform=gn(this.value.matrix)),this._matrixUniform.mul(Ne(e,1)).xy}setUpdateMatrix(e){return this.updateMatrix=e,this.updateType=e?jn.RENDER:jn.NONE,this}setupUV(e,t){const n=this.value;return e.isFlipY()&&(n.image instanceof ImageBitmap&&n.flipY===!0||n.isRenderTargetTexture===!0||n.isFramebufferTexture===!0||n.isDepthTexture===!0)&&(this.sampler?t=t.flipY():t=t.setY(ye(Fh(this,this.levelNode).y).sub(t.y).sub(1))),t}setup(e){const t=e.getNodeProperties(this);t.referenceNode=this.referenceNode;const n=this.value;if(!n||n.isTexture!==!0)throw new Error("THREE.TSL: `texture( value )` function expects a valid instance of THREE.Texture().");let r=this.uvNode;(r===null||e.context.forceUVContext===!0)&&e.context.getUV&&(r=e.context.getUV(this)),r||(r=this.getDefaultUV()),this.updateMatrix===!0&&(r=this.getTransformedUV(r)),r=this.setupUV(e,r);let s=this.levelNode;s===null&&e.context.getTextureLevel&&(s=e.context.getTextureLevel(this)),t.uvNode=r,t.levelNode=s,t.biasNode=this.biasNode,t.compareNode=this.compareNode,t.gradNode=this.gradNode,t.depthNode=this.depthNode}generateUV(e,t){return t.build(e,this.sampler===!0?"vec2":"ivec2")}generateSnippet(e,t,n,r,s,a,l,u){const h=this.value;let g;return r?g=e.generateTextureLevel(h,t,n,r,a):s?g=e.generateTextureBias(h,t,n,s,a):u?g=e.generateTextureGrad(h,t,n,u,a):l?g=e.generateTextureCompare(h,t,n,l,a):this.sampler===!1?g=e.generateTextureLoad(h,t,n,a):g=e.generateTexture(h,t,n,a),g}generate(e,t){const n=this.value,r=e.getNodeProperties(this),s=super.generate(e,"property");if(t==="sampler")return s+"_sampler";if(e.isReference(t))return s;{const a=e.getDataFromNode(this);let l=a.propertyName;if(l===void 0){const{uvNode:g,levelNode:v,biasNode:x,compareNode:S,depthNode:w,gradNode:R}=r,C=this.generateUV(e,g),E=v?v.build(e,"float"):null,B=x?x.build(e,"float"):null,L=w?w.build(e,"int"):null,O=S?S.build(e,"float"):null,z=R?[R[0].build(e,"vec2"),R[1].build(e,"vec2")]:null,G=e.getVarFromNode(this);l=e.getPropertyName(G);const k=this.generateSnippet(e,s,C,E,B,L,O,z);e.addLineFlowCode(`${l} = ${k}`,this),a.snippet=k,a.propertyName=l}let u=l;const h=this.getNodeType(e);return e.needsToWorkingColorSpace(n)&&(u=tE(Hh(u,h),n.colorSpace).setup(e).build(e,h)),e.format(u,h,t)}}setSampler(e){return this.sampler=e,this}getSampler(){return this.sampler}uv(e){return console.warn("THREE.TextureNode: .uv() has been renamed. Use .sample() instead."),this.sample(e)}sample(e){const t=this.clone();return t.uvNode=gt(e),t.referenceNode=this.getSelf(),gt(t)}blur(e){const t=this.clone();return t.biasNode=gt(e).mul(x9(t)),t.referenceNode=this.getSelf(),gt(t)}level(e){const t=this.clone();return t.levelNode=gt(e),t.referenceNode=this.getSelf(),gt(t)}size(e){return Fh(this,e)}bias(e){const t=this.clone();return t.biasNode=gt(e),t.referenceNode=this.getSelf(),gt(t)}compare(e){const t=this.clone();return t.compareNode=gt(e),t.referenceNode=this.getSelf(),gt(t)}grad(e,t){const n=this.clone();return n.gradNode=[gt(e),gt(t)],n.referenceNode=this.getSelf(),gt(n)}depth(e){const t=this.clone();return t.depthNode=gt(e),t.referenceNode=this.getSelf(),gt(t)}serialize(e){super.serialize(e),e.value=this.value.toJSON(e.meta).uuid,e.sampler=this.sampler,e.updateMatrix=this.updateMatrix,e.updateType=this.updateType}deserialize(e){super.deserialize(e),this.value=e.meta.textures[e.value],this.sampler=e.sampler,this.updateMatrix=e.updateMatrix,this.updateType=e.updateType}update(){const e=this.value,t=this._matrixUniform;t!==null&&(t.value=e.matrix),e.matrixAutoUpdate===!0&&e.updateMatrix()}clone(){const e=new this.constructor(this.value,this.uvNode,this.levelNode,this.biasNode);return e.sampler=this.sampler,e}}const Ai=ht(yu),Fr=(...i)=>Ai(...i).setSampler(!1),LJ=i=>(i.isNode===!0?i:Ai(i)).convert("sampler"),Dh=gn("float").label("cameraNear").setGroup(Rn).onRenderUpdate(({camera:i})=>i.near),Ph=gn("float").label("cameraFar").setGroup(Rn).onRenderUpdate(({camera:i})=>i.far),_A=gn("mat4").label("cameraProjectionMatrix").setGroup(Rn).onRenderUpdate(({camera:i})=>i.projectionMatrix),UJ=gn("mat4").label("cameraProjectionMatrixInverse").setGroup(Rn).onRenderUpdate(({camera:i})=>i.projectionMatrixInverse),so=gn("mat4").label("cameraViewMatrix").setGroup(Rn).onRenderUpdate(({camera:i})=>i.matrixWorldInverse),BJ=gn("mat4").label("cameraWorldMatrix").setGroup(Rn).onRenderUpdate(({camera:i})=>i.matrixWorld),OJ=gn("mat3").label("cameraNormalMatrix").setGroup(Rn).onRenderUpdate(({camera:i})=>i.normalMatrix),b9=gn(new ce).label("cameraPosition").setGroup(Rn).onRenderUpdate(({camera:i},e)=>e.value.setFromMatrixPosition(i.matrixWorld));class Li extends Mn{static get type(){return"Object3DNode"}constructor(e,t=null){super(),this.scope=e,this.object3d=t,this.updateType=jn.OBJECT,this._uniformNode=new Hg(null)}getNodeType(){const e=this.scope;if(e===Li.WORLD_MATRIX)return"mat4";if(e===Li.POSITION||e===Li.VIEW_POSITION||e===Li.DIRECTION||e===Li.SCALE)return"vec3"}update(e){const t=this.object3d,n=this._uniformNode,r=this.scope;if(r===Li.WORLD_MATRIX)n.value=t.matrixWorld;else if(r===Li.POSITION)n.value=n.value||new ce,n.value.setFromMatrixPosition(t.matrixWorld);else if(r===Li.SCALE)n.value=n.value||new ce,n.value.setFromMatrixScale(t.matrixWorld);else if(r===Li.DIRECTION)n.value=n.value||new ce,t.getWorldDirection(n.value);else if(r===Li.VIEW_POSITION){const s=e.camera;n.value=n.value||new ce,n.value.setFromMatrixPosition(t.matrixWorld),n.value.applyMatrix4(s.matrixWorldInverse)}}generate(e){const t=this.scope;return t===Li.WORLD_MATRIX?this._uniformNode.nodeType="mat4":(t===Li.POSITION||t===Li.VIEW_POSITION||t===Li.DIRECTION||t===Li.SCALE)&&(this._uniformNode.nodeType="vec3"),this._uniformNode.build(e)}serialize(e){super.serialize(e),e.scope=this.scope}deserialize(e){super.deserialize(e),this.scope=e.scope}}Li.WORLD_MATRIX="worldMatrix";Li.POSITION="position";Li.SCALE="scale";Li.VIEW_POSITION="viewPosition";Li.DIRECTION="direction";const IJ=ht(Li,Li.DIRECTION),FJ=ht(Li,Li.WORLD_MATRIX),S9=ht(Li,Li.POSITION),kJ=ht(Li,Li.SCALE),zJ=ht(Li,Li.VIEW_POSITION);class xu extends Li{static get type(){return"ModelNode"}constructor(e){super(e)}update(e){this.object3d=e.object,super.update(e)}}const GJ=zt(xu,xu.DIRECTION),$o=zt(xu,xu.WORLD_MATRIX),qJ=zt(xu,xu.POSITION),VJ=zt(xu,xu.SCALE),HJ=zt(xu,xu.VIEW_POSITION),T9=gn(new Vn).onObjectUpdate(({object:i},e)=>e.value.getNormalMatrix(i.matrixWorld)),jJ=gn(new kn).onObjectUpdate(({object:i},e)=>e.value.copy(i.matrixWorld).invert()),Q0=je(i=>i.renderer.nodes.modelViewMatrix||w9).once()().toVar("modelViewMatrix"),w9=so.mul($o),WJ=je(i=>(i.context.isHighPrecisionModelViewMatrix=!0,gn("mat4").onObjectUpdate(({object:e,camera:t})=>e.modelViewMatrix.multiplyMatrices(t.matrixWorldInverse,e.matrixWorld)))).once()().toVar("highpModelViewMatrix"),$J=je(i=>{const e=i.context.isHighPrecisionModelViewMatrix;return gn("mat3").onObjectUpdate(({object:t,camera:n})=>(e!==!0&&t.modelViewMatrix.multiplyMatrices(n.matrixWorldInverse,t.matrixWorld),t.normalMatrix.getNormalMatrix(t.modelViewMatrix)))}).once()().toVar("highpModelNormalViewMatrix"),Gy=_u("position","vec3"),Gr=Gy.varying("positionLocal"),ey=Gy.varying("positionPrevious"),Nc=$o.mul(Gr).xyz.varying("v_positionWorld").context({needsPositionReassign:!0}),nE=Gr.transformDirection($o).varying("v_positionWorldDirection").normalize().toVar("positionWorldDirection").context({needsPositionReassign:!0}),Xr=je(i=>i.context.setupPositionView(),"vec3").once()().varying("v_positionView").context({needsPositionReassign:!0}),dr=Xr.negate().varying("v_positionViewDirection").normalize().toVar("positionViewDirection");class XJ extends Mn{static get type(){return"FrontFacingNode"}constructor(){super("bool"),this.isFrontFacingNode=!0}generate(e){const{renderer:t,material:n}=e;return t.coordinateSystem===Ha&&n.side===hr?"false":e.getFrontFacing()}}const M9=zt(XJ),Xg=ge(M9).mul(2).sub(1),qy=_u("normal","vec3"),no=je(i=>i.geometry.hasAttribute("normal")===!1?(console.warn('TSL.NormalNode: Vertex attribute "normal" not found on geometry.'),Ne(0,1,0)):qy,"vec3").once()().toVar("normalLocal"),E9=Xr.dFdx().cross(Xr.dFdy()).normalize().toVar("normalFlat"),Jo=je(i=>{let e;return i.material.flatShading===!0?e=E9:e=ro(iE(no),"v_normalView").normalize(),e},"vec3").once()().toVar("normalView"),Vy=ro(Jo.transformDirection(so),"v_normalWorld").normalize().toVar("normalWorld"),zr=je(i=>i.context.setupNormal(),"vec3").once()().mul(Xg).toVar("transformedNormalView"),Hy=zr.transformDirection(so).toVar("transformedNormalWorld"),Qd=je(i=>i.context.setupClearcoatNormal(),"vec3").once()().mul(Xg).toVar("transformedClearcoatNormalView"),C9=je(([i,e=$o])=>{const t=ha(e),n=i.div(Ne(t[0].dot(t[0]),t[1].dot(t[1]),t[2].dot(t[2])));return t.mul(n).xyz}),iE=je(([i],e)=>{const t=e.renderer.nodes.modelNormalViewMatrix;if(t!==null)return t.transformDirection(i);const n=T9.mul(i);return so.transformDirection(n)}),R9=gn(0).onReference(({material:i})=>i).onRenderUpdate(({material:i})=>i.refractionRatio),N9=dr.negate().reflect(zr),D9=dr.negate().refract(zr,R9),P9=N9.transformDirection(so).toVar("reflectVector"),L9=D9.transformDirection(so).toVar("reflectVector");class YJ extends yu{static get type(){return"CubeTextureNode"}constructor(e,t=null,n=null,r=null){super(e,t,n,r),this.isCubeTextureNode=!0}getInputType(){return"cubeTexture"}getDefaultUV(){const e=this.value;return e.mapping===Qo?P9:e.mapping===Ko?L9:(console.error('THREE.CubeTextureNode: Mapping "%s" not supported.',e.mapping),Ne(0,0,0))}setUpdateMatrix(){}setupUV(e,t){const n=this.value;return e.renderer.coordinateSystem===pu||!n.isRenderTargetTexture?Ne(t.x.negate(),t.yz):t}generateUV(e,t){return t.build(e,"vec3")}}const I0=ht(YJ);class rE extends Hg{static get type(){return"BufferNode"}constructor(e,t,n=0){super(e,t),this.isBufferNode=!0,this.bufferType=t,this.bufferCount=n}getElementType(e){return this.getNodeType(e)}getInputType(){return"buffer"}}const Yg=(i,e,t)=>gt(new rE(i,e,t));class QJ extends vA{static get type(){return"UniformArrayElementNode"}constructor(e,t){super(e,t),this.isArrayBufferElementNode=!0}generate(e){const t=super.generate(e),n=this.getNodeType(),r=this.node.getPaddedType();return e.format(t,r,n)}}class U9 extends rE{static get type(){return"UniformArrayNode"}constructor(e,t=null){super(null),this.array=e,this.elementType=t===null?Uh(e[0]):t,this.paddedType=this.getPaddedType(),this.updateType=jn.RENDER,this.isArrayBufferNode=!0}getNodeType(){return this.paddedType}getElementType(){return this.elementType}getPaddedType(){const e=this.elementType;let t="vec4";return e==="mat2"?t="mat2":/mat/.test(e)===!0?t="mat4":e.charAt(0)==="i"?t="ivec4":e.charAt(0)==="u"&&(t="uvec4"),t}update(){const{array:e,value:t}=this,n=this.elementType;if(n==="float"||n==="int"||n==="uint")for(let r=0;rgt(new U9(i,e)),KJ=(i,e)=>(console.warn("TSL.UniformArrayNode: uniforms() has been renamed to uniformArray()."),gt(new U9(i,e)));class ZJ extends vA{static get type(){return"ReferenceElementNode"}constructor(e,t){super(e,t),this.referenceNode=e,this.isReferenceElementNode=!0}getNodeType(){return this.referenceNode.uniformType}generate(e){const t=super.generate(e),n=this.referenceNode.getNodeType(),r=this.getNodeType();return e.format(t,n,r)}}class jy extends Mn{static get type(){return"ReferenceNode"}constructor(e,t,n=null,r=null){super(),this.property=e,this.uniformType=t,this.object=n,this.count=r,this.properties=e.split("."),this.reference=n,this.node=null,this.group=null,this.name=null,this.updateType=jn.OBJECT}element(e){return gt(new ZJ(this,gt(e)))}setGroup(e){return this.group=e,this}label(e){return this.name=e,this}setNodeType(e){let t=null;this.count!==null?t=Yg(null,e,this.count):Array.isArray(this.getValueFromReference())?t=Sc(null,e):e==="texture"?t=Ai(null):e==="cubeTexture"?t=I0(null):t=gn(null,e),this.group!==null&&t.setGroup(this.group),this.name!==null&&t.label(this.name),this.node=t.getSelf()}getNodeType(e){return this.node===null&&(this.updateReference(e),this.updateValue()),this.node.getNodeType(e)}getValueFromReference(e=this.reference){const{properties:t}=this;let n=e[t[0]];for(let r=1;rgt(new jy(i,e,t)),HT=(i,e,t,n)=>gt(new jy(i,e,n,t));class JJ extends jy{static get type(){return"MaterialReferenceNode"}constructor(e,t,n=null){super(e,t,n),this.material=n,this.isMaterialReferenceNode=!0}updateReference(e){return this.reference=this.material!==null?this.material:e.material,this.reference}}const Tc=(i,e,t=null)=>gt(new JJ(i,e,t)),Wy=je(i=>(i.geometry.hasAttribute("tangent")===!1&&i.geometry.computeTangents(),_u("tangent","vec4")))(),Qg=Wy.xyz.toVar("tangentLocal"),Kg=Q0.mul(dn(Qg,0)).xyz.varying("v_tangentView").normalize().toVar("tangentView"),B9=Kg.transformDirection(so).varying("v_tangentWorld").normalize().toVar("tangentWorld"),sE=Kg.toVar("transformedTangentView"),eee=sE.transformDirection(so).normalize().toVar("transformedTangentWorld"),Zg=i=>i.mul(Wy.w).xyz,tee=ro(Zg(qy.cross(Wy)),"v_bitangentGeometry").normalize().toVar("bitangentGeometry"),nee=ro(Zg(no.cross(Qg)),"v_bitangentLocal").normalize().toVar("bitangentLocal"),O9=ro(Zg(Jo.cross(Kg)),"v_bitangentView").normalize().toVar("bitangentView"),iee=ro(Zg(Vy.cross(B9)),"v_bitangentWorld").normalize().toVar("bitangentWorld"),I9=Zg(zr.cross(sE)).normalize().toVar("transformedBitangentView"),ree=I9.transformDirection(so).normalize().toVar("transformedBitangentWorld"),Yf=ha(Kg,O9,Jo),F9=dr.mul(Yf),see=(i,e)=>i.sub(F9.mul(e)),k9=(()=>{let i=iA.cross(dr);return i=i.cross(iA).normalize(),i=Fi(i,zr,Rh.mul(Zl.oneMinus()).oneMinus().pow2().pow2()).normalize(),i})(),aee=je(i=>{const{eye_pos:e,surf_norm:t,mapN:n,uv:r}=i,s=e.dFdx(),a=e.dFdy(),l=r.dFdx(),u=r.dFdy(),h=t,g=a.cross(h),v=h.cross(s),x=g.mul(l.x).add(v.mul(u.x)),S=g.mul(l.y).add(v.mul(u.y)),w=x.dot(x).max(S.dot(S)),R=Xg.mul(w.inverseSqrt());return Qr(x.mul(n.x,R),S.mul(n.y,R),h.mul(n.z)).normalize()});class oee extends Zr{static get type(){return"NormalMapNode"}constructor(e,t=null){super("vec3"),this.node=e,this.scaleNode=t,this.normalMapType=Dc}setup(e){const{normalMapType:t,scaleNode:n}=this;let r=this.node.mul(2).sub(1);n!==null&&(r=Ne(r.xy.mul(n),r.z));let s=null;return t===B7?s=iE(r):t===Dc&&(e.hasGeometryAttribute("tangent")===!0?s=Yf.mul(r).normalize():s=aee({eye_pos:Xr,surf_norm:Jo,mapN:r,uv:Er()})),s}}const jT=ht(oee),lee=je(({textureNode:i,bumpScale:e})=>{const t=r=>i.cache().context({getUV:s=>r(s.uvNode||Er()),forceUVContext:!0}),n=ge(t(r=>r));return Et(ge(t(r=>r.add(r.dFdx()))).sub(n),ge(t(r=>r.add(r.dFdy()))).sub(n)).mul(e)}),uee=je(i=>{const{surf_pos:e,surf_norm:t,dHdxy:n}=i,r=e.dFdx().normalize(),s=e.dFdy().normalize(),a=t,l=s.cross(a),u=a.cross(r),h=r.dot(l).mul(Xg),g=h.sign().mul(n.x.mul(l).add(n.y.mul(u)));return h.abs().mul(t).sub(g).normalize()});class cee extends Zr{static get type(){return"BumpMapNode"}constructor(e,t=null){super("vec3"),this.textureNode=e,this.scaleNode=t}setup(){const e=this.scaleNode!==null?this.scaleNode:1,t=lee({textureNode:this.textureNode,bumpScale:e});return uee({surf_pos:Xr,surf_norm:Jo,dHdxy:t})}}const z9=ht(cee),LR=new Map;class st extends Mn{static get type(){return"MaterialNode"}constructor(e){super(),this.scope=e}getCache(e,t){let n=LR.get(e);return n===void 0&&(n=Tc(e,t),LR.set(e,n)),n}getFloat(e){return this.getCache(e,"float")}getColor(e){return this.getCache(e,"color")}getTexture(e){return this.getCache(e==="map"?"map":e+"Map","texture")}setup(e){const t=e.context.material,n=this.scope;let r=null;if(n===st.COLOR){const s=t.color!==void 0?this.getColor(n):Ne();t.map&&t.map.isTexture===!0?r=s.mul(this.getTexture("map")):r=s}else if(n===st.OPACITY){const s=this.getFloat(n);t.alphaMap&&t.alphaMap.isTexture===!0?r=s.mul(this.getTexture("alpha")):r=s}else if(n===st.SPECULAR_STRENGTH)t.specularMap&&t.specularMap.isTexture===!0?r=this.getTexture("specular").r:r=ge(1);else if(n===st.SPECULAR_INTENSITY){const s=this.getFloat(n);t.specularIntensityMap&&t.specularIntensityMap.isTexture===!0?r=s.mul(this.getTexture(n).a):r=s}else if(n===st.SPECULAR_COLOR){const s=this.getColor(n);t.specularColorMap&&t.specularColorMap.isTexture===!0?r=s.mul(this.getTexture(n).rgb):r=s}else if(n===st.ROUGHNESS){const s=this.getFloat(n);t.roughnessMap&&t.roughnessMap.isTexture===!0?r=s.mul(this.getTexture(n).g):r=s}else if(n===st.METALNESS){const s=this.getFloat(n);t.metalnessMap&&t.metalnessMap.isTexture===!0?r=s.mul(this.getTexture(n).b):r=s}else if(n===st.EMISSIVE){const s=this.getFloat("emissiveIntensity"),a=this.getColor(n).mul(s);t.emissiveMap&&t.emissiveMap.isTexture===!0?r=a.mul(this.getTexture(n)):r=a}else if(n===st.NORMAL)t.normalMap?(r=jT(this.getTexture("normal"),this.getCache("normalScale","vec2")),r.normalMapType=t.normalMapType):t.bumpMap?r=z9(this.getTexture("bump").r,this.getFloat("bumpScale")):r=Jo;else if(n===st.CLEARCOAT){const s=this.getFloat(n);t.clearcoatMap&&t.clearcoatMap.isTexture===!0?r=s.mul(this.getTexture(n).r):r=s}else if(n===st.CLEARCOAT_ROUGHNESS){const s=this.getFloat(n);t.clearcoatRoughnessMap&&t.clearcoatRoughnessMap.isTexture===!0?r=s.mul(this.getTexture(n).r):r=s}else if(n===st.CLEARCOAT_NORMAL)t.clearcoatNormalMap?r=jT(this.getTexture(n),this.getCache(n+"Scale","vec2")):r=Jo;else if(n===st.SHEEN){const s=this.getColor("sheenColor").mul(this.getFloat("sheen"));t.sheenColorMap&&t.sheenColorMap.isTexture===!0?r=s.mul(this.getTexture("sheenColor").rgb):r=s}else if(n===st.SHEEN_ROUGHNESS){const s=this.getFloat(n);t.sheenRoughnessMap&&t.sheenRoughnessMap.isTexture===!0?r=s.mul(this.getTexture(n).a):r=s,r=r.clamp(.07,1)}else if(n===st.ANISOTROPY)if(t.anisotropyMap&&t.anisotropyMap.isTexture===!0){const s=this.getTexture(n);r=Ly(kd.x,kd.y,kd.y.negate(),kd.x).mul(s.rg.mul(2).sub(Et(1)).normalize().mul(s.b))}else r=kd;else if(n===st.IRIDESCENCE_THICKNESS){const s=ji("1","float",t.iridescenceThicknessRange);if(t.iridescenceThicknessMap){const a=ji("0","float",t.iridescenceThicknessRange);r=s.sub(a).mul(this.getTexture(n).g).add(a)}else r=s}else if(n===st.TRANSMISSION){const s=this.getFloat(n);t.transmissionMap?r=s.mul(this.getTexture(n).r):r=s}else if(n===st.THICKNESS){const s=this.getFloat(n);t.thicknessMap?r=s.mul(this.getTexture(n).g):r=s}else if(n===st.IOR)r=this.getFloat(n);else if(n===st.LIGHT_MAP)r=this.getTexture(n).rgb.mul(this.getFloat("lightMapIntensity"));else if(n===st.AO)r=this.getTexture(n).r.sub(1).mul(this.getFloat("aoMapIntensity")).add(1);else{const s=this.getNodeType(e);r=this.getCache(n,s)}return r}}st.ALPHA_TEST="alphaTest";st.COLOR="color";st.OPACITY="opacity";st.SHININESS="shininess";st.SPECULAR="specular";st.SPECULAR_STRENGTH="specularStrength";st.SPECULAR_INTENSITY="specularIntensity";st.SPECULAR_COLOR="specularColor";st.REFLECTIVITY="reflectivity";st.ROUGHNESS="roughness";st.METALNESS="metalness";st.NORMAL="normal";st.CLEARCOAT="clearcoat";st.CLEARCOAT_ROUGHNESS="clearcoatRoughness";st.CLEARCOAT_NORMAL="clearcoatNormal";st.EMISSIVE="emissive";st.ROTATION="rotation";st.SHEEN="sheen";st.SHEEN_ROUGHNESS="sheenRoughness";st.ANISOTROPY="anisotropy";st.IRIDESCENCE="iridescence";st.IRIDESCENCE_IOR="iridescenceIOR";st.IRIDESCENCE_THICKNESS="iridescenceThickness";st.IOR="ior";st.TRANSMISSION="transmission";st.THICKNESS="thickness";st.ATTENUATION_DISTANCE="attenuationDistance";st.ATTENUATION_COLOR="attenuationColor";st.LINE_SCALE="scale";st.LINE_DASH_SIZE="dashSize";st.LINE_GAP_SIZE="gapSize";st.LINE_WIDTH="linewidth";st.LINE_DASH_OFFSET="dashOffset";st.POINT_WIDTH="pointWidth";st.DISPERSION="dispersion";st.LIGHT_MAP="light";st.AO="ao";const G9=zt(st,st.ALPHA_TEST),q9=zt(st,st.COLOR),V9=zt(st,st.SHININESS),H9=zt(st,st.EMISSIVE),aE=zt(st,st.OPACITY),j9=zt(st,st.SPECULAR),WT=zt(st,st.SPECULAR_INTENSITY),W9=zt(st,st.SPECULAR_COLOR),Fm=zt(st,st.SPECULAR_STRENGTH),Jv=zt(st,st.REFLECTIVITY),$9=zt(st,st.ROUGHNESS),X9=zt(st,st.METALNESS),Y9=zt(st,st.NORMAL).context({getUV:null}),Q9=zt(st,st.CLEARCOAT),K9=zt(st,st.CLEARCOAT_ROUGHNESS),Z9=zt(st,st.CLEARCOAT_NORMAL).context({getUV:null}),J9=zt(st,st.ROTATION),eU=zt(st,st.SHEEN),tU=zt(st,st.SHEEN_ROUGHNESS),nU=zt(st,st.ANISOTROPY),iU=zt(st,st.IRIDESCENCE),rU=zt(st,st.IRIDESCENCE_IOR),sU=zt(st,st.IRIDESCENCE_THICKNESS),aU=zt(st,st.TRANSMISSION),oU=zt(st,st.THICKNESS),lU=zt(st,st.IOR),uU=zt(st,st.ATTENUATION_DISTANCE),cU=zt(st,st.ATTENUATION_COLOR),hU=zt(st,st.LINE_SCALE),fU=zt(st,st.LINE_DASH_SIZE),AU=zt(st,st.LINE_GAP_SIZE),hee=zt(st,st.LINE_WIDTH),dU=zt(st,st.LINE_DASH_OFFSET),fee=zt(st,st.POINT_WIDTH),pU=zt(st,st.DISPERSION),oE=zt(st,st.LIGHT_MAP),mU=zt(st,st.AO),kd=gn(new dt).onReference(function(i){return i.material}).onRenderUpdate(function({material:i}){this.value.set(i.anisotropy*Math.cos(i.anisotropyRotation),i.anisotropy*Math.sin(i.anisotropyRotation))}),lE=je(i=>i.context.setupModelViewProjection(),"vec4").once()().varying("v_modelViewProjection");class pr extends Mn{static get type(){return"IndexNode"}constructor(e){super("uint"),this.scope=e,this.isIndexNode=!0}generate(e){const t=this.getNodeType(e),n=this.scope;let r;if(n===pr.VERTEX)r=e.getVertexIndex();else if(n===pr.INSTANCE)r=e.getInstanceIndex();else if(n===pr.DRAW)r=e.getDrawIndex();else if(n===pr.INVOCATION_LOCAL)r=e.getInvocationLocalIndex();else if(n===pr.INVOCATION_SUBGROUP)r=e.getInvocationSubgroupIndex();else if(n===pr.SUBGROUP)r=e.getSubgroupIndex();else throw new Error("THREE.IndexNode: Unknown scope: "+n);let s;return e.shaderStage==="vertex"||e.shaderStage==="compute"?s=r:s=ro(this).build(e,t),s}}pr.VERTEX="vertex";pr.INSTANCE="instance";pr.SUBGROUP="subgroup";pr.INVOCATION_LOCAL="invocationLocal";pr.INVOCATION_SUBGROUP="invocationSubgroup";pr.DRAW="draw";const gU=zt(pr,pr.VERTEX),Jg=zt(pr,pr.INSTANCE),Aee=zt(pr,pr.SUBGROUP),dee=zt(pr,pr.INVOCATION_SUBGROUP),pee=zt(pr,pr.INVOCATION_LOCAL),vU=zt(pr,pr.DRAW);class _U extends Mn{static get type(){return"InstanceNode"}constructor(e,t,n){super("void"),this.count=e,this.instanceMatrix=t,this.instanceColor=n,this.instanceMatrixNode=null,this.instanceColorNode=null,this.updateType=jn.FRAME,this.buffer=null,this.bufferColor=null}setup(e){const{count:t,instanceMatrix:n,instanceColor:r}=this;let{instanceMatrixNode:s,instanceColorNode:a}=this;if(s===null){if(t<=1e3)s=Yg(n.array,"mat4",Math.max(t,1)).element(Jg);else{const u=new h_(n.array,16,1);this.buffer=u;const h=n.usage===qd?VT:J_,g=[h(u,"vec4",16,0),h(u,"vec4",16,4),h(u,"vec4",16,8),h(u,"vec4",16,12)];s=nA(...g)}this.instanceMatrixNode=s}if(r&&a===null){const u=new Ig(r.array,3),h=r.usage===qd?VT:J_;this.bufferColor=u,a=Ne(h(u,"vec3",3,0)),this.instanceColorNode=a}const l=s.mul(Gr).xyz;if(Gr.assign(l),e.hasGeometryAttribute("normal")){const u=C9(no,s);no.assign(u)}this.instanceColorNode!==null&&Sg("vec3","vInstanceColor").assign(this.instanceColorNode)}update(){this.instanceMatrix.usage!==qd&&this.buffer!==null&&this.instanceMatrix.version!==this.buffer.version&&(this.buffer.version=this.instanceMatrix.version),this.instanceColor&&this.instanceColor.usage!==qd&&this.bufferColor!==null&&this.instanceColor.version!==this.bufferColor.version&&(this.bufferColor.version=this.instanceColor.version)}}const mee=ht(_U);class gee extends _U{static get type(){return"InstancedMeshNode"}constructor(e){const{count:t,instanceMatrix:n,instanceColor:r}=e;super(t,n,r),this.instancedMesh=e}}const yU=ht(gee);class vee extends Mn{static get type(){return"BatchNode"}constructor(e){super("void"),this.batchMesh=e,this.batchingIdNode=null}setup(e){this.batchingIdNode===null&&(e.getDrawIndex()===null?this.batchingIdNode=Jg:this.batchingIdNode=vU);const n=je(([w])=>{const R=Fh(Fr(this.batchMesh._indirectTexture),0),C=ye(w).modInt(ye(R)),E=ye(w).div(ye(R));return Fr(this.batchMesh._indirectTexture,ms(C,E)).x}).setLayout({name:"getIndirectIndex",type:"uint",inputs:[{name:"id",type:"int"}]})(ye(this.batchingIdNode)),r=this.batchMesh._matricesTexture,s=Fh(Fr(r),0),a=ge(n).mul(4).toInt().toVar(),l=a.modInt(s),u=a.div(ye(s)),h=nA(Fr(r,ms(l,u)),Fr(r,ms(l.add(1),u)),Fr(r,ms(l.add(2),u)),Fr(r,ms(l.add(3),u))),g=this.batchMesh._colorsTexture;if(g!==null){const R=je(([C])=>{const E=Fh(Fr(g),0).x,B=C,L=B.modInt(E),O=B.div(E);return Fr(g,ms(L,O)).rgb}).setLayout({name:"getBatchingColor",type:"vec3",inputs:[{name:"id",type:"int"}]})(n);Sg("vec3","vBatchColor").assign(R)}const v=ha(h);Gr.assign(h.mul(Gr));const x=no.div(Ne(v[0].dot(v[0]),v[1].dot(v[1]),v[2].dot(v[2]))),S=v.mul(x).xyz;no.assign(S),e.hasGeometryAttribute("tangent")&&Qg.mulAssign(v)}}const xU=ht(vee),UR=new WeakMap;class bU extends Mn{static get type(){return"SkinningNode"}constructor(e,t=!1){super("void"),this.skinnedMesh=e,this.useReference=t,this.updateType=jn.OBJECT,this.skinIndexNode=_u("skinIndex","uvec4"),this.skinWeightNode=_u("skinWeight","vec4");let n,r,s;t?(n=ji("bindMatrix","mat4"),r=ji("bindMatrixInverse","mat4"),s=HT("skeleton.boneMatrices","mat4",e.skeleton.bones.length)):(n=gn(e.bindMatrix,"mat4"),r=gn(e.bindMatrixInverse,"mat4"),s=Yg(e.skeleton.boneMatrices,"mat4",e.skeleton.bones.length)),this.bindMatrixNode=n,this.bindMatrixInverseNode=r,this.boneMatricesNode=s,this.previousBoneMatricesNode=null}getSkinnedPosition(e=this.boneMatricesNode,t=Gr){const{skinIndexNode:n,skinWeightNode:r,bindMatrixNode:s,bindMatrixInverseNode:a}=this,l=e.element(n.x),u=e.element(n.y),h=e.element(n.z),g=e.element(n.w),v=s.mul(t),x=Qr(l.mul(r.x).mul(v),u.mul(r.y).mul(v),h.mul(r.z).mul(v),g.mul(r.w).mul(v));return a.mul(x).xyz}getSkinnedNormal(e=this.boneMatricesNode,t=no){const{skinIndexNode:n,skinWeightNode:r,bindMatrixNode:s,bindMatrixInverseNode:a}=this,l=e.element(n.x),u=e.element(n.y),h=e.element(n.z),g=e.element(n.w);let v=Qr(r.x.mul(l),r.y.mul(u),r.z.mul(h),r.w.mul(g));return v=a.mul(v).mul(s),v.transformDirection(t).xyz}getPreviousSkinnedPosition(e){const t=e.object;return this.previousBoneMatricesNode===null&&(t.skeleton.previousBoneMatrices=new Float32Array(t.skeleton.boneMatrices),this.previousBoneMatricesNode=HT("skeleton.previousBoneMatrices","mat4",t.skeleton.bones.length)),this.getSkinnedPosition(this.previousBoneMatricesNode,ey)}needsPreviousBoneMatrices(e){const t=e.renderer.getMRT();return t&&t.has("velocity")||IP(e.object).useVelocity===!0}setup(e){this.needsPreviousBoneMatrices(e)&&ey.assign(this.getPreviousSkinnedPosition(e));const t=this.getSkinnedPosition();if(Gr.assign(t),e.hasGeometryAttribute("normal")){const n=this.getSkinnedNormal();no.assign(n),e.hasGeometryAttribute("tangent")&&Qg.assign(n)}}generate(e,t){if(t!=="void")return Gr.build(e,t)}update(e){const n=(this.useReference?e.object:this.skinnedMesh).skeleton;UR.get(n)!==e.frameId&&(UR.set(n,e.frameId),this.previousBoneMatricesNode!==null&&n.previousBoneMatrices.set(n.boneMatrices),n.update())}}const _ee=i=>gt(new bU(i)),SU=i=>gt(new bU(i,!0));class yee extends Mn{static get type(){return"LoopNode"}constructor(e=[]){super(),this.params=e}getVarName(e){return String.fromCharCode(105+e)}getProperties(e){const t=e.getNodeProperties(this);if(t.stackNode!==void 0)return t;const n={};for(let s=0,a=this.params.length-1;sNumber(v)?w=">=":w="<"));const C={start:g,end:v},E=C.start,B=C.end;let L="",O="",z="";R||(S==="int"||S==="uint"?w.includes("<")?R="++":R="--":w.includes("<")?R="+= 1.":R="-= 1."),L+=e.getVar(S,x)+" = "+E,O+=x+" "+w+" "+B,z+=x+" "+R;const G=`for ( ${L}; ${O}; ${z} )`;e.addFlowCode((l===0?` `:"")+e.tab+G+` { `).addFlowTab()}const s=r.build(e,"void"),a=t.returnsNode?t.returnsNode.build(e):"";e.removeFlowTab().addFlowCode(` `+e.tab+s);for(let l=0,u=this.params.length-1;lmt(new yee(tA(i,"int"))).append(),xee=()=>Hh("continue").append(),TU=()=>Hh("break").append(),bee=(...i)=>(console.warn("TSL.LoopNode: loop() has been renamed to Loop()."),ki(...i)),$3=new WeakMap,vo=new Pn,BR=je(({bufferMap:i,influence:e,stride:t,width:n,depth:r,offset:s})=>{const a=ye(gU).mul(t).add(s),l=a.div(n),u=a.sub(l.mul(n));return Fr(i,ms(u,l)).depth(r).mul(e)});function See(i){const e=i.morphAttributes.position!==void 0,t=i.morphAttributes.normal!==void 0,n=i.morphAttributes.color!==void 0,r=i.morphAttributes.position||i.morphAttributes.normal||i.morphAttributes.color,s=r!==void 0?r.length:0;let a=$3.get(i);if(a===void 0||a.count!==s){let B=function(){C.dispose(),$3.delete(i),i.removeEventListener("dispose",B)};var l=B;a!==void 0&&a.texture.dispose();const u=i.morphAttributes.position||[],h=i.morphAttributes.normal||[],g=i.morphAttributes.color||[];let v=0;e===!0&&(v=1),t===!0&&(v=2),n===!0&&(v=3);let x=i.attributes.position.count*v,S=1;const w=4096;x>w&&(S=Math.ceil(x/w),x=w);const R=new Float32Array(x*S*4*s),C=new Hw(R,x,S,s);C.type=$r,C.needsUpdate=!0;const E=v*4;for(let L=0;L{const x=ge(0).toVar();this.mesh.count>1&&this.mesh.morphTexture!==null&&this.mesh.morphTexture!==void 0?x.assign(Fr(this.mesh.morphTexture,ms(ye(v).add(1),ye(Jg))).r):x.assign(ji("morphTargetInfluences","float").element(v).toVar()),n===!0&&Gr.addAssign(BR({bufferMap:l,influence:x,stride:u,width:g,depth:v,offset:ye(0)})),r===!0&&no.addAssign(BR({bufferMap:l,influence:x,stride:u,width:g,depth:v,offset:ye(1)}))})}update(){const e=this.morphBaseInfluence;this.mesh.geometry.morphTargetsRelative?e.value=1:e.value=1-this.mesh.morphTargetInfluences.reduce((t,n)=>t+n,0)}}const wU=ct(Tee);class K0 extends Mn{static get type(){return"LightingNode"}constructor(){super("vec3"),this.isLightingNode=!0}}class wee extends K0{static get type(){return"AONode"}constructor(e=null){super(),this.aoNode=e}setup(e){e.context.ambientOcclusion.mulAssign(this.aoNode)}}class Mee extends ZL{static get type(){return"LightingContextNode"}constructor(e,t=null,n=null,r=null){super(e),this.lightingModel=t,this.backdropNode=n,this.backdropAlphaNode=r,this._value=null}getContext(){const{backdropNode:e,backdropAlphaNode:t}=this,n=Ne().toVar("directDiffuse"),r=Ne().toVar("directSpecular"),s=Ne().toVar("indirectDiffuse"),a=Ne().toVar("indirectSpecular"),l={directDiffuse:n,directSpecular:r,indirectDiffuse:s,indirectSpecular:a};return{radiance:Ne().toVar("radiance"),irradiance:Ne().toVar("irradiance"),iblIrradiance:Ne().toVar("iblIrradiance"),ambientOcclusion:ge(1).toVar("ambientOcclusion"),reflectedLight:l,backdrop:e,backdropAlpha:t}}setup(e){return this.value=this._value||(this._value=this.getContext()),this.value.lightingModel=this.lightingModel||e.context.lightingModel,super.setup(e)}}const MU=ct(Mee);class Eee extends K0{static get type(){return"IrradianceNode"}constructor(e){super(),this.node=e}setup(e){e.context.irradiance.addAssign(this.node)}}let am,om;class ss extends Mn{static get type(){return"ScreenNode"}constructor(e){super(),this.scope=e,this.isViewportNode=!0}getNodeType(){return this.scope===ss.VIEWPORT?"vec4":"vec2"}getUpdateType(){let e=jn.NONE;return(this.scope===ss.SIZE||this.scope===ss.VIEWPORT)&&(e=jn.RENDER),this.updateType=e,e}update({renderer:e}){const t=e.getRenderTarget();this.scope===ss.VIEWPORT?t!==null?om.copy(t.viewport):(e.getViewport(om),om.multiplyScalar(e.getPixelRatio())):t!==null?(am.width=t.width,am.height=t.height):e.getDrawingBufferSize(am)}setup(){const e=this.scope;let t=null;return e===ss.SIZE?t=gn(am||(am=new At)):e===ss.VIEWPORT?t=gn(om||(om=new Pn)):t=Et(e1.div(Rg)),t}generate(e){if(this.scope===ss.COORDINATE){let t=e.getFragCoord();if(e.isFlipY()){const n=e.getNodeProperties(Rg).outputNode.build(e);t=`${e.getType("vec2")}( ${t}.x, ${n}.y - ${t}.y )`}return t}return super.generate(e)}}ss.COORDINATE="coordinate";ss.VIEWPORT="viewport";ss.SIZE="size";ss.UV="uv";const bu=zt(ss,ss.UV),Rg=zt(ss,ss.SIZE),e1=zt(ss,ss.COORDINATE),uE=zt(ss,ss.VIEWPORT),EU=uE.zw,CU=e1.sub(uE.xy),Cee=CU.div(EU),Ree=je(()=>(console.warn('TSL.ViewportNode: "viewportResolution" is deprecated. Use "screenSize" instead.'),Rg),"vec2").once()(),Nee=je(()=>(console.warn('TSL.ViewportNode: "viewportTopLeft" is deprecated. Use "screenUV" instead.'),bu),"vec2").once()(),Dee=je(()=>(console.warn('TSL.ViewportNode: "viewportBottomLeft" is deprecated. Use "screenUV.flipY()" instead.'),bu.flipY()),"vec2").once()(),lm=new At;class $y extends yu{static get type(){return"ViewportTextureNode"}constructor(e=bu,t=null,n=null){n===null&&(n=new j7,n.minFilter=Va),super(n,e,t),this.generateMipmaps=!1,this.isOutputTextureNode=!0,this.updateBeforeType=jn.FRAME}updateBefore(e){const t=e.renderer;t.getDrawingBufferSize(lm);const n=this.value;(n.image.width!==lm.width||n.image.height!==lm.height)&&(n.image.width=lm.width,n.image.height=lm.height,n.needsUpdate=!0);const r=n.generateMipmaps;n.generateMipmaps=this.generateMipmaps,t.copyFramebufferToTexture(n),n.generateMipmaps=r}clone(){const e=new this.constructor(this.uvNode,this.levelNode,this.value);return e.generateMipmaps=this.generateMipmaps,e}}const Pee=ct($y),cE=ct($y,null,null,{generateMipmaps:!0});let X3=null;class Lee extends $y{static get type(){return"ViewportDepthTextureNode"}constructor(e=bu,t=null){X3===null&&(X3=new qc),super(e,t,X3)}}const hE=ct(Lee);class Xa extends Mn{static get type(){return"ViewportDepthNode"}constructor(e,t=null){super("float"),this.scope=e,this.valueNode=t,this.isViewportDepthNode=!0}generate(e){const{scope:t}=this;return t===Xa.DEPTH_BASE?e.getFragDepth():super.generate(e)}setup({camera:e}){const{scope:t}=this,n=this.valueNode;let r=null;if(t===Xa.DEPTH_BASE)n!==null&&(r=NU().assign(n));else if(t===Xa.DEPTH)e.isPerspectiveCamera?r=RU(Xr.z,Dh,Ph):r=s0(Xr.z,Dh,Ph);else if(t===Xa.LINEAR_DEPTH)if(n!==null)if(e.isPerspectiveCamera){const s=fE(n,Dh,Ph);r=s0(s,Dh,Ph)}else r=n;else r=s0(Xr.z,Dh,Ph);return r}}Xa.DEPTH_BASE="depthBase";Xa.DEPTH="depth";Xa.LINEAR_DEPTH="linearDepth";const s0=(i,e,t)=>i.add(e).div(e.sub(t)),Uee=(i,e,t)=>e.sub(t).mul(i).sub(e),RU=(i,e,t)=>e.add(i).mul(t).div(t.sub(e).mul(i)),fE=(i,e,t)=>e.mul(t).div(t.sub(e).mul(i).sub(t)),AE=(i,e,t)=>{e=e.max(1e-6).toVar();const n=cu(i.negate().div(e)),r=cu(t.div(e));return n.div(r)},Bee=(i,e,t)=>{const n=i.mul(Oy(t.div(e)));return ge(Math.E).pow(n).mul(e).negate()},NU=ct(Xa,Xa.DEPTH_BASE),dE=zt(Xa,Xa.DEPTH),ty=ct(Xa,Xa.LINEAR_DEPTH),Oee=ty(hE());dE.assign=i=>NU(i);class Iee extends Mn{constructor(e){super("float"),this.name=e,this.isBuiltinNode=!0}generate(){return this.name}}const Fee=ct(Iee);class Yo extends Mn{static get type(){return"ClippingNode"}constructor(e=Yo.DEFAULT){super(),this.scope=e}setup(e){super.setup(e);const t=e.clippingContext,{intersectionPlanes:n,unionPlanes:r}=t;return this.hardwareClipping=e.material.hardwareClipping,this.scope===Yo.ALPHA_TO_COVERAGE?this.setupAlphaToCoverage(n,r):this.scope===Yo.HARDWARE?this.setupHardwareClipping(r,e):this.setupDefault(n,r)}setupAlphaToCoverage(e,t){return je(()=>{const n=ge().toVar("distanceToPlane"),r=ge().toVar("distanceToGradient"),s=ge(1).toVar("clipOpacity"),a=t.length;if(this.hardwareClipping===!1&&a>0){const u=Sc(t);ki(a,({i:h})=>{const g=u.element(h);n.assign(Xr.dot(g.xyz).negate().add(g.w)),r.assign(n.fwidth().div(2)),s.mulAssign(kc(r.negate(),r,n))})}const l=e.length;if(l>0){const u=Sc(e),h=ge(1).toVar("intersectionClipOpacity");ki(l,({i:g})=>{const v=u.element(g);n.assign(Xr.dot(v.xyz).negate().add(v.w)),r.assign(n.fwidth().div(2)),h.mulAssign(kc(r.negate(),r,n).oneMinus())}),s.mulAssign(h.oneMinus())}Ui.a.mulAssign(s),Ui.a.equal(0).discard()})()}setupDefault(e,t){return je(()=>{const n=t.length;if(this.hardwareClipping===!1&&n>0){const s=Sc(t);ki(n,({i:a})=>{const l=s.element(a);Xr.dot(l.xyz).greaterThan(l.w).discard()})}const r=e.length;if(r>0){const s=Sc(e),a=Ic(!0).toVar("clipped");ki(r,({i:l})=>{const u=s.element(l);a.assign(Xr.dot(u.xyz).greaterThan(u.w).and(a))}),a.discard()}})()}setupHardwareClipping(e,t){const n=e.length;return t.enableHardwareClipping(n),je(()=>{const r=Sc(e),s=Fee(t.getClipDistance());ki(n,({i:a})=>{const l=r.element(a),u=Xr.dot(l.xyz).sub(l.w).negate();s.element(a).assign(u)})})()}}Yo.ALPHA_TO_COVERAGE="alphaToCoverage";Yo.DEFAULT="default";Yo.HARDWARE="hardware";const kee=()=>mt(new Yo),zee=()=>mt(new Yo(Yo.ALPHA_TO_COVERAGE)),Gee=()=>mt(new Yo(Yo.HARDWARE)),qee=.05,OR=je(([i])=>Hc(Wn(1e4,Mo(Wn(17,i.x).add(Wn(.1,i.y)))).mul(Qr(.1,ur(Mo(Wn(13,i.y).add(i.x))))))),IR=je(([i])=>OR(Et(OR(i.xy),i.z))),Vee=je(([i])=>{const e=qr(Rc($M(i.xyz)),Rc(XM(i.xyz))),t=ge(1).div(ge(qee).mul(e)).toVar("pixScale"),n=Et(O0(hu(cu(t))),O0(Iy(cu(t)))),r=Et(IR(hu(n.x.mul(i.xyz))),IR(hu(n.y.mul(i.xyz)))),s=Hc(cu(t)),a=Qr(Wn(s.oneMinus(),r.x),Wn(s,r.y)),l=to(s,s.oneMinus()),u=Ne(a.mul(a).div(Wn(2,l).mul(Ti(1,l))),a.sub(Wn(.5,l)).div(Ti(1,l)),Ti(1,Ti(1,a).mul(Ti(1,a)).div(Wn(2,l).mul(Ti(1,l))))),h=a.lessThan(l.oneMinus()).select(a.lessThan(l).select(u.x,u.y),u.z);return vu(h,1e-6,1)}).setLayout({name:"getAlphaHashThreshold",type:"float",inputs:[{name:"position",type:"vec3"}]});class Vr extends ua{static get type(){return"NodeMaterial"}get type(){return this.constructor.type}set type(e){}constructor(){super(),this.isNodeMaterial=!0,this.fog=!0,this.lights=!1,this.hardwareClipping=!1,this.lightsNode=null,this.envNode=null,this.aoNode=null,this.colorNode=null,this.normalNode=null,this.opacityNode=null,this.backdropNode=null,this.backdropAlphaNode=null,this.alphaTestNode=null,this.positionNode=null,this.geometryNode=null,this.depthNode=null,this.shadowPositionNode=null,this.receivedShadowNode=null,this.castShadowNode=null,this.outputNode=null,this.mrtNode=null,this.fragmentNode=null,this.vertexNode=null}customProgramCacheKey(){return this.type+PP(this)}build(e){this.setup(e)}setupObserver(e){return new zZ(e)}setup(e){e.context.setupNormal=()=>this.setupNormal(e),e.context.setupPositionView=()=>this.setupPositionView(e),e.context.setupModelViewProjection=()=>this.setupModelViewProjection(e);const t=e.renderer,n=t.getRenderTarget();e.addStack();const r=this.vertexNode||this.setupVertex(e);e.stack.outputNode=r,this.setupHardwareClipping(e),this.geometryNode!==null&&(e.stack.outputNode=e.stack.outputNode.bypass(this.geometryNode)),e.addFlow("vertex",e.removeStack()),e.addStack();let s;const a=this.setupClipping(e);if((this.depthWrite===!0||this.depthTest===!0)&&(n!==null?n.depthBuffer===!0&&this.setupDepth(e):t.depth===!0&&this.setupDepth(e)),this.fragmentNode===null){this.setupDiffuseColor(e),this.setupVariants(e);const l=this.setupLighting(e);a!==null&&e.stack.add(a);const u=dn(l,Ui.a).max(0);if(s=this.setupOutput(e,u),Eg.assign(s),this.outputNode!==null&&(s=this.outputNode),n!==null){const h=t.getMRT(),g=this.mrtNode;h!==null?(s=h,g!==null&&(s=h.merge(g))):g!==null&&(s=g)}}else{let l=this.fragmentNode;l.isOutputStructNode!==!0&&(l=dn(l)),s=this.setupOutput(e,l)}e.stack.outputNode=s,e.addFlow("fragment",e.removeStack()),e.monitor=this.setupObserver(e)}setupClipping(e){if(e.clippingContext===null)return null;const{unionPlanes:t,intersectionPlanes:n}=e.clippingContext;let r=null;if(t.length>0||n.length>0){const s=e.renderer.samples;this.alphaToCoverage&&s>1?r=zee():e.stack.add(kee())}return r}setupHardwareClipping(e){if(this.hardwareClipping=!1,e.clippingContext===null)return;const t=e.clippingContext.unionPlanes.length;t>0&&t<=8&&e.isAvailable("clipDistance")&&(e.stack.add(Gee()),this.hardwareClipping=!0)}setupDepth(e){const{renderer:t,camera:n}=e;let r=this.depthNode;if(r===null){const s=t.getMRT();s&&s.has("depth")?r=s.get("depth"):t.logarithmicDepthBuffer===!0&&(n.isPerspectiveCamera?r=AE(Xr.z,Dh,Ph):r=s0(Xr.z,Dh,Ph))}r!==null&&dE.assign(r).append()}setupPositionView(){return Q0.mul(Gr).xyz}setupModelViewProjection(){return _A.mul(Xr)}setupVertex(e){return e.addStack(),this.setupPosition(e),e.context.vertex=e.removeStack(),lE}setupPosition(e){const{object:t,geometry:n}=e;if((n.morphAttributes.position||n.morphAttributes.normal||n.morphAttributes.color)&&wU(t).append(),t.isSkinnedMesh===!0&&SU(t).append(),this.displacementMap){const r=Tc("displacementMap","texture"),s=Tc("displacementScale","float"),a=Tc("displacementBias","float");Gr.addAssign(no.normalize().mul(r.x.mul(s).add(a)))}return t.isBatchedMesh&&xU(t).append(),t.isInstancedMesh&&t.instanceMatrix&&t.instanceMatrix.isInstancedBufferAttribute===!0&&yU(t).append(),this.positionNode!==null&&Gr.assign(this.positionNode.context({isPositionNodeInput:!0})),Gr}setupDiffuseColor({object:e,geometry:t}){let n=this.colorNode?dn(this.colorNode):q9;this.vertexColors===!0&&t.hasAttribute("color")&&(n=dn(n.xyz.mul(_u("color","vec3")),n.a)),e.instanceColor&&(n=Sg("vec3","vInstanceColor").mul(n)),e.isBatchedMesh&&e._colorsTexture&&(n=Sg("vec3","vBatchColor").mul(n)),Ui.assign(n);const r=this.opacityNode?ge(this.opacityNode):aE;if(Ui.a.assign(Ui.a.mul(r)),this.alphaTestNode!==null||this.alphaTest>0){const s=this.alphaTestNode!==null?ge(this.alphaTestNode):G9;Ui.a.lessThanEqual(s).discard()}this.alphaHash===!0&&Ui.a.lessThan(Vee(Gr)).discard(),this.transparent===!1&&this.blending===Ka&&this.alphaToCoverage===!1&&Ui.a.assign(1)}setupVariants(){}setupOutgoingLight(){return this.lights===!0?Ne(0):Ui.rgb}setupNormal(){return this.normalNode?Ne(this.normalNode):Y9}setupEnvironment(){let e=null;return this.envNode?e=this.envNode:this.envMap&&(e=this.envMap.isCubeTexture?Tc("envMap","cubeTexture"):Tc("envMap","texture")),e}setupLightMap(e){let t=null;return e.material.lightMap&&(t=new Eee(oE)),t}setupLights(e){const t=[],n=this.setupEnvironment(e);n&&n.isLightingNode&&t.push(n);const r=this.setupLightMap(e);if(r&&r.isLightingNode&&t.push(r),this.aoNode!==null||e.material.aoMap){const a=this.aoNode!==null?this.aoNode:mU;t.push(new wee(a))}let s=this.lightsNode||e.lightsNode;return t.length>0&&(s=e.renderer.lighting.createNode([...s.getLights(),...t])),s}setupLightingModel(){}setupLighting(e){const{material:t}=e,{backdropNode:n,backdropAlphaNode:r,emissiveNode:s}=this,l=this.lights===!0||this.lightsNode!==null?this.setupLights(e):null;let u=this.setupOutgoingLight(e);if(l&&l.getScope().hasLights){const h=this.setupLightingModel(e);u=MU(l,h,n,r)}else n!==null&&(u=Ne(r!==null?Fi(u,n,r):n));return(s&&s.isNode===!0||t.emissive&&t.emissive.isColor===!0)&&(GT.assign(Ne(s||H9)),u=u.add(GT)),u}setupOutput(e,t){if(this.fog===!0){const n=e.fogNode;n&&(Eg.assign(t),t=dn(n))}return t}setDefaultValues(e){for(const n in e){const r=e[n];this[n]===void 0&&(this[n]=r,r&&r.clone&&(this[n]=r.clone()))}const t=Object.getOwnPropertyDescriptors(e.constructor.prototype);for(const n in t)Object.getOwnPropertyDescriptor(this.constructor.prototype,n)===void 0&&t[n].get!==void 0&&Object.defineProperty(this.constructor.prototype,n,t[n])}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{},nodes:{}});const n=ua.prototype.toJSON.call(this,e),r=$_(this);n.inputNodes={};for(const{property:a,childNode:l}of r)n.inputNodes[a]=l.toJSON(e).uuid;function s(a){const l=[];for(const u in a){const h=a[u];delete h.metadata,l.push(h)}return l}if(t){const a=s(e.textures),l=s(e.images),u=s(e.nodes);a.length>0&&(n.textures=a),l.length>0&&(n.images=l),u.length>0&&(n.nodes=u)}return n}copy(e){return this.lightsNode=e.lightsNode,this.envNode=e.envNode,this.colorNode=e.colorNode,this.normalNode=e.normalNode,this.opacityNode=e.opacityNode,this.backdropNode=e.backdropNode,this.backdropAlphaNode=e.backdropAlphaNode,this.alphaTestNode=e.alphaTestNode,this.positionNode=e.positionNode,this.geometryNode=e.geometryNode,this.depthNode=e.depthNode,this.shadowPositionNode=e.shadowPositionNode,this.receivedShadowNode=e.receivedShadowNode,this.castShadowNode=e.castShadowNode,this.outputNode=e.outputNode,this.mrtNode=e.mrtNode,this.fragmentNode=e.fragmentNode,this.vertexNode=e.vertexNode,super.copy(e)}}const Hee=new $0;class jee extends Vr{static get type(){return"LineBasicNodeMaterial"}constructor(e){super(),this.isLineBasicNodeMaterial=!0,this.setDefaultValues(Hee),this.setValues(e)}}const Wee=new Uz;class $ee extends Vr{static get type(){return"LineDashedNodeMaterial"}constructor(e){super(),this.isLineDashedNodeMaterial=!0,this.setDefaultValues(Wee),this.dashOffset=0,this.offsetNode=null,this.dashScaleNode=null,this.dashSizeNode=null,this.gapSizeNode=null,this.setValues(e)}setupVariants(){const e=this.offsetNode?ge(this.offsetNode):dU,t=this.dashScaleNode?ge(this.dashScaleNode):hU,n=this.dashSizeNode?ge(this.dashSizeNode):fU,r=this.gapSizeNode?ge(this.gapSizeNode):AU;Qv.assign(n),qT.assign(r);const s=ro(_u("lineDistance").mul(t));(e?s.add(e):s).mod(Qv.add(qT)).greaterThan(Qv).discard()}}let Y3=null;class Xee extends $y{static get type(){return"ViewportSharedTextureNode"}constructor(e=bu,t=null){Y3===null&&(Y3=new j7),super(e,t,Y3)}updateReference(){return this}}const Yee=ct(Xee),DU=i=>mt(i).mul(.5).add(.5),Qee=i=>mt(i).mul(2).sub(1),Kee=new Nz;class Zee extends Vr{static get type(){return"MeshNormalNodeMaterial"}constructor(e){super(),this.isMeshNormalNodeMaterial=!0,this.setDefaultValues(Kee),this.setValues(e)}setupDiffuseColor(){const e=this.opacityNode?ge(this.opacityNode):aE;Ui.assign(dn(DU(zr),e))}}class Jee extends Zr{static get type(){return"EquirectUVNode"}constructor(e=nE){super("vec2"),this.dirNode=e}setup(){const e=this.dirNode,t=e.z.atan(e.x).mul(1/(Math.PI*2)).add(.5),n=e.y.clamp(-1,1).asin().mul(1/Math.PI).add(.5);return Et(t,n)}}const pE=ct(Jee);class PU extends V7{constructor(e=1,t={}){super(e,t),this.isCubeRenderTarget=!0}fromEquirectangularTexture(e,t){const n=t.minFilter,r=t.generateMipmaps;t.generateMipmaps=!0,this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;const s=new $h(5,5,5),a=pE(nE),l=new Vr;l.colorNode=Ai(t,a,0),l.side=hr,l.blending=Qa;const u=new zi(s,l),h=new Xw;h.add(u),t.minFilter===Va&&(t.minFilter=gs);const g=new q7(1,10,this),v=e.getMRT();return e.setMRT(null),g.update(e,h),e.setMRT(v),t.minFilter=n,t.currentGenerateMipmaps=r,u.geometry.dispose(),u.material.dispose(),this}}const km=new WeakMap;class ete extends Zr{static get type(){return"CubeMapNode"}constructor(e){super("vec3"),this.envNode=e,this._cubeTexture=null,this._cubeTextureNode=I0();const t=new yy;t.isRenderTargetTexture=!0,this._defaultTexture=t,this.updateBeforeType=jn.RENDER}updateBefore(e){const{renderer:t,material:n}=e,r=this.envNode;if(r.isTextureNode||r.isMaterialReferenceNode){const s=r.isTextureNode?r.value:n[r.property];if(s&&s.isTexture){const a=s.mapping;if(a===zh||a===Gh){if(km.has(s)){const l=km.get(s);FR(l,s.mapping),this._cubeTexture=l}else{const l=s.image;if(tte(l)){const u=new PU(l.height);u.fromEquirectangularTexture(t,s),FR(u.texture,s.mapping),this._cubeTexture=u.texture,km.set(s,u.texture),s.addEventListener("dispose",LU)}else this._cubeTexture=this._defaultTexture}this._cubeTextureNode.value=this._cubeTexture}else this._cubeTextureNode=this.envNode}}}setup(e){return this.updateBefore(e),this._cubeTextureNode}}function tte(i){return i==null?!1:i.height>0}function LU(i){const e=i.target;e.removeEventListener("dispose",LU);const t=km.get(e);t!==void 0&&(km.delete(e),t.dispose())}function FR(i,e){e===zh?i.mapping=Qo:e===Gh&&(i.mapping=Ko)}const UU=ct(ete);class mE extends K0{static get type(){return"BasicEnvironmentNode"}constructor(e=null){super(),this.envNode=e}setup(e){e.context.environment=UU(this.envNode)}}class nte extends K0{static get type(){return"BasicLightMapNode"}constructor(e=null){super(),this.lightMapNode=e}setup(e){const t=ge(1/Math.PI);e.context.irradianceLightMap=this.lightMapNode.mul(t)}}class Xy{start(){}finish(){}direct(){}directRectArea(){}indirect(){}ambientOcclusion(){}}class BU extends Xy{constructor(){super()}indirect(e,t,n){const r=e.ambientOcclusion,s=e.reflectedLight,a=n.context.irradianceLightMap;s.indirectDiffuse.assign(dn(0)),a?s.indirectDiffuse.addAssign(a):s.indirectDiffuse.addAssign(dn(1,1,1,0)),s.indirectDiffuse.mulAssign(r),s.indirectDiffuse.mulAssign(Ui.rgb)}finish(e,t,n){const r=n.material,s=e.outgoingLight,a=n.context.environment;if(a)switch(r.combine){case Lg:s.rgb.assign(Fi(s.rgb,s.rgb.mul(a.rgb),Fm.mul(Jv)));break;case E7:s.rgb.assign(Fi(s.rgb,a.rgb,Fm.mul(Jv)));break;case C7:s.rgb.addAssign(a.rgb.mul(Fm.mul(Jv)));break;default:console.warn("THREE.BasicLightingModel: Unsupported .combine value:",r.combine);break}}}const ite=new pA;class rte extends Vr{static get type(){return"MeshBasicNodeMaterial"}constructor(e){super(),this.isMeshBasicNodeMaterial=!0,this.lights=!0,this.setDefaultValues(ite),this.setValues(e)}setupNormal(){return Jo}setupEnvironment(e){const t=super.setupEnvironment(e);return t?new mE(t):null}setupLightMap(e){let t=null;return e.material.lightMap&&(t=new nte(oE)),t}setupOutgoingLight(){return Ui.rgb}setupLightingModel(){return new BU}}const F0=je(({f0:i,f90:e,dotVH:t})=>{const n=t.mul(-5.55473).sub(6.98316).mul(t).exp2();return i.mul(n.oneMinus()).add(e.mul(n))}),AA=je(i=>i.diffuseColor.mul(1/Math.PI)),ste=()=>ge(.25),ate=je(({dotNH:i})=>Q_.mul(ge(.5)).add(1).mul(ge(1/Math.PI)).mul(i.pow(Q_))),ote=je(({lightDirection:i})=>{const e=i.add(dr).normalize(),t=zr.dot(e).clamp(),n=dr.dot(e).clamp(),r=F0({f0:ka,f90:1,dotVH:n}),s=ste(),a=ate({dotNH:t});return r.mul(s).mul(a)});class OU extends BU{constructor(e=!0){super(),this.specular=e}direct({lightDirection:e,lightColor:t,reflectedLight:n}){const s=zr.dot(e).clamp().mul(t);n.directDiffuse.addAssign(s.mul(AA({diffuseColor:Ui.rgb}))),this.specular===!0&&n.directSpecular.addAssign(s.mul(ote({lightDirection:e})).mul(Fm))}indirect({ambientOcclusion:e,irradiance:t,reflectedLight:n}){n.indirectDiffuse.addAssign(t.mul(AA({diffuseColor:Ui}))),n.indirectDiffuse.mulAssign(e)}}const lte=new Vc;class ute extends Vr{static get type(){return"MeshLambertNodeMaterial"}constructor(e){super(),this.isMeshLambertNodeMaterial=!0,this.lights=!0,this.setDefaultValues(lte),this.setValues(e)}setupEnvironment(e){const t=super.setupEnvironment(e);return t?new mE(t):null}setupLightingModel(){return new OU(!1)}}const cte=new nD;class hte extends Vr{static get type(){return"MeshPhongNodeMaterial"}constructor(e){super(),this.isMeshPhongNodeMaterial=!0,this.lights=!0,this.shininessNode=null,this.specularNode=null,this.setDefaultValues(cte),this.setValues(e)}setupEnvironment(e){const t=super.setupEnvironment(e);return t?new mE(t):null}setupLightingModel(){return new OU}setupVariants(){const e=(this.shininessNode?ge(this.shininessNode):V9).max(1e-4);Q_.assign(e);const t=this.specularNode||j9;ka.assign(t)}copy(e){return this.shininessNode=e.shininessNode,this.specularNode=e.specularNode,super.copy(e)}}const IU=je(i=>{if(i.geometry.hasAttribute("normal")===!1)return ge(0);const e=Jo.dFdx().abs().max(Jo.dFdy().abs());return e.x.max(e.y).max(e.z)}),gE=je(i=>{const{roughness:e}=i,t=IU();let n=e.max(.0525);return n=n.add(t),n=n.min(1),n}),FU=je(({alpha:i,dotNL:e,dotNV:t})=>{const n=i.pow2(),r=e.mul(n.add(n.oneMinus().mul(t.pow2())).sqrt()),s=t.mul(n.add(n.oneMinus().mul(e.pow2())).sqrt());return Dl(.5,r.add(s).max(TL))}).setLayout({name:"V_GGX_SmithCorrelated",type:"float",inputs:[{name:"alpha",type:"float"},{name:"dotNL",type:"float"},{name:"dotNV",type:"float"}]}),fte=je(({alphaT:i,alphaB:e,dotTV:t,dotBV:n,dotTL:r,dotBL:s,dotNV:a,dotNL:l})=>{const u=l.mul(Ne(i.mul(t),e.mul(n),a).length()),h=a.mul(Ne(i.mul(r),e.mul(s),l).length());return Dl(.5,u.add(h)).saturate()}).setLayout({name:"V_GGX_SmithCorrelated_Anisotropic",type:"float",inputs:[{name:"alphaT",type:"float",qualifier:"in"},{name:"alphaB",type:"float",qualifier:"in"},{name:"dotTV",type:"float",qualifier:"in"},{name:"dotBV",type:"float",qualifier:"in"},{name:"dotTL",type:"float",qualifier:"in"},{name:"dotBL",type:"float",qualifier:"in"},{name:"dotNV",type:"float",qualifier:"in"},{name:"dotNL",type:"float",qualifier:"in"}]}),kU=je(({alpha:i,dotNH:e})=>{const t=i.pow2(),n=e.pow2().mul(t.oneMinus()).oneMinus();return t.div(n.pow2()).mul(1/Math.PI)}).setLayout({name:"D_GGX",type:"float",inputs:[{name:"alpha",type:"float"},{name:"dotNH",type:"float"}]}),Ate=ge(1/Math.PI),dte=je(({alphaT:i,alphaB:e,dotNH:t,dotTH:n,dotBH:r})=>{const s=i.mul(e),a=Ne(e.mul(n),i.mul(r),s.mul(t)),l=a.dot(a),u=s.div(l);return Ate.mul(s.mul(u.pow2()))}).setLayout({name:"D_GGX_Anisotropic",type:"float",inputs:[{name:"alphaT",type:"float",qualifier:"in"},{name:"alphaB",type:"float",qualifier:"in"},{name:"dotNH",type:"float",qualifier:"in"},{name:"dotTH",type:"float",qualifier:"in"},{name:"dotBH",type:"float",qualifier:"in"}]}),$T=je(i=>{const{lightDirection:e,f0:t,f90:n,roughness:r,f:s,USE_IRIDESCENCE:a,USE_ANISOTROPY:l}=i,u=i.normalView||zr,h=r.pow2(),g=e.add(dr).normalize(),v=u.dot(e).clamp(),x=u.dot(dr).clamp(),S=u.dot(g).clamp(),w=dr.dot(g).clamp();let R=F0({f0:t,f90:n,dotVH:w}),C,E;if(xg(a)&&(R=By.mix(R,s)),xg(l)){const B=Bm.dot(e),L=Bm.dot(dr),O=Bm.dot(g),z=iA.dot(e),G=iA.dot(dr),k=iA.dot(g);C=fte({alphaT:Y_,alphaB:h,dotTV:L,dotBV:G,dotTL:B,dotBL:z,dotNV:x,dotNL:v}),E=dte({alphaT:Y_,alphaB:h,dotNH:S,dotTH:O,dotBH:k})}else C=FU({alpha:h,dotNL:v,dotNV:x}),E=kU({alpha:h,dotNH:S});return R.mul(C).mul(E)}),vE=je(({roughness:i,dotNV:e})=>{const t=dn(-1,-.0275,-.572,.022),n=dn(1,.0425,1.04,-.04),r=i.mul(t).add(n),s=r.x.mul(r.x).min(e.mul(-9.28).exp2()).mul(r.x).add(r.y);return Et(-1.04,1.04).mul(s).add(r.zw)}).setLayout({name:"DFGApprox",type:"vec2",inputs:[{name:"roughness",type:"float"},{name:"dotNV",type:"vec3"}]}),zU=je(i=>{const{dotNV:e,specularColor:t,specularF90:n,roughness:r}=i,s=vE({dotNV:e,roughness:r});return t.mul(s.x).add(n.mul(s.y))}),GU=je(({f:i,f90:e,dotVH:t})=>{const n=t.oneMinus().saturate(),r=n.mul(n),s=n.mul(r,r).clamp(0,.9999);return i.sub(Ne(e).mul(s)).div(s.oneMinus())}).setLayout({name:"Schlick_to_F0",type:"vec3",inputs:[{name:"f",type:"vec3"},{name:"f90",type:"float"},{name:"dotVH",type:"float"}]}),pte=je(({roughness:i,dotNH:e})=>{const t=i.pow2(),n=ge(1).div(t),s=e.pow2().oneMinus().max(.0078125);return ge(2).add(n).mul(s.pow(n.mul(.5))).div(2*Math.PI)}).setLayout({name:"D_Charlie",type:"float",inputs:[{name:"roughness",type:"float"},{name:"dotNH",type:"float"}]}),mte=je(({dotNV:i,dotNL:e})=>ge(1).div(ge(4).mul(e.add(i).sub(e.mul(i))))).setLayout({name:"V_Neubelt",type:"float",inputs:[{name:"dotNV",type:"float"},{name:"dotNL",type:"float"}]}),gte=je(({lightDirection:i})=>{const e=i.add(dr).normalize(),t=zr.dot(i).clamp(),n=zr.dot(dr).clamp(),r=zr.dot(e).clamp(),s=pte({roughness:Uy,dotNH:r}),a=mte({dotNV:n,dotNL:t});return Xf.mul(s).mul(a)}),vte=je(({N:i,V:e,roughness:t})=>{const s=.0078125,a=i.dot(e).saturate(),l=Et(t,a.oneMinus().sqrt());return l.assign(l.mul(.984375).add(s)),l}).setLayout({name:"LTC_Uv",type:"vec2",inputs:[{name:"N",type:"vec3"},{name:"V",type:"vec3"},{name:"roughness",type:"float"}]}),_te=je(({f:i})=>{const e=i.length();return qr(e.mul(e).add(i.z).div(e.add(1)),0)}).setLayout({name:"LTC_ClippedSphereFormFactor",type:"float",inputs:[{name:"f",type:"vec3"}]}),lv=je(({v1:i,v2:e})=>{const t=i.dot(e),n=t.abs().toVar(),r=n.mul(.0145206).add(.4965155).mul(n).add(.8543985).toVar(),s=n.add(4.1616724).mul(n).add(3.417594).toVar(),a=r.div(s),l=t.greaterThan(0).select(a,qr(t.mul(t).oneMinus(),1e-7).inverseSqrt().mul(.5).sub(a));return i.cross(e).mul(l)}).setLayout({name:"LTC_EdgeVectorFormFactor",type:"vec3",inputs:[{name:"v1",type:"vec3"},{name:"v2",type:"vec3"}]}),kR=je(({N:i,V:e,P:t,mInv:n,p0:r,p1:s,p2:a,p3:l})=>{const u=s.sub(r).toVar(),h=l.sub(r).toVar(),g=u.cross(h),v=Ne().toVar();return ti(g.dot(t.sub(r)).greaterThanEqual(0),()=>{const x=e.sub(i.mul(e.dot(i))).normalize(),S=i.cross(x).negate(),w=n.mul(ha(x,S,i).transpose()).toVar(),R=w.mul(r.sub(t)).normalize().toVar(),C=w.mul(s.sub(t)).normalize().toVar(),E=w.mul(a.sub(t)).normalize().toVar(),B=w.mul(l.sub(t)).normalize().toVar(),L=Ne(0).toVar();L.addAssign(lv({v1:R,v2:C})),L.addAssign(lv({v1:C,v2:E})),L.addAssign(lv({v1:E,v2:B})),L.addAssign(lv({v1:B,v2:R})),v.assign(Ne(_te({f:L})))}),v}).setLayout({name:"LTC_Evaluate",type:"vec3",inputs:[{name:"N",type:"vec3"},{name:"V",type:"vec3"},{name:"P",type:"vec3"},{name:"mInv",type:"mat3"},{name:"p0",type:"vec3"},{name:"p1",type:"vec3"},{name:"p2",type:"vec3"},{name:"p3",type:"vec3"}]}),Yy=1/6,qU=i=>Wn(Yy,Wn(i,Wn(i,i.negate().add(3)).sub(3)).add(1)),XT=i=>Wn(Yy,Wn(i,Wn(i,Wn(3,i).sub(6))).add(4)),VU=i=>Wn(Yy,Wn(i,Wn(i,Wn(-3,i).add(3)).add(3)).add(1)),YT=i=>Wn(Yy,Cl(i,3)),zR=i=>qU(i).add(XT(i)),GR=i=>VU(i).add(YT(i)),qR=i=>Qr(-1,XT(i).div(qU(i).add(XT(i)))),VR=i=>Qr(1,YT(i).div(VU(i).add(YT(i)))),HR=(i,e,t)=>{const n=i.uvNode,r=Wn(n,e.zw).add(.5),s=hu(r),a=Hc(r),l=zR(a.x),u=GR(a.x),h=qR(a.x),g=VR(a.x),v=qR(a.y),x=VR(a.y),S=Et(s.x.add(h),s.y.add(v)).sub(.5).mul(e.xy),w=Et(s.x.add(g),s.y.add(v)).sub(.5).mul(e.xy),R=Et(s.x.add(h),s.y.add(x)).sub(.5).mul(e.xy),C=Et(s.x.add(g),s.y.add(x)).sub(.5).mul(e.xy),E=zR(a.y).mul(Qr(l.mul(i.sample(S).level(t)),u.mul(i.sample(w).level(t)))),B=GR(a.y).mul(Qr(l.mul(i.sample(R).level(t)),u.mul(i.sample(C).level(t))));return E.add(B)},HU=je(([i,e=ge(3)])=>{const t=Et(i.size(ye(e))),n=Et(i.size(ye(e.add(1)))),r=Dl(1,t),s=Dl(1,n),a=HR(i,dn(r,t),hu(e)),l=HR(i,dn(s,n),Iy(e));return Hc(e).mix(a,l)}),jR=je(([i,e,t,n,r])=>{const s=Ne(ZM(e.negate(),Fc(i),Dl(1,n))),a=Ne(Rc(r[0].xyz),Rc(r[1].xyz),Rc(r[2].xyz));return Fc(s).mul(t.mul(a))}).setLayout({name:"getVolumeTransmissionRay",type:"vec3",inputs:[{name:"n",type:"vec3"},{name:"v",type:"vec3"},{name:"thickness",type:"float"},{name:"ior",type:"float"},{name:"modelMatrix",type:"mat4"}]}),yte=je(([i,e])=>i.mul(vu(e.mul(2).sub(2),0,1))).setLayout({name:"applyIorToRoughness",type:"float",inputs:[{name:"roughness",type:"float"},{name:"ior",type:"float"}]}),xte=cE(),bte=cE(),WR=je(([i,e,t],{material:n})=>{const s=(n.side===hr?xte:bte).sample(i),a=cu(Rg.x).mul(yte(e,t));return HU(s,a)}),$R=je(([i,e,t])=>(ti(t.notEqual(0),()=>{const n=Oy(e).negate().div(t);return HM(n.negate().mul(i))}),Ne(1))).setLayout({name:"volumeAttenuation",type:"vec3",inputs:[{name:"transmissionDistance",type:"float"},{name:"attenuationColor",type:"vec3"},{name:"attenuationDistance",type:"float"}]}),Ste=je(([i,e,t,n,r,s,a,l,u,h,g,v,x,S,w])=>{let R,C;if(w){R=dn().toVar(),C=Ne().toVar();const z=g.sub(1).mul(w.mul(.025)),G=Ne(g.sub(z),g,g.add(z));ki({start:0,end:3},({i:k})=>{const H=G.element(k),F=jR(i,e,v,H,l),V=a.add(F),X=h.mul(u.mul(dn(V,1))),J=Et(X.xy.div(X.w)).toVar();J.addAssign(1),J.divAssign(2),J.assign(Et(J.x,J.y.oneMinus()));const te=WR(J,t,H);R.element(k).assign(te.element(k)),R.a.addAssign(te.a),C.element(k).assign(n.element(k).mul($R(Rc(F),x,S).element(k)))}),R.a.divAssign(3)}else{const z=jR(i,e,v,g,l),G=a.add(z),k=h.mul(u.mul(dn(G,1))),H=Et(k.xy.div(k.w)).toVar();H.addAssign(1),H.divAssign(2),H.assign(Et(H.x,H.y.oneMinus())),R=WR(H,t,g),C=n.mul($R(Rc(z),x,S))}const E=C.rgb.mul(R.rgb),B=i.dot(e).clamp(),L=Ne(zU({dotNV:B,specularColor:r,specularF90:s,roughness:t})),O=C.r.add(C.g,C.b).div(3);return dn(L.oneMinus().mul(E),R.a.oneMinus().mul(O).oneMinus())}),Tte=ha(3.2404542,-.969266,.0556434,-1.5371385,1.8760108,-.2040259,-.4985314,.041556,1.0572252),wte=i=>{const e=i.sqrt();return Ne(1).add(e).div(Ne(1).sub(e))},XR=(i,e)=>i.sub(e).div(i.add(e)).pow2(),Mte=(i,e)=>{const t=i.mul(2*Math.PI*1e-9),n=Ne(54856e-17,44201e-17,52481e-17),r=Ne(1681e3,1795300,2208400),s=Ne(43278e5,93046e5,66121e5),a=ge(9747e-17*Math.sqrt(2*Math.PI*45282e5)).mul(t.mul(2239900).add(e.x).cos()).mul(t.pow2().mul(-45282e5).exp());let l=n.mul(s.mul(2*Math.PI).sqrt()).mul(r.mul(t).add(e).cos()).mul(t.pow2().negate().mul(s).exp());return l=Ne(l.x.add(a),l.y,l.z).div(10685e-11),Tte.mul(l)},Ete=je(({outsideIOR:i,eta2:e,cosTheta1:t,thinFilmThickness:n,baseF0:r})=>{const s=Fi(i,e,kc(0,.03,n)),l=i.div(s).pow2().mul(t.pow2().oneMinus()).oneMinus();ti(l.lessThan(0),()=>Ne(1));const u=l.sqrt(),h=XR(s,i),g=F0({f0:h,f90:1,dotVH:t}),v=g.oneMinus(),x=s.lessThan(i).select(Math.PI,0),S=ge(Math.PI).sub(x),w=wte(r.clamp(0,.9999)),R=XR(w,s.toVec3()),C=F0({f0:R,f90:1,dotVH:u}),E=Ne(w.x.lessThan(s).select(Math.PI,0),w.y.lessThan(s).select(Math.PI,0),w.z.lessThan(s).select(Math.PI,0)),B=s.mul(n,u,2),L=Ne(S).add(E),O=g.mul(C).clamp(1e-5,.9999),z=O.sqrt(),G=v.pow2().mul(C).div(Ne(1).sub(O)),H=g.add(G).toVar(),F=G.sub(v).toVar();return ki({start:1,end:2,condition:"<=",name:"m"},({m:V})=>{F.mulAssign(z);const X=Mte(ge(V).mul(B),ge(V).mul(L)).mul(2);H.addAssign(F.mul(X))}),H.max(Ne(0))}).setLayout({name:"evalIridescence",type:"vec3",inputs:[{name:"outsideIOR",type:"float"},{name:"eta2",type:"float"},{name:"cosTheta1",type:"float"},{name:"thinFilmThickness",type:"float"},{name:"baseF0",type:"vec3"}]}),Cte=je(({normal:i,viewDir:e,roughness:t})=>{const n=i.dot(e).saturate(),r=t.pow2(),s=zs(t.lessThan(.25),ge(-339.2).mul(r).add(ge(161.4).mul(t)).sub(25.9),ge(-8.48).mul(r).add(ge(14.3).mul(t)).sub(9.95)),a=zs(t.lessThan(.25),ge(44).mul(r).sub(ge(23.7).mul(t)).add(3.26),ge(1.97).mul(r).sub(ge(3.27).mul(t)).add(.72));return zs(t.lessThan(.25),0,ge(.1).mul(t).sub(.025)).add(s.mul(n).add(a).exp()).mul(1/Math.PI).saturate()}),Q3=Ne(.04),K3=ge(1);class jU extends Xy{constructor(e=!1,t=!1,n=!1,r=!1,s=!1,a=!1){super(),this.clearcoat=e,this.sheen=t,this.iridescence=n,this.anisotropy=r,this.transmission=s,this.dispersion=a,this.clearcoatRadiance=null,this.clearcoatSpecularDirect=null,this.clearcoatSpecularIndirect=null,this.sheenSpecularDirect=null,this.sheenSpecularIndirect=null,this.iridescenceFresnel=null,this.iridescenceF0=null}start(e){if(this.clearcoat===!0&&(this.clearcoatRadiance=Ne().toVar("clearcoatRadiance"),this.clearcoatSpecularDirect=Ne().toVar("clearcoatSpecularDirect"),this.clearcoatSpecularIndirect=Ne().toVar("clearcoatSpecularIndirect")),this.sheen===!0&&(this.sheenSpecularDirect=Ne().toVar("sheenSpecularDirect"),this.sheenSpecularIndirect=Ne().toVar("sheenSpecularIndirect")),this.iridescence===!0){const t=zr.dot(dr).clamp();this.iridescenceFresnel=Ete({outsideIOR:ge(1),eta2:BM,cosTheta1:t,thinFilmThickness:OM,baseF0:ka}),this.iridescenceF0=GU({f:this.iridescenceFresnel,f90:1,dotVH:t})}if(this.transmission===!0){const t=Nc,n=b9.sub(Nc).normalize(),r=Hy;e.backdrop=Ste(r,n,Zl,Ui,ka,Mg,t,$o,so,_A,Om,IM,kM,FM,this.dispersion?zM:null),e.backdropAlpha=K_,Ui.a.mulAssign(Fi(1,e.backdrop.a,K_))}}computeMultiscattering(e,t,n){const r=zr.dot(dr).clamp(),s=vE({roughness:Zl,dotNV:r}),l=(this.iridescenceF0?By.mix(ka,this.iridescenceF0):ka).mul(s.x).add(n.mul(s.y)),h=s.x.add(s.y).oneMinus(),g=ka.add(ka.oneMinus().mul(.047619)),v=l.mul(g).div(h.mul(g).oneMinus());e.addAssign(l),t.addAssign(v.mul(h))}direct({lightDirection:e,lightColor:t,reflectedLight:n}){const s=zr.dot(e).clamp().mul(t);if(this.sheen===!0&&this.sheenSpecularDirect.addAssign(s.mul(gte({lightDirection:e}))),this.clearcoat===!0){const l=Qd.dot(e).clamp().mul(t);this.clearcoatSpecularDirect.addAssign(l.mul($T({lightDirection:e,f0:Q3,f90:K3,roughness:wg,normalView:Qd})))}n.directDiffuse.addAssign(s.mul(AA({diffuseColor:Ui.rgb}))),n.directSpecular.addAssign(s.mul($T({lightDirection:e,f0:ka,f90:1,roughness:Zl,iridescence:this.iridescence,f:this.iridescenceFresnel,USE_IRIDESCENCE:this.iridescence,USE_ANISOTROPY:this.anisotropy})))}directRectArea({lightColor:e,lightPosition:t,halfWidth:n,halfHeight:r,reflectedLight:s,ltc_1:a,ltc_2:l}){const u=t.add(n).sub(r),h=t.sub(n).sub(r),g=t.sub(n).add(r),v=t.add(n).add(r),x=zr,S=dr,w=Xr.toVar(),R=vte({N:x,V:S,roughness:Zl}),C=a.sample(R).toVar(),E=l.sample(R).toVar(),B=ha(Ne(C.x,0,C.y),Ne(0,1,0),Ne(C.z,0,C.w)).toVar(),L=ka.mul(E.x).add(ka.oneMinus().mul(E.y)).toVar();s.directSpecular.addAssign(e.mul(L).mul(kR({N:x,V:S,P:w,mInv:B,p0:u,p1:h,p2:g,p3:v}))),s.directDiffuse.addAssign(e.mul(Ui).mul(kR({N:x,V:S,P:w,mInv:ha(1,0,0,0,1,0,0,0,1),p0:u,p1:h,p2:g,p3:v})))}indirect(e,t,n){this.indirectDiffuse(e,t,n),this.indirectSpecular(e,t,n),this.ambientOcclusion(e,t,n)}indirectDiffuse({irradiance:e,reflectedLight:t}){t.indirectDiffuse.addAssign(e.mul(AA({diffuseColor:Ui})))}indirectSpecular({radiance:e,iblIrradiance:t,reflectedLight:n}){if(this.sheen===!0&&this.sheenSpecularIndirect.addAssign(t.mul(Xf,Cte({normal:zr,viewDir:dr,roughness:Uy}))),this.clearcoat===!0){const h=Qd.dot(dr).clamp(),g=zU({dotNV:h,specularColor:Q3,specularF90:K3,roughness:wg});this.clearcoatSpecularIndirect.addAssign(this.clearcoatRadiance.mul(g))}const r=Ne().toVar("singleScattering"),s=Ne().toVar("multiScattering"),a=t.mul(1/Math.PI);this.computeMultiscattering(r,s,Mg);const l=r.add(s),u=Ui.mul(l.r.max(l.g).max(l.b).oneMinus());n.indirectSpecular.addAssign(e.mul(r)),n.indirectSpecular.addAssign(s.mul(a)),n.indirectDiffuse.addAssign(u.mul(a))}ambientOcclusion({ambientOcclusion:e,reflectedLight:t}){const r=zr.dot(dr).clamp().add(e),s=Zl.mul(-16).oneMinus().negate().exp2(),a=e.sub(r.pow(s).oneMinus()).clamp();this.clearcoat===!0&&this.clearcoatSpecularIndirect.mulAssign(e),this.sheen===!0&&this.sheenSpecularIndirect.mulAssign(e),t.indirectDiffuse.mulAssign(e),t.indirectSpecular.mulAssign(a)}finish(e){const{outgoingLight:t}=e;if(this.clearcoat===!0){const n=Qd.dot(dr).clamp(),r=F0({dotVH:n,f0:Q3,f90:K3}),s=t.mul(X_.mul(r).oneMinus()).add(this.clearcoatSpecularDirect.add(this.clearcoatSpecularIndirect).mul(X_));t.assign(s)}if(this.sheen===!0){const n=Xf.r.max(Xf.g).max(Xf.b).mul(.157).oneMinus(),r=t.mul(n).add(this.sheenSpecularDirect,this.sheenSpecularIndirect);t.assign(r)}}}const YR=ge(1),QT=ge(-2),uv=ge(.8),Z3=ge(-1),cv=ge(.4),J3=ge(2),hv=ge(.305),eS=ge(3),QR=ge(.21),Rte=ge(4),KR=ge(4),Nte=ge(16),Dte=je(([i])=>{const e=Ne(ur(i)).toVar(),t=ge(-1).toVar();return ti(e.x.greaterThan(e.z),()=>{ti(e.x.greaterThan(e.y),()=>{t.assign(zs(i.x.greaterThan(0),0,3))}).Else(()=>{t.assign(zs(i.y.greaterThan(0),1,4))})}).Else(()=>{ti(e.z.greaterThan(e.y),()=>{t.assign(zs(i.z.greaterThan(0),2,5))}).Else(()=>{t.assign(zs(i.y.greaterThan(0),1,4))})}),t}).setLayout({name:"getFace",type:"float",inputs:[{name:"direction",type:"vec3"}]}),Pte=je(([i,e])=>{const t=Et().toVar();return ti(e.equal(0),()=>{t.assign(Et(i.z,i.y).div(ur(i.x)))}).ElseIf(e.equal(1),()=>{t.assign(Et(i.x.negate(),i.z.negate()).div(ur(i.y)))}).ElseIf(e.equal(2),()=>{t.assign(Et(i.x.negate(),i.y).div(ur(i.z)))}).ElseIf(e.equal(3),()=>{t.assign(Et(i.z.negate(),i.y).div(ur(i.x)))}).ElseIf(e.equal(4),()=>{t.assign(Et(i.x.negate(),i.z).div(ur(i.y)))}).Else(()=>{t.assign(Et(i.x,i.y).div(ur(i.z)))}),Wn(.5,t.add(1))}).setLayout({name:"getUV",type:"vec2",inputs:[{name:"direction",type:"vec3"},{name:"face",type:"float"}]}),Lte=je(([i])=>{const e=ge(0).toVar();return ti(i.greaterThanEqual(uv),()=>{e.assign(YR.sub(i).mul(Z3.sub(QT)).div(YR.sub(uv)).add(QT))}).ElseIf(i.greaterThanEqual(cv),()=>{e.assign(uv.sub(i).mul(J3.sub(Z3)).div(uv.sub(cv)).add(Z3))}).ElseIf(i.greaterThanEqual(hv),()=>{e.assign(cv.sub(i).mul(eS.sub(J3)).div(cv.sub(hv)).add(J3))}).ElseIf(i.greaterThanEqual(QR),()=>{e.assign(hv.sub(i).mul(Rte.sub(eS)).div(hv.sub(QR)).add(eS))}).Else(()=>{e.assign(ge(-2).mul(cu(Wn(1.16,i))))}),e}).setLayout({name:"roughnessToMip",type:"float",inputs:[{name:"roughness",type:"float"}]}),WU=je(([i,e])=>{const t=i.toVar();t.assign(Wn(2,t).sub(1));const n=Ne(t,1).toVar();return ti(e.equal(0),()=>{n.assign(n.zyx)}).ElseIf(e.equal(1),()=>{n.assign(n.xzy),n.xz.mulAssign(-1)}).ElseIf(e.equal(2),()=>{n.x.mulAssign(-1)}).ElseIf(e.equal(3),()=>{n.assign(n.zyx),n.xz.mulAssign(-1)}).ElseIf(e.equal(4),()=>{n.assign(n.xzy),n.xy.mulAssign(-1)}).ElseIf(e.equal(5),()=>{n.z.mulAssign(-1)}),n}).setLayout({name:"getDirection",type:"vec3",inputs:[{name:"uv",type:"vec2"},{name:"face",type:"float"}]}),$U=je(([i,e,t,n,r,s])=>{const a=ge(t),l=Ne(e),u=vu(Lte(a),QT,s),h=Hc(u),g=hu(u),v=Ne(KT(i,l,g,n,r,s)).toVar();return ti(h.notEqual(0),()=>{const x=Ne(KT(i,l,g.add(1),n,r,s)).toVar();v.assign(Fi(v,x,h))}),v}),KT=je(([i,e,t,n,r,s])=>{const a=ge(t).toVar(),l=Ne(e),u=ge(Dte(l)).toVar(),h=ge(qr(KR.sub(a),0)).toVar();a.assign(qr(a,KR));const g=ge(O0(a)).toVar(),v=Et(Pte(l,u).mul(g.sub(2)).add(1)).toVar();return ti(u.greaterThan(2),()=>{v.y.addAssign(g),u.subAssign(3)}),v.x.addAssign(u.mul(g)),v.x.addAssign(h.mul(Wn(3,Nte))),v.y.addAssign(Wn(4,O0(s).sub(g))),v.x.mulAssign(n),v.y.mulAssign(r),i.sample(v).grad(Et(),Et())}),tS=je(({envMap:i,mipInt:e,outputDirection:t,theta:n,axis:r,CUBEUV_TEXEL_WIDTH:s,CUBEUV_TEXEL_HEIGHT:a,CUBEUV_MAX_MIP:l})=>{const u=yc(n),h=t.mul(u).add(r.cross(t).mul(Mo(n))).add(r.mul(r.dot(t).mul(u.oneMinus())));return KT(i,h,e,s,a,l)}),XU=je(({n:i,latitudinal:e,poleAxis:t,outputDirection:n,weights:r,samples:s,dTheta:a,mipInt:l,envMap:u,CUBEUV_TEXEL_WIDTH:h,CUBEUV_TEXEL_HEIGHT:g,CUBEUV_MAX_MIP:v})=>{const x=Ne(zs(e,t,ky(t,n))).toVar();ti(VM(x.equals(Ne(0))),()=>{x.assign(Ne(n.z,0,n.x.negate()))}),x.assign(Fc(x));const S=Ne().toVar();return S.addAssign(r.element(ye(0)).mul(tS({theta:0,axis:x,outputDirection:n,mipInt:l,envMap:u,CUBEUV_TEXEL_WIDTH:h,CUBEUV_TEXEL_HEIGHT:g,CUBEUV_MAX_MIP:v}))),ki({start:ye(1),end:i},({i:w})=>{ti(w.greaterThanEqual(s),()=>{TU()});const R=ge(a.mul(ge(w))).toVar();S.addAssign(r.element(w).mul(tS({theta:R.mul(-1),axis:x,outputDirection:n,mipInt:l,envMap:u,CUBEUV_TEXEL_WIDTH:h,CUBEUV_TEXEL_HEIGHT:g,CUBEUV_MAX_MIP:v}))),S.addAssign(r.element(w).mul(tS({theta:R,axis:x,outputDirection:n,mipInt:l,envMap:u,CUBEUV_TEXEL_WIDTH:h,CUBEUV_TEXEL_HEIGHT:g,CUBEUV_MAX_MIP:v})))}),dn(S,1)});let ny=null;const ZR=new WeakMap;function Ute(i){const e=Math.log2(i)-2,t=1/i;return{texelWidth:1/(3*Math.max(Math.pow(2,e),112)),texelHeight:t,maxMip:e}}function Bte(i){let e=ZR.get(i);if((e!==void 0?e.pmremVersion:-1)!==i.pmremVersion){const n=i.image;if(i.isCubeTexture)if(Ite(n))e=ny.fromCubemap(i,e);else return null;else if(Fte(n))e=ny.fromEquirectangular(i,e);else return null;e.pmremVersion=i.pmremVersion,ZR.set(i,e)}return e.texture}class Ote extends Zr{static get type(){return"PMREMNode"}constructor(e,t=null,n=null){super("vec3"),this._value=e,this._pmrem=null,this.uvNode=t,this.levelNode=n,this._generator=null;const r=new vs;r.isRenderTargetTexture=!0,this._texture=Ai(r),this._width=gn(0),this._height=gn(0),this._maxMip=gn(0),this.updateBeforeType=jn.RENDER}set value(e){this._value=e,this._pmrem=null}get value(){return this._value}updateFromTexture(e){const t=Ute(e.image.height);this._texture.value=e,this._width.value=t.texelWidth,this._height.value=t.texelHeight,this._maxMip.value=t.maxMip}updateBefore(){let e=this._pmrem;const t=e?e.pmremVersion:-1,n=this._value;t!==n.pmremVersion&&(n.isPMREMTexture===!0?e=n:e=Bte(n),e!==null&&(this._pmrem=e,this.updateFromTexture(e)))}setup(e){ny===null&&(ny=e.createPMREMGenerator()),this.updateBefore(e);let t=this.uvNode;t===null&&e.context.getUV&&(t=e.context.getUV(this));const n=this.value;e.renderer.coordinateSystem===Ha&&n.isPMREMTexture!==!0&&n.isRenderTargetTexture===!0&&(t=Ne(t.x.negate(),t.yz)),t=Ne(t.x,t.y.negate(),t.z);let r=this.levelNode;return r===null&&e.context.getTextureLevel&&(r=e.context.getTextureLevel(this)),$U(this._texture,t,r,this._width,this._height,this._maxMip)}}function Ite(i){if(i==null)return!1;let e=0;const t=6;for(let n=0;n0}const _E=ct(Ote),JR=new WeakMap;class kte extends K0{static get type(){return"EnvironmentNode"}constructor(e=null){super(),this.envNode=e}setup(e){const{material:t}=e;let n=this.envNode;if(n.isTextureNode||n.isMaterialReferenceNode){const S=n.isTextureNode?n.value:t[n.property];let w=JR.get(S);w===void 0&&(w=_E(S),JR.set(S,w)),n=w}const s=t.envMap?ji("envMapIntensity","float",e.material):ji("environmentIntensity","float",e.scene),l=t.useAnisotropy===!0||t.anisotropy>0?k9:zr,u=n.context(eN(Zl,l)).mul(s),h=n.context(zte(Hy)).mul(Math.PI).mul(s),g=Im(u),v=Im(h);e.context.radiance.addAssign(g),e.context.iblIrradiance.addAssign(v);const x=e.context.lightingModel.clearcoatRadiance;if(x){const S=n.context(eN(wg,Qd)).mul(s),w=Im(S);x.addAssign(w)}}}const eN=(i,e)=>{let t=null;return{getUV:()=>(t===null&&(t=dr.negate().reflect(e),t=i.mul(i).mix(t,e).normalize(),t=t.transformDirection(so)),t),getTextureLevel:()=>i}},zte=i=>({getUV:()=>i,getTextureLevel:()=>ge(1)}),Gte=new tD;class YU extends Vr{static get type(){return"MeshStandardNodeMaterial"}constructor(e){super(),this.isMeshStandardNodeMaterial=!0,this.lights=!0,this.emissiveNode=null,this.metalnessNode=null,this.roughnessNode=null,this.setDefaultValues(Gte),this.setValues(e)}setupEnvironment(e){let t=super.setupEnvironment(e);return t===null&&e.environmentNode&&(t=e.environmentNode),t?new kte(t):null}setupLightingModel(){return new jU}setupSpecular(){const e=Fi(Ne(.04),Ui.rgb,Tg);ka.assign(e),Mg.assign(1)}setupVariants(){const e=this.metalnessNode?ge(this.metalnessNode):X9;Tg.assign(e);let t=this.roughnessNode?ge(this.roughnessNode):$9;t=gE({roughness:t}),Zl.assign(t),this.setupSpecular(),Ui.assign(dn(Ui.rgb.mul(e.oneMinus()),Ui.a))}copy(e){return this.emissiveNode=e.emissiveNode,this.metalnessNode=e.metalnessNode,this.roughnessNode=e.roughnessNode,super.copy(e)}}const qte=new Cz;class Vte extends YU{static get type(){return"MeshPhysicalNodeMaterial"}constructor(e){super(),this.isMeshPhysicalNodeMaterial=!0,this.clearcoatNode=null,this.clearcoatRoughnessNode=null,this.clearcoatNormalNode=null,this.sheenNode=null,this.sheenRoughnessNode=null,this.iridescenceNode=null,this.iridescenceIORNode=null,this.iridescenceThicknessNode=null,this.specularIntensityNode=null,this.specularColorNode=null,this.iorNode=null,this.transmissionNode=null,this.thicknessNode=null,this.attenuationDistanceNode=null,this.attenuationColorNode=null,this.dispersionNode=null,this.anisotropyNode=null,this.setDefaultValues(qte),this.setValues(e)}get useClearcoat(){return this.clearcoat>0||this.clearcoatNode!==null}get useIridescence(){return this.iridescence>0||this.iridescenceNode!==null}get useSheen(){return this.sheen>0||this.sheenNode!==null}get useAnisotropy(){return this.anisotropy>0||this.anisotropyNode!==null}get useTransmission(){return this.transmission>0||this.transmissionNode!==null}get useDispersion(){return this.dispersion>0||this.dispersionNode!==null}setupSpecular(){const e=this.iorNode?ge(this.iorNode):lU;Om.assign(e),ka.assign(Fi(to(KM(Om.sub(1).div(Om.add(1))).mul(W9),Ne(1)).mul(WT),Ui.rgb,Tg)),Mg.assign(Fi(WT,1,Tg))}setupLightingModel(){return new jU(this.useClearcoat,this.useSheen,this.useIridescence,this.useAnisotropy,this.useTransmission,this.useDispersion)}setupVariants(e){if(super.setupVariants(e),this.useClearcoat){const t=this.clearcoatNode?ge(this.clearcoatNode):Q9,n=this.clearcoatRoughnessNode?ge(this.clearcoatRoughnessNode):K9;X_.assign(t),wg.assign(gE({roughness:n}))}if(this.useSheen){const t=this.sheenNode?Ne(this.sheenNode):eU,n=this.sheenRoughnessNode?ge(this.sheenRoughnessNode):tU;Xf.assign(t),Uy.assign(n)}if(this.useIridescence){const t=this.iridescenceNode?ge(this.iridescenceNode):iU,n=this.iridescenceIORNode?ge(this.iridescenceIORNode):rU,r=this.iridescenceThicknessNode?ge(this.iridescenceThicknessNode):sU;By.assign(t),BM.assign(n),OM.assign(r)}if(this.useAnisotropy){const t=(this.anisotropyNode?Et(this.anisotropyNode):nU).toVar();Rh.assign(t.length()),ti(Rh.equal(0),()=>{t.assign(Et(1,0))}).Else(()=>{t.divAssign(Et(Rh)),Rh.assign(Rh.saturate())}),Y_.assign(Rh.pow2().mix(Zl.pow2(),1)),Bm.assign(Yf[0].mul(t.x).add(Yf[1].mul(t.y))),iA.assign(Yf[1].mul(t.x).sub(Yf[0].mul(t.y)))}if(this.useTransmission){const t=this.transmissionNode?ge(this.transmissionNode):aU,n=this.thicknessNode?ge(this.thicknessNode):oU,r=this.attenuationDistanceNode?ge(this.attenuationDistanceNode):uU,s=this.attenuationColorNode?Ne(this.attenuationColorNode):cU;if(K_.assign(t),IM.assign(n),FM.assign(r),kM.assign(s),this.useDispersion){const a=this.dispersionNode?ge(this.dispersionNode):pU;zM.assign(a)}}}setupClearcoatNormal(){return this.clearcoatNormalNode?Ne(this.clearcoatNormalNode):Z9}setup(e){e.context.setupClearcoatNormal=()=>this.setupClearcoatNormal(e),super.setup(e)}copy(e){return this.clearcoatNode=e.clearcoatNode,this.clearcoatRoughnessNode=e.clearcoatRoughnessNode,this.clearcoatNormalNode=e.clearcoatNormalNode,this.sheenNode=e.sheenNode,this.sheenRoughnessNode=e.sheenRoughnessNode,this.iridescenceNode=e.iridescenceNode,this.iridescenceIORNode=e.iridescenceIORNode,this.iridescenceThicknessNode=e.iridescenceThicknessNode,this.specularIntensityNode=e.specularIntensityNode,this.specularColorNode=e.specularColorNode,this.transmissionNode=e.transmissionNode,this.thicknessNode=e.thicknessNode,this.attenuationDistanceNode=e.attenuationDistanceNode,this.attenuationColorNode=e.attenuationColorNode,this.dispersionNode=e.dispersionNode,this.anisotropyNode=e.anisotropyNode,super.copy(e)}}const Hte=je(({normal:i,lightDirection:e,builder:t})=>{const n=i.dot(e),r=Et(n.mul(.5).add(.5),0);if(t.material.gradientMap){const s=Tc("gradientMap","texture").context({getUV:()=>r});return Ne(s.r)}else{const s=r.fwidth().mul(.5);return Fi(Ne(.7),Ne(1),kc(ge(.7).sub(s.x),ge(.7).add(s.x),r.x))}});class jte extends Xy{direct({lightDirection:e,lightColor:t,reflectedLight:n},r,s){const a=Hte({normal:qy,lightDirection:e,builder:s}).mul(t);n.directDiffuse.addAssign(a.mul(AA({diffuseColor:Ui.rgb})))}indirect({ambientOcclusion:e,irradiance:t,reflectedLight:n}){n.indirectDiffuse.addAssign(t.mul(AA({diffuseColor:Ui}))),n.indirectDiffuse.mulAssign(e)}}const Wte=new Rz;class $te extends Vr{static get type(){return"MeshToonNodeMaterial"}constructor(e){super(),this.isMeshToonNodeMaterial=!0,this.lights=!0,this.setDefaultValues(Wte),this.setValues(e)}setupLightingModel(){return new jte}}class Xte extends Zr{static get type(){return"MatcapUVNode"}constructor(){super("vec2")}setup(){const e=Ne(dr.z,0,dr.x.negate()).normalize(),t=dr.cross(e);return Et(e.dot(zr),t.dot(zr)).mul(.495).add(.5)}}const QU=zt(Xte),Yte=new Lz;class Qte extends Vr{static get type(){return"MeshMatcapNodeMaterial"}constructor(e){super(),this.isMeshMatcapNodeMaterial=!0,this.setDefaultValues(Yte),this.setValues(e)}setupVariants(e){const t=QU;let n;e.material.matcap?n=Tc("matcap","texture").context({getUV:()=>t}):n=Ne(Fi(.2,.8,t.y)),Ui.rgb.mulAssign(n.rgb)}}const Kte=new Qw;class Zte extends Vr{static get type(){return"PointsNodeMaterial"}constructor(e){super(),this.isPointsNodeMaterial=!0,this.setDefaultValues(Kte),this.setValues(e)}}class Jte extends Zr{static get type(){return"RotateNode"}constructor(e,t){super(),this.positionNode=e,this.rotationNode=t}getNodeType(e){return this.positionNode.getNodeType(e)}setup(e){const{rotationNode:t,positionNode:n}=this;if(this.getNodeType(e)==="vec2"){const s=t.cos(),a=t.sin();return Ly(s,a,a.negate(),s).mul(n)}else{const s=t,a=nA(dn(1,0,0,0),dn(0,yc(s.x),Mo(s.x).negate(),0),dn(0,Mo(s.x),yc(s.x),0),dn(0,0,0,1)),l=nA(dn(yc(s.y),0,Mo(s.y),0),dn(0,1,0,0),dn(Mo(s.y).negate(),0,yc(s.y),0),dn(0,0,0,1)),u=nA(dn(yc(s.z),Mo(s.z).negate(),0,0),dn(Mo(s.z),yc(s.z),0,0),dn(0,0,1,0),dn(0,0,0,1));return a.mul(l).mul(u).mul(dn(n,1)).xyz}}}const yE=ct(Jte),ene=new jk;class tne extends Vr{static get type(){return"SpriteNodeMaterial"}constructor(e){super(),this.isSpriteNodeMaterial=!0,this._useSizeAttenuation=!0,this.positionNode=null,this.rotationNode=null,this.scaleNode=null,this.setDefaultValues(ene),this.setValues(e)}setupPositionView(e){const{object:t,camera:n}=e,r=this.sizeAttenuation,{positionNode:s,rotationNode:a,scaleNode:l}=this,u=Q0.mul(Ne(s||0));let h=Et($o[0].xyz.length(),$o[1].xyz.length());if(l!==null&&(h=h.mul(l)),r===!1)if(n.isPerspectiveCamera)h=h.mul(u.z.negate());else{const S=ge(2).div(_A.element(1).element(1));h=h.mul(S.mul(2))}let g=Gy.xy;if(t.center&&t.center.isVector2===!0){const S=xJ("center","vec2",t);g=g.sub(S.sub(.5))}g=g.mul(h);const v=ge(a||J9),x=yE(g,v);return dn(u.xy.add(x),u.zw)}copy(e){return this.positionNode=e.positionNode,this.rotationNode=e.rotationNode,this.scaleNode=e.scaleNode,super.copy(e)}get sizeAttenuation(){return this._useSizeAttenuation}set sizeAttenuation(e){this._useSizeAttenuation!==e&&(this._useSizeAttenuation=e,this.needsUpdate=!0)}}class nne extends Xy{constructor(){super(),this.shadowNode=ge(1).toVar("shadowMask")}direct({shadowMask:e}){this.shadowNode.mulAssign(e)}finish(e){Ui.a.mulAssign(this.shadowNode.oneMinus()),e.outgoingLight.rgb.assign(Ui.rgb)}}const ine=new Ez;class rne extends Vr{static get type(){return"ShadowNodeMaterial"}constructor(e){super(),this.isShadowNodeMaterial=!0,this.lights=!0,this.setDefaultValues(ine),this.setValues(e)}setupLightingModel(){return new nne}}const sne=je(({texture:i,uv:e})=>{const n=Ne().toVar();return ti(e.x.lessThan(1e-4),()=>{n.assign(Ne(1,0,0))}).ElseIf(e.y.lessThan(1e-4),()=>{n.assign(Ne(0,1,0))}).ElseIf(e.z.lessThan(1e-4),()=>{n.assign(Ne(0,0,1))}).ElseIf(e.x.greaterThan(1-1e-4),()=>{n.assign(Ne(-1,0,0))}).ElseIf(e.y.greaterThan(1-1e-4),()=>{n.assign(Ne(0,-1,0))}).ElseIf(e.z.greaterThan(1-1e-4),()=>{n.assign(Ne(0,0,-1))}).Else(()=>{const s=i.sample(e.add(Ne(-.01,0,0))).r.sub(i.sample(e.add(Ne(.01,0,0))).r),a=i.sample(e.add(Ne(0,-.01,0))).r.sub(i.sample(e.add(Ne(0,.01,0))).r),l=i.sample(e.add(Ne(0,0,-.01))).r.sub(i.sample(e.add(Ne(0,0,.01))).r);n.assign(Ne(s,a,l))}),n.normalize()});class ane extends yu{static get type(){return"Texture3DNode"}constructor(e,t=null,n=null){super(e,t,n),this.isTexture3DNode=!0}getInputType(){return"texture3D"}getDefaultUV(){return Ne(.5,.5,.5)}setUpdateMatrix(){}setupUV(e,t){const n=this.value;return e.isFlipY()&&(n.isRenderTargetTexture===!0||n.isFramebufferTexture===!0)&&(this.sampler?t=t.flipY():t=t.setY(ye(Fh(this,this.levelNode).y).sub(t.y).sub(1))),t}generateUV(e,t){return t.build(e,"vec3")}normal(e){return sne({texture:this,uv:e})}}const one=ct(ane);class lne{constructor(e,t){this.nodes=e,this.info=t,this._context=self,this._animationLoop=null,this._requestId=null}start(){const e=(t,n)=>{this._requestId=this._context.requestAnimationFrame(e),this.info.autoReset===!0&&this.info.reset(),this.nodes.nodeFrame.update(),this.info.frame=this.nodes.nodeFrame.frameId,this._animationLoop!==null&&this._animationLoop(t,n)};e()}stop(){this._context.cancelAnimationFrame(this._requestId),this._requestId=null}setAnimationLoop(e){this._animationLoop=e}setContext(e){this._context=e}dispose(){this.stop()}}class Su{constructor(){this.weakMap=new WeakMap}get(e){let t=this.weakMap;for(let n=0;n{this.dispose()},this.material.addEventListener("dispose",this.onMaterialDispose)}updateClipping(e){this.clippingContext=e}get clippingNeedsUpdate(){return this.clippingContext===null||this.clippingContext.cacheKey===this.clippingContextCacheKey?!1:(this.clippingContextCacheKey=this.clippingContext.cacheKey,!0)}get hardwareClippingPlanes(){return this.material.hardwareClipping===!0?this.clippingContext.unionClippingCount:0}getNodeBuilderState(){return this._nodeBuilderState||(this._nodeBuilderState=this._nodes.getForRender(this))}getMonitor(){return this._monitor||(this._monitor=this.getNodeBuilderState().monitor)}getBindings(){return this._bindings||(this._bindings=this.getNodeBuilderState().createBindings())}getIndex(){return this._geometries.getIndex(this)}getIndirect(){return this._geometries.getIndirect(this)}getChainArray(){return[this.object,this.material,this.context,this.lightsNode]}setGeometry(e){this.geometry=e,this.attributes=null}getAttributes(){if(this.attributes!==null)return this.attributes;const e=this.getNodeBuilderState().nodeAttributes,t=this.geometry,n=[],r=new Set;for(const s of e){const a=s.node&&s.node.attribute?s.node.attribute:t.getAttribute(s.name);if(a===void 0)continue;n.push(a);const l=a.isInterleavedBufferAttribute?a.data:a;r.add(l)}return this.attributes=n,this.vertexBuffers=Array.from(r.values()),n}getVertexBuffers(){return this.vertexBuffers===null&&this.getAttributes(),this.vertexBuffers}getDrawParameters(){const{object:e,material:t,geometry:n,group:r,drawRange:s}=this,a=this.drawParams||(this.drawParams={vertexCount:0,firstVertex:0,instanceCount:0,firstInstance:0}),l=this.getIndex(),u=l!==null,h=n.isInstancedBufferGeometry?n.instanceCount:e.count>1?e.count:1;if(h===0)return null;if(a.instanceCount=h,e.isBatchedMesh===!0)return a;let g=1;t.wireframe===!0&&!e.isPoints&&!e.isLineSegments&&!e.isLine&&!e.isLineLoop&&(g=2);let v=s.start*g,x=(s.start+s.count)*g;r!==null&&(v=Math.max(v,r.start*g),x=Math.min(x,(r.start+r.count)*g));const S=n.attributes.position;let w=1/0;u?w=l.count:S!=null&&(w=S.count),v=Math.max(v,0),x=Math.min(x,w);const R=x-v;return R<0||R===1/0?null:(a.vertexCount=R,a.firstVertex=v,a)}getGeometryCacheKey(){const{geometry:e}=this;let t="";for(const n of Object.keys(e.attributes).sort()){const r=e.attributes[n];t+=n+",",r.data&&(t+=r.data.stride+","),r.offset&&(t+=r.offset+","),r.itemSize&&(t+=r.itemSize+","),r.normalized&&(t+="n,")}return e.index&&(t+="index,"),t}getMaterialCacheKey(){const{object:e,material:t}=this;let n=t.customProgramCacheKey();for(const r of cne(t)){if(/^(is[A-Z]|_)|^(visible|version|uuid|name|opacity|userData)$/.test(r))continue;const s=t[r];let a;if(s!==null){const l=typeof s;l==="number"?a=s!==0?"1":"0":l==="object"?(a="{",s.isTexture&&(a+=s.mapping),a+="}"):a=String(s)}else a=String(s);n+=a+","}return n+=this.clippingContextCacheKey+",",e.geometry&&(n+=this.getGeometryCacheKey()),e.skeleton&&(n+=e.skeleton.bones.length+","),e.morphTargetInfluences&&(n+=e.morphTargetInfluences.length+","),e.isBatchedMesh&&(n+=e._matricesTexture.uuid+",",e._colorsTexture!==null&&(n+=e._colorsTexture.uuid+",")),e.count>1&&(n+=e.uuid+","),n+=e.receiveShadow+",",DP(n)}get needsGeometryUpdate(){return this.geometry.id!==this.object.geometry.id}get needsUpdate(){return this.initialNodesCacheKey!==this.getDynamicCacheKey()||this.clippingNeedsUpdate}getDynamicCacheKey(){let e=this._nodes.getCacheKey(this.scene,this.lightsNode);return this.object.receiveShadow&&(e+=1),e}getCacheKey(){return this.getMaterialCacheKey()+this.getDynamicCacheKey()}dispose(){this.material.removeEventListener("dispose",this.onMaterialDispose),this.onDispose()}}const Ed=[];class fne{constructor(e,t,n,r,s,a){this.renderer=e,this.nodes=t,this.geometries=n,this.pipelines=r,this.bindings=s,this.info=a,this.chainMaps={}}get(e,t,n,r,s,a,l,u){const h=this.getChainMap(u);Ed[0]=e,Ed[1]=t,Ed[2]=a,Ed[3]=s;let g=h.get(Ed);return g===void 0?(g=this.createRenderObject(this.nodes,this.geometries,this.renderer,e,t,n,r,s,a,l,u),h.set(Ed,g)):(g.updateClipping(l),g.needsGeometryUpdate&&g.setGeometry(e.geometry),(g.version!==t.version||g.needsUpdate)&&(g.initialCacheKey!==g.getCacheKey()?(g.dispose(),g=this.get(e,t,n,r,s,a,l,u)):g.version=t.version)),g}getChainMap(e="default"){return this.chainMaps[e]||(this.chainMaps[e]=new Su)}dispose(){this.chainMaps={}}createRenderObject(e,t,n,r,s,a,l,u,h,g,v){const x=this.getChainMap(v),S=new hne(e,t,n,r,s,a,l,u,h,g);return S.onDispose=()=>{this.pipelines.delete(S),this.bindings.delete(S),this.nodes.delete(S),x.delete(S.getChainArray())},S}}class Yh{constructor(){this.data=new WeakMap}get(e){let t=this.data.get(e);return t===void 0&&(t={},this.data.set(e,t)),t}delete(e){let t=null;return this.data.has(e)&&(t=this.data.get(e),this.data.delete(e)),t}has(e){return this.data.has(e)}dispose(){this.data=new WeakMap}}const iu={VERTEX:1,INDEX:2,STORAGE:3,INDIRECT:4},Lh=16,Ane=211,dne=212;class pne extends Yh{constructor(e){super(),this.backend=e}delete(e){const t=super.delete(e);return t!==void 0&&this.backend.destroyAttribute(e),t}update(e,t){const n=this.get(e);if(n.version===void 0)t===iu.VERTEX?this.backend.createAttribute(e):t===iu.INDEX?this.backend.createIndexAttribute(e):t===iu.STORAGE?this.backend.createStorageAttribute(e):t===iu.INDIRECT&&this.backend.createIndirectStorageAttribute(e),n.version=this._getBufferAttribute(e).version;else{const r=this._getBufferAttribute(e);(n.version=0;--e)if(i[e]>=65535)return!0;return!1}function KU(i){return i.index!==null?i.index.version:i.attributes.position.version}function tN(i){const e=[],t=i.index,n=i.attributes.position;if(t!==null){const s=t.array;for(let a=0,l=s.length;a{this.info.memory.geometries--;const s=t.index,a=e.getAttributes();s!==null&&this.attributes.delete(s);for(const u of a)this.attributes.delete(u);const l=this.wireframes.get(t);l!==void 0&&this.attributes.delete(l),t.removeEventListener("dispose",r)};t.addEventListener("dispose",r)}updateAttributes(e){const t=e.getAttributes();for(const s of t)s.isStorageBufferAttribute||s.isStorageInstancedBufferAttribute?this.updateAttribute(s,iu.STORAGE):this.updateAttribute(s,iu.VERTEX);const n=this.getIndex(e);n!==null&&this.updateAttribute(n,iu.INDEX);const r=e.geometry.indirect;r!==null&&this.updateAttribute(r,iu.INDIRECT)}updateAttribute(e,t){const n=this.info.render.calls;e.isInterleavedBufferAttribute?this.attributeCall.get(e)===void 0?(this.attributes.update(e,t),this.attributeCall.set(e,n)):this.attributeCall.get(e.data)!==n&&(this.attributes.update(e,t),this.attributeCall.set(e.data,n),this.attributeCall.set(e,n)):this.attributeCall.get(e)!==n&&(this.attributes.update(e,t),this.attributeCall.set(e,n))}getIndirect(e){return e.geometry.indirect}getIndex(e){const{geometry:t,material:n}=e;let r=t.index;if(n.wireframe===!0){const s=this.wireframes;let a=s.get(t);a===void 0?(a=tN(t),s.set(t,a)):a.version!==KU(t)&&(this.attributes.delete(a),a=tN(t),s.set(t,a)),r=a}return r}}class vne{constructor(){this.autoReset=!0,this.frame=0,this.calls=0,this.render={calls:0,frameCalls:0,drawCalls:0,triangles:0,points:0,lines:0,timestamp:0,previousFrameCalls:0,timestampCalls:0},this.compute={calls:0,frameCalls:0,timestamp:0,previousFrameCalls:0,timestampCalls:0},this.memory={geometries:0,textures:0}}update(e,t,n){this.render.drawCalls++,e.isMesh||e.isSprite?this.render.triangles+=n*(t/3):e.isPoints?this.render.points+=n*t:e.isLineSegments?this.render.lines+=n*(t/2):e.isLine?this.render.lines+=n*(t-1):console.error("THREE.WebGPUInfo: Unknown object type.")}updateTimestamp(e,t){this[e].timestampCalls===0&&(this[e].timestamp=0),this[e].timestamp+=t,this[e].timestampCalls++,this[e].timestampCalls>=this[e].previousFrameCalls&&(this[e].timestampCalls=0)}reset(){const e=this.render.frameCalls;this.render.previousFrameCalls=e;const t=this.compute.frameCalls;this.compute.previousFrameCalls=t,this.render.drawCalls=0,this.render.frameCalls=0,this.compute.frameCalls=0,this.render.triangles=0,this.render.points=0,this.render.lines=0}dispose(){this.reset(),this.calls=0,this.render.calls=0,this.compute.calls=0,this.render.timestamp=0,this.compute.timestamp=0,this.memory.geometries=0,this.memory.textures=0}}class ZU{constructor(e){this.cacheKey=e,this.usedTimes=0}}class _ne extends ZU{constructor(e,t,n){super(e),this.vertexProgram=t,this.fragmentProgram=n}}class yne extends ZU{constructor(e,t){super(e),this.computeProgram=t,this.isComputePipeline=!0}}let xne=0;class nS{constructor(e,t,n,r=null,s=null){this.id=xne++,this.code=e,this.stage=t,this.name=n,this.transforms=r,this.attributes=s,this.usedTimes=0}}class bne extends Yh{constructor(e,t){super(),this.backend=e,this.nodes=t,this.bindings=null,this.caches=new Map,this.programs={vertex:new Map,fragment:new Map,compute:new Map}}getForCompute(e,t){const{backend:n}=this,r=this.get(e);if(this._needsComputeUpdate(e)){const s=r.pipeline;s&&(s.usedTimes--,s.computeProgram.usedTimes--);const a=this.nodes.getForCompute(e);let l=this.programs.compute.get(a.computeShader);l===void 0&&(s&&s.computeProgram.usedTimes===0&&this._releaseProgram(s.computeProgram),l=new nS(a.computeShader,"compute",e.name,a.transforms,a.nodeAttributes),this.programs.compute.set(a.computeShader,l),n.createProgram(l));const u=this._getComputeCacheKey(e,l);let h=this.caches.get(u);h===void 0&&(s&&s.usedTimes===0&&this._releasePipeline(s),h=this._getComputePipeline(e,l,u,t)),h.usedTimes++,l.usedTimes++,r.version=e.version,r.pipeline=h}return r.pipeline}getForRender(e,t=null){const{backend:n}=this,r=this.get(e);if(this._needsRenderUpdate(e)){const s=r.pipeline;s&&(s.usedTimes--,s.vertexProgram.usedTimes--,s.fragmentProgram.usedTimes--);const a=e.getNodeBuilderState(),l=e.material?e.material.name:"";let u=this.programs.vertex.get(a.vertexShader);u===void 0&&(s&&s.vertexProgram.usedTimes===0&&this._releaseProgram(s.vertexProgram),u=new nS(a.vertexShader,"vertex",l),this.programs.vertex.set(a.vertexShader,u),n.createProgram(u));let h=this.programs.fragment.get(a.fragmentShader);h===void 0&&(s&&s.fragmentProgram.usedTimes===0&&this._releaseProgram(s.fragmentProgram),h=new nS(a.fragmentShader,"fragment",l),this.programs.fragment.set(a.fragmentShader,h),n.createProgram(h));const g=this._getRenderCacheKey(e,u,h);let v=this.caches.get(g);v===void 0?(s&&s.usedTimes===0&&this._releasePipeline(s),v=this._getRenderPipeline(e,u,h,g,t)):e.pipeline=v,v.usedTimes++,u.usedTimes++,h.usedTimes++,r.pipeline=v}return r.pipeline}delete(e){const t=this.get(e).pipeline;return t&&(t.usedTimes--,t.usedTimes===0&&this._releasePipeline(t),t.isComputePipeline?(t.computeProgram.usedTimes--,t.computeProgram.usedTimes===0&&this._releaseProgram(t.computeProgram)):(t.fragmentProgram.usedTimes--,t.vertexProgram.usedTimes--,t.vertexProgram.usedTimes===0&&this._releaseProgram(t.vertexProgram),t.fragmentProgram.usedTimes===0&&this._releaseProgram(t.fragmentProgram))),super.delete(e)}dispose(){super.dispose(),this.caches=new Map,this.programs={vertex:new Map,fragment:new Map,compute:new Map}}updateForRender(e){this.getForRender(e)}_getComputePipeline(e,t,n,r){n=n||this._getComputeCacheKey(e,t);let s=this.caches.get(n);return s===void 0&&(s=new yne(n,t),this.caches.set(n,s),this.backend.createComputePipeline(s,r)),s}_getRenderPipeline(e,t,n,r,s){r=r||this._getRenderCacheKey(e,t,n);let a=this.caches.get(r);return a===void 0&&(a=new _ne(r,t,n),this.caches.set(r,a),e.pipeline=a,this.backend.createRenderPipeline(e,s)),a}_getComputeCacheKey(e,t){return e.id+","+t.id}_getRenderCacheKey(e,t,n){return t.id+","+n.id+","+this.backend.getRenderCacheKey(e)}_releasePipeline(e){this.caches.delete(e.cacheKey)}_releaseProgram(e){const t=e.code,n=e.stage;this.programs[n].delete(t)}_needsComputeUpdate(e){const t=this.get(e);return t.pipeline===void 0||t.version!==e.version}_needsRenderUpdate(e){return this.get(e).pipeline===void 0||this.backend.needsRenderUpdate(e)}}class Sne extends Yh{constructor(e,t,n,r,s,a){super(),this.backend=e,this.textures=n,this.pipelines=s,this.attributes=r,this.nodes=t,this.info=a,this.pipelines.bindings=this}getForRender(e){const t=e.getBindings();for(const n of t){const r=this.get(n);r.bindGroup===void 0&&(this._init(n),this.backend.createBindings(n,t,0),r.bindGroup=n)}return t}getForCompute(e){const t=this.nodes.getForCompute(e).bindings;for(const n of t){const r=this.get(n);r.bindGroup===void 0&&(this._init(n),this.backend.createBindings(n,t,0),r.bindGroup=n)}return t}updateForCompute(e){this._updateBindings(this.getForCompute(e))}updateForRender(e){this._updateBindings(this.getForRender(e))}_updateBindings(e){for(const t of e)this._update(t,e)}_init(e){for(const t of e.bindings)if(t.isSampledTexture)this.textures.updateTexture(t.texture);else if(t.isStorageBuffer){const n=t.attribute,r=n.isIndirectStorageBufferAttribute?iu.INDIRECT:iu.STORAGE;this.attributes.update(n,r)}}_update(e,t){const{backend:n}=this;let r=!1,s=!0,a=0,l=0;for(const u of e.bindings)if(!(u.isNodeUniformsGroup&&this.nodes.updateGroup(u)===!1)){if(u.isUniformBuffer)u.update()&&n.updateBinding(u);else if(u.isSampler)u.update();else if(u.isSampledTexture){const h=this.textures.get(u.texture);u.needsBindingsUpdate(h.generation)&&(r=!0);const g=u.update(),v=u.texture;g&&this.textures.updateTexture(v);const x=n.get(v);if(x.externalTexture!==void 0||h.isDefaultTexture?s=!1:(a=a*10+v.id,l+=v.version),n.isWebGPUBackend===!0&&x.texture===void 0&&x.externalTexture===void 0&&(console.error("Bindings._update: binding should be available:",u,g,v,u.textureNode.value,r),this.textures.updateTexture(v),r=!0),v.isStorageTexture===!0){const S=this.get(v);u.store===!0?S.needsMipmap=!0:this.textures.needsMipmaps(v)&&S.needsMipmap===!0&&(this.backend.generateMipmaps(v),S.needsMipmap=!1)}}}r===!0&&this.backend.updateBindings(e,t,s?a:0,l)}}function Tne(i,e){return i.groupOrder!==e.groupOrder?i.groupOrder-e.groupOrder:i.renderOrder!==e.renderOrder?i.renderOrder-e.renderOrder:i.material.id!==e.material.id?i.material.id-e.material.id:i.z!==e.z?i.z-e.z:i.id-e.id}function nN(i,e){return i.groupOrder!==e.groupOrder?i.groupOrder-e.groupOrder:i.renderOrder!==e.renderOrder?i.renderOrder-e.renderOrder:i.z!==e.z?e.z-i.z:i.id-e.id}function iN(i){return(i.transmission>0||i.transmissionNode)&&i.side===as&&i.forceSinglePass===!1}class wne{constructor(e,t,n){this.renderItems=[],this.renderItemsIndex=0,this.opaque=[],this.transparentDoublePass=[],this.transparent=[],this.bundles=[],this.lightsNode=e.getNode(t,n),this.lightsArray=[],this.scene=t,this.camera=n,this.occlusionQueryCount=0}begin(){return this.renderItemsIndex=0,this.opaque.length=0,this.transparentDoublePass.length=0,this.transparent.length=0,this.bundles.length=0,this.lightsArray.length=0,this.occlusionQueryCount=0,this}getNextRenderItem(e,t,n,r,s,a,l){let u=this.renderItems[this.renderItemsIndex];return u===void 0?(u={id:e.id,object:e,geometry:t,material:n,groupOrder:r,renderOrder:e.renderOrder,z:s,group:a,clippingContext:l},this.renderItems[this.renderItemsIndex]=u):(u.id=e.id,u.object=e,u.geometry=t,u.material=n,u.groupOrder=r,u.renderOrder=e.renderOrder,u.z=s,u.group=a,u.clippingContext=l),this.renderItemsIndex++,u}push(e,t,n,r,s,a,l){const u=this.getNextRenderItem(e,t,n,r,s,a,l);e.occlusionTest===!0&&this.occlusionQueryCount++,n.transparent===!0||n.transmission>0?(iN(n)&&this.transparentDoublePass.push(u),this.transparent.push(u)):this.opaque.push(u)}unshift(e,t,n,r,s,a,l){const u=this.getNextRenderItem(e,t,n,r,s,a,l);n.transparent===!0||n.transmission>0?(iN(n)&&this.transparentDoublePass.unshift(u),this.transparent.unshift(u)):this.opaque.unshift(u)}pushBundle(e){this.bundles.push(e)}pushLight(e){this.lightsArray.push(e)}sort(e,t){this.opaque.length>1&&this.opaque.sort(e||Tne),this.transparentDoublePass.length>1&&this.transparentDoublePass.sort(t||nN),this.transparent.length>1&&this.transparent.sort(t||nN)}finish(){this.lightsNode.setLights(this.lightsArray);for(let e=this.renderItemsIndex,t=this.renderItems.length;e>t,h=l.height>>t;let g=e.depthTexture||s[t];const v=e.depthBuffer===!0||e.stencilBuffer===!0;let x=!1;g===void 0&&v&&(g=new qc,g.format=e.stencilBuffer?du:au,g.type=e.stencilBuffer?Au:Rr,g.image.width=u,g.image.height=h,s[t]=g),(n.width!==l.width||l.height!==n.height)&&(x=!0,g&&(g.needsUpdate=!0,g.image.width=u,g.image.height=h)),n.width=l.width,n.height=l.height,n.textures=a,n.depthTexture=g||null,n.depth=e.depthBuffer,n.stencil=e.stencilBuffer,n.renderTarget=e,n.sampleCount!==r&&(x=!0,g&&(g.needsUpdate=!0),n.sampleCount=r);const S={sampleCount:r};for(let w=0;w{e.removeEventListener("dispose",w);for(let R=0;R0){const g=e.image;if(g===void 0)console.warn("THREE.Renderer: Texture marked for update but image is undefined.");else if(g.complete===!1)console.warn("THREE.Renderer: Texture marked for update but image is incomplete.");else{if(e.images){const v=[];for(const x of e.images)v.push(x);t.images=v}else t.image=g;(n.isDefaultTexture===void 0||n.isDefaultTexture===!0)&&(s.createTexture(e,t),n.isDefaultTexture=!1,n.generation=e.version),e.source.dataReady===!0&&s.updateTexture(e,t),t.needsMipmaps&&e.mipmaps.length===0&&s.generateMipmaps(e)}}else s.createDefaultTexture(e),n.isDefaultTexture=!0,n.generation=e.version;if(n.initialized!==!0){n.initialized=!0,n.generation=e.version,this.info.memory.textures++;const h=()=>{e.removeEventListener("dispose",h),this._destroyTexture(e),this.info.memory.textures--};e.addEventListener("dispose",h)}n.version=e.version}getSize(e,t=Nne){let n=e.images?e.images[0]:e.image;return n?(n.image!==void 0&&(n=n.image),t.width=n.width||1,t.height=n.height||1,t.depth=e.isCubeTexture?6:n.depth||1):t.width=t.height=t.depth=1,t}getMipLevels(e,t,n){let r;return e.isCompressedTexture?e.mipmaps?r=e.mipmaps.length:r=1:r=Math.floor(Math.log2(Math.max(t,n)))+1,r}needsMipmaps(e){return this.isEnvironmentTexture(e)||e.isCompressedTexture===!0||e.generateMipmaps}isEnvironmentTexture(e){const t=e.mapping;return t===zh||t===Gh||t===Qo||t===Ko}_destroyTexture(e){this.backend.destroySampler(e),this.backend.destroyTexture(e),this.delete(e)}}class xE extends sn{constructor(e,t,n,r=1){super(e,t,n),this.a=r}set(e,t,n,r=1){return this.a=r,super.set(e,t,n)}copy(e){return e.a!==void 0&&(this.a=e.a),super.copy(e)}clone(){return new this.constructor(this.r,this.g,this.b,this.a)}}class eB extends Gi{static get type(){return"ParameterNode"}constructor(e,t=null){super(e,t),this.isParameterNode=!0}getHash(){return this.uuid}generate(){return this.name}}const Pne=(i,e)=>mt(new eB(i,e));class Lne extends Mn{static get type(){return"StackNode"}constructor(e=null){super(),this.nodes=[],this.outputNode=null,this.parent=e,this._currentCond=null,this.isStackNode=!0}getNodeType(e){return this.outputNode?this.outputNode.getNodeType(e):"void"}add(e){return this.nodes.push(e),this}If(e,t){const n=new Um(t);return this._currentCond=zs(e,n),this.add(this._currentCond)}ElseIf(e,t){const n=new Um(t),r=zs(e,n);return this._currentCond.elseNode=r,this._currentCond=r,this}Else(e){return this._currentCond.elseNode=new Um(e),this}build(e,...t){const n=DM();bg(this);for(const r of this.nodes)r.build(e,"void");return bg(n),this.outputNode?this.outputNode.build(e,...t):super.build(e,...t)}else(...e){return console.warn("TSL.StackNode: .else() has been renamed to .Else()."),this.Else(...e)}elseif(...e){return console.warn("TSL.StackNode: .elseif() has been renamed to .ElseIf()."),this.ElseIf(...e)}}const e_=ct(Lne);class tB extends Mn{static get type(){return"OutputStructNode"}constructor(...e){super(),this.members=e,this.isOutputStructNode=!0}setup(e){super.setup(e);const t=this.members,n=[];for(let r=0;r{const e=i.toUint().mul(747796405).add(2891336453),t=e.shiftRight(e.shiftRight(28).add(4)).bitXor(e).mul(277803737);return t.shiftRight(22).bitXor(t).toFloat().mul(1/2**32)}),ZT=(i,e)=>Cl(Wn(4,i.mul(Ti(1,i))),e),Ine=(i,e)=>i.lessThan(.5)?ZT(i.mul(2),e).div(2):Ti(1,ZT(Wn(Ti(1,i),2),e).div(2)),Fne=(i,e,t)=>Cl(Dl(Cl(i,e),Qr(Cl(i,e),Cl(Ti(1,i),t))),1/e),kne=(i,e)=>Mo(Z_.mul(e.mul(i).sub(1))).div(Z_.mul(e.mul(i).sub(1))),xc=je(([i])=>i.fract().sub(.5).abs()).setLayout({name:"tri",type:"float",inputs:[{name:"x",type:"float"}]}),zne=je(([i])=>Ne(xc(i.z.add(xc(i.y.mul(1)))),xc(i.z.add(xc(i.x.mul(1)))),xc(i.y.add(xc(i.x.mul(1)))))).setLayout({name:"tri3",type:"vec3",inputs:[{name:"p",type:"vec3"}]}),Gne=je(([i,e,t])=>{const n=Ne(i).toVar(),r=ge(1.4).toVar(),s=ge(0).toVar(),a=Ne(n).toVar();return ki({start:ge(0),end:ge(3),type:"float",condition:"<="},()=>{const l=Ne(zne(a.mul(2))).toVar();n.addAssign(l.add(t.mul(ge(.1).mul(e)))),a.mulAssign(1.8),r.mulAssign(1.5),n.mulAssign(1.2);const u=ge(xc(n.z.add(xc(n.x.add(xc(n.y)))))).toVar();s.addAssign(u.div(r)),a.addAssign(.14)}),s}).setLayout({name:"triNoise3D",type:"float",inputs:[{name:"position",type:"vec3"},{name:"speed",type:"float"},{name:"time",type:"float"}]});class qne extends Mn{static get type(){return"FunctionOverloadingNode"}constructor(e=[],...t){super(),this.functionNodes=e,this.parametersNodes=t,this._candidateFnCall=null,this.global=!0}getNodeType(){return this.functionNodes[0].shaderNode.layout.type}setup(e){const t=this.parametersNodes;let n=this._candidateFnCall;if(n===null){let r=null,s=-1;for(const a of this.functionNodes){const u=a.shaderNode.layout;if(u===null)throw new Error("FunctionOverloadingNode: FunctionNode must be a layout.");const h=u.inputs;if(t.length===h.length){let g=0;for(let v=0;vs&&(r=a,s=g)}}this._candidateFnCall=n=r(...t)}return n}}const Vne=ct(qne),Vs=i=>(...e)=>Vne(i,...e),yA=gn(0).setGroup(Rn).onRenderUpdate(i=>i.time),rB=gn(0).setGroup(Rn).onRenderUpdate(i=>i.deltaTime),Hne=gn(0,"uint").setGroup(Rn).onRenderUpdate(i=>i.frameId),jne=(i=1)=>(console.warn('TSL: timerLocal() is deprecated. Use "time" instead.'),yA.mul(i)),Wne=(i=1)=>(console.warn('TSL: timerGlobal() is deprecated. Use "time" instead.'),yA.mul(i)),$ne=(i=1)=>(console.warn('TSL: timerDelta() is deprecated. Use "deltaTime" instead.'),rB.mul(i)),Xne=(i=yA)=>i.add(.75).mul(Math.PI*2).sin().mul(.5).add(.5),Yne=(i=yA)=>i.fract().round(),Qne=(i=yA)=>i.add(.5).fract().mul(2).sub(1).abs(),Kne=(i=yA)=>i.fract(),Zne=je(([i,e,t=Et(.5)])=>yE(i.sub(t),e).add(t)),Jne=je(([i,e,t=Et(.5)])=>{const n=i.sub(t),r=n.dot(n),a=r.mul(r).mul(e);return i.add(n.mul(a))}),eie=je(({position:i=null,horizontal:e=!0,vertical:t=!1})=>{let n;i!==null?(n=$o.toVar(),n[3][0]=i.x,n[3][1]=i.y,n[3][2]=i.z):n=$o;const r=so.mul(n);return xg(e)&&(r[0][0]=$o[0].length(),r[0][1]=0,r[0][2]=0),xg(t)&&(r[1][0]=0,r[1][1]=$o[1].length(),r[1][2]=0),r[2][0]=0,r[2][1]=0,r[2][2]=1,_A.mul(r).mul(Gr)}),tie=je(([i=null])=>{const e=ty();return ty(hE(i)).sub(e).lessThan(0).select(bu,i)});class nie extends Mn{static get type(){return"SpriteSheetUVNode"}constructor(e,t=Er(),n=ge(0)){super("vec2"),this.countNode=e,this.uvNode=t,this.frameNode=n}setup(){const{frameNode:e,uvNode:t,countNode:n}=this,{width:r,height:s}=n,a=e.mod(r.mul(s)).floor(),l=a.mod(r),u=s.sub(a.add(1).div(r).ceil()),h=n.reciprocal(),g=Et(l,u);return t.add(g).mul(h)}}const iie=ct(nie);class rie extends Mn{static get type(){return"TriplanarTexturesNode"}constructor(e,t=null,n=null,r=ge(1),s=Gr,a=no){super("vec4"),this.textureXNode=e,this.textureYNode=t,this.textureZNode=n,this.scaleNode=r,this.positionNode=s,this.normalNode=a}setup(){const{textureXNode:e,textureYNode:t,textureZNode:n,scaleNode:r,positionNode:s,normalNode:a}=this;let l=a.abs().normalize();l=l.div(l.dot(Ne(1)));const u=s.yz.mul(r),h=s.zx.mul(r),g=s.xy.mul(r),v=e.value,x=t!==null?t.value:v,S=n!==null?n.value:v,w=Ai(v,u).mul(l.x),R=Ai(x,h).mul(l.y),C=Ai(S,g).mul(l.z);return Qr(w,R,C)}}const sB=ct(rie),sie=(...i)=>sB(...i),Cd=new Yl,Cf=new ce,Rd=new ce,iS=new ce,um=new kn,fv=new ce(0,0,-1),Hl=new Pn,cm=new ce,Av=new ce,hm=new Pn,dv=new At,iy=new Wh,aie=bu.flipX();iy.depthTexture=new qc(1,1);let rS=!1;class bE extends yu{static get type(){return"ReflectorNode"}constructor(e={}){super(e.defaultTexture||iy.texture,aie),this._reflectorBaseNode=e.reflector||new oie(this,e),this._depthNode=null,this.setUpdateMatrix(!1)}get reflector(){return this._reflectorBaseNode}get target(){return this._reflectorBaseNode.target}getDepthNode(){if(this._depthNode===null){if(this._reflectorBaseNode.depth!==!0)throw new Error("THREE.ReflectorNode: Depth node can only be requested when the reflector is created with { depth: true }. ");this._depthNode=mt(new bE({defaultTexture:iy.depthTexture,reflector:this._reflectorBaseNode}))}return this._depthNode}setup(e){return e.object.isQuadMesh||this._reflectorBaseNode.build(e),super.setup(e)}clone(){const e=new this.constructor(this.reflectorNode);return e._reflectorBaseNode=this._reflectorBaseNode,e}}class oie extends Mn{static get type(){return"ReflectorBaseNode"}constructor(e,t={}){super();const{target:n=new vr,resolution:r=1,generateMipmaps:s=!1,bounces:a=!0,depth:l=!1}=t;this.textureNode=e,this.target=n,this.resolution=r,this.generateMipmaps=s,this.bounces=a,this.depth=l,this.updateBeforeType=a?jn.RENDER:jn.FRAME,this.virtualCameras=new WeakMap,this.renderTargets=new WeakMap}_updateResolution(e,t){const n=this.resolution;t.getDrawingBufferSize(dv),e.setSize(Math.round(dv.width*n),Math.round(dv.height*n))}setup(e){return this._updateResolution(iy,e.renderer),super.setup(e)}getVirtualCamera(e){let t=this.virtualCameras.get(e);return t===void 0&&(t=e.clone(),this.virtualCameras.set(e,t)),t}getRenderTarget(e){let t=this.renderTargets.get(e);return t===void 0&&(t=new Wh(0,0,{type:Gs}),this.generateMipmaps===!0&&(t.texture.minFilter=GF,t.texture.generateMipmaps=!0),this.depth===!0&&(t.depthTexture=new qc),this.renderTargets.set(e,t)),t}updateBefore(e){if(this.bounces===!1&&rS)return!1;rS=!0;const{scene:t,camera:n,renderer:r,material:s}=e,{target:a}=this,l=this.getVirtualCamera(n),u=this.getRenderTarget(l);if(r.getDrawingBufferSize(dv),this._updateResolution(u,r),Rd.setFromMatrixPosition(a.matrixWorld),iS.setFromMatrixPosition(n.matrixWorld),um.extractRotation(a.matrixWorld),Cf.set(0,0,1),Cf.applyMatrix4(um),cm.subVectors(Rd,iS),cm.dot(Cf)>0)return;cm.reflect(Cf).negate(),cm.add(Rd),um.extractRotation(n.matrixWorld),fv.set(0,0,-1),fv.applyMatrix4(um),fv.add(iS),Av.subVectors(Rd,fv),Av.reflect(Cf).negate(),Av.add(Rd),l.coordinateSystem=n.coordinateSystem,l.position.copy(cm),l.up.set(0,1,0),l.up.applyMatrix4(um),l.up.reflect(Cf),l.lookAt(Av),l.near=n.near,l.far=n.far,l.updateMatrixWorld(),l.projectionMatrix.copy(n.projectionMatrix),Cd.setFromNormalAndCoplanarPoint(Cf,Rd),Cd.applyMatrix4(l.matrixWorldInverse),Hl.set(Cd.normal.x,Cd.normal.y,Cd.normal.z,Cd.constant);const h=l.projectionMatrix;hm.x=(Math.sign(Hl.x)+h.elements[8])/h.elements[0],hm.y=(Math.sign(Hl.y)+h.elements[9])/h.elements[5],hm.z=-1,hm.w=(1+h.elements[10])/h.elements[14],Hl.multiplyScalar(1/Hl.dot(hm));const g=0;h.elements[2]=Hl.x,h.elements[6]=Hl.y,h.elements[10]=r.coordinateSystem===pu?Hl.z-g:Hl.z+1-g,h.elements[14]=Hl.w,this.textureNode.value=u.texture,this.depth===!0&&(this.textureNode.getDepthNode().value=u.depthTexture),s.visible=!1;const v=r.getRenderTarget(),x=r.getMRT(),S=r.autoClear;r.setMRT(null),r.setRenderTarget(u),r.autoClear=!0,r.render(t,l),r.setMRT(x),r.setRenderTarget(v),r.autoClear=S,s.visible=!0,rS=!1}}const lie=i=>mt(new bE(i)),sS=new kg(-1,1,1,-1,0,1);class uie extends Ki{constructor(e=!1){super();const t=e===!1?[0,-1,0,1,2,1]:[0,2,0,0,2,0];this.setAttribute("position",new wi([-1,3,0,-1,-1,0,3,-1,0],3)),this.setAttribute("uv",new wi(t,2))}}const cie=new uie;class SE extends zi{constructor(e=null){super(cie,e),this.camera=sS,this.isQuadMesh=!0}async renderAsync(e){return e.renderAsync(this,sS)}render(e){e.render(this,sS)}}const hie=new At;class fie extends yu{static get type(){return"RTTNode"}constructor(e,t=null,n=null,r={type:Gs}){const s=new Wh(t,n,r);super(s.texture,Er()),this.node=e,this.width=t,this.height=n,this.pixelRatio=1,this.renderTarget=s,this.textureNeedsUpdate=!0,this.autoUpdate=!0,this._rttNode=null,this._quadMesh=new SE(new Vr),this.updateBeforeType=jn.RENDER}get autoSize(){return this.width===null}setup(e){return this._rttNode=this.node.context(e.getSharedContext()),this._quadMesh.material.name="RTT",this._quadMesh.material.needsUpdate=!0,super.setup(e)}setSize(e,t){this.width=e,this.height=t;const n=e*this.pixelRatio,r=t*this.pixelRatio;this.renderTarget.setSize(n,r),this.textureNeedsUpdate=!0}setPixelRatio(e){this.pixelRatio=e,this.setSize(this.width,this.height)}updateBefore({renderer:e}){if(this.textureNeedsUpdate===!1&&this.autoUpdate===!1)return;if(this.textureNeedsUpdate=!1,this.autoSize===!0){this.pixelRatio=e.getPixelRatio();const n=e.getSize(hie);this.setSize(n.width,n.height)}this._quadMesh.material.fragmentNode=this._rttNode;const t=e.getRenderTarget();e.setRenderTarget(this.renderTarget),this._quadMesh.render(e),e.setRenderTarget(t)}clone(){const e=new yu(this.value,this.uvNode,this.levelNode);return e.sampler=this.sampler,e.referenceNode=this,e}}const aB=(i,...e)=>mt(new fie(mt(i),...e)),Aie=(i,...e)=>i.isTextureNode?i:i.isPassNode?i.getTextureNode():aB(i,...e),zd=je(([i,e,t],n)=>{let r;n.renderer.coordinateSystem===pu?(i=Et(i.x,i.y.oneMinus()).mul(2).sub(1),r=dn(Ne(i,e),1)):r=dn(Ne(i.x,i.y.oneMinus(),e).mul(2).sub(1),1);const s=dn(t.mul(r));return s.xyz.div(s.w)}),die=je(([i,e])=>{const t=e.mul(dn(i,1)),n=t.xy.div(t.w).mul(.5).add(.5).toVar();return Et(n.x,n.y.oneMinus())}),pie=je(([i,e,t])=>{const n=Fh(Fr(e)),r=ms(i.mul(n)).toVar(),s=Fr(e,r).toVar(),a=Fr(e,r.sub(ms(2,0))).toVar(),l=Fr(e,r.sub(ms(1,0))).toVar(),u=Fr(e,r.add(ms(1,0))).toVar(),h=Fr(e,r.add(ms(2,0))).toVar(),g=Fr(e,r.add(ms(0,2))).toVar(),v=Fr(e,r.add(ms(0,1))).toVar(),x=Fr(e,r.sub(ms(0,1))).toVar(),S=Fr(e,r.sub(ms(0,2))).toVar(),w=ur(Ti(ge(2).mul(l).sub(a),s)).toVar(),R=ur(Ti(ge(2).mul(u).sub(h),s)).toVar(),C=ur(Ti(ge(2).mul(v).sub(g),s)).toVar(),E=ur(Ti(ge(2).mul(x).sub(S),s)).toVar(),B=zd(i,s,t).toVar(),L=w.lessThan(R).select(B.sub(zd(i.sub(Et(ge(1).div(n.x),0)),l,t)),B.negate().add(zd(i.add(Et(ge(1).div(n.x),0)),u,t))),O=C.lessThan(E).select(B.sub(zd(i.add(Et(0,ge(1).div(n.y))),v,t)),B.negate().add(zd(i.sub(Et(0,ge(1).div(n.y))),x,t)));return Fc(ky(L,O))});class t_ extends Ig{constructor(e,t,n=Float32Array){const r=ArrayBuffer.isView(e)?e:new n(e*t);super(r,t),this.isStorageInstancedBufferAttribute=!0}}class mie extends wr{constructor(e,t,n=Float32Array){const r=ArrayBuffer.isView(e)?e:new n(e*t);super(r,t),this.isStorageBufferAttribute=!0}}class gie extends vA{static get type(){return"StorageArrayElementNode"}constructor(e,t){super(e,t),this.isStorageArrayElementNode=!0}set storageBufferNode(e){this.node=e}get storageBufferNode(){return this.node}setup(e){return e.isAvailable("storageBuffer")===!1&&this.node.isPBO===!0&&e.setupPBO(this.node),super.setup(e)}generate(e,t){let n;const r=e.context.assign;if(e.isAvailable("storageBuffer")===!1?this.node.isPBO===!0&&r!==!0&&(this.node.value.isInstancedBufferAttribute||e.shaderStage!=="compute")?n=e.generatePBO(this):n=this.node.build(e):n=super.generate(e),r!==!0){const s=this.getNodeType(e);n=e.format(n,s,t)}return n}}const vie=ct(gie);class _ie extends rE{static get type(){return"StorageBufferNode"}constructor(e,t=null,n=0){t===null&&(e.isStorageBufferAttribute||e.isStorageInstancedBufferAttribute)&&(t=LP(e.itemSize),n=e.count),super(e,t,n),this.isStorageBufferNode=!0,this.access=sa.READ_WRITE,this.isAtomic=!1,this.isPBO=!1,this._attribute=null,this._varying=null,this.global=!0,e.isStorageBufferAttribute!==!0&&e.isStorageInstancedBufferAttribute!==!0&&(e.isInstancedBufferAttribute?e.isStorageInstancedBufferAttribute=!0:e.isStorageBufferAttribute=!0)}getHash(e){if(this.bufferCount===0){let t=e.globalCache.getData(this.value);return t===void 0&&(t={node:this},e.globalCache.setData(this.value,t)),t.node.uuid}return this.uuid}getInputType(){return this.value.isIndirectStorageBufferAttribute?"indirectStorageBuffer":"storageBuffer"}element(e){return vie(this,e)}setPBO(e){return this.isPBO=e,this}getPBO(){return this.isPBO}setAccess(e){return this.access=e,this}toReadOnly(){return this.setAccess(sa.READ_ONLY)}setAtomic(e){return this.isAtomic=e,this}toAtomic(){return this.setAtomic(!0)}getAttributeData(){return this._attribute===null&&(this._attribute=$g(this.value),this._varying=ro(this._attribute)),{attribute:this._attribute,varying:this._varying}}getNodeType(e){if(e.isAvailable("storageBuffer")||e.isAvailable("indirectStorageBuffer"))return super.getNodeType(e);const{attribute:t}=this.getAttributeData();return t.getNodeType(e)}generate(e){if(e.isAvailable("storageBuffer")||e.isAvailable("indirectStorageBuffer"))return super.generate(e);const{attribute:t,varying:n}=this.getAttributeData(),r=n.build(e);return e.registerTransform(r,t),r}}const Qy=(i,e=null,t=0)=>mt(new _ie(i,e,t)),yie=(i,e,t)=>(console.warn('THREE.TSL: "storageObject()" is deprecated. Use "storage().setPBO( true )" instead.'),Qy(i,e,t).setPBO(!0)),xie=(i,e="float")=>{const t=BP(e),n=UP(e),r=new mie(i,t,n);return Qy(r,e,i)},bie=(i,e="float")=>{const t=BP(e),n=UP(e),r=new t_(i,t,n);return Qy(r,e,i)};class Sie extends y9{static get type(){return"VertexColorNode"}constructor(e=0){super(null,"vec4"),this.isVertexColorNode=!0,this.index=e}getAttributeName(){const e=this.index;return"color"+(e>0?e:"")}generate(e){const t=this.getAttributeName(e),n=e.hasGeometryAttribute(t);let r;return n===!0?r=super.generate(e):r=e.generateConst(this.nodeType,new Pn(1,1,1,1)),r}serialize(e){super.serialize(e),e.index=this.index}deserialize(e){super.deserialize(e),this.index=e.index}}const Tie=i=>mt(new Sie(i));class wie extends Mn{static get type(){return"PointUVNode"}constructor(){super("vec2"),this.isPointUVNode=!0}generate(){return"vec2( gl_PointCoord.x, 1.0 - gl_PointCoord.y )"}}const Mie=zt(wie),fm=new la,aS=new kn;class Ya extends Mn{static get type(){return"SceneNode"}constructor(e=Ya.BACKGROUND_BLURRINESS,t=null){super(),this.scope=e,this.scene=t}setup(e){const t=this.scope,n=this.scene!==null?this.scene:e.scene;let r;return t===Ya.BACKGROUND_BLURRINESS?r=ji("backgroundBlurriness","float",n):t===Ya.BACKGROUND_INTENSITY?r=ji("backgroundIntensity","float",n):t===Ya.BACKGROUND_ROTATION?r=gn("mat4").label("backgroundRotation").setGroup(Rn).onRenderUpdate(()=>{const s=n.background;return s!==null&&s.isTexture&&s.mapping!==Pw?(fm.copy(n.backgroundRotation),fm.x*=-1,fm.y*=-1,fm.z*=-1,aS.makeRotationFromEuler(fm)):aS.identity(),aS}):console.error("THREE.SceneNode: Unknown scope:",t),r}}Ya.BACKGROUND_BLURRINESS="backgroundBlurriness";Ya.BACKGROUND_INTENSITY="backgroundIntensity";Ya.BACKGROUND_ROTATION="backgroundRotation";const oB=zt(Ya,Ya.BACKGROUND_BLURRINESS),JT=zt(Ya,Ya.BACKGROUND_INTENSITY),lB=zt(Ya,Ya.BACKGROUND_ROTATION);class Eie extends yu{static get type(){return"StorageTextureNode"}constructor(e,t,n=null){super(e,t),this.storeNode=n,this.isStorageTextureNode=!0,this.access=sa.WRITE_ONLY}getInputType(){return"storageTexture"}setup(e){super.setup(e);const t=e.getNodeProperties(this);t.storeNode=this.storeNode}setAccess(e){return this.access=e,this}generate(e,t){let n;return this.storeNode!==null?n=this.generateStore(e):n=super.generate(e,t),n}toReadWrite(){return this.setAccess(sa.READ_WRITE)}toReadOnly(){return this.setAccess(sa.READ_ONLY)}toWriteOnly(){return this.setAccess(sa.WRITE_ONLY)}generateStore(e){const t=e.getNodeProperties(this),{uvNode:n,storeNode:r}=t,s=super.generate(e,"property"),a=n.build(e,"uvec2"),l=r.build(e,"vec4"),u=e.generateTextureStore(e,s,a,l);e.addLineFlowCode(u,this)}}const uB=ct(Eie),Cie=(i,e,t)=>{const n=uB(i,e,t);return t!==null&&n.append(),n};class Rie extends jy{static get type(){return"UserDataNode"}constructor(e,t,n=null){super(e,t,n),this.userData=n}updateReference(e){return this.reference=this.userData!==null?this.userData:e.object.userData,this.reference}}const Nie=(i,e,t)=>mt(new Rie(i,e,t)),rN=new WeakMap;class Die extends Zr{static get type(){return"VelocityNode"}constructor(){super("vec2"),this.projectionMatrix=null,this.updateType=jn.OBJECT,this.updateAfterType=jn.OBJECT,this.previousModelWorldMatrix=gn(new kn),this.previousProjectionMatrix=gn(new kn).setGroup(Rn),this.previousCameraViewMatrix=gn(new kn)}setProjectionMatrix(e){this.projectionMatrix=e}update({frameId:e,camera:t,object:n}){const r=sN(n);this.previousModelWorldMatrix.value.copy(r);const s=cB(t);s.frameId!==e&&(s.frameId=e,s.previousProjectionMatrix===void 0?(s.previousProjectionMatrix=new kn,s.previousCameraViewMatrix=new kn,s.currentProjectionMatrix=new kn,s.currentCameraViewMatrix=new kn,s.previousProjectionMatrix.copy(this.projectionMatrix||t.projectionMatrix),s.previousCameraViewMatrix.copy(t.matrixWorldInverse)):(s.previousProjectionMatrix.copy(s.currentProjectionMatrix),s.previousCameraViewMatrix.copy(s.currentCameraViewMatrix)),s.currentProjectionMatrix.copy(this.projectionMatrix||t.projectionMatrix),s.currentCameraViewMatrix.copy(t.matrixWorldInverse),this.previousProjectionMatrix.value.copy(s.previousProjectionMatrix),this.previousCameraViewMatrix.value.copy(s.previousCameraViewMatrix))}updateAfter({object:e}){sN(e).copy(e.matrixWorld)}setup(){const e=this.projectionMatrix===null?_A:gn(this.projectionMatrix),t=this.previousCameraViewMatrix.mul(this.previousModelWorldMatrix),n=e.mul(Q0).mul(Gr),r=this.previousProjectionMatrix.mul(t).mul(ey),s=n.xy.div(n.w),a=r.xy.div(r.w);return Ti(s,a)}}function cB(i){let e=rN.get(i);return e===void 0&&(e={},rN.set(i,e)),e}function sN(i,e=0){const t=cB(i);let n=t[e];return n===void 0&&(t[e]=n=new kn),n}const Pie=zt(Die),hB=je(([i,e])=>to(1,i.oneMinus().div(e)).oneMinus()).setLayout({name:"blendBurn",type:"vec3",inputs:[{name:"base",type:"vec3"},{name:"blend",type:"vec3"}]}),fB=je(([i,e])=>to(i.div(e.oneMinus()),1)).setLayout({name:"blendDodge",type:"vec3",inputs:[{name:"base",type:"vec3"},{name:"blend",type:"vec3"}]}),AB=je(([i,e])=>i.oneMinus().mul(e.oneMinus()).oneMinus()).setLayout({name:"blendScreen",type:"vec3",inputs:[{name:"base",type:"vec3"},{name:"blend",type:"vec3"}]}),dB=je(([i,e])=>Fi(i.mul(2).mul(e),i.oneMinus().mul(2).mul(e.oneMinus()).oneMinus(),Fy(.5,i))).setLayout({name:"blendOverlay",type:"vec3",inputs:[{name:"base",type:"vec3"},{name:"blend",type:"vec3"}]}),Lie=je(([i,e])=>{const t=e.a.add(i.a.mul(e.a.oneMinus()));return dn(e.rgb.mul(e.a).add(i.rgb.mul(i.a).mul(e.a.oneMinus())).div(t),t)}).setLayout({name:"blendColor",type:"vec4",inputs:[{name:"base",type:"vec4"},{name:"blend",type:"vec4"}]}),Uie=(...i)=>(console.warn('THREE.TSL: "burn" has been renamed. Use "blendBurn" instead.'),hB(i)),Bie=(...i)=>(console.warn('THREE.TSL: "dodge" has been renamed. Use "blendDodge" instead.'),fB(i)),Oie=(...i)=>(console.warn('THREE.TSL: "screen" has been renamed. Use "blendScreen" instead.'),AB(i)),Iie=(...i)=>(console.warn('THREE.TSL: "overlay" has been renamed. Use "blendOverlay" instead.'),dB(i)),Fie=je(([i])=>TE(i.rgb)),kie=je(([i,e=ge(1)])=>e.mix(TE(i.rgb),i.rgb)),zie=je(([i,e=ge(1)])=>{const t=Qr(i.r,i.g,i.b).div(3),n=i.r.max(i.g.max(i.b)),r=n.sub(t).mul(e).mul(-3);return Fi(i.rgb,n,r)}),Gie=je(([i,e=ge(1)])=>{const t=Ne(.57735,.57735,.57735),n=e.cos();return Ne(i.rgb.mul(n).add(t.cross(i.rgb).mul(e.sin()).add(t.mul(Xh(t,i.rgb).mul(n.oneMinus())))))}),TE=(i,e=Ne(ai.getLuminanceCoefficients(new ce)))=>Xh(i,e),qie=je(([i,e=Ne(1),t=Ne(0),n=Ne(1),r=ge(1),s=Ne(ai.getLuminanceCoefficients(new ce,Ro))])=>{const a=i.rgb.dot(Ne(s)),l=qr(i.rgb.mul(e).add(t),0).toVar(),u=l.pow(n).toVar();return ti(l.r.greaterThan(0),()=>{l.r.assign(u.r)}),ti(l.g.greaterThan(0),()=>{l.g.assign(u.g)}),ti(l.b.greaterThan(0),()=>{l.b.assign(u.b)}),l.assign(a.add(l.sub(a).mul(r))),dn(l.rgb,i.a)});class Vie extends Zr{static get type(){return"PosterizeNode"}constructor(e,t){super(),this.sourceNode=e,this.stepsNode=t}setup(){const{sourceNode:e,stepsNode:t}=this;return e.mul(t).floor().div(t)}}const Hie=ct(Vie),jie=new At;class pB extends yu{static get type(){return"PassTextureNode"}constructor(e,t){super(t),this.passNode=e,this.setUpdateMatrix(!1)}setup(e){return e.object.isQuadMesh&&this.passNode.build(e),super.setup(e)}clone(){return new this.constructor(this.passNode,this.value)}}class aN extends pB{static get type(){return"PassMultipleTextureNode"}constructor(e,t,n=!1){super(e,null),this.textureName=t,this.previousTexture=n}updateTexture(){this.value=this.previousTexture?this.passNode.getPreviousTexture(this.textureName):this.passNode.getTexture(this.textureName)}setup(e){return this.updateTexture(),super.setup(e)}clone(){return new this.constructor(this.passNode,this.textureName,this.previousTexture)}}class Tu extends Zr{static get type(){return"PassNode"}constructor(e,t,n,r={}){super("vec4"),this.scope=e,this.scene=t,this.camera=n,this.options=r,this._pixelRatio=1,this._width=1,this._height=1;const s=new qc;s.isRenderTargetTexture=!0,s.name="depth";const a=new Wh(this._width*this._pixelRatio,this._height*this._pixelRatio,{type:Gs,...r});a.texture.name="output",a.depthTexture=s,this.renderTarget=a,this._textures={output:a.texture,depth:s},this._textureNodes={},this._linearDepthNodes={},this._viewZNodes={},this._previousTextures={},this._previousTextureNodes={},this._cameraNear=gn(0),this._cameraFar=gn(0),this._mrt=null,this.isPassNode=!0,this.updateBeforeType=jn.FRAME}setMRT(e){return this._mrt=e,this}getMRT(){return this._mrt}isGlobal(){return!0}getTexture(e){let t=this._textures[e];return t===void 0&&(t=this.renderTarget.texture.clone(),t.name=e,this._textures[e]=t,this.renderTarget.textures.push(t)),t}getPreviousTexture(e){let t=this._previousTextures[e];return t===void 0&&(t=this.getTexture(e).clone(),this._previousTextures[e]=t),t}toggleTexture(e){const t=this._previousTextures[e];if(t!==void 0){const n=this._textures[e],r=this.renderTarget.textures.indexOf(n);this.renderTarget.textures[r]=t,this._textures[e]=t,this._previousTextures[e]=n,this._textureNodes[e].updateTexture(),this._previousTextureNodes[e].updateTexture()}}getTextureNode(e="output"){let t=this._textureNodes[e];return t===void 0&&(t=mt(new aN(this,e)),t.updateTexture(),this._textureNodes[e]=t),t}getPreviousTextureNode(e="output"){let t=this._previousTextureNodes[e];return t===void 0&&(this._textureNodes[e]===void 0&&this.getTextureNode(e),t=mt(new aN(this,e,!0)),t.updateTexture(),this._previousTextureNodes[e]=t),t}getViewZNode(e="depth"){let t=this._viewZNodes[e];if(t===void 0){const n=this._cameraNear,r=this._cameraFar;this._viewZNodes[e]=t=fE(this.getTextureNode(e),n,r)}return t}getLinearDepthNode(e="depth"){let t=this._linearDepthNodes[e];if(t===void 0){const n=this._cameraNear,r=this._cameraFar,s=this.getViewZNode(e);this._linearDepthNodes[e]=t=s0(s,n,r)}return t}setup({renderer:e}){return this.renderTarget.samples=this.options.samples===void 0?e.samples:this.options.samples,e.backend.isWebGLBackend===!0&&(this.renderTarget.samples=0),this.scope===Tu.COLOR?this.getTextureNode():this.getLinearDepthNode()}updateBefore(e){const{renderer:t}=e,{scene:n,camera:r}=this;this._pixelRatio=t.getPixelRatio();const s=t.getSize(jie);this.setSize(s.width,s.height);const a=t.getRenderTarget(),l=t.getMRT();this._cameraNear.value=r.near,this._cameraFar.value=r.far;for(const u in this._previousTextures)this.toggleTexture(u);t.setRenderTarget(this.renderTarget),t.setMRT(this._mrt),t.render(n,r),t.setRenderTarget(a),t.setMRT(l)}setSize(e,t){this._width=e,this._height=t;const n=this._width*this._pixelRatio,r=this._height*this._pixelRatio;this.renderTarget.setSize(n,r)}setPixelRatio(e){this._pixelRatio=e,this.setSize(this._width,this._height)}dispose(){this.renderTarget.dispose()}}Tu.COLOR="color";Tu.DEPTH="depth";const Wie=(i,e,t)=>mt(new Tu(Tu.COLOR,i,e,t)),$ie=(i,e)=>mt(new pB(i,e)),Xie=(i,e,t)=>mt(new Tu(Tu.DEPTH,i,e,t));class Yie extends Tu{static get type(){return"ToonOutlinePassNode"}constructor(e,t,n,r,s){super(Tu.COLOR,e,t),this.colorNode=n,this.thicknessNode=r,this.alphaNode=s,this._materialCache=new WeakMap}updateBefore(e){const{renderer:t}=e,n=t.getRenderObjectFunction();t.setRenderObjectFunction((r,s,a,l,u,h,g,v)=>{if((u.isMeshToonMaterial||u.isMeshToonNodeMaterial)&&u.wireframe===!1){const x=this._getOutlineMaterial(u);t.renderObject(r,s,a,l,x,h,g,v)}t.renderObject(r,s,a,l,u,h,g,v)}),super.updateBefore(e),t.setRenderObjectFunction(n)}_createMaterial(){const e=new Vr;e.isMeshToonOutlineMaterial=!0,e.name="Toon_Outline",e.side=hr;const t=no.negate(),n=_A.mul(Q0),r=ge(1),s=n.mul(dn(Gr,1)),a=n.mul(dn(Gr.add(t),1)),l=Fc(s.sub(a));return e.vertexNode=s.add(l.mul(this.thicknessNode).mul(s.w).mul(r)),e.colorNode=dn(this.colorNode,this.alphaNode),e}_getOutlineMaterial(e){let t=this._materialCache.get(e);return t===void 0&&(t=this._createMaterial(),this._materialCache.set(e,t)),t}}const Qie=(i,e,t=new sn(0,0,0),n=.003,r=1)=>mt(new Yie(i,e,mt(t),mt(n),mt(r))),mB=je(([i,e])=>i.mul(e).clamp()).setLayout({name:"linearToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),gB=je(([i,e])=>(i=i.mul(e),i.div(i.add(1)).clamp())).setLayout({name:"reinhardToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),vB=je(([i,e])=>{i=i.mul(e),i=i.sub(.004).max(0);const t=i.mul(i.mul(6.2).add(.5)),n=i.mul(i.mul(6.2).add(1.7)).add(.06);return t.div(n).pow(2.2)}).setLayout({name:"cineonToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),Kie=je(([i])=>{const e=i.mul(i.add(.0245786)).sub(90537e-9),t=i.mul(i.add(.432951).mul(.983729)).add(.238081);return e.div(t)}),_B=je(([i,e])=>{const t=ha(.59719,.35458,.04823,.076,.90834,.01566,.0284,.13383,.83777),n=ha(1.60475,-.53108,-.07367,-.10208,1.10813,-.00605,-.00327,-.07276,1.07602);return i=i.mul(e).div(.6),i=t.mul(i),i=Kie(i),i=n.mul(i),i.clamp()}).setLayout({name:"acesFilmicToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),Zie=ha(Ne(1.6605,-.1246,-.0182),Ne(-.5876,1.1329,-.1006),Ne(-.0728,-.0083,1.1187)),Jie=ha(Ne(.6274,.0691,.0164),Ne(.3293,.9195,.088),Ne(.0433,.0113,.8956)),ere=je(([i])=>{const e=Ne(i).toVar(),t=Ne(e.mul(e)).toVar(),n=Ne(t.mul(t)).toVar();return ge(15.5).mul(n.mul(t)).sub(Wn(40.14,n.mul(e))).add(Wn(31.96,n).sub(Wn(6.868,t.mul(e))).add(Wn(.4298,t).add(Wn(.1191,e).sub(.00232))))}),yB=je(([i,e])=>{const t=Ne(i).toVar(),n=ha(Ne(.856627153315983,.137318972929847,.11189821299995),Ne(.0951212405381588,.761241990602591,.0767994186031903),Ne(.0482516061458583,.101439036467562,.811302368396859)),r=ha(Ne(1.1271005818144368,-.1413297634984383,-.14132976349843826),Ne(-.11060664309660323,1.157823702216272,-.11060664309660294),Ne(-.016493938717834573,-.016493938717834257,1.2519364065950405)),s=ge(-12.47393),a=ge(4.026069);return t.mulAssign(e),t.assign(Jie.mul(t)),t.assign(n.mul(t)),t.assign(qr(t,1e-10)),t.assign(cu(t)),t.assign(t.sub(s).div(a.sub(s))),t.assign(vu(t,0,1)),t.assign(ere(t)),t.assign(r.mul(t)),t.assign(Cl(qr(Ne(0),t),Ne(2.2))),t.assign(Zie.mul(t)),t.assign(vu(t,0,1)),t}).setLayout({name:"agxToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),xB=je(([i,e])=>{const t=ge(.76),n=ge(.15);i=i.mul(e);const r=to(i.r,to(i.g,i.b)),s=zs(r.lessThan(.08),r.sub(Wn(6.25,r.mul(r))),.04);i.subAssign(s);const a=qr(i.r,qr(i.g,i.b));ti(a.lessThan(t),()=>i);const l=Ti(1,t),u=Ti(1,l.mul(l).div(a.add(l.sub(t))));i.mulAssign(u.div(a));const h=Ti(1,Dl(1,n.mul(a.sub(u)).add(1)));return Fi(i,Ne(u),h)}).setLayout({name:"neutralToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]});class rs extends Mn{static get type(){return"CodeNode"}constructor(e="",t=[],n=""){super("code"),this.isCodeNode=!0,this.code=e,this.includes=t,this.language=n}isGlobal(){return!0}setIncludes(e){return this.includes=e,this}getIncludes(){return this.includes}generate(e){const t=this.getIncludes(e);for(const r of t)r.build(e);const n=e.getCodeFromNode(this,this.getNodeType(e));return n.code=this.code,n.code}serialize(e){super.serialize(e),e.code=this.code,e.language=this.language}deserialize(e){super.deserialize(e),this.code=e.code,this.language=e.language}}const Ky=ct(rs),tre=(i,e)=>Ky(i,e,"js"),nre=(i,e)=>Ky(i,e,"wgsl"),ire=(i,e)=>Ky(i,e,"glsl");class bB extends rs{static get type(){return"FunctionNode"}constructor(e="",t=[],n=""){super(e,t,n)}getNodeType(e){return this.getNodeFunction(e).type}getInputs(e){return this.getNodeFunction(e).inputs}getNodeFunction(e){const t=e.getDataFromNode(this);let n=t.nodeFunction;return n===void 0&&(n=e.parser.parseFunction(this.code),t.nodeFunction=n),n}generate(e,t){super.generate(e);const n=this.getNodeFunction(e),r=n.name,s=n.type,a=e.getCodeFromNode(this,s);r!==""&&(a.name=r);const l=e.getPropertyName(a),u=this.getNodeFunction(e).getCode(l);return a.code=u+` -`,t==="property"?l:e.format(`${l}()`,s,t)}}const SB=(i,e=[],t="")=>{for(let s=0;sn.call(...s);return r.functionNode=n,r},rre=(i,e)=>SB(i,e,"glsl"),sre=(i,e)=>SB(i,e,"wgsl");class are extends Mn{static get type(){return"ScriptableValueNode"}constructor(e=null){super(),this._value=e,this._cache=null,this.inputType=null,this.outputType=null,this.events=new zc,this.isScriptableValueNode=!0}get isScriptableOutputNode(){return this.outputType!==null}set value(e){this._value!==e&&(this._cache&&this.inputType==="URL"&&this.value.value instanceof ArrayBuffer&&(URL.revokeObjectURL(this._cache),this._cache=null),this._value=e,this.events.dispatchEvent({type:"change"}),this.refresh())}get value(){return this._value}refresh(){this.events.dispatchEvent({type:"refresh"})}getValue(){const e=this.value;if(e&&this._cache===null&&this.inputType==="URL"&&e.value instanceof ArrayBuffer)this._cache=URL.createObjectURL(new Blob([e.value]));else if(e&&e.value!==null&&e.value!==void 0&&((this.inputType==="URL"||this.inputType==="String")&&typeof e.value=="string"||this.inputType==="Number"&&typeof e.value=="number"||this.inputType==="Vector2"&&e.value.isVector2||this.inputType==="Vector3"&&e.value.isVector3||this.inputType==="Vector4"&&e.value.isVector4||this.inputType==="Color"&&e.value.isColor||this.inputType==="Matrix3"&&e.value.isMatrix3||this.inputType==="Matrix4"&&e.value.isMatrix4))return e.value;return this._cache||e}getNodeType(e){return this.value&&this.value.isNode?this.value.getNodeType(e):"float"}setup(){return this.value&&this.value.isNode?this.value:ge()}serialize(e){super.serialize(e),this.value!==null?this.inputType==="ArrayBuffer"?e.value=FP(this.value):e.value=this.value?this.value.toJSON(e.meta).uuid:null:e.value=null,e.inputType=this.inputType,e.outputType=this.outputType}deserialize(e){super.deserialize(e);let t=null;e.value!==null&&(e.inputType==="ArrayBuffer"?t=kP(e.value):e.inputType==="Texture"?t=e.meta.textures[e.value]:t=e.meta.nodes[e.value]||null),this.value=t,this.inputType=e.inputType,this.outputType=e.outputType}}const n_=ct(are);class TB extends Map{get(e,t=null,...n){if(this.has(e))return super.get(e);if(t!==null){const r=t(...n);return this.set(e,r),r}}}class ore{constructor(e){this.scriptableNode=e}get parameters(){return this.scriptableNode.parameters}get layout(){return this.scriptableNode.getLayout()}getInputLayout(e){return this.scriptableNode.getInputLayout(e)}get(e){const t=this.parameters[e];return t?t.getValue():null}}const i_=new TB;class lre extends Mn{static get type(){return"ScriptableNode"}constructor(e=null,t={}){super(),this.codeNode=e,this.parameters=t,this._local=new TB,this._output=n_(),this._outputs={},this._source=this.source,this._method=null,this._object=null,this._value=null,this._needsOutputUpdate=!0,this.onRefresh=this.onRefresh.bind(this),this.isScriptableNode=!0}get source(){return this.codeNode?this.codeNode.code:""}setLocal(e,t){return this._local.set(e,t)}getLocal(e){return this._local.get(e)}onRefresh(){this._refresh()}getInputLayout(e){for(const t of this.getLayout())if(t.inputType&&(t.id===e||t.name===e))return t}getOutputLayout(e){for(const t of this.getLayout())if(t.outputType&&(t.id===e||t.name===e))return t}setOutput(e,t){const n=this._outputs;return n[e]===void 0?n[e]=n_(t):n[e].value=t,this}getOutput(e){return this._outputs[e]}getParameter(e){return this.parameters[e]}setParameter(e,t){const n=this.parameters;return t&&t.isScriptableNode?(this.deleteParameter(e),n[e]=t,n[e].getDefaultOutput().events.addEventListener("refresh",this.onRefresh)):t&&t.isScriptableValueNode?(this.deleteParameter(e),n[e]=t,n[e].events.addEventListener("refresh",this.onRefresh)):n[e]===void 0?(n[e]=n_(t),n[e].events.addEventListener("refresh",this.onRefresh)):n[e].value=t,this}getValue(){return this.getDefaultOutput().getValue()}deleteParameter(e){let t=this.parameters[e];return t&&(t.isScriptableNode&&(t=t.getDefaultOutput()),t.events.removeEventListener("refresh",this.onRefresh)),this}clearParameters(){for(const e of Object.keys(this.parameters))this.deleteParameter(e);return this.needsUpdate=!0,this}call(e,...t){const r=this.getObject()[e];if(typeof r=="function")return r(...t)}async callAsync(e,...t){const r=this.getObject()[e];if(typeof r=="function")return r.constructor.name==="AsyncFunction"?await r(...t):r(...t)}getNodeType(e){return this.getDefaultOutputNode().getNodeType(e)}refresh(e=null){e!==null?this.getOutput(e).refresh():this._refresh()}getObject(){if(this.needsUpdate&&this.dispose(),this._object!==null)return this._object;const e=()=>this.refresh(),t=(h,g)=>this.setOutput(h,g),n=new ore(this),r=i_.get("THREE"),s=i_.get("TSL"),a=this.getMethod(),l=[n,this._local,i_,e,t,r,s];this._object=a(...l);const u=this._object.layout;if(u&&(u.cache===!1&&this._local.clear(),this._output.outputType=u.outputType||null,Array.isArray(u.elements)))for(const h of u.elements){const g=h.id||h.name;h.inputType&&(this.getParameter(g)===void 0&&this.setParameter(g,null),this.getParameter(g).inputType=h.inputType),h.outputType&&(this.getOutput(g)===void 0&&this.setOutput(g,null),this.getOutput(g).outputType=h.outputType)}return this._object}deserialize(e){super.deserialize(e);for(const t in this.parameters){let n=this.parameters[t];n.isScriptableNode&&(n=n.getDefaultOutput()),n.events.addEventListener("refresh",this.onRefresh)}}getLayout(){return this.getObject().layout}getDefaultOutputNode(){const e=this.getDefaultOutput().value;return e&&e.isNode?e:ge()}getDefaultOutput(){return this._exec()._output}getMethod(){if(this.needsUpdate&&this.dispose(),this._method!==null)return this._method;const e=["parameters","local","global","refresh","setOutput","THREE","TSL"],n=["layout","init","main","dispose"].join(", "),r="var "+n+`; var output = {}; +`).removeFlowTab();return e.addFlowTab(),a}}const ki=(...i)=>gt(new yee(tA(i,"int"))).append(),xee=()=>Hh("continue").append(),TU=()=>Hh("break").append(),bee=(...i)=>(console.warn("TSL.LoopNode: loop() has been renamed to Loop()."),ki(...i)),$3=new WeakMap,vo=new Pn,BR=je(({bufferMap:i,influence:e,stride:t,width:n,depth:r,offset:s})=>{const a=ye(gU).mul(t).add(s),l=a.div(n),u=a.sub(l.mul(n));return Fr(i,ms(u,l)).depth(r).mul(e)});function See(i){const e=i.morphAttributes.position!==void 0,t=i.morphAttributes.normal!==void 0,n=i.morphAttributes.color!==void 0,r=i.morphAttributes.position||i.morphAttributes.normal||i.morphAttributes.color,s=r!==void 0?r.length:0;let a=$3.get(i);if(a===void 0||a.count!==s){let B=function(){C.dispose(),$3.delete(i),i.removeEventListener("dispose",B)};var l=B;a!==void 0&&a.texture.dispose();const u=i.morphAttributes.position||[],h=i.morphAttributes.normal||[],g=i.morphAttributes.color||[];let v=0;e===!0&&(v=1),t===!0&&(v=2),n===!0&&(v=3);let x=i.attributes.position.count*v,S=1;const w=4096;x>w&&(S=Math.ceil(x/w),x=w);const R=new Float32Array(x*S*4*s),C=new Hw(R,x,S,s);C.type=$r,C.needsUpdate=!0;const E=v*4;for(let L=0;L{const x=ge(0).toVar();this.mesh.count>1&&this.mesh.morphTexture!==null&&this.mesh.morphTexture!==void 0?x.assign(Fr(this.mesh.morphTexture,ms(ye(v).add(1),ye(Jg))).r):x.assign(ji("morphTargetInfluences","float").element(v).toVar()),n===!0&&Gr.addAssign(BR({bufferMap:l,influence:x,stride:u,width:g,depth:v,offset:ye(0)})),r===!0&&no.addAssign(BR({bufferMap:l,influence:x,stride:u,width:g,depth:v,offset:ye(1)}))})}update(){const e=this.morphBaseInfluence;this.mesh.geometry.morphTargetsRelative?e.value=1:e.value=1-this.mesh.morphTargetInfluences.reduce((t,n)=>t+n,0)}}const wU=ht(Tee);class K0 extends Mn{static get type(){return"LightingNode"}constructor(){super("vec3"),this.isLightingNode=!0}}class wee extends K0{static get type(){return"AONode"}constructor(e=null){super(),this.aoNode=e}setup(e){e.context.ambientOcclusion.mulAssign(this.aoNode)}}class Mee extends ZL{static get type(){return"LightingContextNode"}constructor(e,t=null,n=null,r=null){super(e),this.lightingModel=t,this.backdropNode=n,this.backdropAlphaNode=r,this._value=null}getContext(){const{backdropNode:e,backdropAlphaNode:t}=this,n=Ne().toVar("directDiffuse"),r=Ne().toVar("directSpecular"),s=Ne().toVar("indirectDiffuse"),a=Ne().toVar("indirectSpecular"),l={directDiffuse:n,directSpecular:r,indirectDiffuse:s,indirectSpecular:a};return{radiance:Ne().toVar("radiance"),irradiance:Ne().toVar("irradiance"),iblIrradiance:Ne().toVar("iblIrradiance"),ambientOcclusion:ge(1).toVar("ambientOcclusion"),reflectedLight:l,backdrop:e,backdropAlpha:t}}setup(e){return this.value=this._value||(this._value=this.getContext()),this.value.lightingModel=this.lightingModel||e.context.lightingModel,super.setup(e)}}const MU=ht(Mee);class Eee extends K0{static get type(){return"IrradianceNode"}constructor(e){super(),this.node=e}setup(e){e.context.irradiance.addAssign(this.node)}}let am,om;class ss extends Mn{static get type(){return"ScreenNode"}constructor(e){super(),this.scope=e,this.isViewportNode=!0}getNodeType(){return this.scope===ss.VIEWPORT?"vec4":"vec2"}getUpdateType(){let e=jn.NONE;return(this.scope===ss.SIZE||this.scope===ss.VIEWPORT)&&(e=jn.RENDER),this.updateType=e,e}update({renderer:e}){const t=e.getRenderTarget();this.scope===ss.VIEWPORT?t!==null?om.copy(t.viewport):(e.getViewport(om),om.multiplyScalar(e.getPixelRatio())):t!==null?(am.width=t.width,am.height=t.height):e.getDrawingBufferSize(am)}setup(){const e=this.scope;let t=null;return e===ss.SIZE?t=gn(am||(am=new dt)):e===ss.VIEWPORT?t=gn(om||(om=new Pn)):t=Et(e1.div(Rg)),t}generate(e){if(this.scope===ss.COORDINATE){let t=e.getFragCoord();if(e.isFlipY()){const n=e.getNodeProperties(Rg).outputNode.build(e);t=`${e.getType("vec2")}( ${t}.x, ${n}.y - ${t}.y )`}return t}return super.generate(e)}}ss.COORDINATE="coordinate";ss.VIEWPORT="viewport";ss.SIZE="size";ss.UV="uv";const bu=zt(ss,ss.UV),Rg=zt(ss,ss.SIZE),e1=zt(ss,ss.COORDINATE),uE=zt(ss,ss.VIEWPORT),EU=uE.zw,CU=e1.sub(uE.xy),Cee=CU.div(EU),Ree=je(()=>(console.warn('TSL.ViewportNode: "viewportResolution" is deprecated. Use "screenSize" instead.'),Rg),"vec2").once()(),Nee=je(()=>(console.warn('TSL.ViewportNode: "viewportTopLeft" is deprecated. Use "screenUV" instead.'),bu),"vec2").once()(),Dee=je(()=>(console.warn('TSL.ViewportNode: "viewportBottomLeft" is deprecated. Use "screenUV.flipY()" instead.'),bu.flipY()),"vec2").once()(),lm=new dt;class $y extends yu{static get type(){return"ViewportTextureNode"}constructor(e=bu,t=null,n=null){n===null&&(n=new j7,n.minFilter=Va),super(n,e,t),this.generateMipmaps=!1,this.isOutputTextureNode=!0,this.updateBeforeType=jn.FRAME}updateBefore(e){const t=e.renderer;t.getDrawingBufferSize(lm);const n=this.value;(n.image.width!==lm.width||n.image.height!==lm.height)&&(n.image.width=lm.width,n.image.height=lm.height,n.needsUpdate=!0);const r=n.generateMipmaps;n.generateMipmaps=this.generateMipmaps,t.copyFramebufferToTexture(n),n.generateMipmaps=r}clone(){const e=new this.constructor(this.uvNode,this.levelNode,this.value);return e.generateMipmaps=this.generateMipmaps,e}}const Pee=ht($y),cE=ht($y,null,null,{generateMipmaps:!0});let X3=null;class Lee extends $y{static get type(){return"ViewportDepthTextureNode"}constructor(e=bu,t=null){X3===null&&(X3=new qc),super(e,t,X3)}}const hE=ht(Lee);class Xa extends Mn{static get type(){return"ViewportDepthNode"}constructor(e,t=null){super("float"),this.scope=e,this.valueNode=t,this.isViewportDepthNode=!0}generate(e){const{scope:t}=this;return t===Xa.DEPTH_BASE?e.getFragDepth():super.generate(e)}setup({camera:e}){const{scope:t}=this,n=this.valueNode;let r=null;if(t===Xa.DEPTH_BASE)n!==null&&(r=NU().assign(n));else if(t===Xa.DEPTH)e.isPerspectiveCamera?r=RU(Xr.z,Dh,Ph):r=s0(Xr.z,Dh,Ph);else if(t===Xa.LINEAR_DEPTH)if(n!==null)if(e.isPerspectiveCamera){const s=fE(n,Dh,Ph);r=s0(s,Dh,Ph)}else r=n;else r=s0(Xr.z,Dh,Ph);return r}}Xa.DEPTH_BASE="depthBase";Xa.DEPTH="depth";Xa.LINEAR_DEPTH="linearDepth";const s0=(i,e,t)=>i.add(e).div(e.sub(t)),Uee=(i,e,t)=>e.sub(t).mul(i).sub(e),RU=(i,e,t)=>e.add(i).mul(t).div(t.sub(e).mul(i)),fE=(i,e,t)=>e.mul(t).div(t.sub(e).mul(i).sub(t)),AE=(i,e,t)=>{e=e.max(1e-6).toVar();const n=cu(i.negate().div(e)),r=cu(t.div(e));return n.div(r)},Bee=(i,e,t)=>{const n=i.mul(Oy(t.div(e)));return ge(Math.E).pow(n).mul(e).negate()},NU=ht(Xa,Xa.DEPTH_BASE),dE=zt(Xa,Xa.DEPTH),ty=ht(Xa,Xa.LINEAR_DEPTH),Oee=ty(hE());dE.assign=i=>NU(i);class Iee extends Mn{constructor(e){super("float"),this.name=e,this.isBuiltinNode=!0}generate(){return this.name}}const Fee=ht(Iee);class Yo extends Mn{static get type(){return"ClippingNode"}constructor(e=Yo.DEFAULT){super(),this.scope=e}setup(e){super.setup(e);const t=e.clippingContext,{intersectionPlanes:n,unionPlanes:r}=t;return this.hardwareClipping=e.material.hardwareClipping,this.scope===Yo.ALPHA_TO_COVERAGE?this.setupAlphaToCoverage(n,r):this.scope===Yo.HARDWARE?this.setupHardwareClipping(r,e):this.setupDefault(n,r)}setupAlphaToCoverage(e,t){return je(()=>{const n=ge().toVar("distanceToPlane"),r=ge().toVar("distanceToGradient"),s=ge(1).toVar("clipOpacity"),a=t.length;if(this.hardwareClipping===!1&&a>0){const u=Sc(t);ki(a,({i:h})=>{const g=u.element(h);n.assign(Xr.dot(g.xyz).negate().add(g.w)),r.assign(n.fwidth().div(2)),s.mulAssign(kc(r.negate(),r,n))})}const l=e.length;if(l>0){const u=Sc(e),h=ge(1).toVar("intersectionClipOpacity");ki(l,({i:g})=>{const v=u.element(g);n.assign(Xr.dot(v.xyz).negate().add(v.w)),r.assign(n.fwidth().div(2)),h.mulAssign(kc(r.negate(),r,n).oneMinus())}),s.mulAssign(h.oneMinus())}Ui.a.mulAssign(s),Ui.a.equal(0).discard()})()}setupDefault(e,t){return je(()=>{const n=t.length;if(this.hardwareClipping===!1&&n>0){const s=Sc(t);ki(n,({i:a})=>{const l=s.element(a);Xr.dot(l.xyz).greaterThan(l.w).discard()})}const r=e.length;if(r>0){const s=Sc(e),a=Ic(!0).toVar("clipped");ki(r,({i:l})=>{const u=s.element(l);a.assign(Xr.dot(u.xyz).greaterThan(u.w).and(a))}),a.discard()}})()}setupHardwareClipping(e,t){const n=e.length;return t.enableHardwareClipping(n),je(()=>{const r=Sc(e),s=Fee(t.getClipDistance());ki(n,({i:a})=>{const l=r.element(a),u=Xr.dot(l.xyz).sub(l.w).negate();s.element(a).assign(u)})})()}}Yo.ALPHA_TO_COVERAGE="alphaToCoverage";Yo.DEFAULT="default";Yo.HARDWARE="hardware";const kee=()=>gt(new Yo),zee=()=>gt(new Yo(Yo.ALPHA_TO_COVERAGE)),Gee=()=>gt(new Yo(Yo.HARDWARE)),qee=.05,OR=je(([i])=>Hc(Wn(1e4,Mo(Wn(17,i.x).add(Wn(.1,i.y)))).mul(Qr(.1,ur(Mo(Wn(13,i.y).add(i.x))))))),IR=je(([i])=>OR(Et(OR(i.xy),i.z))),Vee=je(([i])=>{const e=qr(Rc($M(i.xyz)),Rc(XM(i.xyz))),t=ge(1).div(ge(qee).mul(e)).toVar("pixScale"),n=Et(O0(hu(cu(t))),O0(Iy(cu(t)))),r=Et(IR(hu(n.x.mul(i.xyz))),IR(hu(n.y.mul(i.xyz)))),s=Hc(cu(t)),a=Qr(Wn(s.oneMinus(),r.x),Wn(s,r.y)),l=to(s,s.oneMinus()),u=Ne(a.mul(a).div(Wn(2,l).mul(Ti(1,l))),a.sub(Wn(.5,l)).div(Ti(1,l)),Ti(1,Ti(1,a).mul(Ti(1,a)).div(Wn(2,l).mul(Ti(1,l))))),h=a.lessThan(l.oneMinus()).select(a.lessThan(l).select(u.x,u.y),u.z);return vu(h,1e-6,1)}).setLayout({name:"getAlphaHashThreshold",type:"float",inputs:[{name:"position",type:"vec3"}]});class Vr extends ua{static get type(){return"NodeMaterial"}get type(){return this.constructor.type}set type(e){}constructor(){super(),this.isNodeMaterial=!0,this.fog=!0,this.lights=!1,this.hardwareClipping=!1,this.lightsNode=null,this.envNode=null,this.aoNode=null,this.colorNode=null,this.normalNode=null,this.opacityNode=null,this.backdropNode=null,this.backdropAlphaNode=null,this.alphaTestNode=null,this.positionNode=null,this.geometryNode=null,this.depthNode=null,this.shadowPositionNode=null,this.receivedShadowNode=null,this.castShadowNode=null,this.outputNode=null,this.mrtNode=null,this.fragmentNode=null,this.vertexNode=null}customProgramCacheKey(){return this.type+PP(this)}build(e){this.setup(e)}setupObserver(e){return new zZ(e)}setup(e){e.context.setupNormal=()=>this.setupNormal(e),e.context.setupPositionView=()=>this.setupPositionView(e),e.context.setupModelViewProjection=()=>this.setupModelViewProjection(e);const t=e.renderer,n=t.getRenderTarget();e.addStack();const r=this.vertexNode||this.setupVertex(e);e.stack.outputNode=r,this.setupHardwareClipping(e),this.geometryNode!==null&&(e.stack.outputNode=e.stack.outputNode.bypass(this.geometryNode)),e.addFlow("vertex",e.removeStack()),e.addStack();let s;const a=this.setupClipping(e);if((this.depthWrite===!0||this.depthTest===!0)&&(n!==null?n.depthBuffer===!0&&this.setupDepth(e):t.depth===!0&&this.setupDepth(e)),this.fragmentNode===null){this.setupDiffuseColor(e),this.setupVariants(e);const l=this.setupLighting(e);a!==null&&e.stack.add(a);const u=dn(l,Ui.a).max(0);if(s=this.setupOutput(e,u),Eg.assign(s),this.outputNode!==null&&(s=this.outputNode),n!==null){const h=t.getMRT(),g=this.mrtNode;h!==null?(s=h,g!==null&&(s=h.merge(g))):g!==null&&(s=g)}}else{let l=this.fragmentNode;l.isOutputStructNode!==!0&&(l=dn(l)),s=this.setupOutput(e,l)}e.stack.outputNode=s,e.addFlow("fragment",e.removeStack()),e.monitor=this.setupObserver(e)}setupClipping(e){if(e.clippingContext===null)return null;const{unionPlanes:t,intersectionPlanes:n}=e.clippingContext;let r=null;if(t.length>0||n.length>0){const s=e.renderer.samples;this.alphaToCoverage&&s>1?r=zee():e.stack.add(kee())}return r}setupHardwareClipping(e){if(this.hardwareClipping=!1,e.clippingContext===null)return;const t=e.clippingContext.unionPlanes.length;t>0&&t<=8&&e.isAvailable("clipDistance")&&(e.stack.add(Gee()),this.hardwareClipping=!0)}setupDepth(e){const{renderer:t,camera:n}=e;let r=this.depthNode;if(r===null){const s=t.getMRT();s&&s.has("depth")?r=s.get("depth"):t.logarithmicDepthBuffer===!0&&(n.isPerspectiveCamera?r=AE(Xr.z,Dh,Ph):r=s0(Xr.z,Dh,Ph))}r!==null&&dE.assign(r).append()}setupPositionView(){return Q0.mul(Gr).xyz}setupModelViewProjection(){return _A.mul(Xr)}setupVertex(e){return e.addStack(),this.setupPosition(e),e.context.vertex=e.removeStack(),lE}setupPosition(e){const{object:t,geometry:n}=e;if((n.morphAttributes.position||n.morphAttributes.normal||n.morphAttributes.color)&&wU(t).append(),t.isSkinnedMesh===!0&&SU(t).append(),this.displacementMap){const r=Tc("displacementMap","texture"),s=Tc("displacementScale","float"),a=Tc("displacementBias","float");Gr.addAssign(no.normalize().mul(r.x.mul(s).add(a)))}return t.isBatchedMesh&&xU(t).append(),t.isInstancedMesh&&t.instanceMatrix&&t.instanceMatrix.isInstancedBufferAttribute===!0&&yU(t).append(),this.positionNode!==null&&Gr.assign(this.positionNode.context({isPositionNodeInput:!0})),Gr}setupDiffuseColor({object:e,geometry:t}){let n=this.colorNode?dn(this.colorNode):q9;this.vertexColors===!0&&t.hasAttribute("color")&&(n=dn(n.xyz.mul(_u("color","vec3")),n.a)),e.instanceColor&&(n=Sg("vec3","vInstanceColor").mul(n)),e.isBatchedMesh&&e._colorsTexture&&(n=Sg("vec3","vBatchColor").mul(n)),Ui.assign(n);const r=this.opacityNode?ge(this.opacityNode):aE;if(Ui.a.assign(Ui.a.mul(r)),this.alphaTestNode!==null||this.alphaTest>0){const s=this.alphaTestNode!==null?ge(this.alphaTestNode):G9;Ui.a.lessThanEqual(s).discard()}this.alphaHash===!0&&Ui.a.lessThan(Vee(Gr)).discard(),this.transparent===!1&&this.blending===Ka&&this.alphaToCoverage===!1&&Ui.a.assign(1)}setupVariants(){}setupOutgoingLight(){return this.lights===!0?Ne(0):Ui.rgb}setupNormal(){return this.normalNode?Ne(this.normalNode):Y9}setupEnvironment(){let e=null;return this.envNode?e=this.envNode:this.envMap&&(e=this.envMap.isCubeTexture?Tc("envMap","cubeTexture"):Tc("envMap","texture")),e}setupLightMap(e){let t=null;return e.material.lightMap&&(t=new Eee(oE)),t}setupLights(e){const t=[],n=this.setupEnvironment(e);n&&n.isLightingNode&&t.push(n);const r=this.setupLightMap(e);if(r&&r.isLightingNode&&t.push(r),this.aoNode!==null||e.material.aoMap){const a=this.aoNode!==null?this.aoNode:mU;t.push(new wee(a))}let s=this.lightsNode||e.lightsNode;return t.length>0&&(s=e.renderer.lighting.createNode([...s.getLights(),...t])),s}setupLightingModel(){}setupLighting(e){const{material:t}=e,{backdropNode:n,backdropAlphaNode:r,emissiveNode:s}=this,l=this.lights===!0||this.lightsNode!==null?this.setupLights(e):null;let u=this.setupOutgoingLight(e);if(l&&l.getScope().hasLights){const h=this.setupLightingModel(e);u=MU(l,h,n,r)}else n!==null&&(u=Ne(r!==null?Fi(u,n,r):n));return(s&&s.isNode===!0||t.emissive&&t.emissive.isColor===!0)&&(GT.assign(Ne(s||H9)),u=u.add(GT)),u}setupOutput(e,t){if(this.fog===!0){const n=e.fogNode;n&&(Eg.assign(t),t=dn(n))}return t}setDefaultValues(e){for(const n in e){const r=e[n];this[n]===void 0&&(this[n]=r,r&&r.clone&&(this[n]=r.clone()))}const t=Object.getOwnPropertyDescriptors(e.constructor.prototype);for(const n in t)Object.getOwnPropertyDescriptor(this.constructor.prototype,n)===void 0&&t[n].get!==void 0&&Object.defineProperty(this.constructor.prototype,n,t[n])}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{},nodes:{}});const n=ua.prototype.toJSON.call(this,e),r=$_(this);n.inputNodes={};for(const{property:a,childNode:l}of r)n.inputNodes[a]=l.toJSON(e).uuid;function s(a){const l=[];for(const u in a){const h=a[u];delete h.metadata,l.push(h)}return l}if(t){const a=s(e.textures),l=s(e.images),u=s(e.nodes);a.length>0&&(n.textures=a),l.length>0&&(n.images=l),u.length>0&&(n.nodes=u)}return n}copy(e){return this.lightsNode=e.lightsNode,this.envNode=e.envNode,this.colorNode=e.colorNode,this.normalNode=e.normalNode,this.opacityNode=e.opacityNode,this.backdropNode=e.backdropNode,this.backdropAlphaNode=e.backdropAlphaNode,this.alphaTestNode=e.alphaTestNode,this.positionNode=e.positionNode,this.geometryNode=e.geometryNode,this.depthNode=e.depthNode,this.shadowPositionNode=e.shadowPositionNode,this.receivedShadowNode=e.receivedShadowNode,this.castShadowNode=e.castShadowNode,this.outputNode=e.outputNode,this.mrtNode=e.mrtNode,this.fragmentNode=e.fragmentNode,this.vertexNode=e.vertexNode,super.copy(e)}}const Hee=new $0;class jee extends Vr{static get type(){return"LineBasicNodeMaterial"}constructor(e){super(),this.isLineBasicNodeMaterial=!0,this.setDefaultValues(Hee),this.setValues(e)}}const Wee=new Uz;class $ee extends Vr{static get type(){return"LineDashedNodeMaterial"}constructor(e){super(),this.isLineDashedNodeMaterial=!0,this.setDefaultValues(Wee),this.dashOffset=0,this.offsetNode=null,this.dashScaleNode=null,this.dashSizeNode=null,this.gapSizeNode=null,this.setValues(e)}setupVariants(){const e=this.offsetNode?ge(this.offsetNode):dU,t=this.dashScaleNode?ge(this.dashScaleNode):hU,n=this.dashSizeNode?ge(this.dashSizeNode):fU,r=this.gapSizeNode?ge(this.gapSizeNode):AU;Qv.assign(n),qT.assign(r);const s=ro(_u("lineDistance").mul(t));(e?s.add(e):s).mod(Qv.add(qT)).greaterThan(Qv).discard()}}let Y3=null;class Xee extends $y{static get type(){return"ViewportSharedTextureNode"}constructor(e=bu,t=null){Y3===null&&(Y3=new j7),super(e,t,Y3)}updateReference(){return this}}const Yee=ht(Xee),DU=i=>gt(i).mul(.5).add(.5),Qee=i=>gt(i).mul(2).sub(1),Kee=new Nz;class Zee extends Vr{static get type(){return"MeshNormalNodeMaterial"}constructor(e){super(),this.isMeshNormalNodeMaterial=!0,this.setDefaultValues(Kee),this.setValues(e)}setupDiffuseColor(){const e=this.opacityNode?ge(this.opacityNode):aE;Ui.assign(dn(DU(zr),e))}}class Jee extends Zr{static get type(){return"EquirectUVNode"}constructor(e=nE){super("vec2"),this.dirNode=e}setup(){const e=this.dirNode,t=e.z.atan(e.x).mul(1/(Math.PI*2)).add(.5),n=e.y.clamp(-1,1).asin().mul(1/Math.PI).add(.5);return Et(t,n)}}const pE=ht(Jee);class PU extends V7{constructor(e=1,t={}){super(e,t),this.isCubeRenderTarget=!0}fromEquirectangularTexture(e,t){const n=t.minFilter,r=t.generateMipmaps;t.generateMipmaps=!0,this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;const s=new $h(5,5,5),a=pE(nE),l=new Vr;l.colorNode=Ai(t,a,0),l.side=hr,l.blending=Qa;const u=new zi(s,l),h=new Xw;h.add(u),t.minFilter===Va&&(t.minFilter=gs);const g=new q7(1,10,this),v=e.getMRT();return e.setMRT(null),g.update(e,h),e.setMRT(v),t.minFilter=n,t.currentGenerateMipmaps=r,u.geometry.dispose(),u.material.dispose(),this}}const km=new WeakMap;class ete extends Zr{static get type(){return"CubeMapNode"}constructor(e){super("vec3"),this.envNode=e,this._cubeTexture=null,this._cubeTextureNode=I0();const t=new yy;t.isRenderTargetTexture=!0,this._defaultTexture=t,this.updateBeforeType=jn.RENDER}updateBefore(e){const{renderer:t,material:n}=e,r=this.envNode;if(r.isTextureNode||r.isMaterialReferenceNode){const s=r.isTextureNode?r.value:n[r.property];if(s&&s.isTexture){const a=s.mapping;if(a===zh||a===Gh){if(km.has(s)){const l=km.get(s);FR(l,s.mapping),this._cubeTexture=l}else{const l=s.image;if(tte(l)){const u=new PU(l.height);u.fromEquirectangularTexture(t,s),FR(u.texture,s.mapping),this._cubeTexture=u.texture,km.set(s,u.texture),s.addEventListener("dispose",LU)}else this._cubeTexture=this._defaultTexture}this._cubeTextureNode.value=this._cubeTexture}else this._cubeTextureNode=this.envNode}}}setup(e){return this.updateBefore(e),this._cubeTextureNode}}function tte(i){return i==null?!1:i.height>0}function LU(i){const e=i.target;e.removeEventListener("dispose",LU);const t=km.get(e);t!==void 0&&(km.delete(e),t.dispose())}function FR(i,e){e===zh?i.mapping=Qo:e===Gh&&(i.mapping=Ko)}const UU=ht(ete);class mE extends K0{static get type(){return"BasicEnvironmentNode"}constructor(e=null){super(),this.envNode=e}setup(e){e.context.environment=UU(this.envNode)}}class nte extends K0{static get type(){return"BasicLightMapNode"}constructor(e=null){super(),this.lightMapNode=e}setup(e){const t=ge(1/Math.PI);e.context.irradianceLightMap=this.lightMapNode.mul(t)}}class Xy{start(){}finish(){}direct(){}directRectArea(){}indirect(){}ambientOcclusion(){}}class BU extends Xy{constructor(){super()}indirect(e,t,n){const r=e.ambientOcclusion,s=e.reflectedLight,a=n.context.irradianceLightMap;s.indirectDiffuse.assign(dn(0)),a?s.indirectDiffuse.addAssign(a):s.indirectDiffuse.addAssign(dn(1,1,1,0)),s.indirectDiffuse.mulAssign(r),s.indirectDiffuse.mulAssign(Ui.rgb)}finish(e,t,n){const r=n.material,s=e.outgoingLight,a=n.context.environment;if(a)switch(r.combine){case Lg:s.rgb.assign(Fi(s.rgb,s.rgb.mul(a.rgb),Fm.mul(Jv)));break;case E7:s.rgb.assign(Fi(s.rgb,a.rgb,Fm.mul(Jv)));break;case C7:s.rgb.addAssign(a.rgb.mul(Fm.mul(Jv)));break;default:console.warn("THREE.BasicLightingModel: Unsupported .combine value:",r.combine);break}}}const ite=new pA;class rte extends Vr{static get type(){return"MeshBasicNodeMaterial"}constructor(e){super(),this.isMeshBasicNodeMaterial=!0,this.lights=!0,this.setDefaultValues(ite),this.setValues(e)}setupNormal(){return Jo}setupEnvironment(e){const t=super.setupEnvironment(e);return t?new mE(t):null}setupLightMap(e){let t=null;return e.material.lightMap&&(t=new nte(oE)),t}setupOutgoingLight(){return Ui.rgb}setupLightingModel(){return new BU}}const F0=je(({f0:i,f90:e,dotVH:t})=>{const n=t.mul(-5.55473).sub(6.98316).mul(t).exp2();return i.mul(n.oneMinus()).add(e.mul(n))}),AA=je(i=>i.diffuseColor.mul(1/Math.PI)),ste=()=>ge(.25),ate=je(({dotNH:i})=>Q_.mul(ge(.5)).add(1).mul(ge(1/Math.PI)).mul(i.pow(Q_))),ote=je(({lightDirection:i})=>{const e=i.add(dr).normalize(),t=zr.dot(e).clamp(),n=dr.dot(e).clamp(),r=F0({f0:ka,f90:1,dotVH:n}),s=ste(),a=ate({dotNH:t});return r.mul(s).mul(a)});class OU extends BU{constructor(e=!0){super(),this.specular=e}direct({lightDirection:e,lightColor:t,reflectedLight:n}){const s=zr.dot(e).clamp().mul(t);n.directDiffuse.addAssign(s.mul(AA({diffuseColor:Ui.rgb}))),this.specular===!0&&n.directSpecular.addAssign(s.mul(ote({lightDirection:e})).mul(Fm))}indirect({ambientOcclusion:e,irradiance:t,reflectedLight:n}){n.indirectDiffuse.addAssign(t.mul(AA({diffuseColor:Ui}))),n.indirectDiffuse.mulAssign(e)}}const lte=new Vc;class ute extends Vr{static get type(){return"MeshLambertNodeMaterial"}constructor(e){super(),this.isMeshLambertNodeMaterial=!0,this.lights=!0,this.setDefaultValues(lte),this.setValues(e)}setupEnvironment(e){const t=super.setupEnvironment(e);return t?new mE(t):null}setupLightingModel(){return new OU(!1)}}const cte=new nD;class hte extends Vr{static get type(){return"MeshPhongNodeMaterial"}constructor(e){super(),this.isMeshPhongNodeMaterial=!0,this.lights=!0,this.shininessNode=null,this.specularNode=null,this.setDefaultValues(cte),this.setValues(e)}setupEnvironment(e){const t=super.setupEnvironment(e);return t?new mE(t):null}setupLightingModel(){return new OU}setupVariants(){const e=(this.shininessNode?ge(this.shininessNode):V9).max(1e-4);Q_.assign(e);const t=this.specularNode||j9;ka.assign(t)}copy(e){return this.shininessNode=e.shininessNode,this.specularNode=e.specularNode,super.copy(e)}}const IU=je(i=>{if(i.geometry.hasAttribute("normal")===!1)return ge(0);const e=Jo.dFdx().abs().max(Jo.dFdy().abs());return e.x.max(e.y).max(e.z)}),gE=je(i=>{const{roughness:e}=i,t=IU();let n=e.max(.0525);return n=n.add(t),n=n.min(1),n}),FU=je(({alpha:i,dotNL:e,dotNV:t})=>{const n=i.pow2(),r=e.mul(n.add(n.oneMinus().mul(t.pow2())).sqrt()),s=t.mul(n.add(n.oneMinus().mul(e.pow2())).sqrt());return Dl(.5,r.add(s).max(TL))}).setLayout({name:"V_GGX_SmithCorrelated",type:"float",inputs:[{name:"alpha",type:"float"},{name:"dotNL",type:"float"},{name:"dotNV",type:"float"}]}),fte=je(({alphaT:i,alphaB:e,dotTV:t,dotBV:n,dotTL:r,dotBL:s,dotNV:a,dotNL:l})=>{const u=l.mul(Ne(i.mul(t),e.mul(n),a).length()),h=a.mul(Ne(i.mul(r),e.mul(s),l).length());return Dl(.5,u.add(h)).saturate()}).setLayout({name:"V_GGX_SmithCorrelated_Anisotropic",type:"float",inputs:[{name:"alphaT",type:"float",qualifier:"in"},{name:"alphaB",type:"float",qualifier:"in"},{name:"dotTV",type:"float",qualifier:"in"},{name:"dotBV",type:"float",qualifier:"in"},{name:"dotTL",type:"float",qualifier:"in"},{name:"dotBL",type:"float",qualifier:"in"},{name:"dotNV",type:"float",qualifier:"in"},{name:"dotNL",type:"float",qualifier:"in"}]}),kU=je(({alpha:i,dotNH:e})=>{const t=i.pow2(),n=e.pow2().mul(t.oneMinus()).oneMinus();return t.div(n.pow2()).mul(1/Math.PI)}).setLayout({name:"D_GGX",type:"float",inputs:[{name:"alpha",type:"float"},{name:"dotNH",type:"float"}]}),Ate=ge(1/Math.PI),dte=je(({alphaT:i,alphaB:e,dotNH:t,dotTH:n,dotBH:r})=>{const s=i.mul(e),a=Ne(e.mul(n),i.mul(r),s.mul(t)),l=a.dot(a),u=s.div(l);return Ate.mul(s.mul(u.pow2()))}).setLayout({name:"D_GGX_Anisotropic",type:"float",inputs:[{name:"alphaT",type:"float",qualifier:"in"},{name:"alphaB",type:"float",qualifier:"in"},{name:"dotNH",type:"float",qualifier:"in"},{name:"dotTH",type:"float",qualifier:"in"},{name:"dotBH",type:"float",qualifier:"in"}]}),$T=je(i=>{const{lightDirection:e,f0:t,f90:n,roughness:r,f:s,USE_IRIDESCENCE:a,USE_ANISOTROPY:l}=i,u=i.normalView||zr,h=r.pow2(),g=e.add(dr).normalize(),v=u.dot(e).clamp(),x=u.dot(dr).clamp(),S=u.dot(g).clamp(),w=dr.dot(g).clamp();let R=F0({f0:t,f90:n,dotVH:w}),C,E;if(xg(a)&&(R=By.mix(R,s)),xg(l)){const B=Bm.dot(e),L=Bm.dot(dr),O=Bm.dot(g),z=iA.dot(e),G=iA.dot(dr),k=iA.dot(g);C=fte({alphaT:Y_,alphaB:h,dotTV:L,dotBV:G,dotTL:B,dotBL:z,dotNV:x,dotNL:v}),E=dte({alphaT:Y_,alphaB:h,dotNH:S,dotTH:O,dotBH:k})}else C=FU({alpha:h,dotNL:v,dotNV:x}),E=kU({alpha:h,dotNH:S});return R.mul(C).mul(E)}),vE=je(({roughness:i,dotNV:e})=>{const t=dn(-1,-.0275,-.572,.022),n=dn(1,.0425,1.04,-.04),r=i.mul(t).add(n),s=r.x.mul(r.x).min(e.mul(-9.28).exp2()).mul(r.x).add(r.y);return Et(-1.04,1.04).mul(s).add(r.zw)}).setLayout({name:"DFGApprox",type:"vec2",inputs:[{name:"roughness",type:"float"},{name:"dotNV",type:"vec3"}]}),zU=je(i=>{const{dotNV:e,specularColor:t,specularF90:n,roughness:r}=i,s=vE({dotNV:e,roughness:r});return t.mul(s.x).add(n.mul(s.y))}),GU=je(({f:i,f90:e,dotVH:t})=>{const n=t.oneMinus().saturate(),r=n.mul(n),s=n.mul(r,r).clamp(0,.9999);return i.sub(Ne(e).mul(s)).div(s.oneMinus())}).setLayout({name:"Schlick_to_F0",type:"vec3",inputs:[{name:"f",type:"vec3"},{name:"f90",type:"float"},{name:"dotVH",type:"float"}]}),pte=je(({roughness:i,dotNH:e})=>{const t=i.pow2(),n=ge(1).div(t),s=e.pow2().oneMinus().max(.0078125);return ge(2).add(n).mul(s.pow(n.mul(.5))).div(2*Math.PI)}).setLayout({name:"D_Charlie",type:"float",inputs:[{name:"roughness",type:"float"},{name:"dotNH",type:"float"}]}),mte=je(({dotNV:i,dotNL:e})=>ge(1).div(ge(4).mul(e.add(i).sub(e.mul(i))))).setLayout({name:"V_Neubelt",type:"float",inputs:[{name:"dotNV",type:"float"},{name:"dotNL",type:"float"}]}),gte=je(({lightDirection:i})=>{const e=i.add(dr).normalize(),t=zr.dot(i).clamp(),n=zr.dot(dr).clamp(),r=zr.dot(e).clamp(),s=pte({roughness:Uy,dotNH:r}),a=mte({dotNV:n,dotNL:t});return Xf.mul(s).mul(a)}),vte=je(({N:i,V:e,roughness:t})=>{const s=.0078125,a=i.dot(e).saturate(),l=Et(t,a.oneMinus().sqrt());return l.assign(l.mul(.984375).add(s)),l}).setLayout({name:"LTC_Uv",type:"vec2",inputs:[{name:"N",type:"vec3"},{name:"V",type:"vec3"},{name:"roughness",type:"float"}]}),_te=je(({f:i})=>{const e=i.length();return qr(e.mul(e).add(i.z).div(e.add(1)),0)}).setLayout({name:"LTC_ClippedSphereFormFactor",type:"float",inputs:[{name:"f",type:"vec3"}]}),lv=je(({v1:i,v2:e})=>{const t=i.dot(e),n=t.abs().toVar(),r=n.mul(.0145206).add(.4965155).mul(n).add(.8543985).toVar(),s=n.add(4.1616724).mul(n).add(3.417594).toVar(),a=r.div(s),l=t.greaterThan(0).select(a,qr(t.mul(t).oneMinus(),1e-7).inverseSqrt().mul(.5).sub(a));return i.cross(e).mul(l)}).setLayout({name:"LTC_EdgeVectorFormFactor",type:"vec3",inputs:[{name:"v1",type:"vec3"},{name:"v2",type:"vec3"}]}),kR=je(({N:i,V:e,P:t,mInv:n,p0:r,p1:s,p2:a,p3:l})=>{const u=s.sub(r).toVar(),h=l.sub(r).toVar(),g=u.cross(h),v=Ne().toVar();return ti(g.dot(t.sub(r)).greaterThanEqual(0),()=>{const x=e.sub(i.mul(e.dot(i))).normalize(),S=i.cross(x).negate(),w=n.mul(ha(x,S,i).transpose()).toVar(),R=w.mul(r.sub(t)).normalize().toVar(),C=w.mul(s.sub(t)).normalize().toVar(),E=w.mul(a.sub(t)).normalize().toVar(),B=w.mul(l.sub(t)).normalize().toVar(),L=Ne(0).toVar();L.addAssign(lv({v1:R,v2:C})),L.addAssign(lv({v1:C,v2:E})),L.addAssign(lv({v1:E,v2:B})),L.addAssign(lv({v1:B,v2:R})),v.assign(Ne(_te({f:L})))}),v}).setLayout({name:"LTC_Evaluate",type:"vec3",inputs:[{name:"N",type:"vec3"},{name:"V",type:"vec3"},{name:"P",type:"vec3"},{name:"mInv",type:"mat3"},{name:"p0",type:"vec3"},{name:"p1",type:"vec3"},{name:"p2",type:"vec3"},{name:"p3",type:"vec3"}]}),Yy=1/6,qU=i=>Wn(Yy,Wn(i,Wn(i,i.negate().add(3)).sub(3)).add(1)),XT=i=>Wn(Yy,Wn(i,Wn(i,Wn(3,i).sub(6))).add(4)),VU=i=>Wn(Yy,Wn(i,Wn(i,Wn(-3,i).add(3)).add(3)).add(1)),YT=i=>Wn(Yy,Cl(i,3)),zR=i=>qU(i).add(XT(i)),GR=i=>VU(i).add(YT(i)),qR=i=>Qr(-1,XT(i).div(qU(i).add(XT(i)))),VR=i=>Qr(1,YT(i).div(VU(i).add(YT(i)))),HR=(i,e,t)=>{const n=i.uvNode,r=Wn(n,e.zw).add(.5),s=hu(r),a=Hc(r),l=zR(a.x),u=GR(a.x),h=qR(a.x),g=VR(a.x),v=qR(a.y),x=VR(a.y),S=Et(s.x.add(h),s.y.add(v)).sub(.5).mul(e.xy),w=Et(s.x.add(g),s.y.add(v)).sub(.5).mul(e.xy),R=Et(s.x.add(h),s.y.add(x)).sub(.5).mul(e.xy),C=Et(s.x.add(g),s.y.add(x)).sub(.5).mul(e.xy),E=zR(a.y).mul(Qr(l.mul(i.sample(S).level(t)),u.mul(i.sample(w).level(t)))),B=GR(a.y).mul(Qr(l.mul(i.sample(R).level(t)),u.mul(i.sample(C).level(t))));return E.add(B)},HU=je(([i,e=ge(3)])=>{const t=Et(i.size(ye(e))),n=Et(i.size(ye(e.add(1)))),r=Dl(1,t),s=Dl(1,n),a=HR(i,dn(r,t),hu(e)),l=HR(i,dn(s,n),Iy(e));return Hc(e).mix(a,l)}),jR=je(([i,e,t,n,r])=>{const s=Ne(ZM(e.negate(),Fc(i),Dl(1,n))),a=Ne(Rc(r[0].xyz),Rc(r[1].xyz),Rc(r[2].xyz));return Fc(s).mul(t.mul(a))}).setLayout({name:"getVolumeTransmissionRay",type:"vec3",inputs:[{name:"n",type:"vec3"},{name:"v",type:"vec3"},{name:"thickness",type:"float"},{name:"ior",type:"float"},{name:"modelMatrix",type:"mat4"}]}),yte=je(([i,e])=>i.mul(vu(e.mul(2).sub(2),0,1))).setLayout({name:"applyIorToRoughness",type:"float",inputs:[{name:"roughness",type:"float"},{name:"ior",type:"float"}]}),xte=cE(),bte=cE(),WR=je(([i,e,t],{material:n})=>{const s=(n.side===hr?xte:bte).sample(i),a=cu(Rg.x).mul(yte(e,t));return HU(s,a)}),$R=je(([i,e,t])=>(ti(t.notEqual(0),()=>{const n=Oy(e).negate().div(t);return HM(n.negate().mul(i))}),Ne(1))).setLayout({name:"volumeAttenuation",type:"vec3",inputs:[{name:"transmissionDistance",type:"float"},{name:"attenuationColor",type:"vec3"},{name:"attenuationDistance",type:"float"}]}),Ste=je(([i,e,t,n,r,s,a,l,u,h,g,v,x,S,w])=>{let R,C;if(w){R=dn().toVar(),C=Ne().toVar();const z=g.sub(1).mul(w.mul(.025)),G=Ne(g.sub(z),g,g.add(z));ki({start:0,end:3},({i:k})=>{const H=G.element(k),F=jR(i,e,v,H,l),V=a.add(F),X=h.mul(u.mul(dn(V,1))),J=Et(X.xy.div(X.w)).toVar();J.addAssign(1),J.divAssign(2),J.assign(Et(J.x,J.y.oneMinus()));const te=WR(J,t,H);R.element(k).assign(te.element(k)),R.a.addAssign(te.a),C.element(k).assign(n.element(k).mul($R(Rc(F),x,S).element(k)))}),R.a.divAssign(3)}else{const z=jR(i,e,v,g,l),G=a.add(z),k=h.mul(u.mul(dn(G,1))),H=Et(k.xy.div(k.w)).toVar();H.addAssign(1),H.divAssign(2),H.assign(Et(H.x,H.y.oneMinus())),R=WR(H,t,g),C=n.mul($R(Rc(z),x,S))}const E=C.rgb.mul(R.rgb),B=i.dot(e).clamp(),L=Ne(zU({dotNV:B,specularColor:r,specularF90:s,roughness:t})),O=C.r.add(C.g,C.b).div(3);return dn(L.oneMinus().mul(E),R.a.oneMinus().mul(O).oneMinus())}),Tte=ha(3.2404542,-.969266,.0556434,-1.5371385,1.8760108,-.2040259,-.4985314,.041556,1.0572252),wte=i=>{const e=i.sqrt();return Ne(1).add(e).div(Ne(1).sub(e))},XR=(i,e)=>i.sub(e).div(i.add(e)).pow2(),Mte=(i,e)=>{const t=i.mul(2*Math.PI*1e-9),n=Ne(54856e-17,44201e-17,52481e-17),r=Ne(1681e3,1795300,2208400),s=Ne(43278e5,93046e5,66121e5),a=ge(9747e-17*Math.sqrt(2*Math.PI*45282e5)).mul(t.mul(2239900).add(e.x).cos()).mul(t.pow2().mul(-45282e5).exp());let l=n.mul(s.mul(2*Math.PI).sqrt()).mul(r.mul(t).add(e).cos()).mul(t.pow2().negate().mul(s).exp());return l=Ne(l.x.add(a),l.y,l.z).div(10685e-11),Tte.mul(l)},Ete=je(({outsideIOR:i,eta2:e,cosTheta1:t,thinFilmThickness:n,baseF0:r})=>{const s=Fi(i,e,kc(0,.03,n)),l=i.div(s).pow2().mul(t.pow2().oneMinus()).oneMinus();ti(l.lessThan(0),()=>Ne(1));const u=l.sqrt(),h=XR(s,i),g=F0({f0:h,f90:1,dotVH:t}),v=g.oneMinus(),x=s.lessThan(i).select(Math.PI,0),S=ge(Math.PI).sub(x),w=wte(r.clamp(0,.9999)),R=XR(w,s.toVec3()),C=F0({f0:R,f90:1,dotVH:u}),E=Ne(w.x.lessThan(s).select(Math.PI,0),w.y.lessThan(s).select(Math.PI,0),w.z.lessThan(s).select(Math.PI,0)),B=s.mul(n,u,2),L=Ne(S).add(E),O=g.mul(C).clamp(1e-5,.9999),z=O.sqrt(),G=v.pow2().mul(C).div(Ne(1).sub(O)),H=g.add(G).toVar(),F=G.sub(v).toVar();return ki({start:1,end:2,condition:"<=",name:"m"},({m:V})=>{F.mulAssign(z);const X=Mte(ge(V).mul(B),ge(V).mul(L)).mul(2);H.addAssign(F.mul(X))}),H.max(Ne(0))}).setLayout({name:"evalIridescence",type:"vec3",inputs:[{name:"outsideIOR",type:"float"},{name:"eta2",type:"float"},{name:"cosTheta1",type:"float"},{name:"thinFilmThickness",type:"float"},{name:"baseF0",type:"vec3"}]}),Cte=je(({normal:i,viewDir:e,roughness:t})=>{const n=i.dot(e).saturate(),r=t.pow2(),s=zs(t.lessThan(.25),ge(-339.2).mul(r).add(ge(161.4).mul(t)).sub(25.9),ge(-8.48).mul(r).add(ge(14.3).mul(t)).sub(9.95)),a=zs(t.lessThan(.25),ge(44).mul(r).sub(ge(23.7).mul(t)).add(3.26),ge(1.97).mul(r).sub(ge(3.27).mul(t)).add(.72));return zs(t.lessThan(.25),0,ge(.1).mul(t).sub(.025)).add(s.mul(n).add(a).exp()).mul(1/Math.PI).saturate()}),Q3=Ne(.04),K3=ge(1);class jU extends Xy{constructor(e=!1,t=!1,n=!1,r=!1,s=!1,a=!1){super(),this.clearcoat=e,this.sheen=t,this.iridescence=n,this.anisotropy=r,this.transmission=s,this.dispersion=a,this.clearcoatRadiance=null,this.clearcoatSpecularDirect=null,this.clearcoatSpecularIndirect=null,this.sheenSpecularDirect=null,this.sheenSpecularIndirect=null,this.iridescenceFresnel=null,this.iridescenceF0=null}start(e){if(this.clearcoat===!0&&(this.clearcoatRadiance=Ne().toVar("clearcoatRadiance"),this.clearcoatSpecularDirect=Ne().toVar("clearcoatSpecularDirect"),this.clearcoatSpecularIndirect=Ne().toVar("clearcoatSpecularIndirect")),this.sheen===!0&&(this.sheenSpecularDirect=Ne().toVar("sheenSpecularDirect"),this.sheenSpecularIndirect=Ne().toVar("sheenSpecularIndirect")),this.iridescence===!0){const t=zr.dot(dr).clamp();this.iridescenceFresnel=Ete({outsideIOR:ge(1),eta2:BM,cosTheta1:t,thinFilmThickness:OM,baseF0:ka}),this.iridescenceF0=GU({f:this.iridescenceFresnel,f90:1,dotVH:t})}if(this.transmission===!0){const t=Nc,n=b9.sub(Nc).normalize(),r=Hy;e.backdrop=Ste(r,n,Zl,Ui,ka,Mg,t,$o,so,_A,Om,IM,kM,FM,this.dispersion?zM:null),e.backdropAlpha=K_,Ui.a.mulAssign(Fi(1,e.backdrop.a,K_))}}computeMultiscattering(e,t,n){const r=zr.dot(dr).clamp(),s=vE({roughness:Zl,dotNV:r}),l=(this.iridescenceF0?By.mix(ka,this.iridescenceF0):ka).mul(s.x).add(n.mul(s.y)),h=s.x.add(s.y).oneMinus(),g=ka.add(ka.oneMinus().mul(.047619)),v=l.mul(g).div(h.mul(g).oneMinus());e.addAssign(l),t.addAssign(v.mul(h))}direct({lightDirection:e,lightColor:t,reflectedLight:n}){const s=zr.dot(e).clamp().mul(t);if(this.sheen===!0&&this.sheenSpecularDirect.addAssign(s.mul(gte({lightDirection:e}))),this.clearcoat===!0){const l=Qd.dot(e).clamp().mul(t);this.clearcoatSpecularDirect.addAssign(l.mul($T({lightDirection:e,f0:Q3,f90:K3,roughness:wg,normalView:Qd})))}n.directDiffuse.addAssign(s.mul(AA({diffuseColor:Ui.rgb}))),n.directSpecular.addAssign(s.mul($T({lightDirection:e,f0:ka,f90:1,roughness:Zl,iridescence:this.iridescence,f:this.iridescenceFresnel,USE_IRIDESCENCE:this.iridescence,USE_ANISOTROPY:this.anisotropy})))}directRectArea({lightColor:e,lightPosition:t,halfWidth:n,halfHeight:r,reflectedLight:s,ltc_1:a,ltc_2:l}){const u=t.add(n).sub(r),h=t.sub(n).sub(r),g=t.sub(n).add(r),v=t.add(n).add(r),x=zr,S=dr,w=Xr.toVar(),R=vte({N:x,V:S,roughness:Zl}),C=a.sample(R).toVar(),E=l.sample(R).toVar(),B=ha(Ne(C.x,0,C.y),Ne(0,1,0),Ne(C.z,0,C.w)).toVar(),L=ka.mul(E.x).add(ka.oneMinus().mul(E.y)).toVar();s.directSpecular.addAssign(e.mul(L).mul(kR({N:x,V:S,P:w,mInv:B,p0:u,p1:h,p2:g,p3:v}))),s.directDiffuse.addAssign(e.mul(Ui).mul(kR({N:x,V:S,P:w,mInv:ha(1,0,0,0,1,0,0,0,1),p0:u,p1:h,p2:g,p3:v})))}indirect(e,t,n){this.indirectDiffuse(e,t,n),this.indirectSpecular(e,t,n),this.ambientOcclusion(e,t,n)}indirectDiffuse({irradiance:e,reflectedLight:t}){t.indirectDiffuse.addAssign(e.mul(AA({diffuseColor:Ui})))}indirectSpecular({radiance:e,iblIrradiance:t,reflectedLight:n}){if(this.sheen===!0&&this.sheenSpecularIndirect.addAssign(t.mul(Xf,Cte({normal:zr,viewDir:dr,roughness:Uy}))),this.clearcoat===!0){const h=Qd.dot(dr).clamp(),g=zU({dotNV:h,specularColor:Q3,specularF90:K3,roughness:wg});this.clearcoatSpecularIndirect.addAssign(this.clearcoatRadiance.mul(g))}const r=Ne().toVar("singleScattering"),s=Ne().toVar("multiScattering"),a=t.mul(1/Math.PI);this.computeMultiscattering(r,s,Mg);const l=r.add(s),u=Ui.mul(l.r.max(l.g).max(l.b).oneMinus());n.indirectSpecular.addAssign(e.mul(r)),n.indirectSpecular.addAssign(s.mul(a)),n.indirectDiffuse.addAssign(u.mul(a))}ambientOcclusion({ambientOcclusion:e,reflectedLight:t}){const r=zr.dot(dr).clamp().add(e),s=Zl.mul(-16).oneMinus().negate().exp2(),a=e.sub(r.pow(s).oneMinus()).clamp();this.clearcoat===!0&&this.clearcoatSpecularIndirect.mulAssign(e),this.sheen===!0&&this.sheenSpecularIndirect.mulAssign(e),t.indirectDiffuse.mulAssign(e),t.indirectSpecular.mulAssign(a)}finish(e){const{outgoingLight:t}=e;if(this.clearcoat===!0){const n=Qd.dot(dr).clamp(),r=F0({dotVH:n,f0:Q3,f90:K3}),s=t.mul(X_.mul(r).oneMinus()).add(this.clearcoatSpecularDirect.add(this.clearcoatSpecularIndirect).mul(X_));t.assign(s)}if(this.sheen===!0){const n=Xf.r.max(Xf.g).max(Xf.b).mul(.157).oneMinus(),r=t.mul(n).add(this.sheenSpecularDirect,this.sheenSpecularIndirect);t.assign(r)}}}const YR=ge(1),QT=ge(-2),uv=ge(.8),Z3=ge(-1),cv=ge(.4),J3=ge(2),hv=ge(.305),eS=ge(3),QR=ge(.21),Rte=ge(4),KR=ge(4),Nte=ge(16),Dte=je(([i])=>{const e=Ne(ur(i)).toVar(),t=ge(-1).toVar();return ti(e.x.greaterThan(e.z),()=>{ti(e.x.greaterThan(e.y),()=>{t.assign(zs(i.x.greaterThan(0),0,3))}).Else(()=>{t.assign(zs(i.y.greaterThan(0),1,4))})}).Else(()=>{ti(e.z.greaterThan(e.y),()=>{t.assign(zs(i.z.greaterThan(0),2,5))}).Else(()=>{t.assign(zs(i.y.greaterThan(0),1,4))})}),t}).setLayout({name:"getFace",type:"float",inputs:[{name:"direction",type:"vec3"}]}),Pte=je(([i,e])=>{const t=Et().toVar();return ti(e.equal(0),()=>{t.assign(Et(i.z,i.y).div(ur(i.x)))}).ElseIf(e.equal(1),()=>{t.assign(Et(i.x.negate(),i.z.negate()).div(ur(i.y)))}).ElseIf(e.equal(2),()=>{t.assign(Et(i.x.negate(),i.y).div(ur(i.z)))}).ElseIf(e.equal(3),()=>{t.assign(Et(i.z.negate(),i.y).div(ur(i.x)))}).ElseIf(e.equal(4),()=>{t.assign(Et(i.x.negate(),i.z).div(ur(i.y)))}).Else(()=>{t.assign(Et(i.x,i.y).div(ur(i.z)))}),Wn(.5,t.add(1))}).setLayout({name:"getUV",type:"vec2",inputs:[{name:"direction",type:"vec3"},{name:"face",type:"float"}]}),Lte=je(([i])=>{const e=ge(0).toVar();return ti(i.greaterThanEqual(uv),()=>{e.assign(YR.sub(i).mul(Z3.sub(QT)).div(YR.sub(uv)).add(QT))}).ElseIf(i.greaterThanEqual(cv),()=>{e.assign(uv.sub(i).mul(J3.sub(Z3)).div(uv.sub(cv)).add(Z3))}).ElseIf(i.greaterThanEqual(hv),()=>{e.assign(cv.sub(i).mul(eS.sub(J3)).div(cv.sub(hv)).add(J3))}).ElseIf(i.greaterThanEqual(QR),()=>{e.assign(hv.sub(i).mul(Rte.sub(eS)).div(hv.sub(QR)).add(eS))}).Else(()=>{e.assign(ge(-2).mul(cu(Wn(1.16,i))))}),e}).setLayout({name:"roughnessToMip",type:"float",inputs:[{name:"roughness",type:"float"}]}),WU=je(([i,e])=>{const t=i.toVar();t.assign(Wn(2,t).sub(1));const n=Ne(t,1).toVar();return ti(e.equal(0),()=>{n.assign(n.zyx)}).ElseIf(e.equal(1),()=>{n.assign(n.xzy),n.xz.mulAssign(-1)}).ElseIf(e.equal(2),()=>{n.x.mulAssign(-1)}).ElseIf(e.equal(3),()=>{n.assign(n.zyx),n.xz.mulAssign(-1)}).ElseIf(e.equal(4),()=>{n.assign(n.xzy),n.xy.mulAssign(-1)}).ElseIf(e.equal(5),()=>{n.z.mulAssign(-1)}),n}).setLayout({name:"getDirection",type:"vec3",inputs:[{name:"uv",type:"vec2"},{name:"face",type:"float"}]}),$U=je(([i,e,t,n,r,s])=>{const a=ge(t),l=Ne(e),u=vu(Lte(a),QT,s),h=Hc(u),g=hu(u),v=Ne(KT(i,l,g,n,r,s)).toVar();return ti(h.notEqual(0),()=>{const x=Ne(KT(i,l,g.add(1),n,r,s)).toVar();v.assign(Fi(v,x,h))}),v}),KT=je(([i,e,t,n,r,s])=>{const a=ge(t).toVar(),l=Ne(e),u=ge(Dte(l)).toVar(),h=ge(qr(KR.sub(a),0)).toVar();a.assign(qr(a,KR));const g=ge(O0(a)).toVar(),v=Et(Pte(l,u).mul(g.sub(2)).add(1)).toVar();return ti(u.greaterThan(2),()=>{v.y.addAssign(g),u.subAssign(3)}),v.x.addAssign(u.mul(g)),v.x.addAssign(h.mul(Wn(3,Nte))),v.y.addAssign(Wn(4,O0(s).sub(g))),v.x.mulAssign(n),v.y.mulAssign(r),i.sample(v).grad(Et(),Et())}),tS=je(({envMap:i,mipInt:e,outputDirection:t,theta:n,axis:r,CUBEUV_TEXEL_WIDTH:s,CUBEUV_TEXEL_HEIGHT:a,CUBEUV_MAX_MIP:l})=>{const u=yc(n),h=t.mul(u).add(r.cross(t).mul(Mo(n))).add(r.mul(r.dot(t).mul(u.oneMinus())));return KT(i,h,e,s,a,l)}),XU=je(({n:i,latitudinal:e,poleAxis:t,outputDirection:n,weights:r,samples:s,dTheta:a,mipInt:l,envMap:u,CUBEUV_TEXEL_WIDTH:h,CUBEUV_TEXEL_HEIGHT:g,CUBEUV_MAX_MIP:v})=>{const x=Ne(zs(e,t,ky(t,n))).toVar();ti(VM(x.equals(Ne(0))),()=>{x.assign(Ne(n.z,0,n.x.negate()))}),x.assign(Fc(x));const S=Ne().toVar();return S.addAssign(r.element(ye(0)).mul(tS({theta:0,axis:x,outputDirection:n,mipInt:l,envMap:u,CUBEUV_TEXEL_WIDTH:h,CUBEUV_TEXEL_HEIGHT:g,CUBEUV_MAX_MIP:v}))),ki({start:ye(1),end:i},({i:w})=>{ti(w.greaterThanEqual(s),()=>{TU()});const R=ge(a.mul(ge(w))).toVar();S.addAssign(r.element(w).mul(tS({theta:R.mul(-1),axis:x,outputDirection:n,mipInt:l,envMap:u,CUBEUV_TEXEL_WIDTH:h,CUBEUV_TEXEL_HEIGHT:g,CUBEUV_MAX_MIP:v}))),S.addAssign(r.element(w).mul(tS({theta:R,axis:x,outputDirection:n,mipInt:l,envMap:u,CUBEUV_TEXEL_WIDTH:h,CUBEUV_TEXEL_HEIGHT:g,CUBEUV_MAX_MIP:v})))}),dn(S,1)});let ny=null;const ZR=new WeakMap;function Ute(i){const e=Math.log2(i)-2,t=1/i;return{texelWidth:1/(3*Math.max(Math.pow(2,e),112)),texelHeight:t,maxMip:e}}function Bte(i){let e=ZR.get(i);if((e!==void 0?e.pmremVersion:-1)!==i.pmremVersion){const n=i.image;if(i.isCubeTexture)if(Ite(n))e=ny.fromCubemap(i,e);else return null;else if(Fte(n))e=ny.fromEquirectangular(i,e);else return null;e.pmremVersion=i.pmremVersion,ZR.set(i,e)}return e.texture}class Ote extends Zr{static get type(){return"PMREMNode"}constructor(e,t=null,n=null){super("vec3"),this._value=e,this._pmrem=null,this.uvNode=t,this.levelNode=n,this._generator=null;const r=new vs;r.isRenderTargetTexture=!0,this._texture=Ai(r),this._width=gn(0),this._height=gn(0),this._maxMip=gn(0),this.updateBeforeType=jn.RENDER}set value(e){this._value=e,this._pmrem=null}get value(){return this._value}updateFromTexture(e){const t=Ute(e.image.height);this._texture.value=e,this._width.value=t.texelWidth,this._height.value=t.texelHeight,this._maxMip.value=t.maxMip}updateBefore(){let e=this._pmrem;const t=e?e.pmremVersion:-1,n=this._value;t!==n.pmremVersion&&(n.isPMREMTexture===!0?e=n:e=Bte(n),e!==null&&(this._pmrem=e,this.updateFromTexture(e)))}setup(e){ny===null&&(ny=e.createPMREMGenerator()),this.updateBefore(e);let t=this.uvNode;t===null&&e.context.getUV&&(t=e.context.getUV(this));const n=this.value;e.renderer.coordinateSystem===Ha&&n.isPMREMTexture!==!0&&n.isRenderTargetTexture===!0&&(t=Ne(t.x.negate(),t.yz)),t=Ne(t.x,t.y.negate(),t.z);let r=this.levelNode;return r===null&&e.context.getTextureLevel&&(r=e.context.getTextureLevel(this)),$U(this._texture,t,r,this._width,this._height,this._maxMip)}}function Ite(i){if(i==null)return!1;let e=0;const t=6;for(let n=0;n0}const _E=ht(Ote),JR=new WeakMap;class kte extends K0{static get type(){return"EnvironmentNode"}constructor(e=null){super(),this.envNode=e}setup(e){const{material:t}=e;let n=this.envNode;if(n.isTextureNode||n.isMaterialReferenceNode){const S=n.isTextureNode?n.value:t[n.property];let w=JR.get(S);w===void 0&&(w=_E(S),JR.set(S,w)),n=w}const s=t.envMap?ji("envMapIntensity","float",e.material):ji("environmentIntensity","float",e.scene),l=t.useAnisotropy===!0||t.anisotropy>0?k9:zr,u=n.context(eN(Zl,l)).mul(s),h=n.context(zte(Hy)).mul(Math.PI).mul(s),g=Im(u),v=Im(h);e.context.radiance.addAssign(g),e.context.iblIrradiance.addAssign(v);const x=e.context.lightingModel.clearcoatRadiance;if(x){const S=n.context(eN(wg,Qd)).mul(s),w=Im(S);x.addAssign(w)}}}const eN=(i,e)=>{let t=null;return{getUV:()=>(t===null&&(t=dr.negate().reflect(e),t=i.mul(i).mix(t,e).normalize(),t=t.transformDirection(so)),t),getTextureLevel:()=>i}},zte=i=>({getUV:()=>i,getTextureLevel:()=>ge(1)}),Gte=new tD;class YU extends Vr{static get type(){return"MeshStandardNodeMaterial"}constructor(e){super(),this.isMeshStandardNodeMaterial=!0,this.lights=!0,this.emissiveNode=null,this.metalnessNode=null,this.roughnessNode=null,this.setDefaultValues(Gte),this.setValues(e)}setupEnvironment(e){let t=super.setupEnvironment(e);return t===null&&e.environmentNode&&(t=e.environmentNode),t?new kte(t):null}setupLightingModel(){return new jU}setupSpecular(){const e=Fi(Ne(.04),Ui.rgb,Tg);ka.assign(e),Mg.assign(1)}setupVariants(){const e=this.metalnessNode?ge(this.metalnessNode):X9;Tg.assign(e);let t=this.roughnessNode?ge(this.roughnessNode):$9;t=gE({roughness:t}),Zl.assign(t),this.setupSpecular(),Ui.assign(dn(Ui.rgb.mul(e.oneMinus()),Ui.a))}copy(e){return this.emissiveNode=e.emissiveNode,this.metalnessNode=e.metalnessNode,this.roughnessNode=e.roughnessNode,super.copy(e)}}const qte=new Cz;class Vte extends YU{static get type(){return"MeshPhysicalNodeMaterial"}constructor(e){super(),this.isMeshPhysicalNodeMaterial=!0,this.clearcoatNode=null,this.clearcoatRoughnessNode=null,this.clearcoatNormalNode=null,this.sheenNode=null,this.sheenRoughnessNode=null,this.iridescenceNode=null,this.iridescenceIORNode=null,this.iridescenceThicknessNode=null,this.specularIntensityNode=null,this.specularColorNode=null,this.iorNode=null,this.transmissionNode=null,this.thicknessNode=null,this.attenuationDistanceNode=null,this.attenuationColorNode=null,this.dispersionNode=null,this.anisotropyNode=null,this.setDefaultValues(qte),this.setValues(e)}get useClearcoat(){return this.clearcoat>0||this.clearcoatNode!==null}get useIridescence(){return this.iridescence>0||this.iridescenceNode!==null}get useSheen(){return this.sheen>0||this.sheenNode!==null}get useAnisotropy(){return this.anisotropy>0||this.anisotropyNode!==null}get useTransmission(){return this.transmission>0||this.transmissionNode!==null}get useDispersion(){return this.dispersion>0||this.dispersionNode!==null}setupSpecular(){const e=this.iorNode?ge(this.iorNode):lU;Om.assign(e),ka.assign(Fi(to(KM(Om.sub(1).div(Om.add(1))).mul(W9),Ne(1)).mul(WT),Ui.rgb,Tg)),Mg.assign(Fi(WT,1,Tg))}setupLightingModel(){return new jU(this.useClearcoat,this.useSheen,this.useIridescence,this.useAnisotropy,this.useTransmission,this.useDispersion)}setupVariants(e){if(super.setupVariants(e),this.useClearcoat){const t=this.clearcoatNode?ge(this.clearcoatNode):Q9,n=this.clearcoatRoughnessNode?ge(this.clearcoatRoughnessNode):K9;X_.assign(t),wg.assign(gE({roughness:n}))}if(this.useSheen){const t=this.sheenNode?Ne(this.sheenNode):eU,n=this.sheenRoughnessNode?ge(this.sheenRoughnessNode):tU;Xf.assign(t),Uy.assign(n)}if(this.useIridescence){const t=this.iridescenceNode?ge(this.iridescenceNode):iU,n=this.iridescenceIORNode?ge(this.iridescenceIORNode):rU,r=this.iridescenceThicknessNode?ge(this.iridescenceThicknessNode):sU;By.assign(t),BM.assign(n),OM.assign(r)}if(this.useAnisotropy){const t=(this.anisotropyNode?Et(this.anisotropyNode):nU).toVar();Rh.assign(t.length()),ti(Rh.equal(0),()=>{t.assign(Et(1,0))}).Else(()=>{t.divAssign(Et(Rh)),Rh.assign(Rh.saturate())}),Y_.assign(Rh.pow2().mix(Zl.pow2(),1)),Bm.assign(Yf[0].mul(t.x).add(Yf[1].mul(t.y))),iA.assign(Yf[1].mul(t.x).sub(Yf[0].mul(t.y)))}if(this.useTransmission){const t=this.transmissionNode?ge(this.transmissionNode):aU,n=this.thicknessNode?ge(this.thicknessNode):oU,r=this.attenuationDistanceNode?ge(this.attenuationDistanceNode):uU,s=this.attenuationColorNode?Ne(this.attenuationColorNode):cU;if(K_.assign(t),IM.assign(n),FM.assign(r),kM.assign(s),this.useDispersion){const a=this.dispersionNode?ge(this.dispersionNode):pU;zM.assign(a)}}}setupClearcoatNormal(){return this.clearcoatNormalNode?Ne(this.clearcoatNormalNode):Z9}setup(e){e.context.setupClearcoatNormal=()=>this.setupClearcoatNormal(e),super.setup(e)}copy(e){return this.clearcoatNode=e.clearcoatNode,this.clearcoatRoughnessNode=e.clearcoatRoughnessNode,this.clearcoatNormalNode=e.clearcoatNormalNode,this.sheenNode=e.sheenNode,this.sheenRoughnessNode=e.sheenRoughnessNode,this.iridescenceNode=e.iridescenceNode,this.iridescenceIORNode=e.iridescenceIORNode,this.iridescenceThicknessNode=e.iridescenceThicknessNode,this.specularIntensityNode=e.specularIntensityNode,this.specularColorNode=e.specularColorNode,this.transmissionNode=e.transmissionNode,this.thicknessNode=e.thicknessNode,this.attenuationDistanceNode=e.attenuationDistanceNode,this.attenuationColorNode=e.attenuationColorNode,this.dispersionNode=e.dispersionNode,this.anisotropyNode=e.anisotropyNode,super.copy(e)}}const Hte=je(({normal:i,lightDirection:e,builder:t})=>{const n=i.dot(e),r=Et(n.mul(.5).add(.5),0);if(t.material.gradientMap){const s=Tc("gradientMap","texture").context({getUV:()=>r});return Ne(s.r)}else{const s=r.fwidth().mul(.5);return Fi(Ne(.7),Ne(1),kc(ge(.7).sub(s.x),ge(.7).add(s.x),r.x))}});class jte extends Xy{direct({lightDirection:e,lightColor:t,reflectedLight:n},r,s){const a=Hte({normal:qy,lightDirection:e,builder:s}).mul(t);n.directDiffuse.addAssign(a.mul(AA({diffuseColor:Ui.rgb})))}indirect({ambientOcclusion:e,irradiance:t,reflectedLight:n}){n.indirectDiffuse.addAssign(t.mul(AA({diffuseColor:Ui}))),n.indirectDiffuse.mulAssign(e)}}const Wte=new Rz;class $te extends Vr{static get type(){return"MeshToonNodeMaterial"}constructor(e){super(),this.isMeshToonNodeMaterial=!0,this.lights=!0,this.setDefaultValues(Wte),this.setValues(e)}setupLightingModel(){return new jte}}class Xte extends Zr{static get type(){return"MatcapUVNode"}constructor(){super("vec2")}setup(){const e=Ne(dr.z,0,dr.x.negate()).normalize(),t=dr.cross(e);return Et(e.dot(zr),t.dot(zr)).mul(.495).add(.5)}}const QU=zt(Xte),Yte=new Lz;class Qte extends Vr{static get type(){return"MeshMatcapNodeMaterial"}constructor(e){super(),this.isMeshMatcapNodeMaterial=!0,this.setDefaultValues(Yte),this.setValues(e)}setupVariants(e){const t=QU;let n;e.material.matcap?n=Tc("matcap","texture").context({getUV:()=>t}):n=Ne(Fi(.2,.8,t.y)),Ui.rgb.mulAssign(n.rgb)}}const Kte=new Qw;class Zte extends Vr{static get type(){return"PointsNodeMaterial"}constructor(e){super(),this.isPointsNodeMaterial=!0,this.setDefaultValues(Kte),this.setValues(e)}}class Jte extends Zr{static get type(){return"RotateNode"}constructor(e,t){super(),this.positionNode=e,this.rotationNode=t}getNodeType(e){return this.positionNode.getNodeType(e)}setup(e){const{rotationNode:t,positionNode:n}=this;if(this.getNodeType(e)==="vec2"){const s=t.cos(),a=t.sin();return Ly(s,a,a.negate(),s).mul(n)}else{const s=t,a=nA(dn(1,0,0,0),dn(0,yc(s.x),Mo(s.x).negate(),0),dn(0,Mo(s.x),yc(s.x),0),dn(0,0,0,1)),l=nA(dn(yc(s.y),0,Mo(s.y),0),dn(0,1,0,0),dn(Mo(s.y).negate(),0,yc(s.y),0),dn(0,0,0,1)),u=nA(dn(yc(s.z),Mo(s.z).negate(),0,0),dn(Mo(s.z),yc(s.z),0,0),dn(0,0,1,0),dn(0,0,0,1));return a.mul(l).mul(u).mul(dn(n,1)).xyz}}}const yE=ht(Jte),ene=new jk;class tne extends Vr{static get type(){return"SpriteNodeMaterial"}constructor(e){super(),this.isSpriteNodeMaterial=!0,this._useSizeAttenuation=!0,this.positionNode=null,this.rotationNode=null,this.scaleNode=null,this.setDefaultValues(ene),this.setValues(e)}setupPositionView(e){const{object:t,camera:n}=e,r=this.sizeAttenuation,{positionNode:s,rotationNode:a,scaleNode:l}=this,u=Q0.mul(Ne(s||0));let h=Et($o[0].xyz.length(),$o[1].xyz.length());if(l!==null&&(h=h.mul(l)),r===!1)if(n.isPerspectiveCamera)h=h.mul(u.z.negate());else{const S=ge(2).div(_A.element(1).element(1));h=h.mul(S.mul(2))}let g=Gy.xy;if(t.center&&t.center.isVector2===!0){const S=xJ("center","vec2",t);g=g.sub(S.sub(.5))}g=g.mul(h);const v=ge(a||J9),x=yE(g,v);return dn(u.xy.add(x),u.zw)}copy(e){return this.positionNode=e.positionNode,this.rotationNode=e.rotationNode,this.scaleNode=e.scaleNode,super.copy(e)}get sizeAttenuation(){return this._useSizeAttenuation}set sizeAttenuation(e){this._useSizeAttenuation!==e&&(this._useSizeAttenuation=e,this.needsUpdate=!0)}}class nne extends Xy{constructor(){super(),this.shadowNode=ge(1).toVar("shadowMask")}direct({shadowMask:e}){this.shadowNode.mulAssign(e)}finish(e){Ui.a.mulAssign(this.shadowNode.oneMinus()),e.outgoingLight.rgb.assign(Ui.rgb)}}const ine=new Ez;class rne extends Vr{static get type(){return"ShadowNodeMaterial"}constructor(e){super(),this.isShadowNodeMaterial=!0,this.lights=!0,this.setDefaultValues(ine),this.setValues(e)}setupLightingModel(){return new nne}}const sne=je(({texture:i,uv:e})=>{const n=Ne().toVar();return ti(e.x.lessThan(1e-4),()=>{n.assign(Ne(1,0,0))}).ElseIf(e.y.lessThan(1e-4),()=>{n.assign(Ne(0,1,0))}).ElseIf(e.z.lessThan(1e-4),()=>{n.assign(Ne(0,0,1))}).ElseIf(e.x.greaterThan(1-1e-4),()=>{n.assign(Ne(-1,0,0))}).ElseIf(e.y.greaterThan(1-1e-4),()=>{n.assign(Ne(0,-1,0))}).ElseIf(e.z.greaterThan(1-1e-4),()=>{n.assign(Ne(0,0,-1))}).Else(()=>{const s=i.sample(e.add(Ne(-.01,0,0))).r.sub(i.sample(e.add(Ne(.01,0,0))).r),a=i.sample(e.add(Ne(0,-.01,0))).r.sub(i.sample(e.add(Ne(0,.01,0))).r),l=i.sample(e.add(Ne(0,0,-.01))).r.sub(i.sample(e.add(Ne(0,0,.01))).r);n.assign(Ne(s,a,l))}),n.normalize()});class ane extends yu{static get type(){return"Texture3DNode"}constructor(e,t=null,n=null){super(e,t,n),this.isTexture3DNode=!0}getInputType(){return"texture3D"}getDefaultUV(){return Ne(.5,.5,.5)}setUpdateMatrix(){}setupUV(e,t){const n=this.value;return e.isFlipY()&&(n.isRenderTargetTexture===!0||n.isFramebufferTexture===!0)&&(this.sampler?t=t.flipY():t=t.setY(ye(Fh(this,this.levelNode).y).sub(t.y).sub(1))),t}generateUV(e,t){return t.build(e,"vec3")}normal(e){return sne({texture:this,uv:e})}}const one=ht(ane);class lne{constructor(e,t){this.nodes=e,this.info=t,this._context=self,this._animationLoop=null,this._requestId=null}start(){const e=(t,n)=>{this._requestId=this._context.requestAnimationFrame(e),this.info.autoReset===!0&&this.info.reset(),this.nodes.nodeFrame.update(),this.info.frame=this.nodes.nodeFrame.frameId,this._animationLoop!==null&&this._animationLoop(t,n)};e()}stop(){this._context.cancelAnimationFrame(this._requestId),this._requestId=null}setAnimationLoop(e){this._animationLoop=e}setContext(e){this._context=e}dispose(){this.stop()}}class Su{constructor(){this.weakMap=new WeakMap}get(e){let t=this.weakMap;for(let n=0;n{this.dispose()},this.material.addEventListener("dispose",this.onMaterialDispose)}updateClipping(e){this.clippingContext=e}get clippingNeedsUpdate(){return this.clippingContext===null||this.clippingContext.cacheKey===this.clippingContextCacheKey?!1:(this.clippingContextCacheKey=this.clippingContext.cacheKey,!0)}get hardwareClippingPlanes(){return this.material.hardwareClipping===!0?this.clippingContext.unionClippingCount:0}getNodeBuilderState(){return this._nodeBuilderState||(this._nodeBuilderState=this._nodes.getForRender(this))}getMonitor(){return this._monitor||(this._monitor=this.getNodeBuilderState().monitor)}getBindings(){return this._bindings||(this._bindings=this.getNodeBuilderState().createBindings())}getIndex(){return this._geometries.getIndex(this)}getIndirect(){return this._geometries.getIndirect(this)}getChainArray(){return[this.object,this.material,this.context,this.lightsNode]}setGeometry(e){this.geometry=e,this.attributes=null}getAttributes(){if(this.attributes!==null)return this.attributes;const e=this.getNodeBuilderState().nodeAttributes,t=this.geometry,n=[],r=new Set;for(const s of e){const a=s.node&&s.node.attribute?s.node.attribute:t.getAttribute(s.name);if(a===void 0)continue;n.push(a);const l=a.isInterleavedBufferAttribute?a.data:a;r.add(l)}return this.attributes=n,this.vertexBuffers=Array.from(r.values()),n}getVertexBuffers(){return this.vertexBuffers===null&&this.getAttributes(),this.vertexBuffers}getDrawParameters(){const{object:e,material:t,geometry:n,group:r,drawRange:s}=this,a=this.drawParams||(this.drawParams={vertexCount:0,firstVertex:0,instanceCount:0,firstInstance:0}),l=this.getIndex(),u=l!==null,h=n.isInstancedBufferGeometry?n.instanceCount:e.count>1?e.count:1;if(h===0)return null;if(a.instanceCount=h,e.isBatchedMesh===!0)return a;let g=1;t.wireframe===!0&&!e.isPoints&&!e.isLineSegments&&!e.isLine&&!e.isLineLoop&&(g=2);let v=s.start*g,x=(s.start+s.count)*g;r!==null&&(v=Math.max(v,r.start*g),x=Math.min(x,(r.start+r.count)*g));const S=n.attributes.position;let w=1/0;u?w=l.count:S!=null&&(w=S.count),v=Math.max(v,0),x=Math.min(x,w);const R=x-v;return R<0||R===1/0?null:(a.vertexCount=R,a.firstVertex=v,a)}getGeometryCacheKey(){const{geometry:e}=this;let t="";for(const n of Object.keys(e.attributes).sort()){const r=e.attributes[n];t+=n+",",r.data&&(t+=r.data.stride+","),r.offset&&(t+=r.offset+","),r.itemSize&&(t+=r.itemSize+","),r.normalized&&(t+="n,")}return e.index&&(t+="index,"),t}getMaterialCacheKey(){const{object:e,material:t}=this;let n=t.customProgramCacheKey();for(const r of cne(t)){if(/^(is[A-Z]|_)|^(visible|version|uuid|name|opacity|userData)$/.test(r))continue;const s=t[r];let a;if(s!==null){const l=typeof s;l==="number"?a=s!==0?"1":"0":l==="object"?(a="{",s.isTexture&&(a+=s.mapping),a+="}"):a=String(s)}else a=String(s);n+=a+","}return n+=this.clippingContextCacheKey+",",e.geometry&&(n+=this.getGeometryCacheKey()),e.skeleton&&(n+=e.skeleton.bones.length+","),e.morphTargetInfluences&&(n+=e.morphTargetInfluences.length+","),e.isBatchedMesh&&(n+=e._matricesTexture.uuid+",",e._colorsTexture!==null&&(n+=e._colorsTexture.uuid+",")),e.count>1&&(n+=e.uuid+","),n+=e.receiveShadow+",",DP(n)}get needsGeometryUpdate(){return this.geometry.id!==this.object.geometry.id}get needsUpdate(){return this.initialNodesCacheKey!==this.getDynamicCacheKey()||this.clippingNeedsUpdate}getDynamicCacheKey(){let e=this._nodes.getCacheKey(this.scene,this.lightsNode);return this.object.receiveShadow&&(e+=1),e}getCacheKey(){return this.getMaterialCacheKey()+this.getDynamicCacheKey()}dispose(){this.material.removeEventListener("dispose",this.onMaterialDispose),this.onDispose()}}const Ed=[];class fne{constructor(e,t,n,r,s,a){this.renderer=e,this.nodes=t,this.geometries=n,this.pipelines=r,this.bindings=s,this.info=a,this.chainMaps={}}get(e,t,n,r,s,a,l,u){const h=this.getChainMap(u);Ed[0]=e,Ed[1]=t,Ed[2]=a,Ed[3]=s;let g=h.get(Ed);return g===void 0?(g=this.createRenderObject(this.nodes,this.geometries,this.renderer,e,t,n,r,s,a,l,u),h.set(Ed,g)):(g.updateClipping(l),g.needsGeometryUpdate&&g.setGeometry(e.geometry),(g.version!==t.version||g.needsUpdate)&&(g.initialCacheKey!==g.getCacheKey()?(g.dispose(),g=this.get(e,t,n,r,s,a,l,u)):g.version=t.version)),g}getChainMap(e="default"){return this.chainMaps[e]||(this.chainMaps[e]=new Su)}dispose(){this.chainMaps={}}createRenderObject(e,t,n,r,s,a,l,u,h,g,v){const x=this.getChainMap(v),S=new hne(e,t,n,r,s,a,l,u,h,g);return S.onDispose=()=>{this.pipelines.delete(S),this.bindings.delete(S),this.nodes.delete(S),x.delete(S.getChainArray())},S}}class Yh{constructor(){this.data=new WeakMap}get(e){let t=this.data.get(e);return t===void 0&&(t={},this.data.set(e,t)),t}delete(e){let t=null;return this.data.has(e)&&(t=this.data.get(e),this.data.delete(e)),t}has(e){return this.data.has(e)}dispose(){this.data=new WeakMap}}const iu={VERTEX:1,INDEX:2,STORAGE:3,INDIRECT:4},Lh=16,Ane=211,dne=212;class pne extends Yh{constructor(e){super(),this.backend=e}delete(e){const t=super.delete(e);return t!==void 0&&this.backend.destroyAttribute(e),t}update(e,t){const n=this.get(e);if(n.version===void 0)t===iu.VERTEX?this.backend.createAttribute(e):t===iu.INDEX?this.backend.createIndexAttribute(e):t===iu.STORAGE?this.backend.createStorageAttribute(e):t===iu.INDIRECT&&this.backend.createIndirectStorageAttribute(e),n.version=this._getBufferAttribute(e).version;else{const r=this._getBufferAttribute(e);(n.version=0;--e)if(i[e]>=65535)return!0;return!1}function KU(i){return i.index!==null?i.index.version:i.attributes.position.version}function tN(i){const e=[],t=i.index,n=i.attributes.position;if(t!==null){const s=t.array;for(let a=0,l=s.length;a{this.info.memory.geometries--;const s=t.index,a=e.getAttributes();s!==null&&this.attributes.delete(s);for(const u of a)this.attributes.delete(u);const l=this.wireframes.get(t);l!==void 0&&this.attributes.delete(l),t.removeEventListener("dispose",r)};t.addEventListener("dispose",r)}updateAttributes(e){const t=e.getAttributes();for(const s of t)s.isStorageBufferAttribute||s.isStorageInstancedBufferAttribute?this.updateAttribute(s,iu.STORAGE):this.updateAttribute(s,iu.VERTEX);const n=this.getIndex(e);n!==null&&this.updateAttribute(n,iu.INDEX);const r=e.geometry.indirect;r!==null&&this.updateAttribute(r,iu.INDIRECT)}updateAttribute(e,t){const n=this.info.render.calls;e.isInterleavedBufferAttribute?this.attributeCall.get(e)===void 0?(this.attributes.update(e,t),this.attributeCall.set(e,n)):this.attributeCall.get(e.data)!==n&&(this.attributes.update(e,t),this.attributeCall.set(e.data,n),this.attributeCall.set(e,n)):this.attributeCall.get(e)!==n&&(this.attributes.update(e,t),this.attributeCall.set(e,n))}getIndirect(e){return e.geometry.indirect}getIndex(e){const{geometry:t,material:n}=e;let r=t.index;if(n.wireframe===!0){const s=this.wireframes;let a=s.get(t);a===void 0?(a=tN(t),s.set(t,a)):a.version!==KU(t)&&(this.attributes.delete(a),a=tN(t),s.set(t,a)),r=a}return r}}class vne{constructor(){this.autoReset=!0,this.frame=0,this.calls=0,this.render={calls:0,frameCalls:0,drawCalls:0,triangles:0,points:0,lines:0,timestamp:0,previousFrameCalls:0,timestampCalls:0},this.compute={calls:0,frameCalls:0,timestamp:0,previousFrameCalls:0,timestampCalls:0},this.memory={geometries:0,textures:0}}update(e,t,n){this.render.drawCalls++,e.isMesh||e.isSprite?this.render.triangles+=n*(t/3):e.isPoints?this.render.points+=n*t:e.isLineSegments?this.render.lines+=n*(t/2):e.isLine?this.render.lines+=n*(t-1):console.error("THREE.WebGPUInfo: Unknown object type.")}updateTimestamp(e,t){this[e].timestampCalls===0&&(this[e].timestamp=0),this[e].timestamp+=t,this[e].timestampCalls++,this[e].timestampCalls>=this[e].previousFrameCalls&&(this[e].timestampCalls=0)}reset(){const e=this.render.frameCalls;this.render.previousFrameCalls=e;const t=this.compute.frameCalls;this.compute.previousFrameCalls=t,this.render.drawCalls=0,this.render.frameCalls=0,this.compute.frameCalls=0,this.render.triangles=0,this.render.points=0,this.render.lines=0}dispose(){this.reset(),this.calls=0,this.render.calls=0,this.compute.calls=0,this.render.timestamp=0,this.compute.timestamp=0,this.memory.geometries=0,this.memory.textures=0}}class ZU{constructor(e){this.cacheKey=e,this.usedTimes=0}}class _ne extends ZU{constructor(e,t,n){super(e),this.vertexProgram=t,this.fragmentProgram=n}}class yne extends ZU{constructor(e,t){super(e),this.computeProgram=t,this.isComputePipeline=!0}}let xne=0;class nS{constructor(e,t,n,r=null,s=null){this.id=xne++,this.code=e,this.stage=t,this.name=n,this.transforms=r,this.attributes=s,this.usedTimes=0}}class bne extends Yh{constructor(e,t){super(),this.backend=e,this.nodes=t,this.bindings=null,this.caches=new Map,this.programs={vertex:new Map,fragment:new Map,compute:new Map}}getForCompute(e,t){const{backend:n}=this,r=this.get(e);if(this._needsComputeUpdate(e)){const s=r.pipeline;s&&(s.usedTimes--,s.computeProgram.usedTimes--);const a=this.nodes.getForCompute(e);let l=this.programs.compute.get(a.computeShader);l===void 0&&(s&&s.computeProgram.usedTimes===0&&this._releaseProgram(s.computeProgram),l=new nS(a.computeShader,"compute",e.name,a.transforms,a.nodeAttributes),this.programs.compute.set(a.computeShader,l),n.createProgram(l));const u=this._getComputeCacheKey(e,l);let h=this.caches.get(u);h===void 0&&(s&&s.usedTimes===0&&this._releasePipeline(s),h=this._getComputePipeline(e,l,u,t)),h.usedTimes++,l.usedTimes++,r.version=e.version,r.pipeline=h}return r.pipeline}getForRender(e,t=null){const{backend:n}=this,r=this.get(e);if(this._needsRenderUpdate(e)){const s=r.pipeline;s&&(s.usedTimes--,s.vertexProgram.usedTimes--,s.fragmentProgram.usedTimes--);const a=e.getNodeBuilderState(),l=e.material?e.material.name:"";let u=this.programs.vertex.get(a.vertexShader);u===void 0&&(s&&s.vertexProgram.usedTimes===0&&this._releaseProgram(s.vertexProgram),u=new nS(a.vertexShader,"vertex",l),this.programs.vertex.set(a.vertexShader,u),n.createProgram(u));let h=this.programs.fragment.get(a.fragmentShader);h===void 0&&(s&&s.fragmentProgram.usedTimes===0&&this._releaseProgram(s.fragmentProgram),h=new nS(a.fragmentShader,"fragment",l),this.programs.fragment.set(a.fragmentShader,h),n.createProgram(h));const g=this._getRenderCacheKey(e,u,h);let v=this.caches.get(g);v===void 0?(s&&s.usedTimes===0&&this._releasePipeline(s),v=this._getRenderPipeline(e,u,h,g,t)):e.pipeline=v,v.usedTimes++,u.usedTimes++,h.usedTimes++,r.pipeline=v}return r.pipeline}delete(e){const t=this.get(e).pipeline;return t&&(t.usedTimes--,t.usedTimes===0&&this._releasePipeline(t),t.isComputePipeline?(t.computeProgram.usedTimes--,t.computeProgram.usedTimes===0&&this._releaseProgram(t.computeProgram)):(t.fragmentProgram.usedTimes--,t.vertexProgram.usedTimes--,t.vertexProgram.usedTimes===0&&this._releaseProgram(t.vertexProgram),t.fragmentProgram.usedTimes===0&&this._releaseProgram(t.fragmentProgram))),super.delete(e)}dispose(){super.dispose(),this.caches=new Map,this.programs={vertex:new Map,fragment:new Map,compute:new Map}}updateForRender(e){this.getForRender(e)}_getComputePipeline(e,t,n,r){n=n||this._getComputeCacheKey(e,t);let s=this.caches.get(n);return s===void 0&&(s=new yne(n,t),this.caches.set(n,s),this.backend.createComputePipeline(s,r)),s}_getRenderPipeline(e,t,n,r,s){r=r||this._getRenderCacheKey(e,t,n);let a=this.caches.get(r);return a===void 0&&(a=new _ne(r,t,n),this.caches.set(r,a),e.pipeline=a,this.backend.createRenderPipeline(e,s)),a}_getComputeCacheKey(e,t){return e.id+","+t.id}_getRenderCacheKey(e,t,n){return t.id+","+n.id+","+this.backend.getRenderCacheKey(e)}_releasePipeline(e){this.caches.delete(e.cacheKey)}_releaseProgram(e){const t=e.code,n=e.stage;this.programs[n].delete(t)}_needsComputeUpdate(e){const t=this.get(e);return t.pipeline===void 0||t.version!==e.version}_needsRenderUpdate(e){return this.get(e).pipeline===void 0||this.backend.needsRenderUpdate(e)}}class Sne extends Yh{constructor(e,t,n,r,s,a){super(),this.backend=e,this.textures=n,this.pipelines=s,this.attributes=r,this.nodes=t,this.info=a,this.pipelines.bindings=this}getForRender(e){const t=e.getBindings();for(const n of t){const r=this.get(n);r.bindGroup===void 0&&(this._init(n),this.backend.createBindings(n,t,0),r.bindGroup=n)}return t}getForCompute(e){const t=this.nodes.getForCompute(e).bindings;for(const n of t){const r=this.get(n);r.bindGroup===void 0&&(this._init(n),this.backend.createBindings(n,t,0),r.bindGroup=n)}return t}updateForCompute(e){this._updateBindings(this.getForCompute(e))}updateForRender(e){this._updateBindings(this.getForRender(e))}_updateBindings(e){for(const t of e)this._update(t,e)}_init(e){for(const t of e.bindings)if(t.isSampledTexture)this.textures.updateTexture(t.texture);else if(t.isStorageBuffer){const n=t.attribute,r=n.isIndirectStorageBufferAttribute?iu.INDIRECT:iu.STORAGE;this.attributes.update(n,r)}}_update(e,t){const{backend:n}=this;let r=!1,s=!0,a=0,l=0;for(const u of e.bindings)if(!(u.isNodeUniformsGroup&&this.nodes.updateGroup(u)===!1)){if(u.isUniformBuffer)u.update()&&n.updateBinding(u);else if(u.isSampler)u.update();else if(u.isSampledTexture){const h=this.textures.get(u.texture);u.needsBindingsUpdate(h.generation)&&(r=!0);const g=u.update(),v=u.texture;g&&this.textures.updateTexture(v);const x=n.get(v);if(x.externalTexture!==void 0||h.isDefaultTexture?s=!1:(a=a*10+v.id,l+=v.version),n.isWebGPUBackend===!0&&x.texture===void 0&&x.externalTexture===void 0&&(console.error("Bindings._update: binding should be available:",u,g,v,u.textureNode.value,r),this.textures.updateTexture(v),r=!0),v.isStorageTexture===!0){const S=this.get(v);u.store===!0?S.needsMipmap=!0:this.textures.needsMipmaps(v)&&S.needsMipmap===!0&&(this.backend.generateMipmaps(v),S.needsMipmap=!1)}}}r===!0&&this.backend.updateBindings(e,t,s?a:0,l)}}function Tne(i,e){return i.groupOrder!==e.groupOrder?i.groupOrder-e.groupOrder:i.renderOrder!==e.renderOrder?i.renderOrder-e.renderOrder:i.material.id!==e.material.id?i.material.id-e.material.id:i.z!==e.z?i.z-e.z:i.id-e.id}function nN(i,e){return i.groupOrder!==e.groupOrder?i.groupOrder-e.groupOrder:i.renderOrder!==e.renderOrder?i.renderOrder-e.renderOrder:i.z!==e.z?e.z-i.z:i.id-e.id}function iN(i){return(i.transmission>0||i.transmissionNode)&&i.side===as&&i.forceSinglePass===!1}class wne{constructor(e,t,n){this.renderItems=[],this.renderItemsIndex=0,this.opaque=[],this.transparentDoublePass=[],this.transparent=[],this.bundles=[],this.lightsNode=e.getNode(t,n),this.lightsArray=[],this.scene=t,this.camera=n,this.occlusionQueryCount=0}begin(){return this.renderItemsIndex=0,this.opaque.length=0,this.transparentDoublePass.length=0,this.transparent.length=0,this.bundles.length=0,this.lightsArray.length=0,this.occlusionQueryCount=0,this}getNextRenderItem(e,t,n,r,s,a,l){let u=this.renderItems[this.renderItemsIndex];return u===void 0?(u={id:e.id,object:e,geometry:t,material:n,groupOrder:r,renderOrder:e.renderOrder,z:s,group:a,clippingContext:l},this.renderItems[this.renderItemsIndex]=u):(u.id=e.id,u.object=e,u.geometry=t,u.material=n,u.groupOrder=r,u.renderOrder=e.renderOrder,u.z=s,u.group=a,u.clippingContext=l),this.renderItemsIndex++,u}push(e,t,n,r,s,a,l){const u=this.getNextRenderItem(e,t,n,r,s,a,l);e.occlusionTest===!0&&this.occlusionQueryCount++,n.transparent===!0||n.transmission>0?(iN(n)&&this.transparentDoublePass.push(u),this.transparent.push(u)):this.opaque.push(u)}unshift(e,t,n,r,s,a,l){const u=this.getNextRenderItem(e,t,n,r,s,a,l);n.transparent===!0||n.transmission>0?(iN(n)&&this.transparentDoublePass.unshift(u),this.transparent.unshift(u)):this.opaque.unshift(u)}pushBundle(e){this.bundles.push(e)}pushLight(e){this.lightsArray.push(e)}sort(e,t){this.opaque.length>1&&this.opaque.sort(e||Tne),this.transparentDoublePass.length>1&&this.transparentDoublePass.sort(t||nN),this.transparent.length>1&&this.transparent.sort(t||nN)}finish(){this.lightsNode.setLights(this.lightsArray);for(let e=this.renderItemsIndex,t=this.renderItems.length;e>t,h=l.height>>t;let g=e.depthTexture||s[t];const v=e.depthBuffer===!0||e.stencilBuffer===!0;let x=!1;g===void 0&&v&&(g=new qc,g.format=e.stencilBuffer?du:au,g.type=e.stencilBuffer?Au:Rr,g.image.width=u,g.image.height=h,s[t]=g),(n.width!==l.width||l.height!==n.height)&&(x=!0,g&&(g.needsUpdate=!0,g.image.width=u,g.image.height=h)),n.width=l.width,n.height=l.height,n.textures=a,n.depthTexture=g||null,n.depth=e.depthBuffer,n.stencil=e.stencilBuffer,n.renderTarget=e,n.sampleCount!==r&&(x=!0,g&&(g.needsUpdate=!0),n.sampleCount=r);const S={sampleCount:r};for(let w=0;w{e.removeEventListener("dispose",w);for(let R=0;R0){const g=e.image;if(g===void 0)console.warn("THREE.Renderer: Texture marked for update but image is undefined.");else if(g.complete===!1)console.warn("THREE.Renderer: Texture marked for update but image is incomplete.");else{if(e.images){const v=[];for(const x of e.images)v.push(x);t.images=v}else t.image=g;(n.isDefaultTexture===void 0||n.isDefaultTexture===!0)&&(s.createTexture(e,t),n.isDefaultTexture=!1,n.generation=e.version),e.source.dataReady===!0&&s.updateTexture(e,t),t.needsMipmaps&&e.mipmaps.length===0&&s.generateMipmaps(e)}}else s.createDefaultTexture(e),n.isDefaultTexture=!0,n.generation=e.version;if(n.initialized!==!0){n.initialized=!0,n.generation=e.version,this.info.memory.textures++;const h=()=>{e.removeEventListener("dispose",h),this._destroyTexture(e),this.info.memory.textures--};e.addEventListener("dispose",h)}n.version=e.version}getSize(e,t=Nne){let n=e.images?e.images[0]:e.image;return n?(n.image!==void 0&&(n=n.image),t.width=n.width||1,t.height=n.height||1,t.depth=e.isCubeTexture?6:n.depth||1):t.width=t.height=t.depth=1,t}getMipLevels(e,t,n){let r;return e.isCompressedTexture?e.mipmaps?r=e.mipmaps.length:r=1:r=Math.floor(Math.log2(Math.max(t,n)))+1,r}needsMipmaps(e){return this.isEnvironmentTexture(e)||e.isCompressedTexture===!0||e.generateMipmaps}isEnvironmentTexture(e){const t=e.mapping;return t===zh||t===Gh||t===Qo||t===Ko}_destroyTexture(e){this.backend.destroySampler(e),this.backend.destroyTexture(e),this.delete(e)}}class xE extends sn{constructor(e,t,n,r=1){super(e,t,n),this.a=r}set(e,t,n,r=1){return this.a=r,super.set(e,t,n)}copy(e){return e.a!==void 0&&(this.a=e.a),super.copy(e)}clone(){return new this.constructor(this.r,this.g,this.b,this.a)}}class eB extends Gi{static get type(){return"ParameterNode"}constructor(e,t=null){super(e,t),this.isParameterNode=!0}getHash(){return this.uuid}generate(){return this.name}}const Pne=(i,e)=>gt(new eB(i,e));class Lne extends Mn{static get type(){return"StackNode"}constructor(e=null){super(),this.nodes=[],this.outputNode=null,this.parent=e,this._currentCond=null,this.isStackNode=!0}getNodeType(e){return this.outputNode?this.outputNode.getNodeType(e):"void"}add(e){return this.nodes.push(e),this}If(e,t){const n=new Um(t);return this._currentCond=zs(e,n),this.add(this._currentCond)}ElseIf(e,t){const n=new Um(t),r=zs(e,n);return this._currentCond.elseNode=r,this._currentCond=r,this}Else(e){return this._currentCond.elseNode=new Um(e),this}build(e,...t){const n=DM();bg(this);for(const r of this.nodes)r.build(e,"void");return bg(n),this.outputNode?this.outputNode.build(e,...t):super.build(e,...t)}else(...e){return console.warn("TSL.StackNode: .else() has been renamed to .Else()."),this.Else(...e)}elseif(...e){return console.warn("TSL.StackNode: .elseif() has been renamed to .ElseIf()."),this.ElseIf(...e)}}const e_=ht(Lne);class tB extends Mn{static get type(){return"OutputStructNode"}constructor(...e){super(),this.members=e,this.isOutputStructNode=!0}setup(e){super.setup(e);const t=this.members,n=[];for(let r=0;r{const e=i.toUint().mul(747796405).add(2891336453),t=e.shiftRight(e.shiftRight(28).add(4)).bitXor(e).mul(277803737);return t.shiftRight(22).bitXor(t).toFloat().mul(1/2**32)}),ZT=(i,e)=>Cl(Wn(4,i.mul(Ti(1,i))),e),Ine=(i,e)=>i.lessThan(.5)?ZT(i.mul(2),e).div(2):Ti(1,ZT(Wn(Ti(1,i),2),e).div(2)),Fne=(i,e,t)=>Cl(Dl(Cl(i,e),Qr(Cl(i,e),Cl(Ti(1,i),t))),1/e),kne=(i,e)=>Mo(Z_.mul(e.mul(i).sub(1))).div(Z_.mul(e.mul(i).sub(1))),xc=je(([i])=>i.fract().sub(.5).abs()).setLayout({name:"tri",type:"float",inputs:[{name:"x",type:"float"}]}),zne=je(([i])=>Ne(xc(i.z.add(xc(i.y.mul(1)))),xc(i.z.add(xc(i.x.mul(1)))),xc(i.y.add(xc(i.x.mul(1)))))).setLayout({name:"tri3",type:"vec3",inputs:[{name:"p",type:"vec3"}]}),Gne=je(([i,e,t])=>{const n=Ne(i).toVar(),r=ge(1.4).toVar(),s=ge(0).toVar(),a=Ne(n).toVar();return ki({start:ge(0),end:ge(3),type:"float",condition:"<="},()=>{const l=Ne(zne(a.mul(2))).toVar();n.addAssign(l.add(t.mul(ge(.1).mul(e)))),a.mulAssign(1.8),r.mulAssign(1.5),n.mulAssign(1.2);const u=ge(xc(n.z.add(xc(n.x.add(xc(n.y)))))).toVar();s.addAssign(u.div(r)),a.addAssign(.14)}),s}).setLayout({name:"triNoise3D",type:"float",inputs:[{name:"position",type:"vec3"},{name:"speed",type:"float"},{name:"time",type:"float"}]});class qne extends Mn{static get type(){return"FunctionOverloadingNode"}constructor(e=[],...t){super(),this.functionNodes=e,this.parametersNodes=t,this._candidateFnCall=null,this.global=!0}getNodeType(){return this.functionNodes[0].shaderNode.layout.type}setup(e){const t=this.parametersNodes;let n=this._candidateFnCall;if(n===null){let r=null,s=-1;for(const a of this.functionNodes){const u=a.shaderNode.layout;if(u===null)throw new Error("FunctionOverloadingNode: FunctionNode must be a layout.");const h=u.inputs;if(t.length===h.length){let g=0;for(let v=0;vs&&(r=a,s=g)}}this._candidateFnCall=n=r(...t)}return n}}const Vne=ht(qne),Vs=i=>(...e)=>Vne(i,...e),yA=gn(0).setGroup(Rn).onRenderUpdate(i=>i.time),rB=gn(0).setGroup(Rn).onRenderUpdate(i=>i.deltaTime),Hne=gn(0,"uint").setGroup(Rn).onRenderUpdate(i=>i.frameId),jne=(i=1)=>(console.warn('TSL: timerLocal() is deprecated. Use "time" instead.'),yA.mul(i)),Wne=(i=1)=>(console.warn('TSL: timerGlobal() is deprecated. Use "time" instead.'),yA.mul(i)),$ne=(i=1)=>(console.warn('TSL: timerDelta() is deprecated. Use "deltaTime" instead.'),rB.mul(i)),Xne=(i=yA)=>i.add(.75).mul(Math.PI*2).sin().mul(.5).add(.5),Yne=(i=yA)=>i.fract().round(),Qne=(i=yA)=>i.add(.5).fract().mul(2).sub(1).abs(),Kne=(i=yA)=>i.fract(),Zne=je(([i,e,t=Et(.5)])=>yE(i.sub(t),e).add(t)),Jne=je(([i,e,t=Et(.5)])=>{const n=i.sub(t),r=n.dot(n),a=r.mul(r).mul(e);return i.add(n.mul(a))}),eie=je(({position:i=null,horizontal:e=!0,vertical:t=!1})=>{let n;i!==null?(n=$o.toVar(),n[3][0]=i.x,n[3][1]=i.y,n[3][2]=i.z):n=$o;const r=so.mul(n);return xg(e)&&(r[0][0]=$o[0].length(),r[0][1]=0,r[0][2]=0),xg(t)&&(r[1][0]=0,r[1][1]=$o[1].length(),r[1][2]=0),r[2][0]=0,r[2][1]=0,r[2][2]=1,_A.mul(r).mul(Gr)}),tie=je(([i=null])=>{const e=ty();return ty(hE(i)).sub(e).lessThan(0).select(bu,i)});class nie extends Mn{static get type(){return"SpriteSheetUVNode"}constructor(e,t=Er(),n=ge(0)){super("vec2"),this.countNode=e,this.uvNode=t,this.frameNode=n}setup(){const{frameNode:e,uvNode:t,countNode:n}=this,{width:r,height:s}=n,a=e.mod(r.mul(s)).floor(),l=a.mod(r),u=s.sub(a.add(1).div(r).ceil()),h=n.reciprocal(),g=Et(l,u);return t.add(g).mul(h)}}const iie=ht(nie);class rie extends Mn{static get type(){return"TriplanarTexturesNode"}constructor(e,t=null,n=null,r=ge(1),s=Gr,a=no){super("vec4"),this.textureXNode=e,this.textureYNode=t,this.textureZNode=n,this.scaleNode=r,this.positionNode=s,this.normalNode=a}setup(){const{textureXNode:e,textureYNode:t,textureZNode:n,scaleNode:r,positionNode:s,normalNode:a}=this;let l=a.abs().normalize();l=l.div(l.dot(Ne(1)));const u=s.yz.mul(r),h=s.zx.mul(r),g=s.xy.mul(r),v=e.value,x=t!==null?t.value:v,S=n!==null?n.value:v,w=Ai(v,u).mul(l.x),R=Ai(x,h).mul(l.y),C=Ai(S,g).mul(l.z);return Qr(w,R,C)}}const sB=ht(rie),sie=(...i)=>sB(...i),Cd=new Yl,Cf=new ce,Rd=new ce,iS=new ce,um=new kn,fv=new ce(0,0,-1),Hl=new Pn,cm=new ce,Av=new ce,hm=new Pn,dv=new dt,iy=new Wh,aie=bu.flipX();iy.depthTexture=new qc(1,1);let rS=!1;class bE extends yu{static get type(){return"ReflectorNode"}constructor(e={}){super(e.defaultTexture||iy.texture,aie),this._reflectorBaseNode=e.reflector||new oie(this,e),this._depthNode=null,this.setUpdateMatrix(!1)}get reflector(){return this._reflectorBaseNode}get target(){return this._reflectorBaseNode.target}getDepthNode(){if(this._depthNode===null){if(this._reflectorBaseNode.depth!==!0)throw new Error("THREE.ReflectorNode: Depth node can only be requested when the reflector is created with { depth: true }. ");this._depthNode=gt(new bE({defaultTexture:iy.depthTexture,reflector:this._reflectorBaseNode}))}return this._depthNode}setup(e){return e.object.isQuadMesh||this._reflectorBaseNode.build(e),super.setup(e)}clone(){const e=new this.constructor(this.reflectorNode);return e._reflectorBaseNode=this._reflectorBaseNode,e}}class oie extends Mn{static get type(){return"ReflectorBaseNode"}constructor(e,t={}){super();const{target:n=new vr,resolution:r=1,generateMipmaps:s=!1,bounces:a=!0,depth:l=!1}=t;this.textureNode=e,this.target=n,this.resolution=r,this.generateMipmaps=s,this.bounces=a,this.depth=l,this.updateBeforeType=a?jn.RENDER:jn.FRAME,this.virtualCameras=new WeakMap,this.renderTargets=new WeakMap}_updateResolution(e,t){const n=this.resolution;t.getDrawingBufferSize(dv),e.setSize(Math.round(dv.width*n),Math.round(dv.height*n))}setup(e){return this._updateResolution(iy,e.renderer),super.setup(e)}getVirtualCamera(e){let t=this.virtualCameras.get(e);return t===void 0&&(t=e.clone(),this.virtualCameras.set(e,t)),t}getRenderTarget(e){let t=this.renderTargets.get(e);return t===void 0&&(t=new Wh(0,0,{type:Gs}),this.generateMipmaps===!0&&(t.texture.minFilter=GF,t.texture.generateMipmaps=!0),this.depth===!0&&(t.depthTexture=new qc),this.renderTargets.set(e,t)),t}updateBefore(e){if(this.bounces===!1&&rS)return!1;rS=!0;const{scene:t,camera:n,renderer:r,material:s}=e,{target:a}=this,l=this.getVirtualCamera(n),u=this.getRenderTarget(l);if(r.getDrawingBufferSize(dv),this._updateResolution(u,r),Rd.setFromMatrixPosition(a.matrixWorld),iS.setFromMatrixPosition(n.matrixWorld),um.extractRotation(a.matrixWorld),Cf.set(0,0,1),Cf.applyMatrix4(um),cm.subVectors(Rd,iS),cm.dot(Cf)>0)return;cm.reflect(Cf).negate(),cm.add(Rd),um.extractRotation(n.matrixWorld),fv.set(0,0,-1),fv.applyMatrix4(um),fv.add(iS),Av.subVectors(Rd,fv),Av.reflect(Cf).negate(),Av.add(Rd),l.coordinateSystem=n.coordinateSystem,l.position.copy(cm),l.up.set(0,1,0),l.up.applyMatrix4(um),l.up.reflect(Cf),l.lookAt(Av),l.near=n.near,l.far=n.far,l.updateMatrixWorld(),l.projectionMatrix.copy(n.projectionMatrix),Cd.setFromNormalAndCoplanarPoint(Cf,Rd),Cd.applyMatrix4(l.matrixWorldInverse),Hl.set(Cd.normal.x,Cd.normal.y,Cd.normal.z,Cd.constant);const h=l.projectionMatrix;hm.x=(Math.sign(Hl.x)+h.elements[8])/h.elements[0],hm.y=(Math.sign(Hl.y)+h.elements[9])/h.elements[5],hm.z=-1,hm.w=(1+h.elements[10])/h.elements[14],Hl.multiplyScalar(1/Hl.dot(hm));const g=0;h.elements[2]=Hl.x,h.elements[6]=Hl.y,h.elements[10]=r.coordinateSystem===pu?Hl.z-g:Hl.z+1-g,h.elements[14]=Hl.w,this.textureNode.value=u.texture,this.depth===!0&&(this.textureNode.getDepthNode().value=u.depthTexture),s.visible=!1;const v=r.getRenderTarget(),x=r.getMRT(),S=r.autoClear;r.setMRT(null),r.setRenderTarget(u),r.autoClear=!0,r.render(t,l),r.setMRT(x),r.setRenderTarget(v),r.autoClear=S,s.visible=!0,rS=!1}}const lie=i=>gt(new bE(i)),sS=new kg(-1,1,1,-1,0,1);class uie extends Ki{constructor(e=!1){super();const t=e===!1?[0,-1,0,1,2,1]:[0,2,0,0,2,0];this.setAttribute("position",new wi([-1,3,0,-1,-1,0,3,-1,0],3)),this.setAttribute("uv",new wi(t,2))}}const cie=new uie;class SE extends zi{constructor(e=null){super(cie,e),this.camera=sS,this.isQuadMesh=!0}async renderAsync(e){return e.renderAsync(this,sS)}render(e){e.render(this,sS)}}const hie=new dt;class fie extends yu{static get type(){return"RTTNode"}constructor(e,t=null,n=null,r={type:Gs}){const s=new Wh(t,n,r);super(s.texture,Er()),this.node=e,this.width=t,this.height=n,this.pixelRatio=1,this.renderTarget=s,this.textureNeedsUpdate=!0,this.autoUpdate=!0,this._rttNode=null,this._quadMesh=new SE(new Vr),this.updateBeforeType=jn.RENDER}get autoSize(){return this.width===null}setup(e){return this._rttNode=this.node.context(e.getSharedContext()),this._quadMesh.material.name="RTT",this._quadMesh.material.needsUpdate=!0,super.setup(e)}setSize(e,t){this.width=e,this.height=t;const n=e*this.pixelRatio,r=t*this.pixelRatio;this.renderTarget.setSize(n,r),this.textureNeedsUpdate=!0}setPixelRatio(e){this.pixelRatio=e,this.setSize(this.width,this.height)}updateBefore({renderer:e}){if(this.textureNeedsUpdate===!1&&this.autoUpdate===!1)return;if(this.textureNeedsUpdate=!1,this.autoSize===!0){this.pixelRatio=e.getPixelRatio();const n=e.getSize(hie);this.setSize(n.width,n.height)}this._quadMesh.material.fragmentNode=this._rttNode;const t=e.getRenderTarget();e.setRenderTarget(this.renderTarget),this._quadMesh.render(e),e.setRenderTarget(t)}clone(){const e=new yu(this.value,this.uvNode,this.levelNode);return e.sampler=this.sampler,e.referenceNode=this,e}}const aB=(i,...e)=>gt(new fie(gt(i),...e)),Aie=(i,...e)=>i.isTextureNode?i:i.isPassNode?i.getTextureNode():aB(i,...e),zd=je(([i,e,t],n)=>{let r;n.renderer.coordinateSystem===pu?(i=Et(i.x,i.y.oneMinus()).mul(2).sub(1),r=dn(Ne(i,e),1)):r=dn(Ne(i.x,i.y.oneMinus(),e).mul(2).sub(1),1);const s=dn(t.mul(r));return s.xyz.div(s.w)}),die=je(([i,e])=>{const t=e.mul(dn(i,1)),n=t.xy.div(t.w).mul(.5).add(.5).toVar();return Et(n.x,n.y.oneMinus())}),pie=je(([i,e,t])=>{const n=Fh(Fr(e)),r=ms(i.mul(n)).toVar(),s=Fr(e,r).toVar(),a=Fr(e,r.sub(ms(2,0))).toVar(),l=Fr(e,r.sub(ms(1,0))).toVar(),u=Fr(e,r.add(ms(1,0))).toVar(),h=Fr(e,r.add(ms(2,0))).toVar(),g=Fr(e,r.add(ms(0,2))).toVar(),v=Fr(e,r.add(ms(0,1))).toVar(),x=Fr(e,r.sub(ms(0,1))).toVar(),S=Fr(e,r.sub(ms(0,2))).toVar(),w=ur(Ti(ge(2).mul(l).sub(a),s)).toVar(),R=ur(Ti(ge(2).mul(u).sub(h),s)).toVar(),C=ur(Ti(ge(2).mul(v).sub(g),s)).toVar(),E=ur(Ti(ge(2).mul(x).sub(S),s)).toVar(),B=zd(i,s,t).toVar(),L=w.lessThan(R).select(B.sub(zd(i.sub(Et(ge(1).div(n.x),0)),l,t)),B.negate().add(zd(i.add(Et(ge(1).div(n.x),0)),u,t))),O=C.lessThan(E).select(B.sub(zd(i.add(Et(0,ge(1).div(n.y))),v,t)),B.negate().add(zd(i.sub(Et(0,ge(1).div(n.y))),x,t)));return Fc(ky(L,O))});class t_ extends Ig{constructor(e,t,n=Float32Array){const r=ArrayBuffer.isView(e)?e:new n(e*t);super(r,t),this.isStorageInstancedBufferAttribute=!0}}class mie extends wr{constructor(e,t,n=Float32Array){const r=ArrayBuffer.isView(e)?e:new n(e*t);super(r,t),this.isStorageBufferAttribute=!0}}class gie extends vA{static get type(){return"StorageArrayElementNode"}constructor(e,t){super(e,t),this.isStorageArrayElementNode=!0}set storageBufferNode(e){this.node=e}get storageBufferNode(){return this.node}setup(e){return e.isAvailable("storageBuffer")===!1&&this.node.isPBO===!0&&e.setupPBO(this.node),super.setup(e)}generate(e,t){let n;const r=e.context.assign;if(e.isAvailable("storageBuffer")===!1?this.node.isPBO===!0&&r!==!0&&(this.node.value.isInstancedBufferAttribute||e.shaderStage!=="compute")?n=e.generatePBO(this):n=this.node.build(e):n=super.generate(e),r!==!0){const s=this.getNodeType(e);n=e.format(n,s,t)}return n}}const vie=ht(gie);class _ie extends rE{static get type(){return"StorageBufferNode"}constructor(e,t=null,n=0){t===null&&(e.isStorageBufferAttribute||e.isStorageInstancedBufferAttribute)&&(t=LP(e.itemSize),n=e.count),super(e,t,n),this.isStorageBufferNode=!0,this.access=sa.READ_WRITE,this.isAtomic=!1,this.isPBO=!1,this._attribute=null,this._varying=null,this.global=!0,e.isStorageBufferAttribute!==!0&&e.isStorageInstancedBufferAttribute!==!0&&(e.isInstancedBufferAttribute?e.isStorageInstancedBufferAttribute=!0:e.isStorageBufferAttribute=!0)}getHash(e){if(this.bufferCount===0){let t=e.globalCache.getData(this.value);return t===void 0&&(t={node:this},e.globalCache.setData(this.value,t)),t.node.uuid}return this.uuid}getInputType(){return this.value.isIndirectStorageBufferAttribute?"indirectStorageBuffer":"storageBuffer"}element(e){return vie(this,e)}setPBO(e){return this.isPBO=e,this}getPBO(){return this.isPBO}setAccess(e){return this.access=e,this}toReadOnly(){return this.setAccess(sa.READ_ONLY)}setAtomic(e){return this.isAtomic=e,this}toAtomic(){return this.setAtomic(!0)}getAttributeData(){return this._attribute===null&&(this._attribute=$g(this.value),this._varying=ro(this._attribute)),{attribute:this._attribute,varying:this._varying}}getNodeType(e){if(e.isAvailable("storageBuffer")||e.isAvailable("indirectStorageBuffer"))return super.getNodeType(e);const{attribute:t}=this.getAttributeData();return t.getNodeType(e)}generate(e){if(e.isAvailable("storageBuffer")||e.isAvailable("indirectStorageBuffer"))return super.generate(e);const{attribute:t,varying:n}=this.getAttributeData(),r=n.build(e);return e.registerTransform(r,t),r}}const Qy=(i,e=null,t=0)=>gt(new _ie(i,e,t)),yie=(i,e,t)=>(console.warn('THREE.TSL: "storageObject()" is deprecated. Use "storage().setPBO( true )" instead.'),Qy(i,e,t).setPBO(!0)),xie=(i,e="float")=>{const t=BP(e),n=UP(e),r=new mie(i,t,n);return Qy(r,e,i)},bie=(i,e="float")=>{const t=BP(e),n=UP(e),r=new t_(i,t,n);return Qy(r,e,i)};class Sie extends y9{static get type(){return"VertexColorNode"}constructor(e=0){super(null,"vec4"),this.isVertexColorNode=!0,this.index=e}getAttributeName(){const e=this.index;return"color"+(e>0?e:"")}generate(e){const t=this.getAttributeName(e),n=e.hasGeometryAttribute(t);let r;return n===!0?r=super.generate(e):r=e.generateConst(this.nodeType,new Pn(1,1,1,1)),r}serialize(e){super.serialize(e),e.index=this.index}deserialize(e){super.deserialize(e),this.index=e.index}}const Tie=i=>gt(new Sie(i));class wie extends Mn{static get type(){return"PointUVNode"}constructor(){super("vec2"),this.isPointUVNode=!0}generate(){return"vec2( gl_PointCoord.x, 1.0 - gl_PointCoord.y )"}}const Mie=zt(wie),fm=new la,aS=new kn;class Ya extends Mn{static get type(){return"SceneNode"}constructor(e=Ya.BACKGROUND_BLURRINESS,t=null){super(),this.scope=e,this.scene=t}setup(e){const t=this.scope,n=this.scene!==null?this.scene:e.scene;let r;return t===Ya.BACKGROUND_BLURRINESS?r=ji("backgroundBlurriness","float",n):t===Ya.BACKGROUND_INTENSITY?r=ji("backgroundIntensity","float",n):t===Ya.BACKGROUND_ROTATION?r=gn("mat4").label("backgroundRotation").setGroup(Rn).onRenderUpdate(()=>{const s=n.background;return s!==null&&s.isTexture&&s.mapping!==Pw?(fm.copy(n.backgroundRotation),fm.x*=-1,fm.y*=-1,fm.z*=-1,aS.makeRotationFromEuler(fm)):aS.identity(),aS}):console.error("THREE.SceneNode: Unknown scope:",t),r}}Ya.BACKGROUND_BLURRINESS="backgroundBlurriness";Ya.BACKGROUND_INTENSITY="backgroundIntensity";Ya.BACKGROUND_ROTATION="backgroundRotation";const oB=zt(Ya,Ya.BACKGROUND_BLURRINESS),JT=zt(Ya,Ya.BACKGROUND_INTENSITY),lB=zt(Ya,Ya.BACKGROUND_ROTATION);class Eie extends yu{static get type(){return"StorageTextureNode"}constructor(e,t,n=null){super(e,t),this.storeNode=n,this.isStorageTextureNode=!0,this.access=sa.WRITE_ONLY}getInputType(){return"storageTexture"}setup(e){super.setup(e);const t=e.getNodeProperties(this);t.storeNode=this.storeNode}setAccess(e){return this.access=e,this}generate(e,t){let n;return this.storeNode!==null?n=this.generateStore(e):n=super.generate(e,t),n}toReadWrite(){return this.setAccess(sa.READ_WRITE)}toReadOnly(){return this.setAccess(sa.READ_ONLY)}toWriteOnly(){return this.setAccess(sa.WRITE_ONLY)}generateStore(e){const t=e.getNodeProperties(this),{uvNode:n,storeNode:r}=t,s=super.generate(e,"property"),a=n.build(e,"uvec2"),l=r.build(e,"vec4"),u=e.generateTextureStore(e,s,a,l);e.addLineFlowCode(u,this)}}const uB=ht(Eie),Cie=(i,e,t)=>{const n=uB(i,e,t);return t!==null&&n.append(),n};class Rie extends jy{static get type(){return"UserDataNode"}constructor(e,t,n=null){super(e,t,n),this.userData=n}updateReference(e){return this.reference=this.userData!==null?this.userData:e.object.userData,this.reference}}const Nie=(i,e,t)=>gt(new Rie(i,e,t)),rN=new WeakMap;class Die extends Zr{static get type(){return"VelocityNode"}constructor(){super("vec2"),this.projectionMatrix=null,this.updateType=jn.OBJECT,this.updateAfterType=jn.OBJECT,this.previousModelWorldMatrix=gn(new kn),this.previousProjectionMatrix=gn(new kn).setGroup(Rn),this.previousCameraViewMatrix=gn(new kn)}setProjectionMatrix(e){this.projectionMatrix=e}update({frameId:e,camera:t,object:n}){const r=sN(n);this.previousModelWorldMatrix.value.copy(r);const s=cB(t);s.frameId!==e&&(s.frameId=e,s.previousProjectionMatrix===void 0?(s.previousProjectionMatrix=new kn,s.previousCameraViewMatrix=new kn,s.currentProjectionMatrix=new kn,s.currentCameraViewMatrix=new kn,s.previousProjectionMatrix.copy(this.projectionMatrix||t.projectionMatrix),s.previousCameraViewMatrix.copy(t.matrixWorldInverse)):(s.previousProjectionMatrix.copy(s.currentProjectionMatrix),s.previousCameraViewMatrix.copy(s.currentCameraViewMatrix)),s.currentProjectionMatrix.copy(this.projectionMatrix||t.projectionMatrix),s.currentCameraViewMatrix.copy(t.matrixWorldInverse),this.previousProjectionMatrix.value.copy(s.previousProjectionMatrix),this.previousCameraViewMatrix.value.copy(s.previousCameraViewMatrix))}updateAfter({object:e}){sN(e).copy(e.matrixWorld)}setup(){const e=this.projectionMatrix===null?_A:gn(this.projectionMatrix),t=this.previousCameraViewMatrix.mul(this.previousModelWorldMatrix),n=e.mul(Q0).mul(Gr),r=this.previousProjectionMatrix.mul(t).mul(ey),s=n.xy.div(n.w),a=r.xy.div(r.w);return Ti(s,a)}}function cB(i){let e=rN.get(i);return e===void 0&&(e={},rN.set(i,e)),e}function sN(i,e=0){const t=cB(i);let n=t[e];return n===void 0&&(t[e]=n=new kn),n}const Pie=zt(Die),hB=je(([i,e])=>to(1,i.oneMinus().div(e)).oneMinus()).setLayout({name:"blendBurn",type:"vec3",inputs:[{name:"base",type:"vec3"},{name:"blend",type:"vec3"}]}),fB=je(([i,e])=>to(i.div(e.oneMinus()),1)).setLayout({name:"blendDodge",type:"vec3",inputs:[{name:"base",type:"vec3"},{name:"blend",type:"vec3"}]}),AB=je(([i,e])=>i.oneMinus().mul(e.oneMinus()).oneMinus()).setLayout({name:"blendScreen",type:"vec3",inputs:[{name:"base",type:"vec3"},{name:"blend",type:"vec3"}]}),dB=je(([i,e])=>Fi(i.mul(2).mul(e),i.oneMinus().mul(2).mul(e.oneMinus()).oneMinus(),Fy(.5,i))).setLayout({name:"blendOverlay",type:"vec3",inputs:[{name:"base",type:"vec3"},{name:"blend",type:"vec3"}]}),Lie=je(([i,e])=>{const t=e.a.add(i.a.mul(e.a.oneMinus()));return dn(e.rgb.mul(e.a).add(i.rgb.mul(i.a).mul(e.a.oneMinus())).div(t),t)}).setLayout({name:"blendColor",type:"vec4",inputs:[{name:"base",type:"vec4"},{name:"blend",type:"vec4"}]}),Uie=(...i)=>(console.warn('THREE.TSL: "burn" has been renamed. Use "blendBurn" instead.'),hB(i)),Bie=(...i)=>(console.warn('THREE.TSL: "dodge" has been renamed. Use "blendDodge" instead.'),fB(i)),Oie=(...i)=>(console.warn('THREE.TSL: "screen" has been renamed. Use "blendScreen" instead.'),AB(i)),Iie=(...i)=>(console.warn('THREE.TSL: "overlay" has been renamed. Use "blendOverlay" instead.'),dB(i)),Fie=je(([i])=>TE(i.rgb)),kie=je(([i,e=ge(1)])=>e.mix(TE(i.rgb),i.rgb)),zie=je(([i,e=ge(1)])=>{const t=Qr(i.r,i.g,i.b).div(3),n=i.r.max(i.g.max(i.b)),r=n.sub(t).mul(e).mul(-3);return Fi(i.rgb,n,r)}),Gie=je(([i,e=ge(1)])=>{const t=Ne(.57735,.57735,.57735),n=e.cos();return Ne(i.rgb.mul(n).add(t.cross(i.rgb).mul(e.sin()).add(t.mul(Xh(t,i.rgb).mul(n.oneMinus())))))}),TE=(i,e=Ne(ai.getLuminanceCoefficients(new ce)))=>Xh(i,e),qie=je(([i,e=Ne(1),t=Ne(0),n=Ne(1),r=ge(1),s=Ne(ai.getLuminanceCoefficients(new ce,Ro))])=>{const a=i.rgb.dot(Ne(s)),l=qr(i.rgb.mul(e).add(t),0).toVar(),u=l.pow(n).toVar();return ti(l.r.greaterThan(0),()=>{l.r.assign(u.r)}),ti(l.g.greaterThan(0),()=>{l.g.assign(u.g)}),ti(l.b.greaterThan(0),()=>{l.b.assign(u.b)}),l.assign(a.add(l.sub(a).mul(r))),dn(l.rgb,i.a)});class Vie extends Zr{static get type(){return"PosterizeNode"}constructor(e,t){super(),this.sourceNode=e,this.stepsNode=t}setup(){const{sourceNode:e,stepsNode:t}=this;return e.mul(t).floor().div(t)}}const Hie=ht(Vie),jie=new dt;class pB extends yu{static get type(){return"PassTextureNode"}constructor(e,t){super(t),this.passNode=e,this.setUpdateMatrix(!1)}setup(e){return e.object.isQuadMesh&&this.passNode.build(e),super.setup(e)}clone(){return new this.constructor(this.passNode,this.value)}}class aN extends pB{static get type(){return"PassMultipleTextureNode"}constructor(e,t,n=!1){super(e,null),this.textureName=t,this.previousTexture=n}updateTexture(){this.value=this.previousTexture?this.passNode.getPreviousTexture(this.textureName):this.passNode.getTexture(this.textureName)}setup(e){return this.updateTexture(),super.setup(e)}clone(){return new this.constructor(this.passNode,this.textureName,this.previousTexture)}}class Tu extends Zr{static get type(){return"PassNode"}constructor(e,t,n,r={}){super("vec4"),this.scope=e,this.scene=t,this.camera=n,this.options=r,this._pixelRatio=1,this._width=1,this._height=1;const s=new qc;s.isRenderTargetTexture=!0,s.name="depth";const a=new Wh(this._width*this._pixelRatio,this._height*this._pixelRatio,{type:Gs,...r});a.texture.name="output",a.depthTexture=s,this.renderTarget=a,this._textures={output:a.texture,depth:s},this._textureNodes={},this._linearDepthNodes={},this._viewZNodes={},this._previousTextures={},this._previousTextureNodes={},this._cameraNear=gn(0),this._cameraFar=gn(0),this._mrt=null,this.isPassNode=!0,this.updateBeforeType=jn.FRAME}setMRT(e){return this._mrt=e,this}getMRT(){return this._mrt}isGlobal(){return!0}getTexture(e){let t=this._textures[e];return t===void 0&&(t=this.renderTarget.texture.clone(),t.name=e,this._textures[e]=t,this.renderTarget.textures.push(t)),t}getPreviousTexture(e){let t=this._previousTextures[e];return t===void 0&&(t=this.getTexture(e).clone(),this._previousTextures[e]=t),t}toggleTexture(e){const t=this._previousTextures[e];if(t!==void 0){const n=this._textures[e],r=this.renderTarget.textures.indexOf(n);this.renderTarget.textures[r]=t,this._textures[e]=t,this._previousTextures[e]=n,this._textureNodes[e].updateTexture(),this._previousTextureNodes[e].updateTexture()}}getTextureNode(e="output"){let t=this._textureNodes[e];return t===void 0&&(t=gt(new aN(this,e)),t.updateTexture(),this._textureNodes[e]=t),t}getPreviousTextureNode(e="output"){let t=this._previousTextureNodes[e];return t===void 0&&(this._textureNodes[e]===void 0&&this.getTextureNode(e),t=gt(new aN(this,e,!0)),t.updateTexture(),this._previousTextureNodes[e]=t),t}getViewZNode(e="depth"){let t=this._viewZNodes[e];if(t===void 0){const n=this._cameraNear,r=this._cameraFar;this._viewZNodes[e]=t=fE(this.getTextureNode(e),n,r)}return t}getLinearDepthNode(e="depth"){let t=this._linearDepthNodes[e];if(t===void 0){const n=this._cameraNear,r=this._cameraFar,s=this.getViewZNode(e);this._linearDepthNodes[e]=t=s0(s,n,r)}return t}setup({renderer:e}){return this.renderTarget.samples=this.options.samples===void 0?e.samples:this.options.samples,e.backend.isWebGLBackend===!0&&(this.renderTarget.samples=0),this.scope===Tu.COLOR?this.getTextureNode():this.getLinearDepthNode()}updateBefore(e){const{renderer:t}=e,{scene:n,camera:r}=this;this._pixelRatio=t.getPixelRatio();const s=t.getSize(jie);this.setSize(s.width,s.height);const a=t.getRenderTarget(),l=t.getMRT();this._cameraNear.value=r.near,this._cameraFar.value=r.far;for(const u in this._previousTextures)this.toggleTexture(u);t.setRenderTarget(this.renderTarget),t.setMRT(this._mrt),t.render(n,r),t.setRenderTarget(a),t.setMRT(l)}setSize(e,t){this._width=e,this._height=t;const n=this._width*this._pixelRatio,r=this._height*this._pixelRatio;this.renderTarget.setSize(n,r)}setPixelRatio(e){this._pixelRatio=e,this.setSize(this._width,this._height)}dispose(){this.renderTarget.dispose()}}Tu.COLOR="color";Tu.DEPTH="depth";const Wie=(i,e,t)=>gt(new Tu(Tu.COLOR,i,e,t)),$ie=(i,e)=>gt(new pB(i,e)),Xie=(i,e,t)=>gt(new Tu(Tu.DEPTH,i,e,t));class Yie extends Tu{static get type(){return"ToonOutlinePassNode"}constructor(e,t,n,r,s){super(Tu.COLOR,e,t),this.colorNode=n,this.thicknessNode=r,this.alphaNode=s,this._materialCache=new WeakMap}updateBefore(e){const{renderer:t}=e,n=t.getRenderObjectFunction();t.setRenderObjectFunction((r,s,a,l,u,h,g,v)=>{if((u.isMeshToonMaterial||u.isMeshToonNodeMaterial)&&u.wireframe===!1){const x=this._getOutlineMaterial(u);t.renderObject(r,s,a,l,x,h,g,v)}t.renderObject(r,s,a,l,u,h,g,v)}),super.updateBefore(e),t.setRenderObjectFunction(n)}_createMaterial(){const e=new Vr;e.isMeshToonOutlineMaterial=!0,e.name="Toon_Outline",e.side=hr;const t=no.negate(),n=_A.mul(Q0),r=ge(1),s=n.mul(dn(Gr,1)),a=n.mul(dn(Gr.add(t),1)),l=Fc(s.sub(a));return e.vertexNode=s.add(l.mul(this.thicknessNode).mul(s.w).mul(r)),e.colorNode=dn(this.colorNode,this.alphaNode),e}_getOutlineMaterial(e){let t=this._materialCache.get(e);return t===void 0&&(t=this._createMaterial(),this._materialCache.set(e,t)),t}}const Qie=(i,e,t=new sn(0,0,0),n=.003,r=1)=>gt(new Yie(i,e,gt(t),gt(n),gt(r))),mB=je(([i,e])=>i.mul(e).clamp()).setLayout({name:"linearToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),gB=je(([i,e])=>(i=i.mul(e),i.div(i.add(1)).clamp())).setLayout({name:"reinhardToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),vB=je(([i,e])=>{i=i.mul(e),i=i.sub(.004).max(0);const t=i.mul(i.mul(6.2).add(.5)),n=i.mul(i.mul(6.2).add(1.7)).add(.06);return t.div(n).pow(2.2)}).setLayout({name:"cineonToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),Kie=je(([i])=>{const e=i.mul(i.add(.0245786)).sub(90537e-9),t=i.mul(i.add(.432951).mul(.983729)).add(.238081);return e.div(t)}),_B=je(([i,e])=>{const t=ha(.59719,.35458,.04823,.076,.90834,.01566,.0284,.13383,.83777),n=ha(1.60475,-.53108,-.07367,-.10208,1.10813,-.00605,-.00327,-.07276,1.07602);return i=i.mul(e).div(.6),i=t.mul(i),i=Kie(i),i=n.mul(i),i.clamp()}).setLayout({name:"acesFilmicToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),Zie=ha(Ne(1.6605,-.1246,-.0182),Ne(-.5876,1.1329,-.1006),Ne(-.0728,-.0083,1.1187)),Jie=ha(Ne(.6274,.0691,.0164),Ne(.3293,.9195,.088),Ne(.0433,.0113,.8956)),ere=je(([i])=>{const e=Ne(i).toVar(),t=Ne(e.mul(e)).toVar(),n=Ne(t.mul(t)).toVar();return ge(15.5).mul(n.mul(t)).sub(Wn(40.14,n.mul(e))).add(Wn(31.96,n).sub(Wn(6.868,t.mul(e))).add(Wn(.4298,t).add(Wn(.1191,e).sub(.00232))))}),yB=je(([i,e])=>{const t=Ne(i).toVar(),n=ha(Ne(.856627153315983,.137318972929847,.11189821299995),Ne(.0951212405381588,.761241990602591,.0767994186031903),Ne(.0482516061458583,.101439036467562,.811302368396859)),r=ha(Ne(1.1271005818144368,-.1413297634984383,-.14132976349843826),Ne(-.11060664309660323,1.157823702216272,-.11060664309660294),Ne(-.016493938717834573,-.016493938717834257,1.2519364065950405)),s=ge(-12.47393),a=ge(4.026069);return t.mulAssign(e),t.assign(Jie.mul(t)),t.assign(n.mul(t)),t.assign(qr(t,1e-10)),t.assign(cu(t)),t.assign(t.sub(s).div(a.sub(s))),t.assign(vu(t,0,1)),t.assign(ere(t)),t.assign(r.mul(t)),t.assign(Cl(qr(Ne(0),t),Ne(2.2))),t.assign(Zie.mul(t)),t.assign(vu(t,0,1)),t}).setLayout({name:"agxToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),xB=je(([i,e])=>{const t=ge(.76),n=ge(.15);i=i.mul(e);const r=to(i.r,to(i.g,i.b)),s=zs(r.lessThan(.08),r.sub(Wn(6.25,r.mul(r))),.04);i.subAssign(s);const a=qr(i.r,qr(i.g,i.b));ti(a.lessThan(t),()=>i);const l=Ti(1,t),u=Ti(1,l.mul(l).div(a.add(l.sub(t))));i.mulAssign(u.div(a));const h=Ti(1,Dl(1,n.mul(a.sub(u)).add(1)));return Fi(i,Ne(u),h)}).setLayout({name:"neutralToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]});class rs extends Mn{static get type(){return"CodeNode"}constructor(e="",t=[],n=""){super("code"),this.isCodeNode=!0,this.code=e,this.includes=t,this.language=n}isGlobal(){return!0}setIncludes(e){return this.includes=e,this}getIncludes(){return this.includes}generate(e){const t=this.getIncludes(e);for(const r of t)r.build(e);const n=e.getCodeFromNode(this,this.getNodeType(e));return n.code=this.code,n.code}serialize(e){super.serialize(e),e.code=this.code,e.language=this.language}deserialize(e){super.deserialize(e),this.code=e.code,this.language=e.language}}const Ky=ht(rs),tre=(i,e)=>Ky(i,e,"js"),nre=(i,e)=>Ky(i,e,"wgsl"),ire=(i,e)=>Ky(i,e,"glsl");class bB extends rs{static get type(){return"FunctionNode"}constructor(e="",t=[],n=""){super(e,t,n)}getNodeType(e){return this.getNodeFunction(e).type}getInputs(e){return this.getNodeFunction(e).inputs}getNodeFunction(e){const t=e.getDataFromNode(this);let n=t.nodeFunction;return n===void 0&&(n=e.parser.parseFunction(this.code),t.nodeFunction=n),n}generate(e,t){super.generate(e);const n=this.getNodeFunction(e),r=n.name,s=n.type,a=e.getCodeFromNode(this,s);r!==""&&(a.name=r);const l=e.getPropertyName(a),u=this.getNodeFunction(e).getCode(l);return a.code=u+` +`,t==="property"?l:e.format(`${l}()`,s,t)}}const SB=(i,e=[],t="")=>{for(let s=0;sn.call(...s);return r.functionNode=n,r},rre=(i,e)=>SB(i,e,"glsl"),sre=(i,e)=>SB(i,e,"wgsl");class are extends Mn{static get type(){return"ScriptableValueNode"}constructor(e=null){super(),this._value=e,this._cache=null,this.inputType=null,this.outputType=null,this.events=new zc,this.isScriptableValueNode=!0}get isScriptableOutputNode(){return this.outputType!==null}set value(e){this._value!==e&&(this._cache&&this.inputType==="URL"&&this.value.value instanceof ArrayBuffer&&(URL.revokeObjectURL(this._cache),this._cache=null),this._value=e,this.events.dispatchEvent({type:"change"}),this.refresh())}get value(){return this._value}refresh(){this.events.dispatchEvent({type:"refresh"})}getValue(){const e=this.value;if(e&&this._cache===null&&this.inputType==="URL"&&e.value instanceof ArrayBuffer)this._cache=URL.createObjectURL(new Blob([e.value]));else if(e&&e.value!==null&&e.value!==void 0&&((this.inputType==="URL"||this.inputType==="String")&&typeof e.value=="string"||this.inputType==="Number"&&typeof e.value=="number"||this.inputType==="Vector2"&&e.value.isVector2||this.inputType==="Vector3"&&e.value.isVector3||this.inputType==="Vector4"&&e.value.isVector4||this.inputType==="Color"&&e.value.isColor||this.inputType==="Matrix3"&&e.value.isMatrix3||this.inputType==="Matrix4"&&e.value.isMatrix4))return e.value;return this._cache||e}getNodeType(e){return this.value&&this.value.isNode?this.value.getNodeType(e):"float"}setup(){return this.value&&this.value.isNode?this.value:ge()}serialize(e){super.serialize(e),this.value!==null?this.inputType==="ArrayBuffer"?e.value=FP(this.value):e.value=this.value?this.value.toJSON(e.meta).uuid:null:e.value=null,e.inputType=this.inputType,e.outputType=this.outputType}deserialize(e){super.deserialize(e);let t=null;e.value!==null&&(e.inputType==="ArrayBuffer"?t=kP(e.value):e.inputType==="Texture"?t=e.meta.textures[e.value]:t=e.meta.nodes[e.value]||null),this.value=t,this.inputType=e.inputType,this.outputType=e.outputType}}const n_=ht(are);class TB extends Map{get(e,t=null,...n){if(this.has(e))return super.get(e);if(t!==null){const r=t(...n);return this.set(e,r),r}}}class ore{constructor(e){this.scriptableNode=e}get parameters(){return this.scriptableNode.parameters}get layout(){return this.scriptableNode.getLayout()}getInputLayout(e){return this.scriptableNode.getInputLayout(e)}get(e){const t=this.parameters[e];return t?t.getValue():null}}const i_=new TB;class lre extends Mn{static get type(){return"ScriptableNode"}constructor(e=null,t={}){super(),this.codeNode=e,this.parameters=t,this._local=new TB,this._output=n_(),this._outputs={},this._source=this.source,this._method=null,this._object=null,this._value=null,this._needsOutputUpdate=!0,this.onRefresh=this.onRefresh.bind(this),this.isScriptableNode=!0}get source(){return this.codeNode?this.codeNode.code:""}setLocal(e,t){return this._local.set(e,t)}getLocal(e){return this._local.get(e)}onRefresh(){this._refresh()}getInputLayout(e){for(const t of this.getLayout())if(t.inputType&&(t.id===e||t.name===e))return t}getOutputLayout(e){for(const t of this.getLayout())if(t.outputType&&(t.id===e||t.name===e))return t}setOutput(e,t){const n=this._outputs;return n[e]===void 0?n[e]=n_(t):n[e].value=t,this}getOutput(e){return this._outputs[e]}getParameter(e){return this.parameters[e]}setParameter(e,t){const n=this.parameters;return t&&t.isScriptableNode?(this.deleteParameter(e),n[e]=t,n[e].getDefaultOutput().events.addEventListener("refresh",this.onRefresh)):t&&t.isScriptableValueNode?(this.deleteParameter(e),n[e]=t,n[e].events.addEventListener("refresh",this.onRefresh)):n[e]===void 0?(n[e]=n_(t),n[e].events.addEventListener("refresh",this.onRefresh)):n[e].value=t,this}getValue(){return this.getDefaultOutput().getValue()}deleteParameter(e){let t=this.parameters[e];return t&&(t.isScriptableNode&&(t=t.getDefaultOutput()),t.events.removeEventListener("refresh",this.onRefresh)),this}clearParameters(){for(const e of Object.keys(this.parameters))this.deleteParameter(e);return this.needsUpdate=!0,this}call(e,...t){const r=this.getObject()[e];if(typeof r=="function")return r(...t)}async callAsync(e,...t){const r=this.getObject()[e];if(typeof r=="function")return r.constructor.name==="AsyncFunction"?await r(...t):r(...t)}getNodeType(e){return this.getDefaultOutputNode().getNodeType(e)}refresh(e=null){e!==null?this.getOutput(e).refresh():this._refresh()}getObject(){if(this.needsUpdate&&this.dispose(),this._object!==null)return this._object;const e=()=>this.refresh(),t=(h,g)=>this.setOutput(h,g),n=new ore(this),r=i_.get("THREE"),s=i_.get("TSL"),a=this.getMethod(),l=[n,this._local,i_,e,t,r,s];this._object=a(...l);const u=this._object.layout;if(u&&(u.cache===!1&&this._local.clear(),this._output.outputType=u.outputType||null,Array.isArray(u.elements)))for(const h of u.elements){const g=h.id||h.name;h.inputType&&(this.getParameter(g)===void 0&&this.setParameter(g,null),this.getParameter(g).inputType=h.inputType),h.outputType&&(this.getOutput(g)===void 0&&this.setOutput(g,null),this.getOutput(g).outputType=h.outputType)}return this._object}deserialize(e){super.deserialize(e);for(const t in this.parameters){let n=this.parameters[t];n.isScriptableNode&&(n=n.getDefaultOutput()),n.events.addEventListener("refresh",this.onRefresh)}}getLayout(){return this.getObject().layout}getDefaultOutputNode(){const e=this.getDefaultOutput().value;return e&&e.isNode?e:ge()}getDefaultOutput(){return this._exec()._output}getMethod(){if(this.needsUpdate&&this.dispose(),this._method!==null)return this._method;const e=["parameters","local","global","refresh","setOutput","THREE","TSL"],n=["layout","init","main","dispose"].join(", "),r="var "+n+`; var output = {}; `,s=` -return { ...output, `+n+" };",a=r+this.codeNode.code+s;return this._method=new Function(...e,a),this._method}dispose(){this._method!==null&&(this._object&&typeof this._object.dispose=="function"&&this._object.dispose(),this._method=null,this._object=null,this._source=null,this._value=null,this._needsOutputUpdate=!0,this._output.value=null,this._outputs={})}setup(){return this.getDefaultOutputNode()}getCacheKey(e){const t=[DP(this.source),this.getDefaultOutputNode().getCacheKey(e)];for(const n in this.parameters)t.push(this.parameters[n].getCacheKey(e));return Ny(t)}set needsUpdate(e){e===!0&&this.dispose()}get needsUpdate(){return this.source!==this._source}_exec(){return this.codeNode===null?this:(this._needsOutputUpdate===!0&&(this._value=this.call("main"),this._needsOutputUpdate=!1),this._output.value=this._value,this)}_refresh(){this.needsUpdate=!0,this._exec(),this._output.refresh()}}const ure=ct(lre);function wB(i){let e;const t=i.context.getViewZ;return t!==void 0&&(e=t(this)),(e||Xr.z).negate()}const wE=je(([i,e],t)=>{const n=wB(t);return kc(i,e,n)}),ME=je(([i],e)=>{const t=wB(e);return i.mul(i,t,t).negate().exp().oneMinus()}),Ng=je(([i,e])=>dn(e.toFloat().mix(Eg.rgb,i.toVec3()),Eg.a));function cre(i,e,t){return console.warn('THREE.TSL: "rangeFog( color, near, far )" is deprecated. Use "fog( color, rangeFogFactor( near, far ) )" instead.'),Ng(i,wE(e,t))}function hre(i,e){return console.warn('THREE.TSL: "densityFog( color, density )" is deprecated. Use "fog( color, densityFogFactor( density ) )" instead.'),Ng(i,ME(e))}let Rf=null,Nf=null;class fre extends Mn{static get type(){return"RangeNode"}constructor(e=ge(),t=ge()){super(),this.minNode=e,this.maxNode=t}getVectorLength(e){const t=e.getTypeLength(Uh(this.minNode.value)),n=e.getTypeLength(Uh(this.maxNode.value));return t>n?t:n}getNodeType(e){return e.object.count>1?e.getTypeFromLength(this.getVectorLength(e)):"float"}setup(e){const t=e.object;let n=null;if(t.count>1){const r=this.minNode.value,s=this.maxNode.value,a=e.getTypeLength(Uh(r)),l=e.getTypeLength(Uh(s));Rf=Rf||new Pn,Nf=Nf||new Pn,Rf.setScalar(0),Nf.setScalar(0),a===1?Rf.setScalar(r):r.isColor?Rf.set(r.r,r.g,r.b,1):Rf.set(r.x,r.y,r.z||0,r.w||0),l===1?Nf.setScalar(s):s.isColor?Nf.set(s.r,s.g,s.b,1):Nf.set(s.x,s.y,s.z||0,s.w||0);const u=4,h=u*t.count,g=new Float32Array(h);for(let x=0;xmt(new dre(i,e)),pre=Zy("numWorkgroups","uvec3"),mre=Zy("workgroupId","uvec3"),gre=Zy("localId","uvec3"),vre=Zy("subgroupSize","uint");class _re extends Mn{constructor(e){super(),this.scope=e}generate(e){const{scope:t}=this,{renderer:n}=e;n.backend.isWebGLBackend===!0?e.addFlowCode(` // ${t}Barrier -`):e.addLineFlowCode(`${t}Barrier()`,this)}}const EE=ct(_re),yre=()=>EE("workgroup").append(),xre=()=>EE("storage").append(),bre=()=>EE("texture").append();class Sre extends vA{constructor(e,t){super(e,t),this.isWorkgroupInfoElementNode=!0}generate(e,t){let n;const r=e.context.assign;if(n=super.generate(e),r!==!0){const s=this.getNodeType(e);n=e.format(n,s,t)}return n}}class Tre extends Mn{constructor(e,t,n=0){super(t),this.bufferType=t,this.bufferCount=n,this.isWorkgroupInfoNode=!0,this.elementType=t,this.scope=e}label(e){return this.name=e,this}setScope(e){return this.scope=e,this}getElementType(){return this.elementType}getInputType(){return`${this.scope}Array`}element(e){return mt(new Sre(this,e))}generate(e){return e.getScopedArray(this.name||`${this.scope}Array_${this.id}`,this.scope.toLowerCase(),this.bufferType,this.bufferCount)}}const wre=(i,e)=>mt(new Tre("Workgroup",i,e));class Ds extends Zr{static get type(){return"AtomicFunctionNode"}constructor(e,t,n,r=null){super("uint"),this.method=e,this.pointerNode=t,this.valueNode=n,this.storeNode=r}getInputType(e){return this.pointerNode.getNodeType(e)}getNodeType(e){return this.getInputType(e)}generate(e){const t=this.method,n=this.getNodeType(e),r=this.getInputType(e),s=this.pointerNode,a=this.valueNode,l=[];l.push(`&${s.build(e,r)}`),l.push(a.build(e,r));const u=`${e.getMethod(t,n)}( ${l.join(", ")} )`;if(this.storeNode!==null){const h=this.storeNode.build(e,r);e.addLineFlowCode(`${h} = ${u}`,this)}else e.addLineFlowCode(u,this)}}Ds.ATOMIC_LOAD="atomicLoad";Ds.ATOMIC_STORE="atomicStore";Ds.ATOMIC_ADD="atomicAdd";Ds.ATOMIC_SUB="atomicSub";Ds.ATOMIC_MAX="atomicMax";Ds.ATOMIC_MIN="atomicMin";Ds.ATOMIC_AND="atomicAnd";Ds.ATOMIC_OR="atomicOr";Ds.ATOMIC_XOR="atomicXor";const Mre=ct(Ds),jc=(i,e,t,n=null)=>{const r=Mre(i,e,t,n);return r.append(),r},Ere=(i,e,t=null)=>jc(Ds.ATOMIC_STORE,i,e,t),Cre=(i,e,t=null)=>jc(Ds.ATOMIC_ADD,i,e,t),Rre=(i,e,t=null)=>jc(Ds.ATOMIC_SUB,i,e,t),Nre=(i,e,t=null)=>jc(Ds.ATOMIC_MAX,i,e,t),Dre=(i,e,t=null)=>jc(Ds.ATOMIC_MIN,i,e,t),Pre=(i,e,t=null)=>jc(Ds.ATOMIC_AND,i,e,t),Lre=(i,e,t=null)=>jc(Ds.ATOMIC_OR,i,e,t),Ure=(i,e,t=null)=>jc(Ds.ATOMIC_XOR,i,e,t);let pv;function t1(i){pv=pv||new WeakMap;let e=pv.get(i);return e===void 0&&pv.set(i,e={}),e}function CE(i){const e=t1(i);return e.shadowMatrix||(e.shadowMatrix=gn("mat4").setGroup(Rn).onRenderUpdate(()=>(i.castShadow!==!0&&i.shadow.updateMatrices(i),i.shadow.matrix)))}function MB(i){const e=t1(i);if(e.projectionUV===void 0){const t=CE(i).mul(Nc);e.projectionUV=t.xyz.div(t.w)}return e.projectionUV}function RE(i){const e=t1(i);return e.position||(e.position=gn(new ce).setGroup(Rn).onRenderUpdate((t,n)=>n.value.setFromMatrixPosition(i.matrixWorld)))}function EB(i){const e=t1(i);return e.targetPosition||(e.targetPosition=gn(new ce).setGroup(Rn).onRenderUpdate((t,n)=>n.value.setFromMatrixPosition(i.target.matrixWorld)))}function Jy(i){const e=t1(i);return e.viewPosition||(e.viewPosition=gn(new ce).setGroup(Rn).onRenderUpdate(({camera:t},n)=>{n.value=n.value||new ce,n.value.setFromMatrixPosition(i.matrixWorld),n.value.applyMatrix4(t.matrixWorldInverse)}))}const NE=i=>so.transformDirection(RE(i).sub(EB(i))),Bre=i=>i.sort((e,t)=>e.id-t.id),Ore=(i,e)=>{for(const t of e)if(t.isAnalyticLightNode&&t.light.id===i)return t;return null},oS=new WeakMap;class DE extends Mn{static get type(){return"LightsNode"}constructor(){super("vec3"),this.totalDiffuseNode=Ne().toVar("totalDiffuse"),this.totalSpecularNode=Ne().toVar("totalSpecular"),this.outgoingLightNode=Ne().toVar("outgoingLight"),this._lights=[],this._lightNodes=null,this._lightNodesHash=null,this.global=!0}customCacheKey(){const e=[],t=this._lights;for(let n=0;n0}}const Ire=(i=[])=>mt(new DE).setLights(i);class Fre extends Mn{static get type(){return"ShadowBaseNode"}constructor(e){super(),this.light=e,this.updateBeforeType=jn.RENDER,this.isShadowBaseNode=!0}setupShadowPosition({material:e}){PE.assign(e.shadowPositionNode||Nc)}dispose(){this.updateBeforeType=jn.NONE}}const PE=Ne().toVar("shadowPositionWorld");function kre(i,e={}){return e.toneMapping=i.toneMapping,e.toneMappingExposure=i.toneMappingExposure,e.outputColorSpace=i.outputColorSpace,e.renderTarget=i.getRenderTarget(),e.activeCubeFace=i.getActiveCubeFace(),e.activeMipmapLevel=i.getActiveMipmapLevel(),e.renderObjectFunction=i.getRenderObjectFunction(),e.pixelRatio=i.getPixelRatio(),e.mrt=i.getMRT(),e.clearColor=i.getClearColor(e.clearColor||new sn),e.clearAlpha=i.getClearAlpha(),e.autoClear=i.autoClear,e.scissorTest=i.getScissorTest(),e}function zre(i,e){return e=kre(i,e),i.setMRT(null),i.setRenderObjectFunction(null),i.setClearColor(0,1),i.autoClear=!0,e}function Gre(i,e){i.toneMapping=e.toneMapping,i.toneMappingExposure=e.toneMappingExposure,i.outputColorSpace=e.outputColorSpace,i.setRenderTarget(e.renderTarget,e.activeCubeFace,e.activeMipmapLevel),i.setRenderObjectFunction(e.renderObjectFunction),i.setPixelRatio(e.pixelRatio),i.setMRT(e.mrt),i.setClearColor(e.clearColor,e.clearAlpha),i.autoClear=e.autoClear,i.setScissorTest(e.scissorTest)}function qre(i,e={}){return e.background=i.background,e.backgroundNode=i.backgroundNode,e.overrideMaterial=i.overrideMaterial,e}function Vre(i,e){return e=qre(i,e),i.background=null,i.backgroundNode=null,i.overrideMaterial=null,e}function Hre(i,e){i.background=e.background,i.backgroundNode=e.backgroundNode,i.overrideMaterial=e.overrideMaterial}function jre(i,e,t){return t=zre(i,t),t=Vre(e,t),t}function Wre(i,e,t){Gre(i,t),Hre(e,t)}const oN=new WeakMap,$re=je(([i,e,t])=>{let n=Nc.sub(i).length();return n=n.sub(e).div(t.sub(e)),n=n.saturate(),n}),Xre=i=>{const e=i.shadow.camera,t=ji("near","float",e).setGroup(Rn),n=ji("far","float",e).setGroup(Rn),r=S9(i);return $re(r,t,n)},Yre=i=>{let e=oN.get(i);if(e===void 0){const t=i.isPointLight?Xre(i):null;e=new Vr,e.colorNode=dn(0,0,0,1),e.depthNode=t,e.isShadowNodeMaterial=!0,e.name="ShadowMaterial",e.fog=!1,oN.set(i,e)}return e},CB=je(({depthTexture:i,shadowCoord:e})=>Ai(i,e.xy).compare(e.z)),RB=je(({depthTexture:i,shadowCoord:e,shadow:t})=>{const n=(R,C)=>Ai(i,R).compare(C),r=ji("mapSize","vec2",t).setGroup(Rn),s=ji("radius","float",t).setGroup(Rn),a=Et(1).div(r),l=a.x.negate().mul(s),u=a.y.negate().mul(s),h=a.x.mul(s),g=a.y.mul(s),v=l.div(2),x=u.div(2),S=h.div(2),w=g.div(2);return Qr(n(e.xy.add(Et(l,u)),e.z),n(e.xy.add(Et(0,u)),e.z),n(e.xy.add(Et(h,u)),e.z),n(e.xy.add(Et(v,x)),e.z),n(e.xy.add(Et(0,x)),e.z),n(e.xy.add(Et(S,x)),e.z),n(e.xy.add(Et(l,0)),e.z),n(e.xy.add(Et(v,0)),e.z),n(e.xy,e.z),n(e.xy.add(Et(S,0)),e.z),n(e.xy.add(Et(h,0)),e.z),n(e.xy.add(Et(v,w)),e.z),n(e.xy.add(Et(0,w)),e.z),n(e.xy.add(Et(S,w)),e.z),n(e.xy.add(Et(l,g)),e.z),n(e.xy.add(Et(0,g)),e.z),n(e.xy.add(Et(h,g)),e.z)).mul(1/17)}),NB=je(({depthTexture:i,shadowCoord:e,shadow:t})=>{const n=(g,v)=>Ai(i,g).compare(v),r=ji("mapSize","vec2",t).setGroup(Rn),s=Et(1).div(r),a=s.x,l=s.y,u=e.xy,h=Hc(u.mul(r).add(.5));return u.subAssign(h.mul(s)),Qr(n(u,e.z),n(u.add(Et(a,0)),e.z),n(u.add(Et(0,l)),e.z),n(u.add(s),e.z),Fi(n(u.add(Et(a.negate(),0)),e.z),n(u.add(Et(a.mul(2),0)),e.z),h.x),Fi(n(u.add(Et(a.negate(),l)),e.z),n(u.add(Et(a.mul(2),l)),e.z),h.x),Fi(n(u.add(Et(0,l.negate())),e.z),n(u.add(Et(0,l.mul(2))),e.z),h.y),Fi(n(u.add(Et(a,l.negate())),e.z),n(u.add(Et(a,l.mul(2))),e.z),h.y),Fi(Fi(n(u.add(Et(a.negate(),l.negate())),e.z),n(u.add(Et(a.mul(2),l.negate())),e.z),h.x),Fi(n(u.add(Et(a.negate(),l.mul(2))),e.z),n(u.add(Et(a.mul(2),l.mul(2))),e.z),h.x),h.y)).mul(1/9)}),DB=je(({depthTexture:i,shadowCoord:e})=>{const t=ge(1).toVar(),n=Ai(i).sample(e.xy).rg,r=Fy(e.z,n.x);return ti(r.notEqual(ge(1)),()=>{const s=e.z.sub(n.x),a=qr(0,n.y.mul(n.y));let l=a.div(a.add(s.mul(s)));l=vu(Ti(l,.3).div(.95-.3)),t.assign(vu(qr(r,l)))}),t}),Qre=je(({samples:i,radius:e,size:t,shadowPass:n})=>{const r=ge(0).toVar(),s=ge(0).toVar(),a=i.lessThanEqual(ge(1)).select(ge(0),ge(2).div(i.sub(1))),l=i.lessThanEqual(ge(1)).select(ge(0),ge(-1));ki({start:ye(0),end:ye(i),type:"int",condition:"<"},({i:h})=>{const g=l.add(ge(h).mul(a)),v=n.sample(Qr(e1.xy,Et(0,g).mul(e)).div(t)).x;r.addAssign(v),s.addAssign(v.mul(v))}),r.divAssign(i),s.divAssign(i);const u=Cu(s.sub(r.mul(r)));return Et(r,u)}),Kre=je(({samples:i,radius:e,size:t,shadowPass:n})=>{const r=ge(0).toVar(),s=ge(0).toVar(),a=i.lessThanEqual(ge(1)).select(ge(0),ge(2).div(i.sub(1))),l=i.lessThanEqual(ge(1)).select(ge(0),ge(-1));ki({start:ye(0),end:ye(i),type:"int",condition:"<"},({i:h})=>{const g=l.add(ge(h).mul(a)),v=n.sample(Qr(e1.xy,Et(g,0).mul(e)).div(t));r.addAssign(v.x),s.addAssign(Qr(v.y.mul(v.y),v.x.mul(v.x)))}),r.divAssign(i),s.divAssign(i);const u=Cu(s.sub(r.mul(r)));return Et(r,u)}),Zre=[CB,RB,NB,DB];let lS;const mv=new SE;class PB extends Fre{static get type(){return"ShadowNode"}constructor(e,t=null){super(e),this.shadow=t||e.shadow,this.shadowMap=null,this.vsmShadowMapVertical=null,this.vsmShadowMapHorizontal=null,this.vsmMaterialVertical=null,this.vsmMaterialHorizontal=null,this._node=null,this.isShadowNode=!0}setupShadowFilter(e,{filterFn:t,depthTexture:n,shadowCoord:r,shadow:s}){const a=r.x.greaterThanEqual(0).and(r.x.lessThanEqual(1)).and(r.y.greaterThanEqual(0)).and(r.y.lessThanEqual(1)).and(r.z.lessThanEqual(1)),l=t({depthTexture:n,shadowCoord:r,shadow:s});return a.select(l,ge(1))}setupShadowCoord(e,t){const{shadow:n}=this,{renderer:r}=e,s=ji("bias","float",n).setGroup(Rn);let a=t,l;if(n.camera.isOrthographicCamera||r.logarithmicDepthBuffer!==!0)a=a.xyz.div(a.w),l=a.z,r.coordinateSystem===pu&&(l=l.mul(2).sub(1));else{const u=a.w;a=a.xy.div(u);const h=ji("near","float",n.camera).setGroup(Rn),g=ji("far","float",n.camera).setGroup(Rn);l=AE(u.negate(),h,g)}return a=Ne(a.x,a.y.oneMinus(),l.add(s)),a}getShadowFilterFn(e){return Zre[e]}setupShadow(e){const{renderer:t}=e,{light:n,shadow:r}=this,s=t.shadowMap.type,a=new qc(r.mapSize.width,r.mapSize.height);a.compareFunction=my;const l=e.createRenderTarget(r.mapSize.width,r.mapSize.height);if(l.depthTexture=a,r.camera.updateProjectionMatrix(),s===xo){a.compareFunction=null,this.vsmShadowMapVertical=e.createRenderTarget(r.mapSize.width,r.mapSize.height,{format:lA,type:Gs}),this.vsmShadowMapHorizontal=e.createRenderTarget(r.mapSize.width,r.mapSize.height,{format:lA,type:Gs});const E=Ai(a),B=Ai(this.vsmShadowMapVertical.texture),L=ji("blurSamples","float",r).setGroup(Rn),O=ji("radius","float",r).setGroup(Rn),z=ji("mapSize","vec2",r).setGroup(Rn);let G=this.vsmMaterialVertical||(this.vsmMaterialVertical=new Vr);G.fragmentNode=Qre({samples:L,radius:O,size:z,shadowPass:E}).context(e.getSharedContext()),G.name="VSMVertical",G=this.vsmMaterialHorizontal||(this.vsmMaterialHorizontal=new Vr),G.fragmentNode=Kre({samples:L,radius:O,size:z,shadowPass:B}).context(e.getSharedContext()),G.name="VSMHorizontal"}const u=ji("intensity","float",r).setGroup(Rn),h=ji("normalBias","float",r).setGroup(Rn),g=CE(n).mul(PE.add(Hy.mul(h))),v=this.setupShadowCoord(e,g),x=r.filterNode||this.getShadowFilterFn(t.shadowMap.type)||null;if(x===null)throw new Error("THREE.WebGPURenderer: Shadow map type not supported yet.");const S=s===xo?this.vsmShadowMapHorizontal.texture:a,w=this.setupShadowFilter(e,{filterFn:x,shadowTexture:l.texture,depthTexture:S,shadowCoord:v,shadow:r}),R=Ai(l.texture,v),C=Fi(1,w.rgb.mix(R,1),u.mul(R.a)).toVar();return this.shadowMap=l,this.shadow.map=l,C}setup(e){if(e.renderer.shadowMap.enabled!==!1)return je(()=>{let t=this._node;return this.setupShadowPosition(e),t===null&&(this._node=t=this.setupShadow(e)),e.material.shadowNode&&console.warn('THREE.NodeMaterial: ".shadowNode" is deprecated. Use ".castShadowNode" instead.'),e.material.receivedShadowNode&&(t=e.material.receivedShadowNode(t)),t})()}renderShadow(e){const{shadow:t,shadowMap:n,light:r}=this,{renderer:s,scene:a}=e;t.updateMatrices(r),n.setSize(t.mapSize.width,t.mapSize.height),s.render(a,t.camera)}updateShadow(e){const{shadowMap:t,light:n,shadow:r}=this,{renderer:s,scene:a,camera:l}=e,u=s.shadowMap.type,h=t.depthTexture.version;this._depthVersionCached=h,r.camera.layers.mask=l.layers.mask;const g=s.getRenderObjectFunction(),v=s.getMRT(),x=v?v.has("velocity"):!1;lS=jre(s,a,lS),a.overrideMaterial=Yre(n),s.setRenderObjectFunction((S,w,R,C,E,B,...L)=>{(S.castShadow===!0||S.receiveShadow&&u===xo)&&(x&&(IP(S).useVelocity=!0),S.onBeforeShadow(s,S,l,r.camera,C,w.overrideMaterial,B),s.renderObject(S,w,R,C,E,B,...L),S.onAfterShadow(s,S,l,r.camera,C,w.overrideMaterial,B))}),s.setRenderTarget(t),this.renderShadow(e),s.setRenderObjectFunction(g),n.isPointLight!==!0&&u===xo&&this.vsmPass(s),Wre(s,a,lS)}vsmPass(e){const{shadow:t}=this;this.vsmShadowMapVertical.setSize(t.mapSize.width,t.mapSize.height),this.vsmShadowMapHorizontal.setSize(t.mapSize.width,t.mapSize.height),e.setRenderTarget(this.vsmShadowMapVertical),mv.material=this.vsmMaterialVertical,mv.render(e),e.setRenderTarget(this.vsmShadowMapHorizontal),mv.material=this.vsmMaterialHorizontal,mv.render(e)}dispose(){this.shadowMap.dispose(),this.shadowMap=null,this.vsmShadowMapVertical!==null&&(this.vsmShadowMapVertical.dispose(),this.vsmShadowMapVertical=null,this.vsmMaterialVertical.dispose(),this.vsmMaterialVertical=null),this.vsmShadowMapHorizontal!==null&&(this.vsmShadowMapHorizontal.dispose(),this.vsmShadowMapHorizontal=null,this.vsmMaterialHorizontal.dispose(),this.vsmMaterialHorizontal=null),super.dispose()}updateBefore(e){const{shadow:t}=this;(t.needsUpdate||t.autoUpdate)&&(this.updateShadow(e),this.shadowMap.depthTexture.version===this._depthVersionCached&&(t.needsUpdate=!1))}}const LB=(i,e)=>mt(new PB(i,e));class xA extends K0{static get type(){return"AnalyticLightNode"}constructor(e=null){super(),this.light=e,this.color=new sn,this.colorNode=e&&e.colorNode||gn(this.color).setGroup(Rn),this.baseColorNode=null,this.shadowNode=null,this.shadowColorNode=null,this.isAnalyticLightNode=!0,this.updateType=jn.FRAME}customCacheKey(){return MM(this.light.id,this.light.castShadow?1:0)}getHash(){return this.light.uuid}setupShadowNode(){return LB(this.light)}setupShadow(e){const{renderer:t}=e;if(t.shadowMap.enabled===!1)return;let n=this.shadowColorNode;if(n===null){const r=this.light.shadow.shadowNode;let s;r!==void 0?s=mt(r):s=this.setupShadowNode(e),this.shadowNode=s,this.shadowColorNode=n=this.colorNode.mul(s),this.baseColorNode=this.colorNode}this.colorNode=n}setup(e){this.colorNode=this.baseColorNode||this.colorNode,this.light.castShadow?e.object.receiveShadow&&this.setupShadow(e):this.shadowNode!==null&&(this.shadowNode.dispose(),this.shadowNode=null,this.shadowColorNode=null)}update(){const{light:e}=this;this.color.copy(e.color).multiplyScalar(e.intensity)}}const LE=je(i=>{const{lightDistance:e,cutoffDistance:t,decayExponent:n}=i,r=e.pow(n).max(.01).reciprocal();return t.greaterThan(0).select(r.mul(e.div(t).pow4().oneMinus().clamp().pow2()),r)}),Jre=new sn,Xl=je(([i,e])=>{const t=i.toVar(),n=ur(t),r=Dl(1,qr(n.x,qr(n.y,n.z)));n.mulAssign(r),t.mulAssign(r.mul(e.mul(2).oneMinus()));const s=Et(t.xy).toVar(),l=e.mul(1.5).oneMinus();return ti(n.z.greaterThanEqual(l),()=>{ti(t.z.greaterThan(0),()=>{s.x.assign(Ti(4,t.x))})}).ElseIf(n.x.greaterThanEqual(l),()=>{const u=Cg(t.x);s.x.assign(t.z.mul(u).add(u.mul(2)))}).ElseIf(n.y.greaterThanEqual(l),()=>{const u=Cg(t.y);s.x.assign(t.x.add(u.mul(2)).add(2)),s.y.assign(t.z.mul(u).sub(2))}),Et(.125,.25).mul(s).add(Et(.375,.75)).flipY()}).setLayout({name:"cubeToUV",type:"vec2",inputs:[{name:"pos",type:"vec3"},{name:"texelSizeY",type:"float"}]}),ese=je(({depthTexture:i,bd3D:e,dp:t,texelSize:n})=>Ai(i,Xl(e,n.y)).compare(t)),tse=je(({depthTexture:i,bd3D:e,dp:t,texelSize:n,shadow:r})=>{const s=ji("radius","float",r).setGroup(Rn),a=Et(-1,1).mul(s).mul(n.y);return Ai(i,Xl(e.add(a.xyy),n.y)).compare(t).add(Ai(i,Xl(e.add(a.yyy),n.y)).compare(t)).add(Ai(i,Xl(e.add(a.xyx),n.y)).compare(t)).add(Ai(i,Xl(e.add(a.yyx),n.y)).compare(t)).add(Ai(i,Xl(e,n.y)).compare(t)).add(Ai(i,Xl(e.add(a.xxy),n.y)).compare(t)).add(Ai(i,Xl(e.add(a.yxy),n.y)).compare(t)).add(Ai(i,Xl(e.add(a.xxx),n.y)).compare(t)).add(Ai(i,Xl(e.add(a.yxx),n.y)).compare(t)).mul(1/9)}),nse=je(({filterFn:i,depthTexture:e,shadowCoord:t,shadow:n})=>{const r=t.xyz.toVar(),s=r.length(),a=gn("float").setGroup(Rn).onRenderUpdate(()=>n.camera.near),l=gn("float").setGroup(Rn).onRenderUpdate(()=>n.camera.far),u=ji("bias","float",n).setGroup(Rn),h=gn(n.mapSize).setGroup(Rn),g=ge(1).toVar();return ti(s.sub(l).lessThanEqual(0).and(s.sub(a).greaterThanEqual(0)),()=>{const v=s.sub(a).div(l.sub(a)).toVar();v.addAssign(u);const x=r.normalize(),S=Et(1).div(h.mul(Et(4,2)));g.assign(i({depthTexture:e,bd3D:x,dp:v,texelSize:S,shadow:n}))}),g}),lN=new Pn,Nd=new At,Am=new At;class ise extends PB{static get type(){return"PointShadowNode"}constructor(e,t=null){super(e,t)}getShadowFilterFn(e){return e===UF?ese:tse}setupShadowCoord(e,t){return t}setupShadowFilter(e,{filterFn:t,shadowTexture:n,depthTexture:r,shadowCoord:s,shadow:a}){return nse({filterFn:t,shadowTexture:n,depthTexture:r,shadowCoord:s,shadow:a})}renderShadow(e){const{shadow:t,shadowMap:n,light:r}=this,{renderer:s,scene:a}=e,l=t.getFrameExtents();Am.copy(t.mapSize),Am.multiply(l),n.setSize(Am.width,Am.height),Nd.copy(t.mapSize);const u=s.autoClear,h=s.getClearColor(Jre),g=s.getClearAlpha();s.autoClear=!1,s.setClearColor(t.clearColor,t.clearAlpha),s.clear();const v=t.getViewportCount();for(let x=0;xmt(new ise(i,e)),UB=je(({color:i,lightViewPosition:e,cutoffDistance:t,decayExponent:n},r)=>{const s=r.context.lightingModel,a=e.sub(Xr),l=a.normalize(),u=a.length(),h=LE({lightDistance:u,cutoffDistance:t,decayExponent:n}),g=i.mul(h),v=r.context.reflectedLight;s.direct({lightDirection:l,lightColor:g,reflectedLight:v},r.stack,r)});class sse extends xA{static get type(){return"PointLightNode"}constructor(e=null){super(e),this.cutoffDistanceNode=gn(0).setGroup(Rn),this.decayExponentNode=gn(2).setGroup(Rn)}update(e){const{light:t}=this;super.update(e),this.cutoffDistanceNode.value=t.distance,this.decayExponentNode.value=t.decay}setupShadowNode(){return rse(this.light)}setup(e){super.setup(e),UB({color:this.colorNode,lightViewPosition:Jy(this.light),cutoffDistance:this.cutoffDistanceNode,decayExponent:this.decayExponentNode}).append()}}const ase=je(([i=Er()])=>{const e=i.mul(2),t=e.x.floor(),n=e.y.floor();return t.add(n).mod(2).sign()}),zm=je(([i,e,t])=>{const n=ge(t).toVar(),r=ge(e).toVar(),s=Ic(i).toVar();return zs(s,r,n)}).setLayout({name:"mx_select",type:"float",inputs:[{name:"b",type:"bool"},{name:"t",type:"float"},{name:"f",type:"float"}]}),ry=je(([i,e])=>{const t=Ic(e).toVar(),n=ge(i).toVar();return zs(t,n.negate(),n)}).setLayout({name:"mx_negate_if",type:"float",inputs:[{name:"val",type:"float"},{name:"b",type:"bool"}]}),Yr=je(([i])=>{const e=ge(i).toVar();return ye(hu(e))}).setLayout({name:"mx_floor",type:"int",inputs:[{name:"x",type:"float"}]}),_r=je(([i,e])=>{const t=ge(i).toVar();return e.assign(Yr(t)),t.sub(ge(e))}),ose=je(([i,e,t,n,r,s])=>{const a=ge(s).toVar(),l=ge(r).toVar(),u=ge(n).toVar(),h=ge(t).toVar(),g=ge(e).toVar(),v=ge(i).toVar(),x=ge(Ti(1,l)).toVar();return Ti(1,a).mul(v.mul(x).add(g.mul(l))).add(a.mul(h.mul(x).add(u.mul(l))))}).setLayout({name:"mx_bilerp_0",type:"float",inputs:[{name:"v0",type:"float"},{name:"v1",type:"float"},{name:"v2",type:"float"},{name:"v3",type:"float"},{name:"s",type:"float"},{name:"t",type:"float"}]}),lse=je(([i,e,t,n,r,s])=>{const a=ge(s).toVar(),l=ge(r).toVar(),u=Ne(n).toVar(),h=Ne(t).toVar(),g=Ne(e).toVar(),v=Ne(i).toVar(),x=ge(Ti(1,l)).toVar();return Ti(1,a).mul(v.mul(x).add(g.mul(l))).add(a.mul(h.mul(x).add(u.mul(l))))}).setLayout({name:"mx_bilerp_1",type:"vec3",inputs:[{name:"v0",type:"vec3"},{name:"v1",type:"vec3"},{name:"v2",type:"vec3"},{name:"v3",type:"vec3"},{name:"s",type:"float"},{name:"t",type:"float"}]}),BB=Vs([ose,lse]),use=je(([i,e,t,n,r,s,a,l,u,h,g])=>{const v=ge(g).toVar(),x=ge(h).toVar(),S=ge(u).toVar(),w=ge(l).toVar(),R=ge(a).toVar(),C=ge(s).toVar(),E=ge(r).toVar(),B=ge(n).toVar(),L=ge(t).toVar(),O=ge(e).toVar(),z=ge(i).toVar(),G=ge(Ti(1,S)).toVar(),k=ge(Ti(1,x)).toVar();return ge(Ti(1,v)).toVar().mul(k.mul(z.mul(G).add(O.mul(S))).add(x.mul(L.mul(G).add(B.mul(S))))).add(v.mul(k.mul(E.mul(G).add(C.mul(S))).add(x.mul(R.mul(G).add(w.mul(S))))))}).setLayout({name:"mx_trilerp_0",type:"float",inputs:[{name:"v0",type:"float"},{name:"v1",type:"float"},{name:"v2",type:"float"},{name:"v3",type:"float"},{name:"v4",type:"float"},{name:"v5",type:"float"},{name:"v6",type:"float"},{name:"v7",type:"float"},{name:"s",type:"float"},{name:"t",type:"float"},{name:"r",type:"float"}]}),cse=je(([i,e,t,n,r,s,a,l,u,h,g])=>{const v=ge(g).toVar(),x=ge(h).toVar(),S=ge(u).toVar(),w=Ne(l).toVar(),R=Ne(a).toVar(),C=Ne(s).toVar(),E=Ne(r).toVar(),B=Ne(n).toVar(),L=Ne(t).toVar(),O=Ne(e).toVar(),z=Ne(i).toVar(),G=ge(Ti(1,S)).toVar(),k=ge(Ti(1,x)).toVar();return ge(Ti(1,v)).toVar().mul(k.mul(z.mul(G).add(O.mul(S))).add(x.mul(L.mul(G).add(B.mul(S))))).add(v.mul(k.mul(E.mul(G).add(C.mul(S))).add(x.mul(R.mul(G).add(w.mul(S))))))}).setLayout({name:"mx_trilerp_1",type:"vec3",inputs:[{name:"v0",type:"vec3"},{name:"v1",type:"vec3"},{name:"v2",type:"vec3"},{name:"v3",type:"vec3"},{name:"v4",type:"vec3"},{name:"v5",type:"vec3"},{name:"v6",type:"vec3"},{name:"v7",type:"vec3"},{name:"s",type:"float"},{name:"t",type:"float"},{name:"r",type:"float"}]}),OB=Vs([use,cse]),hse=je(([i,e,t])=>{const n=ge(t).toVar(),r=ge(e).toVar(),s=Qt(i).toVar(),a=Qt(s.bitAnd(Qt(7))).toVar(),l=ge(zm(a.lessThan(Qt(4)),r,n)).toVar(),u=ge(Wn(2,zm(a.lessThan(Qt(4)),n,r))).toVar();return ry(l,Ic(a.bitAnd(Qt(1)))).add(ry(u,Ic(a.bitAnd(Qt(2)))))}).setLayout({name:"mx_gradient_float_0",type:"float",inputs:[{name:"hash",type:"uint"},{name:"x",type:"float"},{name:"y",type:"float"}]}),fse=je(([i,e,t,n])=>{const r=ge(n).toVar(),s=ge(t).toVar(),a=ge(e).toVar(),l=Qt(i).toVar(),u=Qt(l.bitAnd(Qt(15))).toVar(),h=ge(zm(u.lessThan(Qt(8)),a,s)).toVar(),g=ge(zm(u.lessThan(Qt(4)),s,zm(u.equal(Qt(12)).or(u.equal(Qt(14))),a,r))).toVar();return ry(h,Ic(u.bitAnd(Qt(1)))).add(ry(g,Ic(u.bitAnd(Qt(2)))))}).setLayout({name:"mx_gradient_float_1",type:"float",inputs:[{name:"hash",type:"uint"},{name:"x",type:"float"},{name:"y",type:"float"},{name:"z",type:"float"}]}),Rs=Vs([hse,fse]),Ase=je(([i,e,t])=>{const n=ge(t).toVar(),r=ge(e).toVar(),s=Y0(i).toVar();return Ne(Rs(s.x,r,n),Rs(s.y,r,n),Rs(s.z,r,n))}).setLayout({name:"mx_gradient_vec3_0",type:"vec3",inputs:[{name:"hash",type:"uvec3"},{name:"x",type:"float"},{name:"y",type:"float"}]}),dse=je(([i,e,t,n])=>{const r=ge(n).toVar(),s=ge(t).toVar(),a=ge(e).toVar(),l=Y0(i).toVar();return Ne(Rs(l.x,a,s,r),Rs(l.y,a,s,r),Rs(l.z,a,s,r))}).setLayout({name:"mx_gradient_vec3_1",type:"vec3",inputs:[{name:"hash",type:"uvec3"},{name:"x",type:"float"},{name:"y",type:"float"},{name:"z",type:"float"}]}),Ho=Vs([Ase,dse]),pse=je(([i])=>{const e=ge(i).toVar();return Wn(.6616,e)}).setLayout({name:"mx_gradient_scale2d_0",type:"float",inputs:[{name:"v",type:"float"}]}),mse=je(([i])=>{const e=ge(i).toVar();return Wn(.982,e)}).setLayout({name:"mx_gradient_scale3d_0",type:"float",inputs:[{name:"v",type:"float"}]}),gse=je(([i])=>{const e=Ne(i).toVar();return Wn(.6616,e)}).setLayout({name:"mx_gradient_scale2d_1",type:"vec3",inputs:[{name:"v",type:"vec3"}]}),IB=Vs([pse,gse]),vse=je(([i])=>{const e=Ne(i).toVar();return Wn(.982,e)}).setLayout({name:"mx_gradient_scale3d_1",type:"vec3",inputs:[{name:"v",type:"vec3"}]}),FB=Vs([mse,vse]),To=je(([i,e])=>{const t=ye(e).toVar(),n=Qt(i).toVar();return n.shiftLeft(t).bitOr(n.shiftRight(ye(32).sub(t)))}).setLayout({name:"mx_rotl32",type:"uint",inputs:[{name:"x",type:"uint"},{name:"k",type:"int"}]}),kB=je(([i,e,t])=>{i.subAssign(t),i.bitXorAssign(To(t,ye(4))),t.addAssign(e),e.subAssign(i),e.bitXorAssign(To(i,ye(6))),i.addAssign(t),t.subAssign(e),t.bitXorAssign(To(e,ye(8))),e.addAssign(i),i.subAssign(t),i.bitXorAssign(To(t,ye(16))),t.addAssign(e),e.subAssign(i),e.bitXorAssign(To(i,ye(19))),i.addAssign(t),t.subAssign(e),t.bitXorAssign(To(e,ye(4))),e.addAssign(i)}),n1=je(([i,e,t])=>{const n=Qt(t).toVar(),r=Qt(e).toVar(),s=Qt(i).toVar();return n.bitXorAssign(r),n.subAssign(To(r,ye(14))),s.bitXorAssign(n),s.subAssign(To(n,ye(11))),r.bitXorAssign(s),r.subAssign(To(s,ye(25))),n.bitXorAssign(r),n.subAssign(To(r,ye(16))),s.bitXorAssign(n),s.subAssign(To(n,ye(4))),r.bitXorAssign(s),r.subAssign(To(s,ye(14))),n.bitXorAssign(r),n.subAssign(To(r,ye(24))),n}).setLayout({name:"mx_bjfinal",type:"uint",inputs:[{name:"a",type:"uint"},{name:"b",type:"uint"},{name:"c",type:"uint"}]}),oa=je(([i])=>{const e=Qt(i).toVar();return ge(e).div(ge(Qt(ye(4294967295))))}).setLayout({name:"mx_bits_to_01",type:"float",inputs:[{name:"bits",type:"uint"}]}),fu=je(([i])=>{const e=ge(i).toVar();return e.mul(e).mul(e).mul(e.mul(e.mul(6).sub(15)).add(10))}).setLayout({name:"mx_fade",type:"float",inputs:[{name:"t",type:"float"}]}),_se=je(([i])=>{const e=ye(i).toVar(),t=Qt(Qt(1)).toVar(),n=Qt(Qt(ye(3735928559)).add(t.shiftLeft(Qt(2))).add(Qt(13))).toVar();return n1(n.add(Qt(e)),n,n)}).setLayout({name:"mx_hash_int_0",type:"uint",inputs:[{name:"x",type:"int"}]}),yse=je(([i,e])=>{const t=ye(e).toVar(),n=ye(i).toVar(),r=Qt(Qt(2)).toVar(),s=Qt().toVar(),a=Qt().toVar(),l=Qt().toVar();return s.assign(a.assign(l.assign(Qt(ye(3735928559)).add(r.shiftLeft(Qt(2))).add(Qt(13))))),s.addAssign(Qt(n)),a.addAssign(Qt(t)),n1(s,a,l)}).setLayout({name:"mx_hash_int_1",type:"uint",inputs:[{name:"x",type:"int"},{name:"y",type:"int"}]}),xse=je(([i,e,t])=>{const n=ye(t).toVar(),r=ye(e).toVar(),s=ye(i).toVar(),a=Qt(Qt(3)).toVar(),l=Qt().toVar(),u=Qt().toVar(),h=Qt().toVar();return l.assign(u.assign(h.assign(Qt(ye(3735928559)).add(a.shiftLeft(Qt(2))).add(Qt(13))))),l.addAssign(Qt(s)),u.addAssign(Qt(r)),h.addAssign(Qt(n)),n1(l,u,h)}).setLayout({name:"mx_hash_int_2",type:"uint",inputs:[{name:"x",type:"int"},{name:"y",type:"int"},{name:"z",type:"int"}]}),bse=je(([i,e,t,n])=>{const r=ye(n).toVar(),s=ye(t).toVar(),a=ye(e).toVar(),l=ye(i).toVar(),u=Qt(Qt(4)).toVar(),h=Qt().toVar(),g=Qt().toVar(),v=Qt().toVar();return h.assign(g.assign(v.assign(Qt(ye(3735928559)).add(u.shiftLeft(Qt(2))).add(Qt(13))))),h.addAssign(Qt(l)),g.addAssign(Qt(a)),v.addAssign(Qt(s)),kB(h,g,v),h.addAssign(Qt(r)),n1(h,g,v)}).setLayout({name:"mx_hash_int_3",type:"uint",inputs:[{name:"x",type:"int"},{name:"y",type:"int"},{name:"z",type:"int"},{name:"xx",type:"int"}]}),Sse=je(([i,e,t,n,r])=>{const s=ye(r).toVar(),a=ye(n).toVar(),l=ye(t).toVar(),u=ye(e).toVar(),h=ye(i).toVar(),g=Qt(Qt(5)).toVar(),v=Qt().toVar(),x=Qt().toVar(),S=Qt().toVar();return v.assign(x.assign(S.assign(Qt(ye(3735928559)).add(g.shiftLeft(Qt(2))).add(Qt(13))))),v.addAssign(Qt(h)),x.addAssign(Qt(u)),S.addAssign(Qt(l)),kB(v,x,S),v.addAssign(Qt(a)),x.addAssign(Qt(s)),n1(v,x,S)}).setLayout({name:"mx_hash_int_4",type:"uint",inputs:[{name:"x",type:"int"},{name:"y",type:"int"},{name:"z",type:"int"},{name:"xx",type:"int"},{name:"yy",type:"int"}]}),Wi=Vs([_se,yse,xse,bse,Sse]),Tse=je(([i,e])=>{const t=ye(e).toVar(),n=ye(i).toVar(),r=Qt(Wi(n,t)).toVar(),s=Y0().toVar();return s.x.assign(r.bitAnd(ye(255))),s.y.assign(r.shiftRight(ye(8)).bitAnd(ye(255))),s.z.assign(r.shiftRight(ye(16)).bitAnd(ye(255))),s}).setLayout({name:"mx_hash_vec3_0",type:"uvec3",inputs:[{name:"x",type:"int"},{name:"y",type:"int"}]}),wse=je(([i,e,t])=>{const n=ye(t).toVar(),r=ye(e).toVar(),s=ye(i).toVar(),a=Qt(Wi(s,r,n)).toVar(),l=Y0().toVar();return l.x.assign(a.bitAnd(ye(255))),l.y.assign(a.shiftRight(ye(8)).bitAnd(ye(255))),l.z.assign(a.shiftRight(ye(16)).bitAnd(ye(255))),l}).setLayout({name:"mx_hash_vec3_1",type:"uvec3",inputs:[{name:"x",type:"int"},{name:"y",type:"int"},{name:"z",type:"int"}]}),jo=Vs([Tse,wse]),Mse=je(([i])=>{const e=Et(i).toVar(),t=ye().toVar(),n=ye().toVar(),r=ge(_r(e.x,t)).toVar(),s=ge(_r(e.y,n)).toVar(),a=ge(fu(r)).toVar(),l=ge(fu(s)).toVar(),u=ge(BB(Rs(Wi(t,n),r,s),Rs(Wi(t.add(ye(1)),n),r.sub(1),s),Rs(Wi(t,n.add(ye(1))),r,s.sub(1)),Rs(Wi(t.add(ye(1)),n.add(ye(1))),r.sub(1),s.sub(1)),a,l)).toVar();return IB(u)}).setLayout({name:"mx_perlin_noise_float_0",type:"float",inputs:[{name:"p",type:"vec2"}]}),Ese=je(([i])=>{const e=Ne(i).toVar(),t=ye().toVar(),n=ye().toVar(),r=ye().toVar(),s=ge(_r(e.x,t)).toVar(),a=ge(_r(e.y,n)).toVar(),l=ge(_r(e.z,r)).toVar(),u=ge(fu(s)).toVar(),h=ge(fu(a)).toVar(),g=ge(fu(l)).toVar(),v=ge(OB(Rs(Wi(t,n,r),s,a,l),Rs(Wi(t.add(ye(1)),n,r),s.sub(1),a,l),Rs(Wi(t,n.add(ye(1)),r),s,a.sub(1),l),Rs(Wi(t.add(ye(1)),n.add(ye(1)),r),s.sub(1),a.sub(1),l),Rs(Wi(t,n,r.add(ye(1))),s,a,l.sub(1)),Rs(Wi(t.add(ye(1)),n,r.add(ye(1))),s.sub(1),a,l.sub(1)),Rs(Wi(t,n.add(ye(1)),r.add(ye(1))),s,a.sub(1),l.sub(1)),Rs(Wi(t.add(ye(1)),n.add(ye(1)),r.add(ye(1))),s.sub(1),a.sub(1),l.sub(1)),u,h,g)).toVar();return FB(v)}).setLayout({name:"mx_perlin_noise_float_1",type:"float",inputs:[{name:"p",type:"vec3"}]}),UE=Vs([Mse,Ese]),Cse=je(([i])=>{const e=Et(i).toVar(),t=ye().toVar(),n=ye().toVar(),r=ge(_r(e.x,t)).toVar(),s=ge(_r(e.y,n)).toVar(),a=ge(fu(r)).toVar(),l=ge(fu(s)).toVar(),u=Ne(BB(Ho(jo(t,n),r,s),Ho(jo(t.add(ye(1)),n),r.sub(1),s),Ho(jo(t,n.add(ye(1))),r,s.sub(1)),Ho(jo(t.add(ye(1)),n.add(ye(1))),r.sub(1),s.sub(1)),a,l)).toVar();return IB(u)}).setLayout({name:"mx_perlin_noise_vec3_0",type:"vec3",inputs:[{name:"p",type:"vec2"}]}),Rse=je(([i])=>{const e=Ne(i).toVar(),t=ye().toVar(),n=ye().toVar(),r=ye().toVar(),s=ge(_r(e.x,t)).toVar(),a=ge(_r(e.y,n)).toVar(),l=ge(_r(e.z,r)).toVar(),u=ge(fu(s)).toVar(),h=ge(fu(a)).toVar(),g=ge(fu(l)).toVar(),v=Ne(OB(Ho(jo(t,n,r),s,a,l),Ho(jo(t.add(ye(1)),n,r),s.sub(1),a,l),Ho(jo(t,n.add(ye(1)),r),s,a.sub(1),l),Ho(jo(t.add(ye(1)),n.add(ye(1)),r),s.sub(1),a.sub(1),l),Ho(jo(t,n,r.add(ye(1))),s,a,l.sub(1)),Ho(jo(t.add(ye(1)),n,r.add(ye(1))),s.sub(1),a,l.sub(1)),Ho(jo(t,n.add(ye(1)),r.add(ye(1))),s,a.sub(1),l.sub(1)),Ho(jo(t.add(ye(1)),n.add(ye(1)),r.add(ye(1))),s.sub(1),a.sub(1),l.sub(1)),u,h,g)).toVar();return FB(v)}).setLayout({name:"mx_perlin_noise_vec3_1",type:"vec3",inputs:[{name:"p",type:"vec3"}]}),BE=Vs([Cse,Rse]),Nse=je(([i])=>{const e=ge(i).toVar(),t=ye(Yr(e)).toVar();return oa(Wi(t))}).setLayout({name:"mx_cell_noise_float_0",type:"float",inputs:[{name:"p",type:"float"}]}),Dse=je(([i])=>{const e=Et(i).toVar(),t=ye(Yr(e.x)).toVar(),n=ye(Yr(e.y)).toVar();return oa(Wi(t,n))}).setLayout({name:"mx_cell_noise_float_1",type:"float",inputs:[{name:"p",type:"vec2"}]}),Pse=je(([i])=>{const e=Ne(i).toVar(),t=ye(Yr(e.x)).toVar(),n=ye(Yr(e.y)).toVar(),r=ye(Yr(e.z)).toVar();return oa(Wi(t,n,r))}).setLayout({name:"mx_cell_noise_float_2",type:"float",inputs:[{name:"p",type:"vec3"}]}),Lse=je(([i])=>{const e=dn(i).toVar(),t=ye(Yr(e.x)).toVar(),n=ye(Yr(e.y)).toVar(),r=ye(Yr(e.z)).toVar(),s=ye(Yr(e.w)).toVar();return oa(Wi(t,n,r,s))}).setLayout({name:"mx_cell_noise_float_3",type:"float",inputs:[{name:"p",type:"vec4"}]}),Use=Vs([Nse,Dse,Pse,Lse]),Bse=je(([i])=>{const e=ge(i).toVar(),t=ye(Yr(e)).toVar();return Ne(oa(Wi(t,ye(0))),oa(Wi(t,ye(1))),oa(Wi(t,ye(2))))}).setLayout({name:"mx_cell_noise_vec3_0",type:"vec3",inputs:[{name:"p",type:"float"}]}),Ose=je(([i])=>{const e=Et(i).toVar(),t=ye(Yr(e.x)).toVar(),n=ye(Yr(e.y)).toVar();return Ne(oa(Wi(t,n,ye(0))),oa(Wi(t,n,ye(1))),oa(Wi(t,n,ye(2))))}).setLayout({name:"mx_cell_noise_vec3_1",type:"vec3",inputs:[{name:"p",type:"vec2"}]}),Ise=je(([i])=>{const e=Ne(i).toVar(),t=ye(Yr(e.x)).toVar(),n=ye(Yr(e.y)).toVar(),r=ye(Yr(e.z)).toVar();return Ne(oa(Wi(t,n,r,ye(0))),oa(Wi(t,n,r,ye(1))),oa(Wi(t,n,r,ye(2))))}).setLayout({name:"mx_cell_noise_vec3_2",type:"vec3",inputs:[{name:"p",type:"vec3"}]}),Fse=je(([i])=>{const e=dn(i).toVar(),t=ye(Yr(e.x)).toVar(),n=ye(Yr(e.y)).toVar(),r=ye(Yr(e.z)).toVar(),s=ye(Yr(e.w)).toVar();return Ne(oa(Wi(t,n,r,s,ye(0))),oa(Wi(t,n,r,s,ye(1))),oa(Wi(t,n,r,s,ye(2))))}).setLayout({name:"mx_cell_noise_vec3_3",type:"vec3",inputs:[{name:"p",type:"vec4"}]}),zB=Vs([Bse,Ose,Ise,Fse]),sy=je(([i,e,t,n])=>{const r=ge(n).toVar(),s=ge(t).toVar(),a=ye(e).toVar(),l=Ne(i).toVar(),u=ge(0).toVar(),h=ge(1).toVar();return ki(a,()=>{u.addAssign(h.mul(UE(l))),h.mulAssign(r),l.mulAssign(s)}),u}).setLayout({name:"mx_fractal_noise_float",type:"float",inputs:[{name:"p",type:"vec3"},{name:"octaves",type:"int"},{name:"lacunarity",type:"float"},{name:"diminish",type:"float"}]}),GB=je(([i,e,t,n])=>{const r=ge(n).toVar(),s=ge(t).toVar(),a=ye(e).toVar(),l=Ne(i).toVar(),u=Ne(0).toVar(),h=ge(1).toVar();return ki(a,()=>{u.addAssign(h.mul(BE(l))),h.mulAssign(r),l.mulAssign(s)}),u}).setLayout({name:"mx_fractal_noise_vec3",type:"vec3",inputs:[{name:"p",type:"vec3"},{name:"octaves",type:"int"},{name:"lacunarity",type:"float"},{name:"diminish",type:"float"}]}),kse=je(([i,e,t,n])=>{const r=ge(n).toVar(),s=ge(t).toVar(),a=ye(e).toVar(),l=Ne(i).toVar();return Et(sy(l,a,s,r),sy(l.add(Ne(ye(19),ye(193),ye(17))),a,s,r))}).setLayout({name:"mx_fractal_noise_vec2",type:"vec2",inputs:[{name:"p",type:"vec3"},{name:"octaves",type:"int"},{name:"lacunarity",type:"float"},{name:"diminish",type:"float"}]}),zse=je(([i,e,t,n])=>{const r=ge(n).toVar(),s=ge(t).toVar(),a=ye(e).toVar(),l=Ne(i).toVar(),u=Ne(GB(l,a,s,r)).toVar(),h=ge(sy(l.add(Ne(ye(19),ye(193),ye(17))),a,s,r)).toVar();return dn(u,h)}).setLayout({name:"mx_fractal_noise_vec4",type:"vec4",inputs:[{name:"p",type:"vec3"},{name:"octaves",type:"int"},{name:"lacunarity",type:"float"},{name:"diminish",type:"float"}]}),Gse=je(([i,e,t,n,r,s,a])=>{const l=ye(a).toVar(),u=ge(s).toVar(),h=ye(r).toVar(),g=ye(n).toVar(),v=ye(t).toVar(),x=ye(e).toVar(),S=Et(i).toVar(),w=Ne(zB(Et(x.add(g),v.add(h)))).toVar(),R=Et(w.x,w.y).toVar();R.subAssign(.5),R.mulAssign(u),R.addAssign(.5);const C=Et(Et(ge(x),ge(v)).add(R)).toVar(),E=Et(C.sub(S)).toVar();return ti(l.equal(ye(2)),()=>ur(E.x).add(ur(E.y))),ti(l.equal(ye(3)),()=>qr(ur(E.x),ur(E.y))),Xh(E,E)}).setLayout({name:"mx_worley_distance_0",type:"float",inputs:[{name:"p",type:"vec2"},{name:"x",type:"int"},{name:"y",type:"int"},{name:"xoff",type:"int"},{name:"yoff",type:"int"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),qse=je(([i,e,t,n,r,s,a,l,u])=>{const h=ye(u).toVar(),g=ge(l).toVar(),v=ye(a).toVar(),x=ye(s).toVar(),S=ye(r).toVar(),w=ye(n).toVar(),R=ye(t).toVar(),C=ye(e).toVar(),E=Ne(i).toVar(),B=Ne(zB(Ne(C.add(S),R.add(x),w.add(v)))).toVar();B.subAssign(.5),B.mulAssign(g),B.addAssign(.5);const L=Ne(Ne(ge(C),ge(R),ge(w)).add(B)).toVar(),O=Ne(L.sub(E)).toVar();return ti(h.equal(ye(2)),()=>ur(O.x).add(ur(O.y)).add(ur(O.z))),ti(h.equal(ye(3)),()=>qr(qr(ur(O.x),ur(O.y)),ur(O.z))),Xh(O,O)}).setLayout({name:"mx_worley_distance_1",type:"float",inputs:[{name:"p",type:"vec3"},{name:"x",type:"int"},{name:"y",type:"int"},{name:"z",type:"int"},{name:"xoff",type:"int"},{name:"yoff",type:"int"},{name:"zoff",type:"int"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),Z0=Vs([Gse,qse]),Vse=je(([i,e,t])=>{const n=ye(t).toVar(),r=ge(e).toVar(),s=Et(i).toVar(),a=ye().toVar(),l=ye().toVar(),u=Et(_r(s.x,a),_r(s.y,l)).toVar(),h=ge(1e6).toVar();return ki({start:-1,end:ye(1),name:"x",condition:"<="},({x:g})=>{ki({start:-1,end:ye(1),name:"y",condition:"<="},({y:v})=>{const x=ge(Z0(u,g,v,a,l,r,n)).toVar();h.assign(to(h,x))})}),ti(n.equal(ye(0)),()=>{h.assign(Cu(h))}),h}).setLayout({name:"mx_worley_noise_float_0",type:"float",inputs:[{name:"p",type:"vec2"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),Hse=je(([i,e,t])=>{const n=ye(t).toVar(),r=ge(e).toVar(),s=Et(i).toVar(),a=ye().toVar(),l=ye().toVar(),u=Et(_r(s.x,a),_r(s.y,l)).toVar(),h=Et(1e6,1e6).toVar();return ki({start:-1,end:ye(1),name:"x",condition:"<="},({x:g})=>{ki({start:-1,end:ye(1),name:"y",condition:"<="},({y:v})=>{const x=ge(Z0(u,g,v,a,l,r,n)).toVar();ti(x.lessThan(h.x),()=>{h.y.assign(h.x),h.x.assign(x)}).ElseIf(x.lessThan(h.y),()=>{h.y.assign(x)})})}),ti(n.equal(ye(0)),()=>{h.assign(Cu(h))}),h}).setLayout({name:"mx_worley_noise_vec2_0",type:"vec2",inputs:[{name:"p",type:"vec2"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),jse=je(([i,e,t])=>{const n=ye(t).toVar(),r=ge(e).toVar(),s=Et(i).toVar(),a=ye().toVar(),l=ye().toVar(),u=Et(_r(s.x,a),_r(s.y,l)).toVar(),h=Ne(1e6,1e6,1e6).toVar();return ki({start:-1,end:ye(1),name:"x",condition:"<="},({x:g})=>{ki({start:-1,end:ye(1),name:"y",condition:"<="},({y:v})=>{const x=ge(Z0(u,g,v,a,l,r,n)).toVar();ti(x.lessThan(h.x),()=>{h.z.assign(h.y),h.y.assign(h.x),h.x.assign(x)}).ElseIf(x.lessThan(h.y),()=>{h.z.assign(h.y),h.y.assign(x)}).ElseIf(x.lessThan(h.z),()=>{h.z.assign(x)})})}),ti(n.equal(ye(0)),()=>{h.assign(Cu(h))}),h}).setLayout({name:"mx_worley_noise_vec3_0",type:"vec3",inputs:[{name:"p",type:"vec2"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),Wse=je(([i,e,t])=>{const n=ye(t).toVar(),r=ge(e).toVar(),s=Ne(i).toVar(),a=ye().toVar(),l=ye().toVar(),u=ye().toVar(),h=Ne(_r(s.x,a),_r(s.y,l),_r(s.z,u)).toVar(),g=ge(1e6).toVar();return ki({start:-1,end:ye(1),name:"x",condition:"<="},({x:v})=>{ki({start:-1,end:ye(1),name:"y",condition:"<="},({y:x})=>{ki({start:-1,end:ye(1),name:"z",condition:"<="},({z:S})=>{const w=ge(Z0(h,v,x,S,a,l,u,r,n)).toVar();g.assign(to(g,w))})})}),ti(n.equal(ye(0)),()=>{g.assign(Cu(g))}),g}).setLayout({name:"mx_worley_noise_float_1",type:"float",inputs:[{name:"p",type:"vec3"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),$se=Vs([Vse,Wse]),Xse=je(([i,e,t])=>{const n=ye(t).toVar(),r=ge(e).toVar(),s=Ne(i).toVar(),a=ye().toVar(),l=ye().toVar(),u=ye().toVar(),h=Ne(_r(s.x,a),_r(s.y,l),_r(s.z,u)).toVar(),g=Et(1e6,1e6).toVar();return ki({start:-1,end:ye(1),name:"x",condition:"<="},({x:v})=>{ki({start:-1,end:ye(1),name:"y",condition:"<="},({y:x})=>{ki({start:-1,end:ye(1),name:"z",condition:"<="},({z:S})=>{const w=ge(Z0(h,v,x,S,a,l,u,r,n)).toVar();ti(w.lessThan(g.x),()=>{g.y.assign(g.x),g.x.assign(w)}).ElseIf(w.lessThan(g.y),()=>{g.y.assign(w)})})})}),ti(n.equal(ye(0)),()=>{g.assign(Cu(g))}),g}).setLayout({name:"mx_worley_noise_vec2_1",type:"vec2",inputs:[{name:"p",type:"vec3"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),Yse=Vs([Hse,Xse]),Qse=je(([i,e,t])=>{const n=ye(t).toVar(),r=ge(e).toVar(),s=Ne(i).toVar(),a=ye().toVar(),l=ye().toVar(),u=ye().toVar(),h=Ne(_r(s.x,a),_r(s.y,l),_r(s.z,u)).toVar(),g=Ne(1e6,1e6,1e6).toVar();return ki({start:-1,end:ye(1),name:"x",condition:"<="},({x:v})=>{ki({start:-1,end:ye(1),name:"y",condition:"<="},({y:x})=>{ki({start:-1,end:ye(1),name:"z",condition:"<="},({z:S})=>{const w=ge(Z0(h,v,x,S,a,l,u,r,n)).toVar();ti(w.lessThan(g.x),()=>{g.z.assign(g.y),g.y.assign(g.x),g.x.assign(w)}).ElseIf(w.lessThan(g.y),()=>{g.z.assign(g.y),g.y.assign(w)}).ElseIf(w.lessThan(g.z),()=>{g.z.assign(w)})})})}),ti(n.equal(ye(0)),()=>{g.assign(Cu(g))}),g}).setLayout({name:"mx_worley_noise_vec3_1",type:"vec3",inputs:[{name:"p",type:"vec3"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),Kse=Vs([jse,Qse]),Zse=je(([i])=>{const e=i.y,t=i.z,n=Ne().toVar();return ti(e.lessThan(1e-4),()=>{n.assign(Ne(t,t,t))}).Else(()=>{let r=i.x;r=r.sub(hu(r)).mul(6).toVar();const s=ye(YM(r)),a=r.sub(ge(s)),l=t.mul(e.oneMinus()),u=t.mul(e.mul(a).oneMinus()),h=t.mul(e.mul(a.oneMinus()).oneMinus());ti(s.equal(ye(0)),()=>{n.assign(Ne(t,h,l))}).ElseIf(s.equal(ye(1)),()=>{n.assign(Ne(u,t,l))}).ElseIf(s.equal(ye(2)),()=>{n.assign(Ne(l,t,h))}).ElseIf(s.equal(ye(3)),()=>{n.assign(Ne(l,u,t))}).ElseIf(s.equal(ye(4)),()=>{n.assign(Ne(h,l,t))}).Else(()=>{n.assign(Ne(t,l,u))})}),n}).setLayout({name:"mx_hsvtorgb",type:"vec3",inputs:[{name:"hsv",type:"vec3"}]}),Jse=je(([i])=>{const e=Ne(i).toVar(),t=ge(e.x).toVar(),n=ge(e.y).toVar(),r=ge(e.z).toVar(),s=ge(to(t,to(n,r))).toVar(),a=ge(qr(t,qr(n,r))).toVar(),l=ge(a.sub(s)).toVar(),u=ge().toVar(),h=ge().toVar(),g=ge().toVar();return g.assign(a),ti(a.greaterThan(0),()=>{h.assign(l.div(a))}).Else(()=>{h.assign(0)}),ti(h.lessThanEqual(0),()=>{u.assign(0)}).Else(()=>{ti(t.greaterThanEqual(a),()=>{u.assign(n.sub(r).div(l))}).ElseIf(n.greaterThanEqual(a),()=>{u.assign(Qr(2,r.sub(t).div(l)))}).Else(()=>{u.assign(Qr(4,t.sub(n).div(l)))}),u.mulAssign(1/6),ti(u.lessThan(0),()=>{u.addAssign(1)})}),Ne(u,h,g)}).setLayout({name:"mx_rgbtohsv",type:"vec3",inputs:[{name:"c",type:"vec3"}]}),eae=je(([i])=>{const e=Ne(i).toVar(),t=PM(qM(e,Ne(.04045))).toVar(),n=Ne(e.div(12.92)).toVar(),r=Ne(Cl(qr(e.add(Ne(.055)),Ne(0)).div(1.055),Ne(2.4))).toVar();return Fi(n,r,t)}).setLayout({name:"mx_srgb_texture_to_lin_rec709",type:"vec3",inputs:[{name:"color",type:"vec3"}]}),qB=(i,e)=>{i=ge(i),e=ge(e);const t=Et(e.dFdx(),e.dFdy()).length().mul(.7071067811865476);return kc(i.sub(t),i.add(t),e)},VB=(i,e,t,n)=>Fi(i,e,t[n].clamp()),tae=(i,e,t=Er())=>VB(i,e,t,"x"),nae=(i,e,t=Er())=>VB(i,e,t,"y"),HB=(i,e,t,n,r)=>Fi(i,e,qB(t,n[r])),iae=(i,e,t,n=Er())=>HB(i,e,t,n,"x"),rae=(i,e,t,n=Er())=>HB(i,e,t,n,"y"),sae=(i=1,e=0,t=Er())=>t.mul(i).add(e),aae=(i,e=1)=>(i=ge(i),i.abs().pow(e).mul(i.sign())),oae=(i,e=1,t=.5)=>ge(i).sub(t).mul(e).add(t),lae=(i=Er(),e=1,t=0)=>UE(i.convert("vec2|vec3")).mul(e).add(t),uae=(i=Er(),e=1,t=0)=>BE(i.convert("vec2|vec3")).mul(e).add(t),cae=(i=Er(),e=1,t=0)=>(i=i.convert("vec2|vec3"),dn(BE(i),UE(i.add(Et(19,73)))).mul(e).add(t)),hae=(i=Er(),e=1)=>$se(i.convert("vec2|vec3"),e,ye(1)),fae=(i=Er(),e=1)=>Yse(i.convert("vec2|vec3"),e,ye(1)),Aae=(i=Er(),e=1)=>Kse(i.convert("vec2|vec3"),e,ye(1)),dae=(i=Er())=>Use(i.convert("vec2|vec3")),pae=(i=Er(),e=3,t=2,n=.5,r=1)=>sy(i,ye(e),t,n).mul(r),mae=(i=Er(),e=3,t=2,n=.5,r=1)=>kse(i,ye(e),t,n).mul(r),gae=(i=Er(),e=3,t=2,n=.5,r=1)=>GB(i,ye(e),t,n).mul(r),vae=(i=Er(),e=3,t=2,n=.5,r=1)=>zse(i,ye(e),t,n).mul(r),_ae=je(([i,e,t])=>{const n=Fc(i).toVar("nDir"),r=Ti(ge(.5).mul(e.sub(t)),Nc).div(n).toVar("rbmax"),s=Ti(ge(-.5).mul(e.sub(t)),Nc).div(n).toVar("rbmin"),a=Ne().toVar("rbminmax");a.x=n.x.greaterThan(ge(0)).select(r.x,s.x),a.y=n.y.greaterThan(ge(0)).select(r.y,s.y),a.z=n.z.greaterThan(ge(0)).select(r.z,s.z);const l=to(to(a.x,a.y),a.z).toVar("correction");return Nc.add(n.mul(l)).toVar("boxIntersection").sub(t)}),jB=je(([i,e])=>{const t=i.x,n=i.y,r=i.z;let s=e.element(0).mul(.886227);return s=s.add(e.element(1).mul(2*.511664).mul(n)),s=s.add(e.element(2).mul(2*.511664).mul(r)),s=s.add(e.element(3).mul(2*.511664).mul(t)),s=s.add(e.element(4).mul(2*.429043).mul(t).mul(n)),s=s.add(e.element(5).mul(2*.429043).mul(n).mul(r)),s=s.add(e.element(6).mul(r.mul(r).mul(.743125).sub(.247708))),s=s.add(e.element(7).mul(2*.429043).mul(t).mul(r)),s=s.add(e.element(8).mul(.429043).mul(Wn(t,t).sub(Wn(n,n)))),s});var j=Object.freeze({__proto__:null,BRDF_GGX:$T,BRDF_Lambert:AA,BasicShadowFilter:CB,Break:TU,Continue:xee,DFGApprox:vE,D_GGX:kU,Discard:v9,EPSILON:TL,F_Schlick:F0,Fn:je,INFINITY:fJ,If:ti,Loop:ki,NodeAccess:sa,NodeShaderStage:OT,NodeType:qZ,NodeUpdateType:jn,PCFShadowFilter:RB,PCFSoftShadowFilter:NB,PI:Z_,PI2:AJ,Return:CJ,Schlick_to_F0:GU,ScriptableNodeResources:i_,ShaderNode:Um,TBNViewMatrix:Yf,VSMShadowFilter:DB,V_GGX_SmithCorrelated:FU,abs:ur,acesFilmicToneMapping:_B,acos:NL,add:Qr,addMethodChaining:ut,addNodeElement:NJ,agxToneMapping:yB,all:VM,alphaT:Y_,and:AL,anisotropy:Rh,anisotropyB:iA,anisotropyT:Bm,any:wL,append:WP,arrayBuffer:oJ,asin:RL,assign:aL,atan:WM,atan2:QL,atomicAdd:Cre,atomicAnd:Pre,atomicFunc:jc,atomicMax:Nre,atomicMin:Dre,atomicOr:Lre,atomicStore:Ere,atomicSub:Rre,atomicXor:Ure,attenuationColor:kM,attenuationDistance:FM,attribute:_u,attributeArray:xie,backgroundBlurriness:oB,backgroundIntensity:JT,backgroundRotation:lB,batch:xU,billboarding:eie,bitAnd:gL,bitNot:vL,bitOr:_L,bitXor:yL,bitangentGeometry:tee,bitangentLocal:nee,bitangentView:O9,bitangentWorld:iee,bitcast:dJ,blendBurn:hB,blendColor:Lie,blendDodge:fB,blendOverlay:dB,blendScreen:AB,blur:XU,bool:Ic,buffer:Yg,bufferAttribute:$g,bumpMap:z9,burn:Uie,bvec2:YP,bvec3:PM,bvec4:JP,bypass:d9,cache:Im,call:oL,cameraFar:Ph,cameraNear:Dh,cameraNormalMatrix:OJ,cameraPosition:b9,cameraProjectionMatrix:_A,cameraProjectionMatrixInverse:UJ,cameraViewMatrix:so,cameraWorldMatrix:BJ,cbrt:HL,cdl:qie,ceil:Iy,checker:ase,cineonToneMapping:vB,clamp:vu,clearcoat:X_,clearcoatRoughness:wg,code:Ky,color:$P,colorSpaceToWorking:tE,colorToDirection:Qee,compute:A9,cond:KL,context:zy,convert:tL,convertColorSpace:_J,convertToTexture:Aie,cos:yc,cross:ky,cubeTexture:I0,dFdx:$M,dFdy:XM,dashSize:Qv,defaultBuildStages:IT,defaultShaderStages:zP,defined:xg,degrees:EL,deltaTime:rB,densityFog:hre,densityFogFactor:ME,depth:dE,depthPass:Xie,difference:zL,diffuseColor:Ui,directPointLight:UB,directionToColor:DU,dispersion:zM,distance:kL,div:Dl,dodge:Bie,dot:Xh,drawIndex:vU,dynamicBufferAttribute:f9,element:eL,emissive:GT,equal:lL,equals:IL,equirectUV:pE,exp:HM,exp2:O0,expression:Hh,faceDirection:Xg,faceForward:JM,faceforward:pJ,float:ge,floor:hu,fog:Ng,fract:Hc,frameGroup:rL,frameId:Hne,frontFacing:M9,fwidth:BL,gain:Ine,gapSize:qT,getConstNodeType:jP,getCurrentStack:DM,getDirection:WU,getDistanceAttenuation:LE,getGeometryRoughness:IU,getNormalFromDepth:pie,getParallaxCorrectNormal:_ae,getRoughness:gE,getScreenPosition:die,getShIrradianceAt:jB,getTextureIndex:nB,getViewPosition:zd,glsl:ire,glslFn:rre,grayscale:Fie,greaterThan:qM,greaterThanEqual:fL,hash:One,highpModelNormalViewMatrix:$J,highpModelViewMatrix:WJ,hue:Gie,instance:mee,instanceIndex:Jg,instancedArray:bie,instancedBufferAttribute:J_,instancedDynamicBufferAttribute:VT,instancedMesh:yU,int:ye,inverseSqrt:jM,inversesqrt:mJ,invocationLocalIndex:pee,invocationSubgroupIndex:dee,ior:Om,iridescence:By,iridescenceIOR:BM,iridescenceThickness:OM,ivec2:ms,ivec3:QP,ivec4:KP,js:tre,label:JL,length:Rc,lengthSq:jL,lessThan:cL,lessThanEqual:hL,lightPosition:RE,lightProjectionUV:MB,lightShadowMatrix:CE,lightTargetDirection:NE,lightTargetPosition:EB,lightViewPosition:Jy,lightingContext:MU,lights:Ire,linearDepth:ty,linearToneMapping:mB,localId:gre,log:Oy,log2:cu,logarithmicDepthToViewZ:Bee,loop:bee,luminance:TE,mat2:Ly,mat3:ha,mat4:nA,matcapUV:QU,materialAO:mU,materialAlphaTest:G9,materialAnisotropy:nU,materialAnisotropyVector:kd,materialAttenuationColor:cU,materialAttenuationDistance:uU,materialClearcoat:Q9,materialClearcoatNormal:Z9,materialClearcoatRoughness:K9,materialColor:q9,materialDispersion:pU,materialEmissive:H9,materialIOR:lU,materialIridescence:iU,materialIridescenceIOR:rU,materialIridescenceThickness:sU,materialLightMap:oE,materialLineDashOffset:dU,materialLineDashSize:fU,materialLineGapSize:AU,materialLineScale:hU,materialLineWidth:hee,materialMetalness:X9,materialNormal:Y9,materialOpacity:aE,materialPointWidth:fee,materialReference:Tc,materialReflectivity:Jv,materialRefractionRatio:R9,materialRotation:J9,materialRoughness:$9,materialSheen:eU,materialSheenRoughness:tU,materialShininess:V9,materialSpecular:j9,materialSpecularColor:W9,materialSpecularIntensity:WT,materialSpecularStrength:Fm,materialThickness:oU,materialTransmission:aU,max:qr,maxMipLevel:x9,mediumpModelViewMatrix:w9,metalness:Tg,min:to,mix:Fi,mixElement:XL,mod:QM,modInt:GM,modelDirection:GJ,modelNormalMatrix:T9,modelPosition:qJ,modelScale:VJ,modelViewMatrix:Q0,modelViewPosition:HJ,modelViewProjection:lE,modelWorldMatrix:$o,modelWorldMatrixInverse:jJ,morphReference:wU,mrt:iB,mul:Wn,mx_aastep:qB,mx_cell_noise_float:dae,mx_contrast:oae,mx_fractal_noise_float:pae,mx_fractal_noise_vec2:mae,mx_fractal_noise_vec3:gae,mx_fractal_noise_vec4:vae,mx_hsvtorgb:Zse,mx_noise_float:lae,mx_noise_vec3:uae,mx_noise_vec4:cae,mx_ramplr:tae,mx_ramptb:nae,mx_rgbtohsv:Jse,mx_safepower:aae,mx_splitlr:iae,mx_splittb:rae,mx_srgb_texture_to_lin_rec709:eae,mx_transform_uv:sae,mx_worley_noise_float:hae,mx_worley_noise_vec2:fae,mx_worley_noise_vec3:Aae,negate:DL,neutralToneMapping:xB,nodeArray:tA,nodeImmutable:zt,nodeObject:mt,nodeObjects:Vg,nodeProxy:ct,normalFlat:E9,normalGeometry:qy,normalLocal:no,normalMap:jT,normalView:Jo,normalWorld:Vy,normalize:Fc,not:pL,notEqual:uL,numWorkgroups:pre,objectDirection:IJ,objectGroup:UM,objectPosition:S9,objectScale:kJ,objectViewPosition:zJ,objectWorldMatrix:FJ,oneMinus:PL,or:dL,orthographicDepthToViewZ:Uee,oscSawtooth:Kne,oscSine:Xne,oscSquare:Yne,oscTriangle:Qne,output:Eg,outputStruct:Une,overlay:Iie,overloadingFn:Vs,parabola:ZT,parallaxDirection:F9,parallaxUV:see,parameter:Pne,pass:Wie,passTexture:$ie,pcurve:Fne,perspectiveDepthToViewZ:fE,pmremTexture:_E,pointUV:Mie,pointWidth:uJ,positionGeometry:Gy,positionLocal:Gr,positionPrevious:ey,positionView:Xr,positionViewDirection:dr,positionWorld:Nc,positionWorldDirection:nE,posterize:Hie,pow:Cl,pow2:KM,pow3:GL,pow4:qL,property:sL,radians:ML,rand:$L,range:Are,rangeFog:cre,rangeFogFactor:wE,reciprocal:UL,reference:ji,referenceBuffer:HT,reflect:FL,reflectVector:P9,reflectView:N9,reflector:lie,refract:ZM,refractVector:L9,refractView:D9,reinhardToneMapping:gB,remainder:SL,remap:m9,remapClamp:g9,renderGroup:Rn,renderOutput:_9,rendererReference:u9,rotate:yE,rotateUV:Zne,roughness:Zl,round:LL,rtt:aB,sRGBTransferEOTF:i9,sRGBTransferOETF:r9,sampler:LJ,saturate:WL,saturation:kie,screen:Oie,screenCoordinate:e1,screenSize:Rg,screenUV:bu,scriptable:ure,scriptableValue:n_,select:zs,setCurrentStack:bg,shaderStages:FT,shadow:LB,shadowPositionWorld:PE,sharedUniformGroup:LM,sheen:Xf,sheenRoughness:Uy,shiftLeft:xL,shiftRight:bL,shininess:Q_,sign:Cg,sin:Mo,sinc:kne,skinning:_ee,skinningReference:SU,smoothstep:kc,smoothstepElement:YL,specularColor:ka,specularF90:Mg,spherizeUV:Jne,split:lJ,spritesheetUV:iie,sqrt:Cu,stack:e_,step:Fy,storage:Qy,storageBarrier:xre,storageObject:yie,storageTexture:uB,string:aJ,sub:Ti,subgroupIndex:Aee,subgroupSize:vre,tan:CL,tangentGeometry:Wy,tangentLocal:Qg,tangentView:Kg,tangentWorld:B9,temp:t9,texture:Ai,texture3D:one,textureBarrier:bre,textureBicubic:HU,textureCubeUV:$U,textureLoad:Fr,textureSize:Fh,textureStore:Cie,thickness:IM,time:yA,timerDelta:$ne,timerGlobal:Wne,timerLocal:jne,toOutputColorSpace:s9,toWorkingColorSpace:a9,toneMapping:c9,toneMappingExposure:h9,toonOutlinePass:Qie,transformDirection:VL,transformNormal:C9,transformNormalToView:iE,transformedBentNormalView:k9,transformedBitangentView:I9,transformedBitangentWorld:ree,transformedClearcoatNormalView:Qd,transformedNormalView:zr,transformedNormalWorld:Hy,transformedTangentView:sE,transformedTangentWorld:eee,transmission:K_,transpose:OL,triNoise3D:Gne,triplanarTexture:sie,triplanarTextures:sB,trunc:YM,tslFn:sJ,uint:Qt,uniform:gn,uniformArray:Sc,uniformGroup:iL,uniforms:KJ,userData:Nie,uv:Er,uvec2:XP,uvec3:Y0,uvec4:ZP,varying:ro,varyingProperty:Sg,vec2:Et,vec3:Ne,vec4:dn,vectorComponents:gA,velocity:Pie,vertexColor:Tie,vertexIndex:gU,vertexStage:n9,vibrance:zie,viewZToLogarithmicDepth:AE,viewZToOrthographicDepth:s0,viewZToPerspectiveDepth:RU,viewport:uE,viewportBottomLeft:Dee,viewportCoordinate:CU,viewportDepthTexture:hE,viewportLinearDepth:Oee,viewportMipTexture:cE,viewportResolution:Ree,viewportSafeUV:tie,viewportSharedTexture:Yee,viewportSize:EU,viewportTexture:Pee,viewportTopLeft:Nee,viewportUV:Cee,wgsl:nre,wgslFn:sre,workgroupArray:wre,workgroupBarrier:yre,workgroupId:mre,workingToColorSpace:o9,xor:mL});const vc=new xE;class yae extends Yh{constructor(e,t){super(),this.renderer=e,this.nodes=t}update(e,t,n){const r=this.renderer,s=this.nodes.getBackgroundNode(e)||e.background;let a=!1;if(s===null)r._clearColor.getRGB(vc,Ro),vc.a=r._clearColor.a;else if(s.isColor===!0)s.getRGB(vc,Ro),vc.a=1,a=!0;else if(s.isNode===!0){const l=this.get(e),u=s;vc.copy(r._clearColor);let h=l.backgroundMesh;if(h===void 0){const v=zy(dn(u).mul(JT),{getUV:()=>lB.mul(Vy),getTextureLevel:()=>oB});let x=lE;x=x.setZ(x.w);const S=new Vr;S.name="Background.material",S.side=hr,S.depthTest=!1,S.depthWrite=!1,S.fog=!1,S.lights=!1,S.vertexNode=x,S.colorNode=v,l.backgroundMeshNode=v,l.backgroundMesh=h=new zi(new Eu(1,32,32),S),h.frustumCulled=!1,h.name="Background.mesh",h.onBeforeRender=function(w,R,C){this.matrixWorld.copyPosition(C.matrixWorld)}}const g=u.getCacheKey();l.backgroundCacheKey!==g&&(l.backgroundMeshNode.node=dn(u).mul(JT),l.backgroundMeshNode.needsUpdate=!0,h.material.needsUpdate=!0,l.backgroundCacheKey=g),t.unshift(h,h.geometry,h.material,0,0,null,null)}else console.error("THREE.Renderer: Unsupported background configuration.",s);if(r.autoClear===!0||a===!0){const l=n.clearColorValue;l.r=vc.r,l.g=vc.g,l.b=vc.b,l.a=vc.a,(r.backend.isWebGLBackend===!0||r.alpha===!0)&&(l.r*=l.a,l.g*=l.a,l.b*=l.a),n.depthClearValue=r._clearDepth,n.stencilClearValue=r._clearStencil,n.clearColor=r.autoClearColor===!0,n.clearDepth=r.autoClearDepth===!0,n.clearStencil=r.autoClearStencil===!0}else n.clearColor=!1,n.clearDepth=!1,n.clearStencil=!1}}let xae=0;class ew{constructor(e="",t=[],n=0,r=[]){this.name=e,this.bindings=t,this.index=n,this.bindingsReference=r,this.id=xae++}}class bae{constructor(e,t,n,r,s,a,l,u,h,g=[]){this.vertexShader=e,this.fragmentShader=t,this.computeShader=n,this.transforms=g,this.nodeAttributes=r,this.bindings=s,this.updateNodes=a,this.updateBeforeNodes=l,this.updateAfterNodes=u,this.monitor=h,this.usedTimes=0}createBindings(){const e=[];for(const t of this.bindings)if(t.bindings[0].groupNode.shared!==!0){const r=new ew(t.name,[],t.index,t);e.push(r);for(const s of t.bindings)r.bindings.push(s.clone())}else e.push(t);return e}}class uN{constructor(e,t,n=null){this.isNodeAttribute=!0,this.name=e,this.type=t,this.node=n}}class Sae{constructor(e,t,n){this.isNodeUniform=!0,this.name=e,this.type=t,this.node=n.getSelf()}get value(){return this.node.value}set value(e){this.node.value=e}get id(){return this.node.id}get groupNode(){return this.node.groupNode}}class WB{constructor(e,t){this.isNodeVar=!0,this.name=e,this.type=t}}class Tae extends WB{constructor(e,t){super(e,t),this.needsInterpolation=!1,this.isNodeVarying=!0}}class wae{constructor(e,t,n=""){this.name=e,this.type=t,this.code=n,Object.defineProperty(this,"isNodeCode",{value:!0})}}let Mae=0;class uS{constructor(e=null){this.id=Mae++,this.nodesData=new WeakMap,this.parent=e}getData(e){let t=this.nodesData.get(e);return t===void 0&&this.parent!==null&&(t=this.parent.getData(e)),t}setData(e,t){this.nodesData.set(e,t)}}class Eae extends Mn{static get type(){return"StructTypeNode"}constructor(e,t){super(),this.name=e,this.types=t,this.isStructTypeNode=!0}getMemberTypes(){return this.types}}class bA{constructor(e,t){this.name=e,this.value=t,this.boundary=0,this.itemSize=0,this.offset=0}setValue(e){this.value=e}getValue(){return this.value}}class Cae extends bA{constructor(e,t=0){super(e,t),this.isNumberUniform=!0,this.boundary=4,this.itemSize=1}}class Rae extends bA{constructor(e,t=new At){super(e,t),this.isVector2Uniform=!0,this.boundary=8,this.itemSize=2}}class Nae extends bA{constructor(e,t=new ce){super(e,t),this.isVector3Uniform=!0,this.boundary=16,this.itemSize=3}}class Dae extends bA{constructor(e,t=new Pn){super(e,t),this.isVector4Uniform=!0,this.boundary=16,this.itemSize=4}}class Pae extends bA{constructor(e,t=new sn){super(e,t),this.isColorUniform=!0,this.boundary=16,this.itemSize=3}}class Lae extends bA{constructor(e,t=new Vn){super(e,t),this.isMatrix3Uniform=!0,this.boundary=48,this.itemSize=12}}class Uae extends bA{constructor(e,t=new kn){super(e,t),this.isMatrix4Uniform=!0,this.boundary=64,this.itemSize=16}}class Bae extends Cae{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}}class Oae extends Rae{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}}class Iae extends Nae{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}}class Fae extends Dae{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}}class kae extends Pae{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}}class zae extends Lae{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}}class Gae extends Uae{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}}const Kd=4,cN=[.125,.215,.35,.446,.526,.582],Gf=20,cS=new kg(-1,1,1,-1,0,1),qae=new ya(90,1),hN=new sn;let hS=null,fS=0,AS=0;const If=(1+Math.sqrt(5))/2,Dd=1/If,fN=[new ce(-If,Dd,0),new ce(If,Dd,0),new ce(-Dd,0,If),new ce(Dd,0,If),new ce(0,If,-Dd),new ce(0,If,Dd),new ce(-1,1,-1),new ce(1,1,-1),new ce(-1,1,1),new ce(1,1,1)],Vae=[3,1,5,0,4,2],dS=WU(Er(),_u("faceIndex")).normalize(),OE=Ne(dS.x,dS.y,dS.z);class Hae{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._lodMeshes=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._backgroundBox=null}get _hasInitialized(){return this._renderer.hasInitialized()}fromScene(e,t=0,n=.1,r=100,s=null){if(this._setSize(256),this._hasInitialized===!1){console.warn("THREE.PMREMGenerator: .fromScene() called before the backend is initialized. Try using .fromSceneAsync() instead.");const l=s||this._allocateTargets();return this.fromSceneAsync(e,t,n,r,l),l}hS=this._renderer.getRenderTarget(),fS=this._renderer.getActiveCubeFace(),AS=this._renderer.getActiveMipmapLevel();const a=s||this._allocateTargets();return a.depthBuffer=!0,this._sceneToCubeUV(e,n,r,a),t>0&&this._blur(a,0,0,t),this._applyPMREM(a),this._cleanup(a),a}async fromSceneAsync(e,t=0,n=.1,r=100,s=null){return this._hasInitialized===!1&&await this._renderer.init(),this.fromScene(e,t,n,r,s)}fromEquirectangular(e,t=null){if(this._hasInitialized===!1){console.warn("THREE.PMREMGenerator: .fromEquirectangular() called before the backend is initialized. Try using .fromEquirectangularAsync() instead."),this._setSizeFromTexture(e);const n=t||this._allocateTargets();return this.fromEquirectangularAsync(e,n),n}return this._fromTexture(e,t)}async fromEquirectangularAsync(e,t=null){return this._hasInitialized===!1&&await this._renderer.init(),this._fromTexture(e,t)}fromCubemap(e,t=null){if(this._hasInitialized===!1){console.warn("THREE.PMREMGenerator: .fromCubemap() called before the backend is initialized. Try using .fromCubemapAsync() instead."),this._setSizeFromTexture(e);const n=t||this._allocateTargets();return this.fromCubemapAsync(e,t),n}return this._fromTexture(e,t)}async fromCubemapAsync(e,t=null){return this._hasInitialized===!1&&await this._renderer.init(),this._fromTexture(e,t)}async compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=dN(),await this._compileMaterial(this._cubemapMaterial))}async compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=pN(),await this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose(),this._backgroundBox!==null&&(this._backgroundBox.geometry.dispose(),this._backgroundBox.material.dispose())}_setSizeFromTexture(e){e.mapping===Qo||e.mapping===Ko?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4)}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e2?R:0,R,R),u.render(e,s)}u.autoClear=h,e.background=x}_textureToCubeUV(e,t){const n=this._renderer,r=e.mapping===Qo||e.mapping===Ko;r?this._cubemapMaterial===null&&(this._cubemapMaterial=dN(e)):this._equirectMaterial===null&&(this._equirectMaterial=pN(e));const s=r?this._cubemapMaterial:this._equirectMaterial;s.fragmentNode.value=e;const a=this._lodMeshes[0];a.material=s;const l=this._cubeSize;gv(t,0,0,3*l,2*l),n.setRenderTarget(t),n.render(a,cS)}_applyPMREM(e){const t=this._renderer,n=t.autoClear;t.autoClear=!1;const r=this._lodPlanes.length;for(let s=1;sGf&&console.warn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${C} samples when the maximum is set to ${Gf}`);const E=[];let B=0;for(let k=0;kL-Kd?r-L+Kd:0),G=4*(this._cubeSize-O);gv(t,z,G,3*O,2*O),u.setRenderTarget(t),u.render(v,cS)}}function jae(i){const e=[],t=[],n=[],r=[];let s=i;const a=i-Kd+1+cN.length;for(let l=0;li-Kd?h=cN[l-i+Kd-1]:l===0&&(h=0),n.push(h);const g=1/(u-2),v=-g,x=1+g,S=[v,v,x,v,x,x,v,v,x,x,v,x],w=6,R=6,C=3,E=2,B=1,L=new Float32Array(C*R*w),O=new Float32Array(E*R*w),z=new Float32Array(B*R*w);for(let k=0;k2?0:-1,V=[H,F,0,H+2/3,F,0,H+2/3,F+1,0,H,F,0,H+2/3,F+1,0,H,F+1,0],X=Vae[k];L.set(V,C*R*X),O.set(S,E*R*X);const J=[X,X,X,X,X,X];z.set(J,B*R*X)}const G=new Ki;G.setAttribute("position",new wr(L,C)),G.setAttribute("uv",new wr(O,E)),G.setAttribute("faceIndex",new wr(z,B)),e.push(G),r.push(new zi(G,null)),s>Kd&&s--}return{lodPlanes:e,sizeLods:t,sigmas:n,lodMeshes:r}}function AN(i,e,t){const n=new Wh(i,e,t);return n.texture.mapping=sA,n.texture.name="PMREM.cubeUv",n.texture.isPMREMTexture=!0,n.scissorTest=!0,n}function gv(i,e,t,n,r){i.viewport.set(e,t,n,r),i.scissor.set(e,t,n,r)}function IE(i){const e=new Vr;return e.depthTest=!1,e.depthWrite=!1,e.blending=Qa,e.name=`PMREM_${i}`,e}function Wae(i,e,t){const n=Sc(new Array(Gf).fill(0)),r=gn(new ce(0,1,0)),s=gn(0),a=ge(Gf),l=gn(0),u=gn(1),h=Ai(null),g=gn(0),v=ge(1/e),x=ge(1/t),S=ge(i),w={n:a,latitudinal:l,weights:n,poleAxis:r,outputDirection:OE,dTheta:s,samples:u,envMap:h,mipInt:g,CUBEUV_TEXEL_WIDTH:v,CUBEUV_TEXEL_HEIGHT:x,CUBEUV_MAX_MIP:S},R=IE("blur");return R.uniforms=w,R.fragmentNode=XU({...w,latitudinal:l.equal(1)}),R}function dN(i){const e=IE("cubemap");return e.fragmentNode=I0(i,OE),e}function pN(i){const e=IE("equirect");return e.fragmentNode=Ai(i,pE(OE),0),e}const mN=new WeakMap,$ae=new Map([[Int8Array,"int"],[Int16Array,"int"],[Int32Array,"int"],[Uint8Array,"uint"],[Uint16Array,"uint"],[Uint32Array,"uint"],[Float32Array,"float"]]),vv=i=>/e/g.test(i)?String(i).replace(/\+/g,""):(i=Number(i),i+(i%1?"":".0"));class $B{constructor(e,t,n){this.object=e,this.material=e&&e.material||null,this.geometry=e&&e.geometry||null,this.renderer=t,this.parser=n,this.scene=null,this.camera=null,this.nodes=[],this.sequentialNodes=[],this.updateNodes=[],this.updateBeforeNodes=[],this.updateAfterNodes=[],this.hashNodes={},this.monitor=null,this.lightsNode=null,this.environmentNode=null,this.fogNode=null,this.clippingContext=null,this.vertexShader=null,this.fragmentShader=null,this.computeShader=null,this.flowNodes={vertex:[],fragment:[],compute:[]},this.flowCode={vertex:"",fragment:"",compute:""},this.uniforms={vertex:[],fragment:[],compute:[],index:0},this.structs={vertex:[],fragment:[],compute:[],index:0},this.bindings={vertex:{},fragment:{},compute:{}},this.bindingsIndexes={},this.bindGroups=null,this.attributes=[],this.bufferAttributes=[],this.varyings=[],this.codes={},this.vars={},this.flow={code:""},this.chaining=[],this.stack=e_(),this.stacks=[],this.tab=" ",this.currentFunctionNode=null,this.context={material:this.material},this.cache=new uS,this.globalCache=this.cache,this.flowsData=new WeakMap,this.shaderStage=null,this.buildStage=null,this.useComparisonMethod=!1}getBindGroupsCache(){let e=mN.get(this.renderer);return e===void 0&&(e=new Su,mN.set(this.renderer,e)),e}createRenderTarget(e,t,n){return new Wh(e,t,n)}createCubeRenderTarget(e,t){return new PU(e,t)}createPMREMGenerator(){return new Hae(this.renderer)}includes(e){return this.nodes.includes(e)}_getBindGroup(e,t){const n=this.getBindGroupsCache(),r=[];let s=!0;for(const l of t)r.push(l),s=s&&l.groupNode.shared!==!0;let a;return s?(a=n.get(r),a===void 0&&(a=new ew(e,r,this.bindingsIndexes[e].group,r),n.set(r,a))):a=new ew(e,r,this.bindingsIndexes[e].group,r),a}getBindGroupArray(e,t){const n=this.bindings[t];let r=n[e];return r===void 0&&(this.bindingsIndexes[e]===void 0&&(this.bindingsIndexes[e]={binding:0,group:Object.keys(this.bindingsIndexes).length}),n[e]=r=[]),r}getBindings(){let e=this.bindGroups;if(e===null){const t={},n=this.bindings;for(const r of FT)for(const s in n[r]){const a=n[r][s];(t[s]||(t[s]=[])).push(...a)}e=[];for(const r in t){const s=t[r],a=this._getBindGroup(r,s);e.push(a)}this.bindGroups=e}return e}sortBindingGroups(){const e=this.getBindings();e.sort((t,n)=>t.bindings[0].groupNode.order-n.bindings[0].groupNode.order);for(let t=0;t=0?`${Math.round(t)}u`:"0u";if(e==="bool")return t?"true":"false";if(e==="color")return`${this.getType("vec3")}( ${vv(t.r)}, ${vv(t.g)}, ${vv(t.b)} )`;const n=this.getTypeLength(e),r=this.getComponentType(e),s=a=>this.generateConst(r,a);if(n===2)return`${this.getType(e)}( ${s(t.x)}, ${s(t.y)} )`;if(n===3)return`${this.getType(e)}( ${s(t.x)}, ${s(t.y)}, ${s(t.z)} )`;if(n===4)return`${this.getType(e)}( ${s(t.x)}, ${s(t.y)}, ${s(t.z)}, ${s(t.w)} )`;if(n>4&&t&&(t.isMatrix3||t.isMatrix4))return`${this.getType(e)}( ${t.elements.map(s).join(", ")} )`;if(n>4)return`${this.getType(e)}()`;throw new Error(`NodeBuilder: Type '${e}' not found in generate constant attempt.`)}getType(e){return e==="color"?"vec3":e}hasGeometryAttribute(e){return this.geometry&&this.geometry.getAttribute(e)!==void 0}getAttribute(e,t){const n=this.attributes;for(const s of n)if(s.name===e)return s;const r=new uN(e,t);return n.push(r),r}getPropertyName(e){return e.name}isVector(e){return/vec\d/.test(e)}isMatrix(e){return/mat\d/.test(e)}isReference(e){return e==="void"||e==="property"||e==="sampler"||e==="texture"||e==="cubeTexture"||e==="storageTexture"||e==="depthTexture"||e==="texture3D"}needsToWorkingColorSpace(){return!1}getComponentTypeFromTexture(e){const t=e.type;if(e.isDataTexture){if(t===Ns)return"int";if(t===Rr)return"uint"}return"float"}getElementType(e){return e==="mat2"?"vec2":e==="mat3"?"vec3":e==="mat4"?"vec4":this.getComponentType(e)}getComponentType(e){if(e=this.getVectorType(e),e==="float"||e==="bool"||e==="int"||e==="uint")return e;const t=/(b|i|u|)(vec|mat)([2-4])/.exec(e);return t===null?null:t[1]==="b"?"bool":t[1]==="i"?"int":t[1]==="u"?"uint":"float"}getVectorType(e){return e==="color"?"vec3":e==="texture"||e==="cubeTexture"||e==="storageTexture"||e==="texture3D"?"vec4":e}getTypeFromLength(e,t="float"){if(e===1)return t;const n=LP(e);return(t==="float"?"":t[0])+n}getTypeFromArray(e){return $ae.get(e.constructor)}getTypeFromAttribute(e){let t=e;e.isInterleavedBufferAttribute&&(t=e.data);const n=t.array,r=e.itemSize,s=e.normalized;let a;return!(e instanceof z7)&&s!==!0&&(a=this.getTypeFromArray(n)),this.getTypeFromLength(r,a)}getTypeLength(e){const t=this.getVectorType(e),n=/vec([2-4])/.exec(t);return n!==null?Number(n[1]):t==="float"||t==="bool"||t==="int"||t==="uint"?1:/mat2/.test(e)===!0?4:/mat3/.test(e)===!0?9:/mat4/.test(e)===!0?16:0}getVectorFromMatrix(e){return e.replace("mat","vec")}changeComponentType(e,t){return this.getTypeFromLength(this.getTypeLength(e),t)}getIntegerType(e){const t=this.getComponentType(e);return t==="int"||t==="uint"?e:this.changeComponentType(e,"int")}addStack(){return this.stack=e_(this.stack),this.stacks.push(DM()||this.stack),bg(this.stack),this.stack}removeStack(){const e=this.stack;return this.stack=e.parent,bg(this.stacks.pop()),e}getDataFromNode(e,t=this.shaderStage,n=null){n=n===null?e.isGlobal(this)?this.globalCache:this.cache:n;let r=n.getData(e);return r===void 0&&(r={},n.setData(e,r)),r[t]===void 0&&(r[t]={}),r[t]}getNodeProperties(e,t="any"){const n=this.getDataFromNode(e,t);return n.properties||(n.properties={outputNode:null})}getBufferAttributeFromNode(e,t){const n=this.getDataFromNode(e);let r=n.bufferAttribute;if(r===void 0){const s=this.uniforms.index++;r=new uN("nodeAttribute"+s,t,e),this.bufferAttributes.push(r),n.bufferAttribute=r}return r}getStructTypeFromNode(e,t,n=this.shaderStage){const r=this.getDataFromNode(e,n);let s=r.structType;if(s===void 0){const a=this.structs.index++;s=new Eae("StructType"+a,t),this.structs[n].push(s),r.structType=s}return s}getUniformFromNode(e,t,n=this.shaderStage,r=null){const s=this.getDataFromNode(e,n,this.globalCache);let a=s.uniform;if(a===void 0){const l=this.uniforms.index++;a=new Sae(r||"nodeUniform"+l,t,e),this.uniforms[n].push(a),s.uniform=a}return a}getVarFromNode(e,t=null,n=e.getNodeType(this),r=this.shaderStage){const s=this.getDataFromNode(e,r);let a=s.variable;if(a===void 0){const l=this.vars[r]||(this.vars[r]=[]);t===null&&(t="nodeVar"+l.length),a=new WB(t,n),l.push(a),s.variable=a}return a}getVaryingFromNode(e,t=null,n=e.getNodeType(this)){const r=this.getDataFromNode(e,"any");let s=r.varying;if(s===void 0){const a=this.varyings,l=a.length;t===null&&(t="nodeVarying"+l),s=new Tae(t,n),a.push(s),r.varying=s}return s}getCodeFromNode(e,t,n=this.shaderStage){const r=this.getDataFromNode(e);let s=r.code;if(s===void 0){const a=this.codes[n]||(this.codes[n]=[]),l=a.length;s=new wae("nodeCode"+l,t),a.push(s),r.code=s}return s}addFlowCodeHierarchy(e,t){const{flowCodes:n,flowCodeBlock:r}=this.getDataFromNode(e);let s=!0,a=t;for(;a;){if(r.get(a)===!0){s=!1;break}a=this.getDataFromNode(a).parentNodeBlock}if(s)for(const l of n)this.addLineFlowCode(l)}addLineFlowCodeBlock(e,t,n){const r=this.getDataFromNode(e),s=r.flowCodes||(r.flowCodes=[]),a=r.flowCodeBlock||(r.flowCodeBlock=new WeakMap);s.push(t),a.set(n,!0)}addLineFlowCode(e,t=null){return e===""?this:(t!==null&&this.context.nodeBlock&&this.addLineFlowCodeBlock(t,e,this.context.nodeBlock),e=this.tab+e,/;\s*$/.test(e)||(e=e+`; +return { ...output, `+n+" };",a=r+this.codeNode.code+s;return this._method=new Function(...e,a),this._method}dispose(){this._method!==null&&(this._object&&typeof this._object.dispose=="function"&&this._object.dispose(),this._method=null,this._object=null,this._source=null,this._value=null,this._needsOutputUpdate=!0,this._output.value=null,this._outputs={})}setup(){return this.getDefaultOutputNode()}getCacheKey(e){const t=[DP(this.source),this.getDefaultOutputNode().getCacheKey(e)];for(const n in this.parameters)t.push(this.parameters[n].getCacheKey(e));return Ny(t)}set needsUpdate(e){e===!0&&this.dispose()}get needsUpdate(){return this.source!==this._source}_exec(){return this.codeNode===null?this:(this._needsOutputUpdate===!0&&(this._value=this.call("main"),this._needsOutputUpdate=!1),this._output.value=this._value,this)}_refresh(){this.needsUpdate=!0,this._exec(),this._output.refresh()}}const ure=ht(lre);function wB(i){let e;const t=i.context.getViewZ;return t!==void 0&&(e=t(this)),(e||Xr.z).negate()}const wE=je(([i,e],t)=>{const n=wB(t);return kc(i,e,n)}),ME=je(([i],e)=>{const t=wB(e);return i.mul(i,t,t).negate().exp().oneMinus()}),Ng=je(([i,e])=>dn(e.toFloat().mix(Eg.rgb,i.toVec3()),Eg.a));function cre(i,e,t){return console.warn('THREE.TSL: "rangeFog( color, near, far )" is deprecated. Use "fog( color, rangeFogFactor( near, far ) )" instead.'),Ng(i,wE(e,t))}function hre(i,e){return console.warn('THREE.TSL: "densityFog( color, density )" is deprecated. Use "fog( color, densityFogFactor( density ) )" instead.'),Ng(i,ME(e))}let Rf=null,Nf=null;class fre extends Mn{static get type(){return"RangeNode"}constructor(e=ge(),t=ge()){super(),this.minNode=e,this.maxNode=t}getVectorLength(e){const t=e.getTypeLength(Uh(this.minNode.value)),n=e.getTypeLength(Uh(this.maxNode.value));return t>n?t:n}getNodeType(e){return e.object.count>1?e.getTypeFromLength(this.getVectorLength(e)):"float"}setup(e){const t=e.object;let n=null;if(t.count>1){const r=this.minNode.value,s=this.maxNode.value,a=e.getTypeLength(Uh(r)),l=e.getTypeLength(Uh(s));Rf=Rf||new Pn,Nf=Nf||new Pn,Rf.setScalar(0),Nf.setScalar(0),a===1?Rf.setScalar(r):r.isColor?Rf.set(r.r,r.g,r.b,1):Rf.set(r.x,r.y,r.z||0,r.w||0),l===1?Nf.setScalar(s):s.isColor?Nf.set(s.r,s.g,s.b,1):Nf.set(s.x,s.y,s.z||0,s.w||0);const u=4,h=u*t.count,g=new Float32Array(h);for(let x=0;xgt(new dre(i,e)),pre=Zy("numWorkgroups","uvec3"),mre=Zy("workgroupId","uvec3"),gre=Zy("localId","uvec3"),vre=Zy("subgroupSize","uint");class _re extends Mn{constructor(e){super(),this.scope=e}generate(e){const{scope:t}=this,{renderer:n}=e;n.backend.isWebGLBackend===!0?e.addFlowCode(` // ${t}Barrier +`):e.addLineFlowCode(`${t}Barrier()`,this)}}const EE=ht(_re),yre=()=>EE("workgroup").append(),xre=()=>EE("storage").append(),bre=()=>EE("texture").append();class Sre extends vA{constructor(e,t){super(e,t),this.isWorkgroupInfoElementNode=!0}generate(e,t){let n;const r=e.context.assign;if(n=super.generate(e),r!==!0){const s=this.getNodeType(e);n=e.format(n,s,t)}return n}}class Tre extends Mn{constructor(e,t,n=0){super(t),this.bufferType=t,this.bufferCount=n,this.isWorkgroupInfoNode=!0,this.elementType=t,this.scope=e}label(e){return this.name=e,this}setScope(e){return this.scope=e,this}getElementType(){return this.elementType}getInputType(){return`${this.scope}Array`}element(e){return gt(new Sre(this,e))}generate(e){return e.getScopedArray(this.name||`${this.scope}Array_${this.id}`,this.scope.toLowerCase(),this.bufferType,this.bufferCount)}}const wre=(i,e)=>gt(new Tre("Workgroup",i,e));class Ds extends Zr{static get type(){return"AtomicFunctionNode"}constructor(e,t,n,r=null){super("uint"),this.method=e,this.pointerNode=t,this.valueNode=n,this.storeNode=r}getInputType(e){return this.pointerNode.getNodeType(e)}getNodeType(e){return this.getInputType(e)}generate(e){const t=this.method,n=this.getNodeType(e),r=this.getInputType(e),s=this.pointerNode,a=this.valueNode,l=[];l.push(`&${s.build(e,r)}`),l.push(a.build(e,r));const u=`${e.getMethod(t,n)}( ${l.join(", ")} )`;if(this.storeNode!==null){const h=this.storeNode.build(e,r);e.addLineFlowCode(`${h} = ${u}`,this)}else e.addLineFlowCode(u,this)}}Ds.ATOMIC_LOAD="atomicLoad";Ds.ATOMIC_STORE="atomicStore";Ds.ATOMIC_ADD="atomicAdd";Ds.ATOMIC_SUB="atomicSub";Ds.ATOMIC_MAX="atomicMax";Ds.ATOMIC_MIN="atomicMin";Ds.ATOMIC_AND="atomicAnd";Ds.ATOMIC_OR="atomicOr";Ds.ATOMIC_XOR="atomicXor";const Mre=ht(Ds),jc=(i,e,t,n=null)=>{const r=Mre(i,e,t,n);return r.append(),r},Ere=(i,e,t=null)=>jc(Ds.ATOMIC_STORE,i,e,t),Cre=(i,e,t=null)=>jc(Ds.ATOMIC_ADD,i,e,t),Rre=(i,e,t=null)=>jc(Ds.ATOMIC_SUB,i,e,t),Nre=(i,e,t=null)=>jc(Ds.ATOMIC_MAX,i,e,t),Dre=(i,e,t=null)=>jc(Ds.ATOMIC_MIN,i,e,t),Pre=(i,e,t=null)=>jc(Ds.ATOMIC_AND,i,e,t),Lre=(i,e,t=null)=>jc(Ds.ATOMIC_OR,i,e,t),Ure=(i,e,t=null)=>jc(Ds.ATOMIC_XOR,i,e,t);let pv;function t1(i){pv=pv||new WeakMap;let e=pv.get(i);return e===void 0&&pv.set(i,e={}),e}function CE(i){const e=t1(i);return e.shadowMatrix||(e.shadowMatrix=gn("mat4").setGroup(Rn).onRenderUpdate(()=>(i.castShadow!==!0&&i.shadow.updateMatrices(i),i.shadow.matrix)))}function MB(i){const e=t1(i);if(e.projectionUV===void 0){const t=CE(i).mul(Nc);e.projectionUV=t.xyz.div(t.w)}return e.projectionUV}function RE(i){const e=t1(i);return e.position||(e.position=gn(new ce).setGroup(Rn).onRenderUpdate((t,n)=>n.value.setFromMatrixPosition(i.matrixWorld)))}function EB(i){const e=t1(i);return e.targetPosition||(e.targetPosition=gn(new ce).setGroup(Rn).onRenderUpdate((t,n)=>n.value.setFromMatrixPosition(i.target.matrixWorld)))}function Jy(i){const e=t1(i);return e.viewPosition||(e.viewPosition=gn(new ce).setGroup(Rn).onRenderUpdate(({camera:t},n)=>{n.value=n.value||new ce,n.value.setFromMatrixPosition(i.matrixWorld),n.value.applyMatrix4(t.matrixWorldInverse)}))}const NE=i=>so.transformDirection(RE(i).sub(EB(i))),Bre=i=>i.sort((e,t)=>e.id-t.id),Ore=(i,e)=>{for(const t of e)if(t.isAnalyticLightNode&&t.light.id===i)return t;return null},oS=new WeakMap;class DE extends Mn{static get type(){return"LightsNode"}constructor(){super("vec3"),this.totalDiffuseNode=Ne().toVar("totalDiffuse"),this.totalSpecularNode=Ne().toVar("totalSpecular"),this.outgoingLightNode=Ne().toVar("outgoingLight"),this._lights=[],this._lightNodes=null,this._lightNodesHash=null,this.global=!0}customCacheKey(){const e=[],t=this._lights;for(let n=0;n0}}const Ire=(i=[])=>gt(new DE).setLights(i);class Fre extends Mn{static get type(){return"ShadowBaseNode"}constructor(e){super(),this.light=e,this.updateBeforeType=jn.RENDER,this.isShadowBaseNode=!0}setupShadowPosition({material:e}){PE.assign(e.shadowPositionNode||Nc)}dispose(){this.updateBeforeType=jn.NONE}}const PE=Ne().toVar("shadowPositionWorld");function kre(i,e={}){return e.toneMapping=i.toneMapping,e.toneMappingExposure=i.toneMappingExposure,e.outputColorSpace=i.outputColorSpace,e.renderTarget=i.getRenderTarget(),e.activeCubeFace=i.getActiveCubeFace(),e.activeMipmapLevel=i.getActiveMipmapLevel(),e.renderObjectFunction=i.getRenderObjectFunction(),e.pixelRatio=i.getPixelRatio(),e.mrt=i.getMRT(),e.clearColor=i.getClearColor(e.clearColor||new sn),e.clearAlpha=i.getClearAlpha(),e.autoClear=i.autoClear,e.scissorTest=i.getScissorTest(),e}function zre(i,e){return e=kre(i,e),i.setMRT(null),i.setRenderObjectFunction(null),i.setClearColor(0,1),i.autoClear=!0,e}function Gre(i,e){i.toneMapping=e.toneMapping,i.toneMappingExposure=e.toneMappingExposure,i.outputColorSpace=e.outputColorSpace,i.setRenderTarget(e.renderTarget,e.activeCubeFace,e.activeMipmapLevel),i.setRenderObjectFunction(e.renderObjectFunction),i.setPixelRatio(e.pixelRatio),i.setMRT(e.mrt),i.setClearColor(e.clearColor,e.clearAlpha),i.autoClear=e.autoClear,i.setScissorTest(e.scissorTest)}function qre(i,e={}){return e.background=i.background,e.backgroundNode=i.backgroundNode,e.overrideMaterial=i.overrideMaterial,e}function Vre(i,e){return e=qre(i,e),i.background=null,i.backgroundNode=null,i.overrideMaterial=null,e}function Hre(i,e){i.background=e.background,i.backgroundNode=e.backgroundNode,i.overrideMaterial=e.overrideMaterial}function jre(i,e,t){return t=zre(i,t),t=Vre(e,t),t}function Wre(i,e,t){Gre(i,t),Hre(e,t)}const oN=new WeakMap,$re=je(([i,e,t])=>{let n=Nc.sub(i).length();return n=n.sub(e).div(t.sub(e)),n=n.saturate(),n}),Xre=i=>{const e=i.shadow.camera,t=ji("near","float",e).setGroup(Rn),n=ji("far","float",e).setGroup(Rn),r=S9(i);return $re(r,t,n)},Yre=i=>{let e=oN.get(i);if(e===void 0){const t=i.isPointLight?Xre(i):null;e=new Vr,e.colorNode=dn(0,0,0,1),e.depthNode=t,e.isShadowNodeMaterial=!0,e.name="ShadowMaterial",e.fog=!1,oN.set(i,e)}return e},CB=je(({depthTexture:i,shadowCoord:e})=>Ai(i,e.xy).compare(e.z)),RB=je(({depthTexture:i,shadowCoord:e,shadow:t})=>{const n=(R,C)=>Ai(i,R).compare(C),r=ji("mapSize","vec2",t).setGroup(Rn),s=ji("radius","float",t).setGroup(Rn),a=Et(1).div(r),l=a.x.negate().mul(s),u=a.y.negate().mul(s),h=a.x.mul(s),g=a.y.mul(s),v=l.div(2),x=u.div(2),S=h.div(2),w=g.div(2);return Qr(n(e.xy.add(Et(l,u)),e.z),n(e.xy.add(Et(0,u)),e.z),n(e.xy.add(Et(h,u)),e.z),n(e.xy.add(Et(v,x)),e.z),n(e.xy.add(Et(0,x)),e.z),n(e.xy.add(Et(S,x)),e.z),n(e.xy.add(Et(l,0)),e.z),n(e.xy.add(Et(v,0)),e.z),n(e.xy,e.z),n(e.xy.add(Et(S,0)),e.z),n(e.xy.add(Et(h,0)),e.z),n(e.xy.add(Et(v,w)),e.z),n(e.xy.add(Et(0,w)),e.z),n(e.xy.add(Et(S,w)),e.z),n(e.xy.add(Et(l,g)),e.z),n(e.xy.add(Et(0,g)),e.z),n(e.xy.add(Et(h,g)),e.z)).mul(1/17)}),NB=je(({depthTexture:i,shadowCoord:e,shadow:t})=>{const n=(g,v)=>Ai(i,g).compare(v),r=ji("mapSize","vec2",t).setGroup(Rn),s=Et(1).div(r),a=s.x,l=s.y,u=e.xy,h=Hc(u.mul(r).add(.5));return u.subAssign(h.mul(s)),Qr(n(u,e.z),n(u.add(Et(a,0)),e.z),n(u.add(Et(0,l)),e.z),n(u.add(s),e.z),Fi(n(u.add(Et(a.negate(),0)),e.z),n(u.add(Et(a.mul(2),0)),e.z),h.x),Fi(n(u.add(Et(a.negate(),l)),e.z),n(u.add(Et(a.mul(2),l)),e.z),h.x),Fi(n(u.add(Et(0,l.negate())),e.z),n(u.add(Et(0,l.mul(2))),e.z),h.y),Fi(n(u.add(Et(a,l.negate())),e.z),n(u.add(Et(a,l.mul(2))),e.z),h.y),Fi(Fi(n(u.add(Et(a.negate(),l.negate())),e.z),n(u.add(Et(a.mul(2),l.negate())),e.z),h.x),Fi(n(u.add(Et(a.negate(),l.mul(2))),e.z),n(u.add(Et(a.mul(2),l.mul(2))),e.z),h.x),h.y)).mul(1/9)}),DB=je(({depthTexture:i,shadowCoord:e})=>{const t=ge(1).toVar(),n=Ai(i).sample(e.xy).rg,r=Fy(e.z,n.x);return ti(r.notEqual(ge(1)),()=>{const s=e.z.sub(n.x),a=qr(0,n.y.mul(n.y));let l=a.div(a.add(s.mul(s)));l=vu(Ti(l,.3).div(.95-.3)),t.assign(vu(qr(r,l)))}),t}),Qre=je(({samples:i,radius:e,size:t,shadowPass:n})=>{const r=ge(0).toVar(),s=ge(0).toVar(),a=i.lessThanEqual(ge(1)).select(ge(0),ge(2).div(i.sub(1))),l=i.lessThanEqual(ge(1)).select(ge(0),ge(-1));ki({start:ye(0),end:ye(i),type:"int",condition:"<"},({i:h})=>{const g=l.add(ge(h).mul(a)),v=n.sample(Qr(e1.xy,Et(0,g).mul(e)).div(t)).x;r.addAssign(v),s.addAssign(v.mul(v))}),r.divAssign(i),s.divAssign(i);const u=Cu(s.sub(r.mul(r)));return Et(r,u)}),Kre=je(({samples:i,radius:e,size:t,shadowPass:n})=>{const r=ge(0).toVar(),s=ge(0).toVar(),a=i.lessThanEqual(ge(1)).select(ge(0),ge(2).div(i.sub(1))),l=i.lessThanEqual(ge(1)).select(ge(0),ge(-1));ki({start:ye(0),end:ye(i),type:"int",condition:"<"},({i:h})=>{const g=l.add(ge(h).mul(a)),v=n.sample(Qr(e1.xy,Et(g,0).mul(e)).div(t));r.addAssign(v.x),s.addAssign(Qr(v.y.mul(v.y),v.x.mul(v.x)))}),r.divAssign(i),s.divAssign(i);const u=Cu(s.sub(r.mul(r)));return Et(r,u)}),Zre=[CB,RB,NB,DB];let lS;const mv=new SE;class PB extends Fre{static get type(){return"ShadowNode"}constructor(e,t=null){super(e),this.shadow=t||e.shadow,this.shadowMap=null,this.vsmShadowMapVertical=null,this.vsmShadowMapHorizontal=null,this.vsmMaterialVertical=null,this.vsmMaterialHorizontal=null,this._node=null,this.isShadowNode=!0}setupShadowFilter(e,{filterFn:t,depthTexture:n,shadowCoord:r,shadow:s}){const a=r.x.greaterThanEqual(0).and(r.x.lessThanEqual(1)).and(r.y.greaterThanEqual(0)).and(r.y.lessThanEqual(1)).and(r.z.lessThanEqual(1)),l=t({depthTexture:n,shadowCoord:r,shadow:s});return a.select(l,ge(1))}setupShadowCoord(e,t){const{shadow:n}=this,{renderer:r}=e,s=ji("bias","float",n).setGroup(Rn);let a=t,l;if(n.camera.isOrthographicCamera||r.logarithmicDepthBuffer!==!0)a=a.xyz.div(a.w),l=a.z,r.coordinateSystem===pu&&(l=l.mul(2).sub(1));else{const u=a.w;a=a.xy.div(u);const h=ji("near","float",n.camera).setGroup(Rn),g=ji("far","float",n.camera).setGroup(Rn);l=AE(u.negate(),h,g)}return a=Ne(a.x,a.y.oneMinus(),l.add(s)),a}getShadowFilterFn(e){return Zre[e]}setupShadow(e){const{renderer:t}=e,{light:n,shadow:r}=this,s=t.shadowMap.type,a=new qc(r.mapSize.width,r.mapSize.height);a.compareFunction=my;const l=e.createRenderTarget(r.mapSize.width,r.mapSize.height);if(l.depthTexture=a,r.camera.updateProjectionMatrix(),s===xo){a.compareFunction=null,this.vsmShadowMapVertical=e.createRenderTarget(r.mapSize.width,r.mapSize.height,{format:lA,type:Gs}),this.vsmShadowMapHorizontal=e.createRenderTarget(r.mapSize.width,r.mapSize.height,{format:lA,type:Gs});const E=Ai(a),B=Ai(this.vsmShadowMapVertical.texture),L=ji("blurSamples","float",r).setGroup(Rn),O=ji("radius","float",r).setGroup(Rn),z=ji("mapSize","vec2",r).setGroup(Rn);let G=this.vsmMaterialVertical||(this.vsmMaterialVertical=new Vr);G.fragmentNode=Qre({samples:L,radius:O,size:z,shadowPass:E}).context(e.getSharedContext()),G.name="VSMVertical",G=this.vsmMaterialHorizontal||(this.vsmMaterialHorizontal=new Vr),G.fragmentNode=Kre({samples:L,radius:O,size:z,shadowPass:B}).context(e.getSharedContext()),G.name="VSMHorizontal"}const u=ji("intensity","float",r).setGroup(Rn),h=ji("normalBias","float",r).setGroup(Rn),g=CE(n).mul(PE.add(Hy.mul(h))),v=this.setupShadowCoord(e,g),x=r.filterNode||this.getShadowFilterFn(t.shadowMap.type)||null;if(x===null)throw new Error("THREE.WebGPURenderer: Shadow map type not supported yet.");const S=s===xo?this.vsmShadowMapHorizontal.texture:a,w=this.setupShadowFilter(e,{filterFn:x,shadowTexture:l.texture,depthTexture:S,shadowCoord:v,shadow:r}),R=Ai(l.texture,v),C=Fi(1,w.rgb.mix(R,1),u.mul(R.a)).toVar();return this.shadowMap=l,this.shadow.map=l,C}setup(e){if(e.renderer.shadowMap.enabled!==!1)return je(()=>{let t=this._node;return this.setupShadowPosition(e),t===null&&(this._node=t=this.setupShadow(e)),e.material.shadowNode&&console.warn('THREE.NodeMaterial: ".shadowNode" is deprecated. Use ".castShadowNode" instead.'),e.material.receivedShadowNode&&(t=e.material.receivedShadowNode(t)),t})()}renderShadow(e){const{shadow:t,shadowMap:n,light:r}=this,{renderer:s,scene:a}=e;t.updateMatrices(r),n.setSize(t.mapSize.width,t.mapSize.height),s.render(a,t.camera)}updateShadow(e){const{shadowMap:t,light:n,shadow:r}=this,{renderer:s,scene:a,camera:l}=e,u=s.shadowMap.type,h=t.depthTexture.version;this._depthVersionCached=h,r.camera.layers.mask=l.layers.mask;const g=s.getRenderObjectFunction(),v=s.getMRT(),x=v?v.has("velocity"):!1;lS=jre(s,a,lS),a.overrideMaterial=Yre(n),s.setRenderObjectFunction((S,w,R,C,E,B,...L)=>{(S.castShadow===!0||S.receiveShadow&&u===xo)&&(x&&(IP(S).useVelocity=!0),S.onBeforeShadow(s,S,l,r.camera,C,w.overrideMaterial,B),s.renderObject(S,w,R,C,E,B,...L),S.onAfterShadow(s,S,l,r.camera,C,w.overrideMaterial,B))}),s.setRenderTarget(t),this.renderShadow(e),s.setRenderObjectFunction(g),n.isPointLight!==!0&&u===xo&&this.vsmPass(s),Wre(s,a,lS)}vsmPass(e){const{shadow:t}=this;this.vsmShadowMapVertical.setSize(t.mapSize.width,t.mapSize.height),this.vsmShadowMapHorizontal.setSize(t.mapSize.width,t.mapSize.height),e.setRenderTarget(this.vsmShadowMapVertical),mv.material=this.vsmMaterialVertical,mv.render(e),e.setRenderTarget(this.vsmShadowMapHorizontal),mv.material=this.vsmMaterialHorizontal,mv.render(e)}dispose(){this.shadowMap.dispose(),this.shadowMap=null,this.vsmShadowMapVertical!==null&&(this.vsmShadowMapVertical.dispose(),this.vsmShadowMapVertical=null,this.vsmMaterialVertical.dispose(),this.vsmMaterialVertical=null),this.vsmShadowMapHorizontal!==null&&(this.vsmShadowMapHorizontal.dispose(),this.vsmShadowMapHorizontal=null,this.vsmMaterialHorizontal.dispose(),this.vsmMaterialHorizontal=null),super.dispose()}updateBefore(e){const{shadow:t}=this;(t.needsUpdate||t.autoUpdate)&&(this.updateShadow(e),this.shadowMap.depthTexture.version===this._depthVersionCached&&(t.needsUpdate=!1))}}const LB=(i,e)=>gt(new PB(i,e));class xA extends K0{static get type(){return"AnalyticLightNode"}constructor(e=null){super(),this.light=e,this.color=new sn,this.colorNode=e&&e.colorNode||gn(this.color).setGroup(Rn),this.baseColorNode=null,this.shadowNode=null,this.shadowColorNode=null,this.isAnalyticLightNode=!0,this.updateType=jn.FRAME}customCacheKey(){return MM(this.light.id,this.light.castShadow?1:0)}getHash(){return this.light.uuid}setupShadowNode(){return LB(this.light)}setupShadow(e){const{renderer:t}=e;if(t.shadowMap.enabled===!1)return;let n=this.shadowColorNode;if(n===null){const r=this.light.shadow.shadowNode;let s;r!==void 0?s=gt(r):s=this.setupShadowNode(e),this.shadowNode=s,this.shadowColorNode=n=this.colorNode.mul(s),this.baseColorNode=this.colorNode}this.colorNode=n}setup(e){this.colorNode=this.baseColorNode||this.colorNode,this.light.castShadow?e.object.receiveShadow&&this.setupShadow(e):this.shadowNode!==null&&(this.shadowNode.dispose(),this.shadowNode=null,this.shadowColorNode=null)}update(){const{light:e}=this;this.color.copy(e.color).multiplyScalar(e.intensity)}}const LE=je(i=>{const{lightDistance:e,cutoffDistance:t,decayExponent:n}=i,r=e.pow(n).max(.01).reciprocal();return t.greaterThan(0).select(r.mul(e.div(t).pow4().oneMinus().clamp().pow2()),r)}),Jre=new sn,Xl=je(([i,e])=>{const t=i.toVar(),n=ur(t),r=Dl(1,qr(n.x,qr(n.y,n.z)));n.mulAssign(r),t.mulAssign(r.mul(e.mul(2).oneMinus()));const s=Et(t.xy).toVar(),l=e.mul(1.5).oneMinus();return ti(n.z.greaterThanEqual(l),()=>{ti(t.z.greaterThan(0),()=>{s.x.assign(Ti(4,t.x))})}).ElseIf(n.x.greaterThanEqual(l),()=>{const u=Cg(t.x);s.x.assign(t.z.mul(u).add(u.mul(2)))}).ElseIf(n.y.greaterThanEqual(l),()=>{const u=Cg(t.y);s.x.assign(t.x.add(u.mul(2)).add(2)),s.y.assign(t.z.mul(u).sub(2))}),Et(.125,.25).mul(s).add(Et(.375,.75)).flipY()}).setLayout({name:"cubeToUV",type:"vec2",inputs:[{name:"pos",type:"vec3"},{name:"texelSizeY",type:"float"}]}),ese=je(({depthTexture:i,bd3D:e,dp:t,texelSize:n})=>Ai(i,Xl(e,n.y)).compare(t)),tse=je(({depthTexture:i,bd3D:e,dp:t,texelSize:n,shadow:r})=>{const s=ji("radius","float",r).setGroup(Rn),a=Et(-1,1).mul(s).mul(n.y);return Ai(i,Xl(e.add(a.xyy),n.y)).compare(t).add(Ai(i,Xl(e.add(a.yyy),n.y)).compare(t)).add(Ai(i,Xl(e.add(a.xyx),n.y)).compare(t)).add(Ai(i,Xl(e.add(a.yyx),n.y)).compare(t)).add(Ai(i,Xl(e,n.y)).compare(t)).add(Ai(i,Xl(e.add(a.xxy),n.y)).compare(t)).add(Ai(i,Xl(e.add(a.yxy),n.y)).compare(t)).add(Ai(i,Xl(e.add(a.xxx),n.y)).compare(t)).add(Ai(i,Xl(e.add(a.yxx),n.y)).compare(t)).mul(1/9)}),nse=je(({filterFn:i,depthTexture:e,shadowCoord:t,shadow:n})=>{const r=t.xyz.toVar(),s=r.length(),a=gn("float").setGroup(Rn).onRenderUpdate(()=>n.camera.near),l=gn("float").setGroup(Rn).onRenderUpdate(()=>n.camera.far),u=ji("bias","float",n).setGroup(Rn),h=gn(n.mapSize).setGroup(Rn),g=ge(1).toVar();return ti(s.sub(l).lessThanEqual(0).and(s.sub(a).greaterThanEqual(0)),()=>{const v=s.sub(a).div(l.sub(a)).toVar();v.addAssign(u);const x=r.normalize(),S=Et(1).div(h.mul(Et(4,2)));g.assign(i({depthTexture:e,bd3D:x,dp:v,texelSize:S,shadow:n}))}),g}),lN=new Pn,Nd=new dt,Am=new dt;class ise extends PB{static get type(){return"PointShadowNode"}constructor(e,t=null){super(e,t)}getShadowFilterFn(e){return e===UF?ese:tse}setupShadowCoord(e,t){return t}setupShadowFilter(e,{filterFn:t,shadowTexture:n,depthTexture:r,shadowCoord:s,shadow:a}){return nse({filterFn:t,shadowTexture:n,depthTexture:r,shadowCoord:s,shadow:a})}renderShadow(e){const{shadow:t,shadowMap:n,light:r}=this,{renderer:s,scene:a}=e,l=t.getFrameExtents();Am.copy(t.mapSize),Am.multiply(l),n.setSize(Am.width,Am.height),Nd.copy(t.mapSize);const u=s.autoClear,h=s.getClearColor(Jre),g=s.getClearAlpha();s.autoClear=!1,s.setClearColor(t.clearColor,t.clearAlpha),s.clear();const v=t.getViewportCount();for(let x=0;xgt(new ise(i,e)),UB=je(({color:i,lightViewPosition:e,cutoffDistance:t,decayExponent:n},r)=>{const s=r.context.lightingModel,a=e.sub(Xr),l=a.normalize(),u=a.length(),h=LE({lightDistance:u,cutoffDistance:t,decayExponent:n}),g=i.mul(h),v=r.context.reflectedLight;s.direct({lightDirection:l,lightColor:g,reflectedLight:v},r.stack,r)});class sse extends xA{static get type(){return"PointLightNode"}constructor(e=null){super(e),this.cutoffDistanceNode=gn(0).setGroup(Rn),this.decayExponentNode=gn(2).setGroup(Rn)}update(e){const{light:t}=this;super.update(e),this.cutoffDistanceNode.value=t.distance,this.decayExponentNode.value=t.decay}setupShadowNode(){return rse(this.light)}setup(e){super.setup(e),UB({color:this.colorNode,lightViewPosition:Jy(this.light),cutoffDistance:this.cutoffDistanceNode,decayExponent:this.decayExponentNode}).append()}}const ase=je(([i=Er()])=>{const e=i.mul(2),t=e.x.floor(),n=e.y.floor();return t.add(n).mod(2).sign()}),zm=je(([i,e,t])=>{const n=ge(t).toVar(),r=ge(e).toVar(),s=Ic(i).toVar();return zs(s,r,n)}).setLayout({name:"mx_select",type:"float",inputs:[{name:"b",type:"bool"},{name:"t",type:"float"},{name:"f",type:"float"}]}),ry=je(([i,e])=>{const t=Ic(e).toVar(),n=ge(i).toVar();return zs(t,n.negate(),n)}).setLayout({name:"mx_negate_if",type:"float",inputs:[{name:"val",type:"float"},{name:"b",type:"bool"}]}),Yr=je(([i])=>{const e=ge(i).toVar();return ye(hu(e))}).setLayout({name:"mx_floor",type:"int",inputs:[{name:"x",type:"float"}]}),_r=je(([i,e])=>{const t=ge(i).toVar();return e.assign(Yr(t)),t.sub(ge(e))}),ose=je(([i,e,t,n,r,s])=>{const a=ge(s).toVar(),l=ge(r).toVar(),u=ge(n).toVar(),h=ge(t).toVar(),g=ge(e).toVar(),v=ge(i).toVar(),x=ge(Ti(1,l)).toVar();return Ti(1,a).mul(v.mul(x).add(g.mul(l))).add(a.mul(h.mul(x).add(u.mul(l))))}).setLayout({name:"mx_bilerp_0",type:"float",inputs:[{name:"v0",type:"float"},{name:"v1",type:"float"},{name:"v2",type:"float"},{name:"v3",type:"float"},{name:"s",type:"float"},{name:"t",type:"float"}]}),lse=je(([i,e,t,n,r,s])=>{const a=ge(s).toVar(),l=ge(r).toVar(),u=Ne(n).toVar(),h=Ne(t).toVar(),g=Ne(e).toVar(),v=Ne(i).toVar(),x=ge(Ti(1,l)).toVar();return Ti(1,a).mul(v.mul(x).add(g.mul(l))).add(a.mul(h.mul(x).add(u.mul(l))))}).setLayout({name:"mx_bilerp_1",type:"vec3",inputs:[{name:"v0",type:"vec3"},{name:"v1",type:"vec3"},{name:"v2",type:"vec3"},{name:"v3",type:"vec3"},{name:"s",type:"float"},{name:"t",type:"float"}]}),BB=Vs([ose,lse]),use=je(([i,e,t,n,r,s,a,l,u,h,g])=>{const v=ge(g).toVar(),x=ge(h).toVar(),S=ge(u).toVar(),w=ge(l).toVar(),R=ge(a).toVar(),C=ge(s).toVar(),E=ge(r).toVar(),B=ge(n).toVar(),L=ge(t).toVar(),O=ge(e).toVar(),z=ge(i).toVar(),G=ge(Ti(1,S)).toVar(),k=ge(Ti(1,x)).toVar();return ge(Ti(1,v)).toVar().mul(k.mul(z.mul(G).add(O.mul(S))).add(x.mul(L.mul(G).add(B.mul(S))))).add(v.mul(k.mul(E.mul(G).add(C.mul(S))).add(x.mul(R.mul(G).add(w.mul(S))))))}).setLayout({name:"mx_trilerp_0",type:"float",inputs:[{name:"v0",type:"float"},{name:"v1",type:"float"},{name:"v2",type:"float"},{name:"v3",type:"float"},{name:"v4",type:"float"},{name:"v5",type:"float"},{name:"v6",type:"float"},{name:"v7",type:"float"},{name:"s",type:"float"},{name:"t",type:"float"},{name:"r",type:"float"}]}),cse=je(([i,e,t,n,r,s,a,l,u,h,g])=>{const v=ge(g).toVar(),x=ge(h).toVar(),S=ge(u).toVar(),w=Ne(l).toVar(),R=Ne(a).toVar(),C=Ne(s).toVar(),E=Ne(r).toVar(),B=Ne(n).toVar(),L=Ne(t).toVar(),O=Ne(e).toVar(),z=Ne(i).toVar(),G=ge(Ti(1,S)).toVar(),k=ge(Ti(1,x)).toVar();return ge(Ti(1,v)).toVar().mul(k.mul(z.mul(G).add(O.mul(S))).add(x.mul(L.mul(G).add(B.mul(S))))).add(v.mul(k.mul(E.mul(G).add(C.mul(S))).add(x.mul(R.mul(G).add(w.mul(S))))))}).setLayout({name:"mx_trilerp_1",type:"vec3",inputs:[{name:"v0",type:"vec3"},{name:"v1",type:"vec3"},{name:"v2",type:"vec3"},{name:"v3",type:"vec3"},{name:"v4",type:"vec3"},{name:"v5",type:"vec3"},{name:"v6",type:"vec3"},{name:"v7",type:"vec3"},{name:"s",type:"float"},{name:"t",type:"float"},{name:"r",type:"float"}]}),OB=Vs([use,cse]),hse=je(([i,e,t])=>{const n=ge(t).toVar(),r=ge(e).toVar(),s=Qt(i).toVar(),a=Qt(s.bitAnd(Qt(7))).toVar(),l=ge(zm(a.lessThan(Qt(4)),r,n)).toVar(),u=ge(Wn(2,zm(a.lessThan(Qt(4)),n,r))).toVar();return ry(l,Ic(a.bitAnd(Qt(1)))).add(ry(u,Ic(a.bitAnd(Qt(2)))))}).setLayout({name:"mx_gradient_float_0",type:"float",inputs:[{name:"hash",type:"uint"},{name:"x",type:"float"},{name:"y",type:"float"}]}),fse=je(([i,e,t,n])=>{const r=ge(n).toVar(),s=ge(t).toVar(),a=ge(e).toVar(),l=Qt(i).toVar(),u=Qt(l.bitAnd(Qt(15))).toVar(),h=ge(zm(u.lessThan(Qt(8)),a,s)).toVar(),g=ge(zm(u.lessThan(Qt(4)),s,zm(u.equal(Qt(12)).or(u.equal(Qt(14))),a,r))).toVar();return ry(h,Ic(u.bitAnd(Qt(1)))).add(ry(g,Ic(u.bitAnd(Qt(2)))))}).setLayout({name:"mx_gradient_float_1",type:"float",inputs:[{name:"hash",type:"uint"},{name:"x",type:"float"},{name:"y",type:"float"},{name:"z",type:"float"}]}),Rs=Vs([hse,fse]),Ase=je(([i,e,t])=>{const n=ge(t).toVar(),r=ge(e).toVar(),s=Y0(i).toVar();return Ne(Rs(s.x,r,n),Rs(s.y,r,n),Rs(s.z,r,n))}).setLayout({name:"mx_gradient_vec3_0",type:"vec3",inputs:[{name:"hash",type:"uvec3"},{name:"x",type:"float"},{name:"y",type:"float"}]}),dse=je(([i,e,t,n])=>{const r=ge(n).toVar(),s=ge(t).toVar(),a=ge(e).toVar(),l=Y0(i).toVar();return Ne(Rs(l.x,a,s,r),Rs(l.y,a,s,r),Rs(l.z,a,s,r))}).setLayout({name:"mx_gradient_vec3_1",type:"vec3",inputs:[{name:"hash",type:"uvec3"},{name:"x",type:"float"},{name:"y",type:"float"},{name:"z",type:"float"}]}),Ho=Vs([Ase,dse]),pse=je(([i])=>{const e=ge(i).toVar();return Wn(.6616,e)}).setLayout({name:"mx_gradient_scale2d_0",type:"float",inputs:[{name:"v",type:"float"}]}),mse=je(([i])=>{const e=ge(i).toVar();return Wn(.982,e)}).setLayout({name:"mx_gradient_scale3d_0",type:"float",inputs:[{name:"v",type:"float"}]}),gse=je(([i])=>{const e=Ne(i).toVar();return Wn(.6616,e)}).setLayout({name:"mx_gradient_scale2d_1",type:"vec3",inputs:[{name:"v",type:"vec3"}]}),IB=Vs([pse,gse]),vse=je(([i])=>{const e=Ne(i).toVar();return Wn(.982,e)}).setLayout({name:"mx_gradient_scale3d_1",type:"vec3",inputs:[{name:"v",type:"vec3"}]}),FB=Vs([mse,vse]),To=je(([i,e])=>{const t=ye(e).toVar(),n=Qt(i).toVar();return n.shiftLeft(t).bitOr(n.shiftRight(ye(32).sub(t)))}).setLayout({name:"mx_rotl32",type:"uint",inputs:[{name:"x",type:"uint"},{name:"k",type:"int"}]}),kB=je(([i,e,t])=>{i.subAssign(t),i.bitXorAssign(To(t,ye(4))),t.addAssign(e),e.subAssign(i),e.bitXorAssign(To(i,ye(6))),i.addAssign(t),t.subAssign(e),t.bitXorAssign(To(e,ye(8))),e.addAssign(i),i.subAssign(t),i.bitXorAssign(To(t,ye(16))),t.addAssign(e),e.subAssign(i),e.bitXorAssign(To(i,ye(19))),i.addAssign(t),t.subAssign(e),t.bitXorAssign(To(e,ye(4))),e.addAssign(i)}),n1=je(([i,e,t])=>{const n=Qt(t).toVar(),r=Qt(e).toVar(),s=Qt(i).toVar();return n.bitXorAssign(r),n.subAssign(To(r,ye(14))),s.bitXorAssign(n),s.subAssign(To(n,ye(11))),r.bitXorAssign(s),r.subAssign(To(s,ye(25))),n.bitXorAssign(r),n.subAssign(To(r,ye(16))),s.bitXorAssign(n),s.subAssign(To(n,ye(4))),r.bitXorAssign(s),r.subAssign(To(s,ye(14))),n.bitXorAssign(r),n.subAssign(To(r,ye(24))),n}).setLayout({name:"mx_bjfinal",type:"uint",inputs:[{name:"a",type:"uint"},{name:"b",type:"uint"},{name:"c",type:"uint"}]}),oa=je(([i])=>{const e=Qt(i).toVar();return ge(e).div(ge(Qt(ye(4294967295))))}).setLayout({name:"mx_bits_to_01",type:"float",inputs:[{name:"bits",type:"uint"}]}),fu=je(([i])=>{const e=ge(i).toVar();return e.mul(e).mul(e).mul(e.mul(e.mul(6).sub(15)).add(10))}).setLayout({name:"mx_fade",type:"float",inputs:[{name:"t",type:"float"}]}),_se=je(([i])=>{const e=ye(i).toVar(),t=Qt(Qt(1)).toVar(),n=Qt(Qt(ye(3735928559)).add(t.shiftLeft(Qt(2))).add(Qt(13))).toVar();return n1(n.add(Qt(e)),n,n)}).setLayout({name:"mx_hash_int_0",type:"uint",inputs:[{name:"x",type:"int"}]}),yse=je(([i,e])=>{const t=ye(e).toVar(),n=ye(i).toVar(),r=Qt(Qt(2)).toVar(),s=Qt().toVar(),a=Qt().toVar(),l=Qt().toVar();return s.assign(a.assign(l.assign(Qt(ye(3735928559)).add(r.shiftLeft(Qt(2))).add(Qt(13))))),s.addAssign(Qt(n)),a.addAssign(Qt(t)),n1(s,a,l)}).setLayout({name:"mx_hash_int_1",type:"uint",inputs:[{name:"x",type:"int"},{name:"y",type:"int"}]}),xse=je(([i,e,t])=>{const n=ye(t).toVar(),r=ye(e).toVar(),s=ye(i).toVar(),a=Qt(Qt(3)).toVar(),l=Qt().toVar(),u=Qt().toVar(),h=Qt().toVar();return l.assign(u.assign(h.assign(Qt(ye(3735928559)).add(a.shiftLeft(Qt(2))).add(Qt(13))))),l.addAssign(Qt(s)),u.addAssign(Qt(r)),h.addAssign(Qt(n)),n1(l,u,h)}).setLayout({name:"mx_hash_int_2",type:"uint",inputs:[{name:"x",type:"int"},{name:"y",type:"int"},{name:"z",type:"int"}]}),bse=je(([i,e,t,n])=>{const r=ye(n).toVar(),s=ye(t).toVar(),a=ye(e).toVar(),l=ye(i).toVar(),u=Qt(Qt(4)).toVar(),h=Qt().toVar(),g=Qt().toVar(),v=Qt().toVar();return h.assign(g.assign(v.assign(Qt(ye(3735928559)).add(u.shiftLeft(Qt(2))).add(Qt(13))))),h.addAssign(Qt(l)),g.addAssign(Qt(a)),v.addAssign(Qt(s)),kB(h,g,v),h.addAssign(Qt(r)),n1(h,g,v)}).setLayout({name:"mx_hash_int_3",type:"uint",inputs:[{name:"x",type:"int"},{name:"y",type:"int"},{name:"z",type:"int"},{name:"xx",type:"int"}]}),Sse=je(([i,e,t,n,r])=>{const s=ye(r).toVar(),a=ye(n).toVar(),l=ye(t).toVar(),u=ye(e).toVar(),h=ye(i).toVar(),g=Qt(Qt(5)).toVar(),v=Qt().toVar(),x=Qt().toVar(),S=Qt().toVar();return v.assign(x.assign(S.assign(Qt(ye(3735928559)).add(g.shiftLeft(Qt(2))).add(Qt(13))))),v.addAssign(Qt(h)),x.addAssign(Qt(u)),S.addAssign(Qt(l)),kB(v,x,S),v.addAssign(Qt(a)),x.addAssign(Qt(s)),n1(v,x,S)}).setLayout({name:"mx_hash_int_4",type:"uint",inputs:[{name:"x",type:"int"},{name:"y",type:"int"},{name:"z",type:"int"},{name:"xx",type:"int"},{name:"yy",type:"int"}]}),Wi=Vs([_se,yse,xse,bse,Sse]),Tse=je(([i,e])=>{const t=ye(e).toVar(),n=ye(i).toVar(),r=Qt(Wi(n,t)).toVar(),s=Y0().toVar();return s.x.assign(r.bitAnd(ye(255))),s.y.assign(r.shiftRight(ye(8)).bitAnd(ye(255))),s.z.assign(r.shiftRight(ye(16)).bitAnd(ye(255))),s}).setLayout({name:"mx_hash_vec3_0",type:"uvec3",inputs:[{name:"x",type:"int"},{name:"y",type:"int"}]}),wse=je(([i,e,t])=>{const n=ye(t).toVar(),r=ye(e).toVar(),s=ye(i).toVar(),a=Qt(Wi(s,r,n)).toVar(),l=Y0().toVar();return l.x.assign(a.bitAnd(ye(255))),l.y.assign(a.shiftRight(ye(8)).bitAnd(ye(255))),l.z.assign(a.shiftRight(ye(16)).bitAnd(ye(255))),l}).setLayout({name:"mx_hash_vec3_1",type:"uvec3",inputs:[{name:"x",type:"int"},{name:"y",type:"int"},{name:"z",type:"int"}]}),jo=Vs([Tse,wse]),Mse=je(([i])=>{const e=Et(i).toVar(),t=ye().toVar(),n=ye().toVar(),r=ge(_r(e.x,t)).toVar(),s=ge(_r(e.y,n)).toVar(),a=ge(fu(r)).toVar(),l=ge(fu(s)).toVar(),u=ge(BB(Rs(Wi(t,n),r,s),Rs(Wi(t.add(ye(1)),n),r.sub(1),s),Rs(Wi(t,n.add(ye(1))),r,s.sub(1)),Rs(Wi(t.add(ye(1)),n.add(ye(1))),r.sub(1),s.sub(1)),a,l)).toVar();return IB(u)}).setLayout({name:"mx_perlin_noise_float_0",type:"float",inputs:[{name:"p",type:"vec2"}]}),Ese=je(([i])=>{const e=Ne(i).toVar(),t=ye().toVar(),n=ye().toVar(),r=ye().toVar(),s=ge(_r(e.x,t)).toVar(),a=ge(_r(e.y,n)).toVar(),l=ge(_r(e.z,r)).toVar(),u=ge(fu(s)).toVar(),h=ge(fu(a)).toVar(),g=ge(fu(l)).toVar(),v=ge(OB(Rs(Wi(t,n,r),s,a,l),Rs(Wi(t.add(ye(1)),n,r),s.sub(1),a,l),Rs(Wi(t,n.add(ye(1)),r),s,a.sub(1),l),Rs(Wi(t.add(ye(1)),n.add(ye(1)),r),s.sub(1),a.sub(1),l),Rs(Wi(t,n,r.add(ye(1))),s,a,l.sub(1)),Rs(Wi(t.add(ye(1)),n,r.add(ye(1))),s.sub(1),a,l.sub(1)),Rs(Wi(t,n.add(ye(1)),r.add(ye(1))),s,a.sub(1),l.sub(1)),Rs(Wi(t.add(ye(1)),n.add(ye(1)),r.add(ye(1))),s.sub(1),a.sub(1),l.sub(1)),u,h,g)).toVar();return FB(v)}).setLayout({name:"mx_perlin_noise_float_1",type:"float",inputs:[{name:"p",type:"vec3"}]}),UE=Vs([Mse,Ese]),Cse=je(([i])=>{const e=Et(i).toVar(),t=ye().toVar(),n=ye().toVar(),r=ge(_r(e.x,t)).toVar(),s=ge(_r(e.y,n)).toVar(),a=ge(fu(r)).toVar(),l=ge(fu(s)).toVar(),u=Ne(BB(Ho(jo(t,n),r,s),Ho(jo(t.add(ye(1)),n),r.sub(1),s),Ho(jo(t,n.add(ye(1))),r,s.sub(1)),Ho(jo(t.add(ye(1)),n.add(ye(1))),r.sub(1),s.sub(1)),a,l)).toVar();return IB(u)}).setLayout({name:"mx_perlin_noise_vec3_0",type:"vec3",inputs:[{name:"p",type:"vec2"}]}),Rse=je(([i])=>{const e=Ne(i).toVar(),t=ye().toVar(),n=ye().toVar(),r=ye().toVar(),s=ge(_r(e.x,t)).toVar(),a=ge(_r(e.y,n)).toVar(),l=ge(_r(e.z,r)).toVar(),u=ge(fu(s)).toVar(),h=ge(fu(a)).toVar(),g=ge(fu(l)).toVar(),v=Ne(OB(Ho(jo(t,n,r),s,a,l),Ho(jo(t.add(ye(1)),n,r),s.sub(1),a,l),Ho(jo(t,n.add(ye(1)),r),s,a.sub(1),l),Ho(jo(t.add(ye(1)),n.add(ye(1)),r),s.sub(1),a.sub(1),l),Ho(jo(t,n,r.add(ye(1))),s,a,l.sub(1)),Ho(jo(t.add(ye(1)),n,r.add(ye(1))),s.sub(1),a,l.sub(1)),Ho(jo(t,n.add(ye(1)),r.add(ye(1))),s,a.sub(1),l.sub(1)),Ho(jo(t.add(ye(1)),n.add(ye(1)),r.add(ye(1))),s.sub(1),a.sub(1),l.sub(1)),u,h,g)).toVar();return FB(v)}).setLayout({name:"mx_perlin_noise_vec3_1",type:"vec3",inputs:[{name:"p",type:"vec3"}]}),BE=Vs([Cse,Rse]),Nse=je(([i])=>{const e=ge(i).toVar(),t=ye(Yr(e)).toVar();return oa(Wi(t))}).setLayout({name:"mx_cell_noise_float_0",type:"float",inputs:[{name:"p",type:"float"}]}),Dse=je(([i])=>{const e=Et(i).toVar(),t=ye(Yr(e.x)).toVar(),n=ye(Yr(e.y)).toVar();return oa(Wi(t,n))}).setLayout({name:"mx_cell_noise_float_1",type:"float",inputs:[{name:"p",type:"vec2"}]}),Pse=je(([i])=>{const e=Ne(i).toVar(),t=ye(Yr(e.x)).toVar(),n=ye(Yr(e.y)).toVar(),r=ye(Yr(e.z)).toVar();return oa(Wi(t,n,r))}).setLayout({name:"mx_cell_noise_float_2",type:"float",inputs:[{name:"p",type:"vec3"}]}),Lse=je(([i])=>{const e=dn(i).toVar(),t=ye(Yr(e.x)).toVar(),n=ye(Yr(e.y)).toVar(),r=ye(Yr(e.z)).toVar(),s=ye(Yr(e.w)).toVar();return oa(Wi(t,n,r,s))}).setLayout({name:"mx_cell_noise_float_3",type:"float",inputs:[{name:"p",type:"vec4"}]}),Use=Vs([Nse,Dse,Pse,Lse]),Bse=je(([i])=>{const e=ge(i).toVar(),t=ye(Yr(e)).toVar();return Ne(oa(Wi(t,ye(0))),oa(Wi(t,ye(1))),oa(Wi(t,ye(2))))}).setLayout({name:"mx_cell_noise_vec3_0",type:"vec3",inputs:[{name:"p",type:"float"}]}),Ose=je(([i])=>{const e=Et(i).toVar(),t=ye(Yr(e.x)).toVar(),n=ye(Yr(e.y)).toVar();return Ne(oa(Wi(t,n,ye(0))),oa(Wi(t,n,ye(1))),oa(Wi(t,n,ye(2))))}).setLayout({name:"mx_cell_noise_vec3_1",type:"vec3",inputs:[{name:"p",type:"vec2"}]}),Ise=je(([i])=>{const e=Ne(i).toVar(),t=ye(Yr(e.x)).toVar(),n=ye(Yr(e.y)).toVar(),r=ye(Yr(e.z)).toVar();return Ne(oa(Wi(t,n,r,ye(0))),oa(Wi(t,n,r,ye(1))),oa(Wi(t,n,r,ye(2))))}).setLayout({name:"mx_cell_noise_vec3_2",type:"vec3",inputs:[{name:"p",type:"vec3"}]}),Fse=je(([i])=>{const e=dn(i).toVar(),t=ye(Yr(e.x)).toVar(),n=ye(Yr(e.y)).toVar(),r=ye(Yr(e.z)).toVar(),s=ye(Yr(e.w)).toVar();return Ne(oa(Wi(t,n,r,s,ye(0))),oa(Wi(t,n,r,s,ye(1))),oa(Wi(t,n,r,s,ye(2))))}).setLayout({name:"mx_cell_noise_vec3_3",type:"vec3",inputs:[{name:"p",type:"vec4"}]}),zB=Vs([Bse,Ose,Ise,Fse]),sy=je(([i,e,t,n])=>{const r=ge(n).toVar(),s=ge(t).toVar(),a=ye(e).toVar(),l=Ne(i).toVar(),u=ge(0).toVar(),h=ge(1).toVar();return ki(a,()=>{u.addAssign(h.mul(UE(l))),h.mulAssign(r),l.mulAssign(s)}),u}).setLayout({name:"mx_fractal_noise_float",type:"float",inputs:[{name:"p",type:"vec3"},{name:"octaves",type:"int"},{name:"lacunarity",type:"float"},{name:"diminish",type:"float"}]}),GB=je(([i,e,t,n])=>{const r=ge(n).toVar(),s=ge(t).toVar(),a=ye(e).toVar(),l=Ne(i).toVar(),u=Ne(0).toVar(),h=ge(1).toVar();return ki(a,()=>{u.addAssign(h.mul(BE(l))),h.mulAssign(r),l.mulAssign(s)}),u}).setLayout({name:"mx_fractal_noise_vec3",type:"vec3",inputs:[{name:"p",type:"vec3"},{name:"octaves",type:"int"},{name:"lacunarity",type:"float"},{name:"diminish",type:"float"}]}),kse=je(([i,e,t,n])=>{const r=ge(n).toVar(),s=ge(t).toVar(),a=ye(e).toVar(),l=Ne(i).toVar();return Et(sy(l,a,s,r),sy(l.add(Ne(ye(19),ye(193),ye(17))),a,s,r))}).setLayout({name:"mx_fractal_noise_vec2",type:"vec2",inputs:[{name:"p",type:"vec3"},{name:"octaves",type:"int"},{name:"lacunarity",type:"float"},{name:"diminish",type:"float"}]}),zse=je(([i,e,t,n])=>{const r=ge(n).toVar(),s=ge(t).toVar(),a=ye(e).toVar(),l=Ne(i).toVar(),u=Ne(GB(l,a,s,r)).toVar(),h=ge(sy(l.add(Ne(ye(19),ye(193),ye(17))),a,s,r)).toVar();return dn(u,h)}).setLayout({name:"mx_fractal_noise_vec4",type:"vec4",inputs:[{name:"p",type:"vec3"},{name:"octaves",type:"int"},{name:"lacunarity",type:"float"},{name:"diminish",type:"float"}]}),Gse=je(([i,e,t,n,r,s,a])=>{const l=ye(a).toVar(),u=ge(s).toVar(),h=ye(r).toVar(),g=ye(n).toVar(),v=ye(t).toVar(),x=ye(e).toVar(),S=Et(i).toVar(),w=Ne(zB(Et(x.add(g),v.add(h)))).toVar(),R=Et(w.x,w.y).toVar();R.subAssign(.5),R.mulAssign(u),R.addAssign(.5);const C=Et(Et(ge(x),ge(v)).add(R)).toVar(),E=Et(C.sub(S)).toVar();return ti(l.equal(ye(2)),()=>ur(E.x).add(ur(E.y))),ti(l.equal(ye(3)),()=>qr(ur(E.x),ur(E.y))),Xh(E,E)}).setLayout({name:"mx_worley_distance_0",type:"float",inputs:[{name:"p",type:"vec2"},{name:"x",type:"int"},{name:"y",type:"int"},{name:"xoff",type:"int"},{name:"yoff",type:"int"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),qse=je(([i,e,t,n,r,s,a,l,u])=>{const h=ye(u).toVar(),g=ge(l).toVar(),v=ye(a).toVar(),x=ye(s).toVar(),S=ye(r).toVar(),w=ye(n).toVar(),R=ye(t).toVar(),C=ye(e).toVar(),E=Ne(i).toVar(),B=Ne(zB(Ne(C.add(S),R.add(x),w.add(v)))).toVar();B.subAssign(.5),B.mulAssign(g),B.addAssign(.5);const L=Ne(Ne(ge(C),ge(R),ge(w)).add(B)).toVar(),O=Ne(L.sub(E)).toVar();return ti(h.equal(ye(2)),()=>ur(O.x).add(ur(O.y)).add(ur(O.z))),ti(h.equal(ye(3)),()=>qr(qr(ur(O.x),ur(O.y)),ur(O.z))),Xh(O,O)}).setLayout({name:"mx_worley_distance_1",type:"float",inputs:[{name:"p",type:"vec3"},{name:"x",type:"int"},{name:"y",type:"int"},{name:"z",type:"int"},{name:"xoff",type:"int"},{name:"yoff",type:"int"},{name:"zoff",type:"int"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),Z0=Vs([Gse,qse]),Vse=je(([i,e,t])=>{const n=ye(t).toVar(),r=ge(e).toVar(),s=Et(i).toVar(),a=ye().toVar(),l=ye().toVar(),u=Et(_r(s.x,a),_r(s.y,l)).toVar(),h=ge(1e6).toVar();return ki({start:-1,end:ye(1),name:"x",condition:"<="},({x:g})=>{ki({start:-1,end:ye(1),name:"y",condition:"<="},({y:v})=>{const x=ge(Z0(u,g,v,a,l,r,n)).toVar();h.assign(to(h,x))})}),ti(n.equal(ye(0)),()=>{h.assign(Cu(h))}),h}).setLayout({name:"mx_worley_noise_float_0",type:"float",inputs:[{name:"p",type:"vec2"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),Hse=je(([i,e,t])=>{const n=ye(t).toVar(),r=ge(e).toVar(),s=Et(i).toVar(),a=ye().toVar(),l=ye().toVar(),u=Et(_r(s.x,a),_r(s.y,l)).toVar(),h=Et(1e6,1e6).toVar();return ki({start:-1,end:ye(1),name:"x",condition:"<="},({x:g})=>{ki({start:-1,end:ye(1),name:"y",condition:"<="},({y:v})=>{const x=ge(Z0(u,g,v,a,l,r,n)).toVar();ti(x.lessThan(h.x),()=>{h.y.assign(h.x),h.x.assign(x)}).ElseIf(x.lessThan(h.y),()=>{h.y.assign(x)})})}),ti(n.equal(ye(0)),()=>{h.assign(Cu(h))}),h}).setLayout({name:"mx_worley_noise_vec2_0",type:"vec2",inputs:[{name:"p",type:"vec2"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),jse=je(([i,e,t])=>{const n=ye(t).toVar(),r=ge(e).toVar(),s=Et(i).toVar(),a=ye().toVar(),l=ye().toVar(),u=Et(_r(s.x,a),_r(s.y,l)).toVar(),h=Ne(1e6,1e6,1e6).toVar();return ki({start:-1,end:ye(1),name:"x",condition:"<="},({x:g})=>{ki({start:-1,end:ye(1),name:"y",condition:"<="},({y:v})=>{const x=ge(Z0(u,g,v,a,l,r,n)).toVar();ti(x.lessThan(h.x),()=>{h.z.assign(h.y),h.y.assign(h.x),h.x.assign(x)}).ElseIf(x.lessThan(h.y),()=>{h.z.assign(h.y),h.y.assign(x)}).ElseIf(x.lessThan(h.z),()=>{h.z.assign(x)})})}),ti(n.equal(ye(0)),()=>{h.assign(Cu(h))}),h}).setLayout({name:"mx_worley_noise_vec3_0",type:"vec3",inputs:[{name:"p",type:"vec2"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),Wse=je(([i,e,t])=>{const n=ye(t).toVar(),r=ge(e).toVar(),s=Ne(i).toVar(),a=ye().toVar(),l=ye().toVar(),u=ye().toVar(),h=Ne(_r(s.x,a),_r(s.y,l),_r(s.z,u)).toVar(),g=ge(1e6).toVar();return ki({start:-1,end:ye(1),name:"x",condition:"<="},({x:v})=>{ki({start:-1,end:ye(1),name:"y",condition:"<="},({y:x})=>{ki({start:-1,end:ye(1),name:"z",condition:"<="},({z:S})=>{const w=ge(Z0(h,v,x,S,a,l,u,r,n)).toVar();g.assign(to(g,w))})})}),ti(n.equal(ye(0)),()=>{g.assign(Cu(g))}),g}).setLayout({name:"mx_worley_noise_float_1",type:"float",inputs:[{name:"p",type:"vec3"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),$se=Vs([Vse,Wse]),Xse=je(([i,e,t])=>{const n=ye(t).toVar(),r=ge(e).toVar(),s=Ne(i).toVar(),a=ye().toVar(),l=ye().toVar(),u=ye().toVar(),h=Ne(_r(s.x,a),_r(s.y,l),_r(s.z,u)).toVar(),g=Et(1e6,1e6).toVar();return ki({start:-1,end:ye(1),name:"x",condition:"<="},({x:v})=>{ki({start:-1,end:ye(1),name:"y",condition:"<="},({y:x})=>{ki({start:-1,end:ye(1),name:"z",condition:"<="},({z:S})=>{const w=ge(Z0(h,v,x,S,a,l,u,r,n)).toVar();ti(w.lessThan(g.x),()=>{g.y.assign(g.x),g.x.assign(w)}).ElseIf(w.lessThan(g.y),()=>{g.y.assign(w)})})})}),ti(n.equal(ye(0)),()=>{g.assign(Cu(g))}),g}).setLayout({name:"mx_worley_noise_vec2_1",type:"vec2",inputs:[{name:"p",type:"vec3"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),Yse=Vs([Hse,Xse]),Qse=je(([i,e,t])=>{const n=ye(t).toVar(),r=ge(e).toVar(),s=Ne(i).toVar(),a=ye().toVar(),l=ye().toVar(),u=ye().toVar(),h=Ne(_r(s.x,a),_r(s.y,l),_r(s.z,u)).toVar(),g=Ne(1e6,1e6,1e6).toVar();return ki({start:-1,end:ye(1),name:"x",condition:"<="},({x:v})=>{ki({start:-1,end:ye(1),name:"y",condition:"<="},({y:x})=>{ki({start:-1,end:ye(1),name:"z",condition:"<="},({z:S})=>{const w=ge(Z0(h,v,x,S,a,l,u,r,n)).toVar();ti(w.lessThan(g.x),()=>{g.z.assign(g.y),g.y.assign(g.x),g.x.assign(w)}).ElseIf(w.lessThan(g.y),()=>{g.z.assign(g.y),g.y.assign(w)}).ElseIf(w.lessThan(g.z),()=>{g.z.assign(w)})})})}),ti(n.equal(ye(0)),()=>{g.assign(Cu(g))}),g}).setLayout({name:"mx_worley_noise_vec3_1",type:"vec3",inputs:[{name:"p",type:"vec3"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),Kse=Vs([jse,Qse]),Zse=je(([i])=>{const e=i.y,t=i.z,n=Ne().toVar();return ti(e.lessThan(1e-4),()=>{n.assign(Ne(t,t,t))}).Else(()=>{let r=i.x;r=r.sub(hu(r)).mul(6).toVar();const s=ye(YM(r)),a=r.sub(ge(s)),l=t.mul(e.oneMinus()),u=t.mul(e.mul(a).oneMinus()),h=t.mul(e.mul(a.oneMinus()).oneMinus());ti(s.equal(ye(0)),()=>{n.assign(Ne(t,h,l))}).ElseIf(s.equal(ye(1)),()=>{n.assign(Ne(u,t,l))}).ElseIf(s.equal(ye(2)),()=>{n.assign(Ne(l,t,h))}).ElseIf(s.equal(ye(3)),()=>{n.assign(Ne(l,u,t))}).ElseIf(s.equal(ye(4)),()=>{n.assign(Ne(h,l,t))}).Else(()=>{n.assign(Ne(t,l,u))})}),n}).setLayout({name:"mx_hsvtorgb",type:"vec3",inputs:[{name:"hsv",type:"vec3"}]}),Jse=je(([i])=>{const e=Ne(i).toVar(),t=ge(e.x).toVar(),n=ge(e.y).toVar(),r=ge(e.z).toVar(),s=ge(to(t,to(n,r))).toVar(),a=ge(qr(t,qr(n,r))).toVar(),l=ge(a.sub(s)).toVar(),u=ge().toVar(),h=ge().toVar(),g=ge().toVar();return g.assign(a),ti(a.greaterThan(0),()=>{h.assign(l.div(a))}).Else(()=>{h.assign(0)}),ti(h.lessThanEqual(0),()=>{u.assign(0)}).Else(()=>{ti(t.greaterThanEqual(a),()=>{u.assign(n.sub(r).div(l))}).ElseIf(n.greaterThanEqual(a),()=>{u.assign(Qr(2,r.sub(t).div(l)))}).Else(()=>{u.assign(Qr(4,t.sub(n).div(l)))}),u.mulAssign(1/6),ti(u.lessThan(0),()=>{u.addAssign(1)})}),Ne(u,h,g)}).setLayout({name:"mx_rgbtohsv",type:"vec3",inputs:[{name:"c",type:"vec3"}]}),eae=je(([i])=>{const e=Ne(i).toVar(),t=PM(qM(e,Ne(.04045))).toVar(),n=Ne(e.div(12.92)).toVar(),r=Ne(Cl(qr(e.add(Ne(.055)),Ne(0)).div(1.055),Ne(2.4))).toVar();return Fi(n,r,t)}).setLayout({name:"mx_srgb_texture_to_lin_rec709",type:"vec3",inputs:[{name:"color",type:"vec3"}]}),qB=(i,e)=>{i=ge(i),e=ge(e);const t=Et(e.dFdx(),e.dFdy()).length().mul(.7071067811865476);return kc(i.sub(t),i.add(t),e)},VB=(i,e,t,n)=>Fi(i,e,t[n].clamp()),tae=(i,e,t=Er())=>VB(i,e,t,"x"),nae=(i,e,t=Er())=>VB(i,e,t,"y"),HB=(i,e,t,n,r)=>Fi(i,e,qB(t,n[r])),iae=(i,e,t,n=Er())=>HB(i,e,t,n,"x"),rae=(i,e,t,n=Er())=>HB(i,e,t,n,"y"),sae=(i=1,e=0,t=Er())=>t.mul(i).add(e),aae=(i,e=1)=>(i=ge(i),i.abs().pow(e).mul(i.sign())),oae=(i,e=1,t=.5)=>ge(i).sub(t).mul(e).add(t),lae=(i=Er(),e=1,t=0)=>UE(i.convert("vec2|vec3")).mul(e).add(t),uae=(i=Er(),e=1,t=0)=>BE(i.convert("vec2|vec3")).mul(e).add(t),cae=(i=Er(),e=1,t=0)=>(i=i.convert("vec2|vec3"),dn(BE(i),UE(i.add(Et(19,73)))).mul(e).add(t)),hae=(i=Er(),e=1)=>$se(i.convert("vec2|vec3"),e,ye(1)),fae=(i=Er(),e=1)=>Yse(i.convert("vec2|vec3"),e,ye(1)),Aae=(i=Er(),e=1)=>Kse(i.convert("vec2|vec3"),e,ye(1)),dae=(i=Er())=>Use(i.convert("vec2|vec3")),pae=(i=Er(),e=3,t=2,n=.5,r=1)=>sy(i,ye(e),t,n).mul(r),mae=(i=Er(),e=3,t=2,n=.5,r=1)=>kse(i,ye(e),t,n).mul(r),gae=(i=Er(),e=3,t=2,n=.5,r=1)=>GB(i,ye(e),t,n).mul(r),vae=(i=Er(),e=3,t=2,n=.5,r=1)=>zse(i,ye(e),t,n).mul(r),_ae=je(([i,e,t])=>{const n=Fc(i).toVar("nDir"),r=Ti(ge(.5).mul(e.sub(t)),Nc).div(n).toVar("rbmax"),s=Ti(ge(-.5).mul(e.sub(t)),Nc).div(n).toVar("rbmin"),a=Ne().toVar("rbminmax");a.x=n.x.greaterThan(ge(0)).select(r.x,s.x),a.y=n.y.greaterThan(ge(0)).select(r.y,s.y),a.z=n.z.greaterThan(ge(0)).select(r.z,s.z);const l=to(to(a.x,a.y),a.z).toVar("correction");return Nc.add(n.mul(l)).toVar("boxIntersection").sub(t)}),jB=je(([i,e])=>{const t=i.x,n=i.y,r=i.z;let s=e.element(0).mul(.886227);return s=s.add(e.element(1).mul(2*.511664).mul(n)),s=s.add(e.element(2).mul(2*.511664).mul(r)),s=s.add(e.element(3).mul(2*.511664).mul(t)),s=s.add(e.element(4).mul(2*.429043).mul(t).mul(n)),s=s.add(e.element(5).mul(2*.429043).mul(n).mul(r)),s=s.add(e.element(6).mul(r.mul(r).mul(.743125).sub(.247708))),s=s.add(e.element(7).mul(2*.429043).mul(t).mul(r)),s=s.add(e.element(8).mul(.429043).mul(Wn(t,t).sub(Wn(n,n)))),s});var j=Object.freeze({__proto__:null,BRDF_GGX:$T,BRDF_Lambert:AA,BasicShadowFilter:CB,Break:TU,Continue:xee,DFGApprox:vE,D_GGX:kU,Discard:v9,EPSILON:TL,F_Schlick:F0,Fn:je,INFINITY:fJ,If:ti,Loop:ki,NodeAccess:sa,NodeShaderStage:OT,NodeType:qZ,NodeUpdateType:jn,PCFShadowFilter:RB,PCFSoftShadowFilter:NB,PI:Z_,PI2:AJ,Return:CJ,Schlick_to_F0:GU,ScriptableNodeResources:i_,ShaderNode:Um,TBNViewMatrix:Yf,VSMShadowFilter:DB,V_GGX_SmithCorrelated:FU,abs:ur,acesFilmicToneMapping:_B,acos:NL,add:Qr,addMethodChaining:ct,addNodeElement:NJ,agxToneMapping:yB,all:VM,alphaT:Y_,and:AL,anisotropy:Rh,anisotropyB:iA,anisotropyT:Bm,any:wL,append:WP,arrayBuffer:oJ,asin:RL,assign:aL,atan:WM,atan2:QL,atomicAdd:Cre,atomicAnd:Pre,atomicFunc:jc,atomicMax:Nre,atomicMin:Dre,atomicOr:Lre,atomicStore:Ere,atomicSub:Rre,atomicXor:Ure,attenuationColor:kM,attenuationDistance:FM,attribute:_u,attributeArray:xie,backgroundBlurriness:oB,backgroundIntensity:JT,backgroundRotation:lB,batch:xU,billboarding:eie,bitAnd:gL,bitNot:vL,bitOr:_L,bitXor:yL,bitangentGeometry:tee,bitangentLocal:nee,bitangentView:O9,bitangentWorld:iee,bitcast:dJ,blendBurn:hB,blendColor:Lie,blendDodge:fB,blendOverlay:dB,blendScreen:AB,blur:XU,bool:Ic,buffer:Yg,bufferAttribute:$g,bumpMap:z9,burn:Uie,bvec2:YP,bvec3:PM,bvec4:JP,bypass:d9,cache:Im,call:oL,cameraFar:Ph,cameraNear:Dh,cameraNormalMatrix:OJ,cameraPosition:b9,cameraProjectionMatrix:_A,cameraProjectionMatrixInverse:UJ,cameraViewMatrix:so,cameraWorldMatrix:BJ,cbrt:HL,cdl:qie,ceil:Iy,checker:ase,cineonToneMapping:vB,clamp:vu,clearcoat:X_,clearcoatRoughness:wg,code:Ky,color:$P,colorSpaceToWorking:tE,colorToDirection:Qee,compute:A9,cond:KL,context:zy,convert:tL,convertColorSpace:_J,convertToTexture:Aie,cos:yc,cross:ky,cubeTexture:I0,dFdx:$M,dFdy:XM,dashSize:Qv,defaultBuildStages:IT,defaultShaderStages:zP,defined:xg,degrees:EL,deltaTime:rB,densityFog:hre,densityFogFactor:ME,depth:dE,depthPass:Xie,difference:zL,diffuseColor:Ui,directPointLight:UB,directionToColor:DU,dispersion:zM,distance:kL,div:Dl,dodge:Bie,dot:Xh,drawIndex:vU,dynamicBufferAttribute:f9,element:eL,emissive:GT,equal:lL,equals:IL,equirectUV:pE,exp:HM,exp2:O0,expression:Hh,faceDirection:Xg,faceForward:JM,faceforward:pJ,float:ge,floor:hu,fog:Ng,fract:Hc,frameGroup:rL,frameId:Hne,frontFacing:M9,fwidth:BL,gain:Ine,gapSize:qT,getConstNodeType:jP,getCurrentStack:DM,getDirection:WU,getDistanceAttenuation:LE,getGeometryRoughness:IU,getNormalFromDepth:pie,getParallaxCorrectNormal:_ae,getRoughness:gE,getScreenPosition:die,getShIrradianceAt:jB,getTextureIndex:nB,getViewPosition:zd,glsl:ire,glslFn:rre,grayscale:Fie,greaterThan:qM,greaterThanEqual:fL,hash:One,highpModelNormalViewMatrix:$J,highpModelViewMatrix:WJ,hue:Gie,instance:mee,instanceIndex:Jg,instancedArray:bie,instancedBufferAttribute:J_,instancedDynamicBufferAttribute:VT,instancedMesh:yU,int:ye,inverseSqrt:jM,inversesqrt:mJ,invocationLocalIndex:pee,invocationSubgroupIndex:dee,ior:Om,iridescence:By,iridescenceIOR:BM,iridescenceThickness:OM,ivec2:ms,ivec3:QP,ivec4:KP,js:tre,label:JL,length:Rc,lengthSq:jL,lessThan:cL,lessThanEqual:hL,lightPosition:RE,lightProjectionUV:MB,lightShadowMatrix:CE,lightTargetDirection:NE,lightTargetPosition:EB,lightViewPosition:Jy,lightingContext:MU,lights:Ire,linearDepth:ty,linearToneMapping:mB,localId:gre,log:Oy,log2:cu,logarithmicDepthToViewZ:Bee,loop:bee,luminance:TE,mat2:Ly,mat3:ha,mat4:nA,matcapUV:QU,materialAO:mU,materialAlphaTest:G9,materialAnisotropy:nU,materialAnisotropyVector:kd,materialAttenuationColor:cU,materialAttenuationDistance:uU,materialClearcoat:Q9,materialClearcoatNormal:Z9,materialClearcoatRoughness:K9,materialColor:q9,materialDispersion:pU,materialEmissive:H9,materialIOR:lU,materialIridescence:iU,materialIridescenceIOR:rU,materialIridescenceThickness:sU,materialLightMap:oE,materialLineDashOffset:dU,materialLineDashSize:fU,materialLineGapSize:AU,materialLineScale:hU,materialLineWidth:hee,materialMetalness:X9,materialNormal:Y9,materialOpacity:aE,materialPointWidth:fee,materialReference:Tc,materialReflectivity:Jv,materialRefractionRatio:R9,materialRotation:J9,materialRoughness:$9,materialSheen:eU,materialSheenRoughness:tU,materialShininess:V9,materialSpecular:j9,materialSpecularColor:W9,materialSpecularIntensity:WT,materialSpecularStrength:Fm,materialThickness:oU,materialTransmission:aU,max:qr,maxMipLevel:x9,mediumpModelViewMatrix:w9,metalness:Tg,min:to,mix:Fi,mixElement:XL,mod:QM,modInt:GM,modelDirection:GJ,modelNormalMatrix:T9,modelPosition:qJ,modelScale:VJ,modelViewMatrix:Q0,modelViewPosition:HJ,modelViewProjection:lE,modelWorldMatrix:$o,modelWorldMatrixInverse:jJ,morphReference:wU,mrt:iB,mul:Wn,mx_aastep:qB,mx_cell_noise_float:dae,mx_contrast:oae,mx_fractal_noise_float:pae,mx_fractal_noise_vec2:mae,mx_fractal_noise_vec3:gae,mx_fractal_noise_vec4:vae,mx_hsvtorgb:Zse,mx_noise_float:lae,mx_noise_vec3:uae,mx_noise_vec4:cae,mx_ramplr:tae,mx_ramptb:nae,mx_rgbtohsv:Jse,mx_safepower:aae,mx_splitlr:iae,mx_splittb:rae,mx_srgb_texture_to_lin_rec709:eae,mx_transform_uv:sae,mx_worley_noise_float:hae,mx_worley_noise_vec2:fae,mx_worley_noise_vec3:Aae,negate:DL,neutralToneMapping:xB,nodeArray:tA,nodeImmutable:zt,nodeObject:gt,nodeObjects:Vg,nodeProxy:ht,normalFlat:E9,normalGeometry:qy,normalLocal:no,normalMap:jT,normalView:Jo,normalWorld:Vy,normalize:Fc,not:pL,notEqual:uL,numWorkgroups:pre,objectDirection:IJ,objectGroup:UM,objectPosition:S9,objectScale:kJ,objectViewPosition:zJ,objectWorldMatrix:FJ,oneMinus:PL,or:dL,orthographicDepthToViewZ:Uee,oscSawtooth:Kne,oscSine:Xne,oscSquare:Yne,oscTriangle:Qne,output:Eg,outputStruct:Une,overlay:Iie,overloadingFn:Vs,parabola:ZT,parallaxDirection:F9,parallaxUV:see,parameter:Pne,pass:Wie,passTexture:$ie,pcurve:Fne,perspectiveDepthToViewZ:fE,pmremTexture:_E,pointUV:Mie,pointWidth:uJ,positionGeometry:Gy,positionLocal:Gr,positionPrevious:ey,positionView:Xr,positionViewDirection:dr,positionWorld:Nc,positionWorldDirection:nE,posterize:Hie,pow:Cl,pow2:KM,pow3:GL,pow4:qL,property:sL,radians:ML,rand:$L,range:Are,rangeFog:cre,rangeFogFactor:wE,reciprocal:UL,reference:ji,referenceBuffer:HT,reflect:FL,reflectVector:P9,reflectView:N9,reflector:lie,refract:ZM,refractVector:L9,refractView:D9,reinhardToneMapping:gB,remainder:SL,remap:m9,remapClamp:g9,renderGroup:Rn,renderOutput:_9,rendererReference:u9,rotate:yE,rotateUV:Zne,roughness:Zl,round:LL,rtt:aB,sRGBTransferEOTF:i9,sRGBTransferOETF:r9,sampler:LJ,saturate:WL,saturation:kie,screen:Oie,screenCoordinate:e1,screenSize:Rg,screenUV:bu,scriptable:ure,scriptableValue:n_,select:zs,setCurrentStack:bg,shaderStages:FT,shadow:LB,shadowPositionWorld:PE,sharedUniformGroup:LM,sheen:Xf,sheenRoughness:Uy,shiftLeft:xL,shiftRight:bL,shininess:Q_,sign:Cg,sin:Mo,sinc:kne,skinning:_ee,skinningReference:SU,smoothstep:kc,smoothstepElement:YL,specularColor:ka,specularF90:Mg,spherizeUV:Jne,split:lJ,spritesheetUV:iie,sqrt:Cu,stack:e_,step:Fy,storage:Qy,storageBarrier:xre,storageObject:yie,storageTexture:uB,string:aJ,sub:Ti,subgroupIndex:Aee,subgroupSize:vre,tan:CL,tangentGeometry:Wy,tangentLocal:Qg,tangentView:Kg,tangentWorld:B9,temp:t9,texture:Ai,texture3D:one,textureBarrier:bre,textureBicubic:HU,textureCubeUV:$U,textureLoad:Fr,textureSize:Fh,textureStore:Cie,thickness:IM,time:yA,timerDelta:$ne,timerGlobal:Wne,timerLocal:jne,toOutputColorSpace:s9,toWorkingColorSpace:a9,toneMapping:c9,toneMappingExposure:h9,toonOutlinePass:Qie,transformDirection:VL,transformNormal:C9,transformNormalToView:iE,transformedBentNormalView:k9,transformedBitangentView:I9,transformedBitangentWorld:ree,transformedClearcoatNormalView:Qd,transformedNormalView:zr,transformedNormalWorld:Hy,transformedTangentView:sE,transformedTangentWorld:eee,transmission:K_,transpose:OL,triNoise3D:Gne,triplanarTexture:sie,triplanarTextures:sB,trunc:YM,tslFn:sJ,uint:Qt,uniform:gn,uniformArray:Sc,uniformGroup:iL,uniforms:KJ,userData:Nie,uv:Er,uvec2:XP,uvec3:Y0,uvec4:ZP,varying:ro,varyingProperty:Sg,vec2:Et,vec3:Ne,vec4:dn,vectorComponents:gA,velocity:Pie,vertexColor:Tie,vertexIndex:gU,vertexStage:n9,vibrance:zie,viewZToLogarithmicDepth:AE,viewZToOrthographicDepth:s0,viewZToPerspectiveDepth:RU,viewport:uE,viewportBottomLeft:Dee,viewportCoordinate:CU,viewportDepthTexture:hE,viewportLinearDepth:Oee,viewportMipTexture:cE,viewportResolution:Ree,viewportSafeUV:tie,viewportSharedTexture:Yee,viewportSize:EU,viewportTexture:Pee,viewportTopLeft:Nee,viewportUV:Cee,wgsl:nre,wgslFn:sre,workgroupArray:wre,workgroupBarrier:yre,workgroupId:mre,workingToColorSpace:o9,xor:mL});const vc=new xE;class yae extends Yh{constructor(e,t){super(),this.renderer=e,this.nodes=t}update(e,t,n){const r=this.renderer,s=this.nodes.getBackgroundNode(e)||e.background;let a=!1;if(s===null)r._clearColor.getRGB(vc,Ro),vc.a=r._clearColor.a;else if(s.isColor===!0)s.getRGB(vc,Ro),vc.a=1,a=!0;else if(s.isNode===!0){const l=this.get(e),u=s;vc.copy(r._clearColor);let h=l.backgroundMesh;if(h===void 0){const v=zy(dn(u).mul(JT),{getUV:()=>lB.mul(Vy),getTextureLevel:()=>oB});let x=lE;x=x.setZ(x.w);const S=new Vr;S.name="Background.material",S.side=hr,S.depthTest=!1,S.depthWrite=!1,S.fog=!1,S.lights=!1,S.vertexNode=x,S.colorNode=v,l.backgroundMeshNode=v,l.backgroundMesh=h=new zi(new Eu(1,32,32),S),h.frustumCulled=!1,h.name="Background.mesh",h.onBeforeRender=function(w,R,C){this.matrixWorld.copyPosition(C.matrixWorld)}}const g=u.getCacheKey();l.backgroundCacheKey!==g&&(l.backgroundMeshNode.node=dn(u).mul(JT),l.backgroundMeshNode.needsUpdate=!0,h.material.needsUpdate=!0,l.backgroundCacheKey=g),t.unshift(h,h.geometry,h.material,0,0,null,null)}else console.error("THREE.Renderer: Unsupported background configuration.",s);if(r.autoClear===!0||a===!0){const l=n.clearColorValue;l.r=vc.r,l.g=vc.g,l.b=vc.b,l.a=vc.a,(r.backend.isWebGLBackend===!0||r.alpha===!0)&&(l.r*=l.a,l.g*=l.a,l.b*=l.a),n.depthClearValue=r._clearDepth,n.stencilClearValue=r._clearStencil,n.clearColor=r.autoClearColor===!0,n.clearDepth=r.autoClearDepth===!0,n.clearStencil=r.autoClearStencil===!0}else n.clearColor=!1,n.clearDepth=!1,n.clearStencil=!1}}let xae=0;class ew{constructor(e="",t=[],n=0,r=[]){this.name=e,this.bindings=t,this.index=n,this.bindingsReference=r,this.id=xae++}}class bae{constructor(e,t,n,r,s,a,l,u,h,g=[]){this.vertexShader=e,this.fragmentShader=t,this.computeShader=n,this.transforms=g,this.nodeAttributes=r,this.bindings=s,this.updateNodes=a,this.updateBeforeNodes=l,this.updateAfterNodes=u,this.monitor=h,this.usedTimes=0}createBindings(){const e=[];for(const t of this.bindings)if(t.bindings[0].groupNode.shared!==!0){const r=new ew(t.name,[],t.index,t);e.push(r);for(const s of t.bindings)r.bindings.push(s.clone())}else e.push(t);return e}}class uN{constructor(e,t,n=null){this.isNodeAttribute=!0,this.name=e,this.type=t,this.node=n}}class Sae{constructor(e,t,n){this.isNodeUniform=!0,this.name=e,this.type=t,this.node=n.getSelf()}get value(){return this.node.value}set value(e){this.node.value=e}get id(){return this.node.id}get groupNode(){return this.node.groupNode}}class WB{constructor(e,t){this.isNodeVar=!0,this.name=e,this.type=t}}class Tae extends WB{constructor(e,t){super(e,t),this.needsInterpolation=!1,this.isNodeVarying=!0}}class wae{constructor(e,t,n=""){this.name=e,this.type=t,this.code=n,Object.defineProperty(this,"isNodeCode",{value:!0})}}let Mae=0;class uS{constructor(e=null){this.id=Mae++,this.nodesData=new WeakMap,this.parent=e}getData(e){let t=this.nodesData.get(e);return t===void 0&&this.parent!==null&&(t=this.parent.getData(e)),t}setData(e,t){this.nodesData.set(e,t)}}class Eae extends Mn{static get type(){return"StructTypeNode"}constructor(e,t){super(),this.name=e,this.types=t,this.isStructTypeNode=!0}getMemberTypes(){return this.types}}class bA{constructor(e,t){this.name=e,this.value=t,this.boundary=0,this.itemSize=0,this.offset=0}setValue(e){this.value=e}getValue(){return this.value}}class Cae extends bA{constructor(e,t=0){super(e,t),this.isNumberUniform=!0,this.boundary=4,this.itemSize=1}}class Rae extends bA{constructor(e,t=new dt){super(e,t),this.isVector2Uniform=!0,this.boundary=8,this.itemSize=2}}class Nae extends bA{constructor(e,t=new ce){super(e,t),this.isVector3Uniform=!0,this.boundary=16,this.itemSize=3}}class Dae extends bA{constructor(e,t=new Pn){super(e,t),this.isVector4Uniform=!0,this.boundary=16,this.itemSize=4}}class Pae extends bA{constructor(e,t=new sn){super(e,t),this.isColorUniform=!0,this.boundary=16,this.itemSize=3}}class Lae extends bA{constructor(e,t=new Vn){super(e,t),this.isMatrix3Uniform=!0,this.boundary=48,this.itemSize=12}}class Uae extends bA{constructor(e,t=new kn){super(e,t),this.isMatrix4Uniform=!0,this.boundary=64,this.itemSize=16}}class Bae extends Cae{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}}class Oae extends Rae{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}}class Iae extends Nae{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}}class Fae extends Dae{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}}class kae extends Pae{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}}class zae extends Lae{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}}class Gae extends Uae{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}}const Kd=4,cN=[.125,.215,.35,.446,.526,.582],Gf=20,cS=new kg(-1,1,1,-1,0,1),qae=new ya(90,1),hN=new sn;let hS=null,fS=0,AS=0;const If=(1+Math.sqrt(5))/2,Dd=1/If,fN=[new ce(-If,Dd,0),new ce(If,Dd,0),new ce(-Dd,0,If),new ce(Dd,0,If),new ce(0,If,-Dd),new ce(0,If,Dd),new ce(-1,1,-1),new ce(1,1,-1),new ce(-1,1,1),new ce(1,1,1)],Vae=[3,1,5,0,4,2],dS=WU(Er(),_u("faceIndex")).normalize(),OE=Ne(dS.x,dS.y,dS.z);class Hae{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._lodMeshes=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._backgroundBox=null}get _hasInitialized(){return this._renderer.hasInitialized()}fromScene(e,t=0,n=.1,r=100,s=null){if(this._setSize(256),this._hasInitialized===!1){console.warn("THREE.PMREMGenerator: .fromScene() called before the backend is initialized. Try using .fromSceneAsync() instead.");const l=s||this._allocateTargets();return this.fromSceneAsync(e,t,n,r,l),l}hS=this._renderer.getRenderTarget(),fS=this._renderer.getActiveCubeFace(),AS=this._renderer.getActiveMipmapLevel();const a=s||this._allocateTargets();return a.depthBuffer=!0,this._sceneToCubeUV(e,n,r,a),t>0&&this._blur(a,0,0,t),this._applyPMREM(a),this._cleanup(a),a}async fromSceneAsync(e,t=0,n=.1,r=100,s=null){return this._hasInitialized===!1&&await this._renderer.init(),this.fromScene(e,t,n,r,s)}fromEquirectangular(e,t=null){if(this._hasInitialized===!1){console.warn("THREE.PMREMGenerator: .fromEquirectangular() called before the backend is initialized. Try using .fromEquirectangularAsync() instead."),this._setSizeFromTexture(e);const n=t||this._allocateTargets();return this.fromEquirectangularAsync(e,n),n}return this._fromTexture(e,t)}async fromEquirectangularAsync(e,t=null){return this._hasInitialized===!1&&await this._renderer.init(),this._fromTexture(e,t)}fromCubemap(e,t=null){if(this._hasInitialized===!1){console.warn("THREE.PMREMGenerator: .fromCubemap() called before the backend is initialized. Try using .fromCubemapAsync() instead."),this._setSizeFromTexture(e);const n=t||this._allocateTargets();return this.fromCubemapAsync(e,t),n}return this._fromTexture(e,t)}async fromCubemapAsync(e,t=null){return this._hasInitialized===!1&&await this._renderer.init(),this._fromTexture(e,t)}async compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=dN(),await this._compileMaterial(this._cubemapMaterial))}async compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=pN(),await this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose(),this._backgroundBox!==null&&(this._backgroundBox.geometry.dispose(),this._backgroundBox.material.dispose())}_setSizeFromTexture(e){e.mapping===Qo||e.mapping===Ko?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4)}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e2?R:0,R,R),u.render(e,s)}u.autoClear=h,e.background=x}_textureToCubeUV(e,t){const n=this._renderer,r=e.mapping===Qo||e.mapping===Ko;r?this._cubemapMaterial===null&&(this._cubemapMaterial=dN(e)):this._equirectMaterial===null&&(this._equirectMaterial=pN(e));const s=r?this._cubemapMaterial:this._equirectMaterial;s.fragmentNode.value=e;const a=this._lodMeshes[0];a.material=s;const l=this._cubeSize;gv(t,0,0,3*l,2*l),n.setRenderTarget(t),n.render(a,cS)}_applyPMREM(e){const t=this._renderer,n=t.autoClear;t.autoClear=!1;const r=this._lodPlanes.length;for(let s=1;sGf&&console.warn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${C} samples when the maximum is set to ${Gf}`);const E=[];let B=0;for(let k=0;kL-Kd?r-L+Kd:0),G=4*(this._cubeSize-O);gv(t,z,G,3*O,2*O),u.setRenderTarget(t),u.render(v,cS)}}function jae(i){const e=[],t=[],n=[],r=[];let s=i;const a=i-Kd+1+cN.length;for(let l=0;li-Kd?h=cN[l-i+Kd-1]:l===0&&(h=0),n.push(h);const g=1/(u-2),v=-g,x=1+g,S=[v,v,x,v,x,x,v,v,x,x,v,x],w=6,R=6,C=3,E=2,B=1,L=new Float32Array(C*R*w),O=new Float32Array(E*R*w),z=new Float32Array(B*R*w);for(let k=0;k2?0:-1,V=[H,F,0,H+2/3,F,0,H+2/3,F+1,0,H,F,0,H+2/3,F+1,0,H,F+1,0],X=Vae[k];L.set(V,C*R*X),O.set(S,E*R*X);const J=[X,X,X,X,X,X];z.set(J,B*R*X)}const G=new Ki;G.setAttribute("position",new wr(L,C)),G.setAttribute("uv",new wr(O,E)),G.setAttribute("faceIndex",new wr(z,B)),e.push(G),r.push(new zi(G,null)),s>Kd&&s--}return{lodPlanes:e,sizeLods:t,sigmas:n,lodMeshes:r}}function AN(i,e,t){const n=new Wh(i,e,t);return n.texture.mapping=sA,n.texture.name="PMREM.cubeUv",n.texture.isPMREMTexture=!0,n.scissorTest=!0,n}function gv(i,e,t,n,r){i.viewport.set(e,t,n,r),i.scissor.set(e,t,n,r)}function IE(i){const e=new Vr;return e.depthTest=!1,e.depthWrite=!1,e.blending=Qa,e.name=`PMREM_${i}`,e}function Wae(i,e,t){const n=Sc(new Array(Gf).fill(0)),r=gn(new ce(0,1,0)),s=gn(0),a=ge(Gf),l=gn(0),u=gn(1),h=Ai(null),g=gn(0),v=ge(1/e),x=ge(1/t),S=ge(i),w={n:a,latitudinal:l,weights:n,poleAxis:r,outputDirection:OE,dTheta:s,samples:u,envMap:h,mipInt:g,CUBEUV_TEXEL_WIDTH:v,CUBEUV_TEXEL_HEIGHT:x,CUBEUV_MAX_MIP:S},R=IE("blur");return R.uniforms=w,R.fragmentNode=XU({...w,latitudinal:l.equal(1)}),R}function dN(i){const e=IE("cubemap");return e.fragmentNode=I0(i,OE),e}function pN(i){const e=IE("equirect");return e.fragmentNode=Ai(i,pE(OE),0),e}const mN=new WeakMap,$ae=new Map([[Int8Array,"int"],[Int16Array,"int"],[Int32Array,"int"],[Uint8Array,"uint"],[Uint16Array,"uint"],[Uint32Array,"uint"],[Float32Array,"float"]]),vv=i=>/e/g.test(i)?String(i).replace(/\+/g,""):(i=Number(i),i+(i%1?"":".0"));class $B{constructor(e,t,n){this.object=e,this.material=e&&e.material||null,this.geometry=e&&e.geometry||null,this.renderer=t,this.parser=n,this.scene=null,this.camera=null,this.nodes=[],this.sequentialNodes=[],this.updateNodes=[],this.updateBeforeNodes=[],this.updateAfterNodes=[],this.hashNodes={},this.monitor=null,this.lightsNode=null,this.environmentNode=null,this.fogNode=null,this.clippingContext=null,this.vertexShader=null,this.fragmentShader=null,this.computeShader=null,this.flowNodes={vertex:[],fragment:[],compute:[]},this.flowCode={vertex:"",fragment:"",compute:""},this.uniforms={vertex:[],fragment:[],compute:[],index:0},this.structs={vertex:[],fragment:[],compute:[],index:0},this.bindings={vertex:{},fragment:{},compute:{}},this.bindingsIndexes={},this.bindGroups=null,this.attributes=[],this.bufferAttributes=[],this.varyings=[],this.codes={},this.vars={},this.flow={code:""},this.chaining=[],this.stack=e_(),this.stacks=[],this.tab=" ",this.currentFunctionNode=null,this.context={material:this.material},this.cache=new uS,this.globalCache=this.cache,this.flowsData=new WeakMap,this.shaderStage=null,this.buildStage=null,this.useComparisonMethod=!1}getBindGroupsCache(){let e=mN.get(this.renderer);return e===void 0&&(e=new Su,mN.set(this.renderer,e)),e}createRenderTarget(e,t,n){return new Wh(e,t,n)}createCubeRenderTarget(e,t){return new PU(e,t)}createPMREMGenerator(){return new Hae(this.renderer)}includes(e){return this.nodes.includes(e)}_getBindGroup(e,t){const n=this.getBindGroupsCache(),r=[];let s=!0;for(const l of t)r.push(l),s=s&&l.groupNode.shared!==!0;let a;return s?(a=n.get(r),a===void 0&&(a=new ew(e,r,this.bindingsIndexes[e].group,r),n.set(r,a))):a=new ew(e,r,this.bindingsIndexes[e].group,r),a}getBindGroupArray(e,t){const n=this.bindings[t];let r=n[e];return r===void 0&&(this.bindingsIndexes[e]===void 0&&(this.bindingsIndexes[e]={binding:0,group:Object.keys(this.bindingsIndexes).length}),n[e]=r=[]),r}getBindings(){let e=this.bindGroups;if(e===null){const t={},n=this.bindings;for(const r of FT)for(const s in n[r]){const a=n[r][s];(t[s]||(t[s]=[])).push(...a)}e=[];for(const r in t){const s=t[r],a=this._getBindGroup(r,s);e.push(a)}this.bindGroups=e}return e}sortBindingGroups(){const e=this.getBindings();e.sort((t,n)=>t.bindings[0].groupNode.order-n.bindings[0].groupNode.order);for(let t=0;t=0?`${Math.round(t)}u`:"0u";if(e==="bool")return t?"true":"false";if(e==="color")return`${this.getType("vec3")}( ${vv(t.r)}, ${vv(t.g)}, ${vv(t.b)} )`;const n=this.getTypeLength(e),r=this.getComponentType(e),s=a=>this.generateConst(r,a);if(n===2)return`${this.getType(e)}( ${s(t.x)}, ${s(t.y)} )`;if(n===3)return`${this.getType(e)}( ${s(t.x)}, ${s(t.y)}, ${s(t.z)} )`;if(n===4)return`${this.getType(e)}( ${s(t.x)}, ${s(t.y)}, ${s(t.z)}, ${s(t.w)} )`;if(n>4&&t&&(t.isMatrix3||t.isMatrix4))return`${this.getType(e)}( ${t.elements.map(s).join(", ")} )`;if(n>4)return`${this.getType(e)}()`;throw new Error(`NodeBuilder: Type '${e}' not found in generate constant attempt.`)}getType(e){return e==="color"?"vec3":e}hasGeometryAttribute(e){return this.geometry&&this.geometry.getAttribute(e)!==void 0}getAttribute(e,t){const n=this.attributes;for(const s of n)if(s.name===e)return s;const r=new uN(e,t);return n.push(r),r}getPropertyName(e){return e.name}isVector(e){return/vec\d/.test(e)}isMatrix(e){return/mat\d/.test(e)}isReference(e){return e==="void"||e==="property"||e==="sampler"||e==="texture"||e==="cubeTexture"||e==="storageTexture"||e==="depthTexture"||e==="texture3D"}needsToWorkingColorSpace(){return!1}getComponentTypeFromTexture(e){const t=e.type;if(e.isDataTexture){if(t===Ns)return"int";if(t===Rr)return"uint"}return"float"}getElementType(e){return e==="mat2"?"vec2":e==="mat3"?"vec3":e==="mat4"?"vec4":this.getComponentType(e)}getComponentType(e){if(e=this.getVectorType(e),e==="float"||e==="bool"||e==="int"||e==="uint")return e;const t=/(b|i|u|)(vec|mat)([2-4])/.exec(e);return t===null?null:t[1]==="b"?"bool":t[1]==="i"?"int":t[1]==="u"?"uint":"float"}getVectorType(e){return e==="color"?"vec3":e==="texture"||e==="cubeTexture"||e==="storageTexture"||e==="texture3D"?"vec4":e}getTypeFromLength(e,t="float"){if(e===1)return t;const n=LP(e);return(t==="float"?"":t[0])+n}getTypeFromArray(e){return $ae.get(e.constructor)}getTypeFromAttribute(e){let t=e;e.isInterleavedBufferAttribute&&(t=e.data);const n=t.array,r=e.itemSize,s=e.normalized;let a;return!(e instanceof z7)&&s!==!0&&(a=this.getTypeFromArray(n)),this.getTypeFromLength(r,a)}getTypeLength(e){const t=this.getVectorType(e),n=/vec([2-4])/.exec(t);return n!==null?Number(n[1]):t==="float"||t==="bool"||t==="int"||t==="uint"?1:/mat2/.test(e)===!0?4:/mat3/.test(e)===!0?9:/mat4/.test(e)===!0?16:0}getVectorFromMatrix(e){return e.replace("mat","vec")}changeComponentType(e,t){return this.getTypeFromLength(this.getTypeLength(e),t)}getIntegerType(e){const t=this.getComponentType(e);return t==="int"||t==="uint"?e:this.changeComponentType(e,"int")}addStack(){return this.stack=e_(this.stack),this.stacks.push(DM()||this.stack),bg(this.stack),this.stack}removeStack(){const e=this.stack;return this.stack=e.parent,bg(this.stacks.pop()),e}getDataFromNode(e,t=this.shaderStage,n=null){n=n===null?e.isGlobal(this)?this.globalCache:this.cache:n;let r=n.getData(e);return r===void 0&&(r={},n.setData(e,r)),r[t]===void 0&&(r[t]={}),r[t]}getNodeProperties(e,t="any"){const n=this.getDataFromNode(e,t);return n.properties||(n.properties={outputNode:null})}getBufferAttributeFromNode(e,t){const n=this.getDataFromNode(e);let r=n.bufferAttribute;if(r===void 0){const s=this.uniforms.index++;r=new uN("nodeAttribute"+s,t,e),this.bufferAttributes.push(r),n.bufferAttribute=r}return r}getStructTypeFromNode(e,t,n=this.shaderStage){const r=this.getDataFromNode(e,n);let s=r.structType;if(s===void 0){const a=this.structs.index++;s=new Eae("StructType"+a,t),this.structs[n].push(s),r.structType=s}return s}getUniformFromNode(e,t,n=this.shaderStage,r=null){const s=this.getDataFromNode(e,n,this.globalCache);let a=s.uniform;if(a===void 0){const l=this.uniforms.index++;a=new Sae(r||"nodeUniform"+l,t,e),this.uniforms[n].push(a),s.uniform=a}return a}getVarFromNode(e,t=null,n=e.getNodeType(this),r=this.shaderStage){const s=this.getDataFromNode(e,r);let a=s.variable;if(a===void 0){const l=this.vars[r]||(this.vars[r]=[]);t===null&&(t="nodeVar"+l.length),a=new WB(t,n),l.push(a),s.variable=a}return a}getVaryingFromNode(e,t=null,n=e.getNodeType(this)){const r=this.getDataFromNode(e,"any");let s=r.varying;if(s===void 0){const a=this.varyings,l=a.length;t===null&&(t="nodeVarying"+l),s=new Tae(t,n),a.push(s),r.varying=s}return s}getCodeFromNode(e,t,n=this.shaderStage){const r=this.getDataFromNode(e);let s=r.code;if(s===void 0){const a=this.codes[n]||(this.codes[n]=[]),l=a.length;s=new wae("nodeCode"+l,t),a.push(s),r.code=s}return s}addFlowCodeHierarchy(e,t){const{flowCodes:n,flowCodeBlock:r}=this.getDataFromNode(e);let s=!0,a=t;for(;a;){if(r.get(a)===!0){s=!1;break}a=this.getDataFromNode(a).parentNodeBlock}if(s)for(const l of n)this.addLineFlowCode(l)}addLineFlowCodeBlock(e,t,n){const r=this.getDataFromNode(e),s=r.flowCodes||(r.flowCodes=[]),a=r.flowCodeBlock||(r.flowCodeBlock=new WeakMap);s.push(t),a.set(n,!0)}addLineFlowCode(e,t=null){return e===""?this:(t!==null&&this.context.nodeBlock&&this.addLineFlowCodeBlock(t,e,this.context.nodeBlock),e=this.tab+e,/;\s*$/.test(e)||(e=e+`; `),this.flow.code+=e,this)}addFlowCode(e){return this.flow.code+=e,this}addFlowTab(){return this.tab+=" ",this}removeFlowTab(){return this.tab=this.tab.slice(0,-1),this}getFlowData(e){return this.flowsData.get(e)}flowNode(e){const t=e.getNodeType(this),n=this.flowChildNode(e,t);return this.flowsData.set(e,n),n}buildFunctionNode(e){const t=new bB,n=this.currentFunctionNode;return this.currentFunctionNode=t,t.code=this.buildFunctionCode(e),this.currentFunctionNode=n,t}flowShaderNode(e){const t=e.layout,n={[Symbol.iterator](){let a=0;const l=Object.values(this);return{next:()=>({value:l[a],done:a++>=l.length})}}};for(const a of t.inputs)n[a.name]=new eB(a.type,a.name);e.layout=null;const r=e.call(n),s=this.flowStagesNode(r,t.type);return e.layout=t,s}flowStagesNode(e,t=null){const n=this.flow,r=this.vars,s=this.cache,a=this.buildStage,l=this.stack,u={code:""};this.flow=u,this.vars={},this.cache=new uS,this.stack=e_();for(const h of IT)this.setBuildStage(h),u.result=e.build(this,t);return u.vars=this.getVars(this.shaderStage),this.flow=n,this.vars=r,this.cache=s,this.stack=l,this.setBuildStage(a),u}getFunctionOperator(){return null}flowChildNode(e,t=null){const n=this.flow,r={code:""};return this.flow=r,r.result=e.build(this,t),this.flow=n,r}flowNodeFromShaderStage(e,t,n=null,r=null){const s=this.shaderStage;this.setShaderStage(e);const a=this.flowChildNode(t,n);return r!==null&&(a.code+=`${this.tab+r} = ${a.result}; `),this.flowCode[e]=this.flowCode[e]+a.code,this.setShaderStage(s),a}getAttributesArray(){return this.attributes.concat(this.bufferAttributes)}getAttributes(){console.warn("Abstract function.")}getVaryings(){console.warn("Abstract function.")}getVar(e,t){return`${this.getType(e)} ${t}`}getVars(e){let t="";const n=this.vars[e];if(n!==void 0)for(const r of n)t+=`${this.getVar(r.type,r.name)}; `;return t}getUniforms(){console.warn("Abstract function.")}getCodes(e){const t=this.codes[e];let n="";if(t!==void 0)for(const r of t)n+=r.code+` `;return n}getHash(){return this.vertexShader+this.fragmentShader+this.computeShader}setShaderStage(e){this.shaderStage=e}getShaderStage(){return this.shaderStage}setBuildStage(e){this.buildStage=e}getBuildStage(){return this.buildStage}buildCode(){console.warn("Abstract function.")}build(){const{object:e,material:t,renderer:n}=this;if(t!==null){let r=n.library.fromMaterial(t);r===null&&(console.error(`NodeMaterial: Material "${t.type}" is not compatible.`),r=new Vr),r.build(this)}else this.addFlow("compute",e);for(const r of IT){this.setBuildStage(r),this.context.vertex&&this.context.vertex.isNode&&this.flowNodeFromShaderStage("vertex",this.context.vertex);for(const s of FT){this.setShaderStage(s);const a=this.flowNodes[s];for(const l of a)r==="generate"?this.flowNode(l):l.build(this)}}return this.setBuildStage(null),this.setShaderStage(null),this.buildCode(),this.buildUpdateNodes(),this}getNodeUniform(e,t){if(t==="float"||t==="int"||t==="uint")return new Bae(e);if(t==="vec2"||t==="ivec2"||t==="uvec2")return new Oae(e);if(t==="vec3"||t==="ivec3"||t==="uvec3")return new Iae(e);if(t==="vec4"||t==="ivec4"||t==="uvec4")return new Fae(e);if(t==="color")return new kae(e);if(t==="mat3")return new zae(e);if(t==="mat4")return new Gae(e);throw new Error(`Uniform "${t}" not declared.`)}format(e,t,n){if(t=this.getVectorType(t),n=this.getVectorType(n),t===n||n===null||this.isReference(n))return e;const r=this.getTypeLength(t),s=this.getTypeLength(n);return r===16&&s===9?`${this.getType(n)}(${e}[0].xyz, ${e}[1].xyz, ${e}[2].xyz)`:r===9&&s===4?`${this.getType(n)}(${e}[0].xy, ${e}[1].xy)`:r>4||s>4||s===0?e:r===s?`${this.getType(n)}( ${e} )`:r>s?this.format(`${e}.${"xyz".slice(0,s)}`,this.getTypeFromLength(s,this.getComponentType(t)),n):s===4&&r>1?`${this.getType(n)}( ${this.format(e,t,"vec3")}, 1.0 )`:r===2?`${this.getType(n)}( ${this.format(e,t,"vec2")}, 0.0 )`:(r===1&&s>1&&t!==this.getComponentType(n)&&(e=`${this.getType(this.getComponentType(n))}( ${e} )`),`${this.getType(n)}( ${e} )`)}getSignature(){return`// Three.js r${V0} - Node System -`}createNodeMaterial(e="NodeMaterial"){throw new Error(`THREE.NodeBuilder: createNodeMaterial() was deprecated. Use new ${e}() instead.`)}}class gN{constructor(){this.time=0,this.deltaTime=0,this.frameId=0,this.renderId=0,this.updateMap=new WeakMap,this.updateBeforeMap=new WeakMap,this.updateAfterMap=new WeakMap,this.renderer=null,this.material=null,this.camera=null,this.object=null,this.scene=null}_getMaps(e,t){let n=e.get(t);return n===void 0&&(n={renderMap:new WeakMap,frameMap:new WeakMap},e.set(t,n)),n}updateBeforeNode(e){const t=e.getUpdateBeforeType(),n=e.updateReference(this);if(t===jn.FRAME){const{frameMap:r}=this._getMaps(this.updateBeforeMap,n);r.get(n)!==this.frameId&&e.updateBefore(this)!==!1&&r.set(n,this.frameId)}else if(t===jn.RENDER){const{renderMap:r}=this._getMaps(this.updateBeforeMap,n);r.get(n)!==this.renderId&&e.updateBefore(this)!==!1&&r.set(n,this.renderId)}else t===jn.OBJECT&&e.updateBefore(this)}updateAfterNode(e){const t=e.getUpdateAfterType(),n=e.updateReference(this);if(t===jn.FRAME){const{frameMap:r}=this._getMaps(this.updateAfterMap,n);r.get(n)!==this.frameId&&e.updateAfter(this)!==!1&&r.set(n,this.frameId)}else if(t===jn.RENDER){const{renderMap:r}=this._getMaps(this.updateAfterMap,n);r.get(n)!==this.renderId&&e.updateAfter(this)!==!1&&r.set(n,this.renderId)}else t===jn.OBJECT&&e.updateAfter(this)}updateNode(e){const t=e.getUpdateType(),n=e.updateReference(this);if(t===jn.FRAME){const{frameMap:r}=this._getMaps(this.updateMap,n);r.get(n)!==this.frameId&&e.update(this)!==!1&&r.set(n,this.frameId)}else if(t===jn.RENDER){const{renderMap:r}=this._getMaps(this.updateMap,n);r.get(n)!==this.renderId&&e.update(this)!==!1&&r.set(n,this.renderId)}else t===jn.OBJECT&&e.update(this)}update(){this.frameId++,this.lastTime===void 0&&(this.lastTime=performance.now()),this.deltaTime=(performance.now()-this.lastTime)/1e3,this.lastTime=performance.now(),this.time+=this.deltaTime}}class FE{constructor(e,t,n=null,r="",s=!1){this.type=e,this.name=t,this.count=n,this.qualifier=r,this.isConst=s}}FE.isNodeFunctionInput=!0;class Xae extends xA{static get type(){return"DirectionalLightNode"}constructor(e=null){super(e)}setup(e){super.setup(e);const t=e.context.lightingModel,n=this.colorNode,r=NE(this.light),s=e.context.reflectedLight;t.direct({lightDirection:r,lightColor:n,reflectedLight:s},e.stack,e)}}const pS=new kn,_v=new kn;let dm=null;class Yae extends xA{static get type(){return"RectAreaLightNode"}constructor(e=null){super(e),this.halfHeight=gn(new ce).setGroup(Rn),this.halfWidth=gn(new ce).setGroup(Rn),this.updateType=jn.RENDER}update(e){super.update(e);const{light:t}=this,n=e.camera.matrixWorldInverse;_v.identity(),pS.copy(t.matrixWorld),pS.premultiply(n),_v.extractRotation(pS),this.halfWidth.value.set(t.width*.5,0,0),this.halfHeight.value.set(0,t.height*.5,0),this.halfWidth.value.applyMatrix4(_v),this.halfHeight.value.applyMatrix4(_v)}setup(e){super.setup(e);let t,n;e.isAvailable("float32Filterable")?(t=Ai(dm.LTC_FLOAT_1),n=Ai(dm.LTC_FLOAT_2)):(t=Ai(dm.LTC_HALF_1),n=Ai(dm.LTC_HALF_2));const{colorNode:r,light:s}=this,a=e.context.lightingModel,l=Jy(s),u=e.context.reflectedLight;a.directRectArea({lightColor:r,lightPosition:l,halfWidth:this.halfWidth,halfHeight:this.halfHeight,reflectedLight:u,ltc_1:t,ltc_2:n},e.stack,e)}static setLTC(e){dm=e}}class XB extends xA{static get type(){return"SpotLightNode"}constructor(e=null){super(e),this.coneCosNode=gn(0).setGroup(Rn),this.penumbraCosNode=gn(0).setGroup(Rn),this.cutoffDistanceNode=gn(0).setGroup(Rn),this.decayExponentNode=gn(0).setGroup(Rn)}update(e){super.update(e);const{light:t}=this;this.coneCosNode.value=Math.cos(t.angle),this.penumbraCosNode.value=Math.cos(t.angle*(1-t.penumbra)),this.cutoffDistanceNode.value=t.distance,this.decayExponentNode.value=t.decay}getSpotAttenuation(e){const{coneCosNode:t,penumbraCosNode:n}=this;return kc(t,n,e)}setup(e){super.setup(e);const t=e.context.lightingModel,{colorNode:n,cutoffDistanceNode:r,decayExponentNode:s,light:a}=this,l=Jy(a).sub(Xr),u=l.normalize(),h=u.dot(NE(a)),g=this.getSpotAttenuation(h),v=l.length(),x=LE({lightDistance:v,cutoffDistance:r,decayExponent:s});let S=n.mul(g).mul(x);if(a.map){const R=MB(a),C=Ai(a.map,R.xy).onRenderUpdate(()=>a.map);S=R.mul(2).sub(1).abs().lessThan(1).all().select(S.mul(C),S)}const w=e.context.reflectedLight;t.direct({lightDirection:u,lightColor:S,reflectedLight:w},e.stack,e)}}class Qae extends XB{static get type(){return"IESSpotLightNode"}getSpotAttenuation(e){const t=this.light.iesMap;let n=null;if(t&&t.isTexture===!0){const r=e.acos().mul(1/Math.PI);n=Ai(t,Et(r,0),0).r}else n=super.getSpotAttenuation(e);return n}}class Kae extends xA{static get type(){return"AmbientLightNode"}constructor(e=null){super(e)}setup({context:e}){e.irradiance.addAssign(this.colorNode)}}class Zae extends xA{static get type(){return"HemisphereLightNode"}constructor(e=null){super(e),this.lightPositionNode=RE(e),this.lightDirectionNode=this.lightPositionNode.normalize(),this.groundColorNode=gn(new sn).setGroup(Rn)}update(e){const{light:t}=this;super.update(e),this.lightPositionNode.object3d=t,this.groundColorNode.value.copy(t.groundColor).multiplyScalar(t.intensity)}setup(e){const{colorNode:t,groundColorNode:n,lightDirectionNode:r}=this,a=Jo.dot(r).mul(.5).add(.5),l=Fi(n,t,a);e.context.irradiance.addAssign(l)}}class Jae extends xA{static get type(){return"LightProbeNode"}constructor(e=null){super(e);const t=[];for(let n=0;n<9;n++)t.push(new ce);this.lightProbe=Sc(t)}update(e){const{light:t}=this;super.update(e);for(let n=0;n<9;n++)this.lightProbe.array[n].copy(t.sh.coefficients[n]).multiplyScalar(t.intensity)}setup(e){const t=jB(Vy,this.lightProbe);e.context.irradiance.addAssign(t)}}class YB{parseFunction(){console.warn("Abstract function.")}}class kE{constructor(e,t,n="",r=""){this.type=e,this.inputs=t,this.name=n,this.precision=r}getCode(){console.warn("Abstract function.")}}kE.isNodeFunction=!0;const eoe=/^\s*(highp|mediump|lowp)?\s*([a-z_0-9]+)\s*([a-z_0-9]+)?\s*\(([\s\S]*?)\)/i,toe=/[a-z_0-9]+/ig,vN="#pragma main",noe=i=>{i=i.trim();const e=i.indexOf(vN),t=e!==-1?i.slice(e+vN.length):i,n=t.match(eoe);if(n!==null&&n.length===5){const r=n[4],s=[];let a=null;for(;(a=toe.exec(r))!==null;)s.push(a);const l=[];let u=0;for(;u0||e.backgroundBlurriness>0&&t.backgroundBlurriness===0;if(t.background!==n||r){const s=this.getCacheNode("background",n,()=>{if(n.isCubeTexture===!0||n.mapping===zh||n.mapping===Gh||n.mapping===sA){if(e.backgroundBlurriness>0||n.mapping===sA)return _E(n);{let a;return n.isCubeTexture===!0?a=I0(n):a=Ai(n),UU(a)}}else{if(n.isTexture===!0)return Ai(n,bu.flipY()).setUpdateMatrix(!0);n.isColor!==!0&&console.error("WebGPUNodes: Unsupported background configuration.",n)}},r);t.backgroundNode=s,t.background=n,t.backgroundBlurriness=e.backgroundBlurriness}}else t.backgroundNode&&(delete t.backgroundNode,delete t.background)}getCacheNode(e,t,n,r=!1){const s=this.cacheLib[e]||(this.cacheLib[e]=new WeakMap);let a=s.get(t);return(a===void 0||r)&&(a=n(),s.set(t,a)),a}updateFog(e){const t=this.get(e),n=e.fog;if(n){if(t.fog!==n){const r=this.getCacheNode("fog",n,()=>{if(n.isFogExp2){const s=ji("color","color",n).setGroup(Rn),a=ji("density","float",n).setGroup(Rn);return Ng(s,ME(a))}else if(n.isFog){const s=ji("color","color",n).setGroup(Rn),a=ji("near","float",n).setGroup(Rn),l=ji("far","float",n).setGroup(Rn);return Ng(s,wE(a,l))}else console.error("THREE.Renderer: Unsupported fog configuration.",n)});t.fogNode=r,t.fog=n}}else delete t.fogNode,delete t.fog}updateEnvironment(e){const t=this.get(e),n=e.environment;if(n){if(t.environment!==n){const r=this.getCacheNode("environment",n,()=>{if(n.isCubeTexture===!0)return I0(n);if(n.isTexture===!0)return Ai(n);console.error("Nodes: Unsupported environment configuration.",n)});t.environmentNode=r,t.environment=n}}else t.environmentNode&&(delete t.environmentNode,delete t.environment)}getNodeFrame(e=this.renderer,t=null,n=null,r=null,s=null){const a=this.nodeFrame;return a.renderer=e,a.scene=t,a.object=n,a.camera=r,a.material=s,a}getNodeFrameForRender(e){return this.getNodeFrame(e.renderer,e.scene,e.object,e.camera,e.material)}getOutputCacheKey(){const e=this.renderer;return e.toneMapping+","+e.currentColorSpace}hasOutputChange(e){return _N.get(e)!==this.getOutputCacheKey()}getOutputNode(e){const t=this.renderer,n=this.getOutputCacheKey(),r=Ai(e,bu).renderOutput(t.toneMapping,t.currentColorSpace);return _N.set(e,n),r}updateBefore(e){const t=e.getNodeBuilderState();for(const n of t.updateBeforeNodes)this.getNodeFrameForRender(e).updateBeforeNode(n)}updateAfter(e){const t=e.getNodeBuilderState();for(const n of t.updateAfterNodes)this.getNodeFrameForRender(e).updateAfterNode(n)}updateForCompute(e){const t=this.getNodeFrame(),n=this.getForCompute(e);for(const r of n.updateNodes)t.updateNode(r)}updateForRender(e){const t=this.getNodeFrameForRender(e),n=e.getNodeBuilderState();for(const r of n.updateNodes)t.updateNode(r)}needsRefresh(e){const t=this.getNodeFrameForRender(e);return e.getMonitor().needsRefresh(e,t)}dispose(){super.dispose(),this.nodeFrame=new gN,this.nodeBuilderCache=new Map,this.cacheLib={}}}const mS=new Yl;class ay{constructor(e=null){this.version=0,this.clipIntersection=null,this.cacheKey="",this.shadowPass=!1,this.viewNormalMatrix=new Vn,this.clippingGroupContexts=new WeakMap,this.intersectionPlanes=[],this.unionPlanes=[],this.parentVersion=null,e!==null&&(this.viewNormalMatrix=e.viewNormalMatrix,this.clippingGroupContexts=e.clippingGroupContexts,this.shadowPass=e.shadowPass,this.viewMatrix=e.viewMatrix)}projectPlanes(e,t,n){const r=e.length;for(let s=0;s{await this.compileAsync(v,x);const w=this._renderLists.get(v,x),R=this._renderContexts.get(v,x,this._renderTarget),C=v.overrideMaterial||S.material,E=this._objects.get(S,C,v,x,w.lightsNode,R,R.clippingContext),{fragmentShader:B,vertexShader:L}=E.getNodeBuilderState();return{fragmentShader:B,vertexShader:L}}}}async init(){if(this._initialized)throw new Error("Renderer: Backend has already been initialized.");return this._initPromise!==null?this._initPromise:(this._initPromise=new Promise(async(e,t)=>{let n=this.backend;try{await n.init(this)}catch(r){if(this._getFallback!==null)try{this.backend=n=this._getFallback(r),await n.init(this)}catch(s){t(s);return}else{t(r);return}}this._nodes=new soe(this,n),this._animation=new lne(this._nodes,this.info),this._attributes=new pne(n),this._background=new yae(this,this._nodes),this._geometries=new gne(this._attributes,this.info),this._textures=new Dne(this,n,this.info),this._pipelines=new bne(n,this._nodes),this._bindings=new Sne(n,this._nodes,this._textures,this._attributes,this._pipelines,this.info),this._objects=new fne(this,this._nodes,this._geometries,this._pipelines,this._bindings,this.info),this._renderLists=new Mne(this.lighting),this._bundles=new ooe,this._renderContexts=new Rne,this._animation.start(),this._initialized=!0,e()}),this._initPromise)}get coordinateSystem(){return this.backend.coordinateSystem}async compileAsync(e,t,n=null){if(this._isDeviceLost===!0)return;this._initialized===!1&&await this.init();const r=this._nodes.nodeFrame,s=r.renderId,a=this._currentRenderContext,l=this._currentRenderObjectFunction,u=this._compilationPromises,h=e.isScene===!0?e:yN;n===null&&(n=e);const g=this._renderTarget,v=this._renderContexts.get(n,t,g),x=this._activeMipmapLevel,S=[];this._currentRenderContext=v,this._currentRenderObjectFunction=this.renderObject,this._handleObjectFunction=this._createObjectPipeline,this._compilationPromises=S,r.renderId++,r.update(),v.depth=this.depth,v.stencil=this.stencil,v.clippingContext||(v.clippingContext=new ay),v.clippingContext.updateGlobal(h,t),h.onBeforeRender(this,e,t,g);const w=this._renderLists.get(e,t);if(w.begin(),this._projectObject(e,t,0,w,v.clippingContext),n!==e&&n.traverseVisible(function(L){L.isLight&&L.layers.test(t.layers)&&w.pushLight(L)}),w.finish(),g!==null){this._textures.updateRenderTarget(g,x);const L=this._textures.get(g);v.textures=L.textures,v.depthTexture=L.depthTexture}else v.textures=null,v.depthTexture=null;this._background.update(h,w,v);const R=w.opaque,C=w.transparent,E=w.transparentDoublePass,B=w.lightsNode;this.opaque===!0&&R.length>0&&this._renderObjects(R,t,h,B),this.transparent===!0&&C.length>0&&this._renderTransparents(C,E,t,h,B),r.renderId=s,this._currentRenderContext=a,this._currentRenderObjectFunction=l,this._compilationPromises=u,this._handleObjectFunction=this._renderObjectDirect,await Promise.all(S)}async renderAsync(e,t){this._initialized===!1&&await this.init();const n=this._renderScene(e,t);await this.backend.resolveTimestampAsync(n,"render")}async waitForGPU(){await this.backend.waitForGPU()}setMRT(e){return this._mrt=e,this}getMRT(){return this._mrt}_onDeviceLost(e){let t=`THREE.WebGPURenderer: ${e.api} Device Lost: +`}createNodeMaterial(e="NodeMaterial"){throw new Error(`THREE.NodeBuilder: createNodeMaterial() was deprecated. Use new ${e}() instead.`)}}class gN{constructor(){this.time=0,this.deltaTime=0,this.frameId=0,this.renderId=0,this.updateMap=new WeakMap,this.updateBeforeMap=new WeakMap,this.updateAfterMap=new WeakMap,this.renderer=null,this.material=null,this.camera=null,this.object=null,this.scene=null}_getMaps(e,t){let n=e.get(t);return n===void 0&&(n={renderMap:new WeakMap,frameMap:new WeakMap},e.set(t,n)),n}updateBeforeNode(e){const t=e.getUpdateBeforeType(),n=e.updateReference(this);if(t===jn.FRAME){const{frameMap:r}=this._getMaps(this.updateBeforeMap,n);r.get(n)!==this.frameId&&e.updateBefore(this)!==!1&&r.set(n,this.frameId)}else if(t===jn.RENDER){const{renderMap:r}=this._getMaps(this.updateBeforeMap,n);r.get(n)!==this.renderId&&e.updateBefore(this)!==!1&&r.set(n,this.renderId)}else t===jn.OBJECT&&e.updateBefore(this)}updateAfterNode(e){const t=e.getUpdateAfterType(),n=e.updateReference(this);if(t===jn.FRAME){const{frameMap:r}=this._getMaps(this.updateAfterMap,n);r.get(n)!==this.frameId&&e.updateAfter(this)!==!1&&r.set(n,this.frameId)}else if(t===jn.RENDER){const{renderMap:r}=this._getMaps(this.updateAfterMap,n);r.get(n)!==this.renderId&&e.updateAfter(this)!==!1&&r.set(n,this.renderId)}else t===jn.OBJECT&&e.updateAfter(this)}updateNode(e){const t=e.getUpdateType(),n=e.updateReference(this);if(t===jn.FRAME){const{frameMap:r}=this._getMaps(this.updateMap,n);r.get(n)!==this.frameId&&e.update(this)!==!1&&r.set(n,this.frameId)}else if(t===jn.RENDER){const{renderMap:r}=this._getMaps(this.updateMap,n);r.get(n)!==this.renderId&&e.update(this)!==!1&&r.set(n,this.renderId)}else t===jn.OBJECT&&e.update(this)}update(){this.frameId++,this.lastTime===void 0&&(this.lastTime=performance.now()),this.deltaTime=(performance.now()-this.lastTime)/1e3,this.lastTime=performance.now(),this.time+=this.deltaTime}}class FE{constructor(e,t,n=null,r="",s=!1){this.type=e,this.name=t,this.count=n,this.qualifier=r,this.isConst=s}}FE.isNodeFunctionInput=!0;class Xae extends xA{static get type(){return"DirectionalLightNode"}constructor(e=null){super(e)}setup(e){super.setup(e);const t=e.context.lightingModel,n=this.colorNode,r=NE(this.light),s=e.context.reflectedLight;t.direct({lightDirection:r,lightColor:n,reflectedLight:s},e.stack,e)}}const pS=new kn,_v=new kn;let dm=null;class Yae extends xA{static get type(){return"RectAreaLightNode"}constructor(e=null){super(e),this.halfHeight=gn(new ce).setGroup(Rn),this.halfWidth=gn(new ce).setGroup(Rn),this.updateType=jn.RENDER}update(e){super.update(e);const{light:t}=this,n=e.camera.matrixWorldInverse;_v.identity(),pS.copy(t.matrixWorld),pS.premultiply(n),_v.extractRotation(pS),this.halfWidth.value.set(t.width*.5,0,0),this.halfHeight.value.set(0,t.height*.5,0),this.halfWidth.value.applyMatrix4(_v),this.halfHeight.value.applyMatrix4(_v)}setup(e){super.setup(e);let t,n;e.isAvailable("float32Filterable")?(t=Ai(dm.LTC_FLOAT_1),n=Ai(dm.LTC_FLOAT_2)):(t=Ai(dm.LTC_HALF_1),n=Ai(dm.LTC_HALF_2));const{colorNode:r,light:s}=this,a=e.context.lightingModel,l=Jy(s),u=e.context.reflectedLight;a.directRectArea({lightColor:r,lightPosition:l,halfWidth:this.halfWidth,halfHeight:this.halfHeight,reflectedLight:u,ltc_1:t,ltc_2:n},e.stack,e)}static setLTC(e){dm=e}}class XB extends xA{static get type(){return"SpotLightNode"}constructor(e=null){super(e),this.coneCosNode=gn(0).setGroup(Rn),this.penumbraCosNode=gn(0).setGroup(Rn),this.cutoffDistanceNode=gn(0).setGroup(Rn),this.decayExponentNode=gn(0).setGroup(Rn)}update(e){super.update(e);const{light:t}=this;this.coneCosNode.value=Math.cos(t.angle),this.penumbraCosNode.value=Math.cos(t.angle*(1-t.penumbra)),this.cutoffDistanceNode.value=t.distance,this.decayExponentNode.value=t.decay}getSpotAttenuation(e){const{coneCosNode:t,penumbraCosNode:n}=this;return kc(t,n,e)}setup(e){super.setup(e);const t=e.context.lightingModel,{colorNode:n,cutoffDistanceNode:r,decayExponentNode:s,light:a}=this,l=Jy(a).sub(Xr),u=l.normalize(),h=u.dot(NE(a)),g=this.getSpotAttenuation(h),v=l.length(),x=LE({lightDistance:v,cutoffDistance:r,decayExponent:s});let S=n.mul(g).mul(x);if(a.map){const R=MB(a),C=Ai(a.map,R.xy).onRenderUpdate(()=>a.map);S=R.mul(2).sub(1).abs().lessThan(1).all().select(S.mul(C),S)}const w=e.context.reflectedLight;t.direct({lightDirection:u,lightColor:S,reflectedLight:w},e.stack,e)}}class Qae extends XB{static get type(){return"IESSpotLightNode"}getSpotAttenuation(e){const t=this.light.iesMap;let n=null;if(t&&t.isTexture===!0){const r=e.acos().mul(1/Math.PI);n=Ai(t,Et(r,0),0).r}else n=super.getSpotAttenuation(e);return n}}class Kae extends xA{static get type(){return"AmbientLightNode"}constructor(e=null){super(e)}setup({context:e}){e.irradiance.addAssign(this.colorNode)}}class Zae extends xA{static get type(){return"HemisphereLightNode"}constructor(e=null){super(e),this.lightPositionNode=RE(e),this.lightDirectionNode=this.lightPositionNode.normalize(),this.groundColorNode=gn(new sn).setGroup(Rn)}update(e){const{light:t}=this;super.update(e),this.lightPositionNode.object3d=t,this.groundColorNode.value.copy(t.groundColor).multiplyScalar(t.intensity)}setup(e){const{colorNode:t,groundColorNode:n,lightDirectionNode:r}=this,a=Jo.dot(r).mul(.5).add(.5),l=Fi(n,t,a);e.context.irradiance.addAssign(l)}}class Jae extends xA{static get type(){return"LightProbeNode"}constructor(e=null){super(e);const t=[];for(let n=0;n<9;n++)t.push(new ce);this.lightProbe=Sc(t)}update(e){const{light:t}=this;super.update(e);for(let n=0;n<9;n++)this.lightProbe.array[n].copy(t.sh.coefficients[n]).multiplyScalar(t.intensity)}setup(e){const t=jB(Vy,this.lightProbe);e.context.irradiance.addAssign(t)}}class YB{parseFunction(){console.warn("Abstract function.")}}class kE{constructor(e,t,n="",r=""){this.type=e,this.inputs=t,this.name=n,this.precision=r}getCode(){console.warn("Abstract function.")}}kE.isNodeFunction=!0;const eoe=/^\s*(highp|mediump|lowp)?\s*([a-z_0-9]+)\s*([a-z_0-9]+)?\s*\(([\s\S]*?)\)/i,toe=/[a-z_0-9]+/ig,vN="#pragma main",noe=i=>{i=i.trim();const e=i.indexOf(vN),t=e!==-1?i.slice(e+vN.length):i,n=t.match(eoe);if(n!==null&&n.length===5){const r=n[4],s=[];let a=null;for(;(a=toe.exec(r))!==null;)s.push(a);const l=[];let u=0;for(;u0||e.backgroundBlurriness>0&&t.backgroundBlurriness===0;if(t.background!==n||r){const s=this.getCacheNode("background",n,()=>{if(n.isCubeTexture===!0||n.mapping===zh||n.mapping===Gh||n.mapping===sA){if(e.backgroundBlurriness>0||n.mapping===sA)return _E(n);{let a;return n.isCubeTexture===!0?a=I0(n):a=Ai(n),UU(a)}}else{if(n.isTexture===!0)return Ai(n,bu.flipY()).setUpdateMatrix(!0);n.isColor!==!0&&console.error("WebGPUNodes: Unsupported background configuration.",n)}},r);t.backgroundNode=s,t.background=n,t.backgroundBlurriness=e.backgroundBlurriness}}else t.backgroundNode&&(delete t.backgroundNode,delete t.background)}getCacheNode(e,t,n,r=!1){const s=this.cacheLib[e]||(this.cacheLib[e]=new WeakMap);let a=s.get(t);return(a===void 0||r)&&(a=n(),s.set(t,a)),a}updateFog(e){const t=this.get(e),n=e.fog;if(n){if(t.fog!==n){const r=this.getCacheNode("fog",n,()=>{if(n.isFogExp2){const s=ji("color","color",n).setGroup(Rn),a=ji("density","float",n).setGroup(Rn);return Ng(s,ME(a))}else if(n.isFog){const s=ji("color","color",n).setGroup(Rn),a=ji("near","float",n).setGroup(Rn),l=ji("far","float",n).setGroup(Rn);return Ng(s,wE(a,l))}else console.error("THREE.Renderer: Unsupported fog configuration.",n)});t.fogNode=r,t.fog=n}}else delete t.fogNode,delete t.fog}updateEnvironment(e){const t=this.get(e),n=e.environment;if(n){if(t.environment!==n){const r=this.getCacheNode("environment",n,()=>{if(n.isCubeTexture===!0)return I0(n);if(n.isTexture===!0)return Ai(n);console.error("Nodes: Unsupported environment configuration.",n)});t.environmentNode=r,t.environment=n}}else t.environmentNode&&(delete t.environmentNode,delete t.environment)}getNodeFrame(e=this.renderer,t=null,n=null,r=null,s=null){const a=this.nodeFrame;return a.renderer=e,a.scene=t,a.object=n,a.camera=r,a.material=s,a}getNodeFrameForRender(e){return this.getNodeFrame(e.renderer,e.scene,e.object,e.camera,e.material)}getOutputCacheKey(){const e=this.renderer;return e.toneMapping+","+e.currentColorSpace}hasOutputChange(e){return _N.get(e)!==this.getOutputCacheKey()}getOutputNode(e){const t=this.renderer,n=this.getOutputCacheKey(),r=Ai(e,bu).renderOutput(t.toneMapping,t.currentColorSpace);return _N.set(e,n),r}updateBefore(e){const t=e.getNodeBuilderState();for(const n of t.updateBeforeNodes)this.getNodeFrameForRender(e).updateBeforeNode(n)}updateAfter(e){const t=e.getNodeBuilderState();for(const n of t.updateAfterNodes)this.getNodeFrameForRender(e).updateAfterNode(n)}updateForCompute(e){const t=this.getNodeFrame(),n=this.getForCompute(e);for(const r of n.updateNodes)t.updateNode(r)}updateForRender(e){const t=this.getNodeFrameForRender(e),n=e.getNodeBuilderState();for(const r of n.updateNodes)t.updateNode(r)}needsRefresh(e){const t=this.getNodeFrameForRender(e);return e.getMonitor().needsRefresh(e,t)}dispose(){super.dispose(),this.nodeFrame=new gN,this.nodeBuilderCache=new Map,this.cacheLib={}}}const mS=new Yl;class ay{constructor(e=null){this.version=0,this.clipIntersection=null,this.cacheKey="",this.shadowPass=!1,this.viewNormalMatrix=new Vn,this.clippingGroupContexts=new WeakMap,this.intersectionPlanes=[],this.unionPlanes=[],this.parentVersion=null,e!==null&&(this.viewNormalMatrix=e.viewNormalMatrix,this.clippingGroupContexts=e.clippingGroupContexts,this.shadowPass=e.shadowPass,this.viewMatrix=e.viewMatrix)}projectPlanes(e,t,n){const r=e.length;for(let s=0;s{await this.compileAsync(v,x);const w=this._renderLists.get(v,x),R=this._renderContexts.get(v,x,this._renderTarget),C=v.overrideMaterial||S.material,E=this._objects.get(S,C,v,x,w.lightsNode,R,R.clippingContext),{fragmentShader:B,vertexShader:L}=E.getNodeBuilderState();return{fragmentShader:B,vertexShader:L}}}}async init(){if(this._initialized)throw new Error("Renderer: Backend has already been initialized.");return this._initPromise!==null?this._initPromise:(this._initPromise=new Promise(async(e,t)=>{let n=this.backend;try{await n.init(this)}catch(r){if(this._getFallback!==null)try{this.backend=n=this._getFallback(r),await n.init(this)}catch(s){t(s);return}else{t(r);return}}this._nodes=new soe(this,n),this._animation=new lne(this._nodes,this.info),this._attributes=new pne(n),this._background=new yae(this,this._nodes),this._geometries=new gne(this._attributes,this.info),this._textures=new Dne(this,n,this.info),this._pipelines=new bne(n,this._nodes),this._bindings=new Sne(n,this._nodes,this._textures,this._attributes,this._pipelines,this.info),this._objects=new fne(this,this._nodes,this._geometries,this._pipelines,this._bindings,this.info),this._renderLists=new Mne(this.lighting),this._bundles=new ooe,this._renderContexts=new Rne,this._animation.start(),this._initialized=!0,e()}),this._initPromise)}get coordinateSystem(){return this.backend.coordinateSystem}async compileAsync(e,t,n=null){if(this._isDeviceLost===!0)return;this._initialized===!1&&await this.init();const r=this._nodes.nodeFrame,s=r.renderId,a=this._currentRenderContext,l=this._currentRenderObjectFunction,u=this._compilationPromises,h=e.isScene===!0?e:yN;n===null&&(n=e);const g=this._renderTarget,v=this._renderContexts.get(n,t,g),x=this._activeMipmapLevel,S=[];this._currentRenderContext=v,this._currentRenderObjectFunction=this.renderObject,this._handleObjectFunction=this._createObjectPipeline,this._compilationPromises=S,r.renderId++,r.update(),v.depth=this.depth,v.stencil=this.stencil,v.clippingContext||(v.clippingContext=new ay),v.clippingContext.updateGlobal(h,t),h.onBeforeRender(this,e,t,g);const w=this._renderLists.get(e,t);if(w.begin(),this._projectObject(e,t,0,w,v.clippingContext),n!==e&&n.traverseVisible(function(L){L.isLight&&L.layers.test(t.layers)&&w.pushLight(L)}),w.finish(),g!==null){this._textures.updateRenderTarget(g,x);const L=this._textures.get(g);v.textures=L.textures,v.depthTexture=L.depthTexture}else v.textures=null,v.depthTexture=null;this._background.update(h,w,v);const R=w.opaque,C=w.transparent,E=w.transparentDoublePass,B=w.lightsNode;this.opaque===!0&&R.length>0&&this._renderObjects(R,t,h,B),this.transparent===!0&&C.length>0&&this._renderTransparents(C,E,t,h,B),r.renderId=s,this._currentRenderContext=a,this._currentRenderObjectFunction=l,this._compilationPromises=u,this._handleObjectFunction=this._renderObjectDirect,await Promise.all(S)}async renderAsync(e,t){this._initialized===!1&&await this.init();const n=this._renderScene(e,t);await this.backend.resolveTimestampAsync(n,"render")}async waitForGPU(){await this.backend.waitForGPU()}setMRT(e){return this._mrt=e,this}getMRT(){return this._mrt}_onDeviceLost(e){let t=`THREE.WebGPURenderer: ${e.api} Device Lost: Message: ${e.message}`;e.reason&&(t+=` Reason: ${e.reason}`),console.error(t),this._isDeviceLost=!0}_renderBundle(e,t,n){const{bundleGroup:r,camera:s,renderList:a}=e,l=this._currentRenderContext,u=this._bundles.get(r,s),h=this.backend.get(u);h.renderContexts===void 0&&(h.renderContexts=new Set);const g=r.version!==h.version,v=h.renderContexts.has(l)===!1||g;if(h.renderContexts.add(l),v){this.backend.beginBundle(l),(h.renderObjects===void 0||g)&&(h.renderObjects=[]),this._currentRenderBundle=u;const x=a.opaque;this.opaque===!0&&x.length>0&&this._renderObjects(x,s,t,n),this._currentRenderBundle=null,this.backend.finishBundle(l,u),h.version=r.version}else{const{renderObjects:x}=h;for(let S=0,w=x.length;S>=x,w.viewportValue.height>>=x,w.viewportValue.minDepth=L,w.viewportValue.maxDepth=O,w.viewport=w.viewportValue.equals(gS)===!1,w.scissorValue.copy(E).multiplyScalar(B).floor(),w.scissor=this._scissorTest&&w.scissorValue.equals(gS)===!1,w.scissorValue.width>>=x,w.scissorValue.height>>=x,w.clippingContext||(w.clippingContext=new ay),w.clippingContext.updateGlobal(h,t),h.onBeforeRender(this,e,t,S),xv.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),vS.setFromProjectionMatrix(xv,R);const z=this._renderLists.get(e,t);if(z.begin(),this._projectObject(e,t,0,z,w.clippingContext),z.finish(),this.sortObjects===!0&&z.sort(this._opaqueSort,this._transparentSort),S!==null){this._textures.updateRenderTarget(S,x);const X=this._textures.get(S);w.textures=X.textures,w.depthTexture=X.depthTexture,w.width=X.width,w.height=X.height,w.renderTarget=S,w.depth=S.depthBuffer,w.stencil=S.stencilBuffer}else w.textures=null,w.depthTexture=null,w.width=this.domElement.width,w.height=this.domElement.height,w.depth=this.depth,w.stencil=this.stencil;w.width>>=x,w.height>>=x,w.activeCubeFace=v,w.activeMipmapLevel=x,w.occlusionQueryCount=z.occlusionQueryCount,this._background.update(h,z,w),this.backend.beginRender(w);const{bundles:G,lightsNode:k,transparentDoublePass:H,transparent:F,opaque:V}=z;if(G.length>0&&this._renderBundles(G,h,k),this.opaque===!0&&V.length>0&&this._renderObjects(V,t,h,k),this.transparent===!0&&F.length>0&&this._renderTransparents(F,H,t,h,k),this.backend.finishRender(w),s.renderId=a,this._currentRenderContext=l,this._currentRenderObjectFunction=u,r!==null){this.setRenderTarget(g,v,x);const X=this._quad;this._nodes.hasOutputChange(S.texture)&&(X.material.fragmentNode=this._nodes.getOutputNode(S.texture),X.material.needsUpdate=!0),this._renderScene(X,X.camera,!1)}return h.onAfterRender(this,e,t,S),w}getMaxAnisotropy(){return this.backend.getMaxAnisotropy()}getActiveCubeFace(){return this._activeCubeFace}getActiveMipmapLevel(){return this._activeMipmapLevel}async setAnimationLoop(e){this._initialized===!1&&await this.init(),this._animation.setAnimationLoop(e)}async getArrayBufferAsync(e){return await this.backend.getArrayBufferAsync(e)}getContext(){return this.backend.getContext()}getPixelRatio(){return this._pixelRatio}getDrawingBufferSize(e){return e.set(this._width*this._pixelRatio,this._height*this._pixelRatio).floor()}getSize(e){return e.set(this._width,this._height)}setPixelRatio(e=1){this._pixelRatio!==e&&(this._pixelRatio=e,this.setSize(this._width,this._height,!1))}setDrawingBufferSize(e,t,n){this._width=e,this._height=t,this._pixelRatio=n,this.domElement.width=Math.floor(e*n),this.domElement.height=Math.floor(t*n),this.setViewport(0,0,e,t),this._initialized&&this.backend.updateSize()}setSize(e,t,n=!0){this._width=e,this._height=t,this.domElement.width=Math.floor(e*this._pixelRatio),this.domElement.height=Math.floor(t*this._pixelRatio),n===!0&&(this.domElement.style.width=e+"px",this.domElement.style.height=t+"px"),this.setViewport(0,0,e,t),this._initialized&&this.backend.updateSize()}setOpaqueSort(e){this._opaqueSort=e}setTransparentSort(e){this._transparentSort=e}getScissor(e){const t=this._scissor;return e.x=t.x,e.y=t.y,e.width=t.width,e.height=t.height,e}setScissor(e,t,n,r){const s=this._scissor;e.isVector4?s.copy(e):s.set(e,t,n,r)}getScissorTest(){return this._scissorTest}setScissorTest(e){this._scissorTest=e,this.backend.setScissorTest(e)}getViewport(e){return e.copy(this._viewport)}setViewport(e,t,n,r,s=0,a=1){const l=this._viewport;e.isVector4?l.copy(e):l.set(e,t,n,r),l.minDepth=s,l.maxDepth=a}getClearColor(e){return e.copy(this._clearColor)}setClearColor(e,t=1){this._clearColor.set(e),this._clearColor.a=t}getClearAlpha(){return this._clearColor.a}setClearAlpha(e){this._clearColor.a=e}getClearDepth(){return this._clearDepth}setClearDepth(e){this._clearDepth=e}getClearStencil(){return this._clearStencil}setClearStencil(e){this._clearStencil=e}isOccluded(e){const t=this._currentRenderContext;return t&&this.backend.isOccluded(t,e)}clear(e=!0,t=!0,n=!0){if(this._initialized===!1)return console.warn("THREE.Renderer: .clear() called before the backend is initialized. Try using .clearAsync() instead."),this.clearAsync(e,t,n);const r=this._renderTarget||this._getFrameBufferTarget();let s=null;if(r!==null){this._textures.updateRenderTarget(r);const a=this._textures.get(r);s=this._renderContexts.get(null,null,r),s.textures=a.textures,s.depthTexture=a.depthTexture,s.width=a.width,s.height=a.height,s.renderTarget=r,s.depth=r.depthBuffer,s.stencil=r.stencilBuffer}if(this.backend.clear(e,t,n,s),r!==null&&this._renderTarget===null){const a=this._quad;this._nodes.hasOutputChange(r.texture)&&(a.material.fragmentNode=this._nodes.getOutputNode(r.texture),a.material.needsUpdate=!0),this._renderScene(a,a.camera,!1)}}clearColor(){return this.clear(!0,!1,!1)}clearDepth(){return this.clear(!1,!0,!1)}clearStencil(){return this.clear(!1,!1,!0)}async clearAsync(e=!0,t=!0,n=!0){this._initialized===!1&&await this.init(),this.clear(e,t,n)}async clearColorAsync(){this.clearAsync(!0,!1,!1)}async clearDepthAsync(){this.clearAsync(!1,!0,!1)}async clearStencilAsync(){this.clearAsync(!1,!1,!0)}get currentToneMapping(){return this._renderTarget!==null?Za:this.toneMapping}get currentColorSpace(){return this._renderTarget!==null?Ro:this.outputColorSpace}dispose(){this.info.dispose(),this.backend.dispose(),this._animation.dispose(),this._objects.dispose(),this._pipelines.dispose(),this._nodes.dispose(),this._bindings.dispose(),this._renderLists.dispose(),this._renderContexts.dispose(),this._textures.dispose(),this.setRenderTarget(null),this.setAnimationLoop(null)}setRenderTarget(e,t=0,n=0){this._renderTarget=e,this._activeCubeFace=t,this._activeMipmapLevel=n}getRenderTarget(){return this._renderTarget}setRenderObjectFunction(e){this._renderObjectFunction=e}getRenderObjectFunction(){return this._renderObjectFunction}compute(e){if(this.isDeviceLost===!0)return;if(this._initialized===!1)return console.warn("THREE.Renderer: .compute() called before the backend is initialized. Try using .computeAsync() instead."),this.computeAsync(e);const t=this._nodes.nodeFrame,n=t.renderId;this.info.calls++,this.info.compute.calls++,this.info.compute.frameCalls++,t.renderId=this.info.calls;const r=this.backend,s=this._pipelines,a=this._bindings,l=this._nodes,u=Array.isArray(e)?e:[e];if(u[0]===void 0||u[0].isComputeNode!==!0)throw new Error("THREE.Renderer: .compute() expects a ComputeNode.");r.beginCompute(e);for(const h of u){if(s.has(h)===!1){const x=()=>{h.removeEventListener("dispose",x),s.delete(h),a.delete(h),l.delete(h)};h.addEventListener("dispose",x);const S=h.onInitFunction;S!==null&&S.call(h,{renderer:this})}l.updateForCompute(h),a.updateForCompute(h);const g=a.getForCompute(h),v=s.getForCompute(h,g);r.compute(e,h,g,v)}r.finishCompute(e),t.renderId=n}async computeAsync(e){this._initialized===!1&&await this.init(),this.compute(e),await this.backend.resolveTimestampAsync(e,"compute")}async hasFeatureAsync(e){return this._initialized===!1&&await this.init(),this.backend.hasFeature(e)}hasFeature(e){return this._initialized===!1?(console.warn("THREE.Renderer: .hasFeature() called before the backend is initialized. Try using .hasFeatureAsync() instead."),!1):this.backend.hasFeature(e)}hasInitialized(){return this._initialized}async initTextureAsync(e){this._initialized===!1&&await this.init(),this._textures.updateTexture(e)}initTexture(e){this._initialized===!1&&console.warn("THREE.Renderer: .initTexture() called before the backend is initialized. Try using .initTextureAsync() instead."),this._textures.updateTexture(e)}copyFramebufferToTexture(e,t=null){if(t!==null)if(t.isVector2)t=Sh.set(t.x,t.y,e.image.width,e.image.height).floor();else if(t.isVector4)t=Sh.copy(t).floor();else{console.error("THREE.Renderer.copyFramebufferToTexture: Invalid rectangle.");return}else t=Sh.set(0,0,e.image.width,e.image.height);let n=this._currentRenderContext,r;n!==null?r=n.renderTarget:(r=this._renderTarget||this._getFrameBufferTarget(),r!==null&&(this._textures.updateRenderTarget(r),n=this._textures.get(r))),this._textures.updateTexture(e,{renderTarget:r}),this.backend.copyFramebufferToTexture(e,n,t)}copyTextureToTexture(e,t,n=null,r=null,s=0){this._textures.updateTexture(e),this._textures.updateTexture(t),this.backend.copyTextureToTexture(e,t,n,r,s)}async readRenderTargetPixelsAsync(e,t,n,r,s,a=0,l=0){return this.backend.copyTextureToBuffer(e.textures[a],t,n,r,s,l)}_projectObject(e,t,n,r,s){if(e.visible===!1)return;if(e.layers.test(t.layers)){if(e.isGroup)n=e.renderOrder,e.isClippingGroup&&e.enabled&&(s=s.getGroupContext(e));else if(e.isLOD)e.autoUpdate===!0&&e.update(t);else if(e.isLight)r.pushLight(e);else if(e.isSprite){if(!e.frustumCulled||vS.intersectsSprite(e)){this.sortObjects===!0&&Sh.setFromMatrixPosition(e.matrixWorld).applyMatrix4(xv);const{geometry:u,material:h}=e;h.visible&&r.push(e,u,h,n,Sh.z,null,s)}}else if(e.isLineLoop)console.error("THREE.Renderer: Objects of type THREE.LineLoop are not supported. Please use THREE.Line or THREE.LineSegments.");else if((e.isMesh||e.isLine||e.isPoints)&&(!e.frustumCulled||vS.intersectsObject(e))){const{geometry:u,material:h}=e;if(this.sortObjects===!0&&(u.boundingSphere===null&&u.computeBoundingSphere(),Sh.copy(u.boundingSphere.center).applyMatrix4(e.matrixWorld).applyMatrix4(xv)),Array.isArray(h)){const g=u.groups;for(let v=0,x=g.length;v0){for(const{material:a}of t)a.side=hr;this._renderObjects(t,n,r,s,"backSide");for(const{material:a}of t)a.side=Nl;this._renderObjects(e,n,r,s);for(const{material:a}of t)a.side=as}else this._renderObjects(e,n,r,s)}_renderObjects(e,t,n,r,s=null){for(let a=0,l=e.length;a0,S.isShadowNodeMaterial&&(S.side=s.shadowSide===null?s.side:s.shadowSide,s.depthNode&&s.depthNode.isNode&&(x=S.depthNode,S.depthNode=s.depthNode),s.castShadowNode&&s.castShadowNode.isNode&&(v=S.colorNode,S.colorNode=s.castShadowNode)),s=S}s.transparent===!0&&s.side===as&&s.forceSinglePass===!1?(s.side=hr,this._handleObjectFunction(e,s,t,n,l,a,u,"backSide"),s.side=Nl,this._handleObjectFunction(e,s,t,n,l,a,u,h),s.side=as):this._handleObjectFunction(e,s,t,n,l,a,u,h),g!==void 0&&(t.overrideMaterial.positionNode=g),x!==void 0&&(t.overrideMaterial.depthNode=x),v!==void 0&&(t.overrideMaterial.colorNode=v),e.onAfterRender(this,t,n,r,s,a)}_renderObjectDirect(e,t,n,r,s,a,l,u){const h=this._objects.get(e,t,n,r,s,this._currentRenderContext,l,u);h.drawRange=e.geometry.drawRange,h.group=a;const g=this._nodes.needsRefresh(h);g&&(this._nodes.updateBefore(h),this._geometries.updateForRender(h),this._nodes.updateForRender(h),this._bindings.updateForRender(h)),this._pipelines.updateForRender(h),this._currentRenderBundle!==null&&(this.backend.get(this._currentRenderBundle).renderObjects.push(h),h.bundle=this._currentRenderBundle.bundleGroup),this.backend.draw(h,this.info),g&&this._nodes.updateAfter(h)}_createObjectPipeline(e,t,n,r,s,a,l,u){const h=this._objects.get(e,t,n,r,s,this._currentRenderContext,l,u);h.drawRange=e.geometry.drawRange,h.group=a,this._nodes.updateBefore(h),this._geometries.updateForRender(h),this._nodes.updateForRender(h),this._bindings.updateForRender(h),this._pipelines.getForRender(h,this._compilationPromises),this._nodes.updateAfter(h)}get compile(){return this.compileAsync}}class zE{constructor(e=""){this.name=e,this.visibility=0}setVisibility(e){this.visibility|=e}clone(){return Object.assign(new this.constructor,this)}}function hoe(i){return i+(Lh-i%Lh)%Lh}class KB extends zE{constructor(e,t=null){super(e),this.isBuffer=!0,this.bytesPerElement=Float32Array.BYTES_PER_ELEMENT,this._buffer=t}get byteLength(){return hoe(this._buffer.byteLength)}get buffer(){return this._buffer}update(){return!0}}class ZB extends KB{constructor(e,t=null){super(e,t),this.isUniformBuffer=!0}}let foe=0;class JB extends ZB{constructor(e,t){super("UniformBuffer_"+foe++,e?e.value:null),this.nodeUniform=e,this.groupNode=t}get buffer(){return this.nodeUniform.value}}class Aoe extends ZB{constructor(e){super(e),this.isUniformsGroup=!0,this._values=null,this.uniforms=[]}addUniform(e){return this.uniforms.push(e),this}removeUniform(e){const t=this.uniforms.indexOf(e);return t!==-1&&this.uniforms.splice(t,1),this}get values(){return this._values===null&&(this._values=Array.from(this.buffer)),this._values}get buffer(){let e=this._buffer;if(e===null){const t=this.byteLength;e=new Float32Array(new ArrayBuffer(t)),this._buffer=e}return e}get byteLength(){let e=0;for(let t=0,n=this.uniforms.length;t ${h} `),n+=`${u.code} `,l===s&&t!=="compute"&&(n+=`// result - `,t==="vertex"?(n+="gl_Position = ",n+=`${u.result};`):t==="fragment"&&(l.outputNode.isOutputStructNode||(n+="fragColor = ",n+=`${u.result};`)))}const a=e[t];a.extensions=this.getExtensions(t),a.uniforms=this.getUniforms(t),a.attributes=this.getAttributes(t),a.varyings=this.getVaryings(t),a.vars=this.getVars(t),a.structs=this.getStructs(t),a.codes=this.getCodes(t),a.transforms=this.getTransforms(t),a.flow=n}this.material!==null?(this.vertexShader=this._getGLSLVertexCode(e.vertex),this.fragmentShader=this._getGLSLFragmentCode(e.fragment)):this.computeShader=this._getGLSLVertexCode(e.compute)}getUniformFromNode(e,t,n,r=null){const s=super.getUniformFromNode(e,t,n,r),a=this.getDataFromNode(e,n,this.globalCache);let l=a.uniformGPU;if(l===void 0){const u=e.groupNode,h=u.name,g=this.getBindGroupArray(h,n);if(t==="texture")l=new ex(s.name,s.node,u),g.push(l);else if(t==="cubeTexture")l=new tO(s.name,s.node,u),g.push(l);else if(t==="texture3D")l=new nO(s.name,s.node,u),g.push(l);else if(t==="buffer"){e.name=`NodeBuffer_${e.id}`,s.name=`buffer${e.id}`;const v=new JB(e,u);v.name=e.name,g.push(v),l=v}else{const v=this.uniformGroups[n]||(this.uniformGroups[n]={});let x=v[h];x===void 0&&(x=new eO(n+"_"+h,u),v[h]=x,g.push(x)),l=this.getNodeUniform(s,t),x.addUniform(l)}a.uniformGPU=l}return s}}let _S=null,Pd=null;class iO{constructor(e={}){this.parameters=Object.assign({},e),this.data=new WeakMap,this.renderer=null,this.domElement=null}async init(e){this.renderer=e}get coordinateSystem(){}beginRender(){}finishRender(){}beginCompute(){}finishCompute(){}draw(){}compute(){}createProgram(){}destroyProgram(){}createBindings(){}updateBindings(){}updateBinding(){}createRenderPipeline(){}createComputePipeline(){}needsRenderUpdate(){}getRenderCacheKey(){}createNodeBuilder(){}createSampler(){}destroySampler(){}createDefaultTexture(){}createTexture(){}updateTexture(){}generateMipmaps(){}destroyTexture(){}copyTextureToBuffer(){}copyTextureToTexture(){}copyFramebufferToTexture(){}createAttribute(){}createIndexAttribute(){}createStorageAttribute(){}updateAttribute(){}destroyAttribute(){}getContext(){}updateSize(){}updateViewport(){}isOccluded(){}async resolveTimestampAsync(){}async waitForGPU(){}async hasFeatureAsync(){}hasFeature(){}getMaxAnisotropy(){}getDrawingBufferSize(){return _S=_S||new At,this.renderer.getDrawingBufferSize(_S)}setScissorTest(){}getClearColor(){const e=this.renderer;return Pd=Pd||new xE,e.getClearColor(Pd),Pd.getRGB(Pd,this.renderer.currentColorSpace),Pd}getDomElement(){let e=this.domElement;return e===null&&(e=this.parameters.canvas!==void 0?this.parameters.canvas:I7(),"setAttribute"in e&&e.setAttribute("data-engine",`three.js r${V0} webgpu`),this.domElement=e),e}set(e,t){this.data.set(e,t)}get(e){let t=this.data.get(e);return t===void 0&&(t={},this.data.set(e,t)),t}has(e){return this.data.has(e)}delete(e){this.data.delete(e)}dispose(){}}let boe=0;class Soe{constructor(e,t){this.buffers=[e.bufferGPU,t],this.type=e.type,this.bufferType=e.bufferType,this.pbo=e.pbo,this.byteLength=e.byteLength,this.bytesPerElement=e.BYTES_PER_ELEMENT,this.version=e.version,this.isInteger=e.isInteger,this.activeBufferIndex=0,this.baseId=e.id}get id(){return`${this.baseId}|${this.activeBufferIndex}`}get bufferGPU(){return this.buffers[this.activeBufferIndex]}get transformBuffer(){return this.buffers[this.activeBufferIndex^1]}switchBuffers(){this.activeBufferIndex^=1}}class Toe{constructor(e){this.backend=e}createAttribute(e,t){const n=this.backend,{gl:r}=n,s=e.array,a=e.usage||r.STATIC_DRAW,l=e.isInterleavedBufferAttribute?e.data:e,u=n.get(l);let h=u.bufferGPU;h===void 0&&(h=this._createBuffer(r,t,s,a),u.bufferGPU=h,u.bufferType=t,u.version=l.version);let g;if(s instanceof Float32Array)g=r.FLOAT;else if(s instanceof Uint16Array)e.isFloat16BufferAttribute?g=r.HALF_FLOAT:g=r.UNSIGNED_SHORT;else if(s instanceof Int16Array)g=r.SHORT;else if(s instanceof Uint32Array)g=r.UNSIGNED_INT;else if(s instanceof Int32Array)g=r.INT;else if(s instanceof Int8Array)g=r.BYTE;else if(s instanceof Uint8Array)g=r.UNSIGNED_BYTE;else if(s instanceof Uint8ClampedArray)g=r.UNSIGNED_BYTE;else throw new Error("THREE.WebGLBackend: Unsupported buffer data format: "+s);let v={bufferGPU:h,bufferType:t,type:g,byteLength:s.byteLength,bytesPerElement:s.BYTES_PER_ELEMENT,version:e.version,pbo:e.pbo,isInteger:g===r.INT||g===r.UNSIGNED_INT||e.gpuType===Ns,id:boe++};if(e.isStorageBufferAttribute||e.isStorageInstancedBufferAttribute){const x=this._createBuffer(r,t,s,a);v=new Soe(v,x)}n.set(e,v)}updateAttribute(e){const t=this.backend,{gl:n}=t,r=e.array,s=e.isInterleavedBufferAttribute?e.data:e,a=t.get(s),l=a.bufferType,u=e.isInterleavedBufferAttribute?e.data.updateRanges:e.updateRanges;if(n.bindBuffer(l,a.bufferGPU),u.length===0)n.bufferSubData(l,0,r);else{for(let h=0,g=u.length;h1?this.enable(r.SAMPLE_ALPHA_TO_COVERAGE):this.disable(r.SAMPLE_ALPHA_TO_COVERAGE),n>0&&this.currentClippingPlanes!==n)for(let u=0;u<8;u++)u{function s(){const a=e.clientWaitSync(t,e.SYNC_FLUSH_COMMANDS_BIT,0);if(a===e.WAIT_FAILED){e.deleteSync(t),r();return}if(a===e.TIMEOUT_EXPIRED){requestAnimationFrame(s);return}e.deleteSync(t),n()}s()})}}let TN=!1,bv,xS,wN;class Eoe{constructor(e){this.backend=e,this.gl=e.gl,this.extensions=e.extensions,this.defaultTextures={},TN===!1&&(this._init(this.gl),TN=!0)}_init(e){bv={[aA]:e.REPEAT,[eu]:e.CLAMP_TO_EDGE,[oA]:e.MIRRORED_REPEAT},xS={[mr]:e.NEAREST,[s_]:e.NEAREST_MIPMAP_NEAREST,[tu]:e.NEAREST_MIPMAP_LINEAR,[gs]:e.LINEAR,[Jd]:e.LINEAR_MIPMAP_NEAREST,[Va]:e.LINEAR_MIPMAP_LINEAR},wN={[Iw]:e.NEVER,[qw]:e.ALWAYS,[my]:e.LESS,[gy]:e.LEQUAL,[Fw]:e.EQUAL,[Gw]:e.GEQUAL,[kw]:e.GREATER,[zw]:e.NOTEQUAL}}filterFallback(e){const{gl:t}=this;return e===mr||e===s_||e===tu?t.NEAREST:t.LINEAR}getGLTextureType(e){const{gl:t}=this;let n;return e.isCubeTexture===!0?n=t.TEXTURE_CUBE_MAP:e.isDataArrayTexture===!0||e.isCompressedArrayTexture===!0?n=t.TEXTURE_2D_ARRAY:e.isData3DTexture===!0?n=t.TEXTURE_3D:n=t.TEXTURE_2D,n}getInternalFormat(e,t,n,r,s=!1){const{gl:a,extensions:l}=this;if(e!==null){if(a[e]!==void 0)return a[e];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+e+"'")}let u=t;return t===a.RED&&(n===a.FLOAT&&(u=a.R32F),n===a.HALF_FLOAT&&(u=a.R16F),n===a.UNSIGNED_BYTE&&(u=a.R8),n===a.UNSIGNED_SHORT&&(u=a.R16),n===a.UNSIGNED_INT&&(u=a.R32UI),n===a.BYTE&&(u=a.R8I),n===a.SHORT&&(u=a.R16I),n===a.INT&&(u=a.R32I)),t===a.RED_INTEGER&&(n===a.UNSIGNED_BYTE&&(u=a.R8UI),n===a.UNSIGNED_SHORT&&(u=a.R16UI),n===a.UNSIGNED_INT&&(u=a.R32UI),n===a.BYTE&&(u=a.R8I),n===a.SHORT&&(u=a.R16I),n===a.INT&&(u=a.R32I)),t===a.RG&&(n===a.FLOAT&&(u=a.RG32F),n===a.HALF_FLOAT&&(u=a.RG16F),n===a.UNSIGNED_BYTE&&(u=a.RG8),n===a.UNSIGNED_SHORT&&(u=a.RG16),n===a.UNSIGNED_INT&&(u=a.RG32UI),n===a.BYTE&&(u=a.RG8I),n===a.SHORT&&(u=a.RG16I),n===a.INT&&(u=a.RG32I)),t===a.RG_INTEGER&&(n===a.UNSIGNED_BYTE&&(u=a.RG8UI),n===a.UNSIGNED_SHORT&&(u=a.RG16UI),n===a.UNSIGNED_INT&&(u=a.RG32UI),n===a.BYTE&&(u=a.RG8I),n===a.SHORT&&(u=a.RG16I),n===a.INT&&(u=a.RG32I)),t===a.RGB&&(n===a.FLOAT&&(u=a.RGB32F),n===a.HALF_FLOAT&&(u=a.RGB16F),n===a.UNSIGNED_BYTE&&(u=a.RGB8),n===a.UNSIGNED_SHORT&&(u=a.RGB16),n===a.UNSIGNED_INT&&(u=a.RGB32UI),n===a.BYTE&&(u=a.RGB8I),n===a.SHORT&&(u=a.RGB16I),n===a.INT&&(u=a.RGB32I),n===a.UNSIGNED_BYTE&&(u=r===_n&&s===!1?a.SRGB8:a.RGB8),n===a.UNSIGNED_SHORT_5_6_5&&(u=a.RGB565),n===a.UNSIGNED_SHORT_5_5_5_1&&(u=a.RGB5_A1),n===a.UNSIGNED_SHORT_4_4_4_4&&(u=a.RGB4),n===a.UNSIGNED_INT_5_9_9_9_REV&&(u=a.RGB9_E5)),t===a.RGB_INTEGER&&(n===a.UNSIGNED_BYTE&&(u=a.RGB8UI),n===a.UNSIGNED_SHORT&&(u=a.RGB16UI),n===a.UNSIGNED_INT&&(u=a.RGB32UI),n===a.BYTE&&(u=a.RGB8I),n===a.SHORT&&(u=a.RGB16I),n===a.INT&&(u=a.RGB32I)),t===a.RGBA&&(n===a.FLOAT&&(u=a.RGBA32F),n===a.HALF_FLOAT&&(u=a.RGBA16F),n===a.UNSIGNED_BYTE&&(u=a.RGBA8),n===a.UNSIGNED_SHORT&&(u=a.RGBA16),n===a.UNSIGNED_INT&&(u=a.RGBA32UI),n===a.BYTE&&(u=a.RGBA8I),n===a.SHORT&&(u=a.RGBA16I),n===a.INT&&(u=a.RGBA32I),n===a.UNSIGNED_BYTE&&(u=r===_n&&s===!1?a.SRGB8_ALPHA8:a.RGBA8),n===a.UNSIGNED_SHORT_4_4_4_4&&(u=a.RGBA4),n===a.UNSIGNED_SHORT_5_5_5_1&&(u=a.RGB5_A1)),t===a.RGBA_INTEGER&&(n===a.UNSIGNED_BYTE&&(u=a.RGBA8UI),n===a.UNSIGNED_SHORT&&(u=a.RGBA16UI),n===a.UNSIGNED_INT&&(u=a.RGBA32UI),n===a.BYTE&&(u=a.RGBA8I),n===a.SHORT&&(u=a.RGBA16I),n===a.INT&&(u=a.RGBA32I)),t===a.DEPTH_COMPONENT&&(n===a.UNSIGNED_INT&&(u=a.DEPTH24_STENCIL8),n===a.FLOAT&&(u=a.DEPTH_COMPONENT32F)),t===a.DEPTH_STENCIL&&n===a.UNSIGNED_INT_24_8&&(u=a.DEPTH24_STENCIL8),(u===a.R16F||u===a.R32F||u===a.RG16F||u===a.RG32F||u===a.RGBA16F||u===a.RGBA32F)&&l.get("EXT_color_buffer_float"),u}setTextureParameters(e,t){const{gl:n,extensions:r,backend:s}=this;n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,t.flipY),n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.premultiplyAlpha),n.pixelStorei(n.UNPACK_ALIGNMENT,t.unpackAlignment),n.pixelStorei(n.UNPACK_COLORSPACE_CONVERSION_WEBGL,n.NONE),n.texParameteri(e,n.TEXTURE_WRAP_S,bv[t.wrapS]),n.texParameteri(e,n.TEXTURE_WRAP_T,bv[t.wrapT]),(e===n.TEXTURE_3D||e===n.TEXTURE_2D_ARRAY)&&n.texParameteri(e,n.TEXTURE_WRAP_R,bv[t.wrapR]),n.texParameteri(e,n.TEXTURE_MAG_FILTER,xS[t.magFilter]);const a=t.mipmaps!==void 0&&t.mipmaps.length>0,l=t.minFilter===gs&&a?Va:t.minFilter;if(n.texParameteri(e,n.TEXTURE_MIN_FILTER,xS[l]),t.compareFunction&&(n.texParameteri(e,n.TEXTURE_COMPARE_MODE,n.COMPARE_REF_TO_TEXTURE),n.texParameteri(e,n.TEXTURE_COMPARE_FUNC,wN[t.compareFunction])),r.has("EXT_texture_filter_anisotropic")===!0){if(t.magFilter===mr||t.minFilter!==tu&&t.minFilter!==Va||t.type===$r&&r.has("OES_texture_float_linear")===!1)return;if(t.anisotropy>1){const u=r.get("EXT_texture_filter_anisotropic");n.texParameterf(e,u.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(t.anisotropy,s.getMaxAnisotropy()))}}}createDefaultTexture(e){const{gl:t,backend:n,defaultTextures:r}=this,s=this.getGLTextureType(e);let a=r[s];a===void 0&&(a=t.createTexture(),n.state.bindTexture(s,a),t.texParameteri(s,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(s,t.TEXTURE_MAG_FILTER,t.NEAREST),r[s]=a),n.set(e,{textureGPU:a,glTextureType:s,isDefault:!0})}createTexture(e,t){const{gl:n,backend:r}=this,{levels:s,width:a,height:l,depth:u}=t,h=r.utils.convert(e.format,e.colorSpace),g=r.utils.convert(e.type),v=this.getInternalFormat(e.internalFormat,h,g,e.colorSpace,e.isVideoTexture),x=n.createTexture(),S=this.getGLTextureType(e);r.state.bindTexture(S,x),this.setTextureParameters(S,e),e.isDataArrayTexture||e.isCompressedArrayTexture?n.texStorage3D(n.TEXTURE_2D_ARRAY,s,v,a,l,u):e.isData3DTexture?n.texStorage3D(n.TEXTURE_3D,s,v,a,l,u):e.isVideoTexture||n.texStorage2D(S,s,v,a,l),r.set(e,{textureGPU:x,glTextureType:S,glFormat:h,glType:g,glInternalFormat:v})}copyBufferToTexture(e,t){const{gl:n,backend:r}=this,{textureGPU:s,glTextureType:a,glFormat:l,glType:u}=r.get(t),{width:h,height:g}=t.source.data;n.bindBuffer(n.PIXEL_UNPACK_BUFFER,e),r.state.bindTexture(a,s),n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,!1),n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),n.texSubImage2D(a,0,0,0,h,g,l,u,0),n.bindBuffer(n.PIXEL_UNPACK_BUFFER,null),r.state.unbindTexture()}updateTexture(e,t){const{gl:n}=this,{width:r,height:s}=t,{textureGPU:a,glTextureType:l,glFormat:u,glType:h,glInternalFormat:g}=this.backend.get(e);if(e.isRenderTargetTexture||a===void 0)return;const v=x=>x.isDataTexture?x.image.data:typeof HTMLImageElement<"u"&&x instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&x instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&x instanceof ImageBitmap||x instanceof OffscreenCanvas?x:x.data;if(this.backend.state.bindTexture(l,a),this.setTextureParameters(l,e),e.isCompressedTexture){const x=e.mipmaps,S=t.image;for(let w=0;w0,x=t.renderTarget?t.renderTarget.height:this.backend.getDrawingBufferSize().y;if(v){const S=l!==0||u!==0;let w,R;if(e.isDepthTexture===!0?(w=r.DEPTH_BUFFER_BIT,R=r.DEPTH_ATTACHMENT,t.stencil&&(w|=r.STENCIL_BUFFER_BIT)):(w=r.COLOR_BUFFER_BIT,R=r.COLOR_ATTACHMENT0),S){const C=this.backend.get(t.renderTarget),E=C.framebuffers[t.getCacheKey()],B=C.msaaFrameBuffer;s.bindFramebuffer(r.DRAW_FRAMEBUFFER,E),s.bindFramebuffer(r.READ_FRAMEBUFFER,B);const L=x-u-g;r.blitFramebuffer(l,L,l+h,L+g,l,L,l+h,L+g,w,r.NEAREST),s.bindFramebuffer(r.READ_FRAMEBUFFER,E),s.bindTexture(r.TEXTURE_2D,a),r.copyTexSubImage2D(r.TEXTURE_2D,0,0,0,l,L,h,g),s.unbindTexture()}else{const C=r.createFramebuffer();s.bindFramebuffer(r.DRAW_FRAMEBUFFER,C),r.framebufferTexture2D(r.DRAW_FRAMEBUFFER,R,r.TEXTURE_2D,a,0),r.blitFramebuffer(0,0,h,g,0,0,h,g,w,r.NEAREST),r.deleteFramebuffer(C)}}else s.bindTexture(r.TEXTURE_2D,a),r.copyTexSubImage2D(r.TEXTURE_2D,0,0,0,l,x-g-u,h,g),s.unbindTexture();e.generateMipmaps&&this.generateMipmaps(e),this.backend._setFramebuffer(t)}setupRenderBufferStorage(e,t){const{gl:n}=this,r=t.renderTarget,{samples:s,depthTexture:a,depthBuffer:l,stencilBuffer:u,width:h,height:g}=r;if(n.bindRenderbuffer(n.RENDERBUFFER,e),l&&!u){let v=n.DEPTH_COMPONENT24;s>0?(a&&a.isDepthTexture&&a.type===n.FLOAT&&(v=n.DEPTH_COMPONENT32F),n.renderbufferStorageMultisample(n.RENDERBUFFER,s,v,h,g)):n.renderbufferStorage(n.RENDERBUFFER,v,h,g),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.RENDERBUFFER,e)}else l&&u&&(s>0?n.renderbufferStorageMultisample(n.RENDERBUFFER,s,n.DEPTH24_STENCIL8,h,g):n.renderbufferStorage(n.RENDERBUFFER,n.DEPTH_STENCIL,h,g),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_STENCIL_ATTACHMENT,n.RENDERBUFFER,e))}async copyTextureToBuffer(e,t,n,r,s,a){const{backend:l,gl:u}=this,{textureGPU:h,glFormat:g,glType:v}=this.backend.get(e),x=u.createFramebuffer();u.bindFramebuffer(u.READ_FRAMEBUFFER,x);const S=e.isCubeTexture?u.TEXTURE_CUBE_MAP_POSITIVE_X+a:u.TEXTURE_2D;u.framebufferTexture2D(u.READ_FRAMEBUFFER,u.COLOR_ATTACHMENT0,S,h,0);const w=this._getTypedArrayType(v),R=this._getBytesPerTexel(v,g),E=r*s*R,B=u.createBuffer();u.bindBuffer(u.PIXEL_PACK_BUFFER,B),u.bufferData(u.PIXEL_PACK_BUFFER,E,u.STREAM_READ),u.readPixels(t,n,r,s,g,v,0),u.bindBuffer(u.PIXEL_PACK_BUFFER,null),await l.utils._clientWaitAsync();const L=new w(E/w.BYTES_PER_ELEMENT);return u.bindBuffer(u.PIXEL_PACK_BUFFER,B),u.getBufferSubData(u.PIXEL_PACK_BUFFER,0,L),u.bindBuffer(u.PIXEL_PACK_BUFFER,null),u.deleteFramebuffer(x),L}_getTypedArrayType(e){const{gl:t}=this;if(e===t.UNSIGNED_BYTE)return Uint8Array;if(e===t.UNSIGNED_SHORT_4_4_4_4||e===t.UNSIGNED_SHORT_5_5_5_1||e===t.UNSIGNED_SHORT_5_6_5||e===t.UNSIGNED_SHORT)return Uint16Array;if(e===t.UNSIGNED_INT)return Uint32Array;if(e===t.HALF_FLOAT)return Uint16Array;if(e===t.FLOAT)return Float32Array;throw new Error(`Unsupported WebGL type: ${e}`)}_getBytesPerTexel(e,t){const{gl:n}=this;let r=0;if(e===n.UNSIGNED_BYTE&&(r=1),(e===n.UNSIGNED_SHORT_4_4_4_4||e===n.UNSIGNED_SHORT_5_5_5_1||e===n.UNSIGNED_SHORT_5_6_5||e===n.UNSIGNED_SHORT||e===n.HALF_FLOAT)&&(r=2),(e===n.UNSIGNED_INT||e===n.FLOAT)&&(r=4),t===n.RGBA)return r*4;if(t===n.RGB)return r*3;if(t===n.ALPHA)return r}}class Coe{constructor(e){this.backend=e,this.gl=this.backend.gl,this.availableExtensions=this.gl.getSupportedExtensions(),this.extensions={}}get(e){let t=this.extensions[e];return t===void 0&&(t=this.gl.getExtension(e),this.extensions[e]=t),t}has(e){return this.availableExtensions.includes(e)}}class Roe{constructor(e){this.backend=e,this.maxAnisotropy=null}getMaxAnisotropy(){if(this.maxAnisotropy!==null)return this.maxAnisotropy;const e=this.backend.gl,t=this.backend.extensions;if(t.has("EXT_texture_filter_anisotropic")===!0){const n=t.get("EXT_texture_filter_anisotropic");this.maxAnisotropy=e.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else this.maxAnisotropy=0;return this.maxAnisotropy}}const MN={WEBGL_multi_draw:"WEBGL_multi_draw",WEBGL_compressed_texture_astc:"texture-compression-astc",WEBGL_compressed_texture_etc:"texture-compression-etc2",WEBGL_compressed_texture_etc1:"texture-compression-etc1",WEBGL_compressed_texture_pvrtc:"texture-compression-pvrtc",WEBKIT_WEBGL_compressed_texture_pvrtc:"texture-compression-pvrtc",WEBGL_compressed_texture_s3tc:"texture-compression-bc",EXT_texture_compression_bptc:"texture-compression-bptc",EXT_disjoint_timer_query_webgl2:"timestamp-query"};class Noe{constructor(e){this.gl=e.gl,this.extensions=e.extensions,this.info=e.renderer.info,this.mode=null,this.index=0,this.type=null,this.object=null}render(e,t){const{gl:n,mode:r,object:s,type:a,info:l,index:u}=this;u!==0?n.drawElements(r,t,a,e):n.drawArrays(r,e,t),l.update(s,t,r,1)}renderInstances(e,t,n){const{gl:r,mode:s,type:a,index:l,object:u,info:h}=this;n!==0&&(l!==0?r.drawElementsInstanced(s,t,a,e,n):r.drawArraysInstanced(s,e,t,n),h.update(u,t,s,n))}renderMultiDraw(e,t,n){const{extensions:r,mode:s,object:a,info:l}=this;if(n===0)return;const u=r.get("WEBGL_multi_draw");if(u===null)for(let h=0;h0)){const n=t.queryQueue.shift();this.initTimestampQuery(n)}}async resolveTimestampAsync(e,t="render"){if(!this.disjoint||!this.trackTimestamp)return;const n=this.get(e);n.gpuQueries||(n.gpuQueries=[]);for(let r=0;r0&&(n.currentOcclusionQueries=n.occlusionQueries,n.currentOcclusionQueryObjects=n.occlusionQueryObjects,n.lastOcclusionObject=null,n.occlusionQueries=new Array(r),n.occlusionQueryObjects=new Array(r),n.occlusionQueryIndex=0)}finishRender(e){const{gl:t,state:n}=this,r=this.get(e),s=r.previousContext,a=e.occlusionQueryCount;a>0&&(a>r.occlusionQueryIndex&&t.endQuery(t.ANY_SAMPLES_PASSED),this.resolveOccludedAsync(e));const l=e.textures;if(l!==null)for(let u=0;u0){const g=u.framebuffers[e.getCacheKey()],v=t.COLOR_BUFFER_BIT,x=u.msaaFrameBuffer,S=e.textures;n.bindFramebuffer(t.READ_FRAMEBUFFER,x),n.bindFramebuffer(t.DRAW_FRAMEBUFFER,g);for(let w=0;w{let u=0;for(let h=0;h0&&s.add(r[h]),n[h]=null,a.deleteQuery(g),u++)}u1?E.renderInstances(O,B,L):E.render(O,B),u.bindVertexArray(null)}needsRenderUpdate(){return!1}getRenderCacheKey(){return""}createDefaultTexture(e){this.textureUtils.createDefaultTexture(e)}createTexture(e,t){this.textureUtils.createTexture(e,t)}updateTexture(e,t){this.textureUtils.updateTexture(e,t)}generateMipmaps(e){this.textureUtils.generateMipmaps(e)}destroyTexture(e){this.textureUtils.destroyTexture(e)}copyTextureToBuffer(e,t,n,r,s,a){return this.textureUtils.copyTextureToBuffer(e,t,n,r,s,a)}createSampler(){}destroySampler(){}createNodeBuilder(e,t){return new xoe(e,t)}createProgram(e){const t=this.gl,{stage:n,code:r}=e,s=n==="fragment"?t.createShader(t.FRAGMENT_SHADER):t.createShader(t.VERTEX_SHADER);t.shaderSource(s,r),t.compileShader(s),this.set(e,{shaderGPU:s})}destroyProgram(e){this.delete(e)}createRenderPipeline(e,t){const n=this.gl,r=e.pipeline,{fragmentProgram:s,vertexProgram:a}=r,l=n.createProgram(),u=this.get(s).shaderGPU,h=this.get(a).shaderGPU;if(n.attachShader(l,u),n.attachShader(l,h),n.linkProgram(l),this.set(r,{programGPU:l,fragmentShader:u,vertexShader:h}),t!==null&&this.parallel){const g=new Promise(v=>{const x=this.parallel,S=()=>{n.getProgramParameter(l,x.COMPLETION_STATUS_KHR)?(this._completeCompile(e,r),v()):requestAnimationFrame(S)};S()});t.push(g);return}this._completeCompile(e,r)}_handleSource(e,t){const n=e.split(` + `,t==="vertex"?(n+="gl_Position = ",n+=`${u.result};`):t==="fragment"&&(l.outputNode.isOutputStructNode||(n+="fragColor = ",n+=`${u.result};`)))}const a=e[t];a.extensions=this.getExtensions(t),a.uniforms=this.getUniforms(t),a.attributes=this.getAttributes(t),a.varyings=this.getVaryings(t),a.vars=this.getVars(t),a.structs=this.getStructs(t),a.codes=this.getCodes(t),a.transforms=this.getTransforms(t),a.flow=n}this.material!==null?(this.vertexShader=this._getGLSLVertexCode(e.vertex),this.fragmentShader=this._getGLSLFragmentCode(e.fragment)):this.computeShader=this._getGLSLVertexCode(e.compute)}getUniformFromNode(e,t,n,r=null){const s=super.getUniformFromNode(e,t,n,r),a=this.getDataFromNode(e,n,this.globalCache);let l=a.uniformGPU;if(l===void 0){const u=e.groupNode,h=u.name,g=this.getBindGroupArray(h,n);if(t==="texture")l=new ex(s.name,s.node,u),g.push(l);else if(t==="cubeTexture")l=new tO(s.name,s.node,u),g.push(l);else if(t==="texture3D")l=new nO(s.name,s.node,u),g.push(l);else if(t==="buffer"){e.name=`NodeBuffer_${e.id}`,s.name=`buffer${e.id}`;const v=new JB(e,u);v.name=e.name,g.push(v),l=v}else{const v=this.uniformGroups[n]||(this.uniformGroups[n]={});let x=v[h];x===void 0&&(x=new eO(n+"_"+h,u),v[h]=x,g.push(x)),l=this.getNodeUniform(s,t),x.addUniform(l)}a.uniformGPU=l}return s}}let _S=null,Pd=null;class iO{constructor(e={}){this.parameters=Object.assign({},e),this.data=new WeakMap,this.renderer=null,this.domElement=null}async init(e){this.renderer=e}get coordinateSystem(){}beginRender(){}finishRender(){}beginCompute(){}finishCompute(){}draw(){}compute(){}createProgram(){}destroyProgram(){}createBindings(){}updateBindings(){}updateBinding(){}createRenderPipeline(){}createComputePipeline(){}needsRenderUpdate(){}getRenderCacheKey(){}createNodeBuilder(){}createSampler(){}destroySampler(){}createDefaultTexture(){}createTexture(){}updateTexture(){}generateMipmaps(){}destroyTexture(){}copyTextureToBuffer(){}copyTextureToTexture(){}copyFramebufferToTexture(){}createAttribute(){}createIndexAttribute(){}createStorageAttribute(){}updateAttribute(){}destroyAttribute(){}getContext(){}updateSize(){}updateViewport(){}isOccluded(){}async resolveTimestampAsync(){}async waitForGPU(){}async hasFeatureAsync(){}hasFeature(){}getMaxAnisotropy(){}getDrawingBufferSize(){return _S=_S||new dt,this.renderer.getDrawingBufferSize(_S)}setScissorTest(){}getClearColor(){const e=this.renderer;return Pd=Pd||new xE,e.getClearColor(Pd),Pd.getRGB(Pd,this.renderer.currentColorSpace),Pd}getDomElement(){let e=this.domElement;return e===null&&(e=this.parameters.canvas!==void 0?this.parameters.canvas:I7(),"setAttribute"in e&&e.setAttribute("data-engine",`three.js r${V0} webgpu`),this.domElement=e),e}set(e,t){this.data.set(e,t)}get(e){let t=this.data.get(e);return t===void 0&&(t={},this.data.set(e,t)),t}has(e){return this.data.has(e)}delete(e){this.data.delete(e)}dispose(){}}let boe=0;class Soe{constructor(e,t){this.buffers=[e.bufferGPU,t],this.type=e.type,this.bufferType=e.bufferType,this.pbo=e.pbo,this.byteLength=e.byteLength,this.bytesPerElement=e.BYTES_PER_ELEMENT,this.version=e.version,this.isInteger=e.isInteger,this.activeBufferIndex=0,this.baseId=e.id}get id(){return`${this.baseId}|${this.activeBufferIndex}`}get bufferGPU(){return this.buffers[this.activeBufferIndex]}get transformBuffer(){return this.buffers[this.activeBufferIndex^1]}switchBuffers(){this.activeBufferIndex^=1}}class Toe{constructor(e){this.backend=e}createAttribute(e,t){const n=this.backend,{gl:r}=n,s=e.array,a=e.usage||r.STATIC_DRAW,l=e.isInterleavedBufferAttribute?e.data:e,u=n.get(l);let h=u.bufferGPU;h===void 0&&(h=this._createBuffer(r,t,s,a),u.bufferGPU=h,u.bufferType=t,u.version=l.version);let g;if(s instanceof Float32Array)g=r.FLOAT;else if(s instanceof Uint16Array)e.isFloat16BufferAttribute?g=r.HALF_FLOAT:g=r.UNSIGNED_SHORT;else if(s instanceof Int16Array)g=r.SHORT;else if(s instanceof Uint32Array)g=r.UNSIGNED_INT;else if(s instanceof Int32Array)g=r.INT;else if(s instanceof Int8Array)g=r.BYTE;else if(s instanceof Uint8Array)g=r.UNSIGNED_BYTE;else if(s instanceof Uint8ClampedArray)g=r.UNSIGNED_BYTE;else throw new Error("THREE.WebGLBackend: Unsupported buffer data format: "+s);let v={bufferGPU:h,bufferType:t,type:g,byteLength:s.byteLength,bytesPerElement:s.BYTES_PER_ELEMENT,version:e.version,pbo:e.pbo,isInteger:g===r.INT||g===r.UNSIGNED_INT||e.gpuType===Ns,id:boe++};if(e.isStorageBufferAttribute||e.isStorageInstancedBufferAttribute){const x=this._createBuffer(r,t,s,a);v=new Soe(v,x)}n.set(e,v)}updateAttribute(e){const t=this.backend,{gl:n}=t,r=e.array,s=e.isInterleavedBufferAttribute?e.data:e,a=t.get(s),l=a.bufferType,u=e.isInterleavedBufferAttribute?e.data.updateRanges:e.updateRanges;if(n.bindBuffer(l,a.bufferGPU),u.length===0)n.bufferSubData(l,0,r);else{for(let h=0,g=u.length;h1?this.enable(r.SAMPLE_ALPHA_TO_COVERAGE):this.disable(r.SAMPLE_ALPHA_TO_COVERAGE),n>0&&this.currentClippingPlanes!==n)for(let u=0;u<8;u++)u{function s(){const a=e.clientWaitSync(t,e.SYNC_FLUSH_COMMANDS_BIT,0);if(a===e.WAIT_FAILED){e.deleteSync(t),r();return}if(a===e.TIMEOUT_EXPIRED){requestAnimationFrame(s);return}e.deleteSync(t),n()}s()})}}let TN=!1,bv,xS,wN;class Eoe{constructor(e){this.backend=e,this.gl=e.gl,this.extensions=e.extensions,this.defaultTextures={},TN===!1&&(this._init(this.gl),TN=!0)}_init(e){bv={[aA]:e.REPEAT,[eu]:e.CLAMP_TO_EDGE,[oA]:e.MIRRORED_REPEAT},xS={[mr]:e.NEAREST,[s_]:e.NEAREST_MIPMAP_NEAREST,[tu]:e.NEAREST_MIPMAP_LINEAR,[gs]:e.LINEAR,[Jd]:e.LINEAR_MIPMAP_NEAREST,[Va]:e.LINEAR_MIPMAP_LINEAR},wN={[Iw]:e.NEVER,[qw]:e.ALWAYS,[my]:e.LESS,[gy]:e.LEQUAL,[Fw]:e.EQUAL,[Gw]:e.GEQUAL,[kw]:e.GREATER,[zw]:e.NOTEQUAL}}filterFallback(e){const{gl:t}=this;return e===mr||e===s_||e===tu?t.NEAREST:t.LINEAR}getGLTextureType(e){const{gl:t}=this;let n;return e.isCubeTexture===!0?n=t.TEXTURE_CUBE_MAP:e.isDataArrayTexture===!0||e.isCompressedArrayTexture===!0?n=t.TEXTURE_2D_ARRAY:e.isData3DTexture===!0?n=t.TEXTURE_3D:n=t.TEXTURE_2D,n}getInternalFormat(e,t,n,r,s=!1){const{gl:a,extensions:l}=this;if(e!==null){if(a[e]!==void 0)return a[e];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+e+"'")}let u=t;return t===a.RED&&(n===a.FLOAT&&(u=a.R32F),n===a.HALF_FLOAT&&(u=a.R16F),n===a.UNSIGNED_BYTE&&(u=a.R8),n===a.UNSIGNED_SHORT&&(u=a.R16),n===a.UNSIGNED_INT&&(u=a.R32UI),n===a.BYTE&&(u=a.R8I),n===a.SHORT&&(u=a.R16I),n===a.INT&&(u=a.R32I)),t===a.RED_INTEGER&&(n===a.UNSIGNED_BYTE&&(u=a.R8UI),n===a.UNSIGNED_SHORT&&(u=a.R16UI),n===a.UNSIGNED_INT&&(u=a.R32UI),n===a.BYTE&&(u=a.R8I),n===a.SHORT&&(u=a.R16I),n===a.INT&&(u=a.R32I)),t===a.RG&&(n===a.FLOAT&&(u=a.RG32F),n===a.HALF_FLOAT&&(u=a.RG16F),n===a.UNSIGNED_BYTE&&(u=a.RG8),n===a.UNSIGNED_SHORT&&(u=a.RG16),n===a.UNSIGNED_INT&&(u=a.RG32UI),n===a.BYTE&&(u=a.RG8I),n===a.SHORT&&(u=a.RG16I),n===a.INT&&(u=a.RG32I)),t===a.RG_INTEGER&&(n===a.UNSIGNED_BYTE&&(u=a.RG8UI),n===a.UNSIGNED_SHORT&&(u=a.RG16UI),n===a.UNSIGNED_INT&&(u=a.RG32UI),n===a.BYTE&&(u=a.RG8I),n===a.SHORT&&(u=a.RG16I),n===a.INT&&(u=a.RG32I)),t===a.RGB&&(n===a.FLOAT&&(u=a.RGB32F),n===a.HALF_FLOAT&&(u=a.RGB16F),n===a.UNSIGNED_BYTE&&(u=a.RGB8),n===a.UNSIGNED_SHORT&&(u=a.RGB16),n===a.UNSIGNED_INT&&(u=a.RGB32UI),n===a.BYTE&&(u=a.RGB8I),n===a.SHORT&&(u=a.RGB16I),n===a.INT&&(u=a.RGB32I),n===a.UNSIGNED_BYTE&&(u=r===_n&&s===!1?a.SRGB8:a.RGB8),n===a.UNSIGNED_SHORT_5_6_5&&(u=a.RGB565),n===a.UNSIGNED_SHORT_5_5_5_1&&(u=a.RGB5_A1),n===a.UNSIGNED_SHORT_4_4_4_4&&(u=a.RGB4),n===a.UNSIGNED_INT_5_9_9_9_REV&&(u=a.RGB9_E5)),t===a.RGB_INTEGER&&(n===a.UNSIGNED_BYTE&&(u=a.RGB8UI),n===a.UNSIGNED_SHORT&&(u=a.RGB16UI),n===a.UNSIGNED_INT&&(u=a.RGB32UI),n===a.BYTE&&(u=a.RGB8I),n===a.SHORT&&(u=a.RGB16I),n===a.INT&&(u=a.RGB32I)),t===a.RGBA&&(n===a.FLOAT&&(u=a.RGBA32F),n===a.HALF_FLOAT&&(u=a.RGBA16F),n===a.UNSIGNED_BYTE&&(u=a.RGBA8),n===a.UNSIGNED_SHORT&&(u=a.RGBA16),n===a.UNSIGNED_INT&&(u=a.RGBA32UI),n===a.BYTE&&(u=a.RGBA8I),n===a.SHORT&&(u=a.RGBA16I),n===a.INT&&(u=a.RGBA32I),n===a.UNSIGNED_BYTE&&(u=r===_n&&s===!1?a.SRGB8_ALPHA8:a.RGBA8),n===a.UNSIGNED_SHORT_4_4_4_4&&(u=a.RGBA4),n===a.UNSIGNED_SHORT_5_5_5_1&&(u=a.RGB5_A1)),t===a.RGBA_INTEGER&&(n===a.UNSIGNED_BYTE&&(u=a.RGBA8UI),n===a.UNSIGNED_SHORT&&(u=a.RGBA16UI),n===a.UNSIGNED_INT&&(u=a.RGBA32UI),n===a.BYTE&&(u=a.RGBA8I),n===a.SHORT&&(u=a.RGBA16I),n===a.INT&&(u=a.RGBA32I)),t===a.DEPTH_COMPONENT&&(n===a.UNSIGNED_INT&&(u=a.DEPTH24_STENCIL8),n===a.FLOAT&&(u=a.DEPTH_COMPONENT32F)),t===a.DEPTH_STENCIL&&n===a.UNSIGNED_INT_24_8&&(u=a.DEPTH24_STENCIL8),(u===a.R16F||u===a.R32F||u===a.RG16F||u===a.RG32F||u===a.RGBA16F||u===a.RGBA32F)&&l.get("EXT_color_buffer_float"),u}setTextureParameters(e,t){const{gl:n,extensions:r,backend:s}=this;n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,t.flipY),n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.premultiplyAlpha),n.pixelStorei(n.UNPACK_ALIGNMENT,t.unpackAlignment),n.pixelStorei(n.UNPACK_COLORSPACE_CONVERSION_WEBGL,n.NONE),n.texParameteri(e,n.TEXTURE_WRAP_S,bv[t.wrapS]),n.texParameteri(e,n.TEXTURE_WRAP_T,bv[t.wrapT]),(e===n.TEXTURE_3D||e===n.TEXTURE_2D_ARRAY)&&n.texParameteri(e,n.TEXTURE_WRAP_R,bv[t.wrapR]),n.texParameteri(e,n.TEXTURE_MAG_FILTER,xS[t.magFilter]);const a=t.mipmaps!==void 0&&t.mipmaps.length>0,l=t.minFilter===gs&&a?Va:t.minFilter;if(n.texParameteri(e,n.TEXTURE_MIN_FILTER,xS[l]),t.compareFunction&&(n.texParameteri(e,n.TEXTURE_COMPARE_MODE,n.COMPARE_REF_TO_TEXTURE),n.texParameteri(e,n.TEXTURE_COMPARE_FUNC,wN[t.compareFunction])),r.has("EXT_texture_filter_anisotropic")===!0){if(t.magFilter===mr||t.minFilter!==tu&&t.minFilter!==Va||t.type===$r&&r.has("OES_texture_float_linear")===!1)return;if(t.anisotropy>1){const u=r.get("EXT_texture_filter_anisotropic");n.texParameterf(e,u.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(t.anisotropy,s.getMaxAnisotropy()))}}}createDefaultTexture(e){const{gl:t,backend:n,defaultTextures:r}=this,s=this.getGLTextureType(e);let a=r[s];a===void 0&&(a=t.createTexture(),n.state.bindTexture(s,a),t.texParameteri(s,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(s,t.TEXTURE_MAG_FILTER,t.NEAREST),r[s]=a),n.set(e,{textureGPU:a,glTextureType:s,isDefault:!0})}createTexture(e,t){const{gl:n,backend:r}=this,{levels:s,width:a,height:l,depth:u}=t,h=r.utils.convert(e.format,e.colorSpace),g=r.utils.convert(e.type),v=this.getInternalFormat(e.internalFormat,h,g,e.colorSpace,e.isVideoTexture),x=n.createTexture(),S=this.getGLTextureType(e);r.state.bindTexture(S,x),this.setTextureParameters(S,e),e.isDataArrayTexture||e.isCompressedArrayTexture?n.texStorage3D(n.TEXTURE_2D_ARRAY,s,v,a,l,u):e.isData3DTexture?n.texStorage3D(n.TEXTURE_3D,s,v,a,l,u):e.isVideoTexture||n.texStorage2D(S,s,v,a,l),r.set(e,{textureGPU:x,glTextureType:S,glFormat:h,glType:g,glInternalFormat:v})}copyBufferToTexture(e,t){const{gl:n,backend:r}=this,{textureGPU:s,glTextureType:a,glFormat:l,glType:u}=r.get(t),{width:h,height:g}=t.source.data;n.bindBuffer(n.PIXEL_UNPACK_BUFFER,e),r.state.bindTexture(a,s),n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,!1),n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),n.texSubImage2D(a,0,0,0,h,g,l,u,0),n.bindBuffer(n.PIXEL_UNPACK_BUFFER,null),r.state.unbindTexture()}updateTexture(e,t){const{gl:n}=this,{width:r,height:s}=t,{textureGPU:a,glTextureType:l,glFormat:u,glType:h,glInternalFormat:g}=this.backend.get(e);if(e.isRenderTargetTexture||a===void 0)return;const v=x=>x.isDataTexture?x.image.data:typeof HTMLImageElement<"u"&&x instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&x instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&x instanceof ImageBitmap||x instanceof OffscreenCanvas?x:x.data;if(this.backend.state.bindTexture(l,a),this.setTextureParameters(l,e),e.isCompressedTexture){const x=e.mipmaps,S=t.image;for(let w=0;w0,x=t.renderTarget?t.renderTarget.height:this.backend.getDrawingBufferSize().y;if(v){const S=l!==0||u!==0;let w,R;if(e.isDepthTexture===!0?(w=r.DEPTH_BUFFER_BIT,R=r.DEPTH_ATTACHMENT,t.stencil&&(w|=r.STENCIL_BUFFER_BIT)):(w=r.COLOR_BUFFER_BIT,R=r.COLOR_ATTACHMENT0),S){const C=this.backend.get(t.renderTarget),E=C.framebuffers[t.getCacheKey()],B=C.msaaFrameBuffer;s.bindFramebuffer(r.DRAW_FRAMEBUFFER,E),s.bindFramebuffer(r.READ_FRAMEBUFFER,B);const L=x-u-g;r.blitFramebuffer(l,L,l+h,L+g,l,L,l+h,L+g,w,r.NEAREST),s.bindFramebuffer(r.READ_FRAMEBUFFER,E),s.bindTexture(r.TEXTURE_2D,a),r.copyTexSubImage2D(r.TEXTURE_2D,0,0,0,l,L,h,g),s.unbindTexture()}else{const C=r.createFramebuffer();s.bindFramebuffer(r.DRAW_FRAMEBUFFER,C),r.framebufferTexture2D(r.DRAW_FRAMEBUFFER,R,r.TEXTURE_2D,a,0),r.blitFramebuffer(0,0,h,g,0,0,h,g,w,r.NEAREST),r.deleteFramebuffer(C)}}else s.bindTexture(r.TEXTURE_2D,a),r.copyTexSubImage2D(r.TEXTURE_2D,0,0,0,l,x-g-u,h,g),s.unbindTexture();e.generateMipmaps&&this.generateMipmaps(e),this.backend._setFramebuffer(t)}setupRenderBufferStorage(e,t){const{gl:n}=this,r=t.renderTarget,{samples:s,depthTexture:a,depthBuffer:l,stencilBuffer:u,width:h,height:g}=r;if(n.bindRenderbuffer(n.RENDERBUFFER,e),l&&!u){let v=n.DEPTH_COMPONENT24;s>0?(a&&a.isDepthTexture&&a.type===n.FLOAT&&(v=n.DEPTH_COMPONENT32F),n.renderbufferStorageMultisample(n.RENDERBUFFER,s,v,h,g)):n.renderbufferStorage(n.RENDERBUFFER,v,h,g),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.RENDERBUFFER,e)}else l&&u&&(s>0?n.renderbufferStorageMultisample(n.RENDERBUFFER,s,n.DEPTH24_STENCIL8,h,g):n.renderbufferStorage(n.RENDERBUFFER,n.DEPTH_STENCIL,h,g),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_STENCIL_ATTACHMENT,n.RENDERBUFFER,e))}async copyTextureToBuffer(e,t,n,r,s,a){const{backend:l,gl:u}=this,{textureGPU:h,glFormat:g,glType:v}=this.backend.get(e),x=u.createFramebuffer();u.bindFramebuffer(u.READ_FRAMEBUFFER,x);const S=e.isCubeTexture?u.TEXTURE_CUBE_MAP_POSITIVE_X+a:u.TEXTURE_2D;u.framebufferTexture2D(u.READ_FRAMEBUFFER,u.COLOR_ATTACHMENT0,S,h,0);const w=this._getTypedArrayType(v),R=this._getBytesPerTexel(v,g),E=r*s*R,B=u.createBuffer();u.bindBuffer(u.PIXEL_PACK_BUFFER,B),u.bufferData(u.PIXEL_PACK_BUFFER,E,u.STREAM_READ),u.readPixels(t,n,r,s,g,v,0),u.bindBuffer(u.PIXEL_PACK_BUFFER,null),await l.utils._clientWaitAsync();const L=new w(E/w.BYTES_PER_ELEMENT);return u.bindBuffer(u.PIXEL_PACK_BUFFER,B),u.getBufferSubData(u.PIXEL_PACK_BUFFER,0,L),u.bindBuffer(u.PIXEL_PACK_BUFFER,null),u.deleteFramebuffer(x),L}_getTypedArrayType(e){const{gl:t}=this;if(e===t.UNSIGNED_BYTE)return Uint8Array;if(e===t.UNSIGNED_SHORT_4_4_4_4||e===t.UNSIGNED_SHORT_5_5_5_1||e===t.UNSIGNED_SHORT_5_6_5||e===t.UNSIGNED_SHORT)return Uint16Array;if(e===t.UNSIGNED_INT)return Uint32Array;if(e===t.HALF_FLOAT)return Uint16Array;if(e===t.FLOAT)return Float32Array;throw new Error(`Unsupported WebGL type: ${e}`)}_getBytesPerTexel(e,t){const{gl:n}=this;let r=0;if(e===n.UNSIGNED_BYTE&&(r=1),(e===n.UNSIGNED_SHORT_4_4_4_4||e===n.UNSIGNED_SHORT_5_5_5_1||e===n.UNSIGNED_SHORT_5_6_5||e===n.UNSIGNED_SHORT||e===n.HALF_FLOAT)&&(r=2),(e===n.UNSIGNED_INT||e===n.FLOAT)&&(r=4),t===n.RGBA)return r*4;if(t===n.RGB)return r*3;if(t===n.ALPHA)return r}}class Coe{constructor(e){this.backend=e,this.gl=this.backend.gl,this.availableExtensions=this.gl.getSupportedExtensions(),this.extensions={}}get(e){let t=this.extensions[e];return t===void 0&&(t=this.gl.getExtension(e),this.extensions[e]=t),t}has(e){return this.availableExtensions.includes(e)}}class Roe{constructor(e){this.backend=e,this.maxAnisotropy=null}getMaxAnisotropy(){if(this.maxAnisotropy!==null)return this.maxAnisotropy;const e=this.backend.gl,t=this.backend.extensions;if(t.has("EXT_texture_filter_anisotropic")===!0){const n=t.get("EXT_texture_filter_anisotropic");this.maxAnisotropy=e.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else this.maxAnisotropy=0;return this.maxAnisotropy}}const MN={WEBGL_multi_draw:"WEBGL_multi_draw",WEBGL_compressed_texture_astc:"texture-compression-astc",WEBGL_compressed_texture_etc:"texture-compression-etc2",WEBGL_compressed_texture_etc1:"texture-compression-etc1",WEBGL_compressed_texture_pvrtc:"texture-compression-pvrtc",WEBKIT_WEBGL_compressed_texture_pvrtc:"texture-compression-pvrtc",WEBGL_compressed_texture_s3tc:"texture-compression-bc",EXT_texture_compression_bptc:"texture-compression-bptc",EXT_disjoint_timer_query_webgl2:"timestamp-query"};class Noe{constructor(e){this.gl=e.gl,this.extensions=e.extensions,this.info=e.renderer.info,this.mode=null,this.index=0,this.type=null,this.object=null}render(e,t){const{gl:n,mode:r,object:s,type:a,info:l,index:u}=this;u!==0?n.drawElements(r,t,a,e):n.drawArrays(r,e,t),l.update(s,t,r,1)}renderInstances(e,t,n){const{gl:r,mode:s,type:a,index:l,object:u,info:h}=this;n!==0&&(l!==0?r.drawElementsInstanced(s,t,a,e,n):r.drawArraysInstanced(s,e,t,n),h.update(u,t,s,n))}renderMultiDraw(e,t,n){const{extensions:r,mode:s,object:a,info:l}=this;if(n===0)return;const u=r.get("WEBGL_multi_draw");if(u===null)for(let h=0;h0)){const n=t.queryQueue.shift();this.initTimestampQuery(n)}}async resolveTimestampAsync(e,t="render"){if(!this.disjoint||!this.trackTimestamp)return;const n=this.get(e);n.gpuQueries||(n.gpuQueries=[]);for(let r=0;r0&&(n.currentOcclusionQueries=n.occlusionQueries,n.currentOcclusionQueryObjects=n.occlusionQueryObjects,n.lastOcclusionObject=null,n.occlusionQueries=new Array(r),n.occlusionQueryObjects=new Array(r),n.occlusionQueryIndex=0)}finishRender(e){const{gl:t,state:n}=this,r=this.get(e),s=r.previousContext,a=e.occlusionQueryCount;a>0&&(a>r.occlusionQueryIndex&&t.endQuery(t.ANY_SAMPLES_PASSED),this.resolveOccludedAsync(e));const l=e.textures;if(l!==null)for(let u=0;u0){const g=u.framebuffers[e.getCacheKey()],v=t.COLOR_BUFFER_BIT,x=u.msaaFrameBuffer,S=e.textures;n.bindFramebuffer(t.READ_FRAMEBUFFER,x),n.bindFramebuffer(t.DRAW_FRAMEBUFFER,g);for(let w=0;w{let u=0;for(let h=0;h0&&s.add(r[h]),n[h]=null,a.deleteQuery(g),u++)}u1?E.renderInstances(O,B,L):E.render(O,B),u.bindVertexArray(null)}needsRenderUpdate(){return!1}getRenderCacheKey(){return""}createDefaultTexture(e){this.textureUtils.createDefaultTexture(e)}createTexture(e,t){this.textureUtils.createTexture(e,t)}updateTexture(e,t){this.textureUtils.updateTexture(e,t)}generateMipmaps(e){this.textureUtils.generateMipmaps(e)}destroyTexture(e){this.textureUtils.destroyTexture(e)}copyTextureToBuffer(e,t,n,r,s,a){return this.textureUtils.copyTextureToBuffer(e,t,n,r,s,a)}createSampler(){}destroySampler(){}createNodeBuilder(e,t){return new xoe(e,t)}createProgram(e){const t=this.gl,{stage:n,code:r}=e,s=n==="fragment"?t.createShader(t.FRAGMENT_SHADER):t.createShader(t.VERTEX_SHADER);t.shaderSource(s,r),t.compileShader(s),this.set(e,{shaderGPU:s})}destroyProgram(e){this.delete(e)}createRenderPipeline(e,t){const n=this.gl,r=e.pipeline,{fragmentProgram:s,vertexProgram:a}=r,l=n.createProgram(),u=this.get(s).shaderGPU,h=this.get(a).shaderGPU;if(n.attachShader(l,u),n.attachShader(l,h),n.linkProgram(l),this.set(r,{programGPU:l,fragmentShader:u,vertexShader:h}),t!==null&&this.parallel){const g=new Promise(v=>{const x=this.parallel,S=()=>{n.getProgramParameter(l,x.COMPLETION_STATUS_KHR)?(this._completeCompile(e,r),v()):requestAnimationFrame(S)};S()});t.push(g);return}this._completeCompile(e,r)}_handleSource(e,t){const n=e.split(` `),r=[],s=Math.max(t-6,0),a=Math.min(t+6,n.length);for(let l=s;l":" "} ${u}: ${n[l]}`)}return r.join(` `)}_getShaderErrors(e,t,n){const r=e.getShaderParameter(t,e.COMPILE_STATUS),s=e.getShaderInfoLog(t).trim();if(r&&s==="")return"";const a=/ERROR: 0:(\d+)/.exec(s);if(a){const l=parseInt(a[1]);return n.toUpperCase()+` @@ -4263,7 +4263,7 @@ var<${n}> ${e} : ${a};`}}class Qoe{constructor(e){this.backend=e}getCurrentDepth * @license * Copyright 2010-2024 Three.js Authors * SPDX-License-Identifier: MIT - */j.BRDF_GGX;j.BRDF_Lambert;j.BasicShadowFilter;j.Break;j.Continue;j.DFGApprox;j.D_GGX;j.Discard;j.EPSILON;j.F_Schlick;const ale=j.Fn;j.INFINITY;const ole=j.If,lle=j.Loop;j.NodeShaderStage;j.NodeType;j.NodeUpdateType;j.NodeAccess;j.PCFShadowFilter;j.PCFSoftShadowFilter;j.PI;j.PI2;j.Return;j.Schlick_to_F0;j.ScriptableNodeResources;j.ShaderNode;j.TBNViewMatrix;j.VSMShadowFilter;j.V_GGX_SmithCorrelated;j.abs;j.acesFilmicToneMapping;j.acos;j.add;j.addNodeElement;j.agxToneMapping;j.all;j.alphaT;j.and;j.anisotropy;j.anisotropyB;j.anisotropyT;j.any;j.append;j.arrayBuffer;const ule=j.asin;j.assign;j.atan;j.atan2;j.atomicAdd;j.atomicAnd;j.atomicFunc;j.atomicMax;j.atomicMin;j.atomicOr;j.atomicStore;j.atomicSub;j.atomicXor;j.attenuationColor;j.attenuationDistance;j.attribute;j.attributeArray;j.backgroundBlurriness;j.backgroundIntensity;j.backgroundRotation;j.batch;j.billboarding;j.bitAnd;j.bitNot;j.bitOr;j.bitXor;j.bitangentGeometry;j.bitangentLocal;j.bitangentView;j.bitangentWorld;j.bitcast;j.blendBurn;j.blendColor;j.blendDodge;j.blendOverlay;j.blendScreen;j.blur;j.bool;j.buffer;j.bufferAttribute;j.bumpMap;j.burn;j.bvec2;j.bvec3;j.bvec4;j.bypass;j.cache;j.call;j.cameraFar;j.cameraNear;j.cameraNormalMatrix;j.cameraPosition;j.cameraProjectionMatrix;j.cameraProjectionMatrixInverse;j.cameraViewMatrix;j.cameraWorldMatrix;j.cbrt;j.cdl;j.ceil;j.checker;j.cineonToneMapping;j.clamp;j.clearcoat;j.clearcoatRoughness;j.code;j.color;j.colorSpaceToWorking;j.colorToDirection;j.compute;j.cond;j.context;j.convert;j.convertColorSpace;j.convertToTexture;const cle=j.cos;j.cross;j.cubeTexture;j.dFdx;j.dFdy;j.dashSize;j.defaultBuildStages;j.defaultShaderStages;j.defined;j.degrees;j.deltaTime;j.densityFog;j.densityFogFactor;j.depth;j.depthPass;j.difference;j.diffuseColor;j.directPointLight;j.directionToColor;j.dispersion;j.distance;j.div;j.dodge;j.dot;j.drawIndex;j.dynamicBufferAttribute;j.element;j.emissive;j.equal;j.equals;j.equirectUV;const hle=j.exp;j.exp2;j.expression;j.faceDirection;j.faceForward;j.faceforward;const fle=j.float;j.floor;j.fog;j.fract;j.frameGroup;j.frameId;j.frontFacing;j.fwidth;j.gain;j.gapSize;j.getConstNodeType;j.getCurrentStack;j.getDirection;j.getDistanceAttenuation;j.getGeometryRoughness;j.getNormalFromDepth;j.getParallaxCorrectNormal;j.getRoughness;j.getScreenPosition;j.getShIrradianceAt;j.getTextureIndex;j.getViewPosition;j.glsl;j.glslFn;j.grayscale;j.greaterThan;j.greaterThanEqual;j.hash;j.highpModelNormalViewMatrix;j.highpModelViewMatrix;j.hue;j.instance;const Ale=j.instanceIndex;j.instancedArray;j.instancedBufferAttribute;j.instancedDynamicBufferAttribute;j.instancedMesh;j.int;j.inverseSqrt;j.inversesqrt;j.invocationLocalIndex;j.invocationSubgroupIndex;j.ior;j.iridescence;j.iridescenceIOR;j.iridescenceThickness;j.ivec2;j.ivec3;j.ivec4;j.js;j.label;j.length;j.lengthSq;j.lessThan;j.lessThanEqual;j.lightPosition;j.lightTargetDirection;j.lightTargetPosition;j.lightViewPosition;j.lightingContext;j.lights;j.linearDepth;j.linearToneMapping;j.localId;j.log;j.log2;j.logarithmicDepthToViewZ;j.loop;j.luminance;j.mediumpModelViewMatrix;j.mat2;j.mat3;j.mat4;j.matcapUV;j.materialAO;j.materialAlphaTest;j.materialAnisotropy;j.materialAnisotropyVector;j.materialAttenuationColor;j.materialAttenuationDistance;j.materialClearcoat;j.materialClearcoatNormal;j.materialClearcoatRoughness;j.materialColor;j.materialDispersion;j.materialEmissive;j.materialIOR;j.materialIridescence;j.materialIridescenceIOR;j.materialIridescenceThickness;j.materialLightMap;j.materialLineDashOffset;j.materialLineDashSize;j.materialLineGapSize;j.materialLineScale;j.materialLineWidth;j.materialMetalness;j.materialNormal;j.materialOpacity;j.materialPointWidth;j.materialReference;j.materialReflectivity;j.materialRefractionRatio;j.materialRotation;j.materialRoughness;j.materialSheen;j.materialSheenRoughness;j.materialShininess;j.materialSpecular;j.materialSpecularColor;j.materialSpecularIntensity;j.materialSpecularStrength;j.materialThickness;j.materialTransmission;j.max;j.maxMipLevel;j.metalness;j.min;j.mix;j.mixElement;j.mod;j.modInt;j.modelDirection;j.modelNormalMatrix;j.modelPosition;j.modelScale;j.modelViewMatrix;j.modelViewPosition;j.modelViewProjection;j.modelWorldMatrix;j.modelWorldMatrixInverse;j.morphReference;j.mrt;j.mul;j.mx_aastep;j.mx_cell_noise_float;j.mx_contrast;j.mx_fractal_noise_float;j.mx_fractal_noise_vec2;j.mx_fractal_noise_vec3;j.mx_fractal_noise_vec4;j.mx_hsvtorgb;j.mx_noise_float;j.mx_noise_vec3;j.mx_noise_vec4;j.mx_ramplr;j.mx_ramptb;j.mx_rgbtohsv;j.mx_safepower;j.mx_splitlr;j.mx_splittb;j.mx_srgb_texture_to_lin_rec709;j.mx_transform_uv;j.mx_worley_noise_float;j.mx_worley_noise_vec2;j.mx_worley_noise_vec3;const dle=j.negate;j.neutralToneMapping;j.nodeArray;j.nodeImmutable;j.nodeObject;j.nodeObjects;j.nodeProxy;j.normalFlat;j.normalGeometry;j.normalLocal;j.normalMap;j.normalView;j.normalWorld;j.normalize;j.not;j.notEqual;j.numWorkgroups;j.objectDirection;j.objectGroup;j.objectPosition;j.objectScale;j.objectViewPosition;j.objectWorldMatrix;j.oneMinus;j.or;j.orthographicDepthToViewZ;j.oscSawtooth;j.oscSine;j.oscSquare;j.oscTriangle;j.output;j.outputStruct;j.overlay;j.overloadingFn;j.parabola;j.parallaxDirection;j.parallaxUV;j.parameter;j.pass;j.passTexture;j.pcurve;j.perspectiveDepthToViewZ;j.pmremTexture;j.pointUV;j.pointWidth;j.positionGeometry;j.positionLocal;j.positionPrevious;j.positionView;j.positionViewDirection;j.positionWorld;j.positionWorldDirection;j.posterize;j.pow;j.pow2;j.pow3;j.pow4;j.property;j.radians;j.rand;j.range;j.rangeFog;j.rangeFogFactor;j.reciprocal;j.reference;j.referenceBuffer;j.reflect;j.reflectVector;j.reflectView;j.reflector;j.refract;j.refractVector;j.refractView;j.reinhardToneMapping;j.remainder;j.remap;j.remapClamp;j.renderGroup;j.renderOutput;j.rendererReference;j.rotate;j.rotateUV;j.roughness;j.round;j.rtt;j.sRGBTransferEOTF;j.sRGBTransferOETF;j.sampler;j.saturate;j.saturation;j.screen;j.screenCoordinate;j.screenSize;j.screenUV;j.scriptable;j.scriptableValue;j.select;j.setCurrentStack;j.shaderStages;j.shadow;j.shadowPositionWorld;j.sharedUniformGroup;j.sheen;j.sheenRoughness;j.shiftLeft;j.shiftRight;j.shininess;j.sign;const ple=j.sin;j.sinc;j.skinning;j.skinningReference;j.smoothstep;j.smoothstepElement;j.specularColor;j.specularF90;j.spherizeUV;j.split;j.spritesheetUV;const mle=j.sqrt;j.stack;j.step;const gle=j.storage;j.storageBarrier;j.storageObject;j.storageTexture;j.string;j.sub;j.subgroupIndex;j.subgroupSize;j.tan;j.tangentGeometry;j.tangentLocal;j.tangentView;j.tangentWorld;j.temp;j.texture;j.texture3D;j.textureBarrier;j.textureBicubic;j.textureCubeUV;j.textureLoad;j.textureSize;j.textureStore;j.thickness;j.threshold;j.time;j.timerDelta;j.timerGlobal;j.timerLocal;j.toOutputColorSpace;j.toWorkingColorSpace;j.toneMapping;j.toneMappingExposure;j.toonOutlinePass;j.transformDirection;j.transformNormal;j.transformNormalToView;j.transformedBentNormalView;j.transformedBitangentView;j.transformedBitangentWorld;j.transformedClearcoatNormalView;j.transformedNormalView;j.transformedNormalWorld;j.transformedTangentView;j.transformedTangentWorld;j.transmission;j.transpose;j.tri;j.tri3;j.triNoise3D;j.triplanarTexture;j.triplanarTextures;j.trunc;j.tslFn;j.uint;const vle=j.uniform;j.uniformArray;j.uniformGroup;j.uniforms;j.userData;j.uv;j.uvec2;j.uvec3;j.uvec4;j.varying;j.varyingProperty;j.vec2;j.vec3;j.vec4;j.vectorComponents;j.velocity;j.vertexColor;j.vertexIndex;j.vibrance;j.viewZToLogarithmicDepth;j.viewZToOrthographicDepth;j.viewZToPerspectiveDepth;j.viewport;j.viewportBottomLeft;j.viewportCoordinate;j.viewportDepthTexture;j.viewportLinearDepth;j.viewportMipTexture;j.viewportResolution;j.viewportSafeUV;j.viewportSharedTexture;j.viewportSize;j.viewportTexture;j.viewportTopLeft;j.viewportUV;j.wgsl;j.wgslFn;j.workgroupArray;j.workgroupBarrier;j.workgroupId;j.workingToColorSpace;j.xor;const UN=new Gc,wv=new ce;class aO extends Wz{constructor(){super(),this.isLineSegmentsGeometry=!0,this.type="LineSegmentsGeometry";const e=[-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],t=[-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],n=[0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5];this.setIndex(n),this.setAttribute("position",new wi(e,3)),this.setAttribute("uv",new wi(t,2))}applyMatrix4(e){const t=this.attributes.instanceStart,n=this.attributes.instanceEnd;return t!==void 0&&(t.applyMatrix4(e),n.applyMatrix4(e),t.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}setPositions(e){let t;e instanceof Float32Array?t=e:Array.isArray(e)&&(t=new Float32Array(e));const n=new h_(t,6,1);return this.setAttribute("instanceStart",new nu(n,3,0)),this.setAttribute("instanceEnd",new nu(n,3,3)),this.instanceCount=this.attributes.instanceStart.count,this.computeBoundingBox(),this.computeBoundingSphere(),this}setColors(e){let t;e instanceof Float32Array?t=e:Array.isArray(e)&&(t=new Float32Array(e));const n=new h_(t,6,1);return this.setAttribute("instanceColorStart",new nu(n,3,0)),this.setAttribute("instanceColorEnd",new nu(n,3,3)),this}fromWireframeGeometry(e){return this.setPositions(e.attributes.position.array),this}fromEdgesGeometry(e){return this.setPositions(e.attributes.position.array),this}fromMesh(e){return this.fromWireframeGeometry(new Mz(e.geometry)),this}fromLineSegments(e){const t=e.geometry;return this.setPositions(t.attributes.position.array),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Gc);const e=this.attributes.instanceStart,t=this.attributes.instanceEnd;e!==void 0&&t!==void 0&&(this.boundingBox.setFromBufferAttribute(e),UN.setFromBufferAttribute(t),this.boundingBox.union(UN))}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new dA),this.boundingBox===null&&this.computeBoundingBox();const e=this.attributes.instanceStart,t=this.attributes.instanceEnd;if(e!==void 0&&t!==void 0){const n=this.boundingSphere.center;this.boundingBox.getCenter(n);let r=0;for(let s=0,a=e.count;s #include #include @@ -4760,7 +4760,7 @@ varying vec3 vPos; gl_Position = projectionMatrix * modelViewMatrix * vec4(pos, 1.0); } `),` - `),e},jE=function(e,t){return e.onBeforeCompile=function(n){e.userData.shader=t(n)},e},Yle=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:function(r){return r};if(e.userData.shader)t(e.userData.shader.uniforms);else{var n=e.onBeforeCompile;e.onBeforeCompile=function(r){n(r),t(r.uniforms)}}},Qle=["stroke"],yl=window.THREE?window.THREE:{BufferGeometry:Ki,CubicBezierCurve3:$7,Curve:Pl,Group:ja,Line:xy,Mesh:zi,NormalBlending:Ka,ShaderMaterial:Ja,TubeGeometry:tM,Vector3:ce},Kle=L0.default||L0,mO=xs({props:{arcsData:{default:[]},arcStartLat:{default:"startLat"},arcStartLng:{default:"startLng"},arcStartAltitude:{default:0},arcEndLat:{default:"endLat"},arcEndLng:{default:"endLng"},arcEndAltitude:{default:0},arcColor:{default:function(){return"#ffffaa"}},arcAltitude:{},arcAltitudeAutoScale:{default:.5},arcStroke:{},arcCurveResolution:{default:64,triggerUpdate:!1},arcCircularResolution:{default:6,triggerUpdate:!1},arcDashLength:{default:1},arcDashGap:{default:0},arcDashInitialGap:{default:0},arcDashAnimateTime:{default:0},arcsTransitionDuration:{default:1e3,triggerUpdate:!1}},methods:{pauseAnimation:function(e){var t;(t=e.ticker)===null||t===void 0||t.pause()},resumeAnimation:function(e){var t;(t=e.ticker)===null||t===void 0||t.resume()},_destructor:function(e){var t;e.sharedMaterial.dispose(),(t=e.ticker)===null||t===void 0||t.dispose()}},stateInit:function(e){var t=e.tweenGroup;return{tweenGroup:t,ticker:new Kle,sharedMaterial:new yl.ShaderMaterial(Hi(Hi({},pO()),{},{transparent:!0,blending:yl.NormalBlending}))}},init:function(e,t){nr(e),t.scene=e,t.dataMapper=new ao(e,{objBindAttr:"__threeObjArc"}).onCreateObj(function(){var n=new yl.Group;return n.__globeObjType="arc",n}),t.ticker.onTick.add(function(n,r){t.dataMapper.entries().map(function(s){var a=gr(s,2),l=a[1];return l}).filter(function(s){return s.children.length&&s.children[0].material&&s.children[0].__dashAnimateStep}).forEach(function(s){var a=s.children[0],l=a.__dashAnimateStep*r,u=a.material.uniforms.dashTranslate.value%1e9;a.material.uniforms.dashTranslate.value=u+l})})},update:function(e){var t=Ct(e.arcStartLat),n=Ct(e.arcStartLng),r=Ct(e.arcStartAltitude),s=Ct(e.arcEndLat),a=Ct(e.arcEndLng),l=Ct(e.arcEndAltitude),u=Ct(e.arcAltitude),h=Ct(e.arcAltitudeAutoScale),g=Ct(e.arcStroke),v=Ct(e.arcColor),x=Ct(e.arcDashLength),S=Ct(e.arcDashGap),w=Ct(e.arcDashInitialGap),R=Ct(e.arcDashAnimateTime);e.dataMapper.onUpdateObj(function(L,O){var z=g(O),G=z!=null;if(!L.children.length||G!==(L.children[0].type==="Mesh")){nr(L);var k=G?new yl.Mesh:new yl.Line(new yl.BufferGeometry);k.material=e.sharedMaterial.clone(),L.add(k)}var H=L.children[0];Object.assign(H.material.uniforms,{dashSize:{value:x(O)},gapSize:{value:S(O)},dashOffset:{value:w(O)}});var F=R(O);H.__dashAnimateStep=F>0?1e3/F:0;var V=E(v(O),e.arcCurveResolution,G?e.arcCircularResolution+1:1),X=B(e.arcCurveResolution,G?e.arcCircularResolution+1:1,!0);H.geometry.setAttribute("color",V),H.geometry.setAttribute("relDistance",X);var J=function(Z){var ue=L.__currentTargetD=Z,he=ue.stroke,be=Ole(ue,Qle),Se=C(be);G?(H.geometry&&H.geometry.dispose(),H.geometry=new yl.TubeGeometry(Se,e.arcCurveResolution,he/2,e.arcCircularResolution),H.geometry.setAttribute("color",V),H.geometry.setAttribute("relDistance",X)):H.geometry.setFromPoints(Se.getPoints(e.arcCurveResolution))},te={stroke:z,alt:u(O),altAutoScale:+h(O),startLat:+t(O),startLng:+n(O),startAlt:+r(O),endLat:+s(O),endLng:+a(O),endAlt:+l(O)},se=L.__currentTargetD||Object.assign({},te,{altAutoScale:-.001});Object.keys(te).some(function(ne){return se[ne]!==te[ne]})&&(!e.arcsTransitionDuration||e.arcsTransitionDuration<0?J(te):e.tweenGroup.add(new ca(se).to(te,e.arcsTransitionDuration).easing(os.Quadratic.InOut).onUpdate(J).start()))}).digest(e.arcsData);function C(L){var O=L.alt,z=L.altAutoScale,G=L.startLat,k=L.startLng,H=L.startAlt,F=L.endLat,V=L.endLng,X=L.endAlt,J=function(_e){var De=gr(_e,3),dt=De[0],vt=De[1],Tt=De[2],Ge=el(vt,dt,Tt),Be=Ge.x,ke=Ge.y,oe=Ge.z;return new yl.Vector3(Be,ke,oe)},te=[k,G],se=[V,F],ne=O;if(ne==null&&(ne=Vh(te,se)/2*z+Math.max(H,X)),ne||H||X){var Z=dM(te,se),ue=function(_e,De){return De+(De-_e)*(_e2&&arguments[2]!==void 0?arguments[2]:1,G=O+1,k;if(L instanceof Array||L instanceof Function){var H=L instanceof Array?Pc().domain(L.map(function(ne,Z){return Z/(L.length-1)})).range(L):L;k=function(Z){return jh(H(Z),!0,!0)}}else{var F=jh(L,!0,!0);k=function(){return F}}for(var V=[],X=0,J=G;X1&&arguments[1]!==void 0?arguments[1]:1,z=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,G=L+1,k=[],H=0,F=G;H=H?z:G}),4)),O})):new wh.BufferGeometry,w=new wh.MeshLambertMaterial({color:16777215,transparent:!0,vertexColors:!0,side:wh.DoubleSide});w.onBeforeCompile=function(B){w.userData.shader=ow(B)};var R=new wh.Mesh(S,w);R.__globeObjType="hexBinPoints",R.__data=v,e.dataMapper.clear(),nr(e.scene),e.scene.add(R)}function C(B){var L=new wh.Mesh;L.__hexCenter=CP(B.h3Idx),L.__hexGeoJson=RP(B.h3Idx,!0).reverse();var O=L.__hexCenter[1];return L.__hexGeoJson.forEach(function(z){var G=z[0];Math.abs(O-G)>170&&(z[0]+=O>G?360:-360)}),L.__globeObjType="hexbin",L}function E(B,L){var O=function(ue,he,be){return ue-(ue-he)*be},z=Math.max(0,Math.min(1,+h(L))),G=gr(B.__hexCenter,2),k=G[0],H=G[1],F=z===0?B.__hexGeoJson:B.__hexGeoJson.map(function(Z){var ue=gr(Z,2),he=ue[0],be=ue[1];return[[he,H],[be,k]].map(function(Se){var le=gr(Se,2),we=le[0],We=le[1];return O(we,We,z)})}),V=e.hexTopCurvatureResolution;B.geometry&&B.geometry.dispose(),B.geometry=new TM([F],0,cr,!1,!0,!0,V);var X={alt:+a(L)},J=function(ue){var he=B.__currentTargetD=ue,be=he.alt;B.scale.x=B.scale.y=B.scale.z=1+be;var Se=cr/(be+1);B.geometry.setAttribute("surfaceRadius",Mu(Array(B.geometry.getAttribute("position").count).fill(Se),1))},te=B.__currentTargetD||Object.assign({},X,{alt:-.001});if(Object.keys(X).some(function(Z){return te[Z]!==X[Z]})&&(e.hexBinMerge||!e.hexTransitionDuration||e.hexTransitionDuration<0?J(X):e.tweenGroup.add(new ca(te).to(X,e.hexTransitionDuration).easing(os.Quadratic.InOut).onUpdate(J).start())),!e.hexBinMerge){var se=u(L),ne=l(L);[se,ne].forEach(function(Z){if(!x.hasOwnProperty(Z)){var ue=Rl(Z);x[Z]=jE(new wh.MeshLambertMaterial({color:wu(Z),transparent:ue<1,opacity:ue,side:wh.DoubleSide}),ow)}}),B.material=[se,ne].map(function(Z){return x[Z]})}}}}),vO=function(e){return e*e},wc=function(e){return e*Math.PI/180};function Zle(i,e){var t=Math.sqrt,n=Math.cos,r=function(g){return vO(Math.sin(g/2))},s=wc(i[1]),a=wc(e[1]),l=wc(i[0]),u=wc(e[0]);return 2*Math.asin(t(r(a-s)+n(s)*n(a)*r(u-l)))}var Jle=Math.sqrt(2*Math.PI);function eue(i,e){return Math.exp(-vO(i/e)/2)/(e*Jle)}var tue=function(e){var t=gr(e,2),n=t[0],r=t[1],s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},l=a.lngAccessor,u=l===void 0?function(C){return C[0]}:l,h=a.latAccessor,g=h===void 0?function(C){return C[1]}:h,v=a.weightAccessor,x=v===void 0?function(){return 1}:v,S=a.bandwidth,w=[n,r],R=S*Math.PI/180;return XW(s.map(function(C){var E=x(C);if(!E)return 0;var B=Zle(w,[u(C),g(C)]);return eue(B,R)*E}))},nue=(function(){var i=Rle(sw().m(function e(t){var n,r,s,a,l,u,h,g,v,x,S,w,R,C,E,B,L,O,z,G,k,H,F,V,X,J,te,se,ne,Z,ue,he,be,Se,le,we,We,Te,ze,_e,De=arguments,dt,vt,Tt;return sw().w(function(Ge){for(;;)switch(Ge.n){case 0:if(r=De.length>1&&De[1]!==void 0?De[1]:[],s=De.length>2&&De[2]!==void 0?De[2]:{},a=s.lngAccessor,l=a===void 0?function(Be){return Be[0]}:a,u=s.latAccessor,h=u===void 0?function(Be){return Be[1]}:u,g=s.weightAccessor,v=g===void 0?function(){return 1}:g,x=s.bandwidth,(n=navigator)!==null&&n!==void 0&&n.gpu){Ge.n=1;break}return console.warn("WebGPU not enabled in browser. Please consider enabling it to improve performance."),Ge.a(2,t.map(function(Be){return tue(Be,r,{lngAccessor:l,latAccessor:h,weightAccessor:v,bandwidth:x})}));case 1:return S=4,w=ale,R=ole,C=vle,E=gle,B=fle,L=Ale,O=lle,z=mle,G=ple,k=cle,H=ule,F=hle,V=dle,X=E(new t_(new Float32Array(t.flat().map(wc)),2),"vec2",t.length),J=E(new t_(new Float32Array(r.map(function(Be){return[wc(l(Be)),wc(h(Be)),v(Be)]}).flat()),3),"vec3",r.length),te=new t_(t.length,1),se=E(te,"float",t.length),ne=B(Math.PI),Z=z(ne.mul(2)),ue=function(ke){return ke.mul(ke)},he=function(ke){return ue(G(ke.div(2)))},be=function(ke,oe){var Mt=B(ke[1]),lt=B(oe[1]),Dt=B(ke[0]),wt=B(oe[0]);return B(2).mul(H(z(he(lt.sub(Mt)).add(k(Mt).mul(k(lt)).mul(he(wt.sub(Dt)))))))},Se=function(ke,oe){return F(V(ue(ke.div(oe)).div(2))).div(oe.mul(Z))},le=C(wc(x)),we=C(wc(x*S)),We=C(r.length),Te=w(function(){var Be=X.element(L),ke=se.element(L);ke.assign(0),O(We,function(oe){var Mt=oe.i,lt=J.element(Mt),Dt=lt.z;R(Dt,function(){var wt=be(lt.xy,Be.xy);R(wt&&wt.lessThan(we),function(){ke.addAssign(Se(wt,le).mul(Dt))})})})}),ze=Te().compute(t.length),_e=new sO,Ge.n=2,_e.computeAsync(ze);case 2:return dt=Array,vt=Float32Array,Ge.n=3,_e.getArrayBufferAsync(te);case 3:return Tt=Ge.v,Ge.a(2,dt.from.call(dt,new vt(Tt)))}},e)}));return function(t){return i.apply(this,arguments)}})(),Nv=window.THREE?window.THREE:{Mesh:zi,MeshLambertMaterial:Vc,SphereGeometry:Eu},iue=3.5,rue=.1,XN=100,sue=function(e){var t=cA(FZ(e));return t.opacity=Math.cbrt(e),t.formatRgb()},_O=xs({props:{heatmapsData:{default:[]},heatmapPoints:{default:function(e){return e}},heatmapPointLat:{default:function(e){return e[0]}},heatmapPointLng:{default:function(e){return e[1]}},heatmapPointWeight:{default:1},heatmapBandwidth:{default:2.5},heatmapColorFn:{default:function(){return sue}},heatmapColorSaturation:{default:1.5},heatmapBaseAltitude:{default:.01},heatmapTopAltitude:{},heatmapsTransitionDuration:{default:0,triggerUpdate:!1}},init:function(e,t,n){var r=n.tweenGroup;nr(e),t.scene=e,t.tweenGroup=r,t.dataMapper=new ao(e,{objBindAttr:"__threeObjHeatmap"}).onCreateObj(function(){var s=new Nv.Mesh(new Nv.SphereGeometry(cr),jE(new Nv.MeshLambertMaterial({vertexColors:!0,transparent:!0}),Xle));return s.__globeObjType="heatmap",s})},update:function(e){var t=Ct(e.heatmapPoints),n=Ct(e.heatmapPointLat),r=Ct(e.heatmapPointLng),s=Ct(e.heatmapPointWeight),a=Ct(e.heatmapBandwidth),l=Ct(e.heatmapColorFn),u=Ct(e.heatmapColorSaturation),h=Ct(e.heatmapBaseAltitude),g=Ct(e.heatmapTopAltitude);e.dataMapper.onUpdateObj(function(v,x){var S=a(x),w=l(x),R=u(x),C=h(x),E=g(x),B=t(x).map(function(k){var H=n(k),F=r(k),V=el(H,F),X=V.x,J=V.y,te=V.z;return{x:X,y:J,z:te,lat:H,lng:F,weight:s(k)}}),L=Math.max(rue,S/iue),O=Math.ceil(360/(L||-1));v.geometry.parameters.widthSegments!==O&&(v.geometry.dispose(),v.geometry=new Nv.SphereGeometry(cr,O,O/2));var z=$le(v.geometry.getAttribute("position")),G=z.map(function(k){var H=gr(k,3),F=H[0],V=H[1],X=H[2],J=fO({x:F,y:V,z:X}),te=J.lng,se=J.lat;return[te,se]});nue(G,B,{latAccessor:function(H){return H.lat},lngAccessor:function(H){return H.lng},weightAccessor:function(H){return H.weight},bandwidth:S}).then(function(k){var H=Qi(new Array(XN)).map(function(J,te){return jh(w(te/(XN-1)))}),F=function(te){var se=v.__currentTargetD=te,ne=se.kdeVals,Z=se.topAlt,ue=se.saturation,he=jW(ne.map(Math.abs))||1e-15,be=RD([0,he/ue],H);v.geometry.setAttribute("color",Mu(ne.map(function(le){return be(Math.abs(le))}),4));var Se=Pc([0,he],[cr*(1+C),cr*(1+(Z||C))]);v.geometry.setAttribute("r",Mu(ne.map(Se)))},V={kdeVals:k,topAlt:E,saturation:R},X=v.__currentTargetD||Object.assign({},V,{kdeVals:k.map(function(){return 0}),topAlt:E&&C,saturation:.5});X.kdeVals.length!==k.length&&(X.kdeVals=k.slice()),Object.keys(V).some(function(J){return X[J]!==V[J]})&&(!e.heatmapsTransitionDuration||e.heatmapsTransitionDuration<0?F(V):e.tweenGroup.add(new ca(X).to(V,e.heatmapsTransitionDuration).easing(os.Quadratic.InOut).onUpdate(F).start()))})}).digest(e.heatmapsData)}}),Mh=window.THREE?window.THREE:{DoubleSide:as,Group:ja,LineBasicMaterial:$0,LineSegments:H7,Mesh:zi,MeshBasicMaterial:pA},yO=xs({props:{polygonsData:{default:[]},polygonGeoJsonGeometry:{default:"geometry"},polygonSideColor:{default:function(){return"#ffffaa"}},polygonSideMaterial:{},polygonCapColor:{default:function(){return"#ffffaa"}},polygonCapMaterial:{},polygonStrokeColor:{},polygonAltitude:{default:.01},polygonCapCurvatureResolution:{default:5},polygonsTransitionDuration:{default:1e3,triggerUpdate:!1}},init:function(e,t,n){var r=n.tweenGroup;nr(e),t.scene=e,t.tweenGroup=r,t.dataMapper=new ao(e,{objBindAttr:"__threeObjPolygon"}).id(function(s){return s.id}).onCreateObj(function(){var s=new Mh.Group;return s.__defaultSideMaterial=jE(new Mh.MeshBasicMaterial({side:Mh.DoubleSide,depthWrite:!0}),ow),s.__defaultCapMaterial=new Mh.MeshBasicMaterial({side:Mh.DoubleSide,depthWrite:!0}),s.add(new Mh.Mesh(void 0,[s.__defaultSideMaterial,s.__defaultCapMaterial])),s.add(new Mh.LineSegments(void 0,new Mh.LineBasicMaterial)),s.__globeObjType="polygon",s})},update:function(e){var t=Ct(e.polygonGeoJsonGeometry),n=Ct(e.polygonAltitude),r=Ct(e.polygonCapCurvatureResolution),s=Ct(e.polygonCapColor),a=Ct(e.polygonCapMaterial),l=Ct(e.polygonSideColor),u=Ct(e.polygonSideMaterial),h=Ct(e.polygonStrokeColor),g=[];e.polygonsData.forEach(function(v){var x={data:v,capColor:s(v),capMaterial:a(v),sideColor:l(v),sideMaterial:u(v),strokeColor:h(v),altitude:+n(v),capCurvatureResolution:+r(v)},S=t(v),w=v.__id||"".concat(Math.round(Math.random()*1e9));v.__id=w,S.type==="Polygon"?g.push(Hi({id:"".concat(w,"_0"),coords:S.coordinates},x)):S.type==="MultiPolygon"?g.push.apply(g,Qi(S.coordinates.map(function(R,C){return Hi({id:"".concat(w,"_").concat(C),coords:R},x)}))):console.warn("Unsupported GeoJson geometry type: ".concat(S.type,". Skipping geometry..."))}),e.dataMapper.onUpdateObj(function(v,x){var S=x.coords,w=x.capColor,R=x.capMaterial,C=x.sideColor,E=x.sideMaterial,B=x.strokeColor,L=x.altitude,O=x.capCurvatureResolution,z=gr(v.children,2),G=z[0],k=z[1],H=!!B;k.visible=H;var F=!!(w||R),V=!!(C||E);aue(G.geometry.parameters||{},{polygonGeoJson:S,curvatureResolution:O,closedTop:F,includeSides:V})||(G.geometry&&G.geometry.dispose(),G.geometry=new TM(S,0,cr,!1,F,V,O)),H&&(!k.geometry.parameters||k.geometry.parameters.geoJson.coordinates!==S||k.geometry.parameters.resolution!==O)&&(k.geometry&&k.geometry.dispose(),k.geometry=new uP({type:"Polygon",coordinates:S},cr,O));var X=V?0:-1,J=F?V?1:0:-1;if(X>=0&&(G.material[X]=E||v.__defaultSideMaterial),J>=0&&(G.material[J]=R||v.__defaultCapMaterial),[[!E&&C,X],[!R&&w,J]].forEach(function(he){var be=gr(he,2),Se=be[0],le=be[1];if(!(!Se||le<0)){var we=G.material[le],We=Rl(Se);we.color.set(wu(Se)),we.transparent=We<1,we.opacity=We}}),H){var te=k.material,se=Rl(B);te.color.set(wu(B)),te.transparent=se<1,te.opacity=se}var ne={alt:L},Z=function(be){var Se=v.__currentTargetD=be,le=Se.alt;G.scale.x=G.scale.y=G.scale.z=1+le,H&&(k.scale.x=k.scale.y=k.scale.z=1+le+1e-4),Yle(v.__defaultSideMaterial,function(we){return we.uSurfaceRadius.value=cr/(le+1)})},ue=v.__currentTargetD||Object.assign({},ne,{alt:-.001});Object.keys(ne).some(function(he){return ue[he]!==ne[he]})&&(!e.polygonsTransitionDuration||e.polygonsTransitionDuration<0||ue.alt===ne.alt?Z(ne):e.tweenGroup.add(new ca(ue).to(ne,e.polygonsTransitionDuration).easing(os.Quadratic.InOut).onUpdate(Z).start()))}).digest(g)}});function aue(i,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:function(){return function(n,r){return n===r}};return Object.entries(e).every(function(n){var r=gr(n,2),s=r[0],a=r[1];return i.hasOwnProperty(s)&&t(s)(i[s],a)})}var Bd=window.THREE?window.THREE:{BufferGeometry:Ki,DoubleSide:as,Mesh:zi,MeshLambertMaterial:Vc,Vector3:ce},YN=Object.assign({},_M),QN=YN.BufferGeometryUtils||YN,xO=xs({props:{hexPolygonsData:{default:[]},hexPolygonGeoJsonGeometry:{default:"geometry"},hexPolygonColor:{default:function(){return"#ffffaa"}},hexPolygonAltitude:{default:.001},hexPolygonResolution:{default:3},hexPolygonMargin:{default:.2},hexPolygonUseDots:{default:!1},hexPolygonCurvatureResolution:{default:5},hexPolygonDotResolution:{default:12},hexPolygonsTransitionDuration:{default:0,triggerUpdate:!1}},init:function(e,t,n){var r=n.tweenGroup;nr(e),t.scene=e,t.tweenGroup=r,t.dataMapper=new ao(e,{objBindAttr:"__threeObjHexPolygon"}).onCreateObj(function(){var s=new Bd.Mesh(void 0,new Bd.MeshLambertMaterial({side:Bd.DoubleSide}));return s.__globeObjType="hexPolygon",s})},update:function(e){var t=Ct(e.hexPolygonGeoJsonGeometry),n=Ct(e.hexPolygonColor),r=Ct(e.hexPolygonAltitude),s=Ct(e.hexPolygonResolution),a=Ct(e.hexPolygonMargin),l=Ct(e.hexPolygonUseDots),u=Ct(e.hexPolygonCurvatureResolution),h=Ct(e.hexPolygonDotResolution);e.dataMapper.onUpdateObj(function(g,v){var x=t(v),S=s(v),w=r(v),R=Math.max(0,Math.min(1,+a(v))),C=l(v),E=u(v),B=h(v),L=n(v),O=Rl(L);g.material.color.set(wu(L)),g.material.transparent=O<1,g.material.opacity=O;var z={alt:w,margin:R,curvatureResolution:E},G={geoJson:x,h3Res:S},k=g.__currentTargetD||Object.assign({},z,{alt:-.001}),H=g.__currentMemD||G;if(Object.keys(z).some(function(J){return k[J]!==z[J]})||Object.keys(G).some(function(J){return H[J]!==G[J]})){g.__currentMemD=G;var F=[];x.type==="Polygon"?CR(x.coordinates,S,!0).forEach(function(J){return F.push(J)}):x.type==="MultiPolygon"?x.coordinates.forEach(function(J){return CR(J,S,!0).forEach(function(te){return F.push(te)})}):console.warn("Unsupported GeoJson geometry type: ".concat(x.type,". Skipping geometry..."));var V=F.map(function(J){var te=CP(J),se=RP(J,!0).reverse(),ne=te[1];return se.forEach(function(Z){var ue=Z[0];Math.abs(ne-ue)>170&&(Z[0]+=ne>ue?360:-360)}),{h3Idx:J,hexCenter:te,hexGeoJson:se}}),X=function(te){var se=g.__currentTargetD=te,ne=se.alt,Z=se.margin,ue=se.curvatureResolution;g.geometry&&g.geometry.dispose(),g.geometry=V.length?(QN.mergeGeometries||QN.mergeBufferGeometries)(V.map(function(he){var be=gr(he.hexCenter,2),Se=be[0],le=be[1];if(C){var we=el(Se,le,ne),We=el(he.hexGeoJson[0][1],he.hexGeoJson[0][0],ne),Te=.85*(1-Z)*new Bd.Vector3(we.x,we.y,we.z).distanceTo(new Bd.Vector3(We.x,We.y,We.z)),ze=new by(Te,B);return ze.rotateX(Vf(-Se)),ze.rotateY(Vf(le)),ze.translate(we.x,we.y,we.z),ze}else{var _e=function(vt,Tt,Ge){return vt-(vt-Tt)*Ge},De=Z===0?he.hexGeoJson:he.hexGeoJson.map(function(dt){var vt=gr(dt,2),Tt=vt[0],Ge=vt[1];return[[Tt,le],[Ge,Se]].map(function(Be){var ke=gr(Be,2),oe=ke[0],Mt=ke[1];return _e(oe,Mt,Z)})});return new TM([De],cr,cr*(1+ne),!1,!0,!1,ue)}})):new Bd.BufferGeometry};!e.hexPolygonsTransitionDuration||e.hexPolygonsTransitionDuration<0?X(z):e.tweenGroup.add(new ca(k).to(z,e.hexPolygonsTransitionDuration).easing(os.Quadratic.InOut).onUpdate(X).start())}}).digest(e.hexPolygonsData)}}),oue=window.THREE?window.THREE:{Vector3:ce};function lue(i,e){var t=function(a,l){var u=a[a.length-1];return[].concat(Qi(a),Qi(Array(l-a.length).fill(u)))},n=Math.max(i.length,e.length),r=c$.apply(void 0,Qi([i,e].map(function(s){return s.map(function(a){var l=a.x,u=a.y,h=a.z;return[l,u,h]})}).map(function(s){return t(s,n)})));return function(s){return s===0?i:s===1?e:r(s).map(function(a){var l=gr(a,3),u=l[0],h=l[1],g=l[2];return new oue.Vector3(u,h,g)})}}var Pf=window.THREE?window.THREE:{BufferGeometry:Ki,Color:sn,Group:ja,Line:xy,NormalBlending:Ka,ShaderMaterial:Ja,Vector3:ce},uue=L0.default||L0,bO=xs({props:{pathsData:{default:[]},pathPoints:{default:function(e){return e}},pathPointLat:{default:function(e){return e[0]}},pathPointLng:{default:function(e){return e[1]}},pathPointAlt:{default:.001},pathResolution:{default:2},pathColor:{default:function(){return"#ffffaa"}},pathStroke:{},pathDashLength:{default:1},pathDashGap:{default:0},pathDashInitialGap:{default:0},pathDashAnimateTime:{default:0},pathTransitionDuration:{default:1e3,triggerUpdate:!1},rendererSize:{}},methods:{pauseAnimation:function(e){var t;(t=e.ticker)===null||t===void 0||t.pause()},resumeAnimation:function(e){var t;(t=e.ticker)===null||t===void 0||t.resume()},_destructor:function(e){var t;(t=e.ticker)===null||t===void 0||t.dispose()}},stateInit:function(e){var t=e.tweenGroup;return{tweenGroup:t,ticker:new uue,sharedMaterial:new Pf.ShaderMaterial(Hi(Hi({},pO()),{},{transparent:!0,blending:Pf.NormalBlending}))}},init:function(e,t){nr(e),t.scene=e,t.dataMapper=new ao(e,{objBindAttr:"__threeObjPath"}).onCreateObj(function(){var n=new Pf.Group;return n.__globeObjType="path",n}),t.ticker.onTick.add(function(n,r){t.dataMapper.entries().map(function(s){var a=gr(s,2),l=a[1];return l}).filter(function(s){return s.children.length&&s.children[0].material&&s.children[0].__dashAnimateStep}).forEach(function(s){var a=s.children[0],l=a.__dashAnimateStep*r;if(a.type==="Line"){var u=a.material.uniforms.dashTranslate.value%1e9;a.material.uniforms.dashTranslate.value=u+l}else if(a.type==="Line2"){for(var h=a.material.dashOffset-l,g=a.material.dashSize+a.material.gapSize;h<=-g;)h+=g;a.material.dashOffset=h}})})},update:function(e){var t=Ct(e.pathPoints),n=Ct(e.pathPointLat),r=Ct(e.pathPointLng),s=Ct(e.pathPointAlt),a=Ct(e.pathStroke),l=Ct(e.pathColor),u=Ct(e.pathDashLength),h=Ct(e.pathDashGap),g=Ct(e.pathDashInitialGap),v=Ct(e.pathDashAnimateTime);e.dataMapper.onUpdateObj(function(C,E){var B=a(E),L=B!=null;if(!C.children.length||L===(C.children[0].type==="Line")){nr(C);var O=L?new ble(new oO,new GE):new Pf.Line(new Pf.BufferGeometry,e.sharedMaterial.clone());C.add(O)}var z=C.children[0],G=S(t(E),n,r,s,e.pathResolution),k=v(E);if(z.__dashAnimateStep=k>0?1e3/k:0,L){z.material.resolution=e.rendererSize;{var V=u(E),X=h(E),J=g(E);z.material.dashed=X>0,z.material.dashed?z.material.defines.USE_DASH="":delete z.material.defines.USE_DASH,z.material.dashed&&(z.material.dashScale=1/x(G),z.material.dashSize=V,z.material.gapSize=X,z.material.dashOffset=-J)}{var te=l(E);if(te instanceof Array){var se=w(l(E),G.length-1,1,!1);z.geometry.setColors(se.array),z.material.vertexColors=!0}else{var ne=te,Z=Rl(ne);z.material.color=new Pf.Color(wu(ne)),z.material.transparent=Z<1,z.material.opacity=Z,z.material.vertexColors=!1}}z.material.needsUpdate=!0}else{Object.assign(z.material.uniforms,{dashSize:{value:u(E)},gapSize:{value:h(E)},dashOffset:{value:g(E)}});var H=w(l(E),G.length),F=R(G.length,1,!0);z.geometry.setAttribute("color",H),z.geometry.setAttribute("relDistance",F)}var ue=lue(C.__currentTargetD&&C.__currentTargetD.points||[G[0]],G),he=function(we){var We=C.__currentTargetD=we,Te=We.stroke,ze=We.interpolK,_e=C.__currentTargetD.points=ue(ze);if(L){var De;z.geometry.setPositions((De=[]).concat.apply(De,Qi(_e.map(function(dt){var vt=dt.x,Tt=dt.y,Ge=dt.z;return[vt,Tt,Ge]})))),z.material.linewidth=Te,z.material.dashed&&z.computeLineDistances()}else z.geometry.setFromPoints(_e),z.geometry.computeBoundingSphere()},be={stroke:B,interpolK:1},Se=Object.assign({},C.__currentTargetD||be,{interpolK:0});Object.keys(be).some(function(le){return Se[le]!==be[le]})&&(!e.pathTransitionDuration||e.pathTransitionDuration<0?he(be):e.tweenGroup.add(new ca(Se).to(be,e.pathTransitionDuration).easing(os.Quadratic.InOut).onUpdate(he).start()))}).digest(e.pathsData);function x(C){var E=0,B;return C.forEach(function(L){B&&(E+=B.distanceTo(L)),B=L}),E}function S(C,E,B,L,O){var z=function(F,V,X){for(var J=[],te=1;te<=X;te++)J.push(F+(V-F)*te/(X+1));return J},G=function(){var F=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],V=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,X=[],J=null;return F.forEach(function(te){if(J){for(;Math.abs(J[1]-te[1])>180;)J[1]+=360*(J[1]V)for(var ne=Math.floor(se/V),Z=z(J[0],te[0],ne),ue=z(J[1],te[1],ne),he=z(J[2],te[2],ne),be=0,Se=Z.length;be2&&arguments[2]!==void 0?arguments[2]:1,L=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,O=E+1,z;if(C instanceof Array||C instanceof Function){var G=C instanceof Array?Pc().domain(C.map(function(te,se){return se/(C.length-1)})).range(C):C;z=function(se){return jh(G(se),L,!0)}}else{var k=jh(C,L,!0);z=function(){return k}}for(var H=[],F=0,V=O;F1&&arguments[1]!==void 0?arguments[1]:1,B=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,L=C+1,O=[],z=0,G=L;z0&&arguments[0]!==void 0?arguments[0]:1,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:32;nx(this,e),t=tx(this,e),t.type="CircleLineGeometry",t.parameters={radius:n,segmentCount:r};for(var s=[],a=0;a<=r;a++){var l=(a/r-.25)*Math.PI*2;s.push({x:Math.cos(l)*n,y:Math.sin(l)*n,z:0})}return t.setFromPoints(s),t}return rx(e,i),ix(e)})(cue.BufferGeometry),Id=window.THREE?window.THREE:{Color:sn,Group:ja,Line:xy,LineBasicMaterial:$0,Vector3:ce},fue=L0.default||L0,wO=xs({props:{ringsData:{default:[]},ringLat:{default:"lat"},ringLng:{default:"lng"},ringAltitude:{default:.0015},ringColor:{default:function(){return"#ffffaa"},triggerUpdate:!1},ringResolution:{default:64,triggerUpdate:!1},ringMaxRadius:{default:2,triggerUpdate:!1},ringPropagationSpeed:{default:1,triggerUpdate:!1},ringRepeatPeriod:{default:700,triggerUpdate:!1}},methods:{pauseAnimation:function(e){var t;(t=e.ticker)===null||t===void 0||t.pause()},resumeAnimation:function(e){var t;(t=e.ticker)===null||t===void 0||t.resume()},_destructor:function(e){var t;(t=e.ticker)===null||t===void 0||t.dispose()}},init:function(e,t,n){var r=n.tweenGroup;nr(e),t.scene=e,t.tweenGroup=r,t.dataMapper=new ao(e,{objBindAttr:"__threeObjRing",removeDelay:3e4}).onCreateObj(function(){var s=new Id.Group;return s.__globeObjType="ring",s}),t.ticker=new fue,t.ticker.onTick.add(function(s){if(t.ringsData.length){var a=Ct(t.ringColor),l=Ct(t.ringAltitude),u=Ct(t.ringMaxRadius),h=Ct(t.ringPropagationSpeed),g=Ct(t.ringRepeatPeriod);t.dataMapper.entries().filter(function(v){var x=gr(v,2),S=x[1];return S}).forEach(function(v){var x=gr(v,2),S=x[0],w=x[1];if((w.__nextRingTime||0)<=s){var R=g(S)/1e3;w.__nextRingTime=s+(R<=0?1/0:R);var C=new Id.Line(new hue(1,t.ringResolution),new Id.LineBasicMaterial),E=a(S),B=E instanceof Array||E instanceof Function,L;B?E instanceof Array?(L=Pc().domain(E.map(function(X,J){return J/(E.length-1)})).range(E),C.material.transparent=E.some(function(X){return Rl(X)<1})):(L=E,C.material.transparent=!0):(C.material.color=new Id.Color(wu(E)),Wle(C.material,Rl(E)));var O=cr*(1+l(S)),z=u(S),G=z*Math.PI/180,k=h(S),H=k<=0,F=function(J){var te=J.t,se=(H?1-te:te)*G;if(C.scale.x=C.scale.y=O*Math.sin(se),C.position.z=O*(1-Math.cos(se)),B){var ne=L(te);C.material.color=new Id.Color(wu(ne)),C.material.transparent&&(C.material.opacity=Rl(ne))}};if(k===0)F({t:0}),w.add(C);else{var V=Math.abs(z/k)*1e3;t.tweenGroup.add(new ca({t:0}).to({t:1},V).onUpdate(F).onStart(function(){return w.add(C)}).onComplete(function(){w.remove(C),HE(C)}).start())}}})}})},update:function(e){var t=Ct(e.ringLat),n=Ct(e.ringLng),r=Ct(e.ringAltitude),s=e.scene.localToWorld(new Id.Vector3(0,0,0));e.dataMapper.onUpdateObj(function(a,l){var u=t(l),h=n(l),g=r(l);Object.assign(a.position,el(u,h,g)),a.lookAt(s)}).digest(e.ringsData)}}),Aue={0:{x_min:73,x_max:715,ha:792,o:"m 394 -29 q 153 129 242 -29 q 73 479 73 272 q 152 829 73 687 q 394 989 241 989 q 634 829 545 989 q 715 479 715 684 q 635 129 715 270 q 394 -29 546 -29 m 394 89 q 546 211 489 89 q 598 479 598 322 q 548 748 598 640 q 394 871 491 871 q 241 748 298 871 q 190 479 190 637 q 239 211 190 319 q 394 89 296 89 "},1:{x_min:215.671875,x_max:574,ha:792,o:"m 574 0 l 442 0 l 442 697 l 215 697 l 215 796 q 386 833 330 796 q 475 986 447 875 l 574 986 l 574 0 "},2:{x_min:59,x_max:731,ha:792,o:"m 731 0 l 59 0 q 197 314 59 188 q 457 487 199 315 q 598 691 598 580 q 543 819 598 772 q 411 867 488 867 q 272 811 328 867 q 209 630 209 747 l 81 630 q 182 901 81 805 q 408 986 271 986 q 629 909 536 986 q 731 694 731 826 q 613 449 731 541 q 378 316 495 383 q 201 122 235 234 l 731 122 l 731 0 "},3:{x_min:54,x_max:737,ha:792,o:"m 737 284 q 635 55 737 141 q 399 -25 541 -25 q 156 52 248 -25 q 54 308 54 140 l 185 308 q 245 147 185 202 q 395 96 302 96 q 539 140 484 96 q 602 280 602 190 q 510 429 602 390 q 324 454 451 454 l 324 565 q 487 584 441 565 q 565 719 565 617 q 515 835 565 791 q 395 879 466 879 q 255 824 307 879 q 203 661 203 769 l 78 661 q 166 909 78 822 q 387 992 250 992 q 603 921 513 992 q 701 723 701 844 q 669 607 701 656 q 578 524 637 558 q 696 434 655 499 q 737 284 737 369 "},4:{x_min:48,x_max:742.453125,ha:792,o:"m 742 243 l 602 243 l 602 0 l 476 0 l 476 243 l 48 243 l 48 368 l 476 958 l 602 958 l 602 354 l 742 354 l 742 243 m 476 354 l 476 792 l 162 354 l 476 354 "},5:{x_min:54.171875,x_max:738,ha:792,o:"m 738 314 q 626 60 738 153 q 382 -23 526 -23 q 155 47 248 -23 q 54 256 54 125 l 183 256 q 259 132 204 174 q 382 91 314 91 q 533 149 471 91 q 602 314 602 213 q 538 469 602 411 q 386 528 475 528 q 284 506 332 528 q 197 439 237 484 l 81 439 l 159 958 l 684 958 l 684 840 l 254 840 l 214 579 q 306 627 258 612 q 407 643 354 643 q 636 552 540 643 q 738 314 738 457 "},6:{x_min:53,x_max:739,ha:792,o:"m 739 312 q 633 62 739 162 q 400 -31 534 -31 q 162 78 257 -31 q 53 439 53 206 q 178 859 53 712 q 441 986 284 986 q 643 912 559 986 q 732 713 732 833 l 601 713 q 544 830 594 786 q 426 875 494 875 q 268 793 331 875 q 193 517 193 697 q 301 597 240 570 q 427 624 362 624 q 643 540 552 624 q 739 312 739 451 m 603 298 q 540 461 603 400 q 404 516 484 516 q 268 461 323 516 q 207 300 207 401 q 269 137 207 198 q 405 83 325 83 q 541 137 486 83 q 603 298 603 197 "},7:{x_min:58.71875,x_max:730.953125,ha:792,o:"m 730 839 q 469 448 560 641 q 335 0 378 255 l 192 0 q 328 441 235 252 q 593 830 421 630 l 58 830 l 58 958 l 730 958 l 730 839 "},8:{x_min:55,x_max:736,ha:792,o:"m 571 527 q 694 424 652 491 q 736 280 736 358 q 648 71 736 158 q 395 -26 551 -26 q 142 69 238 -26 q 55 279 55 157 q 96 425 55 359 q 220 527 138 491 q 120 615 153 562 q 88 726 88 668 q 171 904 88 827 q 395 986 261 986 q 618 905 529 986 q 702 727 702 830 q 670 616 702 667 q 571 527 638 565 m 394 565 q 519 610 475 565 q 563 717 563 655 q 521 823 563 781 q 392 872 474 872 q 265 824 312 872 q 224 720 224 783 q 265 613 224 656 q 394 565 312 565 m 395 91 q 545 150 488 91 q 597 280 597 204 q 546 408 597 355 q 395 465 492 465 q 244 408 299 465 q 194 280 194 356 q 244 150 194 203 q 395 91 299 91 "},9:{x_min:53,x_max:739,ha:792,o:"m 739 524 q 619 94 739 241 q 362 -32 516 -32 q 150 47 242 -32 q 59 244 59 126 l 191 244 q 246 129 191 176 q 373 82 301 82 q 526 161 466 82 q 597 440 597 255 q 363 334 501 334 q 130 432 216 334 q 53 650 53 521 q 134 880 53 786 q 383 986 226 986 q 659 841 566 986 q 739 524 739 719 m 388 449 q 535 514 480 449 q 585 658 585 573 q 535 805 585 744 q 388 873 480 873 q 242 809 294 873 q 191 658 191 745 q 239 514 191 572 q 388 449 292 449 "},ο:{x_min:0,x_max:712,ha:815,o:"m 356 -25 q 96 88 192 -25 q 0 368 0 201 q 92 642 0 533 q 356 761 192 761 q 617 644 517 761 q 712 368 712 533 q 619 91 712 201 q 356 -25 520 -25 m 356 85 q 527 175 465 85 q 583 369 583 255 q 528 562 583 484 q 356 651 466 651 q 189 560 250 651 q 135 369 135 481 q 187 177 135 257 q 356 85 250 85 "},S:{x_min:0,x_max:788,ha:890,o:"m 788 291 q 662 54 788 144 q 397 -26 550 -26 q 116 68 226 -26 q 0 337 0 168 l 131 337 q 200 152 131 220 q 384 85 269 85 q 557 129 479 85 q 650 270 650 183 q 490 429 650 379 q 194 513 341 470 q 33 739 33 584 q 142 964 33 881 q 388 1041 242 1041 q 644 957 543 1041 q 756 716 756 867 l 625 716 q 561 874 625 816 q 395 933 497 933 q 243 891 309 933 q 164 759 164 841 q 325 609 164 656 q 625 526 475 568 q 788 291 788 454 "},"¦":{x_min:343,x_max:449,ha:792,o:"m 449 462 l 343 462 l 343 986 l 449 986 l 449 462 m 449 -242 l 343 -242 l 343 280 l 449 280 l 449 -242 "},"/":{x_min:183.25,x_max:608.328125,ha:792,o:"m 608 1041 l 266 -129 l 183 -129 l 520 1041 l 608 1041 "},Τ:{x_min:-.4375,x_max:777.453125,ha:839,o:"m 777 893 l 458 893 l 458 0 l 319 0 l 319 892 l 0 892 l 0 1013 l 777 1013 l 777 893 "},y:{x_min:0,x_max:684.78125,ha:771,o:"m 684 738 l 388 -83 q 311 -216 356 -167 q 173 -279 252 -279 q 97 -266 133 -279 l 97 -149 q 132 -155 109 -151 q 168 -160 155 -160 q 240 -114 213 -160 q 274 -26 248 -98 l 0 738 l 137 737 l 341 139 l 548 737 l 684 738 "},Π:{x_min:0,x_max:803,ha:917,o:"m 803 0 l 667 0 l 667 886 l 140 886 l 140 0 l 0 0 l 0 1012 l 803 1012 l 803 0 "},ΐ:{x_min:-111,x_max:339,ha:361,o:"m 339 800 l 229 800 l 229 925 l 339 925 l 339 800 m -1 800 l -111 800 l -111 925 l -1 925 l -1 800 m 284 3 q 233 -10 258 -5 q 182 -15 207 -15 q 85 26 119 -15 q 42 200 42 79 l 42 737 l 167 737 l 168 215 q 172 141 168 157 q 226 101 183 101 q 248 103 239 101 q 284 112 257 104 l 284 3 m 302 1040 l 113 819 l 30 819 l 165 1040 l 302 1040 "},g:{x_min:0,x_max:686,ha:838,o:"m 686 34 q 586 -213 686 -121 q 331 -306 487 -306 q 131 -252 216 -306 q 31 -84 31 -190 l 155 -84 q 228 -174 166 -138 q 345 -207 284 -207 q 514 -109 454 -207 q 564 89 564 -27 q 461 6 521 36 q 335 -23 401 -23 q 88 100 184 -23 q 0 370 0 215 q 87 634 0 522 q 330 758 183 758 q 457 728 398 758 q 564 644 515 699 l 564 737 l 686 737 l 686 34 m 582 367 q 529 560 582 481 q 358 652 468 652 q 189 561 250 652 q 135 369 135 482 q 189 176 135 255 q 361 85 251 85 q 529 176 468 85 q 582 367 582 255 "},"²":{x_min:0,x_max:442,ha:539,o:"m 442 383 l 0 383 q 91 566 0 492 q 260 668 176 617 q 354 798 354 727 q 315 875 354 845 q 227 905 277 905 q 136 869 173 905 q 99 761 99 833 l 14 761 q 82 922 14 864 q 232 974 141 974 q 379 926 316 974 q 442 797 442 878 q 351 635 442 704 q 183 539 321 611 q 92 455 92 491 l 442 455 l 442 383 "},"–":{x_min:0,x_max:705.5625,ha:803,o:"m 705 334 l 0 334 l 0 410 l 705 410 l 705 334 "},Κ:{x_min:0,x_max:819.5625,ha:893,o:"m 819 0 l 650 0 l 294 509 l 139 356 l 139 0 l 0 0 l 0 1013 l 139 1013 l 139 526 l 626 1013 l 809 1013 l 395 600 l 819 0 "},ƒ:{x_min:-46.265625,x_max:392,ha:513,o:"m 392 651 l 259 651 l 79 -279 l -46 -278 l 134 651 l 14 651 l 14 751 l 135 751 q 151 948 135 900 q 304 1041 185 1041 q 334 1040 319 1041 q 392 1034 348 1039 l 392 922 q 337 931 360 931 q 271 883 287 931 q 260 793 260 853 l 260 751 l 392 751 l 392 651 "},e:{x_min:0,x_max:714,ha:813,o:"m 714 326 l 140 326 q 200 157 140 227 q 359 87 260 87 q 488 130 431 87 q 561 245 545 174 l 697 245 q 577 48 670 123 q 358 -26 484 -26 q 97 85 195 -26 q 0 363 0 197 q 94 642 0 529 q 358 765 195 765 q 626 627 529 765 q 714 326 714 503 m 576 429 q 507 583 564 522 q 355 650 445 650 q 206 583 266 650 q 140 429 152 522 l 576 429 "},ό:{x_min:0,x_max:712,ha:815,o:"m 356 -25 q 94 91 194 -25 q 0 368 0 202 q 92 642 0 533 q 356 761 192 761 q 617 644 517 761 q 712 368 712 533 q 619 91 712 201 q 356 -25 520 -25 m 356 85 q 527 175 465 85 q 583 369 583 255 q 528 562 583 484 q 356 651 466 651 q 189 560 250 651 q 135 369 135 481 q 187 177 135 257 q 356 85 250 85 m 576 1040 l 387 819 l 303 819 l 438 1040 l 576 1040 "},J:{x_min:0,x_max:588,ha:699,o:"m 588 279 q 287 -26 588 -26 q 58 73 126 -26 q 0 327 0 158 l 133 327 q 160 172 133 227 q 288 96 198 96 q 426 171 391 96 q 449 336 449 219 l 449 1013 l 588 1013 l 588 279 "},"»":{x_min:-1,x_max:503,ha:601,o:"m 503 302 l 280 136 l 281 256 l 429 373 l 281 486 l 280 608 l 503 440 l 503 302 m 221 302 l 0 136 l 0 255 l 145 372 l 0 486 l -1 608 l 221 440 l 221 302 "},"©":{x_min:-3,x_max:1008,ha:1106,o:"m 502 -7 q 123 151 263 -7 q -3 501 -3 294 q 123 851 -3 706 q 502 1011 263 1011 q 881 851 739 1011 q 1008 501 1008 708 q 883 151 1008 292 q 502 -7 744 -7 m 502 60 q 830 197 709 60 q 940 501 940 322 q 831 805 940 681 q 502 944 709 944 q 174 805 296 944 q 65 501 65 680 q 173 197 65 320 q 502 60 294 60 m 741 394 q 661 246 731 302 q 496 190 591 190 q 294 285 369 190 q 228 497 228 370 q 295 714 228 625 q 499 813 370 813 q 656 762 588 813 q 733 625 724 711 l 634 625 q 589 704 629 673 q 498 735 550 735 q 377 666 421 735 q 334 504 334 597 q 374 340 334 408 q 490 272 415 272 q 589 304 549 272 q 638 394 628 337 l 741 394 "},ώ:{x_min:0,x_max:922,ha:1030,o:"m 687 1040 l 498 819 l 415 819 l 549 1040 l 687 1040 m 922 339 q 856 97 922 203 q 650 -26 780 -26 q 538 9 587 -26 q 461 103 489 44 q 387 12 436 46 q 277 -22 339 -22 q 69 97 147 -22 q 0 338 0 202 q 45 551 0 444 q 161 737 84 643 l 302 737 q 175 552 219 647 q 124 336 124 446 q 155 179 124 248 q 275 88 197 88 q 375 163 341 88 q 400 294 400 219 l 400 572 l 524 572 l 524 294 q 561 135 524 192 q 643 88 591 88 q 762 182 719 88 q 797 341 797 257 q 745 555 797 450 q 619 737 705 637 l 760 737 q 874 551 835 640 q 922 339 922 444 "},"^":{x_min:193.0625,x_max:598.609375,ha:792,o:"m 598 772 l 515 772 l 395 931 l 277 772 l 193 772 l 326 1013 l 462 1013 l 598 772 "},"«":{x_min:0,x_max:507.203125,ha:604,o:"m 506 136 l 284 302 l 284 440 l 506 608 l 507 485 l 360 371 l 506 255 l 506 136 m 222 136 l 0 302 l 0 440 l 222 608 l 221 486 l 73 373 l 222 256 l 222 136 "},D:{x_min:0,x_max:828,ha:935,o:"m 389 1013 q 714 867 593 1013 q 828 521 828 729 q 712 161 828 309 q 382 0 587 0 l 0 0 l 0 1013 l 389 1013 m 376 124 q 607 247 523 124 q 681 510 681 355 q 607 771 681 662 q 376 896 522 896 l 139 896 l 139 124 l 376 124 "},"∙":{x_min:0,x_max:142,ha:239,o:"m 142 585 l 0 585 l 0 738 l 142 738 l 142 585 "},ÿ:{x_min:0,x_max:47,ha:125,o:"m 47 3 q 37 -7 47 -7 q 28 0 30 -7 q 39 -4 32 -4 q 45 3 45 -1 l 37 0 q 28 9 28 0 q 39 19 28 19 l 47 16 l 47 19 l 47 3 m 37 1 q 44 8 44 1 q 37 16 44 16 q 30 8 30 16 q 37 1 30 1 m 26 1 l 23 22 l 14 0 l 3 22 l 3 3 l 0 25 l 13 1 l 22 25 l 26 1 "},w:{x_min:0,x_max:1009.71875,ha:1100,o:"m 1009 738 l 783 0 l 658 0 l 501 567 l 345 0 l 222 0 l 0 738 l 130 738 l 284 174 l 432 737 l 576 738 l 721 173 l 881 737 l 1009 738 "},$:{x_min:0,x_max:700,ha:793,o:"m 664 717 l 542 717 q 490 825 531 785 q 381 872 450 865 l 381 551 q 620 446 540 522 q 700 241 700 370 q 618 45 700 116 q 381 -25 536 -25 l 381 -152 l 307 -152 l 307 -25 q 81 62 162 -25 q 0 297 0 149 l 124 297 q 169 146 124 204 q 307 81 215 89 l 307 441 q 80 536 148 469 q 13 725 13 603 q 96 910 13 839 q 307 982 180 982 l 307 1077 l 381 1077 l 381 982 q 574 917 494 982 q 664 717 664 845 m 307 565 l 307 872 q 187 831 233 872 q 142 724 142 791 q 180 618 142 656 q 307 565 218 580 m 381 76 q 562 237 562 96 q 517 361 562 313 q 381 423 472 409 l 381 76 "},"\\":{x_min:-.015625,x_max:425.0625,ha:522,o:"m 425 -129 l 337 -129 l 0 1041 l 83 1041 l 425 -129 "},µ:{x_min:0,x_max:697.21875,ha:747,o:"m 697 -4 q 629 -14 658 -14 q 498 97 513 -14 q 422 9 470 41 q 313 -23 374 -23 q 207 4 258 -23 q 119 81 156 32 l 119 -278 l 0 -278 l 0 738 l 124 738 l 124 343 q 165 173 124 246 q 308 83 216 83 q 452 178 402 83 q 493 359 493 255 l 493 738 l 617 738 l 617 214 q 623 136 617 160 q 673 92 637 92 q 697 96 684 92 l 697 -4 "},Ι:{x_min:42,x_max:181,ha:297,o:"m 181 0 l 42 0 l 42 1013 l 181 1013 l 181 0 "},Ύ:{x_min:0,x_max:1144.5,ha:1214,o:"m 1144 1012 l 807 416 l 807 0 l 667 0 l 667 416 l 325 1012 l 465 1012 l 736 533 l 1004 1012 l 1144 1012 m 277 1040 l 83 799 l 0 799 l 140 1040 l 277 1040 "},"’":{x_min:0,x_max:139,ha:236,o:"m 139 851 q 102 737 139 784 q 0 669 65 690 l 0 734 q 59 787 42 741 q 72 873 72 821 l 0 873 l 0 1013 l 139 1013 l 139 851 "},Ν:{x_min:0,x_max:801,ha:915,o:"m 801 0 l 651 0 l 131 822 l 131 0 l 0 0 l 0 1013 l 151 1013 l 670 191 l 670 1013 l 801 1013 l 801 0 "},"-":{x_min:8.71875,x_max:350.390625,ha:478,o:"m 350 317 l 8 317 l 8 428 l 350 428 l 350 317 "},Q:{x_min:0,x_max:968,ha:1072,o:"m 954 5 l 887 -79 l 744 35 q 622 -11 687 2 q 483 -26 556 -26 q 127 130 262 -26 q 0 504 0 279 q 127 880 0 728 q 484 1041 262 1041 q 841 884 708 1041 q 968 507 968 735 q 933 293 968 398 q 832 104 899 188 l 954 5 m 723 191 q 802 330 777 248 q 828 499 828 412 q 744 790 828 673 q 483 922 650 922 q 228 791 322 922 q 142 505 142 673 q 227 221 142 337 q 487 91 323 91 q 632 123 566 91 l 520 215 l 587 301 l 723 191 "},ς:{x_min:1,x_max:676.28125,ha:740,o:"m 676 460 l 551 460 q 498 595 542 546 q 365 651 448 651 q 199 578 263 651 q 136 401 136 505 q 266 178 136 241 q 508 106 387 142 q 640 -50 640 62 q 625 -158 640 -105 q 583 -278 611 -211 l 465 -278 q 498 -182 490 -211 q 515 -80 515 -126 q 381 12 515 -15 q 134 91 197 51 q 1 388 1 179 q 100 651 1 542 q 354 761 199 761 q 587 680 498 761 q 676 460 676 599 "},M:{x_min:0,x_max:954,ha:1067,o:"m 954 0 l 819 0 l 819 869 l 537 0 l 405 0 l 128 866 l 128 0 l 0 0 l 0 1013 l 200 1013 l 472 160 l 757 1013 l 954 1013 l 954 0 "},Ψ:{x_min:0,x_max:1006,ha:1094,o:"m 1006 678 q 914 319 1006 429 q 571 200 814 200 l 571 0 l 433 0 l 433 200 q 92 319 194 200 q 0 678 0 429 l 0 1013 l 139 1013 l 139 679 q 191 417 139 492 q 433 326 255 326 l 433 1013 l 571 1013 l 571 326 l 580 326 q 813 423 747 326 q 868 679 868 502 l 868 1013 l 1006 1013 l 1006 678 "},C:{x_min:0,x_max:886,ha:944,o:"m 886 379 q 760 87 886 201 q 455 -26 634 -26 q 112 136 236 -26 q 0 509 0 283 q 118 882 0 737 q 469 1041 245 1041 q 748 955 630 1041 q 879 708 879 859 l 745 708 q 649 862 724 805 q 473 920 573 920 q 219 791 312 920 q 136 509 136 675 q 217 229 136 344 q 470 99 311 99 q 672 179 591 99 q 753 379 753 259 l 886 379 "},"!":{x_min:0,x_max:138,ha:236,o:"m 138 684 q 116 409 138 629 q 105 244 105 299 l 33 244 q 16 465 33 313 q 0 684 0 616 l 0 1013 l 138 1013 l 138 684 m 138 0 l 0 0 l 0 151 l 138 151 l 138 0 "},"{":{x_min:0,x_max:480.5625,ha:578,o:"m 480 -286 q 237 -213 303 -286 q 187 -45 187 -159 q 194 48 187 -15 q 201 141 201 112 q 164 264 201 225 q 0 314 118 314 l 0 417 q 164 471 119 417 q 201 605 201 514 q 199 665 201 644 q 193 772 193 769 q 241 941 193 887 q 480 1015 308 1015 l 480 915 q 336 866 375 915 q 306 742 306 828 q 310 662 306 717 q 314 577 314 606 q 288 452 314 500 q 176 365 256 391 q 289 275 257 337 q 314 143 314 226 q 313 84 314 107 q 310 -11 310 -5 q 339 -131 310 -94 q 480 -182 377 -182 l 480 -286 "},X:{x_min:-.015625,x_max:854.15625,ha:940,o:"m 854 0 l 683 0 l 423 409 l 166 0 l 0 0 l 347 519 l 18 1013 l 186 1013 l 428 637 l 675 1013 l 836 1013 l 504 520 l 854 0 "},"#":{x_min:0,x_max:963.890625,ha:1061,o:"m 963 690 l 927 590 l 719 590 l 655 410 l 876 410 l 840 310 l 618 310 l 508 -3 l 393 -2 l 506 309 l 329 310 l 215 -2 l 102 -3 l 212 310 l 0 310 l 36 410 l 248 409 l 312 590 l 86 590 l 120 690 l 347 690 l 459 1006 l 573 1006 l 462 690 l 640 690 l 751 1006 l 865 1006 l 754 690 l 963 690 m 606 590 l 425 590 l 362 410 l 543 410 l 606 590 "},ι:{x_min:42,x_max:284,ha:361,o:"m 284 3 q 233 -10 258 -5 q 182 -15 207 -15 q 85 26 119 -15 q 42 200 42 79 l 42 738 l 167 738 l 168 215 q 172 141 168 157 q 226 101 183 101 q 248 103 239 101 q 284 112 257 104 l 284 3 "},Ά:{x_min:0,x_max:906.953125,ha:982,o:"m 283 1040 l 88 799 l 5 799 l 145 1040 l 283 1040 m 906 0 l 756 0 l 650 303 l 251 303 l 143 0 l 0 0 l 376 1012 l 529 1012 l 906 0 m 609 421 l 452 866 l 293 421 l 609 421 "},")":{x_min:0,x_max:318,ha:415,o:"m 318 365 q 257 25 318 191 q 87 -290 197 -141 l 0 -290 q 140 21 93 -128 q 193 360 193 189 q 141 704 193 537 q 0 1024 97 850 l 87 1024 q 257 706 197 871 q 318 365 318 542 "},ε:{x_min:0,x_max:634.71875,ha:714,o:"m 634 234 q 527 38 634 110 q 300 -25 433 -25 q 98 29 183 -25 q 0 204 0 93 q 37 314 0 265 q 128 390 67 353 q 56 460 82 419 q 26 555 26 505 q 114 712 26 654 q 295 763 191 763 q 499 700 416 763 q 589 515 589 631 l 478 515 q 419 618 464 580 q 307 657 374 657 q 207 630 253 657 q 151 547 151 598 q 238 445 151 469 q 389 434 280 434 l 389 331 l 349 331 q 206 315 255 331 q 125 210 125 287 q 183 107 125 145 q 302 76 233 76 q 436 117 379 76 q 509 234 493 159 l 634 234 "},Δ:{x_min:0,x_max:952.78125,ha:1028,o:"m 952 0 l 0 0 l 400 1013 l 551 1013 l 952 0 m 762 124 l 476 867 l 187 124 l 762 124 "},"}":{x_min:0,x_max:481,ha:578,o:"m 481 314 q 318 262 364 314 q 282 136 282 222 q 284 65 282 97 q 293 -58 293 -48 q 241 -217 293 -166 q 0 -286 174 -286 l 0 -182 q 143 -130 105 -182 q 171 -2 171 -93 q 168 81 171 22 q 165 144 165 140 q 188 275 165 229 q 306 365 220 339 q 191 455 224 391 q 165 588 165 505 q 168 681 165 624 q 171 742 171 737 q 141 865 171 827 q 0 915 102 915 l 0 1015 q 243 942 176 1015 q 293 773 293 888 q 287 675 293 741 q 282 590 282 608 q 318 466 282 505 q 481 417 364 417 l 481 314 "},"‰":{x_min:-3,x_max:1672,ha:1821,o:"m 846 0 q 664 76 732 0 q 603 244 603 145 q 662 412 603 344 q 846 489 729 489 q 1027 412 959 489 q 1089 244 1089 343 q 1029 76 1089 144 q 846 0 962 0 m 845 103 q 945 143 910 103 q 981 243 981 184 q 947 340 981 301 q 845 385 910 385 q 745 342 782 385 q 709 243 709 300 q 742 147 709 186 q 845 103 781 103 m 888 986 l 284 -25 l 199 -25 l 803 986 l 888 986 m 241 468 q 58 545 126 468 q -3 715 -3 615 q 56 881 -3 813 q 238 958 124 958 q 421 881 353 958 q 483 712 483 813 q 423 544 483 612 q 241 468 356 468 m 241 855 q 137 811 175 855 q 100 710 100 768 q 136 612 100 653 q 240 572 172 572 q 344 614 306 572 q 382 713 382 656 q 347 810 382 771 q 241 855 308 855 m 1428 0 q 1246 76 1314 0 q 1185 244 1185 145 q 1244 412 1185 344 q 1428 489 1311 489 q 1610 412 1542 489 q 1672 244 1672 343 q 1612 76 1672 144 q 1428 0 1545 0 m 1427 103 q 1528 143 1492 103 q 1564 243 1564 184 q 1530 340 1564 301 q 1427 385 1492 385 q 1327 342 1364 385 q 1291 243 1291 300 q 1324 147 1291 186 q 1427 103 1363 103 "},a:{x_min:0,x_max:698.609375,ha:794,o:"m 698 0 q 661 -12 679 -7 q 615 -17 643 -17 q 536 12 564 -17 q 500 96 508 41 q 384 6 456 37 q 236 -25 312 -25 q 65 31 130 -25 q 0 194 0 88 q 118 390 0 334 q 328 435 180 420 q 488 483 476 451 q 495 523 495 504 q 442 619 495 584 q 325 654 389 654 q 209 617 257 654 q 152 513 161 580 l 33 513 q 123 705 33 633 q 332 772 207 772 q 528 712 448 772 q 617 531 617 645 l 617 163 q 624 108 617 126 q 664 90 632 90 l 698 94 l 698 0 m 491 262 l 491 372 q 272 329 350 347 q 128 201 128 294 q 166 113 128 144 q 264 83 205 83 q 414 130 346 83 q 491 262 491 183 "},"—":{x_min:0,x_max:941.671875,ha:1039,o:"m 941 334 l 0 334 l 0 410 l 941 410 l 941 334 "},"=":{x_min:8.71875,x_max:780.953125,ha:792,o:"m 780 510 l 8 510 l 8 606 l 780 606 l 780 510 m 780 235 l 8 235 l 8 332 l 780 332 l 780 235 "},N:{x_min:0,x_max:801,ha:914,o:"m 801 0 l 651 0 l 131 823 l 131 0 l 0 0 l 0 1013 l 151 1013 l 670 193 l 670 1013 l 801 1013 l 801 0 "},ρ:{x_min:0,x_max:712,ha:797,o:"m 712 369 q 620 94 712 207 q 362 -26 521 -26 q 230 2 292 -26 q 119 83 167 30 l 119 -278 l 0 -278 l 0 362 q 91 643 0 531 q 355 764 190 764 q 617 647 517 764 q 712 369 712 536 m 583 366 q 530 559 583 480 q 359 651 469 651 q 190 562 252 651 q 135 370 135 483 q 189 176 135 257 q 359 85 250 85 q 528 175 466 85 q 583 366 583 254 "},"¯":{x_min:0,x_max:941.671875,ha:938,o:"m 941 1033 l 0 1033 l 0 1109 l 941 1109 l 941 1033 "},Z:{x_min:0,x_max:779,ha:849,o:"m 779 0 l 0 0 l 0 113 l 621 896 l 40 896 l 40 1013 l 779 1013 l 778 887 l 171 124 l 779 124 l 779 0 "},u:{x_min:0,x_max:617,ha:729,o:"m 617 0 l 499 0 l 499 110 q 391 10 460 45 q 246 -25 322 -25 q 61 58 127 -25 q 0 258 0 136 l 0 738 l 125 738 l 125 284 q 156 148 125 202 q 273 82 197 82 q 433 165 369 82 q 493 340 493 243 l 493 738 l 617 738 l 617 0 "},k:{x_min:0,x_max:612.484375,ha:697,o:"m 612 738 l 338 465 l 608 0 l 469 0 l 251 382 l 121 251 l 121 0 l 0 0 l 0 1013 l 121 1013 l 121 402 l 456 738 l 612 738 "},Η:{x_min:0,x_max:803,ha:917,o:"m 803 0 l 667 0 l 667 475 l 140 475 l 140 0 l 0 0 l 0 1013 l 140 1013 l 140 599 l 667 599 l 667 1013 l 803 1013 l 803 0 "},Α:{x_min:0,x_max:906.953125,ha:985,o:"m 906 0 l 756 0 l 650 303 l 251 303 l 143 0 l 0 0 l 376 1013 l 529 1013 l 906 0 m 609 421 l 452 866 l 293 421 l 609 421 "},s:{x_min:0,x_max:604,ha:697,o:"m 604 217 q 501 36 604 104 q 292 -23 411 -23 q 86 43 166 -23 q 0 238 0 114 l 121 237 q 175 122 121 164 q 300 85 223 85 q 415 112 363 85 q 479 207 479 147 q 361 309 479 276 q 140 372 141 370 q 21 544 21 426 q 111 708 21 647 q 298 761 190 761 q 492 705 413 761 q 583 531 583 643 l 462 531 q 412 625 462 594 q 298 657 363 657 q 199 636 242 657 q 143 558 143 608 q 262 454 143 486 q 484 394 479 397 q 604 217 604 341 "},B:{x_min:0,x_max:778,ha:876,o:"m 580 546 q 724 469 670 535 q 778 311 778 403 q 673 83 778 171 q 432 0 575 0 l 0 0 l 0 1013 l 411 1013 q 629 957 541 1013 q 732 768 732 892 q 691 633 732 693 q 580 546 650 572 m 393 899 l 139 899 l 139 588 l 379 588 q 521 624 462 588 q 592 744 592 667 q 531 859 592 819 q 393 899 471 899 m 419 124 q 566 169 504 124 q 635 303 635 219 q 559 436 635 389 q 402 477 494 477 l 139 477 l 139 124 l 419 124 "},"…":{x_min:0,x_max:614,ha:708,o:"m 142 0 l 0 0 l 0 151 l 142 151 l 142 0 m 378 0 l 236 0 l 236 151 l 378 151 l 378 0 m 614 0 l 472 0 l 472 151 l 614 151 l 614 0 "},"?":{x_min:0,x_max:607,ha:704,o:"m 607 777 q 543 599 607 674 q 422 474 482 537 q 357 272 357 391 l 236 272 q 297 487 236 395 q 411 619 298 490 q 474 762 474 691 q 422 885 474 838 q 301 933 371 933 q 179 880 228 933 q 124 706 124 819 l 0 706 q 94 963 0 872 q 302 1044 177 1044 q 511 973 423 1044 q 607 777 607 895 m 370 0 l 230 0 l 230 151 l 370 151 l 370 0 "},H:{x_min:0,x_max:803,ha:915,o:"m 803 0 l 667 0 l 667 475 l 140 475 l 140 0 l 0 0 l 0 1013 l 140 1013 l 140 599 l 667 599 l 667 1013 l 803 1013 l 803 0 "},ν:{x_min:0,x_max:675,ha:761,o:"m 675 738 l 404 0 l 272 0 l 0 738 l 133 738 l 340 147 l 541 738 l 675 738 "},c:{x_min:1,x_max:701.390625,ha:775,o:"m 701 264 q 584 53 681 133 q 353 -26 487 -26 q 91 91 188 -26 q 1 370 1 201 q 92 645 1 537 q 353 761 190 761 q 572 688 479 761 q 690 493 666 615 l 556 493 q 487 606 545 562 q 356 650 428 650 q 186 563 246 650 q 134 372 134 487 q 188 179 134 258 q 359 88 250 88 q 492 136 437 88 q 566 264 548 185 l 701 264 "},"¶":{x_min:0,x_max:566.671875,ha:678,o:"m 21 892 l 52 892 l 98 761 l 145 892 l 176 892 l 178 741 l 157 741 l 157 867 l 108 741 l 88 741 l 40 871 l 40 741 l 21 741 l 21 892 m 308 854 l 308 731 q 252 691 308 691 q 227 691 240 691 q 207 696 213 695 l 207 712 l 253 706 q 288 733 288 706 l 288 763 q 244 741 279 741 q 193 797 193 741 q 261 860 193 860 q 287 860 273 860 q 308 854 302 855 m 288 842 l 263 843 q 213 796 213 843 q 248 756 213 756 q 288 796 288 756 l 288 842 m 566 988 l 502 988 l 502 -1 l 439 -1 l 439 988 l 317 988 l 317 -1 l 252 -1 l 252 602 q 81 653 155 602 q 0 805 0 711 q 101 989 0 918 q 309 1053 194 1053 l 566 1053 l 566 988 "},β:{x_min:0,x_max:660,ha:745,o:"m 471 550 q 610 450 561 522 q 660 280 660 378 q 578 64 660 151 q 367 -22 497 -22 q 239 5 299 -22 q 126 82 178 32 l 126 -278 l 0 -278 l 0 593 q 54 903 0 801 q 318 1042 127 1042 q 519 964 436 1042 q 603 771 603 887 q 567 644 603 701 q 471 550 532 586 m 337 79 q 476 138 418 79 q 535 279 535 198 q 427 437 535 386 q 226 477 344 477 l 226 583 q 398 620 329 583 q 486 762 486 668 q 435 884 486 833 q 312 935 384 935 q 169 861 219 935 q 126 698 126 797 l 126 362 q 170 169 126 242 q 337 79 224 79 "},Μ:{x_min:0,x_max:954,ha:1068,o:"m 954 0 l 819 0 l 819 868 l 537 0 l 405 0 l 128 865 l 128 0 l 0 0 l 0 1013 l 199 1013 l 472 158 l 758 1013 l 954 1013 l 954 0 "},Ό:{x_min:.109375,x_max:1120,ha:1217,o:"m 1120 505 q 994 132 1120 282 q 642 -29 861 -29 q 290 130 422 -29 q 167 505 167 280 q 294 883 167 730 q 650 1046 430 1046 q 999 882 868 1046 q 1120 505 1120 730 m 977 504 q 896 784 977 669 q 644 915 804 915 q 391 785 484 915 q 307 504 307 669 q 391 224 307 339 q 644 95 486 95 q 894 224 803 95 q 977 504 977 339 m 277 1040 l 83 799 l 0 799 l 140 1040 l 277 1040 "},Ή:{x_min:0,x_max:1158,ha:1275,o:"m 1158 0 l 1022 0 l 1022 475 l 496 475 l 496 0 l 356 0 l 356 1012 l 496 1012 l 496 599 l 1022 599 l 1022 1012 l 1158 1012 l 1158 0 m 277 1040 l 83 799 l 0 799 l 140 1040 l 277 1040 "},"•":{x_min:0,x_max:663.890625,ha:775,o:"m 663 529 q 566 293 663 391 q 331 196 469 196 q 97 294 194 196 q 0 529 0 393 q 96 763 0 665 q 331 861 193 861 q 566 763 469 861 q 663 529 663 665 "},"¥":{x_min:.1875,x_max:819.546875,ha:886,o:"m 563 561 l 697 561 l 696 487 l 520 487 l 482 416 l 482 380 l 697 380 l 695 308 l 482 308 l 482 0 l 342 0 l 342 308 l 125 308 l 125 380 l 342 380 l 342 417 l 303 487 l 125 487 l 125 561 l 258 561 l 0 1013 l 140 1013 l 411 533 l 679 1013 l 819 1013 l 563 561 "},"(":{x_min:0,x_max:318.0625,ha:415,o:"m 318 -290 l 230 -290 q 61 23 122 -142 q 0 365 0 190 q 62 712 0 540 q 230 1024 119 869 l 318 1024 q 175 705 219 853 q 125 360 125 542 q 176 22 125 187 q 318 -290 223 -127 "},U:{x_min:0,x_max:796,ha:904,o:"m 796 393 q 681 93 796 212 q 386 -25 566 -25 q 101 95 208 -25 q 0 393 0 211 l 0 1013 l 138 1013 l 138 391 q 204 191 138 270 q 394 107 276 107 q 586 191 512 107 q 656 391 656 270 l 656 1013 l 796 1013 l 796 393 "},γ:{x_min:.5,x_max:744.953125,ha:822,o:"m 744 737 l 463 54 l 463 -278 l 338 -278 l 338 54 l 154 495 q 104 597 124 569 q 13 651 67 651 l 0 651 l 0 751 l 39 753 q 168 711 121 753 q 242 594 207 676 l 403 208 l 617 737 l 744 737 "},α:{x_min:0,x_max:765.5625,ha:809,o:"m 765 -4 q 698 -14 726 -14 q 564 97 586 -14 q 466 7 525 40 q 337 -26 407 -26 q 88 98 186 -26 q 0 369 0 212 q 88 637 0 525 q 337 760 184 760 q 465 728 407 760 q 563 637 524 696 l 563 739 l 685 739 l 685 222 q 693 141 685 168 q 748 94 708 94 q 765 96 760 94 l 765 -4 m 584 371 q 531 562 584 485 q 360 653 470 653 q 192 566 254 653 q 135 379 135 489 q 186 181 135 261 q 358 84 247 84 q 528 176 465 84 q 584 371 584 260 "},F:{x_min:0,x_max:683.328125,ha:717,o:"m 683 888 l 140 888 l 140 583 l 613 583 l 613 458 l 140 458 l 140 0 l 0 0 l 0 1013 l 683 1013 l 683 888 "},"­":{x_min:0,x_max:705.5625,ha:803,o:"m 705 334 l 0 334 l 0 410 l 705 410 l 705 334 "},":":{x_min:0,x_max:142,ha:239,o:"m 142 585 l 0 585 l 0 738 l 142 738 l 142 585 m 142 0 l 0 0 l 0 151 l 142 151 l 142 0 "},Χ:{x_min:0,x_max:854.171875,ha:935,o:"m 854 0 l 683 0 l 423 409 l 166 0 l 0 0 l 347 519 l 18 1013 l 186 1013 l 427 637 l 675 1013 l 836 1013 l 504 521 l 854 0 "},"*":{x_min:116,x_max:674,ha:792,o:"m 674 768 l 475 713 l 610 544 l 517 477 l 394 652 l 272 478 l 178 544 l 314 713 l 116 766 l 153 876 l 341 812 l 342 1013 l 446 1013 l 446 811 l 635 874 l 674 768 "},"†":{x_min:0,x_max:777,ha:835,o:"m 458 804 l 777 804 l 777 683 l 458 683 l 458 0 l 319 0 l 319 681 l 0 683 l 0 804 l 319 804 l 319 1015 l 458 1013 l 458 804 "},"°":{x_min:0,x_max:347,ha:444,o:"m 173 802 q 43 856 91 802 q 0 977 0 905 q 45 1101 0 1049 q 173 1153 90 1153 q 303 1098 255 1153 q 347 977 347 1049 q 303 856 347 905 q 173 802 256 802 m 173 884 q 238 910 214 884 q 262 973 262 937 q 239 1038 262 1012 q 173 1064 217 1064 q 108 1037 132 1064 q 85 973 85 1010 q 108 910 85 937 q 173 884 132 884 "},V:{x_min:0,x_max:862.71875,ha:940,o:"m 862 1013 l 505 0 l 361 0 l 0 1013 l 143 1013 l 434 165 l 718 1012 l 862 1013 "},Ξ:{x_min:0,x_max:734.71875,ha:763,o:"m 723 889 l 9 889 l 9 1013 l 723 1013 l 723 889 m 673 463 l 61 463 l 61 589 l 673 589 l 673 463 m 734 0 l 0 0 l 0 124 l 734 124 l 734 0 "}," ":{x_min:0,x_max:0,ha:853},Ϋ:{x_min:.328125,x_max:819.515625,ha:889,o:"m 588 1046 l 460 1046 l 460 1189 l 588 1189 l 588 1046 m 360 1046 l 232 1046 l 232 1189 l 360 1189 l 360 1046 m 819 1012 l 482 416 l 482 0 l 342 0 l 342 416 l 0 1012 l 140 1012 l 411 533 l 679 1012 l 819 1012 "},"”":{x_min:0,x_max:347,ha:454,o:"m 139 851 q 102 737 139 784 q 0 669 65 690 l 0 734 q 59 787 42 741 q 72 873 72 821 l 0 873 l 0 1013 l 139 1013 l 139 851 m 347 851 q 310 737 347 784 q 208 669 273 690 l 208 734 q 267 787 250 741 q 280 873 280 821 l 208 873 l 208 1013 l 347 1013 l 347 851 "},"@":{x_min:0,x_max:1260,ha:1357,o:"m 1098 -45 q 877 -160 1001 -117 q 633 -203 752 -203 q 155 -29 327 -203 q 0 360 0 127 q 176 802 0 616 q 687 1008 372 1008 q 1123 854 969 1008 q 1260 517 1260 718 q 1155 216 1260 341 q 868 82 1044 82 q 772 106 801 82 q 737 202 737 135 q 647 113 700 144 q 527 82 594 82 q 367 147 420 82 q 314 312 314 212 q 401 565 314 452 q 639 690 498 690 q 810 588 760 690 l 849 668 l 938 668 q 877 441 900 532 q 833 226 833 268 q 853 182 833 198 q 902 167 873 167 q 1088 272 1012 167 q 1159 512 1159 372 q 1051 793 1159 681 q 687 925 925 925 q 248 747 415 925 q 97 361 97 586 q 226 26 97 159 q 627 -122 370 -122 q 856 -87 737 -122 q 1061 8 976 -53 l 1098 -45 m 786 488 q 738 580 777 545 q 643 615 700 615 q 483 517 548 615 q 425 322 425 430 q 457 203 425 250 q 552 156 490 156 q 722 273 665 156 q 786 488 738 309 "},Ί:{x_min:0,x_max:499,ha:613,o:"m 277 1040 l 83 799 l 0 799 l 140 1040 l 277 1040 m 499 0 l 360 0 l 360 1012 l 499 1012 l 499 0 "},i:{x_min:14,x_max:136,ha:275,o:"m 136 873 l 14 873 l 14 1013 l 136 1013 l 136 873 m 136 0 l 14 0 l 14 737 l 136 737 l 136 0 "},Β:{x_min:0,x_max:778,ha:877,o:"m 580 545 q 724 468 671 534 q 778 310 778 402 q 673 83 778 170 q 432 0 575 0 l 0 0 l 0 1013 l 411 1013 q 629 957 541 1013 q 732 768 732 891 q 691 632 732 692 q 580 545 650 571 m 393 899 l 139 899 l 139 587 l 379 587 q 521 623 462 587 q 592 744 592 666 q 531 859 592 819 q 393 899 471 899 m 419 124 q 566 169 504 124 q 635 302 635 219 q 559 435 635 388 q 402 476 494 476 l 139 476 l 139 124 l 419 124 "},υ:{x_min:0,x_max:617,ha:725,o:"m 617 352 q 540 94 617 199 q 308 -24 455 -24 q 76 94 161 -24 q 0 352 0 199 l 0 739 l 126 739 l 126 355 q 169 185 126 257 q 312 98 220 98 q 451 185 402 98 q 492 355 492 257 l 492 739 l 617 739 l 617 352 "},"]":{x_min:0,x_max:275,ha:372,o:"m 275 -281 l 0 -281 l 0 -187 l 151 -187 l 151 920 l 0 920 l 0 1013 l 275 1013 l 275 -281 "},m:{x_min:0,x_max:1019,ha:1128,o:"m 1019 0 l 897 0 l 897 454 q 860 591 897 536 q 739 660 816 660 q 613 586 659 660 q 573 436 573 522 l 573 0 l 447 0 l 447 455 q 412 591 447 535 q 294 657 372 657 q 165 586 213 657 q 122 437 122 521 l 122 0 l 0 0 l 0 738 l 117 738 l 117 640 q 202 730 150 697 q 316 763 254 763 q 437 730 381 763 q 525 642 494 697 q 621 731 559 700 q 753 763 682 763 q 943 694 867 763 q 1019 512 1019 625 l 1019 0 "},χ:{x_min:8.328125,x_max:780.5625,ha:815,o:"m 780 -278 q 715 -294 747 -294 q 616 -257 663 -294 q 548 -175 576 -227 l 379 133 l 143 -277 l 9 -277 l 313 254 l 163 522 q 127 586 131 580 q 36 640 91 640 q 8 637 27 640 l 8 752 l 52 757 q 162 719 113 757 q 236 627 200 690 l 383 372 l 594 737 l 726 737 l 448 250 l 625 -69 q 670 -153 647 -110 q 743 -188 695 -188 q 780 -184 759 -188 l 780 -278 "},ί:{x_min:42,x_max:326.71875,ha:361,o:"m 284 3 q 233 -10 258 -5 q 182 -15 207 -15 q 85 26 119 -15 q 42 200 42 79 l 42 737 l 167 737 l 168 215 q 172 141 168 157 q 226 101 183 101 q 248 102 239 101 q 284 112 257 104 l 284 3 m 326 1040 l 137 819 l 54 819 l 189 1040 l 326 1040 "},Ζ:{x_min:0,x_max:779.171875,ha:850,o:"m 779 0 l 0 0 l 0 113 l 620 896 l 40 896 l 40 1013 l 779 1013 l 779 887 l 170 124 l 779 124 l 779 0 "},R:{x_min:0,x_max:781.953125,ha:907,o:"m 781 0 l 623 0 q 587 242 590 52 q 407 433 585 433 l 138 433 l 138 0 l 0 0 l 0 1013 l 396 1013 q 636 946 539 1013 q 749 731 749 868 q 711 597 749 659 q 608 502 674 534 q 718 370 696 474 q 729 207 722 352 q 781 26 736 62 l 781 0 m 373 551 q 533 594 465 551 q 614 731 614 645 q 532 859 614 815 q 373 896 465 896 l 138 896 l 138 551 l 373 551 "},o:{x_min:0,x_max:713,ha:821,o:"m 357 -25 q 94 91 194 -25 q 0 368 0 202 q 93 642 0 533 q 357 761 193 761 q 618 644 518 761 q 713 368 713 533 q 619 91 713 201 q 357 -25 521 -25 m 357 85 q 528 175 465 85 q 584 369 584 255 q 529 562 584 484 q 357 651 467 651 q 189 560 250 651 q 135 369 135 481 q 187 177 135 257 q 357 85 250 85 "},K:{x_min:0,x_max:819.46875,ha:906,o:"m 819 0 l 649 0 l 294 509 l 139 355 l 139 0 l 0 0 l 0 1013 l 139 1013 l 139 526 l 626 1013 l 809 1013 l 395 600 l 819 0 "},",":{x_min:0,x_max:142,ha:239,o:"m 142 -12 q 105 -132 142 -82 q 0 -205 68 -182 l 0 -138 q 57 -82 40 -124 q 70 0 70 -51 l 0 0 l 0 151 l 142 151 l 142 -12 "},d:{x_min:0,x_max:683,ha:796,o:"m 683 0 l 564 0 l 564 93 q 456 6 516 38 q 327 -25 395 -25 q 87 100 181 -25 q 0 365 0 215 q 90 639 0 525 q 343 763 187 763 q 564 647 486 763 l 564 1013 l 683 1013 l 683 0 m 582 373 q 529 562 582 484 q 361 653 468 653 q 190 561 253 653 q 135 365 135 479 q 189 175 135 254 q 358 85 251 85 q 529 178 468 85 q 582 373 582 258 "},"¨":{x_min:-109,x_max:247,ha:232,o:"m 247 1046 l 119 1046 l 119 1189 l 247 1189 l 247 1046 m 19 1046 l -109 1046 l -109 1189 l 19 1189 l 19 1046 "},E:{x_min:0,x_max:736.109375,ha:789,o:"m 736 0 l 0 0 l 0 1013 l 725 1013 l 725 889 l 139 889 l 139 585 l 677 585 l 677 467 l 139 467 l 139 125 l 736 125 l 736 0 "},Y:{x_min:0,x_max:820,ha:886,o:"m 820 1013 l 482 416 l 482 0 l 342 0 l 342 416 l 0 1013 l 140 1013 l 411 534 l 679 1012 l 820 1013 "},'"':{x_min:0,x_max:299,ha:396,o:"m 299 606 l 203 606 l 203 988 l 299 988 l 299 606 m 96 606 l 0 606 l 0 988 l 96 988 l 96 606 "},"‹":{x_min:17.984375,x_max:773.609375,ha:792,o:"m 773 40 l 18 376 l 17 465 l 773 799 l 773 692 l 159 420 l 773 149 l 773 40 "},"„":{x_min:0,x_max:364,ha:467,o:"m 141 -12 q 104 -132 141 -82 q 0 -205 67 -182 l 0 -138 q 56 -82 40 -124 q 69 0 69 -51 l 0 0 l 0 151 l 141 151 l 141 -12 m 364 -12 q 327 -132 364 -82 q 222 -205 290 -182 l 222 -138 q 279 -82 262 -124 q 292 0 292 -51 l 222 0 l 222 151 l 364 151 l 364 -12 "},δ:{x_min:1,x_max:710,ha:810,o:"m 710 360 q 616 87 710 196 q 356 -28 518 -28 q 99 82 197 -28 q 1 356 1 192 q 100 606 1 509 q 355 703 199 703 q 180 829 288 754 q 70 903 124 866 l 70 1012 l 643 1012 l 643 901 l 258 901 q 462 763 422 794 q 636 592 577 677 q 710 360 710 485 m 584 365 q 552 501 584 447 q 451 602 521 555 q 372 611 411 611 q 197 541 258 611 q 136 355 136 472 q 190 171 136 245 q 358 85 252 85 q 528 173 465 85 q 584 365 584 252 "},έ:{x_min:0,x_max:634.71875,ha:714,o:"m 634 234 q 527 38 634 110 q 300 -25 433 -25 q 98 29 183 -25 q 0 204 0 93 q 37 313 0 265 q 128 390 67 352 q 56 459 82 419 q 26 555 26 505 q 114 712 26 654 q 295 763 191 763 q 499 700 416 763 q 589 515 589 631 l 478 515 q 419 618 464 580 q 307 657 374 657 q 207 630 253 657 q 151 547 151 598 q 238 445 151 469 q 389 434 280 434 l 389 331 l 349 331 q 206 315 255 331 q 125 210 125 287 q 183 107 125 145 q 302 76 233 76 q 436 117 379 76 q 509 234 493 159 l 634 234 m 520 1040 l 331 819 l 248 819 l 383 1040 l 520 1040 "},ω:{x_min:0,x_max:922,ha:1031,o:"m 922 339 q 856 97 922 203 q 650 -26 780 -26 q 538 9 587 -26 q 461 103 489 44 q 387 12 436 46 q 277 -22 339 -22 q 69 97 147 -22 q 0 339 0 203 q 45 551 0 444 q 161 738 84 643 l 302 738 q 175 553 219 647 q 124 336 124 446 q 155 179 124 249 q 275 88 197 88 q 375 163 341 88 q 400 294 400 219 l 400 572 l 524 572 l 524 294 q 561 135 524 192 q 643 88 591 88 q 762 182 719 88 q 797 342 797 257 q 745 556 797 450 q 619 738 705 638 l 760 738 q 874 551 835 640 q 922 339 922 444 "},"´":{x_min:0,x_max:96,ha:251,o:"m 96 606 l 0 606 l 0 988 l 96 988 l 96 606 "},"±":{x_min:11,x_max:781,ha:792,o:"m 781 490 l 446 490 l 446 255 l 349 255 l 349 490 l 11 490 l 11 586 l 349 586 l 349 819 l 446 819 l 446 586 l 781 586 l 781 490 m 781 21 l 11 21 l 11 115 l 781 115 l 781 21 "},"|":{x_min:343,x_max:449,ha:792,o:"m 449 462 l 343 462 l 343 986 l 449 986 l 449 462 m 449 -242 l 343 -242 l 343 280 l 449 280 l 449 -242 "},ϋ:{x_min:0,x_max:617,ha:725,o:"m 482 800 l 372 800 l 372 925 l 482 925 l 482 800 m 239 800 l 129 800 l 129 925 l 239 925 l 239 800 m 617 352 q 540 93 617 199 q 308 -24 455 -24 q 76 93 161 -24 q 0 352 0 199 l 0 738 l 126 738 l 126 354 q 169 185 126 257 q 312 98 220 98 q 451 185 402 98 q 492 354 492 257 l 492 738 l 617 738 l 617 352 "},"§":{x_min:0,x_max:593,ha:690,o:"m 593 425 q 554 312 593 369 q 467 233 516 254 q 537 83 537 172 q 459 -74 537 -12 q 288 -133 387 -133 q 115 -69 184 -133 q 47 96 47 -6 l 166 96 q 199 7 166 40 q 288 -26 232 -26 q 371 -5 332 -26 q 420 60 420 21 q 311 201 420 139 q 108 309 210 255 q 0 490 0 383 q 33 602 0 551 q 124 687 66 654 q 75 743 93 712 q 58 812 58 773 q 133 984 58 920 q 300 1043 201 1043 q 458 987 394 1043 q 529 814 529 925 l 411 814 q 370 908 404 877 q 289 939 336 939 q 213 911 246 939 q 180 841 180 883 q 286 720 180 779 q 484 612 480 615 q 593 425 593 534 m 467 409 q 355 544 467 473 q 196 630 228 612 q 146 587 162 609 q 124 525 124 558 q 239 387 124 462 q 398 298 369 315 q 448 345 429 316 q 467 409 467 375 "},b:{x_min:0,x_max:685,ha:783,o:"m 685 372 q 597 99 685 213 q 347 -25 501 -25 q 219 5 277 -25 q 121 93 161 36 l 121 0 l 0 0 l 0 1013 l 121 1013 l 121 634 q 214 723 157 692 q 341 754 272 754 q 591 637 493 754 q 685 372 685 526 m 554 356 q 499 550 554 470 q 328 644 437 644 q 162 556 223 644 q 108 369 108 478 q 160 176 108 256 q 330 83 221 83 q 498 169 435 83 q 554 356 554 245 "},q:{x_min:0,x_max:683,ha:876,o:"m 683 -278 l 564 -278 l 564 97 q 474 8 533 39 q 345 -23 415 -23 q 91 93 188 -23 q 0 364 0 203 q 87 635 0 522 q 337 760 184 760 q 466 727 408 760 q 564 637 523 695 l 564 737 l 683 737 l 683 -278 m 582 375 q 527 564 582 488 q 358 652 466 652 q 190 565 253 652 q 135 377 135 488 q 189 179 135 261 q 361 84 251 84 q 530 179 469 84 q 582 375 582 260 "},Ω:{x_min:-.171875,x_max:969.5625,ha:1068,o:"m 969 0 l 555 0 l 555 123 q 744 308 675 194 q 814 558 814 423 q 726 812 814 709 q 484 922 633 922 q 244 820 334 922 q 154 567 154 719 q 223 316 154 433 q 412 123 292 199 l 412 0 l 0 0 l 0 124 l 217 124 q 68 327 122 210 q 15 572 15 444 q 144 911 15 781 q 484 1041 274 1041 q 822 909 691 1041 q 953 569 953 777 q 899 326 953 443 q 750 124 846 210 l 969 124 l 969 0 "},ύ:{x_min:0,x_max:617,ha:725,o:"m 617 352 q 540 93 617 199 q 308 -24 455 -24 q 76 93 161 -24 q 0 352 0 199 l 0 738 l 126 738 l 126 354 q 169 185 126 257 q 312 98 220 98 q 451 185 402 98 q 492 354 492 257 l 492 738 l 617 738 l 617 352 m 535 1040 l 346 819 l 262 819 l 397 1040 l 535 1040 "},z:{x_min:-.015625,x_max:613.890625,ha:697,o:"m 613 0 l 0 0 l 0 100 l 433 630 l 20 630 l 20 738 l 594 738 l 593 636 l 163 110 l 613 110 l 613 0 "},"™":{x_min:0,x_max:894,ha:1e3,o:"m 389 951 l 229 951 l 229 503 l 160 503 l 160 951 l 0 951 l 0 1011 l 389 1011 l 389 951 m 894 503 l 827 503 l 827 939 l 685 503 l 620 503 l 481 937 l 481 503 l 417 503 l 417 1011 l 517 1011 l 653 580 l 796 1010 l 894 1011 l 894 503 "},ή:{x_min:.78125,x_max:697,ha:810,o:"m 697 -278 l 572 -278 l 572 454 q 540 587 572 536 q 425 650 501 650 q 271 579 337 650 q 206 420 206 509 l 206 0 l 81 0 l 81 489 q 73 588 81 562 q 0 644 56 644 l 0 741 q 68 755 38 755 q 158 721 124 755 q 200 630 193 687 q 297 726 234 692 q 434 761 359 761 q 620 692 544 761 q 697 516 697 624 l 697 -278 m 479 1040 l 290 819 l 207 819 l 341 1040 l 479 1040 "},Θ:{x_min:0,x_max:960,ha:1056,o:"m 960 507 q 833 129 960 280 q 476 -32 698 -32 q 123 129 255 -32 q 0 507 0 280 q 123 883 0 732 q 476 1045 255 1045 q 832 883 696 1045 q 960 507 960 732 m 817 500 q 733 789 817 669 q 476 924 639 924 q 223 792 317 924 q 142 507 142 675 q 222 222 142 339 q 476 89 315 89 q 730 218 636 89 q 817 500 817 334 m 716 449 l 243 449 l 243 571 l 716 571 l 716 449 "},"®":{x_min:-3,x_max:1008,ha:1106,o:"m 503 532 q 614 562 566 532 q 672 658 672 598 q 614 747 672 716 q 503 772 569 772 l 338 772 l 338 532 l 503 532 m 502 -7 q 123 151 263 -7 q -3 501 -3 294 q 123 851 -3 706 q 502 1011 263 1011 q 881 851 739 1011 q 1008 501 1008 708 q 883 151 1008 292 q 502 -7 744 -7 m 502 60 q 830 197 709 60 q 940 501 940 322 q 831 805 940 681 q 502 944 709 944 q 174 805 296 944 q 65 501 65 680 q 173 197 65 320 q 502 60 294 60 m 788 146 l 678 146 q 653 316 655 183 q 527 449 652 449 l 338 449 l 338 146 l 241 146 l 241 854 l 518 854 q 688 808 621 854 q 766 658 766 755 q 739 563 766 607 q 668 497 713 519 q 751 331 747 472 q 788 164 756 190 l 788 146 "},"~":{x_min:0,x_max:833,ha:931,o:"m 833 958 q 778 753 833 831 q 594 665 716 665 q 402 761 502 665 q 240 857 302 857 q 131 795 166 857 q 104 665 104 745 l 0 665 q 54 867 0 789 q 237 958 116 958 q 429 861 331 958 q 594 765 527 765 q 704 827 670 765 q 729 958 729 874 l 833 958 "},Ε:{x_min:0,x_max:736.21875,ha:778,o:"m 736 0 l 0 0 l 0 1013 l 725 1013 l 725 889 l 139 889 l 139 585 l 677 585 l 677 467 l 139 467 l 139 125 l 736 125 l 736 0 "},"³":{x_min:0,x_max:450,ha:547,o:"m 450 552 q 379 413 450 464 q 220 366 313 366 q 69 414 130 366 q 0 567 0 470 l 85 567 q 126 470 85 504 q 225 437 168 437 q 320 467 280 437 q 360 552 360 498 q 318 632 360 608 q 213 657 276 657 q 195 657 203 657 q 176 657 181 657 l 176 722 q 279 733 249 722 q 334 815 334 752 q 300 881 334 856 q 220 907 267 907 q 133 875 169 907 q 97 781 97 844 l 15 781 q 78 926 15 875 q 220 972 135 972 q 364 930 303 972 q 426 817 426 888 q 344 697 426 733 q 421 642 392 681 q 450 552 450 603 "},"[":{x_min:0,x_max:273.609375,ha:371,o:"m 273 -281 l 0 -281 l 0 1013 l 273 1013 l 273 920 l 124 920 l 124 -187 l 273 -187 l 273 -281 "},L:{x_min:0,x_max:645.828125,ha:696,o:"m 645 0 l 0 0 l 0 1013 l 140 1013 l 140 126 l 645 126 l 645 0 "},σ:{x_min:0,x_max:803.390625,ha:894,o:"m 803 628 l 633 628 q 713 368 713 512 q 618 93 713 204 q 357 -25 518 -25 q 94 91 194 -25 q 0 368 0 201 q 94 644 0 533 q 356 761 194 761 q 481 750 398 761 q 608 739 564 739 l 803 739 l 803 628 m 360 85 q 529 180 467 85 q 584 374 584 262 q 527 566 584 490 q 352 651 463 651 q 187 559 247 651 q 135 368 135 478 q 189 175 135 254 q 360 85 251 85 "},ζ:{x_min:0,x_max:573,ha:642,o:"m 573 -40 q 553 -162 573 -97 q 510 -278 543 -193 l 400 -278 q 441 -187 428 -219 q 462 -90 462 -132 q 378 -14 462 -14 q 108 45 197 -14 q 0 290 0 117 q 108 631 0 462 q 353 901 194 767 l 55 901 l 55 1012 l 561 1012 l 561 924 q 261 669 382 831 q 128 301 128 489 q 243 117 128 149 q 458 98 350 108 q 573 -40 573 80 "},θ:{x_min:0,x_max:674,ha:778,o:"m 674 496 q 601 160 674 304 q 336 -26 508 -26 q 73 153 165 -26 q 0 485 0 296 q 72 840 0 683 q 343 1045 166 1045 q 605 844 516 1045 q 674 496 674 692 m 546 579 q 498 798 546 691 q 336 935 437 935 q 178 798 237 935 q 126 579 137 701 l 546 579 m 546 475 l 126 475 q 170 233 126 348 q 338 80 230 80 q 504 233 447 80 q 546 475 546 346 "},Ο:{x_min:0,x_max:958,ha:1054,o:"m 485 1042 q 834 883 703 1042 q 958 511 958 735 q 834 136 958 287 q 481 -26 701 -26 q 126 130 261 -26 q 0 504 0 279 q 127 880 0 729 q 485 1042 263 1042 m 480 98 q 731 225 638 98 q 815 504 815 340 q 733 783 815 670 q 480 913 640 913 q 226 785 321 913 q 142 504 142 671 q 226 224 142 339 q 480 98 319 98 "},Γ:{x_min:0,x_max:705.28125,ha:749,o:"m 705 886 l 140 886 l 140 0 l 0 0 l 0 1012 l 705 1012 l 705 886 "}," ":{x_min:0,x_max:0,ha:375},"%":{x_min:-3,x_max:1089,ha:1186,o:"m 845 0 q 663 76 731 0 q 602 244 602 145 q 661 412 602 344 q 845 489 728 489 q 1027 412 959 489 q 1089 244 1089 343 q 1029 76 1089 144 q 845 0 962 0 m 844 103 q 945 143 909 103 q 981 243 981 184 q 947 340 981 301 q 844 385 909 385 q 744 342 781 385 q 708 243 708 300 q 741 147 708 186 q 844 103 780 103 m 888 986 l 284 -25 l 199 -25 l 803 986 l 888 986 m 241 468 q 58 545 126 468 q -3 715 -3 615 q 56 881 -3 813 q 238 958 124 958 q 421 881 353 958 q 483 712 483 813 q 423 544 483 612 q 241 468 356 468 m 241 855 q 137 811 175 855 q 100 710 100 768 q 136 612 100 653 q 240 572 172 572 q 344 614 306 572 q 382 713 382 656 q 347 810 382 771 q 241 855 308 855 "},P:{x_min:0,x_max:726,ha:806,o:"m 424 1013 q 640 931 555 1013 q 726 719 726 850 q 637 506 726 587 q 413 426 548 426 l 140 426 l 140 0 l 0 0 l 0 1013 l 424 1013 m 379 889 l 140 889 l 140 548 l 372 548 q 522 589 459 548 q 593 720 593 637 q 528 845 593 801 q 379 889 463 889 "},Έ:{x_min:0,x_max:1078.21875,ha:1118,o:"m 1078 0 l 342 0 l 342 1013 l 1067 1013 l 1067 889 l 481 889 l 481 585 l 1019 585 l 1019 467 l 481 467 l 481 125 l 1078 125 l 1078 0 m 277 1040 l 83 799 l 0 799 l 140 1040 l 277 1040 "},Ώ:{x_min:.125,x_max:1136.546875,ha:1235,o:"m 1136 0 l 722 0 l 722 123 q 911 309 842 194 q 981 558 981 423 q 893 813 981 710 q 651 923 800 923 q 411 821 501 923 q 321 568 321 720 q 390 316 321 433 q 579 123 459 200 l 579 0 l 166 0 l 166 124 l 384 124 q 235 327 289 210 q 182 572 182 444 q 311 912 182 782 q 651 1042 441 1042 q 989 910 858 1042 q 1120 569 1120 778 q 1066 326 1120 443 q 917 124 1013 210 l 1136 124 l 1136 0 m 277 1040 l 83 800 l 0 800 l 140 1041 l 277 1040 "},_:{x_min:0,x_max:705.5625,ha:803,o:"m 705 -334 l 0 -334 l 0 -234 l 705 -234 l 705 -334 "},Ϊ:{x_min:-110,x_max:246,ha:275,o:"m 246 1046 l 118 1046 l 118 1189 l 246 1189 l 246 1046 m 18 1046 l -110 1046 l -110 1189 l 18 1189 l 18 1046 m 136 0 l 0 0 l 0 1012 l 136 1012 l 136 0 "},"+":{x_min:23,x_max:768,ha:792,o:"m 768 372 l 444 372 l 444 0 l 347 0 l 347 372 l 23 372 l 23 468 l 347 468 l 347 840 l 444 840 l 444 468 l 768 468 l 768 372 "},"½":{x_min:0,x_max:1050,ha:1149,o:"m 1050 0 l 625 0 q 712 178 625 108 q 878 277 722 187 q 967 385 967 328 q 932 456 967 429 q 850 484 897 484 q 759 450 798 484 q 721 352 721 416 l 640 352 q 706 502 640 448 q 851 551 766 551 q 987 509 931 551 q 1050 385 1050 462 q 976 251 1050 301 q 829 179 902 215 q 717 68 740 133 l 1050 68 l 1050 0 m 834 985 l 215 -28 l 130 -28 l 750 984 l 834 985 m 224 422 l 142 422 l 142 811 l 0 811 l 0 867 q 104 889 62 867 q 164 973 157 916 l 224 973 l 224 422 "},Ρ:{x_min:0,x_max:720,ha:783,o:"m 424 1013 q 637 933 554 1013 q 720 723 720 853 q 633 508 720 591 q 413 426 546 426 l 140 426 l 140 0 l 0 0 l 0 1013 l 424 1013 m 378 889 l 140 889 l 140 548 l 371 548 q 521 589 458 548 q 592 720 592 637 q 527 845 592 801 q 378 889 463 889 "},"'":{x_min:0,x_max:139,ha:236,o:"m 139 851 q 102 737 139 784 q 0 669 65 690 l 0 734 q 59 787 42 741 q 72 873 72 821 l 0 873 l 0 1013 l 139 1013 l 139 851 "},ª:{x_min:0,x_max:350,ha:397,o:"m 350 625 q 307 616 328 616 q 266 631 281 616 q 247 673 251 645 q 190 628 225 644 q 116 613 156 613 q 32 641 64 613 q 0 722 0 669 q 72 826 0 800 q 247 866 159 846 l 247 887 q 220 934 247 916 q 162 953 194 953 q 104 934 129 953 q 76 882 80 915 l 16 882 q 60 976 16 941 q 166 1011 104 1011 q 266 979 224 1011 q 308 891 308 948 l 308 706 q 311 679 308 688 q 331 670 315 670 l 350 672 l 350 625 m 247 757 l 247 811 q 136 790 175 798 q 64 726 64 773 q 83 682 64 697 q 132 667 103 667 q 207 690 174 667 q 247 757 247 718 "},"΅":{x_min:0,x_max:450,ha:553,o:"m 450 800 l 340 800 l 340 925 l 450 925 l 450 800 m 406 1040 l 212 800 l 129 800 l 269 1040 l 406 1040 m 110 800 l 0 800 l 0 925 l 110 925 l 110 800 "},T:{x_min:0,x_max:777,ha:835,o:"m 777 894 l 458 894 l 458 0 l 319 0 l 319 894 l 0 894 l 0 1013 l 777 1013 l 777 894 "},Φ:{x_min:0,x_max:915,ha:997,o:"m 527 0 l 389 0 l 389 122 q 110 231 220 122 q 0 509 0 340 q 110 785 0 677 q 389 893 220 893 l 389 1013 l 527 1013 l 527 893 q 804 786 693 893 q 915 509 915 679 q 805 231 915 341 q 527 122 696 122 l 527 0 m 527 226 q 712 310 641 226 q 779 507 779 389 q 712 705 779 627 q 527 787 641 787 l 527 226 m 389 226 l 389 787 q 205 698 275 775 q 136 505 136 620 q 206 308 136 391 q 389 226 276 226 "},"⁋":{x_min:0,x_max:0,ha:694},j:{x_min:-77.78125,x_max:167,ha:349,o:"m 167 871 l 42 871 l 42 1013 l 167 1013 l 167 871 m 167 -80 q 121 -231 167 -184 q -26 -278 76 -278 l -77 -278 l -77 -164 l -41 -164 q 26 -143 11 -164 q 42 -65 42 -122 l 42 737 l 167 737 l 167 -80 "},Σ:{x_min:0,x_max:756.953125,ha:819,o:"m 756 0 l 0 0 l 0 107 l 395 523 l 22 904 l 22 1013 l 745 1013 l 745 889 l 209 889 l 566 523 l 187 125 l 756 125 l 756 0 "},"›":{x_min:18.0625,x_max:774,ha:792,o:"m 774 376 l 18 40 l 18 149 l 631 421 l 18 692 l 18 799 l 774 465 l 774 376 "},"<":{x_min:17.984375,x_max:773.609375,ha:792,o:"m 773 40 l 18 376 l 17 465 l 773 799 l 773 692 l 159 420 l 773 149 l 773 40 "},"£":{x_min:0,x_max:704.484375,ha:801,o:"m 704 41 q 623 -10 664 5 q 543 -26 583 -26 q 359 15 501 -26 q 243 36 288 36 q 158 23 197 36 q 73 -21 119 10 l 6 76 q 125 195 90 150 q 175 331 175 262 q 147 443 175 383 l 0 443 l 0 512 l 108 512 q 43 734 43 623 q 120 929 43 854 q 358 1010 204 1010 q 579 936 487 1010 q 678 729 678 857 l 678 684 l 552 684 q 504 838 552 780 q 362 896 457 896 q 216 852 263 896 q 176 747 176 815 q 199 627 176 697 q 248 512 217 574 l 468 512 l 468 443 l 279 443 q 297 356 297 398 q 230 194 297 279 q 153 107 211 170 q 227 133 190 125 q 293 142 264 142 q 410 119 339 142 q 516 96 482 96 q 579 105 550 96 q 648 142 608 115 l 704 41 "},t:{x_min:0,x_max:367,ha:458,o:"m 367 0 q 312 -5 339 -2 q 262 -8 284 -8 q 145 28 183 -8 q 108 143 108 64 l 108 638 l 0 638 l 0 738 l 108 738 l 108 944 l 232 944 l 232 738 l 367 738 l 367 638 l 232 638 l 232 185 q 248 121 232 140 q 307 102 264 102 q 345 104 330 102 q 367 107 360 107 l 367 0 "},"¬":{x_min:0,x_max:706,ha:803,o:"m 706 411 l 706 158 l 630 158 l 630 335 l 0 335 l 0 411 l 706 411 "},λ:{x_min:0,x_max:750,ha:803,o:"m 750 -7 q 679 -15 716 -15 q 538 59 591 -15 q 466 214 512 97 l 336 551 l 126 0 l 0 0 l 270 705 q 223 837 247 770 q 116 899 190 899 q 90 898 100 899 l 90 1004 q 152 1011 125 1011 q 298 938 244 1011 q 373 783 326 901 l 605 192 q 649 115 629 136 q 716 95 669 95 l 736 95 q 750 97 745 97 l 750 -7 "},W:{x_min:0,x_max:1263.890625,ha:1351,o:"m 1263 1013 l 995 0 l 859 0 l 627 837 l 405 0 l 265 0 l 0 1013 l 136 1013 l 342 202 l 556 1013 l 701 1013 l 921 207 l 1133 1012 l 1263 1013 "},">":{x_min:18.0625,x_max:774,ha:792,o:"m 774 376 l 18 40 l 18 149 l 631 421 l 18 692 l 18 799 l 774 465 l 774 376 "},v:{x_min:0,x_max:675.15625,ha:761,o:"m 675 738 l 404 0 l 272 0 l 0 738 l 133 737 l 340 147 l 541 737 l 675 738 "},τ:{x_min:.28125,x_max:644.5,ha:703,o:"m 644 628 l 382 628 l 382 179 q 388 120 382 137 q 436 91 401 91 q 474 94 447 91 q 504 97 501 97 l 504 0 q 454 -9 482 -5 q 401 -14 426 -14 q 278 67 308 -14 q 260 233 260 118 l 260 628 l 0 628 l 0 739 l 644 739 l 644 628 "},ξ:{x_min:0,x_max:624.9375,ha:699,o:"m 624 -37 q 608 -153 624 -96 q 563 -278 593 -211 l 454 -278 q 491 -183 486 -200 q 511 -83 511 -126 q 484 -23 511 -44 q 370 1 452 1 q 323 0 354 1 q 283 -1 293 -1 q 84 76 169 -1 q 0 266 0 154 q 56 431 0 358 q 197 538 108 498 q 94 613 134 562 q 54 730 54 665 q 77 823 54 780 q 143 901 101 867 l 27 901 l 27 1012 l 576 1012 l 576 901 l 380 901 q 244 863 303 901 q 178 745 178 820 q 312 600 178 636 q 532 582 380 582 l 532 479 q 276 455 361 479 q 118 281 118 410 q 165 173 118 217 q 274 120 208 133 q 494 101 384 110 q 624 -37 624 76 "},"&":{x_min:-3,x_max:894.25,ha:992,o:"m 894 0 l 725 0 l 624 123 q 471 0 553 40 q 306 -41 390 -41 q 168 -7 231 -41 q 62 92 105 26 q 14 187 31 139 q -3 276 -3 235 q 55 433 -3 358 q 248 581 114 508 q 170 689 196 640 q 137 817 137 751 q 214 985 137 922 q 384 1041 284 1041 q 548 988 483 1041 q 622 824 622 928 q 563 666 622 739 q 431 556 516 608 l 621 326 q 649 407 639 361 q 663 493 653 426 l 781 493 q 703 229 781 352 l 894 0 m 504 818 q 468 908 504 877 q 384 940 433 940 q 293 907 331 940 q 255 818 255 875 q 289 714 255 767 q 363 628 313 678 q 477 729 446 682 q 504 818 504 771 m 556 209 l 314 499 q 179 395 223 449 q 135 283 135 341 q 146 222 135 253 q 183 158 158 192 q 333 80 241 80 q 556 209 448 80 "},Λ:{x_min:0,x_max:862.5,ha:942,o:"m 862 0 l 719 0 l 426 847 l 143 0 l 0 0 l 356 1013 l 501 1013 l 862 0 "},I:{x_min:41,x_max:180,ha:293,o:"m 180 0 l 41 0 l 41 1013 l 180 1013 l 180 0 "},G:{x_min:0,x_max:921,ha:1011,o:"m 921 0 l 832 0 l 801 136 q 655 15 741 58 q 470 -28 568 -28 q 126 133 259 -28 q 0 499 0 284 q 125 881 0 731 q 486 1043 259 1043 q 763 957 647 1043 q 905 709 890 864 l 772 709 q 668 866 747 807 q 486 926 589 926 q 228 795 322 926 q 142 507 142 677 q 228 224 142 342 q 483 94 323 94 q 712 195 625 94 q 796 435 796 291 l 477 435 l 477 549 l 921 549 l 921 0 "},ΰ:{x_min:0,x_max:617,ha:725,o:"m 524 800 l 414 800 l 414 925 l 524 925 l 524 800 m 183 800 l 73 800 l 73 925 l 183 925 l 183 800 m 617 352 q 540 93 617 199 q 308 -24 455 -24 q 76 93 161 -24 q 0 352 0 199 l 0 738 l 126 738 l 126 354 q 169 185 126 257 q 312 98 220 98 q 451 185 402 98 q 492 354 492 257 l 492 738 l 617 738 l 617 352 m 489 1040 l 300 819 l 216 819 l 351 1040 l 489 1040 "},"`":{x_min:0,x_max:138.890625,ha:236,o:"m 138 699 l 0 699 l 0 861 q 36 974 0 929 q 138 1041 72 1020 l 138 977 q 82 931 95 969 q 69 839 69 893 l 138 839 l 138 699 "},"·":{x_min:0,x_max:142,ha:239,o:"m 142 585 l 0 585 l 0 738 l 142 738 l 142 585 "},Υ:{x_min:.328125,x_max:819.515625,ha:889,o:"m 819 1013 l 482 416 l 482 0 l 342 0 l 342 416 l 0 1013 l 140 1013 l 411 533 l 679 1013 l 819 1013 "},r:{x_min:0,x_max:355.5625,ha:432,o:"m 355 621 l 343 621 q 179 569 236 621 q 122 411 122 518 l 122 0 l 0 0 l 0 737 l 117 737 l 117 604 q 204 719 146 686 q 355 753 262 753 l 355 621 "},x:{x_min:0,x_max:675,ha:764,o:"m 675 0 l 525 0 l 331 286 l 144 0 l 0 0 l 256 379 l 12 738 l 157 737 l 336 473 l 516 738 l 661 738 l 412 380 l 675 0 "},μ:{x_min:0,x_max:696.609375,ha:747,o:"m 696 -4 q 628 -14 657 -14 q 498 97 513 -14 q 422 8 470 41 q 313 -24 374 -24 q 207 3 258 -24 q 120 80 157 31 l 120 -278 l 0 -278 l 0 738 l 124 738 l 124 343 q 165 172 124 246 q 308 82 216 82 q 451 177 402 82 q 492 358 492 254 l 492 738 l 616 738 l 616 214 q 623 136 616 160 q 673 92 636 92 q 696 95 684 92 l 696 -4 "},h:{x_min:0,x_max:615,ha:724,o:"m 615 472 l 615 0 l 490 0 l 490 454 q 456 590 490 535 q 338 654 416 654 q 186 588 251 654 q 122 436 122 522 l 122 0 l 0 0 l 0 1013 l 122 1013 l 122 633 q 218 727 149 694 q 362 760 287 760 q 552 676 484 760 q 615 472 615 600 "},".":{x_min:0,x_max:142,ha:239,o:"m 142 0 l 0 0 l 0 151 l 142 151 l 142 0 "},φ:{x_min:-2,x_max:878,ha:974,o:"m 496 -279 l 378 -279 l 378 -17 q 101 88 204 -17 q -2 367 -2 194 q 68 626 -2 510 q 283 758 151 758 l 283 646 q 167 537 209 626 q 133 373 133 462 q 192 177 133 254 q 378 93 259 93 l 378 758 q 445 764 426 763 q 476 765 464 765 q 765 659 653 765 q 878 377 878 553 q 771 96 878 209 q 496 -17 665 -17 l 496 -279 m 496 93 l 514 93 q 687 183 623 93 q 746 380 746 265 q 691 569 746 491 q 522 658 629 658 l 496 656 l 496 93 "},";":{x_min:0,x_max:142,ha:239,o:"m 142 585 l 0 585 l 0 738 l 142 738 l 142 585 m 142 -12 q 105 -132 142 -82 q 0 -206 68 -182 l 0 -138 q 58 -82 43 -123 q 68 0 68 -56 l 0 0 l 0 151 l 142 151 l 142 -12 "},f:{x_min:0,x_max:378,ha:472,o:"m 378 638 l 246 638 l 246 0 l 121 0 l 121 638 l 0 638 l 0 738 l 121 738 q 137 935 121 887 q 290 1028 171 1028 q 320 1027 305 1028 q 378 1021 334 1026 l 378 908 q 323 918 346 918 q 257 870 273 918 q 246 780 246 840 l 246 738 l 378 738 l 378 638 "},"“":{x_min:1,x_max:348.21875,ha:454,o:"m 140 670 l 1 670 l 1 830 q 37 943 1 897 q 140 1011 74 990 l 140 947 q 82 900 97 940 q 68 810 68 861 l 140 810 l 140 670 m 348 670 l 209 670 l 209 830 q 245 943 209 897 q 348 1011 282 990 l 348 947 q 290 900 305 940 q 276 810 276 861 l 348 810 l 348 670 "},A:{x_min:.03125,x_max:906.953125,ha:1008,o:"m 906 0 l 756 0 l 648 303 l 251 303 l 142 0 l 0 0 l 376 1013 l 529 1013 l 906 0 m 610 421 l 452 867 l 293 421 l 610 421 "},"‘":{x_min:1,x_max:139.890625,ha:236,o:"m 139 670 l 1 670 l 1 830 q 37 943 1 897 q 139 1011 74 990 l 139 947 q 82 900 97 940 q 68 810 68 861 l 139 810 l 139 670 "},ϊ:{x_min:-70,x_max:283,ha:361,o:"m 283 800 l 173 800 l 173 925 l 283 925 l 283 800 m 40 800 l -70 800 l -70 925 l 40 925 l 40 800 m 283 3 q 232 -10 257 -5 q 181 -15 206 -15 q 84 26 118 -15 q 41 200 41 79 l 41 737 l 166 737 l 167 215 q 171 141 167 157 q 225 101 182 101 q 247 103 238 101 q 283 112 256 104 l 283 3 "},π:{x_min:-.21875,x_max:773.21875,ha:857,o:"m 773 -7 l 707 -11 q 575 40 607 -11 q 552 174 552 77 l 552 226 l 552 626 l 222 626 l 222 0 l 97 0 l 97 626 l 0 626 l 0 737 l 773 737 l 773 626 l 676 626 l 676 171 q 695 103 676 117 q 773 90 714 90 l 773 -7 "},ά:{x_min:0,x_max:765.5625,ha:809,o:"m 765 -4 q 698 -14 726 -14 q 564 97 586 -14 q 466 7 525 40 q 337 -26 407 -26 q 88 98 186 -26 q 0 369 0 212 q 88 637 0 525 q 337 760 184 760 q 465 727 407 760 q 563 637 524 695 l 563 738 l 685 738 l 685 222 q 693 141 685 168 q 748 94 708 94 q 765 95 760 94 l 765 -4 m 584 371 q 531 562 584 485 q 360 653 470 653 q 192 566 254 653 q 135 379 135 489 q 186 181 135 261 q 358 84 247 84 q 528 176 465 84 q 584 371 584 260 m 604 1040 l 415 819 l 332 819 l 466 1040 l 604 1040 "},O:{x_min:0,x_max:958,ha:1057,o:"m 485 1041 q 834 882 702 1041 q 958 512 958 734 q 834 136 958 287 q 481 -26 702 -26 q 126 130 261 -26 q 0 504 0 279 q 127 880 0 728 q 485 1041 263 1041 m 480 98 q 731 225 638 98 q 815 504 815 340 q 733 783 815 669 q 480 912 640 912 q 226 784 321 912 q 142 504 142 670 q 226 224 142 339 q 480 98 319 98 "},n:{x_min:0,x_max:615,ha:724,o:"m 615 463 l 615 0 l 490 0 l 490 454 q 453 592 490 537 q 331 656 410 656 q 178 585 240 656 q 117 421 117 514 l 117 0 l 0 0 l 0 738 l 117 738 l 117 630 q 218 728 150 693 q 359 764 286 764 q 552 675 484 764 q 615 463 615 593 "},l:{x_min:41,x_max:166,ha:279,o:"m 166 0 l 41 0 l 41 1013 l 166 1013 l 166 0 "},"¤":{x_min:40.09375,x_max:728.796875,ha:825,o:"m 728 304 l 649 224 l 512 363 q 383 331 458 331 q 256 363 310 331 l 119 224 l 40 304 l 177 441 q 150 553 150 493 q 184 673 150 621 l 40 818 l 119 898 l 267 749 q 321 766 291 759 q 384 773 351 773 q 447 766 417 773 q 501 749 477 759 l 649 898 l 728 818 l 585 675 q 612 618 604 648 q 621 553 621 587 q 591 441 621 491 l 728 304 m 384 682 q 280 643 318 682 q 243 551 243 604 q 279 461 243 499 q 383 423 316 423 q 487 461 449 423 q 525 553 525 500 q 490 641 525 605 q 384 682 451 682 "},κ:{x_min:0,x_max:632.328125,ha:679,o:"m 632 0 l 482 0 l 225 384 l 124 288 l 124 0 l 0 0 l 0 738 l 124 738 l 124 446 l 433 738 l 596 738 l 312 466 l 632 0 "},p:{x_min:0,x_max:685,ha:786,o:"m 685 364 q 598 96 685 205 q 350 -23 504 -23 q 121 89 205 -23 l 121 -278 l 0 -278 l 0 738 l 121 738 l 121 633 q 220 726 159 691 q 351 761 280 761 q 598 636 504 761 q 685 364 685 522 m 557 371 q 501 560 557 481 q 330 651 437 651 q 162 559 223 651 q 108 366 108 479 q 162 177 108 254 q 333 87 224 87 q 502 178 441 87 q 557 371 557 258 "},"‡":{x_min:0,x_max:777,ha:835,o:"m 458 238 l 458 0 l 319 0 l 319 238 l 0 238 l 0 360 l 319 360 l 319 681 l 0 683 l 0 804 l 319 804 l 319 1015 l 458 1013 l 458 804 l 777 804 l 777 683 l 458 683 l 458 360 l 777 360 l 777 238 l 458 238 "},ψ:{x_min:0,x_max:808,ha:907,o:"m 465 -278 l 341 -278 l 341 -15 q 87 102 180 -15 q 0 378 0 210 l 0 739 l 133 739 l 133 379 q 182 195 133 275 q 341 98 242 98 l 341 922 l 465 922 l 465 98 q 623 195 563 98 q 675 382 675 278 l 675 742 l 808 742 l 808 381 q 720 104 808 213 q 466 -13 627 -13 l 465 -278 "},η:{x_min:.78125,x_max:697,ha:810,o:"m 697 -278 l 572 -278 l 572 454 q 540 587 572 536 q 425 650 501 650 q 271 579 337 650 q 206 420 206 509 l 206 0 l 81 0 l 81 489 q 73 588 81 562 q 0 644 56 644 l 0 741 q 68 755 38 755 q 158 720 124 755 q 200 630 193 686 q 297 726 234 692 q 434 761 359 761 q 620 692 544 761 q 697 516 697 624 l 697 -278 "}},due="normal",pue=1189,mue=-100,gue="normal",vue={yMin:-334,xMin:-111,yMax:1189,xMax:1672},_ue=1e3,yue={postscript_name:"Helvetiker-Regular",version_string:"Version 1.00 2004 initial release",vendor_url:"http://www.magenta.gr/",full_font_name:"Helvetiker",font_family_name:"Helvetiker",copyright:"Copyright (c) Μagenta ltd, 2004",description:"",trademark:"",designer:"",designer_url:"",unique_font_identifier:"Μagenta ltd:Helvetiker:22-10-104",license_url:"http://www.ellak.gr/fonts/MgOpen/license.html",license_description:`Copyright (c) 2004 by MAGENTA Ltd. All Rights Reserved.\r + `),e},jE=function(e,t){return e.onBeforeCompile=function(n){e.userData.shader=t(n)},e},Yle=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:function(r){return r};if(e.userData.shader)t(e.userData.shader.uniforms);else{var n=e.onBeforeCompile;e.onBeforeCompile=function(r){n(r),t(r.uniforms)}}},Qle=["stroke"],yl=window.THREE?window.THREE:{BufferGeometry:Ki,CubicBezierCurve3:$7,Curve:Pl,Group:ja,Line:xy,Mesh:zi,NormalBlending:Ka,ShaderMaterial:Ja,TubeGeometry:tM,Vector3:ce},Kle=L0.default||L0,mO=xs({props:{arcsData:{default:[]},arcStartLat:{default:"startLat"},arcStartLng:{default:"startLng"},arcStartAltitude:{default:0},arcEndLat:{default:"endLat"},arcEndLng:{default:"endLng"},arcEndAltitude:{default:0},arcColor:{default:function(){return"#ffffaa"}},arcAltitude:{},arcAltitudeAutoScale:{default:.5},arcStroke:{},arcCurveResolution:{default:64,triggerUpdate:!1},arcCircularResolution:{default:6,triggerUpdate:!1},arcDashLength:{default:1},arcDashGap:{default:0},arcDashInitialGap:{default:0},arcDashAnimateTime:{default:0},arcsTransitionDuration:{default:1e3,triggerUpdate:!1}},methods:{pauseAnimation:function(e){var t;(t=e.ticker)===null||t===void 0||t.pause()},resumeAnimation:function(e){var t;(t=e.ticker)===null||t===void 0||t.resume()},_destructor:function(e){var t;e.sharedMaterial.dispose(),(t=e.ticker)===null||t===void 0||t.dispose()}},stateInit:function(e){var t=e.tweenGroup;return{tweenGroup:t,ticker:new Kle,sharedMaterial:new yl.ShaderMaterial(Hi(Hi({},pO()),{},{transparent:!0,blending:yl.NormalBlending}))}},init:function(e,t){nr(e),t.scene=e,t.dataMapper=new ao(e,{objBindAttr:"__threeObjArc"}).onCreateObj(function(){var n=new yl.Group;return n.__globeObjType="arc",n}),t.ticker.onTick.add(function(n,r){t.dataMapper.entries().map(function(s){var a=gr(s,2),l=a[1];return l}).filter(function(s){return s.children.length&&s.children[0].material&&s.children[0].__dashAnimateStep}).forEach(function(s){var a=s.children[0],l=a.__dashAnimateStep*r,u=a.material.uniforms.dashTranslate.value%1e9;a.material.uniforms.dashTranslate.value=u+l})})},update:function(e){var t=Ct(e.arcStartLat),n=Ct(e.arcStartLng),r=Ct(e.arcStartAltitude),s=Ct(e.arcEndLat),a=Ct(e.arcEndLng),l=Ct(e.arcEndAltitude),u=Ct(e.arcAltitude),h=Ct(e.arcAltitudeAutoScale),g=Ct(e.arcStroke),v=Ct(e.arcColor),x=Ct(e.arcDashLength),S=Ct(e.arcDashGap),w=Ct(e.arcDashInitialGap),R=Ct(e.arcDashAnimateTime);e.dataMapper.onUpdateObj(function(L,O){var z=g(O),G=z!=null;if(!L.children.length||G!==(L.children[0].type==="Mesh")){nr(L);var k=G?new yl.Mesh:new yl.Line(new yl.BufferGeometry);k.material=e.sharedMaterial.clone(),L.add(k)}var H=L.children[0];Object.assign(H.material.uniforms,{dashSize:{value:x(O)},gapSize:{value:S(O)},dashOffset:{value:w(O)}});var F=R(O);H.__dashAnimateStep=F>0?1e3/F:0;var V=E(v(O),e.arcCurveResolution,G?e.arcCircularResolution+1:1),X=B(e.arcCurveResolution,G?e.arcCircularResolution+1:1,!0);H.geometry.setAttribute("color",V),H.geometry.setAttribute("relDistance",X);var J=function(Z){var ue=L.__currentTargetD=Z,he=ue.stroke,be=Ole(ue,Qle),Se=C(be);G?(H.geometry&&H.geometry.dispose(),H.geometry=new yl.TubeGeometry(Se,e.arcCurveResolution,he/2,e.arcCircularResolution),H.geometry.setAttribute("color",V),H.geometry.setAttribute("relDistance",X)):H.geometry.setFromPoints(Se.getPoints(e.arcCurveResolution))},te={stroke:z,alt:u(O),altAutoScale:+h(O),startLat:+t(O),startLng:+n(O),startAlt:+r(O),endLat:+s(O),endLng:+a(O),endAlt:+l(O)},se=L.__currentTargetD||Object.assign({},te,{altAutoScale:-.001});Object.keys(te).some(function(ne){return se[ne]!==te[ne]})&&(!e.arcsTransitionDuration||e.arcsTransitionDuration<0?J(te):e.tweenGroup.add(new ca(se).to(te,e.arcsTransitionDuration).easing(os.Quadratic.InOut).onUpdate(J).start()))}).digest(e.arcsData);function C(L){var O=L.alt,z=L.altAutoScale,G=L.startLat,k=L.startLng,H=L.startAlt,F=L.endLat,V=L.endLng,X=L.endAlt,J=function(_e){var De=gr(_e,3),pt=De[0],_t=De[1],wt=De[2],Ge=el(_t,pt,wt),Be=Ge.x,ke=Ge.y,oe=Ge.z;return new yl.Vector3(Be,ke,oe)},te=[k,G],se=[V,F],ne=O;if(ne==null&&(ne=Vh(te,se)/2*z+Math.max(H,X)),ne||H||X){var Z=dM(te,se),ue=function(_e,De){return De+(De-_e)*(_e2&&arguments[2]!==void 0?arguments[2]:1,G=O+1,k;if(L instanceof Array||L instanceof Function){var H=L instanceof Array?Pc().domain(L.map(function(ne,Z){return Z/(L.length-1)})).range(L):L;k=function(Z){return jh(H(Z),!0,!0)}}else{var F=jh(L,!0,!0);k=function(){return F}}for(var V=[],X=0,J=G;X1&&arguments[1]!==void 0?arguments[1]:1,z=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,G=L+1,k=[],H=0,F=G;H=H?z:G}),4)),O})):new wh.BufferGeometry,w=new wh.MeshLambertMaterial({color:16777215,transparent:!0,vertexColors:!0,side:wh.DoubleSide});w.onBeforeCompile=function(B){w.userData.shader=ow(B)};var R=new wh.Mesh(S,w);R.__globeObjType="hexBinPoints",R.__data=v,e.dataMapper.clear(),nr(e.scene),e.scene.add(R)}function C(B){var L=new wh.Mesh;L.__hexCenter=CP(B.h3Idx),L.__hexGeoJson=RP(B.h3Idx,!0).reverse();var O=L.__hexCenter[1];return L.__hexGeoJson.forEach(function(z){var G=z[0];Math.abs(O-G)>170&&(z[0]+=O>G?360:-360)}),L.__globeObjType="hexbin",L}function E(B,L){var O=function(ue,he,be){return ue-(ue-he)*be},z=Math.max(0,Math.min(1,+h(L))),G=gr(B.__hexCenter,2),k=G[0],H=G[1],F=z===0?B.__hexGeoJson:B.__hexGeoJson.map(function(Z){var ue=gr(Z,2),he=ue[0],be=ue[1];return[[he,H],[be,k]].map(function(Se){var le=gr(Se,2),we=le[0],We=le[1];return O(we,We,z)})}),V=e.hexTopCurvatureResolution;B.geometry&&B.geometry.dispose(),B.geometry=new TM([F],0,cr,!1,!0,!0,V);var X={alt:+a(L)},J=function(ue){var he=B.__currentTargetD=ue,be=he.alt;B.scale.x=B.scale.y=B.scale.z=1+be;var Se=cr/(be+1);B.geometry.setAttribute("surfaceRadius",Mu(Array(B.geometry.getAttribute("position").count).fill(Se),1))},te=B.__currentTargetD||Object.assign({},X,{alt:-.001});if(Object.keys(X).some(function(Z){return te[Z]!==X[Z]})&&(e.hexBinMerge||!e.hexTransitionDuration||e.hexTransitionDuration<0?J(X):e.tweenGroup.add(new ca(te).to(X,e.hexTransitionDuration).easing(os.Quadratic.InOut).onUpdate(J).start())),!e.hexBinMerge){var se=u(L),ne=l(L);[se,ne].forEach(function(Z){if(!x.hasOwnProperty(Z)){var ue=Rl(Z);x[Z]=jE(new wh.MeshLambertMaterial({color:wu(Z),transparent:ue<1,opacity:ue,side:wh.DoubleSide}),ow)}}),B.material=[se,ne].map(function(Z){return x[Z]})}}}}),vO=function(e){return e*e},wc=function(e){return e*Math.PI/180};function Zle(i,e){var t=Math.sqrt,n=Math.cos,r=function(g){return vO(Math.sin(g/2))},s=wc(i[1]),a=wc(e[1]),l=wc(i[0]),u=wc(e[0]);return 2*Math.asin(t(r(a-s)+n(s)*n(a)*r(u-l)))}var Jle=Math.sqrt(2*Math.PI);function eue(i,e){return Math.exp(-vO(i/e)/2)/(e*Jle)}var tue=function(e){var t=gr(e,2),n=t[0],r=t[1],s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},l=a.lngAccessor,u=l===void 0?function(C){return C[0]}:l,h=a.latAccessor,g=h===void 0?function(C){return C[1]}:h,v=a.weightAccessor,x=v===void 0?function(){return 1}:v,S=a.bandwidth,w=[n,r],R=S*Math.PI/180;return XW(s.map(function(C){var E=x(C);if(!E)return 0;var B=Zle(w,[u(C),g(C)]);return eue(B,R)*E}))},nue=(function(){var i=Rle(sw().m(function e(t){var n,r,s,a,l,u,h,g,v,x,S,w,R,C,E,B,L,O,z,G,k,H,F,V,X,J,te,se,ne,Z,ue,he,be,Se,le,we,We,Te,ze,_e,De=arguments,pt,_t,wt;return sw().w(function(Ge){for(;;)switch(Ge.n){case 0:if(r=De.length>1&&De[1]!==void 0?De[1]:[],s=De.length>2&&De[2]!==void 0?De[2]:{},a=s.lngAccessor,l=a===void 0?function(Be){return Be[0]}:a,u=s.latAccessor,h=u===void 0?function(Be){return Be[1]}:u,g=s.weightAccessor,v=g===void 0?function(){return 1}:g,x=s.bandwidth,(n=navigator)!==null&&n!==void 0&&n.gpu){Ge.n=1;break}return console.warn("WebGPU not enabled in browser. Please consider enabling it to improve performance."),Ge.a(2,t.map(function(Be){return tue(Be,r,{lngAccessor:l,latAccessor:h,weightAccessor:v,bandwidth:x})}));case 1:return S=4,w=ale,R=ole,C=vle,E=gle,B=fle,L=Ale,O=lle,z=mle,G=ple,k=cle,H=ule,F=hle,V=dle,X=E(new t_(new Float32Array(t.flat().map(wc)),2),"vec2",t.length),J=E(new t_(new Float32Array(r.map(function(Be){return[wc(l(Be)),wc(h(Be)),v(Be)]}).flat()),3),"vec3",r.length),te=new t_(t.length,1),se=E(te,"float",t.length),ne=B(Math.PI),Z=z(ne.mul(2)),ue=function(ke){return ke.mul(ke)},he=function(ke){return ue(G(ke.div(2)))},be=function(ke,oe){var Mt=B(ke[1]),lt=B(oe[1]),Dt=B(ke[0]),ut=B(oe[0]);return B(2).mul(H(z(he(lt.sub(Mt)).add(k(Mt).mul(k(lt)).mul(he(ut.sub(Dt)))))))},Se=function(ke,oe){return F(V(ue(ke.div(oe)).div(2))).div(oe.mul(Z))},le=C(wc(x)),we=C(wc(x*S)),We=C(r.length),Te=w(function(){var Be=X.element(L),ke=se.element(L);ke.assign(0),O(We,function(oe){var Mt=oe.i,lt=J.element(Mt),Dt=lt.z;R(Dt,function(){var ut=be(lt.xy,Be.xy);R(ut&&ut.lessThan(we),function(){ke.addAssign(Se(ut,le).mul(Dt))})})})}),ze=Te().compute(t.length),_e=new sO,Ge.n=2,_e.computeAsync(ze);case 2:return pt=Array,_t=Float32Array,Ge.n=3,_e.getArrayBufferAsync(te);case 3:return wt=Ge.v,Ge.a(2,pt.from.call(pt,new _t(wt)))}},e)}));return function(t){return i.apply(this,arguments)}})(),Nv=window.THREE?window.THREE:{Mesh:zi,MeshLambertMaterial:Vc,SphereGeometry:Eu},iue=3.5,rue=.1,XN=100,sue=function(e){var t=cA(FZ(e));return t.opacity=Math.cbrt(e),t.formatRgb()},_O=xs({props:{heatmapsData:{default:[]},heatmapPoints:{default:function(e){return e}},heatmapPointLat:{default:function(e){return e[0]}},heatmapPointLng:{default:function(e){return e[1]}},heatmapPointWeight:{default:1},heatmapBandwidth:{default:2.5},heatmapColorFn:{default:function(){return sue}},heatmapColorSaturation:{default:1.5},heatmapBaseAltitude:{default:.01},heatmapTopAltitude:{},heatmapsTransitionDuration:{default:0,triggerUpdate:!1}},init:function(e,t,n){var r=n.tweenGroup;nr(e),t.scene=e,t.tweenGroup=r,t.dataMapper=new ao(e,{objBindAttr:"__threeObjHeatmap"}).onCreateObj(function(){var s=new Nv.Mesh(new Nv.SphereGeometry(cr),jE(new Nv.MeshLambertMaterial({vertexColors:!0,transparent:!0}),Xle));return s.__globeObjType="heatmap",s})},update:function(e){var t=Ct(e.heatmapPoints),n=Ct(e.heatmapPointLat),r=Ct(e.heatmapPointLng),s=Ct(e.heatmapPointWeight),a=Ct(e.heatmapBandwidth),l=Ct(e.heatmapColorFn),u=Ct(e.heatmapColorSaturation),h=Ct(e.heatmapBaseAltitude),g=Ct(e.heatmapTopAltitude);e.dataMapper.onUpdateObj(function(v,x){var S=a(x),w=l(x),R=u(x),C=h(x),E=g(x),B=t(x).map(function(k){var H=n(k),F=r(k),V=el(H,F),X=V.x,J=V.y,te=V.z;return{x:X,y:J,z:te,lat:H,lng:F,weight:s(k)}}),L=Math.max(rue,S/iue),O=Math.ceil(360/(L||-1));v.geometry.parameters.widthSegments!==O&&(v.geometry.dispose(),v.geometry=new Nv.SphereGeometry(cr,O,O/2));var z=$le(v.geometry.getAttribute("position")),G=z.map(function(k){var H=gr(k,3),F=H[0],V=H[1],X=H[2],J=fO({x:F,y:V,z:X}),te=J.lng,se=J.lat;return[te,se]});nue(G,B,{latAccessor:function(H){return H.lat},lngAccessor:function(H){return H.lng},weightAccessor:function(H){return H.weight},bandwidth:S}).then(function(k){var H=Qi(new Array(XN)).map(function(J,te){return jh(w(te/(XN-1)))}),F=function(te){var se=v.__currentTargetD=te,ne=se.kdeVals,Z=se.topAlt,ue=se.saturation,he=jW(ne.map(Math.abs))||1e-15,be=RD([0,he/ue],H);v.geometry.setAttribute("color",Mu(ne.map(function(le){return be(Math.abs(le))}),4));var Se=Pc([0,he],[cr*(1+C),cr*(1+(Z||C))]);v.geometry.setAttribute("r",Mu(ne.map(Se)))},V={kdeVals:k,topAlt:E,saturation:R},X=v.__currentTargetD||Object.assign({},V,{kdeVals:k.map(function(){return 0}),topAlt:E&&C,saturation:.5});X.kdeVals.length!==k.length&&(X.kdeVals=k.slice()),Object.keys(V).some(function(J){return X[J]!==V[J]})&&(!e.heatmapsTransitionDuration||e.heatmapsTransitionDuration<0?F(V):e.tweenGroup.add(new ca(X).to(V,e.heatmapsTransitionDuration).easing(os.Quadratic.InOut).onUpdate(F).start()))})}).digest(e.heatmapsData)}}),Mh=window.THREE?window.THREE:{DoubleSide:as,Group:ja,LineBasicMaterial:$0,LineSegments:H7,Mesh:zi,MeshBasicMaterial:pA},yO=xs({props:{polygonsData:{default:[]},polygonGeoJsonGeometry:{default:"geometry"},polygonSideColor:{default:function(){return"#ffffaa"}},polygonSideMaterial:{},polygonCapColor:{default:function(){return"#ffffaa"}},polygonCapMaterial:{},polygonStrokeColor:{},polygonAltitude:{default:.01},polygonCapCurvatureResolution:{default:5},polygonsTransitionDuration:{default:1e3,triggerUpdate:!1}},init:function(e,t,n){var r=n.tweenGroup;nr(e),t.scene=e,t.tweenGroup=r,t.dataMapper=new ao(e,{objBindAttr:"__threeObjPolygon"}).id(function(s){return s.id}).onCreateObj(function(){var s=new Mh.Group;return s.__defaultSideMaterial=jE(new Mh.MeshBasicMaterial({side:Mh.DoubleSide,depthWrite:!0}),ow),s.__defaultCapMaterial=new Mh.MeshBasicMaterial({side:Mh.DoubleSide,depthWrite:!0}),s.add(new Mh.Mesh(void 0,[s.__defaultSideMaterial,s.__defaultCapMaterial])),s.add(new Mh.LineSegments(void 0,new Mh.LineBasicMaterial)),s.__globeObjType="polygon",s})},update:function(e){var t=Ct(e.polygonGeoJsonGeometry),n=Ct(e.polygonAltitude),r=Ct(e.polygonCapCurvatureResolution),s=Ct(e.polygonCapColor),a=Ct(e.polygonCapMaterial),l=Ct(e.polygonSideColor),u=Ct(e.polygonSideMaterial),h=Ct(e.polygonStrokeColor),g=[];e.polygonsData.forEach(function(v){var x={data:v,capColor:s(v),capMaterial:a(v),sideColor:l(v),sideMaterial:u(v),strokeColor:h(v),altitude:+n(v),capCurvatureResolution:+r(v)},S=t(v),w=v.__id||"".concat(Math.round(Math.random()*1e9));v.__id=w,S.type==="Polygon"?g.push(Hi({id:"".concat(w,"_0"),coords:S.coordinates},x)):S.type==="MultiPolygon"?g.push.apply(g,Qi(S.coordinates.map(function(R,C){return Hi({id:"".concat(w,"_").concat(C),coords:R},x)}))):console.warn("Unsupported GeoJson geometry type: ".concat(S.type,". Skipping geometry..."))}),e.dataMapper.onUpdateObj(function(v,x){var S=x.coords,w=x.capColor,R=x.capMaterial,C=x.sideColor,E=x.sideMaterial,B=x.strokeColor,L=x.altitude,O=x.capCurvatureResolution,z=gr(v.children,2),G=z[0],k=z[1],H=!!B;k.visible=H;var F=!!(w||R),V=!!(C||E);aue(G.geometry.parameters||{},{polygonGeoJson:S,curvatureResolution:O,closedTop:F,includeSides:V})||(G.geometry&&G.geometry.dispose(),G.geometry=new TM(S,0,cr,!1,F,V,O)),H&&(!k.geometry.parameters||k.geometry.parameters.geoJson.coordinates!==S||k.geometry.parameters.resolution!==O)&&(k.geometry&&k.geometry.dispose(),k.geometry=new uP({type:"Polygon",coordinates:S},cr,O));var X=V?0:-1,J=F?V?1:0:-1;if(X>=0&&(G.material[X]=E||v.__defaultSideMaterial),J>=0&&(G.material[J]=R||v.__defaultCapMaterial),[[!E&&C,X],[!R&&w,J]].forEach(function(he){var be=gr(he,2),Se=be[0],le=be[1];if(!(!Se||le<0)){var we=G.material[le],We=Rl(Se);we.color.set(wu(Se)),we.transparent=We<1,we.opacity=We}}),H){var te=k.material,se=Rl(B);te.color.set(wu(B)),te.transparent=se<1,te.opacity=se}var ne={alt:L},Z=function(be){var Se=v.__currentTargetD=be,le=Se.alt;G.scale.x=G.scale.y=G.scale.z=1+le,H&&(k.scale.x=k.scale.y=k.scale.z=1+le+1e-4),Yle(v.__defaultSideMaterial,function(we){return we.uSurfaceRadius.value=cr/(le+1)})},ue=v.__currentTargetD||Object.assign({},ne,{alt:-.001});Object.keys(ne).some(function(he){return ue[he]!==ne[he]})&&(!e.polygonsTransitionDuration||e.polygonsTransitionDuration<0||ue.alt===ne.alt?Z(ne):e.tweenGroup.add(new ca(ue).to(ne,e.polygonsTransitionDuration).easing(os.Quadratic.InOut).onUpdate(Z).start()))}).digest(g)}});function aue(i,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:function(){return function(n,r){return n===r}};return Object.entries(e).every(function(n){var r=gr(n,2),s=r[0],a=r[1];return i.hasOwnProperty(s)&&t(s)(i[s],a)})}var Bd=window.THREE?window.THREE:{BufferGeometry:Ki,DoubleSide:as,Mesh:zi,MeshLambertMaterial:Vc,Vector3:ce},YN=Object.assign({},_M),QN=YN.BufferGeometryUtils||YN,xO=xs({props:{hexPolygonsData:{default:[]},hexPolygonGeoJsonGeometry:{default:"geometry"},hexPolygonColor:{default:function(){return"#ffffaa"}},hexPolygonAltitude:{default:.001},hexPolygonResolution:{default:3},hexPolygonMargin:{default:.2},hexPolygonUseDots:{default:!1},hexPolygonCurvatureResolution:{default:5},hexPolygonDotResolution:{default:12},hexPolygonsTransitionDuration:{default:0,triggerUpdate:!1}},init:function(e,t,n){var r=n.tweenGroup;nr(e),t.scene=e,t.tweenGroup=r,t.dataMapper=new ao(e,{objBindAttr:"__threeObjHexPolygon"}).onCreateObj(function(){var s=new Bd.Mesh(void 0,new Bd.MeshLambertMaterial({side:Bd.DoubleSide}));return s.__globeObjType="hexPolygon",s})},update:function(e){var t=Ct(e.hexPolygonGeoJsonGeometry),n=Ct(e.hexPolygonColor),r=Ct(e.hexPolygonAltitude),s=Ct(e.hexPolygonResolution),a=Ct(e.hexPolygonMargin),l=Ct(e.hexPolygonUseDots),u=Ct(e.hexPolygonCurvatureResolution),h=Ct(e.hexPolygonDotResolution);e.dataMapper.onUpdateObj(function(g,v){var x=t(v),S=s(v),w=r(v),R=Math.max(0,Math.min(1,+a(v))),C=l(v),E=u(v),B=h(v),L=n(v),O=Rl(L);g.material.color.set(wu(L)),g.material.transparent=O<1,g.material.opacity=O;var z={alt:w,margin:R,curvatureResolution:E},G={geoJson:x,h3Res:S},k=g.__currentTargetD||Object.assign({},z,{alt:-.001}),H=g.__currentMemD||G;if(Object.keys(z).some(function(J){return k[J]!==z[J]})||Object.keys(G).some(function(J){return H[J]!==G[J]})){g.__currentMemD=G;var F=[];x.type==="Polygon"?CR(x.coordinates,S,!0).forEach(function(J){return F.push(J)}):x.type==="MultiPolygon"?x.coordinates.forEach(function(J){return CR(J,S,!0).forEach(function(te){return F.push(te)})}):console.warn("Unsupported GeoJson geometry type: ".concat(x.type,". Skipping geometry..."));var V=F.map(function(J){var te=CP(J),se=RP(J,!0).reverse(),ne=te[1];return se.forEach(function(Z){var ue=Z[0];Math.abs(ne-ue)>170&&(Z[0]+=ne>ue?360:-360)}),{h3Idx:J,hexCenter:te,hexGeoJson:se}}),X=function(te){var se=g.__currentTargetD=te,ne=se.alt,Z=se.margin,ue=se.curvatureResolution;g.geometry&&g.geometry.dispose(),g.geometry=V.length?(QN.mergeGeometries||QN.mergeBufferGeometries)(V.map(function(he){var be=gr(he.hexCenter,2),Se=be[0],le=be[1];if(C){var we=el(Se,le,ne),We=el(he.hexGeoJson[0][1],he.hexGeoJson[0][0],ne),Te=.85*(1-Z)*new Bd.Vector3(we.x,we.y,we.z).distanceTo(new Bd.Vector3(We.x,We.y,We.z)),ze=new by(Te,B);return ze.rotateX(Vf(-Se)),ze.rotateY(Vf(le)),ze.translate(we.x,we.y,we.z),ze}else{var _e=function(_t,wt,Ge){return _t-(_t-wt)*Ge},De=Z===0?he.hexGeoJson:he.hexGeoJson.map(function(pt){var _t=gr(pt,2),wt=_t[0],Ge=_t[1];return[[wt,le],[Ge,Se]].map(function(Be){var ke=gr(Be,2),oe=ke[0],Mt=ke[1];return _e(oe,Mt,Z)})});return new TM([De],cr,cr*(1+ne),!1,!0,!1,ue)}})):new Bd.BufferGeometry};!e.hexPolygonsTransitionDuration||e.hexPolygonsTransitionDuration<0?X(z):e.tweenGroup.add(new ca(k).to(z,e.hexPolygonsTransitionDuration).easing(os.Quadratic.InOut).onUpdate(X).start())}}).digest(e.hexPolygonsData)}}),oue=window.THREE?window.THREE:{Vector3:ce};function lue(i,e){var t=function(a,l){var u=a[a.length-1];return[].concat(Qi(a),Qi(Array(l-a.length).fill(u)))},n=Math.max(i.length,e.length),r=c$.apply(void 0,Qi([i,e].map(function(s){return s.map(function(a){var l=a.x,u=a.y,h=a.z;return[l,u,h]})}).map(function(s){return t(s,n)})));return function(s){return s===0?i:s===1?e:r(s).map(function(a){var l=gr(a,3),u=l[0],h=l[1],g=l[2];return new oue.Vector3(u,h,g)})}}var Pf=window.THREE?window.THREE:{BufferGeometry:Ki,Color:sn,Group:ja,Line:xy,NormalBlending:Ka,ShaderMaterial:Ja,Vector3:ce},uue=L0.default||L0,bO=xs({props:{pathsData:{default:[]},pathPoints:{default:function(e){return e}},pathPointLat:{default:function(e){return e[0]}},pathPointLng:{default:function(e){return e[1]}},pathPointAlt:{default:.001},pathResolution:{default:2},pathColor:{default:function(){return"#ffffaa"}},pathStroke:{},pathDashLength:{default:1},pathDashGap:{default:0},pathDashInitialGap:{default:0},pathDashAnimateTime:{default:0},pathTransitionDuration:{default:1e3,triggerUpdate:!1},rendererSize:{}},methods:{pauseAnimation:function(e){var t;(t=e.ticker)===null||t===void 0||t.pause()},resumeAnimation:function(e){var t;(t=e.ticker)===null||t===void 0||t.resume()},_destructor:function(e){var t;(t=e.ticker)===null||t===void 0||t.dispose()}},stateInit:function(e){var t=e.tweenGroup;return{tweenGroup:t,ticker:new uue,sharedMaterial:new Pf.ShaderMaterial(Hi(Hi({},pO()),{},{transparent:!0,blending:Pf.NormalBlending}))}},init:function(e,t){nr(e),t.scene=e,t.dataMapper=new ao(e,{objBindAttr:"__threeObjPath"}).onCreateObj(function(){var n=new Pf.Group;return n.__globeObjType="path",n}),t.ticker.onTick.add(function(n,r){t.dataMapper.entries().map(function(s){var a=gr(s,2),l=a[1];return l}).filter(function(s){return s.children.length&&s.children[0].material&&s.children[0].__dashAnimateStep}).forEach(function(s){var a=s.children[0],l=a.__dashAnimateStep*r;if(a.type==="Line"){var u=a.material.uniforms.dashTranslate.value%1e9;a.material.uniforms.dashTranslate.value=u+l}else if(a.type==="Line2"){for(var h=a.material.dashOffset-l,g=a.material.dashSize+a.material.gapSize;h<=-g;)h+=g;a.material.dashOffset=h}})})},update:function(e){var t=Ct(e.pathPoints),n=Ct(e.pathPointLat),r=Ct(e.pathPointLng),s=Ct(e.pathPointAlt),a=Ct(e.pathStroke),l=Ct(e.pathColor),u=Ct(e.pathDashLength),h=Ct(e.pathDashGap),g=Ct(e.pathDashInitialGap),v=Ct(e.pathDashAnimateTime);e.dataMapper.onUpdateObj(function(C,E){var B=a(E),L=B!=null;if(!C.children.length||L===(C.children[0].type==="Line")){nr(C);var O=L?new ble(new oO,new GE):new Pf.Line(new Pf.BufferGeometry,e.sharedMaterial.clone());C.add(O)}var z=C.children[0],G=S(t(E),n,r,s,e.pathResolution),k=v(E);if(z.__dashAnimateStep=k>0?1e3/k:0,L){z.material.resolution=e.rendererSize;{var V=u(E),X=h(E),J=g(E);z.material.dashed=X>0,z.material.dashed?z.material.defines.USE_DASH="":delete z.material.defines.USE_DASH,z.material.dashed&&(z.material.dashScale=1/x(G),z.material.dashSize=V,z.material.gapSize=X,z.material.dashOffset=-J)}{var te=l(E);if(te instanceof Array){var se=w(l(E),G.length-1,1,!1);z.geometry.setColors(se.array),z.material.vertexColors=!0}else{var ne=te,Z=Rl(ne);z.material.color=new Pf.Color(wu(ne)),z.material.transparent=Z<1,z.material.opacity=Z,z.material.vertexColors=!1}}z.material.needsUpdate=!0}else{Object.assign(z.material.uniforms,{dashSize:{value:u(E)},gapSize:{value:h(E)},dashOffset:{value:g(E)}});var H=w(l(E),G.length),F=R(G.length,1,!0);z.geometry.setAttribute("color",H),z.geometry.setAttribute("relDistance",F)}var ue=lue(C.__currentTargetD&&C.__currentTargetD.points||[G[0]],G),he=function(we){var We=C.__currentTargetD=we,Te=We.stroke,ze=We.interpolK,_e=C.__currentTargetD.points=ue(ze);if(L){var De;z.geometry.setPositions((De=[]).concat.apply(De,Qi(_e.map(function(pt){var _t=pt.x,wt=pt.y,Ge=pt.z;return[_t,wt,Ge]})))),z.material.linewidth=Te,z.material.dashed&&z.computeLineDistances()}else z.geometry.setFromPoints(_e),z.geometry.computeBoundingSphere()},be={stroke:B,interpolK:1},Se=Object.assign({},C.__currentTargetD||be,{interpolK:0});Object.keys(be).some(function(le){return Se[le]!==be[le]})&&(!e.pathTransitionDuration||e.pathTransitionDuration<0?he(be):e.tweenGroup.add(new ca(Se).to(be,e.pathTransitionDuration).easing(os.Quadratic.InOut).onUpdate(he).start()))}).digest(e.pathsData);function x(C){var E=0,B;return C.forEach(function(L){B&&(E+=B.distanceTo(L)),B=L}),E}function S(C,E,B,L,O){var z=function(F,V,X){for(var J=[],te=1;te<=X;te++)J.push(F+(V-F)*te/(X+1));return J},G=function(){var F=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],V=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,X=[],J=null;return F.forEach(function(te){if(J){for(;Math.abs(J[1]-te[1])>180;)J[1]+=360*(J[1]V)for(var ne=Math.floor(se/V),Z=z(J[0],te[0],ne),ue=z(J[1],te[1],ne),he=z(J[2],te[2],ne),be=0,Se=Z.length;be2&&arguments[2]!==void 0?arguments[2]:1,L=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,O=E+1,z;if(C instanceof Array||C instanceof Function){var G=C instanceof Array?Pc().domain(C.map(function(te,se){return se/(C.length-1)})).range(C):C;z=function(se){return jh(G(se),L,!0)}}else{var k=jh(C,L,!0);z=function(){return k}}for(var H=[],F=0,V=O;F1&&arguments[1]!==void 0?arguments[1]:1,B=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,L=C+1,O=[],z=0,G=L;z0&&arguments[0]!==void 0?arguments[0]:1,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:32;nx(this,e),t=tx(this,e),t.type="CircleLineGeometry",t.parameters={radius:n,segmentCount:r};for(var s=[],a=0;a<=r;a++){var l=(a/r-.25)*Math.PI*2;s.push({x:Math.cos(l)*n,y:Math.sin(l)*n,z:0})}return t.setFromPoints(s),t}return rx(e,i),ix(e)})(cue.BufferGeometry),Id=window.THREE?window.THREE:{Color:sn,Group:ja,Line:xy,LineBasicMaterial:$0,Vector3:ce},fue=L0.default||L0,wO=xs({props:{ringsData:{default:[]},ringLat:{default:"lat"},ringLng:{default:"lng"},ringAltitude:{default:.0015},ringColor:{default:function(){return"#ffffaa"},triggerUpdate:!1},ringResolution:{default:64,triggerUpdate:!1},ringMaxRadius:{default:2,triggerUpdate:!1},ringPropagationSpeed:{default:1,triggerUpdate:!1},ringRepeatPeriod:{default:700,triggerUpdate:!1}},methods:{pauseAnimation:function(e){var t;(t=e.ticker)===null||t===void 0||t.pause()},resumeAnimation:function(e){var t;(t=e.ticker)===null||t===void 0||t.resume()},_destructor:function(e){var t;(t=e.ticker)===null||t===void 0||t.dispose()}},init:function(e,t,n){var r=n.tweenGroup;nr(e),t.scene=e,t.tweenGroup=r,t.dataMapper=new ao(e,{objBindAttr:"__threeObjRing",removeDelay:3e4}).onCreateObj(function(){var s=new Id.Group;return s.__globeObjType="ring",s}),t.ticker=new fue,t.ticker.onTick.add(function(s){if(t.ringsData.length){var a=Ct(t.ringColor),l=Ct(t.ringAltitude),u=Ct(t.ringMaxRadius),h=Ct(t.ringPropagationSpeed),g=Ct(t.ringRepeatPeriod);t.dataMapper.entries().filter(function(v){var x=gr(v,2),S=x[1];return S}).forEach(function(v){var x=gr(v,2),S=x[0],w=x[1];if((w.__nextRingTime||0)<=s){var R=g(S)/1e3;w.__nextRingTime=s+(R<=0?1/0:R);var C=new Id.Line(new hue(1,t.ringResolution),new Id.LineBasicMaterial),E=a(S),B=E instanceof Array||E instanceof Function,L;B?E instanceof Array?(L=Pc().domain(E.map(function(X,J){return J/(E.length-1)})).range(E),C.material.transparent=E.some(function(X){return Rl(X)<1})):(L=E,C.material.transparent=!0):(C.material.color=new Id.Color(wu(E)),Wle(C.material,Rl(E)));var O=cr*(1+l(S)),z=u(S),G=z*Math.PI/180,k=h(S),H=k<=0,F=function(J){var te=J.t,se=(H?1-te:te)*G;if(C.scale.x=C.scale.y=O*Math.sin(se),C.position.z=O*(1-Math.cos(se)),B){var ne=L(te);C.material.color=new Id.Color(wu(ne)),C.material.transparent&&(C.material.opacity=Rl(ne))}};if(k===0)F({t:0}),w.add(C);else{var V=Math.abs(z/k)*1e3;t.tweenGroup.add(new ca({t:0}).to({t:1},V).onUpdate(F).onStart(function(){return w.add(C)}).onComplete(function(){w.remove(C),HE(C)}).start())}}})}})},update:function(e){var t=Ct(e.ringLat),n=Ct(e.ringLng),r=Ct(e.ringAltitude),s=e.scene.localToWorld(new Id.Vector3(0,0,0));e.dataMapper.onUpdateObj(function(a,l){var u=t(l),h=n(l),g=r(l);Object.assign(a.position,el(u,h,g)),a.lookAt(s)}).digest(e.ringsData)}}),Aue={0:{x_min:73,x_max:715,ha:792,o:"m 394 -29 q 153 129 242 -29 q 73 479 73 272 q 152 829 73 687 q 394 989 241 989 q 634 829 545 989 q 715 479 715 684 q 635 129 715 270 q 394 -29 546 -29 m 394 89 q 546 211 489 89 q 598 479 598 322 q 548 748 598 640 q 394 871 491 871 q 241 748 298 871 q 190 479 190 637 q 239 211 190 319 q 394 89 296 89 "},1:{x_min:215.671875,x_max:574,ha:792,o:"m 574 0 l 442 0 l 442 697 l 215 697 l 215 796 q 386 833 330 796 q 475 986 447 875 l 574 986 l 574 0 "},2:{x_min:59,x_max:731,ha:792,o:"m 731 0 l 59 0 q 197 314 59 188 q 457 487 199 315 q 598 691 598 580 q 543 819 598 772 q 411 867 488 867 q 272 811 328 867 q 209 630 209 747 l 81 630 q 182 901 81 805 q 408 986 271 986 q 629 909 536 986 q 731 694 731 826 q 613 449 731 541 q 378 316 495 383 q 201 122 235 234 l 731 122 l 731 0 "},3:{x_min:54,x_max:737,ha:792,o:"m 737 284 q 635 55 737 141 q 399 -25 541 -25 q 156 52 248 -25 q 54 308 54 140 l 185 308 q 245 147 185 202 q 395 96 302 96 q 539 140 484 96 q 602 280 602 190 q 510 429 602 390 q 324 454 451 454 l 324 565 q 487 584 441 565 q 565 719 565 617 q 515 835 565 791 q 395 879 466 879 q 255 824 307 879 q 203 661 203 769 l 78 661 q 166 909 78 822 q 387 992 250 992 q 603 921 513 992 q 701 723 701 844 q 669 607 701 656 q 578 524 637 558 q 696 434 655 499 q 737 284 737 369 "},4:{x_min:48,x_max:742.453125,ha:792,o:"m 742 243 l 602 243 l 602 0 l 476 0 l 476 243 l 48 243 l 48 368 l 476 958 l 602 958 l 602 354 l 742 354 l 742 243 m 476 354 l 476 792 l 162 354 l 476 354 "},5:{x_min:54.171875,x_max:738,ha:792,o:"m 738 314 q 626 60 738 153 q 382 -23 526 -23 q 155 47 248 -23 q 54 256 54 125 l 183 256 q 259 132 204 174 q 382 91 314 91 q 533 149 471 91 q 602 314 602 213 q 538 469 602 411 q 386 528 475 528 q 284 506 332 528 q 197 439 237 484 l 81 439 l 159 958 l 684 958 l 684 840 l 254 840 l 214 579 q 306 627 258 612 q 407 643 354 643 q 636 552 540 643 q 738 314 738 457 "},6:{x_min:53,x_max:739,ha:792,o:"m 739 312 q 633 62 739 162 q 400 -31 534 -31 q 162 78 257 -31 q 53 439 53 206 q 178 859 53 712 q 441 986 284 986 q 643 912 559 986 q 732 713 732 833 l 601 713 q 544 830 594 786 q 426 875 494 875 q 268 793 331 875 q 193 517 193 697 q 301 597 240 570 q 427 624 362 624 q 643 540 552 624 q 739 312 739 451 m 603 298 q 540 461 603 400 q 404 516 484 516 q 268 461 323 516 q 207 300 207 401 q 269 137 207 198 q 405 83 325 83 q 541 137 486 83 q 603 298 603 197 "},7:{x_min:58.71875,x_max:730.953125,ha:792,o:"m 730 839 q 469 448 560 641 q 335 0 378 255 l 192 0 q 328 441 235 252 q 593 830 421 630 l 58 830 l 58 958 l 730 958 l 730 839 "},8:{x_min:55,x_max:736,ha:792,o:"m 571 527 q 694 424 652 491 q 736 280 736 358 q 648 71 736 158 q 395 -26 551 -26 q 142 69 238 -26 q 55 279 55 157 q 96 425 55 359 q 220 527 138 491 q 120 615 153 562 q 88 726 88 668 q 171 904 88 827 q 395 986 261 986 q 618 905 529 986 q 702 727 702 830 q 670 616 702 667 q 571 527 638 565 m 394 565 q 519 610 475 565 q 563 717 563 655 q 521 823 563 781 q 392 872 474 872 q 265 824 312 872 q 224 720 224 783 q 265 613 224 656 q 394 565 312 565 m 395 91 q 545 150 488 91 q 597 280 597 204 q 546 408 597 355 q 395 465 492 465 q 244 408 299 465 q 194 280 194 356 q 244 150 194 203 q 395 91 299 91 "},9:{x_min:53,x_max:739,ha:792,o:"m 739 524 q 619 94 739 241 q 362 -32 516 -32 q 150 47 242 -32 q 59 244 59 126 l 191 244 q 246 129 191 176 q 373 82 301 82 q 526 161 466 82 q 597 440 597 255 q 363 334 501 334 q 130 432 216 334 q 53 650 53 521 q 134 880 53 786 q 383 986 226 986 q 659 841 566 986 q 739 524 739 719 m 388 449 q 535 514 480 449 q 585 658 585 573 q 535 805 585 744 q 388 873 480 873 q 242 809 294 873 q 191 658 191 745 q 239 514 191 572 q 388 449 292 449 "},ο:{x_min:0,x_max:712,ha:815,o:"m 356 -25 q 96 88 192 -25 q 0 368 0 201 q 92 642 0 533 q 356 761 192 761 q 617 644 517 761 q 712 368 712 533 q 619 91 712 201 q 356 -25 520 -25 m 356 85 q 527 175 465 85 q 583 369 583 255 q 528 562 583 484 q 356 651 466 651 q 189 560 250 651 q 135 369 135 481 q 187 177 135 257 q 356 85 250 85 "},S:{x_min:0,x_max:788,ha:890,o:"m 788 291 q 662 54 788 144 q 397 -26 550 -26 q 116 68 226 -26 q 0 337 0 168 l 131 337 q 200 152 131 220 q 384 85 269 85 q 557 129 479 85 q 650 270 650 183 q 490 429 650 379 q 194 513 341 470 q 33 739 33 584 q 142 964 33 881 q 388 1041 242 1041 q 644 957 543 1041 q 756 716 756 867 l 625 716 q 561 874 625 816 q 395 933 497 933 q 243 891 309 933 q 164 759 164 841 q 325 609 164 656 q 625 526 475 568 q 788 291 788 454 "},"¦":{x_min:343,x_max:449,ha:792,o:"m 449 462 l 343 462 l 343 986 l 449 986 l 449 462 m 449 -242 l 343 -242 l 343 280 l 449 280 l 449 -242 "},"/":{x_min:183.25,x_max:608.328125,ha:792,o:"m 608 1041 l 266 -129 l 183 -129 l 520 1041 l 608 1041 "},Τ:{x_min:-.4375,x_max:777.453125,ha:839,o:"m 777 893 l 458 893 l 458 0 l 319 0 l 319 892 l 0 892 l 0 1013 l 777 1013 l 777 893 "},y:{x_min:0,x_max:684.78125,ha:771,o:"m 684 738 l 388 -83 q 311 -216 356 -167 q 173 -279 252 -279 q 97 -266 133 -279 l 97 -149 q 132 -155 109 -151 q 168 -160 155 -160 q 240 -114 213 -160 q 274 -26 248 -98 l 0 738 l 137 737 l 341 139 l 548 737 l 684 738 "},Π:{x_min:0,x_max:803,ha:917,o:"m 803 0 l 667 0 l 667 886 l 140 886 l 140 0 l 0 0 l 0 1012 l 803 1012 l 803 0 "},ΐ:{x_min:-111,x_max:339,ha:361,o:"m 339 800 l 229 800 l 229 925 l 339 925 l 339 800 m -1 800 l -111 800 l -111 925 l -1 925 l -1 800 m 284 3 q 233 -10 258 -5 q 182 -15 207 -15 q 85 26 119 -15 q 42 200 42 79 l 42 737 l 167 737 l 168 215 q 172 141 168 157 q 226 101 183 101 q 248 103 239 101 q 284 112 257 104 l 284 3 m 302 1040 l 113 819 l 30 819 l 165 1040 l 302 1040 "},g:{x_min:0,x_max:686,ha:838,o:"m 686 34 q 586 -213 686 -121 q 331 -306 487 -306 q 131 -252 216 -306 q 31 -84 31 -190 l 155 -84 q 228 -174 166 -138 q 345 -207 284 -207 q 514 -109 454 -207 q 564 89 564 -27 q 461 6 521 36 q 335 -23 401 -23 q 88 100 184 -23 q 0 370 0 215 q 87 634 0 522 q 330 758 183 758 q 457 728 398 758 q 564 644 515 699 l 564 737 l 686 737 l 686 34 m 582 367 q 529 560 582 481 q 358 652 468 652 q 189 561 250 652 q 135 369 135 482 q 189 176 135 255 q 361 85 251 85 q 529 176 468 85 q 582 367 582 255 "},"²":{x_min:0,x_max:442,ha:539,o:"m 442 383 l 0 383 q 91 566 0 492 q 260 668 176 617 q 354 798 354 727 q 315 875 354 845 q 227 905 277 905 q 136 869 173 905 q 99 761 99 833 l 14 761 q 82 922 14 864 q 232 974 141 974 q 379 926 316 974 q 442 797 442 878 q 351 635 442 704 q 183 539 321 611 q 92 455 92 491 l 442 455 l 442 383 "},"–":{x_min:0,x_max:705.5625,ha:803,o:"m 705 334 l 0 334 l 0 410 l 705 410 l 705 334 "},Κ:{x_min:0,x_max:819.5625,ha:893,o:"m 819 0 l 650 0 l 294 509 l 139 356 l 139 0 l 0 0 l 0 1013 l 139 1013 l 139 526 l 626 1013 l 809 1013 l 395 600 l 819 0 "},ƒ:{x_min:-46.265625,x_max:392,ha:513,o:"m 392 651 l 259 651 l 79 -279 l -46 -278 l 134 651 l 14 651 l 14 751 l 135 751 q 151 948 135 900 q 304 1041 185 1041 q 334 1040 319 1041 q 392 1034 348 1039 l 392 922 q 337 931 360 931 q 271 883 287 931 q 260 793 260 853 l 260 751 l 392 751 l 392 651 "},e:{x_min:0,x_max:714,ha:813,o:"m 714 326 l 140 326 q 200 157 140 227 q 359 87 260 87 q 488 130 431 87 q 561 245 545 174 l 697 245 q 577 48 670 123 q 358 -26 484 -26 q 97 85 195 -26 q 0 363 0 197 q 94 642 0 529 q 358 765 195 765 q 626 627 529 765 q 714 326 714 503 m 576 429 q 507 583 564 522 q 355 650 445 650 q 206 583 266 650 q 140 429 152 522 l 576 429 "},ό:{x_min:0,x_max:712,ha:815,o:"m 356 -25 q 94 91 194 -25 q 0 368 0 202 q 92 642 0 533 q 356 761 192 761 q 617 644 517 761 q 712 368 712 533 q 619 91 712 201 q 356 -25 520 -25 m 356 85 q 527 175 465 85 q 583 369 583 255 q 528 562 583 484 q 356 651 466 651 q 189 560 250 651 q 135 369 135 481 q 187 177 135 257 q 356 85 250 85 m 576 1040 l 387 819 l 303 819 l 438 1040 l 576 1040 "},J:{x_min:0,x_max:588,ha:699,o:"m 588 279 q 287 -26 588 -26 q 58 73 126 -26 q 0 327 0 158 l 133 327 q 160 172 133 227 q 288 96 198 96 q 426 171 391 96 q 449 336 449 219 l 449 1013 l 588 1013 l 588 279 "},"»":{x_min:-1,x_max:503,ha:601,o:"m 503 302 l 280 136 l 281 256 l 429 373 l 281 486 l 280 608 l 503 440 l 503 302 m 221 302 l 0 136 l 0 255 l 145 372 l 0 486 l -1 608 l 221 440 l 221 302 "},"©":{x_min:-3,x_max:1008,ha:1106,o:"m 502 -7 q 123 151 263 -7 q -3 501 -3 294 q 123 851 -3 706 q 502 1011 263 1011 q 881 851 739 1011 q 1008 501 1008 708 q 883 151 1008 292 q 502 -7 744 -7 m 502 60 q 830 197 709 60 q 940 501 940 322 q 831 805 940 681 q 502 944 709 944 q 174 805 296 944 q 65 501 65 680 q 173 197 65 320 q 502 60 294 60 m 741 394 q 661 246 731 302 q 496 190 591 190 q 294 285 369 190 q 228 497 228 370 q 295 714 228 625 q 499 813 370 813 q 656 762 588 813 q 733 625 724 711 l 634 625 q 589 704 629 673 q 498 735 550 735 q 377 666 421 735 q 334 504 334 597 q 374 340 334 408 q 490 272 415 272 q 589 304 549 272 q 638 394 628 337 l 741 394 "},ώ:{x_min:0,x_max:922,ha:1030,o:"m 687 1040 l 498 819 l 415 819 l 549 1040 l 687 1040 m 922 339 q 856 97 922 203 q 650 -26 780 -26 q 538 9 587 -26 q 461 103 489 44 q 387 12 436 46 q 277 -22 339 -22 q 69 97 147 -22 q 0 338 0 202 q 45 551 0 444 q 161 737 84 643 l 302 737 q 175 552 219 647 q 124 336 124 446 q 155 179 124 248 q 275 88 197 88 q 375 163 341 88 q 400 294 400 219 l 400 572 l 524 572 l 524 294 q 561 135 524 192 q 643 88 591 88 q 762 182 719 88 q 797 341 797 257 q 745 555 797 450 q 619 737 705 637 l 760 737 q 874 551 835 640 q 922 339 922 444 "},"^":{x_min:193.0625,x_max:598.609375,ha:792,o:"m 598 772 l 515 772 l 395 931 l 277 772 l 193 772 l 326 1013 l 462 1013 l 598 772 "},"«":{x_min:0,x_max:507.203125,ha:604,o:"m 506 136 l 284 302 l 284 440 l 506 608 l 507 485 l 360 371 l 506 255 l 506 136 m 222 136 l 0 302 l 0 440 l 222 608 l 221 486 l 73 373 l 222 256 l 222 136 "},D:{x_min:0,x_max:828,ha:935,o:"m 389 1013 q 714 867 593 1013 q 828 521 828 729 q 712 161 828 309 q 382 0 587 0 l 0 0 l 0 1013 l 389 1013 m 376 124 q 607 247 523 124 q 681 510 681 355 q 607 771 681 662 q 376 896 522 896 l 139 896 l 139 124 l 376 124 "},"∙":{x_min:0,x_max:142,ha:239,o:"m 142 585 l 0 585 l 0 738 l 142 738 l 142 585 "},ÿ:{x_min:0,x_max:47,ha:125,o:"m 47 3 q 37 -7 47 -7 q 28 0 30 -7 q 39 -4 32 -4 q 45 3 45 -1 l 37 0 q 28 9 28 0 q 39 19 28 19 l 47 16 l 47 19 l 47 3 m 37 1 q 44 8 44 1 q 37 16 44 16 q 30 8 30 16 q 37 1 30 1 m 26 1 l 23 22 l 14 0 l 3 22 l 3 3 l 0 25 l 13 1 l 22 25 l 26 1 "},w:{x_min:0,x_max:1009.71875,ha:1100,o:"m 1009 738 l 783 0 l 658 0 l 501 567 l 345 0 l 222 0 l 0 738 l 130 738 l 284 174 l 432 737 l 576 738 l 721 173 l 881 737 l 1009 738 "},$:{x_min:0,x_max:700,ha:793,o:"m 664 717 l 542 717 q 490 825 531 785 q 381 872 450 865 l 381 551 q 620 446 540 522 q 700 241 700 370 q 618 45 700 116 q 381 -25 536 -25 l 381 -152 l 307 -152 l 307 -25 q 81 62 162 -25 q 0 297 0 149 l 124 297 q 169 146 124 204 q 307 81 215 89 l 307 441 q 80 536 148 469 q 13 725 13 603 q 96 910 13 839 q 307 982 180 982 l 307 1077 l 381 1077 l 381 982 q 574 917 494 982 q 664 717 664 845 m 307 565 l 307 872 q 187 831 233 872 q 142 724 142 791 q 180 618 142 656 q 307 565 218 580 m 381 76 q 562 237 562 96 q 517 361 562 313 q 381 423 472 409 l 381 76 "},"\\":{x_min:-.015625,x_max:425.0625,ha:522,o:"m 425 -129 l 337 -129 l 0 1041 l 83 1041 l 425 -129 "},µ:{x_min:0,x_max:697.21875,ha:747,o:"m 697 -4 q 629 -14 658 -14 q 498 97 513 -14 q 422 9 470 41 q 313 -23 374 -23 q 207 4 258 -23 q 119 81 156 32 l 119 -278 l 0 -278 l 0 738 l 124 738 l 124 343 q 165 173 124 246 q 308 83 216 83 q 452 178 402 83 q 493 359 493 255 l 493 738 l 617 738 l 617 214 q 623 136 617 160 q 673 92 637 92 q 697 96 684 92 l 697 -4 "},Ι:{x_min:42,x_max:181,ha:297,o:"m 181 0 l 42 0 l 42 1013 l 181 1013 l 181 0 "},Ύ:{x_min:0,x_max:1144.5,ha:1214,o:"m 1144 1012 l 807 416 l 807 0 l 667 0 l 667 416 l 325 1012 l 465 1012 l 736 533 l 1004 1012 l 1144 1012 m 277 1040 l 83 799 l 0 799 l 140 1040 l 277 1040 "},"’":{x_min:0,x_max:139,ha:236,o:"m 139 851 q 102 737 139 784 q 0 669 65 690 l 0 734 q 59 787 42 741 q 72 873 72 821 l 0 873 l 0 1013 l 139 1013 l 139 851 "},Ν:{x_min:0,x_max:801,ha:915,o:"m 801 0 l 651 0 l 131 822 l 131 0 l 0 0 l 0 1013 l 151 1013 l 670 191 l 670 1013 l 801 1013 l 801 0 "},"-":{x_min:8.71875,x_max:350.390625,ha:478,o:"m 350 317 l 8 317 l 8 428 l 350 428 l 350 317 "},Q:{x_min:0,x_max:968,ha:1072,o:"m 954 5 l 887 -79 l 744 35 q 622 -11 687 2 q 483 -26 556 -26 q 127 130 262 -26 q 0 504 0 279 q 127 880 0 728 q 484 1041 262 1041 q 841 884 708 1041 q 968 507 968 735 q 933 293 968 398 q 832 104 899 188 l 954 5 m 723 191 q 802 330 777 248 q 828 499 828 412 q 744 790 828 673 q 483 922 650 922 q 228 791 322 922 q 142 505 142 673 q 227 221 142 337 q 487 91 323 91 q 632 123 566 91 l 520 215 l 587 301 l 723 191 "},ς:{x_min:1,x_max:676.28125,ha:740,o:"m 676 460 l 551 460 q 498 595 542 546 q 365 651 448 651 q 199 578 263 651 q 136 401 136 505 q 266 178 136 241 q 508 106 387 142 q 640 -50 640 62 q 625 -158 640 -105 q 583 -278 611 -211 l 465 -278 q 498 -182 490 -211 q 515 -80 515 -126 q 381 12 515 -15 q 134 91 197 51 q 1 388 1 179 q 100 651 1 542 q 354 761 199 761 q 587 680 498 761 q 676 460 676 599 "},M:{x_min:0,x_max:954,ha:1067,o:"m 954 0 l 819 0 l 819 869 l 537 0 l 405 0 l 128 866 l 128 0 l 0 0 l 0 1013 l 200 1013 l 472 160 l 757 1013 l 954 1013 l 954 0 "},Ψ:{x_min:0,x_max:1006,ha:1094,o:"m 1006 678 q 914 319 1006 429 q 571 200 814 200 l 571 0 l 433 0 l 433 200 q 92 319 194 200 q 0 678 0 429 l 0 1013 l 139 1013 l 139 679 q 191 417 139 492 q 433 326 255 326 l 433 1013 l 571 1013 l 571 326 l 580 326 q 813 423 747 326 q 868 679 868 502 l 868 1013 l 1006 1013 l 1006 678 "},C:{x_min:0,x_max:886,ha:944,o:"m 886 379 q 760 87 886 201 q 455 -26 634 -26 q 112 136 236 -26 q 0 509 0 283 q 118 882 0 737 q 469 1041 245 1041 q 748 955 630 1041 q 879 708 879 859 l 745 708 q 649 862 724 805 q 473 920 573 920 q 219 791 312 920 q 136 509 136 675 q 217 229 136 344 q 470 99 311 99 q 672 179 591 99 q 753 379 753 259 l 886 379 "},"!":{x_min:0,x_max:138,ha:236,o:"m 138 684 q 116 409 138 629 q 105 244 105 299 l 33 244 q 16 465 33 313 q 0 684 0 616 l 0 1013 l 138 1013 l 138 684 m 138 0 l 0 0 l 0 151 l 138 151 l 138 0 "},"{":{x_min:0,x_max:480.5625,ha:578,o:"m 480 -286 q 237 -213 303 -286 q 187 -45 187 -159 q 194 48 187 -15 q 201 141 201 112 q 164 264 201 225 q 0 314 118 314 l 0 417 q 164 471 119 417 q 201 605 201 514 q 199 665 201 644 q 193 772 193 769 q 241 941 193 887 q 480 1015 308 1015 l 480 915 q 336 866 375 915 q 306 742 306 828 q 310 662 306 717 q 314 577 314 606 q 288 452 314 500 q 176 365 256 391 q 289 275 257 337 q 314 143 314 226 q 313 84 314 107 q 310 -11 310 -5 q 339 -131 310 -94 q 480 -182 377 -182 l 480 -286 "},X:{x_min:-.015625,x_max:854.15625,ha:940,o:"m 854 0 l 683 0 l 423 409 l 166 0 l 0 0 l 347 519 l 18 1013 l 186 1013 l 428 637 l 675 1013 l 836 1013 l 504 520 l 854 0 "},"#":{x_min:0,x_max:963.890625,ha:1061,o:"m 963 690 l 927 590 l 719 590 l 655 410 l 876 410 l 840 310 l 618 310 l 508 -3 l 393 -2 l 506 309 l 329 310 l 215 -2 l 102 -3 l 212 310 l 0 310 l 36 410 l 248 409 l 312 590 l 86 590 l 120 690 l 347 690 l 459 1006 l 573 1006 l 462 690 l 640 690 l 751 1006 l 865 1006 l 754 690 l 963 690 m 606 590 l 425 590 l 362 410 l 543 410 l 606 590 "},ι:{x_min:42,x_max:284,ha:361,o:"m 284 3 q 233 -10 258 -5 q 182 -15 207 -15 q 85 26 119 -15 q 42 200 42 79 l 42 738 l 167 738 l 168 215 q 172 141 168 157 q 226 101 183 101 q 248 103 239 101 q 284 112 257 104 l 284 3 "},Ά:{x_min:0,x_max:906.953125,ha:982,o:"m 283 1040 l 88 799 l 5 799 l 145 1040 l 283 1040 m 906 0 l 756 0 l 650 303 l 251 303 l 143 0 l 0 0 l 376 1012 l 529 1012 l 906 0 m 609 421 l 452 866 l 293 421 l 609 421 "},")":{x_min:0,x_max:318,ha:415,o:"m 318 365 q 257 25 318 191 q 87 -290 197 -141 l 0 -290 q 140 21 93 -128 q 193 360 193 189 q 141 704 193 537 q 0 1024 97 850 l 87 1024 q 257 706 197 871 q 318 365 318 542 "},ε:{x_min:0,x_max:634.71875,ha:714,o:"m 634 234 q 527 38 634 110 q 300 -25 433 -25 q 98 29 183 -25 q 0 204 0 93 q 37 314 0 265 q 128 390 67 353 q 56 460 82 419 q 26 555 26 505 q 114 712 26 654 q 295 763 191 763 q 499 700 416 763 q 589 515 589 631 l 478 515 q 419 618 464 580 q 307 657 374 657 q 207 630 253 657 q 151 547 151 598 q 238 445 151 469 q 389 434 280 434 l 389 331 l 349 331 q 206 315 255 331 q 125 210 125 287 q 183 107 125 145 q 302 76 233 76 q 436 117 379 76 q 509 234 493 159 l 634 234 "},Δ:{x_min:0,x_max:952.78125,ha:1028,o:"m 952 0 l 0 0 l 400 1013 l 551 1013 l 952 0 m 762 124 l 476 867 l 187 124 l 762 124 "},"}":{x_min:0,x_max:481,ha:578,o:"m 481 314 q 318 262 364 314 q 282 136 282 222 q 284 65 282 97 q 293 -58 293 -48 q 241 -217 293 -166 q 0 -286 174 -286 l 0 -182 q 143 -130 105 -182 q 171 -2 171 -93 q 168 81 171 22 q 165 144 165 140 q 188 275 165 229 q 306 365 220 339 q 191 455 224 391 q 165 588 165 505 q 168 681 165 624 q 171 742 171 737 q 141 865 171 827 q 0 915 102 915 l 0 1015 q 243 942 176 1015 q 293 773 293 888 q 287 675 293 741 q 282 590 282 608 q 318 466 282 505 q 481 417 364 417 l 481 314 "},"‰":{x_min:-3,x_max:1672,ha:1821,o:"m 846 0 q 664 76 732 0 q 603 244 603 145 q 662 412 603 344 q 846 489 729 489 q 1027 412 959 489 q 1089 244 1089 343 q 1029 76 1089 144 q 846 0 962 0 m 845 103 q 945 143 910 103 q 981 243 981 184 q 947 340 981 301 q 845 385 910 385 q 745 342 782 385 q 709 243 709 300 q 742 147 709 186 q 845 103 781 103 m 888 986 l 284 -25 l 199 -25 l 803 986 l 888 986 m 241 468 q 58 545 126 468 q -3 715 -3 615 q 56 881 -3 813 q 238 958 124 958 q 421 881 353 958 q 483 712 483 813 q 423 544 483 612 q 241 468 356 468 m 241 855 q 137 811 175 855 q 100 710 100 768 q 136 612 100 653 q 240 572 172 572 q 344 614 306 572 q 382 713 382 656 q 347 810 382 771 q 241 855 308 855 m 1428 0 q 1246 76 1314 0 q 1185 244 1185 145 q 1244 412 1185 344 q 1428 489 1311 489 q 1610 412 1542 489 q 1672 244 1672 343 q 1612 76 1672 144 q 1428 0 1545 0 m 1427 103 q 1528 143 1492 103 q 1564 243 1564 184 q 1530 340 1564 301 q 1427 385 1492 385 q 1327 342 1364 385 q 1291 243 1291 300 q 1324 147 1291 186 q 1427 103 1363 103 "},a:{x_min:0,x_max:698.609375,ha:794,o:"m 698 0 q 661 -12 679 -7 q 615 -17 643 -17 q 536 12 564 -17 q 500 96 508 41 q 384 6 456 37 q 236 -25 312 -25 q 65 31 130 -25 q 0 194 0 88 q 118 390 0 334 q 328 435 180 420 q 488 483 476 451 q 495 523 495 504 q 442 619 495 584 q 325 654 389 654 q 209 617 257 654 q 152 513 161 580 l 33 513 q 123 705 33 633 q 332 772 207 772 q 528 712 448 772 q 617 531 617 645 l 617 163 q 624 108 617 126 q 664 90 632 90 l 698 94 l 698 0 m 491 262 l 491 372 q 272 329 350 347 q 128 201 128 294 q 166 113 128 144 q 264 83 205 83 q 414 130 346 83 q 491 262 491 183 "},"—":{x_min:0,x_max:941.671875,ha:1039,o:"m 941 334 l 0 334 l 0 410 l 941 410 l 941 334 "},"=":{x_min:8.71875,x_max:780.953125,ha:792,o:"m 780 510 l 8 510 l 8 606 l 780 606 l 780 510 m 780 235 l 8 235 l 8 332 l 780 332 l 780 235 "},N:{x_min:0,x_max:801,ha:914,o:"m 801 0 l 651 0 l 131 823 l 131 0 l 0 0 l 0 1013 l 151 1013 l 670 193 l 670 1013 l 801 1013 l 801 0 "},ρ:{x_min:0,x_max:712,ha:797,o:"m 712 369 q 620 94 712 207 q 362 -26 521 -26 q 230 2 292 -26 q 119 83 167 30 l 119 -278 l 0 -278 l 0 362 q 91 643 0 531 q 355 764 190 764 q 617 647 517 764 q 712 369 712 536 m 583 366 q 530 559 583 480 q 359 651 469 651 q 190 562 252 651 q 135 370 135 483 q 189 176 135 257 q 359 85 250 85 q 528 175 466 85 q 583 366 583 254 "},"¯":{x_min:0,x_max:941.671875,ha:938,o:"m 941 1033 l 0 1033 l 0 1109 l 941 1109 l 941 1033 "},Z:{x_min:0,x_max:779,ha:849,o:"m 779 0 l 0 0 l 0 113 l 621 896 l 40 896 l 40 1013 l 779 1013 l 778 887 l 171 124 l 779 124 l 779 0 "},u:{x_min:0,x_max:617,ha:729,o:"m 617 0 l 499 0 l 499 110 q 391 10 460 45 q 246 -25 322 -25 q 61 58 127 -25 q 0 258 0 136 l 0 738 l 125 738 l 125 284 q 156 148 125 202 q 273 82 197 82 q 433 165 369 82 q 493 340 493 243 l 493 738 l 617 738 l 617 0 "},k:{x_min:0,x_max:612.484375,ha:697,o:"m 612 738 l 338 465 l 608 0 l 469 0 l 251 382 l 121 251 l 121 0 l 0 0 l 0 1013 l 121 1013 l 121 402 l 456 738 l 612 738 "},Η:{x_min:0,x_max:803,ha:917,o:"m 803 0 l 667 0 l 667 475 l 140 475 l 140 0 l 0 0 l 0 1013 l 140 1013 l 140 599 l 667 599 l 667 1013 l 803 1013 l 803 0 "},Α:{x_min:0,x_max:906.953125,ha:985,o:"m 906 0 l 756 0 l 650 303 l 251 303 l 143 0 l 0 0 l 376 1013 l 529 1013 l 906 0 m 609 421 l 452 866 l 293 421 l 609 421 "},s:{x_min:0,x_max:604,ha:697,o:"m 604 217 q 501 36 604 104 q 292 -23 411 -23 q 86 43 166 -23 q 0 238 0 114 l 121 237 q 175 122 121 164 q 300 85 223 85 q 415 112 363 85 q 479 207 479 147 q 361 309 479 276 q 140 372 141 370 q 21 544 21 426 q 111 708 21 647 q 298 761 190 761 q 492 705 413 761 q 583 531 583 643 l 462 531 q 412 625 462 594 q 298 657 363 657 q 199 636 242 657 q 143 558 143 608 q 262 454 143 486 q 484 394 479 397 q 604 217 604 341 "},B:{x_min:0,x_max:778,ha:876,o:"m 580 546 q 724 469 670 535 q 778 311 778 403 q 673 83 778 171 q 432 0 575 0 l 0 0 l 0 1013 l 411 1013 q 629 957 541 1013 q 732 768 732 892 q 691 633 732 693 q 580 546 650 572 m 393 899 l 139 899 l 139 588 l 379 588 q 521 624 462 588 q 592 744 592 667 q 531 859 592 819 q 393 899 471 899 m 419 124 q 566 169 504 124 q 635 303 635 219 q 559 436 635 389 q 402 477 494 477 l 139 477 l 139 124 l 419 124 "},"…":{x_min:0,x_max:614,ha:708,o:"m 142 0 l 0 0 l 0 151 l 142 151 l 142 0 m 378 0 l 236 0 l 236 151 l 378 151 l 378 0 m 614 0 l 472 0 l 472 151 l 614 151 l 614 0 "},"?":{x_min:0,x_max:607,ha:704,o:"m 607 777 q 543 599 607 674 q 422 474 482 537 q 357 272 357 391 l 236 272 q 297 487 236 395 q 411 619 298 490 q 474 762 474 691 q 422 885 474 838 q 301 933 371 933 q 179 880 228 933 q 124 706 124 819 l 0 706 q 94 963 0 872 q 302 1044 177 1044 q 511 973 423 1044 q 607 777 607 895 m 370 0 l 230 0 l 230 151 l 370 151 l 370 0 "},H:{x_min:0,x_max:803,ha:915,o:"m 803 0 l 667 0 l 667 475 l 140 475 l 140 0 l 0 0 l 0 1013 l 140 1013 l 140 599 l 667 599 l 667 1013 l 803 1013 l 803 0 "},ν:{x_min:0,x_max:675,ha:761,o:"m 675 738 l 404 0 l 272 0 l 0 738 l 133 738 l 340 147 l 541 738 l 675 738 "},c:{x_min:1,x_max:701.390625,ha:775,o:"m 701 264 q 584 53 681 133 q 353 -26 487 -26 q 91 91 188 -26 q 1 370 1 201 q 92 645 1 537 q 353 761 190 761 q 572 688 479 761 q 690 493 666 615 l 556 493 q 487 606 545 562 q 356 650 428 650 q 186 563 246 650 q 134 372 134 487 q 188 179 134 258 q 359 88 250 88 q 492 136 437 88 q 566 264 548 185 l 701 264 "},"¶":{x_min:0,x_max:566.671875,ha:678,o:"m 21 892 l 52 892 l 98 761 l 145 892 l 176 892 l 178 741 l 157 741 l 157 867 l 108 741 l 88 741 l 40 871 l 40 741 l 21 741 l 21 892 m 308 854 l 308 731 q 252 691 308 691 q 227 691 240 691 q 207 696 213 695 l 207 712 l 253 706 q 288 733 288 706 l 288 763 q 244 741 279 741 q 193 797 193 741 q 261 860 193 860 q 287 860 273 860 q 308 854 302 855 m 288 842 l 263 843 q 213 796 213 843 q 248 756 213 756 q 288 796 288 756 l 288 842 m 566 988 l 502 988 l 502 -1 l 439 -1 l 439 988 l 317 988 l 317 -1 l 252 -1 l 252 602 q 81 653 155 602 q 0 805 0 711 q 101 989 0 918 q 309 1053 194 1053 l 566 1053 l 566 988 "},β:{x_min:0,x_max:660,ha:745,o:"m 471 550 q 610 450 561 522 q 660 280 660 378 q 578 64 660 151 q 367 -22 497 -22 q 239 5 299 -22 q 126 82 178 32 l 126 -278 l 0 -278 l 0 593 q 54 903 0 801 q 318 1042 127 1042 q 519 964 436 1042 q 603 771 603 887 q 567 644 603 701 q 471 550 532 586 m 337 79 q 476 138 418 79 q 535 279 535 198 q 427 437 535 386 q 226 477 344 477 l 226 583 q 398 620 329 583 q 486 762 486 668 q 435 884 486 833 q 312 935 384 935 q 169 861 219 935 q 126 698 126 797 l 126 362 q 170 169 126 242 q 337 79 224 79 "},Μ:{x_min:0,x_max:954,ha:1068,o:"m 954 0 l 819 0 l 819 868 l 537 0 l 405 0 l 128 865 l 128 0 l 0 0 l 0 1013 l 199 1013 l 472 158 l 758 1013 l 954 1013 l 954 0 "},Ό:{x_min:.109375,x_max:1120,ha:1217,o:"m 1120 505 q 994 132 1120 282 q 642 -29 861 -29 q 290 130 422 -29 q 167 505 167 280 q 294 883 167 730 q 650 1046 430 1046 q 999 882 868 1046 q 1120 505 1120 730 m 977 504 q 896 784 977 669 q 644 915 804 915 q 391 785 484 915 q 307 504 307 669 q 391 224 307 339 q 644 95 486 95 q 894 224 803 95 q 977 504 977 339 m 277 1040 l 83 799 l 0 799 l 140 1040 l 277 1040 "},Ή:{x_min:0,x_max:1158,ha:1275,o:"m 1158 0 l 1022 0 l 1022 475 l 496 475 l 496 0 l 356 0 l 356 1012 l 496 1012 l 496 599 l 1022 599 l 1022 1012 l 1158 1012 l 1158 0 m 277 1040 l 83 799 l 0 799 l 140 1040 l 277 1040 "},"•":{x_min:0,x_max:663.890625,ha:775,o:"m 663 529 q 566 293 663 391 q 331 196 469 196 q 97 294 194 196 q 0 529 0 393 q 96 763 0 665 q 331 861 193 861 q 566 763 469 861 q 663 529 663 665 "},"¥":{x_min:.1875,x_max:819.546875,ha:886,o:"m 563 561 l 697 561 l 696 487 l 520 487 l 482 416 l 482 380 l 697 380 l 695 308 l 482 308 l 482 0 l 342 0 l 342 308 l 125 308 l 125 380 l 342 380 l 342 417 l 303 487 l 125 487 l 125 561 l 258 561 l 0 1013 l 140 1013 l 411 533 l 679 1013 l 819 1013 l 563 561 "},"(":{x_min:0,x_max:318.0625,ha:415,o:"m 318 -290 l 230 -290 q 61 23 122 -142 q 0 365 0 190 q 62 712 0 540 q 230 1024 119 869 l 318 1024 q 175 705 219 853 q 125 360 125 542 q 176 22 125 187 q 318 -290 223 -127 "},U:{x_min:0,x_max:796,ha:904,o:"m 796 393 q 681 93 796 212 q 386 -25 566 -25 q 101 95 208 -25 q 0 393 0 211 l 0 1013 l 138 1013 l 138 391 q 204 191 138 270 q 394 107 276 107 q 586 191 512 107 q 656 391 656 270 l 656 1013 l 796 1013 l 796 393 "},γ:{x_min:.5,x_max:744.953125,ha:822,o:"m 744 737 l 463 54 l 463 -278 l 338 -278 l 338 54 l 154 495 q 104 597 124 569 q 13 651 67 651 l 0 651 l 0 751 l 39 753 q 168 711 121 753 q 242 594 207 676 l 403 208 l 617 737 l 744 737 "},α:{x_min:0,x_max:765.5625,ha:809,o:"m 765 -4 q 698 -14 726 -14 q 564 97 586 -14 q 466 7 525 40 q 337 -26 407 -26 q 88 98 186 -26 q 0 369 0 212 q 88 637 0 525 q 337 760 184 760 q 465 728 407 760 q 563 637 524 696 l 563 739 l 685 739 l 685 222 q 693 141 685 168 q 748 94 708 94 q 765 96 760 94 l 765 -4 m 584 371 q 531 562 584 485 q 360 653 470 653 q 192 566 254 653 q 135 379 135 489 q 186 181 135 261 q 358 84 247 84 q 528 176 465 84 q 584 371 584 260 "},F:{x_min:0,x_max:683.328125,ha:717,o:"m 683 888 l 140 888 l 140 583 l 613 583 l 613 458 l 140 458 l 140 0 l 0 0 l 0 1013 l 683 1013 l 683 888 "},"­":{x_min:0,x_max:705.5625,ha:803,o:"m 705 334 l 0 334 l 0 410 l 705 410 l 705 334 "},":":{x_min:0,x_max:142,ha:239,o:"m 142 585 l 0 585 l 0 738 l 142 738 l 142 585 m 142 0 l 0 0 l 0 151 l 142 151 l 142 0 "},Χ:{x_min:0,x_max:854.171875,ha:935,o:"m 854 0 l 683 0 l 423 409 l 166 0 l 0 0 l 347 519 l 18 1013 l 186 1013 l 427 637 l 675 1013 l 836 1013 l 504 521 l 854 0 "},"*":{x_min:116,x_max:674,ha:792,o:"m 674 768 l 475 713 l 610 544 l 517 477 l 394 652 l 272 478 l 178 544 l 314 713 l 116 766 l 153 876 l 341 812 l 342 1013 l 446 1013 l 446 811 l 635 874 l 674 768 "},"†":{x_min:0,x_max:777,ha:835,o:"m 458 804 l 777 804 l 777 683 l 458 683 l 458 0 l 319 0 l 319 681 l 0 683 l 0 804 l 319 804 l 319 1015 l 458 1013 l 458 804 "},"°":{x_min:0,x_max:347,ha:444,o:"m 173 802 q 43 856 91 802 q 0 977 0 905 q 45 1101 0 1049 q 173 1153 90 1153 q 303 1098 255 1153 q 347 977 347 1049 q 303 856 347 905 q 173 802 256 802 m 173 884 q 238 910 214 884 q 262 973 262 937 q 239 1038 262 1012 q 173 1064 217 1064 q 108 1037 132 1064 q 85 973 85 1010 q 108 910 85 937 q 173 884 132 884 "},V:{x_min:0,x_max:862.71875,ha:940,o:"m 862 1013 l 505 0 l 361 0 l 0 1013 l 143 1013 l 434 165 l 718 1012 l 862 1013 "},Ξ:{x_min:0,x_max:734.71875,ha:763,o:"m 723 889 l 9 889 l 9 1013 l 723 1013 l 723 889 m 673 463 l 61 463 l 61 589 l 673 589 l 673 463 m 734 0 l 0 0 l 0 124 l 734 124 l 734 0 "}," ":{x_min:0,x_max:0,ha:853},Ϋ:{x_min:.328125,x_max:819.515625,ha:889,o:"m 588 1046 l 460 1046 l 460 1189 l 588 1189 l 588 1046 m 360 1046 l 232 1046 l 232 1189 l 360 1189 l 360 1046 m 819 1012 l 482 416 l 482 0 l 342 0 l 342 416 l 0 1012 l 140 1012 l 411 533 l 679 1012 l 819 1012 "},"”":{x_min:0,x_max:347,ha:454,o:"m 139 851 q 102 737 139 784 q 0 669 65 690 l 0 734 q 59 787 42 741 q 72 873 72 821 l 0 873 l 0 1013 l 139 1013 l 139 851 m 347 851 q 310 737 347 784 q 208 669 273 690 l 208 734 q 267 787 250 741 q 280 873 280 821 l 208 873 l 208 1013 l 347 1013 l 347 851 "},"@":{x_min:0,x_max:1260,ha:1357,o:"m 1098 -45 q 877 -160 1001 -117 q 633 -203 752 -203 q 155 -29 327 -203 q 0 360 0 127 q 176 802 0 616 q 687 1008 372 1008 q 1123 854 969 1008 q 1260 517 1260 718 q 1155 216 1260 341 q 868 82 1044 82 q 772 106 801 82 q 737 202 737 135 q 647 113 700 144 q 527 82 594 82 q 367 147 420 82 q 314 312 314 212 q 401 565 314 452 q 639 690 498 690 q 810 588 760 690 l 849 668 l 938 668 q 877 441 900 532 q 833 226 833 268 q 853 182 833 198 q 902 167 873 167 q 1088 272 1012 167 q 1159 512 1159 372 q 1051 793 1159 681 q 687 925 925 925 q 248 747 415 925 q 97 361 97 586 q 226 26 97 159 q 627 -122 370 -122 q 856 -87 737 -122 q 1061 8 976 -53 l 1098 -45 m 786 488 q 738 580 777 545 q 643 615 700 615 q 483 517 548 615 q 425 322 425 430 q 457 203 425 250 q 552 156 490 156 q 722 273 665 156 q 786 488 738 309 "},Ί:{x_min:0,x_max:499,ha:613,o:"m 277 1040 l 83 799 l 0 799 l 140 1040 l 277 1040 m 499 0 l 360 0 l 360 1012 l 499 1012 l 499 0 "},i:{x_min:14,x_max:136,ha:275,o:"m 136 873 l 14 873 l 14 1013 l 136 1013 l 136 873 m 136 0 l 14 0 l 14 737 l 136 737 l 136 0 "},Β:{x_min:0,x_max:778,ha:877,o:"m 580 545 q 724 468 671 534 q 778 310 778 402 q 673 83 778 170 q 432 0 575 0 l 0 0 l 0 1013 l 411 1013 q 629 957 541 1013 q 732 768 732 891 q 691 632 732 692 q 580 545 650 571 m 393 899 l 139 899 l 139 587 l 379 587 q 521 623 462 587 q 592 744 592 666 q 531 859 592 819 q 393 899 471 899 m 419 124 q 566 169 504 124 q 635 302 635 219 q 559 435 635 388 q 402 476 494 476 l 139 476 l 139 124 l 419 124 "},υ:{x_min:0,x_max:617,ha:725,o:"m 617 352 q 540 94 617 199 q 308 -24 455 -24 q 76 94 161 -24 q 0 352 0 199 l 0 739 l 126 739 l 126 355 q 169 185 126 257 q 312 98 220 98 q 451 185 402 98 q 492 355 492 257 l 492 739 l 617 739 l 617 352 "},"]":{x_min:0,x_max:275,ha:372,o:"m 275 -281 l 0 -281 l 0 -187 l 151 -187 l 151 920 l 0 920 l 0 1013 l 275 1013 l 275 -281 "},m:{x_min:0,x_max:1019,ha:1128,o:"m 1019 0 l 897 0 l 897 454 q 860 591 897 536 q 739 660 816 660 q 613 586 659 660 q 573 436 573 522 l 573 0 l 447 0 l 447 455 q 412 591 447 535 q 294 657 372 657 q 165 586 213 657 q 122 437 122 521 l 122 0 l 0 0 l 0 738 l 117 738 l 117 640 q 202 730 150 697 q 316 763 254 763 q 437 730 381 763 q 525 642 494 697 q 621 731 559 700 q 753 763 682 763 q 943 694 867 763 q 1019 512 1019 625 l 1019 0 "},χ:{x_min:8.328125,x_max:780.5625,ha:815,o:"m 780 -278 q 715 -294 747 -294 q 616 -257 663 -294 q 548 -175 576 -227 l 379 133 l 143 -277 l 9 -277 l 313 254 l 163 522 q 127 586 131 580 q 36 640 91 640 q 8 637 27 640 l 8 752 l 52 757 q 162 719 113 757 q 236 627 200 690 l 383 372 l 594 737 l 726 737 l 448 250 l 625 -69 q 670 -153 647 -110 q 743 -188 695 -188 q 780 -184 759 -188 l 780 -278 "},ί:{x_min:42,x_max:326.71875,ha:361,o:"m 284 3 q 233 -10 258 -5 q 182 -15 207 -15 q 85 26 119 -15 q 42 200 42 79 l 42 737 l 167 737 l 168 215 q 172 141 168 157 q 226 101 183 101 q 248 102 239 101 q 284 112 257 104 l 284 3 m 326 1040 l 137 819 l 54 819 l 189 1040 l 326 1040 "},Ζ:{x_min:0,x_max:779.171875,ha:850,o:"m 779 0 l 0 0 l 0 113 l 620 896 l 40 896 l 40 1013 l 779 1013 l 779 887 l 170 124 l 779 124 l 779 0 "},R:{x_min:0,x_max:781.953125,ha:907,o:"m 781 0 l 623 0 q 587 242 590 52 q 407 433 585 433 l 138 433 l 138 0 l 0 0 l 0 1013 l 396 1013 q 636 946 539 1013 q 749 731 749 868 q 711 597 749 659 q 608 502 674 534 q 718 370 696 474 q 729 207 722 352 q 781 26 736 62 l 781 0 m 373 551 q 533 594 465 551 q 614 731 614 645 q 532 859 614 815 q 373 896 465 896 l 138 896 l 138 551 l 373 551 "},o:{x_min:0,x_max:713,ha:821,o:"m 357 -25 q 94 91 194 -25 q 0 368 0 202 q 93 642 0 533 q 357 761 193 761 q 618 644 518 761 q 713 368 713 533 q 619 91 713 201 q 357 -25 521 -25 m 357 85 q 528 175 465 85 q 584 369 584 255 q 529 562 584 484 q 357 651 467 651 q 189 560 250 651 q 135 369 135 481 q 187 177 135 257 q 357 85 250 85 "},K:{x_min:0,x_max:819.46875,ha:906,o:"m 819 0 l 649 0 l 294 509 l 139 355 l 139 0 l 0 0 l 0 1013 l 139 1013 l 139 526 l 626 1013 l 809 1013 l 395 600 l 819 0 "},",":{x_min:0,x_max:142,ha:239,o:"m 142 -12 q 105 -132 142 -82 q 0 -205 68 -182 l 0 -138 q 57 -82 40 -124 q 70 0 70 -51 l 0 0 l 0 151 l 142 151 l 142 -12 "},d:{x_min:0,x_max:683,ha:796,o:"m 683 0 l 564 0 l 564 93 q 456 6 516 38 q 327 -25 395 -25 q 87 100 181 -25 q 0 365 0 215 q 90 639 0 525 q 343 763 187 763 q 564 647 486 763 l 564 1013 l 683 1013 l 683 0 m 582 373 q 529 562 582 484 q 361 653 468 653 q 190 561 253 653 q 135 365 135 479 q 189 175 135 254 q 358 85 251 85 q 529 178 468 85 q 582 373 582 258 "},"¨":{x_min:-109,x_max:247,ha:232,o:"m 247 1046 l 119 1046 l 119 1189 l 247 1189 l 247 1046 m 19 1046 l -109 1046 l -109 1189 l 19 1189 l 19 1046 "},E:{x_min:0,x_max:736.109375,ha:789,o:"m 736 0 l 0 0 l 0 1013 l 725 1013 l 725 889 l 139 889 l 139 585 l 677 585 l 677 467 l 139 467 l 139 125 l 736 125 l 736 0 "},Y:{x_min:0,x_max:820,ha:886,o:"m 820 1013 l 482 416 l 482 0 l 342 0 l 342 416 l 0 1013 l 140 1013 l 411 534 l 679 1012 l 820 1013 "},'"':{x_min:0,x_max:299,ha:396,o:"m 299 606 l 203 606 l 203 988 l 299 988 l 299 606 m 96 606 l 0 606 l 0 988 l 96 988 l 96 606 "},"‹":{x_min:17.984375,x_max:773.609375,ha:792,o:"m 773 40 l 18 376 l 17 465 l 773 799 l 773 692 l 159 420 l 773 149 l 773 40 "},"„":{x_min:0,x_max:364,ha:467,o:"m 141 -12 q 104 -132 141 -82 q 0 -205 67 -182 l 0 -138 q 56 -82 40 -124 q 69 0 69 -51 l 0 0 l 0 151 l 141 151 l 141 -12 m 364 -12 q 327 -132 364 -82 q 222 -205 290 -182 l 222 -138 q 279 -82 262 -124 q 292 0 292 -51 l 222 0 l 222 151 l 364 151 l 364 -12 "},δ:{x_min:1,x_max:710,ha:810,o:"m 710 360 q 616 87 710 196 q 356 -28 518 -28 q 99 82 197 -28 q 1 356 1 192 q 100 606 1 509 q 355 703 199 703 q 180 829 288 754 q 70 903 124 866 l 70 1012 l 643 1012 l 643 901 l 258 901 q 462 763 422 794 q 636 592 577 677 q 710 360 710 485 m 584 365 q 552 501 584 447 q 451 602 521 555 q 372 611 411 611 q 197 541 258 611 q 136 355 136 472 q 190 171 136 245 q 358 85 252 85 q 528 173 465 85 q 584 365 584 252 "},έ:{x_min:0,x_max:634.71875,ha:714,o:"m 634 234 q 527 38 634 110 q 300 -25 433 -25 q 98 29 183 -25 q 0 204 0 93 q 37 313 0 265 q 128 390 67 352 q 56 459 82 419 q 26 555 26 505 q 114 712 26 654 q 295 763 191 763 q 499 700 416 763 q 589 515 589 631 l 478 515 q 419 618 464 580 q 307 657 374 657 q 207 630 253 657 q 151 547 151 598 q 238 445 151 469 q 389 434 280 434 l 389 331 l 349 331 q 206 315 255 331 q 125 210 125 287 q 183 107 125 145 q 302 76 233 76 q 436 117 379 76 q 509 234 493 159 l 634 234 m 520 1040 l 331 819 l 248 819 l 383 1040 l 520 1040 "},ω:{x_min:0,x_max:922,ha:1031,o:"m 922 339 q 856 97 922 203 q 650 -26 780 -26 q 538 9 587 -26 q 461 103 489 44 q 387 12 436 46 q 277 -22 339 -22 q 69 97 147 -22 q 0 339 0 203 q 45 551 0 444 q 161 738 84 643 l 302 738 q 175 553 219 647 q 124 336 124 446 q 155 179 124 249 q 275 88 197 88 q 375 163 341 88 q 400 294 400 219 l 400 572 l 524 572 l 524 294 q 561 135 524 192 q 643 88 591 88 q 762 182 719 88 q 797 342 797 257 q 745 556 797 450 q 619 738 705 638 l 760 738 q 874 551 835 640 q 922 339 922 444 "},"´":{x_min:0,x_max:96,ha:251,o:"m 96 606 l 0 606 l 0 988 l 96 988 l 96 606 "},"±":{x_min:11,x_max:781,ha:792,o:"m 781 490 l 446 490 l 446 255 l 349 255 l 349 490 l 11 490 l 11 586 l 349 586 l 349 819 l 446 819 l 446 586 l 781 586 l 781 490 m 781 21 l 11 21 l 11 115 l 781 115 l 781 21 "},"|":{x_min:343,x_max:449,ha:792,o:"m 449 462 l 343 462 l 343 986 l 449 986 l 449 462 m 449 -242 l 343 -242 l 343 280 l 449 280 l 449 -242 "},ϋ:{x_min:0,x_max:617,ha:725,o:"m 482 800 l 372 800 l 372 925 l 482 925 l 482 800 m 239 800 l 129 800 l 129 925 l 239 925 l 239 800 m 617 352 q 540 93 617 199 q 308 -24 455 -24 q 76 93 161 -24 q 0 352 0 199 l 0 738 l 126 738 l 126 354 q 169 185 126 257 q 312 98 220 98 q 451 185 402 98 q 492 354 492 257 l 492 738 l 617 738 l 617 352 "},"§":{x_min:0,x_max:593,ha:690,o:"m 593 425 q 554 312 593 369 q 467 233 516 254 q 537 83 537 172 q 459 -74 537 -12 q 288 -133 387 -133 q 115 -69 184 -133 q 47 96 47 -6 l 166 96 q 199 7 166 40 q 288 -26 232 -26 q 371 -5 332 -26 q 420 60 420 21 q 311 201 420 139 q 108 309 210 255 q 0 490 0 383 q 33 602 0 551 q 124 687 66 654 q 75 743 93 712 q 58 812 58 773 q 133 984 58 920 q 300 1043 201 1043 q 458 987 394 1043 q 529 814 529 925 l 411 814 q 370 908 404 877 q 289 939 336 939 q 213 911 246 939 q 180 841 180 883 q 286 720 180 779 q 484 612 480 615 q 593 425 593 534 m 467 409 q 355 544 467 473 q 196 630 228 612 q 146 587 162 609 q 124 525 124 558 q 239 387 124 462 q 398 298 369 315 q 448 345 429 316 q 467 409 467 375 "},b:{x_min:0,x_max:685,ha:783,o:"m 685 372 q 597 99 685 213 q 347 -25 501 -25 q 219 5 277 -25 q 121 93 161 36 l 121 0 l 0 0 l 0 1013 l 121 1013 l 121 634 q 214 723 157 692 q 341 754 272 754 q 591 637 493 754 q 685 372 685 526 m 554 356 q 499 550 554 470 q 328 644 437 644 q 162 556 223 644 q 108 369 108 478 q 160 176 108 256 q 330 83 221 83 q 498 169 435 83 q 554 356 554 245 "},q:{x_min:0,x_max:683,ha:876,o:"m 683 -278 l 564 -278 l 564 97 q 474 8 533 39 q 345 -23 415 -23 q 91 93 188 -23 q 0 364 0 203 q 87 635 0 522 q 337 760 184 760 q 466 727 408 760 q 564 637 523 695 l 564 737 l 683 737 l 683 -278 m 582 375 q 527 564 582 488 q 358 652 466 652 q 190 565 253 652 q 135 377 135 488 q 189 179 135 261 q 361 84 251 84 q 530 179 469 84 q 582 375 582 260 "},Ω:{x_min:-.171875,x_max:969.5625,ha:1068,o:"m 969 0 l 555 0 l 555 123 q 744 308 675 194 q 814 558 814 423 q 726 812 814 709 q 484 922 633 922 q 244 820 334 922 q 154 567 154 719 q 223 316 154 433 q 412 123 292 199 l 412 0 l 0 0 l 0 124 l 217 124 q 68 327 122 210 q 15 572 15 444 q 144 911 15 781 q 484 1041 274 1041 q 822 909 691 1041 q 953 569 953 777 q 899 326 953 443 q 750 124 846 210 l 969 124 l 969 0 "},ύ:{x_min:0,x_max:617,ha:725,o:"m 617 352 q 540 93 617 199 q 308 -24 455 -24 q 76 93 161 -24 q 0 352 0 199 l 0 738 l 126 738 l 126 354 q 169 185 126 257 q 312 98 220 98 q 451 185 402 98 q 492 354 492 257 l 492 738 l 617 738 l 617 352 m 535 1040 l 346 819 l 262 819 l 397 1040 l 535 1040 "},z:{x_min:-.015625,x_max:613.890625,ha:697,o:"m 613 0 l 0 0 l 0 100 l 433 630 l 20 630 l 20 738 l 594 738 l 593 636 l 163 110 l 613 110 l 613 0 "},"™":{x_min:0,x_max:894,ha:1e3,o:"m 389 951 l 229 951 l 229 503 l 160 503 l 160 951 l 0 951 l 0 1011 l 389 1011 l 389 951 m 894 503 l 827 503 l 827 939 l 685 503 l 620 503 l 481 937 l 481 503 l 417 503 l 417 1011 l 517 1011 l 653 580 l 796 1010 l 894 1011 l 894 503 "},ή:{x_min:.78125,x_max:697,ha:810,o:"m 697 -278 l 572 -278 l 572 454 q 540 587 572 536 q 425 650 501 650 q 271 579 337 650 q 206 420 206 509 l 206 0 l 81 0 l 81 489 q 73 588 81 562 q 0 644 56 644 l 0 741 q 68 755 38 755 q 158 721 124 755 q 200 630 193 687 q 297 726 234 692 q 434 761 359 761 q 620 692 544 761 q 697 516 697 624 l 697 -278 m 479 1040 l 290 819 l 207 819 l 341 1040 l 479 1040 "},Θ:{x_min:0,x_max:960,ha:1056,o:"m 960 507 q 833 129 960 280 q 476 -32 698 -32 q 123 129 255 -32 q 0 507 0 280 q 123 883 0 732 q 476 1045 255 1045 q 832 883 696 1045 q 960 507 960 732 m 817 500 q 733 789 817 669 q 476 924 639 924 q 223 792 317 924 q 142 507 142 675 q 222 222 142 339 q 476 89 315 89 q 730 218 636 89 q 817 500 817 334 m 716 449 l 243 449 l 243 571 l 716 571 l 716 449 "},"®":{x_min:-3,x_max:1008,ha:1106,o:"m 503 532 q 614 562 566 532 q 672 658 672 598 q 614 747 672 716 q 503 772 569 772 l 338 772 l 338 532 l 503 532 m 502 -7 q 123 151 263 -7 q -3 501 -3 294 q 123 851 -3 706 q 502 1011 263 1011 q 881 851 739 1011 q 1008 501 1008 708 q 883 151 1008 292 q 502 -7 744 -7 m 502 60 q 830 197 709 60 q 940 501 940 322 q 831 805 940 681 q 502 944 709 944 q 174 805 296 944 q 65 501 65 680 q 173 197 65 320 q 502 60 294 60 m 788 146 l 678 146 q 653 316 655 183 q 527 449 652 449 l 338 449 l 338 146 l 241 146 l 241 854 l 518 854 q 688 808 621 854 q 766 658 766 755 q 739 563 766 607 q 668 497 713 519 q 751 331 747 472 q 788 164 756 190 l 788 146 "},"~":{x_min:0,x_max:833,ha:931,o:"m 833 958 q 778 753 833 831 q 594 665 716 665 q 402 761 502 665 q 240 857 302 857 q 131 795 166 857 q 104 665 104 745 l 0 665 q 54 867 0 789 q 237 958 116 958 q 429 861 331 958 q 594 765 527 765 q 704 827 670 765 q 729 958 729 874 l 833 958 "},Ε:{x_min:0,x_max:736.21875,ha:778,o:"m 736 0 l 0 0 l 0 1013 l 725 1013 l 725 889 l 139 889 l 139 585 l 677 585 l 677 467 l 139 467 l 139 125 l 736 125 l 736 0 "},"³":{x_min:0,x_max:450,ha:547,o:"m 450 552 q 379 413 450 464 q 220 366 313 366 q 69 414 130 366 q 0 567 0 470 l 85 567 q 126 470 85 504 q 225 437 168 437 q 320 467 280 437 q 360 552 360 498 q 318 632 360 608 q 213 657 276 657 q 195 657 203 657 q 176 657 181 657 l 176 722 q 279 733 249 722 q 334 815 334 752 q 300 881 334 856 q 220 907 267 907 q 133 875 169 907 q 97 781 97 844 l 15 781 q 78 926 15 875 q 220 972 135 972 q 364 930 303 972 q 426 817 426 888 q 344 697 426 733 q 421 642 392 681 q 450 552 450 603 "},"[":{x_min:0,x_max:273.609375,ha:371,o:"m 273 -281 l 0 -281 l 0 1013 l 273 1013 l 273 920 l 124 920 l 124 -187 l 273 -187 l 273 -281 "},L:{x_min:0,x_max:645.828125,ha:696,o:"m 645 0 l 0 0 l 0 1013 l 140 1013 l 140 126 l 645 126 l 645 0 "},σ:{x_min:0,x_max:803.390625,ha:894,o:"m 803 628 l 633 628 q 713 368 713 512 q 618 93 713 204 q 357 -25 518 -25 q 94 91 194 -25 q 0 368 0 201 q 94 644 0 533 q 356 761 194 761 q 481 750 398 761 q 608 739 564 739 l 803 739 l 803 628 m 360 85 q 529 180 467 85 q 584 374 584 262 q 527 566 584 490 q 352 651 463 651 q 187 559 247 651 q 135 368 135 478 q 189 175 135 254 q 360 85 251 85 "},ζ:{x_min:0,x_max:573,ha:642,o:"m 573 -40 q 553 -162 573 -97 q 510 -278 543 -193 l 400 -278 q 441 -187 428 -219 q 462 -90 462 -132 q 378 -14 462 -14 q 108 45 197 -14 q 0 290 0 117 q 108 631 0 462 q 353 901 194 767 l 55 901 l 55 1012 l 561 1012 l 561 924 q 261 669 382 831 q 128 301 128 489 q 243 117 128 149 q 458 98 350 108 q 573 -40 573 80 "},θ:{x_min:0,x_max:674,ha:778,o:"m 674 496 q 601 160 674 304 q 336 -26 508 -26 q 73 153 165 -26 q 0 485 0 296 q 72 840 0 683 q 343 1045 166 1045 q 605 844 516 1045 q 674 496 674 692 m 546 579 q 498 798 546 691 q 336 935 437 935 q 178 798 237 935 q 126 579 137 701 l 546 579 m 546 475 l 126 475 q 170 233 126 348 q 338 80 230 80 q 504 233 447 80 q 546 475 546 346 "},Ο:{x_min:0,x_max:958,ha:1054,o:"m 485 1042 q 834 883 703 1042 q 958 511 958 735 q 834 136 958 287 q 481 -26 701 -26 q 126 130 261 -26 q 0 504 0 279 q 127 880 0 729 q 485 1042 263 1042 m 480 98 q 731 225 638 98 q 815 504 815 340 q 733 783 815 670 q 480 913 640 913 q 226 785 321 913 q 142 504 142 671 q 226 224 142 339 q 480 98 319 98 "},Γ:{x_min:0,x_max:705.28125,ha:749,o:"m 705 886 l 140 886 l 140 0 l 0 0 l 0 1012 l 705 1012 l 705 886 "}," ":{x_min:0,x_max:0,ha:375},"%":{x_min:-3,x_max:1089,ha:1186,o:"m 845 0 q 663 76 731 0 q 602 244 602 145 q 661 412 602 344 q 845 489 728 489 q 1027 412 959 489 q 1089 244 1089 343 q 1029 76 1089 144 q 845 0 962 0 m 844 103 q 945 143 909 103 q 981 243 981 184 q 947 340 981 301 q 844 385 909 385 q 744 342 781 385 q 708 243 708 300 q 741 147 708 186 q 844 103 780 103 m 888 986 l 284 -25 l 199 -25 l 803 986 l 888 986 m 241 468 q 58 545 126 468 q -3 715 -3 615 q 56 881 -3 813 q 238 958 124 958 q 421 881 353 958 q 483 712 483 813 q 423 544 483 612 q 241 468 356 468 m 241 855 q 137 811 175 855 q 100 710 100 768 q 136 612 100 653 q 240 572 172 572 q 344 614 306 572 q 382 713 382 656 q 347 810 382 771 q 241 855 308 855 "},P:{x_min:0,x_max:726,ha:806,o:"m 424 1013 q 640 931 555 1013 q 726 719 726 850 q 637 506 726 587 q 413 426 548 426 l 140 426 l 140 0 l 0 0 l 0 1013 l 424 1013 m 379 889 l 140 889 l 140 548 l 372 548 q 522 589 459 548 q 593 720 593 637 q 528 845 593 801 q 379 889 463 889 "},Έ:{x_min:0,x_max:1078.21875,ha:1118,o:"m 1078 0 l 342 0 l 342 1013 l 1067 1013 l 1067 889 l 481 889 l 481 585 l 1019 585 l 1019 467 l 481 467 l 481 125 l 1078 125 l 1078 0 m 277 1040 l 83 799 l 0 799 l 140 1040 l 277 1040 "},Ώ:{x_min:.125,x_max:1136.546875,ha:1235,o:"m 1136 0 l 722 0 l 722 123 q 911 309 842 194 q 981 558 981 423 q 893 813 981 710 q 651 923 800 923 q 411 821 501 923 q 321 568 321 720 q 390 316 321 433 q 579 123 459 200 l 579 0 l 166 0 l 166 124 l 384 124 q 235 327 289 210 q 182 572 182 444 q 311 912 182 782 q 651 1042 441 1042 q 989 910 858 1042 q 1120 569 1120 778 q 1066 326 1120 443 q 917 124 1013 210 l 1136 124 l 1136 0 m 277 1040 l 83 800 l 0 800 l 140 1041 l 277 1040 "},_:{x_min:0,x_max:705.5625,ha:803,o:"m 705 -334 l 0 -334 l 0 -234 l 705 -234 l 705 -334 "},Ϊ:{x_min:-110,x_max:246,ha:275,o:"m 246 1046 l 118 1046 l 118 1189 l 246 1189 l 246 1046 m 18 1046 l -110 1046 l -110 1189 l 18 1189 l 18 1046 m 136 0 l 0 0 l 0 1012 l 136 1012 l 136 0 "},"+":{x_min:23,x_max:768,ha:792,o:"m 768 372 l 444 372 l 444 0 l 347 0 l 347 372 l 23 372 l 23 468 l 347 468 l 347 840 l 444 840 l 444 468 l 768 468 l 768 372 "},"½":{x_min:0,x_max:1050,ha:1149,o:"m 1050 0 l 625 0 q 712 178 625 108 q 878 277 722 187 q 967 385 967 328 q 932 456 967 429 q 850 484 897 484 q 759 450 798 484 q 721 352 721 416 l 640 352 q 706 502 640 448 q 851 551 766 551 q 987 509 931 551 q 1050 385 1050 462 q 976 251 1050 301 q 829 179 902 215 q 717 68 740 133 l 1050 68 l 1050 0 m 834 985 l 215 -28 l 130 -28 l 750 984 l 834 985 m 224 422 l 142 422 l 142 811 l 0 811 l 0 867 q 104 889 62 867 q 164 973 157 916 l 224 973 l 224 422 "},Ρ:{x_min:0,x_max:720,ha:783,o:"m 424 1013 q 637 933 554 1013 q 720 723 720 853 q 633 508 720 591 q 413 426 546 426 l 140 426 l 140 0 l 0 0 l 0 1013 l 424 1013 m 378 889 l 140 889 l 140 548 l 371 548 q 521 589 458 548 q 592 720 592 637 q 527 845 592 801 q 378 889 463 889 "},"'":{x_min:0,x_max:139,ha:236,o:"m 139 851 q 102 737 139 784 q 0 669 65 690 l 0 734 q 59 787 42 741 q 72 873 72 821 l 0 873 l 0 1013 l 139 1013 l 139 851 "},ª:{x_min:0,x_max:350,ha:397,o:"m 350 625 q 307 616 328 616 q 266 631 281 616 q 247 673 251 645 q 190 628 225 644 q 116 613 156 613 q 32 641 64 613 q 0 722 0 669 q 72 826 0 800 q 247 866 159 846 l 247 887 q 220 934 247 916 q 162 953 194 953 q 104 934 129 953 q 76 882 80 915 l 16 882 q 60 976 16 941 q 166 1011 104 1011 q 266 979 224 1011 q 308 891 308 948 l 308 706 q 311 679 308 688 q 331 670 315 670 l 350 672 l 350 625 m 247 757 l 247 811 q 136 790 175 798 q 64 726 64 773 q 83 682 64 697 q 132 667 103 667 q 207 690 174 667 q 247 757 247 718 "},"΅":{x_min:0,x_max:450,ha:553,o:"m 450 800 l 340 800 l 340 925 l 450 925 l 450 800 m 406 1040 l 212 800 l 129 800 l 269 1040 l 406 1040 m 110 800 l 0 800 l 0 925 l 110 925 l 110 800 "},T:{x_min:0,x_max:777,ha:835,o:"m 777 894 l 458 894 l 458 0 l 319 0 l 319 894 l 0 894 l 0 1013 l 777 1013 l 777 894 "},Φ:{x_min:0,x_max:915,ha:997,o:"m 527 0 l 389 0 l 389 122 q 110 231 220 122 q 0 509 0 340 q 110 785 0 677 q 389 893 220 893 l 389 1013 l 527 1013 l 527 893 q 804 786 693 893 q 915 509 915 679 q 805 231 915 341 q 527 122 696 122 l 527 0 m 527 226 q 712 310 641 226 q 779 507 779 389 q 712 705 779 627 q 527 787 641 787 l 527 226 m 389 226 l 389 787 q 205 698 275 775 q 136 505 136 620 q 206 308 136 391 q 389 226 276 226 "},"⁋":{x_min:0,x_max:0,ha:694},j:{x_min:-77.78125,x_max:167,ha:349,o:"m 167 871 l 42 871 l 42 1013 l 167 1013 l 167 871 m 167 -80 q 121 -231 167 -184 q -26 -278 76 -278 l -77 -278 l -77 -164 l -41 -164 q 26 -143 11 -164 q 42 -65 42 -122 l 42 737 l 167 737 l 167 -80 "},Σ:{x_min:0,x_max:756.953125,ha:819,o:"m 756 0 l 0 0 l 0 107 l 395 523 l 22 904 l 22 1013 l 745 1013 l 745 889 l 209 889 l 566 523 l 187 125 l 756 125 l 756 0 "},"›":{x_min:18.0625,x_max:774,ha:792,o:"m 774 376 l 18 40 l 18 149 l 631 421 l 18 692 l 18 799 l 774 465 l 774 376 "},"<":{x_min:17.984375,x_max:773.609375,ha:792,o:"m 773 40 l 18 376 l 17 465 l 773 799 l 773 692 l 159 420 l 773 149 l 773 40 "},"£":{x_min:0,x_max:704.484375,ha:801,o:"m 704 41 q 623 -10 664 5 q 543 -26 583 -26 q 359 15 501 -26 q 243 36 288 36 q 158 23 197 36 q 73 -21 119 10 l 6 76 q 125 195 90 150 q 175 331 175 262 q 147 443 175 383 l 0 443 l 0 512 l 108 512 q 43 734 43 623 q 120 929 43 854 q 358 1010 204 1010 q 579 936 487 1010 q 678 729 678 857 l 678 684 l 552 684 q 504 838 552 780 q 362 896 457 896 q 216 852 263 896 q 176 747 176 815 q 199 627 176 697 q 248 512 217 574 l 468 512 l 468 443 l 279 443 q 297 356 297 398 q 230 194 297 279 q 153 107 211 170 q 227 133 190 125 q 293 142 264 142 q 410 119 339 142 q 516 96 482 96 q 579 105 550 96 q 648 142 608 115 l 704 41 "},t:{x_min:0,x_max:367,ha:458,o:"m 367 0 q 312 -5 339 -2 q 262 -8 284 -8 q 145 28 183 -8 q 108 143 108 64 l 108 638 l 0 638 l 0 738 l 108 738 l 108 944 l 232 944 l 232 738 l 367 738 l 367 638 l 232 638 l 232 185 q 248 121 232 140 q 307 102 264 102 q 345 104 330 102 q 367 107 360 107 l 367 0 "},"¬":{x_min:0,x_max:706,ha:803,o:"m 706 411 l 706 158 l 630 158 l 630 335 l 0 335 l 0 411 l 706 411 "},λ:{x_min:0,x_max:750,ha:803,o:"m 750 -7 q 679 -15 716 -15 q 538 59 591 -15 q 466 214 512 97 l 336 551 l 126 0 l 0 0 l 270 705 q 223 837 247 770 q 116 899 190 899 q 90 898 100 899 l 90 1004 q 152 1011 125 1011 q 298 938 244 1011 q 373 783 326 901 l 605 192 q 649 115 629 136 q 716 95 669 95 l 736 95 q 750 97 745 97 l 750 -7 "},W:{x_min:0,x_max:1263.890625,ha:1351,o:"m 1263 1013 l 995 0 l 859 0 l 627 837 l 405 0 l 265 0 l 0 1013 l 136 1013 l 342 202 l 556 1013 l 701 1013 l 921 207 l 1133 1012 l 1263 1013 "},">":{x_min:18.0625,x_max:774,ha:792,o:"m 774 376 l 18 40 l 18 149 l 631 421 l 18 692 l 18 799 l 774 465 l 774 376 "},v:{x_min:0,x_max:675.15625,ha:761,o:"m 675 738 l 404 0 l 272 0 l 0 738 l 133 737 l 340 147 l 541 737 l 675 738 "},τ:{x_min:.28125,x_max:644.5,ha:703,o:"m 644 628 l 382 628 l 382 179 q 388 120 382 137 q 436 91 401 91 q 474 94 447 91 q 504 97 501 97 l 504 0 q 454 -9 482 -5 q 401 -14 426 -14 q 278 67 308 -14 q 260 233 260 118 l 260 628 l 0 628 l 0 739 l 644 739 l 644 628 "},ξ:{x_min:0,x_max:624.9375,ha:699,o:"m 624 -37 q 608 -153 624 -96 q 563 -278 593 -211 l 454 -278 q 491 -183 486 -200 q 511 -83 511 -126 q 484 -23 511 -44 q 370 1 452 1 q 323 0 354 1 q 283 -1 293 -1 q 84 76 169 -1 q 0 266 0 154 q 56 431 0 358 q 197 538 108 498 q 94 613 134 562 q 54 730 54 665 q 77 823 54 780 q 143 901 101 867 l 27 901 l 27 1012 l 576 1012 l 576 901 l 380 901 q 244 863 303 901 q 178 745 178 820 q 312 600 178 636 q 532 582 380 582 l 532 479 q 276 455 361 479 q 118 281 118 410 q 165 173 118 217 q 274 120 208 133 q 494 101 384 110 q 624 -37 624 76 "},"&":{x_min:-3,x_max:894.25,ha:992,o:"m 894 0 l 725 0 l 624 123 q 471 0 553 40 q 306 -41 390 -41 q 168 -7 231 -41 q 62 92 105 26 q 14 187 31 139 q -3 276 -3 235 q 55 433 -3 358 q 248 581 114 508 q 170 689 196 640 q 137 817 137 751 q 214 985 137 922 q 384 1041 284 1041 q 548 988 483 1041 q 622 824 622 928 q 563 666 622 739 q 431 556 516 608 l 621 326 q 649 407 639 361 q 663 493 653 426 l 781 493 q 703 229 781 352 l 894 0 m 504 818 q 468 908 504 877 q 384 940 433 940 q 293 907 331 940 q 255 818 255 875 q 289 714 255 767 q 363 628 313 678 q 477 729 446 682 q 504 818 504 771 m 556 209 l 314 499 q 179 395 223 449 q 135 283 135 341 q 146 222 135 253 q 183 158 158 192 q 333 80 241 80 q 556 209 448 80 "},Λ:{x_min:0,x_max:862.5,ha:942,o:"m 862 0 l 719 0 l 426 847 l 143 0 l 0 0 l 356 1013 l 501 1013 l 862 0 "},I:{x_min:41,x_max:180,ha:293,o:"m 180 0 l 41 0 l 41 1013 l 180 1013 l 180 0 "},G:{x_min:0,x_max:921,ha:1011,o:"m 921 0 l 832 0 l 801 136 q 655 15 741 58 q 470 -28 568 -28 q 126 133 259 -28 q 0 499 0 284 q 125 881 0 731 q 486 1043 259 1043 q 763 957 647 1043 q 905 709 890 864 l 772 709 q 668 866 747 807 q 486 926 589 926 q 228 795 322 926 q 142 507 142 677 q 228 224 142 342 q 483 94 323 94 q 712 195 625 94 q 796 435 796 291 l 477 435 l 477 549 l 921 549 l 921 0 "},ΰ:{x_min:0,x_max:617,ha:725,o:"m 524 800 l 414 800 l 414 925 l 524 925 l 524 800 m 183 800 l 73 800 l 73 925 l 183 925 l 183 800 m 617 352 q 540 93 617 199 q 308 -24 455 -24 q 76 93 161 -24 q 0 352 0 199 l 0 738 l 126 738 l 126 354 q 169 185 126 257 q 312 98 220 98 q 451 185 402 98 q 492 354 492 257 l 492 738 l 617 738 l 617 352 m 489 1040 l 300 819 l 216 819 l 351 1040 l 489 1040 "},"`":{x_min:0,x_max:138.890625,ha:236,o:"m 138 699 l 0 699 l 0 861 q 36 974 0 929 q 138 1041 72 1020 l 138 977 q 82 931 95 969 q 69 839 69 893 l 138 839 l 138 699 "},"·":{x_min:0,x_max:142,ha:239,o:"m 142 585 l 0 585 l 0 738 l 142 738 l 142 585 "},Υ:{x_min:.328125,x_max:819.515625,ha:889,o:"m 819 1013 l 482 416 l 482 0 l 342 0 l 342 416 l 0 1013 l 140 1013 l 411 533 l 679 1013 l 819 1013 "},r:{x_min:0,x_max:355.5625,ha:432,o:"m 355 621 l 343 621 q 179 569 236 621 q 122 411 122 518 l 122 0 l 0 0 l 0 737 l 117 737 l 117 604 q 204 719 146 686 q 355 753 262 753 l 355 621 "},x:{x_min:0,x_max:675,ha:764,o:"m 675 0 l 525 0 l 331 286 l 144 0 l 0 0 l 256 379 l 12 738 l 157 737 l 336 473 l 516 738 l 661 738 l 412 380 l 675 0 "},μ:{x_min:0,x_max:696.609375,ha:747,o:"m 696 -4 q 628 -14 657 -14 q 498 97 513 -14 q 422 8 470 41 q 313 -24 374 -24 q 207 3 258 -24 q 120 80 157 31 l 120 -278 l 0 -278 l 0 738 l 124 738 l 124 343 q 165 172 124 246 q 308 82 216 82 q 451 177 402 82 q 492 358 492 254 l 492 738 l 616 738 l 616 214 q 623 136 616 160 q 673 92 636 92 q 696 95 684 92 l 696 -4 "},h:{x_min:0,x_max:615,ha:724,o:"m 615 472 l 615 0 l 490 0 l 490 454 q 456 590 490 535 q 338 654 416 654 q 186 588 251 654 q 122 436 122 522 l 122 0 l 0 0 l 0 1013 l 122 1013 l 122 633 q 218 727 149 694 q 362 760 287 760 q 552 676 484 760 q 615 472 615 600 "},".":{x_min:0,x_max:142,ha:239,o:"m 142 0 l 0 0 l 0 151 l 142 151 l 142 0 "},φ:{x_min:-2,x_max:878,ha:974,o:"m 496 -279 l 378 -279 l 378 -17 q 101 88 204 -17 q -2 367 -2 194 q 68 626 -2 510 q 283 758 151 758 l 283 646 q 167 537 209 626 q 133 373 133 462 q 192 177 133 254 q 378 93 259 93 l 378 758 q 445 764 426 763 q 476 765 464 765 q 765 659 653 765 q 878 377 878 553 q 771 96 878 209 q 496 -17 665 -17 l 496 -279 m 496 93 l 514 93 q 687 183 623 93 q 746 380 746 265 q 691 569 746 491 q 522 658 629 658 l 496 656 l 496 93 "},";":{x_min:0,x_max:142,ha:239,o:"m 142 585 l 0 585 l 0 738 l 142 738 l 142 585 m 142 -12 q 105 -132 142 -82 q 0 -206 68 -182 l 0 -138 q 58 -82 43 -123 q 68 0 68 -56 l 0 0 l 0 151 l 142 151 l 142 -12 "},f:{x_min:0,x_max:378,ha:472,o:"m 378 638 l 246 638 l 246 0 l 121 0 l 121 638 l 0 638 l 0 738 l 121 738 q 137 935 121 887 q 290 1028 171 1028 q 320 1027 305 1028 q 378 1021 334 1026 l 378 908 q 323 918 346 918 q 257 870 273 918 q 246 780 246 840 l 246 738 l 378 738 l 378 638 "},"“":{x_min:1,x_max:348.21875,ha:454,o:"m 140 670 l 1 670 l 1 830 q 37 943 1 897 q 140 1011 74 990 l 140 947 q 82 900 97 940 q 68 810 68 861 l 140 810 l 140 670 m 348 670 l 209 670 l 209 830 q 245 943 209 897 q 348 1011 282 990 l 348 947 q 290 900 305 940 q 276 810 276 861 l 348 810 l 348 670 "},A:{x_min:.03125,x_max:906.953125,ha:1008,o:"m 906 0 l 756 0 l 648 303 l 251 303 l 142 0 l 0 0 l 376 1013 l 529 1013 l 906 0 m 610 421 l 452 867 l 293 421 l 610 421 "},"‘":{x_min:1,x_max:139.890625,ha:236,o:"m 139 670 l 1 670 l 1 830 q 37 943 1 897 q 139 1011 74 990 l 139 947 q 82 900 97 940 q 68 810 68 861 l 139 810 l 139 670 "},ϊ:{x_min:-70,x_max:283,ha:361,o:"m 283 800 l 173 800 l 173 925 l 283 925 l 283 800 m 40 800 l -70 800 l -70 925 l 40 925 l 40 800 m 283 3 q 232 -10 257 -5 q 181 -15 206 -15 q 84 26 118 -15 q 41 200 41 79 l 41 737 l 166 737 l 167 215 q 171 141 167 157 q 225 101 182 101 q 247 103 238 101 q 283 112 256 104 l 283 3 "},π:{x_min:-.21875,x_max:773.21875,ha:857,o:"m 773 -7 l 707 -11 q 575 40 607 -11 q 552 174 552 77 l 552 226 l 552 626 l 222 626 l 222 0 l 97 0 l 97 626 l 0 626 l 0 737 l 773 737 l 773 626 l 676 626 l 676 171 q 695 103 676 117 q 773 90 714 90 l 773 -7 "},ά:{x_min:0,x_max:765.5625,ha:809,o:"m 765 -4 q 698 -14 726 -14 q 564 97 586 -14 q 466 7 525 40 q 337 -26 407 -26 q 88 98 186 -26 q 0 369 0 212 q 88 637 0 525 q 337 760 184 760 q 465 727 407 760 q 563 637 524 695 l 563 738 l 685 738 l 685 222 q 693 141 685 168 q 748 94 708 94 q 765 95 760 94 l 765 -4 m 584 371 q 531 562 584 485 q 360 653 470 653 q 192 566 254 653 q 135 379 135 489 q 186 181 135 261 q 358 84 247 84 q 528 176 465 84 q 584 371 584 260 m 604 1040 l 415 819 l 332 819 l 466 1040 l 604 1040 "},O:{x_min:0,x_max:958,ha:1057,o:"m 485 1041 q 834 882 702 1041 q 958 512 958 734 q 834 136 958 287 q 481 -26 702 -26 q 126 130 261 -26 q 0 504 0 279 q 127 880 0 728 q 485 1041 263 1041 m 480 98 q 731 225 638 98 q 815 504 815 340 q 733 783 815 669 q 480 912 640 912 q 226 784 321 912 q 142 504 142 670 q 226 224 142 339 q 480 98 319 98 "},n:{x_min:0,x_max:615,ha:724,o:"m 615 463 l 615 0 l 490 0 l 490 454 q 453 592 490 537 q 331 656 410 656 q 178 585 240 656 q 117 421 117 514 l 117 0 l 0 0 l 0 738 l 117 738 l 117 630 q 218 728 150 693 q 359 764 286 764 q 552 675 484 764 q 615 463 615 593 "},l:{x_min:41,x_max:166,ha:279,o:"m 166 0 l 41 0 l 41 1013 l 166 1013 l 166 0 "},"¤":{x_min:40.09375,x_max:728.796875,ha:825,o:"m 728 304 l 649 224 l 512 363 q 383 331 458 331 q 256 363 310 331 l 119 224 l 40 304 l 177 441 q 150 553 150 493 q 184 673 150 621 l 40 818 l 119 898 l 267 749 q 321 766 291 759 q 384 773 351 773 q 447 766 417 773 q 501 749 477 759 l 649 898 l 728 818 l 585 675 q 612 618 604 648 q 621 553 621 587 q 591 441 621 491 l 728 304 m 384 682 q 280 643 318 682 q 243 551 243 604 q 279 461 243 499 q 383 423 316 423 q 487 461 449 423 q 525 553 525 500 q 490 641 525 605 q 384 682 451 682 "},κ:{x_min:0,x_max:632.328125,ha:679,o:"m 632 0 l 482 0 l 225 384 l 124 288 l 124 0 l 0 0 l 0 738 l 124 738 l 124 446 l 433 738 l 596 738 l 312 466 l 632 0 "},p:{x_min:0,x_max:685,ha:786,o:"m 685 364 q 598 96 685 205 q 350 -23 504 -23 q 121 89 205 -23 l 121 -278 l 0 -278 l 0 738 l 121 738 l 121 633 q 220 726 159 691 q 351 761 280 761 q 598 636 504 761 q 685 364 685 522 m 557 371 q 501 560 557 481 q 330 651 437 651 q 162 559 223 651 q 108 366 108 479 q 162 177 108 254 q 333 87 224 87 q 502 178 441 87 q 557 371 557 258 "},"‡":{x_min:0,x_max:777,ha:835,o:"m 458 238 l 458 0 l 319 0 l 319 238 l 0 238 l 0 360 l 319 360 l 319 681 l 0 683 l 0 804 l 319 804 l 319 1015 l 458 1013 l 458 804 l 777 804 l 777 683 l 458 683 l 458 360 l 777 360 l 777 238 l 458 238 "},ψ:{x_min:0,x_max:808,ha:907,o:"m 465 -278 l 341 -278 l 341 -15 q 87 102 180 -15 q 0 378 0 210 l 0 739 l 133 739 l 133 379 q 182 195 133 275 q 341 98 242 98 l 341 922 l 465 922 l 465 98 q 623 195 563 98 q 675 382 675 278 l 675 742 l 808 742 l 808 381 q 720 104 808 213 q 466 -13 627 -13 l 465 -278 "},η:{x_min:.78125,x_max:697,ha:810,o:"m 697 -278 l 572 -278 l 572 454 q 540 587 572 536 q 425 650 501 650 q 271 579 337 650 q 206 420 206 509 l 206 0 l 81 0 l 81 489 q 73 588 81 562 q 0 644 56 644 l 0 741 q 68 755 38 755 q 158 720 124 755 q 200 630 193 686 q 297 726 234 692 q 434 761 359 761 q 620 692 544 761 q 697 516 697 624 l 697 -278 "}},due="normal",pue=1189,mue=-100,gue="normal",vue={yMin:-334,xMin:-111,yMax:1189,xMax:1672},_ue=1e3,yue={postscript_name:"Helvetiker-Regular",version_string:"Version 1.00 2004 initial release",vendor_url:"http://www.magenta.gr/",full_font_name:"Helvetiker",font_family_name:"Helvetiker",copyright:"Copyright (c) Μagenta ltd, 2004",description:"",trademark:"",designer:"",designer_url:"",unique_font_identifier:"Μagenta ltd:Helvetiker:22-10-104",license_url:"http://www.ellak.gr/fonts/MgOpen/license.html",license_description:`Copyright (c) 2004 by MAGENTA Ltd. All Rights Reserved.\r \r Permission is hereby granted, free of charge, to any person obtaining a copy of the fonts accompanying this license ("Fonts") and associated documentation files (the "Font Software"), to reproduce and distribute the Font Software, including without limitation the rights to use, copy, merge, publish, distribute, and/or sell copies of the Font Software, and to permit persons to whom the Font Software is furnished to do so, subject to the following conditions: \r \r @@ -4772,7 +4772,7 @@ This License becomes null and void to the extent applicable to Fonts or Font Sof \r The Font Software may be sold as part of a larger software package but no copy of one or more of the Font Software typefaces may be sold by itself. \r \r -THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL MAGENTA OR PERSONS OR BODIES IN CHARGE OF ADMINISTRATION AND MAINTENANCE OF THE FONT SOFTWARE BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER DEALINGS IN THE FONT SOFTWARE.`,manufacturer_name:"Μagenta ltd",font_sub_family_name:"Regular"},xue=-334,bue="Helvetiker",Sue=1522,Tue=50,wue={glyphs:Aue,cssFontWeight:due,ascender:pue,underlinePosition:mue,cssFontStyle:gue,boundingBox:vue,resolution:_ue,original_font_information:yue,descender:xue,familyName:bue,lineHeight:Sue,underlineThickness:Tue},xl=Hi(Hi({},window.THREE?window.THREE:{BoxGeometry:$h,CircleGeometry:by,DoubleSide:as,Group:ja,Mesh:zi,MeshLambertMaterial:Vc,TextGeometry:kN,Vector3:ce}),{},{Font:Sle,TextGeometry:kN}),MO=xs({props:{labelsData:{default:[]},labelLat:{default:"lat"},labelLng:{default:"lng"},labelAltitude:{default:.002},labelText:{default:"text"},labelSize:{default:.5},labelTypeFace:{default:wue,onChange:function(e,t){t.font=new xl.Font(e)}},labelColor:{default:function(){return"lightgrey"}},labelRotation:{default:0},labelResolution:{default:3},labelIncludeDot:{default:!0},labelDotRadius:{default:.1},labelDotOrientation:{default:function(){return"bottom"}},labelsTransitionDuration:{default:1e3,triggerUpdate:!1}},init:function(e,t,n){var r=n.tweenGroup;nr(e),t.scene=e,t.tweenGroup=r;var s=new xl.CircleGeometry(1,32);t.dataMapper=new ao(e,{objBindAttr:"__threeObjLabel"}).onCreateObj(function(){var a=new xl.MeshLambertMaterial;a.side=as;var l=new xl.Group;l.add(new xl.Mesh(s,a));var u=new xl.Mesh(void 0,a);l.add(u);var h=new xl.Mesh;return h.visible=!1,u.add(h),l.__globeObjType="label",l})},update:function(e){var t=Ct(e.labelLat),n=Ct(e.labelLng),r=Ct(e.labelAltitude),s=Ct(e.labelText),a=Ct(e.labelSize),l=Ct(e.labelRotation),u=Ct(e.labelColor),h=Ct(e.labelIncludeDot),g=Ct(e.labelDotRadius),v=Ct(e.labelDotOrientation),x=new Set(["right","top","bottom"]),S=2*Math.PI*cr/360;e.dataMapper.onUpdateObj(function(w,R){var C=gr(w.children,2),E=C[0],B=C[1],L=gr(B.children,1),O=L[0],z=u(R),G=Rl(z);B.material.color.set(wu(z)),B.material.transparent=G<1,B.material.opacity=G;var k=h(R),H=v(R);!k||!x.has(H)&&(H="bottom");var F=k?+g(R)*S:1e-12;E.scale.x=E.scale.y=F;var V=+a(R)*S;if(B.geometry&&B.geometry.dispose(),B.geometry=new xl.TextGeometry(s(R),{font:e.font,size:V,depth:0,bevelEnabled:!0,bevelThickness:0,bevelSize:0,curveSegments:e.labelResolution}),O.geometry&&O.geometry.dispose(),B.geometry.computeBoundingBox(),O.geometry=qE(xl.BoxGeometry,Qi(new xl.Vector3().subVectors(B.geometry.boundingBox.max,B.geometry.boundingBox.min).clampScalar(0,1/0).toArray())),H!=="right"&&B.geometry.center(),k){var X=F+V/2;H==="right"&&(B.position.x=X),B.position.y={right:-V/2,top:X+V/2,bottom:-X-V/2}[H]}var J=function(Z){var ue=w.__currentTargetD=Z,he=ue.lat,be=ue.lng,Se=ue.alt,le=ue.rot,we=ue.scale;Object.assign(w.position,el(he,be,Se)),w.lookAt(e.scene.localToWorld(new xl.Vector3(0,0,0))),w.rotateY(Math.PI),w.rotateZ(-le*Math.PI/180),w.scale.x=w.scale.y=w.scale.z=we},te={lat:+t(R),lng:+n(R),alt:+r(R),rot:+l(R),scale:1},se=w.__currentTargetD||Object.assign({},te,{scale:1e-12});Object.keys(te).some(function(ne){return se[ne]!==te[ne]})&&(!e.labelsTransitionDuration||e.labelsTransitionDuration<0?J(te):e.tweenGroup.add(new ca(se).to(te,e.labelsTransitionDuration).easing(os.Quadratic.InOut).onUpdate(J).start()))}).digest(e.labelsData)}}),Mue=Hi(Hi({},window.THREE?window.THREE:{}),{},{CSS2DObject:Uj}),EO=xs({props:{htmlElementsData:{default:[]},htmlLat:{default:"lat"},htmlLng:{default:"lng"},htmlAltitude:{default:0},htmlElement:{},htmlElementVisibilityModifier:{triggerUpdate:!1},htmlTransitionDuration:{default:1e3,triggerUpdate:!1},isBehindGlobe:{onChange:function(){this.updateObjVisibility()},triggerUpdate:!1}},methods:{updateObjVisibility:function(e,t){if(e.dataMapper){var n=t?[t]:e.dataMapper.entries().map(function(r){var s=gr(r,2),a=s[1];return a}).filter(function(r){return r});n.forEach(function(r){var s=!e.isBehindGlobe||!e.isBehindGlobe(r.position);e.htmlElementVisibilityModifier?(r.visible=!0,e.htmlElementVisibilityModifier(r.element,s)):r.visible=s})}}},init:function(e,t,n){var r=n.tweenGroup;nr(e),t.scene=e,t.tweenGroup=r,t.dataMapper=new ao(e,{objBindAttr:"__threeObjHtml"}).onCreateObj(function(s){var a=Ct(t.htmlElement)(s),l=new Mue.CSS2DObject(a);return l.__globeObjType="html",l})},update:function(e,t){var n=this,r=Ct(e.htmlLat),s=Ct(e.htmlLng),a=Ct(e.htmlAltitude);t.hasOwnProperty("htmlElement")&&e.dataMapper.clear(),e.dataMapper.onUpdateObj(function(l,u){var h=function(x){var S=l.__currentTargetD=x,w=S.alt,R=S.lat,C=S.lng;Object.assign(l.position,el(R,C,w)),n.updateObjVisibility(l)},g={lat:+r(u),lng:+s(u),alt:+a(u)};!e.htmlTransitionDuration||e.htmlTransitionDuration<0||!l.__currentTargetD?h(g):e.tweenGroup.add(new ca(l.__currentTargetD).to(g,e.htmlTransitionDuration).easing(os.Quadratic.InOut).onUpdate(h).start())}).digest(e.htmlElementsData)}}),Pv=window.THREE?window.THREE:{Group:ja,Mesh:zi,MeshLambertMaterial:Vc,SphereGeometry:Eu},CO=xs({props:{objectsData:{default:[]},objectLat:{default:"lat"},objectLng:{default:"lng"},objectAltitude:{default:.01},objectFacesSurface:{default:!0},objectRotation:{},objectThreeObject:{default:new Pv.Mesh(new Pv.SphereGeometry(1,16,8),new Pv.MeshLambertMaterial({color:"#ffffaa",transparent:!0,opacity:.7}))}},init:function(e,t){nr(e),t.scene=e,t.dataMapper=new ao(e,{objBindAttr:"__threeObjObject"}).onCreateObj(function(n){var r=Ct(t.objectThreeObject)(n);t.objectThreeObject===r&&(r=r.clone());var s=new Pv.Group;return s.add(r),s.__globeObjType="object",s})},update:function(e,t){var n=Ct(e.objectLat),r=Ct(e.objectLng),s=Ct(e.objectAltitude),a=Ct(e.objectFacesSurface),l=Ct(e.objectRotation);t.hasOwnProperty("objectThreeObject")&&e.dataMapper.clear(),e.dataMapper.onUpdateObj(function(u,h){var g=+n(h),v=+r(h),x=+s(h);Object.assign(u.position,el(g,v,x)),a(h)?u.setRotationFromEuler(new la(Vf(-g),Vf(v),0,"YXZ")):u.rotation.set(0,0,0);var S=u.children[0],w=l(h);w&&S.setRotationFromEuler(new la(Vf(w.x||0),Vf(w.y||0),Vf(w.z||0)))}).digest(e.objectsData)}}),RO=xs({props:{customLayerData:{default:[]},customThreeObject:{},customThreeObjectUpdate:{triggerUpdate:!1}},init:function(e,t){nr(e),t.scene=e,t.dataMapper=new ao(e,{objBindAttr:"__threeObjCustom"}).onCreateObj(function(n){var r=Ct(t.customThreeObject)(n,cr);return r&&(t.customThreeObject===r&&(r=r.clone()),r.__globeObjType="custom"),r})},update:function(e,t){e.customThreeObjectUpdate||nr(e.scene);var n=Ct(e.customThreeObjectUpdate);t.hasOwnProperty("customThreeObject")&&e.dataMapper.clear(),e.dataMapper.onUpdateObj(function(r,s){return n(r,s,cr)}).digest(e.customLayerData)}}),Lv=window.THREE?window.THREE:{Camera:_y,Group:ja,Vector2:At,Vector3:ce},Eue=["globeLayer","pointsLayer","arcsLayer","hexBinLayer","heatmapsLayer","polygonsLayer","hexedPolygonsLayer","pathsLayer","tilesLayer","particlesLayer","ringsLayer","labelsLayer","htmlElementsLayer","objectsLayer","customLayer"],NO=wa("globeLayer",AO),Cue=Object.assign.apply(Object,Qi(["globeImageUrl","bumpImageUrl","globeCurvatureResolution","globeTileEngineUrl","globeTileEngineMaxLevel","showGlobe","showGraticules","showAtmosphere","atmosphereColor","atmosphereAltitude"].map(function(i){return Ps({},i,NO.linkProp(i))}))),Rue=Object.assign.apply(Object,Qi(["globeMaterial","globeTileEngineClearCache"].map(function(i){return Ps({},i,NO.linkMethod(i))}))),Nue=wa("pointsLayer",dO),Due=Object.assign.apply(Object,Qi(["pointsData","pointLat","pointLng","pointColor","pointAltitude","pointRadius","pointResolution","pointsMerge","pointsTransitionDuration"].map(function(i){return Ps({},i,Nue.linkProp(i))}))),Pue=wa("arcsLayer",mO),Lue=Object.assign.apply(Object,Qi(["arcsData","arcStartLat","arcStartLng","arcStartAltitude","arcEndLat","arcEndLng","arcEndAltitude","arcColor","arcAltitude","arcAltitudeAutoScale","arcStroke","arcCurveResolution","arcCircularResolution","arcDashLength","arcDashGap","arcDashInitialGap","arcDashAnimateTime","arcsTransitionDuration"].map(function(i){return Ps({},i,Pue.linkProp(i))}))),Uue=wa("hexBinLayer",gO),Bue=Object.assign.apply(Object,Qi(["hexBinPointsData","hexBinPointLat","hexBinPointLng","hexBinPointWeight","hexBinResolution","hexMargin","hexTopCurvatureResolution","hexTopColor","hexSideColor","hexAltitude","hexBinMerge","hexTransitionDuration"].map(function(i){return Ps({},i,Uue.linkProp(i))}))),Oue=wa("heatmapsLayer",_O),Iue=Object.assign.apply(Object,Qi(["heatmapsData","heatmapPoints","heatmapPointLat","heatmapPointLng","heatmapPointWeight","heatmapBandwidth","heatmapColorFn","heatmapColorSaturation","heatmapBaseAltitude","heatmapTopAltitude","heatmapsTransitionDuration"].map(function(i){return Ps({},i,Oue.linkProp(i))}))),Fue=wa("hexedPolygonsLayer",xO),kue=Object.assign.apply(Object,Qi(["hexPolygonsData","hexPolygonGeoJsonGeometry","hexPolygonColor","hexPolygonAltitude","hexPolygonResolution","hexPolygonMargin","hexPolygonUseDots","hexPolygonCurvatureResolution","hexPolygonDotResolution","hexPolygonsTransitionDuration"].map(function(i){return Ps({},i,Fue.linkProp(i))}))),zue=wa("polygonsLayer",yO),Gue=Object.assign.apply(Object,Qi(["polygonsData","polygonGeoJsonGeometry","polygonCapColor","polygonCapMaterial","polygonSideColor","polygonSideMaterial","polygonStrokeColor","polygonAltitude","polygonCapCurvatureResolution","polygonsTransitionDuration"].map(function(i){return Ps({},i,zue.linkProp(i))}))),que=wa("pathsLayer",bO),Vue=Object.assign.apply(Object,Qi(["pathsData","pathPoints","pathPointLat","pathPointLng","pathPointAlt","pathResolution","pathColor","pathStroke","pathDashLength","pathDashGap","pathDashInitialGap","pathDashAnimateTime","pathTransitionDuration"].map(function(i){return Ps({},i,que.linkProp(i))}))),Hue=wa("tilesLayer",SO),jue=Object.assign.apply(Object,Qi(["tilesData","tileLat","tileLng","tileAltitude","tileWidth","tileHeight","tileUseGlobeProjection","tileMaterial","tileCurvatureResolution","tilesTransitionDuration"].map(function(i){return Ps({},i,Hue.linkProp(i))}))),Wue=wa("particlesLayer",TO),$ue=Object.assign.apply(Object,Qi(["particlesData","particlesList","particleLat","particleLng","particleAltitude","particlesSize","particlesSizeAttenuation","particlesColor","particlesTexture"].map(function(i){return Ps({},i,Wue.linkProp(i))}))),Xue=wa("ringsLayer",wO),Yue=Object.assign.apply(Object,Qi(["ringsData","ringLat","ringLng","ringAltitude","ringColor","ringResolution","ringMaxRadius","ringPropagationSpeed","ringRepeatPeriod"].map(function(i){return Ps({},i,Xue.linkProp(i))}))),Que=wa("labelsLayer",MO),Kue=Object.assign.apply(Object,Qi(["labelsData","labelLat","labelLng","labelAltitude","labelRotation","labelText","labelSize","labelTypeFace","labelColor","labelResolution","labelIncludeDot","labelDotRadius","labelDotOrientation","labelsTransitionDuration"].map(function(i){return Ps({},i,Que.linkProp(i))}))),Zue=wa("htmlElementsLayer",EO),Jue=Object.assign.apply(Object,Qi(["htmlElementsData","htmlLat","htmlLng","htmlAltitude","htmlElement","htmlElementVisibilityModifier","htmlTransitionDuration"].map(function(i){return Ps({},i,Zue.linkProp(i))}))),ece=wa("objectsLayer",CO),tce=Object.assign.apply(Object,Qi(["objectsData","objectLat","objectLng","objectAltitude","objectRotation","objectFacesSurface","objectThreeObject"].map(function(i){return Ps({},i,ece.linkProp(i))}))),nce=wa("customLayer",RO),ice=Object.assign.apply(Object,Qi(["customLayerData","customThreeObject","customThreeObjectUpdate"].map(function(i){return Ps({},i,nce.linkProp(i))}))),rce=xs({props:Hi(Hi(Hi(Hi(Hi(Hi(Hi(Hi(Hi(Hi(Hi(Hi(Hi(Hi(Hi({onGlobeReady:{triggerUpdate:!1},rendererSize:{default:new Lv.Vector2(window.innerWidth,window.innerHeight),onChange:function(e,t){t.pathsLayer.rendererSize(e)},triggerUpdate:!1}},Cue),Due),Lue),Bue),Iue),Gue),kue),Vue),jue),$ue),Yue),Kue),Jue),tce),ice),methods:Hi({getGlobeRadius:qN,getCoords:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r1?t-1:0),r=1;r1&&arguments[1]!==void 0?arguments[1]:Object,t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,n=(function(r){function s(){var a;nx(this,s);for(var l=arguments.length,u=new Array(l),h=0;hKN&&(this.dispatchEvent(US),this._lastPosition.copy(this.object.position))):this.object.isOrthographicCamera?(this.object.lookAt(this.target),(this._lastPosition.distanceToSquared(this.object.position)>KN||this._lastZoom!==this.object.zoom)&&(this.dispatchEvent(US),this._lastPosition.copy(this.object.position),this._lastZoom=this.object.zoom)):console.warn("THREE.TrackballControls: Unsupported camera type.")}reset(){this.state=Ii.NONE,this.keyState=Ii.NONE,this.target.copy(this._target0),this.object.position.copy(this._position0),this.object.up.copy(this._up0),this.object.zoom=this._zoom0,this.object.updateProjectionMatrix(),this._eye.subVectors(this.object.position,this.target),this.object.lookAt(this.target),this.dispatchEvent(US),this._lastPosition.copy(this.object.position),this._lastZoom=this.object.zoom}_panCamera(){if(Eh.copy(this._panEnd).sub(this._panStart),Eh.lengthSq()){if(this.object.isOrthographicCamera){const e=(this.object.right-this.object.left)/this.object.zoom/this.domElement.clientWidth,t=(this.object.top-this.object.bottom)/this.object.zoom/this.domElement.clientWidth;Eh.x*=e,Eh.y*=t}Eh.multiplyScalar(this._eye.length()*this.panSpeed),Bv.copy(this._eye).cross(this.object.up).setLength(Eh.x),Bv.add(oce.copy(this.object.up).setLength(Eh.y)),this.object.position.add(Bv),this.target.add(Bv),this.staticMoving?this._panStart.copy(this._panEnd):this._panStart.add(Eh.subVectors(this._panEnd,this._panStart).multiplyScalar(this.dynamicDampingFactor))}}_rotateCamera(){Iv.set(this._moveCurr.x-this._movePrev.x,this._moveCurr.y-this._movePrev.y,0);let e=Iv.length();e?(this._eye.copy(this.object.position).sub(this.target),ZN.copy(this._eye).normalize(),Ov.copy(this.object.up).normalize(),OS.crossVectors(Ov,ZN).normalize(),Ov.setLength(this._moveCurr.y-this._movePrev.y),OS.setLength(this._moveCurr.x-this._movePrev.x),Iv.copy(Ov.add(OS)),BS.crossVectors(Iv,this._eye).normalize(),e*=this.rotateSpeed,Fd.setFromAxisAngle(BS,e),this._eye.applyQuaternion(Fd),this.object.up.applyQuaternion(Fd),this._lastAxis.copy(BS),this._lastAngle=e):!this.staticMoving&&this._lastAngle&&(this._lastAngle*=Math.sqrt(1-this.dynamicDampingFactor),this._eye.copy(this.object.position).sub(this.target),Fd.setFromAxisAngle(this._lastAxis,this._lastAngle),this._eye.applyQuaternion(Fd),this.object.up.applyQuaternion(Fd)),this._movePrev.copy(this._moveCurr)}_zoomCamera(){let e;this.state===Ii.TOUCH_ZOOM_PAN?(e=this._touchZoomDistanceStart/this._touchZoomDistanceEnd,this._touchZoomDistanceStart=this._touchZoomDistanceEnd,this.object.isPerspectiveCamera?this._eye.multiplyScalar(e):this.object.isOrthographicCamera?(this.object.zoom=M0.clamp(this.object.zoom/e,this.minZoom,this.maxZoom),this._lastZoom!==this.object.zoom&&this.object.updateProjectionMatrix()):console.warn("THREE.TrackballControls: Unsupported camera type")):(e=1+(this._zoomEnd.y-this._zoomStart.y)*this.zoomSpeed,e!==1&&e>0&&(this.object.isPerspectiveCamera?this._eye.multiplyScalar(e):this.object.isOrthographicCamera?(this.object.zoom=M0.clamp(this.object.zoom/e,this.minZoom,this.maxZoom),this._lastZoom!==this.object.zoom&&this.object.updateProjectionMatrix()):console.warn("THREE.TrackballControls: Unsupported camera type")),this.staticMoving?this._zoomStart.copy(this._zoomEnd):this._zoomStart.y+=(this._zoomEnd.y-this._zoomStart.y)*this.dynamicDampingFactor)}_getMouseOnScreen(e,t){return Uv.set((e-this.screen.left)/this.screen.width,(t-this.screen.top)/this.screen.height),Uv}_getMouseOnCircle(e,t){return Uv.set((e-this.screen.width*.5-this.screen.left)/(this.screen.width*.5),(this.screen.height+2*(this.screen.top-t))/this.screen.width),Uv}_addPointer(e){this._pointers.push(e)}_removePointer(e){delete this._pointerPositions[e.pointerId];for(let t=0;tthis.maxDistance*this.maxDistance&&(this.object.position.addVectors(this.target,this._eye.setLength(this.maxDistance)),this._zoomStart.copy(this._zoomEnd)),this._eye.lengthSq()Math.PI&&(n-=Fa),r<-Math.PI?r+=Fa:r>Math.PI&&(r-=Fa),n<=r?this._spherical.theta=Math.max(n,Math.min(r,this._spherical.theta)):this._spherical.theta=this._spherical.theta>(n+r)/2?Math.max(n,this._spherical.theta):Math.min(r,this._spherical.theta)),this._spherical.phi=Math.max(this.minPolarAngle,Math.min(this.maxPolarAngle,this._spherical.phi)),this._spherical.makeSafe(),this.enableDamping===!0?this.target.addScaledVector(this._panOffset,this.dampingFactor):this.target.add(this._panOffset),this.target.sub(this.cursor),this.target.clampLength(this.minTargetRadius,this.maxTargetRadius),this.target.add(this.cursor);let s=!1;if(this.zoomToCursor&&this._performCursorZoom||this.object.isOrthographicCamera)this._spherical.radius=this._clampDistance(this._spherical.radius);else{const a=this._spherical.radius;this._spherical.radius=this._clampDistance(this._spherical.radius*this._scale),s=a!=this._spherical.radius}if(ps.setFromSpherical(this._spherical),ps.applyQuaternion(this._quatInverse),t.copy(this.target).add(ps),this.object.lookAt(this.target),this.enableDamping===!0?(this._sphericalDelta.theta*=1-this.dampingFactor,this._sphericalDelta.phi*=1-this.dampingFactor,this._panOffset.multiplyScalar(1-this.dampingFactor)):(this._sphericalDelta.set(0,0,0),this._panOffset.set(0,0,0)),this.zoomToCursor&&this._performCursorZoom){let a=null;if(this.object.isPerspectiveCamera){const l=ps.length();a=this._clampDistance(l*this._scale);const u=l-a;this.object.position.addScaledVector(this._dollyDirection,u),this.object.updateMatrixWorld(),s=!!u}else if(this.object.isOrthographicCamera){const l=new ce(this._mouse.x,this._mouse.y,0);l.unproject(this.object);const u=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),this.object.updateProjectionMatrix(),s=u!==this.object.zoom;const h=new ce(this._mouse.x,this._mouse.y,0);h.unproject(this.object),this.object.position.sub(h).add(l),this.object.updateMatrixWorld(),a=ps.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),this.zoomToCursor=!1;a!==null&&(this.screenSpacePanning?this.target.set(0,0,-1).transformDirection(this.object.matrix).multiplyScalar(a).add(this.object.position):(Fv.origin.copy(this.object.position),Fv.direction.set(0,0,-1).transformDirection(this.object.matrix),Math.abs(this.object.up.dot(Fv.direction))IS||8*(1-this._lastQuaternion.dot(this.object.quaternion))>IS||this._lastTargetPosition.distanceToSquared(this.target)>IS?(this.dispatchEvent(JN),this._lastPosition.copy(this.object.position),this._lastQuaternion.copy(this.object.quaternion),this._lastTargetPosition.copy(this.target),!0):!1}_getAutoRotationAngle(e){return e!==null?Fa/60*this.autoRotateSpeed*e:Fa/60/60*this.autoRotateSpeed}_getZoomScale(e){const t=Math.abs(e*.01);return Math.pow(.95,this.zoomSpeed*t)}_rotateLeft(e){this._sphericalDelta.theta-=e}_rotateUp(e){this._sphericalDelta.phi-=e}_panLeft(e,t){ps.setFromMatrixColumn(t,0),ps.multiplyScalar(-e),this._panOffset.add(ps)}_panUp(e,t){this.screenSpacePanning===!0?ps.setFromMatrixColumn(t,1):(ps.setFromMatrixColumn(t,0),ps.crossVectors(this.object.up,ps)),ps.multiplyScalar(e),this._panOffset.add(ps)}_pan(e,t){const n=this.domElement;if(this.object.isPerspectiveCamera){const r=this.object.position;ps.copy(r).sub(this.target);let s=ps.length();s*=Math.tan(this.object.fov/2*Math.PI/180),this._panLeft(2*e*s/n.clientHeight,this.object.matrix),this._panUp(2*t*s/n.clientHeight,this.object.matrix)}else this.object.isOrthographicCamera?(this._panLeft(e*(this.object.right-this.object.left)/this.object.zoom/n.clientWidth,this.object.matrix),this._panUp(t*(this.object.top-this.object.bottom)/this.object.zoom/n.clientHeight,this.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),this.enablePan=!1)}_dollyOut(e){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale/=e:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}_dollyIn(e){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale*=e:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}_updateZoomParameters(e,t){if(!this.zoomToCursor)return;this._performCursorZoom=!0;const n=this.domElement.getBoundingClientRect(),r=e-n.left,s=t-n.top,a=n.width,l=n.height;this._mouse.x=r/a*2-1,this._mouse.y=-(s/l)*2+1,this._dollyDirection.set(this._mouse.x,this._mouse.y,1).unproject(this.object).sub(this.object.position).normalize()}_clampDistance(e){return Math.max(this.minDistance,Math.min(this.maxDistance,e))}_handleMouseDownRotate(e){this._rotateStart.set(e.clientX,e.clientY)}_handleMouseDownDolly(e){this._updateZoomParameters(e.clientX,e.clientX),this._dollyStart.set(e.clientX,e.clientY)}_handleMouseDownPan(e){this._panStart.set(e.clientX,e.clientY)}_handleMouseMoveRotate(e){this._rotateEnd.set(e.clientX,e.clientY),this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);const t=this.domElement;this._rotateLeft(Fa*this._rotateDelta.x/t.clientHeight),this._rotateUp(Fa*this._rotateDelta.y/t.clientHeight),this._rotateStart.copy(this._rotateEnd),this.update()}_handleMouseMoveDolly(e){this._dollyEnd.set(e.clientX,e.clientY),this._dollyDelta.subVectors(this._dollyEnd,this._dollyStart),this._dollyDelta.y>0?this._dollyOut(this._getZoomScale(this._dollyDelta.y)):this._dollyDelta.y<0&&this._dollyIn(this._getZoomScale(this._dollyDelta.y)),this._dollyStart.copy(this._dollyEnd),this.update()}_handleMouseMovePan(e){this._panEnd.set(e.clientX,e.clientY),this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd),this.update()}_handleMouseWheel(e){this._updateZoomParameters(e.clientX,e.clientY),e.deltaY<0?this._dollyIn(this._getZoomScale(e.deltaY)):e.deltaY>0&&this._dollyOut(this._getZoomScale(e.deltaY)),this.update()}_handleKeyDown(e){let t=!1;switch(e.code){case this.keys.UP:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateUp(Fa*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,this.keyPanSpeed),t=!0;break;case this.keys.BOTTOM:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateUp(-Fa*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,-this.keyPanSpeed),t=!0;break;case this.keys.LEFT:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateLeft(Fa*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(this.keyPanSpeed,0),t=!0;break;case this.keys.RIGHT:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateLeft(-Fa*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(-this.keyPanSpeed,0),t=!0;break}t&&(e.preventDefault(),this.update())}_handleTouchStartRotate(e){if(this._pointers.length===1)this._rotateStart.set(e.pageX,e.pageY);else{const t=this._getSecondPointerPosition(e),n=.5*(e.pageX+t.x),r=.5*(e.pageY+t.y);this._rotateStart.set(n,r)}}_handleTouchStartPan(e){if(this._pointers.length===1)this._panStart.set(e.pageX,e.pageY);else{const t=this._getSecondPointerPosition(e),n=.5*(e.pageX+t.x),r=.5*(e.pageY+t.y);this._panStart.set(n,r)}}_handleTouchStartDolly(e){const t=this._getSecondPointerPosition(e),n=e.pageX-t.x,r=e.pageY-t.y,s=Math.sqrt(n*n+r*r);this._dollyStart.set(0,s)}_handleTouchStartDollyPan(e){this.enableZoom&&this._handleTouchStartDolly(e),this.enablePan&&this._handleTouchStartPan(e)}_handleTouchStartDollyRotate(e){this.enableZoom&&this._handleTouchStartDolly(e),this.enableRotate&&this._handleTouchStartRotate(e)}_handleTouchMoveRotate(e){if(this._pointers.length==1)this._rotateEnd.set(e.pageX,e.pageY);else{const n=this._getSecondPointerPosition(e),r=.5*(e.pageX+n.x),s=.5*(e.pageY+n.y);this._rotateEnd.set(r,s)}this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);const t=this.domElement;this._rotateLeft(Fa*this._rotateDelta.x/t.clientHeight),this._rotateUp(Fa*this._rotateDelta.y/t.clientHeight),this._rotateStart.copy(this._rotateEnd)}_handleTouchMovePan(e){if(this._pointers.length===1)this._panEnd.set(e.pageX,e.pageY);else{const t=this._getSecondPointerPosition(e),n=.5*(e.pageX+t.x),r=.5*(e.pageY+t.y);this._panEnd.set(n,r)}this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd)}_handleTouchMoveDolly(e){const t=this._getSecondPointerPosition(e),n=e.pageX-t.x,r=e.pageY-t.y,s=Math.sqrt(n*n+r*r);this._dollyEnd.set(0,s),this._dollyDelta.set(0,Math.pow(this._dollyEnd.y/this._dollyStart.y,this.zoomSpeed)),this._dollyOut(this._dollyDelta.y),this._dollyStart.copy(this._dollyEnd);const a=(e.pageX+t.x)*.5,l=(e.pageY+t.y)*.5;this._updateZoomParameters(a,l)}_handleTouchMoveDollyPan(e){this.enableZoom&&this._handleTouchMoveDolly(e),this.enablePan&&this._handleTouchMovePan(e)}_handleTouchMoveDollyRotate(e){this.enableZoom&&this._handleTouchMoveDolly(e),this.enableRotate&&this._handleTouchMoveRotate(e)}_addPointer(e){this._pointers.push(e.pointerId)}_removePointer(e){delete this._pointerPositions[e.pointerId];for(let t=0;tt7||8*(1-this._lastQuaternion.dot(t.quaternion))>t7)&&(this.dispatchEvent(Ice),this._lastQuaternion.copy(t.quaternion),this._lastPosition.copy(t.position))}_updateMovementVector(){const e=this._moveState.forward||this.autoForward&&!this._moveState.back?1:0;this._moveVector.x=-this._moveState.left+this._moveState.right,this._moveVector.y=-this._moveState.down+this._moveState.up,this._moveVector.z=-e+this._moveState.back}_updateRotationVector(){this._rotationVector.x=-this._moveState.pitchDown+this._moveState.pitchUp,this._rotationVector.y=-this._moveState.yawRight+this._moveState.yawLeft,this._rotationVector.z=-this._moveState.rollRight+this._moveState.rollLeft}_getContainerDimensions(){return this.domElement!=document?{size:[this.domElement.offsetWidth,this.domElement.offsetHeight],offset:[this.domElement.offsetLeft,this.domElement.offsetTop]}:{size:[window.innerWidth,window.innerHeight],offset:[0,0]}}}function kce(i){if(!(i.altKey||this.enabled===!1)){switch(i.code){case"ShiftLeft":case"ShiftRight":this.movementSpeedMultiplier=.1;break;case"KeyW":this._moveState.forward=1;break;case"KeyS":this._moveState.back=1;break;case"KeyA":this._moveState.left=1;break;case"KeyD":this._moveState.right=1;break;case"KeyR":this._moveState.up=1;break;case"KeyF":this._moveState.down=1;break;case"ArrowUp":this._moveState.pitchUp=1;break;case"ArrowDown":this._moveState.pitchDown=1;break;case"ArrowLeft":this._moveState.yawLeft=1;break;case"ArrowRight":this._moveState.yawRight=1;break;case"KeyQ":this._moveState.rollLeft=1;break;case"KeyE":this._moveState.rollRight=1;break}this._updateMovementVector(),this._updateRotationVector()}}function zce(i){if(this.enabled!==!1){switch(i.code){case"ShiftLeft":case"ShiftRight":this.movementSpeedMultiplier=1;break;case"KeyW":this._moveState.forward=0;break;case"KeyS":this._moveState.back=0;break;case"KeyA":this._moveState.left=0;break;case"KeyD":this._moveState.right=0;break;case"KeyR":this._moveState.up=0;break;case"KeyF":this._moveState.down=0;break;case"ArrowUp":this._moveState.pitchUp=0;break;case"ArrowDown":this._moveState.pitchDown=0;break;case"ArrowLeft":this._moveState.yawLeft=0;break;case"ArrowRight":this._moveState.yawRight=0;break;case"KeyQ":this._moveState.rollLeft=0;break;case"KeyE":this._moveState.rollRight=0;break}this._updateMovementVector(),this._updateRotationVector()}}function Gce(i){if(this.enabled!==!1)if(this.dragToLook)this._status++;else{switch(i.button){case 0:this._moveState.forward=1;break;case 2:this._moveState.back=1;break}this._updateMovementVector()}}function qce(i){if(this.enabled!==!1&&(!this.dragToLook||this._status>0)){const e=this._getContainerDimensions(),t=e.size[0]/2,n=e.size[1]/2;this._moveState.yawLeft=-(i.pageX-e.offset[0]-t)/t,this._moveState.pitchDown=(i.pageY-e.offset[1]-n)/n,this._updateRotationVector()}}function Vce(i){if(this.enabled!==!1){if(this.dragToLook)this._status--,this._moveState.yawLeft=this._moveState.pitchDown=0;else{switch(i.button){case 0:this._moveState.forward=0;break;case 2:this._moveState.back=0;break}this._updateMovementVector()}this._updateRotationVector()}}function Hce(){this.enabled!==!1&&(this.dragToLook?(this._status=0,this._moveState.yawLeft=this._moveState.pitchDown=0):(this._moveState.forward=0,this._moveState.back=0,this._updateMovementVector()),this._updateRotationVector())}function jce(i){this.enabled!==!1&&i.preventDefault()}const Wce={name:"CopyShader",uniforms:{tDiffuse:{value:null},opacity:{value:1}},vertexShader:` +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL MAGENTA OR PERSONS OR BODIES IN CHARGE OF ADMINISTRATION AND MAINTENANCE OF THE FONT SOFTWARE BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER DEALINGS IN THE FONT SOFTWARE.`,manufacturer_name:"Μagenta ltd",font_sub_family_name:"Regular"},xue=-334,bue="Helvetiker",Sue=1522,Tue=50,wue={glyphs:Aue,cssFontWeight:due,ascender:pue,underlinePosition:mue,cssFontStyle:gue,boundingBox:vue,resolution:_ue,original_font_information:yue,descender:xue,familyName:bue,lineHeight:Sue,underlineThickness:Tue},xl=Hi(Hi({},window.THREE?window.THREE:{BoxGeometry:$h,CircleGeometry:by,DoubleSide:as,Group:ja,Mesh:zi,MeshLambertMaterial:Vc,TextGeometry:kN,Vector3:ce}),{},{Font:Sle,TextGeometry:kN}),MO=xs({props:{labelsData:{default:[]},labelLat:{default:"lat"},labelLng:{default:"lng"},labelAltitude:{default:.002},labelText:{default:"text"},labelSize:{default:.5},labelTypeFace:{default:wue,onChange:function(e,t){t.font=new xl.Font(e)}},labelColor:{default:function(){return"lightgrey"}},labelRotation:{default:0},labelResolution:{default:3},labelIncludeDot:{default:!0},labelDotRadius:{default:.1},labelDotOrientation:{default:function(){return"bottom"}},labelsTransitionDuration:{default:1e3,triggerUpdate:!1}},init:function(e,t,n){var r=n.tweenGroup;nr(e),t.scene=e,t.tweenGroup=r;var s=new xl.CircleGeometry(1,32);t.dataMapper=new ao(e,{objBindAttr:"__threeObjLabel"}).onCreateObj(function(){var a=new xl.MeshLambertMaterial;a.side=as;var l=new xl.Group;l.add(new xl.Mesh(s,a));var u=new xl.Mesh(void 0,a);l.add(u);var h=new xl.Mesh;return h.visible=!1,u.add(h),l.__globeObjType="label",l})},update:function(e){var t=Ct(e.labelLat),n=Ct(e.labelLng),r=Ct(e.labelAltitude),s=Ct(e.labelText),a=Ct(e.labelSize),l=Ct(e.labelRotation),u=Ct(e.labelColor),h=Ct(e.labelIncludeDot),g=Ct(e.labelDotRadius),v=Ct(e.labelDotOrientation),x=new Set(["right","top","bottom"]),S=2*Math.PI*cr/360;e.dataMapper.onUpdateObj(function(w,R){var C=gr(w.children,2),E=C[0],B=C[1],L=gr(B.children,1),O=L[0],z=u(R),G=Rl(z);B.material.color.set(wu(z)),B.material.transparent=G<1,B.material.opacity=G;var k=h(R),H=v(R);!k||!x.has(H)&&(H="bottom");var F=k?+g(R)*S:1e-12;E.scale.x=E.scale.y=F;var V=+a(R)*S;if(B.geometry&&B.geometry.dispose(),B.geometry=new xl.TextGeometry(s(R),{font:e.font,size:V,depth:0,bevelEnabled:!0,bevelThickness:0,bevelSize:0,curveSegments:e.labelResolution}),O.geometry&&O.geometry.dispose(),B.geometry.computeBoundingBox(),O.geometry=qE(xl.BoxGeometry,Qi(new xl.Vector3().subVectors(B.geometry.boundingBox.max,B.geometry.boundingBox.min).clampScalar(0,1/0).toArray())),H!=="right"&&B.geometry.center(),k){var X=F+V/2;H==="right"&&(B.position.x=X),B.position.y={right:-V/2,top:X+V/2,bottom:-X-V/2}[H]}var J=function(Z){var ue=w.__currentTargetD=Z,he=ue.lat,be=ue.lng,Se=ue.alt,le=ue.rot,we=ue.scale;Object.assign(w.position,el(he,be,Se)),w.lookAt(e.scene.localToWorld(new xl.Vector3(0,0,0))),w.rotateY(Math.PI),w.rotateZ(-le*Math.PI/180),w.scale.x=w.scale.y=w.scale.z=we},te={lat:+t(R),lng:+n(R),alt:+r(R),rot:+l(R),scale:1},se=w.__currentTargetD||Object.assign({},te,{scale:1e-12});Object.keys(te).some(function(ne){return se[ne]!==te[ne]})&&(!e.labelsTransitionDuration||e.labelsTransitionDuration<0?J(te):e.tweenGroup.add(new ca(se).to(te,e.labelsTransitionDuration).easing(os.Quadratic.InOut).onUpdate(J).start()))}).digest(e.labelsData)}}),Mue=Hi(Hi({},window.THREE?window.THREE:{}),{},{CSS2DObject:Uj}),EO=xs({props:{htmlElementsData:{default:[]},htmlLat:{default:"lat"},htmlLng:{default:"lng"},htmlAltitude:{default:0},htmlElement:{},htmlElementVisibilityModifier:{triggerUpdate:!1},htmlTransitionDuration:{default:1e3,triggerUpdate:!1},isBehindGlobe:{onChange:function(){this.updateObjVisibility()},triggerUpdate:!1}},methods:{updateObjVisibility:function(e,t){if(e.dataMapper){var n=t?[t]:e.dataMapper.entries().map(function(r){var s=gr(r,2),a=s[1];return a}).filter(function(r){return r});n.forEach(function(r){var s=!e.isBehindGlobe||!e.isBehindGlobe(r.position);e.htmlElementVisibilityModifier?(r.visible=!0,e.htmlElementVisibilityModifier(r.element,s)):r.visible=s})}}},init:function(e,t,n){var r=n.tweenGroup;nr(e),t.scene=e,t.tweenGroup=r,t.dataMapper=new ao(e,{objBindAttr:"__threeObjHtml"}).onCreateObj(function(s){var a=Ct(t.htmlElement)(s),l=new Mue.CSS2DObject(a);return l.__globeObjType="html",l})},update:function(e,t){var n=this,r=Ct(e.htmlLat),s=Ct(e.htmlLng),a=Ct(e.htmlAltitude);t.hasOwnProperty("htmlElement")&&e.dataMapper.clear(),e.dataMapper.onUpdateObj(function(l,u){var h=function(x){var S=l.__currentTargetD=x,w=S.alt,R=S.lat,C=S.lng;Object.assign(l.position,el(R,C,w)),n.updateObjVisibility(l)},g={lat:+r(u),lng:+s(u),alt:+a(u)};!e.htmlTransitionDuration||e.htmlTransitionDuration<0||!l.__currentTargetD?h(g):e.tweenGroup.add(new ca(l.__currentTargetD).to(g,e.htmlTransitionDuration).easing(os.Quadratic.InOut).onUpdate(h).start())}).digest(e.htmlElementsData)}}),Pv=window.THREE?window.THREE:{Group:ja,Mesh:zi,MeshLambertMaterial:Vc,SphereGeometry:Eu},CO=xs({props:{objectsData:{default:[]},objectLat:{default:"lat"},objectLng:{default:"lng"},objectAltitude:{default:.01},objectFacesSurface:{default:!0},objectRotation:{},objectThreeObject:{default:new Pv.Mesh(new Pv.SphereGeometry(1,16,8),new Pv.MeshLambertMaterial({color:"#ffffaa",transparent:!0,opacity:.7}))}},init:function(e,t){nr(e),t.scene=e,t.dataMapper=new ao(e,{objBindAttr:"__threeObjObject"}).onCreateObj(function(n){var r=Ct(t.objectThreeObject)(n);t.objectThreeObject===r&&(r=r.clone());var s=new Pv.Group;return s.add(r),s.__globeObjType="object",s})},update:function(e,t){var n=Ct(e.objectLat),r=Ct(e.objectLng),s=Ct(e.objectAltitude),a=Ct(e.objectFacesSurface),l=Ct(e.objectRotation);t.hasOwnProperty("objectThreeObject")&&e.dataMapper.clear(),e.dataMapper.onUpdateObj(function(u,h){var g=+n(h),v=+r(h),x=+s(h);Object.assign(u.position,el(g,v,x)),a(h)?u.setRotationFromEuler(new la(Vf(-g),Vf(v),0,"YXZ")):u.rotation.set(0,0,0);var S=u.children[0],w=l(h);w&&S.setRotationFromEuler(new la(Vf(w.x||0),Vf(w.y||0),Vf(w.z||0)))}).digest(e.objectsData)}}),RO=xs({props:{customLayerData:{default:[]},customThreeObject:{},customThreeObjectUpdate:{triggerUpdate:!1}},init:function(e,t){nr(e),t.scene=e,t.dataMapper=new ao(e,{objBindAttr:"__threeObjCustom"}).onCreateObj(function(n){var r=Ct(t.customThreeObject)(n,cr);return r&&(t.customThreeObject===r&&(r=r.clone()),r.__globeObjType="custom"),r})},update:function(e,t){e.customThreeObjectUpdate||nr(e.scene);var n=Ct(e.customThreeObjectUpdate);t.hasOwnProperty("customThreeObject")&&e.dataMapper.clear(),e.dataMapper.onUpdateObj(function(r,s){return n(r,s,cr)}).digest(e.customLayerData)}}),Lv=window.THREE?window.THREE:{Camera:_y,Group:ja,Vector2:dt,Vector3:ce},Eue=["globeLayer","pointsLayer","arcsLayer","hexBinLayer","heatmapsLayer","polygonsLayer","hexedPolygonsLayer","pathsLayer","tilesLayer","particlesLayer","ringsLayer","labelsLayer","htmlElementsLayer","objectsLayer","customLayer"],NO=wa("globeLayer",AO),Cue=Object.assign.apply(Object,Qi(["globeImageUrl","bumpImageUrl","globeCurvatureResolution","globeTileEngineUrl","globeTileEngineMaxLevel","showGlobe","showGraticules","showAtmosphere","atmosphereColor","atmosphereAltitude"].map(function(i){return Ps({},i,NO.linkProp(i))}))),Rue=Object.assign.apply(Object,Qi(["globeMaterial","globeTileEngineClearCache"].map(function(i){return Ps({},i,NO.linkMethod(i))}))),Nue=wa("pointsLayer",dO),Due=Object.assign.apply(Object,Qi(["pointsData","pointLat","pointLng","pointColor","pointAltitude","pointRadius","pointResolution","pointsMerge","pointsTransitionDuration"].map(function(i){return Ps({},i,Nue.linkProp(i))}))),Pue=wa("arcsLayer",mO),Lue=Object.assign.apply(Object,Qi(["arcsData","arcStartLat","arcStartLng","arcStartAltitude","arcEndLat","arcEndLng","arcEndAltitude","arcColor","arcAltitude","arcAltitudeAutoScale","arcStroke","arcCurveResolution","arcCircularResolution","arcDashLength","arcDashGap","arcDashInitialGap","arcDashAnimateTime","arcsTransitionDuration"].map(function(i){return Ps({},i,Pue.linkProp(i))}))),Uue=wa("hexBinLayer",gO),Bue=Object.assign.apply(Object,Qi(["hexBinPointsData","hexBinPointLat","hexBinPointLng","hexBinPointWeight","hexBinResolution","hexMargin","hexTopCurvatureResolution","hexTopColor","hexSideColor","hexAltitude","hexBinMerge","hexTransitionDuration"].map(function(i){return Ps({},i,Uue.linkProp(i))}))),Oue=wa("heatmapsLayer",_O),Iue=Object.assign.apply(Object,Qi(["heatmapsData","heatmapPoints","heatmapPointLat","heatmapPointLng","heatmapPointWeight","heatmapBandwidth","heatmapColorFn","heatmapColorSaturation","heatmapBaseAltitude","heatmapTopAltitude","heatmapsTransitionDuration"].map(function(i){return Ps({},i,Oue.linkProp(i))}))),Fue=wa("hexedPolygonsLayer",xO),kue=Object.assign.apply(Object,Qi(["hexPolygonsData","hexPolygonGeoJsonGeometry","hexPolygonColor","hexPolygonAltitude","hexPolygonResolution","hexPolygonMargin","hexPolygonUseDots","hexPolygonCurvatureResolution","hexPolygonDotResolution","hexPolygonsTransitionDuration"].map(function(i){return Ps({},i,Fue.linkProp(i))}))),zue=wa("polygonsLayer",yO),Gue=Object.assign.apply(Object,Qi(["polygonsData","polygonGeoJsonGeometry","polygonCapColor","polygonCapMaterial","polygonSideColor","polygonSideMaterial","polygonStrokeColor","polygonAltitude","polygonCapCurvatureResolution","polygonsTransitionDuration"].map(function(i){return Ps({},i,zue.linkProp(i))}))),que=wa("pathsLayer",bO),Vue=Object.assign.apply(Object,Qi(["pathsData","pathPoints","pathPointLat","pathPointLng","pathPointAlt","pathResolution","pathColor","pathStroke","pathDashLength","pathDashGap","pathDashInitialGap","pathDashAnimateTime","pathTransitionDuration"].map(function(i){return Ps({},i,que.linkProp(i))}))),Hue=wa("tilesLayer",SO),jue=Object.assign.apply(Object,Qi(["tilesData","tileLat","tileLng","tileAltitude","tileWidth","tileHeight","tileUseGlobeProjection","tileMaterial","tileCurvatureResolution","tilesTransitionDuration"].map(function(i){return Ps({},i,Hue.linkProp(i))}))),Wue=wa("particlesLayer",TO),$ue=Object.assign.apply(Object,Qi(["particlesData","particlesList","particleLat","particleLng","particleAltitude","particlesSize","particlesSizeAttenuation","particlesColor","particlesTexture"].map(function(i){return Ps({},i,Wue.linkProp(i))}))),Xue=wa("ringsLayer",wO),Yue=Object.assign.apply(Object,Qi(["ringsData","ringLat","ringLng","ringAltitude","ringColor","ringResolution","ringMaxRadius","ringPropagationSpeed","ringRepeatPeriod"].map(function(i){return Ps({},i,Xue.linkProp(i))}))),Que=wa("labelsLayer",MO),Kue=Object.assign.apply(Object,Qi(["labelsData","labelLat","labelLng","labelAltitude","labelRotation","labelText","labelSize","labelTypeFace","labelColor","labelResolution","labelIncludeDot","labelDotRadius","labelDotOrientation","labelsTransitionDuration"].map(function(i){return Ps({},i,Que.linkProp(i))}))),Zue=wa("htmlElementsLayer",EO),Jue=Object.assign.apply(Object,Qi(["htmlElementsData","htmlLat","htmlLng","htmlAltitude","htmlElement","htmlElementVisibilityModifier","htmlTransitionDuration"].map(function(i){return Ps({},i,Zue.linkProp(i))}))),ece=wa("objectsLayer",CO),tce=Object.assign.apply(Object,Qi(["objectsData","objectLat","objectLng","objectAltitude","objectRotation","objectFacesSurface","objectThreeObject"].map(function(i){return Ps({},i,ece.linkProp(i))}))),nce=wa("customLayer",RO),ice=Object.assign.apply(Object,Qi(["customLayerData","customThreeObject","customThreeObjectUpdate"].map(function(i){return Ps({},i,nce.linkProp(i))}))),rce=xs({props:Hi(Hi(Hi(Hi(Hi(Hi(Hi(Hi(Hi(Hi(Hi(Hi(Hi(Hi(Hi({onGlobeReady:{triggerUpdate:!1},rendererSize:{default:new Lv.Vector2(window.innerWidth,window.innerHeight),onChange:function(e,t){t.pathsLayer.rendererSize(e)},triggerUpdate:!1}},Cue),Due),Lue),Bue),Iue),Gue),kue),Vue),jue),$ue),Yue),Kue),Jue),tce),ice),methods:Hi({getGlobeRadius:qN,getCoords:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r1?t-1:0),r=1;r1&&arguments[1]!==void 0?arguments[1]:Object,t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,n=(function(r){function s(){var a;nx(this,s);for(var l=arguments.length,u=new Array(l),h=0;hKN&&(this.dispatchEvent(US),this._lastPosition.copy(this.object.position))):this.object.isOrthographicCamera?(this.object.lookAt(this.target),(this._lastPosition.distanceToSquared(this.object.position)>KN||this._lastZoom!==this.object.zoom)&&(this.dispatchEvent(US),this._lastPosition.copy(this.object.position),this._lastZoom=this.object.zoom)):console.warn("THREE.TrackballControls: Unsupported camera type.")}reset(){this.state=Ii.NONE,this.keyState=Ii.NONE,this.target.copy(this._target0),this.object.position.copy(this._position0),this.object.up.copy(this._up0),this.object.zoom=this._zoom0,this.object.updateProjectionMatrix(),this._eye.subVectors(this.object.position,this.target),this.object.lookAt(this.target),this.dispatchEvent(US),this._lastPosition.copy(this.object.position),this._lastZoom=this.object.zoom}_panCamera(){if(Eh.copy(this._panEnd).sub(this._panStart),Eh.lengthSq()){if(this.object.isOrthographicCamera){const e=(this.object.right-this.object.left)/this.object.zoom/this.domElement.clientWidth,t=(this.object.top-this.object.bottom)/this.object.zoom/this.domElement.clientWidth;Eh.x*=e,Eh.y*=t}Eh.multiplyScalar(this._eye.length()*this.panSpeed),Bv.copy(this._eye).cross(this.object.up).setLength(Eh.x),Bv.add(oce.copy(this.object.up).setLength(Eh.y)),this.object.position.add(Bv),this.target.add(Bv),this.staticMoving?this._panStart.copy(this._panEnd):this._panStart.add(Eh.subVectors(this._panEnd,this._panStart).multiplyScalar(this.dynamicDampingFactor))}}_rotateCamera(){Iv.set(this._moveCurr.x-this._movePrev.x,this._moveCurr.y-this._movePrev.y,0);let e=Iv.length();e?(this._eye.copy(this.object.position).sub(this.target),ZN.copy(this._eye).normalize(),Ov.copy(this.object.up).normalize(),OS.crossVectors(Ov,ZN).normalize(),Ov.setLength(this._moveCurr.y-this._movePrev.y),OS.setLength(this._moveCurr.x-this._movePrev.x),Iv.copy(Ov.add(OS)),BS.crossVectors(Iv,this._eye).normalize(),e*=this.rotateSpeed,Fd.setFromAxisAngle(BS,e),this._eye.applyQuaternion(Fd),this.object.up.applyQuaternion(Fd),this._lastAxis.copy(BS),this._lastAngle=e):!this.staticMoving&&this._lastAngle&&(this._lastAngle*=Math.sqrt(1-this.dynamicDampingFactor),this._eye.copy(this.object.position).sub(this.target),Fd.setFromAxisAngle(this._lastAxis,this._lastAngle),this._eye.applyQuaternion(Fd),this.object.up.applyQuaternion(Fd)),this._movePrev.copy(this._moveCurr)}_zoomCamera(){let e;this.state===Ii.TOUCH_ZOOM_PAN?(e=this._touchZoomDistanceStart/this._touchZoomDistanceEnd,this._touchZoomDistanceStart=this._touchZoomDistanceEnd,this.object.isPerspectiveCamera?this._eye.multiplyScalar(e):this.object.isOrthographicCamera?(this.object.zoom=M0.clamp(this.object.zoom/e,this.minZoom,this.maxZoom),this._lastZoom!==this.object.zoom&&this.object.updateProjectionMatrix()):console.warn("THREE.TrackballControls: Unsupported camera type")):(e=1+(this._zoomEnd.y-this._zoomStart.y)*this.zoomSpeed,e!==1&&e>0&&(this.object.isPerspectiveCamera?this._eye.multiplyScalar(e):this.object.isOrthographicCamera?(this.object.zoom=M0.clamp(this.object.zoom/e,this.minZoom,this.maxZoom),this._lastZoom!==this.object.zoom&&this.object.updateProjectionMatrix()):console.warn("THREE.TrackballControls: Unsupported camera type")),this.staticMoving?this._zoomStart.copy(this._zoomEnd):this._zoomStart.y+=(this._zoomEnd.y-this._zoomStart.y)*this.dynamicDampingFactor)}_getMouseOnScreen(e,t){return Uv.set((e-this.screen.left)/this.screen.width,(t-this.screen.top)/this.screen.height),Uv}_getMouseOnCircle(e,t){return Uv.set((e-this.screen.width*.5-this.screen.left)/(this.screen.width*.5),(this.screen.height+2*(this.screen.top-t))/this.screen.width),Uv}_addPointer(e){this._pointers.push(e)}_removePointer(e){delete this._pointerPositions[e.pointerId];for(let t=0;tthis.maxDistance*this.maxDistance&&(this.object.position.addVectors(this.target,this._eye.setLength(this.maxDistance)),this._zoomStart.copy(this._zoomEnd)),this._eye.lengthSq()Math.PI&&(n-=Fa),r<-Math.PI?r+=Fa:r>Math.PI&&(r-=Fa),n<=r?this._spherical.theta=Math.max(n,Math.min(r,this._spherical.theta)):this._spherical.theta=this._spherical.theta>(n+r)/2?Math.max(n,this._spherical.theta):Math.min(r,this._spherical.theta)),this._spherical.phi=Math.max(this.minPolarAngle,Math.min(this.maxPolarAngle,this._spherical.phi)),this._spherical.makeSafe(),this.enableDamping===!0?this.target.addScaledVector(this._panOffset,this.dampingFactor):this.target.add(this._panOffset),this.target.sub(this.cursor),this.target.clampLength(this.minTargetRadius,this.maxTargetRadius),this.target.add(this.cursor);let s=!1;if(this.zoomToCursor&&this._performCursorZoom||this.object.isOrthographicCamera)this._spherical.radius=this._clampDistance(this._spherical.radius);else{const a=this._spherical.radius;this._spherical.radius=this._clampDistance(this._spherical.radius*this._scale),s=a!=this._spherical.radius}if(ps.setFromSpherical(this._spherical),ps.applyQuaternion(this._quatInverse),t.copy(this.target).add(ps),this.object.lookAt(this.target),this.enableDamping===!0?(this._sphericalDelta.theta*=1-this.dampingFactor,this._sphericalDelta.phi*=1-this.dampingFactor,this._panOffset.multiplyScalar(1-this.dampingFactor)):(this._sphericalDelta.set(0,0,0),this._panOffset.set(0,0,0)),this.zoomToCursor&&this._performCursorZoom){let a=null;if(this.object.isPerspectiveCamera){const l=ps.length();a=this._clampDistance(l*this._scale);const u=l-a;this.object.position.addScaledVector(this._dollyDirection,u),this.object.updateMatrixWorld(),s=!!u}else if(this.object.isOrthographicCamera){const l=new ce(this._mouse.x,this._mouse.y,0);l.unproject(this.object);const u=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),this.object.updateProjectionMatrix(),s=u!==this.object.zoom;const h=new ce(this._mouse.x,this._mouse.y,0);h.unproject(this.object),this.object.position.sub(h).add(l),this.object.updateMatrixWorld(),a=ps.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),this.zoomToCursor=!1;a!==null&&(this.screenSpacePanning?this.target.set(0,0,-1).transformDirection(this.object.matrix).multiplyScalar(a).add(this.object.position):(Fv.origin.copy(this.object.position),Fv.direction.set(0,0,-1).transformDirection(this.object.matrix),Math.abs(this.object.up.dot(Fv.direction))IS||8*(1-this._lastQuaternion.dot(this.object.quaternion))>IS||this._lastTargetPosition.distanceToSquared(this.target)>IS?(this.dispatchEvent(JN),this._lastPosition.copy(this.object.position),this._lastQuaternion.copy(this.object.quaternion),this._lastTargetPosition.copy(this.target),!0):!1}_getAutoRotationAngle(e){return e!==null?Fa/60*this.autoRotateSpeed*e:Fa/60/60*this.autoRotateSpeed}_getZoomScale(e){const t=Math.abs(e*.01);return Math.pow(.95,this.zoomSpeed*t)}_rotateLeft(e){this._sphericalDelta.theta-=e}_rotateUp(e){this._sphericalDelta.phi-=e}_panLeft(e,t){ps.setFromMatrixColumn(t,0),ps.multiplyScalar(-e),this._panOffset.add(ps)}_panUp(e,t){this.screenSpacePanning===!0?ps.setFromMatrixColumn(t,1):(ps.setFromMatrixColumn(t,0),ps.crossVectors(this.object.up,ps)),ps.multiplyScalar(e),this._panOffset.add(ps)}_pan(e,t){const n=this.domElement;if(this.object.isPerspectiveCamera){const r=this.object.position;ps.copy(r).sub(this.target);let s=ps.length();s*=Math.tan(this.object.fov/2*Math.PI/180),this._panLeft(2*e*s/n.clientHeight,this.object.matrix),this._panUp(2*t*s/n.clientHeight,this.object.matrix)}else this.object.isOrthographicCamera?(this._panLeft(e*(this.object.right-this.object.left)/this.object.zoom/n.clientWidth,this.object.matrix),this._panUp(t*(this.object.top-this.object.bottom)/this.object.zoom/n.clientHeight,this.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),this.enablePan=!1)}_dollyOut(e){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale/=e:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}_dollyIn(e){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale*=e:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}_updateZoomParameters(e,t){if(!this.zoomToCursor)return;this._performCursorZoom=!0;const n=this.domElement.getBoundingClientRect(),r=e-n.left,s=t-n.top,a=n.width,l=n.height;this._mouse.x=r/a*2-1,this._mouse.y=-(s/l)*2+1,this._dollyDirection.set(this._mouse.x,this._mouse.y,1).unproject(this.object).sub(this.object.position).normalize()}_clampDistance(e){return Math.max(this.minDistance,Math.min(this.maxDistance,e))}_handleMouseDownRotate(e){this._rotateStart.set(e.clientX,e.clientY)}_handleMouseDownDolly(e){this._updateZoomParameters(e.clientX,e.clientX),this._dollyStart.set(e.clientX,e.clientY)}_handleMouseDownPan(e){this._panStart.set(e.clientX,e.clientY)}_handleMouseMoveRotate(e){this._rotateEnd.set(e.clientX,e.clientY),this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);const t=this.domElement;this._rotateLeft(Fa*this._rotateDelta.x/t.clientHeight),this._rotateUp(Fa*this._rotateDelta.y/t.clientHeight),this._rotateStart.copy(this._rotateEnd),this.update()}_handleMouseMoveDolly(e){this._dollyEnd.set(e.clientX,e.clientY),this._dollyDelta.subVectors(this._dollyEnd,this._dollyStart),this._dollyDelta.y>0?this._dollyOut(this._getZoomScale(this._dollyDelta.y)):this._dollyDelta.y<0&&this._dollyIn(this._getZoomScale(this._dollyDelta.y)),this._dollyStart.copy(this._dollyEnd),this.update()}_handleMouseMovePan(e){this._panEnd.set(e.clientX,e.clientY),this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd),this.update()}_handleMouseWheel(e){this._updateZoomParameters(e.clientX,e.clientY),e.deltaY<0?this._dollyIn(this._getZoomScale(e.deltaY)):e.deltaY>0&&this._dollyOut(this._getZoomScale(e.deltaY)),this.update()}_handleKeyDown(e){let t=!1;switch(e.code){case this.keys.UP:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateUp(Fa*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,this.keyPanSpeed),t=!0;break;case this.keys.BOTTOM:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateUp(-Fa*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,-this.keyPanSpeed),t=!0;break;case this.keys.LEFT:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateLeft(Fa*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(this.keyPanSpeed,0),t=!0;break;case this.keys.RIGHT:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateLeft(-Fa*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(-this.keyPanSpeed,0),t=!0;break}t&&(e.preventDefault(),this.update())}_handleTouchStartRotate(e){if(this._pointers.length===1)this._rotateStart.set(e.pageX,e.pageY);else{const t=this._getSecondPointerPosition(e),n=.5*(e.pageX+t.x),r=.5*(e.pageY+t.y);this._rotateStart.set(n,r)}}_handleTouchStartPan(e){if(this._pointers.length===1)this._panStart.set(e.pageX,e.pageY);else{const t=this._getSecondPointerPosition(e),n=.5*(e.pageX+t.x),r=.5*(e.pageY+t.y);this._panStart.set(n,r)}}_handleTouchStartDolly(e){const t=this._getSecondPointerPosition(e),n=e.pageX-t.x,r=e.pageY-t.y,s=Math.sqrt(n*n+r*r);this._dollyStart.set(0,s)}_handleTouchStartDollyPan(e){this.enableZoom&&this._handleTouchStartDolly(e),this.enablePan&&this._handleTouchStartPan(e)}_handleTouchStartDollyRotate(e){this.enableZoom&&this._handleTouchStartDolly(e),this.enableRotate&&this._handleTouchStartRotate(e)}_handleTouchMoveRotate(e){if(this._pointers.length==1)this._rotateEnd.set(e.pageX,e.pageY);else{const n=this._getSecondPointerPosition(e),r=.5*(e.pageX+n.x),s=.5*(e.pageY+n.y);this._rotateEnd.set(r,s)}this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);const t=this.domElement;this._rotateLeft(Fa*this._rotateDelta.x/t.clientHeight),this._rotateUp(Fa*this._rotateDelta.y/t.clientHeight),this._rotateStart.copy(this._rotateEnd)}_handleTouchMovePan(e){if(this._pointers.length===1)this._panEnd.set(e.pageX,e.pageY);else{const t=this._getSecondPointerPosition(e),n=.5*(e.pageX+t.x),r=.5*(e.pageY+t.y);this._panEnd.set(n,r)}this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd)}_handleTouchMoveDolly(e){const t=this._getSecondPointerPosition(e),n=e.pageX-t.x,r=e.pageY-t.y,s=Math.sqrt(n*n+r*r);this._dollyEnd.set(0,s),this._dollyDelta.set(0,Math.pow(this._dollyEnd.y/this._dollyStart.y,this.zoomSpeed)),this._dollyOut(this._dollyDelta.y),this._dollyStart.copy(this._dollyEnd);const a=(e.pageX+t.x)*.5,l=(e.pageY+t.y)*.5;this._updateZoomParameters(a,l)}_handleTouchMoveDollyPan(e){this.enableZoom&&this._handleTouchMoveDolly(e),this.enablePan&&this._handleTouchMovePan(e)}_handleTouchMoveDollyRotate(e){this.enableZoom&&this._handleTouchMoveDolly(e),this.enableRotate&&this._handleTouchMoveRotate(e)}_addPointer(e){this._pointers.push(e.pointerId)}_removePointer(e){delete this._pointerPositions[e.pointerId];for(let t=0;tt7||8*(1-this._lastQuaternion.dot(t.quaternion))>t7)&&(this.dispatchEvent(Ice),this._lastQuaternion.copy(t.quaternion),this._lastPosition.copy(t.position))}_updateMovementVector(){const e=this._moveState.forward||this.autoForward&&!this._moveState.back?1:0;this._moveVector.x=-this._moveState.left+this._moveState.right,this._moveVector.y=-this._moveState.down+this._moveState.up,this._moveVector.z=-e+this._moveState.back}_updateRotationVector(){this._rotationVector.x=-this._moveState.pitchDown+this._moveState.pitchUp,this._rotationVector.y=-this._moveState.yawRight+this._moveState.yawLeft,this._rotationVector.z=-this._moveState.rollRight+this._moveState.rollLeft}_getContainerDimensions(){return this.domElement!=document?{size:[this.domElement.offsetWidth,this.domElement.offsetHeight],offset:[this.domElement.offsetLeft,this.domElement.offsetTop]}:{size:[window.innerWidth,window.innerHeight],offset:[0,0]}}}function kce(i){if(!(i.altKey||this.enabled===!1)){switch(i.code){case"ShiftLeft":case"ShiftRight":this.movementSpeedMultiplier=.1;break;case"KeyW":this._moveState.forward=1;break;case"KeyS":this._moveState.back=1;break;case"KeyA":this._moveState.left=1;break;case"KeyD":this._moveState.right=1;break;case"KeyR":this._moveState.up=1;break;case"KeyF":this._moveState.down=1;break;case"ArrowUp":this._moveState.pitchUp=1;break;case"ArrowDown":this._moveState.pitchDown=1;break;case"ArrowLeft":this._moveState.yawLeft=1;break;case"ArrowRight":this._moveState.yawRight=1;break;case"KeyQ":this._moveState.rollLeft=1;break;case"KeyE":this._moveState.rollRight=1;break}this._updateMovementVector(),this._updateRotationVector()}}function zce(i){if(this.enabled!==!1){switch(i.code){case"ShiftLeft":case"ShiftRight":this.movementSpeedMultiplier=1;break;case"KeyW":this._moveState.forward=0;break;case"KeyS":this._moveState.back=0;break;case"KeyA":this._moveState.left=0;break;case"KeyD":this._moveState.right=0;break;case"KeyR":this._moveState.up=0;break;case"KeyF":this._moveState.down=0;break;case"ArrowUp":this._moveState.pitchUp=0;break;case"ArrowDown":this._moveState.pitchDown=0;break;case"ArrowLeft":this._moveState.yawLeft=0;break;case"ArrowRight":this._moveState.yawRight=0;break;case"KeyQ":this._moveState.rollLeft=0;break;case"KeyE":this._moveState.rollRight=0;break}this._updateMovementVector(),this._updateRotationVector()}}function Gce(i){if(this.enabled!==!1)if(this.dragToLook)this._status++;else{switch(i.button){case 0:this._moveState.forward=1;break;case 2:this._moveState.back=1;break}this._updateMovementVector()}}function qce(i){if(this.enabled!==!1&&(!this.dragToLook||this._status>0)){const e=this._getContainerDimensions(),t=e.size[0]/2,n=e.size[1]/2;this._moveState.yawLeft=-(i.pageX-e.offset[0]-t)/t,this._moveState.pitchDown=(i.pageY-e.offset[1]-n)/n,this._updateRotationVector()}}function Vce(i){if(this.enabled!==!1){if(this.dragToLook)this._status--,this._moveState.yawLeft=this._moveState.pitchDown=0;else{switch(i.button){case 0:this._moveState.forward=0;break;case 2:this._moveState.back=0;break}this._updateMovementVector()}this._updateRotationVector()}}function Hce(){this.enabled!==!1&&(this.dragToLook?(this._status=0,this._moveState.yawLeft=this._moveState.pitchDown=0):(this._moveState.forward=0,this._moveState.back=0,this._updateMovementVector()),this._updateRotationVector())}function jce(i){this.enabled!==!1&&i.preventDefault()}const Wce={name:"CopyShader",uniforms:{tDiffuse:{value:null},opacity:{value:1}},vertexShader:` varying vec2 vUv; @@ -4795,7 +4795,7 @@ THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR gl_FragColor = opacity * texel; - }`};class sx{constructor(){this.isPass=!0,this.enabled=!0,this.needsSwap=!0,this.clear=!1,this.renderToScreen=!1}setSize(){}render(){console.error("THREE.Pass: .render() must be implemented in derived pass.")}dispose(){}}const $ce=new kg(-1,1,1,-1,0,1);class Xce extends Ki{constructor(){super(),this.setAttribute("position",new wi([-1,3,0,-1,-1,0,3,-1,0],3)),this.setAttribute("uv",new wi([0,2,0,0,2,0],2))}}const Yce=new Xce;class Qce{constructor(e){this._mesh=new zi(Yce,e)}dispose(){this._mesh.geometry.dispose()}render(e){e.render(this._mesh,$ce)}get material(){return this._mesh.material}set material(e){this._mesh.material=e}}class Kce extends sx{constructor(e,t){super(),this.textureID=t!==void 0?t:"tDiffuse",e instanceof Ja?(this.uniforms=e.uniforms,this.material=e):e&&(this.uniforms=vy.clone(e.uniforms),this.material=new Ja({name:e.name!==void 0?e.name:"unspecified",defines:Object.assign({},e.defines),uniforms:this.uniforms,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader})),this.fsQuad=new Qce(this.material)}render(e,t,n){this.uniforms[this.textureID]&&(this.uniforms[this.textureID].value=n.texture),this.fsQuad.material=this.material,this.renderToScreen?(e.setRenderTarget(null),this.fsQuad.render(e)):(e.setRenderTarget(t),this.clear&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),this.fsQuad.render(e))}dispose(){this.material.dispose(),this.fsQuad.dispose()}}class i7 extends sx{constructor(e,t){super(),this.scene=e,this.camera=t,this.clear=!0,this.needsSwap=!1,this.inverse=!1}render(e,t,n){const r=e.getContext(),s=e.state;s.buffers.color.setMask(!1),s.buffers.depth.setMask(!1),s.buffers.color.setLocked(!0),s.buffers.depth.setLocked(!0);let a,l;this.inverse?(a=0,l=1):(a=1,l=0),s.buffers.stencil.setTest(!0),s.buffers.stencil.setOp(r.REPLACE,r.REPLACE,r.REPLACE),s.buffers.stencil.setFunc(r.ALWAYS,a,4294967295),s.buffers.stencil.setClear(l),s.buffers.stencil.setLocked(!0),e.setRenderTarget(n),this.clear&&e.clear(),e.render(this.scene,this.camera),e.setRenderTarget(t),this.clear&&e.clear(),e.render(this.scene,this.camera),s.buffers.color.setLocked(!1),s.buffers.depth.setLocked(!1),s.buffers.color.setMask(!0),s.buffers.depth.setMask(!0),s.buffers.stencil.setLocked(!1),s.buffers.stencil.setFunc(r.EQUAL,1,4294967295),s.buffers.stencil.setOp(r.KEEP,r.KEEP,r.KEEP),s.buffers.stencil.setLocked(!0)}}class Zce extends sx{constructor(){super(),this.needsSwap=!1}render(e){e.state.buffers.stencil.setLocked(!1),e.state.buffers.stencil.setTest(!1)}}class Jce{constructor(e,t){if(this.renderer=e,this._pixelRatio=e.getPixelRatio(),t===void 0){const n=e.getSize(new At);this._width=n.width,this._height=n.height,t=new qh(this._width*this._pixelRatio,this._height*this._pixelRatio,{type:Gs}),t.texture.name="EffectComposer.rt1"}else this._width=t.width,this._height=t.height;this.renderTarget1=t,this.renderTarget2=t.clone(),this.renderTarget2.texture.name="EffectComposer.rt2",this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2,this.renderToScreen=!0,this.passes=[],this.copyPass=new Kce(Wce),this.copyPass.material.blending=Qa,this.clock=new aD}swapBuffers(){const e=this.readBuffer;this.readBuffer=this.writeBuffer,this.writeBuffer=e}addPass(e){this.passes.push(e),e.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}insertPass(e,t){this.passes.splice(t,0,e),e.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}removePass(e){const t=this.passes.indexOf(e);t!==-1&&this.passes.splice(t,1)}isLastEnabledPass(e){for(let t=e+1;t=0&&r<1?(l=s,u=a):r>=1&&r<2?(l=a,u=s):r>=2&&r<3?(u=s,h=a):r>=3&&r<4?(u=a,h=s):r>=4&&r<5?(l=a,h=s):r>=5&&r<6&&(l=s,h=a);var g=t-s/2,v=l+g,x=u+g,S=h+g;return n(v,x,S)}var r7={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"00ffff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"0000ff",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"00ffff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"ff00ff",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"639",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"};function ahe(i){if(typeof i!="string")return i;var e=i.toLowerCase();return r7[e]?"#"+r7[e]:i}var ohe=/^#[a-fA-F0-9]{6}$/,lhe=/^#[a-fA-F0-9]{8}$/,uhe=/^#[a-fA-F0-9]{3}$/,che=/^#[a-fA-F0-9]{4}$/,kS=/^rgb\(\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*\)$/i,hhe=/^rgb(?:a)?\(\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*(?:,|\/)\s*([-+]?\d*[.]?\d+[%]?)\s*\)$/i,fhe=/^hsl\(\s*(\d{0,3}[.]?[0-9]+(?:deg)?)\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*\)$/i,Ahe=/^hsl(?:a)?\(\s*(\d{0,3}[.]?[0-9]+(?:deg)?)\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*(?:,|\/)\s*([-+]?\d*[.]?\d+[%]?)\s*\)$/i;function G0(i){if(typeof i!="string")throw new ru(3);var e=ahe(i);if(e.match(ohe))return{red:parseInt(""+e[1]+e[2],16),green:parseInt(""+e[3]+e[4],16),blue:parseInt(""+e[5]+e[6],16)};if(e.match(lhe)){var t=parseFloat((parseInt(""+e[7]+e[8],16)/255).toFixed(2));return{red:parseInt(""+e[1]+e[2],16),green:parseInt(""+e[3]+e[4],16),blue:parseInt(""+e[5]+e[6],16),alpha:t}}if(e.match(uhe))return{red:parseInt(""+e[1]+e[1],16),green:parseInt(""+e[2]+e[2],16),blue:parseInt(""+e[3]+e[3],16)};if(e.match(che)){var n=parseFloat((parseInt(""+e[4]+e[4],16)/255).toFixed(2));return{red:parseInt(""+e[1]+e[1],16),green:parseInt(""+e[2]+e[2],16),blue:parseInt(""+e[3]+e[3],16),alpha:n}}var r=kS.exec(e);if(r)return{red:parseInt(""+r[1],10),green:parseInt(""+r[2],10),blue:parseInt(""+r[3],10)};var s=hhe.exec(e.substring(0,50));if(s)return{red:parseInt(""+s[1],10),green:parseInt(""+s[2],10),blue:parseInt(""+s[3],10),alpha:parseFloat(""+s[4])>1?parseFloat(""+s[4])/100:parseFloat(""+s[4])};var a=fhe.exec(e);if(a){var l=parseInt(""+a[1],10),u=parseInt(""+a[2],10)/100,h=parseInt(""+a[3],10)/100,g="rgb("+oy(l,u,h)+")",v=kS.exec(g);if(!v)throw new ru(4,e,g);return{red:parseInt(""+v[1],10),green:parseInt(""+v[2],10),blue:parseInt(""+v[3],10)}}var x=Ahe.exec(e.substring(0,50));if(x){var S=parseInt(""+x[1],10),w=parseInt(""+x[2],10)/100,R=parseInt(""+x[3],10)/100,C="rgb("+oy(S,w,R)+")",E=kS.exec(C);if(!E)throw new ru(4,e,C);return{red:parseInt(""+E[1],10),green:parseInt(""+E[2],10),blue:parseInt(""+E[3],10),alpha:parseFloat(""+x[4])>1?parseFloat(""+x[4])/100:parseFloat(""+x[4])}}throw new ru(5)}function dhe(i){var e=i.red/255,t=i.green/255,n=i.blue/255,r=Math.max(e,t,n),s=Math.min(e,t,n),a=(r+s)/2;if(r===s)return i.alpha!==void 0?{hue:0,saturation:0,lightness:a,alpha:i.alpha}:{hue:0,saturation:0,lightness:a};var l,u=r-s,h=a>.5?u/(2-r-s):u/(r+s);switch(r){case e:l=(t-n)/u+(t=1?UO(i.hue,i.saturation,i.lightness):"rgba("+oy(i.hue,i.saturation,i.lightness)+","+i.alpha+")";throw new ru(2)}function BO(i,e,t){if(typeof i=="number"&&typeof e=="number"&&typeof t=="number")return cw("#"+Ff(i)+Ff(e)+Ff(t));if(typeof i=="object"&&e===void 0&&t===void 0)return cw("#"+Ff(i.red)+Ff(i.green)+Ff(i.blue));throw new ru(6)}function ax(i,e,t,n){if(typeof i=="object"&&e===void 0&&t===void 0&&n===void 0)return i.alpha>=1?BO(i.red,i.green,i.blue):"rgba("+i.red+","+i.green+","+i.blue+","+i.alpha+")";throw new ru(7)}var _he=function(e){return typeof e.red=="number"&&typeof e.green=="number"&&typeof e.blue=="number"&&(typeof e.alpha!="number"||typeof e.alpha>"u")},yhe=function(e){return typeof e.red=="number"&&typeof e.green=="number"&&typeof e.blue=="number"&&typeof e.alpha=="number"},xhe=function(e){return typeof e.hue=="number"&&typeof e.saturation=="number"&&typeof e.lightness=="number"&&(typeof e.alpha!="number"||typeof e.alpha>"u")},bhe=function(e){return typeof e.hue=="number"&&typeof e.saturation=="number"&&typeof e.lightness=="number"&&typeof e.alpha=="number"};function Kh(i){if(typeof i!="object")throw new ru(8);if(yhe(i))return ax(i);if(_he(i))return BO(i);if(bhe(i))return vhe(i);if(xhe(i))return ghe(i);throw new ru(8)}function OO(i,e,t){return function(){var r=t.concat(Array.prototype.slice.call(arguments));return r.length>=e?i.apply(this,r):OO(i,e,r)}}function Do(i){return OO(i,i.length,[])}function She(i,e){if(e==="transparent")return e;var t=Qh(e);return Kh(io({},t,{hue:t.hue+parseFloat(i)}))}Do(She);function J0(i,e,t){return Math.max(i,Math.min(e,t))}function The(i,e){if(e==="transparent")return e;var t=Qh(e);return Kh(io({},t,{lightness:J0(0,1,t.lightness-parseFloat(i))}))}Do(The);function whe(i,e){if(e==="transparent")return e;var t=Qh(e);return Kh(io({},t,{saturation:J0(0,1,t.saturation-parseFloat(i))}))}Do(whe);function Mhe(i,e){if(e==="transparent")return e;var t=Qh(e);return Kh(io({},t,{lightness:J0(0,1,t.lightness+parseFloat(i))}))}Do(Mhe);function Ehe(i,e,t){if(e==="transparent")return t;if(t==="transparent")return e;if(i===0)return t;var n=G0(e),r=io({},n,{alpha:typeof n.alpha=="number"?n.alpha:1}),s=G0(t),a=io({},s,{alpha:typeof s.alpha=="number"?s.alpha:1}),l=r.alpha-a.alpha,u=parseFloat(i)*2-1,h=u*l===-1?u:u+l,g=1+u*l,v=(h/g+1)/2,x=1-v,S={red:Math.floor(r.red*v+a.red*x),green:Math.floor(r.green*v+a.green*x),blue:Math.floor(r.blue*v+a.blue*x),alpha:r.alpha*parseFloat(i)+a.alpha*(1-parseFloat(i))};return ax(S)}var Che=Do(Ehe),IO=Che;function Rhe(i,e){if(e==="transparent")return e;var t=G0(e),n=typeof t.alpha=="number"?t.alpha:1,r=io({},t,{alpha:J0(0,1,(n*100+parseFloat(i)*100)/100)});return ax(r)}var Nhe=Do(Rhe),Dhe=Nhe;function Phe(i,e){if(e==="transparent")return e;var t=Qh(e);return Kh(io({},t,{saturation:J0(0,1,t.saturation+parseFloat(i))}))}Do(Phe);function Lhe(i,e){return e==="transparent"?e:Kh(io({},Qh(e),{hue:parseFloat(i)}))}Do(Lhe);function Uhe(i,e){return e==="transparent"?e:Kh(io({},Qh(e),{lightness:parseFloat(i)}))}Do(Uhe);function Bhe(i,e){return e==="transparent"?e:Kh(io({},Qh(e),{saturation:parseFloat(i)}))}Do(Bhe);function Ohe(i,e){return e==="transparent"?e:IO(parseFloat(i),"rgb(0, 0, 0)",e)}Do(Ohe);function Ihe(i,e){return e==="transparent"?e:IO(parseFloat(i),"rgb(255, 255, 255)",e)}Do(Ihe);function Fhe(i,e){if(e==="transparent")return e;var t=G0(e),n=typeof t.alpha=="number"?t.alpha:1,r=io({},t,{alpha:J0(0,1,+(n*100-parseFloat(i)*100).toFixed(2)/100)});return ax(r)}Do(Fhe);var hw="http://www.w3.org/1999/xhtml";const s7={svg:"http://www.w3.org/2000/svg",xhtml:hw,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function FO(i){var e=i+="",t=e.indexOf(":");return t>=0&&(e=i.slice(0,t))!=="xmlns"&&(i=i.slice(t+1)),s7.hasOwnProperty(e)?{space:s7[e],local:i}:i}function khe(i){return function(){var e=this.ownerDocument,t=this.namespaceURI;return t===hw&&e.documentElement.namespaceURI===hw?e.createElement(i):e.createElementNS(t,i)}}function zhe(i){return function(){return this.ownerDocument.createElementNS(i.space,i.local)}}function kO(i){var e=FO(i);return(e.local?zhe:khe)(e)}function Ghe(){}function zO(i){return i==null?Ghe:function(){return this.querySelector(i)}}function qhe(i){typeof i!="function"&&(i=zO(i));for(var e=this._groups,t=e.length,n=new Array(t),r=0;r=L&&(L=B+1);!(z=C[L])&&++L=0;)(a=n[r])&&(s&&a.compareDocumentPosition(s)^4&&s.parentNode.insertBefore(a,s),s=a);return this}function pfe(i){i||(i=mfe);function e(v,x){return v&&x?i(v.__data__,x.__data__):!v-!x}for(var t=this._groups,n=t.length,r=new Array(n),s=0;se?1:i>=e?0:NaN}function gfe(){var i=arguments[0];return arguments[0]=this,i.apply(null,arguments),this}function vfe(){return Array.from(this)}function _fe(){for(var i=this._groups,e=0,t=i.length;e1?this.each((e==null?Nfe:typeof e=="function"?Pfe:Dfe)(i,e,t??"")):Ufe(this.node(),i)}function Ufe(i,e){return i.style.getPropertyValue(e)||VO(i).getComputedStyle(i,null).getPropertyValue(e)}function Bfe(i){return function(){delete this[i]}}function Ofe(i,e){return function(){this[i]=e}}function Ife(i,e){return function(){var t=e.apply(this,arguments);t==null?delete this[i]:this[i]=t}}function Ffe(i,e){return arguments.length>1?this.each((e==null?Bfe:typeof e=="function"?Ife:Ofe)(i,e)):this.node()[i]}function HO(i){return i.trim().split(/^|\s+/)}function YE(i){return i.classList||new jO(i)}function jO(i){this._node=i,this._names=HO(i.getAttribute("class")||"")}jO.prototype={add:function(i){var e=this._names.indexOf(i);e<0&&(this._names.push(i),this._node.setAttribute("class",this._names.join(" ")))},remove:function(i){var e=this._names.indexOf(i);e>=0&&(this._names.splice(e,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(i){return this._names.indexOf(i)>=0}};function WO(i,e){for(var t=YE(i),n=-1,r=e.length;++n=0&&(t=e.slice(n+1),e=e.slice(0,n)),{type:e,name:t}})}function fAe(i){return function(){var e=this.__on;if(e){for(var t=0,n=-1,r=e.length,s;t2&&(a.children=arguments.length>3?i1.call(arguments,2):t),typeof i=="function"&&i.defaultProps!=null)for(s in i.defaultProps)a[s]===void 0&&(a[s]=i.defaultProps[s]);return Gm(i,a,n,r,null)}function Gm(i,e,t,n,r){var s={type:i,props:e,key:t,ref:n,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:r??++YO,__i:-1,__u:0};return r==null&&Tr.vnode!=null&&Tr.vnode(s),s}function lx(i){return i.children}function r_(i,e){this.props=i,this.context=e}function q0(i,e){if(e==null)return i.__?q0(i.__,i.__i+1):null;for(var t;ee&&Hf.sort(ZO),i=Hf.shift(),e=Hf.length,MAe(i);hy.__r=0}function tI(i,e,t,n,r,s,a,l,u,h,g){var v,x,S,w,R,C,E,B=n&&n.__k||cy,L=e.length;for(u=EAe(t,e,B,u,L),v=0;v0?a=i.__k[s]=Gm(a.type,a.props,a.key,a.ref?a.ref:null,a.__v):i.__k[s]=a,u=s+x,a.__=i,a.__b=i.__b+1,l=null,(h=a.__i=CAe(a,t,u,v))!=-1&&(v--,(l=t[h])&&(l.__u|=2)),l==null||l.__v==null?(h==-1&&(r>g?x--:ru?x--:x++,a.__u|=4))):i.__k[s]=null;if(v)for(s=0;s(g?1:0)){for(r=t-1,s=t+1;r>=0||s=0?r--:s++])!=null&&(2&h.__u)==0&&l==h.key&&u==h.type)return a}return-1}function l7(i,e,t){e[0]=="-"?i.setProperty(e,t??""):i[e]=t==null?"":typeof t!="number"||TAe.test(e)?t:t+"px"}function kv(i,e,t,n,r){var s,a;e:if(e=="style")if(typeof t=="string")i.style.cssText=t;else{if(typeof n=="string"&&(i.style.cssText=n=""),n)for(e in n)t&&e in t||l7(i.style,e,"");if(t)for(e in t)n&&t[e]==n[e]||l7(i.style,e,t[e])}else if(e[0]=="o"&&e[1]=="n")s=e!=(e=e.replace(JO,"$1")),a=e.toLowerCase(),e=a in i||e=="onFocusOut"||e=="onFocusIn"?a.slice(2):e.slice(2),i.l||(i.l={}),i.l[e+s]=t,t?n?t.u=n.u:(t.u=QE,i.addEventListener(e,s?Aw:fw,s)):i.removeEventListener(e,s?Aw:fw,s);else{if(r=="http://www.w3.org/2000/svg")e=e.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(e!="width"&&e!="height"&&e!="href"&&e!="list"&&e!="form"&&e!="tabIndex"&&e!="download"&&e!="rowSpan"&&e!="colSpan"&&e!="role"&&e!="popover"&&e in i)try{i[e]=t??"";break e}catch{}typeof t=="function"||(t==null||t===!1&&e[4]!="-"?i.removeAttribute(e):i.setAttribute(e,e=="popover"&&t==1?"":t))}}function u7(i){return function(e){if(this.l){var t=this.l[e.type+i];if(e.t==null)e.t=QE++;else if(e.t0?i:ox(i)?i.map(rI):su({},i)}function RAe(i,e,t,n,r,s,a,l,u){var h,g,v,x,S,w,R,C=t.props||uy,E=e.props,B=e.type;if(B=="svg"?r="http://www.w3.org/2000/svg":B=="math"?r="http://www.w3.org/1998/Math/MathML":r||(r="http://www.w3.org/1999/xhtml"),s!=null){for(h=0;h2&&(l.children=arguments.length>3?i1.call(arguments,2):t),Gm(i.type,l,n||i.key,r||i.ref,null)}i1=cy.slice,Tr={__e:function(i,e,t,n){for(var r,s,a;e=e.__;)if((r=e.__c)&&!r.__)try{if((s=r.constructor)&&s.getDerivedStateFromError!=null&&(r.setState(s.getDerivedStateFromError(i)),a=r.__d),r.componentDidCatch!=null&&(r.componentDidCatch(i,n||{}),a=r.__d),a)return r.__E=r}catch(l){i=l}throw i}},YO=0,QO=function(i){return i!=null&&i.constructor===void 0},r_.prototype.setState=function(i,e){var t;t=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=su({},this.state),typeof i=="function"&&(i=i(su({},t),this.props)),i&&su(t,i),i!=null&&this.__v&&(e&&this._sb.push(e),o7(this))},r_.prototype.forceUpdate=function(i){this.__v&&(this.__e=!0,i&&this.__h.push(i),o7(this))},r_.prototype.render=lx,Hf=[],KO=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,ZO=function(i,e){return i.__v.__b-e.__v.__b},hy.__r=0,JO=/(PointerCapture)$|Capture$/i,QE=0,fw=u7(!1),Aw=u7(!0);function c7(i,e){(e==null||e>i.length)&&(e=i.length);for(var t=0,n=Array(e);t=0&&r<1?(l=s,u=a):r>=1&&r<2?(l=a,u=s):r>=2&&r<3?(u=s,h=a):r>=3&&r<4?(u=a,h=s):r>=4&&r<5?(l=a,h=s):r>=5&&r<6&&(l=s,h=a);var g=t-s/2,v=l+g,x=u+g,S=h+g;return n(v,x,S)}var r7={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"00ffff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"0000ff",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"00ffff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"ff00ff",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"639",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"};function ahe(i){if(typeof i!="string")return i;var e=i.toLowerCase();return r7[e]?"#"+r7[e]:i}var ohe=/^#[a-fA-F0-9]{6}$/,lhe=/^#[a-fA-F0-9]{8}$/,uhe=/^#[a-fA-F0-9]{3}$/,che=/^#[a-fA-F0-9]{4}$/,kS=/^rgb\(\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*\)$/i,hhe=/^rgb(?:a)?\(\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*(?:,|\/)\s*([-+]?\d*[.]?\d+[%]?)\s*\)$/i,fhe=/^hsl\(\s*(\d{0,3}[.]?[0-9]+(?:deg)?)\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*\)$/i,Ahe=/^hsl(?:a)?\(\s*(\d{0,3}[.]?[0-9]+(?:deg)?)\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*(?:,|\/)\s*([-+]?\d*[.]?\d+[%]?)\s*\)$/i;function G0(i){if(typeof i!="string")throw new ru(3);var e=ahe(i);if(e.match(ohe))return{red:parseInt(""+e[1]+e[2],16),green:parseInt(""+e[3]+e[4],16),blue:parseInt(""+e[5]+e[6],16)};if(e.match(lhe)){var t=parseFloat((parseInt(""+e[7]+e[8],16)/255).toFixed(2));return{red:parseInt(""+e[1]+e[2],16),green:parseInt(""+e[3]+e[4],16),blue:parseInt(""+e[5]+e[6],16),alpha:t}}if(e.match(uhe))return{red:parseInt(""+e[1]+e[1],16),green:parseInt(""+e[2]+e[2],16),blue:parseInt(""+e[3]+e[3],16)};if(e.match(che)){var n=parseFloat((parseInt(""+e[4]+e[4],16)/255).toFixed(2));return{red:parseInt(""+e[1]+e[1],16),green:parseInt(""+e[2]+e[2],16),blue:parseInt(""+e[3]+e[3],16),alpha:n}}var r=kS.exec(e);if(r)return{red:parseInt(""+r[1],10),green:parseInt(""+r[2],10),blue:parseInt(""+r[3],10)};var s=hhe.exec(e.substring(0,50));if(s)return{red:parseInt(""+s[1],10),green:parseInt(""+s[2],10),blue:parseInt(""+s[3],10),alpha:parseFloat(""+s[4])>1?parseFloat(""+s[4])/100:parseFloat(""+s[4])};var a=fhe.exec(e);if(a){var l=parseInt(""+a[1],10),u=parseInt(""+a[2],10)/100,h=parseInt(""+a[3],10)/100,g="rgb("+oy(l,u,h)+")",v=kS.exec(g);if(!v)throw new ru(4,e,g);return{red:parseInt(""+v[1],10),green:parseInt(""+v[2],10),blue:parseInt(""+v[3],10)}}var x=Ahe.exec(e.substring(0,50));if(x){var S=parseInt(""+x[1],10),w=parseInt(""+x[2],10)/100,R=parseInt(""+x[3],10)/100,C="rgb("+oy(S,w,R)+")",E=kS.exec(C);if(!E)throw new ru(4,e,C);return{red:parseInt(""+E[1],10),green:parseInt(""+E[2],10),blue:parseInt(""+E[3],10),alpha:parseFloat(""+x[4])>1?parseFloat(""+x[4])/100:parseFloat(""+x[4])}}throw new ru(5)}function dhe(i){var e=i.red/255,t=i.green/255,n=i.blue/255,r=Math.max(e,t,n),s=Math.min(e,t,n),a=(r+s)/2;if(r===s)return i.alpha!==void 0?{hue:0,saturation:0,lightness:a,alpha:i.alpha}:{hue:0,saturation:0,lightness:a};var l,u=r-s,h=a>.5?u/(2-r-s):u/(r+s);switch(r){case e:l=(t-n)/u+(t=1?UO(i.hue,i.saturation,i.lightness):"rgba("+oy(i.hue,i.saturation,i.lightness)+","+i.alpha+")";throw new ru(2)}function BO(i,e,t){if(typeof i=="number"&&typeof e=="number"&&typeof t=="number")return cw("#"+Ff(i)+Ff(e)+Ff(t));if(typeof i=="object"&&e===void 0&&t===void 0)return cw("#"+Ff(i.red)+Ff(i.green)+Ff(i.blue));throw new ru(6)}function ax(i,e,t,n){if(typeof i=="object"&&e===void 0&&t===void 0&&n===void 0)return i.alpha>=1?BO(i.red,i.green,i.blue):"rgba("+i.red+","+i.green+","+i.blue+","+i.alpha+")";throw new ru(7)}var _he=function(e){return typeof e.red=="number"&&typeof e.green=="number"&&typeof e.blue=="number"&&(typeof e.alpha!="number"||typeof e.alpha>"u")},yhe=function(e){return typeof e.red=="number"&&typeof e.green=="number"&&typeof e.blue=="number"&&typeof e.alpha=="number"},xhe=function(e){return typeof e.hue=="number"&&typeof e.saturation=="number"&&typeof e.lightness=="number"&&(typeof e.alpha!="number"||typeof e.alpha>"u")},bhe=function(e){return typeof e.hue=="number"&&typeof e.saturation=="number"&&typeof e.lightness=="number"&&typeof e.alpha=="number"};function Kh(i){if(typeof i!="object")throw new ru(8);if(yhe(i))return ax(i);if(_he(i))return BO(i);if(bhe(i))return vhe(i);if(xhe(i))return ghe(i);throw new ru(8)}function OO(i,e,t){return function(){var r=t.concat(Array.prototype.slice.call(arguments));return r.length>=e?i.apply(this,r):OO(i,e,r)}}function Do(i){return OO(i,i.length,[])}function She(i,e){if(e==="transparent")return e;var t=Qh(e);return Kh(io({},t,{hue:t.hue+parseFloat(i)}))}Do(She);function J0(i,e,t){return Math.max(i,Math.min(e,t))}function The(i,e){if(e==="transparent")return e;var t=Qh(e);return Kh(io({},t,{lightness:J0(0,1,t.lightness-parseFloat(i))}))}Do(The);function whe(i,e){if(e==="transparent")return e;var t=Qh(e);return Kh(io({},t,{saturation:J0(0,1,t.saturation-parseFloat(i))}))}Do(whe);function Mhe(i,e){if(e==="transparent")return e;var t=Qh(e);return Kh(io({},t,{lightness:J0(0,1,t.lightness+parseFloat(i))}))}Do(Mhe);function Ehe(i,e,t){if(e==="transparent")return t;if(t==="transparent")return e;if(i===0)return t;var n=G0(e),r=io({},n,{alpha:typeof n.alpha=="number"?n.alpha:1}),s=G0(t),a=io({},s,{alpha:typeof s.alpha=="number"?s.alpha:1}),l=r.alpha-a.alpha,u=parseFloat(i)*2-1,h=u*l===-1?u:u+l,g=1+u*l,v=(h/g+1)/2,x=1-v,S={red:Math.floor(r.red*v+a.red*x),green:Math.floor(r.green*v+a.green*x),blue:Math.floor(r.blue*v+a.blue*x),alpha:r.alpha*parseFloat(i)+a.alpha*(1-parseFloat(i))};return ax(S)}var Che=Do(Ehe),IO=Che;function Rhe(i,e){if(e==="transparent")return e;var t=G0(e),n=typeof t.alpha=="number"?t.alpha:1,r=io({},t,{alpha:J0(0,1,(n*100+parseFloat(i)*100)/100)});return ax(r)}var Nhe=Do(Rhe),Dhe=Nhe;function Phe(i,e){if(e==="transparent")return e;var t=Qh(e);return Kh(io({},t,{saturation:J0(0,1,t.saturation+parseFloat(i))}))}Do(Phe);function Lhe(i,e){return e==="transparent"?e:Kh(io({},Qh(e),{hue:parseFloat(i)}))}Do(Lhe);function Uhe(i,e){return e==="transparent"?e:Kh(io({},Qh(e),{lightness:parseFloat(i)}))}Do(Uhe);function Bhe(i,e){return e==="transparent"?e:Kh(io({},Qh(e),{saturation:parseFloat(i)}))}Do(Bhe);function Ohe(i,e){return e==="transparent"?e:IO(parseFloat(i),"rgb(0, 0, 0)",e)}Do(Ohe);function Ihe(i,e){return e==="transparent"?e:IO(parseFloat(i),"rgb(255, 255, 255)",e)}Do(Ihe);function Fhe(i,e){if(e==="transparent")return e;var t=G0(e),n=typeof t.alpha=="number"?t.alpha:1,r=io({},t,{alpha:J0(0,1,+(n*100-parseFloat(i)*100).toFixed(2)/100)});return ax(r)}Do(Fhe);var hw="http://www.w3.org/1999/xhtml";const s7={svg:"http://www.w3.org/2000/svg",xhtml:hw,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function FO(i){var e=i+="",t=e.indexOf(":");return t>=0&&(e=i.slice(0,t))!=="xmlns"&&(i=i.slice(t+1)),s7.hasOwnProperty(e)?{space:s7[e],local:i}:i}function khe(i){return function(){var e=this.ownerDocument,t=this.namespaceURI;return t===hw&&e.documentElement.namespaceURI===hw?e.createElement(i):e.createElementNS(t,i)}}function zhe(i){return function(){return this.ownerDocument.createElementNS(i.space,i.local)}}function kO(i){var e=FO(i);return(e.local?zhe:khe)(e)}function Ghe(){}function zO(i){return i==null?Ghe:function(){return this.querySelector(i)}}function qhe(i){typeof i!="function"&&(i=zO(i));for(var e=this._groups,t=e.length,n=new Array(t),r=0;r=L&&(L=B+1);!(z=C[L])&&++L=0;)(a=n[r])&&(s&&a.compareDocumentPosition(s)^4&&s.parentNode.insertBefore(a,s),s=a);return this}function pfe(i){i||(i=mfe);function e(v,x){return v&&x?i(v.__data__,x.__data__):!v-!x}for(var t=this._groups,n=t.length,r=new Array(n),s=0;se?1:i>=e?0:NaN}function gfe(){var i=arguments[0];return arguments[0]=this,i.apply(null,arguments),this}function vfe(){return Array.from(this)}function _fe(){for(var i=this._groups,e=0,t=i.length;e1?this.each((e==null?Nfe:typeof e=="function"?Pfe:Dfe)(i,e,t??"")):Ufe(this.node(),i)}function Ufe(i,e){return i.style.getPropertyValue(e)||VO(i).getComputedStyle(i,null).getPropertyValue(e)}function Bfe(i){return function(){delete this[i]}}function Ofe(i,e){return function(){this[i]=e}}function Ife(i,e){return function(){var t=e.apply(this,arguments);t==null?delete this[i]:this[i]=t}}function Ffe(i,e){return arguments.length>1?this.each((e==null?Bfe:typeof e=="function"?Ife:Ofe)(i,e)):this.node()[i]}function HO(i){return i.trim().split(/^|\s+/)}function YE(i){return i.classList||new jO(i)}function jO(i){this._node=i,this._names=HO(i.getAttribute("class")||"")}jO.prototype={add:function(i){var e=this._names.indexOf(i);e<0&&(this._names.push(i),this._node.setAttribute("class",this._names.join(" ")))},remove:function(i){var e=this._names.indexOf(i);e>=0&&(this._names.splice(e,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(i){return this._names.indexOf(i)>=0}};function WO(i,e){for(var t=YE(i),n=-1,r=e.length;++n=0&&(t=e.slice(n+1),e=e.slice(0,n)),{type:e,name:t}})}function fAe(i){return function(){var e=this.__on;if(e){for(var t=0,n=-1,r=e.length,s;t2&&(a.children=arguments.length>3?i1.call(arguments,2):t),typeof i=="function"&&i.defaultProps!=null)for(s in i.defaultProps)a[s]===void 0&&(a[s]=i.defaultProps[s]);return Gm(i,a,n,r,null)}function Gm(i,e,t,n,r){var s={type:i,props:e,key:t,ref:n,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:r??++YO,__i:-1,__u:0};return r==null&&Tr.vnode!=null&&Tr.vnode(s),s}function lx(i){return i.children}function r_(i,e){this.props=i,this.context=e}function q0(i,e){if(e==null)return i.__?q0(i.__,i.__i+1):null;for(var t;ee&&Hf.sort(ZO),i=Hf.shift(),e=Hf.length,MAe(i);hy.__r=0}function tI(i,e,t,n,r,s,a,l,u,h,g){var v,x,S,w,R,C,E,B=n&&n.__k||cy,L=e.length;for(u=EAe(t,e,B,u,L),v=0;v0?a=i.__k[s]=Gm(a.type,a.props,a.key,a.ref?a.ref:null,a.__v):i.__k[s]=a,u=s+x,a.__=i,a.__b=i.__b+1,l=null,(h=a.__i=CAe(a,t,u,v))!=-1&&(v--,(l=t[h])&&(l.__u|=2)),l==null||l.__v==null?(h==-1&&(r>g?x--:ru?x--:x++,a.__u|=4))):i.__k[s]=null;if(v)for(s=0;s(g?1:0)){for(r=t-1,s=t+1;r>=0||s=0?r--:s++])!=null&&(2&h.__u)==0&&l==h.key&&u==h.type)return a}return-1}function l7(i,e,t){e[0]=="-"?i.setProperty(e,t??""):i[e]=t==null?"":typeof t!="number"||TAe.test(e)?t:t+"px"}function kv(i,e,t,n,r){var s,a;e:if(e=="style")if(typeof t=="string")i.style.cssText=t;else{if(typeof n=="string"&&(i.style.cssText=n=""),n)for(e in n)t&&e in t||l7(i.style,e,"");if(t)for(e in t)n&&t[e]==n[e]||l7(i.style,e,t[e])}else if(e[0]=="o"&&e[1]=="n")s=e!=(e=e.replace(JO,"$1")),a=e.toLowerCase(),e=a in i||e=="onFocusOut"||e=="onFocusIn"?a.slice(2):e.slice(2),i.l||(i.l={}),i.l[e+s]=t,t?n?t.u=n.u:(t.u=QE,i.addEventListener(e,s?Aw:fw,s)):i.removeEventListener(e,s?Aw:fw,s);else{if(r=="http://www.w3.org/2000/svg")e=e.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(e!="width"&&e!="height"&&e!="href"&&e!="list"&&e!="form"&&e!="tabIndex"&&e!="download"&&e!="rowSpan"&&e!="colSpan"&&e!="role"&&e!="popover"&&e in i)try{i[e]=t??"";break e}catch{}typeof t=="function"||(t==null||t===!1&&e[4]!="-"?i.removeAttribute(e):i.setAttribute(e,e=="popover"&&t==1?"":t))}}function u7(i){return function(e){if(this.l){var t=this.l[e.type+i];if(e.t==null)e.t=QE++;else if(e.t0?i:ox(i)?i.map(rI):su({},i)}function RAe(i,e,t,n,r,s,a,l,u){var h,g,v,x,S,w,R,C=t.props||uy,E=e.props,B=e.type;if(B=="svg"?r="http://www.w3.org/2000/svg":B=="math"?r="http://www.w3.org/1998/Math/MathML":r||(r="http://www.w3.org/1999/xhtml"),s!=null){for(h=0;h2&&(l.children=arguments.length>3?i1.call(arguments,2):t),Gm(i.type,l,n||i.key,r||i.ref,null)}i1=cy.slice,Tr={__e:function(i,e,t,n){for(var r,s,a;e=e.__;)if((r=e.__c)&&!r.__)try{if((s=r.constructor)&&s.getDerivedStateFromError!=null&&(r.setState(s.getDerivedStateFromError(i)),a=r.__d),r.componentDidCatch!=null&&(r.componentDidCatch(i,n||{}),a=r.__d),a)return r.__E=r}catch(l){i=l}throw i}},YO=0,QO=function(i){return i!=null&&i.constructor===void 0},r_.prototype.setState=function(i,e){var t;t=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=su({},this.state),typeof i=="function"&&(i=i(su({},t),this.props)),i&&su(t,i),i!=null&&this.__v&&(e&&this._sb.push(e),o7(this))},r_.prototype.forceUpdate=function(i){this.__v&&(this.__e=!0,i&&this.__h.push(i),o7(this))},r_.prototype.render=lx,Hf=[],KO=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,ZO=function(i,e){return i.__v.__b-e.__v.__b},hy.__r=0,JO=/(PointerCapture)$|Capture$/i,QE=0,fw=u7(!1),Aw=u7(!0);function c7(i,e){(e==null||e>i.length)&&(e=i.length);for(var t=0,n=Array(e);t"u")){var n=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css",t==="top"&&n.firstChild?n.insertBefore(r,n.firstChild):n.appendChild(r),r.styleSheet?r.styleSheet.cssText=i:r.appendChild(document.createTextNode(i))}}var HAe=`.float-tooltip-kap { position: absolute; width: max-content; /* prevent shrinking near right edge */ @@ -4824,7 +4824,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho outline: none; }`;WAe($Ae);function mw(i,e){(e==null||e>i.length)&&(e=i.length);for(var t=0,n=Array(e);t=e.pointerRaycasterThrottleMs){e.lastRaycasterCheck=t;var n=null;if(e.hoverDuringDrag||!e.isPointerDragging){var r=this.intersectingObjects(e.pointerPos.x,e.pointerPos.y);e.hoverOrderComparator&&r.sort(function(a,l){return e.hoverOrderComparator(a.object,l.object)});var s=r.find(function(a){return e.hoverFilter(a.object)})||null;n=s?s.object:null,e.intersection=s||null}n!==e.hoverObj&&(e.onHover(n,e.hoverObj,e.intersection),e.tooltip.content(n&&Ct(e.tooltipContent)(n,e.intersection)||null),e.hoverObj=n)}e.tweenGroup.update()}return this},getPointerPos:function(e){var t=e.pointerPos,n=t.x,r=t.y;return{x:n,y:r}},cameraPosition:function(e,t,n,r){var s=e.camera;if(t&&e.initialised){var a=t,l=n||{x:0,y:0,z:0};if(!r)g(a),v(l);else{var u=Object.assign({},s.position),h=x();e.tweenGroup.add(new ca(u).to(a,r).easing(os.Quadratic.Out).onUpdate(g).start()),e.tweenGroup.add(new ca(h).to(l,r/3).easing(os.Quadratic.Out).onUpdate(v).start())}return this}return Object.assign({},s.position,{lookAt:x()});function g(S){var w=S.x,R=S.y,C=S.z;w!==void 0&&(s.position.x=w),R!==void 0&&(s.position.y=R),C!==void 0&&(s.position.z=C)}function v(S){var w=new br.Vector3(S.x,S.y,S.z);e.controls.enabled&&e.controls.target?e.controls.target=w:s.lookAt(w)}function x(){return Object.assign(new br.Vector3(0,0,-1e3).applyQuaternion(s.quaternion).add(s.position))}},zoomToFit:function(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:10,r=arguments.length,s=new Array(r>3?r-3:0),a=3;a2&&arguments[2]!==void 0?arguments[2]:0,r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:10,s=e.camera;if(t){var a=new br.Vector3(0,0,0),l=Math.max.apply(Math,Lf(Object.entries(t).map(function(S){var w=tde(S,2),R=w[0],C=w[1];return Math.max.apply(Math,Lf(C.map(function(E){return Math.abs(a[R]-E)})))})))*2,u=(1-r*2/e.height)*s.fov,h=l/Math.atan(u*Math.PI/180),g=h/s.aspect,v=Math.max(h,g);if(v>0){var x=a.clone().sub(s.position).normalize().multiplyScalar(-v);this.cameraPosition(x,a,n)}}return this},getBbox:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:function(){return!0},n=new br.Box3(new br.Vector3(0,0,0),new br.Vector3(0,0,0)),r=e.objects.filter(t);return r.length?(r.forEach(function(s){return n.expandByObject(s)}),Object.assign.apply(Object,Lf(["x","y","z"].map(function(s){return QAe({},s,[n.min[s],n.max[s]])})))):null},getScreenCoords:function(e,t,n,r){var s=new br.Vector3(t,n,r);return s.project(this.camera()),{x:(s.x+1)*e.width/2,y:-(s.y-1)*e.height/2}},getSceneCoords:function(e,t,n){var r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,s=new br.Vector2(t/e.width*2-1,-(n/e.height)*2+1),a=new br.Raycaster;return a.setFromCamera(s,e.camera),Object.assign({},a.ray.at(r,new br.Vector3))},intersectingObjects:function(e,t,n){var r=new br.Vector2(t/e.width*2-1,-(n/e.height)*2+1),s=new br.Raycaster;return s.params.Line.threshold=e.lineHoverPrecision,s.params.Points.threshold=e.pointsHoverPrecision,s.setFromCamera(r,e.camera),s.intersectObjects(e.objects,!0)},renderer:function(e){return e.renderer},scene:function(e){return e.scene},camera:function(e){return e.camera},postProcessingComposer:function(e){return e.postProcessingComposer},controls:function(e){return e.controls},tbControls:function(e){return e.controls}},stateInit:function(){return{scene:new br.Scene,camera:new br.PerspectiveCamera,clock:new br.Clock,tweenGroup:new My,lastRaycasterCheck:0}},init:function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},r=n.controlType,s=r===void 0?"trackball":r,a=n.useWebGPU,l=a===void 0?!1:a,u=n.rendererConfig,h=u===void 0?{}:u,g=n.extraRenderers,v=g===void 0?[]:g,x=n.waitForLoadComplete,S=x===void 0?!0:x;e.innerHTML="",e.appendChild(t.container=document.createElement("div")),t.container.className="scene-container",t.container.style.position="relative",t.container.appendChild(t.navInfo=document.createElement("div")),t.navInfo.className="scene-nav-info",t.navInfo.textContent={orbit:"Left-click: rotate, Mouse-wheel/middle-click: zoom, Right-click: pan",trackball:"Left-click: rotate, Mouse-wheel/middle-click: zoom, Right-click: pan",fly:"WASD: move, R|F: up | down, Q|E: roll, up|down: pitch, left|right: yaw"}[s]||"",t.navInfo.style.display=t.showNavInfo?null:"none",t.tooltip=new jAe(t.container),t.pointerPos=new br.Vector2,t.pointerPos.x=-2,t.pointerPos.y=-2,["pointermove","pointerdown"].forEach(function(w){return t.container.addEventListener(w,function(R){if(w==="pointerdown"&&(t.isPointerPressed=!0),!t.isPointerDragging&&R.type==="pointermove"&&(R.pressure>0||t.isPointerPressed)&&(R.pointerType==="mouse"||R.movementX===void 0||[R.movementX,R.movementY].some(function(B){return Math.abs(B)>1}))&&(t.isPointerDragging=!0),t.enablePointerInteraction){var C=E(t.container);t.pointerPos.x=R.pageX-C.left,t.pointerPos.y=R.pageY-C.top}function E(B){var L=B.getBoundingClientRect(),O=window.pageXOffset||document.documentElement.scrollLeft,z=window.pageYOffset||document.documentElement.scrollTop;return{top:L.top+z,left:L.left+O}}},{passive:!0})}),t.container.addEventListener("pointerup",function(w){t.isPointerPressed&&(t.isPointerPressed=!1,!(t.isPointerDragging&&(t.isPointerDragging=!1,!t.clickAfterDrag))&&requestAnimationFrame(function(){w.button===0&&t.onClick(t.hoverObj||null,w,t.intersection),w.button===2&&t.onRightClick&&t.onRightClick(t.hoverObj||null,w,t.intersection)}))},{passive:!0,capture:!0}),t.container.addEventListener("contextmenu",function(w){t.onRightClick&&w.preventDefault()}),t.renderer=new(l?sO:br.WebGLRenderer)(Object.assign({antialias:!0,alpha:!0},h)),t.renderer.setPixelRatio(Math.min(2,window.devicePixelRatio)),t.container.appendChild(t.renderer.domElement),t.extraRenderers=v,t.extraRenderers.forEach(function(w){w.domElement.style.position="absolute",w.domElement.style.top="0px",w.domElement.style.pointerEvents="none",t.container.appendChild(w.domElement)}),t.postProcessingComposer=new Jce(t.renderer),t.postProcessingComposer.addPass(new ehe(t.scene,t.camera)),t.controls=new{trackball:lce,orbit:Tce,fly:Fce}[s](t.camera,t.renderer.domElement),s==="fly"&&(t.controls.movementSpeed=300,t.controls.rollSpeed=Math.PI/6,t.controls.dragToLook=!0),(s==="trackball"||s==="orbit")&&(t.controls.minDistance=.1,t.controls.maxDistance=t.skyRadius,t.controls.addEventListener("start",function(){t.controlsEngaged=!0}),t.controls.addEventListener("change",function(){t.controlsEngaged&&(t.controlsDragging=!0)}),t.controls.addEventListener("end",function(){t.controlsEngaged=!1,t.controlsDragging=!1})),[t.renderer,t.postProcessingComposer].concat(Lf(t.extraRenderers)).forEach(function(w){return w.setSize(t.width,t.height)}),t.camera.aspect=t.width/t.height,t.camera.updateProjectionMatrix(),t.camera.position.z=1e3,t.scene.add(t.skysphere=new br.Mesh),t.skysphere.visible=!1,t.loadComplete=t.scene.visible=!S,window.scene=t.scene},update:function(e,t){if(e.width&&e.height&&(t.hasOwnProperty("width")||t.hasOwnProperty("height"))){var n,r=e.width,s=e.height;e.container.style.width="".concat(r,"px"),e.container.style.height="".concat(s,"px"),[e.renderer,e.postProcessingComposer].concat(Lf(e.extraRenderers)).forEach(function(S){return S.setSize(r,s)}),e.camera.aspect=r/s;var a=e.viewOffset.slice(0,2);a.some(function(S){return S})&&(n=e.camera).setViewOffset.apply(n,[r,s].concat(Lf(a),[r,s])),e.camera.updateProjectionMatrix()}if(t.hasOwnProperty("viewOffset")){var l,u=e.width,h=e.height,g=e.viewOffset.slice(0,2);g.some(function(S){return S})?(l=e.camera).setViewOffset.apply(l,[u,h].concat(Lf(g),[u,h])):e.camera.clearViewOffset()}if(t.hasOwnProperty("skyRadius")&&e.skyRadius&&(e.controls.hasOwnProperty("maxDistance")&&t.skyRadius&&(e.controls.maxDistance=Math.min(e.controls.maxDistance,e.skyRadius)),e.camera.far=e.skyRadius*2.5,e.camera.updateProjectionMatrix(),e.skysphere.geometry=new br.SphereGeometry(e.skyRadius)),t.hasOwnProperty("backgroundColor")){var v=G0(e.backgroundColor).alpha;v===void 0&&(v=1),e.renderer.setClearColor(new br.Color(Dhe(1,e.backgroundColor)),v)}t.hasOwnProperty("backgroundImageUrl")&&(e.backgroundImageUrl?new br.TextureLoader().load(e.backgroundImageUrl,function(S){S.colorSpace=br.SRGBColorSpace,e.skysphere.material=new br.MeshBasicMaterial({map:S,side:br.BackSide}),e.skysphere.visible=!0,e.onBackgroundImageLoaded&&setTimeout(e.onBackgroundImageLoaded),!e.loadComplete&&x()}):(e.skysphere.visible=!1,e.skysphere.material.map=null,!e.loadComplete&&x())),t.hasOwnProperty("showNavInfo")&&(e.navInfo.style.display=e.showNavInfo?null:"none"),t.hasOwnProperty("lights")&&((t.lights||[]).forEach(function(S){return e.scene.remove(S)}),e.lights.forEach(function(S){return e.scene.add(S)})),t.hasOwnProperty("objects")&&((t.objects||[]).forEach(function(S){return e.scene.remove(S)}),e.objects.forEach(function(S){return e.scene.add(S)}));function x(){e.loadComplete=e.scene.visible=!0}}});function rde(i,e){e===void 0&&(e={});var t=e.insertAt;if(!(typeof document>"u")){var n=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css",t==="top"&&n.firstChild?n.insertBefore(r,n.firstChild):n.appendChild(r),r.styleSheet?r.styleSheet.cssText=i:r.appendChild(document.createTextNode(i))}}var sde=`.scene-container .clickable { +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function tde(i,e){return XAe(i)||ZAe(i,e)||oI(i,e)||JAe()}function Lf(i){return YAe(i)||KAe(i)||oI(i)||ede()}function nde(i,e){if(typeof i!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}function ide(i){var e=nde(i,"string");return typeof e=="symbol"?e:e+""}function oI(i,e){if(i){if(typeof i=="string")return mw(i,e);var t={}.toString.call(i).slice(8,-1);return t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set"?Array.from(i):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?mw(i,e):void 0}}var br=window.THREE?window.THREE:{WebGLRenderer:Lj,Scene:Xw,PerspectiveCamera:ya,Raycaster:Xz,SRGBColorSpace:_n,TextureLoader:iM,Vector2:dt,Vector3:ce,Box3:Gc,Color:sn,Mesh:zi,SphereGeometry:Eu,MeshBasicMaterial:pA,BackSide:hr,Clock:aD},lI=xs({props:{width:{default:window.innerWidth,onChange:function(e,t,n){isNaN(e)&&(t.width=n)}},height:{default:window.innerHeight,onChange:function(e,t,n){isNaN(e)&&(t.height=n)}},viewOffset:{default:[0,0]},backgroundColor:{default:"#000011"},backgroundImageUrl:{},onBackgroundImageLoaded:{},showNavInfo:{default:!0},skyRadius:{default:5e4},objects:{default:[]},lights:{default:[]},enablePointerInteraction:{default:!0,onChange:function(e,t){t.hoverObj=null,t.tooltip&&t.tooltip.content(null)},triggerUpdate:!1},pointerRaycasterThrottleMs:{default:50,triggerUpdate:!1},lineHoverPrecision:{default:1,triggerUpdate:!1},pointsHoverPrecision:{default:1,triggerUpdate:!1},hoverOrderComparator:{triggerUpdate:!1},hoverFilter:{default:function(){return!0},triggerUpdate:!1},tooltipContent:{triggerUpdate:!1},hoverDuringDrag:{default:!1,triggerUpdate:!1},clickAfterDrag:{default:!1,triggerUpdate:!1},onHover:{default:function(){},triggerUpdate:!1},onClick:{default:function(){},triggerUpdate:!1},onRightClick:{triggerUpdate:!1}},methods:{tick:function(e){if(e.initialised){e.controls.enabled&&e.controls.update&&e.controls.update(Math.min(1,e.clock.getDelta())),e.postProcessingComposer?e.postProcessingComposer.render():e.renderer.render(e.scene,e.camera),e.extraRenderers.forEach(function(a){return a.render(e.scene,e.camera)});var t=+new Date;if(e.enablePointerInteraction&&t-e.lastRaycasterCheck>=e.pointerRaycasterThrottleMs){e.lastRaycasterCheck=t;var n=null;if(e.hoverDuringDrag||!e.isPointerDragging){var r=this.intersectingObjects(e.pointerPos.x,e.pointerPos.y);e.hoverOrderComparator&&r.sort(function(a,l){return e.hoverOrderComparator(a.object,l.object)});var s=r.find(function(a){return e.hoverFilter(a.object)})||null;n=s?s.object:null,e.intersection=s||null}n!==e.hoverObj&&(e.onHover(n,e.hoverObj,e.intersection),e.tooltip.content(n&&Ct(e.tooltipContent)(n,e.intersection)||null),e.hoverObj=n)}e.tweenGroup.update()}return this},getPointerPos:function(e){var t=e.pointerPos,n=t.x,r=t.y;return{x:n,y:r}},cameraPosition:function(e,t,n,r){var s=e.camera;if(t&&e.initialised){var a=t,l=n||{x:0,y:0,z:0};if(!r)g(a),v(l);else{var u=Object.assign({},s.position),h=x();e.tweenGroup.add(new ca(u).to(a,r).easing(os.Quadratic.Out).onUpdate(g).start()),e.tweenGroup.add(new ca(h).to(l,r/3).easing(os.Quadratic.Out).onUpdate(v).start())}return this}return Object.assign({},s.position,{lookAt:x()});function g(S){var w=S.x,R=S.y,C=S.z;w!==void 0&&(s.position.x=w),R!==void 0&&(s.position.y=R),C!==void 0&&(s.position.z=C)}function v(S){var w=new br.Vector3(S.x,S.y,S.z);e.controls.enabled&&e.controls.target?e.controls.target=w:s.lookAt(w)}function x(){return Object.assign(new br.Vector3(0,0,-1e3).applyQuaternion(s.quaternion).add(s.position))}},zoomToFit:function(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:10,r=arguments.length,s=new Array(r>3?r-3:0),a=3;a2&&arguments[2]!==void 0?arguments[2]:0,r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:10,s=e.camera;if(t){var a=new br.Vector3(0,0,0),l=Math.max.apply(Math,Lf(Object.entries(t).map(function(S){var w=tde(S,2),R=w[0],C=w[1];return Math.max.apply(Math,Lf(C.map(function(E){return Math.abs(a[R]-E)})))})))*2,u=(1-r*2/e.height)*s.fov,h=l/Math.atan(u*Math.PI/180),g=h/s.aspect,v=Math.max(h,g);if(v>0){var x=a.clone().sub(s.position).normalize().multiplyScalar(-v);this.cameraPosition(x,a,n)}}return this},getBbox:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:function(){return!0},n=new br.Box3(new br.Vector3(0,0,0),new br.Vector3(0,0,0)),r=e.objects.filter(t);return r.length?(r.forEach(function(s){return n.expandByObject(s)}),Object.assign.apply(Object,Lf(["x","y","z"].map(function(s){return QAe({},s,[n.min[s],n.max[s]])})))):null},getScreenCoords:function(e,t,n,r){var s=new br.Vector3(t,n,r);return s.project(this.camera()),{x:(s.x+1)*e.width/2,y:-(s.y-1)*e.height/2}},getSceneCoords:function(e,t,n){var r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,s=new br.Vector2(t/e.width*2-1,-(n/e.height)*2+1),a=new br.Raycaster;return a.setFromCamera(s,e.camera),Object.assign({},a.ray.at(r,new br.Vector3))},intersectingObjects:function(e,t,n){var r=new br.Vector2(t/e.width*2-1,-(n/e.height)*2+1),s=new br.Raycaster;return s.params.Line.threshold=e.lineHoverPrecision,s.params.Points.threshold=e.pointsHoverPrecision,s.setFromCamera(r,e.camera),s.intersectObjects(e.objects,!0)},renderer:function(e){return e.renderer},scene:function(e){return e.scene},camera:function(e){return e.camera},postProcessingComposer:function(e){return e.postProcessingComposer},controls:function(e){return e.controls},tbControls:function(e){return e.controls}},stateInit:function(){return{scene:new br.Scene,camera:new br.PerspectiveCamera,clock:new br.Clock,tweenGroup:new My,lastRaycasterCheck:0}},init:function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},r=n.controlType,s=r===void 0?"trackball":r,a=n.useWebGPU,l=a===void 0?!1:a,u=n.rendererConfig,h=u===void 0?{}:u,g=n.extraRenderers,v=g===void 0?[]:g,x=n.waitForLoadComplete,S=x===void 0?!0:x;e.innerHTML="",e.appendChild(t.container=document.createElement("div")),t.container.className="scene-container",t.container.style.position="relative",t.container.appendChild(t.navInfo=document.createElement("div")),t.navInfo.className="scene-nav-info",t.navInfo.textContent={orbit:"Left-click: rotate, Mouse-wheel/middle-click: zoom, Right-click: pan",trackball:"Left-click: rotate, Mouse-wheel/middle-click: zoom, Right-click: pan",fly:"WASD: move, R|F: up | down, Q|E: roll, up|down: pitch, left|right: yaw"}[s]||"",t.navInfo.style.display=t.showNavInfo?null:"none",t.tooltip=new jAe(t.container),t.pointerPos=new br.Vector2,t.pointerPos.x=-2,t.pointerPos.y=-2,["pointermove","pointerdown"].forEach(function(w){return t.container.addEventListener(w,function(R){if(w==="pointerdown"&&(t.isPointerPressed=!0),!t.isPointerDragging&&R.type==="pointermove"&&(R.pressure>0||t.isPointerPressed)&&(R.pointerType==="mouse"||R.movementX===void 0||[R.movementX,R.movementY].some(function(B){return Math.abs(B)>1}))&&(t.isPointerDragging=!0),t.enablePointerInteraction){var C=E(t.container);t.pointerPos.x=R.pageX-C.left,t.pointerPos.y=R.pageY-C.top}function E(B){var L=B.getBoundingClientRect(),O=window.pageXOffset||document.documentElement.scrollLeft,z=window.pageYOffset||document.documentElement.scrollTop;return{top:L.top+z,left:L.left+O}}},{passive:!0})}),t.container.addEventListener("pointerup",function(w){t.isPointerPressed&&(t.isPointerPressed=!1,!(t.isPointerDragging&&(t.isPointerDragging=!1,!t.clickAfterDrag))&&requestAnimationFrame(function(){w.button===0&&t.onClick(t.hoverObj||null,w,t.intersection),w.button===2&&t.onRightClick&&t.onRightClick(t.hoverObj||null,w,t.intersection)}))},{passive:!0,capture:!0}),t.container.addEventListener("contextmenu",function(w){t.onRightClick&&w.preventDefault()}),t.renderer=new(l?sO:br.WebGLRenderer)(Object.assign({antialias:!0,alpha:!0},h)),t.renderer.setPixelRatio(Math.min(2,window.devicePixelRatio)),t.container.appendChild(t.renderer.domElement),t.extraRenderers=v,t.extraRenderers.forEach(function(w){w.domElement.style.position="absolute",w.domElement.style.top="0px",w.domElement.style.pointerEvents="none",t.container.appendChild(w.domElement)}),t.postProcessingComposer=new Jce(t.renderer),t.postProcessingComposer.addPass(new ehe(t.scene,t.camera)),t.controls=new{trackball:lce,orbit:Tce,fly:Fce}[s](t.camera,t.renderer.domElement),s==="fly"&&(t.controls.movementSpeed=300,t.controls.rollSpeed=Math.PI/6,t.controls.dragToLook=!0),(s==="trackball"||s==="orbit")&&(t.controls.minDistance=.1,t.controls.maxDistance=t.skyRadius,t.controls.addEventListener("start",function(){t.controlsEngaged=!0}),t.controls.addEventListener("change",function(){t.controlsEngaged&&(t.controlsDragging=!0)}),t.controls.addEventListener("end",function(){t.controlsEngaged=!1,t.controlsDragging=!1})),[t.renderer,t.postProcessingComposer].concat(Lf(t.extraRenderers)).forEach(function(w){return w.setSize(t.width,t.height)}),t.camera.aspect=t.width/t.height,t.camera.updateProjectionMatrix(),t.camera.position.z=1e3,t.scene.add(t.skysphere=new br.Mesh),t.skysphere.visible=!1,t.loadComplete=t.scene.visible=!S,window.scene=t.scene},update:function(e,t){if(e.width&&e.height&&(t.hasOwnProperty("width")||t.hasOwnProperty("height"))){var n,r=e.width,s=e.height;e.container.style.width="".concat(r,"px"),e.container.style.height="".concat(s,"px"),[e.renderer,e.postProcessingComposer].concat(Lf(e.extraRenderers)).forEach(function(S){return S.setSize(r,s)}),e.camera.aspect=r/s;var a=e.viewOffset.slice(0,2);a.some(function(S){return S})&&(n=e.camera).setViewOffset.apply(n,[r,s].concat(Lf(a),[r,s])),e.camera.updateProjectionMatrix()}if(t.hasOwnProperty("viewOffset")){var l,u=e.width,h=e.height,g=e.viewOffset.slice(0,2);g.some(function(S){return S})?(l=e.camera).setViewOffset.apply(l,[u,h].concat(Lf(g),[u,h])):e.camera.clearViewOffset()}if(t.hasOwnProperty("skyRadius")&&e.skyRadius&&(e.controls.hasOwnProperty("maxDistance")&&t.skyRadius&&(e.controls.maxDistance=Math.min(e.controls.maxDistance,e.skyRadius)),e.camera.far=e.skyRadius*2.5,e.camera.updateProjectionMatrix(),e.skysphere.geometry=new br.SphereGeometry(e.skyRadius)),t.hasOwnProperty("backgroundColor")){var v=G0(e.backgroundColor).alpha;v===void 0&&(v=1),e.renderer.setClearColor(new br.Color(Dhe(1,e.backgroundColor)),v)}t.hasOwnProperty("backgroundImageUrl")&&(e.backgroundImageUrl?new br.TextureLoader().load(e.backgroundImageUrl,function(S){S.colorSpace=br.SRGBColorSpace,e.skysphere.material=new br.MeshBasicMaterial({map:S,side:br.BackSide}),e.skysphere.visible=!0,e.onBackgroundImageLoaded&&setTimeout(e.onBackgroundImageLoaded),!e.loadComplete&&x()}):(e.skysphere.visible=!1,e.skysphere.material.map=null,!e.loadComplete&&x())),t.hasOwnProperty("showNavInfo")&&(e.navInfo.style.display=e.showNavInfo?null:"none"),t.hasOwnProperty("lights")&&((t.lights||[]).forEach(function(S){return e.scene.remove(S)}),e.lights.forEach(function(S){return e.scene.add(S)})),t.hasOwnProperty("objects")&&((t.objects||[]).forEach(function(S){return e.scene.remove(S)}),e.objects.forEach(function(S){return e.scene.add(S)}));function x(){e.loadComplete=e.scene.visible=!0}}});function rde(i,e){e===void 0&&(e={});var t=e.insertAt;if(!(typeof document>"u")){var n=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css",t==="top"&&n.firstChild?n.insertBefore(r,n.firstChild):n.appendChild(r),r.styleSheet?r.styleSheet.cssText=i:r.appendChild(document.createTextNode(i))}}var sde=`.scene-container .clickable { cursor: pointer; }`;rde(sde);function gw(i,e){(e==null||e>i.length)&&(e=i.length);for(var t=0,n=Array(e);t1?l-1:0),h=1;h1&&arguments[1]!==void 0?arguments[1]:{},n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,r=a();if(t.lat===void 0&&t.lng===void 0&&t.altitude===void 0)return r;var s=Object.assign({},r,t);if(["lat","lng","altitude"].forEach(function(u){return s[u]=+s[u]}),!n)l(s);else{for(;r.lng-s.lng>180;)r.lng-=360;for(;r.lng-s.lng<-180;)r.lng+=360;e.tweenGroup.add(new ca(r).to(s,n).easing(os.Cubic.InOut).onUpdate(l).start())}return this;function a(){return e.globe.toGeoCoords(e.renderObjs.cameraPosition())}function l(u){var h=u.lat,g=u.lng,v=u.altitude;e.renderObjs.cameraPosition(e.globe.getCoords(h,g,v)),e.globe.setPointOfView(e.renderObjs.camera())}},getScreenCoords:function(e){for(var t,n=arguments.length,r=new Array(n>1?n-1:0),s=1;slocalStorage.getItem("radio-theme")||"default"),[a,l]=Ie.useState([]),[u,h]=Ie.useState(null),[g,v]=Ie.useState([]),[x,S]=Ie.useState(!1),[w,R]=Ie.useState({}),[C,E]=Ie.useState([]),[B,L]=Ie.useState(""),[O,z]=Ie.useState(""),[G,k]=Ie.useState(""),[H,F]=Ie.useState([]),[V,X]=Ie.useState(!1),[J,te]=Ie.useState([]),[se,ne]=Ie.useState(!1),[Z,ue]=Ie.useState(!1),[he,be]=Ie.useState(.5),[Se,le]=Ie.useState(null),[we,We]=Ie.useState(!1),[Te,ze]=Ie.useState(!1),_e=Ie.useRef(void 0),De=Ie.useRef(void 0),dt=Ie.useRef(B);Ie.useEffect(()=>{fetch("/api/radio/places").then(Y=>Y.json()).then(l).catch(console.error),fetch("/api/radio/guilds").then(Y=>Y.json()).then(Y=>{if(E(Y),Y.length>0){L(Y[0].id);const Ce=Y[0].voiceChannels.find($e=>$e.members>0)??Y[0].voiceChannels[0];Ce&&z(Ce.id)}}).catch(console.error),fetch("/api/radio/favorites").then(Y=>Y.json()).then(te).catch(console.error)},[]),Ie.useEffect(()=>{dt.current=B},[B]),Ie.useEffect(()=>{i!=null&&i.guildId&&"playing"in i&&i.type!=="radio_voicestats"?R(Y=>{if(i.playing)return{...Y,[i.guildId]:i.playing};const Ce={...Y};return delete Ce[i.guildId],Ce}):i!=null&&i.playing&&!(i!=null&&i.guildId)&&R(i.playing),i!=null&&i.favorites&&te(i.favorites),i!=null&&i.volumes&&B&&i.volumes[B]!=null&&be(i.volumes[B]),(i==null?void 0:i.volume)!=null&&(i==null?void 0:i.guildId)===B&&be(i.volume),(i==null?void 0:i.type)==="radio_voicestats"&&i.guildId===dt.current&&le({voicePing:i.voicePing,gatewayPing:i.gatewayPing,status:i.status,channelName:i.channelName,connectedSince:i.connectedSince})},[i,B]),Ie.useEffect(()=>{if(localStorage.setItem("radio-theme",r),t.current&&e.current){const Ce=getComputedStyle(e.current.parentElement).getPropertyValue("--accent-rgb").trim();t.current.pointColor(()=>`rgba(${Ce}, 0.85)`).atmosphereColor(`rgba(${Ce}, 0.25)`)}},[r]);const vt=Ie.useRef(u);vt.current=u;const Tt=Ie.useRef(se);Tt.current=se;const Ge=Ie.useCallback(()=>{var Ce;const Y=(Ce=t.current)==null?void 0:Ce.controls();Y&&(Y.autoRotate=!1),n.current&&clearTimeout(n.current),n.current=setTimeout(()=>{var it;if(vt.current||Tt.current)return;const $e=(it=t.current)==null?void 0:it.controls();$e&&($e.autoRotate=!0)},5e3)},[]);Ie.useEffect(()=>{var Ce;const Y=(Ce=t.current)==null?void 0:Ce.controls();Y&&(u||se?(Y.autoRotate=!1,n.current&&clearTimeout(n.current)):Y.autoRotate=!0)},[u,se]);const Be=Ie.useRef(void 0);Be.current=Y=>{h(Y),ne(!1),S(!0),v([]),Ge(),t.current&&t.current.pointOfView({lat:Y.geo[1],lng:Y.geo[0],altitude:.4},800),fetch(`/api/radio/place/${Y.id}/channels`).then(Ce=>Ce.json()).then(Ce=>{v(Ce),S(!1)}).catch(()=>S(!1))},Ie.useEffect(()=>{const Y=e.current;if(!Y)return;Y.clientWidth>0&&Y.clientHeight>0&&ze(!0);const Ce=new ResizeObserver($e=>{for(const it of $e){const{width:tt,height:Vt}=it.contentRect;tt>0&&Vt>0&&ze(!0)}});return Ce.observe(Y),()=>Ce.disconnect()},[]),Ie.useEffect(()=>{if(!e.current||a.length===0)return;const Y=e.current.clientWidth,Ce=e.current.clientHeight;if(t.current){t.current.pointsData(a),Y>0&&Ce>0&&t.current.width(Y).height(Ce);return}if(Y===0||Ce===0)return;const it=getComputedStyle(e.current.parentElement).getPropertyValue("--accent-rgb").trim()||"230, 126, 34",tt=new _de(e.current).backgroundColor("rgba(0,0,0,0)").atmosphereColor(`rgba(${it}, 0.25)`).atmosphereAltitude(.12).globeImageUrl("/nasa-blue-marble.jpg").pointsData(a).pointLat(Ht=>Ht.geo[1]).pointLng(Ht=>Ht.geo[0]).pointColor(()=>`rgba(${it}, 0.85)`).pointRadius(Ht=>Math.max(.12,Math.min(.45,.06+(Ht.size??1)*.005))).pointAltitude(.001).pointResolution(24).pointLabel(Ht=>`

`).onPointClick(Ht=>{var Ft;return(Ft=Be.current)==null?void 0:Ft.call(Be,Ht)}).width(e.current.clientWidth).height(e.current.clientHeight);tt.renderer().setPixelRatio(window.devicePixelRatio),tt.pointOfView({lat:48,lng:10,altitude:GS});const Vt=tt.controls();Vt&&(Vt.autoRotate=!0,Vt.autoRotateSpeed=.3);let Bt=GS;const Wt=()=>{const Ft=tt.pointOfView().altitude;if(Math.abs(Ft-Bt)/Bt<.05)return;Bt=Ft;const Gt=Math.sqrt(Ft/GS);tt.pointRadius(In=>Math.max(.12,Math.min(.45,.06+(In.size??1)*.005))*Math.max(.15,Math.min(2.5,Gt)))};Vt.addEventListener("change",Wt),t.current=tt;const ln=e.current,St=()=>Ge();ln.addEventListener("mousedown",St),ln.addEventListener("touchstart",St),ln.addEventListener("wheel",St);const Kt=()=>{if(e.current&&t.current){const Ht=e.current.clientWidth,Ft=e.current.clientHeight;Ht>0&&Ft>0&&t.current.width(Ht).height(Ft)}};window.addEventListener("resize",Kt);const rn=new ResizeObserver(()=>Kt());return rn.observe(ln),()=>{Vt.removeEventListener("change",Wt),ln.removeEventListener("mousedown",St),ln.removeEventListener("touchstart",St),ln.removeEventListener("wheel",St),window.removeEventListener("resize",Kt),rn.disconnect()}},[a,Ge,Te]);const ke=Ie.useCallback(async(Y,Ce,$e,it)=>{if(!(!B||!O)){ue(!0);try{(await(await fetch("/api/radio/play",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({guildId:B,voiceChannelId:O,stationId:Y,stationName:Ce,placeName:$e??(u==null?void 0:u.title)??"",country:it??(u==null?void 0:u.country)??""})})).json()).ok&&(R(Bt=>{var Wt,ln;return{...Bt,[B]:{stationId:Y,stationName:Ce,placeName:$e??(u==null?void 0:u.title)??"",country:it??(u==null?void 0:u.country)??"",startedAt:new Date().toISOString(),channelName:((ln=(Wt=C.find(St=>St.id===B))==null?void 0:Wt.voiceChannels.find(St=>St.id===O))==null?void 0:ln.name)??""}}}),Ge())}catch(tt){console.error(tt)}ue(!1)}},[B,O,u,C]),oe=Ie.useCallback(async()=>{B&&(await fetch("/api/radio/stop",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({guildId:B})}),R(Y=>{const Ce={...Y};return delete Ce[B],Ce}))},[B]),Mt=Ie.useCallback(Y=>{if(k(Y),_e.current&&clearTimeout(_e.current),!Y.trim()){F([]),X(!1);return}_e.current=setTimeout(async()=>{try{const $e=await(await fetch(`/api/radio/search?q=${encodeURIComponent(Y)}`)).json();F($e),X(!0)}catch{F([])}},350)},[]),lt=Ie.useCallback(Y=>{var Ce,$e,it;if(X(!1),k(""),F([]),Y.type==="channel"){const tt=(Ce=Y.url.match(/\/listen\/[^/]+\/([^/]+)/))==null?void 0:Ce[1];tt&&ke(tt,Y.title,Y.subtitle,"")}else if(Y.type==="place"){const tt=($e=Y.url.match(/\/visit\/[^/]+\/([^/]+)/))==null?void 0:$e[1],Vt=a.find(Bt=>Bt.id===tt);Vt&&((it=Be.current)==null||it.call(Be,Vt))}},[a,ke]),Dt=Ie.useCallback(async(Y,Ce)=>{try{const it=await(await fetch("/api/radio/favorites",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({stationId:Y,stationName:Ce,placeName:(u==null?void 0:u.title)??"",country:(u==null?void 0:u.country)??"",placeId:(u==null?void 0:u.id)??""})})).json();it.favorites&&te(it.favorites)}catch{}},[u]),wt=Ie.useCallback(Y=>{be(Y),B&&(De.current&&clearTimeout(De.current),De.current=setTimeout(()=>{fetch("/api/radio/volume",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({guildId:B,volume:Y})}).catch(console.error)},100))},[B]),tn=Y=>J.some(Ce=>Ce.stationId===Y),bt=B?w[B]:null,fe=C.find(Y=>Y.id===B);return W.jsxs("div",{className:"radio-container","data-theme":r,children:[W.jsxs("header",{className:"radio-topbar",children:[W.jsxs("div",{className:"radio-topbar-left",children:[W.jsx("span",{className:"radio-topbar-logo",children:"🌍"}),W.jsx("span",{className:"radio-topbar-title",children:"World Radio"}),C.length>1&&W.jsx("select",{className:"radio-sel",value:B,onChange:Y=>{L(Y.target.value);const Ce=C.find(it=>it.id===Y.target.value),$e=(Ce==null?void 0:Ce.voiceChannels.find(it=>it.members>0))??(Ce==null?void 0:Ce.voiceChannels[0]);z(($e==null?void 0:$e.id)??"")},children:C.map(Y=>W.jsx("option",{value:Y.id,children:Y.name},Y.id))}),W.jsxs("select",{className:"radio-sel",value:O,onChange:Y=>z(Y.target.value),children:[W.jsx("option",{value:"",children:"Voice Channel..."}),fe==null?void 0:fe.voiceChannels.map(Y=>W.jsxs("option",{value:Y.id,children:["🔊"," ",Y.name,Y.members>0?` (${Y.members})`:""]},Y.id))]})]}),bt&&W.jsxs("div",{className:"radio-topbar-np",children:[W.jsxs("div",{className:"radio-eq radio-eq-np",children:[W.jsx("span",{}),W.jsx("span",{}),W.jsx("span",{})]}),W.jsxs("div",{className:"radio-np-info",children:[W.jsx("span",{className:"radio-np-name",children:bt.stationName}),W.jsxs("span",{className:"radio-np-loc",children:[bt.placeName,bt.country?`, ${bt.country}`:""]})]})]}),W.jsxs("div",{className:"radio-topbar-right",children:[bt&&W.jsxs(W.Fragment,{children:[W.jsxs("div",{className:"radio-volume",children:[W.jsx("span",{className:"radio-volume-icon",children:he===0?"🔇":he<.4?"🔉":"🔊"}),W.jsx("input",{type:"range",className:"radio-volume-slider",min:0,max:1,step:.01,value:he,onChange:Y=>wt(Number(Y.target.value))}),W.jsxs("span",{className:"radio-volume-val",children:[Math.round(he*100),"%"]})]}),W.jsxs("div",{className:"radio-conn",onClick:()=>We(!0),title:"Verbindungsdetails",children:[W.jsx("span",{className:"radio-conn-dot"}),"Verbunden",(Se==null?void 0:Se.voicePing)!=null&&W.jsxs("span",{className:"radio-conn-ping",children:[Se.voicePing,"ms"]})]}),W.jsxs("button",{className:"radio-topbar-stop",onClick:oe,children:["⏹"," Stop"]})]}),W.jsx("div",{className:"radio-theme-inline",children:yde.map(Y=>W.jsx("div",{className:`radio-theme-dot ${r===Y.id?"active":""}`,style:{background:Y.color},title:Y.label,onClick:()=>s(Y.id)},Y.id))})]})]}),W.jsxs("div",{className:"radio-globe-wrap",children:[W.jsx("div",{className:"radio-globe",ref:e}),W.jsxs("div",{className:"radio-search",children:[W.jsxs("div",{className:"radio-search-wrap",children:[W.jsx("span",{className:"radio-search-icon",children:"🔍"}),W.jsx("input",{className:"radio-search-input",type:"text",placeholder:"Sender oder Stadt suchen...",value:G,onChange:Y=>Mt(Y.target.value),onFocus:()=>{H.length&&X(!0)}}),G&&W.jsx("button",{className:"radio-search-clear",onClick:()=>{k(""),F([]),X(!1)},children:"✕"})]}),V&&H.length>0&&W.jsx("div",{className:"radio-search-results",children:H.slice(0,12).map(Y=>W.jsxs("button",{className:"radio-search-result",onClick:()=>lt(Y),children:[W.jsx("span",{className:"radio-search-result-icon",children:Y.type==="channel"?"📻":Y.type==="place"?"📍":"🌍"}),W.jsxs("div",{className:"radio-search-result-text",children:[W.jsx("span",{className:"radio-search-result-title",children:Y.title}),W.jsx("span",{className:"radio-search-result-sub",children:Y.subtitle})]})]},Y.id+Y.url))})]}),!u&&!se&&W.jsxs("button",{className:"radio-fab",onClick:()=>{ne(!0),h(null)},title:"Favoriten",children:["⭐",J.length>0&&W.jsx("span",{className:"radio-fab-badge",children:J.length})]}),se&&W.jsxs("div",{className:"radio-panel open",children:[W.jsxs("div",{className:"radio-panel-header",children:[W.jsxs("h3",{children:["⭐"," Favoriten"]}),W.jsx("button",{className:"radio-panel-close",onClick:()=>ne(!1),children:"✕"})]}),W.jsx("div",{className:"radio-panel-body",children:J.length===0?W.jsx("div",{className:"radio-panel-empty",children:"Noch keine Favoriten"}):J.map(Y=>W.jsxs("div",{className:`radio-station ${(bt==null?void 0:bt.stationId)===Y.stationId?"playing":""}`,children:[W.jsxs("div",{className:"radio-station-info",children:[W.jsx("span",{className:"radio-station-name",children:Y.stationName}),W.jsxs("span",{className:"radio-station-loc",children:[Y.placeName,", ",Y.country]})]}),W.jsxs("div",{className:"radio-station-btns",children:[W.jsx("button",{className:"radio-btn-play",onClick:()=>ke(Y.stationId,Y.stationName,Y.placeName,Y.country),disabled:!O||Z,children:"▶"}),W.jsx("button",{className:"radio-btn-fav active",onClick:()=>Dt(Y.stationId,Y.stationName),children:"★"})]})]},Y.stationId))})]}),u&&!se&&W.jsxs("div",{className:"radio-panel open",children:[W.jsxs("div",{className:"radio-panel-header",children:[W.jsxs("div",{children:[W.jsx("h3",{children:u.title}),W.jsx("span",{className:"radio-panel-sub",children:u.country})]}),W.jsx("button",{className:"radio-panel-close",onClick:()=>h(null),children:"✕"})]}),W.jsx("div",{className:"radio-panel-body",children:x?W.jsxs("div",{className:"radio-panel-loading",children:[W.jsx("div",{className:"radio-spinner"}),"Sender werden geladen..."]}):g.length===0?W.jsx("div",{className:"radio-panel-empty",children:"Keine Sender gefunden"}):g.map(Y=>W.jsxs("div",{className:`radio-station ${(bt==null?void 0:bt.stationId)===Y.id?"playing":""}`,children:[W.jsxs("div",{className:"radio-station-info",children:[W.jsx("span",{className:"radio-station-name",children:Y.title}),(bt==null?void 0:bt.stationId)===Y.id&&W.jsxs("span",{className:"radio-station-live",children:[W.jsxs("span",{className:"radio-eq",children:[W.jsx("span",{}),W.jsx("span",{}),W.jsx("span",{})]}),"Live"]})]}),W.jsxs("div",{className:"radio-station-btns",children:[(bt==null?void 0:bt.stationId)===Y.id?W.jsx("button",{className:"radio-btn-stop",onClick:oe,children:"⏹"}):W.jsx("button",{className:"radio-btn-play",onClick:()=>ke(Y.id,Y.title),disabled:!O||Z,children:"▶"}),W.jsx("button",{className:`radio-btn-fav ${tn(Y.id)?"active":""}`,onClick:()=>Dt(Y.id,Y.title),children:tn(Y.id)?"★":"☆"})]})]},Y.id))})]}),W.jsxs("div",{className:"radio-counter",children:["📻"," ",a.length.toLocaleString("de-DE")," Sender weltweit"]}),W.jsx("a",{className:"radio-attribution",href:"https://science.nasa.gov/earth/earth-observatory/blue-marble-next-generation/",target:"_blank",rel:"noreferrer",children:"Imagery © NASA Blue Marble"})]}),we&&(()=>{const Y=Se!=null&&Se.connectedSince?Math.floor((Date.now()-new Date(Se.connectedSince).getTime())/1e3):0,Ce=Math.floor(Y/3600),$e=Math.floor(Y%3600/60),it=Y%60,tt=Ce>0?`${Ce}h ${String($e).padStart(2,"0")}m ${String(it).padStart(2,"0")}s`:$e>0?`${$e}m ${String(it).padStart(2,"0")}s`:`${it}s`,Vt=Bt=>Bt==null?"var(--text-faint)":Bt<80?"var(--success)":Bt<150?"#f0a830":"#e04040";return W.jsx("div",{className:"radio-modal-overlay",onClick:()=>We(!1),children:W.jsxs("div",{className:"radio-modal",onClick:Bt=>Bt.stopPropagation(),children:[W.jsxs("div",{className:"radio-modal-header",children:[W.jsx("span",{children:"📡"}),W.jsx("span",{children:"Verbindungsdetails"}),W.jsx("button",{className:"radio-modal-close",onClick:()=>We(!1),children:"✕"})]}),W.jsxs("div",{className:"radio-modal-body",children:[W.jsxs("div",{className:"radio-modal-stat",children:[W.jsx("span",{className:"radio-modal-label",children:"Voice Ping"}),W.jsxs("span",{className:"radio-modal-value",children:[W.jsx("span",{className:"radio-modal-dot",style:{background:Vt((Se==null?void 0:Se.voicePing)??null)}}),(Se==null?void 0:Se.voicePing)!=null?`${Se.voicePing} ms`:"---"]})]}),W.jsxs("div",{className:"radio-modal-stat",children:[W.jsx("span",{className:"radio-modal-label",children:"Gateway Ping"}),W.jsxs("span",{className:"radio-modal-value",children:[W.jsx("span",{className:"radio-modal-dot",style:{background:Vt((Se==null?void 0:Se.gatewayPing)??null)}}),Se&&Se.gatewayPing>=0?`${Se.gatewayPing} ms`:"---"]})]}),W.jsxs("div",{className:"radio-modal-stat",children:[W.jsx("span",{className:"radio-modal-label",children:"Status"}),W.jsx("span",{className:"radio-modal-value",style:{color:(Se==null?void 0:Se.status)==="ready"?"var(--success)":"#f0a830"},children:(Se==null?void 0:Se.status)==="ready"?"Verbunden":(Se==null?void 0:Se.status)??"Warte auf Verbindung"})]}),W.jsxs("div",{className:"radio-modal-stat",children:[W.jsx("span",{className:"radio-modal-label",children:"Kanal"}),W.jsx("span",{className:"radio-modal-value",children:(Se==null?void 0:Se.channelName)||"---"})]}),W.jsxs("div",{className:"radio-modal-stat",children:[W.jsx("span",{className:"radio-modal-label",children:"Verbunden seit"}),W.jsx("span",{className:"radio-modal-value",children:tt||"---"})]})]})]})})})()]})}function bde(i,e,t=365){const n=new Date(Date.now()+t*24*60*60*1e3).toUTCString();document.cookie=`${encodeURIComponent(i)}=${encodeURIComponent(e)}; expires=${n}; path=/; SameSite=Lax`}function Sde(i){const e=`${encodeURIComponent(i)}=`,t=document.cookie.split(";");for(const n of t){const r=n.trim();if(r.startsWith(e))return decodeURIComponent(r.slice(e.length))}return null}const us="/api/soundboard";async function A7(i,e,t,n){const r=new URL(`${us}/sounds`,window.location.origin);i&&r.searchParams.set("q",i),e!==void 0&&r.searchParams.set("folder",e),r.searchParams.set("fuzzy","0");const s=await fetch(r.toString());if(!s.ok)throw new Error("Fehler beim Laden der Sounds");return s.json()}async function Tde(){const i=await fetch(`${us}/analytics`);if(!i.ok)throw new Error("Fehler beim Laden der Analytics");return i.json()}async function wde(){const i=await fetch(`${us}/categories`,{credentials:"include"});if(!i.ok)throw new Error("Fehler beim Laden der Kategorien");return i.json()}async function Mde(){const i=await fetch(`${us}/channels`);if(!i.ok)throw new Error("Fehler beim Laden der Channels");return i.json()}async function Ede(){const i=await fetch(`${us}/selected-channels`);if(!i.ok)throw new Error("Fehler beim Laden der Channel-Auswahl");const e=await i.json();return(e==null?void 0:e.selected)||{}}async function Cde(i,e){if(!(await fetch(`${us}/selected-channel`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({guildId:i,channelId:e})})).ok)throw new Error("Channel-Auswahl setzen fehlgeschlagen")}async function Rde(i,e,t,n,r){const s=await fetch(`${us}/play`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({soundName:i,guildId:e,channelId:t,volume:n,relativePath:r})});if(!s.ok){const a=await s.json().catch(()=>({}));throw new Error((a==null?void 0:a.error)||"Play fehlgeschlagen")}}async function Nde(i,e,t,n,r){const s=await fetch(`${us}/play-url`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({url:i,guildId:e,channelId:t,volume:n,filename:r})}),a=await s.json().catch(()=>({}));if(!s.ok)throw new Error((a==null?void 0:a.error)||"Play-URL fehlgeschlagen");return a}async function Dde(i,e){const t=await fetch(`${us}/download-url`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({url:i,filename:e})}),n=await t.json().catch(()=>({}));if(!t.ok)throw new Error((n==null?void 0:n.error)||"Download fehlgeschlagen");return n}async function Pde(i,e){if(!(await fetch(`${us}/party/start`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({guildId:i,channelId:e})})).ok)throw new Error("Partymode Start fehlgeschlagen")}async function Lde(i){if(!(await fetch(`${us}/party/stop`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({guildId:i})})).ok)throw new Error("Partymode Stop fehlgeschlagen")}async function d7(i,e){const t=await fetch(`${us}/volume`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({guildId:i,volume:e})});if(!t.ok){const n=await t.json().catch(()=>({}));throw new Error((n==null?void 0:n.error)||"Volume aendern fehlgeschlagen")}}async function Ude(i){const e=new URL(`${us}/volume`,window.location.origin);e.searchParams.set("guildId",i);const t=await fetch(e.toString());if(!t.ok)throw new Error("Fehler beim Laden der Lautstaerke");const n=await t.json();return typeof(n==null?void 0:n.volume)=="number"?n.volume:1}async function Bde(){const i=await fetch(`${us}/admin/status`,{credentials:"include"});if(!i.ok)return!1;const e=await i.json();return!!(e!=null&&e.authenticated)}async function Ode(i){return(await fetch(`${us}/admin/login`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({password:i})})).ok}async function Ide(){await fetch(`${us}/admin/logout`,{method:"POST",credentials:"include"})}async function Fde(i){if(!(await fetch(`${us}/admin/sounds/delete`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({paths:i})})).ok)throw new Error("Loeschen fehlgeschlagen")}async function kde(i,e){const t=await fetch(`${us}/admin/sounds/rename`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({from:i,to:e})});if(!t.ok)throw new Error("Umbenennen fehlgeschlagen");const n=await t.json();return n==null?void 0:n.to}function zde(i,e){return new Promise((t,n)=>{const r=new FormData;r.append("files",i);const s=new XMLHttpRequest;s.open("POST",`${us}/upload`),s.upload.onprogress=a=>{a.lengthComputable&&e(Math.round(a.loaded/a.total*100))},s.onload=()=>{var a,l;if(s.status===200)try{const u=JSON.parse(s.responseText);t(((l=(a=u.files)==null?void 0:a[0])==null?void 0:l.name)??i.name)}catch{t(i.name)}else try{n(new Error(JSON.parse(s.responseText).error))}catch{n(new Error(`HTTP ${s.status}`))}},s.onerror=()=>n(new Error("Netzwerkfehler")),s.send(r)})}const Gde=[{id:"default",color:"#5865f2",label:"Discord"},{id:"purple",color:"#9b59b6",label:"Midnight"},{id:"forest",color:"#2ecc71",label:"Forest"},{id:"sunset",color:"#e67e22",label:"Sunset"},{id:"ocean",color:"#3498db",label:"Ocean"}],p7=["#3b82f6","#f59e0b","#8b5cf6","#ec4899","#14b8a6","#f97316","#06b6d4","#ef4444","#a855f7","#84cc16","#d946ef","#0ea5e9","#f43f5e","#10b981"];function qde({data:i}){const[e,t]=Ie.useState([]),[n,r]=Ie.useState(0),[s,a]=Ie.useState([]),[l,u]=Ie.useState([]),[h,g]=Ie.useState({totalSounds:0,totalPlays:0,mostPlayed:[]}),[v,x]=Ie.useState("all"),[S,w]=Ie.useState(""),[R,C]=Ie.useState(""),[E,B]=Ie.useState(""),[L,O]=Ie.useState(!1),[z,G]=Ie.useState(null),[k,H]=Ie.useState([]),[F,V]=Ie.useState(""),X=Ie.useRef(""),[J,te]=Ie.useState(!1),[se,ne]=Ie.useState(1),[Z,ue]=Ie.useState(""),[he,be]=Ie.useState({}),[Se,le]=Ie.useState(()=>localStorage.getItem("jb-theme")||"default"),[we,We]=Ie.useState(()=>parseInt(localStorage.getItem("jb-card-size")||"110")),[Te,ze]=Ie.useState(!1),[_e,De]=Ie.useState([]),dt=Ie.useRef(!1),vt=Ie.useRef(void 0),[Tt,Ge]=Ie.useState(!1),[Be,ke]=Ie.useState(!1),[oe,Mt]=Ie.useState(""),[lt,Dt]=Ie.useState([]),[wt,tn]=Ie.useState(!1),[bt,fe]=Ie.useState(""),[Y,Ce]=Ie.useState({}),[$e,it]=Ie.useState(""),[tt,Vt]=Ie.useState(""),[Bt,Wt]=Ie.useState(!1),[ln,St]=Ie.useState([]),[Kt,rn]=Ie.useState(!1),Ht=Ie.useRef(0),Ft=Ie.useRef(void 0),[Gt,In]=Ie.useState(null),[Mi,me]=Ie.useState(!1),[jt,rt]=Ie.useState(null),[_t,$t]=Ie.useState(""),[kt,xn]=Ie.useState(null),[qi,rr]=Ie.useState(0);Ie.useEffect(()=>{dt.current=Te},[Te]),Ie.useEffect(()=>{X.current=F},[F]),Ie.useEffect(()=>{const ve=cn=>{var Yn;Array.from(((Yn=cn.dataTransfer)==null?void 0:Yn.items)??[]).some(yi=>yi.kind==="file")&&(Ht.current++,Wt(!0))},ot=()=>{Ht.current=Math.max(0,Ht.current-1),Ht.current===0&&Wt(!1)},Rt=cn=>cn.preventDefault(),Zt=cn=>{var yi;cn.preventDefault(),Ht.current=0,Wt(!1);const Yn=Array.from(((yi=cn.dataTransfer)==null?void 0:yi.files)??[]).filter(js=>/\.(mp3|wav)$/i.test(js.name));Yn.length&&Hs(Yn)};return window.addEventListener("dragenter",ve),window.addEventListener("dragleave",ot),window.addEventListener("dragover",Rt),window.addEventListener("drop",Zt),()=>{window.removeEventListener("dragenter",ve),window.removeEventListener("dragleave",ot),window.removeEventListener("dragover",Rt),window.removeEventListener("drop",Zt)}},[Tt]);const pn=Ie.useCallback((ve,ot="info")=>{rt({msg:ve,type:ot}),setTimeout(()=>rt(null),3e3)},[]),$i=Ie.useCallback(ve=>ve.relativePath??ve.fileName,[]),Jr=["youtube.com","www.youtube.com","m.youtube.com","youtu.be","music.youtube.com","instagram.com","www.instagram.com"],Ze=Ie.useCallback(ve=>{const ot=ve.trim();return!ot||/^https?:\/\//i.test(ot)?ot:"https://"+ot},[]),pt=Ie.useCallback(ve=>{try{const ot=new URL(Ze(ve)),Rt=ot.hostname.toLowerCase();return!!(ot.pathname.toLowerCase().endsWith(".mp3")||Jr.some(Zt=>Rt===Zt||Rt.endsWith("."+Zt)))}catch{return!1}},[Ze]),It=Ie.useCallback(ve=>{try{const ot=new URL(Ze(ve)),Rt=ot.hostname.toLowerCase();return Rt.includes("youtube")||Rt==="youtu.be"?"youtube":Rt.includes("instagram")?"instagram":ot.pathname.toLowerCase().endsWith(".mp3")?"mp3":null}catch{return null}},[Ze]),at=F?F.split(":")[0]:"",d=F?F.split(":")[1]:"",ee=Ie.useMemo(()=>k.find(ve=>`${ve.guildId}:${ve.channelId}`===F),[k,F]);Ie.useEffect(()=>{const ve=()=>{const Rt=new Date,Zt=String(Rt.getHours()).padStart(2,"0"),cn=String(Rt.getMinutes()).padStart(2,"0"),Yn=String(Rt.getSeconds()).padStart(2,"0");$t(`${Zt}:${cn}:${Yn}`)};ve();const ot=setInterval(ve,1e3);return()=>clearInterval(ot)},[]),Ie.useEffect(()=>{(async()=>{try{const[ve,ot]=await Promise.all([Mde(),Ede()]);if(H(ve),ve.length){const Rt=ve[0].guildId,Zt=ot[Rt],cn=Zt&&ve.find(Yn=>Yn.guildId===Rt&&Yn.channelId===Zt);V(cn?`${Rt}:${Zt}`:`${ve[0].guildId}:${ve[0].channelId}`)}}catch(ve){pn((ve==null?void 0:ve.message)||"Channel-Fehler","error")}try{Ge(await Bde())}catch{}try{const ve=await wde();u(ve.categories||[])}catch{}})()},[]),Ie.useEffect(()=>{localStorage.setItem("jb-theme",Se)},[Se]);const $n=Ie.useRef(null);Ie.useEffect(()=>{const ve=$n.current;if(!ve)return;ve.style.setProperty("--card-size",we+"px");const ot=we/110;ve.style.setProperty("--card-emoji",Math.round(28*ot)+"px"),ve.style.setProperty("--card-font",Math.max(9,Math.round(11*ot))+"px"),localStorage.setItem("jb-card-size",String(we))},[we]),Ie.useEffect(()=>{var ve,ot,Rt,Zt,cn,Yn,yi,js;if(i){if(i.soundboard){const pi=i.soundboard;Array.isArray(pi.party)&&De(pi.party);try{const Pr=pi.selected||{},Ei=(ve=X.current)==null?void 0:ve.split(":")[0];Ei&&Pr[Ei]&&V(`${Ei}:${Pr[Ei]}`)}catch{}try{const Pr=pi.volumes||{},Ei=(ot=X.current)==null?void 0:ot.split(":")[0];Ei&&typeof Pr[Ei]=="number"&&ne(Pr[Ei])}catch{}try{const Pr=pi.nowplaying||{},Ei=(Rt=X.current)==null?void 0:Rt.split(":")[0];Ei&&typeof Pr[Ei]=="string"&&ue(Pr[Ei])}catch{}try{const Pr=pi.voicestats||{},Ei=(Zt=X.current)==null?void 0:Zt.split(":")[0];Ei&&Pr[Ei]&&In(Pr[Ei])}catch{}}if(i.type==="soundboard_party")De(pi=>{const Pr=new Set(pi);return i.active?Pr.add(i.guildId):Pr.delete(i.guildId),Array.from(Pr)});else if(i.type==="soundboard_channel"){const pi=(cn=X.current)==null?void 0:cn.split(":")[0];i.guildId===pi&&V(`${i.guildId}:${i.channelId}`)}else if(i.type==="soundboard_volume"){const pi=(Yn=X.current)==null?void 0:Yn.split(":")[0];i.guildId===pi&&typeof i.volume=="number"&&ne(i.volume)}else if(i.type==="soundboard_nowplaying"){const pi=(yi=X.current)==null?void 0:yi.split(":")[0];i.guildId===pi&&ue(i.name||"")}else if(i.type==="soundboard_voicestats"){const pi=(js=X.current)==null?void 0:js.split(":")[0];i.guildId===pi&&In({voicePing:i.voicePing,gatewayPing:i.gatewayPing,status:i.status,channelName:i.channelName,connectedSince:i.connectedSince})}}},[i]),Ie.useEffect(()=>{ze(at?_e.includes(at):!1)},[F,_e,at]),Ie.useEffect(()=>{(async()=>{try{let ve="__all__";v==="recent"?ve="__recent__":S&&(ve=S);const ot=await A7(R,ve,void 0,!1);t(ot.items),r(ot.total),a(ot.folders)}catch(ve){pn((ve==null?void 0:ve.message)||"Sounds-Fehler","error")}})()},[v,S,R,qi,pn]),Ie.useEffect(()=>{Gn()},[qi]),Ie.useEffect(()=>{const ve=Sde("favs");if(ve)try{be(JSON.parse(ve))}catch{}},[]),Ie.useEffect(()=>{try{bde("favs",JSON.stringify(he))}catch{}},[he]),Ie.useEffect(()=>{F&&(async()=>{try{const ve=await Ude(at);ne(ve)}catch{}})()},[F]),Ie.useEffect(()=>{const ve=()=>{te(!1),xn(null)};return document.addEventListener("click",ve),()=>document.removeEventListener("click",ve)},[]),Ie.useEffect(()=>{Be&&Tt&&ae()},[Be,Tt]);async function Gn(){try{const ve=await Tde();g(ve)}catch{}}async function Xn(ve){if(!F)return pn("Bitte einen Voice-Channel auswaehlen","error");try{await Rde(ve.name,at,d,se,ve.relativePath),ue(ve.name),Gn()}catch(ot){pn((ot==null?void 0:ot.message)||"Play fehlgeschlagen","error")}}function un(){var Zt;const ve=Ze(E);if(!ve)return pn("Bitte einen Link eingeben","error");if(!pt(ve))return pn("Nur YouTube, Instagram oder direkte MP3-Links","error");const ot=It(ve);let Rt="";if(ot==="mp3")try{Rt=((Zt=new URL(ve).pathname.split("/").pop())==null?void 0:Zt.replace(/\.mp3$/i,""))??""}catch{}G({url:ve,type:ot,filename:Rt,phase:"input"})}async function qn(){if(z){G(ve=>ve?{...ve,phase:"downloading"}:null);try{let ve;const ot=z.filename.trim()||void 0;F&&at&&d?ve=(await Nde(z.url,at,d,se,ot)).saved:ve=(await Dde(z.url,ot)).saved,G(Rt=>Rt?{...Rt,phase:"done",savedName:ve}:null),B(""),rr(Rt=>Rt+1),Gn(),setTimeout(()=>G(null),2500)}catch(ve){G(ot=>ot?{...ot,phase:"error",error:(ve==null?void 0:ve.message)||"Fehler"}:null)}}}async function Hs(ve){if(!Tt){pn("Admin-Login erforderlich zum Hochladen","error");return}Ft.current&&clearTimeout(Ft.current);const ot=ve.map(Zt=>({id:Math.random().toString(36).slice(2),file:Zt,status:"waiting",progress:0}));St(ot),rn(!0);const Rt=[...ot];for(let Zt=0;Zt{Rt[Zt]={...Rt[Zt],progress:Yn},St([...Rt])});Rt[Zt]={...Rt[Zt],status:"done",progress:100,savedName:cn}}catch(cn){Rt[Zt]={...Rt[Zt],status:"error",error:(cn==null?void 0:cn.message)??"Fehler"}}St([...Rt])}rr(Zt=>Zt+1),Gn(),Ft.current=setTimeout(()=>{rn(!1),St([])},3500)}async function li(){if(F){ue("");try{await fetch(`${us}/stop?guildId=${encodeURIComponent(at)}`,{method:"POST"})}catch{}}}async function Fn(){if(!K.length||!F)return;const ve=K[Math.floor(Math.random()*K.length)];Xn(ve)}async function cs(){if(Te){await li();try{await Lde(at)}catch{}}else{if(!F)return pn("Bitte einen Channel auswaehlen","error");try{await Pde(at,d)}catch{}}}async function Ma(ve){const ot=`${ve.guildId}:${ve.channelId}`;V(ot),te(!1);try{await Cde(ve.guildId,ve.channelId)}catch{}}function Ul(ve){be(ot=>({...ot,[ve]:!ot[ve]}))}async function ae(){tn(!0);try{const ve=await A7("","__all__",void 0,!1);Dt(ve.items||[])}catch(ve){pn((ve==null?void 0:ve.message)||"Admin-Sounds konnten nicht geladen werden","error")}finally{tn(!1)}}function Ue(ve){Ce(ot=>({...ot,[ve]:!ot[ve]}))}function Qe(ve){it($i(ve)),Vt(ve.name)}function Xe(){it(""),Vt("")}async function Oe(){if(!$e)return;const ve=tt.trim().replace(/\.(mp3|wav)$/i,"");if(!ve){pn("Bitte einen gueltigen Namen eingeben","error");return}try{await kde($e,ve),pn("Sound umbenannt"),Xe(),rr(ot=>ot+1),Be&&await ae()}catch(ot){pn((ot==null?void 0:ot.message)||"Umbenennen fehlgeschlagen","error")}}async function Ot(ve){if(ve.length!==0)try{await Fde(ve),pn(ve.length===1?"Sound geloescht":`${ve.length} Sounds geloescht`),Ce({}),Xe(),rr(ot=>ot+1),Be&&await ae()}catch(ot){pn((ot==null?void 0:ot.message)||"Loeschen fehlgeschlagen","error")}}async function qt(){try{await Ode(oe)?(Ge(!0),Mt(""),pn("Admin eingeloggt")):pn("Falsches Passwort","error")}catch{pn("Login fehlgeschlagen","error")}}async function ft(){try{await Ide(),Ge(!1),Ce({}),Xe(),pn("Ausgeloggt")}catch{}}const K=Ie.useMemo(()=>v==="favorites"?e.filter(ve=>he[ve.relativePath??ve.fileName]):e,[e,v,he]),Ut=Ie.useMemo(()=>Object.values(he).filter(Boolean).length,[he]),bn=Ie.useMemo(()=>s.filter(ve=>!["__all__","__recent__","__top3__"].includes(ve.key)),[s]),fn=Ie.useMemo(()=>{const ve={};return bn.forEach((ot,Rt)=>{ve[ot.key]=p7[Rt%p7.length]}),ve},[bn]),ui=Ie.useMemo(()=>{const ve=new Set,ot=new Set;return K.forEach((Rt,Zt)=>{const cn=Rt.name.charAt(0).toUpperCase();ve.has(cn)||(ve.add(cn),ot.add(Zt))}),ot},[K]),ci=Ie.useMemo(()=>{const ve={};return k.forEach(ot=>{ve[ot.guildName]||(ve[ot.guildName]=[]),ve[ot.guildName].push(ot)}),ve},[k]),_i=Ie.useMemo(()=>{const ve=bt.trim().toLowerCase();return ve?lt.filter(ot=>{const Rt=$i(ot).toLowerCase();return ot.name.toLowerCase().includes(ve)||(ot.folder||"").toLowerCase().includes(ve)||Rt.includes(ve)}):lt},[bt,lt,$i]),Q=Ie.useMemo(()=>Object.keys(Y).filter(ve=>Y[ve]),[Y]),Ln=Ie.useMemo(()=>_i.filter(ve=>!!Y[$i(ve)]).length,[_i,Y,$i]),mn=_i.length>0&&Ln===_i.length,yr=h.mostPlayed.slice(0,10),hi=h.totalSounds||n,bs=_t.slice(0,5),fa=_t.slice(5);return W.jsxs("div",{className:"sb-app","data-theme":Se,ref:$n,children:[Te&&W.jsx("div",{className:"party-overlay active"}),W.jsxs("header",{className:"topbar",children:[W.jsxs("div",{className:"topbar-left",children:[W.jsx("div",{className:"sb-app-logo",children:W.jsx("span",{className:"material-icons",style:{fontSize:16,color:"white"},children:"music_note"})}),W.jsx("span",{className:"sb-app-title",children:"Soundboard"}),W.jsxs("div",{className:"channel-dropdown",onClick:ve=>ve.stopPropagation(),children:[W.jsxs("button",{className:`channel-btn ${J?"open":""}`,onClick:()=>te(!J),children:[W.jsx("span",{className:"material-icons cb-icon",children:"headset"}),F&&W.jsx("span",{className:"channel-status"}),W.jsx("span",{className:"channel-label",children:ee?`${ee.channelName}${ee.members?` (${ee.members})`:""}`:"Channel..."}),W.jsx("span",{className:"material-icons chevron",children:"expand_more"})]}),J&&W.jsxs("div",{className:"channel-menu visible",children:[Object.entries(ci).map(([ve,ot])=>W.jsxs(LF.Fragment,{children:[W.jsx("div",{className:"channel-menu-header",children:ve}),ot.map(Rt=>W.jsxs("div",{className:`channel-option ${`${Rt.guildId}:${Rt.channelId}`===F?"active":""}`,onClick:()=>Ma(Rt),children:[W.jsx("span",{className:"material-icons co-icon",children:"volume_up"}),Rt.channelName,Rt.members?` (${Rt.members})`:""]},`${Rt.guildId}:${Rt.channelId}`))]},ve)),k.length===0&&W.jsx("div",{className:"channel-option",style:{color:"var(--text-faint)",cursor:"default"},children:"Keine Channels verfuegbar"})]})]})]}),W.jsx("div",{className:"clock-wrap",children:W.jsxs("div",{className:"clock",children:[bs,W.jsx("span",{className:"clock-seconds",children:fa})]})}),W.jsxs("div",{className:"topbar-right",children:[Z&&W.jsxs("div",{className:"now-playing",children:[W.jsxs("div",{className:"np-waves active",children:[W.jsx("div",{className:"np-wave-bar"}),W.jsx("div",{className:"np-wave-bar"}),W.jsx("div",{className:"np-wave-bar"}),W.jsx("div",{className:"np-wave-bar"})]}),W.jsx("span",{className:"np-label",children:"Last Played:"})," ",W.jsx("span",{className:"np-name",children:Z})]}),F&&W.jsxs("div",{className:"connection",onClick:()=>me(!0),style:{cursor:"pointer"},title:"Verbindungsdetails",children:[W.jsx("span",{className:"conn-dot"}),"Verbunden",(Gt==null?void 0:Gt.voicePing)!=null&&W.jsxs("span",{className:"conn-ping",children:[Gt.voicePing,"ms"]})]}),W.jsx("button",{className:`admin-btn-icon ${Tt?"active":""}`,onClick:()=>ke(!0),title:"Admin",children:W.jsx("span",{className:"material-icons",children:"settings"})})]})]}),W.jsxs("div",{className:"toolbar",children:[W.jsxs("div",{className:"cat-tabs",children:[W.jsxs("button",{className:`cat-tab ${v==="all"?"active":""}`,onClick:()=>{x("all"),w("")},children:["Alle",W.jsx("span",{className:"tab-count",children:n})]}),W.jsx("button",{className:`cat-tab ${v==="recent"?"active":""}`,onClick:()=>{x("recent"),w("")},children:"Neu hinzugefuegt"}),W.jsxs("button",{className:`cat-tab ${v==="favorites"?"active":""}`,onClick:()=>{x("favorites"),w("")},children:["Favoriten",Ut>0&&W.jsx("span",{className:"tab-count",children:Ut})]})]}),W.jsxs("div",{className:"search-wrap",children:[W.jsx("span",{className:"material-icons search-icon",children:"search"}),W.jsx("input",{className:"search-input",type:"text",placeholder:"Suchen...",value:R,onChange:ve=>C(ve.target.value)}),R&&W.jsx("button",{className:"search-clear",onClick:()=>C(""),children:W.jsx("span",{className:"material-icons",style:{fontSize:14},children:"close"})})]}),W.jsxs("div",{className:"url-import-wrap",children:[W.jsx("span",{className:"material-icons url-import-icon",children:It(E)==="youtube"?"smart_display":It(E)==="instagram"?"photo_camera":"link"}),W.jsx("input",{className:"url-import-input",type:"text",placeholder:"YouTube / Instagram / MP3-Link...",value:E,onChange:ve=>B(ve.target.value),onKeyDown:ve=>{ve.key==="Enter"&&un()}}),E&&W.jsx("span",{className:`url-import-tag ${pt(E)?"valid":"invalid"}`,children:It(E)==="youtube"?"YT":It(E)==="instagram"?"IG":It(E)==="mp3"?"MP3":"?"}),W.jsx("button",{className:"url-import-btn",onClick:()=>{un()},disabled:L||!!E&&!pt(E),title:"Sound herunterladen",children:L?"Laedt...":"Download"})]}),W.jsx("div",{className:"toolbar-spacer"}),W.jsxs("div",{className:"volume-control",children:[W.jsx("span",{className:"material-icons vol-icon",onClick:()=>{const ve=se>0?0:.5;ne(ve),at&&d7(at,ve).catch(()=>{})},children:se===0?"volume_off":se<.5?"volume_down":"volume_up"}),W.jsx("input",{type:"range",className:"vol-slider",min:0,max:1,step:.01,value:se,onChange:ve=>{const ot=parseFloat(ve.target.value);ne(ot),at&&(vt.current&&clearTimeout(vt.current),vt.current=setTimeout(()=>{d7(at,ot).catch(()=>{})},120))},style:{"--vol":`${Math.round(se*100)}%`}}),W.jsxs("span",{className:"vol-pct",children:[Math.round(se*100),"%"]})]}),W.jsxs("button",{className:"tb-btn random",onClick:Fn,title:"Zufaelliger Sound",children:[W.jsx("span",{className:"material-icons tb-icon",children:"shuffle"}),"Random"]}),W.jsxs("button",{className:`tb-btn party ${Te?"active":""}`,onClick:cs,title:"Party Mode",children:[W.jsx("span",{className:"material-icons tb-icon",children:Te?"celebration":"auto_awesome"}),Te?"Party!":"Party"]}),W.jsxs("button",{className:"tb-btn stop",onClick:li,title:"Alle stoppen",children:[W.jsx("span",{className:"material-icons tb-icon",children:"stop"}),"Stop"]}),W.jsxs("div",{className:"size-control",title:"Button-Groesse",children:[W.jsx("span",{className:"material-icons sc-icon",children:"grid_view"}),W.jsx("input",{type:"range",className:"size-slider",min:80,max:160,value:we,onChange:ve=>We(parseInt(ve.target.value))})]}),W.jsx("div",{className:"theme-selector",children:Gde.map(ve=>W.jsx("div",{className:`theme-dot ${Se===ve.id?"active":""}`,style:{background:ve.color},title:ve.label,onClick:()=>le(ve.id)},ve.id))})]}),W.jsxs("div",{className:"analytics-strip",children:[W.jsxs("div",{className:"analytics-card",children:[W.jsx("span",{className:"material-icons analytics-icon",children:"library_music"}),W.jsxs("div",{className:"analytics-copy",children:[W.jsx("span",{className:"analytics-label",children:"Sounds gesamt"}),W.jsx("strong",{className:"analytics-value",children:hi})]})]}),W.jsxs("div",{className:"analytics-card analytics-wide",children:[W.jsx("span",{className:"material-icons analytics-icon",children:"leaderboard"}),W.jsxs("div",{className:"analytics-copy",children:[W.jsx("span",{className:"analytics-label",children:"Most Played"}),W.jsx("div",{className:"analytics-top-list",children:yr.length===0?W.jsx("span",{className:"analytics-muted",children:"Noch keine Plays"}):yr.map((ve,ot)=>W.jsxs("span",{className:"analytics-chip",children:[ot+1,". ",ve.name," (",ve.count,")"]},ve.relativePath))})]})]})]}),v==="all"&&bn.length>0&&W.jsx("div",{className:"category-strip",children:bn.map(ve=>{const ot=fn[ve.key]||"#888",Rt=S===ve.key;return W.jsxs("button",{className:`cat-chip ${Rt?"active":""}`,onClick:()=>w(Rt?"":ve.key),style:Rt?{borderColor:ot,color:ot}:void 0,children:[W.jsx("span",{className:"cat-dot",style:{background:ot}}),ve.name.replace(/\s*\(\d+\)\s*$/,""),W.jsx("span",{className:"cat-count",children:ve.count})]},ve.key)})}),W.jsx("main",{className:"main",children:K.length===0?W.jsxs("div",{className:"empty-state visible",children:[W.jsx("div",{className:"empty-emoji",children:v==="favorites"?"⭐":"🔇"}),W.jsx("div",{className:"empty-title",children:v==="favorites"?"Noch keine Favoriten":R?`Kein Sound fuer "${R}" gefunden`:"Keine Sounds vorhanden"}),W.jsx("div",{className:"empty-desc",children:v==="favorites"?"Klick den Stern auf einem Sound!":"Hier gibt's noch nichts zu hoeren."})]}):W.jsx("div",{className:"sound-grid",children:K.map((ve,ot)=>{var Pr;const Rt=ve.relativePath??ve.fileName,Zt=!!he[Rt],cn=Z===ve.name,Yn=ve.isRecent||((Pr=ve.badges)==null?void 0:Pr.includes("new")),yi=ve.name.charAt(0).toUpperCase(),js=ui.has(ot),pi=ve.folder&&fn[ve.folder]||"var(--accent)";return W.jsxs("div",{className:`sound-card ${cn?"playing":""} ${js?"has-initial":""}`,style:{animationDelay:`${Math.min(ot*20,400)}ms`},onClick:Ei=>{const Zh=Ei.currentTarget,Bl=Zh.getBoundingClientRect(),nl=document.createElement("div");nl.className="ripple";const Bi=Math.max(Bl.width,Bl.height);nl.style.width=nl.style.height=Bi+"px",nl.style.left=Ei.clientX-Bl.left-Bi/2+"px",nl.style.top=Ei.clientY-Bl.top-Bi/2+"px",Zh.appendChild(nl),setTimeout(()=>nl.remove(),500),Xn(ve)},onContextMenu:Ei=>{Ei.preventDefault(),Ei.stopPropagation(),xn({x:Math.min(Ei.clientX,window.innerWidth-170),y:Math.min(Ei.clientY,window.innerHeight-140),sound:ve})},title:`${ve.name}${ve.folder?` (${ve.folder})`:""}`,children:[Yn&&W.jsx("span",{className:"new-badge",children:"NEU"}),W.jsx("span",{className:`fav-star ${Zt?"active":""}`,onClick:Ei=>{Ei.stopPropagation(),Ul(Rt)},children:W.jsx("span",{className:"material-icons fav-icon",children:Zt?"star":"star_border"})}),js&&W.jsx("span",{className:"sound-emoji",style:{color:pi},children:yi}),W.jsx("span",{className:"sound-name",children:ve.name}),ve.folder&&W.jsx("span",{className:"sound-duration",children:ve.folder}),W.jsxs("div",{className:"playing-indicator",children:[W.jsx("div",{className:"wave-bar"}),W.jsx("div",{className:"wave-bar"}),W.jsx("div",{className:"wave-bar"}),W.jsx("div",{className:"wave-bar"})]})]},Rt)})})}),kt&&W.jsxs("div",{className:"ctx-menu visible",style:{left:kt.x,top:kt.y},onClick:ve=>ve.stopPropagation(),children:[W.jsxs("div",{className:"ctx-item",onClick:()=>{Xn(kt.sound),xn(null)},children:[W.jsx("span",{className:"material-icons ctx-icon",children:"play_arrow"}),"Abspielen"]}),W.jsxs("div",{className:"ctx-item",onClick:()=>{Ul(kt.sound.relativePath??kt.sound.fileName),xn(null)},children:[W.jsx("span",{className:"material-icons ctx-icon",children:he[kt.sound.relativePath??kt.sound.fileName]?"star":"star_border"}),"Favorit"]}),Tt&&W.jsxs(W.Fragment,{children:[W.jsx("div",{className:"ctx-sep"}),W.jsxs("div",{className:"ctx-item danger",onClick:async()=>{const ve=kt.sound.relativePath??kt.sound.fileName;await Ot([ve]),xn(null)},children:[W.jsx("span",{className:"material-icons ctx-icon",children:"delete"}),"Loeschen"]})]})]}),Mi&&(()=>{const ve=Gt!=null&&Gt.connectedSince?Math.floor((Date.now()-new Date(Gt.connectedSince).getTime())/1e3):0,ot=Math.floor(ve/3600),Rt=Math.floor(ve%3600/60),Zt=ve%60,cn=ot>0?`${ot}h ${String(Rt).padStart(2,"0")}m ${String(Zt).padStart(2,"0")}s`:Rt>0?`${Rt}m ${String(Zt).padStart(2,"0")}s`:`${Zt}s`,Yn=yi=>yi==null?"var(--muted)":yi<80?"var(--green)":yi<150?"#f0a830":"#e04040";return W.jsx("div",{className:"conn-modal-overlay",onClick:()=>me(!1),children:W.jsxs("div",{className:"conn-modal",onClick:yi=>yi.stopPropagation(),children:[W.jsxs("div",{className:"conn-modal-header",children:[W.jsx("span",{className:"material-icons",style:{fontSize:20,color:"var(--green)"},children:"cell_tower"}),W.jsx("span",{children:"Verbindungsdetails"}),W.jsx("button",{className:"conn-modal-close",onClick:()=>me(!1),children:W.jsx("span",{className:"material-icons",children:"close"})})]}),W.jsxs("div",{className:"conn-modal-body",children:[W.jsxs("div",{className:"conn-stat",children:[W.jsx("span",{className:"conn-stat-label",children:"Voice Ping"}),W.jsxs("span",{className:"conn-stat-value",children:[W.jsx("span",{className:"conn-ping-dot",style:{background:Yn((Gt==null?void 0:Gt.voicePing)??null)}}),(Gt==null?void 0:Gt.voicePing)!=null?`${Gt.voicePing} ms`:"---"]})]}),W.jsxs("div",{className:"conn-stat",children:[W.jsx("span",{className:"conn-stat-label",children:"Gateway Ping"}),W.jsxs("span",{className:"conn-stat-value",children:[W.jsx("span",{className:"conn-ping-dot",style:{background:Yn((Gt==null?void 0:Gt.gatewayPing)??null)}}),Gt&&Gt.gatewayPing>=0?`${Gt.gatewayPing} ms`:"---"]})]}),W.jsxs("div",{className:"conn-stat",children:[W.jsx("span",{className:"conn-stat-label",children:"Status"}),W.jsx("span",{className:"conn-stat-value",style:{color:(Gt==null?void 0:Gt.status)==="ready"?"var(--green)":"#f0a830"},children:(Gt==null?void 0:Gt.status)==="ready"?"Verbunden":(Gt==null?void 0:Gt.status)??"Warte auf Verbindung"})]}),W.jsxs("div",{className:"conn-stat",children:[W.jsx("span",{className:"conn-stat-label",children:"Kanal"}),W.jsx("span",{className:"conn-stat-value",children:(Gt==null?void 0:Gt.channelName)||"---"})]}),W.jsxs("div",{className:"conn-stat",children:[W.jsx("span",{className:"conn-stat-label",children:"Verbunden seit"}),W.jsx("span",{className:"conn-stat-value",children:cn||"---"})]})]})]})})})(),jt&&W.jsxs("div",{className:`toast ${jt.type}`,children:[W.jsx("span",{className:"material-icons toast-icon",children:jt.type==="error"?"error_outline":"check_circle"}),jt.msg]}),Be&&W.jsx("div",{className:"admin-overlay",onClick:ve=>{ve.target===ve.currentTarget&&ke(!1)},children:W.jsxs("div",{className:"admin-panel",children:[W.jsxs("h3",{children:["Admin",W.jsx("button",{className:"admin-close",onClick:()=>ke(!1),children:W.jsx("span",{className:"material-icons",style:{fontSize:18},children:"close"})})]}),Tt?W.jsxs("div",{className:"admin-shell",children:[W.jsxs("div",{className:"admin-header-row",children:[W.jsx("p",{className:"admin-status",children:"Eingeloggt als Admin"}),W.jsxs("div",{className:"admin-actions-inline",children:[W.jsx("button",{className:"admin-btn-action outline",onClick:()=>{ae()},disabled:wt,children:"Aktualisieren"}),W.jsx("button",{className:"admin-btn-action outline",onClick:ft,children:"Logout"})]})]}),W.jsxs("div",{className:"admin-field admin-search-field",children:[W.jsx("label",{children:"Sounds verwalten"}),W.jsx("input",{type:"text",value:bt,onChange:ve=>fe(ve.target.value),placeholder:"Nach Name, Ordner oder Pfad filtern..."})]}),W.jsxs("div",{className:"admin-bulk-row",children:[W.jsxs("label",{className:"admin-select-all",children:[W.jsx("input",{type:"checkbox",checked:mn,onChange:ve=>{const ot=ve.target.checked,Rt={...Y};_i.forEach(Zt=>{Rt[$i(Zt)]=ot}),Ce(Rt)}}),W.jsxs("span",{children:["Alle sichtbaren auswaehlen (",Ln,"/",_i.length,")"]})]}),W.jsx("button",{className:"admin-btn-action danger",disabled:Q.length===0,onClick:async()=>{window.confirm(`Wirklich ${Q.length} Sound(s) loeschen?`)&&await Ot(Q)},children:"Ausgewaehlte loeschen"})]}),W.jsx("div",{className:"admin-list-wrap",children:wt?W.jsx("div",{className:"admin-empty",children:"Lade Sounds..."}):_i.length===0?W.jsx("div",{className:"admin-empty",children:"Keine Sounds gefunden."}):W.jsx("div",{className:"admin-list",children:_i.map(ve=>{const ot=$i(ve),Rt=$e===ot;return W.jsxs("div",{className:"admin-item",children:[W.jsx("label",{className:"admin-item-check",children:W.jsx("input",{type:"checkbox",checked:!!Y[ot],onChange:()=>Ue(ot)})}),W.jsxs("div",{className:"admin-item-main",children:[W.jsx("div",{className:"admin-item-name",children:ve.name}),W.jsxs("div",{className:"admin-item-meta",children:[ve.folder?`Ordner: ${ve.folder}`:"Root"," · ",ot]}),Rt&&W.jsxs("div",{className:"admin-rename-row",children:[W.jsx("input",{value:tt,onChange:Zt=>Vt(Zt.target.value),onKeyDown:Zt=>{Zt.key==="Enter"&&Oe(),Zt.key==="Escape"&&Xe()},placeholder:"Neuer Name..."}),W.jsx("button",{className:"admin-btn-action primary",onClick:()=>{Oe()},children:"Speichern"}),W.jsx("button",{className:"admin-btn-action outline",onClick:Xe,children:"Abbrechen"})]})]}),!Rt&&W.jsxs("div",{className:"admin-item-actions",children:[W.jsx("button",{className:"admin-btn-action outline",onClick:()=>Qe(ve),children:"Umbenennen"}),W.jsx("button",{className:"admin-btn-action danger ghost",onClick:async()=>{window.confirm(`Sound "${ve.name}" loeschen?`)&&await Ot([ot])},children:"Loeschen"})]})]},ot)})})})]}):W.jsxs("div",{children:[W.jsxs("div",{className:"admin-field",children:[W.jsx("label",{children:"Passwort"}),W.jsx("input",{type:"password",value:oe,onChange:ve=>Mt(ve.target.value),onKeyDown:ve=>ve.key==="Enter"&&qt(),placeholder:"Admin-Passwort..."})]}),W.jsx("button",{className:"admin-btn-action primary",onClick:qt,children:"Login"})]})]})}),Bt&&W.jsx("div",{className:"drop-overlay",children:W.jsxs("div",{className:"drop-zone",children:[W.jsx("span",{className:"material-icons drop-icon",children:"cloud_upload"}),W.jsx("div",{className:"drop-title",children:"MP3 & WAV hier ablegen"}),W.jsx("div",{className:"drop-sub",children:"Mehrere Dateien gleichzeitig moeglich"})]})}),Kt&&ln.length>0&&W.jsxs("div",{className:"upload-queue",children:[W.jsxs("div",{className:"uq-header",children:[W.jsx("span",{className:"material-icons",style:{fontSize:16},children:"upload"}),W.jsx("span",{children:ln.every(ve=>ve.status==="done"||ve.status==="error")?`${ln.filter(ve=>ve.status==="done").length} von ${ln.length} hochgeladen`:`Lade hoch… (${ln.filter(ve=>ve.status==="done").length}/${ln.length})`}),W.jsx("button",{className:"uq-close",onClick:()=>{rn(!1),St([])},children:W.jsx("span",{className:"material-icons",style:{fontSize:14},children:"close"})})]}),W.jsx("div",{className:"uq-list",children:ln.map(ve=>W.jsxs("div",{className:`uq-item uq-${ve.status}`,children:[W.jsx("span",{className:"material-icons uq-file-icon",children:"audio_file"}),W.jsxs("div",{className:"uq-info",children:[W.jsx("div",{className:"uq-name",title:ve.savedName??ve.file.name,children:ve.savedName??ve.file.name}),W.jsxs("div",{className:"uq-size",children:[(ve.file.size/1024).toFixed(0)," KB"]})]}),(ve.status==="waiting"||ve.status==="uploading")&&W.jsx("div",{className:"uq-progress-wrap",children:W.jsx("div",{className:"uq-progress-bar",style:{width:`${ve.progress}%`}})}),W.jsx("span",{className:`material-icons uq-status-icon uq-status-${ve.status}`,children:ve.status==="done"?"check_circle":ve.status==="error"?"error":ve.status==="uploading"?"sync":"schedule"}),ve.status==="error"&&W.jsx("div",{className:"uq-error",children:ve.error})]},ve.id))})]}),z&&W.jsx("div",{className:"dl-modal-overlay",onClick:()=>z.phase!=="downloading"&&G(null),children:W.jsxs("div",{className:"dl-modal",onClick:ve=>ve.stopPropagation(),children:[W.jsxs("div",{className:"dl-modal-header",children:[W.jsx("span",{className:"material-icons",style:{fontSize:20},children:z.type==="youtube"?"smart_display":z.type==="instagram"?"photo_camera":"audio_file"}),W.jsx("span",{children:z.phase==="input"?"Sound herunterladen":z.phase==="downloading"?"Wird heruntergeladen...":z.phase==="done"?"Fertig!":"Fehler"}),z.phase!=="downloading"&&W.jsx("button",{className:"dl-modal-close",onClick:()=>G(null),children:W.jsx("span",{className:"material-icons",style:{fontSize:16},children:"close"})})]}),W.jsxs("div",{className:"dl-modal-body",children:[W.jsxs("div",{className:"dl-modal-url",children:[W.jsx("span",{className:`dl-modal-tag ${z.type??""}`,children:z.type==="youtube"?"YouTube":z.type==="instagram"?"Instagram":"MP3"}),W.jsx("span",{className:"dl-modal-url-text",title:z.url,children:z.url.length>60?z.url.slice(0,57)+"...":z.url})]}),z.phase==="input"&&W.jsxs("div",{className:"dl-modal-field",children:[W.jsx("label",{className:"dl-modal-label",children:"Dateiname"}),W.jsxs("div",{className:"dl-modal-input-wrap",children:[W.jsx("input",{className:"dl-modal-input",type:"text",placeholder:z.type==="mp3"?"Dateiname...":"Wird automatisch erkannt...",value:z.filename,onChange:ve=>G(ot=>ot?{...ot,filename:ve.target.value}:null),onKeyDown:ve=>{ve.key==="Enter"&&qn()},autoFocus:!0}),W.jsx("span",{className:"dl-modal-ext",children:".mp3"})]}),W.jsx("span",{className:"dl-modal-hint",children:"Leer lassen = automatischer Name"})]}),z.phase==="downloading"&&W.jsxs("div",{className:"dl-modal-progress",children:[W.jsx("div",{className:"dl-modal-spinner"}),W.jsx("span",{children:z.type==="youtube"||z.type==="instagram"?"Audio wird extrahiert...":"MP3 wird heruntergeladen..."})]}),z.phase==="done"&&W.jsxs("div",{className:"dl-modal-success",children:[W.jsx("span",{className:"material-icons dl-modal-check",children:"check_circle"}),W.jsxs("span",{children:["Gespeichert als ",W.jsx("b",{children:z.savedName})]})]}),z.phase==="error"&&W.jsxs("div",{className:"dl-modal-error",children:[W.jsx("span",{className:"material-icons",style:{color:"#e74c3c"},children:"error"}),W.jsx("span",{children:z.error})]})]}),z.phase==="input"&&W.jsxs("div",{className:"dl-modal-actions",children:[W.jsx("button",{className:"dl-modal-cancel",onClick:()=>G(null),children:"Abbrechen"}),W.jsxs("button",{className:"dl-modal-submit",onClick:()=>void qn(),children:[W.jsx("span",{className:"material-icons",style:{fontSize:16},children:"download"}),"Herunterladen"]})]}),z.phase==="error"&&W.jsxs("div",{className:"dl-modal-actions",children:[W.jsx("button",{className:"dl-modal-cancel",onClick:()=>G(null),children:"Schliessen"}),W.jsxs("button",{className:"dl-modal-submit",onClick:()=>G(ve=>ve?{...ve,phase:"input",error:void 0}:null),children:[W.jsx("span",{className:"material-icons",style:{fontSize:16},children:"refresh"}),"Nochmal"]})]})]})})]})}const m7={IRON:"#6b6b6b",BRONZE:"#8c6239",SILVER:"#8c8c8c",GOLD:"#d4a017",PLATINUM:"#28b29e",EMERALD:"#1e9e5e",DIAMOND:"#576cce",MASTER:"#9d48e0",GRANDMASTER:"#e44c3e",CHALLENGER:"#f4c874"},Vde={SOLORANKED:"Ranked Solo",FLEXRANKED:"Ranked Flex",NORMAL:"Normal",ARAM:"ARAM",ARENA:"Arena",URF:"URF",BOT:"Co-op vs AI"},Hde="https://ddragon.leagueoflegends.com/cdn/15.5.1/img";function zv(i){return`${Hde}/champion/${i}.png`}function g7(i){const e=Math.floor((Date.now()-new Date(i).getTime())/1e3);return e<60?`${e}s`:e<3600?`${Math.floor(e/60)}m`:e<86400?`${Math.floor(e/3600)}h`:`${Math.floor(e/86400)}d`}function jde(i){const e=Math.floor(i/60),t=i%60;return`${e}:${String(t).padStart(2,"0")}`}function v7(i,e,t){return e===0?"Perfect":((i+t)/e).toFixed(2)}function _7(i,e){const t=i+e;return t>0?Math.round(i/t*100):0}function Wde(i,e){if(!i)return"Unranked";const t=["","I","II","III","IV"];return`${i.charAt(0)}${i.slice(1).toLowerCase()}${e?" "+(t[e]??e):""}`}function $de({data:i}){var we,We,Te,ze;const[e,t]=Ie.useState(""),[n,r]=Ie.useState("EUW"),[s,a]=Ie.useState([]),[l,u]=Ie.useState(null),[h,g]=Ie.useState([]),[v,x]=Ie.useState(!1),[S,w]=Ie.useState(null),[R,C]=Ie.useState([]),[E,B]=Ie.useState(null),[L,O]=Ie.useState({}),[z,G]=Ie.useState(!1),[k,H]=Ie.useState(!1),[F,V]=Ie.useState(null),X=Ie.useRef(null),J=Ie.useRef(null);Ie.useEffect(()=>{fetch("/api/lolstats/regions").then(_e=>_e.json()).then(a).catch(()=>{}),fetch("/api/lolstats/recent").then(_e=>_e.json()).then(C).catch(()=>{})},[]),Ie.useEffect(()=>{i&&(i.recentSearches&&C(i.recentSearches),i.regions&&!s.length&&a(i.regions))},[i]);const te=Ie.useCallback(async(_e,De,dt)=>{H(!0);try{const vt=`gameName=${encodeURIComponent(_e)}&tagLine=${encodeURIComponent(De)}®ion=${dt}`,Tt=await fetch(`/api/lolstats/renew?${vt}`,{method:"POST"});if(Tt.ok){const Ge=await Tt.json();return Ge.last_updated_at&&V(Ge.last_updated_at),Ge.renewed??!1}}catch{}return H(!1),!1},[]),se=Ie.useCallback(async(_e,De,dt,vt=!1)=>{var ke,oe;let Tt=_e??"",Ge=De??"";const Be=dt??n;if(!Tt){const Mt=e.split("#");Tt=((ke=Mt[0])==null?void 0:ke.trim())??"",Ge=((oe=Mt[1])==null?void 0:oe.trim())??""}if(!Tt||!Ge){w("Bitte im Format Name#Tag eingeben");return}x(!0),w(null),u(null),g([]),B(null),O({}),J.current={gameName:Tt,tagLine:Ge,region:Be},vt||te(Tt,Ge,Be).finally(()=>H(!1));try{const Mt=`gameName=${encodeURIComponent(Tt)}&tagLine=${encodeURIComponent(Ge)}®ion=${Be}`,[lt,Dt]=await Promise.all([fetch(`/api/lolstats/profile?${Mt}`),fetch(`/api/lolstats/matches?${Mt}&limit=10`)]);if(!lt.ok){const tn=await lt.json();throw new Error(tn.error??`Fehler ${lt.status}`)}const wt=await lt.json();if(u(wt),wt.updated_at&&V(wt.updated_at),Dt.ok){const tn=await Dt.json();g(Array.isArray(tn)?tn:[])}}catch(Mt){w(Mt.message)}x(!1)},[e,n,te]),ne=Ie.useCallback(async()=>{const _e=J.current;if(!(!_e||k)){H(!0);try{await te(_e.gameName,_e.tagLine,_e.region),await new Promise(De=>setTimeout(De,1500)),await se(_e.gameName,_e.tagLine,_e.region,!0)}finally{H(!1)}}},[te,se,k]),Z=Ie.useCallback(async()=>{if(!(!l||z)){G(!0);try{const _e=`gameName=${encodeURIComponent(l.game_name)}&tagLine=${encodeURIComponent(l.tagline)}®ion=${n}&limit=20`,De=await fetch(`/api/lolstats/matches?${_e}`);if(De.ok){const dt=await De.json();g(Array.isArray(dt)?dt:[])}}catch{}G(!1)}},[l,n,z]),ue=Ie.useCallback(async _e=>{var De;if(E===_e.id){B(null);return}if(B(_e.id),!(((De=_e.participants)==null?void 0:De.length)>=10||L[_e.id]))try{const dt=`region=${n}&createdAt=${encodeURIComponent(_e.created_at)}`,vt=await fetch(`/api/lolstats/match/${encodeURIComponent(_e.id)}?${dt}`);if(vt.ok){const Tt=await vt.json();O(Ge=>({...Ge,[_e.id]:Tt}))}}catch{}},[E,L,n]),he=Ie.useCallback(_e=>{t(`${_e.game_name}#${_e.tag_line}`),r(_e.region),se(_e.game_name,_e.tag_line,_e.region)},[se]),be=Ie.useCallback(_e=>{var dt,vt,Tt;if(!l)return((dt=_e.participants)==null?void 0:dt[0])??null;const De=l.game_name.toLowerCase();return((vt=_e.participants)==null?void 0:vt.find(Ge=>{var Be,ke;return((ke=(Be=Ge.summoner)==null?void 0:Be.game_name)==null?void 0:ke.toLowerCase())===De}))??((Tt=_e.participants)==null?void 0:Tt[0])??null},[l]),Se=_e=>{var oe,Mt,lt;const De=be(_e);if(!De)return null;const dt=((oe=De.stats)==null?void 0:oe.result)==="WIN",vt=v7(De.stats.kill,De.stats.death,De.stats.assist),Tt=(De.stats.minion_kill??0)+(De.stats.neutral_minion_kill??0),Ge=_e.game_length_second>0?(Tt/(_e.game_length_second/60)).toFixed(1):"0",Be=E===_e.id,ke=L[_e.id]??(((Mt=_e.participants)==null?void 0:Mt.length)>=10?_e:null);return W.jsxs("div",{children:[W.jsxs("div",{className:`lol-match ${dt?"win":"loss"}`,onClick:()=>ue(_e),children:[W.jsx("div",{className:"lol-match-result",children:dt?"W":"L"}),W.jsxs("div",{className:"lol-match-champ",children:[W.jsx("img",{src:zv(De.champion_name),alt:De.champion_name,title:De.champion_name}),W.jsx("span",{className:"lol-match-champ-level",children:De.stats.champion_level})]}),W.jsxs("div",{className:"lol-match-kda",children:[W.jsxs("div",{className:"lol-match-kda-nums",children:[De.stats.kill,"/",De.stats.death,"/",De.stats.assist]}),W.jsxs("div",{className:`lol-match-kda-ratio ${vt==="Perfect"?"perfect":Number(vt)>=4?"great":""}`,children:[vt," KDA"]})]}),W.jsxs("div",{className:"lol-match-stats",children:[W.jsxs("span",{children:[Tt," CS (",Ge,"/m)"]}),W.jsxs("span",{children:[De.stats.ward_place," wards"]})]}),W.jsx("div",{className:"lol-match-items",children:(De.items_names??[]).slice(0,7).map((Dt,wt)=>Dt?W.jsx("img",{src:zv("Aatrox"),alt:Dt,title:Dt,style:{background:"var(--bg-deep)"},onError:tn=>{tn.target.style.display="none"}},wt):W.jsx("div",{className:"lol-match-item-empty"},wt))}),W.jsxs("div",{className:"lol-match-meta",children:[W.jsx("div",{className:"lol-match-duration",children:jde(_e.game_length_second)}),W.jsx("div",{className:"lol-match-queue",children:Vde[_e.game_type]??_e.game_type}),W.jsxs("div",{className:"lol-match-ago",children:[g7(_e.created_at)," ago"]})]})]}),Be&&ke&&W.jsx("div",{className:"lol-match-detail",children:le(ke,(lt=De.summoner)==null?void 0:lt.game_name)})]},_e.id)},le=(_e,De)=>{var Be,ke,oe,Mt,lt;const dt=((Be=_e.participants)==null?void 0:Be.filter(Dt=>Dt.team_key==="BLUE"))??[],vt=((ke=_e.participants)==null?void 0:ke.filter(Dt=>Dt.team_key==="RED"))??[],Tt=(lt=(Mt=(oe=_e.teams)==null?void 0:oe.find(Dt=>Dt.key==="BLUE"))==null?void 0:Mt.game_stat)==null?void 0:lt.is_win,Ge=(Dt,wt,tn)=>W.jsxs("div",{className:"lol-match-detail-team",children:[W.jsxs("div",{className:`lol-match-detail-team-header ${wt?"win":"loss"}`,children:[tn," — ",wt?"Victory":"Defeat"]}),Dt.map((bt,fe)=>{var $e,it,tt,Vt,Bt,Wt,ln,St,Kt,rn,Ht,Ft;const Y=((it=($e=bt.summoner)==null?void 0:$e.game_name)==null?void 0:it.toLowerCase())===(De==null?void 0:De.toLowerCase()),Ce=(((tt=bt.stats)==null?void 0:tt.minion_kill)??0)+(((Vt=bt.stats)==null?void 0:Vt.neutral_minion_kill)??0);return W.jsxs("div",{className:`lol-detail-row ${Y?"me":""}`,children:[W.jsx("img",{className:"lol-detail-champ",src:zv(bt.champion_name),alt:bt.champion_name}),W.jsx("span",{className:"lol-detail-name",title:`${(Bt=bt.summoner)==null?void 0:Bt.game_name}#${(Wt=bt.summoner)==null?void 0:Wt.tagline}`,children:((ln=bt.summoner)==null?void 0:ln.game_name)??bt.champion_name}),W.jsxs("span",{className:"lol-detail-kda",children:[(St=bt.stats)==null?void 0:St.kill,"/",(Kt=bt.stats)==null?void 0:Kt.death,"/",(rn=bt.stats)==null?void 0:rn.assist]}),W.jsxs("span",{className:"lol-detail-cs",children:[Ce," CS"]}),W.jsxs("span",{className:"lol-detail-dmg",children:[((((Ht=bt.stats)==null?void 0:Ht.total_damage_dealt_to_champions)??0)/1e3).toFixed(1),"k"]}),W.jsxs("span",{className:"lol-detail-gold",children:[((((Ft=bt.stats)==null?void 0:Ft.gold_earned)??0)/1e3).toFixed(1),"k"]})]},fe)})]});return W.jsxs(W.Fragment,{children:[Ge(dt,Tt,"Blue Team"),Ge(vt,Tt===void 0?void 0:!Tt,"Red Team")]})};return W.jsxs("div",{className:"lol-container",children:[W.jsxs("div",{className:"lol-search",children:[W.jsx("input",{ref:X,className:"lol-search-input",placeholder:"Summoner Name#Tag",value:e,onChange:_e=>t(_e.target.value),onKeyDown:_e=>_e.key==="Enter"&&se()}),W.jsx("select",{className:"lol-search-region",value:n,onChange:_e=>r(_e.target.value),children:s.map(_e=>W.jsx("option",{value:_e.code,children:_e.code},_e.code))}),W.jsx("button",{className:"lol-search-btn",onClick:()=>se(),disabled:v,children:v?"...":"Search"})]}),R.length>0&&W.jsx("div",{className:"lol-recent",children:R.map((_e,De)=>W.jsxs("button",{className:"lol-recent-chip",onClick:()=>he(_e),children:[_e.profile_image_url&&W.jsx("img",{src:_e.profile_image_url,alt:""}),_e.game_name,"#",_e.tag_line,_e.tier&&W.jsx("span",{className:"lol-recent-tier",style:{color:m7[_e.tier]},children:_e.tier})]},De))}),S&&W.jsx("div",{className:"lol-error",children:S}),v&&W.jsxs("div",{className:"lol-loading",children:[W.jsx("div",{className:"lol-spinner"}),"Lade Profil..."]}),l&&!v&&W.jsxs(W.Fragment,{children:[W.jsxs("div",{className:"lol-profile",children:[W.jsx("img",{className:"lol-profile-icon",src:l.profile_image_url,alt:""}),W.jsxs("div",{className:"lol-profile-info",children:[W.jsxs("h2",{children:[l.game_name,W.jsxs("span",{children:["#",l.tagline]})]}),W.jsxs("div",{className:"lol-profile-level",children:["Level ",l.level]}),((we=l.ladder_rank)==null?void 0:we.rank)&&W.jsxs("div",{className:"lol-profile-ladder",children:["Ladder Rank #",l.ladder_rank.rank.toLocaleString()," / ",(We=l.ladder_rank.total)==null?void 0:We.toLocaleString()]}),F&&W.jsxs("div",{className:"lol-profile-updated",children:["Updated ",g7(F)," ago"]})]}),W.jsxs("button",{className:`lol-update-btn ${k?"renewing":""}`,onClick:ne,disabled:k,title:"Refresh data from Riot servers",children:[W.jsx("span",{className:"lol-update-icon",children:k?"⟳":"↻"}),k?"Updating...":"Update"]})]}),W.jsx("div",{className:"lol-ranked-row",children:(l.league_stats??[]).filter(_e=>_e.game_type==="SOLORANKED"||_e.game_type==="FLEXRANKED").map(_e=>{const De=_e.tier_info,dt=!!(De!=null&&De.tier),vt=m7[(De==null?void 0:De.tier)??""]??"var(--text-normal)";return W.jsxs("div",{className:`lol-ranked-card ${dt?"has-rank":""}`,style:{"--tier-color":vt},children:[W.jsx("div",{className:"lol-ranked-type",children:_e.game_type==="SOLORANKED"?"Ranked Solo/Duo":"Ranked Flex"}),dt?W.jsxs(W.Fragment,{children:[W.jsxs("div",{className:"lol-ranked-tier",style:{color:vt},children:[Wde(De.tier,De.division),W.jsxs("span",{className:"lol-ranked-lp",children:[De.lp," LP"]})]}),W.jsxs("div",{className:"lol-ranked-record",children:[_e.win,"W ",_e.lose,"L",W.jsxs("span",{className:"lol-ranked-wr",children:["(",_7(_e.win??0,_e.lose??0),"%)"]}),_e.is_hot_streak&&W.jsx("span",{className:"lol-ranked-streak",children:"🔥"})]})]}):W.jsx("div",{className:"lol-ranked-tier",children:"Unranked"})]},_e.game_type)})}),((ze=(Te=l.most_champions)==null?void 0:Te.champion_stats)==null?void 0:ze.length)>0&&W.jsxs(W.Fragment,{children:[W.jsx("div",{className:"lol-section-title",children:"Top Champions"}),W.jsx("div",{className:"lol-champs",children:l.most_champions.champion_stats.slice(0,7).map(_e=>{const De=_7(_e.win,_e.lose),dt=_e.play>0?v7(_e.kill/_e.play,_e.death/_e.play,_e.assist/_e.play):"0";return W.jsxs("div",{className:"lol-champ-card",children:[W.jsx("img",{className:"lol-champ-icon",src:zv(_e.champion_name),alt:_e.champion_name}),W.jsxs("div",{children:[W.jsx("div",{className:"lol-champ-name",children:_e.champion_name}),W.jsxs("div",{className:"lol-champ-stats",children:[_e.play," games · ",De,"% WR"]}),W.jsxs("div",{className:"lol-champ-kda",children:[dt," KDA"]})]})]},_e.champion_name)})})]}),h.length>0&&W.jsxs(W.Fragment,{children:[W.jsx("div",{className:"lol-section-title",children:"Match History"}),W.jsx("div",{className:"lol-matches",children:h.map(_e=>Se(_e))}),h.length<20&&W.jsx("button",{className:"lol-load-more",onClick:Z,disabled:z,children:z?"Laden...":"Mehr laden"})]})]}),!l&&!v&&!S&&W.jsxs("div",{className:"lol-empty",children:[W.jsx("div",{className:"lol-empty-icon",children:"⚔️"}),W.jsx("h3",{children:"League of Legends Stats"}),W.jsx("p",{children:"Gib einen Summoner Name#Tag ein und wähle die Region"})]})]})}const y7={iceServers:[{urls:"stun:stun.l.google.com:19302"},{urls:"stun:stun1.l.google.com:19302"}]};function x7(i){const e=Math.max(0,Math.floor((Date.now()-new Date(i).getTime())/1e3)),t=Math.floor(e/3600),n=Math.floor(e%3600/60),r=e%60;return t>0?`${t}:${String(n).padStart(2,"0")}:${String(r).padStart(2,"0")}`:`${n}:${String(r).padStart(2,"0")}`}function Xde({data:i}){var vt,Tt;const[e,t]=Ie.useState([]),[n,r]=Ie.useState(()=>localStorage.getItem("streaming_name")||""),[s,a]=Ie.useState("Screen Share"),[l,u]=Ie.useState(""),[h,g]=Ie.useState(null),[v,x]=Ie.useState(null),[S,w]=Ie.useState(null),[R,C]=Ie.useState(!1),[E,B]=Ie.useState(!1),[L,O]=Ie.useState(null),[,z]=Ie.useState(0),G=Ie.useRef(null),k=Ie.useRef(""),H=Ie.useRef(null),F=Ie.useRef(null),V=Ie.useRef(null),X=Ie.useRef(new Map),J=Ie.useRef(null),te=Ie.useRef(new Map),se=Ie.useRef(null),ne=Ie.useRef(1e3),Z=Ie.useRef(!1),ue=Ie.useRef(null);Ie.useEffect(()=>{Z.current=R},[R]),Ie.useEffect(()=>{ue.current=L},[L]),Ie.useEffect(()=>{if(!(e.length>0||R))return;const Be=setInterval(()=>z(ke=>ke+1),1e3);return()=>clearInterval(Be)},[e.length,R]),Ie.useEffect(()=>{i!=null&&i.streams&&t(i.streams)},[i]),Ie.useEffect(()=>{n&&localStorage.setItem("streaming_name",n)},[n]);const he=Ie.useCallback(Ge=>{var Be;((Be=G.current)==null?void 0:Be.readyState)===WebSocket.OPEN&&G.current.send(JSON.stringify(Ge))},[]),be=Ie.useCallback((Ge,Be,ke)=>{if(Ge.remoteDescription)Ge.addIceCandidate(new RTCIceCandidate(ke)).catch(()=>{});else{let oe=te.current.get(Be);oe||(oe=[],te.current.set(Be,oe)),oe.push(ke)}},[]),Se=Ie.useCallback((Ge,Be)=>{const ke=te.current.get(Be);if(ke){for(const oe of ke)Ge.addIceCandidate(new RTCIceCandidate(oe)).catch(()=>{});te.current.delete(Be)}},[]),le=Ie.useCallback(()=>{J.current&&(J.current.close(),J.current=null),V.current&&(V.current.srcObject=null),te.current.clear()},[]),we=Ie.useRef(()=>{});we.current=Ge=>{var Be;switch(Ge.type){case"welcome":k.current=Ge.clientId,Ge.streams&&t(Ge.streams);break;case"broadcast_started":w(Ge.streamId),C(!0),Z.current=!0,B(!1);break;case"stream_available":break;case"stream_ended":((Be=ue.current)==null?void 0:Be.streamId)===Ge.streamId&&(le(),O(null));break;case"viewer_joined":{const ke=Ge.viewerId,oe=X.current.get(ke);oe&&(oe.close(),X.current.delete(ke)),te.current.delete(ke);const Mt=new RTCPeerConnection(y7);X.current.set(ke,Mt);const lt=H.current;if(lt)for(const Dt of lt.getTracks())Mt.addTrack(Dt,lt);Mt.onicecandidate=Dt=>{Dt.candidate&&he({type:"ice_candidate",targetId:ke,candidate:Dt.candidate.toJSON()})},Mt.createOffer().then(Dt=>Mt.setLocalDescription(Dt)).then(()=>{he({type:"offer",targetId:ke,sdp:Mt.localDescription})}).catch(console.error);break}case"viewer_left":{const ke=X.current.get(Ge.viewerId);ke&&(ke.close(),X.current.delete(Ge.viewerId)),te.current.delete(Ge.viewerId);break}case"offer":{const ke=Ge.fromId;J.current&&(J.current.close(),J.current=null),te.current.delete(ke);const oe=new RTCPeerConnection(y7);J.current=oe,oe.ontrack=Mt=>{V.current&&Mt.streams[0]&&(V.current.srcObject=Mt.streams[0]),O(lt=>lt&&{...lt,phase:"connected"})},oe.onicecandidate=Mt=>{Mt.candidate&&he({type:"ice_candidate",targetId:ke,candidate:Mt.candidate.toJSON()})},oe.oniceconnectionstatechange=()=>{(oe.iceConnectionState==="failed"||oe.iceConnectionState==="disconnected")&&O(Mt=>Mt&&{...Mt,phase:"error",error:"Verbindung verloren"})},oe.setRemoteDescription(new RTCSessionDescription(Ge.sdp)).then(()=>(Se(oe,ke),oe.createAnswer())).then(Mt=>oe.setLocalDescription(Mt)).then(()=>{he({type:"answer",targetId:ke,sdp:oe.localDescription})}).catch(console.error);break}case"answer":{const ke=X.current.get(Ge.fromId);ke&&ke.setRemoteDescription(new RTCSessionDescription(Ge.sdp)).then(()=>Se(ke,Ge.fromId)).catch(console.error);break}case"ice_candidate":{if(!Ge.candidate)break;if(Z.current){const ke=X.current.get(Ge.fromId);ke&&be(ke,Ge.fromId,Ge.candidate)}else{const ke=J.current;ke&&be(ke,Ge.fromId,Ge.candidate)}break}case"error":Ge.code==="WRONG_PASSWORD"?x(ke=>ke&&{...ke,error:Ge.message}):g(Ge.message),B(!1);break}};const We=Ie.useCallback(()=>{if(G.current&&G.current.readyState===WebSocket.OPEN)return;const Ge=location.protocol==="https:"?"wss":"ws",Be=new WebSocket(`${Ge}://${location.host}/ws/streaming`);G.current=Be,Be.onopen=()=>{ne.current=1e3},Be.onmessage=ke=>{let oe;try{oe=JSON.parse(ke.data)}catch{return}we.current(oe)},Be.onclose=()=>{G.current=null,(Z.current||ue.current)&&(se.current=setTimeout(()=>{ne.current=Math.min(ne.current*2,1e4),We()},ne.current))},Be.onerror=()=>{Be.close()}},[]),Te=Ie.useCallback(async()=>{var Ge,Be;if(!n.trim()){g("Bitte gib einen Namen ein.");return}if(!l.trim()){g("Passwort ist Pflicht.");return}if(!((Ge=navigator.mediaDevices)!=null&&Ge.getDisplayMedia)){g("Dein Browser unterstützt keine Bildschirmfreigabe.");return}g(null),B(!0);try{const ke=await navigator.mediaDevices.getDisplayMedia({video:!0,audio:!0});H.current=ke,F.current&&(F.current.srcObject=ke),(Be=ke.getVideoTracks()[0])==null||Be.addEventListener("ended",()=>{ze()}),We();const oe=()=>{var Mt;((Mt=G.current)==null?void 0:Mt.readyState)===WebSocket.OPEN?he({type:"start_broadcast",name:n.trim(),title:s.trim()||"Screen Share",password:l.trim()}):setTimeout(oe,100)};oe()}catch(ke){B(!1),ke.name==="NotAllowedError"?g("Bildschirmfreigabe wurde abgelehnt."):g(`Fehler: ${ke.message}`)}},[n,s,l,We,he]),ze=Ie.useCallback(()=>{var Ge;he({type:"stop_broadcast"}),(Ge=H.current)==null||Ge.getTracks().forEach(Be=>Be.stop()),H.current=null,F.current&&(F.current.srcObject=null);for(const Be of X.current.values())Be.close();X.current.clear(),te.current.clear(),C(!1),Z.current=!1,w(null),u("")},[he]),_e=Ie.useCallback(Ge=>{x({streamId:Ge.id,streamTitle:Ge.title,broadcasterName:Ge.broadcasterName,password:"",error:null})},[]),De=Ie.useCallback(()=>{if(!v)return;if(!v.password.trim()){x(oe=>oe&&{...oe,error:"Passwort eingeben."});return}const{streamId:Ge,password:Be}=v;x(null),g(null),O({streamId:Ge,phase:"connecting"}),We();const ke=()=>{var oe;((oe=G.current)==null?void 0:oe.readyState)===WebSocket.OPEN?he({type:"join_viewer",name:n.trim()||"Viewer",streamId:Ge,password:Be.trim()}):setTimeout(ke,100)};ke()},[v,n,We,he]),dt=Ie.useCallback(()=>{he({type:"leave_viewer"}),le(),O(null)},[le,he]);if(Ie.useEffect(()=>()=>{var Ge;(Ge=H.current)==null||Ge.getTracks().forEach(Be=>Be.stop());for(const Be of X.current.values())Be.close();J.current&&J.current.close(),G.current&&G.current.close(),se.current&&clearTimeout(se.current)},[]),L){const Ge=e.find(Be=>Be.id===L.streamId);return W.jsxs("div",{className:"stream-viewer-overlay",children:[W.jsxs("div",{className:"stream-viewer-header",children:[W.jsxs("div",{className:"stream-viewer-header-left",children:[W.jsxs("span",{className:"stream-live-badge",children:[W.jsx("span",{className:"stream-live-dot"})," LIVE"]}),W.jsxs("div",{children:[W.jsx("div",{className:"stream-viewer-title",children:(Ge==null?void 0:Ge.title)||"Stream"}),W.jsxs("div",{className:"stream-viewer-subtitle",children:[(Ge==null?void 0:Ge.broadcasterName)||"..."," ",Ge?`· ${Ge.viewerCount} Zuschauer`:""]})]})]}),W.jsx("button",{className:"stream-viewer-close",onClick:dt,children:"Verlassen"})]}),W.jsxs("div",{className:"stream-viewer-video",children:[L.phase==="connecting"?W.jsxs("div",{className:"stream-viewer-connecting",children:[W.jsx("div",{className:"stream-viewer-spinner"}),"Verbindung wird hergestellt..."]}):L.phase==="error"?W.jsxs("div",{className:"stream-viewer-connecting",children:[L.error||"Verbindungsfehler",W.jsx("button",{className:"stream-btn",onClick:dt,children:"Zur\\u00FCck"})]}):null,W.jsx("video",{ref:V,autoPlay:!0,playsInline:!0,style:L.phase==="connected"?{}:{display:"none"}})]})]})}return W.jsxs("div",{className:"stream-container",children:[h&&W.jsxs("div",{className:"stream-error",children:[h,W.jsx("button",{className:"stream-error-dismiss",onClick:()=>g(null),children:"×"})]}),W.jsxs("div",{className:"stream-topbar",children:[W.jsx("input",{className:"stream-input stream-input-name",placeholder:"Dein Name",value:n,onChange:Ge=>r(Ge.target.value),disabled:R}),W.jsx("input",{className:"stream-input stream-input-title",placeholder:"Stream-Titel",value:s,onChange:Ge=>a(Ge.target.value),disabled:R}),W.jsx("input",{className:"stream-input stream-input-password",type:"password",placeholder:"Passwort",value:l,onChange:Ge=>u(Ge.target.value),disabled:R}),R?W.jsxs("button",{className:"stream-btn stream-btn-stop",onClick:ze,children:["⏹"," Stream beenden"]}):W.jsx("button",{className:"stream-btn",onClick:Te,disabled:E,children:E?"Starte...":"🖥️ Stream starten"})]}),e.length===0&&!R?W.jsxs("div",{className:"stream-empty",children:[W.jsx("div",{className:"stream-empty-icon",children:"📺"}),W.jsx("h3",{children:"Keine aktiven Streams"}),W.jsx("p",{children:"Starte einen Stream, um deinen Bildschirm zu teilen."})]}):W.jsxs("div",{className:"stream-grid",children:[R&&W.jsxs("div",{className:"stream-tile own broadcasting",children:[W.jsxs("div",{className:"stream-tile-preview",children:[W.jsx("video",{ref:F,autoPlay:!0,playsInline:!0,muted:!0}),W.jsxs("span",{className:"stream-live-badge",children:[W.jsx("span",{className:"stream-live-dot"})," LIVE"]}),W.jsxs("span",{className:"stream-tile-viewers",children:["👥"," ",((vt=e.find(Ge=>Ge.id===S))==null?void 0:vt.viewerCount)??0]})]}),W.jsxs("div",{className:"stream-tile-info",children:[W.jsxs("div",{className:"stream-tile-meta",children:[W.jsxs("div",{className:"stream-tile-name",children:[n," (Du)"]}),W.jsx("div",{className:"stream-tile-title",children:s})]}),W.jsx("span",{className:"stream-tile-time",children:S&&((Tt=e.find(Ge=>Ge.id===S))!=null&&Tt.startedAt)?x7(e.find(Ge=>Ge.id===S).startedAt):"0:00"})]})]}),e.filter(Ge=>Ge.id!==S).map(Ge=>W.jsxs("div",{className:"stream-tile",onClick:()=>_e(Ge),children:[W.jsxs("div",{className:"stream-tile-preview",children:[W.jsx("span",{className:"stream-tile-icon",children:"🖥️"}),W.jsxs("span",{className:"stream-live-badge",children:[W.jsx("span",{className:"stream-live-dot"})," LIVE"]}),W.jsxs("span",{className:"stream-tile-viewers",children:["👥"," ",Ge.viewerCount]}),Ge.hasPassword&&W.jsx("span",{className:"stream-tile-lock",children:"🔒"})]}),W.jsxs("div",{className:"stream-tile-info",children:[W.jsxs("div",{className:"stream-tile-meta",children:[W.jsx("div",{className:"stream-tile-name",children:Ge.broadcasterName}),W.jsx("div",{className:"stream-tile-title",children:Ge.title})]}),W.jsx("span",{className:"stream-tile-time",children:x7(Ge.startedAt)}),W.jsx("button",{className:"stream-tile-menu",onClick:Be=>Be.stopPropagation(),children:"⋮"})]})]},Ge.id))]}),v&&W.jsx("div",{className:"stream-pw-overlay",onClick:()=>x(null),children:W.jsxs("div",{className:"stream-pw-modal",onClick:Ge=>Ge.stopPropagation(),children:[W.jsx("h3",{children:v.broadcasterName}),W.jsx("p",{children:v.streamTitle}),v.error&&W.jsx("div",{className:"stream-pw-modal-error",children:v.error}),W.jsx("input",{className:"stream-input",type:"password",placeholder:"Stream-Passwort",value:v.password,onChange:Ge=>x(Be=>Be&&{...Be,password:Ge.target.value,error:null}),onKeyDown:Ge=>{Ge.key==="Enter"&&De()},autoFocus:!0}),W.jsxs("div",{className:"stream-pw-actions",children:[W.jsx("button",{className:"stream-pw-cancel",onClick:()=>x(null),children:"Abbrechen"}),W.jsx("button",{className:"stream-btn",onClick:De,children:"Beitreten"})]})]})})]})}const Yde={radio:xde,soundboard:qde,lolstats:$de,streaming:Xde};function Qde(){const[i,e]=Ie.useState(!1),[t,n]=Ie.useState([]),[r,s]=Ie.useState(()=>localStorage.getItem("hub_activeTab")??""),a=x=>{s(x),localStorage.setItem("hub_activeTab",x)},[l,u]=Ie.useState({}),h=Ie.useRef(null);Ie.useEffect(()=>{fetch("/api/plugins").then(x=>x.json()).then(x=>{n(x);const S=localStorage.getItem("hub_activeTab"),w=x.some(R=>R.name===S);x.length>0&&!w&&a(x[0].name)}).catch(()=>{})},[]),Ie.useEffect(()=>{let x=null,S;function w(){x=new EventSource("/api/events"),h.current=x,x.onopen=()=>e(!0),x.onmessage=R=>{try{const C=JSON.parse(R.data);C.type==="snapshot"?u(E=>({...E,...C})):C.plugin&&u(E=>({...E,[C.plugin]:{...E[C.plugin]||{},...C}}))}catch{}},x.onerror=()=>{e(!1),x==null||x.close(),S=setTimeout(w,3e3)}}return w(),()=>{x==null||x.close(),clearTimeout(S)}},[]);const g="1.0.0-dev",v={radio:"🌍",soundboard:"🎵",lolstats:"⚔️",stats:"📊",events:"📅",games:"🎲",gamevote:"🎮",streaming:"📺"};return W.jsxs("div",{className:"hub-app",children:[W.jsxs("header",{className:"hub-header",children:[W.jsxs("div",{className:"hub-header-left",children:[W.jsx("span",{className:"hub-logo",children:"🎮"}),W.jsx("span",{className:"hub-title",children:"Gaming Hub"}),W.jsx("span",{className:`hub-conn-dot ${i?"online":""}`})]}),W.jsx("nav",{className:"hub-tabs",children:t.map(x=>W.jsxs("button",{className:`hub-tab ${r===x.name?"active":""}`,onClick:()=>a(x.name),title:x.description,children:[W.jsx("span",{className:"hub-tab-icon",children:v[x.name]??"📦"}),W.jsx("span",{className:"hub-tab-label",children:x.name})]},x.name))}),W.jsx("div",{className:"hub-header-right",children:W.jsxs("span",{className:"hub-version",children:["v",g]})})]}),W.jsx("main",{className:"hub-content",children:t.length===0?W.jsxs("div",{className:"hub-empty",children:[W.jsx("span",{className:"hub-empty-icon",children:"📦"}),W.jsx("h2",{children:"Keine Plugins geladen"}),W.jsx("p",{children:"Plugins werden im Server konfiguriert."})]}):t.map(x=>{const S=Yde[x.name];if(!S)return null;const w=r===x.name;return W.jsx("div",{className:`hub-tab-panel ${w?"active":""}`,style:w?{display:"flex",flexDirection:"column",width:"100%",height:"100%"}:{display:"none"},children:W.jsx(S,{data:l[x.name]||{}})},x.name)})})]})}PF.createRoot(document.getElementById("root")).render(W.jsx(Qde,{})); +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function f7(i,e){var t=Object.keys(i);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(i);e&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(i,r).enumerable})),t.push.apply(t,n)}return t}function jf(i){for(var e=1;e1?l-1:0),h=1;h1&&arguments[1]!==void 0?arguments[1]:{},n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,r=a();if(t.lat===void 0&&t.lng===void 0&&t.altitude===void 0)return r;var s=Object.assign({},r,t);if(["lat","lng","altitude"].forEach(function(u){return s[u]=+s[u]}),!n)l(s);else{for(;r.lng-s.lng>180;)r.lng-=360;for(;r.lng-s.lng<-180;)r.lng+=360;e.tweenGroup.add(new ca(r).to(s,n).easing(os.Cubic.InOut).onUpdate(l).start())}return this;function a(){return e.globe.toGeoCoords(e.renderObjs.cameraPosition())}function l(u){var h=u.lat,g=u.lng,v=u.altitude;e.renderObjs.cameraPosition(e.globe.getCoords(h,g,v)),e.globe.setPointOfView(e.renderObjs.camera())}},getScreenCoords:function(e){for(var t,n=arguments.length,r=new Array(n>1?n-1:0),s=1;slocalStorage.getItem("radio-theme")||"default"),[a,l]=Ie.useState([]),[u,h]=Ie.useState(null),[g,v]=Ie.useState([]),[x,S]=Ie.useState(!1),[w,R]=Ie.useState({}),[C,E]=Ie.useState([]),[B,L]=Ie.useState(""),[O,z]=Ie.useState(""),[G,k]=Ie.useState(""),[H,F]=Ie.useState([]),[V,X]=Ie.useState(!1),[J,te]=Ie.useState([]),[se,ne]=Ie.useState(!1),[Z,ue]=Ie.useState(!1),[he,be]=Ie.useState(.5),[Se,le]=Ie.useState(null),[we,We]=Ie.useState(!1),[Te,ze]=Ie.useState(!1),_e=Ie.useRef(void 0),De=Ie.useRef(void 0),pt=Ie.useRef(B);Ie.useEffect(()=>{fetch("/api/radio/places").then(Y=>Y.json()).then(l).catch(console.error),fetch("/api/radio/guilds").then(Y=>Y.json()).then(Y=>{if(E(Y),Y.length>0){L(Y[0].id);const Ce=Y[0].voiceChannels.find($e=>$e.members>0)??Y[0].voiceChannels[0];Ce&&z(Ce.id)}}).catch(console.error),fetch("/api/radio/favorites").then(Y=>Y.json()).then(te).catch(console.error)},[]),Ie.useEffect(()=>{pt.current=B},[B]),Ie.useEffect(()=>{i!=null&&i.guildId&&"playing"in i&&i.type!=="radio_voicestats"?R(Y=>{if(i.playing)return{...Y,[i.guildId]:i.playing};const Ce={...Y};return delete Ce[i.guildId],Ce}):i!=null&&i.playing&&!(i!=null&&i.guildId)&&R(i.playing),i!=null&&i.favorites&&te(i.favorites),i!=null&&i.volumes&&B&&i.volumes[B]!=null&&be(i.volumes[B]),(i==null?void 0:i.volume)!=null&&(i==null?void 0:i.guildId)===B&&be(i.volume),(i==null?void 0:i.type)==="radio_voicestats"&&i.guildId===pt.current&&le({voicePing:i.voicePing,gatewayPing:i.gatewayPing,status:i.status,channelName:i.channelName,connectedSince:i.connectedSince})},[i,B]),Ie.useEffect(()=>{if(localStorage.setItem("radio-theme",r),t.current&&e.current){const Ce=getComputedStyle(e.current.parentElement).getPropertyValue("--accent-rgb").trim();t.current.pointColor(()=>`rgba(${Ce}, 0.85)`).atmosphereColor(`rgba(${Ce}, 0.25)`)}},[r]);const _t=Ie.useRef(u);_t.current=u;const wt=Ie.useRef(se);wt.current=se;const Ge=Ie.useCallback(()=>{var Ce;const Y=(Ce=t.current)==null?void 0:Ce.controls();Y&&(Y.autoRotate=!1),n.current&&clearTimeout(n.current),n.current=setTimeout(()=>{var it;if(_t.current||wt.current)return;const $e=(it=t.current)==null?void 0:it.controls();$e&&($e.autoRotate=!0)},5e3)},[]);Ie.useEffect(()=>{var Ce;const Y=(Ce=t.current)==null?void 0:Ce.controls();Y&&(u||se?(Y.autoRotate=!1,n.current&&clearTimeout(n.current)):Y.autoRotate=!0)},[u,se]);const Be=Ie.useRef(void 0);Be.current=Y=>{h(Y),ne(!1),S(!0),v([]),Ge(),t.current&&t.current.pointOfView({lat:Y.geo[1],lng:Y.geo[0],altitude:.4},800),fetch(`/api/radio/place/${Y.id}/channels`).then(Ce=>Ce.json()).then(Ce=>{v(Ce),S(!1)}).catch(()=>S(!1))},Ie.useEffect(()=>{const Y=e.current;if(!Y)return;Y.clientWidth>0&&Y.clientHeight>0&&ze(!0);const Ce=new ResizeObserver($e=>{for(const it of $e){const{width:tt,height:Vt}=it.contentRect;tt>0&&Vt>0&&ze(!0)}});return Ce.observe(Y),()=>Ce.disconnect()},[]),Ie.useEffect(()=>{if(!e.current||a.length===0)return;const Y=e.current.clientWidth,Ce=e.current.clientHeight;if(t.current){t.current.pointsData(a),Y>0&&Ce>0&&t.current.width(Y).height(Ce);return}if(Y===0||Ce===0)return;const it=getComputedStyle(e.current.parentElement).getPropertyValue("--accent-rgb").trim()||"230, 126, 34",tt=new _de(e.current).backgroundColor("rgba(0,0,0,0)").atmosphereColor(`rgba(${it}, 0.25)`).atmosphereAltitude(.12).globeImageUrl("/nasa-blue-marble.jpg").pointsData(a).pointLat(Ht=>Ht.geo[1]).pointLng(Ht=>Ht.geo[0]).pointColor(()=>`rgba(${it}, 0.85)`).pointRadius(Ht=>Math.max(.12,Math.min(.45,.06+(Ht.size??1)*.005))).pointAltitude(.001).pointResolution(24).pointLabel(Ht=>`
${Ht.title}
${Ht.country}
`).onPointClick(Ht=>{var Ft;return(Ft=Be.current)==null?void 0:Ft.call(Be,Ht)}).width(e.current.clientWidth).height(e.current.clientHeight);tt.renderer().setPixelRatio(window.devicePixelRatio),tt.pointOfView({lat:48,lng:10,altitude:GS});const Vt=tt.controls();Vt&&(Vt.autoRotate=!0,Vt.autoRotateSpeed=.3);let Bt=GS;const Wt=()=>{const Ft=tt.pointOfView().altitude;if(Math.abs(Ft-Bt)/Bt<.05)return;Bt=Ft;const Gt=Math.sqrt(Ft/GS);tt.pointRadius(In=>Math.max(.12,Math.min(.45,.06+(In.size??1)*.005))*Math.max(.15,Math.min(2.5,Gt)))};Vt.addEventListener("change",Wt),t.current=tt;const ln=e.current,Tt=()=>Ge();ln.addEventListener("mousedown",Tt),ln.addEventListener("touchstart",Tt),ln.addEventListener("wheel",Tt);const Kt=()=>{if(e.current&&t.current){const Ht=e.current.clientWidth,Ft=e.current.clientHeight;Ht>0&&Ft>0&&t.current.width(Ht).height(Ft)}};window.addEventListener("resize",Kt);const rn=new ResizeObserver(()=>Kt());return rn.observe(ln),()=>{Vt.removeEventListener("change",Wt),ln.removeEventListener("mousedown",Tt),ln.removeEventListener("touchstart",Tt),ln.removeEventListener("wheel",Tt),window.removeEventListener("resize",Kt),rn.disconnect()}},[a,Ge,Te]);const ke=Ie.useCallback(async(Y,Ce,$e,it)=>{if(!(!B||!O)){ue(!0);try{(await(await fetch("/api/radio/play",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({guildId:B,voiceChannelId:O,stationId:Y,stationName:Ce,placeName:$e??(u==null?void 0:u.title)??"",country:it??(u==null?void 0:u.country)??""})})).json()).ok&&(R(Bt=>{var Wt,ln;return{...Bt,[B]:{stationId:Y,stationName:Ce,placeName:$e??(u==null?void 0:u.title)??"",country:it??(u==null?void 0:u.country)??"",startedAt:new Date().toISOString(),channelName:((ln=(Wt=C.find(Tt=>Tt.id===B))==null?void 0:Wt.voiceChannels.find(Tt=>Tt.id===O))==null?void 0:ln.name)??""}}}),Ge())}catch(tt){console.error(tt)}ue(!1)}},[B,O,u,C]),oe=Ie.useCallback(async()=>{B&&(await fetch("/api/radio/stop",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({guildId:B})}),R(Y=>{const Ce={...Y};return delete Ce[B],Ce}))},[B]),Mt=Ie.useCallback(Y=>{if(k(Y),_e.current&&clearTimeout(_e.current),!Y.trim()){F([]),X(!1);return}_e.current=setTimeout(async()=>{try{const $e=await(await fetch(`/api/radio/search?q=${encodeURIComponent(Y)}`)).json();F($e),X(!0)}catch{F([])}},350)},[]),lt=Ie.useCallback(Y=>{var Ce,$e,it;if(X(!1),k(""),F([]),Y.type==="channel"){const tt=(Ce=Y.url.match(/\/listen\/[^/]+\/([^/]+)/))==null?void 0:Ce[1];tt&&ke(tt,Y.title,Y.subtitle,"")}else if(Y.type==="place"){const tt=($e=Y.url.match(/\/visit\/[^/]+\/([^/]+)/))==null?void 0:$e[1],Vt=a.find(Bt=>Bt.id===tt);Vt&&((it=Be.current)==null||it.call(Be,Vt))}},[a,ke]),Dt=Ie.useCallback(async(Y,Ce)=>{try{const it=await(await fetch("/api/radio/favorites",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({stationId:Y,stationName:Ce,placeName:(u==null?void 0:u.title)??"",country:(u==null?void 0:u.country)??"",placeId:(u==null?void 0:u.id)??""})})).json();it.favorites&&te(it.favorites)}catch{}},[u]),ut=Ie.useCallback(Y=>{be(Y),B&&(De.current&&clearTimeout(De.current),De.current=setTimeout(()=>{fetch("/api/radio/volume",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({guildId:B,volume:Y})}).catch(console.error)},100))},[B]),en=Y=>J.some(Ce=>Ce.stationId===Y),St=B?w[B]:null,fe=C.find(Y=>Y.id===B);return W.jsxs("div",{className:"radio-container","data-theme":r,children:[W.jsxs("header",{className:"radio-topbar",children:[W.jsxs("div",{className:"radio-topbar-left",children:[W.jsx("span",{className:"radio-topbar-logo",children:"🌍"}),W.jsx("span",{className:"radio-topbar-title",children:"World Radio"}),C.length>1&&W.jsx("select",{className:"radio-sel",value:B,onChange:Y=>{L(Y.target.value);const Ce=C.find(it=>it.id===Y.target.value),$e=(Ce==null?void 0:Ce.voiceChannels.find(it=>it.members>0))??(Ce==null?void 0:Ce.voiceChannels[0]);z(($e==null?void 0:$e.id)??"")},children:C.map(Y=>W.jsx("option",{value:Y.id,children:Y.name},Y.id))}),W.jsxs("select",{className:"radio-sel",value:O,onChange:Y=>z(Y.target.value),children:[W.jsx("option",{value:"",children:"Voice Channel..."}),fe==null?void 0:fe.voiceChannels.map(Y=>W.jsxs("option",{value:Y.id,children:["🔊"," ",Y.name,Y.members>0?` (${Y.members})`:""]},Y.id))]})]}),St&&W.jsxs("div",{className:"radio-topbar-np",children:[W.jsxs("div",{className:"radio-eq radio-eq-np",children:[W.jsx("span",{}),W.jsx("span",{}),W.jsx("span",{})]}),W.jsxs("div",{className:"radio-np-info",children:[W.jsx("span",{className:"radio-np-name",children:St.stationName}),W.jsxs("span",{className:"radio-np-loc",children:[St.placeName,St.country?`, ${St.country}`:""]})]})]}),W.jsxs("div",{className:"radio-topbar-right",children:[St&&W.jsxs(W.Fragment,{children:[W.jsxs("div",{className:"radio-volume",children:[W.jsx("span",{className:"radio-volume-icon",children:he===0?"🔇":he<.4?"🔉":"🔊"}),W.jsx("input",{type:"range",className:"radio-volume-slider",min:0,max:1,step:.01,value:he,onChange:Y=>ut(Number(Y.target.value))}),W.jsxs("span",{className:"radio-volume-val",children:[Math.round(he*100),"%"]})]}),W.jsxs("div",{className:"radio-conn",onClick:()=>We(!0),title:"Verbindungsdetails",children:[W.jsx("span",{className:"radio-conn-dot"}),"Verbunden",(Se==null?void 0:Se.voicePing)!=null&&W.jsxs("span",{className:"radio-conn-ping",children:[Se.voicePing,"ms"]})]}),W.jsxs("button",{className:"radio-topbar-stop",onClick:oe,children:["⏹"," Stop"]})]}),W.jsx("div",{className:"radio-theme-inline",children:yde.map(Y=>W.jsx("div",{className:`radio-theme-dot ${r===Y.id?"active":""}`,style:{background:Y.color},title:Y.label,onClick:()=>s(Y.id)},Y.id))})]})]}),W.jsxs("div",{className:"radio-globe-wrap",children:[W.jsx("div",{className:"radio-globe",ref:e}),W.jsxs("div",{className:"radio-search",children:[W.jsxs("div",{className:"radio-search-wrap",children:[W.jsx("span",{className:"radio-search-icon",children:"🔍"}),W.jsx("input",{className:"radio-search-input",type:"text",placeholder:"Sender oder Stadt suchen...",value:G,onChange:Y=>Mt(Y.target.value),onFocus:()=>{H.length&&X(!0)}}),G&&W.jsx("button",{className:"radio-search-clear",onClick:()=>{k(""),F([]),X(!1)},children:"✕"})]}),V&&H.length>0&&W.jsx("div",{className:"radio-search-results",children:H.slice(0,12).map(Y=>W.jsxs("button",{className:"radio-search-result",onClick:()=>lt(Y),children:[W.jsx("span",{className:"radio-search-result-icon",children:Y.type==="channel"?"📻":Y.type==="place"?"📍":"🌍"}),W.jsxs("div",{className:"radio-search-result-text",children:[W.jsx("span",{className:"radio-search-result-title",children:Y.title}),W.jsx("span",{className:"radio-search-result-sub",children:Y.subtitle})]})]},Y.id+Y.url))})]}),!u&&!se&&W.jsxs("button",{className:"radio-fab",onClick:()=>{ne(!0),h(null)},title:"Favoriten",children:["⭐",J.length>0&&W.jsx("span",{className:"radio-fab-badge",children:J.length})]}),se&&W.jsxs("div",{className:"radio-panel open",children:[W.jsxs("div",{className:"radio-panel-header",children:[W.jsxs("h3",{children:["⭐"," Favoriten"]}),W.jsx("button",{className:"radio-panel-close",onClick:()=>ne(!1),children:"✕"})]}),W.jsx("div",{className:"radio-panel-body",children:J.length===0?W.jsx("div",{className:"radio-panel-empty",children:"Noch keine Favoriten"}):J.map(Y=>W.jsxs("div",{className:`radio-station ${(St==null?void 0:St.stationId)===Y.stationId?"playing":""}`,children:[W.jsxs("div",{className:"radio-station-info",children:[W.jsx("span",{className:"radio-station-name",children:Y.stationName}),W.jsxs("span",{className:"radio-station-loc",children:[Y.placeName,", ",Y.country]})]}),W.jsxs("div",{className:"radio-station-btns",children:[W.jsx("button",{className:"radio-btn-play",onClick:()=>ke(Y.stationId,Y.stationName,Y.placeName,Y.country),disabled:!O||Z,children:"▶"}),W.jsx("button",{className:"radio-btn-fav active",onClick:()=>Dt(Y.stationId,Y.stationName),children:"★"})]})]},Y.stationId))})]}),u&&!se&&W.jsxs("div",{className:"radio-panel open",children:[W.jsxs("div",{className:"radio-panel-header",children:[W.jsxs("div",{children:[W.jsx("h3",{children:u.title}),W.jsx("span",{className:"radio-panel-sub",children:u.country})]}),W.jsx("button",{className:"radio-panel-close",onClick:()=>h(null),children:"✕"})]}),W.jsx("div",{className:"radio-panel-body",children:x?W.jsxs("div",{className:"radio-panel-loading",children:[W.jsx("div",{className:"radio-spinner"}),"Sender werden geladen..."]}):g.length===0?W.jsx("div",{className:"radio-panel-empty",children:"Keine Sender gefunden"}):g.map(Y=>W.jsxs("div",{className:`radio-station ${(St==null?void 0:St.stationId)===Y.id?"playing":""}`,children:[W.jsxs("div",{className:"radio-station-info",children:[W.jsx("span",{className:"radio-station-name",children:Y.title}),(St==null?void 0:St.stationId)===Y.id&&W.jsxs("span",{className:"radio-station-live",children:[W.jsxs("span",{className:"radio-eq",children:[W.jsx("span",{}),W.jsx("span",{}),W.jsx("span",{})]}),"Live"]})]}),W.jsxs("div",{className:"radio-station-btns",children:[(St==null?void 0:St.stationId)===Y.id?W.jsx("button",{className:"radio-btn-stop",onClick:oe,children:"⏹"}):W.jsx("button",{className:"radio-btn-play",onClick:()=>ke(Y.id,Y.title),disabled:!O||Z,children:"▶"}),W.jsx("button",{className:`radio-btn-fav ${en(Y.id)?"active":""}`,onClick:()=>Dt(Y.id,Y.title),children:en(Y.id)?"★":"☆"})]})]},Y.id))})]}),W.jsxs("div",{className:"radio-counter",children:["📻"," ",a.length.toLocaleString("de-DE")," Sender weltweit"]}),W.jsx("a",{className:"radio-attribution",href:"https://science.nasa.gov/earth/earth-observatory/blue-marble-next-generation/",target:"_blank",rel:"noreferrer",children:"Imagery © NASA Blue Marble"})]}),we&&(()=>{const Y=Se!=null&&Se.connectedSince?Math.floor((Date.now()-new Date(Se.connectedSince).getTime())/1e3):0,Ce=Math.floor(Y/3600),$e=Math.floor(Y%3600/60),it=Y%60,tt=Ce>0?`${Ce}h ${String($e).padStart(2,"0")}m ${String(it).padStart(2,"0")}s`:$e>0?`${$e}m ${String(it).padStart(2,"0")}s`:`${it}s`,Vt=Bt=>Bt==null?"var(--text-faint)":Bt<80?"var(--success)":Bt<150?"#f0a830":"#e04040";return W.jsx("div",{className:"radio-modal-overlay",onClick:()=>We(!1),children:W.jsxs("div",{className:"radio-modal",onClick:Bt=>Bt.stopPropagation(),children:[W.jsxs("div",{className:"radio-modal-header",children:[W.jsx("span",{children:"📡"}),W.jsx("span",{children:"Verbindungsdetails"}),W.jsx("button",{className:"radio-modal-close",onClick:()=>We(!1),children:"✕"})]}),W.jsxs("div",{className:"radio-modal-body",children:[W.jsxs("div",{className:"radio-modal-stat",children:[W.jsx("span",{className:"radio-modal-label",children:"Voice Ping"}),W.jsxs("span",{className:"radio-modal-value",children:[W.jsx("span",{className:"radio-modal-dot",style:{background:Vt((Se==null?void 0:Se.voicePing)??null)}}),(Se==null?void 0:Se.voicePing)!=null?`${Se.voicePing} ms`:"---"]})]}),W.jsxs("div",{className:"radio-modal-stat",children:[W.jsx("span",{className:"radio-modal-label",children:"Gateway Ping"}),W.jsxs("span",{className:"radio-modal-value",children:[W.jsx("span",{className:"radio-modal-dot",style:{background:Vt((Se==null?void 0:Se.gatewayPing)??null)}}),Se&&Se.gatewayPing>=0?`${Se.gatewayPing} ms`:"---"]})]}),W.jsxs("div",{className:"radio-modal-stat",children:[W.jsx("span",{className:"radio-modal-label",children:"Status"}),W.jsx("span",{className:"radio-modal-value",style:{color:(Se==null?void 0:Se.status)==="ready"?"var(--success)":"#f0a830"},children:(Se==null?void 0:Se.status)==="ready"?"Verbunden":(Se==null?void 0:Se.status)??"Warte auf Verbindung"})]}),W.jsxs("div",{className:"radio-modal-stat",children:[W.jsx("span",{className:"radio-modal-label",children:"Kanal"}),W.jsx("span",{className:"radio-modal-value",children:(Se==null?void 0:Se.channelName)||"---"})]}),W.jsxs("div",{className:"radio-modal-stat",children:[W.jsx("span",{className:"radio-modal-label",children:"Verbunden seit"}),W.jsx("span",{className:"radio-modal-value",children:tt||"---"})]})]})]})})})()]})}function bde(i,e,t=365){const n=new Date(Date.now()+t*24*60*60*1e3).toUTCString();document.cookie=`${encodeURIComponent(i)}=${encodeURIComponent(e)}; expires=${n}; path=/; SameSite=Lax`}function Sde(i){const e=`${encodeURIComponent(i)}=`,t=document.cookie.split(";");for(const n of t){const r=n.trim();if(r.startsWith(e))return decodeURIComponent(r.slice(e.length))}return null}const us="/api/soundboard";async function A7(i,e,t,n){const r=new URL(`${us}/sounds`,window.location.origin);i&&r.searchParams.set("q",i),e!==void 0&&r.searchParams.set("folder",e),r.searchParams.set("fuzzy","0");const s=await fetch(r.toString());if(!s.ok)throw new Error("Fehler beim Laden der Sounds");return s.json()}async function Tde(){const i=await fetch(`${us}/analytics`);if(!i.ok)throw new Error("Fehler beim Laden der Analytics");return i.json()}async function wde(){const i=await fetch(`${us}/categories`,{credentials:"include"});if(!i.ok)throw new Error("Fehler beim Laden der Kategorien");return i.json()}async function Mde(){const i=await fetch(`${us}/channels`);if(!i.ok)throw new Error("Fehler beim Laden der Channels");return i.json()}async function Ede(){const i=await fetch(`${us}/selected-channels`);if(!i.ok)throw new Error("Fehler beim Laden der Channel-Auswahl");const e=await i.json();return(e==null?void 0:e.selected)||{}}async function Cde(i,e){if(!(await fetch(`${us}/selected-channel`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({guildId:i,channelId:e})})).ok)throw new Error("Channel-Auswahl setzen fehlgeschlagen")}async function Rde(i,e,t,n,r){const s=await fetch(`${us}/play`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({soundName:i,guildId:e,channelId:t,volume:n,relativePath:r})});if(!s.ok){const a=await s.json().catch(()=>({}));throw new Error((a==null?void 0:a.error)||"Play fehlgeschlagen")}}async function Nde(i,e,t,n,r){const s=await fetch(`${us}/play-url`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({url:i,guildId:e,channelId:t,volume:n,filename:r})}),a=await s.json().catch(()=>({}));if(!s.ok)throw new Error((a==null?void 0:a.error)||"Play-URL fehlgeschlagen");return a}async function Dde(i,e){const t=await fetch(`${us}/download-url`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({url:i,filename:e})}),n=await t.json().catch(()=>({}));if(!t.ok)throw new Error((n==null?void 0:n.error)||"Download fehlgeschlagen");return n}async function Pde(i,e){if(!(await fetch(`${us}/party/start`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({guildId:i,channelId:e})})).ok)throw new Error("Partymode Start fehlgeschlagen")}async function Lde(i){if(!(await fetch(`${us}/party/stop`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({guildId:i})})).ok)throw new Error("Partymode Stop fehlgeschlagen")}async function d7(i,e){const t=await fetch(`${us}/volume`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({guildId:i,volume:e})});if(!t.ok){const n=await t.json().catch(()=>({}));throw new Error((n==null?void 0:n.error)||"Volume aendern fehlgeschlagen")}}async function Ude(i){const e=new URL(`${us}/volume`,window.location.origin);e.searchParams.set("guildId",i);const t=await fetch(e.toString());if(!t.ok)throw new Error("Fehler beim Laden der Lautstaerke");const n=await t.json();return typeof(n==null?void 0:n.volume)=="number"?n.volume:1}async function Bde(){const i=await fetch(`${us}/admin/status`,{credentials:"include"});if(!i.ok)return!1;const e=await i.json();return!!(e!=null&&e.authenticated)}async function Ode(i){return(await fetch(`${us}/admin/login`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({password:i})})).ok}async function Ide(){await fetch(`${us}/admin/logout`,{method:"POST",credentials:"include"})}async function Fde(i){if(!(await fetch(`${us}/admin/sounds/delete`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({paths:i})})).ok)throw new Error("Loeschen fehlgeschlagen")}async function kde(i,e){const t=await fetch(`${us}/admin/sounds/rename`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({from:i,to:e})});if(!t.ok)throw new Error("Umbenennen fehlgeschlagen");const n=await t.json();return n==null?void 0:n.to}function zde(i,e){return new Promise((t,n)=>{const r=new FormData;r.append("files",i);const s=new XMLHttpRequest;s.open("POST",`${us}/upload`),s.upload.onprogress=a=>{a.lengthComputable&&e(Math.round(a.loaded/a.total*100))},s.onload=()=>{var a,l;if(s.status===200)try{const u=JSON.parse(s.responseText);t(((l=(a=u.files)==null?void 0:a[0])==null?void 0:l.name)??i.name)}catch{t(i.name)}else try{n(new Error(JSON.parse(s.responseText).error))}catch{n(new Error(`HTTP ${s.status}`))}},s.onerror=()=>n(new Error("Netzwerkfehler")),s.send(r)})}const Gde=[{id:"default",color:"#5865f2",label:"Discord"},{id:"purple",color:"#9b59b6",label:"Midnight"},{id:"forest",color:"#2ecc71",label:"Forest"},{id:"sunset",color:"#e67e22",label:"Sunset"},{id:"ocean",color:"#3498db",label:"Ocean"}],p7=["#3b82f6","#f59e0b","#8b5cf6","#ec4899","#14b8a6","#f97316","#06b6d4","#ef4444","#a855f7","#84cc16","#d946ef","#0ea5e9","#f43f5e","#10b981"];function qde({data:i}){const[e,t]=Ie.useState([]),[n,r]=Ie.useState(0),[s,a]=Ie.useState([]),[l,u]=Ie.useState([]),[h,g]=Ie.useState({totalSounds:0,totalPlays:0,mostPlayed:[]}),[v,x]=Ie.useState("all"),[S,w]=Ie.useState(""),[R,C]=Ie.useState(""),[E,B]=Ie.useState(""),[L,O]=Ie.useState(!1),[z,G]=Ie.useState(null),[k,H]=Ie.useState([]),[F,V]=Ie.useState(""),X=Ie.useRef(""),[J,te]=Ie.useState(!1),[se,ne]=Ie.useState(1),[Z,ue]=Ie.useState(""),[he,be]=Ie.useState({}),[Se,le]=Ie.useState(()=>localStorage.getItem("jb-theme")||"default"),[we,We]=Ie.useState(()=>parseInt(localStorage.getItem("jb-card-size")||"110")),[Te,ze]=Ie.useState(!1),[_e,De]=Ie.useState([]),pt=Ie.useRef(!1),_t=Ie.useRef(void 0),[wt,Ge]=Ie.useState(!1),[Be,ke]=Ie.useState(!1),[oe,Mt]=Ie.useState(""),[lt,Dt]=Ie.useState([]),[ut,en]=Ie.useState(!1),[St,fe]=Ie.useState(""),[Y,Ce]=Ie.useState({}),[$e,it]=Ie.useState(""),[tt,Vt]=Ie.useState(""),[Bt,Wt]=Ie.useState(!1),[ln,Tt]=Ie.useState([]),[Kt,rn]=Ie.useState(!1),Ht=Ie.useRef(0),Ft=Ie.useRef(void 0),[Gt,In]=Ie.useState(null),[Mi,me]=Ie.useState(!1),[jt,rt]=Ie.useState(null),[yt,$t]=Ie.useState(""),[kt,xn]=Ie.useState(null),[qi,rr]=Ie.useState(0);Ie.useEffect(()=>{pt.current=Te},[Te]),Ie.useEffect(()=>{X.current=F},[F]),Ie.useEffect(()=>{const ve=cn=>{var Yn;Array.from(((Yn=cn.dataTransfer)==null?void 0:Yn.items)??[]).some(yi=>yi.kind==="file")&&(Ht.current++,Wt(!0))},ot=()=>{Ht.current=Math.max(0,Ht.current-1),Ht.current===0&&Wt(!1)},Rt=cn=>cn.preventDefault(),Zt=cn=>{var yi;cn.preventDefault(),Ht.current=0,Wt(!1);const Yn=Array.from(((yi=cn.dataTransfer)==null?void 0:yi.files)??[]).filter(js=>/\.(mp3|wav)$/i.test(js.name));Yn.length&&Hs(Yn)};return window.addEventListener("dragenter",ve),window.addEventListener("dragleave",ot),window.addEventListener("dragover",Rt),window.addEventListener("drop",Zt),()=>{window.removeEventListener("dragenter",ve),window.removeEventListener("dragleave",ot),window.removeEventListener("dragover",Rt),window.removeEventListener("drop",Zt)}},[wt]);const pn=Ie.useCallback((ve,ot="info")=>{rt({msg:ve,type:ot}),setTimeout(()=>rt(null),3e3)},[]),$i=Ie.useCallback(ve=>ve.relativePath??ve.fileName,[]),Jr=["youtube.com","www.youtube.com","m.youtube.com","youtu.be","music.youtube.com","instagram.com","www.instagram.com"],Ze=Ie.useCallback(ve=>{const ot=ve.trim();return!ot||/^https?:\/\//i.test(ot)?ot:"https://"+ot},[]),mt=Ie.useCallback(ve=>{try{const ot=new URL(Ze(ve)),Rt=ot.hostname.toLowerCase();return!!(ot.pathname.toLowerCase().endsWith(".mp3")||Jr.some(Zt=>Rt===Zt||Rt.endsWith("."+Zt)))}catch{return!1}},[Ze]),It=Ie.useCallback(ve=>{try{const ot=new URL(Ze(ve)),Rt=ot.hostname.toLowerCase();return Rt.includes("youtube")||Rt==="youtu.be"?"youtube":Rt.includes("instagram")?"instagram":ot.pathname.toLowerCase().endsWith(".mp3")?"mp3":null}catch{return null}},[Ze]),at=F?F.split(":")[0]:"",d=F?F.split(":")[1]:"",ee=Ie.useMemo(()=>k.find(ve=>`${ve.guildId}:${ve.channelId}`===F),[k,F]);Ie.useEffect(()=>{const ve=()=>{const Rt=new Date,Zt=String(Rt.getHours()).padStart(2,"0"),cn=String(Rt.getMinutes()).padStart(2,"0"),Yn=String(Rt.getSeconds()).padStart(2,"0");$t(`${Zt}:${cn}:${Yn}`)};ve();const ot=setInterval(ve,1e3);return()=>clearInterval(ot)},[]),Ie.useEffect(()=>{(async()=>{try{const[ve,ot]=await Promise.all([Mde(),Ede()]);if(H(ve),ve.length){const Rt=ve[0].guildId,Zt=ot[Rt],cn=Zt&&ve.find(Yn=>Yn.guildId===Rt&&Yn.channelId===Zt);V(cn?`${Rt}:${Zt}`:`${ve[0].guildId}:${ve[0].channelId}`)}}catch(ve){pn((ve==null?void 0:ve.message)||"Channel-Fehler","error")}try{Ge(await Bde())}catch{}try{const ve=await wde();u(ve.categories||[])}catch{}})()},[]),Ie.useEffect(()=>{localStorage.setItem("jb-theme",Se)},[Se]);const $n=Ie.useRef(null);Ie.useEffect(()=>{const ve=$n.current;if(!ve)return;ve.style.setProperty("--card-size",we+"px");const ot=we/110;ve.style.setProperty("--card-emoji",Math.round(28*ot)+"px"),ve.style.setProperty("--card-font",Math.max(9,Math.round(11*ot))+"px"),localStorage.setItem("jb-card-size",String(we))},[we]),Ie.useEffect(()=>{var ve,ot,Rt,Zt,cn,Yn,yi,js;if(i){if(i.soundboard){const pi=i.soundboard;Array.isArray(pi.party)&&De(pi.party);try{const Pr=pi.selected||{},Ei=(ve=X.current)==null?void 0:ve.split(":")[0];Ei&&Pr[Ei]&&V(`${Ei}:${Pr[Ei]}`)}catch{}try{const Pr=pi.volumes||{},Ei=(ot=X.current)==null?void 0:ot.split(":")[0];Ei&&typeof Pr[Ei]=="number"&&ne(Pr[Ei])}catch{}try{const Pr=pi.nowplaying||{},Ei=(Rt=X.current)==null?void 0:Rt.split(":")[0];Ei&&typeof Pr[Ei]=="string"&&ue(Pr[Ei])}catch{}try{const Pr=pi.voicestats||{},Ei=(Zt=X.current)==null?void 0:Zt.split(":")[0];Ei&&Pr[Ei]&&In(Pr[Ei])}catch{}}if(i.type==="soundboard_party")De(pi=>{const Pr=new Set(pi);return i.active?Pr.add(i.guildId):Pr.delete(i.guildId),Array.from(Pr)});else if(i.type==="soundboard_channel"){const pi=(cn=X.current)==null?void 0:cn.split(":")[0];i.guildId===pi&&V(`${i.guildId}:${i.channelId}`)}else if(i.type==="soundboard_volume"){const pi=(Yn=X.current)==null?void 0:Yn.split(":")[0];i.guildId===pi&&typeof i.volume=="number"&&ne(i.volume)}else if(i.type==="soundboard_nowplaying"){const pi=(yi=X.current)==null?void 0:yi.split(":")[0];i.guildId===pi&&ue(i.name||"")}else if(i.type==="soundboard_voicestats"){const pi=(js=X.current)==null?void 0:js.split(":")[0];i.guildId===pi&&In({voicePing:i.voicePing,gatewayPing:i.gatewayPing,status:i.status,channelName:i.channelName,connectedSince:i.connectedSince})}}},[i]),Ie.useEffect(()=>{ze(at?_e.includes(at):!1)},[F,_e,at]),Ie.useEffect(()=>{(async()=>{try{let ve="__all__";v==="recent"?ve="__recent__":S&&(ve=S);const ot=await A7(R,ve,void 0,!1);t(ot.items),r(ot.total),a(ot.folders)}catch(ve){pn((ve==null?void 0:ve.message)||"Sounds-Fehler","error")}})()},[v,S,R,qi,pn]),Ie.useEffect(()=>{Gn()},[qi]),Ie.useEffect(()=>{const ve=Sde("favs");if(ve)try{be(JSON.parse(ve))}catch{}},[]),Ie.useEffect(()=>{try{bde("favs",JSON.stringify(he))}catch{}},[he]),Ie.useEffect(()=>{F&&(async()=>{try{const ve=await Ude(at);ne(ve)}catch{}})()},[F]),Ie.useEffect(()=>{const ve=()=>{te(!1),xn(null)};return document.addEventListener("click",ve),()=>document.removeEventListener("click",ve)},[]),Ie.useEffect(()=>{Be&&wt&&ae()},[Be,wt]);async function Gn(){try{const ve=await Tde();g(ve)}catch{}}async function Xn(ve){if(!F)return pn("Bitte einen Voice-Channel auswaehlen","error");try{await Rde(ve.name,at,d,se,ve.relativePath),ue(ve.name),Gn()}catch(ot){pn((ot==null?void 0:ot.message)||"Play fehlgeschlagen","error")}}function un(){var Zt;const ve=Ze(E);if(!ve)return pn("Bitte einen Link eingeben","error");if(!mt(ve))return pn("Nur YouTube, Instagram oder direkte MP3-Links","error");const ot=It(ve);let Rt="";if(ot==="mp3")try{Rt=((Zt=new URL(ve).pathname.split("/").pop())==null?void 0:Zt.replace(/\.mp3$/i,""))??""}catch{}G({url:ve,type:ot,filename:Rt,phase:"input"})}async function qn(){if(z){G(ve=>ve?{...ve,phase:"downloading"}:null);try{let ve;const ot=z.filename.trim()||void 0;F&&at&&d?ve=(await Nde(z.url,at,d,se,ot)).saved:ve=(await Dde(z.url,ot)).saved,G(Rt=>Rt?{...Rt,phase:"done",savedName:ve}:null),B(""),rr(Rt=>Rt+1),Gn(),setTimeout(()=>G(null),2500)}catch(ve){G(ot=>ot?{...ot,phase:"error",error:(ve==null?void 0:ve.message)||"Fehler"}:null)}}}async function Hs(ve){if(!wt){pn("Admin-Login erforderlich zum Hochladen","error");return}Ft.current&&clearTimeout(Ft.current);const ot=ve.map(Zt=>({id:Math.random().toString(36).slice(2),file:Zt,status:"waiting",progress:0}));Tt(ot),rn(!0);const Rt=[...ot];for(let Zt=0;Zt{Rt[Zt]={...Rt[Zt],progress:Yn},Tt([...Rt])});Rt[Zt]={...Rt[Zt],status:"done",progress:100,savedName:cn}}catch(cn){Rt[Zt]={...Rt[Zt],status:"error",error:(cn==null?void 0:cn.message)??"Fehler"}}Tt([...Rt])}rr(Zt=>Zt+1),Gn(),Ft.current=setTimeout(()=>{rn(!1),Tt([])},3500)}async function li(){if(F){ue("");try{await fetch(`${us}/stop?guildId=${encodeURIComponent(at)}`,{method:"POST"})}catch{}}}async function Fn(){if(!K.length||!F)return;const ve=K[Math.floor(Math.random()*K.length)];Xn(ve)}async function cs(){if(Te){await li();try{await Lde(at)}catch{}}else{if(!F)return pn("Bitte einen Channel auswaehlen","error");try{await Pde(at,d)}catch{}}}async function Ma(ve){const ot=`${ve.guildId}:${ve.channelId}`;V(ot),te(!1);try{await Cde(ve.guildId,ve.channelId)}catch{}}function Ul(ve){be(ot=>({...ot,[ve]:!ot[ve]}))}async function ae(){en(!0);try{const ve=await A7("","__all__",void 0,!1);Dt(ve.items||[])}catch(ve){pn((ve==null?void 0:ve.message)||"Admin-Sounds konnten nicht geladen werden","error")}finally{en(!1)}}function Ue(ve){Ce(ot=>({...ot,[ve]:!ot[ve]}))}function Qe(ve){it($i(ve)),Vt(ve.name)}function Xe(){it(""),Vt("")}async function Oe(){if(!$e)return;const ve=tt.trim().replace(/\.(mp3|wav)$/i,"");if(!ve){pn("Bitte einen gueltigen Namen eingeben","error");return}try{await kde($e,ve),pn("Sound umbenannt"),Xe(),rr(ot=>ot+1),Be&&await ae()}catch(ot){pn((ot==null?void 0:ot.message)||"Umbenennen fehlgeschlagen","error")}}async function Ot(ve){if(ve.length!==0)try{await Fde(ve),pn(ve.length===1?"Sound geloescht":`${ve.length} Sounds geloescht`),Ce({}),Xe(),rr(ot=>ot+1),Be&&await ae()}catch(ot){pn((ot==null?void 0:ot.message)||"Loeschen fehlgeschlagen","error")}}async function qt(){try{await Ode(oe)?(Ge(!0),Mt(""),pn("Admin eingeloggt")):pn("Falsches Passwort","error")}catch{pn("Login fehlgeschlagen","error")}}async function At(){try{await Ide(),Ge(!1),Ce({}),Xe(),pn("Ausgeloggt")}catch{}}const K=Ie.useMemo(()=>v==="favorites"?e.filter(ve=>he[ve.relativePath??ve.fileName]):e,[e,v,he]),Ut=Ie.useMemo(()=>Object.values(he).filter(Boolean).length,[he]),bn=Ie.useMemo(()=>s.filter(ve=>!["__all__","__recent__","__top3__"].includes(ve.key)),[s]),fn=Ie.useMemo(()=>{const ve={};return bn.forEach((ot,Rt)=>{ve[ot.key]=p7[Rt%p7.length]}),ve},[bn]),ui=Ie.useMemo(()=>{const ve=new Set,ot=new Set;return K.forEach((Rt,Zt)=>{const cn=Rt.name.charAt(0).toUpperCase();ve.has(cn)||(ve.add(cn),ot.add(Zt))}),ot},[K]),ci=Ie.useMemo(()=>{const ve={};return k.forEach(ot=>{ve[ot.guildName]||(ve[ot.guildName]=[]),ve[ot.guildName].push(ot)}),ve},[k]),_i=Ie.useMemo(()=>{const ve=St.trim().toLowerCase();return ve?lt.filter(ot=>{const Rt=$i(ot).toLowerCase();return ot.name.toLowerCase().includes(ve)||(ot.folder||"").toLowerCase().includes(ve)||Rt.includes(ve)}):lt},[St,lt,$i]),Q=Ie.useMemo(()=>Object.keys(Y).filter(ve=>Y[ve]),[Y]),Ln=Ie.useMemo(()=>_i.filter(ve=>!!Y[$i(ve)]).length,[_i,Y,$i]),mn=_i.length>0&&Ln===_i.length,yr=h.mostPlayed.slice(0,10),hi=h.totalSounds||n,bs=yt.slice(0,5),fa=yt.slice(5);return W.jsxs("div",{className:"sb-app","data-theme":Se,ref:$n,children:[Te&&W.jsx("div",{className:"party-overlay active"}),W.jsxs("header",{className:"topbar",children:[W.jsxs("div",{className:"topbar-left",children:[W.jsx("div",{className:"sb-app-logo",children:W.jsx("span",{className:"material-icons",style:{fontSize:16,color:"white"},children:"music_note"})}),W.jsx("span",{className:"sb-app-title",children:"Soundboard"}),W.jsxs("div",{className:"channel-dropdown",onClick:ve=>ve.stopPropagation(),children:[W.jsxs("button",{className:`channel-btn ${J?"open":""}`,onClick:()=>te(!J),children:[W.jsx("span",{className:"material-icons cb-icon",children:"headset"}),F&&W.jsx("span",{className:"channel-status"}),W.jsx("span",{className:"channel-label",children:ee?`${ee.channelName}${ee.members?` (${ee.members})`:""}`:"Channel..."}),W.jsx("span",{className:"material-icons chevron",children:"expand_more"})]}),J&&W.jsxs("div",{className:"channel-menu visible",children:[Object.entries(ci).map(([ve,ot])=>W.jsxs(LF.Fragment,{children:[W.jsx("div",{className:"channel-menu-header",children:ve}),ot.map(Rt=>W.jsxs("div",{className:`channel-option ${`${Rt.guildId}:${Rt.channelId}`===F?"active":""}`,onClick:()=>Ma(Rt),children:[W.jsx("span",{className:"material-icons co-icon",children:"volume_up"}),Rt.channelName,Rt.members?` (${Rt.members})`:""]},`${Rt.guildId}:${Rt.channelId}`))]},ve)),k.length===0&&W.jsx("div",{className:"channel-option",style:{color:"var(--text-faint)",cursor:"default"},children:"Keine Channels verfuegbar"})]})]})]}),W.jsx("div",{className:"clock-wrap",children:W.jsxs("div",{className:"clock",children:[bs,W.jsx("span",{className:"clock-seconds",children:fa})]})}),W.jsxs("div",{className:"topbar-right",children:[Z&&W.jsxs("div",{className:"now-playing",children:[W.jsxs("div",{className:"np-waves active",children:[W.jsx("div",{className:"np-wave-bar"}),W.jsx("div",{className:"np-wave-bar"}),W.jsx("div",{className:"np-wave-bar"}),W.jsx("div",{className:"np-wave-bar"})]}),W.jsx("span",{className:"np-label",children:"Last Played:"})," ",W.jsx("span",{className:"np-name",children:Z})]}),F&&W.jsxs("div",{className:"connection",onClick:()=>me(!0),style:{cursor:"pointer"},title:"Verbindungsdetails",children:[W.jsx("span",{className:"conn-dot"}),"Verbunden",(Gt==null?void 0:Gt.voicePing)!=null&&W.jsxs("span",{className:"conn-ping",children:[Gt.voicePing,"ms"]})]}),W.jsx("button",{className:`admin-btn-icon ${wt?"active":""}`,onClick:()=>ke(!0),title:"Admin",children:W.jsx("span",{className:"material-icons",children:"settings"})})]})]}),W.jsxs("div",{className:"toolbar",children:[W.jsxs("div",{className:"cat-tabs",children:[W.jsxs("button",{className:`cat-tab ${v==="all"?"active":""}`,onClick:()=>{x("all"),w("")},children:["Alle",W.jsx("span",{className:"tab-count",children:n})]}),W.jsx("button",{className:`cat-tab ${v==="recent"?"active":""}`,onClick:()=>{x("recent"),w("")},children:"Neu hinzugefuegt"}),W.jsxs("button",{className:`cat-tab ${v==="favorites"?"active":""}`,onClick:()=>{x("favorites"),w("")},children:["Favoriten",Ut>0&&W.jsx("span",{className:"tab-count",children:Ut})]})]}),W.jsxs("div",{className:"search-wrap",children:[W.jsx("span",{className:"material-icons search-icon",children:"search"}),W.jsx("input",{className:"search-input",type:"text",placeholder:"Suchen...",value:R,onChange:ve=>C(ve.target.value)}),R&&W.jsx("button",{className:"search-clear",onClick:()=>C(""),children:W.jsx("span",{className:"material-icons",style:{fontSize:14},children:"close"})})]}),W.jsxs("div",{className:"url-import-wrap",children:[W.jsx("span",{className:"material-icons url-import-icon",children:It(E)==="youtube"?"smart_display":It(E)==="instagram"?"photo_camera":"link"}),W.jsx("input",{className:"url-import-input",type:"text",placeholder:"YouTube / Instagram / MP3-Link...",value:E,onChange:ve=>B(ve.target.value),onKeyDown:ve=>{ve.key==="Enter"&&un()}}),E&&W.jsx("span",{className:`url-import-tag ${mt(E)?"valid":"invalid"}`,children:It(E)==="youtube"?"YT":It(E)==="instagram"?"IG":It(E)==="mp3"?"MP3":"?"}),W.jsx("button",{className:"url-import-btn",onClick:()=>{un()},disabled:L||!!E&&!mt(E),title:"Sound herunterladen",children:L?"Laedt...":"Download"})]}),W.jsx("div",{className:"toolbar-spacer"}),W.jsxs("div",{className:"volume-control",children:[W.jsx("span",{className:"material-icons vol-icon",onClick:()=>{const ve=se>0?0:.5;ne(ve),at&&d7(at,ve).catch(()=>{})},children:se===0?"volume_off":se<.5?"volume_down":"volume_up"}),W.jsx("input",{type:"range",className:"vol-slider",min:0,max:1,step:.01,value:se,onChange:ve=>{const ot=parseFloat(ve.target.value);ne(ot),at&&(_t.current&&clearTimeout(_t.current),_t.current=setTimeout(()=>{d7(at,ot).catch(()=>{})},120))},style:{"--vol":`${Math.round(se*100)}%`}}),W.jsxs("span",{className:"vol-pct",children:[Math.round(se*100),"%"]})]}),W.jsxs("button",{className:"tb-btn random",onClick:Fn,title:"Zufaelliger Sound",children:[W.jsx("span",{className:"material-icons tb-icon",children:"shuffle"}),"Random"]}),W.jsxs("button",{className:`tb-btn party ${Te?"active":""}`,onClick:cs,title:"Party Mode",children:[W.jsx("span",{className:"material-icons tb-icon",children:Te?"celebration":"auto_awesome"}),Te?"Party!":"Party"]}),W.jsxs("button",{className:"tb-btn stop",onClick:li,title:"Alle stoppen",children:[W.jsx("span",{className:"material-icons tb-icon",children:"stop"}),"Stop"]}),W.jsxs("div",{className:"size-control",title:"Button-Groesse",children:[W.jsx("span",{className:"material-icons sc-icon",children:"grid_view"}),W.jsx("input",{type:"range",className:"size-slider",min:80,max:160,value:we,onChange:ve=>We(parseInt(ve.target.value))})]}),W.jsx("div",{className:"theme-selector",children:Gde.map(ve=>W.jsx("div",{className:`theme-dot ${Se===ve.id?"active":""}`,style:{background:ve.color},title:ve.label,onClick:()=>le(ve.id)},ve.id))})]}),W.jsxs("div",{className:"analytics-strip",children:[W.jsxs("div",{className:"analytics-card",children:[W.jsx("span",{className:"material-icons analytics-icon",children:"library_music"}),W.jsxs("div",{className:"analytics-copy",children:[W.jsx("span",{className:"analytics-label",children:"Sounds gesamt"}),W.jsx("strong",{className:"analytics-value",children:hi})]})]}),W.jsxs("div",{className:"analytics-card analytics-wide",children:[W.jsx("span",{className:"material-icons analytics-icon",children:"leaderboard"}),W.jsxs("div",{className:"analytics-copy",children:[W.jsx("span",{className:"analytics-label",children:"Most Played"}),W.jsx("div",{className:"analytics-top-list",children:yr.length===0?W.jsx("span",{className:"analytics-muted",children:"Noch keine Plays"}):yr.map((ve,ot)=>W.jsxs("span",{className:"analytics-chip",children:[ot+1,". ",ve.name," (",ve.count,")"]},ve.relativePath))})]})]})]}),v==="all"&&bn.length>0&&W.jsx("div",{className:"category-strip",children:bn.map(ve=>{const ot=fn[ve.key]||"#888",Rt=S===ve.key;return W.jsxs("button",{className:`cat-chip ${Rt?"active":""}`,onClick:()=>w(Rt?"":ve.key),style:Rt?{borderColor:ot,color:ot}:void 0,children:[W.jsx("span",{className:"cat-dot",style:{background:ot}}),ve.name.replace(/\s*\(\d+\)\s*$/,""),W.jsx("span",{className:"cat-count",children:ve.count})]},ve.key)})}),W.jsx("main",{className:"main",children:K.length===0?W.jsxs("div",{className:"empty-state visible",children:[W.jsx("div",{className:"empty-emoji",children:v==="favorites"?"⭐":"🔇"}),W.jsx("div",{className:"empty-title",children:v==="favorites"?"Noch keine Favoriten":R?`Kein Sound fuer "${R}" gefunden`:"Keine Sounds vorhanden"}),W.jsx("div",{className:"empty-desc",children:v==="favorites"?"Klick den Stern auf einem Sound!":"Hier gibt's noch nichts zu hoeren."})]}):W.jsx("div",{className:"sound-grid",children:K.map((ve,ot)=>{var Pr;const Rt=ve.relativePath??ve.fileName,Zt=!!he[Rt],cn=Z===ve.name,Yn=ve.isRecent||((Pr=ve.badges)==null?void 0:Pr.includes("new")),yi=ve.name.charAt(0).toUpperCase(),js=ui.has(ot),pi=ve.folder&&fn[ve.folder]||"var(--accent)";return W.jsxs("div",{className:`sound-card ${cn?"playing":""} ${js?"has-initial":""}`,style:{animationDelay:`${Math.min(ot*20,400)}ms`},onClick:Ei=>{const Zh=Ei.currentTarget,Bl=Zh.getBoundingClientRect(),nl=document.createElement("div");nl.className="ripple";const Bi=Math.max(Bl.width,Bl.height);nl.style.width=nl.style.height=Bi+"px",nl.style.left=Ei.clientX-Bl.left-Bi/2+"px",nl.style.top=Ei.clientY-Bl.top-Bi/2+"px",Zh.appendChild(nl),setTimeout(()=>nl.remove(),500),Xn(ve)},onContextMenu:Ei=>{Ei.preventDefault(),Ei.stopPropagation(),xn({x:Math.min(Ei.clientX,window.innerWidth-170),y:Math.min(Ei.clientY,window.innerHeight-140),sound:ve})},title:`${ve.name}${ve.folder?` (${ve.folder})`:""}`,children:[Yn&&W.jsx("span",{className:"new-badge",children:"NEU"}),W.jsx("span",{className:`fav-star ${Zt?"active":""}`,onClick:Ei=>{Ei.stopPropagation(),Ul(Rt)},children:W.jsx("span",{className:"material-icons fav-icon",children:Zt?"star":"star_border"})}),js&&W.jsx("span",{className:"sound-emoji",style:{color:pi},children:yi}),W.jsx("span",{className:"sound-name",children:ve.name}),ve.folder&&W.jsx("span",{className:"sound-duration",children:ve.folder}),W.jsxs("div",{className:"playing-indicator",children:[W.jsx("div",{className:"wave-bar"}),W.jsx("div",{className:"wave-bar"}),W.jsx("div",{className:"wave-bar"}),W.jsx("div",{className:"wave-bar"})]})]},Rt)})})}),kt&&W.jsxs("div",{className:"ctx-menu visible",style:{left:kt.x,top:kt.y},onClick:ve=>ve.stopPropagation(),children:[W.jsxs("div",{className:"ctx-item",onClick:()=>{Xn(kt.sound),xn(null)},children:[W.jsx("span",{className:"material-icons ctx-icon",children:"play_arrow"}),"Abspielen"]}),W.jsxs("div",{className:"ctx-item",onClick:()=>{Ul(kt.sound.relativePath??kt.sound.fileName),xn(null)},children:[W.jsx("span",{className:"material-icons ctx-icon",children:he[kt.sound.relativePath??kt.sound.fileName]?"star":"star_border"}),"Favorit"]}),wt&&W.jsxs(W.Fragment,{children:[W.jsx("div",{className:"ctx-sep"}),W.jsxs("div",{className:"ctx-item danger",onClick:async()=>{const ve=kt.sound.relativePath??kt.sound.fileName;await Ot([ve]),xn(null)},children:[W.jsx("span",{className:"material-icons ctx-icon",children:"delete"}),"Loeschen"]})]})]}),Mi&&(()=>{const ve=Gt!=null&&Gt.connectedSince?Math.floor((Date.now()-new Date(Gt.connectedSince).getTime())/1e3):0,ot=Math.floor(ve/3600),Rt=Math.floor(ve%3600/60),Zt=ve%60,cn=ot>0?`${ot}h ${String(Rt).padStart(2,"0")}m ${String(Zt).padStart(2,"0")}s`:Rt>0?`${Rt}m ${String(Zt).padStart(2,"0")}s`:`${Zt}s`,Yn=yi=>yi==null?"var(--muted)":yi<80?"var(--green)":yi<150?"#f0a830":"#e04040";return W.jsx("div",{className:"conn-modal-overlay",onClick:()=>me(!1),children:W.jsxs("div",{className:"conn-modal",onClick:yi=>yi.stopPropagation(),children:[W.jsxs("div",{className:"conn-modal-header",children:[W.jsx("span",{className:"material-icons",style:{fontSize:20,color:"var(--green)"},children:"cell_tower"}),W.jsx("span",{children:"Verbindungsdetails"}),W.jsx("button",{className:"conn-modal-close",onClick:()=>me(!1),children:W.jsx("span",{className:"material-icons",children:"close"})})]}),W.jsxs("div",{className:"conn-modal-body",children:[W.jsxs("div",{className:"conn-stat",children:[W.jsx("span",{className:"conn-stat-label",children:"Voice Ping"}),W.jsxs("span",{className:"conn-stat-value",children:[W.jsx("span",{className:"conn-ping-dot",style:{background:Yn((Gt==null?void 0:Gt.voicePing)??null)}}),(Gt==null?void 0:Gt.voicePing)!=null?`${Gt.voicePing} ms`:"---"]})]}),W.jsxs("div",{className:"conn-stat",children:[W.jsx("span",{className:"conn-stat-label",children:"Gateway Ping"}),W.jsxs("span",{className:"conn-stat-value",children:[W.jsx("span",{className:"conn-ping-dot",style:{background:Yn((Gt==null?void 0:Gt.gatewayPing)??null)}}),Gt&&Gt.gatewayPing>=0?`${Gt.gatewayPing} ms`:"---"]})]}),W.jsxs("div",{className:"conn-stat",children:[W.jsx("span",{className:"conn-stat-label",children:"Status"}),W.jsx("span",{className:"conn-stat-value",style:{color:(Gt==null?void 0:Gt.status)==="ready"?"var(--green)":"#f0a830"},children:(Gt==null?void 0:Gt.status)==="ready"?"Verbunden":(Gt==null?void 0:Gt.status)??"Warte auf Verbindung"})]}),W.jsxs("div",{className:"conn-stat",children:[W.jsx("span",{className:"conn-stat-label",children:"Kanal"}),W.jsx("span",{className:"conn-stat-value",children:(Gt==null?void 0:Gt.channelName)||"---"})]}),W.jsxs("div",{className:"conn-stat",children:[W.jsx("span",{className:"conn-stat-label",children:"Verbunden seit"}),W.jsx("span",{className:"conn-stat-value",children:cn||"---"})]})]})]})})})(),jt&&W.jsxs("div",{className:`toast ${jt.type}`,children:[W.jsx("span",{className:"material-icons toast-icon",children:jt.type==="error"?"error_outline":"check_circle"}),jt.msg]}),Be&&W.jsx("div",{className:"admin-overlay",onClick:ve=>{ve.target===ve.currentTarget&&ke(!1)},children:W.jsxs("div",{className:"admin-panel",children:[W.jsxs("h3",{children:["Admin",W.jsx("button",{className:"admin-close",onClick:()=>ke(!1),children:W.jsx("span",{className:"material-icons",style:{fontSize:18},children:"close"})})]}),wt?W.jsxs("div",{className:"admin-shell",children:[W.jsxs("div",{className:"admin-header-row",children:[W.jsx("p",{className:"admin-status",children:"Eingeloggt als Admin"}),W.jsxs("div",{className:"admin-actions-inline",children:[W.jsx("button",{className:"admin-btn-action outline",onClick:()=>{ae()},disabled:ut,children:"Aktualisieren"}),W.jsx("button",{className:"admin-btn-action outline",onClick:At,children:"Logout"})]})]}),W.jsxs("div",{className:"admin-field admin-search-field",children:[W.jsx("label",{children:"Sounds verwalten"}),W.jsx("input",{type:"text",value:St,onChange:ve=>fe(ve.target.value),placeholder:"Nach Name, Ordner oder Pfad filtern..."})]}),W.jsxs("div",{className:"admin-bulk-row",children:[W.jsxs("label",{className:"admin-select-all",children:[W.jsx("input",{type:"checkbox",checked:mn,onChange:ve=>{const ot=ve.target.checked,Rt={...Y};_i.forEach(Zt=>{Rt[$i(Zt)]=ot}),Ce(Rt)}}),W.jsxs("span",{children:["Alle sichtbaren auswaehlen (",Ln,"/",_i.length,")"]})]}),W.jsx("button",{className:"admin-btn-action danger",disabled:Q.length===0,onClick:async()=>{window.confirm(`Wirklich ${Q.length} Sound(s) loeschen?`)&&await Ot(Q)},children:"Ausgewaehlte loeschen"})]}),W.jsx("div",{className:"admin-list-wrap",children:ut?W.jsx("div",{className:"admin-empty",children:"Lade Sounds..."}):_i.length===0?W.jsx("div",{className:"admin-empty",children:"Keine Sounds gefunden."}):W.jsx("div",{className:"admin-list",children:_i.map(ve=>{const ot=$i(ve),Rt=$e===ot;return W.jsxs("div",{className:"admin-item",children:[W.jsx("label",{className:"admin-item-check",children:W.jsx("input",{type:"checkbox",checked:!!Y[ot],onChange:()=>Ue(ot)})}),W.jsxs("div",{className:"admin-item-main",children:[W.jsx("div",{className:"admin-item-name",children:ve.name}),W.jsxs("div",{className:"admin-item-meta",children:[ve.folder?`Ordner: ${ve.folder}`:"Root"," · ",ot]}),Rt&&W.jsxs("div",{className:"admin-rename-row",children:[W.jsx("input",{value:tt,onChange:Zt=>Vt(Zt.target.value),onKeyDown:Zt=>{Zt.key==="Enter"&&Oe(),Zt.key==="Escape"&&Xe()},placeholder:"Neuer Name..."}),W.jsx("button",{className:"admin-btn-action primary",onClick:()=>{Oe()},children:"Speichern"}),W.jsx("button",{className:"admin-btn-action outline",onClick:Xe,children:"Abbrechen"})]})]}),!Rt&&W.jsxs("div",{className:"admin-item-actions",children:[W.jsx("button",{className:"admin-btn-action outline",onClick:()=>Qe(ve),children:"Umbenennen"}),W.jsx("button",{className:"admin-btn-action danger ghost",onClick:async()=>{window.confirm(`Sound "${ve.name}" loeschen?`)&&await Ot([ot])},children:"Loeschen"})]})]},ot)})})})]}):W.jsxs("div",{children:[W.jsxs("div",{className:"admin-field",children:[W.jsx("label",{children:"Passwort"}),W.jsx("input",{type:"password",value:oe,onChange:ve=>Mt(ve.target.value),onKeyDown:ve=>ve.key==="Enter"&&qt(),placeholder:"Admin-Passwort..."})]}),W.jsx("button",{className:"admin-btn-action primary",onClick:qt,children:"Login"})]})]})}),Bt&&W.jsx("div",{className:"drop-overlay",children:W.jsxs("div",{className:"drop-zone",children:[W.jsx("span",{className:"material-icons drop-icon",children:"cloud_upload"}),W.jsx("div",{className:"drop-title",children:"MP3 & WAV hier ablegen"}),W.jsx("div",{className:"drop-sub",children:"Mehrere Dateien gleichzeitig moeglich"})]})}),Kt&&ln.length>0&&W.jsxs("div",{className:"upload-queue",children:[W.jsxs("div",{className:"uq-header",children:[W.jsx("span",{className:"material-icons",style:{fontSize:16},children:"upload"}),W.jsx("span",{children:ln.every(ve=>ve.status==="done"||ve.status==="error")?`${ln.filter(ve=>ve.status==="done").length} von ${ln.length} hochgeladen`:`Lade hoch… (${ln.filter(ve=>ve.status==="done").length}/${ln.length})`}),W.jsx("button",{className:"uq-close",onClick:()=>{rn(!1),Tt([])},children:W.jsx("span",{className:"material-icons",style:{fontSize:14},children:"close"})})]}),W.jsx("div",{className:"uq-list",children:ln.map(ve=>W.jsxs("div",{className:`uq-item uq-${ve.status}`,children:[W.jsx("span",{className:"material-icons uq-file-icon",children:"audio_file"}),W.jsxs("div",{className:"uq-info",children:[W.jsx("div",{className:"uq-name",title:ve.savedName??ve.file.name,children:ve.savedName??ve.file.name}),W.jsxs("div",{className:"uq-size",children:[(ve.file.size/1024).toFixed(0)," KB"]})]}),(ve.status==="waiting"||ve.status==="uploading")&&W.jsx("div",{className:"uq-progress-wrap",children:W.jsx("div",{className:"uq-progress-bar",style:{width:`${ve.progress}%`}})}),W.jsx("span",{className:`material-icons uq-status-icon uq-status-${ve.status}`,children:ve.status==="done"?"check_circle":ve.status==="error"?"error":ve.status==="uploading"?"sync":"schedule"}),ve.status==="error"&&W.jsx("div",{className:"uq-error",children:ve.error})]},ve.id))})]}),z&&W.jsx("div",{className:"dl-modal-overlay",onClick:()=>z.phase!=="downloading"&&G(null),children:W.jsxs("div",{className:"dl-modal",onClick:ve=>ve.stopPropagation(),children:[W.jsxs("div",{className:"dl-modal-header",children:[W.jsx("span",{className:"material-icons",style:{fontSize:20},children:z.type==="youtube"?"smart_display":z.type==="instagram"?"photo_camera":"audio_file"}),W.jsx("span",{children:z.phase==="input"?"Sound herunterladen":z.phase==="downloading"?"Wird heruntergeladen...":z.phase==="done"?"Fertig!":"Fehler"}),z.phase!=="downloading"&&W.jsx("button",{className:"dl-modal-close",onClick:()=>G(null),children:W.jsx("span",{className:"material-icons",style:{fontSize:16},children:"close"})})]}),W.jsxs("div",{className:"dl-modal-body",children:[W.jsxs("div",{className:"dl-modal-url",children:[W.jsx("span",{className:`dl-modal-tag ${z.type??""}`,children:z.type==="youtube"?"YouTube":z.type==="instagram"?"Instagram":"MP3"}),W.jsx("span",{className:"dl-modal-url-text",title:z.url,children:z.url.length>60?z.url.slice(0,57)+"...":z.url})]}),z.phase==="input"&&W.jsxs("div",{className:"dl-modal-field",children:[W.jsx("label",{className:"dl-modal-label",children:"Dateiname"}),W.jsxs("div",{className:"dl-modal-input-wrap",children:[W.jsx("input",{className:"dl-modal-input",type:"text",placeholder:z.type==="mp3"?"Dateiname...":"Wird automatisch erkannt...",value:z.filename,onChange:ve=>G(ot=>ot?{...ot,filename:ve.target.value}:null),onKeyDown:ve=>{ve.key==="Enter"&&qn()},autoFocus:!0}),W.jsx("span",{className:"dl-modal-ext",children:".mp3"})]}),W.jsx("span",{className:"dl-modal-hint",children:"Leer lassen = automatischer Name"})]}),z.phase==="downloading"&&W.jsxs("div",{className:"dl-modal-progress",children:[W.jsx("div",{className:"dl-modal-spinner"}),W.jsx("span",{children:z.type==="youtube"||z.type==="instagram"?"Audio wird extrahiert...":"MP3 wird heruntergeladen..."})]}),z.phase==="done"&&W.jsxs("div",{className:"dl-modal-success",children:[W.jsx("span",{className:"material-icons dl-modal-check",children:"check_circle"}),W.jsxs("span",{children:["Gespeichert als ",W.jsx("b",{children:z.savedName})]})]}),z.phase==="error"&&W.jsxs("div",{className:"dl-modal-error",children:[W.jsx("span",{className:"material-icons",style:{color:"#e74c3c"},children:"error"}),W.jsx("span",{children:z.error})]})]}),z.phase==="input"&&W.jsxs("div",{className:"dl-modal-actions",children:[W.jsx("button",{className:"dl-modal-cancel",onClick:()=>G(null),children:"Abbrechen"}),W.jsxs("button",{className:"dl-modal-submit",onClick:()=>void qn(),children:[W.jsx("span",{className:"material-icons",style:{fontSize:16},children:"download"}),"Herunterladen"]})]}),z.phase==="error"&&W.jsxs("div",{className:"dl-modal-actions",children:[W.jsx("button",{className:"dl-modal-cancel",onClick:()=>G(null),children:"Schliessen"}),W.jsxs("button",{className:"dl-modal-submit",onClick:()=>G(ve=>ve?{...ve,phase:"input",error:void 0}:null),children:[W.jsx("span",{className:"material-icons",style:{fontSize:16},children:"refresh"}),"Nochmal"]})]})]})})]})}const m7={IRON:"#6b6b6b",BRONZE:"#8c6239",SILVER:"#8c8c8c",GOLD:"#d4a017",PLATINUM:"#28b29e",EMERALD:"#1e9e5e",DIAMOND:"#576cce",MASTER:"#9d48e0",GRANDMASTER:"#e44c3e",CHALLENGER:"#f4c874"},Vde={SOLORANKED:"Ranked Solo",FLEXRANKED:"Ranked Flex",NORMAL:"Normal",ARAM:"ARAM",ARENA:"Arena",URF:"URF",BOT:"Co-op vs AI"},Hde="https://ddragon.leagueoflegends.com/cdn/15.5.1/img";function zv(i){return`${Hde}/champion/${i}.png`}function g7(i){const e=Math.floor((Date.now()-new Date(i).getTime())/1e3);return e<60?`${e}s`:e<3600?`${Math.floor(e/60)}m`:e<86400?`${Math.floor(e/3600)}h`:`${Math.floor(e/86400)}d`}function jde(i){const e=Math.floor(i/60),t=i%60;return`${e}:${String(t).padStart(2,"0")}`}function v7(i,e,t){return e===0?"Perfect":((i+t)/e).toFixed(2)}function _7(i,e){const t=i+e;return t>0?Math.round(i/t*100):0}function Wde(i,e){if(!i)return"Unranked";const t=["","I","II","III","IV"];return`${i.charAt(0)}${i.slice(1).toLowerCase()}${e?" "+(t[e]??e):""}`}function $de({data:i}){var we,We,Te,ze;const[e,t]=Ie.useState(""),[n,r]=Ie.useState("EUW"),[s,a]=Ie.useState([]),[l,u]=Ie.useState(null),[h,g]=Ie.useState([]),[v,x]=Ie.useState(!1),[S,w]=Ie.useState(null),[R,C]=Ie.useState([]),[E,B]=Ie.useState(null),[L,O]=Ie.useState({}),[z,G]=Ie.useState(!1),[k,H]=Ie.useState(!1),[F,V]=Ie.useState(null),X=Ie.useRef(null),J=Ie.useRef(null);Ie.useEffect(()=>{fetch("/api/lolstats/regions").then(_e=>_e.json()).then(a).catch(()=>{}),fetch("/api/lolstats/recent").then(_e=>_e.json()).then(C).catch(()=>{})},[]),Ie.useEffect(()=>{i&&(i.recentSearches&&C(i.recentSearches),i.regions&&!s.length&&a(i.regions))},[i]);const te=Ie.useCallback(async(_e,De,pt)=>{H(!0);try{const _t=`gameName=${encodeURIComponent(_e)}&tagLine=${encodeURIComponent(De)}®ion=${pt}`,wt=await fetch(`/api/lolstats/renew?${_t}`,{method:"POST"});if(wt.ok){const Ge=await wt.json();return Ge.last_updated_at&&V(Ge.last_updated_at),Ge.renewed??!1}}catch{}return H(!1),!1},[]),se=Ie.useCallback(async(_e,De,pt,_t=!1)=>{var ke,oe;let wt=_e??"",Ge=De??"";const Be=pt??n;if(!wt){const Mt=e.split("#");wt=((ke=Mt[0])==null?void 0:ke.trim())??"",Ge=((oe=Mt[1])==null?void 0:oe.trim())??""}if(!wt||!Ge){w("Bitte im Format Name#Tag eingeben");return}x(!0),w(null),u(null),g([]),B(null),O({}),J.current={gameName:wt,tagLine:Ge,region:Be},_t||te(wt,Ge,Be).finally(()=>H(!1));try{const Mt=`gameName=${encodeURIComponent(wt)}&tagLine=${encodeURIComponent(Ge)}®ion=${Be}`,[lt,Dt]=await Promise.all([fetch(`/api/lolstats/profile?${Mt}`),fetch(`/api/lolstats/matches?${Mt}&limit=10`)]);if(!lt.ok){const en=await lt.json();throw new Error(en.error??`Fehler ${lt.status}`)}const ut=await lt.json();if(u(ut),ut.updated_at&&V(ut.updated_at),Dt.ok){const en=await Dt.json();g(Array.isArray(en)?en:[])}}catch(Mt){w(Mt.message)}x(!1)},[e,n,te]),ne=Ie.useCallback(async()=>{const _e=J.current;if(!(!_e||k)){H(!0);try{await te(_e.gameName,_e.tagLine,_e.region),await new Promise(De=>setTimeout(De,1500)),await se(_e.gameName,_e.tagLine,_e.region,!0)}finally{H(!1)}}},[te,se,k]),Z=Ie.useCallback(async()=>{if(!(!l||z)){G(!0);try{const _e=`gameName=${encodeURIComponent(l.game_name)}&tagLine=${encodeURIComponent(l.tagline)}®ion=${n}&limit=20`,De=await fetch(`/api/lolstats/matches?${_e}`);if(De.ok){const pt=await De.json();g(Array.isArray(pt)?pt:[])}}catch{}G(!1)}},[l,n,z]),ue=Ie.useCallback(async _e=>{var De;if(E===_e.id){B(null);return}if(B(_e.id),!(((De=_e.participants)==null?void 0:De.length)>=10||L[_e.id]))try{const pt=`region=${n}&createdAt=${encodeURIComponent(_e.created_at)}`,_t=await fetch(`/api/lolstats/match/${encodeURIComponent(_e.id)}?${pt}`);if(_t.ok){const wt=await _t.json();O(Ge=>({...Ge,[_e.id]:wt}))}}catch{}},[E,L,n]),he=Ie.useCallback(_e=>{t(`${_e.game_name}#${_e.tag_line}`),r(_e.region),se(_e.game_name,_e.tag_line,_e.region)},[se]),be=Ie.useCallback(_e=>{var pt,_t,wt;if(!l)return((pt=_e.participants)==null?void 0:pt[0])??null;const De=l.game_name.toLowerCase();return((_t=_e.participants)==null?void 0:_t.find(Ge=>{var Be,ke;return((ke=(Be=Ge.summoner)==null?void 0:Be.game_name)==null?void 0:ke.toLowerCase())===De}))??((wt=_e.participants)==null?void 0:wt[0])??null},[l]),Se=_e=>{var oe,Mt,lt;const De=be(_e);if(!De)return null;const pt=((oe=De.stats)==null?void 0:oe.result)==="WIN",_t=v7(De.stats.kill,De.stats.death,De.stats.assist),wt=(De.stats.minion_kill??0)+(De.stats.neutral_minion_kill??0),Ge=_e.game_length_second>0?(wt/(_e.game_length_second/60)).toFixed(1):"0",Be=E===_e.id,ke=L[_e.id]??(((Mt=_e.participants)==null?void 0:Mt.length)>=10?_e:null);return W.jsxs("div",{children:[W.jsxs("div",{className:`lol-match ${pt?"win":"loss"}`,onClick:()=>ue(_e),children:[W.jsx("div",{className:"lol-match-result",children:pt?"W":"L"}),W.jsxs("div",{className:"lol-match-champ",children:[W.jsx("img",{src:zv(De.champion_name),alt:De.champion_name,title:De.champion_name}),W.jsx("span",{className:"lol-match-champ-level",children:De.stats.champion_level})]}),W.jsxs("div",{className:"lol-match-kda",children:[W.jsxs("div",{className:"lol-match-kda-nums",children:[De.stats.kill,"/",De.stats.death,"/",De.stats.assist]}),W.jsxs("div",{className:`lol-match-kda-ratio ${_t==="Perfect"?"perfect":Number(_t)>=4?"great":""}`,children:[_t," KDA"]})]}),W.jsxs("div",{className:"lol-match-stats",children:[W.jsxs("span",{children:[wt," CS (",Ge,"/m)"]}),W.jsxs("span",{children:[De.stats.ward_place," wards"]})]}),W.jsx("div",{className:"lol-match-items",children:(De.items_names??[]).slice(0,7).map((Dt,ut)=>Dt?W.jsx("img",{src:zv("Aatrox"),alt:Dt,title:Dt,style:{background:"var(--bg-deep)"},onError:en=>{en.target.style.display="none"}},ut):W.jsx("div",{className:"lol-match-item-empty"},ut))}),W.jsxs("div",{className:"lol-match-meta",children:[W.jsx("div",{className:"lol-match-duration",children:jde(_e.game_length_second)}),W.jsx("div",{className:"lol-match-queue",children:Vde[_e.game_type]??_e.game_type}),W.jsxs("div",{className:"lol-match-ago",children:[g7(_e.created_at)," ago"]})]})]}),Be&&ke&&W.jsx("div",{className:"lol-match-detail",children:le(ke,(lt=De.summoner)==null?void 0:lt.game_name)})]},_e.id)},le=(_e,De)=>{var Be,ke,oe,Mt,lt;const pt=((Be=_e.participants)==null?void 0:Be.filter(Dt=>Dt.team_key==="BLUE"))??[],_t=((ke=_e.participants)==null?void 0:ke.filter(Dt=>Dt.team_key==="RED"))??[],wt=(lt=(Mt=(oe=_e.teams)==null?void 0:oe.find(Dt=>Dt.key==="BLUE"))==null?void 0:Mt.game_stat)==null?void 0:lt.is_win,Ge=(Dt,ut,en)=>W.jsxs("div",{className:"lol-match-detail-team",children:[W.jsxs("div",{className:`lol-match-detail-team-header ${ut?"win":"loss"}`,children:[en," — ",ut?"Victory":"Defeat"]}),Dt.map((St,fe)=>{var $e,it,tt,Vt,Bt,Wt,ln,Tt,Kt,rn,Ht,Ft;const Y=((it=($e=St.summoner)==null?void 0:$e.game_name)==null?void 0:it.toLowerCase())===(De==null?void 0:De.toLowerCase()),Ce=(((tt=St.stats)==null?void 0:tt.minion_kill)??0)+(((Vt=St.stats)==null?void 0:Vt.neutral_minion_kill)??0);return W.jsxs("div",{className:`lol-detail-row ${Y?"me":""}`,children:[W.jsx("img",{className:"lol-detail-champ",src:zv(St.champion_name),alt:St.champion_name}),W.jsx("span",{className:"lol-detail-name",title:`${(Bt=St.summoner)==null?void 0:Bt.game_name}#${(Wt=St.summoner)==null?void 0:Wt.tagline}`,children:((ln=St.summoner)==null?void 0:ln.game_name)??St.champion_name}),W.jsxs("span",{className:"lol-detail-kda",children:[(Tt=St.stats)==null?void 0:Tt.kill,"/",(Kt=St.stats)==null?void 0:Kt.death,"/",(rn=St.stats)==null?void 0:rn.assist]}),W.jsxs("span",{className:"lol-detail-cs",children:[Ce," CS"]}),W.jsxs("span",{className:"lol-detail-dmg",children:[((((Ht=St.stats)==null?void 0:Ht.total_damage_dealt_to_champions)??0)/1e3).toFixed(1),"k"]}),W.jsxs("span",{className:"lol-detail-gold",children:[((((Ft=St.stats)==null?void 0:Ft.gold_earned)??0)/1e3).toFixed(1),"k"]})]},fe)})]});return W.jsxs(W.Fragment,{children:[Ge(pt,wt,"Blue Team"),Ge(_t,wt===void 0?void 0:!wt,"Red Team")]})};return W.jsxs("div",{className:"lol-container",children:[W.jsxs("div",{className:"lol-search",children:[W.jsx("input",{ref:X,className:"lol-search-input",placeholder:"Summoner Name#Tag",value:e,onChange:_e=>t(_e.target.value),onKeyDown:_e=>_e.key==="Enter"&&se()}),W.jsx("select",{className:"lol-search-region",value:n,onChange:_e=>r(_e.target.value),children:s.map(_e=>W.jsx("option",{value:_e.code,children:_e.code},_e.code))}),W.jsx("button",{className:"lol-search-btn",onClick:()=>se(),disabled:v,children:v?"...":"Search"})]}),R.length>0&&W.jsx("div",{className:"lol-recent",children:R.map((_e,De)=>W.jsxs("button",{className:"lol-recent-chip",onClick:()=>he(_e),children:[_e.profile_image_url&&W.jsx("img",{src:_e.profile_image_url,alt:""}),_e.game_name,"#",_e.tag_line,_e.tier&&W.jsx("span",{className:"lol-recent-tier",style:{color:m7[_e.tier]},children:_e.tier})]},De))}),S&&W.jsx("div",{className:"lol-error",children:S}),v&&W.jsxs("div",{className:"lol-loading",children:[W.jsx("div",{className:"lol-spinner"}),"Lade Profil..."]}),l&&!v&&W.jsxs(W.Fragment,{children:[W.jsxs("div",{className:"lol-profile",children:[W.jsx("img",{className:"lol-profile-icon",src:l.profile_image_url,alt:""}),W.jsxs("div",{className:"lol-profile-info",children:[W.jsxs("h2",{children:[l.game_name,W.jsxs("span",{children:["#",l.tagline]})]}),W.jsxs("div",{className:"lol-profile-level",children:["Level ",l.level]}),((we=l.ladder_rank)==null?void 0:we.rank)&&W.jsxs("div",{className:"lol-profile-ladder",children:["Ladder Rank #",l.ladder_rank.rank.toLocaleString()," / ",(We=l.ladder_rank.total)==null?void 0:We.toLocaleString()]}),F&&W.jsxs("div",{className:"lol-profile-updated",children:["Updated ",g7(F)," ago"]})]}),W.jsxs("button",{className:`lol-update-btn ${k?"renewing":""}`,onClick:ne,disabled:k,title:"Refresh data from Riot servers",children:[W.jsx("span",{className:"lol-update-icon",children:k?"⟳":"↻"}),k?"Updating...":"Update"]})]}),W.jsx("div",{className:"lol-ranked-row",children:(l.league_stats??[]).filter(_e=>_e.game_type==="SOLORANKED"||_e.game_type==="FLEXRANKED").map(_e=>{const De=_e.tier_info,pt=!!(De!=null&&De.tier),_t=m7[(De==null?void 0:De.tier)??""]??"var(--text-normal)";return W.jsxs("div",{className:`lol-ranked-card ${pt?"has-rank":""}`,style:{"--tier-color":_t},children:[W.jsx("div",{className:"lol-ranked-type",children:_e.game_type==="SOLORANKED"?"Ranked Solo/Duo":"Ranked Flex"}),pt?W.jsxs(W.Fragment,{children:[W.jsxs("div",{className:"lol-ranked-tier",style:{color:_t},children:[Wde(De.tier,De.division),W.jsxs("span",{className:"lol-ranked-lp",children:[De.lp," LP"]})]}),W.jsxs("div",{className:"lol-ranked-record",children:[_e.win,"W ",_e.lose,"L",W.jsxs("span",{className:"lol-ranked-wr",children:["(",_7(_e.win??0,_e.lose??0),"%)"]}),_e.is_hot_streak&&W.jsx("span",{className:"lol-ranked-streak",children:"🔥"})]})]}):W.jsx("div",{className:"lol-ranked-tier",children:"Unranked"})]},_e.game_type)})}),((ze=(Te=l.most_champions)==null?void 0:Te.champion_stats)==null?void 0:ze.length)>0&&W.jsxs(W.Fragment,{children:[W.jsx("div",{className:"lol-section-title",children:"Top Champions"}),W.jsx("div",{className:"lol-champs",children:l.most_champions.champion_stats.slice(0,7).map(_e=>{const De=_7(_e.win,_e.lose),pt=_e.play>0?v7(_e.kill/_e.play,_e.death/_e.play,_e.assist/_e.play):"0";return W.jsxs("div",{className:"lol-champ-card",children:[W.jsx("img",{className:"lol-champ-icon",src:zv(_e.champion_name),alt:_e.champion_name}),W.jsxs("div",{children:[W.jsx("div",{className:"lol-champ-name",children:_e.champion_name}),W.jsxs("div",{className:"lol-champ-stats",children:[_e.play," games · ",De,"% WR"]}),W.jsxs("div",{className:"lol-champ-kda",children:[pt," KDA"]})]})]},_e.champion_name)})})]}),h.length>0&&W.jsxs(W.Fragment,{children:[W.jsx("div",{className:"lol-section-title",children:"Match History"}),W.jsx("div",{className:"lol-matches",children:h.map(_e=>Se(_e))}),h.length<20&&W.jsx("button",{className:"lol-load-more",onClick:Z,disabled:z,children:z?"Laden...":"Mehr laden"})]})]}),!l&&!v&&!S&&W.jsxs("div",{className:"lol-empty",children:[W.jsx("div",{className:"lol-empty-icon",children:"⚔️"}),W.jsx("h3",{children:"League of Legends Stats"}),W.jsx("p",{children:"Gib einen Summoner Name#Tag ein und wähle die Region"})]})]})}const y7={iceServers:[{urls:"stun:stun.l.google.com:19302"},{urls:"stun:stun1.l.google.com:19302"}]};function x7(i){const e=Math.max(0,Math.floor((Date.now()-new Date(i).getTime())/1e3)),t=Math.floor(e/3600),n=Math.floor(e%3600/60),r=e%60;return t>0?`${t}:${String(n).padStart(2,"0")}:${String(r).padStart(2,"0")}`:`${n}:${String(r).padStart(2,"0")}`}function Xde({data:i}){var _t,wt;const[e,t]=Ie.useState([]),[n,r]=Ie.useState(()=>localStorage.getItem("streaming_name")||""),[s,a]=Ie.useState("Screen Share"),[l,u]=Ie.useState(""),[h,g]=Ie.useState(null),[v,x]=Ie.useState(null),[S,w]=Ie.useState(null),[R,C]=Ie.useState(!1),[E,B]=Ie.useState(!1),[L,O]=Ie.useState(null),[,z]=Ie.useState(0),G=Ie.useRef(null),k=Ie.useRef(""),H=Ie.useRef(null),F=Ie.useRef(null),V=Ie.useRef(null),X=Ie.useRef(new Map),J=Ie.useRef(null),te=Ie.useRef(new Map),se=Ie.useRef(null),ne=Ie.useRef(1e3),Z=Ie.useRef(!1),ue=Ie.useRef(null);Ie.useEffect(()=>{Z.current=R},[R]),Ie.useEffect(()=>{ue.current=L},[L]),Ie.useEffect(()=>{if(!(e.length>0||R))return;const Be=setInterval(()=>z(ke=>ke+1),1e3);return()=>clearInterval(Be)},[e.length,R]),Ie.useEffect(()=>{i!=null&&i.streams&&t(i.streams)},[i]),Ie.useEffect(()=>{n&&localStorage.setItem("streaming_name",n)},[n]);const he=Ie.useCallback(Ge=>{var Be;((Be=G.current)==null?void 0:Be.readyState)===WebSocket.OPEN&&G.current.send(JSON.stringify(Ge))},[]),be=Ie.useCallback((Ge,Be,ke)=>{if(Ge.remoteDescription)Ge.addIceCandidate(new RTCIceCandidate(ke)).catch(()=>{});else{let oe=te.current.get(Be);oe||(oe=[],te.current.set(Be,oe)),oe.push(ke)}},[]),Se=Ie.useCallback((Ge,Be)=>{const ke=te.current.get(Be);if(ke){for(const oe of ke)Ge.addIceCandidate(new RTCIceCandidate(oe)).catch(()=>{});te.current.delete(Be)}},[]),le=Ie.useCallback(()=>{J.current&&(J.current.close(),J.current=null),V.current&&(V.current.srcObject=null),te.current.clear()},[]),we=Ie.useRef(()=>{});we.current=Ge=>{var Be;switch(Ge.type){case"welcome":k.current=Ge.clientId,Ge.streams&&t(Ge.streams);break;case"broadcast_started":w(Ge.streamId),C(!0),Z.current=!0,B(!1);break;case"stream_available":break;case"stream_ended":((Be=ue.current)==null?void 0:Be.streamId)===Ge.streamId&&(le(),O(null));break;case"viewer_joined":{const ke=Ge.viewerId,oe=X.current.get(ke);oe&&(oe.close(),X.current.delete(ke)),te.current.delete(ke);const Mt=new RTCPeerConnection(y7);X.current.set(ke,Mt);const lt=H.current;if(lt)for(const ut of lt.getTracks())Mt.addTrack(ut,lt);Mt.onicecandidate=ut=>{ut.candidate&&he({type:"ice_candidate",targetId:ke,candidate:ut.candidate.toJSON()})};const Dt=Mt.getSenders().find(ut=>{var en;return((en=ut.track)==null?void 0:en.kind)==="video"});if(Dt){const ut=Dt.getParameters();(!ut.encodings||ut.encodings.length===0)&&(ut.encodings=[{}]),ut.encodings[0].maxFramerate=60,ut.encodings[0].maxBitrate=8e6,Dt.setParameters(ut).catch(()=>{})}Mt.createOffer().then(ut=>Mt.setLocalDescription(ut)).then(()=>{he({type:"offer",targetId:ke,sdp:Mt.localDescription})}).catch(console.error);break}case"viewer_left":{const ke=X.current.get(Ge.viewerId);ke&&(ke.close(),X.current.delete(Ge.viewerId)),te.current.delete(Ge.viewerId);break}case"offer":{const ke=Ge.fromId;J.current&&(J.current.close(),J.current=null),te.current.delete(ke);const oe=new RTCPeerConnection(y7);J.current=oe,oe.ontrack=Mt=>{V.current&&Mt.streams[0]&&(V.current.srcObject=Mt.streams[0]),O(lt=>lt&&{...lt,phase:"connected"})},oe.onicecandidate=Mt=>{Mt.candidate&&he({type:"ice_candidate",targetId:ke,candidate:Mt.candidate.toJSON()})},oe.oniceconnectionstatechange=()=>{(oe.iceConnectionState==="failed"||oe.iceConnectionState==="disconnected")&&O(Mt=>Mt&&{...Mt,phase:"error",error:"Verbindung verloren"})},oe.setRemoteDescription(new RTCSessionDescription(Ge.sdp)).then(()=>(Se(oe,ke),oe.createAnswer())).then(Mt=>oe.setLocalDescription(Mt)).then(()=>{he({type:"answer",targetId:ke,sdp:oe.localDescription})}).catch(console.error);break}case"answer":{const ke=X.current.get(Ge.fromId);ke&&ke.setRemoteDescription(new RTCSessionDescription(Ge.sdp)).then(()=>Se(ke,Ge.fromId)).catch(console.error);break}case"ice_candidate":{if(!Ge.candidate)break;if(Z.current){const ke=X.current.get(Ge.fromId);ke&&be(ke,Ge.fromId,Ge.candidate)}else{const ke=J.current;ke&&be(ke,Ge.fromId,Ge.candidate)}break}case"error":Ge.code==="WRONG_PASSWORD"?x(ke=>ke&&{...ke,error:Ge.message}):g(Ge.message),B(!1);break}};const We=Ie.useCallback(()=>{if(G.current&&G.current.readyState===WebSocket.OPEN)return;const Ge=location.protocol==="https:"?"wss":"ws",Be=new WebSocket(`${Ge}://${location.host}/ws/streaming`);G.current=Be,Be.onopen=()=>{ne.current=1e3},Be.onmessage=ke=>{let oe;try{oe=JSON.parse(ke.data)}catch{return}we.current(oe)},Be.onclose=()=>{G.current=null,(Z.current||ue.current)&&(se.current=setTimeout(()=>{ne.current=Math.min(ne.current*2,1e4),We()},ne.current))},Be.onerror=()=>{Be.close()}},[]),Te=Ie.useCallback(async()=>{var Ge,Be;if(!n.trim()){g("Bitte gib einen Namen ein.");return}if(!l.trim()){g("Passwort ist Pflicht.");return}if(!((Ge=navigator.mediaDevices)!=null&&Ge.getDisplayMedia)){g("Dein Browser unterstützt keine Bildschirmfreigabe.");return}g(null),B(!0);try{const ke=await navigator.mediaDevices.getDisplayMedia({video:{frameRate:{ideal:60},width:{ideal:1920},height:{ideal:1080}},audio:!0});H.current=ke,F.current&&(F.current.srcObject=ke),(Be=ke.getVideoTracks()[0])==null||Be.addEventListener("ended",()=>{ze()}),We();const oe=()=>{var Mt;((Mt=G.current)==null?void 0:Mt.readyState)===WebSocket.OPEN?he({type:"start_broadcast",name:n.trim(),title:s.trim()||"Screen Share",password:l.trim()}):setTimeout(oe,100)};oe()}catch(ke){B(!1),ke.name==="NotAllowedError"?g("Bildschirmfreigabe wurde abgelehnt."):g(`Fehler: ${ke.message}`)}},[n,s,l,We,he]),ze=Ie.useCallback(()=>{var Ge;he({type:"stop_broadcast"}),(Ge=H.current)==null||Ge.getTracks().forEach(Be=>Be.stop()),H.current=null,F.current&&(F.current.srcObject=null);for(const Be of X.current.values())Be.close();X.current.clear(),te.current.clear(),C(!1),Z.current=!1,w(null),u("")},[he]),_e=Ie.useCallback(Ge=>{x({streamId:Ge.id,streamTitle:Ge.title,broadcasterName:Ge.broadcasterName,password:"",error:null})},[]),De=Ie.useCallback(()=>{if(!v)return;if(!v.password.trim()){x(oe=>oe&&{...oe,error:"Passwort eingeben."});return}const{streamId:Ge,password:Be}=v;x(null),g(null),O({streamId:Ge,phase:"connecting"}),We();const ke=()=>{var oe;((oe=G.current)==null?void 0:oe.readyState)===WebSocket.OPEN?he({type:"join_viewer",name:n.trim()||"Viewer",streamId:Ge,password:Be.trim()}):setTimeout(ke,100)};ke()},[v,n,We,he]),pt=Ie.useCallback(()=>{he({type:"leave_viewer"}),le(),O(null)},[le,he]);if(Ie.useEffect(()=>()=>{var Ge;(Ge=H.current)==null||Ge.getTracks().forEach(Be=>Be.stop());for(const Be of X.current.values())Be.close();J.current&&J.current.close(),G.current&&G.current.close(),se.current&&clearTimeout(se.current)},[]),L){const Ge=e.find(Be=>Be.id===L.streamId);return W.jsxs("div",{className:"stream-viewer-overlay",children:[W.jsxs("div",{className:"stream-viewer-header",children:[W.jsxs("div",{className:"stream-viewer-header-left",children:[W.jsxs("span",{className:"stream-live-badge",children:[W.jsx("span",{className:"stream-live-dot"})," LIVE"]}),W.jsxs("div",{children:[W.jsx("div",{className:"stream-viewer-title",children:(Ge==null?void 0:Ge.title)||"Stream"}),W.jsxs("div",{className:"stream-viewer-subtitle",children:[(Ge==null?void 0:Ge.broadcasterName)||"..."," ",Ge?`· ${Ge.viewerCount} Zuschauer`:""]})]})]}),W.jsx("button",{className:"stream-viewer-close",onClick:pt,children:"Verlassen"})]}),W.jsxs("div",{className:"stream-viewer-video",children:[L.phase==="connecting"?W.jsxs("div",{className:"stream-viewer-connecting",children:[W.jsx("div",{className:"stream-viewer-spinner"}),"Verbindung wird hergestellt..."]}):L.phase==="error"?W.jsxs("div",{className:"stream-viewer-connecting",children:[L.error||"Verbindungsfehler",W.jsx("button",{className:"stream-btn",onClick:pt,children:"Zur\\u00FCck"})]}):null,W.jsx("video",{ref:V,autoPlay:!0,playsInline:!0,style:L.phase==="connected"?{}:{display:"none"}})]})]})}return W.jsxs("div",{className:"stream-container",children:[h&&W.jsxs("div",{className:"stream-error",children:[h,W.jsx("button",{className:"stream-error-dismiss",onClick:()=>g(null),children:"×"})]}),W.jsxs("div",{className:"stream-topbar",children:[W.jsx("input",{className:"stream-input stream-input-name",placeholder:"Dein Name",value:n,onChange:Ge=>r(Ge.target.value),disabled:R}),W.jsx("input",{className:"stream-input stream-input-title",placeholder:"Stream-Titel",value:s,onChange:Ge=>a(Ge.target.value),disabled:R}),W.jsx("input",{className:"stream-input stream-input-password",type:"password",placeholder:"Passwort",value:l,onChange:Ge=>u(Ge.target.value),disabled:R}),R?W.jsxs("button",{className:"stream-btn stream-btn-stop",onClick:ze,children:["⏹"," Stream beenden"]}):W.jsx("button",{className:"stream-btn",onClick:Te,disabled:E,children:E?"Starte...":"🖥️ Stream starten"})]}),e.length===0&&!R?W.jsxs("div",{className:"stream-empty",children:[W.jsx("div",{className:"stream-empty-icon",children:"📺"}),W.jsx("h3",{children:"Keine aktiven Streams"}),W.jsx("p",{children:"Starte einen Stream, um deinen Bildschirm zu teilen."})]}):W.jsxs("div",{className:"stream-grid",children:[R&&W.jsxs("div",{className:"stream-tile own broadcasting",children:[W.jsxs("div",{className:"stream-tile-preview",children:[W.jsx("video",{ref:F,autoPlay:!0,playsInline:!0,muted:!0}),W.jsxs("span",{className:"stream-live-badge",children:[W.jsx("span",{className:"stream-live-dot"})," LIVE"]}),W.jsxs("span",{className:"stream-tile-viewers",children:["👥"," ",((_t=e.find(Ge=>Ge.id===S))==null?void 0:_t.viewerCount)??0]})]}),W.jsxs("div",{className:"stream-tile-info",children:[W.jsxs("div",{className:"stream-tile-meta",children:[W.jsxs("div",{className:"stream-tile-name",children:[n," (Du)"]}),W.jsx("div",{className:"stream-tile-title",children:s})]}),W.jsx("span",{className:"stream-tile-time",children:S&&((wt=e.find(Ge=>Ge.id===S))!=null&&wt.startedAt)?x7(e.find(Ge=>Ge.id===S).startedAt):"0:00"})]})]}),e.filter(Ge=>Ge.id!==S).map(Ge=>W.jsxs("div",{className:"stream-tile",onClick:()=>_e(Ge),children:[W.jsxs("div",{className:"stream-tile-preview",children:[W.jsx("span",{className:"stream-tile-icon",children:"🖥️"}),W.jsxs("span",{className:"stream-live-badge",children:[W.jsx("span",{className:"stream-live-dot"})," LIVE"]}),W.jsxs("span",{className:"stream-tile-viewers",children:["👥"," ",Ge.viewerCount]}),Ge.hasPassword&&W.jsx("span",{className:"stream-tile-lock",children:"🔒"})]}),W.jsxs("div",{className:"stream-tile-info",children:[W.jsxs("div",{className:"stream-tile-meta",children:[W.jsx("div",{className:"stream-tile-name",children:Ge.broadcasterName}),W.jsx("div",{className:"stream-tile-title",children:Ge.title})]}),W.jsx("span",{className:"stream-tile-time",children:x7(Ge.startedAt)}),W.jsx("button",{className:"stream-tile-menu",onClick:Be=>Be.stopPropagation(),children:"⋮"})]})]},Ge.id))]}),v&&W.jsx("div",{className:"stream-pw-overlay",onClick:()=>x(null),children:W.jsxs("div",{className:"stream-pw-modal",onClick:Ge=>Ge.stopPropagation(),children:[W.jsx("h3",{children:v.broadcasterName}),W.jsx("p",{children:v.streamTitle}),v.error&&W.jsx("div",{className:"stream-pw-modal-error",children:v.error}),W.jsx("input",{className:"stream-input",type:"password",placeholder:"Stream-Passwort",value:v.password,onChange:Ge=>x(Be=>Be&&{...Be,password:Ge.target.value,error:null}),onKeyDown:Ge=>{Ge.key==="Enter"&&De()},autoFocus:!0}),W.jsxs("div",{className:"stream-pw-actions",children:[W.jsx("button",{className:"stream-pw-cancel",onClick:()=>x(null),children:"Abbrechen"}),W.jsx("button",{className:"stream-btn",onClick:De,children:"Beitreten"})]})]})})]})}const Yde={radio:xde,soundboard:qde,lolstats:$de,streaming:Xde};function Qde(){const[i,e]=Ie.useState(!1),[t,n]=Ie.useState([]),[r,s]=Ie.useState(()=>localStorage.getItem("hub_activeTab")??""),a=x=>{s(x),localStorage.setItem("hub_activeTab",x)},[l,u]=Ie.useState({}),h=Ie.useRef(null);Ie.useEffect(()=>{fetch("/api/plugins").then(x=>x.json()).then(x=>{n(x);const S=localStorage.getItem("hub_activeTab"),w=x.some(R=>R.name===S);x.length>0&&!w&&a(x[0].name)}).catch(()=>{})},[]),Ie.useEffect(()=>{let x=null,S;function w(){x=new EventSource("/api/events"),h.current=x,x.onopen=()=>e(!0),x.onmessage=R=>{try{const C=JSON.parse(R.data);C.type==="snapshot"?u(E=>({...E,...C})):C.plugin&&u(E=>({...E,[C.plugin]:{...E[C.plugin]||{},...C}}))}catch{}},x.onerror=()=>{e(!1),x==null||x.close(),S=setTimeout(w,3e3)}}return w(),()=>{x==null||x.close(),clearTimeout(S)}},[]);const g="1.0.0-dev",v={radio:"🌍",soundboard:"🎵",lolstats:"⚔️",stats:"📊",events:"📅",games:"🎲",gamevote:"🎮",streaming:"📺"};return W.jsxs("div",{className:"hub-app",children:[W.jsxs("header",{className:"hub-header",children:[W.jsxs("div",{className:"hub-header-left",children:[W.jsx("span",{className:"hub-logo",children:"🎮"}),W.jsx("span",{className:"hub-title",children:"Gaming Hub"}),W.jsx("span",{className:`hub-conn-dot ${i?"online":""}`})]}),W.jsx("nav",{className:"hub-tabs",children:t.map(x=>W.jsxs("button",{className:`hub-tab ${r===x.name?"active":""}`,onClick:()=>a(x.name),title:x.description,children:[W.jsx("span",{className:"hub-tab-icon",children:v[x.name]??"📦"}),W.jsx("span",{className:"hub-tab-label",children:x.name})]},x.name))}),W.jsx("div",{className:"hub-header-right",children:W.jsxs("span",{className:"hub-version",children:["v",g]})})]}),W.jsx("main",{className:"hub-content",children:t.length===0?W.jsxs("div",{className:"hub-empty",children:[W.jsx("span",{className:"hub-empty-icon",children:"📦"}),W.jsx("h2",{children:"Keine Plugins geladen"}),W.jsx("p",{children:"Plugins werden im Server konfiguriert."})]}):t.map(x=>{const S=Yde[x.name];if(!S)return null;const w=r===x.name;return W.jsx("div",{className:`hub-tab-panel ${w?"active":""}`,style:w?{display:"flex",flexDirection:"column",width:"100%",height:"100%"}:{display:"none"},children:W.jsx(S,{data:l[x.name]||{}})},x.name)})})]})}PF.createRoot(document.getElementById("root")).render(W.jsx(Qde,{})); diff --git a/web/dist/index.html b/web/dist/index.html index 0fb83e4..a593dca 100644 --- a/web/dist/index.html +++ b/web/dist/index.html @@ -5,7 +5,7 @@ Gaming Hub - + diff --git a/web/src/plugins/streaming/StreamingTab.tsx b/web/src/plugins/streaming/StreamingTab.tsx index 8fd498d..7661fef 100644 --- a/web/src/plugins/streaming/StreamingTab.tsx +++ b/web/src/plugins/streaming/StreamingTab.tsx @@ -197,6 +197,18 @@ export default function StreamingTab({ data }: { data: any }) { } }; + // Boost encoding: 60 fps + higher bitrate for smooth video + const videoSender = pc.getSenders().find(s => s.track?.kind === 'video'); + if (videoSender) { + const params = videoSender.getParameters(); + if (!params.encodings || params.encodings.length === 0) { + params.encodings = [{}]; + } + params.encodings[0].maxFramerate = 60; + params.encodings[0].maxBitrate = 8_000_000; // 8 Mbps + videoSender.setParameters(params).catch(() => {}); + } + // Single offer (no onnegotiationneeded — tracks already added above) pc.createOffer() .then(offer => pc.setLocalDescription(offer)) @@ -350,7 +362,7 @@ export default function StreamingTab({ data }: { data: any }) { try { const stream = await navigator.mediaDevices.getDisplayMedia({ - video: true, + video: { frameRate: { ideal: 60 }, width: { ideal: 1920 }, height: { ideal: 1080 } }, audio: true, }); localStreamRef.current = stream;